diff --git a/.gitignore b/.gitignore index 520ca9b5..46730cc4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies -/node_modules -/studio/node_modules +node_modules /.pnp .pnp.js .yarn/install-state.gz diff --git a/GEMINI.md b/GEMINI.md deleted file mode 100644 index 2ab79132..00000000 --- a/GEMINI.md +++ /dev/null @@ -1,34 +0,0 @@ -# Project Overview - -This is a Next.js project for the CodingCat.dev website. It's a platform for podcasts, courses, and blog posts, built with a modern tech stack. - -## Key Technologies - -* **Framework:** [Next.js](https://nextjs.org/) (React framework) -* **CMS:** [Sanity.io](https://www.sanity.io/) (headless CMS) -* **Styling:** [Tailwind CSS](https://tailwindcss.com/) -* **UI Components:** [Radix UI](https://www.radix-ui.com/) -* **Search:** [Algolia](https://www.algolia.com/) -* **Deployment:** Vercel - -## Architecture - -The project follows a standard Next.js app directory structure. It uses Sanity for content management, with a dedicated Sanity Studio at the `/studio` route. The frontend is built with React and Tailwind CSS, and it uses various libraries for UI components, search, and more. - -# Building and Running - -## Key Commands - -* **`pnpm dev`**: Starts the development server. -* **`pnpm build`**: Builds the application for production. -* **`pnpm start`**: Starts the production server. -* **`pnpm lint`**: Lints the code. -* **`pnpm format`**: Formats the code with Biome. - -## Development Conventions - -* **Content Management:** All content is managed through Sanity. The schema is defined in the `sanity/schemas` directory. -* **Styling:** The project uses Tailwind CSS for styling. -* **UI Components:** The project uses Radix UI for accessible UI components. -* **Code Formatting:** The project uses Biome for code formatting. -* **Language:** All components should be React and TypeScript should be used everywhere. diff --git a/app/(sanity)/icon.svg b/app/(sanity)/icon.svg deleted file mode 100644 index 1beaa9b7..00000000 --- a/app/(sanity)/icon.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/app/(sanity)/layout.tsx b/app/(sanity)/layout.tsx deleted file mode 100644 index cea5ea88..00000000 --- a/app/(sanity)/layout.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import "../globals.css"; - -import type { Metadata } from "next"; -import { Inter } from "next/font/google"; -import { metadata as studioMetadata, viewport } from "next-sanity/studio"; - -const inter = Inter({ - variable: "--font-inter", - subsets: ["latin"], - display: "swap", -}); - -export { viewport }; - -export const metadata: Metadata = { - ...studioMetadata, - icons: { - icon: "/sanity-icons/icon.ico", - apple: "/sanity-icons/apple-icon.png", - }, -}; - -export default function RootLayout({ - children, -}: { - children: React.ReactNode; -}) { - return ( - - {children} - - ); -} diff --git a/app/(sanity)/studio/[[...tool]]/page.tsx b/app/(sanity)/studio/[[...tool]]/page.tsx deleted file mode 100644 index 2369e743..00000000 --- a/app/(sanity)/studio/[[...tool]]/page.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { NextStudio } from "next-sanity/studio"; -import config from "@/sanity.config"; - -export const dynamic = "force-static"; - -export { metadata, viewport } from "next-sanity/studio"; - -export default function StudioPage() { - return ; -} diff --git a/apps/studio/.sanity/runtime/app.js b/apps/studio/.sanity/runtime/app.js new file mode 100644 index 00000000..fd6d55ae --- /dev/null +++ b/apps/studio/.sanity/runtime/app.js @@ -0,0 +1,11 @@ + +// This file is auto-generated on 'sanity dev' +// Modifications to this file are automatically discarded +import studioConfig from "../../sanity.config.ts" +import {renderStudio} from "sanity" + +renderStudio( + document.getElementById("sanity"), + studioConfig, + {reactStrictMode: false, basePath: "/"} +) diff --git a/apps/studio/.sanity/runtime/index.html b/apps/studio/.sanity/runtime/index.html new file mode 100644 index 00000000..79010111 --- /dev/null +++ b/apps/studio/.sanity/runtime/index.html @@ -0,0 +1,253 @@ + + +Sanity Studio +
\ No newline at end of file diff --git a/apps/studio/dist/favicon.ico b/apps/studio/dist/favicon.ico new file mode 100644 index 00000000..598a8a8c Binary files /dev/null and b/apps/studio/dist/favicon.ico differ diff --git a/apps/studio/dist/index.html b/apps/studio/dist/index.html new file mode 100644 index 00000000..8048429d --- /dev/null +++ b/apps/studio/dist/index.html @@ -0,0 +1,248 @@ +Sanity Studio +
\ No newline at end of file diff --git a/apps/studio/dist/static/BroadcastDisplayedDocument-BDnTNiR0.js b/apps/studio/dist/static/BroadcastDisplayedDocument-BDnTNiR0.js new file mode 100644 index 00000000..a4d4b84d --- /dev/null +++ b/apps/studio/dist/static/BroadcastDisplayedDocument-BDnTNiR0.js @@ -0,0 +1 @@ +import{r,c as m,bZ as n}from"./sanity-BZuh2pfi.js";import{u as i}from"./DisplayedDocumentBroadcaster-DEHqxDA2.js";function d(t){const e=m.c(7),a=i(),c=n();let u;e[0]!==t.value||e[1]!==a?(u=()=>{const l=setTimeout(()=>a?.(t.value),10);return()=>clearTimeout(l)},e[0]=t.value,e[1]=a,e[2]=u):u=e[2];const o=c?.perspective;let s;return e[3]!==t.value||e[4]!==a||e[5]!==o?(s=[o,t.value,a],e[3]=t.value,e[4]=a,e[5]=o,e[6]=s):s=e[6],r.useEffect(u,s),null}var f=r.memo(d);export{f as default}; diff --git a/apps/studio/dist/static/CodeMirrorProxy-MXSjwa3c.js b/apps/studio/dist/static/CodeMirrorProxy-MXSjwa3c.js new file mode 100644 index 00000000..add2125f --- /dev/null +++ b/apps/studio/dist/static/CodeMirrorProxy-MXSjwa3c.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["static/index-ByKwSaqq.js","static/index-9VbysdZK.js","static/index-DznCqw2V.js","static/sanity-BZuh2pfi.js","static/index-BgOink5e.js","static/index-BFSXaxBx.js","static/index-Cvg-Ecpa.js","static/index-Dl4iEQF-.js","static/index-CEID5mKn.js","static/index-DEKWc3j5.js","static/sass-BR7ksiGk.js","static/css-Bt2UjfAg.js"])))=>i.map(i=>d[i]); +import{r as f,c as p,aj as G,j as Y,G as J,ak as u,E as Z,al as ee,am as l}from"./sanity-BZuh2pfi.js";import{o as b,H as te,s as oe,R as re,t as c,l as ne,S as ae,D as C,p as W,q as m}from"./index-DznCqw2V.js";var ie=e=>{var{theme:n,settings:t={},styles:i=[]}=e,o={".cm-gutters":{}},a={};t.background&&(a.backgroundColor=t.background),t.backgroundImage&&(a.backgroundImage=t.backgroundImage),t.foreground&&(a.color=t.foreground),t.fontSize&&(a.fontSize=t.fontSize),(t.background||t.foreground)&&(o["&"]=a),t.fontFamily&&(o["&.cm-editor .cm-scroller"]={fontFamily:t.fontFamily}),t.gutterBackground&&(o[".cm-gutters"].backgroundColor=t.gutterBackground),t.gutterForeground&&(o[".cm-gutters"].color=t.gutterForeground),t.gutterBorder&&(o[".cm-gutters"].borderRightColor=t.gutterBorder),t.caret&&(o[".cm-content"]={caretColor:t.caret},o[".cm-cursor, .cm-dropCursor"]={borderLeftColor:t.caret});var r={};t.gutterActiveForeground&&(r.color=t.gutterActiveForeground),t.lineHighlight&&(o[".cm-activeLine"]={backgroundColor:t.lineHighlight},r.backgroundColor=t.lineHighlight),o[".cm-activeLineGutter"]=r,t.selection&&(o["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:t.selection+" !important"}),t.selectionMatch&&(o["& .cm-selectionMatch"]={backgroundColor:t.selectionMatch});var s=b.theme(o,{dark:n==="dark"}),g=te.define(i),d=[s,oe(g)];return d};const ce=[{name:"groq",loader:()=>l(async()=>{const{javascriptLanguage:e}=await import("./index-ByKwSaqq.js");return{javascriptLanguage:e}},__vite__mapDeps([0,1,2,3])).then(({javascriptLanguage:e})=>e)},{name:"javascript",loader:()=>l(async()=>{const{javascript:e}=await import("./index-ByKwSaqq.js");return{javascript:e}},__vite__mapDeps([0,1,2,3])).then(({javascript:e})=>e({jsx:!1}))},{name:"jsx",loader:()=>l(async()=>{const{javascript:e}=await import("./index-ByKwSaqq.js");return{javascript:e}},__vite__mapDeps([0,1,2,3])).then(({javascript:e})=>e({jsx:!0}))},{name:"typescript",loader:()=>l(async()=>{const{javascript:e}=await import("./index-ByKwSaqq.js");return{javascript:e}},__vite__mapDeps([0,1,2,3])).then(({javascript:e})=>e({jsx:!1,typescript:!0}))},{name:"tsx",loader:()=>l(async()=>{const{javascript:e}=await import("./index-ByKwSaqq.js");return{javascript:e}},__vite__mapDeps([0,1,2,3])).then(({javascript:e})=>e({jsx:!0,typescript:!0}))},{name:"php",loader:()=>l(async()=>{const{php:e}=await import("./index-BgOink5e.js");return{php:e}},__vite__mapDeps([4,1,2,3,5,0])).then(({php:e})=>e())},{name:"sql",loader:()=>l(async()=>{const{sql:e}=await import("./index-Cvg-Ecpa.js");return{sql:e}},__vite__mapDeps([6,2,3,1])).then(({sql:e})=>e())},{name:"mysql",loader:()=>l(async()=>{const{sql:e,MySQL:n}=await import("./index-Cvg-Ecpa.js");return{sql:e,MySQL:n}},__vite__mapDeps([6,2,3,1])).then(({sql:e,MySQL:n})=>e({dialect:n}))},{name:"json",loader:()=>l(async()=>{const{json:e}=await import("./index-Dl4iEQF-.js");return{json:e}},__vite__mapDeps([7,1,2,3])).then(({json:e})=>e())},{name:"markdown",loader:()=>l(async()=>{const{markdown:e}=await import("./index-CEID5mKn.js");return{markdown:e}},__vite__mapDeps([8,2,3,5,1,0])).then(({markdown:e})=>e())},{name:"java",loader:()=>l(async()=>{const{java:e}=await import("./index-DEKWc3j5.js");return{java:e}},__vite__mapDeps([9,1,2,3])).then(({java:e})=>e())},{name:"html",loader:()=>l(async()=>{const{html:e}=await import("./index-BFSXaxBx.js");return{html:e}},__vite__mapDeps([5,1,2,3,0])).then(({html:e})=>e())},{name:"csharp",loader:()=>l(async()=>{const{csharp:e}=await import("./clike-CjuBxE1O.js");return{csharp:e}},[]).then(({csharp:e})=>m.define(e))},{name:"sh",loader:()=>l(async()=>{const{shell:e}=await import("./shell-CjFT_Tl9.js");return{shell:e}},[]).then(({shell:e})=>m.define(e))},{name:"css",loader:()=>l(async()=>{const{css:e}=await import("./css-Bt2UjfAg.js");return{css:e}},[]).then(({css:e})=>m.define(e))},{name:"scss",loader:()=>l(async()=>{const{css:e}=await import("./css-Bt2UjfAg.js");return{css:e}},[]).then(({css:e})=>m.define(e))},{name:"sass",loader:()=>l(async()=>{const{sass:e}=await import("./sass-BR7ksiGk.js");return{sass:e}},__vite__mapDeps([10,11])).then(({sass:e})=>m.define(e))},{name:"ruby",loader:()=>l(async()=>{const{ruby:e}=await import("./ruby-B2Rjki9n.js");return{ruby:e}},[]).then(({ruby:e})=>m.define(e))},{name:"python",loader:()=>l(async()=>{const{python:e}=await import("./python-jWMSN8OU.js");return{python:e}},[]).then(({python:e})=>m.define(e))},{name:"xml",loader:()=>l(async()=>{const{xml:e}=await import("./xml-BFMHta2a.js");return{xml:e}},[]).then(({xml:e})=>m.define(e))},{name:"yaml",loader:()=>l(async()=>{const{yaml:e}=await import("./yaml-DsCXHVTH.js");return{yaml:e}},[]).then(({yaml:e})=>m.define(e))},{name:"golang",loader:()=>l(async()=>{const{go:e}=await import("./go-CTD25R5P.js");return{go:e}},[]).then(({go:e})=>m.define(e))},{name:"text",loader:()=>{}},{name:"batch",loader:()=>{}}];function Q(e){return e.tone!=="neutral"&&e.tone!=="suggest"?e.tone:e.tone==="neutral"?"default":"primary"}const O="cm-highlight-line",B=W.define(),z=W.define(),F=ae.define({create(){return C.none},update(e,n){e=e.map(n.changes);for(const t of n.effects)t.is(B)&&(e=e.update({add:[q.range(t.value)]})),t.is(z)&&(e=e.update({filter:i=>i!==t.value}));return e},toJSON(e,n){const t=[],i=e.iter();for(;i.value;){const o=n.doc.lineAt(i.from).number;t.includes(o)||t.push(o),i.next()}return t},fromJSON(e,n){const t=n.doc.lines,i=e.filter(o=>o<=t).map(o=>q.range(n.doc.line(o).from));i.sort((o,a)=>o.from-a.from);try{return C.none.update({add:i})}catch(o){return console.error(o),C.none}},provide:e=>b.decorations.from(e)}),q=C.line({class:O}),K={highlight:F};function se(e){const{themeCtx:n}=e,t=Q(n),i={color:n.theme.color.dark[t]},o={color:n.theme.color.light[t]};return b.baseTheme({".cm-lineNumbers":{cursor:"default"},".cm-line.cm-line":{position:"relative"},[`.${O}::before`]:{position:"absolute",top:0,bottom:0,left:0,right:0,zIndex:-3,content:"''",boxSizing:"border-box"},[`&dark .${O}::before`]:{background:u(i.color.muted.caution.pressed.bg,.5)},[`&light .${O}::before`]:{background:u(o.color.muted.caution.pressed.bg,.75)}})}const le=e=>{const n=se({themeCtx:e.theme});return[F,e.readOnly?[]:ne({domEventHandlers:{mousedown:(t,i)=>{const o=t.state.doc.lineAt(i.from);let a=!1;return t.state.field(F).between(o.from,o.to,(r,s,g)=>{if(g)return a=!0,!1}),a?t.dispatch({effects:z.of(o.from)}):t.dispatch({effects:B.of(o.from)}),e?.onHighlightChange&&e.onHighlightChange(t.state.toJSON(K).highlight),!0}}}),n]};function de(e,n){const t=e.state.doc,i=t.lines,o=Array.from({length:i},(a,r)=>r+1);e.dispatch({effects:o.map(a=>{const r=t.line(a);return n?.includes(a)?B.of(r.from):z.of(r.from)})})}function ge(){const e=p.c(6),n=G();let t;e[0]!==n?(t=Q(n),e[0]=n,e[1]=t):t=e[1];const i=t,o=n.theme.color.dark[i];let a;if(e[2]!==i||e[3]!==o||e[4]!==n.theme.color.light){const r={color:o},s={color:n.theme.color.light[i]};a=b.baseTheme({"&.cm-editor":{height:"100%"},"&.cm-editor.cm-focused":{outline:"none"},"&.cm-editor.cm-focused .cm-matchingBracket":{backgroundColor:"transparent"},"&.cm-editor.cm-focused .cm-nonmatchingBracket":{backgroundColor:"transparent"},"&dark.cm-editor.cm-focused .cm-matchingBracket":{outline:`1px solid ${r.color.base.border}`},"&dark.cm-editor.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${r.color.base.border}`},"&light.cm-editor.cm-focused .cm-matchingBracket":{outline:`1px solid ${s.color.base.border}`},"&light.cm-editor.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${s.color.base.border}`},"& .cm-lineNumbers .cm-gutterElement":{minWidth:"32px !important",padding:"0 8px !important"},"& .cm-gutter.cm-foldGutter":{width:"0px !important"},"&dark .cm-gutters":{color:`${u(r.color.card.enabled.code.fg,.5)} !important`,borderRight:`1px solid ${u(r.color.base.border,.5)}`},"&light .cm-gutters":{color:`${u(s.color.card.enabled.code.fg,.5)} !important`,borderRight:`1px solid ${u(s.color.base.border,.5)}`}}),e[2]=i,e[3]=o,e[4]=n.theme.color.light,e[5]=a}else a=e[5];return a}function me(){const e=p.c(19),n=J(),{code:t}=n.sanity.fonts,{base:i,card:o,dark:a,syntax:r}=n.sanity.color,s=a?"dark":"light";let g;return e[0]!==i.focusRing||e[1]!==o.disabled.bg||e[2]!==o.disabled.code.fg||e[3]!==o.enabled.bg||e[4]!==o.enabled.code.fg||e[5]!==o.enabled.fg||e[6]!==t.family||e[7]!==r.attrName||e[8]!==r.boolean||e[9]!==r.className||e[10]!==r.comment||e[11]!==r.function||e[12]!==r.keyword||e[13]!==r.number||e[14]!==r.operator||e[15]!==r.property||e[16]!==r.string||e[17]!==s?(g=ie({theme:s,settings:{background:o.enabled.bg,foreground:o.enabled.code.fg,lineHighlight:o.enabled.bg,fontFamily:t.family,caret:i.focusRing,selection:u(i.focusRing,.2),selectionMatch:u(i.focusRing,.4),gutterBackground:o.disabled.bg,gutterForeground:o.disabled.code.fg,gutterActiveForeground:o.enabled.fg},styles:[{tag:[c.heading,c.heading2,c.heading3,c.heading4,c.heading5,c.heading6],color:o.enabled.fg},{tag:c.angleBracket,color:o.enabled.code.fg},{tag:c.atom,color:r.keyword},{tag:c.attributeName,color:r.attrName},{tag:c.bool,color:r.boolean},{tag:c.bracket,color:o.enabled.code.fg},{tag:c.className,color:r.className},{tag:c.comment,color:r.comment},{tag:c.definition(c.typeName),color:r.function},{tag:[c.definition(c.variableName),c.function(c.variableName),c.className,c.attributeName],color:r.function},{tag:[c.function(c.propertyName),c.propertyName],color:r.function},{tag:c.keyword,color:r.keyword},{tag:c.null,color:r.number},{tag:c.number,color:r.number},{tag:c.meta,color:o.enabled.code.fg},{tag:c.operator,color:r.operator},{tag:c.propertyName,color:r.property},{tag:[c.string,c.special(c.brace)],color:r.string},{tag:c.tagName,color:r.className},{tag:c.typeName,color:r.keyword}]}),e[0]=i.focusRing,e[1]=o.disabled.bg,e[2]=o.disabled.code.fg,e[3]=o.enabled.bg,e[4]=o.enabled.code.fg,e[5]=o.enabled.fg,e[6]=t.family,e[7]=r.attrName,e[8]=r.boolean,e[9]=r.className,e[10]=r.comment,e[11]=r.function,e[12]=r.keyword,e[13]=r.number,e[14]=r.operator,e[15]=r.property,e[16]=r.string,e[17]=s,e[18]=g):g=e[18],g}function ue(e){const n=p.c(3),{fontSize:t}=e,i=J(),{code:o}=i.sanity.fonts,{fontSize:a,lineHeight:r}=o.sizes[t]||o.sizes[2];let s;return n[0]!==a||n[1]!==r?(s=b.baseTheme({"&":{fontSize:Z(a)},"& .cm-scroller":{lineHeight:`${r/a} !important`}}),n[0]=a,n[1]=r,n[2]=s):s=n[2],s}const be=f.forwardRef(function(e,n){const t=p.c(41);let i,o,a,r,s,g,d;t[0]!==e?({basicSetup:i,highlightLines:a,languageMode:r,onHighlightChange:s,readOnly:g,value:d,...o}=e,t[0]=e,t[1]=i,t[2]=o,t[3]=a,t[4]=r,t[5]=s,t[6]=g,t[7]=d):(i=t[1],o=t[2],a=t[3],r=t[4],s=t[5],g=t[6],d=t[7]);const P=G(),I=me(),[h,U]=f.useState(void 0),N=ge();let y;t[8]===Symbol.for("react.memo_cache_sentinel")?(y={fontSize:1},t[8]=y):y=t[8];const D=ue(y),E=he(r);let v;t[9]!==s||t[10]!==g||t[11]!==P?(v=le({onHighlightChange:s,readOnly:g,theme:P}),t[9]=s,t[10]=g,t[11]=P,t[12]=v):v=t[12];const V=v;let j;e:{let _;t[13]!==D||t[14]!==V||t[15]!==N?(_=[N,D,V,b.lineWrapping],t[13]=D,t[14]=V,t[15]=N,t[16]=_):_=t[16];const S=_;if(E){let A;t[17]!==S||t[18]!==E?(A=[...S,E],t[17]=S,t[18]=E,t[19]=A):A=t[19],j=A;break e}j=S}const H=j;let k;t[20]!==h||t[21]!==a?(k=()=>{h&&de(h,a??[])},t[20]=h,t[21]=a,t[22]=k):k=t[22];let x;t[23]!==h||t[24]!==a||t[25]!==d?(x=[h,a,d],t[23]=h,t[24]=a,t[25]=d,t[26]=x):x=t[26],f.useEffect(k,x);let L;t[27]!==a||t[28]!==d?(L=()=>({json:{doc:d??"",selection:{main:0,ranges:[{anchor:0,head:0}]},highlight:a??[]},fields:K}),t[27]=a,t[28]=d,t[29]=L):L=t[29];const[M]=f.useState(L);let R;t[30]===Symbol.for("react.memo_cache_sentinel")?(R=_=>{U(_)},t[30]=R):R=t[30];const X=R;let T;t[31]!==i?(T=i??{highlightActiveLine:!1},t[31]=i,t[32]=T):T=t[32];const $=T;let w;return t[33]!==$||t[34]!==o||t[35]!==I||t[36]!==H||t[37]!==M||t[38]!==n||t[39]!==d?(w=Y.jsx(re,{...o,value:d,ref:n,extensions:H,theme:I,onCreateEditor:X,initialState:M,basicSetup:$}),t[33]=$,t[34]=o,t[35]=I,t[36]=H,t[37]=M,t[38]=n,t[39]=d,t[40]=w):w=t[40],w});function he(e){const n=p.c(6),t=f.useContext(ee),[i,o]=f.useState();let a;n[0]!==t?.codeModes||n[1]!==e?(a=()=>{const s=[...t?.codeModes??[],...ce].find(d=>d.name===e);s?.loader||console.warn(`Found no codeMode for language mode ${e}, syntax highlighting will be disabled.`);let g=!0;return Promise.resolve(s?.loader()).then(d=>{g&&o(d)}).catch(d=>{console.error(`Failed to load language mode ${e}`,d),g&&o(void 0)}),()=>{g=!1}},n[0]=t?.codeModes,n[1]=e,n[2]=a):a=n[2];let r;return n[3]!==t||n[4]!==e?(r=[e,t],n[3]=t,n[4]=e,n[5]=r):r=n[5],f.useEffect(a,r),i}export{be as default}; diff --git a/apps/studio/dist/static/DisplayedDocumentBroadcaster-DEHqxDA2.js b/apps/studio/dist/static/DisplayedDocumentBroadcaster-DEHqxDA2.js new file mode 100644 index 00000000..b21e86de --- /dev/null +++ b/apps/studio/dist/static/DisplayedDocumentBroadcaster-DEHqxDA2.js @@ -0,0 +1 @@ +import{g as E,r as D,b_ as d,c as j,j as v}from"./sanity-BZuh2pfi.js";var l,m;function x(){return m||(m=1,l=function n(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var r,o,u;if(Array.isArray(t)){if(r=t.length,r!=e.length)return!1;for(o=r;o--!==0;)if(!n(t[o],e[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(u=Object.keys(t),r=u.length,r!==Object.keys(e).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(e,u[o]))return!1;for(o=r;o--!==0;){var s=u[o];if(!n(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}),l}var y=x();const O=E(y);function g(n){const t=j.c(9),{children:e,setDisplayedDocument:r,documentId:o}=n;let u;t[0]!==r?(u=i=>r(p=>O(p,i)?p:i),t[0]=r,t[1]=u):u=t[1];const s=u;let f,c;t[2]!==o||t[3]!==r?(f=()=>{if(o)return;const i=setTimeout(()=>r(null));return()=>clearTimeout(i)},c=[o,r],t[2]=o,t[3]=r,t[4]=f,t[5]=c):(f=t[4],c=t[5]),D.useEffect(f,c);let a;return t[6]!==e||t[7]!==s?(a=v.jsx(d.Provider,{value:s,children:e}),t[6]=e,t[7]=s,t[8]=a):a=t[8],a}function P(){return D.useContext(d)}export{g as D,O as i,P as u}; diff --git a/apps/studio/dist/static/LiveQueries-BFs_Sx0n.js b/apps/studio/dist/static/LiveQueries-BFs_Sx0n.js new file mode 100644 index 00000000..678cb9f7 --- /dev/null +++ b/apps/studio/dist/static/LiveQueries-BFs_Sx0n.js @@ -0,0 +1 @@ +import{cR as j,cS as N,cT as O,bl as x,cU as D,cV as U,cW as V,cX as J,c as M,r as h,a_ as B,a1 as H,u as Y,j as P,cY as K,cZ as W,c_ as z,b8 as F,c$ as $,d0 as G,br as X,d1 as Z}from"./sanity-BZuh2pfi.js";import{c as ee}from"./PresentationToolGrantsCheck-C2q82H48.js";import{i as T}from"./DisplayedDocumentBroadcaster-DEHqxDA2.js";function te(t){if(Array.isArray(t)&&t.length>1&&t.includes("raw"))throw new TypeError('Invalid API perspective value: "raw". The raw-perspective can not be combined with other perspectives')}function re(t){if(te(t),Array.isArray(t))return t.includes("published")?t:[...t,"published"];switch(t){case"previewDrafts":case"drafts":return["drafts","published"];default:return["published"]}}function se(t,e){const s=re(e);function a(r){for(const n of s){let i=null;if(n.startsWith("r")&&(i=t({...r,_id:N(r._id,n)})),n==="drafts"&&(i=t({...r,_id:O(r._id)})),n==="published"&&(i=t({...r,_id:x(r._id)})),i)return{...i,_id:x(i._id),_originalId:i._id}}return null}return function(r){return a(r)}}function ne(t,e,s,a,r){if(!e)return t;const n=se(s,r),i=e.documents?.map?.(n)||[];return j(JSON.parse(JSON.stringify(t)),(l,d)=>{const y=D(d,e);if(!y)return l;const{mapping:o,pathSuffix:f}=y;if(o.type!=="value"||o.source.type!=="documentValue")return l;const p=e.documents[o.source.document],E=e.paths[o.source.path];if(p){const v=U(E+f),w=V(v),m=i[o.source.document];if(!m)return l;const g=m?J(m,w,l):l;return l===g?l:a(g,{cachedDocument:m,previousValue:l,sourceDocument:p,sourcePath:v})}return l})}function ie(t,e){switch(e.type){case"message":return{...t,messages:[...t.messages,e]};case"reconnect":case"restart":return{...t,messages:[],resets:t.resets+1};case"welcome":return t;default:throw Error(`Unknown event: ${e.type}`,{cause:e})}}const ae={messages:[],resets:0};function ue(t){const e=M.c(3),[s,a]=h.useReducer(ie,ae),[r,n]=h.useState(null);if(r!==null)throw r;let i,l;return e[0]!==t.live?(i=()=>{const d=t.live.events({includeDrafts:!0,tag:"presentation-loader"}).subscribe({next:a,error:y=>n(y instanceof Error?y:new Error("Unexpected error in useLiveEvents",{cause:y}))});return()=>d.unsubscribe()},l=[t.live],e[0]=t.live,e[1]=i,e[2]=l):(i=e[1],l=e[2]),h.useEffect(i,l),h.useDeferredValue(s)}const oe=(t,{previousValue:e})=>{if(typeof e=="string"){if(typeof t=="number")return`${t}`;if(Array.isArray(t)){if(t.length===0)return"";if(t.some(s=>typeof s=="object"&&K(s)))return W(t)}}return t};function ce(t,e,s){return`${t}:${e}:${JSON.stringify(s)}`}function le(t){if(t.queries.size<1)return t;const e=Date.now();if(!Array.from(t.heartbeats.values()).some(r=>r.heartbeat!==!1&&e>r.receivedAt+r.heartbeat))return t;const s=new Map,a=new Map;for(const[r,n]of t.heartbeats.entries())n.heartbeat!==!1&&e>n.receivedAt+n.heartbeat||(s.set(r,n),a.set(r,t.queries.get(r)));return{...t,queries:a,heartbeats:s}}function pe(t,{payload:e}){const s=ce(e.perspective,e.query,e.params),a={query:e.query,params:e.params,perspective:e.perspective},r=new Map(t.heartbeats);r.set(s,{receivedAt:Date.now(),heartbeat:e.heartbeat});let n=t.queries;return(!t.queries.has(s)||!T(t.queries.get(s),a))&&(n=new Map(t.queries),n.set(s,a)),{heartbeats:r,queries:n}}function fe(t,e){switch(e.type){case"query-listen":return pe(t,e);case"gc":return le(t);default:throw Error(`Unknown action: ${e.type}`,{cause:e})}}const de={queries:new Map,heartbeats:new Map};function he(){const t=M.c(4),[e,s]=h.useReducer(fe,de);let a,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{const l=setInterval(()=>s({type:"gc"}),z);return()=>clearInterval(l)},r=[],t[0]=a,t[1]=r):(a=t[0],r=t[1]),h.useEffect(a,r);const n=h.useDeferredValue(e.queries);let i;return t[2]!==n?(i=[n,s],t[2]=n,t[3]=i):i=t[3],i}function _e(t){const e=M.c(28),{controller:s,perspective:a,onLoadersConnection:r,onDocumentsOnPage:n}=t,[i,l]=h.useState(),[d,y]=he(),o=B(),f=H();let p,E;e[0]!==s||e[1]!==f||e[2]!==y||e[3]!==n||e[4]!==r||e[5]!==o?(p=()=>{if(s){const c=s.createChannel({name:"presentation",connectTo:"loaders",heartbeat:!0},F().provide({actors:ee()}));return l(c),c.onStatus(r),c.on("loader/documents",u=>{u.projectId===o&&u.dataset===f&&n("loaders",u.perspective,u.documents)}),c.on("loader/query-listen",u=>{if(u.projectId===o&&u.dataset===f){if(typeof u.heartbeat=="number"&&u.heartbeat<$)throw new Error(`Loader query listen heartbeat interval must be at least ${$}ms`);y({type:"query-listen",payload:{perspective:u.perspective,query:u.query,params:u.params,heartbeat:u.heartbeat??!1}})}}),c.start()}return ye},E=[s,f,y,n,r,o],e[0]=s,e[1]=f,e[2]=y,e[3]=n,e[4]=r,e[5]=o,e[6]=p,e[7]=E):(p=e[6],E=e[7]),h.useEffect(p,E);let v;e[8]!==a?(v=Z(a)?G:{apiVersion:X},e[8]=a,e[9]=v):v=e[9];const w=Y(v);let m;e[10]!==w?(m=w.withConfig({resultSourceMap:"withKeyArraySelector"}),e[10]=w,e[11]=m):m=e[11];const g=m;let I,A;e[12]!==a||e[13]!==i||e[14]!==f||e[15]!==o?(I=()=>{i&&i.post("loader/perspective",{projectId:o,dataset:f,perspective:a})},A=[i,a,o,f],e[12]=a,e[13]=i,e[14]=f,e[15]=o,e[16]=I,e[17]=A):(I=e[16],A=e[17]),h.useEffect(I,A);const q=h.useDeferredValue(t.liveDocument),_=ue(g);let S;e[18]!==d?(S=[...d.entries()],e[18]=d,e[19]=S):S=e[19];let b;return e[20]!==g||e[21]!==i||e[22]!==f||e[23]!==q||e[24]!==_||e[25]!==o||e[26]!==S?(b=P.jsx(P.Fragment,{children:S.map(c=>{const[u,R]=c,{query:L,params:Q,perspective:k}=R;return P.jsx(C,{projectId:o,dataset:f,perspective:k,query:L,params:Q,comlink:i,client:g,liveDocument:q,liveEventsMessages:_.messages},`${_.resets}:${u}`)})}),e[20]=g,e[21]=i,e[22]=f,e[23]=q,e[24]=_,e[25]=o,e[26]=S,e[27]=b):b=e[27],b}function ye(){}function me(t){const e=M.c(20),{projectId:s,dataset:a,perspective:r,query:n,client:i,liveDocument:l,params:d,comlink:y,liveEventsMessages:o}=t,{result:f,resultSourceMap:p,syncTags:E}=be({client:i,liveDocument:l,params:d,perspective:r,query:n,liveEventsMessages:o})||{};let v;e[0]!==a||e[1]!==s?(v=(I,A,q,_,S,b,c)=>{I?.post("loader/query-change",{projectId:s,dataset:a,perspective:A,query:q,params:_,result:S,resultSourceMap:b,tags:c})},e[0]=a,e[1]=s,e[2]=v):v=e[2];const w=h.useEffectEvent(v);let m;e[3]!==y||e[4]!==w||e[5]!==d||e[6]!==r||e[7]!==n||e[8]!==f||e[9]!==p||e[10]!==E?(m=()=>{p&&w(y,r,n,d,f,p,E)},e[3]=y,e[4]=w,e[5]=d,e[6]=r,e[7]=n,e[8]=f,e[9]=p,e[10]=E,e[11]=m):m=e[11];let g;return e[12]!==y||e[13]!==d||e[14]!==r||e[15]!==n||e[16]!==f||e[17]!==p||e[18]!==E?(g=[y,d,r,n,f,p,E],e[12]=y,e[13]=d,e[14]=r,e[15]=n,e[16]=f,e[17]=p,e[18]=E,e[19]=g):g=e[19],h.useEffect(m,g),null}const C=h.memo(me);C.displayName="Memo(QuerySubscription)";function be(t){const e=M.c(30),{liveDocument:s,client:a,query:r,params:n,perspective:i,liveEventsMessages:l}=t,[d,y]=h.useState(null),[o,f]=h.useState(null),[p,E]=h.useState(void 0);let v;e[0]!==l?(v=()=>new Set(l.map(ve)),e[0]=l,e[1]=v):v=e[1];const[w]=h.useState(v);let m;if(e[2]!==l||e[3]!==w||e[4]!==p){let b;e[6]!==w?(b=R=>!w.has(R.id),e[6]=w,e[7]=b):b=e[7];const c=l.filter(b);let u;e[8]!==p?(u=R=>R.tags.some(L=>p?.includes(L)),e[8]=p,e[9]=u):u=e[9],m=c.findLast(u),e[2]=l,e[3]=w,e[4]=p,e[5]=m}else m=e[5];const g=m?.id,[I,A]=h.useState(null);if(I)throw I;let q,_;e[10]!==a||e[11]!==g||e[12]!==n||e[13]!==i||e[14]!==r?(q=()=>{const b=new AbortController;return a.fetch(r,n,{lastLiveEventId:g,tag:"presentation-loader",signal:b.signal,perspective:i,filterResponse:!1,returnQuery:!1}).then(c=>{h.startTransition(()=>{y(u=>T(u,c.result)?u:c.result),f(u=>T(u,c.resultSourceMap)?u:c.resultSourceMap),E(u=>T(u,c.syncTags)?u:c.syncTags)})}).catch(c=>{(typeof c!="object"||c?.name!=="AbortError")&&A(c)}),()=>{b.abort()}},_=[a,g,n,i,r],e[10]=a,e[11]=g,e[12]=n,e[13]=i,e[14]=r,e[15]=q,e[16]=_):(q=e[15],_=e[16]),h.useEffect(q,_);let S;e:{if(s&&o){let c;e[17]!==s||e[18]!==i||e[19]!==d||e[20]!==o?(c=ge(s,d,i,o),e[17]=s,e[18]=i,e[19]=d,e[20]=o,e[21]=c):c=e[21];let u;e[22]!==o||e[23]!==p||e[24]!==c?(u={result:c,resultSourceMap:o,syncTags:p},e[22]=o,e[23]=p,e[24]=c,e[25]=u):u=e[25],S=u;break e}let b;e[26]!==d||e[27]!==o||e[28]!==p?(b={result:d,resultSourceMap:o,syncTags:p},e[26]=d,e[27]=o,e[28]=p,e[29]=b):b=e[29],S=b}return S}function ve(t){return t.id}function ge(t,e,s,a){if(s==="raw")throw new Error("turboChargeResultIfSourceMap does not support raw perspective");return ne(e,a,r=>!r._projectId&&t?._id&&x(t._id)===x(r._id)?typeof t._id=="string"&&typeof r._type=="string"?t:{...t,_id:t._id||r._id,_type:t._type||r._type}:null,oe,Array.isArray(s)?s.filter(Boolean):s)}export{_e as default,ge as turboChargeResultIfSourceMap}; diff --git a/apps/studio/dist/static/PostMessageDocuments-C6od-MMX.js b/apps/studio/dist/static/PostMessageDocuments-C6od-MMX.js new file mode 100644 index 00000000..c6b94fae --- /dev/null +++ b/apps/studio/dist/static/PostMessageDocuments-C6od-MMX.js @@ -0,0 +1 @@ +import{r as f,c as w,u as R,d0 as P,br as I,d1 as S,d2 as m,d3 as D,d4 as O,d5 as x}from"./sanity-BZuh2pfi.js";const A=n=>{const e=w.c(14),{comlink:t,perspective:d}=n;let o;e[0]!==d?(o=S(d)?P:{apiVersion:I},e[0]=d,e[1]=o):o=e[1];const s=R(o);let a,c;e[2]!==s||e[3]!==t?(a=()=>{const i=s.listen('*[!(_id in path("_.**"))]',{},{effectFormat:"mendoza",events:["welcome","mutation","reconnect"],includePreviousRevision:!1,includeResult:!1,includeAllVersions:!0,tag:"presentation-documents",visibility:"transaction"}).pipe(m(C)),y=i.pipe(m(N),D({bufferSize:1,refCount:!1})),b=t.on("visual-editing/snapshot-welcome",async()=>({event:await new Promise(v=>{y.pipe(O()).subscribe(h=>{v(h)})})})),_=i.pipe(m(T)),E=i.pipe(m(V)),g=x(y,E,_).subscribe(v=>{t.post("presentation/snapshot-event",{event:v})});return()=>{b(),g.unsubscribe()}},c=[s,t],e[2]=s,e[3]=t,e[4]=a,e[5]=c):(a=e[4],c=e[5]),f.useEffect(a,c);let u,r;e[6]!==s||e[7]!==t?(u=()=>t.on("visual-editing/fetch-snapshot",async i=>({snapshot:await s.getDocument(i.documentId,{tag:"document.snapshots"})})),r=[s,t],e[6]=s,e[7]=t,e[8]=u,e[9]=r):(u=e[8],r=e[9]),f.useEffect(u,r);let p,l;return e[10]!==s||e[11]!==t?(p=()=>t.on("visual-editing/mutate",async i=>s.dataRequest("mutate",i,{visibility:"async",returnDocuments:!0})),l=[s,t],e[10]=s,e[11]=t,e[12]=p,e[13]=l):(p=e[12],l=e[13]),f.useEffect(p,l),null};var L=f.memo(A);function C(n){return n.type==="welcome"||n.type==="reconnect"||n.type==="mutation"}function N(n){return n.type==="welcome"}function T(n){return n.type==="reconnect"}function V(n){return n.type==="mutation"}export{L as default}; diff --git a/apps/studio/dist/static/PostMessagePerspective-DbRM5T0e.js b/apps/studio/dist/static/PostMessagePerspective-DbRM5T0e.js new file mode 100644 index 00000000..1c2e64a3 --- /dev/null +++ b/apps/studio/dist/static/PostMessagePerspective-DbRM5T0e.js @@ -0,0 +1 @@ +import{r as i,c as n}from"./sanity-BZuh2pfi.js";const l=a=>{const e=n.c(8),{comlink:t,perspective:s}=a;let r,c;e[0]!==t||e[1]!==s?(r=()=>t.on("visual-editing/fetch-perspective",()=>({perspective:s})),c=[t,s],e[0]=t,e[1]=s,e[2]=r,e[3]=c):(r=e[2],c=e[3]),i.useEffect(r,c);let o,p;return e[4]!==t||e[5]!==s?(o=()=>{t.post("presentation/perspective",{perspective:s})},p=[t,s],e[4]=t,e[5]=s,e[6]=o,e[7]=p):(o=e[6],p=e[7]),i.useEffect(o,p),null};var u=i.memo(l);export{u as default}; diff --git a/apps/studio/dist/static/PostMessagePreviewSnapshots-DCzBcSpW.js b/apps/studio/dist/static/PostMessagePreviewSnapshots-DCzBcSpW.js new file mode 100644 index 00000000..36c802e6 --- /dev/null +++ b/apps/studio/dist/static/PostMessagePreviewSnapshots-DCzBcSpW.js @@ -0,0 +1 @@ +import{ce as k,cf as $,r as o,c as D,bK as I,by as M,d6 as U,cD as j,d7 as F,cT as O,cI as T,d8 as K,bl as y,d5 as L,d9 as N,d2 as V,e as W,da as q}from"./sanity-BZuh2pfi.js";function z(s){return k(function(e,t){var r=!1,a=0;e.subscribe($(t,function(n){return(r||(r=!s(n,a++)))&&t.next(n)}))})}const A=s=>{const e=D.c(16),{comlink:t,refs:r,perspective:a}=s,n=I(),c=M();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=new U,e[0]=p):p=e[0];const g=p;let u;e[1]!==n||e[2]!==a||e[3]!==c?(u=g.asObservable().pipe(j(w=>F(w.map(i=>{const P={...i,_id:O(i._id)},E=a==="published"?T:n.observeForPreview(P,c.get(P._type)).pipe(K(),z(B)),x={...i,_id:y(i._id)},R=n.observeForPreview(x,c.get(x._type));return L(R.pipe(N(E)),E).pipe(V(C),W(G))}))),q(0)),e[1]=n,e[2]=a,e[3]=c,e[4]=u):u=e[4];const l=u;let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[5]=d):d=e[5];const S=o.useRef(d);let m,b;e[6]!==t||e[7]!==l?(m=()=>{const w=l.subscribe(i=>{t.post("presentation/preview-snapshots",{snapshots:i}),S.current=i});return()=>{w.unsubscribe()}},b=[t,l],e[6]=t,e[7]=l,e[8]=m,e[9]=b):(m=e[8],b=e[9]),o.useEffect(m,b);let f,h;e[10]!==t?(f=()=>t.on("visual-editing/preview-snapshots",()=>({snapshots:S.current})),h=[t],e[10]=t,e[11]=f,e[12]=h):(f=e[11],h=e[12]),o.useEffect(f,h);let v,_;return e[13]!==r?(v=()=>{g.next(r)},_=[r,g],e[13]=r,e[14]=v,e[15]=_):(v=e[14],_=e[15]),o.useEffect(v,_),null};var J=o.memo(A);function B(s){return s.snapshot===null}function C(s){return!!s.snapshot}function G(s){const e=s.snapshot;return{_id:y(e._id),title:e.title,subtitle:e.subtitle,description:e.description,imageUrl:e.imageUrl}}export{J as default}; diff --git a/apps/studio/dist/static/PostMessageRefreshMutations-CjO-WTTB.js b/apps/studio/dist/static/PostMessageRefreshMutations-CjO-WTTB.js new file mode 100644 index 00000000..f9623d74 --- /dev/null +++ b/apps/studio/dist/static/PostMessageRefreshMutations-CjO-WTTB.js @@ -0,0 +1 @@ +import{r as l,c as E,bl as x,n as M,cy as R,j as g}from"./sanity-BZuh2pfi.js";function w(u){const e=E.c(9),{comlink:r,type:s,previewKitConnection:n,loadersConnection:o}=u;let t;e[0]!==u.id?(t=x(u.id),e[0]=u.id,e[1]=t):t=e[1];const i=t,{selectedReleaseId:p}=M(),{draft:a,published:d,ready:f,version:_}=R(i,s,"low",p),c=n==="connected"||o==="connected";if(f&&a||d){let v;return e[2]!==r||e[3]!==a||e[4]!==i||e[5]!==c||e[6]!==d||e[7]!==_?(v=g.jsx(y,{comlink:r,draft:a,livePreviewEnabled:c,published:d,version:_},i),e[2]=r,e[3]=a,e[4]=i,e[5]=c,e[6]=d,e[7]=_,e[8]=v):v=e[8],v}return null}function y(u){const e=E.c(18),{comlink:r,draft:s,published:n,livePreviewEnabled:o,version:t}=u,[i,p]=l.useState(s),[a,d]=l.useState(n),[f,_]=l.useState(t);let c;e[0]!==r||e[1]!==s||e[2]!==o||e[3]!==i?._rev||e[4]!==a?._rev||e[5]!==f?._rev||e[6]!==n||e[7]!==t?(c=()=>{f?._rev!==t?._rev&&(l.startTransition(()=>_(t)),t&&r?.post("presentation/refresh",{source:"mutation",livePreviewEnabled:o,document:b(t)})),i?._rev!==s?._rev&&(l.startTransition(()=>p(s)),s&&r?.post("presentation/refresh",{source:"mutation",livePreviewEnabled:o,document:b(s)})),a?._rev!==n?._rev&&(l.startTransition(()=>d(n)),n&&r?.post("presentation/refresh",{source:"mutation",livePreviewEnabled:o,document:b(n)}))},e[0]=r,e[1]=s,e[2]=o,e[3]=i?._rev,e[4]=a?._rev,e[5]=f?._rev,e[6]=n,e[7]=t,e[8]=c):c=e[8];const v=i?._rev,P=a?._rev,h=f?._rev;let m;return e[9]!==r||e[10]!==s||e[11]!==o||e[12]!==n||e[13]!==v||e[14]!==P||e[15]!==h||e[16]!==t?(m=[r,s,o,v,P,n,h,t],e[9]=r,e[10]=s,e[11]=o,e[12]=n,e[13]=v,e[14]=P,e[15]=h,e[16]=t,e[17]=m):m=e[17],l.useEffect(c,m),null}function b(u){const{_id:e,_type:r,_rev:s,slug:n}=u;return{_id:e,_type:r,_rev:s,slug:n}}var j=l.memo(w);export{j as default}; diff --git a/apps/studio/dist/static/PostMessageSchema-Dir7eK5Q.js b/apps/studio/dist/static/PostMessageSchema-Dir7eK5Q.js new file mode 100644 index 00000000..2c657297 --- /dev/null +++ b/apps/studio/dist/static/PostMessageSchema-Dir7eK5Q.js @@ -0,0 +1 @@ +import{r as j,c as R,s as D,u as q,d0 as U,br as L,d1 as V,bl as C,db as h,j as k}from"./sanity-BZuh2pfi.js";function B(n){const{validation:e}=n.type;if(!e)return!1;const r=Array.isArray(e)?e:[e];for(const i of r){let a=!1;const y=new Proxy({},{get:(m,d)=>()=>(d==="required"&&(a=!0),y)});if(typeof i=="function"&&(i(y),a)||typeof i=="object"&&i!==null&&"_required"in i&&i._required==="required")return!0}return!1}function b(n,e){let r=n;for(;r;){if(r.name===e||r.type&&r.type.name===e)return!0;r=r.type}return!1}function K(n){return b(n,"object")||n.jsonType==="object"||"fields"in n}function W(n){return b(n,"array")}function S(n){return b(n,"reference")}function z(n){return b(n,"crossDatasetReference")}function G(n){return b(n,"string")}function H(n){return b(n,"number")}function N(n){let e=n;for(;e;){if(!e.type)return e;e=e.type}}function A(n){return"fields"in n?n.type?A(n.type).concat(n.fields):n.fields:[]}function J(n){const e=new Set;function r(s,l){if(!e.has(s)){if(e.add(s),"fields"in s)for(const t of A(s)){const o=N(t.type);if(o.name==="document"){l.add(o);continue}let u;s.type.type?u=t.type.type.name:"jsonType"in s.type&&(u=t.type.jsonType),(u==="object"||u==="block")&&(S(t.type)?t.type.to.forEach(p=>l.add(p.type)):l.add(t.type)),r(t.type,l)}else if("of"in s)for(const t of s.of)r(t,l)}}const i=new Map;n.getTypeNames().forEach(s=>{const l=n.get(s);if(l===void 0||l.type===null)return;const t=new Set;r(l,t),i.set(l,t),e.clear()});const a=[],y=new Set,m=new Set;function d(s){if(m.has(s)||y.has(s))return;y.add(s);const l=i.get(s);l!==void 0&&l.forEach(t=>d(t)),y.delete(s),m.add(s),a.includes(s.name)||a.unshift(s.name)}for(const[s]of i)d(s);return a}function Q(n){const e=R.c(2),{schemaType:r}=n,i=r.icon;let a;return e[0]!==i?(a=i?j.isValidElement(i)?i:k.jsx(i,{}):null,e[0]=i,e[1]=a):a=e[1],a}const X=n=>({_id:{type:"objectField",name:"_id",value:{type:"string"}},_type:{type:"objectField",name:"_type",value:{type:"string",value:n}},_createdAt:{type:"objectField",name:"_createdAt",value:{type:"string"}},_updatedAt:{type:"objectField",name:"_updatedAt",value:{type:"string"}},_rev:{type:"objectField",name:"_rev",value:{type:"string"}}});function Y(n){const e=n.options?.list;return e&&Array.isArray(e)?{type:"union",of:e.map(r=>({type:"string",value:typeof r=="string"?r:r.value}))}:{type:"string"}}function Z(n){const e=n.options?.list;return e&&Array.isArray(e)?{type:"union",of:e.map(r=>({type:"number",value:typeof r=="number"?r:r.value}))}:{type:"number"}}function w(n,e=!1){const r={_ref:{type:"objectField",name:"_ref",value:{type:"string"}},_type:{type:"objectField",name:"_type",value:{type:"string",value:"reference"}},_weak:{type:"objectField",name:"_weak",value:{type:"boolean"},optional:!0}};return e&&(r._key={type:"objectField",name:"_key",value:{type:"string"}}),{type:"object",fields:r,dereferencesTo:n}}function T(n){const e=ee(n);return e.length===1?w(e[0]):{type:"union",of:e.map(r=>({type:"unionOption",name:r,value:w(r)}))}}function ee(n){const e=x(n);return[...new Set(e.map(r=>r.name))]}function x(n){const e="to"in n?n.to:[];return"type"in n&&S(n.type)?[...x(n.type),...e]:e}const _=new Map([["text",{type:"string"}],["url",{type:"string"}],["datetime",{type:"string"}],["date",{type:"string"}],["boolean",{type:"boolean"}],["email",{type:"string"}]]);function te(n){const e=new Set,{schema:r,basePath:i}=n;return J(r).map(t=>{const o=r.get(t);if(o===void 0)return;const u=y(o);if(u!==null)return u.type==="type"&&e.add(o),u}).filter(t=>t!==void 0);function a(t){if(t.icon)return h.renderToString(k.jsx(Q,{schemaType:t}))}function y(t){let o;if(t.type?o=t.type.name:"jsonType"in t&&(o=t.jsonType),o==="document"){const p=m(t);return p.type==="unknown"?null:{type:"document",name:t.name,title:typeof t.title=="string"?t.title:void 0,icon:a(t),fields:{...X(t.name),...p.fields}}}const u=d(t);return u.type==="unknown"?null:u.type==="object"?{name:t.name,type:"type",value:{type:"object",fields:{_type:{type:"objectField",name:"_type",value:{type:"string",value:t.name}},...u.fields}}}:{name:t.name,title:typeof t.title=="string"?t.title:void 0,type:"type",value:u}}function m(t){const o={};for(const u of A(t)){const p=d(u.type);p!==null&&(o[u.name]={type:"objectField",name:u.name,title:typeof u.type.title=="string"?u.type.title:void 0,value:p,optional:!B(u)})}return{type:"object",fields:o}}function d(t){if(N(t)?.name==="document")return w(t.name);if(e.has(t.type))return{type:"inline",name:t.type.name};if(t.type?.type?.name==="object")return{type:"inline",name:t.type.name};if(G(t))return Y(t);if(H(t))return Z(t);const o=_.get(t.type?.name||"");if(o)return o;if(t.type&&_.has(t.type.name))return _.get(t.type.name);if(z(t))return{type:"unknown"};if(S(t))return T(t);if(W(t))return l(t);if(K(t))return m(t);throw new Error(`Type "${t.name}" not found`)}function s(t,o){const{options:u}=t;if(!u)return;const p={...u};return u.insertMenu&&(p.insertMenu={...u.insertMenu,views:u.insertMenu.views?.map(g=>g.name==="grid"?{name:"grid",previewImageUrls:g.previewImageUrl?o.reduce((f,{name:c})=>{const v=g.previewImageUrl?.(c);if(!v)return f;try{new URL(v),f[c]=v}catch{f[c]=new URL(v,`${window.location.origin}${i?`${i}/`:""}`).toString()}return f},{}):void 0}:g)}),p}function l(t){const o=[];for(const f of t.of){let c=d(f);const v={type:"unionOption",icon:a(f),name:f.name,title:typeof f.title=="string"?f.title:void 0,value:c};c.type==="inline"?c={type:"object",fields:{_key:F()},rest:c}:c.type==="object"&&(c.rest={type:"object",fields:{_key:F()}}),v.value=c,o.push(v)}if(o.length===0)return{type:"null"};if(o.length>1)return{type:"union",of:o,options:s(t,o)};const{name:u,title:p,value:g}=o[0];return{type:"array",of:{type:"arrayItem",name:u,title:typeof p=="string"?p:void 0,value:g}}}}function F(){return{type:"objectField",name:"_key",value:{type:"string"}}}function ne(n){const e=n.reduce((r,{id:i,path:a})=>(r[i]?r[i].add(a):r[i]=new Set([a]),r),{});return Object.entries(e)}function re(n){const e=R.c(11),{comlink:r,perspective:i}=n,a=D();let y,m;e[0]!==r||e[1]!==a?(y=()=>{try{const o=te(a);return r.post("presentation/schema",{schema:o}),r.on("visual-editing/schema",()=>({schema:o}))}catch{return}},m=[r,a],e[0]=r,e[1]=a,e[2]=y,e[3]=m):(y=e[2],m=e[3]),j.useEffect(y,m);let d;e[4]!==i?(d=V(i)?U:{apiVersion:L},e[4]=i,e[5]=d):d=e[5];const s=q(d);let l,t;return e[6]!==s||e[7]!==r||e[8]!==i?(l=()=>r.on("visual-editing/schema-union-types",async o=>{const u=ne(o.paths),p=await Promise.all(u.map(async f=>{const[c,v]=f,E=Array.from(v),I=`*[_id == $id][0]{${E.map(oe).join(",")}}`,M=await s.fetch(I,{id:C(c)},{tag:"presentation-schema",perspective:i}),O=E.map((P,$)=>({path:P,type:M[$]}));return{id:c,paths:O}})),g=new Map;return p.forEach(f=>{g.set(f.id,new Map(f.paths.map(ie)))}),{types:g}}),t=[r,s,i],e[6]=s,e[7]=r,e[8]=i,e[9]=l,e[10]=t):(l=e[9],t=e[10]),j.useEffect(l,t),null}function ie(n){const{path:e,type:r}=n;return[e,r]}function oe(n,e){return`"${e}": ${n}[0]._type`}var se=j.memo(re);export{se as default}; diff --git a/apps/studio/dist/static/PostMessageTelemetry-CqS8qIVW.js b/apps/studio/dist/static/PostMessageTelemetry-CqS8qIVW.js new file mode 100644 index 00000000..0d7940bb --- /dev/null +++ b/apps/studio/dist/static/PostMessageTelemetry-CqS8qIVW.js @@ -0,0 +1 @@ +import{r as m,c as u,dc as i}from"./sanity-BZuh2pfi.js";const g=c=>{const e=u.c(4),{comlink:s}=c,t=i();let o,l;return e[0]!==s||e[1]!==t?(o=()=>s.on("visual-editing/telemetry-log",n=>{const{event:r,data:a}=n;a?t.log(r,a):t.log(r)}),l=[s,t],e[0]=s,e[1]=t,e[2]=o,e[3]=l):(o=e[2],l=e[3]),m.useEffect(o,l),null};var f=m.memo(g);export{f as default}; diff --git a/apps/studio/dist/static/PresentationToolGrantsCheck-C2q82H48.js b/apps/studio/dist/static/PresentationToolGrantsCheck-C2q82H48.js new file mode 100644 index 00000000..6545ab6b --- /dev/null +++ b/apps/studio/dist/static/PresentationToolGrantsCheck-C2q82H48.js @@ -0,0 +1,37 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["static/QRCodeSVG-BpS_-ERN.js","static/sanity-BZuh2pfi.js","static/LiveQueries-BFs_Sx0n.js","static/DisplayedDocumentBroadcaster-DEHqxDA2.js","static/PostMessageDocuments-C6od-MMX.js","static/PostMessageRefreshMutations-CjO-WTTB.js","static/PostMessagePerspective-DbRM5T0e.js","static/PostMessagePreviewSnapshots-DCzBcSpW.js","static/PostMessageSchema-Dir7eK5Q.js","static/PostMessageTelemetry-CqS8qIVW.js"])))=>i.map(i=>d[i]); +import{ap as yn,r as g,aq as fr,ar as xn,as as Pn,j as u,at as bn,au as Sn,av as Er,aw as Rr,ax as Cr,ay as Ar,az as Tr,aA as Ir,aB as kr,aC as rr,aD as nr,aE as pt,aF as vt,aG as ar,aH as ir,aI as wt,aJ as sr,aK as or,aL as _n,aM as Mr,aN as jn,a7 as Ur,aO as En,c as N,aP as ae,aQ as $r,aR as Rn,u as $t,aS as Dr,aT as Lr,aU as yt,k as Dt,l as Te,aV as Ie,aW as Or,aX as Nr,aY as Cn,aZ as zr,a_ as An,a1 as Tn,s as In,n as Wr,a$ as Fr,b0 as ie,b1 as ge,b2 as kn,b3 as cr,b4 as Mn,b5 as vr,b6 as Un,ad as lr,b7 as $n,b8 as Yt,b9 as Dn,C as me,F as le,ba as Vr,bb as Oe,i as It,T as se,S as He,a5 as kt,b as Mt,am as Ne,bc as Br,bd as xt,be as Ln,bf as Kr,bg as ur,bh as On,bi as Nn,bj as zn,D as ye,ab as Wn,J as we,a as Fn,bk as dr,bl as Pt,bm as Vn,bn as Bn,L as Kn,bo as Hr,bp as gt,bq as Hn,br as Lt,bs as Gn,bt as qn,bu as Qn,bv as Xn,bw as Gr,bx as Jn,by as Yn,bz as Zn,bA as ea,bB as ta,bC as ra,Q as na,U as aa,bD as ia,bE as sa,R as oa,bF as ca,bG as la,bH as ua,bI as da,bJ as pa,bK as ma,bL as qr,bM as ha,bN as Qr,bO as Xr,bP as fa,bQ as va,bR as ga,bS as wa,bT as ya,bU as xa,bV as Pa,bW as ba,Y as Sa,bX as _a,bY as ja}from"./sanity-BZuh2pfi.js";import{D as Ea,i as Ra}from"./DisplayedDocumentBroadcaster-DEHqxDA2.js";function Ca({children:r,isValidProp:e,...t}){e&&yn(e);const a=g.useContext(fr);t={...a,...t},t.transition=xn(t.transition,a.transition),t.isStatic=Pn(()=>t.isStatic);const i=g.useMemo(()=>t,[JSON.stringify(t.transition),t.transformPagePoint,t.reducedMotion,t.skipAnimations]);return u.jsx(fr.Provider,{value:i,children:r})}const Aa={"handshake/syn":kr,"handshake/syn-ack":Ir,"handshake/ack":Tr,"channel/response":Ar,"channel/heartbeat":Cr,"channel/disconnect":Rr,"overlay/focus":"visual-editing/focus","overlay/navigate":"visual-editing/navigate","overlay/toggle":"visual-editing/toggle","presentation/toggleOverlay":"presentation/toggle-overlay"},Ta={[kr]:"handshake/syn",[Ir]:"handshake/syn-ack",[Tr]:"handshake/ack",[Ar]:"channel/response",[Cr]:"channel/heartbeat",[Rr]:"channel/disconnect","visual-editing/focus":"overlay/focus","visual-editing/navigate":"overlay/navigate","visual-editing/toggle":"overlay/toggle","presentation/toggle-overlay":"presentation/toggleOverlay"},Ia=r=>{const{data:e}=r;return e&&typeof e=="object"&&"domain"in e&&"type"in e&&"from"in e&&"to"in e&&(e.domain==="sanity/channels"&&(e.domain=Er),e.to==="overlays"&&(e.to="visual-editing"),e.from==="overlays"&&(e.from="visual-editing"),e.channelId=e.connectionId,delete e.connectionId,e.type=Aa[e.type]??e.type),r},ka=r=>{const{channelId:e,...t}=r,a={...t,connectionId:e};return a.domain===Er&&(a.domain="sanity/channels"),a.to==="visual-editing"&&(a.to="overlays"),a.from==="visual-editing"&&(a.from="overlays"),a.type=Ta[a.type]??a.type,a.type==="channel/response"&&a.responseTo&&!a.data&&(a.data={responseTo:a.responseTo}),(a.type==="handshake/syn"||a.type==="handshake/syn-ack"||a.type==="handshake/ack")&&(a.data={id:a.connectionId}),a},Ma=({context:r},e)=>{const{sources:t,targetOrigin:a}=r,i=ka(e.message);t.forEach(n=>{n.postMessage(i,{targetOrigin:a})})},Zt=()=>({listen:Sn(Ia),requestMachine:bn().provide({actions:{"send message":Ma}})}),ce=[];for(let r=0;r<256;++r)ce.push((r+256).toString(16).slice(1));function Ua(r,e=0){return(ce[r[e+0]]+ce[r[e+1]]+ce[r[e+2]]+ce[r[e+3]]+"-"+ce[r[e+4]]+ce[r[e+5]]+"-"+ce[r[e+6]]+ce[r[e+7]]+"-"+ce[r[e+8]]+ce[r[e+9]]+"-"+ce[r[e+10]]+ce[r[e+11]]+ce[r[e+12]]+ce[r[e+13]]+ce[r[e+14]]+ce[r[e+15]]).toLowerCase()}let Ht;const $a=new Uint8Array(16);function Da(){if(!Ht){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ht=crypto.getRandomValues.bind(crypto)}return Ht($a)}const La=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),gr={randomUUID:La};function Oa(r,e,t){if(gr.randomUUID&&!r)return gr.randomUUID();r=r||{};const a=r.random??r.rng?.()??Da();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=a[6]&15|64,a[8]=a[8]&63|128,Ua(a)}function Na(r){const e=new URL(r),{searchParams:t}=e;return t.delete(rr),t.delete(nr),t.delete(pt),t.delete(vt),t.delete(ar),e}function za(r,e,t,a){const i=new URL(r),{searchParams:n}=i;return e&&(n.set(nr,e),n.set(rr,t)),n.set(pt,a),i}function Jr(){if(typeof crypto<"u"){const r=new Uint8Array(16);crypto.getRandomValues(r);let e="";for(let t=0;t=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122||s===95){i+=r[n++];continue}break}if(!i)throw new TypeError("Missing parameter name at ".concat(t));e.push({type:"NAME",index:t,value:i}),t=n;continue}if(a==="("){var o=1,c="",n=t+1;if(r[n]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(n));for(;n-1)return!0}return!1},w=function(v){var A=o[o.length-1],M=v||(A&&typeof A=="string"?A:"");if(A&&!M)throw new TypeError('Must have text between two parameters, missing text after "'.concat(A.name,'"'));return!M||f(M)?"[^".concat(Ve(s),"]+?"):"(?:(?!".concat(Ve(M),")[^").concat(Ve(s),"])+?")};l)?(?!\?)/g,a=0,i=t.exec(r.source);i;)e.push({name:i[1]||a++,prefix:"",suffix:"",modifier:"",pattern:""}),i=t.exec(r.source);return r}function qa(r,e,t){var a=r.map(function(i){return Zr(i,e,t).source});return new RegExp("(?:".concat(a.join("|"),")"),Yr(t))}function Qa(r,e,t){return Xa(Ba(r,t),e,t)}function Xa(r,e,t){t===void 0&&(t={});for(var a=t.strict,i=a===void 0?!1:a,n=t.start,s=n===void 0?!0:n,o=t.end,c=o===void 0?!0:o,l=t.encode,m=l===void 0?function(A){return A}:l,p=t.delimiter,h=p===void 0?"/#?":p,d=t.endsWith,f=d===void 0?"":d,w="[".concat(Ve(f),"]|$"),x="[".concat(Ve(h),"]"),y=s?"^":"",b=0,j=r;b-1:R===void 0;i||(y+="(?:".concat(x,"(?=").concat(w,"))?")),v||(y+="(?=".concat(x,"|").concat(w,")"))}return new RegExp(y,Yr(t))}function Zr(r,e,t){return r instanceof RegExp?Ga(r,e):Array.isArray(r)?qa(r,e,t):Qa(r,e,t)}async function Ja(r,e,t,a,i=Ur()){const n=r.withConfig({apiVersion:ir});try{const s=new Date(Date.now()+1e3*_n),o=`drafts.${i}`,c=Jr(),l=n.patch(o).set({secret:c,source:e,studioUrl:t,userId:a});return await n.transaction().createOrReplace({_id:o,_type:Mr}).patch(l).commit({tag:or}),{secret:c,expiresAt:s}}finally{try{await n.delete({query:jn})}catch(s){console.error("Failed to delete expired secrets",s)}}}function Ya(r,e){let t=new AbortController,a=[];async function i(s,o){const{result:c,syncTags:l}=await r.fetch(En,{},{filterResponse:!1,lastLiveEventId:s,tag:"preview-url-secret.fetch-vercel-bypass-protection-secret"});Array.isArray(l)&&(a=l),o.aborted||e(c)}const n=r.live.events().subscribe({next:s=>{s.type==="message"&&(t.abort(),t=new AbortController,s.tags.some(o=>a.includes(o))&&i(s.id,t.signal))},error:s=>console.error(s)});return i(null,t.signal),()=>{n.unsubscribe(),t.abort()}}const Za=r=>{const e=N.c(3),{comlink:t}=r;let a,i;return e[0]!==t?(a=()=>t.on("visual-editing/features",ti),i=[t],e[0]=t,e[1]=a,e[2]=i):(a=e[1],i=e[2]),g.useEffect(a,i),null};var ei=g.memo(Za);function ti(){return{features:{optimistic:!0}}}const ri=Fr({actions:{},actors:{},guards:{}}).createMachine({id:"Presentation Tool",context:{url:null,error:null,visualEditingOverlaysEnabled:!1},on:{"iframe reload":{actions:ie({url:null}),target:".loading"}},states:{error:{description:"Failed to load, either because of a misconfiguration, a network error, or an unexpected error",tags:["error"]},loading:{on:{"iframe loaded":{target:"loaded"}},tags:["busy"]},loaded:{on:{"toggle visual editing overlays":{actions:ie({visualEditingOverlaysEnabled:({event:r})=>r.enabled})},"iframe refresh":{target:".refreshing"},"iframe reload":{target:".reloading"}},states:{idle:{},refreshing:{on:{"iframe loaded":{target:"idle"}},tags:["busy"]},reloading:{on:{"iframe loaded":{target:"idle"}},tags:["busy"]}},initial:"idle"}},initial:"loading"}),ni=function(r){const e=N.c(14),{comlink:t,children:a}=r;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];const n=g.useRef(i);let s,o;e[1]!==t?(s=()=>t?.on("visual-editing/shared-state",()=>({state:n.current})),o=[t],e[1]=t,e[2]=s,e[3]=o):(s=e[2],o=e[3]),g.useEffect(s,o);let c;e[4]!==t?(c=(w,x)=>{n.current[w]=x,t?.post("presentation/shared-state",{key:w,value:x})},e[4]=t,e[5]=c):c=e[5];const l=c;let m;e[6]!==t?(m=w=>{t?.post("presentation/shared-state",{key:w}),delete n.current[w]},e[6]=t,e[7]=m):m=e[7];const p=m;let h;e[8]!==p||e[9]!==l?(h={removeValue:p,setValue:l},e[8]=p,e[9]=l,e[10]=h):h=e[10];const d=h;let f;return e[11]!==a||e[12]!==d?(f=u.jsx(la.Provider,{value:d,children:a}),e[11]=a,e[12]=d,e[13]=f):f=e[13],f},ai=ye.div.withConfig({displayName:"Root",componentId:"sc-1auuvvr-0"})`overflow:hidden;flex-basis:0;flex-shrink:1;`,pr=function(r){const e=N.c(15),{children:t,defaultSize:a,id:i,minWidth:n,maxWidth:s,order:o}=r,c=a===void 0?null:a,l=o===void 0?0:o,m=g.useContext(ur);if(m===null)throw Error("Panel components must be rendered within a PanelGroup container");const{getPanelStyle:p,registerElement:h,unregisterElement:d}=m;let f;e[0]!==p||e[1]!==i?(f=p(i),e[0]=p,e[1]=i,e[2]=f):f=e[2];const w=f;let x,y;e[3]!==c||e[4]!==i||e[5]!==s||e[6]!==n||e[7]!==l||e[8]!==h||e[9]!==d?(x=()=>(h(i,{id:i,type:"panel",defaultSize:c,maxWidth:s??null,minWidth:n??0,order:l}),()=>{d(i)}),y=[i,c,l,s,n,h,d],e[3]=c,e[4]=i,e[5]=s,e[6]=n,e[7]=l,e[8]=h,e[9]=d,e[10]=x,e[11]=y):(x=e[10],y=e[11]),g.useLayoutEffect(x,y);let b;return e[12]!==t||e[13]!==w?(b=u.jsx(ai,{style:w,children:t}),e[12]=t,e[13]=w,e[14]=b):b=e[14],b};function en(r,e){let t;return(...a)=>{clearTimeout(t),t=setTimeout(()=>{r.apply(r,a)},e)}}const tn="presentation/panels",rn=()=>JSON.parse(localStorage.getItem(tn)||"{}"),ii=r=>{localStorage.setItem(tn,JSON.stringify(r))},nn=r=>r.map(e=>[e.id,e.order].join(":")).join(",");function si(){const r=N.c(1),e=ci,t=oi;let a;if(r[0]===Symbol.for("react.memo_cache_sentinel")){const i=en(t,100);a={get:e,set:t,setDebounced:i},r[0]=a}else a=r[0];return a}function oi(r,e){const t=rn(),a=nn(r),i={...t,[a]:e};ii(i)}function ci(r){const e=rn(),t=nn(r);return Array.isArray(e[t])&&e[t].some(li)?void 0:e[t]}function li(r){return r===null}function er(r,e,t){const{maxWidth:a,minWidth:i}=r,n=a==null?100:a/t*100,s=i/t*100;return Math.min(n,Math.max(s,e))}function ui(r,e,t,a,i,n){const{panels:s,widths:o}=i,{widths:c}=n,l=c||o,m=[...l];{const f=r<0?a:t,w=s.findIndex(b=>b.id===f.id),x=l[w],y=er(f,x+Math.abs(r),e);if(x===y)return l;r=r<0?x-y:y-x}let p=0,h=r<0?t:a,d=s.findIndex(f=>f.id===h.id);for(;;){const f=s[d],w=l[d],x=Math.abs(r)-Math.abs(p),y=er(f,w-x,e);if(w!==y&&(p+=w-y,m[d]=y,p.toPrecision(10).localeCompare(Math.abs(r).toPrecision(10),void 0,{numeric:!0})>=0))break;if(r<0){if(--d<0)break}else if(++d>=s.length)break}return p===0?l:(h=r<0?a:t,d=s.findIndex(f=>f.id===h.id),m[d]=l[d]+p,m)}function di(r,e,t){if(r.length===1)return"100";const a=r.findIndex(n=>n.id===e),i=t[a];return i==null?"0":i.toPrecision(10)}function wr(r,e,t=0,a=null){const i=r.clientX,n=(a||e.getBoundingClientRect()).left;return i-n-t}function Gt(r){return r.type==="panel"}function yr(r){return r.type==="resizer"}function xr(r){return Array.from(r.values()).sort(({order:e},{order:t})=>e==null&&t==null?0:e==null?-1:t==null?1:e-t)}function Pr(r,e,t){const a=e.reduce((s,o)=>s+o,0),i=[...e].map(s=>s/a*100);let n=0;for(let s=0;sn.defaultSize?(t-=n.defaultSize,e-=1,n.defaultSize):null),i=t/e;return a.map(n=>n===null?i:n)}const mi=ye.div.withConfig({displayName:"PanelsWrapper",componentId:"sc-17hl5hb-0"})`display:flex;flex-direction:row;height:100%;overflow:hidden;width:100%;`,hi=function(r){const e=N.c(46),{children:t}=r,a=g.useRef(null);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Map,e[0]=i):i=e[0];const[n,s]=g.useState(i);let o;e[1]!==n?(o=xr(n).filter(Gt),e[1]=n,e[2]=o):o=e[2];const c=o;let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[3]=l):l=e[3];const[m,p]=g.useState(l),[h,d]=g.useState(null);let f;e[4]!==n||e[5]!==c||e[6]!==m?(f={elements:n,panels:c,widths:m},e[4]=n,e[5]=c,e[6]=m,e[7]=f):f=e[7];const w=g.useRef(f);let x;e[8]!==h||e[9]!==c||e[10]!==m?(x=$=>({flexGrow:di(c,$,m),pointerEvents:h===null?void 0:"none"}),e[8]=h,e[9]=c,e[10]=m,e[11]=x):x=e[11];const y=x;let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=($,F)=>{s(H=>{if(H.has($))return H;const ee=new Map(H);return ee.set($,F),ee})},e[12]=b):b=e[12];const j=b;let P;e[13]===Symbol.for("react.memo_cache_sentinel")?(P=$=>{s(F=>{if(!F.has($))return F;const H=new Map(F);return H.delete($),H})},e[13]=P):P=e[13];const S=P;let E;e[14]===Symbol.for("react.memo_cache_sentinel")?(E={containerWidth:window.innerWidth,dragOffset:0,panelAfter:null,panelBefore:null,resizerIndex:-1,resizerRect:null,startX:0,widths:[]},e[14]=E):E=e[14];const _=g.useRef(E);let R;e[15]!==n?(R=($,F)=>{const H=xr(n),ee=H.findIndex(k=>k.id===$),Y=n.get($);if(!Y||!yr(Y))return;const re=Y.el.current;re&&(_.current={resizerIndex:ee,panelBefore:H.reduce((k,q,Q)=>Gt(q)&&Qk===null&&Gt(q)&&Q>ee?q:k,null),containerWidth:window.innerWidth,startX:F.pageX,dragOffset:wr(F,re),resizerRect:re.getBoundingClientRect(),widths:w.current.widths},d($))},e[15]=n,e[16]=R):R=e[16];const v=R;let A;e[17]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{d(null)},e[17]=A):A=e[17];const M=A;let I;e[18]!==n?(I=($,F)=>{F.preventDefault(),F.stopPropagation();const{containerWidth:H,dragOffset:ee,panelBefore:Y,panelAfter:re,resizerRect:k}=_.current;if(Y==null||re==null)return;const q=n.get($);if(!q||!yr(q))return;const Q=q.el.current;if(!Q)return;const oe=wr(F,Q,ee,k);if(oe===0)return;const{widths:xe}=w.current,he=a.current.getBoundingClientRect(),fe=oe/he.width*100,de=ui(fe,H,Y,re,w.current,_.current);xe.some((ve,pe)=>ve!==de[pe])&&p(de)},e[18]=n,e[19]=I):I=e[19];const U=I;let O,T;e[20]!==n||e[21]!==c||e[22]!==m?(O=()=>{w.current.elements=n,w.current.panels=c,w.current.widths=m},T=[n,c,m],e[20]=n,e[21]=c,e[22]=m,e[23]=O,e[24]=T):(O=e[23],T=e[24]),g.useLayoutEffect(O,T);const W=si();let C,V;e[25]!==c||e[26]!==W?(C=()=>{const{widths:$}=w.current;if($.length===c.length)return;const F=W.get(c);if(F){const ee=Pr(c,F,window.innerWidth);p(ee);return}const H=pi(c);p(H)},V=[W,c],e[25]=c,e[26]=W,e[27]=C,e[28]=V):(C=e[27],V=e[28]),g.useLayoutEffect(C,V);let z,G;e[29]!==c||e[30]!==W||e[31]!==m?(z=()=>{m.length&&W.setDebounced(c,m)},G=[W,c,m],e[29]=c,e[30]=W,e[31]=m,e[32]=z,e[33]=G):(z=e[32],G=e[33]),g.useEffect(z,G);let L,K;e[34]===Symbol.for("react.memo_cache_sentinel")?(L=()=>{const $=new ResizeObserver(()=>{const{panels:F,widths:H}=w.current,ee=Pr(F,H,window.innerWidth);H.some((Y,re)=>Y!==ee[re])&&p(ee)});return $.observe(a.current),()=>{$.disconnect()}},K=[],e[34]=L,e[35]=K):(L=e[34],K=e[35]),g.useLayoutEffect(L,K);let J;e[36]!==h||e[37]!==U||e[38]!==y||e[39]!==v?(J={activeResizer:h,drag:U,getPanelStyle:y,registerElement:j,startDragging:v,stopDragging:M,unregisterElement:S},e[36]=h,e[37]=U,e[38]=y,e[39]=v,e[40]=J):J=e[40];const X=J;let B;e[41]!==t?(B=u.jsx(mi,{ref:a,children:t}),e[41]=t,e[42]=B):B=e[42];let te;return e[43]!==X||e[44]!==B?(te=u.jsx(ur.Provider,{value:X,children:B}),e[43]=X,e[44]=B,e[45]=te):te=e[45],te};function mr(r){const e=N.c(37);let t,a,i,n,s;e[0]!==r?({children:t,message:a,onRetry:n,onContinueAnyway:i,...s}=r,e[0]=r,e[1]=t,e[2]=a,e[3]=i,e[4]=n,e[5]=s):(t=e[1],a=e[2],i=e[3],n=e[4],s=e[5]);const{t:o}=Te(Ie);let c;e[6]!==o?(c=o("error-card.retry-button.text"),e[6]=o,e[7]=c):c=e[7];let l;e[8]!==n||e[9]!==c?(l=u.jsx(Oe,{mode:"ghost",onClick:n,text:c}),e[8]=n,e[9]=c,e[10]=l):l=e[10];const m=l;let p;e[11]!==o?(p=o("error-card.continue-button.text"),e[11]=o,e[12]=p):p=e[12];let h;e[13]!==i||e[14]!==p?(h=u.jsx(Oe,{mode:"ghost",tone:"critical",onClick:i,text:p}),e[13]=i,e[14]=p,e[15]=h):h=e[15];const d=h;let f;e[16]!==o?(f=o("error-card.title"),e[16]=o,e[17]=f):f=e[17];let w;e[18]!==f?(w=u.jsx(se,{size:1,weight:"semibold",children:f}),e[18]=f,e[19]=w):w=e[19];let x;e[20]!==a?(x=u.jsx(se,{muted:!0,size:1,children:a}),e[20]=a,e[21]=x):x=e[21];let y;e[22]!==w||e[23]!==x?(y=u.jsxs(He,{space:3,children:[w,x]}),e[22]=w,e[23]=x,e[24]=y):y=e[24];let b;e[25]!==d||e[26]!==i||e[27]!==n||e[28]!==m?(b=n&&i?u.jsxs(Wn,{space:2,children:[m,d]}):n?u.jsx(we,{children:m}):i?u.jsx(we,{children:d}):null,e[25]=d,e[26]=i,e[27]=n,e[28]=m,e[29]=b):b=e[29];let j;e[30]!==t||e[31]!==y||e[32]!==b?(j=u.jsx(le,{align:"center",height:"fill",justify:"center",children:u.jsx(Fn,{padding:4,sizing:"border",width:0,children:u.jsxs(He,{space:4,children:[y,t,b]})})}),e[30]=t,e[31]=y,e[32]=b,e[33]=j):j=e[33];let P;return e[34]!==s||e[35]!==j?(P=u.jsx(me,{height:"fill",...s,children:j}),e[34]=s,e[35]=j,e[36]=P):P=e[36],P}const an=g.forwardRef(function(r,e){const t=N.c(17);let a,i,n,s,o;if(t[0]!==r){const{childId:p,childType:h,childPayload:d,childParameters:f,searchParams:w,...x}=r;a=p,n=h,i=f,o=w,s=x,t[0]=r,t[1]=a,t[2]=i,t[3]=n,t[4]=s,t[5]=o}else a=t[1],i=t[2],n=t[3],s=t[4],o=t[5];let c;t[6]!==i||t[7]!==o?(c=Object.entries({...o,...i}),t[6]=i,t[7]=o,t[8]=c):c=t[8];let l;t[9]!==a||t[10]!==n||t[11]!==c?(l={id:a,type:n,_searchParams:c},t[9]=a,t[10]=n,t[11]=c,t[12]=l):l=t[12];let m;return t[13]!==e||t[14]!==s||t[15]!==l?(m=u.jsx(dr,{...s,ref:e,state:l}),t[13]=e,t[14]=s,t[15]=l,t[16]=m):m=t[16],m}),fi=g.forwardRef(function(r,e){const t=N.c(24);let a,i,n,s,o,c;t[0]!==r?({documentId:a,documentType:i,parentRefPath:n,template:c,searchParams:o,...s}=r,t[0]=r,t[1]=a,t[2]=i,t[3]=n,t[4]=s,t[5]=o,t[6]=c):(a=t[1],i=t[2],n=t[3],s=t[4],o=t[5],c=t[6]);let l;t[7]!==a?(l=Pt(a),t[7]=a,t[8]=l):l=t[8];const m=c?.params;let p;t[9]!==n?(p=Vn(n),t[9]=n,t[10]=p):p=t[10];let h;t[11]!==c?(h=c&&{template:c?.id},t[11]=c,t[12]=h):h=t[12];let d;t[13]!==p||t[14]!==h?(d={parentRefPath:p,...h},t[13]=p,t[14]=h,t[15]=d):d=t[15];let f;return t[16]!==i||t[17]!==e||t[18]!==s||t[19]!==o||t[20]!==l||t[21]!==m||t[22]!==d?(f=u.jsx(an,{...s,ref:e,childId:l,childType:i,childPayload:m,childParameters:d,searchParams:o}),t[16]=i,t[17]=e,t[18]=s,t[19]=o,t[20]=l,t[21]=m,t[22]=d,t[23]=f):f=t[23],f});function vi(r={}){const e=Object.entries(r).map(([t,a])=>`${t}=${a}`).join("&");return e.length?`?${e}`:""}function gi(r){const e=["comment","inspect","instruction","pathKey","rev","since","template","view"],t=Object.entries(r).filter(([a])=>e.includes(a)).reduce((a,[i,n])=>n==null?a:{...a,[i]:n},{});return vi(t)}const wi=g.forwardRef(function(r,e){const t=N.c(9);let a,i;t[0]!==r?({searchParams:i,...a}=r,t[0]=r,t[1]=a,t[2]=i):(a=t[1],i=t[2]);let n;t[3]!==i?(n={type:void 0,_searchParams:Object.entries(i)},t[3]=i,t[4]=n):n=t[4];let s;return t[5]!==e||t[6]!==a||t[7]!==n?(s=u.jsx(dr,{...a,ref:e,state:n,title:void 0}),t[5]=e,t[6]=a,t[7]=n,t[8]=s):s=t[8],s});function sn(r){const e=N.c(28),{children:t,onEditReference:a,onStructureParams:i,structureParams:n,searchParams:s,refs:o}=r,{state:c,resolvePathFromState:l}=yt();let m;e[0]!==c._searchParams?(m=Object.fromEntries(c._searchParams||[]),e[0]=c._searchParams,e[1]=m):m=e[1];const p=zr(m);let h;e[2]!==l||e[3]!==p||e[4]!==c?(h=R=>{const v=l(c),A=gi({...p,...R});return`${v}${A}`},e[2]=l,e[3]=p,e[4]=c,e[5]=h):h=e[5];const d=h;let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f={},e[6]=f):f=e[6];const w=n;let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[7]=x):x=e[7];let y;e[8]!==o||e[9]!==s?(y=g.forwardRef(function(R,v){const{childId:A,...M}=R,I=o?.find(U=>U._id===A||Pt(U._id)===A);return I?u.jsx(an,{...M,ref:v,childId:A,childType:I._type,searchParams:s}):(console.warn(`ChildLink: No document found for childId "${A}"`),null)}),e[8]=o,e[9]=s,e[10]=y):y=e[10];let b;e[11]!==s?(b=g.forwardRef(function(R,v){return u.jsx(wi,{...R,ref:v,searchParams:s})}),e[11]=s,e[12]=b):b=e[12];let j;e[13]!==s?(j=g.forwardRef(function(R,v){return u.jsx(fi,{...R,ref:v,searchParams:s})}),e[13]=s,e[14]=j):j=e[14];let P;e[15]!==a?(P=R=>{const{id:v,template:A,type:M,parentRefPath:I,version:U}=R;a({state:{id:v,type:M},params:{template:A.id,parentRefPath:va(I),version:U}})},e[15]=a,e[16]=P):P=e[16];let S;e[17]!==d||e[18]!==i||e[19]!==w||e[20]!==y||e[21]!==b||e[22]!==j||e[23]!==P?(S={index:0,groupIndex:0,siblingIndex:0,payload:f,params:w,hasGroupSiblings:!1,groupLength:1,routerPanesState:x,ChildLink:y,BackLink:b,ReferenceChildLink:j,ParameterizedLink:Ei,closeCurrentAndAfter:ji,handleEditReference:P,replaceCurrent:_i,closeCurrent:Si,duplicateCurrent:bi,setView:Pi,setParams:i,setPayload:xi,navigateIntent:yi,createPathWithParams:d},e[17]=d,e[18]=i,e[19]=w,e[20]=y,e[21]=b,e[22]=j,e[23]=P,e[24]=S):S=e[24];const E=S;let _;return e[25]!==t||e[26]!==E?(_=u.jsx(fa.Provider,{value:E,children:t}),e[25]=t,e[26]=E,e[27]=_):_=e[27],_}function yi(r,e,t){console.warn("navigateIntent",r,e,t)}function xi(r){console.warn("setPayload",r)}function Pi(r){console.warn("setView",r)}function bi(r){console.warn("duplicateCurrent",r)}function Si(){console.warn("closeCurrent")}function _i(r){console.warn("replaceCurrent",r)}function ji(){console.warn("closeCurrentAndAfter")}function Ei(){throw new Error("ParameterizedLink not implemented")}const Ri=ye(Xr).withConfig({displayName:"RootLayout",componentId:"sc-18wb5dr-0"})`height:100%;`,Ci=ye(le).withConfig({displayName:"Root",componentId:"sc-18wb5dr-1"})`& > div{min-width:none !important;max-width:none !important;}`,Ai=ye(Mt).withConfig({displayName:"WrappedCode",componentId:"sc-18wb5dr-2"})`white-space:pre-wrap;`;function Ti(r){const e=N.c(34),{mainDocumentState:t,onEditReference:a,onStructureParams:i,searchParams:n,refs:s}=r,{t:o}=Te(Ie),{devMode:c}=cr();let l;if(e[0]!==t?.document?._id||e[1]!==s){let R;e[3]!==t?.document?._id?(R=v=>Pt(v._id)!==t?.document?._id,e[3]=t?.document?._id,e[4]=R):R=e[4],l=s.filter(R).map(ki),e[0]=t?.document?._id,e[1]=s,e[2]=l}else l=e[2];const m=l;let p;e[5]!==m?(p={filter:"_id in $ids",params:{ids:m}},e[5]=m,e[6]=p):p=e[6];let h;e[7]!==o?(h=o("document-list-pane.document-list.title"),e[7]=o,e[8]=h):h=e[8];let d;e[9]!==p||e[10]!==h?(d={id:"$root",options:p,schemaTypeName:"",title:h,type:"documentList"},e[9]=p,e[10]=h,e[11]=d):d=e[11];const f=d,[w,x]=g.useState(null);let y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=()=>x(null),e[12]=y):y=e[12];const b=y,[j]=g.useState(Ii);let P;e[13]===Symbol.for("react.memo_cache_sentinel")?(P=()=>x(null),e[13]=P):P=e[13];let S;if(e[14]!==s?(S=[s],e[14]=s,e[15]=S):S=e[15],g.useEffect(P,S),w){let R;e[16]!==o?(R=o("document-list-pane.error.text"),e[16]=o,e[17]=R):R=e[17];let v;e[18]!==c||e[19]!==w||e[20]!==o?(v=c&&u.jsx(me,{overflow:"auto",padding:3,radius:2,tone:"critical",children:u.jsxs(He,{space:3,children:[u.jsx(kt,{muted:!0,size:0,children:o("presentation-error.label")}),u.jsx(Ai,{size:1,children:w.error.message})]})}),e[18]=c,e[19]=w,e[20]=o,e[21]=v):v=e[21];let A;return e[22]!==R||e[23]!==v?(A=u.jsx(mr,{flex:1,message:R,onRetry:b,children:v}),e[22]=R,e[23]=v,e[24]=A):A=e[24],A}let E;e[25]!==f?(E=u.jsx(Ci,{direction:"column",flex:1,children:u.jsx(ja,{index:0,itemId:"$root",pane:f,paneKey:"$root"})}),e[25]=f,e[26]=E):E=e[26];let _;return e[27]!==a||e[28]!==i||e[29]!==s||e[30]!==n||e[31]!==j||e[32]!==E?(_=u.jsx(Qr,{onCatch:x,children:u.jsx(Ri,{children:u.jsx(qr,{children:u.jsx(sn,{onEditReference:a,onStructureParams:i,structureParams:j,searchParams:n,refs:s,children:E})})})}),e[27]=a,e[28]=i,e[29]=s,e[30]=n,e[31]=j,e[32]=E,e[33]=_):_=e[33],_}function Ii(){return{}}function ki(r){return Pt(r._id)}const Mi=ye(Mt).withConfig({displayName:"WrappedCode",componentId:"sc-m0u57n-0"})`white-space:pre-wrap;`;function Ui(r){const e=N.c(40),{documentId:t,documentType:a,onFocusPath:i,onEditReference:n,onStructureParams:s,searchParams:o,structureParams:c}=r,{template:l,templateParams:m}=c,{t:p}=Te(Ie),{devMode:h}=cr();let d;e[0]!==m?(d=ha(m),e[0]=m,e[1]=d):d=e[1];let f;e[2]!==t||e[3]!==a||e[4]!==d||e[5]!==l?(f={id:t,type:a,template:l,templateParameters:d},e[2]=t,e[3]=a,e[4]=d,e[5]=l,e[6]=f):f=e[6];let w;e[7]!==t||e[8]!==f?(w={id:t,options:f,title:"",type:"document"},e[7]=t,e[8]=f,e[9]=w):w=e[9];const x=w;let y;e[10]!==t||e[11]!==a||e[12]!==i?(y=U=>i({id:t,type:a,path:Kr.toString(U)}),e[10]=t,e[11]=a,e[12]=i,e[13]=y):y=e[13];const b=y,[j,P]=g.useState(null);let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=()=>P(null),e[14]=S):S=e[14];const E=S;let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{P(null)},e[15]=_):_=e[15];let R;if(e[16]!==t||e[17]!==a||e[18]!==c?(R=[t,a,c],e[16]=t,e[17]=a,e[18]=c,e[19]=R):R=e[19],g.useEffect(_,R),j){let U;e[20]!==p?(U=p("document-pane.error.text"),e[20]=p,e[21]=U):U=e[21];let O;e[22]!==h||e[23]!==j||e[24]!==p?(O=h&&u.jsx(me,{overflow:"auto",padding:3,radius:2,tone:"critical",children:u.jsxs(He,{space:3,children:[u.jsx(kt,{muted:!0,size:0,children:p("presentation-error.label")}),u.jsx(Mi,{size:1,children:j.error.message})]})}),e[22]=h,e[23]=j,e[24]=p,e[25]=O):O=e[25];let T;return e[26]!==U||e[27]!==O?(T=u.jsx(mr,{flex:1,message:U,onRetry:E,children:O}),e[26]=U,e[27]=O,e[28]=T):T=e[28],T}let v;e[29]===Symbol.for("react.memo_cache_sentinel")?(v={height:"100%"},e[29]=v):v=e[29];let A;e[30]===Symbol.for("react.memo_cache_sentinel")?(A=u.jsx($r,{}),e[30]=A):A=e[30];let M;e[31]!==b||e[32]!==x?(M=u.jsx(g.Suspense,{fallback:A,children:u.jsx(ga,{paneKey:"document",index:1,itemId:"document",pane:x,onFocusPath:b})}),e[31]=b,e[32]=x,e[33]=M):M=e[33];let I;return e[34]!==n||e[35]!==s||e[36]!==o||e[37]!==c||e[38]!==M?(I=u.jsx(Qr,{onCatch:P,children:u.jsx(Xr,{style:v,children:u.jsx(sn,{searchParams:o,onEditReference:n,onStructureParams:s,structureParams:c,children:M})})}),e[34]=n,e[35]=s,e[36]=o,e[37]=c,e[38]=M,e[39]=I):I=e[39],I}function $i(r){const e=N.c(8),{documentId:t,documentType:a,onFocusPath:i,onEditReference:n,onStructureParams:s,searchParams:o,structureParams:c}=r;let l;return e[0]!==t||e[1]!==a||e[2]!==n||e[3]!==i||e[4]!==s||e[5]!==o||e[6]!==c?(l=u.jsx(qr,{children:u.jsx(Ui,{documentId:t,documentType:a,onEditReference:n,onFocusPath:i,onStructureParams:s,searchParams:o,structureParams:c})}),e[0]=t,e[1]=a,e[2]=n,e[3]=i,e[4]=s,e[5]=o,e[6]=c,e[7]=l):l=e[7],l}function Di(r,e){const t=N.c(7),a=ma();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={},t[0]=i):i=t[0];const[n,s]=g.useState(i),{perspectiveStack:o}=Wr();let c,l;return t[1]!==r||t[2]!==a||t[3]!==o||t[4]!==e?(c=()=>{if(!e)return;const m=wa(a,e,r,o).subscribe(p=>{s(p)});return()=>{m?.unsubscribe()}},l=[a,e,r,o],t[1]=r,t[2]=a,t[3]=o,t[4]=e,t[5]=c,t[6]=l):(c=t[5],l=t[6]),g.useEffect(c,l),n}function Li(r){const e=N.c(40),{documentId:t,documentType:a,mainDocumentState:i,onEditReference:n,onFocusPath:s,onStructureParams:o,refs:c,searchParams:l,structureParams:m}=r,{t:p}=Te(Ie),h=Yn();let d;e[0]!==i?.document?._id||e[1]!==i?.document?._type||e[2]!==l?(d=_=>u.jsx(dr,{..._,state:{id:i?.document?._id,type:i?.document?._type,_searchParams:Object.entries(l)}}),e[0]=i?.document?._id,e[1]=i?.document?._type,e[2]=l,e[3]=d):d=e[3];const f=d;let w;e[4]!==i?.document?._type||e[5]!==h?(w=h.get(i?.document?._type||"shoe"),e[4]=i?.document?._type,e[5]=h,e[6]=w):w=e[6];const x=w,y=Di(i?.document?._id||"",x);let b;e:{if(!i?.document){b=null;break e}let _;e[7]!==i.document||e[8]!==y.snapshot?(_=Zn({snapshot:y.snapshot,fallback:i.document}),e[7]=i.document,e[8]=y.snapshot,e[9]=_):_=e[9];let R;e[10]!==p?(R=p("main-document.label"),e[10]=p,e[11]=R):R=e[11];let v;e[12]!==R?(v=u.jsx(me,{padding:1,radius:2,shadow:1,children:u.jsx(se,{muted:!0,size:0,weight:"medium",children:R})}),e[12]=R,e[13]=v):v=e[13];let A;e[14]!==x||e[15]!==_||e[16]!==v?(A=u.jsx(ea,{..._,schemaType:x,status:v}),e[14]=x,e[15]=_,e[16]=v,e[17]=A):A=e[17],b=A}const j=b;if(t&&a){let _;return e[18]!==t||e[19]!==a||e[20]!==n||e[21]!==s||e[22]!==o||e[23]!==l||e[24]!==m?(_=u.jsx($i,{documentId:t,documentType:a,onEditReference:n,onFocusPath:s,onStructureParams:o,searchParams:l,structureParams:m}),e[18]=t,e[19]=a,e[20]=n,e[21]=s,e[22]=o,e[23]=l,e[24]=m,e[25]=_):_=e[25],_}let P;e[26]!==f||e[27]!==i||e[28]!==j||e[29]!==p?(P=i&&u.jsx(me,{padding:3,tone:i.document?"inherit":"caution",children:i.document?u.jsx(ta,{__unstable_focusRing:!0,as:f,"data-as":"a",radius:2,sizing:"border",tone:"inherit",children:j}):u.jsx(me,{padding:2,radius:2,tone:"inherit",children:u.jsxs(le,{gap:3,children:[u.jsx(we,{flex:"none",children:u.jsx(se,{size:1,children:u.jsx(ra,{})})}),u.jsx(we,{flex:1,children:u.jsx(se,{size:1,children:u.jsx(lr,{t:p,i18nKey:"main-document.missing.text",components:{Code:"code"},values:{path:i.path}})})})]})})}),e[26]=f,e[27]=i,e[28]=j,e[29]=p,e[30]=P):P=e[30];let S;e[31]!==i||e[32]!==n||e[33]!==o||e[34]!==c||e[35]!==l?(S=u.jsx(Ti,{mainDocumentState:i,onEditReference:n,onStructureParams:o,searchParams:l,refs:c}),e[31]=i,e[32]=n,e[33]=o,e[34]=c,e[35]=l,e[36]=S):S=e[36];let E;return e[37]!==P||e[38]!==S?(E=u.jsxs(le,{direction:"column",flex:1,height:"fill",children:[P,S]}),e[37]=P,e[38]=S,e[39]=E):E=e[39],E}function Oi(r){const e=N.c(2);let t;e[0]!==r?(t=()=>r||Oa(),e[0]=r,e[1]=t):t=e[1];const[a]=g.useState(t);return a}const Ni=ye.div.withConfig({displayName:"Resizer",componentId:"sc-1ov4oxw-0"})`position:relative;`,zi=ye.div.withConfig({displayName:"ResizerInner",componentId:"sc-1ov4oxw-1"})`position:absolute;top:0;bottom:0;left:-5px;width:9px;z-index:10;cursor:${({$disabled:r})=>r?"auto":"ew-resize"};& > span:nth-child(1){display:block;border-left:1px solid var(--card-border-color);position:absolute;top:0;left:4px;bottom:0;transition:opacity 200ms;}${({$disabled:r})=>!r&&` + /* Hover effect */ + & > span:nth-child(2) { + display: block; + position: absolute; + top: 0; + left: 0; + width: 9px; + bottom: 0; + background-color: var(--card-border-color); + opacity: 0; + transition: opacity 150ms; + } + + @media (hover: hover) { + &:hover > span:nth-child(2) { + opacity: 0.2; + } + } + `}`,on=function(r){const e=N.c(27),{id:t,order:a,disabled:i}=r,n=i===void 0?!1:i,s=g.useRef(null),o=g.useContext(ur);if(o===null)throw Error("Panel components must be rendered within a PanelGroup container");const c=Oi(t),{activeResizer:l,drag:m,startDragging:p,stopDragging:h,registerElement:d,unregisterElement:f}=o,w=l===c;if(o===null)throw Error("Panel components must be rendered within a PanelGroup container");let x;e[0]!==c||e[1]!==p?(x=O=>{p(c,O.nativeEvent)},e[0]=c,e[1]=p,e[2]=x):x=e[2];const y=x;let b;e[3]!==m||e[4]!==c?(b=O=>{m(c,O)},e[3]=m,e[4]=c,e[5]=b):b=e[5];const j=b;let P;e[6]!==h?(P=()=>{s.current.blur(),h()},e[6]=h,e[7]=P):P=e[7];const S=P;let E,_;e[8]!==n||e[9]!==w||e[10]!==j||e[11]!==S?(E=()=>{if(!w||n)return;const O=(function(){const T=document.body.style,W=document.documentElement.style,{cursor:C}=W,{userSelect:V}=T;return W.cursor="ew-resize",T.userSelect="none",()=>{C?W.cursor=C:W.removeProperty("cursor"),V?T.userSelect=V:T.removeProperty("user-select")}})();return window.addEventListener("mousemove",j),window.addEventListener("mouseup",S),window.addEventListener("contextmenu",S),()=>{O(),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",S),window.removeEventListener("contextmenu",S)}},_=[n,w,j,S],e[8]=n,e[9]=w,e[10]=j,e[11]=S,e[12]=E,e[13]=_):(E=e[12],_=e[13]),g.useEffect(E,_);let R,v;e[14]!==c||e[15]!==a||e[16]!==d||e[17]!==f?(R=()=>(d(c,{id:c,order:a,type:"resizer",el:s}),()=>{f(c)}),v=[c,a,d,f],e[14]=c,e[15]=a,e[16]=d,e[17]=f,e[18]=R,e[19]=v):(R=e[18],v=e[19]),g.useLayoutEffect(R,v);let A,M;e[20]===Symbol.for("react.memo_cache_sentinel")?(M=u.jsx("span",{}),A=u.jsx("span",{}),e[20]=A,e[21]=M):(A=e[20],M=e[21]);let I;e[22]!==n?(I=u.jsxs(zi,{$disabled:n,children:[M,A]}),e[22]=n,e[23]=I):I=e[23];let U;return e[24]!==y||e[25]!==I?(U=u.jsx(Ni,{onMouseDown:y,ref:s,children:I}),e[24]=y,e[25]=I,e[26]=U):U=e[26],U},Wi=r=>{const e=N.c(8),{documentId:t,setDisplayedDocument:a,getCommentIntent:i}=r;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=u.jsx(on,{order:4}),e[0]=n):n=e[0];let s;e[1]!==i||e[2]!==r.children?(s=u.jsx(Ln,{getIntent:i,children:r.children}),e[1]=i,e[2]=r.children,e[3]=s):s=e[3];let o;return e[4]!==t||e[5]!==a||e[6]!==s?(o=u.jsxs(u.Fragment,{children:[n,u.jsx(pr,{id:"content",minWidth:325,order:5,children:u.jsx(Ea,{documentId:t,setDisplayedDocument:a,children:s})})]}),e[4]=t,e[5]=a,e[6]=s,e[7]=o):o=e[7],o},Fi=r=>{const e=N.c(15),{documentId:t,documentsOnPage:a,documentType:i,getCommentIntent:n,mainDocumentState:s,onEditReference:o,onFocusPath:c,onStructureParams:l,searchParams:m,setDisplayedDocument:p,structureParams:h}=r;let d;e[0]!==t||e[1]!==i||e[2]!==a||e[3]!==s||e[4]!==o||e[5]!==c||e[6]!==l||e[7]!==m||e[8]!==h?(d=u.jsx(Li,{documentId:t,documentType:i,mainDocumentState:s,onEditReference:o,onFocusPath:c,onStructureParams:l,refs:a,searchParams:m,structureParams:h}),e[0]=t,e[1]=i,e[2]=a,e[3]=s,e[4]=o,e[5]=c,e[6]=l,e[7]=m,e[8]=h,e[9]=d):d=e[9];let f;return e[10]!==t||e[11]!==n||e[12]!==p||e[13]!==d?(f=u.jsx(Wi,{documentId:t,getCommentIntent:n,setDisplayedDocument:p,children:d}),e[10]=t,e[11]=n,e[12]=p,e[13]=d,e[14]=f):f=e[14],f},Vi=function(r){const e=N.c(5),{children:t,navigate:a}=r;let i;e[0]!==a?(i=(o,c)=>{if(o||c){const l={};o&&(l.params={preview:o}),c&&(l.state=c),a(l)}},e[0]=a,e[1]=i):i=e[1];const n=i;let s;return e[2]!==t||e[3]!==n?(s=u.jsx(da.Provider,{value:n,children:t}),e[2]=t,e[3]=n,e[4]=s):s=e[4],s};function Bi(r,e){const t=N.c(9);let a;t[0]!==e||t[1]!==r?(a=()=>JSON.parse(localStorage.getItem(r)??JSON.stringify(e)),t[0]=e,t[1]=r,t[2]=a):a=t[2];const[i,n]=g.useState(a);let s,o;t[3]!==r||t[4]!==i?(s=()=>{localStorage.setItem(r,JSON.stringify(i))},o=[r,i],t[3]=r,t[4]=i,t[5]=s,t[6]=o):(s=t[5],o=t[6]),g.useEffect(s,o);let c;return t[7]!==i?(c=[i,n],t[7]=i,t[8]=c):c=t[8],c}function Ki(r){const e=N.c(11),{unstable_navigator:t}=r,a=!!t?.component,[i,n]=Bi("presentation/navigator",a),s=a?i:!1;let o;e:{if(!a){o=void 0;break e}let d;e[0]!==n?(d=()=>n(Hi),e[0]=n,e[1]=d):d=e[1],o=d}const c=o;let l;e[2]!==s||e[3]!==t?(l=function(){return u.jsx(u.Fragment,{children:s&&u.jsx(qi,{...t})})},e[2]=s,e[3]=t,e[4]=l):l=e[4];const m=l;let p;e[5]!==s||e[6]!==c?(p={navigatorEnabled:s,toggleNavigator:c},e[5]=s,e[6]=c,e[7]=p):p=e[7];let h;return e[8]!==m||e[9]!==p?(h=[p,m],e[8]=m,e[9]=p,e[10]=h):h=e[10],h}function Hi(r){return!r}function Gi(r){const e=N.c(11),{minWidth:t,maxWidth:a,component:i}=r,n=t!=null&&a!=null&&t===a;let s;e[0]!==i?(s=u.jsx(i,{}),e[0]=i,e[1]=s):s=e[1];let o;e[2]!==a||e[3]!==t||e[4]!==s?(o=u.jsx(pr,{id:"navigator",minWidth:t,maxWidth:a,order:1,children:s}),e[2]=a,e[3]=t,e[4]=s,e[5]=o):o=e[5];let c;e[6]!==n?(c=u.jsx(on,{order:2,disabled:n}),e[6]=n,e[7]=c):c=e[7];let l;return e[8]!==o||e[9]!==c?(l=u.jsxs(u.Fragment,{children:[o,c]}),e[8]=o,e[9]=c,e[10]=l):l=e[10],l}const qi=g.memo(Gi),Qi=function(r){const e=N.c(3),{children:t,params:a}=r,i=a;let n;return e[0]!==t||e[1]!==i?(n=u.jsx(ua.Provider,{value:i,children:t}),e[0]=t,e[1]=i,e[2]=n):n=e[2],n},Xi=function(r){const e=N.c(10),{children:t,devMode:a,name:i,navigate:n,params:s,searchParams:o,structureParams:c}=r;let l;e[0]!==a||e[1]!==i||e[2]!==n||e[3]!==s||e[4]!==o||e[5]!==c?(l={devMode:a,name:i,navigate:n,params:s,searchParams:o,structureParams:c},e[0]=a,e[1]=i,e[2]=n,e[3]=s,e[4]=o,e[5]=c,e[6]=l):l=e[6];const m=l;let p;return e[7]!==t||e[8]!==m?(p=u.jsx(pa.Provider,{value:m,children:t}),e[7]=t,e[8]=m,e[9]=p):p=e[9],p};function hr(r){const e=ae(r,Ji);if(!Array.isArray(e))throw new TypeError("allowPatterns must be an array");return e}function Ji(r){return r.context.allowOrigins}function mt(r){return Array.isArray(r)?r.join(","):r}function cn(){const r=N.c(2),e=g.useId();let t;return r[0]!==e?(t=e.startsWith(":")?e.replace(/^:(.+):$/,"«$1»"):e,r[0]=e,r[1]=t):t=r[1],t}const Yi=g.forwardRef(function(r,e){const t=N.c(19),{animate:a,initial:i,onLoad:n,preventClick:s,src:o,variants:c,style:l}=r,m=g.useRef(null);let p;t[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>m.current,t[0]=p):p=t[0],g.useImperativeHandle(e,p);let h,d;t[1]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{if(!m.current)return;const P=m.current,S=function(){P===document.activeElement&&P.dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,cancelable:!0}))};return window.addEventListener("blur",S),()=>{window.removeEventListener("blur",S)}},d=[],t[1]=h,t[2]=d):(h=t[1],d=t[2]),g.useEffect(h,d);const f=cn();let w;t[3]!==l||t[4]!==f?(w={...l,viewTransitionName:f},t[3]=l,t[4]=f,t[5]=w):w=t[5];let x;t[6]!==a||t[7]!==i||t[8]!==n||t[9]!==o||t[10]!==w||t[11]!==c?(x=u.jsx(Zi,{style:w,animate:a,initial:i,onLoad:n,ref:m,src:o,variants:c}),t[6]=a,t[7]=i,t[8]=n,t[9]=o,t[10]=w,t[11]=c,t[12]=x):x=t[12];let y;t[13]!==s?(y=s&&u.jsx(es,{}),t[13]=s,t[14]=y):y=t[14];let b;t[15]===Symbol.for("react.memo_cache_sentinel")?(b=u.jsx(ts,{}),t[15]=b):b=t[15];let j;return t[16]!==x||t[17]!==y?(j=u.jsxs(u.Fragment,{children:[x,y,b]}),t[16]=x,t[17]=y,t[18]=j):j=t[18],j}),Zi=xt.create(ye.iframe.withConfig({displayName:"IFrameElement",componentId:"sc-yizz5y-0"})`box-shadow:0 0 0 1px var(--card-border-color);border:0;max-height:100%;width:100%;view-transition-class:presentation-tool-iframe;`),es=ye(we).withConfig({displayName:"IFrameOverlay",componentId:"sc-yizz5y-1"})`position:absolute;inset:0;background:transparent;`,ts=Bn` +html:active-view-transition-type(sanity-iframe-viewport) { + view-transition-name: none; + &::view-transition { + pointer-events: none; + } + /* &::view-transition-old(root) { + display: none; + } + &::view-transition-new(root) { + animation: none; + } */ +} +`;function rs(r){const e=N.c(21),{openPopup:t,previewLocationOrigin:a,previewLocationRoute:i,perspective:n,targetOrigin:s}=r;let o;e[0]!==n||e[1]!==a||e[2]!==i||e[3]!==s?(o=new URL(i,a||s),o.searchParams.set(pt,mt(n)),e[0]=n,e[1]=a,e[2]=i,e[3]=s,e[4]=o):o=e[4];const{pathname:c,search:l}=o,m=`${a}${c}${l}`,{t:p}=Te(Ie);let h;e[5]!==t?(h=P=>{P.preventDefault(),t(P.currentTarget.href)},e[5]=t,e[6]=h):h=e[6];const d=h;let f;e[7]!==p?(f=p("share-url.menu-item.open.text"),e[7]=p,e[8]=f):f=e[8];let w;e[9]!==f?(w=u.jsx(se,{size:1,children:f}),e[9]=f,e[10]=w):w=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=["bottom-start"],e[11]=x):x=e[11];let y;e[12]!==p?(y=p("share-url.menu-item.open.text"),e[12]=p,e[13]=y):y=e[13];let b;e[14]!==d||e[15]!==m||e[16]!==y?(b=u.jsx(Oe,{as:"a","aria-label":y,icon:ya,mode:"bleed",href:m,rel:"opener",target:"_blank",tooltipProps:null,onClick:d}),e[14]=d,e[15]=m,e[16]=y,e[17]=b):b=e[17];let j;return e[18]!==w||e[19]!==b?(j=u.jsx(gt,{animate:!0,content:w,fallbackPlacements:x,placement:"bottom",portal:!0,children:b}),e[18]=w,e[19]=b,e[20]=j):j=e[20],j}function ln(r){const e=ae(r,ns);if(!e)throw new TypeError("targetOrigin is required");return e}function ns(r){return r.context.previewUrl?.origin}function as(r){const e=N.c(32),{fontSize:t,onChange:a,padding:i,prefix:n,suffix:s,value:o,previewUrlRef:c}=r,l=t===void 0?1:t,m=i===void 0?3:i,p=hr(c),h=ln(c),{t:d}=Te(Ie),{basePath:f}=Lr()?.activeWorkspace||{},w=f===void 0?"/":f,x=g.useRef(null),[y,b]=g.useState(void 0),[j,P]=g.useState(void 0);let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=G=>{b(G.currentTarget.value)},e[0]=S):S=e[0];const E=S;let _;e[1]!==p||e[2]!==w||e[3]!==a||e[4]!==y||e[5]!==d||e[6]!==h?(_=G=>{if(G.key==="Enter"){if(y===void 0)return;let L=y;try{L=new URL(y,h).toString()}catch{}if(Array.isArray(p)){if(!p.some(J=>J.test(L))){P(d("preview-location-input.error",{origin:h,context:"origin-not-allowed"})),G.currentTarget.reportValidity();return}}else if(!h&&(L.startsWith(`${w}/`)||L===w)){P(d("preview-location-input.error",{basePath:w,context:"same-base-path"}));return}const K=L===h?`${h}/`:L;P(void 0),b(void 0),a(K),x.current?.blur()}G.key==="Escape"&&(P(void 0),b(void 0))},e[1]=p,e[2]=w,e[3]=a,e[4]=y,e[5]=d,e[6]=h,e[7]=_):_=e[7];const R=_;let v;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{P(void 0),b(void 0)},e[8]=v):v=e[8];const A=v;let M;e[9]!==h||e[10]!==o?(M=()=>{P(void 0);let G=o;try{G=new URL(o,h).toString()}catch{}b(G)},e[9]=h,e[10]=o,e[11]=M):M=e[11];const I=M;let U;e[12]===Symbol.for("react.memo_cache_sentinel")?(U=()=>{P(void 0),b(void 0)},e[12]=U):U=e[12];let O;e[13]!==h||e[14]!==o?(O=[h,o],e[13]=h,e[14]=o,e[15]=O):O=e[15],g.useEffect(U,O);let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T={icon:xa},e[16]=T):T=e[16];const W=j?T:void 0;let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C={zIndex:1},e[17]=C):C=e[17];let V;e[18]!==y||e[19]!==h||e[20]!==o?(V=y===void 0?new URL(o,h).toString():y,e[18]=y,e[19]=h,e[20]=o,e[21]=V):V=e[21];let z;return e[22]!==j||e[23]!==l||e[24]!==I||e[25]!==R||e[26]!==m||e[27]!==n||e[28]!==s||e[29]!==W||e[30]!==V?(z=u.jsx(u.Fragment,{children:u.jsx(na,{clearButton:W,customValidity:j,fontSize:l,onBlur:A,onClear:I,onChange:E,onKeyDownCapture:R,padding:m,prefix:n,style:C,radius:2,ref:x,space:m,suffix:s,value:V})}),e[22]=j,e[23]=l,e[24]=I,e[25]=R,e[26]=m,e[27]=n,e[28]=s,e[29]=W,e[30]=V,e[31]=z):z=e[31],z}const is=g.lazy(()=>Ne(()=>import("./QRCodeSVG-BpS_-ERN.js"),__vite__mapDeps([0,1]))),tr=24,ss=16,os=224,cs=ye(Pa).withConfig({displayName:"StyledSanityMonogram",componentId:"sc-wa94k4-0"})`position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);height:${tr}px;width:${tr}px;`,ls=xt.create(It),us=xt.create(se),ds=xt.create(cs);function ps(r){const e=N.c(47),{canToggleSharePreviewAccess:t,canUseSharedPreviewAccess:a,initialUrl:i,previewLocationRoute:n,perspective:s}=r,{t:o}=Te(Ie),{push:c}=Dt();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={apiVersion:Lt},e[0]=l):l=e[0];const m=$t(l),p=Dr(),[h,d]=g.useState(!0),[f,w]=g.useState(!1),[x,y]=g.useState(!1),[b,j]=g.useState(null),P=f||x||h;let S;e[1]!==i||e[2]!==s||e[3]!==n||e[4]!==b?(S=b?za(i,b,n,mt(s)):null,e[1]=i,e[2]=s,e[3]=n,e[4]=b,e[5]=S):S=e[5];const E=S,[_,R]=g.useState(null);if(_)throw _;let v;e[6]!==c||e[7]!==o?(v=()=>{c({closable:!0,status:"warning",title:o("share-preview-menu.error_toggle-sharing",{context:"toggle-sharing"})})},e[6]=c,e[7]=o,e[8]=v):v=e[8];const A=v;let M;e[9]!==m||e[10]!==p?.id?(M=async()=>{const $=async()=>{y(!0),await Fa(m,"sanity/presentation",typeof window>"u"?"":location.href,p?.id),j(null)};try{await $()}catch(F){R(F)}y(!1)},e[9]=m,e[10]=p?.id,e[11]=M):M=e[11];const I=M;let U;e[12]!==m||e[13]!==p?.id?(U=async()=>{const $=async()=>{w(!0);const F=await Wa(m,"sanity/presentation",typeof window>"u"?"":location.href,p?.id);j(F.secret)};try{await $()}catch(F){R(F)}w(!1)},e[12]=m,e[13]=p?.id,e[14]=U):U=e[14];const O=U;let T;e[15]!==c||e[16]!==o||e[17]!==E?(T=async()=>{const $=async()=>{if(!E)throw new Error("No URL to copy");await navigator.clipboard.writeText(E.toString()),c({closable:!0,status:"success",title:o("share-url.clipboard.status",{context:"success"})})};try{await $()}catch(F){R(F)}},e[15]=c,e[16]=o,e[17]=E,e[18]=T):T=e[18];const W=T;let C,V;e[19]!==m?(C=()=>{let $=new AbortController,F=[];const H=async function(Y,re){const{result:k,syncTags:q}=await m.fetch(Gr,{},{filterResponse:!1,lastLiveEventId:Y,tag:"presentation.fetch-shared-access-secret"});Array.isArray(q)&&(F=q),re.aborted||j(k)},ee=m.live.events().subscribe({next:Y=>{Y.type==="message"&&($.abort(),$=new AbortController,Y.tags.some(re=>F.includes(re))&&H(Y.id,$.signal))},error:R});return H(null,$.signal).finally(()=>d(!1)),()=>{ee.unsubscribe(),$.abort()}},V=[m],e[19]=m,e[20]=C,e[21]=V):(C=e[20],V=e[21]),g.useEffect(C,V);let z;e[22]!==o?(z=o("preview-frame.share-button.aria-label"),e[22]=o,e[23]=z):z=e[23];let G;e[24]!==z?(G=u.jsx(Oe,{"aria-label":z,icon:ba,mode:"bleed",tooltipProps:null}),e[24]=z,e[25]=G):G=e[25];let L;e[26]===Symbol.for("react.memo_cache_sentinel")?(L={maxWidth:248},e[26]=L):L=e[26];const K=a?void 0:0;let J;e[27]!==P||e[28]!==t||e[29]!==a||e[30]!==x||e[31]!==f||e[32]!==W||e[33]!==I||e[34]!==O||e[35]!==A||e[36]!==h||e[37]!==o||e[38]!==E?(J=a?u.jsxs(u.Fragment,{children:[u.jsx("label",{style:{cursor:"pointer"},children:u.jsxs(aa,{columns:2,rows:2,gapX:3,gapY:1,style:{justifyContent:"center",alignItems:"center",gridTemplateColumns:"min-content 1fr",gridTemplateRows:"min-content"},paddingTop:3,paddingX:3,children:[u.jsx(gt,{animate:!0,content:u.jsx(se,{size:1,children:o("share-preview-menu.toggle-button.tooltip",{context:E?"disable":"enable"})}),fallbackPlacements:["bottom-start"],placement:"bottom",portal:!0,children:u.jsx(Hr,{checked:f||E!==null&&!x,readOnly:f||x,indeterminate:h,onChange:t?E?I:O:A})}),u.jsx(se,{size:1,weight:"medium",children:o("share-preview-menu.toggle-button.label",{context:"first-line"})}),u.jsx("span",{}),u.jsx(se,{muted:!0,size:1,children:o("share-preview-menu.toggle-button.label",{context:"second-line"})})]})}),u.jsx(we,{padding:3,paddingTop:2,children:u.jsxs(He,{space:3,children:[u.jsx(me,{tone:P||!E?"transparent":void 0,style:{position:"relative",aspectRatio:"1 / 1",display:"flex",alignItems:"center",justifyContent:"center"},children:u.jsx(Vr,{children:P?u.jsx(ls,{muted:!0,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}):E?u.jsx(u.Fragment,{children:u.jsxs(g.Suspense,{fallback:u.jsx(It,{}),children:[u.jsx(is,{title:o("share-preview-menu.qr-code.title",{url:E.toString()}),value:E.toString(),size:os,color:"var(--card-fg-color)",logoSize:tr+ss}),u.jsx(ds,{initial:{opacity:-.5},animate:{opacity:1.5},exit:{opacity:0}})]})}):u.jsx(us,{muted:!0,size:1,style:{maxWidth:"100px",textWrap:"pretty",textAlign:"center"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:o("share-preview-menu.qr-code.placeholder")})})}),u.jsx(se,{muted:!0,size:1,children:o("share-preview-menu.qr-code.instructions")})]})}),u.jsx(ia,{}),u.jsx(sa,{disabled:!E||x,icon:oa,onClick:W,text:o("share-preview-menu.copy-url.text")})]}):u.jsx(me,{padding:2,tone:"caution",radius:3,children:u.jsx(se,{style:{textWrap:"pretty"},children:o("share-preview-menu.error",{context:"missing-grants"})})}),e[27]=P,e[28]=t,e[29]=a,e[30]=x,e[31]=f,e[32]=W,e[33]=I,e[34]=O,e[35]=A,e[36]=h,e[37]=o,e[38]=E,e[39]=J):J=e[39];let X;e[40]!==K||e[41]!==J?(X=u.jsx(Sa,{style:L,padding:K,children:J}),e[40]=K,e[41]=J,e[42]=X):X=e[42];let B;e[43]===Symbol.for("react.memo_cache_sentinel")?(B={constrainSize:!0,placement:"bottom",portal:!0},e[43]=B):B=e[43];let te;return e[44]!==X||e[45]!==G?(te=u.jsx(ca,{button:G,id:"share-menu",menu:X,popover:B}),e[44]=X,e[45]=G,e[46]=te):te=e[46],te}const ms=r=>{const e=N.c(110),{canSharePreviewAccess:t,canToggleSharePreviewAccess:a,canUseSharedPreviewAccess:i,iframeRef:n,initialUrl:s,navigatorEnabled:o,onPathChange:c,onRefresh:l,openPopup:m,overlaysConnection:p,presentationRef:h,perspective:d,previewUrl:f,setViewport:w,targetOrigin:x,toggleNavigator:y,toggleOverlay:b,viewport:j,previewUrlRef:P}=r,{t:S}=Te(Ie);let E;e[0]!==w||e[1]!==j?(E=()=>w(j==="desktop"?"mobile":"desktop"),e[0]=w,e[1]=j,e[2]=E):E=e[2];const _=E,R=x===location.origin?"":x;let v;e[3]!==n||e[4]!==l||e[5]!==h||e[6]!==f||e[7]!==x?(v=()=>{l(()=>{n.current&&(h.send({type:"iframe reload"}),Object.assign(n.current,{src:new URL(f||"/",x).toString()}))})},e[3]=n,e[4]=l,e[5]=h,e[6]=f,e[7]=x,e[8]=v):v=e[8];const A=v,M=ae(h,vs),I=ae(h,gs),U=ae(h,ws),O=ae(h,ys),T=ae(h,xs);let W;if(e[9]!==f||e[10]!==x){const ht=new URL(f||"/",x);W=Na(ht),e[9]=f,e[10]=x,e[11]=W}else W=e[11];const{pathname:C,search:V}=W,z=`${C}${V}`,G=cn(),L=ae(P,Ps);let K;e[12]===Symbol.for("react.memo_cache_sentinel")?(K={width:"100%"},e[12]=K):K=e[12];let J;e[13]!==o||e[14]!==S||e[15]!==y?(J=y&&u.jsx(Oe,{"aria-label":S("preview-frame.navigator.toggle-button.aria-label"),icon:On,mode:"bleed",onClick:y,selected:o,tooltipProps:{content:u.jsx(se,{size:1,children:S("preview-frame.navigator.toggle-button.tooltip")}),fallbackPlacements:["bottom-start"],placement:"bottom"}}),e[13]=o,e[14]=S,e[15]=y,e[16]=J):J=e[16];let X;e[17]===Symbol.for("react.memo_cache_sentinel")?(X={whiteSpace:"nowrap"},e[17]=X):X=e[17];const B=T?"disable":"enable";let te;e[18]!==S||e[19]!==B?(te=S("preview-frame.overlay.toggle-button.tooltip",{context:B}),e[18]=S,e[19]=B,e[20]=te):te=e[20];let $;e[21]!==te?($=u.jsx(we,{padding:1,children:u.jsx(se,{size:1,children:te})}),e[21]=te,e[22]=$):$=e[22];let F;e[23]===Symbol.for("react.memo_cache_sentinel")?(F=u.jsx(we,{paddingY:1,children:u.jsx(Kn,{keys:["Alt"],style:{marginTop:-4,marginBottom:-4}})}),e[23]=F):F=e[23];let H;e[24]!==$?(H=u.jsxs(le,{align:"center",style:X,children:[$,F]}),e[24]=$,e[25]=H):H=e[25];let ee;e[26]===Symbol.for("react.memo_cache_sentinel")?(ee=["bottom-start"],e[26]=ee):ee=e[26];let Y;e[27]===Symbol.for("react.memo_cache_sentinel")?(Y={lineHeight:0,borderRadius:999,userSelect:"none"},e[27]=Y):Y=e[27];const re=T?"transparent":void 0;let k;e[28]===Symbol.for("react.memo_cache_sentinel")?(k={margin:-4},e[28]=k):k=e[28];const q=!I,Q=M||p!=="connected";let oe;e[29]!==T||e[30]!==q||e[31]!==Q||e[32]!==b?(oe=u.jsx("div",{style:k,children:u.jsx(Hr,{indeterminate:q,checked:T,onChange:b,disabled:Q})}),e[29]=T,e[30]=q,e[31]=Q,e[32]=b,e[33]=oe):oe=e[33];const xe=!T;let he;e[34]!==S?(he=S("preview-frame.overlay.toggle-button.text"),e[34]=S,e[35]=he):he=e[35];let fe;e[36]!==xe||e[37]!==he?(fe=u.jsx(we,{children:u.jsx(se,{muted:xe,size:1,weight:"medium",children:he})}),e[36]=xe,e[37]=he,e[38]=fe):fe=e[38];let de;e[39]!==oe||e[40]!==fe?(de=u.jsxs(le,{align:"center",gap:3,children:[oe,fe]}),e[39]=oe,e[40]=fe,e[41]=de):de=e[41];let ve;e[42]!==re||e[43]!==de?(ve=u.jsx(me,{as:"label",flex:"none",padding:3,marginX:1,style:Y,tone:re,children:de}),e[42]=re,e[43]=de,e[44]=ve):ve=e[44];let pe;e[45]!==H||e[46]!==ve?(pe=u.jsx(gt,{animate:!0,content:H,fallbackPlacements:ee,placement:"bottom",portal:!0,children:ve}),e[45]=H,e[46]=ve,e[47]=pe):pe=e[47];let $e;e[48]!==I||e[49]!==M||e[50]!==U||e[51]!==O||e[52]!==S?($e=I?S("preview-frame.refresh-button.tooltip"):S("preview-frame.status",{context:M?"loading":U?"refreshing":O?"reloading":"unknown"}),e[48]=I,e[49]=M,e[50]=U,e[51]=O,e[52]=S,e[53]=$e):$e=e[53];let Pe;e[54]!==$e?(Pe=u.jsx(se,{size:1,children:$e}),e[54]=$e,e[55]=Pe):Pe=e[55];let De;e[56]===Symbol.for("react.memo_cache_sentinel")?(De=["bottom-end"],e[56]=De):De=e[56];let be;e[57]!==S?(be=S("preview-frame.refresh-button.aria-label"),e[57]=S,e[58]=be):be=e[58];const ze=O||U||L;let Se;e[59]!==A||e[60]!==be||e[61]!==ze?(Se=u.jsx(Oe,{"aria-label":be,icon:Hn,mode:"bleed",loading:ze,onClick:A,tooltipProps:null}),e[59]=A,e[60]=be,e[61]=ze,e[62]=Se):Se=e[62];let ke;e[63]!==Pe||e[64]!==Se?(ke=u.jsx(we,{padding:1,children:u.jsx(gt,{animate:!0,content:Pe,fallbackPlacements:De,placement:"bottom",portal:!0,children:Se})}),e[63]=Pe,e[64]=Se,e[65]=ke):ke=e[65];let _e;e[66]!==m||e[67]!==d||e[68]!==R||e[69]!==z||e[70]!==x?(_e=u.jsx(we,{padding:1,children:u.jsx(rs,{openPopup:m,previewLocationOrigin:R,previewLocationRoute:z,perspective:d,targetOrigin:x})}),e[66]=m,e[67]=d,e[68]=R,e[69]=z,e[70]=x,e[71]=_e):_e=e[71];let Me;e[72]!==c||e[73]!==z||e[74]!==P||e[75]!==ke||e[76]!==_e?(Me=u.jsx(we,{flex:1,children:u.jsx(as,{previewUrlRef:P,prefix:ke,onChange:c,suffix:_e,value:z})}),e[72]=c,e[73]=z,e[74]=P,e[75]=ke,e[76]=_e,e[77]=Me):Me=e[77];let je;e[78]!==G?(je=ht=>{ht?.style.setProperty("view-transition-name",G)},e[78]=G,e[79]=je):je=e[79];const Be=j==="desktop"?"narrow":"full";let Ee;e[80]!==S||e[81]!==Be?(Ee=S("preview-frame.viewport-button.tooltip",{context:Be}),e[80]=S,e[81]=Be,e[82]=Ee):Ee=e[82];let Ue;e[83]!==Ee?(Ue=u.jsx(se,{size:1,children:Ee}),e[83]=Ee,e[84]=Ue):Ue=e[84];let Le;e[85]===Symbol.for("react.memo_cache_sentinel")?(Le=["bottom-start"],e[85]=Le):Le=e[85];let Re;e[86]!==S?(Re=S("preview-frame.viewport-button.aria-label"),e[86]=S,e[87]=Re):Re=e[87];const We=j==="desktop"?Nn:zn;let Ce;e[88]!==Re||e[89]!==We||e[90]!==_||e[91]!==j?(Ce=u.jsx(Oe,{"data-testid":"preview-viewport-toggle","data-viewport":j,"aria-label":Re,icon:We,mode:"bleed",onClick:_,tooltipProps:null}),e[88]=Re,e[89]=We,e[90]=_,e[91]=j,e[92]=Ce):Ce=e[92];let Ae;e[93]!==je||e[94]!==Ue||e[95]!==Ce?(Ae=u.jsx(le,{align:"center",flex:"none",gap:1,children:u.jsx(gt,{animate:!0,ref:je,content:Ue,fallbackPlacements:Le,placement:"bottom",portal:!0,children:Ce})}),e[93]=je,e[94]=Ue,e[95]=Ce,e[96]=Ae):Ae=e[96];let ue;e[97]!==t||e[98]!==a||e[99]!==i||e[100]!==s||e[101]!==d||e[102]!==z?(ue=t&&u.jsx(le,{align:"center",flex:"none",gap:1,children:u.jsx(ps,{canToggleSharePreviewAccess:a,canUseSharedPreviewAccess:i,previewLocationRoute:z,initialUrl:s,perspective:d})}),e[97]=t,e[98]=a,e[99]=i,e[100]=s,e[101]=d,e[102]=z,e[103]=ue):ue=e[103];let Fe;return e[104]!==pe||e[105]!==Me||e[106]!==J||e[107]!==Ae||e[108]!==ue?(Fe=u.jsxs(le,{align:"center",gap:1,paddingX:1,style:K,children:[J,pe,Me,Ae,ue]}),e[104]=pe,e[105]=Me,e[106]=J,e[107]=Ae,e[108]=ue,e[109]=Fe):Fe=e[109],Fe};function hs(r){const e=N.c(7),t=fs,a=r.options?.component;let i;e[0]!==a||e[1]!==r?(i=a?u.jsx(a,{...r,renderDefault:t}):t(r),e[0]=a,e[1]=r,e[2]=i):i=e[2];const n=i;let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s={position:"relative"},e[3]=s):s=e[3];let o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o={minHeight:0},e[4]=o):o=e[4];let c;return e[5]!==n?(c=u.jsx(me,{flex:"none",padding:2,borderBottom:!0,style:s,children:u.jsx(le,{align:"center",style:o,children:n})}),e[5]=n,e[6]=c):c=e[6],c}function fs(r){return u.jsx(ms,{...r})}function vs(r){return r.matches("loading")}function gs(r){return r.matches("loaded")}function ws(r){return r.matches({loaded:"refreshing"})}function ys(r){return r.matches({loaded:"reloading"})}function xs(r){return r.context.visualEditingOverlaysEnabled}function Ps(r){return r.hasTag("busy")}const qt=xt.create(le),un=g.memo(g.forwardRef(function(r,e){const{header:t,initialUrl:a,loadersConnection:i,overlaysConnection:n,perspective:s,viewport:o,vercelProtectionBypass:c,presentationRef:l,previewUrlRef:m}=r,[p,h]=g.useState(null),d=mt(p===null?s:p),f=g.useMemo(()=>{const k=new URL(a);return k.searchParams.get(pt)||k.searchParams.set(pt,d),(c||k.searchParams.get(vt))&&k.searchParams.set(ar,"samesitenone"),c&&!k.searchParams.get(vt)&&k.searchParams.set(vt,c),k},[a,d,c]);g.useEffect(()=>{i==="connected"&&h(k=>k===null?s:k)},[i,s]);const{t:w}=Te(Ie),{devMode:x}=cr(),y=Mn(),b=g.useRef(null),j=u.jsx(hs,{...r,iframeRef:b,options:t});g.useImperativeHandle(e,()=>b.current);const P=ae(l,k=>k.matches("loading")||k.matches({loaded:"reloading"})),[S,E]=g.useState(!1),_=ae(l,k=>k.matches({loaded:"refreshing"})),[R,v]=g.useState(!1),A=P||_||n==="connecting",M=g.useCallback(()=>{b.current&&(b.current.src=f.toString(),l.send({type:"iframe reload"}))},[l,f]),[I,U]=g.useState(!1),O=g.useCallback(()=>{U(!0)},[]),[T,W]=g.useState(!1);g.useEffect(()=>{if(!(P||_)&&(n==="connecting"||n==="reconnecting")){const k=setTimeout(()=>{W(!0)},5e3);return()=>clearTimeout(k)}},[n,P,_]),g.useEffect(()=>{if(!(P||_||!T)){if(n==="connected"&&(v(!1),W(!1),E(!1),U(!1)),n==="connecting"){const k=setTimeout(()=>{E(!0),console.error("Unable to connect to visual editing. Make sure you've setup '@sanity/visual-editing' correctly")},vr);return()=>clearTimeout(k)}if(n==="reconnecting"){const k=setTimeout(()=>{E(!0),v(!0)},vr);return()=>clearTimeout(k)}}},[P,n,_,T]);const C=g.useCallback(()=>{l.send({type:"iframe loaded"})},[l]),V=g.useMemo(()=>(P||n==="connecting"&&!_)&&!I,[I,P,_,n]),z=g.useSyncExternalStore(g.useCallback(()=>()=>{},[]),()=>CSS.supports("(view-transition-name: test)")),G=g.useMemo(()=>[V?"background":"active",P?"reloading":"idle",z?"":o,T&&!I?"timedOut":""],[z,I,P,V,T,o]),[L,K]=g.useState(o),[J,X]=g.useState(Qt[o]);g.useEffect(()=>{if(z&&o!==L){const k=()=>{K(o),X(Qt[o])};!y&&"startViewTransition"in document&&typeof document.startViewTransition=="function"?document.startViewTransition({update:()=>Un.flushSync(()=>k()),types:["sanity-iframe-viewport"]}):k()}},[z,y,L,o]);const B=Dt(),te=hr(m),[$,F]=g.useState(!1),[H]=g.useState(new Set),ee=g.useEffectEvent(k=>{if(te.some(q=>q.test(k))){F(k);return}H.has(k)||(H.add(k),console.warn("Visual Editing is here but misconfigured",{reportedOrigin:k}),B.push({closable:!0,id:`presentation-iframe-origin-mismatch-${k}`,status:"error",duration:1/0,title:w("preview-frame.configuration.error.title"),description:u.jsx(lr,{t:w,i18nKey:"preview-frame.configuration.error.description",components:{Code:"code"},values:{targetOrigin:f.origin,reportedOrigin:k}})}))}),Y=$n(),re=g.useEffectEvent(k=>{if(!$)return;const q=new URL(k,$);Y(`${$}${q.pathname}${q.search}${q.hash}`)});return g.useEffect(()=>{if(!$)return;const k=b.current?.contentWindow;if(!k)return;const q=Br({targetOrigin:$});q.addTarget(k);const Q=q.createChannel({name:"presentation",heartbeat:!0,connectTo:"visual-editing"},Yt().provide({actors:Zt()}));Q.on("visual-editing/navigate",xe=>{re(xe.url)});const oe=Q.start();return()=>{oe(),q.destroy()}},[$]),g.useEffect(()=>{if(n==="connecting"||n==="reconnecting"){const k=setInterval(()=>{b.current?.contentWindow?.postMessage({domain:"sanity/channels",from:"presentation",type:"presentation/status"},"*")},1e3),q=new AbortController;return window.addEventListener("message",({data:Q})=>{Q&&typeof Q=="object"&&"domain"in Q&&Q.domain==="sanity/channels"&&"type"in Q&&Q.type==="visual-editing/status"&&"data"in Q&&typeof Q.data=="object"&&Q.data&&"origin"in Q.data&&typeof Q.data.origin=="string"&&ee(Q.data.origin)},{signal:q.signal}),()=>{q.abort(),clearInterval(k)}}},[n,S]),u.jsx(Ca,{transition:y?{duration:0}:void 0,children:u.jsxs(Dn,{children:[j,u.jsx(me,{flex:1,tone:"transparent",children:u.jsxs(le,{align:"center",height:"fill",justify:"center",padding:(z?L:o)==="desktop"?0:2,sizing:"border",style:{position:"relative",cursor:A?"wait":void 0},children:[u.jsx(Vr,{children:!R&&!P&&!_&&T&&!I?u.jsx(qt,{initial:"initial",animate:"animate",exit:"exit",variants:br,justify:"center",align:"center",style:{inset:"0",position:"absolute",backdropFilter:S?"blur(16px) saturate(0.5) grayscale(0.5)":"blur(2px)",transition:"backdrop-filter 0.2s ease-in-out",WebkitBackdropFilter:S?"blur(16px) saturate(0.5) grayscale(0.5)":"blur(2px)",WebkitTransition:"-webkit-backdrop-filter 0.2s ease-in-out",zIndex:1},children:u.jsxs(le,{style:{...Ut[o]},justify:"center",align:"center",direction:"column",gap:4,children:[S&&u.jsx(Oe,{disabled:!0,mode:"ghost",text:w("preview-frame.continue-button.text"),style:{opacity:0}}),u.jsx(me,{radius:2,tone:S?"caution":"inherit",padding:4,shadow:1,children:u.jsxs(le,{justify:"center",align:"center",direction:"column",gap:4,children:[u.jsx(It,{muted:!0}),u.jsx(se,{muted:!0,size:1,children:S?w("preview-frame.status",{context:"timeout"}):w("preview-frame.status",{context:"connecting"})})]})}),S&&u.jsx(Oe,{tone:"critical",onClick:O,text:w("preview-frame.continue-button.text")})]})}):(P||n==="connecting"&&!_)&&!I?u.jsx(qt,{initial:"initial",animate:"animate",exit:"exit",variants:br,justify:"center",align:"center",style:{inset:"0",position:"absolute"},children:u.jsxs(le,{style:{...Ut[o]},justify:"center",align:"center",direction:"column",gap:4,children:[u.jsx(It,{muted:!0}),u.jsx(se,{muted:!0,size:1,children:w("preview-frame.status",{context:"loading"})})]})}):R&&!I?u.jsx(qt,{initial:"initial",animate:"animate",exit:"exit",variants:bs,justify:"center",align:"center",style:{background:"var(--card-bg-color)",inset:"0",position:"absolute"},children:u.jsx(mr,{flex:1,message:w("preview-frame.connection.error.text"),onRetry:M,onContinueAnyway:O,children:x&&u.jsxs(u.Fragment,{children:[n!=="connected"&&u.jsx(me,{padding:3,radius:2,tone:"critical",children:u.jsxs(He,{space:3,children:[u.jsx(kt,{muted:!0,size:0,children:w("preview-frame.overlay.connection-status.label")}),u.jsx(Mt,{size:1,children:w("channel.status",{context:n})})]})}),i!=="connected"&&u.jsx(me,{padding:3,radius:2,tone:"critical",children:u.jsxs(He,{space:3,children:[u.jsx(kt,{muted:!0,size:0,children:w("preview-frame.loader.connection-status.label")}),u.jsx(Mt,{size:1,children:w("channel.status",{context:i})})]})})]})})}):null}),u.jsx(Yi,{animate:G,initial:["background"],onLoad:C,preventClick:V,ref:b,src:f.toString(),style:J,variants:Qt})]})})]})})}));un.displayName="Memo(ForwardRef(Preview))";const Ut={desktop:{width:"100%",height:"100%"},mobile:{width:375,height:650}},br={initial:{opacity:1},animate:{opacity:[0,0,1]},exit:{opacity:[1,0,0]}},bs={initial:{opacity:1},animate:{opacity:[0,0,1]},exit:{opacity:[1,0,0]}},Qt={desktop:{...Ut.desktop,boxShadow:"0 0 0 0px var(--card-border-color)"},mobile:{...Ut.mobile,boxShadow:"0 0 0 1px var(--card-border-color)"},background:{opacity:0,scale:1},idle:{scale:1},reloading:{scale:[1,1,1,.98]},active:{opacity:[0,0,1],scale:1},timedOut:{opacity:[0,0,1]}};function Ss(){let r=!1;return(...e)=>{r||(console.warn(...e),r=!0)}}const _s=Ss();function js(r,e){const t=N.c(11);kn(r);let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a={},t[0]=a):a=t[0];const[i,n]=g.useState(a);let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s={},t[1]=s):s=t[1];const[o,c]=g.useState(s),l=g.useRef("");let m;t[2]!==e?(m=(b,j,P)=>{const S=(P===void 0?[]:P).filter(Rs);(j==="published"?n:c)(E=>{const _={};for(const v of S)_[v._id]=v;if(l.current!==e.current.url)return l.current=e.current.url,{[b]:_};const R=E[b];return Ra(R,_)?E:{...E,[b]:_}})},t[2]=e,t[3]=m):m=t[3];const p=m,h=r==="published"?i:o;let d;t[4]!==h?(d=Object.values(h).reduce(Es,{}),t[4]=h,t[5]=d):d=t[5];const f=d;let w;t[6]!==f?(w=Object.values(f),t[6]=f,t[7]=w):w=t[7];const x=w;let y;return t[8]!==x||t[9]!==p?(y=[x,p],t[8]=x,t[9]=p,t[10]=y):y=t[10],y}function Es(r,e){return Object.values(e).forEach(t=>{r[t._id]=t}),r}function Rs(r){return"_projectId"in r&&r._projectId?(_s("Cross dataset references are not supported yet, ignoring source document",r),!1):r}function dn(r,e){return r instanceof Function?r(e):r}function Cs(r,e){if(r.resolve){const t=r.resolve(e)?.filter;return t?`// groq +*[${t}][0]{_id, _type}`:void 0}return"type"in r?`// groq +*[_type == "${r.type}"][0]{_id, _type}`:`// groq +*[${dn(r.filter,e)}][0]{_id, _type}`}function As(r,e){return r.resolve?r.resolve(e)?.params??e.params:"type"in r?{}:dn(r.params,e)??e.params}function Ts(r,e){const t=Array.isArray(r)?r:[r];for(r of t){let{origin:a}=e,i=r;if(typeof r=="string")try{const n=new URL(r);if(n.origin!==a)continue;a=n.origin,i=n.pathname}catch{}try{const n=Ka(i,{decode:decodeURIComponent})(e.pathname);if(n){const{params:s,path:o}=n;return{origin:a,params:s,path:o}}}catch(n){throw new Error(`"${r}" is not a valid route pattern`,{cause:n})}}}function Is(r){const e=N.c(22),{navigate:t,navigationHistory:a,path:i,targetOrigin:n,resolvers:s,perspective:o}=r;let c;e[0]!==s?(c=s===void 0?[]:s,e[0]=s,e[1]=c):c=e[1];const l=c,{state:m}=yt();let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p={apiVersion:Lt},e[2]=p):p=e[2];const h=$t(p);let d;e[3]!==i||e[4]!==m?(d=i||m._searchParams?.find(ks)?.[1]||"",e[3]=i,e[4]=m,e[5]=d):d=e[5];const f=d,[w,x]=g.useState(void 0),y=g.useRef(void 0);let b;e[6]!==t||e[7]!==a?(b=(E,_)=>{(!E||y.current!==E._id)&&(x({document:E,path:_.pathname}),y.current=E?._id,a.at(-1)?.id===a.at(-2)?.id&&t?.({state:{id:E?._id,type:E?._type}}))},e[6]=t,e[7]=a,e[8]=b):b=e[8];const j=g.useEffectEvent(b);let P;e[9]!==h||e[10]!==j||e[11]!==o||e[12]!==f||e[13]!==l||e[14]!==n?(P=()=>{const E=new URL(f,n);if(l.length){let _;for(const R of l){const v=Ts(R.route,E);if(v){_={context:v,resolver:R};break}}if(_){const R=Cs(_.resolver,_.context),v=As(_.resolver,_.context);if(R){const A=new AbortController,M={perspective:o,signal:A.signal,tag:"use-main-document"};return h.fetch(R,v,M).then(I=>j(I,E)).catch(I=>{I instanceof Error&&I.name==="AbortError"||(x({document:void 0,path:E.pathname}),y.current=void 0)}),()=>{A.abort()}}}}x(void 0),y.current=void 0},e[9]=h,e[10]=j,e[11]=o,e[12]=f,e[13]=l,e[14]=n,e[15]=P):P=e[15];let S;return e[16]!==h||e[17]!==o||e[18]!==f||e[19]!==l||e[20]!==n?(S=[h,o,f,l,n],e[16]=h,e[17]=o,e[18]=f,e[19]=l,e[20]=n,e[21]=S):S=e[21],g.useEffect(P,S),w}function ks(r){const[e]=r;return e==="preview"}const Ms=/^([\w-]+):(0|[1-9][0-9]*)$/,Us=/^([\w-]+):([0-9]+),([0-9]+)$/,$s=/^([\w-]+):([\w-]+)$/;function Ds(r){const e=[];for(const t of r.split(".")){const a=Ms.exec(t);if(a){e.push(a[1],Number(a[2]));continue}const i=Us.exec(t);if(i){e.push(i[1],[Number(i[2]),Number(i[3])]);continue}const n=$s.exec(t);if(n){e.push(n[1],{_key:n[2]});continue}e.push(t)}return e}function Ls(r){if(r===void 0)return;const e=decodeURIComponent(r)?.split(".");return e[0]==="drafts"&&e.shift(),e.join(".")}function Os(r){if(r!==void 0)return Kr.toString(Ds(decodeURIComponent(r)))}function Ns(r){return{id:Ls(r.id),path:Os(r.path),type:r.type}}function Sr(r){return Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0&&e!==""&&e!==null))}const pn=()=>r=>r,zs=pn()(["perspective","preview","viewport"]),Ws=pn()(["changesInspectorTab","comment","inspect","instruction","scheduledDraft","parentRefPath","path","pathKey","rev","since","template","templateParams","version","view"]);function Fs(r){const e=N.c(56),{initialPreviewUrl:t,routerNavigate:a,routerState:i,routerSearchParams:n}=r;let s;e[0]!==i?(s=Ns(i),e[0]=i,e[1]=s):s=e[1];const{id:o,path:c,type:l}=s;let m;e[2]!==t||e[3]!==n.preview?(m=n.preview||t.toString(),e[2]=t,e[3]=n.preview,e[4]=m):m=e[4];const p=n.changesInspectorTab;let h;e[5]!==o||e[6]!==c||e[7]!==n.comment||e[8]!==n.inspect||e[9]!==n.instruction||e[10]!==n.parentRefPath||e[11]!==n.pathKey||e[12]!==n.perspective||e[13]!==n.rev||e[14]!==n.scheduledDraft||e[15]!==n.since||e[16]!==n.template||e[17]!==n.templateParams||e[18]!==n.view||e[19]!==n.viewport||e[20]!==m||e[21]!==p||e[22]!==l?(h={id:o,type:l,path:c,preview:m,perspective:n.perspective,viewport:n.viewport,inspect:n.inspect,scheduledDraft:n.scheduledDraft,parentRefPath:n.parentRefPath,rev:n.rev,since:n.since,template:n.template,templateParams:n.templateParams,view:n.view,pathKey:n.pathKey,instruction:n.instruction,comment:n.comment,changesInspectorTab:p},e[5]=o,e[6]=c,e[7]=n.comment,e[8]=n.inspect,e[9]=n.instruction,e[10]=n.parentRefPath,e[11]=n.pathKey,e[12]=n.perspective,e[13]=n.rev,e[14]=n.scheduledDraft,e[15]=n.since,e[16]=n.template,e[17]=n.templateParams,e[18]=n.view,e[19]=n.viewport,e[20]=m,e[21]=p,e[22]=l,e[23]=h):h=e[23];const d=h;let f;e[24]!==d.changesInspectorTab||e[25]!==d.comment||e[26]!==d.inspect||e[27]!==d.instruction||e[28]!==d.parentRefPath||e[29]!==d.path||e[30]!==d.pathKey||e[31]!==d.rev||e[32]!==d.scheduledDraft||e[33]!==d.since||e[34]!==d.template||e[35]!==d.templateParams||e[36]!==d.view?(f=Sr({inspect:d.inspect,scheduledDraft:d.scheduledDraft,path:d.path,parentRefPath:d.parentRefPath,rev:d.rev,since:d.since,template:d.template,templateParams:d.templateParams,view:d.view,pathKey:d.pathKey,instruction:d.instruction,comment:d.comment,changesInspectorTab:d.changesInspectorTab}),e[24]=d.changesInspectorTab,e[25]=d.comment,e[26]=d.inspect,e[27]=d.instruction,e[28]=d.parentRefPath,e[29]=d.path,e[30]=d.pathKey,e[31]=d.rev,e[32]=d.scheduledDraft,e[33]=d.since,e[34]=d.template,e[35]=d.templateParams,e[36]=d.view,e[37]=f):f=e[37];const w=f;let x;e[38]!==d.perspective||e[39]!==d.preview||e[40]!==d.viewport?(x=Sr({perspective:d.perspective,preview:d.preview,viewport:d.viewport}),e[38]=d.perspective,e[39]=d.preview,e[40]=d.viewport,e[41]=x):x=e[41];const y=x,b=g.useRef(i);let j,P;e[42]!==i?(j=()=>{b.current=i},P=[i],e[42]=i,e[43]=j,e[44]=P):(j=e[43],P=e[44]),g.useLayoutEffect(j,P);let S;e[45]!==i?(S=[i],e[45]=i,e[46]=S):S=e[46];const[E,_]=g.useState(S);let R;e[47]===Symbol.for("react.memo_cache_sentinel")?(R=U=>{const{id:O,type:T}=U,{current:W}=b;return O===W.id&&T===W.type},e[47]=R):R=e[47];const v=R;let A;e[48]!==a?(A=U=>{const{state:O,params:T,replace:W}=U,C=W===void 0?!1:W;O?.id&&(O.id=Pt(O.id));const{current:V}=b,z={id:V.id,type:V.type,path:V.path},G=Object.fromEntries(V._searchParams||[]),L=O||z,K={...[...zs,...v(L)?Ws:[]].reduce((X,B)=>(X[B]=G[B],X),{}),...T},J={...L,_searchParams:Object.entries(K).reduce(Vs,[])};_(X=>[...X,J]),a(J,{replace:C})},e[48]=a,e[49]=A):A=e[49];const M=A;let I;return e[50]!==M||e[51]!==E||e[52]!==d||e[53]!==y||e[54]!==w?(I={isSameDocument:v,navigate:M,navigationHistory:E,params:d,searchParams:y,structureParams:w},e[50]=M,e[51]=E,e[52]=d,e[53]=y,e[54]=w,e[55]=I):I=e[55],I}function Vs(r,e){const[t,a]=e;return[...r,[t,a]]}const Bs=r=>{const e=N.c(10),[t,a]=g.useState(Ks);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=p=>{const h=window.open(p,"_blank");h&&a(d=>new Set(d).add(h))},e[0]=i):i=e[0];const n=i;let s,o;e[1]!==r||e[2]!==t?(s=()=>{const p=[];if(t.size&&r)for(const h of t)h&&"closed"in h&&!h.closed&&p.push(r.addTarget(h));return()=>{p.forEach(Hs)}},o=[r,t],e[1]=r,e[2]=t,e[3]=s,e[4]=o):(s=e[3],o=e[4]),g.useEffect(s,o);let c,l;e[5]!==t?(c=()=>{if(t.size){const p=setInterval(()=>{const h=new Set;for(const d of t)d&&"closed"in d&&d.closed&&h.add(d);h.size&&a(d=>{const f=new Set(d);for(const w of h)f.delete(w);return f})},Gn);return()=>{clearInterval(p)}}},l=[t],e[5]=t,e[6]=c,e[7]=l):(c=e[6],l=e[7]),g.useEffect(c,l);let m;return e[8]!==t?(m={popups:t,open:n},e[8]=t,e[9]=m):m=e[9],m};function Ks(){return new Set}function Hs(r){return r()}function mn(r){const e=N.c(5),{scheduledDraft:t}=r,{selectedPerspectiveName:a,selectedReleaseId:i,perspectiveStack:n}=Wr(),s=a===void 0?"drafts":a;let o;return e[0]!==n||e[1]!==t||e[2]!==s||e[3]!==i?(o=i||t?t?[t,...n]:n:s==="published"?"published":"drafts",e[0]=n,e[1]=t,e[2]=s,e[3]=i,e[4]=o):o=e[4],o}function Xt(){const r=N.c(4);let e;r[0]===Symbol.for("react.memo_cache_sentinel")?(e=new Map,r[0]=e):e=r[0];const[t,a]=g.useState(e);let i;e:{const l=Array.from(t.values());if(l.find(Qs)){i="connected";break e}const m=l.filter(qs);if(m.length){i=m.some(Gs)?"connecting":"reconnecting";break e}i="idle"}const n=i;let s;r[1]===Symbol.for("react.memo_cache_sentinel")?(s=l=>{a(m=>{const p=new Map(m);if(l.status==="disconnected")p.delete(l.connection);else{const h=p.get(l.connection)?.hasConnected||l.status==="connected",d=l.status==="handshaking"?"connecting":l.status;p.set(l.connection,{status:d,hasConnected:h})}return p})},r[1]=s):s=r[1];const o=s;let c;return r[2]!==n?(c=[n,o],r[2]=n,r[3]=c):c=r[3],c}function Gs(r){const{hasConnected:e}=r;return!e}function qs(r){const{status:e}=r;return e==="connecting"}function Qs(r){const{status:e}=r;return e==="connected"}const Xs=g.lazy(()=>Ne(()=>import("./LiveQueries-BFs_Sx0n.js"),__vite__mapDeps([2,1,3]))),Js=g.lazy(()=>Ne(()=>import("./PostMessageDocuments-C6od-MMX.js"),__vite__mapDeps([4,1]))),Ys=g.lazy(()=>Ne(()=>import("./PostMessageRefreshMutations-CjO-WTTB.js"),__vite__mapDeps([5,1]))),Zs=g.lazy(()=>Ne(()=>import("./PostMessagePerspective-DbRM5T0e.js"),__vite__mapDeps([6,1]))),eo=g.lazy(()=>Ne(()=>import("./PostMessagePreviewSnapshots-DCzBcSpW.js"),__vite__mapDeps([7,1]))),to=g.lazy(()=>Ne(()=>import("./PostMessageSchema-Dir7eK5Q.js"),__vite__mapDeps([8,1]))),ro=g.lazy(()=>Ne(()=>import("./PostMessageTelemetry-CqS8qIVW.js"),__vite__mapDeps([9,1]))),no=ye(le).withConfig({displayName:"Container",componentId:"sc-1f7om43-0"})`overflow-x:auto;`;function ao(r){const e=N.c(196),{canToggleSharePreviewAccess:t,canUseSharedPreviewAccess:a,tool:i,vercelProtectionBypass:n,initialPreviewUrl:s,previewUrlRef:o}=r,c=hr(o),l=ln(o),m=i.options?.components,p=i.name||Cn;let h;e[0]!==m?(h=m||{},e[0]=m,e[1]=h):h=e[1];const{unstable_navigator:d,unstable_header:f}=h,{navigate:w,state:x}=yt();let y;e[2]!==x._searchParams?(y=Object.fromEntries(x._searchParams||[]),e[2]=x._searchParams,e[3]=y):y=e[3];const b=zr(y),j=ae(o,so);let P;e[4]!==i.options?.devMode?(P=()=>{const D=i.options?.devMode;return typeof D=="function"?D():typeof D=="boolean"?D:typeof window<"u"&&window.location.hostname==="localhost"},e[4]=i.options?.devMode,e[5]=P):P=e[5];const[S]=g.useState(P),E=g.useRef(null),[_,R]=g.useState(),[v,A]=g.useState(null);let M;e[6]===Symbol.for("react.memo_cache_sentinel")?(M={title:void 0,url:void 0},e[6]=M):M=e[6];const I=g.useRef(M);let U;e[7]!==s||e[8]!==w||e[9]!==b||e[10]!==x?(U={initialPreviewUrl:s,routerNavigate:w,routerState:x,routerSearchParams:b,frameStateRef:I},e[7]=s,e[8]=w,e[9]=b,e[10]=x,e[11]=U):U=e[11];const{isSameDocument:O,navigate:T,navigationHistory:W,params:C,searchParams:V,structureParams:z}=Fs(U);let G;e[12]!==C.scheduledDraft?(G={scheduledDraft:C.scheduledDraft},e[12]=C.scheduledDraft,e[13]=G):G=e[13];const L=mn(G),K=Nr(ri),J=C.viewport?"mobile":"desktop",[X,B]=js(L,I),te=An(),$=Tn(),F=i.options?.resolve?.mainDocuments;let H;e[14]!==T||e[15]!==W||e[16]!==C.preview||e[17]!==L||e[18]!==F||e[19]!==l?(H={navigate:T,navigationHistory:W,path:C.preview,targetOrigin:l,resolvers:F,perspective:L},e[14]=T,e[15]=W,e[16]=C.preview,e[17]=L,e[18]=F,e[19]=l,e[20]=H):H=e[20];const ee=Is(H),[Y,re]=Xt(),[k,q]=Xt(),[Q,oe]=Xt(),{open:xe}=Bs(_),he=ae(K,io);let fe,de;e[21]!==he||e[22]!==l?(fe=()=>{const D=E.current?.contentWindow;if(!D||he)return;const ne=Br({targetOrigin:l});return ne.addTarget(D),R(ne),()=>{ne.destroy(),R(void 0)}},de=[l,he],e[21]=he,e[22]=l,e[23]=fe,e[24]=de):(fe=e[23],de=e[24]),g.useEffect(fe,de);let ve;e[25]!==T?(ve=D=>{T(D)},e[25]=T,e[26]=ve):ve=e[26];const pe=g.useEffectEvent(ve),$e=g.useRef(void 0);let Pe;e[27]!==_||e[28]!==pe||e[29]!==K||e[30]!==B||e[31]!==re||e[32]!==l?(Pe=()=>{if(!_)return;const D=_.createChannel({name:"presentation",heartbeat:!0,connectTo:"visual-editing"},Yt().provide({actors:Zt()}));D.on("visual-editing/focus",Z=>{"id"in Z&&pe({state:{type:Z.type,id:Z.id,path:Z.path}})}),D.on("visual-editing/navigate",Z=>{const{title:ft}=Z;let Ke=Z.url;if(!Ke.startsWith("http"))try{Ke=new URL(Ke,l).toString()}catch{}if(I.current.url!==Ke){const vn=()=>{const[gn,wn]=Ke.split("?"),Tt=new URLSearchParams(wn);Tt.delete(vt),Tt.delete(ar),pe({params:{preview:`${gn}${Tt.size>0?"?":""}${Tt}`}})};try{vn()}catch{pe({params:{preview:Ke}})}}I.current={title:ft,url:Ke}}),D.on("visual-editing/meta",Z=>{I.current.title=Z.title}),D.on("visual-editing/toggle",Z=>{K.send({type:"toggle visual editing overlays",enabled:Z.enabled})}),D.on("visual-editing/documents",Z=>{B("visual-editing",Z.perspective,Z.documents)}),D.on("visual-editing/refreshing",Z=>{Z.source==="manual"?clearTimeout($e.current):Z.source==="mutation"&&K.send({type:"iframe refresh"})}),D.on("visual-editing/refreshed",()=>{K.send({type:"iframe loaded"})}),D.onStatus(re);const ne=D.start();return A(D),()=>{ne(),A(null)}},e[27]=_,e[28]=pe,e[29]=K,e[30]=B,e[31]=re,e[32]=l,e[33]=Pe):Pe=e[33];let De;e[34]!==_||e[35]!==K||e[36]!==B||e[37]!==re||e[38]!==l?(De=[_,K,B,re,l],e[34]=_,e[35]=K,e[36]=B,e[37]=re,e[38]=l,e[39]=De):De=e[39],g.useEffect(Pe,De);let be;e[40]!==_||e[41]!==$||e[42]!==te||e[43]!==B||e[44]!==oe?(be=()=>{if(!_)return;const D=_.createChannel({name:"presentation",connectTo:"preview-kit",heartbeat:!0},Yt().provide({actors:Zt()}));return D.onStatus(oe),D.on("preview-kit/documents",ne=>{ne.projectId===te&&ne.dataset===$&&B("preview-kit",ne.perspective,ne.documents)}),D.start()},e[40]=_,e[41]=$,e[42]=te,e[43]=B,e[44]=oe,e[45]=be):be=e[45];let ze;e[46]!==_||e[47]!==$||e[48]!==te||e[49]!==B||e[50]!==oe||e[51]!==l?(ze=[_,$,te,B,oe,l],e[46]=_,e[47]=$,e[48]=te,e[49]=B,e[50]=oe,e[51]=l,e[52]=ze):ze=e[52],g.useEffect(be,ze);let Se;e[53]!==O||e[54]!==T?(Se=en(D=>{O(D)&&T({state:D,replace:!0})},0),e[53]=O,e[54]=T,e[55]=Se):Se=e[55];const ke=Se;let _e;e[56]!==c||e[57]!==T||e[58]!==C.preview||e[59]!==l?(_e=D=>{const ne=new URL(D,l),Z=ne.toString();C.preview!==Z&&(Array.isArray(c)?c.some(ft=>ft.test(Z))&&T({params:{preview:Z}}):ne.origin===l&&T({params:{preview:Z}}))},e[56]=c,e[57]=T,e[58]=C.preview,e[59]=l,e[60]=_e):_e=e[60];const Me=_e;let je;e[61]!==T?(je=D=>{T({params:D})},e[61]=T,e[62]=je):je=e[62];const Be=je;let Ee;e[63]!==T?(Ee=D=>{T(D)},e[63]=T,e[64]=Ee):Ee=e[64];const Ue=Ee;let Le,Re;e[65]!==C.id||e[66]!==C.path||e[67]!==v?(Le=()=>{C.id&&C.path?v?.post("presentation/focus",{id:C.id,path:C.path}):v?.post("presentation/blur")},Re=[C.id,C.path,v],e[65]=C.id,e[66]=C.path,e[67]=v,e[68]=Le,e[69]=Re):(Le=e[68],Re=e[69]),g.useEffect(Le,Re);let We,Ce;e[70]!==Y||e[71]!==C.preview||e[72]!==l||e[73]!==v?(We=()=>{if(I.current.url&&C.preview&&I.current.url!==C.preview){try{const D=new URL(I.current.url,l).origin,ne=new URL(C.preview,l).origin;if(D!==ne)return}catch{}if(I.current.url=C.preview,Y==="connected"){let D=C.preview;if(D.startsWith("http"))try{const ne=new URL(C.preview,l);D=ne.pathname+ne.search+ne.hash}catch{}v?.post("presentation/navigate",{url:D,type:"replace"})}}},Ce=[Y,l,C.preview,v],e[70]=Y,e[71]=C.preview,e[72]=l,e[73]=v,e[74]=We,e[75]=Ce):(We=e[74],Ce=e[75]),g.useEffect(We,Ce);let Ae;e[76]!==v?(Ae=()=>v?.post("presentation/toggle-overlay"),e[76]=v,e[77]=Ae):Ae=e[77];const ue=Ae,[Fe,ht]=g.useState(null);let bt,St;e[78]!==ue?(bt=()=>{const D=Z=>{_r(Z)&&ue()},ne=Z=>{_r(Z)&&ue(),co(["mod","\\"],Z)&&ue()};return window.addEventListener("keydown",ne),window.addEventListener("keyup",D),()=>{window.removeEventListener("keydown",ne),window.removeEventListener("keyup",D)}},St=[ue],e[78]=ue,e[79]=bt,e[80]=St):(bt=e[79],St=e[80]),g.useEffect(bt,St);const[Ot,hn]=g.useState(null);let _t;e[81]!==d?(_t={unstable_navigator:d},e[81]=d,e[82]=_t):_t=e[82];const[fn,Nt]=Ki(_t),{navigatorEnabled:jt,toggleNavigator:zt}=fn;let Et;e[83]!==k||e[84]!==K||e[85]!==Q||e[86]!==v?(Et=D=>{if(K.send({type:"iframe refresh"}),v){$e.current=window.setTimeout(D,300),v.post("presentation/refresh",{source:"manual",livePreviewEnabled:Q==="connected"||k==="connected"});return}D()},e[83]=k,e[84]=K,e[85]=Q,e[86]=v,e[87]=Et):Et=e[87];const Wt=Et,Ft=In();let Rt;e[88]!==C.preview||e[89]!==Ft.name?(Rt=D=>{const{id:ne,type:Z,path:ft}=D;if(I.current.url)return{title:I.current.title||I.current.url,name:"edit",params:{id:ne,path:ft,type:Z,inspect:Qn,workspace:Ft.name,mode:qn,preview:C.preview}}},e[88]=C.preview,e[89]=Ft.name,e[90]=Rt):Rt=e[90];const Vt=Rt;let Ct;e[91]!==T?(Ct=D=>{T({params:{viewport:D==="desktop"?void 0:"mobile"},replace:!0})},e[91]=T,e[92]=Ct):Ct=e[92];const Bt=Ct;let Ge;e[93]!==Nt?(Ge=u.jsx(Nt,{}),e[93]=Nt,e[94]=Ge):Ge=e[94];const Kt=jt?50:75;let qe;e[95]!==j||e[96]!==t||e[97]!==a||e[98]!==xe||e[99]!==Me||e[100]!==Wt||e[101]!==s||e[102]!==k||e[103]!==jt||e[104]!==Y||e[105]!==C.preview||e[106]!==L||e[107]!==K||e[108]!==o||e[109]!==Bt||e[110]!==l||e[111]!==zt||e[112]!==ue||e[113]!==f||e[114]!==n||e[115]!==J?(qe=u.jsx(un,{canSharePreviewAccess:j,canToggleSharePreviewAccess:t,canUseSharedPreviewAccess:a,header:f,initialUrl:s,loadersConnection:k,navigatorEnabled:jt,onPathChange:Me,onRefresh:Wt,openPopup:xe,overlaysConnection:Y,previewUrl:C.preview,perspective:L,ref:E,setViewport:Bt,targetOrigin:l,toggleNavigator:zt,toggleOverlay:ue,viewport:J,vercelProtectionBypass:n,presentationRef:K,previewUrlRef:o},l),e[95]=j,e[96]=t,e[97]=a,e[98]=xe,e[99]=Me,e[100]=Wt,e[101]=s,e[102]=k,e[103]=jt,e[104]=Y,e[105]=C.preview,e[106]=L,e[107]=K,e[108]=o,e[109]=Bt,e[110]=l,e[111]=zt,e[112]=ue,e[113]=f,e[114]=n,e[115]=J,e[116]=qe):qe=e[116];let Qe;e[117]!==Ot||e[118]!==qe?(Qe=u.jsx(le,{direction:"column",flex:1,height:"fill",ref:hn,children:u.jsx(Xn,{element:Ot,children:qe})}),e[117]=Ot,e[118]=qe,e[119]=Qe):Qe=e[119];let Xe;e[120]!==Kt||e[121]!==Qe?(Xe=u.jsx(pr,{id:"preview",minWidth:325,defaultSize:Kt,order:3,children:Qe}),e[120]=Kt,e[121]=Qe,e[122]=Xe):Xe=e[122];let Je;e[123]!==X||e[124]!==Vt||e[125]!==Ue||e[126]!==ke||e[127]!==Be||e[128]!==ee||e[129]!==C.id||e[130]!==C.type||e[131]!==V||e[132]!==z?(Je=u.jsx(Fi,{documentId:C.id,documentsOnPage:X,documentType:C.type,getCommentIntent:Vt,mainDocumentState:ee,onEditReference:Ue,onFocusPath:ke,onStructureParams:Be,searchParams:V,setDisplayedDocument:ht,structureParams:z}),e[123]=X,e[124]=Vt,e[125]=Ue,e[126]=ke,e[127]=Be,e[128]=ee,e[129]=C.id,e[130]=C.type,e[131]=V,e[132]=z,e[133]=Je):Je=e[133];let Ye;e[134]!==Ge||e[135]!==Xe||e[136]!==Je?(Ye=u.jsx(no,{"data-testid":"presentation-root",height:"fill",children:u.jsxs(hi,{children:[Ge,Xe,Je]})}),e[134]=Ge,e[135]=Xe,e[136]=Je,e[137]=Ye):Ye=e[137];let Ze;e[138]!==Ye||e[139]!==v?(Ze=u.jsx(ni,{comlink:v,children:Ye}),e[138]=Ye,e[139]=v,e[140]=Ze):Ze=e[140];let et;e[141]!==C||e[142]!==Ze?(et=u.jsx(Qi,{params:C,children:Ze}),e[141]=C,e[142]=Ze,e[143]=et):et=e[143];let tt;e[144]!==T||e[145]!==et?(tt=u.jsx(Vi,{navigate:T,children:et}),e[144]=T,e[145]=et,e[146]=tt):tt=e[146];let rt;e[147]!==S||e[148]!==p||e[149]!==T||e[150]!==C||e[151]!==V||e[152]!==z||e[153]!==tt?(rt=u.jsx(Xi,{devMode:S,name:p,navigate:T,params:C,searchParams:V,structureParams:z,children:tt}),e[147]=S,e[148]=p,e[149]=T,e[150]=C,e[151]=V,e[152]=z,e[153]=tt,e[154]=rt):rt=e[154];let nt;e[155]!==_||e[156]!==Fe||e[157]!==L||e[158]!==B||e[159]!==q?(nt=_&&u.jsx(Xs,{controller:_,perspective:L,liveDocument:Fe,onDocumentsOnPage:B,onLoadersConnection:q}),e[155]=_,e[156]=Fe,e[157]=L,e[158]=B,e[159]=q,e[160]=nt):nt=e[160];let at;e[161]!==k||e[162]!==C.id||e[163]!==C.type||e[164]!==Q||e[165]!==v?(at=v&&C.id&&C.type&&u.jsx(Ys,{comlink:v,id:C.id,type:C.type,loadersConnection:k,previewKitConnection:Q}),e[161]=k,e[162]=C.id,e[163]=C.type,e[164]=Q,e[165]=v,e[166]=at):at=e[166];let it;e[167]!==L||e[168]!==v?(it=v&&u.jsx(to,{comlink:v,perspective:L}),e[167]=L,e[168]=v,e[169]=it):it=e[169];let st;e[170]!==X||e[171]!==L||e[172]!==v?(st=v&&X.length>0&&u.jsx(eo,{comlink:v,perspective:L,refs:X}),e[170]=X,e[171]=L,e[172]=v,e[173]=st):st=e[173];let ot;e[174]!==L||e[175]!==v?(ot=v&&u.jsx(Js,{comlink:v,perspective:L}),e[174]=L,e[175]=v,e[176]=ot):ot=e[176];let ct;e[177]!==v?(ct=v&&u.jsx(ei,{comlink:v}),e[177]=v,e[178]=ct):ct=e[178];let lt;e[179]!==L||e[180]!==v?(lt=v&&u.jsx(Zs,{comlink:v,perspective:L}),e[179]=L,e[180]=v,e[181]=lt):lt=e[181];let ut;e[182]!==v?(ut=v&&u.jsx(ro,{comlink:v}),e[182]=v,e[183]=ut):ut=e[183];let dt;e[184]!==nt||e[185]!==at||e[186]!==it||e[187]!==st||e[188]!==ot||e[189]!==ct||e[190]!==lt||e[191]!==ut?(dt=u.jsxs(g.Suspense,{children:[nt,at,it,st,ot,ct,lt,ut]}),e[184]=nt,e[185]=at,e[186]=it,e[187]=st,e[188]=ot,e[189]=ct,e[190]=lt,e[191]=ut,e[192]=dt):dt=e[192];let At;return e[193]!==rt||e[194]!==dt?(At=u.jsxs(u.Fragment,{children:[rt,dt]}),e[193]=rt,e[194]=dt,e[195]=At):At=e[195],At}function io(r){return r.matches("loading")}function so(r){return r.context.previewMode?.shareAccess!==!1}function _r(r){return r.key==="Alt"}const oo=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),jr={alt:"altKey",ctrl:"ctrlKey",mod:oo?"metaKey":"ctrlKey",shift:"shiftKey"};function co(r,e){return r.every(t=>jr[t]?e[jr[t]]:e.key===t.toUpperCase())}function lo({client:r,currentUserId:e}){return ge(async()=>await Ja(r,"sanity/presentation",location.href,e))}function uo({client:r}){return ge(async()=>r.fetch(Gr,{},{tag:"presentation.fallback-to-shared-access-secret"}))}function po({client:r,allowOption:e}){return ge(async({input:t})=>{const{initialUrl:a}=t;if(typeof URLPattern>"u"&&await Ne(()=>import("./index-DPyTNidZ.js"),[]),!e)return[new URLPattern(a.origin)];const i=typeof e=="function"?await e({client:r,origin,initialUrl:a}):e,n=(Array.isArray(i)?i:[i]).map(s=>{const o=new URLPattern(s);if(o.hostname==="*")throw new Error("It's insecure to allow any hostname, it could disclose data to a malicious site");return o});return n.some(s=>s.test(a.origin))?n:[...n,new URLPattern(a.origin)]})}function mo({client:r,studioBasePath:e,previewUrlOption:t,perspective:a}){return ge(async({input:i})=>{const{origin:n}=location;if(typeof t=="function"){const s=await t({client:r,studioBasePath:e,previewUrlSecret:"",studioPreviewPerspective:mt(a),previewSearchParam:i.previewSearchParam});return new URL(s,n)}if(!t)return new URL("/",n);if(typeof t=="string")return new URL(t,n);if(typeof t.initial=="function"){const s=await t.initial({client:r,origin:n});return new URL(s,n)}return typeof t.initial=="string"?new URL(t.initial,n):new URL(t.preview||"/",t.origin||n)})}function ho({client:r,previewUrlOption:e}){return ge(async({input:t})=>{const{targetOrigin:a}=t;if(typeof e=="object"&&e?.draftMode)return{enable:e.draftMode.enable,shareAccess:e.draftMode.shareAccess??!0};if(!e||typeof e=="string"||typeof e=="function"||!e.previewMode)return!1;const i=typeof e.previewMode=="function"?await e.previewMode({client:r,origin,targetOrigin:a}):e.previewMode;return i===!1?!1:{enable:i.enable,shareAccess:i.shareAccess??!0}})}function fo({client:r,studioBasePath:e,previewUrlOption:t,perspective:a}){return ge(async({input:i})=>{const{previewUrlSecret:n,resolvedPreviewMode:s,initialUrl:o}=i;if(typeof t=="function"){const l=await t({client:r,studioBasePath:e,previewUrlSecret:n,studioPreviewPerspective:mt(a),previewSearchParam:o.toString()});return new URL(l,o)}if(!s)throw new Error("Resolved preview mode is false");const c=new URL(s.enable,o);return c.searchParams.set(nr,n),c.searchParams.set(pt,mt(a)),o.pathname!==c.pathname&&c.searchParams.set(rr,`${o.pathname}${o.search}${o.hash}`),c})}const vo=ge(async({input:r})=>{const{previewSearchParam:e,initialUrl:t,allowOrigins:a}=r;if(!e)return t;try{const i=new URL(e,t.origin);return a.some(n=>n.test(i.origin))?i:t}catch{return t}}),Jt={_id:wt,_type:sr},go={_id:`drafts.${Ur()}`,_type:Mr},wo=Fr({actions:{"notify preview will likely fail":Jn("Missing permissions to create preview secret, or read shared preview secret. Preview will likely fail loading."),"assign preview search param":ie({previewSearchParam:(r,e)=>e.previewSearchParam}),"assign error":ie({error:(r,e)=>e.error instanceof Error?e.error:new Error(e.message,{cause:e.error})})},actors:{"check permission":Or(()=>_a(()=>new Error("The 'check permission' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'check permission': fromObservable(({input}: {input: CheckPermissionInput}) => ...)}})"))),"resolve initial url":ge(()=>Promise.reject(new Error("The 'resolve initial url' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'resolve initial url': fromPromise(...)}})"))),"resolve allow patterns":ge(()=>Promise.reject(new Error("The 'resolve allow patterns' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'resolve allow pattern': fromPromise(...)}})"))),"resolve url from preview search param":vo,"resolve preview mode":ge(()=>Promise.reject(new Error("The 'resolve preview mode' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'resolve preview mode': fromPromise(...)}})"))),"create preview secret":ge(async()=>Promise.reject(new Error("The 'create preview secret' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'create preview secret': fromPromise(...)}})"))),"read shared preview secret":ge(async()=>Promise.reject(new Error("The 'read shared preview secret' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'read shared preview secret': fromPromise(...)}})"))),"resolve preview mode url":ge(()=>Promise.reject(new Error("The 'resolve preview mode url' actor is not implemented. Add it to previewUrlMachine.provide({actors: {'resolve preview mode url': fromPromise(...)}})")))},guards:{"has checked permissions":({context:r})=>!!(r.previewAccessSharingCreatePermission&&r.previewAccessSharingReadPermission&&r.previewAccessSharingUpdatePermission&&r.previewUrlSecretPermission),"search param has new origin":({context:r,event:e})=>{if(!r.previewUrl||!e.previewSearchParam)return!1;try{const t=new URL(e.previewSearchParam,r.previewUrl);return r.previewUrl.origin!==t.origin}catch{return!1}},"can create preview secret":({context:r})=>r.previewUrlSecretPermission?.granted===!0,"has preview mode with created secret":({context:r},e)=>e===!1?!1:r.previewUrlSecretPermission?.granted===!0,"has preview mode with share access":({context:r},e)=>e===!1?!1:r.previewAccessSharingReadPermission?.granted===!0,"has preview mode without permissions":({context:r},e)=>e===!1?!1:r.previewAccessSharingReadPermission?.granted===!1&&r.previewUrlSecretPermission?.granted===!1},delays:{expiredSecret:({context:r})=>{if(!r.previewUrlSecret?.expiresAt)return 0;const e=Date.now(),t=r.previewUrlSecret.expiresAt.getTime();return Math.max(t-e,0)}}}).createMachine({id:"Preview URL",context:({input:r})=>({initialUrl:null,previewUrl:null,error:null,allowOrigins:null,previewSearchParam:r.previewSearchParam,previewUrlSecret:null,previewAccessSharingCreatePermission:null,previewAccessSharingReadPermission:null,previewAccessSharingUpdatePermission:null,previewUrlSecretPermission:null,previewMode:null}),invoke:[{src:"check permission",input:()=>({checkPermissionName:"read",document:Jt}),onError:{target:".error",actions:{type:"assign error",params:({event:r})=>({message:"Failed to check permission",error:r.error})}},onSnapshot:{actions:ie({previewAccessSharingReadPermission:({event:r})=>r.snapshot.context??null})}},{src:"check permission",input:()=>({checkPermissionName:"create",document:Jt}),onError:{target:".error",actions:{type:"assign error",params:({event:r})=>({message:"Failed to check permission",error:r.error})}},onSnapshot:{actions:ie({previewAccessSharingCreatePermission:({event:r})=>r.snapshot.context??null})}},{src:"check permission",input:()=>({checkPermissionName:"update",document:Jt}),onError:{target:".error",actions:{type:"assign error",params:({event:r})=>({message:"Failed to check permission",error:r.error})}},onSnapshot:{actions:ie({previewAccessSharingUpdatePermission:({event:r})=>r.snapshot.context??null})}},{src:"check permission",input:()=>({checkPermissionName:"create",document:go}),onError:{target:".error",actions:{type:"assign error",params:({event:r})=>({message:"Failed to check permission",error:r.error})}},onSnapshot:{actions:ie({previewUrlSecretPermission:({event:r})=>r.snapshot.context??null})}}],on:{"set preview search param":{actions:{type:"assign preview search param",params:({event:r})=>({previewSearchParam:r.previewSearchParam})}}},states:{checkingPermissions:{always:{guard:"has checked permissions",target:"resolvingInitialUrl"},tags:"busy"},resolvingInitialUrl:{invoke:{src:"resolve initial url",input:({context:r})=>({previewSearchParam:r.previewSearchParam}),onError:{target:"error",actions:{type:"assign error",params:({event:r})=>({message:"Failed to resolve initial url",error:r.error})}},onDone:{target:"resolvingAllowPatterns",actions:ie({initialUrl:({event:r})=>r.output})}},tags:"busy"},error:{type:"final",tags:"error"},resolvingAllowPatterns:{invoke:{src:"resolve allow patterns",input:({context:r})=>({initialUrl:r.initialUrl}),onError:{target:"error",actions:{type:"assign error",params:({event:r})=>({message:"Failed to resolve preview url allow patterns",error:r.error})}},onDone:{target:"resolvingUrlFromPreviewSearchParam",actions:ie({allowOrigins:({event:r})=>r.output})}},tags:["busy"]},resolvingUrlFromPreviewSearchParam:{id:"loop",invoke:{src:"resolve url from preview search param",input:({context:r})=>({initialUrl:r.initialUrl,allowOrigins:r.allowOrigins,previewSearchParam:r.previewSearchParam}),onError:{target:"error",actions:{type:"assign error",params:({event:r})=>({message:"Failed to resolve preview url from search param",error:r.error})}},onDone:{target:"resolvingPreviewMode",actions:ie({initialUrl:({event:r})=>r.output})}},tags:["busy"]},resolvingPreviewMode:{on:{"set preview search param":{guard:"search param has new origin",actions:{type:"assign preview search param",params:({event:r})=>({previewSearchParam:r.previewSearchParam})},target:"#loop",reenter:!0}},invoke:{src:"resolve preview mode",input:({context:r})=>({targetOrigin:r.initialUrl.origin}),onError:{target:"error",actions:{type:"assign error",params:({event:r})=>({message:"Failed to resolve preview url allow patterns",error:r.error})}},onDone:[{guard:{type:"has preview mode with created secret",params:({event:r})=>r.output},actions:ie({previewMode:({event:r})=>r.output}),target:"previewMode.createPreviewSecret"},{guard:{type:"has preview mode with share access",params:({event:r})=>r.output},actions:ie({previewMode:({event:r})=>r.output}),target:"previewMode.readShareAccess"},{guard:{type:"has preview mode without permissions",params:({event:r})=>r.output},actions:[ie({previewUrl:({context:r})=>r.initialUrl}),"notify preview will likely fail"],target:"success"},{actions:ie({previewUrl:({context:r})=>r.initialUrl}),target:"success"}]},tags:["busy"]},success:{on:{"set preview search param":{guard:"search param has new origin",actions:{type:"assign preview search param",params:({event:r})=>({previewSearchParam:r.previewSearchParam})},target:"#loop",reenter:!0}}},previewMode:{on:{"set preview search param":{guard:"search param has new origin",actions:{type:"assign preview search param",params:({event:r})=>({previewSearchParam:r.previewSearchParam})},target:"#loop",reenter:!0}},states:{createPreviewSecret:{invoke:{src:"create preview secret",onError:{target:"error",actions:{type:"assign error",params:({event:r})=>({message:"Failed to create preview secret",error:r.error})}},onDone:{target:"resolvePreviewUrl",actions:ie({previewUrlSecret:({event:r})=>r.output})}},tags:["busy"]},readShareAccess:{invoke:{src:"read shared preview secret",onError:{target:"error",actions:{type:"assign error",params:({event:r})=>({message:"Failed to read shared preview secret",error:r.error})}},onDone:{target:"resolvePreviewUrl",actions:ie({previewUrlSecret:({event:r})=>({secret:r.output,expiresAt:new Date(Date.now()+1e3*60*60*60*24)})})}},tags:["busy"]},resolvePreviewUrl:{invoke:{src:"resolve preview mode url",input:({context:r})=>({initialUrl:r.initialUrl,resolvedPreviewMode:r.previewMode,previewUrlSecret:r.previewUrlSecret.secret}),onError:{target:"error",actions:{type:"assign error",params:({event:r})=>({message:"Failed to resolve preview url",error:r.error})}},onDone:{target:"success",actions:ie({previewUrl:({event:r})=>r.output})}},tags:["busy"]},error:{type:"final",tags:["error"]},success:{after:{expiredSecret:{guard:"can create preview secret",actions:ie({previewUrlSecret:null}),target:"createPreviewSecret",reenter:!0}}}},initial:"readShareAccess"}},initial:"checkingPermissions"});function yo(r,e){const t=N.c(25),a=Rn();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={apiVersion:Lt},t[0]=i):i=t[0];const n=$t(i),s=Dr()?.id,o=Lr()?.activeWorkspace?.basePath||"/",c=yt();let l;t[1]!==c.state._searchParams?(l=new URLSearchParams(c.state._searchParams).get("preview"),t[1]=c.state._searchParams,t[2]=l):l=t[2];const m=l,{push:p}=Dt(),{t:h}=Te(Ie);let d;t[3]===Symbol.for("react.memo_cache_sentinel")?(d={scheduledDraft:void 0},t[3]=d):d=t[3];const f=mn(d);let w;if(t[4]!==e||t[5]!==n||t[6]!==s||t[7]!==a||t[8]!==f||t[9]!==r||t[10]!==p||t[11]!==o||t[12]!==h){let S;t[14]!==p||t[15]!==h?(S=()=>p({id:"preview-url-secret.missing-grants",closable:!0,status:"error",duration:1/0,title:h("preview-url-secret.missing-grants")}),t[14]=p,t[15]=h,t[16]=S):S=t[16];let E;t[17]!==a?(E=_=>{const{input:R}=_;return a.checkDocumentPermission(R.checkPermissionName,R.document)},t[17]=a,t[18]=E):E=t[18],w=wo.provide({actions:{"notify preview will likely fail":S},actors:{"create preview secret":lo({client:n,currentUserId:s}),"read shared preview secret":uo({client:n}),"resolve allow patterns":po({client:n,allowOption:e}),"resolve initial url":mo({client:n,studioBasePath:o,previewUrlOption:r,perspective:f}),"resolve preview mode":ho({client:n,previewUrlOption:r}),"resolve preview mode url":fo({client:n,studioBasePath:o,previewUrlOption:r,perspective:f}),"check permission":Or(E)}}),t[4]=e,t[5]=n,t[6]=s,t[7]=a,t[8]=f,t[9]=r,t[10]=p,t[11]=o,t[12]=h,t[13]=w}else w=t[13];let x;t[19]!==m?(x={input:{previewSearchParam:m}},t[19]=m,t[20]=x):x=t[20];const y=Nr(w,x);let b,j;t[21]!==y||t[22]!==m?(b=()=>{y.send({type:"set preview search param",previewSearchParam:m})},j=[y,m],t[21]=y,t[22]=m,t[23]=b,t[24]=j):(b=t[23],j=t[24]),g.useEffect(b,j);const P=ae(y,xo);if(P)throw P;return y}function xo(r){return r.status==="error"?r.error:r.hasTag("error")?r.context.error:null}function Po(r){const e=N.c(9),{t}=Te(Ie),{push:a}=Dt(),i=yt();let n;e[0]!==i.state._searchParams?(n=new URLSearchParams(i.state._searchParams).get("preview"),e[0]=i.state._searchParams,e[1]=n):n=e[1];const s=n,o=ae(r,So),c=ae(r,bo);let l,m;e[2]!==o||e[3]!==c||e[4]!==s||e[5]!==a||e[6]!==t?(l=()=>{if(!Array.isArray(o)||!s||!c)return;const p=new URL(s,c).origin;o.some(h=>h.test(p))||a({closable:!0,id:`presentation-iframe-origin-mismatch-${p}`,status:"error",duration:1/0,title:t("preview-search-param.configuration.error.title"),description:u.jsx(lr,{t,i18nKey:"preview-search-param.configuration.error.description",components:{Code:"code"},values:{previewSearchParam:s,blockedOrigin:p}})})},m=[o,c,s,a,t],e[2]=o,e[3]=c,e[4]=s,e[5]=a,e[6]=t,e[7]=l,e[8]=m):(l=e[7],m=e[8]),g.useEffect(l,m)}function bo(r){return r.context.previewUrl?.origin}function So(r){return r.context.allowOrigins}function _o(){const r=N.c(7);let e;r[0]===Symbol.for("react.memo_cache_sentinel")?(e={apiVersion:Lt},r[0]=e):e=r[0];const t=$t(e),[a,i]=g.useReducer(jo,"loading"),[n,s]=g.useState(null);let o,c;r[1]!==t?(o=()=>{const m=Ya(t,p=>{s(p),i()});return()=>m()},c=[t],r[1]=t,r[2]=o,r[3]=c):(o=r[2],c=r[3]),g.useEffect(o,c);let l;return r[4]!==a||r[5]!==n?(l=[n,a],r[4]=a,r[5]=n,r[6]=l):l=r[6],l}function jo(){return"ready"}function Eo(r){const e=N.c(8),{tool:t}=r,a=yo(t.options?.previewUrl,t.options?.allowOrigins);Po(a);const i=ae(a,Io),n=ae(a,To),s=ae(a,Ao),o=ae(a,Co),c=ae(a,Ro),[l,m]=_o();if(!c||m==="loading"||!i||typeof i.granted>"u"||!n||typeof n.granted>"u"||!o||!s||typeof s.granted>"u"||typeof o.granted>"u"){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=u.jsx($r,{}),e[0]=f):f=e[0],f}const p=!!i?.granted&&!!n?.granted,h=!!s?.granted;let d;return e[1]!==a||e[2]!==p||e[3]!==h||e[4]!==t||e[5]!==c||e[6]!==l?(d=u.jsx(ao,{tool:t,initialPreviewUrl:c,vercelProtectionBypass:l,canToggleSharePreviewAccess:p,canUseSharedPreviewAccess:h,previewUrlRef:a}),e[1]=a,e[2]=p,e[3]=h,e[4]=t,e[5]=c,e[6]=l,e[7]=d):d=e[7],d}function Ro(r){return r.context.previewUrl}function Co(r){return r.context.previewUrlSecretPermission}function Ao(r){return r.context.previewAccessSharingReadPermission}function To(r){return r.context.previewAccessSharingUpdatePermission}function Io(r){return r.context.previewAccessSharingCreatePermission}const Uo=Object.freeze(Object.defineProperty({__proto__:null,default:Eo},Symbol.toStringTag,{value:"Module"}));export{Uo as P,Zt as c}; diff --git a/apps/studio/dist/static/QRCodeSVG-BpS_-ERN.js b/apps/studio/dist/static/QRCodeSVG-BpS_-ERN.js new file mode 100644 index 00000000..c4d5262b --- /dev/null +++ b/apps/studio/dist/static/QRCodeSVG-BpS_-ERN.js @@ -0,0 +1 @@ +import{r as k,c as v,j as U,bd as H}from"./sanity-BZuh2pfi.js";class c{static encodeText(t,e){const s=d.makeSegments(t);return c.encodeSegments(s,e)}static encodeBinary(t,e){const s=d.makeBytes(t);return c.encodeSegments([s],e)}static encodeSegments(t,e,s=1,i=40,n=-1,r=!0){if(!(c.MIN_VERSION<=s&&s<=i&&i<=c.MAX_VERSION)||n<-1||n>7)throw new RangeError("Invalid value");let o,h;for(o=s;;o++){const l=c.getNumDataCodewords(o,e)*8,u=d.getTotalBits(t,o);if(u<=l){h=u;break}if(o>=i)throw new RangeError("Data too long")}for(const l of[R.MEDIUM,R.QUARTILE,R.HIGH])r&&h<=c.getNumDataCodewords(o,l)*8&&(e=l);const a=[];for(const l of t){M(l.mode.modeBits,4,a),M(l.numChars,l.mode.numCharCountBits(o),a);for(const u of l.getData())a.push(u)}w(a.length==h);const E=c.getNumDataCodewords(o,e)*8;w(a.length<=E),M(0,Math.min(4,E-a.length),a),M(0,(8-a.length%8)%8,a),w(a.length%8==0);for(let l=236;a.lengthf[u>>>3]|=l<<7-(u&7)),new c(o,e,f,n)}modules=[];isFunction=[];constructor(t,e,s,i){if(this.version=t,this.errorCorrectionLevel=e,tc.MAX_VERSION)throw new RangeError("Version value out of range");if(i<-1||i>7)throw new RangeError("Mask value out of range");this.size=t*4+17;const n=[];for(let o=0;o>>9)*1335;const i=(e<<10|s)^21522;w(i>>>15==0);for(let n=0;n<=5;n++)this.setFunctionModule(8,n,p(i,n));this.setFunctionModule(8,7,p(i,6)),this.setFunctionModule(8,8,p(i,7)),this.setFunctionModule(7,8,p(i,8));for(let n=9;n<15;n++)this.setFunctionModule(14-n,8,p(i,n));for(let n=0;n<8;n++)this.setFunctionModule(this.size-1-n,8,p(i,n));for(let n=8;n<15;n++)this.setFunctionModule(8,this.size-15+n,p(i,n));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let s=0;s<12;s++)t=t<<1^(t>>>11)*7973;const e=this.version<<12|t;w(e>>>18==0);for(let s=0;s<18;s++){const i=p(e,s),n=this.size-11+s%3,r=Math.floor(s/3);this.setFunctionModule(n,r,i),this.setFunctionModule(r,n,i)}}drawFinderPattern(t,e){for(let s=-4;s<=4;s++)for(let i=-4;i<=4;i++){const n=Math.max(Math.abs(i),Math.abs(s)),r=t+i,o=e+s;0<=r&&r{(l!=h-n||g>=o)&&f.push(u[l])});return w(f.length==r),f}drawCodewords(t){if(t.length!=Math.floor(c.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let e=0;for(let s=this.size-1;s>=1;s-=2){s==6&&(s=5);for(let i=0;i>>3],7-(e&7)),e++)}}w(e==t.length*8)}applyMask(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(let e=0;e5&&t++):(this.finderPenaltyAddHistory(o,h),r||(t+=this.finderPenaltyCountPatterns(h)*c.PENALTY_N3),r=this.modules[n][a],o=1);t+=this.finderPenaltyTerminateAndCount(r,o,h)*c.PENALTY_N3}for(let n=0;n5&&t++):(this.finderPenaltyAddHistory(o,h),r||(t+=this.finderPenaltyCountPatterns(h)*c.PENALTY_N3),r=this.modules[a][n],o=1);t+=this.finderPenaltyTerminateAndCount(r,o,h)*c.PENALTY_N3}for(let n=0;nr+(o?1:0),e);const s=this.size*this.size,i=Math.ceil(Math.abs(e*20-s*10)/s)-1;return w(0<=i&&i<=9),t+=i*c.PENALTY_N4,w(0<=t&&t<=2568888),t}getAlignmentPatternPositions(){if(this.version==1)return[];const t=Math.floor(this.version/7)+2,e=this.version==32?26:Math.ceil((this.version*4+4)/(t*2-2))*2,s=[6];for(let i=this.size-7;s.lengthc.MAX_VERSION)throw new RangeError("Version number out of range");let e=(16*t+128)*t+64;if(t>=2){const s=Math.floor(t/7)+2;e-=(25*s-10)*s-55,t>=7&&(e-=36)}return w(208<=e&&e<=29648),e}static getNumDataCodewords(t,e){return Math.floor(c.getNumRawDataModules(t)/8)-c.ECC_CODEWORDS_PER_BLOCK[e.ordinal][t]*c.NUM_ERROR_CORRECTION_BLOCKS[e.ordinal][t]}static reedSolomonComputeDivisor(t){if(t<1||t>255)throw new RangeError("Degree out of range");const e=[];for(let i=0;i0);for(const i of t){const n=i^s.shift();s.push(0),e.forEach((r,o)=>s[o]^=c.reedSolomonMultiply(r,n))}return s}static reedSolomonMultiply(t,e){if(t>>>8||e>>>8)throw new RangeError("Byte out of range");let s=0;for(let i=7;i>=0;i--)s=s<<1^(s>>>7)*285,s^=(e>>>i&1)*t;return w(s>>>8==0),s}finderPenaltyCountPatterns(t){const e=t[1];w(e<=this.size*3);const s=e>0&&t[2]==e&&t[3]==e*3&&t[4]==e&&t[5]==e;return(s&&t[0]>=e*4&&t[6]>=e?1:0)+(s&&t[6]>=e*4&&t[0]>=e?1:0)}finderPenaltyTerminateAndCount(t,e,s){return t&&(this.finderPenaltyAddHistory(e,s),e=0),e+=this.size,this.finderPenaltyAddHistory(e,s),this.finderPenaltyCountPatterns(s)}finderPenaltyAddHistory(t,e){e[0]==0&&(t+=this.size),e.pop(),e.unshift(t)}static MIN_VERSION=1;static MAX_VERSION=40;static PENALTY_N1=3;static PENALTY_N2=3;static PENALTY_N3=40;static PENALTY_N4=10;static ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]];static NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]]}function M(m,t,e){if(t<0||t>31||m>>>t)throw new RangeError("Value out of range");for(let s=t-1;s>=0;s--)e.push(m>>>s&1)}function p(m,t){return(m>>>t&1)!=0}function w(m){if(!m)throw new Error("Assertion error")}class d{static makeBytes(t){const e=[];for(const s of t)M(s,8,e);return new d(N.BYTE,t.length,e)}static makeNumeric(t){if(!d.isNumeric(t))throw new RangeError("String contains non-numeric characters");const e=[];for(let s=0;s=1<s=t.y+t.h?e:e.map((i,n)=>n=t.x+t.w?i:!1))}function _(m,t,e,s){if(!s)return null;const i=(m.length+e*2)/t,n=s*i,r=s*i,o=m.length/2-n/2,h=m.length/2-r/2,a=Math.floor(o),E=Math.floor(h),f=Math.ceil(n+o-a),l=Math.ceil(r+h-E);return{x:o,y:h,h:r,w:n,excavation:{x:a,y:E,w:f,h:l}}}function J(m,t){return t!=null?Math.max(Math.floor(t),0):m?K:W}function q(m){const t=v.c(24),{value:e,level:s,minVersion:i,includeMargin:n,marginSize:r,logoSize:o,size:h}=m;let a;if(t[0]!==s||t[1]!==i||t[2]!==e){const S=d.makeSegments(e);a=c.encodeSegments(S,$[s],i),t[0]=s,t[1]=i,t[2]=e,t[3]=a}else a=t[3];const E=a;let f,l,u,g;t[4]!==n||t[5]!==o||t[6]!==r||t[7]!==E||t[8]!==h?(f=E.getModules(),l=J(n,r),u=f.length+l*2,g=_(f,h,l,o),t[4]=n,t[5]=o,t[6]=r,t[7]=E,t[8]=h,t[9]=f,t[10]=l,t[11]=u,t[12]=g):(f=t[9],l=t[10],u=t[11],g=t[12]);const A=g;let b;t[13]!==A||t[14]!==f||t[15]!==l||t[16]!==u?(b={cells:f,margin:l,numCells:u,calculatedImageSettings:A},t[13]=A,t[14]=f,t[15]=l,t[16]=u,t[17]=b):b=t[17];const{cells:I,margin:C,numCells:y,calculatedImageSettings:P}=b;let L;return t[18]!==P||t[19]!==I||t[20]!==C||t[21]!==y||t[22]!==E?(L={qrcode:E,margin:C,cells:I,numCells:y,calculatedImageSettings:P},t[18]=P,t[19]=I,t[20]=C,t[21]=y,t[22]=E,t[23]=L):L=t[23],L}function Q(m){const t=v.c(26),{value:e,size:s,level:i,color:n,minVersion:r,title:o,logoSize:h}=m,a=s===void 0?Y:s,E=i===void 0?G:i,f=n===void 0?V:n,l=r===void 0?j:r;let u;t[0]!==E||t[1]!==h||t[2]!==l||t[3]!==a||t[4]!==e?(u={value:e,level:E,minVersion:l,includeMargin:X,marginSize:void 0,logoSize:h,size:a},t[0]=E,t[1]=h,t[2]=l,t[3]=a,t[4]=e,t[5]=u):u=t[5];const{margin:g,cells:A,numCells:b,calculatedImageSettings:I}=q(u);let C;t[6]!==I||t[7]!==A||t[8]!==h?(C=h&&I?.excavation?Z(A,I.excavation):A,t[6]=I,t[7]=A,t[8]=h,t[9]=C):C=t[9];const y=C;let P;t[10]!==y||t[11]!==g?(P=x(y,g),t[10]=y,t[11]=g,t[12]=P):P=t[12];const L=P,S=`0 0 ${b} ${b}`;let B;t[13]!==o?(B=!!o&&U.jsx("title",{children:o}),t[13]=o,t[14]=B):B=t[14];let F,O,T;t[15]===Symbol.for("react.memo_cache_sentinel")?(T={opacity:0},F={opacity:2},O={opacity:-1},t[15]=F,t[16]=O,t[17]=T):(F=t[15],O=t[16],T=t[17]);let z;t[18]!==f||t[19]!==L?(z=U.jsx(H.path,{fill:f,d:L,shapeRendering:"crispEdges",initial:T,animate:F,exit:O}),t[18]=f,t[19]=L,t[20]=z):z=t[20];let D;return t[21]!==a||t[22]!==z||t[23]!==S||t[24]!==B?(D=U.jsxs("svg",{height:a,width:a,viewBox:S,role:"img",children:[B,z]}),t[21]=a,t[22]=z,t[23]=S,t[24]=B,t[25]=D):D=t[25],D}const tt=k.memo(Q);tt.displayName="Memo(QRCodeSVG)";export{tt as default}; diff --git a/apps/studio/dist/static/SanityVision-CATdfIug.js b/apps/studio/dist/static/SanityVision-CATdfIug.js new file mode 100644 index 00000000..dbecd83b --- /dev/null +++ b/apps/studio/dist/static/SanityVision-CATdfIug.js @@ -0,0 +1,160 @@ +import{r as O,j as a,g as vn,c as le,u as dr,C as De,a as xn,S as Ee,B as Pe,H as Bn,b as Eu,F as ge,o as Hr,e as Wr,f as bn,h as Sn,i as wn,k as Kr,l as Je,v as Qe,n as Yr,p as jn,q as _n,s as Rn,t as zn,w as Pn,x as On,y as In,z as Ar,P as Er,A as Ot,D as ne,E as Re,G as Nn,I as Xr,J as ue,T as ye,K as kn,L as $n,M as Ln,N as Tn,O as gr,Q as Cu,R as Mn,U as Vn,V as qn,W as jt,X as Jn,Y as Qn,Z as Un,_ as Hn,$ as Wn,a0 as yr,a1 as Kn,a2 as Yn,a3 as Xn,a4 as Gn,a5 as Zn,a6 as ei,a7 as ti,a8 as ui,a9 as ri,aa as Uu,ab as Gr,ac as ni,ad as Zr,ae as ii,af as si,ag as en,ah as ai,ai as oi}from"./sanity-BZuh2pfi.js";import{l as li,h as ci,a as di,b as Di,c as fi,i as pi,d as hi,e as Ci,f as mi,g as Fi,s as tn,j as Ai,k as Ei,m as gi,n as yi,R as vi,E as xi,o as Bi,H as bi,t as L}from"./index-DznCqw2V.js";import{javascriptLanguage as Si}from"./index-ByKwSaqq.js";import"./index-9VbysdZK.js";var wi=Object.defineProperty,vr=Object.getOwnPropertySymbols,ji=Object.prototype.hasOwnProperty,_i=Object.prototype.propertyIsEnumerable,xr=(t,e,u)=>e in t?wi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[e]=u,Br=(t,e)=>{for(var u in e||(e={}))ji.call(e,u)&&xr(t,u,e[u]);if(vr)for(var u of vr(e))_i.call(e,u)&&xr(t,u,e[u]);return t};const br=function(t){const{children:e,className:u,split:r,style:l,size:n,eleRef:o}=t;let i={flex:1,position:"relative",outline:"none"};n!==void 0&&(r==="vertical"?i.width=n:(i.height=n,i.display="flex"),i.flex="none"),i=Br(Br({},i),l);const s=["Pane",r,u].filter(Boolean).join(" ");return a.jsx("div",{role:"region",ref:o,className:s,style:i,children:e})},rr="Resizer",Ri=function(t){const{className:e=rr,onClick:u,onDoubleClick:r,onMouseDown:l,onTouchEnd:n,onTouchStart:o,resizerClassName:i,split:s,style:d}=t,C=[i,s,e].filter(Boolean).join(" ");return a.jsx("span",{role:"separator",className:C,style:d,onMouseDown:D=>l(D.nativeEvent),onTouchStart:D=>{D.preventDefault(),o(D.nativeEvent)},onTouchEnd:D=>{D.preventDefault(),n(D.nativeEvent)},onClick:D=>{u&&(D.preventDefault(),u(D.nativeEvent))},onDoubleClick:D=>{r&&(D.preventDefault(),r(D.nativeEvent))}})};var zi=Object.defineProperty,Pi=Object.defineProperties,Oi=Object.getOwnPropertyDescriptors,Sr=Object.getOwnPropertySymbols,Ii=Object.prototype.hasOwnProperty,Ni=Object.prototype.propertyIsEnumerable,nr=(t,e,u)=>e in t?zi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[e]=u,xe=(t,e)=>{for(var u in e||(e={}))Ii.call(e,u)&&nr(t,u,e[u]);if(Sr)for(var u of Sr(e))Ni.call(e,u)&&nr(t,u,e[u]);return t},mu=(t,e)=>Pi(t,Oi(e)),hu=(t,e,u)=>nr(t,typeof e!="symbol"?e+"":e,u);const un={display:"flex",flex:1,height:"100%",position:"absolute",outline:"none",overflow:"hidden",MozUserSelect:"text",WebkitUserSelect:"text",msUserSelect:"text",userSelect:"text"},ki=mu(xe({},un),{flexDirection:"row",left:0,right:0}),$i=mu(xe({},un),{bottom:0,flexDirection:"column",minHeight:"100%",top:0,width:"100%"}),Hu={},rn=class _t extends O.Component{constructor(e){super(e),hu(this,"pane1",null),hu(this,"pane2",null),hu(this,"splitPane",null),this.onMouseDown=this.onMouseDown.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this);const{size:u,defaultSize:r,minSize:l,maxSize:n,primary:o}=e,i=u!==void 0?u:jr(r,l,n,void 0);this.state={active:!1,resized:!1,pane1Size:o==="first"?i:void 0,pane2Size:o==="second"?i:void 0,instanceProps:{size:u}}}componentDidMount(){document.addEventListener("mouseup",this.onMouseUp),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("touchmove",this.onTouchMove),this.setState(_t.getSizeUpdate(this.props,this.state))}static getDerivedStateFromProps(e,u){return _t.getSizeUpdate(e,u)}componentWillUnmount(){document.removeEventListener("mouseup",this.onMouseUp),document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("touchmove",this.onTouchMove)}onMouseDown(e){this.onTouchStart(mu(xe({},e),{touches:[{clientX:e.clientX,clientY:e.clientY}]}))}onTouchStart(e){const{allowResize:u,onDragStarted:r,split:l}=this.props;if(u){wr(document,window);const n=l==="vertical"?e.touches[0].clientX:e.touches[0].clientY;typeof r=="function"&&r(),this.setState({active:!0,position:n})}}onMouseMove(e){const u=Object.assign({},e,{touches:[{clientX:e.clientX,clientY:e.clientY}]});this.onTouchMove(u)}onTouchMove(e){if(!this.state.active||!this.props.allowResize)return;const{position:u=0}=this.state,{maxSize:r,minSize:l=_t.defaultProps.minSize,onChange:n,split:o=_t.defaultProps.split,step:i}=this.props;wr(document,window);const s=this.props.primary==="first",d=s?this.pane1:this.pane2,C=s?this.pane2:this.pane1;if(!d||!C||!d.getBoundingClientRect)return;const D=d,B=C,F=D.getBoundingClientRect().width,y=D.getBoundingClientRect().height,c=o==="vertical"?e.touches[0].clientX:e.touches[0].clientY,m=o==="vertical"?F:y;let h=u-c;if(i){if(Math.abs(h)w&&(b=-b);let E=r;this.splitPane&&r!==void 0&&r<=0&&(o==="vertical"?E=this.splitPane.getBoundingClientRect().width+r:E=this.splitPane.getBoundingClientRect().height+r);let P=m-b;const T=u-h;l&&PE?P=E:this.setState({position:T,resized:!0}),n&&n(P);const H=s?{pane1Size:P,pane2Size:void 0}:{pane2Size:P,pane1Size:void 0};this.setState(xe({draggedSize:P},H))}onMouseUp(){if(!this.state.active||!this.props.allowResize)return;const{onDragFinished:e}=this.props,{draggedSize:u}=this.state;typeof u<"u"&&typeof e=="function"&&e(u),this.setState({active:!1})}static getSizeUpdate(e,u){const{instanceProps:r}=u;if(r.size===e.size&&e.size!==void 0)return{};const l=e.size!==void 0?e.size:jr(e.defaultSize,e.minSize,e.maxSize,u.draggedSize),n=e.primary==="first"?{pane1Size:l,pane2Size:void 0}:{pane2Size:l,pane1Size:void 0};return mu(xe(xe({},n),typeof e.size>"u"?{}:{draggedSize:l}),{instanceProps:{size:e.size}})}render(){const{allowResize:e,children:u,className:r,onResizerClick:l,onResizerDoubleClick:n,paneClassName:o,pane1ClassName:i,pane2ClassName:s,paneStyle:d,pane1Style:C,pane2Style:D,resizerClassName:B=rr,resizerStyle:F,split:y,style:c}=this.props,{pane1Size:m,pane2Size:h}=this.state,b=e?"":"disabled",R=B&&`${B} ${rr}`,w=Li(u),E=y==="vertical"?ki:$i,P=c?xe(xe({},E),c):E,T=["SplitPane",r,y,b].filter(Boolean).join(" "),H=_r(xe(xe({},d),C),Hu),g=_r(xe(xe({},d),D),Hu),p=["Pane1",o,i].join(" "),x=["Pane2",o,s].join(" ");return a.jsxs("div",{"data-testid":"split-pane",className:T,style:P,ref:S=>{this.splitPane=S},children:[a.jsx(br,{className:p,eleRef:S=>{this.pane1=S},size:m,split:y,style:H,children:w[0]},"pane1"),a.jsx(Ri,{className:b,onClick:l,onDoubleClick:n,onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,onTouchEnd:this.onMouseUp,resizerClassName:R,split:y||"vertical",style:F||Hu},"resizer"),a.jsx(br,{className:x,eleRef:S=>{this.pane2=S},size:h,split:y,style:g,children:w[1]},"pane2")]})}};hu(rn,"defaultProps",{allowResize:!0,minSize:50,primary:"first",split:"vertical",paneClassName:"",pane1ClassName:"",pane2ClassName:""});let Wu=rn;function wr(t,e){var u;if("selection"in t&&typeof t.selection=="object"&&t.selection&&"empty"in t.selection&&typeof t.selection.empty=="function")try{t.selection.empty()}catch{}else if(typeof e<"u"&&typeof e.getSelection=="function")try{(u=e.getSelection())==null||u.removeAllRanges()}catch{}}function jr(t,e,u,r){if(typeof r=="number"){const l=typeof e=="number"?e:0,n=typeof u=="number"&&u>=0?u:1/0;return Math.max(l,Math.min(n,r))}return t!==void 0?t:e}function Li(t){return O.Children.toArray(t).filter(e=>e)}function Ti(t){return t===null||typeof t>"u"||Object.keys(t).length===0}function _r(t,e){return Ti(t)?e:t}var Mi=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,Vi=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,qi=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Ku={Space_Separator:Mi,ID_Start:Vi,ID_Continue:qi},de={isSpaceSeparator(t){return typeof t=="string"&&Ku.Space_Separator.test(t)},isIdStartChar(t){return typeof t=="string"&&(t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="$"||t==="_"||Ku.ID_Start.test(t))},isIdContinueChar(t){return typeof t=="string"&&(t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||t==="$"||t==="_"||t==="‌"||t==="‍"||Ku.ID_Continue.test(t))},isDigit(t){return typeof t=="string"&&/[0-9]/.test(t)},isHexDigit(t){return typeof t=="string"&&/[0-9A-Fa-f]/.test(t)}};let ir,Fe,Me,Fu,He,ze,pe,Dr,zt;var Ji=function(e,u){ir=String(e),Fe="start",Me=[],Fu=0,He=1,ze=0,pe=void 0,Dr=void 0,zt=void 0;do pe=Qi(),Wi[Fe]();while(pe.type!=="eof");return typeof u=="function"?sr({"":zt},"",u):zt};function sr(t,e,u){const r=t[e];if(r!=null&&typeof r=="object")if(Array.isArray(r))for(let l=0;l0;){const u=qe();if(!de.isHexDigit(u))throw ae(A());t+=A()}return String.fromCodePoint(parseInt(t,16))}const Wi={start(){if(pe.type==="eof")throw Xe();Yu()},beforePropertyName(){switch(pe.type){case"identifier":case"string":Dr=pe.value,Fe="afterPropertyName";return;case"punctuator":fu();return;case"eof":throw Xe()}},afterPropertyName(){if(pe.type==="eof")throw Xe();Fe="beforePropertyValue"},beforePropertyValue(){if(pe.type==="eof")throw Xe();Yu()},beforeArrayValue(){if(pe.type==="eof")throw Xe();if(pe.type==="punctuator"&&pe.value==="]"){fu();return}Yu()},afterPropertyValue(){if(pe.type==="eof")throw Xe();switch(pe.value){case",":Fe="beforePropertyName";return;case"}":fu()}},afterArrayValue(){if(pe.type==="eof")throw Xe();switch(pe.value){case",":Fe="beforeArrayValue";return;case"]":fu()}},end(){}};function Yu(){let t;switch(pe.type){case"punctuator":switch(pe.value){case"{":t={};break;case"[":t=[];break}break;case"null":case"boolean":case"numeric":case"string":t=pe.value;break}if(zt===void 0)zt=t;else{const e=Me[Me.length-1];Array.isArray(e)?e.push(t):Object.defineProperty(e,Dr,{value:t,writable:!0,enumerable:!0,configurable:!0})}if(t!==null&&typeof t=="object")Me.push(t),Array.isArray(t)?Fe="beforeArrayValue":Fe="beforePropertyName";else{const e=Me[Me.length-1];e==null?Fe="end":Array.isArray(e)?Fe="afterArrayValue":Fe="afterPropertyValue"}}function fu(){Me.pop();const t=Me[Me.length-1];t==null?Fe="end":Array.isArray(t)?Fe="afterArrayValue":Fe="afterPropertyValue"}function ae(t){return Au(t===void 0?`JSON5: invalid end of input at ${He}:${ze}`:`JSON5: invalid character '${sn(t)}' at ${He}:${ze}`)}function Xe(){return Au(`JSON5: invalid end of input at ${He}:${ze}`)}function Rr(){return ze-=5,Au(`JSON5: invalid identifier character at ${He}:${ze}`)}function Ki(t){console.warn(`JSON5: '${sn(t)}' in strings is not valid ECMAScript; consider escaping`)}function sn(t){const e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[t])return e[t];if(t<" "){const u=t.charCodeAt(0).toString(16);return"\\x"+("00"+u).substring(u.length)}return t}function Au(t){const e=new SyntaxError(t);return e.lineNumber=He,e.columnNumber=ze,e}var Yi=function(e,u,r){const l=[];let n="",o,i,s="",d;if(u!=null&&typeof u=="object"&&!Array.isArray(u)&&(r=u.space,d=u.quote,u=u.replacer),typeof u=="function")i=u;else if(Array.isArray(u)){o=[];for(const c of u){let m;typeof c=="string"?m=c:(typeof c=="number"||c instanceof String||c instanceof Number)&&(m=String(c)),m!==void 0&&o.indexOf(m)<0&&o.push(m)}}return r instanceof Number?r=Number(r):r instanceof String&&(r=String(r)),typeof r=="number"?r>0&&(r=Math.min(10,Math.floor(r)),s=" ".substr(0,r)):typeof r=="string"&&(s=r.substr(0,10)),C("",{"":e});function C(c,m){let h=m[c];switch(h!=null&&(typeof h.toJSON5=="function"?h=h.toJSON5(c):typeof h.toJSON=="function"&&(h=h.toJSON(c))),i&&(h=i.call(m,c,h)),h instanceof Number?h=Number(h):h instanceof String?h=String(h):h instanceof Boolean&&(h=h.valueOf()),h){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof h=="string")return D(h);if(typeof h=="number")return String(h);if(typeof h=="object")return Array.isArray(h)?y(h):B(h)}function D(c){const m={"'":.1,'"':.2},h={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let b="";for(let w=0;wm[w]=0)throw TypeError("Converting circular structure to JSON5");l.push(c);let m=n;n=n+s;let h=o||Object.keys(c),b=[];for(const w of h){const E=C(w,c);if(E!==void 0){let P=F(w)+":";s!==""&&(P+=" "),P+=E,b.push(P)}}let R;if(b.length===0)R="{}";else{let w;if(s==="")w=b.join(","),R="{"+w+"}";else{let E=`, +`+n;w=b.join(E),R=`{ +`+n+w+`, +`+m+"}"}}return l.pop(),n=m,R}function F(c){if(c.length===0)return D(c);const m=String.fromCodePoint(c.codePointAt(0));if(!de.isIdStartChar(m))return D(c);for(let h=m.length;h=0)throw TypeError("Converting circular structure to JSON5");l.push(c);let m=n;n=n+s;let h=[];for(let R=0;R=0&&typeof n=="object"&&!(o in n)){const{key:B}=r(d),F=parseInt(B);return Array.isArray(D)&&isNaN(F)?D.map(y=>t(y,d)):t(D,d)}else if(Array.isArray(n)){const B=parseInt(s);return o===s&&i===-1&&!isNaN(B)?D:n.map(F=>t(F,o))}else{if(i>=0&&o!==s&&typeof n=="object"&&s in n)return t(D,d);if(i===-1&&typeof n=="object"&&s in n&&!(o in n))return D}return C}Ze.evaluatePath=t;function e(n,o,i){if(n){if(!o)throw new Error("No keyPath was provided.")}else throw new Error("No object was provided.");return u(n,o,i)}Ze.setPath=e;function u(n,o,i){const{dotIndex:s,key:d,remaining:C}=r(o);if(o.startsWith("__proto__")||o.startsWith("constructor")||o.startsWith("prototype"))return n;if(s>=0){const D=parseInt(d);if(typeof n=="object"&&n!==null&&!(d in n)&&Array.isArray(n)&&!isNaN(D))return n[d]=n[d]??{},u(n[d],C,i),n;if(typeof n=="object"&&n!==null&&!(d in n)&&Array.isArray(n))return n.forEach(B=>u(B,o,i)),n;if(typeof n=="object"&&n!==null&&!(d in n)&&!Array.isArray(n)){const{key:B}=r(C),F=parseInt(B);if(!isNaN(F))n[d]=[];else{if(C==="")return n[o]=i,n;n[d]={}}}u(n[d],C,i)}else if(Array.isArray(n)){const D=parseInt(d);return o===d&&s===-1&&!isNaN(D)?(n[d]=i,n):(n.forEach(B=>u(B,C,i)),n)}else n[d]=i;return n}function r(n){const o=l(n);return{dotIndex:o,key:n.slice(0,o>=0?o:void 0).replace(/\\./g,"."),remaining:n.slice(o+1)}}function l(n){for(let o=0;o0?n[o-1]:"";if(n[o]==="."&&i!=="\\")return o}return-1}return Ze}var je={},Le={},Or;function Zi(){if(Or)return Le;Or=1,Object.defineProperty(Le,"__esModule",{value:!0}),Le.isDocumentToRecurOn=Le.flatten=Le.unique=void 0;function t(r){return[...new Set(r)]}Le.unique=t;function e(r){return[].concat(...r)}Le.flatten=e;function u(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&Object.keys(r).length}return Le.isDocumentToRecurOn=u,Le}var Xu={},Ir;function es(){return Ir||(Ir=1,Object.defineProperty(Xu,"__esModule",{value:!0})),Xu}var Nr;function ts(){return Nr||(Nr=1,(function(t){var e=je&&je.__createBinding||(Object.create?(function(F,y,c,m){m===void 0&&(m=c);var h=Object.getOwnPropertyDescriptor(y,c);(!h||("get"in h?!y.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return y[c]}}),Object.defineProperty(F,m,h)}):(function(F,y,c,m){m===void 0&&(m=c),F[m]=y[c]})),u=je&&je.__setModuleDefault||(Object.create?(function(F,y){Object.defineProperty(F,"default",{enumerable:!0,value:y})}):function(F,y){F.default=y}),r=je&&je.__importStar||function(F){if(F&&F.__esModule)return F;var y={};if(F!=null)for(var c in F)c!=="default"&&Object.prototype.hasOwnProperty.call(F,c)&&e(y,F,c);return u(y,F),y},l=je&&je.__exportStar||function(F,y){for(var c in F)c!=="default"&&!Object.prototype.hasOwnProperty.call(y,c)&&e(y,F,c)};Object.defineProperty(t,"__esModule",{value:!0}),t.deepKeysFromList=t.deepKeys=void 0;const n=r(Zi());l(es(),t);function o(F,y){const c=B(y);return typeof F=="object"&&F!==null?s("",F,c):[]}t.deepKeys=o;function i(F,y){const c=B(y);return F.map(m=>typeof m=="object"&&m!==null?o(m,c):[])}t.deepKeysFromList=i;function s(F,y,c){const m=Object.keys(y).map(h=>{const b=D(F,C(h,c));return c.expandNestedObjects&&n.isDocumentToRecurOn(y[h])||c.arrayIndexesAsKeys&&Array.isArray(y[h])&&y[h].length?s(b,y[h],c):c.expandArrayObjects&&Array.isArray(y[h])?d(y[h],b,c):c.ignoreEmptyArrays&&Array.isArray(y[h])&&!y[h].length?[]:b});return n.flatten(m)}function d(F,y,c){let m=i(F,c);return F.length?F.length&&n.flatten(m).length===0?[y]:(m=m.map(h=>Array.isArray(h)&&h.length===0?[y]:h.map(b=>D(y,C(b,c)))),n.unique(n.flatten(m))):c.ignoreEmptyArraysWhenExpanding?[]:[y]}function C(F,y){return y.escapeNestedDots?F.replace(/\./g,"\\."):F}function D(F,y){return F?F+"."+y:y}function B(F){return{arrayIndexesAsKeys:!1,expandNestedObjects:!0,expandArrayObjects:!1,ignoreEmptyArraysWhenExpanding:!1,escapeNestedDots:!1,ignoreEmptyArrays:!1,...F??{}}}})(je)),je}var J={},kr;function pr(){if(kr)return J;kr=1,Object.defineProperty(J,"__esModule",{value:!0}),J.isInvalid=J.flatten=J.unique=J.arrayDifference=J.isError=J.isUndefined=J.isNull=J.isObject=J.isString=J.isNumber=J.unwind=J.getNCharacters=J.removeEmptyFields=J.isEmptyField=J.computeSchemaDifferences=J.isDateRepresentation=J.isStringRepresentation=J.deepCopy=J.validate=J.buildC2JOptions=J.buildJ2COptions=void 0;const t=fr(),e=gu(),u=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/,r=1e5;function l(p){return{...e.defaultJson2CsvOptions,...p,delimiter:{field:p?.delimiter?.field??e.defaultJson2CsvOptions.delimiter.field,wrap:p?.delimiter?.wrap||e.defaultJson2CsvOptions.delimiter.wrap,eol:p?.delimiter?.eol||e.defaultJson2CsvOptions.delimiter.eol},fieldTitleMap:p?.fieldTitleMap||Object.create({})}}J.buildJ2COptions=l;function n(p){return{...e.defaultCsv2JsonOptions,...p,delimiter:{field:p?.delimiter?.field??e.defaultCsv2JsonOptions.delimiter.field,wrap:p?.delimiter?.wrap||e.defaultCsv2JsonOptions.delimiter.wrap,eol:p?.delimiter?.eol||e.defaultCsv2JsonOptions.delimiter.eol}}}J.buildC2JOptions=n;function o(p,x,S){if(!p)throw new Error(`${S.cannotCallOn} ${p}.`);if(!x(p))throw new Error(S.dataCheckFailure);return!0}J.validate=o;function i(p){return JSON.parse(JSON.stringify(p))}J.deepCopy=i;function s(p,x){const S=p[0],v=p.length-1,I=p[v];return S===x.delimiter.wrap&&I===x.delimiter.wrap}J.isStringRepresentation=s;function d(p){return u.test(p)}J.isDateRepresentation=d;function C(p,x){return P(p,x).concat(P(x,p))}J.computeSchemaDifferences=C;function D(p){return w(p)||R(p)||p===""}J.isEmptyField=D;function B(p){return p.filter(x=>!D(x))}J.removeEmptyFields=B;function F(p,x,S){return p.substring(x,x+S)}J.getNCharacters=F;function y(p,x,S){const v=(0,t.evaluatePath)(x,S);let I=i(x);Array.isArray(v)&&v.length?v.forEach(Y=>{I=i(x),p.push((0,t.setPath)(I,S,Y))}):(Array.isArray(v)&&v.length===0&&(0,t.setPath)(I,S,""),p.push(I))}function c(p,x){const S=[];return p.forEach(v=>{y(S,v,x)}),S}J.unwind=c;function m(p){return!isNaN(Number(p))}J.isNumber=m;function h(p){return typeof p=="string"}J.isString=h;function b(p){return typeof p=="object"}J.isObject=b;function R(p){return p===null}J.isNull=R;function w(p){return typeof p>"u"}J.isUndefined=w;function E(p){return Object.prototype.toString.call(p)==="[object Error]"}J.isError=E;function P(p,x){return p.filter(S=>!x.includes(S))}J.arrayDifference=P;function T(p){return[...new Set(p)]}J.unique=T;function H(p){if(p.flat)return p.flat();if(p.length>r){let x=[];for(let S=0;Sx.concat(S),[])}J.flatten=H;function g(p){return p===1/0||p===-1/0}return J.isInvalid=g,J}var $r;function us(){if($r)return we;$r=1;var t=we&&we.__createBinding||(Object.create?(function(s,d,C,D){D===void 0&&(D=C);var B=Object.getOwnPropertyDescriptor(d,C);(!B||("get"in B?!d.__esModule:B.writable||B.configurable))&&(B={enumerable:!0,get:function(){return d[C]}}),Object.defineProperty(s,D,B)}):(function(s,d,C,D){D===void 0&&(D=C),s[D]=d[C]})),e=we&&we.__setModuleDefault||(Object.create?(function(s,d){Object.defineProperty(s,"default",{enumerable:!0,value:d})}):function(s,d){s.default=d}),u=we&&we.__importStar||function(s){if(s&&s.__esModule)return s;var d={};if(s!=null)for(var C in s)C!=="default"&&Object.prototype.hasOwnProperty.call(s,C)&&t(d,s,C);return e(d,s),d};Object.defineProperty(we,"__esModule",{value:!0}),we.Json2Csv=void 0;const r=fr(),l=ts(),n=gu(),o=u(pr()),i=function(s){const d=new RegExp(s.delimiter.wrap,"g"),C=/\r?\n|\r/,D=s.parseValue&&typeof s.parseValue=="function"?s.parseValue:null,B=s.expandArrayObjects&&!s.unwindArrays,F={arrayIndexesAsKeys:s.arrayIndexesAsKeys,expandNestedObjects:s.expandNestedObjects,expandArrayObjects:B,ignoreEmptyArraysWhenExpanding:B,escapeNestedDots:!0};function y(f){return(0,l.deepKeysFromList)(f,F)}function c(f){return f.length===0?[]:s.checkSchemaDifferences?m(f):o.unique(o.flatten(f))}function m(f){const j=f[0],N=f.slice(1);if(h(j,N))throw new Error(n.errors.json2csv.notSameSchema);return j}function h(f,j){return j.reduce((N,$)=>o.computeSchemaDifferences(f,$).length>0?N+1:N,0)}function b(f){return s.excludeKeys?f.filter(j=>{for(const N of s.excludeKeys){const $=N instanceof RegExp?N:new RegExp(`^${N}`);if(N===j||j.match($))return!1}return!0}):f}function R(f){return s.sortHeader&&typeof s.sortHeader=="function"?f.sort(s.sortHeader):s.sortHeader?f.sort():f}function w(f){return s.trimHeaderFields&&(f.headerFields=f.headerFields.map(j=>j.split(".").map(N=>N.trim()).join("."))),f}function E(f){return s.prependHeader&&(f.headerFields=f.headerFields.map(function(j){return re(j)})),f}function P(f){const j=Object.keys(s.fieldTitleMap);return f.header=f.headerFields.map(function(N){let $=N;return j.includes(N)?$=s.fieldTitleMap[N]:s.escapeHeaderNestedDots||($=$.replace(/\\\./g,".")),$}).join(s.delimiter.field),f}function T(){return s.keys?s.keys.map(f=>typeof f=="object"&&"field"in f?(s.fieldTitleMap[f.field]=f.title??f.field,f.field):f):[]}function H(){return s.keys?s.keys.flatMap(f=>typeof f=="string"?[]:f?.wildcardMatch?f.field:[]):[]}function g(f){const j=H(),N=T(),$=y(f),Q=c($);if(s.keys){s.keys=N;const V=N.flatMap(q=>{if(!j.includes(q))return q;const fe=[],he=new RegExp(`^${q}`);for(const ie of Q)(q===ie||ie.match(he))&&fe.push(ie);return fe});if(!s.unwindArrays){const q=b(V);return R(q)}}const ee=b(Q);return R(ee)}function p(f){for(const j of f.records)for(const N of f.headerFields){const $=(0,r.evaluatePath)(j,N);if(Array.isArray($))return!0}return!1}function x(f,j=!1){if(s.unwindArrays){if(f.headerFields.forEach(N=>{f.records=o.unwind(f.records,N)}),f.headerFields=g(f.records),p(f))return x(f,j);if(!j)return x(f,!0);if(s.keys){const N=T();f.headerFields=b(N)}return f}return f}function S(f){return f.recordString=f.records.map(j=>{const N=I(j,f.headerFields),$=N.map(Q=>{Q=X(Q),Q=M(Q);let ee=D?D(Q,Y):Y(Q);return ee=re(ee),ee});return z($)}).join(s.delimiter.eol),f}function v(f){const j=o.removeEmptyFields(f);return!f.length||!j.length?s.emptyFieldValue||"":j.length===1?j[0]:f}function I(f,j){const N=[];return j.forEach($=>{let Q=(0,r.evaluatePath)(f,$);!o.isUndefined(s.emptyFieldValue)&&o.isEmptyField(Q)?Q=s.emptyFieldValue:s.expandArrayObjects&&Array.isArray(Q)&&(Q=v(Q)),N.push(Q)}),N}function Y(f){const j=f instanceof Date;return f===null||Array.isArray(f)||typeof f=="object"&&!j?JSON.stringify(f):typeof f>"u"?"undefined":j&&s.useDateIso8601Format?f.toISOString():s.useLocaleFormat?f.toLocaleString():f.toString()}function X(f){return s.trimFieldValues?Array.isArray(f)?f.map(X):typeof f=="string"?f.trim():f:f}function M(f){return s.preventCsvInjection?Array.isArray(f)?f.map(M):typeof f=="string"&&!o.isNumber(f)?f.replace(/^[=+\-@\t\r]+/g,""):f:f}function re(f){const j=s.delimiter.wrap;return f.includes(s.delimiter.wrap)&&(f=f.replace(d,j+j)),(f.includes(s.delimiter.field)||f.includes(s.delimiter.wrap)||f.match(C)||s.wrapBooleans&&(f==="true"||f==="false"))&&(f=j+f+j),f}function z(f){return f.join(s.delimiter.field)}function W(f){const j=f.header,N=f.recordString;return(s.excelBOM?n.excelBOM:"")+(s.prependHeader?j+s.delimiter.eol:"")+N}function oe(f){Array.isArray(f)||(f=[f]);const j={headerFields:g(f),records:f,header:"",recordString:""},N=x(j),$=S(N),Q=E($),ee=w(Q),V=P(ee);return W(V)}return{convert:oe}};return we.Json2Csv=i,we}var _e={},Lr;function rs(){if(Lr)return _e;Lr=1;var t=_e&&_e.__createBinding||(Object.create?(function(i,s,d,C){C===void 0&&(C=d);var D=Object.getOwnPropertyDescriptor(s,d);(!D||("get"in D?!s.__esModule:D.writable||D.configurable))&&(D={enumerable:!0,get:function(){return s[d]}}),Object.defineProperty(i,C,D)}):(function(i,s,d,C){C===void 0&&(C=d),i[C]=s[d]})),e=_e&&_e.__setModuleDefault||(Object.create?(function(i,s){Object.defineProperty(i,"default",{enumerable:!0,value:s})}):function(i,s){i.default=s}),u=_e&&_e.__importStar||function(i){if(i&&i.__esModule)return i;var s={};if(i!=null)for(var d in i)d!=="default"&&Object.prototype.hasOwnProperty.call(i,d)&&t(s,i,d);return e(s,i),s};Object.defineProperty(_e,"__esModule",{value:!0}),_e.Csv2Json=void 0;const r=fr(),l=gu(),n=u(pr()),o=function(i){const s=new RegExp(i.delimiter.wrap+i.delimiter.wrap,"g"),d=new RegExp("^"+l.excelBOM),C=i.parseValue&&typeof i.parseValue=="function"?i.parseValue:JSON.parse;function D(g){return g=w(g),i.trimHeaderFields?g.split(".").map(p=>p.trim()).join("."):g}function B(g){let p=[];if(i.headerFields)p=i.headerFields.map((x,S)=>({value:D(x),index:S}));else if(p=g[0].map((S,v)=>({value:D(S),index:v})),i.keys){const S=i.keys;p=p.filter(v=>S.includes(v.value))}return{lines:g,headerFields:p,recordLines:[]}}function F(g){return i.excelBOM?g.replace(d,""):g}function y(g){const p=[],x=g.length-1,S=i.delimiter.eol.length,v={insideWrapDelimiter:!1,parsingValue:!0,justParsedDoubleQuote:!1,startIndex:0};let I=[],Y,X,M,re,z=0;for(;z{const v=m(S,p);try{return(0,r.setPath)(x,S.value,v)}catch{return x}},{})}function w(g){const p=g[0],x=g.length-1,S=g[x];return p===i.delimiter.wrap&&S===i.delimiter.wrap?g.length<=2?"":g.substring(1,x):g}function E(g){return g.replace(s,i.delimiter.wrap)}function P(g){return g.recordLines.reduce((p,x)=>{x=x.map(v=>(v=w(v),v=E(v),v=b(v),v));const S=R(g.headerFields,x);return p.concat(S)},[])}function T(g){try{if(n.isStringRepresentation(g,i)&&!n.isDateRepresentation(g))return g;const p=C(g);return Array.isArray(p)?p.map(b):p}catch(p){return p}}function H(g){const p=F(g),x=y(p),S=B(x),v=c(S);return P(v)}return{convert:H}};return _e.Csv2Json=o,_e}var Tr;function ns(){if(Tr)return Ge;Tr=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.csv2json=Ge.json2csv=void 0;const t=gu(),e=us(),u=rs(),r=pr();function l(o,i){const s=(0,r.buildJ2COptions)(i??{});return(0,r.validate)(o,r.isObject,t.errors.json2csv),(0,e.Json2Csv)(s).convert(o)}Ge.json2csv=l;function n(o,i){const s=(0,r.buildC2JOptions)(i??{});return(0,r.validate)(o,r.isString,t.errors.csv2json),(0,u.Csv2Json)(s).convert(o)}return Ge.csv2json=n,Ge}var is=ns(),Gu,Mr;function ss(){if(Mr)return Gu;Mr=1;class t{constructor(u={}){if(!(u.maxSize&&u.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=u.maxSize,this.onEviction=u.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(u,r){if(this.cache.set(u,r),this._size++,this._size>=this.maxSize){if(this._size=0,typeof this.onEviction=="function")for(const[l,n]of this.oldCache.entries())this.onEviction(l,n);this.oldCache=this.cache,this.cache=new Map}}get(u){if(this.cache.has(u))return this.cache.get(u);if(this.oldCache.has(u)){const r=this.oldCache.get(u);return this.oldCache.delete(u),this._set(u,r),r}}set(u,r){return this.cache.has(u)?this.cache.set(u,r):this._set(u,r),this}has(u){return this.cache.has(u)||this.oldCache.has(u)}peek(u){if(this.cache.has(u))return this.cache.get(u);if(this.oldCache.has(u))return this.oldCache.get(u)}delete(u){const r=this.cache.delete(u);return r&&this._size--,this.oldCache.delete(u)||r}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(const[u]of this)yield u}*values(){for(const[,u]of this)yield u}*[Symbol.iterator](){for(const u of this.cache)yield u;for(const u of this.oldCache){const[r]=u;this.cache.has(r)||(yield u)}}get size(){let u=0;for(const r of this.oldCache.keys())this.cache.has(r)||u++;return Math.min(this._size+u,this.maxSize)}}return Gu=t,Gu}var as=ss();const os=vn(as),Pt=["v1","vX","v2021-03-25","v2021-10-21","v2022-03-07","v2025-02-19",`v${new Date().toISOString().split("T")[0]}`],[an]=Pt.slice(-1);function on(t){const e=le.c(5),[u,r]=O.useState(!1);let l,n;e[0]!==t.delay?(l=()=>{const i=setTimeout(()=>r(!0),t.delay||500);return()=>clearTimeout(i)},n=[t.delay],e[0]=t.delay,e[1]=l,e[2]=n):(l=e[1],n=e[2]),O.useEffect(l,n);let o;return e[3]!==u?(o=u?a.jsx(wn,{muted:!0,size:4}):null,e[3]=u,e[4]=o):o=e[4],o}const ls=[[Si],li(),ci(),di(),Di(),fi(),pi(),hi(),Ci(),mi(),Fi(),tn(Ai,{fallback:!0}),Ei.of([{key:"Mod-Enter",run:()=>!0},gi,yi].flat().filter(Boolean))];function cs(t){const e=le.c(7);let u;e[0]!==t?(u=ds(t),e[0]=t,e[1]=u):u=e[1];const r=u;let l;e[2]!==t?(l=tn(Ds(t)),e[2]=t,e[3]=l):l=e[3];const n=l;let o;return e[4]!==n||e[5]!==r?(o=[r,n],e[4]=n,e[5]=r,e[6]=o):o=e[6],o}function ds(t){const{color:e,fonts:u}=t.sanity,r=e.card.enabled,l=yr.blue[e.dark?400:500].hex,n=yr.gray[t.sanity.color.dark?900:100].hex;return Bi.theme({"&":{color:r.fg,backgroundColor:r.bg},".cm-content":{caretColor:l},".cm-editor":{fontFamily:u.code.family,fontSize:Re(u.code.sizes[1].fontSize),lineHeight:"inherit"},".cm-cursor, .cm-dropCursor":{borderLeftColor:l},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:n},".cm-panels":{backgroundColor:r.bg,color:r.fg},".cm-panels.cm-panels-top":{borderBottom:`2px solid ${r.border}`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid ${r.border}`}},{dark:e.dark})}function Ds(t){const e=t.sanity.color.base,u=t.sanity.color.syntax;return bi.define([{tag:L.keyword,color:u.keyword},{tag:[L.propertyName,L.name,L.deleted,L.character,L.macroName],color:u.property},{tag:[L.function(L.variableName),L.labelName],color:u.function},{tag:[L.color,L.constant(L.name),L.standard(L.name)],color:u.variable},{tag:[L.definition(L.name),L.separator],color:u.constant},{tag:[L.typeName,L.className,L.number,L.changed,L.annotation,L.modifier,L.self,L.namespace],color:u.number},{tag:[L.operator,L.operatorKeyword,L.url,L.escape,L.regexp,L.link,L.special(L.string)],color:u.operator},{tag:[L.meta,L.comment],color:u.comment},{tag:L.strong,fontWeight:"bold"},{tag:L.emphasis,fontStyle:"italic"},{tag:L.strikethrough,textDecoration:"line-through"},{tag:L.heading,fontWeight:"bold",color:u.property},{tag:[L.atom,L.bool,L.special(L.variableName)],color:u.boolean},{tag:[L.processingInstruction,L.string,L.inserted],color:u.string},{tag:L.invalid,color:e.fg}])}const fs=ne.div.withConfig({displayName:"EditorRoot",componentId:"sc-1e01cjn-0"})`width:100%;box-sizing:border-box;height:100%;overflow:hidden;overflow:clip;position:relative;display:flex;& .cm-theme{width:100%;}& .cm-editor{height:100%;font-size:16px;line-height:21px;}& .cm-line{padding-left:${({theme:t})=>Re(t.sanity.space[3])};}& .cm-content{border-right-width:${({theme:t})=>Re(t.sanity.space[4])} !important;padding-top:${({theme:t})=>Re(t.sanity.space[5])};}`,hr=O.forwardRef((t,e)=>{const u=le.c(7),[r]=O.useState(t.initialValue),l=Nn(),n=cs(l),o=O.useRef(null);let i;u[0]===Symbol.for("react.memo_cache_sentinel")?(i=B=>{const F=o.current?.view;if(!F)return;const y=F.state.doc.toString();B!==y&&F.dispatch({changes:{from:0,to:y.length,insert:B},selection:xi.cursor(B.length)})},u[0]=i):i=u[0];const s=i;let d,C;u[1]===Symbol.for("react.memo_cache_sentinel")?(d=()=>({resetEditorContent:s}),C=[s],u[1]=d,u[2]=C):(d=u[1],C=u[2]),O.useImperativeHandle(e,d,C);let D;return u[3]!==r||u[4]!==t.onChange||u[5]!==n?(D=a.jsx(fs,{children:a.jsx(vi,{ref:o,basicSetup:!1,theme:n,extensions:ls,value:r,onChange:t.onChange})}),u[3]=r,u[4]=t.onChange,u[5]=n,u[6]=D):D=u[6],D});hr.displayName="VisionCodeMirror";const ln=["pinnedRelease","scheduledDrafts","raw","published","drafts"],ps=["pinnedRelease","scheduledDrafts"];function Zu(t){return ln.includes(t)}function Vr(t){return typeof t=="string"&&ps.includes(t)}function qr({selectedPerspectiveName:t}){return typeof t<"u"}function er({visionPerspective:t,perspectiveStack:e,scheduledDraftsStack:u}){return t==="pinnedRelease"?e:t==="scheduledDrafts"?u:t}function tr(t,e={},u={}){const r=new URLSearchParams;r.set("query",t);for(const[l,n]of Object.entries(e))r.set(`$${l}`,JSON.stringify(n));for(const[l,n]of Object.entries(u))n&&r.set(l,`${n}`);return`?${r}`}function hs(t){return!!t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"}const cn=Fs(),dn="sanityVision:";function Cs(){if(cn)for(let t=0;t"u"?d:C[s]}function l(s,d){const C=o();return C[s]=d,localStorage.setItem(e,JSON.stringify(u)),d}function n(s){const d={...o(),...s};return localStorage.setItem(e,JSON.stringify(d)),d}function o(){return u===null&&(u=i()),u}function i(){if(!cn)return{};try{const s=JSON.parse(localStorage.getItem(e)||"{}");return hs(s)?s:{}}catch{return{}}}}function Fs(){const t="lsCheck";try{return localStorage.setItem(t,t),localStorage.removeItem(t),!0}catch{return!1}}function As(t){const e={},u={};for(const[r,l]of t.entries()){if(r[0]==="$"){e[r.slice(1)]=JSON.parse(l);continue}if(r==="perspective"){u[r]=l;continue}}return{query:t.get("query")||"",params:e,options:u}}function Es(t){return t[0]!=="v"&&t!=="other"?`v${t}`:t}function ur(t){const e=t.replace(/^v/,"").trim().toUpperCase();return e.length>0&&(e==="X"||e==="1"||/^\d{4}-\d{2}-\d{2}$/.test(e)&&!isNaN(Date.parse(e)))}function gs(t,e){try{const u=t?Gi.parse(t):{};return typeof u=="object"&&u&&!Array.isArray(u)?u:{}}catch(u){return u.message=`${e("params.error.params-invalid-json")}: + +${u.message.replace("JSON5:","")}`,u}}const Dn=ne(ge).withConfig({displayName:"Root",componentId:"sc-r315za-0"})`.sidebarPanes .Pane{overflow-y:auto;overflow-x:hidden;}& .Resizer{background:var(--card-border-color);opacity:1;z-index:1;box-sizing:border-box;background-clip:padding-box;border:solid transparent;}& .Resizer:hover{border-color:var(--card-shadow-ambient-color);}& .Resizer.horizontal{height:11px;margin:-5px 0;border-width:5px 0;cursor:row-resize;width:100%;z-index:4;}& .Resizer.vertical{width:11px;margin:0 -5px;border-width:0 5px;cursor:col-resize;z-index:2;}.Resizer.disabled{cursor:not-allowed;}.Resizer.disabled:hover{border-color:transparent;}`;Dn.displayName="Root";const ys=ne(De).withConfig({displayName:"Header",componentId:"sc-r315za-1"})`border-bottom:1px solid var(--card-border-color);`,Ve=ne(Zn).withConfig({displayName:"StyledLabel",componentId:"sc-r315za-2"})`flex:1;`,vs=ne(ue).withConfig({displayName:"SplitpaneContainer",componentId:"sc-r315za-3"})`position:relative;`,xs=ne.a.withConfig({displayName:"QueryCopyLink",componentId:"sc-r315za-4"})`cursor:pointer;margin-right:auto;`,fn=ne(ue).withConfig({displayName:"InputBackgroundContainer",componentId:"sc-r315za-5"})`position:absolute;top:1rem;left:0;padding:0;margin:0;z-index:10;right:0;${Ve}{user-select:none;}`,pn=ne(fn).withConfig({displayName:"InputBackgroundContainerLeft",componentId:"sc-r315za-6"})`left:33px;`,Jr=ne(De).withConfig({displayName:"InputContainer",componentId:"sc-r315za-7"})`width:100%;height:100%;position:relative;flex-direction:column;`,Bs=ne(ge).withConfig({displayName:"ResultOuterContainer",componentId:"sc-r315za-8"})`height:100%;`,bs=ne(ue).withConfig({displayName:"ResultInnerContainer",componentId:"sc-r315za-9"})`position:relative;`,Ss=ne(De).withConfig({displayName:"ResultContainer",componentId:"sc-r315za-10"})`height:100%;width:100%;position:absolute;max-width:100%;${({$isInvalid:t})=>t&&Xr` + &:after { + background-color: var(--card-bg-color); + content: ''; + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 100%; + } + `}`,ws=ne(ue).withConfig({displayName:"Result",componentId:"sc-r315za-11"})`position:relative;width:100%;height:100%;z-index:20;`,js=ne(ge).withConfig({displayName:"ResultFooter",componentId:"sc-r315za-12"})`border-top:1px solid var(--card-border-color);`,_s=ne(De).withConfig({displayName:"TimingsCard",componentId:"sc-r315za-13"})`position:relative;`;ne(ue).withConfig({displayName:"TimingsContainer",componentId:"sc-r315za-14"})`width:100%;height:100%;`;const Rs=ne(ge).withConfig({displayName:"TimingsTextContainer",componentId:"sc-r315za-15"})`height:100%;min-height:${({theme:t})=>Re(t.sanity.space[3]*2+t.sanity.fonts.text.sizes[2].lineHeight-t.sanity.fonts.text.sizes[2].ascenderHeight-t.sanity.fonts.text.sizes[2].descenderHeight)};`,zs=ne(De).withConfig({displayName:"DownloadsCard",componentId:"sc-r315za-16"})`position:relative;`,Ps=ne(ye).withConfig({displayName:"SaveResultLabel",componentId:"sc-r315za-17"})`transform:initial;&:before,&:after{content:none;}> span{display:flex !important;gap:${({theme:t})=>Re(t.sanity.space[3])};align-items:center;}`,Os=ne(ue).withConfig({displayName:"ControlsContainer",componentId:"sc-r315za-18"})`border-top:1px solid var(--card-border-color);`,Is=`{ + +}`;function Ns(t){const e=le.c(21),{onChange:u,paramsError:r,hasValidParams:l,editorRef:n}=t,{t:o}=Je(Qe);let i;e[0]!==u?(i=R=>{u(R)},e[0]=u,e[1]=i):i=e[1];const s=i;let d;e[2]!==s?(d=In(s,333),e[2]=s,e[3]=d):d=e[3];const C=d,D=l?"default":"critical";let B;e[4]!==o?(B=o("params.label"),e[4]=o,e[5]=B):B=e[5];let F;e[6]!==B?(F=a.jsx(Ve,{muted:!0,children:B}),e[6]=B,e[7]=F):F=e[7];let y;e[8]!==r?(y=r&&a.jsx(Ot,{animate:!0,placement:"top",portal:!0,content:a.jsx(ye,{size:1,children:r}),children:a.jsx(ue,{padding:1,marginX:2,children:a.jsx(ye,{children:a.jsx(kn,{})})})}),e[8]=r,e[9]=y):y=e[9];let c;e[10]!==F||e[11]!==y?(c=a.jsx(pn,{children:a.jsxs(ge,{children:[F,y]})}),e[10]=F,e[11]=y,e[12]=c):c=e[12];const m=t.value||Is;let h;e[13]!==n||e[14]!==C||e[15]!==m?(h=a.jsx(hr,{ref:n,initialValue:m,onChange:C}),e[13]=n,e[14]=C,e[15]=m,e[16]=h):h=e[16];let b;return e[17]!==D||e[18]!==c||e[19]!==h?(b=a.jsxs(De,{flex:1,tone:D,"data-testid":"params-editor",children:[c,h]}),e[17]=D,e[18]=c,e[19]=h,e[20]=b):b=e[20],b}function Qr(t,e){const u=gs(t,e),r=u instanceof Error?{}:u,l=u instanceof Error?u.message:void 0;return{parsed:r,raw:t,valid:!l,error:l}}const ks="studio.vision-tool.saved-queries",or={queries:[]},pu=ks;function $s(){const t=le.c(27),e=Xn(),[u,r]=O.useState(or),[l,n]=O.useState(!1);let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],t[0]=o):o=t[0];const[i,s]=O.useState(o),[d,C]=O.useState(),[D,B]=O.useState(),[F,y]=O.useState();let c;t[1]!==e?(c=e.getKey(pu),t[1]=e,t[2]=c):c=t[2];const m=c;let h;t[3]!==m?(h=()=>{const p=m.pipe(ei(or),Wr(Ls)).subscribe({next:r,error:x=>y(x)});return()=>p?.unsubscribe()},t[3]=m,t[4]=h):h=t[4];let b;t[5]!==e||t[6]!==m?(b=[m,e],t[5]=e,t[6]=m,t[7]=b):b=t[7],O.useEffect(h,b);let R;t[8]!==e||t[9]!==u.queries?(R=async p=>{n(!0),C(void 0);try{const x=[{...p,_key:ti()},...u.queries];r({queries:x}),await e.setKey(pu,{queries:x})}catch(x){C(x)}n(!1)},t[8]=e,t[9]=u.queries,t[10]=R):R=t[10];const w=R;let E;t[11]!==e||t[12]!==u.queries?(E=async p=>{n(!0),C(void 0);try{const x=u.queries.map(S=>S._key===p._key?{...S,...p}:S);r({queries:x}),await e.setKey(pu,{queries:x})}catch(x){C(x)}n(!1)},t[11]=e,t[12]=u.queries,t[13]=E):E=t[13];const P=E;let T;t[14]!==e||t[15]!==u.queries?(T=async p=>{s(x=>[...x,p]),B(void 0);try{const x=u.queries.filter(S=>S._key!==p);r({queries:x}),await e.setKey(pu,{queries:x})}catch(x){B(x)}s(x=>x.filter(S=>S!==p))},t[14]=e,t[15]=u.queries,t[16]=T):T=t[16];const H=T;let g;return t[17]!==H||t[18]!==D||t[19]!==i||t[20]!==F||t[21]!==w||t[22]!==d||t[23]!==l||t[24]!==P||t[25]!==u.queries?(g={queries:u.queries,saveQuery:w,updateQuery:P,deleteQuery:H,saving:l,deleting:i,saveQueryError:d,deleteQueryError:D,error:F},t[17]=H,t[18]=D,t[19]=i,t[20]=F,t[21]=w,t[22]=d,t[23]=l,t[24]=P,t[25]=u.queries,t[26]=g):g=t[26],g}function Ls(t){return t||or}const Ts=ne(Ee).withConfig({displayName:"FixedHeader",componentId:"sc-14q7beb-0"})`position:sticky;top:0;background:${({theme:t})=>t.sanity.color.base.bg};z-index:1;`,Ms=ne(ue).withConfig({displayName:"ScrollContainer",componentId:"sc-14q7beb-1"})`height:100%;overflow-y:auto;overflow-x:hidden;&::-webkit-scrollbar{width:8px;}&::-webkit-scrollbar-track{background:transparent;}&::-webkit-scrollbar-thumb{background:${({theme:t})=>t.sanity.color.base.border};border-radius:4px;}`;function Vs(t){const e=le.c(80),{url:u,getStateFromUrl:r,setStateFromParsedUrl:l,currentQuery:n,currentParams:o,generateUrl:i}=t,s=Kr(),{saveQuery:d,updateQuery:C,queries:D,deleteQuery:B,saving:F,saveQueryError:y}=$s(),{t:c}=Je(Qe);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0},e[0]=m):m=e[0];const h=qn(m),[b,R]=O.useState(null),[w,E]=O.useState("");let P;e[1]===Symbol.for("react.memo_cache_sentinel")?(P={},e[1]=P):P=e[1];const[T,H]=O.useState(P),[g,p]=O.useState(""),[x,S]=O.useState(u);let v;e[2]!==o||e[3]!==n||e[4]!==h||e[5]!==i||e[6]!==r||e[7]!==D||e[8]!==d||e[9]!==y||e[10]!==c||e[11]!==s?(v=async()=>{const Q=i(n,o);if(D?.some(ee=>{const V=r(ee.url);return V&&V.query===n&&jt(V.params,o)})){const ee=D?.find(V=>{const q=r(V.url);return q&&q.query===n&&jt(q.params,o)});s.push({closable:!0,status:"warning",title:c("save-query.already-saved"),description:`${ee?.title} - ${h.format(new Date(ee?.savedAt||""))}`});return}Q&&(await d({url:Q,savedAt:new Date().toISOString(),title:"Untitled"}),S(Q)),y?s.push({closable:!0,status:"error",title:c("save-query.error"),description:y.message}):s.push({closable:!0,status:"success",title:c("save-query.success")})},e[2]=o,e[3]=n,e[4]=h,e[5]=i,e[6]=r,e[7]=D,e[8]=d,e[9]=y,e[10]=c,e[11]=s,e[12]=v):v=e[12];const I=v;let Y;e[13]!==c||e[14]!==s||e[15]!==C?(Y=async(Q,ee)=>{R(null),H(V=>({...V,[Q._key]:ee}));try{await C({...Q,title:ee}),H(V=>{const q={...V};return delete q[Q._key],q})}catch(V){const q=V;H(fe=>{const he={...fe};return delete he[Q._key],he}),s.push({closable:!0,status:"error",title:c("save-query.error"),description:q.message})}},e[13]=c,e[14]=s,e[15]=C,e[16]=Y):Y=e[16];const X=Y;let M;e[17]!==o||e[18]!==n||e[19]!==h||e[20]!==i||e[21]!==r||e[22]!==D||e[23]!==c||e[24]!==s||e[25]!==C?(M=async Q=>{const ee=i(n,o);if(D?.some(V=>{if(V._key===Q._key)return!1;const q=r(V.url);return q&&q.query===n&&jt(q.params,o)})){const V=D?.find(q=>{if(q._key===Q._key)return!1;const fe=r(q.url);return fe&&fe.query===n&&jt(fe.params,o)});s.push({closable:!0,status:"warning",title:c("save-query.already-saved"),description:`${V?.title} - ${h.format(new Date(V?.savedAt||""))}`});return}try{await C({...Q,url:ee,savedAt:new Date().toISOString()}),S(ee),s.push({closable:!0,status:"success",title:c("save-query.success")})}catch(V){const q=V;s.push({closable:!0,status:"error",title:c("save-query.error"),description:q.message})}},e[17]=o,e[18]=n,e[19]=h,e[20]=i,e[21]=r,e[22]=D,e[23]=c,e[24]=s,e[25]=C,e[26]=M):M=e[26];const re=M;let z,W,oe,f,j;if(e[27]!==o||e[28]!==n||e[29]!==B||e[30]!==b||e[31]!==w||e[32]!==h||e[33]!==r||e[34]!==I||e[35]!==X||e[36]!==re||e[37]!==T||e[38]!==D||e[39]!==F||e[40]!==g||e[41]!==x||e[42]!==l||e[43]!==c){const Q=D?.filter(te=>te?.title?.toLowerCase().includes(g.toLowerCase()));W=Ms;let ee;e[49]===Symbol.for("react.memo_cache_sentinel")?(ee={textTransform:"capitalize"},e[49]=ee):ee=e[49];let V;e[50]!==c?(V=c("label.saved-queries"),e[50]=c,e[51]=V):V=e[51];let q;e[52]!==V?(q=a.jsx(ye,{weight:"semibold",style:ee,size:4,children:V}),e[52]=V,e[53]=q):q=e[53];let fe;e[54]!==c?(fe=c("action.save-query"),e[54]=c,e[55]=fe):fe=e[55];let he;e[56]!==I||e[57]!==F||e[58]!==fe?(he=a.jsx(Pe,{label:fe,icon:ui,disabled:F,onClick:I,mode:"bleed"}),e[56]=I,e[57]=F,e[58]=fe,e[59]=he):he=e[59];let ie;e[60]!==q||e[61]!==he?(ie=a.jsxs(ge,{padding:3,paddingTop:4,paddingBottom:0,justify:"space-between",align:"center",children:[q,he]}),e[60]=q,e[61]=he,e[62]=ie):ie=e[62];let Oe;e[63]!==c?(Oe=c("label.search-queries"),e[63]=c,e[64]=Oe):Oe=e[64];let Ue;e[65]===Symbol.for("react.memo_cache_sentinel")?(Ue=te=>p(te.currentTarget.value),e[65]=Ue):Ue=e[65];let Ie;e[66]!==g||e[67]!==Oe?(Ie=a.jsx(ue,{padding:3,paddingTop:0,children:a.jsx(Cu,{placeholder:Oe,icon:ri,value:g,onChange:Ue})}),e[66]=g,e[67]=Oe,e[68]=Ie):Ie=e[68],e[69]!==ie||e[70]!==Ie?(j=a.jsxs(Ts,{space:3,children:[ie,Ie]}),e[69]=ie,e[70]=Ie,e[71]=j):j=e[71],z=Ee,oe=3,f=Q?.map(te=>{const G=r(te.url),et=x===te.url,yt=G&&n===G.query&&jt(o,G.params),We=et&&!yt;return a.jsx(De,{width:"fill",padding:4,border:!0,tone:et?"positive":"default",onClick:()=>{S(te.url);const Ce=r(te.url);Ce&&l(Ce)},style:{position:"relative"},children:a.jsxs(Ee,{space:3,children:[a.jsxs(ge,{justify:"space-between",align:"center",children:[a.jsxs(ge,{align:"center",gap:2,paddingRight:1,children:[b===te._key?a.jsx(Cu,{value:w,onChange:Ce=>E(Ce.currentTarget.value),onKeyDown:Ce=>{Ce.key==="Enter"?X(te,w):Ce.key==="Escape"&&R(null)},onBlur:()=>X(te,w),autoFocus:!0,style:{maxWidth:"170px",height:"24px"}}):a.jsx(ye,{weight:"bold",size:3,textOverflow:"ellipsis",style:{maxWidth:"170px",cursor:"pointer",padding:"4px 0"},title:T[te._key]||te.title||te._key.slice(te._key.length-5,te._key.length),onClick:()=>{R(te._key),E(te.title||te._key.slice(0,5))},children:T[te._key]||te.title||te._key.slice(te._key.length-5,te._key.length)}),We&&a.jsx(ue,{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"var(--card-focus-ring-color)"}})]}),a.jsx(Jn,{button:a.jsx(Wn,{}),id:`${te._key}-menu`,menu:a.jsx(Qn,{children:a.jsx(Un,{tone:"critical",padding:3,icon:Hn,text:c("action.delete"),onClick:Ce=>{Ce.stopPropagation(),B(te._key)}})}),popover:{portal:!0,placement:"bottom-end",tone:"default"}})]}),a.jsx(Eu,{muted:!0,children:G?.query.split("{")[0]}),a.jsx(ge,{align:"center",gap:1,children:a.jsx(ye,{size:1,muted:!0,children:h.format(new Date(te.savedAt||""))})}),We&&a.jsx(Pe,{mode:"ghost",tone:"default",size:1,padding:2,style:{height:"24px",position:"absolute",right:"16px",bottom:"16px",fontSize:"12px"},text:c("action.update"),onClick:Ce=>{Ce.stopPropagation(),re(te)}})]})},te._key)}),e[27]=o,e[28]=n,e[29]=B,e[30]=b,e[31]=w,e[32]=h,e[33]=r,e[34]=I,e[35]=X,e[36]=re,e[37]=T,e[38]=D,e[39]=F,e[40]=g,e[41]=x,e[42]=l,e[43]=c,e[44]=z,e[45]=W,e[46]=oe,e[47]=f,e[48]=j}else z=e[44],W=e[45],oe=e[46],f=e[47],j=e[48];let N;e[72]!==z||e[73]!==oe||e[74]!==f?(N=a.jsx(z,{paddingY:oe,children:f}),e[72]=z,e[73]=oe,e[74]=f,e[75]=N):N=e[75];let $;return e[76]!==W||e[77]!==j||e[78]!==N?($=a.jsxs(W,{children:[j,N]}),e[76]=W,e[77]=j,e[78]=N,e[79]=$):$=e[79],$}function Cr(){return typeof window<"u"&&window.innerWidth>600}function hn(t){let e=t;return e||(e=typeof window<"u"&&typeof document<"u"?document.body.getBoundingClientRect().height-60:0),{defaultSize:e/(Cr()?2:1),size:e>550?void 0:e*.4,allowResize:e>550,minSize:Math.min(170,Math.max(170,e/2)),maxSize:e>650?e*.7:e*.6}}function qs(t){const e=le.c(6),{visionRootRef:u}=t,[r,l]=O.useState(Qs),[n,o]=O.useState(Js);let i,s;e[0]!==u?(i=()=>{if(!u.current)return;const C=B=>{l(Cr());const F=B?.[0];F&&o(hn(F.contentRect.height))},D=new ResizeObserver(C);return D.observe(u.current),()=>{D.disconnect()}},s=[u],e[0]=u,e[1]=i,e[2]=s):(i=e[1],s=e[2]),O.useEffect(i,s);let d;return e[3]!==r||e[4]!==n?(d={paneSizeOptions:n,isNarrowBreakpoint:r},e[3]=r,e[4]=n,e[5]=d):d=e[5],d}function Js(){return hn(void 0)}function Qs(){return Cr()}function Us(t){const e=le.c(30),{hasValidParams:u,listenInProgress:r,queryInProgress:l,onQueryExecution:n,onListenExecution:o}=t,{t:i}=Je(Qe);let s;e[0]!==i?(s=i("params.error.params-invalid-json"),e[0]=i,e[1]=s):s=e[1];let d;e[2]!==s?(d=a.jsx(De,{radius:4,children:a.jsx(ye,{size:1,muted:!0,children:s})}),e[2]=s,e[3]=d):d=e[3];let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C=a.jsx(De,{radius:4,children:a.jsx($n,{keys:["Ctrl","Enter"]})}),e[4]=C):C=e[4];const D=l?Ar:Er,B=r||!u,F=l?"positive":"primary";let y;e[5]!==l||e[6]!==i?(y=i(l?"action.query-cancel":"action.query-execute"),e[5]=l,e[6]=i,e[7]=y):y=e[7];let c;e[8]!==n||e[9]!==D||e[10]!==B||e[11]!==F||e[12]!==y?(c=a.jsx(ue,{flex:1,children:a.jsx(Ot,{content:C,placement:"top",portal:!0,children:a.jsx(Pe,{width:"fill",onClick:n,type:"button",icon:D,disabled:B,tone:F,text:y})})}),e[8]=n,e[9]=D,e[10]=B,e[11]=F,e[12]=y,e[13]=c):c=e[13];const m=r?Ar:Er;let h;e[14]!==r||e[15]!==i?(h=i(r?"action.listen-cancel":"action.listen-execute"),e[14]=r,e[15]=i,e[16]=h):h=e[16];const b=!u,R=r?"positive":"default";let w;e[17]!==o||e[18]!==h||e[19]!==b||e[20]!==R||e[21]!==m?(w=a.jsx(ue,{flex:1,marginLeft:3,children:a.jsx(Pe,{width:"fill",onClick:o,type:"button",icon:m,text:h,mode:"ghost",disabled:b,tone:R})}),e[17]=o,e[18]=h,e[19]=b,e[20]=R,e[21]=m,e[22]=w):w=e[22];let E;e[23]!==w||e[24]!==c?(E=a.jsxs(ge,{justify:"space-evenly",children:[c,w]}),e[23]=w,e[24]=c,e[25]=E):E=e[25];let P;return e[26]!==u||e[27]!==E||e[28]!==d?(P=a.jsx(Os,{children:a.jsx(De,{padding:3,paddingX:3,children:a.jsx(Ot,{content:d,placement:"top",disabled:u,portal:!0,children:E})})}),e[26]=u,e[27]=E,e[28]=d,e[29]=P):P=e[29],P}const Hs=ne(ue).withConfig({displayName:"PerspectivePopoverContent",componentId:"sc-ls0jfp-0"})`max-width:240px;`,Ws=ne.a.withConfig({displayName:"PerspectivePopoverLink",componentId:"sc-ls0jfp-1"})`cursor:pointer;margin-right:auto;`,Ks=ne.div.withConfig({displayName:"Dot",componentId:"sc-y1ykk8-0"})`width:4px;height:4px;border-radius:3px;box-shadow:0 0 0 1px var(--card-bg-color);background-color:${({$tone:t})=>`var(--card-badge-${t}-dot-color)`};`;function Ys(){const t=le.c(39),[e,u]=O.useState(!1),r=O.useRef(null),l=O.useRef(null);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>u(Xs),t[0]=n):n=t[0];const o=n,{t:i}=Je(Qe);let s,d;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>u(!1),d=()=>[r.current,l.current],t[1]=s,t[2]=d):(s=t[1],d=t[2]),ii(s,d);let C;t[3]!==i?(C=i("settings.perspectives.title"),t[3]=i,t[4]=C):C=t[4];let D;t[5]!==C?(D=a.jsx(Gr,{space:2,children:a.jsx(ye,{weight:"medium",children:C})}),t[5]=C,t[6]=D):D=t[6];let B;t[7]!==i?(B=i("settings.perspectives.description"),t[7]=i,t[8]=B):B=t[8];let F;t[9]!==B?(F=a.jsx(De,{children:a.jsx(ye,{muted:!0,children:B})}),t[9]=B,t[10]=F):F=t[10];let y;t[11]!==i?(y=i("label.new"),t[11]=i,t[12]=y):y=t[12];let c;t[13]!==y?(c=a.jsx(ue,{children:a.jsx(ai,{tone:"primary",children:y})}),t[13]=y,t[14]=c):c=t[14];let m;t[15]!==i?(m=a.jsx(ye,{muted:!0,children:a.jsx(Zr,{t:i,i18nKey:"settings.perspective.preview-drafts-renamed-to-drafts.description"})}),t[15]=i,t[16]=m):m=t[16];let h;t[17]!==c||t[18]!==m?(h=a.jsx(De,{children:a.jsxs(Ee,{space:2,children:[c,m]})}),t[17]=c,t[18]=m,t[19]=h):h=t[19];let b;t[20]!==i?(b=null,t[20]=i,t[21]=b):b=t[21];let R;t[22]!==i?(R=i("settings.perspectives.action.docs-link"),t[22]=i,t[23]=R):R=t[23];let w;t[24]!==R?(w=a.jsx(De,{children:a.jsx(ye,{children:a.jsxs(Ws,{href:"https://www.sanity.io/docs/perspectives",target:"_blank",children:[R," →"]})})}),t[24]=R,t[25]=w):w=t[25];let E;t[26]!==h||t[27]!==b||t[28]!==w||t[29]!==D||t[30]!==F?(E=a.jsx(Hs,{children:a.jsxs(Ee,{space:4,children:[D,F,h,b,w]})}),t[26]=h,t[27]=b,t[28]=w,t[29]=D,t[30]=F,t[31]=E):E=t[31];let P;t[32]===Symbol.for("react.memo_cache_sentinel")?(P=a.jsx(Ks,{$tone:"primary"}),t[32]=P):P=t[32];let T;t[33]!==e?(T=a.jsx(Pe,{icon:oi,mode:"bleed",padding:2,paddingRight:1,tone:"primary",fontSize:1,ref:r,onClick:o,selected:e,children:P}),t[33]=e,t[34]=T):T=t[34];let H;return t[35]!==e||t[36]!==E||t[37]!==T?(H=a.jsx(si,{content:E,placement:"bottom-start",portal:!0,padding:3,ref:l,open:e,children:T}),t[35]=e,t[36]=E,t[37]=T,t[38]=H):H=t[38],H}function Xs(t){return!t}const Gs=t=>{const e=le.c(11),{pinnedPerspective:u,t:r}=t,l=typeof u.selectedPerspective=="object"?u.selectedPerspective.metadata.title:u.selectedPerspectiveName;let n;e[0]!==u||e[1]!==r?(n=qr(u)?`(${r("settings.perspectives.pinned-release-label")})`:r("settings.perspectives.pinned-release-label"),e[0]=u,e[1]=r,e[2]=n):n=e[2];const o=n;let i;e[3]!==o||e[4]!==l?(i=[l,o].filter(ua),e[3]=o,e[4]=l,e[5]=i):i=e[5];const s=i.join(" ");let d;e[6]!==u?(d=qr(u),e[6]=u,e[7]=d):d=e[7];const C=!d;let D;return e[8]!==C||e[9]!==s?(D=a.jsx("option",{value:"pinnedRelease",disabled:C,children:s}),e[8]=C,e[9]=s,e[10]=D):D=e[10],D};function Zs(t){const e=le.c(65),{onChangeDataset:u,dataset:r,customApiVersion:l,apiVersion:n,onChangeApiVersion:o,datasets:i,customApiVersionElementRef:s,onCustomApiVersionChange:d,isValidApiVersion:C,onChangePerspective:D,url:B,perspective:F,isScheduledDraftsEnabled:y}=t,c=Yr(),{t:m}=Je(Qe),h=O.useRef(null);let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=()=>{const q=h.current;if(q)try{q.select(),document.execCommand("copy")}catch{console.error("Unable to copy to clipboard :(")}},e[0]=b):b=e[0];const R=b;let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w=[1,4,8,12],e[1]=w):w=e[1];let E;e[2]!==m?(E=m("settings.dataset-label"),e[2]=m,e[3]=E):E=e[3];let P;e[4]!==E?(P=a.jsx(De,{paddingTop:2,paddingBottom:3,children:a.jsx(Ve,{children:E})}),e[4]=E,e[5]=P):P=e[5];let T;e[6]!==i?(T=i.map(ta),e[6]=i,e[7]=T):T=e[7];let H;e[8]!==r||e[9]!==u||e[10]!==T?(H=a.jsx(Uu,{value:r,onChange:u,children:T}),e[8]=r,e[9]=u,e[10]=T,e[11]=H):H=e[11];let g;e[12]!==P||e[13]!==H?(g=a.jsx(ue,{padding:1,column:2,children:a.jsxs(Ee,{children:[P,H]})}),e[12]=P,e[13]=H,e[14]=g):g=e[14];let p;e[15]!==m?(p=m("settings.api-version-label"),e[15]=m,e[16]=p):p=e[16];let x;e[17]!==p?(x=a.jsx(De,{paddingTop:2,paddingBottom:3,children:a.jsx(Ve,{children:p})}),e[17]=p,e[18]=x):x=e[18];const S=l===!1?n:"other";let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=Pt.map(ea),e[19]=v):v=e[19];let I;e[20]!==m?(I=m("settings.other-api-version-label"),e[20]=m,e[21]=I):I=e[21];let Y;e[22]!==I?(Y=a.jsx("option",{value:"other",children:I},"other"),e[22]=I,e[23]=Y):Y=e[23];let X;e[24]!==o||e[25]!==S||e[26]!==Y?(X=a.jsxs(Uu,{"data-testid":"api-version-selector",value:S,onChange:o,children:[v,Y]}),e[24]=o,e[25]=S,e[26]=Y,e[27]=X):X=e[27];let M;e[28]!==X||e[29]!==x?(M=a.jsx(ue,{padding:1,column:2,children:a.jsxs(Ee,{children:[x,X]})}),e[28]=X,e[29]=x,e[30]=M):M=e[30];let re;e[31]!==l||e[32]!==s||e[33]!==C||e[34]!==d||e[35]!==m?(re=l!==!1&&a.jsx(ue,{padding:1,column:2,children:a.jsxs(Ee,{children:[a.jsx(De,{paddingTop:2,paddingBottom:3,children:a.jsx(Ve,{textOverflow:"ellipsis",children:m("settings.custom-api-version-label")})}),a.jsx(Cu,{ref:s,value:l,onChange:d,customValidity:C?void 0:m("settings.error.invalid-api-version"),maxLength:11})]})}),e[31]=l,e[32]=s,e[33]=C,e[34]=d,e[35]=m,e[36]=re):re=e[36];let z;e[37]!==m?(z=m("settings.perspective-label"),e[37]=m,e[38]=z):z=e[38];let W;e[39]!==z?(W=a.jsx(ue,{children:a.jsx(Ve,{children:z})}),e[39]=z,e[40]=W):W=e[40];let oe;e[41]===Symbol.for("react.memo_cache_sentinel")?(oe=a.jsx(ue,{children:a.jsx(Ys,{})}),e[41]=oe):oe=e[41];let f;e[42]!==W?(f=a.jsx(De,{paddingBottom:1,children:a.jsxs(Gr,{space:1,children:[W,oe]})}),e[42]=W,e[43]=f):f=e[43];const j=F||"default";let N;e[44]!==y||e[45]!==c||e[46]!==m?(N=ln.map(q=>q==="pinnedRelease"?a.jsxs(O.Fragment,{children:[a.jsx(Gs,{pinnedPerspective:c,t:m}),a.jsx("option",{value:"default",children:m("settings.perspectives.default")},"default"),a.jsx("hr",{})]},"pinnedRelease"):q==="scheduledDrafts"?y?a.jsx("option",{value:"scheduledDrafts",children:m("settings.perspectives.scheduled-drafts")},"scheduledDrafts"):null:a.jsx("option",{children:q},q)),e[44]=y,e[45]=c,e[46]=m,e[47]=N):N=e[47];let $;e[48]!==D||e[49]!==j||e[50]!==N?($=a.jsx(Uu,{value:j,onChange:D,children:N}),e[48]=D,e[49]=j,e[50]=N,e[51]=$):$=e[51];let Q;e[52]!==f||e[53]!==$?(Q=a.jsx(ue,{padding:1,column:2,children:a.jsxs(Ee,{children:[f,$]})}),e[52]=f,e[53]=$,e[54]=Q):Q=e[54];let ee;e[55]!==l||e[56]!==m||e[57]!==B?(ee=typeof B=="string"?a.jsx(ue,{padding:1,flex:1,column:l===!1?6:4,children:a.jsxs(Ee,{children:[a.jsx(De,{paddingTop:2,paddingBottom:3,children:a.jsxs(Ve,{children:[m("query.url")," ",a.jsxs(xs,{onClick:R,children:["[",m("action.copy-url-to-clipboard"),"]"]})]})}),a.jsxs(ge,{flex:1,gap:1,children:[a.jsx(ue,{flex:1,children:a.jsx(Cu,{readOnly:!0,type:"url",ref:h,value:B})}),a.jsx(Ot,{content:m("action.copy-url-to-clipboard"),children:a.jsx(Pe,{"aria-label":m("action.copy-url-to-clipboard"),type:"button",mode:"ghost",icon:Mn,onClick:R})})]})]})}):a.jsx(ue,{flex:1}),e[55]=l,e[56]=m,e[57]=B,e[58]=ee):ee=e[58];let V;return e[59]!==M||e[60]!==re||e[61]!==Q||e[62]!==ee||e[63]!==g?(V=a.jsx(ys,{paddingX:3,paddingY:2,children:a.jsxs(Vn,{columns:w,children:[g,M,re,Q,ee]})}),e[59]=M,e[60]=re,e[61]=Q,e[62]=ee,e[63]=g,e[64]=V):V=e[64],V}function ea(t){return a.jsx("option",{children:t},t)}function ta(t){return a.jsx("option",{children:t},t)}function ua(t){return typeof t<"u"}function ra(t,e){return URL.createObjectURL(new Blob([t],{type:e}))}function Cn(t,e){return(()=>{let u="",r="";return l=>{const n=e(l);if(!(typeof n!="string"||n===""))return n===r||(r=n,u&&URL.revokeObjectURL(u),u=ra(n,t)),u}})()}const na=Cn("application/json",t=>JSON.stringify(t,null,2)),ia=Cn("text/csv",t=>is.json2csv(Array.isArray(t)?t:[t]).trim()),lr=ne(Eu).withConfig({displayName:"ErrorCode",componentId:"sc-14lyn64-0"})`color:${({theme:t})=>t.sanity.color.muted.critical.enabled.fg};`;function sa(t){const e=le.c(20),{error:u}=t,{t:r}=Je(Qe);if(!("details"in u))return null;const l=u.details;let n,o,i,s,d,C;if(e[0]!==u.details){C=Symbol.for("react.early_return_sentinel");e:{if(o={...l,...aa(u.details)},!o.line){C=null;break e}n=lr,d=1,i=o.line,s=oa(o.column,o.columnEnd)}e[0]=u.details,e[1]=n,e[2]=o,e[3]=i,e[4]=s,e[5]=d,e[6]=C}else n=e[1],o=e[2],i=e[3],s=e[4],d=e[5],C=e[6];if(C!==Symbol.for("react.early_return_sentinel"))return C;const D=`${i} +${s}`;let B;e[7]!==n||e[8]!==d||e[9]!==D?(B=a.jsx(n,{size:d,children:D}),e[7]=n,e[8]=d,e[9]=D,e[10]=B):B=e[10];let F;e[11]!==r?(F=r("query.error.line"),e[11]=r,e[12]=F):F=e[12];const y=o.lineNumber;let c;e[13]!==r?(c=r("query.error.column"),e[13]=r,e[14]=c):c=e[14];const m=`${F}: ${y} +${c}: ${o.column}`;let h;e[15]!==m?(h=a.jsx(ue,{marginTop:4,children:a.jsx(lr,{size:1,children:m})}),e[15]=m,e[16]=h):h=e[16];let b;return e[17]!==h||e[18]!==B?(b=a.jsxs("div",{children:[B,h]}),e[17]=h,e[18]=B,e[19]=b):b=e[19],b}function aa(t){if(!t||typeof t.query!="string"||typeof t.start!="number")return{};const{query:e,start:u,end:r}=t,l=e.slice(0,u).lastIndexOf(` +`)+1,n=(e.slice(0,l).match(/\n/g)||[]).length,o=e.slice(l,e.indexOf(` +`,l)),i=u-l,s=typeof r=="number"?r-l:void 0;return{line:o,lineNumber:n,column:i,columnEnd:s}}function oa(t,e){const u="-".repeat(t),r="^".repeat(e?e-t:1);return`${u}${r}`}function la(t){const e=le.c(7);let u;e[0]!==t.error.message?(u=a.jsx(lr,{size:1,children:t.error.message}),e[0]=t.error.message,e[1]=u):u=e[1];let r;e[2]!==t.error?(r=a.jsx(sa,{error:t.error}),e[2]=t.error,e[3]=r):r=e[3];let l;return e[4]!==u||e[5]!==r?(l=a.jsxs(Ee,{space:5,marginTop:2,children:[u,r]}),e[4]=u,e[5]=r,e[6]=l):l=e[6],l}const ca=ne.div.withConfig({displayName:"ResultViewWrapper",componentId:"sc-nbqtaq-0"})(({theme:t})=>{const{color:e,fonts:u,space:r}=t.sanity;return Xr` + & .json-inspector, + & .json-inspector .json-inspector__selection { + font-family: ${u.code.family}; + font-size: ${u.code.sizes[2].fontSize}px; + line-height: ${u.code.sizes[2].lineHeight}px; + color: var(--card-code-fg-color); + } + + & .json-inspector .json-inspector__leaf { + padding-left: ${Re(r[4])}; + } + + & .json-inspector .json-inspector__leaf.json-inspector__leaf_root { + padding-top: ${Re(r[0])}; + padding-left: 0; + } + + & .json-inspector > .json-inspector__leaf_root > .json-inspector__line > .json-inspector__key { + display: none; + } + + & .json-inspector .json-inspector__line { + display: block; + position: relative; + cursor: default; + } + + & .json-inspector .json-inspector__line::after { + content: ''; + position: absolute; + top: 0; + left: -200px; + right: -50px; + bottom: 0; + z-index: -1; + pointer-events: none; + } + + & .json-inspector .json-inspector__line:hover::after { + background: var(--card-code-bg-color); + } + + & .json-inspector .json-inspector__leaf_composite > .json-inspector__line { + cursor: pointer; + } + + & .json-inspector .json-inspector__leaf_composite > .json-inspector__line::before { + content: '▸ '; + margin-left: calc(0px - ${Re(r[4])}); + font-size: ${u.code.sizes[2].fontSize}px; + line-height: ${u.code.sizes[2].lineHeight}px; + } + + & + .json-inspector + .json-inspector__leaf_expanded.json-inspector__leaf_composite + > .json-inspector__line::before { + content: '▾ '; + font-size: ${u.code.sizes[2].fontSize}px; + line-height: ${u.code.sizes[2].lineHeight}px; + } + + & .json-inspector .json-inspector__radio, + & .json-inspector .json-inspector__flatpath { + display: none; + } + + & .json-inspector .json-inspector__value { + margin-left: ${Re(r[4]/2)}; + } + + & + .json-inspector + > .json-inspector__leaf_root + > .json-inspector__line + > .json-inspector__key + + .json-inspector__value { + margin: 0; + } + + & .json-inspector .json-inspector__key { + color: ${e.syntax.property}; + } + + & .json-inspector .json-inspector__value_helper, + & .json-inspector .json-inspector__value_null { + color: ${e.syntax.constant}; + } + + & .json-inspector .json-inspector__not-found { + padding-top: ${Re(r[2])}; + } + + & .json-inspector .json-inspector__value_string { + color: ${e.syntax.string}; + word-break: break-word; + } + + & .json-inspector .json-inspector__value_boolean { + color: ${e.syntax.boolean}; + } + + & .json-inspector .json-inspector__value_number { + color: ${e.syntax.number}; + } + + & .json-inspector .json-inspector__show-original { + display: inline-block; + padding: 0 6px; + cursor: pointer; + } + + & .json-inspector .json-inspector__show-original:hover { + color: inherit; + } + + & .json-inspector .json-inspector__show-original::before { + content: '↔'; + } + + & .json-inspector .json-inspector__show-original:hover::after { + content: ' expand'; + } + `}),cr=new os({maxSize:5e4});function Ur(t){const e=le.c(7),{data:u,datasetName:r}=t,l=Kn();if(mn(u)||Array.isArray(u)){const i=l===r?da:void 0;let s;return e[0]!==u||e[1]!==i?(s=a.jsx(ca,{children:a.jsx(Yn,{data:u,search:!1,isExpanded:Da,onClick:fa,interactiveLabel:i})}),e[0]=u,e[1]=i,e[2]=s):s=e[2],s}let n;e[3]!==u?(n=JSON.stringify(u),e[3]=u,e[4]=n):n=e[4];let o;return e[5]!==n?(o=a.jsx(Eu,{language:"json",children:n}),e[5]=n,e[6]=o):o=e[6],o}function da(t){const e=le.c(5);if(t.isKey||!t.keypath.endsWith("_id")&&!t.keypath.endsWith("_ref"))return null;let u;e[0]!==t.value?(u={id:t.value},e[0]=t.value,e[1]=u):u=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=a.jsx(ni,{}),e[2]=r):r=e[2];let l;return e[3]!==u?(l=a.jsx(Gn,{intent:"edit",params:u,children:r}),e[3]=u,e[4]=l):l=e[4],l}function Da(t,e){const u=cr.get(t);if(typeof u=="boolean")return u;const r=t.split(".",4);return r.length===4?!1:Array.isArray(e)?!0:mn(e)&&!r.some(l=>ha(l))}function fa(t){const{path:e}=t,u=cr.get(e);u!==void 0&&cr.set(e,!u)}function mn(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}const pa=/^\d+$/;function ha(t,e=10){return pa.test(t)&&parseInt(t,10)>e}function Ca(t){return t.preventDefault()}function ma(t){const e=le.c(9),{blobUrl:u}=t,{t:r}=Je(Qe),l=!u,n=l?void 0:"query-result.csv",o=l?Ca:void 0;let i;e[0]!==u||e[1]!==l||e[2]!==n||e[3]!==o?(i=a.jsx(Pe,{as:"a",disabled:l,download:n,href:u,icon:en,mode:"ghost",onClick:o,text:"CSV",tone:"default"}),e[0]=u,e[1]=l,e[2]=n,e[3]=o,e[4]=i):i=e[4];const s=i;let d;return e[5]!==s||e[6]!==l||e[7]!==r?(d=l?a.jsx(Ot,{content:r("result.save-result-as-csv.not-csv-encodable"),placement:"top",children:s}):s,e[5]=s,e[6]=l,e[7]=r,e[8]=d):d=e[8],d}function Fa(t){const e=le.c(2),{blobUrl:u}=t;let r;return e[0]!==u?(r=a.jsx(Pe,{as:"a",download:"query-result.json",href:u,icon:en,mode:"ghost",text:"JSON",tone:"default"}),e[0]=u,e[1]=r):r=e[1],r}function Aa(t){const e=le.c(67),{error:u,queryInProgress:r,queryResult:l,listenInProgress:n,listenMutations:o,dataset:i,queryTime:s,e2eTime:d}=t,{t:C}=Je(Qe),D=!u&&!r&&typeof l<"u";let B;e[0]!==D||e[1]!==l?(B=D?na(l):"",e[0]=D,e[1]=l,e[2]=B):B=e[2];const F=B;let y;e[3]!==D||e[4]!==l?(y=D?ia(l):"",e[3]=D,e[4]=l,e[5]=y):y=e[5];const c=y,m=u?"critical":"default",h=!!u;let b;e[6]!==C?(b=C("result.label"),e[6]=C,e[7]=b):b=e[7];let R;e[8]!==b?(R=a.jsx(fn,{children:a.jsx(ue,{marginLeft:3,children:a.jsx(Ve,{muted:!0,children:b})})}),e[8]=b,e[9]=R):R=e[9];let w;e[10]!==n||e[11]!==o||e[12]!==r?(w=(r||n&&o.length===0)&&a.jsx(ue,{marginTop:3,children:a.jsx(on,{})}),e[10]=n,e[11]=o,e[12]=r,e[13]=w):w=e[13];let E;e[14]!==u?(E=u&&a.jsx(la,{error:u}),e[14]=u,e[15]=E):E=e[15];let P;e[16]!==i||e[17]!==D||e[18]!==l?(P=D&&a.jsx(Ur,{data:l,datasetName:i}),e[16]=i,e[17]=D,e[18]=l,e[19]=P):P=e[19];let T;e[20]!==i||e[21]!==n||e[22]!==o?(T=n&&o.length>0&&a.jsx(Ur,{data:o,datasetName:i}),e[20]=i,e[21]=n,e[22]=o,e[23]=T):T=e[23];let H;e[24]!==T||e[25]!==w||e[26]!==E||e[27]!==P?(H=a.jsxs(ue,{padding:3,paddingTop:5,children:[w,E,P,T]}),e[24]=T,e[25]=w,e[26]=E,e[27]=P,e[28]=H):H=e[28];let g;e[29]!==H||e[30]!==R?(g=a.jsxs(ws,{overflow:"auto",children:[R,H]}),e[29]=H,e[30]=R,e[31]=g):g=e[31];let p;e[32]!==g||e[33]!==m||e[34]!==h?(p=a.jsx(bs,{flex:1,children:a.jsx(Ss,{flex:1,overflow:"hidden",tone:m,$isInvalid:h,children:g})}),e[32]=g,e[33]=m,e[34]=h,e[35]=p):p=e[35];let x;e[36]===Symbol.for("react.memo_cache_sentinel")?(x=["column","column","row"],e[36]=x):x=e[36];let S;e[37]!==C?(S=C("result.execution-time-label"),e[37]=C,e[38]=S):S=e[38];let v;e[39]!==s||e[40]!==C?(v=typeof s=="number"?`${s}ms`:C("result.timing-not-applicable"),e[39]=s,e[40]=C,e[41]=v):v=e[41];let I;e[42]!==S||e[43]!==v?(I=a.jsx(ue,{children:a.jsxs(ye,{muted:!0,children:[S,":"," ",v]})}),e[42]=S,e[43]=v,e[44]=I):I=e[44];let Y;e[45]!==C?(Y=C("result.end-to-end-time-label"),e[45]=C,e[46]=Y):Y=e[46];let X;e[47]!==d||e[48]!==C?(X=typeof d=="number"?`${d}ms`:C("result.timing-not-applicable"),e[47]=d,e[48]=C,e[49]=X):X=e[49];let M;e[50]!==Y||e[51]!==X?(M=a.jsx(ue,{marginLeft:4,children:a.jsxs(ye,{muted:!0,children:[Y,":"," ",X]})}),e[50]=Y,e[51]=X,e[52]=M):M=e[52];let re;e[53]!==I||e[54]!==M?(re=a.jsx(_s,{paddingX:4,paddingY:3,sizing:"border",children:a.jsxs(Rs,{align:"center",children:[I,M]})}),e[53]=I,e[54]=M,e[55]=re):re=e[55];let z;e[56]!==c||e[57]!==D||e[58]!==F||e[59]!==C?(z=D&&a.jsx(zs,{paddingX:4,paddingY:3,sizing:"border",children:a.jsx(Ps,{muted:!0,children:a.jsx(Zr,{components:{SaveResultButtons:()=>a.jsxs(a.Fragment,{children:[a.jsx(Fa,{blobUrl:F}),a.jsx(ma,{blobUrl:c})]})},i18nKey:"result.save-result-as-format",t:C})})}),e[56]=c,e[57]=D,e[58]=F,e[59]=C,e[60]=z):z=e[60];let W;e[61]!==re||e[62]!==z?(W=a.jsxs(js,{justify:"space-between",direction:x,children:[re,z]}),e[61]=re,e[62]=z,e[63]=W):W=e[63];let oe;return e[64]!==p||e[65]!==W?(oe=a.jsxs(Bs,{direction:"column","data-testid":"vision-result",children:[p,W]}),e[64]=p,e[65]=W,e[66]=oe):oe=e[66],oe}function Ea(t,e){return!t||!e?!1:t===e||!!(t.compareDocumentPosition(e)&16)}const ga=/\/(vX|v1|v\d{4}-\d\d-\d\d)\/.*?(?:query|listen)\/(.*?)\?(.*)/,ya=t=>gr("ctrl+enter",t)||gr("mod+enter",t);function va(t){const e=le.c(210),{datasets:u,config:r,projectId:l,defaultDataset:n}=t,o=Kr(),{t:i}=Je(Qe),{perspectiveStack:s}=Yr(),d=jn(),{data:C}=_n();let D;e[0]!==C?(D=C===void 0?[]:C,e[0]=C,e[1]=D):D=e[1];const B=D,F=Rn().document.drafts.enabled,y=O.useRef(null),c=O.useRef(null),m=O.useRef(null),h=O.useRef(null),b=O.useRef(void 0),R=O.useRef(void 0);let w;e[2]!==l?(w=()=>ms(l||"default"),e[2]=l,e[3]=w):w=e[3];const[E]=O.useState(w);let P;e[4]!==n||e[5]!==E?(P=E.get("dataset",n),e[4]=n,e[5]=E,e[6]=P):P=e[6];const T=P;let H;e[7]!==r.defaultApiVersion||e[8]!==E?(H=E.get("apiVersion",Es(`${r.defaultApiVersion}`)),e[7]=r.defaultApiVersion,e[8]=E,e[9]=H):H=e[9];const g=H;let p;e[10]!==E?(p=E.get("query",""),e[10]=E,e[11]=p):p=e[11];const x=p;let S;e[12]!==E?(S=E.get("params",`{ + +}`),e[12]=E,e[13]=S):S=e[13];const v=S;let I;e[14]!==E?(I=E.get("perspective",void 0),e[14]=E,e[15]=I):I=e[15];const Y=I;let X;e[16]!==u||e[17]!==n||e[18]!==T?(X=()=>u.includes(T)?T:u.includes(n)?n:u[0],e[16]=u,e[17]=n,e[18]=T,e[19]=X):X=e[19];const[M,re]=O.useState(X);let z;e[20]!==g?(z=()=>Pt.includes(g)?g:an,e[20]=g,e[21]=z):z=e[21];const[W,oe]=O.useState(z);let f;e[22]!==g?(f=()=>Pt.includes(g)?!1:g,e[22]=g,e[23]=f):f=e[23];const[j,N]=O.useState(f),[$,Q]=O.useState(Y||"raw");let ee;e[24]!==j?(ee=j?ur(j):!0,e[24]=j,e[25]=ee):ee=e[25];const V=ee,[q,fe]=O.useState(void 0);let he;e[26]!==x?(he=()=>typeof x=="string"?x:"",e[26]=x,e[27]=he):he=e[27];const[ie,Oe]=O.useState(he),[Ue,Ie]=O.useState(v);let te;e[28]!==Ue||e[29]!==i?(te=Qr(Ue,i),e[28]=Ue,e[29]=i,e[30]=te):te=e[30];const G=te,[et,yt]=O.useState(void 0);let We;e[31]===Symbol.for("react.memo_cache_sentinel")?(We=[],e[31]=We):We=e[31];const[Ce,yu]=O.useState(We),[vu,vt]=O.useState(void 0),[xu,Bu]=O.useState(void 0),[bu,Su]=O.useState(void 0),[Ne,xt]=O.useState(!1),[ke,It]=O.useState(!1),[Ke,Fn]=O.useState(!1);let Nt;e[32]===Symbol.for("react.memo_cache_sentinel")?(Nt={visionRootRef:m},e[32]=Nt):Nt=e[32];const{paneSizeOptions:ve,isNarrowBreakpoint:wu}=qs(Nt);let ju;e:{if(!d){ju=void 0;break e}let _;if(e[33]!==F||e[34]!==B){const k=B.filter(Ba),me=zn(k).map(xa);let be;e[36]!==F?(be=F?["drafts"]:["published"],e[36]=F,e[37]=be):be=e[37];const wt=be;_=[...me,...wt],e[33]=F,e[34]=B,e[35]=_}else _=e[35];ju=_}const $e=ju,_u=V&&j?j:W;let kt;e[38]!==_u?(kt={apiVersion:_u},e[38]=_u,e[39]=kt):kt=e[39];const Ru=dr(kt);let $t;e[40]!==Ru||e[41]!==W||e[42]!==j||e[43]!==M||e[44]!==V||e[45]!==$||e[46]!==s||e[47]!==$e?($t=Ru.withConfig({apiVersion:V&&j?j:W,perspective:er({visionPerspective:$,perspectiveStack:s,scheduledDraftsStack:$e}),dataset:M,allowReconfigure:!0}),e[40]=Ru,e[41]=W,e[42]=j,e[43]=M,e[44]=V,e[45]=$,e[46]=s,e[47]=$e,e[48]=$t):$t=e[48];const Be=$t;let Lt;e[49]===Symbol.for("react.memo_cache_sentinel")?(Lt=()=>{b.current&&(b.current.unsubscribe(),b.current=void 0)},e[49]=Lt):Lt=e[49];const Tt=Lt;let Mt;e[50]===Symbol.for("react.memo_cache_sentinel")?(Mt=()=>{R.current&&(R.current.unsubscribe(),R.current=void 0)},e[50]=Mt):Mt=e[50];const Bt=Mt;let Vt;e[51]!==W||e[52]!==Be||e[53]!==j||e[54]!==M||e[55]!==V||e[56]!==E||e[57]!==G.parsed||e[58]!==$||e[59]!==s||e[60]!==ie||e[61]!==Ne||e[62]!==$e||e[63]!==i?(Vt=_=>{if(Ne){Tt(),Bt(),xt(!1);return}const k={query:_?.query||ie,dataset:_?.dataset||M,params:Qr(JSON.stringify(_?.params||G.parsed,null,2),i),perspective:er({visionPerspective:_&&"perspective"in _?_.perspective:$,perspectiveStack:s,scheduledDraftsStack:$e}),apiVersion:_?.apiVersion||(j&&V?j:W)};if(E.set("query",k.query),E.set("params",k.params.raw),Bt(),xt(!k.params.error&&!!k.query),It(!1),yu([]),vt(k.params.error?new Error(k.params.error):void 0),yt(void 0),Bu(void 0),Su(void 0),k.params.error)return;const me={perspective:k.perspective??[]},be=Be.withConfig({apiVersion:k.apiVersion,dataset:k.dataset,perspective:k.perspective}),wt=be.getUrl(be.getDataUrl("query",tr(k.query,k.params.parsed,me)));fe(wt);const Ju=Date.now();b.current=be.observable.fetch(k.query,k.params.parsed,{filterResponse:!1,tag:"vision"}).subscribe({next:Ae=>{Bu(Ae.ms),Su(Date.now()-Ju),yt(Ae.result),xt(!1),vt(void 0)},error:Ae=>{vt(Ae),xt(!1)}})},e[51]=W,e[52]=Be,e[53]=j,e[54]=M,e[55]=V,e[56]=E,e[57]=G.parsed,e[58]=$,e[59]=s,e[60]=ie,e[61]=Ne,e[62]=$e,e[63]=i,e[64]=Vt):Vt=e[64];const ce=Vt;let qt;e[65]!==ce||e[66]!==E?(qt=_=>{_!==void 0&&!Zu(_)||(Q(_),E.set("perspective",_),ce({perspective:_}))},e[65]=ce,e[66]=E,e[67]=qt):qt=e[67];const tt=qt;let Jt;e[68]!==ce||e[69]!==E?(Jt=_=>{const k=_.target.value;E.set("dataset",k),re(k),ce({dataset:k})},e[68]=ce,e[69]=E,e[70]=Jt):Jt=e[70];const zu=Jt;let Qt;e[71]!==ce||e[72]!==E?(Qt=_=>{const k=_.target.value;if(k?.toLowerCase()==="other"){N("v"),h.current?.focus();return}oe(k),N(!1),E.set("apiVersion",k),ce({apiVersion:k})},e[71]=ce,e[72]=E,e[73]=Qt):Qt=e[73];const Pu=Qt;let Ut;e[74]!==ce||e[75]!==E?(Ut=_=>{const k=_.target.value||"";N(k||"v"),ur(k)&&(oe(k),E.set("apiVersion",k),ce({apiVersion:k}))},e[74]=ce,e[75]=E,e[76]=Ut):Ut=e[76];const Ou=Ut;let Ht;e[77]!==tt?(Ht=_=>{const k=_.target.value;tt(k==="default"?void 0:k)},e[77]=tt,e[78]=Ht):Ht=e[78];const Iu=Ht;let Wt;e[79]===Symbol.for("react.memo_cache_sentinel")?(Wt=_=>{_.type==="mutation"&&yu(k=>k.length===50?[_,...k.slice(0,49)]:[_,...k])},e[79]=Wt):Wt=e[79];const An=Wt;let Kt;e[80]!==Be||e[81]!==ke||e[82]!==E||e[83]!==G.error||e[84]!==G.parsed||e[85]!==G.raw||e[86]!==ie?(Kt=()=>{if(ke){Bt(),It(!1);return}const _=Be.getDataUrl("listen",tr(ie,G.parsed,{})),k=!G.error&&ie.trim().length>0;E.set("query",ie),E.set("params",G.raw),Tt(),fe(_),yu([]),xt(!1),yt(void 0),It(k),vt(G.error?new Error(G.error):void 0),Bu(void 0),Su(void 0),k&&(R.current=Be.listen(ie,G.parsed,{events:["mutation","welcome"],includeAllVersions:!0}).subscribe({next:An,error:me=>{vt(me),It(!1)}}))},e[80]=Be,e[81]=ke,e[82]=E,e[83]=G.error,e[84]=G.parsed,e[85]=G.raw,e[86]=ie,e[87]=Kt):Kt=e[87];const Nu=Kt;let Yt;e[88]!==E?(Yt=_=>{Ie(_),E.set("params",_)},e[88]=E,e[89]=Yt):Yt=e[89];const ku=Yt;let Xt;e[90]!==W||e[91]!==M||e[92]!==u||e[93]!==$||e[94]!==o?(Xt=_=>{const k=_.match(ga);if(!k)return null;const[,me,be,wt]=k,Ju=new URLSearchParams(wt),Ae=As(Ju);if(!Ae)return null;let mr,Qu;ur(me)&&(Pt.includes(me)?(mr=me,Qu=!1):Qu=me);const Fr=Zu(Ae.options.perspective)&&!Vr(Ae.options.perspective)?Ae.options.perspective:void 0;return Fr&&(!Zu(Ae.options.perspective)||Vr(Ae.options.perspective))&&o.push({closable:!0,id:"vision-paste-unsupported-perspective",status:"warning",title:'Perspective in pasted url is currently not supported. Falling back to "raw"'}),{query:Ae.query,params:Ae.params,rawParams:JSON.stringify(Ae.params,null,2),dataset:u.includes(be)?be:M,apiVersion:mr||W,customApiVersion:Qu,perspective:Fr||$,url:_}},e[90]=W,e[91]=M,e[92]=u,e[93]=$,e[94]=o,e[95]=Xt):Xt=e[95];const ut=Xt;let Gt;e[96]!==ce||e[97]!==E?(Gt=_=>{re(_.dataset),Oe(_.query),Ie(_.rawParams),oe(_.apiVersion),_.customApiVersion&&N(_.customApiVersion),Q(_.perspective),fe(_.url),y.current?.resetEditorContent(_.query),c.current?.resetEditorContent(_.rawParams),E.merge({query:_.query,params:_.rawParams,dataset:_.dataset,apiVersion:_.customApiVersion||_.apiVersion,perspective:_.perspective}),ce(_)},e[96]=ce,e[97]=E,e[98]=Gt):Gt=e[98];const rt=Gt;let Zt;e[99]!==ut||e[100]!==rt||e[101]!==o?(Zt=_=>{if(!_.clipboardData)return;const k=_.clipboardData.getData("text/plain");_.preventDefault();const me=ut(k);me&&(rt(me),o.push({closable:!0,id:"vision-paste",status:"info",title:"Parsed URL to query"}))},e[99]=ut,e[100]=rt,e[101]=o,e[102]=Zt):Zt=e[102];const bt=Zt;let eu;e[103]!==ce||e[104]!==G.valid?(eu=_=>{const k=m.current&&Ea(m.current,_.target);ya(_)&&k&&G.valid&&(ce(),_.preventDefault(),_.stopPropagation())},e[103]=ce,e[104]=G.valid,e[105]=eu):eu=e[105];const St=eu;let tu,uu;e[106]!==St||e[107]!==bt?(tu=()=>(window.document.addEventListener("paste",bt),window.document.addEventListener("keydown",St),()=>{window.document.removeEventListener("paste",bt),window.document.removeEventListener("keydown",St)}),uu=[St,bt],e[106]=St,e[107]=bt,e[108]=tu,e[109]=uu):(tu=e[108],uu=e[109]),O.useEffect(tu,uu);let ru,nu;e[110]===Symbol.for("react.memo_cache_sentinel")?(ru=()=>()=>{Tt(),Bt()},nu=[Tt,Bt],e[110]=ru,e[111]=nu):(ru=e[110],nu=e[111]),O.useEffect(ru,nu);let iu;e[112]!==tt?(iu=_=>{_.length>0&&tt("pinnedRelease")},e[112]=tt,e[113]=iu):iu=e[113];const $u=O.useEffectEvent(iu);let su;e[114]!==$u||e[115]!==s?(su=()=>{$u(s)},e[114]=$u,e[115]=s,e[116]=su):su=e[116];let au;e[117]!==s?(au=[s],e[117]=s,e[118]=au):au=e[118],O.useEffect(su,au);let ou;e[119]!==Be||e[120]!==$||e[121]!==s||e[122]!==$e?(ou=(_,k)=>{const me={perspective:er({visionPerspective:$,perspectiveStack:s,scheduledDraftsStack:$e})??[]};return Be.getUrl(Be.getDataUrl("query",tr(_,k,me)))},e[119]=Be,e[120]=$,e[121]=s,e[122]=$e,e[123]=ou):ou=e[123];const Lu=ou;let nt;e[124]!==W||e[125]!==j||e[126]!==M||e[127]!==u||e[128]!==Pu||e[129]!==zu||e[130]!==Iu||e[131]!==Ou||e[132]!==d||e[133]!==V||e[134]!==$||e[135]!==q?(nt=a.jsx(Zs,{apiVersion:W,customApiVersion:j,dataset:M,datasets:u,onChangeDataset:zu,onChangeApiVersion:Pu,customApiVersionElementRef:h,onCustomApiVersionChange:Ou,isValidApiVersion:V,onChangePerspective:Iu,url:q,perspective:$,isScheduledDraftsEnabled:d}),e[124]=W,e[125]=j,e[126]=M,e[127]=u,e[128]=Pu,e[129]=zu,e[130]=Iu,e[131]=Ou,e[132]=d,e[133]=V,e[134]=$,e[135]=q,e[136]=nt):nt=e[136];const Tu=Ke?window.innerWidth:window.innerWidth-275,Mu=wu?"vertical":"horizontal",Vu=wu?ve.defaultSize:ve.minSize,En=ve.size,gn=ve.allowResize,qu=wu?ve.minSize:100,yn=ve.maxSize;let it;e[137]!==i?(it=i("query.label"),e[137]=i,e[138]=it):it=e[138];let st;e[139]!==it?(st=a.jsx(pn,{children:a.jsx(ge,{children:a.jsx(Ve,{muted:!0,children:it})})}),e[139]=it,e[140]=st):st=e[140];let at;e[141]!==ie?(at=a.jsx(hr,{initialValue:ie,onChange:Oe,ref:y}),e[141]=ie,e[142]=at):at=e[142];let ot;e[143]!==st||e[144]!==at?(ot=a.jsx(Jr,{display:"flex","data-testid":"vision-query-editor",children:a.jsxs(ue,{flex:1,children:[st,at]})}),e[143]=st,e[144]=at,e[145]=ot):ot=e[145];let lt;e[146]!==ku||e[147]!==G.error||e[148]!==G.raw||e[149]!==G.valid?(lt=a.jsx(Ns,{value:G.raw,onChange:ku,paramsError:G.error,hasValidParams:G.valid,editorRef:c}),e[146]=ku,e[147]=G.error,e[148]=G.raw,e[149]=G.valid,e[150]=lt):lt=e[150];let ct;e[151]!==Nu||e[152]!==ce||e[153]!==ke||e[154]!==G.valid||e[155]!==Ne?(ct=a.jsx(Us,{hasValidParams:G.valid,queryInProgress:Ne,listenInProgress:ke,onQueryExecution:ce,onListenExecution:Nu}),e[151]=Nu,e[152]=ce,e[153]=ke,e[154]=G.valid,e[155]=Ne,e[156]=ct):ct=e[156];let dt;e[157]!==lt||e[158]!==ct?(dt=a.jsxs(Jr,{display:"flex",children:[lt,ct]}),e[157]=lt,e[158]=ct,e[159]=dt):dt=e[159];let Dt;e[160]!==ve.allowResize||e[161]!==ve.maxSize||e[162]!==ve.size||e[163]!==Vu||e[164]!==qu||e[165]!==ot||e[166]!==dt?(Dt=a.jsx(ue,{height:"stretch",flex:1,children:a.jsxs(Wu,{className:"sidebarPanes",split:"horizontal",defaultSize:Vu,size:En,allowResize:gn,minSize:qu,maxSize:yn,primary:"first",children:[ot,dt]})}),e[160]=ve.allowResize,e[161]=ve.maxSize,e[162]=ve.size,e[163]=Vu,e[164]=qu,e[165]=ot,e[166]=dt,e[167]=Dt):Dt=e[167];let ft;e[168]!==M||e[169]!==bu||e[170]!==vu||e[171]!==ke||e[172]!==Ce||e[173]!==Ne||e[174]!==et||e[175]!==xu?(ft=a.jsx(Aa,{error:vu,queryInProgress:Ne,queryResult:et,listenInProgress:ke,listenMutations:Ce,dataset:M,queryTime:xu,e2eTime:bu}),e[168]=M,e[169]=bu,e[170]=vu,e[171]=ke,e[172]=Ce,e[173]=Ne,e[174]=et,e[175]=xu,e[176]=ft):ft=e[176];let pt;e[177]!==Mu||e[178]!==Dt||e[179]!==ft?(pt=a.jsx(ue,{height:"stretch",flex:1,children:a.jsxs(Wu,{className:"sidebarPanes",split:Mu,minSize:300,children:[Dt,ft]})}),e[177]=Mu,e[178]=Dt,e[179]=ft,e[180]=pt):pt=e[180];let lu;e[181]===Symbol.for("react.memo_cache_sentinel")?(lu={position:"relative",height:"100%"},e[181]=lu):lu=e[181];let cu;e[182]===Symbol.for("react.memo_cache_sentinel")?(cu={position:"absolute",left:-32,top:"50%",transform:"translateY(-50%)",zIndex:100,pointerEvents:"auto"},e[182]=cu):cu=e[182];let ht;e[183]!==Ke?(ht=()=>Fn(!Ke),e[183]=Ke,e[184]=ht):ht=e[184];let du;e[185]===Symbol.for("react.memo_cache_sentinel")?(du={display:"flex",alignItems:"center",height:"100%"},e[185]=du):du=e[185];let Ct;e[186]!==Ke?(Ct=a.jsx("div",{style:du,children:Ke?a.jsx(Ln,{}):a.jsx(Tn,{})}),e[186]=Ke,e[187]=Ct):Ct=e[187];let mt;e[188]!==ht||e[189]!==Ct?(mt=a.jsx(Pe,{mode:"ghost",padding:2,style:cu,onClick:ht,children:Ct}),e[188]=ht,e[189]=Ct,e[190]=mt):mt=e[190];let Ft;e[191]!==G.parsed?(Ft=G.parsed||{},e[191]=G.parsed,e[192]=Ft):Ft=e[192];let At;e[193]!==Lu||e[194]!==ut||e[195]!==ie||e[196]!==rt||e[197]!==Ft||e[198]!==q?(At=a.jsx(Vs,{url:q,getStateFromUrl:ut,setStateFromParsedUrl:rt,currentQuery:ie,currentParams:Ft,generateUrl:Lu}),e[193]=Lu,e[194]=ut,e[195]=ie,e[196]=rt,e[197]=Ft,e[198]=q,e[199]=At):At=e[199];let Et;e[200]!==mt||e[201]!==At?(Et=a.jsxs(ue,{style:lu,children:[mt,At]}),e[200]=mt,e[201]=At,e[202]=Et):Et=e[202];let gt;e[203]!==Tu||e[204]!==pt||e[205]!==Et?(gt=a.jsx(vs,{flex:"auto",children:a.jsxs(Wu,{minSize:800,defaultSize:window.innerWidth-275,size:Tu,maxSize:-225,primary:"first",children:[pt,Et]})}),e[203]=Tu,e[204]=pt,e[205]=Et,e[206]=gt):gt=e[206];let Du;return e[207]!==nt||e[208]!==gt?(Du=a.jsxs(Dn,{direction:"column",height:"fill",ref:m,sizing:"border",overflow:"hidden","data-testid":"vision-root",children:[nt,gt]}),e[207]=nt,e[208]=gt,e[209]=Du):Du=e[209],Du}function xa(t){return On(t._id)}function Ba(t){return Pn(t)&&t.state==="scheduled"}function ba(t){const e=le.c(7),{client:u,datasets:r}=t;let l;e:{if(Array.isArray(r)){let o;e[0]!==r?(o=Hr(r),e[0]=r,e[1]=o):o=e[1],l=o;break e}let n;if(e[2]!==u.observable.datasets||e[3]!==r){let o;e[5]!==r?(o=i=>typeof r=="function"?r(i).map(ja):i.map(wa),e[5]=r,e[6]=o):o=e[6],n=u.observable.datasets.list().pipe(Wr(o),bn(Sa)),e[2]=u.observable.datasets,e[3]=r,e[4]=n}else n=e[4];l=n}return Sn(l,null)}function Sa(t){return Hr(t)}function wa(t){return t.name}function ja(t){return t.name}function _a(t){const e=le.c(19);let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={apiVersion:"v2025-06-27"},e[0]=u):u=e[0];const r=dr(u);let l;e[1]!==r||e[2]!==t.config.datasets?(l={client:r,datasets:t.config.datasets},e[1]=r,e[2]=t.config.datasets,e[3]=l):l=e[3];const n=ba(l);if(!n){let F;return e[4]===Symbol.for("react.memo_cache_sentinel")?(F=a.jsx(ge,{align:"center",height:"fill",justify:"center",children:a.jsx(on,{})}),e[4]=F):F=e[4],F}let o;e[5]!==n||e[6]!==t.client?(o=n instanceof Error?[t.client.config().dataset||"production"]:n,e[5]=n,e[6]=t.client,e[7]=o):o=e[7];const i=o;let s;e[8]!==t.client?(s=t.client.config(),e[8]=t.client,e[9]=s):s=e[9];const d=s.projectId;let C;e[10]!==i||e[11]!==t.client||e[12]!==t.config.defaultDataset?(C=t.config.defaultDataset||t.client.config().dataset||i[0],e[10]=i,e[11]=t.client,e[12]=t.config.defaultDataset,e[13]=C):C=e[13];const D=C;let B;return e[14]!==i||e[15]!==D||e[16]!==d||e[17]!==t?(B=a.jsx(va,{...t,datasets:i,projectId:d,defaultDataset:D},d),e[14]=i,e[15]=D,e[16]=d,e[17]=t,e[18]=B):B=e[18],B}class Ra extends O.Component{constructor(e){super(e),this.state={error:null,numRetries:0}}static getDerivedStateFromError(e){return{error:e instanceof Error?e.message:`${e}`}}handleRetryRender=()=>this.setState(e=>({error:null,numRetries:e.numRetries+1}));handleRetryWithCacheClear=()=>{Cs(),this.handleRetryRender()};render(){if(!this.state.error)return this.props.children;const e=this.state.error,u=this.state.numRetries>0;return a.jsx(De,{height:"fill",overflow:"auto",paddingY:[4,5,6,7],paddingX:4,sizing:"border",tone:"critical",children:a.jsx(xn,{width:3,children:a.jsxs(Ee,{space:4,children:[a.jsx("div",{children:a.jsx(Pe,{onClick:u?this.handleRetryWithCacheClear:this.handleRetryRender,text:u?"Clear cache and retry":"Retry",tone:"default"})}),a.jsx(Bn,{children:"An error occurred"}),a.jsx(De,{border:!0,radius:2,overflow:"auto",padding:4,tone:"inherit",children:a.jsx(Ee,{space:4,children:e&&a.jsx(Eu,{size:1,children:a.jsxs("strong",{children:["Error: ",e]})})})})]})})})}}function Na(t){const e=le.c(6);let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={apiVersion:"1"},e[0]=u):u=e[0];const r=dr(u);let l;e[1]!==t.tool.options?(l={defaultApiVersion:an,...t.tool.options},e[1]=t.tool.options,e[2]=l):l=e[2];const n=l;let o;return e[3]!==r||e[4]!==n?(o=a.jsx(Ra,{children:a.jsx(_a,{client:r,config:n})}),e[3]=r,e[4]=n,e[5]=o):o=e[5],o}export{Na as default}; diff --git a/apps/studio/dist/static/VideoPlayer-BxzJLbcn.js b/apps/studio/dist/static/VideoPlayer-BxzJLbcn.js new file mode 100644 index 00000000..9755a8bd --- /dev/null +++ b/apps/studio/dist/static/VideoPlayer-BxzJLbcn.js @@ -0,0 +1,3386 @@ +import{m as ja,r as za,c as o_,j as l_}from"./sanity-BZuh2pfi.js";var d_=Object.create,bv=Object.defineProperty,u_=Object.getOwnPropertyDescriptor,c_=Object.getOwnPropertyNames,h_=Object.getPrototypeOf,f_=Object.prototype.hasOwnProperty,Tv=function(i,e){return function(){return i&&(e=i(i=0)),e}},Mt=function(i,e){return function(){return e||i((e={exports:{}}).exports,e),e.exports}},m_=function(i,e,t,s){if(e&&typeof e=="object"||typeof e=="function")for(var r=c_(e),n=0,a=r.length,o;n";default:return r(h)}}function r(h){var f=[],m=h.tagName;return h.namespaceURI==="http://www.w3.org/1999/xhtml"&&(m=m.toLowerCase()),f.push("<"+m+d(h)+o(h)),t.indexOf(m)>-1?f.push(" />"):(f.push(">"),h.childNodes.length?f.push.apply(f,h.childNodes.map(s)):h.textContent||h.innerText?f.push(u(h.textContent||h.innerText)):h.innerHTML&&f.push(h.innerHTML),f.push("")),f.join("")}function n(h,f){var m=_v(h[f]);return f==="style"&&Object.keys(h.style).length>0?!0:h.hasOwnProperty(f)&&(m==="string"||m==="boolean"||m==="number")&&f!=="nodeName"&&f!=="className"&&f!=="tagName"&&f!=="textContent"&&f!=="innerText"&&f!=="namespaceURI"&&f!=="innerHTML"}function a(h){if(typeof h=="string")return h;var f="";return Object.keys(h).forEach(function(m){var p=h[m];m=m.replace(/[A-Z]/g,function(g){return"-"+g.toLowerCase()}),f+=m+":"+p+";"}),f}function o(h){var f=h.dataset,m=[];for(var p in f)m.push({name:"data-"+p,value:f[p]});return m.length?l(m):""}function l(h){var f=[];return h.forEach(function(m){var p=m.name,g=m.value;p==="style"&&(g=a(g)),f.push(p+'="'+c(g)+'"')}),f.length?" "+f.join(" "):""}function d(h){var f=[];for(var m in h)n(h,m)&&f.push({name:m,value:h[m]});for(var p in h._attributes)for(var g in h._attributes[p]){var v=h._attributes[p][g],b=(v.prefix?v.prefix+":":"")+g;f.push({name:b,value:v.value})}return h.className&&f.push({name:"class",value:h.className}),f.length?l(f):""}function u(h){var f="";return typeof h=="string"?f=h:h&&(f=h.toString()),f.replace(/&/g,"&").replace(//g,">")}function c(h){return u(h).replace(/"/g,""")}}),xv=Mt(function(i,e){Cr();var t=Sv(),s=Iv(),r=Lv(),n=Rv(),a=v_(),o="http://www.w3.org/1999/xhtml";e.exports=l;function l(d,u,c){if(!Dr(this,l))return new l(d);var h=c===void 0?o:c||null;this.tagName=h===o?String(d).toUpperCase():d,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=u||null,this.namespaceURI=h,this._attributes={},this.tagName==="INPUT"&&(this.type="text")}l.prototype.type="DOMElement",l.prototype.nodeType=1,l.prototype.appendChild=function(d){return d.parentNode&&d.parentNode.removeChild(d),this.childNodes.push(d),d.parentNode=this,d},l.prototype.replaceChild=function(d,u){d.parentNode&&d.parentNode.removeChild(d);var c=this.childNodes.indexOf(u);return u.parentNode=null,this.childNodes[c]=d,d.parentNode=this,u},l.prototype.removeChild=function(d){var u=this.childNodes.indexOf(d);return this.childNodes.splice(u,1),d.parentNode=null,d},l.prototype.insertBefore=function(d,u){d.parentNode&&d.parentNode.removeChild(d);var c=u==null?-1:this.childNodes.indexOf(u);return c>-1?this.childNodes.splice(c,0,d):this.childNodes.push(d),d.parentNode=this,d},l.prototype.setAttributeNS=function(d,u,c){var h=null,f=u,m=u.indexOf(":");if(m>-1&&(h=u.substr(0,m),f=u.substr(m+1)),this.tagName==="INPUT"&&u==="type")this.type=c;else{var p=this._attributes[d]||(this._attributes[d]={});p[f]={value:c,prefix:h}}},l.prototype.getAttributeNS=function(d,u){var c=this._attributes[d],h=c&&c[u]&&c[u].value;return this.tagName==="INPUT"&&u==="type"?this.type:typeof h!="string"?null:h},l.prototype.removeAttributeNS=function(d,u){var c=this._attributes[d];c&&delete c[u]},l.prototype.hasAttributeNS=function(d,u){var c=this._attributes[d];return!!c&&u in c},l.prototype.setAttribute=function(d,u){return this.setAttributeNS(null,d,u)},l.prototype.getAttribute=function(d){return this.getAttributeNS(null,d)},l.prototype.removeAttribute=function(d){return this.removeAttributeNS(null,d)},l.prototype.hasAttribute=function(d){return this.hasAttributeNS(null,d)},l.prototype.removeEventListener=n,l.prototype.addEventListener=r,l.prototype.dispatchEvent=s,l.prototype.focus=function(){},l.prototype.toString=function(){return a(this)},l.prototype.getElementsByClassName=function(d){var u=d.split(" "),c=[];return t(this,function(h){if(h.nodeType===1){var f=h.className||"",m=f.split(" ");u.every(function(p){return m.indexOf(p)!==-1})&&c.push(h)}}),c},l.prototype.getElementsByTagName=function(d){d=d.toLowerCase();var u=[];return t(this.childNodes,function(c){c.nodeType===1&&(d==="*"||c.tagName.toLowerCase()===d)&&u.push(c)}),u},l.prototype.contains=function(d){return t(this,function(u){return d===u})||!1}}),E_=Mt(function(i,e){Cr();var t=xv();e.exports=s;function s(r){if(!Dr(this,s))return new s;this.childNodes=[],this.parentNode=null,this.ownerDocument=r||null}s.prototype.type="DocumentFragment",s.prototype.nodeType=11,s.prototype.nodeName="#document-fragment",s.prototype.appendChild=t.prototype.appendChild,s.prototype.replaceChild=t.prototype.replaceChild,s.prototype.removeChild=t.prototype.removeChild,s.prototype.toString=function(){return this.childNodes.map(function(r){return String(r)}).join("")}}),y_=Mt(function(i,e){e.exports=t;function t(s){}t.prototype.initEvent=function(s,r,n){this.type=s,this.bubbles=r,this.cancelable=n},t.prototype.preventDefault=function(){}}),b_=Mt(function(i,e){Cr();var t=Sv(),s=p_(),r=g_(),n=xv(),a=E_(),o=y_(),l=Iv(),d=Lv(),u=Rv();e.exports=c;function c(){if(!Dr(this,c))return new c;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}var h=c.prototype;h.createTextNode=function(f){return new r(f,this)},h.createElementNS=function(f,m){var p=f===null?null:String(f);return new n(m,this,p)},h.createElement=function(f){return new n(f,this)},h.createDocumentFragment=function(){return new a(this)},h.createEvent=function(f){return new o(f)},h.createComment=function(f){return new s(f,this)},h.getElementById=function(f){f=String(f);var m=t(this.childNodes,function(p){if(String(p.id)===f)return p});return m||null},h.getElementsByClassName=n.prototype.getElementsByClassName,h.getElementsByTagName=n.prototype.getElementsByTagName,h.contains=n.prototype.contains,h.removeEventListener=u,h.addEventListener=d,h.dispatchEvent=l}),T_=Mt(function(i,e){var t=b_();e.exports=new t}),kv=Mt(function(i,e){var t=typeof global<"u"?global:typeof window<"u"?window:{},s=T_(),r;typeof document<"u"?r=document:(r=t["__GLOBAL_DOCUMENT_CACHE@4"],r||(r=t["__GLOBAL_DOCUMENT_CACHE@4"]=s)),e.exports=r});function __(i){if(Array.isArray(i))return i}function A_(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var s=[],r=!0,n=!1,a,o;try{for(t=t.call(i);!(r=(a=t.next()).done)&&(s.push(a.value),!(e&&s.length===e));r=!0);}catch(l){n=!0,o=l}finally{try{!r&&t.return!=null&&t.return()}finally{if(n)throw o}}return s}}function S_(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pc(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t1&&arguments[1]!==void 0?arguments[1]:3,t,s,r,n,a,o=[console,i],l=(t=console.trace).bind.apply(t,ui(o)),d=(s=console.info).bind.apply(s,ui(o)),u=(r=console.debug).bind.apply(r,ui(o)),c=(n=console.warn).bind.apply(n,ui(o)),h=(a=console.error).bind.apply(a,ui(o)),f=e;return{trace:function(){for(var m=arguments.length,p=new Array(m),g=0;ghr.TRACE))return l.apply(void 0,ui(p))},debug:function(){for(var m=arguments.length,p=new Array(m),g=0;ghr.DEBUG))return u.apply(void 0,ui(p))},info:function(){for(var m=arguments.length,p=new Array(m),g=0;ghr.INFO))return d.apply(void 0,ui(p))},warn:function(){for(var m=arguments.length,p=new Array(m),g=0;ghr.WARN))return c.apply(void 0,ui(p))},error:function(){for(var m=arguments.length,p=new Array(m),g=0;ghr.ERROR))return h.apply(void 0,ui(p))},get level(){return f},set level(m){m!==this.level&&(f=m??e)}}},we=D_("[mux]"),Bu=ii(Ji());function Oc(){var i=Bu.default.doNotTrack||Bu.default.navigator&&Bu.default.navigator.doNotTrack;return i==="1"}function oe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}Cr();function it(i,e){if(!Dr(i,e))throw new TypeError("Cannot call a class as a function")}function C_(i,e){for(var t=0;t=0)&&(t[r]=i[r]);return t}function O_(i,e){if(i==null)return{};var t=P_(i,e),s,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(i,s)&&(t[s]=i[s])}return t}function N_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}Av();function U_(i,e){return e&&(_v(e)==="object"||typeof e=="function")?e:oe(i)}function $_(i){var e=N_();return function(){var t=$n(i),s;if(e){var r=$n(this).constructor;s=Reflect.construct(t,arguments,r)}else s=t.apply(this,arguments);return U_(this,s)}}var vi=function(i){return Xa(i)[0]},Xa=function(i){if(typeof i!="string"||i==="")return["localhost"];var e=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,t=i.match(e)||[],s=t[4],r;return s&&(r=(s.match(/[^\.]+\.[^\.]+$/)||[])[0]),[s,r]},Hu=ii(Ji()),F_={exists:function(){var i=Hu.default.performance,e=i&&i.timing;return e!==void 0},domContentLoadedEventEnd:function(){var i=Hu.default.performance,e=i&&i.timing;return e&&e.domContentLoadedEventEnd},navigationStart:function(){var i=Hu.default.performance,e=i&&i.timing;return e&&e.navigationStart}},Id=F_;function ct(i,e,t){t=t===void 0?1:t,i[e]=i[e]||0,i[e]+=t}function Ld(i){for(var e=1;e=0||n.toLowerCase().indexOf("x-litix-")===0)&&(e[n]=r.join(": "))}}),e}function Rd(i){if(i){var e=wv.find(function(t){return i[t]!==void 0});return e?i[e]:void 0}}var K_=function(i){var e={};for(var t in i){var s=i[t],r=s["DATA-ID"].search("io.litix.data.");if(r!==-1){var n=s["DATA-ID"].replace("io.litix.data.","");e[n]=s.VALUE}}return e},Mv=K_,Lo=function(i){if(!i)return{};var e=Id.navigationStart(),t=i.loading,s=t?t.start:i.trequest,r=t?t.first:i.tfirst,n=t?t.end:i.tload;return{bytesLoaded:i.total,requestStart:Math.round(e+s),responseStart:Math.round(e+r),responseEnd:Math.round(e+n)}},Zn=function(i){if(!(!i||typeof i.getAllResponseHeaders!="function"))return kf(i.getAllResponseHeaders())},V_=function(i,e,t){var s=arguments.length>4?arguments[4]:void 0,r=i.log,n=i.utils.secondsToMs,a=function(g){var v=parseInt(s.version),b;return v===1&&g.programDateTime!==null&&(b=g.programDateTime),v===0&&g.pdt!==null&&(b=g.pdt),b};if(!Id.exists()){r.warn("performance timing not supported. Not tracking HLS.js.");return}var o=function(g,v){return i.emit(e,g,v)},l=function(g,v){var b=v.levels,y=v.audioTracks,T=v.url,A=v.stats,L=v.networkDetails,S=v.sessionData,R={},x={};b.forEach(function(H,N){R[N]={width:H.width,height:H.height,bitrate:H.bitrate,attrs:H.attrs}}),y.forEach(function(H,N){x[N]={name:H.name,language:H.lang,bitrate:H.bitrate}});var I=Lo(A),M=I.bytesLoaded,F=I.requestStart,V=I.responseStart,j=I.responseEnd;o("requestcompleted",xf(Ld({},Mv(S)),{request_event_type:g,request_bytes_loaded:M,request_start:F,request_response_start:V,request_response_end:j,request_type:"manifest",request_hostname:vi(T),request_response_headers:Zn(L),request_rendition_lists:{media:R,audio:x,video:{}}}))};t.on(s.Events.MANIFEST_LOADED,l);var d=function(g,v){var b=v.details,y=v.level,T=v.networkDetails,A=v.stats,L=Lo(A),S=L.bytesLoaded,R=L.requestStart,x=L.responseStart,I=L.responseEnd,M=b.fragments[b.fragments.length-1],F=a(M)+n(M.duration);o("requestcompleted",{request_event_type:g,request_bytes_loaded:S,request_start:R,request_response_start:x,request_response_end:I,request_current_level:y,request_type:"manifest",request_hostname:vi(b.url),request_response_headers:Zn(T),video_holdback:b.holdBack&&n(b.holdBack),video_part_holdback:b.partHoldBack&&n(b.partHoldBack),video_part_target_duration:b.partTarget&&n(b.partTarget),video_target_duration:b.targetduration&&n(b.targetduration),video_source_is_live:b.live,player_manifest_newest_program_time:isNaN(F)?void 0:F})};t.on(s.Events.LEVEL_LOADED,d);var u=function(g,v){var b=v.details,y=v.networkDetails,T=v.stats,A=Lo(T),L=A.bytesLoaded,S=A.requestStart,R=A.responseStart,x=A.responseEnd;o("requestcompleted",{request_event_type:g,request_bytes_loaded:L,request_start:S,request_response_start:R,request_response_end:x,request_type:"manifest",request_hostname:vi(b.url),request_response_headers:Zn(y)})};t.on(s.Events.AUDIO_TRACK_LOADED,u);var c=function(g,v){var b=v.stats,y=v.networkDetails,T=v.frag;b=b||T.stats;var A=Lo(b),L=A.bytesLoaded,S=A.requestStart,R=A.responseStart,x=A.responseEnd,I=y?Zn(y):void 0,M={request_event_type:g,request_bytes_loaded:L,request_start:S,request_response_start:R,request_response_end:x,request_hostname:y?vi(y.responseURL):void 0,request_id:I?Rd(I):void 0,request_response_headers:I,request_media_duration:T.duration,request_url:y?.responseURL};T.type==="main"?(M.request_type="media",M.request_current_level=T.level,M.request_video_width=(t.levels[T.level]||{}).width,M.request_video_height=(t.levels[T.level]||{}).height,M.request_labeled_bitrate=(t.levels[T.level]||{}).bitrate):M.request_type=T.type,o("requestcompleted",M)};t.on(s.Events.FRAG_LOADED,c);var h=function(g,v){var b=v.frag,y=b.start,T=a(b),A={currentFragmentPDT:T,currentFragmentStart:n(y)};o("fragmentchange",A)};t.on(s.Events.FRAG_CHANGED,h);var f=function(g,v){var b=v.type,y=v.details,T=v.response,A=v.fatal,L=v.frag,S=v.networkDetails,R=L?.url||v.url||"",x=S?Zn(S):void 0;if((y===s.ErrorDetails.MANIFEST_LOAD_ERROR||y===s.ErrorDetails.MANIFEST_LOAD_TIMEOUT||y===s.ErrorDetails.FRAG_LOAD_ERROR||y===s.ErrorDetails.FRAG_LOAD_TIMEOUT||y===s.ErrorDetails.LEVEL_LOAD_ERROR||y===s.ErrorDetails.LEVEL_LOAD_TIMEOUT||y===s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||y===s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT||y===s.ErrorDetails.SUBTITLE_LOAD_ERROR||y===s.ErrorDetails.SUBTITLE_LOAD_TIMEOUT||y===s.ErrorDetails.KEY_LOAD_ERROR||y===s.ErrorDetails.KEY_LOAD_TIMEOUT)&&o("requestfailed",{request_error:y,request_url:R,request_hostname:vi(R),request_id:x?Rd(x):void 0,request_type:y===s.ErrorDetails.FRAG_LOAD_ERROR||y===s.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":y===s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||y===s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":y===s.ErrorDetails.SUBTITLE_LOAD_ERROR||y===s.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":y===s.ErrorDetails.KEY_LOAD_ERROR||y===s.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:T?.code,request_error_text:T?.text}),A){var I,M="".concat(R?"url: ".concat(R,` +`):"")+"".concat(T&&(T.code||T.text)?"response: ".concat(T.code,", ").concat(T.text,` +`):"")+"".concat(v.reason?"failure reason: ".concat(v.reason,` +`):"")+"".concat(v.level?"level: ".concat(v.level,` +`):"")+"".concat(v.parent?"parent stream controller: ".concat(v.parent,` +`):"")+"".concat(v.buffer?"buffer length: ".concat(v.buffer,` +`):"")+"".concat(v.error?"error: ".concat(v.error,` +`):"")+"".concat(v.event?"event: ".concat(v.event,` +`):"")+"".concat(v.err?"error message: ".concat((I=v.err)===null||I===void 0?void 0:I.message,` +`):"");o("error",{player_error_code:b,player_error_message:y,player_error_context:M})}};t.on(s.Events.ERROR,f);var m=function(g,v){var b=v.frag,y=b&&b._url||"";o("requestcanceled",{request_event_type:g,request_url:y,request_type:"media",request_hostname:vi(y)})};t.on(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,m);var p=function(g,v){var b=v.level,y=t.levels[b];if(y&&y.attrs&&y.attrs.BANDWIDTH){var T=y.attrs.BANDWIDTH,A,L=parseFloat(y.attrs["FRAME-RATE"]);isNaN(L)||(A=L),T?o("renditionchange",{video_source_fps:A,video_source_bitrate:T,video_source_width:y.width,video_source_height:y.height,video_source_rendition_name:y.name,video_source_codec:y?.videoCodec}):r.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};t.on(s.Events.LEVEL_SWITCHED,p),t._stopMuxMonitor=function(){t.off(s.Events.MANIFEST_LOADED,l),t.off(s.Events.LEVEL_LOADED,d),t.off(s.Events.AUDIO_TRACK_LOADED,u),t.off(s.Events.FRAG_LOADED,c),t.off(s.Events.FRAG_CHANGED,h),t.off(s.Events.ERROR,f),t.off(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,m),t.off(s.Events.LEVEL_SWITCHED,p),t.off(s.Events.DESTROYING,t._stopMuxMonitor),delete t._stopMuxMonitor},t.on(s.Events.DESTROYING,t._stopMuxMonitor)},W_=function(i){i&&typeof i._stopMuxMonitor=="function"&&i._stopMuxMonitor()},_p=function(i,e){if(!i||!i.requestEndDate)return{};var t=vi(i.url),s=i.url,r=i.bytesLoaded,n=new Date(i.requestStartDate).getTime(),a=new Date(i.firstByteDate).getTime(),o=new Date(i.requestEndDate).getTime(),l=isNaN(i.duration)?0:i.duration,d=typeof e.getMetricsFor=="function"?e.getMetricsFor(i.mediaType).HttpList:e.getDashMetrics().getHttpRequests(i.mediaType),u;d.length>0&&(u=kf(d[d.length-1]._responseHeaders||""));var c=u?Rd(u):void 0;return{requestStart:n,requestResponseStart:a,requestResponseEnd:o,requestBytesLoaded:r,requestResponseHeaders:u,requestMediaDuration:l,requestHostname:t,requestUrl:s,requestId:c}},q_=function(i,e){if(typeof e.getCurrentRepresentationForType=="function"){var t=e.getCurrentRepresentationForType(i);return t?{currentLevel:t.absoluteIndex,renditionWidth:t.width||null,renditionHeight:t.height||null,renditionBitrate:t.bandwidth}:{}}var s=e.getQualityFor(i),r=e.getCurrentTrackFor(i).bitrateList;return r?{currentLevel:s,renditionWidth:r[s].width||null,renditionHeight:r[s].height||null,renditionBitrate:r[s].bandwidth}:{}},Y_=function(i){var e;return(e=i.match(/.*codecs\*?="(.*)"/))===null||e===void 0?void 0:e[1]},j_=function(i){try{var e,t,s=(t=i.getVersion)===null||t===void 0||(e=t.call(i))===null||e===void 0?void 0:e.split(".").map(function(r){return parseInt(r)})[0];return s}catch{return!1}},z_=function(i,e,t){var s=i.log;if(!t||!t.on){s.warn("Invalid dash.js player reference. Monitoring blocked.");return}var r=j_(t),n=function(b,y){return i.emit(e,b,y)},a=function(b){var y=b.type,T=b.data,A=(T||{}).url;n("requestcompleted",{request_event_type:y,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:vi(A),request_url:A})};t.on("manifestLoaded",a);var o={},l=function(b){if(typeof b.getRequests!="function")return null;var y=b.getRequests({state:"executed"});return y.length===0?null:y[y.length-1]},d=function(b){var y=b.type,T=b.fragmentModel,A=b.chunk,L=l(T);u({type:y,request:L,chunk:A})},u=function(b){var y=b.type,T=b.chunk,A=b.request,L=(T||{}).mediaInfo,S=L||{},R=S.type,x=S.bitrateList;x=x||[];var I={};x.forEach(function(ee,U){I[U]={},I[U].width=ee.width,I[U].height=ee.height,I[U].bitrate=ee.bandwidth,I[U].attrs={}}),R==="video"?o.video=I:R==="audio"?o.audio=I:o.media=I;var M=_p(A,t),F=M.requestStart,V=M.requestResponseStart,j=M.requestResponseEnd,H=M.requestResponseHeaders,N=M.requestMediaDuration,q=M.requestHostname,B=M.requestUrl,z=M.requestId;n("requestcompleted",{request_event_type:y,request_start:F,request_response_start:V,request_response_end:j,request_bytes_loaded:-1,request_type:R+"_init",request_response_headers:H,request_hostname:q,request_id:z,request_url:B,request_media_duration:N,request_rendition_lists:o})};r>=4?t.on("initFragmentLoaded",u):t.on("initFragmentLoaded",d);var c=function(b){var y=b.type,T=b.fragmentModel,A=b.chunk,L=l(T);h({type:y,request:L,chunk:A})},h=function(b){var y=b.type,T=b.chunk,A=b.request,L=T||{},S=L.mediaInfo,R=L.start,x=S||{},I=x.type,M=_p(A,t),F=M.requestStart,V=M.requestResponseStart,j=M.requestResponseEnd,H=M.requestBytesLoaded,N=M.requestResponseHeaders,q=M.requestMediaDuration,B=M.requestHostname,z=M.requestUrl,ee=M.requestId,U=q_(I,t),$=U.currentLevel,re=U.renditionWidth,pe=U.renditionHeight,ue=U.renditionBitrate;n("requestcompleted",{request_event_type:y,request_start:F,request_response_start:V,request_response_end:j,request_bytes_loaded:H,request_type:I,request_response_headers:N,request_hostname:B,request_id:ee,request_url:z,request_media_start_time:R,request_media_duration:q,request_current_level:$,request_labeled_bitrate:ue,request_video_width:re,request_video_height:pe})};r>=4?t.on("mediaFragmentLoaded",h):t.on("mediaFragmentLoaded",c);var f={video:void 0,audio:void 0,totalBitrate:void 0},m=function(){if(f.video&&typeof f.video.bitrate=="number"){if(!(f.video.width&&f.video.height)){s.warn("have bitrate info for video but missing width/height");return}var b=f.video.bitrate;if(f.audio&&typeof f.audio.bitrate=="number"&&(b+=f.audio.bitrate),b!==f.totalBitrate)return f.totalBitrate=b,{video_source_bitrate:b,video_source_height:f.video.height,video_source_width:f.video.width,video_source_codec:Y_(f.video.codec)}}},p=function(b,y,T){var A=b.mediaType;if(A==="audio"||A==="video"){var L;if(typeof t.getRepresentationsByType=="function")if(b.newRepresentation)L={bitrate:b.newRepresentation.bandwidth,width:b.newRepresentation.width,height:b.newRepresentation.height,qualityIndex:b.newRepresentation.absoluteIndex};else{var S=t.getRepresentationsByType(A);if(S&&typeof b.newQuality=="number"){var R=S.find(function(I){return I.absoluteIndex===b.newQuality||I.index===b.newQuality});R&&(L={bitrate:R.bandwidth,width:R.width,height:R.height,qualityIndex:b.newQuality})}}else{if(typeof b.newQuality!="number"){s.warn("missing evt.newQuality in qualityChangeRendered event",b);return}L=t.getBitrateInfoListFor(A).find(function(I){var M=I.qualityIndex;return M===b.newQuality})}if(!(L&&typeof L.bitrate=="number")){s.warn("missing bitrate info for ".concat(A));return}f[A]=xf(Ld({},L),{codec:t.getCurrentTrackFor(A).codec});var x=m();x&&n("renditionchange",x)}};t.on("qualityChangeRendered",p);var g=function(b){var y=b.request,T=b.mediaType;y=y||{},n("requestcanceled",{request_event_type:y.type+"_"+y.action,request_url:y.url,request_type:T,request_hostname:vi(y.url)})};t.on("fragmentLoadingAbandoned",g);var v=function(b){var y=b.error,T,A,L=(y==null||(T=y.data)===null||T===void 0?void 0:T.request)||{},S=(y==null||(A=y.data)===null||A===void 0?void 0:A.response)||{};y?.code===27&&n("requestfailed",{request_error:L.type+"_"+L.action,request_url:L.url,request_hostname:vi(L.url),request_type:L.mediaType,request_error_code:S.status,request_error_text:S.statusText});var R="".concat(L!=null&&L.url?"url: ".concat(L.url,` +`):"")+"".concat(S!=null&&S.status||S!=null&&S.statusText?"response: ".concat(S?.status,", ").concat(S?.statusText,` +`):"");n("error",{player_error_code:y?.code,player_error_message:y?.message,player_error_context:R})};t.on("error",v),t._stopMuxMonitor=function(){t.off("manifestLoaded",a),t.off("initFragmentLoaded",u),t.off("mediaFragmentLoaded",h),t.off("qualityChangeRendered",p),t.off("error",v),t.off("fragmentLoadingAbandoned",g),delete t._stopMuxMonitor}},Q_=function(i){i&&typeof i._stopMuxMonitor=="function"&&i._stopMuxMonitor()},Ap=0,X_=(function(){function i(){it(this,i),K(this,"_listeners",void 0)}return bi(i,[{key:"on",value:function(e,t,s){return t._eventEmitterGuid=t._eventEmitterGuid||++Ap,this._listeners=this._listeners||{},this._listeners[e]=this._listeners[e]||[],s&&(t=t.bind(s)),this._listeners[e].push(t),t}},{key:"off",value:function(e,t){var s=this._listeners&&this._listeners[e];s&&s.forEach(function(r,n){r._eventEmitterGuid===t._eventEmitterGuid&&s.splice(n,1)})}},{key:"one",value:function(e,t,s){var r=this;t._eventEmitterGuid=t._eventEmitterGuid||++Ap;var n=function(){r.off(e,n),t.apply(s||this,arguments)};n._eventEmitterGuid=t._eventEmitterGuid,this.on(e,n)}},{key:"emit",value:function(e,t){var s=this;if(this._listeners){t=t||{};var r=this._listeners["before"+e]||[],n=this._listeners["before*"]||[],a=this._listeners[e]||[],o=this._listeners["after"+e]||[],l=function(d,u){d=d.slice(),d.forEach(function(c){c.call(s,{type:e},u)})};l(r,t),l(n,t),l(a,t),l(o,t)}}}]),i})(),Z_=X_,Gu=ii(Ji()),J_=(function(){function i(e){var t=this;it(this,i),K(this,"_playbackHeartbeatInterval",void 0),K(this,"_playheadShouldBeProgressing",void 0),K(this,"pm",void 0),this.pm=e,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,e.on("playing",function(){t._playheadShouldBeProgressing=!0}),e.on("play",this._startPlaybackHeartbeatInterval.bind(this)),e.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),e.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),e.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("seeked",function(){e.data.player_is_paused?t._stopPlaybackHeartbeatInterval():t._startPlaybackHeartbeatInterval()}),e.on("timeupdate",function(){t._playbackHeartbeatInterval!==null&&e.emit("playbackheartbeat")}),e.on("devicesleep",function(s,r){t._playbackHeartbeatInterval!==null&&(Gu.default.clearInterval(t._playbackHeartbeatInterval),e.emit("playbackheartbeatend",{viewer_time:r.viewer_time}),t._playbackHeartbeatInterval=null)})}return bi(i,[{key:"_startPlaybackHeartbeatInterval",value:function(){var e=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=Gu.default.setInterval(function(){e.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(Gu.default.clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}]),i})(),eA=J_,tA=function i(e){var t=this;it(this,i),K(this,"viewErrored",void 0),e.on("viewinit",function(){t.viewErrored=!1}),e.on("error",function(s,r){try{var n=e.errorTranslator({player_error_code:r.player_error_code,player_error_message:r.player_error_message,player_error_context:r.player_error_context,player_error_severity:r.player_error_severity,player_error_business_exception:r.player_error_business_exception});n&&(e.data.player_error_code=n.player_error_code||r.player_error_code,e.data.player_error_message=n.player_error_message||r.player_error_message,e.data.player_error_context=n.player_error_context||r.player_error_context,e.data.player_error_severity=n.player_error_severity||r.player_error_severity,e.data.player_error_business_exception=n.player_error_business_exception||r.player_error_business_exception,t.viewErrored=!0)}catch(a){e.mux.log.warn("Exception in error translator callback.",a),t.viewErrored=!0}}),e.on("aftererror",function(){var s,r,n,a,o;(s=e.data)===null||s===void 0||delete s.player_error_code,(r=e.data)===null||r===void 0||delete r.player_error_message,(n=e.data)===null||n===void 0||delete n.player_error_context,(a=e.data)===null||a===void 0||delete a.player_error_severity,(o=e.data)===null||o===void 0||delete o.player_error_business_exception})},iA=tA,sA=(function(){function i(e){it(this,i),K(this,"_watchTimeTrackerLastCheckedTime",void 0),K(this,"pm",void 0),this.pm=e,this._watchTimeTrackerLastCheckedTime=null,e.on("playbackheartbeat",this._updateWatchTime.bind(this)),e.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}return bi(i,[{key:"_updateWatchTime",value:function(e,t){var s=t.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=s),ct(this.pm.data,"view_watch_time",s-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=s}},{key:"_clearWatchTimeState",value:function(e,t){this._updateWatchTime(e,t),this._watchTimeTrackerLastCheckedTime=null}}]),i})(),rA=sA,nA=(function(){function i(e){var t=this;it(this,i),K(this,"_playbackTimeTrackerLastPlayheadPosition",void 0),K(this,"_lastTime",void 0),K(this,"_isAdPlaying",void 0),K(this,"_callbackUpdatePlaybackTime",void 0),K(this,"pm",void 0),this.pm=e,this._playbackTimeTrackerLastPlayheadPosition=-1,this._lastTime=gt.now(),this._isAdPlaying=!1,this._callbackUpdatePlaybackTime=null,e.on("viewinit",function(){t.pm.data.view_playing_time_ms_cumulative=0});var s=this._startPlaybackTimeTracking.bind(this);e.on("playing",s),e.on("adplaying",s);var r=function(){t.pm.data.player_is_paused||s()};e.on("seeked",r),e.on("rebufferend",r);var n=this._stopPlaybackTimeTracking.bind(this);e.on("playbackheartbeatend",n),e.on("seeking",n),e.on("rebufferstart",n),e.on("adplaying",function(){t._isAdPlaying=!0}),e.on("adended",function(){t._isAdPlaying=!1}),e.on("adpause",function(){t._isAdPlaying=!1}),e.on("adbreakstart",function(){t._isAdPlaying=!1}),e.on("adbreakend",function(){t._isAdPlaying=!1}),e.on("adplay",function(){t._isAdPlaying=!1}),e.on("viewinit",function(){t._playbackTimeTrackerLastPlayheadPosition=-1,t._lastTime=gt.now(),t._isAdPlaying=!1,t._callbackUpdatePlaybackTime=null})}return bi(i,[{key:"_startPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime===null&&(this._callbackUpdatePlaybackTime=this._updatePlaybackTime.bind(this),this._playbackTimeTrackerLastPlayheadPosition=this.pm.data.player_playhead_time,this._lastTime=gt.now(),this.pm.on("playbackheartbeat",this._callbackUpdatePlaybackTime))}},{key:"_stopPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime&&(this._updatePlaybackTime(),this.pm.off("playbackheartbeat",this._callbackUpdatePlaybackTime),this._callbackUpdatePlaybackTime=null,this._playbackTimeTrackerLastPlayheadPosition=-1)}},{key:"_updatePlaybackTime",value:function(){var e=this.pm.data.player_playhead_time||0,t=gt.now(),s=t-this._lastTime,r=-1;this._playbackTimeTrackerLastPlayheadPosition>=0&&e>this._playbackTimeTrackerLastPlayheadPosition?r=e-this._playbackTimeTrackerLastPlayheadPosition:this._isAdPlaying&&(r=s),r>0&&r<=1e3&&ct(this.pm.data,"view_content_playback_time",r),this._callbackUpdatePlaybackTime!==null&&s>0&&s<=1e3&&(this._isAdPlaying&&ct(this.pm.data,"ad_playing_time_ms_cumulative",s),ct(this.pm.data,"view_playing_time_ms_cumulative",s)),this._playbackTimeTrackerLastPlayheadPosition=e,this._lastTime=t}}]),i})(),aA=nA,oA=(function(){function i(e){it(this,i),K(this,"pm",void 0),this.pm=e;var t=this._updatePlayheadTime.bind(this);e.on("playbackheartbeat",t),e.on("playbackheartbeatend",t),e.on("timeupdate",t),e.on("destroy",function(){e.off("timeupdate",t)})}return bi(i,[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=typeof this.pm.data.view_max_playhead_position>"u"?this.pm.data.player_playhead_time:Math.max(this.pm.data.view_max_playhead_position,this.pm.data.player_playhead_time)}},{key:"_updatePlayheadTime",value:function(e,t){var s=this,r=function(){s.pm.currentFragmentPDT&&s.pm.currentFragmentStart&&(s.pm.data.player_program_time=s.pm.currentFragmentPDT+s.pm.data.player_playhead_time-s.pm.currentFragmentStart)};if(t&&t.player_playhead_time)this.pm.data.player_playhead_time=t.player_playhead_time,r(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var n=this.pm.getPlayheadTime();typeof n<"u"&&(this.pm.data.player_playhead_time=n,r(),this._updateMaxPlayheadPosition())}}}]),i})(),lA=oA,Sp=300*1e3,dA=function i(e){if(it(this,i),!e.disableRebufferTracking){var t,s=function(n,a){r(a),t=void 0},r=function(n){if(t){var a=n.viewer_time-t;ct(e.data,"view_rebuffer_duration",a),t=n.viewer_time,e.data.view_rebuffer_duration>Sp&&(e.emit("viewend"),e.send("viewend"),e.mux.log.warn("Ending view after rebuffering for longer than ".concat(Sp,"ms, future events will be ignored unless a programchange or videochange occurs.")))}e.data.view_watch_time>=0&&e.data.view_rebuffer_count>0&&(e.data.view_rebuffer_frequency=e.data.view_rebuffer_count/e.data.view_watch_time,e.data.view_rebuffer_percentage=e.data.view_rebuffer_duration/e.data.view_watch_time)};e.on("playbackheartbeat",function(n,a){return r(a)}),e.on("rebufferstart",function(n,a){t||(ct(e.data,"view_rebuffer_count",1),t=a.viewer_time,e.one("rebufferend",s))}),e.on("viewinit",function(){t=void 0,e.off("rebufferend",s)})}},uA=dA,cA=(function(){function i(e){var t=this;it(this,i),K(this,"_lastCheckedTime",void 0),K(this,"_lastPlayheadTime",void 0),K(this,"_lastPlayheadTimeUpdatedTime",void 0),K(this,"_rebuffering",void 0),K(this,"pm",void 0),this.pm=e,!(e.disableRebufferTracking||e.disablePlayheadRebufferTracking)&&(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,e.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),e.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),e.on("seeking",function(){t._cleanupRebufferTracker(null,{viewer_time:gt.now()})}))}return bi(i,[{key:"_checkIfRebuffering",value:function(e,t){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing){this._cleanupRebufferTracker(e,t);return}if(this._lastCheckedTime===null){this._prepareRebufferTrackerState(t.viewer_time);return}if(this._lastPlayheadTime!==this.pm.data.player_playhead_time){this._cleanupRebufferTracker(e,t,!0);return}var s=t.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&s>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=t.viewer_time}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(e){this._lastCheckedTime=e,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=e}},{key:"_cleanupRebufferTracker",value:function(e,t){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:t.viewer_time});else{if(this._lastCheckedTime===null)return;var r=this.pm.data.player_playhead_time-this._lastPlayheadTime,n=t.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&r>0&&n-r>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+n-r}))}s?this._prepareRebufferTrackerState(t.viewer_time):this._clearRebufferTrackerState()}}]),i})(),hA=cA,fA=(function(){function i(e){var t=this;it(this,i),K(this,"pm",void 0),this.pm=e,e.on("viewinit",function(){var s=e.data,r=s.view_id;if(!s.view_program_changed){var n=function(a,o){var l=o.viewer_time;(a.type==="playing"&&typeof e.data.view_time_to_first_frame>"u"||a.type==="adplaying"&&(typeof e.data.view_time_to_first_frame>"u"||t._inPrerollPosition()))&&t.calculateTimeToFirstFrame(l||gt.now(),r)};e.one("playing",n),e.one("adplaying",n),e.one("viewend",function(){e.off("playing",n),e.off("adplaying",n)})}})}return bi(i,[{key:"_inPrerollPosition",value:function(){return typeof this.pm.data.view_content_playback_time>"u"||this.pm.data.view_content_playback_time<=1e3}},{key:"calculateTimeToFirstFrame",value:function(e,t){t===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:e}),this.pm.data.view_time_to_first_frame=this.pm.data.view_watch_time,(this.pm.data.player_autoplay_on||this.pm.data.video_is_autoplay)&&this.pm.pageLoadInitTime&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.pm.pageLoadInitTime))}}]),i})(),mA=fA,pA=function i(e){var t=this;it(this,i),K(this,"_lastPlayerHeight",void 0),K(this,"_lastPlayerWidth",void 0),K(this,"_lastPlayheadPosition",void 0),K(this,"_lastSourceHeight",void 0),K(this,"_lastSourceWidth",void 0),e.on("viewinit",function(){t._lastPlayheadPosition=-1});var s=["pause","rebufferstart","seeking","error","adbreakstart","hb","renditionchange","orientationchange","viewend","playbackmodechange"],r=["playing","hb","renditionchange","orientationchange","playbackmodechange"];s.forEach(function(n){e.on(n,function(){if(t._lastPlayheadPosition>=0&&e.data.player_playhead_time>=0&&t._lastPlayerWidth>=0&&t._lastSourceWidth>0&&t._lastPlayerHeight>=0&&t._lastSourceHeight>0){var a=e.data.player_playhead_time-t._lastPlayheadPosition;if(a<0){t._lastPlayheadPosition=-1;return}var o=Math.min(t._lastPlayerWidth/t._lastSourceWidth,t._lastPlayerHeight/t._lastSourceHeight),l=Math.max(0,o-1),d=Math.max(0,1-o);e.data.view_max_upscale_percentage=Math.max(e.data.view_max_upscale_percentage||0,l),e.data.view_max_downscale_percentage=Math.max(e.data.view_max_downscale_percentage||0,d),ct(e.data,"view_total_content_playback_time",a),ct(e.data,"view_total_upscaling",l*a),ct(e.data,"view_total_downscaling",d*a)}t._lastPlayheadPosition=-1})}),r.forEach(function(n){e.on(n,function(){t._lastPlayheadPosition=e.data.player_playhead_time,t._lastPlayerWidth=e.data.player_width,t._lastPlayerHeight=e.data.player_height,t._lastSourceWidth=e.data.video_source_width,t._lastSourceHeight=e.data.video_source_height})})},gA=pA,vA=2e3,EA=function i(e){var t=this;it(this,i),K(this,"isSeeking",void 0),this.isSeeking=!1;var s=-1,r=function(){var n=gt.now(),a=(e.data.viewer_time||n)-(s||n);ct(e.data,"view_seek_duration",a),e.data.view_max_seek_time=Math.max(e.data.view_max_seek_time||0,a),t.isSeeking=!1,s=-1};e.on("seeking",function(n,a){if(Object.assign(e.data,a),t.isSeeking&&a.viewer_time-s<=vA){s=a.viewer_time;return}t.isSeeking&&r(),t.isSeeking=!0,s=a.viewer_time,ct(e.data,"view_seek_count",1),e.send("seeking")}),e.on("seeked",function(){r()}),e.on("viewend",function(){t.isSeeking&&(r(),e.send("seeked")),t.isSeeking=!1,s=-1})},yA=EA,Ip=function(i,e){i.push(e),i.sort(function(t,s){return t.viewer_time-s.viewer_time})},bA=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror","adclicked","adskipped"],TA=(function(){function i(e){var t=this;it(this,i),K(this,"_adHasPlayed",void 0),K(this,"_adRequests",void 0),K(this,"_adResponses",void 0),K(this,"_currentAdRequestNumber",void 0),K(this,"_currentAdResponseNumber",void 0),K(this,"_prerollPlayTime",void 0),K(this,"_wouldBeNewAdPlay",void 0),K(this,"isAdBreak",void 0),K(this,"pm",void 0),this.pm=e,e.on("viewinit",function(){t.isAdBreak=!1,t._currentAdRequestNumber=0,t._currentAdResponseNumber=0,t._adRequests=[],t._adResponses=[],t._adHasPlayed=!1,t._wouldBeNewAdPlay=!0,t._prerollPlayTime=void 0}),bA.forEach(function(r){return e.on(r,t._updateAdData.bind(t))});var s=function(){t.isAdBreak=!1};e.on("adbreakstart",function(){t.isAdBreak=!0}),e.on("play",s),e.on("playing",s),e.on("viewend",s),e.on("adrequest",function(r,n){n=Object.assign({ad_request_id:"generatedAdRequestId"+t._currentAdRequestNumber++},n),Ip(t._adRequests,n),ct(e.data,"view_ad_request_count"),t.inPrerollPosition()&&(e.data.view_preroll_requested=!0,t._adHasPlayed||ct(e.data,"view_preroll_request_count"))}),e.on("adresponse",function(r,n){n=Object.assign({ad_request_id:"generatedAdRequestId"+t._currentAdResponseNumber++},n),Ip(t._adResponses,n);var a=t.findAdRequest(n.ad_request_id);a&&ct(e.data,"view_ad_request_time",Math.max(0,n.viewer_time-a.viewer_time))}),e.on("adplay",function(r,n){t._adHasPlayed=!0,t._wouldBeNewAdPlay&&(t._wouldBeNewAdPlay=!1,ct(e.data,"view_ad_played_count")),t.inPrerollPosition()&&!e.data.view_preroll_played&&(e.data.view_preroll_played=!0,t._adRequests.length>0&&(e.data.view_preroll_request_time=Math.max(0,n.viewer_time-t._adRequests[0].viewer_time)),e.data.view_start&&(e.data.view_startup_preroll_request_time=Math.max(0,n.viewer_time-e.data.view_start)),t._prerollPlayTime=n.viewer_time)}),e.on("adplaying",function(r,n){t.inPrerollPosition()&&typeof e.data.view_preroll_load_time>"u"&&typeof t._prerollPlayTime<"u"&&(e.data.view_preroll_load_time=n.viewer_time-t._prerollPlayTime,e.data.view_startup_preroll_load_time=n.viewer_time-t._prerollPlayTime)}),e.on("adclicked",function(r,n){t._wouldBeNewAdPlay||ct(e.data,"view_ad_clicked_count")}),e.on("adskipped",function(r,n){t._wouldBeNewAdPlay||ct(e.data,"view_ad_skipped_count")}),e.on("adended",function(){t._wouldBeNewAdPlay=!0}),e.on("aderror",function(){t._wouldBeNewAdPlay=!0})}return bi(i,[{key:"inPrerollPosition",value:function(){return typeof this.pm.data.view_content_playback_time>"u"||this.pm.data.view_content_playback_time<=1e3}},{key:"findAdRequest",value:function(e){for(var t=0;t3e4&&(e.emit("devicesleep",{viewer_time:o}),Object.assign(e.data,{viewer_time:o}),e.send("devicesleep"),e.emit("devicewake",{viewer_time:a}),Object.assign(e.data,{viewer_time:a}),e.send("devicewake"))};e.one("playbackheartbeat",s),e.on("playbackheartbeatend",function(){e.off("before*",r),e.one("playbackheartbeat",s)})},SA=AA,Ku=ii(Ji()),Pv=(function(i){return i()})(function(){var i=function(){for(var t=0,s={};t1){if(a=i({path:"/"},s.defaults,a),typeof a.expires=="number"){var l=new Date;l.setMilliseconds(l.getMilliseconds()+a.expires*864e5),a.expires=l}try{o=JSON.stringify(n),/^[\{\[]/.test(o)&&(n=o)}catch{}return t.write?n=t.write(n,r):n=encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),r=encodeURIComponent(String(r)),r=r.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),r=r.replace(/[\(\)]/g,escape),document.cookie=[r,"=",n,a.expires?"; expires="+a.expires.toUTCString():"",a.path?"; path="+a.path:"",a.domain?"; domain="+a.domain:"",a.secure?"; secure":""].join("")}r||(o={});for(var d=document.cookie?document.cookie.split("; "):[],u=/(%[0-9A-Z]{2})+/g,c=0;c1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=i||FA,this._eventQueue=[],this._postInFlight=!1,this._resendAfterPost=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},NA,e)};ps.prototype.queueEvent=function(i,e){var t=Object.assign({},e);return this._eventQueue.length<=this._options.maxQueueLength||i==="eventrateexceeded"?(this._eventQueue.push(t),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength):!1};ps.prototype.flushEvents=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(i&&this._eventQueue.length===1){this._eventQueue.pop();return}this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending()};ps.prototype.destroy=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.destroyed=!0,i?this._clearBeaconQueue():this.flushEvents(),mr.default.clearTimeout(this._sendTimeout)};ps.prototype._clearBeaconQueue=function(){var i=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,e=this._eventQueue.slice(i);i>0&&Object.assign(e[e.length-1],Uc({mux_view_message:"event queue truncated"}));var t=this._createPayload(e);Hv(this._beaconUrl,t,!0,function(){})};ps.prototype._sendBeaconQueue=function(){var i=this;if(this._postInFlight){this._resendAfterPost=!0;return}var e=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var t=this._createPayload(e),s=gt.now();Hv(this._beaconUrl,t,!1,function(r,n){n?(i._eventQueue=e.concat(i._eventQueue),i._failureCount+=1,we.info("Error sending beacon: "+n)):i._failureCount=0,i._roundTripTime=gt.now()-s,i._postInFlight=!1,i._resendAfterPost&&(i._resendAfterPost=!1,i._eventQueue.length>0&&i._sendBeaconQueue())})};ps.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var i=Math.pow(2,this._failureCount-1);return i=i*Math.random(),(1+i)*this._options.baseTimeBetweenBeacons};ps.prototype._startBeaconSending=function(){var i=this;mr.default.clearTimeout(this._sendTimeout),!this.destroyed&&(this._sendTimeout=mr.default.setTimeout(function(){i._eventQueue.length&&i._sendBeaconQueue(),i._startBeaconSending()},this._getNextBeaconTime()))};ps.prototype._createPayload=function(i){var e=this,t={transmission_timestamp:Math.round(gt.now())};this._roundTripTime&&(t.rtt_ms=Math.round(this._roundTripTime));var s,r,n,a=function(){s=JSON.stringify({metadata:t,events:r||i}),n=s.length/1024},o=function(){return n<=e._options.maxPayloadKBSize};return a(),o()||(we.info("Payload size is too big ("+n+" kb). Removing unnecessary events."),r=i.filter(function(l){return $A.indexOf(l.e)===-1}),a()),o()||(we.info("Payload size still too big ("+n+" kb). Cropping fields.."),r.forEach(function(l){for(var d in l){var u=l[d],c=50*1024;typeof u=="string"&&u.length>c&&(l[d]=u.substring(0,c))}}),a()),s};var BA=typeof OA.default.exitPictureInPicture=="function"?function(i){return i.length<=UA}:function(i){return!1},Hv=function(i,e,t,s){if(t&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(i,e)){s();return}if(mr.default.fetch){mr.default.fetch(i,{method:"POST",body:e,headers:{"Content-Type":"text/plain"},keepalive:BA(e)}).then(function(n){return s(null,n.ok?null:"Error")}).catch(function(n){return s(null,n)});return}if(mr.default.XMLHttpRequest){var r=new mr.default.XMLHttpRequest;r.onreadystatechange=function(){if(r.readyState===4)return s(null,r.status!==200?"error":void 0)},r.open("POST",i),r.setRequestHeader("Content-Type","text/plain"),r.send(e);return}s()},HA=ps,GA=["env_key","view_id","view_sequence_number","player_sequence_number","beacon_domain","player_playhead_time","viewer_time","mux_api_version","event","video_id","player_instance_id","player_error_code","player_error_message","player_error_context","player_error_severity","player_error_business_exception","view_playing_time_ms_cumulative","ad_playing_time_ms_cumulative"],KA=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse","adrequest"],VA=["ad_id","ad_creative_id","ad_universal_id"],WA=["viewstart","error","ended","viewend"],qA=600*1e3,YA=(function(){function i(e,t){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};it(this,i);var r,n,a,o,l,d,u,c,h,f,m,p;K(this,"mux",void 0),K(this,"envKey",void 0),K(this,"options",void 0),K(this,"eventQueue",void 0),K(this,"sampleRate",void 0),K(this,"disableCookies",void 0),K(this,"respectDoNotTrack",void 0),K(this,"previousBeaconData",void 0),K(this,"lastEventTime",void 0),K(this,"rateLimited",void 0),K(this,"pageLevelData",void 0),K(this,"viewerData",void 0),this.mux=e,this.envKey=t,this.options=s,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.eventQueue=new HA(kA(this.envKey,this.options));var g;this.sampleRate=(g=this.options.sampleRate)!==null&&g!==void 0?g:1;var v;this.disableCookies=(v=this.options.disableCookies)!==null&&v!==void 0?v:!1;var b;this.respectDoNotTrack=(b=this.options.respectDoNotTrack)!==null&&b!==void 0?b:!1,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:(r=this.options.platform)===null||r===void 0?void 0:r.name,viewer_application_version:(n=this.options.platform)===null||n===void 0?void 0:n.version,viewer_application_engine:(a=this.options.platform)===null||a===void 0?void 0:a.layout,viewer_device_name:(o=this.options.platform)===null||o===void 0?void 0:o.product,viewer_device_category:"",viewer_device_manufacturer:(l=this.options.platform)===null||l===void 0?void 0:l.manufacturer,viewer_os_family:(u=this.options.platform)===null||u===void 0||(d=u.os)===null||d===void 0?void 0:d.family,viewer_os_architecture:(h=this.options.platform)===null||h===void 0||(c=h.os)===null||c===void 0?void 0:c.architecture,viewer_os_version:(m=this.options.platform)===null||m===void 0||(f=m.os)===null||f===void 0?void 0:f.version,viewer_connection_type:CA(),page_url:Ku.default===null||Ku.default===void 0||(p=Ku.default.location)===null||p===void 0?void 0:p.href},this.viewerData=this.disableCookies?{}:RA()}return bi(i,[{key:"send",value:function(e,t){if(!(!e||!(t!=null&&t.view_id))){if(this.respectDoNotTrack&&Oc())return we.info("Not sending `"+e+"` because Do Not Track is enabled");if(!t||typeof t!="object")return we.error("A data object was expected in send() but was not provided");var s=this.disableCookies?{}:xA(),r=xf(Ld({},this.pageLevelData,t,s,this.viewerData),{event:e,env_key:this.envKey});r.user_id&&(r.viewer_user_id=r.user_id,delete r.user_id);var n,a=((n=r.mux_sample_number)!==null&&n!==void 0?n:0)>=this.sampleRate,o=this._deduplicateBeaconData(e,r),l=Uc(o);if(this.lastEventTime=this.mux.utils.now(),a)return we.info("Not sending event due to sample rate restriction",e,r,l);if(this.envKey||we.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",e,r,l),!this.rateLimited)if(we.info("Sending event",e,r,l),this.rateLimited=!this.eventQueue.queueEvent(e,l),this.mux.WINDOW_UNLOADING&&e==="viewend")this.eventQueue.destroy(!0);else{if(this.mux.WINDOW_HIDDEN&&e==="hb")this.eventQueue.flushEvents(!0);else if(WA.indexOf(e)>=0){if(e==="error"&&t.player_error_severity==="warning")return;this.eventQueue.flushEvents()}if(this.rateLimited)return r.event="eventrateexceeded",l=Uc(r),this.eventQueue.queueEvent(r.event,l),we.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(e,t){var s=this,r={},n=t.view_id;if(n==="-1"||e==="viewstart"||e==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=qA)r=Ld({},t),n&&(this.previousBeaconData=r),n&&e==="viewend"&&(this.previousBeaconData=null);else{var a=e.indexOf("request")===0;Object.entries(t).forEach(function(o){var l=fs(o,2),d=l[0],u=l[1];s.previousBeaconData&&(u!==s.previousBeaconData[d]||GA.indexOf(d)>-1||s.objectHasChanged(a,d,u,s.previousBeaconData[d])||s.eventRequiresKey(e,d))&&(r[d]=u,s.previousBeaconData[d]=u)})}return r}},{key:"objectHasChanged",value:function(e,t,s,r){return!e||t.indexOf("request_")!==0?!1:t==="request_response_headers"||typeof s!="object"||typeof r!="object"?!0:Object.keys(s||{}).length!==Object.keys(r||{}).length}},{key:"eventRequiresKey",value:function(e,t){return!!(e==="renditionchange"&&t.indexOf("video_source_")===0||VA.includes(t)&&KA.includes(e)||e==="playbackmodechange"&&t.indexOf("player_playback_mode")===0)}}]),i})(),jA=function i(e){it(this,i);var t=0,s=0,r=0,n=0,a=0,o=0,l=0,d=function(h,f){var m=f.request_start,p=f.request_response_start,g=f.request_response_end,v=f.request_bytes_loaded;n++;var b,y;if(p?(b=p-(m??0),y=(g??0)-p):y=(g??0)-(m??0),y>0&&v&&v>0){var T=v/y*8e3;a++,s+=v,r+=y,e.data.view_min_request_throughput=Math.min(e.data.view_min_request_throughput||1/0,T),e.data.view_average_request_throughput=s/r*8e3,e.data.view_request_count=n,b>0&&(t+=b,e.data.view_max_request_latency=Math.max(e.data.view_max_request_latency||0,b),e.data.view_average_request_latency=t/a)}},u=function(h,f){n++,o++,e.data.view_request_count=n,e.data.view_request_failed_count=o},c=function(h,f){n++,l++,e.data.view_request_count=n,e.data.view_request_canceled_count=l};e.on("requestcompleted",d),e.on("requestfailed",u),e.on("requestcanceled",c)},zA=jA,QA=3600*1e3,XA=function i(e){var t=this;it(this,i),K(this,"_lastEventTime",void 0),e.on("before*",function(s,r){var n=r.viewer_time,a=gt.now(),o=t._lastEventTime;if(t._lastEventTime=a,o&&a-o>QA){var l=Object.keys(e.data).reduce(function(u,c){return c.indexOf("video_")===0?Object.assign(u,K({},c,e.data[c])):u},{});e.mux.log.info("Received event after at least an hour inactivity, creating a new view");var d=e.playbackHeartbeat._playheadShouldBeProgressing;e._resetView(Object.assign({viewer_time:n},l)),e.playbackHeartbeat._playheadShouldBeProgressing=d,e.playbackHeartbeat._playheadShouldBeProgressing&&s.type!=="play"&&s.type!=="adbreakstart"&&(e.emit("play",{viewer_time:n}),s.type!=="playing"&&e.emit("playing",{viewer_time:n}))}})},ZA=XA,JA=function i(e){it(this,i);var t=function(o){var l=eS(o),d=tS(o);if(l!=null&&!Rp(l,n)&&a<=d){n=l,a=d;var u={video_cdn:l};e.emit("cdnchange",u)}},s=null,r=null,n=null,a=0;e.on("viewinit",function(){s=null,r=null,n=null,a=0}),e.on("beforecdnchange",function(o,l){var d=l?.video_cdn;d&&(typeof l.video_previous_cdn>"u"||l.video_previous_cdn===null)&&(Rp(d,r)?l.video_previous_cdn=s??void 0:(l.video_previous_cdn=r??void 0,s=r,r=d))}),e.on("requestcompleted",function(o,l){t(l)})};function Rp(i,e){return i?.toLowerCase()===e?.toLowerCase()}function eS(i){var e;return i!=null&&i.request_type&&(i.request_type==="media"||i.request_type==="video")&&!((e=i.request_response_headers)===null||e===void 0)&&e["x-cdn"]?i.request_response_headers["x-cdn"]:i!=null&&i.video_cdn?i.video_cdn:null}function tS(i){return i!=null&&i.request_start?i.request_start:i!=null&&i.viewer_time?i.viewer_time:Date.now()}var iS=JA,sS=function(i){try{return JSON.parse(i),!0}catch{return!1}},rS=function i(e){var t=this;it(this,i),K(this,"_emittingAutomaticEvent",!1),K(this,"_hasInitialized",!1),K(this,"_currentMode","standard"),e.on("viewstart",function(){t._hasInitialized||(t._hasInitialized=!0,t._currentMode=e.data.player_playback_mode||"standard",t._emittingAutomaticEvent=!0,e.emit("playbackmodechange",{player_playback_mode:t._currentMode,player_playback_mode_data:"{}"}),t._emittingAutomaticEvent=!1)}),e.on("viewend",function(){t._hasInitialized=!1}),e.on("playbackmodechange",function(s,r){t._emittingAutomaticEvent||(r.player_playback_mode_data?sS(r.player_playback_mode_data)||(e.mux.log.warn("Invalid JSON string for player_playback_mode_data"),r.player_playback_mode_data="{}"):r.player_playback_mode_data="{}",e.data.player_playback_mode_data=r.player_playback_mode_data,e.data.player_playback_mode=r.player_playback_mode,t._currentMode=r.player_playback_mode)})},nS=rS,aS=(function(){function i(e){it(this,i),K(this,"pm",void 0),K(this,"_currentRangeStart",void 0),K(this,"_lastPlayheadTime",void 0),this.pm=e,this._currentRangeStart=null,this._lastPlayheadTime=null,e.on("playbackheartbeat",this._updatePlaybackRange.bind(this)),e.on("playbackheartbeatend",this._endPlaybackRange.bind(this))}return bi(i,[{key:"_updateLastRangeEnd",value:function(){var e=this.pm.data.video_playback_ranges;if(e&&e.length>0){var t=this.pm.data.player_playhead_time||0;e[e.length-1][1]=t}}},{key:"_updatePlaybackRange",value:function(){var e,t=this.pm.data.player_playhead_time||0;if(!(!this.pm.disableAdPlaybackRangeFiltering&&!((e=this.pm.adTracker)===null||e===void 0)&&e.isAdBreak&&this._lastPlayheadTime!==null&&t1e3){var r=this.pm.data.video_playback_ranges;r&&r.length>0&&(r[r.length-1][1]=this._lastPlayheadTime),this._currentRangeStart=null}}if(this._currentRangeStart===null){var n=this.pm.data.video_playback_ranges||[];n.length>0&&n[n.length-1][1]===t?this._currentRangeStart=n[n.length-1][0]:(this._currentRangeStart=t,n.push([t,t])),this.pm.data.video_playback_ranges=n}else this._updateLastRangeEnd();this._lastPlayheadTime=t}}},{key:"_endPlaybackRange",value:function(){this._currentRangeStart!==null&&(this._updateLastRangeEnd(),this._currentRangeStart=null,this._lastPlayheadTime=null)}}]),i})(),oS=aS,lS=["viewstart","ended","loadstart","pause","play","playing","ratechange","waiting","adplay","adpause","adended","aderror","adplaying","adrequest","adresponse","adbreakstart","adbreakend","adfirstquartile","admidpoint","adthirdquartile","rebufferstart","rebufferend","seeked","error","hb","requestcompleted","requestfailed","requestcanceled","renditionchange","cdnchange","playbackmodechange"],dS=new Set(["requestcompleted","requestfailed","requestcanceled"]),uS=(function(i){M_(t,i);var e=$_(t);function t(s,r,n){it(this,t);var a;a=e.call(this),K(oe(a),"pageLoadEndTime",void 0),K(oe(a),"pageLoadInitTime",void 0),K(oe(a),"_destroyed",void 0),K(oe(a),"_heartBeatTimeout",void 0),K(oe(a),"adTracker",void 0),K(oe(a),"dashjs",void 0),K(oe(a),"data",void 0),K(oe(a),"disablePlayheadRebufferTracking",void 0),K(oe(a),"disableRebufferTracking",void 0),K(oe(a),"disableAdPlaybackRangeFiltering",void 0),K(oe(a),"errorTracker",void 0),K(oe(a),"errorTranslator",void 0),K(oe(a),"emitTranslator",void 0),K(oe(a),"getAdData",void 0),K(oe(a),"getPlayheadTime",void 0),K(oe(a),"getStateData",void 0),K(oe(a),"stateDataTranslator",void 0),K(oe(a),"hlsjs",void 0),K(oe(a),"id",void 0),K(oe(a),"longResumeTracker",void 0),K(oe(a),"minimumRebufferDuration",void 0),K(oe(a),"mux",void 0),K(oe(a),"playbackEventDispatcher",void 0),K(oe(a),"playbackHeartbeat",void 0),K(oe(a),"playbackHeartbeatTime",void 0),K(oe(a),"playheadTime",void 0),K(oe(a),"seekingTracker",void 0),K(oe(a),"sustainedRebufferThreshold",void 0),K(oe(a),"watchTimeTracker",void 0),K(oe(a),"currentFragmentPDT",void 0),K(oe(a),"currentFragmentStart",void 0),a.pageLoadInitTime=Id.navigationStart(),a.pageLoadEndTime=Id.domContentLoadedEventEnd();var o={debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,disableAdPlaybackRangeFiltering:!1,errorTranslator:function(h){return h},emitTranslator:function(){for(var h=arguments.length,f=new Array(h),m=0;m"u"&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"),this.emit("renditionchange"))}).bind(oe(a));if(a.on("viewinit",function(h,f){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,f),this._initializeViewData(),this.one("play",l),this.one("adbreakstart",l)}),a.on("videochange",function(h,f){this._resetView(f)}),a.on("programchange",function(h,f){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),this._resetView(Object.assign(f,{view_program_changed:!0})),l(),this.emit("play"),this.emit("playing")}),a.on("fragmentchange",function(h,f){this.currentFragmentPDT=f.currentFragmentPDT,this.currentFragmentStart=f.currentFragmentStart}),a.on("destroy",a.destroy),typeof window<"u"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var d=function(){var h=typeof a.data.view_start<"u";a.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",h&&a.mux.WINDOW_HIDDEN&&(a.data.player_is_paused||a.emit("hb"))};window.addEventListener("visibilitychange",d,!1);var u=function(h){h.persisted||a.destroy()};window.addEventListener("pagehide",u,!1),a.on("destroy",function(){window.removeEventListener("visibilitychange",d),window.removeEventListener("pagehide",u)})}a.on("playerready",function(h,f){Object.assign(this.data,f)}),lS.forEach(function(h){a.on(h,function(f,m){h.indexOf("ad")!==0&&this._updateStateData(),Object.assign(this.data,m),this._sanitizeData()}),a.on("after"+h,function(){(h!=="error"||this.errorTracker.viewErrored)&&this.send(h)})}),a.on("viewend",function(h,f){Object.assign(a.data,f)});var c=function(h){var f=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=f-this.data.player_init_time),this.pageLoadInitTime=this.data.page_load_init_time||this.pageLoadInitTime,this.pageLoadEndTime=this.data.page_load_end_time||this.pageLoadEndTime,!this.mux.PLAYER_TRACKED&&this.pageLoadInitTime&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.pageLoadEndTime)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.pageLoadEndTime||1/0)-this.pageLoadInitTime)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time};return a.one("playerready",c),a.longResumeTracker=new ZA(oe(a)),a.errorTracker=new iA(oe(a)),new SA(oe(a)),a.seekingTracker=new yA(oe(a)),a.playheadTime=new lA(oe(a)),a.playbackHeartbeat=new eA(oe(a)),new gA(oe(a)),a.watchTimeTracker=new rA(oe(a)),new aA(oe(a)),new oS(oe(a)),a.adTracker=new _A(oe(a)),new hA(oe(a)),new uA(oe(a)),new mA(oe(a)),new zA(oe(a)),new iS(oe(a)),new nS(oe(a)),n.hlsjs&&a.addHLSJS(n),n.dashjs&&a.addDashJS(n),a.emit("viewinit",n.data),a}return bi(t,[{key:"emit",value:function(s,r){var n,a=Object.assign({viewer_time:this.mux.utils.now()},r),o=[s,a];if(this.emitTranslator)try{o=this.emitTranslator(s,a)}catch(l){this.mux.log.warn("Exception in emit translator callback.",l)}o!=null&&o.length&&(n=ol($n(t.prototype),"emit",this)).call.apply(n,[this].concat(ui(o)))}},{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,typeof this.data.view_start<"u"&&(this.emit("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(s){if(this.data.view_id){var r=Object.assign({},this.data),n=["player_program_time","player_manifest_newest_program_time","player_live_edge_program_time","player_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"];if(r.video_source_is_live===void 0&&(r.player_source_duration===1/0||r.video_source_duration===1/0?r.video_source_is_live=!0:(r.player_source_duration>0||r.video_source_duration>0)&&(r.video_source_is_live=!1)),r.video_source_is_live||n.forEach(function(d){r[d]=void 0}),r.video_source_url=r.video_source_url||r.player_source_url,r.video_source_url){var a=fs(Xa(r.video_source_url),2),o=a[0],l=a[1];r.video_source_domain=l,r.video_source_hostname=o}delete r.ad_request_id,r.video_playback_ranges&&(r.video_playback_range=JSON.stringify(r.video_playback_ranges.filter(function(d){return d[0]!==d[1]}).map(function(d){return"".concat(d[0],":").concat(d[1])})),delete r.video_playback_ranges),this.playbackEventDispatcher.send(s,r),this.data.view_sequence_number++,this.data.player_sequence_number++,dS.has(s)||this._restartHeartBeat(),s==="viewend"&&delete this.data.view_id}}},{key:"_resetView",value:function(s){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",s)}},{key:"_updateStateData",value:function(){var s,r=this.getStateData();if(typeof this.stateDataTranslator=="function")try{r=this.stateDataTranslator(r)}catch(a){this.mux.log.warn("Exception in stateDataTranslator translator callback.",a)}if(!((s=this.data)===null||s===void 0)&&s.video_cdn&&r!=null&&r.video_cdn){r.video_cdn;var n=O_(r,["video_cdn"]);r=n}Object.assign(this.data,r),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var s=this,r=["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"];r.forEach(function(a){var o=parseInt(s.data[a],10);s.data[a]=isNaN(o)?void 0:o});var n=["player_source_url","video_source_url"];n.forEach(function(a){if(s.data[a]){var o=s.data[a].toLowerCase();(o.indexOf("data:")===0||o.indexOf("blob:")===0)&&(s.data[a]="MSE style URL")}})}},{key:"_resetVideoData",value:function(){var s=this;Object.keys(this.data).forEach(function(r){r.indexOf("video_")===0&&delete s.data[r]})}},{key:"_resetViewData",value:function(){var s=this;Object.keys(this.data).forEach(function(r){r.indexOf("view_")===0&&delete s.data[r]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(){delete this.data.player_error_code,delete this.data.player_error_message,delete this.data.player_error_context,delete this.data.player_error_severity,delete this.data.player_error_business_exception}},{key:"_initializeViewData",value:function(){var s=this,r=this.data.view_id=Qa(),n=function(){r===s.data.view_id&&ct(s.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",n):n()}},{key:"_restartHeartBeat",value:function(){var s=this;window.clearTimeout(this._heartBeatTimeout),this._heartBeatTimeout=window.setTimeout(function(){s.data.player_is_paused||s.emit("hb")},1e4)}},{key:"addHLSJS",value:function(s){if(!s.hlsjs){this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.");return}if(this.hlsjs){this.mux.log.warn("An instance of HLS.js is already being monitored for this player.");return}this.hlsjs=s.hlsjs,V_(this.mux,this.id,s.hlsjs,{},s.Hls||window.Hls)}},{key:"removeHLSJS",value:function(){this.hlsjs&&(W_(this.hlsjs),this.hlsjs=void 0)}},{key:"addDashJS",value:function(s){if(!s.dashjs){this.mux.log.warn("You must pass a valid dashjs instance in order to track it.");return}if(this.dashjs){this.mux.log.warn("An instance of Dash.js is already being monitored for this player.");return}this.dashjs=s.dashjs,z_(this.mux,this.id,s.dashjs)}},{key:"removeDashJS",value:function(){this.dashjs&&(Q_(this.dashjs),this.dashjs=void 0)}}]),t})(Z_),cS=uS,Jn=ii(kv());function Vu(){return Jn.default&&!!(Jn.default.fullscreenElement||Jn.default.webkitFullscreenElement||Jn.default.mozFullScreenElement||Jn.default.msFullscreenElement)}var hS=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],fS={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};function mS(i,e,t){var s=fs(Sd(e),3),r=s[0],n=s[1],a=s[2],o=i.log,l=i.utils.getComputedStyle,d=i.utils.secondsToMs,u={automaticErrorTracking:!0};if(r){if(a!=="video"&&a!=="audio")return o.error("The element of `"+n+"` was not a media element.")}else return o.error("No element was found with the `"+n+"` query selector.");r.mux&&(r.mux.destroy(),delete r.mux,o.warn("Already monitoring this video element, replacing existing event listeners"));var c={getPlayheadTime:function(){return d(r.currentTime)},getStateData:function(){var f,m,p,g=((f=(m=this).getPlayheadTime)===null||f===void 0?void 0:f.call(m))||d(r.currentTime),v=this.hlsjs&&this.hlsjs.url,b=this.dashjs&&typeof this.dashjs.getSource=="function"&&this.dashjs.getSource(),y={player_is_paused:r.paused,player_width:parseInt(l(r,"width")),player_height:parseInt(l(r,"height")),player_autoplay_on:r.autoplay,player_preload_on:r.preload,player_language_code:r.lang,player_is_fullscreen:Vu(),video_poster_url:r.poster,video_source_url:v||b||r.currentSrc,video_source_duration:d(r.duration),video_source_height:r.videoHeight,video_source_width:r.videoWidth,view_dropped_frame_count:r==null||(p=r.getVideoPlaybackQuality)===null||p===void 0?void 0:p.call(r).droppedVideoFrames};if(r.getStartDate&&g>0){var T=r.getStartDate();if(T&&typeof T.getTime=="function"&&T.getTime()){var A=T.getTime();if(y.player_program_time=A+g,r.seekable.length>0){var L=A+r.seekable.end(r.seekable.length-1);y.player_live_edge_program_time=L}}}return y}};t=Object.assign(u,t,c),t.data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:i.VERSION},t.data),r.mux=r.mux||{},r.mux.deleted=!1,r.mux.emit=function(f,m){i.emit(n,f,m)},r.mux.updateData=function(f){r.mux.emit("hb",f)};var h=function(){o.error("The monitor for this video element has already been destroyed.")};r.mux.destroy=function(){Object.keys(r.mux.listeners).forEach(function(f){r.removeEventListener(f,r.mux.listeners[f],!1)}),delete r.mux.listeners,r.mux.fullscreenChangeListener&&(document.removeEventListener("fullscreenchange",r.mux.fullscreenChangeListener,!1),delete r.mux.fullscreenChangeListener),r.mux.destroy=h,r.mux.swapElement=h,r.mux.emit=h,r.mux.addHLSJS=h,r.mux.addDashJS=h,r.mux.removeHLSJS=h,r.mux.removeDashJS=h,r.mux.updateData=h,r.mux.setEmitTranslator=h,r.mux.setStateDataTranslator=h,r.mux.setGetPlayheadTime=h,r.mux.deleted=!0,i.emit(n,"destroy")},r.mux.swapElement=function(f){var m=fs(Sd(f),3),p=m[0],g=m[1],v=m[2];if(p){if(v!=="video"&&v!=="audio")return i.log.error("The element of `"+g+"` was not a media element.")}else return i.log.error("No element was found with the `"+g+"` query selector.");p.muxId=r.muxId,delete r.muxId,p.mux=p.mux||{},p.mux.listeners=Object.assign({},r.mux.listeners),delete r.mux.listeners,Object.keys(p.mux.listeners).forEach(function(b){r.removeEventListener(b,p.mux.listeners[b],!1),p.addEventListener(b,p.mux.listeners[b],!1)}),p.mux.fullscreenChangeListener=r.mux.fullscreenChangeListener,delete r.mux.fullscreenChangeListener,p.mux.swapElement=r.mux.swapElement,p.mux.destroy=r.mux.destroy,delete r.mux,r=p},r.mux.addHLSJS=function(f){i.addHLSJS(n,f)},r.mux.addDashJS=function(f){i.addDashJS(n,f)},r.mux.removeHLSJS=function(){i.removeHLSJS(n)},r.mux.removeDashJS=function(){i.removeDashJS(n)},r.mux.setEmitTranslator=function(f){i.setEmitTranslator(n,f)},r.mux.setStateDataTranslator=function(f){i.setStateDataTranslator(n,f)},r.mux.setGetPlayheadTime=function(f){f||(f=t.getPlayheadTime),i.setGetPlayheadTime(n,f)},i.init(n,t),i.emit(n,"playerready"),r.paused||(i.emit(n,"play"),r.readyState>2&&i.emit(n,"playing")),r.mux.listeners={},hS.forEach(function(f){f==="error"&&!t.automaticErrorTracking||(r.mux.listeners[f]=function(){var m={};if(f==="error"){if(!r.error||r.error.code===1)return;m.player_error_code=r.error.code,m.player_error_message=fS[r.error.code]||r.error.message}i.emit(n,f,m)},r.addEventListener(f,r.mux.listeners[f],!1))}),r.mux.listeners.enterpictureinpicture=function(){i.emit(n,"playbackmodechange",{player_playback_mode:"pip",player_playback_mode_data:"{}"})},r.mux.listeners.leavepictureinpicture=function(){var f=Vu()?"fullscreen":"standard";i.emit(n,"playbackmodechange",{player_playback_mode:f,player_playback_mode_data:"{}"})},r.addEventListener("enterpictureinpicture",r.mux.listeners.enterpictureinpicture,!1),r.addEventListener("leavepictureinpicture",r.mux.listeners.leavepictureinpicture,!1),r.mux.fullscreenChangeListener=function(){var f=Vu(),m=document.fullscreenElement;if(f&&(m===r||m!=null&&m.contains(r)))i.emit(n,"playbackmodechange",{player_playback_mode:"fullscreen",player_playback_mode_data:"{}"});else if(!f){var p=document.pictureInPictureElement===r,g=p?"pip":"standard";i.emit(n,"playbackmodechange",{player_playback_mode:g,player_playback_mode_data:"{}"})}},document.addEventListener("fullscreenchange",r.mux.fullscreenChangeListener,!1)}function pS(i,e,t,s){var r=s;if(i&&typeof i[e]=="function")try{r=i[e].apply(i,t)}catch(n){we.info("safeCall error",n)}return r}var Na=ii(Ji()),Yr;Na.default&&Na.default.WeakMap&&(Yr=new WeakMap);function gS(i,e){if(!i||!e||!Na.default||typeof Na.default.getComputedStyle!="function")return"";var t;return Yr&&Yr.has(i)&&(t=Yr.get(i)),t||(t=Na.default.getComputedStyle(i,null),Yr&&Yr.set(i,t)),t.getPropertyValue(e)}function vS(i){return Math.floor(i*1e3)}var zs={TARGET_DURATION:"#EXT-X-TARGETDURATION",PART_INF:"#EXT-X-PART-INF",SERVER_CONTROL:"#EXT-X-SERVER-CONTROL",INF:"#EXTINF",PROGRAM_DATE_TIME:"#EXT-X-PROGRAM-DATE-TIME",VERSION:"#EXT-X-VERSION",SESSION_DATA:"#EXT-X-SESSION-DATA"},hu=function(i){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(i),this.manifest};hu.prototype.process=function(i){var e;for(this.buffer+=i,e=this.buffer.indexOf(` +`);e>-1;e=this.buffer.indexOf(` +`))this.processLine(this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)};hu.prototype.processLine=function(i){var e=i.indexOf(":"),t=TS(i,e),s=t[0],r=t.length===2?Df(t[1]):void 0;if(s[0]!=="#")this.currentUri.uri=s,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(s){case zs.TARGET_DURATION:{if(!isFinite(r)||r<0)return;this.manifest.targetDuration=r,this.setHoldBack();break}case zs.PART_INF:{Wu(this.manifest,t),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break}case zs.SERVER_CONTROL:{Wu(this.manifest,t),this.setHoldBack();break}case zs.INF:{r===0?this.currentUri.duration=.01:r>0&&(this.currentUri.duration=r);break}case zs.PROGRAM_DATE_TIME:{var n=r,a=new Date(n);this.manifest.dateTimeString||(this.manifest.dateTimeString=n,this.manifest.dateTimeObject=a),this.currentUri.dateTimeString=n,this.currentUri.dateTimeObject=a;break}case zs.VERSION:{Wu(this.manifest,t);break}case zs.SESSION_DATA:{var o=_S(t[1]),l=Mv(o);Object.assign(this.manifest.sessionData,l)}}};hu.prototype.setHoldBack=function(){var i=this.manifest,e=i.serverControl,t=i.targetDuration,s=i.partTargetDuration;if(e){var r="holdBack",n="partHoldBack",a=t&&t*3,o=s&&s*2;t&&!e.hasOwnProperty(r)&&(e[r]=a),a&&e[r]1){var s=Gv(t[0]);e[s]=Df(t[1])}return e},yS=function(i){for(var e=i.split(","),t={},s=0;e.length>s;s++){var r=e[s],n=ES(r);t=Object.assign(n,t)}return t},bS=function(i){return i.indexOf("=")>-1},TS=function(i,e){return e===-1?[i]:[i.substring(0,e),i.substring(e+1)]},_S=function(i){var e={};if(i){var t=i.search(","),s=i.slice(0,t),r=i.slice(t+1),n=[s,r];return n.forEach(function(a,o){for(var l=a.replace(/['"]+/g,"").split("="),d=0;d=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function OS(i,e,t){return(e=US(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ce(){return Ce=Object.assign?Object.assign.bind():function(i){for(var e=1;e`):ws}function kp(i,e,t){return e[i]?e[i].bind(e):FS(i,t)}const Fc=$c();function BS(i,e,t){const s=$c();if(typeof console=="object"&&i===!0||typeof i=="object"){const r=["debug","log","info","warn","error"];r.forEach(n=>{s[n]=kp(n,i,t)});try{s.log(`Debug logs enabled for "${e}" in hls.js version 1.6.15`)}catch{return $c()}r.forEach(n=>{Fc[n]=kp(n,i)})}else Ce(Fc,s);return s}const xe=Fc;function Ks(i=!0){return typeof self>"u"?void 0:(i||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function HS(i){return typeof self<"u"&&i===self.ManagedMediaSource}function Kv(i,e){const t=Object.keys(i),s=Object.keys(e),r=t.length,n=s.length;return!r||!n||r===n&&!t.some(a=>s.indexOf(a)===-1)}function qt(i,e=!1){if(typeof TextDecoder<"u"){const d=new TextDecoder("utf-8").decode(i);if(e){const u=d.indexOf("\0");return u!==-1?d.substring(0,u):d}return d.replace(/\0/g,"")}const t=i.length;let s,r,n,a="",o=0;for(;o>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(s);break;case 12:case 13:r=i[o++],a+=String.fromCharCode((s&31)<<6|r&63);break;case 14:r=i[o++],n=i[o++],a+=String.fromCharCode((s&15)<<12|(r&63)<<6|(n&63)<<0);break}}return a}function bt(i){let e="";for(let t=0;t1||r===1&&(t=this.levelkeys[s[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!Q(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return ze(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const t=this.levelkeys;if(t){var s;const r=t[e];r&&!((s=this._decryptdata)!=null&&s.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,s,r,n,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:s,startDTS:r,endDTS:n,partial:a};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,s),l.startDTS=Math.min(l.startDTS,r),l.endDTS=Math.max(l.endDTS,n)}}let VS=class extends Wv{constructor(e,t,s,r,n){super(s),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,n),n&&(this.fragOffset=n.fragOffset+n.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}};function qv(i,e){const t=Object.getPrototypeOf(i);if(t){const s=Object.getOwnPropertyDescriptor(t,e);return s||qv(t,e)}}function WS(i,e){const t=qv(i,e);t&&(t.enumerable=!0,Object.defineProperty(i,e,t))}const Cp=Math.pow(2,32)-1,qS=[].push,Yv={video:1,audio:2,id3:3,text:4};function ot(i){return String.fromCharCode.apply(null,i)}function jv(i,e){const t=i[e]<<8|i[e+1];return t<0?65536+t:t}function le(i,e){const t=zv(i,e);return t<0?4294967296+t:t}function wp(i,e){let t=le(i,e);return t*=Math.pow(2,32),t+=le(i,e+4),t}function zv(i,e){return i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3]}function YS(i){const e=i.byteLength;for(let t=0;t8&&i[t+4]===109&&i[t+5]===111&&i[t+6]===111&&i[t+7]===102)return!0;t=s>1?t+s:e}return!1}function he(i,e){const t=[];if(!e.length)return t;const s=i.byteLength;for(let r=0;r1?r+n:s;if(a===e[0])if(e.length===1)t.push(i.subarray(r+8,o));else{const l=he(i.subarray(r+8,o),e.slice(1));l.length&&qS.apply(t,l)}r=o}return t}function jS(i){const e=[],t=i[0];let s=8;const r=le(i,s);s+=4;let n=0,a=0;t===0?(n=le(i,s),a=le(i,s+4),s+=8):(n=wp(i,s),a=wp(i,s+8),s+=16),s+=2;let o=i.length+a;const l=jv(i,s);s+=2;for(let d=0;d>>31===1)return xe.warn("SIDX has hierarchical references (not supported)"),null;const m=le(i,u);u+=4,e.push({referenceSize:h,subsegmentDuration:m,info:{duration:m/r,start:o,end:o+h-1}}),o+=h,u+=4,s=u}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:l,references:e}}function Qv(i){const e=[],t=he(i,["moov","trak"]);for(let r=0;r{const n=le(r,4),a=e[n];a&&(a.default={duration:le(r,12),flags:le(r,20)})}),e}function zS(i){const e=i.subarray(8),t=e.subarray(86),s=ot(e.subarray(4,8));let r=s,n;const a=s==="enca"||s==="encv";if(a){const d=he(e,[s])[0].subarray(s==="enca"?28:78);he(d,["sinf"]).forEach(c=>{const h=he(c,["schm"])[0];if(h){const f=ot(h.subarray(4,8));if(f==="cbcs"||f==="cenc"){const m=he(c,["frma"])[0];m&&(r=ot(m))}}})}const o=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const l=he(t,["avcC"])[0];l&&l.length>3&&(r+="."+xo(l[1])+xo(l[2])+xo(l[3]),n=Ro(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const l=he(e,[s])[0],d=he(l.subarray(28),["esds"])[0];if(d&&d.length>7){let u=4;if(d[u++]!==3)break;u=ju(d,u),u+=2;const c=d[u++];if(c&128&&(u+=2),c&64&&(u+=d[u++]),d[u++]!==4)break;u=ju(d,u);const h=d[u++];if(h===64)r+="."+xo(h);else break;if(u+=12,d[u++]!==5)break;u=ju(d,u);const f=d[u++];let m=(f&248)>>3;m===31&&(m+=1+((f&7)<<3)+((d[u]&224)>>5)),r+="."+m}break}case"hvc1":case"hev1":{const l=he(t,["hvcC"])[0];if(l&&l.length>12){const d=l[1],u=["","A","B","C"][d>>6],c=d&31,h=le(l,2),f=(d&32)>>5?"H":"L",m=l[12],p=l.subarray(6,12);r+="."+u+c,r+="."+QS(h).toString(16).toUpperCase(),r+="."+f+m;let g="";for(let v=p.length;v--;){const b=p[v];(b||g)&&(g="."+b.toString(16).toUpperCase()+g)}r+=g}n=Ro(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=Ro(r,t)||r;break}case"vp09":{const l=he(t,["vpcC"])[0];if(l&&l.length>6){const d=l[4],u=l[5],c=l[6]>>4&15;r+="."+$i(d)+"."+$i(u)+"."+$i(c)}break}case"av01":{const l=he(t,["av1C"])[0];if(l&&l.length>2){const d=l[1]>>>5,u=l[1]&31,c=l[2]>>>7?"H":"M",h=(l[2]&64)>>6,f=(l[2]&32)>>5,m=d===2&&h?f?12:10:h?10:8,p=(l[2]&16)>>4,g=(l[2]&8)>>3,v=(l[2]&4)>>2,b=l[2]&3;r+="."+d+"."+$i(u)+c+"."+$i(m)+"."+p+"."+g+v+b+"."+$i(1)+"."+$i(1)+"."+$i(1)+"."+0,n=Ro("dav1",t)}break}}return{codec:r,encrypted:a,supplemental:n}}function Ro(i,e){const t=he(e,["dvvC"]),s=t.length?t[0]:he(e,["dvcC"])[0];if(s){const r=s[2]>>1&127,n=s[2]<<5&32|s[3]>>3&31;return i+"."+$i(r)+"."+$i(n)}}function QS(i){let e=0;for(let t=0;t<32;t++)e|=(i>>t&1)<<31-t;return e>>>0}function ju(i,e){const t=e+5;for(;i[e++]&128&&e{const n=s.subarray(8,24);n.some(a=>a!==0)||(xe.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${bt(n)} -> ${bt(t)}`),s.set(t,8))})}function ZS(i){const e=[];return Xv(i,t=>e.push(t.subarray(8,24))),e}function Xv(i,e){he(i,["moov","trak"]).forEach(s=>{const r=he(s,["mdia","minf","stbl","stsd"])[0];if(!r)return;const n=r.subarray(8);let a=he(n,["enca"]);const o=a.length>0;o||(a=he(n,["encv"])),a.forEach(l=>{const d=o?l.subarray(28):l.subarray(78);he(d,["sinf"]).forEach(c=>{const h=Zv(c);h&&e(h,o)})})})}function Zv(i){const e=he(i,["schm"])[0];if(e){const t=ot(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const s=he(i,["schi","tenc"])[0];if(s)return s}}}function JS(i,e,t){const s={},r=he(i,["moof","traf"]);for(let n=0;ns[n].duration)){let n=1/0,a=0;const o=he(i,["sidx"]);for(let l=0;lc+h.info.duration||0,0);a=Math.max(a,u+d.earliestPresentationTime/d.timescale)}}a&&Q(a)&&Object.keys(s).forEach(l=>{s[l].duration||(s[l].duration=a*s[l].timescale-s[l].start)})}return s}function e1(i){const e={valid:null,remainder:null},t=he(i,["moof"]);if(t.length<2)return e.remainder=i,e;const s=t[t.length-1];return e.valid=i.slice(0,s.byteOffset-8),e.remainder=i.slice(s.byteOffset-8),e}function ti(i,e){const t=new Uint8Array(i.length+e.length);return t.set(i),t.set(e,i.length),t}function Mp(i,e){const t=[],s=e.samples,r=e.timescale,n=e.id;let a=!1;return he(s,["moof"]).map(l=>{const d=l.byteOffset-8;he(l,["traf"]).map(c=>{const h=he(c,["tfdt"]).map(f=>{const m=f[0];let p=le(f,4);return m===1&&(p*=Math.pow(2,32),p+=le(f,8)),p/r})[0];return h!==void 0&&(i=h),he(c,["tfhd"]).map(f=>{const m=le(f,4),p=le(f,0)&16777215,g=(p&1)!==0,v=(p&2)!==0,b=(p&8)!==0;let y=0;const T=(p&16)!==0;let A=0;const L=(p&32)!==0;let S=8;m===n&&(g&&(S+=8),v&&(S+=4),b&&(y=le(f,S),S+=4),T&&(A=le(f,S),S+=4),L&&(S+=4),e.type==="video"&&(a=fu(e.codec)),he(c,["trun"]).map(R=>{const x=R[0],I=le(R,0)&16777215,M=(I&1)!==0;let F=0;const V=(I&4)!==0,j=(I&256)!==0;let H=0;const N=(I&512)!==0;let q=0;const B=(I&1024)!==0,z=(I&2048)!==0;let ee=0;const U=le(R,4);let $=8;M&&(F=le(R,$),$+=4),V&&($+=4);let re=F+d;for(let pe=0;pe>1&63;return t===39||t===40}else return(e&31)===6}function Pf(i,e,t,s){const r=Jv(i);let n=0;n+=e;let a=0,o=0,l=0;for(;n=r.length)break;l=r[n++],a+=l}while(l===255);o=0;do{if(n>=r.length)break;l=r[n++],o+=l}while(l===255);const d=r.length-n;let u=n;if(od){xe.error(`Malformed SEI payload. ${o} is too small, only ${d} bytes left to parse.`);break}if(a===4){if(r[u++]===181){const h=jv(r,u);if(u+=2,h===49){const f=le(r,u);if(u+=4,f===1195456820){const m=r[u++];if(m===3){const p=r[u++],g=31&p,v=64&p,b=v?2+g*3:0,y=new Uint8Array(b);if(v){y[0]=p;for(let T=1;T16){const c=[];for(let m=0;m<16;m++){const p=r[u++].toString(16);c.push(p.length==1?"0"+p:p),(m===3||m===5||m===7||m===9)&&c.push("-")}const h=o-16,f=new Uint8Array(h);for(let m=0;m>24&255,n[1]=s>>16&255,n[2]=s>>8&255,n[3]=s&255,n.set(i,4),r=0,s=8;r0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const a=new Uint8Array(4);return t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),s1([112,115,115,104],new Uint8Array([s,0,0,0]),i,n,r,a,t)}function n1(i){const e=[];if(i instanceof ArrayBuffer){const t=i.byteLength;let s=0;for(;s+32>>24;if(n!==0&&n!==1)return{offset:t,size:e};const a=i.buffer,o=bt(new Uint8Array(a,t+12,16));let l=null,d=null,u=0;if(n===0)u=28;else{const h=i.getUint32(28);if(!h||s<32+h*16)return{offset:t,size:e};l=[];for(let f=0;f/\(Windows.+Firefox\//i.test(navigator.userAgent),Fn={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Of(i,e){const t=Fn[e];return!!t&&!!t[i.slice(0,4)]}function Za(i,e,t=!0){return!i.split(",").some(s=>!Nf(s,e,t))}function Nf(i,e,t=!0){var s;const r=Ks(t);return(s=r?.isTypeSupported(Ja(i,e)))!=null?s:!1}function Ja(i,e){return`${e}/mp4;codecs=${i}`}function Pp(i){if(i){const e=i.substring(0,4);return Fn.video[e]}return 2}function xd(i){const e=eE();return i.split(",").reduce((t,s)=>{const n=e&&fu(s)?9:Fn.video[s];return n?(n*2+t)/(t?3:2):(Fn.audio[s]+t)/(t?2:1)},0)}const zu={};function o1(i,e=!0){if(zu[i])return zu[i];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[i];for(let r=0;ro1(t.toLowerCase(),e))}function d1(i,e){const t=[];if(i){const s=i.split(",");for(let r=0;r4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(i)!==-1)&&(Op(i,"audio")||Op(i,"video")))return i;if(e){const t=e.split(",");if(t.length>1){if(i){for(let s=t.length;s--;)if(t[s].substring(0,4)===i.substring(0,4))return t[s]}return t[0]}}return e||i}function Op(i,e){return Of(i,e)&&Nf(i,e)}function u1(i){const e=i.split(",");for(let t=0;t2&&s[0]==="avc1"&&(e[t]=`avc1.${parseInt(s[1]).toString(16)}${("000"+parseInt(s[2]).toString(16)).slice(-4)}`)}return e.join(",")}function c1(i){if(i.startsWith("av01.")){const e=i.split("."),t=["0","111","01","01","01","0"];for(let s=e.length;s>4&&s<10;s++)e[s]=t[s-4];return e.join(".")}return i}function Np(i){const e=Ks(i)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Bc(i){return i.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const h1={supported:!0,powerEfficient:!0,smooth:!0},f1={supported:!1,smooth:!1,powerEfficient:!1},tE={supported:!0,configurations:[],decodingInfoResults:[h1]};function iE(i,e){return{supported:!1,configurations:e,decodingInfoResults:[f1],error:i}}function m1(i,e,t,s,r,n){const a=i.videoCodec,o=i.audioCodec?i.audioGroups:null,l=n?.audioCodec,d=n?.channels,u=d?parseInt(d):l?1/0:2;let c=null;if(o!=null&&o.length)try{o.length===1&&o[0]?c=e.groups[o[0]].channels:c=o.reduce((h,f)=>{if(f){const m=e.groups[f];if(!m)throw new Error(`Audio track group ${f} not found`);Object.keys(m.channels).forEach(p=>{h[p]=(h[p]||0)+m.channels[p]})}return h},{2:0})}catch{return!0}return a!==void 0&&(a.split(",").some(h=>fu(h))||i.width>1920&&i.height>1088||i.height>1920&&i.width>1088||i.frameRate>Math.max(s,30)||i.videoRange!=="SDR"&&i.videoRange!==t||i.bitrate>Math.max(r,8e6))||!!c&&Q(u)&&Object.keys(c).some(h=>parseInt(h)>u)}function sE(i,e,t,s={}){const r=i.videoCodec;if(!r&&!i.audioCodec||!t)return Promise.resolve(tE);const n=[],a=p1(i),o=a.length,l=g1(i,e,o>0),d=l.length;for(let u=o||1*d||1;u--;){const c={type:"media-source"};if(o&&(c.video=a[u%o]),d){c.audio=l[u%d];const h=c.audio.bitrate;c.video&&h&&(c.video.bitrate-=h)}n.push(c)}if(r){const u=navigator.userAgent;if(r.split(",").some(c=>fu(c))&&eE())return Promise.resolve(iE(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),n))}return Promise.all(n.map(u=>{const c=E1(u);return s[c]||(s[c]=t.decodingInfo(u))})).then(u=>({supported:!u.some(c=>!c.supported),configurations:n,decodingInfoResults:u})).catch(u=>({supported:!1,configurations:n,decodingInfoResults:[],error:u}))}function p1(i){var e;const t=(e=i.videoCodec)==null?void 0:e.split(","),s=rE(i),r=i.width||640,n=i.height||480,a=i.frameRate||30,o=i.videoRange.toLowerCase();return t?t.map(l=>{const d={contentType:Ja(c1(l),"video"),width:r,height:n,bitrate:s,framerate:a};return o!=="sdr"&&(d.transferFunction=o),d}):[]}function g1(i,e,t){var s;const r=(s=i.audioCodec)==null?void 0:s.split(","),n=rE(i);return r&&i.audioGroups?i.audioGroups.reduce((a,o)=>{var l;const d=o?(l=e.groups[o])==null?void 0:l.tracks:null;return d?d.reduce((u,c)=>{if(c.groupId===o){const h=parseFloat(c.channels||"");r.forEach(f=>{const m={contentType:Ja(f,"audio"),bitrate:t?v1(f,n):n};h&&(m.channels=""+h),u.push(m)})}return u},a):a},[]):[]}function v1(i,e){if(e<=1)return 1;let t=128e3;return i==="ec-3"?t=768e3:i==="ac-3"&&(t=64e4),Math.min(e/2,t)}function rE(i){return Math.ceil(Math.max(i.bitrate*.9,i.averageBitrate)/1e3)*1e3||1}function E1(i){let e="";const{audio:t,video:s}=i;if(s){const r=Bc(s.contentType);e+=`${r}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||"sd"}_${Math.ceil(s.bitrate/1e5)}`}if(t){const r=Bc(t.contentType);e+=`${s?"_":""}${r}_c${t.channels}`}return e}const Hc=["NONE","TYPE-0","TYPE-1",null];function y1(i){return Hc.indexOf(i)>-1}const Dd=["SDR","PQ","HLG"];function b1(i){return!!i&&Dd.indexOf(i)>-1}var dl={No:"",Yes:"YES",v2:"v2"};function Up(i){const{canSkipUntil:e,canSkipDateRanges:t,age:s}=i,r=s!!s).map(s=>s.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const s=(t=e.supplemental)==null?void 0:t.videoCodec;s&&s!==e.videoCodec&&(this.codecSet+=`,${s.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Fp(this._audioGroups,e)}hasSubtitleGroup(e){return Fp(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(t)===-1&&s.push(t)}else if(e==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(t)===-1&&s.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function Fp(i,e){return!e||!i?!1:i.indexOf(e)!==-1}function T1(){if(typeof matchMedia=="function"){const i=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(i.media!==e.media)return i.matches===!0}return!1}function _1(i,e){let t=!1,s=[];if(i&&(t=i!=="SDR",s=[i]),e){s=e.allowedVideoRanges||Dd.slice(0);const r=s.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&T1(),t||(s=["SDR"])}return{preferHDR:t,allowedVideoRanges:s}}const A1=i=>{const e=new WeakSet;return(t,s)=>{if(i&&(s=i(t,s)),typeof s=="object"&&s!==null){if(e.has(s))return;e.add(s)}return s}},Pe=(i,e)=>JSON.stringify(i,A1(e));function S1(i,e,t,s,r){const n=Object.keys(i),a=s?.channels,o=s?.audioCodec,l=r?.videoCodec,d=a&&parseInt(a)===2;let u=!1,c=!1,h=1/0,f=1/0,m=1/0,p=1/0,g=0,v=[];const{preferHDR:b,allowedVideoRanges:y}=_1(e,r);for(let R=n.length;R--;){const x=i[n[R]];u||(u=x.channels[2]>0),h=Math.min(h,x.minHeight),f=Math.min(f,x.minFramerate),m=Math.min(m,x.minBitrate),y.filter(M=>x.videoRanges[M]>0).length>0&&(c=!0)}h=Q(h)?h:0,f=Q(f)?f:0;const T=Math.max(1080,h),A=Math.max(30,f);m=Q(m)?m:t,t=Math.max(m,t),c||(e=void 0);const L=n.length>1;return{codecSet:n.reduce((R,x)=>{const I=i[x];if(x===R)return R;if(v=c?y.filter(M=>I.videoRanges[M]>0):[],L){if(I.minBitrate>t)return _i(x,`min bitrate of ${I.minBitrate} > current estimate of ${t}`),R;if(!I.hasDefaultAudio)return _i(x,"no renditions with default or auto-select sound found"),R;if(o&&x.indexOf(o.substring(0,4))%5!==0)return _i(x,`audio codec preference "${o}" not found`),R;if(a&&!d){if(!I.channels[a])return _i(x,`no renditions with ${a} channel sound found (channels options: ${Object.keys(I.channels)})`),R}else if((!o||d)&&u&&I.channels[2]===0)return _i(x,"no renditions with stereo sound found"),R;if(I.minHeight>T)return _i(x,`min resolution of ${I.minHeight} > maximum of ${T}`),R;if(I.minFramerate>A)return _i(x,`min framerate of ${I.minFramerate} > maximum of ${A}`),R;if(!v.some(M=>I.videoRanges[M]>0))return _i(x,`no variants with VIDEO-RANGE of ${Pe(v)} found`),R;if(l&&x.indexOf(l.substring(0,4))%5!==0)return _i(x,`video codec preference "${l}" not found`),R;if(I.maxScore=xd(R)||I.fragmentError>i[R].fragmentError)?R:(p=I.minIndex,g=I.maxScore,x)},void 0),videoRanges:v,preferHDR:b,minFramerate:f,minBitrate:m,minIndex:p}}function _i(i,e){xe.log(`[abr] start candidates with "${i}" ignored because ${e}`)}function nE(i){return i.reduce((e,t)=>{let s=e.groups[t.groupId];s||(s=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(t);const r=t.channels||"2";return s.channels[r]=(s.channels[r]||0)+1,s.hasDefault=s.hasDefault||t.default,s.hasAutoSelect=s.hasAutoSelect||t.autoselect,s.hasDefault&&(e.hasDefaultAudio=!0),s.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function I1(i,e,t,s){return i.slice(t,s+1).reduce((r,n,a)=>{if(!n.codecSet)return r;const o=n.audioGroups;let l=r[n.codecSet];l||(r[n.codecSet]=l={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:a,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),l.minBitrate=Math.min(l.minBitrate,n.bitrate);const d=Math.min(n.height,n.width);return l.minHeight=Math.min(l.minHeight,d),l.minFramerate=Math.min(l.minFramerate,n.frameRate),l.minIndex=Math.min(l.minIndex,a),l.maxScore=Math.max(l.maxScore,n.score),l.fragmentError+=n.fragmentError,l.videoRanges[n.videoRange]=(l.videoRanges[n.videoRange]||0)+1,o&&o.forEach(u=>{if(!u)return;const c=e.groups[u];c&&(l.hasDefaultAudio=l.hasDefaultAudio||e.hasDefaultAudio?c.hasDefault:c.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(c.channels).forEach(h=>{l.channels[h]=(l.channels[h]||0)+c.channels[h]}))}),r},{})}function Bp(i){if(!i)return i;const{lang:e,assocLang:t,characteristics:s,channels:r,audioCodec:n}=i;return{lang:e,assocLang:t,characteristics:s,channels:r,audioCodec:n}}function Vi(i,e,t){if("attrs"in i){const s=e.indexOf(i);if(s!==-1)return s}for(let s=0;ss.indexOf(r)===-1)}function tr(i,e){const{audioCodec:t,channels:s}=i;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(s===void 0||s===(e.channels||"2"))}function x1(i,e,t,s,r){const n=e[s],o=e.reduce((h,f,m)=>{const p=f.uri;return(h[p]||(h[p]=[])).push(m),h},{})[n.uri];o.length>1&&(s=Math.max.apply(Math,o));const l=n.videoRange,d=n.frameRate,u=n.codecSet.substring(0,4),c=Hp(e,s,h=>{if(h.videoRange!==l||h.frameRate!==d||h.codecSet.substring(0,4)!==u)return!1;const f=h.audioGroups,m=t.filter(p=>!f||f.indexOf(p.groupId)!==-1);return Vi(i,m,r)>-1});return c>-1?c:Hp(e,s,h=>{const f=h.audioGroups,m=t.filter(p=>!f||f.indexOf(p.groupId)!==-1);return Vi(i,m,r)>-1})}function Hp(i,e,t){for(let s=e;s>-1;s--)if(t(i[s]))return s;for(let s=e+1;s{var s;const{fragCurrent:r,partCurrent:n,hls:a}=this,{autoLevelEnabled:o,media:l}=a;if(!r||!l)return;const d=performance.now(),u=n?n.stats:r.stats,c=n?n.duration:r.duration,h=d-u.loading.start,f=a.minAutoLevel,m=r.level,p=this._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||m<=f){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const g=p>-1&&p!==m,v=!!t||g;if(!v&&(l.paused||!l.playbackRate||!l.readyState))return;const b=a.mainForwardBufferInfo;if(!v&&b===null)return;const y=this.bwEstimator.getEstimateTTFB(),T=Math.abs(l.playbackRate);if(h<=Math.max(y,1e3*(c/(T*2))))return;const A=b?b.len/T:0,L=u.loading.first?u.loading.first-u.loading.start:-1,S=u.loaded&&L>-1,R=this.getBwEstimate(),x=a.levels,I=x[m],M=Math.max(u.loaded,Math.round(c*(r.bitrate||I.averageBitrate)/8));let F=S?h-L:h;F<1&&S&&(F=Math.min(h,u.loaded*8/R));const V=S?u.loaded*1e3/F:0,j=y/1e3,H=V?(M-u.loaded)/V:M*8/R+j;if(H<=A)return;const N=V?V*8:R,q=((s=t?.details||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,B=this.hls.config.abrBandWidthUpFactor;let z=Number.POSITIVE_INFINITY,ee;for(ee=m-1;ee>f;ee--){const pe=x[ee].maxBitrate,ue=!x[ee].details||q;if(z=this.getTimeToLoadFrag(j,N,c*pe,ue),z=H||z>c*10)return;S?this.bwEstimator.sample(h-Math.min(y,L),u.loaded):this.bwEstimator.sampleTTFB(h);const U=x[ee].maxBitrate;this.getBwEstimate()*B>U&&this.resetEstimator(U);const $=this.findBestLevel(U,f,ee,0,A,1,1);$>-1&&(ee=$),this.warn(`Fragment ${r.sn}${n?" part "+n.index:""} of level ${m} is loading too slowly; + Fragment duration: ${r.duration.toFixed(3)} + Time to underbuffer: ${A.toFixed(3)} s + Estimated load time for current fragment: ${H.toFixed(3)} s + Estimated load time for down switch fragment: ${z.toFixed(3)} s + TTFB estimate: ${L|0} ms + Current BW estimate: ${Q(R)?R|0:"Unknown"} bps + New BW estimate: ${this.getBwEstimate()|0} bps + Switching to level ${ee} @ ${U|0} bps`),a.nextLoadLevel=a.nextAutoLevel=ee,this.clearTimer();const re=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===ee&&ee>0){const pe=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${ee>0?"and switching down":""} + Fragment duration: ${r.duration.toFixed(3)} s + Time to underbuffer: ${pe.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,ee>f){let ue=this.findBestLevel(this.hls.levels[f].bitrate,f,ee,0,pe,1,1);ue===-1&&(ue=f),this.hls.nextLoadLevel=this.hls.nextAutoLevel=ue,this.resetEstimator(this.hls.levels[ue].bitrate)}}};g||H>z*2?re():this.timer=self.setInterval(re,z*1e3),a.trigger(E.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:n,stats:u})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new PS(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(E.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const s=t.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var r;this.fragCurrent=s,this.partCurrent=(r=t.part)!=null?r:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case w.FRAG_LOAD_TIMEOUT:{const s=t.frag,{fragCurrent:r,partCurrent:n}=this;if(s&&r&&s.sn===r.sn&&s.level===r.level){const a=performance.now(),o=n?n.stats:s.stats,l=a-o.loading.start,d=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&d>-1){const c=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(c,d),o.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,s,r){const n=e+s/t,a=r?e+this.lastLevelLoadSec:0;return n+a}onLevelLoaded(e,t){const s=this.hls.config,{loading:r}=t.stats,n=r.end-r.first;Q(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:s}){const r=s?s.stats:t.stats;if(t.type===X.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=s?s.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+r.loaded,l=(a.loaded?a.loaded.duration:0)+n;a.loaded={bytes:o,duration:l},a.realBitrate=Math.round(8*o/l)}if(t.bitrateTest){const n={stats:r,frag:t,part:s,id:t.type};this.onFragBuffered(E.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:s,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:s.stats;if(n.aborted||this.ignoreFragment(s))return;const a=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==X.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,s=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,n=this.findBestLevel(s,t,e,0,r,1,1);if(n>-1)return n;const a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!s||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=s&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,n)&&a[e].loadError<=a[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:s}=this;if(s.levels.length<=1)return s.loadLevel;const{maxAutoLevel:r,config:n,minAutoLevel:a}=s,o=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),d=this.getStarvationDelay();let u=n.abrBandWidthFactor,c=n.abrBandWidthUpFactor;if(d){const g=this.findBestLevel(l,a,r,d,0,u,c);if(g>=0)return this.rebufferNotice=-1,g}let h=o?Math.min(o,n.maxStarvationDelay):n.maxStarvationDelay;if(!d){const g=this.bitrateTestDelay;g&&(h=(o?Math.min(o,n.maxLoadingDelay):n.maxLoadingDelay)-g,this.info(`bitrate test took ${Math.round(1e3*g)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),u=c=1)}const f=this.findBestLevel(l,a,r,d,h,u,c);if(this.rebufferNotice!==f&&(this.rebufferNotice=f,this.info(`${d?"rebuffering expected":"buffer is empty"}, optimal quality level ${f}`)),f>-1)return f;const m=s.levels[a],p=s.loadLevelObj;return p&&m?.bitrate=t;N--){var H;const q=m[N],B=N>c;if(!q)continue;if(v.useMediaCapabilities&&!q.supportedResult&&!q.supportedPromise){const ue=navigator.mediaCapabilities;typeof ue?.decodingInfo=="function"&&m1(q,I,L,S,e,R)?(q.supportedPromise=sE(q,I,ue,this.supportedCache),q.supportedPromise.then(fe=>{if(!this.hls)return;q.supportedResult=fe;const st=this.hls.levels,Qe=st.indexOf(q);fe.error?this.warn(`MediaCapabilities decodingInfo error: "${fe.error}" for level ${Qe} ${Pe(fe)}`):fe.supported?fe.decodingInfoResults.some(It=>It.smooth===!1||It.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Qe} not smooth or powerEfficient: ${Pe(fe)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Qe} ${Pe(fe)}`),Qe>-1&&st.length>1&&(this.log(`Removing unsupported level ${Qe}`),this.hls.removeLevel(Qe),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(fe=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${fe}`)})):q.supportedResult=tE}if((A&&q.codecSet!==A||L&&q.videoRange!==L||B&&S>q.frameRate||!B&&S>0&&Sue.smooth===!1))&&(!T||N!==M)){j.push(N);continue}const z=q.details,ee=(f?z?.partTarget:z?.averagetargetduration)||F;let U;B?U=o*e:U=a*e;const $=F&&r>=F*2&&n===0?q.averageBitrate:q.maxBitrate,re=this.getTimeToLoadFrag(V,U,$*ee,z===void 0);if(U>=$&&(N===u||q.loadError===0&&q.fragmentError===0)&&(re<=V||!Q(re)||y&&!this.bitrateTestDelay||re${N} adjustedbw(${Math.round(U)})-bitrate=${Math.round(U-$)} ttfb:${V.toFixed(1)} avgDuration:${ee.toFixed(1)} maxFetchDuration:${d.toFixed(1)} fetchDuration:${re.toFixed(1)} firstSelection:${T} codecSet:${q.codecSet} videoRange:${q.videoRange} hls.loadLevel:${g}`)),T&&(this.firstSelection=N),N}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:s}=this.hls;return Math.min(Math.max(e,s),t)}}const aE={search:function(i,e){let t=0,s=i.length-1,r=null,n=null;for(;t<=s;){r=(t+s)/2|0,n=i[r];const a=e(n);if(a>0)t=r+1;else if(a<0)s=r-1;else return n}return null}};function D1(i,e,t){if(e===null||!Array.isArray(i)||!i.length||!Q(e))return null;const s=i[0].programDateTime;if(e<(s||0))return null;const r=i[i.length-1].endProgramDateTime;if(e>=(r||0))return null;for(let n=0;n0&&o<15e-7&&(t+=15e-7),n&&i.level!==n.level&&n.end<=i.end&&(n=e[2+i.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(n=e[0]);if(n&&((!i||i.level===n.level)&&Gp(t,s,n)===0||C1(n,i,Math.min(r,s))))return n;const a=aE.search(e,Gp.bind(null,t,s));return a&&(a!==i||!n)?a:n}function C1(i,e,t){if(e&&e.start===0&&e.level0){const s=e.tagList.reduce((r,n)=>(n[0]==="INF"&&(r+=parseFloat(n[1])),r),t);return i.start<=s}return!1}function Gp(i=0,e=0,t){if(t.start<=i&&t.start+t.duration>i)return 0;const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-s<=i?1:t.start-s>i&&t.start?-1:0}function w1(i,e,t){const s=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-s>i}function oE(i,e,t){if(i&&i.startCC<=e&&i.endCC>=e){let s=i.fragments;const{fragmentHint:r}=i;r&&(s=s.concat(r));let n;return aE.search(s,a=>a.cce?-1:(n=a,a.end<=t?1:a.start>t?-1:0)),n||null}return null}function wd(i){switch(i.details){case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_TIMEOUT:case w.LEVEL_LOAD_TIMEOUT:case w.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function lE(i){return i.details.startsWith("key")}function dE(i){return lE(i)&&!!i.frag&&!i.frag.decryptdata}function Kp(i,e){const t=wd(e);return i.default[`${t?"timeout":"error"}Retry`]}function Uf(i,e){const t=i.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*i.retryDelayMs,i.maxRetryDelayMs)}function Vp(i){return Le(Le({},i),{errorRetry:null,timeoutRetry:null})}function Md(i,e,t,s){if(!i)return!1;const r=s?.code,n=e499)}function Gc(i){return i===0&&navigator.onLine===!1}var yt={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},Bt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};class P1 extends si{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.ERROR,this.onError,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.ERROR,this.onError,this),e.off(E.ERROR,this.onErrorOut,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return e?.type===X.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,s=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||s===-1?t.loadLevel:s}variantHasKey(e,t){if(e){var s;if((s=e.details)!=null&&s.hasKey(t))return!0;const r=e.audioGroups;if(r)return this.hls.allAudioTracks.filter(a=>r.indexOf(a.groupId)>=0).some(a=>{var o;return(o=a.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var s;if(t.fatal)return;const r=this.hls,n=t.context;switch(t.details){case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case w.FRAG_PARSING_ERROR:if((s=t.frag)!=null&&s.gap){t.errorAction=In();return}case w.FRAG_GAP:case w.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=yt.SendAlternateToPenaltyBox;return}case w.LEVEL_EMPTY_ERROR:case w.LEVEL_PARSING_ERROR:{var a;const l=t.parent===X.MAIN?t.level:r.loadLevel;t.details===w.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(a=a.levelDetails)!=null&&a.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l))}return;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:typeof n?.level=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level));return;case w.AUDIO_TRACK_LOAD_ERROR:case w.AUDIO_TRACK_LOAD_TIMEOUT:case w.SUBTITLE_LOAD_ERROR:case w.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){const l=r.loadLevelObj;if(l&&(n.type===me.AUDIO_TRACK&&l.hasAudioGroup(n.groupId)||n.type===me.SUBTITLE_TRACK&&l.hasSubtitleGroup(n.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=yt.SendAlternateToPenaltyBox,t.errorAction.flags=Bt.MoveAllAlternatesMatchingHost;return}}return;case w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:yt.SendAlternateToPenaltyBox,flags:Bt.MoveAllAlternatesMatchingHDCP};return;case w.KEY_SYSTEM_SESSION_UPDATE_FAILED:case w.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case w.KEY_SYSTEM_NO_SESSION:t.errorAction={action:yt.SendAlternateToPenaltyBox,flags:Bt.MoveAllAlternatesMatchingKey};return;case w.BUFFER_ADD_CODEC_ERROR:case w.REMUX_ALLOC_ERROR:case w.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:r.loadLevel)}return;case w.INTERNAL_EXCEPTION:case w.BUFFER_APPENDING_ERROR:case w.BUFFER_FULL_ERROR:case w.LEVEL_SWITCH_ERROR:case w.BUFFER_STALLED_ERROR:case w.BUFFER_SEEK_OVER_HOLE:case w.BUFFER_NUDGE_ON_STALL:t.errorAction=In();return}t.type===te.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=In())}getPlaylistRetryOrSwitchAction(e,t){const s=this.hls,r=Kp(s.config.playlistLoadPolicy,e),n=this.playlistError++;if(Md(r,n,wd(e),e.response))return{action:yt.RetryRequest,flags:Bt.None,retryConfig:r,retryCount:n};const o=this.getLevelSwitchAction(e,t);return r&&(o.retryConfig=r,o.retryCount=n),o}getFragRetryOrSwitchAction(e){const t=this.hls,s=this.getVariantLevelIndex(e.frag),r=t.levels[s],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,o=Kp(lE(e)?a:n,e),l=t.levels.reduce((u,c)=>u+c.fragmentError,0);if(r&&(e.details!==w.FRAG_GAP&&r.fragmentError++,!dE(e)&&Md(o,l,wd(e),e.response)))return{action:yt.RetryRequest,flags:Bt.None,retryConfig:o,retryCount:l};const d=this.getLevelSwitchAction(e,s);return o&&(d.retryConfig=o,d.retryCount=l),d}getLevelSwitchAction(e,t){const s=this.hls;t==null&&(t=s.loadLevel);const r=this.hls.levels[t];if(r){var n,a;const d=e.details;r.loadError++,d===w.BUFFER_APPEND_ERROR&&r.fragmentError++;let u=-1;const{levels:c,loadLevel:h,minAutoLevel:f,maxAutoLevel:m}=s;!s.autoLevelEnabled&&!s.config.preserveManualLevelOnError&&(s.loadLevel=-1);const p=(n=e.frag)==null?void 0:n.type,v=(p===X.AUDIO&&d===w.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(d===w.BUFFER_ADD_CODEC_ERROR||d===w.BUFFER_APPEND_ERROR))&&c.some(({audioCodec:L})=>r.audioCodec!==L),y=e.sourceBufferName==="video"&&(d===w.BUFFER_ADD_CODEC_ERROR||d===w.BUFFER_APPEND_ERROR)&&c.some(({codecSet:L,audioCodec:S})=>r.codecSet!==L&&r.audioCodec===S),{type:T,groupId:A}=(a=e.context)!=null?a:{};for(let L=c.length;L--;){const S=(L+h)%c.length;if(S!==h&&S>=f&&S<=m&&c[S].loadError===0){var o,l;const R=c[S];if(d===w.FRAG_GAP&&p===X.MAIN&&e.frag){const x=c[S].details;if(x){const I=xr(e.frag,x.fragments,e.frag.start);if(I!=null&&I.gap)continue}}else{if(T===me.AUDIO_TRACK&&R.hasAudioGroup(A)||T===me.SUBTITLE_TRACK&&R.hasSubtitleGroup(A))continue;if(p===X.AUDIO&&(o=r.audioGroups)!=null&&o.some(x=>R.hasAudioGroup(x))||p===X.SUBTITLE&&(l=r.subtitleGroups)!=null&&l.some(x=>R.hasSubtitleGroup(x))||v&&r.audioCodec===R.audioCodec||y&&r.codecSet===R.codecSet||!v&&r.codecSet!==R.codecSet)continue}u=S;break}}if(u>-1&&s.loadLevel!==u)return e.levelRetry=!0,this.playlistError=0,{action:yt.SendAlternateToPenaltyBox,flags:Bt.None,nextAutoLevel:u}}return{action:yt.SendAlternateToPenaltyBox,flags:Bt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var s;switch((s=t.errorAction)==null?void 0:s.action){case yt.DoNothing:break;case yt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==w.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,s=e.errorAction;if(!s)return;const{flags:r}=s,n=s.nextAutoLevel;switch(r){case Bt.None:this.switchLevel(e,n);break;case Bt.MoveAllAlternatesMatchingHDCP:{const l=this.getVariantLevelIndex(e.frag),d=t.levels[l],u=d?.attrs["HDCP-LEVEL"];if(s.hdcpLevel=u,u==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(u){t.maxHdcpLevel=Hc[Hc.indexOf(u)-1],s.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case Bt.MoveAllAlternatesMatchingKey:{const l=e.decryptdata;if(l){const d=this.hls.levels,u=d.length;for(let h=u;h--;)if(this.variantHasKey(d[h],l)){var a,o;this.log(`Banned key found in level ${h} (${d[h].bitrate}bps) or audio group "${(a=d[h].audioGroups)==null?void 0:a.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${bt(l.keyId||[])}`),d[h].fragmentError++,d[h].loadError++,this.log(`Removing level ${h} with key error (${e.error})`),this.hls.removeLevel(h)}const c=e.frag;if(this.hls.levels.length{const l=this.fragments[o];if(!l||a>=l.body.sn)return;if(!l.buffered&&(!l.loaded||n)){l.body.type===s&&this.removeFragment(l.body);return}const d=l.range[e];if(d){if(d.time.length===0){this.removeFragment(l.body);return}d.time.some(u=>{const c=!this.isTimeBuffered(u.startPTS,u.endPTS,t);return c&&this.removeFragment(l.body),c})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const s=e.frag,r=Nr(s),n=this.fragments[r];if(!n||n.buffered&&s.gap)return;const a=!s.relurl;Object.keys(t).forEach(o=>{const l=s.elementaryStreams[o];if(!l)return;const d=t[o],u=a||l.partial===!0;n.range[o]=this.getBufferedTimes(s,e.part,u,d)}),n.loaded=null,Object.keys(n.range).length?(this.bufferedEnd(n,s),ko(n)||this.removeParts(s.sn-1,s.type)):this.removeFragment(n.body)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){const s=this.activePartLists[t];s&&(this.activePartLists[t]=Wp(s,r=>r.fragment.sn>=e))}fragBuffered(e,t){const s=Nr(e);let r=this.fragments[s];!r&&t&&(r=this.fragments[s]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,this.bufferedEnd(r,e))}getBufferedTimes(e,t,s,r){const n={time:[],partial:s},a=e.start,o=e.end,l=e.minEndPTS||o,d=e.maxStartPTS||a;for(let u=0;u=c&&l<=h){n.time.push({startPTS:Math.max(a,r.start(u)),endPTS:Math.min(o,r.end(u))});break}else if(ac){const f=Math.max(a,r.start(u)),m=Math.min(o,r.end(u));m>f&&(n.partial=!0,n.time.push({startPTS:f,endPTS:m}))}else if(o<=c)break}return n}getPartialFragment(e){let t=null,s,r,n,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(d=>{const u=l[d];u&&ko(u)&&(r=u.body.start-o,n=u.body.end+o,e>=r&&e<=n&&(s=Math.min(e-r,n-e),a<=s&&(t=u.body,a=s)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||ko(t))}getState(e){const t=Nr(e),s=this.fragments[t];return s?s.buffered?ko(s)?dt.PARTIAL:dt.OK:dt.APPENDING:dt.NOT_LOADED}isTimeBuffered(e,t,s){let r,n;for(let a=0;a=r&&t<=n)return!0;if(t<=r)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const s=t.frag,r=t.part?null:t,n=Nr(s);this.fragments[n]={body:s,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:s,part:r,timeRanges:n,type:a}=t;if(s.sn==="initSegment")return;const o=s.type;if(r){let d=this.activePartLists[o];d||(this.activePartLists[o]=d=[]),d.push(r)}this.timeRanges=n;const l=n[a];this.detectEvictedFragments(a,l,o,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Nr(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,s=Object.keys(t);if(!e)return s.length>0;for(let r=s.length;r--;){const n=t[s[r]];if(n?.body.type===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,s,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==s||r&&!l.gap||l.starte&&(o.buffered||n)&&this.removeFragment(l)})}removeFragment(e){const t=Nr(e);e.clearElementaryStreamInfo();const s=this.activePartLists[e.type];if(s){const r=e.sn;this.activePartLists[e.type]=Wp(s,n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(s=>s.clearElementaryStreamInfo())}}function ko(i){var e,t,s;return i.buffered&&!!(i.body.gap||(e=i.range.video)!=null&&e.partial||(t=i.range.audio)!=null&&t.partial||(s=i.range.audiovideo)!=null&&s.partial)}function Nr(i){return`${i.type}_${i.level}_${i.sn}`}function Wp(i,e){return i.filter(t=>{const s=e(t);return s||t.clearElementaryStreamInfo(),s})}var Vs={cbc:0,ctr:1};class N1{constructor(e,t,s){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=s}decrypt(e,t){switch(this.aesMode){case Vs.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Vs.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function U1(i){const e=i.byteLength,t=e&&new DataView(i.buffer).getUint8(e-1);return t?i.slice(0,e-t):i}class $1{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),s=new Uint32Array(4);for(let r=0;r<4;r++)s[r]=t.getUint32(r*4);return s}initTable(){const e=this.sBox,t=this.invSBox,s=this.subMix,r=s[0],n=s[1],a=s[2],o=s[3],l=this.invSubMix,d=l[0],u=l[1],c=l[2],h=l[3],f=new Uint32Array(256);let m=0,p=0,g=0;for(g=0;g<256;g++)g<128?f[g]=g<<1:f[g]=g<<1^283;for(g=0;g<256;g++){let v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^v&255^99,e[m]=v,t[v]=m;const b=f[m],y=f[b],T=f[y];let A=f[v]*257^v*16843008;r[m]=A<<24|A>>>8,n[m]=A<<16|A>>>16,a[m]=A<<8|A>>>24,o[m]=A,A=T*16843009^y*65537^b*257^m*16843008,d[v]=A<<24|A>>>8,u[v]=A<<16|A>>>16,c[v]=A<<8|A>>>24,h[v]=A,m?(m=b^f[f[f[T^b]]],p^=f[f[p]]):m=p=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let s=!0,r=0;for(;r{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,s,r);const l=this.flush();l?n(l.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,s,r)}softwareDecrypt(e,t,s,r){const{currentIV:n,currentResult:a,remainderData:o}=this;if(r!==Vs.cbc||t.byteLength!==16)return xe.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=ti(o,e),this.remainderData=null);const l=this.getValidChunk(e);if(!l.length)return null;n&&(s=n);let d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new $1),d.expandKey(t);const u=a;return this.currentResult=d.decrypt(l.buffer,0,s),this.currentIV=l.slice(-16).buffer,u||null}webCryptoDecrypt(e,t,s,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,s,r));this.key=t,this.fastAesKey=new F1(this.subtle,t,r)}return this.fastAesKey.expandKey().then(n=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new N1(this.subtle,new Uint8Array(s),r).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(xe.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,s,r)))}onWebCryptoError(e,t,s,r){const n=this.enableSoftwareAES;if(n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,s,r);const a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(n?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const s=e.length-e.length%H1;return s!==e.length&&(t=e.slice(0,s),this.remainderData=e.slice(s)),t}logOnce(e){this.logEnabled&&(xe.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const qp=Math.pow(2,17);class G1{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const s=e.url;if(!s)return Promise.reject(new as({type:te.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(m=>m[0]==="GAP")){l(jp(e));return}else e.gap=!1;const d=this.loader=n?new n(r):new a(r),u=Yp(e);e.loader=d;const c=Vp(r.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:qp};e.stats=d.stats;const f={onSuccess:(m,p,g,v)=>{this.resetLoader(e,d);let b=m.data;g.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(b.slice(0,16)),b=b.slice(16)),o({frag:e,part:null,payload:b,networkDetails:v})},onError:(m,p,g,v)=>{this.resetLoader(e,d),l(new as({type:te.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Le({url:s,data:void 0},m),error:new Error(`HTTP Error ${m.code} ${m.text}`),networkDetails:g,stats:v}))},onAbort:(m,p,g)=>{this.resetLoader(e,d),l(new as({type:te.NETWORK_ERROR,details:w.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:g,stats:m}))},onTimeout:(m,p,g)=>{this.resetLoader(e,d),l(new as({type:te.NETWORK_ERROR,details:w.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:g,stats:m}))}};t&&(f.onProgress=(m,p,g,v)=>t({frag:e,part:null,payload:g,networkDetails:v})),d.load(u,h,f)})}loadPart(e,t,s){this.abort();const r=this.config,n=r.fLoader,a=r.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(jp(e,t));return}const d=this.loader=n?new n(r):new a(r),u=Yp(e,t);e.loader=d;const c=Vp(r.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:qp};t.stats=d.stats,d.load(u,h,{onSuccess:(f,m,p,g)=>{this.resetLoader(e,d),this.updateStatsFromPart(e,t);const v={frag:e,part:t,payload:f.data,networkDetails:g};s(v),o(v)},onError:(f,m,p,g)=>{this.resetLoader(e,d),l(new as({type:te.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Le({url:u.url,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:p,stats:g}))},onAbort:(f,m,p)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,d),l(new as({type:te.NETWORK_ERROR,details:w.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:p,stats:f}))},onTimeout:(f,m,p)=>{this.resetLoader(e,d),l(new as({type:te.NETWORK_ERROR,details:w.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:p,stats:f}))}})})}updateStatsFromPart(e,t){const s=e.stats,r=t.stats,n=r.total;if(s.loaded+=r.loaded,n){const l=Math.round(e.duration/t.duration),d=Math.min(Math.round(s.loaded/n),l),c=(l-d)*Math.round(s.loaded/d);s.total=s.loaded+c}else s.total=Math.max(s.loaded,s.total);const a=s.loading,o=r.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function Yp(i,e=null){const t=e||i,s={frag:i,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(Q(r)&&Q(n)){var a;let o=r,l=n;if(i.sn==="initSegment"&&K1((a=i.decryptdata)==null?void 0:a.method)){const d=n-r;d%16&&(l=n+(16-d%16)),r!==0&&(s.resetIV=!0,o=r-16)}s.rangeStart=o,s.rangeEnd=l}return s}function jp(i,e){const t=new Error(`GAP ${i.gap?"tag":"attribute"} found`),s={type:te.MEDIA_ERROR,details:w.FRAG_GAP,fatal:!1,frag:i,error:t,networkDetails:null};return e&&(s.part=e),(e||i).stats.aborted=!0,new as(s)}function K1(i){return i==="AES-128"||i==="AES-256"}class as extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class uE extends si{constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class Ff{constructor(e,t,s,r=0,n=-1,a=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Do(),this.buffering={audio:Do(),video:Do(),audiovideo:Do()},this.level=e,this.sn=t,this.id=s,this.size=r,this.part=n,this.partial=a}}function Do(){return{start:0,executeStart:0,executeEnd:0,end:0}}const zp={length:0,start:()=>0,end:()=>0};class de{static isBuffered(e,t){if(e){const s=de.getBuffered(e);for(let r=s.length;r--;)if(t>=s.start(r)&&t<=s.end(r))return!0}return!1}static bufferedRanges(e){if(e){const t=de.getBuffered(e);return de.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let s=0;s1&&e.sort((u,c)=>u.start-c.start||c.end-u.end);let r=-1,n=[];if(s)for(let u=0;u=e[u].start&&t<=e[u].end&&(r=u);const c=n.length;if(c){const h=n[c-1].end;e[u].start-hh&&(n[c-1].end=e[u].end):n.push(e[u])}else n.push(e[u])}else n=e;let a=0,o,l=t,d=t;for(let u=0;u=c&&t<=h&&(r=u),t+s>=c&&t{const r=s.substring(2,s.length-1),n=t?.[r];return n===void 0?(i.playlistParsingError||(i.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),s):n})}return e}function Xp(i,e,t){let s=i.variableList;s||(i.variableList=s={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(r))n=a.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(a){i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else r=e.NAME,n=e.VALUE;r in s?i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):s[r]=n||""}function V1(i,e,t){const s=e.IMPORT;if(t&&s in t){let r=i.variableList;r||(i.variableList=r={}),r[s]=t[s]}else i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}const W1=/^(\d+)x(\d+)$/,Zp=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ke{constructor(e,t){typeof e=="string"&&(e=Ke.parseAttrList(e,t)),Ce(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const s=new Uint8Array(t.length/2);for(let r=0;rNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const s=this[e];return s?parseFloat(s):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const s=this[e];return(s?s.split(/[ ,]+/):[]).reduce((r,n)=>(r[n.toLowerCase()]=!0,r),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=W1.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let s;const r={};for(Zp.lastIndex=0;(s=Zp.exec(e))!==null;){const a=s[1].trim();let o=s[2];const l=o.indexOf('"')===0&&o.lastIndexOf('"')===o.length-1;let d=!1;if(l)o=o.slice(1,-1);else switch(a){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":d=!0}if(t&&(l||d))o=Kc(t,o);else if(!d&&!l)switch(a){case"CLOSED-CAPTIONS":if(o==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":xe.warn(`${e}: attribute ${a} is missing quotes`)}r[a]=o}return r}}const q1="com.apple.hls.interstitial";function Y1(i){return i!=="ID"&&i!=="CLASS"&&i!=="CUE"&&i!=="START-DATE"&&i!=="DURATION"&&i!=="END-DATE"&&i!=="END-ON-NEXT"}function j1(i){return i==="SCTE35-OUT"||i==="SCTE35-IN"||i==="SCTE35-CMD"}class hE{constructor(e,t,s=0){var r;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=t?.tagAnchor||null,this.tagOrder=(r=t?.tagOrder)!=null?r:s,t){const n=t.attr;for(const a in n)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==n[a]){xe.warn(`DATERANGE tag attribute: "${a}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=a;break}e=Ce(new Ke({}),n,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const n=t?.endDate||new Date(this.attr["END-DATE"]);Q(n.getTime())&&(this._endDate=n)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(xe.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(Q(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===q1}get isValid(){return!!this.id&&!this._badValueForSameId&&Q(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const z1=10;class Q1{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,s=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!s||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&s>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let s=t.decryptdata;return s||(t.setKeyFormat(e.keyFormat),s=t.decryptdata),!!s&&e.matches(s)})}get hasProgramDateTime(){return this.fragments.length?Q(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||z1}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let s=e.length;s--;)if(e[s].index>t)return e[s].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function Pd(i,e){return i.length===e.length?!i.some((t,s)=>t!==e[s]):!1}function Jp(i,e){return!i&&!e?!0:!i||!e?!1:Pd(i,e)}function Ln(i){return i==="AES-128"||i==="AES-256"||i==="AES-256-CTR"}function Bf(i){switch(i){case"AES-128":case"AES-256":return Vs.cbc;case"AES-256-CTR":return Vs.ctr;default:throw new Error(`invalid full segment method ${i}`)}}function Hf(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0))}function Vc(i){return Uint8Array.from(unescape(encodeURIComponent(i)),e=>e.charCodeAt(0))}function X1(i){const e=Vc(i).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function fE(i){const e=function(s,r,n){const a=s[r];s[r]=s[n],s[n]=a};e(i,0,3),e(i,1,2),e(i,4,5),e(i,6,7)}function mE(i){const e=i.split(":");let t=null;if(e[0]==="data"&&e.length===2){const s=e[1].split(";"),r=s[s.length-1].split(",");if(r.length===2){const n=r[0]==="base64",a=r[1];n?(s.splice(-1,1),t=Hf(a)):t=X1(a)}}return t}const Od=typeof self<"u"?self:void 0;var Ve={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Tt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function ul(i){switch(i){case Tt.FAIRPLAY:return Ve.FAIRPLAY;case Tt.PLAYREADY:return Ve.PLAYREADY;case Tt.WIDEVINE:return Ve.WIDEVINE;case Tt.CLEARKEY:return Ve.CLEARKEY}}function Qu(i){switch(i){case Ve.FAIRPLAY:return Tt.FAIRPLAY;case Ve.PLAYREADY:return Tt.PLAYREADY;case Ve.WIDEVINE:return Tt.WIDEVINE;case Ve.CLEARKEY:return Tt.CLEARKEY}}function ca(i){const{drmSystems:e,widevineLicenseUrl:t}=i,s=e?[Ve.FAIRPLAY,Ve.WIDEVINE,Ve.PLAYREADY,Ve.CLEARKEY].filter(r=>!!e[r]):[];return!s[Ve.WIDEVINE]&&t&&s.push(Ve.WIDEVINE),s}const pE=(function(i){return Od!=null&&(i=Od.navigator)!=null&&i.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null})();function Z1(i,e,t,s){let r;switch(i){case Ve.FAIRPLAY:r=["cenc","sinf"];break;case Ve.WIDEVINE:case Ve.PLAYREADY:r=["cenc"];break;case Ve.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${i}`)}return J1(r,e,t,s)}function J1(i,e,t,s){return[{initDataTypes:i,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs=${n}`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs=${n}`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function eI(i){var e;return!!i&&(i.sessionType==="persistent-license"||!!((e=i.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function gE(i){const e=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),s=t.substring(t.indexOf("<"),t.length),a=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(a){const o=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(o){const l=Hf(o).subarray(0,16);return fE(l),l}}return null}let Ur={};class Hs{static clearKeyUriToKeyIdMap(){Ur={}}static setKeyIdForUri(e,t){Ur[e]=t}static addKeyIdForUri(e){const t=Object.keys(Ur).length%Number.MAX_SAFE_INTEGER,s=new Uint8Array(16);return new DataView(s.buffer,12,4).setUint32(0,t),Ur[e]=s,s}constructor(e,t,s,r=[1],n=null,a){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=s,this.keyFormatVersions=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Ln(e),a!=null&&a.startsWith("0x")&&(this.keyId=new Uint8Array(Vv(a)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Pd(e.keyFormatVersions,this.keyFormatVersions)&&Jp(e.iv,this.iv)&&Jp(e.keyId,this.keyId)}isSupported(){if(this.method){if(Ln(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Tt.FAIRPLAY:case Tt.WIDEVINE:case Tt.PLAYREADY:case Tt.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(Ln(this.method)){let n=this.iv;return n||(typeof e!="number"&&(xe.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),n=iI(e)),new Hs(this.method,this.uri,"identity",this.keyFormatVersions,n)}if(this.keyId){const n=Ur[this.uri];if(n&&!Pd(this.keyId,n)&&Hs.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const s=mE(this.uri);if(s)switch(this.keyFormat){case Tt.WIDEVINE:if(this.pssh=s,!this.keyId){const n=n1(s.buffer);if(n.length){var r;const a=n[0];this.keyId=(r=a.kids)!=null&&r.length?a.kids[0]:null}}this.keyId||(this.keyId=eg(t));break;case Tt.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=r1(n,null,s),this.keyId=gE(s);break}default:{let n=s.subarray(0,16);if(n.length!==16){const a=new Uint8Array(16);a.set(n,16-n.length),n=a}this.keyId=n;break}}if(!this.keyId||this.keyId.byteLength!==16){let n;n=tI(t),n||(n=eg(t),n||(n=Ur[this.uri])),n&&(this.keyId=n,Hs.setKeyIdForUri(this.uri,n))}return this}}function tI(i){const e=i?.[Tt.WIDEVINE];return e?e.keyId:null}function eg(i){const e=i?.[Tt.PLAYREADY];if(e){const t=mE(e.uri);if(t)return gE(t)}return null}function iI(i){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=i>>8*(15-t)&255;return e}const tg=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,ig=/#EXT-X-MEDIA:(.*)/g,sI=/^#EXT(?:INF|-X-TARGETDURATION):/m,Xu=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),rI=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Wi{static findGroup(e,t){for(let s=0;s0&&n.length({id:d.attrs.AUDIO,audioCodec:d.audioCodec})),SUBTITLES:a.map(d=>({id:d.attrs.SUBTITLES,textCodec:d.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(ig.lastIndex=0;(r=ig.exec(e))!==null;){const d=new Ke(r[1],s),u=d.TYPE;if(u){const c=o[u],h=n[u]||[];n[u]=h;const f=d.LANGUAGE,m=d["ASSOC-LANGUAGE"],p=d.CHANNELS,g=d.CHARACTERISTICS,v=d["INSTREAM-ID"],b={attrs:d,bitrate:0,id:l++,groupId:d["GROUP-ID"]||"",name:d.NAME||f||"",type:u,default:d.bool("DEFAULT"),autoselect:d.bool("AUTOSELECT"),forced:d.bool("FORCED"),lang:f,url:d.URI?Wi.resolve(d.URI,t):""};if(m&&(b.assocLang=m),p&&(b.channels=p),g&&(b.characteristics=g),v&&(b.instreamId=v),c!=null&&c.length){const y=Wi.findGroup(c,b.groupId)||c[0];ag(b,y,"audioCodec"),ag(b,y,"textCodec")}h.push(b)}}return n}static parseLevelPlaylist(e,t,s,r,n,a){var o;const l={url:t},d=new Q1(t),u=d.fragments,c=[];let h=null,f=0,m=0,p=0,g=0,v=0,b=null,y=new Yu(r,l),T,A,L,S=-1,R=!1,x=null,I;if(Xu.lastIndex=0,d.m3u8=e,d.hasVariableRefs=Qp(e),((o=Xu.exec(e))==null?void 0:o[0])!=="#EXTM3U")return d.playlistParsingError=new Error("Missing format identifier #EXTM3U"),d;for(;(T=Xu.exec(e))!==null;){R&&(R=!1,y=new Yu(r,l),y.playlistOffset=p,y.setStart(p),y.sn=f,y.cc=g,v&&(y.bitrate=v),y.level=s,h&&(y.initSegment=h,h.rawProgramDateTime&&(y.rawProgramDateTime=h.rawProgramDateTime,h.rawProgramDateTime=null),x&&(y.setByteRange(x),x=null)));const j=T[1];if(j){y.duration=parseFloat(j);const H=(" "+T[2]).slice(1);y.title=H||null,y.tagList.push(H?["INF",j,H]:["INF",j])}else if(T[3]){if(Q(y.duration)){y.playlistOffset=p,y.setStart(p),L&&lg(y,L,d),y.sn=f,y.level=s,y.cc=g,u.push(y);const H=(" "+T[3]).slice(1);y.relurl=Kc(d,H),Wc(y,b,c),b=y,p+=y.duration,f++,m=0,R=!0}}else{if(T=T[0].match(rI),!T){xe.warn("No matches on slow regex match for level playlist!");continue}for(A=1;A0&&dg(d,H,T),f=d.startSN=parseInt(N);break;case"SKIP":{d.skippedSegments&&es(d,H,T);const B=new Ke(N,d),z=B.decimalInteger("SKIPPED-SEGMENTS");if(Q(z)){d.skippedSegments+=z;for(let U=z;U--;)u.push(null);f+=z}const ee=B.enumeratedString("RECENTLY-REMOVED-DATERANGES");ee&&(d.recentlyRemovedDateranges=(d.recentlyRemovedDateranges||[]).concat(ee.split(" ")));break}case"TARGETDURATION":d.targetduration!==0&&es(d,H,T),d.targetduration=Math.max(parseInt(N),1);break;case"VERSION":d.version!==null&&es(d,H,T),d.version=parseInt(N);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":d.live||es(d,H,T),d.live=!1;break;case"#":(N||q)&&y.tagList.push(q?[N,q]:[N]);break;case"DISCONTINUITY":g++,y.tagList.push(["DIS"]);break;case"GAP":y.gap=!0,y.tagList.push([H]);break;case"BITRATE":y.tagList.push([H,N]),v=parseInt(N)*1e3,Q(v)?y.bitrate=v:v=0;break;case"DATERANGE":{const B=new Ke(N,d),z=new hE(B,d.dateRanges[B.ID],d.dateRangeTagCount);d.dateRangeTagCount++,z.isValid||d.skippedSegments?d.dateRanges[z.id]=z:xe.warn(`Ignoring invalid DATERANGE tag: "${N}"`),y.tagList.push(["EXT-X-DATERANGE",N]);break}case"DEFINE":{{const B=new Ke(N,d);"IMPORT"in B?V1(d,B,a):Xp(d,B,t)}break}case"DISCONTINUITY-SEQUENCE":d.startCC!==0?es(d,H,T):u.length>0&&dg(d,H,T),d.startCC=g=parseInt(N);break;case"KEY":{const B=sg(N,t,d);if(B.isSupported()){if(B.method==="NONE"){L=void 0;break}L||(L={});const z=L[B.keyFormat];z!=null&&z.matches(B)||(z&&(L=Ce({},L)),L[B.keyFormat]=B)}else xe.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${N}"`);break}case"START":d.startTimeOffset=rg(N);break;case"MAP":{const B=new Ke(N,d);if(y.duration){const z=new Yu(r,l);og(z,B,s,L),h=z,y.initSegment=h,h.rawProgramDateTime&&!y.rawProgramDateTime&&(y.rawProgramDateTime=h.rawProgramDateTime)}else{const z=y.byteRangeEndOffset;if(z){const ee=y.byteRangeStartOffset;x=`${z-ee}@${ee}`}else x=null;og(y,B,s,L),h=y,R=!0}h.cc=g;break}case"SERVER-CONTROL":{I&&es(d,H,T),I=new Ke(N),d.canBlockReload=I.bool("CAN-BLOCK-RELOAD"),d.canSkipUntil=I.optionalFloat("CAN-SKIP-UNTIL",0),d.canSkipDateRanges=d.canSkipUntil>0&&I.bool("CAN-SKIP-DATERANGES"),d.partHoldBack=I.optionalFloat("PART-HOLD-BACK",0),d.holdBack=I.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{d.partTarget&&es(d,H,T);const B=new Ke(N);d.partTarget=B.decimalFloatingPoint("PART-TARGET");break}case"PART":{let B=d.partList;B||(B=d.partList=[]);const z=m>0?B[B.length-1]:void 0,ee=m++,U=new Ke(N,d),$=new VS(U,y,l,ee,z);B.push($),y.duration+=$.duration;break}case"PRELOAD-HINT":{const B=new Ke(N,d);d.preloadHint=B;break}case"RENDITION-REPORT":{const B=new Ke(N,d);d.renditionReports=d.renditionReports||[],d.renditionReports.push(B);break}default:xe.warn(`line parsed but not handled: ${T}`);break}}}b&&!b.relurl?(u.pop(),p-=b.duration,d.partList&&(d.fragmentHint=b)):d.partList&&(Wc(y,b,c),y.cc=g,d.fragmentHint=y,L&&lg(y,L,d)),d.targetduration||(d.playlistParsingError=new Error("Missing Target Duration"));const M=u.length,F=u[0],V=u[M-1];if(p+=d.skippedSegments*d.targetduration,p>0&&M&&V){d.averagetargetduration=p/M;const j=V.sn;d.endSN=j!=="initSegment"?j:0,d.live||(V.endList=!0),S>0&&(aI(u,S),F&&c.unshift(F))}return d.fragmentHint&&(p+=d.fragmentHint.duration),d.totalduration=p,c.length&&d.dateRangeTagCount&&F&&vE(c,d),d.endCC=g,d}}function vE(i,e){let t=i.length;if(!t)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];i.push(o),t++}else return;const s=i[t-1],r=e.live?1/0:e.totalduration,n=Object.keys(e.dateRanges);for(let o=n.length;o--;){const l=e.dateRanges[n[o]],d=l.startDate.getTime();l.tagAnchor=s.ref;for(let u=t;u--;){var a;if(((a=i[u])==null?void 0:a.sn)=o||s===0){var a;const l=(((a=t[s+1])==null?void 0:a.start)||r)-n.start;if(e<=o+l*1e3){const d=t[s].sn-i.startSN;if(d<0)return-1;const u=i.fragments;if(u.length>t.length){const h=(t[s+1]||u[u.length-1]).sn-i.startSN;for(let f=h;f>d;f--){const m=u[f].programDateTime;if(e>=m&&es);["video","audio","text"].forEach(s=>{const r=t.filter(n=>Of(n,s));r.length&&(e[`${s}Codec`]=r.map(n=>n.split("/")[0]).join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function ag(i,e,t){const s=e[t];s&&(i[t]=s)}function aI(i,e){let t=i[e];for(let s=e;s--;){const r=i[s];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function Wc(i,e,t){i.rawProgramDateTime?t.push(i):e!=null&&e.programDateTime&&(i.programDateTime=e.endProgramDateTime)}function og(i,e,t,s){i.relurl=e.URI,e.BYTERANGE&&i.setByteRange(e.BYTERANGE),i.level=t,i.sn="initSegment",s&&(i.levelkeys=s),i.initSegment=null}function lg(i,e,t){i.levelkeys=e;const{encryptedFragments:s}=t;(!s.length||s[s.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&s.push(i)}function es(i,e,t){i.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function dg(i,e,t){i.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function Zu(i,e){const t=e.startPTS;if(Q(t)){let s=0,r;e.sn>i.sn?(s=t-i.start,r=i):(s=i.start-t,r=e),r.duration!==s&&r.setDuration(s)}else e.sn>i.sn?i.cc===e.cc&&i.minEndPTS?e.setStart(i.start+(i.minEndPTS-i.start)):e.setStart(i.start+i.duration):e.setStart(Math.max(i.start-e.duration,0))}function EE(i,e,t,s,r,n,a){s-t<=0&&(a.warn("Fragment should have a positive duration",e),s=t+e.duration,n=r+e.duration);let l=t,d=s;const u=e.startPTS,c=e.endPTS;if(Q(u)){const v=Math.abs(u-t);i&&v>i.totalduration?a.warn(`media timestamps and playlist times differ by ${v}s for level ${e.level} ${i.url}`):Q(e.deltaPTS)?e.deltaPTS=Math.max(v,e.deltaPTS):e.deltaPTS=v,l=Math.max(t,u),t=Math.min(t,u),r=e.startDTS!==void 0?Math.min(r,e.startDTS):r,d=Math.min(s,c),s=Math.max(s,c),n=e.endDTS!==void 0?Math.max(n,e.endDTS):n}const h=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(s-e.start),e.startPTS=t,e.maxStartPTS=l,e.startDTS=r,e.endPTS=s,e.minEndPTS=d,e.endDTS=n;const f=e.sn;if(!i||fi.endSN)return 0;let m;const p=f-i.startSN,g=i.fragments;for(g[p]=e,m=p;m>0;m--)Zu(g[m],g[m-1]);for(m=p;m=0;u--){const c=r[u].initSegment;if(c){s=c;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;let n;uI(i,e,(u,c,h,f)=>{if((!e.startCC||e.skippedSegments)&&c.cc!==u.cc){const m=u.cc-c.cc;for(let p=h;p{var c;u&&(!u.initSegment||u.initSegment.relurl===((c=s)==null?void 0:c.relurl))&&(u.initSegment=s)}),e.skippedSegments){if(e.deltaUpdateFailed=a.some(u=>!u),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let u=e.skippedSegments;u--;)a.shift();e.startSN=a[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=lI(i.dateRanges,e,t));const u=i.fragments.filter(c=>c.rawProgramDateTime);if(i.hasProgramDateTime&&!e.hasProgramDateTime)for(let c=1;c{c.elementaryStreams=u.elementaryStreams,c.stats=u.stats}),n?EE(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS,t):yE(i,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=i.driftStartTime,e.driftStart=i.driftStart;const d=e.advancedDateTime;if(e.advanced&&d){const u=e.edge;e.driftStart||(e.driftStartTime=d,e.driftStart=u),e.driftEndTime=d,e.driftEnd=u}else e.driftEndTime=i.driftEndTime,e.driftEnd=i.driftEnd,e.advancedDateTime=i.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=i.requestScheduled)}function lI(i,e,t){const{dateRanges:s,recentlyRemovedDateranges:r}=e,n=Ce({},i);r&&r.forEach(l=>{delete n[l]});const o=Object.keys(n).length;return o?(Object.keys(s).forEach(l=>{const d=n[l],u=new hE(s[l].attr,d);u.isValid?(n[l]=u,d||(u.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Pe(s[l].attr)}"`)}),n):s}function dI(i,e,t){if(i&&e){let s=0;for(let r=0,n=i.length;r<=n;r++){const a=i[r],o=e[r+s];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):s--}}}function uI(i,e,t){const s=e.skippedSegments,r=Math.max(i.startSN,e.startSN)-e.startSN,n=(i.fragmentHint?1:0)+(s?e.endSN:Math.min(i.endSN,e.endSN))-e.startSN,a=e.startSN-i.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments;for(let d=r;d<=n;d++){const u=l[a+d];let c=o[d];if(s&&!c&&u&&(c=e.fragments[d]=u),u&&c){t(u,c,d,o);const h=u.relurl,f=c.relurl;if(h&&cI(h,f)){e.playlistParsingError=ug(`media sequence mismatch ${c.sn}:`,i,e,u,c);return}else if(u.cc!==c.cc){e.playlistParsingError=ug(`discontinuity sequence mismatch (${u.cc}!=${c.cc})`,i,e,u,c);return}}}}function ug(i,e,t,s,r){return new Error(`${i} ${r.url} +Playlist starting @${e.startSN} +${e.m3u8} + +Playlist starting @${t.startSN} +${t.m3u8}`)}function yE(i,e,t=!0){const s=e.startSN+e.skippedSegments-i.startSN,r=i.fragments,n=s>=0;let a=0;if(n&&se){const n=s[s.length-1].duration*1e3;n{var s;(s=e.details)==null||s.fragments.forEach(r=>{r.level=t,r.initSegment&&(r.initSegment.level=t)})})}function cI(i,e){return i!==e&&e?hg(i)!==hg(e):!1}function hg(i){return i.replace(/\?[^?]*$/,"")}function Ua(i,e){for(let s=0,r=i.length;si.startCC)}function fg(i,e){const t=i.start+e;i.startPTS=t,i.setStart(t),i.endPTS=t+i.duration}function SE(i,e){const t=e.fragments;for(let s=0,r=t.length;s{const{config:a,fragCurrent:o,media:l,mediaBuffer:d,state:u}=this,c=l?l.currentTime:0,h=de.bufferInfo(d||l,c,a.maxBufferHole),f=!h.len;if(this.log(`Media seeking to ${Q(c)?c.toFixed(3):c}, state: ${u}, ${f?"out of":"in"} buffer`),this.state===P.ENDED)this.resetLoadingState();else if(o){const m=a.maxFragLookUpTolerance,p=o.start-m,g=o.start+o.duration+m;if(f||gh.end){const v=c>g;(cm&&(this.lastCurrentTime=c),!this.loadingParts){const p=Math.max(h.end,c),g=this.shouldLoadParts(this.getLevelDetails(),p);g&&(this.log(`LL-Part loading ON after seeking to ${c.toFixed(2)} with buffer @${p.toFixed(2)}`),this.loadingParts=g)}}this.hls.hasEnoughToStart||(this.log(`Setting ${f?"startPosition":"nextLoadPosition"} to ${c} for seek without enough to start`),this.nextLoadPosition=c,f&&(this.startPosition=c)),f&&this.state===P.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=n,this.hls=e,this.fragmentLoader=new G1(e.config),this.keyLoader=s,this.fragmentTracker=t,this.config=e.config,this.decrypter=new $f(e.config)}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===P.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=P.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const s=e.end||0,r=this.config.timelineOffset||0;if(s<=r)return!1;const n=e.buffered;this.config.maxBufferHole&&n&&n.length>1&&(e=de.bufferedInfo(n,e.start,0));const a=e.nextStart;if(a&&a>r&&a{const a=n.frag;if(this.fragContextChanged(a)){this.warn(`${a.type} sn: ${a.sn}${n.part?" part: "+n.part.index:""} of ${this.fragInfo(a,!1,n.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(a);return}a.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,s,r).then(n=>{if(!n)return;const a=this.state,o=n.frag;if(this.fragContextChanged(o)){(a===P.FRAG_LOADING||!this.fragCurrent&&a===P.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=P.IDLE);return}"payload"in n&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(E.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===P.STOPPED||this.state===P.ERROR||(this.warn(`Frag error: ${n?.message||n}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:s}=this;if(s.getState(e)===dt.APPENDING){const n=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,n),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&s.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?s.removeAllFragments():s.hasParts(e.type)&&(s.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),s.getState(e)===dt.PARTIAL&&s.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const t=e.details;return t?.live&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,s=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:s};this.hls.trigger(E.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(s=>{const r=s?.frag;if(!r||this.fragContextChanged(r)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:r}=this,{frag:n,payload:a}=s,o=n.decryptdata;if(a&&a.byteLength>0&&o!=null&&o.key&&o.iv&&Ln(o.method)){const l=self.performance.now();return this.decrypter.decrypt(new Uint8Array(a),o.key.buffer,o.iv.buffer,Bf(o.method)).catch(d=>{throw r.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:n}),d}).then(d=>{const u=self.performance.now();return r.trigger(E.FRAG_DECRYPTED,{frag:n,payload:d,stats:{tstart:l,tdecrypt:u}}),s.payload=d,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===P.STOPPED||this.state===P.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const s=e.frag.stats;this.state!==P.STOPPED&&(this.state=P.IDLE),e.frag.data=new Uint8Array(e.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var s,r;const n=e.tracks;if(n&&!t.encrypted&&((s=n.audio)!=null&&s.encrypted||(r=n.video)!=null&&r.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const a=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${a?"attached mediaKeys: "+a.mediaKeys:"detached"})`);return this.warn(o.message),!a||a.mediaKeys?!1:(this.hls.trigger(E.ERROR,{type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${s?mI.toString(de.getBuffered(s)):"(detached)"})`),ze(e)){var r;if(e.type!==X.SUBTITLE){const a=e.elementaryStreams;if(!Object.keys(a).some(o=>!!a[o])){this.state=P.IDLE;return}}const n=(r=this.levels)==null?void 0:r[e.level];n!=null&&n.fragmentError&&(this.log(`Resetting level fragment error count of ${n.fragmentError} on frag buffered`),n.fragmentError=0)}this.state=P.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:s,part:r,partsLoaded:n}=e,a=!n||n.length===0||n.some(l=>!l),o=new Ff(s.level,s.sn,s.stats.chunkCount+1,0,r?r.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,s=null,r){var n;this.fragCurrent=e;const a=t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)){if(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=P.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(h=>{if(!this.fragContextChanged(h.frag))return this.hls.trigger(E.KEY_LOADED,h),this.state===P.KEY_LOADING&&(this.state=P.IDLE),h}),this.hls.trigger(E.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,a.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));const l=this.fragPrevious;if(ze(e)&&(!l||e.sn!==l.sn)){const h=this.shouldLoadParts(t.details,e.end);h!==this.loadingParts&&(this.log(`LL-Part loading ${h?"ON":"OFF"} loading sn ${l?.sn}->${e.sn}`),this.loadingParts=h)}if(s=Math.max(e.start,s||0),this.loadingParts&&ze(e)){const h=a.partList;if(h&&r){s>a.fragmentEnd&&a.fragmentHint&&(e=a.fragmentHint);const f=this.getNextPart(h,e,s);if(f>-1){const m=h[f];e=this.fragCurrent=m.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${m.index} (${f}/${h.length-1}) of ${this.fragInfo(e,!1,m)}) cc: ${e.cc} [${a.startSN}-${a.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=m.start+m.duration,this.state=P.FRAG_LOADING;let p;return o?p=o.then(g=>!g||this.fragContextChanged(g.frag)?null:this.doFragPartsLoad(e,m,t,r)).catch(g=>this.handleFragLoadError(g)):p=this.doFragPartsLoad(e,m,t,r).catch(g=>this.handleFragLoadError(g)),this.hls.trigger(E.FRAG_LOADING,{frag:e,part:m,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):p}else if(!e.url||this.loadedEndOfParts(h,s))return Promise.resolve(null)}}if(ze(e)&&this.loadingParts){var d;this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(d=a.partList)==null?void 0:d.filter(h=>h.loaded).map(h=>`[${h.start}-${h.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+a.startSN+"-"+a.endSN+"]"}, target: ${parseFloat(s.toFixed(3))}`),Q(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=P.FRAG_LOADING;const u=this.config.progressive&&e.type!==X.SUBTITLE;let c;return u&&o?c=o.then(h=>!h||this.fragContextChanged(h.frag)?null:this.fragmentLoader.load(e,r)).catch(h=>this.handleFragLoadError(h)):c=Promise.all([this.fragmentLoader.load(e,u?r:void 0),o]).then(([h])=>(!u&&r&&r(h),h)).catch(h=>this.handleFragLoadError(h)),this.hls.trigger(E.FRAG_LOADING,{frag:e,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c}doFragPartsLoad(e,t,s,r){return new Promise((n,a)=>{var o;const l=[],d=(o=s.details)==null?void 0:o.partList,u=c=>{this.fragmentLoader.loadPart(e,c,r).then(h=>{l[c.index]=h;const f=h.part;this.hls.trigger(E.FRAG_LOADED,h);const m=cg(s.details,e.sn,c.index+1)||_E(d,e.sn,c.index+1);if(m)u(m);else return n({frag:e,part:f,partsLoaded:l})}).catch(a)};u(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===w.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===te.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(E.ERROR,t)}else this.hls.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==P.PARSING){!this.fragCurrent&&this.state!==P.STOPPED&&this.state!==P.ERROR&&(this.state=P.IDLE);return}const{frag:s,part:r,level:n}=t,a=self.performance.now();s.stats.parsing.end=a,r&&(r.stats.parsing.end=a);const o=this.getLevelDetails(),d=o&&s.sn>o.endSN||this.shouldLoadParts(o,s.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} after parsing segment ending @${s.end.toFixed(2)}`),this.loadingParts=d),this.updateLevelTiming(s,r,n,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var s;const n=e.partList[0];if(n.fragment.type===X.SUBTITLE)return!1;const a=n.end+(((s=e.fragmentHint)==null?void 0:s.duration)||0);if(t>=a){var r;if((this.hls.hasEnoughToStart?((r=this.media)==null?void 0:r.currentTime)||this.lastCurrentTime:this.getLoadPosition())>n.start-n.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:s}=this,{level:r,sn:n,part:a}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;const o=t[r],l=o.details,d=a>-1?cg(l,n,a):null,u=d?d.fragment:TE(l,n,s);return u?(s&&s!==u&&(u.stats=s.stats),{frag:u,part:d,level:o}):null}bufferFragmentData(e,t,s,r,n){if(this.state!==P.PARSING)return;const{data1:a,data2:o}=e;let l=a;if(o&&(l=ti(a,o)),!l.length)return;const d=this.initPTS[t.cc],u=d?-d.baseTime/d.timescale:void 0,c={type:e.type,frag:t,part:s,chunkMeta:r,offset:u,parent:t.type,data:l};if(this.hls.trigger(E.BUFFER_APPENDING,c),e.dropped&&e.independent&&!s){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!de.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const s=t.currentTime,r=de.bufferInfo(t,s,0),n=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),o=Math.max(Math.min(e.start-a,r.end-a),s+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var s;const r=this.getLoadPosition();if(!Q(r))return null;const a=this.lastCurrentTime>r||(s=this.media)!=null&&s.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,a)}getFwdBufferInfoAtPos(e,t,s,r){const n=de.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,s);if(a&&(n.nextStart<=a.end||a.gap)){const o=Math.max(Math.min(n.nextStart,a.end)-t,r);return de.bufferInfo(e,t,o)}}return n}getMaxBufferLength(e){const{config:t}=this;let s;return e?s=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):s=t.maxBufferLength,Math.min(s,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const s=this.config,r=Math.max(Math.min(e-t,s.maxBufferLength),t),n=Math.max(e-t*3,s.maxMaxBufferLength/2,r);return n>=r?(s.maxMaxBufferLength=n,this.warn(`Reduce max buffer length to ${n}s`),!0):!1}getAppendedFrag(e,t=X.MAIN){const s=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return s&&"fragment"in s?s.fragment:s}getNextFragment(e,t){const s=t.fragments,r=s.length;if(!r)return null;const{config:n}=this,a=s[0].start,o=n.lowLatencyMode&&!!t.partList;let l=null;if(t.live){const c=n.initialLiveManifestSize;if(r=a?h:f)||l.start:e;this.log(`Setting startPosition to ${m} to match start frag at live edge. mainStart: ${h} liveSyncPosition: ${f} frag.start: ${(d=l)==null?void 0:d.start}`),this.startPosition=this.nextLoadPosition=m}}else e<=a&&(l=s[0]);if(!l){const c=this.loadingParts?t.partEnd:t.fragmentEnd;l=this.getFragmentAtPosition(e,c,t)}let u=this.filterReplacedPrimary(l,t);if(!u&&l){const c=l.sn-t.startSN;u=this.filterReplacedPrimary(s[c+1]||null,t)}return this.mapToInitFragWhenRequired(u)}isLoopLoading(e,t){const s=this.fragmentTracker.getState(e);return(s===dt.OK||s===dt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,s,r,n){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t),a&&!a.gap&&s.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,r,0);if(o!==null&&s.len+o.len>=n){const l=a.sn;return this.loopSn!==l&&(this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${l}`),this.loopSn=l),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(mg(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(mg(this.config)&&e.type!==X.SUBTITLE){const s=this.hls.interstitialsManager,r=s?.bufferingItem;if(r){const a=r.event;if(a){if(a.appendInPlace||Math.abs(e.start-r.start)>1||r.start===0)return null}else if(e.end<=r.start&&t?.live===!1||e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}const n=s?.playerQueue;if(n)for(let a=n.length;a--;){const o=n[a].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,s){let r=-1,n=!1,a=!0;for(let o=0,l=e.length;o-1&&ss.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,s=this.fragPrevious;let r=null;if(s){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),r=D1(t,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=s.sn+1;if(n>=e.startSN&&n<=e.endSN){const a=t[n-e.startSN];s.cc===a.cc&&(r=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=oE(e,s.cc,s.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,s){const{config:r}=this;let{fragPrevious:n}=this,{fragments:a,endSN:o}=s;const{fragmentHint:l}=s,{maxFragLookUpTolerance:d}=r,u=s.partList,c=!!(this.loadingParts&&u!=null&&u.length&&l);c&&!this.bitrateTest&&u[u.length-1].fragment.sn===l.sn&&(a=a.concat(l),o=l.sn);let h;if(et-d||(f=this.media)!=null&&f.paused||!this.startFragRequested?0:d;h=xr(n,a,e,p)}else h=a[a.length-1];if(h){const m=h.sn-s.startSN,p=this.fragmentTracker.getState(h);if((p===dt.OK||p===dt.PARTIAL&&h.gap)&&(n=h),n&&h.sn===n.sn&&(!c||u[0].fragment.sn>h.sn||!s.live)&&h.level===n.level){const v=a[m+1];h.sn${e.startSN} fragments: ${r}`),l}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let s=this.startPosition;s=0&&(s=this.nextLoadPosition),s}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&ze(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==P.FRAG_LOADING_WAITING_RETRY)&&(this.state=P.IDLE)}onFragmentOrKeyLoadError(e,t){var s;if(t.chunkMeta&&!t.frag){const v=this.getCurrentContext(t.chunkMeta);v&&(t.frag=v.frag)}const r=t.frag;if(!r||r.type!==e||!this.levels)return;if(this.fragContextChanged(r)){var n;this.warn(`Frag load error must match current frag to retry ${r.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const a=t.details===w.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(r,!0);const o=t.errorAction;if(!o){this.state=P.ERROR;return}const{action:l,flags:d,retryCount:u=0,retryConfig:c}=o,h=!!c,f=h&&l===yt.RetryRequest,m=h&&!o.resolved&&d===Bt.MoveAllAlternatesMatchingHost,p=(s=this.hls.latestLevelDetails)==null?void 0:s.live;if(!f&&m&&ze(r)&&!r.endList&&p&&!dE(t))this.resetFragmentErrors(e),this.treatAsGap(r),o.resolved=!0;else if((f||m)&&u=t||s&&!Gc(0))&&(s&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=P.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===P.PARSING||this.state===P.PARSED){const t=e.frag,s=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,s),n=r&&r.len>.5;n&&this.reduceMaxBufferLength(r.len,t?.duration||10);const a=!n;return a&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${s} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===X.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==P.STOPPED&&(this.state=P.IDLE)}afterBufferFlushed(e,t,s){if(!e)return;const r=de.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,s),this.state===P.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==P.STOPPED&&(this.state=P.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,s,r){const n=s.details;if(!n){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,d)=>{const u=e.elementaryStreams[d];if(u){const c=u.endPTS-u.startPTS;if(c<=0)return this.warn(`Could not parse fragment ${e.sn} ${d} duration reliably (${c})`),l||!1;const h=r?0:EE(n,e,u.startPTS,u.endPTS,u.startDTS,u.endDTS,this);return this.hls.trigger(E.LEVEL_PTS_UPDATED,{details:n,level:s,drift:h,type:d,frag:e,start:u.startPTS,end:u.endPTS}),!0}return l},!1)){var o;const l=((o=this.transmuxer)==null?void 0:o.error)===null;if((s.fragmentError===0||l&&(s.fragmentError<2||e.endList))&&this.treatAsGap(e,s),l){const d=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(d.message),this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:d,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=P.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(E.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===X.MAIN?"level":"track"}fragInfo(e,t=!0,s){var r,n;return`${this.playlistLabel()} ${e.level} (${s?"part":"frag"}:[${((r=t&&!s?e.startPTS:(s||e).start)!=null?r:NaN).toFixed(3)}-${((n=t&&!s?e.endPTS:(s||e).end)!=null?n:NaN).toFixed(3)}]${s&&e.type==="main"?"INDEPENDENT="+(s.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function mg(i){return!!i.interstitialsController&&i.enableInterstitialPlayback!==!1}class LE{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let s;if(e.length)e.length===1?s=e[0]:s=pI(e,t);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function pI(i,e){const t=new Uint8Array(e);let s=0;for(let r=0;r0)return i.subarray(t,t+s)}function _I(i,e,t,s){const r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],n=e[t+2],a=n>>2&15;if(a>12){const f=new Error(`invalid ADTS sampling index:${a}`);i.emit(E.ERROR,E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!0,error:f,reason:f.message});return}const o=(n>>6&3)+1,l=e[t+3]>>6&3|(n&1)<<2,d="mp4a.40."+o,u=r[a];let c=a;(o===5||o===29)&&(c-=3);const h=[o<<3|(c&14)>>1,(c&1)<<7|l<<3];return xe.log(`manifest codec:${s}, parsed codec:${d}, channels:${l}, rate:${u} (ADTS object type:${o} sampling index:${a})`),{config:h,samplerate:u,channelCount:l,codec:d,parsedCodec:d,manifestCodec:s}}function xE(i,e){return i[e]===255&&(i[e+1]&246)===240}function kE(i,e){return i[e+1]&1?7:9}function Wf(i,e){return(i[e+3]&3)<<11|i[e+4]<<3|(i[e+5]&224)>>>5}function AI(i,e){return e+5=i.length)return!1;const s=Wf(i,e);if(s<=t)return!1;const r=e+s;return r===i.length||Ud(i,r)}return!1}function DE(i,e,t,s,r){if(!i.samplerate){const n=_I(e,t,s,r);if(!n)return;Ce(i,n)}}function CE(i){return 1024*9e4/i}function LI(i,e){const t=kE(i,e);if(e+t<=i.length){const s=Wf(i,e)-t;if(s>0)return{headerLength:t,frameLength:s}}}function wE(i,e,t,s,r){const n=CE(i.samplerate),a=s+r*n,o=LI(e,t);let l;if(o){const{frameLength:c,headerLength:h}=o,f=h+c,m=Math.max(0,t+f-e.length);m?(l=new Uint8Array(f-h),l.set(e.subarray(t+h,e.length),0)):l=e.subarray(t+h,t+f);const p={unit:l,pts:a};return m||i.samples.push(p),{sample:p,length:f,missing:m}}const d=e.length-t;return l=new Uint8Array(d),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:a},length:d,missing:-1}}function RI(i,e){return Vf(i,e)&&mu(i,e+6)+10<=i.length-e}function xI(i){return i instanceof ArrayBuffer?i:i.byteOffset==0&&i.byteLength==i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer}function ec(i,e=0,t=1/0){return kI(i,e,t,Uint8Array)}function kI(i,e,t,s){const r=DI(i);let n=1;"BYTES_PER_ELEMENT"in s&&(n=s.BYTES_PER_ELEMENT);const a=CI(i)?i.byteOffset:0,o=(a+i.byteLength)/n,l=(a+e)/n,d=Math.floor(Math.max(0,Math.min(l,o))),u=Math.floor(Math.min(d+Math.max(t,0),o));return new s(r,d,u-d)}function DI(i){return i instanceof ArrayBuffer?i:i.buffer}function CI(i){return i&&i.buffer instanceof ArrayBuffer&&i.byteLength!==void 0&&i.byteOffset!==void 0}function wI(i){const e={key:i.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(i.size<2)return;if(i.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const s=i.data.subarray(1).indexOf(0);if(s===-1)return;const r=qt(ec(i.data,1,s)),n=i.data[2+s],a=i.data.subarray(3+s).indexOf(0);if(a===-1)return;const o=qt(ec(i.data,3+s,a));let l;return r==="-->"?l=qt(ec(i.data,4+s+a)):l=xI(i.data.subarray(4+s+a)),e.mimeType=r,e.pictureType=n,e.description=o,e.data=l,e}function MI(i){if(i.size<2)return;const e=qt(i.data,!0),t=new Uint8Array(i.data.subarray(e.length+1));return{key:i.type,info:e,data:t.buffer}}function PI(i){if(i.size<2)return;if(i.type==="TXXX"){let t=1;const s=qt(i.data.subarray(t),!0);t+=s.length+1;const r=qt(i.data.subarray(t));return{key:i.type,info:s,data:r}}const e=qt(i.data.subarray(1));return{key:i.type,info:"",data:e}}function OI(i){if(i.type==="WXXX"){if(i.size<2)return;let t=1;const s=qt(i.data.subarray(t),!0);t+=s.length+1;const r=qt(i.data.subarray(t));return{key:i.type,info:s,data:r}}const e=qt(i.data);return{key:i.type,info:"",data:e}}function NI(i){return i.type==="PRIV"?MI(i):i.type[0]==="W"?OI(i):i.type==="APIC"?wI(i):PI(i)}function UI(i){const e=String.fromCharCode(i[0],i[1],i[2],i[3]),t=mu(i,4),s=10;return{type:e,size:t,data:i.subarray(s,s+t)}}const Co=10,$I=10;function ME(i){let e=0;const t=[];for(;Vf(i,e);){const s=mu(i,e+6);i[e+5]>>6&1&&(e+=Co),e+=Co;const r=e+s;for(;e+$I0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:Wt.audioId3,duration:Number.POSITIVE_INFINITY});r{if(Q(i))return i*90;const s=t?t.baseTime*9e4/t.timescale:0;return e*9e4+s};let wo=null;const HI=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],GI=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],KI=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],VI=[0,1,1,4];function OE(i,e,t,s,r){if(t+24>e.length)return;const n=NE(e,t);if(n&&t+n.frameLength<=e.length){const a=n.samplesPerFrame*9e4/n.sampleRate,o=s+r*a,l={unit:e.subarray(t,t+n.frameLength),pts:o,dts:o};return i.config=[],i.channelCount=n.channelCount,i.samplerate=n.sampleRate,i.samples.push(l),{sample:l,length:n.frameLength,missing:0}}}function NE(i,e){const t=i[e+1]>>3&3,s=i[e+1]>>1&3,r=i[e+2]>>4&15,n=i[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const a=i[e+2]>>1&1,o=i[e+3]>>6,l=t===3?3-s:s===3?3:4,d=HI[l*14+r-1]*1e3,c=GI[(t===3?0:t===2?1:2)*3+n],h=o===3?1:2,f=KI[t][s],m=VI[s],p=f*8*m,g=Math.floor(f*d/c+a)*m;if(wo===null){const y=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);wo=y?parseInt(y[1]):0}return wo&&wo<=87&&s===2&&d>=224e3&&o===0&&(i[e+3]=i[e+3]|128),{sampleRate:c,channelCount:h,frameLength:g,samplesPerFrame:p}}}function jf(i,e){return i[e]===255&&(i[e+1]&224)===224&&(i[e+1]&6)!==0}function UE(i,e){return e+1{let t=0,s=5;e+=s;const r=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;s>0;){a[0]=i[e];const o=Math.min(s,8),l=8-o;n[0]=4278190080>>>24+l<>l,t=t?t<e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const o=[48e3,44100,32e3][n],l=e[t+4]&63,u=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][l*3+n]*2;if(t+u>e.length)return-1;const c=e[t+6]>>5;let h=0;c===2?h+=2:(c&1&&c!==1&&(h+=2),c&4&&(h+=2));const f=(e[t+6]<<8|e[t+7])>>12-h&1,p=[2,1,2,3,3,4,4,5][c]+f,g=e[t+5]>>3,v=e[t+5]&7,b=new Uint8Array([n<<6|g<<1|v>>2,(v&3)<<6|c<<3|f<<2|l>>4,l<<4&224]),y=1536/o*9e4,T=s+r*y,A=e.subarray(t,t+u);return i.config=b,i.channelCount=p,i.samplerate=o,i.samples.push({unit:A,pts:T}),u}class jI extends Yf{resetInitSegment(e,t,s,r){super.resetInitSegment(e,t,s,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=io(e,0);let s=t?.length||0;if(t&&e[s]===11&&e[s+1]===119&&qf(t)!==void 0&&FE(e,s)<=16)return!1;for(let r=e.length;s{const a=i1(n);if(zI.test(a.schemeIdUri)){const o=gg(a,t);let l=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const d=a.payload;s.samples.push({data:d,len:d.byteLength,dts:o,pts:o,type:Wt.emsg,duration:l})}else if(this.config.enableEmsgKLVMetadata&&a.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=gg(a,t);s.samples.push({data:a.payload,len:a.payload.byteLength,dts:o,pts:o,type:Wt.misbklv,duration:Number.POSITIVE_INFINITY})}})}return s}demuxSampleAes(e,t,s){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function gg(i,e){return Q(i.presentationTime)?i.presentationTime/i.timeScale:e+i.presentationTimeDelta/i.timeScale}class XI{constructor(e,t,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new $f(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Vs.cbc)}decryptAacSample(e,t,s){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);r.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,s)}).catch(s)}decryptAacSamples(e,t,s){for(;;t++){if(t>=e.length){s();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,s=new Int8Array(t);let r=0;for(let n=32;n{n.data=this.getAvcDecryptedUnit(a,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,s+1,r)}).catch(r)}decryptAvcSamples(e,t,s,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,s=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(s>=n.length);s++){const a=n[s];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,s,r,a),!this.decrypter.isSync()))return}}}}class HE{constructor(){this.VideoSample=null}createVideoSample(e,t,s){return{key:e,frame:!1,pts:t,dts:s,units:[],length:0}}getLastNalUnit(e){var t;let s=this.VideoSample,r;if((!s||s.units.length===0)&&(s=e[e.length-1]),(t=s)!=null&&t.units){const n=s.units;r=n[n.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const s=t.samples,r=s.length;if(r){const n=s[r-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,s){const r=t.byteLength;let n=e.naluState||0;const a=n,o=[];let l=0,d,u,c,h=-1,f=0;for(n===-1&&(h=0,f=this.getNALuType(t,0),n=0,l=1);l=0){const m={data:t.subarray(h,u),type:f};o.push(m)}else{const m=this.getLastNalUnit(e.samples);m&&(a&&l<=4-a&&m.state&&(m.data=m.data.subarray(0,m.data.byteLength-a)),u>0&&(m.data=ti(m.data,t.subarray(0,u)),m.state=0))}l=0&&n>=0){const m={data:t.subarray(h,r),type:f,state:n};o.push(m)}if(o.length===0){const m=this.getLastNalUnit(e.samples);m&&(m.data=ti(m.data,t))}return e.naluState=n,o}}class $a{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,s=e.byteLength-t,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(s,s+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const s=this.word>>>32-t;if(e>32&&xe.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?s<>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class ZI extends HE{parsePES(e,t,s,r){const n=this.parseNALu(e,s.data,r);let a=this.VideoSample,o,l=!1;s.data=null,a&&n.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),n.forEach(d=>{var u,c;switch(d.type){case 1:{let p=!1;o=!0;const g=d.data;if(l&&g.length>4){const v=this.readSliceType(g);(v===2||v===4||v===7||v===9)&&(p=!0)}if(p){var h;(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.frame=!0,a.key=p;break}case 5:o=!0,(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0,a.frame=!0;break;case 6:{o=!0,Pf(d.data,1,s.pts,t.samples);break}case 7:{var f,m;o=!0,l=!0;const p=d.data,g=this.readSPS(p);if(!e.sps||e.width!==g.width||e.height!==g.height||((f=e.pixelRatio)==null?void 0:f[0])!==g.pixelRatio[0]||((m=e.pixelRatio)==null?void 0:m[1])!==g.pixelRatio[1]){e.width=g.width,e.height=g.height,e.pixelRatio=g.pixelRatio,e.sps=[p];const v=p.subarray(1,4);let b="avc1.";for(let y=0;y<3;y++){let T=v[y].toString(16);T.length<2&&(T="0"+T),b+=T}e.codec=b}break}case 8:o=!0,e.pps=[d.data];break;case 9:o=!0,e.audFound=!0,(c=a)!=null&&c.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;case 12:o=!0;break;default:o=!1;break}a&&o&&a.units.push(d)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new $a(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let s=8,r=8,n;for(let a=0;a{var u,c;switch(d.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),a.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,l){var h;(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:o=!0,(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0,a.frame=!0;break;case 39:o=!0,Pf(d.data,2,s.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=Ce(e.params,this.readVPS(d.data)),this.initVPS=d.data),e.vps=[d.data];break;case 33:if(o=!0,l=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],d.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const f=this.readSPS(d.data);e.width=f.width,e.height=f.height,e.pixelRatio=f.pixelRatio,e.codec=f.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const m in f.params)e.params[m]=f.params[m]}this.pushParameterSet(e.sps,d.data,e.vps),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const f=this.readPPS(d.data);for(const m in f)e.params[m]=f[m]}this.pushParameterSet(e.pps,d.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(c=a)!=null&&c.frame&&(this.pushAccessUnit(a,e),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;default:o=!1;break}a&&o&&a.units.push(d)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}pushParameterSet(e,t,s){(s&&s[0]===this.initVPS||!s&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let s=0;for(let r=0;r=2&&e[r]===3&&e[r-1]===0&&e[r-2]===0||(t[s]=e[r],s++);return new Uint8Array(t.buffer,0,s)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new $a(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const s=t.readBits(3),r=t.readBoolean();return{numTemporalLayers:s+1,temporalIdNested:r}}readSPS(e){const t=new $a(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const s=t.readBits(3);t.readBoolean();const r=t.readBits(2),n=t.readBoolean(),a=t.readBits(5),o=t.readUByte(),l=t.readUByte(),d=t.readUByte(),u=t.readUByte(),c=t.readUByte(),h=t.readUByte(),f=t.readUByte(),m=t.readUByte(),p=t.readUByte(),g=t.readUByte(),v=t.readUByte(),b=[],y=[];for(let ye=0;ye0)for(let ye=s;ye<8;ye++)t.readBits(2);for(let ye=0;ye1&&t.readEG();for(let be=0;be0&&Ot<16?($=To[Ot-1],re=Pr[Ot-1]):Ot===255&&($=t.readBits(16),re=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),st=t.readBoolean(),st&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(ue=t.readBits(32),fe=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Pr=t.readBoolean(),_o=t.readBoolean();let js=!1;(Pr||_o)&&(js=t.readBoolean(),js&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),js&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let Ao=0;Ao<=s;Ao++){pe=t.readBoolean();const Fu=pe||t.readBoolean();let So=!1;Fu?t.readEG():So=t.readBoolean();const _t=So?1:t.readUEG()+1;if(Pr)for(let Be=0;Be<_t;Be++)t.readUEG(),t.readUEG(),js&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(_o)for(let Be=0;Be<_t;Be++)t.readUEG(),t.readUEG(),js&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),U=t.readUEG())}let It=A,Pt=L;if(S){let ye=1,rt=1;T===1?ye=rt=2:T==2&&(ye=2),It=A-ye*x-ye*R,Pt=L-rt*M-rt*I}const ni=r?["A","B","C"][r]:"",vs=o<<24|l<<16|d<<8|u;let wr=0;for(let ye=0;ye<32;ye++)wr=(wr|(vs>>ye&1)<<31-ye)>>>0;let Mr=wr.toString(16);return a===1&&Mr==="2"&&(Mr="6"),{codecString:`hvc1.${ni}${a}.${Mr}.${n?"H":"L"}${v}.B0`,params:{general_tier_flag:n,general_profile_idc:a,general_profile_space:r,general_profile_compatibility_flags:[o,l,d,u],general_constraint_indicator_flags:[c,h,f,m,p,g],general_level_idc:v,bit_depth:F+8,bit_depth_luma_minus8:F,bit_depth_chroma_minus8:V,min_spatial_segmentation_idc:U,chroma_format_idc:T,frame_rate:{fixed:pe,fps:fe/ue}},width:It,height:Pt,pixelRatio:[$,re]}}readPPS(e){const t=new $a(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const r=t.readBoolean(),n=t.readBoolean();let a=1;return n&&r?a=0:n?a=3:r&&(a=2),{parallelismType:a}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const ht=188;class Ms{constructor(e,t,s,r){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.logger=r,this.videoParser=null}static probe(e,t){const s=Ms.syncOffset(e);return s>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${s}`),s!==-1}static syncOffset(e){const t=e.length;let s=Math.min(ht*5,t-ht)+1,r=0;for(;r1&&(a===0&&o>2||l+ht>s))return a}else{if(o)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Yv[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,s,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Ms.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=Ms.createTrack("audio",r),this._id3Track=Ms.createTrack("id3"),this._txtTrack=Ms.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:s}=this;e&&(e.pesData=null),t&&(t.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,s=!1,r=!1){s||(this.sampleAes=null);let n;const a=this._videoTrack,o=this._audioTrack,l=this._id3Track,d=this._txtTrack;let u=a.pid,c=a.pesData,h=o.pid,f=l.pid,m=o.pesData,p=l.pesData,g=null,v=this.pmtParsed,b=this._pmtId,y=e.length;if(this.remainderData&&(e=ti(this.remainderData,e),y=e.length,this.remainderData=null),y>4;let M;if(I>1){if(M=S+5+e[S+4],M===S+ht)continue}else M=S+4;switch(x){case u:R&&(c&&(n=$r(c,this.logger))&&(this.readyVideoParser(a.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(a,d,n,!1)),c={data:[],size:0}),c&&(c.data.push(e.subarray(M,S+ht)),c.size+=S+ht-M);break;case h:if(R){if(m&&(n=$r(m,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,n);break;case"mp3":this.parseMPEGPES(o,n);break;case"ac3":this.parseAC3PES(o,n);break}m={data:[],size:0}}m&&(m.data.push(e.subarray(M,S+ht)),m.size+=S+ht-M);break;case f:R&&(p&&(n=$r(p,this.logger))&&this.parseID3PES(l,n),p={data:[],size:0}),p&&(p.data.push(e.subarray(M,S+ht)),p.size+=S+ht-M);break;case 0:R&&(M+=e[M]+1),b=this._pmtId=eL(e,M);break;case b:{R&&(M+=e[M]+1);const F=tL(e,M,this.typeSupported,s,this.observer,this.logger);u=F.videoPid,u>0&&(a.pid=u,a.segmentCodec=F.segmentVideoCodec),h=F.audioPid,h>0&&(o.pid=h,o.segmentCodec=F.segmentAudioCodec),f=F.id3Pid,f>0&&(l.pid=f),g!==null&&!v&&(this.logger.warn(`MPEG-TS PMT found at ${S} after unknown PID '${g}'. Backtracking to sync byte @${T} to parse all TS packets.`),g=null,S=T-188),v=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=x;break}}else A++;A>0&&jc(this.observer,new Error(`Found ${A} TS packet/s that do not start with 0x47`),void 0,this.logger),a.pesData=c,o.pesData=m,l.pesData=p;const L={audioTrack:o,videoTrack:a,id3Track:l,textTrack:d};return r&&this.extractRemainingSamples(L),L}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:s,id3Track:r,textTrack:n}=e,a=s.pesData,o=t.pesData,l=r.pesData;let d;if(a&&(d=$r(a,this.logger))?(this.readyVideoParser(s.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(s,n,d,!0),s.pesData=null)):s.pesData=a,o&&(d=$r(o,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,d);break;case"mp3":this.parseMPEGPES(t,d);break;case"ac3":this.parseAC3PES(t,d);break}t.pesData=null}else o!=null&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;l&&(d=$r(l,this.logger))?(this.parseID3PES(r,d),r.pesData=null):r.pesData=l}demuxSampleAes(e,t,s){const r=this.demux(e,s,!0,!this.config.progressive),n=this.sampleAes=new XI(this.observer,this.config,t);return this.decrypt(r,n)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new ZI:e==="hevc"&&(this.videoParser=new JI))}decrypt(e,t){return new Promise(s=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{s(e)}):s(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{s(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let s=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const c=r.missing,h=r.sample.unit.byteLength;if(c===-1)n=ti(r.sample.unit,n);else{const f=h-c;r.sample.unit.set(n.subarray(0,c),f),e.samples.push(r.sample),s=r.missing}}let a,o;for(a=s,o=n.length;a0;)o+=l}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=Ce({},t,{type:this._videoTrack?Wt.emsg:Wt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(s)}}function Yc(i,e){return((i[e+1]&31)<<8)+i[e+2]}function eL(i,e){return(i[e+10]&31)<<8|i[e+11]}function tL(i,e,t,s,r,n){const a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(i[e+1]&15)<<8|i[e+2],l=e+3+o-4,d=(i[e+10]&15)<<8|i[e+11];for(e+=12+d;e0){let h=e+5,f=c;for(;f>2;){i[h]===106&&(t.ac3!==!0?n.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=u,a.segmentAudioCodec="ac3"));const p=i[h+1]+2;h+=p,f-=p}}break;case 194:case 135:return jc(r,new Error("Unsupported EC-3 in M2TS found"),void 0,n),a;case 36:a.videoPid===-1&&(a.videoPid=u,a.segmentVideoCodec="hevc",n.log("HEVC in M2TS found"));break}e+=c+5}return a}function jc(i,e,t,s){s.warn(`parsing error: ${e.message}`),i.emit(E.ERROR,E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function tc(i,e){e.log(`${i} with AES-128-CBC encryption found in unencrypted stream`)}function $r(i,e){let t=0,s,r,n,a,o;const l=i.data;if(!i||i.size===0)return null;for(;l[0].length<19&&l.length>1;)l[0]=ti(l[0],l[1]),l.splice(1,1);if(s=l[0],(s[0]<<16)+(s[1]<<8)+s[2]===1){if(r=(s[4]<<8)+s[5],r&&r>i.size-6)return null;const u=s[7];u&192&&(a=(s[9]&14)*536870912+(s[10]&255)*4194304+(s[11]&254)*16384+(s[12]&255)*128+(s[13]&254)/2,u&64?(o=(s[14]&14)*536870912+(s[15]&255)*4194304+(s[16]&254)*16384+(s[17]&255)*128+(s[18]&254)/2,a-o>60*9e4&&(e.warn(`${Math.round((a-o)/9e4)}s delta between PTS and DTS, align them`),a=o)):o=a),n=s[8];let c=n+9;if(i.size<=c)return null;i.size-=c;const h=new Uint8Array(i.size);for(let f=0,m=l.length;fp){c-=p;continue}else s=s.subarray(c),p-=c,c=0;h.set(s,t),t+=p}return r&&(r-=n+3),{data:h,pts:a,dts:o,len:r}}return null}class iL{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const Es=Math.pow(2,32)-1;class C{static init(){C.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in C.types)C.types.hasOwnProperty(e)&&(C.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),s=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);C.HDLR_TYPES={video:t,audio:s};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);C.STTS=C.STSC=C.STCO=n,C.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),C.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),C.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),C.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);C.FTYP=C.box(C.types.ftyp,a,l,a,o),C.DINF=C.box(C.types.dinf,C.box(C.types.dref,r))}static box(e,...t){let s=8,r=t.length;const n=r;for(;r--;)s+=t[r].byteLength;const a=new Uint8Array(s);for(a[0]=s>>24&255,a[1]=s>>16&255,a[2]=s>>8&255,a[3]=s&255,a.set(e,4),r=0,s=8;r>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return C.box(C.types.mdia,C.mdhd(e.timescale||0,e.duration||0),C.hdlr(e.type),C.minf(e))}static mfhd(e){return C.box(C.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?C.box(C.types.minf,C.box(C.types.smhd,C.SMHD),C.DINF,C.stbl(e)):C.box(C.types.minf,C.box(C.types.vmhd,C.VMHD),C.DINF,C.stbl(e))}static moof(e,t,s){return C.box(C.types.moof,C.mfhd(e),C.traf(s,t))}static moov(e){let t=e.length;const s=[];for(;t--;)s[t]=C.trak(e[t]);return C.box.apply(null,[C.types.moov,C.mvhd(e[0].timescale||0,e[0].duration||0)].concat(s).concat(C.mvex(e)))}static mvex(e){let t=e.length;const s=[];for(;t--;)s[t]=C.trex(e[t]);return C.box.apply(null,[C.types.mvex,...s])}static mvhd(e,t){t*=e;const s=Math.floor(t/(Es+1)),r=Math.floor(t%(Es+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return C.box(C.types.mvhd,n)}static sdtp(e){const t=e.samples||[],s=new Uint8Array(4+t.length);let r,n;for(r=0;r>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r>>8&255),s.push(a&255),s=s.concat(Array.prototype.slice.call(n));const o=C.box(C.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(s))),l=e.width,d=e.height,u=e.pixelRatio[0],c=e.pixelRatio[1];return C.box(C.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,C.box(C.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),C.box(C.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,c>>24,c>>16&255,c>>8&255,c&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return C.box(C.types.mp4a,C.audioStsd(e),C.box(C.types.esds,C.esds(e)))}static mp3(e){return C.box(C.types[".mp3"],C.audioStsd(e))}static ac3(e){return C.box(C.types["ac-3"],C.audioStsd(e),C.box(C.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return C.box(C.types.stsd,C.STSD,C.mp4a(e));if(t==="ac3"&&e.config)return C.box(C.types.stsd,C.STSD,C.ac3(e));if(t==="mp3"&&e.codec==="mp3")return C.box(C.types.stsd,C.STSD,C.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return C.box(C.types.stsd,C.STSD,C.avc1(e));if(t==="hevc"&&e.vps)return C.box(C.types.stsd,C.STSD,C.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,s=(e.duration||0)*(e.timescale||0),r=e.width||0,n=e.height||0,a=Math.floor(s/(Es+1)),o=Math.floor(s%(Es+1));return C.box(C.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const s=C.sdtp(e),r=e.id,n=Math.floor(t/(Es+1)),a=Math.floor(t%(Es+1));return C.box(C.types.traf,C.box(C.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),C.box(C.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,a>>24,a>>16&255,a>>8&255,a&255])),C.trun(e,s.length+16+20+8+16+8+8),s)}static trak(e){return e.duration=e.duration||4294967295,C.box(C.types.trak,C.tkhd(e),C.mdia(e))}static trex(e){const t=e.id;return C.box(C.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const s=e.samples||[],r=s.length,n=12+16*r,a=new Uint8Array(n);let o,l,d,u,c,h;for(t+=8+n,a.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o>>24&255,d>>>16&255,d>>>8&255,d&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.paddingValue<<1|c.isNonSync,c.degradPrio&61440,c.degradPrio&15,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*o);return C.box(C.types.trun,a)}static initSegment(e){C.types||C.init();const t=C.moov(e);return ti(C.FTYP,t)}static hvc1(e){const t=e.params,s=[e.vps,e.sps,e.pps],r=4,n=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),r-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),s.length]);let a=n.length;for(let m=0;m>8,s[m][p].length&255]),a),a+=2,o.set(s[m][p],a),a+=s[m][p].length}const d=C.box(C.types.hvcC,o),u=e.width,c=e.height,h=e.pixelRatio[0],f=e.pixelRatio[1];return C.box(C.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,u&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d,C.box(C.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),C.box(C.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,f>>24,f>>16&255,f>>8&255,f&255])))}}C.types=void 0;C.HDLR_TYPES=void 0;C.STTS=void 0;C.STSC=void 0;C.STCO=void 0;C.STSZ=void 0;C.VMHD=void 0;C.SMHD=void 0;C.STSD=void 0;C.FTYP=void 0;C.DINF=void 0;const GE=9e4;function zf(i,e,t=1,s=!1){const r=i*e*t;return s?Math.round(r):r}function sL(i,e,t=1,s=!1){return zf(i,e,1/t,s)}function ea(i,e=!1){return zf(i,1e3,1/GE,e)}function rL(i,e=1){return zf(i,GE,1/e)}function vg(i){const{baseTime:e,timescale:t,trackId:s}=i;return`${e/t} (${e}/${t}) trackId: ${s}`}const nL=10*1e3,aL=1024,oL=1152,lL=1536;let Fr=null,ic=null;function Eg(i,e,t,s){return{duration:e,size:t,cts:s,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:i?2:1,isNonSync:i?0:1}}}class cl extends si{constructor(e,t,s,r){if(super("mp4-remuxer",r),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=s,this.ISGenerated=!1,Fr===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Fr=a?parseInt(a[1]):0}if(ic===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);ic=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&vg(t)} > ${e&&vg(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const s=e[0].pts,r=e.reduce((n,a)=>{let o=a.pts,l=o-n;return l<-4294967296&&(t=!0,o=Gt(o,s),l=o-n),l>0?n:o},s);return t&&this.debug("PTS rollover detected"),r}remux(e,t,s,r,n,a,o,l){let d,u,c,h,f,m,p=n,g=n;const v=e.pid>-1,b=t.pid>-1,y=t.samples.length,T=e.samples.length>0,A=o&&y>0||y>1;if((!v||T)&&(!b||A)||this.ISGenerated||o){if(this.ISGenerated){var S,R,x,I;const j=this.videoTrackConfig;(j&&(t.width!==j.width||t.height!==j.height||((S=t.pixelRatio)==null?void 0:S[0])!==((R=j.pixelRatio)==null?void 0:R[0])||((x=t.pixelRatio)==null?void 0:x[1])!==((I=j.pixelRatio)==null?void 0:I[1]))||!j&&A||this.nextAudioTs===null&&T)&&this.resetInitSegment()}this.ISGenerated||(c=this.generateIS(e,t,n,a));const M=this.isVideoContiguous;let F=-1,V;if(A&&(F=dL(t.samples),!M&&this.config.forceKeyFrameOnDiscontinuity))if(m=!0,F>0){this.warn(`Dropped ${F} out of ${y} video samples due to a missing keyframe`);const j=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(F),t.dropped+=F,g+=(t.samples[0].pts-j)/t.inputTimeScale,V=g}else F===-1&&(this.warn(`No keyframe found out of ${y} video samples`),m=!1);if(this.ISGenerated){if(T&&A){const j=this.getVideoStartPts(t.samples),N=(Gt(e.samples[0].pts,j)-j)/t.inputTimeScale;p+=Math.max(0,N),g+=Math.max(0,-N)}if(T){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),c=this.generateIS(e,t,n,a)),u=this.remuxAudio(e,p,this.isAudioContiguous,a,b||A||l===X.AUDIO?g:void 0),A){const j=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),c=this.generateIS(e,t,n,a)),d=this.remuxVideo(t,g,M,j)}}else A&&(d=this.remuxVideo(t,g,M,0));d&&(d.firstKeyFrame=F,d.independent=F!==-1,d.firstKeyFramePTS=V)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(f=KE(s,n,this._initPTS,this._initDTS)),r.samples.length&&(h=VE(r,n,this._initPTS))),{audio:u,video:d,initSegment:c,independent:m,text:h,id3:f}}computeInitPts(e,t,s,r){const n=Math.round(s*t);let a=Gt(e,n);if(a0?U-1:U].dts&&(b=!0)}b&&a.sort(function(U,$){const re=U.dts-$.dts,pe=U.pts-$.pts;return re||pe}),m=a[0].dts,p=a[a.length-1].dts;const T=p-m,A=T?Math.round(T/(l-1)):f||e.inputTimeScale/30;if(s){const U=m-y,$=U>A,re=U<-1;if(($||re)&&($?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${ea(U,!0)} ms (${U}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${ea(-U,!0)} ms (${U}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!re||y>=a[0].pts||Fr)){m=y;const pe=a[0].pts-U;if($)a[0].dts=m,a[0].pts=pe;else{let ue=!0;for(let fe=0;fepe&&ue);fe++){const st=a[fe].pts;if(a[fe].dts-=U,a[fe].pts-=U,fe0?$.dts-a[U-1].dts:A;if(ue=U>0?$.pts-a[U-1].pts:A,st.stretchShortVideoTrack&&this.nextAudioTs!==null){const It=Math.floor(st.maxBufferHole*n),Pt=(r?g+r*n:this.nextAudioTs+u)-$.pts;Pt>It?(f=Pt-Qe,f<0?f=Qe:F=!0,this.log(`It is approximately ${Pt/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=Qe}else f=Qe}const fe=Math.round($.pts-$.dts);V=Math.min(V,f),H=Math.max(H,f),j=Math.min(j,ue),N=Math.max(N,ue),o.push(Eg($.key,f,pe,fe))}if(o.length){if(Fr){if(Fr<70){const U=o[0].flags;U.dependsOn=2,U.isNonSync=0}}else if(ic&&N-j0&&(r&&Math.abs(y-(v+b))<9e3||Math.abs(Gt(p[0].pts,y)-(v+b))<20*u),p.forEach(function(N){N.pts=Gt(N.pts,y)}),!s||v<0){const N=p.length;if(p=p.filter(q=>q.pts>=0),N!==p.length&&this.warn(`Removed ${p.length-N} of ${N} samples (initPTS ${b} / ${a})`),!p.length)return;n===0?v=0:r&&!m?v=Math.max(0,y-b):v=p[0].pts-b}if(e.segmentCodec==="aac"){const N=this.config.maxAudioFramesDrift;for(let q=0,B=v+b;q=N*u&&$0){S+=g;try{L=new Uint8Array(S)}catch($){this.observer.emit(E.ERROR,E.ERROR,{type:te.MUX_ERROR,details:w.REMUX_ALLOC_ERROR,fatal:!1,error:$,bytes:S,reason:`fail allocating audio mdat ${S}`});return}h||(new DataView(L.buffer).setUint32(0,S),L.set(C.types.mdat,4))}else return;L.set(z,g);const U=z.byteLength;g+=U,f.push(Eg(!0,d,U,0)),A=ee}const x=f.length;if(!x)return;const I=f[f.length-1];v=A-b,this.nextAudioTs=v+l*I.duration;const M=h?new Uint8Array(0):C.moof(e.sequenceNumber++,T/l,Ce({},e,{samples:f}));e.samples=[];const F=(T-b)/a,V=this.nextAudioTs/a,H={data1:M,data2:L,startPTS:F,endPTS:V,startDTS:F,endDTS:V,type:"audio",hasAudio:!0,hasVideo:!1,nb:x};return this.isAudioContiguous=!0,H}}function Gt(i,e){let t;if(e===null)return i;for(e4294967296;)i+=t;return i}function dL(i){for(let e=0;ea.pts-o.pts);const n=i.samples;return i.samples=[],{samples:n}}class uL extends si{constructor(e,t,s,r){super("passthrough-remuxer",r),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,s,r){this.audioCodec=t,this.videoCodec=s,this.generateInitSegment(e,r),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:s,videoCodec:r}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:n,video:a}=this.initData=Qv(e);if(t)XS(e,t);else{const l=n||a;l!=null&&l.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${l.codec}")!`)}n&&(s=yg(n,Me.AUDIO,this)),a&&(r=yg(a,Me.VIDEO,this));const o={};n&&a?o.audiovideo={container:"video/mp4",codec:s+","+r,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:n?o.audio={container:"audio/mp4",codec:s,encrypted:n.encrypted,initSegment:e,id:"audio"}:a?o.video={container:"video/mp4",codec:r,supplemental:a.supplemental,encrypted:a.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,s,r,n,a){var o,l;let{initPTS:d,lastEndTime:u}=this;const c={audio:void 0,video:void 0,text:r,id3:s,initSegment:void 0};Q(u)||(u=this.lastEndTime=n||0);const h=t.samples;if(!h.length)return c;const f={initPTS:void 0,timescale:void 0,trackId:void 0};let m=this.initData;if((o=m)!=null&&o.length||(this.generateInitSegment(h),m=this.initData),!((l=m)!=null&&l.length))return this.warn("Failed to generate initSegment."),c;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1);const p=JS(h,m,this),g=m.audio?p[m.audio.id]:null,v=m.video?p[m.video.id]:null,b=Mo(v,1/0),y=Mo(g,1/0),T=Mo(v,0,!0),A=Mo(g,0,!0);let L=n,S=0;const R=g&&(!v||!d&&y0?this.lastEndTime=M:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const F=!!m.audio,V=!!m.video;let j="";F&&(j+="audio"),V&&(j+="video");const H=(m.audio?m.audio.encrypted:!1)||(m.video?m.video.encrypted:!1),N={data1:h,startPTS:I,startDTS:I,endPTS:M,endDTS:M,type:j,hasAudio:F,hasVideo:V,nb:1,dropped:0,encrypted:H};c.audio=F&&!V?N:void 0,c.video=V?N:void 0;const q=v?.sampleCount;if(q){const B=v.keyFrameIndex,z=B!==-1;N.nb=q,N.dropped=B===0||this.isVideoContiguous?0:z?B:q,N.independent=z,N.firstKeyFrame=B,z&&v.keyFrameStart&&(N.firstKeyFramePTS=(v.keyFrameStart-d.baseTime)/d.timescale),this.isVideoContiguous||(c.independent=z),this.isVideoContiguous||(this.isVideoContiguous=z),N.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${B}/${q} dropped: ${N.dropped} start: ${N.firstKeyFramePTS||"NA"}`)}return c.initSegment=f,c.id3=KE(s,n,d,d),r.samples.length&&(c.text=VE(r,n,d)),c}}function Mo(i,e,t=!1){return i?.start!==void 0?(i.start+(t?i.duration:0))/i.timescale:e}function cL(i,e,t,s){if(i===null)return!0;const r=Math.max(s,1),n=e-i.baseTime/i.timescale;return Math.abs(n-t)>r}function yg(i,e,t){const s=i.codec;return s&&s.length>4?s:e===Me.AUDIO?s==="ec-3"||s==="ac-3"||s==="alac"?s:s==="fLaC"||s==="Opus"?kd(s,!1):(t.warn(`Unhandled audio codec "${s}" in mp4 MAP`),s||"mp4a"):(t.warn(`Unhandled video codec "${s}" in mp4 MAP`),s||"avc1")}let os;try{os=self.performance.now.bind(self.performance)}catch{os=Date.now}const hl=[{demux:QI,remux:uL},{demux:Ms,remux:cl},{demux:qI,remux:cl},{demux:jI,remux:cl}];hl.splice(2,0,{demux:YI,remux:cl});class bg{constructor(e,t,s,r,n,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=s,this.id=n,this.logger=a}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,s,r){const n=s.transmuxing;n.executeStart=os();let a=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:l}=this;r&&(this.currentTransmuxState=r);const{contiguous:d,discontinuity:u,trackSwitch:c,accurateTimeOffset:h,timeOffset:f,initSegmentChange:m}=r||o,{audioCodec:p,videoCodec:g,defaultInitPts:v,duration:b,initSegmentData:y}=l,T=hL(a,t);if(T&&Ln(T.method)){const R=this.getDecrypter(),x=Bf(T.method);if(R.isSync()){let I=R.softwareDecrypt(a,T.key.buffer,T.iv.buffer,x);if(s.part>-1){const F=R.flush();I=F&&F.buffer}if(!I)return n.executeEnd=os(),sc(s);a=new Uint8Array(I)}else return this.asyncResult=!0,this.decryptionPromise=R.webCryptoDecrypt(a,T.key.buffer,T.iv.buffer,x).then(I=>{const M=this.push(I,null,s);return this.decryptionPromise=null,M}),this.decryptionPromise}const A=this.needsProbing(u,c);if(A){const R=this.configureTransmuxer(a);if(R)return this.logger.warn(`[transmuxer] ${R.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:R,reason:R.message}),n.executeEnd=os(),sc(s)}(u||c||m||A)&&this.resetInitSegment(y,p,g,b,t),(u||m||A)&&this.resetInitialTimestamp(v),d||this.resetContiguity();const L=this.transmux(a,T,f,h,s);this.asyncResult=so(L);const S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,n.executeEnd=os(),L}flush(e){const t=e.transmuxing;t.executeStart=os();const{decrypter:s,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return this.asyncResult=!0,n.then(()=>this.flush(e));const a=[],{timeOffset:o}=r;if(s){const c=s.flush();c&&a.push(this.push(c.buffer,null,e))}const{demuxer:l,remuxer:d}=this;if(!l||!d){t.executeEnd=os();const c=[sc(e)];return this.asyncResult?Promise.resolve(c):c}const u=l.flush(o);return so(u)?(this.asyncResult=!0,u.then(c=>(this.flushRemux(a,c,e),a))):(this.flushRemux(a,u,e),this.asyncResult?Promise.resolve(a):a)}flushRemux(e,t,s){const{audioTrack:r,videoTrack:n,id3Track:a,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:d}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${s.sn}${s.part>-1?" part: "+s.part:""} of ${this.id===X.MAIN?"level":"track"} ${s.level}`);const u=this.remuxer.remux(r,n,a,o,d,l,!0,this.id);e.push({remuxResult:u,chunkMeta:s}),s.transmuxing.executeEnd=os()}resetInitialTimestamp(e){const{demuxer:t,remuxer:s}=this;!t||!s||(t.resetTimeStamp(e),s.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,s,r,n){const{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,s,r),o.resetInitSegment(e,t,s,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,s,r,n){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,s,r,n):a=this.transmuxUnencrypted(e,s,r,n),a}transmuxUnencrypted(e,t,s,r){const{audioTrack:n,videoTrack:a,id3Track:o,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,a,o,l,t,s,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,s,r,n){return this.demuxer.demuxSampleAes(e,t,s).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,s,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:s,typeSupported:r}=this;let n;for(let c=0,h=hl.length;c0&&e?.key!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const sc=i=>({remuxResult:{},chunkMeta:i});function so(i){return"then"in i&&i.then instanceof Function}class fL{constructor(e,t,s,r,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=s,this.duration=r,this.defaultInitPts=n||null}}class mL{constructor(e,t,s,r,n,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=s,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=a}}let Tg=0;class WE{constructor(e,t,s,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=Tg++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=l=>{const d=l.data,u=this.hls;if(!(!u||!(d!=null&&d.event)||d.instanceNo!==this.instanceNo))switch(d.event){case"init":{var c;const h=(c=this.workerContext)==null?void 0:c.objectURL;h&&self.URL.revokeObjectURL(h);break}case"transmuxComplete":{this.handleTransmuxComplete(d.data);break}case"flush":{this.onFlush(d.data);break}case"workerLog":{u.logger[d.data.logType]&&u.logger[d.data.logType](d.data.message);break}default:{d.data=d.data||{},d.data.frag=this.frag,d.data.part=this.part,d.data.id=this.id,u.trigger(d.event,d.data);break}}},this.onWorkerError=l=>{if(!this.hls)return;const d=new Error(`${l.message} (${l.filename}:${l.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:d})};const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=s,this.onFlush=r;const a=(l,d)=>{d=d||{},d.frag=this.frag||void 0,l===E.ERROR&&(d=d,d.parent=this.id,d.part=this.part,this.error=d.error),this.hls.trigger(l,d)};this.observer=new Kf,this.observer.on(E.FRAG_DECRYPTED,a),this.observer.on(E.ERROR,a);const o=Np(n.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const l=this.hls.logger;if(n.workerPath||EI()){try{n.workerPath?(l.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=bI(n.workerPath)):(l.log(`injecting Web Worker for "${t}"`),this.workerContext=yI());const{worker:u}=this.workerContext;u.addEventListener("message",this.onWorkerMessage),u.addEventListener("error",this.onWorkerError),u.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:Pe(n)})}catch(u){l.warn(`Error setting up "${t}" Web Worker, fallback to inline`,u),this.terminateWorker(),this.error=null,this.transmuxer=new bg(this.observer,o,n,"",t,e.logger)}return}}this.transmuxer=new bg(this.observer,o,n,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=Tg++;const t=this.hls.config,s=Np(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:s,id:this.id,config:Pe(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),TI(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,s,r,n,a,o,l,d,u){var c,h;d.transmuxing.start=self.performance.now();const{instanceNo:f,transmuxer:m}=this,p=a?a.start:n.start,g=n.decryptdata,v=this.frag,b=!(v&&n.cc===v.cc),y=!(v&&d.level===v.level),T=v?d.sn-v.sn:-1,A=this.part?d.part-this.part.index:-1,L=T===0&&d.id>1&&d.id===v?.stats.chunkCount,S=!y&&(T===1||T===0&&(A===1||L&&A<=0)),R=self.performance.now();(y||T||n.stats.parsing.start===0)&&(n.stats.parsing.start=R),a&&(A||!S)&&(a.stats.parsing.start=R);const x=!(v&&((c=n.initSegment)==null?void 0:c.url)===((h=v.initSegment)==null?void 0:h.url)),I=new mL(b,S,l,y,p,x);if(!S||b||x){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${n.type} sn: ${d.sn}${d.part>-1?" part: "+d.part:""} ${this.id===X.MAIN?"level":"track"}: ${d.level} id: ${d.id} + discontinuity: ${b} + trackSwitch: ${y} + contiguous: ${S} + accurateTimeOffset: ${l} + timeOffset: ${p} + initSegmentChange: ${x}`);const M=new fL(s,r,t,o,u);this.configureTransmuxer(M)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:f,cmd:"demux",data:e,decryptdata:g,chunkMeta:d,state:I},e instanceof ArrayBuffer?[e]:[]);else if(m){const M=m.push(e,g,d,I);so(M)?M.then(F=>{this.handleTransmuxComplete(F)}).catch(F=>{this.transmuxerError(F,d,"transmuxer-interface push error")}):this.handleTransmuxComplete(M)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:s}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(s){const r=s.flush(e);so(r)?r.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")}):this.handleFlushResult(r,e)}}transmuxerError(e,t,s){this.hls&&(this.error=e,this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:s}))}handleFlushResult(e,t){e.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:s}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):s&&s.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const _g=100;class pL extends Gf{constructor(e,t,s){super(e,t,s,"audio-stream-controller",X.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:s,initPTS:r,timescale:n,trackId:a}){if(s===X.MAIN){const o=t.cc,l=this.fragCurrent;if(this.initPTS[o]={baseTime:r,timescale:n,trackId:a},this.log(`InitPTS for cc: ${o} found from main: ${r/n} (${r}/${n}) trackId: ${a}`),this.mainAnchor=t,this.state===P.WAITING_INIT_PTS){const d=this.waitingData;(!d&&!this.loadingParts||d&&d.frag.cc!==o)&&this.syncWithAnchor(t,d?.frag)}else!this.hls.hasEnoughToStart&&l&&l.cc!==o?(l.abortRequests(),this.syncWithAnchor(t,l)):this.state===P.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var s;const r=((s=this.mainFragLoading)==null?void 0:s.frag)||null;if(t&&r?.cc===t.cc)return;const n=(r||e).cc,a=this.getLevelDetails(),o=this.getLoadPosition(),l=oE(a,n,o);l&&(this.log(`Syncing with main frag at ${l.start} cc ${l.cc}`),this.startFragRequested=!1,this.nextLoadPosition=l.start,this.resetLoadingState(),this.state===P.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=P.STOPPED;return}const s=this.lastCurrentTime;this.stopLoad(),this.setInterval(_g),s>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s,this.state=P.IDLE):this.state=P.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case P.IDLE:this.doTickIdle();break;case P.WAITING_TRACK:{const{levels:e,trackId:t}=this,s=e?.[t],r=s?.details;if(r&&!this.waitForLive(s)){if(this.waitForCdnTuneIn(r))break;this.state=P.WAITING_INIT_PTS}break}case P.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case P.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:s,cache:r,complete:n}=e,a=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=P.FRAG_LOADING;const o=r.flush().buffer,l={frag:t,part:s,payload:o,networkDetails:null};this._handleFragmentLoadProgress(l),n&&super._handleFragmentLoadComplete(l)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=P.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:s,media:r,trackId:n}=this,a=t.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(s!=null&&s[n]))return;const o=s[n],l=o.details;if(!l||this.waitForLive(o)||this.waitForCdnTuneIn(l)){this.state=P.WAITING_TRACK,this.startFragRequested=!1;return}const d=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&d&&(this.bufferFlushed=!1,this.afterBufferFlushed(d,Me.AUDIO,X.AUDIO));const u=this.getFwdBufferInfo(d,X.AUDIO);if(u===null)return;if(!this.switchingTrack&&this._streamEnded(u,l)){t.trigger(E.BUFFER_EOS,{type:"audio"}),this.state=P.ENDED;return}const c=u.len,h=t.maxBufferLength,f=l.fragments,m=f[0].start,p=this.getLoadPosition(),g=this.flushing?p:u.end;if(this.switchingTrack&&r){const y=p;l.PTSKnown&&ym||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=m+.05)}if(c>=h&&!this.switchingTrack&&gb.end){const T=this.fragmentTracker.getFragAtPos(g,X.MAIN);T&&T.end>b.end&&(b=T,this.mainFragLoading={frag:T,targetBufferTime:null})}if(v.start>b.end)return}this.loadFragment(v,o,g)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(s=>new eo(s))}onAudioTrackSwitching(e,t){const s=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),s?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==P.STOPPED&&(this.setInterval(_g),this.state=P.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const s=this.cachedTrackLoadedData;s&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(E.AUDIO_TRACK_LOADED,s))}onAudioTrackLoaded(e,t){var s;const{levels:r}=this,{details:n,id:a,groupId:o,track:l}=t;if(!r){this.warn(`Audio tracks reset while loading track ${a} "${l.name}" of "${o}"`);return}const d=this.mainDetails;if(!d||n.endCC>d.endCC||d.expired){this.cachedTrackLoadedData=t,this.state!==P.STOPPED&&(this.state=P.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${a} "${l.name}" of "${o}" loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const u=r[a];let c=0;if(n.live||(s=u.details)!=null&&s.live){if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;if(u.details){var h;c=this.alignPlaylists(n,u.details,(h=this.levelLastLoaded)==null?void 0:h.details)}n.alignedSliding||(IE(n,d),n.alignedSliding||Nd(n,d),c=n.fragmentStart)}u.details=n,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(d,c),this.hls.trigger(E.AUDIO_TRACK_UPDATED,{details:n,id:a,groupId:t.groupId}),this.state===P.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=P.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const s=e.frag,{part:r,payload:n}=e,{config:a,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const d=l[o];if(!d){this.warn("Audio track is undefined on fragment load progress");return}const u=d.details;if(!u){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const c=a.defaultAudioCodec||d.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new WE(this.hls,X.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const f=this.initPTS[s.cc],m=(t=s.initSegment)==null?void 0:t.data;if(f!==void 0){const g=r?r.index:-1,v=g!==-1,b=new Ff(s.level,s.sn,s.stats.chunkCount,n.byteLength,g,v);h.push(n,m,c,"",s,r,u.totalduration,!1,b,f)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${u.startSN} ,${u.endSN}],track ${o}`);const{cache:p}=this.waitingData=this.waitingData||{frag:s,part:r,cache:new LE,complete:!1};p.push(new Uint8Array(n)),this.state!==P.STOPPED&&(this.state=P.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const s=t.tracks.audio;s&&(this.mediaBuffer=s.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===X.MAIN&&ze(t.frag)&&(this.mainFragLoading=t,this.state===P.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:s,part:r}=t;if(s.type!==X.AUDIO){!this.audioOnly&&s.type===X.MAIN&&!s.elementaryStreams.video&&!s.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${r?" p: "+r.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(ze(s)){this.fragPrevious=s;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(E.AUDIO_TRACK_SWITCHED,Le({},n)))}this.fragBufferedComplete(s,r),this.media&&this.tick()}onError(e,t){var s;if(t.fatal){this.state=P.ERROR;return}switch(t.details){case w.FRAG_GAP:case w.FRAG_PARSING_ERROR:case w.FRAG_DECRYPT_ERROR:case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(X.AUDIO,t);break;case w.AUDIO_TRACK_LOAD_ERROR:case w.AUDIO_TRACK_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===P.WAITING_TRACK&&((s=t.context)==null?void 0:s.type)===me.AUDIO_TRACK&&(this.state=P.IDLE);break;case w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case w.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case w.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Me.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Me.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===P.ENDED&&(this.state=P.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,t,X.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const s="audio",{hls:r}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:d,level:u}=o,{details:c}=u,{audio:h,text:f,id3:m,initSegment:p}=n;if(this.fragContextChanged(l)||!c){this.fragmentTracker.removeFragment(l);return}if(this.state=P.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),p!=null&&p.tracks){const g=l.initSegment||l;if(this.unhandledEncryptionError(p,l))return;this._bufferInitSegment(u,p.tracks,g,a),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:g,id:s,tracks:p.tracks})}if(h){const{startPTS:g,endPTS:v,startDTS:b,endDTS:y}=h;d&&(d.elementaryStreams[Me.AUDIO]={startPTS:g,endPTS:v,startDTS:b,endDTS:y}),l.setElementaryStreamInfo(Me.AUDIO,g,v,b,y),this.bufferFragmentData(h,l,d,a)}if(m!=null&&(t=m.samples)!=null&&t.length){const g=Ce({id:s,frag:l,details:c},m);r.trigger(E.FRAG_PARSING_METADATA,g)}if(f){const g=Ce({id:s,frag:l,details:c},f);r.trigger(E.FRAG_PARSING_USERDATA,g)}}_bufferInitSegment(e,t,s,r){if(this.state!==P.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const n=t.audio;n.id=X.AUDIO;const a=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${a}/${n.codec}]`),a&&a.split(",").length===1&&(n.levelCodec=a),this.hls.trigger(E.BUFFER_CODECS,t);const o=n.initSegment;if(o!=null&&o.byteLength){const l={type:"audio",frag:s,part:null,chunkMeta:r,parent:s.type,data:o};this.hls.trigger(E.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,s){const r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===dt.NOT_LOADED||r===dt.PARTIAL){var n;if(!ze(e))this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=P.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragmentStart!==t.details.fragmentStart&&Nd(t.details,a)}else super.loadFragment(e,t,s)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:s,assocLang:r,characteristics:n,audioCodec:a,channels:o}=this.bufferedTrack;br({name:t,lang:s,assocLang:r,characteristics:n,audioCodec:a,channels:o},e,tr)||(Cd(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(E.AUDIO_TRACK_SWITCHED,Le({},e))}}class Qf extends si{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,s){const r=t?.renditionReports;if(r){let n=-1;for(let a=0;a=0&&u>t.partTarget&&(l+=1)}const d=s&&Up(s);return new $p(o,l>=0?l:void 0,d)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}return e}playlistLoaded(e,t,s){const{details:r,stats:n}=t,a=self.performance.now(),o=n.loading.first?Math.max(0,a-n.loading.first):0;r.advancedDateTime=Date.now()-o;const l=this.hls.config.timelineOffset;if(l!==r.appliedTimelineOffset){const u=Math.max(l||0,0);r.appliedTimelineOffset=u,r.fragments.forEach(c=>{c.setStart(c.playlistOffset+u)})}if(r.live||s!=null&&s.live){const u="levelInfo"in t?t.levelInfo:t.track;if(r.reloaded(s),s&&r.fragments.length>0){oI(s,r,this);const b=r.playlistParsingError;if(b){this.warn(b);const y=this.hls;if(!y.config.ignorePlaylistParsingErrors){var d;const{networkDetails:T}=t;y.trigger(E.ERROR,{type:te.NETWORK_ERROR,details:w.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:b,reason:b.message,level:t.level||void 0,parent:(d=r.fragments[0])==null?void 0:d.type,networkDetails:T,stats:n});return}r.playlistParsingError=null}}r.requestScheduled===-1&&(r.requestScheduled=n.loading.start);const c=this.hls.mainForwardBufferInfo,h=c?c.end-c.len:0,f=(r.edge-h)*1e3,m=bE(r,f);if(r.requestScheduled+m0){if(x>r.targetduration*3)this.log(`Playlist last advanced ${R.toFixed(2)}s ago. Omitting segment and part directives.`),g=void 0,v=void 0;else if(s!=null&&s.tuneInGoal&&x-r.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${I} with playlist age: ${r.age}`),I=0;else{const M=Math.floor(I/r.targetduration);if(g+=M,v!==void 0){const F=Math.round(I%r.targetduration/r.partTarget);v+=F}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${R.toFixed(2)}s goal: ${I} skip sn ${M} to part ${v}`)}r.tuneInGoal=I}if(p=this.getDeliveryDirectives(r,t.deliveryDirectives,g,v),b||!S){r.requestScheduled=a,this.loadingPlaylist(u,p);return}}else(r.canBlockReload||r.canSkipUntil)&&(p=this.getDeliveryDirectives(r,t.deliveryDirectives,g,v));p&&g!==void 0&&r.canBlockReload&&(r.requestScheduled=n.loading.first+Math.max(m-o*2,m/2)),this.scheduleLoading(u,p,r)}else this.clearTimer()}scheduleLoading(e,t,s){const r=s||e.details;if(!r){this.loadingPlaylist(e,t);return}const n=self.performance.now(),a=r.requestScheduled;if(n>=a){this.loadingPlaylist(e,t);return}const o=a-n;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,s,r){let n=Up(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(s=t.msn,r=t.part,n=dl.No),new $p(s,r,n)}checkRetry(e){const t=e.details,s=wd(e),r=e.errorAction,{action:n,retryCount:a=0,retryConfig:o}=r||{},l=!!r&&!!o&&(n===yt.RetryRequest||!r.resolved&&n===yt.SendAlternateToPenaltyBox);if(l){var d;if(a>=o.maxNumRetry)return!1;if(s&&(d=e.context)!=null&&d.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const u=Uf(o,a);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),u),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${u}ms`)}e.levelRetry=!0,r.resolved=!0}return l}}function qE(i,e){if(i.length!==e.length)return!1;for(let t=0;ti[r]!==e[r])}function zc(i,e){return e.label.toLowerCase()===i.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(i.lang||"").toLowerCase())}class gL extends Qf{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:s,groupId:r,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==r){this.warn(`Audio track with id:${s} and group:${r} not found in active group ${a?.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Audio track ${s} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.audioGroups||null,r=this.groupIds;let n=this.currentTrack;if(!s||r?.length!==s?.length||s!=null&&s.some(o=>r?.indexOf(o)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(h=>!s||s.indexOf(h.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(h=>h.default)&&(this.selectDefaultTrack=!1),o.forEach((h,f)=>{h.id=f});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!n&&l){const h=Vi(l,o,tr);if(h>-1)n=o[h];else{const f=Vi(l,this.tracks);n=this.tracks[f]}}let d=this.findTrackId(n);d===-1&&n&&(d=this.findTrackId(null));const u={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${s?.join(",")}`),this.hls.trigger(E.AUDIO_TRACKS_UPDATED,u);const c=this.trackId;if(d!==-1&&c===-1)this.setAudioTrack(d);else if(o.length&&c===-1){var a;const h=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${o.length}`);this.warn(h.message),this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}}onError(e,t){t.fatal||!t.context||t.context.type===me.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){const r=this.currentTrack;if(r&&br(e,r,tr))return r;const n=Vi(e,this.tracksInGroup,tr);if(n>-1){const a=this.tracksInGroup[n];return this.setAudioTrack(n),a}else if(r){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const o=x1(e,t.levels,s,a,tr);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=Vi(e,s);if(a>-1)return s[a]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,r=t[e],n=r.details&&!r.details.live;if(e===this.trackId&&r===s&&n||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(E.AUDIO_TRACK_SWITCHING,Le({},r)),n))return;const a=this.switchParams(r.url,s?.details,r.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let s=0;s{const s={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(s,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const s={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(s)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const s=(t=e[0])==null?void 0:t.label;(s==="async-blocker"||s==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const r=t[0];try{r.execute()}catch(n){var s;if(r.onError(n),this.queues===null||this.tracks===null)return;const a=(s=this.tracks[e])==null?void 0:s.buffer;a!=null&&a.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"":` +${this.list("video")} +${this.list("audio")} +${this.list("audiovideo")}}`}list(e){var t,s;return(t=this.queues)!=null&&t[e]||(s=this.tracks)!=null&&s[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const s=(t=this.tracks)==null?void 0:t[e],r=s?.buffer;return r?`SourceBuffer${r.updating?" updating":""}${s.ended?" ended":""}${s.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(s=>s.label).join(", "))||""}}const Ag=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,YE="HlsJsTrackRemovedError";class EL extends Error{constructor(e){super(e),this.name=YE}}class yL extends si{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=s=>{var r;this.hls&&((r=this.mediaSource)==null?void 0:r.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=s=>{const{media:r,mediaSource:n}=this;s&&this.log("Media source opened"),!(!r||!n)&&(n.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(E.MEDIA_ATTACHED,{media:r,mediaSource:n}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:s,_objectUrl:r}=this;s!==r&&this.error(`Media element src was set while attaching MediaSource (${r} > ${s})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=HS(Ks(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_APPENDING,this.onBufferAppending,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.BUFFER_EOS,this.onBufferEos,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.FRAG_PARSED,this.onFragParsed,this),e.on(E.FRAG_CHANGED,this.onFragChanged,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_APPENDING,this.onBufferAppending,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_EOS,this.onBufferEos,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.FRAG_PARSED,this.onFragParsed,this),e.off(E.FRAG_CHANGED,this.onFragChanged,this),e.off(E.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const s={};if(this.operationQueue){const n=this.isUpdating();n||this.operationQueue.removeBlockers();const a=this.isQueued();(n||a)&&this.warn(`Transfering MediaSource with${a?" operations in queue":""}${n?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const r=this.transferData;return!this.sourceBufferCount&&r&&r.mediaSource===t?Ce(s,r.tracks):this.sourceBuffers.forEach(n=>{const[a]=n;a&&(s[a]=Ce({},this.tracks[a]),this.removeBuffer(a)),n[0]=n[1]=null}),{media:e,mediaSource:t,tracks:s}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var s;let r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsTotal=r,this.log(`${r} bufferCodec event(s) expected.`),(s=this.transferData)!=null&&s.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){const s=this.media=t.media;this.transferData=this.overrides=void 0;const r=Ks(this.appendSource);if(r){const n=!!t.mediaSource;(n||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const a=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(a),n)this._objectUrl=s.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{s.removeAttribute("src");const l=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||l&&a instanceof l,Sg(s),bL(s,o),s.load()}catch{s.src=o}else s.src=o}s.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,s;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(s=e.constructor)==null?void 0:s.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const s=this.tracks,r=t.tracks,n=r?Object.keys(r):null,a=n?n.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(r&&n&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal}) +required tracks: ${Pe(s,(l,d)=>l==="initSegment"?void 0:d)}; +transfer tracks: ${Pe(r,(l,d)=>l==="initSegment"?void 0:d)}}`),!Kv(r,s)){t.mediaSource=null,t.tracks=void 0;const l=e.currentTime,d=this.details,u=Math.max(l,d?.fragments[0].start||0);if(u-l>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${l} -> ${u}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(r)}"->"${Object.keys(s)}") start time: ${u} currentTime: ${l}`),this.onMediaDetaching(E.MEDIA_DETACHING,{}),this.onMediaAttaching(E.MEDIA_ATTACHING,t),e.currentTime=u;return}this.transferData=void 0,n.forEach(l=>{const d=l,u=r[d];if(u){const c=u.buffer;if(c){const h=this.fragmentTracker,f=u.id;if(h.hasFragments(f)||h.hasParts(f)){const g=de.getBuffered(c);h.detectEvictedFragments(d,g,f,null,!0)}const m=rc(d),p=[d,c];this.sourceBuffers[m]=p,c.updating&&this.operationQueue&&this.operationQueue.prependBlocker(d),this.trackSourceBuffer(d,u)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const s=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:r,mediaSource:n,_objectUrl:a}=this;if(n){if(this.log(`media source ${s?"transferring":"detaching"}`),s)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=n.readyState==="open";try{const l=n.sourceBuffers;for(let d=l.length;d--;)o&&l[d].abort(),n.removeSourceBuffer(l[d]);o&&n.endOfStream()}catch(l){this.warn(`onMediaDetaching: ${l.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}n.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("sourceended",this._onMediaSourceEnded),n.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(n.removeEventListener("startstreaming",this._onStartStreaming),n.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener("emptied",this._onMediaEmptied),s||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(r.removeAttribute("src"),this.appendSource&&Sg(r),r.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(E.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const s=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),s)try{var r;(r=this.mediaSource)!=null&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(s)}catch(n){this.warn(`onBufferReset ${e}`,n)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[rc(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new vL(this.tracks)}onBufferCodecs(e,t){var s;const r=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const a="audiovideo"in t&&(r.audio||r.video)||r.audiovideo&&("audio"in t||"video"in t),o=!a&&this.sourceBufferCount&&this.media&&n.some(l=>!r[l]);if(a||o){this.warn(`Unsupported transition between "${Object.keys(r)}" and "${n}" SourceBuffers`);return}n.forEach(l=>{var d,u;const c=t[l],{id:h,codec:f,levelCodec:m,container:p,metadata:g,supplemental:v}=c;let b=r[l];const y=(d=this.transferData)==null||(d=d.tracks)==null?void 0:d[l],T=y!=null&&y.buffer?y:b,A=T?.pendingCodec||T?.codec,L=T?.levelCodec;b||(b=r[l]={buffer:void 0,listeners:[],codec:f,supplemental:v,container:p,levelCodec:m,metadata:g,id:h});const S=ll(A,L),R=S?.replace(Ag,"$1");let x=ll(f,m);const I=(u=x)==null?void 0:u.replace(Ag,"$1");x&&S&&R!==I&&(l.slice(0,5)==="audio"&&(x=kd(x,this.appendSource)),this.log(`switching codec ${A} to ${x}`),x!==(b.pendingCodec||b.codec)&&(b.pendingCodec=x),b.container=p,this.appendChangeType(l,p,x))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((s=t.audio)==null?void 0:s.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const s=this.tracks[t];return e[t]={id:s.id,container:s.container,codec:s.codec,levelCodec:s.levelCodec},e},{})}appendChangeType(e,t,s){const r=`${t};codecs=${s}`,n={label:`change-type=${r}`,execute:()=>{const a=this.tracks[e];if(a){const o=a.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),o.changeType(r),a.codec=s,a.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:a=>{this.warn(`Failed to change ${e} SourceBuffer type`,a)}};this.append(n,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const s=e.start,r=s+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(s,X.MAIN))==null?void 0:t.gap)===!0)return;const a={label:"block-audio",execute:()=>{var o;const l=this.tracks.video;(this.lastVideoAppendEnd>r||l!=null&&l.buffer&&de.isBuffered(l.buffer,r)||((o=this.fragmentTracker.getAppendedFrag(r,X.MAIN))==null?void 0:o.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.blockedAudioAppend={op:a,frag:e},this.append(a,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:s}=this,{data:r,type:n,parent:a,frag:o,part:l,chunkMeta:d,offset:u}=t,c=d.buffering[n],{sn:h,cc:f}=o,m=self.performance.now();c.start=m;const p=o.stats.buffering,g=l?l.stats.buffering:null;p.start===0&&(p.start=m),g&&g.start===0&&(g.start=m);const v=s.audio;let b=!1;n==="audio"&&v?.container==="audio/mpeg"&&(b=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const y=s.video,T=y?.buffer;if(T&&h!=="initSegment"){const S=l||o,R=this.blockedAudioAppend;if(n==="audio"&&a!=="main"&&!this.blockedAudioAppend&&!(y.ending||y.ended)){const I=S.start+S.duration*.05,M=T.buffered,F=this.currentOp("video");!M.length&&!F?this.blockAudio(S):!F&&!de.isBuffered(T,I)&&this.lastVideoAppendEndI||x{var S;c.executeStart=self.performance.now();const R=(S=this.tracks[n])==null?void 0:S.buffer;R&&(b?this.updateTimestampOffset(R,A,.1,n,h,f):u!==void 0&&Q(u)&&this.updateTimestampOffset(R,u,1e-6,n,h,f)),this.appendExecutor(r,n)},onStart:()=>{},onComplete:()=>{const S=self.performance.now();c.executeEnd=c.end=S,p.first===0&&(p.first=S),g&&g.first===0&&(g.first=S);const R={};this.sourceBuffers.forEach(([x,I])=>{x&&(R[x]=de.getBuffered(I))}),this.appendErrors[n]=0,n==="audio"||n==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(E.BUFFER_APPENDED,{type:n,frag:o,part:l,chunkMeta:d,parent:o.type,timeRanges:R})},onError:S=>{var R;const x={type:te.MEDIA_ERROR,parent:o.type,details:w.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:o,part:l,chunkMeta:d,error:S,err:S,fatal:!1},I=(R=this.media)==null?void 0:R.error;if(S.code===DOMException.QUOTA_EXCEEDED_ERR||S.name=="QuotaExceededError"||"quota"in S)x.details=w.BUFFER_FULL_ERROR;else if(S.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!I)x.errorAction=In(!0);else if(S.name===YE&&this.sourceBufferCount===0)x.errorAction=In(!0);else{const M=++this.appendErrors[n];this.warn(`Failed ${M}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${n}" sourceBuffer (${I||"no media error"})`),(M>=this.hls.config.appendErrorMaxRetry||I)&&(x.fatal=!0)}this.hls.trigger(E.ERROR,x)}};this.log(`queuing "${n}" append sn: ${h}${l?" p: "+l.index:""} of ${o.type===X.MAIN?"level":"track"} ${o.level} cc: ${f}`),this.append(L,n,this.isPending(this.tracks[n]))}getFlushOp(e,t,s){return this.log(`queuing "${e}" remove ${t}-${s}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,s)},onStart:()=>{},onComplete:()=>{this.hls.trigger(E.BUFFER_FLUSHED,{type:e})},onError:r=>{this.warn(`Failed to remove ${t}-${s} from "${e}" SourceBuffer`,r)}}}onBufferFlushing(e,t){const{type:s,startOffset:r,endOffset:n}=t;s?this.append(this.getFlushOp(s,r,n),s):this.sourceBuffers.forEach(([a])=>{a&&this.append(this.getFlushOp(a,r,n),a)})}onFragParsed(e,t){const{frag:s,part:r}=t,n=[],a=r?r.elementaryStreams:s.elementaryStreams;a[Me.AUDIOVIDEO]?n.push("audiovideo"):(a[Me.AUDIO]&&n.push("audio"),a[Me.VIDEO]&&n.push("video"));const o=()=>{const l=self.performance.now();s.stats.buffering.end=l,r&&(r.stats.buffering.end=l);const d=r?r.stats:s.stats;this.hls.trigger(E.FRAG_BUFFERED,{frag:s,part:r,stats:d,id:s.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(o,n).catch(l=>{this.warn(`Fragment buffered callback ${l}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var s;this.sourceBuffers.forEach(([a])=>{if(a){const o=this.tracks[a];(!t.type||t.type===a)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${a} buffer reached EOS`)))}});const r=((s=this.overrides)==null?void 0:s.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var o;return a&&!((o=this.tracks[a])!=null&&o.ended)})?r?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:a}=this;if(!a||a.readyState!=="open"){a&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${a.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),a.endOfStream(),this.hls.trigger(E.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(E.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===w.BUFFER_APPEND_ERROR&&t.frag){var s;const r=(s=t.errorAction)==null?void 0:s.nextAutoLevel;Q(r)&&r!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:s}=this;if(!s||t===null||!this.sourceBufferCount)return;const r=e.config,n=s.currentTime,a=t.levelTargetDuration,o=t.live&&r.liveBackBufferLength!==null?r.liveBackBufferLength:r.backBufferLength;if(Q(o)&&o>=0){const d=Math.max(o,a),u=Math.floor(n/a)*a-d;this.flushBackBuffer(n,a,u)}const l=r.frontBufferFlushThreshold;if(Q(l)&&l>0){const d=Math.max(r.maxBufferLength,l),u=Math.max(d,a),c=Math.floor(n/a)*a+u;this.flushFrontBuffer(n,a,c)}}flushBackBuffer(e,t,s){this.sourceBuffers.forEach(([r,n])=>{if(n){const o=de.getBuffered(n);if(o.length>0&&s>o.start(0)){var a;this.hls.trigger(E.BACK_BUFFER_REACHED,{bufferEnd:s});const l=this.tracks[r];if((a=this.details)!=null&&a.live)this.hls.trigger(E.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(l!=null&&l.ended){this.log(`Cannot flush ${r} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:r})}}})}flushFrontBuffer(e,t,s){this.sourceBuffers.forEach(([r,n])=>{if(n){const a=de.getBuffered(n),o=a.length;if(o<2)return;const l=a.start(o-1),d=a.end(o-1);if(s>l||e>=l&&e<=d)return;this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:l,endOffset:1/0,type:r})}})}getDurationAndRange(){var e;const{details:t,mediaSource:s}=this;if(!t||!this.media||s?.readyState!=="open")return null;const r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&s.setLiveSeekableRange){const d=Math.max(0,t.fragmentStart),u=Math.max(d,r);return{duration:1/0,start:d,end:u}}return{duration:1/0}}const n=(e=this.overrides)==null?void 0:e.duration;if(n)return Q(n)?{duration:n}:null;const a=this.media.duration,o=Q(s.duration)?s.duration:0;return r>o&&r>a||!Q(a)?{duration:r}:null}updateMediaSource({duration:e,start:t,end:s}){const r=this.mediaSource;!this.media||!r||r.readyState!=="open"||(r.duration!==e&&(Q(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),t!==void 0&&s!==void 0&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${t}-${s}.`),r.setLiveSeekableRange(t,s)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:s}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${Pe(s)}`),this.tracksReady){var r;const n=(r=this.transferData)==null?void 0:r.tracks;n&&Object.keys(n).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,s])=>{if(t){const r=this.tracks[t];e[t]={buffer:s,container:r.container,codec:r.codec,supplemental:r.supplemental,levelCodec:r.levelCodec,id:r.id,metadata:r.metadata}}}),this.hls.trigger(E.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:s}=this;if(!s)throw new Error("createSourceBuffers called when mediaSource was null");for(const n in e){const a=n,o=e[a];if(this.isPending(o)){const l=this.getTrackCodec(o,a),d=`${o.container};codecs=${l}`;o.codec=l,this.log(`creating sourceBuffer(${d})${this.currentOp(a)?" Queued":""} ${Pe(o)}`);try{const u=s.addSourceBuffer(d),c=rc(a),h=[a,u];t[c]=h,o.buffer=u}catch(u){var r;this.error(`error while trying to add sourceBuffer: ${u.message}`),this.shiftAndExecuteNext(a),(r=this.operationQueue)==null||r.removeBlockers(),delete this.tracks[a],this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,sourceBufferName:a,mimeType:d,parent:o.id});return}this.trackSourceBuffer(a,o)}}this.bufferCreated()}getTrackCodec(e,t){const s=e.supplemental;let r=e.codec;s&&(t==="video"||t==="audiovideo")&&Za(s,"video")&&(r=d1(r,s));const n=ll(r,e.levelCodec);return n?t.slice(0,5)==="audio"?kd(n,this.appendSource):n:""}trackSourceBuffer(e,t){const s=t.buffer;if(!s)return;const r=this.getTrackCodec(t,e);this.tracks[e]={buffer:s,codec:r,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(n,a)=>{const o=a.removedRanges;o!=null&&o.length&&this.hls.trigger(E.BUFFER_FLUSHED,{type:n})})}get mediaSrc(){var e,t;const s=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return s?.src}onSBUpdateStart(e){const t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const s=this.currentOp(e);s&&(s.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var s;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(s=this.mediaSource)==null?void 0:s.readyState}`);this.error(`${r}`,t),this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const n=this.currentOp(e);n&&n.onError(r)}updateTimestampOffset(e,t,s,r,n,a){const o=t-e.timestampOffset;Math.abs(o)>=s&&(this.log(`Updating ${r} SourceBuffer timestampOffset to ${t} (sn: ${n} cc: ${a})`),e.timestampOffset=t)}removeExecutor(e,t,s){const{media:r,mediaSource:n}=this,a=this.tracks[e],o=a?.buffer;if(!r||!n||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const l=Q(r.duration)?r.duration:1/0,d=Q(n.duration)?n.duration:1/0,u=Math.max(0,t),c=Math.min(s,l,d);c>u&&(!a.ending||a.ended)?(a.ended=!1,this.log(`Removing [${u},${c}] from the ${e} SourceBuffer`),o.remove(u,c)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const s=this.tracks[t],r=s?.buffer;if(!r)throw new EL(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);s.ending=!1,s.ended=!1,r.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:s}=this,r=t.map(a=>this.appendBlocker(a));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(r).then(a=>{s===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var s;const r=(s=this.tracks[t])==null?void 0:s.buffer;!r||r.updating||this.shiftAndExecuteNext(t)})}append(e,t,s){this.operationQueue&&this.operationQueue.append(e,t,s)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,s){const r=this.tracks[e];if(!r)return;const n=r.buffer;if(!n)return;const a=s.bind(this,e);r.listeners.push({event:t,listener:a}),n.addEventListener(t,a)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const s=t.buffer;s&&(t.listeners.forEach(r=>{s.removeEventListener(r.event,r.listener)}),t.listeners.length=0)}}function Sg(i){const e=i.querySelectorAll("source");[].slice.call(e).forEach(t=>{i.removeChild(t)})}function bL(i,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,i.appendChild(t)}function rc(i){return i==="audio"?1:0}class pu{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const s=this.hls.levels[t.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const s=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,s.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&Q(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,s=this.getMaxLevel(e.length-1);s!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${s}: ${e[s].height}p@${e[s].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=s,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const s=t.filter((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,pu.getMaxLevelByMediaSize(s,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const s=e.getBoundingClientRect();t.width=s.width,t.height=s.height,!t.width&&!t.height&&(t.width=s.right-s.left||e.width||0,t.height=s.bottom-s.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(s=>e.bitrate===s.bitrate&&e.width===s.width&&e.height===s.height)}static getMaxLevelByMediaSize(e,t,s){if(!(e!=null&&e.length))return-1;const r=(o,l)=>l?o.width!==l.width||o.height!==l.height:!0;let n=e.length-1;const a=Math.max(t,s);for(let o=0;o=a||l.height>=a)&&r(l,e[o+1])){n=o;break}}return n}}const TL={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},xt=TL,_L={HLS:"h"},AL=_L;class Xi{constructor(e,t){Array.isArray(e)&&(e=e.map(s=>s instanceof Xi?s:new Xi(s))),this.value=e,this.params=t}}const SL="Dict";function IL(i){return Array.isArray(i)?JSON.stringify(i):i instanceof Map?"Map{}":i instanceof Set?"Set{}":typeof i=="object"?JSON.stringify(i):String(i)}function LL(i,e,t,s){return new Error(`failed to ${i} "${IL(e)}" as ${t}`,{cause:s})}function Zi(i,e,t){return LL("serialize",i,e,t)}class jE{constructor(e){this.description=e}}const Ig="Bare Item",RL="Boolean";function xL(i){if(typeof i!="boolean")throw Zi(i,RL);return i?"?1":"?0"}function kL(i){return btoa(String.fromCharCode(...i))}const DL="Byte Sequence";function CL(i){if(ArrayBuffer.isView(i)===!1)throw Zi(i,DL);return`:${kL(i)}:`}const wL="Integer";function ML(i){return i<-999999999999999||99999999999999912)throw Zi(i,OL);const t=e.toString();return t.includes(".")?t:`${t}.0`}const UL="String",$L=/[\x00-\x1f\x7f]+/;function FL(i){if($L.test(i))throw Zi(i,UL);return`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function BL(i){return i.description||i.toString().slice(7,-1)}const HL="Token";function Lg(i){const e=BL(i);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Zi(e,HL);return e}function Qc(i){switch(typeof i){case"number":if(!Q(i))throw Zi(i,Ig);return Number.isInteger(i)?zE(i):NL(i);case"string":return FL(i);case"symbol":return Lg(i);case"boolean":return xL(i);case"object":if(i instanceof Date)return PL(i);if(i instanceof Uint8Array)return CL(i);if(i instanceof jE)return Lg(i);default:throw Zi(i,Ig)}}const GL="Key";function Xc(i){if(/^[a-z*][a-z0-9\-_.*]*$/.test(i)===!1)throw Zi(i,GL);return i}function Xf(i){return i==null?"":Object.entries(i).map(([e,t])=>t===!0?`;${Xc(e)}`:`;${Xc(e)}=${Qc(t)}`).join("")}function XE(i){return i instanceof Xi?`${Qc(i.value)}${Xf(i.params)}`:Qc(i)}function KL(i){return`(${i.value.map(XE).join(" ")})${Xf(i.params)}`}function VL(i,e={whitespace:!0}){if(typeof i!="object"||i==null)throw Zi(i,SL);const t=i instanceof Map?i.entries():Object.entries(i),s=e?.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof Xi||(n=new Xi(n));let a=Xc(r);return n.value===!0?a+=Xf(n.params):(a+="=",Array.isArray(n.value)?a+=KL(n):a+=XE(n)),a}).join(`,${s}`)}function ZE(i,e){return VL(i,e)}const Ai="CMCD-Object",We="CMCD-Request",Qs="CMCD-Session",ys="CMCD-Status",WL={br:Ai,ab:Ai,d:Ai,ot:Ai,tb:Ai,tpb:Ai,lb:Ai,tab:Ai,lab:Ai,url:Ai,pb:We,bl:We,tbl:We,dl:We,ltc:We,mtp:We,nor:We,nrr:We,rc:We,sn:We,sta:We,su:We,ttfb:We,ttfbb:We,ttlb:We,cmsdd:We,cmsds:We,smrt:We,df:We,cs:We,ts:We,cid:Qs,pr:Qs,sf:Qs,sid:Qs,st:Qs,v:Qs,msd:Qs,bs:ys,bsd:ys,cdn:ys,rtp:ys,bg:ys,pt:ys,ec:ys,e:ys},qL={REQUEST:We};function YL(i){return Object.keys(i).reduce((e,t)=>{var s;return(s=i[t])===null||s===void 0||s.forEach(r=>e[r]=t),e},{})}function jL(i,e){const t={};if(!i)return t;const s=Object.keys(i),r=e?YL(e):{};return s.reduce((n,a)=>{var o;const l=WL[a]||r[a]||qL.REQUEST,d=(o=n[l])!==null&&o!==void 0?o:n[l]={};return d[a]=i[a],n},t)}function zL(i){return["ot","sf","st","e","sta"].includes(i)}function QL(i){return typeof i=="number"?Q(i):i!=null&&i!==""&&i!==!1}const JE="event";function XL(i,e){const t=new URL(i),s=new URL(e);if(t.origin!==s.origin)return i;const r=t.pathname.split("/").slice(1),n=s.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")+t.search+t.hash}const fl=i=>Math.round(i),Zc=(i,e)=>Array.isArray(i)?i.map(t=>Zc(t,e)):i instanceof Xi&&typeof i.value=="string"?new Xi(Zc(i.value,e),i.params):(e.baseUrl&&(i=XL(i,e.baseUrl)),e.version===1?encodeURIComponent(i):i),Po=i=>fl(i/100)*100,ZL=(i,e)=>{let t=i;return e.version>=2&&(i instanceof Xi&&typeof i.value=="string"?t=new Xi([i]):typeof i=="string"&&(t=[i])),Zc(t,e)},JL={br:fl,d:fl,bl:Po,dl:Po,mtp:Po,nor:ZL,rtp:Po,tb:fl},ey="request",ty="response",Zf=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],eR=["e"],tR=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function gu(i){return tR.test(i)}function iR(i){return Zf.includes(i)||eR.includes(i)||gu(i)}const iy=["d","dl","nor","ot","rtp","su"];function sR(i){return Zf.includes(i)||iy.includes(i)||gu(i)}const rR=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function nR(i){return Zf.includes(i)||iy.includes(i)||rR.includes(i)||gu(i)}const aR=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function oR(i){return aR.includes(i)||gu(i)}const lR={[ty]:nR,[JE]:iR,[ey]:sR};function sy(i,e={}){const t={};if(i==null||typeof i!="object")return t;const s=e.version||i.v||1,r=e.reportingMode||ey,n=s===1?oR:lR[r];let a=Object.keys(i).filter(n);const o=e.filter;typeof o=="function"&&(a=a.filter(o));const l=r===ty||r===JE;l&&!a.includes("ts")&&a.push("ts"),s>1&&!a.includes("v")&&a.push("v");const d=Ce({},JL,e.formatters),u={version:s,reportingMode:r,baseUrl:e.baseUrl};return a.sort().forEach(c=>{let h=i[c];const f=d[c];if(typeof f=="function"&&(h=f(h,u)),c==="v"){if(s===1)return;h=s}c=="pr"&&h===1||(l&&c==="ts"&&!Q(h)&&(h=Date.now()),QL(h)&&(zL(c)&&typeof h=="string"&&(h=new jE(h)),t[c]=h))}),t}function dR(i,e={}){const t={};if(!i)return t;const s=sy(i,e),r=jL(s,e?.customHeaderMap);return Object.entries(r).reduce((n,[a,o])=>{const l=ZE(o,{whitespace:!1});return l&&(n[a]=l),n},t)}function uR(i,e,t){return Ce(i,dR(e,t))}const cR="CMCD";function hR(i,e={}){return i?ZE(sy(i,e),{whitespace:!1}):""}function fR(i,e={}){if(!i)return"";const t=hR(i,e);return encodeURIComponent(t)}function mR(i,e={}){if(!i)return"";const t=fR(i,e);return`${cR}=${t}`}const Rg=/CMCD=[^&#]+/;function pR(i,e,t){const s=mR(e,t);if(!s)return i;if(Rg.test(i))return i.replace(Rg,s);const r=i.includes("?")?"&":"?";return`${i}${r}${s}`}class gR{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=r=>{try{this.apply(r,{ot:xt.MANIFEST,su:!this.initialized})}catch(n){this.hls.logger.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const{frag:n,part:a}=r,o=this.hls.levels[n.level],l=this.getObjectType(n),d={d:(a||n).duration*1e3,ot:l};(l===xt.VIDEO||l===xt.AUDIO||l==xt.MUXED)&&(d.br=o.bitrate/1e3,d.tb=this.getTopBandwidth(l)/1e3,d.bl=this.getBufferLength(l));const u=a?this.getNextPart(a):this.getNextFrag(n);u!=null&&u.url&&u.url!==n.url&&(d.nor=u.url),this.apply(r,d)}catch(n){this.hls.logger.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:s}=t;s!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||e.sessionId,this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.includeKeys=s.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHED,this.onMediaDetached,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHED,this.onMediaDetached,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var s,r;this.audioBuffer=(s=t.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:AL.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Ce(t,this.createData());const s=t.ot===xt.INIT||t.ot===xt.VIDEO||t.ot===xt.MUXED;this.starved&&s&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((a,o)=>(r.includes(o)&&(a[o]=t[o]),a),{}));const n={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),uR(e.headers,t,n)):e.url=pR(e.url,t,n)}getNextFrag(e){var t;const s=(t=this.hls.levels[e.level])==null?void 0:t.details;if(s){const r=e.sn-s.startSN;return s.fragments[r+1]}}getNextPart(e){var t;const{index:s,fragment:r}=e,n=(t=this.hls.levels[r.level])==null||(t=t.details)==null?void 0:t.partList;if(n){const{sn:a}=r;for(let o=n.length-1;o>=0;o--){const l=n[o];if(l.index===s&&l.fragment.sn===a)return n[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return xt.TIMED_TEXT;if(e.sn==="initSegment")return xt.INIT;if(t==="audio")return xt.AUDIO;if(t==="main")return this.hls.audioTracks.length?xt.VIDEO:xt.MUXED}getTopBandwidth(e){let t=0,s;const r=this.hls;if(e===xt.AUDIO)s=r.audioTracks;else{const n=r.maxAutoLevel,a=n>-1?n+1:r.levels.length;s=r.levels.slice(0,a)}return s.forEach(n=>{n.bitrate>t&&(t=n.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,s=e===xt.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!t?NaN:de.bufferInfo(s,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,s=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new s(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,s=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new s(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}}const vR=3e5;class ER extends si{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(s=>s!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:s}=t;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:s}=t;if(s?.action===yt.SendAlternateToPenaltyBox&&s.flags===Bt.MoveAllAlternatesMatchingHost){const r=this.levels;let n=this._pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:o,pathwayId:l,type:d}=t.context;o&&r?a=this.getPathwayForGroupId(o,d,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&r&&(n=this.pathways()),n&&n.length>1&&(this.updatePathwayPriority(n),s.resolved=this.pathwayId!==a),t.details===w.BUFFER_APPEND_ERROR&&!t.fatal?s.resolved=!0:s.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${r&&r.length} priorities: ${Pe(n)} penalized: ${Pe(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const s=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),t=this.getLevelsForPathway(s),this.pathwayId=s}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let t;const s=this.penalizedPathways,r=performance.now();Object.keys(s).forEach(n=>{r-s[n]>vR&&delete s[n]});for(let n=0;n0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,AE(t),this.hls.trigger(E.LEVELS_UPDATED,{levels:t});const d=this.hls.levels[o];l&&d&&this.levels&&(d.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&d.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${d.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,s){const r=this.getLevelsForPathway(s).concat(this.levels||[]);for(let n=0;n{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=n;if(t.some(u=>u.pathwayId===a))return;const d=this.getLevelsForPathway(o).map(u=>{const c=new Ke(u.attrs);c["PATHWAY-ID"]=a;const h=c.AUDIO&&`${c.AUDIO}_clone_${a}`,f=c.SUBTITLES&&`${c.SUBTITLES}_clone_${a}`;h&&(s[c.AUDIO]=h,c.AUDIO=h),f&&(r[c.SUBTITLES]=f,c.SUBTITLES=f);const m=ry(u.uri,c["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),p=new eo({attrs:c,audioCodec:u.audioCodec,bitrate:u.bitrate,height:u.height,name:u.name,url:m,videoCodec:u.videoCodec,width:u.width});if(u.audioGroups)for(let g=1;g{this.log(`Loaded steering manifest: "${r}"`);const m=u.data;if(m?.VERSION!==1){this.log(`Steering VERSION ${m.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=m.TTL;const{"RELOAD-URI":p,"PATHWAY-CLONES":g,"PATHWAY-PRIORITY":v}=m;if(p)try{this.uri=new self.URL(p,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${p}`);return}this.scheduleRefresh(this.uri||h.url),g&&this.clonePathways(g);const b={steeringManifest:m,url:r.toString()};this.hls.trigger(E.STEERING_MANIFEST_LOADED,b),v&&this.updatePathwayPriority(v)},onError:(u,c,h,f)=>{if(this.log(`Error loading steering manifest: ${u.code} ${u.text} (${c.url})`),this.stopLoad(),u.code===410){this.enabled=!1,this.log(`Steering manifest ${c.url} no longer available`);return}let m=this.timeToLoad*1e3;if(u.code===429){const p=this.loader;if(typeof p?.getResponseHeader=="function"){const g=p.getResponseHeader("Retry-After");g&&(m=parseFloat(g)*1e3)}this.log(`Steering manifest ${c.url} rate limited`);return}this.scheduleRefresh(this.uri||c.url,m)},onTimeout:(u,c,h)=>{this.log(`Timeout loading steering manifest (${c.url})`),this.scheduleRefresh(this.uri||c.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,l,d)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;const r=(s=this.hls)==null?void 0:s.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function xg(i,e,t,s){i&&Object.keys(e).forEach(r=>{const n=i.filter(a=>a.groupId===r).map(a=>{const o=Ce({},a);return o.details=void 0,o.attrs=new Ke(o.attrs),o.url=o.attrs.URI=ry(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[r],o.attrs["PATHWAY-ID"]=s,o});i.push(...n)})}function ry(i,e,t,s){const{HOST:r,PARAMS:n,[t]:a}=s;let o;e&&(o=a?.[e],o&&(i=o));const l=new self.URL(i);return r&&!o&&(l.host=r),n&&Object.keys(n).sort().forEach(d=>{d&&l.searchParams.set(d,n[d])}),l.href}class Rn extends si{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=Rn.CDMCleanupPromise?[Rn.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:s,initData:r}=t,n=`"${t.type}" event: init data type: "${s}"`;if(this.debug(n),r!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=ca(this.config));const o=a.map(Qu).filter(l=>!!l);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(a=>{const o=ul(a);if(s!=="sinf"||o!==Ve.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${s}" for selected key-system ${o}`);return}let l;try{const f=ot(new Uint8Array(r)),m=Hf(JSON.parse(f).sinf),p=Zv(m);if(!p)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");l=new Uint8Array(p.subarray(8,24))}catch(f){this.warn(`${n} Failed to parse sinf: ${f}`);return}const d=bt(l),{keyIdToKeySessionPromise:u,mediaKeySessions:c}=this;let h=u[d];for(let f=0;fthis.generateRequestWithPreferredKeySession(m,s,r,"encrypted-event-key-match")),h.catch(v=>this.handleError(v));break}}h||this.handleError(new Error(`Key ID ${d} not encountered in playlist. Key-system sessions ${c.length}.`))}).catch(a=>this.handleError(a))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(E.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(E.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:s}=this.config,r=t?.[e];if(r)return r.licenseUrl;if(e===Ve.WIDEVINE&&s)return s}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,s=t?.[e];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,s=(a,o,l)=>!!a&&l.indexOf(a)===o,r=t.map(a=>a.audioCodec).filter(s),n=t.map(a=>a.videoCodec).filter(s);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((a,o)=>{const l=d=>{const u=d.shift();this.getMediaKeysPromise(u,r,n).then(c=>a({keySystem:u,mediaKeys:c})).catch(c=>{d.length?l(d):c instanceof $t?o(c):o(new $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_ACCESS,error:c,fatal:!0},c.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${s}`;return pE===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return s(e,t)}getMediaKeysPromise(e,t,s){var r;const n=Z1(e,t,s,this.config.drmSystemOptions||{});let a=this.keySystemAccessPromises[e],o=(r=a)==null?void 0:r.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${Pe(n)}`),o=this.requestMediaKeySystemAccess(e,n);const l=a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(d=>{this.log(`Failed to obtain access to key-system "${e}": ${d}`)}),o.then(d=>{this.log(`Access for key-system "${d.keySystem}" obtained`);const u=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const c=l.mediaKeys=d.createMediaKeys().then(h=>(this.log(`Media-keys created for "${e}"`),l.hasMediaKeys=!0,u.then(f=>f?this.setMediaKeysServerCertificate(h,e,f):h)));return c.catch(h=>{this.error(`Failed to create media-keys for "${e}"}: ${h}`)}),c})}return o.then(()=>a.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:s}){this.log(`Creating key-system session "${t}" keyId: ${bt(e.keyId||[])} keyUri: ${e.uri}`);const r=s.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:s,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const s=this.createMediaKeySessionContext(e),r=Oo(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(s,n,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyId ${bt(e.decryptdata.keyId||[])} + } (data length: ${t.byteLength})`),s.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>Qu(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:s})=>this.attemptSetMediaKeys(t,s))}selectKeySystem(e){return new Promise((t,s)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:r})=>{const n=Qu(r);n?t(n):s(new Error(`Unable to find format for key-system "${r}"`))}).catch(s)})}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){const t=ca(this.config),s=e.map(ul).filter(r=>!!r&&t.indexOf(r)!==-1);return this.selectKeySystem(s)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let s=0;s(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(l,d).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:l,mediaKeys:d,decryptdata:t}))))).then(l=>{const d="cenc",u=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(l,d,u,"playlist-key")});return o.catch(l=>this.handleError(l,e.frag)),this.keyIdToKeySessionPromise[s]=o,o}return a.catch(o=>{if(o instanceof $t){const l=Le({},o.data);this.getKeyStatus(t)==="internal-error"&&(l.decryptdata=t);const d=new $t(l,o.message);this.handleError(d,e.frag)}}),a}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof $t){t&&(e.data.frag=t);const s=e.data.decryptdata;this.error(`${e.message}${s?` (${bt(s.keyId||[])})`:""}`),this.hls.trigger(E.ERROR,e.data)}else this.error(e.message),this.hls.trigger(E.ERROR,{type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=Oo(e),s=this.keyIdToKeySessionPromise[t];if(!s){const r=ul(e.keyFormat),n=r?[r]:ca(this.config);return this.attemptKeySystemAccess(n)}return s}getKeySystemSelectionPromise(e){if(e.length||(e=ca(this.config)),e.length===0)throw new $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Pe({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(s).then(()=>this.media?this.media.setMediaKeys(t):new Promise((n,a)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return a(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(n).catch(a)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),s.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>s.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,s,r){var n;const a=(n=this.config.drmSystems)==null||(n=n[e.keySystem])==null?void 0:n.generateRequest;if(a)try{const m=a.call(this.hls,t,s,e);if(!m)throw new Error("Invalid response from configured generateRequest filter");t=m.initDataType,s=m.initData?m.initData:null,e.decryptdata.pssh=s?new Uint8Array(s):null}catch(m){if(this.warn(m.message),this.hls&&this.hls.config.debug)throw m}if(s===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const o=Oo(e.decryptdata),l=e.decryptdata.uri;this.log(`Generating key-session request for "${r}" keyId: ${o} URI: ${l} (init data type: ${t} length: ${s.byteLength})`);const d=new Kf,u=e._onmessage=m=>{const p=e.mediaKeysSession;if(!p){d.emit("error",new Error("invalid state"));return}const{messageType:g,message:v}=m;this.log(`"${g}" message event for session "${p.sessionId}" message size: ${v.byteLength}`),g==="license-request"||g==="license-renewal"?this.renewLicense(e,v).catch(b=>{d.eventNames().length?d.emit("error",b):this.handleError(b)}):g==="license-release"?e.keySystem===Ve.FAIRPLAY&&this.updateKeySession(e,Vc("acknowledged")).then(()=>this.removeSession(e)).catch(b=>this.handleError(b)):this.warn(`unhandled media key message type "${g}"`)},c=(m,p)=>{p.keyStatus=m;let g;m.startsWith("usable")?d.emit("resolved"):m==="internal-error"||m==="output-restricted"||m==="output-downscaled"?g=kg(m,p.decryptdata):m==="expired"?g=new Error(`key expired (keyId: ${o})`):m==="released"?g=new Error("key released"):m==="status-pending"||this.warn(`unhandled key status change "${m}" (keyId: ${o})`),g&&(d.eventNames().length?d.emit("error",g):this.handleError(g))},h=e._onkeystatuseschange=m=>{if(!e.mediaKeysSession){d.emit("error",new Error("invalid state"));return}const g=this.getKeyStatuses(e);if(!Object.keys(g).some(T=>g[T]!=="status-pending"))return;if(g[o]==="expired"){this.log(`Expired key ${Pe(g)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let b=g[o];if(b)c(b,e);else{var y;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(y=e.keyStatusTimeouts)[o]||(y[o]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const A=this.getKeyStatus(e.decryptdata);if(A&&A!=="status-pending")return this.log(`No status for keyId ${o} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${A} from other session.`),c(A,e);this.log(`key status for ${o} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),b="internal-error",c(b,e)},1e3)),this.log(`No status for keyId ${o} (${Pe(g)}).`)}};Rt(e.mediaKeysSession,"message",u),Rt(e.mediaKeysSession,"keystatuseschange",h);const f=new Promise((m,p)=>{d.on("error",p),d.on("resolved",m)});return e.mediaKeysSession.generateRequest(t,s).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o} URI: ${l}`)}).catch(m=>{throw new $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_SESSION,error:m,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>f).catch(m=>(d.removeAllListeners(),this.removeSession(e).then(()=>{throw m}))).then(()=>(d.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((s,r)=>{if(typeof r=="string"&&typeof s=="object"){const o=r;r=s,s=o}const n="buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r);if(e.keySystem===Ve.PLAYREADY&&n.length===16){const o=bt(n);t[o]=s,fE(n)}const a=bt(n);s==="internal-error"&&(this.bannedKeyIds[a]=s),this.log(`key status change "${s}" for keyStatuses keyId: ${a} key-session "${e.mediaKeysSession.sessionId}"`),t[a]=s}),t}fetchServerCertificate(e){const t=this.config,s=t.loader,r=new s(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const l={responseType:"arraybuffer",url:n},d=t.certLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,p)=>{a(h.data)},onError:(h,f,m,p)=>{o(new $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:Le({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${n}). Status: ${h.code} (${h.text})`))},onTimeout:(h,f,m)=>{o(new $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(h,f,m)=>{o(new Error("aborted"))}};r.load(l,u,c)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,s){return new Promise((r,n)=>{e.setServerCertificate(s).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${s.byteLength}) on "${t}"`),r(e)}).catch(a=>{n(new $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(s=>this.updateKeySession(e,new Uint8Array(s)).catch(r=>{throw new $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:r,fatal:!1},r.message)}))}unpackPlayReadyKeyMessage(e,t){const s=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!s.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=new DOMParser().parseFromString(s,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let u;for(let c=0,h=n.length;c in key message");return Vc(atob(d))}setupLicenseXHR(e,t,s,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,s,r)}).catch(a=>{if(!s.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,s,r)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const s=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let l=o.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const d=this.config.licenseResponseCallback;if(d)try{l=d.call(this.hls,o,a,e)}catch(u){this.error(u)}r(l)}else{const l=s.errorRetry,d=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>d||o.status>=400&&o.status<500)n(new $t({type:te.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{const u=d-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:l,licenseChallenge:d})=>{e.keySystem==Ve.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(l,d)),l.send(d)}).catch(n)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const s=t.media;this.media=s,Rt(s,"encrypted",this.onMediaEncrypted),Rt(s,"waitingforkey",this.onWaitingForKey);const r=this.mediaResolved;r?r():this.mediaKeys=s.mediaKeys}onMediaDetached(){const e=this.media;e&&(Ct(e,"encrypted",this.onMediaEncrypted),Ct(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const s=this.media,r=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Hs.clearKeyUriToKeyIdMap();const n=r.length;Rn.CDMCleanupPromise=Promise.all(r.map(a=>this.removeSession(a)).concat((s==null||(e=s.setMediaKeys(null))==null?void 0:e.catch(a=>{this.log(`Could not clear media keys: ${a}`),this.hls&&this.hls.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${a}`)})}))||Promise.resolve())).catch(a=>{this.log(`Could not close sessions and clear media keys: ${a}`),this.hls&&this.hls.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${a}`)})}).then(()=>{n&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:s,decryptdata:r}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${bt(r?.keyId||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);n>-1&&this.mediaKeySessions.splice(n,1);const{keyStatusTimeouts:a}=e;a&&Object.keys(a).forEach(d=>self.clearTimeout(a[d]));const{drmSystemOptions:o}=this.config;return(eI(o)?new Promise((d,u)=>{self.setTimeout(()=>u(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(d).catch(u)}):Promise.resolve()).catch(d=>{this.log(`Could not remove session: ${d}`),this.hls&&this.hls.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${d}`)})}).then(()=>t.close()).catch(d=>{this.log(`Could not close session: ${d}`),this.hls&&this.hls.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${d}`)})})}return Promise.resolve()}}Rn.CDMCleanupPromise=void 0;function Oo(i){if(!i)throw new Error("Could not read keyId of undefined decryptdata");if(i.keyId===null)throw new Error("keyId is null");return bt(i.keyId)}function yR(i,e){if(i.keyId&&e.mediaKeysSession.keyStatuses.has(i.keyId))return e.mediaKeysSession.keyStatuses.get(i.keyId);if(i.matches(e.decryptdata))return e.keyStatus}class $t extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}function kg(i,e){const t=i==="output-restricted",s=t?w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:w.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new $t({type:te.KEY_SYSTEM_ERROR,details:s,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${i}"`)}class bR{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(E.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const s=this.hls.config;if(s.capLevelOnFPSDrop){const r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,s){const r=performance.now();if(t){if(this.lastTime){const n=r-this.lastTime,a=s-this.lastDroppedFrames,o=t-this.lastDecodedFrames,l=1e3*a/n,d=this.hls;if(d.trigger(E.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:s}),l>0&&a>d.config.fpsDroppedMonitoringThreshold*o){let u=d.currentLevel;d.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(d.autoLevelCapping===-1||d.autoLevelCapping>=u)&&(u=u-1,d.trigger(E.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:d.currentLevel}),d.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=s,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function ny(i,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=i,e.dispatchEvent(t)}function ay(i,e){const t=i.mode;if(t==="disabled"&&(i.mode="hidden"),i.cues&&!i.cues.getCueById(e.id))try{if(i.addCue(e),!i.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(s){xe.debug(`[texttrack-utils]: ${s}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,i.addCue(r)}catch(r){xe.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(i.mode=t)}function yn(i,e){const t=i.mode;if(t==="disabled"&&(i.mode="hidden"),i.cues)for(let s=i.cues.length;s--;)e&&i.cues[s].removeEventListener("enter",e),i.removeCue(i.cues[s]);t==="disabled"&&(i.mode=t)}function Jc(i,e,t,s){const r=i.mode;if(r==="disabled"&&(i.mode="hidden"),i.cues&&i.cues.length>0){const n=_R(i.cues,e,t);for(let a=0;ai[t].endTime)return-1;let s=0,r=t,n;for(;s<=r;)if(n=Math.floor((r+s)/2),ei[n].startTime&&s-1)for(let n=r,a=i.length;n=e&&o.endTime<=t)s.push(o);else if(o.startTime>t)return s}return s}function ml(i){const e=[];for(let t=0;tthis.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const s=ml(this.media.textTracks);for(let n=0;n-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){const s=this.media;if(!s)return;const r=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||s.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,r)return;ml(s.textTracks).forEach(a=>{yn(a)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:s,groupId:r,details:n}=t,a=this.tracksInGroup[s];if(!a||a.groupId!==r){this.warn(`Subtitle track with id:${s} and group:${r} not found in active group ${a?.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Subtitle track ${s} "${a.name}" lang:${a.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),s===this.trackId&&this.playlistLoaded(s,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const s=t.subtitleGroups||null,r=this.groupIds;let n=this.currentTrack;if(!s||r?.length!==s?.length||s!=null&&s.some(a=>r?.indexOf(a)===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(u=>!s||s.indexOf(u.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(u=>u.default)&&(this.selectDefaultTrack=!1),a.forEach((u,c)=>{u.id=c});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const o=this.hls.config.subtitlePreference;if(!n&&o){this.selectDefaultTrack=!1;const u=Vi(o,a);if(u>-1)n=a[u];else{const c=Vi(o,this.tracks);n=this.tracks[c]}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const d={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${s?.join(",")}" group-id`),this.hls.trigger(E.SUBTITLE_TRACKS_UPDATED,d),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}}findTrackId(e){const t=this.tracksInGroup,s=this.selectDefaultTrack;for(let r=0;r-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(s)return null;{const n=Vi(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=e.id,r=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,o=a?.age;this.log(`Loading subtitle ${s} "${e.name}" lang:${e.lang} group:${r}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${n}`),this.hls.trigger(E.SUBTITLE_TRACK_LOADING,{url:n,id:s,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=ml(e.textTracks),s=this.currentTrack;let r;if(s&&(r=t.filter(n=>zc(s,n))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${s.name}" and language "${s.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==r&&(n.mode="disabled")}),r){const n=this.subtitleDisplay?"showing":"hidden";r.mode!==n&&(r.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!Q(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!r.details&&!r.details.live;if(e===this.trackId&&r===s&&n)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:a,groupId:o="",name:l,type:d,url:u}=r;this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:d,url:u});const c=this.switchParams(r.url,s?.details,r.details);this.loadPlaylist(c)}}function SR(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?n:n&3|8).toString(16)})}}}function Fa(i){let e=5381,t=i.length;for(;t;)e=e*33^i.charCodeAt(--t);return(e>>>0).toString()}const xn=.025;let $d=(function(i){return i[i.Point=0]="Point",i[i.Range=1]="Range",i})({});function IR(i,e,t){return`${i.identifier}-${t+1}-${Fa(e)}`}class LR{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const s=this.playoutLimit;return e<=0||isNaN(s)?!1:s===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>s}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return nc(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,s=nc(t,e);return t-s<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=Q(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return nc(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)0||this.assetListResponse!==null}toString(){return RR(this)}}function nc(i,e){return i-e.start":i.cue.post?"":""}${i.timelineStart.toFixed(2)}-${i.resumeTime.toFixed(2)}]`}function jr(i){const e=i.timelineStart,t=i.duration||0;return`["${i.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class xR{constructor(e,t,s,r){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(E.PLAYOUT_LIMIT_REACHED,{})};const n=this.hls=new e(t);this.interstitial=s,this.assetItem=r;const a=()=>{this.hasDetails=!0};n.once(E.LEVEL_LOADED,a),n.once(E.AUDIO_TRACK_LOADED,a),n.once(E.SUBTITLE_TRACK_LOADED,a),n.on(E.MEDIA_ATTACHING,(o,{media:l})=>{this.removeMediaListeners(),this.mediaAttached=l,this.interstitial.playoutLimit&&(l.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&n.on(E.BUFFER_APPENDED,()=>{const u=this.bufferedEnd;this.reachedPlayout(u)&&(this._bufferedEosTime=u,n.trigger(E.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=oy(t,e.config.primarySessionId||"").href}catch{}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const s=Math.min(this._bufferedEosTime||1/0,this.duration),r=this.timelineOffset,n=de.bufferInfo(e,r,0);return this.getAssetTime(n.end)>=s-.02}reachedPlayout(e){const s=this.interstitial.playoutLimit;return this.startOffset+e>=s}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=de.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const s=t-this.startOffset;if(s>0&&s1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,s=this.duration;return Math.min(Math.max(0,e-t),s)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=s=>delete s.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,s){var r;(r=this.hls)==null||r.on(e,t)}once(e,t,s){var r;(r=this.hls)==null||r.once(e,t)}off(e,t,s){var r;(r=this.hls)==null||r.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${jr(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Dg=.033;class kR extends si{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((s,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.error,s+1):s,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let s=-1;e.nextEvent?s=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(s=this.findEventIndex(e.previousEvent.identifier)+1);const r=this.items;if(r)for(r[s]||(t===void 0&&(t=e.start),s=this.findItemIndexAtTime(t));s>=0&&(n=r[s])!=null&&n.event;){var n;s--}return s}findItemIndexAtTime(e,t){const s=this.items;if(s)for(let r=0;rn.start&&e1)for(let n=0;no&&(t!o.includes(d.identifier)):[];a.length&&a.sort((d,u)=>{const c=d.cue.pre,h=d.cue.post,f=u.cue.pre,m=u.cue.post;if(c&&!f)return-1;if(f&&!c||h&&!m)return 1;if(m&&!h)return-1;if(!c&&!f&&!h&&!m){const p=d.startTime,g=u.startTime;if(p!==g)return p-g}return d.dateRange.tagOrder-u.dateRange.tagOrder}),this.events=a,l.forEach(d=>{this.removeEvent(d)}),this.updateSchedule(e,l)}updateSchedule(e,t=[],s=!1){const r=this.events||[];if(r.length||t.length||this.length<2){const n=this.items,a=this.parseSchedule(r,e);(s||t.length||n?.length!==a.length||a.some((l,d)=>Math.abs(l.playout.start-n[d].playout.start)>.005||Math.abs(l.playout.end-n[d].playout.end)>.005))&&(this.items=a,this.onScheduleUpdate(t,n))}}parseDateRanges(e,t,s){const r=[],n=Object.keys(e);for(let a=0;a!l.error&&!(l.cue.once&&l.hasPlayed)),e.length){this.resolveOffsets(e,t);let l=0,d=0;if(e.forEach((u,c)=>{const h=u.cue.pre,f=u.cue.post,m=e[c-1]||null,p=u.appendInPlace,g=f?n:u.startOffset,v=u.duration,b=u.timelineOccupancy===$d.Range?v:0,y=u.resumptionOffset,T=m?.startTime===g,A=g+u.cumulativeDuration;let L=p?A+v:g+y;if(h||!f&&g<=0){const R=d;d+=b,u.timelineStart=A;const x=a;a+=v,s.push({event:u,start:A,end:L,playout:{start:x,end:a},integrated:{start:R,end:d}})}else if(g<=n){if(!T){const I=g-l;if(I>Dg){const M=l,F=d;d+=I;const V=a;a+=I;const j={previousEvent:e[c-1]||null,nextEvent:u,start:M,end:M+I,playout:{start:V,end:a},integrated:{start:F,end:d}};s.push(j)}else I>0&&m&&(m.cumulativeDuration+=I,s[s.length-1].end=g)}f&&(L=A),u.timelineStart=A;const R=d;d+=b;const x=a;a+=v,s.push({event:u,start:A,end:L,playout:{start:x,end:a},integrated:{start:R,end:d}})}else return;const S=u.resumeTime;f||S>n?l=n:l=S}),l{const d=o.cue.pre,u=o.cue.post,c=d?0:u?r:o.startTime;this.updateAssetDurations(o),a===c?o.cumulativeDuration=n:(n=0,a=c),!u&&o.snapOptions.in&&(o.resumeAnchor=xr(null,s.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&l+1xn?(this.log(`"${e.identifier}" resumption ${s} not aligned with estimated timeline end ${r}`),!1):!Object.keys(t).some(a=>{const o=t[a].details,l=o.edge;if(s>=l)return this.log(`"${e.identifier}" resumption ${s} past ${a} playlist end ${l}`),!1;const d=xr(null,o.fragments,s);if(!d)return this.log(`"${e.identifier}" resumption ${s} does not align with any fragments in ${a} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const u=a==="audio"?.175:0;return Math.abs(d.start-s){const g=h.data,v=g?.ASSETS;if(!Array.isArray(v)){const b=this.assignAssetListError(e,w.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),m.url,f,p);this.hls.trigger(E.ERROR,b);return}e.assetListResponse=g,this.hls.trigger(E.ASSET_LIST_LOADED,{event:e,assetListResponse:g,networkDetails:p})},onError:(h,f,m,p)=>{const g=this.assignAssetListError(e,w.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${h.code} ${h.text} (${f.url})`),f.url,p,m);this.hls.trigger(E.ERROR,g)},onTimeout:(h,f,m)=>{const p=this.assignAssetListError(e,w.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${f.url})`),f.url,h,m);this.hls.trigger(E.ERROR,p)}};return o.load(l,u,c),this.hls.trigger(E.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,s,r,n,a){return e.error=s,{type:te.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:s,networkDetails:a,stats:n}}}function Cg(i){var e;i==null||(e=i.play())==null||e.catch(()=>{})}function No(i,e){return`[${i}] Advancing timeline position to ${e}`}class CR extends si{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled||!this.schedule)return;const r=s-this.timelinePos;if(Math.abs(r)<1/7056e5)return;const a=r<=-.01;this.timelinePos=s,this.bufferedPos=s;const o=this.playingItem;if(!o){this.checkBuffer();return}if(a&&this.schedule.resetErrorsInRange(s,s-r)&&this.updateSchedule(!0),this.checkBuffer(),a&&s=o.end){var l;const f=this.findItemIndex(o);let m=this.schedule.findItemIndexAtTime(s);if(m===-1&&(m=f+(a?-1:1),this.log(`seeked ${a?"back ":""}to position not covered by schedule ${s} (resolving from ${f} to ${m})`)),!this.isInterstitial(o)&&(l=this.media)!=null&&l.paused&&(this.shouldPlay=!1),!a&&m>f){const p=this.schedule.findJumpRestrictedIndex(f+1,m);if(p>f){this.setSchedulePosition(p);return}}this.setSchedulePosition(m);return}const d=this.playingAsset;if(!d){if(this.playingLastItem&&this.isInterstitial(o)){const f=o.event.assetList[0];f&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(s,f))}return}const u=d.timelineStart,c=d.duration||0;if(a&&s=u+c){var h;(h=o.event)!=null&&h.appendInPlace&&(this.clearAssetPlayers(o.event,o),this.flushFrontBuffer(s)),this.setScheduleToAssetAtTime(s,d)}},this.onTimeupdate=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled)return;if(s>this.timelinePos)this.timelinePos=s,s>this.bufferedPos&&this.checkBuffer();else return;const r=this.playingItem;if(!r||this.playingLastItem)return;if(s>=r.end){this.timelinePos=r.end;const o=this.findItemIndex(r);this.setSchedulePosition(o+1)}const n=this.playingAsset;if(!n)return;const a=n.timelineStart+(n.duration||0);s>=a&&this.setScheduleToAssetAtTime(s,n)},this.onScheduleUpdate=(s,r)=>{const n=this.schedule;if(!n)return;const a=this.playingItem,o=n.events||[],l=n.items||[],d=n.durations,u=s.map(p=>p.identifier),c=!!(o.length||u.length);(c||r)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o} +Schedule: ${l.map(p=>oi(p))} pos: ${this.timelinePos}`),u.length&&this.log(`Removed events ${u}`);let h=null,f=null;a&&(h=this.updateItem(a,this.timelinePos),this.itemsMatch(a,h)?this.playingItem=h:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const m=this.bufferingItem;if(m&&(f=this.updateItem(m,this.bufferedPos),this.itemsMatch(m,f)?this.bufferingItem=f:m.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(m.event,null))),s.forEach(p=>{p.assetList.forEach(g=>{this.clearAssetPlayer(g.identifier,null)})}),this.playerQueue.forEach(p=>{if(p.interstitial.appendInPlace){const g=p.assetItem.timelineStart,v=p.timelineOffset-g;if(v)try{p.timelineOffset=g}catch(b){Math.abs(v)>xn&&this.warn(`${b} ("${p.assetId}" ${p.timelineOffset}->${g})`)}}}),c||r){if(this.hls.trigger(E.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:l.slice(0),durations:d,removedIds:u}),this.isInterstitial(a)&&u.includes(a.event.identifier)){this.warn(`Interstitial "${a.event.identifier}" removed while playing`),this.primaryFallback(a.event);return}a&&this.trimInPlace(h,a),m&&f!==h&&this.trimInPlace(f,m),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new DR(e),this.schedule=new kR(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(E.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(E.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(E.BUFFER_APPENDED,this.onBufferAppended,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(E.MEDIA_ENDED,this.onMediaEnded,this),e.on(E.ERROR,this.onError,this),e.on(E.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(E.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(E.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_APPENDED,this.onBufferAppended,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(E.MEDIA_ENDED,this.onMediaEnded,this),e.off(E.ERROR,this.onError,this),e.off(E.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){Ct(e,"play",this.onPlay),Ct(e,"pause",this.onPause),Ct(e,"seeking",this.onSeeking),Ct(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const s=this.media=t.media;Rt(s,"seeking",this.onSeeking),Rt(s,"timeupdate",this.onTimeupdate),Rt(s,"play",this.onPlay),Rt(s,"pause",this.onPause)}onMediaAttached(e,t){const s=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,s===null)this.checkStart();else if(!r){this.clearScheduleState();const n=this.findItemIndex(s);this.setSchedulePosition(n)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const s=!!t.transferMedia,r=this.media;if(this.media=null,!s&&(r&&this.removeMediaListeners(r),this.detachedData)){const n=this.getBufferingPlayer();n&&(this.log(`Removing schedule state for detachedData and ${n}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,n.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,s=c=>c&&e.getAssetPlayer(c.identifier),r=(c,h,f,m,p)=>{if(c){let g=c[h].start;const v=c.event;if(v){if(h==="playout"||v.timelineOccupancy!==$d.Point){const b=s(f);b?.interstitial===v&&(g+=b.assetItem.startOffset+b[p])}}else{const b=m==="bufferedPos"?a():e[m];g+=b-c.start}return g}return 0},n=(c,h)=>{var f;if(c!==0&&h!=="primary"&&(f=e.schedule)!=null&&f.length){var m;const p=e.schedule.findItemIndexAtTime(c),g=(m=e.schedule.items)==null?void 0:m[p];if(g){const v=g[h].start-g.start;return c+v}}return c},a=()=>{const c=e.bufferedPos;return c===Number.MAX_VALUE?o("primary"):Math.max(c,0)},o=c=>{var h,f;return(h=e.primaryDetails)!=null&&h.live?e.primaryDetails.edge:((f=e.schedule)==null?void 0:f.durations[c])||0},l=(c,h)=>{var f,m;const p=e.effectivePlayingItem;if(p!=null&&(f=p.event)!=null&&f.restrictions.skip||!e.schedule)return;e.log(`seek to ${c} "${h}"`);const g=e.effectivePlayingItem,v=e.schedule.findItemIndexAtTime(c,h),b=(m=e.schedule.items)==null?void 0:m[v],y=e.getBufferingPlayer(),T=y?.interstitial,A=T?.appendInPlace,L=g&&e.itemsMatch(g,b);if(g&&(A||L)){const S=s(e.playingAsset),R=S?.media||e.primaryMedia;if(R){const x=h==="primary"?R.currentTime:r(g,h,e.playingAsset,"timelinePos","currentTime"),I=c-x,M=(A?x:R.currentTime)+I;if(M>=0&&(!S||A||M<=S.duration)){R.currentTime=M;return}}}if(b){let S=c;if(h!=="primary"){const x=b[h].start,I=c-x;S=b.start+I}const R=!e.isInterstitial(b);if((!e.isInterstitial(g)||g.event.appendInPlace)&&(R||b.event.appendInPlace)){const x=e.media||(A?y?.media:null);x&&(x.currentTime=S)}else if(g){const x=e.findItemIndex(g);if(v>x){const M=e.schedule.findJumpRestrictedIndex(x+1,v);if(M>x){e.setSchedulePosition(M);return}}let I=0;if(R)e.timelinePos=S,e.checkBuffer();else{const M=b.event.assetList,F=c-(b[h]||b).start;for(let V=M.length;V--;){const j=M[V];if(j.duration&&F>=j.startOffset&&F{const c=e.effectivePlayingItem;if(e.isInterstitial(c))return c;const h=t();return e.isInterstitial(h)?h:null},u={get bufferedEnd(){const c=t(),h=e.bufferingItem;if(h&&h===c){var f;return r(h,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-h.playout.start||((f=e.bufferingAsset)==null?void 0:f.startOffset)||0}return 0},get currentTime(){const c=d(),h=e.effectivePlayingItem;return h&&h===c?r(h,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-h.playout.start:0},set currentTime(c){const h=d(),f=e.effectivePlayingItem;f&&f===h&&l(c+f.playout.start,"playout")},get duration(){const c=d();return c?c.playout.end-c.playout.start:0},get assetPlayers(){var c;const h=(c=d())==null?void 0:c.event.assetList;return h?h.map(f=>e.getAssetPlayer(f.identifier)):[]},get playingIndex(){var c;const h=(c=d())==null?void 0:c.event;return h&&e.effectivePlayingAsset?h.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return d()}};return this.manager={get events(){var c;return((c=e.schedule)==null||(c=c.events)==null?void 0:c.slice(0))||[]},get schedule(){var c;return((c=e.schedule)==null||(c=c.items)==null?void 0:c.slice(0))||[]},get interstitialPlayer(){return d()?u:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const c=t();return e.findItemIndex(c)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const c=e.effectivePlayingItem;return e.findItemIndex(c)},primary:{get bufferedEnd(){return a()},get currentTime(){const c=e.timelinePos;return c>0?c:0},set currentTime(c){l(c,"primary")},get duration(){return o("primary")},get seekableStart(){var c;return((c=e.primaryDetails)==null?void 0:c.fragmentStart)||0}},integrated:{get bufferedEnd(){return r(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return r(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(c){l(c,"integrated")},get duration(){return o("integrated")},get seekableStart(){var c;return n(((c=e.primaryDetails)==null?void 0:c.fragmentStart)||0,"integrated")}},skip:()=>{const c=e.effectivePlayingItem,h=c?.event;if(h&&!h.restrictions.skip){const f=e.findItemIndex(c);if(h.appendInPlace){const m=c.playout.start+c.event.duration;l(m+.001,"playout")}else e.advanceAfterAssetEnded(h,f,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,s=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!s?!1:this.findItemIndex(t)===s.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const s=this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&!s.event.appendInPlace)return;let r=this.media;!r&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(r=this.primaryMedia);const n=(t=r)==null?void 0:t.currentTime;if(!(n===void 0||!Q(n)))return n}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const s=this.getAssetPlayer(e);s&&this.transferMediaFromPlayer(s,t)}transferMediaFromPlayer(e,t){const s=e.interstitial.appendInPlace,r=e.media;if(s&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r){this.detachedData={media:r};return}const n=e.transferMedia();this.log(`transfer MediaSource from ${e} ${Pe(n)}`),this.detachedData=n}else t&&r&&(this.shouldPlay||(this.shouldPlay=!r.paused))}transferMediaTo(e,t){var s,r;if(e.media===t)return;let n=null;const a=this.hls,o=e!==a,l=o&&e.interstitial.appendInPlace,d=(s=this.detachedData)==null?void 0:s.mediaSource;let u;if(a.media)l&&(n=a.transferMedia(),this.detachedData=n),u="Primary";else if(d){const m=this.getBufferingPlayer();m?(n=m.transferMedia(),u=`${m}`):u="detached MediaSource"}else u="detached media";if(!n){if(d)n=this.detachedData,this.log(`using detachedData: MediaSource ${Pe(n)}`);else if(!this.detachedData||a.media===t){const m=this.playerQueue;m.length>1&&m.forEach(p=>{if(o&&p.interstitial.appendInPlace!==l){const g=p.interstitial;this.clearInterstitial(p.interstitial,null),g.appendInPlace=!1,g.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${g}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const c=n&&"mediaSource"in n&&((r=n.mediaSource)==null?void 0:r.readyState)!=="closed",h=c&&n?n:t;this.log(`${c?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${u} (media.currentTime: ${t.currentTime})`);const f=this.schedule;if(h===n&&f){const m=o&&e.assetId===f.assetIdAtEnd;h.overrides={duration:f.duration,endOfStream:!o||m,cueRemoval:!o}}e.attachMedia(h)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e?.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const s=this.timelinePos,r=this.effectivePlayingItem;if(s===-1){const n=this.hls.startPosition;if(this.log(No("checkStart",n)),this.timelinePos=n,t.length&&t[0].cue.pre){const a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(n>=0||!this.primaryLive){const a=this.timelinePos=n>0?n:0,o=e.findItemIndexAtTime(a);this.setSchedulePosition(o)}}else if(r&&!this.playingItem){const n=e.findItemIndex(r);this.setSchedulePosition(n)}}advanceAssetBuffering(e,t){const s=e.event,r=s.findAssetIndex(t),n=ac(s,r);if(!s.isAssetPastPlayoutLimit(n))this.bufferedToEvent(e,n);else if(this.schedule){var a;const o=(a=this.schedule.items)==null?void 0:a[this.findItemIndex(e)+1];o&&this.bufferedToItem(o)}}advanceAfterAssetEnded(e,t,s){const r=ac(e,s);if(e.isAssetPastPlayoutLimit(r)){if(this.schedule){const n=this.schedule.items;if(n){const a=t+1,o=n.length;if(a>=o){this.setSchedulePosition(-1);return}const l=e.resumeTime;this.timelinePos=0?r[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${n&&oi(n)}) pos: ${this.timelinePos}`);const a=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(a)){const u=a.event,c=this.playingAsset,h=c?.identifier,f=h?this.getAssetPlayer(h):null;if(f&&h&&(!this.eventItemsMatch(a,n)||t!==void 0&&h!==u.assetList[t].identifier)){var l;const m=u.findAssetIndex(c);if(this.log(`INTERSTITIAL_ASSET_ENDED ${m+1}/${u.assetList.length} ${jr(c)}`),this.endedAsset=c,this.playingAsset=null,this.hls.trigger(E.INTERSTITIAL_ASSET_ENDED,{asset:c,assetListIndex:m,event:u,schedule:r.slice(0),scheduleIndex:e,player:f}),a!==this.playingItem){this.itemsMatch(a,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(u,this.findItemIndex(this.playingItem),m);return}this.retreiveMediaSource(h,n),f.media&&!((l=this.detachedData)!=null&&l.mediaSource)&&f.detachMedia()}if(!this.eventItemsMatch(a,n)&&(this.endedItem=a,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${u} ${oi(a)}`),u.hasPlayed=!0,this.hls.trigger(E.INTERSTITIAL_ENDED,{event:u,schedule:r.slice(0),scheduleIndex:e}),u.cue.once)){var d;this.updateSchedule();const m=(d=this.schedule)==null?void 0:d.items;if(n&&m){const p=this.findItemIndex(n);this.advanceSchedule(p,m,t,a,o)}return}}this.advanceSchedule(e,r,t,a,o)}advanceSchedule(e,t,s,r,n){const a=this.schedule;if(!a)return;const o=t[e]||null,l=this.primaryMedia,d=this.playerQueue;if(d.length&&d.forEach(u=>{const c=u.interstitial,h=a.findEventIndex(c.identifier);(he+1)&&this.clearInterstitial(c,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const u=o.event;if(s===void 0){s=a.findAssetIndex(u,this.timelinePos);const m=ac(u,s-1);if(u.isAssetPastPlayoutLimit(m)||u.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(u,e,s);return}s=m}const c=this.waitingItem;this.assetsBuffered(o,l)||this.setBufferingItem(o);let h=this.preloadAssets(u,s);if(this.eventItemsMatch(o,c||r)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${oi(o)} ${u.appendInPlace?"append in place":""}`),this.hls.trigger(E.INTERSTITIAL_STARTED,{event:u,schedule:t.slice(0),scheduleIndex:e})),!u.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${u}`);return}if(u.assetListLoader&&(u.assetListLoader.destroy(),u.assetListLoader=void 0),!l){this.log(`Waiting for attachMedia to start Interstitial ${u}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const f=u.assetList[s];if(!f){this.advanceAfterAssetEnded(u,e,s||0);return}if(h||(h=this.getAssetPlayer(f.identifier)),h===null||h.destroyed){const m=u.assetList.length;this.warn(`asset ${s+1}/${m} player destroyed ${u}`),h=this.createAssetPlayer(u,f,s),h.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(f))return;this.startAssetPlayer(h,s,t,e,l),this.shouldPlay&&Cg(h.media)}else o?(this.resumePrimary(o,e,r),this.shouldPlay&&Cg(this.hls.media)):n&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,s){var r,n;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${oi(e)}`),!((r=this.detachedData)!=null&&r.mediaSource)){let o=this.timelinePos;(o=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(No("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!s)return;const a=(n=this.schedule)==null?void 0:n.items;a&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${oi(e)}`),this.hls.trigger(E.INTERSTITIALS_PRIMARY_RESUMED,{schedule:a.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const s=e.start;if(this.primaryLive){const r=this.primaryDetails;if(t===0)return this.hls.startPosition;if(r&&(sr.edge))return this.hls.liveSyncPosition||-1}return s}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:de.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,s){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const r=this.primaryMedia;if(!r)return;const n=this.hls;n.media?this.checkBuffer():(this.transferMediaTo(n,r),s&&this.startLoadingPrimaryAt(e,s)),s||(this.log(No("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,s))}startLoadingPrimaryAt(e,t){var s;const r=this.hls;!r.loadingEnabled||!r.media||Math.abs((((s=r.mainForwardBufferInfo)==null?void 0:s.start)||r.media.currentTime)-e)>.5?r.startLoad(e,t):r.bufferingEnabled||r.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(E.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(E.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const s=this.hls.levels[t.level];if(!s.details)return;const r=Le(Le({},this.mediaSelection||this.altSelection),{},{main:s});this.mediaSelection=r,this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const s=this.hls.audioTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=Le(Le({},this.altSelection),{},{audio:s});return}const n=Le(Le({},r),{},{audio:s});this.mediaSelection=n}onSubtitleTrackUpdated(e,t){const s=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=Le(Le({},this.altSelection),{},{subtitles:s});return}const n=Le(Le({},r),{},{subtitles:s});this.mediaSelection=n}onAudioTrackSwitching(e,t){const s=Bp(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setAudioOption(t)||r.setAudioOption(s)))}onSubtitleTrackSwitch(e,t){const s=Bp(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setSubtitleOption(t)||t.id!==-1&&r.setSubtitleOption(s)))}onBufferCodecs(e,t){const s=t.tracks;s&&(this.requiredTracks=s)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const s=this.playingItem;if(s&&!this.itemsMatch(s,this.bufferingItem)&&!this.isInterstitial(s)){const r=this.timelinePos;this.bufferedPos=r,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos.25){e.event.assetList.forEach((n,a)=>{e.event.isAssetPastPlayoutLimit(a)&&this.clearAssetPlayer(n.identifier,null)});const s=e.end+.25,r=de.bufferInfo(this.primaryMedia,s,0);(r.end>s||(r.nextStart||0)>s)&&(this.log(`trim buffered interstitial ${oi(e)} (was ${oi(t)})`),this.attachPrimary(s,null,!0),this.flushFrontBuffer(s))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var s;return!!t&&(e===t||e.event.identifier===((s=t.event)==null?void 0:s.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const s=this.mediaSelection;s&&((t=this.schedule)==null||t.updateSchedule(s,[],e))}checkBuffer(e){var t;const s=(t=this.schedule)==null?void 0:t.items;if(!s)return;const r=de.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=r.len<1),this.updateBufferedPos(r.end,s,e)}updateBufferedPos(e,t,s){const r=this.schedule,n=this.bufferingItem;if(this.bufferedPos>e||!r)return;if(t.length===1&&this.itemsMatch(t[0],n)){this.bufferedPos=e;return}const a=this.playingItem,o=this.findItemIndex(a);let l=r.findItemIndexAtTime(e);if(this.bufferedPos=n.end||(d=h.event)!=null&&d.appendInPlace&&e+.01>=h.start)&&(l=c),this.isInterstitial(n)){const f=n.event;if(c-o>1&&f.appendInPlace===!1||f.assetList.length===0&&f.assetListLoader)return}if(this.bufferedPos=e,l>u&&l>o)this.bufferedToItem(h);else{const f=this.primaryDetails;this.primaryLive&&f&&e>f.edge-f.targetduration&&h.start{const n=this.getAssetPlayer(r.identifier);return!(n!=null&&n.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,s=this.schedule;if(!this.itemsMatch(e,t)&&s){const{items:r,events:n}=s;if(!r||!n)return t;const a=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const l=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${oi(e)}`+(t?` (${l.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(a){const d=s.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((u,c)=>{const h=this.getAssetPlayer(u.identifier);h&&(c===d&&h.loadSource(),h.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(d=>d.pauseBuffering());this.hls.trigger(E.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:n.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const s=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(s!==null){this.bufferingAsset=null;const r=this.detachedData;r?r.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),s=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(s)}bufferedToEvent(e,t){const s=e.event,r=s.assetList.length===0&&!s.assetListLoader,n=s.cue.once;if(r||!n){const a=this.preloadAssets(s,t);if(a!=null&&a.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(a,o)}}}preloadAssets(e,t){const s=e.assetUrl,r=e.assetList.length,n=r===0&&!e.assetListLoader,a=e.cue.once;if(n){const l=e.timelineStart;if(e.appendInPlace){var o;const h=this.playingItem;!this.isInterstitial(h)&&(h==null||(o=h.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(l+.25)}let d,u=0;if(!this.playingItem&&this.primaryLive&&(u=this.hls.startPosition,u===-1&&(u=this.hls.liveSyncPosition||0)),u&&!(e.cue.pre||e.cue.post)){const h=u-l;h>0&&(d=Math.round(h*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${s?1:r} ${e}${d?` live-start: ${u} start-offset: ${d}`:""}`),s)return this.createAsset(e,0,0,l,e.duration,s);const c=this.assetListLoader.loadAssetList(e,d);c&&(e.assetListLoader=c)}else if(!a&&r){for(let d=t;d{this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:r})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let s=0;s1){const A=t.duration;A&&T{if(T.live){var A;const R=new Error(`Interstitials MUST be VOD assets ${e}`),x={fatal:!0,type:te.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:R},I=((A=this.schedule)==null?void 0:A.findEventIndex(e.identifier))||-1;this.handleAssetItemError(x,e,I,s,R.message);return}const L=T.edge-T.fragmentStart,S=t.duration;(p||S===null||L>S)&&(p=!1,this.log(`Interstitial asset "${c}" duration change ${S} > ${L}`),t.duration=L,this.updateSchedule())};m.on(E.LEVEL_UPDATED,(T,{details:A})=>g(A)),m.on(E.LEVEL_PTS_UPDATED,(T,{details:A})=>g(A)),m.on(E.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const v=(T,A)=>{const L=this.getAssetPlayer(c);if(L&&A.tracks){L.off(E.BUFFER_CODECS,v),L.tracks=A.tracks;const S=this.primaryMedia;this.bufferingAsset===L.assetItem&&S&&!L.media&&this.bufferAssetPlayer(L,S)}};m.on(E.BUFFER_CODECS,v);const b=()=>{var T;const A=this.getAssetPlayer(c);if(this.log(`buffered to end of asset ${A}`),!A||!this.schedule)return;const L=this.schedule.findEventIndex(e.identifier),S=(T=this.schedule.items)==null?void 0:T[L];this.isInterstitial(S)&&this.advanceAssetBuffering(S,t)};m.on(E.BUFFERED_TO_END,b);const y=T=>()=>{if(!this.getAssetPlayer(c)||!this.schedule)return;this.shouldPlay=!0;const L=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,L,T)};return m.once(E.MEDIA_ENDED,y(s)),m.once(E.PLAYOUT_LIMIT_REACHED,y(1/0)),m.on(E.ERROR,(T,A)=>{if(!this.schedule)return;const L=this.getAssetPlayer(c);if(A.details===w.BUFFER_STALLED_ERROR){if(L!=null&&L.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(A,e,this.schedule.findEventIndex(e.identifier),s,`Asset player error ${A.error} ${e}`)}),m.on(E.DESTROYING,()=>{if(!this.getAssetPlayer(c)||!this.schedule)return;const A=new Error(`Asset player destroyed unexpectedly ${c}`),L={fatal:!0,type:te.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:A};this.handleAssetItemError(L,e,this.schedule.findEventIndex(e.identifier),s,A.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${jr(t)}`),this.hls.trigger(E.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:s,event:e,player:m}),m}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(s=>{this.clearAssetPlayer(s.identifier,t)})}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const s=this.playerQueue[t];this.transferMediaFromPlayer(s,null),s.resetDetails()}}clearAssetPlayer(e,t){const s=this.getAssetPlayerQueueIndex(e);if(s!==-1){const r=this.playerQueue[s];this.log(`clear ${r} toSegment: ${t&&oi(t)}`),this.transferMediaFromPlayer(r,t),this.playerQueue.splice(s,1),r.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,s,r,n){const{interstitial:a,assetItem:o,assetId:l}=e,d=a.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!u||u.identifier!==l)&&(u&&(this.clearAssetPlayer(u.identifier,s[r]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${d} ${jr(o)}`),this.hls.trigger(E.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:a,schedule:s.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,n)}bufferAssetPlayer(e,t){var s,r;if(!this.schedule)return;const{interstitial:n,assetItem:a}=e,o=this.schedule.findEventIndex(n.identifier),l=(s=this.schedule.items)==null?void 0:s[o];if(!l)return;e.loadSource(),this.setBufferingItem(l),this.bufferingAsset=a;const d=this.getBufferingPlayer();if(d===e)return;const u=n.appendInPlace;if(u&&d?.interstitial.appendInPlace===!1)return;const c=d?.tracks||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(u&&a!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(c&&!Kv(c,e.tracks)){const h=new Error(`Asset ${jr(a)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(c)}')`),f={fatal:!0,type:te.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:h},m=n.findAssetIndex(a);this.handleAssetItemError(f,n,o,m,h.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,s=this.primaryMedia;if(!t||!s)return;const r=s.currentTime,n=t.findAssetIndex(e,r),a=e.assetList[n];if(a){const o=this.getAssetPlayer(a.identifier);if(o){const l=o.currentTime||r-a.timelineStart,d=o.duration-l;if(this.warn(`Stalled at ${l} of ${l+d} in ${o} ${e} (media.currentTime: ${r})`),l&&(d/s.playbackRate<.5||o.bufferedInPlaceToEnd(s))&&o.hls){const u=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,u,n)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime!p.error))t.error=m;else for(let p=r;p{const v=parseFloat(p.DURATION);this.createAsset(n,g,u,l+u,v,p.URI),u+=v}),n.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${d}) ${n}`);const c=this.waitingItem,h=c?.event.identifier===a;this.updateSchedule();const f=(r=this.bufferingItem)==null?void 0:r.event;if(h){var m;const p=this.schedule.findEventIndex(a),g=(m=this.schedule.items)==null?void 0:m[p];if(g){if(!this.playingItem&&this.timelinePos>g.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==p){n.error=new Error(`Interstitial ${o.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${n}`),this.log(n.error.message),this.updateSchedule(!0),this.primaryFallback(n);return}this.setBufferingItem(g)}this.setSchedulePosition(p)}else if(f?.identifier===a){const p=n.assetList[0];if(p){const g=this.getAssetPlayer(p.identifier);if(f.appendInPlace){const v=this.primaryMedia;g&&v&&this.bufferAssetPlayer(g,v)}else g&&g.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case w.ASSET_LIST_PARSING_ERROR:case w.ASSET_LIST_LOAD_ERROR:case w.ASSET_LIST_LOAD_TIMEOUT:{const s=t.interstitial;s&&(this.updateSchedule(!0),this.primaryFallback(s));break}case w.BUFFER_STALLED_ERROR:{const s=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&s.event.appendInPlace){this.handleInPlaceStall(s.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const wg=500;class wR extends Gf{constructor(e,t,s){super(e,t,s,"subtitle-stream-controller",X.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=P.IDLE,this.setInterval(wg),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:s,success:r}=t;if(this.fragContextChanged(s)||(ze(s)&&(this.fragPrevious=s),this.state=P.IDLE),!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const o=s.start;for(let d=0;d=n[d].start&&o<=n[d].end){a=n[d];break}const l=s.start+s.duration;a?a.end=l:(a={start:o,end:l},n.push(a)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:s,endOffset:r}=t;if(s===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(a=>{for(let o=0;onew eo(s));return}this.tracksBuffered=[],this.levels=t.map(s=>{const r=new eo(s);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,X.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var s;if(this.currentTrackId=t.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}const r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.state!==P.STOPPED&&this.setInterval(wg)}onSubtitleTrackLoaded(e,t){var s;const{currentTrackId:r,levels:n}=this,{details:a,id:o}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=n[o];if(o>=n.length||!l)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let d=0;if(a.live||(s=l.details)!=null&&s.live){if(a.deltaUpdateFailed)return;const c=this.mainDetails;if(!c){this.startFragRequested=!1;return}const h=c.fragments[0];if(!l.details)a.hasProgramDateTime&&c.hasProgramDateTime?(Nd(a,c),d=a.fragmentStart):h&&(d=h.start,qc(a,d));else{var u;d=this.alignPlaylists(a,l.details,(u=this.levelLastLoaded)==null?void 0:u.details),d===0&&h&&(d=h.start,qc(a,d))}c&&!this.startFragRequested&&this.setStartPosition(c,d)}l.details=a,this.levelLastLoaded=l,o===r&&(this.hls.trigger(E.SUBTITLE_TRACK_UPDATED,{details:a,id:o,groupId:t.groupId}),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===P.IDLE&&(xr(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:s}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&s&&s.byteLength>0&&r!=null&&r.key&&r.iv&&Ln(r.method)){const a=performance.now();this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer,Bf(r.method)).catch(o=>{throw n.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const l=performance.now();n.trigger(E.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:a,tdecrypt:l}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=P.IDLE})}}doTick(){if(!this.media){this.state=P.IDLE;return}if(this.state===P.IDLE){const{currentTrackId:e,levels:t}=this,s=t?.[e];if(!s||!t.length||!s.details||this.waitForLive(s))return;const{config:r}=this,n=this.getLoadPosition(),a=de.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:o,len:l}=a,d=s.details,u=this.hls.maxBufferLength+d.levelTargetDuration;if(l>u)return;const c=d.fragments,h=c.length,f=d.edge;let m=null;const p=this.fragPrevious;if(of-b?0:b;m=xr(p,c,Math.max(c[0].start,o),y),!m&&p&&p.start{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][s]};this.buffered={get length(){return e.length},end(s){return t("end",s,e.length)},start(s){return t("start",s,e.length)}}}}const PR={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},ly=i=>String.fromCharCode(PR[i]||i),hi=15,ts=100,OR={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},NR={17:2,18:4,21:6,22:8,23:10,19:13,20:15},UR={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},$R={25:2,26:4,29:6,30:8,31:10,27:13,28:15},FR=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class BR{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const s=typeof t=="function"?t():t;xe.log(`${this.time} [${e}] ${s}`)}}}const Xs=function(e){const t=[];for(let s=0;sts&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=ts)}moveCursor(e){const t=this.pos+e;if(e>1)for(let s=this.pos+1;s=144&&this.backSpace();const t=ly(e);if(this.pos>=ts){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t"pacData = "+Pe(e));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+Pe(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let s="",r=-1;for(let n=0;n0&&(e?s="["+t.join(" | ")+"]":s=t.join(` +`)),s}getTextAndFormat(){return this.rows}}class Mg{constructor(e,t,s){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new oc(s),this.nonDisplayedMemory=new oc(s),this.lastOutputScreen=new oc(s),this.currRollUpRow=this.displayedMemory.rows[hi-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[hi-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let s=0;st+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const s=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[s]}this.logger.log(2,"MIDROW: "+Pe(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Pg{constructor(e,t,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=VR(),this.logger=void 0;const r=this.logger=new BR;this.channels=[null,new Mg(e,t,r),new Mg(e+1,s,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let s=0;s"["+Xs([t[s],t[s+1]])+"] -> ("+Xs([r,n])+")");const l=this.cmdHistory;if(r>=16&&r<=31){if(KR(r,n,l)){Uo(null,null,l),this.logger.log(3,()=>"Repeated command ("+Xs([r,n])+") is dropped");continue}Uo(r,n,this.cmdHistory),a=this.parseCmd(r,n),a||(a=this.parseMidrow(r,n)),a||(a=this.parsePAC(r,n)),a||(a=this.parseBackgroundAttributes(r,n))}else Uo(null,null,l);if(!a&&(o=this.parseChars(r,n),o)){const u=this.currentChannel;u&&u>0?this.channels[u].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Xs([r,n])+" orig: "+Xs([t[s],t[s+1]]))}}parseCmd(e,t){const s=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=33&&t<=35;if(!(s||r))return!1;const n=e===20||e===21||e===23?1:2,a=this.channels[n];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=n,!0}parseMidrow(e,t){let s=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[s];return r?(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Xs([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let s;const r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,n=(e===16||e===24)&&t>=64&&t<=95;if(!(r||n))return!1;const a=e<=23?1:2;t>=64&&t<=95?s=a===1?OR[e]:UR[e]:s=a===1?NR[e]:$R[e];const o=this.channels[a];return o?(o.setPAC(this.interpretPAC(s,t)),this.currentChannel=a,!0):!1}interpretPAC(e,t){let s;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?s=t-96:s=t-64,r.underline=(s&1)===1,s<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((s-16)/2)*4,r}parseChars(e,t){let s,r=null,n=null;if(e>=25?(s=2,n=e-8):(s=1,n=e),n>=17&&n<=19){let a;n===17?a=t+80:n===18?a=t+112:a=t+144,this.logger.log(2,()=>"Special char '"+ly(a)+"' in channel "+s),r=[a]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes = "+Xs(r).join(",")),r}parseBackgroundAttributes(e,t){const s=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(s||r))return!1;let n;const a={};e===16||e===24?(n=Math.floor((t-32)/2),a.background=FR[n],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(a),!0}reset(){for(let e=0;e100)throw new Error("Position must be between 0 and 100.");L=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",n({},c,{get:function(){return S},set:function(I){const M=r(I);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");S=M,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",n({},c,{get:function(){return R},set:function(I){if(I<0||I>100)throw new Error("Size must be between 0 and 100.");R=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",n({},c,{get:function(){return x},set:function(I){const M=r(I);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");x=M,this.hasBeenReset=!0}})),u.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a})();class WR{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function uy(i){function e(s,r,n,a){return(s|0)*3600+(r|0)*60+(n|0)+parseFloat(a||0)}const t=i.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class qR{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,s){return s?this.has(e)?this.values[e]:t[s]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,s){for(let r=0;r=0&&s<=100)return this.set(e,s),!0}return!1}}function cy(i,e,t,s){const r=s?i.split(s):[i];for(const n in r){if(typeof r[n]!="string")continue;const a=r[n].split(t);if(a.length!==2)continue;const o=a[0],l=a[1];e(o,l)}}const eh=new Jf(0,0,""),$o=eh.align==="middle"?"middle":"center";function YR(i,e,t){const s=i;function r(){const o=uy(i);if(o===null)throw new Error("Malformed timestamp: "+s);return i=i.replace(/^[^\sa-zA-Z-]+/,""),o}function n(o,l){const d=new qR;cy(o,function(h,f){let m;switch(h){case"region":for(let p=t.length-1;p>=0;p--)if(t[p].id===f){d.set(h,t[p].region);break}break;case"vertical":d.alt(h,f,["rl","lr"]);break;case"line":m=f.split(","),d.integer(h,m[0]),d.percent(h,m[0])&&d.set("snapToLines",!1),d.alt(h,m[0],["auto"]),m.length===2&&d.alt("lineAlign",m[1],["start",$o,"end"]);break;case"position":m=f.split(","),d.percent(h,m[0]),m.length===2&&d.alt("positionAlign",m[1],["start",$o,"end","line-left","line-right","auto"]);break;case"size":d.percent(h,f);break;case"align":d.alt(h,f,["start",$o,"end","left","right"]);break}},/:/,/\s/),l.region=d.get("region",null),l.vertical=d.get("vertical","");let u=d.get("line","auto");u==="auto"&&eh.line===-1&&(u=-1),l.line=u,l.lineAlign=d.get("lineAlign","start"),l.snapToLines=d.get("snapToLines",!0),l.size=d.get("size",100),l.align=d.get("align",$o);let c=d.get("position","auto");c==="auto"&&eh.position===50&&(c=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=c}function a(){i=i.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),i.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);i=i.slice(3),a(),e.endTime=r(),a(),n(i,e)}function hy(i){return i.replace(//gi,` +`)}class jR{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new WR,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function s(){let n=t.buffer,a=0;for(n=hy(n);a")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{YR(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=n.indexOf("-->")!==-1;if(!n||o&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=` +`),t.cue.text+=n}continue;case"BADCUE":n||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=` + +`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const zR=/\r\n|\n\r|\n|\r/g,lc=function(e,t,s=0){return e.slice(s,s+t.length)===t},QR=function(e){let t=parseInt(e.slice(-3));const s=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!Q(t)||!Q(s)||!Q(r)||!Q(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*s,t+=60*1e3*r,t+=3600*1e3*n,t};function em(i,e,t){return Fa(i.toString())+Fa(e.toString())+Fa(t)}const XR=function(e,t,s){let r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(a=n)!=null&&a.new;){var a;e.ccOffset+=r.start-n.start,r.new=!1,r=n,n=e[r.prevCC]}e.presentationOffset=s};function ZR(i,e,t,s,r,n,a){const o=new jR,l=qt(new Uint8Array(i)).trim().replace(zR,` +`).split(` +`),d=[],u=e?rL(e.baseTime,e.timescale):0;let c="00:00.000",h=0,f=0,m,p=!0;o.oncue=function(g){const v=t[s];let b=t.ccOffset;const y=(h-u)/9e4;if(v!=null&&v.new&&(f!==void 0?b=t.ccOffset=v.start:XR(t,s,y)),y){if(!e){m=new Error("Missing initPTS for VTT MPEGTS");return}b=y-t.presentationOffset}const T=g.endTime-g.startTime,A=Gt((g.startTime+b-f)*9e4,r*9e4)/9e4;g.startTime=Math.max(A,0),g.endTime=Math.max(A+T,0);const L=g.text.trim();g.text=decodeURIComponent(encodeURIComponent(L)),g.id||(g.id=em(g.startTime,g.endTime,L)),g.endTime>0&&d.push(g)},o.onparsingerror=function(g){m=g},o.onflush=function(){if(m){a(m);return}n(d)},l.forEach(g=>{if(p)if(lc(g,"X-TIMESTAMP-MAP=")){p=!1,g.slice(16).split(",").forEach(v=>{lc(v,"LOCAL:")?c=v.slice(6):lc(v,"MPEGTS:")&&(h=parseInt(v.slice(7)))});try{f=QR(c)/1e3}catch(v){m=v}return}else g===""&&(p=!1);o.parse(g+` +`)}),o.flush()}const dc="stpp.ttml.im1t",fy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,my=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,JR={left:"start",center:"center",right:"end",start:"start",end:"end"};function Og(i,e,t,s){const r=he(new Uint8Array(i),["mdat"]);if(r.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(o=>qt(o)),a=sL(e.baseTime,1,e.timescale);try{n.forEach(o=>t(ex(o,a)))}catch(o){s(o)}}function ex(i,e){const r=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((c,h)=>(c[h]=r.getAttribute(`ttp:${h}`)||n[h],c),{}),o=r.getAttribute("xml:space")!=="preserve",l=Ng(uc(r,"styling","style")),d=Ng(uc(r,"layout","region")),u=uc(r,"body","[begin]");return[].map.call(u,c=>{const h=py(c,o);if(!h||!c.hasAttribute("begin"))return null;const f=hc(c.getAttribute("begin"),a),m=hc(c.getAttribute("dur"),a);let p=hc(c.getAttribute("end"),a);if(f===null)throw Ug(c);if(p===null){if(m===null)throw Ug(c);p=f+m}const g=new Jf(f-e,p-e,h);g.id=em(g.startTime,g.endTime,g.text);const v=d[c.getAttribute("region")],b=l[c.getAttribute("style")],y=tx(v,b,l),{textAlign:T}=y;if(T){const A=JR[T];A&&(g.lineAlign=A),g.align=T}return Ce(g,y),g}).filter(c=>c!==null)}function uc(i,e,t){const s=i.getElementsByTagName(e)[0];return s?[].slice.call(s.querySelectorAll(t)):[]}function Ng(i){return i.reduce((e,t)=>{const s=t.getAttribute("xml:id");return s&&(e[s]=t),e},{})}function py(i,e){return[].slice.call(i.childNodes).reduce((t,s,r)=>{var n;return s.nodeName==="br"&&r?t+` +`:(n=s.childNodes)!=null&&n.length?py(s,e):e?t+s.textContent.trim().replace(/\s+/g," "):t+s.textContent},"")}function tx(i,e,t){const s="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=i!=null&&i.hasAttribute("style")?i.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(r=t[a]),n.reduce((o,l)=>{const d=cc(e,s,l)||cc(i,s,l)||cc(r,s,l);return d&&(o[l]=d),o},{})}function cc(i,e,t){return i&&i.hasAttributeNS(e,t)?i.getAttributeNS(e,t):null}function Ug(i){return new Error(`Could not parse ttml timestamp ${i}`)}function hc(i,e){if(!i)return null;let t=uy(i);return t===null&&(fy.test(i)?t=ix(i,e):my.test(i)&&(t=sx(i,e))),t}function ix(i,e){const t=fy.exec(i),s=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+s/e.frameRate}function sx(i,e){const t=my.exec(i),s=Number(t[1]);switch(t[2]){case"h":return s*3600;case"m":return s*60;case"ms":return s*1e3;case"f":return s/e.frameRate;case"t":return s/e.tickRate}return s}class Fo{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,s){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class rx{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Fg(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Fo(this,"textTrack1"),t=new Fo(this,"textTrack2"),s=new Fo(this,"textTrack3"),r=new Fo(this,"textTrack4");this.cea608Parser1=new Pg(1,e,t),this.cea608Parser2=new Pg(3,s,r)}addCues(e,t,s,r,n){let a=!1;for(let o=n.length;o--;){const l=n[o],d=nx(l[0],l[1],t,s);if(d>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],s),a=!0,d/(s-t)>.5))return}if(a||n.push([t,s]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,s,r)}else{const o=this.Cues.newCue(null,t,s,r);this.hls.trigger(E.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:s,initPTS:r,timescale:n,trackId:a}){const{unparsedVttFrags:o}=this;s===X.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:n,trackId:a}),o.length&&(this.unparsedVttFrags=[],o.forEach(l=>{this.initPTS[l.frag.cc]?this.onFragLoaded(E.FRAG_LOADED,l):this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:s}=this;if(s)for(let r=0;r{yn(r[n]),delete r[n]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Fg(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let s=0;sn.textCodec===dc);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(qE(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const a=this.media,o=a?ml(a.textTracks):null;if(this.tracks.forEach((l,d)=>{let u;if(o){let c=null;for(let h=0;hd!==null).map(d=>d.label);l.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const a=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(s=>{const r=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!r)return;const n=`textTrack${r[1]}`,a=this.captionsProperties[n];a&&(a.label=s.name,s.lang&&(a.languageCode=s.lang),a.media=s)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t?.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===X.MAIN){var s,r;const{cea608Parser1:n,cea608Parser2:a,lastSn:o}=this,{cc:l,sn:d}=t.frag,u=(s=(r=t.part)==null?void 0:r.index)!=null?s:-1;n&&a&&(d!==o+1||d===o&&u!==this.lastPartIndex+1||l!==this.lastCc)&&(n.reset(),a.reset()),this.lastCc=l,this.lastSn=d,this.lastPartIndex=u}}onFragLoaded(e,t){const{frag:s,payload:r}=t;if(s.type===X.SUBTITLE)if(r.byteLength){const n=s.decryptdata,a="stats"in t;if(n==null||!n.encrypted||a){const o=this.tracks[s.level],l=this.vttCCs;l[s.cc]||(l[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),o&&o.textCodec===dc?this._parseIMSC1(s,r):this._parseVTTs(t)}}else this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const s=this.hls;Og(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),s.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{s.logger.log(`Failed to parse IMSC1: ${r}`),s.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:s,payload:r}=e,{initPTS:n,unparsedVttFrags:a}=this,o=n.length-1;if(!n[s.cc]&&o===-1){a.push(e);return}const l=this.hls,d=(t=s.initSegment)!=null&&t.data?ti(s.initSegment.data,new Uint8Array(r)).buffer:r;ZR(d,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,u=>{this._appendCues(u,s.level),l.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},u=>{const c=u.message==="Missing initPTS for VTT MPEGTS";c?a.push(e):this._fallbackToIMSC1(s,r),l.logger.log(`Failed to parse VTT cue: ${u}`),!(c&&o>s.cc)&&l.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:u})})}_fallbackToIMSC1(e,t){const s=this.tracks[e.level];s.textCodec||Og(t,this.initPTS[e.cc],()=>{s.textCodec=dc,this._parseIMSC1(e,t)},()=>{s.textCodec="wvtt"})}_appendCues(e,t){const s=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(n=>ay(r,n))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;s.trigger(E.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:s}=t;s.type===X.SUBTITLE&&this.onFragLoaded(E.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:s,samples:r}=t;if(!(s.type===X.MAIN&&this.closedCaptionsForLevel(s)==="NONE"))for(let n=0;nJc(o[l],t,s))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>Jc(o[l],t,r))}}}extractCea608Data(e){const t=[[],[]],s=e[0]&31;let r=2;for(let n=0;n=16?l--:l++;const f=hy(d.trim()),m=em(e,t,f);i!=null&&(c=i.cues)!=null&&c.getCueById(m)||(a=new u(e,t,f),a.id=m,a.line=h+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),r.push(a))}return i&&r.length&&(r.sort((h,f)=>h.line==="auto"||f.line==="auto"?0:h.line>8&&f.line>8?f.line-h.line:h.line-f.line),r.forEach(h=>ay(i,h))),r}};function lx(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const dx=/(\d+)-(\d+)\/(\d+)/;class Bg{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||fx,this.controller=new self.AbortController,this.stats=new Mf}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,s){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=ux(e,this.controller.signal),a=e.responseType==="arraybuffer",o=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=s,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=l&&Q(l)?l:d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(so(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(c=>{var h;this.response=this.loader=c;const f=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},d-(f-r.loading.start)),!c.ok){const{status:p,statusText:g}=c;throw new mx(g||"fetch, bad network response",p,c)}r.loading.first=f,r.total=hx(c.headers)||r.total;const m=(h=this.callbacks)==null?void 0:h.onProgress;return m&&Q(t.highWaterMark)?this.loadProgressively(c,r,e,t.highWaterMark,m):a?c.arrayBuffer():e.responseType==="json"?c.json():c.text()}).then(c=>{var h,f;const m=this.response;if(!m)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const p=c[o];p&&(r.loaded=r.total=p);const g={url:m.url,data:c,code:m.status},v=(h=this.callbacks)==null?void 0:h.onProgress;v&&!Q(t.highWaterMark)&&v(r,e,c,m),(f=this.callbacks)==null||f.onSuccess(g,r,e,m)}).catch(c=>{var h;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const f=c&&c.code||0,m=c?c.message:null;(h=this.callbacks)==null||h.onError({code:f,text:m},e,c?c.details:null,r)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,s,r=0,n){const a=new LE,o=e.body.getReader(),l=()=>o.read().then(d=>{if(d.done)return a.dataLength&&n(t,s,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const u=d.value,c=u.length;return t.loaded+=c,c=r&&n(t,s,a.flush().buffer,e)):n(t,s,u.buffer,e),l()}).catch(()=>Promise.reject());return l()}}function ux(i,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Ce({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function cx(i){const e=dx.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function hx(i){const e=i.get("Content-Range");if(e){const s=cx(e);if(Q(s))return s}const t=i.get("Content-Length");if(t)return parseInt(t)}function fx(i,e){return new self.Request(i.url,e)}class mx extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const px=/^age:\s*[\d.]+\s*$/im;class vy{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Mf,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=s,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const s=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==s||this.stats.aborted))return n(s,t.url)}).catch(a=>{if(!(this.loader!==s||this.stats.aborted))return s.open("GET",t.url,!0),n(s,t.url)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,t,e)}).catch(a=>{var o;(o=this.callbacks)==null||o.onError({code:s.status,text:a.message},t,s,r)}):this.openAndSendXhr(s,t,e)}openAndSendXhr(e,t,s){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=s.loadPolicy;if(r)for(const o in r)e.setRequestHeader(o,r[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),s.timeout=n&&Q(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:s}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!s.aborted&&r>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const d=t.status,u=t.responseType==="text"?t.responseText:null;if(d>=200&&d<300){const m=u??t.response;if(m!=null){var a,o;s.loading.end=Math.max(self.performance.now(),s.loading.first);const p=t.responseType==="arraybuffer"?m.byteLength:m.length;s.loaded=s.total=p,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);const g=(a=this.callbacks)==null?void 0:a.onProgress;g&&g(s,e,m,t);const v={url:t.responseURL,data:m,code:d};(o=this.callbacks)==null||o.onSuccess(v,s,e,t);return}}const c=n.loadPolicy.errorRetry,h=s.retry,f={url:e.url,data:void 0,code:d};if(Md(c,h,!1,f))this.retry(c);else{var l;xe.error(`${d} while loading ${e.url}`),(l=this.callbacks)==null||l.onError({code:d,text:t.statusText},e,t,s)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Md(e,t,!0))this.retry(e);else{var s;xe.warn(`timeout while loading ${(s=this.context)==null?void 0:s.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:s}=this;this.retryDelay=Uf(e,s.retry),s.retry++,xe.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${s.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&px.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const gx={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},vx=Le(Le({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:vy,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:k1,bufferController:yL,capLevelController:pu,errorController:P1,fpsController:bR,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:pE,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:gx},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Ex()),{},{subtitleStreamController:wR,subtitleTrackController:AR,timelineController:rx,audioStreamController:pL,audioTrackController:gL,emeController:Rn,cmcdController:gR,contentSteeringController:ER,interstitialsController:CR});function Ex(){return{cueHandler:ox,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function yx(i,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const s=th(i),r=["manifest","level","frag"],n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(a=>{const o=`${a==="level"?"playlist":a}LoadPolicy`,l=e[o]===void 0,d=[];n.forEach(u=>{const c=`${a}Loading${u}`,h=e[c];if(h!==void 0&&l){d.push(c);const f=s[o].default;switch(e[o]={default:f},u){case"TimeOut":f.maxLoadTimeMs=h,f.maxTimeToFirstByteMs=h;break;case"MaxRetry":f.errorRetry.maxNumRetry=h,f.timeoutRetry.maxNumRetry=h;break;case"RetryDelay":f.errorRetry.retryDelayMs=h,f.timeoutRetry.retryDelayMs=h;break;case"MaxRetryTimeout":f.errorRetry.maxRetryDelayMs=h,f.timeoutRetry.maxRetryDelayMs=h;break}}}),d.length&&t.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${o}": ${Pe(e[o])}`)}),Le(Le({},s),e)}function th(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(th):Object.keys(i).reduce((e,t)=>(e[t]=th(i[t]),e),{}):i}function bx(i,e){const t=i.loader;t!==Bg&&t!==vy?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):lx()&&(i.loader=Bg,i.progressive=!0,i.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const pl=2,Tx=.1,_x=.05,Ax=100;class Sx extends uE{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var s;(s=this.media)!=null&&s.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var s;this.ended=((s=this.media)==null?void 0:s.currentTime)||1,this.hls.trigger(E.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(Ax),this.mediaSource=t.mediaSource;const s=this.media=t.media;Rt(s,"playing",this.onMediaPlaying),Rt(s,"waiting",this.onMediaWaiting),Rt(s,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:s}=this;s&&(Ct(s,"playing",this.onMediaPlaying),Ct(s,"waiting",this.onMediaWaiting),Ct(s,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var s,r;const n=(s=this.hls)==null?void 0:s.config;if(!n)return;const a=this.media;if(!a)return;const{seeking:o}=a,l=this.seeking&&!o,d=!this.seeking&&o,u=a.paused&&!o||a.ended||a.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,n.nudgeOnVideoHole&&!u&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(d||l){l&&this.stallResolved(e);return}if(u){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(E.MEDIA_ENDED,{stalled:!1}));return}if(!de.getBuffered(a).length){this.nudgeRetry=0;return}const c=de.bufferInfo(a,e,0),h=c.nextStart||0,f=this.fragmentTracker;if(o&&f&&this.hls){const L=Hg(this.hls.inFlightFragments,e),S=c.len>pl,R=!h||L||h-e>pl&&!f.getPartialFragment(e);if(S||R)return;this.moved=!1}const m=(r=this.hls)==null?void 0:r.latestLevelDetails;if(!this.moved&&this.stalled!==null&&f){if(!(c.len>0)&&!h)return;const S=Math.max(h,c.start||0)-e,x=!!(m!=null&&m.live)?m.targetduration*2:pl,I=Bo(e,f);if(S>0&&(S<=x||I)){a.paused||this._trySkipBufferHole(I);return}}const p=n.detectStallWithCurrentTimeMs,g=self.performance.now(),v=this.waiting;let b=this.stalled;if(b===null)if(v>0&&g-v=p||v)&&this.hls){var T;if(((T=this.mediaSource)==null?void 0:T.readyState)==="ended"&&!(m!=null&&m.live)&&Math.abs(e-(m?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(E.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(c),!this.media||!this.hls)return}const A=de.bufferInfo(a,e,n.maxBufferHole);this._tryFixBufferStall(A,y,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const s=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(s)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(E.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var s;const r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(s=this.buffered.audio)!=null&&s.length&&r&&r.length>1&&e>r.end(0)){const n=de.bufferedInfo(de.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){const a=de.timeRangesToArray(r),o=de.bufferedInfo(a,t,0).bufferedIndex;if(o>-1&&oo)&&u-d<1&&e-d<2){const c=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${d} -> ${u} buffered index: ${l}`);this.warn(c.message),this.media.currentTime+=1e-6;let h=Bo(e,this.fragmentTracker);h&&"fragment"in h?h=h.fragment:h||(h=void 0);const f=de.bufferInfo(this.media,e,0);this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:c,reason:c.message,frag:h,buffer:f.len,bufferInfo:f})}}}}}_tryFixBufferStall(e,t,s){var r,n;const{fragmentTracker:a,media:o}=this,l=(r=this.hls)==null?void 0:r.config;if(!o||!a||!l)return;const d=(n=this.hls)==null?void 0:n.latestLevelDetails,u=Bo(s,a);if((u||d!=null&&d.live&&s1&&e.len>l.maxBufferHole||e.nextStart&&(e.nextStart-sl.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const s=this.fragmentTracker,r=e.nextStart;if(s&&r){const n=s.getFragAtPos(t,X.MAIN),a=s.getFragAtPos(r,X.MAIN);if(n&&a)return a.sn-n.sn<2}return!1}_reportStall(e){const{hls:t,media:s,stallReported:r,stalled:n}=this;if(!r&&n!==null&&s&&t){this.stallReported=!0;const a=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${Pe(e)})`);this.warn(a.message),t.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:n}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:s,media:r}=this,n=(t=this.hls)==null?void 0:t.config;if(!r||!s||!n)return 0;const a=r.currentTime,o=de.bufferInfo(r,a,0),l=a0&&o.len<1&&r.readyState<3,h=l-a;if(h>0&&(u||c)){if(h>n.maxBufferHole){let m=!1;if(a===0){const p=s.getAppendedFrag(0,X.MAIN);p&&l"u"))return self.VTTCue||self.TextTrackCue}function fc(i,e,t,s,r){let n=new i(e,t,"");try{n.value=s,r&&(n.type=r)}catch{n=new i(e,t,Pe(r?Le({type:r},s):s))}return n}const Ho=(()=>{const i=ih();try{i&&new i(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Lx{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(E.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var s;this.media=t.media,((s=t.overrides)==null?void 0:s.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&yn(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tHo&&(c=Ho),c-u<=0&&(c=u+Ix);for(let f=0;fu.type===Wt.audioId3&&l:r==="video"?d=u=>u.type===Wt.emsg&&o:d=u=>u.type===Wt.audioId3&&l||u.type===Wt.emsg&&o,Jc(n,t,s,d)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:s,timelineOffset:r,enableDateRangeMetadataCues:n,interstitialsController:a}=this.hls.config;if(!n)return;const o=ih();if(s&&r&&!a){const{fragmentStart:p,fragmentEnd:g}=e;let v=this.assetCue;v?(v.startTime=p,v.endTime=g):o&&(v=this.assetCue=fc(o,p,g,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),v&&(v.id=s,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(v),v.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:l}=this,{dateRanges:d}=e,u=Object.keys(d);let c=this.dateRangeCuesAppended;if(l&&t){var h;if((h=l.cues)!=null&&h.length){const p=Object.keys(c).filter(g=>!u.includes(g));for(let g=p.length;g--;){var f;const v=p[g],b=(f=c[v])==null?void 0:f.cues;delete c[v],b&&Object.keys(b).forEach(y=>{const T=b[y];if(T){T.removeEventListener("enter",this.onEventCueEnter);try{l.removeCue(T)}catch{}}})}}else c=this.dateRangeCuesAppended={}}const m=e.fragments[e.fragments.length-1];if(!(u.length===0||!Q(m?.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let p=0;p{if(F!==v.id){const V=d[F];if(V.class===v.class&&V.startDate>v.startDate&&(!M||v.startDate.01&&(F.startTime=b,F.endTime=L);else if(o){let V=v.attr[M];j1(M)&&(V=Vv(V));const H=fc(o,b,L,{key:M,data:V},Wt.dateRange);H&&(H.id=g,this.id3Track.addCue(H),T[M]=H,a&&(M==="X-ASSET-LIST"||M==="X-ASSET-URL")&&H.addEventListener("enter",this.onEventCueEnter))}}c[g]={cues:T,dateRange:v,durationKnown:A}}}}}class Rx{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,s=this.levelDetails;if(!t||!s)return;this.currentTime=t.currentTime;const r=this.computeLatency();if(r===null)return;this._latency=r;const{lowLatencyMode:n,maxLiveSyncPlaybackRate:a}=this.config;if(!n||a===1||!s.live)return;const o=this.targetLatency;if(o===null)return;const l=r-o,d=Math.min(this.maxLatency,o+s.targetduration);if(l.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,a)),h=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20,f=Math.min(c,Math.max(1,h));this.changeMediaPlaybackRate(t,f)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:s,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,l=this.hls.userConfig;let d=o&&s||t;(this._targetLatencyUpdated||l.liveSyncDuration||l.liveSyncDurationCount||d===0)&&(d=n!==void 0?n:a*r);const u=r;return d+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,u)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const s=this.levelDetails;if(s===null)return null;const r=s.edge,n=e-t-this.edgeStalled,a=r-s.totalduration,o=r-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(a,n),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const s=e.buffered.length;return(s?e.buffered.end(s-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var s;t.details===w.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(s=this.levelDetails)!=null&&s.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var s,r;e.playbackRate!==t&&((s=this.hls)==null||s.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(r=this.targetLatency)==null?void 0:r.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class xx extends Qf{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const s=this.hls.config.preferManagedMediaSource,r=[],n={},a={};let o=!1,l=!1,d=!1;t.levels.forEach(u=>{const c=u.attrs;let{audioCodec:h,videoCodec:f}=u;h&&(u.audioCodec=h=kd(h,s)||void 0),f&&(f=u.videoCodec=u1(f));const{width:m,height:p,unknownCodecs:g}=u,v=g?.length||0;if(o||(o=!!(m&&p)),l||(l=!!f),d||(d=!!h),v||h&&!this.isAudioSupported(h)||f&&!this.isVideoSupported(f)){this.log(`Some or all CODECS not supported "${c.CODECS}"`);return}const{CODECS:b,"FRAME-RATE":y,"HDCP-LEVEL":T,"PATHWAY-ID":A,RESOLUTION:L,"VIDEO-RANGE":S}=c,x=`${`${A||"."}-`}${u.bitrate}-${L}-${y}-${b}-${S}-${T}`;if(n[x])if(n[x].uri!==u.url&&!u.attrs["PATHWAY-ID"]){const I=a[x]+=1;u.attrs["PATHWAY-ID"]=new Array(I+1).join(".");const M=this.createLevel(u);n[x]=M,r.push(M)}else n[x].addGroupId("audio",c.AUDIO),n[x].addGroupId("text",c.SUBTITLES);else{const I=this.createLevel(u);n[x]=I,a[x]=1,r.push(I)}}),this.filterAndSortMediaOptions(r,t,o,l,d)}createLevel(e){const t=new eo(e),s=e.supplemental;if(s!=null&&s.videoCodec&&!this.isVideoSupported(s.videoCodec)){const r=new Error(`SUPPLEMENTAL-CODECS not supported "${s.videoCodec}"`);this.log(r.message),t.supportedResult=iE(r,[])}return t}isAudioSupported(e){return Za(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Za(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,s,r,n){var a;let o=[],l=[],d=e;const u=((a=t.stats)==null?void 0:a.parsing)||{};if((s||r)&&n&&(d=d.filter(({videoCodec:b,videoRange:y,width:T,height:A})=>(!!b||!!(T&&A))&&b1(y))),d.length===0){Promise.resolve().then(()=>{if(this.hls){let b="no level with compatible codecs found in manifest",y=b;t.levels.length&&(y=`one or more CODECS in variant not supported: ${Pe(t.levels.map(A=>A.attrs.CODECS).filter((A,L,S)=>S.indexOf(A)===L))}`,this.warn(y),b+=` (${y})`);const T=new Error(b);this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:T,reason:y})}}),u.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(b=>!b.audioCodec||this.isAudioSupported(b.audioCodec)),Kg(o)),t.subtitles&&(l=t.subtitles,Kg(l));const c=d.slice(0);d.sort((b,y)=>{if(b.attrs["HDCP-LEVEL"]!==y.attrs["HDCP-LEVEL"])return(b.attrs["HDCP-LEVEL"]||"")>(y.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&b.height!==y.height)return b.height-y.height;if(b.frameRate!==y.frameRate)return b.frameRate-y.frameRate;if(b.videoRange!==y.videoRange)return Dd.indexOf(b.videoRange)-Dd.indexOf(y.videoRange);if(b.videoCodec!==y.videoCodec){const T=Pp(b.videoCodec),A=Pp(y.videoCodec);if(T!==A)return A-T}if(b.uri===y.uri&&b.codecSet!==y.codecSet){const T=xd(b.codecSet),A=xd(y.codecSet);if(T!==A)return A-T}return b.averageBitrate!==y.averageBitrate?b.averageBitrate-y.averageBitrate:0});let h=c[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==c.length)){for(let b=0;bT&&T===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=A)}break}const m=n&&!r,p=this.hls.config,g=!!(p.audioStreamController&&p.audioTrackController),v={levels:d,audioTracks:o,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:g&&!m&&o.some(b=>!!b.url)};u.end=performance.now(),this.hls.trigger(E.MANIFEST_PARSED,v)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const u=new Error("invalid level idx"),c=e<0;if(this.hls.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.LEVEL_SWITCH_ERROR,level:e,fatal:c,error:u,reason:u.message}),c)return;e=Math.min(e,t.length-1)}const s=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,s===e&&r&&n===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${s}${n?" with Pathway "+n:""}`);const l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(E.LEVEL_SWITCHING,l);const d=a.details;if(!d||d.live){const u=this.switchParams(a.uri,r?.details,d);this.loadPlaylist(u)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),s=e.filter(r=>t.indexOf(r)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=s}}onError(e,t){t.fatal||!t.context||t.context.type===me.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===X.MAIN){const s=t.elementaryStreams;if(!Object.keys(s).some(n=>!!s[n]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var s;const{level:r,details:n}=t,a=t.levelInfo;if(!a){var o;this.warn(`Invalid level index ${r}`),(o=t.deliveryDirectives)!=null&&o.skip&&(n.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let l=a.details;l===t.details&&l.advanced&&(l=void 0),this.playlistLoaded(r,t,l)}else(s=t.deliveryDirectives)!=null&&s.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,n=e.attrs["PATHWAY-ID"],a=e.details,o=a?.age;this.log(`Loading level index ${r}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${n?" Pathway "+n:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${s}`),this.hls.trigger(E.LEVEL_LOADING,{url:s,level:r,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const s=this._levels.filter((n,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(n),n===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,n.details&&n.details.fragments.forEach(o=>o.level=-1)),!1));AE(s),this._levels=s,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const r=s.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&(this._startLevel=Math.min(this._startLevel,r)),this.hls.trigger(E.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(E.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function Kg(i){const e={};i.forEach(t=>{const s=t.groupId||"";t.id=e[s]=e[s]||0,e[s]++})}function Ey(){return self.SourceBuffer||self.WebKitSourceBuffer}function yy(){if(!Ks())return!1;const e=Ey();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function kx(){if(!yy())return!1;const i=Ks();return typeof i?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>i.isTypeSupported(Ja(e,"video")))||["mp4a.40.2","fLaC"].some(e=>i.isTypeSupported(Ja(e,"audio"))))}function Dx(){var i;const e=Ey();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}const Cx=100;class wx extends Gf{constructor(e,t,s){super(e,t,s,"stream-controller",X.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const r=this.media,n=r?r.currentTime:null;if(n===null||!Q(n)||(this.log(`Media seeked to ${n.toFixed(3)}`),!this.getBufferedFrag(n)))return;const a=this.getFwdBufferInfoAtPos(r,n,X.MAIN,0);if(a===null||a.len===0){this.warn(`Main forward buffer length at ${n} on "seeked" event ${a?a.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:s,hls:r}=this;if(this.stopLoad(),this.setInterval(Cx),this.level=-1,!this.startFragRequested){let n=r.startLevel;n===-1&&(r.config.testBandwidth&&this.levels.length>1?(n=0,this.bitrateTest=!0):n=r.firstAutoLevel),r.nextLoadLevel=n,this.level=r.loadLevel,this._hasEnoughToStart=!!t}s>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s),this.state=P.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=P.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case P.WAITING_LEVEL:{const{levels:e,level:t}=this,s=e?.[t],r=s?.details;if(r&&(!r.live||this.levelLastLoaded===s&&!this.waitForLive(s))){if(this.waitForCdnTuneIn(r))break;this.state=P.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=P.IDLE;break}break}case P.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===P.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:s,media:r}=this;if(t===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(s!=null&&s[n]))return;const a=s[n],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const p={};this.altAudio===2&&(p.type="video"),this.hls.trigger(E.BUFFER_EOS,p),this.state=P.ENDED;return}if(!this.buffering)return;e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const d=a.details;if(!d||this.state===P.WAITING_LEVEL||this.waitForLive(a)){this.level=n,this.state=P.WAITING_LEVEL,this.startFragRequested=!1;return}const u=o.len,c=this.getMaxBufferLength(a.maxBitrate);if(u>=c)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:o.end;let f=this.getNextFragment(h,d);if(this.couldBacktrack&&!this.fragPrevious&&f&&ze(f)&&this.fragmentTracker.getState(f)!==dt.OK){var m;const g=((m=this.backtrackFragment)!=null?m:f).sn-d.startSN,v=d.fragments[g-1];v&&f.cc===v.cc&&(f=v,this.fragmentTracker.removeFragment(v))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,h)){if(!f.gap){const g=this.audioOnly&&!this.altAudio?Me.AUDIO:Me.VIDEO,v=(g===Me.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,g,X.MAIN)}f=this.getNextFragmentLoopLoading(f,d,o,X.MAIN,c)}f&&(f.initSegment&&!f.initSegment.data&&!this.bitrateTest&&(f=f.initSegment),this.loadFragment(f,a,h))}loadFragment(e,t,s){const r=this.fragmentTracker.getState(e);r===dt.NOT_LOADED||r===dt.PARTIAL?ze(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,s):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,X.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let s;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const o=this.getMainFwdBufferInfo();if(!o||o.len=a-t.maxFragLookUpTolerance&&n<=o;if(r!==null&&s.duration>r&&(n{this.hls&&this.hls.trigger(E.AUDIO_TRACK_SWITCHED,t)}),s.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}s.trigger(E.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const s=Cd(t.url,this.hls);if(s){const r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=s?2:0,this.tick()}onBufferCreated(e,t){const s=t.tracks;let r,n,a=!1;for(const o in s){const l=s[o];if(l.id==="main"){if(n=o,r=l,o==="video"){const d=s[o];d&&(this.videoBuffer=d.buffer)}}else a=!0}a&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:s,part:r}=t,n=s.type===X.MAIN;if(n){if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${r?" p: "+r.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===P.PARSED&&(this.state=P.IDLE);return}const o=r?r.stats:s.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),ze(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,r)}const a=this.media;a&&(!this._hasEnoughToStart&&de.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),n&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var s;if(t.fatal){this.state=P.ERROR;return}switch(t.details){case w.FRAG_GAP:case w.FRAG_PARSING_ERROR:case w.FRAG_DECRYPT_ERROR:case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(X.MAIN,t);break;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===P.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===me.LEVEL&&(this.state=P.IDLE);break;case w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case w.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case w.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=P.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Me.AUDIO||!this.altAudio){const s=(t===Me.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,t,X.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let s=this.startPosition;if(s>=0&&t0&&(l{const{hls:r}=this,n=s?.frag;if(!n||this.fragContextChanged(n))return;t.fragmentError=0,this.state=P.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=n.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),r.trigger(E.FRAG_LOADED,s),n.bitrateTest=!1}).catch(s=>{this.state===P.STOPPED||this.state===P.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:s}=this,{remuxResult:r,chunkMeta:n}=e,a=this.getCurrentContext(n);if(!a){this.resetWhenMissingContext(n);return}const{frag:o,part:l,level:d}=a,{video:u,text:c,id3:h,initSegment:f}=r,{details:m}=d,p=this.altAudio?void 0:r.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=P.PARSING,f){const g=f.tracks;if(g){const T=o.initSegment||o;if(this.unhandledEncryptionError(f,o))return;this._bufferInitSegment(d,g,T,n),s.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:T,id:t,tracks:g})}const v=f.initPTS,b=f.timescale,y=this.initPTS[o.cc];if(Q(v)&&(!y||y.baseTime!==v||y.timescale!==b)){const T=f.trackId;this.initPTS[o.cc]={baseTime:v,timescale:b,trackId:T},s.trigger(E.INIT_PTS_FOUND,{frag:o,id:t,initPTS:v,timescale:b,trackId:T})}}if(u&&m){p&&u.type==="audiovideo"&&this.logMuxedErr(o);const g=m.fragments[o.sn-1-m.startSN],v=o.sn===m.startSN,b=!g||o.cc>g.cc;if(r.independent!==!1){const{startPTS:y,endPTS:T,startDTS:A,endDTS:L}=u;if(l)l.elementaryStreams[u.type]={startPTS:y,endPTS:T,startDTS:A,endDTS:L};else if(u.firstKeyFrame&&u.independent&&n.id===1&&!b&&(this.couldBacktrack=!0),u.dropped&&u.independent){const S=this.getMainFwdBufferInfo(),R=(S?S.end:this.getLoadPosition())+this.config.maxBufferHole,x=u.firstKeyFramePTS?u.firstKeyFramePTS:y;if(!v&&Rpl&&(o.gap=!0);o.setElementaryStreamInfo(u.type,y,T,A,L),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(u,o,l,n,v||b)}else if(v||b)o.gap=!0;else{this.backtrack(o);return}}if(p){const{startPTS:g,endPTS:v,startDTS:b,endDTS:y}=p;l&&(l.elementaryStreams[Me.AUDIO]={startPTS:g,endPTS:v,startDTS:b,endDTS:y}),o.setElementaryStreamInfo(Me.AUDIO,g,v,b,y),this.bufferFragmentData(p,o,l,n)}if(m&&h!=null&&h.samples.length){const g={id:t,frag:o,details:m,samples:h.samples};s.trigger(E.FRAG_PARSING_METADATA,g)}if(m&&c){const g={id:t,frag:o,details:m,samples:c.samples};s.trigger(E.FRAG_PARSING_USERDATA,g)}}logMuxedErr(e){this.warn(`${ze(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,s,r){if(this.state!==P.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(s));const{audio:n,video:a,audiovideo:o}=t;if(n){const d=e.audioCodec;let u=ll(n.codec,d);u==="mp4a"&&(u="mp4a.40.5");const c=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const h=n.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&c.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&c.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),d&&d!==u&&this.log(`Swapping manifest audio codec "${d}" for "${u}"`),n.levelCodec=u,n.id=X.MAIN,this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${u||""}/${d||""}/${n.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=X.MAIN;const d=a.codec;if(d?.length===4)switch(d){case"hvc1":case"hev1":a.codec="hvc1.1.6.L120.90";break;case"av01":a.codec="av01.0.04M.08";break;case"avc1":a.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${d}]${a.codec!==d?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const l=Object.keys(t);if(l.length){if(this.hls.trigger(E.BUFFER_CODECS,t),!this.hls)return;l.forEach(d=>{const c=t[d].initSegment;c!=null&&c.byteLength&&this.hls.trigger(E.BUFFER_APPENDING,{type:d,data:c,frag:s,part:null,chunkMeta:r,parent:s.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,X.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,s=e?.[t];return s?this.getMaxBufferLength(s.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=P.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(de.isBuffered(e,s)?t=this.getAppendedFrag(s):de.isBuffered(e,s+.1)&&(t=this.getAppendedFrag(s+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n)&&(this.fragPlaying=t,this.hls.trigger(E.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(E.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return Q(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(Q(t)){const s=this.getLevelDetails(),r=this.currentFrag||(s?xr(null,s.fragments,t):null);if(r){const n=r.programDateTime;if(n!==null){const a=n+(t-r.start)*1e3;return new Date(a)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Mx extends si{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const s in this.keyIdToKeyInfo){const r=this.keyIdToKeyInfo[s].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=w.KEY_LOAD_ERROR,s,r,n){return new as({type:te.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:s,networkDetails:r})}loadClear(e,t,s){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let r=0,n=t.length;r{if(!this.emeController)return;a.setKeyFormat(o);const l=ul(o);if(l)return this.emeController.getKeySystemAccess([l])})}if(this.config.requireKeySystemAccessOnStart){const r=ca(this.config);if(r.length)return this.emeController.getKeySystemAccess(r)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var s,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const d=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,d))}const a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));const o=mc(n);let l=this.keyIdToKeyInfo[o];if((s=l)!=null&&s.decryptdata.key)return n.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if(this.emeController&&(r=l)!=null&&r.keyLoadPromise)switch(this.emeController.getKeyStatus(l.decryptdata)){case"usable":case"usable-in-future":return l.keyLoadPromise.then(u=>{const{keyInfo:c}=u;return n.key=c.decryptdata.key,{frag:e,keyInfo:c}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${n.keyId?" keyId: "+bt(n.keyId):""} URI: ${n.uri} from ${e.type} ${e.level}`),l=this.keyIdToKeyInfo[o]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const s={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r;if(!e.decryptdata.keyId&&(r=t.initSegment)!=null&&r.data){const a=ZS(t.initSegment.data);if(a.length){let o=a[0];o.some(l=>l!==0)?(this.log(`Using keyId found in init segment ${bt(o)}`),Hs.setKeyIdForUri(e.decryptdata.uri,o)):(o=Hs.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${bt(o)}`)),e.decryptdata.keyId=o}}if(!e.decryptdata.keyId&&!ze(t))return Promise.resolve(s);const n=this.emeController.loadKey(s);return(e.keyLoadPromise=n.then(a=>(e.mediaKeySessionContext=a,s))).catch(a=>{throw e.keyLoadPromise=null,"data"in a&&(a.data.frag=t),a})}return Promise.resolve(s)}loadKeyHTTP(e,t){const s=this.config,r=s.loader,n=new r(s);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,o)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},d=s.keyLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,p)=>{const{frag:g,keyInfo:v}=m,b=mc(v.decryptdata);if(!g.decryptdata||v!==this.keyIdToKeyInfo[b])return o(this.createKeyLoadError(g,w.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),p));v.decryptdata.key=g.decryptdata.key=new Uint8Array(h.data),g.keyLoader=null,v.loader=null,a({frag:g,keyInfo:v})},onError:(h,f,m,p)=>{this.resetLoader(f),o(this.createKeyLoadError(t,w.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),m,Le({url:l.url,data:void 0},h)))},onTimeout:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,w.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,w.INTERNAL_ABORTED,new Error("key loading aborted"),m))}};n.load(l,u,c)})}resetLoader(e){const{frag:t,keyInfo:s,url:r}=e,n=s.loader;t.keyLoader===n&&(t.keyLoader=null,s.loader=null);const a=mc(s.decryptdata)||r;delete this.keyIdToKeyInfo[a],n&&n.destroy()}}function mc(i){if(i.keyFormat!==Tt.FAIRPLAY){const e=i.keyId;if(e)return bt(e)}return i.uri}function Vg(i){const{type:e}=i;switch(e){case me.AUDIO_TRACK:return X.AUDIO;case me.SUBTITLE_TRACK:return X.SUBTITLE;default:return X.MAIN}}function pc(i,e){let t=i.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Px{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,s=t.pLoader,r=t.loader,n=s||r,a=new n(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:s}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:me.MANIFEST,url:s,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:s,level:r,pathwayId:n,url:a,deliveryDirectives:o,levelInfo:l}=t;this.load({id:s,level:r,pathwayId:n,responseType:"text",type:me.LEVEL,url:a,deliveryDirectives:o,levelOrTrack:l})}onAudioTrackLoading(e,t){const{id:s,groupId:r,url:n,deliveryDirectives:a,track:o}=t;this.load({id:s,groupId:r,level:null,responseType:"text",type:me.AUDIO_TRACK,url:n,deliveryDirectives:a,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:s,groupId:r,url:n,deliveryDirectives:a,track:o}=t;this.load({id:s,groupId:r,level:null,responseType:"text",type:me.SUBTITLE_TRACK,url:n,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,t){const s=this.loaders[me.LEVEL];if(s){const r=s.context;r&&!t.levels.some(n=>n===r.levelOrTrack)&&(s.abort(),delete this.loaders[me.LEVEL])}}load(e){var t;const s=this.hls.config;let r=this.getInternalLoader(e);if(r){const d=this.hls.logger,u=r.context;if(u&&u.levelOrTrack===e.levelOrTrack&&(u.url===e.url||u.deliveryDirectives&&!e.deliveryDirectives)){u.url===e.url?d.log(`[playlist-loader]: ignore ${e.url} ongoing request`):d.log(`[playlist-loader]: ignore ${e.url} in favor of ${u.url}`);return}d.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===me.MANIFEST?n=s.manifestLoadPolicy.default:n=Ce({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),Q((t=e.deliveryDirectives)==null?void 0:t.part)){let d;if(e.type===me.LEVEL&&e.level!==null?d=this.hls.levels[e.level].details:e.type===me.AUDIO_TRACK&&e.id!==null?d=this.hls.audioTracks[e.id].details:e.type===me.SUBTITLE_TRACK&&e.id!==null&&(d=this.hls.subtitleTracks[e.id].details),d){const u=d.partTarget,c=d.targetduration;if(u&&c){const h=Math.max(u*3,c*.8)*1e3;n=Ce({},n,{maxTimeToFirstByteMs:Math.min(h,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,n.maxTimeToFirstByteMs)})}}}const a=n.errorRetry||n.timeoutRetry||{},o={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(d,u,c,h)=>{const f=this.getInternalLoader(c);this.resetInternalLoader(c.type);const m=d.data;u.parsing.start=performance.now(),Wi.isMediaPlaylist(m)||c.type!==me.MANIFEST?this.handleTrackOrLevelPlaylist(d,u,c,h||null,f):this.handleMasterPlaylist(d,u,c,h)},onError:(d,u,c,h)=>{this.handleNetworkError(u,c,!1,d,h)},onTimeout:(d,u,c)=>{this.handleNetworkError(u,c,!0,void 0,d)}};r.load(e,o,l)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:s}=this.hls;(e||s)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,s,r){const n=this.hls,a=e.data,o=pc(e,s),l=Wi.parseMasterPlaylist(a,o);if(l.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,s,l.playlistParsingError,r,t);return}const{contentSteering:d,levels:u,sessionData:c,sessionKeys:h,startTimeOffset:f,variableList:m}=l;this.variableList=m,u.forEach(b=>{const{unknownCodecs:y}=b;if(y){const{preferManagedMediaSource:T}=this.hls.config;let{audioCodec:A,videoCodec:L}=b;for(let S=y.length;S--;){const R=y[S];Za(R,"audio",T)?(b.audioCodec=A=A?`${A},${R}`:R,Fn.audio[A.substring(0,4)]=2,y.splice(S,1)):Za(R,"video",T)&&(b.videoCodec=L=L?`${L},${R}`:R,Fn.video[L.substring(0,4)]=2,y.splice(S,1))}}});const{AUDIO:p=[],SUBTITLES:g,"CLOSED-CAPTIONS":v}=Wi.parseMasterPlaylistMedia(a,o,l);p.length&&!p.some(y=>!y.url)&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ke({}),bitrate:0,url:""})),n.trigger(E.MANIFEST_LOADED,{levels:u,audioTracks:p,subtitles:g,captions:v,contentSteering:d,url:o,stats:t,networkDetails:r,sessionData:c,sessionKeys:h,startTimeOffset:f,variableList:m})}handleTrackOrLevelPlaylist(e,t,s,r,n){const a=this.hls,{id:o,level:l,type:d}=s,u=pc(e,s),c=Q(l)?l:Q(o)?o:0,h=Vg(s),f=Wi.parseLevelPlaylist(e.data,u,c,h,0,this.variableList);if(d===me.MANIFEST){const m={attrs:new Ke({}),bitrate:0,details:f,name:"",url:u};f.requestScheduled=t.loading.start+bE(f,0),a.trigger(E.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:u,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),s.levelDetails=f,this.handlePlaylistLoaded(f,e,t,s,r,n)}handleManifestParsingError(e,t,s,r,n){this.hls.trigger(E.ERROR,{type:te.NETWORK_ERROR,details:w.MANIFEST_PARSING_ERROR,fatal:t.type===me.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,s=!1,r,n){let a=`A network ${s?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===me.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===me.AUDIO_TRACK||e.type===me.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let l=w.UNKNOWN,d=!1;const u=this.getInternalLoader(e);switch(e.type){case me.MANIFEST:l=s?w.MANIFEST_LOAD_TIMEOUT:w.MANIFEST_LOAD_ERROR,d=!0;break;case me.LEVEL:l=s?w.LEVEL_LOAD_TIMEOUT:w.LEVEL_LOAD_ERROR,d=!1;break;case me.AUDIO_TRACK:l=s?w.AUDIO_TRACK_LOAD_TIMEOUT:w.AUDIO_TRACK_LOAD_ERROR,d=!1;break;case me.SUBTITLE_TRACK:l=s?w.SUBTITLE_TRACK_LOAD_TIMEOUT:w.SUBTITLE_LOAD_ERROR,d=!1;break}u&&this.resetInternalLoader(e.type);const c={type:te.NETWORK_ERROR,details:l,fatal:d,url:e.url,loader:u,context:e,error:o,networkDetails:t,stats:n};if(r){const h=t?.url||e.url;c.response=Le({url:h,data:void 0},r)}this.hls.trigger(E.ERROR,c)}handlePlaylistLoaded(e,t,s,r,n,a){const o=this.hls,{type:l,level:d,levelOrTrack:u,id:c,groupId:h,deliveryDirectives:f}=r,m=pc(t,r),p=Vg(r);let g=typeof r.level=="number"&&p===X.MAIN?d:void 0;const v=e.playlistParsingError;if(v){if(this.hls.logger.warn(`${v} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(E.ERROR,{type:te.NETWORK_ERROR,details:w.LEVEL_PARSING_ERROR,fatal:!1,url:m,error:v,reason:v.message,response:t,context:r,level:g,parent:p,networkDetails:n,stats:s});return}e.playlistParsingError=null}if(!e.fragments.length){const b=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(E.ERROR,{type:te.NETWORK_ERROR,details:w.LEVEL_EMPTY_ERROR,fatal:!1,url:m,error:b,reason:b.message,response:t,context:r,level:g,parent:p,networkDetails:n,stats:s});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case me.MANIFEST:case me.LEVEL:if(g){if(!u)g=0;else if(u!==o.levels[g]){const b=o.levels.indexOf(u);b>-1&&(g=b)}}o.trigger(E.LEVEL_LOADED,{details:e,levelInfo:u||o.levels[0],level:g||0,id:c||0,stats:s,networkDetails:n,deliveryDirectives:f,withoutMultiVariant:l===me.MANIFEST});break;case me.AUDIO_TRACK:o.trigger(E.AUDIO_TRACK_LOADED,{details:e,track:u,id:c||0,groupId:h||"",stats:s,networkDetails:n,deliveryDirectives:f});break;case me.SUBTITLE_TRACK:o.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,track:u,id:c||0,groupId:h||"",stats:s,networkDetails:n,deliveryDirectives:f});break}}}class Os{static get version(){return to}static isMSESupported(){return yy()}static isSupported(){return kx()}static getMediaSource(){return Ks()}static get Events(){return E}static get MetadataSchema(){return Wt}static get ErrorTypes(){return te}static get ErrorDetails(){return w}static get DefaultConfig(){return Os.defaultConfig?Os.defaultConfig:vx}static set DefaultConfig(e){Os.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Kf,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=BS(e.debug||!1,"Hls instance",e.assetPlayerId),s=this.config=yx(Os.DefaultConfig,e,t);this.userConfig=e,s.progressive&&bx(s,t);const{abrController:r,bufferController:n,capLevelController:a,errorController:o,fpsController:l}=s,d=new o(this),u=this.abrController=new r(this),c=new O1(this),h=s.interstitialsController,f=h?this.interstitialsController=new h(this,Os):null,m=this.bufferController=new n(this,c),p=this.capLevelController=new a(this),g=new l(this),v=new Px(this),b=s.contentSteeringController,y=b?new b(this):null,T=this.levelController=new xx(this,y),A=new Lx(this),L=new Mx(this.config,this.logger),S=this.streamController=new wx(this,c,L),R=this.gapController=new Sx(this,c);p.setStreamController(S),g.setStreamController(S);const x=[v,T,S];f&&x.splice(1,0,f),y&&x.splice(1,0,y),this.networkControllers=x;const I=[u,m,R,p,g,A,c];this.audioTrackController=this.createController(s.audioTrackController,x);const M=s.audioStreamController;M&&x.push(this.audioStreamController=new M(this,c,L)),this.subtitleTrackController=this.createController(s.subtitleTrackController,x);const F=s.subtitleStreamController;F&&x.push(this.subtititleStreamController=new F(this,c,L)),this.createController(s.timelineController,I),L.emeController=this.emeController=this.createController(s.emeController,I),this.cmcdController=this.createController(s.cmcdController,I),this.latencyController=this.createController(Rx,I),this.coreComponents=I,x.push(d);const V=d.onErrorOut;typeof V=="function"&&this.on(E.ERROR,V,d),this.on(E.MANIFEST_LOADED,v.onManifestLoaded,v)}createController(e,t){if(e){const s=new e(this);return t&&t.push(s),s}return null}on(e,t,s=this){this._emitter.on(e,t,s)}once(e,t,s=this){this._emitter.once(e,t,s)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,s=this,r){this._emitter.off(e,t,s,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,s){return this._emitter.emit(e,t,s)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(s){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const r=e===E.ERROR;this.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,fatal:r,event:e,error:s}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(E.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const n=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.ATTACH_MEDIA_ERROR,fatal:!0,error:n});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,s=t?e.media:e,r=t?e:{media:s};this._media=s,this.trigger(E.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log("detachMedia"),this.trigger(E.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(E.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,s=this._url,r=this._url=wf.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),t&&s&&(s!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(E.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", ":"")})`),this.started=!0,this.resumeBuffering();for(let s=0;s{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[X.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[X.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[X.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=SR()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){y1(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const s=e.length;for(let r=0;r=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:s}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,s)for(let n=r;n--;){const a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=s)return n}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const s=nE(t);return sE(e,s,navigator.mediaCapabilities)}}Os.defaultConfig=void 0;var ge=Os,Re={VIDEO:"video",THUMBNAIL:"thumbnail",STORYBOARD:"storyboard",DRM:"drm"},se={NOT_AN_ERROR:0,NETWORK_OFFLINE:2000002,NETWORK_UNKNOWN_ERROR:2e6,NETWORK_NO_STATUS:2000001,NETWORK_INVALID_URL:24e5,NETWORK_NOT_FOUND:2404e3,NETWORK_NOT_READY:2412e3,NETWORK_GENERIC_SERVER_FAIL:25e5,NETWORK_TOKEN_MISSING:2403201,NETWORK_TOKEN_MALFORMED:2412202,NETWORK_TOKEN_EXPIRED:2403210,NETWORK_TOKEN_AUD_MISSING:2403221,NETWORK_TOKEN_AUD_MISMATCH:2403222,NETWORK_TOKEN_SUB_MISMATCH:2403232,ENCRYPTED_ERROR:5e6,ENCRYPTED_UNSUPPORTED_KEY_SYSTEM:5000001,ENCRYPTED_GENERATE_REQUEST_FAILED:5000002,ENCRYPTED_UPDATE_LICENSE_FAILED:5000003,ENCRYPTED_UPDATE_SERVER_CERT_FAILED:5000004,ENCRYPTED_CDM_ERROR:5000005,ENCRYPTED_OUTPUT_RESTRICTED:5000006,ENCRYPTED_MISSING_TOKEN:5000002},vu=i=>i===Re.VIDEO?"playback":i,Ss=class ha extends Error{constructor(e,t=ha.MEDIA_ERR_CUSTOM,s,r){var n;super(e),this.name="MediaError",this.code=t,this.context=r,this.fatal=s??(t>=ha.MEDIA_ERR_NETWORK&&t<=ha.MEDIA_ERR_ENCRYPTED),this.message||(this.message=(n=ha.defaultMessages[this.code])!=null?n:"")}};Ss.MEDIA_ERR_ABORTED=1,Ss.MEDIA_ERR_NETWORK=2,Ss.MEDIA_ERR_DECODE=3,Ss.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Ss.MEDIA_ERR_ENCRYPTED=5,Ss.MEDIA_ERR_CUSTOM=100,Ss.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var W=Ss,Ox=i=>i==null,tm=(i,e)=>Ox(e)?!1:i in e,sh={ANY:"any",MUTED:"muted"},Se={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},qi={MSE:"mse",NATIVE:"native"},fa={HEADER:"header",QUERY:"query",NONE:"none"},Fd=Object.values(fa),cs={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Wg={HLS:cs.M3U8};[...Object.values(cs)];var Nx="en",rh={code:Nx},lt=(i,e,t,s,r=i)=>{r.addEventListener(e,t,s),i.addEventListener("teardown",()=>{r.removeEventListener(e,t)},{once:!0})};function Ux(i,e,t){e&&t>e&&(t=e);for(let s=0;s=t)return!0;return!1}var im=i=>{let e=i.indexOf("?");if(e<0)return[i];let t=i.slice(0,e),s=i.slice(e);return[t,s]},Eu=i=>{let{type:e}=i;if(e){let t=e.toUpperCase();return tm(t,Wg)?Wg[t]:e}return $x(i)},by=i=>i==="VOD"?Se.ON_DEMAND:Se.LIVE,Ty=i=>i==="EVENT"?Number.POSITIVE_INFINITY:i==="VOD"?Number.NaN:0,$x=i=>{let{src:e}=i;if(!e)return"";let t="";try{t=new URL(e).pathname}catch{console.error("invalid url")}let s=t.lastIndexOf(".");if(s<0)return Bx(i)?cs.M3U8:"";let r=t.slice(s+1).toUpperCase();return tm(r,cs)?cs[r]:""},Fx="mux.com",Bx=({src:i,customDomain:e=Fx})=>{let t;try{t=new URL(`${i}`)}catch{return!1}let s=t.protocol==="https:",r=t.hostname===`stream.${e}`.toLowerCase(),n=t.pathname.split("/"),a=n.length===2,o=!(n!=null&&n[1].includes("."));return s&&r&&a&&o},kn=i=>{let e=(i??"").split(".")[1];if(e)try{let t=e.replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(s)}catch{return}},Hx=({exp:i},e=Date.now())=>!i||i*1e3i!==e,Kx=({aud:i},e)=>!i,Vx=({aud:i},e)=>i!==e,_y="en";function ie(i,e=!0){var t,s;let r=e&&(s=(t=rh)==null?void 0:t[i])!=null?s:i,n=e?rh.code:_y;return new Wx(r,n)}var Wx=class{constructor(i,e=(t=>(t=rh)!=null?t:_y)()){this.message=i,this.locale=e}format(i){return this.message.replace(/\{(\w+)\}/g,(e,t)=>{var s;return(s=i[t])!=null?s:""})}toString(){return this.message}},qx=Object.values(sh),qg=i=>typeof i=="boolean"||typeof i=="string"&&qx.includes(i),Yx=(i,e,t)=>{let{autoplay:s}=i,r=!1,n=!1,a=qg(s)?s:!!s,o=()=>{r||lt(e,"playing",()=>{r=!0},{once:!0})};if(o(),lt(e,"loadstart",()=>{r=!1,o(),gc(e,a)},{once:!0}),lt(e,"loadstart",()=>{t||(i.streamType&&i.streamType!==Se.UNKNOWN?n=i.streamType===Se.LIVE:n=!Number.isFinite(e.duration)),gc(e,a)},{once:!0}),t&&t.once(ge.Events.LEVEL_LOADED,(l,d)=>{var u;i.streamType&&i.streamType!==Se.UNKNOWN?n=i.streamType===Se.LIVE:n=(u=d.details.live)!=null?u:!1}),!a){let l=()=>{!n||Number.isFinite(i.startTime)||(t!=null&&t.liveSyncPosition?e.currentTime=t.liveSyncPosition:Number.isFinite(e.seekable.end(0))&&(e.currentTime=e.seekable.end(0)))};t&<(e,"play",()=>{e.preload==="metadata"?t.once(ge.Events.LEVEL_UPDATED,l):l()},{once:!0})}return l=>{r||(a=qg(l)?l:!!l,gc(e,a))}},gc=(i,e)=>{if(!e)return;let t=i.muted,s=()=>i.muted=t;switch(e){case sh.ANY:i.play().catch(()=>{i.muted=!0,i.play().catch(s)});break;case sh.MUTED:i.muted=!0,i.play().catch(s);break;default:i.play().catch(()=>{});break}},jx=({preload:i,src:e},t,s)=>{let r=c=>{c!=null&&["","none","metadata","auto"].includes(c)?t.setAttribute("preload",c):t.removeAttribute("preload")};if(!s)return r(i),r;let n=!1,a=!1,o=s.config.maxBufferLength,l=s.config.maxBufferSize,d=c=>{r(c);let h=c??t.preload;a||h==="none"||(h==="metadata"?(s.config.maxBufferLength=1,s.config.maxBufferSize=1):(s.config.maxBufferLength=o,s.config.maxBufferSize=l),u())},u=()=>{!n&&e&&(n=!0,s.loadSource(e))};return lt(t,"play",()=>{a=!0,s.config.maxBufferLength=o,s.config.maxBufferSize=l,u()},{once:!0}),d(i),d};function zx(i,e){var t;if(!("videoTracks"in i))return;let s=new WeakMap;e.on(ge.Events.MANIFEST_PARSED,function(l,d){o();let u=i.addVideoTrack("main");u.selected=!0;for(let[c,h]of d.levels.entries()){let f=u.addRendition(h.url[0],h.width,h.height,h.videoCodec,h.bitrate);s.set(h,`${c}`),f.id=`${c}`}}),e.on(ge.Events.AUDIO_TRACKS_UPDATED,function(l,d){a();for(let u of d.audioTracks){let c=u.default?"main":"alternative",h=i.addAudioTrack(c,u.name,u.lang);h.id=`${u.id}`,u.default&&(h.enabled=!0)}}),i.audioTracks.addEventListener("change",()=>{var l;let d=+((l=[...i.audioTracks].find(c=>c.enabled))==null?void 0:l.id),u=e.audioTracks.map(c=>c.id);d!=e.audioTrack&&u.includes(d)&&(e.audioTrack=d)}),e.on(ge.Events.LEVELS_UPDATED,function(l,d){var u;let c=i.videoTracks[(u=i.videoTracks.selectedIndex)!=null?u:0];if(!c)return;let h=d.levels.map(f=>s.get(f));for(let f of i.videoRenditions)f.id&&!h.includes(f.id)&&c.removeRendition(f)});let r=l=>{let d=l.target.selectedIndex;d!=e.nextLevel&&(e.nextLevel=d)};(t=i.videoRenditions)==null||t.addEventListener("change",r);let n=()=>{for(let l of i.videoTracks)i.removeVideoTrack(l)},a=()=>{for(let l of i.audioTracks)i.removeAudioTrack(l)},o=()=>{n(),a()};e.once(ge.Events.DESTROYING,o)}var vc=i=>"time"in i?i.time:i.startTime;function Qx(i,e){e.on(ge.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(r,{tracks:n})=>{n.forEach(a=>{var o,l;let d=(o=a.subtitleTrack)!=null?o:a.closedCaptions,u=e.subtitleTracks.findIndex(({lang:h,name:f,type:m})=>h==d?.lang&&f===a.label&&m.toLowerCase()===a.kind),c=((l=a._id)!=null?l:a.default)?"default":`${a.kind}${u}`;sm(i,a.kind,a.label,d?.lang,c,a.default)})});let t=()=>{if(!e.subtitleTracks.length)return;let r=Array.from(i.textTracks).find(o=>o.id&&o.mode==="showing"&&["subtitles","captions"].includes(o.kind));if(!r)return;let n=e.subtitleTracks[e.subtitleTrack],a=n?n.default?"default":`${e.subtitleTracks[e.subtitleTrack].type.toLowerCase()}${e.subtitleTrack}`:void 0;if(e.subtitleTrack<0||r?.id!==a){let o=e.subtitleTracks.findIndex(({lang:l,name:d,type:u,default:c})=>r.id==="default"&&c||l==r.language&&d===r.label&&u.toLowerCase()===r.kind);e.subtitleTrack=o}r?.id===a&&r.cues&&Array.from(r.cues).forEach(o=>{r.addCue(o)})};i.textTracks.addEventListener("change",t),e.on(ge.Events.CUES_PARSED,(r,{track:n,cues:a})=>{let o=i.textTracks.getTrackById(n);if(!o)return;let l=o.mode==="disabled";l&&(o.mode="hidden"),a.forEach(d=>{var u;(u=o.cues)!=null&&u.getCueById(d.id)||o.addCue(d)}),l&&(o.mode="disabled")}),e.once(ge.Events.DESTROYING,()=>{i.textTracks.removeEventListener("change",t),i.querySelectorAll("track[data-removeondestroy]").forEach(r=>{r.remove()})});let s=()=>{Array.from(i.textTracks).forEach(r=>{var n,a;if(!["subtitles","caption"].includes(r.kind)&&(r.label==="thumbnails"||r.kind==="chapters")){if(!((n=r.cues)!=null&&n.length)){let o="track";r.kind&&(o+=`[kind="${r.kind}"]`),r.label&&(o+=`[label="${r.label}"]`);let l=i.querySelector(o),d=(a=l?.getAttribute("src"))!=null?a:"";l?.removeAttribute("src"),setTimeout(()=>{l?.setAttribute("src",d)},0)}r.mode!=="hidden"&&(r.mode="hidden")}})};e.once(ge.Events.MANIFEST_LOADED,s),e.once(ge.Events.MEDIA_ATTACHED,s)}function sm(i,e,t,s,r,n){let a=document.createElement("track");return a.kind=e,a.label=t,s&&(a.srclang=s),r&&(a.id=r),n&&(a.default=!0),a.track.mode=["subtitles","captions"].includes(e)?"disabled":"hidden",a.setAttribute("data-removeondestroy",""),i.append(a),a.track}function Xx(i,e){let t=Array.prototype.find.call(i.querySelectorAll("track"),s=>s.track===e);t?.remove()}function bo(i,e,t){var s;return(s=Array.from(i.querySelectorAll("track")).find(r=>r.track.label===e&&r.track.kind===t))==null?void 0:s.track}async function Ay(i,e,t,s){let r=bo(i,t,s);return r||(r=sm(i,s,t),r.mode="hidden",await new Promise(n=>setTimeout(()=>n(void 0),0))),r.mode!=="hidden"&&(r.mode="hidden"),[...e].sort((n,a)=>vc(a)-vc(n)).forEach(n=>{var a,o;let l=n.value,d=vc(n);if("endTime"in n&&n.endTime!=null)r?.addCue(new VTTCue(d,n.endTime,s==="chapters"?l:JSON.stringify(l??null)));else{let u=Array.prototype.findIndex.call(r?.cues,m=>m.startTime>=d),c=(a=r?.cues)==null?void 0:a[u],h=c?c.startTime:Number.isFinite(i.duration)?i.duration:Number.MAX_SAFE_INTEGER,f=(o=r?.cues)==null?void 0:o[u-1];f&&(f.endTime=d),r?.addCue(new VTTCue(d,h,s==="chapters"?l:JSON.stringify(l??null)))}}),i.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),r}var rm="cuepoints",Sy=Object.freeze({label:rm});async function Iy(i,e,t=Sy){return Ay(i,e,t.label,"metadata")}var nh=i=>({time:i.startTime,value:JSON.parse(i.text)});function Zx(i,e={label:rm}){let t=bo(i,e.label,"metadata");return t!=null&&t.cues?Array.from(t.cues,s=>nh(s)):[]}function Ly(i,e={label:rm}){var t,s;let r=bo(i,e.label,"metadata");if(!((t=r?.activeCues)!=null&&t.length))return;if(r.activeCues.length===1)return nh(r.activeCues[0]);let{currentTime:n}=i,a=Array.prototype.find.call((s=r.activeCues)!=null?s:[],({startTime:o,endTime:l})=>o<=n&&l>n);return nh(a||r.activeCues[0])}async function Jx(i,e=Sy){return new Promise(t=>{lt(i,"loadstart",async()=>{let s=await Iy(i,[],e);lt(i,"cuechange",()=>{let r=Ly(i);if(r){let n=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:r});i.dispatchEvent(n)}},{},s),t(s)})})}var nm="chapters",Ry=Object.freeze({label:nm}),ah=i=>({startTime:i.startTime,endTime:i.endTime,value:i.text});async function xy(i,e,t=Ry){return Ay(i,e,t.label,"chapters")}function ek(i,e={label:nm}){var t;let s=bo(i,e.label,"chapters");return(t=s?.cues)!=null&&t.length?Array.from(s.cues,r=>ah(r)):[]}function ky(i,e={label:nm}){var t,s;let r=bo(i,e.label,"chapters");if(!((t=r?.activeCues)!=null&&t.length))return;if(r.activeCues.length===1)return ah(r.activeCues[0]);let{currentTime:n}=i,a=Array.prototype.find.call((s=r.activeCues)!=null?s:[],({startTime:o,endTime:l})=>o<=n&&l>n);return ah(a||r.activeCues[0])}async function tk(i,e=Ry){return new Promise(t=>{lt(i,"loadstart",async()=>{let s=await xy(i,[],e);lt(i,"cuechange",()=>{let r=ky(i);if(r){let n=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:r});i.dispatchEvent(n)}},{},s),t(s)})})}function ik(i,e){if(e){let t=e.playingDate;if(t!=null)return new Date(t.getTime()-i.currentTime*1e3)}return typeof i.getStartDate=="function"?i.getStartDate():new Date(NaN)}function sk(i,e){if(e&&e.playingDate)return e.playingDate;if(typeof i.getStartDate=="function"){let t=i.getStartDate();return new Date(t.getTime()+i.currentTime*1e3)}return new Date(NaN)}var Ba={VIDEO:"v",THUMBNAIL:"t",STORYBOARD:"s",DRM:"d"},rk=i=>{if(i===Re.VIDEO)return Ba.VIDEO;if(i===Re.DRM)return Ba.DRM},nk=(i,e)=>{var t,s;let r=vu(i),n=`${r}Token`;return(t=e.tokens)!=null&&t[r]?(s=e.tokens)==null?void 0:s[r]:tm(n,e)?e[n]:void 0},Bd=(i,e,t,s,r=!1,n=!(a=>(a=globalThis.navigator)==null?void 0:a.onLine)())=>{var a,o;if(n){let v=ie("Your device appears to be offline",r),b,y=W.MEDIA_ERR_NETWORK,T=new W(v,y,!1,b);return T.errorCategory=e,T.muxCode=se.NETWORK_OFFLINE,T.data=i,T}let l="status"in i?i.status:i.code,d=Date.now(),u=W.MEDIA_ERR_NETWORK;if(l===200)return;let c=vu(e),h=nk(e,t),f=rk(e),[m]=im((a=t.playbackId)!=null?a:"");if(!l||!m)return;let p=kn(h);if(h&&!p){let v=ie("The {tokenNamePrefix}-token provided is invalid or malformed.",r).format({tokenNamePrefix:c}),b=ie("Compact JWT string: {token}",r).format({token:h}),y=new W(v,u,!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_MALFORMED,y.data=i,y}if(l>=500){let v=new W("",u,s??!0);return v.errorCategory=e,v.muxCode=se.NETWORK_UNKNOWN_ERROR,v}if(l===403)if(p){if(Hx(p,d)){let v={timeStyle:"medium",dateStyle:"medium"},b=ie("The video’s secured {tokenNamePrefix}-token has expired.",r).format({tokenNamePrefix:c}),y=ie("Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat("en",v).format((o=p.exp)!=null?o:0*1e3),currentDate:new Intl.DateTimeFormat("en",v).format(d)}),T=new W(b,u,!0,y);return T.errorCategory=e,T.muxCode=se.NETWORK_TOKEN_EXPIRED,T.data=i,T}if(Gx(p,m)){let v=ie("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",r).format({tokenNamePrefix:c}),b=ie("Specified playback ID: {playbackId} and the playback ID encoded in the {tokenNamePrefix}-token: {tokenPlaybackId}",r).format({tokenNamePrefix:c,playbackId:m,tokenPlaybackId:p.sub}),y=new W(v,u,!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_SUB_MISMATCH,y.data=i,y}if(Kx(p)){let v=ie("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:c}),b=ie("The {tokenNamePrefix}-token has no aud value. aud value should be {expectedAud}.",r).format({tokenNamePrefix:c,expectedAud:f}),y=new W(v,u,!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_AUD_MISSING,y.data=i,y}if(Vx(p,f)){let v=ie("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:c}),b=ie("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.",r).format({tokenNamePrefix:c,expectedAud:f,aud:p.aud}),y=new W(v,u,!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_AUD_MISMATCH,y.data=i,y}}else{let v=ie("Authorization error trying to access this {category} URL. If this is a signed URL, you might need to provide a {tokenNamePrefix}-token.",r).format({tokenNamePrefix:c,category:e}),b=ie("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new W(v,u,s??!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_MISSING,y.data=i,y}if(l===412){let v=ie("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),b=ie("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new W(v,u,s??!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_NOT_READY,y.streamType=t.streamType===Se.LIVE?"live":t.streamType===Se.ON_DEMAND?"on-demand":"unknown",y.data=i,y}if(l===404){let v=ie("This URL or playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),b=ie("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new W(v,u,s??!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_NOT_FOUND,y.data=i,y}if(l===400){let v=ie("The URL or playback-id was invalid. You may have used an invalid value as a playback-id."),b=ie("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new W(v,u,s??!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_INVALID_URL,y.data=i,y}let g=new W("",u,s??!0);return g.errorCategory=e,g.muxCode=se.NETWORK_UNKNOWN_ERROR,g.data=i,g},Yg=ge.DefaultConfig.capLevelController,ak={"720p":921600,"1080p":2073600,"1440p":4194304,"2160p":8294400};function ok(i){let e=i.toLowerCase().trim();return ak[e]}var oh=class ma extends Yg{constructor(e){super(e)}static setMaxAutoResolution(e,t){t?ma.maxAutoResolution.set(e,t):ma.maxAutoResolution.delete(e)}getMaxAutoResolution(){var e;let t=this.hls;return(e=ma.maxAutoResolution.get(t))!=null?e:void 0}get levels(){var e;return(e=this.hls.levels)!=null?e:[]}getValidLevels(e){return this.levels.filter((t,s)=>this.isLevelAllowed(t)&&s<=e)}getMaxLevelCapped(e){let t=this.getValidLevels(e),s=this.getMaxAutoResolution();if(!s)return super.getMaxLevel(e);let r=ok(s);if(!r)return super.getMaxLevel(e);let n=t.filter(l=>l.width*l.height<=r),a=n.findIndex(l=>l.width*l.height===r);if(a!==-1){let l=n[a];return t.findIndex(d=>d===l)}if(n.length===0)return 0;let o=n[n.length-1];return t.findIndex(l=>l===o)}getMaxLevel(e){if(this.getMaxAutoResolution()!==void 0)return this.getMaxLevelCapped(e);let t=super.getMaxLevel(e),s=this.getValidLevels(e);if(!s[t])return t;let r=Math.min(s[t].width,s[t].height),n=ma.minMaxResolution;return r>=n?t:Yg.getMaxLevelByMediaSize(s,n*(16/9),n)}};oh.minMaxResolution=720,oh.maxAutoResolution=new WeakMap;var lk=oh,lh=lk,dk="com.apple.fps.1_0",uk="application/vnd.apple.mpegurl",ck=({mediaEl:i,getAppCertificate:e,getLicenseKey:t,saveAndDispatchError:s,drmTypeCb:r})=>{if(!window.WebKitMediaKeys||!("onwebkitneedkey"in i)){console.error("No WebKitMediaKeys. FairPlay may not be supported");let h=ie("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),f=new W(h,W.MEDIA_ERR_ENCRYPTED,!0);return f.errorCategory=Re.DRM,f.muxCode=se.ENCRYPTED_CDM_ERROR,s(i,f),()=>{}}let n=i,a=e(),o=null,l=h=>{(async()=>{try{n.webkitKeys||d();let f=await a;if(h.initData===null||f==null)return;let m=hk(h.initData,f);u(m)}catch(f){console.error("Could not start encrypted playback due to exception",f),s(n,f)}})()},d=()=>{try{let h=new WebKitMediaKeys(dk);n.webkitSetMediaKeys(h),r()}catch{let h="Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.",f=new W(h,W.MEDIA_ERR_ENCRYPTED,!0);throw f.errorCategory=Re.DRM,f.muxCode=se.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM,f}},u=h=>{let f=n.webkitKeys.createSession(uk,h),m=async v=>{try{let b=v.message,y=await t(b);f.update(y)}catch(b){console.error("Error on FairPlay session message",b),s(i,b)}},p=v=>{let b=v.target.error;if(!b)return;console.error(`Internal Webkit Key Session Error - sysCode: ${b.systemCode} code: ${b.code}`);let y=ie("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser."),T=new W(y,W.MEDIA_ERR_ENCRYPTED,!0);T.errorCategory=Re.DRM,T.muxCode=se.ENCRYPTED_CDM_ERROR,s(i,T)},g=()=>{f.removeEventListener("webkitkeymessage",m),f.removeEventListener("webkitkeyerror",p),i.removeEventListener("teardown",g),"webkitCurrentPlaybackTargetIsWireless"in i&&i.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",g),o=null;try{f.close()}catch{}};"webkitCurrentPlaybackTargetIsWireless"in i&&i.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",g,{once:!0}),f.addEventListener("webkitkeymessage",m),f.addEventListener("webkitkeyerror",p),i.addEventListener("teardown",g),o=g},c=()=>{i.removeEventListener("webkitneedkey",l),i.removeEventListener("teardown",c),o?.();try{n.webkitSetMediaKeys(null)}catch{}};return i.addEventListener("webkitneedkey",l),i.addEventListener("teardown",c,{once:!0}),c},hk=(i,e)=>{let t=mk(fk(i)),s=new Uint8Array(i),r=new Uint8Array(t),n=new Uint8Array(e),a=s.byteLength+4+n.byteLength+4+r.byteLength,o=new Uint8Array(a),l=0,d=c=>{o.set(c,l),l+=c.byteLength},u=c=>{let h=new DataView(o.buffer),f=c.byteLength;h.setUint32(l,f,!0),l+=4,d(c)};return d(s),u(r),u(n),o},fk=i=>new TextDecoder("utf-16le").decode(i).replace("skd://","").slice(1);function mk(i){let e=new ArrayBuffer(i.length*2),t=new DataView(e);for(let s=0;s{let a=null,o=async c=>{try{let h=c.initDataType;if(h!=="skd"){console.error(`Received unexpected initialization data type "${h}"`);return}i.mediaKeys||await l(h);let f=c.initData;if(f==null){console.error(`Could not start encrypted playback due to missing initData in ${c.type} event`);return}await d(h,f)}catch(h){s(i,h);return}},l=async c=>{let h=await navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:[c],videoCapabilities:[{contentType:"application/vnd.apple.mpegurl",robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:"not-allowed",sessionTypes:["temporary"]}]).then(m=>(r(),m)).catch(()=>{let m=ie("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),p=new W(m,W.MEDIA_ERR_ENCRYPTED,!0);p.errorCategory=Re.DRM,p.muxCode=se.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM,s(i,p)});if(!h)return;let f=await h.createMediaKeys();try{let m=await e();await f.setServerCertificate(m).catch(()=>{let p=ie("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),g=new W(p,W.MEDIA_ERR_ENCRYPTED,!0);return g.errorCategory=Re.DRM,g.muxCode=se.ENCRYPTED_UPDATE_SERVER_CERT_FAILED,Promise.reject(g)})}catch(m){s(i,m);return}await i.setMediaKeys(f)},d=async(c,h)=>{let f=i.mediaKeys.createSession(),m=async v=>{let b=v.message,y=await t(b);try{await f.update(y)}catch{let T=ie("Failed to update DRM license. This may be an issue with the player or your protected content."),A=new W(T,W.MEDIA_ERR_ENCRYPTED,!0);A.errorCategory=Re.DRM,A.muxCode=se.ENCRYPTED_UPDATE_LICENSE_FAILED,s(i,A)}},p=()=>{let v=b=>{let y;if(b==="internal-error"){let T=ie("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");y=new W(T,W.MEDIA_ERR_ENCRYPTED,!0),y.errorCategory=Re.DRM,y.muxCode=se.ENCRYPTED_CDM_ERROR}else if(b==="output-restricted"||b==="output-downscaled"){let T=ie("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");y=new W(T,W.MEDIA_ERR_ENCRYPTED,!1),y.errorCategory=Re.DRM,y.muxCode=se.ENCRYPTED_OUTPUT_RESTRICTED}y&&s(i,y)};f.keyStatuses.forEach(b=>v(b))};f.addEventListener("keystatuseschange",p),f.addEventListener("message",m);let g=async()=>{f.removeEventListener("keystatuseschange",p),f.removeEventListener("message",m),"webkitCurrentPlaybackTargetIsWireless"in i&&i.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",g),i.removeEventListener("teardown",g),await f.close().catch(v=>{console.warn("There was an error when closing EME session",v)}),a=null};"webkitCurrentPlaybackTargetIsWireless"in i&&i.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",g,{once:!0}),i.addEventListener("teardown",g,{once:!0}),a=g,await f.generateRequest(c,h).catch(async v=>{if(v.name==="NotSupportedError"&&"webkitCurrentPlaybackTargetIsWireless"in i&&i.webkitCurrentPlaybackTargetIsWireless)console.warn("Failed to generate a DRM license request. Attempting to fallback to Webkit DRM"),n?.();else{let b=ie("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),y=new W(b,W.MEDIA_ERR_ENCRYPTED,!0);return y.errorCategory=Re.DRM,y.muxCode=se.ENCRYPTED_GENERATE_REQUEST_FAILED,console.error("Failed to generate license request",v),Promise.reject(y)}})},u=async()=>{i.removeEventListener("encrypted",o),i.removeEventListener("teardown",u),a&&await a(),await i.setMediaKeys(null).catch(()=>{})};return i.addEventListener("encrypted",o),i.addEventListener("teardown",u,{once:!0}),u},gl={FAIRPLAY:"fairplay",PLAYREADY:"playready",WIDEVINE:"widevine"},gk=i=>{if(i.includes("fps"))return gl.FAIRPLAY;if(i.includes("playready"))return gl.PLAYREADY;if(i.includes("widevine"))return gl.WIDEVINE},vk=i=>{let e=i.split(` +`).find((t,s,r)=>s&&r[s-1].startsWith("#EXT-X-STREAM-INF"));return fetch(e).then(t=>t.status!==200?Promise.reject(t):t.text())},Ek=i=>{let e=i.split(` +`).filter(s=>s.startsWith("#EXT-X-SESSION-DATA"));if(!e.length)return{};let t={};for(let s of e){let r=bk(s),n=r["DATA-ID"];n&&(t[n]={...r})}return{sessionData:t}},yk=/([A-Z0-9-]+)="?(.*?)"?(?:,|$)/g;function bk(i){let e=[...i.matchAll(yk)];return Object.fromEntries(e.map(([,t,s])=>[t,s]))}var Tk=i=>{var e,t,s;let r=i.split(` +`),n=(t=((e=r.find(d=>d.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?e:"").split(":")[1])==null?void 0:t.trim(),a=by(n),o=Ty(n),l;if(a===Se.LIVE){let d=r.find(u=>u.startsWith("#EXT-X-PART-INF"));if(d)l=+d.split(":")[1].split("=")[1]*2;else{let u=r.find(h=>h.startsWith("#EXT-X-TARGETDURATION")),c=(s=u?.split(":"))==null?void 0:s[1];l=+(c??6)*3}}return{streamType:a,targetLiveWindow:o,liveEdgeStartOffset:l}},_k=async(i,e)=>{if(e===cs.MP4)return{streamType:Se.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0,sessionData:void 0};if(e===cs.M3U8){let t=await fetch(i);if(!t.ok)return Promise.reject(t);let s=await t.text(),r=await vk(s);return{...Ek(s),...Tk(r)}}return console.error(`Media type ${e} is an unrecognized or unsupported type for src ${i}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0,sessionData:void 0}},Ak=async(i,e,t=Eu({src:i}))=>{var s,r,n,a;let{streamType:o,targetLiveWindow:l,liveEdgeStartOffset:d,sessionData:u}=await _k(i,t),c=u?.["com.apple.hls.chapters"];(c!=null&&c.URI||c!=null&&c.VALUE.toLocaleLowerCase().startsWith("http"))&&am((s=c.URI)!=null?s:c.VALUE,e),((r=Fe.get(e))!=null?r:{}).liveEdgeStartOffset=d,((n=Fe.get(e))!=null?n:{}).targetLiveWindow=l,e.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((a=Fe.get(e))!=null?a:{}).streamType=o,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},am=async(i,e)=>{var t,s;try{let r=await fetch(i);if(!r.ok)throw new Error(`Failed to fetch Mux metadata: ${r.status} ${r.statusText}`);let n=await r.json(),a={};if(!((t=n?.[0])!=null&&t.metadata))return;for(let l of n[0].metadata)l.key&&l.value&&(a[l.key]=l.value);((s=Fe.get(e))!=null?s:{}).metadata=a;let o=new CustomEvent("muxmetadata");e.dispatchEvent(o)}catch(r){console.error(r)}},Sk=i=>{var e;let t=i.type,s=by(t),r=Ty(t),n,a=!!((e=i.partList)!=null&&e.length);return s===Se.LIVE&&(n=a?i.partTarget*2:i.targetduration*3),{streamType:s,targetLiveWindow:r,liveEdgeStartOffset:n,lowLatency:a}},Ik=(i,e,t)=>{var s,r,n,a,o,l,d,u;let{streamType:c,targetLiveWindow:h,liveEdgeStartOffset:f,lowLatency:m}=Sk(i);if(c===Se.LIVE){m?(t.config.backBufferLength=(s=t.userConfig.backBufferLength)!=null?s:4,t.config.maxFragLookUpTolerance=(r=t.userConfig.maxFragLookUpTolerance)!=null?r:.001,t.config.abrBandWidthUpFactor=(n=t.userConfig.abrBandWidthUpFactor)!=null?n:t.config.abrBandWidthFactor):t.config.backBufferLength=(a=t.userConfig.backBufferLength)!=null?a:8;let p=Object.freeze({get length(){return e.seekable.length},start(g){return e.seekable.start(g)},end(g){var v;return g>this.length||g<0||Number.isFinite(e.duration)?e.seekable.end(g):(v=t.liveSyncPosition)!=null?v:e.seekable.end(g)}});((o=Fe.get(e))!=null?o:{}).seekable=p}((l=Fe.get(e))!=null?l:{}).liveEdgeStartOffset=f,((d=Fe.get(e))!=null?d:{}).targetLiveWindow=h,e.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((u=Fe.get(e))!=null?u:{}).streamType=c,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},jg,zg,Dy=(zg=(jg=globalThis?.navigator)==null?void 0:jg.userAgent)!=null?zg:"",Qg,Xg,Zg,Lk=(Zg=(Xg=(Qg=globalThis?.navigator)==null?void 0:Qg.userAgentData)==null?void 0:Xg.platform)!=null?Zg:"",Rk=Dy.toLowerCase().includes("android")||["x11","android"].some(i=>Lk.toLowerCase().includes(i)),xk=i=>/^((?!chrome|android).)*safari/i.test(Dy)&&!!i.canPlayType("application/vnd.apple.mpegurl"),Fe=new WeakMap,hs="mux.com",Jg,e0,Cy=(e0=(Jg=ge).isSupported)==null?void 0:e0.call(Jg),kk=i=>Rk||!xk(i),om=()=>{if(typeof window<"u")return Cf.utils.now()},Dk=Cf.utils.generateUUID,dh=({playbackId:i,customDomain:e=hs,maxResolution:t,minResolution:s,renditionOrder:r,programStartTime:n,programEndTime:a,assetStartTime:o,assetEndTime:l,playbackToken:d,tokens:{playback:u=d}={},extraSourceParams:c={}}={})=>{if(!i)return;let[h,f=""]=im(i),m=new URL(`https://stream.${e}/${h}.m3u8${f}`);return u||m.searchParams.has("token")?(m.searchParams.forEach((p,g)=>{g!="token"&&m.searchParams.delete(g)}),u&&m.searchParams.set("token",u)):(t&&m.searchParams.set("max_resolution",t),s&&(m.searchParams.set("min_resolution",s),t&&+t.slice(0,-1)<+s.slice(0,-1)&&console.error("minResolution must be <= maxResolution","minResolution",s,"maxResolution",t)),r&&m.searchParams.set("rendition_order",r),n&&m.searchParams.set("program_start_time",`${n}`),a&&m.searchParams.set("program_end_time",`${a}`),o&&m.searchParams.set("asset_start_time",`${o}`),l&&m.searchParams.set("asset_end_time",`${l}`),Object.entries(c).forEach(([p,g])=>{g!=null&&m.searchParams.set(p,g)})),m.toString()},yu=i=>{if(!i)return;let[e]=i.split("?");return e||void 0},lm=i=>{if(!i||!i.startsWith("https://stream."))return;let[e]=new URL(i).pathname.slice(1).split(/\.m3u8|\//);return e||void 0},Ck=i=>{var e,t,s;return(e=i?.metadata)!=null&&e.video_id?i.metadata.video_id:By(i)&&(s=(t=yu(i.playbackId))!=null?t:lm(i.src))!=null?s:i.src},wy=i=>{var e;return(e=Fe.get(i))==null?void 0:e.error},wk=i=>{var e;return(e=Fe.get(i))==null?void 0:e.metadata},uh=i=>{var e,t;return(t=(e=Fe.get(i))==null?void 0:e.streamType)!=null?t:Se.UNKNOWN},Mk=i=>{var e,t;return(t=(e=Fe.get(i))==null?void 0:e.targetLiveWindow)!=null?t:Number.NaN},dm=i=>{var e,t;return(t=(e=Fe.get(i))==null?void 0:e.seekable)!=null?t:i.seekable},Pk=i=>{var e;let t=(e=Fe.get(i))==null?void 0:e.liveEdgeStartOffset;if(typeof t!="number")return Number.NaN;let s=dm(i);return s.length?s.end(s.length-1)-t:Number.NaN},Ok=i=>{var e;return(e=Fe.get(i))==null?void 0:e.coreReference},um=.034,Nk=(i,e,t=um)=>Math.abs(i-e)<=t,My=(i,e,t=um)=>i>e||Nk(i,e,t),Uk=(i,e=um)=>i.paused&&My(i.currentTime,i.duration,e),Py=(i,e)=>{var t,s,r;if(!e||!i.buffered.length)return;if(i.readyState>2)return!1;let n=e.currentLevel>=0?(s=(t=e.levels)==null?void 0:t[e.currentLevel])==null?void 0:s.details:(r=e.levels.find(c=>!!c.details))==null?void 0:r.details;if(!n||n.live)return;let{fragments:a}=n;if(!(a!=null&&a.length))return;if(i.currentTimed&&li.ended||i.loop?i.ended:e&&Py(i,e)?!0:Uk(i),Ny=(i,e,t)=>{Uy(e,t,i);let{metadata:s={}}=i,{view_session_id:r=Dk()}=s,n=Ck(i);s.view_session_id=r,s.video_id=n,i.metadata=s;let a=h=>{var f;(f=e.mux)==null||f.emit("hb",{view_drm_type:h})};i.drmTypeCb=a,i.fallbackToWebkitFairplay=async()=>{var h;let f=!e.paused,m=e.currentTime;i.useWebkitFairplay=!0;let p=i.muxDataKeepSession;i.muxDataKeepSession=!0;let g=(h=Fe.get(e))==null?void 0:h.coreReference;Ny(i,e,g),i.muxDataKeepSession=p,i.useWebkitFairplay=!1,f&&await e.play().then(()=>{e.currentTime=m}).catch(()=>{}),e.currentTime=m},Fe.set(e,{retryCount:0});let o=$k(i,e),l=jx(i,e,o);i!=null&&i.muxDataKeepSession&&e!=null&&e.mux&&!e.mux.deleted?o&&e.mux.addHLSJS({hlsjs:o,Hls:o?ge:void 0}):Wk(i,e,o),qk(i,e,o),Jx(e),tk(e);let d=Yx(i,e,o),u={engine:o,setAutoplay:d,setPreload:l},c=Fe.get(e);return c&&(c.coreReference=u),u},Uy=(i,e,t)=>{let s=e?.engine;i!=null&&i.mux&&!i.mux.deleted&&(t!=null&&t.muxDataKeepSession?s&&i.mux.removeHLSJS():(i.mux.destroy(),delete i.mux)),s&&(s.detachMedia(),s.destroy()),i&&(i.hasAttribute("src")&&(i.removeAttribute("src"),i.load()),i.removeEventListener("error",Gy),i.removeEventListener("error",ch),i.removeEventListener("durationchange",Hy),Fe.delete(i),i.dispatchEvent(new Event("teardown")))};function $y(i,e){var t;let s=Eu(i);if(s!==cs.M3U8)return!0;let r=!s||((t=e.canPlayType(s))!=null?t:!0),{preferPlayback:n}=i,a=n===qi.MSE,o=n===qi.NATIVE,l=Cy&&(a||kk(e));return r&&(o||!l)}var $k=(i,e)=>{let{debug:t,streamType:s,startTime:r=-1,metadata:n,preferCmcd:a,_hlsConfig:o={},maxAutoResolution:l}=i,d=Eu(i)===cs.M3U8,u=$y(i,e);if(d&&!u&&Cy){let c={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelOnFPSDrop:!0},h=Fk(s),f=Bk(i),m=[fa.QUERY,fa.HEADER].includes(a)?{useHeaders:a===fa.HEADER,sessionId:n?.view_session_id,contentId:n?.video_id}:void 0,p=Vk(i),g=new ge({debug:t,startPosition:r,cmcd:m,xhrSetup:(v,b)=>{var y,T;if(a&&a!==fa.QUERY)return;let A=new URL(b);if(!A.searchParams.has("CMCD"))return;let L=((T=(y=A.searchParams.get("CMCD"))==null?void 0:y.split(","))!=null?T:[]).filter(S=>S.startsWith("sid")||S.startsWith("cid")).join(",");A.searchParams.set("CMCD",L),v.open("GET",A)},...c,...p,...h,...f,...o});return p.capLevelController===lh&&l!==void 0&&lh.setMaxAutoResolution(g,l),g.on(ge.Events.MANIFEST_PARSED,async function(v,b){var y,T;let A=(y=b.sessionData)==null?void 0:y["com.apple.hls.chapters"];(A!=null&&A.URI||A!=null&&A.VALUE.toLocaleLowerCase().startsWith("http"))&&am((T=A?.URI)!=null?T:A?.VALUE,e)}),g}},Fk=i=>i===Se.LIVE?{backBufferLength:8}:{},Bk=i=>{let{tokens:{drm:e}={},playbackId:t,drmTypeCb:s}=i,r=yu(t);return!e||!r?{}:{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:vl(i,"fairplay"),serverCertificateUrl:Fy(i,"fairplay")},"com.widevine.alpha":{licenseUrl:vl(i,"widevine")},"com.microsoft.playready":{licenseUrl:vl(i,"playready")}},requestMediaKeySystemAccessFunc:(n,a)=>(n==="com.widevine.alpha"&&(a=[...a.map(o=>{var l;let d=(l=o.videoCapabilities)==null?void 0:l.map(u=>({...u,robustness:"HW_SECURE_ALL"}));return{...o,videoCapabilities:d}}),...a]),navigator.requestMediaKeySystemAccess(n,a).then(o=>{let l=gk(n);return s?.(l),o}))}},Hk=async i=>{let e=await fetch(i);return e.status!==200?Promise.reject(e):await e.arrayBuffer()},Gk=async(i,e)=>{let t=await fetch(e,{method:"POST",headers:{"Content-type":"application/octet-stream"},body:i});if(t.status!==200)return Promise.reject(t);let s=await t.arrayBuffer();return new Uint8Array(s)},Kk=(i,e)=>{let t={mediaEl:e,getAppCertificate:()=>Hk(Fy(i,"fairplay")).catch(s=>{if(s instanceof Response){let r=Bd(s,Re.DRM,i);return console.error("mediaError",r?.message,r?.context),r?Promise.reject(r):Promise.reject(new Error("Unexpected error in app cert request"))}return Promise.reject(s)}),getLicenseKey:s=>Gk(s,vl(i,"fairplay")).catch(r=>{if(r instanceof Response){let n=Bd(r,Re.DRM,i);return console.error("mediaError",n?.message,n?.context),n?Promise.reject(n):Promise.reject(new Error("Unexpected error in license key request"))}return Promise.reject(r)}),saveAndDispatchError:Ns,drmTypeCb:()=>{var s;(s=i.drmTypeCb)==null||s.call(i,gl.FAIRPLAY)}};if(i.useWebkitFairplay)ck(t);else{let s={fallbackToWebkitFairplay:async()=>{var n;await r(),(n=i.fallbackToWebkitFairplay)==null||n.call(i)},...t},r=pk(s)}},vl=({playbackId:i,tokens:{drm:e}={},customDomain:t=hs},s)=>{let r=yu(i);return`https://license.${t.toLocaleLowerCase().endsWith(hs)?t:hs}/license/${s}/${r}?token=${e}`},Fy=({playbackId:i,tokens:{drm:e}={},customDomain:t=hs},s)=>{let r=yu(i);return`https://license.${t.toLocaleLowerCase().endsWith(hs)?t:hs}/appcert/${s}/${r}?token=${e}`},By=({playbackId:i,src:e,customDomain:t})=>{if(i)return!0;if(typeof e!="string")return!1;let s=window?.location.href,r=new URL(e,s).hostname.toLocaleLowerCase();return r.includes(hs)||!!t&&r.includes(t.toLocaleLowerCase())},Vk=(i,e)=>{let t={};return t.capLevelToPlayerSize=i.capRenditionToPlayerSize,t.capLevelToPlayerSize==null?(t.capLevelController=lh,t.capLevelToPlayerSize=!0):t.capLevelController=pu,t},Wk=(i,e,t)=>{var s;let{envKey:r,disableTracking:n,muxDataSDK:a=Cf,muxDataSDKOptions:o={}}=i,l=By(i);if(!n&&(r||l)){let{playerInitTime:d,playerSoftwareName:u,playerSoftwareVersion:c,beaconCollectionDomain:h,debug:f,disableCookies:m}=i,p={...i.metadata,video_title:((s=i?.metadata)==null?void 0:s.video_title)||void 0},g=v=>typeof v.player_error_code=="string"?!1:typeof i.errorTranslator=="function"?i.errorTranslator(v):v;a.monitor(e,{debug:f,beaconCollectionDomain:h,hlsjs:t,Hls:t?ge:void 0,automaticErrorTracking:!1,errorTranslator:g,disableCookies:m,...o,data:{...r?{env_key:r}:{},player_software_name:u,player_software:u,player_software_version:c,player_init_time:d,...p}})}},qk=(i,e,t)=>{var s,r;let n=$y(i,e),{src:a,customDomain:o=hs}=i,l=()=>{e.ended||i.disablePseudoEnded||!Oy(e,t)||(Py(e,t)?e.currentTime=e.buffered.end(e.buffered.length-1):e.dispatchEvent(new Event("ended")))},d,u,c=()=>{let h=dm(e),f,m;h.length>0&&(f=h.start(0),m=h.end(0)),(u!==m||d!==f)&&e.dispatchEvent(new CustomEvent("seekablechange",{composed:!0})),d=f,u=m};if(lt(e,"durationchange",c),e&&n){let h=Eu(i);if(typeof a=="string"){if(a.endsWith(".mp4")&&a.includes(o)){let p=lm(a),g=new URL(`https://stream.${o}/${p}/metadata.json`);am(g.toString(),e)}let f=()=>{if(uh(e)!==Se.LIVE||Number.isFinite(e.duration))return;let p=setInterval(c,1e3);e.addEventListener("teardown",()=>{clearInterval(p)},{once:!0}),lt(e,"durationchange",()=>{Number.isFinite(e.duration)&&clearInterval(p)})},m=async()=>Ak(a,e,h).then(f).catch(p=>{if(p instanceof Response){let g=Bd(p,Re.VIDEO,i);if(g){Ns(e,g);return}}});if(e.preload==="none"){let p=()=>{m(),e.removeEventListener("loadedmetadata",g)},g=()=>{m(),e.removeEventListener("play",p)};lt(e,"play",p,{once:!0}),lt(e,"loadedmetadata",g,{once:!0})}else m();(s=i.tokens)!=null&&s.drm?Kk(i,e):lt(e,"encrypted",()=>{let p=ie("Attempting to play DRM-protected content without providing a DRM token."),g=new W(p,W.MEDIA_ERR_ENCRYPTED,!0);g.errorCategory=Re.DRM,g.muxCode=se.ENCRYPTED_MISSING_TOKEN,Ns(e,g)},{once:!0}),e.setAttribute("src",a),i.startTime&&(((r=Fe.get(e))!=null?r:{}).startTime=i.startTime,e.addEventListener("durationchange",Hy,{once:!0}))}else e.removeAttribute("src");e.addEventListener("error",Gy),e.addEventListener("error",ch),e.addEventListener("emptied",()=>{e.querySelectorAll("track[data-removeondestroy]").forEach(f=>{f.remove()})},{once:!0}),lt(e,"pause",l),lt(e,"seeked",l),lt(e,"play",()=>{e.ended||My(e.currentTime,e.duration)&&(e.currentTime=e.seekable.length?e.seekable.start(0):0)})}else t&&a?(t.once(ge.Events.LEVEL_LOADED,(h,f)=>{Ik(f.details,e,t),c(),uh(e)===Se.LIVE&&!Number.isFinite(e.duration)&&(t.on(ge.Events.LEVEL_UPDATED,c),lt(e,"durationchange",()=>{Number.isFinite(e.duration)&&t.off(ge.Events.LEVELS_UPDATED,c)}))}),t.on(ge.Events.ERROR,(h,f)=>{var m,p;let g=Yk(f,i);if(g.muxCode===se.NETWORK_NOT_READY){let v=(m=Fe.get(e))!=null?m:{},b=(p=v.retryCount)!=null?p:0;if(b<6){let y=b===0?5e3:6e4,T=new W(`Retrying in ${y/1e3} seconds...`,g.code,g.fatal);Object.assign(T,g),Ns(e,T),setTimeout(()=>{v.retryCount=b+1,f.details==="manifestLoadError"&&f.url&&t.loadSource(f.url)},y);return}else{v.retryCount=0;let y=new W('Try again later or click here to retry',g.code,g.fatal);Object.assign(y,g),Ns(e,y);return}}Ns(e,g)}),t.on(ge.Events.MANIFEST_LOADED,()=>{let h=Fe.get(e);h&&h.error&&(h.error=null,h.retryCount=0,e.dispatchEvent(new Event("emptied")),e.dispatchEvent(new Event("loadstart")))}),e.addEventListener("error",ch),lt(e,"waiting",l),zx(i,t),Qx(e,t),t.attachMedia(e)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function Hy(i){var e;let t=i.target,s=(e=Fe.get(t))==null?void 0:e.startTime;if(s&&Ux(t.seekable,t.duration,s)){let r=t.preload==="auto";r&&(t.preload="none"),t.currentTime=s,r&&(t.preload="auto")}}async function Gy(i){if(!i.isTrusted)return;i.stopImmediatePropagation();let e=i.target;if(!(e!=null&&e.error))return;let{message:t,code:s}=e.error,r=new W(t,s);if(e.src&&s===W.MEDIA_ERR_SRC_NOT_SUPPORTED&&e.readyState===HTMLMediaElement.HAVE_NOTHING){setTimeout(()=>{var n;let a=(n=wy(e))!=null?n:e.error;a?.code===W.MEDIA_ERR_SRC_NOT_SUPPORTED&&Ns(e,r)},500);return}if(e.src&&(s!==W.MEDIA_ERR_DECODE||s!==void 0))try{let{status:n}=await fetch(e.src);r.data={response:{code:n}}}catch{}Ns(e,r)}function Ns(i,e){var t;e.fatal&&(((t=Fe.get(i))!=null?t:{}).error=e,i.dispatchEvent(new CustomEvent("error",{detail:e})))}function ch(i){var e,t;if(!(i instanceof CustomEvent)||!(i.detail instanceof W))return;let s=i.target,r=i.detail;!r||!r.fatal||(((e=Fe.get(s))!=null?e:{}).error=r,(t=s.mux)==null||t.emit("error",{player_error_code:r.code,player_error_message:r.message,player_error_context:r.context}))}var Yk=(i,e)=>{var t,s,r;i.fatal?console.error("getErrorFromHlsErrorData()",i):e.debug&&console.warn("getErrorFromHlsErrorData() (non-fatal)",i);let n={[ge.ErrorTypes.NETWORK_ERROR]:W.MEDIA_ERR_NETWORK,[ge.ErrorTypes.MEDIA_ERROR]:W.MEDIA_ERR_DECODE,[ge.ErrorTypes.KEY_SYSTEM_ERROR]:W.MEDIA_ERR_ENCRYPTED},a=u=>[ge.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,ge.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED].includes(u.details)?W.MEDIA_ERR_NETWORK:n[u.type],o=u=>{if(u.type===ge.ErrorTypes.KEY_SYSTEM_ERROR)return Re.DRM;if(u.type===ge.ErrorTypes.NETWORK_ERROR)return Re.VIDEO},l,d=a(i);if(d===W.MEDIA_ERR_NETWORK&&i.response){let u=(t=o(i))!=null?t:Re.VIDEO;l=(s=Bd(i.response,u,e,i.fatal))!=null?s:new W("",d,i.fatal)}else if(d===W.MEDIA_ERR_ENCRYPTED)if(i.details===ge.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE){let u=ie("Attempting to play DRM-protected content without providing a DRM token.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_MISSING_TOKEN}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_NO_ACCESS){let u=ie("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_NO_SESSION){let u=ie("Failed to generate a DRM license request. This may be an issue with the player or your protected content.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,!0),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_GENERATE_REQUEST_FAILED}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED){let u=ie("Failed to update DRM license. This may be an issue with the player or your protected content.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_UPDATE_LICENSE_FAILED}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED){let u=ie("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_UPDATE_SERVER_CERT_FAILED}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR){let u=ie("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_CDM_ERROR}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED){let u=ie("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,!1),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_OUTPUT_RESTRICTED}else l=new W(i.error.message,W.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_ERROR;else l=new W("",d,i.fatal);return l.context||(l.context=`${i.url?`url: ${i.url} +`:""}${i.response&&(i.response.code||i.response.text)?`response: ${i.response.code}, ${i.response.text} +`:""}${i.reason?`failure reason: ${i.reason} +`:""}${i.level?`level: ${i.level} +`:""}${i.parent?`parent stream controller: ${i.parent} +`:""}${i.buffer?`buffer length: ${i.buffer} +`:""}${i.error?`error: ${i.error} +`:""}${i.event?`event: ${i.event} +`:""}${i.err?`error message: ${(r=i.err)==null?void 0:r.message} +`:""}`),l.data=i,l};const jk=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],Ky=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function zk(i){return` + + + + + + `}function Qk(i){return` + + + + + + `}function Vy(i,{tag:e,is:t}){const s=globalThis.document?.createElement?.(e,{is:t}),r=s?Xk(s):[];return class hh extends i{static getTemplateHTML=e.endsWith("audio")?zk:Qk;static shadowRootOptions={mode:"open"};static Events=jk;static#e=!1;static get observedAttributes(){return hh.#s(),[...s?.constructor?.observedAttributes??[],...Ky]}static#s(){if(this.#e)return;this.#e=!0;const a=new Set(this.observedAttributes);a.delete("muted");for(const o of r)if(!(o in this.prototype))if(typeof s[o]=="function")this.prototype[o]=function(...l){return this.#n(),this.call?this.call(o,...l):this.nativeEl?.[o]?.apply(this.nativeEl,l)};else{const l={get(){this.#n();const d=o.toLowerCase();if(a.has(d)){const u=this.getAttribute(d);return u===null?!1:u===""?!0:u}return this.get?.(o)??this.nativeEl?.[o]}};o!==o.toUpperCase()&&(l.set=function(d){this.#n();const u=o.toLowerCase();if(a.has(u)){d===!0||d===!1||d==null?this.toggleAttribute(u,!!d):this.setAttribute(u,d);return}if(this.set){this.set(o,d);return}this.nativeEl&&(this.nativeEl[o]=d)}),Object.defineProperty(this.prototype,o,l)}}#i=!1;#r=null;#t=new Map;#a;get;set;call;get nativeEl(){return this.#n(),this.#r??this.querySelector(":scope > [slot=media]")??this.querySelector(e)??this.shadowRoot?.querySelector(e)??null}set nativeEl(a){this.#r=a}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(a){this.toggleAttribute("muted",a)}get src(){return this.getAttribute("src")}set src(a){this.setAttribute("src",`${a}`)}get preload(){return this.getAttribute("preload")??this.nativeEl?.preload}set preload(a){this.setAttribute("preload",`${a}`)}#n(){this.#i||(this.#i=!0,this.init())}init(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const a=Zk(this.attributes);t&&(a.is=t),e&&(a.part=e),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(a)}this.nativeEl.muted=this.hasAttribute("muted");for(const a of r)this.#c(a);this.#a=new MutationObserver(this.#o.bind(this)),this.shadowRoot.addEventListener("slotchange",()=>this.#l()),this.#l();for(const a of this.constructor.Events)this.shadowRoot.addEventListener(a,this,!0)}handleEvent(a){a.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(a.type,{detail:a.detail}))}#l(){const a=new Map(this.#t);(this.shadowRoot?.querySelector("slot:not([name])")?.assignedElements({flatten:!0}).filter(d=>["track","source"].includes(d.localName))).forEach(d=>{a.delete(d);let u=this.#t.get(d);u||(u=d.cloneNode(),this.#t.set(d,u),this.#a?.observe(d,{attributes:!0})),this.nativeEl?.append(u),this.#d(u)}),a.forEach((d,u)=>{d.remove(),this.#t.delete(u)})}#o(a){for(const o of a)if(o.type==="attributes"){const{target:l,attributeName:d}=o,u=this.#t.get(l);u&&d&&(u.setAttribute(d,l.getAttribute(d)??""),this.#d(u))}}#d(a){a&&a.localName==="track"&&a.default&&(a.kind==="chapters"||a.kind==="metadata")&&a.track.mode==="disabled"&&(a.track.mode="hidden")}#c(a){if(Object.prototype.hasOwnProperty.call(this,a)){const o=this[a];delete this[a],this[a]=o}}attributeChangedCallback(a,o,l){this.#n(),this.#u(a,o,l)}#u(a,o,l){["id","class"].includes(a)||!hh.observedAttributes.includes(a)&&this.constructor.observedAttributes.includes(a)||(l===null?this.nativeEl?.removeAttribute(a):this.nativeEl?.getAttribute(a)!==l&&this.nativeEl?.setAttribute(a,l))}connectedCallback(){this.#n()}}}function Xk(i){const e=[];for(let t=Object.getPrototypeOf(i);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t)){const s=Object.getOwnPropertyNames(t);e.push(...s)}return e}function Wy(i){let e="";for(const t in i){if(!Ky.includes(t))continue;const s=i[t];s===""?e+=` ${t}`:e+=` ${t}="${s}"`}return e}function Zk(i){const e={};for(const t of i)e[t.name]=t.value;return e}const Go=Vy(globalThis.HTMLElement??class{},{tag:"video"});Vy(globalThis.HTMLElement??class{},{tag:"audio"});var qy=i=>{throw TypeError(i)},cm=(i,e,t)=>e.has(i)||qy("Cannot "+t),ft=(i,e,t)=>(cm(i,e,"read from private field"),t?t.call(i):e.get(i)),li=(i,e,t)=>e.has(i)?qy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),fi=(i,e,t,s)=>(cm(i,e,"write to private field"),e.set(i,t),t),Ko=(i,e,t)=>(cm(i,e,"access private method"),t),Jk=()=>{try{return"0.30.3"}catch{}return"UNKNOWN"},eD=Jk(),tD=()=>eD,iD=` +`,D={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",DISABLE_PSEUDO_ENDED:"disable-pseudo-ended",DRM_TOKEN:"drm-token",PLAYBACK_TOKEN:"playback-token",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",MIN_RESOLUTION:"min-resolution",MAX_AUTO_RESOLUTION:"max-auto-resolution",RENDITION_ORDER:"rendition-order",PROGRAM_START_TIME:"program-start-time",PROGRAM_END_TIME:"program-end-time",ASSET_START_TIME:"asset-start-time",ASSET_END_TIME:"asset-end-time",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_INIT_TIME:"player-init-time",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type",LOGO:"logo",CAP_RENDITION_TO_PLAYER_SIZE:"cap-rendition-to-player-size"},sD=Object.values(D),t0=tD(),i0="mux-video",pa,El,ga,yl,bl,Tl,_l,Al,va,Xt,ir,Sl,Ea,rD=class extends Go{constructor(){super(),li(this,Xt),li(this,pa),li(this,El),li(this,ga,{}),li(this,yl,{}),li(this,bl),li(this,Tl),li(this,_l),li(this,Al),li(this,va,""),li(this,Sl),fi(this,El,om()),this.nativeEl.addEventListener("muxmetadata",e=>{var t;let s=wk(this.nativeEl),r=(t=this.metadata)!=null?t:{};this.metadata={...s,...r},s?.["com.mux.video.branding"]==="mux-free-plan"&&(fi(this,va,"default"),this.updateLogo())})}static get NAME(){return i0}static get VERSION(){return t0}static get observedAttributes(){var e;return[...sD,...(e=Go.observedAttributes)!=null?e:[]]}static getLogoHTML(e){return!e||e==="false"?"":e==="default"?iD:``}static getTemplateHTML(e={}){var t;return` + ${Go.getTemplateHTML(e)} + + + ${this.getLogoHTML((t=e[D.LOGO])!=null?t:"")} + + `}get preferCmcd(){var e;return(e=this.getAttribute(D.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Fd.includes(e)?this.setAttribute(D.PREFER_CMCD,e):console.warn(`Invalid value for preferCmcd. Must be one of ${Fd.join()}`):this.removeAttribute(D.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(D.PLAYER_INIT_TIME)?+this.getAttribute(D.PLAYER_INIT_TIME):ft(this,El)}set playerInitTime(e){e!=this.playerInitTime&&(e==null?this.removeAttribute(D.PLAYER_INIT_TIME):this.setAttribute(D.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return(e=ft(this,_l))!=null?e:i0}set playerSoftwareName(e){fi(this,_l,e)}get playerSoftwareVersion(){var e;return(e=ft(this,Tl))!=null?e:t0}set playerSoftwareVersion(e){fi(this,Tl,e)}get _hls(){var e;return(e=ft(this,Xt,ir))==null?void 0:e.engine}get mux(){var e;return(e=this.nativeEl)==null?void 0:e.mux}get error(){var e;return(e=wy(this.nativeEl))!=null?e:null}get errorTranslator(){return ft(this,Al)}set errorTranslator(e){fi(this,Al,e)}get src(){return this.getAttribute("src")}set src(e){e!==this.src&&(e==null?this.removeAttribute("src"):this.setAttribute("src",e))}get type(){var e;return(e=this.getAttribute(D.TYPE))!=null?e:void 0}set type(e){e!==this.type&&(e?this.setAttribute(D.TYPE,e):this.removeAttribute(D.TYPE))}get preload(){let e=this.getAttribute("preload");return e===""?"auto":["none","metadata","auto"].includes(e)?e:super.preload}set preload(e){e!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(e)?this.setAttribute("preload",e):this.removeAttribute("preload"))}get debug(){return this.getAttribute(D.DEBUG)!=null}set debug(e){e!==this.debug&&(e?this.setAttribute(D.DEBUG,""):this.removeAttribute(D.DEBUG))}get disableTracking(){return this.hasAttribute(D.DISABLE_TRACKING)}set disableTracking(e){e!==this.disableTracking&&this.toggleAttribute(D.DISABLE_TRACKING,!!e)}get disableCookies(){return this.hasAttribute(D.DISABLE_COOKIES)}set disableCookies(e){e!==this.disableCookies&&(e?this.setAttribute(D.DISABLE_COOKIES,""):this.removeAttribute(D.DISABLE_COOKIES))}get disablePseudoEnded(){return this.hasAttribute(D.DISABLE_PSEUDO_ENDED)}set disablePseudoEnded(e){e!==this.disablePseudoEnded&&(e?this.setAttribute(D.DISABLE_PSEUDO_ENDED,""):this.removeAttribute(D.DISABLE_PSEUDO_ENDED))}get startTime(){let e=this.getAttribute(D.START_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set startTime(e){e!==this.startTime&&(e==null?this.removeAttribute(D.START_TIME):this.setAttribute(D.START_TIME,`${e}`))}get playbackId(){var e;return this.hasAttribute(D.PLAYBACK_ID)?this.getAttribute(D.PLAYBACK_ID):(e=lm(this.src))!=null?e:void 0}set playbackId(e){e!==this.playbackId&&(e?this.setAttribute(D.PLAYBACK_ID,e):this.removeAttribute(D.PLAYBACK_ID))}get maxResolution(){var e;return(e=this.getAttribute(D.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(D.MAX_RESOLUTION,e):this.removeAttribute(D.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(D.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(D.MIN_RESOLUTION,e):this.removeAttribute(D.MIN_RESOLUTION))}get maxAutoResolution(){var e;return(e=this.getAttribute(D.MAX_AUTO_RESOLUTION))!=null?e:void 0}set maxAutoResolution(e){e==null?this.removeAttribute(D.MAX_AUTO_RESOLUTION):this.setAttribute(D.MAX_AUTO_RESOLUTION,e)}get renditionOrder(){var e;return(e=this.getAttribute(D.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(D.RENDITION_ORDER,e):this.removeAttribute(D.RENDITION_ORDER))}get programStartTime(){let e=this.getAttribute(D.PROGRAM_START_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set programStartTime(e){e==null?this.removeAttribute(D.PROGRAM_START_TIME):this.setAttribute(D.PROGRAM_START_TIME,`${e}`)}get programEndTime(){let e=this.getAttribute(D.PROGRAM_END_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set programEndTime(e){e==null?this.removeAttribute(D.PROGRAM_END_TIME):this.setAttribute(D.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){let e=this.getAttribute(D.ASSET_START_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set assetStartTime(e){e==null?this.removeAttribute(D.ASSET_START_TIME):this.setAttribute(D.ASSET_START_TIME,`${e}`)}get assetEndTime(){let e=this.getAttribute(D.ASSET_END_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set assetEndTime(e){e==null?this.removeAttribute(D.ASSET_END_TIME):this.setAttribute(D.ASSET_END_TIME,`${e}`)}get customDomain(){var e;return(e=this.getAttribute(D.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(D.CUSTOM_DOMAIN,e):this.removeAttribute(D.CUSTOM_DOMAIN))}get capRenditionToPlayerSize(){var e;return((e=this._hlsConfig)==null?void 0:e.capLevelToPlayerSize)!=null?this._hlsConfig.capLevelToPlayerSize:ft(this,Sl)}set capRenditionToPlayerSize(e){fi(this,Sl,e)}get drmToken(){var e;return(e=this.getAttribute(D.DRM_TOKEN))!=null?e:void 0}set drmToken(e){e!==this.drmToken&&(e?this.setAttribute(D.DRM_TOKEN,e):this.removeAttribute(D.DRM_TOKEN))}get playbackToken(){var e,t,s,r;if(this.hasAttribute(D.PLAYBACK_TOKEN))return(e=this.getAttribute(D.PLAYBACK_TOKEN))!=null?e:void 0;if(this.hasAttribute(D.PLAYBACK_ID)){let[,n]=im((t=this.playbackId)!=null?t:"");return(s=new URLSearchParams(n).get("token"))!=null?s:void 0}if(this.src)return(r=new URLSearchParams(this.src).get("token"))!=null?r:void 0}set playbackToken(e){e!==this.playbackToken&&(e?this.setAttribute(D.PLAYBACK_TOKEN,e):this.removeAttribute(D.PLAYBACK_TOKEN))}get tokens(){let e=this.getAttribute(D.PLAYBACK_TOKEN),t=this.getAttribute(D.DRM_TOKEN);return{...ft(this,yl),...e!=null?{playback:e}:{},...t!=null?{drm:t}:{}}}set tokens(e){fi(this,yl,e??{})}get ended(){return Oy(this.nativeEl,this._hls)}get envKey(){var e;return(e=this.getAttribute(D.ENV_KEY))!=null?e:void 0}set envKey(e){e!==this.envKey&&(e?this.setAttribute(D.ENV_KEY,e):this.removeAttribute(D.ENV_KEY))}get beaconCollectionDomain(){var e;return(e=this.getAttribute(D.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(D.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(D.BEACON_COLLECTION_DOMAIN))}get streamType(){var e;return(e=this.getAttribute(D.STREAM_TYPE))!=null?e:uh(this.nativeEl)}set streamType(e){e!==this.streamType&&(e?this.setAttribute(D.STREAM_TYPE,e):this.removeAttribute(D.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(D.TARGET_LIVE_WINDOW)?+this.getAttribute(D.TARGET_LIVE_WINDOW):Mk(this.nativeEl)}set targetLiveWindow(e){e!=this.targetLiveWindow&&(e==null?this.removeAttribute(D.TARGET_LIVE_WINDOW):this.setAttribute(D.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e,t;if(this.hasAttribute(D.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:s}=this,r=(e=this.nativeEl.seekable.end(0))!=null?e:0,n=(t=this.nativeEl.seekable.start(0))!=null?t:0;return Math.max(n,r-s)}return Pk(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(D.LIVE_EDGE_OFFSET))return+this.getAttribute(D.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){e!=this.liveEdgeOffset&&(e==null?this.removeAttribute(D.LIVE_EDGE_OFFSET):this.setAttribute(D.LIVE_EDGE_OFFSET,`${+e}`))}get seekable(){return dm(this.nativeEl)}async addCuePoints(e){return Iy(this.nativeEl,e)}get activeCuePoint(){return Ly(this.nativeEl)}get cuePoints(){return Zx(this.nativeEl)}async addChapters(e){return xy(this.nativeEl,e)}get activeChapter(){return ky(this.nativeEl)}get chapters(){return ek(this.nativeEl)}getStartDate(){return ik(this.nativeEl,this._hls)}get currentPdt(){return sk(this.nativeEl,this._hls)}get preferPlayback(){let e=this.getAttribute(D.PREFER_PLAYBACK);if(e===qi.MSE||e===qi.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===qi.MSE||e===qi.NATIVE?this.setAttribute(D.PREFER_PLAYBACK,e):this.removeAttribute(D.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(e=>e.startsWith("metadata-")&&![D.METADATA_URL].includes(e)).reduce((e,t)=>{let s=this.getAttribute(t);return s!=null&&(e[t.replace(/^metadata-/,"").replace(/-/g,"_")]=s),e},{}),...ft(this,ga)}}set metadata(e){fi(this,ga,e??{}),this.mux&&this.mux.emit("hb",ft(this,ga))}get _hlsConfig(){return ft(this,bl)}set _hlsConfig(e){fi(this,bl,e)}get logo(){var e;return(e=this.getAttribute(D.LOGO))!=null?e:ft(this,va)}set logo(e){e?this.setAttribute(D.LOGO,e):this.removeAttribute(D.LOGO)}load(){Ny(this,this.nativeEl,ft(this,Xt,ir))}unload(){Uy(this.nativeEl,ft(this,Xt,ir),this)}attributeChangedCallback(e,t,s){var r,n;switch(Go.observedAttributes.includes(e)&&!["src","autoplay","preload"].includes(e)&&super.attributeChangedCallback(e,t,s),e){case D.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=s??void 0;break;case D.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=s??void 0;break;case"src":{let a=!!t,o=!!s;!a&&o?Ko(this,Xt,Ea).call(this):a&&!o?this.unload():a&&o&&(this.unload(),Ko(this,Xt,Ea).call(this));break}case"autoplay":if(s===t)break;(r=ft(this,Xt,ir))==null||r.setAutoplay(this.autoplay);break;case"preload":if(s===t)break;(n=ft(this,Xt,ir))==null||n.setPreload(s);break;case D.PLAYBACK_ID:this.src=dh(this);break;case D.DEBUG:{let a=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=a);break}case D.METADATA_URL:s&&fetch(s).then(a=>a.json()).then(a=>this.metadata=a).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${s}!`));break;case D.STREAM_TYPE:(s==null||s!==t)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case D.TARGET_LIVE_WINDOW:(s==null||s!==t)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;case D.LOGO:(s==null||s!==t)&&this.updateLogo();break;case D.DISABLE_TRACKING:{if(s==null||s!==t){let a=this.currentTime,o=this.paused;this.unload(),Ko(this,Xt,Ea).call(this).then(()=>{this.currentTime=a,o||this.play()})}break}case D.DISABLE_COOKIES:{(s==null||s!==t)&&this.disableCookies&&document.cookie.split(";").forEach(a=>{a.trim().startsWith("muxData")&&(document.cookie=a.replace(/^ +/,"").replace(/=.*/,"=;expires="+new Date().toUTCString()+";path=/"))});break}case D.CAP_RENDITION_TO_PLAYER_SIZE:(s==null||s!==t)&&(this.capRenditionToPlayerSize=s!=null?!0:void 0)}}updateLogo(){if(!this.shadowRoot)return;let e=this.shadowRoot.querySelector('slot[name="logo"]');if(!e)return;let t=this.constructor.getLogoHTML(ft(this,va)||this.logo);e.innerHTML=t}connectedCallback(){var e;(e=super.connectedCallback)==null||e.call(this),this.nativeEl&&this.src&&!ft(this,Xt,ir)&&Ko(this,Xt,Ea).call(this)}disconnectedCallback(){this.unload()}handleEvent(e){e.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(e.type,{composed:!0,detail:e.detail}))}};pa=new WeakMap,El=new WeakMap,ga=new WeakMap,yl=new WeakMap,bl=new WeakMap,Tl=new WeakMap,_l=new WeakMap,Al=new WeakMap,va=new WeakMap,Xt=new WeakSet,ir=function(){return Ok(this.nativeEl)},Sl=new WeakMap,Ea=async function(){ft(this,pa)||(await fi(this,pa,Promise.resolve()),fi(this,pa,null),this.load())};const Tr=new WeakMap;class Ec extends Error{}class nD extends Error{}const aD=["application/x-mpegURL","application/vnd.apple.mpegurl","audio/mpegurl"],oD=globalThis.WeakRef?class extends Set{add(i){super.add(new WeakRef(i))}forEach(i){super.forEach(e=>{const t=e.deref();t&&i(t)})}}:Set;function lD(i){globalThis.chrome?.cast?.isAvailable?globalThis.cast?.framework?i():customElements.whenDefined("google-cast-button").then(i):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(i)}}function dD(){return globalThis.chrome}function uD(){const i="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if(globalThis.chrome?.cast||document.querySelector(`script[src="${i}"]`))return;const e=document.createElement("script");e.src=i,document.head.append(e)}function Fs(){return globalThis.cast?.framework?.CastContext.getInstance()}function hm(){return Fs()?.getCurrentSession()}function fm(){return hm()?.getSessionObj().media[0]}function cD(i){return new Promise((e,t)=>{fm().editTracksInfo(i,e,t)})}function hD(i){return new Promise((e,t)=>{fm().getStatus(i,e,t)})}function s0(i){return Fs().setOptions({...Yy(),...i})}function Yy(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}function fD(i){if(!i)return;const e=/\.([a-zA-Z0-9]+)(?:\?.*)?$/,t=i.match(e);return t?t[1]:null}function mD(i){const e=i.split(` +`),t=[];for(let s=0;s!s.trim().startsWith("#")&&s.trim()!=="")}async function gD(i){try{const t=(await fetch(i,{method:"HEAD"})).headers.get("Content-Type");return aD.some(s=>t===s)}catch(e){return console.error("Error while trying to get the Content-Type of the manifest",e),!1}}async function vD(i){try{const e=await(await fetch(i)).text();let t=e;const s=mD(e);if(s.length>0){const a=new URL(s[0],i).toString();t=await(await fetch(a)).text()}const r=pD(t);return fD(r)}catch(e){console.error("Error while trying to parse the manifest playlist",e);return}}const Il=new oD,bs=new WeakSet;let at;lD(()=>{if(!globalThis.chrome?.cast?.isAvailable){console.debug("chrome.cast.isAvailable",globalThis.chrome?.cast?.isAvailable);return}at||(at=cast.framework,Fs().addEventListener(at.CastContextEventType.CAST_STATE_CHANGED,i=>{Il.forEach(e=>Tr.get(e).onCastStateChanged?.(i))}),Fs().addEventListener(at.CastContextEventType.SESSION_STATE_CHANGED,i=>{Il.forEach(e=>Tr.get(e).onSessionStateChanged?.(i))}),Il.forEach(i=>Tr.get(i).init?.()))});let r0=0;class ED extends EventTarget{#e;#s;#i;#r;#t="disconnected";#a=!1;#n=new Set;#l=new WeakMap;constructor(e){super(),this.#e=e,Il.add(this),Tr.set(this,{init:()=>this.#h(),onCastStateChanged:()=>this.#u(),onSessionStateChanged:()=>this.#m(),getCastPlayer:()=>this.#o}),this.#h()}get#o(){if(bs.has(this.#e))return this.#i}get state(){return this.#t}async watchAvailability(e){if(this.#e.disableRemotePlayback)throw new Ec("disableRemotePlayback attribute is present.");return this.#l.set(e,++r0),this.#n.add(e),queueMicrotask(()=>e(this.#c())),r0}async cancelWatchAvailability(e){if(this.#e.disableRemotePlayback)throw new Ec("disableRemotePlayback attribute is present.");e?this.#n.delete(e):this.#n.clear()}async prompt(){if(this.#e.disableRemotePlayback)throw new Ec("disableRemotePlayback attribute is present.");if(!globalThis.chrome?.cast?.isAvailable)throw new nD("The RemotePlayback API is disabled on this platform.");const e=bs.has(this.#e);bs.add(this.#e),s0(this.#e.castOptions),Object.entries(this.#r).forEach(([t,s])=>{this.#i.controller.addEventListener(t,s)});try{await Fs().requestSession()}catch(t){if(e||bs.delete(this.#e),t==="cancel")return;throw new Error(t)}Tr.get(this.#e)?.loadOnPrompt?.()}#d(){bs.has(this.#e)&&(Object.entries(this.#r).forEach(([e,t])=>{this.#i.controller.removeEventListener(e,t)}),bs.delete(this.#e),this.#e.muted=this.#i.isMuted,this.#e.currentTime=this.#i.savedPlayerState.currentTime,this.#i.savedPlayerState.isPaused===!1&&this.#e.play())}#c(){const e=Fs()?.getCastState();return e&&e!=="NO_DEVICES_AVAILABLE"}#u(){const e=Fs().getCastState();if(bs.has(this.#e)&&e==="CONNECTING"&&(this.#t="connecting",this.dispatchEvent(new Event("connecting"))),!this.#a&&e?.includes("CONNECT")){this.#a=!0;for(let t of this.#n)t(!0)}else if(this.#a&&(!e||e==="NO_DEVICES_AVAILABLE")){this.#a=!1;for(let t of this.#n)t(!1)}}async#m(){const{SESSION_RESUMED:e}=at.SessionState;if(Fs().getSessionState()===e&&this.#e.castSrc===fm()?.media.contentId){bs.add(this.#e),Object.entries(this.#r).forEach(([t,s])=>{this.#i.controller.addEventListener(t,s)});try{await hD(new chrome.cast.media.GetStatusRequest)}catch(t){console.error(t)}this.#r[at.RemotePlayerEventType.IS_PAUSED_CHANGED](),this.#r[at.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}}#h(){!at||this.#s||(this.#s=!0,s0(this.#e.castOptions),this.#e.textTracks.addEventListener("change",()=>this.#f()),this.#u(),this.#i=new at.RemotePlayer,new at.RemotePlayerController(this.#i),this.#r={[at.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:e})=>{e===!0?(this.#t="connected",this.dispatchEvent(new Event("connect"))):(this.#d(),this.#t="disconnected",this.dispatchEvent(new Event("disconnect")))},[at.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.#e.dispatchEvent(new Event("durationchange"))},[at.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.#e.dispatchEvent(new Event("volumechange"))},[at.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.#e.dispatchEvent(new Event("volumechange"))},[at.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{this.#o?.isMediaLoaded&&this.#e.dispatchEvent(new Event("timeupdate"))},[at.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.#e.dispatchEvent(new Event("resize"))},[at.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.#e.dispatchEvent(new Event(this.paused?"pause":"play"))},[at.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{this.#o?.playerState!==chrome.cast.media.PlayerState.PAUSED&&this.#e.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[this.#o?.playerState]))},[at.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{this.#o?.isMediaLoaded&&(await Promise.resolve(),this.#p())}})}#p(){this.#f()}async#f(){if(!this.#o)return;const t=(this.#i.mediaInfo?.tracks??[]).filter(({type:c})=>c===chrome.cast.media.TrackType.TEXT),s=[...this.#e.textTracks].filter(({kind:c})=>c==="subtitles"||c==="captions"),r=t.map(({language:c,name:h,trackId:f})=>{const{mode:m}=s.find(p=>p.language===c&&p.label===h)??{};return m?{mode:m,trackId:f}:!1}).filter(Boolean),a=r.filter(({mode:c})=>c!=="showing").map(({trackId:c})=>c),o=r.find(({mode:c})=>c==="showing"),l=hm()?.getSessionObj().media[0]?.activeTrackIds??[];let d=l;if(l.length&&(d=d.filter(c=>!a.includes(c))),o?.trackId&&(d=[...d,o.trackId]),d=[...new Set(d)],!((c,h)=>c.length===h.length&&c.every(f=>h.includes(f)))(l,d))try{const c=new chrome.cast.media.EditTracksInfoRequest(d);await cD(c)}catch(c){console.error(c)}}}const yD=i=>class extends i{static observedAttributes=[...i.observedAttributes??[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"];#e={paused:!1};#s=Yy();#i;#r;get remote(){return this.#r?this.#r:dD()?(this.disableRemotePlayback||uD(),Tr.set(this,{loadOnPrompt:()=>this.#a()}),this.#r=new ED(this)):super.remote}get#t(){return Tr.get(this.remote)?.getCastPlayer?.()}attributeChangedCallback(t,s,r){if(super.attributeChangedCallback(t,s,r),t==="cast-receiver"&&r){this.#s.receiverApplicationId=r;return}if(this.#t)switch(t){case"cast-stream-type":case"cast-src":this.load();break}}async#a(){this.#e.paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(t){console.error(t)}}async load(){if(!this.#t)return super.load();const t=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType);t.customData=this.castCustomData;const s=[...this.querySelectorAll("track")].filter(({kind:o,src:l})=>l&&(o==="subtitles"||o==="captions")),r=[];let n=0;if(s.length&&(t.tracks=s.map(o=>{const l=++n;r.length===0&&o.track.mode==="showing"&&r.push(l);const d=new chrome.cast.media.Track(l,chrome.cast.media.TrackType.TEXT);return d.trackContentId=o.src,d.trackContentType="text/vtt",d.subtype=o.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,d.name=o.label,d.language=o.srclang,d})),this.castStreamType==="live"?t.streamType=chrome.cast.media.StreamType.LIVE:t.streamType=chrome.cast.media.StreamType.BUFFERED,t.metadata=new chrome.cast.media.GenericMediaMetadata,t.metadata.title=this.title,t.metadata.images=[{url:this.poster}],gD(this.castSrc)){const o=await vD(this.castSrc);o?.includes("m4s")||o?.includes("mp4")?(t.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.FMP4,t.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.FMP4):o?.includes("ts")&&(t.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.TS,t.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.TS)}const a=new chrome.cast.media.LoadRequest(t);a.currentTime=super.currentTime??0,a.autoplay=!this.#e.paused,a.activeTrackIds=r,await hm()?.loadMedia(a),this.dispatchEvent(new Event("volumechange"))}play(){if(this.#t){this.#t.isPaused&&this.#t.controller?.playOrPause();return}return super.play()}pause(){if(this.#t){this.#t.isPaused||this.#t.controller?.playOrPause();return}super.pause()}get castOptions(){return this.#s}get castReceiver(){return this.getAttribute("cast-receiver")??void 0}set castReceiver(t){this.castReceiver!=t&&this.setAttribute("cast-receiver",`${t}`)}get castSrc(){return this.getAttribute("cast-src")??this.querySelector("source")?.src??this.currentSrc}set castSrc(t){this.castSrc!=t&&this.setAttribute("cast-src",`${t}`)}get castContentType(){return this.getAttribute("cast-content-type")??void 0}set castContentType(t){this.setAttribute("cast-content-type",`${t}`)}get castStreamType(){return this.getAttribute("cast-stream-type")??this.streamType??void 0}set castStreamType(t){this.setAttribute("cast-stream-type",`${t}`)}get castCustomData(){return this.#i}set castCustomData(t){const s=typeof t;if(!["object","undefined"].includes(s)){console.error(`castCustomData must be nullish or an object but value was of type ${s}`);return}this.#i=t}get readyState(){if(this.#t)switch(this.#t.playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return this.#t?this.#t.isPaused:super.paused}get muted(){return this.#t?this.#t?.isMuted:super.muted}set muted(t){if(this.#t){(t&&!this.#t.isMuted||!t&&this.#t.isMuted)&&this.#t.controller?.muteOrUnmute();return}super.muted=t}get volume(){return this.#t?this.#t?.volumeLevel??1:super.volume}set volume(t){if(this.#t){this.#t.volumeLevel=+t,this.#t.controller?.setVolumeLevel();return}super.volume=t}get duration(){return this.#t&&this.#t?.isMediaLoaded?this.#t?.duration??NaN:super.duration}get currentTime(){return this.#t&&this.#t?.isMediaLoaded?this.#t?.currentTime??0:super.currentTime}set currentTime(t){if(this.#t){this.#t.currentTime=t,this.#t.controller?.seek();return}super.currentTime=t}};class bu extends Event{track;constructor(e,t){super(e),this.track=t.track}}const fh=new WeakMap;function Z(i){return fh.get(i)??bD(i,{})}function bD(i,e){let t=fh.get(i);return t||fh.set(i,t={}),Object.assign(t,e)}function mh(i,e){const t=i.videoTracks;Z(e).media=i,Z(e).renditionSet||(Z(e).renditionSet=new Set);const s=Z(t).trackSet;s.add(e);const r=s.size-1;r in gh.prototype||Object.defineProperty(gh.prototype,r,{get(){return[...Z(this).trackSet][r]}}),queueMicrotask(()=>{t.dispatchEvent(new bu("addtrack",{track:e}))})}function ph(i){const e=Z(i).media?.videoTracks;if(!e)return;Z(e).trackSet.delete(i),queueMicrotask(()=>{e.dispatchEvent(new bu("removetrack",{track:i}))})}function TD(i){const e=Z(i).media.videoTracks??[];let t=!1;for(const s of e)s!==i&&(s.selected=!1,t=!0);if(t){if(Z(e).changeRequested)return;Z(e).changeRequested=!0,queueMicrotask(()=>{delete Z(e).changeRequested,e.dispatchEvent(new Event("change"))})}}class gh extends EventTarget{#e;#s;#i;constructor(){super(),Z(this).trackSet=new Set}get#r(){return Z(this).trackSet}[Symbol.iterator](){return this.#r.values()}get length(){return this.#r.size}getTrackById(e){return[...this.#r].find(t=>t.id===e)??null}get selectedIndex(){return[...this.#r].findIndex(e=>e.selected)}get onaddtrack(){return this.#e}set onaddtrack(e){this.#e&&(this.removeEventListener("addtrack",this.#e),this.#e=void 0),typeof e=="function"&&(this.#e=e,this.addEventListener("addtrack",e))}get onremovetrack(){return this.#s}set onremovetrack(e){this.#s&&(this.removeEventListener("removetrack",this.#s),this.#s=void 0),typeof e=="function"&&(this.#s=e,this.addEventListener("removetrack",e))}get onchange(){return this.#i}set onchange(e){this.#i&&(this.removeEventListener("change",this.#i),this.#i=void 0),typeof e=="function"&&(this.#i=e,this.addEventListener("change",e))}}class Tu extends Event{rendition;constructor(e,t){super(e),this.rendition=t.rendition}}function _D(i,e){const t=Z(i).media.videoRenditions;Z(e).media=Z(i).media,Z(e).track=i;const s=Z(i).renditionSet;s.add(e);const r=s.size-1;r in vh.prototype||Object.defineProperty(vh.prototype,r,{get(){return zr(this)[r]}}),queueMicrotask(()=>{i.selected&&t.dispatchEvent(new Tu("addrendition",{rendition:e}))})}function AD(i){const e=Z(i).media.videoRenditions,t=Z(i).track;Z(t).renditionSet.delete(i),queueMicrotask(()=>{Z(i).track.selected&&e.dispatchEvent(new Tu("removerendition",{rendition:i}))})}function SD(i){const e=Z(i).media.videoRenditions;!e||Z(e).changeRequested||(Z(e).changeRequested=!0,queueMicrotask(()=>{delete Z(e).changeRequested,Z(i).track.selected&&e.dispatchEvent(new Event("change"))}))}function zr(i){return[...Z(i).media.videoTracks].filter(t=>t.selected).flatMap(t=>[...Z(t).renditionSet])}class vh extends EventTarget{#e;#s;#i;[Symbol.iterator](){return zr(this).values()}get length(){return zr(this).length}getRenditionById(e){return zr(this).find(t=>`${t.id}`==`${e}`)??null}get selectedIndex(){return zr(this).findIndex(e=>e.selected)}set selectedIndex(e){for(const[t,s]of zr(this).entries())s.selected=t===e}get onaddrendition(){return this.#e}set onaddrendition(e){this.#e&&(this.removeEventListener("addrendition",this.#e),this.#e=void 0),typeof e=="function"&&(this.#e=e,this.addEventListener("addrendition",e))}get onremoverendition(){return this.#s}set onremoverendition(e){this.#s&&(this.removeEventListener("removerendition",this.#s),this.#s=void 0),typeof e=="function"&&(this.#s=e,this.addEventListener("removerendition",e))}get onchange(){return this.#i}set onchange(e){this.#i&&(this.removeEventListener("change",this.#i),this.#i=void 0),typeof e=="function"&&(this.#i=e,this.addEventListener("change",e))}}class ID{src;id;width;height;bitrate;frameRate;codec;#e=!1;get selected(){return this.#e}set selected(e){this.#e!==e&&(this.#e=e,SD(this))}}class jy{id;kind;label="";language="";sourceBuffer;#e=!1;addRendition(e,t,s,r,n,a){const o=new ID;return o.src=e,o.width=t,o.height=s,o.frameRate=a,o.bitrate=n,o.codec=r,_D(this,o),o}removeRendition(e){AD(e)}get selected(){return this.#e}set selected(e){this.#e!==e&&(this.#e=e,e===!0&&TD(this))}}function LD(i,e){const t=Z(i).media.audioRenditions;Z(e).media=Z(i).media,Z(e).track=i;const s=Z(i).renditionSet;s.add(e);const r=s.size-1;r in Eh.prototype||Object.defineProperty(Eh.prototype,r,{get(){return Qr(this)[r]}}),queueMicrotask(()=>{i.enabled&&t.dispatchEvent(new Tu("addrendition",{rendition:e}))})}function RD(i){const e=Z(i).media.audioRenditions,t=Z(i).track;Z(t).renditionSet.delete(i),queueMicrotask(()=>{Z(i).track.enabled&&e.dispatchEvent(new Tu("removerendition",{rendition:i}))})}function xD(i){const e=Z(i).media.audioRenditions;!e||Z(e).changeRequested||(Z(e).changeRequested=!0,queueMicrotask(()=>{delete Z(e).changeRequested,Z(i).track.enabled&&e.dispatchEvent(new Event("change"))}))}function Qr(i){return[...Z(i).media.audioTracks].filter(t=>t.enabled).flatMap(t=>[...Z(t).renditionSet])}class Eh extends EventTarget{#e;#s;#i;[Symbol.iterator](){return Qr(this).values()}get length(){return Qr(this).length}getRenditionById(e){return Qr(this).find(t=>`${t.id}`==`${e}`)??null}get selectedIndex(){return Qr(this).findIndex(e=>e.selected)}set selectedIndex(e){for(const[t,s]of Qr(this).entries())s.selected=t===e}get onaddrendition(){return this.#e}set onaddrendition(e){this.#e&&(this.removeEventListener("addrendition",this.#e),this.#e=void 0),typeof e=="function"&&(this.#e=e,this.addEventListener("addrendition",e))}get onremoverendition(){return this.#s}set onremoverendition(e){this.#s&&(this.removeEventListener("removerendition",this.#s),this.#s=void 0),typeof e=="function"&&(this.#s=e,this.addEventListener("removerendition",e))}get onchange(){return this.#i}set onchange(e){this.#i&&(this.removeEventListener("change",this.#i),this.#i=void 0),typeof e=="function"&&(this.#i=e,this.addEventListener("change",e))}}class kD{src;id;bitrate;codec;#e=!1;get selected(){return this.#e}set selected(e){this.#e!==e&&(this.#e=e,xD(this))}}function yh(i,e){const t=i.audioTracks;Z(e).media=i,Z(e).renditionSet||(Z(e).renditionSet=new Set);const s=Z(t).trackSet;s.add(e);const r=s.size-1;r in Th.prototype||Object.defineProperty(Th.prototype,r,{get(){return[...Z(this).trackSet][r]}}),queueMicrotask(()=>{t.dispatchEvent(new bu("addtrack",{track:e}))})}function bh(i){const e=Z(i).media?.audioTracks;if(!e)return;Z(e).trackSet.delete(i),queueMicrotask(()=>{e.dispatchEvent(new bu("removetrack",{track:i}))})}function DD(i){const e=Z(i).media.audioTracks;!e||Z(e).changeRequested||(Z(e).changeRequested=!0,queueMicrotask(()=>{delete Z(e).changeRequested,e.dispatchEvent(new Event("change"))}))}class Th extends EventTarget{#e;#s;#i;constructor(){super(),Z(this).trackSet=new Set}get#r(){return Z(this).trackSet}[Symbol.iterator](){return this.#r.values()}get length(){return this.#r.size}getTrackById(e){return[...this.#r].find(t=>t.id===e)??null}get onaddtrack(){return this.#e}set onaddtrack(e){this.#e&&(this.removeEventListener("addtrack",this.#e),this.#e=void 0),typeof e=="function"&&(this.#e=e,this.addEventListener("addtrack",e))}get onremovetrack(){return this.#s}set onremovetrack(e){this.#s&&(this.removeEventListener("removetrack",this.#s),this.#s=void 0),typeof e=="function"&&(this.#s=e,this.addEventListener("removetrack",e))}get onchange(){return this.#i}set onchange(e){this.#i&&(this.removeEventListener("change",this.#i),this.#i=void 0),typeof e=="function"&&(this.#i=e,this.addEventListener("change",e))}}class zy{id;kind;label="";language="";sourceBuffer;#e=!1;addRendition(e,t,s){const r=new kD;return r.src=e,r.codec=t,r.bitrate=s,LD(this,r),r}removeRendition(e){RD(e)}get enabled(){return this.#e}set enabled(e){this.#e!==e&&(this.#e=e,DD(this))}}const n0=Hd(globalThis.HTMLMediaElement,"video"),a0=Hd(globalThis.HTMLMediaElement,"audio");function CD(i){if(!i?.prototype)return i;const e=Hd(i,"video");(!e||`${e}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"videoTracks",{get(){return wD(this)}});const t=Hd(i,"audio");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"audioTracks",{get(){return MD(this)}}),"addVideoTrack"in i.prototype||(i.prototype.addVideoTrack=function(n,a="",o=""){const l=new jy;return l.kind=n,l.label=a,l.language=o,mh(this,l),l}),"removeVideoTrack"in i.prototype||(i.prototype.removeVideoTrack=ph),"addAudioTrack"in i.prototype||(i.prototype.addAudioTrack=function(n,a="",o=""){const l=new zy;return l.kind=n,l.label=a,l.language=o,yh(this,l),l}),"removeAudioTrack"in i.prototype||(i.prototype.removeAudioTrack=bh),"videoRenditions"in i.prototype||Object.defineProperty(i.prototype,"videoRenditions",{get(){return s(this)}});const s=n=>{let a=Z(n).videoRenditions;return a||(a=new vh,Z(a).media=n,Z(n).videoRenditions=a),a};"audioRenditions"in i.prototype||Object.defineProperty(i.prototype,"audioRenditions",{get(){return r(this)}});const r=n=>{let a=Z(n).audioRenditions;return a||(a=new Eh,Z(a).media=n,Z(n).audioRenditions=a),a};return i}function Hd(i,e){if(i?.prototype)return Object.getOwnPropertyDescriptor(i.prototype,`${e}Tracks`)?.get}function wD(i){let e=Z(i).videoTracks;if(!e&&(e=new gh,Z(i).videoTracks=e,n0)){const t=n0.call(i.nativeEl??i);for(const s of t)mh(i,s);t.addEventListener("change",()=>{e.dispatchEvent(new Event("change"))}),t.addEventListener("addtrack",s=>{if([...e].some(r=>r instanceof jy)){for(const r of t)ph(r);return}mh(i,s.track)}),t.addEventListener("removetrack",s=>{ph(s.track)})}return e}function MD(i){let e=Z(i).audioTracks;if(!e&&(e=new Th,Z(i).audioTracks=e,a0)){const t=a0.call(i.nativeEl??i);for(const s of t)yh(i,s);t.addEventListener("change",()=>{e.dispatchEvent(new Event("change"))}),t.addEventListener("addtrack",s=>{if([...e].some(r=>r instanceof zy)){for(const r of t)bh(r);return}yh(i,s.track)}),t.addEventListener("removetrack",s=>{bh(s.track)})}return e}var Qy=i=>{throw TypeError(i)},Xy=(i,e,t)=>e.has(i)||Qy("Cannot "+t),PD=(i,e,t)=>(Xy(i,e,"read from private field"),t?t.call(i):e.get(i)),OD=(i,e,t)=>e.has(i)?Qy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),ND=(i,e,t,s)=>(Xy(i,e,"write to private field"),e.set(i,t),t),Zy=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment>"u"){class i extends Zy{}globalThis.DocumentFragment=i}var UD=class extends Zy{},$D={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(UD)}},FD={customElements:$D},BD=typeof window>"u"||typeof globalThis.customElements>"u",yc=BD?FD:globalThis,Ll,o0=class extends yD(CD(rD)){constructor(){super(...arguments),OD(this,Ll)}get autoplay(){let i=this.getAttribute("autoplay");return i===null?!1:i===""?!0:i}set autoplay(i){let e=this.autoplay;i!==e&&(i?this.setAttribute("autoplay",typeof i=="string"?i:""):this.removeAttribute("autoplay"))}get muxCastCustomData(){return{mux:{playbackId:this.playbackId,minResolution:this.minResolution,maxResolution:this.maxResolution,renditionOrder:this.renditionOrder,customDomain:this.customDomain,tokens:{drm:this.drmToken},envKey:this.envKey,metadata:this.metadata,disableCookies:this.disableCookies,disableTracking:this.disableTracking,beaconCollectionDomain:this.beaconCollectionDomain,startTime:this.startTime,preferCmcd:this.preferCmcd}}}get castCustomData(){var i;return(i=PD(this,Ll))!=null?i:this.muxCastCustomData}set castCustomData(i){ND(this,Ll,i)}};Ll=new WeakMap;yc.customElements.get("mux-video")||(yc.customElements.define("mux-video",o0),yc.MuxVideoElement=o0);const Y={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_LOOP_REQUEST:"medialooprequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},Ae={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},Jy={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_BUFFERED:"mediaBuffered",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_CHAPTERS_CUES:"mediaChaptersCues",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_ENDED:"mediaEnded",MEDIA_ERROR:"mediaError",MEDIA_ERROR_CODE:"mediaErrorCode",MEDIA_ERROR_MESSAGE:"mediaErrorMessage",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_HAS_PLAYED:"mediaHasPlayed",MEDIA_HEIGHT:"mediaHeight",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_IS_PIP:"mediaIsPip",MEDIA_LOADING:"mediaLoading",MEDIA_MUTED:"mediaMuted",MEDIA_LOOP:"mediaLoop",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_LANG:"mediaLang",MEDIA_WIDTH:"mediaWidth"},eb=Object.entries(Jy),_=eb.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{}),HD={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},ms=eb.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{...HD});Object.entries(ms).reduce((i,[e,t])=>{const s=_[e];return s&&(i[t]=s),i},{userinactivechange:"userinactive"});const GD=Object.entries(_).reduce((i,[e,t])=>{const s=ms[e];return s&&(i[t]=s),i},{userinactive:"userinactivechange"}),zi={SUBTITLES:"subtitles",CAPTIONS:"captions",CHAPTERS:"chapters",METADATA:"metadata"},Dn={DISABLED:"disabled",SHOWING:"showing"},bc={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},Nt={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},ls={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},KD={FULLSCREEN:"fullscreen"};function VD(i){return i?.map(qD).join(" ")}function WD(i){return i?.split(/\s+/).map(YD)}function qD(i){if(i){const{id:e,width:t,height:s}=i;return[e,t,s].filter(r=>r!=null).join(":")}}function YD(i){if(i){const[e,t,s]=i.split(":");return{id:e,width:+t,height:+s}}}function jD(i){return i?.map(QD).join(" ")}function zD(i){return i?.split(/\s+/).map(XD)}function QD(i){if(i){const{id:e,kind:t,language:s,label:r}=i;return[e,t,s,r].filter(n=>n!=null).join(":")}}function XD(i){if(i){const[e,t,s,r]=i.split(":");return{id:e,kind:t,language:s,label:r}}}function ZD(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function mm(i){return typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i)}function tb(i){return typeof i!="string"?!1:!isNaN(i)&&!isNaN(parseFloat(i))}const ib=i=>new Promise(e=>setTimeout(e,i)),l0=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],JD=(i,e)=>{const t=i===1?l0[e].singular:l0[e].plural;return`${i} ${t}`},Ha=i=>{if(!mm(i))return"";const e=Math.abs(i),t=e!==i,s=new Date(0,0,0,0,0,e,0);return`${[s.getHours(),s.getMinutes(),s.getSeconds()].map((o,l)=>o&&JD(o,l)).filter(o=>o).join(", ")}${t?" remaining":""}`};function Gs(i,e){let t=!1;i<0&&(t=!0,i=0-i),i=i<0?0:i;let s=Math.floor(i%60),r=Math.floor(i/60%60),n=Math.floor(i/3600);const a=Math.floor(e/60%60),o=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(n=r=s="0"),n=n>0||o>0?n+":":"",r=((n||a>=10)&&r<10?"0"+r:r)+":",s=s<10?"0"+s:s,(t?"-":"")+n+r+s}const eC={"Start airplay":"Start airplay","Stop airplay":"Stop airplay",Audio:"Audio",Captions:"Captions","Enable captions":"Enable captions","Disable captions":"Disable captions","Start casting":"Start casting","Stop casting":"Stop casting","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",Mute:"Mute",Unmute:"Unmute",Loop:"Loop","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings",Auto:"Auto","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute","chapter: {chapterName}":"chapter: {chapterName}",live:"live",Off:"Off","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","Source Not Supported":"Source Not Supported","Encryption Error":"Encryption Error","A network error caused the media download to fail.":"A network error caused the media download to fail.","A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.":"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.","An unsupported error occurred. The server or network failed, or your browser does not support this format.":"An unsupported error occurred. The server or network failed, or your browser does not support this format.","The media is encrypted and there are no keys to decrypt it.":"The media is encrypted and there are no keys to decrypt it."};var d0;const Tc={en:eC};let _h=((d0=globalThis.navigator)==null?void 0:d0.language)||"en";const tC=i=>{_h=i},iC=i=>{var e,t,s;const[r]=_h.split("-");return((e=Tc[_h])==null?void 0:e[i])||((t=Tc[r])==null?void 0:t[i])||((s=Tc.en)==null?void 0:s[i])||i},J=(i,e={})=>iC(i).replace(/\{(\w+)\}/g,(t,s)=>s in e?String(e[s]):`{${s}}`);let sb=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}};class rb extends sb{}let u0=class extends rb{constructor(){super(...arguments),this.role=null}};class sC{observe(){}unobserve(){}disconnect(){}}const nb={createElement:function(){return new no.HTMLElement},createElementNS:function(){return new no.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(i){return!1}},no={ResizeObserver:sC,document:nb,Node:rb,Element:u0,HTMLElement:class extends u0{constructor(){super(...arguments),this.innerHTML=""}get content(){return new no.DocumentFragment}},DocumentFragment:class extends sb{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem(i){return null},setItem(i,e){},removeItem(i){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia(i){return{matches:!1,media:i}},DOMParser:class{parseFromString(e,t){return{body:{textContent:e}}}}},ab="global"in globalThis&&globalThis?.global===globalThis||typeof window>"u"||typeof window.customElements>"u",ob=Object.keys(no).every(i=>i in globalThis),k=ab&&!ob?no:globalThis,tt=ab&&!ob?nb:globalThis.document,c0=new WeakMap,pm=i=>{let e=c0.get(i);return e||c0.set(i,e=new Set),e},lb=new k.ResizeObserver(i=>{for(const e of i)for(const t of pm(e.target))t(e)});function Hn(i,e){pm(i).add(e),lb.observe(i)}function Gn(i,e){const t=pm(i);t.delete(e),t.size||lb.unobserve(i)}function Yt(i){const e={};for(const t of i)e[t.name]=t.value;return e}function wt(i){var e;return(e=Ah(i))!=null?e:Yn(i,"media-controller")}function Ah(i){var e;const{MEDIA_CONTROLLER:t}=Ae,s=i.getAttribute(t);if(s)return(e=_u(i))==null?void 0:e.getElementById(s)}const db=(i,e,t=".value")=>{const s=i.querySelector(t);s&&(s.textContent=e)},rC=(i,e)=>{const t=`slot[name="${e}"]`,s=i.shadowRoot.querySelector(t);return s?s.children:[]},ub=(i,e)=>rC(i,e)[0],gs=(i,e)=>!i||!e?!1:i?.contains(e)?!0:gs(i,e.getRootNode().host),Yn=(i,e)=>{if(!i)return null;const t=i.closest(e);return t||Yn(i.getRootNode().host,e)};function gm(i=document){var e;const t=i?.activeElement;return t?(e=gm(t.shadowRoot))!=null?e:t:null}function _u(i){var e;const t=(e=i?.getRootNode)==null?void 0:e.call(i);return t instanceof ShadowRoot||t instanceof Document?t:null}function cb(i,{depth:e=3,checkOpacity:t=!0,checkVisibilityCSS:s=!0}={}){if(i.checkVisibility)return i.checkVisibility({checkOpacity:t,checkVisibilityCSS:s});let r=i;for(;r&&e>0;){const n=getComputedStyle(r);if(t&&n.opacity==="0"||s&&n.visibility==="hidden"||n.display==="none")return!1;r=r.parentElement,e--}return!0}function nC(i,e,t,s){const r=s.x-t.x,n=s.y-t.y,a=r*r+n*n;if(a===0)return 0;const o=((i-t.x)*r+(e-t.y)*n)/a;return Math.max(0,Math.min(1,o))}function ut(i,e){const t=aC(i,s=>s===e);return t||vm(i,e)}function aC(i,e){var t,s;let r;for(r of(t=i.querySelectorAll("style:not([media])"))!=null?t:[]){let n;try{n=(s=r.sheet)==null?void 0:s.cssRules}catch{continue}for(const a of n??[])if(e(a.selectorText))return a}}function vm(i,e){var t,s;const r=(t=i.querySelectorAll("style:not([media])"))!=null?t:[],n=r?.[r.length-1];return n?.sheet?(n?.sheet.insertRule(`${e}{}`,n.sheet.cssRules.length),(s=n.sheet.cssRules)==null?void 0:s[n.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",i),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function Oe(i,e,t=Number.NaN){const s=i.getAttribute(e);return s!=null?+s:t}function Ye(i,e,t){const s=+t;if(t==null||Number.isNaN(s)){i.hasAttribute(e)&&i.removeAttribute(e);return}Oe(i,e,void 0)!==s&&i.setAttribute(e,`${s}`)}function ve(i,e){return i.hasAttribute(e)}function Ee(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}ve(i,e)!=t&&i.toggleAttribute(e,t)}function Ne(i,e,t=null){var s;return(s=i.getAttribute(e))!=null?s:t}function Ue(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}const s=`${t}`;Ne(i,e,void 0)!==s&&i.setAttribute(e,s)}var hb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ts=(i,e,t)=>(hb(i,e,"read from private field"),t?t.call(i):e.get(i)),oC=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Vo=(i,e,t,s)=>(hb(i,e,"write to private field"),e.set(i,t),t),kt;function lC(i){return` + + `}class Au extends k.HTMLElement{constructor(){if(super(),oC(this,kt,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Ae.MEDIA_CONTROLLER,_.MEDIA_PAUSED]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Ae.MEDIA_CONTROLLER&&(t&&((n=(r=Ts(this,kt))==null?void 0:r.unassociateElement)==null||n.call(r,this),Vo(this,kt,null)),s&&this.isConnected&&(Vo(this,kt,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Ts(this,kt))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s,r;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),Vo(this,kt,dC(this)),this.getAttribute(Ae.MEDIA_CONTROLLER)&&((t=(e=Ts(this,kt))==null?void 0:e.associateElement)==null||t.call(e,this)),(s=Ts(this,kt))==null||s.addEventListener("pointerdown",this),(r=Ts(this,kt))==null||r.addEventListener("click",this)}disconnectedCallback(){var e,t,s,r;this.getAttribute(Ae.MEDIA_CONTROLLER)&&((t=(e=Ts(this,kt))==null?void 0:e.unassociateElement)==null||t.call(e,this)),(s=Ts(this,kt))==null||s.removeEventListener("pointerdown",this),(r=Ts(this,kt))==null||r.removeEventListener("click",this),Vo(this,kt,null)}handleEvent(e){var t;const s=(t=e.composedPath())==null?void 0:t[0];if(["video","media-controller"].includes(s?.localName)){if(e.type==="pointerdown")this._pointerType=e.pointerType;else if(e.type==="click"){const{clientX:n,clientY:a}=e,{left:o,top:l,width:d,height:u}=this.getBoundingClientRect(),c=n-o,h=a-l;if(c<0||h<0||c>d||h>u||d===0&&u===0)return;const f=this._pointerType||"mouse";if(this._pointerType=void 0,f===bc.TOUCH){this.handleTap(e);return}else if(f===bc.MOUSE||f===bc.PEN){this.handleMouseClick(e);return}}}}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){const t=this.mediaPaused?Y.MEDIA_PLAY_REQUEST:Y.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new k.CustomEvent(t,{composed:!0,bubbles:!0}))}}kt=new WeakMap;Au.shadowRootOptions={mode:"open"};Au.getTemplateHTML=lC;function dC(i){var e;const t=i.getAttribute(Ae.MEDIA_CONTROLLER);return t?(e=i.getRootNode())==null?void 0:e.getElementById(t):Yn(i,"media-controller")}k.customElements.get("media-gesture-receiver")||k.customElements.define("media-gesture-receiver",Au);var h0=Au,Em=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Kt=(i,e,t)=>(Em(i,e,"read from private field"),t?t.call(i):e.get(i)),Ut=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},sr=(i,e,t,s)=>(Em(i,e,"write to private field"),e.set(i,t),t),ei=(i,e,t)=>(Em(i,e,"access private method"),t),Gd,Xr,ao,bn,Rl,Sh,fb,ya,xl,Ih,mb,Lh,pb,oo,Su,Iu,ym,Kn,lo;const ne={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive",AUTOHIDE_OVER_CONTROLS:"autohideovercontrols"};function uC(i){return` + + + + + + + + + + + + + + + + + + `}const cC=Object.values(_),hC="sm:384 md:576 lg:768 xl:960";function fC(i){gb(i.target,i.contentRect.width)}function gb(i,e){var t;if(!i.isConnected)return;const s=(t=i.getAttribute(ne.BREAKPOINTS))!=null?t:hC,r=mC(s),n=pC(r,e);let a=!1;if(Object.keys(r).forEach(o=>{if(n.includes(o)){i.hasAttribute(`breakpoint${o}`)||(i.setAttribute(`breakpoint${o}`,""),a=!0);return}i.hasAttribute(`breakpoint${o}`)&&(i.removeAttribute(`breakpoint${o}`),a=!0)}),a){const o=new CustomEvent(ms.BREAKPOINTS_CHANGE,{detail:n});i.dispatchEvent(o)}i.breakpointsComputed||(i.breakpointsComputed=!0,i.dispatchEvent(new CustomEvent(ms.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}function mC(i){const e=i.split(/\s+/);return Object.fromEntries(e.map(t=>t.split(":")))}function pC(i,e){return Object.keys(i).filter(t=>e>=parseInt(i[t]))}class Lu extends k.HTMLElement{constructor(){if(super(),Ut(this,Sh),Ut(this,Ih),Ut(this,Lh),Ut(this,oo),Ut(this,Iu),Ut(this,Kn),Ut(this,Gd,0),Ut(this,Xr,null),Ut(this,ao,null),Ut(this,bn,void 0),this.breakpointsComputed=!1,Ut(this,Rl,new MutationObserver(ei(this,Sh,fb).bind(this))),Ut(this,ya,!1),Ut(this,xl,t=>{Kt(this,ya)||(setTimeout(()=>{fC(t),sr(this,ya,!1)},0),sr(this,ya,!0))}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const t=Yt(this.attributes),s=this.constructor.getTemplateHTML(t);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(s):this.shadowRoot.innerHTML=s}const e=this.querySelector(":scope > slot[slot=media]");e&&e.addEventListener("slotchange",()=>{if(!e.assignedElements({flatten:!0}).length){Kt(this,Xr)&&this.mediaUnsetCallback(Kt(this,Xr));return}this.handleMediaUpdated(this.media)})}static get observedAttributes(){return[ne.AUTOHIDE,ne.GESTURES_DISABLED].concat(cC).filter(e=>![_.MEDIA_RENDITION_LIST,_.MEDIA_AUDIO_TRACK_LIST,_.MEDIA_CHAPTERS_CUES,_.MEDIA_WIDTH,_.MEDIA_HEIGHT,_.MEDIA_ERROR,_.MEDIA_ERROR_MESSAGE].includes(e))}attributeChangedCallback(e,t,s){e.toLowerCase()==ne.AUTOHIDE&&(this.autohide=s)}get media(){let e=this.querySelector(":scope > [slot=media]");return e?.nodeName=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(sr(this,Xr,e),e.localName.includes("-")&&await k.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;Kt(this,Rl).observe(this,{childList:!0,subtree:!0}),Hn(this,Kt(this,xl));const t=this.getAttribute(ne.AUDIO)!=null,s=J(t?"audio player":"video player");this.setAttribute("role","region"),this.setAttribute("aria-label",s),this.handleMediaUpdated(this.media),this.setAttribute(ne.USER_INACTIVE,""),gb(this,this.getBoundingClientRect().width),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),(e=k.window)==null||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;Kt(this,Rl).disconnect(),Gn(this,Kt(this,xl)),this.media&&this.mediaUnsetCallback(this.media),(e=k.window)==null||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){sr(this,Xr,null)}handleEvent(e){switch(e.type){case"pointerdown":sr(this,Gd,e.timeStamp);break;case"pointermove":ei(this,Ih,mb).call(this,e);break;case"pointerup":ei(this,Lh,pb).call(this,e);break;case"mouseleave":ei(this,oo,Su).call(this);break;case"mouseup":this.removeAttribute(ne.KEYBOARD_CONTROL);break;case"keyup":ei(this,Kn,lo).call(this),this.setAttribute(ne.KEYBOARD_CONTROL,"");break}}set autohide(e){const t=Number(e);sr(this,bn,isNaN(t)?0:t)}get autohide(){return(Kt(this,bn)===void 0?2:Kt(this,bn)).toString()}get breakpoints(){return Ne(this,ne.BREAKPOINTS)}set breakpoints(e){Ue(this,ne.BREAKPOINTS,e)}get audio(){return ve(this,ne.AUDIO)}set audio(e){Ee(this,ne.AUDIO,e)}get gesturesDisabled(){return ve(this,ne.GESTURES_DISABLED)}set gesturesDisabled(e){Ee(this,ne.GESTURES_DISABLED,e)}get keyboardControl(){return ve(this,ne.KEYBOARD_CONTROL)}set keyboardControl(e){Ee(this,ne.KEYBOARD_CONTROL,e)}get noAutohide(){return ve(this,ne.NO_AUTOHIDE)}set noAutohide(e){Ee(this,ne.NO_AUTOHIDE,e)}get autohideOverControls(){return ve(this,ne.AUTOHIDE_OVER_CONTROLS)}set autohideOverControls(e){Ee(this,ne.AUTOHIDE_OVER_CONTROLS,e)}get userInteractive(){return ve(this,ne.USER_INACTIVE)}set userInteractive(e){Ee(this,ne.USER_INACTIVE,e)}}Gd=new WeakMap;Xr=new WeakMap;ao=new WeakMap;bn=new WeakMap;Rl=new WeakMap;Sh=new WeakSet;fb=function(i){const e=this.media;for(const t of i){if(t.type!=="childList")continue;const s=t.removedNodes;for(const r of s){if(r.slot!="media"||t.target!=this)continue;let n=t.previousSibling&&t.previousSibling.previousElementSibling;if(!n||!e)this.mediaUnsetCallback(r);else{let a=n.slot!=="media";for(;(n=n.previousSibling)!==null;)n.slot=="media"&&(a=!1);a&&this.mediaUnsetCallback(r)}}if(e)for(const r of t.addedNodes)r===e&&this.handleMediaUpdated(e)}};ya=new WeakMap;xl=new WeakMap;Ih=new WeakSet;mb=function(i){if(i.pointerType!=="mouse"&&i.timeStamp-Kt(this,Gd)<250)return;ei(this,Iu,ym).call(this),clearTimeout(Kt(this,ao));const e=this.hasAttribute(ne.AUTOHIDE_OVER_CONTROLS);([this,this.media].includes(i.target)||e)&&ei(this,Kn,lo).call(this)};Lh=new WeakSet;pb=function(i){if(i.pointerType==="touch"){const e=!this.hasAttribute(ne.USER_INACTIVE);[this,this.media].includes(i.target)&&e?ei(this,oo,Su).call(this):ei(this,Kn,lo).call(this)}else i.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(e?.localName))&&ei(this,Kn,lo).call(this)};oo=new WeakSet;Su=function(){if(Kt(this,bn)<0||this.hasAttribute(ne.USER_INACTIVE))return;this.setAttribute(ne.USER_INACTIVE,"");const i=new k.CustomEvent(ms.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(i)};Iu=new WeakSet;ym=function(){if(!this.hasAttribute(ne.USER_INACTIVE))return;this.removeAttribute(ne.USER_INACTIVE);const i=new k.CustomEvent(ms.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(i)};Kn=new WeakSet;lo=function(){ei(this,Iu,ym).call(this),clearTimeout(Kt(this,ao));const i=parseInt(this.autohide);i<0||sr(this,ao,setTimeout(()=>{ei(this,oo,Su).call(this)},i*1e3))};Lu.shadowRootOptions={mode:"open"};Lu.getTemplateHTML=uC;k.customElements.get("media-container")||k.customElements.define("media-container",Lu);var vb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},pt=(i,e,t)=>(vb(i,e,"read from private field"),t?t.call(i):e.get(i)),ta=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Wo=(i,e,t,s)=>(vb(i,e,"write to private field"),e.set(i,t),t),Zr,Jr,Kd,pr,rs,Is;class bm{constructor(e,t,{defaultValue:s}={defaultValue:void 0}){ta(this,rs),ta(this,Zr,void 0),ta(this,Jr,void 0),ta(this,Kd,void 0),ta(this,pr,new Set),Wo(this,Zr,e),Wo(this,Jr,t),Wo(this,Kd,new Set(s))}[Symbol.iterator](){return pt(this,rs,Is).values()}get length(){return pt(this,rs,Is).size}get value(){var e;return(e=[...pt(this,rs,Is)].join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(Wo(this,pr,new Set),this.add(...(t=e?.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return[...pt(this,rs,Is)][e]}values(){return pt(this,rs,Is).values()}forEach(e,t){pt(this,rs,Is).forEach(e,t)}add(...e){var t,s;e.forEach(r=>pt(this,pr).add(r)),!(this.value===""&&!((t=pt(this,Zr))!=null&&t.hasAttribute(`${pt(this,Jr)}`)))&&((s=pt(this,Zr))==null||s.setAttribute(`${pt(this,Jr)}`,`${this.value}`))}remove(...e){var t;e.forEach(s=>pt(this,pr).delete(s)),(t=pt(this,Zr))==null||t.setAttribute(`${pt(this,Jr)}`,`${this.value}`)}contains(e){return pt(this,rs,Is).has(e)}toggle(e,t){return typeof t<"u"?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){return this.remove(e),this.add(t),e===t}}Zr=new WeakMap;Jr=new WeakMap;Kd=new WeakMap;pr=new WeakMap;rs=new WeakSet;Is=function(){return pt(this,pr).size?pt(this,pr):pt(this,Kd)};const gC=(i="")=>i.split(/\s+/),Eb=(i="")=>{const[e,t,s]=i.split(":"),r=s?decodeURIComponent(s):void 0;return{kind:e==="cc"?zi.CAPTIONS:zi.SUBTITLES,language:t,label:r}},Ru=(i="",e={})=>gC(i).map(t=>{const s=Eb(t);return{...e,...s}}),yb=i=>i?Array.isArray(i)?i.map(e=>typeof e=="string"?Eb(e):e):typeof i=="string"?Ru(i):[i]:[],Rh=({kind:i,label:e,language:t}={kind:"subtitles"})=>e?`${i==="captions"?"cc":"sb"}:${t}:${encodeURIComponent(e)}`:t,uo=(i=[])=>Array.prototype.map.call(i,Rh).join(" "),vC=(i,e)=>t=>t[i]===e,bb=i=>{const e=Object.entries(i).map(([t,s])=>vC(t,s));return t=>e.every(s=>s(t))},Ga=(i,e=[],t=[])=>{const s=yb(t).map(bb),r=n=>s.some(a=>a(n));Array.from(e).filter(r).forEach(n=>{n.mode=i})},xu=(i,e=()=>!0)=>{if(!i?.textTracks)return[];const t=typeof e=="function"?e:bb(e);return Array.from(i.textTracks).filter(t)},Tb=i=>{var e;return!!((e=i.mediaSubtitlesShowing)!=null&&e.length)||i.hasAttribute(_.MEDIA_SUBTITLES_SHOWING)},EC=i=>{var e;const{media:t,fullscreenElement:s}=i;try{const r=s&&"requestFullscreen"in s?"requestFullscreen":s&&"webkitRequestFullScreen"in s?"webkitRequestFullScreen":void 0;if(r){const n=(e=s[r])==null?void 0:e.call(s);if(n instanceof Promise)return n.catch(()=>{})}else t?.webkitEnterFullscreen?t.webkitEnterFullscreen():t?.requestFullscreen&&t.requestFullscreen()}catch(r){console.error(r)}},f0="exitFullscreen"in tt?"exitFullscreen":"webkitExitFullscreen"in tt?"webkitExitFullscreen":"webkitCancelFullScreen"in tt?"webkitCancelFullScreen":void 0,yC=i=>{var e;const{documentElement:t}=i;if(f0){const s=(e=t?.[f0])==null?void 0:e.call(t);if(s instanceof Promise)return s.catch(()=>{})}},ba="fullscreenElement"in tt?"fullscreenElement":"webkitFullscreenElement"in tt?"webkitFullscreenElement":void 0,bC=i=>{const{documentElement:e,media:t}=i,s=e?.[ba];return!s&&"webkitDisplayingFullscreen"in t&&"webkitPresentationMode"in t&&t.webkitDisplayingFullscreen&&t.webkitPresentationMode===KD.FULLSCREEN?t:s},TC=i=>{var e;const{media:t,documentElement:s,fullscreenElement:r=t}=i;if(!t||!s)return!1;const n=bC(i);if(!n)return!1;if(n===r||n===t)return!0;if(n.localName.includes("-")){let a=n.shadowRoot;if(!(ba in a))return gs(n,r);for(;a?.[ba];){if(a[ba]===r)return!0;a=(e=a[ba])==null?void 0:e.shadowRoot}}return!1},_C="fullscreenEnabled"in tt?"fullscreenEnabled":"webkitFullscreenEnabled"in tt?"webkitFullscreenEnabled":void 0,AC=i=>{const{documentElement:e,media:t}=i;return!!e?.[_C]||t&&"webkitSupportsFullscreen"in t};let qo;const Tm=()=>{var i,e;return qo||(qo=(e=(i=tt)==null?void 0:i.createElement)==null?void 0:e.call(i,"video"),qo)},SC=async(i=Tm())=>{if(!i)return!1;const e=i.volume;i.volume=e/2+.1;const t=new AbortController,s=await Promise.race([IC(i,t.signal),LC(i,e)]);return t.abort(),s},IC=(i,e)=>new Promise(t=>{i.addEventListener("volumechange",()=>t(!0),{signal:e})}),LC=async(i,e)=>{for(let t=0;t<10;t++){if(i.volume===e)return!1;await ib(10)}return i.volume!==e},RC=/.*Version\/.*Safari\/.*/.test(k.navigator.userAgent),_b=(i=Tm())=>k.matchMedia("(display-mode: standalone)").matches&&RC?!1:typeof i?.requestPictureInPicture=="function",Ab=(i=Tm())=>AC({documentElement:tt,media:i}),xC=Ab(),kC=_b(),DC=!!k.WebKitPlaybackTargetAvailabilityEvent,CC=!!k.chrome,Vd=i=>xu(i.media,e=>[zi.SUBTITLES,zi.CAPTIONS].includes(e.kind)).sort((e,t)=>e.kind>=t.kind?1:-1),Sb=i=>xu(i.media,e=>e.mode===Dn.SHOWING&&[zi.SUBTITLES,zi.CAPTIONS].includes(e.kind)),Ib=(i,e)=>{const t=Vd(i),s=Sb(i),r=!!s.length;if(t.length){if(e===!1||r&&e!==!0)Ga(Dn.DISABLED,t,s);else if(e===!0||!r&&e!==!1){let n=t[0];const{options:a}=i;if(!a?.noSubtitlesLangPref){const u=globalThis.localStorage.getItem("media-chrome-pref-subtitles-lang"),c=u?[u,...globalThis.navigator.languages]:globalThis.navigator.languages,h=t.filter(f=>c.some(m=>f.language.toLowerCase().startsWith(m.split("-")[0]))).sort((f,m)=>{const p=c.findIndex(v=>f.language.toLowerCase().startsWith(v.split("-")[0])),g=c.findIndex(v=>m.language.toLowerCase().startsWith(v.split("-")[0]));return p-g});h[0]&&(n=h[0])}const{language:o,label:l,kind:d}=n;Ga(Dn.DISABLED,t,s),Ga(Dn.SHOWING,t,[{language:o,label:l,kind:d}])}}},_m=(i,e)=>i===e?!0:i==null||e==null||typeof i!=typeof e?!1:typeof i=="number"&&Number.isNaN(i)&&Number.isNaN(e)?!0:typeof i!="object"?!1:Array.isArray(i)?wC(i,e):Object.entries(i).every(([t,s])=>t in e&&_m(s,e[t])),wC=(i,e)=>{const t=Array.isArray(i),s=Array.isArray(e);return t!==s?!1:t||s?i.length!==e.length?!1:i.every((r,n)=>_m(r,e[n])):!0},MC=Object.values(ls);let Wd;const PC=SC().then(i=>(Wd=i,Wd)),OC=async(...i)=>{await Promise.all(i.filter(e=>e).map(async e=>{if(!("localName"in e&&e instanceof k.HTMLElement))return;const t=e.localName;if(!t.includes("-"))return;const s=k.customElements.get(t);s&&e instanceof s||(await k.customElements.whenDefined(t),k.customElements.upgrade(e))}))},NC=new k.DOMParser,UC=i=>i&&(NC.parseFromString(i,"text/html").body.textContent||i),Ta={mediaError:{get(i,e){const{media:t}=i;if(e?.type!=="playing")return t?.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(i,e){var t;const{media:s}=i;if(e?.type!=="playing")return(t=s?.error)==null?void 0:t.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(i,e){var t,s;const{media:r}=i;if(e?.type!=="playing")return(s=(t=r?.error)==null?void 0:t.message)!=null?s:""},mediaEvents:["emptied","error","playing"]},mediaWidth:{get(i){var e;const{media:t}=i;return(e=t?.videoWidth)!=null?e:0},mediaEvents:["resize"]},mediaHeight:{get(i){var e;const{media:t}=i;return(e=t?.videoHeight)!=null?e:0},mediaEvents:["resize"]},mediaPaused:{get(i){var e;const{media:t}=i;return(e=t?.paused)!=null?e:!0},set(i,e){var t;const{media:s}=e;s&&(i?s.pause():(t=s.play())==null||t.catch(()=>{}))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(i,e){const{media:t}=i;return t?e?e.type==="playing":!t.paused:!1},mediaEvents:["playing","emptied"]},mediaEnded:{get(i){var e;const{media:t}=i;return(e=t?.ended)!=null?e:!1},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(i){var e;const{media:t}=i;return(e=t?.playbackRate)!=null?e:1},set(i,e){const{media:t}=e;t&&Number.isFinite(+i)&&(t.playbackRate=+i)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(i){var e;const{media:t}=i;return(e=t?.muted)!=null?e:!1},set(i,e){const{media:t,options:{noMutedPref:s}={}}=e;if(t){t.muted=i;try{const r=k.localStorage.getItem("media-chrome-pref-muted")!==null,n=t.hasAttribute("muted");if(s){r&&k.localStorage.removeItem("media-chrome-pref-muted");return}if(n&&!r)return;k.localStorage.setItem("media-chrome-pref-muted",i?"true":"false")}catch(r){console.debug("Error setting muted pref",r)}}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,e)=>{const{options:{noMutedPref:t}}=e,{media:s}=e;if(!(!s||s.muted||t))try{const r=k.localStorage.getItem("media-chrome-pref-muted")==="true";Ta.mediaMuted.set(r,e),i(r)}catch(r){console.debug("Error getting muted pref",r)}}]},mediaLoop:{get(i){const{media:e}=i;return e?.loop},set(i,e){const{media:t}=e;t&&(t.loop=i)},mediaEvents:["medialooprequest"]},mediaVolume:{get(i){var e;const{media:t}=i;return(e=t?.volume)!=null?e:1},set(i,e){const{media:t,options:{noVolumePref:s}={}}=e;if(t){try{i==null?k.localStorage.removeItem("media-chrome-pref-volume"):!t.hasAttribute("muted")&&!s&&k.localStorage.setItem("media-chrome-pref-volume",i.toString())}catch(r){console.debug("Error setting volume pref",r)}Number.isFinite(+i)&&(t.volume=+i)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,e)=>{const{options:{noVolumePref:t}}=e;if(!t)try{const{media:s}=e;if(!s)return;const r=k.localStorage.getItem("media-chrome-pref-volume");if(r==null)return;Ta.mediaVolume.set(+r,e),i(+r)}catch(s){console.debug("Error getting volume pref",s)}}]},mediaVolumeLevel:{get(i){const{media:e}=i;return typeof e?.volume>"u"?"high":e.muted||e.volume===0?"off":e.volume<.5?"low":e.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(i){var e;const{media:t}=i;return(e=t?.currentTime)!=null?e:0},set(i,e){const{media:t}=e;!t||!mm(i)||(t.currentTime=i)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(i){const{media:e,options:{defaultDuration:t}={}}=i;return t&&(!e||!e.duration||Number.isNaN(e.duration)||!Number.isFinite(e.duration))?t:Number.isFinite(e?.duration)?e.duration:Number.NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(i){const{media:e}=i;return e?.readyState<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(i){var e;const{media:t}=i;if(!((e=t?.seekable)!=null&&e.length))return;const s=t.seekable.start(0),r=t.seekable.end(t.seekable.length-1);if(!(!s&&!r))return[Number(s.toFixed(3)),Number(r.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(i){var e;const{media:t}=i,s=(e=t?.buffered)!=null?e:[];return Array.from(s).map((r,n)=>[Number(s.start(n).toFixed(3)),Number(s.end(n).toFixed(3))])},mediaEvents:["progress","emptied"]},mediaStreamType:{get(i){const{media:e,options:{defaultStreamType:t}={}}=i,s=[ls.LIVE,ls.ON_DEMAND].includes(t)?t:void 0;if(!e)return s;const{streamType:r}=e;if(MC.includes(r))return r===ls.UNKNOWN?s:r;const n=e.duration;return n===1/0?ls.LIVE:Number.isFinite(n)?ls.ON_DEMAND:s},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(i){const{media:e}=i;if(!e)return Number.NaN;const{targetLiveWindow:t}=e,s=Ta.mediaStreamType.get(i);return(t==null||Number.isNaN(t))&&s===ls.LIVE?0:t},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(i){const{media:e,options:{liveEdgeOffset:t=10}={}}=i;if(!e)return!1;if(typeof e.liveEdgeStart=="number")return Number.isNaN(e.liveEdgeStart)?!1:e.currentTime>=e.liveEdgeStart;if(!(Ta.mediaStreamType.get(i)===ls.LIVE))return!1;const r=e.seekable;if(!r)return!0;if(!r.length)return!1;const n=r.end(r.length-1)-t;return e.currentTime>=n},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},mediaSubtitlesList:{get(i){return Vd(i).map(({kind:e,label:t,language:s})=>({kind:e,label:t,language:s}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get(i){return Sb(i).map(({kind:e,label:t,language:s})=>({kind:e,label:t,language:s}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(i,e)=>{var t,s;const{media:r,options:n}=e;if(!r)return;const a=o=>{var l;!n.defaultSubtitles||o&&![zi.CAPTIONS,zi.SUBTITLES].includes((l=o?.track)==null?void 0:l.kind)||Ib(e,!0)};return r.addEventListener("loadstart",a),(t=r.textTracks)==null||t.addEventListener("addtrack",a),(s=r.textTracks)==null||s.addEventListener("removetrack",a),()=>{var o,l;r.removeEventListener("loadstart",a),(o=r.textTracks)==null||o.removeEventListener("addtrack",a),(l=r.textTracks)==null||l.removeEventListener("removetrack",a)}}]},mediaChaptersCues:{get(i){var e;const{media:t}=i;if(!t)return[];const[s]=xu(t,{kind:zi.CHAPTERS});return Array.from((e=s?.cues)!=null?e:[]).map(({text:r,startTime:n,endTime:a})=>({text:UC(r),startTime:n,endTime:a}))},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;if(!s)return;const r=s.querySelector('track[kind="chapters"][default][src]'),n=(t=s.shadowRoot)==null?void 0:t.querySelector(':is(video,audio) > track[kind="chapters"][default][src]');return r?.addEventListener("load",i),n?.addEventListener("load",i),()=>{r?.removeEventListener("load",i),n?.removeEventListener("load",i)}}]},mediaIsPip:{get(i){var e,t;const{media:s,documentElement:r}=i;if(!s||!r||!r.pictureInPictureElement)return!1;if(r.pictureInPictureElement===s)return!0;if(r.pictureInPictureElement instanceof HTMLMediaElement)return(e=s.localName)!=null&&e.includes("-")?gs(s,r.pictureInPictureElement):!1;if(r.pictureInPictureElement.localName.includes("-")){let n=r.pictureInPictureElement.shadowRoot;for(;n?.pictureInPictureElement;){if(n.pictureInPictureElement===s)return!0;n=(t=n.pictureInPictureElement)==null?void 0:t.shadowRoot}}return!1},set(i,e){const{media:t}=e;if(t)if(i){if(!tt.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!t.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}const s=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};t.requestPictureInPicture().catch(r=>{if(r.code===11){if(!t.src){console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a src set.");return}if(t.readyState===0&&t.preload==="none"){const n=()=>{t.removeEventListener("loadedmetadata",a),t.preload="none"},a=()=>{t.requestPictureInPicture().catch(s),n()};t.addEventListener("loadedmetadata",a),t.preload="metadata",setTimeout(()=>{t.readyState===0&&s(),n()},1e3)}else throw r}else throw r})}else tt.pictureInPictureElement&&tt.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(i){var e;const{media:t}=i;return[...(e=t?.videoRenditions)!=null?e:[]].map(s=>({...s}))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(i){var e,t,s;const{media:r}=i;return(s=(t=r?.videoRenditions)==null?void 0:t[(e=r.videoRenditions)==null?void 0:e.selectedIndex])==null?void 0:s.id},set(i,e){const{media:t}=e;if(!t?.videoRenditions){console.warn("MediaController: Rendition selection not supported by this media.");return}const s=i,r=Array.prototype.findIndex.call(t.videoRenditions,n=>n.id==s);t.videoRenditions.selectedIndex!=r&&(t.videoRenditions.selectedIndex=r)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(i){var e;const{media:t}=i;return[...(e=t?.audioTracks)!=null?e:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(i){var e,t;const{media:s}=i;return(t=[...(e=s?.audioTracks)!=null?e:[]].find(r=>r.enabled))==null?void 0:t.id},set(i,e){const{media:t}=e;if(!t?.audioTracks){console.warn("MediaChrome: Audio track selection not supported by this media.");return}const s=i;for(const r of t.audioTracks)r.enabled=s==r.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get(i){return TC(i)},set(i,e,t){var s;i?(EC(e),t.detail&&((s=e.media)==null||s.focus())):yC(e)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(i){var e;const{media:t}=i;return!t?.remote||((e=t.remote)==null?void 0:e.state)==="disconnected"?!1:!!t.remote.state},set(i,e){var t,s;const{media:r}=e;if(r&&!(i&&((t=r.remote)==null?void 0:t.state)!=="disconnected")&&!(!i&&((s=r.remote)==null?void 0:s.state)!=="connected")){if(typeof r.remote.prompt!="function"){console.warn("MediaChrome: Casting is not supported in this environment");return}r.remote.prompt().catch(()=>{})}},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get(){return!1},set(i,e){const{media:t}=e;if(t){if(!(t.webkitShowPlaybackTargetPicker&&k.WebKitPlaybackTargetAvailabilityEvent)){console.error("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment");return}t.webkitShowPlaybackTargetPicker()}},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(i){const{media:e}=i;if(!xC||!Ab(e))return Nt.UNSUPPORTED}},mediaPipUnavailable:{get(i){const{media:e}=i;if(!kC||!_b(e))return Nt.UNSUPPORTED;if(e?.disablePictureInPicture)return Nt.UNAVAILABLE}},mediaVolumeUnavailable:{get(i){const{media:e}=i;if(Wd===!1||e?.volume==null)return Nt.UNSUPPORTED},stateOwnersUpdateHandlers:[i=>{Wd==null&&PC.then(e=>i(e?void 0:Nt.UNSUPPORTED))}]},mediaCastUnavailable:{get(i,{availability:e="not-available"}={}){var t;const{media:s}=i;if(!CC||!((t=s?.remote)!=null&&t.state))return Nt.UNSUPPORTED;if(!(e==null||e==="available"))return Nt.UNAVAILABLE},stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;return s?(s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(t=s?.remote)==null||t.watchAvailability(n=>{i({availability:n?"available":"not-available"})}).catch(n=>{n.name==="NotSupportedError"?i({availability:null}):i({availability:"not-available"})}),()=>{var n;(n=s?.remote)==null||n.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaAirplayUnavailable:{get(i,e){if(!DC)return Nt.UNSUPPORTED;if(e?.availability==="not-available")return Nt.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;return s?(s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(t=s?.remote)==null||t.watchAvailability(n=>{i({availability:n?"available":"not-available"})}).catch(n=>{n.name==="NotSupportedError"?i({availability:null}):i({availability:"not-available"})}),()=>{var n;(n=s?.remote)==null||n.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaRenditionUnavailable:{get(i){var e;const{media:t}=i;if(!t?.videoRenditions)return Nt.UNSUPPORTED;if(!((e=t.videoRenditions)!=null&&e.length))return Nt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(i){var e,t;const{media:s}=i;if(!s?.audioTracks)return Nt.UNSUPPORTED;if(((t=(e=s.audioTracks)==null?void 0:e.length)!=null?t:0)<=1)return Nt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaLang:{get(i){const{options:{mediaLang:e}={}}=i;return e??"en"}}},$C={[Y.MEDIA_PREVIEW_REQUEST](i,e,{detail:t}){var s,r,n;const{media:a}=e,o=t??void 0;let l,d;if(a&&o!=null){const[f]=xu(a,{kind:zi.METADATA,label:"thumbnails"}),m=Array.prototype.find.call((s=f?.cues)!=null?s:[],(p,g,v)=>g===0?p.endTime>o:g===v.length-1?p.startTime<=o:p.startTime<=o&&p.endTime>o);if(m){const p=/'^(?:[a-z]+:)?\/\//i.test(m.text)||(r=a?.querySelector('track[label="thumbnails"]'))==null?void 0:r.src,g=new URL(m.text,p);d=new URLSearchParams(g.hash).get("#xywh").split(",").map(b=>+b),l=g.href}}const u=i.mediaDuration.get(e);let h=(n=i.mediaChaptersCues.get(e).find((f,m,p)=>m===p.length-1&&u===f.endTime?f.startTime<=o&&f.endTime>=o:f.startTime<=o&&f.endTime>o))==null?void 0:n.text;return t!=null&&h==null&&(h=""),{mediaPreviewTime:o,mediaPreviewImage:l,mediaPreviewCoords:d,mediaPreviewChapter:h}},[Y.MEDIA_PAUSE_REQUEST](i,e){i["mediaPaused"].set(!0,e)},[Y.MEDIA_PLAY_REQUEST](i,e){var t,s,r,n;const a="mediaPaused",l=i.mediaStreamType.get(e)===ls.LIVE,d=!((t=e.options)!=null&&t.noAutoSeekToLive),u=i.mediaTargetLiveWindow.get(e)>0;if(l&&d&&!u){const c=(s=i.mediaSeekable.get(e))==null?void 0:s[1];if(c){const h=(n=(r=e.options)==null?void 0:r.seekToLiveOffset)!=null?n:0,f=c-h;i.mediaCurrentTime.set(f,e)}}i[a].set(!1,e)},[Y.MEDIA_PLAYBACK_RATE_REQUEST](i,e,{detail:t}){const s="mediaPlaybackRate",r=t;i[s].set(r,e)},[Y.MEDIA_MUTE_REQUEST](i,e){i["mediaMuted"].set(!0,e)},[Y.MEDIA_UNMUTE_REQUEST](i,e){const t="mediaMuted";i.mediaVolume.get(e)||i.mediaVolume.set(.25,e),i[t].set(!1,e)},[Y.MEDIA_LOOP_REQUEST](i,e,{detail:t}){const s="mediaLoop",r=!!t;return i[s].set(r,e),{mediaLoop:r}},[Y.MEDIA_VOLUME_REQUEST](i,e,{detail:t}){const s="mediaVolume",r=t;r&&i.mediaMuted.get(e)&&i.mediaMuted.set(!1,e),i[s].set(r,e)},[Y.MEDIA_SEEK_REQUEST](i,e,{detail:t}){const s="mediaCurrentTime",r=t;i[s].set(r,e)},[Y.MEDIA_SEEK_TO_LIVE_REQUEST](i,e){var t,s,r;const n="mediaCurrentTime",a=(t=i.mediaSeekable.get(e))==null?void 0:t[1];if(Number.isNaN(Number(a)))return;const o=(r=(s=e.options)==null?void 0:s.seekToLiveOffset)!=null?r:0,l=a-o;i[n].set(l,e)},[Y.MEDIA_SHOW_SUBTITLES_REQUEST](i,e,{detail:t}){var s;const{options:r}=e,n=Vd(e),a=yb(t),o=(s=a[0])==null?void 0:s.language;o&&!r.noSubtitlesLangPref&&k.localStorage.setItem("media-chrome-pref-subtitles-lang",o),Ga(Dn.SHOWING,n,a)},[Y.MEDIA_DISABLE_SUBTITLES_REQUEST](i,e,{detail:t}){const s=Vd(e),r=t??[];Ga(Dn.DISABLED,s,r)},[Y.MEDIA_TOGGLE_SUBTITLES_REQUEST](i,e,{detail:t}){Ib(e,t)},[Y.MEDIA_RENDITION_REQUEST](i,e,{detail:t}){const s="mediaRenditionSelected",r=t;i[s].set(r,e)},[Y.MEDIA_AUDIO_TRACK_REQUEST](i,e,{detail:t}){const s="mediaAudioTrackEnabled",r=t;i[s].set(r,e)},[Y.MEDIA_ENTER_PIP_REQUEST](i,e){const t="mediaIsPip";i.mediaIsFullscreen.get(e)&&i.mediaIsFullscreen.set(!1,e),i[t].set(!0,e)},[Y.MEDIA_EXIT_PIP_REQUEST](i,e){i["mediaIsPip"].set(!1,e)},[Y.MEDIA_ENTER_FULLSCREEN_REQUEST](i,e,t){const s="mediaIsFullscreen";i.mediaIsPip.get(e)&&i.mediaIsPip.set(!1,e),i[s].set(!0,e,t)},[Y.MEDIA_EXIT_FULLSCREEN_REQUEST](i,e){i["mediaIsFullscreen"].set(!1,e)},[Y.MEDIA_ENTER_CAST_REQUEST](i,e){const t="mediaIsCasting";i.mediaIsFullscreen.get(e)&&i.mediaIsFullscreen.set(!1,e),i[t].set(!0,e)},[Y.MEDIA_EXIT_CAST_REQUEST](i,e){i["mediaIsCasting"].set(!1,e)},[Y.MEDIA_AIRPLAY_REQUEST](i,e){i["mediaIsAirplaying"].set(!0,e)}},FC=({media:i,fullscreenElement:e,documentElement:t,stateMediator:s=Ta,requestMap:r=$C,options:n={},monitorStateOwnersOnlyWithSubscriptions:a=!0})=>{const o=[],l={options:{...n}};let d=Object.freeze({mediaPreviewTime:void 0,mediaPreviewImage:void 0,mediaPreviewCoords:void 0,mediaPreviewChapter:void 0});const u=p=>{p!=null&&(_m(p,d)||(d=Object.freeze({...d,...p}),o.forEach(g=>g(d))))},c=()=>{const p=Object.entries(s).reduce((g,[v,{get:b}])=>(g[v]=b(l),g),{});u(p)},h={};let f;const m=async(p,g)=>{var v,b,y,T,A,L,S,R,x,I,M,F,V,j,H,N;const q=!!f;if(f={...l,...f??{},...p},q)return;await OC(...Object.values(p));const B=o.length>0&&g===0&&a,z=l.media!==f.media,ee=((v=l.media)==null?void 0:v.textTracks)!==((b=f.media)==null?void 0:b.textTracks),U=((y=l.media)==null?void 0:y.videoRenditions)!==((T=f.media)==null?void 0:T.videoRenditions),$=((A=l.media)==null?void 0:A.audioTracks)!==((L=f.media)==null?void 0:L.audioTracks),re=((S=l.media)==null?void 0:S.remote)!==((R=f.media)==null?void 0:R.remote),pe=l.documentElement!==f.documentElement,ue=!!l.media&&(z||B),fe=!!((x=l.media)!=null&&x.textTracks)&&(ee||B),st=!!((I=l.media)!=null&&I.videoRenditions)&&(U||B),Qe=!!((M=l.media)!=null&&M.audioTracks)&&($||B),It=!!((F=l.media)!=null&&F.remote)&&(re||B),Pt=!!l.documentElement&&(pe||B),ni=ue||fe||st||Qe||It||Pt,vs=o.length===0&&g===1&&a,wr=!!f.media&&(z||vs),Mr=!!((V=f.media)!=null&&V.textTracks)&&(ee||vs),$u=!!((j=f.media)!=null&&j.videoRenditions)&&(U||vs),ye=!!((H=f.media)!=null&&H.audioTracks)&&($||vs),rt=!!((N=f.media)!=null&&N.remote)&&(re||vs),Lt=!!f.documentElement&&(pe||vs),Ti=wr||Mr||$u||ye||rt||Lt;if(!(ni||Ti)){Object.entries(f).forEach(([be,Ot])=>{l[be]=Ot}),c(),f=void 0;return}Object.entries(s).forEach(([be,{get:Ot,mediaEvents:To=[],textTracksEvents:Pr=[],videoRenditionsEvents:_o=[],audioTracksEvents:js=[],remoteEvents:Ao=[],rootEvents:Fu=[],stateOwnersUpdateHandlers:So=[]}])=>{h[be]||(h[be]={});const _t=He=>{const Xe=Ot(l,He);u({[be]:Xe})};let Be;Be=h[be].mediaEvents,To.forEach(He=>{Be&&ue&&(l.media.removeEventListener(He,Be),h[be].mediaEvents=void 0),wr&&(f.media.addEventListener(He,_t),h[be].mediaEvents=_t)}),Be=h[be].textTracksEvents,Pr.forEach(He=>{var Xe,ai;Be&&fe&&((Xe=l.media.textTracks)==null||Xe.removeEventListener(He,Be),h[be].textTracksEvents=void 0),Mr&&((ai=f.media.textTracks)==null||ai.addEventListener(He,_t),h[be].textTracksEvents=_t)}),Be=h[be].videoRenditionsEvents,_o.forEach(He=>{var Xe,ai;Be&&st&&((Xe=l.media.videoRenditions)==null||Xe.removeEventListener(He,Be),h[be].videoRenditionsEvents=void 0),$u&&((ai=f.media.videoRenditions)==null||ai.addEventListener(He,_t),h[be].videoRenditionsEvents=_t)}),Be=h[be].audioTracksEvents,js.forEach(He=>{var Xe,ai;Be&&Qe&&((Xe=l.media.audioTracks)==null||Xe.removeEventListener(He,Be),h[be].audioTracksEvents=void 0),ye&&((ai=f.media.audioTracks)==null||ai.addEventListener(He,_t),h[be].audioTracksEvents=_t)}),Be=h[be].remoteEvents,Ao.forEach(He=>{var Xe,ai;Be&&It&&((Xe=l.media.remote)==null||Xe.removeEventListener(He,Be),h[be].remoteEvents=void 0),rt&&((ai=f.media.remote)==null||ai.addEventListener(He,_t),h[be].remoteEvents=_t)}),Be=h[be].rootEvents,Fu.forEach(He=>{Be&&Pt&&(l.documentElement.removeEventListener(He,Be),h[be].rootEvents=void 0),Lt&&(f.documentElement.addEventListener(He,_t),h[be].rootEvents=_t)});const Io=h[be].stateOwnersUpdateHandlers;if(Io&&ni&&(Array.isArray(Io)?Io:[Io]).forEach(Xe=>{typeof Xe=="function"&&Xe()}),Ti){const He=So.map(Xe=>Xe(_t,f)).filter(Xe=>typeof Xe=="function");h[be].stateOwnersUpdateHandlers=He.length===1?He[0]:He}else ni&&(h[be].stateOwnersUpdateHandlers=void 0)}),Object.entries(f).forEach(([be,Ot])=>{l[be]=Ot}),c(),f=void 0};return m({media:i,fullscreenElement:e,documentElement:t,options:n}),{dispatch(p){const{type:g,detail:v}=p;if(r[g]&&d.mediaErrorCode==null){u(r[g](s,l,p));return}g==="mediaelementchangerequest"?m({media:v}):g==="fullscreenelementchangerequest"?m({fullscreenElement:v}):g==="documentelementchangerequest"?m({documentElement:v}):g==="optionschangerequest"&&(Object.entries(v??{}).forEach(([b,y])=>{l.options[b]=y}),c())},getState(){return d},subscribe(p){return m({},o.length+1),o.push(p),p(d),()=>{const g=o.indexOf(p);g>=0&&(m({},o.length-1),o.splice(g,1))}}}};var Am=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ae=(i,e,t)=>(Am(i,e,"read from private field"),t?t.call(i):e.get(i)),zt=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},xi=(i,e,t,s)=>(Am(i,e,"write to private field"),e.set(i,t),t),Hi=(i,e,t)=>(Am(i,e,"access private method"),t),Us,_a,Te,gr,Aa,ki,kl,Sa,Dl,xh,_r,Cn,Cl,kh,Dh,Lb;const Rb=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Enter"," ","f","m","k","c","l","j",">","<","p"],m0=10,p0=.025,g0=.25,BC=.25,HC=2,G={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",DEFAULT_DURATION:"defaultduration",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYBOARD_BACKWARD_SEEK_OFFSET:"keyboardbackwardseekoffset",KEYBOARD_FORWARD_SEEK_OFFSET:"keyboardforwardseekoffset",KEYBOARD_DOWN_VOLUME_STEP:"keyboarddownvolumestep",KEYBOARD_UP_VOLUME_STEP:"keyboardupvolumestep",KEYS_USED:"keysused",LANG:"lang",LOOP:"loop",LIVE_EDGE_OFFSET:"liveedgeoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_DEFAULT_STORE:"nodefaultstore",NO_HOTKEYS:"nohotkeys",NO_MUTED_PREF:"nomutedpref",NO_SUBTITLES_LANG_PREF:"nosubtitleslangpref",NO_VOLUME_PREF:"novolumepref",SEEK_TO_LIVE_OFFSET:"seektoliveoffset"};class xb extends Lu{constructor(){super(),zt(this,Dl),zt(this,_r),zt(this,Cl),zt(this,Dh),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,zt(this,Us,new bm(this,G.HOTKEYS)),zt(this,_a,void 0),zt(this,Te,void 0),zt(this,gr,null),zt(this,Aa,void 0),zt(this,ki,void 0),zt(this,kl,t=>{var s;(s=ae(this,Te))==null||s.dispatch(t)}),zt(this,Sa,void 0),this.associateElement(this);let e={};xi(this,Aa,t=>{Object.entries(t).forEach(([s,r])=>{if(s in e&&e[s]===r)return;this.propagateMediaState(s,r);const n=s.toLowerCase(),a=new k.CustomEvent(GD[n],{composed:!0,detail:r});this.dispatchEvent(a)}),e=t}),this.hasAttribute(G.NO_HOTKEYS)?this.disableHotkeys():this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(G.NO_HOTKEYS,G.HOTKEYS,G.DEFAULT_STREAM_TYPE,G.DEFAULT_SUBTITLES,G.DEFAULT_DURATION,G.NO_MUTED_PREF,G.NO_VOLUME_PREF,G.LANG,G.LOOP)}get mediaStore(){return ae(this,Te)}set mediaStore(e){var t,s;if(ae(this,Te)&&((t=ae(this,ki))==null||t.call(this),xi(this,ki,void 0)),xi(this,Te,e),!ae(this,Te)&&!this.hasAttribute(G.NO_DEFAULT_STORE)){Hi(this,Dl,xh).call(this);return}xi(this,ki,(s=ae(this,Te))==null?void 0:s.subscribe(ae(this,Aa)))}get fullscreenElement(){var e;return(e=ae(this,_a))!=null?e:this}set fullscreenElement(e){var t;this.hasAttribute(G.FULLSCREEN_ELEMENT)&&this.removeAttribute(G.FULLSCREEN_ELEMENT),xi(this,_a,e),(t=ae(this,Te))==null||t.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return ve(this,G.DEFAULT_SUBTITLES)}set defaultSubtitles(e){Ee(this,G.DEFAULT_SUBTITLES,e)}get defaultStreamType(){return Ne(this,G.DEFAULT_STREAM_TYPE)}set defaultStreamType(e){Ue(this,G.DEFAULT_STREAM_TYPE,e)}get defaultDuration(){return Oe(this,G.DEFAULT_DURATION)}set defaultDuration(e){Ye(this,G.DEFAULT_DURATION,e)}get noHotkeys(){return ve(this,G.NO_HOTKEYS)}set noHotkeys(e){Ee(this,G.NO_HOTKEYS,e)}get keysUsed(){return Ne(this,G.KEYS_USED)}set keysUsed(e){Ue(this,G.KEYS_USED,e)}get liveEdgeOffset(){return Oe(this,G.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){Ye(this,G.LIVE_EDGE_OFFSET,e)}get noAutoSeekToLive(){return ve(this,G.NO_AUTO_SEEK_TO_LIVE)}set noAutoSeekToLive(e){Ee(this,G.NO_AUTO_SEEK_TO_LIVE,e)}get noVolumePref(){return ve(this,G.NO_VOLUME_PREF)}set noVolumePref(e){Ee(this,G.NO_VOLUME_PREF,e)}get noMutedPref(){return ve(this,G.NO_MUTED_PREF)}set noMutedPref(e){Ee(this,G.NO_MUTED_PREF,e)}get noSubtitlesLangPref(){return ve(this,G.NO_SUBTITLES_LANG_PREF)}set noSubtitlesLangPref(e){Ee(this,G.NO_SUBTITLES_LANG_PREF,e)}get noDefaultStore(){return ve(this,G.NO_DEFAULT_STORE)}set noDefaultStore(e){Ee(this,G.NO_DEFAULT_STORE,e)}attributeChangedCallback(e,t,s){var r,n,a,o,l,d,u,c,h,f,m,p;if(super.attributeChangedCallback(e,t,s),e===G.NO_HOTKEYS)s!==t&&s===""?(this.hasAttribute(G.HOTKEYS)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):s!==t&&s===null&&this.enableHotkeys();else if(e===G.HOTKEYS)ae(this,Us).value=s;else if(e===G.DEFAULT_SUBTITLES&&s!==t)(r=ae(this,Te))==null||r.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(G.DEFAULT_SUBTITLES)}});else if(e===G.DEFAULT_STREAM_TYPE)(a=ae(this,Te))==null||a.dispatch({type:"optionschangerequest",detail:{defaultStreamType:(n=this.getAttribute(G.DEFAULT_STREAM_TYPE))!=null?n:void 0}});else if(e===G.LIVE_EDGE_OFFSET)(o=ae(this,Te))==null||o.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(G.LIVE_EDGE_OFFSET)?+this.getAttribute(G.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(G.SEEK_TO_LIVE_OFFSET)?void 0:+this.getAttribute(G.LIVE_EDGE_OFFSET)}});else if(e===G.SEEK_TO_LIVE_OFFSET)(l=ae(this,Te))==null||l.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(G.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(G.SEEK_TO_LIVE_OFFSET):void 0}});else if(e===G.NO_AUTO_SEEK_TO_LIVE)(d=ae(this,Te))==null||d.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(G.NO_AUTO_SEEK_TO_LIVE)}});else if(e===G.FULLSCREEN_ELEMENT){const g=s?(u=this.getRootNode())==null?void 0:u.getElementById(s):void 0;xi(this,_a,g),(c=ae(this,Te))==null||c.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}else e===G.LANG&&s!==t?(tC(s),(h=ae(this,Te))==null||h.dispatch({type:"optionschangerequest",detail:{mediaLang:s}})):e===G.LOOP&&s!==t?(f=ae(this,Te))==null||f.dispatch({type:Y.MEDIA_LOOP_REQUEST,detail:s!=null}):e===G.NO_VOLUME_PREF&&s!==t?(m=ae(this,Te))==null||m.dispatch({type:"optionschangerequest",detail:{noVolumePref:this.hasAttribute(G.NO_VOLUME_PREF)}}):e===G.NO_MUTED_PREF&&s!==t&&((p=ae(this,Te))==null||p.dispatch({type:"optionschangerequest",detail:{noMutedPref:this.hasAttribute(G.NO_MUTED_PREF)}}))}connectedCallback(){var e,t;!ae(this,Te)&&!this.hasAttribute(G.NO_DEFAULT_STORE)&&Hi(this,Dl,xh).call(this),(e=ae(this,Te))==null||e.dispatch({type:"documentelementchangerequest",detail:tt}),super.connectedCallback(),ae(this,Te)&&!ae(this,ki)&&xi(this,ki,(t=ae(this,Te))==null?void 0:t.subscribe(ae(this,Aa))),ae(this,Sa)!==void 0&&ae(this,Te)&&this.media&&setTimeout(()=>{var s,r,n;(r=(s=this.media)==null?void 0:s.textTracks)!=null&&r.length&&((n=ae(this,Te))==null||n.dispatch({type:Y.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:ae(this,Sa)}))},0),this.hasAttribute(G.NO_HOTKEYS)?this.disableHotkeys():this.enableHotkeys()}disconnectedCallback(){var e,t,s,r,n;if((e=super.disconnectedCallback)==null||e.call(this),ae(this,Te)){const a=ae(this,Te).getState();xi(this,Sa,!!((t=a.mediaSubtitlesShowing)!=null&&t.length)),(s=ae(this,Te))==null||s.dispatch({type:"documentelementchangerequest",detail:void 0}),(r=ae(this,Te))==null||r.dispatch({type:Y.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})}ae(this,ki)&&((n=ae(this,ki))==null||n.call(this),xi(this,ki,void 0))}mediaSetCallback(e){var t;super.mediaSetCallback(e),(t=ae(this,Te))==null||t.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var t;super.mediaUnsetCallback(e),(t=ae(this,Te))==null||t.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,t){y0(this.mediaStateReceivers,e,t)}associateElement(e){if(!e)return;const{associatedElementSubscriptions:t}=this;if(t.has(e))return;const s=this.registerMediaStateReceiver.bind(this),r=this.unregisterMediaStateReceiver.bind(this),n=YC(e,s,r);Object.values(Y).forEach(a=>{e.addEventListener(a,ae(this,kl))}),t.set(e,n)}unassociateElement(e){if(!e)return;const{associatedElementSubscriptions:t}=this;if(!t.has(e))return;t.get(e)(),t.delete(e),Object.values(Y).forEach(r=>{e.removeEventListener(r,ae(this,kl))})}registerMediaStateReceiver(e){if(!e)return;const t=this.mediaStateReceivers;t.indexOf(e)>-1||(t.push(e),ae(this,Te)&&Object.entries(ae(this,Te).getState()).forEach(([r,n])=>{y0([e],r,n)}))}unregisterMediaStateReceiver(e){const t=this.mediaStateReceivers,s=t.indexOf(e);s<0||t.splice(s,1)}enableHotkeys(){this.addEventListener("keydown",Hi(this,Cl,kh))}disableHotkeys(){this.removeEventListener("keydown",Hi(this,Cl,kh)),this.removeEventListener("keyup",Hi(this,_r,Cn))}get hotkeys(){return Ne(this,G.HOTKEYS)}set hotkeys(e){Ue(this,G.HOTKEYS,e)}keyboardShortcutHandler(e){var t,s,r,n,a,o,l,d,u;const c=e.target;if(((r=(s=(t=c.getAttribute(G.KEYS_USED))==null?void 0:t.split(" "))!=null?s:c?.keysUsed)!=null?r:[]).map(v=>v==="Space"?" ":v).filter(Boolean).includes(e.key))return;let f,m,p;if(!(ae(this,Us).contains(`no${e.key.toLowerCase()}`)||e.key===" "&&ae(this,Us).contains("nospace")||e.shiftKey&&(e.key==="/"||e.key==="?")&&ae(this,Us).contains("noshift+/")))switch(e.key){case" ":case"k":f=ae(this,Te).getState().mediaPaused?Y.MEDIA_PLAY_REQUEST:Y.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new k.CustomEvent(f,{composed:!0,bubbles:!0}));break;case"m":f=this.mediaStore.getState().mediaVolumeLevel==="off"?Y.MEDIA_UNMUTE_REQUEST:Y.MEDIA_MUTE_REQUEST,this.dispatchEvent(new k.CustomEvent(f,{composed:!0,bubbles:!0}));break;case"f":f=this.mediaStore.getState().mediaIsFullscreen?Y.MEDIA_EXIT_FULLSCREEN_REQUEST:Y.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new k.CustomEvent(f,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new k.CustomEvent(Y.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":case"j":{const v=this.hasAttribute(G.KEYBOARD_BACKWARD_SEEK_OFFSET)?+this.getAttribute(G.KEYBOARD_BACKWARD_SEEK_OFFSET):m0;m=Math.max(((n=this.mediaStore.getState().mediaCurrentTime)!=null?n:0)-v,0),p=new k.CustomEvent(Y.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"ArrowRight":case"l":{const v=this.hasAttribute(G.KEYBOARD_FORWARD_SEEK_OFFSET)?+this.getAttribute(G.KEYBOARD_FORWARD_SEEK_OFFSET):m0;m=Math.max(((a=this.mediaStore.getState().mediaCurrentTime)!=null?a:0)+v,0),p=new k.CustomEvent(Y.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"ArrowUp":{const v=this.hasAttribute(G.KEYBOARD_UP_VOLUME_STEP)?+this.getAttribute(G.KEYBOARD_UP_VOLUME_STEP):p0;m=Math.min(((o=this.mediaStore.getState().mediaVolume)!=null?o:1)+v,1),p=new k.CustomEvent(Y.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"ArrowDown":{const v=this.hasAttribute(G.KEYBOARD_DOWN_VOLUME_STEP)?+this.getAttribute(G.KEYBOARD_DOWN_VOLUME_STEP):p0;m=Math.max(((l=this.mediaStore.getState().mediaVolume)!=null?l:1)-v,0),p=new k.CustomEvent(Y.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"<":{const v=(d=this.mediaStore.getState().mediaPlaybackRate)!=null?d:1;m=Math.max(v-g0,BC).toFixed(2),p=new k.CustomEvent(Y.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case">":{const v=(u=this.mediaStore.getState().mediaPlaybackRate)!=null?u:1;m=Math.min(v+g0,HC).toFixed(2),p=new k.CustomEvent(Y.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"/":case"?":{e.shiftKey&&Hi(this,Dh,Lb).call(this);break}case"p":{f=this.mediaStore.getState().mediaIsPip?Y.MEDIA_EXIT_PIP_REQUEST:Y.MEDIA_ENTER_PIP_REQUEST,p=new k.CustomEvent(f,{composed:!0,bubbles:!0}),this.dispatchEvent(p);break}}}}Us=new WeakMap;_a=new WeakMap;Te=new WeakMap;gr=new WeakMap;Aa=new WeakMap;ki=new WeakMap;kl=new WeakMap;Sa=new WeakMap;Dl=new WeakSet;xh=function(){var i;this.mediaStore=FC({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(G.DEFAULT_SUBTITLES),defaultDuration:this.hasAttribute(G.DEFAULT_DURATION)?+this.getAttribute(G.DEFAULT_DURATION):void 0,defaultStreamType:(i=this.getAttribute(G.DEFAULT_STREAM_TYPE))!=null?i:void 0,liveEdgeOffset:this.hasAttribute(G.LIVE_EDGE_OFFSET)?+this.getAttribute(G.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(G.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(G.SEEK_TO_LIVE_OFFSET):this.hasAttribute(G.LIVE_EDGE_OFFSET)?+this.getAttribute(G.LIVE_EDGE_OFFSET):void 0,noAutoSeekToLive:this.hasAttribute(G.NO_AUTO_SEEK_TO_LIVE),noVolumePref:this.hasAttribute(G.NO_VOLUME_PREF),noMutedPref:this.hasAttribute(G.NO_MUTED_PREF),noSubtitlesLangPref:this.hasAttribute(G.NO_SUBTITLES_LANG_PREF)}})};_r=new WeakSet;Cn=function(i){const{key:e,shiftKey:t}=i;if(!(t&&(e==="/"||e==="?")||Rb.includes(e))){this.removeEventListener("keyup",Hi(this,_r,Cn));return}this.keyboardShortcutHandler(i)};Cl=new WeakSet;kh=function(i){var e;const{metaKey:t,altKey:s,key:r,shiftKey:n}=i,a=n&&(r==="/"||r==="?");if(a&&((e=ae(this,gr))!=null&&e.open)){this.removeEventListener("keyup",Hi(this,_r,Cn));return}if(t||s||!a&&!Rb.includes(r)){this.removeEventListener("keyup",Hi(this,_r,Cn));return}const o=i.target,l=o instanceof HTMLElement&&(o.tagName.toLowerCase()==="media-volume-range"||o.tagName.toLowerCase()==="media-time-range");[" ","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(r)&&!(ae(this,Us).contains(`no${r.toLowerCase()}`)||r===" "&&ae(this,Us).contains("nospace"))&&!l&&i.preventDefault(),this.addEventListener("keyup",Hi(this,_r,Cn),{once:!0})};Dh=new WeakSet;Lb=function(){ae(this,gr)||(xi(this,gr,tt.createElement("media-keyboard-shortcuts-dialog")),this.appendChild(ae(this,gr))),ae(this,gr).open=!0};const GC=Object.values(_),KC=Object.values(Jy),kb=i=>{var e,t,s,r;let{observedAttributes:n}=i.constructor;!n&&((e=i.nodeName)!=null&&e.includes("-"))&&(k.customElements.upgrade(i),{observedAttributes:n}=i.constructor);const a=(r=(s=(t=i?.getAttribute)==null?void 0:t.call(i,Ae.MEDIA_CHROME_ATTRIBUTES))==null?void 0:s.split)==null?void 0:r.call(s,/\s+/);return Array.isArray(n||a)?(n||a).filter(o=>GC.includes(o)):[]},VC=i=>{var e,t;return(e=i.nodeName)!=null&&e.includes("-")&&k.customElements.get((t=i.nodeName)==null?void 0:t.toLowerCase())&&!(i instanceof k.customElements.get(i.nodeName.toLowerCase()))&&k.customElements.upgrade(i),KC.some(s=>s in i)},Ch=i=>VC(i)||!!kb(i).length,v0=i=>{var e;return(e=i?.join)==null?void 0:e.call(i,":")},E0={[_.MEDIA_SUBTITLES_LIST]:uo,[_.MEDIA_SUBTITLES_SHOWING]:uo,[_.MEDIA_SEEKABLE]:v0,[_.MEDIA_BUFFERED]:i=>i?.map(v0).join(" "),[_.MEDIA_PREVIEW_COORDS]:i=>i?.join(" "),[_.MEDIA_RENDITION_LIST]:VD,[_.MEDIA_AUDIO_TRACK_LIST]:jD},WC=async(i,e,t)=>{var s,r;if(i.isConnected||await ib(0),typeof t=="boolean"||t==null)return Ee(i,e,t);if(typeof t=="number")return Ye(i,e,t);if(typeof t=="string")return Ue(i,e,t);if(Array.isArray(t)&&!t.length)return i.removeAttribute(e);const n=(r=(s=E0[e])==null?void 0:s.call(E0,t))!=null?r:t;return i.setAttribute(e,n)},qC=i=>{var e;return!!((e=i.closest)!=null&&e.call(i,'*[slot="media"]'))},rr=(i,e)=>{if(qC(i))return;const t=(r,n)=>{var a,o;Ch(r)&&n(r);const{children:l=[]}=r??{},d=(o=(a=r?.shadowRoot)==null?void 0:a.children)!=null?o:[];[...l,...d].forEach(c=>rr(c,n))},s=i?.nodeName.toLowerCase();if(s.includes("-")&&!Ch(i)){k.customElements.whenDefined(s).then(()=>{t(i,e)});return}t(i,e)},y0=(i,e,t)=>{i.forEach(s=>{if(e in s){s[e]=t;return}const r=kb(s),n=e.toLowerCase();r.includes(n)&&WC(s,n,t)})},YC=(i,e,t)=>{rr(i,e);const s=u=>{var c;const h=(c=u?.composedPath()[0])!=null?c:u.target;e(h)},r=u=>{var c;const h=(c=u?.composedPath()[0])!=null?c:u.target;t(h)};i.addEventListener(Y.REGISTER_MEDIA_STATE_RECEIVER,s),i.addEventListener(Y.UNREGISTER_MEDIA_STATE_RECEIVER,r);const n=u=>{u.forEach(c=>{const{addedNodes:h=[],removedNodes:f=[],type:m,target:p,attributeName:g}=c;m==="childList"?(Array.prototype.forEach.call(h,v=>rr(v,e)),Array.prototype.forEach.call(f,v=>rr(v,t))):m==="attributes"&&g===Ae.MEDIA_CHROME_ATTRIBUTES&&(Ch(p)?e(p):t(p))})};let a=[];const o=u=>{const c=u.target;c.name!=="media"&&(a.forEach(h=>rr(h,t)),a=[...c.assignedElements({flatten:!0})],a.forEach(h=>rr(h,e)))};i.addEventListener("slotchange",o);const l=new MutationObserver(n);return l.observe(i,{childList:!0,attributes:!0,subtree:!0}),()=>{rr(i,t),i.removeEventListener("slotchange",o),l.disconnect(),i.removeEventListener(Y.REGISTER_MEDIA_STATE_RECEIVER,s),i.removeEventListener(Y.UNREGISTER_MEDIA_STATE_RECEIVER,r)}};k.customElements.get("media-controller")||k.customElements.define("media-controller",xb);var jC=xb;const Br={PLACEMENT:"placement",BOUNDS:"bounds"};function zC(i){return` + + +
+ `}class ku extends k.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!cb(this,{checkOpacity:!1,checkVisibilityCSS:!1}))return;const t=this.placement;if(t==="left"||t==="right"){this.style.removeProperty("--media-tooltip-offset-x");return}const s=getComputedStyle(this),r=(e=Yn(this,"#"+this.bounds))!=null?e:wt(this);if(!r)return;const{x:n,width:a}=r.getBoundingClientRect(),{x:o,width:l}=this.getBoundingClientRect(),d=o+l,u=n+a,c=s.getPropertyValue("--media-tooltip-offset-x"),h=c?parseFloat(c.replace("px","")):0,f=s.getPropertyValue("--media-tooltip-container-margin"),m=f?parseFloat(f.replace("px","")):0,p=o-n+h-m,g=d-u+h+m;if(p<0){this.style.setProperty("--media-tooltip-offset-x",`${p}px`);return}if(g>0){this.style.setProperty("--media-tooltip-offset-x",`${g}px`);return}this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){const e=this.placement;delete this.placement,this.placement=e}}static get observedAttributes(){return[Br.PLACEMENT,Br.BOUNDS]}get placement(){return Ne(this,Br.PLACEMENT)}set placement(e){Ue(this,Br.PLACEMENT,e)}get bounds(){return Ne(this,Br.BOUNDS)}set bounds(e){Ue(this,Br.BOUNDS,e)}}ku.shadowRootOptions={mode:"open"};ku.getTemplateHTML=zC;k.customElements.get("media-tooltip")||k.customElements.define("media-tooltip",ku);var b0=ku,Sm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Je=(i,e,t)=>(Sm(i,e,"read from private field"),t?t.call(i):e.get(i)),Hr=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Yo=(i,e,t,s)=>(Sm(i,e,"write to private field"),e.set(i,t),t),QC=(i,e,t)=>(Sm(i,e,"access private method"),t),Di,Tn,$s,en,wl,wh,Db;const _s={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function XC(i,e={}){return` + + + ${this.getSlotTemplateHTML(i,e)} + + + + + `}function ZC(i,e){return` + + `}function JC(){return""}class vt extends k.HTMLElement{constructor(){if(super(),Hr(this,wh),Hr(this,Di,void 0),this.preventClick=!1,this.tooltipEl=null,Hr(this,Tn,e=>{this.preventClick||this.handleClick(e),setTimeout(Je(this,$s),0)}),Hr(this,$s,()=>{var e,t;(t=(e=this.tooltipEl)==null?void 0:e.updateXOffset)==null||t.call(e)}),Hr(this,en,e=>{const{key:t}=e;if(!this.keysUsed.includes(t)){this.removeEventListener("keyup",Je(this,en));return}this.preventClick||this.handleClick(e)}),Hr(this,wl,e=>{const{metaKey:t,altKey:s,key:r}=e;if(t||s||!this.keysUsed.includes(r)){this.removeEventListener("keyup",Je(this,en));return}this.addEventListener("keyup",Je(this,en),{once:!0})}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.tooltipEl=this.shadowRoot.querySelector("media-tooltip")}static get observedAttributes(){return["disabled",_s.TOOLTIP_PLACEMENT,Ae.MEDIA_CONTROLLER,_.MEDIA_LANG]}enable(){this.addEventListener("click",Je(this,Tn)),this.addEventListener("keydown",Je(this,wl)),this.tabIndex=0}disable(){this.removeEventListener("click",Je(this,Tn)),this.removeEventListener("keydown",Je(this,wl)),this.removeEventListener("keyup",Je(this,en)),this.tabIndex=-1}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Ae.MEDIA_CONTROLLER?(t&&((n=(r=Je(this,Di))==null?void 0:r.unassociateElement)==null||n.call(r,this),Yo(this,Di,null)),s&&this.isConnected&&(Yo(this,Di,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Je(this,Di))==null?void 0:o.associateElement)==null||l.call(o,this))):e==="disabled"&&s!==t?s==null?this.enable():this.disable():e===_s.TOOLTIP_PLACEMENT&&this.tooltipEl&&s!==t?this.tooltipEl.placement=s:e===_.MEDIA_LANG&&(this.shadowRoot.querySelector('slot[name="tooltip-content"]').innerHTML=this.constructor.getTooltipContentHTML()),Je(this,$s).call(this)}connectedCallback(){var e,t,s;const{style:r}=ut(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),this.hasAttribute("disabled")?this.disable():this.enable(),this.setAttribute("role","button");const n=this.getAttribute(Ae.MEDIA_CONTROLLER);n&&(Yo(this,Di,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=Je(this,Di))==null?void 0:t.associateElement)==null||s.call(t,this)),k.customElements.whenDefined("media-tooltip").then(()=>QC(this,wh,Db).call(this))}disconnectedCallback(){var e,t;this.disable(),(t=(e=Je(this,Di))==null?void 0:e.unassociateElement)==null||t.call(e,this),Yo(this,Di,null),this.removeEventListener("mouseenter",Je(this,$s)),this.removeEventListener("focus",Je(this,$s)),this.removeEventListener("click",Je(this,Tn))}get keysUsed(){return["Enter"," "]}get tooltipPlacement(){return Ne(this,_s.TOOLTIP_PLACEMENT)}set tooltipPlacement(e){Ue(this,_s.TOOLTIP_PLACEMENT,e)}get mediaController(){return Ne(this,Ae.MEDIA_CONTROLLER)}set mediaController(e){Ue(this,Ae.MEDIA_CONTROLLER,e)}get disabled(){return ve(this,_s.DISABLED)}set disabled(e){Ee(this,_s.DISABLED,e)}get noTooltip(){return ve(this,_s.NO_TOOLTIP)}set noTooltip(e){Ee(this,_s.NO_TOOLTIP,e)}handleClick(e){}}Di=new WeakMap;Tn=new WeakMap;$s=new WeakMap;en=new WeakMap;wl=new WeakMap;wh=new WeakSet;Db=function(){this.addEventListener("mouseenter",Je(this,$s)),this.addEventListener("focus",Je(this,$s)),this.addEventListener("click",Je(this,Tn));const i=this.tooltipPlacement;i&&this.tooltipEl&&(this.tooltipEl.placement=i)};vt.shadowRootOptions={mode:"open"};vt.getTemplateHTML=XC;vt.getSlotTemplateHTML=ZC;vt.getTooltipContentHTML=JC;k.customElements.get("media-chrome-button")||k.customElements.define("media-chrome-button",vt);const T0=` +`;function ew(i){return` + + + + ${T0} + ${T0} + + `}function tw(){return` + ${J("start airplay")} + ${J("stop airplay")} + `}const _0=i=>{const e=i.mediaIsAirplaying?J("stop airplay"):J("start airplay");i.setAttribute("aria-label",e)};class Im extends vt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_AIRPLAYING,_.MEDIA_AIRPLAY_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),_0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_AIRPLAYING&&_0(this)}get mediaIsAirplaying(){return ve(this,_.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(e){Ee(this,_.MEDIA_IS_AIRPLAYING,e)}get mediaAirplayUnavailable(){return Ne(this,_.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(e){Ue(this,_.MEDIA_AIRPLAY_UNAVAILABLE,e)}handleClick(){const e=new k.CustomEvent(Y.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(e)}}Im.getSlotTemplateHTML=ew;Im.getTooltipContentHTML=tw;k.customElements.get("media-airplay-button")||k.customElements.define("media-airplay-button",Im);const iw=``,sw=``;function rw(i){return` + + + + ${iw} + ${sw} + + `}function nw(){return` + ${J("Enable captions")} + ${J("Disable captions")} + `}const A0=i=>{i.setAttribute("aria-checked",Tb(i).toString())};class Lm extends vt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_SUBTITLES_LIST,_.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",J("closed captions")),A0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_SUBTITLES_SHOWING&&A0(this)}get mediaSubtitlesList(){return S0(this,_.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){I0(this,_.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return S0(this,_.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){I0(this,_.MEDIA_SUBTITLES_SHOWING,e)}handleClick(){this.dispatchEvent(new k.CustomEvent(Y.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}}Lm.getSlotTemplateHTML=rw;Lm.getTooltipContentHTML=nw;const S0=(i,e)=>{const t=i.getAttribute(e);return t?Ru(t):[]},I0=(i,e,t)=>{if(!t?.length){i.removeAttribute(e);return}const s=uo(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};k.customElements.get("media-captions-button")||k.customElements.define("media-captions-button",Lm);const aw='',ow='';function lw(i){return` + + + + ${aw} + ${ow} + + `}function dw(){return` + ${J("Start casting")} + ${J("Stop casting")} + `}const L0=i=>{const e=i.mediaIsCasting?J("stop casting"):J("start casting");i.setAttribute("aria-label",e)};class Rm extends vt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_CASTING,_.MEDIA_CAST_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),L0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_CASTING&&L0(this)}get mediaIsCasting(){return ve(this,_.MEDIA_IS_CASTING)}set mediaIsCasting(e){Ee(this,_.MEDIA_IS_CASTING,e)}get mediaCastUnavailable(){return Ne(this,_.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(e){Ue(this,_.MEDIA_CAST_UNAVAILABLE,e)}handleClick(){const e=this.mediaIsCasting?Y.MEDIA_EXIT_CAST_REQUEST:Y.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}Rm.getSlotTemplateHTML=lw;Rm.getTooltipContentHTML=dw;k.customElements.get("media-cast-button")||k.customElements.define("media-cast-button",Rm);var xm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ar=(i,e,t)=>(xm(i,e,"read from private field"),e.get(i)),is=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},km=(i,e,t,s)=>(xm(i,e,"write to private field"),e.set(i,t),t),Zs=(i,e,t)=>(xm(i,e,"access private method"),t),qd,co,kr,Ml,Mh,Ph,Cb,Oh,wb,Nh,Mb,Uh,Pb,$h,Ob;function uw(i){return` + + ${this.getSlotTemplateHTML(i)} + `}function cw(i){return` + + `}const ia={OPEN:"open",ANCHOR:"anchor"};class jn extends k.HTMLElement{constructor(){super(),is(this,Ml),is(this,Ph),is(this,Oh),is(this,Nh),is(this,Uh),is(this,$h),is(this,qd,!1),is(this,co,null),is(this,kr,null),this.addEventListener("invoke",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}static get observedAttributes(){return[ia.OPEN,ia.ANCHOR]}get open(){return ve(this,ia.OPEN)}set open(e){Ee(this,ia.OPEN,e)}handleEvent(e){switch(e.type){case"invoke":Zs(this,Nh,Mb).call(this,e);break;case"focusout":Zs(this,Uh,Pb).call(this,e);break;case"keydown":Zs(this,$h,Ob).call(this,e);break}}connectedCallback(){Zs(this,Ml,Mh).call(this),this.role||(this.role="dialog")}attributeChangedCallback(e,t,s){Zs(this,Ml,Mh).call(this),e===ia.OPEN&&s!==t&&(this.open?Zs(this,Ph,Cb).call(this):Zs(this,Oh,wb).call(this))}focus(){km(this,co,gm());const e=!this.dispatchEvent(new Event("focus",{composed:!0,cancelable:!0})),t=!this.dispatchEvent(new Event("focusin",{composed:!0,bubbles:!0,cancelable:!0}));if(e||t)return;const s=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');s?.focus()}get keysUsed(){return["Escape","Tab"]}}qd=new WeakMap;co=new WeakMap;kr=new WeakMap;Ml=new WeakSet;Mh=function(){if(!Ar(this,qd)&&(km(this,qd,!0),!this.shadowRoot)){this.attachShadow(this.constructor.shadowRootOptions);const i=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i),queueMicrotask(()=>{const{style:e}=ut(this.shadowRoot,":host");e.setProperty("transition","display .15s, visibility .15s, opacity .15s ease-in, transform .15s ease-in")})}};Ph=new WeakSet;Cb=function(){var i;(i=Ar(this,kr))==null||i.setAttribute("aria-expanded","true"),this.dispatchEvent(new Event("open",{composed:!0,bubbles:!0})),this.addEventListener("transitionend",()=>this.focus(),{once:!0})};Oh=new WeakSet;wb=function(){var i;(i=Ar(this,kr))==null||i.setAttribute("aria-expanded","false"),this.dispatchEvent(new Event("close",{composed:!0,bubbles:!0}))};Nh=new WeakSet;Mb=function(i){km(this,kr,i.relatedTarget),gs(this,i.relatedTarget)||(this.open=!this.open)};Uh=new WeakSet;Pb=function(i){var e;gs(this,i.relatedTarget)||((e=Ar(this,co))==null||e.focus(),Ar(this,kr)&&Ar(this,kr)!==i.relatedTarget&&this.open&&(this.open=!1))};$h=new WeakSet;Ob=function(i){var e,t,s,r,n;const{key:a,ctrlKey:o,altKey:l,metaKey:d}=i;o||l||d||this.keysUsed.includes(a)&&(i.preventDefault(),i.stopPropagation(),a==="Tab"?(i.shiftKey?(t=(e=this.previousElementSibling)==null?void 0:e.focus)==null||t.call(e):(r=(s=this.nextElementSibling)==null?void 0:s.focus)==null||r.call(s),this.blur()):a==="Escape"&&((n=Ar(this,co))==null||n.focus(),this.open=!1))};jn.shadowRootOptions={mode:"open"};jn.getTemplateHTML=uw;jn.getSlotTemplateHTML=cw;k.customElements.get("media-chrome-dialog")||k.customElements.define("media-chrome-dialog",jn);var Dm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ge=(i,e,t)=>(Dm(i,e,"read from private field"),t?t.call(i):e.get(i)),Et=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ls=(i,e,t,s)=>(Dm(i,e,"write to private field"),e.set(i,t),t),mi=(i,e,t)=>(Dm(i,e,"access private method"),t),Ci,Du,Pl,Ol,pi,Yd,Nl,Ul,$l,Cm,Nb,Fl,Fh,Bl,Bh,jd,wm,Hh,Ub,Gh,$b,Kh,Fb,Vh,Bb;function hw(i){return` + +
+
+
+
+
+
+
+
+
+ +
+
+ +
+ + + ${this.getContainerTemplateHTML(i)} +
+
+ `}function fw(i){return""}class zn extends k.HTMLElement{constructor(){if(super(),Et(this,Cm),Et(this,Fl),Et(this,Bl),Et(this,jd),Et(this,Hh),Et(this,Gh),Et(this,Kh),Et(this,Vh),Et(this,Ci,void 0),Et(this,Du,void 0),Et(this,Pl,void 0),Et(this,Ol,void 0),Et(this,pi,{}),Et(this,Yd,[]),Et(this,Nl,()=>{if(this.range.matches(":focus-visible")){const{style:e}=ut(this.shadowRoot,":host");e.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),Et(this,Ul,()=>{const{style:e}=ut(this.shadowRoot,":host");e.removeProperty("--_focus-visible-box-shadow")}),Et(this,$l,()=>{const e=this.shadowRoot.querySelector("#segments-clipping");e&&e.parentNode.append(e)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.container=this.shadowRoot.querySelector("#container"),Ls(this,Pl,this.shadowRoot.querySelector("#startpoint")),Ls(this,Ol,this.shadowRoot.querySelector("#endpoint")),this.range=this.shadowRoot.querySelector("#range"),this.appearance=this.shadowRoot.querySelector("#appearance")}static get observedAttributes(){return["disabled","aria-disabled",Ae.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Ae.MEDIA_CONTROLLER?(t&&((n=(r=Ge(this,Ci))==null?void 0:r.unassociateElement)==null||n.call(r,this),Ls(this,Ci,null)),s&&this.isConnected&&(Ls(this,Ci,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Ge(this,Ci))==null?void 0:o.associateElement)==null||l.call(o,this))):(e==="disabled"||e==="aria-disabled"&&t!==s)&&(s==null?(this.range.removeAttribute(e),mi(this,Fl,Fh).call(this)):(this.range.setAttribute(e,s),mi(this,Bl,Bh).call(this)))}connectedCallback(){var e,t,s;const{style:r}=ut(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),Ge(this,pi).pointer=ut(this.shadowRoot,"#pointer"),Ge(this,pi).progress=ut(this.shadowRoot,"#progress"),Ge(this,pi).thumb=ut(this.shadowRoot,'#thumb, ::slotted([slot="thumb"])'),Ge(this,pi).activeSegment=ut(this.shadowRoot,"#segments-clipping rect:nth-child(0)");const n=this.getAttribute(Ae.MEDIA_CONTROLLER);n&&(Ls(this,Ci,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=Ge(this,Ci))==null?void 0:t.associateElement)==null||s.call(t,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",Ge(this,Nl)),this.shadowRoot.addEventListener("focusout",Ge(this,Ul)),mi(this,Fl,Fh).call(this),Hn(this.container,Ge(this,$l))}disconnectedCallback(){var e,t;mi(this,Bl,Bh).call(this),(t=(e=Ge(this,Ci))==null?void 0:e.unassociateElement)==null||t.call(e,this),Ls(this,Ci,null),this.shadowRoot.removeEventListener("focusin",Ge(this,Nl)),this.shadowRoot.removeEventListener("focusout",Ge(this,Ul)),Gn(this.container,Ge(this,$l))}updatePointerBar(e){var t;(t=Ge(this,pi).pointer)==null||t.style.setProperty("width",`${this.getPointerRatio(e)*100}%`)}updateBar(){var e,t;const s=this.range.valueAsNumber*100;(e=Ge(this,pi).progress)==null||e.style.setProperty("width",`${s}%`),(t=Ge(this,pi).thumb)==null||t.style.setProperty("left",`${s}%`)}updateSegments(e){const t=this.shadowRoot.querySelector("#segments-clipping");if(t.textContent="",this.container.classList.toggle("segments",!!e?.length),!e?.length)return;const s=[...new Set([+this.range.min,...e.flatMap(n=>[n.start,n.end]),+this.range.max])];Ls(this,Yd,[...s]);const r=s.pop();for(const[n,a]of s.entries()){const[o,l]=[n===0,n===s.length-1],d=o?"calc(var(--segments-gap) / -1)":`${a*100}%`,c=`calc(${((l?r:s[n+1])-a)*100}%${o||l?"":" - var(--segments-gap)"})`,h=tt.createElementNS("http://www.w3.org/2000/svg","rect"),f=vm(this.shadowRoot,`#segments-clipping rect:nth-child(${n+1})`);f.style.setProperty("x",d),f.style.setProperty("width",c),t.append(h)}}getPointerRatio(e){return nC(e.clientX,e.clientY,Ge(this,Pl).getBoundingClientRect(),Ge(this,Ol).getBoundingClientRect())}get dragging(){return this.hasAttribute("dragging")}handleEvent(e){switch(e.type){case"pointermove":mi(this,Vh,Bb).call(this,e);break;case"input":this.updateBar();break;case"pointerenter":mi(this,Hh,Ub).call(this,e);break;case"pointerdown":mi(this,jd,wm).call(this,e);break;case"pointerup":mi(this,Gh,$b).call(this);break;case"pointerleave":mi(this,Kh,Fb).call(this);break}}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}}Ci=new WeakMap;Du=new WeakMap;Pl=new WeakMap;Ol=new WeakMap;pi=new WeakMap;Yd=new WeakMap;Nl=new WeakMap;Ul=new WeakMap;$l=new WeakMap;Cm=new WeakSet;Nb=function(i){const e=Ge(this,pi).activeSegment;if(!e)return;const t=this.getPointerRatio(i),r=`#segments-clipping rect:nth-child(${Ge(this,Yd).findIndex((n,a,o)=>{const l=o[a+1];return l!=null&&t>=n&&t<=l})+1})`;(e.selectorText!=r||!e.style.transform)&&(e.selectorText=r,e.style.setProperty("transform","var(--media-range-segment-hover-transform, scaleY(2))"))};Fl=new WeakSet;Fh=function(){this.hasAttribute("disabled")||(this.addEventListener("input",this),this.addEventListener("pointerdown",this),this.addEventListener("pointerenter",this))};Bl=new WeakSet;Bh=function(){var i,e;this.removeEventListener("input",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointerenter",this),(i=k.window)==null||i.removeEventListener("pointerup",this),(e=k.window)==null||e.removeEventListener("pointermove",this)};jd=new WeakSet;wm=function(i){var e;Ls(this,Du,i.composedPath().includes(this.range)),(e=k.window)==null||e.addEventListener("pointerup",this)};Hh=new WeakSet;Ub=function(i){var e;i.pointerType!=="mouse"&&mi(this,jd,wm).call(this,i),this.addEventListener("pointerleave",this),(e=k.window)==null||e.addEventListener("pointermove",this)};Gh=new WeakSet;$b=function(){var i;(i=k.window)==null||i.removeEventListener("pointerup",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled")};Kh=new WeakSet;Fb=function(){var i,e;this.removeEventListener("pointerleave",this),(i=k.window)==null||i.removeEventListener("pointermove",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled"),(e=Ge(this,pi).activeSegment)==null||e.style.removeProperty("transform")};Vh=new WeakSet;Bb=function(i){i.pointerType==="pen"&&i.buttons===0||(this.toggleAttribute("dragging",i.buttons===1||i.pointerType!=="mouse"),this.updatePointerBar(i),mi(this,Cm,Nb).call(this,i),this.dragging&&(i.pointerType!=="mouse"||!Ge(this,Du))&&(this.range.disabled=!0,this.range.valueAsNumber=this.getPointerRatio(i),this.range.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))))};zn.shadowRootOptions={mode:"open"};zn.getTemplateHTML=hw;zn.getContainerTemplateHTML=fw;k.customElements.get("media-chrome-range")||k.customElements.define("media-chrome-range",zn);var Hb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},jo=(i,e,t)=>(Hb(i,e,"read from private field"),t?t.call(i):e.get(i)),mw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},zo=(i,e,t,s)=>(Hb(i,e,"write to private field"),e.set(i,t),t),wi;function pw(i){return` + + + + `}class Mm extends k.HTMLElement{constructor(){if(super(),mw(this,wi,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Ae.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Ae.MEDIA_CONTROLLER&&(t&&((n=(r=jo(this,wi))==null?void 0:r.unassociateElement)==null||n.call(r,this),zo(this,wi,null)),s&&this.isConnected&&(zo(this,wi,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=jo(this,wi))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s;const r=this.getAttribute(Ae.MEDIA_CONTROLLER);r&&(zo(this,wi,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(s=(t=jo(this,wi))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=jo(this,wi))==null?void 0:e.unassociateElement)==null||t.call(e,this),zo(this,wi,null)}}wi=new WeakMap;Mm.shadowRootOptions={mode:"open"};Mm.getTemplateHTML=pw;k.customElements.get("media-control-bar")||k.customElements.define("media-control-bar",Mm);var Gb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Qo=(i,e,t)=>(Gb(i,e,"read from private field"),t?t.call(i):e.get(i)),gw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Xo=(i,e,t,s)=>(Gb(i,e,"write to private field"),e.set(i,t),t),Mi;function vw(i,e={}){return` + + + ${this.getSlotTemplateHTML(i,e)} + `}function Ew(i,e){return` + + `}class qs extends k.HTMLElement{constructor(){if(super(),gw(this,Mi,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Ae.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Ae.MEDIA_CONTROLLER&&(t&&((n=(r=Qo(this,Mi))==null?void 0:r.unassociateElement)==null||n.call(r,this),Xo(this,Mi,null)),s&&this.isConnected&&(Xo(this,Mi,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Qo(this,Mi))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s;const{style:r}=ut(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`);const n=this.getAttribute(Ae.MEDIA_CONTROLLER);n&&(Xo(this,Mi,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=Qo(this,Mi))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=Qo(this,Mi))==null?void 0:e.unassociateElement)==null||t.call(e,this),Xo(this,Mi,null)}}Mi=new WeakMap;qs.shadowRootOptions={mode:"open"};qs.getTemplateHTML=vw;qs.getSlotTemplateHTML=Ew;k.customElements.get("media-text-display")||k.customElements.define("media-text-display",qs);var Kb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},R0=(i,e,t)=>(Kb(i,e,"read from private field"),t?t.call(i):e.get(i)),yw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},bw=(i,e,t,s)=>(Kb(i,e,"write to private field"),e.set(i,t),t),Ia;function Tw(i,e){return` + ${Gs(e.mediaDuration)} + `}class Vb extends qs{constructor(){var e;super(),yw(this,Ia,void 0),bw(this,Ia,this.shadowRoot.querySelector("slot")),R0(this,Ia).textContent=Gs((e=this.mediaDuration)!=null?e:0)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_DURATION]}attributeChangedCallback(e,t,s){e===_.MEDIA_DURATION&&(R0(this,Ia).textContent=Gs(+s)),super.attributeChangedCallback(e,t,s)}get mediaDuration(){return Oe(this,_.MEDIA_DURATION)}set mediaDuration(e){Ye(this,_.MEDIA_DURATION,e)}}Ia=new WeakMap;Vb.getSlotTemplateHTML=Tw;k.customElements.get("media-duration-display")||k.customElements.define("media-duration-display",Vb);const _w={2:J("Network Error"),3:J("Decode Error"),4:J("Source Not Supported"),5:J("Encryption Error")},Aw={2:J("A network error caused the media download to fail."),3:J("A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format."),4:J("An unsupported error occurred. The server or network failed, or your browser does not support this format."),5:J("The media is encrypted and there are no keys to decrypt it.")},Wb=i=>{var e,t;return i.code===1?null:{title:(e=_w[i.code])!=null?e:`Error ${i.code}`,message:(t=Aw[i.code])!=null?t:i.message}};var qb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Sw=(i,e,t)=>(qb(i,e,"read from private field"),t?t.call(i):e.get(i)),Iw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Lw=(i,e,t,s)=>(qb(i,e,"write to private field"),e.set(i,t),t),Hl;function Rw(i){return` + + + ${Yb({code:+i.mediaerrorcode,message:i.mediaerrormessage})} + + `}function xw(i){return i.code&&Wb(i)!==null}function Yb(i){var e;const{title:t,message:s}=(e=Wb(i))!=null?e:{};let r="";return t&&(r+=`

${t}

`),s&&(r+=`

${s}

`),r}const x0=[_.MEDIA_ERROR_CODE,_.MEDIA_ERROR_MESSAGE];class Cu extends jn{constructor(){super(...arguments),Iw(this,Hl,null)}static get observedAttributes(){return[...super.observedAttributes,...x0]}formatErrorMessage(e){return this.constructor.formatErrorMessage(e)}attributeChangedCallback(e,t,s){var r;if(super.attributeChangedCallback(e,t,s),!x0.includes(e))return;const n=(r=this.mediaError)!=null?r:{code:this.mediaErrorCode,message:this.mediaErrorMessage};this.open=xw(n),this.open&&(this.shadowRoot.querySelector("slot").name=`error-${this.mediaErrorCode}`,this.shadowRoot.querySelector("#content").innerHTML=this.formatErrorMessage(n))}get mediaError(){return Sw(this,Hl)}set mediaError(e){Lw(this,Hl,e)}get mediaErrorCode(){return Oe(this,"mediaerrorcode")}set mediaErrorCode(e){Ye(this,"mediaerrorcode",e)}get mediaErrorMessage(){return Ne(this,"mediaerrormessage")}set mediaErrorMessage(e){Ue(this,"mediaerrormessage",e)}}Hl=new WeakMap;Cu.getSlotTemplateHTML=Rw;Cu.formatErrorMessage=Yb;k.customElements.get("media-error-dialog")||k.customElements.define("media-error-dialog",Cu);var jb=Cu,kw=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},As=(i,e,t)=>(kw(i,e,"read from private field"),t?t.call(i):e.get(i)),k0=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},tn,sn;function Dw(i){return` + + + ${Cw()} + + `}function Cw(){return` +

Keyboard Shortcuts

+ ${[{keys:["Space","k"],description:"Toggle Playback"},{keys:["m"],description:"Toggle mute"},{keys:["f"],description:"Toggle fullscreen"},{keys:["c"],description:"Toggle captions or subtitles, if available"},{keys:["p"],description:"Toggle Picture in Picture"},{keys:["←","j"],description:"Seek back 10s"},{keys:["→","l"],description:"Seek forward 10s"},{keys:["↑"],description:"Turn volume up"},{keys:["↓"],description:"Turn volume down"},{keys:["< (SHIFT+,)"],description:"Decrease playback rate"},{keys:["> (SHIFT+.)"],description:"Increase playback rate"}].map(({keys:t,description:s})=>` + + + + + `).join("")}
+
${t.map((n,a)=>a>0?`or${n}`:`${n}`).join("")}
+
${s}
+ `}class zb extends jn{constructor(){super(...arguments),k0(this,tn,e=>{var t;if(!this.open)return;const s=(t=this.shadowRoot)==null?void 0:t.querySelector("#content");if(!s)return;const r=e.composedPath(),n=r[0]===this||r.includes(this),a=r.includes(s);n&&!a&&(this.open=!1)}),k0(this,sn,e=>{if(!this.open)return;const t=e.shiftKey&&(e.key==="/"||e.key==="?");(e.key==="Escape"||t)&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&(this.open=!1,e.preventDefault(),e.stopPropagation())})}connectedCallback(){super.connectedCallback(),this.open&&(this.addEventListener("click",As(this,tn)),document.addEventListener("keydown",As(this,sn)))}disconnectedCallback(){this.removeEventListener("click",As(this,tn)),document.removeEventListener("keydown",As(this,sn))}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e==="open"&&(this.open?(this.addEventListener("click",As(this,tn)),document.addEventListener("keydown",As(this,sn))):(this.removeEventListener("click",As(this,tn)),document.removeEventListener("keydown",As(this,sn))))}}tn=new WeakMap;sn=new WeakMap;zb.getSlotTemplateHTML=Dw;k.customElements.get("media-keyboard-shortcuts-dialog")||k.customElements.define("media-keyboard-shortcuts-dialog",zb);var Qb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ww=(i,e,t)=>(Qb(i,e,"read from private field"),e.get(i)),Mw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Pw=(i,e,t,s)=>(Qb(i,e,"write to private field"),e.set(i,t),t),Gl;const Ow=``,Nw=``;function Uw(i){return` + + + + ${Ow} + ${Nw} + + `}function $w(){return` + ${J("Enter fullscreen mode")} + ${J("Exit fullscreen mode")} + `}const D0=i=>{const e=i.mediaIsFullscreen?J("exit fullscreen mode"):J("enter fullscreen mode");i.setAttribute("aria-label",e)};class Pm extends vt{constructor(){super(...arguments),Mw(this,Gl,null)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_FULLSCREEN,_.MEDIA_FULLSCREEN_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),D0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_FULLSCREEN&&D0(this)}get mediaFullscreenUnavailable(){return Ne(this,_.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(e){Ue(this,_.MEDIA_FULLSCREEN_UNAVAILABLE,e)}get mediaIsFullscreen(){return ve(this,_.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(e){Ee(this,_.MEDIA_IS_FULLSCREEN,e)}handleClick(e){Pw(this,Gl,e);const t=ww(this,Gl)instanceof PointerEvent,s=this.mediaIsFullscreen?new k.CustomEvent(Y.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0}):new k.CustomEvent(Y.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(s)}}Gl=new WeakMap;Pm.getSlotTemplateHTML=Uw;Pm.getTooltipContentHTML=$w;k.customElements.get("media-fullscreen-button")||k.customElements.define("media-fullscreen-button",Pm);const{MEDIA_TIME_IS_LIVE:Kl,MEDIA_PAUSED:Ka}=_,{MEDIA_SEEK_TO_LIVE_REQUEST:Fw,MEDIA_PLAY_REQUEST:Bw}=Y,Hw='';function Gw(i){return` + + + ${Hw} + +  ${J("live")} + `}const C0=i=>{var e;const t=i.mediaPaused||!i.mediaTimeIsLive,s=J(t?"seek to live":"playing live");i.setAttribute("aria-label",s);const r=(e=i.shadowRoot)==null?void 0:e.querySelector('slot[name="text"]');r&&(r.textContent=J("live")),t?i.removeAttribute("aria-disabled"):i.setAttribute("aria-disabled","true")};class Xb extends vt{static get observedAttributes(){return[...super.observedAttributes,Kl,Ka]}connectedCallback(){super.connectedCallback(),C0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),C0(this)}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}get mediaTimeIsLive(){return ve(this,_.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(e){Ee(this,_.MEDIA_TIME_IS_LIVE,e)}handleClick(){!this.mediaPaused&&this.mediaTimeIsLive||(this.dispatchEvent(new k.CustomEvent(Fw,{composed:!0,bubbles:!0})),this.hasAttribute(Ka)&&this.dispatchEvent(new k.CustomEvent(Bw,{composed:!0,bubbles:!0})))}}Xb.getSlotTemplateHTML=Gw;k.customElements.get("media-live-button")||k.customElements.define("media-live-button",Xb);var Zb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},sa=(i,e,t)=>(Zb(i,e,"read from private field"),t?t.call(i):e.get(i)),w0=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},ra=(i,e,t,s)=>(Zb(i,e,"write to private field"),e.set(i,t),t),Pi,Vl;const Zo={LOADING_DELAY:"loadingdelay",NO_AUTOHIDE:"noautohide"},Jb=500,Kw=` + +`;function Vw(i){return` + + + ${Kw} +
${J("media loading")}
+ `}class Om extends k.HTMLElement{constructor(){if(super(),w0(this,Pi,void 0),w0(this,Vl,Jb),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Ae.MEDIA_CONTROLLER,_.MEDIA_PAUSED,_.MEDIA_LOADING,Zo.LOADING_DELAY]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Zo.LOADING_DELAY&&t!==s?this.loadingDelay=Number(s):e===Ae.MEDIA_CONTROLLER&&(t&&((n=(r=sa(this,Pi))==null?void 0:r.unassociateElement)==null||n.call(r,this),ra(this,Pi,null)),s&&this.isConnected&&(ra(this,Pi,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=sa(this,Pi))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s;const r=this.getAttribute(Ae.MEDIA_CONTROLLER);r&&(ra(this,Pi,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(s=(t=sa(this,Pi))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=sa(this,Pi))==null?void 0:e.unassociateElement)==null||t.call(e,this),ra(this,Pi,null)}get loadingDelay(){return sa(this,Vl)}set loadingDelay(e){ra(this,Vl,e);const{style:t}=ut(this.shadowRoot,":host");t.setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${e}ms)`)}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}get mediaLoading(){return ve(this,_.MEDIA_LOADING)}set mediaLoading(e){Ee(this,_.MEDIA_LOADING,e)}get mediaController(){return Ne(this,Ae.MEDIA_CONTROLLER)}set mediaController(e){Ue(this,Ae.MEDIA_CONTROLLER,e)}get noAutohide(){return ve(this,Zo.NO_AUTOHIDE)}set noAutohide(e){Ee(this,Zo.NO_AUTOHIDE,e)}}Pi=new WeakMap;Vl=new WeakMap;Om.shadowRootOptions={mode:"open"};Om.getTemplateHTML=Vw;k.customElements.get("media-loading-indicator")||k.customElements.define("media-loading-indicator",Om);const Ww=``,M0=``,qw=``;function Yw(i){return` + + + + ${Ww} + ${M0} + ${M0} + ${qw} + + `}function jw(){return` + ${J("Mute")} + ${J("Unmute")} + `}const P0=i=>{const e=i.mediaVolumeLevel==="off",t=J(e?"unmute":"mute");i.setAttribute("aria-label",t)};class Nm extends vt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_VOLUME_LEVEL]}connectedCallback(){super.connectedCallback(),P0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_VOLUME_LEVEL&&P0(this)}get mediaVolumeLevel(){return Ne(this,_.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(e){Ue(this,_.MEDIA_VOLUME_LEVEL,e)}handleClick(){const e=this.mediaVolumeLevel==="off"?Y.MEDIA_UNMUTE_REQUEST:Y.MEDIA_MUTE_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}Nm.getSlotTemplateHTML=Yw;Nm.getTooltipContentHTML=jw;k.customElements.get("media-mute-button")||k.customElements.define("media-mute-button",Nm);const O0=``;function zw(i){return` + + + + ${O0} + ${O0} + + `}function Qw(){return` + ${J("Enter picture in picture mode")} + ${J("Exit picture in picture mode")} + `}const N0=i=>{const e=i.mediaIsPip?J("exit picture in picture mode"):J("enter picture in picture mode");i.setAttribute("aria-label",e)};class Um extends vt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_PIP,_.MEDIA_PIP_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),N0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_PIP&&N0(this)}get mediaPipUnavailable(){return Ne(this,_.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(e){Ue(this,_.MEDIA_PIP_UNAVAILABLE,e)}get mediaIsPip(){return ve(this,_.MEDIA_IS_PIP)}set mediaIsPip(e){Ee(this,_.MEDIA_IS_PIP,e)}handleClick(){const e=this.mediaIsPip?Y.MEDIA_EXIT_PIP_REQUEST:Y.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}Um.getSlotTemplateHTML=zw;Um.getTooltipContentHTML=Qw;k.customElements.get("media-pip-button")||k.customElements.define("media-pip-button",Um);var Xw=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Gr=(i,e,t)=>(Xw(i,e,"read from private field"),t?t.call(i):e.get(i)),Zw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Rs;const _c={RATES:"rates"},eT=[1,1.2,1.5,1.7,2],_n=1;function Jw(i){return` + + ${i.mediaplaybackrate||_n}x + `}function eM(){return J("Playback rate")}class $m extends vt{constructor(){var e;super(),Zw(this,Rs,new bm(this,_c.RATES,{defaultValue:eT})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(e=this.mediaPlaybackRate)!=null?e:_n}x`}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PLAYBACK_RATE,_c.RATES]}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),e===_c.RATES&&(Gr(this,Rs).value=s),e===_.MEDIA_PLAYBACK_RATE){const r=s?+s:Number.NaN,n=Number.isNaN(r)?_n:r;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",J("Playback rate {playbackRate}",{playbackRate:n}))}}get rates(){return Gr(this,Rs)}set rates(e){e?Array.isArray(e)?Gr(this,Rs).value=e.join(" "):typeof e=="string"&&(Gr(this,Rs).value=e):Gr(this,Rs).value=""}get mediaPlaybackRate(){return Oe(this,_.MEDIA_PLAYBACK_RATE,_n)}set mediaPlaybackRate(e){Ye(this,_.MEDIA_PLAYBACK_RATE,e)}handleClick(){var e,t;const s=Array.from(Gr(this,Rs).values(),a=>+a).sort((a,o)=>a-o),r=(t=(e=s.find(a=>a>this.mediaPlaybackRate))!=null?e:s[0])!=null?t:_n,n=new k.CustomEvent(Y.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(n)}}Rs=new WeakMap;$m.getSlotTemplateHTML=Jw;$m.getTooltipContentHTML=eM;k.customElements.get("media-playback-rate-button")||k.customElements.define("media-playback-rate-button",$m);const tM=``,iM=``;function sM(i){return` + + + + ${tM} + ${iM} + + `}function rM(){return` + ${J("Play")} + ${J("Pause")} + `}const U0=i=>{const e=i.mediaPaused?J("play"):J("pause");i.setAttribute("aria-label",e)};class Fm extends vt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PAUSED,_.MEDIA_ENDED]}connectedCallback(){super.connectedCallback(),U0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),(e===_.MEDIA_PAUSED||e===_.MEDIA_LANG)&&U0(this)}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}handleClick(){const e=this.mediaPaused?Y.MEDIA_PLAY_REQUEST:Y.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}Fm.getSlotTemplateHTML=sM;Fm.getTooltipContentHTML=rM;k.customElements.get("media-play-button")||k.customElements.define("media-play-button",Fm);const Si={PLACEHOLDER_SRC:"placeholdersrc",SRC:"src"};function nM(i){return` + + + + `}const aM=i=>{i.style.removeProperty("background-image")},oM=(i,e)=>{i.style["background-image"]=`url('${e}')`};class Bm extends k.HTMLElement{static get observedAttributes(){return[Si.PLACEHOLDER_SRC,Si.SRC]}constructor(){if(super(),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(e,t,s){e===Si.SRC&&(s==null?this.image.removeAttribute(Si.SRC):this.image.setAttribute(Si.SRC,s)),e===Si.PLACEHOLDER_SRC&&(s==null?aM(this.image):oM(this.image,s))}get placeholderSrc(){return Ne(this,Si.PLACEHOLDER_SRC)}set placeholderSrc(e){Ue(this,Si.SRC,e)}get src(){return Ne(this,Si.SRC)}set src(e){Ue(this,Si.SRC,e)}}Bm.shadowRootOptions={mode:"open"};Bm.getTemplateHTML=nM;k.customElements.get("media-poster-image")||k.customElements.define("media-poster-image",Bm);var tT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},lM=(i,e,t)=>(tT(i,e,"read from private field"),t?t.call(i):e.get(i)),dM=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},uM=(i,e,t,s)=>(tT(i,e,"write to private field"),e.set(i,t),t),Wl;class cM extends qs{constructor(){super(),dM(this,Wl,void 0),uM(this,Wl,this.shadowRoot.querySelector("slot"))}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PREVIEW_CHAPTER,_.MEDIA_LANG]}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),(e===_.MEDIA_PREVIEW_CHAPTER||e===_.MEDIA_LANG)&&s!==t&&s!=null)if(lM(this,Wl).textContent=s,s!==""){const r=J("chapter: {chapterName}",{chapterName:s});this.setAttribute("aria-valuetext",r)}else this.removeAttribute("aria-valuetext")}get mediaPreviewChapter(){return Ne(this,_.MEDIA_PREVIEW_CHAPTER)}set mediaPreviewChapter(e){Ue(this,_.MEDIA_PREVIEW_CHAPTER,e)}}Wl=new WeakMap;k.customElements.get("media-preview-chapter-display")||k.customElements.define("media-preview-chapter-display",cM);var iT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Jo=(i,e,t)=>(iT(i,e,"read from private field"),t?t.call(i):e.get(i)),hM=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},el=(i,e,t,s)=>(iT(i,e,"write to private field"),e.set(i,t),t),Oi;function fM(i){return` + + + `}class wu extends k.HTMLElement{constructor(){if(super(),hM(this,Oi,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Ae.MEDIA_CONTROLLER,_.MEDIA_PREVIEW_IMAGE,_.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,t,s;const r=this.getAttribute(Ae.MEDIA_CONTROLLER);r&&(el(this,Oi,(e=this.getRootNode())==null?void 0:e.getElementById(r)),(s=(t=Jo(this,Oi))==null?void 0:t.associateElement)==null||s.call(t,this))}disconnectedCallback(){var e,t;(t=(e=Jo(this,Oi))==null?void 0:e.unassociateElement)==null||t.call(e,this),el(this,Oi,null)}attributeChangedCallback(e,t,s){var r,n,a,o,l;[_.MEDIA_PREVIEW_IMAGE,_.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===Ae.MEDIA_CONTROLLER&&(t&&((n=(r=Jo(this,Oi))==null?void 0:r.unassociateElement)==null||n.call(r,this),el(this,Oi,null)),s&&this.isConnected&&(el(this,Oi,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Jo(this,Oi))==null?void 0:o.associateElement)==null||l.call(o,this)))}get mediaPreviewImage(){return Ne(this,_.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){Ue(this,_.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){const e=this.getAttribute(_.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map(t=>+t)}set mediaPreviewCoords(e){if(!e){this.removeAttribute(_.MEDIA_PREVIEW_COORDS);return}this.setAttribute(_.MEDIA_PREVIEW_COORDS,e.join(" "))}update(){const e=this.mediaPreviewCoords,t=this.mediaPreviewImage;if(!(e&&t))return;const[s,r,n,a]=e,o=t.split("#")[0],l=getComputedStyle(this),{maxWidth:d,maxHeight:u,minWidth:c,minHeight:h}=l,f=Math.min(parseInt(d)/n,parseInt(u)/a),m=Math.max(parseInt(c)/n,parseInt(h)/a),p=f<1,g=p?f:m>1?m:1,{style:v}=ut(this.shadowRoot,":host"),b=ut(this.shadowRoot,"img").style,y=this.shadowRoot.querySelector("img"),T=p?"min":"max";v.setProperty(`${T}-width`,"initial","important"),v.setProperty(`${T}-height`,"initial","important"),v.width=`${n*g}px`,v.height=`${a*g}px`;const A=()=>{b.width=`${this.imgWidth*g}px`,b.height=`${this.imgHeight*g}px`,b.display="block"};y.src!==o&&(y.onload=()=>{this.imgWidth=y.naturalWidth,this.imgHeight=y.naturalHeight,A()},y.src=o,A()),A(),b.transform=`translate(-${s*g}px, -${r*g}px)`}}Oi=new WeakMap;wu.shadowRootOptions={mode:"open"};wu.getTemplateHTML=fM;k.customElements.get("media-preview-thumbnail")||k.customElements.define("media-preview-thumbnail",wu);var $0=wu,sT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},F0=(i,e,t)=>(sT(i,e,"read from private field"),t?t.call(i):e.get(i)),mM=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},pM=(i,e,t,s)=>(sT(i,e,"write to private field"),e.set(i,t),t),La;class gM extends qs{constructor(){super(),mM(this,La,void 0),pM(this,La,this.shadowRoot.querySelector("slot")),F0(this,La).textContent=Gs(0)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_PREVIEW_TIME&&s!=null&&(F0(this,La).textContent=Gs(parseFloat(s)))}get mediaPreviewTime(){return Oe(this,_.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){Ye(this,_.MEDIA_PREVIEW_TIME,e)}}La=new WeakMap;k.customElements.get("media-preview-time-display")||k.customElements.define("media-preview-time-display",gM);const Kr={SEEK_OFFSET:"seekoffset"},Ac=30,vM=i=>` + `;function EM(i,e){return` + ${vM(e.seekOffset)} + `}function yM(){return J("Seek backward")}const bM=0;class Hm extends vt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_CURRENT_TIME,Kr.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=Oe(this,Kr.SEEK_OFFSET,Ac)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===Kr.SEEK_OFFSET&&(this.seekOffset=Oe(this,Kr.SEEK_OFFSET,Ac))}get seekOffset(){return Oe(this,Kr.SEEK_OFFSET,Ac)}set seekOffset(e){Ye(this,Kr.SEEK_OFFSET,e),this.setAttribute("aria-label",J("seek back {seekOffset} seconds",{seekOffset:this.seekOffset})),db(ub(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return Oe(this,_.MEDIA_CURRENT_TIME,bM)}set mediaCurrentTime(e){Ye(this,_.MEDIA_CURRENT_TIME,e)}handleClick(){const e=Math.max(this.mediaCurrentTime-this.seekOffset,0),t=new k.CustomEvent(Y.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}Hm.getSlotTemplateHTML=EM;Hm.getTooltipContentHTML=yM;k.customElements.get("media-seek-backward-button")||k.customElements.define("media-seek-backward-button",Hm);const Vr={SEEK_OFFSET:"seekoffset"},Sc=30,TM=i=>` + `;function _M(i,e){return` + ${TM(e.seekOffset)} + `}function AM(){return J("Seek forward")}const SM=0;class Gm extends vt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_CURRENT_TIME,Vr.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=Oe(this,Vr.SEEK_OFFSET,Sc)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===Vr.SEEK_OFFSET&&(this.seekOffset=Oe(this,Vr.SEEK_OFFSET,Sc))}get seekOffset(){return Oe(this,Vr.SEEK_OFFSET,Sc)}set seekOffset(e){Ye(this,Vr.SEEK_OFFSET,e),this.setAttribute("aria-label",J("seek forward {seekOffset} seconds",{seekOffset:this.seekOffset})),db(ub(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return Oe(this,_.MEDIA_CURRENT_TIME,SM)}set mediaCurrentTime(e){Ye(this,_.MEDIA_CURRENT_TIME,e)}handleClick(){const e=this.mediaCurrentTime+this.seekOffset,t=new k.CustomEvent(Y.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}Gm.getSlotTemplateHTML=_M;Gm.getTooltipContentHTML=AM;k.customElements.get("media-seek-forward-button")||k.customElements.define("media-seek-forward-button",Gm);var rT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ic=(i,e,t)=>(rT(i,e,"read from private field"),t?t.call(i):e.get(i)),IM=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},LM=(i,e,t,s)=>(rT(i,e,"write to private field"),e.set(i,t),t),rn;const nr={REMAINING:"remaining",SHOW_DURATION:"showduration",NO_TOGGLE:"notoggle"},B0=[...Object.values(nr),_.MEDIA_CURRENT_TIME,_.MEDIA_DURATION,_.MEDIA_SEEKABLE],H0=["Enter"," "],RM=" / ",Wh=(i,{timesSep:e=RM}={})=>{var t,s;const r=(t=i.mediaCurrentTime)!=null?t:0,[,n]=(s=i.mediaSeekable)!=null?s:[];let a=0;Number.isFinite(i.mediaDuration)?a=i.mediaDuration:Number.isFinite(n)&&(a=n);const o=i.remaining?Gs(0-(a-r)):Gs(r);return i.showDuration?`${o}${e}${Gs(a)}`:o},xM="video not loaded, unknown time.",kM=i=>{var e;const t=i.mediaCurrentTime,[,s]=(e=i.mediaSeekable)!=null?e:[];let r=null;if(Number.isFinite(i.mediaDuration)?r=i.mediaDuration:Number.isFinite(s)&&(r=s),t==null||r===null){i.setAttribute("aria-valuetext",xM);return}const n=i.remaining?Ha(0-(r-t)):Ha(t);if(!i.showDuration){i.setAttribute("aria-valuetext",n);return}const a=Ha(r),o=`${n} of ${a}`;i.setAttribute("aria-valuetext",o)};function DM(i,e){return` + ${Wh(e)} + `}class nT extends qs{constructor(){super(),IM(this,rn,void 0),LM(this,rn,this.shadowRoot.querySelector("slot")),Ic(this,rn).innerHTML=`${Wh(this)}`}static get observedAttributes(){return[...super.observedAttributes,...B0,"disabled"]}connectedCallback(){const{style:e}=ut(this.shadowRoot,":host(:hover:not([notoggle]))");e.setProperty("cursor","var(--media-cursor, pointer)"),e.setProperty("background","var(--media-control-hover-background, rgba(50 50 70 / .7))"),this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",J("playback time"));const t=s=>{const{key:r}=s;if(!H0.includes(r)){this.removeEventListener("keyup",t);return}this.toggleTimeDisplay()};this.addEventListener("keydown",s=>{const{metaKey:r,altKey:n,key:a}=s;if(r||n||!H0.includes(a)){this.removeEventListener("keyup",t);return}this.addEventListener("keyup",t)}),this.addEventListener("click",this.toggleTimeDisplay),super.connectedCallback()}toggleTimeDisplay(){this.noToggle||(this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining",""))}disconnectedCallback(){this.disable(),super.disconnectedCallback()}attributeChangedCallback(e,t,s){B0.includes(e)?this.update():e==="disabled"&&s!==t&&(s==null?this.enable():this.disable()),super.attributeChangedCallback(e,t,s)}enable(){this.tabIndex=0}disable(){this.tabIndex=-1}get remaining(){return ve(this,nr.REMAINING)}set remaining(e){Ee(this,nr.REMAINING,e)}get showDuration(){return ve(this,nr.SHOW_DURATION)}set showDuration(e){Ee(this,nr.SHOW_DURATION,e)}get noToggle(){return ve(this,nr.NO_TOGGLE)}set noToggle(e){Ee(this,nr.NO_TOGGLE,e)}get mediaDuration(){return Oe(this,_.MEDIA_DURATION)}set mediaDuration(e){Ye(this,_.MEDIA_DURATION,e)}get mediaCurrentTime(){return Oe(this,_.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){Ye(this,_.MEDIA_CURRENT_TIME,e)}get mediaSeekable(){const e=this.getAttribute(_.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}set mediaSeekable(e){if(e==null){this.removeAttribute(_.MEDIA_SEEKABLE);return}this.setAttribute(_.MEDIA_SEEKABLE,e.join(":"))}update(){const e=Wh(this);kM(this),e!==Ic(this,rn).innerHTML&&(Ic(this,rn).innerHTML=e)}}rn=new WeakMap;nT.getSlotTemplateHTML=DM;k.customElements.get("media-time-display")||k.customElements.define("media-time-display",nT);var aT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},mt=(i,e,t)=>(aT(i,e,"read from private field"),e.get(i)),Ii=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ft=(i,e,t,s)=>(aT(i,e,"write to private field"),e.set(i,t),t),CM=(i,e,t,s)=>({set _(r){Ft(i,e,r)},get _(){return mt(i,e)}}),nn,ql,an,Ra,Yl,jl,zl,on,ar,Ql;class wM{constructor(e,t,s){Ii(this,nn,void 0),Ii(this,ql,void 0),Ii(this,an,void 0),Ii(this,Ra,void 0),Ii(this,Yl,void 0),Ii(this,jl,void 0),Ii(this,zl,void 0),Ii(this,on,void 0),Ii(this,ar,0),Ii(this,Ql,(r=performance.now())=>{Ft(this,ar,requestAnimationFrame(mt(this,Ql))),Ft(this,Ra,performance.now()-mt(this,an));const n=1e3/this.fps;if(mt(this,Ra)>n){Ft(this,an,r-mt(this,Ra)%n);const a=1e3/((r-mt(this,ql))/++CM(this,Yl)._),o=(r-mt(this,jl))/1e3/this.duration;let l=mt(this,zl)+o*this.playbackRate;l-mt(this,nn).valueAsNumber>0?Ft(this,on,this.playbackRate/this.duration/a):(Ft(this,on,.995*mt(this,on)),l=mt(this,nn).valueAsNumber+mt(this,on)),this.callback(l)}}),Ft(this,nn,e),this.callback=t,this.fps=s}start(){mt(this,ar)===0&&(Ft(this,an,performance.now()),Ft(this,ql,mt(this,an)),Ft(this,Yl,0),mt(this,Ql).call(this))}stop(){mt(this,ar)!==0&&(cancelAnimationFrame(mt(this,ar)),Ft(this,ar,0))}update({start:e,duration:t,playbackRate:s}){const r=e-mt(this,nn).valueAsNumber,n=Math.abs(t-this.duration);(r>0||r<-.03||n>=.5)&&this.callback(e),Ft(this,zl,e),Ft(this,jl,performance.now()),this.duration=t,this.playbackRate=s}}nn=new WeakMap;ql=new WeakMap;an=new WeakMap;Ra=new WeakMap;Yl=new WeakMap;jl=new WeakMap;zl=new WeakMap;on=new WeakMap;ar=new WeakMap;Ql=new WeakMap;var Km=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},je=(i,e,t)=>(Km(i,e,"read from private field"),t?t.call(i):e.get(i)),nt=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Zt=(i,e,t,s)=>(Km(i,e,"write to private field"),e.set(i,t),t),St=(i,e,t)=>(Km(i,e,"access private method"),t),ln,Sr,zd,Va,Qd,Xl,ho,fo,dn,un,cn,xa,Vm,oT,qh,Xd,Wm,Zd,qm,Jd,Ym,Yh,lT,mo,eu,jh,dT;const MM="video not loaded, unknown time.",PM=i=>{const e=i.range,t=Ha(+uT(i)),s=Ha(+i.mediaSeekableEnd),r=t&&s?`${t} of ${s}`:MM;e.setAttribute("aria-valuetext",r)};function OM(i){return` + +
+ + + + + + +
+
+
+
+ + + +
+ `}const tl=(i,e=i.mediaCurrentTime)=>{const t=Number.isFinite(i.mediaSeekableStart)?i.mediaSeekableStart:0,s=Number.isFinite(i.mediaDuration)?i.mediaDuration:i.mediaSeekableEnd;if(Number.isNaN(s))return 0;const r=(e-t)/(s-t);return Math.max(0,Math.min(r,1))},uT=(i,e=i.range.valueAsNumber)=>{const t=Number.isFinite(i.mediaSeekableStart)?i.mediaSeekableStart:0,s=Number.isFinite(i.mediaDuration)?i.mediaDuration:i.mediaSeekableEnd;return Number.isNaN(s)?0:e*(s-t)+t};class jm extends zn{constructor(){super(),nt(this,cn),nt(this,Vm),nt(this,Xd),nt(this,Zd),nt(this,Jd),nt(this,Yh),nt(this,mo),nt(this,jh),nt(this,ln,void 0),nt(this,Sr,void 0),nt(this,zd,void 0),nt(this,Va,void 0),nt(this,Qd,void 0),nt(this,Xl,void 0),nt(this,ho,void 0),nt(this,fo,void 0),nt(this,dn,void 0),nt(this,un,void 0),nt(this,qh,s=>{this.dragging||(mm(s)&&(this.range.valueAsNumber=s),je(this,un)||this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'
'),Zt(this,zd,this.shadowRoot.querySelectorAll('[part~="box"]')),Zt(this,Qd,this.shadowRoot.querySelector('[part~="preview-box"]')),Zt(this,Xl,this.shadowRoot.querySelector('[part~="current-box"]'));const t=getComputedStyle(this);Zt(this,ho,parseInt(t.getPropertyValue("--media-box-padding-left"))),Zt(this,fo,parseInt(t.getPropertyValue("--media-box-padding-right"))),Zt(this,Sr,new wM(this.range,je(this,qh),60))}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PAUSED,_.MEDIA_DURATION,_.MEDIA_SEEKABLE,_.MEDIA_CURRENT_TIME,_.MEDIA_PREVIEW_IMAGE,_.MEDIA_PREVIEW_TIME,_.MEDIA_PREVIEW_CHAPTER,_.MEDIA_BUFFERED,_.MEDIA_PLAYBACK_RATE,_.MEDIA_LOADING,_.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",J("seek")),St(this,cn,xa).call(this),Zt(this,ln,this.getRootNode()),(e=je(this,ln))==null||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),St(this,cn,xa).call(this),(e=je(this,ln))==null||e.removeEventListener("transitionstart",this),Zt(this,ln,null)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),t!=s&&(e===_.MEDIA_CURRENT_TIME||e===_.MEDIA_PAUSED||e===_.MEDIA_ENDED||e===_.MEDIA_LOADING||e===_.MEDIA_DURATION||e===_.MEDIA_SEEKABLE?(je(this,Sr).update({start:tl(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),St(this,cn,xa).call(this),PM(this)):e===_.MEDIA_BUFFERED&&this.updateBufferedBar(),(e===_.MEDIA_DURATION||e===_.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=je(this,dn),this.updateBar()))}get mediaChaptersCues(){return je(this,dn)}set mediaChaptersCues(e){var t;Zt(this,dn,e),this.updateSegments((t=je(this,dn))==null?void 0:t.map(s=>({start:tl(this,s.startTime),end:tl(this,s.endTime)})))}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}get mediaLoading(){return ve(this,_.MEDIA_LOADING)}set mediaLoading(e){Ee(this,_.MEDIA_LOADING,e)}get mediaDuration(){return Oe(this,_.MEDIA_DURATION)}set mediaDuration(e){Ye(this,_.MEDIA_DURATION,e)}get mediaCurrentTime(){return Oe(this,_.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){Ye(this,_.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return Oe(this,_.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){Ye(this,_.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){const e=this.getAttribute(_.MEDIA_BUFFERED);return e?e.split(" ").map(t=>t.split(":").map(s=>+s)):[]}set mediaBuffered(e){if(!e){this.removeAttribute(_.MEDIA_BUFFERED);return}const t=e.map(s=>s.join(":")).join(" ");this.setAttribute(_.MEDIA_BUFFERED,t)}get mediaSeekable(){const e=this.getAttribute(_.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}set mediaSeekable(e){if(e==null){this.removeAttribute(_.MEDIA_SEEKABLE);return}this.setAttribute(_.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;const[,t=this.mediaDuration]=(e=this.mediaSeekable)!=null?e:[];return t}get mediaSeekableStart(){var e;const[t=0]=(e=this.mediaSeekable)!=null?e:[];return t}get mediaPreviewImage(){return Ne(this,_.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){Ue(this,_.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return Oe(this,_.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){Ye(this,_.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return ve(this,_.MEDIA_ENDED)}set mediaEnded(e){Ee(this,_.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;const t=this.mediaBuffered;if(!t.length)return;let s;if(this.mediaEnded)s=1;else{const n=this.mediaCurrentTime,[,a=this.mediaSeekableStart]=(e=t.find(([o,l])=>o<=n&&n<=l))!=null?e:[];s=tl(this,a)}const{style:r}=ut(this.shadowRoot,"#buffered");r.setProperty("width",`${s*100}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;const t=ut(this.shadowRoot,"#current-rail"),s=ut(this.shadowRoot,'[part~="current-box"]'),r=St(this,Xd,Wm).call(this,je(this,Xl)),n=St(this,Zd,qm).call(this,r,this.range.valueAsNumber),a=St(this,Jd,Ym).call(this,r,this.range.valueAsNumber);t.style.transform=`translateX(${n})`,t.style.setProperty("--_range-width",`${r.range.width}`),s.style.setProperty("--_box-shift",`${a}`),s.style.setProperty("--_box-width",`${r.box.width}px`),s.style.setProperty("visibility","initial")}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":St(this,jh,dT).call(this);break;case"pointermove":St(this,Yh,lT).call(this,e);break;case"pointerup":je(this,un)&&Zt(this,un,!1);break;case"pointerdown":Zt(this,un,!0);break;case"pointerleave":St(this,mo,eu).call(this,null);break;case"transitionstart":gs(e.target,this)&&setTimeout(()=>St(this,cn,xa).call(this),0);break}}}ln=new WeakMap;Sr=new WeakMap;zd=new WeakMap;Va=new WeakMap;Qd=new WeakMap;Xl=new WeakMap;ho=new WeakMap;fo=new WeakMap;dn=new WeakMap;un=new WeakMap;cn=new WeakSet;xa=function(){St(this,Vm,oT).call(this)?je(this,Sr).start():je(this,Sr).stop()};Vm=new WeakSet;oT=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&cb(this)};qh=new WeakMap;Xd=new WeakSet;Wm=function(i){var e;const s=((e=this.getAttribute("bounds")?Yn(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?e:this).getBoundingClientRect(),r=this.range.getBoundingClientRect(),n=i.offsetWidth,a=-(r.left-s.left-n/2),o=s.right-r.left-n/2;return{box:{width:n,min:a,max:o},bounds:s,range:r}};Zd=new WeakSet;qm=function(i,e){let t=`${e*100}%`;const{width:s,min:r,max:n}=i.box;if(!s)return t;if(Number.isNaN(r)||(t=`max(${`calc(1 / var(--_range-width) * 100 * ${r}% + var(--media-box-padding-left))`}, ${t})`),!Number.isNaN(n)){const o=`calc(1 / var(--_range-width) * 100 * ${n}% - var(--media-box-padding-right))`;t=`min(${t}, ${o})`}return t};Jd=new WeakSet;Ym=function(i,e){const{width:t,min:s,max:r}=i.box,n=e*i.range.width;if(nr-je(this,fo)){const a=i.bounds.right-i.range.right-je(this,fo);return`${n+t/2-a-i.range.width}px`}return 0};Yh=new WeakSet;lT=function(i){const e=[...je(this,zd)].some(u=>i.composedPath().includes(u));if(!this.dragging&&(e||!i.composedPath().includes(this))){St(this,mo,eu).call(this,null);return}const t=this.mediaSeekableEnd;if(!t)return;const s=ut(this.shadowRoot,"#preview-rail"),r=ut(this.shadowRoot,'[part~="preview-box"]'),n=St(this,Xd,Wm).call(this,je(this,Qd));let a=(i.clientX-n.range.left)/n.range.width;a=Math.max(0,Math.min(1,a));const o=St(this,Zd,qm).call(this,n,a),l=St(this,Jd,Ym).call(this,n,a);s.style.transform=`translateX(${o})`,s.style.setProperty("--_range-width",`${n.range.width}`),r.style.setProperty("--_box-shift",`${l}`),r.style.setProperty("--_box-width",`${n.box.width}px`);const d=Math.round(je(this,Va))-Math.round(a*t);Math.abs(d)<1&&a>.01&&a<.99||(Zt(this,Va,a*t),St(this,mo,eu).call(this,je(this,Va)))};mo=new WeakSet;eu=function(i){this.dispatchEvent(new k.CustomEvent(Y.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:i}))};jh=new WeakSet;dT=function(){je(this,Sr).stop();const i=uT(this);this.dispatchEvent(new k.CustomEvent(Y.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:i}))};jm.shadowRootOptions={mode:"open"};jm.getContainerTemplateHTML=OM;k.customElements.get("media-time-range")||k.customElements.define("media-time-range",jm);const NM=1,UM=i=>i.mediaMuted?0:i.mediaVolume,$M=i=>`${Math.round(i*100)}%`;class FM extends zn{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_VOLUME,_.MEDIA_MUTED,_.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{const e=this.range.value,t=new k.CustomEvent(Y.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",J("volume"))}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),(e===_.MEDIA_VOLUME||e===_.MEDIA_MUTED)&&(this.range.valueAsNumber=UM(this),this.range.setAttribute("aria-valuetext",$M(this.range.valueAsNumber)),this.updateBar())}get mediaVolume(){return Oe(this,_.MEDIA_VOLUME,NM)}set mediaVolume(e){Ye(this,_.MEDIA_VOLUME,e)}get mediaMuted(){return ve(this,_.MEDIA_MUTED)}set mediaMuted(e){Ee(this,_.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return Ne(this,_.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){Ue(this,_.MEDIA_VOLUME_UNAVAILABLE,e)}}k.customElements.get("media-volume-range")||k.customElements.define("media-volume-range",FM);function BM(i){return` + + + + + +
+ +
+ `}function HM(){return J("Loop")}class zm extends vt{constructor(){super(...arguments),this.container=null}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_LOOP]}connectedCallback(){var e;super.connectedCallback(),this.container=((e=this.shadowRoot)==null?void 0:e.querySelector("#icon"))||null,this.container&&(this.container.textContent=J("Loop"))}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_LOOP&&this.container&&this.setAttribute("aria-checked",this.mediaLoop?"true":"false")}get mediaLoop(){return ve(this,_.MEDIA_LOOP)}set mediaLoop(e){Ee(this,_.MEDIA_LOOP,e)}handleClick(){const e=!this.mediaLoop,t=new k.CustomEvent(Y.MEDIA_LOOP_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}zm.getSlotTemplateHTML=BM;zm.getTooltipContentHTML=HM;k.customElements.get("media-loop-button")||k.customElements.define("media-loop-button",zm);var cT=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ce=(i,e,t)=>(cT(i,e,"read from private field"),t?t.call(i):e.get(i)),Gi=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},us=(i,e,t,s)=>(cT(i,e,"write to private field"),e.set(i,t),t),hn,Zl,or,ka,xs,ks,Ds,lr,fn,Jl,ci;const G0=1,K0=0,GM=1,KM={processCallback(i,e,t){if(t){for(const[s,r]of e)if(s in t){const n=t[s];typeof n=="boolean"&&r instanceof yi&&typeof r.element[r.attributeName]=="boolean"?r.booleanValue=n:typeof n=="function"&&r instanceof yi?r.element[r.attributeName]=n:r.value=n}}}};class Mu extends k.DocumentFragment{constructor(e,t,s=KM){var r;super(),Gi(this,hn,void 0),Gi(this,Zl,void 0),this.append(e.content.cloneNode(!0)),us(this,hn,hT(this)),us(this,Zl,s),(r=s.createCallback)==null||r.call(s,this,ce(this,hn),t),s.processCallback(this,ce(this,hn),t)}update(e){ce(this,Zl).processCallback(this,ce(this,hn),e)}}hn=new WeakMap;Zl=new WeakMap;const hT=(i,e=[])=>{let t,s;for(const r of i.attributes||[])if(r.value.includes("{{")){const n=new WM;for([t,s]of W0(r.value))if(!t)n.append(s);else{const a=new yi(i,r.name,r.namespaceURI);n.append(a),e.push([s,a])}r.value=n.toString()}for(const r of i.childNodes)if(r.nodeType===G0&&!(r instanceof HTMLTemplateElement))hT(r,e);else{const n=r.data;if(r.nodeType===G0||n.includes("{{")){const a=[];if(n)for([t,s]of W0(n))if(!t)a.push(new Text(s));else{const o=new Qn(i);a.push(o),e.push([s,o])}else if(r instanceof HTMLTemplateElement){const o=new pT(i,r);a.push(o),e.push([o.expression,o])}r.replaceWith(...a.flatMap(o=>o.replacementNodes||[o]))}}return e},V0={},W0=i=>{let e="",t=0,s=V0[i],r=0,n;if(s)return s;for(s=[];n=i[r];r++)n==="{"&&i[r+1]==="{"&&i[r-1]!=="\\"&&i[r+2]&&++t==1?(e&&s.push([K0,e]),e="",r++):n==="}"&&i[r+1]==="}"&&i[r-1]!=="\\"&&!--t?(s.push([GM,e.trim()]),e="",r++):e+=n||"";return e&&s.push([K0,(t>0?"{{":"")+e]),V0[i]=s},VM=11;class fT{get value(){return""}set value(e){}toString(){return this.value}}const mT=new WeakMap;class WM{constructor(){Gi(this,or,[])}[Symbol.iterator](){return ce(this,or).values()}get length(){return ce(this,or).length}item(e){return ce(this,or)[e]}append(...e){for(const t of e)t instanceof yi&&mT.set(t,this),ce(this,or).push(t)}toString(){return ce(this,or).join("")}}or=new WeakMap;class yi extends fT{constructor(e,t,s){super(),Gi(this,lr),Gi(this,ka,""),Gi(this,xs,void 0),Gi(this,ks,void 0),Gi(this,Ds,void 0),us(this,xs,e),us(this,ks,t),us(this,Ds,s)}get attributeName(){return ce(this,ks)}get attributeNamespace(){return ce(this,Ds)}get element(){return ce(this,xs)}get value(){return ce(this,ka)}set value(e){ce(this,ka)!==e&&(us(this,ka,e),!ce(this,lr,fn)||ce(this,lr,fn).length===1?e==null?ce(this,xs).removeAttributeNS(ce(this,Ds),ce(this,ks)):ce(this,xs).setAttributeNS(ce(this,Ds),ce(this,ks),e):ce(this,xs).setAttributeNS(ce(this,Ds),ce(this,ks),ce(this,lr,fn).toString()))}get booleanValue(){return ce(this,xs).hasAttributeNS(ce(this,Ds),ce(this,ks))}set booleanValue(e){if(!ce(this,lr,fn)||ce(this,lr,fn).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}}ka=new WeakMap;xs=new WeakMap;ks=new WeakMap;Ds=new WeakMap;lr=new WeakSet;fn=function(){return mT.get(this)};class Qn extends fT{constructor(e,t){super(),Gi(this,Jl,void 0),Gi(this,ci,void 0),us(this,Jl,e),us(this,ci,t?[...t]:[new Text])}get replacementNodes(){return ce(this,ci)}get parentNode(){return ce(this,Jl)}get nextSibling(){return ce(this,ci)[ce(this,ci).length-1].nextSibling}get previousSibling(){return ce(this,ci)[0].previousSibling}get value(){return ce(this,ci).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){const t=e.flat().flatMap(s=>s==null?[new Text]:s.forEach?[...s]:s.nodeType===VM?[...s.childNodes]:s.nodeType?[s]:[new Text(s)]);t.length||t.push(new Text),us(this,ci,qM(ce(this,ci)[0].parentNode,ce(this,ci),t,this.nextSibling))}}Jl=new WeakMap;ci=new WeakMap;class pT extends Qn{constructor(e,t){const s=t.getAttribute("directive")||t.getAttribute("type");let r=t.getAttribute("expression")||t.getAttribute(s)||"";r.startsWith("{{")&&(r=r.trim().slice(2,-2).trim()),super(e),this.expression=r,this.template=t,this.directive=s}}function qM(i,e,t,s=null){let r=0,n,a,o,l=t.length,d=e.length;for(;rString(i)};class gT{constructor(e){this.template=e,this.state=void 0}}const vr=new WeakMap,Er=new WeakMap,zh={partial:(i,e)=>{e[i.expression]=new gT(i.template)},if:(i,e)=>{var t;if(vT(i.expression,e))if(vr.get(i)!==i.template){vr.set(i,i.template);const s=new Mu(i.template,e,Qm);i.replace(s),Er.set(i,s)}else(t=Er.get(i))==null||t.update(e);else i.replace(""),vr.delete(i),Er.delete(i)}},YM=Object.keys(zh),Qm={processCallback(i,e,t){var s,r;if(t)for(const[n,a]of e){if(a instanceof pT){if(!a.directive){const l=YM.find(d=>a.template.hasAttribute(d));l&&(a.directive=l,a.expression=a.template.getAttribute(l))}(s=zh[a.directive])==null||s.call(zh,a,t);continue}let o=vT(n,t);if(o instanceof gT){vr.get(a)!==o.template?(vr.set(a,o.template),o=new Mu(o.template,o.state,Qm),a.value=o,Er.set(a,o)):(r=Er.get(a))==null||r.update(o.state);continue}o?(a instanceof yi&&a.attributeName.startsWith("aria-")&&(o=String(o)),a instanceof yi?typeof o=="boolean"?a.booleanValue=o:typeof o=="function"?a.element[a.attributeName]=o:a.value=o:(a.value=o,vr.delete(a),Er.delete(a))):a instanceof yi?a.value=void 0:(a.value=void 0,vr.delete(a),Er.delete(a))}}},Y0={"!":i=>!i,"!!":i=>!!i,"==":(i,e)=>i==e,"!=":(i,e)=>i!=e,">":(i,e)=>i>e,">=":(i,e)=>i>=e,"<":(i,e)=>ii<=e,"??":(i,e)=>i??e,"|":(i,e)=>{var t;return(t=q0[e])==null?void 0:t.call(q0,i)}};function jM(i){return zM(i,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>e!=="ws")}function vT(i,e={}){var t,s,r,n,a,o,l;const d=jM(i);if(d.length===0||d.some(({type:u})=>!u))return na(i);if(((t=d[0])==null?void 0:t.token)===">"){const u=e[(s=d[1])==null?void 0:s.token];if(!u)return na(i);const c={...e};u.state=c;const h=d.slice(2);for(let f=0;f{if(!e.has(i))throw TypeError("Cannot "+t)},Qh=(i,e,t)=>(Xm(i,e,"read from private field"),t?t.call(i):e.get(i)),oa=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},yr=(i,e,t,s)=>(Xm(i,e,"write to private field"),e.set(i,t),t),Lc=(i,e,t)=>(Xm(i,e,"access private method"),t),wn,ed,Mn,Xh,ET,td,Zh;const Rc={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},yT=tt.createElement("template");yT.innerHTML=` + +`;class Pu extends k.HTMLElement{constructor(){super(),oa(this,Xh),oa(this,td),oa(this,wn,void 0),oa(this,ed,void 0),oa(this,Mn,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());const e=new MutationObserver(t=>{var s;this.mediaController&&!((s=this.mediaController)!=null&&s.breakpointsComputed)||t.some(r=>{const n=r.target;return n===this?!0:n.localName!=="media-controller"?!1:!!(Rc[r.attributeName]||r.attributeName.startsWith("breakpoint"))})&&this.render()});e.observe(this,{attributes:!0}),e.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.addEventListener(ms.BREAKPOINTS_COMPUTED,this.render),Lc(this,Xh,ET).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var e;return(e=Qh(this,wn))!=null?e:this.constructor.template}set template(e){if(e===null){this.removeAttribute("template");return}typeof e=="string"?this.setAttribute("template",e):e instanceof HTMLTemplateElement&&(yr(this,wn,e),yr(this,Mn,null),this.createRenderer())}get props(){var e,t,s;const r=[...Array.from((t=(e=this.mediaController)==null?void 0:e.attributes)!=null?t:[]).filter(({name:a})=>Rc[a]||a.startsWith("breakpoint")),...Array.from(this.attributes)],n={};for(const a of r){const o=(s=Rc[a.name])!=null?s:ZD(a.name);let{value:l}=a;l!=null?(tb(l)&&(l=parseFloat(l)),n[o]=l===""?!0:l):n[o]=!1}return n}attributeChangedCallback(e,t,s){e==="template"&&t!=s&&Lc(this,td,Zh).call(this)}connectedCallback(){Lc(this,td,Zh).call(this)}createRenderer(){this.template instanceof HTMLTemplateElement&&this.template!==Qh(this,ed)&&(yr(this,ed,this.template),this.renderer=new Mu(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(yT.content.cloneNode(!0),this.renderer))}render(){var e;(e=this.renderer)==null||e.update(this.props)}}wn=new WeakMap;ed=new WeakMap;Mn=new WeakMap;Xh=new WeakSet;ET=function(i){if(Object.prototype.hasOwnProperty.call(this,i)){const e=this[i];delete this[i],this[i]=e}};td=new WeakSet;Zh=function(){var i;const e=this.getAttribute("template");if(!e||e===Qh(this,Mn))return;const t=this.getRootNode(),s=(i=t?.getElementById)==null?void 0:i.call(t,e);if(s){yr(this,Mn,e),yr(this,wn,s),this.createRenderer();return}QM(e)&&(yr(this,Mn,e),XM(e).then(r=>{const n=tt.createElement("template");n.innerHTML=r,yr(this,wn,n),this.createRenderer()}).catch(console.error))};Pu.observedAttributes=["template"];Pu.processor=Qm;function QM(i){if(!/^(\/|\.\/|https?:\/\/)/.test(i))return!1;const e=/^https?:\/\//.test(i)?void 0:location.origin;try{new URL(i,e)}catch{return!1}return!0}async function XM(i){const e=await fetch(i);if(e.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${e.status}`);return e.text()}k.customElements.get("media-theme")||k.customElements.define("media-theme",Pu);function ZM({anchor:i,floating:e,placement:t}){const s=JM({anchor:i,floating:e}),{x:r,y:n}=tP(s,t);return{x:r,y:n}}function JM({anchor:i,floating:e}){return{anchor:eP(i,e.offsetParent),floating:{x:0,y:0,width:e.offsetWidth,height:e.offsetHeight}}}function eP(i,e){var t;const s=i.getBoundingClientRect(),r=(t=e?.getBoundingClientRect())!=null?t:{x:0,y:0};return{x:s.x-r.x,y:s.y-r.y,width:s.width,height:s.height}}function tP({anchor:i,floating:e},t){const s=iP(t)==="x"?"y":"x",r=s==="y"?"height":"width",n=bT(t),a=i.x+i.width/2-e.width/2,o=i.y+i.height/2-e.height/2,l=i[r]/2-e[r]/2;let d;switch(n){case"top":d={x:a,y:i.y-e.height};break;case"bottom":d={x:a,y:i.y+i.height};break;case"right":d={x:i.x+i.width,y:o};break;case"left":d={x:i.x-e.width,y:o};break;default:d={x:i.x,y:i.y}}switch(t.split("-")[1]){case"start":d[s]-=l;break;case"end":d[s]+=l;break}return d}function bT(i){return i.split("-")[0]}function iP(i){return["top","bottom"].includes(bT(i))?"y":"x"}class Zm extends Event{constructor({action:e="auto",relatedTarget:t,...s}){super("invoke",s),this.action=e,this.relatedTarget=t}}class sP extends Event{constructor({newState:e,oldState:t,...s}){super("toggle",s),this.newState=e,this.oldState=t}}var Jm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},_e=(i,e,t)=>(Jm(i,e,"read from private field"),t?t.call(i):e.get(i)),ke=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ni=(i,e,t,s)=>(Jm(i,e,"write to private field"),e.set(i,t),t),De=(i,e,t)=>(Jm(i,e,"access private method"),t),Ui,Ir,Ws,id,sd,Lr,po,Jh,TT,tu,ep,iu,rd,ef,tf,_T,sf,AT,rf,ST,Pn,On,Nn,go,su,tp,nf,IT,ip,LT,af,RT,sp,xT,of,kT,lf,DT,Wa,ru,df,CT,qa,nu,nd,uf;function Vn({type:i,text:e,value:t,checked:s}){const r=tt.createElement("media-chrome-menu-item");r.type=i,r.part.add("menu-item"),r.part.add(i),r.value=t,r.checked=s;const n=tt.createElement("span");return n.textContent=e,r.append(n),r}function Rr(i,e){let t=i.querySelector(`:scope > [slot="${e}"]`);if(t?.nodeName=="SLOT"&&(t=t.assignedElements({flatten:!0})[0]),t)return t=t.cloneNode(!0),t;const s=i.shadowRoot.querySelector(`[name="${e}"] > svg`);return s?s.cloneNode(!0):""}function rP(i){return` + + +
+ + +
+ + `}const Js={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"};class ri extends k.HTMLElement{constructor(){if(super(),ke(this,Jh),ke(this,tu),ke(this,rd),ke(this,tf),ke(this,sf),ke(this,rf),ke(this,Nn),ke(this,su),ke(this,nf),ke(this,ip),ke(this,af),ke(this,sp),ke(this,of),ke(this,lf),ke(this,Wa),ke(this,df),ke(this,qa),ke(this,nd),ke(this,Ui,null),ke(this,Ir,null),ke(this,Ws,null),ke(this,id,new Set),ke(this,sd,void 0),ke(this,Lr,!1),ke(this,po,null),ke(this,iu,()=>{const e=_e(this,id),t=new Set(this.items);for(const s of e)t.has(s)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:s}));for(const s of t)e.has(s)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:s}));Ni(this,id,t)}),ke(this,Pn,()=>{De(this,Nn,go).call(this),De(this,su,tp).call(this,!1)}),ke(this,On,()=>{De(this,Nn,go).call(this)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),Ni(this,sd,new MutationObserver(_e(this,iu))),_e(this,sd).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[Js.DISABLED,Js.HIDDEN,Js.STYLE,Js.ANCHOR,Ae.MEDIA_CONTROLLER]}static formatMenuItemText(e,t){return e}enable(){this.addEventListener("click",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this),this.addEventListener("invoke",this),this.addEventListener("toggle",this)}disable(){this.removeEventListener("click",this),this.removeEventListener("focusout",this),this.removeEventListener("keyup",this),this.removeEventListener("invoke",this),this.removeEventListener("toggle",this)}handleEvent(e){switch(e.type){case"slotchange":De(this,Jh,TT).call(this,e);break;case"invoke":De(this,tf,_T).call(this,e);break;case"click":De(this,nf,IT).call(this,e);break;case"toggle":De(this,af,RT).call(this,e);break;case"focusout":De(this,of,kT).call(this,e);break;case"keydown":De(this,lf,DT).call(this,e);break}}connectedCallback(){var e,t;Ni(this,po,vm(this.shadowRoot,":host")),De(this,rd,ef).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),Ni(this,Ui,Ah(this)),(t=(e=_e(this,Ui))==null?void 0:e.associateElement)==null||t.call(e,this),this.hidden||(Hn(vo(this),_e(this,Pn)),Hn(this,_e(this,On))),De(this,tu,ep).call(this)}disconnectedCallback(){var e,t;Gn(vo(this),_e(this,Pn)),Gn(this,_e(this,On)),this.disable(),(t=(e=_e(this,Ui))==null?void 0:e.unassociateElement)==null||t.call(e,this),Ni(this,Ui,null)}attributeChangedCallback(e,t,s){var r,n,a,o;e===Js.HIDDEN&&s!==t?(_e(this,Lr)||Ni(this,Lr,!0),this.hidden?De(this,rf,ST).call(this):De(this,sf,AT).call(this),this.dispatchEvent(new sP({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):e===Ae.MEDIA_CONTROLLER?(t&&((n=(r=_e(this,Ui))==null?void 0:r.unassociateElement)==null||n.call(r,this),Ni(this,Ui,null)),s&&this.isConnected&&(Ni(this,Ui,Ah(this)),(o=(a=_e(this,Ui))==null?void 0:a.associateElement)==null||o.call(a,this))):e===Js.DISABLED&&s!==t?s==null?this.enable():this.disable():e===Js.STYLE&&s!==t&&De(this,rd,ef).call(this)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}get anchor(){return this.getAttribute("anchor")}set anchor(e){this.setAttribute("anchor",`${e}`)}get anchorElement(){var e;return this.anchor?(e=_u(this))==null?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(nP)}get radioGroupItems(){return this.items.filter(e=>e.role==="menuitemradio")}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,t;return(t=(e=this.checkedItems[0])==null?void 0:e.value)!=null?t:""}set value(e){const t=this.items.find(s=>s.value===e);t&&De(this,nd,uf).call(this,t)}focus(){if(Ni(this,Ir,gm()),this.items.length){De(this,qa,nu).call(this,this.items[0]),this.items[0].focus();return}const e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');e?.focus()}handleSelect(e){var t;const s=De(this,Wa,ru).call(this,e);s&&(De(this,nd,uf).call(this,s,s.type==="checkbox"),_e(this,Ws)&&!this.hidden&&((t=_e(this,Ir))==null||t.focus(),this.hidden=!0))}get keysUsed(){return["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var t,s;const{key:r}=e,n=this.items,a=(s=(t=De(this,Wa,ru).call(this,e))!=null?t:De(this,df,CT).call(this))!=null?s:n[0],o=n.indexOf(a);let l=Math.max(0,o);r==="ArrowDown"?l++:r==="ArrowUp"?l--:e.key==="Home"?l=0:e.key==="End"&&(l=n.length-1),l<0&&(l=n.length-1),l>n.length-1&&(l=0),De(this,qa,nu).call(this,n[l]),n[l].focus()}}Ui=new WeakMap;Ir=new WeakMap;Ws=new WeakMap;id=new WeakMap;sd=new WeakMap;Lr=new WeakMap;po=new WeakMap;Jh=new WeakSet;TT=function(i){const e=i.target;for(const t of e.assignedNodes({flatten:!0}))t.nodeType===3&&t.textContent.trim()===""&&t.remove();["header","title"].includes(e.name)&&De(this,tu,ep).call(this),e.name||_e(this,iu).call(this)};tu=new WeakSet;ep=function(){const i=this.shadowRoot.querySelector('slot[name="header"]'),e=this.shadowRoot.querySelector('slot[name="title"]');i.hidden=e.assignedNodes().length===0&&i.assignedNodes().length===0};iu=new WeakMap;rd=new WeakSet;ef=function(){var i;const e=this.shadowRoot.querySelector("#layout-row"),t=(i=getComputedStyle(this).getPropertyValue("--media-menu-layout"))==null?void 0:i.trim();e.setAttribute("media",t==="row"?"":"width:0")};tf=new WeakSet;_T=function(i){Ni(this,Ws,i.relatedTarget),gs(this,i.relatedTarget)||(this.hidden=!this.hidden)};sf=new WeakSet;AT=function(){var i;(i=_e(this,Ws))==null||i.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),Hn(vo(this),_e(this,Pn)),Hn(this,_e(this,On))};rf=new WeakSet;ST=function(){var i;(i=_e(this,Ws))==null||i.setAttribute("aria-expanded","false"),Gn(vo(this),_e(this,Pn)),Gn(this,_e(this,On))};Pn=new WeakMap;On=new WeakMap;Nn=new WeakSet;go=function(i){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;const{x:e,y:t}=ZM({anchor:this.anchorElement,floating:this,placement:"top-start"});i??(i=this.offsetWidth);const r=vo(this).getBoundingClientRect(),n=r.width-e-i,a=r.height-t-this.offsetHeight,{style:o}=_e(this,po);o.setProperty("position","absolute"),o.setProperty("right",`${Math.max(0,n)}px`),o.setProperty("--_menu-bottom",`${a}px`);const l=getComputedStyle(this),u=o.getPropertyValue("--_menu-bottom")===l.bottom?a:parseFloat(l.bottom),c=r.height-u-parseFloat(l.marginBottom);this.style.setProperty("--_menu-max-height",`${c}px`)};su=new WeakSet;tp=function(i){const e=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),t=e?.querySelector('[role="menu"]'),{style:s}=_e(this,po);if(i||s.setProperty("--media-menu-transition-in","none"),t){const r=t.offsetHeight,n=Math.max(t.offsetWidth,e.offsetWidth);this.style.setProperty("min-width",`${n}px`),this.style.setProperty("min-height",`${r}px`),De(this,Nn,go).call(this,n)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),De(this,Nn,go).call(this);s.removeProperty("--media-menu-transition-in")};nf=new WeakSet;IT=function(i){var e;if(i.stopPropagation(),i.composedPath().includes(_e(this,ip,LT))){(e=_e(this,Ir))==null||e.focus(),this.hidden=!0;return}const t=De(this,Wa,ru).call(this,i);!t||t.hasAttribute("disabled")||(De(this,qa,nu).call(this,t),this.handleSelect(i))};ip=new WeakSet;LT=function(){var i;return(i=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:!0}))==null?void 0:i.find(t=>t.matches('button[part~="back"]'))};af=new WeakSet;RT=function(i){if(i.target===this)return;De(this,sp,xT).call(this);const e=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(const t of e)t.invokeTargetElement!=i.target&&i.newState=="open"&&t.getAttribute("aria-expanded")=="true"&&!t.invokeTargetElement.hidden&&t.invokeTargetElement.dispatchEvent(new Zm({relatedTarget:t}));for(const t of e)t.setAttribute("aria-expanded",`${!t.submenuElement.hidden}`);De(this,su,tp).call(this,!0)};sp=new WeakSet;xT=function(){const e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e)};of=new WeakSet;kT=function(i){var e;gs(this,i.relatedTarget)||(_e(this,Lr)&&((e=_e(this,Ir))==null||e.focus()),_e(this,Ws)&&_e(this,Ws)!==i.relatedTarget&&!this.hidden&&(this.hidden=!0))};lf=new WeakSet;DT=function(i){var e,t,s,r,n;const{key:a,ctrlKey:o,altKey:l,metaKey:d}=i;if(!(o||l||d)&&this.keysUsed.includes(a))if(i.preventDefault(),i.stopPropagation(),a==="Tab"){if(_e(this,Lr)){this.hidden=!0;return}i.shiftKey?(t=(e=this.previousElementSibling)==null?void 0:e.focus)==null||t.call(e):(r=(s=this.nextElementSibling)==null?void 0:s.focus)==null||r.call(s),this.blur()}else a==="Escape"?((n=_e(this,Ir))==null||n.focus(),_e(this,Lr)&&(this.hidden=!0)):a==="Enter"||a===" "?this.handleSelect(i):this.handleMove(i)};Wa=new WeakSet;ru=function(i){return i.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))};df=new WeakSet;CT=function(){return this.items.find(i=>i.tabIndex===0)};qa=new WeakSet;nu=function(i){for(const e of this.items)e.tabIndex=e===i?0:-1};nd=new WeakSet;uf=function(i,e){const t=[...this.checkedItems];i.type==="radio"&&this.radioGroupItems.forEach(s=>s.checked=!1),e?i.checked=!i.checked:i.checked=!0,this.checkedItems.some((s,r)=>s!=t[r])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};ri.shadowRootOptions={mode:"open"};ri.getTemplateHTML=rP;function nP(i){return["menuitem","menuitemradio","menuitemcheckbox"].includes(i?.role)}function vo(i){var e;return(e=i.getAttribute("bounds")?Yn(i,`#${i.getAttribute("bounds")}`):wt(i)||i.parentElement)!=null?e:i}k.customElements.get("media-chrome-menu")||k.customElements.define("media-chrome-menu",ri);var rp=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Yi=(i,e,t)=>(rp(i,e,"read from private field"),t?t.call(i):e.get(i)),ss=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},xc=(i,e,t,s)=>(rp(i,e,"write to private field"),e.set(i,t),t),Ei=(i,e,t)=>(rp(i,e,"access private method"),t),ad,Ya,cf,wT,au,np,ap,MT,ji,Wn,Eo,hf,PT,od,ff;function aP(i){return` + + + + + + + + + ${this.getSuffixSlotInnerHTML(i)} + + + `}function oP(i){return""}const Qt={TYPE:"type",VALUE:"value",CHECKED:"checked",DISABLED:"disabled"};class Ys extends k.HTMLElement{constructor(){if(super(),ss(this,cf),ss(this,au),ss(this,ap),ss(this,Wn),ss(this,hf),ss(this,od),ss(this,ad,!1),ss(this,Ya,void 0),ss(this,ji,()=>{var e,t;this.submenuElement.items&&this.setAttribute("submenusize",`${this.submenuElement.items.length}`);const s=this.shadowRoot.querySelector('slot[name="description"]'),r=(e=this.submenuElement.checkedItems)==null?void 0:e[0],n=(t=r?.dataset.description)!=null?t:r?.text,a=tt.createElement("span");a.textContent=n??"",s.replaceChildren(a)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.shadowRoot.addEventListener("slotchange",this)}static get observedAttributes(){return[Qt.TYPE,Qt.DISABLED,Qt.CHECKED,Qt.VALUE]}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),la(this)&&!this.hasAttribute("aria-checked")&&this.setAttribute("aria-checked","false"),this.addEventListener("click",this),this.addEventListener("keydown",this)}disable(){this.removeAttribute("tabindex"),this.removeEventListener("click",this),this.removeEventListener("keydown",this),this.removeEventListener("keyup",this)}handleEvent(e){switch(e.type){case"slotchange":Ei(this,cf,wT).call(this,e);break;case"click":this.handleClick(e);break;case"keydown":Ei(this,hf,PT).call(this,e);break;case"keyup":Ei(this,Wn,Eo).call(this,e);break}}attributeChangedCallback(e,t,s){e===Qt.CHECKED&&la(this)&&!Yi(this,ad)?this.setAttribute("aria-checked",s!=null?"true":"false"):e===Qt.TYPE&&s!==t?this.role="menuitem"+s:e===Qt.DISABLED&&s!==t&&(s==null?this.enable():this.disable())}connectedCallback(){this.hasAttribute(Qt.DISABLED)||this.enable(),this.role="menuitem"+this.type,xc(this,Ya,mf(this,this.parentNode)),Ei(this,od,ff).call(this),this.submenuElement&&Ei(this,au,np).call(this)}disconnectedCallback(){this.disable(),Ei(this,od,ff).call(this),xc(this,Ya,null)}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`)}get invokeTargetElement(){var e;return this.invokeTarget?(e=_u(this))==null?void 0:e.querySelector(`#${this.invokeTarget}`):this.submenuElement}get submenuElement(){return this.shadowRoot.querySelector('slot[name="submenu"]').assignedElements({flatten:!0})[0]}get type(){var e;return(e=this.getAttribute(Qt.TYPE))!=null?e:""}set type(e){this.setAttribute(Qt.TYPE,`${e}`)}get value(){var e;return(e=this.getAttribute(Qt.VALUE))!=null?e:this.text}set value(e){this.setAttribute(Qt.VALUE,e)}get text(){var e;return((e=this.textContent)!=null?e:"").trim()}get checked(){if(la(this))return this.getAttribute("aria-checked")==="true"}set checked(e){la(this)&&(xc(this,ad,!0),this.setAttribute("aria-checked",e?"true":"false"),e?this.part.add("checked"):this.part.remove("checked"))}handleClick(e){la(this)||this.invokeTargetElement&&gs(this,e.target)&&this.invokeTargetElement.dispatchEvent(new Zm({relatedTarget:this}))}get keysUsed(){return["Enter"," "]}}ad=new WeakMap;Ya=new WeakMap;cf=new WeakSet;wT=function(i){const e=i.target;if(!e?.name)for(const s of e.assignedNodes({flatten:!0}))s instanceof Text&&s.textContent.trim()===""&&s.remove();e.name==="submenu"&&(this.submenuElement?Ei(this,au,np).call(this):Ei(this,ap,MT).call(this))};au=new WeakSet;np=async function(){this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",`${!this.submenuElement.hidden}`),this.submenuElement.addEventListener("change",Yi(this,ji)),this.submenuElement.addEventListener("addmenuitem",Yi(this,ji)),this.submenuElement.addEventListener("removemenuitem",Yi(this,ji)),Yi(this,ji).call(this)};ap=new WeakSet;MT=function(){this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.submenuElement.removeEventListener("change",Yi(this,ji)),this.submenuElement.removeEventListener("addmenuitem",Yi(this,ji)),this.submenuElement.removeEventListener("removemenuitem",Yi(this,ji)),Yi(this,ji).call(this)};ji=new WeakMap;Wn=new WeakSet;Eo=function(i){const{key:e}=i;if(!this.keysUsed.includes(e)){this.removeEventListener("keyup",Ei(this,Wn,Eo));return}this.handleClick(i)};hf=new WeakSet;PT=function(i){const{metaKey:e,altKey:t,key:s}=i;if(e||t||!this.keysUsed.includes(s)){this.removeEventListener("keyup",Ei(this,Wn,Eo));return}this.addEventListener("keyup",Ei(this,Wn,Eo),{once:!0})};od=new WeakSet;ff=function(){var i;const e=(i=Yi(this,Ya))==null?void 0:i.radioGroupItems;if(!e)return;let t=e.filter(s=>s.getAttribute("aria-checked")==="true").pop();t||(t=e[0]);for(const s of e)s.setAttribute("aria-checked","false");t?.setAttribute("aria-checked","true")};Ys.shadowRootOptions={mode:"open"};Ys.getTemplateHTML=aP;Ys.getSuffixSlotInnerHTML=oP;function la(i){return i.type==="radio"||i.type==="checkbox"}function mf(i,e){if(!i)return null;const{host:t}=i.getRootNode();return!e&&t?mf(i,t):e?.items?e:mf(e,e?.parentNode)}k.customElements.get("media-chrome-menu-item")||k.customElements.define("media-chrome-menu-item",Ys);function lP(i){return` + ${ri.getTemplateHTML(i)} + + `}class OT extends ri{get anchorElement(){return this.anchor!=="auto"?super.anchorElement:wt(this).querySelector("media-settings-menu-button")}}OT.getTemplateHTML=lP;k.customElements.get("media-settings-menu")||k.customElements.define("media-settings-menu",OT);function dP(i){return` + ${Ys.getTemplateHTML.call(this,i)} + + `}function uP(i){return` + + `}class Ou extends Ys{}Ou.shadowRootOptions={mode:"open"};Ou.getTemplateHTML=dP;Ou.getSuffixSlotInnerHTML=uP;k.customElements.get("media-settings-menu-item")||k.customElements.define("media-settings-menu-item",Ou);class Xn extends vt{connectedCallback(){super.connectedCallback(),this.invokeTargetElement&&this.setAttribute("aria-haspopup","menu")}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`)}get invokeTargetElement(){var e;return this.invokeTarget?(e=_u(this))==null?void 0:e.querySelector(`#${this.invokeTarget}`):null}handleClick(){var e;(e=this.invokeTargetElement)==null||e.dispatchEvent(new Zm({relatedTarget:this}))}}k.customElements.get("media-chrome-menu-button")||k.customElements.define("media-chrome-menu-button",Xn);function cP(){return` + + + + + `}function hP(){return J("Settings")}class op extends Xn{static get observedAttributes(){return[...super.observedAttributes,"target"]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",J("settings"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:wt(this).querySelector("media-settings-menu")}}op.getSlotTemplateHTML=cP;op.getTooltipContentHTML=hP;k.customElements.get("media-settings-menu-button")||k.customElements.define("media-settings-menu-button",op);var lp=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},NT=(i,e,t)=>(lp(i,e,"read from private field"),t?t.call(i):e.get(i)),sl=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},pf=(i,e,t,s)=>(lp(i,e,"write to private field"),e.set(i,t),t),rl=(i,e,t)=>(lp(i,e,"access private method"),t),Da,ou,ld,gf,dd,vf;class fP extends ri{constructor(){super(...arguments),sl(this,ld),sl(this,dd),sl(this,Da,[]),sl(this,ou,void 0)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_AUDIO_TRACK_LIST,_.MEDIA_AUDIO_TRACK_ENABLED,_.MEDIA_AUDIO_TRACK_UNAVAILABLE]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_AUDIO_TRACK_ENABLED&&t!==s?this.value=s:e===_.MEDIA_AUDIO_TRACK_LIST&&t!==s&&(pf(this,Da,zD(s??"")),rl(this,ld,gf).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",rl(this,dd,vf))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",rl(this,dd,vf))}get anchorElement(){var e;return this.anchor!=="auto"?super.anchorElement:(e=wt(this))==null?void 0:e.querySelector("media-audio-track-menu-button")}get mediaAudioTrackList(){return NT(this,Da)}set mediaAudioTrackList(e){pf(this,Da,e),rl(this,ld,gf).call(this)}get mediaAudioTrackEnabled(){var e;return(e=Ne(this,_.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){Ue(this,_.MEDIA_AUDIO_TRACK_ENABLED,e)}}Da=new WeakMap;ou=new WeakMap;ld=new WeakSet;gf=function(){if(NT(this,ou)===JSON.stringify(this.mediaAudioTrackList))return;pf(this,ou,JSON.stringify(this.mediaAudioTrackList));const i=this.mediaAudioTrackList;this.defaultSlot.textContent="",i.sort((e,t)=>e.id.localeCompare(t.id,void 0,{numeric:!0}));for(const e of i){const t=this.formatMenuItemText(e.label,e),s=Vn({type:"radio",text:t,value:`${e.id}`,checked:e.enabled});s.prepend(Rr(this,"checked-indicator")),this.defaultSlot.append(s)}};dd=new WeakSet;vf=function(){if(this.value==null)return;const i=new k.CustomEvent(Y.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};k.customElements.get("media-audio-track-menu")||k.customElements.define("media-audio-track-menu",fP);const mP=``;function pP(){return` + + ${mP} + `}function gP(){return J("Audio")}const j0=i=>{const e=J("Audio");i.setAttribute("aria-label",e)};class dp extends Xn{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_AUDIO_TRACK_ENABLED,_.MEDIA_AUDIO_TRACK_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),j0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_LANG&&j0(this)}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=wt(this))==null?void 0:e.querySelector("media-audio-track-menu")}get mediaAudioTrackEnabled(){var e;return(e=Ne(this,_.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){Ue(this,_.MEDIA_AUDIO_TRACK_ENABLED,e)}}dp.getSlotTemplateHTML=pP;dp.getTooltipContentHTML=gP;k.customElements.get("media-audio-track-menu-button")||k.customElements.define("media-audio-track-menu-button",dp);var up=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},vP=(i,e,t)=>(up(i,e,"read from private field"),e.get(i)),kc=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},EP=(i,e,t,s)=>(up(i,e,"write to private field"),e.set(i,t),t),nl=(i,e,t)=>(up(i,e,"access private method"),t),lu,ud,Ef,cd,yf;const yP=` + `;function bP(i){return` + ${ri.getTemplateHTML(i)} + + `}class UT extends ri{constructor(){super(...arguments),kc(this,ud),kc(this,cd),kc(this,lu,void 0)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_SUBTITLES_LIST,_.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_SUBTITLES_LIST&&t!==s?nl(this,ud,Ef).call(this):e===_.MEDIA_SUBTITLES_SHOWING&&t!==s&&(this.value=s||"",nl(this,ud,Ef).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",nl(this,cd,yf))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",nl(this,cd,yf))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:wt(this).querySelector("media-captions-menu-button")}get mediaSubtitlesList(){return z0(this,_.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){Q0(this,_.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return z0(this,_.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){Q0(this,_.MEDIA_SUBTITLES_SHOWING,e)}}lu=new WeakMap;ud=new WeakSet;Ef=function(){var i;const e=vP(this,lu)!==JSON.stringify(this.mediaSubtitlesList),t=this.value!==this.getAttribute(_.MEDIA_SUBTITLES_SHOWING);if(!e&&!t)return;EP(this,lu,JSON.stringify(this.mediaSubtitlesList)),this.defaultSlot.textContent="";const s=!this.value,r=Vn({type:"radio",text:this.formatMenuItemText(J("Off")),value:"off",checked:s});r.prepend(Rr(this,"checked-indicator")),this.defaultSlot.append(r);const n=this.mediaSubtitlesList;for(const a of n){const o=Vn({type:"radio",text:this.formatMenuItemText(a.label,a),value:Rh(a),checked:this.value==Rh(a)});o.prepend(Rr(this,"checked-indicator")),((i=a.kind)!=null?i:"subs")==="captions"&&o.append(Rr(this,"captions-indicator")),this.defaultSlot.append(o)}};cd=new WeakSet;yf=function(){const i=this.mediaSubtitlesShowing,e=this.getAttribute(_.MEDIA_SUBTITLES_SHOWING),t=this.value!==e;if(i?.length&&t&&this.dispatchEvent(new k.CustomEvent(Y.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:i})),!this.value||!t)return;const s=new k.CustomEvent(Y.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(s)};UT.getTemplateHTML=bP;const z0=(i,e)=>{const t=i.getAttribute(e);return t?Ru(t):[]},Q0=(i,e,t)=>{if(!t?.length){i.removeAttribute(e);return}const s=uo(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};k.customElements.get("media-captions-menu")||k.customElements.define("media-captions-menu",UT);const TP=``,_P=``;function AP(){return` + + + + ${TP} + ${_P} + + `}function SP(){return J("Captions")}const X0=i=>{i.setAttribute("data-captions-enabled",Tb(i).toString())},Z0=i=>{i.setAttribute("aria-label",J("closed captions"))};class cp extends Xn{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_SUBTITLES_LIST,_.MEDIA_SUBTITLES_SHOWING,_.MEDIA_LANG]}connectedCallback(){super.connectedCallback(),Z0(this),X0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_SUBTITLES_SHOWING?X0(this):e===_.MEDIA_LANG&&Z0(this)}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=wt(this))==null?void 0:e.querySelector("media-captions-menu")}get mediaSubtitlesList(){return J0(this,_.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){ev(this,_.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return J0(this,_.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){ev(this,_.MEDIA_SUBTITLES_SHOWING,e)}}cp.getSlotTemplateHTML=AP;cp.getTooltipContentHTML=SP;const J0=(i,e)=>{const t=i.getAttribute(e);return t?Ru(t):[]},ev=(i,e,t)=>{if(!t?.length){i.removeAttribute(e);return}const s=uo(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};k.customElements.get("media-captions-menu-button")||k.customElements.define("media-captions-menu-button",cp);var $T=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},mn=(i,e,t)=>($T(i,e,"read from private field"),t?t.call(i):e.get(i)),Dc=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Wr=(i,e,t)=>($T(i,e,"access private method"),t),Ps,pn,Ca,hd,bf;const Cc={RATES:"rates"};class IP extends ri{constructor(){super(),Dc(this,pn),Dc(this,hd),Dc(this,Ps,new bm(this,Cc.RATES,{defaultValue:eT})),Wr(this,pn,Ca).call(this)}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PLAYBACK_RATE,Cc.RATES]}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_PLAYBACK_RATE&&t!=s?(this.value=s,Wr(this,pn,Ca).call(this)):e===Cc.RATES&&t!=s&&(mn(this,Ps).value=s,Wr(this,pn,Ca).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Wr(this,hd,bf))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Wr(this,hd,bf))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:wt(this).querySelector("media-playback-rate-menu-button")}get rates(){return mn(this,Ps)}set rates(e){e?Array.isArray(e)?mn(this,Ps).value=e.join(" "):typeof e=="string"&&(mn(this,Ps).value=e):mn(this,Ps).value="",Wr(this,pn,Ca).call(this)}get mediaPlaybackRate(){return Oe(this,_.MEDIA_PLAYBACK_RATE,_n)}set mediaPlaybackRate(e){Ye(this,_.MEDIA_PLAYBACK_RATE,e)}}Ps=new WeakMap;pn=new WeakSet;Ca=function(){this.defaultSlot.textContent="";const i=this.mediaPlaybackRate,e=new Set(Array.from(mn(this,Ps)).map(s=>Number(s)));i>0&&!e.has(i)&&e.add(i);const t=Array.from(e).sort((s,r)=>s-r);for(const s of t){const r=Vn({type:"radio",text:this.formatMenuItemText(`${s}x`,s),value:s.toString(),checked:i===s});r.prepend(Rr(this,"checked-indicator")),this.defaultSlot.append(r)}};hd=new WeakSet;bf=function(){if(!this.value)return;const i=new k.CustomEvent(Y.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};k.customElements.get("media-playback-rate-menu")||k.customElements.define("media-playback-rate-menu",IP);const fd=1;function LP(i){return` + + ${i.mediaplaybackrate||fd}x + `}function RP(){return J("Playback rate")}class hp extends Xn{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_PLAYBACK_RATE]}constructor(){var e;super(),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(e=this.mediaPlaybackRate)!=null?e:fd}x`}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),e===_.MEDIA_PLAYBACK_RATE){const r=s?+s:Number.NaN,n=Number.isNaN(r)?fd:r;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",J("Playback rate {playbackRate}",{playbackRate:n}))}}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:wt(this).querySelector("media-playback-rate-menu")}get mediaPlaybackRate(){return Oe(this,_.MEDIA_PLAYBACK_RATE,fd)}set mediaPlaybackRate(e){Ye(this,_.MEDIA_PLAYBACK_RATE,e)}}hp.getSlotTemplateHTML=LP;hp.getTooltipContentHTML=RP;k.customElements.get("media-playback-rate-menu-button")||k.customElements.define("media-playback-rate-menu-button",hp);var fp=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},wa=(i,e,t)=>(fp(i,e,"read from private field"),t?t.call(i):e.get(i)),al=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},tv=(i,e,t,s)=>(fp(i,e,"write to private field"),e.set(i,t),t),qr=(i,e,t)=>(fp(i,e,"access private method"),t),Ma,An,gn,Pa,md,Tf;class xP extends ri{constructor(){super(...arguments),al(this,gn),al(this,md),al(this,Ma,[]),al(this,An,{})}static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_RENDITION_LIST,_.MEDIA_RENDITION_SELECTED,_.MEDIA_RENDITION_UNAVAILABLE,_.MEDIA_HEIGHT]}static formatMenuItemText(e,t){return super.formatMenuItemText(e,t)}static formatRendition(e,{showBitrate:t=!1}={}){const s=`${Math.min(e.width,e.height)}p`;if(t&&e.bitrate){const r=e.bitrate/1e6,n=`${r.toFixed(r<1?1:0)} Mbps`;return`${s} (${n})`}return this.formatMenuItemText(s,e)}static compareRendition(e,t){var s,r;return t.height===e.height?((s=t.bitrate)!=null?s:0)-((r=e.bitrate)!=null?r:0):t.height-e.height}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_RENDITION_SELECTED&&t!==s?(this.value=s??"auto",qr(this,gn,Pa).call(this)):e===_.MEDIA_RENDITION_LIST&&t!==s?(tv(this,Ma,WD(s)),qr(this,gn,Pa).call(this)):e===_.MEDIA_HEIGHT&&t!==s&&qr(this,gn,Pa).call(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",qr(this,md,Tf))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",qr(this,md,Tf))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:wt(this).querySelector("media-rendition-menu-button")}get mediaRenditionList(){return wa(this,Ma)}set mediaRenditionList(e){tv(this,Ma,e),qr(this,gn,Pa).call(this)}get mediaRenditionSelected(){return Ne(this,_.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){Ue(this,_.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return Oe(this,_.MEDIA_HEIGHT)}set mediaHeight(e){Ye(this,_.MEDIA_HEIGHT,e)}compareRendition(e,t){return this.constructor.compareRendition(e,t)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}formatRendition(e,t){return this.constructor.formatRendition(e,t)}showRenditionBitrate(e){return this.mediaRenditionList.some(t=>t!==e&&t.height===e.height&&t.bitrate!==e.bitrate)}}Ma=new WeakMap;An=new WeakMap;gn=new WeakSet;Pa=function(){if(wa(this,An).mediaRenditionList===JSON.stringify(this.mediaRenditionList)&&wa(this,An).mediaHeight===this.mediaHeight)return;wa(this,An).mediaRenditionList=JSON.stringify(this.mediaRenditionList),wa(this,An).mediaHeight=this.mediaHeight;const i=this.mediaRenditionList.sort(this.compareRendition.bind(this)),e=i.find(a=>a.id===this.mediaRenditionSelected);for(const a of i)a.selected=a===e;this.defaultSlot.textContent="";const t=!this.mediaRenditionSelected;for(const a of i){const o=this.formatRendition(a,{showBitrate:this.showRenditionBitrate(a)}),l=Vn({type:"radio",text:o,value:`${a.id}`,checked:a.selected&&!t});l.prepend(Rr(this,"checked-indicator")),this.defaultSlot.append(l)}const s=e&&this.showRenditionBitrate(e),r=t?e?this.formatMenuItemText(`${J("Auto")} • ${this.formatRendition(e,{showBitrate:s})}`,e):this.formatMenuItemText(`${J("Auto")} (${this.mediaHeight}p)`):this.formatMenuItemText(J("Auto")),n=Vn({type:"radio",text:r,value:"auto",checked:t});n.dataset.description=r,n.prepend(Rr(this,"checked-indicator")),this.defaultSlot.append(n)};md=new WeakSet;Tf=function(){if(this.value==null)return;const i=new k.CustomEvent(Y.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};k.customElements.get("media-rendition-menu")||k.customElements.define("media-rendition-menu",xP);const kP=``;function DP(){return` + + ${kP} + `}function CP(){return J("Quality")}class mp extends Xn{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_RENDITION_SELECTED,_.MEDIA_RENDITION_UNAVAILABLE,_.MEDIA_HEIGHT]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",J("quality"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:wt(this).querySelector("media-rendition-menu")}get mediaRenditionSelected(){return Ne(this,_.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){Ue(this,_.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return Oe(this,_.MEDIA_HEIGHT)}set mediaHeight(e){Ye(this,_.MEDIA_HEIGHT,e)}}mp.getSlotTemplateHTML=DP;mp.getTooltipContentHTML=CP;k.customElements.get("media-rendition-menu-button")||k.customElements.define("media-rendition-menu-button",mp);var pp=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Fi=(i,e,t)=>(pp(i,e,"read from private field"),t?t.call(i):e.get(i)),Li=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},FT=(i,e,t,s)=>(pp(i,e,"write to private field"),e.set(i,t),t),Jt=(i,e,t)=>(pp(i,e,"access private method"),t),qn,yo,Nu,fr,Sn,gp,BT,pd,_f,gd,Af,HT,du,uu,vd;function wP(i){return` + ${ri.getTemplateHTML(i)} + + `}class GT extends ri{constructor(){super(),Li(this,yo),Li(this,fr),Li(this,gp),Li(this,pd),Li(this,Af),Li(this,qn,!1),Li(this,gd,e=>{const t=e.target,s=t?.nodeName==="VIDEO",r=Jt(this,pd,_f).call(this,t);(s||r)&&(Fi(this,qn)?Jt(this,fr,Sn).call(this):Jt(this,Af,HT).call(this,e))}),Li(this,du,e=>{const t=e.target,s=this.contains(t),r=e.button===2,n=t?.nodeName==="VIDEO",a=Jt(this,pd,_f).call(this,t);s||r&&(n||a)||Jt(this,fr,Sn).call(this)}),Li(this,uu,e=>{e.key==="Escape"&&Jt(this,fr,Sn).call(this)}),Li(this,vd,e=>{var t,s;const r=e.target;if((t=r.matches)!=null&&t.call(r,'button[invoke="copy"]')){const n=(s=r.closest("media-context-menu-item"))==null?void 0:s.querySelector('input[slot="copy"]');n&&navigator.clipboard.writeText(n.value)}Jt(this,fr,Sn).call(this)}),this.setAttribute("noautohide",""),Jt(this,yo,Nu).call(this)}connectedCallback(){super.connectedCallback(),wt(this).addEventListener("contextmenu",Fi(this,gd)),this.addEventListener("click",Fi(this,vd))}disconnectedCallback(){super.disconnectedCallback(),wt(this).removeEventListener("contextmenu",Fi(this,gd)),this.removeEventListener("click",Fi(this,vd)),document.removeEventListener("mousedown",Fi(this,du)),document.removeEventListener("keydown",Fi(this,uu))}}qn=new WeakMap;yo=new WeakSet;Nu=function(){this.hidden=!Fi(this,qn)};fr=new WeakSet;Sn=function(){FT(this,qn,!1),Jt(this,yo,Nu).call(this)};gp=new WeakSet;BT=function(){document.querySelectorAll("media-context-menu").forEach(e=>{var t;e!==this&&Jt(t=e,fr,Sn).call(t)})};pd=new WeakSet;_f=function(i){return i?i.hasAttribute("slot")&&i.getAttribute("slot")==="media"?!0:i.nodeName.includes("-")&&i.tagName.includes("-")?i.hasAttribute("src")||i.hasAttribute("poster")||i.hasAttribute("preload")||i.hasAttribute("playsinline"):!1:!1};gd=new WeakMap;Af=new WeakSet;HT=function(i){i.preventDefault(),Jt(this,gp,BT).call(this),FT(this,qn,!0),this.style.position="fixed",this.style.left=`${i.clientX}px`,this.style.top=`${i.clientY}px`,Jt(this,yo,Nu).call(this),document.addEventListener("mousedown",Fi(this,du),{once:!0}),document.addEventListener("keydown",Fi(this,uu),{once:!0})};du=new WeakMap;uu=new WeakMap;vd=new WeakMap;GT.getTemplateHTML=wP;k.customElements.get("media-context-menu")||k.customElements.define("media-context-menu",GT);function MP(i){return` + ${Ys.getTemplateHTML.call(this,i)} + + `}class vp extends Ys{}vp.shadowRootOptions={mode:"open"};vp.getTemplateHTML=MP;k.customElements.get("media-context-menu-item")||k.customElements.define("media-context-menu-item",vp);var KT=i=>{throw TypeError(i)},Ep=(i,e,t)=>e.has(i)||KT("Cannot "+t),Ie=(i,e,t)=>(Ep(i,e,"read from private field"),t?t.call(i):e.get(i)),gi=(i,e,t)=>e.has(i)?KT("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Qi=(i,e,t,s)=>(Ep(i,e,"write to private field"),e.set(i,t),t),et=(i,e,t)=>(Ep(i,e,"access private method"),t),Uu=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment>"u"){class i extends Uu{}globalThis.DocumentFragment=i}var yp=class extends Uu{},PP=class extends Uu{},OP={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(yp)}},Ed,NP=class{constructor(e,t={}){gi(this,Ed),Qi(this,Ed,t?.detail)}get detail(){return Ie(this,Ed)}initCustomEvent(){}};Ed=new WeakMap;function UP(i,e){return new yp}var VT={document:{createElement:UP},DocumentFragment,customElements:OP,CustomEvent:NP,EventTarget:Uu,HTMLElement:yp,HTMLVideoElement:PP},WT=typeof window>"u"||typeof globalThis.customElements>"u",Ki=WT?VT:globalThis,cu=WT?VT.document:globalThis.document;function $P(i){let e="";return Object.entries(i).forEach(([t,s])=>{s!=null&&(e+=`${Sf(t)}: ${s}; `)}),e?e.trim():void 0}function Sf(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function qT(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function Ht(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function YT(i){let e=FP(i).toString();return e?"?"+e:""}function FP(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}var jT=(i,e)=>!i||!e?!1:i.contains(e)?!0:jT(i,e.getRootNode().host),zT="mux.com",BP=()=>{try{return"3.11.5"}catch{}return"UNKNOWN"},HP=BP(),QT=()=>HP,GP=(i,{token:e,customDomain:t=zT,thumbnailTime:s,programTime:r}={})=>{var n;let a=e==null?s:void 0,{aud:o}=(n=kn(e))!=null?n:{};if(!(e&&o!=="t"))return`https://image.${t}/${i}/thumbnail.webp${YT({token:e,time:a,program_time:r})}`},KP=(i,{token:e,customDomain:t=zT,programStartTime:s,programEndTime:r}={})=>{var n;let{aud:a}=(n=kn(e))!=null?n:{};if(!(e&&a!=="s"))return`https://image.${t}/${i}/storyboard.vtt${YT({token:e,format:"webp",program_start_time:s,program_end_time:r})}`},bp=i=>{if(i){if([Se.LIVE,Se.ON_DEMAND].includes(i))return i;if(i!=null&&i.includes("live"))return Se.LIVE}},VP={crossorigin:"crossOrigin",playsinline:"playsInline"};function WP(i){var e;return(e=VP[i])!=null?e:qT(i)}var vn,En,Dt,qP=class{constructor(e,t){gi(this,vn),gi(this,En),gi(this,Dt,[]),Qi(this,vn,e),Qi(this,En,t)}[Symbol.iterator](){return Ie(this,Dt).values()}get length(){return Ie(this,Dt).length}get value(){var e;return(e=Ie(this,Dt).join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(Qi(this,Dt,[]),this.add(...(t=e?.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return Ie(this,Dt)[e]}values(){return Ie(this,Dt).values()}keys(){return Ie(this,Dt).keys()}forEach(e){Ie(this,Dt).forEach(e)}add(...e){var t,s;e.forEach(r=>{this.contains(r)||Ie(this,Dt).push(r)}),!(this.value===""&&!((t=Ie(this,vn))!=null&&t.hasAttribute(`${Ie(this,En)}`)))&&((s=Ie(this,vn))==null||s.setAttribute(`${Ie(this,En)}`,`${this.value}`))}remove(...e){var t;e.forEach(s=>{Ie(this,Dt).splice(Ie(this,Dt).indexOf(s),1)}),(t=Ie(this,vn))==null||t.setAttribute(`${Ie(this,En)}`,`${this.value}`)}contains(e){return Ie(this,Dt).includes(e)}toggle(e,t){return typeof t<"u"?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){this.remove(e),this.add(t)}};vn=new WeakMap,En=new WeakMap,Dt=new WeakMap;var XT=`[mux-player ${QT()}]`;function ds(...i){console.warn(XT,...i)}function Vt(...i){console.error(XT,...i)}function ZT(i){var e;let t=(e=i.message)!=null?e:"";i.context&&(t+=` ${i.context}`),i.file&&(t+=` ${ie("Read more: ")} +https://github.com/muxinc/elements/blob/main/errors/${i.file}`),ds(t)}var At={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},dr={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},iv=Object.freeze({length:0,start(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),YP=Object.values(At).filter(i=>At.PLAYSINLINE!==i),jP=Object.values(dr),zP=[...YP,...jP],QP=class extends Ki.HTMLElement{static get observedAttributes(){return zP}constructor(){super()}attributeChangedCallback(i,e,t){var s,r;switch(i){case dr.MUTED:{this.media&&(this.media.muted=t!=null,this.media.defaultMuted=t!=null);return}case dr.VOLUME:{let n=(s=Ht(t))!=null?s:1;this.media&&(this.media.volume=n);return}case dr.PLAYBACKRATE:{let n=(r=Ht(t))!=null?r:1;this.media&&(this.media.playbackRate=n,this.media.defaultPlaybackRate=n);return}}}play(){var i,e;return(e=(i=this.media)==null?void 0:i.play())!=null?e:Promise.reject()}pause(){var i;(i=this.media)==null||i.pause()}load(){var i;(i=this.media)==null||i.load()}get media(){var i;return(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var i,e;return(e=(i=this.media)==null?void 0:i.paused)!=null?e:!0}get duration(){var i,e;return(e=(i=this.media)==null?void 0:i.duration)!=null?e:NaN}get ended(){var i,e;return(e=(i=this.media)==null?void 0:i.ended)!=null?e:!1}get buffered(){var i,e;return(e=(i=this.media)==null?void 0:i.buffered)!=null?e:iv}get seekable(){var i,e;return(e=(i=this.media)==null?void 0:i.seekable)!=null?e:iv}get readyState(){var i,e;return(e=(i=this.media)==null?void 0:i.readyState)!=null?e:0}get videoWidth(){var i,e;return(e=(i=this.media)==null?void 0:i.videoWidth)!=null?e:0}get videoHeight(){var i,e;return(e=(i=this.media)==null?void 0:i.videoHeight)!=null?e:0}get currentSrc(){var i,e;return(e=(i=this.media)==null?void 0:i.currentSrc)!=null?e:""}get currentTime(){var i,e;return(e=(i=this.media)==null?void 0:i.currentTime)!=null?e:0}set currentTime(i){this.media&&(this.media.currentTime=Number(i))}get volume(){var i,e;return(e=(i=this.media)==null?void 0:i.volume)!=null?e:1}set volume(i){this.media&&(this.media.volume=Number(i))}get playbackRate(){var i,e;return(e=(i=this.media)==null?void 0:i.playbackRate)!=null?e:1}set playbackRate(i){this.media&&(this.media.playbackRate=Number(i))}get defaultPlaybackRate(){var i;return(i=Ht(this.getAttribute(dr.PLAYBACKRATE)))!=null?i:1}set defaultPlaybackRate(i){i!=null?this.setAttribute(dr.PLAYBACKRATE,`${i}`):this.removeAttribute(dr.PLAYBACKRATE)}get crossOrigin(){return da(this,At.CROSSORIGIN)}set crossOrigin(i){this.setAttribute(At.CROSSORIGIN,`${i}`)}get autoplay(){return da(this,At.AUTOPLAY)!=null}set autoplay(i){i?this.setAttribute(At.AUTOPLAY,typeof i=="string"?i:""):this.removeAttribute(At.AUTOPLAY)}get loop(){return da(this,At.LOOP)!=null}set loop(i){i?this.setAttribute(At.LOOP,""):this.removeAttribute(At.LOOP)}get muted(){var i,e;return(e=(i=this.media)==null?void 0:i.muted)!=null?e:!1}set muted(i){this.media&&(this.media.muted=!!i)}get defaultMuted(){return da(this,At.MUTED)!=null}set defaultMuted(i){i?this.setAttribute(At.MUTED,""):this.removeAttribute(At.MUTED)}get playsInline(){return da(this,At.PLAYSINLINE)!=null}set playsInline(i){Vt("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(i){["","none","metadata","auto"].includes(i)?this.setAttribute(At.PRELOAD,i):this.removeAttribute(At.PRELOAD)}};function da(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var sv=QP,XP=`:host { + --media-control-display: var(--controls); + --media-loading-indicator-display: var(--loading-indicator); + --media-dialog-display: var(--dialog); + --media-play-button-display: var(--play-button); + --media-live-button-display: var(--live-button); + --media-seek-backward-button-display: var(--seek-backward-button); + --media-seek-forward-button-display: var(--seek-forward-button); + --media-mute-button-display: var(--mute-button); + --media-captions-button-display: var(--captions-button); + --media-captions-menu-button-display: var(--captions-menu-button, var(--media-captions-button-display)); + --media-rendition-menu-button-display: var(--rendition-menu-button); + --media-audio-track-menu-button-display: var(--audio-track-menu-button); + --media-airplay-button-display: var(--airplay-button); + --media-pip-button-display: var(--pip-button); + --media-fullscreen-button-display: var(--fullscreen-button); + --media-cast-button-display: var(--cast-button, var(--_cast-button-drm-display)); + --media-playback-rate-button-display: var(--playback-rate-button); + --media-playback-rate-menu-button-display: var(--playback-rate-menu-button); + --media-volume-range-display: var(--volume-range); + --media-time-range-display: var(--time-range); + --media-time-display-display: var(--time-display); + --media-duration-display-display: var(--duration-display); + --media-title-display-display: var(--title-display); + + display: inline-block; + line-height: 0; + width: 100%; +} + +a { + color: #fff; + font-size: 0.9em; + text-decoration: underline; +} + +media-theme { + display: inline-block; + line-height: 0; + width: 100%; + height: 100%; + direction: ltr; +} + +media-poster-image { + display: inline-block; + line-height: 0; + width: 100%; + height: 100%; +} + +media-poster-image:not([src]):not([placeholdersrc]) { + display: none; +} + +::part(top), +[part~='top'] { + --media-control-display: var(--controls, var(--top-controls)); + --media-play-button-display: var(--play-button, var(--top-play-button)); + --media-live-button-display: var(--live-button, var(--top-live-button)); + --media-seek-backward-button-display: var(--seek-backward-button, var(--top-seek-backward-button)); + --media-seek-forward-button-display: var(--seek-forward-button, var(--top-seek-forward-button)); + --media-mute-button-display: var(--mute-button, var(--top-mute-button)); + --media-captions-button-display: var(--captions-button, var(--top-captions-button)); + --media-captions-menu-button-display: var( + --captions-menu-button, + var(--media-captions-button-display, var(--top-captions-menu-button)) + ); + --media-rendition-menu-button-display: var(--rendition-menu-button, var(--top-rendition-menu-button)); + --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--top-audio-track-menu-button)); + --media-airplay-button-display: var(--airplay-button, var(--top-airplay-button)); + --media-pip-button-display: var(--pip-button, var(--top-pip-button)); + --media-fullscreen-button-display: var(--fullscreen-button, var(--top-fullscreen-button)); + --media-cast-button-display: var(--cast-button, var(--top-cast-button, var(--_cast-button-drm-display))); + --media-playback-rate-button-display: var(--playback-rate-button, var(--top-playback-rate-button)); + --media-playback-rate-menu-button-display: var( + --captions-menu-button, + var(--media-playback-rate-button-display, var(--top-playback-rate-menu-button)) + ); + --media-volume-range-display: var(--volume-range, var(--top-volume-range)); + --media-time-range-display: var(--time-range, var(--top-time-range)); + --media-time-display-display: var(--time-display, var(--top-time-display)); + --media-duration-display-display: var(--duration-display, var(--top-duration-display)); + --media-title-display-display: var(--title-display, var(--top-title-display)); +} + +::part(center), +[part~='center'] { + --media-control-display: var(--controls, var(--center-controls)); + --media-play-button-display: var(--play-button, var(--center-play-button)); + --media-live-button-display: var(--live-button, var(--center-live-button)); + --media-seek-backward-button-display: var(--seek-backward-button, var(--center-seek-backward-button)); + --media-seek-forward-button-display: var(--seek-forward-button, var(--center-seek-forward-button)); + --media-mute-button-display: var(--mute-button, var(--center-mute-button)); + --media-captions-button-display: var(--captions-button, var(--center-captions-button)); + --media-captions-menu-button-display: var( + --captions-menu-button, + var(--media-captions-button-display, var(--center-captions-menu-button)) + ); + --media-rendition-menu-button-display: var(--rendition-menu-button, var(--center-rendition-menu-button)); + --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--center-audio-track-menu-button)); + --media-airplay-button-display: var(--airplay-button, var(--center-airplay-button)); + --media-pip-button-display: var(--pip-button, var(--center-pip-button)); + --media-fullscreen-button-display: var(--fullscreen-button, var(--center-fullscreen-button)); + --media-cast-button-display: var(--cast-button, var(--center-cast-button, var(--_cast-button-drm-display))); + --media-playback-rate-button-display: var(--playback-rate-button, var(--center-playback-rate-button)); + --media-playback-rate-menu-button-display: var( + --playback-rate-menu-button, + var(--media-playback-rate-button-display, var(--center-playback-rate-menu-button)) + ); + --media-volume-range-display: var(--volume-range, var(--center-volume-range)); + --media-time-range-display: var(--time-range, var(--center-time-range)); + --media-time-display-display: var(--time-display, var(--center-time-display)); + --media-duration-display-display: var(--duration-display, var(--center-duration-display)); +} + +::part(bottom), +[part~='bottom'] { + --media-control-display: var(--controls, var(--bottom-controls)); + --media-play-button-display: var(--play-button, var(--bottom-play-button)); + --media-live-button-display: var(--live-button, var(--bottom-live-button)); + --media-seek-backward-button-display: var(--seek-backward-button, var(--bottom-seek-backward-button)); + --media-seek-forward-button-display: var(--seek-forward-button, var(--bottom-seek-forward-button)); + --media-mute-button-display: var(--mute-button, var(--bottom-mute-button)); + --media-captions-button-display: var(--captions-button, var(--bottom-captions-button)); + --media-captions-menu-button-display: var( + --captions-menu-button, + var(--media-captions-button-display, var(--bottom-captions-menu-button)) + ); + --media-rendition-menu-button-display: var(--rendition-menu-button, var(--bottom-rendition-menu-button)); + --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--bottom-audio-track-menu-button)); + --media-airplay-button-display: var(--airplay-button, var(--bottom-airplay-button)); + --media-pip-button-display: var(--pip-button, var(--bottom-pip-button)); + --media-fullscreen-button-display: var(--fullscreen-button, var(--bottom-fullscreen-button)); + --media-cast-button-display: var(--cast-button, var(--bottom-cast-button, var(--_cast-button-drm-display))); + --media-playback-rate-button-display: var(--playback-rate-button, var(--bottom-playback-rate-button)); + --media-playback-rate-menu-button-display: var( + --playback-rate-menu-button, + var(--media-playback-rate-button-display, var(--bottom-playback-rate-menu-button)) + ); + --media-volume-range-display: var(--volume-range, var(--bottom-volume-range)); + --media-time-range-display: var(--time-range, var(--bottom-time-range)); + --media-time-display-display: var(--time-display, var(--bottom-time-display)); + --media-duration-display-display: var(--duration-display, var(--bottom-duration-display)); + --media-title-display-display: var(--title-display, var(--bottom-title-display)); +} + +:host([no-tooltips]) { + --media-tooltip-display: none; +} +`,ua=new WeakMap,ZP=class JT{constructor(e,t){this.element=e,this.type=t,this.element.addEventListener(this.type,this);let s=ua.get(this.element);s&&s.set(this.type,this)}set(e){if(typeof e=="function")this.handleEvent=e.bind(this.element);else if(typeof e=="object"&&typeof e.handleEvent=="function")this.handleEvent=e.handleEvent.bind(e);else{this.element.removeEventListener(this.type,this);let t=ua.get(this.element);t&&t.delete(this.type)}}static for(e){ua.has(e.element)||ua.set(e.element,new Map);let t=e.attributeName.slice(2),s=ua.get(e.element);return s&&s.has(t)?s.get(t):new JT(e.element,t)}};function JP(i,e){return i instanceof yi&&i.attributeName.startsWith("on")?(ZP.for(i).set(e),i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),!0):!1}function eO(i,e){return e instanceof e_&&i instanceof Qn?(e.renderInto(i),!0):!1}function tO(i,e){return e instanceof DocumentFragment&&i instanceof Qn?(e.childNodes.length&&i.replace(...e.childNodes),!0):!1}function iO(i,e){if(i instanceof yi){let t=i.attributeNamespace,s=i.element.getAttributeNS(t,i.attributeName);return String(e)!==s&&(i.value=String(e)),!0}return i.value=String(e),!0}function sO(i,e){if(i instanceof yi&&e instanceof Element){let t=i.element;return t[i.attributeName]!==e&&(i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),t[i.attributeName]=e),!0}return!1}function rO(i,e){if(typeof e=="boolean"&&i instanceof yi){let t=i.attributeNamespace,s=i.element.hasAttributeNS(t,i.attributeName);return e!==s&&(i.booleanValue=e),!0}return!1}function nO(i,e){return e===!1&&i instanceof Qn?(i.replace(""),!0):!1}function aO(i,e){sO(i,e)||rO(i,e)||JP(i,e)||nO(i,e)||eO(i,e)||tO(i,e)||iO(i,e)}var wc=new Map,rv=new WeakMap,nv=new WeakMap,e_=class{constructor(e,t,s){this.strings=e,this.values=t,this.processor=s,this.stringsKey=this.strings.join("")}get template(){if(wc.has(this.stringsKey))return wc.get(this.stringsKey);{let e=cu.createElement("template"),t=this.strings.length-1;return e.innerHTML=this.strings.reduce((s,r,n)=>s+r+(n{let{tokens:e}=i;return e.drm?":host(:not([cast-receiver])) { --_cast-button-drm-display: none; }":""},uO=i=>yd` + + ${mO(i)} +`,cO=i=>{let e=i.hotKeys?`${i.hotKeys}`:"";return bp(i.streamType)==="live"&&(e+=" noarrowleft noarrowright"),e},hO={TOP:"top",CENTER:"center",BOTTOM:"bottom",LAYER:"layer",MEDIA_LAYER:"media-layer",POSTER_LAYER:"poster-layer",VERTICAL_LAYER:"vertical-layer",CENTERED_LAYER:"centered-layer",GESTURE_LAYER:"gesture-layer",CONTROLLER_LAYER:"controller",BUTTON:"button",RANGE:"range",THUMB:"thumb",DISPLAY:"display",CONTROL_BAR:"control-bar",MENU_BUTTON:"menu-button",MENU:"menu",MENU_ITEM:"menu-item",OPTION:"option",POSTER:"poster",LIVE:"live",PLAY:"play",PRE_PLAY:"pre-play",SEEK_BACKWARD:"seek-backward",SEEK_FORWARD:"seek-forward",MUTE:"mute",CAPTIONS:"captions",AIRPLAY:"airplay",PIP:"pip",FULLSCREEN:"fullscreen",CAST:"cast",PLAYBACK_RATE:"playback-rate",VOLUME:"volume",TIME:"time",TITLE:"title",AUDIO_TRACK:"audio-track",RENDITION:"rendition"},fO=Object.values(hO).join(", "),mO=i=>{var e,t,s,r,n,a,o,l,d,u,c,h,f,m,p,g,v,b,y,T,A,L,S,R,x,I,M,F,V,j,H,N,q,B,z,ee,U,$,re;return yd` + + + ${i.storyboard?yd``:yd``} + + + + + + +`},t_=i=>i.charAt(0).toUpperCase()+i.slice(1),pO=(i,e=!1)=>{var t,s;if(i.muxCode){let r=t_((t=i.errorCategory)!=null?t:"video"),n=vu((s=i.errorCategory)!=null?s:Re.VIDEO);if(i.muxCode===se.NETWORK_OFFLINE)return ie("Your device appears to be offline",e);if(i.muxCode===se.NETWORK_TOKEN_EXPIRED)return ie("{category} URL has expired",e).format({category:r});if([se.NETWORK_TOKEN_SUB_MISMATCH,se.NETWORK_TOKEN_AUD_MISMATCH,se.NETWORK_TOKEN_AUD_MISSING,se.NETWORK_TOKEN_MALFORMED].includes(i.muxCode))return ie("{category} URL is formatted incorrectly",e).format({category:r});if(i.muxCode===se.NETWORK_TOKEN_MISSING)return ie("Invalid {categoryName} URL",e).format({categoryName:n});if(i.muxCode===se.NETWORK_NOT_FOUND)return ie("{category} does not exist",e).format({category:r});if(i.muxCode===se.NETWORK_NOT_READY){let a=i.streamType==="live"?"Live stream":"Video";return ie("{mediaType} is not currently available",e).format({mediaType:a})}}if(i.code){if(i.code===W.MEDIA_ERR_NETWORK)return ie("Network Error",e);if(i.code===W.MEDIA_ERR_DECODE)return ie("Media Error",e);if(i.code===W.MEDIA_ERR_SRC_NOT_SUPPORTED)return ie("Source Not Supported",e)}return ie("Error",e)},gO=(i,e=!1)=>{var t,s;if(i.muxCode){let r=t_((t=i.errorCategory)!=null?t:"video"),n=vu((s=i.errorCategory)!=null?s:Re.VIDEO);return i.muxCode===se.NETWORK_OFFLINE?ie("Check your internet connection and try reloading this video.",e):i.muxCode===se.NETWORK_TOKEN_EXPIRED?ie("The video’s secured {tokenNamePrefix}-token has expired.",e).format({tokenNamePrefix:n}):i.muxCode===se.NETWORK_TOKEN_SUB_MISMATCH?ie("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",e).format({tokenNamePrefix:n}):i.muxCode===se.NETWORK_TOKEN_MALFORMED?ie("{category} URL is formatted incorrectly",e).format({category:r}):[se.NETWORK_TOKEN_AUD_MISMATCH,se.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode)?ie("The {tokenNamePrefix}-token is formatted with incorrect information.",e).format({tokenNamePrefix:n}):[se.NETWORK_TOKEN_MISSING,se.NETWORK_INVALID_URL].includes(i.muxCode)?ie("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",e).format({tokenNamePrefix:n}):i.muxCode===se.NETWORK_NOT_FOUND?"":i.message}return i.code&&(i.code===W.MEDIA_ERR_NETWORK||i.code===W.MEDIA_ERR_DECODE||(i.code,W.MEDIA_ERR_SRC_NOT_SUPPORTED)),i.message},vO=(i,e=!1)=>{let t=pO(i,e).toString(),s=gO(i,e).toString();return{title:t,message:s}},EO=i=>{if(i.muxCode){if(i.muxCode===se.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(i.muxCode===se.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([se.NETWORK_TOKEN_AUD_MISMATCH,se.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode))return"403-incorrect-aud-value.md";if(i.muxCode===se.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(i.muxCode===se.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(i.muxCode===se.NETWORK_NOT_FOUND)return"404-not-found.md";if(i.muxCode===se.NETWORK_NOT_READY)return"412-not-playable.md"}if(i.code){if(i.code===W.MEDIA_ERR_NETWORK)return"";if(i.code===W.MEDIA_ERR_DECODE)return"media-decode-error.md";if(i.code===W.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},av=(i,e)=>{let t=EO(i);return{message:i.message,context:i.context,file:t}},yO=` +`,If=cu.createElement("template");"innerHTML"in If&&(If.innerHTML=yO);var ov,lv,i_=class extends Pu{};i_.template=(lv=(ov=If.content)==null?void 0:ov.children)==null?void 0:lv[0];Ki.customElements.get("media-theme-gerwig")||Ki.customElements.define("media-theme-gerwig",i_);var bO="gerwig",ns={SRC:"src",POSTER:"poster"},O={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",FULLSCREEN_ELEMENT:"fullscreen-element",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",VIDEO_TITLE:"video-title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",NO_MUTED_PREF:"no-muted-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips",PROUDLY_DISPLAY_MUX_BADGE:"proudly-display-mux-badge",DISABLE_PSEUDO_ENDED:"disable-pseudo-ended"},Lf=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","videotitle","novolumepref","nomutedpref","proudlydisplaymuxbadge"];function TO(i,e){var t,s,r;return{src:!i.playbackId&&i.src,playbackId:i.playbackId,hasSrc:!!i.playbackId||!!i.src||!!i.currentSrc,poster:i.poster,storyboard:((t=i.media)==null?void 0:t.currentSrc)&&i.storyboard,storyboardSrc:i.getAttribute(O.STORYBOARD_SRC),fullscreenElement:i.getAttribute(O.FULLSCREEN_ELEMENT),placeholder:i.getAttribute("placeholder"),themeTemplate:AO(i),thumbnailTime:!i.tokens.thumbnail&&i.thumbnailTime,autoplay:i.autoplay,crossOrigin:i.crossOrigin,loop:i.loop,noHotKeys:i.hasAttribute(O.NOHOTKEYS),hotKeys:i.getAttribute(O.HOTKEYS),muted:i.muted,paused:i.paused,preload:i.preload,envKey:i.envKey,preferCmcd:i.preferCmcd,debug:i.debug,disableTracking:i.disableTracking,disableCookies:i.disableCookies,tokens:i.tokens,beaconCollectionDomain:i.beaconCollectionDomain,maxResolution:i.maxResolution,minResolution:i.minResolution,maxAutoResolution:i.maxAutoResolution,programStartTime:i.programStartTime,programEndTime:i.programEndTime,assetStartTime:i.assetStartTime,assetEndTime:i.assetEndTime,renditionOrder:i.renditionOrder,metadata:i.metadata,playerInitTime:i.playerInitTime,playerSoftwareName:i.playerSoftwareName,playerSoftwareVersion:i.playerSoftwareVersion,startTime:i.startTime,preferPlayback:i.preferPlayback,audio:i.audio,defaultStreamType:i.defaultStreamType,targetLiveWindow:i.getAttribute(D.TARGET_LIVE_WINDOW),streamType:bp(i.getAttribute(D.STREAM_TYPE)),primaryColor:i.getAttribute(O.PRIMARY_COLOR),secondaryColor:i.getAttribute(O.SECONDARY_COLOR),accentColor:i.getAttribute(O.ACCENT_COLOR),forwardSeekOffset:i.forwardSeekOffset,backwardSeekOffset:i.backwardSeekOffset,defaultHiddenCaptions:i.defaultHiddenCaptions,defaultDuration:i.defaultDuration,defaultShowRemainingTime:i.defaultShowRemainingTime,hideDuration:SO(i),playbackRates:i.getAttribute(O.PLAYBACK_RATES),customDomain:(s=i.getAttribute(D.CUSTOM_DOMAIN))!=null?s:void 0,title:i.getAttribute(O.TITLE),videoTitle:(r=i.getAttribute(O.VIDEO_TITLE))!=null?r:i.getAttribute(O.TITLE),novolumepref:i.hasAttribute(O.NO_VOLUME_PREF),nomutedpref:i.hasAttribute(O.NO_MUTED_PREF),proudlyDisplayMuxBadge:i.hasAttribute(O.PROUDLY_DISPLAY_MUX_BADGE),castReceiver:i.castReceiver,disablePseudoEnded:i.hasAttribute(O.DISABLE_PSEUDO_ENDED),capRenditionToPlayerSize:i.capRenditionToPlayerSize,...e,extraSourceParams:i.extraSourceParams}}var _O=jb.formatErrorMessage;jb.formatErrorMessage=i=>{var e,t;if(i instanceof W){let s=vO(i,!1);return` + ${s!=null&&s.title?`

${s.title}

`:""} + ${s!=null&&s.message||s!=null&&s.linkUrl?`

+ ${s?.message} + ${s!=null&&s.linkUrl?`${(t=s.linkText)!=null?t:s.linkUrl}`:""} +

`:""} + `}return _O(i)};function AO(i){var e,t;let s=i.theme;if(s){let r=(t=(e=i.getRootNode())==null?void 0:e.getElementById)==null?void 0:t.call(e,s);if(r&&r instanceof HTMLTemplateElement)return r;s.startsWith("media-theme-")||(s=`media-theme-${s}`);let n=Ki.customElements.get(s);if(n!=null&&n.template)return n.template}}function SO(i){var e;let t=(e=i.mediaController)==null?void 0:e.querySelector("media-time-display");return t&&getComputedStyle(t).getPropertyValue("--media-duration-display-display").trim()==="none"}function dv(i){let e=i.videoTitle?{video_title:i.videoTitle}:{};return i.getAttributeNames().filter(t=>t.startsWith("metadata-")).reduce((t,s)=>{let r=i.getAttribute(s);return r!==null&&(t[s.replace(/^metadata-/,"").replace(/-/g,"_")]=r),t},e)}var IO=Object.values(D),LO=Object.values(ns),RO=Object.values(O),uv=QT(),cv="mux-player",hv={isDialogOpen:!1},xO={redundant_streams:!0},bd,Td,_d,ur,Ad,Un,qe,Cs,s_,Rf,cr,fv,mv,pv,gv,kO=class extends sv{constructor(){super(),gi(this,qe),gi(this,bd),gi(this,Td,!1),gi(this,_d,{}),gi(this,ur,!0),gi(this,Ad,new qP(this,"hotkeys")),gi(this,Un,{...hv,onCloseErrorDialog:i=>{var e;((e=i.composedPath()[0])==null?void 0:e.localName)==="media-error-dialog"&&et(this,qe,Rf).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:i=>{var e;((e=i.composedPath()[0])==null?void 0:e.localName)==="media-error-dialog"&&(jT(this,cu.activeElement)||i.preventDefault())}}),Qi(this,bd,om()),this.attachShadow({mode:"open"}),et(this,qe,s_).call(this),this.isConnected&&et(this,qe,Cs).call(this)}static get NAME(){return cv}static get VERSION(){return uv}static get observedAttributes(){var i;return[...(i=sv.observedAttributes)!=null?i:[],...LO,...IO,...RO]}get mediaTheme(){var i;return(i=this.shadowRoot)==null?void 0:i.querySelector("media-theme")}get mediaController(){var i,e;return(e=(i=this.mediaTheme)==null?void 0:i.shadowRoot)==null?void 0:e.querySelector("media-controller")}connectedCallback(){let i=this.media;i&&(i.metadata=dv(this))}attributeChangedCallback(i,e,t){switch(et(this,qe,Cs).call(this),super.attributeChangedCallback(i,e,t),i){case O.HOTKEYS:Ie(this,Ad).value=t;break;case O.THUMBNAIL_TIME:{t!=null&&this.tokens.thumbnail&&ds(ie("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break}case O.THUMBNAIL_TOKEN:{if(t){let s=kn(t);if(s){let{aud:r}=s,n=Ba.THUMBNAIL;r!==n&&ds(ie("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"thumbnail"}))}}break}case O.STORYBOARD_TOKEN:{if(t){let s=kn(t);if(s){let{aud:r}=s,n=Ba.STORYBOARD;r!==n&&ds(ie("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"storyboard"}))}}break}case O.DRM_TOKEN:{if(t){let s=kn(t);if(s){let{aud:r}=s,n=Ba.DRM;r!==n&&ds(ie("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:r,expectedAud:n,tokenNamePrefix:"drm"}))}}break}case D.PLAYBACK_ID:{t!=null&&t.includes("?token")&&Vt(ie("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:t}));break}case D.STREAM_TYPE:{t&&![Se.LIVE,Se.ON_DEMAND,Se.UNKNOWN].includes(t)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=t.includes("dvr")?Number.POSITIVE_INFINITY:0:ZT({file:"invalid-stream-type.md",message:ie("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):t===Se.LIVE?this.getAttribute(O.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN;break}case O.FULLSCREEN_ELEMENT:{if(t!=null||t!==e){let s=cu.getElementById(t),r=s?.querySelector("mux-player");this.mediaController&&s&&r&&(this.mediaController.fullscreenElement=s)}break}case D.CAP_RENDITION_TO_PLAYER_SIZE:{(t==null||t!==e)&&(this.capRenditionToPlayerSize=t!=null?!0:void 0);break}}[D.PLAYBACK_ID,ns.SRC,O.PLAYBACK_TOKEN].includes(i)&&e!==t&&Qi(this,Un,{...Ie(this,Un),...hv}),et(this,qe,cr).call(this,{[WP(i)]:t})}async requestFullscreen(i){var e;if(!(!this.mediaController||this.mediaController.hasAttribute(_.MEDIA_IS_FULLSCREEN)))return(e=this.mediaController)==null||e.dispatchEvent(new Ki.CustomEvent(Y.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((t,s)=>{var r;(r=this.mediaController)==null||r.addEventListener(ms.MEDIA_IS_FULLSCREEN,()=>t(),{once:!0})})}async exitFullscreen(){var i;if(!(!this.mediaController||!this.mediaController.hasAttribute(_.MEDIA_IS_FULLSCREEN)))return(i=this.mediaController)==null||i.dispatchEvent(new Ki.CustomEvent(Y.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((e,t)=>{var s;(s=this.mediaController)==null||s.addEventListener(ms.MEDIA_IS_FULLSCREEN,()=>e(),{once:!0})})}get preferCmcd(){var i;return(i=this.getAttribute(D.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?Fd.includes(i)?this.setAttribute(D.PREFER_CMCD,i):ds(`Invalid value for preferCmcd. Must be one of ${Fd.join()}`):this.removeAttribute(D.PREFER_CMCD))}get hasPlayed(){var i,e;return(e=(i=this.mediaController)==null?void 0:i.hasAttribute(_.MEDIA_HAS_PLAYED))!=null?e:!1}get inLiveWindow(){var i;return(i=this.mediaController)==null?void 0:i.hasAttribute(_.MEDIA_TIME_IS_LIVE)}get _hls(){var i;return(i=this.media)==null?void 0:i._hls}get mux(){var i;return(i=this.media)==null?void 0:i.mux}get theme(){var i;return(i=this.getAttribute(O.THEME))!=null?i:bO}set theme(i){this.setAttribute(O.THEME,`${i}`)}get themeProps(){let i=this.mediaTheme;if(!i)return;let e={};for(let t of i.getAttributeNames()){if(Lf.includes(t))continue;let s=i.getAttribute(t);e[qT(t)]=s===""?!0:s}return e}set themeProps(i){var e,t;et(this,qe,Cs).call(this);let s={...this.themeProps,...i};for(let r in s){if(Lf.includes(r))continue;let n=i?.[r];typeof n=="boolean"||n==null?(e=this.mediaTheme)==null||e.toggleAttribute(Sf(r),!!n):(t=this.mediaTheme)==null||t.setAttribute(Sf(r),n)}}get playbackId(){var i;return(i=this.getAttribute(D.PLAYBACK_ID))!=null?i:void 0}set playbackId(i){i?this.setAttribute(D.PLAYBACK_ID,i):this.removeAttribute(D.PLAYBACK_ID)}get src(){var i,e;return this.playbackId?(i=er(this,ns.SRC))!=null?i:void 0:(e=this.getAttribute(ns.SRC))!=null?e:void 0}set src(i){i?this.setAttribute(ns.SRC,i):this.removeAttribute(ns.SRC)}get poster(){var i;let e=this.getAttribute(ns.POSTER);if(e!=null)return e;let{tokens:t}=this;if(t.playback&&!t.thumbnail){ds("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return GP(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,programTime:this.programStartTime,token:t.thumbnail})}set poster(i){i||i===""?this.setAttribute(ns.POSTER,i):this.removeAttribute(ns.POSTER)}get storyboardSrc(){var i;return(i=this.getAttribute(O.STORYBOARD_SRC))!=null?i:void 0}set storyboardSrc(i){i?this.setAttribute(O.STORYBOARD_SRC,i):this.removeAttribute(O.STORYBOARD_SRC)}get storyboard(){let{tokens:i}=this;if(this.storyboardSrc&&!i.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[Se.LIVE,Se.UNKNOWN].includes(this.streamType)||i.playback&&!i.storyboard))return KP(this.playbackId,{customDomain:this.customDomain,token:i.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(O.AUDIO)}set audio(i){if(!i){this.removeAttribute(O.AUDIO);return}this.setAttribute(O.AUDIO,"")}get hotkeys(){return Ie(this,Ad)}get nohotkeys(){return this.hasAttribute(O.NOHOTKEYS)}set nohotkeys(i){if(!i){this.removeAttribute(O.NOHOTKEYS);return}this.setAttribute(O.NOHOTKEYS,"")}get thumbnailTime(){return Ht(this.getAttribute(O.THUMBNAIL_TIME))}set thumbnailTime(i){this.setAttribute(O.THUMBNAIL_TIME,`${i}`)}get videoTitle(){var i,e;return(e=(i=this.getAttribute(O.VIDEO_TITLE))!=null?i:this.getAttribute(O.TITLE))!=null?e:""}set videoTitle(i){i!==this.videoTitle&&(i?this.setAttribute(O.VIDEO_TITLE,i):this.removeAttribute(O.VIDEO_TITLE))}get placeholder(){var i;return(i=er(this,O.PLACEHOLDER))!=null?i:""}set placeholder(i){this.setAttribute(O.PLACEHOLDER,`${i}`)}get primaryColor(){var i,e;let t=this.getAttribute(O.PRIMARY_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=Ki.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:e.trim(),t))return t}set primaryColor(i){this.setAttribute(O.PRIMARY_COLOR,`${i}`)}get secondaryColor(){var i,e;let t=this.getAttribute(O.SECONDARY_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=Ki.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:e.trim(),t))return t}set secondaryColor(i){this.setAttribute(O.SECONDARY_COLOR,`${i}`)}get accentColor(){var i,e;let t=this.getAttribute(O.ACCENT_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=Ki.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:e.trim(),t))return t}set accentColor(i){this.setAttribute(O.ACCENT_COLOR,`${i}`)}get defaultShowRemainingTime(){return this.hasAttribute(O.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(i){i?this.setAttribute(O.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(O.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(O.PLAYBACK_RATES))return this.getAttribute(O.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(i=>Number(i)).filter(i=>!Number.isNaN(i)).sort((i,e)=>i-e)}set playbackRates(i){if(!i){this.removeAttribute(O.PLAYBACK_RATES);return}this.setAttribute(O.PLAYBACK_RATES,i.join(" "))}get forwardSeekOffset(){var i;return(i=Ht(this.getAttribute(O.FORWARD_SEEK_OFFSET)))!=null?i:10}set forwardSeekOffset(i){this.setAttribute(O.FORWARD_SEEK_OFFSET,`${i}`)}get backwardSeekOffset(){var i;return(i=Ht(this.getAttribute(O.BACKWARD_SEEK_OFFSET)))!=null?i:10}set backwardSeekOffset(i){this.setAttribute(O.BACKWARD_SEEK_OFFSET,`${i}`)}get defaultHiddenCaptions(){return this.hasAttribute(O.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(i){i?this.setAttribute(O.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(O.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return Ht(this.getAttribute(O.DEFAULT_DURATION))}set defaultDuration(i){i==null?this.removeAttribute(O.DEFAULT_DURATION):this.setAttribute(O.DEFAULT_DURATION,`${i}`)}get playerInitTime(){return this.hasAttribute(D.PLAYER_INIT_TIME)?Ht(this.getAttribute(D.PLAYER_INIT_TIME)):Ie(this,bd)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(D.PLAYER_INIT_TIME):this.setAttribute(D.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=this.getAttribute(D.PLAYER_SOFTWARE_NAME))!=null?i:cv}get playerSoftwareVersion(){var i;return(i=this.getAttribute(D.PLAYER_SOFTWARE_VERSION))!=null?i:uv}get beaconCollectionDomain(){var i;return(i=this.getAttribute(D.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(D.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(D.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var i;return(i=this.getAttribute(D.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(D.MAX_RESOLUTION,i):this.removeAttribute(D.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(D.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(D.MIN_RESOLUTION,i):this.removeAttribute(D.MIN_RESOLUTION))}get maxAutoResolution(){var i;return(i=this.getAttribute(D.MAX_AUTO_RESOLUTION))!=null?i:void 0}set maxAutoResolution(i){i==null?this.removeAttribute(D.MAX_AUTO_RESOLUTION):this.setAttribute(D.MAX_AUTO_RESOLUTION,i)}get renditionOrder(){var i;return(i=this.getAttribute(D.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(D.RENDITION_ORDER,i):this.removeAttribute(D.RENDITION_ORDER))}get programStartTime(){return Ht(this.getAttribute(D.PROGRAM_START_TIME))}set programStartTime(i){i==null?this.removeAttribute(D.PROGRAM_START_TIME):this.setAttribute(D.PROGRAM_START_TIME,`${i}`)}get programEndTime(){return Ht(this.getAttribute(D.PROGRAM_END_TIME))}set programEndTime(i){i==null?this.removeAttribute(D.PROGRAM_END_TIME):this.setAttribute(D.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){return Ht(this.getAttribute(D.ASSET_START_TIME))}set assetStartTime(i){i==null?this.removeAttribute(D.ASSET_START_TIME):this.setAttribute(D.ASSET_START_TIME,`${i}`)}get assetEndTime(){return Ht(this.getAttribute(D.ASSET_END_TIME))}set assetEndTime(i){i==null?this.removeAttribute(D.ASSET_END_TIME):this.setAttribute(D.ASSET_END_TIME,`${i}`)}get extraSourceParams(){return this.hasAttribute(O.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(O.EXTRA_SOURCE_PARAMS)).entries()].reduce((i,[e,t])=>(i[e]=t,i),{}):xO}set extraSourceParams(i){i==null?this.removeAttribute(O.EXTRA_SOURCE_PARAMS):this.setAttribute(O.EXTRA_SOURCE_PARAMS,new URLSearchParams(i).toString())}get customDomain(){var i;return(i=this.getAttribute(D.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(D.CUSTOM_DOMAIN,i):this.removeAttribute(D.CUSTOM_DOMAIN))}get envKey(){var i;return(i=er(this,D.ENV_KEY))!=null?i:void 0}set envKey(i){this.setAttribute(D.ENV_KEY,`${i}`)}get noVolumePref(){return this.hasAttribute(O.NO_VOLUME_PREF)}set noVolumePref(i){i?this.setAttribute(O.NO_VOLUME_PREF,""):this.removeAttribute(O.NO_VOLUME_PREF)}get noMutedPref(){return this.hasAttribute(O.NO_MUTED_PREF)}set noMutedPref(i){i?this.setAttribute(O.NO_MUTED_PREF,""):this.removeAttribute(O.NO_MUTED_PREF)}get debug(){return er(this,D.DEBUG)!=null}set debug(i){i?this.setAttribute(D.DEBUG,""):this.removeAttribute(D.DEBUG)}get disableTracking(){return er(this,D.DISABLE_TRACKING)!=null}set disableTracking(i){this.toggleAttribute(D.DISABLE_TRACKING,!!i)}get disableCookies(){return er(this,D.DISABLE_COOKIES)!=null}set disableCookies(i){i?this.setAttribute(D.DISABLE_COOKIES,""):this.removeAttribute(D.DISABLE_COOKIES)}get streamType(){var i,e,t;return(t=(e=this.getAttribute(D.STREAM_TYPE))!=null?e:(i=this.media)==null?void 0:i.streamType)!=null?t:Se.UNKNOWN}set streamType(i){this.setAttribute(D.STREAM_TYPE,`${i}`)}get defaultStreamType(){var i,e,t;return(t=(e=this.getAttribute(O.DEFAULT_STREAM_TYPE))!=null?e:(i=this.mediaController)==null?void 0:i.getAttribute(O.DEFAULT_STREAM_TYPE))!=null?t:Se.ON_DEMAND}set defaultStreamType(i){i?this.setAttribute(O.DEFAULT_STREAM_TYPE,i):this.removeAttribute(O.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var i,e;return this.hasAttribute(O.TARGET_LIVE_WINDOW)?+this.getAttribute(O.TARGET_LIVE_WINDOW):(e=(i=this.media)==null?void 0:i.targetLiveWindow)!=null?e:Number.NaN}set targetLiveWindow(i){i==this.targetLiveWindow||Number.isNaN(i)&&Number.isNaN(this.targetLiveWindow)||(i==null?this.removeAttribute(O.TARGET_LIVE_WINDOW):this.setAttribute(O.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i;return(i=this.media)==null?void 0:i.liveEdgeStart}get startTime(){return Ht(er(this,D.START_TIME))}set startTime(i){this.setAttribute(D.START_TIME,`${i}`)}get preferPlayback(){let i=this.getAttribute(D.PREFER_PLAYBACK);if(i===qi.MSE||i===qi.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===qi.MSE||i===qi.NATIVE?this.setAttribute(D.PREFER_PLAYBACK,i):this.removeAttribute(D.PREFER_PLAYBACK))}get metadata(){var i;return(i=this.media)==null?void 0:i.metadata}set metadata(i){if(et(this,qe,Cs).call(this),!this.media){Vt("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...dv(this),...i}}get _hlsConfig(){var i;return(i=this.media)==null?void 0:i._hlsConfig}set _hlsConfig(i){if(et(this,qe,Cs).call(this),!this.media){Vt("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=i}async addCuePoints(i){var e;if(et(this,qe,Cs).call(this),!this.media){Vt("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(e=this.media)==null?void 0:e.addCuePoints(i)}get activeCuePoint(){var i;return(i=this.media)==null?void 0:i.activeCuePoint}get cuePoints(){var i,e;return(e=(i=this.media)==null?void 0:i.cuePoints)!=null?e:[]}addChapters(i){var e;if(et(this,qe,Cs).call(this),!this.media){Vt("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(e=this.media)==null?void 0:e.addChapters(i)}get activeChapter(){var i;return(i=this.media)==null?void 0:i.activeChapter}get chapters(){var i,e;return(e=(i=this.media)==null?void 0:i.chapters)!=null?e:[]}getStartDate(){var i;return(i=this.media)==null?void 0:i.getStartDate()}get currentPdt(){var i;return(i=this.media)==null?void 0:i.currentPdt}get tokens(){let i=this.getAttribute(O.PLAYBACK_TOKEN),e=this.getAttribute(O.DRM_TOKEN),t=this.getAttribute(O.THUMBNAIL_TOKEN),s=this.getAttribute(O.STORYBOARD_TOKEN);return{...Ie(this,_d),...i!=null?{playback:i}:{},...e!=null?{drm:e}:{},...t!=null?{thumbnail:t}:{},...s!=null?{storyboard:s}:{}}}set tokens(i){Qi(this,_d,i??{})}get playbackToken(){var i;return(i=this.getAttribute(O.PLAYBACK_TOKEN))!=null?i:void 0}set playbackToken(i){this.setAttribute(O.PLAYBACK_TOKEN,`${i}`)}get drmToken(){var i;return(i=this.getAttribute(O.DRM_TOKEN))!=null?i:void 0}set drmToken(i){this.setAttribute(O.DRM_TOKEN,`${i}`)}get thumbnailToken(){var i;return(i=this.getAttribute(O.THUMBNAIL_TOKEN))!=null?i:void 0}set thumbnailToken(i){this.setAttribute(O.THUMBNAIL_TOKEN,`${i}`)}get storyboardToken(){var i;return(i=this.getAttribute(O.STORYBOARD_TOKEN))!=null?i:void 0}set storyboardToken(i){this.setAttribute(O.STORYBOARD_TOKEN,`${i}`)}addTextTrack(i,e,t,s){var r;let n=(r=this.media)==null?void 0:r.nativeEl;if(n)return sm(n,i,e,t,s)}removeTextTrack(i){var e;let t=(e=this.media)==null?void 0:e.nativeEl;if(t)return Xx(t,i)}get textTracks(){var i;return(i=this.media)==null?void 0:i.textTracks}get castReceiver(){var i;return(i=this.getAttribute(O.CAST_RECEIVER))!=null?i:void 0}set castReceiver(i){i!==this.castReceiver&&(i?this.setAttribute(O.CAST_RECEIVER,i):this.removeAttribute(O.CAST_RECEIVER))}get castCustomData(){var i;return(i=this.media)==null?void 0:i.castCustomData}set castCustomData(i){if(!this.media){Vt("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=i}get noTooltips(){return this.hasAttribute(O.NO_TOOLTIPS)}set noTooltips(i){if(!i){this.removeAttribute(O.NO_TOOLTIPS);return}this.setAttribute(O.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(O.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(i){i?this.setAttribute(O.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(O.PROUDLY_DISPLAY_MUX_BADGE)}get capRenditionToPlayerSize(){var i;return(i=this.media)==null?void 0:i.capRenditionToPlayerSize}set capRenditionToPlayerSize(i){if(!this.media){Vt("underlying media element missing when trying to set capRenditionToPlayerSize");return}this.media.capRenditionToPlayerSize=i}};bd=new WeakMap,Td=new WeakMap,_d=new WeakMap,ur=new WeakMap,Ad=new WeakMap,Un=new WeakMap,qe=new WeakSet,Cs=function(){var i,e,t,s;if(!Ie(this,Td)){Qi(this,Td,!0),et(this,qe,cr).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof Ki.HTMLElement))throw""}catch{Vt(" failed to upgrade!")}try{customElements.upgrade(this.media)}catch{Vt("underlying media element failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof jC))throw""}catch{Vt(" failed to upgrade!")}et(this,qe,fv).call(this),et(this,qe,mv).call(this),et(this,qe,pv).call(this),Qi(this,ur,(e=(i=this.mediaController)==null?void 0:i.hasAttribute(ne.USER_INACTIVE))!=null?e:!0),et(this,qe,gv).call(this),(t=this.media)==null||t.addEventListener("streamtypechange",()=>et(this,qe,cr).call(this)),(s=this.media)==null||s.addEventListener("loadstart",()=>et(this,qe,cr).call(this))}},s_=function(){var i,e;try{(i=window?.CSS)==null||i.registerProperty({name:"--media-primary-color",syntax:"",inherits:!0}),(e=window?.CSS)==null||e.registerProperty({name:"--media-secondary-color",syntax:"",inherits:!0})}catch{}},Rf=function(i){Object.assign(Ie(this,Un),i),et(this,qe,cr).call(this)},cr=function(i={}){lO(uO(TO(this,{...Ie(this,Un),...i})),this.shadowRoot)},fv=function(){let i=e=>{var t,s;if(!(e!=null&&e.startsWith("theme-")))return;let r=e.replace(/^theme-/,"");if(Lf.includes(r))return;let n=this.getAttribute(e);n!=null?(t=this.mediaTheme)==null||t.setAttribute(r,n):(s=this.mediaTheme)==null||s.removeAttribute(r)};new MutationObserver(e=>{for(let{attributeName:t}of e)i(t)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(i)},mv=function(){let i=e=>{var t;let s=(t=this.media)==null?void 0:t.error;if(!(s instanceof W)){let{message:n,code:a}=s??{};s=new W(n,a)}if(!(s!=null&&s.fatal)){ds(s),s.data&&ds(`${s.name} data:`,s.data);return}let r=av(s);r.message&&ZT(r),Vt(s),s.data&&Vt(`${s.name} data:`,s.data),et(this,qe,Rf).call(this,{isDialogOpen:!0})};this.addEventListener("error",i),this.media&&(this.media.errorTranslator=(e={})=>{var t,s,r;if(!(((t=this.media)==null?void 0:t.error)instanceof W))return e;let n=av((s=this.media)==null?void 0:s.error);return{player_error_code:(r=this.media)==null?void 0:r.error.code,player_error_message:n.message?String(n.message):e.player_error_message,player_error_context:n.context?String(n.context):e.player_error_context}})},pv=function(){var i,e,t,s;let r=()=>et(this,qe,cr).call(this);(e=(i=this.media)==null?void 0:i.textTracks)==null||e.addEventListener("addtrack",r),(s=(t=this.media)==null?void 0:t.textTracks)==null||s.addEventListener("removetrack",r)},gv=function(){var i,e;if(!/Firefox/i.test(navigator.userAgent))return;let t,s=new WeakMap,r=()=>this.streamType===Se.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,n=(l,d,u=!1)=>{r()||Array.from(l&&l.activeCues||[]).forEach(c=>{if(!(!c.snapToLines||c.line<-5||c.line>=0&&c.line<10))if(!d||this.paused){let h=c.text.split(` +`).length,f=-3;this.streamType===Se.LIVE&&(f=-2);let m=f-h;if(c.line===m&&!u)return;s.has(c)||s.set(c,c.line),c.line=m}else setTimeout(()=>{c.line=s.get(c)||"auto"},500)})},a=()=>{var l,d;n(t,(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ne.USER_INACTIVE))!=null?d:!1)},o=()=>{var l,d;let u=Array.from(((d=(l=this.mediaController)==null?void 0:l.media)==null?void 0:d.textTracks)||[]).filter(c=>["subtitles","captions"].includes(c.kind)&&c.mode==="showing")[0];u!==t&&t?.removeEventListener("cuechange",a),t=u,t?.addEventListener("cuechange",a),n(t,Ie(this,ur))};o(),(i=this.textTracks)==null||i.addEventListener("change",o),(e=this.textTracks)==null||e.addEventListener("addtrack",o),this.addEventListener("userinactivechange",()=>{var l,d;let u=(d=(l=this.mediaController)==null?void 0:l.hasAttribute(ne.USER_INACTIVE))!=null?d:!0;Ie(this,ur)!==u&&(Qi(this,ur,u),n(t,Ie(this,ur)))})};function er(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var vv=kO,r_=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment>"u"){class i extends r_{}globalThis.DocumentFragment=i}var DO=class extends r_{},CO={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(DO)}},wO={customElements:CO},MO=typeof window>"u"||typeof globalThis.customElements>"u",Mc=MO?wO:globalThis;Mc.customElements.get("mux-player")||(Mc.customElements.define("mux-player",vv),Mc.MuxPlayerElement=vv);var n_=parseInt(ja.version)>=19,Ev={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay",playbackRate:"playbackrate"},PO=i=>i==null,OO=(i,e)=>PO(e)?!1:i in e,NO=i=>i.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),UO=(i,e)=>{if(!(!n_&&typeof e=="boolean"&&!e)){if(OO(i,Ev))return Ev[i];if(typeof e<"u")return/[A-Z]/.test(i)?NO(i):i}},$O=(i,e)=>!n_&&typeof i=="boolean"?"":i,FO=(i={})=>{let{ref:e,...t}=i;return Object.entries(t).reduce((s,[r,n])=>{let a=UO(r,n);if(!a)return s;let o=$O(n);return s[a]=o,s},{})};function yv(i,e){if(typeof i=="function")return i(e);i!=null&&(i.current=e)}function BO(...i){return e=>{let t=!1,s=i.map(r=>{let n=yv(r,e);return!t&&typeof n=="function"&&(t=!0),n});if(t)return()=>{for(let r=0;r{if(Object.is(i,e))return!0;if(typeof i!="object"||i===null||typeof e!="object"||e===null)return!1;if(Array.isArray(i))return!Array.isArray(e)||i.length!==e.length?!1:i.some((r,n)=>e[n]===r);let t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(let r=0;r!KO(e,i[t]),VO=(i,e,t)=>{i[t]=e},WO=(i,e,t,s=VO,r=a_)=>za.useEffect(()=>{let n=t?.current;n&&r(n,e,i)&&s(n,e,i)},[t?.current,e]),Ri=WO,qO=()=>{try{return"3.11.5"}catch{}return"UNKNOWN"},YO=qO(),jO=()=>YO,$e=(i,e,t)=>za.useEffect(()=>{let s=e?.current;if(!s||!t)return;let r=i,n=t;return s.addEventListener(r,n),()=>{s.removeEventListener(r,n)}},[e?.current,t,i]),zO=ja.forwardRef(({children:i,...e},t)=>ja.createElement("mux-player",{suppressHydrationWarning:!0,...FO(e),ref:t},i)),QO=(i,e)=>{let{onAbort:t,onCanPlay:s,onCanPlayThrough:r,onEmptied:n,onLoadStart:a,onLoadedData:o,onLoadedMetadata:l,onProgress:d,onDurationChange:u,onVolumeChange:c,onRateChange:h,onResize:f,onWaiting:m,onPlay:p,onPlaying:g,onTimeUpdate:v,onPause:b,onSeeking:y,onSeeked:T,onStalled:A,onSuspend:L,onEnded:S,onError:R,onCuePointChange:x,onChapterChange:I,metadata:M,tokens:F,paused:V,playbackId:j,playbackRates:H,currentTime:N,themeProps:q,extraSourceParams:B,castCustomData:z,_hlsConfig:ee,...U}=e;return Ri("tokens",F,i),Ri("playbackId",j,i),Ri("playbackRates",H,i),Ri("metadata",M,i),Ri("extraSourceParams",B,i),Ri("_hlsConfig",ee,i),Ri("themeProps",q,i),Ri("castCustomData",z,i),Ri("paused",V,i,($,re)=>{re!=null&&(re?$.pause():$.play())},($,re,pe)=>$.hasAttribute("autoplay")&&!$.hasPlayed?!1:a_($,re,pe)),Ri("currentTime",N,i,($,re)=>{re!=null&&($.currentTime=re)}),$e("abort",i,t),$e("canplay",i,s),$e("canplaythrough",i,r),$e("emptied",i,n),$e("loadstart",i,a),$e("loadeddata",i,o),$e("loadedmetadata",i,l),$e("progress",i,d),$e("durationchange",i,u),$e("volumechange",i,c),$e("ratechange",i,h),$e("resize",i,f),$e("waiting",i,m),$e("play",i,p),$e("playing",i,g),$e("timeupdate",i,v),$e("pause",i,b),$e("seeking",i,y),$e("seeked",i,T),$e("stalled",i,A),$e("suspend",i,L),$e("ended",i,S),$e("error",i,R),$e("cuepointchange",i,x),$e("chapterchange",i,I),[U]},XO=jO(),ZO="mux-player-react",JO=ja.forwardRef((i,e)=>{var t;let s=za.useRef(null),r=HO(s,e),[n]=QO(s,i),[a]=za.useState((t=i.playerInitTime)!=null?t:om());return ja.createElement(zO,{ref:r,defaultHiddenCaptions:i.defaultHiddenCaptions,playerSoftwareName:ZO,playerSoftwareVersion:XO,playerInitTime:a,...n})}),e2=JO;function E2(i){const e=o_.c(5),{customDomain:t,playbackId:s,tokens:r}=i;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={position:"absolute",inset:0},e[0]=n):n=e[0];let a;return e[1]!==t||e[2]!==s||e[3]!==r?(a=l_.jsx(e2,{customDomain:t,theme:"sutro",playbackId:s,tokens:r,autoPlay:!1,loop:!1,style:n}),e[1]=t,e[2]=s,e[3]=r,e[4]=a):a=e[4],a}export{E2 as VideoPlayer}; diff --git a/apps/studio/dist/static/ViteDevServerStopped-HxHxJIfh.js b/apps/studio/dist/static/ViteDevServerStopped-HxHxJIfh.js new file mode 100644 index 00000000..e38cdff1 --- /dev/null +++ b/apps/studio/dist/static/ViteDevServerStopped-HxHxJIfh.js @@ -0,0 +1 @@ +import{c as a,j as o,C as l,a as m,S as p,T as h,r as d,H as u}from"./sanity-BZuh2pfi.js";const S="Dev server stopped",f="The development server has stopped. You may need to restart it to continue working.";class x extends Error{constructor(){super(S),this.name="ViteDevServerStoppedError",this.ViteDevServerStoppedError=!0}}const _=e=>!1,E=()=>{const e=a.c(5),[r,s]=d.useState(!1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>s(!0),e[0]=t):t=e[0];const v=t;let n,c;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=()=>{},c=[v],e[1]=n,e[2]=c):(n=e[1],c=e[2]),d.useEffect(n,c);let i;return e[3]!==r?(i={devServerStopped:r},e[3]=r,e[4]=i):i=e[4],i},D=()=>{const{devServerStopped:e}=E();if(e)throw new x;return null},R=()=>{const e=a.c(1);let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=_()?o.jsx(D,{}):null,e[0]=r):r=e[0],r},b=()=>{const e=a.c(3);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=[4,5,6,7],e[0]=r):r=e[0];let s;e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(u,{children:S}),e[1]=s):s=e[1];let t;return e[2]===Symbol.for("react.memo_cache_sentinel")?(t=o.jsx(l,{height:"fill",overflow:"auto",paddingY:r,paddingX:4,sizing:"border",tone:"critical",children:o.jsx(m,{width:3,children:o.jsxs(p,{space:4,children:[s,o.jsx(l,{border:!0,radius:2,overflow:"auto",padding:4,tone:"inherit",children:o.jsx(p,{space:4,children:o.jsx(h,{size:2,children:f})})})]})})}),e[2]=t):t=e[2],t};export{R as DetectViteDevServerStopped,b as DevServerStoppedErrorScreen,x as ViteDevServerStoppedError}; diff --git a/apps/studio/dist/static/apple-touch-icon.png b/apps/studio/dist/static/apple-touch-icon.png new file mode 100644 index 00000000..161019f9 Binary files /dev/null and b/apps/studio/dist/static/apple-touch-icon.png differ diff --git a/apps/studio/dist/static/browser-BzyRemDg.js b/apps/studio/dist/static/browser-BzyRemDg.js new file mode 100644 index 00000000..d5d68084 --- /dev/null +++ b/apps/studio/dist/static/browser-BzyRemDg.js @@ -0,0 +1,3 @@ +import{g as Ue}from"./sanity-BZuh2pfi.js";function Ge(G,K){for(var y=0;yT[_]})}}}return Object.freeze(Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}))}var $={exports:{}};var Ve=$.exports,Ae;function We(){return Ae||(Ae=1,(function(G,K){(function(y){var T=y.setTimeout,_=y.clearTimeout,h=y.XMLHttpRequest,ce=y.XDomainRequest,le=y.ActiveXObject,Z=y.EventSource,I=y.document,Fe=y.Promise,J=y.fetch,ve=y.Response,Y=y.TextDecoder,he=y.TextEncoder,te=y.AbortController;if(typeof window<"u"&&typeof I<"u"&&!("readyState"in I)&&I.body==null&&(I.readyState="loading",window.addEventListener("load",function(e){I.readyState="complete"},!1)),h==null&&le!=null&&(h=function(){return new le("Microsoft.XMLHTTP")}),Object.create==null&&(Object.create=function(e){function r(){}return r.prototype=e,new r}),Date.now||(Date.now=function(){return new Date().getTime()}),te==null){var Oe=J;J=function(e,r){var n=r.signal;return Oe(e,{headers:r.headers,credentials:r.credentials,cache:r.cache}).then(function(t){var o=t.body.getReader();return n._reader=o,n._aborted&&n._reader.cancel(),{status:t.status,statusText:t.statusText,headers:t.headers,body:{getReader:function(){return o}}}})},te=function(){this.signal={_reader:null,_aborted:!1},this.abort=function(){this.signal._reader!=null&&this.signal._reader.cancel(),this.signal._aborted=!0}}}function pe(){this.bitsNeeded=0,this.codePoint=0}pe.prototype.decode=function(e){function r(d,u,i){if(i===1)return d>=128>>u&&d<=2048>>u&&d<=57344>>u&&d<=65536>>u&&d<>6>15?3:u>31?2:1;if(d===12)return u>15?3:2;if(d===18)return 3;throw new Error}for(var t=65533,o="",a=this.bitsNeeded,s=this.codePoint,c=0;c191||!r(s<<6|f&63,a-6,n(a,s)))&&(a=0,s=t,o+=String.fromCharCode(s)),a===0?(f>=0&&f<=127?(a=0,s=f):f>=192&&f<=223?(a=6,s=f&31):f>=224&&f<=239?(a=12,s=f&15):f>=240&&f<=247?(a=18,s=f&7):(a=0,s=t),a!==0&&!r(s,a,n(a,s))&&(a=0,s=t)):(a-=6,s=s<<6|f&63),a===0&&(s<=65535?o+=String.fromCharCode(s):(o+=String.fromCharCode(55296+(s-65535-1>>10)),o+=String.fromCharCode(56320+(s-65535-1&1023))))}return this.bitsNeeded=a,this.codePoint=s,o};var Ne=function(){try{return new Y().decode(new he().encode("test"),{stream:!0})==="test"}catch(e){console.debug("TextDecoder does not support streaming option. Using polyfill instead: "+e)}return!1};(Y==null||he==null||!Ne())&&(Y=pe);var R=function(){};function j(e){this.withCredentials=!1,this.readyState=0,this.status=0,this.statusText="",this.responseText="",this.onprogress=R,this.onload=R,this.onerror=R,this.onreadystatechange=R,this._contentType="",this._xhr=e,this._sendTimeout=0,this._abort=R}j.prototype.open=function(e,r){this._abort(!0);var n=this,t=this._xhr,o=1,a=0;this._abort=function(i){n._sendTimeout!==0&&(_(n._sendTimeout),n._sendTimeout=0),(o===1||o===2||o===3)&&(o=4,t.onload=R,t.onerror=R,t.onabort=R,t.onprogress=R,t.onreadystatechange=R,t.abort(),a!==0&&(_(a),a=0),i||(n.readyState=4,n.onabort(null),n.onreadystatechange())),o=0};var s=function(){if(o===1){var i=0,l="",D=void 0;if("contentType"in t)i=200,l="OK",D=t.contentType;else try{i=t.status,l=t.statusText,D=t.getResponseHeader("Content-Type")}catch{i=0,l="",D=void 0}i!==0&&(o=2,n.readyState=2,n.status=i,n.statusText=l,n._contentType=D,n.onreadystatechange())}},c=function(){if(s(),o===2||o===3){o=3;var i="";try{i=t.responseText}catch{}n.readyState=3,n.responseText=i,n.onprogress()}},f=function(i,l){if((l==null||l.preventDefault==null)&&(l={preventDefault:R}),c(),o===1||o===2||o===3){if(o=4,a!==0&&(_(a),a=0),n.readyState=4,i==="load")n.onload(l);else if(i==="error")n.onerror(l);else if(i==="abort")n.onabort(l);else throw new TypeError;n.onreadystatechange()}},d=function(i){t!=null&&(t.readyState===4?(!("onload"in t)||!("onerror"in t)||!("onabort"in t))&&f(t.responseText===""?"error":"load",i):t.readyState===3?"onprogress"in t||c():t.readyState===2&&s())},u=function(){a=T(function(){u()},500),t.readyState===3&&c()};"onload"in t&&(t.onload=function(i){f("load",i)}),"onerror"in t&&(t.onerror=function(i){f("error",i)}),"onabort"in t&&(t.onabort=function(i){f("abort",i)}),"onprogress"in t&&(t.onprogress=c),"onreadystatechange"in t&&(t.onreadystatechange=function(i){d(i)}),("contentType"in t||!("ontimeout"in h.prototype))&&(r+=(r.indexOf("?")===-1?"?":"&")+"padding=true"),t.open(e,r,!0),"readyState"in t&&(a=T(function(){u()},0))},j.prototype.abort=function(){this._abort(!1)},j.prototype.getResponseHeader=function(e){return this._contentType},j.prototype.setRequestHeader=function(e,r){var n=this._xhr;"setRequestHeader"in n&&n.setRequestHeader(e,r)},j.prototype.getAllResponseHeaders=function(){return this._xhr.getAllResponseHeaders!=null&&this._xhr.getAllResponseHeaders()||""},j.prototype.send=function(){if((!("ontimeout"in h.prototype)||!("sendAsBinary"in h.prototype)&&!("mozAnon"in h.prototype))&&I!=null&&I.readyState!=null&&I.readyState!=="complete"){var e=this;e._sendTimeout=T(function(){e._sendTimeout=0,e.send()},4);return}var r=this._xhr;"withCredentials"in r&&(r.withCredentials=this.withCredentials);try{r.send(void 0)}catch(n){throw n}};function ye(e){return e.replace(/[A-Z]/g,function(r){return String.fromCharCode(r.charCodeAt(0)+32)})}function ge(e){for(var r=Object.create(null),n=e.split(`\r +`),t=0;t"u"?typeof window<"u"?window:typeof self<"u"?self:Ve:globalThis)})($,$.exports)),$.exports}var ue,xe;function ze(){return xe||(xe=1,ue=We().EventSourcePolyfill),ue}var De=ze();const Qe=Ue(De),Ke=Ge({__proto__:null,default:Qe},[De]);export{Ke as b}; diff --git a/apps/studio/dist/static/clike-CjuBxE1O.js b/apps/studio/dist/static/clike-CjuBxE1O.js new file mode 100644 index 00000000..4aac1359 --- /dev/null +++ b/apps/studio/dist/static/clike-CjuBxE1O.js @@ -0,0 +1 @@ +function O(e,n,t,l,u,d){this.indented=e,this.column=n,this.type=t,this.info=l,this.align=u,this.prev=d}function D(e,n,t,l){var u=e.indented;return e.context&&e.context.type=="statement"&&t!="statement"&&(u=e.context.indented),e.context=new O(u,n,t,l,null,e.context)}function x(e){var n=e.context.type;return(n==")"||n=="]"||n=="}")&&(e.indented=e.context.indented),e.context=e.context.prev}function V(e,n,t){if(n.prevToken=="variable"||n.prevToken=="type"||/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,t))||n.typeAtEndOfLine&&e.column()==e.indentation())return!0}function P(e){for(;;){if(!e||e.type=="top")return!0;if(e.type=="}"&&e.prev.info!="namespace")return!1;e=e.prev}}function h(e){var n=e.statementIndentUnit,t=e.dontAlignCalls,l=e.keywords||{},u=e.types||{},d=e.builtin||{},b=e.blockKeywords||{},_=e.defKeywords||{},w=e.atoms||{},y=e.hooks||{},te=e.multiLineStrings,re=e.indentStatements!==!1,ie=e.indentSwitch!==!1,F=e.namespaceSeparator,oe=e.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,ae=e.numberStart||/[\d\.]/,le=e.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,j=e.isOperatorChar||/[+\-*&%=<>!?|\/]/,B=e.isIdentifierChar||/[\w\$_\xa1-\uffff]/,U=e.isReservedIdentifier||!1,p,C;function K(i,a){var c=i.next();if(y[c]){var o=y[c](i,a);if(o!==!1)return o}if(c=='"'||c=="'")return a.tokenize=ce(c),a.tokenize(i,a);if(ae.test(c)){if(i.backUp(1),i.match(le))return"number";i.next()}if(oe.test(c))return p=c,null;if(c=="/"){if(i.eat("*"))return a.tokenize=A,A(i,a);if(i.eat("/"))return i.skipToEnd(),"comment"}if(j.test(c)){for(;!i.match(/^\/[\/*]/,!1)&&i.eat(j););return"operator"}if(i.eatWhile(B),F)for(;i.match(F);)i.eatWhile(B);var s=i.current();return m(l,s)?(m(b,s)&&(p="newstatement"),m(_,s)&&(C=!0),"keyword"):m(u,s)?"type":m(d,s)||U&&U(s)?(m(b,s)&&(p="newstatement"),"builtin"):m(w,s)?"atom":"variable"}function ce(i){return function(a,c){for(var o=!1,s,v=!1;(s=a.next())!=null;){if(s==i&&!o){v=!0;break}o=!o&&s=="\\"}return(v||!(o||te))&&(c.tokenize=null),"string"}}function A(i,a){for(var c=!1,o;o=i.next();){if(o=="/"&&c){a.tokenize=null;break}c=o=="*"}return"comment"}function $(i,a){e.typeFirstDefinitions&&i.eol()&&P(a.context)&&(a.typeAtEndOfLine=V(i,a,i.pos))}return{name:e.name,startState:function(i){return{tokenize:null,context:new O(-i,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(i,a){var c=a.context;if(i.sol()&&(c.align==null&&(c.align=!1),a.indented=i.indentation(),a.startOfLine=!0),i.eatSpace())return $(i,a),null;p=C=null;var o=(a.tokenize||K)(i,a);if(o=="comment"||o=="meta")return o;if(c.align==null&&(c.align=!0),p==";"||p==":"||p==","&&i.match(/^\s*(?:\/\/.*)?$/,!1))for(;a.context.type=="statement";)x(a);else if(p=="{")D(a,i.column(),"}");else if(p=="[")D(a,i.column(),"]");else if(p=="(")D(a,i.column(),")");else if(p=="}"){for(;c.type=="statement";)c=x(a);for(c.type=="}"&&(c=x(a));c.type=="statement";)c=x(a)}else p==c.type?x(a):re&&((c.type=="}"||c.type=="top")&&p!=";"||c.type=="statement"&&p=="newstatement")&&D(a,i.column(),"statement",i.current());if(o=="variable"&&(a.prevToken=="def"||e.typeFirstDefinitions&&V(i,a,i.start)&&P(a.context)&&i.match(/^\s*\(/,!1))&&(o="def"),y.token){var s=y.token(i,a,o);s!==void 0&&(o=s)}return o=="def"&&e.styleDefs===!1&&(o="variable"),a.startOfLine=!1,a.prevToken=C?"def":o||p,$(i,a),o},indent:function(i,a,c){if(i.tokenize!=K&&i.tokenize!=null||i.typeAtEndOfLine&&P(i.context))return null;var o=i.context,s=a&&a.charAt(0),v=s==o.type;if(o.type=="statement"&&s=="}"&&(o=o.prev),e.dontIndentStatements)for(;o.type=="statement"&&e.dontIndentStatements.test(o.info);)o=o.prev;if(y.indent){var q=y.indent(i,o,a,c.unit);if(typeof q=="number")return q}var ue=o.prev&&o.prev.info=="switch";if(e.allmanIndentation&&/[{(]/.test(s)){for(;o.type!="top"&&o.type!="}";)o=o.prev;return o.indented}return o.type=="statement"?o.indented+(s=="{"?0:n||c.unit):o.align&&(!t||o.type!=")")?o.column+(v?0:1):o.type==")"&&!v?o.indented+(n||c.unit):o.indented+(v?0:c.unit)+(!v&&ue&&!/^(?:case|default)\b/.test(a)?c.unit:0)},languageData:{indentOnInput:ie?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}},autocomplete:Object.keys(l).concat(Object.keys(u)).concat(Object.keys(d)).concat(Object.keys(w)),...e.languageData}}}function r(e){for(var n={},t=e.split(" "),l=0;l!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,n){return e.match('""')?(n.tokenize=J,n.tokenize(e,n)):!1},"'":function(e){return e.match(/^(\\[^'\s]+|[^\\'])'/)?"character":(e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},"=":function(e,n){var t=n.context;return t.type=="}"&&t.align&&e.eat(">")?(n.context=new O(t.indented,t.column,t.type,t.info,null,t.prev),"operator"):!1},"/":function(e,n){return e.eat("*")?(n.tokenize=S(1),n.tokenize(e,n)):!1}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}});function de(e){return function(n,t){for(var l=!1,u,d=!1;!n.eol();){if(!e&&!l&&n.match('"')){d=!0;break}if(e&&n.match('"""')){d=!0;break}u=n.next(),!l&&u=="$"&&n.match("{")&&n.skipTo("}"),l=!l&&u=="\\"&&!e}return(d||!e)&&(t.tokenize=null),"string"}}h({name:"kotlin",keywords:r("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam"),types:r("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(ul?|l|f)?/i,blockKeywords:r("catch class do else finally for if where try while enum"),defKeywords:r("class val var object interface fun"),atoms:r("true false null this"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},"*":function(e,n){return n.prevToken=="."?"variable":"operator"},'"':function(e,n){return n.tokenize=de(e.match('""')),n.tokenize(e,n)},"/":function(e,n){return e.eat("*")?(n.tokenize=S(1),n.tokenize(e,n)):!1},indent:function(e,n,t,l){var u=t&&t.charAt(0);if((e.prevToken=="}"||e.prevToken==")")&&t=="")return e.indented;if(e.prevToken=="operator"&&t!="}"&&e.context.type!="}"||e.prevToken=="variable"&&u=="."||(e.prevToken=="}"||e.prevToken==")")&&u==".")return l*2+n.indented;if(n.align&&n.type=="}")return n.indented+(e.context.type==(t||"").charAt(0)?0:l)}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}});h({name:"shader",keywords:r("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:r("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:r("for while do if else struct"),builtin:r("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:r("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":g}});h({name:"nesc",keywords:r(T+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:I,blockKeywords:r(N),atoms:r("null true false"),hooks:{"#":g}});h({name:"objectivec",keywords:r(T+" "+Q),types:X,builtin:r(Z),blockKeywords:r(N+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:r(z+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:r("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:E,hooks:{"#":g,"*":M}});h({name:"objectivecpp",keywords:r(T+" "+Q+" "+H),types:X,builtin:r(Z),blockKeywords:r(N+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:r(z+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:r("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:E,hooks:{"#":g,"*":M,u:k,U:k,L:k,R:k,0:f,1:f,2:f,3:f,4:f,5:f,6:f,7:f,8:f,9:f,token:function(e,n,t){if(t=="variable"&&e.peek()=="("&&(n.prevToken==";"||n.prevToken==null||n.prevToken=="}")&&Y(e.current()))return"def"}},namespaceSeparator:"::"});h({name:"squirrel",keywords:r("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:I,blockKeywords:r("case catch class else for foreach if switch try while"),defKeywords:r("function local class"),typeFirstDefinitions:!0,atoms:r("true false null"),hooks:{"#":g}});var L=null;function ee(e){return function(n,t){for(var l=!1,u,d=!1;!n.eol();){if(!l&&n.match('"')&&(e=="single"||n.match('""'))){d=!0;break}if(!l&&n.match("``")){L=ee(e),d=!0;break}u=n.next(),l=e=="single"&&!l&&u=="\\"}return d&&(t.tokenize=null),"string"}}h({name:"ceylon",keywords:r("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var n=e.charAt(0);return n===n.toUpperCase()&&n!==n.toLowerCase()},blockKeywords:r("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:r("class dynamic function interface module object package value"),builtin:r("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:r("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,n){return n.tokenize=ee(e.match('""')?"triple":"single"),n.tokenize(e,n)},"`":function(e,n){return!L||!e.match("`")?!1:(n.tokenize=L,L=null,n.tokenize(e,n))},"'":function(e){return e.match(/^(\\[^'\s]+|[^\\'])'/)?"string.special":(e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},token:function(e,n,t){if((t=="variable"||t=="type")&&n.prevToken==".")return"variableName.special"}},languageData:{closeBrackets:{brackets:["(","[","{","'",'"','"""']}}});function pe(e){(e.interpolationStack||(e.interpolationStack=[])).push(e.tokenize)}function ne(e){return(e.interpolationStack||(e.interpolationStack=[])).pop()}function he(e){return e.interpolationStack?e.interpolationStack.length:0}function R(e,n,t,l){var u=!1;if(n.eat(e))if(n.eat(e))u=!0;else return"string";function d(b,_){for(var w=!1;!b.eol();){if(!l&&!w&&b.peek()=="$")return pe(_),_.tokenize=ye,"string";var y=b.next();if(y==e&&!w&&(!u||b.match(e+e))){_.tokenize=null;break}w=!l&&!w&&y=="\\"}return"string"}return t.tokenize=d,d(n,t)}function ye(e,n){return e.eat("$"),e.eat("{")?n.tokenize=null:n.tokenize=me,null}function me(e,n){return e.eatWhile(/[\w_]/),n.tokenize=ne(n),"variable"}h({name:"dart",keywords:r("this super static final const abstract class extends external factory implements mixin get native set typedef with enum throw rethrow assert break case continue default in return new deferred async await covariant try catch finally do else for if switch while import library export part of show hide is as extension on yield late required sealed base interface when inline"),blockKeywords:r("try catch finally do else for if switch while"),builtin:r("void bool num int double dynamic var String Null Never"),atoms:r("true false null"),number:/^(?:0x[a-f\d_]+|(?:[\d_]+\.?[\d_]*|\.[\d_]+)(?:e[-+]?[\d_]+)?)/i,hooks:{"@":function(e){return e.eatWhile(/[\w\$_\.]/),"meta"},"'":function(e,n){return R("'",e,n,!1)},'"':function(e,n){return R('"',e,n,!1)},r:function(e,n){var t=e.peek();return t=="'"||t=='"'?R(e.next(),e,n,!0):!1},"}":function(e,n){return he(n)>0?(n.tokenize=ne(n),null):!1},"/":function(e,n){return e.eat("*")?(n.tokenize=S(1),n.tokenize(e,n)):!1},token:function(e,n,t){if(t=="variable"){var l=RegExp("^[_$]*[A-Z][a-zA-Z0-9_$]*$","g");if(l.test(e.current()))return"type"}}}});export{h as clike,ke as csharp}; diff --git a/apps/studio/dist/static/css-Bt2UjfAg.js b/apps/studio/dist/static/css-Bt2UjfAg.js new file mode 100644 index 00000000..018016e6 --- /dev/null +++ b/apps/studio/dist/static/css-Bt2UjfAg.js @@ -0,0 +1 @@ +function y(i){i={...ae,...i};var l=i.inline,m=i.tokenHooks,b=i.documentTypes||{},G=i.mediaTypes||{},J=i.mediaFeatures||{},Q=i.mediaValueKeywords||{},O=i.propertyKeywords||{},F=i.nonStandardPropertyKeywords||{},R=i.fontProperties||{},ee=i.counterDescriptors||{},N=i.colorKeywords||{},V=i.valueKeywords||{},g=i.allowNested,re=i.lineComment,oe=i.supportsAtComponent===!0,W=i.highlightNonStandardPropertyKeywords!==!1,w,n;function d(e,o){return w=o,e}function ie(e,o){var r=e.next();if(m[r]){var t=m[r](e,o);if(t!==!1)return t}if(r=="@")return e.eatWhile(/[\w\\\-]/),d("def",e.current());if(r=="="||(r=="~"||r=="|")&&e.eat("="))return d(null,"compare");if(r=='"'||r=="'")return o.tokenize=$(r),o.tokenize(e,o);if(r=="#")return e.eatWhile(/[\w\\\-]/),d("atom","hash");if(r=="!")return e.match(/^\s*\w*/),d("keyword","important");if(/\d/.test(r)||r=="."&&e.eat(/\d/))return e.eatWhile(/[\w.%]/),d("number","unit");if(r==="-"){if(/[\d.]/.test(e.peek()))return e.eatWhile(/[\w.%]/),d("number","unit");if(e.match(/^-[\w\\\-]*/))return e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?d("def","variable-definition"):d("variableName","variable");if(e.match(/^\w+-/))return d("meta","meta")}else return/[,+>*\/]/.test(r)?d(null,"select-op"):r=="."&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?d("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?d(null,r):e.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(e.current())&&(o.tokenize=te),d("variableName.function","variable")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),d("property","word")):d(null,null)}function $(e){return function(o,r){for(var t=!1,c;(c=o.next())!=null;){if(c==e&&!t){e==")"&&o.backUp(1);break}t=!t&&c=="\\"}return(c==e||!t&&e!=")")&&(r.tokenize=null),d("string","string")}}function te(e,o){return e.next(),e.match(/^\s*[\"\')]/,!1)?o.tokenize=null:o.tokenize=$(")"),d(null,"(")}function D(e,o,r){this.type=e,this.indent=o,this.prev=r}function s(e,o,r,t){return e.context=new D(r,o.indentation()+(t===!1?0:o.indentUnit),e.context),r}function u(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function k(e,o,r){return a[r.context.type](e,o,r)}function h(e,o,r,t){for(var c=t||1;c>0;c--)r.context=r.context.prev;return k(e,o,r)}function L(e){var o=e.current().toLowerCase();V.hasOwnProperty(o)?n="atom":N.hasOwnProperty(o)?n="keyword":n="variable"}var a={};return a.top=function(e,o,r){if(e=="{")return s(r,o,"block");if(e=="}"&&r.context.prev)return u(r);if(oe&&/@component/i.test(e))return s(r,o,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return s(r,o,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return s(r,o,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&e.charAt(0)=="@")return s(r,o,"at");if(e=="hash")n="builtin";else if(e=="word")n="tag";else{if(e=="variable-definition")return"maybeprop";if(e=="interpolation")return s(r,o,"interpolation");if(e==":")return"pseudo";if(g&&e=="(")return s(r,o,"parens")}return r.context.type},a.block=function(e,o,r){if(e=="word"){var t=o.current().toLowerCase();return O.hasOwnProperty(t)?(n="property","maybeprop"):F.hasOwnProperty(t)?(n=W?"string.special":"property","maybeprop"):g?(n=o.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(n="error","maybeprop")}else return e=="meta"?"block":!g&&(e=="hash"||e=="qualifier")?(n="error","block"):a.top(e,o,r)},a.maybeprop=function(e,o,r){return e==":"?s(r,o,"prop"):k(e,o,r)},a.prop=function(e,o,r){if(e==";")return u(r);if(e=="{"&&g)return s(r,o,"propBlock");if(e=="}"||e=="{")return h(e,o,r);if(e=="(")return s(r,o,"parens");if(e=="hash"&&!/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(o.current()))n="error";else if(e=="word")L(o);else if(e=="interpolation")return s(r,o,"interpolation");return"prop"},a.propBlock=function(e,o,r){return e=="}"?u(r):e=="word"?(n="property","maybeprop"):r.context.type},a.parens=function(e,o,r){return e=="{"||e=="}"?h(e,o,r):e==")"?u(r):e=="("?s(r,o,"parens"):e=="interpolation"?s(r,o,"interpolation"):(e=="word"&&L(o),"parens")},a.pseudo=function(e,o,r){return e=="meta"?"pseudo":e=="word"?(n="variableName.constant",r.context.type):k(e,o,r)},a.documentTypes=function(e,o,r){return e=="word"&&b.hasOwnProperty(o.current())?(n="tag",r.context.type):a.atBlock(e,o,r)},a.atBlock=function(e,o,r){if(e=="(")return s(r,o,"atBlock_parens");if(e=="}"||e==";")return h(e,o,r);if(e=="{")return u(r)&&s(r,o,g?"block":"top");if(e=="interpolation")return s(r,o,"interpolation");if(e=="word"){var t=o.current().toLowerCase();t=="only"||t=="not"||t=="and"||t=="or"?n="keyword":G.hasOwnProperty(t)?n="attribute":J.hasOwnProperty(t)?n="property":Q.hasOwnProperty(t)?n="keyword":O.hasOwnProperty(t)?n="property":F.hasOwnProperty(t)?n=W?"string.special":"property":V.hasOwnProperty(t)?n="atom":N.hasOwnProperty(t)?n="keyword":n="error"}return r.context.type},a.atComponentBlock=function(e,o,r){return e=="}"?h(e,o,r):e=="{"?u(r)&&s(r,o,g?"block":"top",!1):(e=="word"&&(n="error"),r.context.type)},a.atBlock_parens=function(e,o,r){return e==")"?u(r):e=="{"||e=="}"?h(e,o,r,2):a.atBlock(e,o,r)},a.restricted_atBlock_before=function(e,o,r){return e=="{"?s(r,o,"restricted_atBlock"):e=="word"&&r.stateArg=="@counter-style"?(n="variable","restricted_atBlock_before"):k(e,o,r)},a.restricted_atBlock=function(e,o,r){return e=="}"?(r.stateArg=null,u(r)):e=="word"?(r.stateArg=="@font-face"&&!R.hasOwnProperty(o.current().toLowerCase())||r.stateArg=="@counter-style"&&!ee.hasOwnProperty(o.current().toLowerCase())?n="error":n="property","maybeprop"):"restricted_atBlock"},a.keyframes=function(e,o,r){return e=="word"?(n="variable","keyframes"):e=="{"?s(r,o,"top"):k(e,o,r)},a.at=function(e,o,r){return e==";"?u(r):e=="{"||e=="}"?h(e,o,r):(e=="word"?n="tag":e=="hash"&&(n="builtin"),"at")},a.interpolation=function(e,o,r){return e=="}"?u(r):e=="{"||e==";"?h(e,o,r):(e=="word"?n="variable":e!="variable"&&e!="("&&e!=")"&&(n="error"),"interpolation")},{name:i.name,startState:function(){return{tokenize:null,state:l?"block":"top",stateArg:null,context:new D(l?"block":"top",0,null)}},token:function(e,o){if(!o.tokenize&&e.eatSpace())return null;var r=(o.tokenize||ie)(e,o);return r&&typeof r=="object"&&(w=r[1],r=r[0]),n=r,w!="comment"&&(o.state=a[o.state](w,e,o)),n},indent:function(e,o,r){var t=e.context,c=o&&o.charAt(0),q=t.indent;return t.type=="prop"&&(c=="}"||c==")")&&(t=t.prev),t.prev&&(c=="}"&&(t.type=="block"||t.type=="top"||t.type=="interpolation"||t.type=="restricted_atBlock")?(t=t.prev,q=t.indent):(c==")"&&(t.type=="parens"||t.type=="atBlock_parens")||c=="{"&&(t.type=="at"||t.type=="atBlock"))&&(q=Math.max(0,t.indent-r.unit))),q},languageData:{indentOnInput:/^\s*\}$/,commentTokens:{line:re,block:{open:"/*",close:"*/"}},autocomplete:M}}}function p(i){for(var l={},m=0;m + + + + + + + + + + + diff --git a/apps/studio/dist/static/go-CTD25R5P.js b/apps/studio/dist/static/go-CTD25R5P.js new file mode 100644 index 00000000..cacb8014 --- /dev/null +++ b/apps/studio/dist/static/go-CTD25R5P.js @@ -0,0 +1 @@ +var h={break:!0,case:!0,chan:!0,const:!0,continue:!0,default:!0,defer:!0,else:!0,fallthrough:!0,for:!0,func:!0,go:!0,goto:!0,if:!0,import:!0,interface:!0,map:!0,package:!0,range:!0,return:!0,select:!0,struct:!0,switch:!0,type:!0,var:!0,bool:!0,byte:!0,complex64:!0,complex128:!0,float32:!0,float64:!0,int8:!0,int16:!0,int32:!0,int64:!0,string:!0,uint8:!0,uint16:!0,uint32:!0,uint64:!0,int:!0,uint:!0,uintptr:!0,error:!0,rune:!0,any:!0,comparable:!0},k={true:!0,false:!0,iota:!0,nil:!0,append:!0,cap:!0,close:!0,complex:!0,copy:!0,delete:!0,imag:!0,len:!0,make:!0,new:!0,panic:!0,print:!0,println:!0,real:!0,recover:!0},f=/[+\-*&^%:=<>!|\/]/,u;function l(e,t){var n=e.next();if(n=='"'||n=="'"||n=="`")return t.tokenize=x(n),t.tokenize(e,t);if(/[\d\.]/.test(n))return n=="."?e.match(/^[0-9]+([eE][\-+]?[0-9]+)?/):n=="0"?e.match(/^[xX][0-9a-fA-F]+/)||e.match(/^0[0-7]+/):e.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/),"number";if(/[\[\]{}\(\),;\:\.]/.test(n))return u=n,null;if(n=="/"){if(e.eat("*"))return t.tokenize=a,a(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(f.test(n))return e.eatWhile(f),"operator";e.eatWhile(/[\w\$_\xa1-\uffff]/);var r=e.current();return h.propertyIsEnumerable(r)?((r=="case"||r=="default")&&(u="case"),"keyword"):k.propertyIsEnumerable(r)?"atom":"variable"}function x(e){return function(t,n){for(var r=!1,i,o=!1;(i=t.next())!=null;){if(i==e&&!r){o=!0;break}r=!r&&e!="`"&&i=="\\"}return(o||!(r||e=="`"))&&(n.tokenize=l),"string"}}function a(e,t){for(var n=!1,r;r=e.next();){if(r=="/"&&n){t.tokenize=l;break}n=r=="*"}return"comment"}function d(e,t,n,r,i){this.indented=e,this.column=t,this.type=n,this.align=r,this.prev=i}function c(e,t,n){return e.context=new d(e.indented,t,n,null,e.context)}function p(e){if(e.context.prev){var t=e.context.type;return(t==")"||t=="]"||t=="}")&&(e.indented=e.context.indented),e.context=e.context.prev}}const s={name:"go",startState:function(e){return{tokenize:null,context:new d(-e,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,t){var n=t.context;if(e.sol()&&(n.align==null&&(n.align=!1),t.indented=e.indentation(),t.startOfLine=!0,n.type=="case"&&(n.type="}")),e.eatSpace())return null;u=null;var r=(t.tokenize||l)(e,t);return r=="comment"||(n.align==null&&(n.align=!0),u=="{"?c(t,e.column(),"}"):u=="["?c(t,e.column(),"]"):u=="("?c(t,e.column(),")"):u=="case"?n.type="case":(u=="}"&&n.type=="}"||u==n.type)&&p(t),t.startOfLine=!1),r},indent:function(e,t,n){if(e.tokenize!=l&&e.tokenize!=null)return null;var r=e.context,i=t&&t.charAt(0);if(r.type=="case"&&/^(?:case|default)\b/.test(t))return r.indented;var o=i==r.type;return r.align?r.column+(o?0:1):r.indented+(o?0:n.unit)},languageData:{indentOnInput:/^\s([{}]|case |default\s*:)$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}}}};export{s as go}; diff --git a/apps/studio/dist/static/index-9VbysdZK.js b/apps/studio/dist/static/index-9VbysdZK.js new file mode 100644 index 00000000..8b28523f --- /dev/null +++ b/apps/studio/dist/static/index-9VbysdZK.js @@ -0,0 +1 @@ +import{P as L,I as $,N as E,a5 as j,G as y,J as S,a1 as G}from"./index-DznCqw2V.js";var N={};class v{constructor(t,e,s,i,h,r,n,o,a,u=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=a,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new v(t,[],e,s,s,0,[],0,i?new R(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&r.buffer[n-4]==0&&r.buffer[n-1]>-1){if(e==s)return;if(r.buffer[n-2]>=e){r.buffer[n-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);!n&&(i>s||e<=r.maxNode)&&(this.reducePos=i),this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}else this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4)}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new v(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new U(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;ho&1&&n==r)||i.push(e[h],r)}e=i}let s=[];for(let i=0;i>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,a=this.stack.length-n*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(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:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e0&&this.emitLookAhead()}}class R{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class U{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class A{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new A(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.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 A(this.stack,this.pos,this.index)}}function x(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,n=!0),h+=o,n)break;h*=46}e?e[i++]=h:e=new t(h)}return e}class P{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const z=new P;class H{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=z,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;for(;hs.to:h>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e=this.chunk2Pos&&sn.to&&(this.chunk2=this.chunk2.slice(0,n.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,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(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,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(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=z,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;O(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class W{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(O(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(h||i++,r==null)break;t.reset(r,t.token)}i&&(t.reset(s,t.token),t.acceptToken(this.elseToken,i))}}W.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class Z{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function O(l,t,e,s,i,h){let r=0,n=1<0){let d=l[c];if(o.allows(d)&&(t.token.value==-1||t.token.value==d||J(d,t.token.value,i,h))){t.acceptToken(d);break}}let u=t.next,f=0,p=l[r+2];if(t.next<0&&p>f&&l[a+p*3-3]==65535){r=l[a+p*3-1];continue t}for(;f>1,d=a+c+(c<<1),b=l[d],M=l[d+1]||65536;if(u=M)f=c+1;else{r=l[d+2],t.advance();continue t}}break}}function I(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function J(l,t,e,s){let i=I(e,s,t);return i<0||I(e,s,l)t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class q{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?D(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?D(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=r,null;if(h instanceof S){if(r==t){if(r=Math.max(this.safeFrom,t)&&(this.trees.push(h),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+h.length}}}class K{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new P)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let a=0;af.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let p=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!u.extend&&(s=f,e>p))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new P,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new P,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r=0&&s.p.parser.dialect.allows(n>>1)){(n&1)==0?t.value=n>>1:t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;ht.bufferLength*4?new q(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;re)s.push(n);else{if(this.advanceStack(n,s,t))continue;{i||(i=[],h=[]),i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}}break}}if(!s.length){let r=i&&X(i);if(r)return g&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw g&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r)return g&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((n,o)=>o.score-n.score);s.length>r;)s.pop();s.some(n=>n.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r500&&a.buffer.length>500)if((n.score-a.score||n.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&(s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,u=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let p=this.parser.nodeSet.types[f.type.id]==f.type?h.getGoto(t.state,f.type.id):-1;if(p>-1&&f.length&&(!a||(f.prop(y.contextHash)||0)==u))return t.useNode(f,p),g&&console.log(r+this.stackID(t)+` (via reuse of ${h.getName(f.type.id)})`),!0;if(!(f instanceof S)||f.children.length==0||f.positions[0]>0)break;let c=f.children[0];if(c instanceof S&&f.positions[0]==0)f=c;else break}}let n=h.stateSlot(t.state,4);if(n>0)return t.reduce(n),g&&console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;ai?e.push(d):s.push(d)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return B(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r ":"";if(n.deadEnd&&(h||(h=!0,n.restart(),g&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,s))))continue;let f=n.split(),p=u;for(let c=0;c<10&&f.forceReduce()&&(g&&console.log(p+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));c++)g&&(p=this.stackID(f)+" -> ");for(let c of n.recoverByInsert(o))g&&console.log(u+this.stackID(c)+" (via recover-insert)"),this.advanceFully(c,s);this.stream.end>n.pos?(a==n.pos&&(a++,o=0),n.recoverByDelete(o,a),g&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`),B(n,s)):(!i||i.scorel;class _{constructor(t){this.start=t.start,this.shift=t.shift||C,this.reduce=t.reduce||C,this.reuse=t.reuse||C,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class w extends L{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;nt.topRules[n][1]),i=[];for(let n=0;n=0)h(u,o,n[a++]);else{let f=n[a+-u];for(let p=-u;p>0;p--)h(n[a++],o,f);a++}}}this.nodeSet=new $(e.map((n,o)=>E.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=j;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;ntypeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new Q(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let a=h+(r>>1);h0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];e.some((h,r)=>r&1&&h==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(w.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(h=>h.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find(n=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=F(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);r>=0&&(s[r]=!0)}let i=null;for(let h=0;hs)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.scorel.external(e,s)<<1|t}return l.get}export{_ as C,Z as E,w as L,W as a}; diff --git a/apps/studio/dist/static/index-BFSXaxBx.js b/apps/studio/dist/static/index-BFSXaxBx.js new file mode 100644 index 00000000..a8c5a9f3 --- /dev/null +++ b/apps/studio/dist/static/index-BFSXaxBx.js @@ -0,0 +1 @@ +import{L as ce,E as P,C as Ae,a as Ze}from"./index-9VbysdZK.js";import{u as We,r as ue,t as i,v as pe,w as Qe,x as Be,z as me,A as Ne,L as Se,F as W,a0 as Ue,a1 as De,a2 as Ie,o as Me,E as Fe}from"./index-DznCqw2V.js";import{typescriptLanguage as Le,jsxLanguage as Ke,tsxLanguage as Je,javascriptLanguage as B,javascript as He}from"./index-ByKwSaqq.js";import"./sanity-BZuh2pfi.js";const et=55,tt=1,at=56,lt=2,rt=57,Ot=3,F=4,nt=5,N=6,fe=7,ge=8,he=9,be=10,ot=11,st=12,it=13,z=58,dt=14,ct=15,L=59,Pe=21,ut=23,ye=24,pt=25,A=27,$e=28,Qt=29,mt=32,St=35,ft=37,gt=38,ht=0,bt=1,Pt={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},yt={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},K={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function $t(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}let J=null,H=null,ee=0;function Z(e,l){let r=e.pos+l;if(ee==r&&H==e)return J;let a=e.peek(l),t="";for(;$t(a);)t+=String.fromCharCode(a),a=e.peek(++l);return H=e,ee=r,J=t?t.toLowerCase():a==Xt||a==xt?void 0:null}const Xe=60,q=62,U=47,Xt=63,xt=33,vt=45;function te(e,l){this.name=e,this.parent=l}const wt=[N,be,fe,ge,he],Tt=new Ae({start:null,shift(e,l,r,a){return wt.indexOf(l)>-1?new te(Z(a,1)||"",e):e},reduce(e,l){return l==Pe&&e?e.parent:e},reuse(e,l,r,a){let t=l.type.id;return t==N||t==ft?new te(Z(a,1)||"",e):e},strict:!1}),kt=new P((e,l)=>{if(e.next!=Xe){e.next<0&&l.context&&e.acceptToken(z);return}e.advance();let r=e.next==U;r&&e.advance();let a=Z(e,0);if(a===void 0)return;if(!a)return e.acceptToken(r?ct:dt);let t=l.context?l.context.name:null;if(r){if(a==t)return e.acceptToken(ot);if(t&&yt[t])return e.acceptToken(z,-2);if(l.dialectEnabled(ht))return e.acceptToken(st);for(let O=l.context;O;O=O.parent)if(O.name==a)return;e.acceptToken(it)}else{if(a=="script")return e.acceptToken(fe);if(a=="style")return e.acceptToken(ge);if(a=="textarea")return e.acceptToken(he);if(Pt.hasOwnProperty(a))return e.acceptToken(be);t&&K[t]&&K[t][a]?e.acceptToken(z,-1):e.acceptToken(N)}},{contextual:!0}),Vt=new P(e=>{for(let l=0,r=0;;r++){if(e.next<0){r&&e.acceptToken(L);break}if(e.next==vt)l++;else if(e.next==q&&l>=2){r>=3&&e.acceptToken(L,-2);break}else l=0;e.advance()}});function qt(e){for(;e;e=e.parent)if(e.name=="svg"||e.name=="math")return!0;return!1}const Yt=new P((e,l)=>{if(e.next==U&&e.peek(1)==q){let r=l.dialectEnabled(bt)||qt(l.context);e.acceptToken(r?nt:F,2)}else e.next==q&&e.acceptToken(F,1)});function D(e,l,r){let a=2+e.length;return new P(t=>{for(let O=0,n=0,s=0;;s++){if(t.next<0){s&&t.acceptToken(l);break}if(O==0&&t.next==Xe||O==1&&t.next==U||O>=2&&On?t.acceptToken(l,-n):t.acceptToken(r,-(n-2));break}else if((t.next==10||t.next==13)&&s){t.acceptToken(l,1);break}else O=n=0;t.advance()}})}const zt=D("script",et,tt),_t=D("style",at,lt),Ct=D("textarea",rt,Ot),Rt=ue({"Text RawText IncompleteTag IncompleteCloseTag":i.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":i.angleBracket,TagName:i.tagName,"MismatchedCloseTag/TagName":[i.tagName,i.invalid],AttributeName:i.attributeName,"AttributeValue UnquotedAttributeValue":i.attributeValue,Is:i.definitionOperator,"EntityReference CharacterReference":i.character,Comment:i.blockComment,ProcessingInst:i.processingInstruction,DoctypeDecl:i.documentMeta}),Et=ce.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:",c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:Tt,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[Rt],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let S=s.type.id;if(S==Qt)return _(s,d,r);if(S==mt)return _(s,d,a);if(S==St)return _(s,d,t);if(S==Pe&&O.length){let Q=s.node,u=Q.firstChild,m=u&&ae(u,d),c;if(m){for(let p of O)if(p.tag==m&&(!p.attrs||p.attrs(c||(c=xe(u,d))))){let g=Q.lastChild,h=g.type.id==gt?g.from:Q.to;if(h>u.to)return{parser:p.parser,overlay:[{from:u.to,to:h}]}}}}if(n&&S==ye){let Q=s.node,u;if(u=Q.firstChild){let m=n[d.read(u.from,u.to)];if(m)for(let c of m){if(c.tagName&&c.tagName!=ae(Q.parent,d))continue;let p=Q.lastChild;if(p.type.id==A){let g=p.from+1,h=p.lastChild,y=p.to-(h&&h.isError?0:1);if(y>g)return{parser:c.parser,overlay:[{from:g,to:y}],bracketed:!0}}else if(p.type.id==$e)return{parser:c.parser,overlay:[{from:p.from,to:p.to}]}}}}return null})}const jt=122,le=1,Gt=123,At=124,we=2,Zt=125,Wt=3,Bt=4,Te=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Nt=58,Ut=40,ke=95,Dt=91,k=45,It=46,Mt=35,Ft=37,Lt=38,Kt=92,Jt=10,Ht=42;function v(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function I(e){return e>=48&&e<=57}function re(e){return I(e)||e>=97&&e<=102||e>=65&&e<=70}const Ve=(e,l,r)=>(a,t)=>{for(let O=!1,n=0,s=0;;s++){let{next:d}=a;if(v(d)||d==k||d==ke||O&&I(d))!O&&(d!=k||s>0)&&(O=!0),n===s&&d==k&&n++,a.advance();else if(d==Kt&&a.peek(1)!=Jt){if(a.advance(),re(a.next)){do a.advance();while(re(a.next));a.next==32&&a.advance()}else a.next>-1&&a.advance();O=!0}else{O&&a.acceptToken(n==2&&t.canShift(we)?l:d==Ut?r:e);break}}},ea=new P(Ve(Gt,we,At)),ta=new P(Ve(Zt,Wt,Bt)),aa=new P(e=>{if(Te.includes(e.peek(-1))){let{next:l}=e;(v(l)||l==ke||l==Mt||l==It||l==Ht||l==Dt||l==Nt&&v(e.peek(1))||l==k||l==Lt)&&e.acceptToken(jt)}}),la=new P(e=>{if(!Te.includes(e.peek(-1))){let{next:l}=e;if(l==Ft&&(e.advance(),e.acceptToken(le)),v(l)){do e.advance();while(v(e.next)||I(e.next));e.acceptToken(le)}}}),ra=ue({"AtKeyword import charset namespace keyframes media supports":i.definitionKeyword,"from to selector":i.keyword,NamespaceName:i.namespace,KeyframeName:i.labelName,KeyframeRangeName:i.operatorKeyword,TagName:i.tagName,ClassName:i.className,PseudoClassName:i.constant(i.className),IdName:i.labelName,"FeatureName PropertyName":i.propertyName,AttributeName:i.attributeName,NumberLiteral:i.number,KeywordQuery:i.keyword,UnaryQueryOp:i.operatorKeyword,"CallTag ValueName":i.atom,VariableName:i.variableName,Callee:i.operatorKeyword,Unit:i.unit,"UniversalSelector NestingSelector":i.definitionOperator,"MatchOp CompareOp":i.compareOperator,"ChildOp SiblingOp, LogicOp":i.logicOperator,BinOp:i.arithmeticOperator,Important:i.modifier,Comment:i.blockComment,ColorLiteral:i.color,"ParenthesizedContent StringLiteral":i.string,":":i.punctuation,"PseudoOp #":i.derefOperator,"; ,":i.separator,"( )":i.paren,"[ ]":i.squareBracket,"{ }":i.brace}),Oa={__proto__:null,lang:38,"nth-child":38,"nth-last-child":38,"nth-of-type":38,"nth-last-of-type":38,dir:38,"host-context":38,if:84,url:124,"url-prefix":124,domain:124,regexp:124},na={__proto__:null,or:98,and:98,not:106,only:106,layer:170},oa={__proto__:null,selector:112,layer:166},sa={__proto__:null,"@import":162,"@media":174,"@charset":178,"@namespace":182,"@keyframes":188,"@supports":200,"@scope":204},ia={__proto__:null,to:207},da=ce.deserialize({version:14,states:"EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#DuO%_QdO'#DxOOQP'#FV'#FVO&eQhO'#EhOOQS'#FU'#FUOOQS'#Ek'#EkQYQdOOO&lQdO'#EOO&PQhO'#EUO&lQdO'#EWO'aQdO'#EYO'lQdO'#E]O'tQhO'#EcO(VQdO'#EeO(bQaO'#CfO)VQ`O'#D{O)[Q`O'#F`O)gQdO'#F`QOQ`OOP)qO&jO'#CaPOOO)C@t)C@tOOQP'#Cj'#CjOOQP,59S,59SO#}QdO,59SO)|QdO,59VO%TQdO,5:[O%YQdO,5:^O%_QdO,5:aO%_QdO,5:cO%_QdO,5:dO%_QdO'#ErO*XQ`O,58}O*aQdO'#DzOOQS,58},58}OOQP'#Cn'#CnOOQO'#Dn'#DnOOQP,59V,59VO*hQ`O,59VO*mQ`O,59VOOQP'#Dq'#DqOOQP,5:[,5:[OOQO'#Ds'#DsO*rQpO,5:^O+]QaO,5:aO+sQaO,5:dOOQW'#DZ'#DZO,ZQhO'#DdO,xQhO'#FaO'tQhO'#DbO-WQ`O'#DhOOQW'#F['#F[O-]Q`O,5;SO-eQ`O'#DeOOQS-E8i-E8iOOQ['#Cs'#CsO-jQdO'#CtO.QQdO'#CzO.hQdO'#C}O/OQ!pO'#DPO1RQ!jO,5:jOOQO'#DU'#DUO*mQ`O'#DTO1cQ!nO'#FXO3`Q`O'#DVO3eQ`O'#DkOOQ['#FX'#FXO-`Q`O,5:pO3jQ!bO,5:rOOQS'#E['#E[O3rQ`O,5:tO3wQdO,5:tOOQO'#E_'#E_O4PQ`O,5:wO4UQhO,5:}O%_QdO'#DgOOQS,5;P,5;PO-eQ`O,5;PO4^QdO,5;PO4fQdO,5:gO4vQdO'#EtO5TQ`O,5;zO5TQ`O,5;zPOOO'#Ej'#EjP5`O&jO,58{POOO,58{,58{OOQP1G.n1G.nOOQP1G.q1G.qO*hQ`O1G.qO*mQ`O1G.qOOQP1G/v1G/vO5kQpO1G/xO5sQaO1G/{O6ZQaO1G/}O6qQaO1G0OO7XQaO,5;^OOQO-E8p-E8pOOQS1G.i1G.iO7cQ`O,5:fO7hQdO'#DoO7oQdO'#CrOOQP1G/x1G/xO&lQdO1G/xO7vQ!jO'#DZO8UQ!bO,59vO8^QhO,5:OOOQO'#F]'#F]O8XQ!bO,59zO'tQhO,59xO8fQhO'#EvO8sQ`O,5;{O9OQhO,59|O9uQhO'#DiOOQW,5:S,5:SOOQS1G0n1G0nOOQW,5:P,5:PO9|Q!fO'#FYOOQS'#FY'#FYOOQS'#Em'#EmO;^QdO,59`OOQ[,59`,59`O;tQdO,59fOOQ[,59f,59fO<[QdO,59iOOQ[,59i,59iOOQ[,59k,59kO&lQdO,59mOPQ!fO1G0ROOQO1G0R1G0ROOQO,5;`,5;`O>gQdO,5;`OOQO-E8r-E8rO>tQ`O1G1fPOOO-E8h-E8hPOOO1G.g1G.gOOQP7+$]7+$]OOQP7+%d7+%dO&lQdO7+%dOOQS1G0Q1G0QO?PQaO'#F_O?ZQ`O,5:ZO?`Q!fO'#ElO@^QdO'#FWO@hQ`O,59^O@mQ!bO7+%dO&lQdO1G/bO@uQhO1G/fOOQW1G/j1G/jOOQW1G/d1G/dOAWQhO,5;bOOQO-E8t-E8tOAfQhO'#DZOAtQhO'#F^OBPQ`O'#F^OBUQ`O,5:TOOQS-E8k-E8kOOQ[1G.z1G.zOOQ[1G/Q1G/QOOQ[1G/T1G/TOOQ[1G/X1G/XOBZQdO,5:lOOQS7+%p7+%pOB`Q`O7+%pOBeQhO'#DYOBmQ`O,59sO'tQhO,59sOOQ[1G/q1G/qOBuQ`O1G/qOOQS7+%z7+%zOBzQbO'#DPOOQO'#Eb'#EbOCYQ`O'#EaOOQO'#Ea'#EaOCeQ`O'#EwOCmQdO,5:zOOQS,5:z,5:zOOQ[1G/m1G/mOOQS7+&V7+&VO-`Q`O7+&VOCxQ!fO'#EsO&lQdO'#EsOEPQdO7+%mOOQO7+%m7+%mOOQO1G0z1G0zOEdQ!bO<jAN>jOIUQaO,5;]OOQO-E8o-E8oOI`QdO,5;[OOQO-E8n-E8nOOQW<WO&lQdO1G0uOK]Q`O7+'OOOQO,5;a,5;aOOQO-E8s-E8sOOQW<t}!O?V!O!P?t!P!Q@]!Q![AU![!]BP!]!^B{!^!_C^!_!`DY!`!aDm!a!b$q!b!cEn!c!}$q!}#OG{#O#P$q#P#QH^#Q#R6W#R#o$q#o#pHo#p#q6W#q#rIQ#r#sIc#s#y$q#y#z%i#z$f$q$f$g%i$g#BY$q#BY#BZ%i#BZ$IS$q$IS$I_%i$I_$I|$q$I|$JO%i$JO$JT$q$JT$JU%i$JU$KV$q$KV$KW%i$KW&FU$q&FU&FV%i&FV;'S$q;'S;=`Iz<%lO$q`$tSOy%Qz;'S%Q;'S;=`%c<%lO%Q`%VS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q`%fP;=`<%l%Q~%nh#s~OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Q~'ah#s~!a`OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Qj)OUOy%Qz#]%Q#]#^)b#^;'S%Q;'S;=`%c<%lO%Qj)gU!a`Oy%Qz#a%Q#a#b)y#b;'S%Q;'S;=`%c<%lO%Qj*OU!a`Oy%Qz#d%Q#d#e*b#e;'S%Q;'S;=`%c<%lO%Qj*gU!a`Oy%Qz#c%Q#c#d*y#d;'S%Q;'S;=`%c<%lO%Qj+OU!a`Oy%Qz#f%Q#f#g+b#g;'S%Q;'S;=`%c<%lO%Qj+gU!a`Oy%Qz#h%Q#h#i+y#i;'S%Q;'S;=`%c<%lO%Qj,OU!a`Oy%Qz#T%Q#T#U,b#U;'S%Q;'S;=`%c<%lO%Qj,gU!a`Oy%Qz#b%Q#b#c,y#c;'S%Q;'S;=`%c<%lO%Qj-OU!a`Oy%Qz#h%Q#h#i-b#i;'S%Q;'S;=`%c<%lO%Qj-iS!qY!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q~-xWOY-uZr-urs.bs#O-u#O#P.g#P;'S-u;'S;=`/c<%lO-u~.gOt~~.jRO;'S-u;'S;=`.s;=`O-u~.vXOY-uZr-urs.bs#O-u#O#P.g#P;'S-u;'S;=`/c;=`<%l-u<%lO-u~/fP;=`<%l-uj/nYjYOy%Qz!Q%Q!Q![0^![!c%Q!c!i0^!i#T%Q#T#Z0^#Z;'S%Q;'S;=`%c<%lO%Qj0cY!a`Oy%Qz!Q%Q!Q![1R![!c%Q!c!i1R!i#T%Q#T#Z1R#Z;'S%Q;'S;=`%c<%lO%Qj1WY!a`Oy%Qz!Q%Q!Q![1v![!c%Q!c!i1v!i#T%Q#T#Z1v#Z;'S%Q;'S;=`%c<%lO%Qj1}YrY!a`Oy%Qz!Q%Q!Q![2m![!c%Q!c!i2m!i#T%Q#T#Z2m#Z;'S%Q;'S;=`%c<%lO%Qj2tYrY!a`Oy%Qz!Q%Q!Q![3d![!c%Q!c!i3d!i#T%Q#T#Z3d#Z;'S%Q;'S;=`%c<%lO%Qj3iY!a`Oy%Qz!Q%Q!Q![4X![!c%Q!c!i4X!i#T%Q#T#Z4X#Z;'S%Q;'S;=`%c<%lO%Qj4`YrY!a`Oy%Qz!Q%Q!Q![5O![!c%Q!c!i5O!i#T%Q#T#Z5O#Z;'S%Q;'S;=`%c<%lO%Qj5TY!a`Oy%Qz!Q%Q!Q![5s![!c%Q!c!i5s!i#T%Q#T#Z5s#Z;'S%Q;'S;=`%c<%lO%Qj5zSrY!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Qd6ZUOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Qd6tS!hS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Qb7VSZQOy%Qz;'S%Q;'S;=`%c<%lO%Q~7fWOY7cZw7cwx.bx#O7c#O#P8O#P;'S7c;'S;=`8z<%lO7c~8RRO;'S7c;'S;=`8[;=`O7c~8_XOY7cZw7cwx.bx#O7c#O#P8O#P;'S7c;'S;=`8z;=`<%l7c<%lO7c~8}P;=`<%l7cj9VSeYOy%Qz;'S%Q;'S;=`%c<%lO%Q~9hOd~n9oUWQvWOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Qj:YWvW!mQOy%Qz!O%Q!O!P:r!P!Q%Q!Q![=w![;'S%Q;'S;=`%c<%lO%Qj:wU!a`Oy%Qz!Q%Q!Q![;Z![;'S%Q;'S;=`%c<%lO%Qj;bY!a`#}YOy%Qz!Q%Q!Q![;Z![!g%Q!g!hO[!a`#}YOy%Qz!O%Q!O!P;Z!P!Q%Q!Q![=w![!g%Q!g!hyS!^YOy%Qz;'S%Q;'S;=`%c<%lO%Qj?[WvWOy%Qz!O%Q!O!P:r!P!Q%Q!Q![=w![;'S%Q;'S;=`%c<%lO%Qj?yU]YOy%Qz!Q%Q!Q![;Z![;'S%Q;'S;=`%c<%lO%Q~@bTvWOy%Qz{@q{;'S%Q;'S;=`%c<%lO%Q~@xS!a`#t~Oy%Qz;'S%Q;'S;=`%c<%lO%QjAZ[#}YOy%Qz!O%Q!O!P;Z!P!Q%Q!Q![=w![!g%Q!g!hOa[e]||-1},{term:125,get:e=>na[e]||-1},{term:4,get:e=>oa[e]||-1},{term:25,get:e=>sa[e]||-1},{term:123,get:e=>ia[e]||-1}],tokenPrec:1963});let C=null;function R(){if(!C&&typeof document=="object"&&document.body){let{style:e}=document.body,l=[],r=new Set;for(let a in e)a!="cssText"&&a!="cssFloat"&&typeof e[a]=="string"&&(/[A-Z]/.test(a)&&(a=a.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())),r.has(a)||(l.push(a),r.add(a)));C=l.sort().map(a=>({type:"property",label:a,apply:a+": "}))}return C||[]}const Oe=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(e=>({type:"class",label:e})),ne=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(e=>({type:"keyword",label:e})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(e=>({type:"constant",label:e}))),ca=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(e=>({type:"type",label:e})),ua=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(e=>({type:"keyword",label:e})),b=/^(\w[\w-]*|-\w[\w-]*|)$/,pa=/^-(-[\w-]*)?$/;function Qa(e,l){var r;if((e.name=="("||e.type.isError)&&(e=e.parent||e),e.name!="ArgList")return!1;let a=(r=e.parent)===null||r===void 0?void 0:r.firstChild;return a?.name!="Callee"?!1:l.sliceString(a.from,a.to)=="var"}const oe=new Ue,ma=["Declaration"];function Sa(e){for(let l=e;;){if(l.type.isTop)return l;if(!(l=l.parent))return e}}function qe(e,l,r){if(l.to-l.from>4096){let a=oe.get(l);if(a)return a;let t=[],O=new Set,n=l.cursor(De.IncludeAnonymous);if(n.firstChild())do for(let s of qe(e,n.node,r))O.has(s.label)||(O.add(s.label),t.push(s));while(n.nextSibling());return oe.set(l,t),t}else{let a=[],t=new Set;return l.cursor().iterate(O=>{var n;if(r(O)&&O.matchContext(ma)&&((n=O.node.nextSibling)===null||n===void 0?void 0:n.name)==":"){let s=e.sliceString(O.from,O.to);t.has(s)||(t.add(s),a.push({label:s,type:"variable"}))}}),a}}const fa=e=>l=>{let{state:r,pos:a}=l,t=W(r).resolveInner(a,-1),O=t.type.isError&&t.from==t.to-1&&r.doc.sliceString(t.from,t.to)=="-";if(t.name=="PropertyName"||(O||t.name=="TagName")&&/^(Block|Styles)$/.test(t.resolve(t.to).name))return{from:t.from,options:R(),validFor:b};if(t.name=="ValueName")return{from:t.from,options:ne,validFor:b};if(t.name=="PseudoClassName")return{from:t.from,options:Oe,validFor:b};if(e(t)||(l.explicit||O)&&Qa(t,r.doc))return{from:e(t)||O?t.from:a,options:qe(r.doc,Sa(t),e),validFor:pa};if(t.name=="TagName"){for(let{parent:d}=t;d;d=d.parent)if(d.name=="Block")return{from:t.from,options:R(),validFor:b};return{from:t.from,options:ca,validFor:b}}if(t.name=="AtKeyword")return{from:t.from,options:ua,validFor:b};if(!l.explicit)return null;let n=t.resolve(a),s=n.childBefore(a);return s&&s.name==":"&&n.name=="PseudoClassSelector"?{from:a,options:Oe,validFor:b}:s&&s.name==":"&&n.name=="Declaration"||n.name=="ArgList"?{from:a,options:ne,validFor:b}:n.name=="Block"||n.name=="Styles"?{from:a,options:R(),validFor:b}:null},ga=fa(e=>e.name=="VariableName"),Y=pe.define({name:"css",parser:da.configure({props:[Qe.add({Declaration:Be()}),me.add({"Block KeyframeList":Ne})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function ha(){return new Se(Y,Y.data.of({autocomplete:ga}))}const x=["_blank","_self","_top","_parent"],E=["ascii","utf-8","utf-16","latin1","latin1"],j=["get","post","put","delete"],G=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],f=["true","false"],o={},ba={a:{attrs:{href:null,ping:null,type:null,media:null,target:x,hreflang:null}},abbr:o,address:o,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:o,aside:o,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:o,base:{attrs:{href:null,target:x}},bdi:o,bdo:o,blockquote:{attrs:{cite:null}},body:o,br:o,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:G,formmethod:j,formnovalidate:["novalidate"],formtarget:x,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:o,center:o,cite:o,code:o,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:o,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:o,div:o,dl:o,dt:o,em:o,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:o,figure:o,footer:o,form:{attrs:{action:null,name:null,"accept-charset":E,autocomplete:["on","off"],enctype:G,method:j,novalidate:["novalidate"],target:x}},h1:o,h2:o,h3:o,h4:o,h5:o,h6:o,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:o,hgroup:o,hr:o,html:{attrs:{manifest:null}},i:o,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:G,formmethod:j,formnovalidate:["novalidate"],formtarget:x,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:o,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:o,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:o,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:E,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:o,noscript:o,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:o,param:{attrs:{name:null,value:null}},pre:o,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:o,rt:o,ruby:o,samp:o,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:E}},section:o,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:o,source:{attrs:{src:null,type:null,media:null}},span:o,strong:o,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:o,summary:o,sup:o,table:o,tbody:o,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:o,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:o,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:o,time:{attrs:{datetime:null}},title:o,tr:o,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:o,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:o},Ye={accesskey:null,class:null,contenteditable:f,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:f,autocorrect:f,autocapitalize:f,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":f,"aria-autocomplete":["inline","list","both","none"],"aria-busy":f,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":f,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":f,"aria-hidden":f,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":f,"aria-multiselectable":f,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":f,"aria-relevant":null,"aria-required":f,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},ze="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of ze)Ye[e]=null;class w{constructor(l,r){this.tags={...ba,...l},this.globalAttrs={...Ye,...r},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}w.default=new w;function $(e,l,r=e.length){if(!l)return"";let a=l.firstChild,t=a&&a.getChild("TagName");return t?e.sliceString(t.from,Math.min(t.to,r)):""}function X(e,l=!1){for(;e;e=e.parent)if(e.name=="Element")if(l)l=!1;else return e;return null}function _e(e,l,r){let a=r.tags[$(e,X(l))];return a?.children||r.allTags}function M(e,l){let r=[];for(let a=X(l);a&&!a.type.isTop;a=X(a.parent)){let t=$(e,a);if(t&&a.lastChild.name=="CloseTag")break;t&&r.indexOf(t)<0&&(l.name=="EndTag"||l.from>=a.firstChild.to)&&r.push(t)}return r}const Ce=/^[:\-\.\w\u00b7-\uffff]*$/;function se(e,l,r,a,t){let O=/\s*>/.test(e.sliceDoc(t,t+5))?"":">",n=X(r,r.name=="StartTag"||r.name=="TagName");return{from:a,to:t,options:_e(e.doc,n,l).map(s=>({label:s,type:"type"})).concat(M(e.doc,r).map((s,d)=>({label:"/"+s,apply:"/"+s+O,type:"type",boost:99-d}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function ie(e,l,r,a){let t=/\s*>/.test(e.sliceDoc(a,a+5))?"":">";return{from:r,to:a,options:M(e.doc,l).map((O,n)=>({label:O,apply:O+t,type:"type",boost:99-n})),validFor:Ce}}function Pa(e,l,r,a){let t=[],O=0;for(let n of _e(e.doc,r,l))t.push({label:"<"+n,type:"type"});for(let n of M(e.doc,r))t.push({label:"",type:"type",boost:99-O++});return{from:a,to:a,options:t,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function ya(e,l,r,a,t){let O=X(r),n=O?l.tags[$(e.doc,O)]:null,s=n&&n.attrs?Object.keys(n.attrs):[],d=n&&n.globalAttrs===!1?s:s.length?s.concat(l.globalAttrNames):l.globalAttrNames;return{from:a,to:t,options:d.map(S=>({label:S,type:"property"})),validFor:Ce}}function $a(e,l,r,a,t){var O;let n=(O=r.parent)===null||O===void 0?void 0:O.getChild("AttributeName"),s=[],d;if(n){let S=e.sliceDoc(n.from,n.to),Q=l.globalAttrs[S];if(!Q){let u=X(r),m=u?l.tags[$(e.doc,u)]:null;Q=m?.attrs&&m.attrs[S]}if(Q){let u=e.sliceDoc(a,t).toLowerCase(),m='"',c='"';/^['"]/.test(u)?(d=u[0]=='"'?/^[^"]*$/:/^[^']*$/,m="",c=e.sliceDoc(t,t+1)==u[0]?"":u[0],u=u.slice(1),a++):d=/^[^\s<>='"]*$/;for(let p of Q)s.push({label:p,apply:m+p+c,type:"constant"})}}return{from:a,to:t,options:s,validFor:d}}function Re(e,l){let{state:r,pos:a}=l,t=W(r).resolveInner(a,-1),O=t.resolve(a);for(let n=a,s;O==t&&(s=t.childBefore(n));){let d=s.lastChild;if(!d||!d.type.isError||d.fromRe(a,t)}const xa=B.parser.configure({top:"SingleExpression"}),Ee=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:Le.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:Ke.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:Je.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:xa},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:B.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:Y.parser}],je=[{name:"style",parser:Y.parser.configure({top:"Styles"})}].concat(ze.map(e=>({name:e,parser:B.parser}))),Ge=pe.define({name:"html",parser:Et.configure({props:[Qe.add({Element(e){let l=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+l[0].length?e.continue():e.lineIndent(e.node.from)+(l[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].lengthe.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),V=Ge.configure({wrap:ve(Ee,je)});function Ya(e={}){let l="",r;e.matchClosingTags===!1&&(l="noMatch"),e.selfClosingTags===!0&&(l=(l?l+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(r=ve((e.nestedLanguages||[]).concat(Ee),(e.nestedAttributes||[]).concat(je)));let a=r?Ge.configure({wrap:r,dialect:l}):l?V.configure({dialect:l}):V;return new Se(a,[V.data.of({autocomplete:Xa(e)}),e.autoCloseTags!==!1?va:[],He().support,ha().support])}const de=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),va=Me.inputHandler.of((e,l,r,a,t)=>{if(e.composing||e.state.readOnly||l!=r||a!=">"&&a!="/"||!V.isActiveAt(e.state,l,-1))return!1;let O=t(),{state:n}=O,s=n.changeByRange(d=>{var S,Q,u;let m=n.doc.sliceString(d.from-1,d.to)==a,{head:c}=d,p=W(n).resolveInner(c,-1),g;if(m&&a==">"&&p.name=="EndTag"){let h=p.parent;if(((Q=(S=h.parent)===null||S===void 0?void 0:S.lastChild)===null||Q===void 0?void 0:Q.name)!="CloseTag"&&(g=$(n.doc,h.parent,c))&&!de.has(g)){let y=c+(n.doc.sliceString(c,c+1)===">"?1:0),T=``;return{range:d,changes:{from:c,to:y,insert:T}}}}else if(m&&a=="/"&&p.name=="IncompleteCloseTag"){let h=p.parent;if(p.from==c-2&&((u=h.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(g=$(n.doc,h,c))&&!de.has(g)){let y=c+(n.doc.sliceString(c,c+1)===">"?1:0),T=`${g}>`;return{range:Fe.cursor(c+T.length,-1),changes:{from:c,to:y,insert:T}}}}return{range:d}});return s.changes.empty?!1:(e.dispatch([O,n.update(s,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});export{va as autoCloseTags,Ya as html,qa as htmlCompletionSource,Xa as htmlCompletionSourceWith,V as htmlLanguage}; diff --git a/apps/studio/dist/static/index-BgOink5e.js b/apps/studio/dist/static/index-BgOink5e.js new file mode 100644 index 00000000..0064f3c7 --- /dev/null +++ b/apps/studio/dist/static/index-BgOink5e.js @@ -0,0 +1 @@ +import{L as V,E as X}from"./index-9VbysdZK.js";import{r as d,t as $,L as Z,u as R,v as s,w as t,x as c,y,z as U,A as l}from"./index-DznCqw2V.js";import{html as w}from"./index-BFSXaxBx.js";import"./sanity-BZuh2pfi.js";import"./index-ByKwSaqq.js";const W=1,p=2,q=275,u=3,b=276,_=277,f=278,m=4,k=5,G=6,x=7,n=8,h=9,v=10,g=11,j=12,E=13,I=14,N=15,L=16,F=17,C=18,H=19,A=20,K=21,D=22,B=23,M=24,J=25,OO=26,$O=27,QO=28,iO=29,aO=30,TO=31,PO=32,XO=33,SO=34,cO=35,eO=36,oO=37,_O=38,nO=39,zO=40,rO=41,YO=42,VO=43,dO=44,ZO=45,RO=46,sO=47,tO=48,yO=49,UO=50,lO=51,wO=52,WO=53,pO=54,qO=55,uO=56,bO=57,fO=58,mO=59,kO=60,GO=61,xO=62,e=63,hO=64,vO=65,gO=66,jO={abstract:m,and:k,array:G,as:x,true:n,false:n,break:h,case:v,catch:g,clone:j,const:E,continue:I,declare:L,default:N,do:F,echo:C,else:H,elseif:A,enddeclare:K,endfor:D,endforeach:B,endif:M,endswitch:J,endwhile:OO,enum:$O,extends:QO,final:iO,finally:aO,fn:TO,for:PO,foreach:XO,from:SO,function:cO,global:eO,goto:oO,if:_O,implements:nO,include:zO,include_once:rO,instanceof:YO,insteadof:VO,interface:dO,list:ZO,match:RO,namespace:sO,new:tO,null:yO,or:UO,print:lO,readonly:wO,require:WO,require_once:pO,return:qO,switch:uO,throw:bO,trait:fO,try:mO,unset:kO,use:GO,var:xO,public:e,private:e,protected:e,while:hO,xor:vO,yield:gO,__proto__:null};function z(O){let Q=jO[O.toLowerCase()];return Q??-1}function r(O){return O==9||O==10||O==13||O==32}function Y(O){return O>=97&&O<=122||O>=65&&O<=90}function T(O){return O==95||O>=128||Y(O)}function o(O){return O>=48&&O<=55||O>=97&&O<=102||O>=65&&O<=70}const EO={int:!0,integer:!0,bool:!0,boolean:!0,float:!0,double:!0,real:!0,string:!0,array:!0,object:!0,unset:!0,__proto__:null},IO=new X(O=>{if(O.next==40){O.advance();let Q=0;for(;r(O.peek(Q));)Q++;let i="",a;for(;Y(a=O.peek(Q));)i+=String.fromCharCode(a),Q++;for(;r(O.peek(Q));)Q++;O.peek(Q)==41&&EO[i.toLowerCase()]&&O.acceptToken(W)}else if(O.next==60&&O.peek(1)==60&&O.peek(2)==60){for(let a=0;a<3;a++)O.advance();for(;O.next==32||O.next==9;)O.advance();let Q=O.next==39;if(Q&&O.advance(),!T(O.next))return;let i=String.fromCharCode(O.next);for(;O.advance(),!(!T(O.next)&&!(O.next>=48&&O.next<=55));)i+=String.fromCharCode(O.next);if(Q){if(O.next!=39)return;O.advance()}if(O.next!=10&&O.next!=13)return;for(;;){let a=O.next==10||O.next==13;if(O.advance(),O.next<0)return;if(a){for(;O.next==32||O.next==9;)O.advance();let P=!0;for(let S=0;S{O.next<0&&O.acceptToken(f)}),LO=new X((O,Q)=>{O.next==63&&Q.canShift(_)&&O.peek(1)==62&&O.acceptToken(_)});function FO(O){let Q=O.peek(1);if(Q==110||Q==114||Q==116||Q==118||Q==101||Q==102||Q==92||Q==36||Q==34||Q==123)return 2;if(Q>=48&&Q<=55){let i=2,a;for(;i<5&&(a=O.peek(i))>=48&&a<=55;)i++;return i}if(Q==120&&o(O.peek(2)))return o(O.peek(3))?4:3;if(Q==117&&O.peek(2)==123)for(let i=3;;i++){let a=O.peek(i);if(a==125)return i==2?0:i+1;if(!o(a))break}return 0}const CO=new X((O,Q)=>{let i=!1;for(;!(O.next==34||O.next<0||O.next==36&&(T(O.peek(1))||O.peek(1)==123)||O.next==123&&O.peek(1)==36);i=!0){if(O.next==92){let a=FO(O);if(a){if(i)break;return O.acceptToken(u,a)}}else if(!i&&(O.next==91||O.next==45&&O.peek(1)==62&&T(O.peek(2))||O.next==63&&O.peek(1)==45&&O.peek(2)==62&&T(O.peek(3)))&&Q.canShift(b))break;O.advance()}i&&O.acceptToken(q)}),HO=d({"Visibility abstract final static":$.modifier,"for foreach while do if else elseif switch try catch finally return throw break continue default case":$.controlKeyword,"endif endfor endforeach endswitch endwhile declare enddeclare goto match":$.controlKeyword,"and or xor yield unset clone instanceof insteadof":$.operatorKeyword,"function fn class trait implements extends const enum global interface use var":$.definitionKeyword,"include include_once require require_once namespace":$.moduleKeyword,"new from echo print array list as":$.keyword,null:$.null,Boolean:$.bool,VariableName:$.variableName,"NamespaceName/...":$.namespace,"NamedType/...":$.typeName,Name:$.name,"CallExpression/Name":$.function($.variableName),"LabelStatement/Name":$.labelName,"MemberExpression/Name":$.propertyName,"MemberExpression/VariableName":$.special($.propertyName),"ScopedExpression/ClassMemberName/Name":$.propertyName,"ScopedExpression/ClassMemberName/VariableName":$.special($.propertyName),"CallExpression/MemberExpression/Name":$.function($.propertyName),"CallExpression/ScopedExpression/ClassMemberName/Name":$.function($.propertyName),"MethodDeclaration/Name":$.function($.definition($.variableName)),"FunctionDefinition/Name":$.function($.definition($.variableName)),"ClassDeclaration/Name":$.definition($.className),UpdateOp:$.updateOperator,ArithOp:$.arithmeticOperator,"LogicOp IntersectionType/&":$.logicOperator,BitOp:$.bitwiseOperator,CompareOp:$.compareOperator,ControlOp:$.controlOperator,AssignOp:$.definitionOperator,"$ ConcatOp":$.operator,LineComment:$.lineComment,BlockComment:$.blockComment,Integer:$.integer,Float:$.float,String:$.string,ShellExpression:$.special($.string),"=> ->":$.punctuation,"( )":$.paren,"#[ [ ]":$.squareBracket,"${ { }":$.brace,"-> ?->":$.derefOperator,", ; :: : \\":$.separator,"PhpOpen PhpClose":$.processingInstruction}),AO={__proto__:null,static:325,STATIC:325,class:351,CLASS:351},KO=V.deserialize({version:14,states:"%#[Q`OWOOQhQaOOP%oO`OOOOO#t'#Hh'#HhO%tO#|O'#DuOOO#u'#Dx'#DxQ&SOWO'#DxO&XO$VOOOOQ#u'#Dy'#DyO&lQaO'#D}O'[QdO'#EQO+QQdO'#IqO+_QdO'#ERO-RQaO'#EXO/bQ`O'#EUO/gQ`O'#E_O2UQaO'#E_O2]Q`O'#EgO2bQ`O'#EqO-RQaO'#EqO2mQpO'#FOO2rQ`O'#FOOOQS'#Iq'#IqO2wQ`O'#ExOOQS'#Ih'#IhO5SQdO'#IeO9UQeO'#F]O-RQaO'#FlO-RQaO'#FmO-RQaO'#FnO-RQaO'#FoO-RQaO'#FoO-RQaO'#FrOOQO'#Ir'#IrO9cQ`O'#FxOOQO'#Ht'#HtO9kQ`O'#HXO:VQ`O'#FsO:bQ`O'#HfO:mQ`O'#GPO:uQaO'#GQO-RQaO'#G`O-RQaO'#GcO;bOrO'#GfOOQS'#JP'#JPOOQS'#JO'#JOOOQS'#Ie'#IeO/bQ`O'#GmO/bQ`O'#GoO/bQ`O'#GtOhQaO'#GvO;iQ`O'#GwO;nQ`O'#GzO:]Q`O'#G}O;sQeO'#HOO;sQeO'#HPO;sQeO'#HQO;}Q`O'#HROhQ`O'#HVO:]Q`O'#HWO>mQ`O'#HWO;}Q`O'#HXO:]Q`O'#HZO:]Q`O'#H[O:]Q`O'#H]O>rQ`O'#H`O>}Q`O'#HaOQO!$dQ`O,5POOQ#u-E;h-E;hO!1QQ`O,5=tOOO#u,5:_,5:_O!1]O#|O,5:_OOO#u-E;g-E;gOOOO,5>|,5>|OOQ#y1G0T1G0TO!1eQ`O1G0YO-RQaO1G0YO!2wQ`O1G0qOOQS1G0q1G0qOOQS'#Eo'#EoOOQS'#Il'#IlO-RQaO'#IlOOQS1G0r1G0rO!4ZQ`O'#IoO!5pQ`O'#IqO!5}QaO'#EwOOQO'#Io'#IoO!6XQ`O'#InO!6aQ`O,5;aO-RQaO'#FXOOQS'#FW'#FWOOQS1G1[1G1[O!6fQdO1G1dO!8kQdO1G1dO!:WQdO1G1dO!;sQdO1G1dO!=`QdO1G1dO!>{QdO1G1dO!@hQdO1G1dO!BTQdO1G1dO!CpQdO1G1dO!E]QdO1G1dO!FxQdO1G1dO!HeQdO1G1dO!JQQdO1G1dO!KmQdO1G1dO!MYQdO1G1dO!NuQdO1G1dOOQT1G0_1G0_O!#[Q`O,5<_O#!bQaO'#EYOOQS1G0[1G0[O#!iQ`O,5:zOEdQaO,5:zO#!nQaO,5;OO#!uQdO,5:|O#$tQdO,5?UO#&sQaO'#HmO#'TQ`O,5?TOOQS1G0e1G0eO#']Q`O1G0eO#'bQ`O'#IkO#(zQ`O'#IkO#)SQ`O,5;SOG|QaO,5;SOOQS1G0w1G0wOOQO,5>^,5>^OOQO-E;p-E;pOOQS1G1U1G1UO#)pQdO'#FQO#+uQ`O'#HsOJ}QpO1G1UO2wQ`O'#HpO#+zQtO,5;eO2wQ`O'#HqO#,iQtO,5;gO#-WQaO1G1OOOQS,5;h,5;hO#/gQtO'#FQO#/tQdO1G0dO-RQaO1G0dO#1aQdO1G1aO#2|QdO1G1cOOQO,5X,5>XOOQO-E;k-E;kOOQS7+&P7+&PO!+iQaO,5;TO$$^QaO'#HnO$$hQ`O,5?VOOQS1G0n1G0nO$$pQ`O1G0nPOQO'#FQ'#FQOOQO,5>_,5>_OOQO-E;q-E;qOOQS7+&p7+&pOOQS,5>[,5>[OOQS-E;n-E;nO$$uQtO,5>]OOQS-E;o-E;oO$%dQdO7+&jO$'iQtO'#FQO$'vQdO7+&OOOQS1G0j1G0jOOQO,5>a,5>aOOQO-E;s-E;sOOQ#u7+(x7+(xO!$[QdO7+(xOOQ#u7+(}7+(}O#JfQ`O7+(}O#JkQ`O7+(}OOQ#u7+(z7+(zO!.]Q`O7+(zO!1TQ`O7+(zO!1QQ`O7+(zO$)cQ`O,5i,5>iOOQS-E;{-E;{O$.lQdO7+'qO$.|QpO7+'qO$/XQdO'#IxOOQO,5pOOQ#u,5>p,5>pOOQ#u-EoOOQS-EVQdO1G2^OOQS,5>h,5>hOOQS-E;z-E;zOOQ#u7+({7+({O$?oQ`O'#GXO:]Q`O'#H_OOQO'#IV'#IVO$@fQ`O,5=xOOQ#u,5=x,5=xO$AcQ!bO'#EQO$AzQ!bO7+(}O$BYQpO7+)RO#KRQpO7+)RO$BbQ`O'#HbO!$[QdO7+)RO$BpQdO,5>rOOQS-EVOOQS-E;i-E;iO$D{QdO<Z,5>ZOOQO-E;m-E;mOOQS1G1_1G1_O$8rQaO,5:uO$G}QaO'#HlO$H[Q`O,5?QOOQS1G0`1G0`OOQS7+&Q7+&QO$HdQ`O7+&UO$IyQ`O1G0oO$K`Q`O,5>YOOQO,5>Y,5>YOOQO-E;l-E;lOOQS7+&Y7+&YOOQS7+&U7+&UOOQ#u<c,5>cOOQO-E;u-E;uOOQS<lOOQ#u-EmOOQO-EW,5>WOOQO-E;j-E;jO!+iQaO,5;UOOQ#uANBTANBTO#JfQ`OANBTOOQ#uANBQANBQO!.]Q`OANBQO!+iQaO7+'hOOQO7+'l7+'lO%-bQ`O7+'hO%.wQ`O7+'hO%/SQ`O7+'lO!+iQaO7+'mOOQO7+'m7+'mO%/XQdO'#F}OOQO'#Hv'#HvO%/jQ`O,5e,5>eOOQS-E;w-E;wOOQO1G2_1G2_O$1YQdO1G2_O$/jQpO1G2_O#JkQ`O1G2]O!.mQdO1G2aO%$dQ!bO1G2]O!$[QdO1G2]OOQO1G2a1G2aOOQO1G2]1G2]O%2uQaO'#G]OOQO1G2b1G2bOOQSAN@xAN@xO!.]Q`OAN@xOOOQ<]O%6rQ!bO'#FQO!$[QdOANBXOOQ#uANBXANBXO:]Q`O,5=}O%7WQ`O,5=}O%7cQ`O'#IXO%7wQ`O,5?rOOQS1G3h1G3hOOQS7+)x7+)xP%+OQpOANBXO%8PQ`O1G0pOOQ#uG27oG27oOOQ#uG27lG27lO%9fQ`O<d,5>dO%dOOQO-E;v-E;vO%hQ`O'#IqO%>rQ`O'#IhO!$[QdO'#IOO%@lQaO,5s,5>sOOQO-Ej,5>jOOQP-E;|-E;|OOQO1G2c1G2cOOQ#uLD,kLD,kOOQTG27[G27[O!$[QdOLD-RO!$[QdO<OO%EpQ`O,5>OPOQ#uLD-_LD-_OOQO7+'o7+'oO+_QdO7+'oOOQS!$( ]!$( ]OOQOAN@}AN@}OOQS1G2d1G2dOOQS1G2e1G2eO%E{QdO1G2eOOQ#u!$(!m!$(!mOOQOANBVANBVOOQO1G3j1G3jO:]Q`O1G3jOOQO<tQaO,5:xO'/vQaO,5;uO'/vQaO,5;wO'@sQdO,5YQdO,5<^O)@XQdO,5QQ`O,5=eO*>YQaO'#HkO*>dQ`O,5?ROlQdO7+%tO*@kQ`O1G0jO!+iQaO1G0jO*BQQdO7+&OOoO*GeQ`O,5>VO*HzQdO<[QdO,5{QdO'#IjO.BbQ`O'#IeO.BoQ`O'#GPO.BwQaO,5:nO.COQ`O,5uOs#fOx7xOy7xO}aO!O^O!Q8OO!R}O!T7}O!V7yO!W7yO!Z8QO!d:QO!z]O#T#mO#V#lO#X`O#dhO#fbO#gcO#sdO$[7|O$d7{O$e7|O$hqO%T8PO%U!OO%W}O%X}O%`|O'WYO'u{O#Y']P~O#O#qO~P/lO!z#rO~O#d#tO#fbO#gcO~O'a#vO~O#s#zO~OU$OO!R$OO!w#}O#s3hO'W#{O~OT'XXz'XX!S'XX!c'XX!n'XX!w'XX!z'XX#T'XX#X'XX#a'XX#b'XX#y'XX$R'XX$S'XX$T'XX$U'XX$V'XX$X'XX$Y'XX$Z'XX$['XX$]'XX$^'XX$_'XX%T'XX'P'XX!y'XX!o'XX~O#|$QO$O$RO~P3YOP7wOQ|OU_OW}O[7zOo>uOs#fOx7xOy7xO}aO!O^O!Q8OO!R}O!T7}O!V7yO!W7yO!Z8QO!d:QO!z]O#X`O#dhO#fbO#gcO#sdO$[7|O$d7{O$e7|O$hqO%T8PO%U!OO%W}O%X}O%`|O'WYO'u{OT$PXz$PX!S$PX!c$PX!n$PX!w$PX#a$PX#b$PX#y$PX$R$PX$S$PX$T$PX$U$PX$V$PX$X$PX$Y$PX$Z$PX$]$PX$^$PX$_$PX'P$PX!y$PX!o$PX~Or$TO#T8eO#V8dO~P5^O#sdO'WYO~OS$fO]$aOk$dOm$fOs$`O!a$bO$krO$u$eO~O!z$hO#T$jO'W$gO~Oo$mOs$lO#d$nO~O!z$hO#T$rO~O!U$uO$u$tO~P-ROR${O!p$zO#d$yO#g$zO&}${O~O't$}O~P;PO!z%SO~O!z%UO~O!n#bO'P#bO~P-RO!pXO~O!z%`O~OP7wOQ|OU_OW}O[7zOo>uOs#fOx7xOy7xO}aO!O^O!Q8OO!R}O!T7}O!V7yO!W7yO!Z8QO!d:QO!z]O#X`O#dhO#fbO#gcO#sdO$[7|O$d7{O$e7|O$hqO%T8PO%U!OO%W}O%X}O%`|O'WYO'u{O~O!z%dO~O]$aO~O!pXO#sdO'WYO~O]%rOs%rO#s%nO'WYO~O!j%wO'Q%wO'TRO~O'Q%zO~PhO!o%{O~PhO!r%}O~PvO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y'cX#O'cX~P!%aO!r)yO!y'eX#O'eX~P)dO!y#kX#O#kX~P!+iO#O){O!y'bX~O!y)}O~O%T#cOT$Qiz$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$[$Qi$]$Qi$^$Qi$_$Qi'P$Qi!y$Qi#O$Qi#P$Qi#Y$Qi!o$Qi!r$QiV$Qi#|$Qi$O$Qi!p$Qi~P!%aOz#QO#T#PO$R#RO$S#VO$T#WO$U#XO$V#YO$X#[O$Y#]O$Z#^O$[#_O$]#`O$^#aO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi'P$Qi!y$Qi!o$Qi~P!%aOz#QO!w!yO#T#PO$R#RO$S#VO$T#WO$U#XO$V#YO$X#[O$Y#]O$Z#^O$[#_O$]#`O$^#aO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi'P$Qi!y$Qi!o$Qi~P!%aOT#SOz#QO!c#UO!w!yO#T#PO$R#RO$S#VO$T#WO$U#XO$V#YO$X#[O$Y#]O$Z#^O$[#_O$]#`O$^#aO$_#aO%T#cO!S$Qi!n$Qi'P$Qi!y$Qi!o$Qi~P!%aOT#SOz#QO!w!yO#T#PO$R#RO$S#VO$T#WO$U#XO$V#YO$X#[O$Y#]O$Z#^O$[#_O$]#`O$^#aO$_#aO%T#cO!S$Qi!c$Qi!n$Qi'P$Qi!y$Qi!o$Qi~P!%aOz#QO#T#PO$T#WO$U#XO$V#YO$X#[O$Y#]O$Z#^O$[#_O$]#`O$^#aO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi$R$Qi$S$Qi'P$Qi!y$Qi!o$Qi~P!%aOz#QO#T#PO$U#XO$V#YO$X#[O$Y#]O$Z#^O$[#_O$]#`O$^#aO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi$R$Qi$S$Qi$T$Qi'P$Qi!y$Qi!o$Qi~P!%aOz#QO#T#PO$V#YO$X#[O$Y#]O$Z#^O$[#_O$]#`O$^#aO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi$R$Qi$S$Qi$T$Qi$U$Qi'P$Qi!y$Qi!o$Qi~P!%aOz#QO#T#PO$X#[O$Y#]O$Z#^O$[#_O$]#`O$^#aO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi'P$Qi!y$Qi!o$Qi~P!%aOz#QO$X#[O$Y#]O$Z#^O$[#_O$]#`O$^#aO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi'P$Qi!y$Qi!o$Qi~P!%aOz#QO$Y#]O$Z#^O$[#_O$]#`O$^#aO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi'P$Qi!y$Qi!o$Qi~P!%aOz#QO$Z#^O$[#_O$]#`O$^#aO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi'P$Qi!y$Qi!o$Qi~P!%aOz#QO$[#_O$^#aO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$]$Qi'P$Qi!y$Qi!o$Qi~P!%aOz#QO$^#aO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$[$Qi$]$Qi'P$Qi!y$Qi!o$Qi~P!%aOz#QO$Z#^O$[#_O$^#aO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$]$Qi'P$Qi!y$Qi!o$Qi~P!%aOz#QO$_#aO%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$[$Qi$]$Qi$^$Qi'P$Qi!y$Qi!o$Qi~P!%aO_*PO~PxO$hqO$krO~P2wO#X+|O#a+{O#b+{O~O#d,OO%W,OO%^+}O'W$gO~O!o,PO~PCVOc%bXd%bXh%bXj%bXf%bXg%bXe%bX~PhOc,TOd,ROP%aiQ%aiS%aiU%aiW%aiX%ai[%ai]%ai^%ai`%aia%aib%aik%aim%aio%aip%aiq%ais%ait%aiu%aiv%aix%aiy%ai|%ai}%ai!O%ai!P%ai!Q%ai!R%ai!T%ai!V%ai!W%ai!X%ai!Y%ai!Z%ai![%ai!]%ai!^%ai!_%ai!a%ai!b%ai!d%ai!n%ai!p%ai!z%ai#X%ai#d%ai#f%ai#g%ai#s%ai$[%ai$d%ai$e%ai$h%ai$k%ai$u%ai%T%ai%U%ai%W%ai%X%ai%`%ai&|%ai'W%ai'u%ai'Q%ai!o%aih%aij%aif%aig%aiY%ai_%aii%aie%ai~Oc,XOd,UOh,WO~OY,YO_,ZO!o,^O~OY,YO_,ZOi%gX~Oi,`O~Oj,aO~O!n,cO~PxO$hqO$krO~P2wO!p)`O~OU$OO!R$OO!w3nO#s3iO'W,zO~O#s,|O~O!p-OO'a'UO~O#sdO'WYO!n&zX#O&zX'P&zX~O#O)gO!n'ya'P'ya~O#s-UO~O!n&_X#O&_X'P&_X#P&_X~PvO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y#ka#O#ka~P!%aO!y&cX#O&cX~P@aO#O){O!y'ba~O!o-_O~PCVO#P-`O~O#O-aO!o'YX~O!o-cO~O!y-dO~OT8TOz8RO!S8UO!c8VO!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO#O#Wi#Y#Wi~P!%aO!y&bX#O&bX~PxO#n'XO~OS+kO].cOm+kOs$`O!U+kO!`+kO!a+kO#d>xO$hqO$krO~P2wOS+kO].cOm+kOs$`O!U+kO!`+kO!a+kO#d>xO$hqO~P2wO!n#bO!p-yO'P#bO~OS+kO]+nOm+kOs$`O!U+kO!_+qO!`+kO!a+kO!o.mO#d>xO$hqO$krO~P2wO#d.rO%W.rO%^+}O'W$gO~O%W.sO~O#Y.tO~Oc%bad%bah%baj%baf%bag%bae%ba~PhOc.wOd,ROP%aqQ%aqS%aqU%aqW%aqX%aq[%aq]%aq^%aq`%aqa%aqb%aqk%aqm%aqo%aqp%aqq%aqs%aqt%aqu%aqv%aqx%aqy%aq|%aq}%aq!O%aq!P%aq!Q%aq!R%aq!T%aq!V%aq!W%aq!X%aq!Y%aq!Z%aq![%aq!]%aq!^%aq!_%aq!a%aq!b%aq!d%aq!n%aq!p%aq!z%aq#X%aq#d%aq#f%aq#g%aq#s%aq$[%aq$d%aq$e%aq$h%aq$k%aq$u%aq%T%aq%U%aq%W%aq%X%aq%`%aq&|%aq'W%aq'u%aq'Q%aq!o%aqh%aqj%aqf%aqg%aqY%aq_%aqi%aqe%aq~Oc.|Od,UOh.{O~O!r(hO~OP7wOQ|OU_OW}O[xO$hqO$krO~P2wOS+kOY,vO]+nOm+kOs$`O!U+kO!_+qO!`+kO!a+kO!o/fO#d>xO$hqO$krO~P2wOw!tX!p!tX#T!tX#n!tX#s#vX#|!tX'W!tX~Ow(ZO!p)`O#T3tO#n3sO~O!p-OO'a&fa~O]/nOs/nO#sdO'WYO~OV/rO!n&za#O&za'P&za~O#O)gO!n'yi'P'yi~O#s/tO~OT8TOz8RO!S8UO!c8VO!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO!n&_a#O&_a'P&_a#P&_a~P!%aOz#QO#T#PO$R#RO$S#VO$T#WO$U#XO$V#YO$X#[O$Y#]O$Z#^O$[#_O$]#`O$^#aO$_#aO%T#cOT!vy!S!vy!c!vy!n!vy!w!vy'P!vy!y!vy!o!vy~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y#ji#O#ji~P!%aO_*PO!o&`X#O&`X~PvO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y#]i#O#]i~P!%aOT8TOz8RO!S8UO!c8VO!w:_O#P/yO#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO!y&ba#O&ba~P!%aO#|0OO!y$ji#O$ji~O#d0PO~O#V0SO#d0RO~P2wOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$ji#O$ji~P!%aO!p-yO#|0TO!y$oi#O$oi~O!o0YO'W$gO~O#O0[O!y'kX~O#d0^O~O!y0_O~O!pXO!r0bO~O#T'ZO#n'XO!p'qy!n'qy'P'qy~O!n$sy'P$sy!y$sy!o$sy~PCVO#P0eO#T'ZO#n'XO~O#sdO'WYOw&mX!p&mX#O&mX!n&mX'P&mX~O#O.^Ow'la!p'la!n'la'P'la~OS+kO]0mOm+kOs$`O!U+kO!`+kO!a+kO#d>xO$hqO~P2wO#T3tO#n3sO'W$gO~O#|)XO#T'eX#n'eX'W'eX~O!n#bO!p0sO'P#bO~O#Y0wO~Oh0|O~OTvO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$jq#O$jq~P!%aO#|1kO!y$jq#O$jq~O#d1lO~O!n#bO!pXO!z$hO#P1oO'P#bO~O!o1rO'W$gO~OT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$oq#O$oq~P!%aO#T1tO#d1sO!y&lX#O&lX~O#O0[O!y'ka~O#T'ZO#n'XO!p'q!R!n'q!R'P'q!R~O!pXO!r1yO~O!n$s!R'P$s!R!y$s!R!o$s!R~PCVO#P1{O#T'ZO#n'XO~OP7wOU_O[:rOo?tOs#fOx:rOy:rO}aO!O^O!QvO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y#^i#O#^i~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$jy#O$jy~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$oy#O$oy~P!%aO!pXO#P2rO~O#d2sO~O#O0[O!y'ki~O!n$s!Z'P$s!Z!y$s!Z!o$s!Z~PCVOTvO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$j!R#O$j!R~P!%aO!n$s!c'P$s!c!y$s!c!o$s!c~PCVO!a3`O'W$gO~OV3dO!o&Wa#O&Wa~O'W$gO!n%Ri'P%Ri~O'a'_O~O'a/jO~O'a*iO~O'a1]O~OT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n$ta#|$ta$O$ta'P$ta!y$ta!o$ta#O$ta~P!%aO#T3uO~P-RO#s3lO~O#s3mO~O!U$uO$u$tO~P#-WOT8TOz8RO!S8UO!c8VO!w:_O#P3pO#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO!n'^X'P'^X!y'^X!o'^X~P!%aOT6QOz6OO!S6RO!c6SO!w7oO#P5aO#T#PO$R6PO$S6TO$T6UO$U6VO$V6WO$X6YO$Y6ZO$Z6[O$[6]O$]6^O$^6_O$_6_O%T#cO#O'^X#Y'^X#|'^X$O'^X!n'^X'P'^X!r'^X!y'^X!o'^XV'^X!p'^X~P!%aO#T5OO~P#-WOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n$`a#|$`a$O$`a'P$`a!y$`a!o$`a#O$`a~P!%aOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n$aa#|$aa$O$aa'P$aa!y$aa!o$aa#O$aa~P!%aOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n$ba#|$ba$O$ba'P$ba!y$ba!o$ba#O$ba~P!%aOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n$ca#|$ca$O$ca'P$ca!y$ca!o$ca#O$ca~P!%aOz3{O#|$ca$O$ca#O$ca~PMVOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n$fa#|$fa$O$fa'P$fa!y$fa!o$fa#O$fa~P!%aOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n%Va#|%Va$O%Va'P%Va!y%Va!o%Va#O%Va~P!%aOz3{O#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#|$Qi$O$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOz3{O!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi#|$Qi$O$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOT3}Oz3{O!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!S$Qi!n$Qi#|$Qi$O$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOT3}Oz3{O!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!S$Qi!c$Qi!n$Qi#|$Qi$O$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOz3{O#T#PO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#|$Qi$O$Qi$R$Qi$S$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOz3{O#T#PO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#|$Qi$O$Qi$R$Qi$S$Qi$T$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOz3{O#T#PO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#|$Qi$O$Qi$R$Qi$S$Qi$T$Qi$U$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOz3{O#T#PO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#|$Qi$O$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOz3{O$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi#|$Qi$O$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOz3{O$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi#|$Qi$O$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOz3{O$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi#|$Qi$O$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOz3{O$[4YO$^4[O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi#|$Qi$O$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$]$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOz3{O$^4[O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi#|$Qi$O$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$[$Qi$]$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOz3{O$Z4XO$[4YO$^4[O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi#|$Qi$O$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$]$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOz3{O$_4[O%T#cOT$Qi!S$Qi!c$Qi!n$Qi!w$Qi#T$Qi#|$Qi$O$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$[$Qi$]$Qi$^$Qi'P$Qi!y$Qi!o$Qi#O$Qi~P!%aOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n#Ua#|#Ua$O#Ua'P#Ua!y#Ua!o#Ua#O#Ua~P!%aOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n'^a#|'^a$O'^a'P'^a!y'^a!o'^a#O'^a~P!%aOz3{O!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT#Qi!S#Qi!c#Qi!n#Qi#|#Qi$O#Qi'P#Qi!y#Qi!o#Qi#O#Qi~P!%aOz3{O!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT#}i!S#}i!c#}i!n#}i#|#}i$O#}i'P#}i!y#}i!o#}i#O#}i~P!%aOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n$Pi#|$Pi$O$Pi'P$Pi!y$Pi!o$Pi#O$Pi~P!%aOz3{O#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT!vq!S!vq!c!vq!n!vq!w!vq#|!vq$O!vq'P!vq!y!vq!o!vq#O!vq~P!%aOz3{O!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT#Qq!S#Qq!c#Qq!n#Qq#|#Qq$O#Qq'P#Qq!y#Qq!o#Qq#O#Qq~P!%aOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n$sq#|$sq$O$sq'P$sq!y$sq!o$sq#O$sq~P!%aOz3{O#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cOT!vy!S!vy!c!vy!n!vy!w!vy#|!vy$O!vy'P!vy!y!vy!o!vy#O!vy~P!%aOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n$sy#|$sy$O$sy'P$sy!y$sy!o$sy#O$sy~P!%aOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n$s!R#|$s!R$O$s!R'P$s!R!y$s!R!o$s!R#O$s!R~P!%aOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n$s!Z#|$s!Z$O$s!Z'P$s!Z!y$s!Z!o$s!Z#O$s!Z~P!%aOT3}Oz3{O!S4OO!c4PO!w5rO#T#PO$R3|O$S4QO$T4RO$U4SO$V4TO$X4VO$Y4WO$Z4XO$[4YO$]4ZO$^4[O$_4[O%T#cO!n$s!c#|$s!c$O$s!c'P$s!c!y$s!c!o$s!c#O$s!c~P!%aOP7wOU_O[5kOo9xOs#fOx5gOy5gO}aO!O^O!Q5{O!T5qO!V5iO!W5iO!Z5}O!d5eO!z]O#T5bO#X`O#dhO#fbO#gcO#sdO$[5oO$d5mO$e5oO$hqO%T5|O%U!OO'WYO~P$vO#O9_O#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y'xX~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#O9aO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y'ZX~P!%aOz8RO#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cOT$Qi!S$Qi!c$Qi!w$Qi#O$Qi#P$Qi#Y$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOz8RO!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cOT$Qi!S$Qi!c$Qi#O$Qi#P$Qi#Y$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOT8TOz8RO!c8VO!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO!S$Qi#O$Qi#P$Qi#Y$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOT8TOz8RO!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO!S$Qi!c$Qi#O$Qi#P$Qi#Y$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOz8RO#T#PO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cOT$Qi!S$Qi!c$Qi!w$Qi#O$Qi#P$Qi#Y$Qi$R$Qi$S$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOz8RO#T#PO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cOT$Qi!S$Qi!c$Qi!w$Qi#O$Qi#P$Qi#Y$Qi$R$Qi$S$Qi$T$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOz8RO#T#PO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cOT$Qi!S$Qi!c$Qi!w$Qi#O$Qi#P$Qi#Y$Qi$R$Qi$S$Qi$T$Qi$U$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOz8RO#T#PO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cOT$Qi!S$Qi!c$Qi!w$Qi#O$Qi#P$Qi#Y$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOz8RO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cOT$Qi!S$Qi!c$Qi!w$Qi#O$Qi#P$Qi#T$Qi#Y$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOz8RO$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cOT$Qi!S$Qi!c$Qi!w$Qi#O$Qi#P$Qi#T$Qi#Y$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOz8RO$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cOT$Qi!S$Qi!c$Qi!w$Qi#O$Qi#P$Qi#T$Qi#Y$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOz8RO$[8`O$^8bO$_8bO%T#cOT$Qi!S$Qi!c$Qi!w$Qi#O$Qi#P$Qi#T$Qi#Y$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$]$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOz8RO$^8bO$_8bO%T#cOT$Qi!S$Qi!c$Qi!w$Qi#O$Qi#P$Qi#T$Qi#Y$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$[$Qi$]$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOz8RO$Z8_O$[8`O$^8bO$_8bO%T#cOT$Qi!S$Qi!c$Qi!w$Qi#O$Qi#P$Qi#T$Qi#Y$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$]$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aOz8RO$_8bO%T#cOT$Qi!S$Qi!c$Qi!w$Qi#O$Qi#P$Qi#T$Qi#Y$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$[$Qi$]$Qi$^$Qi!n$Qi'P$Qi!r$Qi!y$Qi!o$QiV$Qi!p$Qi~P!%aO#T9fO~P!+iO!n#Ua'P#Ua!y#Ua!o#Ua~PCVO!n'^a'P'^a!y'^a!o'^a~PCVO#T=PO#V=OO!y&aX#O&aX~PvO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y#Wi#O#Wi~P!%aOz8RO!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cOT#Qq!S#Qq!c#Qq#O#Qq#P#Qq#Y#Qq!n#Qq'P#Qq!r#Qq!y#Qq!o#QqV#Qq!p#Qq~P!%aOT8TOz8RO!S8UO!c8VO!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO#O$sq#P$sq#Y$sq!n$sq'P$sq!r$sq!y$sq!o$sqV$sq!p$sq~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y&wa#O&wa~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y&_a#O&_a~P!%aOz8RO#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cOT!vy!S!vy!c!vy!w!vy#O!vy#P!vy#Y!vy!n!vy'P!vy!r!vy!y!vy!o!vyV!vy!p!vy~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y#Wq#O#Wq~P!%aOT8TOz8RO!S8UO!c8VO!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO#O$sy#P$sy#Y$sy!n$sy'P$sy!r$sy!y$sy!o$syV$sy!p$sy~P!%aOT8TOz8RO!S8UO!c8VO!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO#O$s!R#P$s!R#Y$s!R!n$s!R'P$s!R!r$s!R!y$s!R!o$s!RV$s!R!p$s!R~P!%aOT8TOz8RO!S8UO!c8VO!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO#O$s!Z#P$s!Z#Y$s!Z!n$s!Z'P$s!Z!r$s!Z!y$s!Z!o$s!ZV$s!Z!p$s!Z~P!%aOT8TOz8RO!S8UO!c8VO!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO#O$s!c#P$s!c#Y$s!c!n$s!c'P$s!c!r$s!c!y$s!c!o$s!cV$s!c!p$s!c~P!%aO#T9vO~PvO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$`a#O$`a~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$aa#O$aa~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$ba#O$ba~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$ca#O$ca~P!%aOz:`O%T#cOT$ca!S$ca!c$ca!w$ca!y$ca#O$ca#T$ca$R$ca$S$ca$T$ca$U$ca$V$ca$X$ca$Y$ca$Z$ca$[$ca$]$ca$^$ca$_$ca~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$fa#O$fa~P!%aO!r?SO#P9^O~OT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$ta#O$ta~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y%Va#O%Va~P!%aOT8TOz8RO!S8UO!c8VO!r9cO!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO~P!%aOz:`O#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT$Qi!S$Qi!c$Qi!w$Qi!y$Qi#O$Qi~P!%aOz:`O!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT$Qi!S$Qi!c$Qi!y$Qi#O$Qi~P!%aOT:bOz:`O!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!S$Qi!y$Qi#O$Qi~P!%aOT:bOz:`O!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!S$Qi!c$Qi!y$Qi#O$Qi~P!%aOz:`O#T#PO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT$Qi!S$Qi!c$Qi!w$Qi!y$Qi#O$Qi$R$Qi$S$Qi~P!%aOz:`O#T#PO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT$Qi!S$Qi!c$Qi!w$Qi!y$Qi#O$Qi$R$Qi$S$Qi$T$Qi~P!%aOz:`O#T#PO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT$Qi!S$Qi!c$Qi!w$Qi!y$Qi#O$Qi$R$Qi$S$Qi$T$Qi$U$Qi~P!%aOz:`O#T#PO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT$Qi!S$Qi!c$Qi!w$Qi!y$Qi#O$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi~P!%aOz:`O$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT$Qi!S$Qi!c$Qi!w$Qi!y$Qi#O$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi~P!%aOz:`O$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT$Qi!S$Qi!c$Qi!w$Qi!y$Qi#O$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi~P!%aOz:`O$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT$Qi!S$Qi!c$Qi!w$Qi!y$Qi#O$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi~P!%aOz:`O$[:mO$^:oO$_:oO%T#cOT$Qi!S$Qi!c$Qi!w$Qi!y$Qi#O$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$]$Qi~P!%aOz:`O$^:oO$_:oO%T#cOT$Qi!S$Qi!c$Qi!w$Qi!y$Qi#O$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$[$Qi$]$Qi~P!%aOz:`O$Z:lO$[:mO$^:oO$_:oO%T#cOT$Qi!S$Qi!c$Qi!w$Qi!y$Qi#O$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$]$Qi~P!%aOz:`O$_:oO%T#cOT$Qi!S$Qi!c$Qi!w$Qi!y$Qi#O$Qi#T$Qi$R$Qi$S$Qi$T$Qi$U$Qi$V$Qi$X$Qi$Y$Qi$Z$Qi$[$Qi$]$Qi$^$Qi~P!%aOz:`O!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT#Qi!S#Qi!c#Qi!y#Qi#O#Qi~P!%aOz:`O!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT#}i!S#}i!c#}i!y#}i#O#}i~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$Pi#O$Pi~P!%aO!r?TO#P9hO~Oz:`O#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT!vq!S!vq!c!vq!w!vq!y!vq#O!vq~P!%aOz:`O!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT#Qq!S#Qq!c#Qq!y#Qq#O#Qq~P!%aO!r?YO#P9oO~OT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$sq#O$sq~P!%aO#P9oO#T'ZO#n'XO~Oz:`O#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cOT!vy!S!vy!c!vy!w!vy!y!vy#O!vy~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$sy#O$sy~P!%aO#P9pO#T'ZO#n'XO~OT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$s!R#O$s!R~P!%aO#P9sO#T'ZO#n'XO~OT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$s!Z#O$s!Z~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y$s!c#O$s!c~P!%aO#T;}O~P!+iOT8TOz8RO!S8UO!c8VO!w:_O#P;|O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO!y'^X#O'^X~P!%aO!U$uO$u$tO~P$8rOP7wOU_O[:rOo?tOs#fOx:rOy:rO}aO!O^O!QVO~P$8rOP7wOU_O[:rOo?tOs#fOx:rOy:rO}aO!O^O!QWO#X`O#dhO#fbO#gcO#sdO$[vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y#Ua#O#Ua~P!%aOT:bOz:`O!S:cO!c:dO!w>vO#T#PO$R:aO$S:eO$T:fO$U:gO$V:hO$X:jO$Y:kO$Z:lO$[:mO$]:nO$^:oO$_:oO%T#cO!y'^a#O'^a~P!%aOz<]O!w?^O#T#PO$R<_O$SpO~P$8rOP7wOU_O[:rOo?tOs#fOx:rOy:rO}aO!O^O!QqO#X`O#dhO#fbO#gcO#sdO$[oO#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO~P!%aOT8TOz8RO!S8UO!c8VO!w:_O#P>nO#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO!n'^X!r'^X!o'^X#O'^X!p'^X'P'^X~P!%aOT'XXz'XX!S'XX!c'XX!w'XX!z'XX#O'XX#T'XX#X'XX#a'XX#b'XX#y'XX$R'XX$S'XX$T'XX$U'XX$V'XX$X'XX$Y'XX$Z'XX$['XX$]'XX$^'XX$_'XX%T'XX~O#|:uO$O:vO!y'XX~P.@qO!z$hO#T>zO~O!r;SO~PxO!n&qX!p&qX#O&qX'P&qX~O#O?QO!n'pa!p'pa'P'pa~O!r?rO#P;uO~OT[O~O!r?zO#P:rO~OT8TOz8RO!S8UO!c8VO!r>]O!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO~P!%aOT8TOz8RO!S8UO!c8VO!r>^O!w:_O#T#PO$R8SO$S8WO$T8XO$U8YO$V8ZO$X8]O$Y8^O$Z8_O$[8`O$]8aO$^8bO$_8bO%T#cO~P!%aO!r?{O#P>cO~O!r?|O#P>hO~O#P>hO#T'ZO#n'XO~O#P:rO#T'ZO#n'XO~O#P>iO#T'ZO#n'XO~O#P>lO#T'ZO#n'XO~O!z$hO#T?nO~Oo>wOs$lO~O!z$hO#T?oO~O#O?QO!n'pX!p'pX'P'pX~O!z$hO#T?vO~O!z$hO#T?wO~O!z$hO#T?xO~Oo?lOs$lO~Oo?uOs$lO~Oo?tOs$lO~O%X$]%W$k!e$^#d%`#g'u'W#f~",goto:"%1O'{PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP'|P(TPP(Z(^PPP(vP(^*o(^6cP6cPP>cFxF{PP6cGR! RP! UP! UPPGR! e! h! lGRGRPP! oP! rPPGR!)u!0q!0qGR!0uP!0u!0u!0u!2PP!;g!S#>Y#>h#>n#>x#?O#?U#?[#?b#?l#?v#?|#@S#@^PPPPPPPP#@d#@hP#A^$(h$(k$(u$1R$1_$1t$1zP$1}$2Q$2W$5[$?Y$Gr$Gu$G{$HO$Kb$Ke$Kn$Kv$LQ$Li$MP$Mz%'}PP%0O%0S%0`%0u%0{Q!nQT!qV!rQUOR%x!mRVO}!hPVX!S!j!r!s!w%O%Q%T%V(h,Q,T.u.w/P0}1O1W2]|!hPVX!S!j!r!s!w%O%Q%T%V(h,Q,T.u.w/P0}1O1W2]Q%_!ZQ%h!aQ%m!eQ'k$cQ'x$iQ)d%lQ+W'{Q,k)QU.O+T+V+]Q.j+pQ/`,jS0a.T.UQ0q.dQ1n0VS1w0`0dQ2Q0nQ2q1pQ2t1xR3[2u|ZPVX!S!j!r!s!w%O%Q%T%V(h,Q,T.u.w/P0}1O1W2]2lf]`cgjklmnoprxyz!W!X!Y!]!e!f!g!y!z#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a#i#l#m#q#r#}$Q$R$T$h$z%S%U%d%r%}&S&W&[&q&t&u&x'P'X'Z']'a'e'p't'y(R(V(W(Y(Z([(t)T)X)`)c)g)n)u)y*V*Z*[*r*w*|+Q+X+[+^+_+j+m+q+t,Y,c,e,g,i,u,x-O-`-a-t-v-z.S.V.[.].^.b/X/n/y0O0T0b0e1R1S1b1k1o1y1{2k2r3n3p3s3t3u3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5a5b5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`7b7c7i7j7k7o7w7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8d8e8f8g8h8s9T9W9Z9^9_9a9c9f9h9o9p9s9u9v9|9}:O:Q:R:S:T:U:V:W:X:Y:Z:[:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:q:r:s:u:v:w;S;e;i;j;k;n;u;v;z;|;}V>W>[>]>^>c>h>i>l>n>o>p>q>v?S?T?Y?^?_?p?q?r?y?z?{?|S$ku$`Q%W!V^%e!_$a'j)Y.f0o2OQ%i!bQ%j!cQ%k!dQ%v!kS&V!|){Q&]#OQ'l$dQ'm$eS'|$j'hQ)S%`Q*v'nQ+z(bQ,O(dQ-S)iU.g+n.c0mQ.q+{Q.r+|Q/d,vS0V-y0XQ1X/cQ1e/rS2T0s2WQ2h1`Q3U2iQ3^2zQ3_2{Q3c3VQ3f3`R3g3d0{!OPVX]`cjklmnopxyz!S!W!X!Y!]!g!j!r!s!w!y!z!|#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a#i#l#m#q#r$Q$R$T$z%O%Q%S%T%U%V%d%}&S&W&[&q&t&u&x'P']'a(R(V(h(t)T)X)n)u)y){*V*Z*[*|+^,Q,T,Y,c,e,g-`-a-t-z.[.u.w/P/X/y0O0T0e0s0}1O1R1S1W1k1o1{2W2]2r3p3u3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5a5b5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`7b7c7o7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8d8e8f8g8h8s9T9W9Z9^9_9a9c9f9h9o9p9s9u9v:Q:R:S:T:U:V:W:X:Y:Z:[:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:q:r:s:u:v:w;S;e;i;j;k;n;u;v;z;|;}V>W>[>]>^>c>h>i>l>n>o>p>q>v?^?_0z!OPVX]`cjklmnopxyz!S!W!X!Y!]!g!j!r!s!w!y!z!|#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a#i#l#m#q#r$Q$R$T$z%O%Q%S%T%U%V%d%}&S&W&[&q&t&u&x'P']'a(R(V(h(t)T)X)n)u)y){*V*Z*[*|+^,Q,T,Y,c,e,g-`-a-t-z.[.u.w/P/X/y0O0T0e0s0}1O1R1S1W1k1o1{2W2]2r3p3u3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5a5b5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`7b7c7o7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8d8e8f8g8h8s9T9W9Z9^9_9a9c9f9h9o9p9s9u9v:Q:R:S:T:U:V:W:X:Y:Z:[:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:q:r:s:u:v:w;S;e;i;j;k;n;u;v;z;|;}V>W>[>]>^>c>h>i>l>n>o>p>q>v?^?_Q#h^Q%O!PQ%P!QQ%Q!RQ,b(sQ.u,RR.y,UR&r#hQ*Q&qR/w-a0{hPVX]`cjklmnopxyz!S!W!X!Y!]!g!j!r!s!w!y!z!|#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a#i#l#m#q#r$Q$R$T$z%O%Q%S%T%U%V%d%}&S&W&[&q&t&u&x'P']'a(R(V(h(t)T)X)n)u)y){*V*Z*[*|+^,Q,T,Y,c,e,g-`-a-t-z.[.u.w/P/X/y0O0T0e0s0}1O1R1S1W1k1o1{2W2]2r3p3u3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5a5b5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`7b7c7o7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8d8e8f8g8h8s9T9W9Z9^9_9a9c9f9h9o9p9s9u9v:Q:R:S:T:U:V:W:X:Y:Z:[:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:q:r:s:u:v:w;S;e;i;j;k;n;u;v;z;|;}V>W>[>]>^>c>h>i>l>n>o>p>q>v?^?_R#j_k#n`j#i#q&t&x5d5e9W:Q:R:S:TR#saT&}#r'PR-h*[R&R!{0zhPVX]`cjklmnopxyz!S!W!X!Y!]!g!j!r!s!w!y!z!|#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a#i#l#m#q#r$Q$R$T$z%O%Q%S%T%U%V%d%}&S&W&[&q&t&u&x'P']'a(R(V(h(t)T)X)n)u)y){*V*Z*[*|+^,Q,T,Y,c,e,g-`-a-t-z.[.u.w/P/X/y0O0T0e0s0}1O1R1S1W1k1o1{2W2]2r3p3u3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5a5b5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`7b7c7o7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8d8e8f8g8h8s9T9W9Z9^9_9a9c9f9h9o9p9s9u9v:Q:R:S:T:U:V:W:X:Y:Z:[:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:q:r:s:u:v:w;S;e;i;j;k;n;u;v;z;|;}V>W>[>]>^>c>h>i>l>n>o>p>q>v?^?_R#tb-x!}[#e#k#u$U$V$W$X$Y$Z$v$w%X%Z%]%a%s%|&O&U&_&`&a&b&c&d&e&f&g&h&i&j&k&l&m&n&v&w&|'`'b'c(e(x)v)x)z*O*U*h*j+a+d,n,q-W-Y-[-e-f-g-w.Y/O/[/v0Q0Z0f1g1j1m1z2S2`2o2p2v3Z4]4^4d4e4f4g4h4i4j4l4m4n4o4p4q4r4s4t4u4v4w4x4y4z4{4|4}5P5Q5T5U5W5X5Y5]5^5`5t6e6f6g6h6i6j6k6m6n6o6p6q6r6s6t6u6v6w6x6y6z6{6|6}7O7Q7R7U7V7X7Y7Z7^7_7a7m7q8i8j8k8l8m8n8p8q8r8t8u8v8w8x8y8z8{8|8}9O9P9Q9R9S9U9V9Y9[9]9d9e9g9i9j9k9l9m9n9q9r9t9w:p:x:y:z:{:|:};Q;R;T;U;V;W;X;Y;Z;[;];^;_;`;a;b;c;d;f;g;l;m;p;r;s;w;y;{O>P>Q>R>S>T>U>X>Y>Z>_>`>a>b>d>e>f>g>j>k>m>r>s>{>|>}?V?b?cQ'd$[Y(X$s8o;P=^=_S(]3o7lQ(`$tR+y(aT&X!|){#a$Pg#}$h'X'Z'p't'y(W([)`)c*r*w+Q+X+[+_+j+m+n+t,i,u,x-v.S.V.].b.c0b0m1y3n3s3t7i7j7k7w9|9}:O?S?T?Y?p?q?r?y?z?{?|3yfPVX]`cgjklmnoprxyz!S!W!X!Y!]!e!f!g!j!r!s!w!y!z!|#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a#i#l#m#q#r#}$Q$R$T$h$z%O%Q%S%T%U%V%d%r%}&S&W&[&q&t&u&x'P'X'Z']'a'e'p't'y(R(V(W(Y(Z([(h(t)T)X)`)c)g)n)u)y){*V*Z*[*r*w*|+Q+X+[+^+_+j+m+n+q+t,Q,T,Y,c,e,g,i,u,x-O-`-a-t-v-z.S.V.[.].^.b.c.u.w/P/X/n/y0O0T0b0e0m0s0}1O1R1S1W1b1k1o1y1{2W2]2k2r3n3p3s3t3u3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5a5b5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`7b7c7i7j7k7o7w7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8d8e8f8g8h8s9T9W9Z9^9_9a9c9f9h9o9p9s9u9v9|9}:O:Q:R:S:T:U:V:W:X:Y:Z:[:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:q:r:s:u:v:w;S;e;i;j;k;n;u;v;z;|;}V>W>[>]>^>c>h>i>l>n>o>p>q>v?S?T?Y?^?_?p?q?r?y?z?{?|[#wd#x3h3i3j3kh'V#z'W)f,}-U/k/u1f3l3m3q3rQ)e%nR-T)kY#yd%n)k3h3iV'T#x3j3k1dePVX]`cjklmnoprxyz!S!W!X!Y!]!e!g!j!r!s!w!y!z!|#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a#i#l#m#q#r$Q$R$T$z%O%Q%S%T%U%V%d%}&S&W&[&q&t&u&x'P']'a'e(R(V(Y(Z(h(t)T)X)g)n)u)y){*V*Z*[*|+^+q,Q,T,Y,c,e,g-O-`-a-t-z.[.^.u.w/P/X/n/y0O0T0e0s0}1O1R1S1W1b1k1o1{2W2]2k2r3p3u3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5a5b5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`7b7c7o7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8d8e8f8g8h8s9T9W9Z9^9_9a9c9f9h9o9p9s9u9v:Q:R:S:T:U:V:W:X:Y:Z:[:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:q:r:s:u:v:w;S;e;i;j;k;n;u;v;z;|;}V>W>[>]>^>c>h>i>l>n>o>p>q>v?^?_Q%o!fQ)l%r#O3vg#}$h'X'Z'p't'y(W([)`*w+Q+X+[+_+j+m+t,i,u,x-v.S.V.].b0b1y7i7j7k7w9|9}:O?S?T?Y?p?q?r?y?z?{?|a3w)c*r+n.c0m3n3s3tY'T#z)f-U3l3mZ*c'W,}/u3q3r0vhPVX]`cjklmnopxyz!S!W!X!Y!]!g!j!r!s!w!y!z!|#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a#i#l#m#q#r$Q$R$T$z%O%Q%S%T%U%V%d%}&S&W&[&q&t&u&x'P']'a(R(V(h(t)T)X)n)u)y){*V*Z*[*|+^,Q,T,Y,c,e,g-`-a-t-z.[.u.w/P/X/y0O0T0e0}1O1R1S1W1k1o1{2]2r3p3u3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5a5b5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`7b7c7o7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8d8e8f8g8h8s9T9W9Z9^9_9a9c9f9h9o9p9s9u9v:Q:R:S:T:U:V:W:X:Y:Z:[:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:q:r:s:u:v:w;S;e;i;j;k;n;u;v;z;|;}V>W>[>]>^>c>h>i>l>n>o>p>q>v?^?_T2U0s2WR&^#OR&]#O!r#Z[#e#u$U$V$W$X$Z$s$w%X%Z%]&`&a&b&c&d&e&f&g'`'b'c(e)v)x*O*j+d-Y.Y0f1z2`2p2v3Z9U9V!Y4U3o4d4e4f4g4i4j4l4m4n4o4p4q4r4s4{4|4}5P5Q5T5U5W5X5Y5]5^5`!^6X4^6e6f6g6h6j6k6m6n6o6p6q6r6s6t6|6}7O7Q7R7U7V7X7Y7Z7^7_7a7l7m#b8[#k%a%s%|&O&v&w&|(x*U+a,n,q-W-e-g/[4]5t7q8i8j8k8l8n8o8p8t8u8v8w8x8y8z8{9Y9[9]9d9g9i9l9n9q9r9t9w:p;Rr>s>{?b?c!|:i&U)z-[-f-w0Q0Z1g1j1m2o8q8r9e9j9k9m:x:y:z:{:};P;Q;T;U;V;W;X;Y;Z;[;d;f;g;l;m;p;r;s;w;y;{>R>S!`T>X>Z>_>a>d>e>g>j>k>m>|>}?VoU>Y>`>b>fS$iu#fQ$qwU'{$j$l&pQ'}$kS(P$m$rQ+Z'|Q+](OQ+`(QQ1p0VQ5s7dS5v7f7gQ5w7hQ7p9xS7r9y9zQ7s9{Q;O>uS;h>w>zQ;o?PQ>y?jS?O?l?nQ?U?oQ?`?sS?a?t?wS?d?u?vR?e?xT'u$h+Q!csPVXt!S!j!r!s!w$h%O%Q%T%V'p([(h)`+Q+j+t,Q,T,u,x.u.w/P0}1O1W2]Q$]rR*l'eQ-{+PQ.i+oQ0U-xQ0j.`Q1|0kR2w1}T0W-y0XQ+V'zQ.U+YR0d.XQ(_$tQ)^%iQ)s%vQ*u'mS+x(`(aQ-q*vR.p+yQ(^$tQ)b%kQ)r%vQ*q'lS*t'm)sU+w(_(`(aS-p*u*vS.o+x+yQ/i,{Q/{-nQ/}-qR0v.pQ(]$tQ)]%iQ)_%jQ)q%vU*s'm)r)sW+v(^(_(`(aQ,t)^U-o*t*u*vU.n+w+x+yS/|-p-qS0u.o.pQ1i/}R2Y0vX+r([)`+t,xb%f!_$a'j+n.c.f0m0o2OR,r)YQ$ovS+b(S?Qg?m([)`+i+j+m+t,u,x.a.b0lR0t.kT2V0s2W0}|PVX]`cjklmnopxyz!S!W!X!Y!]!g!j!r!s!w!y!z!|#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a#i#l#m#q#r$Q$R$T$z%O%Q%S%T%U%V%d%}&S&W&[&q&t&u&x'P']'a(R(V(h(t)T)X)n)u)y){*V*Z*[*|+^,Q,T,Y,c,e,g,m-`-a-t-z.[.u.w/P/X/y0O0T0e0s0}1O1R1S1W1k1o1{2W2]2r3p3u3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5a5b5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`7b7c7o7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8d8e8f8g8h8s9T9W9Z9^9_9a9c9f9h9o9p9s9u9v:Q:R:S:T:U:V:W:X:Y:Z:[:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:q:r:s:u:v:w;S;e;i;j;k;n;u;v;z;|;}V>W>[>]>^>c>h>i>l>n>o>p>q>v?^?_T$y{$|Q,O(dR.r+|T${{$|Q(j%OQ(r%QQ(w%TQ(z%VQ.},XQ0z.yQ0{.|R2c1WR(m%PX,[(k(l,],_R(n%PX(p%Q%T%V1WR%T!T_%b!]%S(t,c,e/X1RR%V!UR/],gR,j)PQ)a%kS*p'l)bS-m*q,{S/z-n/iR1h/{T,w)`,xQ-P)fU/l,|,}-UU1^/k/t/uR2n1fR/o-OR2l1bSSO!mR!oSQ!rVR%y!rQ!jPS!sV!rQ!wX[%u!j!s!w,Q1O2]Q,Q(hQ1O/PR2]0}Q)o%sS-X)o9bR9b8rQ-b*QR/x-bQ&y#oS*X&y9XR9X:tS*]&|&}R-i*]Q)|&YR-^)|!j'Y#|'o*f*z+O+T+e+i.T.W.Z.a/_0`0c0g0l1x2u5x5y5z7e7t7u7v;q;t;x?W?X?Z?f?g?h?iS*e'Y/g]/g,{-n.f0o1[2O!h'[#|'o*z+O+T+e+i.T.W.Z.a/_0`0c0g0l1x2u5x5y5z7e7t7u7v;q;t;x?W?X?Z?f?g?h?iS*g'[/hZ/h,{-n.f0o2OU#xd%n)kU'S#x3j3kQ3j3hR3k3iQ'W#z^*b'W,}/k/u1f3q3rQ,})fQ/u-UQ3q3lR3r3m|tPVX!S!j!r!s!w%O%Q%T%V(h,Q,T.u.w/P0}1O1W2]W$_t'p+j,uS'p$h+QS+j([+tT,u)`,xQ'f$]R*m'fQ0X-yR1q0XQ+R'vR-}+RQ0].PS1u0]1vR1v0^Q._+fR0i._Q+t([R.l+tW+m([)`+t,xS.b+j,uT.e+m.bQ)Z%fR,s)ZQ(T$oS+c(T?RR?R?mQ2W0sR2}2WQ$|{R(f$|Q,S(iR.v,SQ,V(jR.z,VQ,](kQ,_(lT/Q,],_Q)U%aS,o)U9`R9`8qQ)R%_R,l)RQ,x)`R/e,xQ)h%pS-R)h/sR/s-SQ1c/oR2m1cT!uV!rj!iPVX!j!r!s!w(h,Q/P0}1O2]Q%R!SQ(i%OW(p%Q%T%V1WQ.x,TQ0x.uR0y.w|[PVX!S!j!r!s!w%O%Q%T%V(h,Q,T.u.w/P0}1O1W2]Q#e]U#k`#q&xQ#ucQ$UkQ$VlQ$WmQ$XnQ$YoQ$ZpQ$sx^$vy3y5|8P:]n>oQ+a(RQ+d(VQ,n)TQ,q)XQ-W)nQ-Y)uQ-[)yQ-e*VQ-f*ZQ-g*[^-k3u5b7c9v;}>p>qQ-w*|Q.Y+^Q/O,YQ/[,gQ/v-`Q0Q-tQ0Z-zQ0f.[Q1g/yQ1j0OQ1m0TQ1z0eU2S0s2W:rQ2`1SQ2o1kQ2p1oQ2v1{Q3Z2rQ3o3xQ4]jQ4^5eQ4d5fQ4e5hQ4f5jQ4g5lQ4h5nQ4i5pQ4j3zQ4l3|Q4m3}Q4n4OQ4o4PQ4p4QQ4q4RQ4r4SQ4s4TQ4t4UQ4u4VQ4v4WQ4w4XQ4x4YQ4y4ZQ4z4[Q4{4_Q4|4`Q4}4aQ5P4bQ5Q4cQ5T4kQ5U5OQ5W5RQ5X5SQ5Y5VQ5]5ZQ5^5[Q5`5_Q5t5rQ6e5gQ6f5iQ6g5kQ6h5mQ6i5oQ6j5qQ6k5}Q6m6PQ6n6QQ6o6RQ6p6SQ6q6TQ6r6UQ6s6VQ6t6WQ6u6XQ6v6YQ6w6ZQ6x6[Q6y6]Q6z6^Q6{6_Q6|6`Q6}6aQ7O6bQ7Q6cQ7R6dQ7U6lQ7V7PQ7X7SQ7Y7TQ7Z7WQ7^7[Q7_7]Q7a7`Q7l5{Q7m5dQ7q7oQ8i7xQ8j7yQ8k7zQ8l7{Q8m7|Q8n7}Q8o8OQ8p8QU8q,c/X1RQ8r%dQ8t8SQ8u8TQ8v8UQ8w8VQ8x8WQ8y8XQ8z8YQ8{8ZQ8|8[Q8}8]Q9O8^Q9P8_Q9Q8`Q9R8aQ9S8bQ9U8dQ9V8eQ9Y8fQ9[8gQ9]8hQ9d8sQ9e9TQ9g9ZQ9i9^Q9j9_Q9k9aQ9l9cQ9m9fQ9n9hQ9q9oQ9r9pQ9t9sQ9w:QU:p#i&t9WQ:x:UQ:y:VQ:z:WQ:{:XQ:|:YQ:}:ZQ;P:[Q;Q:^Q;R:_Q;T:aQ;U:bQ;V:cQ;W:dQ;X:eQ;Y:fQ;Z:gQ;[:hQ;]:iQ;^:jQ;_:kQ;`:lQ;a:mQ;b:nQ;c:oQ;d:uQ;f:vQ;g:wQ;l;SQ;m;eQ;p;jQ;r;kQ;s;nQ;w;uQ;y;vQ;{;zQOP<{Q>Q<|Q>R=OQ>S=PQ>T=QQ>U=RQ>X=SQ>Y=TQ>Z=UQ>_=aQ>`=bQ>a>VQ>b>WQ>d>[Q>e>]Q>f>^Q>g>cQ>j>hQ>k>iQ>m>lQ>r:SQ>s:RQ>{>vQ>|:qQ>}:sQ?V;iQ?b?^R?c?_R*R&qQ%t!gQ)W%dT*P&q-a$WiPVX]cklmnopxyz!S!W!X!Y!j!r!s!w#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a$Q$R$T$z%O%Q%T%V%}&S&['a(V(h)u+^,Q,T.[.u.w/P0e0}1O1S1W1o1{2]2r3p3u8d8e!t5c']3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5f5h5j5l5n5p7b7c!x7n5a5b5d5e5g5i5k5m5o5q5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`$`:P`j!]!g!y!z#i#l#m#q#r%S%U&q&t&u&x'P(R(t)T)X)n*V*[,e,g-a5r7o7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8f8g8h8s9W9Z9^9c9h9o9p9s9u9v:Q:R:S:T:_>v?^?_#l>t!|%d&W)y){*Z*|,c-t-z/X/y0O0T1R1k9T9_9a9f:U:V:W:X:Y:Z:[:]:^:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:u:v:w;S;e;j;k;n;u;v;z;|;}=O=P!x?[,Y-`:q:s;iV>[>]>c>h>i>l>n>p!]?]0s2W:rW>^>o>qQ#p`Q&s#iQ&{#qR*T&tS#o`#q^$Sj5d5e:Q:R:S:TS*W&x9WT:t#i&tQ'O#rR*_'PR&T!{R&Z!|Q&Y!|R-]){Q#|gS'^#}3nS'o$h+QS*d'X3sU*f'Z*w-vQ*z'pQ+O'tQ+T'yQ+e(WW+i([)`+t,xQ,{)cQ-n*rQ.T+XQ.W+[Q.Z+_U.a+j+m,uQ.f+nQ/_,iQ0`.SQ0c.VQ0g.]Q0l.bQ0o.cQ1[3tQ1x0bQ2O0mQ2u1yQ5x7iQ5y7jQ5z7kQ7e7wQ7t9|Q7u9}Q7v:OQ;q?SQ;t?TQ;x?YQ?W?pQ?X?qQ?Z?rQ?f?yQ?g?zQ?h?{R?i?|0z!OPVX]`cjklmnopxyz!S!W!X!Y!]!g!j!r!s!w!y!z!|#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a#i#l#m#q#r$Q$R$T$z%O%Q%S%T%U%V%d%}&S&W&[&q&t&u&x'P']'a(R(V(h(t)T)X)n)u)y){*V*Z*[*|+^,Q,T,Y,c,e,g-`-a-t-z.[.u.w/P/X/y0O0T0e0s0}1O1R1S1W1k1o1{2W2]2r3p3u3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5a5b5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`7b7c7o7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8d8e8f8g8h8s9T9W9Z9^9_9a9c9f9h9o9p9s9u9v:Q:R:S:T:U:V:W:X:Y:Z:[:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:q:r:s:u:v:w;S;e;i;j;k;n;u;v;z;|;}V>W>[>]>^>c>h>i>l>n>o>p>q>v?^?_#`$Og#}$h'X'Z'p't'y(W([)`)c*r*w+Q+X+[+_+j+m+n+t,i,u,x-v.S.V.].b.c0b0m1y3n3s3t7i7j7k7w9|9}:O?S?T?Y?p?q?r?y?z?{?|S$[r'eQ%l!eS%p!f%rU+f(Y(Z+qQ-Q)gQ/m-OQ0h.^Q1a/nQ2j1bR3W2k|vPVX!S!j!r!s!w%O%Q%T%V(h,Q,T.u.w/P0}1O1W2]#Y#g]cklmnopxyz!W!X!Y#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a$Q$R$T$z%}&S&['a(V)u+^.[0e1S1o1{2r3p3u8d8e`+k([)`+j+m+t,u,x.b!t8c']3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5f5h5j5l5n5p7b7c!x<}5a5b5d5e5g5i5k5m5o5q5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`$`?k`j!]!g!y!z#i#l#m#q#r%S%U&q&t&u&x'P(R(t)T)X)n*V*[,e,g-a5r7o7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8f8g8h8s9W9Z9^9c9h9o9p9s9u9v:Q:R:S:T:_>v?^?_#l?}!|%d&W)y){*Z*|,c-t-z/X/y0O0T1R1k9T9_9a9f:U:V:W:X:Y:Z:[:]:^:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:u:v:w;S;e;j;k;n;u;v;z;|;}=O=P!x@O,Y-`:q:s;iV>[>]>c>h>i>l>n>p!]@P0s2W:rW>^>o>qR'w$hQ'v$hR-|+QR$^rQ#d[Q%Y!WQ%[!XQ%^!YQ(U$pQ({%WQ(|%XQ(}%ZQ)O%]Q)V%cQ)[%gQ)d%lQ)j%qQ)p%tQ*n'iQ-V)mQ-l*oQ.i+oQ.j+pQ.x,WQ/S,`Q/T,aQ/U,bQ/Z,fQ/^,hQ/b,pQ/q-PQ0j.`Q0q.dQ0r.hQ0t.kQ0y.{Q1Y/dQ1_/lQ1n0VQ1|0kQ2Q0nQ2R0pQ2[0|Q2d1XQ2g1^Q2w1}Q2y2PQ2|2VQ3P2ZQ3T2fQ3X2nQ3Y2pQ3]2xQ3a3RQ3b3SR3e3ZR.R+UQ+g(YQ+h(ZR.k+qS+s([+tT,w)`,xa+l([)`+j+m+t,u,x.bQ%g!_Q'i$aQ*o'jQ.h+nS0p.c.fS2P0m0oR2x2OQ$pvW+o([)`+t,xW.`+i+j+m,uS0k.a.bR1}0l|!aPVX!S!j!r!s!w%O%Q%T%V(h,Q,T.u.w/P0}1O1W2]Q$ctW+p([)`+t,xU.d+j+m,uR0n.b0z!OPVX]`cjklmnopxyz!S!W!X!Y!]!g!j!r!s!w!y!z!|#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a#i#l#m#q#r$Q$R$T$z%O%Q%S%T%U%V%d%}&S&W&[&q&t&u&x'P']'a(R(V(h(t)T)X)n)u)y){*V*Z*[*|+^,Q,T,Y,c,e,g-`-a-t-z.[.u.w/P/X/y0O0T0e0s0}1O1R1S1W1k1o1{2W2]2r3p3u3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5a5b5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`7b7c7o7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8d8e8f8g8h8s9T9W9Z9^9_9a9c9f9h9o9p9s9u9v:Q:R:S:T:U:V:W:X:Y:Z:[:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:q:r:s:u:v:w;S;e;i;j;k;n;u;v;z;|;}V>W>[>]>^>c>h>i>l>n>o>p>q>v?^?_R/a,m0}}PVX]`cjklmnopxyz!S!W!X!Y!]!g!j!r!s!w!y!z!|#Q#R#S#T#U#V#W#X#Y#Z#[#]#^#_#`#a#i#l#m#q#r$Q$R$T$z%O%Q%S%T%U%V%d%}&S&W&[&q&t&u&x'P']'a(R(V(h(t)T)X)n)u)y){*V*Z*[*|+^,Q,T,Y,c,e,g,m-`-a-t-z.[.u.w/P/X/y0O0T0e0s0}1O1R1S1W1k1o1{2W2]2r3p3u3x3y3z3{3|3}4O4P4Q4R4S4T4U4V4W4X4Y4Z4[4_4`4a4b4c4k5O5R5S5V5Z5[5_5a5b5d5e5f5g5h5i5j5k5l5m5n5o5p5q5r5u5{5|5}6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6]6^6_6`6a6b6c6d6l7P7S7T7W7[7]7`7b7c7o7x7y7z7{7|7}8O8P8Q8R8S8T8U8V8W8X8Y8Z8[8]8^8_8`8a8b8d8e8f8g8h8s9T9W9Z9^9_9a9c9f9h9o9p9s9u9v:Q:R:S:T:U:V:W:X:Y:Z:[:]:^:_:`:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:q:r:s:u:v:w;S;e;i;j;k;n;u;v;z;|;}V>W>[>]>^>c>h>i>l>n>o>p>q>v?^?_T$x{$|Q(q%QQ(v%TQ(y%VR2b1WQ%c!]Q(u%SQ,d(tQ/W,cQ/Y,eQ1Q/XR2_1RQ%q!fR)m%rR/p-O",nodeNames:"⚠ ( HeredocString EscapeSequence abstract LogicOp array as Boolean break case catch clone const continue default declare do echo else elseif enddeclare endfor endforeach endif endswitch endwhile enum extends final finally fn for foreach from function global goto if implements include include_once LogicOp insteadof interface list match namespace new null LogicOp print readonly require require_once return switch throw trait try unset use var Visibility while LogicOp yield LineComment BlockComment TextInterpolation PhpClose Text PhpOpen Template TextInterpolation EmptyStatement ; } { Block : LabelStatement Name ExpressionStatement ConditionalExpression LogicOp MatchExpression ) ( ParenthesizedExpression MatchBlock MatchArm , => AssignmentExpression ArrayExpression ValueList & VariadicUnpacking ... Pair [ ] ListExpression ValueList Pair Pair SubscriptExpression MemberExpression -> ?-> Name VariableName DynamicVariable $ ${ CallExpression ArgList NamedArgument SpreadArgument CastExpression UnionType LogicOp IntersectionType OptionalType NamedType QualifiedName \\ NamespaceName Name NamespaceName Name ScopedExpression :: ClassMemberName DynamicMemberName AssignOp UpdateExpression UpdateOp YieldExpression BinaryExpression LogicOp LogicOp LogicOp BitOp BitOp BitOp CompareOp CompareOp BitOp ArithOp ConcatOp ArithOp ArithOp IncludeExpression RequireExpression CloneExpression UnaryExpression ControlOp LogicOp PrintIntrinsic FunctionExpression static ParamList Parameter #[ Attributes Attribute VariadicParameter PropertyParameter PropertyHooks PropertyHook UseList ArrowFunction NewExpression class BaseClause ClassInterfaceClause DeclarationList ConstDeclaration VariableDeclarator PropertyDeclaration VariableDeclarator MethodDeclaration UseDeclaration UseList UseInsteadOfClause UseAsClause UpdateExpression ArithOp ShellExpression ThrowExpression Integer Float String MemberExpression SubscriptExpression UnaryExpression ArithOp Interpolation String IfStatement ColonBlock SwitchStatement Block CaseStatement DefaultStatement ColonBlock WhileStatement EmptyStatement DoStatement ForStatement ForSpec SequenceExpression ForeachStatement ForSpec Pair GotoStatement ContinueStatement BreakStatement ReturnStatement TryStatement CatchDeclarator DeclareStatement EchoStatement UnsetStatement ConstDeclaration FunctionDefinition ClassDeclaration InterfaceDeclaration TraitDeclaration EnumDeclaration EnumBody EnumCase NamespaceDefinition NamespaceUseDeclaration UseGroup UseClause UseClause GlobalDeclaration FunctionStaticDeclaration Program",maxTerm:318,nodeProps:[["group",-36,2,8,49,82,84,86,89,94,95,103,107,108,112,113,116,120,126,132,137,139,140,154,155,156,157,160,161,173,174,188,190,191,192,193,194,200,"Expression",-28,75,79,81,83,201,203,208,210,211,214,217,218,219,220,221,223,224,225,226,227,228,229,230,231,234,235,239,240,"Statement",-4,121,123,124,125,"Type"],["isolate",-4,67,68,71,200,""],["openedBy",70,"phpOpen",77,"{",87,"(",102,"#["],["closedBy",72,"phpClose",78,"}",88,")",165,"]"]],propSources:[HO],skippedNodes:[0],repeatNodeCount:32,tokenData:"!GQ_R!]OX$zXY&^YZ'sZ]$z]^&^^p$zpq&^qr)Rrs+Pst+otu2buv5evw6rwx8Vxy>]yz>yz{?g{|@}|}Bb}!OCO!O!PDh!P!QKT!Q!R!!o!R![!$q![!]!,P!]!^!-a!^!_!-}!_!`!1S!`!a!2d!a!b!3t!b!c!7^!c!d!7z!d!e!9Y!e!}!7z!}#O!;b#O#P!V<%lO8VR9WV'TP%`QOw9mwx:Xx#O9m#O#P:^#P;'S9m;'S;=`;X<%lO9mQ9rV%`QOw9mwx:Xx#O9m#O#P:^#P;'S9m;'S;=`;X<%lO9mQ:^O%`QQ:aRO;'S9m;'S;=`:j;=`O9mQ:oW%`QOw9mwx:Xx#O9m#O#P:^#P;'S9m;'S;=`;X;=`<%l9m<%lO9mQ;[P;=`<%l9mR;fV'TP%`QOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zRV<%l~8V~O8V~~%fR=OW'TPOY8VYZ9PZ!^8V!^!_;{!_;'S8V;'S;=`=h;=`<%l9m<%lO8VR=mW%`QOw9mwx:Xx#O9m#O#P:^#P;'S9m;'S;=`;X;=`<%l8V<%lO9mR>YP;=`<%l8VR>dV!zQ'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zV?QV!yU'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zR?nY'TP$^QOY$zYZ%fZz$zz{@^{!^$z!^!_%k!_!`6U!`;'S$z;'S;=`&W<%lO$zR@eW$_Q'TPOY$zYZ%fZ!^$z!^!_%k!_!`6U!`;'S$z;'S;=`&W<%lO$zRAUY$[Q'TPOY$zYZ%fZ{$z{|At|!^$z!^!_%k!_!`6U!`;'S$z;'S;=`&W<%lO$zRA{V%TQ'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zRBiV#OQ'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$z_CXZ$[Q%^W'TPOY$zYZ%fZ}$z}!OAt!O!^$z!^!_%k!_!`6U!`!aCz!a;'S$z;'S;=`&W<%lO$zVDRV#aU'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zVDo['TP$]QOY$zYZ%fZ!O$z!O!PEe!P!Q$z!Q![Fs![!^$z!^!_%k!_!`6U!`;'S$z;'S;=`&W<%lO$zVEjX'TPOY$zYZ%fZ!O$z!O!PFV!P!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zVF^V#VU'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zRFz_'TP%XQOY$zYZ%fZ!Q$z!Q![Fs![!^$z!^!_%k!_!g$z!g!hGy!h#R$z#R#SJc#S#X$z#X#YGy#Y;'S$z;'S;=`&W<%lO$zRHO]'TPOY$zYZ%fZ{$z{|Hw|}$z}!OHw!O!Q$z!Q![Ii![!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zRH|X'TPOY$zYZ%fZ!Q$z!Q![Ii![!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zRIpZ'TP%XQOY$zYZ%fZ!Q$z!Q![Ii![!^$z!^!_%k!_#R$z#R#SHw#S;'S$z;'S;=`&W<%lO$zRJhX'TPOY$zYZ%fZ!Q$z!Q![Fs![!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$z_K[['TP$^QOY$zYZ%fZz$zz{LQ{!P$z!P!Q,o!Q!^$z!^!_%k!_!`6U!`;'S$z;'S;=`&W<%lO$z_LVX'TPOYLQYZLrZzLQz{N_{!^LQ!^!_! s!_;'SLQ;'S;=`!!i<%lOLQ_LwT'TPOzMWz{Mj{;'SMW;'S;=`NX<%lOMW^MZTOzMWz{Mj{;'SMW;'S;=`NX<%lOMW^MmVOzMWz{Mj{!PMW!P!QNS!Q;'SMW;'S;=`NX<%lOMW^NXO!f^^N[P;=`<%lMW_NdZ'TPOYLQYZLrZzLQz{N_{!PLQ!P!Q! V!Q!^LQ!^!_! s!_;'SLQ;'S;=`!!i<%lOLQ_! ^V!f^'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$z_! vZOYLQYZLrZzLQz{N_{!aLQ!a!bMW!b;'SLQ;'S;=`!!i<%l~LQ~OLQ~~%f_!!lP;=`<%lLQZ!!vm'TP%WYOY$zYZ%fZ!O$z!O!PFs!P!Q$z!Q![!$q![!^$z!^!_%k!_!d$z!d!e!&o!e!g$z!g!hGy!h!q$z!q!r!(a!r!z$z!z!{!){!{#R$z#R#S!%}#S#U$z#U#V!&o#V#X$z#X#YGy#Y#c$z#c#d!(a#d#l$z#l#m!){#m;'S$z;'S;=`&W<%lO$zZ!$xa'TP%WYOY$zYZ%fZ!O$z!O!PFs!P!Q$z!Q![!$q![!^$z!^!_%k!_!g$z!g!hGy!h#R$z#R#S!%}#S#X$z#X#YGy#Y;'S$z;'S;=`&W<%lO$zZ!&SX'TPOY$zYZ%fZ!Q$z!Q![!$q![!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zZ!&tY'TPOY$zYZ%fZ!Q$z!Q!R!'d!R!S!'d!S!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zZ!'k['TP%WYOY$zYZ%fZ!Q$z!Q!R!'d!R!S!'d!S!^$z!^!_%k!_#R$z#R#S!&o#S;'S$z;'S;=`&W<%lO$zZ!(fX'TPOY$zYZ%fZ!Q$z!Q!Y!)R!Y!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zZ!)YZ'TP%WYOY$zYZ%fZ!Q$z!Q!Y!)R!Y!^$z!^!_%k!_#R$z#R#S!(a#S;'S$z;'S;=`&W<%lO$zZ!*Q]'TPOY$zYZ%fZ!Q$z!Q![!*y![!^$z!^!_%k!_!c$z!c!i!*y!i#T$z#T#Z!*y#Z;'S$z;'S;=`&W<%lO$zZ!+Q_'TP%WYOY$zYZ%fZ!Q$z!Q![!*y![!^$z!^!_%k!_!c$z!c!i!*y!i#R$z#R#S!){#S#T$z#T#Z!*y#Z;'S$z;'S;=`&W<%lO$zR!,WX!rQ'TPOY$zYZ%fZ![$z![!]!,s!]!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zR!,zV#yQ'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zV!-hV!nU'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zR!.S[$YQOY$zYZ%fZ!^$z!^!_!.x!_!`!/i!`!a*c!a!b!0]!b;'S$z;'S;=`&W<%l~$z~O$z~~%fR!/PW$ZQ'TPOY$zYZ%fZ!^$z!^!_%k!_!`6U!`;'S$z;'S;=`&W<%lO$zR!/pX$YQ'TPOY$zYZ%fZ!^$z!^!_%k!_!`$z!`!a*c!a;'S$z;'S;=`&W<%lO$zP!0bR!jP!_!`!0k!r!s!0p#d#e!0pP!0pO!jPP!0sQ!j!k!0y#[#]!0yP!0|Q!r!s!0k#d#e!0k_!1ZX#|Y'TPOY$zYZ%fZ!^$z!^!_%k!_!`)r!`!a!1v!a;'S$z;'S;=`&W<%lO$zV!1}V#PU'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zR!2kX$YQ'TPOY$zYZ%fZ!^$z!^!_%k!_!`!3W!`!a!.x!a;'S$z;'S;=`&W<%lO$zR!3_V$YQ'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$z_!3{[!wQ'TPOY$zYZ%fZ}$z}!O!4q!O!^$z!^!_%k!_!`$z!`!a!6P!a!b!6m!b;'S$z;'S;=`&W<%lO$zV!4vX'TPOY$zYZ%fZ!^$z!^!_%k!_!`$z!`!a!5c!a;'S$z;'S;=`&W<%lO$zV!5jV#bU'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$z_!6WV!h^'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zR!6tW$RQ'TPOY$zYZ%fZ!^$z!^!_%k!_!`6U!`;'S$z;'S;=`&W<%lO$zR!7eV$dQ'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$z_!8Ta'aS'TP'WYOY$zYZ%fZ!Q$z!Q![!7z![!^$z!^!_%k!_!c$z!c!}!7z!}#R$z#R#S!7z#S#T$z#T#o!7z#o$g$z$g&j!7z&j;'S$z;'S;=`&W<%lO$z_!9ce'aS'TP'WYOY$zYZ%fZr$zrs!:tsw$zwx8Vx!Q$z!Q![!7z![!^$z!^!_%k!_!c$z!c!}!7z!}#R$z#R#S!7z#S#T$z#T#o!7z#o$g$z$g&j!7z&j;'S$z;'S;=`&W<%lO$zR!:{V'TP'uQOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zV!;iV#XU'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$z_!OZ'TPOY!=yYZ!>qZ!^!=y!^!_!@y!_#O!=y#O#P!Au#P#S!=y#S#T!CP#T;'S!=y;'S;=`!Cm<%lO!=yR!>vV'TPO#O!?]#O#P!?u#P#S!?]#S#T!@n#T;'S!?];'S;=`!@s<%lO!?]Q!?`VO#O!?]#O#P!?u#P#S!?]#S#T!@n#T;'S!?];'S;=`!@s<%lO!?]Q!?xRO;'S!?];'S;=`!@R;=`O!?]Q!@UWO#O!?]#O#P!?u#P#S!?]#S#T!@n#T;'S!?];'S;=`!@s;=`<%l!?]<%lO!?]Q!@sO%UQQ!@vP;=`<%l!?]R!@|]OY!=yYZ!>qZ!a!=y!a!b!?]!b#O!=y#O#P!Au#P#S!=y#S#T!CP#T;'S!=y;'S;=`!Cm<%l~!=y~O!=y~~%fR!AzW'TPOY!=yYZ!>qZ!^!=y!^!_!@y!_;'S!=y;'S;=`!Bd;=`<%l!?]<%lO!=yR!BgWO#O!?]#O#P!?u#P#S!?]#S#T!@n#T;'S!?];'S;=`!@s;=`<%l!=y<%lO!?]R!CWV%UQ'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zR!CpP;=`<%l!=y_!CzV!p^'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$z_!DjY$UQ#n['TPOY$zYZ%fZ!^$z!^!_%k!_!`6U!`#p$z#p#q!EY#q;'S$z;'S;=`&W<%lO$zR!EaV$SQ'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zR!E}V!oQ'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$zR!FkV$eQ'TPOY$zYZ%fZ!^$z!^!_%k!_;'S$z;'S;=`&W<%lO$z",tokenizers:[IO,CO,LO,0,1,2,3,NO],topRules:{Template:[0,73],Program:[1,241]},dynamicPrecedences:{298:1},specialized:[{term:284,get:(O,Q)=>z(O)<<1,external:z},{term:284,get:O=>AO[O]||-1}],tokenPrec:29889}),DO=s.define({name:"php",parser:KO.configure({props:[t.add({IfStatement:c({except:/^\s*({|else\b|elseif\b|endif\b)/}),TryStatement:c({except:/^\s*({|catch\b|finally\b)/}),SwitchBody:O=>{let Q=O.textAfter,i=/^\s*\}/.test(Q),a=/^\s*(case|default)\b/.test(Q);return O.baseIndent+(i?0:a?1:2)*O.unit},ColonBlock:O=>O.baseIndent+O.unit,"Block EnumBody DeclarationList":y({closing:"}"}),ArrowFunction:O=>O.baseIndent+O.unit,"String BlockComment":()=>null,Statement:c({except:/^({|end(for|foreach|switch|while)\b)/})}),U.add({"Block EnumBody DeclarationList SwitchBody ArrayExpression ValueList":l,ColonBlock(O){return{from:O.from+1,to:O.to}},BlockComment(O){return{from:O.from+2,to:O.to-2}}})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"},line:"//"},indentOnInput:/^\s*(?:case |default:|end(?:if|for(?:each)?|switch|while)|else(?:if)?|\{|\})$/,wordChars:"$",closeBrackets:{stringPrefixes:["b","B"]}}});function Q$(O={}){let Q=[],i;if(O.baseLanguage!==null)if(O.baseLanguage)i=O.baseLanguage;else{let a=w({matchClosingTags:!1});Q.push(a.support),i=a.language}return new Z(DO.configure({wrap:i&&R(a=>a.type.isTop?{parser:i.parser,overlay:P=>P.name=="Text"}:null),top:O.plain?"Program":"Template"}),Q)}export{Q$ as php,DO as phpLanguage}; diff --git a/apps/studio/dist/static/index-ByKwSaqq.js b/apps/studio/dist/static/index-ByKwSaqq.js new file mode 100644 index 00000000..1b2c954c --- /dev/null +++ b/apps/studio/dist/static/index-ByKwSaqq.js @@ -0,0 +1,13 @@ +import{L as U,E as c,a as d,C as L}from"./index-9VbysdZK.js";import{r as M,t as a,v as E,w as A,$ as C,x as Y,y as I,z as J,A as D,L as K,B as N,C as B,a3 as b,a4 as e,o as F,F as z,E as H,V as OO,a0 as aO,a1 as QO}from"./index-DznCqw2V.js";import"./sanity-BZuh2pfi.js";const iO=316,$O=317,k=1,rO=2,eO=3,tO=4,lO=318,ZO=320,nO=321,oO=5,PO=6,sO=0,T=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],q=125,pO=59,_=47,cO=42,SO=43,XO=45,gO=60,mO=44,YO=63,xO=46,TO=91,_O=new L({start:!1,shift(O,Q){return Q==oO||Q==PO||Q==ZO?O:Q==nO},strict:!1}),uO=new c((O,Q)=>{let{next:i}=O;(i==q||i==-1||Q.context)&&O.acceptToken(lO)},{contextual:!0,fallback:!0}),dO=new c((O,Q)=>{let{next:i}=O,$;T.indexOf(i)>-1||i==_&&(($=O.peek(1))==_||$==cO)||i!=q&&i!=pO&&i!=-1&&!Q.context&&O.acceptToken(iO)},{contextual:!0}),kO=new c((O,Q)=>{O.next==TO&&!Q.context&&O.acceptToken($O)},{contextual:!0}),fO=new c((O,Q)=>{let{next:i}=O;if(i==SO||i==XO){if(O.advance(),i==O.next){O.advance();let $=!Q.context&&Q.canShift(k);O.acceptToken($?k:rO)}}else i==YO&&O.peek(1)==xO&&(O.advance(),O.advance(),(O.next<48||O.next>57)&&O.acceptToken(eO))},{contextual:!0});function x(O,Q){return O>=65&&O<=90||O>=97&&O<=122||O==95||O>=192||!Q&&O>=48&&O<=57}const yO=new c((O,Q)=>{if(O.next!=gO||!Q.dialectEnabled(sO)||(O.advance(),O.next==_))return;let i=0;for(;T.indexOf(O.next)>-1;)O.advance(),i++;if(x(O.next,!0)){for(O.advance(),i++;x(O.next,!1);)O.advance(),i++;for(;T.indexOf(O.next)>-1;)O.advance(),i++;if(O.next==mO)return;for(let $=0;;$++){if($==7){if(!x(O.next,!0))return;break}if(O.next!="extends".charCodeAt($))break;O.advance(),i++}}O.acceptToken(tO,-i)}),wO=M({"get set async static":a.modifier,"for while do if else switch try catch finally return throw break continue default case defer":a.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":a.operatorKeyword,"let var const using function class extends":a.definitionKeyword,"import export from":a.moduleKeyword,"with debugger new":a.keyword,TemplateString:a.special(a.string),super:a.atom,BooleanLiteral:a.bool,this:a.self,null:a.null,Star:a.modifier,VariableName:a.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":a.function(a.variableName),VariableDefinition:a.definition(a.variableName),Label:a.labelName,PropertyName:a.propertyName,PrivatePropertyName:a.special(a.propertyName),"CallExpression/MemberExpression/PropertyName":a.function(a.propertyName),"FunctionDeclaration/VariableDefinition":a.function(a.definition(a.variableName)),"ClassDeclaration/VariableDefinition":a.definition(a.className),"NewExpression/VariableName":a.className,PropertyDefinition:a.definition(a.propertyName),PrivatePropertyDefinition:a.definition(a.special(a.propertyName)),UpdateOp:a.updateOperator,"LineComment Hashbang":a.lineComment,BlockComment:a.blockComment,Number:a.number,String:a.string,Escape:a.escape,ArithOp:a.arithmeticOperator,LogicOp:a.logicOperator,BitOp:a.bitwiseOperator,CompareOp:a.compareOperator,RegExp:a.regexp,Equals:a.definitionOperator,Arrow:a.function(a.punctuation),": Spread":a.punctuation,"( )":a.paren,"[ ]":a.squareBracket,"{ }":a.brace,"InterpolationStart InterpolationEnd":a.special(a.brace),".":a.derefOperator,", ;":a.separator,"@":a.meta,TypeName:a.typeName,TypeDefinition:a.definition(a.typeName),"type enum interface implements namespace module declare":a.definitionKeyword,"abstract global Privacy readonly override":a.modifier,"is keyof unique infer asserts":a.operatorKeyword,JSXAttributeValue:a.attributeValue,JSXText:a.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":a.angleBracket,"JSXIdentifier JSXNameSpacedName":a.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":a.attributeName,"JSXBuiltin/JSXIdentifier":a.standard(a.tagName)}),bO={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},zO={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},qO={__proto__:null,"<":193},jO=U.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:_O,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[wO],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z?O$@a_!q7`$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[dO,kO,fO,yO,2,3,4,5,6,7,8,9,10,11,12,13,14,uO,new d("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new d("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:O=>bO[O]||-1},{term:343,get:O=>zO[O]||-1},{term:95,get:O=>qO[O]||-1}],tokenPrec:15201}),j=[e("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),e("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),e("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),e("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),e("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),e(`try { + \${} +} catch (\${error}) { + \${} +}`,{label:"try",detail:"/ catch block",type:"keyword"}),e("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),e(`if (\${}) { + \${} +} else { + \${} +}`,{label:"if",detail:"/ else block",type:"keyword"}),e(`class \${name} { + constructor(\${params}) { + \${} + } +}`,{label:"class",detail:"definition",type:"keyword"}),e('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),e('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],RO=j.concat([e("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),e("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),e("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),f=new aO,R=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function p(O){return(Q,i)=>{let $=Q.node.getChild("VariableDefinition");return $&&i($,O),!0}}const hO=["FunctionDeclaration"],WO={FunctionDeclaration:p("function"),ClassDeclaration:p("class"),ClassExpression:()=>!0,EnumDeclaration:p("constant"),TypeAliasDeclaration:p("type"),NamespaceDeclaration:p("namespace"),VariableDefinition(O,Q){O.matchContext(hO)||Q(O,"variable")},TypeDefinition(O,Q){Q(O,"type")},__proto__:null};function h(O,Q){let i=f.get(Q);if(i)return i;let $=[],l=!0;function S(r,Z){let P=O.sliceString(r.from,r.to);$.push({label:P,type:Z})}return Q.cursor(QO.IncludeAnonymous).iterate(r=>{if(l)l=!1;else if(r.name){let Z=WO[r.name];if(Z&&Z(r,S)||R.has(r.name))return!1}else if(r.to-r.from>8192){for(let Z of h(O,r.node))$.push(Z);return!1}}),f.set(Q,$),$}const y=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,W=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function GO(O){let Q=z(O.state).resolveInner(O.pos,-1);if(W.indexOf(Q.name)>-1)return null;let i=Q.name=="VariableName"||Q.to-Q.from<20&&y.test(O.state.sliceDoc(Q.from,Q.to));if(!i&&!O.explicit)return null;let $=[];for(let l=Q;l;l=l.parent)R.has(l.name)&&($=$.concat(h(O.state.doc,l)));return{options:$,from:i?Q.from:O.pos,validFor:y}}const o=E.define({name:"javascript",parser:jO.configure({props:[A.add({IfStatement:Y({except:/^\s*({|else\b)/}),TryStatement:Y({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:C,SwitchBody:O=>{let Q=O.textAfter,i=/^\s*\}/.test(Q),$=/^\s*(case|default)\b/.test(Q);return O.baseIndent+(i?0:$?1:2)*O.unit},Block:I({closing:"}"}),ArrowFunction:O=>O.baseIndent+O.unit,"TemplateString BlockComment":()=>null,"Statement Property":Y({except:/^\s*{/}),JSXElement(O){let Q=/^\s*<\//.test(O.textAfter);return O.lineIndent(O.node.from)+(Q?0:O.unit)},JSXEscape(O){let Q=/\s*\}/.test(O.textAfter);return O.lineIndent(O.node.from)+(Q?0:O.unit)},"JSXOpenTag JSXSelfClosingTag"(O){return O.column(O.node.from)+O.unit}}),J.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":D,BlockComment(O){return{from:O.from+2,to:O.to-2}},JSXElement(O){let Q=O.firstChild;if(!Q||Q.name=="JSXSelfClosingTag")return null;let i=O.lastChild;return{from:Q.to,to:i.type.isError?O.to:i.from}},"JSXSelfClosingTag JSXOpenTag"(O){var Q;let i=(Q=O.firstChild)===null||Q===void 0?void 0:Q.nextSibling,$=O.lastChild;return!i||i.type.isError?null:{from:i.to,to:$.type.isError?O.to:$.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),G={test:O=>/^JSX/.test(O.name),facet:OO({commentTokens:{block:{open:"{/*",close:"*/}"}}})},vO=o.configure({dialect:"ts"},"typescript"),VO=o.configure({dialect:"jsx",props:[b.add(O=>O.isTop?[G]:void 0)]}),UO=o.configure({dialect:"jsx ts",props:[b.add(O=>O.isTop?[G]:void 0)]},"typescript");let v=O=>({label:O,type:"keyword"});const V="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(v),LO=V.concat(["declare","implements","private","protected","public"].map(v));function DO(O={}){let Q=O.jsx?O.typescript?UO:VO:O.typescript?vO:o,i=O.typescript?RO.concat(LO):j.concat(V);return new K(Q,[o.data.of({autocomplete:N(W,B(i))}),o.data.of({autocomplete:GO}),O.jsx?AO:[]])}function MO(O){for(;;){if(O.name=="JSXOpenTag"||O.name=="JSXSelfClosingTag"||O.name=="JSXFragmentTag")return O;if(O.name=="JSXEscape"||!O.parent)return null;O=O.parent}}function w(O,Q,i=O.length){for(let $=Q?.firstChild;$;$=$.nextSibling)if($.name=="JSXIdentifier"||$.name=="JSXBuiltin"||$.name=="JSXNamespacedName"||$.name=="JSXMemberExpression")return O.sliceString($.from,Math.min($.to,i));return""}const EO=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),AO=F.inputHandler.of((O,Q,i,$,l)=>{if((EO?O.composing:O.compositionStarted)||O.state.readOnly||Q!=i||$!=">"&&$!="/"||!o.isActiveAt(O.state,Q,-1))return!1;let S=l(),{state:r}=S,Z=r.changeByRange(P=>{var g;let{head:t}=P,n=z(r).resolveInner(t-1,-1),X;if(n.name=="JSXStartTag"&&(n=n.parent),!(r.doc.sliceString(t-1,t)!=$||n.name=="JSXAttributeValue"&&n.to>t)){if($==">"&&n.name=="JSXFragmentTag")return{range:P,changes:{from:t,insert:""}};if($=="/"&&n.name=="JSXStartCloseTag"){let s=n.parent,m=s.parent;if(m&&s.from==t-2&&((X=w(r.doc,m.firstChild,t))||((g=m.firstChild)===null||g===void 0?void 0:g.name)=="JSXFragmentTag")){let u=`${X}>`;return{range:H.cursor(t+u.length,-1),changes:{from:t,insert:u}}}}else if($==">"){let s=MO(n);if(s&&s.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(r.doc.sliceString(t,t+2))&&(X=w(r.doc,s,t)))return{range:P,changes:{from:t,insert:``}}}}return{range:P}});return Z.changes.empty?!1:(O.dispatch([S,r.update(Z,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});export{AO as autoCloseTags,DO as javascript,o as javascriptLanguage,VO as jsxLanguage,GO as localCompletionSource,j as snippets,UO as tsxLanguage,vO as typescriptLanguage,RO as typescriptSnippets}; diff --git a/apps/studio/dist/static/index-CEID5mKn.js b/apps/studio/dist/static/index-CEID5mKn.js new file mode 100644 index 00000000..9e54b002 --- /dev/null +++ b/apps/studio/dist/static/index-CEID5mKn.js @@ -0,0 +1,6 @@ +import{P as st,N as Q,G as v,T as it,I as Ee,r as Ie,J as H,u as ot,t as m,L as fe,K as at,k as lt,M as ht,F as X,E as P,O as z,Q as ft,U as ut,V as dt,W as pt,X as ct,z as Me,w as mt,Y as gt,o as kt,Z as ue,_ as Lt}from"./index-DznCqw2V.js";import{html as bt,htmlCompletionSource as wt}from"./index-BFSXaxBx.js";import"./sanity-BZuh2pfi.js";import"./index-9VbysdZK.js";import"./index-ByKwSaqq.js";class _{static create(e,r,n,s,i){let o=s+(s<<8)+e+(r<<4)|0;return new _(e,r,n,o,i,[],[])}constructor(e,r,n,s,i,o,a){this.type=e,this.value=r,this.from=n,this.hash=s,this.end=i,this.children=o,this.positions=a,this.hashProp=[[v.contextHash,s]]}addChild(e,r){e.prop(v.contextHash)!=this.hash&&(e=new H(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(r)}toTree(e,r=this.end){let n=this.children.length-1;return n>=0&&(r=Math.max(r,this.positions[n]+this.children[n].length+this.from)),new H(e.types[this.type],this.children,this.positions,r-this.from).balance({makeTree:(s,i,o)=>new H(Q.none,s,i,o,this.hashProp)})}}var u;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(u||(u={}));class St{constructor(e,r){this.start=e,this.content=r,this.marks=[],this.parsers=[]}}class Ct{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return R(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,r=0,n=0){for(let s=r;s=e.stack[r.depth+1].value+r.baseIndent)return!0;if(r.indent>=r.baseIndent+4)return!1;let n=(t.type==u.OrderedList?oe:ie)(r,e,!1);return n>0&&(t.type!=u.BulletList||se(r,e,!1)<0)&&r.text.charCodeAt(r.pos+n-1)==t.value}const He={[u.Blockquote](t,e,r){return r.next!=62?!1:(r.markers.push(k(u.QuoteMark,e.lineStart+r.pos,e.lineStart+r.pos+1)),r.moveBase(r.pos+(A(r.text.charCodeAt(r.pos+1))?2:1)),t.end=e.lineStart+r.text.length,!0)},[u.ListItem](t,e,r){return r.indent-1?!1:(r.moveBaseColumn(r.baseIndent+t.value),!0)},[u.OrderedList]:de,[u.BulletList]:de,[u.Document](){return!0}};function A(t){return t==32||t==9||t==10||t==13}function R(t,e=0){for(;er&&A(t.charCodeAt(e-1));)e--;return e}function Pe(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(De.SetextHeading)>-1||n<3?-1:1}function Ne(t,e){for(let r=t.stack.length-1;r>=0;r--)if(t.stack[r].type==e)return!0;return!1}function ie(t,e,r){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||A(t.text.charCodeAt(t.pos+1)))&&(!r||Ne(e,u.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){n++;if(n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||s!=46&&s!=41||nt.pos+1||t.next!=49)?-1:n+1-t.pos}function ye(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e6?-1:r}function Oe(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,Te=/\?>/,ee=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(n);if(i)return t.append(k(u.Comment,r,r+1+i[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(k(u.ProcessingInstruction,r,r+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return a?t.append(k(u.HTMLTag,r,r+1+a[0].length)):-1},Emphasis(t,e,r){if(e!=95&&e!=42)return-1;let n=r+1;for(;t.char(n)==e;)n++;let s=t.slice(r-1,r),i=t.slice(n,n+1),o=F.test(s),a=F.test(i),l=/\s|^$/.test(s),h=/\s|^$/.test(i),f=!h&&(!a||l||o),p=!l&&(!o||h||a),d=f&&(e==42||!p||o),c=p&&(e==42||!f||a);return t.append(new C(e==95?_e:je,r,n,(d?1:0)|(c?2:0)))},HardBreak(t,e,r){if(e==92&&t.char(r+1)==10)return t.append(k(u.HardBreak,r,r+2));if(e==32){let n=r+1;for(;t.char(n)==32;)n++;if(t.char(n)==10&&n>=r+2)return t.append(k(u.HardBreak,r,n+1))}return-1},Link(t,e,r){return e==91?t.append(new C(M,r,r+1,1)):-1},Image(t,e,r){return e==33&&t.char(r+1)==91?t.append(new C(j,r,r+2,1)):-1},LinkEnd(t,e,r){if(e!=93)return-1;for(let n=t.parts.length-1;n>=0;n--){let s=t.parts[n];if(s instanceof C&&(s.type==M||s.type==j)){if(!s.side||t.skipSpace(s.to)==r&&!/[(\[]/.test(t.slice(r+1,r+2)))return t.parts[n]=null,-1;let i=t.takeContent(n),o=t.parts[n]=Mt(t,i,s.type==M?u.Link:u.Image,s.from,r+1);if(s.type==M)for(let a=0;ae?k(u.URL,e+r,i+r):i==t.length?null:!1}}function Qe(t,e,r){let n=t.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let s=n==40?41:n;for(let i=e+1,o=!1;i=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,r){return this.text.slice(e-this.offset,r-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,r,n,s,i){return this.append(new C(e,r,n,(s?1:0)|(i?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let r=this.parts[e];if(r instanceof C&&(r.type==M||r.type==j))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n=e;l--){let g=this.parts[l];if(g instanceof C&&g.side&1&&g.type==s.type&&!(i&&(s.side&1||g.side&2)&&(g.to-g.from+o)%3==0&&((g.to-g.from)%3||o%3))){a=g;break}}if(!a)continue;let h=s.type.resolve,f=[],p=a.from,d=s.to;if(i){let g=Math.min(2,a.to-a.from,o);p=a.to-g,d=s.from+g,h=g==1?"Emphasis":"StrongEmphasis"}a.type.mark&&f.push(this.elt(a.type.mark,p,a.to));for(let g=l+1;g=0;r--){let n=this.parts[r];if(n instanceof C&&n.type==e&&n.side&1)return r}return null}takeContent(e){let r=this.resolveMarkers(e);return this.parts.length=e,r}getDelimiterAt(e){let r=this.parts[e];return r instanceof C?r:null}skipSpace(e){return R(this.text,e-this.offset)+this.offset}elt(e,r,n,s){return typeof e=="string"?k(this.parser.getNodeType(e),r,n,s):new Ue(e,r)}}ae.linkStart=M;ae.imageStart=j;function re(t,e){if(!e.length)return t;if(!t.length)return e;let r=t.slice(),n=0;for(let s of e){for(;n(e?e-1:0))return!1;if(this.fragmentEnd<0){let i=this.fragment.to;for(;i>0&&this.input.read(i-1,i)!=` +`;)i--;this.fragmentEnd=i?i-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let s=e+this.fragment.offset;for(;n.to<=s;)if(!n.parent())return!1;for(;;){if(n.from>=s)return this.fragment.from<=r;if(!n.childAfter(s))return!1}}matches(e){let r=this.cursor.tree;return r&&r.prop(v.contextHash)==e}takeNodes(e){let r=this.cursor,n=this.fragment.offset,s=this.fragmentEnd-(this.fragment.openEnd?1:0),i=e.absoluteLineStart,o=i,a=e.block.children.length,l=o,h=a;for(;;){if(r.to-n>s){if(r.type.isAnonymous&&r.firstChild())continue;break}let f=Ve(r.from-n,e.ranges);if(r.to-n<=e.ranges[e.rangeI].to)e.addNode(r.tree,f);else{let p=new H(e.parser.nodeSet.types[u.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(p,r.tree),e.addNode(p,f)}if(r.type.is("Block")&&(Ht.indexOf(r.type.id)<0?(o=r.to-n,a=e.block.children.length):(o=l,a=h),l=r.to-n,h=e.block.children.length),!r.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-i}}function Ve(t,e){let r=t;for(let n=1;n$[t]),Object.keys($).map(t=>De[t]),Object.keys($),Bt,He,Object.keys(G).map(t=>G[t]),Object.keys(G),[]);function yt(t,e,r){let n=[];for(let s=t.firstChild,i=e;;s=s.nextSibling){let o=s?s.from:r;if(o>i&&n.push({from:i,to:o}),!s)break;i=s.to}return n}function Ot(t){let{codeParser:e,htmlParser:r}=t;return{wrap:ot((s,i)=>{let o=s.type.id;if(e&&(o==u.CodeBlock||o==u.FencedCode)){let a="";if(o==u.FencedCode){let h=s.node.getChild(u.CodeInfo);h&&(a=i.read(h.from,h.to))}let l=e(a);if(l)return{parser:l,overlay:h=>h.type.id==u.CodeText,bracketed:o==u.FencedCode}}else if(r&&(o==u.HTMLBlock||o==u.HTMLTag||o==u.CommentBlock))return{parser:r,overlay:yt(s.node,s.from,s.to)};return null})}}const Rt={resolve:"Strikethrough",mark:"StrikethroughMark"},Tt={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":m.strikethrough}},{name:"StrikethroughMark",style:m.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,r){if(e!=126||t.char(r+1)!=126||t.char(r+2)==126)return-1;let n=t.slice(r-1,r),s=t.slice(r+2,r+3),i=/\s|^$/.test(n),o=/\s|^$/.test(s),a=F.test(n),l=F.test(s);return t.addDelimiter(Rt,r,r+2,!o&&(!l||i||a),!i&&(!a||o||l))},after:"Emphasis"}]};function T(t,e,r=0,n,s=0){let i=0,o=!0,a=-1,l=-1,h=!1,f=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let p=r;p-1)&&i++,o=!1,n&&(a>-1&&f(),n.push(t.elt("TableDelimiter",p+s,p+s+1))),a=l=-1):(h||d!=32&&d!=9)&&(a<0&&(a=p),l=p+1),h=!h&&d==92}return a>-1&&(i++,n&&f()),i}function ge(t,e){for(let r=e;rs instanceof ke)||!ge(e.text,e.basePos))return!1;let n=t.peekLine();return Ge.test(n)&&T(t,e.text,e.basePos)==T(t,n,e.basePos)},before:"SetextHeading"}]};class Dt{nextLine(){return!1}finish(e,r){return e.addLeafElement(r,e.elt("Task",r.start,r.start+r.content.length,[e.elt("TaskMarker",r.start,r.start+3),...e.parser.parseInline(r.content.slice(3),r.start+3)])),!0}}const Ft={defineNodes:[{name:"Task",block:!0,style:m.list},{name:"TaskMarker",style:m.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new Dt:null},after:"SetextHeading"}]},Le=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,be=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,Xt=/[\w-]+\.[\w-]+($|\/)/,we=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Se=/\/[a-zA-Z\d@.]+/gy;function Ce(t,e,r,n){let s=0;for(let i=e;i-1)return-1;let n=e+r[0].length;for(;;){let s=t[n-1],i;if(/[?!.,:*_~]/.test(s)||s==")"&&Ce(t,e,n,")")>Ce(t,e,n,"("))n--;else if(s==";"&&(i=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,n))))n=e+i.index;else break}return n}function Ae(t,e){we.lastIndex=e;let r=we.exec(t);if(!r)return-1;let n=r[0][r[0].length-1];return n=="_"||n=="-"?-1:e+r[0].length-(n=="."?1:0)}const Ut={parseInline:[{name:"Autolink",parse(t,e,r){let n=r-t.offset;if(n&&/\w/.test(t.text[n-1]))return-1;Le.lastIndex=n;let s=Le.exec(t.text),i=-1;if(!s)return-1;if(s[1]||s[2]){if(i=$t(t.text,n+s[0].length),i>-1&&t.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(n,i));i=n+o[0].length}}else s[3]?i=Ae(t.text,n):(i=Ae(t.text,n+s[0].length),i>-1&&s[0]=="xmpp:"&&(Se.lastIndex=i,s=Se.exec(t.text),s&&(i=s.index+s[0].length)));return i<0?-1:(t.addElement(t.elt("URL",r,i+t.offset)),i+t.offset)}}]},_t=[zt,Ft,Tt,Ut];function Ke(t,e,r){return(n,s,i)=>{if(s!=t||n.char(i+1)==t)return-1;let o=[n.elt(r,i,i+1)];for(let a=i+1;a"}}}),Ye=new v,We=Nt.configure({props:[Me.add(t=>!t.is("Block")||t.is("Document")||ne(t)!=null||Zt(t)?void 0:(e,r)=>({from:r.doc.lineAt(e.from).to,to:e.to})),Ye.add(ne),mt.add({Document:()=>null}),gt.add({Document:Je})]});function ne(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function Zt(t){return t.name=="OrderedList"||t.name=="BulletList"}function Vt(t,e){let r=t;for(;;){let n=r.nextSibling,s;if(!n||(s=ne(n.type))!=null&&s<=e)break;r=n}return r.to}const Gt=ht.of((t,e,r)=>{for(let n=X(t).resolveInner(r,-1);n&&!(n.fromr)return{from:r,to:i}}return null});function le(t){return new ft(Je,t,[],"markdown")}const Kt=le(We),Jt=We.configure([_t,qt,jt,Qt,{props:[Me.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),q=le(Jt);function Yt(t,e){return r=>{if(r&&t){let n=null;if(r=/\S*/.exec(r)[0],typeof t=="function"?n=t(r):n=ue.matchLanguageName(t,r,!0),n instanceof ue)return n.support?n.support.language.parser:Lt.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}class K{constructor(e,r,n,s,i,o,a){this.node=e,this.from=r,this.to=n,this.spaceBefore=s,this.spaceAfter=i,this.type=o,this.item=a}blank(e,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length0;s--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(e,r){let n=this.node.name=="OrderedList"?String(+tt(this.item,e)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function et(t,e){let r=[],n=[];for(let s=t;s;s=s.parent){if(s.name=="FencedCode")return n;(s.name=="ListItem"||s.name=="Blockquote")&&r.push(s)}for(let s=r.length-1;s>=0;s--){let i=r[s],o,a=e.lineAt(i.from),l=i.from-a.from;if(i.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))n.push(new K(i,l,l+o[0].length,"",o[1],">",null));else if(i.name=="ListItem"&&i.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let h=o[3],f=o[0].length;h.length>=4&&(h=h.slice(0,h.length-4),f-=4),n.push(new K(i.parent,l,l+f,o[1],h,o[2],i))}else if(i.name=="ListItem"&&i.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let h=o[4],f=o[0].length;h.length>4&&(h=h.slice(0,h.length-4),f-=4);let p=o[2];o[3]&&(p+=o[3].replace(/[xX]/," ")),n.push(new K(i.parent,l,l+f,o[1],h,p,i))}}return n}function tt(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function J(t,e,r,n=0){for(let s=-1,i=t;;){if(i.name=="ListItem"){let a=tt(i,e),l=+a[2];if(s>=0){if(l!=s+1)return;r.push({from:i.from+a[1].length,to:i.from+a[0].length,insert:String(s+2+n)})}s=l}let o=i.nextSibling;if(!o)break;i=o}}function he(t,e){let r=/^[ \t]*/.exec(t)[0].length;if(!r||e.facet(ut)!=" ")return t;let n=z(t,4,r),s="";for(let i=n;i>0;)i>=4?(s+=" ",i-=4):(s+=" ",i--);return s+t.slice(r)}const Wt=(t={})=>({state:e,dispatch:r})=>{let n=X(e),{doc:s}=e,i=null,o=e.changeByRange(a=>{if(!a.empty||!q.isActiveAt(e,a.from,-1)&&!q.isActiveAt(e,a.from,1))return i={range:a};let l=a.from,h=s.lineAt(l),f=et(n.resolveInner(l,-1),s);for(;f.length&&f[f.length-1].from>l-h.from;)f.pop();if(!f.length)return i={range:a};let p=f[f.length-1];if(p.to-p.spaceAfter.length>l-h.from)return i={range:a};let d=l>=p.to-p.spaceAfter.length&&!/\S/.test(h.text.slice(p.to));if(p.item&&d){let w=p.node.firstChild,S=p.node.getChild("ListItem","ListItem");if(w.to>=l||S&&S.to0&&!/[^\s>]/.test(s.lineAt(h.from-1).text)||t.nonTightLists===!1){let b=f.length>1?f[f.length-2]:null,E,I="";b&&b.item?(E=h.from+b.from,I=b.marker(s,1)):E=h.from+(b?b.to:0);let y=[{from:E,to:l,insert:I}];return p.node.name=="OrderedList"&&J(p.item,s,y,-2),b&&b.node.name=="OrderedList"&&J(b.item,s,y),{range:P.cursor(E+I.length),changes:y}}else{let b=Be(f,e,h);return{range:P.cursor(l+b.length+1),changes:{from:h.from,insert:b+e.lineBreak}}}}if(p.node.name=="Blockquote"&&d&&h.from){let w=s.lineAt(h.from-1),S=/>\s*$/.exec(w.text);if(S&&S.index==p.from){let b=e.changes([{from:w.from+S.index,to:w.to},{from:h.from+p.from,to:h.to}]);return{range:a.map(b),changes:b}}}let c=[];p.node.name=="OrderedList"&&J(p.item,s,c);let L=p.item&&p.item.from]*/.exec(h.text)[0].length>=p.to)for(let w=0,S=f.length-1;w<=S;w++)g+=w==S&&!L?f[w].marker(s,1):f[w].blank(wh.from&&/\s/.test(h.text.charAt(B-h.from-1));)B--;return g=he(g,e),tr(p.node,e.doc)&&(g=Be(f,e,h)+e.lineBreak+g),c.push({from:B,to:l,insert:e.lineBreak+g}),{range:P.cursor(B+g.length+1),changes:c}});return i?!1:(r(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},er=Wt();function xe(t){return t.name=="QuoteMark"||t.name=="ListMark"}function tr(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let r=t.firstChild,n=t.getChild("ListItem","ListItem");if(!n)return!1;let s=e.lineAt(r.to),i=e.lineAt(n.from),o=/^[\s>]*$/.test(s.text);return s.number+(o?0:1){let r=X(t),n=null,s=t.changeByRange(i=>{let o=i.from,{doc:a}=t;if(i.empty&&q.isActiveAt(t,i.from)){let l=a.lineAt(o),h=et(rr(r,o),a);if(h.length){let f=h[h.length-1],p=f.to-f.spaceAfter.length+(f.spaceAfter?1:0);if(o-l.from>p&&!/\S/.test(l.text.slice(p,o-l.from)))return{range:P.cursor(l.from+p),changes:{from:l.from+p,to:o}};if(o-l.from==p&&(!f.item||l.from<=f.item.from||!/\S/.test(l.text.slice(0,f.to)))){let d=l.from+f.from;if(f.item&&f.node.from{var r;let{main:n}=e.state.selection;if(n.empty)return!1;let s=(r=t.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!q.isActiveAt(e.state,n.from,1)))return!1;let i=X(e.state),o=!1;return i.iterate({from:n.from,to:n.to,enter:a=>{(a.from>n.from||ar.test(a.name))&&(o=!0)},leave:a=>{a.to=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57}function Pe(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function h(t,e,r){for(let a=!1;;){if(t.next<0)return;if(t.next==e&&!a){t.advance();return}a=r&&!a&&t.next==92,t.advance()}}function Te(t,e){e:for(;;){if(t.next<0)return;if(t.next==36){t.advance();for(let r=0;r)".charCodeAt(r);for(;;){if(t.next<0)return;if(t.next==a&&t.peek(1)==39){t.advance(2);return}t.advance()}}function S(t,e){for(;!(t.next!=95&&!C(t.next));)e!=null&&(e+=String.fromCharCode(t.next)),t.advance();return e}function qe(t){if(t.next==39||t.next==34||t.next==96){let e=t.next;t.advance(),h(t,e,!1)}else S(t)}function z(t,e){for(;t.next==48||t.next==49;)t.advance();e&&t.next==e&&t.advance()}function Z(t,e){for(;;){if(t.next==46){if(e)break;e=!0}else if(t.next<48||t.next>57)break;t.advance()}if(t.next==69||t.next==101)for(t.advance(),(t.next==43||t.next==45)&&t.advance();t.next>=48&&t.next<=57;)t.advance()}function D(t){for(;!(t.next<0||t.next==10);)t.advance()}function O(t,e){for(let r=0;r!=&|~^/",specialVar:"?",identifierQuotes:'"',caseInsensitiveIdentifiers:!1,words:V(F,W)};function Be(t,e,r,a){let n={};for(let s in P)n[s]=(t.hasOwnProperty(s)?t:P)[s];return e&&(n.words=V(e,r||"",a)),n}function K(t){return new le(e=>{var r;let{next:a}=e;if(e.advance(),O(a,w)){for(;O(e.next,w);)e.advance();e.acceptToken(de)}else if(a==36&&t.doubleDollarQuotedStrings){let n=S(e,"");e.next==36&&(e.advance(),Te(e,n),e.acceptToken(g))}else if(a==39||a==34&&t.doubleQuotedStrings)h(e,a,t.backslashEscapes),e.acceptToken(g);else if(a==35&&t.hashComments||a==47&&e.next==47&&t.slashComments)D(e),e.acceptToken(X);else if(a==45&&e.next==45&&(!t.spaceAfterDashes||e.peek(1)==32))D(e),e.acceptToken(X);else if(a==47&&e.next==42){e.advance();for(let n=1;;){let s=e.next;if(e.next<0)break;if(e.advance(),s==42&&e.next==47){if(n--,e.advance(),!n)break}else s==47&&e.next==42&&(n++,e.advance())}e.acceptToken(fe)}else if((a==101||a==69)&&e.next==39)e.advance(),h(e,39,!0),e.acceptToken(g);else if((a==110||a==78)&&e.next==39&&t.charSetCasts)e.advance(),h(e,39,t.backslashEscapes),e.acceptToken(g);else if(a==95&&t.charSetCasts)for(let n=0;;n++){if(e.next==39&&n>1){e.advance(),h(e,39,t.backslashEscapes),e.acceptToken(g);break}if(!C(e.next))break;e.advance()}else if(t.plsqlQuotingMechanism&&(a==113||a==81)&&e.next==39&&e.peek(1)>0&&!O(e.peek(1),w)){let n=e.peek(1);e.advance(2),Ue(e,n),e.acceptToken(g)}else if(O(a,t.identifierQuotes)){const n=a==91?93:a;h(e,n,!1),e.acceptToken(we)}else if(a==40)e.acceptToken(Oe);else if(a==41)e.acceptToken(he);else if(a==123)e.acceptToken(ge);else if(a==125)e.acceptToken(ke);else if(a==91)e.acceptToken(ve);else if(a==93)e.acceptToken(pe);else if(a==59)e.acceptToken(be);else if(t.unquotedBitLiterals&&a==48&&e.next==98)e.advance(),z(e),e.acceptToken(R);else if((a==98||a==66)&&(e.next==39||e.next==34)){const n=e.next;e.advance(),t.treatBitsAsBytes?(h(e,n,t.backslashEscapes),e.acceptToken(Ce)):(z(e,n),e.acceptToken(R))}else if(a==48&&(e.next==120||e.next==88)||(a==120||a==88)&&e.next==39){let n=e.next==39;for(e.advance();Pe(e.next);)e.advance();n&&e.next==39&&e.advance(),e.acceptToken(_)}else if(a==46&&e.next>=48&&e.next<=57)Z(e,!0),e.acceptToken(_);else if(a==46)e.acceptToken(Qe);else if(a>=48&&a<=57)Z(e,!1),e.acceptToken(_);else if(O(a,t.operatorChars)){for(;O(e.next,t.operatorChars);)e.advance();e.acceptToken(xe)}else if(O(a,t.specialVar))e.next==a&&e.advance(),qe(e),e.acceptToken(_e);else if(a==58||a==44)e.acceptToken(ye);else if(C(a)){let n=S(e,String.fromCharCode(a));e.acceptToken(e.next==46||e.peek(-n.length-1)==46?I:(r=t.words[n.toLowerCase()])!==null&&r!==void 0?r:I)}})}const G=K(P),Le=ce.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,G],topRules:{Script:[0,25]},tokenPrec:0});function T(t){let e=t.cursor().moveTo(t.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function p(t,e){let r=t.sliceString(e.from,e.to),a=/^([`'"\[])(.*)([`'"\]])$/.exec(r);return a?a[2]:r}function y(t){return t&&(t.name=="Identifier"||t.name=="QuotedIdentifier")}function Xe(t,e){if(e.name=="CompositeIdentifier"){let r=[];for(let a=e.firstChild;a;a=a.nextSibling)y(a)&&r.push(p(t,a));return r}return[p(t,e)]}function j(t,e){for(let r=[];;){if(!e||e.name!=".")return r;let a=T(e);if(!y(a))return r;r.unshift(p(t,a)),e=T(a)}}function Ie(t,e){let r=ie(t).resolveInner(e,-1),a=ze(t.doc,r);return r.name=="Identifier"||r.name=="QuotedIdentifier"||r.name=="Keyword"?{from:r.from,quoted:r.name=="QuotedIdentifier"?t.doc.sliceString(r.from,r.from+1):null,parents:j(t.doc,T(r)),aliases:a}:r.name=="."?{from:e,quoted:null,parents:j(t.doc,r),aliases:a}:{from:e,quoted:null,parents:[],empty:!0,aliases:a}}const Re=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function ze(t,e){let r;for(let n=e;!r;n=n.parent){if(!n)return null;n.name=="Statement"&&(r=n)}let a=null;for(let n=r.firstChild,s=!1,c=null;n;n=n.nextSibling){let l=n.name=="Keyword"?t.sliceString(n.from,n.to).toLowerCase():null,i=null;if(!s)s=l=="from";else if(l=="as"&&c&&y(n.nextSibling))i=p(t,n.nextSibling);else{if(l&&Re.has(l))break;c&&y(n)&&(i=p(t,n))}i&&(a||(a=Object.create(null)),a[i]=Xe(t,c)),c=/Identifier$/.test(n.name)?n:null}return a}function Ze(t,e,r){return r.map(a=>({...a,label:a.label[0]==t?a.label:t+a.label+e,apply:void 0}))}const De=/^\w*$/,je=/^[`'"\[]?\w*[`'"\]]?$/;function N(t){return t.self&&typeof t.self.label=="string"}class U{constructor(e,r){this.idQuote=e,this.idCaseInsensitive=r,this.list=[],this.children=void 0}child(e){let r=this.children||(this.children=Object.create(null)),a=r[e];return a||(e&&!this.list.some(n=>n.label==e)&&this.list.push(E(e,"type",this.idQuote,this.idCaseInsensitive)),r[e]=new U(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let r=this.list.findIndex(a=>a.label==e.label);r>-1?this.list[r]=e:this.list.push(e)}addCompletions(e){for(let r of e)this.addCompletion(typeof r=="string"?E(r,"property",this.idQuote,this.idCaseInsensitive):r)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):N(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let r of Object.keys(e)){let a=e[r],n=null,s=r.replace(/\\?\./g,l=>l=="."?"\0":l).split("\0"),c=this;N(a)&&(n=a.self,a=a.children);for(let l=0;l{let{parents:k,from:B,quoted:L,empty:Y,aliases:Q}=Ie(m.state,m.pos);if(Y&&!m.explicit)return null;Q&&k.length==1&&(k=Q[k[0]]||k);let d=i;for(let u of k){for(;!d.children||!d.children[u];)if(d==i&&f)d=f;else if(d==f&&a)d=d.child(a);else return null;let v=d.maybeChild(u);if(!v)return null;d=v}let x=d.list;if(d==i&&Q&&(x=x.concat(Object.keys(Q).map(u=>({label:u,type:"constant"})))),L){let u=L[0],v=M(u),H=m.state.sliceDoc(m.pos,m.pos+1)==v;return{from:B,to:H?m.pos+1:void 0,options:Ze(u,v,x),validFor:je}}else return{from:B,options:x,validFor:De}}}function Ee(t){return t==A?"type":t==$?"keyword":"variable"}function $e(t,e,r){let a=Object.keys(t).map(n=>r(e?n.toUpperCase():n,Ee(t[n])));return te(["QuotedIdentifier","String","LineComment","BlockComment","."],ae(a))}let Ae=Le.configure({props:[re.add({Statement:ne()}),oe.add({Statement(t,e){return{from:Math.min(t.from+100,e.doc.lineAt(t.from).to),to:t.to}},BlockComment(t){return{from:t.from+2,to:t.to-2}}}),se({Keyword:o.keyword,Type:o.typeName,Builtin:o.standard(o.name),Bits:o.number,Bytes:o.string,Bool:o.bool,Null:o.null,Number:o.number,String:o.string,Identifier:o.name,QuotedIdentifier:o.special(o.string),SpecialVar:o.special(o.name),LineComment:o.lineComment,BlockComment:o.blockComment,Operator:o.operator,"Semi Punctuation":o.punctuation,"( )":o.paren,"{ }":o.brace,"[ ]":o.squareBracket})]});class b{constructor(e,r,a){this.dialect=e,this.language=r,this.spec=a}get extension(){return this.language.extension}configureLanguage(e,r){return new b(this.dialect,this.language.configure(e,r),this.spec)}static define(e){let r=Be(e,e.keywords,e.types,e.builtin),a=ee.define({name:"sql",parser:Ae.configure({tokenizers:[{from:G,to:K(r)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new b(r,a,e)}}function Ve(t,e){return{label:t,type:e,boost:-1}}function We(t,e=!1,r){return $e(t.dialect.words,e,r||Ve)}function Fe(t){return t.schema?Ne(t.schema,t.tables,t.schemas,t.defaultTable,t.defaultSchema,t.dialect||q):()=>null}function Ke(t){return t.schema?(t.dialect||q).language.data.of({autocomplete:Fe(t)}):[]}function tt(t={}){let e=t.dialect||q;return new J(e.language,[Ke(t),e.language.data.of({autocomplete:We(e,t.upperCaseKeywords,t.keywordCompletion)})])}const q=b.define({}),Ge="accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill",Me=W+"bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int1 int2 int3 int4 int8 float4 float8 varbinary varcharacter precision datetime unsigned signed",Ye="charset clear edit ego help nopager notee nowarning pager print prompt quit rehash source status system tee",at=b.define({operatorChars:"*+-%<>!=&|^",charSetCasts:!0,doubleQuotedStrings:!0,unquotedBitLiterals:!0,hashComments:!0,spaceAfterDashes:!0,specialVar:"@?",identifierQuotes:"`",keywords:F+"group_concat "+Ge,types:Me,builtin:Ye});export{at as MySQL,b as SQLDialect,q as StandardSQL,We as keywordCompletionSource,Fe as schemaCompletionSource,tt as sql}; diff --git a/apps/studio/dist/static/index-DEKWc3j5.js b/apps/studio/dist/static/index-DEKWc3j5.js new file mode 100644 index 00000000..f88d4944 --- /dev/null +++ b/apps/studio/dist/static/index-DEKWc3j5.js @@ -0,0 +1 @@ +import{L as r}from"./index-9VbysdZK.js";import{r as e,t as O,L as s,v as X,w as l,$ as Y,x as $,y as S,z as o,A as t}from"./index-DznCqw2V.js";import"./sanity-BZuh2pfi.js";const Z=e({null:O.null,instanceof:O.operatorKeyword,this:O.self,"new super assert open to with void":O.keyword,"class interface extends implements enum var":O.definitionKeyword,"module package import":O.moduleKeyword,"switch while for if else case default do break continue return try catch finally throw":O.controlKeyword,"requires exports opens uses provides public private protected static transitive abstract final strictfp synchronized native transient volatile throws":O.modifier,IntegerLiteral:O.integer,FloatingPointLiteral:O.float,"StringLiteral TextBlock":O.string,CharacterLiteral:O.character,LineComment:O.lineComment,BlockComment:O.blockComment,BooleanLiteral:O.bool,PrimitiveType:O.standard(O.typeName),TypeName:O.typeName,Identifier:O.variableName,"MethodName/Identifier":O.function(O.variableName),Definition:O.definition(O.variableName),ArithOp:O.arithmeticOperator,LogicOp:O.logicOperator,BitOp:O.bitwiseOperator,CompareOp:O.compareOperator,AssignOp:O.definitionOperator,UpdateOp:O.updateOperator,Asterisk:O.punctuation,Label:O.labelName,"( )":O.paren,"[ ]":O.squareBracket,"{ }":O.brace,".":O.derefOperator,", ;":O.separator}),n={__proto__:null,true:34,false:34,null:42,void:46,byte:48,short:48,int:48,long:48,char:48,float:48,double:48,boolean:48,extends:62,super:64,class:76,this:78,new:84,public:100,protected:102,private:104,abstract:106,static:108,final:110,strictfp:112,default:114,synchronized:116,native:118,transient:120,volatile:122,throws:150,implements:160,interface:166,enum:176,instanceof:238,open:267,module:269,requires:274,transitive:276,exports:278,to:280,opens:282,uses:284,provides:286,with:288,package:292,import:296,if:308,else:310,while:314,for:318,var:325,assert:332,switch:336,case:342,do:346,break:350,continue:354,return:358,throw:364,try:368,catch:372,finally:380},d=r.deserialize({version:14,states:"##jQ]QPOOQ$wQPOOO(bQQO'#H^O*iQQO'#CbOOQO'#Cb'#CbO*pQPO'#CaO*xOSO'#CpOOQO'#Hc'#HcOOQO'#Cu'#CuO,eQPO'#D_O-OQQO'#HmOOQO'#Hm'#HmO/gQQO'#HhO/nQQO'#HhOOQO'#Hh'#HhOOQO'#Hg'#HgO1rQPO'#DUO2PQPO'#GnO4wQPO'#D_O5OQPO'#DzO*pQPO'#E[O5qQPO'#E[OOQO'#DV'#DVO7SQQO'#HaO9^QQO'#EeO9eQPO'#EdO9jQPO'#EfOOQO'#Hb'#HbO7jQQO'#HbO:pQQO'#FhO:wQPO'#ExO:|QPO'#E}O:|QPO'#FPOOQO'#Ha'#HaOOQO'#HY'#HYOOQO'#Gh'#GhOOQO'#HX'#HXO<^QPO'#FiOOQO'#HW'#HWOOQO'#Gg'#GgQ]QPOOOOQO'#Hs'#HsOQQPO'#GSO>]QPO'#GUO=kQPO'#GWO:|QPO'#GXO>dQPO'#GZO?QQQO'#HiO?mQQO'#CuO?tQPO'#HxO@SQPO'#D_O@rQPO'#DpO?wQPO'#DqO@|QPO'#HxOA_QPO'#DpOAgQPO'#IROAlQPO'#E`OOQO'#Hr'#HrOOQO'#Gm'#GmQ$wQPOOOAtQPO'#HsOOQO'#H^'#H^OCsQQO,58{OOQO'#H['#H[OOOO'#Gi'#GiOEfOSO,59[OOQO,59[,59[OOQO'#Hi'#HiOFVQPO,59eOGXQPO,59yOOQO-E:f-E:fO*pQPO,58zOG{QPO,58zO*pQPO,5;}OHQQPO'#DQOHVQPO'#DQOOQO'#Gk'#GkOIVQQO,59jOOQO'#Dm'#DmOJqQPO'#HuOJ{QPO'#DlOKZQPO'#HtOKcQPO,5<_OKhQPO,59^OLRQPO'#CxOOQO,59c,59cOLYQPO,59bOLeQQO'#H^ONgQQO'#CbO!!iQPO'#D_O!#nQQO'#HmO!$OQQO,59pO!$VQPO'#DvO!$eQPO'#H|O!$mQPO,5:`O!$rQPO,5:`O!%YQPO,5;nO!%eQPO'#ITO!%pQPO,5;eO!%uQPO,5=YOOQO-E:l-E:lOOQO,5:f,5:fO!']QPO,5:fO!'dQPO,5:vO?tQPO,5<_O*pQPO,5:vO_,5>_O!*sQPO,5:gO!+RQPO,5:qO!+ZQPO,5:lO!+fQPO,5>[O!$VQPO,5>[O!'iQPO,59UO!+qQQO,58zO!+yQQO,5;}O!,RQQO,5gQPO,5gQPO,5<}O!2mQPO,59jO!2zQPO'#HuO!3RQPO,59xO!3WQPO,5>dO?tQPO,59xO!3cQPO,5:[OAlQPO,5:zO!3kQPO'#DrO?wQPO'#DrO!3vQPO'#HyO!4OQPO,5:]O?tQPO,5>dO!(hQPO,5>dOAgQPO,5>mOOQO,5:[,5:[O!$rQPO'#DtOOQO,5>m,5>mO!4TQPO'#EaOOQO,5:z,5:zO!7UQPO,5:zO!(hQPO'#DxOOQO-E:k-E:kOOQO,5:y,5:yO*pQPO,58}O!7ZQPO'#ChOOQO1G.k1G.kOOOO-E:g-E:gOOQO1G.v1G.vO!+qQQO1G.fO*pQPO1G.fO!7eQQO1G1iOOQO,59l,59lO!7mQPO,59lOOQO-E:i-E:iO!7rQPO,5>aO!8ZQPO,5:WO`OOQO1G1y1G1yOOQO1G.x1G.xO!8{QPO'#CyO!9kQPO'#HmO!9uQPO'#CzO!:TQPO'#HlO!:]QPO,59dOOQO1G.|1G.|OLYQPO1G.|O!:sQPO,59eO!;QQQO'#H^O!;cQQO'#CbOOQO,5:b,5:bOhOOQO1G/z1G/zO!oOOQO1G1P1G1POOQO1G0Q1G0QO!=oQPO'#E]OOQO1G0b1G0bO!>`QPO1G1yO!'dQPO1G0bO!*sQPO1G0RO!+RQPO1G0]O!+ZQPO1G0WOOQO1G/]1G/]O!>eQQO1G.pO9eQPO1G0jO*pQPO1G0jOgQPO'#GaOOQO1G2a1G2aO#2zQPO1G2iO#6xQPO,5>gOOQO1G/d1G/dOOQO1G4O1G4OO#7ZQPO1G/dOOQO1G/v1G/vOOQO1G0f1G0fO!7UQPO1G0fOOQO,5:^,5:^O!(hQPO'#DsO#7`QPO,5:^O?wQPO'#GrO#7kQPO,5>eOOQO1G/w1G/wOAgQPO'#H{O#7sQPO1G4OO?tQPO1G4OOOQO1G4X1G4XO!#YQPO'#DvO!!iQPO'#D_OOQO,5:{,5:{O#8OQPO,5:{O#8OQPO,5:{O#8VQQO'#HaO#9hQQO'#HbO#9rQQO'#EbO#9}QPO'#EbO#:VQPO'#IOOOQO,5:d,5:dOOQO1G.i1G.iO#:bQQO'#EeO#:rQQO'#H`O#;SQPO'#FTOOQO'#H`'#H`O#;^QPO'#H`O#;{QPO'#IWO#WOOQO1G/O1G/OOOQO7+$h7+$hOOQO1G/{1G/{O#=cQQO1G/{OOQO1G/}1G/}O#=hQPO1G/{OOQO1G/|1G/|OdQPO,5:wOOQO,5:w,5:wOOQO7+'e7+'eOOQO7+%|7+%|OOQO7+%m7+%mO!KqQPO7+%mO!KvQPO7+%mO!LOQPO7+%mOOQO7+%w7+%wO!LnQPO7+%wOOQO7+%r7+%rO!MmQPO7+%rO!MrQPO7+%rOOQO7+&U7+&UOOQO'#Ee'#EeO9eQPO7+&UO9eQPO,5>[O#?TQPO7+$[OOQO7+&T7+&TOOQO7+&W7+&WO:|QPO'#GlO#?cQPO,5>]OOQO1G/_1G/_O:|QPO7+&lO#?nQQO,59eO#@tQPO,59vOOQO,59v,59vOOQO,5:h,5:hOOQO'#EP'#EPOOQO,5:i,5:iO#@{QPO'#EYOgQPO,5jO#M{QPO,59TO#NSQPO'#IVO#N[QPO,5;oO*pQPO'#G{O#NaQPO,5>rOOQO1G.n1G.nOOQO<Z,5>ZOOQO,5=U,5=UOOQO-E:h-E:hO#NvQPO7+%gOOQO7+%g7+%gOOQO7+%i7+%iOOQO<kO$%tQPO'#EZOOQO1G0_1G0_O$%{QPO1G0_O?tQPO,5:pOOQO-E:s-E:sOOQO1G0Z1G0ZOOQO1G0n1G0nO$&QQQO1G0nOOQO<qOOQO1G1Z1G1ZO$+dQPO'#FUOOQO,5=g,5=gOOQO-E:y-E:yO$+iQPO'#GoO$+vQPO,5>cOOQO1G/u1G/uOOQO<sAN>sO!KqQPOAN>sOOQOAN>xAN>xOOQOAN?[AN?[O9eQPOAN?[OOQO1G0`1G0`O$,_QPO1G0`OOQO,5=b,5=bOOQO-E:t-E:tO$,mQPO,5:uOOQO7+%y7+%yOOQO7+&Y7+&YOOQO1G1`1G1`O$,tQQO1G1`OOQO-E:{-E:{O$,|QQO'#IYO$,wQPO1G1`O$&gQPO1G1`O*pQPO1G1`OOQOAN@]AN@]O$-XQQO<tO$.qQPO7+&zO$.vQQO'#IZOOQOAN@nAN@nO$/RQQOAN@nOOQOAN@jAN@jO$/YQPOAN@jO$/_QQO<uOOQOG26YG26YOOQOG26UG26UOOQO<lOWiXuiX%}iX&PiX&RiX&_iX~OZ!aX~P?XOu#OO%}TO&P#SO&R#SO~O%}TO~P3gOg^Oh^Ov#pO!u#rO!z#qO&_!hO&t#oO~O&P!cO&R!dO~P@ZOg^Oh^O%}TO&P!cO&R!dO~O}cO!P%aO~OZ%bO~O}%dO!m%gO~O}cOg&gXh&gXv&gX!S&gX!T&gX!U&gX!V&gX!W&gX!X&gX!Y&gX!Z&gX!]&gX!^&gX!_&gX!u&gX!z&gX%}&gX&P&gX&R&gX&_&gX&t&gX~OW%jOZ%kOgTahTa%}Ta&PTa&RTa~OvTa!STa!TTa!UTa!VTa!WTa!XTa!YTa!ZTa!]Ta!^Ta!_Ta!uTa!zTa#yTa#zTa$WTa$hTa&tTa&_TauTaYTaqTa|Ta!PTa~PC[O&W%nO&Y!tO~Ou#OO%}TOqma&^maYma&nma!Pma~O&vma}ma!rma~PEnO!SyO!TyO!UyO!VyO!WyO!XyO!YyO!ZzO!]yO!^yO!_yO~Og!Rah!Rav!Ra!u!Ra!z!Ra$h!Ra&P!Ra&R!Ra&t!Ra&_!Ra~PFdO#z%pO~Os%rO~Ou%sO%}TO~Ou#OO%}ra&Pra&Rra&vraYrawra&nra&qra!Pra&^raqra~OWra#_ra#ara#bra#dra#era#fra#gra#hra#ira#kra#ora#rra&_ra#prasra|ra~PH_Ou#OO%}TOq&iX!P&iX!b&iX~OY&iX#p&iX~PJ`O!b%vOq!`X!P!`XY!`X~Oq%wO!P&hX~O!P%yO~Ov%zO~Og^Oh^O%}0oO&P!wO&RWO&b%}O~O&^&`P~PKmO%}TO&P!wO&RWO~OW&QXYiXY!aXY&QXZ&QXq!aXu&QXwiX!b&QX#]&QX#_&QX#a&QX#b&QX#d&QX#e&QX#f&QX#g&QX#h&QX#i&QX#k&QX#o&QX#r&QX&^&QX&_&QX&niX&n&QX&qiX&viX&v&QX&x!aX~P?XOWUXYUXY!aXY&]XZUXq!aXuUXw&]X!bUX#]UX#_UX#aUX#bUX#dUX#eUX#fUX#gUX#hUX#iUX#kUX#oUX#rUX&^UX&_UX&nUX&n&]X&q&]X&vUX&v&]X&x!aX~P>lOg^Oh^O%}TO&P!wO&RWOg!RXh!RX&P!RX&R!RX~PFdOu#OOw&XO%}TO&P&UO&R&TO&q&WO~OW#XOY&aX&n&aX&v&aX~P!#YOY&ZO~P9oOg^Oh^O&P!wO&RWO~Oq&]OY&pX~OY&_O~Og^Oh^O%}TO&P!wO&RWOY&pP~PFdOY&dO&n&bO&v#vO~Oq&eO&x$ZOY&wX~OY&gO~O%}TOg%bah%bav%ba!S%ba!T%ba!U%ba!V%ba!W%ba!X%ba!Y%ba!Z%ba!]%ba!^%ba!_%ba!u%ba!z%ba$h%ba&P%ba&R%ba&t%ba&_%ba~O|&hO~P]O}&iO~Op&uOw&vO&PSO&R!qO&_#YO~Oz&tO~P!'iOz&xO&PSO&R!qO&_#YO~OY&eP~P:|Og^Oh^O%}TO&P!wO&RWO~O}cO~P:|OW#XOu#OO%}TO&v&aX~O#r$WO!P#sa#_#sa#a#sa#b#sa#d#sa#e#sa#f#sa#g#sa#h#sa#i#sa#k#sa#o#sa&^#sa&_#sa&n#saY#sa#p#sas#saq#sa|#sa~Oo'_O}'^O!r'`O&_!hO~O}'eO!r'`O~Oo'iO}'hO&_!hO~OZ#xOu'mO%}TO~OW%jO}'sO~OW%jO!P'uO~OW'vO!P'wO~O$h!WO&P0qO&R0pO!P&eP~P/uO!P(SO#p(TO~P9oO}(UO~O$c(WO~O!P(XO~O!P(YO~O!P(ZO~P9oO!P(]O~P9oOZ$lO_VO`VOaVObVOcVOeVOg^Oh^Op!POwkOz!OO%}TO&P(_O&R(^O&XUO~PFdO%Q(hO%U(iOZ$}a_$}a`$}aa$}ab$}ac$}ae$}ag$}ah$}ap$}av$}aw$}az$}a}$}a!P$}a!S$}a!T$}a!U$}a!V$}a!W$}a!X$}a!Y$}a!Z$}a![$}a!]$}a!^$}a!_$}a!u$}a!z$}a#f$}a#r$}a#t$}a#u$}a#y$}a#z$}a$W$}a$Y$}a$`$}a$c$}a$e$}a$h$}a$l$}a$n$}a$s$}a$u$}a$w$}a$y$}a$|$}a%O$}a%w$}a%}$}a&P$}a&R$}a&X$}a&t$}a|$}a$a$}a$q$}a~O}ra!rra'Ora~PH_OZ%bO~PJ`O!P(mO~O!m%gO}&la!P&la~O}cO!P(pO~Oo(tOq!fX&^!fX~Oq(vO&^&mX~O&^(xO~OZ`O_VO`VOaVObVOcVOeVOg^Oh^Op)UOv{Ow)TOz!OO|)PO}cO!PvO![!`O!u}O!z|O#fpO#roO#tpO#upO#y!RO#z!QO$W!SO$Y!TO$`!UO$c!VO$e!XO$h!WO$l!YO$n!ZO$s![O$u!]O$w!^O$y!_O$|!aO%O!bO%}TO&PRO&RQO&XUO&_#YO&tdO~PFdO}%dO~O})]OY&zP~P:|OW%jO!P)dO~Os)eO~Ou#OO%}TOq&ia!P&ia!b&iaY&ia#p&ia~O})fO~P:|Oq%wO!P&ha~Og^Oh^O%}0oO&P!wO&RWO~O&b)mO~P!8jOu#OO%}TOq&aX&^&aXY&aX&n&aX!P&aX~O}&aX!r&aX~P!9SOo)oOp)oOqnX&^nX~Oq)pO&^&`X~O&^)rO~Ou#OOw)tO%}TO&PSO&R!qO~OYma&nma&vma~P!:bOW&QXY!aXq!aXu!aX%}!aX~OWUXY!aXq!aXu!aX%}!aX~OW)wO~Ou#OO%}TO&P#SO&R#SO&q)yO~Og^Oh^O%}TO&P!wO&RWO~PFdOq&]OY&pa~Ou#OO%}TO&P#SO&R#SO&q&WO~OY)|O~OY*PO&n&bO~Oq&eOY&wa~Og^Oh^Ov{O|*XO!u}O%}TO&P!wO&RWO&tdO~PFdO!P*YO~OW^iZ#XXu^i!P^i!b^i#]^i#_^i#a^i#b^i#d^i#e^i#f^i#g^i#h^i#i^i#k^i#o^i#r^i&^^i&_^i&n^i&v^iY^i#p^is^iq^i|^i~OW*iO~Os*jO~P9oOz*kO&PSO&R!qO~O!P]iY]i#p]is]iq]i|]i~P9oOq*lOY&eX!P&eX~P9oOY*nO~O#f$SO#g$TO#k$YO#r$WO!P#^i#_#^i#a#^i#b#^i#d#^i#e#^i#o#^i&^#^i&_#^i&n#^iY#^i#p#^is#^iq#^i|#^i~O#h$UO#i$UO~P!AmO#_#|O#d$QO#e$RO#f$SO#g$TO#h$UO#i$UO#k$YO#r$WO&^#zO&_#zO&n#{O!P#^i#b#^i#o#^iY#^i#p#^is#^iq#^i|#^i~O#a#^i~P!CUO#a#}O~P!CUO#_#|O#f$SO#g$TO#h$UO#i$UO#k$YO#r$WO&^#zO&_#zO!P#^i#a#^i#b#^i#d#^i#e#^i#o#^iY#^i#p#^is#^iq#^i|#^i~O&n#^i~P!DtO&n#{O~P!DtO#f$SO#g$TO#k$YO#r$WO!P#^i#a#^i#b#^i#e#^i#o#^iY#^i#p#^is#^iq#^i|#^i~O#_#|O#d$QO#h$UO#i$UO&^#zO&_#zO&n#{O~P!FdO#k$YO#r$WO!P#^i#_#^i#a#^i#b#^i#d#^i#e#^i#f#^i#h#^i#i#^i#o#^i&^#^i&_#^i&n#^iY#^i#p#^is#^iq#^i|#^i~O#g$TO~P!G{O#g#^i~P!G{O#h#^i#i#^i~P!AmO#p*oO~P9oO#_&aX#a&aX#b&aX#d&aX#e&aX#f&aX#g&aX#h&aX#i&aX#k&aX#o&aX#r&aX&_&aX#p&aXs&aX|&aX~P!9SO!P#liY#li#p#lis#liq#li|#li~P9oO|*rO~P$wO}'^O~O}'^O!r'`O~Oo'_O}'^O!r'`O~O%}TO&P#SO&R#SO|&sP!P&sP~PFdO}'eO~Og^Oh^Ov{O|+PO!P*}O!u}O!z|O%}TO&P!wO&RWO&_!hO&tdO~PFdO}'hO~Oo'iO}'hO~Os+RO~P:|Ou+TO%}TO~Ou'mO})fO%}TOW#Zi!P#Zi#_#Zi#a#Zi#b#Zi#d#Zi#e#Zi#f#Zi#g#Zi#h#Zi#i#Zi#k#Zi#o#Zi#r#Zi&^#Zi&_#Zi&n#Zi&v#ZiY#Zi#p#Zis#Ziq#Zi|#Zi~O}'^OW&diu&di!P&di#_&di#a&di#b&di#d&di#e&di#f&di#g&di#h&di#i&di#k&di#o&di#r&di&^&di&_&di&n&di&v&diY&di#p&dis&diq&di|&di~O#}+]O$P+^O$R+^O$S+_O$T+`O~O|+[O~P##nO$Z+aO&PSO&R!qO~OW+bO!P+cO~O$a+dOZ$_i_$_i`$_ia$_ib$_ic$_ie$_ig$_ih$_ip$_iv$_iw$_iz$_i}$_i!P$_i!S$_i!T$_i!U$_i!V$_i!W$_i!X$_i!Y$_i!Z$_i![$_i!]$_i!^$_i!_$_i!u$_i!z$_i#f$_i#r$_i#t$_i#u$_i#y$_i#z$_i$W$_i$Y$_i$`$_i$c$_i$e$_i$h$_i$l$_i$n$_i$s$_i$u$_i$w$_i$y$_i$|$_i%O$_i%w$_i%}$_i&P$_i&R$_i&X$_i&t$_i|$_i$q$_i~Og^Oh^O$h#sO&P!wO&RWO~O!P+hO~P:|O!P+iO~OZ`O_VO`VOaVObVOcVOeVOg^Oh^Op!POv{OwkOz!OO}cO!PvO!SyO!TyO!UyO!VyO!WyO!XyO!YyO!Z+nO![!`O!]yO!^yO!_yO!u}O!z|O#fpO#roO#tpO#upO#y!RO#z!QO$W!SO$Y!TO$`!UO$c!VO$e!XO$h!WO$l!YO$n!ZO$q+oO$s![O$u!]O$w!^O$y!_O$|!aO%O!bO%}TO&PRO&RQO&XUO&tdO~O|+mO~P#)QOW&QXY&QXZ&QXu&QX!P&QX&viX&v&QX~P?XOWUXYUXZUXuUX!PUX&vUX&v&]X~P>lOW#tOu#uO&v#vO~OW&UXY%XXu&UX!P%XX&v&UX~OZ#XX~P#.VOY+uO!P+sO~O%Q(hO%U(iOZ$}i_$}i`$}ia$}ib$}ic$}ie$}ig$}ih$}ip$}iv$}iw$}iz$}i}$}i!P$}i!S$}i!T$}i!U$}i!V$}i!W$}i!X$}i!Y$}i!Z$}i![$}i!]$}i!^$}i!_$}i!u$}i!z$}i#f$}i#r$}i#t$}i#u$}i#y$}i#z$}i$W$}i$Y$}i$`$}i$c$}i$e$}i$h$}i$l$}i$n$}i$s$}i$u$}i$w$}i$y$}i$|$}i%O$}i%w$}i%}$}i&P$}i&R$}i&X$}i&t$}i|$}i$a$}i$q$}i~OZ+xO~O%Q(hO%U(iOZ%Vi_%Vi`%Via%Vib%Vic%Vie%Vig%Vih%Vip%Viv%Viw%Viz%Vi}%Vi!P%Vi!S%Vi!T%Vi!U%Vi!V%Vi!W%Vi!X%Vi!Y%Vi!Z%Vi![%Vi!]%Vi!^%Vi!_%Vi!u%Vi!z%Vi#f%Vi#r%Vi#t%Vi#u%Vi#y%Vi#z%Vi$W%Vi$Y%Vi$`%Vi$c%Vi$e%Vi$h%Vi$l%Vi$n%Vi$s%Vi$u%Vi$w%Vi$y%Vi$|%Vi%O%Vi%w%Vi%}%Vi&P%Vi&R%Vi&X%Vi&t%Vi|%Vi$a%Vi$q%Vi~Ou#OO%}TO}&oa!P&oa!m&oa~O!P,OO~Oo(tOq!fa&^!fa~Oq(vO&^&ma~O!m%gO}&li!P&li~O|,XO~P]OW,ZO~P5xOW&UXu&UX#_&UX#a&UX#b&UX#d&UX#e&UX#f&UX#g&UX#h&UX#i&UX#k&UX#o&UX#r&UX&^&UX&_&UX&n&UX&v&UX~OZ#xO!P&UX~P#8^OW$gOZ#xO&v#vO~Op,]Ow,]O~Oq,^O}&rX!P&rX~O!b,`O#]#wOY&UXZ#XX~P#8^OY&SXq&SX|&SX!P&SX~P9oO})]O|&yP~P:|OY&SXg%[Xh%[X%}%[X&P%[X&R%[Xq&SX|&SX!P&SX~Oq,cOY&zX~OY,eO~O})fO|&kP~P:|Oq&jX!P&jX|&jXY&jX~P9oO&bTa~PC[Oo)oOp)oOqna&^na~Oq)pO&^&`a~OW,mO~Ow,nO~Ou#OO%}TO&P,rO&R,qO~Og^Oh^Ov#pO!u#rO&P!wO&RWO&t#oO~Og^Oh^Ov{O|,wO!u}O%}TO&P!wO&RWO&tdO~PFdOw-SO&PSO&R!qO&_#YO~Oq*lOY&ea!P&ea~O#_ma#ama#bma#dma#ema#fma#gma#hma#ima#kma#oma#rma&_ma#pmasma|ma~PEnO|-WO~P$wOZ#xO}'^Oq!|X|!|X!P!|X~Oq-[O|&sX!P&sX~O|-_O!P-^O~O&_!hO~P5VOg^Oh^Ov{O|-cO!P*}O!u}O!z|O%}TO&P!wO&RWO&_!hO&tdO~PFdOs-dO~P9oOs-dO~P:|O}'^OW&dqu&dq!P&dq#_&dq#a&dq#b&dq#d&dq#e&dq#f&dq#g&dq#h&dq#i&dq#k&dq#o&dq#r&dq&^&dq&_&dq&n&dq&v&dqY&dq#p&dqs&dqq&dq|&dq~O|-hO~P##nO!W-lO$O-lO&PSO&R!qO~O!P-oO~O$Z-pO&PSO&R!qO~O!b%vO#p-rOq!`X!P!`X~O!P-tO~P9oO!P-tO~P:|O!P-wO~P9oO|-yO~P#)QO![$aO#p-zO~O!P-|O~O!b-}O~OY.QOZ$lO_VO`VOaVObVOcVOeVOg^Oh^Op!POwkOz!OO%}TO&P(_O&R(^O&XUO~PFdOY.QO!P.RO~O%Q(hO%U(iOZ%Vq_%Vq`%Vqa%Vqb%Vqc%Vqe%Vqg%Vqh%Vqp%Vqv%Vqw%Vqz%Vq}%Vq!P%Vq!S%Vq!T%Vq!U%Vq!V%Vq!W%Vq!X%Vq!Y%Vq!Z%Vq![%Vq!]%Vq!^%Vq!_%Vq!u%Vq!z%Vq#f%Vq#r%Vq#t%Vq#u%Vq#y%Vq#z%Vq$W%Vq$Y%Vq$`%Vq$c%Vq$e%Vq$h%Vq$l%Vq$n%Vq$s%Vq$u%Vq$w%Vq$y%Vq$|%Vq%O%Vq%w%Vq%}%Vq&P%Vq&R%Vq&X%Vq&t%Vq|%Vq$a%Vq$q%Vq~Ou#OO%}TO}&oi!P&oi!m&oi~O&n&bOq!ga&^!ga~O!m%gO}&lq!P&lq~O|.^O~P]Op.`Ow&vOz&tO&PSO&R!qO&_#YO~O!P.aO~Oq,^O}&ra!P&ra~O})]O~P:|Oq.gO|&yX~O|.iO~Oq,cOY&za~Oq.mO|&kX~O|.oO~Ow.pO~Oq!aXu!aX!P!aX!b!aX%}!aX~OZ&QX~P#N{OZUX~P#N{O!P.qO~OZ.rO~OW^yZ#XXu^y!P^y!b^y#]^y#_^y#a^y#b^y#d^y#e^y#f^y#g^y#h^y#i^y#k^y#o^y#r^y&^^y&_^y&n^y&v^yY^y#p^ys^yq^y|^y~OY%`aq%`a!P%`a~P9oO!P#nyY#ny#p#nys#nyq#ny|#ny~P9oO}'^Oq!|a|!|a!P!|a~OZ#xO}'^Oq!|a|!|a!P!|a~O%}TO&P#SO&R#SOq%jX|%jX!P%jX~PFdOq-[O|&sa!P&sa~O|!}X~P$wO|/PO~Os/QO~P9oOW%jO!P/RO~OW%jO$Q/WO&PSO&R!qO!P&|P~OW%jO$U/XO~O!P/YO~O!b%vO#p/[Oq!`X!P!`X~OY/^O~O!P/_O~P9oO#p/`O~P9oO!b/bO~OY/cOZ$lO_VO`VOaVObVOcVOeVOg^Oh^Op!POwkOz!OO%}TO&P(_O&R(^O&XUO~PFdOW#[Ou&[X%}&[X&P&[X&R&[X'O&[X~O&_#YO~P$)QOu#OO%}TO'O/eO&P%SX&R%SX~O&n&bOq!gi&^!gi~Op/iO&PSO&R!qO~OW*iOZ#xO~O!P/kO~OY&SXq&SX~P9oO})]Oq%nX|%nX~P:|Oq.gO|&ya~O!b/nO~O})fOq%cX|%cX~P:|Oq.mO|&ka~OY/qO~O!P/rO~OZ/sO~O}'^Oq!|i|!|i!P!|i~O|!}a~P$wOW%jO!P/wO~OW%jOq/xO!P&|X~OY/|O~P9oOY0OO~OY%Xq!P%Xq~P9oO'O/eO&P%Sa&R%Sa~OY0TO~O!P0WO~Ou#OO!P0YO!Z0ZO%}TO~OY0[O~Oq/xO!P&|a~O!P0_O~OW%jOq/xO!P&}X~OY0aO~P9oOY0bO~OY%Xy!P%Xy~P9oOu#OO%}TO&P%ua&R%ua'O%ua~OY0cO~O!P0dO~Ou#OO!P0eO!Z0fO%}TO~OW%jOq%ra!P%ra~Oq/xO!P&}a~O!P0jO~Ou#OO!P0jO!Z0kO%}TO~O!P0lO~O!P0nO~O#p&QXY&QXs&QXq&QX|&QX~P&bO#pUXYUXsUXqUX|UX~P(iO`Q_P#g%y&P&Xc&X~",goto:"#+S'OPPPP'P'd*x.OP'dPP.d.h0PPPPPP1nP3ZPP4v7l:[WP!?[P!Ap!BW!E]3ZPPP!F|!Jm!MaPP#!P#!SP#$`#$f#&V#&f#&n#'p#(Y#)T#)^#)a#)oP#)r#*OP#*V#*^P#*aP#*lP#*o#*r#*u#*y#+PstOcx![#l$_$m$n$p$q%d(U)Q)R+d+l,Y'urOPXY`acopx!Y![!_!a!e!f!h!i!o!x#P#T#Y#[#_#`#e#i#l#n#u#w#x#|#}$O$P$Q$R$S$T$U$V$Y$Z$[$]$_$e$l$m$n$o$p$q%O%S%V%Z%^%_%b%d%g%k%u%v%{%|&R&S&[&]&`&b&d&i'X'^'_'`'e'h'i'm'n'p'{'|(O(T(U(`(l(t(v({(})O)Q)R)])f)o)p*P*T*W*l*o*p*q*z*{+O+T+d+f+h+i+l+o+r+s+x+},W,Y,^,`,u-[-^-a-r-t-}.R.V.g.m/O/[/_/b/d/n/q0R0X0Z0[0f0h0k0r#xhO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%d%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o,Y,`-r-t-}.g.m/[/_/b/n0Z0f0kt!sT!Q!S!T!{!}$k%p+]+^+_+`-k-m/W/X/x0oQ#mdS&Y#`(}Q&l#oU&q#t$g,ZQ&x#vW(b%O+s.R/dU)Y%j'v+bQ)Z%kS)u&S,WU*f&s-R._Q*k&yQ,t*TQ-P*iQ.j,cR.t,uu!sT!Q!S!T!{!}$k%p+]+^+_+`-k-m/W/X/x0oT%l!r)l#{qO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o,Y,`-r-t-}.g.m/[/_/b/n0Z0f0k#zlO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o,Y,`-r-t-}.g.m/[/_/b/n0Z0f0kX(c%O+s.R/d$TVO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%O%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o+s,Y,`-r-t-}.R.g.m/[/_/b/d/n0Z0f0k$TkO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%O%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o+s,Y,`-r-t-}.R.g.m/[/_/b/d/n0Z0f0k&O[OPX`ceopx!O!Y![!_!a!g!i!o#Y#_#b#e#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Y$Z$[$_$f$l$m$n$o$p$q%O%_%b%d%g%k%v%{&]&b&d&i&t'^'_'`'h'i'm'{'}(O(T(U(d(t)O)Q)R)])f)o)p*P*U*W*l*o*q*{*|+O+T+d+h+i+l+o+s,Y,^,`-^-r-t-}.R.g.m/O/[/_/b/d/n0Z0f0k0rQ&Q#[Q)s&RV.T+x.X/e&O[OPX`ceopx!O!Y![!_!a!g!i!o#Y#_#b#e#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Y$Z$[$_$f$l$m$n$o$p$q%O%_%b%d%g%k%v%{&]&b&d&i&t'^'_'`'h'i'm'{'}(O(T(U(d(t)O)Q)R)])f)o)p*P*U*W*l*o*q*{*|+O+T+d+h+i+l+o+s,Y,^,`-^-r-t-}.R.g.m/O/[/_/b/d/n0Z0f0k0rV.T+x.X/e&O]OPX`ceopx!O!Y![!_!a!g!i!o#Y#_#b#e#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Y$Z$[$_$f$l$m$n$o$p$q%O%_%b%d%g%k%v%{&]&b&d&i&t'^'_'`'h'i'm'{'}(O(T(U(d(t)O)Q)R)])f)o)p*P*U*W*l*o*q*{*|+O+T+d+h+i+l+o+s,Y,^,`-^-r-t-}.R.g.m/O/[/_/b/d/n0Z0f0k0rV.U+x.X/eS#Z[.TS$f!O&tS&s#t$gQ&y#vQ)V%dQ-R*iR._,Z$kZO`copx!Y![!_!a#Y#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Y$Z$_$l$m$n$o$p$q%O%d%g%k%v&b&d'_'`'i'm(O(T(U(t)Q)R)])f)o)p*P*l*o+T+d+h+i+l+o+s,Y,^,`-r-t-}.R.g.m/[/_/b/d/n0Z0f0kQ&O#YR,k)p&P_OPX`ceopx!Y![!_!a!g!i!o#Y#_#b#e#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Y$Z$[$_$l$m$n$o$p$q%O%_%b%d%g%k%v%{&]&b&d&i'^'_'`'h'i'm'{'}(O(T(U(d(t)O)Q)R)])f)o)p*P*U*W*l*o*q*{*|+O+T+d+h+i+l+o+s+x,Y,^,`-^-r-t-}.R.X.g.m/O/[/_/b/d/e/n0Z0f0k0r!o#QY!e!x#R#T#`#n$]%R%S%V%^%u%|&S&[&`'X'|(`(l({(}*T*p*z+f+r+},W,u-a.V/q0R0X0[0h$SkO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%O%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o+s,Y,`-r-t-}.R.g.m/[/_/b/d/n0Z0f0kQ$m!UQ$n!VQ$s!ZQ$|!`R+p(WQ#yiS'q$e*hQ*e&rQ+X'rS,[)T)UQ-O*gQ-Y*vQ.b,]Q.x-QQ.{-ZQ/j.`Q/u.yR0V/iQ'a$bW*[&m'b'c'dQ+W'qU,x*]*^*_Q-X*vQ-f+XS.u,y,zS.z-Y-ZQ/t.vR/v.{]!mP!o'^*q-^/OreOcx![#l$_$m$n$p$q%d(U)Q)R+d+l,Y[!gP!o'^*q-^/OW#b`#e%b&]Q'}$oW(d%O+s.R/dS*U&i*WS*w'e-[S*|'h+OR.X+xh#VY!W!e#n#s%V'|*T*z+f,u-aQ)j%wQ)v&WR,o)y#xnOcopx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o,Y,`-r-t-}.g.m/[/_/b/n0Z0f0k^!kP!g!o'^*q-^/Ov#TY!W#`#n#s%w&W&[&`'|(`(})y*T+f+r,u.W/hQ#g`Q$b{Q$c|Q$d}W%S!e%V*z-aS%Y!h(vQ%`!iQ&m#pQ&n#qQ&o#rQ(u%ZS(y%^({Q*R&eS*v'e-[R-Z*wU)h%v)f.mR+V'p[!mP!o'^*q-^/OT*}'h+O^!iP!g!o'^*q-^/OQ'd$bQ'l$dQ*_&mQ*d&oV*{'h*|+OQ%[!hR,S(vQ(s%YR,R(u#znO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o,Y,`-r-t-}.g.m/[/_/b/n0Z0f0kQ%c!kS(l%S(yR(|%`T#e`%bU#c`#e%bR)z&]Q%f!lQ(n%UQ(r%XQ,U(zR.],VrvOcx![#l$_$m$n$p$q%d(U)Q)R+d+l,Y[!mP!o'^*q-^/OQ%P!bQ%a!jQ%i!pQ'[$ZQ([$|Q(k%QQ(p%WQ+z(iR.Y+yrtOcx![#l$_$m$n$p$q%d(U)Q)R+d+l,Y[!mP!o'^*q-^/OS*V&i*WT*}'h+OQ'c$bS*^&m'dR,z*_Q'b$bQ'g$cU*]&m'c'dQ*a&nS,y*^*_R.v,zQ*u'`R+Q'iQ'k$dS*c&o'lR,}*dQ'j$dU*b&o'k'lS,|*c*dR.w,}rtOcx![#l$_$m$n$p$q%d(U)Q)R+d+l,Y[!mP!o'^*q-^/OT*}'h+OQ'f$cS*`&n'gR,{*aQ*x'eR.|-[R-`*yQ&j#mR*Z&lT*V&i*WQ%e!lS(q%X%fR,P(rR)R%dWk%O+s.R/d#{lO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o,Y,`-r-t-}.g.m/[/_/b/n0Z0f0k$SiO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%O%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o+s,Y,`-r-t-}.R.g.m/[/_/b/d/n0Z0f0kU&r#t$g,ZS*g&s._Q-Q*iR.y-RT'o$e'p!_#|m#a$r$z$}&w&z&{'O'P'Q'R'S'W'Z)[)g+S+g+j-T-V-e-v-{.e/Z/a/}0Q!]$Pm#a$r$z$}&w&z&{'O'P'R'S'W'Z)[)g+S+g+j-T-V-e-v-{.e/Z/a/}0Q#{nO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o,Y,`-r-t-}.g.m/[/_/b/n0Z0f0ka)^%k)],`.g/n0Z0f0kQ)`%kR.k,cQ't$hQ)b%oR,f)cT+Y's+ZsvOcx![#l$_$m$n$p$q%d(U)Q)R+d+l,YruOcx![#l$_$m$n$p$q%d(U)Q)R+d+l,YQ$w!]R$y!^R$p!XrvOcx![#l$_$m$n$p$q%d(U)Q)R+d+l,YR(O$oR$q!XR(V$sT+k(U+lX(f%P(g(k+{R+y(hQ.W+xR/h.XQ(j%PQ+w(gQ+|(kR.Z+{R%Q!bQ(e%OV.P+s.R/dQxOQ#lcW$`x#l)Q,YQ)Q%dR,Y)RrXOcx![#l$_$m$n$p$q%d(U)Q)R+d+l,Yn!fP!o#e&]&i'^'e'h*W*q+O+x-[-^/Ol!zX!f#P#_#i$[%Z%_%{&R'n'{)O0r!j#PY!e!x#T#`#n$]%S%V%^%u%|&S&[&`'X'|(`(l({(}*T*p*z+f+r+},W,u-a.V/q0R0X0[0hQ#_`Q#ia#d$[op!Y!_!a#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$l%g%k%v&b&d'_'`'i'm(O(T(t)])f)o*P*l*o+T+h+i+o,^,`-r-t-}.g.m/[/_/b/n0Z0f0kS%Z!h(vS%_!i*{S%{#Y)pQ&R#[S'n$e'pY'{$o%O+s.R/dQ)O%bR0r$YQ!uUR%m!uQ)q&OR,l)q^#RY#`$]'X'|(`*px%R!e!x#n%V%^%|&S&[&`({(}*T*z+f+r,W,u-a.V0R[%t#R%R%u+}0X0hS%u#T%SQ+}(lQ0X/qR0h0[Q*m&{R-U*mQ!oPU%h!o*q/OQ*q'^R/O-^!pbOP`cx![!o#e#l$_$m$n$o$p$q%O%b%d&]&i'^'e'h(U)Q)R*W*q+O+d+l+s+x,Y-[-^.R/O/dY!yX!f#_'{)OT#jb!yQ.n,gR/p.nQ%x#VR)k%xQ&c#fS*O&c.[R.[,QQ(w%[R,T(wQ&^#cR){&^Q,_)WR.d,_Q+O'hR-b+OQ-]*xR.}-]Q*W&iR,v*WQ'p$eR+U'pQ&f#gR*S&fQ.h,aR/m.hQ,d)`R.l,dQ+Z'sR-g+ZQ-k+]R/T-kQ/y/US0^/y0`R0`/{Q+l(UR-x+lQ(g%PS+v(g+{R+{(kQ/f.VR0S/fQ+t(eR.S+t`wOcx#l%d)Q)R,YQ$t![Q']$_Q'y$mQ'z$nQ(Q$pQ(R$qS+k(U+lR-q+d'dsOPXY`acopx!Y![!_!a!e!f!h!i!o!x#P#T#Y#[#_#`#e#i#l#n#u#w#x#|#}$O$P$Q$R$S$T$U$V$Y$Z$[$]$_$e$l$m$n$o$p$q%O%S%V%Z%^%_%b%d%g%u%v%{%|&R&S&[&]&`&b&d&i'X'^'_'`'e'h'i'm'n'p'{'|(O(T(U(`(l(t(v({(})O)Q)R)f)o)p*P*T*W*l*o*p*q*z*{+O+T+d+f+h+i+l+o+r+s+x+},W,Y,^,u-[-^-a-r-t-}.R.V.m/O/[/_/b/d/q0R0X0[0h0ra)_%k)],`.g/n0Z0f0kQ!rTQ$h!QQ$i!SQ$j!TQ%o!{Q%q!}Q'x$kQ)c%pQ)l0oS-i+]+_Q-m+^Q-n+`Q/S-kS/U-m/WQ/{/XR0]/x%uSOT`cdopx!Q!S!T!Y![!_!a!{!}#`#l#o#t#u#v#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$g$k$l$m$n$o$p$q%O%d%j%k%p%v&S&d&s&y'm'v(O(T(U(})Q)R)])f*P*T*i*l*o+T+]+^+_+`+b+d+h+i+l+o+s,W,Y,Z,`,c,u-R-k-m-r-t-}.R._.g.m/W/X/[/_/b/d/n/x0Z0f0k0oQ)a%kQ,a)]S.f,`/nQ/l.gQ0g0ZQ0i0fR0m0krmOcx![#l$_$m$n$p$q%d(U)Q)R+d+l,YS#a`$lQ$WoQ$^pQ$r!YQ$z!_Q$}!aQ&w#uQ&z#wY&{#x$o+h-t/_Q&}#|Q'O#}Q'P$OQ'Q$PQ'R$QQ'S$RQ'T$SQ'U$TQ'V$UQ'W$VQ'Z$Z^)[%k)].g/n0Z0f0kU)g%v)f.mQ*Q&dQ+S'mQ+g(OQ+j(TQ,p*PQ-T*lQ-V*oQ-e+TQ-v+iQ-{+oQ.e,`Q/Z-rQ/a-}Q/}/[R0Q/b#xgO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o,Y,`-r-t-}.g.m/[/_/b/n0Z0f0kW(a%O+s.R/dR)S%drYOcx![#l$_$m$n$p$q%d(U)Q)R+d+l,Y[!eP!o'^*q-^/OW!xX$[%{'{Q#``Q#ne#S$]op!Y!_!a#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$l%k%v&d'm(O(T)])f*P*l*o+T+h+i+o,`-r-t-}.g.m/[/_/b/n0Z0f0kQ%V!gS%^!i*{d%|#Y%g&b'_'`'i(t)o)p,^Q&S#_Q&[#bS&`#e&]Q'X$YQ'|$oW(`%O+s.R/dQ({%_Q(}%bS*T&i*WQ*p0rS*z'h+OQ+f'}Q+r(dQ,W)OQ,u*UQ-a*|S.V+x.XR0R/e&O_OPX`ceopx!Y![!_!a!g!i!o#Y#_#b#e#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Y$Z$[$_$l$m$n$o$p$q%O%_%b%d%g%k%v%{&]&b&d&i'^'_'`'h'i'm'{'}(O(T(U(d(t)O)Q)R)])f)o)p*P*U*W*l*o*q*{*|+O+T+d+h+i+l+o+s+x,Y,^,`-^-r-t-}.R.X.g.m/O/[/_/b/d/e/n0Z0f0k0rQ$e!OQ'r$fR*h&t&ZWOPX`ceopx!O!Y![!_!a!g!i!o#Y#[#_#b#e#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Y$Z$[$_$f$l$m$n$o$p$q%O%_%b%d%g%k%v%{&R&]&b&d&i&t'^'_'`'h'i'm'{'}(O(T(U(d(t)O)Q)R)])f)o)p*P*U*W*l*o*q*{*|+O+T+d+h+i+l+o+s+x,Y,^,`-^-r-t-}.R.X.g.m/O/[/_/b/d/e/n0Z0f0k0rR&P#Y$QjOcopx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%O%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o+s,Y,`-r-t-}.R.g.m/[/_/b/d/n0Z0f0kQ#f`Q&O#YQ'Y$YU)W%g'`'iQ)}&bQ*s'_Q,Q(tQ,j)oQ,k)pR.c,^Q)n%}R,i)m$SfO`copx!Y![!_!a#l#u#w#x#|#}$O$P$Q$R$S$T$U$V$Z$_$l$m$n$o$p$q%O%d%k%v&d'm(O(T(U)Q)R)])f*P*l*o+T+d+h+i+l+o+s,Y,`-r-t-}.R.g.m/[/_/b/d/n0Z0f0kT&p#t,ZQ&|#xQ(P$oQ-u+hQ/]-tR0P/_]!nP!o'^*q-^/O#PaOPX`bcx![!f!o!y#_#e#l$_$m$n$o$p$q%O%b%d&]&i'^'e'h'{(U)O)Q)R*W*q+O+d+l+s+x,Y-[-^.R/O/dU#WY!W'|Q%T!eU&k#n#s+fQ(o%VS,s*T*zT.s,u-aj#UY!W!e#n#s%V%w&W)y*T*z,u-aU&V#`&`(}Q)x&[Q+e'|Q+q(`Q-s+fQ.O+rQ/g.WR0U/hQ)i%vQ,g)fR/o.mR,h)f`!jP!o'^'h*q+O-^/OT%W!g*|R%]!hW%U!e%V*z-aQ(z%^R,V({S#d`%bR&a#eQ)X%gT*t'`'iR*y'e[!lP!o'^*q-^/OR%X!gR#h`R,b)]R)a%kT-j+]-kQ/V-mR/z/WR/z/X",nodeNames:"⚠ LineComment BlockComment Program ModuleDeclaration MarkerAnnotation Identifier ScopedIdentifier . Annotation ) ( AnnotationArgumentList AssignmentExpression FieldAccess IntegerLiteral FloatingPointLiteral BooleanLiteral CharacterLiteral StringLiteral TextBlock null ClassLiteral void PrimitiveType TypeName ScopedTypeName GenericType TypeArguments AnnotatedType Wildcard extends super , ArrayType ] Dimension [ class this ParenthesizedExpression ObjectCreationExpression new ArgumentList } { ClassBody ; FieldDeclaration Modifiers public protected private abstract static final strictfp default synchronized native transient volatile VariableDeclarator Definition AssignOp ArrayInitializer MethodDeclaration TypeParameters TypeParameter TypeBound FormalParameters ReceiverParameter FormalParameter SpreadParameter Throws throws Block ClassDeclaration Superclass SuperInterfaces implements InterfaceTypeList InterfaceDeclaration interface ExtendsInterfaces InterfaceBody ConstantDeclaration EnumDeclaration enum EnumBody EnumConstant EnumBodyDeclarations AnnotationTypeDeclaration AnnotationTypeBody AnnotationTypeElementDeclaration StaticInitializer ConstructorDeclaration ConstructorBody ExplicitConstructorInvocation ArrayAccess MethodInvocation MethodName MethodReference ArrayCreationExpression Dimension AssignOp BinaryExpression CompareOp CompareOp LogicOp LogicOp BitOp BitOp BitOp ArithOp ArithOp ArithOp BitOp InstanceofExpression instanceof LambdaExpression InferredParameters TernaryExpression LogicOp : UpdateExpression UpdateOp UnaryExpression LogicOp BitOp CastExpression ElementValueArrayInitializer ElementValuePair open module ModuleBody ModuleDirective requires transitive exports to opens uses provides with PackageDeclaration package ImportDeclaration import Asterisk ExpressionStatement LabeledStatement Label IfStatement if else WhileStatement while ForStatement for ForSpec LocalVariableDeclaration var EnhancedForStatement ForSpec AssertStatement assert SwitchStatement switch SwitchBlock SwitchLabel case DoStatement do BreakStatement break ContinueStatement continue ReturnStatement return SynchronizedStatement ThrowStatement throw TryStatement try CatchClause catch CatchFormalParameter CatchType FinallyClause finally TryWithResourcesStatement ResourceSpecification Resource ClassContent",maxTerm:276,nodeProps:[["isolate",-4,1,2,18,19,""],["group",-26,4,47,76,77,82,87,92,145,147,150,151,153,156,158,161,163,165,167,172,174,176,178,180,181,183,191,"Statement",-25,6,13,14,15,16,17,18,19,20,21,22,39,40,41,99,100,102,103,106,118,120,122,125,127,130,"Expression",-7,23,24,25,26,27,29,34,"Type"],["openedBy",10,"(",44,"{"],["closedBy",11,")",45,"}"]],propSources:[Z],skippedNodes:[0,1,2],repeatNodeCount:28,tokenData:"#'f_R!_OX%QXY'fYZ)bZ^'f^p%Qpq'fqr*|rs,^st%Qtu4euv5zvw7[wx8rxyAZyzAwz{Be{|CZ|}Dq}!OE_!O!PFx!P!Q! r!Q!R!,h!R![!0`![!]!>p!]!^!@Q!^!_!@n!_!`!BX!`!a!B{!a!b!Di!b!c!EX!c!}!LT!}#O!Mj#O#P%Q#P#Q!NW#Q#R!Nt#R#S4e#S#T%Q#T#o4e#o#p# h#p#q#!U#q#r##n#r#s#$[#s#y%Q#y#z'f#z$f%Q$f$g'f$g#BY4e#BY#BZ#$x#BZ$IS4e$IS$I_#$x$I_$I|4e$I|$JO#$x$JO$JT4e$JT$JU#$x$JU$KV4e$KV$KW#$x$KW&FU4e&FU&FV#$x&FV;'S4e;'S;=`5t<%lO4eS%VV&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QS%qO&YSS%tVOY&ZYZ%lZr&Zrs&ys;'S&Z;'S;=`'`<%lO&ZS&^VOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QS&vP;=`<%l%QS&|UOY&ZYZ%lZr&Zs;'S&Z;'S;=`'`<%lO&ZS'cP;=`<%l&Z_'mk&YS%yZOX%QXY'fYZ)bZ^'f^p%Qpq'fqr%Qrs%qs#y%Q#y#z'f#z$f%Q$f$g'f$g#BY%Q#BY#BZ'f#BZ$IS%Q$IS$I_'f$I_$I|%Q$I|$JO'f$JO$JT%Q$JT$JU'f$JU$KV%Q$KV$KW'f$KW&FU%Q&FU&FV'f&FV;'S%Q;'S;=`&s<%lO%Q_)iY&YS%yZX^*Xpq*X#y#z*X$f$g*X#BY#BZ*X$IS$I_*X$I|$JO*X$JT$JU*X$KV$KW*X&FU&FV*XZ*^Y%yZX^*Xpq*X#y#z*X$f$g*X#BY#BZ*X$IS$I_*X$I|$JO*X$JT$JU*X$KV$KW*X&FU&FV*XV+TX#tP&YSOY%QYZ%lZr%Qrs%qs!_%Q!_!`+p!`;'S%Q;'S;=`&s<%lO%QU+wV#_Q&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QT,aXOY,|YZ%lZr,|rs3Ys#O,|#O#P2d#P;'S,|;'S;=`3S<%lO,|T-PXOY-lYZ%lZr-lrs.^s#O-l#O#P.x#P;'S-l;'S;=`2|<%lO-lT-qX&YSOY-lYZ%lZr-lrs.^s#O-l#O#P.x#P;'S-l;'S;=`2|<%lO-lT.cVcPOY&ZYZ%lZr&Zrs&ys;'S&Z;'S;=`'`<%lO&ZT.}V&YSOY-lYZ/dZr-lrs1]s;'S-l;'S;=`2|<%lO-lT/iW&YSOY0RZr0Rrs0ns#O0R#O#P0s#P;'S0R;'S;=`1V<%lO0RP0UWOY0RZr0Rrs0ns#O0R#O#P0s#P;'S0R;'S;=`1V<%lO0RP0sOcPP0vTOY0RYZ0RZ;'S0R;'S;=`1V<%lO0RP1YP;=`<%l0RT1`XOY,|YZ%lZr,|rs1{s#O,|#O#P2d#P;'S,|;'S;=`3S<%lO,|T2QUcPOY&ZYZ%lZr&Zs;'S&Z;'S;=`'`<%lO&ZT2gVOY-lYZ/dZr-lrs1]s;'S-l;'S;=`2|<%lO-lT3PP;=`<%l-lT3VP;=`<%l,|T3_VcPOY&ZYZ%lZr&Zrs3ts;'S&Z;'S;=`'`<%lO&ZT3yR&WSXY4SYZ4`pq4SP4VRXY4SYZ4`pq4SP4eO&XP_4lb&YS&PZOY%QYZ%lZr%Qrs%qst%Qtu4eu!Q%Q!Q![4e![!c%Q!c!}4e!}#R%Q#R#S4e#S#T%Q#T#o4e#o$g%Q$g;'S4e;'S;=`5t<%lO4e_5wP;=`<%l4eU6RX#hQ&YSOY%QYZ%lZr%Qrs%qs!_%Q!_!`6n!`;'S%Q;'S;=`&s<%lO%QU6uV#]Q&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QV7cZ&nR&YSOY%QYZ%lZr%Qrs%qsv%Qvw8Uw!_%Q!_!`6n!`;'S%Q;'S;=`&s<%lO%QU8]V#aQ&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QT8wZ&YSOY9jYZ%lZr9jrs:xsw9jwx%Qx#O9j#O#PhYZ%lZr>hrs?dsw>hwx;hx#O>h#O#P&Z#P;'S>h;'S;=`@}<%lO>hT>kZOYhYZ%lZr>hrs@Ysw>hwx;hx#O>h#O#P&Z#P;'S>h;'S;=`@}<%lO>hP@]VOY@YZw@Ywx@rx#O@Y#P;'S@Y;'S;=`@w<%lO@YP@wObPP@zP;=`<%l@YTAQP;=`<%l>hTAWP;=`<%l9j_AbVZZ&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QVBOVYR&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QVBnX$ZP&YS#gQOY%QYZ%lZr%Qrs%qs!_%Q!_!`6n!`;'S%Q;'S;=`&s<%lO%QVCbZ#fR&YSOY%QYZ%lZr%Qrs%qs{%Q{|DT|!_%Q!_!`6n!`;'S%Q;'S;=`&s<%lO%QVD[V#rR&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QVDxVqR&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QVEf[#fR&YSOY%QYZ%lZr%Qrs%qs}%Q}!ODT!O!_%Q!_!`6n!`!aF[!a;'S%Q;'S;=`&s<%lO%QVFcV&xR&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%Q_GPZWY&YSOY%QYZ%lZr%Qrs%qs!O%Q!O!PGr!P!Q%Q!Q![IQ![;'S%Q;'S;=`&s<%lO%QVGwX&YSOY%QYZ%lZr%Qrs%qs!O%Q!O!PHd!P;'S%Q;'S;=`&s<%lO%QVHkV&qR&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QTIXc&YS`POY%QYZ%lZr%Qrs%qs!Q%Q!Q![IQ![!f%Q!f!gJd!g!hKQ!h!iJd!i#R%Q#R#SNz#S#W%Q#W#XJd#X#YKQ#Y#ZJd#Z;'S%Q;'S;=`&s<%lO%QTJkV&YS`POY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QTKV]&YSOY%QYZ%lZr%Qrs%qs{%Q{|LO|}%Q}!OLO!O!Q%Q!Q![Lp![;'S%Q;'S;=`&s<%lO%QTLTX&YSOY%QYZ%lZr%Qrs%qs!Q%Q!Q![Lp![;'S%Q;'S;=`&s<%lO%QTLwc&YS`POY%QYZ%lZr%Qrs%qs!Q%Q!Q![Lp![!f%Q!f!gJd!g!h%Q!h!iJd!i#R%Q#R#SNS#S#W%Q#W#XJd#X#Y%Q#Y#ZJd#Z;'S%Q;'S;=`&s<%lO%QTNXZ&YSOY%QYZ%lZr%Qrs%qs!Q%Q!Q![Lp![#R%Q#R#SNS#S;'S%Q;'S;=`&s<%lO%QT! PZ&YSOY%QYZ%lZr%Qrs%qs!Q%Q!Q![IQ![#R%Q#R#SNz#S;'S%Q;'S;=`&s<%lO%Q_! y]&YS#gQOY%QYZ%lZr%Qrs%qsz%Qz{!!r{!P%Q!P!Q!)e!Q!_%Q!_!`6n!`;'S%Q;'S;=`&s<%lO%Q_!!wX&YSOY!!rYZ!#dZr!!rrs!%Psz!!rz{!&_{;'S!!r;'S;=`!'s<%lO!!r_!#iT&YSOz!#xz{!$[{;'S!#x;'S;=`!$y<%lO!#xZ!#{TOz!#xz{!$[{;'S!#x;'S;=`!$y<%lO!#xZ!$_VOz!#xz{!$[{!P!#x!P!Q!$t!Q;'S!#x;'S;=`!$y<%lO!#xZ!$yOQZZ!$|P;=`<%l!#x_!%SXOY!%oYZ!#dZr!%ors!'ysz!%oz{!(i{;'S!%o;'S;=`!)_<%lO!%o_!%rXOY!!rYZ!#dZr!!rrs!%Psz!!rz{!&_{;'S!!r;'S;=`!'s<%lO!!r_!&dZ&YSOY!!rYZ!#dZr!!rrs!%Psz!!rz{!&_{!P!!r!P!Q!'V!Q;'S!!r;'S;=`!'s<%lO!!r_!'^V&YSQZOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%Q_!'vP;=`<%l!!r_!'|XOY!%oYZ!#dZr!%ors!#xsz!%oz{!(i{;'S!%o;'S;=`!)_<%lO!%o_!(lZOY!!rYZ!#dZr!!rrs!%Psz!!rz{!&_{!P!!r!P!Q!'V!Q;'S!!r;'S;=`!'s<%lO!!r_!)bP;=`<%l!%o_!)lV&YSPZOY!)eYZ%lZr!)ers!*Rs;'S!)e;'S;=`!+X<%lO!)e_!*WVPZOY!*mYZ%lZr!*mrs!+_s;'S!*m;'S;=`!,b<%lO!*m_!*rVPZOY!)eYZ%lZr!)ers!*Rs;'S!)e;'S;=`!+X<%lO!)e_!+[P;=`<%l!)e_!+dVPZOY!*mYZ%lZr!*mrs!+ys;'S!*m;'S;=`!,b<%lO!*mZ!,OSPZOY!+yZ;'S!+y;'S;=`!,[<%lO!+yZ!,_P;=`<%l!+y_!,eP;=`<%l!*mT!,ou&YS_POY%QYZ%lZr%Qrs%qs!O%Q!O!P!/S!P!Q%Q!Q![!0`![!d%Q!d!e!3j!e!f%Q!f!gJd!g!hKQ!h!iJd!i!n%Q!n!o!2U!o!q%Q!q!r!5h!r!z%Q!z!{!7`!{#R%Q#R#S!2r#S#U%Q#U#V!3j#V#W%Q#W#XJd#X#YKQ#Y#ZJd#Z#`%Q#`#a!2U#a#c%Q#c#d!5h#d#l%Q#l#m!7`#m;'S%Q;'S;=`&s<%lO%QT!/Za&YS`POY%QYZ%lZr%Qrs%qs!Q%Q!Q![IQ![!f%Q!f!gJd!g!hKQ!h!iJd!i#W%Q#W#XJd#X#YKQ#Y#ZJd#Z;'S%Q;'S;=`&s<%lO%QT!0gi&YS_POY%QYZ%lZr%Qrs%qs!O%Q!O!P!/S!P!Q%Q!Q![!0`![!f%Q!f!gJd!g!hKQ!h!iJd!i!n%Q!n!o!2U!o#R%Q#R#S!2r#S#W%Q#W#XJd#X#YKQ#Y#ZJd#Z#`%Q#`#a!2U#a;'S%Q;'S;=`&s<%lO%QT!2]V&YS_POY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QT!2wZ&YSOY%QYZ%lZr%Qrs%qs!Q%Q!Q![!0`![#R%Q#R#S!2r#S;'S%Q;'S;=`&s<%lO%QT!3oY&YSOY%QYZ%lZr%Qrs%qs!Q%Q!Q!R!4_!R!S!4_!S;'S%Q;'S;=`&s<%lO%QT!4f`&YS_POY%QYZ%lZr%Qrs%qs!Q%Q!Q!R!4_!R!S!4_!S!n%Q!n!o!2U!o#R%Q#R#S!3j#S#`%Q#`#a!2U#a;'S%Q;'S;=`&s<%lO%QT!5mX&YSOY%QYZ%lZr%Qrs%qs!Q%Q!Q!Y!6Y!Y;'S%Q;'S;=`&s<%lO%QT!6a_&YS_POY%QYZ%lZr%Qrs%qs!Q%Q!Q!Y!6Y!Y!n%Q!n!o!2U!o#R%Q#R#S!5h#S#`%Q#`#a!2U#a;'S%Q;'S;=`&s<%lO%QT!7e_&YSOY%QYZ%lZr%Qrs%qs!O%Q!O!P!8d!P!Q%Q!Q![!:r![!c%Q!c!i!:r!i#T%Q#T#Z!:r#Z;'S%Q;'S;=`&s<%lO%QT!8i]&YSOY%QYZ%lZr%Qrs%qs!Q%Q!Q![!9b![!c%Q!c!i!9b!i#T%Q#T#Z!9b#Z;'S%Q;'S;=`&s<%lO%QT!9gc&YSOY%QYZ%lZr%Qrs%qs!Q%Q!Q![!9b![!c%Q!c!i!9b!i!r%Q!r!sKQ!s#R%Q#R#S!8d#S#T%Q#T#Z!9b#Z#d%Q#d#eKQ#e;'S%Q;'S;=`&s<%lO%QT!:yi&YS_POY%QYZ%lZr%Qrs%qs!O%Q!O!P!wX#pR&YSOY%QYZ%lZr%Qrs%qs![%Q![!]!?d!];'S%Q;'S;=`&s<%lO%QV!?kV&vR&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QV!@XV!PR&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%Q_!@uY&_Z&YSOY%QYZ%lZr%Qrs%qs!^%Q!^!_!Ae!_!`+p!`;'S%Q;'S;=`&s<%lO%QU!AlX#iQ&YSOY%QYZ%lZr%Qrs%qs!_%Q!_!`6n!`;'S%Q;'S;=`&s<%lO%QV!B`X!bR&YSOY%QYZ%lZr%Qrs%qs!_%Q!_!`+p!`;'S%Q;'S;=`&s<%lO%QV!CSY&^R&YSOY%QYZ%lZr%Qrs%qs!_%Q!_!`+p!`!a!Cr!a;'S%Q;'S;=`&s<%lO%QU!CyY#iQ&YSOY%QYZ%lZr%Qrs%qs!_%Q!_!`6n!`!a!Ae!a;'S%Q;'S;=`&s<%lO%Q_!DrV&bX#oQ&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%Q_!E`X%}Z&YSOY%QYZ%lZr%Qrs%qs#]%Q#]#^!E{#^;'S%Q;'S;=`&s<%lO%QV!FQX&YSOY%QYZ%lZr%Qrs%qs#b%Q#b#c!Fm#c;'S%Q;'S;=`&s<%lO%QV!FrX&YSOY%QYZ%lZr%Qrs%qs#h%Q#h#i!G_#i;'S%Q;'S;=`&s<%lO%QV!GdX&YSOY%QYZ%lZr%Qrs%qs#X%Q#X#Y!HP#Y;'S%Q;'S;=`&s<%lO%QV!HUX&YSOY%QYZ%lZr%Qrs%qs#f%Q#f#g!Hq#g;'S%Q;'S;=`&s<%lO%QV!HvX&YSOY%QYZ%lZr%Qrs%qs#Y%Q#Y#Z!Ic#Z;'S%Q;'S;=`&s<%lO%QV!IhX&YSOY%QYZ%lZr%Qrs%qs#T%Q#T#U!JT#U;'S%Q;'S;=`&s<%lO%QV!JYX&YSOY%QYZ%lZr%Qrs%qs#V%Q#V#W!Ju#W;'S%Q;'S;=`&s<%lO%QV!JzX&YSOY%QYZ%lZr%Qrs%qs#X%Q#X#Y!Kg#Y;'S%Q;'S;=`&s<%lO%QV!KnV&tR&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%Q_!L[b&RZ&YSOY%QYZ%lZr%Qrs%qst%Qtu!LTu!Q%Q!Q![!LT![!c%Q!c!}!LT!}#R%Q#R#S!LT#S#T%Q#T#o!LT#o$g%Q$g;'S!LT;'S;=`!Md<%lO!LT_!MgP;=`<%l!LT_!MqVuZ&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QV!N_VsR&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QU!N{X#eQ&YSOY%QYZ%lZr%Qrs%qs!_%Q!_!`6n!`;'S%Q;'S;=`&s<%lO%QV# oV}R&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%Q_#!_Z'OX#dQ&YSOY%QYZ%lZr%Qrs%qs!_%Q!_!`6n!`#p%Q#p#q##Q#q;'S%Q;'S;=`&s<%lO%QU##XV#bQ&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QV##uV|R&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%QT#$cV#uP&YSOY%QYZ%lZr%Qrs%qs;'S%Q;'S;=`&s<%lO%Q_#%Ru&YS%yZ&PZOX%QXY'fYZ)bZ^'f^p%Qpq'fqr%Qrs%qst%Qtu4eu!Q%Q!Q![4e![!c%Q!c!}4e!}#R%Q#R#S4e#S#T%Q#T#o4e#o#y%Q#y#z'f#z$f%Q$f$g'f$g#BY4e#BY#BZ#$x#BZ$IS4e$IS$I_#$x$I_$I|4e$I|$JO#$x$JO$JT4e$JT$JU#$x$JU$KV4e$KV$KW#$x$KW&FU4e&FU&FV#$x&FV;'S4e;'S;=`5t<%lO4e",tokenizers:[0,1,2,3],topRules:{Program:[0,3],ClassContent:[1,194]},dynamicPrecedences:{27:1,232:-1,243:-1},specialized:[{term:231,get:Q=>n[Q]||-1}],tokenPrec:7144}),_=X.define({name:"java",parser:d.configure({props:[l.add({IfStatement:$({except:/^\s*({|else\b)/}),TryStatement:$({except:/^\s*({|catch|finally)\b/}),LabeledStatement:Y,SwitchBlock:Q=>{let P=Q.textAfter,i=/^\s*\}/.test(P),a=/^\s*(case|default)\b/.test(P);return Q.baseIndent+(i?0:a?1:2)*Q.unit},Block:S({closing:"}"}),BlockComment:()=>null,Statement:$({except:/^{/})}),o.add({"Block SwitchBlock ClassBody ElementValueArrayInitializer ModuleBody EnumBody ConstructorBody InterfaceBody ArrayInitializer":t,BlockComment(Q){return{from:Q.from+2,to:Q.to-2}}})]}),languageData:{commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\})$/}});function T(){return new s(_)}export{T as java,_ as javaLanguage}; diff --git a/apps/studio/dist/static/index-DPyTNidZ.js b/apps/studio/dist/static/index-DPyTNidZ.js new file mode 100644 index 00000000..a28b6771 --- /dev/null +++ b/apps/studio/dist/static/index-DPyTNidZ.js @@ -0,0 +1 @@ +var vt=Object.defineProperty,a=(t,e)=>vt(t,"name",{value:e,configurable:!0}),L=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(t,e,r,i,h,c){this.type=t,this.name=e,this.prefix=r,this.value=i,this.suffix=h,this.modifier=c}hasCustomName(){return this.name!==""&&typeof this.name!="number"}};a(L,"Part");var xt=/[$_\p{ID_Start}]/u,Et=/[$_\u200C\u200D\p{ID_Continue}]/u,N=".*";function Q(t,e){return(e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)}a(Q,"isASCII");function F(t,e=!1){let r=[],i=0;for(;i{if(on("OTHER_MODIFIER")??n("ASTERISK"),"tryConsumeModifier"),f=a(p=>{let l=n(p);if(l!==void 0)return l;let{type:m,index:P}=r[o];throw new TypeError(`Unexpected ${m} at ${P}, expected ${p}`)},"mustConsume"),b=a(()=>{let p="",l;for(;l=n("CHAR")??n("ESCAPED_CHAR");)p+=l;return p},"consumeText"),S=a(p=>p,"DefaultEncodePart"),T=e.encodePart||S,U="",O=a(p=>{U+=p},"appendToPendingFixedValue"),D=a(()=>{U.length&&(h.push(new L(3,"","",T(U),"",3)),U="")},"maybeAddPartFromPendingFixedValue"),J=a((p,l,m,P,v)=>{let y=3;switch(v){case"?":y=1;break;case"*":y=0;break;case"+":y=2;break}if(!l&&!m&&y===3){O(p);return}if(D(),!l&&!m){if(!p)return;h.push(new L(3,"","",T(p),"",y));return}let g;m?m==="*"?g=N:g=m:g=i;let A=2;g===i?(A=1,g=""):g===N&&(A=0,g="");let x;if(l?x=l:m&&(x=c++),s.has(x))throw new TypeError(`Duplicate name '${x}'.`);s.add(x),h.push(new L(A,x,T(p),g,T(P),y))},"addPart");for(;o-1)}return o||(i+=`(?=${c}|${h})`),new RegExp(i,j(r))}a(z,"partsToRegexp");var $={delimiter:"",prefixes:"",sensitive:!0,strict:!0},$t={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Rt={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};function Z(t,e){return t.length?t[0]==="/"?!0:!e||t.length<2?!1:(t[0]=="\\"||t[0]=="{")&&t[1]=="/":!1}a(Z,"isAbsolutePathname");function W(t,e){return t.startsWith(e)?t.substring(e.length,t.length):t}a(W,"maybeStripPrefix");function tt(t,e){return t.endsWith(e)?t.substr(0,t.length-e.length):t}a(tt,"maybeStripSuffix");function G(t){return!t||t.length<2?!1:t[0]==="["||(t[0]==="\\"||t[0]==="{")&&t[1]==="["}a(G,"treatAsIPv6Hostname");var et=["ftp","file","http","https","ws","wss"];function K(t){if(!t)return!0;for(let e of et)if(t.test(e))return!0;return!1}a(K,"isSpecialScheme");function rt(t,e){if(t=W(t,"#"),e||t==="")return t;let r=new URL("https://example.com");return r.hash=t,r.hash?r.hash.substring(1,r.hash.length):""}a(rt,"canonicalizeHash");function st(t,e){if(t=W(t,"?"),e||t==="")return t;let r=new URL("https://example.com");return r.search=t,r.search?r.search.substring(1,r.search.length):""}a(st,"canonicalizeSearch");function it(t,e){return e||t===""?t:G(t)?B(t):X(t)}a(it,"canonicalizeHostname");function nt(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.password=t,r.password}a(nt,"canonicalizePassword");function at(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.username=t,r.username}a(at,"canonicalizeUsername");function ot(t,e,r){if(r||t==="")return t;if(e&&!et.includes(e))return new URL(`${e}:${t}`).pathname;let i=t[0]=="/";return t=new URL(i?t:"/-"+t,"https://example.com").pathname,i||(t=t.substring(2,t.length)),t}a(ot,"canonicalizePathname");function ht(t,e,r){return V(e)===t&&(t=""),r||t===""?t:q(t)}a(ht,"canonicalizePort");function ut(t,e){return t=tt(t,":"),e||t===""?t:I(t)}a(ut,"canonicalizeProtocol");function V(t){switch(t){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}a(V,"defaultPortForProtocol");function I(t){if(t==="")return t;if(/^[-+.A-Za-z0-9]*$/.test(t))return t.toLowerCase();throw new TypeError(`Invalid protocol '${t}'.`)}a(I,"protocolEncodeCallback");function ct(t){if(t==="")return t;let e=new URL("https://example.com");return e.username=t,e.username}a(ct,"usernameEncodeCallback");function pt(t){if(t==="")return t;let e=new URL("https://example.com");return e.password=t,e.password}a(pt,"passwordEncodeCallback");function X(t){if(t==="")return t;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(t))throw new TypeError(`Invalid hostname '${t}'`);let e=new URL("https://example.com");return e.hostname=t,e.hostname}a(X,"hostnameEncodeCallback");function B(t){if(t==="")return t;if(/[^0-9a-fA-F[\]:]/g.test(t))throw new TypeError(`Invalid IPv6 hostname '${t}'`);return t.toLowerCase()}a(B,"ipv6HostnameEncodeCallback");function q(t){if(t===""||/^[0-9]*$/.test(t)&&parseInt(t)<=65535)return t;throw new TypeError(`Invalid port '${t}'.`)}a(q,"portEncodeCallback");function lt(t){if(t==="")return t;let e=new URL("https://example.com");return e.pathname=t[0]!=="/"?"/-"+t:t,t[0]!=="/"?e.pathname.substring(2,e.pathname.length):e.pathname}a(lt,"standardURLPathnameEncodeCallback");function ft(t){return t===""?t:new URL(`data:${t}`).pathname}a(ft,"pathURLPathnameEncodeCallback");function mt(t){if(t==="")return t;let e=new URL("https://example.com");return e.search=t,e.search.substring(1,e.search.length)}a(mt,"searchEncodeCallback");function dt(t){if(t==="")return t;let e=new URL("https://example.com");return e.hash=t,e.hash.substring(1,e.hash.length)}a(dt,"hashEncodeCallback");var gt=class{#n;#s=[];#e={};#t=0;#i=1;#u=0;#o=0;#f=0;#m=0;#d=!1;constructor(t){this.#n=t}get result(){return this.#e}parse(){for(this.#s=F(this.#n,!0);this.#t0)if(this.#k())this.#f-=1;else continue;if(this.#P()){this.#f+=1;continue}switch(this.#o){case 0:this.#v()&&this.#l(1);break;case 1:if(this.#v()){this.#S();let t=7,e=1;this.#E()?(t=2,e=3):this.#d&&(t=2),this.#r(t,e)}break;case 2:this.#y()?this.#l(3):(this.#b()||this.#p()||this.#c())&&this.#l(5);break;case 3:this.#$()?this.#r(4,1):this.#y()&&this.#r(5,1);break;case 4:this.#y()&&this.#r(5,1);break;case 5:this.#C()?this.#m+=1:this.#L()&&(this.#m-=1),this.#R()&&!this.#m?this.#r(6,1):this.#b()?this.#r(7,0):this.#p()?this.#r(8,1):this.#c()&&this.#r(9,1);break;case 6:this.#b()?this.#r(7,0):this.#p()?this.#r(8,1):this.#c()&&this.#r(9,1);break;case 7:this.#p()?this.#r(8,1):this.#c()&&this.#r(9,1);break;case 8:this.#c()&&this.#r(9,1);break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#r(t,e){switch(this.#o){case 0:break;case 1:this.#e.protocol=this.#h();break;case 2:break;case 3:this.#e.username=this.#h();break;case 4:this.#e.password=this.#h();break;case 5:this.#e.hostname=this.#h();break;case 6:this.#e.port=this.#h();break;case 7:this.#e.pathname=this.#h();break;case 8:this.#e.search=this.#h();break;case 9:this.#e.hash=this.#h();break}this.#o!==0&&t!==10&&([1,2,3,4].includes(this.#o)&&[6,7,8,9].includes(t)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#o)&&[8,9].includes(t)&&(this.#e.pathname??=this.#d?"/":""),[1,2,3,4,5,6,7].includes(this.#o)&&t===9&&(this.#e.search??="")),this.#x(t,e)}#x(t,e){this.#o=t,this.#u=this.#t+e,this.#t+=e,this.#i=0}#w(){this.#t=this.#u,this.#i=0}#l(t){this.#w(),this.#o=t}#g(t){return t<0&&(t=this.#s.length-t),t=0&&(t.pathname=w(i.pathname.substring(0,h+1),r)+t.pathname)}t.pathname=ot(t.pathname,t.protocol,r)}return typeof e.search=="string"&&(t.search=st(e.search,r)),typeof e.hash=="string"&&(t.hash=rt(e.hash,r)),t}a(k,"applyInit");function C(t){return t.replace(/([+*?:{}()\\])/g,"\\$1")}a(C,"escapePatternString");function yt(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}a(yt,"escapeRegexpString");function bt(t,e){e.delimiter??="/#?",e.prefixes??="./",e.sensitive??=!1,e.strict??=!1,e.end??=!0,e.start??=!0,e.endsWith="";let r=".*",i=`[^${yt(e.delimiter)}]+?`,h=/[$_\u200C\u200D\p{ID_Continue}]/u,c="";for(let o=0;o0?t[o-1]:null,b=o0?b.value[0]:"";u=h.test(S)}else u=!b.hasCustomName();if(!u&&!s.prefix.length&&f&&f.type===3){let S=f.value[f.value.length-1];u=e.prefixes.includes(S)}u&&(c+="{"),c+=C(s.prefix),n&&(c+=`:${s.name}`),s.type===2?c+=`(${s.value})`:s.type===1?n||(c+=`(${i})`):s.type===0&&(!n&&(!f||f.type===3||f.modifier!==3||u||s.prefix!=="")?c+="*":c+=`(${r})`),s.type===1&&n&&s.suffix.length&&h.test(s.suffix[0])&&(c+="\\"),c+=C(s.suffix),u&&(c+="}"),s.modifier!==3&&(c+=R(s.modifier))}return c}a(bt,"partsToPattern");var wt=class{#n;#s={};#e={};#t={};#i={};#u=!1;constructor(t={},e,r){try{let i;if(typeof e=="string"?i=e:r=e,typeof t=="string"){let s=new gt(t);if(s.parse(),t=s.result,i===void 0&&typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=i}else{if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(i)throw new TypeError("parameter 1 is not of type 'string'.")}typeof r>"u"&&(r={ignoreCase:!1});let h={ignoreCase:r.ignoreCase===!0},c={pathname:E,protocol:E,username:E,password:E,hostname:E,port:E,search:E,hash:E};this.#n=k(c,t,!0),V(this.#n.protocol)===this.#n.port&&(this.#n.port="");let o;for(o of H){if(!(o in this.#n))continue;let s={},n=this.#n[o];switch(this.#e[o]=[],o){case"protocol":Object.assign(s,$),s.encodePart=I;break;case"username":Object.assign(s,$),s.encodePart=ct;break;case"password":Object.assign(s,$),s.encodePart=pt;break;case"hostname":Object.assign(s,$t),G(n)?s.encodePart=B:s.encodePart=X;break;case"port":Object.assign(s,$),s.encodePart=q;break;case"pathname":K(this.#s.protocol)?(Object.assign(s,Rt,h),s.encodePart=lt):(Object.assign(s,$,h),s.encodePart=ft);break;case"search":Object.assign(s,$,h),s.encodePart=mt;break;case"hash":Object.assign(s,$,h),s.encodePart=dt;break}try{this.#i[o]=M(n,s),this.#s[o]=z(this.#i[o],this.#e[o],s),this.#t[o]=bt(this.#i[o],s),this.#u=this.#u||this.#i[o].some(u=>u.type===2)}catch{throw new TypeError(`invalid ${o} pattern '${this.#n[o]}'.`)}}}catch(i){throw new TypeError(`Failed to construct 'URLPattern': ${i.message}`)}}get[Symbol.toStringTag](){return"URLPattern"}test(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return!1;try{typeof t=="object"?r=k(r,t,!1):r=k(r,_(t,e),!1)}catch{return!1}let i;for(i of H)if(!this.#s[i].exec(r[i]))return!1;return!0}exec(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return;try{typeof t=="object"?r=k(r,t,!1):r=k(r,_(t,e),!1)}catch{return null}let i={};e?i.inputs=[t,e]:i.inputs=[t];let h;for(h of H){let c=this.#s[h].exec(r[h]);if(!c)return null;let o={};for(let[s,n]of this.#e[h].entries())if(typeof n=="string"||typeof n=="number"){let u=c[s+1];o[n]=u}i[h]={input:r[h]??"",groups:o}}return i}static compareComponent(t,e,r){let i=a((s,n)=>{for(let u of["type","modifier","prefix","value","suffix"]){if(s[u]{let u=0;for(;u{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=Ea[i])e=i+1;else return!0;if(e==t)return!1}}function Io(n){return n>=127462&&n<=127487}const No=8205;function Vf(n,e,t=!0,i=!0){return(t?Pa:zf)(n,e,i)}function Pa(n,e,t){if(e==n.length)return e;e&&Ra(n.charCodeAt(e))&&Ia(n.charCodeAt(e-1))&&e--;let i=ws(n,e);for(e+=Wo(i);e=0&&Io(ws(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function zf(n,e,t){for(;e>0;){let i=Pa(n,e-2,t);if(i=56320&&n<57344}function Ia(n){return n>=55296&&n<56320}function Wo(n){return n<65536?1:2}class q{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=ii(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),Xe.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ii(this,e,t);let i=[];return this.decompose(e,t,i,0),Xe.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new vi(this),r=new vi(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new vi(this,e)}iterRange(e,t=this.length){return new Na(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Wa(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?q.empty:e.length<=32?new ee(e):Xe.from(ee.split(e,[]))}}class ee extends q{constructor(e,t=qf(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Kf(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new ee(Fo(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=On(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new ee(l,o.length+r.length));else{let a=l.length>>1;i.push(new ee(l.slice(0,a)),new ee(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof ee))return super.replace(e,t,i);[e,t]=ii(this,e,t);let s=On(this.text,On(i.text,Fo(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new ee(s,r):Xe.from(ee.split(s,[]),r)}sliceString(e,t=this.length,i=` +`){[e,t]=ii(this,e,t);let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new ee(i,s)),i=[],s=-1);return s>-1&&t.push(new ee(i,s)),t}}class Xe extends q{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=ii(this,e,t),i.lines=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[s]=a,new Xe(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` +`){[e,t]=ii(this,e,t);let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Xe))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new ee(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Xe)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof ee&&a&&(p=c[c.length-1])instanceof ee&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new ee(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Xe.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Xe(l,t)}}q.empty=new ee([""],0);function qf(n){let e=-1;for(let t of n)e+=t.length+1;return e}function On(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(a>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof ee?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof ee?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(s instanceof ee){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof ee?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Na{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new vi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Wa{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(q.prototype[Symbol.iterator]=function(){return this.iter()},vi.prototype[Symbol.iterator]=Na.prototype[Symbol.iterator]=Wa.prototype[Symbol.iterator]=function(){return this});class Kf{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function ii(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function le(n,e,t=!0,i=!0){return Vf(n,e,t,i)}function $f(n){return n>=56320&&n<57344}function jf(n){return n>=55296&&n<56320}function Ce(n,e){let t=n.charCodeAt(e);if(!jf(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return $f(i)?(t-55296<<10)+(i-56320)+65536:t}function $r(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Qe(n){return n<65536?1:2}const Xs=/\r\n?|\n/;var fe=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(fe||(fe={}));class st{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=fe.Simple&&h>=e&&(i==fe.TrackDel&&se||i==fe.TrackBefore&&se))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new st(e)}static create(e){return new st(e)}}class se extends st{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Qs(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return Zs(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length0&>(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?q.of(d.split(i||Xs)):d:q.empty,m=p.length;if(f==u&&m==0)return;fo&&ye(s,f-o,-1),ye(s,u-f,m),gt(r,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new se(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:s>=0&&e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function gt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function Zs(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Di(n),l=new Di(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ye(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Di{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?q.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?q.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Et{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Et(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return x.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return x.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return x.range(e.anchor,e.head)}static create(e,t,i){return new Et(e,t,i)}}class x{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:x.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new x(e.ranges.map(t=>Et.fromJSON(t)),e.main)}static single(e,t=e){return new x([x.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?8:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?x.range(a,l):x.range(l,a))}}return new x(e,t)}}function Ha(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let jr=0;class D{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=jr++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new D(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Ur),!!e.static,e.enables)}of(e){return new Bn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Bn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Bn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Ur(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Bn{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=jr++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||er(f,c)){let d=i(f);if(l?!Ho(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let m=Fn(u,p);if(this.dependencies.every(g=>g instanceof D?u.facet(g)===f.facet(g):g instanceof pe?u.field(g,!1)==f.field(g,!1):!0)||(l?Ho(d=i(f),m,s):s(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}}function Ho(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(on).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>{let r=i.facet(on),o=s.facet(on),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,on.of({field:this,create:e})]}get extension(){return this}}const Bt={lowest:4,low:3,default:2,high:1,highest:0};function di(n){return e=>new Va(e,n)}const At={highest:di(Bt.highest),high:di(Bt.high),default:di(Bt.default),low:di(Bt.low),lowest:di(Bt.lowest)};class Va{constructor(e,t){this.inner=e,this.prec=t}}class os{of(e){return new tr(this,e)}reconfigure(e){return os.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class tr{constructor(e,t){this.compartment=e,this.inner=t}}class Wn{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Gf(e,t,o))u instanceof pe?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i?.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[p.id]=a.length<<1|1,Ur(m,d))a.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(y=>g.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(g=>Uf(g,p,d))}}let f=h.map(u=>u(l));return new Wn(e,o,f,l,a,r)}}function Gf(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof tr&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof tr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof Va)r(o.inner,o.prec);else if(o instanceof pe)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Bn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,Bt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,Bt.default),i.reduce((o,l)=>o.concat(l))}function ki(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Fn(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const za=D.define(),ir=D.define({combine:n=>n.some(e=>e),static:!0}),qa=D.define({combine:n=>n.length?n[0]:void 0,static:!0}),Ka=D.define(),$a=D.define(),ja=D.define(),Ua=D.define({combine:n=>n.length?n[0]:!1});class rt{constructor(e,t){this.type=e,this.value=t}static define(){return new _f}}class _f{of(e){return new rt(this,e)}}class Yf{constructor(e){this.map=e}of(e){return new R(this,e)}}class R{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new R(this.type,t)}is(e){return this.type==e}static define(e={}){return new Yf(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}R.reconfigure=R.define();R.appendConfig=R.define();class ie{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Ha(i,t.newLength),r.some(l=>l.type==ie.time)||(this.annotations=r.concat(ie.time.of(Date.now())))}static create(e,t,i,s,r,o){return new ie(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ie.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ie.time=rt.define();ie.userEvent=rt.define();ie.addToHistory=rt.define();ie.remote=rt.define();function Jf(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof ie?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof ie?n=r[0]:n=_a(e,Yt(r),!1)}return n}function Qf(n){let e=n.startState,t=e.facet(ja),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=Ga(i,nr(e,r,n.changes.newLength),!0))}return i==n?n:ie.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const Zf=[];function Yt(n){return n==null?Zf:Array.isArray(n)?n:[n]}var X=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(X||(X={}));const eu=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let sr;try{sr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function tu(n){if(sr)return sr.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||eu.test(t)))return!0}return!1}function iu(n){return e=>{if(!/\S/.test(e))return X.Space;if(tu(e))return X.Word;for(let t=0;t-1)return X.Word;return X.Other}}class z{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(R.reconfigure)?(t=null,i=l.value):l.is(R.appendConfig)&&(t=null,i=Yt(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=Wn.resolve(i,s,this),r=new z(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(ir)?e.newSelection:e.newSelection.asSingle();new z(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:x.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=Yt(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return z.create({doc:e.doc,selection:x.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Wn.resolve(e.extensions||[],new Map),i=e.doc instanceof q?e.doc:q.of((e.doc||"").split(t.staticFacet(z.lineSeparator)||Xs)),s=e.selection?e.selection instanceof x?e.selection:x.single(e.selection.anchor,e.selection.head):x.single(0);return Ha(s,i.length),t.staticFacet(ir)||(s=s.asSingle()),new z(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(z.tabSize)}get lineBreak(){return this.facet(z.lineSeparator)||` +`}get readOnly(){return this.facet(Ua)}phrase(e,...t){for(let i of this.facet(z.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(za))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return iu(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=le(t,o,!1);if(r(t.slice(a,o))!=X.Word)break;o=a}for(;ln.length?n[0]:4});z.lineSeparator=qa;z.readOnly=Ua;z.phrases=D.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});z.languageData=za;z.changeFilter=Ka;z.transactionFilter=$a;z.transactionExtender=ja;os.reconfigure=R.define();function ot(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class bt{eq(e){return this==e}range(e,t=e){return rr.create(e,t,this)}}bt.prototype.startSide=bt.prototype.endSide=0;bt.prototype.point=!1;bt.prototype.mapMode=fe.TrackDel;function Gr(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let rr=class Ya{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Ya(e,t,i)}};function or(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class _r{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),s.push(u-o),r.push(d-o))}return{mapped:i.length?new _r(s,r,i,l):null,pos:o}}}class H{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new H(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(or)),this.isEmpty)return t.length?H.of(t):this;let l=new Ja(this,null,-1).goto(0),a=0,h=[],c=new ct;for(;l.value||a=0){let f=t[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Oi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Oi.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),a=Vo(o,l,i),h=new pi(o,a,r),c=new pi(l,a,r);i.iterGaps((f,u,d)=>zo(h,f,c,u,d,s)),i.empty&&i.length==0&&zo(h,0,c,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=999999999);let r=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=Vo(r,o),a=new pi(r,l,0).goto(i),h=new pi(o,l,0).goto(i);for(;;){if(a.to!=h.to||!lr(a.active,h.active)||a.point&&(!h.point||!Gr(a.point,h.point)))return!1;if(a.to>s)return!0;a.next(),h.next()}}static spans(e,t,i,s,r=-1){let o=new pi(e,null,r).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(s.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,t=!1){let i=new ct;for(let s of e instanceof rr?[e]:t?nu(e):e)i.add(s.from,s.to,s.value);return i.finish()}static join(e){if(!e.length)return H.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let s=e[i];s!=H.empty;s=s.nextLayer)t=new H(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}H.empty=new H([],[],null,-1);function nu(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(or);e=i}return n}H.empty.nextLayer=H.empty;class ct{finishChunk(e){this.chunks.push(new _r(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new ct)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(H.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=H.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Vo(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new Ja(o,t,i,r));return s.length==1?s[0]:new Oi(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)vs(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)vs(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),vs(this.heap,0)}}}function vs(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}class pi{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Oi.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){ln(this.active,e),ln(this.activeTo,e),ln(this.activeRank,e),this.minActive=qo(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t0;)t++;an(this.active,t,i),an(this.activeTo,t,s),an(this.activeRank,t,r),e&&an(e,t,this.cursor.from),this.minActive=qo(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&ln(i,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[s]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function zo(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,l=i,a=i-e,h=!!r.boundChange;for(let c=!1;;){let f=n.to+a-t.to,u=f||n.endSide-t.endSide,d=u<0?n.to+a:t.to,p=Math.min(d,o);if(n.point||t.point?(n.point&&t.point&&Gr(n.point,t.point)&&lr(n.activeForPoint(n.to),t.activeForPoint(t.to))||r.comparePoint(l,p,n.point,t.point),c=!1):(c&&r.boundChange(l),p>l&&!lr(n.active,t.active)&&r.compareRange(l,p,n.active,t.active),h&&po)break;l=d,u<=0&&n.next(),u>=0&&t.next()}}function lr(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function qo(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=le(n,s)}return i===!0?-1:n.length}const hr="ͼ",Ko=typeof Symbol>"u"?"__"+hr:Symbol.for(hr),cr=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),$o=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class xt{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||u)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=$o[Ko]||1;return $o[Ko]=e+1,hr+e.toString(36)}static mount(e,t,i){let s=e[cr],r=i&&i.nonce;s?r&&s.setNonce(r):s=new su(e,r),s.mount(Array.isArray(t)?t:[t],e)}}let jo=new Map;class su{constructor(e,t){let i=e.ownerDocument||e,s=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let r=jo.get(i);if(r)return e[cr]=r;this.sheet=new s.CSSStyleSheet,jo.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[cr]=this}mount(e,t){let i=this.sheet,s=0,r=0;for(let o=0;o-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,l),i)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ru=typeof navigator<"u"&&/Mac/.test(navigator.platform),ou=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ce=0;ce<10;ce++)wt[48+ce]=wt[96+ce]=String(ce);for(var ce=1;ce<=24;ce++)wt[ce+111]="F"+ce;for(var ce=65;ce<=90;ce++)wt[ce]=String.fromCharCode(ce+32),Bi[ce]=String.fromCharCode(ce);for(var ks in wt)Bi.hasOwnProperty(ks)||(Bi[ks]=wt[ks]);function lu(n){var e=ru&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ou&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Bi:wt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function j(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;e2);var O={mac:Go||/Mac/.test(ve.platform),windows:/Win/.test(ve.platform),linux:/Linux|X11/.test(ve.platform),ie:ls,ie_version:Qa?fr.documentMode||6:dr?+dr[1]:ur?+ur[1]:0,gecko:Uo,gecko_version:Uo?+(/Firefox\/(\d+)/.exec(ve.userAgent)||[0,0])[1]:0,chrome:!!Ss,chrome_version:Ss?+Ss[1]:0,ios:Go,android:/Android\b/.test(ve.userAgent),webkit_version:au?+(/\bAppleWebKit\/(\d+)/.exec(ve.userAgent)||[0,0])[1]:0,safari:pr,safari_version:pr?+(/\bVersion\/(\d+(\.\d+)?)/.exec(ve.userAgent)||[0,0])[1]:0,tabSize:fr.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Yr(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const Hn=Object.create(null);function Jr(n,e,t){if(n==e)return!0;n||(n=Hn),e||(e=Hn);let i=Object.keys(n),s=Object.keys(e);if(i.length-0!=s.length-0)return!1;for(let r of i)if(r!=t&&(s.indexOf(r)==-1||n[r]!==e[r]))return!1;return!0}function hu(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function _o(n,e,t){let i=!1;if(e)for(let s in e)t&&s in t||(i=!0,s=="style"?n.style.cssText="":n.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(i=!0,s=="style"?n.style.cssText=t[s]:n.setAttribute(s,t[s]));return i}function cu(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new Wt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=Za(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new Wt(e,i,s,t,e.widget||null,!0)}static line(e){return new _i(e)}static set(e,t=!1){return H.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}L.none=H.empty;class Gi extends L{constructor(e){let{start:t,end:i}=Za(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Yr(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Hn}eq(e){return this==e||e instanceof Gi&&this.tagName==e.tagName&&Jr(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Gi.prototype.point=!1;class _i extends L{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof _i&&this.spec.class==e.spec.class&&Jr(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}_i.prototype.mapMode=fe.TrackBefore;_i.prototype.point=!0;class Wt extends L{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?fe.TrackBefore:fe.TrackAfter:fe.TrackDel}get type(){return this.startSide!=this.endSide?ue.WidgetRange:this.startSide<=0?ue.WidgetBefore:ue.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Wt&&fu(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Wt.prototype.point=!0;function Za(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function fu(n,e){return n==e||!!(n&&e&&n.compare(e))}function Jt(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}class Li extends bt{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof Li&&this.tagName==e.tagName&&Jr(this.attributes,e.attributes)}static create(e){return new Li(e.tagName,e.attributes||Hn)}static set(e,t=!1){return H.of(e,t)}}Li.prototype.startSide=Li.prototype.endSide=-1;function Ei(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function mr(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Si(n,e){if(!e.anchorNode)return!1;try{return mr(n,e.anchorNode)}catch{return!1}}function Ci(n){return n.nodeType==3?Ri(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Ai(n,e,t,i){return t?Yo(n,e,t,i,-1)||Yo(n,e,t,i,1):!1}function vt(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function Vn(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function Yo(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:ft(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=vt(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?ft(n):0}else return!1}}function ft(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Pi(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function uu(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function eh(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function du(n,e,t,i,s,r,o,l){let a=n.ownerDocument,h=a.defaultView||window;for(let c=n,f=!1;c&&!f;)if(c.nodeType==1){let u,d=c==a.body,p=1,m=1;if(d)u=uu(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let w=c.getBoundingClientRect();({scaleX:p,scaleY:m}=eh(c,w)),u={left:w.left,right:w.left+c.clientWidth*p,top:w.top,bottom:w.top+c.clientHeight*m}}let g=0,y=0;if(s=="nearest")e.top0&&e.bottom>u.bottom+y&&(y=e.bottom-u.bottom+o)):e.bottom>u.bottom&&(y=e.bottom-u.bottom+o,t<0&&e.top-y0&&e.right>u.right+g&&(g=e.right-u.right+r)):e.right>u.right&&(g=e.right-u.right+r,t<0&&e.leftu.bottom||e.leftu.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function th(n,e=!0){let t=n.ownerDocument,i=null,s=null;for(let r=n.parentNode;r&&!(r==t.body||(!e||i)&&s);)if(r.nodeType==1)!s&&r.scrollHeight>r.clientHeight&&(s=r),e&&!i&&r.scrollWidth>r.clientWidth&&(i=r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;return{x:i,y:s}}class pu{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?ft(t):0),i,Math.min(e.focusOffset,i?ft(i):0))}set(e,t,i,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}}let Ot=null;O.safari&&O.safari_version>=26&&(Ot=!1);function ih(n){if(n.setActive)return n.setActive();if(Ot)return n.focus(Ot);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(Ot==null?{get preventScroll(){return Ot={preventScroll:!0},!0}}:void 0),!Ot){Ot=!1;for(let t=0;tMath.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function sh(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=ft(t)}else if(t.parentNode&&!Vn(t))i=vt(t),t=t.parentNode;else return null}}function rh(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i=t){if(l.level==i)return o;(r<0||(s!=0?s<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function ah(n,e){if(n.length!=e.length)return!1;for(let t=0;t=0;m-=3)if(Ge[m+1]==-d){let g=Ge[m+2],y=g&2?s:g&4?g&1?r:s:0;y&&(U[f]=U[Ge[m]]=y),l=m;break}}else{if(Ge.length==189)break;Ge[l++]=f,Ge[l++]=u,Ge[l++]=a}else if((p=U[f])==2||p==1){let m=p==s;a=m?0:1;for(let g=l-3;g>=0;g-=3){let y=Ge[g+2];if(y&2)break;if(m)Ge[g+2]|=2;else{if(y&4)break;Ge[g+2]|=4}}}}}function ku(n,e,t,i){for(let s=0,r=i;s<=t.length;s++){let o=s?t[s-1].to:n,l=sa;)p==g&&(p=t[--m].from,g=m?t[m-1].to:n),U[--p]=d;a=c}else r=h,a++}}}function yr(n,e,t,i,s,r,o){let l=i%2?2:1;if(i%2==s%2)for(let a=e,h=0;aa&&o.push(new et(a,m.from,d));let g=m.direction==Ft!=!(d%2);br(n,g?i+1:i,s,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==t||(c?U[p]!=l:U[p]==l))break;p++}u?yr(n,a,p,i+1,s,u,o):ae;){let c=!0,f=!1;if(!h||a>r[h-1].to){let m=U[a-1];m!=l&&(c=!1,f=m==16)}let u=!c&&l==1?[]:null,d=c?i:i+1,p=a;e:for(;;)if(h&&p==r[h-1].to){if(f)break e;let m=r[--h];if(!c)for(let g=m.from,y=h;;){if(g==e)break e;if(y&&r[y-1].to==g)g=r[--y].from;else{if(U[g-1]==l)break e;break}}if(u)u.push(m);else{m.toU.length;)U[U.length]=256;let i=[],s=e==Ft?0:1;return br(n,s,s,t,0,n.length,i),i}function hh(n){return[new et(0,n,0)]}let ch="";function Cu(n,e,t,i,s){var r;let o=i.head-n.from,l=et.find(e,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),a=e[l],h=a.side(s,t);if(o==h){let u=l+=s?1:-1;if(u<0||u>=e.length)return null;a=e[l=u],o=a.side(!s,t),h=a.side(s,t)}let c=le(n.text,o,a.forward(s,t));(ca.to)&&(c=h),ch=n.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return f&&c==h&&f.level+(s?0:1)n.some(e=>e)}),bh=D.define({combine:n=>n.some(e=>e)}),xh=D.define();class Qt{constructor(e,t="nearest",i="nearest",s=5,r=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new Qt(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Qt(x.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const hn=R.define({map:(n,e)=>n.map(e)}),wh=R.define();function Te(n,e,t){let i=n.facet(ph);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const lt=D.define({combine:n=>n.length?n[0]:!0});let Mu=0;const Ut=D.define({combine(n){return n.filter((e,t)=>{for(let i=0;i{let a=[];return o&&a.push(as.of(h=>{let c=h.plugin(l);return c?o(c):L.none})),r&&a.push(r(l)),a})}static fromClass(e,t){return Z.define((i,s)=>new e(i,s),t)}}class Cs{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Te(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Te(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Te(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const vh=D.define(),eo=D.define(),as=D.define(),kh=D.define(),to=D.define(),Yi=D.define(),Sh=D.define();function Xo(n,e){let t=n.state.facet(Sh);if(!t.length)return t;let i=t.map(r=>r instanceof Function?r(n):r),s=[];return H.spans(i,e.from,e.to,{point(){},span(r,o,l,a){let h=r-e.from,c=o-e.from,f=s;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,p;if(d==null&&(d=Au(e.text,h,c)),a>0&&f.length&&(p=f[f.length-1]).to==h&&p.direction==d)p.to=c,f=p.inner;else{let m={from:h,to:c,direction:d,inner:[]};f.push(m),f=m.inner}}}}),s}const Ch=D.define();function io(n){let e=0,t=0,i=0,s=0;for(let r of n.state.facet(Ch)){let o=r(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:i,bottom:s}}const bi=D.define();class Re{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new Re(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toAs.push(new Re(r,o,l,a))),this.changedRanges=s}static create(e,t,i){return new zn(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const Tu=[];class Q{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Tu}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&hu(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let s of this.children){if(s==e)return i;i+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let i=vt(this.dom),s=this.length?e>0:t>0;return new ze(this.parent.dom,i+(s?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof cs)return e;return null}static get(e){return e.cmTile}}class hs extends Q{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,s,r=e?.node==t?e:null,o=0;for(let l of this.children){if(l.sync(e),o+=l.length+l.breakAfter,s=i?i.nextSibling:t.firstChild,r&&s!=l.dom&&(r.written=!0),l.dom.parentNode==t)for(;s&&s!=l.dom;)s=Qo(s);else t.insertBefore(l.dom,s);i=l.dom}for(s=i?i.nextSibling:t.firstChild,r&&s&&(r.written=!0);s;)s=Qo(s);this.length=o}}function Qo(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class cs extends hs{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Q.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,s=0,r=0;;)if(s==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&r++,s=t.pop()}else{let o=i.children[s++];if(o instanceof at)t.push(s),i=o,s=0;else{let l=r+o.length,a=e(o,r);if(a!==void 0)return a;r=l+o.breakAfter}}}resolveBlock(e,t){let i,s=-1,r,o=-1;if(this.blockTiles((l,a)=>{let h=a+l.length;if(e>=a&&e<=h){if(l.isWidget()&&t>=-1&&t<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(ae||e==a&&(t>1?l.length:l.covers(-1)))&&(!r||!l.isWidget()&&r.isWidget())&&(r=l,o=e-a)}}),!i&&!r)throw new Error("No tile at position "+e);return i&&t<0||!r?{tile:i,offset:s}:{tile:r,offset:o}}}class at extends hs{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new at(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class ni extends hs{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let s=new ni(t||document.createElement("div"),e);return(!t||!i)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(e,t,i){let s=null,r=-1,o=null,l=-1;function a(c,f){for(let u=0,d=0;u=f&&(p.isComposite()?a(p,f-d):(!o||o.isHidden&&(t>0||i&&Ou(o,p)))&&(m>f||p.flags&32)?(o=p,l=f-d):(di&&(e=i);let s=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?O.chrome||O.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return O.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?Pi(a,o<0):a||null}static of(e,t){let i=new Pt(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class Ht extends Q{constructor(e,t,i,s){super(e,t,s),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let s=this.widget.coordsAt(this.dom,e,t);if(s)return s;if(i)return Pi(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let a=l?r.length-1:0;o=r[a],!(e>0?a==0:a==r.length-1||o.top0;)if(s.isComposite())if(o){if(!e)break;i&&i.break(),e--,o=!1}else if(r==s.children.length){if(!e&&!l.length)break;i&&i.leave(s),o=!!s.breakAfter,{tile:s,index:r}=l.pop(),r++}else{let a=s.children[r],h=a.breakAfter;(t>0?a.length<=e:a.length=0;l--){let a=t.marks[l],h=s.lastChild;if(h instanceof Me&&h.mark.eq(a.mark))h.dom!=a.dom&&h.setDOM(As(a.dom)),s=h;else{if(this.cache.reused.get(a)){let f=Q.get(a.dom);f&&f.setDOM(As(a.dom))}let c=Me.of(a.mark,a.dom);s.append(c),s=c}this.cache.reused.set(a,2)}let r=Q.get(e.text);r&&this.cache.reused.set(r,2);let o=new Pt(e.text,e.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(e,t,i){let s=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);s||this.flushBuffer();let r=this.ensureMarks(t,i);!s&&!(e.flags&16)&&r.append(this.getBuffer(1)),r.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=Ah);let s=ni.start(e,t||((i=this.cache.find(ni))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let s=this.curLine;for(let r=e.length-1;r>=0;r--){let o=e[r],l;if(t>0&&(l=s.lastChild)&&l instanceof Me&&l.mark.eq(o))s=l,t--;else{let a=Me.of(o,(i=this.cache.find(Me,h=>h.mark.eq(o)))===null||i===void 0?void 0:i.dom);s.append(a),s=a,t=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Zo(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(O.ios&&Zo(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Ms,0,32)||new Ht(Ms.toDOM(),0,Ms,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let t=new Lu(e.from,e.to,e.value,e.rank),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-t.rank||this.wrappers[i-1].to-t.to)<0;)i--;this.wrappers.splice(i,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let s=t.lastChild;if(i.fromo.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(r),t=r}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(qn,void 0,1);return i&&(i.flags=t),i||new qn(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Pu{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:s,lineBreak:r,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let l=this.textOff=Math.min(e,s.length);return r?null:s.slice(0,l)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const Kn=[Ht,ni,Pt,Me,qn,at,cs];for(let n=0;n[]),this.index=Kn.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let s=e.bucket,r=this.buckets[s],o=this.index[s];for(let l=r.length-1;l>=0;l--){let a=(l+o)%r.length,h=r[a];if((!t||t(h))&&!this.reused.has(h))return r.splice(a,1),a{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let s=0,r=0,o=0;;){let l=os){let h=a-s;this.preserve(h,!o,!l),s=a,r+=h}if(!l)break;t&&l.fromA<=t.range.fromA&&l.toA>=t.range.toA?(this.forward(l.fromA,t.range.fromA,t.range.fromA{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let h=a>0||l{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Me&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=r=0):o instanceof Me&&(s.shift(),r=Math.min(r,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,s=this.builder,r=0,o=H.spans(this.decorations,e,t,{point:(l,a,h,c,f,u)=>{if(h instanceof Wt){if(this.disallowBlockEffectsFor[u]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=c.length,f>c.length)s.continueWidget(a-l);else{let d=h.widget||(h.block?si.block:si.inline),p=Nu(h),m=this.cache.findWidget(d,a-l,p)||Ht.of(d,this.view,a-l,p);h.block?(h.startSide>0&&s.addLineStartIfNotCovered(i),s.addBlockWidget(m)):(s.ensureLine(i),s.addInlineWidget(m,c,f))}i=null}else i=Wu(i,h);a>l&&this.text.skip(a-l)},span:(l,a,h,c)=>{for(let f=l;fr,this.openMarks=o}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let s=e.parentNode;;s=s.parentNode){let r=Q.get(s);if(s==this.view.contentDOM)break;r instanceof Me?t.push(r):r?.isLine()?i=r:r instanceof at||(s.nodeName=="DIV"&&!i&&s!=this.view.contentDOM?i=new ni(s,Ah):i||t.push(Me.of(new Gi({tagName:s.nodeName.toLowerCase(),attributes:cu(s)}),s)))}return{line:i,marks:t}}}function Zo(n,e){let t=i=>{for(let s of i.children)if((e?s.isText():s.length)||t(s))return!0;return!1};return t(n)}function Nu(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const Ah={class:"cm-line"};function Wu(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&Yr(t,n),i&&(n.class+=" "+i)),n}function Fu(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof Me&&e.push(i.mark)}return e}function As(n){let e=Q.get(n);return e&&e.setDOM(n.cloneNode()),n}class si extends Ke{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}si.inline=new si("span");si.block=new si("div");const Ms=new class extends Ke{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class el{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=L.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new cs(e,e.contentDOM),this.updateInner([new Re(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:c,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!Gu(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let r=s>-1?Vu(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:f}=this.hasComposition;i=new Re(c,f,e.changes.mapPos(c,-1),e.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(O.ie||O.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=Ku(o,this.decorations,e.changes);a.length&&(i=Re.extendWithRanges(i,a));let h=ju(l,this.blockWrappers,e.changes);return h.length&&(i=Re.extendWithRanges(i,h)),r&&!i.some(c=>c.fromA<=r.range.fromA&&c.toA>=r.range.toA)&&(i=r.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let o=this.tile,l=new Iu(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Q.get(t.text)&&l.cache.reused.set(Q.get(t.text),2),this.tile=l.run(e,t),wr(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=O.chrome||O.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||i.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to-1)&&Si(i,this.view.observer.selectionRange)&&!(s&&i.contains(s));if(!(r||t||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,h,c;if(a.empty?c=h=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),h=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),O.gecko&&a.empty&&!this.hasComposition&&Hu(h)){let u=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(u,h.node.childNodes[h.offset]||null)),h=c=new ze(u,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!Ai(h.node,h.offset,f.anchorNode,f.anchorOffset)||!Ai(c.node,c.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,a))&&(this.view.observer.ignore(()=>{O.android&&O.chrome&&i.contains(f.focusNode)&&Uu(f.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let u=Ei(this.view.root);if(u)if(a.empty){if(O.gecko){let d=zu(h.node,h.offset);if(d&&d!=3){let p=(d==1?sh:rh)(h.node,h.offset);p&&(h=new ze(p.node,p.offset))}}u.collapse(h.node,h.offset),a.bidiLevel!=null&&u.caretBidiLevel!==void 0&&(u.caretBidiLevel=a.bidiLevel)}else if(u.extend){u.collapse(h.node,h.offset);try{u.extend(c.node,c.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([h,c]=[c,h]),d.setEnd(c.node,c.offset),d.setStart(h.node,h.offset),u.removeAllRanges(),u.addRange(d)}o&&this.view.root.activeElement==i&&(i.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(h,c)),this.impreciseAnchor=h.precise?null:new ze(f.anchorNode,f.anchorOffset),this.impreciseHead=c.precise?null:new ze(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ai(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Ei(e.root),{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(s,r)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let s=i.posAtStart;if(i.isComposite()){let r;if(e==i.dom)r=i.dom.childNodes[t];else{let o=ft(e)==0?0:t==0?-1:1;for(;;){let l=e.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?o=-1:o=1),e=l}o<0?r=e:r=e.nextSibling}if(r==i.dom.firstChild)return s;for(;r&&!Q.get(r);)r=r.nextSibling;if(!r)return s+i.length;for(let o=0,l=s;;o++){let a=i.children[o];if(a.dom==r)return l;l+=a.length+a.breakAfter}}else return i.isText()?e==i.dom?s+t:s+(t?i.length:0):s}domAtPos(e,t){let{tile:i,offset:s}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(e,t):i.domIn(s,t)}inlineDOMNearPos(e,t){let i,s=-1,r=!1,o,l=-1,a=!1;return this.tile.blockTiles((h,c)=>{if(h.isWidget()){if(h.flags&32&&c>=e)return!0;h.flags&16&&(r=!0)}else{let f=c+h.length;if(c<=e&&(i=h,s=e-c,r=f=e&&!o&&(o=h,l=e-c,a=c>e),c>e&&o)return!0}}),!i&&!o?this.domAtPos(e,t):(r&&o?i=null:a&&i&&(o=null),i&&t<0||!o?i.domIn(s,t):o.domIn(l,t))}coordsAt(e,t){let{tile:i,offset:s}=this.tile.resolveBlock(e,t);return i.isWidget()?i.widget instanceof Ts?null:i.coordsInWidget(s,t,!0):i.coordsIn(s,t)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function s(r,o){if(r.isComposite())for(let l of r.children){if(l.length>=o){let a=s(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(r.isText()&&oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==_.LTR,h=0,c=(f,u,d)=>{for(let p=0;ps);p++){let m=f.children[p],g=u+m.length,y=m.dom.getBoundingClientRect(),{height:w}=y;if(d&&!p&&(h+=y.top-d.top),m instanceof at)g>i&&c(m,u,y);else if(u>=i&&(h>0&&t.push(-h),t.push(w+h),h=0,o)){let v=m.dom.lastChild,T=v?Ci(v):[];if(T.length){let k=T[T.length-1],S=a?k.right-y.left:y.right-k.left;S>l&&(l=S,this.minWidth=r,this.minWidthFrom=u,this.minWidthTo=g)}}d&&p==f.children.length-1&&(h+=d.bottom-y.bottom),u=g+m.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?_.RTL:_.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let c=Ci(h.dom);if(c.length!=1)return;l+=c[0].width,a=c[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(e)return e;let t=document.createElement("div"),i,s,r;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Ci(t.firstChild)[0];i=t.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,r=o&&o.height?o.height:i,t.remove()}),{lineHeight:i,charWidth:s,textHeight:r}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.view.state.doc.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(L.replace({widget:new Ts(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return L.set(e)}updateDeco(){let e=1,t=this.view.state.facet(as).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),i=!1,s=this.view.state.facet(to).map((r,o)=>{let l=typeof r=="function";return l&&(i=!0),l?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[e++]=i,t.push(H.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof r=="function"?r(this.view):r)}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(xh))try{if(h(this.view,e.range,e))return!0}catch(c){Te(this.view.state,c,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=io(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;if(du(this.view.scrollDOM,o,t.head1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottomi.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){wr(this.tile)}}function wr(n,e){let t=e?.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)wr(i,e)}}function Hu(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function Mh(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=sh(t.focusNode,t.focusOffset),s=rh(t.focusNode,t.focusOffset),r=i||s;if(s&&i&&s.node!=i.node){let l=Q.get(s.node);if(!l||l.isText()&&l.text!=s.node.nodeValue)r=s;else if(n.docView.lastCompositionAfterCursor){let a=Q.get(i.node);!a||a.isText()&&a.text!=i.node.nodeValue||(r=s)}}if(n.docView.lastCompositionAfterCursor=r!=i,!r)return null;let o=e-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function Vu(n,e,t){let i=Mh(n,t);if(!i)return null;let{node:s,from:r,to:o}=i,l=s.nodeValue;if(/[\n\r]/.test(l)||n.state.doc.sliceString(i.from,i.to)!=l)return null;let a=e.invertedDesc;return{range:new Re(a.mapPos(r),a.mapPos(o),r,o),text:s}}function zu(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}class Ts extends Ke{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function _u(n,e,t=1){let i=n.charCategorizer(e),s=n.doc.lineAt(e),r=e-s.from;if(s.length==0)return x.cursor(e);r==0?t=1:r==s.length&&(t=-1);let o=r,l=r;t<0?o=le(s.text,r,!1):l=le(s.text,r);let a=i(s.text.slice(o,l));for(;o>0;){let h=le(s.text,o,!1);if(i(s.text.slice(h,o))!=a)break;o=h}for(;ln.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,a=Math.floor((s-t.top-(n.defaultLineHeight-l)*.5)/l);r+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+ar(o,r,n.state.tabSize)}function vr(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let s;for(let r of i.type){if(r.from>e)break;if(!(r.toe)return r;(!s||r.type==ue.Text&&(s.type!=r.type||(t<0?r.frome)))&&(s=r)}}return s||i}return i}function Ju(n,e,t,i){let s=vr(n,e.head,e.assoc||-1),r=!i||s.type!=ue.Text||!(n.lineWrapping||s.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(s.from),a=n.posAtCoords({x:t==(l==_.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return x.cursor(a,t?-1:1)}return x.cursor(t?s.to:s.from,t?-1:1)}function tl(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=e,a=null;;){let h=Cu(s,r,o,l,t),c=ch;if(!h){if(s.number==(t?n.state.doc.lines:1))return l;c=` +`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),h=n.visualLineSide(s,!t)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function Xu(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==X.Space&&(s=o),s==o}}function Qu(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return x.cursor(s,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(s,(e.empty?e.assoc:0)||(t?1:-1)),c=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let p=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(s-p.from))),l=(r<0?p.top:p.bottom)+c}let f=a.left+o,u=i??n.viewState.heightOracle.textHeight>>1,d=kr(n,{x:f,y:l+u*r},!1,r);return x.cursor(d.pos,d.assoc,void 0,o)}function Mi(n,e,t){for(;;){let i=0;for(let s of n)s.between(e-1,e+1,(r,o,l)=>{if(e>r&&es(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:x.cursor(i,in.viewState.docHeight)return new Ze(n.state.doc.length,-1);if(h=n.elementAtHeight(a),i==null)break;if(h.type==ue.Text){if(i<0?h.ton.viewport.to)break;let u=n.docView.coordsAt(i<0?h.from:h.to,i>0?-1:1);if(u&&(i<0?u.top<=a+r:u.bottom>=a+r))break}let f=n.viewState.heightOracle.textHeight/2;a=i>0?h.bottom+f:h.top-f}if(n.viewport.from>=h.to||n.viewport.to<=h.from){if(t)return null;if(h.type==ue.Text){let f=Yu(n,s,h,o,l);return new Ze(f,f==h.from?1:-1)}}if(h.type!=ue.Text)return a<(h.top+h.bottom)/2?new Ze(h.from,1):new Ze(h.to,-1);let c=n.docView.lineAt(h.from,2);return(!c||c.length!=h.length)&&(c=n.docView.lineAt(h.from,-2)),new Zu(n,o,l,n.textDirectionAt(h.from)).scanTile(c,h.from)}class Zu{constructor(e,t,i,s){this.view=e,this.x=t,this.y=i,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||i.length&&(i[0].level!=this.baseDir||i[0].to+s.from>1;t:if(r.has(p)){let g=i+Math.floor(Math.random()*d);for(let y=0;ythis.y)(!a||a.top>y.top)&&(a=y),w=-1;else{let v=y.left>this.x?this.x-y.left:y.right(f.left+f.right)/2==u}}scanText(e,t){let i=[];for(let r=0;r{let o=i[r]-t,l=i[r+1]-t;return Ri(e.dom,o,l).getClientRects()});return s.after?new Ze(i[s.i+1],-1):new Ze(i[s.i],1)}scanTile(e,t){if(!e.length)return new Ze(t,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,t);if(l.isComposite())return this.scanTile(l,t)}let i=[t];for(let l=0,a=t;l{let a=e.children[l];return a.flags&48?null:(a.dom.nodeType==1?a.dom:Ri(a.dom,0,a.length)).getClientRects()}),r=e.children[s.i],o=i[s.i];return r.isText()?this.scanText(r,o):r.isComposite()?this.scanTile(r,o):s.after?new Ze(i[s.i+1],-1):new Ze(o,1)}}const Kt="￿";class ed{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(z.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Kt}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let s=e;;){this.findPointBefore(i,s);let r=this.text.length;this.readNode(s);let o=Q.get(s),l=s.nextSibling;if(l==t){o?.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let a=Q.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:Vn(s))||Vn(l)&&(s.nodeName!="BR"||o?.isWidget())&&this.text.length>r)&&!id(l,t)&&this.lineBreak(),s=l}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(t))&&(r=l.index,o=l[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(e){let t=Q.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(td(e,i.node,i.offset)?t:0))}}function td(n,e,t){for(;;){if(!e||t-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Dh(e.docView.tile,t,i,0))){let l=r||o?[]:rd(e),a=new ed(l,e);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=od(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!mr(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!mr(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((O.ios||O.chrome)&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(x.range(h,a)):this.newSel=x.single(h,a)}}}function Dh(n,e,t,i){if(n.isComposite()){let s=-1,r=-1,o=-1,l=-1;for(let a=0,h=i,c=i;at)return Dh(f,e,t,h);if(u>=e&&s==-1&&(s=a,r=h),h>t&&f.dom.parentNode==n.dom){o=a,l=c;break}c=u,h=u+f.breakAfter}return{from:r,to:l<0?i+n.length:l,startDOM:(s?n.children[s-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o=0?n.children[o].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function Oh(n,e){let t,{newSel:i}=e,{state:s}=n,r=s.selection.main,o=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:a}=e.bounds,h=r.from,c=null;(o===8||O.android&&e.text.length=l&&r.to<=a&&(e.typeOver||f!=e.text)&&f.slice(0,r.from-l)==e.text.slice(0,r.from-l)&&f.slice(r.to-l)==e.text.slice(u=e.text.length-(f.length-(r.to-l)))?t={from:r.from,to:r.to,insert:q.of(e.text.slice(r.from-l,u).split(Kt))}:(d=Bh(f,e.text,h-l,c))&&(O.chrome&&o==13&&d.toB==d.from+2&&e.text.slice(d.from,d.toB)==Kt+Kt&&d.toB--,t={from:l+d.from,to:l+d.toA,insert:q.of(e.text.slice(d.from,d.toB).split(Kt))})}else i&&(!n.hasFocus&&s.facet(lt)||$n(i,r))&&(i=null);if(!t&&!i)return!1;if((O.mac||O.android)&&t&&t.from==t.to&&t.from==r.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=x.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:q.of([t.insert.toString().replace("."," ")])}):s.doc.lineAt(r.from).toDate.now()-50?t={from:r.from,to:r.to,insert:s.toText(n.inputState.insertingText)}:O.chrome&&t&&t.from==t.to&&t.from==r.head&&t.insert.toString()==` + `&&n.lineWrapping&&(i&&(i=x.single(i.main.anchor-1,i.main.head-1)),t={from:r.from,to:r.to,insert:q.of([" "])}),t)return no(n,t,i,o);if(i&&!$n(i,r)){let l=!1,a="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),a=n.inputState.lastSelectionOrigin,a=="select.pointer"&&(i=Th(s.facet(Yi).map(h=>h(n)),i))),n.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function no(n,e,t,i=-1){if(O.ios&&n.inputState.flushIOSKey(e))return!0;let s=n.state.selection.main;if(O.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&n.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Xt(n.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||i==8&&e.insert.lengths.head)&&Xt(n.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Xt(n.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=sd(n,e,t));return n.state.facet(mh).some(a=>a(n,e.from,e.to,r,l))||n.dispatch(l()),!0}function sd(n,e,t){let i,s=n.state,r=s.selection.main,o=-1;if(e.from==e.to&&e.fromr.to){let a=e.fromf(n)),h,a);e.from==c&&(o=c)}if(o>-1)i={changes:e,selection:x.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=r.frome.to?s.sliceDoc(e.to,r.to):"";i=s.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let a=s.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(s.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let c=n.state.sliceDoc(e.from,e.to),f,u=t&&Mh(n,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=n.state.doc.lineAt(r.head);let d=r.to-e.to;i=s.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:a,range:h||p.map(a)};let m=p.to-d,g=m-c.length;if(n.state.sliceDoc(g,m)!=c||m>=f.from&&g<=f.to)return{range:p};let y=s.changes({from:g,to:m,insert:e.insert}),w=p.to-r.to;return{changes:y,range:h?x.range(Math.max(0,h.anchor+w),Math.max(0,h.head+w)):p.map(y)}})}else i={changes:a,selection:h&&s.selection.replaceRange(h)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:l,scrollIntoView:!0})}function Bh(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function rd(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new il(t,i)),(s!=t||r!=i)&&e.push(new il(s,r))),e}function od(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?x.single(t+e,i+e):null}function $n(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class ld{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.lastWheelEvent=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.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,O.safari&&e.contentDOM.addEventListener("input",()=>null),O.gecko&&kd(e.contentDOM.ownerDocument)}handleEvent(e){!md(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,t){let i=this.handlers[e];if(i){for(let s of i.observers)s(this.view,t);for(let s of i.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=ad(e),i=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!t[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=t}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&&Eh.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),O.android&&O.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return O.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Lh.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||hd.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from0?!0:O.safari&&!O.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 nl(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(s){Te(t.state,s)}}}function ad(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let s=i.spec,r=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(r)for(let l in r){let a=r[l];a&&t(l).handlers.push(nl(i.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(nl(i.value,a))}}for(let i in qe)t(i).handlers.push(qe[i]);for(let i in Oe)t(i).observers.push(Oe[i]);return e}const Lh=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],hd="dthko",Eh=[16,17,18,20,91,92,224,225],cn=6;function fn(n){return Math.max(0,n)*.7+8}function cd(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class fd{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=th(e.contentDOM),this.atoms=e.state.facet(Yi).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(z.allowMultipleSelections)&&ud(e,t),this.dragging=pd(e,t)&&Ih(t)==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&&cd(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,s=0,r=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=io(this.view);e.clientX-a.left<=s+cn?t=-fn(s-e.clientX):e.clientX+a.right>=o-cn&&(t=fn(e.clientX-o)),e.clientY-a.top<=r+cn?i=-fn(r-e.clientY):e.clientY+a.bottom>=l-cn&&(i=fn(e.clientY-l)),this.setScrollSpeed(t,i)}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,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=Th(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function ud(n,e){let t=n.state.facet(fh);return t.length?t[0](e):O.mac?e.metaKey:e.ctrlKey}function dd(n,e){let t=n.state.facet(uh);return t.length?t[0](e):O.mac?!e.altKey:!e.ctrlKey}function pd(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=Ei(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function md(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=Q.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const qe=Object.create(null),Oe=Object.create(null),Ph=O.ie&&O.ie_version<15||O.ios&&O.webkit_version<604;function gd(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Rh(n,t.value)},50)}function fs(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function Rh(n,e){e=fs(n.state,Qr,e);let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Sr!=null&&t.selection.ranges.every(a=>a.empty)&&Sr==r.toString()){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:x.cursor(h.from+f.length)}})}else o?i=t.changeByRange(a=>{let h=r.line(s++);return{changes:{from:a.from,to:a.to,insert:h.text},range:x.cursor(a.from+h.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Oe.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};Oe.wheel=Oe.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};qe.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);Oe.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};Oe.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};qe.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(dh))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=bd(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new fd(n,e,t,i)),i&&n.observer.ignore(()=>{ih(n.contentDOM);let r=n.root.activeElement;r&&!r.contains(n.contentDOM)&&r.blur()});let s=n.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function sl(n,e,t,i){if(i==1)return x.cursor(e,t);if(i==2)return _u(n.state,e,t);{let s=n.docView.lineAt(e,t),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return lDate.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(ol+1)%3:1}function bd(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=Ih(e),s=n.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,l){let a=n.posAndSideAtCoords({x:r.clientX,y:r.clientY},!1),h,c=sl(n,a.pos,a.assoc,i);if(t.pos!=a.pos&&!o){let f=sl(n,t.pos,t.assoc,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u1&&(h=xd(s,a.pos))?h:l?s.addRange(c):x.create([c])}}}function xd(n,e){for(let t=0;t=e)return x.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}qe.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let s=n.docView.tile.nearest(e.target);if(s&&s.isWidget()){let r=s.posAtStart,o=r+s.length;(r>=t.to||o<=t.from)&&(t=x.range(r,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",fs(n.state,Zr,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};qe.dragend=n=>(n.inputState.draggedContent=null,!1);function al(n,e,t,i){if(t=fs(n.state,Qr,t),!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=n.inputState,o=i&&r&&dd(n,e)?{from:r.from,to:r.to}:null,l={from:s,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}qe.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),s=0,r=()=>{++s==t.length&&al(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return al(n,e,i,!0),!0}return!1};qe.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=Ph?null:e.clipboardData;return t?(Rh(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(gd(n),!1)};function wd(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function vd(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:fs(n,Zr,e.join(n.lineBreak)),ranges:t,linewise:i}}let Sr=null;qe.copy=qe.cut=(n,e)=>{if(!Si(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:s}=vd(n.state);if(!t&&!s)return!1;Sr=s?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=Ph?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(wd(n,t),!1)};const Nh=rt.define();function Wh(n,e){let t=[];for(let i of n.facet(gh)){let s=i(n,e);s&&t.push(s)}return t.length?n.update({effects:t,annotations:Nh.of(!0)}):null}function Fh(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=Wh(n.state,e);t?n.dispatch(t):n.update([])}},10)}Oe.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),Fh(n)};Oe.blur=n=>{n.observer.clearSelectionRange(),Fh(n)};Oe.compositionstart=Oe.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};Oe.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,O.chrome&&O.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};Oe.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};qe.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(r&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),h=n.posAtDOM(l.endContainer,l.endOffset);return no(n,{from:a,to:h,insert:n.state.toText(r)},null),!0}}let s;if(O.chrome&&O.android&&(s=Lh.find(r=>r.inputType==e.inputType))&&(n.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return O.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),O.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>Oe.compositionend(n,e),20),!1};const hl=new Set;function kd(n){hl.has(n)||(hl.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const cl=["pre-wrap","normal","pre-line","break-spaces"];let ri=!1;function fl(){ri=!1}class Sd{constructor(e){this.lineWrapping=e,this.doc=q.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}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 cl.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(i-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=s,this.lineLength=r,a){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Ln&&(ri=!0),this.height=e)}replace(e,t,i){return ke.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=s[l],u=r.lineAt(a,J.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:r.lineAt(h,J.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=s[l-1].toA;)a=s[l-1].fromA,c=s[l-1].fromB,l--,ar*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.lineAt(0,J.ByPos,i,s,r))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Le extends Hh{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Ve(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof Le||s instanceof he&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof he?s=new Le(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):ke.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setMeasuredHeight(s):(i||this.outdated)&&(this.spaceAbove=0,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 he extends ke{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,s);if(t.lineWrapping){let h=s+(e0){let r=i[i.length-1];r instanceof he?i[i.length-1]=new he(r.length+s):i.push(null,new he(s-1))}if(e>0){let r=i[0];r instanceof he?i[0]=new he(e+r.length):i.unshift(new he(e-1),null)}return ke.of(i)}decomposeLeft(e,t){t.push(new he(e-1),null)}decomposeRight(e,t){t.push(null,new he(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),a=-1;for(s.from>t&&o.push(new he(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++],u=0;f<0&&(u=-f,f=s.heights[s.index++]),a==-1?a=f:Math.abs(f-a)>=Ln&&(a=-2);let d=new Le(c,f,u);d.outdated=!1,o.push(d),l+=c+1}l<=r&&o.push(null,new he(r-l).updateHeight(e,l));let h=ke.of(o);return(a<0||Math.abs(h.height-this.height)>=Ln||Math.abs(a-this.heightMetrics(e,t).perLine)>=Ln)&&(ri=!0),jn(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Md extends ke{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return h;let c=t==J.ByPosNoHeight?J.ByPosNoHeight:J.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(h)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,J.ByPos,i,s,r);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&ul(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?ke.of(this.break?[e,null,t]:[e,t]):(this.left=jn(this.left,e),this.right=jn(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return s&&s.from<=t+r.length&&s.more?a=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?a=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function ul(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof he&&(i=n[e+1])instanceof he&&n.splice(e-1,3,new he(t.length+1+i.length))}const Td=5;class so{constructor(e,t){this.pos=e,this.oracle=t,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,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Le?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Le(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=Td)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Le(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new he(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Le)return e;let t=new Le(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Le)&&!this.isCovered?this.nodes.push(new Le(0,-1,0)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=Math.min(h==n.parentNode?s.innerHeight:a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function Ld(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left0&&e.top0}function Ed(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Os{constructor(e,t,i,s){this.from=e,this.to=t,this.size=i,this.displaySize=s}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new Sd(i),this.stateDeco=ml(t),this.heightMap=ke.empty().applyChanges(this.stateDeco,q.empty,this.heightOracle.setDoc(t.doc),[new Re(0,0,0,t.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=L.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new un(r,o))}}return this.viewports=e.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?pl:new ro(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(xi(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=ml(this.state);let s=e.changedRanges,r=Re.extendWithRanges(s,Dd(i,this.stateDeco,e?e.changes:se.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);fl(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||ri)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!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),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(bh)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?_.RTL:_.LTR;let o=this.heightOracle.mustRefreshForWrapping(r)||this.mustMeasureContent==="refresh",l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:k,scaleY:S}=eh(t,l);(k>.005&&Math.abs(this.scaleX-k)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=k,this.scaleY=S,h|=16,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let d=th(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=nh(this.scrollParent||e.win);let m=(this.printing?Ed:Bd)(t,this.paddingTop),g=m.top-this.pixelViewport.top,y=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(a=!0)),!this.inView&&!this.scrollTarget&&!Ld(e.dom))return 0;let v=l.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),a){let k=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(k)&&(o=!0),o||s.lineWrapping&&Math.abs(v-this.contentDOMWidth)>s.charWidth){let{lineHeight:S,charWidth:C,textHeight:P}=e.docView.measureTextSize();o=S>0&&s.refresh(r,S,C,P,Math.max(5,v/C),k),o&&(e.docView.minWidth=0,h|=16)}g>0&&y>0?c=Math.max(g,y):g<0&&y<0&&(c=Math.min(g,y)),fl();for(let S of this.viewports){let C=S.from==this.viewport.from?k:e.docView.measureVisibleLineHeights(S);this.heightMap=(o?ke.empty().applyChanges(this.stateDeco,q.empty,this.heightOracle,[new Re(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Cd(S.from,C))}ri&&(h|=2)}let T=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return T&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||T)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new un(s.lineAt(o-i*1e3,J.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,J.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,J.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=_.LTR&&!i)return[];let l=[],a=(c,f,u,d)=>{if(f-cc&&yy.from>=u.from&&y.to<=u.to&&Math.abs(y.from-c)y.fromw));if(!g){if(fv.from<=f&&v.to>=f)){let v=t.moveToLineBoundary(x.cursor(f),!1,!0).head;v>c&&(f=v)}let y=this.gapSize(u,c,f,d),w=i||y<2e6?y:2e6;g=new Os(c,f,y,w)}l.push(g)},h=c=>{if(c.length2e6)for(let S of e)S.from>=c.from&&S.fromc.from&&a(c.from,d,c,f),pt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];H.spans(t,this.viewport.from,this.viewport.to,{span(r,o){i.push({from:r,to:o})},point(){}},20);let s=0;if(i.length!=this.visibleRanges.length)s=12;else for(let r=0;r=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||xi(this.heightMap.lineAt(e,J.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(t=>t.top<=e&&t.bottom>=e)||xi(this.heightMap.lineAt(this.scaler.fromDOM(e),J.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return xi(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 un{constructor(e,t){this.from=e,this.to=t}}function Rd(n,e,t){let i=[],s=n,r=0;return H.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function pn(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function Id(n,e){for(let t of n)if(e(t))return t}const pl={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function ml(n){let e=n.facet(as).filter(i=>typeof i!="function"),t=n.facet(to).filter(i=>typeof i!="function");return t.length&&e.push(H.join(t)),e}class ro{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,J.ByPos,e,0,0).top,c=t.lineAt(a,J.ByPos,e,0,0).bottom;return s+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function xi(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Ve(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(s=>xi(s,e)):n._content)}const mn=D.define({combine:n=>n.join(" ")}),Cr=D.define({combine:n=>n.indexOf(!0)>-1}),Ar=xt.newName(),Vh=xt.newName(),zh=xt.newName(),qh={"&light":"."+Vh,"&dark":"."+zh};function Mr(n,e,t){return new xt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const Nd=Mr("."+Ar,{"&":{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,')`,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"}},qh),Wd={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Bs=O.ie&&O.ie_version<=11;class Fd{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new pu,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(t=>{for(let i of t)this.queue.push(i);(O.ie&&O.ie_version<=11||O.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&O.android&&e.constructor.EDIT_CONTEXT!==!1&&!(O.chrome&&O.chrome_version<126)&&(this.editContext=new Vd(e),e.state.facet(lt)&&(e.contentDOM.editContext=this.editContext.editContext)),Bs&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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 t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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(t=>{t.length>0&&t[t.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((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(lt)?i.root.activeElement!=this.dom:!Si(this.dom,s))return;let r=s.anchorNode&&i.docView.tile.nearest(s.anchorNode);if(r&&r.isWidget()&&r.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(O.ie&&O.ie_version<=11||O.android&&O.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Ai(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Ei(e.root);if(!t)return!1;let i=O.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Hd(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let s=Si(this.dom,i);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&Xt(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{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 t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&Si(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new nd(this.view,e,t,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,s=Oh(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!$n(this.view.state.selection,t.newSel.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=gl(t,e.previousSibling||e.target.previousSibling,-1),s=gl(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.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(lt)!=e.state.facet(lt)&&(e.view.contentDOM.editContext=e.state.facet(lt)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.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 gl(n,e,t){for(;e;){let i=Q.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function yl(n,e){let t=e.startContainer,i=e.startOffset,s=e.endContainer,r=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return Ai(o.node,o.offset,s,r)&&([t,i,s,r]=[s,r,t,i]),{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}}function Hd(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return yl(n,s)}let t=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?yl(n,t):null}class Vd{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=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=i=>{let s=e.state.selection.main,{anchor:r,head:o}=s,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let h=a-l>i.text.length;l==this.from&&rthis.to&&(a=r);let c=Bh(e.state.sliceDoc(l,a),i.text,(h?s.from:s.to)-l,h?"end":null);if(!c){let u=x.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));$n(u,s)||e.dispatch({selection:u,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:q.of(i.text.slice(c.from,c.toB).split(` +`))};if((O.mac||O.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:q.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);no(e,f,x.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let s=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{let s=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(a{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:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=Ei(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,s=this.pendingContextChange;return e.changes.iterChanges((r,o,l,a,h)=>{if(i)return;let c=h.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,t+=c,this.to+=c;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(rthis.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),s&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.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||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+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 t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class M{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 t;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:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(s=>s.forEach(r=>i(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||mu(e.parent)||document,this.viewState=new dl(this,e.state||z.create(e)),e.scrollTo&&e.scrollTo.is(hn)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ut).map(s=>new Cs(s));for(let s of this.plugins)s.update(this);this.observer=new Fd(this),this.inputState=new ld(this),this.inputState.ensureHandlers(this.plugins),this.docView=new el(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof ie?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(Nh))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Wh(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(z.phrases)!=this.state.facet(z.phrases))return this.setState(r);s=zn.create(this,r,e),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;f=new Qt(d.empty?d:x.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(hn)&&(f=d.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=Un.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(bi)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(mn)!=s.state.facet(mn)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let u of this.state.facet(xr))try{u(s)}catch(d){Te(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Oh(this,c)&&h.force&&Xt(this.contentDOM,h.key,h.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 t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new dl(this,e),this.plugins=e.facet(Ut).map(i=>new Cs(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new el(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Ut),i=e.state.facet(Ut);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new Cs(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(nh(i||this.win))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(s);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(d=>{try{return d.read(this)}catch(p){return Te(this.state,p),bl}}),f=zn.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let d=0;d1||p<-1)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+p,i?i.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(xr))l(t)}get themeClasses(){return Ar+" "+(this.state.facet(Cr)?zh:Vh)+" "+this.state.facet(mn)}updateAttrs(){let e=xl(this,vh,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(lt)?"true":"false",class:"cm-content",style:`${O.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),xl(this,eo,t);let i=this.observer.ignore(()=>{let s=_o(this.contentDOM,this.contentAttrs,t),r=_o(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(M.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(bi);let e=this.state.facet(M.cspNonce);xt.mount(this.root,this.styleModules.concat(Nd).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 t=0;ti.plugin==e)||null),t&&t.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,t,i){return Ds(this,e,tl(this,e,t,i))}moveByGroup(e,t){return Ds(this,e,tl(this,e,t,i=>Xu(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=i[t?i.length-1:0];return x.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,i=!0){return Ju(this,e,t,i)}moveVertically(e,t,i){return Ds(this,e,Qu(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=kr(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),kr(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[et.find(r,e-s.from,-1,t)];return Pi(i,o.dir==_.LTR==t>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(yh)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>zd)return hh(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||ah(r.isolates,i=Xo(this,e))))return r.order;i||(i=Xo(this,e));let s=Su(e.text,t,i);return this.bidiCache.push(new Un(e.from,e.to,t,i,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||O.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ih(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,t={}){return hn.of(new Qt(typeof e=="number"?x.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return hn.of(new Qt(x.cursor(i.from),"start","start",i.top-e,t,!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 Z.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Z.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=xt.newName(),s=[mn.of(i),bi.of(Mr(`.${i}`,e))];return t&&t.dark&&s.push(Cr.of(!0)),s}static baseTheme(e){return At.lowest(bi.of(Mr("."+Ar,e,qh)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&Q.get(i)||Q.get(e);return((t=s?.root)===null||t===void 0?void 0:t.view)||null}}M.styleModule=bi;M.inputHandler=mh;M.clipboardInputFilter=Qr;M.clipboardOutputFilter=Zr;M.scrollHandler=xh;M.focusChangeEffect=gh;M.perLineTextDirection=yh;M.exceptionSink=ph;M.updateListener=xr;M.editable=lt;M.mouseSelectionStyle=dh;M.dragMovesSelection=uh;M.clickAddsSelectionRange=fh;M.decorations=as;M.blockWrappers=kh;M.outerDecorations=to;M.atomicRanges=Yi;M.bidiIsolatedRanges=Sh;M.scrollMargins=Ch;M.darkTheme=Cr;M.cspNonce=D.define({combine:n=>n.length?n[0]:""});M.contentAttributes=eo;M.editorAttributes=vh;M.lineWrapping=M.contentAttributes.of({class:"cm-lineWrapping"});M.announce=R.define();const zd=4096,bl={};class Un{constructor(e,t,i,s,r,o){this.from=e,this.to=t,this.dir=i,this.isolates=s,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],s=e.length?e[e.length-1].dir:_.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&Yr(o,t)}return t}const qd=O.mac?"mac":O.windows?"win":O.linux?"linux":"key";function Kd(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let a=0;ai.concat(s),[]))),t}function jd(n,e,t){return $h(Kh(n.state),e,n,t)}let mt=null;const Ud=4e3;function Gd(n,e=qd){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(y=>Kd(y,e));for(let y=1;y{let T=mt={view:v,prefix:w,scope:o};return setTimeout(()=>{mt==T&&(mt=null)},Ud),!0}]})}let m=p.join(" ");s(m,!1);let g=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),c&&(g.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let u in c)c[u].run.push(d=>f(d,Tr))}let a=o[e]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let Tr=null;function $h(n,e,t,i){Tr=e;let s=lu(e),r=Ce(s,0),o=Qe(r)==s.length&&s!=" ",l="",a=!1,h=!1,c=!1;mt&&mt.view==t&&mt.scope==i&&(l=mt.prefix+" ",Eh.indexOf(e.keyCode)<0&&(h=!0,mt=null));let f=new Set,u=g=>{if(g){for(let y of g.run)if(!f.has(y)&&(f.add(y),y(t)))return g.stopPropagation&&(c=!0),!0;g.preventDefault&&(g.stopPropagation&&(c=!0),h=!0)}return!1},d=n[i],p,m;return d&&(u(d[l+gn(s,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(O.windows&&e.ctrlKey&&e.altKey)&&!(O.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=wt[e.keyCode])&&p!=s?(u(d[l+gn(p,e,!0)])||e.shiftKey&&(m=Bi[e.keyCode])!=s&&m!=p&&u(d[l+gn(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(d[l+gn(s,e,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),Tr=null,a}class Xi{constructor(e,t,i,s,r){this.className=e,this.left=t,this.top=i,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.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,t,i){if(i.empty){let s=e.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let r=jh(e);return[new Xi(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return _d(e,t,i)}}function jh(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==_.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function vl(n,e,t,i){let s=n.coordsAtPos(e,t*2);if(!s)return i;let r=n.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,l=n.posAtCoords({x:r.left+1,y:o}),a=n.posAtCoords({x:r.right-1,y:o});return l==null||a==null?i:{from:Math.max(i.from,Math.min(l,a)),to:Math.min(i.to,Math.max(l,a))}}function _d(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),s=Math.min(t.to,n.viewport.to),r=n.textDirection==_.LTR,o=n.contentDOM,l=o.getBoundingClientRect(),a=jh(n),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),d=vr(n,i,1),p=vr(n,s,-1),m=d.type==ue.Text?d:null,g=p.type==ue.Text?p:null;if(m&&(n.lineWrapping||d.widgetLineBreaks)&&(m=vl(n,i,1,m)),g&&(n.lineWrapping||p.widgetLineBreaks)&&(g=vl(n,s,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return w(v(t.from,t.to,m));{let k=m?v(t.from,null,m):T(d,!1),S=g?v(null,t.to,g):T(p,!0),C=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&k.bottom+n.defaultLineHeight/2E&&W.from=ne)break;te>K&&I(Math.max($,K),k==null&&$<=E,Math.min(te,ne),S==null&&te>=N,me.dir)}if(K=re.to+1,K>=ne)break}return V.length==0&&I(E,k==null,N,S==null,n.textDirection),{top:P,bottom:B,horizontal:V}}function T(k,S){let C=l.top+(S?k.top:k.bottom);return{top:C,bottom:C,horizontal:[]}}}function Yd(n,e){return n.constructor==e.constructor&&n.eq(e)}class Jd{constructor(e,t){this.view=e,this.layer=t,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"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(En)!=e.state.facet(En)&&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 t=0,i=e.facet(En);for(;t!Yd(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[i].constructor&&s.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e,O.safari&&O.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 En=D.define();function Uh(n){return[Z.define(e=>new Jd(e,n)),En.of(n)]}const Ii=D.define({combine(n){return ot(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Xd(n={}){return[Ii.of(n),Qd,Zd,ep,bh.of(!0)]}function Gh(n){return n.startState.facet(Ii)!=n.state.facet(Ii)}const Qd=Uh({above:!0,markers(n){let{state:e}=n,t=e.facet(Ii),i=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty||t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:x.cursor(s.head,s.head>s.anchor?-1:1);for(let a of Xi.forRange(n,o,l))i.push(a)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Gh(n);return t&&kl(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){kl(e.state,n)},class:"cm-cursorLayer"});function kl(n,e){e.style.animationDuration=n.facet(Ii).cursorBlinkRate+"ms"}const Zd=Uh({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:Xi.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||Gh(n)},class:"cm-selectionLayer"}),ep=At.highest(M.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"}}}})),_h=R.define({map(n,e){return n==null?null:e.mapPos(n)}}),wi=pe.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(_h)?i.value:t,n)}}),tp=Z.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(wi);t==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"),(n.startState.field(wi)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(wi),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(wi)!=n&&this.view.dispatch({effects:_h.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function ip(){return[wi,tp]}function Sl(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,l)}function np(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class sp{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(l,a,h,c)=>s(c,h,h+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,h,c)=>{let f=i(l,a,h);f&&c(h,h+l[0].length,f)};else if(i)this.addMatch=(l,a,h,c)=>c(h,h+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new ct,i=t.add.bind(t);for(let{from:s,to:r}of np(e,this.maxLength))Sl(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(i=Math.min(l,i),s=Math.max(a,s))}),e.viewportMoved||s-i>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>=o){let a=e.state.doc.lineAt(o),h=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lu.push(y.range(m,g));if(a==h)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(g,e,m,p));t=t.update({filterFrom:c,filterTo:f,filter:(m,g)=>mf,add:u})}}return t}}const Dr=/x/.unicode!=null?"gu":"g",rp=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Dr),op={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 Ls=null;function lp(){var n;if(Ls==null&&typeof document<"u"&&document.body){let e=document.body.style;Ls=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Ls||!1}const Pn=D.define({combine(n){let e=ot(n,{render:null,specialChars:rp,addSpecialChars:null});return(e.replaceTabs=!lp())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Dr)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Dr)),e}});function ap(n={}){return[Pn.of(n),hp()]}let Cl=null;function hp(){return Cl||(Cl=Z.fromClass(class{constructor(n){this.view=n,this.decorations=L.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Pn)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new sp({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=Ce(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,a=hi(o.text,l,i-o.from);return L.replace({widget:new dp((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=L.replace({widget:new up(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Pn);n.startState.facet(Pn)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const cp="•";function fp(n){return n>=32?cp:n==10?"␤":String.fromCharCode(9216+n)}class up extends Ke{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=fp(this.code),i=e.state.phrase("Control character")+" "+(op[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class dp extends Ke{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 pp(){return gp}const mp=L.line({class:"cm-activeLine"}),gp=Z.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let s=n.lineBlockAt(i.head);s.from>e&&(t.push(mp.range(s.from)),e=s.from)}return L.set(t)}},{decorations:n=>n.decorations});class yp extends Ke{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Ci(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),s=Pi(t[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function bp(n){let e=Z.fromClass(class{constructor(t){this.view=t,this.placeholder=n?L.set([L.widget({widget:new yp(n),side:1}).range(0)]):L.none}get decorations(){return this.view.state.doc.length?L.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,M.contentAttributes.of({"aria-placeholder":n})]:e}const Or=2e3;function xp(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>Or||t.off>Or||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=s;a++){let h=n.doc.line(a);h.length<=l&&r.push(x.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=s;a++){let h=n.doc.line(a),c=ar(h.text,o,n.tabSize,!0);if(c<0)r.push(x.cursor(h.to));else{let f=ar(h.text,l,n.tabSize);r.push(x.range(h.from+c,h.from+f))}}}return r}function wp(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function Al(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>Or?-1:s==i.length?wp(n,e.clientX):hi(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function vp(n,e){let t=Al(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=Al(n,s);if(!l)return i;let a=xp(n.state,t,l);return a.length?o?x.create(a.concat(i.ranges)):x.create(a):i}}:null}function kp(n){let e=(t=>t.altKey&&t.button==0);return M.mouseSelectionStyle.of((t,i)=>e(i)?vp(t,i):null)}const Sp={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},Cp={style:"cursor: crosshair"};function Ap(n={}){let[e,t]=Sp[n.key||"Alt"],i=Z.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[i,M.contentAttributes.of(s=>{var r;return!((r=s.plugin(i))===null||r===void 0)&&r.isDown?Cp:null})]}const yn="-10000px";class Yh{constructor(e,t,i,s){this.facet=t,this.createTooltipView=i,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(e,t){var i;let s=e.state.facet(this.facet),r=s.filter(a=>a);if(s===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[h]=a),t.length=l.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function Mp(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const Es=D.define({combine:n=>{var e,t,i;return{position:O.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Mp}}}),Ml=new WeakMap,oo=Z.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(Es);this.position=e.position,this.parent=e.parent,this.classes=n.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 Yh(n,lo,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.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 n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(Es);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=yn,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(O.safari){let o=r.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(n=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),s=io(this.view);return{visible:{left:i.left+s.left,top:i.top+s.top,right:i.right-s.right,bottom:i.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(Es).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:t,space:i,scaleX:s,scaleY:r}=n,o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1)){c.style.top=yn;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=u.right-u.left,g=(e=Ml.get(h))!==null&&e!==void 0?e:u.bottom-u.top,y=h.offset||Dp,w=this.view.textDirection==_.LTR,v=u.width>i.right-i.left?w?i.left:i.right-u.width:w?Math.max(i.left,Math.min(f.left-(d?14:0)+y.x,i.right-m)):Math.min(Math.max(i.left,f.left-m+(d?14:0)-y.x),i.right-m),T=this.above[l];!a.strictSide&&(T?f.top-g-p-y.yi.bottom)&&T==i.bottom-f.bottom>f.top-i.top&&(T=this.above[l]=!T);let k=(T?f.top-i.top:i.bottom-f.bottom)-p;if(kv&&P.topS&&(S=T?P.top-g-2-p:P.bottom+p+2);if(this.position=="absolute"?(c.style.top=(S-n.parent.top)/r+"px",Tl(c,(v-n.parent.left)/s)):(c.style.top=S/r+"px",Tl(c,v/s)),d){let P=f.left+(w?y.x:-y.x)-(v+14-7);d.style.left=P/s+"px"}h.overlap!==!0&&o.push({left:v,top:S,right:C,bottom:S+g}),c.classList.toggle("cm-tooltip-above",T),c.classList.toggle("cm-tooltip-below",!T),h.positioned&&h.positioned(n.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 n of this.manager.tooltipViews)n.dom.style.top=yn}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Tl(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const Tp=M.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:"14px",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"}}}),Dp={x:0,y:0},lo=D.define({enables:[oo,Tp]}),Gn=D.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class us{static create(e){return new us(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Yh(e,Gn,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let s=i[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}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 Op=lo.compute([Gn],n=>{let e=n.facet(Gn);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:us.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class Bp{constructor(e,t,i,s,r){this.view=e,this.source=t,this.field=i,this.setHover=s,this.hoverTime=r,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;el.bottom||t.xl.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(s)).find(c=>c.from<=s&&c.to>=s),h=a&&a.dir==_.RTL?-1:1;r=t.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Te(e.state,a,"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(oo),t=e?e.manager.tooltips.findIndex(i=>i.create==us.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;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:s,tooltip:r}=this;if(s.length&&r&&!Lp(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!Ep(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const bn=4;function Lp(n,e){let{left:t,right:i,top:s,bottom:r}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();s=Math.min(l.top,s),r=Math.max(l.bottom,r)}return e.clientX>=t-bn&&e.clientX<=i+bn&&e.clientY>=s-bn&&e.clientY<=r+bn}function Ep(n,e,t,i,s,r){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.rights||Math.min(o.bottom,l)=e&&a<=t}function Pp(n,e={}){let t=R.define(),i=pe.define({create(){return[]},update(s,r){if(s.length&&(e.hideOnChange&&(r.docChanged||r.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(r,o))),r.docChanged)){let o=[];for(let l of s){let a=r.changes.mapPos(l.pos,-1,fe.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=r.changes.mapPos(h.end)),o.push(h)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(Rp)&&(s=[]);return s},provide:s=>Gn.from(s)});return{active:i,extension:[i,Z.define(s=>new Bp(s,n,i,t,e.hoverTime||300)),Op]}}function Jh(n,e){let t=n.plugin(oo);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const Rp=R.define(),Dl=D.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function ao(n,e){let t=n.plugin(Xh),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const Xh=Z.fromClass(class{constructor(n){this.input=n.state.facet(Ni),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(Dl);this.top=new xn(n,!0,e.topContainer),this.bottom=new xn(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(Dl);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new xn(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new xn(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Ni);if(t!=this.input){let i=t.filter(a=>a),s=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(n.view),l.push(c)):(c=this.panels[h],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>M.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class xn{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.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 t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Ol(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Ol(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 Ol(n){let e=n.nextSibling;return n.remove(),e}const Ni=D.define({enables:Xh});function Ip(n,e){let t,i=new Promise(o=>t=o),s=o=>Np(o,e,t);n.state.field(Ps,!1)?n.dispatch({effects:Qh.of(s)}):n.dispatch({effects:R.appendConfig.of(Ps.init(()=>[s]))});let r=Zh.of(s);return{close:r,result:i.then(o=>((n.win.queueMicrotask||(a=>n.win.setTimeout(a,10)))(()=>{n.state.field(Ps).indexOf(s)>-1&&n.dispatch({effects:r})}),o))}}const Ps=pe.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(Qh)?n=[t.value].concat(n):t.is(Zh)&&(n=n.filter(i=>i!=t.value));return n},provide:n=>Ni.computeN([n],e=>e.field(n))}),Qh=R.define(),Zh=R.define();function Np(n,e,t){let i=e.content?e.content(n,()=>o(null)):null;if(!i){if(i=j("form"),e.input){let l=j("input",e.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),i.appendChild(j("label",(e.label||"")+": ",l))}else i.appendChild(document.createTextNode(e.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(j("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let s=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let l=0;l{h.keyCode==27?(h.preventDefault(),o(null)):h.keyCode==13&&(h.preventDefault(),o(a))}),a.addEventListener("submit",h=>{h.preventDefault(),o(a)})}let r=j("div",i,j("button",{onclick:()=>o(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(r.className=e.class),r.classList.add("cm-dialog");function o(l){r.contains(r.ownerDocument.activeElement)&&n.focus(),t(l)}return{dom:r,top:e.top,mount:()=>{if(e.focus){let l;typeof e.focus=="string"?l=i.querySelector(e.focus):l=i.querySelector("input")||i.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class ut extends bt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ut.prototype.elementClass="";ut.prototype.toDOM=void 0;ut.prototype.mapMode=fe.TrackBefore;ut.prototype.startSide=ut.prototype.endSide=-1;ut.prototype.point=!0;const Rn=D.define(),Wp=D.define(),Fp={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>H.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Ti=D.define();function Hp(n){return[ec(),Ti.of({...Fp,...n})]}const Bl=D.define({combine:n=>n.some(e=>e)});function ec(n){return[Vp]}const Vp=Z.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.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=n.state.facet(Ti).map(e=>new El(n,e)),this.fixed=!n.state.facet(Bl);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),n.scrollDOM.insertBefore(this.dom,n.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(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.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(Bl)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=H.iter(this.view.state.facet(Rn),this.view.viewport.from),i=[],s=this.gutters.map(r=>new zp(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let l of r.type)if(l.type==ue.Text&&o){Br(t,i,l.from);for(let a of s)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of s)a.widget(this.view,l)}else if(r.type==ue.Text){Br(t,i,r.from);for(let o of s)o.line(this.view,r,i)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Ti),t=n.state.facet(Ti),i=n.docChanged||n.heightChanged||n.viewportChanged||!H.eq(n.startState.facet(Rn),n.state.facet(Rn),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(n)&&(i=!0);else{i=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new El(this.view,r)):(this.gutters[o].update(n),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>M.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,s=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==_.LTR?{left:i,right:s}:{right:i,left:s}})});function Ll(n){return Array.isArray(n)?n:[n]}function Br(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class zp{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=H.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let l=new tc(e,o,r,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,o,r,i);this.height=t.bottom,this.i++}line(e,t,i){let s=[];Br(this.cursor,s,t.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),s=i?[i]:null;for(let r of e.state.facet(Wp)){let o=r(e,t.widget,t);o&&(s||(s=[])).push(o)}s&&this.addElement(e,t,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class El{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=s.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,s)&&s.preventDefault()});this.markers=Ll(t.markers(e)),t.initialSpacer&&(this.spacer=new tc(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Ll(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!H.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class tc{constructor(e,t,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,s)}update(e,t,i,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),qp(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=rr(l,a,h)||o(l,a,h):o}return i}})}});class Rs extends ut{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Is(n,e){return n.state.facet(Gt).formatNumber(e,n.state)}const jp=Ti.compute([Gt],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Kp)},lineMarker(e,t,i){return i.some(s=>s.toDOM)?null:new Rs(Is(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let s of e.state.facet($p)){let r=s(e,t,i);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(Gt)!=e.state.facet(Gt),initialSpacer(e){return new Rs(Is(e,Pl(e.state.doc.lines)))},updateSpacer(e,t){let i=Is(t.view,Pl(t.view.state.doc.lines));return i==e.number?e:new Rs(i)},domEventHandlers:n.facet(Gt).domEventHandlers,side:"before"}));function Up(n={}){return[Gt.of(n),ec(),jp]}function Pl(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(Gp.range(s)))}return H.of(e)});function Yp(){return _p}const Jp=1024;let Xp=0;class Ie{constructor(e,t){this.from=e,this.to=t}}class F{constructor(e={}){this.id=Xp++,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=Se.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}F.closedBy=new F({deserialize:n=>n.split(" ")});F.openedBy=new F({deserialize:n=>n.split(" ")});F.group=new F({deserialize:n=>n.split(" ")});F.isolate=new F({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});F.contextHash=new F({perNode:!0});F.lookAhead=new F({perNode:!0});F.mounted=new F({perNode:!0});class Zt{constructor(e,t,i,s=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=s}static get(e){return e&&e.props&&e.props[F.mounted.id]}}const Qp=Object.create(null);class Se{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Qp,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Se(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}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 t=this.prop(F.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(F.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}Se.none=new Se("",Object.create(null),0,8);class ho{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|G.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=s&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!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 t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:uo(Se.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new Y(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new Y(Se.none,t,i,s)))}static build(e){return im(e)}}Y.empty=new Y(Se.none,[],[],0);class co{constructor(e,t){this.buffer=e,this.index=t}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 co(this.buffer,this.index)}}class kt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Se.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,i){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Wi(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from,u;if(!(!(r&G.EnterBracketed&&c instanceof Y&&(u=Zt.get(c))&&!u.overlay&&u.bracketed&&i>=f&&i<=f+c.length)&&!ic(s,i,f,f+c.length))){if(c instanceof kt){if(r&G.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,t,i-f,s);if(d>-1)return new tt(new Zp(o,c,e,f),null,d)}else if(r&G.IncludeAnonymous||!c.type.isAnonymous||fo(c)){let d;if(!(r&G.IgnoreMounts)&&(d=Zt.get(c))&&!d.overlay)return new be(d.tree,f,e,o);let p=new be(c,f,e,o);return r&G.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?c.children.length-1:0,t,i,s,r)}}}if(r&G.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<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)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let s;if(!(i&G.IgnoreOverlays)&&(s=Zt.get(this._tree))&&s.overlay){let r=e-this.from,o=i&G.EnterBracketed&&s.bracketed;for(let{from:l,to:a}of s.overlay)if((t>0||o?l<=r:l=r:a>r))return new be(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}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 Il(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function Lr(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Zp{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class tt extends nc{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,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new tt(this.context,this,r)}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)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&G.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new tt(this.context,this,r)}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,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new tt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new tt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1];e.push(i.slice(s,r,o)),t.push(0)}return new Y(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function sc(n){if(!n.length)return null;let e=0,t=n[0];for(let r=1;rt.from||o.to=e){let l=new be(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[i])).push(Wi(l,e,t,!1))}}return s?sc(s):i}class _n{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~G.EnterBracketed,e instanceof be)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.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,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof be?(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,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}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,t,i=this.mode){return this.buffer?i&G.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&G.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&G.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:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<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 t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&G.IncludeAnonymous||l instanceof kt||!l.type.isAnonymous||fo(l))return!1}return!0}move(e,t){if(t&&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,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}for(let s=i;s=0;r--){if(r<0)return Lr(this._tree,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function fo(n){return n.children.some(e=>e instanceof kt||!e.type.isAnonymous||fo(e))}function im(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Jp,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new co(t,t.length):t,a=i.types,h=0,c=0;function f(k,S,C,P,B,V){let{id:I,start:E,end:N,size:W}=l,K=c,ne=h;if(W<0)if(l.next(),W==-1){let ae=r[I];C.push(ae),P.push(E-k);return}else if(W==-3){h=I;return}else if(W==-4){c=I;return}else throw new RangeError(`Unrecognized record size: ${W}`);let re=a[I],me,$,te=E-k;if(N-E<=s&&($=g(l.pos-S,B))){let ae=new Uint16Array($.size-$.skip),ge=l.pos-$.size,Ue=ae.length;for(;l.pos>ge;)Ue=y($.start,ae,Ue);me=new kt(ae,N-$.start,i),te=$.start-k}else{let ae=l.pos-W;l.next();let ge=[],Ue=[],Tt=I>=o?I:-1,qt=0,rn=N;for(;l.pos>ae;)Tt>=0&&l.id==Tt&&l.size>=0?(l.end<=rn-s&&(p(ge,Ue,E,qt,l.end,rn,Tt,K,ne),qt=ge.length,rn=l.end),l.next()):V>2500?u(E,ae,ge,Ue):f(E,ae,ge,Ue,Tt,V+1);if(Tt>=0&&qt>0&&qt-1&&qt>0){let Ro=d(re,ne);me=uo(re,ge,Ue,0,ge.length,0,N-E,Ro,Ro)}else me=m(re,ge,Ue,N-E,K-N,ne)}C.push(me),P.push(te)}function u(k,S,C,P){let B=[],V=0,I=-1;for(;l.pos>S;){let{id:E,start:N,end:W,size:K}=l;if(K>4)l.next();else{if(I>-1&&N=0;W-=3)E[K++]=B[W],E[K++]=B[W+1]-N,E[K++]=B[W+2]-N,E[K++]=K;C.push(new kt(E,B[2]-N,i)),P.push(N-k)}}function d(k,S){return(C,P,B)=>{let V=0,I=C.length-1,E,N;if(I>=0&&(E=C[I])instanceof Y){if(!I&&E.type==k&&E.length==B)return E;(N=E.prop(F.lookAhead))&&(V=P[I]+E.length+N)}return m(k,C,P,B,V,S)}}function p(k,S,C,P,B,V,I,E,N){let W=[],K=[];for(;k.length>P;)W.push(k.pop()),K.push(S.pop()+C-B);k.push(m(i.types[I],W,K,V-B,E-V,N)),S.push(B-C)}function m(k,S,C,P,B,V,I){if(V){let E=[F.contextHash,V];I=I?[E].concat(I):[E]}if(B>25){let E=[F.lookAhead,B];I=I?[E].concat(I):[E]}return new Y(k,S,C,P,I)}function g(k,S){let C=l.fork(),P=0,B=0,V=0,I=C.end-s,E={size:0,start:0,skip:0};e:for(let N=C.pos-k;C.pos>N;){let W=C.size;if(C.id==S&&W>=0){E.size=P,E.start=B,E.skip=V,V+=4,P+=4,C.next();continue}let K=C.pos-W;if(W<0||K=o?4:0,re=C.start;for(C.next();C.pos>K;){if(C.size<0)if(C.size==-3||C.size==-4)ne+=4;else break e;else C.id>=o&&(ne+=4);C.next()}B=re,P+=W,V+=ne}return(S<0||P==k)&&(E.size=P,E.start=B,E.skip=V),E.size>4?E:void 0}function y(k,S,C){let{id:P,start:B,end:V,size:I}=l;if(l.next(),I>=0&&P4){let N=l.pos-(I-4);for(;l.pos>N;)C=y(k,S,C)}S[--C]=E,S[--C]=V-k,S[--C]=B-k,S[--C]=P}else I==-3?h=P:I==-4&&(c=P);return C}let w=[],v=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,w,v,-1,0);let T=(e=n.length)!==null&&e!==void 0?e:w.length?v[0]+w[0].length:0;return new Y(a[n.topID],w.reverse(),v.reverse(),T)}const Nl=new WeakMap;function In(n,e){if(!n.isAnonymous||e instanceof kt||e.type!=n)return 1;let t=Nl.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof Y)){t=1;break}t+=In(n,i)}Nl.set(e,t)}return t}function uo(n,e,t,i,s,r,o,l,a){let h=0;for(let p=i;p=c)break;S+=C}if(v==T+1){if(S>c){let C=p[T];d(C.children,C.positions,0,C.children.length,m[T]+w);continue}f.push(p[T])}else{let C=m[v-1]+p[v-1].length-k;f.push(uo(n,p,m,T,v,k,C,null,a))}u.push(k+w-r)}}return d(e,t,i,s,0),(l||a)(f,u,o)}class Pb{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof tt?this.setBuffer(e.context.buffer,e.index,t):e instanceof be&&this.map.set(e.tree,t)}get(e){return e instanceof tt?this.getBuffer(e.context.buffer,e.index):e instanceof be?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class ht{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new ht(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,f)-h;u=d>=p?null:new ht(d,p,u.tree,u.offset+h,l>0,!!c)}if(u&&s.push(u),o.to>f)break;o=rnew Ie(s.from,s.to)):[new Ie(0,0)]:[new Ie(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class nm{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function Rb(n){return(e,t,i,s)=>new rm(e,n,t,i,s)}class Wl{constructor(e,t,i,s,r,o){this.parser=e,this.parse=t,this.overlay=i,this.bracketed=s,this.target=r,this.from=o}}function Fl(n){if(!n.length||n.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class sm{constructor(e,t,i,s,r,o,l,a){this.parser=e,this.predicate=t,this.mounts=i,this.index=s,this.start=r,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const Er=new F({perNode:!0});class rm{constructor(e,t,i,s,r){this.nest=t,this.input=i,this.fragments=s,this.ranges=r,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let s of this.inner)s.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new Y(i.type,i.children,i.positions,i.length,i.propValues.concat([[Er,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[F.mounted.id]=new Zt(t,e.overlay,e.parser,e.bracketed),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(s)){if(t){let h=t.mounts.find(c=>c.frag.from<=s.from&&c.frag.to>=s.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let f=c.from+h.pos,u=c.to+h.pos;f>=s.from&&u<=s.to&&!t.ranges.some(d=>d.fromf)&&t.ranges.push({from:f,to:u})}}l=!1}else if(i&&(o=om(i.ranges,s.from,s.to)))l=o!=2;else if(!s.type.isAnonymous&&(r=this.nest(s,this.input))&&(s.fromnew Ie(f.from-s.from,f.to-s.from)):null,!!r.bracketed,s.tree,c.length?c[0].from:s.from)),r.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):l=!1}}else if(t&&(a=t.predicate(s))&&(a===!0&&(a=new Ie(s.from,s.to)),a.from=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&s.firstChild())t&&t.depth++,i&&i.depth++;else for(;!s.nextSibling();){if(!s.parent())break e;if(t&&!--t.depth){let h=zl(this.ranges,t.ranges);h.length&&(Fl(h),this.inner.splice(t.index,0,new Wl(t.parser,t.parser.startParse(this.input,ql(t.mounts,h),h),t.ranges.map(c=>new Ie(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function om(n,e,t){for(let i of n){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function Hl(n,e,t,i,s,r){if(e=e&&t.enter(i,1,G.IgnoreOverlays|G.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof Y)t=t.children[0];else break}return!1}}class am{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(Er))!==null&&t!==void 0?t:i.to,this.inner=new Vl(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Er))!==null&&e!==void 0?e:t.to,this.inner=new Vl(t.tree,-t.offset)}}findMounts(e,t){var i;let s=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let r=this.inner.cursor.node;r;r=r.parent){let o=(i=r.tree)===null||i===void 0?void 0:i.prop(F.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=r.to)break;a.tree==this.curFrag.tree&&s.push({frag:a,pos:r.from-a.offset,mount:o})}}}return s}}function zl(n,e){let t=null,i=e;for(let s=1,r=0;s=l)break;a.to<=o||(t||(i=t=e.slice()),a.froml&&t.splice(r+1,0,new Ie(l,a.to))):a.to>l?t[r--]=new Ie(l,a.to):t.splice(r--,1))}}return i}function hm(n,e,t,i){let s=0,r=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=s==n.length?1e9:o?n[s].to:n[s].from,f=r==e.length?1e9:l?e[r].to:e[r].from;if(o!=l){let u=Math.max(a,t),d=Math.min(c,f,i);unew Ie(u.from+i,u.to+i)),f=hm(e,c,a,h);for(let u=0,d=a;;u++){let p=u==f.length,m=p?h:f[u].from;if(m>d&&t.push(new ht(d,m,s.tree,-o,r.from>=d||r.openStart,r.to<=m||r.openEnd)),p)break;d=f[u].to}}else t.push(new ht(a,h,s.tree,-o,r.from>=o||r.openStart,r.to<=l||r.openEnd))}return t}let cm=0;class Pe{constructor(e,t,i,s){this.name=e,this.set=t,this.base=i,this.modified=s,this.id=cm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof Pe&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let s=new Pe(i,[],null,[]);if(s.set.push(s),t)for(let r of t.set)s.set.push(r);return s}static defineModifier(e){let t=new Yn(e);return i=>i.modified.indexOf(t)>-1?i:Yn.get(i.base||i,i.modified.concat(t).sort((s,r)=>s.id-r.id))}}let fm=0;class Yn{constructor(e){this.name=e,this.instances=[],this.id=fm++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&um(t,l.modified));if(i)return i;let s=[],r=new Pe(e.name,s,e,t);for(let l of t)l.instances.push(r);let o=dm(t);for(let l of e.set)if(!l.modified.length)for(let a of o)s.push(Yn.get(l,a));return r}}function um(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function dm(n){let e=[[]];for(let t=0;ti.length-t.length)}function pm(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let r=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+s);let c=new Fi(i,o,a>0?r.slice(0,a):null);e[h]=c.sort(e[h])}}return oc.add(e)}const oc=new F({combine(n,e){let t,i,s;for(;n||e;){if(!n||e&&n.depth>=e.depth?(s=e,e=e.next):(s=n,n=n.next),t&&t.mode==s.mode&&!s.context&&!t.context)continue;let r=new Fi(s.tags,s.mode,s.context);t?t.next=r:i=r,t=r}return i}});class Fi{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=s;for(let l of r)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function mm(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function gm(n,e,t,i=0,s=n.length){let r=new ym(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class ym{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=s,c=bm(e)||Fi.empty,f=mm(r,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(t,l),h),c.opaque)return;let u=e.tree&&e.tree.prop(F.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),m=e.firstChild();for(let g=0,y=l;;g++){let w=g=v||!e.nextSibling())););if(!w||v>i)break;y=w.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,w.from+l),Math.min(i,y),"",p),this.startSpan(Math.min(i,y),h))}m&&e.parent()}else if(e.firstChild()){u&&(s="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function bm(n){let e=n.type.prop(oc);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const A=Pe.define,vn=A(),dt=A(),Kl=A(dt),$l=A(dt),pt=A(),kn=A(pt),Ns=A(pt),Je=A(),Dt=A(Je),_e=A(),Ye=A(),Pr=A(),mi=A(Pr),Sn=A(),b={comment:vn,lineComment:A(vn),blockComment:A(vn),docComment:A(vn),name:dt,variableName:A(dt),typeName:Kl,tagName:A(Kl),propertyName:$l,attributeName:A($l),className:A(dt),labelName:A(dt),namespace:A(dt),macroName:A(dt),literal:pt,string:kn,docString:A(kn),character:A(kn),attributeValue:A(kn),number:Ns,integer:A(Ns),float:A(Ns),bool:A(pt),regexp:A(pt),escape:A(pt),color:A(pt),url:A(pt),keyword:_e,self:A(_e),null:A(_e),atom:A(_e),unit:A(_e),modifier:A(_e),operatorKeyword:A(_e),controlKeyword:A(_e),definitionKeyword:A(_e),moduleKeyword:A(_e),operator:Ye,derefOperator:A(Ye),arithmeticOperator:A(Ye),logicOperator:A(Ye),bitwiseOperator:A(Ye),compareOperator:A(Ye),updateOperator:A(Ye),definitionOperator:A(Ye),typeOperator:A(Ye),controlOperator:A(Ye),punctuation:Pr,separator:A(Pr),bracket:mi,angleBracket:A(mi),squareBracket:A(mi),paren:A(mi),brace:A(mi),content:Je,heading:Dt,heading1:A(Dt),heading2:A(Dt),heading3:A(Dt),heading4:A(Dt),heading5:A(Dt),heading6:A(Dt),contentSeparator:A(Je),list:A(Je),quote:A(Je),emphasis:A(Je),strong:A(Je),link:A(Je),monospace:A(Je),strikethrough:A(Je),inserted:A(),deleted:A(),changed:A(),invalid:A(),meta:Sn,documentMeta:A(Sn),annotation:A(Sn),processingInstruction:A(Sn),definition:Pe.defineModifier("definition"),constant:Pe.defineModifier("constant"),function:Pe.defineModifier("function"),standard:Pe.defineModifier("standard"),local:Pe.defineModifier("local"),special:Pe.defineModifier("special")};for(let n in b){let e=b[n];e instanceof Pe&&(e.name=n)}lc([{tag:b.link,class:"tok-link"},{tag:b.heading,class:"tok-heading"},{tag:b.emphasis,class:"tok-emphasis"},{tag:b.strong,class:"tok-strong"},{tag:b.keyword,class:"tok-keyword"},{tag:b.atom,class:"tok-atom"},{tag:b.bool,class:"tok-bool"},{tag:b.url,class:"tok-url"},{tag:b.labelName,class:"tok-labelName"},{tag:b.inserted,class:"tok-inserted"},{tag:b.deleted,class:"tok-deleted"},{tag:b.literal,class:"tok-literal"},{tag:b.string,class:"tok-string"},{tag:b.number,class:"tok-number"},{tag:[b.regexp,b.escape,b.special(b.string)],class:"tok-string2"},{tag:b.variableName,class:"tok-variableName"},{tag:b.local(b.variableName),class:"tok-variableName tok-local"},{tag:b.definition(b.variableName),class:"tok-variableName tok-definition"},{tag:b.special(b.variableName),class:"tok-variableName2"},{tag:b.definition(b.propertyName),class:"tok-propertyName tok-definition"},{tag:b.typeName,class:"tok-typeName"},{tag:b.namespace,class:"tok-namespace"},{tag:b.className,class:"tok-className"},{tag:b.macroName,class:"tok-macroName"},{tag:b.propertyName,class:"tok-propertyName"},{tag:b.operator,class:"tok-operator"},{tag:b.comment,class:"tok-comment"},{tag:b.meta,class:"tok-meta"},{tag:b.invalid,class:"tok-invalid"},{tag:b.punctuation,class:"tok-punctuation"}]);var Ws;const Rt=new F;function ac(n){return D.define({combine:n?e=>e.concat(n):void 0})}const xm=new F;class Ne{constructor(e,t,i=[],s=""){this.data=e,this.name=s,z.prototype.hasOwnProperty("tree")||Object.defineProperty(z.prototype,"tree",{get(){return de(this)}}),this.parser=t,this.extension=[St.of(this),z.languageData.of((r,o,l)=>{let a=jl(r,o,l),h=a.type.prop(Rt);if(!h)return[];let c=r.facet(h),f=a.type.prop(xm);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return jl(e,t,i).type.prop(Rt)==this.data}findRegions(e){let t=e.facet(St);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(Rt)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(F.mounted);if(l){if(l.tree.prop(Rt)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new Rr(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function de(n){let e=n.field(Ne.state,!1);return e?e.tree:Y.empty}class wm{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,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let gi=null;class oi{constructor(e,t,i=[],s,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new oi(e,t,[],Y.empty,0,i,[],null)}startParse(){return this.parser.startParse(new wm(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Y.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ht.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=gi;gi=this;try{return e()}finally{gi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Ul(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=ht.applyChanges(i,a),s=Y.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=Ul(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends rc{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let a=gi;if(a){for(let h of s)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new Y(Se.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return gi}}function Ul(n,e,t){return ht.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class li{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new li(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=oi.create(e.facet(St).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new li(i)}}Ne.state=pe.define({create:li.init,update(n,e){for(let t of e.effects)if(t.is(Ne.setState))return t.value;return e.startState.facet(St)!=e.state.facet(St)?li.init(e.state):n.apply(e)}});let hc=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(hc=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Fs=typeof navigator<"u"&&(!((Ws=navigator.scheduling)===null||Ws===void 0)&&Ws.isInputPending)?()=>navigator.scheduling.isInputPending():null,vm=Z.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 t=this.view.state.field(Ne.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Ne.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=hc(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,a=r.context.work(()=>Fs&&Fs()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Ne.setState.of(new li(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Te(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),St=D.define({combine(n){return n.length?n[0]:null},enables:n=>[Ne.state,vm,M.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class Nb{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class cc{constructor(e,t,i,s,r,o=void 0){this.name=e,this.alias=t,this.extensions=i,this.filename=s,this.loadFunc=r,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:i}=e;if(!t){if(!i)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(i)}return new cc(e.name,(e.alias||[]).concat(e.name).map(s=>s.toLowerCase()),e.extensions||[],e.filename,t,i)}static matchFilename(e,t){for(let s of e)if(s.filename&&s.filename.test(t))return s;let i=/\.([^.]+)$/.exec(t);if(i){for(let s of e)if(s.extensions.indexOf(i[1])>-1)return s}return null}static matchLanguageName(e,t,i=!0){t=t.toLowerCase();for(let s of e)if(s.alias.some(r=>r==t))return s;if(i)for(let s of e)for(let r of s.alias){let o=t.indexOf(r);if(o>-1&&(r.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+r.length])))return s}return null}}const km=D.define(),Qi=D.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Vt(n){let e=n.facet(Qi);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Hi(n,e){let t="",i=n.tabSize,s=n.facet(Qi)[0];if(s==" "){for(;e>=i;)t+=" ",e-=i;s=" "}for(let r=0;r=e?Sm(n,t,e):null}class ds{constructor(e,t={}){this.state=e,this.options=t,this.unit=Vt(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return hi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const fc=new F;function Sm(n,e,t){let i=e.resolveStack(t),s=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(s!=i.node){let r=[];for(let o=s;o&&!(o.fromi.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return uc(i,n,t)}function uc(n,e,t){for(let i=n;i;i=i.next){let s=Am(i.node);if(s)return s(mo.create(e,t,i))}return 0}function Cm(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function Am(n){let e=n.type.prop(fc);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(F.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>dc(o,!0,1,void 0,r&&!Cm(o)?s.from:void 0)}return n.parent==null?Mm:null}function Mm(){return 0}class mo extends ds{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new mo(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(Tm(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return uc(this.context.next,this.base,this.pos)}}function Tm(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function Dm(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let h=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+h}}l=a.to}}function Wb({closing:n,align:e=!0,units:t=1}){return i=>dc(i,e,t,n)}function dc(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||s==n.pos+o,a=e?Dm(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}const Fb=n=>n.baseIndent;function Hb({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const Om=200;function Bm(){return z.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,s=t.lineAt(i);if(i>s.from+Om)return n;let r=t.sliceString(s.from,i);if(!e.some(h=>h.test(r)))return n;let{state:o}=n,l=-1,a=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==l)continue;l=c.from;let f=po(o,c.from);if(f==null)continue;let u=/^\s*/.exec(c.text)[0],d=Hi(o,f);u!=d&&a.push({from:c.from,to:c.from+u.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const Lm=D.define(),Em=new F;function Vb(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(r&&l.from=e&&h.to>t&&(r=h)}}return r}function Rm(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function Jn(n,e,t){for(let i of n.facet(Lm)){let s=i(n,e,t);if(s)return s}return Pm(n,e,t)}function pc(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const ps=R.define({map:pc}),Zi=R.define({map:pc});function mc(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const zt=pe.define({create(){return L.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,i)=>n=Gl(n,t,i)),n=n.map(e.changes);for(let t of e.effects)if(t.is(ps)&&!Im(n,t.value.from,t.value.to)){let{preparePlaceholder:i}=e.state.facet(bc),s=i?L.replace({widget:new qm(i(e.state,t.value))}):_l;n=n.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(Zi)&&(n=n.update({filter:(i,s)=>t.value.from!=i||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=Gl(n,e.selection.main.head)),n},provide:n=>M.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,s)=>{t.push(i,s)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{se&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(s,r)=>s>=t||r<=e}):n}function Xn(n,e,t){var i;let s=null;return(i=n.field(zt,!1))===null||i===void 0||i.between(e,t,(r,o)=>{(!s||s.from>r)&&(s={from:r,to:o})}),s}function Im(n,e,t){let i=!1;return n.between(e,e,(s,r)=>{s==e&&r==t&&(i=!0)}),i}function gc(n,e){return n.field(zt,!1)?e:e.concat(R.appendConfig.of(xc()))}const Nm=n=>{for(let e of mc(n)){let t=Jn(n.state,e.from,e.to);if(t)return n.dispatch({effects:gc(n.state,[ps.of(t),yc(n,t)])}),!0}return!1},Wm=n=>{if(!n.state.field(zt,!1))return!1;let e=[];for(let t of mc(n)){let i=Xn(n.state,t.from,t.to);i&&e.push(Zi.of(i),yc(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function yc(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,s=n.state.doc.lineAt(e.to).number;return M.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${s}.`)}const Fm=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(zt,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,s)=>{t.push(Zi.of({from:i,to:s}))}),n.dispatch({effects:t}),!0},Vm=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Nm},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Wm},{key:"Ctrl-Alt-[",run:Fm},{key:"Ctrl-Alt-]",run:Hm}],zm={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},bc=D.define({combine(n){return ot(n,zm)}});function xc(n){return[zt,jm]}function wc(n,e){let{state:t}=n,i=t.facet(bc),s=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=Xn(n.state,l.from,l.to);a&&n.dispatch({effects:Zi.of(a)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,s,e);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const _l=L.replace({widget:new class extends Ke{toDOM(n){return wc(n,null)}}});class qm extends Ke{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return wc(e,this.value)}}const Km={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Hs extends ut{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function $m(n={}){let e={...Km,...n},t=new Hs(e,!0),i=new Hs(e,!1),s=Z.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(St)!=o.state.facet(St)||o.startState.field(zt,!1)!=o.state.field(zt,!1)||de(o.startState)!=de(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new ct;for(let a of o.viewportLineBlocks){let h=Xn(o.state,a.from,a.to)?i:Jn(o.state,a.from,a.to)?t:null;h&&l.add(a.from,a.from,h)}return l.finish()}}),{domEventHandlers:r}=e;return[s,Hp({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||H.empty},initialSpacer(){return new Hs(e,!1)},domEventHandlers:{...r,click:(o,l,a)=>{if(r.click&&r.click(o,l,a))return!0;let h=Xn(o.state,l.from,l.to);if(h)return o.dispatch({effects:Zi.of(h)}),!0;let c=Jn(o.state,l.from,l.to);return c?(o.dispatch({effects:ps.of(c)}),!0):!1}}}),xc()]}const jm=M.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 en{constructor(e,t){this.specs=e;let i;function s(l){let a=xt.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof Ne?l=>l.prop(Rt)==o.data:o?l=>l==o:void 0,this.style=lc(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new xt(i):null,this.themeType=t.themeType}static define(e,t){return new en(e,t||{})}}const Ir=D.define(),vc=D.define({combine(n){return n.length?[n[0]]:null}});function Vs(n){let e=n.facet(Ir);return e.length?e:n.facet(vc)}function kc(n,e){let t=[Gm],i;return n instanceof en&&(n.module&&t.push(M.styleModule.of(n.module)),i=n.themeType),e?.fallback?t.push(vc.of(n)):i?t.push(Ir.computeN([M.darkTheme],s=>s.facet(M.darkTheme)==(i=="dark")?[n]:[])):t.push(Ir.of(n)),t}class Um{constructor(e){this.markCache=Object.create(null),this.tree=de(e.state),this.decorations=this.buildDeco(e,Vs(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=de(e.state),i=Vs(e.state),s=i!=Vs(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return L.none;let i=new ct;for(let{from:s,to:r}of e.visibleRanges)gm(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=L.mark({class:a})))},s,r);return i.finish()}}const Gm=At.high(Z.fromClass(Um,{decorations:n=>n.decorations})),_m=en.define([{tag:b.meta,color:"#404740"},{tag:b.link,textDecoration:"underline"},{tag:b.heading,textDecoration:"underline",fontWeight:"bold"},{tag:b.emphasis,fontStyle:"italic"},{tag:b.strong,fontWeight:"bold"},{tag:b.strikethrough,textDecoration:"line-through"},{tag:b.keyword,color:"#708"},{tag:[b.atom,b.bool,b.url,b.contentSeparator,b.labelName],color:"#219"},{tag:[b.literal,b.inserted],color:"#164"},{tag:[b.string,b.deleted],color:"#a11"},{tag:[b.regexp,b.escape,b.special(b.string)],color:"#e40"},{tag:b.definition(b.variableName),color:"#00f"},{tag:b.local(b.variableName),color:"#30a"},{tag:[b.typeName,b.namespace],color:"#085"},{tag:b.className,color:"#167"},{tag:[b.special(b.variableName),b.macroName],color:"#256"},{tag:b.definition(b.propertyName),color:"#00c"},{tag:b.comment,color:"#940"},{tag:b.invalid,color:"#f00"}]),Ym=M.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Sc=1e4,Cc="()[]{}",Ac=D.define({combine(n){return ot(n,{afterCursor:!0,brackets:Cc,maxScanDistance:Sc,renderMatch:Qm})}}),Jm=L.mark({class:"cm-matchingBracket"}),Xm=L.mark({class:"cm-nonmatchingBracket"});function Qm(n){let e=[],t=n.matched?Jm:Xm;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function Yl(n){let e=[],t=n.facet(Ac);for(let i of n.selection.ranges){if(!i.empty)continue;let s=it(n,i.head,-1,t)||i.head>0&&it(n,i.head-1,1,t)||t.afterCursor&&(it(n,i.head,1,t)||i.headn.decorations}),eg=[Zm,Ym];function tg(n={}){return[Ac.of(n),eg]}const ig=new F;function Nr(n,e,t){let i=n.prop(e<0?F.openedBy:F.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function Wr(n){let e=n.type.prop(ig);return e?e(n.node):n}function it(n,e,t,i={}){let s=i.maxScanDistance||Sc,r=i.brackets||Cc,o=de(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=Nr(a.type,t,r);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return ng(n,e,t,a,c,h,r)}}return sg(n,e,t,o,l.type,s,r)}function ng(n,e,t,i,s,r,o){let l=i.parent,a={from:s.from,to:s.to},h=0,c=l?.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let p=e+u*t;for(let m=t>0?0:d.length-1,g=t>0?d.length:-1;m!=g;m+=t){let y=o.indexOf(d[m]);if(!(y<0||i.resolveInner(p+m,1).type!=s))if(y%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:p+m,to:p+m+1},matched:y>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}function Jl(n,e,t,i=0,s=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let r=s;for(let o=i;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosi?o.toLowerCase():o,r=this.string.substr(this.pos,e.length);return s(r)==s(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function rg(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||og,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||yo,mergeTokens:n.mergeTokens!==!1}}function og(n){if(typeof n!="object")return n;let e={};for(let t in n){let i=n[t];e[t]=i instanceof Array?i.slice():i}return e}const Xl=new WeakMap;class Tc extends Ne{constructor(e){let t=ac(e.languageData),i=rg(e),s,r=new class extends rc{createParse(o,l,a){return new ag(s,o,l,a)}};super(t,r,[],e.name),this.topNode=fg(t,this),s=this,this.streamParser=i,this.stateAfter=new F({perNode:!0}),this.tokenTable=e.tokenTable?new Lc(i.tokenTable):cg}static define(e){return new Tc(e)}getIndent(e){let t,{overrideIndentation:i}=e.options;i&&(t=Xl.get(e.state),t!=null&&t1e4)return null;for(;r=i&&t+e.length<=s&&e.prop(n.stateAfter);if(r)return{state:n.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],h=l instanceof Y&&a=e.length)return e;!s&&t==0&&e.type==n.topNode&&(s=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],a;if(ot&&go(n,r.tree,0-r.offset,t,l),h;if(a&&a.pos<=i&&(h=Dc(n,r.tree,t+r.offset,a.pos+r.offset,!1)))return{state:a.state,tree:h}}return{state:n.streamParser.startState(s?Vt(s):4),tree:Y.empty}}class ag{constructor(e,t,i,s){this.lang=e,this.input=t,this.fragments=i,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let r=oi.get(),o=s[0].from,{state:l,tree:a}=lg(e,i,o,this.to,r?.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let h=0;hh.from<=r.viewport.from&&h.to>=r.viewport.from)&&(this.state=this.lang.streamParser.startState(Vt(r.state)),r.skipUntilInView(this.parsedPos,r.viewport.from),this.parsedPos=r.viewport.from),this.moveRangeIndex()}advance(){let e=oi.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(t,this.chunkStart+512);for(e&&(i=Math.min(i,e.viewport.to));this.parsedPos=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` +`&&(t="");else{let i=t.indexOf(` +`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?s>r:s>=r)break;let o=this.ranges[++this.rangeIndex].from;t+=o-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(t,s,1),t+=s;let l=this.chunk.length;s=this.skipGapsTo(i,s,-1),i+=s,r+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&r==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=i:this.chunk.push(e,t,i,r),s}parseLine(e){let{line:t,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new Mc(t,e?e.state.tabSize:4,e?Vt(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=Oc(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const yo=Object.create(null),Vi=[Se.none],hg=new ho(Vi),Ql=[],Zl=Object.create(null),Bc=Object.create(null);for(let[n,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"]])Bc[n]=Ec(yo,e);class Lc{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Bc)}resolve(e){return e?this.table[e]||(this.table[e]=Ec(this.extra,e)):0}}const cg=new Lc(yo);function zs(n,e){Ql.indexOf(n)>-1||(Ql.push(n),console.warn(e))}function Ec(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||b[h];c?typeof c=="function"?a.length?a=a.map(c):zs(h,`Modifier ${h} used at start of tag`):a.length?zs(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:zs(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(l=>l.id),r=Zl[s];if(r)return r.id;let o=Zl[s]=Se.define({id:Vi.length,name:i,props:[pm({[i]:t})]});return Vi.push(o),o.id}function fg(n,e){let t=Se.define({id:Vi.length,name:"Document",props:[Rt.add(()=>n),fc.add(()=>i=>e.getIndent(i))],top:!0});return Vi.push(t),t}_.RTL,_.LTR;const ug=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=xo(n.state,t.from);return i.line?dg(n):i.block?mg(n):!1};function bo(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const dg=bo(bg,0),pg=bo(Pc,0),mg=bo((n,e)=>Pc(n,e,yg(e)),0);function xo(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const yi=50;function gg(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-yi,i),o=n.sliceDoc(s,s+yi),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,h=r.length-l;if(r.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+a,margin:a&&1}};let c,f;s-i<=2*yi?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+yi),f=n.sliceDoc(s-yi,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function yg(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to);s.from>i.from&&s.from==t.to&&(s=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return e}function Pc(n,e,t=e.selection.ranges){let i=t.map(r=>xo(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>gg(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>f.from)){s=f.from;let u=/^\s*/.exec(f.text)[0].length,d=u==f.length,p=f.text.slice(u,u+h.length)==h?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+h,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,r.push({from:h,to:c})}return{changes:r}}return null}const Fr=rt.define(),xg=rt.define(),wg=D.define(),Rc=D.define({combine(n){return ot(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,s)=>e(i,s)||t(i,s)})}}),Ic=pe.define({create(){return nt.empty},update(n,e){let t=e.state.facet(Rc),i=e.annotation(Fr);if(i){let a=De.fromTransaction(e,i.selection),h=i.side,c=h==0?n.undone:n.done;return a?c=Qn(c,c.length,t.minDepth,a):c=Fc(c,e.startState.selection),new nt(h==0?i.rest:c,h==0?c:i.rest)}let s=e.annotation(xg);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(ie.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=De.fromTransaction(e),o=e.annotation(ie.time),l=e.annotation(ie.userEvent);return r?n=n.addChanges(r,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new nt(n.done.map(De.fromJSON),n.undone.map(De.fromJSON))}});function vg(n={}){return[Ic,Rc.of(n),M.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Nc:e.inputType=="historyRedo"?Hr:null;return i?(e.preventDefault(),i(t)):!1}})]}function ms(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(Ic,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const Nc=ms(0,!1),Hr=ms(1,!1),kg=ms(0,!0),Sg=ms(1,!0);class De{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new De(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new De(e.changes&&se.fromJSON(e.changes),[],e.mapped&&st.fromJSON(e.mapped),e.startSelection&&x.fromJSON(e.startSelection),e.selectionsAfter.map(x.fromJSON))}static fromTransaction(e,t){let i=We;for(let s of e.startState.facet(wg)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new De(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,We)}static selection(e){return new De(void 0,We,void 0,void 0,e)}}function Qn(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function Cg(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let a=0;a=h&&o<=c&&(i=!0)}}),i}function Ag(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function Wc(n,e){return n.length?e.length?n.concat(e):n:e}const We=[],Mg=200;function Fc(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-Mg));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Qn(n,n.length-1,1e9,t.setSelAfter(i)))}else return[De.selection([e])]}function Tg(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function qs(n,e){if(!n.length)return n;let t=n.length,i=We;for(;t;){let s=Dg(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[De.selection(i)]:We}function Dg(n,e,t){let i=Wc(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):We,t);if(!n.changes)return De.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new De(s,R.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const Og=/^(input\.type|delete)($|\.)/;class nt{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new nt(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||Og.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):gs(t,e))}function xe(n){return n.textDirectionAt(n.state.selection.main.head)==_.LTR}const Vc=n=>Hc(n,!xe(n)),zc=n=>Hc(n,xe(n));function qc(n,e){return je(n,t=>t.empty?n.moveByGroup(t,e):gs(t,e))}const Lg=n=>qc(n,!xe(n)),Eg=n=>qc(n,xe(n));function Pg(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function ys(n,e,t){let i=de(n).resolveInner(e.head),s=t?F.closedBy:F.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;Pg(n,h,s)?i=h:a=t?h.to:h.from}let r=i.type.prop(s),o,l;return r&&(o=t?it(n,i.from,1):it(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,x.cursor(l,t?-1:1)}const Rg=n=>je(n,e=>ys(n.state,e,!xe(n))),Ig=n=>je(n,e=>ys(n.state,e,xe(n)));function Kc(n,e){return je(n,t=>{if(!t.empty)return gs(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const $c=n=>Kc(n,!1),jc=n=>Kc(n,!0);function Uc(n){let e=n.scrollDOM.clientHeighto.empty?n.moveVertically(o,e,t.height):gs(o,e));if(s.eq(i.selection))return!1;let r;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomGc(n,!1),Vr=n=>Gc(n,!0);function Mt(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=x.cursor(i.from+r))}return s}const Ng=n=>je(n,e=>Mt(n,e,!0)),Wg=n=>je(n,e=>Mt(n,e,!1)),Fg=n=>je(n,e=>Mt(n,e,!xe(n))),Hg=n=>je(n,e=>Mt(n,e,xe(n))),Vg=n=>je(n,e=>x.cursor(n.lineBlockAt(e.head).from,1)),zg=n=>je(n,e=>x.cursor(n.lineBlockAt(e.head).to,-1));function qg(n,e,t){let i=!1,s=ci(n.selection,r=>{let o=it(n,r.head,-1)||it(n,r.head,1)||r.head>0&&it(n,r.head-1,1)||r.headqg(n,e);function He(n,e){let t=ci(n.state.selection,i=>{let s=e(i);return x.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch($e(n.state,t)),!0)}function _c(n,e){return He(n,t=>n.moveByChar(t,e))}const Yc=n=>_c(n,!xe(n)),Jc=n=>_c(n,xe(n));function Xc(n,e){return He(n,t=>n.moveByGroup(t,e))}const $g=n=>Xc(n,!xe(n)),jg=n=>Xc(n,xe(n)),Ug=n=>He(n,e=>ys(n.state,e,!xe(n))),Gg=n=>He(n,e=>ys(n.state,e,xe(n)));function Qc(n,e){return He(n,t=>n.moveVertically(t,e))}const Zc=n=>Qc(n,!1),ef=n=>Qc(n,!0);function tf(n,e){return He(n,t=>n.moveVertically(t,e,Uc(n).height))}const ta=n=>tf(n,!1),ia=n=>tf(n,!0),_g=n=>He(n,e=>Mt(n,e,!0)),Yg=n=>He(n,e=>Mt(n,e,!1)),Jg=n=>He(n,e=>Mt(n,e,!xe(n))),Xg=n=>He(n,e=>Mt(n,e,xe(n))),Qg=n=>He(n,e=>x.cursor(n.lineBlockAt(e.head).from)),Zg=n=>He(n,e=>x.cursor(n.lineBlockAt(e.head).to)),na=({state:n,dispatch:e})=>(e($e(n,{anchor:0})),!0),sa=({state:n,dispatch:e})=>(e($e(n,{anchor:n.doc.length})),!0),ra=({state:n,dispatch:e})=>(e($e(n,{anchor:n.selection.main.anchor,head:0})),!0),oa=({state:n,dispatch:e})=>(e($e(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),e0=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),t0=({state:n,dispatch:e})=>{let t=bs(n).map(({from:i,to:s})=>x.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:x.create(t),userEvent:"select"})),!0},i0=({state:n,dispatch:e})=>{let t=ci(n.selection,i=>{let s=de(n),r=s.resolveStack(i.from,1);if(i.empty){let o=s.resolveStack(i.from,-1);o.node.from>=r.node.from&&o.node.to<=r.node.to&&(r=o)}for(let o=r;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return x.range(l.to,l.from)}return i});return t.eq(n.selection)?!1:(e($e(n,t)),!0)};function nf(n,e){let{state:t}=n,i=t.selection,s=t.selection.ranges.slice();for(let r of t.selection.ranges){let o=t.doc.lineAt(r.head);if(e?o.to0)for(let l=r;;){let a=n.moveVertically(l,e);if(a.heado.to){s.some(h=>h.head==a.head)||s.push(a);break}else{if(a.head==l.head)break;l=a}}}return s.length==i.ranges.length?!1:(n.dispatch($e(t,x.create(s,s.length-1))),!0)}const n0=n=>nf(n,!1),s0=n=>nf(n,!0),r0=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=x.create([t.main]):t.main.empty||(i=x.create([x.cursor(t.main.head)])),i?(e($e(n,i)),!0):!1};function tn(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);ao&&(t="delete.forward",a=Cn(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Cn(n,o,!1),l=Cn(n,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:x.cursor(o,os(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const sf=(n,e,t)=>tn(n,i=>{let s=i.from,{state:r}=n,o=r.doc.lineAt(s),l,a;if(t&&!e&&s>o.from&&ssf(n,!1,!0),rf=n=>sf(n,!0,!1),of=(n,e)=>tn(n,t=>{let i=t.head,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t.head&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let a=le(r.text,i-r.from,e)+r.from,h=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||i!=t.head)&&(l=c),i=a}return i}),lf=n=>of(n,!1),o0=n=>of(n,!0),l0=n=>tn(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headtn(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),h0=n=>tn(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:q.of(["",""])},range:x.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},f0=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:le(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:le(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:x.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function bs(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function af(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of bs(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let a of r.ranges)s.push(x.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let a of r.ranges)s.push(x.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:x.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const u0=({state:n,dispatch:e})=>af(n,e,!1),d0=({state:n,dispatch:e})=>af(n,e,!0);function hf(n,e,t){if(n.readOnly)return!1;let i=[];for(let r of bs(n))t?i.push({from:r.from,insert:n.doc.slice(r.from,r.to)+n.lineBreak}):i.push({from:r.to,insert:n.lineBreak+n.doc.slice(r.from,r.to)});let s=n.changes(i);return e(n.update({changes:s,selection:n.selection.map(s,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const p0=({state:n,dispatch:e})=>hf(n,e,!1),m0=({state:n,dispatch:e})=>hf(n,e,!0),g0=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(bs(e).map(({from:s,to:r})=>(s>0?s--:r{let r;if(n.lineWrapping){let o=n.lineBlockAt(s.head),l=n.coordsAtPos(s.head,s.assoc||1);l&&(r=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(s,!0,r)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function y0(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=de(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(F.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from&&!/\S/.test(n.sliceDoc(i.to,s.from))?{from:i.to,to:s.from}:null}const la=cf(!1),b0=cf(!0);function cf(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),a=!n&&r==o&&y0(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new ds(e,{simulateBreak:r,simulateDoubleBreak:!!a}),c=po(h,r);for(c==null&&(c=hi(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:x.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const x0=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new ds(n,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=wo(n,(r,o,l)=>{let a=po(i,r.from);if(a==null)return;/\S/.test(r.text)||(a=0);let h=/^\s*/.exec(r.text)[0],c=Hi(n,a);(h!=c||l.fromn.readOnly?!1:(e(n.update(wo(n,(t,i)=>{i.push({from:t.from,insert:n.facet(Qi)})}),{userEvent:"input.indent"})),!0),uf=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(wo(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=hi(s,n.tabSize),o=0,l=Hi(n,Math.max(0,r-Vt(n)));for(;o(n.setTabFocusMode(),!0),v0=[{key:"Ctrl-b",run:Vc,shift:Yc,preventDefault:!0},{key:"Ctrl-f",run:zc,shift:Jc},{key:"Ctrl-p",run:$c,shift:Zc},{key:"Ctrl-n",run:jc,shift:ef},{key:"Ctrl-a",run:Vg,shift:Qg},{key:"Ctrl-e",run:zg,shift:Zg},{key:"Ctrl-d",run:rf},{key:"Ctrl-h",run:zr},{key:"Ctrl-k",run:l0},{key:"Ctrl-Alt-h",run:lf},{key:"Ctrl-o",run:c0},{key:"Ctrl-t",run:f0},{key:"Ctrl-v",run:Vr}],k0=[{key:"ArrowLeft",run:Vc,shift:Yc,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Lg,shift:$g,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Fg,shift:Jg,preventDefault:!0},{key:"ArrowRight",run:zc,shift:Jc,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Eg,shift:jg,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Hg,shift:Xg,preventDefault:!0},{key:"ArrowUp",run:$c,shift:Zc,preventDefault:!0},{mac:"Cmd-ArrowUp",run:na,shift:ra},{mac:"Ctrl-ArrowUp",run:ea,shift:ta},{key:"ArrowDown",run:jc,shift:ef,preventDefault:!0},{mac:"Cmd-ArrowDown",run:sa,shift:oa},{mac:"Ctrl-ArrowDown",run:Vr,shift:ia},{key:"PageUp",run:ea,shift:ta},{key:"PageDown",run:Vr,shift:ia},{key:"Home",run:Wg,shift:Yg,preventDefault:!0},{key:"Mod-Home",run:na,shift:ra},{key:"End",run:Ng,shift:_g,preventDefault:!0},{key:"Mod-End",run:sa,shift:oa},{key:"Enter",run:la,shift:la},{key:"Mod-a",run:e0},{key:"Backspace",run:zr,shift:zr,preventDefault:!0},{key:"Delete",run:rf,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:lf,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:o0,preventDefault:!0},{mac:"Mod-Backspace",run:a0,preventDefault:!0},{mac:"Mod-Delete",run:h0,preventDefault:!0}].concat(v0.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),S0=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Rg,shift:Ug},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Ig,shift:Gg},{key:"Alt-ArrowUp",run:u0},{key:"Shift-Alt-ArrowUp",run:p0},{key:"Alt-ArrowDown",run:d0},{key:"Shift-Alt-ArrowDown",run:m0},{key:"Mod-Alt-ArrowUp",run:n0},{key:"Mod-Alt-ArrowDown",run:s0},{key:"Escape",run:r0},{key:"Mod-Enter",run:b0},{key:"Alt-l",mac:"Ctrl-l",run:t0},{key:"Mod-i",run:i0,preventDefault:!0},{key:"Mod-[",run:uf},{key:"Mod-]",run:ff},{key:"Mod-Alt-\\",run:x0},{key:"Shift-Mod-k",run:g0},{key:"Shift-Mod-\\",run:Kg},{key:"Mod-/",run:ug},{key:"Alt-A",run:pg},{key:"Ctrl-m",mac:"Shift-Alt-m",run:w0}].concat(k0),C0={key:"Tab",run:ff,shift:uf},aa=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class ai{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?l=>r(aa(l)):aa,this.query=this.normalize(t)}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 Ce(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 t=$r(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Qe(e);let s=this.normalize(t);if(s.length)for(let r=0,o=i;;r++){let l=s.charCodeAt(r),a=this.match(l,o,this.bufferPos+this.bufferStart);if(r==s.length-1){if(a)return this.value=a,this;break}o==i&&rthis.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 t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=Zn(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let l=new ei(t,e.sliceString(t,i));return Ks.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this.matchPos=Zn(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ei.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(pf.prototype[Symbol.iterator]=mf.prototype[Symbol.iterator]=function(){return this});function A0(n){try{return new RegExp(n,vo),!0}catch{return!1}}function Zn(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}const M0=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:i,result:s}=Ip(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return s.then(r=>{let o=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!o){n.dispatch({effects:i});return}let l=e.doc.lineAt(e.selection.main.head),[,a,h,c,f]=o,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let g=d/100;a&&(g=g*(a=="-"?-1:1)+l.number/e.doc.lines),d=Math.round(e.doc.lines*g)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=e.doc.line(Math.max(1,Math.min(e.doc.lines,d))),m=x.cursor(p.from+Math.max(0,Math.min(u,p.length)));n.dispatch({effects:[i,M.scrollIntoView(m.from,{y:"center"})],selection:m})}),!0},T0={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},D0=D.define({combine(n){return ot(n,T0,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function O0(n){return[R0,P0]}const B0=L.mark({class:"cm-selectionMatch"}),L0=L.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ha(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=X.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=X.Word)}function E0(n,e,t,i){return n(e.sliceDoc(t,t+1))==X.Word&&n(e.sliceDoc(i-1,i))==X.Word}const P0=Z.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(D0),{state:t}=n,i=t.selection;if(i.ranges.length>1)return L.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return L.none;let a=t.wordAt(s.head);if(!a)return L.none;o=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a200)return L.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(ha(o,t,s.from,s.to)&&E0(o,t,s.from,s.to)))return L.none}else if(r=t.sliceDoc(s.from,s.to),!r)return L.none}let l=[];for(let a of n.visibleRanges){let h=new ai(t.doc,r,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||ha(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(L0.range(c,f)):(c>=s.to||f<=s.from)&&l.push(B0.range(c,f)),l.length>e.maxMatches))return L.none}}return L.set(l)}},{decorations:n=>n.decorations}),R0=M.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),I0=({state:n,dispatch:e})=>{let{selection:t}=n,i=x.create(t.ranges.map(s=>n.wordAt(s.head)||x.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function N0(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new ai(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new ai(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const W0=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return I0({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=N0(n,i);return s?(e(n.update({selection:n.selection.addRange(x.range(s.from,s.to),!1),effects:M.scrollIntoView(s.to)})),!0):!1},fi=D.define({combine(n){return ot(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new X0(e),scrollToMatch:e=>M.scrollIntoView(e)})}});class gf{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||A0(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` +`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new K0(this):new V0(this)}getCursor(e,t=0,i){let s=e.doc?e:z.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?jt(this,s,t,i):$t(this,s,t,i)}}class yf{constructor(e){this.spec=e}}function F0(n,e,t){return(i,s,r,o)=>{if(t&&!t(i,s,r,o))return!1;let l=i>=o&&s<=o+r.length?r.slice(i-o,s-o):e.doc.sliceString(i,s);return n(l,e,i,s)}}function $t(n,e,t,i){let s;return n.wholeWord&&(s=H0(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(s=F0(n.test,e,s)),new ai(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:r=>r.toLowerCase(),s)}function H0(n,e){return(t,i,s,r)=>((r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=$t(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function z0(n,e,t){return(i,s,r)=>(!t||t(i,s,r))&&n(r[0],e,i,s)}function jt(n,e,t,i){let s;return n.wholeWord&&(s=q0(e.charCategorizer(e.selection.main.head))),n.test&&(s=z0(n.test,e,s)),new pf(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:s},t,i)}function es(n,e){return n.slice(le(n,e,!1),e)}function ts(n,e){return n.slice(e,le(n,e))}function q0(n){return(e,t,i)=>!i[0].length||(n(es(i.input,i.index))!=X.Word||n(ts(i.input,i.index))!=X.Word)&&(n(ts(i.input,i.index+i[0].length))!=X.Word||n(es(i.input,i.index+i[0].length))!=X.Word)}class K0 extends yf{nextMatch(e,t,i){let s=jt(this.spec,e,i,e.doc.length).next();return s.done&&(s=jt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=jt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let r=+i.slice(0,s);if(r>0&&r=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=jt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const zi=R.define(),ko=R.define(),yt=pe.define({create(n){return new $s(qr(n).create(),null)},update(n,e){for(let t of e.effects)t.is(zi)?n=new $s(t.value.create(),n.panel):t.is(ko)&&(n=new $s(n.query,t.value?So:null));return n},provide:n=>Ni.from(n,e=>e.panel)});class $s{constructor(e,t){this.query=e,this.panel=t}}const $0=L.mark({class:"cm-searchMatch"}),j0=L.mark({class:"cm-searchMatch cm-searchMatch-selected"}),U0=Z.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(yt))}update(n){let e=n.state.field(yt);(e!=n.startState.field(yt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return L.none;let{view:t}=this,i=new ct;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-500;)a=r[++s].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?j0:$0)})}return i.finish()}},{decorations:n=>n.decorations});function nn(n){return e=>{let t=e.state.field(yt,!1);return t&&t.query.spec.valid?n(e,t):wf(e)}}const is=nn((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=x.single(i.from,i.to),r=n.state.facet(fi);return n.dispatch({selection:s,effects:[Co(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),xf(n),!0}),ns=nn((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=x.single(s.from,s.to),o=n.state.facet(fi);return n.dispatch({selection:r,effects:[Co(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),xf(n),!0}),G0=nn((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:x.create(t.map(i=>x.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),_0=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new ai(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(x.range(l.value.from,l.value.to))}return e(n.update({selection:x.create(r,o),userEvent:"select.search.matches"})),!0},ca=nn((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=r,l=[],a,h,c=[];o.from==i&&o.to==s&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),c.push(M.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+".")));let f=n.state.changes(l);return o&&(a=x.single(o.from,o.to).map(f),c.push(Co(n,o)),c.push(t.facet(fi).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),Y0=nn((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:M.announce.of(i),userEvent:"input.replace.all"}),!0});function So(n){return n.state.facet(fi).createPanel(n)}function qr(n,e){var t,i,s,r,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(fi);return new gf({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function bf(n){let e=ao(n,So);return e&&e.dom.querySelector("[main-field]")}function xf(n){let e=bf(n);e&&e==n.root.activeElement&&e.select()}const wf=n=>{let e=n.state.field(yt,!1);if(e&&e.panel){let t=bf(n);if(t&&t!=n.root.activeElement){let i=qr(n.state,e.query.spec);i.valid&&n.dispatch({effects:zi.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[ko.of(!0),e?zi.of(qr(n.state,e.query.spec)):R.appendConfig.of(Z0)]});return!0},vf=n=>{let e=n.state.field(yt,!1);if(!e||!e.panel)return!1;let t=ao(n,So);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:ko.of(!1)}),!0},J0=[{key:"Mod-f",run:wf,scope:"editor search-panel"},{key:"F3",run:is,shift:ns,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:is,shift:ns,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:vf,scope:"editor search-panel"},{key:"Mod-Shift-l",run:_0},{key:"Mod-Alt-g",run:M0},{key:"Mod-d",run:W0,preventDefault:!0}];class X0{constructor(e){this.view=e;let t=this.query=e.state.field(yt).query.spec;this.commit=this.commit.bind(this),this.searchField=j("input",{value:t.search,placeholder:Be(e,"Find"),"aria-label":Be(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=j("input",{value:t.replace,placeholder:Be(e,"Replace"),"aria-label":Be(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=j("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=j("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=j("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return j("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=j("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>is(e),[Be(e,"next")]),i("prev",()=>ns(e),[Be(e,"previous")]),i("select",()=>G0(e),[Be(e,"all")]),j("label",null,[this.caseField,Be(e,"match case")]),j("label",null,[this.reField,Be(e,"regexp")]),j("label",null,[this.wordField,Be(e,"by word")]),...e.state.readOnly?[]:[j("br"),this.replaceField,i("replace",()=>ca(e),[Be(e,"replace")]),i("replaceAll",()=>Y0(e),[Be(e,"replace all")])],j("button",{name:"close",onclick:()=>vf(e),"aria-label":Be(e,"close"),type:"button"},["×"])])}commit(){let e=new gf({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:zi.of(e)}))}keydown(e){jd(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ns:is)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),ca(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(zi)&&!i.value.eq(this.query)&&this.setQuery(i.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(fi).top}}function Be(n,e){return n.state.phrase(e)}const An=30,Mn=/[\s\.,:;?!]/;function Co(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-An),o=Math.min(s,t+An),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;al.length-An;a--)if(!Mn.test(l[a-1])&&Mn.test(l[a])){l=l.slice(0,a);break}}return M.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const Q0=M.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"}}),Z0=[yt,At.low(U0),Q0];class kf{constructor(e,t,i,s){this.state=e,this.pos=t,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=de(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(Sf(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function fa(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function ey(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:ey(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function zb(n,e){return t=>{for(let i=de(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class ua{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}}function Nt(n){return n.selection.main.from}function Sf(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const Ao=rt.define();function iy(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return{...n.changeByRange(l=>{if(l!=s&&t!=i&&n.sliceDoc(l.from+r,l.from+o)!=n.sliceDoc(t,i))return{range:l};let a=n.toText(e);return{changes:{from:l.from+r,to:i==s.from?l.to:l.from+o,insert:a},range:x.cursor(l.from+r+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const da=new WeakMap;function ny(n){if(!Array.isArray(n))return n;let e=da.get(n);return e||da.set(n,e=ty(n)),e}const ss=R.define(),qi=R.define();class sy{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&k<=57||k>=97&&k<=122?2:k>=65&&k<=90?1:0:(S=$r(k))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!w||C==1&&g||T==0&&C!=0)&&(t[f]==k||i[f]==k&&(u=!0)?o[f++]=w:o.length&&(y=!1)),T=C,w+=Qe(k)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let l=o+(this.astral?Qe(Ce(i,o)):1);r&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return this.ret(e-i.length,s)}}class ry{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:oy,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>pa(e(i),t(i)),optionClass:(e,t)=>i=>pa(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function pa(n,e){return n?e?n+" "+e:n:e}function oy(n,e,t,i,s,r){let o=n.textDirection==_.RTL,l=o,a=!1,h="top",c,f,u=e.left-s.left,d=s.right-e.right,p=i.right-i.left,m=i.bottom-i.top;if(l&&u=m||w>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let g=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/g}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}const Mo=R.define();function ly(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function js(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class ay{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,l=e.state.facet(oe);this.optionContent=ly(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=js(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:Mo.of(c)}),a.preventDefault())}}),this.dom.addEventListener("focusout",a=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(oe).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:qi.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=s){let{options:r,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=r)&&(this.range=js(r.length,o,e.state.facet(oe).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=js(t.options.length,t.selected,this.view.state.facet(oe).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:r}=s;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(s);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>Te(this.view.state,l,"completion info")):(this.addInfoPane(o,s),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&cy(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottom{o.target==s&&o.preventDefault()});let r=null;for(let o=i.from;oi.from||i.from==0))if(r=u,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.tonew ay(t,n,e)}function cy(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),s=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/s)}function ma(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function fy(n,e){let t=[],i=null,s=null,r=c=>{t.push(c);let{section:f}=c.completion;if(f){i||(i=[]);let u=typeof f=="string"?f:f.name;i.some(d=>d.name==u)||i.push(typeof f=="string"?{name:u}:f)}},o=e.facet(oe);for(let c of n)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)r(new ua(u,c.source,f?f(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),d,p=o.filterStrict?new ry(u):new sy(u);for(let m of c.result.options)if(d=p.match(m.label)){let g=m.displayLabel?f?f(m,d.matched):[]:d.matched,y=d.score+(m.boost||0);if(r(new ua(m,c.source,g,y)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:w}=m.section;s||(s=Object.create(null)),s[w]=Math.max(y,s[w]||-1e9)}}}}if(i){let c=Object.create(null),f=0,u=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.nameu.score-f.score||h(f.completion,u.completion))){let f=c.completion;!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost?l.push(c):ma(c.completion)>ma(a)&&(l[l.length-1]=c),a=c.completion}return l}class _t{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new _t(this.options,ga(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r,o){if(s&&!o&&e.some(h=>h.isPending))return s.setDisabled();let l=fy(e,t);if(!l.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let a=t.facet(oe).selectOnOpen?0:-1;if(s&&s.selected!=a&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;cc.hasResult()?Math.min(h,c.from):h,1e8),create:yy,above:r.aboveCursor},s?s.timestamp:Date.now(),a,!1)}map(e){return new _t(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new _t(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class rs{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new rs(my,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(oe),r=(i.override||t.languageDataAt("autocomplete",Nt(t)).map(ny)).map(a=>(this.active.find(c=>c.source==a)||new Fe(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((a,h)=>a==this.active[h])&&(r=this.active);let o=this.open,l=e.effects.some(a=>a.is(To));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!uy(r,this.active)||l?o=_t.build(r,t,this.id,o,i,l):o&&o.disabled&&!r.some(a=>a.isPending)&&(o=null),!o&&r.every(a=>!a.isPending)&&r.some(a=>a.hasResult())&&(r=r.map(a=>a.hasResult()?new Fe(a.source,0):a));for(let a of e.effects)a.is(Mo)&&(o=o&&o.setSelected(a.value,this.id));return r==this.active&&o==this.open?this:new rs(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?dy:py}}function uy(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const my=[];function Cf(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(Ao);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class Fe{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=Cf(e,t),s=this;(i&8||i&16&&this.touches(e))&&(s=new Fe(s.source,0)),i&4&&s.state==0&&(s=new Fe(this.source,1)),s=s.updateFor(e,i);for(let r of e.effects)if(r.is(ss))s=new Fe(s.source,1,r.value);else if(r.is(qi))s=new Fe(s.source,0);else if(r.is(To))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Nt(e.state))}}class ti extends Fe{constructor(e,t,i,s,r,o){super(e,3,t),this.limit=i,this.result=s,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Nt(e.state);if(l>o||!s||t&2&&(Nt(e.startState)==this.from||lt.map(e))}}),Ae=pe.define({create(){return rs.start()},update(n,e){return n.update(e)},provide:n=>[lo.from(n,e=>e.tooltip),M.contentAttributes.from(n,e=>e.attrs)]});function Do(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(Ae).active.find(s=>s.source==e.source);return i instanceof ti?(typeof t=="string"?n.dispatch({...iy(n.state,t,i.from,i.to),annotations:Ao.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const yy=hy(Ae,Do);function Tn(n,e="option"){return t=>{let i=t.state.field(Ae,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:Mo.of(l)}),!0}}const by=n=>{let e=n.state.field(Ae,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(Ae,!1)?(n.dispatch({effects:ss.of(!0)}),!0):!1,xy=n=>{let e=n.state.field(Ae,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:qi.of(null)}),!0)};class wy{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const vy=50,ky=1e3,Sy=Z.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(Ae).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(Ae),t=n.state.facet(oe);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Ae)==e)return;let i=n.transactions.some(r=>{let o=Cf(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;rvy&&Date.now()-o.time>ky){for(let l of o.context.abortListeners)try{l()}catch(a){Te(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(r=>r.effects.some(o=>o.is(ss)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.isPending&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of n.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(Ae);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(oe).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Nt(e),i=new kf(e,t,n.explicit,this.view),s=new wy(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:qi.of(null)}),Te(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(oe).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(oe),i=this.view.state.field(Ae);for(let s=0;sl.source==r.active.source);if(o&&o.isPending)if(r.done==null){let l=new Fe(r.active.source,0);for(let a of r.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:To.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Ae,!1);if(e&&e.tooltip&&this.view.state.facet(oe).closeOnBlur){let t=e.open&&Jh(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:qi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:ss.of(!1)}),20),this.composing=0}}}),Cy=typeof navigator=="object"&&/Win/.test(navigator.platform),Ay=At.highest(M.domEventHandlers({keydown(n,e){let t=e.state.field(Ae,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(Cy&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],s=t.active.find(o=>o.source==i.source),r=i.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(n.key)>-1&&Do(e,i),!1}})),Af=M.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"}}});class My{constructor(e,t,i,s){this.field=e,this.line=t,this.from=i,this.to=s}}class Oo{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,fe.TrackDel),i=e.mapPos(this.to,1,fe.TrackDel);return t==null||i==null?null:new Oo(this.field,t,i)}}class Bo{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],s=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let a of this.lines){if(i.length){let h=o,c=/^\t*/.exec(a)[0].length;for(let f=0;fnew Oo(a.field,s[a.line]+a.from,s[a.line]+a.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let l=r[1]?+r[1]:null,a=r[2]||r[3]||"",h=-1,c=a.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=h&&u.field++}for(let f of s)if(f.line==i.length&&f.from>r.index){let u=r[2]?3+(r[1]||"").length:2;f.from-=u,f.to-=u}s.push(new My(h,i.length,r.index,r.index+c.length)),o=o.slice(0,r.index)+a+o.slice(r.index+r[0].length)}o=o.replace(/\\([{}])/g,(l,a,h)=>{for(let c of s)c.line==i.length&&c.from>h&&(c.from--,c.to--);return a}),i.push(o)}return new Bo(i,s)}}let Ty=L.widget({widget:new class extends Ke{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),Dy=L.mark({class:"cm-snippetField"});class ui{constructor(e,t){this.ranges=e,this.active=t,this.deco=L.set(e.map(i=>(i.from==i.to?Ty:Dy).range(i.from,i.to)),!0)}map(e){let t=[];for(let i of this.ranges){let s=i.map(e);if(!s)return null;t.push(s)}return new ui(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const sn=R.define({map(n,e){return n&&n.map(e)}}),Oy=R.define(),Ki=pe.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(sn))return t.value;if(t.is(Oy)&&n)return new ui(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>M.decorations.from(n,e=>e?e.deco:L.none)});function Lo(n,e){return x.create(n.filter(t=>t.field==e).map(t=>x.range(t.from,t.to)))}function By(n){let e=Bo.parse(n);return(t,i,s,r)=>{let{text:o,ranges:l}=e.instantiate(t.state,s),{main:a}=t.state.selection,h={changes:{from:s,to:r==a.from?a.to:r,insert:q.of(o)},scrollIntoView:!0,annotations:i?[Ao.of(i),ie.userEvent.of("input.complete")]:void 0};if(l.length&&(h.selection=Lo(l,0)),l.some(c=>c.field>0)){let c=new ui(l,0),f=h.effects=[sn.of(c)];t.state.field(Ki,!1)===void 0&&f.push(R.appendConfig.of([Ki,Iy,Ny,Af]))}t.dispatch(t.state.update(h))}}function Mf(n){return({state:e,dispatch:t})=>{let i=e.field(Ki,!1);if(!i||n<0&&i.active==0)return!1;let s=i.active+n,r=n>0&&!i.ranges.some(o=>o.field==s+n);return t(e.update({selection:Lo(i.ranges,s),effects:sn.of(r?null:new ui(i.ranges,s)),scrollIntoView:!0})),!0}}const Ly=({state:n,dispatch:e})=>n.field(Ki,!1)?(e(n.update({effects:sn.of(null)})),!0):!1,Ey=Mf(1),Py=Mf(-1),Ry=[{key:"Tab",run:Ey,shift:Py},{key:"Escape",run:Ly}],ya=D.define({combine(n){return n.length?n[0]:Ry}}),Iy=At.highest(Ji.compute([ya],n=>n.facet(ya)));function qb(n,e){return{...e,apply:By(n)}}const Ny=M.domEventHandlers({mousedown(n,e){let t=e.state.field(Ki,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let s=t.ranges.find(r=>r.from<=i&&r.to>=i);return!s||s.field==t.active?!1:(e.dispatch({selection:Lo(t.ranges,s.field),effects:sn.of(t.ranges.some(r=>r.field>s.field)?new ui(t.ranges,s.field):null),scrollIntoView:!0}),!0)}}),$i={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},It=R.define({map(n,e){let t=e.mapPos(n,-1,fe.TrackAfter);return t??void 0}}),Eo=new class extends bt{};Eo.startSide=1;Eo.endSide=-1;const Tf=pe.define({create(){return H.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(It)&&(n=n.update({add:[Eo.range(t.value,t.value+1)]}));return n}});function Wy(){return[Hy,Tf]}const Gs="()[]{}<>«»»«[]{}";function Df(n){for(let e=0;e{if((Fy?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&Qe(Ce(i,0))==1||e!=s.from||t!=s.to)return!1;let r=qy(n.state,i);return r?(n.dispatch(r),!0):!1}),Vy=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=Of(n,n.selection.main.head).brackets||$i.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=Ky(n.doc,o.head);for(let a of i)if(a==l&&xs(n.doc,o.head)==Df(Ce(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:x.cursor(o.head-a.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},zy=[{key:"Backspace",run:Vy}];function qy(n,e){let t=Of(n,n.selection.main.head),i=t.brackets||$i.brackets;for(let s of i){let r=Df(Ce(s,0));if(e==s)return r==s?Uy(n,s,i.indexOf(s+s+s)>-1,t):$y(n,s,r,t.before||$i.before);if(e==r&&Bf(n,n.selection.main.from))return jy(n,s,r)}return null}function Bf(n,e){let t=!1;return n.field(Tf).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function xs(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Qe(Ce(t,0)))}function Ky(n,e){let t=n.sliceString(e-2,e);return Qe(Ce(t,0))==t.length?t:t.slice(1)}function $y(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:It.of(o.to+e.length),range:x.range(o.anchor+e.length,o.head+e.length)};let l=xs(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:It.of(o.head+e.length),range:x.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function jy(n,e,t){let i=null,s=n.changeByRange(r=>r.empty&&xs(n.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:x.cursor(r.head+t.length)}:i={range:r});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Uy(n,e,t,i){let s=i.stringPrefixes||$i.stringPrefixes,r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:It.of(l.to+e.length),range:x.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=xs(n.doc,a),c;if(h==e){if(ba(n,a))return{changes:{insert:e+e,from:a},effects:It.of(a+e.length),range:x.cursor(a+e.length)};if(Bf(n,a)){let u=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:x.cursor(a+u.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(c=xa(n,a-2*e.length,s))>-1&&ba(n,c))return{changes:{insert:e+e+e+e,from:a},effects:It.of(a+e.length),range:x.cursor(a+e.length)};if(n.charCategorizer(a)(h)!=X.Word&&xa(n,a,s)>-1&&!Gy(n,a,e,s))return{changes:{insert:e+e,from:a},effects:It.of(a+e.length),range:x.cursor(a+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function ba(n,e){let t=de(n).resolveInner(e+1);return t.parent&&t.from==e}function Gy(n,e,t,i){let s=de(n).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+a;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function xa(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=X.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=X.Word)return r}return-1}function _y(n={}){return[Ay,Ae,oe.of(n),Sy,Yy,Af]}const Lf=[{key:"Ctrl-Space",run:Us},{mac:"Alt-`",run:Us},{mac:"Alt-i",run:Us},{key:"Escape",run:xy},{key:"ArrowDown",run:Tn(!0)},{key:"ArrowUp",run:Tn(!1)},{key:"PageDown",run:Tn(!0,"page")},{key:"PageUp",run:Tn(!1,"page")},{key:"Enter",run:by}],Yy=At.highest(Ji.computeN([oe],n=>n.facet(oe).defaultKeymap?[Lf]:[]));class wa{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Lt{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=i.facet(ji).markerFilter;s&&(e=s(e,i));let r=e.slice().sort((d,p)=>d.from-p.from||d.to-p.to),o=new ct,l=[],a=0,h=i.doc.iter(),c=0,f=i.doc.length;for(let d=0;;){let p=d==r.length?null:r[d];if(!p&&!l.length)break;let m,g;if(l.length)m=a,g=l.reduce((v,T)=>Math.min(v,T.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;g=p.to,l.push(p),d++}for(;dv.from||v.to==m))l.push(v),d++,g=Math.min(v.to,g);else{g=Math.min(v.from,g);break}}g=Math.min(g,f);let y=!1;if(l.some(v=>v.from==m&&(v.to==g||g==f))&&(y=m==g,!y&&g-m<10)){let v=m-(c+h.value.length);v>0&&(h.next(v),c=m);for(let T=m;;){if(T>=g){y=!0;break}if(!h.lineBreak&&c+h.value.length>T)break;T=c+h.value.length,c+=h.value.length,h.next()}}let w=ab(l);if(y)o.add(m,m,L.widget({widget:new sb(w),diagnostics:l.slice()}));else{let v=l.reduce((T,k)=>k.markClass?T+" "+k.markClass:T,"");o.add(m,g,L.mark({class:"cm-lintRange cm-lintRange-"+w+v,diagnostics:l.slice(),inclusiveEnd:l.some(T=>T.to>g)}))}if(a=g,a==f)break;for(let v=0;v{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new wa(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new wa(i.from,r,i.diagnostic)}}),i}function Jy(n,e){let t=e.pos,i=e.end||t,s=n.state.facet(ji).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(Ef))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function Xy(n,e){return n.field(Ee,!1)?e:e.concat(R.appendConfig.of(hb))}const Ef=R.define(),Po=R.define(),Pf=R.define(),Ee=pe.define({create(){return new Lt(L.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=Ct(t,n.selected.diagnostic,r)||Ct(t,null,r)}!t.size&&s&&e.state.facet(ji).autoPanel&&(s=null),n=new Lt(t,s,i)}for(let t of e.effects)if(t.is(Ef)){let i=e.state.facet(ji).autoPanel?t.value.length?Ui.open:null:n.panel;n=Lt.init(t.value,i,e.state)}else t.is(Po)?n=new Lt(n.diagnostics,t.value?Ui.open:null,n.selected):t.is(Pf)&&(n=new Lt(n.diagnostics,n.panel,t.value));return n},provide:n=>[Ni.from(n,e=>e.panel),M.decorations.from(n,e=>e.diagnostics)]}),Qy=L.mark({class:"cm-lintRange cm-lintRange-active"});function Zy(n,e,t){let{diagnostics:i}=n.state.field(Ee),s,r=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(eIf(n,t,!1)))}const tb=n=>{let e=n.state.field(Ee,!1);(!e||!e.panel)&&n.dispatch({effects:Xy(n.state,[Po.of(!0)])});let t=ao(n,Ui.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},va=n=>{let e=n.state.field(Ee,!1);return!e||!e.panel?!1:(n.dispatch({effects:Po.of(!1)}),!0)},ib=n=>{let e=n.state.field(Ee,!1);if(!e)return!1;let t=n.state.selection.main,i=Ct(e.diagnostics,null,t.to+1);return!i&&(i=Ct(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},nb=[{key:"Mod-Shift-m",run:tb,preventDefault:!0},{key:"F8",run:ib}],ji=D.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...ot(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:ka,tooltipFilter:ka,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,s,r)=>e(i,s,r)||t(i,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function ka(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function Rf(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;ir.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function If(n,e,t){var i;let s=t?Rf(e.actions):[];return j("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},j("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=Ct(n.state.field(Ee).diagnostics,e);p&&r.apply(n,p.from,p.to)},{name:h}=r,c=s[o]?h.indexOf(s[o]):-1,f=c<0?h:[h.slice(0,c),j("u",h.slice(c,c+1)),h.slice(c+1)],u=r.markClass?" "+r.markClass:"";return j("button",{type:"button",class:"cm-diagnosticAction"+u,onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&j("div",{class:"cm-diagnosticSource"},e.source))}class sb extends Ke{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return j("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Sa{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=If(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Ui{constructor(e){this.view=e,this.items=[];let t=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)va(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=Rf(r.actions);for(let l=0;l{for(let r=0;rva(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ee).selected;if(!e)return-1;for(let t=0;t{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,u;for(let d=i;di&&(this.items.splice(i,f-i),s=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),i++}});i({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let h=a.height/this.list.offsetHeight;l.topa.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Ee),i=Ct(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:Pf.of(i)})}static open(e){return new Ui(e)}}function rb(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function Dn(n){return rb(``,'width="6" height="3"')}const ob=M.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:Dn("#d11")},".cm-lintRange-warning":{backgroundImage:Dn("orange")},".cm-lintRange-info":{backgroundImage:Dn("#999")},".cm-lintRange-hint":{backgroundImage:Dn("#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}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function lb(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function ab(n){let e="hint",t=1;for(let i of n){let s=lb(i.severity);s>t&&(t=s,e=i.severity)}return e}const hb=[Ee,M.decorations.compute([Ee],n=>{let{selected:e,panel:t}=n.field(Ee);return!e||!t||e.from==e.to?L.none:L.set([Qy.range(e.from,e.to)])}),Pp(Zy,{hideOn:Jy}),ob];var Ca=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,i=[];e.closeBracketsKeymap!==!1&&(i=i.concat(zy)),e.defaultKeymap!==!1&&(i=i.concat(S0)),e.searchKeymap!==!1&&(i=i.concat(J0)),e.historyKeymap!==!1&&(i=i.concat(Bg)),e.foldKeymap!==!1&&(i=i.concat(Vm)),e.completionKeymap!==!1&&(i=i.concat(Lf)),e.lintKeymap!==!1&&(i=i.concat(nb));var s=[];return e.lineNumbers!==!1&&s.push(Up()),e.highlightActiveLineGutter!==!1&&s.push(Yp()),e.highlightSpecialChars!==!1&&s.push(ap()),e.history!==!1&&s.push(vg()),e.foldGutter!==!1&&s.push($m()),e.drawSelection!==!1&&s.push(Xd()),e.dropCursor!==!1&&s.push(ip()),e.allowMultipleSelections!==!1&&s.push(z.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(Bm()),e.syntaxHighlighting!==!1&&s.push(kc(_m,{fallback:!0})),e.bracketMatching!==!1&&s.push(tg()),e.closeBrackets!==!1&&s.push(Wy()),e.autocompletion!==!1&&s.push(_y()),e.rectangularSelection!==!1&&s.push(kp()),t!==!1&&s.push(Ap()),e.highlightActiveLine!==!1&&s.push(pp()),e.highlightSelectionMatches!==!1&&s.push(O0()),e.tabSize&&typeof e.tabSize=="number"&&s.push(Qi.of(" ".repeat(e.tabSize))),s.concat([Ji.of(i.flat())]).filter(Boolean)};const cb="#e5c07b",Aa="#e06c75",fb="#56b6c2",ub="#ffffff",Nn="#abb2bf",Kr="#7d8799",db="#61afef",pb="#98c379",Ma="#d19a66",mb="#c678dd",gb="#21252b",Ta="#2c313a",Da="#282c34",_s="#353a42",yb="#3E4451",Oa="#528bff",bb=M.theme({"&":{color:Nn,backgroundColor:Da},".cm-content":{caretColor:Oa},".cm-cursor, .cm-dropCursor":{borderLeftColor:Oa},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:yb},".cm-panels":{backgroundColor:gb,color:Nn},".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:Da,color:Kr,border:"none"},".cm-activeLineGutter":{backgroundColor:Ta},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:_s},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:_s,borderBottomColor:_s},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Ta,color:Nn}}},{dark:!0}),xb=en.define([{tag:b.keyword,color:mb},{tag:[b.name,b.deleted,b.character,b.propertyName,b.macroName],color:Aa},{tag:[b.function(b.variableName),b.labelName],color:db},{tag:[b.color,b.constant(b.name),b.standard(b.name)],color:Ma},{tag:[b.definition(b.name),b.separator],color:Nn},{tag:[b.typeName,b.className,b.number,b.changed,b.annotation,b.modifier,b.self,b.namespace],color:cb},{tag:[b.operator,b.operatorKeyword,b.url,b.escape,b.regexp,b.link,b.special(b.string)],color:fb},{tag:[b.meta,b.comment],color:Kr},{tag:b.strong,fontWeight:"bold"},{tag:b.emphasis,fontStyle:"italic"},{tag:b.strikethrough,textDecoration:"line-through"},{tag:b.link,color:Kr,textDecoration:"underline"},{tag:b.heading,fontWeight:"bold",color:Aa},{tag:[b.atom,b.bool,b.special(b.variableName)],color:Ma},{tag:[b.processingInstruction,b.string,b.inserted],color:pb},{tag:b.invalid,color:ub}]),wb=[bb,kc(xb)];var vb=M.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),kb=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:i=!0,readOnly:s=!1,theme:r="light",placeholder:o="",basicSetup:l=!0}=e,a=[];switch(t&&a.unshift(Ji.of([C0])),l&&(typeof l=="boolean"?a.unshift(Ca()):a.unshift(Ca(l))),o&&a.unshift(bp(o)),r){case"light":a.push(vb);break;case"dark":a.push(wb);break;case"none":break;default:a.push(r);break}return i===!1&&a.push(M.editable.of(!1)),s&&a.push(z.readOnly.of(!0)),[...a]},Sb=n=>({line:n.state.doc.lineAt(n.state.selection.main.from),lineCount:n.state.doc.lines,lineBreak:n.state.lineBreak,length:n.state.doc.length,readOnly:n.state.readOnly,tabSize:n.state.tabSize,selection:n.state.selection,selectionAsSingle:n.state.selection.asSingle().main,ranges:n.state.selection.ranges,selectionCode:n.state.sliceDoc(n.state.selection.main.from,n.state.selection.main.to),selections:n.state.selection.ranges.map(e=>n.state.sliceDoc(e.from,e.to)),selectedText:n.state.selection.ranges.some(e=>!e.empty)});class Cb{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,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(t=>{try{t()}catch(i){console.error("TimeoutLatch callback error:",i)}})}}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 Ba{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 Ys=null,Ab=()=>typeof window>"u"?new Ba:(Ys||(Ys=new Ba),Ys),La=rt.define(),Mb=200,Tb=[];function Db(n){var{value:e,selection:t,onChange:i,onStatistics:s,onCreateEditor:r,onUpdate:o,extensions:l=Tb,autoFocus:a,theme:h="light",height:c=null,minHeight:f=null,maxHeight:u=null,width:d=null,minWidth:p=null,maxWidth:m=null,placeholder:g="",editable:y=!0,readOnly:w=!1,indentWithTab:v=!0,basicSetup:T=!0,root:k,initialState:S}=n,[C,P]=we.useState(),[B,V]=we.useState(),[I,E]=we.useState(),N=we.useState(()=>({current:null}))[0],W=we.useState(()=>({current:null}))[0],K=M.theme({"&":{height:c,minHeight:f,maxHeight:u,width:d,minWidth:p,maxWidth:m},"& .cm-scroller":{height:"100% !important"}}),ne=M.updateListener.of($=>{if($.docChanged&&typeof i=="function"&&!$.transactions.some(ge=>ge.annotation(La))){N.current?N.current.reset():(N.current=new Cb(()=>{if(W.current){var ge=W.current;W.current=null,ge()}N.current=null},Mb),Ab().add(N.current));var te=$.state.doc,ae=te.toString();i(ae,$)}s&&s(Sb($))}),re=kb({theme:h,editable:y,readOnly:w,placeholder:g,indentWithTab:v,basicSetup:T}),me=[ne,K,...re];return o&&typeof o=="function"&&me.push(M.updateListener.of(o)),me=me.concat(l),we.useLayoutEffect(()=>{if(C&&!I){var $={doc:e,selection:t,extensions:me},te=S?z.fromJSON(S.json,$,S.fields):z.create($);if(E(te),!B){var ae=new M({state:te,parent:C,root:k});V(ae),r&&r(ae,te)}}return()=>{B&&(E(void 0),V(void 0))}},[C,I]),we.useEffect(()=>{n.container&&P(n.container)},[n.container]),we.useEffect(()=>()=>{B&&(B.destroy(),V(void 0)),N.current&&(N.current.cancel(),N.current=null)},[B]),we.useEffect(()=>{a&&B&&B.focus()},[a,B]),we.useEffect(()=>{B&&B.dispatch({effects:R.reconfigure.of(me)})},[h,l,c,f,u,d,p,m,g,y,w,v,T,i,o]),we.useEffect(()=>{if(e!==void 0){var $=B?B.state.doc.toString():"";if(B&&e!==$){var te=N.current&&!N.current.isDone,ae=()=>{B&&e!==B.state.doc.toString()&&B.dispatch({changes:{from:0,to:B.state.doc.toString().length,insert:e||""},annotations:[La.of(!0)]})};te?W.current=ae:ae()}}},[e,B]),{state:I,setState:E,view:B,setView:V,container:C,setContainer:P}}var Ob=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Bb=we.forwardRef((n,e)=>{var{className:t,value:i="",selection:s,extensions:r=[],onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:h,autoFocus:c,theme:f="light",height:u,minHeight:d,maxHeight:p,width:m,minWidth:g,maxWidth:y,basicSetup:w,placeholder:v,indentWithTab:T,editable:k,readOnly:S,root:C,initialState:P}=n,B=Nf(n,Ob),V=we.useRef(null),{state:I,view:E,container:N,setContainer:W}=Db({root:C,value:i,autoFocus:c,theme:f,height:u,minHeight:d,maxHeight:p,width:m,minWidth:g,maxWidth:y,basicSetup:w,placeholder:v,indentWithTab:T,editable:k,readOnly:S,selection:s,onChange:o,onStatistics:l,onCreateEditor:a,onUpdate:h,extensions:r,initialState:P});we.useImperativeHandle(e,()=>({editor:V.current,state:I,view:E}),[V,N,I,E]);var K=we.useCallback(re=>{V.current=re,W(re)},[W]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var ne=typeof f=="string"?"cm-theme-"+f:"cm-theme";return Wf.jsx("div",Ff({ref:K,className:""+ne+(t?" "+t:"")},B))});Bb.displayName="CodeMirror";export{Fb as $,Vb as A,zb as B,ty as C,L as D,x as E,de as F,F as G,en as H,ho as I,Y as J,At as K,Nb as L,Lm as M,Se as N,hi as O,rc as P,Ne as Q,Bb as R,pe as S,Pe as T,Qi as U,ac as V,kf as W,z as X,Rt as Y,cc as Z,oi as _,Yp as a,Pb as a0,G as a1,ig as a2,xm as a3,qb as a4,Jp as a5,O0 as b,ap as c,tg as d,Wy as e,vg as f,Xd as g,pp as h,Bm as i,_m as j,Ji as k,Up as l,S0 as m,Bg as n,M as o,R as p,Tc as q,pm as r,kc as s,b as t,Rb as u,Rr as v,fc as w,Hb as x,Wb as y,Em as z}; diff --git a/apps/studio/dist/static/index2-C9Na6VdA.js b/apps/studio/dist/static/index2-C9Na6VdA.js new file mode 100644 index 00000000..bdf2df8c --- /dev/null +++ b/apps/studio/dist/static/index2-C9Na6VdA.js @@ -0,0 +1 @@ +import{c as k,r as C,b$ as U,c0 as g,j as u,c1 as w,D as G,J as T,c2 as A,bb as L,c3 as V,c4 as q,c5 as D,c6 as J,c7 as K}from"./sanity-BZuh2pfi.js";const N=G(T).withConfig({displayName:"Root",componentId:"sc-s75qv0-0"})`position:relative;`;function W(d){const e=k.c(3),{children:o}=d,{collapsed:s}=J();let t;return e[0]!==o||e[1]!==s?(t=u.jsx(N,{hidden:s,height:"fill",overflow:"auto",children:o}),e[0]=o,e[1]=s,e[2]=t):t=e[2],t}function _(d){const e=k.c(11),{actionHandlers:o,index:s,menuItems:t,menuItemGroups:a,title:n}=d,{features:r}=A();if(!t?.length&&!n)return null;let c;e[0]!==o||e[1]!==a||e[2]!==t?(c=u.jsx(K,{menuItems:t,menuItemGroups:a,actionHandlers:o}),e[0]=o,e[1]=a,e[2]=t,e[3]=c):c=e[3];let l;e[4]!==r.backButton||e[5]!==s?(l=r.backButton&&s>0&&u.jsx(L,{as:q,"data-as":"a",icon:V,mode:"bleed",tooltipProps:{content:"Back"}}),e[4]=r.backButton,e[5]=s,e[6]=l):l=e[6];let i;return e[7]!==c||e[8]!==l||e[9]!==n?(i=u.jsx(D,{actions:c,backButton:l,title:n}),e[7]=c,e[8]=l,e[9]=n,e[10]=i):i=e[10],i}function M(d){const e=k.c(37);let o,s,t,a;e[0]!==d?({index:o,pane:s,paneKey:t,...a}=d,e[0]=d,e[1]=o,e[2]=s,e[3]=t,e[4]=a):(o=e[1],s=e[2],t=e[3],a=e[4]);let n,r,c,l,i;if(e[5]!==s){const{child:y,component:R,menuItems:S,menuItemGroups:$,type:z,...v}=s;r=y,n=R,l=S,c=$,i=v,e[5]=s,e[6]=n,e[7]=r,e[8]=c,e[9]=l,e[10]=i}else n=e[6],r=e[7],c=e[8],l=e[9],i=e[10];const[E,H]=C.useState(null),{title:B}=U(s),I=B===void 0?"":B;let m,p;e[11]!==i||e[12]!==a?({key:p,...m}={...a,...i},e[11]=i,e[12]=a,e[13]=m,e[14]=p):(m=e[13],p=e[14]);const b=E?.actionHandlers;let x;e[15]!==o||e[16]!==c||e[17]!==l||e[18]!==b||e[19]!==I?(x=u.jsx(_,{actionHandlers:b,index:o,menuItems:l,menuItemGroups:c,title:I}),e[15]=o,e[16]=c,e[17]=l,e[18]=b,e[19]=I,e[20]=x):x=e[20];let f;e[21]!==n||e[22]!==r||e[23]!==m||e[24]!==p||e[25]!==t?(f=g.isValidElementType(n)&&u.jsx(n,{...m,ref:H,child:r,paneKey:t},p),e[21]=n,e[22]=r,e[23]=m,e[24]=p,e[25]=t,e[26]=f):f=e[26];let h;e[27]!==n?(h=C.isValidElement(n)&&n,e[27]=n,e[28]=h):h=e[28];let P;e[29]!==f||e[30]!==h?(P=u.jsxs(W,{children:[f,h]}),e[29]=f,e[30]=h,e[31]=P):P=e[31];let j;return e[32]!==t||e[33]!==a.isSelected||e[34]!==x||e[35]!==P?(j=u.jsxs(w,{id:t,minWidth:320,selected:a.isSelected,children:[x,P]}),e[32]=t,e[33]=a.isSelected,e[34]=x,e[35]=P,e[36]=j):j=e[36],j}export{M as default}; diff --git a/apps/studio/dist/static/index3-DpC12yUy.js b/apps/studio/dist/static/index3-DpC12yUy.js new file mode 100644 index 00000000..04c40588 --- /dev/null +++ b/apps/studio/dist/static/index3-DpC12yUy.js @@ -0,0 +1 @@ +import{c as b,b$ as P,j as c,c1 as $,D as T,J as D,T as S,c8 as G,c2 as H,c6 as W,bb as E,c3 as N,c4 as R,c5 as F,c9 as O,ca as z,cb as J,cc as K,cd as M,c7 as U}from"./sanity-BZuh2pfi.js";const X=T(D).withConfig({displayName:"DividerContainer",componentId:"sc-j4cdg4-0"})`display:flex;align-items:center;gap:1rem;margin:0.75rem 0 0.25rem 0;`,L=T.hr.withConfig({displayName:"Divider",componentId:"sc-j4cdg4-1"})`flex:1;background-color:var(--card-border-color);height:1px;margin:0;border:none;`,q=T(S).withConfig({displayName:"DividerTitle",componentId:"sc-j4cdg4-2"})`padding-bottom:0.75rem;padding-left:0.5rem;padding-right:0.5rem;`;function Q(f){const e=b.c(5),{item:d}=f,{title:t}=P(d);let s;e[0]!==t?(s=c.jsx(q,{weight:"semibold",muted:!0,size:1,children:t}),e[0]=t,e[1]=s):s=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=c.jsx(L,{}),e[2]=a):a=e[2];let i;return e[3]!==s?(i=c.jsxs(X,{children:[s,a]}),e[3]=s,e[4]=i):i=e[4],i}function V(f){const e=b.c(20),{childItemId:d,items:t,isActive:s,layout:a,showIcons:i,title:l}=f,{collapsed:y}=O();let h;e[0]!==t?(h=t?.filter(Y),e[0]=t,e[1]=h):h=e[1];const r=z(h);let o;e[2]!==t?(o=n=>t?.find((B,w)=>w===n)?.type==="divider",e[2]=t,e[3]=o):o=e[3];const u=o;let v;e[4]!==i?(v=n=>n.displayOptions?.showIcon??i??!1,e[4]=i,e[5]=v):v=e[5];const x=v;let m;e[6]!==d||e[7]!==r||e[8]!==s||e[9]!==a||e[10]!==x?(m=(n,B)=>{const{virtualIndex:w}=B;if(n.type==="divider")return c.jsx(D,{marginBottom:1,children:n.title?c.jsx(Q,{item:n}):c.jsx(L,{})},`divider-${w}`);const C=!s&&d===n.id,k=s&&d===n.id,A=n._id&&n.schemaType?{_id:n._id,_type:n.schemaType.name,title:n.title}:void 0;return c.jsx(M,{icon:x(n)?n.icon:!1,id:n.id,layout:a,marginBottom:1,pressed:C,schemaType:n.schemaType,selected:k,title:r(n).title,value:A},n.id)},e[6]=d,e[7]=r,e[8]=s,e[9]=a,e[10]=x,e[11]=m):m=e[11];const I=m,g=y?"hidden":"auto";let p;e[12]!==u||e[13]!==t||e[14]!==I||e[15]!==l?(p=t&&t.length>0&&c.jsx(J,{activeItemDataAttr:"data-hovered",ariaLabel:l,canReceiveFocus:!0,getItemDisabled:u,itemHeight:51,items:t,onlyShowSelectionWhenActive:!0,paddingBottom:1,paddingX:3,renderItem:I,wrapAround:!1}),e[12]=u,e[13]=t,e[14]=I,e[15]=l,e[16]=p):p=e[16];let j;return e[17]!==g||e[18]!==p?(j=c.jsx(K,{overflow:g,children:p}),e[17]=g,e[18]=p,e[19]=j):j=e[19],j}function Y(f){return f.type!=="divider"}const Z=f=>{const e=b.c(11),{index:d,menuItems:t,menuItemGroups:s,title:a}=f,{features:i}=H(),{collapsed:l,isLast:y}=W(),h=y&&!l?-1:0;let r;e[0]!==s||e[1]!==t?(r=c.jsx(U,{menuItems:t,menuItemGroups:s}),e[0]=s,e[1]=t,e[2]=r):r=e[2];let o;e[3]!==i.backButton||e[4]!==d?(o=i.backButton&&d>0&&c.jsx(E,{as:R,"data-as":"a",icon:N,mode:"bleed",tooltipProps:{content:"Back"}}),e[3]=i.backButton,e[4]=d,e[5]=o):o=e[5];let u;return e[6]!==r||e[7]!==o||e[8]!==h||e[9]!==a?(u=c.jsx(F,{actions:r,backButton:o,tabIndex:h,title:a}),e[6]=r,e[7]=o,e[8]=h,e[9]=a,e[10]=u):u=e[10],u};function ee(f){const e=b.c(21),{childItemId:d,index:t,isActive:s,isSelected:a,pane:i,paneKey:l}=f,{defaultLayout:y,displayOptions:h,items:r,menuItems:o,menuItemGroups:u}=i,v=h?.showIcons!==!1,{title:x}=P(i);let m;e[0]!==i.source?(m=G,e[0]=i.source,e[1]=m):m=e[1];let I;e[2]!==t||e[3]!==u||e[4]!==o||e[5]!==x?(I=c.jsx(Z,{index:t,menuItems:o,menuItemGroups:u,title:x}),e[2]=t,e[3]=u,e[4]=o,e[5]=x,e[6]=I):I=e[6];let g;e[7]!==d||e[8]!==y||e[9]!==s||e[10]!==r||e[11]!==l||e[12]!==v||e[13]!==x?(g=c.jsx(V,{childItemId:d,isActive:s,items:r,layout:y,showIcons:v,title:x},l),e[7]=d,e[8]=y,e[9]=s,e[10]=r,e[11]=l,e[12]=v,e[13]=x,e[14]=g):g=e[14];let p;return e[15]!==a||e[16]!==l||e[17]!==m||e[18]!==I||e[19]!==g?(p=c.jsxs($,{currentMaxWidth:350,"data-testid":"structure-tool-list-pane","data-ui":"ListPane",id:l,maxWidth:640,minWidth:320,selected:a,children:[m,I,g]}),e[15]=a,e[16]=l,e[17]=m,e[18]=I,e[19]=g,e[20]=p):p=e[20],p}export{ee as default}; diff --git a/apps/studio/dist/static/index4-C9j3K6hK.js b/apps/studio/dist/static/index4-C9j3K6hK.js new file mode 100644 index 00000000..73d6a763 --- /dev/null +++ b/apps/studio/dist/static/index4-C9j3K6hK.js @@ -0,0 +1,2 @@ +import{ce as Ke,cf as Je,c as L,s as Ue,r as v,j as p,bN as qe,cg as Ye,ch as xe,l as ye,ci as ge,cj as ue,S as me,T as K,b as Se,J as fe,ck as Re,D as ke,aU as ie,cl as he,c2 as le,cm as Qe,C as oe,a as De,H as Xe,bb as Ze,cn as et,O as tt,k as nt,by as ze,G as rt,co as at,cp as st,bL as ot,F as _e,cq as B,cr as je,cs as it,ct as lt,cu as Ce,e as Z,a7 as ct,cv as Me,cw as dt,cx as ut,n as pt,cy as mt,cz as ft,cA as ht,cB as xt,cC as yt,cD as Ie,o as ae,cE as ce,bC as gt,bO as It,cF as Pt,cG as bt,a6 as wt,W as vt,cH as $e,cI as St,cJ as _t,cK as jt}from"./sanity-BZuh2pfi.js";function $t(){return Ke(function(t,e){var r,n=!1;t.subscribe(Je(e,function(o){var a=r;r=o,n&&e.next([a,o]),n=!0}))})}class ee extends Error{constructor({message:e,context:r,helpId:n,cause:o}){super(e),this.name="PaneResolutionError",this.context=r,this.helpId=n,this.cause=o}}const Et=t=>!!t&&typeof t?.then=="function",Tt=t=>Ce(t)?typeof t.serialize=="function":!1,Rt=t=>(e,r,n)=>{try{return t(e,r,n)}catch(o){throw o instanceof ee?o:new ee({message:typeof o?.message=="string"?o.message:"",context:r,cause:o})}},kt=t=>(...e)=>t(...e).pipe(Pt(1),bt());function Ne(t){const e=Rt(kt(t((r,n,o)=>{if(!r)throw new ee({message:"Pane returned no child",context:n,helpId:"structure-item-returned-no-child"});return Et(r)||xt(r)?yt(r).pipe(Ie(a=>e(a,n,o))):Tt(r)?e(r.serialize(n),n,o):typeof r=="function"?e(r(n.id,n),n,o):ae(r)})));return e}const Ee=new WeakMap;function Le(t,e){const r=Ee.get(t)||new Map;if(r){const a=r.get(e);if(a)return a}const n=t[e];if(typeof n!="function")throw new Error(`Expected property \`${e}\` to be a function but got ${typeof n} instead.`);const o=n.bind(t);return r.set(e,o),Ee.set(t,r),o}async function Dt(t){const e=new Map,r=Ne(s=>(l,c,d)=>{const i=l&&`${ce(l)}-${c.path.join("__")}`,u=i&&e.get(i);if(u)return u;const m=s(l,c,d);return i&&e.set(i,m),m}),n=[[{id:`__edit__${t.params.id}`,params:{...dt(t.params,["id"]),type:t.params.type},payload:t.payload}]];async function o({currentId:s,flatIndex:l,intent:c,params:d,parent:i,path:u,payload:m,unresolvedPane:x,levelIndex:h,structureContext:I}){if(!x)return[];const{id:g,type:w,...P}=d,f=await Me(r(x,{id:s,splitIndex:0,parent:i,path:u,index:l,params:{},payload:void 0,structureContext:I},l));return f.type==="document"&&f.id===g?[{panes:[...u.slice(0,u.length-1).map(y=>[{id:y}]),[{id:g,params:P,payload:m}]],depthIndex:u.length,levelIndex:h}]:f.canHandleIntent?.(c,d,{pane:f,index:l})||f.type==="documentList"&&f.schemaTypeName===w&&f.options.filter==="_type == $type"?[{panes:[...u.map(y=>[{id:y}]),[{id:d.id,params:P,payload:m}]],depthIndex:u.length,levelIndex:h}]:f.type==="list"&&f.child&&f.items?(await Promise.all(f.items.map((y,S)=>y.type==="divider"?Promise.resolve([]):o({currentId:y._id||y.id,flatIndex:l+1,intent:c,params:d,parent:f,path:[...u,y.id],payload:m,unresolvedPane:typeof f.child=="function"?Le(f,"child"):f.child,levelIndex:S,structureContext:I})))).flat():[]}const a=(await o({currentId:"root",flatIndex:0,levelIndex:0,intent:t.intent,params:t.params,parent:null,path:[],payload:t.payload,unresolvedPane:t.rootPaneNode,structureContext:t.structureContext})).sort((s,l)=>s.depthIndex===l.depthIndex?s.levelIndex-l.levelIndex:s.depthIndex-l.depthIndex)[0];return a?a.panes:n}function zt(t){return t!==B&&t.type==="document"}const Ct=(t,e)=>{const r=t.replace(/^__edit__/,""),{params:n,payload:o,structureContext:{resolveDocumentNode:a}}=e,{type:s,template:l}=n;if(!s)throw new Error(`Document type for document with ID ${r} was not provided in the router params.`);let c=a({schemaType:s,documentId:r}).id("editor");return l&&(c=c.initialValueTemplate(l,o)),c.serialize()};function Mt(t){return`contextHash(${JSON.stringify({id:t.id,parentId:parent&&ce(parent),path:t.path,index:t.index,splitIndex:t.splitIndex,serializeOptionsIndex:t.serializeOptions?.index,serializeOptionsPath:t.serializeOptions?.path})})`}const Te=t=>{const e={type:t.type,id:t.routerPaneSibling.id,params:t.routerPaneSibling.params||{},payload:t.routerPaneSibling.payload||null,flatIndex:t.flatIndex,groupIndex:t.groupIndex,siblingIndex:t.siblingIndex,path:t.path,paneNode:t.type==="resolvedMeta"?ce(t.paneNode):null};return`metaHash(${JSON.stringify(e)})`};function se({unresolvedPane:t,flattenedRouterPanes:e,parent:r,path:n,resolvePane:o,structureContext:a}){const[s,...l]=e,c=l[0],d={id:s.routerPaneSibling.id,splitIndex:s.siblingIndex,parent:r,path:[...n,s.routerPaneSibling.id],index:s.flatIndex,params:s.routerPaneSibling.params||{},payload:s.routerPaneSibling.payload,structureContext:a};try{return o(t,d,s.flatIndex).pipe(Ie(i=>{const u={type:"resolvedMeta",...s,paneNode:i,path:d.path},m=l.map((h,I)=>({type:"loading",path:[...d.path,...l.slice(I).map((g,w)=>`[${h.flatIndex+w}]`)],paneNode:null,...h}));if(!l.length)return ae([u]);let x;return c?.routerPaneSibling.id.startsWith("__edit__")?x=se({unresolvedPane:Ct,flattenedRouterPanes:l,parent:r,path:d.path,resolvePane:o,structureContext:a}):s.groupIndex===c?.groupIndex?x=se({unresolvedPane:t,flattenedRouterPanes:l,parent:r,path:n,resolvePane:o,structureContext:a}):x=se({unresolvedPane:typeof i.child=="function"?Le(i,"child"):i.child,flattenedRouterPanes:l,parent:i,path:d.path,resolvePane:o,structureContext:a}),jt(ae([u,...m]),x.pipe(Z(h=>[u,...h])))}))}catch(i){if(i instanceof ee&&(i.context&&console.warn(`Pane resolution error at index ${i.context.index}${i.context.splitIndex>0?` for split pane index ${i.context.splitIndex}`:""}: ${i.message}${i.helpId?` - see ${Re(i.helpId)}`:""}`,i),i.helpId==="structure-item-returned-no-child"))return ae([]);throw i}}function Nt({routerPanesStream:t,rootPaneNode:e,initialCacheState:r={cacheKeysByFlatIndex:[],flattenedRouterPanes:[],resolvedPaneCache:new Map,resolvePane:()=>St},structureContext:n}){return t.pipe(Z(o=>[[{id:"root"}],...o]),Z(o=>o.flatMap((a,s)=>a.map((l,c)=>({routerPaneSibling:l,groupIndex:s,siblingIndex:c}))).map((a,s)=>({...a,flatIndex:s}))),wt([]),$t(),Z(([o,a])=>{for(let s=0;s{const{cacheKeysByFlatIndex:s,resolvedPaneCache:l}=o,{flattenedRouterPanes:c,diffIndex:d}=a,i=s.slice(0,d+1),u=s.slice(d+1),m=new Set(i.flatMap(h=>Array.from(h))),x=u.flatMap(h=>Array.from(h)).filter(h=>!m.has(h));for(const h of x)l.delete(h);return{flattenedRouterPanes:c,cacheKeysByFlatIndex:s,resolvedPaneCache:l,resolvePane:Ne(h=>(I,g,w)=>{const P=I&&`${ce(I)}-${Mt(g)}`,f=P&&l.get(P);if(f)return f;const y=h(I,g,w);if(!P)return y;const S=s[w]||new Set;return S.add(P),s[w]=S,l.set(P,y),y})}},r),Ie(({flattenedRouterPanes:o,resolvePane:a})=>se({unresolvedPane:e,flattenedRouterPanes:o,parent:null,path:[],resolvePane:a,structureContext:n}))).pipe($e((o,a)=>a.map((s,l)=>{const c=o[l];return!c||s.type!=="loading"?s:c.routerPaneSibling.id===s.routerPaneSibling.id?c:s}),[]),_t((o,a)=>{if(o.length!==a.length)return!1;for(let s=0;s{e.next(o)},s=[o,e],t[2]=o,t[3]=e,t[4]=a,t[5]=s):(a=t[4],s=t[5]),v.useEffect(a,s),n}function Ot(t){return t?.panes||[]}function Wt(){return new ut(1)}function Bt(){const t=L.c(19),[e,r]=v.useState(),[n,o]=v.useState(null);if(e)throw e;const{structureContext:a,rootPaneNode:s}=le(),{navigate:l}=ie();let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c={paneDataItems:[],resolvedPanes:[],routerPanes:[]},t[0]=c):c=t[0];const[d,i]=v.useState(c),u=Lt();let m,x;t[1]!==s||t[2]!==u||t[3]!==a?(m=()=>{const f=Nt({rootPaneNode:s,routerPanesStream:u,structureContext:a}).pipe(Z(Vt)).subscribe({next:y=>i(y),error:y=>r(y)});return()=>f.unsubscribe()},x=[s,u,a],t[1]=s,t[2]=u,t[3]=a,t[4]=m,t[5]=x):(m=t[4],x=t[5]),v.useEffect(m,x);let h,I;t[6]!==d||t[7]!==l?(h=function(){const{paneDataItems:f,routerPanes:y}=d,S=f[f.length-1]?.pane;if(!S||!zt(S)||!S.defaultPanes)return;const _=y[f.length-1];if(!_||_.length!==1)return;const $=_[0].params;if($?.expanded)return;const R=S.defaultPanes.map((j,T)=>({id:_[0].id,params:{...$,view:j,...T===0?{expanded:"true"}:{}},payload:_[0].payload}));l({panes:[...y.slice(1,-1),R]},{replace:!0})},I=[d,l],t[6]=d,t[7]=l,t[8]=h,t[9]=I):(h=t[8],I=t[9]),v.useEffect(h,I);let g;if(t[10]!==d.paneDataItems||t[11]!==n){let f;t[13]!==n?(f=y=>({...y,maximized:n?y.key===n.key:!1}),t[13]=n,t[14]=f):f=t[14],g=d.paneDataItems.map(f),t[10]=d.paneDataItems,t[11]=n,t[12]=g}else g=t[12];const w=g;let P;return t[15]!==d||t[16]!==n||t[17]!==w?(P={...d,paneDataItems:w,maximizedPane:n,setMaximizedPane:o},t[15]=d,t[16]=n,t[17]=w,t[18]=P):P=t[18],P}function Vt(t){const e=t.reduce(Ft,[]),r=e.length,n=t.map(o=>{const{groupIndex:a,flatIndex:s,siblingIndex:l,routerPaneSibling:c,path:d}=o,i=c.id,u=e[a+1];return{active:a===r-2,childItemId:u?.[0].id??null,index:s,itemId:c.id,groupIndex:a,key:`${o.type==="loading"?"unknown":o.paneNode.id}-${i}-${l}`,pane:o.type==="loading"?B:o.paneNode,params:c.params||{},path:d.join(";"),payload:c.payload,selected:s===t.length-1,siblingIndex:l,maximized:!1}});return{paneDataItems:n,routerPanes:e,resolvedPanes:n.map(At)}}function At(t){return t.pane}function Ft(t,e){const r=t[e.groupIndex]||[];return r[e.siblingIndex]=e.routerPaneSibling,t[e.groupIndex]=r,t}async function Ht(t,e,r){if(e&&r)return{id:e,type:r};if(!e&&r)return{id:ct(),type:r};if(e&&!r){const n=await Me(t.resolveTypeForDocument(e));return{id:e,type:n}}throw new ee({message:"Neither document `id` or `type` was provided when trying to resolve intent."})}const Gt={},Kt=v.memo(function(){const t=L.c(7),{navigate:e}=ie(),r=he(Jt),{rootPaneNode:n,structureContext:o}=le(),a=Qe(),[s,l]=v.useState(null);if(s)throw s;let c,d;return t[0]!==a||t[1]!==r||t[2]!==e||t[3]!==n||t[4]!==o?(c=()=>{if(r){const{intent:i,params:u,payload:m}=r;let x=!1;return(async function(){const{id:h,type:I}=await Ht(a,typeof u.id=="string"?u.id:void 0,typeof u.type=="string"?u.type:void 0);if(x)return;const g=await Dt({intent:i,params:{...u,id:h,type:I},payload:m,rootPaneNode:n,structureContext:o});x||e({panes:g},{replace:!0})})().catch(l),()=>{x=!0}}},d=[a,r,e,n,o],t[0]=a,t[1]=r,t[2]=e,t[3]=n,t[4]=o,t[5]=c,t[6]=d):(c=t[5],d=t[6]),v.useEffect(c,d),null});function Jt(t){const e=typeof t.intent=="string"?t.intent:void 0;return e?{intent:e,params:Ce(t.params)?t.params:Gt,payload:t.payload}:void 0}const Ut=ke.span.withConfig({displayName:"PathSegment",componentId:"sc-jnonai-0"})`&:not(:last-child)::after{content:' ➝ ';opacity:0.5;}`;function qt(t){return t.replace(/\(\.\.\.\)\./g,`(...) + .`).replace(/__WEBPACK_IMPORTED_MODULE_\d+_+/g,"").replace(/___default\./g,".").replace(new RegExp(` \\(https?:\\/\\/${window.location.host}`,"g")," (")}function Yt(t){const e=L.c(74),{error:r}=t;if(!(r instanceof ee))throw r;const{cause:n}=r,{t:o}=ye(ge),a=n?.stack||r.stack;let s;e[0]!==n||e[1]!==r.message||e[2]!==a?(s=a&&!(n instanceof ue)&&!r.message.includes("Module build failed:"),e[0]=n,e[1]=r.message,e[2]=a,e[3]=s):s=e[3];const l=s;let c,d,i,u,m,x,h,I,g,w,P,f,y,S,_,$,R,j;if(e[4]!==n||e[5]!==r.helpId||e[6]!==o){const G=n instanceof ue?n.path:[];m=n instanceof ue&&n.helpId||r.helpId,u=Xt,i=oe,x="fill",h="auto",I=4,g="border",w="critical",d=De;let W;e[25]!==o?(W=o("structure-error.header.text"),e[25]=o,e[26]=W):W=e[26],e[27]!==W?(j=p.jsx(Xe,{as:"h2",children:W}),e[27]=W,e[28]=j):j=e[28],c=oe,P=4,f=4,y=2,S="auto",_=1,$="inherit",R=G.length>0&&p.jsxs(me,{space:2,children:[p.jsx(K,{size:1,weight:"medium",children:o("structure-error.structure-path.label")}),p.jsx(Se,{children:G.slice(1).map(Qt)})]}),e[4]=n,e[5]=r.helpId,e[6]=o,e[7]=c,e[8]=d,e[9]=i,e[10]=u,e[11]=m,e[12]=x,e[13]=h,e[14]=I,e[15]=g,e[16]=w,e[17]=P,e[18]=f,e[19]=y,e[20]=S,e[21]=_,e[22]=$,e[23]=R,e[24]=j}else c=e[7],d=e[8],i=e[9],u=e[10],m=e[11],x=e[12],h=e[13],I=e[14],g=e[15],w=e[16],P=e[17],f=e[18],y=e[19],S=e[20],_=e[21],$=e[22],R=e[23],j=e[24];let T;e[29]!==o?(T=o("structure-error.error.label"),e[29]=o,e[30]=T):T=e[30];let D;e[31]!==T?(D=p.jsx(K,{size:1,weight:"medium",children:T}),e[31]=T,e[32]=D):D=e[32];let z;e[33]!==r.message||e[34]!==l||e[35]!==a?(z=l?qt(a):r.message,e[33]=r.message,e[34]=l,e[35]=a,e[36]=z):z=e[36];let H;e[37]!==z?(H=p.jsx(Se,{children:z}),e[37]=z,e[38]=H):H=e[38];let C;e[39]!==D||e[40]!==H?(C=p.jsxs(me,{marginTop:4,space:2,children:[D,H]}),e[39]=D,e[40]=H,e[41]=C):C=e[41];let k;e[42]!==m||e[43]!==o?(k=m&&p.jsx(fe,{marginTop:4,children:p.jsx(K,{children:p.jsx("a",{href:Re(m),rel:"noopener noreferrer",target:"_blank",children:o("structure-error.docs-link.text")})})}),e[42]=m,e[43]=o,e[44]=k):k=e[44];let V;e[45]!==o?(V=o("structure-error.reload-button.text"),e[45]=o,e[46]=V):V=e[46];let M;e[47]!==u||e[48]!==V?(M=p.jsx(fe,{marginTop:4,children:p.jsx(Ze,{text:V,icon:et,tone:"primary",onClick:u})}),e[47]=u,e[48]=V,e[49]=M):M=e[49];let O;e[50]!==c||e[51]!==C||e[52]!==P||e[53]!==k||e[54]!==M||e[55]!==f||e[56]!==y||e[57]!==S||e[58]!==_||e[59]!==$||e[60]!==R?(O=p.jsxs(c,{marginTop:P,padding:f,radius:y,overflow:S,shadow:_,tone:$,children:[R,C,k,M]}),e[50]=c,e[51]=C,e[52]=P,e[53]=k,e[54]=M,e[55]=f,e[56]=y,e[57]=S,e[58]=_,e[59]=$,e[60]=R,e[61]=O):O=e[61];let N;e[62]!==d||e[63]!==O||e[64]!==j?(N=p.jsxs(d,{children:[j,O]}),e[62]=d,e[63]=O,e[64]=j,e[65]=N):N=e[65];let A;return e[66]!==i||e[67]!==x||e[68]!==h||e[69]!==I||e[70]!==g||e[71]!==w||e[72]!==N?(A=p.jsx(i,{height:x,overflow:h,padding:I,sizing:g,tone:w,children:N}),e[66]=i,e[67]=x,e[68]=h,e[69]=I,e[70]=g,e[71]=w,e[72]=N,e[73]=A):A=e[73],A}function Qt(t,e){return p.jsx(Ut,{children:t},`${t}-${e}`)}function Xt(){window.location.reload()}function Zt(){const t=L.c(17),{t:e}=ye(ge);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx(fe,{children:p.jsx(K,{size:1,children:p.jsx(gt,{})})}),t[0]=r):r=t[0];let n;t[1]!==e?(n=e("no-document-types-screen.title"),t[1]=e,t[2]=n):n=t[2];let o;t[3]!==n?(o=p.jsx(K,{as:"h1",size:1,weight:"medium",children:n}),t[3]=n,t[4]=o):o=t[4];let a;t[5]!==e?(a=e("no-document-types-screen.subtitle"),t[5]=e,t[6]=a):a=t[6];let s;t[7]!==a?(s=p.jsx(K,{as:"p",muted:!0,size:1,children:a}),t[7]=a,t[8]=s):s=t[8];let l;t[9]!==e?(l=e("no-document-types-screen.link-text"),t[9]=e,t[10]=l):l=t[10];let c;t[11]!==l?(c=p.jsx(K,{as:"p",muted:!0,size:1,children:p.jsx("a",{href:"https://www.sanity.io/docs/create-a-schema-and-configure-sanity-studio",target:"_blank",rel:"noreferrer",children:l})}),t[11]=l,t[12]=c):c=t[12];let d;return t[13]!==o||t[14]!==s||t[15]!==c?(d=p.jsx(oe,{height:"fill",children:p.jsx(_e,{align:"center",height:"fill",justify:"center",padding:4,sizing:"border",children:p.jsx(De,{width:0,children:p.jsx(oe,{padding:4,radius:2,shadow:1,tone:"caution",children:p.jsxs(_e,{children:[r,p.jsxs(me,{flex:1,marginLeft:3,space:3,children:[o,s,c]})]})})})})}),t[13]=o,t[14]=s,t[15]=c,t[16]=d):d=t[16],d}const en=t=>{const e=L.c(7),{documentId:r,documentType:n}=t,{selectedReleaseId:o}=pt(),a=mt(r,n,"default",o),s=ze(),{t:l}=ye(ge),c=!a?.published&&!a?.draft,d=a?.version||a?.draft||a?.published,i=s.get(n),{value:u,isLoading:m}=ft({enabled:!!d,schemaType:i,value:d}),{lastRevisionDocument:x}=ht(r,n),h=x&&!d?"":c?l("browser-document-title.new-document",{schemaType:i?.title||i?.name}):u?.title||l("browser-document-title.untitled-document"),I=a.ready&&!m,g=Oe(h);let w;e[0]!==g||e[1]!==I?(w=()=>{I&&(document.title=g)},e[0]=g,e[1]=I,e[2]=w):w=e[2];let P;return e[3]!==h||e[4]!==g||e[5]!==I?(P=[h,I,g],e[3]=h,e[4]=g,e[5]=I,e[6]=P):P=e[6],v.useEffect(w,P),null},pe=t=>{const e=L.c(5),{title:r}=t,n=Oe(r);let o;e[0]!==n?(o=()=>{document.title=n},e[0]=n,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==r?(a=[n,r],e[2]=n,e[3]=r,e[4]=a):a=e[4],v.useEffect(o,a),null},tn=t=>{const e=L.c(8),{resolvedPanes:r}=t;if(!r?.length)return null;const n=r[r.length-1];if(an(n)){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx(pe,{}),e[0]=s):s=e[0],s}if(rn(n)){if(n?.title){let l;return e[1]!==n.title?(l=p.jsx(pe,{title:n.title}),e[1]=n.title,e[2]=l):l=e[2],l}let s;return e[3]!==n.options.id||e[4]!==n.options.type?(s=p.jsx(en,{documentId:n.options.id,documentType:n.options.type}),e[3]=n.options.id,e[4]=n.options.type,e[5]=s):s=e[5],s}const o=n?.title;let a;return e[6]!==o?(a=p.jsx(pe,{title:o}),e[6]=o,e[7]=a):a=e[7],a};function Oe(t){const e=L.c(3),r=le().structureContext.title;let n;return e[0]!==t||e[1]!==r?(n=[t,r].filter(nn),e[0]=t,e[1]=r,e[2]=n):n=e[2],n.join(" | ")}function nn(t){return t}function rn(t){return t!==B&&t.type==="document"}function an(t){return t===B}const sn=ke(It).withConfig({displayName:"StyledPaneLayout",componentId:"sc-1hgaa0f-0"})`min-height:100%;min-width:320px;`,on=tt("mod+s"),ln=v.memo(function(t){const e=L.c(58),{onPaneChange:r}=t,{push:n}=nt(),o=ze(),{navigate:a}=ie(),s=he(),{layoutCollapsed:l,setLayoutCollapsed:c}=le(),d=Bt(),{paneDataItems:i,resolvedPanes:u,setMaximizedPane:m,maximizedPane:x}=d,h=he(cn),{sanity:I}=rt(),{media:g}=I,[w,P]=v.useState(null);let f;e[0]!==c?(f=()=>c(!0),e[0]=c,e[1]=f):f=e[1];const y=f;let S;e[2]!==c?(S=()=>c(!1),e[2]=c,e[3]=S):S=e[3];const _=S;let $;if(e[4]!==i){const b=i.findLastIndex(dn);$=b===-1?i:i.slice(b).filter(E=>E.groupIndex<=i[b].groupIndex),e[4]=i,e[5]=$}else $=e[5];const R=$;let j,T;e[6]!==r||e[7]!==u?(j=()=>{u.length&&r(u)},T=[r,u],e[6]=r,e[7]=u,e[8]=j,e[9]=T):(j=e[8],T=e[9]),v.useEffect(j,T);let D,z;e[10]!==n?(D=()=>{const b=E=>{on(E)&&(E.preventDefault(),n({closable:!0,id:"auto-save-message",status:"info",title:"Your work is automatically saved!",duration:4e3}))};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},z=[n],e[10]=n,e[11]=D,e[12]=z):(D=e[11],z=e[12]),v.useEffect(D,z);const H=o._original?.types.some(at);let C;e[13]!==a||e[14]!==s?.panes||e[15]!==m?(C=b=>{if(!b)return;const E=s?.panes||[];if(b.maximized){m(null),a({panes:E});return}if(b.pane!==B&&b.pane.type==="document"){const F=E.slice(0,b.groupIndex);m(b),a({panes:F})}},e[13]=a,e[14]=s?.panes,e[15]=m,e[16]=C):C=e[16];const k=C,V=v.useRef(-1);let M;e[17]!==a||e[18]!==i||e[19]!==s?.panes||e[20]!==m?(M=()=>{const b=i.find(un);if(!b)return;b.pane!==B&&b.pane.type==="document"&&m(b);const E=(s?.panes||[]).map(mn);a({panes:E},{replace:!0})},e[17]=a,e[18]=i,e[19]=s?.panes,e[20]=m,e[21]=M):M=e[21];const O=s?.panes;let N;e[22]!==a||e[23]!==i||e[24]!==m||e[25]!==O?(N=[a,i,O,m],e[22]=a,e[23]=i,e[24]=m,e[25]=O,e[26]=N):N=e[26],v.useEffect(M,N);let A,G;if(e[27]!==x||e[28]!==i||e[29]!==m?(A=()=>{const b=i.findIndex(fn),E=V.current;if(V.current=b,!!x){if(x.pane!==B&&x.pane.type!=="document"){m(null);return}if(b!==-1&&b!==E){const F=i[b];m(F);return}if(!i.some(F=>F.key===x.key)){const F=i.find(X=>X.groupIndex===x.groupIndex&&X.siblingIndex===x.siblingIndex&&X.pane!==B&&X.pane.type==="document");m(F||null)}}},G=[x,i,m],e[27]=x,e[28]=i,e[29]=m,e[30]=A,e[31]=G):(A=e[30],G=e[31]),v.useEffect(A,G),!H){let b;return e[32]===Symbol.for("react.memo_cache_sentinel")?(b=p.jsx(Zt,{}),e[32]=b):b=e[32],b}const W=w||null,de=l?void 0:"fill",We=g[1];let J;if(e[33]!==k||e[34]!==R){let b;e[36]!==k?(b=E=>{const{active:F,childItemId:X,groupIndex:Be,itemId:Ve,key:Pe,pane:re,index:be,params:Ae,path:we,payload:Fe,siblingIndex:He,selected:ve,maximized:Ge}=E;return p.jsx(v.Fragment,{children:re===B?p.jsx(je,{paneKey:Pe,path:we,selected:ve}):p.jsx(it,{active:F,groupIndex:Be,index:be,pane:re,childItemId:X,itemId:Ve,paneKey:Pe,params:Ae,payload:Fe,path:we,selected:ve,siblingIndex:He,maximized:Ge,onSetMaximizedPane:()=>k(E)})},`${re===B?"loading":re.type}-${be}`)},e[36]=k,e[37]=b):b=e[37],J=R.map(b),e[33]=k,e[34]=R,e[35]=J}else J=e[35];let U;e[38]!==h||e[39]!==i.length?(U=i.length<=1&&h&&p.jsx(je,{paneKey:"intent-resolver"}),e[38]=h,e[39]=i.length,e[40]=U):U=e[40];let q;e[41]!==y||e[42]!==_||e[43]!==g[1]||e[44]!==de||e[45]!==J||e[46]!==U?(q=p.jsxs(sn,{flex:1,height:de,minWidth:We,onCollapse:y,onExpand:_,children:[J,U]}),e[41]=y,e[42]=_,e[43]=g[1],e[44]=de,e[45]=J,e[46]=U,e[47]=q):q=e[47];let Y;e[48]!==u?(Y=p.jsx(tn,{resolvedPanes:u}),e[48]=u,e[49]=Y):Y=e[49];let te;e[50]===Symbol.for("react.memo_cache_sentinel")?(te=p.jsx("div",{"data-portal":"",ref:P}),e[50]=te):te=e[50];let Q;e[51]!==W||e[52]!==q||e[53]!==Y?(Q=p.jsxs(lt,{element:W,children:[q,Y,te]}),e[51]=W,e[52]=q,e[53]=Y,e[54]=Q):Q=e[54];let ne;return e[55]!==d||e[56]!==Q?(ne=p.jsx(st,{value:d,children:Q}),e[55]=d,e[56]=Q,e[57]=ne):ne=e[57],ne});function cn(t){return typeof t.intent=="string"}function dn(t){return t.maximized}function un(t){return t.params?.mode==="focus"}function pn(t){const{mode:e,...r}=t.params||{},n=Object.keys(r).length?r:void 0;return{...t,params:n}}function mn(t){return t.map(pn)}function fn(t){return t.selected}function gn(t){const e=L.c(14),{tool:r}=t,{options:n}=r,{unstable_sources:o}=Ue(),[a]=o;let s;e[0]!==n?(s=n||{},e[0]=n,e[1]=s):s=e[1];const{source:l,defaultDocumentNode:c,structure:d}=s;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=[],e[2]=i):i=e[2],v.useEffect(hn,i);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={error:null},e[3]=u):u=e[3];const[m,x]=v.useState(u),{error:h}=m;if(h){let y;return e[4]!==h?(y=p.jsx(Yt,{error:h}),e[4]=h,e[5]=y):y=e[5],y}const I=l||a.name;let g,w;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=p.jsx(ln,{onPaneChange:xe}),w=p.jsx(Kt,{}),e[6]=g,e[7]=w):(g=e[6],w=e[7]);let P;e[8]!==c||e[9]!==d?(P=p.jsxs(ot,{defaultDocumentNode:c,structure:d,children:[g,w]}),e[8]=c,e[9]=d,e[10]=P):P=e[10];let f;return e[11]!==I||e[12]!==P?(f=p.jsx(qe,{onCatch:x,children:p.jsx(Ye,{name:I,children:P})}),e[11]=I,e[12]=P,e[13]=f):f=e[13],f}function hn(){return xe([]),xn}function xn(){return xe([])}export{gn as default}; diff --git a/apps/studio/dist/static/manifest.webmanifest b/apps/studio/dist/static/manifest.webmanifest new file mode 100644 index 00000000..de051b0d --- /dev/null +++ b/apps/studio/dist/static/manifest.webmanifest @@ -0,0 +1,19 @@ +{ + "icons": [ + { + "src": "/static/favicon-96.png", + "type": "image/png", + "sizes": "96x96" + }, + { + "src": "/static/favicon-192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "/static/favicon-512.png", + "type": "image/png", + "sizes": "512x512" + } + ] +} \ No newline at end of file diff --git a/apps/studio/dist/static/python-jWMSN8OU.js b/apps/studio/dist/static/python-jWMSN8OU.js new file mode 100644 index 00000000..d5f13f8e --- /dev/null +++ b/apps/studio/dist/static/python-jWMSN8OU.js @@ -0,0 +1 @@ +function s(o){return new RegExp("^(("+o.join(")|(")+"))\\b")}var N=s(["and","or","not","is"]),E=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in","False","True"],F=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function c(o){return o.scopes[o.scopes.length-1]}function A(o){for(var p="error",O=o.delimiters||o.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,h=[o.singleOperators,o.doubleOperators,o.doubleDelimiters,o.tripleDelimiters,o.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/],g=0;gi?S(n,e):l0&&_(n,e)&&(t+=" "+p),t}}return v(n,e)}function v(n,e,r){if(n.eatSpace())return null;if(!r&&n.match(/^#.*/))return"comment";if(n.match(/^[0-9\.]/,!1)){var i=!1;if(n.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),n.match(/^[\d_]+\.\d*/)&&(i=!0),n.match(/^\.\d+/)&&(i=!0),i)return n.eat(/J/i),"number";var l=!1;if(n.match(/^0x[0-9a-f_]+/i)&&(l=!0),n.match(/^0b[01_]+/i)&&(l=!0),n.match(/^0o[0-7_]+/i)&&(l=!0),n.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(n.eat(/J/i),l=!0),n.match(/^0(?![\dx])/i)&&(l=!0),l)return n.eat(/L/i),"number"}if(n.match(w)){var t=n.current().toLowerCase().indexOf("f")!==-1;return t?(e.tokenize=R(n.current(),e.tokenize),e.tokenize(n,e)):(e.tokenize=B(n.current(),e.tokenize),e.tokenize(n,e))}for(var u=0;u=0;)n=n.substr(1);var r=n.length==1,i="string";function l(u){return function(f,b){var T=v(f,b,!0);return T=="punctuation"&&(f.current()=="{"?b.tokenize=l(u+1):f.current()=="}"&&(u>1?b.tokenize=l(u-1):b.tokenize=t)),T}}function t(u,f){for(;!u.eol();)if(u.eatWhile(/[^'"\{\}\\]/),u.eat("\\")){if(u.next(),r&&u.eol())return i}else{if(u.match(n))return f.tokenize=e,i;if(u.match("{{"))return i;if(u.match("{",!1))return f.tokenize=l(0),u.current()?i:f.tokenize(u,f);if(u.match("}}"))return i;if(u.match("}"))return p;u.eat(/['"]/)}if(r){if(o.singleLineStringErrors)return p;f.tokenize=e}return i}return t.isString=!0,t}function B(n,e){for(;"rubf".indexOf(n.charAt(0).toLowerCase())>=0;)n=n.substr(1);var r=n.length==1,i="string";function l(t,u){for(;!t.eol();)if(t.eatWhile(/[^'"\\]/),t.eat("\\")){if(t.next(),r&&t.eol())return i}else{if(t.match(n))return u.tokenize=e,i;t.eat(/['"]/)}if(r){if(o.singleLineStringErrors)return p;u.tokenize=e}return i}return l.isString=!0,l}function S(n,e){for(;c(e).type!="py";)e.scopes.pop();e.scopes.push({offset:c(e).offset+n.indentUnit,type:"py",align:null})}function m(n,e,r){var i=n.match(/^[\s\[\{\(]*(?:#|$)/,!1)?null:n.column()+1;e.scopes.push({offset:e.indent+(k||n.indentUnit),type:r,align:i})}function _(n,e){for(var r=n.indentation();e.scopes.length>1&&c(e).offset>r;){if(c(e).type!="py")return!0;e.scopes.pop()}return c(e).offset!=r}function D(n,e){n.sol()&&(e.beginningOfLine=!0,e.dedent=!1);var r=e.tokenize(n,e),i=n.current();if(e.beginningOfLine&&i=="@")return n.match(y,!1)?"meta":x?"operator":p;if(/\S/.test(i)&&(e.beginningOfLine=!1),(r=="variable"||r=="builtin")&&e.lastToken=="meta"&&(r="meta"),(i=="pass"||i=="return")&&(e.dedent=!0),i=="lambda"&&(e.lambda=!0),i==":"&&!e.lambda&&c(e).type=="py"&&n.match(/^\s*(?:#|$)/,!1)&&S(n,e),i.length==1&&!/string|comment/.test(r)){var l="[({".indexOf(i);if(l!=-1&&m(n,e,"])}".slice(l,l+1)),l="])}".indexOf(i),l!=-1)if(c(e).type==i)e.indent=e.scopes.pop().offset-(k||n.indentUnit);else return p}return e.dedent&&n.eol()&&c(e).type=="py"&&e.scopes.length>1&&e.scopes.pop(),r}return{name:"python",startState:function(){return{tokenize:z,scopes:[{offset:0,type:"py",align:null}],indent:0,lastToken:null,lambda:!1,dedent:0}},token:function(n,e){var r=e.errorToken;r&&(e.errorToken=!1);var i=D(n,e);return i&&i!="comment"&&(e.lastToken=i=="keyword"||i=="punctuation"?n.current():i),i=="punctuation"&&(i=null),n.eol()&&e.lambda&&(e.lambda=!1),r?p:i},indent:function(n,e,r){if(n.tokenize!=z)return n.tokenize.isString?null:0;var i=c(n),l=i.type==e.charAt(0)||i.type=="py"&&!n.dedent&&/^(else:|elif |except |finally:)/.test(e);return i.align!=null?i.align-(l?1:0):i.offset-(l?k||r.unit:0)},languageData:{autocomplete:E.concat(F).concat(["exec","print"]),indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:)$/,commentTokens:{line:"#"},closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""']}}}}var U=function(o){return o.split(" ")};const Z=A({});A({extra_keywords:U("by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE")});export{A as mkPython,Z as python}; diff --git a/apps/studio/dist/static/refractor-D2xBBZCk.js b/apps/studio/dist/static/refractor-D2xBBZCk.js new file mode 100644 index 00000000..c970ff55 --- /dev/null +++ b/apps/studio/dist/static/refractor-D2xBBZCk.js @@ -0,0 +1,4 @@ +import{cP as be,cQ as dn,g as wn,cM as kn,j as me}from"./sanity-BZuh2pfi.js";var qe,wr;function Sn(){if(wr)return qe;wr=1,qe=e;var t=Object.prototype.hasOwnProperty;function e(){for(var i={},r=0;r4&&y.slice(0,4)===r&&d.test(A)&&(A.charAt(4)==="-"?S=g(A):A=m(A),w=e),new w(S,A))}function g(b){var A=b.slice(5).replace(f,h);return r+A.charAt(0).toUpperCase()+A.slice(1)}function m(b){var A=b.slice(4);return f.test(A)?b:(A=A.replace(o,k),A.charAt(0)!=="-"&&(A="-"+A),r+A)}function k(b){return"-"+b.toLowerCase()}function h(b){return b.charAt(1).toUpperCase()}return ze}var He,Dr;function In(){if(Dr)return He;Dr=1,He=e;var t=/[#.]/g;function e(i,r){for(var d=i||"",f=r||"div",o={},a=0,g,m,k;a=48&&i<=57}return Ve}var Ze,Wr;function _t(){if(Wr)return Ze;Wr=1,Ze=t;function t(e){var i=typeof e=="string"?e.charCodeAt(0):e;return i>=97&&i<=102||i>=65&&i<=70||i>=48&&i<=57}return Ze}var Ge,Xr;function Pt(){if(Xr)return Ge;Xr=1,Ge=t;function t(e){var i=typeof e=="string"?e.charCodeAt(0):e;return i>=97&&i<=122||i>=65&&i<=90}return Ge}var Ke,Vr;function Ut(){if(Vr)return Ke;Vr=1;var t=Pt(),e=mn();Ke=i;function i(r){return t(r)||e(r)}return Ke}var Je,Zr;function zt(){if(Zr)return Je;Zr=1;var t,e=59;Je=i;function i(r){var d="&"+r+";",f;return t=t||document.createElement("i"),t.innerHTML=d,f=t.textContent,f.charCodeAt(f.length-1)===e&&r!=="semi"||f===d?!1:f}return Je}var Ye,Gr;function Ht(){if(Gr)return Ye;Gr=1;var t=jt,e=Dt,i=mn(),r=_t(),d=Ut(),f=zt();Ye=D;var o={}.hasOwnProperty,a=String.fromCharCode,g=Function.prototype,m={warning:null,reference:null,text:null,warningContext:null,referenceContext:null,textContext:null,position:{},additional:null,attribute:!1,nonTerminated:!0},k=9,h=10,b=12,A=32,y=38,S=59,w=60,C=61,u=35,l=88,p=120,s=65533,n="named",c="hexadecimal",x="decimal",v={};v[c]=16,v[x]=10;var F={};F[n]=d,F[x]=i,F[c]=r;var q=1,L=2,H=3,ie=4,ge=5,le=6,ue=7,R={};R[q]="Named character references must be terminated by a semicolon",R[L]="Numeric character references must be terminated by a semicolon",R[H]="Named character references cannot be empty",R[ie]="Numeric character references cannot be empty",R[ge]="Named character references must be known",R[le]="Numeric character references cannot be disallowed",R[ue]="Numeric character references cannot be outside the permissible Unicode range";function D(E,T){var N={},P,_;T||(T={});for(_ in m)P=T[_],N[_]=P??m[_];return(N.position.indent||N.position.start)&&(N.indent=N.position.indent||[],N.position=N.position.start),X(E,N)}function X(E,T){var N=T.additional,P=T.nonTerminated,_=T.text,ne=T.reference,oe=T.warning,se=T.textContext,ae=T.referenceContext,we=T.warningContext,G=T.position,xn=T.indent||[],ke=E.length,V=0,vr=-1,K=G.column||1,hr=G.line||1,J="",Se=[],te,Ae,Y,j,Z,I,M,U,ve,Ce,Q,ce,ee,B,mr,fe,he,z,$;for(typeof N=="string"&&(N=N.charCodeAt(0)),fe=de(),U=oe?bn:g,V--,ke++;++V65535&&(I-=65536,Ce+=a(I>>>10|55296),I=56320|I&1023),I=Ce+a(I))):B!==n&&U(ie,z)),I?(yr(),fe=de(),V=$-1,K+=$-ee+1,Se.push(I),he=de(),he.offset++,ne&&ne.call(ae,I,{start:fe,end:he},E.slice(ee-1,$)),fe=he):(j=E.slice(ee-1,$),J+=j,K+=j.length,V=$-1)}else Z===10&&(hr++,vr++,K=0),Z===Z?(J+=a(Z),K++):yr();return Se.join("");function de(){return{line:hr,column:K,offset:V+(G.offset||0)}}function bn(xr,br){var Fe=de();Fe.column+=br,Fe.offset+=br,oe.call(we,R[xr],Fe,xr)}function yr(){J&&(Se.push(J),_&&_.call(se,J,{start:fe,end:de()}),J="")}}function re(E){return E>=55296&&E<=57343||E>1114111}function O(E){return E>=1&&E<=8||E===11||E>=13&&E<=31||E>=127&&E<=159||E>=64976&&E<=65007||(E&65535)===65535||(E&65535)===65534}return Ye}var Qe={exports:{}},Kr;function Bt(){return Kr||(Kr=1,(function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var i=(function(r){var d=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,f=0,o={},a={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function u(l){return l instanceof g?new g(l.type,u(l.content),l.alias):Array.isArray(l)?l.map(u):l.replace(/&/g,"&").replace(/"u")return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(s){var u=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(s.stack)||[])[1];if(u){var l=document.getElementsByTagName("script");for(var p in l)if(l[p].src==u)return l[p]}return null}},isActive:function(u,l,p){for(var s="no-"+l;u;){var n=u.classList;if(n.contains(l))return!0;if(n.contains(s))return!1;u=u.parentElement}return!!p}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(u,l){var p=a.util.clone(a.languages[u]);for(var s in l)p[s]=l[s];return p},insertBefore:function(u,l,p,s){s=s||a.languages;var n=s[u],c={};for(var x in n)if(n.hasOwnProperty(x)){if(x==l)for(var v in p)p.hasOwnProperty(v)&&(c[v]=p[v]);p.hasOwnProperty(x)||(c[x]=n[x])}var F=s[u];return s[u]=c,a.languages.DFS(a.languages,function(q,L){L===F&&q!=u&&(this[q]=c)}),c},DFS:function u(l,p,s,n){n=n||{};var c=a.util.objId;for(var x in l)if(l.hasOwnProperty(x)){p.call(l,x,l[x],s||x);var v=l[x],F=a.util.type(v);F==="Object"&&!n[c(v)]?(n[c(v)]=!0,u(v,p,null,n)):F==="Array"&&!n[c(v)]&&(n[c(v)]=!0,u(v,p,x,n))}}},plugins:{},highlightAll:function(u,l){a.highlightAllUnder(document,u,l)},highlightAllUnder:function(u,l,p){var s={callback:p,container:u,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};a.hooks.run("before-highlightall",s),s.elements=Array.prototype.slice.apply(s.container.querySelectorAll(s.selector)),a.hooks.run("before-all-elements-highlight",s);for(var n=0,c;c=s.elements[n++];)a.highlightElement(c,l===!0,s.callback)},highlightElement:function(u,l,p){var s=a.util.getLanguage(u),n=a.languages[s];a.util.setLanguage(u,s);var c=u.parentElement;c&&c.nodeName.toLowerCase()==="pre"&&a.util.setLanguage(c,s);var x=u.textContent,v={element:u,language:s,grammar:n,code:x};function F(L){v.highlightedCode=L,a.hooks.run("before-insert",v),v.element.innerHTML=v.highlightedCode,a.hooks.run("after-highlight",v),a.hooks.run("complete",v),p&&p.call(v.element)}if(a.hooks.run("before-sanity-check",v),c=v.element.parentElement,c&&c.nodeName.toLowerCase()==="pre"&&!c.hasAttribute("tabindex")&&c.setAttribute("tabindex","0"),!v.code){a.hooks.run("complete",v),p&&p.call(v.element);return}if(a.hooks.run("before-highlight",v),!v.grammar){F(a.util.encode(v.code));return}if(l&&r.Worker){var q=new Worker(a.filename);q.onmessage=function(L){F(L.data)},q.postMessage(JSON.stringify({language:v.language,code:v.code,immediateClose:!0}))}else F(a.highlight(v.code,v.grammar,v.language))},highlight:function(u,l,p){var s={code:u,grammar:l,language:p};if(a.hooks.run("before-tokenize",s),!s.grammar)throw new Error('The language "'+s.language+'" has no grammar.');return s.tokens=a.tokenize(s.code,s.grammar),a.hooks.run("after-tokenize",s),g.stringify(a.util.encode(s.tokens),s.language)},tokenize:function(u,l){var p=l.rest;if(p){for(var s in p)l[s]=p[s];delete l.rest}var n=new h;return b(n,n.head,u),k(u,n,l,n.head,0),y(n)},hooks:{all:{},add:function(u,l){var p=a.hooks.all;p[u]=p[u]||[],p[u].push(l)},run:function(u,l){var p=a.hooks.all[u];if(!(!p||!p.length))for(var s=0,n;n=p[s++];)n(l)}},Token:g};r.Prism=a;function g(u,l,p,s){this.type=u,this.content=l,this.alias=p,this.length=(s||"").length|0}g.stringify=function u(l,p){if(typeof l=="string")return l;if(Array.isArray(l)){var s="";return l.forEach(function(F){s+=u(F,p)}),s}var n={type:l.type,content:u(l.content,p),tag:"span",classes:["token",l.type],attributes:{},language:p},c=l.alias;c&&(Array.isArray(c)?Array.prototype.push.apply(n.classes,c):n.classes.push(c)),a.hooks.run("wrap",n);var x="";for(var v in n.attributes)x+=" "+v+'="'+(n.attributes[v]||"").replace(/"/g,""")+'"';return"<"+n.tag+' class="'+n.classes.join(" ")+'"'+x+">"+n.content+""};function m(u,l,p,s){u.lastIndex=l;var n=u.exec(p);if(n&&s&&n[1]){var c=n[1].length;n.index+=c,n[0]=n[0].slice(c)}return n}function k(u,l,p,s,n,c){for(var x in p)if(!(!p.hasOwnProperty(x)||!p[x])){var v=p[x];v=Array.isArray(v)?v:[v];for(var F=0;F=c.reach);D+=R.value.length,R=R.next){var X=R.value;if(l.length>u.length)return;if(!(X instanceof g)){var re=1,O;if(ie){if(O=m(ue,D,u,H),!O||O.index>=u.length)break;var P=O.index,E=O.index+O[0].length,T=D;for(T+=R.value.length;P>=T;)R=R.next,T+=R.value.length;if(T-=R.value.length,D=T,R.value instanceof g)continue;for(var N=R;N!==l.tail&&(Tc.reach&&(c.reach=se);var ae=R.prev;ne&&(ae=b(l,ae,ne),D+=ne.length),A(l,ae,re);var we=new g(x,L?a.tokenize(_,L):_,ge,_);if(R=b(l,ae,we),oe&&b(l,R,oe),re>1){var G={cause:x+","+F,reach:se};k(u,l,p,R.prev,D,G),c&&G.reach>c.reach&&(c.reach=G.reach)}}}}}}function h(){var u={value:null,prev:null,next:null},l={value:null,prev:u,next:null};u.next=l,this.head=u,this.tail=l,this.length=0}function b(u,l,p){var s=l.next,n={value:p,prev:l,next:s};return l.next=n,s.prev=n,u.length++,n}function A(u,l,p){for(var s=l.next,n=0;n/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(i){i.type==="entity"&&(i.attributes.title=i.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(r,d){var f={};f["language-"+d]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[d]},f.cdata=/^$/i;var o={"included-cdata":{pattern://i,inside:f}};o["language-"+d]={pattern:/[\s\S]+/,inside:e.languages[d]};var a={};a[r]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return r}),"i"),lookbehind:!0,greedy:!0,inside:o},e.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(i,r){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+i+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[r,"language-"+r],inside:e.languages[r]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}return er}var rr,Yr;function Xt(){if(Yr)return rr;Yr=1,rr=t,t.displayName="css",t.aliases=[];function t(e){(function(i){var r=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;i.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+r.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+r.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+r.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:r,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},i.languages.css.atrule.inside.rest=i.languages.css;var d=i.languages.markup;d&&(d.tag.addInlined("style","css"),d.tag.addAttribute("style","css"))})(e)}return rr}var nr,Qr;function Vt(){if(Qr)return nr;Qr=1,nr=t,t.displayName="clike",t.aliases=[];function t(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}return nr}var ar,en;function Zt(){if(en)return ar;en=1,ar=t,t.displayName="javascript",t.aliases=["js"];function t(e){e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}return ar}var tr,rn;function Gt(){if(rn)return tr;rn=1;var t=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof be=="object"?be:{},e=s();t.Prism={manual:!0,disableWorkerMessageHandler:!0};var i=Dn(),r=Ht(),d=Bt(),f=Wt(),o=Xt(),a=Vt(),g=Zt();e();var m={}.hasOwnProperty;function k(){}k.prototype=d;var h=new k;tr=h,h.highlight=y,h.register=b,h.alias=A,h.registered=S,h.listLanguages=w,b(f),b(o),b(a),b(g),h.util.encode=l,h.Token.stringify=C;function b(n){if(typeof n!="function"||!n.displayName)throw new Error("Expected `function` for `grammar`, got `"+n+"`");h.languages[n.displayName]===void 0&&n(h)}function A(n,c){var x=h.languages,v=n,F,q,L,H;c&&(v={},v[n]=c);for(F in v)for(q=v[F],q=typeof q=="string"?[q]:q,L=q.length,H=-1;++H":""))+")"),l;function l(){var p=w.concat(y),s=[],n,c;if((!g||b(y,S,w[w.length-1]||null))&&(s=o(m(y,w)),s[0]===d))return s;if(y.children&&s[0]!==r)for(c=(k?y.children.length:-1)+h;c>-1&&c1&&arguments[1]!==void 0?arguments[1]:{lineNumber:1};return g.reduce(function(k,h){var b=m.lineNumber;if(h.type==="text"){if(h.value.indexOf(` +`)===-1)return h.lineStart=b,h.lineEnd=b,k.nodes.push(h),k;for(var A=h.value.split(` +`),y=0;yg&&y.some(function(s){return p.indexOf(s)!==-1})&&S(A,l,p)}});var w=t(k,function(l){return y.indexOf(l)===-1}),C=function(p){var s=p.get(k);return s?(e(s,function(n,c){if(n.children){n.lineStart=0,n.lineEnd=0;return}c.forEach(function(x){x.lineStart=Math.max(x.lineStart,n.lineStart),x.lineEnd=Math.max(x.lineEnd,n.lineEnd)})}),s.children):[]},u=[].concat(C(h),C(b),C(A),w?w.children:[]);return h.clear(),b.clear(),A.clear(),u}function f(g,m,k){var h=m.className||"refractor-marker";return{type:"element",tagName:m.component||"div",properties:m.component?Object.assign({},k,{className:h}):{className:h},children:g,lineStart:m.line,lineEnd:g[g.length-1].lineEnd,isMarker:!0}}function o(g,m,k){if(m.length===0||g.length===0)return g;for(var h=m.reduce(function(l,p){return d(p.line,l)},g),b=[],A=0,y=0;y0&&b.push(f(C,S,k))}for(;A0&&(k=r(k,{markers:o.markers}));var h=k.length===0?o.value:k.map(i.depth(0)),b=d("code",g,h);return o.inline?b:d("pre",m,b)}return f.registerLanguage=function(o){return e.register(o)},f.hasLanguage=function(o){return e.registered(o)},dr=f,dr}var ai=ni();const fn=wn(ai);function ti(t){const e=kn.c(13),{language:i,value:r}=t,d=typeof i=="string"?i:void 0;let f;e[0]!==d?(f=d?fn.hasLanguage(d):!1,e[0]=d,e[1]=f):f=e[1];const o=f;let a;e[2]!==d||e[3]!==o||e[4]!==r?(a=!(d&&o)&&me.jsx("code",{children:r}),e[2]=d,e[3]=o,e[4]=r,e[5]=a):a=e[5];let g;e[6]!==d||e[7]!==o||e[8]!==r?(g=d&&o&&me.jsx(fn,{inline:!0,language:d,value:String(r)}),e[6]=d,e[7]=o,e[8]=r,e[9]=g):g=e[9];let m;return e[10]!==a||e[11]!==g?(m=me.jsxs(me.Fragment,{children:[a,g]}),e[10]=a,e[11]=g,e[12]=m):m=e[12],m}ti.displayName="LazyRefractor";export{ti as default}; diff --git a/apps/studio/dist/static/refractor-LmlFOfGa.js b/apps/studio/dist/static/refractor-LmlFOfGa.js new file mode 100644 index 00000000..6766e957 --- /dev/null +++ b/apps/studio/dist/static/refractor-LmlFOfGa.js @@ -0,0 +1 @@ +import{cM as u,cN as d,j as c,cO as f}from"./sanity-BZuh2pfi.js";function p(g){const e=u.c(13),{language:i,value:a}=g,t=typeof i=="string"?i:void 0;let l;e[0]!==t?(l=t?d(t):!1,e[0]=t,e[1]=l):l=e[1];const r=l;let s;e[2]!==t||e[3]!==r||e[4]!==a?(s=!(t&&r)&&c.jsx("code",{children:a}),e[2]=t,e[3]=r,e[4]=a,e[5]=s):s=e[5];let n;e[6]!==t||e[7]!==r||e[8]!==a?(n=t&&r&&c.jsx(f,{inline:!0,language:t,value:String(a)}),e[6]=t,e[7]=r,e[8]=a,e[9]=n):n=e[9];let o;return e[10]!==s||e[11]!==n?(o=c.jsxs(c.Fragment,{children:[s,n]}),e[10]=s,e[11]=n,e[12]=o):o=e[12],o}p.displayName="LazyRefractor";export{p as default}; diff --git a/apps/studio/dist/static/resources-CN9IRhSx.js b/apps/studio/dist/static/resources-CN9IRhSx.js new file mode 100644 index 00000000..d3e177e3 --- /dev/null +++ b/apps/studio/dist/static/resources-CN9IRhSx.js @@ -0,0 +1 @@ +import{d as e}from"./sanity-BZuh2pfi.js";const o=e("comments",{"close-pane-button-text":"Close comments","close-pane-button-text-aria-label":"Close comments","compose.add-comment-input-placeholder":"Add comment to {{field}}","compose.add-comment-input-placeholder-upsell":"Upgrade to add comment","compose.create-comment-placeholder":"Create a new comment","compose.mention-user-aria-label":"Mention user","compose.mention-user-tooltip":"Mention user","compose.reply-placeholder":"Reply","compose.reply-placeholder-upsell":"Upgrade to reply","compose.send-comment-aria-label":"Send comment","compose.send-comment-tooltip":"Send comment","copy-link-error-message":"Unable to copy link to clipboard","delete-comment.body":"Once deleted, a comment cannot be recovered.","delete-comment.confirm":"Delete comment","delete-comment.title":"Delete this comment?","delete-dialog.error":"An error occurred while deleting the comment. Please try again.","delete-thread.body":"This comment and its replies will be deleted, and once deleted cannot be recovered.","delete-thread.confirm":"Delete thread","delete-thread.title":"Delete this comment thread?","discard.button-confirm":"Discard","discard.header":"Discard comment?","discard.text":"Do you want to discard the comment?","feature-feedback.link":"Share your feedback","feature-feedback.title":"Help improve ","feature-name":"Comments","field-button.aria-label-add":"Add comment","field-button.aria-label-open":"Open comments","field-button.content_one":"View comment","field-button.content_other":"View comments","field-button.title":"Add comment","inline-add-comment-button.disabled-overlap-title":"Comments cannot overlap","inline-add-comment-button.title":"Add comment","inspector-error.title":"Something went wrong while loading comments","list-item.breadcrumb-button-go-to-field-aria-label":"Go to {{field}} field","list-item.context-menu-add-reaction":"Add reaction","list-item.context-menu-add-reaction-aria-label":"Add reaction","list-item.context-menu-add-reaction-upsell":"Upgrade to add reaction","list-item.copy-link":"Copy link to comment","list-item.delete-comment":"Delete comment","list-item.edit-comment":"Edit comment","list-item.edit-comment-upsell":"Upgrade to edit comment","list-item.go-to-field-button.aria-label":"Go to field","list-item.layout-context":"on {{title}}","list-item.layout-edited":"edited","list-item.layout-failed-sent":"Failed to send.","list-item.layout-posting":"Posting...","list-item.layout-retry":"Retry","list-item.missing-referenced-value-tooltip-content":"The commented text has been deleted","list-item.open-menu-aria-label":"Open comment actions menu","list-item.re-open-resolved":"Re-open","list-item.re-open-resolved-aria-label":"Re-open","list-item.resolved-tooltip-aria-label":"Mark comment as resolved","list-item.resolved-tooltip-content":"Mark as resolved","list-status.empty-state-open-text":"Open comments on this document will be shown here.","list-status.empty-state-open-title":"No open comments yet","list-status.empty-state-resolved-text":"Resolved comments on this document will be shown here.","list-status.empty-state-resolved-title":"No resolved comments yet","list-status.error":"Something went wrong","list-status.loading":"Loading comments","mentions.no-users-found":"No users found","mentions.unauthorized-user":"Unauthorized","mentions.user-list-aria-label":"List of users to mention","onboarding.body":"You can add comments to any field in a document. They'll show up here, grouped by field.","onboarding.dismiss":"Got it","onboarding.header":"Document fields now have comments","reactions.add-reaction-tooltip":"Add reaction","reactions.react-with-aria-label":"React with {{reactionName}}","reactions.user-list.unknown-user-fallback-name":"Unknown user","reactions.user-list.you":"you","reactions.user-list.you_leading":"You","reactions.users-reacted-with-reaction":" reacted with ","status-filter.status-open":"Open","status-filter.status-open-full":"Open comments","status-filter.status-resolved":"Resolved","status-filter.status-resolved-full":"Resolved comments","status-filter.status-resolved-full-upsell":"Upgrade to see resolved comments"});export{o as default}; diff --git a/apps/studio/dist/static/resources-D34Sp8g5.js b/apps/studio/dist/static/resources-D34Sp8g5.js new file mode 100644 index 00000000..580eb482 --- /dev/null +++ b/apps/studio/dist/static/resources-D34Sp8g5.js @@ -0,0 +1 @@ +import{d as e}from"./sanity-BZuh2pfi.js";const t=e("vision",{"action.copy-url-to-clipboard":"Copy to clipboard","action.delete":"Delete","action.edit-title":"Edit title","action.listen-cancel":"Stop","action.listen-execute":"Listen","action.load-queries":"Load queries","action.load-query":"Load query","action.query-cancel":"Cancel","action.query-execute":"Fetch","action.save-query":"Save query","action.update":"Update","label.actions":"Actions","label.edited":"Edited","label.new":"New","label.personal":"Personal","label.saved-at":"Saved at","label.saved-queries":"Saved queries","label.search-queries":"Search queries","label.share":"Share","label.team":"Team","params.error.params-invalid-json":"Parameters are not valid JSON","params.label":"Params","query.error.column":"Column","query.error.line":"Line","query.label":"Query","query.url":"Query URL","result.end-to-end-time-label":"End-to-end","result.execution-time-label":"Execution","result.label":"Result","result.save-result-as-csv.not-csv-encodable":"Result cannot be encoded as CSV","result.save-result-as-format":"Save result as ","result.timing-not-applicable":"n/a","save-query.already-saved":"Query already saved","save-query.error":"Error saving query","save-query.success":"Query saved","settings.api-version-label":"API version","settings.custom-api-version-label":"Custom API version","settings.dataset-label":"Dataset","settings.error.invalid-api-version":"Invalid API version","settings.other-api-version-label":"Other","settings.perspective-label":"Perspective","settings.perspective.preview-drafts-renamed-to-drafts.description":'The "previewDrafts" perspective has been renamed to "drafts" and is now deprecated. This change is effective for all versions with perspective support (>= v2021-03-25).',"settings.perspectives.action.docs-link":"Read docs","settings.perspectives.default":"No perspective (API default)","settings.perspectives.description":'Perspectives allow your query to run against different "views" of the content in your dataset',"settings.perspectives.new-default.description":'The default perspective will change from "raw" to "published" in an upcoming API version. Please consult docs for more details.',"settings.perspectives.pinned-release-label":"Pinned release","settings.perspectives.scheduled-drafts":"Scheduled drafts","settings.perspectives.title":"Perspectives"});export{t as default}; diff --git a/apps/studio/dist/static/resources2-DGBwvEda.js b/apps/studio/dist/static/resources2-DGBwvEda.js new file mode 100644 index 00000000..191fbd09 --- /dev/null +++ b/apps/studio/dist/static/resources2-DGBwvEda.js @@ -0,0 +1 @@ +const e={"action.add-document":"Add document","action.archive":"Archive release","action.archive.tooltip":"Unschedule this release to archive it","action.archived":"Archived","action.paused":"Paused","action.create-revert-release":"Create a new release","action.delete-release":"Delete release","action.drafts":"Scheduled drafts","action.duplicate-release":"Duplicate release","action.edit":"Edit release","action.open":"Active","action.releases":"Releases","action.schedule":"Schedule release...","action.schedule-unpublish":"Schedule Unpublish","action.schedule-unpublish.disabled.not-published":"Document must be published to schedule unpublish","action.unpublish":"Unpublish","action.unpublish-doc-actions":"Unpublish when releasing","action.revert-unpublish-actions":"Revert unpublish when releasing","action.unschedule":"Unschedule release","action.publish-all-documents":"Run release","action.review":"Review changes","action.revert":"Revert release","actions.summary":"Summary","action.immediate-revert-release":"Revert now","action.unarchive":"Unarchive release","activity.event.add-document":"added a document version","activity.event.archive":"archived the {{releaseTitle}} release","activity.event.create":"created the {{releaseTitle}} release targeting ","activity.event.discard-document":"discarded a document version","activity.event.edit":"set release time to ","activity.event.edit-time-asap":"immediately","activity.event.edit-time-undecided":"never","activity.event.publish":"published the {{releaseTitle}} release","activity.event.schedule":"marked as scheduled","activity.event.unarchive":"unarchived the {{releaseTitle}} release","activity.event.unschedule":"marked as unscheduled","activity.panel.loading":"Loading release activity","activity.panel.error":"An error occurred getting the release activity","activity.panel.title":"Activity","archive-dialog.confirm-archive-header":"Are you sure you want to archive this release?","archive-dialog.confirm-archive-title":"Are you sure you want to archive the '{{title}}' release?","archive-dialog.confirm-archive-description_one":"This will archive 1 document version.","archive-dialog.confirm-archive-description_other":"This will archive {{count}} document versions.","archive-dialog.confirm-archive-button":"Yes, archive release","archive-info.title":"This release is archived","archive-info.description":"It will be available for {{retentionDays}} days, then automatically removed on {{removalDate}}. Learn about retention.","changes-published-docs.title":"Changes to published documents",created:"Created ","copy-suffix":"Copy","dashboard.details.published-asap":"Published","dashboard.details.published-on":"Published on {{date}}","dashboard.details.pin-release":"Pin release to studio","dashboard.details.unpin-release":"Unpin release from studio","dashboard.details.activity":"Activity","delete-dialog.confirm-delete.header":"Are you sure you want to delete this release?","delete-dialog.confirm-delete-description_one":"This will delete 1 document version.","delete-dialog.confirm-delete-description_other":"This will delete {{count}} document versions.","delete-dialog.confirm-delete-button":"Yes, delete release","diff.no-changes":"No changes","diff.list-empty":"Changes list is empty, see document","discard-version-dialog.description-draft":"This will permanently remove all changes made to this document. This action cannot be undone.","discard-version-dialog.description-release":"This will permanently remove all changes made to this document within the '{{releaseTitle}}' release. This action cannot be undone.","discard-version-dialog.header-draft":"Discard draft?","discard-version-dialog.header-release":"Remove document from the '{{releaseTitle}}' release?","discard-version-dialog.title-draft":"Discard draft","discard-version-dialog.title-release":"Remove from release","copy-to-draft-dialog.title":"Draft version already exists","copy-to-draft-dialog.description":"A draft version of this document already exists. Copy the current version to the draft and override the existing draft version.","copy-to-draft-dialog.confirm-button":"Yes, override Draft","document-validation.error_other":"{{count}} validation errors","document-validation.error_one":"{{count}} validation error","deleted-release":"The '{{title}}' release has been deleted","duplicate-dialog.confirm-duplicate-header":"Are you sure you want to duplicate this release?","duplicate-dialog.confirm-duplicate-description_one":"This will duplicate the release and the 1 document version.","duplicate-dialog.confirm-duplicate-description_other":"This will duplicate the release and the {{count}} document versions.","duplicate-dialog.confirm-duplicate-button":"Yes, duplicate release","error-details-title":"Error details","failed-edit-title":"Failed to save changes","failed-publish-title":"Failed to publish","failed-schedule-title":"Failed to schedule","passed-intended-publish-date":"This release has passed its intended publish date","passed-intended-publish-date-draft":"This draft has passed its intended publish date","footer.status.archived":"Archived","footer.status.created":"Created","footer.status.edited":"Edited","footer.status.published":"Published","footer.status.unarchived":"Unarchived","loading-release":"Loading release","loading-release-documents":"Loading documents","loading-release-documents.error.title":"Something went wrong","loading-release-documents.error.description":"We're unable to load the documents for this release. Please try again later.","menu.label":"Release menu","menu.tooltip":"Actions","menu.group.when-releasing":"When releasing","no-archived-release":"No archived releases","no-paused-release":"No paused scheduled drafts","no-releases":"No Releases","not-found":"Release not found: {{releaseId}}","overview.action.documentation":"Documentation","overview.calendar.tooltip":"View calendar","overview.description":"Releases are collections of document changes which can be managed, scheduled, and rolled back together.","overview.search-releases-placeholder":"Search releases","overview.title":"Releases","permissions.error.discard-version":"You do not have permission to discard this version","permissions.error.unpublish":"You do not have permission to unpublish this document","permission-missing-title":"Limited access","permission-missing-description":"Your role currently limits what you can see in this release. You may not publish nor schedule this release.","permissions.error.archive":"You do not have permission to archive this release","permissions.error.delete":"You do not have permission to delete this release","permissions.error.duplicate":"You do not have permission to duplicate this release","permissions.error.unarchive":"You do not have permission to unarchive this release","presence.tooltip.one":'{{displayName}} is editing this document in the "{{releaseTitle}}" release right now',"presence.tooltip.other":"{{count}} people are editing this document right now","publish-action.validation.no-documents":"There are no documents to publish","publish-dialog.confirm-publish.title":"Are you sure you want to publish the release and all document versions?","publish-dialog.confirm-publish-description_one":"The '{{title}}' release and its document will be published.","publish-dialog.confirm-publish-description_other":"The '{{title}}' release and its {{releaseDocumentsLength}} documents will be published.","publish-dialog.validation.no-permission":"You do not have permission to publish","publish-dialog.validation.loading":"Validating documents...","publish-dialog.validation.error":"Some documents have validation errors","publish-info.title":"This release is published successfully.","release-placeholder.title":"Untitled","review.description":"Add documents to this release to review changes","review.edited":"Edited ","revert-dialog.confirm-revert-description_one":"This will revert {{releaseDocumentsLength}} document version.","revert-dialog.confirm-revert-description_other":"This will revert {{releaseDocumentsLength}} document versions.","revert-dialog.confirm-revert.title":"Are you sure you want to revert the '{{title}}' release?","revert-dialog.confirm-revert.stage-revert-checkbox-label":"Immediately revert the release","revert-dialog.confirm-revert.warning-card":"Changes were made to documents in this release after they were published. Reverting will overwrite these changes.","revert-release.title":'Reverting "{{title}}"',"revert-release.description":'Revert changes to document versions in "{{title}}".',"schedule-button.tooltip":"Are you sure you want to unschedule the release?","schedule-action.validation.no-documents":"There are no documents to schedule","schedule-button-tooltip.validation.no-permission":"You do not have permission to schedule","schedule-button-tooltip.validation.loading":"Validating documents...","schedule-button-tooltip.validation.error":"Some documents have validation errors","schedule-button-tooltip.already-scheduled":"This release is already scheduled","schedule-dialog.confirm-title":"Schedule the release","schedule-dialog.confirm-description_one":"The '{{title}}' release and its document will be published on the selected date.","schedule-dialog.confirm-description_other":"The {{title}} release and its {{count}} document versions will be scheduled.","schedule-dialog.confirm-button":"Yes, schedule","schedule-dialog.select-publish-date-label":"Schedule on","unschedule-dialog.confirm-title":"Are you sure you want to unschedule the release?","unschedule-dialog.confirm-description":"The release will no longer be published on the scheduled date","schedule-dialog.publish-date-in-past-warning":"Schedule for a future time and date.","schedule-unpublish-dialog.header":"Schedule draft for Unpublish","schedule-unpublish-dialog.description":"Select when this document should be unpublished.","schedule-unpublish-dialog.confirm":"Schedule Unpublish","search-documents-placeholder":"Search documents","summary.created":"Created ","summary.published":"Published ","summary.not-published":"Not published","summary.no-documents":"No documents","summary.document-count_one":"{{count}} document","summary.document-count_other":"{{count}} documents","summary.validating-documents":"Validating documents: {{validatedCount}} of {{totalCount}}","summary.validated-documents":"{{validatedCount}} of {{totalCount}} documents validated","summary.all-documents-validated":"All documents validated, no conflicts found","summary.all-documents-errors-found":"All documents validated, conflicts found","summary.errors-found":"In order to publish or schedule the release, please resolve the conflicts found in the documents","table-body.action.add":"Add","table-body.action.change":"Change","table-body.action.unpublish":"Unpublish","table-header.archivedAt":"Archived","table-header.contributors":"Contributors","table-header.created-by":"Created by","table-header.document":"Document","table-header.documents":"Documents","table-header.edited":"Edited","table-header.published-at":"Published","table-header.publishedAt":"Published","table-header.scheduled-draft.published-at":"Published at","table-header.scheduled-for":"Scheduled for","table-header.intended-for":"Intended for","table-header.time":"Time","table-header.title":"Release","table-header.type":"Type","table-header.action":"Action","filter-tab.all":"All","filter-tab.errors":"Errors","toast.archive.error":"Failed to archive '{{title}}': {{error}}","toast.create-version.error":"Failed to add document to release: {{error}}","toast.delete.error":"Failed to delete '{{title}}': {{error}}","toast.delete.success":"The '{{title}}' release was successfully deleted","toast.duplicate.error":"Failed to duplicate '{{title}}': {{error}}","toast.duplicate.success":"The '{{title}}' release was duplicated. ","toast.duplicate.success-link":"View duplicated release","toast.publish.error":"Failed to publish '{{title}}': {{error}}","toast.schedule.error":"Failed to schedule '{{title}}': {{error}}","toast.schedule.success":"The '{{title}}' release was scheduled.","toast.unschedule.error":"Failed to unscheduled '{{title}}': {{error}}","toast.unarchive.error":"Failed to unarchive '{{title}}': {{error}}","type-picker.tooltip.scheduled":"The release is scheduled, unschedule it to change type","toast.revert.error":"Failed to revert release: {{error}}","toast.immediate-revert.success":"The '{{title}}' release was successfully reverted","toast.revert-stage.success":"Revert release for '{{title}}' was successfully created. ","toast.revert-stage.success-link":"View revert release","unpublish.already-unpublished":"This document is already unpublished.","unpublish.no-published-version":"There is no published version of this document.","unpublish-dialog.header":"Are you sure you want to unpublish this document when releasing?","unpublish-dialog.action.cancel":"Cancel","unpublish-dialog.action.unpublish":"Yes, unpublish when releasing","unpublish-dialog.description.to-draft":"This will unpublish the document as part of the release, and create a draft if no draft exists at the time of release.","unpublish-dialog.description.lost-changes":"Any changes made to this document version will be lost.","banner.scheduled-drafts-disabled":"Scheduled drafts has been disabled but there are still scheduled drafts to be published.","banner.drafts-mode-disabled":"Drafts mode has been disabled but there are still scheduled drafts to be published.","no-scheduled-drafts":"No Scheduled Drafts","banner.confirm-active-scheduled-drafts_one":"There is {{count}} Scheduled Draft that requires scheduling confirmation","banner.confirm-active-scheduled-drafts_other":"There are {{count}} Scheduled Drafts that require scheduling confirmation","banner.confirm-active-scheduled-drafts.button":"Resume scheduling","banner.confirm-active-scheduled-drafts.button-paused":"Resume all schedules","confirm-active-scheduled-drafts-dialog.title":"Resume Scheduled Drafts","confirm-active-scheduled-drafts-dialog.description":"Schedule all paused Scheduled Drafts for their intended publish dates","confirm-active-scheduled-drafts-dialog.past-dates-warning":"Some of these Scheduled Drafts are scheduled for past dates. Confirming schedules will immediately publish those versions of documents.","confirm-active-scheduled-drafts-dialog.confirm-button":"Confirm Schedules","toast.confirm-active-scheduled-drafts.error":"Failed to schedule drafts: {{error}}"};export{e as default}; diff --git a/apps/studio/dist/static/resources3-C1LdqNLy.js b/apps/studio/dist/static/resources3-C1LdqNLy.js new file mode 100644 index 00000000..4dd36f98 --- /dev/null +++ b/apps/studio/dist/static/resources3-C1LdqNLy.js @@ -0,0 +1 @@ +import{d as t}from"./sanity-BZuh2pfi.js";const s=t("tasks",{"actions.create.text":"Create new task","actions.open.text":"Tasks","buttons.create.text":"Create Task","buttons.discard.text":"Discard","buttons.draft.text":"Draft","buttons.new.text":"New task","buttons.new.upsell-tooltip":"Upgrade to create tasks","buttons.next.tooltip":"Go to next task","buttons.previous.tooltip":"Go to previous task","dialog.remove-task.body":"Once deleted, a task cannot be recovered.","dialog.remove-task.buttons.cancel.text":"Cancel","dialog.remove-task.buttons.confirm.text":"Delete","dialog.remove-task.title":"Delete this task?","document.footer.open-tasks.placeholder_one":"Open task","document.footer.open-tasks.placeholder_other":"Open tasks","document.footer.open-tasks.text_one":"{{count}} open task","document.footer.open-tasks.text_other":"{{count}} open tasks","empty-state.list.assigned.heading":"You haven't been assigned any tasks","empty-state.list.assigned.text":"Once you're assigned tasks they'll show up here","empty-state.list.create-new":"Create new task","empty-state.list.document.heading":"This document doesn't have any tasks yet","empty-state.list.document.text":"Once a document has connected tasks, they will be shown here.","empty-state.list.no-active-document.heading":"Open a document to see its task","empty-state.list.no-active-document.text":"Tasks on your active document will be shown here.","empty-state.list.subscribed.heading":"You haven't subscribed to any tasks","empty-state.list.subscribed.text":"When you create, modify, or comment on a task you will be subscribed automatically","empty-state.status.list.closed.assigned.heading":"No completed tasks","empty-state.status.list.closed.assigned.text":"Your tasks marked done will show up here","empty-state.status.list.closed.document.heading":"No completed tasks","empty-state.status.list.closed.subscribed.heading":"No completed tasks","empty-state.status.list.closed.subscribed.text":"Tasks you subscribe to marked done will show up here","empty-state.status.list.open.assigned.heading":"You're all caught up","empty-state.status.list.open.assigned.text":"New tasks assigned to you will show up here","empty-state.status.list.open.document.heading":"No tasks on this document","empty-state.status.list.open.subscribed.heading":"No subscribed tasks","empty-state.status.list.open.subscribed.text":"Tasks you subscribe to will show up here","form.input.assignee.no-user-assigned.text":"Unassigned","form.input.assignee.no-user-assigned.tooltip":"Set assignee","form.input.assignee.search.no-users.text":"No users found","form.input.assignee.search.placeholder":"Select assignee","form.input.assignee.unauthorized.text":"Unauthorized","form.input.assignee.user-assigned.tooltip":"Change assignee","form.input.assignee.user-not-found.text":"User not found","form.input.create-more.text":"Create more","form.input.date.buttons.empty.tooltip":"Set due date","form.input.date.buttons.remove.text":"Remove","form.input.date.buttons.tooltip":"Change due date","form.input.description.placeholder":"Add description","form.input.status.button.tooltip":"Change status","form.input.target.buttons.remove.text":"Remove target content","form.input.target.error.schema-not-found":"Schema not found","form.input.target.search.placeholder":"Select target document","form.input.title.placeholder":"Task title","form.status.error.title-required":"Title is required","form.status.success":"Task created","list.empty.text":"No tasks","list.feedback.text":"Help us improve, share feedback on Tasks ","menuitem.copylink.text":"Copy link to task","menuitem.delete.text":"Delete task","menuitem.duplicate.text":"Duplicate task","menuitem.duplicate.upsell-tooltip":"Upgrade to duplicate tasks","panel.activity.created-fragment":"created this task","panel.activity.title":"Activity","panel.activity.unknown-user":"Unknown user","panel.close.tooltip":"Close sidebar","panel.comment.placeholder":"Add a comment...","panel.comment.placeholder.upsell":"Upgrade to comment on tasks","panel.create.title":"Create","panel.drafts.title":"Drafts","panel.navigation.tooltip":"Open tasks","panel.title":"Tasks","tab.assigned.label":"Assigned","tab.document.label":"Active Document","tab.subscribed.label":"Subscribed","toolbar.tooltip":"Tasks"});export{s as default}; diff --git a/apps/studio/dist/static/resources4-E6xXKkjd.js b/apps/studio/dist/static/resources4-E6xXKkjd.js new file mode 100644 index 00000000..bd78950d --- /dev/null +++ b/apps/studio/dist/static/resources4-E6xXKkjd.js @@ -0,0 +1,2 @@ +import{d as n}from"./sanity-BZuh2pfi.js";const i=n("canvas",{"action.link-document":"Link to Canvas","action.link-document-disabled.not-in-dashboard":"Open this document in Dashboard to link to Canvas","action.link-document-disabled.missing-permissions":"You don't have permissions to link this document to Canvas","action.link-document-disabled.version-document":"Version documents are not yet supported in Canvas","action.link-document-disabled.initial-value-not-resolved":"Please wait until the document initial values are resolved","action.unlink-document":"Unlink from Canvas","action.edit-document":"Edit in Canvas","banner.linked-to-canvas":"This document is linked to Canvas","banner.edit-document-in-canvas":"Edit in Canvas","dialog.confirm-document-changes.title":"Confirm document changes","dialog.confirm-document-changes.description":`This document needs to be updated to be compatible with Canvas. + Existing content may be edited or removed as part of this process.`,"dialog.confirm-document-changes.confirm":"Accept and continue","dialog.confirm-document-changes.cancel":"Cancel","dialog.confirm-document-changes.footer-description":"You can unlink from Canvas at any time","dialog.link-to-canvas.title":"Link to Canvas","dialog.link-to-canvas.validating":"Validating","dialog.link-to-canvas.redirecting":"Taking you to Canvas to complete linking...","dialog.link-to-canvas.error":"Failed to link to Canvas","dialog.unlink-from-canvas.title":"Unlink from Canvas","dialog.unlink-from-canvas.unlinking":"You're unlinking “{{documentTitle}}” from Canvas.","dialog.unlink-from-canvas.cancel":"Cancel","dialog.unlink-from-canvas.unlink-action":"Unlink now","dialog.unlink-from-canvas.description":"Once unlinked, it will be editable here and future edits in Canvas will no longer automatically map to this document.","dialog.unlink-from-canvas.success":"Unlinked from Canvas","dialog.unlink-from-canvas.error":"Failed to unlink from Canvas","navigate-to-canvas-doc.error.missing-permissions":"Missing permissions to navigate to Canvas"});export{i as default}; diff --git a/apps/studio/dist/static/resources5-CGlYLiLn.js b/apps/studio/dist/static/resources5-CGlYLiLn.js new file mode 100644 index 00000000..958f1584 --- /dev/null +++ b/apps/studio/dist/static/resources5-CGlYLiLn.js @@ -0,0 +1 @@ +import{d as e}from"./sanity-BZuh2pfi.js";const n=e("create",{"start-in-create-dialog.cta.learn-more":"Learn more.","studio-create-link-banner.text":"This document is linked to Sanity Create","create-link-info.tooltip":"Learn more","create-link-info-popover.eyebrow-title":"Sanity Create","create-link-info-popover.eyebrow-badge":"Early access","create-link-info-popover.header":"Idea-first authoring","create-link-info-popover.text":"Write naturally in an AI-powered editor. Your content automatically maps to Studio fields as you type.","edit-in-create-button.text":"Edit with Sanity Create","unlink-from-create-button.text":"Unlink","unlink-from-create-dialog.header":"Switch editing to Studio?","unlink-from-create-dialog.first-paragraph":"You’re unlinking “{{title}}” from Sanity Create so it can be edited here.","unlink-from-create-dialog.second-paragraph":"You’ll keep your content in both places. Any new changes in Sanity Create will stop syncing to this Studio.","unlink-from-create-dialog.cancel.text":"Cancel","unlink-from-create-dialog.document.untitled.text":"Untitled","unlink-from-create-dialog.unlink.text":"Unlink now"});export{n as default}; diff --git a/apps/studio/dist/static/resources6-BHmPcXiL.js b/apps/studio/dist/static/resources6-BHmPcXiL.js new file mode 100644 index 00000000..ee8011ea --- /dev/null +++ b/apps/studio/dist/static/resources6-BHmPcXiL.js @@ -0,0 +1 @@ +const e={"action.schedule-publish":"Schedule publish","action.schedule-publish-success":"Document scheduled for publishing","action.schedule-publish-success-description":"Publishing scheduled for {{publishAt}}","action.schedule-publish-error":"Failed to schedule publishing","action.schedule-publish.disabled.validation-issues":"Cannot Schedule Draft due to validation errors in the current draft.","action.schedule-publish.disabled.cardinality-one":"A Scheduled Draft for this document already exists.","empty-state.title":"Scheduled Drafts","empty-state.description":"Schedule and lock draft documents for publishing at a future date and time.","empty-state.action.documentation":"Learn about scheduling"};export{e as default}; diff --git a/apps/studio/dist/static/resources7-DBN73N_m.js b/apps/studio/dist/static/resources7-DBN73N_m.js new file mode 100644 index 00000000..b94dd88f --- /dev/null +++ b/apps/studio/dist/static/resources7-DBN73N_m.js @@ -0,0 +1 @@ +import{d as e}from"./sanity-BZuh2pfi.js";const n=e("structure",{"action.copy-document-url.label":"Copy Document URL","action.delete.disabled.not-ready":"Operation not ready","action.delete.disabled.nothing-to-delete":"This document doesn't yet exist or is already deleted","action.delete.disabled.scheduled-release":"This document cannot be deleted as it exists within scheduled releases","action.delete.label":"Delete","action.delete.running.label":"Deleting…","action.disabled-by-canvas.tooltip":"Some document actions are disabled for documents linked to Canvas","action.discard-changes.confirm-dialog.confirm-discard-changes":"Are you sure you want to discard all changes since last published?","action.discard-changes.confirm-dialog.confirm-discard-changes-draft":"Are you sure you want to discard all changes and delete this draft document?","action.discard-changes.confirm-dialog.header.text":"Discard changes?","action.discard-changes.disabled.no-change":"This document has no unpublished changes","action.discard-changes.disabled.not-published":"This document is not published","action.discard-changes.disabled.not-ready":"Operation not ready","action.discard-changes.label":"Discard changes","action.duplicate.disabled.not-ready":"Operation not ready","action.duplicate.disabled.nothing-to-duplicate":"This document doesn't yet exist so there's nothing to duplicate","action.duplicate.label":"Duplicate","action.duplicate.running.label":"Duplicating…","action.publish.already-published.no-time-ago.tooltip":"Already published","action.publish.already-published.tooltip":"Published {{timeSincePublished}}","action.publish.disabled.not-ready":"Operation not ready","action.publish.draft.label":"Publish","action.publish.label":"Publish","action.publish.live-edit.label":"Publish","action.publish.live-edit.publish-disabled":"Cannot publish since Live Edit is enabled for this document type","action.publish.live-edit.tooltip":"Live Edit is enabled for this content type and publishing happens automatically as you make changes","action.publish.no-changes.tooltip":"No unpublished changes","action.publish.published.label":"Published","action.publish.running.label":"Publishing…","action.publish.validation-in-progress.label":"Validating document…","action.publish.validation-issues-toast.description":"Please fix the validation errors before publishing","action.publish.validation-issues-toast.title":"Validation errors","action.publish.validation-issues.tooltip":"There are validation errors that need to be fixed before this document can be published","action.publish.waiting":"Waiting for tasks to finish before publishing","action.restore.confirm.message":"Are you sure you want to restore this document?","action.restore.disabled.cannot-restore-initial":"You can't restore to the initial revision","action.restore.label":"Revert to revision","action.restore.tooltip":"Restore to this revision","action.unpublish.disabled.not-published":"This document is not published","action.unpublish.disabled.not-ready":"Operation not ready","action.unpublish.label":"Unpublish","action.unpublish.live-edit.disabled":"This document has live edit enabled and cannot be unpublished","banners.archived-release.description":"This document version belongs to the archived {{title}} release","banners.archived-scheduled-draft.description":"This scheduled draft is archived","banners.choose-new-document-destination.cannot-create-draft-document":"Cannot create a draft document.","banners.choose-new-document-destination.cannot-create-published-document":"Cannot create a published document.","banners.choose-new-document-destination.choose-destination":"Choose a destination for this document:","banners.choose-new-document-destination.release-inactive":"The {{title}} release is not active.","banners.deleted-document-banner.restore-button.text":"Restore most recent revision","banners.deleted-document-banner.text":"This document has been deleted.","banners.deprecated-document-type-banner.text":"This document type has been deprecated.","banners.live-edit-draft-banner.discard.tooltip":"Discard draft to continue editing.","banners.live-edit-draft-banner.publish.tooltip":"Publish draft to continue editing.","banners.live-edit-draft-banner.text":"The type {{schemaType}} has liveEdit enabled, but a draft version of this document exists. Publish or discard the draft in order to continue live editing it.","banners.obsolete-draft.actions.compare-draft.text":"Compare draft","banners.obsolete-draft.actions.discard-draft.text":"Discard draft","banners.obsolete-draft.actions.publish-draft.text":"Publish draft","banners.obsolete-draft.draft-model-inactive.text":"The workspace does not have drafts enabled, but a draft version of this document exists.","banners.paused-scheduled-draft.text":"Schedule paused while editing. Press Schedule to reactivate or pick a new date.","banners.permission-check-banner.missing-permission_create_one":"Your role does not have permission to publish this document.","banners.permission-check-banner.missing-permission_create_other":"Your roles do not have permission to publish this document.","banners.permission-check-banner.missing-permission_update_one":"Your role does not have permission to edit this document.","banners.permission-check-banner.missing-permission_update_other":"Your roles do not have permission to edit this document.","banners.permission-check-banner.request-permission-button.sent":"Editor request sent","banners.permission-check-banner.request-permission-button.text":"Ask to edit","banners.published-release.description":"You are viewing a read-only document that was published as part of {{title}}. It can't be edited","banners.reference-changed-banner.reason-changed.reload-button.text":"Reload reference","banners.reference-changed-banner.reason-changed.text":"This reference has changed since you opened it.","banners.reference-changed-banner.reason-removed.close-button.text":"Close reference","banners.reference-changed-banner.reason-removed.text":"This reference has been removed since you opened it.","banners.release.action.add-to-release":"Add to release","banners.release.action.open-to-edit":"Open release to edit","banners.release.error.description":"An error occurred when adding document to the release: {{message}}","banners.release.error.title":"Error adding document to release","banners.release.navigate-to-edit-description":"The document only exists in the","banners.release.navigate-to-edit-description-end_one":"release","banners.release.navigate-to-edit-description-end_other":"releases","banners.release.navigate-to-edit-description-multiple_one":"This document is part of the release and {{count}} more release.","banners.release.navigate-to-edit-description-multiple_other":"This document is part of the release and {{count}} more releases","banners.release.navigate-to-edit-description-none":"This document is not part of any release","banners.release.navigate-to-edit-description-single":"This document is part of the release","banners.release.not-in-release":"Not in the {{title}} release.","banners.release.waiting.description":"Please hold tight while the document is added to the release. It should not take longer than a few seconds.","banners.release.waiting.title":"Adding document to release…","banners.revision-not-found.description":"We couldn't find the document revision selected, please select another entry from the history list.","banners.scheduled-draft-override-banner.text":"A scheduled draft for this document exists. If you publish changes now they will be overwritten when the schedule runs.","banners.unpublished-release-banner.text":"This document will be unpublished as part of the {{title}} release.","banners.unpublished-release-banner.text-with-published":"Showing the current published version:","browser-document-title.new-document":"New {{schemaType}}","browser-document-title.untitled-document":"Untitled","buttons.action-menu-button.aria-label":"Open document actions","buttons.action-menu-button.tooltip":"Document actions","buttons.focus-pane-button.aria-label.collapse":"Exit focus mode (show navigation)","buttons.focus-pane-button.aria-label.focus":"Enter focus mode (hide navigation)","buttons.focus-pane-button.tooltip.collapse":"Exit focus mode","buttons.focus-pane-button.tooltip.focus":"Enter focus mode","buttons.split-pane-button.aria-label":"Split pane right","buttons.split-pane-button.tooltip":"Split pane right","buttons.split-pane-close-button.title":"Close split pane","buttons.split-pane-close-group-button.title":"Close pane group","canvas.banner.edit-in-canvas-action":"Edit in Canvas","canvas.banner.editable.linked-text":"This document can be edited in Canvas.","canvas.banner.editable.popover-description":"Canvas lets you write freely, then update content in Studio without manual field-by-field copying.","canvas.banner.editable.popover-heading":"Free-form writing","canvas.banner.linked-text.draft":"This draft document is linked to Canvas","canvas.banner.linked-text.published":"This live document is linked to Canvas","canvas.banner.linked-text.version":"This version document is linked to Canvas","canvas.banner.popover-button-text":"Learn more","canvas.banner.popover-description":"Canvas lets you author in a free-form editor that automatically maps back to the Studio as structured content - as you type.","canvas.banner.popover-heading":"Idea first authoring","changes.banner.description":"Showing the history for the {{perspective}} version of this document.","changes.banner.tooltip":"This view shows the changes that occurred in a specific version of this document. Select a different version to see its changes","changes.from.label":"From","changes.tab.history":"History","changes.tab.review-changes":"Review changes","changes.to.label":"To","compare-version.error.invalidModeParam":'"{{input}}" is not a supported document comparison mode.',"compare-version.error.invalidNextDocumentParam":"The next document parameter is invalid.","compare-version.error.invalidParams.title":"Unable to compare documents","compare-version.error.invalidPreviousDocumentParam":"The previous document parameter is invalid.","compare-version.error.loadReleases.title":"Failed to load releases","compare-versions.menu-item.disabled-reason":"There are no other versions of this document to compare.","compare-versions.menu-item.title":"Compare versions","compare-versions.status.draft":"Draft","compare-versions.status.published":"Published","compare-versions.title":"Compare versions","confirm-delete-dialog.cancel-button.text":"Cancel","confirm-delete-dialog.cdr-summary.document-count_one":"1 document","confirm-delete-dialog.cdr-summary.document-count_other":"{{count}} documents","confirm-delete-dialog.cdr-summary.subtitle_one":"Dataset: {{datasets}}","confirm-delete-dialog.cdr-summary.subtitle_other":"Datasets: {{datasets}}","confirm-delete-dialog.cdr-summary.subtitle_unavailable_one":"Unavailable dataset","confirm-delete-dialog.cdr-summary.subtitle_unavailable_other":"Unavailable datasets","confirm-delete-dialog.cdr-summary.title_one":"{{documentCount}} in another dataset","confirm-delete-dialog.cdr-summary.title_other":"{{documentCount}} in {{count}} datasets","confirm-delete-dialog.cdr-table.copy-id-button.tooltip":"Copy ID to clipboard","confirm-delete-dialog.cdr-table.dataset.label":"Dataset","confirm-delete-dialog.cdr-table.document-id.label":"Document ID","confirm-delete-dialog.cdr-table.id-copied-toast.title-failed":"Failed to copy document ID","confirm-delete-dialog.cdr-table.project-id.label":"Project ID","confirm-delete-dialog.confirm-anyway-button.text_delete":"Delete all versions anyway","confirm-delete-dialog.confirm-anyway-button.text_unpublish":"Unpublish anyway","confirm-delete-dialog.confirm-button.text_delete":"Delete all versions","confirm-delete-dialog.confirm-button.text_unpublish":"Unpublish now","confirm-delete-dialog.confirmation.text_delete":"Are you sure you want to delete all the versions of this document?","confirm-delete-dialog.confirmation.text_unpublish":"Are you sure you want to unpublish “”?","confirm-delete-dialog.error.message.text":"An error occurred while loading referencing documents.","confirm-delete-dialog.error.retry-button.text":"Retry","confirm-delete-dialog.error.title.text":"Error","confirm-delete-dialog.header.text_delete":"Delete document?","confirm-delete-dialog.header.text_unpublish":"Unpublish document?","confirm-delete-dialog.loading.text":"Looking for referring documents…","confirm-delete-dialog.other-reference-count.title_one":"1 other reference not show","confirm-delete-dialog.other-reference-count.title_other":"{{count}} other references not shown","confirm-delete-dialog.other-reference-count.tooltip":"We can't display metadata for these references due to a missing access token for the related datasets.","confirm-delete-dialog.preview-item.preview-unavailable.subtitle":"ID: {{documentId}}","confirm-delete-dialog.preview-item.preview-unavailable.title":"Preview unavailable","confirm-delete-dialog.referential-integrity-disclaimer.text_delete":"If you delete this document, documents that refer to it will no longer be able to access it.","confirm-delete-dialog.referential-integrity-disclaimer.text_unpublish":"If you unpublish this document, documents that refer to it will no longer be able to access it.","confirm-delete-dialog.referring-document-count.text_one":"1 document refers to “”","confirm-delete-dialog.referring-document-count.text_other":"{{count}} documents refer to “”","confirm-delete-dialog.referring-documents-descriptor.text_delete":"You may not be able to delete “” because the following documents refer to it:","confirm-delete-dialog.referring-documents-descriptor.text_unpublish":"You may not be able to unpublish “” because the following documents refer to it:","confirm-dialog.cancel-button.fallback-text":"Cancel","confirm-dialog.confirm-button.fallback-text":"Confirm","default-definition.content-title":"Content","doc-title.error.text":"Error: {{errorMessage}}","doc-title.fallback.text":"Untitled","doc-title.unknown-schema-type.text":"Unknown schema type: {{schemaType}}","document-inspector.close-button.tooltip":"Close","document-inspector.dialog.title":"Inspecting ","document-inspector.dialog.title-no-value":"No value","document-inspector.menu-item.title":"Inspect","document-inspector.search.placeholder":"Search","document-inspector.view-mode.parsed":"Parsed","document-inspector.view-mode.raw-json":"Raw JSON","document-view.form-view.form-hidden":"This form is hidden","document-view.form-view.form-title-fallback":"Untitled","document-view.form-view.loading":"Loading document…","document-view.form-view.sync-lock-toast.description":"Please hold tight while the document is synced. This usually happens right after the document has been published, and it should not take more than a few seconds","document-view.form-view.sync-lock-toast.title":"Syncing document…","document.favorites.add-to-favorites":"Add to favorites","document.favorites.remove-from-favorites":"Remove from favorites","events.compare-with-published.description":"We're unable to load the changes for this document, probably due to history retention policy of your plan, this shows you how the {{version}} version compares to the published version.","events.compare-with-published.title":"Comparing with published","events.inspect.release":"Inspect {{releaseTitle}} document","events.open.draft":"Open draft document","events.open.release":"Open {{releaseTitle}} release","incoming-references-input.add-reference-item":"Add item","incoming-references-input.list-label":"Incoming references of type {{type}}","incoming-references-input.no-items":"No items","incoming-references-input.reference-from":"Reference from {{type}}","incoming-references-input.schema-type-not-found":"Schema type {{type}} not found","incoming-references-input.type-to-search":"Type to search","incoming-references-input.types-loading":"Loading documents...","incoming-references-input.types-loading-cross-dataset":"Loading cross dataset documents...","incoming-references-input.types-not-defined":"No incoming references defined for this type, see the docs for more information.","incoming-references-pane.no-references-found":"No references of this type found.","incoming-references-pane.schema-type-not-found":"Schema type {{type}} not found","insufficient-permissions-message-tooltip.loading-text":"Loading…","menu-item-groups.actions-group":"Actions","menu-item-groups.layout-group":"Layout","menu-item-groups.sorting-group":"Sort","menu-items.layout.compact-view":"Compact view","menu-items.layout.detailed-view":"Detailed view","menu-items.sort-by.created":"Sort by Created","menu-items.sort-by.last-edited":"Sort by Last Edited","no-document-types-screen.link-text":"Learn how to add a document type →","no-document-types-screen.subtitle":"Please define at least one document type in your schema.","no-document-types-screen.title":"No document types","pane-header.back-button.text":"Back","pane-header.context-menu-button.tooltip":"Show menu","pane-header.create-menu.label":"Create","pane-header.create-new-button.tooltip":"Create new document","pane-header.disabled-created-button.aria-label":"Insufficient permissions","pane-item.draft-status.has-draft.tooltip":"Edited ","pane-item.draft-status.no-draft.tooltip":"No unpublished edits","pane-item.missing-schema-type.subtitle":"Document: {{documentId}}","pane-item.missing-schema-type.title":"No schema found for type {{documentType}}","pane-item.published-status.has-published.tooltip":"Published ","pane-item.published-status.no-published.tooltip":"No unpublished edits","panes.document-header-title.error.text":"Error: {{error}}","panes.document-header-title.new.text":"New {{schemaType}}","panes.document-header-title.untitled.text":"Untitled","panes.document-list-pane.error.max-retries-attempted":"Not automatically retrying after {{count}} unsuccessful attempts.","panes.document-list-pane.error.retrying":"Retrying…","panes.document-list-pane.error.text":"Encountered an error while fetching documents.","panes.document-list-pane.error.text.dev":"Error: {{error}}","panes.document-list-pane.error.text.offline":"The Internet connection appears to be offline.","panes.document-list-pane.error.title":"Could not fetch list items","panes.document-list-pane.error.will-retry-automatically_one":"Retrying…","panes.document-list-pane.error.will-retry-automatically_other":"Retrying… (#{{count}}).","panes.document-list-pane.max-items.text":"Displaying a maximum of {{limit}} documents","panes.document-list-pane.no-documents-of-type.text":"No documents of this type","panes.document-list-pane.no-documents.text":"No results found","panes.document-list-pane.no-matching-documents.text":"No matching documents","panes.document-list-pane.reconnecting":"Trying to connect…","panes.document-list-pane.search-input.aria-label":"Search list","panes.document-list-pane.search-input.placeholder":"Search list","panes.document-operation-results.error.summary.title":"Details","panes.document-operation-results.operation-error":"An error occurred during {{context}}","panes.document-operation-results.operation-error_delete":"An error occurred while attempting to delete this document. This usually means that there are other documents that refers to it.","panes.document-operation-results.operation-error_unpublish":"An error occurred while attempting to unpublish this document. This usually means that there are other documents that refers to it.","panes.document-operation-results.operation-success":"Successfully performed {{op}} on document","panes.document-operation-results.operation-success_copy-url":"Document URL copied to clipboard","panes.document-operation-results.operation-success_createVersion":"{{title}} was added to the release","panes.document-operation-results.operation-success_delete":"The document was successfully deleted","panes.document-operation-results.operation-success_discardChanges":"All changes has now been discarded. The discarded draft can still be recovered from history","panes.document-operation-results.operation-success_duplicate":"The document was successfully duplicated","panes.document-operation-results.operation-success_publish":"{{title}} was published","panes.document-operation-results.operation-success_restore":"{{title}} was restored","panes.document-operation-results.operation-success_unpublish":"{{title}} was unpublished. A draft has been created from the latest published revision.","panes.document-operation-results.operation-undefined-title":"Untitled","panes.document-pane.document-not-found.loading":"Loading document…","panes.document-pane.document-not-found.text":"The document type is not defined, and a document with the {{id}} identifier could not be found.","panes.document-pane.document-not-found.title":"The document was not found","panes.document-pane.document-unknown-type.text":"This document has the schema type {{documentType}}, which is not defined as a type in the local content studio schema.","panes.document-pane.document-unknown-type.title":"Unknown document type: {{documentType}}","panes.document-pane.document-unknown-type.without-schema.text":"This document does not exist, and no schema type was specified for it.","panes.resolving.default-message":"Loading…","panes.resolving.slow-resolve-message":"Still loading…","panes.unknown-pane-type.missing-type.text":"Structure item is missing required type property.","panes.unknown-pane-type.title":"Unknown pane type","panes.unknown-pane-type.unknown-type.text":"Structure item of type {{type}} is not a known entity.","production-preview.menu-item.title":"Open preview","request-permission-dialog.confirm-button.text":"Send request","request-permission-dialog.description.text":"Your request will be sent to the project administrator(s). If you'd like, you can also include a note","request-permission-dialog.header.text":"Ask for edit access","request-permission-dialog.note-input.description.text":"If you'd like, you can add a note","request-permission-dialog.note-input.placeholder.text":"Add note...","request-permission-dialog.warning.denied.text":"Your request to access this project has been declined.","request-permission-dialog.warning.limit-reached.text":"You've reached the limit for role requests across all projects. Please wait before submitting more requests or contact an administrator for assistance.","status-bar.document-status-pulse.status.saved.text":"Saved","status-bar.document-status-pulse.status.syncing.text":"Saving...","status-bar.publish-status-button.last-published-time.aria-label":"Last published {{relativeTime}}","status-bar.publish-status-button.last-published-time.tooltip":"Last published ","status-bar.publish-status-button.last-updated-time.aria-label":"Last updated {{relativeTime}}","status-bar.publish-status-button.last-updated-time.tooltip":"Last updated ","status-bar.review-changes-button.aria-label":"Review changes","status-bar.review-changes-button.status.saved.text":"Saved!","status-bar.review-changes-button.status.syncing.text":"Saving...","status-bar.review-changes-button.tooltip.changes-saved":"Changes saved","status-bar.review-changes-button.tooltip.text":"Review changes","structure-error.docs-link.text":"View documentation","structure-error.error.label":"Error","structure-error.header.text":"Encountered an error while reading structure","structure-error.reload-button.text":"Reload","structure-error.structure-path.label":"Structure path","timeline-item.menu-button.aria-label":"Open action menu","timeline-item.menu-button.tooltip":"Actions","timeline-item.menu.action-collapse":"Collapse","timeline-item.menu.action-expand":"Expand","timeline-item.not-found-release.tooltip":'Release with id "{{releaseId}}" not found',"toggle-inline-changes.menu-item.title":"Inline changes"});export{n as default}; diff --git a/apps/studio/dist/static/resources8-BYBeJXDT.js b/apps/studio/dist/static/resources8-BYBeJXDT.js new file mode 100644 index 00000000..dc961bc8 --- /dev/null +++ b/apps/studio/dist/static/resources8-BYBeJXDT.js @@ -0,0 +1 @@ +var e={"document-list-pane.document-list.title":"Documents on this page","document-list-pane.error.text":"Could not render the document list","channel.status_connected":"Connected","channel.status_connecting":"Connecting","channel.status_disconnected":"Disconnected","channel.status_reconnecting":"Reconnecting","document-pane.error.text":"Could not render the document editor","error-card.continue-button.text":"Continue anyway","error-card.retry-button.text":"Retry","error-card.title":"An error occurred","locations-banner.locations-count_one":"Used on one page","locations-banner.locations-count_other":"Used on {{count}} pages","locations-banner.locations-count_zero":"Not used on any pages","locations-banner.resolving.text":"Resolving locations...","main-document.label":"Main document","main-document.missing.text":"Missing a main document for {{path}}","presentation-error.label":"Error message","preview-frame.connection.error.text":"Could not connect to the preview","preview-frame.configuration.error.title":"Preview URL origin mismatch","preview-frame.configuration.error.description":"The preview iframe is configured to load {{targetOrigin}}, but the reported origin is {{reportedOrigin}}. Presentation Tool is unable to connect to unknown origins for security purposes. Update your presentationTool.allowOrigins configuration to allow connecting to Visual Editing and Loaders.","preview-search-param.configuration.error.title":"Blocked preview URL","preview-search-param.configuration.error.description":"The router wants to navigate to {{previewSearchParam}}, but the origin {{blockedOrigin}} is not allowed. Update your presentationTool.allowOrigins configuration to allow it.","preview-frame.continue-button.text":"Continue anyway","preview-frame.loader.connection-status.label":"Loader connection status","preview-frame.navigator.toggle-button.aria-label":"Toggle navigator","preview-frame.navigator.toggle-button.tooltip":"Toggle navigator","preview-frame.overlay.connection-status.label":"Overlay connection status","preview-frame.overlay.toggle-button.text":"Edit","preview-frame.overlay.toggle-button.tooltip_disable":"Disable edit overlay","preview-frame.overlay.toggle-button.tooltip_enable":"Enable edit overlay","preview-frame.perspective.published.text":"View this page with published content","preview-frame.refresh-button.aria-label":"Refresh preview","preview-frame.refresh-button.tooltip":"Refresh preview","preview-frame.status_connecting":"Connecting.","preview-frame.status_loading":"Loading.","preview-frame.status_refreshing":"Refreshing.","preview-frame.status_reloading":"Refreshing.","preview-frame.status_timeout":"Unable to connect, check the browser console for more information.","preview-frame.viewport-button.aria-label":"Toggle viewport size","preview-frame.viewport-button.tooltip_full":"Switch to full viewport","preview-frame.viewport-button.tooltip_narrow":"Switch to narrow viewport","preview-location-input.error_missing-origin":"URL must start with {{origin}}","preview-location-input.error_same-base-path":"URL can’t have the same base path as the Studio {{basePath}}","share-url.clipboard.status_copying":"Copying URL to clipboard…","share-url.clipboard.status_failed":"Copy failed","share-url.clipboard.status_success":"The URL is copied to the clipboard","share-url.clipboard.status_unsupported":"Clipboard not supported","share-url.menu-item.open.text":"Open preview","preview-url-secret.missing-grants":"You don't have permission to create URL Preview Secrets. This will likely cause the preview to fail loading.","preview-frame.share-button.aria-label":"Share this preview","share-preview-menu.qr-code.title":"A QR Code which encodes the URL: {{url}}","share-preview-menu.error_toggle-sharing":"You don't have permission to toggle sharing of this preview","share-preview-menu.toggle-button.tooltip_disable":"Disable sharing","share-preview-menu.toggle-button.tooltip_enable":"Enable sharing","share-preview-menu.toggle-button.label_first-line":"Share this preview","share-preview-menu.toggle-button.label_second-line":"with anyone who has the link","share-preview-menu.qr-code.placeholder":"QR code will appear here","share-preview-menu.qr-code.instructions":"Scan the QR Code to open the preview on your phone.","share-preview-menu.copy-url.text":"Copy preview link","share-preview-menu.error_missing-grants":"You don't have permission to share previews. "};export{e as default}; diff --git a/apps/studio/dist/static/ruby-B2Rjki9n.js b/apps/studio/dist/static/ruby-B2Rjki9n.js new file mode 100644 index 00000000..a95f3577 --- /dev/null +++ b/apps/studio/dist/static/ruby-B2Rjki9n.js @@ -0,0 +1 @@ +function k(e){for(var i={},n=0,o=e.length;n]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator";if(n=="@"&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"propertyName";if(n=="$")return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variableName.special";if(/[a-zA-Z_\xa1-\uffff]/.test(n))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"variable";if(n=="|"&&(i.varList||i.lastTok=="{"||i.lastTok=="do"))return f="|",null;if(/[\(\)\[\]{}\\;]/.test(n))return f=n,null;if(n=="-"&&e.eat(">"))return"operator";if(/[=+\-\/*:\.^%<>~|]/.test(n)){var t=e.eatWhile(/[=+\-\/*:\.^%<>~|]/);return n=="."&&!t&&(f="."),"operator"}else return null}}}function g(e){for(var i=e.pos,n=0,o,l=!1,r=!1;(o=e.next())!=null;)if(r)r=!1;else{if("[{(".indexOf(o)>-1)n++;else if("]})".indexOf(o)>-1){if(n--,n<0)break}else if(o=="/"&&n==0){l=!0;break}r=o=="\\"}return e.backUp(e.pos-i),l}function a(e){return e||(e=1),function(i,n){if(i.peek()=="}"){if(e==1)return n.tokenize.pop(),n.tokenize[n.tokenize.length-1](i,n);n.tokenize[n.tokenize.length-1]=a(e-1)}else i.peek()=="{"&&(n.tokenize[n.tokenize.length-1]=a(e+1));return p(i,n)}}function y(){var e=!1;return function(i,n){return e?(n.tokenize.pop(),n.tokenize[n.tokenize.length-1](i,n)):(e=!0,p(i,n))}}function d(e,i,n,o){return function(l,r){var u=!1,t;for(r.context.type==="read-quoted-paused"&&(r.context=r.context.prev,l.eat("}"));(t=l.next())!=null;){if(t==e&&(o||!u)){r.tokenize.pop();break}if(n&&t=="#"&&!u){if(l.eat("{")){e=="}"&&(r.context={prev:r.context,type:"read-quoted-paused"}),r.tokenize.push(a());break}else if(/[@\$]/.test(l.peek())){r.tokenize.push(y());break}}u=!u&&t=="\\"}return i}}function s(e,i){return function(n,o){return i&&n.eatSpace(),n.match(e)?o.tokenize.pop():n.skipToEnd(),"string"}}function w(e,i){return e.sol()&&e.match("=end")&&e.eol()&&i.tokenize.pop(),e.skipToEnd(),"comment"}const E={name:"ruby",startState:function(e){return{tokenize:[p],indented:0,context:{type:"top",indented:-e},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,i){f=null,e.sol()&&(i.indented=e.indentation());var n=i.tokenize[i.tokenize.length-1](e,i),o,l=f;if(n=="variable"){var r=e.current();n=i.lastTok=="."?"property":x.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(r)?"tag":i.lastTok=="def"||i.lastTok=="class"||i.varList?"def":"variable",n=="keyword"&&(l=r,z.propertyIsEnumerable(r)?o="indent":b.propertyIsEnumerable(r)?o="dedent":((r=="if"||r=="unless")&&e.column()==e.indentation()||r=="do"&&i.context.indentedi.map(i=>d[i]); +function Jgt(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}const e3t="modulepreload",t3t=function(t){return"/"+t},d7e={},wc=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let l=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=s?.nonce||s?.getAttribute("nonce");i=l(n.map(c=>{if(c=t3t(c),c in d7e)return;d7e[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":e3t,u||(h.as="script"),h.crossOrigin="",h.href=c,a&&h.setAttribute("nonce",a),document.head.appendChild(h),u)return new Promise((p,m)=>{h.addEventListener("load",p),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return i.then(s=>{for(const a of s||[])a.status==="rejected"&&o(a.reason);return e().catch(o)})};var Ob=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n3t(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function r(){var i=!1;try{i=this instanceof r}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var lG={exports:{}},IE={};var f7e;function r3t(){if(f7e)return IE;f7e=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,o){var s=null;if(o!==void 0&&(s=""+o),i.key!==void 0&&(s=""+i.key),"key"in i){o={};for(var a in i)a!=="key"&&(o[a]=i[a])}else o=i;return i=o.ref,{$$typeof:t,type:r,key:s,ref:i!==void 0?i:null,props:o}}return IE.Fragment=e,IE.jsx=n,IE.jsxs=n,IE}var h7e;function i3t(){return h7e||(h7e=1,lG.exports=r3t()),lG.exports}var d=i3t(),cG={exports:{}},eo={};var p7e;function o3t(){if(p7e)return eo;p7e=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),s=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),h=Symbol.iterator;function p(V){return V===null||typeof V!="object"?null:(V=h&&V[h]||V["@@iterator"],typeof V=="function"?V:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,y={};function b(V,G,z){this.props=V,this.context=G,this.refs=y,this.updater=z||m}b.prototype.isReactComponent={},b.prototype.setState=function(V,G){if(typeof V!="object"&&typeof V!="function"&&V!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,V,G,"setState")},b.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function v(){}v.prototype=b.prototype;function x(V,G,z){this.props=V,this.context=G,this.refs=y,this.updater=z||m}var C=x.prototype=new v;C.constructor=x,g(C,b.prototype),C.isPureReactComponent=!0;var w=Array.isArray;function _(){}var S={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function I(V,G,z){var Y=z.ref;return{$$typeof:t,type:V,key:G,ref:Y!==void 0?Y:null,props:z}}function j(V,G){return I(V.type,G,V.props)}function A(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function D(V){var G={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(z){return G[z]})}var O=/\/+/g;function P(V,G){return typeof V=="object"&&V!==null&&V.key!=null?D(""+V.key):G.toString(36)}function $(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(_,_):(V.status="pending",V.then(function(G){V.status==="pending"&&(V.status="fulfilled",V.value=G)},function(G){V.status==="pending"&&(V.status="rejected",V.reason=G)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function M(V,G,z,Y,Z){var ee=typeof V;(ee==="undefined"||ee==="boolean")&&(V=null);var K=!1;if(V===null)K=!0;else switch(ee){case"bigint":case"string":case"number":K=!0;break;case"object":switch(V.$$typeof){case t:case e:K=!0;break;case u:return K=V._init,M(K(V._payload),G,z,Y,Z)}}if(K)return Z=Z(V),K=Y===""?"."+P(V,0):Y,w(Z)?(z="",K!=null&&(z=K.replace(O,"$&/")+"/"),M(Z,G,z,"",function(te){return te})):Z!=null&&(A(Z)&&(Z=j(Z,z+(Z.key==null||V&&V.key===Z.key?"":(""+Z.key).replace(O,"$&/")+"/")+K)),G.push(Z)),1;K=0;var q=Y===""?".":Y+":";if(w(V))for(var re=0;reSM(e))&&("markDefs"in t?Array.isArray(t.markDefs)&&t.markDefs.every(e=>SM(e)):!0)&&("style"in t?typeof t.style=="string":!0)}function Rf(t){return SM(t)&&t._type==="span"&&typeof t.text=="string"&&("marks"in t?Array.isArray(t.marks)&&t.marks.every(e=>typeof e=="string"):!0)}function g1(t){return!!t&&(typeof t=="object"||typeof t=="function")}function Bce(t){if(!lc(t))return!1;let e=t;for(;e;){if(e.name==="document")return!0;e=e.type}return!1}function lc(t){return g1(t)?t.jsonType==="object":!1}function _d(t){return g1(t)?t.jsonType==="array":!1}function iw(t){return _d(t)&&t.of.some(e=>Hce(e))}function ov(t){return _d(t)&&t.of.every(e=>lc(e))}function kV(t){return _d(t)&&t.of.every(e=>TV(e))}function qA(t){return g1(t)?t.jsonType==="boolean":!1}function EV(t){return g1(t)?t.jsonType==="string":!1}function x7e(t){return EV(t)?t.name==="datetime":!1}function u8(t){return g1(t)?t.jsonType==="number":!1}function TV(t){return qA(t)||EV(t)||u8(t)}function a0(t){return g1(t)&&(t.name==="reference"||a0(t.type))}function Wb(t){return g1(t)&&(t.name==="image"||Wb(t.type))}function dj(t){return g1(t)&&(t.name==="file"||dj(t.type))}function JBe(t){return g1(t)?typeof t.deprecated<"u":!1}function Vce(t){return g1(t)&&(t.name==="crossDatasetReference"||Vce(t.type))}function zce(t){return typeof t=="object"&&t!==null&&"title"in t&&"value"in t}function eVe(t){return g1(t)?Array.isArray(t.annotations)&&Array.isArray(t.decorators):!1}function Hce(t){if(!g1(t)||!Array.isArray(t.fields))return!1;const e=t.fields.find(_7e),n=t.fields.find(C7e),r=t.fields.find(w7e);return _7e(e)&&C7e(n)&&w7e(r)}function C7e(t){return!g1(t)||t.name!=="style"?!1:g1(t.type)&&t.type.jsonType==="string"}function w7e(t){return!g1(t)||t.name!=="listItem"?!1:g1(t.type)&&t.type.jsonType==="string"}function _7e(t){return!g1(t)||t.name!=="children"||!_d(t.type)?!1:t.type.of.some(eVe)}function Pi(t,e){return t}function Xe(t,e){return t}function rl(t,e){return t}const tVe=["groqLegacy","groq2024"];function uyt(t){return tVe.includes(t)}function dyt(t){return F8(t)&&typeof t.current=="string"}function fyt(t){return t.level==="error"}function hyt(t){return t.level==="warning"}const pyt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,myt=/_key\s*==\s*['"](.*)['"]/,nVe=[],gyt="$",yyt=["true","false","null"];function N8(t,e,n){const r=typeof e=="string"?Lh(e):e;if(!Array.isArray(r))throw new Error("Path must be an array or a string");let i=t;for(let o=0;oa._key===s._key)}if(typeof s=="string"&&(i=typeof i=="object"&&i!==null?i[s]:void 0),typeof i>"u")return n}return i}const fG=new Map;function Rp(t){if(t.length===0)return nVe;const e=Go(t);return fG.has(e)?fG.get(e):(fG.set(e,t),Object.freeze(t),t)}function il(t,e){return t.length===e.length&&t.every((n,r)=>IV(n,e[r]))}function byt(t,e){const n=Math.min(t.length,e.length);for(let r=0;rIV(n,e[r]))}function dI(t,e){if(t.length===0||e.length===0)return e;const[n,...r]=t,[i,...o]=e;return IV(n,i)?Rp(dI(r,o)):e}function hG(t,e){return Bi(t,e)?dI(t,e):nVe}function Go(t){if(!Array.isArray(t))throw new Error("Path is not an array");return t.reduce((e,n,r)=>{const i=r===0;if(typeof n=="number")return`${e}[${n}]`;if(typeof n=="string")return i?n:yyt.includes(n)?`${e}["${n}"]`:`${e}.${n}`;if(Qr(n)&&n._key)return`${e}[_key=="${n._key}"]`;if(Array.isArray(n)){const[o,s]=n;return`${e}[${o}:${s}]`}throw new Error(`Unsupported path segment \`${JSON.stringify(n)}\``)},"")}function Gre(t,e){if(e.length===0)return e;const[n,...r]=e;if(typeof n=="number"){if(!Array.isArray(t)||!(n in t))return[];const o=t[n];return[typeof o?._key=="string"?{_key:o._key}:n,...Gre(o,r)]}const i=N8(t,[n]);return[n,...Gre(i,r)]}function vyt(t,e){if(!Array.isArray(e))throw new Error("Path is not an array");return Rp(Gre(t,e))}function Lh(t){if(typeof t!="string")throw new Error("Path is not a string");const e=t.match(pyt);if(!e)throw new Error("Invalid path string");return e.map(xyt)}function xyt(t){return d1(t)?Cyt(t):Qr(t)?wyt(t):T7(t)?_yt(t):t}function Cyt(t){return Number(t.replace(/[^\d]/g,""))}function wyt(t){return{_key:t.match(myt)[1]}}function _yt(t){const[e,n]=t.split(":").map(r=>r===""?r:Number(r));return[e,n]}var pG,S7e;function Syt(){if(S7e)return pG;S7e=1;var t=typeof Element<"u",e=typeof Map=="function",n=typeof Set=="function",r=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function i(o,s){if(o===s)return!0;if(o&&s&&typeof o=="object"&&typeof s=="object"){if(o.constructor!==s.constructor)return!1;var a,l,c;if(Array.isArray(o)){if(a=o.length,a!=s.length)return!1;for(l=a;l--!==0;)if(!i(o[l],s[l]))return!1;return!0}var u;if(e&&o instanceof Map&&s instanceof Map){if(o.size!==s.size)return!1;for(u=o.entries();!(l=u.next()).done;)if(!s.has(l.value[0]))return!1;for(u=o.entries();!(l=u.next()).done;)if(!i(l.value[1],s.get(l.value[0])))return!1;return!0}if(n&&o instanceof Set&&s instanceof Set){if(o.size!==s.size)return!1;for(u=o.entries();!(l=u.next()).done;)if(!s.has(l.value[0]))return!1;return!0}if(r&&ArrayBuffer.isView(o)&&ArrayBuffer.isView(s)){if(a=o.length,a!=s.length)return!1;for(l=a;l--!==0;)if(o[l]!==s[l])return!1;return!0}if(o.constructor===RegExp)return o.source===s.source&&o.flags===s.flags;if(o.valueOf!==Object.prototype.valueOf&&typeof o.valueOf=="function"&&typeof s.valueOf=="function")return o.valueOf()===s.valueOf();if(o.toString!==Object.prototype.toString&&typeof o.toString=="function"&&typeof s.toString=="function")return o.toString()===s.toString();if(c=Object.keys(o),a=c.length,a!==Object.keys(s).length)return!1;for(l=a;l--!==0;)if(!Object.prototype.hasOwnProperty.call(s,c[l]))return!1;if(t&&o instanceof Element)return!1;for(l=a;l--!==0;)if(!((c[l]==="_owner"||c[l]==="__v"||c[l]==="__o")&&o.$$typeof)&&!i(o[c[l]],s[c[l]]))return!1;return!0}return o!==o&&s!==s}return pG=function(s,a){try{return i(s,a)}catch(l){if((l.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw l}},pG}var kyt=Syt();const B8=rs(kyt);var Eyt="5.12.0";let bF;try{bF=void 0}catch{}try{bF=bF||"5.12.0"}catch{}const tu=bF||`${Eyt}-dev`,k7e="https://www.sanity.io/help/missing-context-error";function wn(t,e){const n=Symbol.for(t);if(typeof document>"u"||typeof window<"u"&&typeof window.navigator<"u"&&window.navigator.userAgent.includes("jsdom")){const r=E.createContext(e);return r.displayName=t,r}if(!jE[n])jE[n]={context:E.createContext(e),version:tu};else{if(jE[n].version!==tu)throw new TypeError(`Duplicate instances of context "${t}" with incompatible versions detected: Expected ${tu} but got ${jE[n].version}. + +For more information, please visit ${k7e}`);E7e.has(tu)||(console.warn(`Duplicate instances of context "${t}" detected. This is likely a mistake and may cause unexpected behavior. + +For more information, please visit ${k7e}`),E7e.add(tu))}return jE[n].context}const E7e=new Set;function Tyt(){if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global;throw new Error("sanity: could not locate global scope")}const jE=Tyt();var Yre=function(t,e){return Yre=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},Yre(t,e)};function Bf(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Yre(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var hd=function(){return hd=Object.assign||function(e){for(var n,r=1,i=arguments.length;r0&&o[o.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ef(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function Iyt(){for(var t=[],e=0;e1||l(p,g)})},m&&(i[p]=m(i[p])))}function l(p,m){try{c(r[p](m))}catch(g){h(o[0][3],g)}}function c(p){p.value instanceof ow?Promise.resolve(p.value.v).then(u,f):h(o[0][2],p)}function u(p){l("next",p)}function f(p){l("throw",p)}function h(p,m){p(m),o.shift(),o.length&&l(o[0][0],o[0][1])}}function Ayt(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof l0=="function"?l0(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(s){return new Promise(function(a,l){s=t[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}}function ts(t){return typeof t=="function"}function jV(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var mG=jV(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription: +`+n.map(function(r,i){return i+1+") "+r.toString()}).join(` + `):"",this.name="UnsubscriptionError",this.errors=n}});function Vw(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var d8=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=l0(s),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(g){e={error:g}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}else s.remove(this);var u=this.initialTeardown;if(ts(u))try{u()}catch(g){o=g instanceof mG?g.errors:[g]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var h=l0(f),p=h.next();!p.done;p=h.next()){var m=p.value;try{T7e(m)}catch(g){o=o??[],g instanceof mG?o=Gu(Gu([],ef(o)),ef(g.errors)):o.push(g)}}}catch(g){r={error:g}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}if(o)throw new mG(o)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)T7e(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&Vw(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Vw(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})(),rVe=d8.EMPTY;function iVe(t){return t instanceof d8||t&&"closed"in t&&ts(t.remove)&&ts(t.add)&&ts(t.unsubscribe)}function T7e(t){ts(t)?t():t.unsubscribe()}var Ryt={Promise:void 0},Dyt={setTimeout:function(t,e){for(var n=[],r=2;r0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,i=this,o=i.hasError,s=i.isStopped,a=i.observers;return o||s?rVe:(this.currentObservers=null,a.push(n),new d8(function(){r.currentObservers=null,Vw(a,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,o=r.thrownError,s=r.isStopped;i?n.error(o):s&&n.complete()},e.prototype.asObservable=function(){var n=new mi;return n.source=this,n},e.create=function(n,r){return new j7e(n,r)},e})(mi),j7e=(function(t){Bf(e,t);function e(n,r){var i=t.call(this)||this;return i.destination=n,i.source=r,i}return e.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},e.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:rVe},e})(qs),jh=(function(t){Bf(e,t);function e(n){var r=t.call(this)||this;return r._value=n,r}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(n){var r=t.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},e.prototype.getValue=function(){var n=this,r=n.hasError,i=n.thrownError,o=n._value;if(r)throw i;return this._throwIfClosed(),o},e.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},e})(qs),qce={now:function(){return(qce.delegate||Date).now()},delegate:void 0},AV=(function(t){Bf(e,t);function e(n,r,i){n===void 0&&(n=1/0),r===void 0&&(r=1/0),i===void 0&&(i=qce);var o=t.call(this)||this;return o._bufferSize=n,o._windowTime=r,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,n),o._windowTime=Math.max(1,r),o}return e.prototype.next=function(n){var r=this,i=r.isStopped,o=r._buffer,s=r._infiniteTimeWindow,a=r._timestampProvider,l=r._windowTime;i||(o.push(n),!s&&o.push(a.now()+l)),this._trimBuffer(),t.prototype.next.call(this,n)},e.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),i=this,o=i._infiniteTimeWindow,s=i._buffer,a=s.slice(),l=0;l0?t.prototype.requestAsyncId.call(this,n,r,i):(n.actions.push(this),n._scheduled||(n._scheduled=D7e.setImmediate(n.flush.bind(n,void 0))))},e.prototype.recycleAsyncId=function(n,r,i){var o;if(i===void 0&&(i=0),i!=null?i>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,n,r,i);var s=n.actions;r!=null&&((o=s[s.length-1])===null||o===void 0?void 0:o.id)!==r&&(D7e.clearImmediate(r),n._scheduled===r&&(n._scheduled=void 0))},e})(Gce),O7e=(function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(r,n)},t.now=qce.now,t})(),Yce=(function(t){Bf(e,t);function e(n,r){r===void 0&&(r=O7e.now);var i=t.call(this,n,r)||this;return i.actions=[],i._active=!1,i}return e.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var i;this._active=!0;do if(i=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,i){for(;n=r.shift();)n.unsubscribe();throw i}},e})(O7e),Wyt=(function(t){Bf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.flush=function(n){this._active=!0;var r=this._scheduled;this._scheduled=void 0;var i=this.actions,o;n=n||i.shift();do if(o=n.execute(n.state,n.delay))break;while((n=i[0])&&n.id===r&&i.shift());if(this._active=!1,o){for(;(n=i[0])&&n.id===r&&i.shift();)n.unsubscribe();throw o}},e})(Yce),uVe=new Wyt(Uyt),Xh=new Yce(Gce),qyt=Xh,Gyt=(function(t){Bf(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.scheduler=n,i.work=r,i}return e.prototype.schedule=function(n,r){return r===void 0&&(r=0),r>0?t.prototype.schedule.call(this,n,r):(this.delay=r,this.state=n,this.scheduler.flush(this),this)},e.prototype.execute=function(n,r){return r>0||this.closed?t.prototype.execute.call(this,n,r):this._execute(n,r)},e.prototype.requestAsyncId=function(n,r,i){return i===void 0&&(i=0),i!=null&&i>0||i==null&&this.delay>0?t.prototype.requestAsyncId.call(this,n,r,i):(n.flush(this),0)},e})(Gce),Yyt=(function(t){Bf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(Yce),P7e=new Yyt(Gyt),Xr=new mi(function(t){return t.complete()});function Kyt(t){return t?Xyt(t):Xr}function Xyt(t){return new mi(function(e){return t.schedule(function(){return e.complete()})})}function dVe(t){return t&&ts(t.schedule)}function Kce(t){return t[t.length-1]}function RV(t){return ts(Kce(t))?t.pop():void 0}function av(t){return dVe(Kce(t))?t.pop():void 0}function Zyt(t,e){return typeof Kce(t)=="number"?t.pop():e}var Xce=(function(t){return t&&typeof t.length=="number"&&typeof t!="function"});function fVe(t){return ts(t?.then)}function hVe(t){return ts(t[Wce])}function pVe(t){return Symbol.asyncIterator&&ts(t?.[Symbol.asyncIterator])}function mVe(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Qyt(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var gVe=Qyt();function yVe(t){return ts(t?.[gVe])}function bVe(t){return jyt(this,arguments,function(){var n,r,i,o;return V8(this,function(s){switch(s.label){case 0:n=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,ow(n.read())];case 3:return r=s.sent(),i=r.value,o=r.done,o?[4,ow(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,ow(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function vVe(t){return ts(t?.getReader)}function Qs(t){if(t instanceof mi)return t;if(t!=null){if(hVe(t))return Jyt(t);if(Xce(t))return e4t(t);if(fVe(t))return t4t(t);if(pVe(t))return xVe(t);if(yVe(t))return n4t(t);if(vVe(t))return r4t(t)}throw mVe(t)}function Jyt(t){return new mi(function(e){var n=t[Wce]();if(ts(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function e4t(t){return new mi(function(e){for(var n=0;n0&&b(i)},void 0,void 0,function(){m?.closed||m?.unsubscribe(),g=null})),!y&&b(r!=null?typeof r=="number"?r:+r-l.now():i)})}function d4t(t){throw new u4t(t)}function Je(t,e){return Zo(function(n,r){var i=0;n.subscribe(yo(r,function(o){r.next(t.call(e,o,i++))}))})}var f4t=Array.isArray;function h4t(t,e){return f4t(e)?t.apply(void 0,Gu([],ef(e))):t(e)}function DV(t){return Je(function(e){return h4t(t,e)})}var p4t=Array.isArray,m4t=Object.getPrototypeOf,g4t=Object.prototype,y4t=Object.keys;function SVe(t){if(t.length===1){var e=t[0];if(p4t(e))return{args:e,keys:null};if(b4t(e)){var n=y4t(e);return{args:n.map(function(r){return e[r]}),keys:n}}}return{args:t,keys:null}}function b4t(t){return t&&typeof t=="object"&&m4t(t)===g4t}function kVe(t,e){return t.reduce(function(n,r,i){return n[r]=e[i],n},{})}function ms(){for(var t=[],e=0;e=0?c0(c,o,p,s,!0):f=!0,p();var m=yo(c,function(g){var y,b,v=u.slice();try{for(var x=l0(v),C=x.next();!C.done;C=x.next()){var w=C.value,_=w.buffer;_.push(g),a<=_.length&&h(w)}}catch(S){y={error:S}}finally{try{C&&!C.done&&(b=x.return)&&b.call(x)}finally{if(y)throw y.error}}},function(){for(;u?.length;)c.next(u.shift().buffer);m?.unsubscribe(),c.complete(),c.unsubscribe()},void 0,function(){return u=null});l.subscribe(m)})}function tr(t){return Zo(function(e,n){var r=null,i=!1,o;r=e.subscribe(yo(n,void 0,void 0,function(s){o=Qs(t(s,tr(t)(e))),r?(r.unsubscribe(),r=null,o.subscribe(n)):i=!0})),i&&(r.unsubscribe(),r=null,o.subscribe(n))})}function RVe(t,e,n,r,i){return function(o,s){var a=n,l=e,c=0;o.subscribe(yo(s,function(u){var f=c++;l=a?t(l,u,f):(a=!0,u),r&&s.next(l)},i&&(function(){a&&s.next(l),s.complete()})))}}function rS(t,e){return Zo(RVe(t,e,arguments.length>=2,!1,!0))}var O4t=function(t,e){return t.push(e),t};function vF(){return Zo(function(t,e){rS(O4t,[])(t).subscribe(e)})}function DVe(){for(var t=[],e=0;e=2;return function(r){return r.pipe(t?nn(function(i,o){return t(i,o,r)}):Pg,$c(1),n?nue(e):PVe(function(){return new GA}))}}function MVe(t,e,n,r){return Zo(function(i,o){var s;!e||typeof e=="function"?s=e:(n=e.duration,s=e.element,r=e.connector);var a=new Map,l=function(m){a.forEach(m),m(o)},c=function(m){return l(function(g){return g.error(m)})},u=0,f=!1,h=new lVe(o,function(m){try{var g=t(m),y=a.get(g);if(!y){a.set(g,y=r?r():new qs);var b=p(g,y);if(o.next(b),n){var v=yo(y,function(){y.complete(),v?.unsubscribe()},void 0,void 0,function(){return a.delete(g)});h.add(Qs(n(b)).subscribe(v))}}y.next(s?s(m):m)}catch(x){c(x)}},function(){return l(function(m){return m.complete()})},c,function(){return a.clear()},function(){return f=!0,u===0});i.subscribe(h);function p(m,g){var y=new mi(function(b){u++;var v=g.subscribe(b);return function(){v.unsubscribe(),--u===0&&f&&h.unsubscribe()}});return y.key=m,y}})}function W4t(t){return t<=0?function(){return Xr}:Zo(function(e,n){var r=[];e.subscribe(yo(n,function(i){r.push(i),t=2;return function(r){return r.pipe(Pg,W4t(1),n?nue(e):PVe(function(){return new GA}))}}function Hw(t,e,n){return n===void 0&&(n=1/0),ts(e)?Kt(function(){return t},e,n):Kt(function(){return t},n)}function G4t(t,e){var n=ts(t)?t:function(){return t};return ts(e)?OVe(e,{connector:n}):function(r){return new Fyt(r,n)}}function q5(t,e,n,r){var i=ts(n)?n:void 0;return function(o){return G4t(new AV(t,e,r),i)(o)}}function Y4t(t){var e,n=1/0,r;return t!=null&&(typeof t=="object"?(e=t.count,n=e===void 0?1/0:e,r=t.delay):n=t),n<=0?function(){return Xr}:Zo(function(i,o){var s=0,a,l=function(){if(a?.unsubscribe(),a=null,r!=null){var u=typeof r=="number"?Cs(r):Qs(r(s)),f=yo(o,function(){f.unsubscribe(),c()});u.subscribe(f)}else c()},c=function(){var u=!1;a=i.subscribe(yo(o,void 0,function(){++s=2,!0))}function sc(t){t===void 0&&(t={});var e=t.connector,n=e===void 0?function(){return new qs}:e,r=t.resetOnError,i=r===void 0?!0:r,o=t.resetOnComplete,s=o===void 0?!0:o,a=t.resetOnRefCountZero,l=a===void 0?!0:a;return function(c){var u,f,h,p=0,m=!1,g=!1,y=function(){f?.unsubscribe(),f=void 0},b=function(){y(),u=h=void 0,m=g=!1},v=function(){var x=u;b(),x?.unsubscribe()};return Zo(function(x,C){p++,!g&&!m&&y();var w=h=h??n();C.add(function(){p--,p===0&&!g&&!m&&(f=yG(v,l))}),w.subscribe(C),!u&&p>0&&(u=new zw({next:function(_){return w.next(_)},error:function(_){g=!0,y(),f=yG(b,i,_),w.error(_)},complete:function(){m=!0,y(),f=yG(b,s),w.complete()}}),Qs(x).subscribe(u))})(c)}}function yG(t,e){for(var n=[],r=2;r{},onMouseLeave:()=>{}}),sze=wn("sanity/_singletons/context/form-builder",null),lue=wn("sanity/_singletons/context/form-callbacks",null),X4t=wn("sanity/_singletons/context/form-field-presence",[]),aze=wn("sanity/_singletons/context/form-value",null),lze=wn("sanity/_singletons/context/free-trial",void 0),cze=wn("sanity/_singletons/context/fullscreen-pte",{getFullscreenPath:()=>{},setFullscreenPath:()=>{},hasAnyFullscreen:()=>!1,allFullscreenPaths:[]}),uze=wn("sanity/_singletons/context/get-form-value",null),dze=wn("sanity/_singletons/context/hovered-field",{store:{subscribe:()=>()=>{},getSnapshot:()=>[]},onMouseEnter:()=>{},onMouseLeave:()=>{}}),fze=wn("sanity/_singletons/context/is-last-pane",!1),hze=wn("sanity/_singletons/context/live-user-application",{userApplication:void 0,isLoading:!0}),cue=wn("sanity/_singletons/context/locale",void 0),pze=wn("sanity/_singletons/context/media-library",null),mze=wn("sanity/_singletons/context/mention-user",null),gze=wn("sanity/_singletons/context/navbar",{onSearchFullscreenOpenChange:()=>"",onSearchOpenChange:()=>"",searchFullscreenOpen:!1,searchFullscreenPortalEl:null,searchOpen:!1}),yze=wn("sanity/_singletons/context/package-version-info",{isAutoUpdating:!1,checkForUpdates:()=>{},get currentVersion(){throw new Error("PackageVersionInfoContext not provided")},versionCheckStatus:{lastCheckedAt:null,checking:!1}}),bze=wn("sanity/_singletons/context/pane",null),vze=wn("sanity/_singletons/context/pane-layout",null);function u2(){throw new Error("Pane is missing router context")}const iS=wn("sanity/_singletons/context/pane-router",{index:0,groupIndex:0,siblingIndex:0,payload:void 0,params:{},hasGroupSiblings:!1,groupLength:0,routerPanesState:[],BackLink:()=>u2(),ChildLink:()=>u2(),ReferenceChildLink:()=>u2(),handleEditReference:()=>u2(),ParameterizedLink:()=>u2(),replaceCurrent:()=>u2(),closeCurrentAndAfter:()=>u2(),closeCurrent:()=>u2(),duplicateCurrent:()=>u2(),setView:()=>u2(),setParams:()=>u2(),setPayload:()=>u2(),navigateIntent:()=>u2(),createPathWithParams:()=>u2()}),xze=wn("sanity/_singletons/context/perspective-context",null),Cze=wn("sanity/_singletons/context/portable-text-markers",[]),wze=wn("sanity/_singletons/context/portable-text-member-item-element-refs",new jh({})),uue=wn("sanity/_singletons/context/portable-text-member-items",[]),_ze=wn("sanity/_singletons/context/portable-text-member-schema-types",null),Sze=wn("sanity/_singletons/context/presence",[]),kze=wn("sanity/_singletons/context/presence-tracker-store",null),Eze=wn("sanity/_singletons/context/presence-tracker-get-snapshot",null),FV=wn("sanity/_singletons/context/presentation",null),tli=wn("sanity/_singletons/context/presentation/displayed-document",null),Zre=wn("sanity/_singletons/context/presentation/document",null),Z4t=wn("sanity/_singletons/context/presentation/navigate",null),nli=wn("sanity/_singletons/context/presentation/panels",null),Q4t=wn("sanity/_singletons/context/presentation/params",null),rli=wn("sanity/_singletons/context/presentation/shared-state",null),J4t=wn("sanity/_singletons/context/preview-card",{selected:!1}),CF=wn("sanity/_singletons/context/reference-input-options",{}),Tze=wn("sanity/_singletons/context/reference-item-ref",null),due=wn("sanity/_singletons/context/releases-metadata",null),Ize=wn("sanity/_singletons/context/releases-table",null),jze=wn("sanity/_singletons/context/releases-upsell",null),Aze=wn("sanity/_singletons/context/resolved-panes",null);function ili(t){const e=H.c(3),{children:n,value:r}=t;let i;return e[0]!==n||e[1]!==r?(i=d.jsx(Aze.Provider,{value:r,children:n}),e[0]=n,e[1]=r,e[2]=i):i=e[2],i}const Rze=wn("sanity/_singletons/context/resource-cache",null),Mg=wn("sanity/_singletons/context/review-changes",{onOpenReviewChanges:()=>{},onSetFocus:()=>{},isReviewChangesOpen:!1,isInteractive:!0}),NV=wn("sanity/_singletons/context/router",null),Dze=wn("sanity/_singletons/context/router-history",null),Oze=wn("sanity/_singletons/context/start-in-create-enabled",{startInCreateEnabled:!1}),e8t={enabled:!1,mode:null,hasUsedScheduledPublishing:{used:!1,loading:!1}},Pze=wn("sanity/_singletons/context/scheduled-publishing-enabled",e8t),$ze=wn("sanity/_singletons/context/schedule-publish-upsell",{upsellData:null,handleOpenDialog:()=>null,handleClose:()=>null,upsellDialogOpen:!1,telemetryLogs:{dialogSecondaryClicked:()=>null,dialogPrimaryClicked:()=>null,panelViewed:()=>null,panelDismissed:()=>null,panelPrimaryClicked:()=>null,panelSecondaryClicked:()=>null}}),Mze=wn("sanity/_singletons/context/schedules",void 0),Qre=wn("sanity/_singletons/context/scroll",null),Lze=wn("sanity/_singletons/context/search",void 0),Fze=wn("sanity/_singletons/context/selected-annotations",null),Nze=wn("sanity/_singletons/context/single-doc-release-context",null),t8t={enabled:!1,mode:null},Bze=wn("sanity/_singletons/context/single-doc-release-enabled",t8t),Vze=wn("sanity/_singletons/context/single-doc-release-upsell",{upsellData:null,handleOpenDialog:()=>null,handleClose:()=>null,upsellDialogOpen:!1,telemetryLogs:{dialogSecondaryClicked:()=>null,dialogPrimaryClicked:()=>null,panelViewed:()=>null,panelDismissed:()=>null,panelPrimaryClicked:()=>null,panelSecondaryClicked:()=>null}}),zze=wn("sanity/_singletons/context/sortable-item-id",null),hI=wn("sanity/_singletons/context/source",null),Hze=wn("sanity/_singletons/context/structure-tool",null),Uze=wn("sanity/_singletons/context/studioAnnouncements",void 0),Wze=wn("sanity/_singletons/context/tasks",null),qze=wn("sanity/_singletons/context/tasks-enabled",{enabled:!1,mode:null}),Gze=wn("sanity/_singletons/context/tasks-navigation",null),Yze=wn("sanity/_singletons/context/tasks-upsell",null),Jre=wn("sanity/_singletons/context/user-application-cache",null),Kze=wn("sanity/_singletons/context/user-color-manager",null),Xze=wn("sanity/_singletons/context/validation",[]),Zze=wn("sanity/_singletons/context/virtualizer-scroll-instance",null),Qze=wn("sanity/_singletons/context/workspace",null),Jze=wn("sanity/_singletons/context/workspaces",null),n8t={navbar:200,navbarPopover:5e5,navbarDialog:500001,pane:100,paneHeader:[110,15e3],paneFooter:[120,2e4],paneResizer:[130,25e3],paneDialog:[140,5e3],popover:200,modal:200,movingItem:1e4,drawershade:1e6,drawer:1000001,fullscreen:12e5,toast:[100,11e3],portal:200,dropdown:200,navbarFixed:1010,fullscreenEdit:1050,popoverBackground:1060,tooltip:200,modalBackground:2e3,spinner:3e3},r8t=wn("sanity/_singletons/context/z-index",n8t),F2=["gray","blue","purple","magenta","red","orange","yellow","green","cyan"],eHe=["50","100","200","300","400","500","600","700","800","900","950"],EM={title:"Black",hex:"#0d0e12"},u0={title:"White",hex:"#ffffff"},pI={50:{title:"Gray 50",hex:"#f6f6f8"},100:{title:"Gray 100",hex:"#eeeef1"},200:{title:"Gray 200",hex:"#e3e4e8"},300:{title:"Gray 300",hex:"#bbbdc9"},400:{title:"Gray 400",hex:"#9499ad"},500:{title:"Gray 500",hex:"#727892"},600:{title:"Gray 600",hex:"#515870"},700:{title:"Gray 700",hex:"#383d51"},800:{title:"Gray 800",hex:"#252837"},900:{title:"Gray 900",hex:"#1b1d27"},950:{title:"Gray 950",hex:"#13141b"}},OT={50:{title:"Blue 50",hex:"#f5f8ff"},100:{title:"Blue 100",hex:"#e5edff"},200:{title:"Blue 200",hex:"#dbe5ff"},300:{title:"Blue 300",hex:"#a8bfff"},400:{title:"Blue 400",hex:"#7595ff"},500:{title:"Blue 500",hex:"#556bfc"},600:{title:"Blue 600",hex:"#4043e7"},700:{title:"Blue 700",hex:"#2927aa"},800:{title:"Blue 800",hex:"#192457"},900:{title:"Blue 900",hex:"#161a41"},950:{title:"Blue 950",hex:"#101228"}},OC={50:{title:"Purple 50",hex:"#f8f5ff"},100:{title:"Purple 100",hex:"#f1ebff"},200:{title:"Purple 200",hex:"#ece1fe"},300:{title:"Purple 300",hex:"#ccb1fc"},400:{title:"Purple 400",hex:"#b087f7"},500:{title:"Purple 500",hex:"#8f57ef"},600:{title:"Purple 600",hex:"#721fe5"},700:{title:"Purple 700",hex:"#4c1a9e"},800:{title:"Purple 800",hex:"#2f1862"},900:{title:"Purple 900",hex:"#23173f"},950:{title:"Purple 950",hex:"#181128"}},i8t={50:{title:"Magenta 50",hex:"#fef6f9"},100:{title:"Magenta 100",hex:"#fde8ef"},200:{title:"Magenta 200",hex:"#fcdee9"},300:{title:"Magenta 300",hex:"#f7abc5"},400:{title:"Magenta 400",hex:"#f0709b"},500:{title:"Magenta 500",hex:"#e72767"},600:{title:"Magenta 600",hex:"#b11651"},700:{title:"Magenta 700",hex:"#7c1342"},800:{title:"Magenta 800",hex:"#4b1130"},900:{title:"Magenta 900",hex:"#341325"},950:{title:"Magenta 950",hex:"#1f0f14"}},y9={50:{title:"Red 50",hex:"#fff6f5"},100:{title:"Red 100",hex:"#ffe7e5"},200:{title:"Red 200",hex:"#ffdedc"},300:{title:"Red 300",hex:"#fdada5"},400:{title:"Red 400",hex:"#f77769"},500:{title:"Red 500",hex:"#ef4434"},600:{title:"Red 600",hex:"#cc2819"},700:{title:"Red 700",hex:"#8b2018"},800:{title:"Red 800",hex:"#4d1714"},900:{title:"Red 900",hex:"#321615"},950:{title:"Red 950",hex:"#1e1011"}},o8t={50:{title:"Orange 50",hex:"#fff7f0"},100:{title:"Orange 100",hex:"#ffeadb"},200:{title:"Orange 200",hex:"#ffddc7"},300:{title:"Orange 300",hex:"#ffb685"},400:{title:"Orange 400",hex:"#ff8e42"},500:{title:"Orange 500",hex:"#fa6400"},600:{title:"Orange 600",hex:"#b14802"},700:{title:"Orange 700",hex:"#7c3404"},800:{title:"Orange 800",hex:"#461e07"},900:{title:"Orange 900",hex:"#32160b"},950:{title:"Orange 950",hex:"#21120d"}},wF={50:{title:"Yellow 50",hex:"#fefae1"},100:{title:"Yellow 100",hex:"#fcf3bb"},200:{title:"Yellow 200",hex:"#f9e994"},300:{title:"Yellow 300",hex:"#f7d455"},400:{title:"Yellow 400",hex:"#f9bc15"},500:{title:"Yellow 500",hex:"#d28a04"},600:{title:"Yellow 600",hex:"#965908"},700:{title:"Yellow 700",hex:"#653a0b"},800:{title:"Yellow 800",hex:"#3b220c"},900:{title:"Yellow 900",hex:"#271a11"},950:{title:"Yellow 950",hex:"#181410"}},eie={50:{title:"Green 50",hex:"#e7fef5"},100:{title:"Green 100",hex:"#c5fce8"},200:{title:"Green 200",hex:"#a9f9dc"},300:{title:"Green 300",hex:"#59f3ba"},400:{title:"Green 400",hex:"#0ff0a1"},500:{title:"Green 500",hex:"#04b97a"},600:{title:"Green 600",hex:"#01794f"},700:{title:"Green 700",hex:"#015133"},800:{title:"Green 800",hex:"#023120"},900:{title:"Green 900",hex:"#06231a"},950:{title:"Green 950",hex:"#071715"}},s8t={50:{title:"Cyan 50",hex:"#e7fefe"},100:{title:"Cyan 100",hex:"#c5fcfc"},200:{title:"Cyan 200",hex:"#96f8f8"},300:{title:"Cyan 300",hex:"#62efef"},400:{title:"Cyan 400",hex:"#18e2e2"},500:{title:"Cyan 500",hex:"#04b8be"},600:{title:"Cyan 600",hex:"#037782"},700:{title:"Cyan 700",hex:"#024950"},800:{title:"Cyan 800",hex:"#042f34"},900:{title:"Cyan 900",hex:"#072227"},950:{title:"Cyan 950",hex:"#0d181c"}},io={gray:pI,blue:OT,purple:OC,magenta:i8t,red:y9,orange:o8t,yellow:wF,green:eie,cyan:s8t},tHe={black:EM,white:u0,...io},ja={avatar:{sizes:[{distance:-4,size:19},{distance:-4,size:25},{distance:-8,size:33},{distance:-12,size:49}],focusRing:{offset:1,width:1}},button:{textWeight:"medium",border:{width:1},focusRing:{offset:-1,width:1}},card:{border:{width:1},focusRing:{offset:-1,width:1},shadow:{outline:.5}},container:[320,640,960,1280,1600,1920],media:[360,600,900,1200,1800,2400],layer:{dialog:{zOffset:600},popover:{zOffset:400},tooltip:{zOffset:200}},radius:[0,1,3,6,9,12,21],shadow:[null,{umbra:[0,0,0,0],penumbra:[0,0,0,0],ambient:[0,0,0,0]},{umbra:[0,3,5,-2],penumbra:[0,6,10,0],ambient:[0,1,18,1]},{umbra:[0,7,8,-4],penumbra:[0,12,17,2],ambient:[0,5,22,4]},{umbra:[0,9,11,-5],penumbra:[0,18,28,2],ambient:[0,7,34,6]},{umbra:[0,11,15,-7],penumbra:[0,24,38,3],ambient:[0,9,46,8]}],space:[0,4,8,12,20,32,52,84,136,220],input:{border:{width:1},checkbox:{size:17,focusRing:{offset:-1,width:1}},radio:{size:17,markSize:9,focusRing:{offset:-1,width:1}},switch:{width:25,height:17,padding:5,transitionDurationMs:150,transitionTimingFunction:"ease-out",focusRing:{offset:1,width:1}},select:{focusRing:{offset:-1,width:1}},text:{focusRing:{offset:-1,width:1}}},style:{button:{root:{transition:"background-color 100ms,border-color 100ms,color 100ms"}}}},a8t={code:{family:"ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",weights:{regular:400,medium:500,semibold:600,bold:700},sizes:[{ascenderHeight:4,descenderHeight:4,fontSize:10,iconSize:17,lineHeight:15,letterSpacing:0},{ascenderHeight:5,descenderHeight:5,fontSize:13,iconSize:21,lineHeight:19,letterSpacing:0},{ascenderHeight:6,descenderHeight:6,fontSize:16,iconSize:25,lineHeight:23,letterSpacing:0},{ascenderHeight:7,descenderHeight:7,fontSize:19,iconSize:29,lineHeight:27,letterSpacing:0},{ascenderHeight:8,descenderHeight:8,fontSize:22,iconSize:33,lineHeight:31,letterSpacing:0}]},heading:{family:'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',weights:{regular:700,medium:800,semibold:900,bold:900},sizes:[{ascenderHeight:5,descenderHeight:5,fontSize:13,iconSize:17,lineHeight:19,letterSpacing:0},{ascenderHeight:6,descenderHeight:6,fontSize:16,iconSize:25,lineHeight:23,letterSpacing:0},{ascenderHeight:7,descenderHeight:7,fontSize:21,iconSize:33,lineHeight:29,letterSpacing:0},{ascenderHeight:8,descenderHeight:8,fontSize:27,iconSize:41,lineHeight:35,letterSpacing:0},{ascenderHeight:9.5,descenderHeight:8.5,fontSize:33,iconSize:49,lineHeight:41,letterSpacing:0},{ascenderHeight:10.5,descenderHeight:9.5,fontSize:38,iconSize:53,lineHeight:47,letterSpacing:0}]},label:{family:'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',weights:{regular:600,medium:700,semibold:800,bold:900},sizes:[{ascenderHeight:2,descenderHeight:2,fontSize:8.1,iconSize:13,lineHeight:10,letterSpacing:.5},{ascenderHeight:2,descenderHeight:2,fontSize:9.5,iconSize:15,lineHeight:11,letterSpacing:.5},{ascenderHeight:2,descenderHeight:2,fontSize:10.8,iconSize:17,lineHeight:12,letterSpacing:.5},{ascenderHeight:2,descenderHeight:2,fontSize:12.25,iconSize:19,lineHeight:13,letterSpacing:.5},{ascenderHeight:2,descenderHeight:2,fontSize:13.6,iconSize:21,lineHeight:14,letterSpacing:.5},{ascenderHeight:2,descenderHeight:2,fontSize:15,iconSize:23,lineHeight:15,letterSpacing:.5}]},text:{family:'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',weights:{regular:400,medium:500,semibold:600,bold:700},sizes:[{ascenderHeight:4,descenderHeight:4,fontSize:10,iconSize:17,lineHeight:15,letterSpacing:0},{ascenderHeight:5,descenderHeight:5,fontSize:13,iconSize:21,lineHeight:19,letterSpacing:0},{ascenderHeight:6,descenderHeight:6,fontSize:15,iconSize:25,lineHeight:23,letterSpacing:0},{ascenderHeight:7,descenderHeight:7,fontSize:18,iconSize:29,lineHeight:27,letterSpacing:0},{ascenderHeight:8,descenderHeight:8,fontSize:21,iconSize:33,lineHeight:31,letterSpacing:0}]}},L7e=new WeakMap;function e1(t){const e=L7e.get(t);if(e)return e;const n=as(t,t.card.enabled),r={_blend:t._blend||(t.dark?"screen":"multiply"),_dark:t.dark,accent:n.accent,avatar:n.avatar,backdrop:t.base.shadow.ambient,badge:n.badge,bg:t.base.bg,border:t.base.border,button:{default:oP(t,t.button.default),ghost:oP(t,t.button.ghost),bleed:oP(t,t.button.bleed)},code:n.code,fg:t.base.fg,focusRing:t.base.focusRing,icon:n.muted.fg,input:{default:F7e(t.input.default),invalid:F7e(t.input.invalid)},kbd:n.kbd,link:n.link,muted:{...n.muted,bg:t.selectable?.default.enabled.bg2||t.base.bg},selectable:oP(t,t.selectable||t.muted),shadow:t.base.shadow,skeleton:{from:t.skeleton?.from||t.base.border,to:t.skeleton?.to||t.base.border},syntax:t.syntax};return L7e.set(t,r),r}function oP(t,e){return{default:{enabled:as(t,e.default.enabled),hovered:as(t,e.default.hovered),pressed:as(t,e.default.pressed),selected:as(t,e.default.selected),disabled:as(t,e.default.disabled)},neutral:{enabled:as(t,e.default.enabled),hovered:as(t,e.default.hovered),pressed:as(t,e.default.pressed),selected:as(t,e.default.selected),disabled:as(t,e.default.disabled)},primary:{enabled:as(t,e.primary.enabled),hovered:as(t,e.primary.hovered),pressed:as(t,e.primary.pressed),selected:as(t,e.primary.selected),disabled:as(t,e.primary.disabled)},suggest:{enabled:as(t,e.primary.enabled),hovered:as(t,e.primary.hovered),pressed:as(t,e.primary.pressed),selected:as(t,e.primary.selected),disabled:as(t,e.primary.disabled)},positive:{enabled:as(t,e.positive.enabled),hovered:as(t,e.positive.hovered),pressed:as(t,e.positive.pressed),selected:as(t,e.positive.selected),disabled:as(t,e.positive.disabled)},caution:{enabled:as(t,e.caution.enabled),hovered:as(t,e.caution.hovered),pressed:as(t,e.caution.pressed),selected:as(t,e.caution.selected),disabled:as(t,e.caution.disabled)},critical:{enabled:as(t,e.critical.enabled),hovered:as(t,e.critical.hovered),pressed:as(t,e.critical.pressed),selected:as(t,e.critical.selected),disabled:as(t,e.critical.disabled)}}}function as(t,e){return{...e,avatar:{gray:{bg:t.spot.gray,fg:t.base.bg},blue:{bg:t.spot.blue,fg:t.base.bg},purple:{bg:t.spot.purple,fg:t.base.bg},magenta:{bg:t.spot.magenta,fg:t.base.bg},red:{bg:t.spot.red,fg:t.base.bg},orange:{bg:t.spot.orange,fg:t.base.bg},yellow:{bg:t.spot.yellow,fg:t.base.bg},green:{bg:t.spot.green,fg:t.base.bg},cyan:{bg:t.spot.cyan,fg:t.base.bg}},badge:{default:{bg:t.muted.default.enabled.bg,fg:t.muted.default.enabled.fg,dot:t.muted.default.enabled.muted.fg,icon:t.muted.default.enabled.muted.fg},neutral:{bg:t.muted.transparent.enabled.bg,fg:t.muted.transparent.enabled.fg,dot:t.muted.transparent.enabled.muted.fg,icon:t.muted.transparent.enabled.muted.fg},primary:{bg:t.muted.primary.enabled.bg,fg:t.muted.primary.enabled.fg,dot:t.muted.primary.enabled.muted.fg,icon:t.muted.primary.enabled.muted.fg},suggest:{bg:t.muted.primary.enabled.bg,fg:t.muted.primary.enabled.fg,dot:t.muted.primary.enabled.muted.fg,icon:t.muted.primary.enabled.muted.fg},positive:{bg:t.muted.positive.enabled.bg,fg:t.muted.positive.enabled.fg,dot:t.muted.positive.enabled.muted.fg,icon:t.muted.positive.enabled.muted.fg},caution:{bg:t.muted.caution.enabled.bg,fg:t.muted.caution.enabled.fg,dot:t.muted.caution.enabled.muted.fg,icon:t.muted.caution.enabled.muted.fg},critical:{bg:t.muted.critical.enabled.bg,fg:t.muted.critical.enabled.fg,dot:t.muted.critical.enabled.muted.fg,icon:t.muted.critical.enabled.muted.fg}},kbd:{bg:t.muted.default.enabled.bg,fg:t.muted.default.enabled.fg,border:t.muted.default.enabled.border},muted:{...t.muted.default.enabled.muted,bg:e.bg2||e.bg},skeleton:{from:e.skeleton?.from||e.border,to:e.skeleton?.to||e.border}}}function F7e(t){return{enabled:sP(t.enabled),disabled:sP(t.disabled),readOnly:sP(t.readOnly),hovered:sP(t.hovered)}}function sP(t){return{bg:t.bg,border:t.border,fg:t.fg,muted:{bg:t.bg2},placeholder:t.placeholder}}const N7e=new WeakMap;function Jt(t){if(t.sanity.v2?._resolved)return t.sanity.v2;const e=N7e.get(t);if(e)return e;const n={_version:2,_resolved:!0,avatar:{...ja.avatar,...t.sanity.avatar},button:{...ja.button,...t.sanity.button},card:ja.card,color:e1(t.sanity.color),container:t.sanity.container,font:t.sanity.fonts,input:{...ja.input,...t.sanity.input,checkbox:{...ja.input.checkbox,...t.sanity.input.checkbox},radio:{...ja.input.radio,...t.sanity.input.radio},switch:{...ja.input.switch,...t.sanity.input.switch}},layer:t.sanity.layer??ja.layer,media:t.sanity.media,radius:t.sanity.radius,shadow:t.sanity.shadows,space:t.sanity.space,style:t.sanity.styles};return N7e.set(t,n),n}function B7e(t){return t._version===2}const V7e=new WeakMap;function l8t(t){if(t.v2)return t.v2;const e=V7e.get(t);if(e)return e;const{avatar:n,button:r,color:i,container:o,fonts:s,input:a,layer:l,media:c,radius:u,shadows:f,space:h,styles:p}=t,m={_version:2,avatar:{...ja.avatar,...n},button:{...ja.button,...r},card:ja.card,color:{light:{transparent:e1(i.light.transparent),default:e1(i.light.default),neutral:e1(i.light.transparent),primary:e1(i.light.primary),suggest:e1(i.light.primary),positive:e1(i.light.positive),caution:e1(i.light.caution),critical:e1(i.light.critical)},dark:{transparent:e1(i.dark.transparent),default:e1(i.dark.default),neutral:e1(i.dark.transparent),primary:e1(i.dark.primary),suggest:e1(i.dark.primary),positive:e1(i.dark.positive),caution:e1(i.dark.caution),critical:e1(i.dark.critical)}},container:o,font:s,input:{...ja.input,...a,checkbox:{...ja.input.checkbox,...a.checkbox},radio:{...ja.input.radio,...a.radio},switch:{...ja.input.switch,...a.switch}},layer:l??ja.layer,media:c,radius:u,shadow:f,space:h,style:p};return V7e.set(t,m),m}function yg(t,e,n){Object.defineProperty(t,e,{get(){const r=n();return Object.defineProperty(t,e,{value:r,enumerable:!0,writable:!1,configurable:!1}),r},enumerable:!0,configurable:!0})}const z7e=new WeakMap,c8t=["transparent","default","primary","positive","caution","critical"];function H7e(t,e){const n={};for(const r of c8t)yg(n,r,()=>u8t(e[t][r]));return n}function nHe(t){const e=z7e.get(t);if(e)return e;const{avatar:n,button:r,color:i,container:o,font:s,input:a,media:l,radius:c,shadow:u,space:f,style:h}=t,p={};yg(p,"light",()=>H7e("light",i)),yg(p,"dark",()=>H7e("dark",i));const m={_version:0,avatar:n,button:r,container:o,color:p,focusRing:a.text.focusRing,fonts:s,input:a,media:l,radius:c,shadows:u,space:f,styles:h,v2:t};return z7e.set(t,m),m}function u8t(t){return{base:{bg:t.bg,fg:t.fg,border:t.border,focusRing:t.focusRing,shadow:t.shadow},button:t.button,card:t.selectable.default,dark:t._dark,input:{default:U7e(t.input.default),invalid:U7e(t.input.invalid)},muted:{...t.button.ghost,transparent:t.button.ghost.default},solid:{...t.button.default,transparent:t.button.default.default},selectable:t.selectable,spot:{gray:t.avatar.gray.bg,blue:t.avatar.blue.bg,purple:t.avatar.purple.bg,magenta:t.avatar.magenta.bg,red:t.avatar.red.bg,orange:t.avatar.orange.bg,yellow:t.avatar.yellow.bg,green:t.avatar.green.bg,cyan:t.avatar.cyan.bg},syntax:t.syntax}}function U7e(t){return{enabled:aP(t.enabled),disabled:aP(t.disabled),readOnly:aP(t.readOnly),hovered:aP(t.hovered)}}function aP(t){return{bg:t.bg,bg2:t.muted.bg,border:t.border,fg:t.fg,placeholder:t.placeholder}}const d8t=["multiply","screen"],BV=["transparent","default","neutral","primary","suggest","positive","caution","critical"],nm=["default","neutral","primary","suggest","positive","caution","critical"],JA=["enabled","hovered","pressed","selected","disabled"],rHe=["default","ghost","bleed"],iHe=["default","invalid"],oHe=["enabled","hovered","readOnly","disabled"],f8t=F2;function h8t(t){return d8t.includes(t)}function p8t(t){return F2.includes(t)}function W7e(t){return eHe.includes(t)}[...f8t];[...BV];[...nm];[...JA];[...iHe];[...oHe];function bG(t){return/^\d+%$/.test(t)}function sHe(t){const e=t.split("/");let n=e.shift()||"";const[r,i]=n.split(" ");if(W7e(r)){const o=r,s=e.shift()||"";if(bG(i)){const a=Number(i.slice(0,-1))/100;return{type:"color",tint:o,mix:a}}if(vG(s)){const a=Number(s);return{type:"color",tint:o,opacity:a}}return{type:"color",tint:o}}if(m8t(r)){const o=r,s=e.shift()||"";if(bG(i)){const a=Number(i.slice(0,-1))/100;return{type:"color",key:o,mix:a}}if(vG(s)){const a=Number(s);return{type:"color",key:o,opacity:a}}return{type:"color",key:o}}if(p8t(r)){const o=r;n=e.shift()||"";const[s,a]=n.split(" ");if(W7e(s)){const l=s,c=e.shift()||"";if(bG(a)){const u=Number(a.slice(0,-1))/100;return{type:"color",hue:o,tint:l,mix:u}}if(vG(c)){const u=Number(c);return{type:"color",hue:o,tint:l,opacity:u}}return{type:"color",hue:o,tint:l}}return{type:"hue",value:o}}if(h8t(r))return{type:"blendMode",value:r}}function m8t(t){return t==="black"||t==="white"}function vG(t){return t==="0"||/^0\.[0-9]+$/.test(t)||t==="1"}function g8t(t){let e="";return t.key==="black"||t.key==="white"?e=t.key:e=`${t.hue}/${t.tint}`,t.mix!==void 0?`${e} ${t.mix*100}%`:(t.opacity!==void 0&&(e+=`/${t.opacity}`),e)}const y8t=["500","500"];function Sn(t,e=y8t){const{hue:n,scheme:r}=t,i=sHe(e[r==="light"?0:1]);if(!i||i.type!=="color")throw new Error(`Invalid color token: ${e[0]}`);return g8t({...i,hue:i.hue||n})}const b8t={base:{"*":{_blend:["multiply","screen"],accent:{fg:["purple/600","purple/400"]},avatar:{"*":{_blend:["screen","multiply"],bg:["500","400"],fg:["white","black"]}},backdrop:["gray/200/0.5","black/0.5"],badge:{"*":{bg:["100","900"],fg:["600","400"],icon:["500","500"],dot:["500","500"]},positive:{bg:["200 50%","900"],fg:["600","500"]},caution:{bg:["200 50%","900"],fg:["600","500"]}},bg:["50","950"],border:["200","800"],code:{bg:["50","950"],fg:["600","400"]},fg:["800","200"],focusRing:["blue/500","blue/500"],icon:["600","400"],kbd:{bg:["white","black"],fg:["600","400"],border:["200","800"]},link:{fg:["blue/600","blue/300"]},muted:{bg:["50","950"],fg:["700 75%","300 75%"]},shadow:{outline:["500/0.3","500/0.4"],umbra:["gray/500/0.1","black/0.2"],penumbra:["gray/500/0.07","black/0.14"],ambient:["gray/500/0.06","black/0.12"]},skeleton:{from:["100","900"],to:["100 50%","900 50%"]}},transparent:{bg:["50","black"]},default:{bg:["white","950"],fg:["800","200"],muted:{fg:["600","400"]}},primary:{_hue:"blue"},suggest:{_hue:"purple"},positive:{_hue:"green",shadow:{outline:["500/0.4","500/0.4"]}},caution:{_hue:"yellow",shadow:{outline:["600/0.3","500/0.4"]}},critical:{_hue:"red"}},button:{default:{"*":{"*":{_blend:["screen","multiply"],accent:{fg:["purple/300","purple/700"]},avatar:{"*":{_blend:["screen","multiply"],bg:["500","400"],fg:["white","black"]}},badge:{"*":{bg:["900","100"],fg:["400","600"],dot:["500","500"],icon:["500","500"]}},bg:["500","400"],border:["500/0","400/0"],code:{bg:["500 20%","400 20%"],fg:["200","600"]},fg:["white","black"],icon:["100 70%","900 70%"],kbd:{bg:["black","white"],fg:["200","600"],border:["800","200"]},link:{fg:["blue/200","blue/600"]},muted:{bg:["950","50"],fg:["100 70%","900 70%"]},skeleton:{from:["900","100"],to:["900 50%","100 50%"]}},hovered:{bg:["600","300"],border:["700/0","300/0"]},pressed:{bg:["700","300"]},selected:{bg:["700","300"]},disabled:{_hue:"gray",accent:{fg:["100 70%","900 70%"]},avatar:{"*":{_blend:["screen","multiply"],bg:["gray/500","gray/400"],fg:["white","black"]}},badge:{"*":{bg:["gray/700","gray/300"],fg:["white","black"],dot:["white","black"],icon:["white","black"]}},bg:["300","600"],code:{bg:["950","50"],fg:["300","600"]},fg:["300","600"],muted:{bg:["950","50"],fg:["300","600"]},kbd:{bg:["black","white"],fg:["white","black"],border:["700","300"]},link:{fg:["100 70%","900 70%"]}}},default:{"*":{avatar:{"*":{_blend:["screen","multiply"],bg:["500","400"],fg:["white","black"]}},bg:["800","200"],muted:{bg:["950","50"],fg:["400","600"]}},hovered:{bg:["900","100"]},pressed:{bg:["black","white"]},selected:{bg:["black","white"]}}},ghost:{"*":{"*":{_blend:["multiply","screen"],accent:{fg:["purple/700 60%","purple/300 70%"]},avatar:{"*":{_blend:["screen","multiply"],bg:["500","400"],fg:["white","black"]}},badge:{"*":{bg:["100","900"],fg:["600","400"],dot:["500","500"],icon:["500","500"]}},bg:["50","950"],border:["100","900"],code:{bg:["500 10%","400 10%"],fg:["700 60%","400 60%"]},fg:["600","400"],icon:["700 60%","300 60%"],kbd:{bg:["white","black"],fg:["600","400"],border:["200","800"]},link:{fg:["blue/700 60%","blue/300 60%"]},muted:{bg:["100","950"],fg:["700 60%","300 60%"]},skeleton:{from:["100","900"],to:["100 50%","900 50%"]}},hovered:{bg:["100","900"],fg:["700","300"]},pressed:{bg:["200","800"],fg:["800","200"]},selected:{bg:["200","800"],fg:["800","200"]},disabled:{_hue:"gray",accent:{fg:["200","800"]},avatar:{"*":{_blend:["screen","multiply"],bg:["gray/100","gray/900"],fg:["white","black"]}},badge:{"*":{_hue:"gray",bg:["50","950"],fg:["gray/200","gray/800"],dot:["gray/200","gray/800"],icon:["gray/200","gray/800"]}},border:["100","900"],code:{bg:["50","950"],fg:["200","800"]},fg:["400","600"],icon:["300","700"],muted:{fg:["300","700"]},kbd:{bg:["white","black"],fg:["200","800"],border:["100","900"]},link:{fg:["200","800"]}}},positive:{"*":{border:["600 20%","800"]}},caution:{"*":{border:["600 20%","800"]}}},bleed:{"*":{"*":{_blend:["multiply","screen"],accent:{fg:["purple/700 70%","purple/300 70%"]},avatar:{"*":{_blend:["screen","multiply"],bg:["500","400"],fg:["white","black"]}},badge:{"*":{bg:["100","900"],fg:["600","400"],dot:["500","500"],icon:["500","500"]}},bg:["white","black"],border:["white/0","black/0"],code:{bg:["50","950"],fg:["700 75%","300 75%"]},fg:["700","300"],icon:["700 75%","300 75%"],kbd:{bg:["white","black"],fg:["700","300"],border:["200","800"]},link:{fg:["blue/700 70%","blue/300 70%"]},muted:{bg:["100","950"],fg:["700 75%","300 75%"]},skeleton:{from:["100","900"],to:["100 50%","900 50%"]}},hovered:{bg:["50","900"],fg:["800","200"],icon:["800 70%","300 70%"]},pressed:{bg:["100","800"],fg:["800","200"],icon:["800 70%","200 70%"]},selected:{bg:["100","900"],fg:["800","200"],icon:["800 60%","200 60%"]},disabled:{_hue:"gray",accent:{fg:["200","800"]},avatar:{"*":{_blend:["screen","multiply"],bg:["gray/100","gray/900"],fg:["white","black"]}},badge:{"*":{_hue:"gray",bg:["50","950"],fg:["gray/200","gray/800"],dot:["gray/200","gray/800"],icon:["gray/200","gray/800"]}},code:{bg:["50","950"],fg:["200","800"]},fg:["400","600"],icon:["300","700"],muted:{fg:["400","600"]},kbd:{bg:["white","black"],fg:["200","800"],border:["100","900"]},link:{fg:["200","800"]}}}}},input:{"*":{"*":{_blend:["multiply","screen"],bg:["white","black"],border:["200","700"],fg:["black","200"],muted:{bg:["50","950"]},placeholder:["400","600"]},hovered:{border:["300","700"]},readOnly:{bg:["50","950"],border:["200","800"],fg:["800","200"]},disabled:{bg:["50","950"],fg:["400","600"],border:["100","900"],placeholder:["200","800 50%"]}},invalid:{"*":{_hue:"red",bg:["100","950"]}}},selectable:{"*":{"*":{_blend:["multiply","screen"],accent:{fg:["purple/700 70%","purple/300 70%"]},avatar:{"*":{_blend:["screen","multiply"],bg:["500","400"],fg:["white","black"]}},badge:{"*":{bg:["100","900"],fg:["600","400"],dot:["500","500"],icon:["500","500"]}},bg:["white","black"],border:["200","800"],code:{bg:["50","950"],fg:["600","400"]},fg:["700","300"],icon:["700 75%","300 75%"],kbd:{bg:["white","black"],fg:["600","400"],border:["200","800"]},link:{fg:["blue/700 70%","blue/300 70%"]},muted:{bg:["50","950"],fg:["700 75%","300 75%"]},skeleton:{from:["100","900"],to:["100 50%","900 50%"]}},hovered:{bg:["50","950"]},pressed:{bg:["100","900"]},selected:{_blend:["screen","multiply"],accent:{fg:["purple/300","purple/700"]},avatar:{"*":{_blend:["multiply","screen"],bg:["white","black"],fg:["black","white"]}},badge:{"*":{bg:["900","100"],fg:["400","600"],dot:["500","500"],icon:["500","500"]}},bg:["500","400"],border:["500 20%","400 20%"],code:{bg:["500 20%","400 20%"],fg:["200","600"]},fg:["white","black"],icon:["100 70%","900 70%"],kbd:{bg:["black","white"],fg:["200","600"],border:["800","200"]},link:{fg:["blue/200","blue/600"]},muted:{bg:["500 10%","400 10%"],fg:["100 70%","900 70%"]},skeleton:{from:["900","100"],to:["900 50%","100 50%"]}},disabled:{_hue:"gray",accent:{fg:["200","800"]},avatar:{"*":{_blend:["screen","multiply"],bg:["gray/100","gray/900"],fg:["white","black"]}},badge:{"*":{_hue:"gray",bg:["50","950"],fg:["gray/200","gray/800"],dot:["gray/200","gray/800"],icon:["gray/200","gray/800"]}},border:["100","900"],code:{bg:["50","950"],fg:["200","800"]},fg:["200","800"],icon:["200","800"],kbd:{bg:["white","black"],fg:["200","800"],border:["100","900"]},link:{fg:["200","800"]},muted:{bg:["50 50%","950 50%"],fg:["200","800"]}}},default:{selected:{_hue:"blue"}},critical:{disabled:{bg:["50 50%","950 50%"]}}},syntax:{atrule:["purple/600","purple/400"],attrName:["green/600","green/400"],attrValue:["yellow/600","yellow/400"],attribute:["yellow/600","yellow/400"],boolean:["purple/600","purple/400"],builtin:["purple/600","purple/400"],cdata:["yellow/600","yellow/400"],char:["yellow/600","yellow/400"],class:["orange/600","orange/400"],className:["cyan/600","cyan/400"],comment:["gray/400","gray/600"],constant:["purple/600","purple/400"],deleted:["red/600","red/400"],entity:["red/600","red/400"],function:["green/600","green/400"],hexcode:["blue/600","blue/400"],id:["purple/600","purple/400"],important:["purple/600","purple/400"],inserted:["yellow/600","yellow/400"],keyword:["magenta/600","magenta/400"],number:["purple/600","purple/400"],operator:["magenta/600","magenta/400"],property:["blue/600","blue/400"],pseudoClass:["yellow/600","yellow/400"],pseudoElement:["yellow/600","yellow/400"],punctuation:["gray/600","gray/400"],regex:["blue/600","blue/400"],selector:["red/600","red/400"],string:["yellow/600","yellow/400"],symbol:["purple/600","purple/400"],tag:["red/600","red/400"],unit:["orange/600","orange/400"],url:["red/600","red/400"],variable:["red/600","red/400"]}};function q7e(t){return!!(t&&typeof t=="object"&&!Array.isArray(t))}function j7(...t){const e=t.filter(Boolean);return e.length===0?{}:e.reduce(v8t,{})}function v8t(t,e){for(const n of Object.keys(e)){const r=t[n],i=e[n];q7e(r)&&q7e(i)?t[n]=j7(r,i):t[n]=i}return t}function x8t(t){const e=j7(b8t,t);return{base:C8t(e),button:_8t(e),input:T8t(e),selectable:A8t(e),syntax:e.syntax}}function C8t(t){const e={};for(const n of BV)e[n]=w8t(t,n);return e}function w8t(t,e){const n=j7(t?.base?.["*"],t?.base?.[e]),r=n._hue||t?.base?.[e]?._hue||"gray";return{...n,_hue:r,avatar:F2.reduce((i,o)=>({...i,[o]:j7({_hue:o},n.avatar?.["*"],n.avatar?.[o])}),{}),badge:nm.reduce((i,o)=>({...i,[o]:{_hue:t?.base?.[o]?._hue||r,...n.badge?.["*"],...n.badge?.[o]}}),{})}}function _8t(t){const e={};for(const n of rHe)e[n]=S8t(t,n);return e}function S8t(t,e){const n={};for(const r of nm)n[r]=k8t(t,e,r);return n}function k8t(t,e,n){const r={};for(const i of JA)r[i]=E8t(t,n,e,i);return r}function E8t(t,e,n,r){const i=j7(t?.button?.[n]?.["*"]?.["*"],t?.button?.[n]?.[e]?.["*"],t?.button?.[n]?.["*"]?.[r],t?.button?.[n]?.[e]?.[r]),o=i._hue||t?.base?.[e]?._hue;return{...i,_hue:o,avatar:F2.reduce((s,a)=>({...s,[a]:j7({_hue:a},i.avatar?.["*"],i.avatar?.[a])}),{}),badge:nm.reduce((s,a)=>({...s,[a]:{_hue:t?.base?.[a]?._hue||o,...i.badge?.["*"],...i.badge?.[a]}}),{})}}function T8t(t){const e={};for(const n of iHe)e[n]=I8t(t,n);return e}function I8t(t,e){const n={};for(const r of oHe)n[r]=j8t(t,e,r);return n}function j8t(t,e,n){const r=j7(t?.input?.["*"]?.["*"],t?.input?.[e]?.["*"],t?.input?.["*"]?.[n],t?.input?.[e]?.[n]),i=r._hue||t?.input?.[e]?._hue;return{...r,_hue:i}}function A8t(t){const e={};for(const n of nm)e[n]=R8t(t,n);return e}function R8t(t,e){const n={_hue:t?.selectable?.[e]?._hue||t?.base?.[e]?._hue};for(const r of JA)n[r]=D8t(t,e,r);return n}function D8t(t,e,n){const r=j7(t?.selectable?.["*"]?.["*"],t?.selectable?.[e]?.["*"],t?.selectable?.["*"]?.[n],t?.selectable?.[e]?.[n]),i=r._hue||t?.base?.[e]?._hue;return{...r,_hue:i,avatar:F2.reduce((o,s)=>({...o,[s]:j7({_hue:s},r.avatar?.["*"],r.avatar?.[s])}),{}),badge:nm.reduce((o,s)=>({...o,[s]:{_hue:t?.base?.[s]?._hue||i,...r.badge?.["*"],...r.badge?.[s]}}),{})}}function O8t(t){const e={color:x8t(t?.color)},n={};return yg(n,"light",()=>G7e({scheme:"light"},e)),yg(n,"dark",()=>G7e({scheme:"dark"},e)),n}function G7e(t,e){const{scheme:n}=t,r={};for(const i of BV)yg(r,i,()=>P8t({scheme:n,tone:i},e));return r}function P8t(t,e){const{scheme:n,tone:r}=t,i=e?.color?.base?.[r],o={hue:i?._hue||"gray",scheme:n};return{_blend:(i?._blend||["multiply","screen"])[n==="light"?0:1],_dark:n==="dark",accent:{fg:Sn(o,i?.accent?.fg)},avatar:fue({scheme:n},i),backdrop:Sn(o,i?.backdrop),badge:hue(i?.badge,{scheme:n},e),bg:Sn(o,i?.bg),border:Sn(o,i?.border),button:L8t({scheme:n,tone:r},e),code:{bg:Sn(o,i?.code?.bg),fg:Sn(o,i?.code?.fg)},fg:Sn(o,i?.fg),focusRing:Sn(o,i?.focusRing),icon:Sn(o,i?.icon),input:V8t({scheme:n,tone:r},e),kbd:{bg:Sn(o,i?.kbd?.bg),fg:Sn(o,i?.kbd?.fg),border:Sn(o,i?.kbd?.border)},link:{fg:Sn(o,i?.link?.fg)},muted:{bg:Sn(o,i?.muted?.bg),fg:Sn(o,i?.muted?.fg)},selectable:z8t({scheme:n,tone:r},e),shadow:$8t({scheme:n,tone:r},e),skeleton:{from:Sn(o,i?.skeleton?.from),to:Sn(o,i?.skeleton?.to)},syntax:W8t({scheme:n},e)}}function $8t(t,e){const{scheme:n,tone:r}=t,i=e?.color?.base?.[r],o={hue:i?._hue||"gray",scheme:n};return{outline:Sn(o,i?.shadow?.outline),umbra:Sn(o,i?.shadow?.umbra),penumbra:Sn(o,i?.shadow?.penumbra),ambient:Sn(o,i?.shadow?.ambient)}}function fue(t,e){const{scheme:n}=t;return{gray:I3({color:"gray",scheme:n},e),blue:I3({color:"blue",scheme:n},e),purple:I3({color:"purple",scheme:n},e),magenta:I3({color:"magenta",scheme:n},e),red:I3({color:"red",scheme:n},e),orange:I3({color:"orange",scheme:n},e),yellow:I3({color:"yellow",scheme:n},e),green:I3({color:"green",scheme:n},e),cyan:I3({color:"cyan",scheme:n},e)}}function I3(t,e){const{color:n,scheme:r}=t,i=e?.avatar?.[n],o={hue:i?._hue||"gray",scheme:r};return{_blend:(i?._blend||["screen","multiply"])[r==="light"?0:1],bg:Sn(o,i?.bg),fg:Sn(o,i?.fg)}}function hue(t,e,n){const{scheme:r}=e,i={};for(const o of nm)i[o]=M8t(t,{scheme:r,tone:o},n);return i}function M8t(t,e,n){const{scheme:r,tone:i}=e,o=t?.[i],s={hue:o?._hue||n?.color?.base?.[i]?._hue||"gray",scheme:r};return{bg:Sn(s,o?.bg),fg:Sn(s,o?.fg),dot:Sn(s,o?.dot),icon:Sn(s,o?.icon)}}function L8t(t,e){const{scheme:n,tone:r}=t,i={};for(const o of rHe)i[o]=F8t({cardTone:r,scheme:n,mode:o},e);return i}function F8t(t,e){const{cardTone:n,mode:r,scheme:i}=t,o={};for(const s of nm)o[s]=N8t({cardTone:n,mode:r,scheme:i,tone:s},e);return o}function N8t(t,e){const{cardTone:n,mode:r,scheme:i,tone:o}=t,s={};for(const a of JA)s[a]=B8t({cardTone:n,mode:r,tone:o,scheme:i,state:a},e);return s}function B8t(t,e){const{cardTone:n,mode:r,tone:i,scheme:o,state:s}=t,a=e?.color?.base?.[n],l=e?.color?.button?.[r]?.[i]?.[s],c=l?._hue||a?._hue||"gray",u=l?._blend||["screen","multiply"],f={hue:c,scheme:o};return{_blend:u[o==="light"?0:1],accent:{fg:Sn(f,l?.accent?.fg)},avatar:fue({scheme:o},l),badge:hue(l?.badge,{scheme:o},e),bg:Sn(f,l?.bg),border:Sn(f,l?.border),code:{bg:Sn(f,l?.code?.bg),fg:Sn(f,l?.code?.fg)},fg:Sn(f,l?.fg),icon:Sn(f,l?.icon),muted:{bg:Sn(f,l?.muted?.bg),fg:Sn(f,l?.muted?.fg)},kbd:{bg:Sn(f,l?.kbd?.bg),fg:Sn(f,l?.kbd?.fg),border:Sn(f,l?.kbd?.border)},link:{fg:Sn(f,l?.link?.fg)},skeleton:{from:Sn(f,l?.skeleton?.from),to:Sn(f,l?.skeleton?.to)}}}function V8t(t,e){const{scheme:n,tone:r}=t;return{default:Y7e({mode:"default",scheme:n,tone:r},e),invalid:Y7e({mode:"invalid",scheme:n,tone:r},e)}}function Y7e(t,e){const{mode:n,scheme:r,tone:i}=t;return{enabled:lP({mode:n,scheme:r,state:"enabled",cardTone:i},e),hovered:lP({mode:n,scheme:r,state:"hovered",cardTone:i},e),readOnly:lP({mode:n,scheme:r,state:"readOnly",cardTone:i},e),disabled:lP({mode:n,scheme:r,state:"disabled",cardTone:i},e)}}function lP(t,e){const{cardTone:n,mode:r,scheme:i,state:o}=t,s=e?.color?.base?.[n],a=e?.color?.input?.[r]?.[o],l=a?._hue||s?._hue||"gray",c=a?._blend||["screen","multiply"],u={hue:l,scheme:i};return{_blend:c[i==="light"?0:1],bg:Sn(u,a?.bg),border:Sn(u,a?.border),fg:Sn(u,a?.fg),muted:{bg:Sn(u,a?.muted?.bg)},placeholder:Sn(u,a?.placeholder)}}function z8t(t,e){const{scheme:n,tone:r}=t,i={};for(const o of nm)i[o]=H8t({cardTone:r,scheme:n,tone:o},e);return i}function H8t(t,e){const{cardTone:n,scheme:r,tone:i}=t,o={};for(const s of JA)o[s]=U8t({cardTone:n,tone:i,scheme:r,state:s},e);return o}function U8t(t,e){const{cardTone:n,scheme:r,state:i,tone:o}=t,s=e?.color?.base?.[n],a=e?.color?.selectable?.[o]?.[i],l=a?._hue||s?._hue||"gray",c=a?._blend||["screen","multiply"],u={hue:l,scheme:r};return{_blend:c[r==="light"?0:1],accent:{fg:Sn(u,a?.accent?.fg)},avatar:fue({scheme:r},a),badge:hue(a?.badge,{scheme:r},e),bg:Sn(u,a?.bg),border:Sn(u,a?.border),code:{bg:Sn(u,a?.code?.bg),fg:Sn(u,a?.code?.fg)},fg:Sn(u,a?.fg),icon:Sn(u,a?.icon),muted:{bg:Sn(u,a?.muted?.bg),fg:Sn(u,a?.muted?.fg)},kbd:{bg:Sn(u,a?.kbd?.bg),fg:Sn(u,a?.kbd?.fg),border:Sn(u,a?.kbd?.border)},link:{fg:Sn(u,a?.link?.fg)},skeleton:{from:Sn(u,a?.skeleton?.from),to:Sn(u,a?.skeleton?.to)}}}function W8t(t,e){const{scheme:n}=t,r=e?.color?.syntax,i={hue:"gray",scheme:n};return{atrule:Sn(i,r?.atrule),attrName:Sn(i,r?.attrName),attrValue:Sn(i,r?.attrValue),attribute:Sn(i,r?.attribute),boolean:Sn(i,r?.boolean),builtin:Sn(i,r?.builtin),cdata:Sn(i,r?.cdata),char:Sn(i,r?.char),class:Sn(i,r?.class),className:Sn(i,r?.className),comment:Sn(i,r?.comment),constant:Sn(i,r?.constant),deleted:Sn(i,r?.deleted),doctype:Sn(i,r?.doctype),entity:Sn(i,r?.entity),function:Sn(i,r?.function),hexcode:Sn(i,r?.hexcode),id:Sn(i,r?.id),important:Sn(i,r?.important),inserted:Sn(i,r?.inserted),keyword:Sn(i,r?.keyword),number:Sn(i,r?.number),operator:Sn(i,r?.operator),prolog:Sn(i,r?.prolog),property:Sn(i,r?.property),pseudoClass:Sn(i,r?.pseudoClass),pseudoElement:Sn(i,r?.pseudoElement),punctuation:Sn(i,r?.punctuation),regex:Sn(i,r?.regex),selector:Sn(i,r?.selector),string:Sn(i,r?.string),symbol:Sn(i,r?.symbol),tag:Sn(i,r?.tag),unit:Sn(i,r?.unit),url:Sn(i,r?.url),variable:Sn(i,r?.variable)}}const q8t=tHe;function xG(t,e,n){const r=(e-t)*n;return t+r}function G8t(t,e,n){return{r:xG(t.r,e.r,n),g:xG(t.g,e.g,n),b:xG(t.b,e.b,n)}}function CG(t,e){return t*e}function Y8t(t,e){return{r:CG(t.r/255,e.r/255)*255,g:CG(t.g/255,e.g/255)*255,b:CG(t.b/255,e.b/255)*255}}function wG(t,e){return t+e-t*e}function K8t(t,e){return{r:wG(t.r/255,e.r/255)*255,g:wG(t.g/255,e.g/255)*255,b:wG(t.b/255,e.b/255)*255}}function X8t(t,e,n){return t*(1-n)+e*n}function Z8t(t,e,n){return mh((n-t)/(e-t))}function mh(t,e=0,n=1){return Math.min(n,Math.max(e,t))}function j3(t,e,n,r,i){return X8t(n,r,Z8t(t,e,i))}function _G(t){return Math.round(t)}function tie(t){if(t.length===4){const e=t.slice(1,2),n=t.slice(2,3),r=t.slice(3,4);return{r:parseInt(e+e,16),g:parseInt(n+n,16),b:parseInt(r+r,16)}}return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16)}}function Q8t(t){const e=t.replace(/rgba\(|\)/g,"").split(",");return{r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2]),a:parseFloat(e[3])}}function aHe(t){const e=_G(mh(Math.round(t.r),0,255)),n=_G(mh(Math.round(t.g),0,255)),r=_G(mh(Math.round(t.b),0,255));return"a"in t?`rgba(${e},${n},${r},${t.a})`:"#"+((1<<24)+(e<<16)+(n<<8)+r).toString(16).slice(1)}function J8t(t){const e=t.s/100,n=t.l/100,r=(1-Math.abs(2*n-1))*e,i=r*(1-Math.abs(t.h/60%2-1)),o=n-r/2;let s=0,a=0,l=0;return 0<=t.h&&t.h<60?(s=r,a=i,l=0):60<=t.h&&t.h<120?(s=i,a=r,l=0):120<=t.h&&t.h<180?(s=0,a=r,l=i):180<=t.h&&t.h<240?(s=0,a=i,l=r):240<=t.h&&t.h<300?(s=i,a=0,l=r):300<=t.h&&t.h<360&&(s=r,a=0,l=i),{r:Math.round((s+o)*255),g:Math.round((a+o)*255),b:Math.round((l+o)*255)}}const e6t="0123456789ABCDEFabcdef",t6t=/hsl\(\s*(\d+)\s*,\s*((\d+(?:\.\d+)?)%)\s*,\s*((\d+(?:\.\d+)?)%)\s*\)/i;function n6t(t){for(const e of t)if(e6t.indexOf(e)===-1)return!1;return!0}function r6t(t){return t[0]!=="#"||!(t.length===4||t.length===7)?!1:n6t(t.slice(1))}function i6t(t){const e=t6t.exec(t);if(!e)throw new Error(`parseHsl: string is not a HSL color: "${t}"`);return{h:parseInt(e[1]),s:parseFloat(e[3]),l:parseFloat(e[5])}}function PT(t){if(!t)return{r:0,g:0,b:0};if(typeof t!="string")throw new Error("parseColor: expected a string");if(r6t(t))return tie(t);if(t.startsWith("hsl("))return J8t(i6t(t));if(t.startsWith("rgba("))return Q8t(t);throw new Error(`parseColor: unexpected color format: "${t}"`)}function eR(t,e){const n=PT(t);return`rgba(${n.r},${n.g},${n.b},${e})`}const bf=[0,255];function o6t(t,e){const{blendMode:n}=e,r=PT(t),i=PT(e.black),o=PT(e.white),s=e.bg?PT(e.bg):n==="multiply"?o:i,a={r:[i.r,o.r],g:[i.g,o.g],b:[i.b,o.b]},l={r:mh(j3(...a.r,...bf,s.r),...bf),g:mh(j3(...a.g,...bf,s.g),...bf),b:mh(j3(...a.b,...bf,s.b),...bf)},c={r:mh(j3(...a.r,...bf,r.r),...bf),g:mh(j3(...a.g,...bf,r.g),...bf),b:mh(j3(...a.b,...bf,r.b),...bf)},u=n==="multiply"?Y8t(l,c):K8t(l,c),f={r:mh(j3(...bf,...a.r,u.r),...a.r),g:mh(j3(...bf,...a.g,u.g),...a.g),b:mh(j3(...bf,...a.b,u.b),...a.b)};return aHe(f)}function Zn(t,e){const{bg:n,blendMode:r,colorPalette:i}=e;if(n==="white")throw new Error("Cannot blend with white background");const o=sHe(t);if(!o||o.type!=="color")throw new Error(`Invalid color token value: ${t}`);let s="";if(o.key==="black"&&(s=AE(i.black)),o.key==="white"&&(s=AE(i.white)),o.hue&&o.tint&&(s=AE(i[o.hue][o.tint])),!s)throw new Error(`Invalid color token value: ${t}`);const a=s,l={blendMode:r,bg:n,black:AE(i.black),white:AE(i.white)};try{if(s=o6t(s,l),n&&o.mix!==void 0){const c=tie(n),u=tie(s);s=aHe(G8t(c,u,o.mix))}}catch(c){throw console.warn("could not blend",s,l),c}return s==="#aN"&&(console.warn(`invalid color token value: ${t}`),s=a),o.opacity!==void 0&&(s=eR(s,o.opacity)),s}function AE(t){return typeof t=="string"?t:t.hex}function s6t(t,e){const n=q8t,r={};return yg(r,"light",()=>K7e(n,t.light)),yg(r,"dark",()=>K7e(n,t.dark)),r}function K7e(t,e){const n=X7e(e.default,{colorPalette:t}),r=n.bg;if(r==="white")throw new Error("Cannot blend with white background");const i={default:n};for(const o of BV){if(o==="default")continue;const s=o==="transparent"?{colorPalette:t}:{bg:r,colorPalette:t};yg(i,o,()=>X7e(e[o],s))}return i}function X7e(t,e){const{colorPalette:n,bg:r}=e,i=t._blend||"multiply",o=Zn(t.bg,{colorPalette:n,bg:r,blendMode:i}),s={colorPalette:n,bg:o,blendMode:i},a=u6t(t.button,{baseBg:o,blendMode:i,colorPalette:n}),l=h6t(t.selectable,{colorPalette:n,baseBg:o,blendMode:i}),c={outline:Zn(t.shadow.outline,s),umbra:Zn(t.shadow.umbra,{...s,bg:void 0,colorPalette:{...n,black:"#000000"}}),penumbra:Zn(t.shadow.penumbra,{...s,bg:void 0,colorPalette:{...n,black:"#000000"}}),ambient:Zn(t.shadow.ambient,{...s,bg:void 0,colorPalette:{...n,black:"#000000"}})};return{_blend:i,_dark:t._dark,accent:{fg:Zn(t.accent.fg,s)},avatar:lHe(t.avatar,{baseBg:o,colorPalette:n,blendMode:i}),backdrop:Zn(t.backdrop,s),badge:cHe(t.badge,{baseBg:o,colorPalette:n,blendMode:i}),bg:o,border:Zn(t.border,s),button:a,code:{bg:Zn(t.code.bg,s),fg:Zn(t.code.fg,s)},fg:Zn(t.fg,s),focusRing:Zn(t.focusRing,s),icon:Zn(t.icon,s),input:f6t(t.input,{baseBg:o,colorPalette:n,blendMode:i}),kbd:a6t(t.kbd,{baseBg:o,colorPalette:n,blendMode:i}),link:{fg:Zn(t.link.fg,s)},muted:{bg:Zn(t.muted.bg,s),fg:Zn(t.muted.fg,s)},shadow:c,skeleton:{from:Zn(t.skeleton.from,s),to:Zn(t.skeleton.to,s)},syntax:m6t(t.syntax,{baseBg:o,colorPalette:n,blendMode:i}),selectable:l}}function a6t(t,e){const{baseBg:n,blendMode:r,colorPalette:i}=e,o={bg:n,blendMode:r,colorPalette:i},s=Zn(t.bg,o),a={bg:s,blendMode:r,colorPalette:i};return{bg:s,fg:Zn(t.fg,a),border:Zn(t.border,a)}}function lHe(t,e){const n={};for(const r of F2)n[r]=l6t(t[r],e);return n}function l6t(t,e){const{baseBg:n,blendMode:r,colorPalette:i}=e,o=t._blend||"multiply",s={bg:n,blendMode:r,colorPalette:i},a=Zn(t.bg,s),l={bg:a,blendMode:o,colorPalette:i};return{_blend:o,bg:a,fg:Zn(t.fg,l)}}function cHe(t,e){const n={};for(const r of nm)n[r]=c6t(t[r],e);return n}function c6t(t,e){const{baseBg:n,blendMode:r,colorPalette:i}=e,o=r,s={bg:n,blendMode:r,colorPalette:i},a=Zn(t.bg,s),l={bg:a,blendMode:o,colorPalette:i};return{bg:a,dot:Zn(t.dot,l),fg:Zn(t.fg,l),icon:Zn(t.icon,l)}}function u6t(t,e){return{default:SG(t.default,e),ghost:SG(t.ghost,e),bleed:SG(t.bleed,e)}}function SG(t,e){const n={};for(const r of nm)n[r]=d6t(t[r],e);return n}function d6t(t,e){return{enabled:N5(t.enabled,e),hovered:N5(t.hovered,e),pressed:N5(t.pressed,e),selected:N5(t.selected,e),disabled:N5(t.disabled,e)}}function N5(t,e){const{baseBg:n,blendMode:r,colorPalette:i}=e,o=t._blend||"multiply",s={bg:n,blendMode:r,colorPalette:i},a=Zn(t.bg,s),l={bg:a,blendMode:o,colorPalette:i};return{_blend:o,accent:{fg:Zn(t.accent.fg,l)},avatar:lHe(t.avatar,{baseBg:a,colorPalette:i,blendMode:o}),badge:cHe(t.badge,{baseBg:a,colorPalette:i,blendMode:o}),bg:a,border:Zn(t.border,l),code:{bg:Zn(t.code.bg,l),fg:Zn(t.code.fg,l)},fg:Zn(t.fg,l),icon:Zn(t.icon,l),link:{fg:Zn(t.link.fg,l)},muted:{bg:Zn(t.muted.bg,l),fg:Zn(t.muted.fg,l)},kbd:{bg:Zn(t.kbd.bg,l),fg:Zn(t.kbd.fg,l),border:Zn(t.kbd.border,l)},skeleton:{from:Zn(t.skeleton?.from,l),to:Zn(t.skeleton?.to,l)}}}function f6t(t,e){return{default:Z7e(t.default,e),invalid:Z7e(t.invalid,e)}}function Z7e(t,e){return{enabled:cP(t.enabled,e),hovered:cP(t.hovered,e),readOnly:cP(t.readOnly,e),disabled:cP(t.disabled,e)}}function cP(t,e){const{baseBg:n,blendMode:r,colorPalette:i}=e,o=t._blend||"multiply",s={colorPalette:i,bg:n,blendMode:r},a=Zn(t.bg,s),l={colorPalette:i,bg:a,blendMode:o};return{_blend:o,bg:a,border:Zn(t.border,l),fg:Zn(t.fg,l),muted:{bg:Zn(t.muted.bg,l)},placeholder:Zn(t.placeholder,l)}}function h6t(t,e){const n={};for(const r of nm)n[r]=p6t(t[r],e);return n}function p6t(t,e){return{enabled:N5(t.enabled,e),hovered:N5(t.hovered,e),pressed:N5(t.pressed,e),selected:N5(t.selected,e),disabled:N5(t.disabled,e)}}function m6t(t,e){const{colorPalette:n,baseBg:r,blendMode:i}=e,o={colorPalette:n,bg:r,blendMode:i};return{atrule:Zn(t.atrule,o),attrName:Zn(t.attrName,o),attrValue:Zn(t.attrValue,o),attribute:Zn(t.attribute,o),boolean:Zn(t.boolean,o),builtin:Zn(t.builtin,o),cdata:Zn(t.cdata,o),char:Zn(t.char,o),class:Zn(t.class,o),className:Zn(t.className,o),comment:Zn(t.comment,o),constant:Zn(t.constant,o),deleted:Zn(t.deleted,o),doctype:Zn(t.doctype,o),entity:Zn(t.entity,o),function:Zn(t.function,o),hexcode:Zn(t.hexcode,o),id:Zn(t.id,o),important:Zn(t.important,o),inserted:Zn(t.inserted,o),keyword:Zn(t.keyword,o),number:Zn(t.number,o),operator:Zn(t.operator,o),prolog:Zn(t.prolog,o),property:Zn(t.property,o),pseudoClass:Zn(t.pseudoClass,o),pseudoElement:Zn(t.pseudoElement,o),punctuation:Zn(t.punctuation,o),regex:Zn(t.regex,o),selector:Zn(t.selector,o),string:Zn(t.string,o),symbol:Zn(t.symbol,o),tag:Zn(t.tag,o),unit:Zn(t.unit,o),url:Zn(t.url,o),variable:Zn(t.variable,o)}}function uHe(t){const e=O8t(t),n={_version:2,avatar:ja.avatar,button:ja.button,card:ja.card,color:s6t(e),container:ja.container,font:a8t,input:ja.input,layer:ja.layer,media:ja.media,radius:ja.radius,shadow:ja.shadow,space:ja.space,style:ja.style};return nHe(n)}function g6t(t){if("neutral"in t.badge)return t;const e=t;return{...e,badge:{...e.badge,neutral:e.badge.default,suggest:e.badge.primary},button:{bleed:{...e.button.bleed,neutral:e.button.bleed.default,suggest:e.button.bleed.primary},default:{...e.button.default,neutral:e.button.default.default,suggest:e.button.default.primary},ghost:{...e.button.ghost,neutral:e.button.ghost.default,suggest:e.button.ghost.primary}},selectable:{...e.selectable,neutral:e.selectable.default,suggest:e.selectable.primary}}}const TM=new Map;function y6t(t,e,n){const r=b6t(t,e,n);if(r)return r;const i=B7e(t)?nHe(t):t,o=B7e(t)?t:l8t(t),s=i.layer||ja.layer,a=o.color[e]||o.color.light,l=a[n]||a.default,c=g6t(l),u=o.layer||ja.layer,{color:f,...h}=i,p={...h,layer:s,v2:{...o,_resolved:!0,color:c,layer:u}};yg(p,"color",()=>{const g=i.color[e]||i.color.light;return g[n]||g.default});const m={sanity:p};return v6t(t,e,n,m),m}function b6t(t,e,n){const r=TM.get(e);if(!r)return;const i=r.get(n);if(i)return i.get(t)}function v6t(t,e,n,r){TM.has(e)||TM.set(e,new Map);const i=TM.get(e);i.has(n)||i.set(n,new WeakMap),i.get(n).set(t,r)}var kG,Q7e;function x6t(){if(Q7e)return kG;Q7e=1;var t=Object.create,e=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(B,W)=>{for(var N in W)e(B,N,{get:W[N],enumerable:!0})},a=(B,W,N,V)=>{if(W&&typeof W=="object"||typeof W=="function")for(let G of r(W))!o.call(B,G)&&G!==N&&e(B,G,{get:()=>W[G],enumerable:!(V=n(W,G))||V.enumerable});return B},l=(B,W,N)=>(N=B!=null?t(i(B)):{},a(!B||!B.__esModule?e(N,"default",{value:B,enumerable:!0}):N,B)),c=B=>a(e({},"__esModule",{value:!0}),B),u={};s(u,{$dispatcherGuard:()=>k,$makeReadOnly:()=>j,$reset:()=>I,$structuralCheck:()=>L,c:()=>x,clearRenderCounterRegistry:()=>D,renderCounterRegistry:()=>A,useRenderCounter:()=>$}),kG=c(u);var f=l(Rg()),{useRef:h,useEffect:p,isValidElement:m}=f,g,y=(g=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE)!=null?g:f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,b=Symbol.for("react.memo_cache_sentinel"),v,x=typeof((v=f.__COMPILER_RUNTIME)==null?void 0:v.c)=="function"?f.__COMPILER_RUNTIME.c:function(W){return f.useMemo(()=>{const N=new Array(W);for(let V=0;V{C[B]=()=>{throw new Error(`[React] Unexpected React hook call (${B}) from a React compiled function. Check that all hooks are called directly and named according to convention ('use[A-Z]') `)}});var w=null;C.useMemoCache=B=>{if(w==null)throw new Error("React Compiler internal invariant violation: unexpected null dispatcher");return w.useMemoCache(B)};function _(B){return y.ReactCurrentDispatcher.current=B,y.ReactCurrentDispatcher.current}var S=[];function k(B){const W=y.ReactCurrentDispatcher.current;if(B===0){if(S.push(W),S.length===1&&(w=W),W===C)throw new Error("[React] Unexpected call to custom hook or component from a React compiled function. Check that (1) all hooks are called directly and named according to convention ('use[A-Z]') and (2) components are returned as JSX instead of being directly invoked.");_(C)}else if(B===1){const N=S.pop();if(N==null)throw new Error("React Compiler internal error: unexpected null in guard stack");S.length===0&&(w=null),_(N)}else if(B===2)S.push(W),_(w);else if(B===3){const N=S.pop();if(N==null)throw new Error("React Compiler internal error: unexpected null in guard stack");_(N)}else throw new Error("React Compiler internal error: unreachable block"+B)}function I(B){for(let W=0;W{W.count=0})}function O(B,W){let N=A.get(B);N==null&&(N=new Set,A.set(B,N)),N.add(W)}function P(B,W){const N=A.get(B);N?.delete(W)}function $(B){const W=h(null);W.current!=null&&(W.current.count+=1),p(()=>{if(W.current==null){const N={count:0};O(B,N),W.current=N}return()=>{W.current!==null&&P(B,W.current)}})}var M=new Set;function L(B,W,N,V,G,z){function Y(K,q,re,te){const ae=`${V}:${z} [${G}] ${N}${re} changed from ${K} to ${q} at depth ${te}`;M.has(ae)||(M.add(ae),console.error(ae))}const Z=2;function ee(K,q,re,te){if(!(te>Z)){if(K===q)return;if(typeof K!=typeof q)Y(`type ${typeof K}`,`type ${typeof q}`,re,te);else if(typeof K=="object"){const ae=Array.isArray(K),se=Array.isArray(q);if(K===null&&q!==null)Y("null",`type ${typeof q}`,re,te);else if(q===null)Y(`type ${typeof K}`,"null",re,te);else if(K instanceof Map)if(!(q instanceof Map))Y("Map instance","other value",re,te);else if(K.size!==q.size)Y(`Map instance with size ${K.size}`,`Map instance with size ${q.size}`,re,te);else for(const[le,pe]of K)q.has(le)?ee(pe,q.get(le),`${re}.get(${le})`,te+1):Y(`Map instance with key ${le}`,`Map instance without key ${le}`,re,te);else if(q instanceof Map)Y("other value","Map instance",re,te);else if(K instanceof Set)if(!(q instanceof Set))Y("Set instance","other value",re,te);else if(K.size!==q.size)Y(`Set instance with size ${K.size}`,`Set instance with size ${q.size}`,re,te);else for(const le of q)K.has(le)||Y(`Set instance without element ${le}`,`Set instance with element ${le}`,re,te);else if(q instanceof Set)Y("other value","Set instance",re,te);else if(ae||se)if(ae!==se)Y(`type ${ae?"array":"object"}`,`type ${se?"array":"object"}`,re,te);else if(K.length!==q.length)Y(`array with length ${K.length}`,`array with length ${q.length}`,re,te);else for(let le=0;le0?cd(oS,--Yp):0,Uw--,Lu===10&&(Uw=1,zV--),Lu}function d0(){return Lu=Yp2||fj(Lu)>3?"":" "}function D6t(t,e){for(;--e&&d0()&&!(Lu<48||Lu>102||Lu>57&&Lu<65||Lu>70&&Lu<97););return UV(t,jM()+(e<6&&q4()==32&&d0()==32))}function rie(t){for(;d0();)switch(Lu){case t:return Yp;case 34:case 39:t!==34&&t!==39&&rie(Lu);break;case 40:t===41&&rie(t);break;case 92:d0();break}return Yp}function O6t(t,e){for(;d0()&&t+Lu!==57;)if(t+Lu===84&&q4()===47)break;return"/*"+UV(e,Yp-1)+"*"+mue(t===47?t:d0())}function P6t(t){for(;!fj(q4());)d0();return UV(t,Yp)}function $6t(t){return A6t(AM("",null,null,null,[""],t=j6t(t),0,[0],t))}function AM(t,e,n,r,i,o,s,a,l){for(var c=0,u=0,f=s,h=0,p=0,m=0,g=1,y=1,b=1,v=0,x="",C=i,w=o,_=r,S=x;y;)switch(m=v,v=d0()){case 40:if(m!=108&&cd(S,f-1)==58){IM(S+=Oo(EG(v),"&","&\f"),"&\f",hHe(c?a[c-1]:0))!=-1&&(b=-1);break}case 34:case 39:case 91:S+=EG(v);break;case 9:case 10:case 13:case 32:S+=R6t(m);break;case 92:S+=D6t(jM()-1,7);continue;case 47:switch(q4()){case 42:case 47:$T(M6t(O6t(d0(),jM()),e,n,l),l),(fj(m||1)==5||fj(q4()||1)==5)&&Ym(S)&&b9(S,-1,void 0)!==" "&&(S+=" ");break;default:S+="/"}break;case 123*g:a[c++]=Ym(S)*b;case 125*g:case 59:case 0:switch(v){case 0:case 125:y=0;case 59+u:b==-1&&(S=Oo(S,/\f/g,"")),p>0&&(Ym(S)-f||g===0&&m===47)&&$T(p>32?tye(S+";",r,n,f-1,l):tye(Oo(S," ","")+";",r,n,f-2,l),l);break;case 59:S+=";";default:if($T(_=eye(S,e,n,c,u,i,a,x,C=[],w=[],f,o),o),v===123)if(u===0)AM(S,e,_,_,C,o,f,a,w);else{switch(h){case 99:if(cd(S,3)===110)break;case 108:if(cd(S,2)===97)break;default:u=0;case 100:case 109:case 115:}u?AM(t,_,_,r&&$T(eye(t,_,_,0,0,i,a,x,i,C=[],f,w),w),i,w,f,a,r?C:w):AM(S,_,_,_,[""],w,0,a,w)}}c=u=p=0,g=b=1,x=S="",f=s;break;case 58:f=1+Ym(S),p=m;default:if(g<1){if(v==123)--g;else if(v==125&&g++==0&&I6t()==125)continue}switch(S+=mue(v),v*g){case 38:b=u>0?1:(S+="\f",-1);break;case 44:a[c++]=(Ym(S)-1)*b,b=1;break;case 64:q4()===45&&(S+=EG(d0())),h=q4(),u=f=Ym(x=S+=P6t(jM())),v++;break;case 45:m===45&&Ym(S)==2&&(g=0)}}return o}function eye(t,e,n,r,i,o,s,a,l,c,u,f){for(var h=i-1,p=i===0?o:[""],m=mHe(p),g=0,y=0,b=0;g0?p[v]+" "+x:Oo(x,/&\f/g,p[v])))&&(l[b++]=C);return HV(t,e,n,i===0?VV:a,l,c,u,f)}function M6t(t,e,n,r){return HV(t,e,n,dHe,mue(T6t()),b9(t,2,-2),0,r)}function tye(t,e,n,r,i){return HV(t,e,n,pue,b9(t,0,r),b9(t,r+1,-1),r,i)}function yHe(t,e,n){switch(k6t(t,e)){case 5103:return zs+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:case 6391:case 5879:case 5623:case 6135:case 4599:return zs+t+t;case 4855:return zs+t.replace("add","source-over").replace("substract","source-out").replace("intersect","source-in").replace("exclude","xor")+t;case 4789:return mI+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return zs+t+mI+t+Fl+t+t;case 5936:switch(cd(t,e+11)){case 114:return zs+t+Fl+Oo(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return zs+t+Fl+Oo(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return zs+t+Fl+Oo(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return zs+t+Fl+t+t;case 6165:return zs+t+Fl+"flex-"+t+t;case 5187:return zs+t+Oo(t,/(\w+).+(:[^]+)/,zs+"box-$1$2"+Fl+"flex-$1$2")+t;case 5443:return zs+t+Fl+"flex-item-"+Oo(t,/flex-|-self/g,"")+(z3(t,/flex-|baseline/)?"":Fl+"grid-row-"+Oo(t,/flex-|-self/g,""))+t;case 4675:return zs+t+Fl+"flex-line-pack"+Oo(t,/align-content|flex-|-self/g,"")+t;case 5548:return zs+t+Fl+Oo(t,"shrink","negative")+t;case 5292:return zs+t+Fl+Oo(t,"basis","preferred-size")+t;case 6060:return zs+"box-"+Oo(t,"-grow","")+zs+t+Fl+Oo(t,"grow","positive")+t;case 4554:return zs+Oo(t,/([^-])(transform)/g,"$1"+zs+"$2")+t;case 6187:return Oo(Oo(Oo(t,/(zoom-|grab)/,zs+"$1"),/(image-set)/,zs+"$1"),t,"")+t;case 5495:case 3959:return Oo(t,/(image-set\([^]*)/,zs+"$1$`$1");case 4968:return Oo(Oo(t,/(.+:)(flex-)?(.*)/,zs+"box-pack:$3"+Fl+"flex-pack:$3"),/space-between/,"justify")+zs+t+t;case 4200:if(!z3(t,/flex-|baseline/))return Fl+"grid-column-align"+b9(t,e)+t;break;case 2592:case 3360:return Fl+Oo(t,"template-","")+t;case 4384:case 3616:return n&&n.some(function(r,i){return e=i,z3(r.props,/grid-\w+-end/)})?~IM(t+(n=n[e].value),"span",0)?t:Fl+Oo(t,"-start","")+t+Fl+"grid-row-span:"+(~IM(n,"span",0)?z3(n,/\d+/):+z3(n,/\d+/)-+z3(t,/\d+/))+";":Fl+Oo(t,"-start","")+t;case 4896:case 4128:return n&&n.some(function(r){return z3(r.props,/grid-\w+-start/)})?t:Fl+Oo(Oo(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return Oo(t,/(.+)-inline(.+)/,zs+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Ym(t)-1-e>6)switch(cd(t,e+1)){case 109:if(cd(t,e+4)!==45)break;case 102:return Oo(t,/(.+:)(.+)-([^]+)/,"$1"+zs+"$2-$3$1"+mI+(cd(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~IM(t,"stretch",0)?yHe(Oo(t,"stretch","fill-available"),e,n)+t:t}break;case 5152:case 5920:return Oo(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(r,i,o,s,a,l,c){return Fl+i+":"+o+c+(s?Fl+i+"-span:"+(a?l:+l-+o)+c:"")+t});case 4949:if(cd(t,e+6)===121)return Oo(t,":",":"+zs)+t;break;case 6444:switch(cd(t,cd(t,14)===45?18:11)){case 120:return Oo(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+zs+(cd(t,14)===45?"inline-":"")+"box$3$1"+zs+"$2$3$1"+Fl+"$2box$3")+t;case 100:return Oo(t,":",":"+Fl)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return Oo(t,"scroll-","scroll-snap-")+t}return t}function _F(t,e){for(var n="",r=0;r-1&&!t.return)switch(t.type){case pue:t.return=yHe(t.value,t.length,n);return;case fHe:return _F([T4(t,{value:Oo(t.value,"@","@"+zs)})],r);case VV:if(t.length)return E6t(n=t.props,function(i){switch(z3(i,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Lx(T4(t,{props:[Oo(i,/:(read-\w+)/,":"+mI+"$1")]})),Lx(T4(t,{props:[i]})),nie(t,{props:J7e(n,r)});break;case"::placeholder":Lx(T4(t,{props:[Oo(i,/:(plac\w+)/,":"+zs+"input-$1")]})),Lx(T4(t,{props:[Oo(i,/:(plac\w+)/,":"+mI+"$1")]})),Lx(T4(t,{props:[Oo(i,/:(plac\w+)/,Fl+"input-$1")]})),Lx(T4(t,{props:[i]})),nie(t,{props:J7e(n,r)});break}return""})}}var bHe={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Y3={},Ww=typeof process<"u"&&Y3!==void 0&&(Y3.REACT_APP_SC_ATTR||Y3.SC_ATTR)||"data-styled",vHe="active",xHe="data-styled-version",WV="6.3.11",gue=`/*!sc*/ +`,gI=typeof window<"u"&&typeof document<"u",V6t=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&Y3!==void 0&&Y3.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&Y3.REACT_APP_SC_DISABLE_SPEEDY!==""&&Y3.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&Y3.REACT_APP_SC_DISABLE_SPEEDY),z6t={};function f8(t){for(var e=[],n=1;n0?" Args: ".concat(e.join(", ")):""))}var RM=new Map,SF=new Map,DM=1,MT=function(t){if(RM.has(t))return RM.get(t);for(;SF.has(DM);)DM++;var e=DM++;return RM.set(t,e),SF.set(e,t),e},H6t=function(t,e){DM=e+1,RM.set(t,e),SF.set(e,t)},yue=Object.freeze([]),qw=Object.freeze({});function CHe(t,e,n){return n===void 0&&(n=qw),t.theme!==n.theme&&t.theme||e||n.theme}var wHe=new Set(["a","abbr","address","area","article","aside","audio","b","bdi","bdo","blockquote","body","button","br","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","slot","small","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","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","filter","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tspan","use"]),U6t=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,W6t=/(^-|-$)/g;function nye(t){return t.replace(U6t,"-").replace(W6t,"")}var q6t=/(a)(d)/gi,rye=function(t){return String.fromCharCode(t+(t>25?39:97))};function iie(t){var e,n="";for(e=Math.abs(t);e>52;e=e/52|0)n=rye(e%52)+n;return(rye(e%52)+n).replace(q6t,"$1-$2")}var TG,jb=function(t,e){for(var n=e.length;n;)t=33*t^e.charCodeAt(--n);return t},_He=function(t){return jb(5381,t)};function bue(t){return iie(_He(t)>>>0)}function G6t(t){return t.displayName||t.name||"Component"}function IG(t){return typeof t=="string"&&!0}var SHe=typeof Symbol=="function"&&Symbol.for,kHe=SHe?Symbol.for("react.memo"):60115,Y6t=SHe?Symbol.for("react.forward_ref"):60112,K6t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},X6t={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},EHe={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Z6t=((TG={})[Y6t]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},TG[kHe]=EHe,TG);function iye(t){return("type"in(e=t)&&e.type.$$typeof)===kHe?EHe:"$$typeof"in t?Z6t[t.$$typeof]:K6t;var e}var Q6t=Object.defineProperty,J6t=Object.getOwnPropertyNames,oye=Object.getOwnPropertySymbols,ebt=Object.getOwnPropertyDescriptor,tbt=Object.getPrototypeOf,sye=Object.prototype;function THe(t,e,n){if(typeof e!="string"){if(sye){var r=tbt(e);r&&r!==sye&&THe(t,r,n)}var i=J6t(e);oye&&(i=i.concat(oye(e)));for(var o=iye(t),s=iye(e),a=0;athis._cGroup)for(var r=this._cGroup;r=e;r--)n-=this.groupSizes[r];return this._cGroup=e,this._cIndex=n,n},t.prototype.insertRules=function(e,n){if(e>=this.groupSizes.length){for(var r=this.groupSizes,i=r.length,o=i;e>=o;)if((o<<=1)<0)throw f8(16,"".concat(e));this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var s=i;s0&&this._cGroup>e&&(this._cIndex+=l)},t.prototype.clearGroup=function(e){if(e0&&this._cGroup>e&&(this._cIndex-=n)}},t.prototype.getGroup=function(e){var n="";if(e>=this.length||this.groupSizes[e]===0)return n;for(var r=this.groupSizes[e],i=this.indexOfGroup(e),o=i+r,s=i;s=0){var r=document.createTextNode(n);return this.element.insertBefore(r,this.nodes[e]||null),this.length++,!0}return!1},t.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.prototype.getRule=function(e){return e0&&(y+=b+",")}),l+=m+g+'{content:"'+y+'"}'+gue},u=0;u0?".".concat(e):m},u=l.slice();u.push(function(m){m.type===VV&&m.value.includes("&")&&(r||(r=new RegExp("\\".concat(n,"\\b"),"g")),m.props[0]=m.props[0].replace(fbt,n).replace(r,c))}),s.prefix&&u.push(B6t),u.push(L6t);var f=[],h=F6t(u.concat(N6t(function(m){return f.push(m)}))),p=function(m,g,y,b){g===void 0&&(g=""),y===void 0&&(y=""),b===void 0&&(b="&"),e=b,n=g,r=void 0;var v=(function(C){if(!cye(C))return C;for(var w=C.length,_="",S=0,k=0,I=0,j=!1,A=0;A=3&&(32|C.charCodeAt(k-1))==108&&(32|C.charCodeAt(k-2))==114&&(32|C.charCodeAt(k-3))==117)j=1,k++;else if(j>0)A===41?j--:A===40&&j++,k++;else if(A===Ab&&k+1S&&_.push(C.substring(S,k)),S=k+=2;else if(A===H3&&k+1S&&_.push(C.substring(S,k));k="A"&&t<="Z"};function uye(t){for(var e="",n=0;n>>0);if(!n.hasNameForId(this.componentId,s)){var a=r(o,".".concat(s),void 0,this.componentId);n.insertRules(this.componentId,s,a)}i=Pb(i,s),this.staticRulesId=s}else{for(var l=jb(this.baseHash,r.hash),c="",u=0;u>>0);if(!n.hasNameForId(this.componentId,p)){var m=r(c,".".concat(p),void 0,this.componentId);n.insertRules(this.componentId,p,m)}i=Pb(i,p)}}return{className:i,css:typeof window>"u"?n.getTag().getGroup(MT(this.componentId)):""}},t})(),Gw=vt.createContext(void 0);Gw.Consumer;function qV(){var t=vt.useContext(Gw);if(!t)throw f8(18);return t}function $He(t){var e=vt.useContext(Gw),n=vt.useMemo(function(){return(function(r,i){if(!r)throw f8(14);if(v9(r)){var o=r(i);return o}if(Array.isArray(r)||typeof r!="object")throw f8(8);return i?hd(hd({},i),r):r})(t.theme,e)},[t.theme,e]);return t.children?vt.createElement(Gw.Provider,{value:n},t.children):null}var AG={};function vbt(t,e,n){var r=vue(t),i=t,o=!IG(t),s=e.attrs,a=s===void 0?yue:s,l=e.componentId,c=l===void 0?(function(C,w){var _=typeof C!="string"?"sc":nye(C);AG[_]=(AG[_]||0)+1;var S="".concat(_,"-").concat(bue(WV+_+AG[_]));return w?"".concat(w,"-").concat(S):S})(e.displayName,e.parentComponentId):l,u=e.displayName,f=u===void 0?(function(C){return IG(C)?"styled.".concat(C):"Styled(".concat(G6t(C),")")})(t):u,h=e.displayName&&e.componentId?"".concat(nye(e.displayName),"-").concat(e.componentId):e.componentId||c,p=r&&i.attrs?i.attrs.concat(a).filter(Boolean):a,m=e.shouldForwardProp;if(r&&i.shouldForwardProp){var g=i.shouldForwardProp;if(e.shouldForwardProp){var y=e.shouldForwardProp;m=function(C,w){return g(C,w)&&y(C,w)}}else m=g}var b=new bbt(n,h,r?i.componentStyle:void 0);function v(C,w){return(function(_,S,k){var I=_.attrs,j=_.componentStyle,A=_.defaultProps,D=_.foldedComponentIds,O=_.styledComponentId,P=_.target,$=vt.useContext(Gw),M=lie(),L=_.shouldForwardProp||M.shouldForwardProp,B=CHe(S,$,A)||qw,W=(function(ee,K,q){for(var re,te=hd(hd({},K),{className:void 0,theme:q}),ae=0;ae2&&EF.registerId(this.componentId+e);var o=this.componentId+e;this.isStatic?r.hasNameForId(o,o)||this.createStyles(e,n,r,i):(this.removeStyles(e,r),this.createStyles(e,n,r,i))},t})();function LHe(t){for(var e=[],n=1;n"u"||!u.styleSheet.server)&&l(h,c,u.styleSheet,f,u.stylis),vt.useLayoutEffect(function(){return u.styleSheet.server||l(h,c,u.styleSheet,f,u.stylis),function(){var p;o.removeStyles(h,u.styleSheet),p=u.styleSheet.options.target,typeof document<"u"&&(p??document).querySelectorAll('style[data-styled-global="'.concat(i,'"]')).forEach(function(m){return m.remove()})}},[h,c,u.styleSheet,f,u.stylis]),null};function l(c,u,f,h,p){if(o.isStatic)o.renderStyles(c,z6t,f,p);else{var m=hd(hd({},u),{theme:CHe(u,h,a.defaultProps)});o.renderStyles(c,m,f,p)}}return vt.memo(a)}function Vf(t){for(var e=[],n=1;nt.concat(e,e+"-"+mye[0],e+"-"+mye[1]),[]),Yw=Math.min,Gb=Math.max,TF=Math.round,uP=Math.floor,og=t=>({x:t,y:t}),_bt={left:"right",right:"left",bottom:"top",top:"bottom"},Sbt={start:"end",end:"start"};function uie(t,e,n){return Gb(t,Yw(e,n))}function cv(t,e){return typeof t=="function"?t(e):t}function A7(t){return t.split("-")[0]}function sg(t){return t.split("-")[1]}function BHe(t){return t==="x"?"y":"x"}function Cue(t){return t==="y"?"height":"width"}const kbt=new Set(["top","bottom"]);function G4(t){return kbt.has(A7(t))?"y":"x"}function wue(t){return BHe(G4(t))}function VHe(t,e,n){n===void 0&&(n=!1);const r=sg(t),i=wue(t),o=Cue(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=jF(s)),[s,jF(s)]}function Ebt(t){const e=jF(t);return[IF(t),e,IF(e)]}function IF(t){return t.replace(/start|end/g,e=>Sbt[e])}const yye=["left","right"],bye=["right","left"],Tbt=["top","bottom"],Ibt=["bottom","top"];function jbt(t,e,n){switch(t){case"top":case"bottom":return n?e?bye:yye:e?yye:bye;case"left":case"right":return e?Tbt:Ibt;default:return[]}}function Abt(t,e,n,r){const i=sg(t);let o=jbt(A7(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(IF)))),o}function jF(t){return t.replace(/left|right|bottom|top/g,e=>_bt[e])}function Rbt(t){return{top:0,right:0,bottom:0,left:0,...t}}function zHe(t){return typeof t!="number"?Rbt(t):{top:t,right:t,bottom:t,left:t}}function AF(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function vye(t,e,n){let{reference:r,floating:i}=t;const o=G4(e),s=wue(e),a=Cue(s),l=A7(e),c=o==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-i.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(sg(e)){case"start":p[s]-=h*(n&&c?-1:1);break;case"end":p[s]+=h*(n&&c?-1:1);break}return p}async function HHe(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=cv(e,t),m=zHe(p),y=a[h?f==="floating"?"reference":"floating":f],b=AF(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),C=await(o.isElement==null?void 0:o.isElement(x))?await(o.getScale==null?void 0:o.getScale(x))||{x:1,y:1}:{x:1,y:1},w=AF(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:x,strategy:l}):v);return{top:(b.top-w.top+m.top)/C.y,bottom:(w.bottom-b.bottom+m.bottom)/C.y,left:(b.left-w.left+m.left)/C.x,right:(w.right-b.right+m.right)/C.x}}const Dbt=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=vye(c,r,l),h=r,p={},m=0;for(let y=0;y({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=cv(t,e)||{};if(c==null)return{};const f=zHe(u),h={x:n,y:r},p=wue(i),m=Cue(p),g=await s.getDimensions(c),y=p==="y",b=y?"top":"left",v=y?"bottom":"right",x=y?"clientHeight":"clientWidth",C=o.reference[m]+o.reference[p]-h[p]-o.floating[m],w=h[p]-o.reference[p],_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let S=_?_[x]:0;(!S||!await(s.isElement==null?void 0:s.isElement(_)))&&(S=a.floating[x]||o.floating[m]);const k=C/2-w/2,I=S/2-g[m]/2-1,j=Yw(f[b],I),A=Yw(f[v],I),D=j,O=S-g[m]-A,P=S/2-g[m]/2+k,$=uie(D,P,O),M=!l.arrow&&sg(i)!=null&&P!==$&&o.reference[m]/2-(Psg(i)===t),...n.filter(i=>sg(i)!==t)]:n.filter(i=>A7(i)===i)).filter(i=>t?sg(i)===t||(e?IF(i)!==i:!1):!0)}const $bt=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var n,r,i;const{rects:o,middlewareData:s,placement:a,platform:l,elements:c}=e,{crossAxis:u=!1,alignment:f,allowedPlacements:h=gye,autoAlignment:p=!0,...m}=cv(t,e),g=f!==void 0||h===gye?Pbt(f||null,p,h):h,y=await l.detectOverflow(e,m),b=((n=s.autoPlacement)==null?void 0:n.index)||0,v=g[b];if(v==null)return{};const x=VHe(v,o,await(l.isRTL==null?void 0:l.isRTL(c.floating)));if(a!==v)return{reset:{placement:g[0]}};const C=[y[A7(v)],y[x[0]],y[x[1]]],w=[...((r=s.autoPlacement)==null?void 0:r.overflows)||[],{placement:v,overflows:C}],_=g[b+1];if(_)return{data:{index:b+1,overflows:w},reset:{placement:_}};const S=w.map(j=>{const A=sg(j.placement);return[j.placement,A&&u?j.overflows.slice(0,2).reduce((D,O)=>D+O,0):j.overflows[0],j.overflows]}).sort((j,A)=>j[1]-A[1]),I=((i=S.filter(j=>j[2].slice(0,sg(j[0])?2:3).every(A=>A<=0))[0])==null?void 0:i[0])||S[0][0];return I!==a?{data:{index:b+1,overflows:w},reset:{placement:I}}:{}}}},Mbt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=cv(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const b=A7(i),v=G4(a),x=A7(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(x||!g?[jF(a)]:Ebt(a)),_=m!=="none";!h&&_&&w.push(...Abt(a,g,m,C));const S=[a,...w],k=await l.detectOverflow(e,y),I=[];let j=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&I.push(k[b]),f){const P=VHe(i,s,C);I.push(k[P[0]],k[P[1]])}if(j=[...j,{placement:i,overflows:I}],!I.every(P=>P<=0)){var A,D;const P=(((A=o.flip)==null?void 0:A.index)||0)+1,$=S[P];if($&&(!(f==="alignment"?v!==G4($):!1)||j.every(B=>G4(B.placement)===v?B.overflows[0]>0:!0)))return{data:{index:P,overflows:j},reset:{placement:$}};let M=(D=j.filter(L=>L.overflows[0]<=0).sort((L,B)=>L.overflows[1]-B.overflows[1])[0])==null?void 0:D.placement;if(!M)switch(p){case"bestFit":{var O;const L=(O=j.filter(B=>{if(_){const W=G4(B.placement);return W===v||W==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(W=>W>0).reduce((W,N)=>W+N,0)]).sort((B,W)=>B[1]-W[1])[0])==null?void 0:O[0];L&&(M=L);break}case"initialPlacement":M=a;break}if(i!==M)return{reset:{placement:M}}}return{}}}};function xye(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Cye(t){return NHe.some(e=>t[e]>=0)}const Lbt=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...o}=cv(t,e);switch(i){case"referenceHidden":{const s=await r.detectOverflow(e,{...o,elementContext:"reference"}),a=xye(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Cye(a)}}}case"escaped":{const s=await r.detectOverflow(e,{...o,altBoundary:!0}),a=xye(s,n.floating);return{data:{escapedOffsets:a,escaped:Cye(a)}}}default:return{}}}}},Fbt=new Set(["left","top"]);async function Nbt(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=A7(n),a=sg(n),l=G4(n)==="y",c=Fbt.has(s)?-1:1,u=o&&l?-1:1,f=cv(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*u,y:h*c}:{x:h*c,y:p*u}}const Bbt=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=e,l=await Nbt(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},Vbt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:o}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:v,y:x}=b;return{x:v,y:x}}},...c}=cv(t,e),u={x:n,y:r},f=await o.detectOverflow(e,c),h=G4(A7(i)),p=BHe(h);let m=u[p],g=u[h];if(s){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",x=m+f[b],C=m-f[v];m=uie(x,m,C)}if(a){const b=h==="y"?"top":"left",v=h==="y"?"bottom":"right",x=g+f[b],C=g-f[v];g=uie(x,g,C)}const y=l.fn({...e,[p]:m,[h]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[p]:s,[h]:a}}}}}};function GV(){return typeof window<"u"}function sS(t){return UHe(t)?(t.nodeName||"").toLowerCase():"#document"}function Ah(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Lg(t){var e;return(e=(UHe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function UHe(t){return GV()?t instanceof Node||t instanceof Ah(t).Node:!1}function E0(t){return GV()?t instanceof Element||t instanceof Ah(t).Element:!1}function bg(t){return GV()?t instanceof HTMLElement||t instanceof Ah(t).HTMLElement:!1}function wye(t){return!GV()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ah(t).ShadowRoot}const zbt=new Set(["inline","contents"]);function tR(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=T0(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!zbt.has(i)}const Hbt=new Set(["table","td","th"]);function Ubt(t){return Hbt.has(sS(t))}const Wbt=[":popover-open",":modal"];function YV(t){return Wbt.some(e=>{try{return t.matches(e)}catch{return!1}})}const qbt=["transform","translate","scale","rotate","perspective"],Gbt=["transform","translate","scale","rotate","perspective","filter"],Ybt=["paint","layout","strict","content"];function _ue(t){const e=Sue(),n=E0(t)?T0(t):t;return qbt.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||Gbt.some(r=>(n.willChange||"").includes(r))||Ybt.some(r=>(n.contain||"").includes(r))}function Kbt(t){let e=h8(t);for(;bg(e)&&!Kw(e);){if(_ue(e))return e;if(YV(e))return null;e=h8(e)}return null}function Sue(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Xbt=new Set(["html","body","#document"]);function Kw(t){return Xbt.has(sS(t))}function T0(t){return Ah(t).getComputedStyle(t)}function KV(t){return E0(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function h8(t){if(sS(t)==="html")return t;const e=t.assignedSlot||t.parentNode||wye(t)&&t.host||Lg(t);return wye(e)?e.host:e}function WHe(t){const e=h8(t);return Kw(e)?t.ownerDocument?t.ownerDocument.body:t.body:bg(e)&&tR(e)?e:WHe(e)}function pj(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=WHe(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Ah(i);if(o){const a=die(s);return e.concat(s,s.visualViewport||[],tR(i)?i:[],a&&n?pj(a):[])}return e.concat(i,pj(i,[],n))}function die(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function qHe(t){const e=T0(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=bg(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=TF(n)!==o||TF(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function kue(t){return E0(t)?t:t.contextElement}function sw(t){const e=kue(t);if(!bg(e))return og(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=qHe(e);let s=(o?TF(n.width):n.width)/r,a=(o?TF(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Zbt=og(0);function GHe(t){const e=Ah(t);return!Sue()||!e.visualViewport?Zbt:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Qbt(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ah(t)?!1:e}function x9(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=kue(t);let s=og(1);e&&(r?E0(r)&&(s=sw(r)):s=sw(t));const a=Qbt(o,n,r)?GHe(o):og(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,f=i.height/s.y;if(o){const h=Ah(o),p=r&&E0(r)?Ah(r):r;let m=h,g=die(m);for(;g&&r&&p!==m;){const y=sw(g),b=g.getBoundingClientRect(),v=T0(g),x=b.left+(g.clientLeft+parseFloat(v.paddingLeft))*y.x,C=b.top+(g.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,f*=y.y,l+=x,c+=C,m=Ah(g),g=die(m)}}return AF({width:u,height:f,x:l,y:c})}function XV(t,e){const n=KV(t).scrollLeft;return e?e.left+n:x9(Lg(t)).left+n}function YHe(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-XV(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function Jbt(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=Lg(r),a=e?YV(e.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=og(1);const u=og(0),f=bg(r);if((f||!f&&!o)&&((sS(r)!=="body"||tR(s))&&(l=KV(r)),bg(r))){const p=x9(r);c=sw(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const h=s&&!f&&!o?YHe(s,l):og(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function e9t(t){return Array.from(t.getClientRects())}function t9t(t){const e=Lg(t),n=KV(t),r=t.ownerDocument.body,i=Gb(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Gb(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+XV(t);const a=-n.scrollTop;return T0(r).direction==="rtl"&&(s+=Gb(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}const _ye=25;function n9t(t,e){const n=Ah(t),r=Lg(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;const u=Sue();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=XV(r);if(c<=0){const u=r.ownerDocument,f=u.body,h=getComputedStyle(f),p=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(r.clientWidth-f.clientWidth-p);m<=_ye&&(o-=m)}else c<=_ye&&(o+=c);return{width:o,height:s,x:a,y:l}}const r9t=new Set(["absolute","fixed"]);function i9t(t,e){const n=x9(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=bg(t)?sw(t):og(1),s=t.clientWidth*o.x,a=t.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function Sye(t,e,n){let r;if(e==="viewport")r=n9t(t,n);else if(e==="document")r=t9t(Lg(t));else if(E0(e))r=i9t(e,n);else{const i=GHe(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return AF(r)}function KHe(t,e){const n=h8(t);return n===e||!E0(n)||Kw(n)?!1:T0(n).position==="fixed"||KHe(n,e)}function o9t(t,e){const n=e.get(t);if(n)return n;let r=pj(t,[],!1).filter(a=>E0(a)&&sS(a)!=="body"),i=null;const o=T0(t).position==="fixed";let s=o?h8(t):t;for(;E0(s)&&!Kw(s);){const a=T0(s),l=_ue(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&r9t.has(i.position)||tR(s)&&!l&&KHe(t,s))?r=r.filter(u=>u!==s):i=a,s=h8(s)}return e.set(t,r),r}function s9t(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?YV(e)?[]:o9t(e,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=Sye(e,u,i);return c.top=Gb(f.top,c.top),c.right=Yw(f.right,c.right),c.bottom=Yw(f.bottom,c.bottom),c.left=Gb(f.left,c.left),c},Sye(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function a9t(t){const{width:e,height:n}=qHe(t);return{width:e,height:n}}function l9t(t,e,n){const r=bg(e),i=Lg(e),o=n==="fixed",s=x9(t,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=og(0);function c(){l.x=XV(i)}if(r||!r&&!o)if((sS(e)!=="body"||tR(i))&&(a=KV(e)),r){const p=x9(e,!0,o,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else i&&c();o&&!r&&i&&c();const u=i&&!r&&!o?YHe(i,a):og(0),f=s.left+a.scrollLeft-l.x-u.x,h=s.top+a.scrollTop-l.y-u.y;return{x:f,y:h,width:s.width,height:s.height}}function DG(t){return T0(t).position==="static"}function kye(t,e){if(!bg(t)||T0(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Lg(t)===n&&(n=n.ownerDocument.body),n}function XHe(t,e){const n=Ah(t);if(YV(t))return n;if(!bg(t)){let i=h8(t);for(;i&&!Kw(i);){if(E0(i)&&!DG(i))return i;i=h8(i)}return n}let r=kye(t,e);for(;r&&Ubt(r)&&DG(r);)r=kye(r,e);return r&&Kw(r)&&DG(r)&&!_ue(r)?n:r||Kbt(t)||n}const c9t=async function(t){const e=this.getOffsetParent||XHe,n=this.getDimensions,r=await n(t.floating);return{reference:l9t(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function u9t(t){return T0(t).direction==="rtl"}const d9t={convertOffsetParentRelativeRectToViewportRelativeRect:Jbt,getDocumentElement:Lg,getClippingRect:s9t,getOffsetParent:XHe,getElementRects:c9t,getClientRects:e9t,getDimensions:a9t,getScale:sw,isElement:E0,isRTL:u9t};function ZHe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function f9t(t,e){let n=null,r;const i=Lg(t);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const c=t.getBoundingClientRect(),{left:u,top:f,width:h,height:p}=c;if(a||e(),!h||!p)return;const m=uP(f),g=uP(i.clientWidth-(u+h)),y=uP(i.clientHeight-(f+p)),b=uP(u),x={rootMargin:-m+"px "+-g+"px "+-y+"px "+-b+"px",threshold:Gb(0,Yw(1,l))||1};let C=!0;function w(_){const S=_[0].intersectionRatio;if(S!==l){if(!C)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!ZHe(c,t.getBoundingClientRect())&&s(),C=!1}try{n=new IntersectionObserver(w,{...x,root:i.ownerDocument})}catch{n=new IntersectionObserver(w,x)}n.observe(t)}return s(!0),o}function nR(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=kue(t),u=i||o?[...c?pj(c):[],...pj(e)]:[];u.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const f=c&&a?f9t(c,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(b=>{let[v]=b;v&&v.target===c&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(e)})),n()}),c&&!l&&p.observe(c),p.observe(e));let m,g=l?x9(t):null;l&&y();function y(){const b=x9(t);g&&!ZHe(g,b)&&n(),g=b,m=requestAnimationFrame(y)}return n(),()=>{var b;u.forEach(v=>{i&&v.removeEventListener("scroll",n),o&&v.removeEventListener("resize",n)}),f?.(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const QHe=HHe,h9t=Bbt,p9t=$bt,m9t=Vbt,g9t=Mbt,y9t=Lbt,Eye=Obt,b9t=(t,e,n)=>{const r=new Map,i={platform:d9t,...n},o={...i.platform,_c:r};return Dbt(t,e,{...i,platform:o})};var OG={exports:{}},O1={};var Tye;function v9t(){if(Tye)return O1;Tye=1;var t=Rg();function e(l){var c="https://react.dev/errors/"+l;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),OG.exports=v9t(),OG.exports}var r0=ZV();const x9t=rs(r0);var C9t=typeof document<"u",w9t=function(){},OM=C9t?E.useLayoutEffect:w9t;function RF(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!RF(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&t.$$typeof)&&!RF(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function JHe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function jye(t,e){const n=JHe(t);return Math.round(e*n)/n}function PG(t){const e=E.useRef(t);return OM(()=>{e.current=t}),e}function QV(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[u,f]=E.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,p]=E.useState(r);RF(h,r)||p(r);const[m,g]=E.useState(null),[y,b]=E.useState(null),v=E.useCallback(B=>{B!==_.current&&(_.current=B,g(B))},[]),x=E.useCallback(B=>{B!==S.current&&(S.current=B,b(B))},[]),C=o||m,w=s||y,_=E.useRef(null),S=E.useRef(null),k=E.useRef(u),I=l!=null,j=PG(l),A=PG(i),D=PG(c),O=E.useCallback(()=>{if(!_.current||!S.current)return;const B={placement:e,strategy:n,middleware:h};A.current&&(B.platform=A.current),b9t(_.current,S.current,B).then(W=>{const N={...W,isPositioned:D.current!==!1};P.current&&!RF(k.current,N)&&(k.current=N,r0.flushSync(()=>{f(N)}))})},[h,e,n,A,D]);OM(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(B=>({...B,isPositioned:!1})))},[c]);const P=E.useRef(!1);OM(()=>(P.current=!0,()=>{P.current=!1}),[]),OM(()=>{if(C&&(_.current=C),w&&(S.current=w),C&&w){if(j.current)return j.current(C,w,O);O()}},[C,w,O,j,I]);const $=E.useMemo(()=>({reference:_,floating:S,setReference:v,setFloating:x}),[v,x]),M=E.useMemo(()=>({reference:C,floating:w}),[C,w]),L=E.useMemo(()=>{const B={position:n,left:0,top:0};if(!M.floating)return B;const W=jye(M.floating,u.x),N=jye(M.floating,u.y);return a?{...B,transform:"translate("+W+"px, "+N+"px)",...JHe(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:N}},[n,a,M.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:O,refs:$,elements:M,floatingStyles:L}),[u,O,$,M,L])}const _9t=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Eye({element:r.current,padding:i}).fn(n):{}:r?Eye({element:r,padding:i}).fn(n):{}}}},JV=(t,e)=>({...h9t(t),options:[t,e]}),ez=(t,e)=>({...m9t(t),options:[t,e]}),tz=(t,e)=>({...g9t(t),options:[t,e]}),eUe=(t,e)=>({...p9t(t),options:[t,e]}),tUe=(t,e)=>({...y9t(t),options:[t,e]}),nz=(t,e)=>({..._9t(t),options:[t,e]}),Eue=E.createContext({});function Tue(t){const e=E.useRef(null);return e.current===null&&(e.current=t()),e.current}const nUe=typeof window<"u",rUe=nUe?E.useLayoutEffect:E.useEffect,rz=E.createContext(null);function Iue(t,e){t.indexOf(e)===-1&&t.push(e)}function DF(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const vg=(t,e,n)=>n>e?e:n{};const R7={},iUe=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function oUe(t){return typeof t=="object"&&t!==null}const sUe=t=>/^0[^.\s]+$/u.test(t);function aUe(t){let e;return()=>(e===void 0&&(e=t()),e)}const Hp=t=>t,S9t=(t,e)=>n=>e(t(n)),rR=(...t)=>t.reduce(S9t),mj=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class Aue{constructor(){this.subscriptions=[]}add(e){return Iue(this.subscriptions,e),()=>DF(this.subscriptions,e)}notify(e,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,r);else for(let o=0;ot*1e3,Dp=t=>t/1e3;function lUe(t,e){return e?t*(1e3/e):0}const cUe=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,k9t=1e-7,E9t=12;function T9t(t,e,n,r,i){let o,s,a=0;do s=e+(n-e)/2,o=cUe(s,r,i)-t,o>0?n=s:e=s;while(Math.abs(o)>k9t&&++aT9t(o,0,1,t,n);return o=>o===0||o===1?o:cUe(i(o),e,r)}const uUe=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,dUe=t=>e=>1-t(1-e),fUe=iR(.33,1.53,.69,.99),Rue=dUe(fUe),hUe=uUe(Rue),pUe=t=>(t*=2)<1?.5*Rue(t):.5*(2-Math.pow(2,-10*(t-1))),Due=t=>1-Math.sin(Math.acos(t)),mUe=dUe(Due),gUe=uUe(Due),I9t=iR(.42,0,1,1),j9t=iR(0,0,.58,1),yUe=iR(.42,0,.58,1),A9t=t=>Array.isArray(t)&&typeof t[0]!="number",bUe=t=>Array.isArray(t)&&typeof t[0]=="number",R9t={linear:Hp,easeIn:I9t,easeInOut:yUe,easeOut:j9t,circIn:Due,circInOut:gUe,circOut:mUe,backIn:Rue,backInOut:hUe,backOut:fUe,anticipate:pUe},D9t=t=>typeof t=="string",Aye=t=>{if(bUe(t)){jue(t.length===4);const[e,n,r,i]=t;return iR(e,n,r,i)}else if(D9t(t))return R9t[t];return t},dP=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function O9t(t,e){let n=new Set,r=new Set,i=!1,o=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){s.has(u)&&(c.schedule(u),t()),u(a)}const c={schedule:(u,f=!1,h=!1)=>{const m=h&&i?n:r;return f&&s.add(u),m.has(u)||m.add(u),u},cancel:u=>{r.delete(u),s.delete(u)},process:u=>{if(a=u,i){o=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),n.clear(),i=!1,o&&(o=!1,c.process(u))}};return c}const P9t=40;function vUe(t,e){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,s=dP.reduce((x,C)=>(x[C]=O9t(o),x),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:f,preRender:h,render:p,postRender:m}=s,g=()=>{const x=R7.useManualTiming?i.timestamp:performance.now();n=!1,R7.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(x-i.timestamp,P9t),1)),i.timestamp=x,i.isProcessing=!0,a.process(i),l.process(i),c.process(i),u.process(i),f.process(i),h.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&e&&(r=!1,t(g))},y=()=>{n=!0,r=!0,i.isProcessing||t(g)};return{schedule:dP.reduce((x,C)=>{const w=s[C];return x[C]=(_,S=!1,k=!1)=>(n||y(),w.schedule(_,S,k)),x},{}),cancel:x=>{for(let C=0;C(PM===void 0&&If.set(o1.isProcessing||R7.useManualTiming?o1.timestamp:performance.now()),PM),set:t=>{PM=t,queueMicrotask($9t)}},xUe=t=>e=>typeof e=="string"&&e.startsWith(t),CUe=xUe("--"),M9t=xUe("var(--"),Oue=t=>M9t(t)?L9t.test(t.split("/*")[0].trim()):!1,L9t=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Rye(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const aS={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},gj={...aS,transform:t=>vg(0,1,t)},fP={...aS,default:1},yI=t=>Math.round(t*1e5)/1e5,Pue=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function F9t(t){return t==null}const N9t=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,$ue=(t,e)=>n=>!!(typeof n=="string"&&N9t.test(n)&&n.startsWith(t)||e&&!F9t(n)&&Object.prototype.hasOwnProperty.call(n,e)),wUe=(t,e,n)=>r=>{if(typeof r!="string")return r;const[i,o,s,a]=r.match(Pue);return{[t]:parseFloat(i),[e]:parseFloat(o),[n]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},B9t=t=>vg(0,255,t),MG={...aS,transform:t=>Math.round(B9t(t))},$b={test:$ue("rgb","red"),parse:wUe("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+MG.transform(t)+", "+MG.transform(e)+", "+MG.transform(n)+", "+yI(gj.transform(r))+")"};function V9t(t){let e="",n="",r="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const fie={test:$ue("#"),parse:V9t,transform:$b.transform},oR=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),I4=oR("deg"),ag=oR("%"),Dr=oR("px"),z9t=oR("vh"),H9t=oR("vw"),Dye={...ag,parse:t=>ag.parse(t)/100,transform:t=>ag.transform(t*100)},PC={test:$ue("hsl","hue"),parse:wUe("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+ag.transform(yI(e))+", "+ag.transform(yI(n))+", "+yI(gj.transform(r))+")"},Pu={test:t=>$b.test(t)||fie.test(t)||PC.test(t),parse:t=>$b.test(t)?$b.parse(t):PC.test(t)?PC.parse(t):fie.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?$b.transform(t):PC.transform(t),getAnimatableNone:t=>{const e=Pu.parse(t);return e.alpha=0,Pu.transform(e)}},U9t=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function W9t(t){return isNaN(t)&&typeof t=="string"&&(t.match(Pue)?.length||0)+(t.match(U9t)?.length||0)>0}const _Ue="number",SUe="color",q9t="var",G9t="var(",Oye="${}",Y9t=/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 yj(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},i=[];let o=0;const a=e.replace(Y9t,l=>(Pu.test(l)?(r.color.push(o),i.push(SUe),n.push(Pu.parse(l))):l.startsWith(G9t)?(r.var.push(o),i.push(q9t),n.push(l)):(r.number.push(o),i.push(_Ue),n.push(parseFloat(l))),++o,Oye)).split(Oye);return{values:n,split:a,indexes:r,types:i}}function kUe(t){return yj(t).values}function EUe(t){const{split:e,types:n}=yj(t),r=e.length;return i=>{let o="";for(let s=0;stypeof t=="number"?0:Pu.test(t)?Pu.getAnimatableNone(t):t;function X9t(t){const e=kUe(t);return EUe(t)(e.map(K9t))}const h0={test:W9t,parse:kUe,createTransformer:EUe,getAnimatableNone:X9t};function LG(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 Z9t({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let i=0,o=0,s=0;if(!e)i=o=s=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;i=LG(l,a,t+1/3),o=LG(l,a,t),s=LG(l,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:r}}function OF(t,e){return n=>n>0?e:t}const bc=(t,e,n)=>t+(e-t)*n,FG=(t,e,n)=>{const r=t*t,i=n*(e*e-r)+r;return i<0?0:Math.sqrt(i)},Q9t=[fie,$b,PC],J9t=t=>Q9t.find(e=>e.test(t));function Pye(t){const e=J9t(t);if(!e)return!1;let n=e.parse(t);return e===PC&&(n=Z9t(n)),n}const $ye=(t,e)=>{const n=Pye(t),r=Pye(e);if(!n||!r)return OF(t,e);const i={...n};return o=>(i.red=FG(n.red,r.red,o),i.green=FG(n.green,r.green,o),i.blue=FG(n.blue,r.blue,o),i.alpha=bc(n.alpha,r.alpha,o),$b.transform(i))},hie=new Set(["none","hidden"]);function evt(t,e){return hie.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function tvt(t,e){return n=>bc(t,e,n)}function Mue(t){return typeof t=="number"?tvt:typeof t=="string"?Oue(t)?OF:Pu.test(t)?$ye:ivt:Array.isArray(t)?TUe:typeof t=="object"?Pu.test(t)?$ye:nvt:OF}function TUe(t,e){const n=[...t],r=n.length,i=t.map((o,s)=>Mue(o)(o,e[s]));return o=>{for(let s=0;s{for(const o in r)n[o]=r[o](i);return n}}function rvt(t,e){const n=[],r={color:0,var:0,number:0};for(let i=0;i{const n=h0.createTransformer(e),r=yj(t),i=yj(e);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?hie.has(t)&&!i.values.length||hie.has(e)&&!r.values.length?evt(t,e):rR(TUe(rvt(r,i),i.values),n):OF(t,e)};function IUe(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?bc(t,e,n):Mue(t)(t,e)}const ovt=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Tl.update(e,n),stop:()=>p8(e),now:()=>o1.isProcessing?o1.timestamp:If.now()}},jUe=(t,e,n=10)=>{let r="";const i=Math.max(Math.round(e/n),2);for(let o=0;o=PF?1/0:e}function svt(t,e=100,n){const r=n({...t,keyframes:[0,e]}),i=Math.min(Lue(r),PF);return{type:"keyframes",ease:o=>r.next(i*o).value/e,duration:Dp(i)}}const avt=5;function AUe(t,e,n){const r=Math.max(e-avt,0);return lUe(n-t(r),e-r)}const Rc={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},NG=.001;function lvt({duration:t=Rc.duration,bounce:e=Rc.bounce,velocity:n=Rc.velocity,mass:r=Rc.mass}){let i,o,s=1-e;s=vg(Rc.minDamping,Rc.maxDamping,s),t=vg(Rc.minDuration,Rc.maxDuration,Dp(t)),s<1?(i=c=>{const u=c*s,f=u*t,h=u-n,p=pie(c,s),m=Math.exp(-f);return NG-h/p*m},o=c=>{const f=c*s*t,h=f*n+n,p=Math.pow(s,2)*Math.pow(c,2)*t,m=Math.exp(-f),g=pie(Math.pow(c,2),s);return(-i(c)+NG>0?-1:1)*((h-p)*m)/g}):(i=c=>{const u=Math.exp(-c*t),f=(c-n)*t+1;return-NG+u*f},o=c=>{const u=Math.exp(-c*t),f=(n-c)*(t*t);return u*f});const a=5/t,l=uvt(i,o,a);if(t=f0(t),isNaN(l))return{stiffness:Rc.stiffness,damping:Rc.damping,duration:t};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:s*2*Math.sqrt(r*c),duration:t}}}const cvt=12;function uvt(t,e,n){let r=n;for(let i=1;it[n]!==void 0)}function hvt(t){let e={velocity:Rc.velocity,stiffness:Rc.stiffness,damping:Rc.damping,mass:Rc.mass,isResolvedFromDuration:!1,...t};if(!Mye(t,fvt)&&Mye(t,dvt))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,o=2*vg(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:Rc.mass,stiffness:i,damping:o}}else{const n=lvt({...t,velocity:0});e={...e,...n,mass:Rc.mass},e.isResolvedFromDuration=!0}return e}function $F(t=Rc.visualDuration,e=Rc.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:i}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:c,mass:u,duration:f,velocity:h,isResolvedFromDuration:p}=hvt({...n,velocity:-Dp(n.velocity||0)}),m=h||0,g=c/(2*Math.sqrt(l*u)),y=s-o,b=Dp(Math.sqrt(l/u)),v=Math.abs(y)<5;r||(r=v?Rc.restSpeed.granular:Rc.restSpeed.default),i||(i=v?Rc.restDelta.granular:Rc.restDelta.default);let x;if(g<1){const w=pie(b,g);x=_=>{const S=Math.exp(-g*b*_);return s-S*((m+g*b*y)/w*Math.sin(w*_)+y*Math.cos(w*_))}}else if(g===1)x=w=>s-Math.exp(-b*w)*(y+(m+b*y)*w);else{const w=b*Math.sqrt(g*g-1);x=_=>{const S=Math.exp(-g*b*_),k=Math.min(w*_,300);return s-S*((m+g*b*y)*Math.sinh(k)+w*y*Math.cosh(k))/w}}const C={calculatedDuration:p&&f||null,next:w=>{const _=x(w);if(p)a.done=w>=f;else{let S=w===0?m:0;g<1&&(S=w===0?f0(m):AUe(x,w,_));const k=Math.abs(S)<=r,I=Math.abs(s-_)<=i;a.done=k&&I}return a.value=a.done?s:_,a},toString:()=>{const w=Math.min(Lue(C),PF),_=jUe(S=>C.next(w*S).value,w,30);return w+"ms "+_},toTransition:()=>{}};return C}$F.applyToOptions=t=>{const e=svt(t,100,$F);return t.ease=e.ease,t.duration=f0(e.duration),t.type="keyframes",t};function mie({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:c=.5,restSpeed:u}){const f=t[0],h={done:!1,value:f},p=k=>a!==void 0&&kl,m=k=>a===void 0?l:l===void 0||Math.abs(a-k)-g*Math.exp(-k/r),x=k=>b+v(k),C=k=>{const I=v(k),j=x(k);h.done=Math.abs(I)<=c,h.value=h.done?b:j};let w,_;const S=k=>{p(h.value)&&(w=k,_=$F({keyframes:[h.value,m(h.value)],velocity:AUe(x,k,h.value),damping:i,stiffness:o,restDelta:c,restSpeed:u}))};return S(0),{calculatedDuration:null,next:k=>{let I=!1;return!_&&w===void 0&&(I=!0,C(k),S(k)),w!==void 0&&k>=w?_.next(k-w):(!I&&C(k),h)}}}function pvt(t,e,n){const r=[],i=n||R7.mix||IUe,o=t.length-1;for(let s=0;se[0];if(o===2&&e[0]===e[1])return()=>e[1];const s=t[0]===t[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=pvt(e,r,i),l=a.length,c=u=>{if(s&&u1)for(;fc(vg(t[0],t[o-1],u)):c}function gvt(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=mj(0,e,r);t.push(bc(n,1,i))}}function yvt(t){const e=[0];return gvt(e,t.length-1),e}function bvt(t,e){return t.map(n=>n*e)}function vvt(t,e){return t.map(()=>e||yUe).splice(0,t.length-1)}function bI({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=A9t(r)?r.map(Aye):Aye(r),o={done:!1,value:e[0]},s=bvt(n&&n.length===e.length?n:yvt(e),t),a=mvt(s,e,{ease:Array.isArray(i)?i:vvt(e,i)});return{calculatedDuration:t,next:l=>(o.value=a(l),o.done=l>=t,o)}}const xvt=t=>t!==null;function Fue(t,{repeat:e,repeatType:n="loop"},r,i=1){const o=t.filter(xvt),a=i<0||e&&n!=="loop"&&e%2===1?0:o.length-1;return!a||r===void 0?o[a]:r}const Cvt={decay:mie,inertia:mie,tween:bI,keyframes:bI,spring:$F};function RUe(t){typeof t.type=="string"&&(t.type=Cvt[t.type])}class Nue{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 wvt=t=>t/100;class Bue extends Nue{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==If.now()&&this.tick(If.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;RUe(e);const{type:n=bI,repeat:r=0,repeatDelay:i=0,repeatType:o,velocity:s=0}=e;let{keyframes:a}=e;const l=n||bI;l!==bI&&typeof a[0]!="number"&&(this.mixKeyframes=rR(wvt,IUe(a[0],a[1])),a=[0,100]);const c=l({...e,keyframes:a});o==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...a].reverse(),velocity:-s})),c.calculatedDuration===null&&(c.calculatedDuration=Lue(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=c}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:r,totalDuration:i,mixKeyframes:o,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:c=0,keyframes:u,repeat:f,repeatType:h,repeatDelay:p,type:m,onUpdate:g,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const b=this.currentTime-c*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?b<0:b>i;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let x=this.currentTime,C=r;if(f){const k=Math.min(this.currentTime,i)/a;let I=Math.floor(k),j=k%1;!j&&k>=1&&(j=1),j===1&&I--,I=Math.min(I,f+1),I%2&&(h==="reverse"?(j=1-j,p&&(j-=p/a)):h==="mirror"&&(C=s)),x=vg(0,1,j)*a}const w=v?{done:!1,value:u[0]}:C.next(x);o&&(w.value=o(w.value));let{done:_}=w;!v&&l!==null&&(_=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&_);return S&&m!==mie&&(w.value=Fue(u,this.options,y,this.speed)),g&&g(w.value),S&&this.finish(),w}then(e,n){return this.finished.then(e,n)}get duration(){return Dp(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Dp(e)}get time(){return Dp(this.currentTime)}set time(e){e=f0(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),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(If.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Dp(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=ovt,startTime:n}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),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(If.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}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){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function _vt(t){for(let e=1;et*180/Math.PI,gie=t=>{const e=Mb(Math.atan2(t[1],t[0]));return yie(e)},Svt={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:gie,rotateZ:gie,skewX:t=>Mb(Math.atan(t[1])),skewY:t=>Mb(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},yie=t=>(t=t%360,t<0&&(t+=360),t),Lye=gie,Fye=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Nye=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),kvt={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Fye,scaleY:Nye,scale:t=>(Fye(t)+Nye(t))/2,rotateX:t=>yie(Mb(Math.atan2(t[6],t[5]))),rotateY:t=>yie(Mb(Math.atan2(-t[2],t[0]))),rotateZ:Lye,rotate:Lye,skewX:t=>Mb(Math.atan(t[4])),skewY:t=>Mb(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function bie(t){return t.includes("scale")?1:0}function vie(t,e){if(!t||t==="none")return bie(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=kvt,i=n;else{const a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Svt,i=a}if(!i)return bie(e);const o=r[e],s=i[1].split(",").map(Tvt);return typeof o=="function"?o(s):s[o]}const Evt=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return vie(n,e)};function Tvt(t){return parseFloat(t.trim())}const lS=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],cS=new Set(lS),Bye=t=>t===aS||t===Dr,Ivt=new Set(["x","y","z"]),jvt=lS.filter(t=>!Ivt.has(t));function Avt(t){const e=[];return jvt.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const Y4={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})=>vie(e,"x"),y:(t,{transform:e})=>vie(e,"y")};Y4.translateX=Y4.x;Y4.translateY=Y4.y;const Yb=new Set;let xie=!1,Cie=!1,wie=!1;function DUe(){if(Cie){const t=Array.from(Yb).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const i=Avt(r);i.length&&(n.set(r,i),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([o,s])=>{r.getValue(o)?.set(s)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Cie=!1,xie=!1,Yb.forEach(t=>t.complete(wie)),Yb.clear()}function OUe(){Yb.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Cie=!0)})}function Rvt(){wie=!0,OUe(),DUe(),wie=!1}class Vue{constructor(e,n,r,i,o,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=i,this.element=o,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(Yb.add(this),xie||(xie=!0,Tl.read(OUe),Tl.resolveKeyframes(DUe))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:i}=this;if(e[0]===null){const o=i?.get(),s=e[e.length-1];if(o!==void 0)e[0]=o;else if(r&&n){const a=r.readValue(n,s);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=s),i&&o===void 0&&i.set(e[0])}_vt(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Yb.delete(this)}cancel(){this.state==="scheduled"&&(Yb.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Dvt=t=>t.startsWith("--");function Ovt(t,e,n){Dvt(e)?t.style.setProperty(e,n):t.style[e]=n}const Pvt={};function PUe(t,e){const n=aUe(t);return()=>Pvt[e]??n()}const $vt=PUe(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),$Ue=PUe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),LT=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Vye={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:LT([0,.65,.55,1]),circOut:LT([.55,0,1,.45]),backIn:LT([.31,.01,.66,-.59]),backOut:LT([.33,1.53,.69,.99])};function MUe(t,e){if(t)return typeof t=="function"?$Ue()?jUe(t,e):"ease-out":bUe(t)?LT(t):Array.isArray(t)?t.map(n=>MUe(n,e)||Vye.easeOut):Vye[t]}function Mvt(t,e,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[e]:n};l&&(u.offset=l);const f=MUe(a,i);Array.isArray(f)&&(u.easing=f);const h={delay:r,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:o+1,direction:s==="reverse"?"alternate":"normal"};return c&&(h.pseudoElement=c),t.animate(u,h)}function LUe(t){return typeof t=="function"&&"applyToOptions"in t}function Lvt({type:t,...e}){return LUe(t)&&$Ue()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class FUe extends Nue{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:r,keyframes:i,pseudoElement:o,allowFlatten:s=!1,finalKeyframe:a,onComplete:l}=e;this.isPseudoElement=!!o,this.allowFlatten=s,this.options=e,jue(typeof e.type!="string");const c=Lvt(e);this.animation=Mvt(n,r,i,c,o),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const u=Fue(i,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(u):Ovt(n,r,u),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}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(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Dp(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Dp(e)}get time(){return Dp(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=f0(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}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&$vt()?(this.animation.timeline=e,Hp):n(this)}}const NUe={anticipate:pUe,backInOut:hUe,circInOut:gUe};function Fvt(t){return t in NUe}function Nvt(t){typeof t.ease=="string"&&Fvt(t.ease)&&(t.ease=NUe[t.ease])}const BG=10;class Bvt extends FUe{constructor(e){Nvt(e),RUe(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:i,element:o,...s}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const a=new Bue({...s,autoplay:!1}),l=Math.max(BG,If.now()-this.startTime),c=vg(0,BG,l-BG);n.setWithVelocity(a.sample(Math.max(0,l-c)).value,a.sample(l).value,c),a.stop()}}const zye=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(h0.test(t)||t==="0")&&!t.startsWith("url("));function Vvt(t){const e=t[0];if(t.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,"animate"));function Wvt(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:i,damping:o,type:s}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=e.owner.getProps();return Uvt()&&n&&Hvt.has(n)&&(n!=="transform"||!c)&&!l&&!r&&i!=="mirror"&&o!==0&&s!=="inertia"}const qvt=40;class Gvt extends Nue{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:s="loop",keyframes:a,name:l,motionValue:c,element:u,...f}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=If.now();const h={autoplay:e,delay:n,type:r,repeat:i,repeatDelay:o,repeatType:s,name:l,motionValue:c,element:u,...f},p=u?.KeyframeResolver||Vue;this.keyframeResolver=new p(a,(m,g,y)=>this.onKeyframesResolved(m,g,h,!y),l,c,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,i){this.keyframeResolver=void 0;const{name:o,type:s,velocity:a,delay:l,isHandoff:c,onUpdate:u}=r;this.resolvedAt=If.now(),zvt(e,o,s,a)||((R7.instantAnimations||!l)&&u?.(Fue(e,r,n)),e[0]=e[e.length-1],_ie(r),r.repeat=0);const h={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>qvt?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},p=!c&&Wvt(h),m=h.motionValue?.owner?.current,g=p?new Bvt({...h,element:m}):new Bue(h);g.finished.then(()=>{this.notifyFinished()}).catch(Hp),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Rvt()),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(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function BUe(t,e,n,r=0,i=1){const o=Array.from(t).sort((c,u)=>c.sortNodePosition(u)).indexOf(e),s=t.size,a=(s-1)*r;return typeof n=="function"?n(o,s):i===1?o*r:a-o*r}const Yvt=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Kvt(t){const e=Yvt.exec(t);if(!e)return[,];const[,n,r,i]=e;return[`--${n??r}`,i]}function VUe(t,e,n=1){const[r,i]=Kvt(t);if(!r)return;const o=window.getComputedStyle(e).getPropertyValue(r);if(o){const s=o.trim();return iUe(s)?parseFloat(s):s}return Oue(i)?VUe(i,e,n+1):i}const Xvt={type:"spring",stiffness:500,damping:25,restSpeed:10},Zvt=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Qvt={type:"keyframes",duration:.8},Jvt={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ext=(t,{keyframes:e})=>e.length>2?Qvt:cS.has(t)?t.startsWith("scale")?Zvt(e[1]):Xvt:Jvt,txt=t=>t!==null;function nxt(t,{repeat:e,repeatType:n="loop"},r){const i=t.filter(txt),o=e&&n!=="loop"&&e%2===1?0:i.length-1;return i[o]}function zUe(t,e){if(t?.inherit&&e){const{inherit:n,...r}=t;return{...e,...r}}return t}function zue(t,e){const n=t?.[e]??t?.default??t;return n!==t?zUe(n,t):n}function rxt({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:o,repeatType:s,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length}const Hue=(t,e,n,r={},i,o)=>s=>{const a=zue(r,t)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-f0(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:h=>{e.set(h),a.onUpdate&&a.onUpdate(h)},onComplete:()=>{s(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:o?void 0:i};rxt(a)||Object.assign(u,ext(t,u)),u.duration&&(u.duration=f0(u.duration)),u.repeatDelay&&(u.repeatDelay=f0(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let f=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(_ie(u),u.delay===0&&(f=!0)),(R7.instantAnimations||R7.skipAnimations||i?.shouldSkipAnimations)&&(f=!0,_ie(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,f&&!o&&e.get()!==void 0){const h=nxt(u.keyframes,a);if(h!==void 0){Tl.update(()=>{u.onUpdate(h),u.onComplete()});return}}return a.isSync?new Bue(u):new Gvt(u)};function Hye(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function Uue(t,e,n,r){if(typeof e=="function"){const[i,o]=Hye(r);e=e(n!==void 0?n:t.custom,i,o)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,o]=Hye(r);e=e(n!==void 0?n:t.custom,i,o)}return e}function aw(t,e,n){const r=t.getProps();return Uue(r,e,n!==void 0?n:r.custom,t)}const HUe=new Set(["width","height","top","left","right","bottom",...lS]),Uye=30,ixt=t=>!isNaN(parseFloat(t));class oxt{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const i=If.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.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=If.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=ixt(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 Aue);const r=this.events[e].add(n);return e==="change"?()=>{r(),Tl.read(()=>{this.events.change.getSize()||this.stop()})}:r}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,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.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=If.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Uye)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Uye);return lUe(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(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Xw(t,e){return new oxt(t,e)}const Sie=t=>Array.isArray(t);function sxt(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Xw(n))}function axt(t){return Sie(t)?t[t.length-1]||0:t}function lxt(t,e){const n=aw(t,e);let{transitionEnd:r={},transition:i={},...o}=n||{};o={...o,...r};for(const s in o){const a=axt(o[s]);sxt(t,s,a)}}const U1=t=>!!(t&&t.getVelocity);function cxt(t){return!!(U1(t)&&t.add)}function kie(t,e){const n=t.getValue("willChange");if(cxt(n))return n.add(e);if(!n&&R7.WillChange){const r=new R7.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function Wue(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const uxt="framerAppearId",UUe="data-"+Wue(uxt);function WUe(t){return t.props[UUe]}function dxt({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function qUe(t,e,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:o,transitionEnd:s,...a}=e;const l=t.getDefaultTransition();o=o?zUe(o,l):l;const c=o?.reduceMotion;r&&(o=r);const u=[],f=i&&t.animationState&&t.animationState.getState()[i];for(const h in a){const p=t.getValue(h,t.latestValues[h]??null),m=a[h];if(m===void 0||f&&dxt(f,h))continue;const g={delay:n,...zue(o||{},h)},y=p.get();if(y!==void 0&&!p.isAnimating&&!Array.isArray(m)&&m===y&&!g.velocity)continue;let b=!1;if(window.MotionHandoffAnimation){const C=WUe(t);if(C){const w=window.MotionHandoffAnimation(C,h,Tl);w!==null&&(g.startTime=w,b=!0)}}kie(t,h);const v=c??t.shouldReduceMotion;p.start(Hue(h,p,m,v&&HUe.has(h)?{type:!1}:g,t,b));const x=p.animation;x&&u.push(x)}if(s){const h=()=>Tl.update(()=>{s&&lxt(t,s)});u.length?Promise.all(u).then(h):h()}return u}function Eie(t,e,n={}){const r=aw(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(qUe(t,r,n)):()=>Promise.resolve(),s=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:u,staggerDirection:f}=i;return fxt(t,e,l,c,u,f,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[l,c]=a==="beforeChildren"?[o,s]:[s,o];return l().then(()=>c())}else return Promise.all([o(),s(n.delay)])}function fxt(t,e,n=0,r=0,i=0,o=1,s){const a=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),a.push(Eie(l,e,{...s,delay:n+(typeof r=="function"?0:r)+BUe(t.variantChildren,l,r,i,o)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(a)}function hxt(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const i=e.map(o=>Eie(t,o,n));r=Promise.all(i)}else if(typeof e=="string")r=Eie(t,e,n);else{const i=typeof e=="function"?aw(t,e,n.custom):e;r=Promise.all(qUe(t,i,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}const pxt={test:t=>t==="auto",parse:t=>t},GUe=t=>e=>e.test(t),YUe=[aS,Dr,ag,I4,H9t,z9t,pxt],Wye=t=>YUe.find(GUe(t));function mxt(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||sUe(t):!0}const gxt=new Set(["brightness","contrast","saturate","opacity"]);function yxt(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(Pue)||[];if(!r)return t;const i=n.replace(r,"");let o=gxt.has(e)?1:0;return r!==n&&(o*=100),e+"("+o+i+")"}const bxt=/\b([a-z-]*)\(.*?\)/gu,Tie={...h0,getAnimatableNone:t=>{const e=t.match(bxt);return e?e.map(yxt).join(" "):t}},Iie={...h0,getAnimatableNone:t=>{const e=h0.parse(t);return h0.createTransformer(t)(e.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},qye={...aS,transform:Math.round},vxt={rotate:I4,rotateX:I4,rotateY:I4,rotateZ:I4,scale:fP,scaleX:fP,scaleY:fP,scaleZ:fP,skew:I4,skewX:I4,skewY:I4,distance:Dr,translateX:Dr,translateY:Dr,translateZ:Dr,x:Dr,y:Dr,z:Dr,perspective:Dr,transformPerspective:Dr,opacity:gj,originX:Dye,originY:Dye,originZ:Dr},que={borderWidth:Dr,borderTopWidth:Dr,borderRightWidth:Dr,borderBottomWidth:Dr,borderLeftWidth:Dr,borderRadius:Dr,borderTopLeftRadius:Dr,borderTopRightRadius:Dr,borderBottomRightRadius:Dr,borderBottomLeftRadius:Dr,width:Dr,maxWidth:Dr,height:Dr,maxHeight:Dr,top:Dr,right:Dr,bottom:Dr,left:Dr,inset:Dr,insetBlock:Dr,insetBlockStart:Dr,insetBlockEnd:Dr,insetInline:Dr,insetInlineStart:Dr,insetInlineEnd:Dr,padding:Dr,paddingTop:Dr,paddingRight:Dr,paddingBottom:Dr,paddingLeft:Dr,paddingBlock:Dr,paddingBlockStart:Dr,paddingBlockEnd:Dr,paddingInline:Dr,paddingInlineStart:Dr,paddingInlineEnd:Dr,margin:Dr,marginTop:Dr,marginRight:Dr,marginBottom:Dr,marginLeft:Dr,marginBlock:Dr,marginBlockStart:Dr,marginBlockEnd:Dr,marginInline:Dr,marginInlineStart:Dr,marginInlineEnd:Dr,fontSize:Dr,backgroundPositionX:Dr,backgroundPositionY:Dr,...vxt,zIndex:qye,fillOpacity:gj,strokeOpacity:gj,numOctaves:qye},xxt={...que,color:Pu,backgroundColor:Pu,outlineColor:Pu,fill:Pu,stroke:Pu,borderColor:Pu,borderTopColor:Pu,borderRightColor:Pu,borderBottomColor:Pu,borderLeftColor:Pu,filter:Tie,WebkitFilter:Tie,mask:Iie,WebkitMask:Iie},KUe=t=>xxt[t],Cxt=new Set([Tie,Iie]);function XUe(t,e){let n=KUe(t);return Cxt.has(n)||(n=h0),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const wxt=new Set(["auto","none","0"]);function _xt(t,e,n){let r=0,i;for(;r{e.getValue(a).set(l)}),this.resolveNoneKeyframes()}}const kxt=new Set(["opacity","clipPath","filter","transform"]);function ZUe(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const i=n?.[t]??r.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(r=>r!=null)}const QUe=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function jie(t){return oUe(t)&&"offsetHeight"in t}const{schedule:Gue}=vUe(queueMicrotask,!1),qm={x:!1,y:!1};function JUe(){return qm.x||qm.y}function Ext(t){return t==="x"||t==="y"?qm[t]?null:(qm[t]=!0,()=>{qm[t]=!1}):qm.x||qm.y?null:(qm.x=qm.y=!0,()=>{qm.x=qm.y=!1})}function eWe(t,e){const n=ZUe(t),r=new AbortController,i={passive:!0,...e,signal:r.signal};return[n,i,()=>r.abort()]}function Txt(t){return!(t.pointerType==="touch"||JUe())}function Ixt(t,e,n={}){const[r,i,o]=eWe(t,n);return r.forEach(s=>{let a=!1,l=!1,c;const u=()=>{s.removeEventListener("pointerleave",m)},f=y=>{c&&(c(y),c=void 0),u()},h=y=>{a=!1,window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h),l&&(l=!1,f(y))},p=()=>{a=!0,window.addEventListener("pointerup",h,i),window.addEventListener("pointercancel",h,i)},m=y=>{if(y.pointerType!=="touch"){if(a){l=!0;return}f(y)}},g=y=>{if(!Txt(y))return;l=!1;const b=e(s,y);typeof b=="function"&&(c=b,s.addEventListener("pointerleave",m,i))};s.addEventListener("pointerenter",g,i),s.addEventListener("pointerdown",p,i)}),o}const tWe=(t,e)=>e?t===e?!0:tWe(t,e.parentElement):!1,Yue=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,jxt=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Axt(t){return jxt.has(t.tagName)||t.isContentEditable===!0}const Rxt=new Set(["INPUT","SELECT","TEXTAREA"]);function Dxt(t){return Rxt.has(t.tagName)||t.isContentEditable===!0}const $M=new WeakSet;function Gye(t){return e=>{e.key==="Enter"&&t(e)}}function VG(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Oxt=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=Gye(()=>{if($M.has(n))return;VG(n,"down");const i=Gye(()=>{VG(n,"up")}),o=()=>VG(n,"cancel");n.addEventListener("keyup",i,e),n.addEventListener("blur",o,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function Yye(t){return Yue(t)&&!JUe()}const Kye=new WeakSet;function Pxt(t,e,n={}){const[r,i,o]=eWe(t,n),s=a=>{const l=a.currentTarget;if(!Yye(a)||Kye.has(a))return;$M.add(l),n.stopPropagation&&Kye.add(a);const c=e(l,a),u=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),$M.has(l)&&$M.delete(l),Yye(p)&&typeof c=="function"&&c(p,{success:m})},f=p=>{u(p,l===window||l===document||n.useGlobalTarget||tWe(l,p.target))},h=p=>{u(p,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",s,i),jie(a)&&(a.addEventListener("focus",c=>Oxt(c,i)),!Axt(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),o}function Kue(t){return oUe(t)&&"ownerSVGElement"in t}const MM=new WeakMap;let LM;const nWe=(t,e,n)=>(r,i)=>i&&i[0]?i[0][t+"Size"]:Kue(r)&&"getBBox"in r?r.getBBox()[e]:r[n],$xt=nWe("inline","width","offsetWidth"),Mxt=nWe("block","height","offsetHeight");function Lxt({target:t,borderBoxSize:e}){MM.get(t)?.forEach(n=>{n(t,{get width(){return $xt(t,e)},get height(){return Mxt(t,e)}})})}function Fxt(t){t.forEach(Lxt)}function Nxt(){typeof ResizeObserver>"u"||(LM=new ResizeObserver(Fxt))}function Bxt(t,e){LM||Nxt();const n=ZUe(t);return n.forEach(r=>{let i=MM.get(r);i||(i=new Set,MM.set(r,i)),i.add(e),LM?.observe(r)}),()=>{n.forEach(r=>{const i=MM.get(r);i?.delete(e),i?.size||LM?.unobserve(r)})}}const FM=new Set;let $C;function Vxt(){$C=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};FM.forEach(e=>e(t))},window.addEventListener("resize",$C)}function zxt(t){return FM.add(t),$C||Vxt(),()=>{FM.delete(t),!FM.size&&typeof $C=="function"&&(window.removeEventListener("resize",$C),$C=void 0)}}function Xye(t,e){return typeof t=="function"?zxt(t):Bxt(t,e)}function Hxt(t){return Kue(t)&&t.tagName==="svg"}const Uxt=[...YUe,Pu,h0],Wxt=t=>Uxt.find(GUe(t)),Zye=()=>({translate:0,scale:1,origin:0,originPoint:0}),MC=()=>({x:Zye(),y:Zye()}),Qye=()=>({min:0,max:0}),ld=()=>({x:Qye(),y:Qye()}),qxt=new WeakMap;function iz(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function bj(t){return typeof t=="string"||Array.isArray(t)}const Xue=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Zue=["initial",...Xue];function oz(t){return iz(t.animate)||Zue.some(e=>bj(t[e]))}function rWe(t){return!!(oz(t)||t.variants)}function Gxt(t,e,n){for(const r in e){const i=e[r],o=n[r];if(U1(i))t.addValue(r,i);else if(U1(o))t.addValue(r,Xw(i,{owner:t}));else if(o!==i)if(t.hasValue(r)){const s=t.getValue(r);s.liveStyle===!0?s.jump(i):s.hasAnimated||s.set(i)}else{const s=t.getStaticValue(r);t.addValue(r,Xw(s!==void 0?s:i,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Aie={current:null},iWe={current:!1},Yxt=typeof window<"u";function Kxt(){if(iWe.current=!0,!!Yxt)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Aie.current=t.matches;t.addEventListener("change",e),e()}else Aie.current=!1}const Jye=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let MF={};function oWe(t){MF=t}function Xxt(){return MF}class Zxt{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:i,skipAnimations:o,blockInitialAnimation:s,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Vue,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,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 p=If.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(iWe.current||Kxt(),this.shouldReduceMotion=Aie.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),p8(this.notifyUpdate),p8(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.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){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&kxt.has(e)&&this.current instanceof HTMLElement){const{factory:s,keyframes:a,times:l,ease:c,duration:u}=n.accelerate,f=new FUe({element:this.current,name:e,keyframes:a,times:l,ease:c,duration:f0(u)}),h=s(f);this.valueSubscriptions.set(e,()=>{h(),f.cancel()});return}const r=cS.has(e);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",s=>{this.latestValues[e]=s,this.props.onUpdate&&Tl.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;typeof window<"u"&&window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{i(),o&&o(),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 MF){const n=MF[e];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[e]&&i&&r(this.props)&&(this.features[e]=new i(this)),this.features[e]){const o=this.features[e];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ld()}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 r=0;rn.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&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 r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Xw(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(iUe(r)||sUe(r))?r=parseFloat(r):!Wxt(r)&&h0.test(n)&&(r=XUe(e,n)),this.setBaseTarget(e,U1(r)?r.get():r)),U1(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=Uue(this.props,n,this.presenceContext?.custom);o&&(r=o[e])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!U1(i)?i:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Aue),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){Gue.render(this.render)}}class sWe extends Zxt{constructor(){super(...arguments),this.KeyframeResolver=Sxt}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const r=e.style;return r?r[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;U1(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class z8{constructor(e){this.isMounted=!1,this.node=e}update(){}}function aWe({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Qxt({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function Jxt(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function zG(t){return t===void 0||t===1}function Rie({scale:t,scaleX:e,scaleY:n}){return!zG(t)||!zG(e)||!zG(n)}function xb(t){return Rie(t)||lWe(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function lWe(t){return e4e(t.x)||e4e(t.y)}function e4e(t){return t&&t!=="0%"}function LF(t,e,n){const r=t-n,i=e*r;return n+i}function t4e(t,e,n,r,i){return i!==void 0&&(t=LF(t,i,r)),LF(t,n,r)+e}function Die(t,e=0,n=1,r,i){t.min=t4e(t.min,e,n,r,i),t.max=t4e(t.max,e,n,r,i)}function cWe(t,{x:e,y:n}){Die(t.x,e.translate,e.scale,e.originPoint),Die(t.y,n.translate,n.scale,n.originPoint)}const n4e=.999999999999,r4e=1.0000000000001;function eCt(t,e,n,r=!1){const i=n.length;if(!i)return;e.x=e.y=1;let o,s;for(let a=0;an4e&&(e.x=1),e.yn4e&&(e.y=1)}function LC(t,e){t.min=t.min+e,t.max=t.max+e}function i4e(t,e,n,r,i=.5){const o=bc(t.min,t.max,i);Die(t,e,n,o,r)}function FC(t,e){i4e(t.x,e.x,e.scaleX,e.scale,e.originX),i4e(t.y,e.y,e.scaleY,e.scale,e.originY)}function uWe(t,e){return aWe(Jxt(t.getBoundingClientRect(),e))}function tCt(t,e,n){const r=uWe(t,n),{scroll:i}=e;return i&&(LC(r.x,i.offset.x),LC(r.y,i.offset.y)),r}const nCt={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},rCt=lS.length;function iCt(t,e,n){let r="",i=!0;for(let o=0;o{if(!e.target)return t;if(typeof t=="string")if(Dr.test(t))t=parseFloat(t);else return t;const n=o4e(t,e.target.x),r=o4e(t,e.target.y);return`${n}% ${r}%`}},oCt={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,i=h0.parse(t);if(i.length>5)return r;const o=h0.createTransformer(t),s=typeof i[0]!="number"?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;i[0+s]/=a,i[1+s]/=l;const c=bc(a,l,.5);return typeof i[2+s]=="number"&&(i[2+s]/=c),typeof i[3+s]=="number"&&(i[3+s]/=c),o(i)}},Oie={borderRadius:{...RE,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:RE,borderTopRightRadius:RE,borderBottomLeftRadius:RE,borderBottomRightRadius:RE,boxShadow:oCt};function fWe(t,{layout:e,layoutId:n}){return cS.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Oie[t]||t==="opacity")}function Jue(t,e,n){const r=t.style,i=e?.style,o={};if(!r)return o;for(const s in r)(U1(r[s])||i&&U1(i[s])||fWe(s,t)||n?.getValue(s)?.liveStyle!==void 0)&&(o[s]=r[s]);return o}function sCt(t){return window.getComputedStyle(t)}class aCt extends sWe{constructor(){super(...arguments),this.type="html",this.renderInstance=dWe}readValueFromInstance(e,n){if(cS.has(n))return this.projection?.isProjecting?bie(n):Evt(e,n);{const r=sCt(e),i=(CUe(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return uWe(e,n)}build(e,n,r){Que(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return Jue(e,n,r)}}const lCt={offset:"stroke-dashoffset",array:"stroke-dasharray"},cCt={offset:"strokeDashoffset",array:"strokeDasharray"};function uCt(t,e,n=1,r=0,i=!0){t.pathLength=1;const o=i?lCt:cCt;t[o.offset]=`${-r}`,t[o.array]=`${e} ${n}`}const dCt=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function hWe(t,{attrX:e,attrY:n,attrScale:r,pathLength:i,pathSpacing:o=1,pathOffset:s=0,...a},l,c,u){if(Que(t,a,c),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:f,style:h}=t;f.transform&&(h.transform=f.transform,delete f.transform),(h.transform||f.transformOrigin)&&(h.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),h.transform&&(h.transformBox=u?.transformBox??"fill-box",delete f.transformBox);for(const p of dCt)f[p]!==void 0&&(h[p]=f[p],delete f[p]);e!==void 0&&(f.x=e),n!==void 0&&(f.y=n),r!==void 0&&(f.scale=r),i!==void 0&&uCt(f,i,o,s,!1)}const pWe=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"]),mWe=t=>typeof t=="string"&&t.toLowerCase()==="svg";function fCt(t,e,n,r){dWe(t,e,void 0,r);for(const i in e.attrs)t.setAttribute(pWe.has(i)?i:Wue(i),e.attrs[i])}function gWe(t,e,n){const r=Jue(t,e,n);for(const i in t)if(U1(t[i])||U1(e[i])){const o=lS.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[o]=t[i]}return r}class hCt extends sWe{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ld}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(cS.has(n)){const r=KUe(n);return r&&r.default||0}return n=pWe.has(n)?n:Wue(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return gWe(e,n,r)}build(e,n,r){hWe(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,i){fCt(e,n,r,i)}mount(e){this.isSVGTag=mWe(e.tagName),super.mount(e)}}const pCt=Zue.length;function yWe(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?yWe(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;nPromise.all(e.map(({animation:n,options:r})=>hxt(t,n,r)))}function bCt(t){let e=yCt(t),n=s4e(),r=!0;const i=l=>(c,u)=>{const f=aw(t,u,l==="exit"?t.presenceContext?.custom:void 0);if(f){const{transition:h,transitionEnd:p,...m}=f;c={...c,...m,...p}}return c};function o(l){e=l(t)}function s(l){const{props:c}=t,u=yWe(t.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let y=0;ym&&C,I=!1;const j=Array.isArray(x)?x:[x];let A=j.reduce(i(b),{});w===!1&&(A={});const{prevResolvedValues:D={}}=v,O={...D,...A},P=L=>{k=!0,h.has(L)&&(I=!0,h.delete(L)),v.needsAnimating[L]=!0;const B=t.getValue(L);B&&(B.liveStyle=!1)};for(const L in O){const B=A[L],W=D[L];if(p.hasOwnProperty(L))continue;let N=!1;Sie(B)&&Sie(W)?N=!bWe(B,W):N=B!==W,N?B!=null?P(L):h.add(L):B!==void 0&&h.has(L)?P(L):v.protectedKeys[L]=!0}v.prevProp=x,v.prevResolvedValues=A,v.isActive&&(p={...p,...A}),r&&t.blockInitialAnimation&&(k=!1);const $=_&&S;k&&(!$||I)&&f.push(...j.map(L=>{const B={type:b};if(typeof L=="string"&&r&&!$&&t.manuallyAnimateOnMount&&t.parent){const{parent:W}=t,N=aw(W,L);if(W.enteringChildren&&N){const{delayChildren:V}=N.transition||{};B.delay=BUe(W.enteringChildren,t,V)}}return{animation:L,options:B}}))}if(h.size){const y={};if(typeof c.initial!="boolean"){const b=aw(t,Array.isArray(c.initial)?c.initial[0]:c.initial);b&&b.transition&&(y.transition=b.transition)}h.forEach(b=>{const v=t.getBaseTarget(b),x=t.getValue(b);x&&(x.liveStyle=!0),y[b]=v??null}),f.push({animation:y})}let g=!!f.length;return r&&(c.initial===!1||c.initial===c.animate)&&!t.manuallyAnimateOnMount&&(g=!1),r=!1,g?e(f):Promise.resolve()}function a(l,c){if(n[l].isActive===c)return Promise.resolve();t.variantChildren?.forEach(f=>f.animationState?.setActive(l,c)),n[l].isActive=c;const u=s(l);for(const f in n)n[f].protectedKeys={};return u}return{animateChanges:s,setActive:a,setAnimateFunction:o,getState:()=>n,reset:()=>{n=s4e()}}}function vCt(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!bWe(e,t):!1}function ob(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function s4e(){return{animate:ob(!0),whileInView:ob(),whileHover:ob(),whileTap:ob(),whileDrag:ob(),whileFocus:ob(),exit:ob()}}function a4e(t,e){t.min=e.min,t.max=e.max}function Nm(t,e){a4e(t.x,e.x),a4e(t.y,e.y)}function l4e(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const vWe=1e-4,xCt=1-vWe,CCt=1+vWe,xWe=.01,wCt=0-xWe,_Ct=0+xWe;function jf(t){return t.max-t.min}function SCt(t,e,n){return Math.abs(t-e)<=n}function c4e(t,e,n,r=.5){t.origin=r,t.originPoint=bc(e.min,e.max,t.origin),t.scale=jf(n)/jf(e),t.translate=bc(n.min,n.max,t.origin)-t.originPoint,(t.scale>=xCt&&t.scale<=CCt||isNaN(t.scale))&&(t.scale=1),(t.translate>=wCt&&t.translate<=_Ct||isNaN(t.translate))&&(t.translate=0)}function vI(t,e,n,r){c4e(t.x,e.x,n.x,r?r.originX:void 0),c4e(t.y,e.y,n.y,r?r.originY:void 0)}function u4e(t,e,n){t.min=n.min+e.min,t.max=t.min+jf(e)}function kCt(t,e,n){u4e(t.x,e.x,n.x),u4e(t.y,e.y,n.y)}function d4e(t,e,n){t.min=e.min-n.min,t.max=t.min+jf(e)}function FF(t,e,n){d4e(t.x,e.x,n.x),d4e(t.y,e.y,n.y)}function f4e(t,e,n,r,i){return t-=e,t=LF(t,1/n,r),i!==void 0&&(t=LF(t,1/i,r)),t}function ECt(t,e=0,n=1,r=.5,i,o=t,s=t){if(ag.test(e)&&(e=parseFloat(e),e=bc(s.min,s.max,e/100)-s.min),typeof e!="number")return;let a=bc(o.min,o.max,r);t===o&&(a-=e),t.min=f4e(t.min,e,n,a,i),t.max=f4e(t.max,e,n,a,i)}function h4e(t,e,[n,r,i],o,s){ECt(t,e[n],e[r],e[i],e.scale,o,s)}const TCt=["x","scaleX","originX"],ICt=["y","scaleY","originY"];function p4e(t,e,n,r){h4e(t.x,e,TCt,n?n.x:void 0,r?r.x:void 0),h4e(t.y,e,ICt,n?n.y:void 0,r?r.y:void 0)}function m4e(t){return t.translate===0&&t.scale===1}function CWe(t){return m4e(t.x)&&m4e(t.y)}function g4e(t,e){return t.min===e.min&&t.max===e.max}function jCt(t,e){return g4e(t.x,e.x)&&g4e(t.y,e.y)}function y4e(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function wWe(t,e){return y4e(t.x,e.x)&&y4e(t.y,e.y)}function b4e(t){return jf(t.x)/jf(t.y)}function v4e(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function A5(t){return[t("x"),t("y")]}function ACt(t,e,n){let r="";const i=t.x.translate/e.x,o=t.y.translate/e.y,s=n?.z||0;if((i||o||s)&&(r=`translate3d(${i}px, ${o}px, ${s}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:c,rotate:u,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),m&&(r+=`skewY(${m}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const _We=["TopLeft","TopRight","BottomLeft","BottomRight"],RCt=_We.length,x4e=t=>typeof t=="string"?parseFloat(t):t,C4e=t=>typeof t=="number"||Dr.test(t);function DCt(t,e,n,r,i,o){i?(t.opacity=bc(0,n.opacity??1,OCt(r)),t.opacityExit=bc(e.opacity??1,0,PCt(r))):o&&(t.opacity=bc(e.opacity??1,n.opacity??1,r));for(let s=0;sre?1:n(mj(t,e,r))}function $Ct(t,e,n){const r=U1(t)?t:Xw(t);return r.start(Hue("",r,e,n)),r.animation}function vj(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}const MCt=(t,e)=>t.depth-e.depth;class LCt{constructor(){this.children=[],this.isDirty=!1}add(e){Iue(this.children,e),this.isDirty=!0}remove(e){DF(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(MCt),this.isDirty=!1,this.children.forEach(e)}}function FCt(t,e){const n=If.now(),r=({timestamp:i})=>{const o=i-n;o>=e&&(p8(r),t(o-e))};return Tl.setup(r,!0),()=>p8(r)}function NM(t){return U1(t)?t.get():t}class NCt{constructor(){this.members=[]}add(e){Iue(this.members,e);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===e||r===this.lead||r===this.prevLead)continue;const i=r.instance;i&&i.isConnected===!1&&r.isPresent!==!1&&!r.snapshot&&DF(this.members,r)}e.scheduleRender()}remove(e){if(DF(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(i=>e===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i],s=o.instance;if(o.isPresent!==!1&&(!s||s.isConnected!==!1)){r=o;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender();const i=r.options.layoutDependency,o=e.options.layoutDependency;if(!(i!==void 0&&o!==void 0&&i===o)){const l=r.instance;l&&l.isConnected===!1&&!r.snapshot||(e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0))}const{crossfade:a}=e.options;a===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const BM={hasAnimatedSinceResize:!0,hasEverUpdated:!1},HG=["","X","Y","Z"],BCt=1e3;let VCt=0;function UG(t,e,n,r){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function kWe(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=WUe(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:o}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Tl,!(i||o))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&kWe(r)}function EWe({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(s={},a=e?.()){this.id=VCt++,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(UCt),this.nodes.forEach(YCt),this.nodes.forEach(KCt),this.nodes.forEach(WCt)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;Tl.read(()=>{f=window.innerWidth}),t(s,()=>{const p=window.innerWidth;p!==f&&(f=p,this.root.updateBlockedByResize=!0,u&&u(),u=FCt(h,250),BM.hasAnimatedSinceResize&&(BM.hasAnimatedSinceResize=!1,this.nodes.forEach(k4e)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:f,hasRelativeLayoutChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||ewt,{onLayoutAnimationStart:g,onLayoutAnimationComplete:y}=c.getProps(),b=!this.targetLayout||!wWe(this.targetLayout,p),v=!f&&h;if(this.options.layoutRoot||this.resumeFrom||v||f&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const x={...zue(m,"layout"),onPlay:g,onComplete:y};(c.shouldReduceMotion||this.options.layoutRoot)&&(x.delay=0,x.type=!1),this.startAnimation(x),this.setAnimationOrigin(u,v)}else f||k4e(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),p8(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(XCt),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&kWe(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!jf(this.snapshot.measuredBox.x)&&!jf(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{const w=C/1e3;E4e(f.x,s.x,w),E4e(f.y,s.y,w),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(FF(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),QCt(this.relativeTarget,this.relativeTargetOrigin,h,w),x&&jCt(this.relativeTarget,x)&&(this.isProjectionDirty=!1),x||(x=ld()),Nm(x,this.relativeTarget)),g&&(this.animationValues=u,DCt(u,c,this.latestValues,w,v,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=w},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(p8(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Tl.update(()=>{BM.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Xw(0)),this.motionValue.jump(0,!1),this.currentAnimation=$Ct(this.motionValue,[0,1e3],{...s,velocity:0,isSync:!0,onUpdate:a=>{this.mixTargetDelta(a),s.onUpdate&&s.onUpdate(a)},onStop:()=>{},onComplete:()=>{s.onComplete&&s.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 s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(BCt),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=s;if(!(!a||!l||!c)){if(this!==s&&this.layout&&c&&TWe(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||ld();const f=jf(this.layout.layoutBox.x);l.x.min=s.target.x.min,l.x.max=l.x.min+f;const h=jf(this.layout.layoutBox.y);l.y.min=s.target.y.min,l.y.max=l.y.min+h}Nm(a,l),FC(a,u),vI(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(s,a){this.sharedNodes.has(s)||this.sharedNodes.set(s,new NCt),this.sharedNodes.get(s).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){const{layoutId:s}=this.options;return s?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:s}=this.options;return s?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),s&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetSkewAndRotation(){const{visualElement:s}=this.options;if(!s)return;let a=!1;const{latestValues:l}=s;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&UG("z",s,c,this.animationValues);for(let u=0;us.currentAnimation?.stop()),this.root.nodes.forEach(_4e),this.root.sharedNodes.clear()}}}function zCt(t){t.updateLayout()}function HCt(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:i}=t.options,o=e.source!==t.layout.source;i==="size"?A5(u=>{const f=o?e.measuredBox[u]:e.layoutBox[u],h=jf(f);f.min=n[u].min,f.max=f.min+h}):TWe(i,e.layoutBox,n)&&A5(u=>{const f=o?e.measuredBox[u]:e.layoutBox[u],h=jf(n[u]);f.max=f.min+h,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[u].max=t.relativeTarget[u].min+h)});const s=MC();vI(s,n,e.layoutBox);const a=MC();o?vI(a,t.applyTransform(r,!0),e.measuredBox):vI(a,n,e.layoutBox);const l=!CWe(s);let c=!1;if(!t.resumeFrom){const u=t.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:f,layout:h}=u;if(f&&h){const p=ld();FF(p,e.layoutBox,f.layoutBox);const m=ld();FF(m,n,h.layoutBox),wWe(p,m)||(c=!0),u.options.layoutRoot&&(t.relativeTarget=m,t.relativeTargetOrigin=p,t.relativeParent=u)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:a,layoutDelta:s,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function UCt(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 WCt(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function qCt(t){t.clearSnapshot()}function _4e(t){t.clearMeasurements()}function S4e(t){t.isLayoutDirty=!1}function GCt(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function k4e(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function YCt(t){t.resolveTargetDelta()}function KCt(t){t.calcProjection()}function XCt(t){t.resetSkewAndRotation()}function ZCt(t){t.removeLeadSnapshot()}function E4e(t,e,n){t.translate=bc(e.translate,0,n),t.scale=bc(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function T4e(t,e,n,r){t.min=bc(e.min,n.min,r),t.max=bc(e.max,n.max,r)}function QCt(t,e,n,r){T4e(t.x,e.x,n.x,r),T4e(t.y,e.y,n.y,r)}function JCt(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const ewt={duration:.45,ease:[.4,0,.1,1]},I4e=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),j4e=I4e("applewebkit/")&&!I4e("chrome/")?Math.round:Hp;function A4e(t){t.min=j4e(t.min),t.max=j4e(t.max)}function twt(t){A4e(t.x),A4e(t.y)}function TWe(t,e,n){return t==="position"||t==="preserve-aspect"&&!SCt(b4e(e),b4e(n),.2)}function nwt(t){return t!==t.root&&t.scroll?.wasRoot}const rwt=EWe({attachResizeListener:(t,e)=>vj(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),WG={current:void 0},IWe=EWe({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!WG.current){const t=new rwt({});t.mount(window),t.setOptions({layoutScroll:!0}),WG.current=t}return WG.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),ede=E.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function R4e(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function iwt(...t){return e=>{let n=!1;const r=t.map(i=>{const o=R4e(i,e);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{width:h,height:p,top:m,left:g,right:y,bottom:b}=l.current;if(e||o===!1||!a.current||!h||!p)return;const v=n==="left"?`left: ${g}`:`right: ${y}`,x=r==="bottom"?`bottom: ${b}`:`top: ${m}`;a.current.dataset.motionPopId=s;const C=document.createElement("style");c&&(C.nonce=c);const w=i??document.head;return w.appendChild(C),C.sheet&&C.sheet.insertRule(` + [data-motion-pop-id="${s}"] { + position: absolute !important; + width: ${h}px !important; + height: ${p}px !important; + ${v}px !important; + ${x}px !important; + } + `),()=>{w.contains(C)&&w.removeChild(C)}},[e]),d.jsx(swt,{isPresent:e,childRef:a,sizeRef:l,pop:o,children:o===!1?t:E.cloneElement(t,{ref:f})})}const lwt=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:s,anchorX:a,anchorY:l,root:c})=>{const u=Tue(cwt),f=E.useId();let h=!0,p=E.useMemo(()=>(h=!1,{id:f,initial:e,isPresent:n,custom:i,onExitComplete:m=>{u.set(m,!0);for(const g of u.values())if(!g)return;r&&r()},register:m=>(u.set(m,!1),()=>u.delete(m))}),[n,u,r]);return o&&h&&(p={...p}),E.useMemo(()=>{u.forEach((m,g)=>u.set(g,!1))},[n]),E.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),t=d.jsx(awt,{pop:s==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:c,children:t}),d.jsx(rz.Provider,{value:p,children:t})};function cwt(){return new Map}function jWe(t=!0){const e=E.useContext(rz);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=e,o=E.useId();E.useEffect(()=>{if(t)return i(o)},[t]);const s=E.useCallback(()=>t&&r&&r(o),[o,r,t]);return!n&&r?[!1,s]:[!0]}const hP=t=>t.key||"";function D4e(t){const e=[];return E.Children.forEach(t,n=>{E.isValidElement(n)&&e.push(n)}),e}const Zu=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o="sync",propagate:s=!1,anchorX:a="left",anchorY:l="top",root:c})=>{const[u,f]=jWe(s),h=E.useMemo(()=>D4e(t),[t]),p=s&&!u?[]:h.map(hP),m=E.useRef(!0),g=E.useRef(h),y=Tue(()=>new Map),b=E.useRef(new Set),[v,x]=E.useState(h),[C,w]=E.useState(h);rUe(()=>{m.current=!1,g.current=h;for(let k=0;k{const I=hP(k),j=s&&!u?!1:h===C||p.includes(I),A=()=>{if(b.current.has(I))return;if(b.current.add(I),y.has(I))y.set(I,!0);else return;let D=!0;y.forEach(O=>{O||(D=!1)}),D&&(S?.(),w(g.current),s&&f?.(),r&&r())};return d.jsx(lwt,{isPresent:j,initial:!m.current||n?void 0:!1,custom:e,presenceAffectsLayout:i,mode:o,root:c,onExitComplete:j?void 0:A,anchorX:a,anchorY:l,children:k},I)})})},AWe=E.createContext({strict:!1}),O4e={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 P4e=!1;function uwt(){if(P4e)return;const t={};for(const e in O4e)t[e]={isEnabled:n=>O4e[e].some(r=>!!n[r])};oWe(t),P4e=!0}function RWe(){return uwt(),Xxt()}function dwt(t){const e=RWe();for(const n in t)e[n]={...e[n],...t[n]};oWe(e)}const fwt=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","propagate","ignoreStrict","viewport"]);function NF(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||fwt.has(t)}let DWe=t=>!NF(t);function hwt(t){typeof t=="function"&&(DWe=e=>e.startsWith("on")?!NF(e):t(e))}try{hwt(require("@emotion/is-prop-valid").default)}catch{}function pwt(t,e,n){const r={};for(const i in t)i==="values"&&typeof t.values=="object"||(DWe(i)||n===!0&&NF(i)||!e&&!NF(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}const sz=E.createContext({});function mwt(t,e){if(oz(t)){const{initial:n,animate:r}=t;return{initial:n===!1||bj(n)?n:void 0,animate:bj(r)?r:void 0}}return t.inherit!==!1?e:{}}function gwt(t){const{initial:e,animate:n}=mwt(t,E.useContext(sz));return E.useMemo(()=>({initial:e,animate:n}),[$4e(e),$4e(n)])}function $4e(t){return Array.isArray(t)?t.join(" "):t}const tde=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function OWe(t,e,n){for(const r in e)!U1(e[r])&&!fWe(r,n)&&(t[r]=e[r])}function ywt({transformTemplate:t},e){return E.useMemo(()=>{const n=tde();return Que(n,e,t),Object.assign({},n.vars,n.style)},[e])}function bwt(t,e){const n=t.style||{},r={};return OWe(r,n,t),Object.assign(r,ywt(t,e)),r}function vwt(t,e){const n={},r=bwt(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.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=r,n}const PWe=()=>({...tde(),attrs:{}});function xwt(t,e,n,r){const i=E.useMemo(()=>{const o=PWe();return hWe(o,e,mWe(r),t.transformTemplate,t.style),{...o.attrs,style:{...o.style}}},[e]);if(t.style){const o={};OWe(o,t.style,t),i.style={...o,...i.style}}return i}const Cwt=["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 nde(t){return typeof t!="string"||t.includes("-")?!1:!!(Cwt.indexOf(t)>-1||/[A-Z]/u.test(t))}function wwt(t,e,n,{latestValues:r},i,o=!1,s){const l=(s??nde(t)?xwt:vwt)(e,r,i,t),c=pwt(e,typeof t=="string",o),u=t!==E.Fragment?{...c,...l,ref:n}:{},{children:f}=e,h=E.useMemo(()=>U1(f)?f.get():f,[f]);return E.createElement(t,{...u,children:h})}function _wt({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,i){return{latestValues:Swt(n,r,i,t),renderState:e()}}function Swt(t,e,n,r){const i={},o=r(t,{});for(const h in o)i[h]=NM(o[h]);let{initial:s,animate:a}=t;const l=oz(t),c=rWe(t);e&&c&&!l&&t.inherit!==!1&&(s===void 0&&(s=e.initial),a===void 0&&(a=e.animate));let u=n?n.initial===!1:!1;u=u||s===!1;const f=u?a:s;if(f&&typeof f!="boolean"&&!iz(f)){const h=Array.isArray(f)?f:[f];for(let p=0;p(e,n)=>{const r=E.useContext(sz),i=E.useContext(rz),o=()=>_wt(t,e,r,i);return n?o():Tue(o)},kwt=$We({scrapeMotionValuesFromProps:Jue,createRenderState:tde}),Ewt=$We({scrapeMotionValuesFromProps:gWe,createRenderState:PWe}),Twt=Symbol.for("motionComponentSymbol");function Iwt(t,e,n){const r=E.useRef(n);E.useInsertionEffect(()=>{r.current=n});const i=E.useRef(null);return E.useCallback(o=>{o&&t.onMount?.(o),e&&(o?e.mount(o):e.unmount());const s=r.current;if(typeof s=="function")if(o){const a=s(o);typeof a=="function"&&(i.current=a)}else i.current?(i.current(),i.current=null):s(o);else s&&(s.current=o)},[e])}const MWe=E.createContext({});function lC(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function jwt(t,e,n,r,i,o){const{visualElement:s}=E.useContext(sz),a=E.useContext(AWe),l=E.useContext(rz),c=E.useContext(ede),u=c.reducedMotion,f=c.skipAnimations,h=E.useRef(null),p=E.useRef(!1);r=r||a.renderer,!h.current&&r&&(h.current=r(t,{visualState:e,parent:s,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,skipAnimations:f,isSVG:o}),p.current&&h.current&&(h.current.manuallyAnimateOnMount=!0));const m=h.current,g=E.useContext(MWe);m&&!m.projection&&i&&(m.type==="html"||m.type==="svg")&&Awt(h.current,n,i,g);const y=E.useRef(!1);E.useInsertionEffect(()=>{m&&y.current&&m.update(n,l)});const b=n[UUe],v=E.useRef(!!b&&!window.MotionHandoffIsComplete?.(b)&&window.MotionHasOptimisedAnimation?.(b));return rUe(()=>{p.current=!0,m&&(y.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),E.useEffect(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(b)}),v.current=!1),m.enteringChildren=void 0)}),m}function Awt(t,e,n,r){const{layoutId:i,layout:o,drag:s,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:LWe(t.parent)),t.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:!!s||a&&lC(a),visualElement:t,animationType:typeof o=="string"?o:"both",initialPromotionConfig:r,crossfade:u,layoutScroll:l,layoutRoot:c})}function LWe(t){if(t)return t.options.allowProjection!==!1?t.projection:LWe(t.parent)}function qG(t,{forwardMotionProps:e=!1,type:n}={},r,i){r&&dwt(r);const o=n?n==="svg":nde(t),s=o?Ewt:kwt;function a(c,u){let f;const h={...E.useContext(ede),...c,layoutId:Rwt(c)},{isStatic:p}=h,m=gwt(c),g=s(c,p);if(!p&&nUe){Dwt();const y=Owt(h);f=y.MeasureLayout,m.visualElement=jwt(t,g,h,i,y.ProjectionNode,o)}return d.jsxs(sz.Provider,{value:m,children:[f&&m.visualElement?d.jsx(f,{visualElement:m.visualElement,...h}):null,wwt(t,c,Iwt(g,m.visualElement,u),g,p,e,o)]})}a.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const l=E.forwardRef(a);return l[Twt]=t,l}function Rwt({layoutId:t}){const e=E.useContext(Eue).id;return e&&t!==void 0?e+"-"+t:t}function Dwt(t,e){E.useContext(AWe).strict}function Owt(t){const e=RWe(),{drag:n,layout:r}=e;if(!n&&!r)return{};const i={...n,...r};return{MeasureLayout:n?.isEnabled(t)||r?.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function Pwt(t,e){if(typeof Proxy>"u")return qG;const n=new Map,r=(o,s)=>qG(o,s,t,e),i=(o,s)=>r(o,s);return new Proxy(i,{get:(o,s)=>s==="create"?r:(n.has(s)||n.set(s,qG(s,void 0,t,e)),n.get(s))})}const $wt=(t,e)=>e.isSVG??nde(t)?new hCt(e):new aCt(e,{allowProjection:t!==E.Fragment});class Mwt extends z8{constructor(e){super(e),e.animationState||(e.animationState=bCt(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();iz(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(){this.node.animationState.reset(),this.unmountControls?.()}}let Lwt=0;class Fwt extends z8{constructor(){super(...arguments),this.id=Lwt++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const i=this.node.animationState.setActive("exit",!e);n&&!e&&i.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 Nwt={animation:{Feature:Mwt},exit:{Feature:Fwt}};function sR(t){return{point:{x:t.pageX,y:t.pageY}}}const Bwt=t=>e=>Yue(e)&&t(e,sR(e));function xI(t,e,n,r){return vj(t,e,Bwt(n),r)}const FWe=({current:t})=>t?t.ownerDocument.defaultView:null,M4e=(t,e)=>Math.abs(t-e);function Vwt(t,e){const n=M4e(t.x,e.x),r=M4e(t.y,e.y);return Math.sqrt(n**2+r**2)}const L4e=new Set(["auto","scroll"]);class NWe{constructor(e,n,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:o=!1,distanceThreshold:s=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=p=>{this.handleScroll(p.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=YG(this.lastMoveEventInfo,this.history),m=this.startEvent!==null,g=Vwt(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!m&&!g)return;const{point:y}=p,{timestamp:b}=o1;this.history.push({...y,timestamp:b});const{onStart:v,onMove:x}=this.handlers;m||(v&&v(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,p)},this.handlePointerMove=(p,m)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=GG(m,this.transformPagePoint),Tl.update(this.updatePoint,!0)},this.handlePointerUp=(p,m)=>{this.end();const{onEnd:g,onSessionEnd:y,resumeAnimation:b}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=YG(p.type==="pointercancel"?this.lastMoveEventInfo:GG(m,this.transformPagePoint),this.history);this.startEvent&&g&&g(p,v),y&&y(p,v)},!Yue(e))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=s,this.contextWindow=i||window;const l=sR(e),c=GG(l,this.transformPagePoint),{point:u}=c,{timestamp:f}=o1;this.history=[{...u,timestamp:f}];const{onSessionStart:h}=n;h&&h(e,YG(c,this.history)),this.removeListeners=rR(xI(this.contextWindow,"pointermove",this.handlePointerMove),xI(this.contextWindow,"pointerup",this.handlePointerUp),xI(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(e){let n=e.parentElement;for(;n;){const r=getComputedStyle(n);(L4e.has(r.overflowX)||L4e.has(r.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}),window.addEventListener("scroll",this.onWindowScroll),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 r=e===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},o={x:i.x-n.x,y:i.y-n.y};o.x===0&&o.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o.x,this.lastMoveEventInfo.point.y+=o.y):this.history.length>0&&(this.history[0].x-=o.x,this.history[0].y-=o.y),this.scrollPositions.set(e,i),Tl.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),p8(this.updatePoint)}}function GG(t,e){return e?{point:e(t.point)}:t}function F4e(t,e){return{x:t.x-e.x,y:t.y-e.y}}function YG({point:t},e){return{point:t,delta:F4e(t,BWe(e)),offset:F4e(t,zwt(e)),velocity:Hwt(e,.1)}}function zwt(t){return t[0]}function BWe(t){return t[t.length-1]}function Hwt(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const i=BWe(t);for(;n>=0&&(r=t[n],!(i.timestamp-r.timestamp>f0(e)));)n--;if(!r)return{x:0,y:0};r===t[0]&&t.length>2&&i.timestamp-r.timestamp>f0(e)*2&&(r=t[1]);const o=Dp(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const s={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function Uwt(t,{min:e,max:n},r){return e!==void 0&&tn&&(t=r?bc(n,t,r.max):Math.min(t,n)),t}function N4e(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 Wwt(t,{top:e,left:n,bottom:r,right:i}){return{x:N4e(t.x,n,i),y:N4e(t.y,e,r)}}function B4e(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.minr?n=mj(e.min,e.max-r,t.min):r>i&&(n=mj(t.min,t.max-i,e.min)),vg(0,1,n)}function Ywt(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 Pie=.35;function Kwt(t=Pie){return t===!1?t=0:t===!0&&(t=Pie),{x:V4e(t,"left","right"),y:V4e(t,"top","bottom")}}function V4e(t,e,n){return{min:z4e(t,e),max:z4e(t,n)}}function z4e(t,e){return typeof t=="number"?t:t[e]||0}const Xwt=new WeakMap;class Zwt{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=ld(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const o=f=>{n&&this.snapToCursor(sR(f).point),this.stopAnimation()},s=(f,h)=>{const{drag:p,dragPropagation:m,onDragStart:g}=this.getProps();if(p&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Ext(p),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),A5(b=>{let v=this.getAxisMotionValue(b).get()||0;if(ag.test(v)){const{projection:x}=this.visualElement;if(x&&x.layout){const C=x.layout.layoutBox[b];C&&(v=jf(C)*(parseFloat(v)/100))}}this.originPoint[b]=v}),g&&Tl.update(()=>g(f,h),!1,!0),kie(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},a=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h;const{dragPropagation:p,dragDirectionLock:m,onDirectionLock:g,onDrag:y}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:b}=h;if(m&&this.currentDirection===null){this.currentDirection=Jwt(b),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",h.point,b),this.updateAxis("y",h.point,b),this.visualElement.render(),y&&Tl.update(()=>y(f,h),!1,!0)},l=(f,h)=>{this.latestPointerEvent=f,this.latestPanInfo=h,this.stop(f,h),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:f}=this.getProps();(f||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new NWe(e,{onSessionStart:o,onStart:s,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:r,contextWindow:FWe(this.visualElement),element:this.visualElement.current})}stop(e,n){const r=e||this.latestPointerEvent,i=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!i||!r)return;const{velocity:s}=i;this.startAnimation(s);const{onDragEnd:a}=this.getProps();a&&Tl.postRender(()=>a(r,i))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&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,r){const{drag:i}=this.getProps();if(!r||!pP(e,i,this.currentDirection))return;const o=this.getAxisMotionValue(e);let s=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(s=Uwt(s,this.constraints[e],this.elastic[e])),o.set(s)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;e&&lC(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=Wwt(r.layoutBox,e):this.constraints=!1,this.elastic=Kwt(n),i!==this.constraints&&!lC(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&A5(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=Ywt(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!lC(e))return!1;const r=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=tCt(r,i.root,this.visualElement.getTransformPagePoint());let s=qwt(i.layout.layoutBox,o);if(n){const a=n(Qxt(s));this.hasMutatedConstraints=!!a,a&&(s=aWe(a))}return s}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:s,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=A5(u=>{if(!pP(u,n,this.currentDirection))return;let f=l&&l[u]||{};s&&(f={min:0,max:0});const h=i?200:1e6,p=i?40:1e7,m={type:"inertia",velocity:r?e[u]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...o,...f};return this.startAxisValueAnimation(u,m)});return Promise.all(c).then(a)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return kie(this.visualElement,e),r.start(Hue(e,r,0,n,this.visualElement,!1))}stopAnimation(){A5(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){A5(n=>{const{drag:r}=this.getProps();if(!pP(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:s,max:a}=i.layout.layoutBox[n],l=o.get()||0;o.set(e[n]-bc(s,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!lC(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};A5(s=>{const a=this.getAxisMotionValue(s);if(a&&this.constraints!==!1){const l=a.get();i[s]=Gwt({min:l,max:l},this.constraints[s])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),A5(s=>{if(!pP(s,e,null))return;const a=this.getAxisMotionValue(s),{min:l,max:c}=this.constraints[s];a.set(bc(l,c,i[s]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Xwt.set(this.visualElement,this);const e=this.visualElement.current,n=xI(e,"pointerdown",c=>{const{drag:u,dragListener:f=!0}=this.getProps(),h=c.target,p=h!==e&&Dxt(h);u&&f&&!p&&this.start(c)});let r;const i=()=>{const{dragConstraints:c}=this.getProps();lC(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),r||(r=Qwt(e,c.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,s=o.addEventListener("measure",i);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),Tl.read(i);const a=vj(window,"resize",()=>this.scalePositionWithinConstraints()),l=o.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(A5(f=>{const h=this.getAxisMotionValue(f);h&&(this.originPoint[f]+=c[f].translate,h.set(h.get()+c[f].translate))}),this.visualElement.render())}));return()=>{a(),n(),s(),l&&l(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:s=Pie,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:s,dragMomentum:a}}}function H4e(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function Qwt(t,e,n){const r=Xye(t,H4e(n)),i=Xye(e,H4e(n));return()=>{r(),i()}}function pP(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Jwt(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class e_t extends z8{constructor(e){super(e),this.removeGroupControls=Hp,this.removeListeners=Hp,this.controls=new Zwt(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Hp}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.isDragging||this.controls.endPanSession()}}const KG=t=>(e,n)=>{t&&Tl.update(()=>t(e,n),!1,!0)};class t_t extends z8{constructor(){super(...arguments),this.removePointerDownListener=Hp}onPointerDown(e){this.session=new NWe(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:FWe(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:KG(e),onStart:KG(n),onMove:KG(r),onEnd:(o,s)=>{delete this.session,i&&Tl.postRender(()=>i(o,s))}}}mount(){this.removePointerDownListener=xI(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 XG=!1;class n_t extends E.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=e;o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),XG&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),BM.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,{projection:s}=r;return s&&(s.isPresent=o,e.layoutDependency!==n&&s.setOptions({...s.options,layoutDependency:n}),XG=!0,i||e.layoutDependency!==n||n===void 0||e.isPresent!==o?s.willUpdate():this.safeToRemove(),e.isPresent!==o&&(o?s.promote():s.relegate()||Tl.postRender(()=>{const a=s.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Gue.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=e;XG=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function VWe(t){const[e,n]=jWe(),r=E.useContext(Eue);return d.jsx(n_t,{...t,layoutGroup:r,switchLayoutGroup:E.useContext(MWe),isPresent:e,safeToRemove:n})}const r_t={pan:{Feature:t_t},drag:{Feature:e_t,ProjectionNode:IWe,MeasureLayout:VWe}};function U4e(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,o=r[i];o&&Tl.postRender(()=>o(e,sR(e)))}class i_t extends z8{mount(){const{current:e}=this.node;e&&(this.unmount=Ixt(e,(n,r)=>(U4e(this.node,r,"Start"),i=>U4e(this.node,i,"End"))))}unmount(){}}class o_t extends z8{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=rR(vj(this.node.current,"focus",()=>this.onFocus()),vj(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function W4e(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),o=r[i];o&&Tl.postRender(()=>o(e,sR(e)))}class s_t extends z8{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=Pxt(e,(i,o)=>(W4e(this.node,o,"Start"),(s,{success:a})=>W4e(this.node,s,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:r?.tap===!1})}unmount(){}}const $ie=new WeakMap,ZG=new WeakMap,a_t=t=>{const e=$ie.get(t.target);e&&e(t)},l_t=t=>{t.forEach(a_t)};function c_t({root:t,...e}){const n=t||document;ZG.has(n)||ZG.set(n,{});const r=ZG.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(l_t,{root:t,...e})),r[i]}function u_t(t,e,n){const r=c_t(e);return $ie.set(t,n),r.observe(t),()=>{$ie.delete(t),r.unobserve(t)}}const d_t={some:0,all:1};class f_t extends z8{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=e,s={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:d_t[i]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,o&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:f}=this.node.getProps(),h=c?u:f;h&&h(l)};return u_t(this.node.current,s,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(h_t(e,n))&&this.startObserver()}unmount(){}}function h_t({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const p_t={inView:{Feature:f_t},tap:{Feature:s_t},focus:{Feature:o_t},hover:{Feature:i_t}},m_t={layout:{ProjectionNode:IWe,MeasureLayout:VWe}},g_t={...Nwt,...p_t,...r_t,...m_t},ei=Pwt(g_t,$wt);var Kb=[],y_t=function(){return Kb.some(function(t){return t.activeTargets.length>0})},b_t=function(){return Kb.some(function(t){return t.skippedTargets.length>0})},q4e="ResizeObserver loop completed with undelivered notifications.",v_t=function(){var t;typeof ErrorEvent=="function"?t=new ErrorEvent("error",{message:q4e}):(t=document.createEvent("Event"),t.initEvent("error",!1,!1),t.message=q4e),window.dispatchEvent(t)},xj;(function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(xj||(xj={}));var Xb=function(t){return Object.freeze(t)},x_t=(function(){function t(e,n){this.inlineSize=e,this.blockSize=n,Xb(this)}return t})(),zWe=(function(){function t(e,n,r,i){return this.x=e,this.y=n,this.width=r,this.height=i,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Xb(this)}return t.prototype.toJSON=function(){var e=this,n=e.x,r=e.y,i=e.top,o=e.right,s=e.bottom,a=e.left,l=e.width,c=e.height;return{x:n,y:r,top:i,right:o,bottom:s,left:a,width:l,height:c}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t})(),rde=function(t){return t instanceof SVGElement&&"getBBox"in t},HWe=function(t){if(rde(t)){var e=t.getBBox(),n=e.width,r=e.height;return!n&&!r}var i=t,o=i.offsetWidth,s=i.offsetHeight;return!(o||s||t.getClientRects().length)},G4e=function(t){var e;if(t instanceof Element)return!0;var n=(e=t?.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(n&&t instanceof n.Element)},C_t=function(t){switch(t.tagName){case"INPUT":if(t.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},CI=typeof window<"u"?window:{},mP=new WeakMap,Y4e=/auto|scroll/,w_t=/^tb|vertical/,__t=/msie|trident/i.test(CI.navigator&&CI.navigator.userAgent),v5=function(t){return parseFloat(t||"0")},lw=function(t,e,n){return t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=!1),new x_t((n?e:t)||0,(n?t:e)||0)},K4e=Xb({devicePixelContentBoxSize:lw(),borderBoxSize:lw(),contentBoxSize:lw(),contentRect:new zWe(0,0,0,0)}),UWe=function(t,e){if(e===void 0&&(e=!1),mP.has(t)&&!e)return mP.get(t);if(HWe(t))return mP.set(t,K4e),K4e;var n=getComputedStyle(t),r=rde(t)&&t.ownerSVGElement&&t.getBBox(),i=!__t&&n.boxSizing==="border-box",o=w_t.test(n.writingMode||""),s=!r&&Y4e.test(n.overflowY||""),a=!r&&Y4e.test(n.overflowX||""),l=r?0:v5(n.paddingTop),c=r?0:v5(n.paddingRight),u=r?0:v5(n.paddingBottom),f=r?0:v5(n.paddingLeft),h=r?0:v5(n.borderTopWidth),p=r?0:v5(n.borderRightWidth),m=r?0:v5(n.borderBottomWidth),g=r?0:v5(n.borderLeftWidth),y=f+c,b=l+u,v=g+p,x=h+m,C=a?t.offsetHeight-x-t.clientHeight:0,w=s?t.offsetWidth-v-t.clientWidth:0,_=i?y+v:0,S=i?b+x:0,k=r?r.width:v5(n.width)-_-w,I=r?r.height:v5(n.height)-S-C,j=k+y+w+v,A=I+b+C+x,D=Xb({devicePixelContentBoxSize:lw(Math.round(k*devicePixelRatio),Math.round(I*devicePixelRatio),o),borderBoxSize:lw(j,A,o),contentBoxSize:lw(k,I,o),contentRect:new zWe(f,l,k,I)});return mP.set(t,D),D},WWe=function(t,e,n){var r=UWe(t,n),i=r.borderBoxSize,o=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(e){case xj.DEVICE_PIXEL_CONTENT_BOX:return s;case xj.BORDER_BOX:return i;default:return o}},S_t=(function(){function t(e){var n=UWe(e);this.target=e,this.contentRect=n.contentRect,this.borderBoxSize=Xb([n.borderBoxSize]),this.contentBoxSize=Xb([n.contentBoxSize]),this.devicePixelContentBoxSize=Xb([n.devicePixelContentBoxSize])}return t})(),qWe=function(t){if(HWe(t))return 1/0;for(var e=0,n=t.parentNode;n;)e+=1,n=n.parentNode;return e},k_t=function(){var t=1/0,e=[];Kb.forEach(function(s){if(s.activeTargets.length!==0){var a=[];s.activeTargets.forEach(function(c){var u=new S_t(c.target),f=qWe(c.target);a.push(u),c.lastReportedSize=WWe(c.target,c.observedBox),ft?n.activeTargets.push(i):n.skippedTargets.push(i))})})},E_t=function(){var t=0;for(X4e(t);y_t();)t=k_t(),X4e(t);return b_t()&&v_t(),t>0},QG,GWe=[],T_t=function(){return GWe.splice(0).forEach(function(t){return t()})},I_t=function(t){if(!QG){var e=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return T_t()}).observe(n,r),QG=function(){n.textContent="".concat(e?e--:e++)}}GWe.push(t),QG()},j_t=function(t){I_t(function(){requestAnimationFrame(t)})},VM=0,A_t=function(){return!!VM},R_t=250,D_t={attributes:!0,characterData:!0,childList:!0,subtree:!0},Z4e=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Q4e=function(t){return t===void 0&&(t=0),Date.now()+t},JG=!1,O_t=(function(){function t(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return t.prototype.run=function(e){var n=this;if(e===void 0&&(e=R_t),!JG){JG=!0;var r=Q4e(e);j_t(function(){var i=!1;try{i=E_t()}finally{if(JG=!1,e=r-Q4e(),!A_t())return;i?n.run(1e3):e>0?n.run(e):n.start()}})}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var e=this,n=function(){return e.observer&&e.observer.observe(document.body,D_t)};document.body?n():CI.addEventListener("DOMContentLoaded",n)},t.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Z4e.forEach(function(n){return CI.addEventListener(n,e.listener,!0)}))},t.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),Z4e.forEach(function(n){return CI.removeEventListener(n,e.listener,!0)}),this.stopped=!0)},t})(),Mie=new O_t,J4e=function(t){!VM&&t>0&&Mie.start(),VM+=t,!VM&&Mie.stop()},P_t=function(t){return!rde(t)&&!C_t(t)&&getComputedStyle(t).display==="inline"},$_t=(function(){function t(e,n){this.target=e,this.observedBox=n||xj.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var e=WWe(this.target,this.observedBox,!0);return P_t(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t})(),M_t=(function(){function t(e,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=n}return t})(),gP=new WeakMap,e8e=function(t,e){for(var n=0;n=0&&(o&&Kb.splice(Kb.indexOf(r),1),r.observationTargets.splice(i,1),J4e(-1))},t.disconnect=function(e){var n=this,r=gP.get(e);r.observationTargets.slice().forEach(function(i){return n.unobserve(e,i.target)}),r.activeTargets.splice(0,r.activeTargets.length)},t})(),az=(function(){function t(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");yP.connect(this,e)}return t.prototype.observe=function(e,n){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!G4e(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");yP.observe(this,e,n)},t.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!G4e(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");yP.unobserve(this,e)},t.prototype.disconnect=function(){yP.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t})();const L_t=vt.createContext(!0);function t8e(){throw new Error("A function wrapped in useEffectEvent can't be called during rendering.")}const F_t="use"in vt?()=>{try{return vt.use(L_t)}catch{return!1}}:()=>!1;function uv(t){const e=vt.useRef(t8e);return vt.useInsertionEffect(()=>{e.current=t},[t]),(...n)=>{F_t()&&t8e();const r=e.current;return r(...n)}}const YWe=eR,ec=uHe(),uS=[],r8={},NC={card:{initial:{scale:.97,willChange:"transform"},hidden:{opacity:0},visible:{opacity:1,transition:{when:"beforeChildren",duration:.1}},scaleIn:{scale:1},scaleOut:{scale:.97}},children:{hidden:{opacity:0},visible:{opacity:1}},transition:{type:"spring",visualDuration:.2,bounce:.25}};function N_t(t){return ide(t)||ode(t)}function Fg(t){return t instanceof Node&&t.nodeType===Node.ELEMENT_NODE}function ide(t){return Fg(t)&&t.nodeName==="A"}function B_t(t){return Fg(t)&&t.nodeName==="INPUT"}function ode(t){return Fg(t)&&t.nodeName==="BUTTON"}function V_t(t){return Fg(t)&&t.nodeName==="SELECT"}function z_t(t){return Fg(t)&&t.nodeName==="TEXTAREA"}function Lie(t,e){return t.contains(e)||t===e}function H_t(t){if(!(t instanceof Element))return!1;const e=window.getComputedStyle(t);return e.overflowX.includes("auto")||e.overflowX.includes("scroll")||e.overflowY.includes("auto")||e.overflowY.includes("scroll")}function U_t(t,e){return t.reduce((n,r)=>(n[r]=e,n),{})}function qt(t){return t===0?0:`${t/16}rem`}function $i(t,e,n){return(e?.map(n)||[]).map((r,i)=>i===0?r:{[`@media screen and (min-width: ${t[i-1]}px)`]:r})}function fn(t,e){return t===void 0?e||uS:Array.isArray(t)?t:[t]}function v2(t,e,n=uS){if(!Array.isArray(n))throw new Error("the property must be array of numbers");if(n.length===0)return null;const{media:r,space:i}=Jt(t);return $i(r,n,o=>U_t(e,qt(i[o])))}function Zw(t,e){const{$size:n,$weight:r}=e,{font:i,media:o}=Jt(e.theme),{family:s,sizes:a,weights:l}=i[t],c=r&&l[r]||l.regular,u=a[2],f={position:"relative",fontFamily:s,fontWeight:`${c}`,padding:"1px 0",margin:0,"&:before":{content:'""',display:"block",height:0},"&:after":{content:'""',display:"block",height:0},"& > code, & > span":{display:"block"},"&:not([hidden])":{display:"block"}};if(!n)return Zw.warned||(console.warn("No size specified for responsive font",{fontKey:t,$size:n,props:e,base:f}),Zw.warned=!0),[f];const h=$i(o,n,p=>W_t(a[p]||u));return[f,...h]}function W_t(t){const{ascenderHeight:e,descenderHeight:n,fontSize:r,iconSize:i,letterSpacing:o,lineHeight:s}=t,a=e+n,l=s-a,c=(l-i)/2,u=Math.floor(r*1.125/2)*2+1,f=(l-u)/2;return{fontSize:qt(r),lineHeight:`calc(${s} / ${r})`,letterSpacing:qt(o),transform:`translateY(${qt(n)})`,"&:before":{marginTop:`calc(${qt(0-a)} - 1px)`},"&:after":{marginBottom:"-1px"},"& svg:not([data-sanity-icon])":{fontSize:`calc(${u} / 16 * 1rem)`,margin:qt(f)},"& [data-sanity-icon]":{fontSize:`calc(${i} / 16 * 1rem)`,margin:qt(c)}}}function q_t(t){return Zw("code",t)}function G_t(t){return Zw("heading",t)}function Y_t(t){return Zw("label",t)}function sde(t){const{media:e}=Jt(t.theme);return $i(e,t.$align,n=>({textAlign:n}))}function K_t(t){return Zw("text",t)}function X_t(){if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global;throw new Error("@sanity/ui: could not locate global scope")}const Q3=X_t();function q7(t,e){const n=Symbol.for(t);if(typeof document>"u"){const r=E.createContext(e);return r.displayName=t,r}return Q3[n]=Q3[n]||E.createContext(e),Q3[n]}const Fie=q7("@sanity/ui/context/theme",null);function C9(t){const e=Ut.c(15),n=E.useContext(Fie),{children:r}=t,i=t.scheme??(n?.scheme||"light"),o=t.theme??(n?.theme||null),s=t.tone??(n?.tone||"default");let a;e:{if(!o){a=null;break e}let p;e[0]!==o||e[1]!==i||e[2]!==s?(p={version:0,theme:o,scheme:i,tone:s},e[0]=o,e[1]=i,e[2]=s,e[3]=p):p=e[3],a=p}const l=a;let c;e:{if(!o){c=null;break e}let p;e[4]!==o||e[5]!==i||e[6]!==s?(p=y6t(o,i,s),e[4]=o,e[5]=i,e[6]=s,e[7]=p):p=e[7],c=p}const u=c;if(!u){let p;return e[8]===Symbol.for("react.memo_cache_sentinel")?(p=d.jsx("pre",{children:'ThemeProvider: no "theme" property provided'}),e[8]=p):p=e[8],p}let f;e[9]!==r||e[10]!==u?(f=d.jsx($He,{theme:u,children:r}),e[9]=r,e[10]=u,e[11]=f):f=e[11];let h;return e[12]!==f||e[13]!==l?(h=d.jsx(Fie.Provider,{value:l,children:f}),e[12]=f,e[13]=l,e[14]=h):h=e[14],h}C9.displayName="ThemeProvider";function H8(){const t=E.useContext(Fie);if(!t)throw new Error("useRootTheme(): missing context value");return t}function ade(t){const e=Ut.c(5),{children:n,scheme:r,tone:i}=t,o=H8(),s=r||o.scheme;let a;return e[0]!==n||e[1]!==o.theme||e[2]!==s||e[3]!==i?(a=d.jsx(C9,{scheme:s,theme:o.theme,tone:i,children:n}),e[0]=n,e[1]=o.theme,e[2]=s,e[3]=i,e[4]=a):a=e[4],a}ade.displayName="ThemeColorProvider";function G7(){return qV()}function Y7(){const t=Ut.c(2),e=qV();let n;return t[0]!==e?(n=Jt(e),t[0]=e,t[1]=n):n=t[1],n}function Z_t(){return[Q_t,J_t,eSt,tSt,nSt]}function Q_t(t){const{card:e,media:n}=Jt(t.theme),r=`${e.border?.width??1}px solid var(--card-border-color)`;return $i(n,t.$border,i=>i?{"&&":{border:r}}:{"&&":{border:0}})}function J_t(t){const{card:e,media:n}=Jt(t.theme),r=`${e.border?.width??1}px solid var(--card-border-color)`;return $i(n,t.$borderTop,i=>i?{"&&":{borderTop:r}}:{"&&":{borderTop:0}})}function eSt(t){const{card:e,media:n}=Jt(t.theme),r=`${e.border?.width??1}px solid var(--card-border-color)`;return $i(n,t.$borderRight,i=>i?{"&&":{borderRight:r}}:{"&&":{borderRight:0}})}function tSt(t){const{card:e,media:n}=Jt(t.theme),r=`${e.border?.width??1}px solid var(--card-border-color)`;return $i(n,t.$borderBottom,i=>i?{"&&":{borderBottom:r}}:{"&&":{borderBottom:0}})}function nSt(t){const{card:e,media:n}=Jt(t.theme),r=`${e.border?.width??1}px solid var(--card-border-color)`;return $i(n,t.$borderLeft,i=>i?{"&&":{borderLeft:r}}:{"&&":{borderLeft:0}})}const rSt={'&[data-as="ul"],&[data-as="ol"]':{listStyle:"none"}},iSt={content:"content-box",border:"border-box"},oSt={stretch:"stretch",fill:"100%"};function sSt(){return rSt}function aSt(){return[cSt,uSt,dSt,lSt]}function lSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$display,n=>({"&:not([hidden])":{display:n}}))}function cSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$sizing,n=>({boxSizing:iSt[n]}))}function uSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$height,n=>({height:oSt[n]}))}function dSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$overflow,n=>({overflow:n}))}const fSt={minWidth:0,minHeight:0};function KWe(){return[fSt,hSt]}function hSt(t){const{media:e}=Jt(t.theme);return t.$flex?$i(e,t.$flex,n=>({flex:`${n}`})):uS}const pSt={"&&:not([hidden])":{display:"flex"}};function mSt(){return[pSt,gSt,ySt,bSt,vSt,xSt]}function gSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$align,n=>({alignItems:n}))}function ySt(t){const{media:e,space:n}=Jt(t.theme);return $i(e,t.$gap,r=>({gap:r?qt(n[r]):void 0}))}function bSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$wrap,n=>({flexWrap:n}))}function vSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$justify,n=>({justifyContent:n}))}function xSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$direction,n=>({flexDirection:n}))}function Dc(t){return`inset 0 0 0 ${t.width}px ${t.color}`}function Up(t){const{base:e,border:n,focusRing:r}=t,i=r.offset+r.width,o=0-r.offset,s=e?e.bg:"var(--card-bg-color)";return[o>0&&`inset 0 0 0 ${o}px var(--card-focus-ring-color)`,n&&Dc(n),o<0&&`0 0 0 ${0-o}px ${s}`,i>0&&`0 0 0 ${i}px var(--card-focus-ring-color)`].filter(Boolean).join(",")}function CSt(){return[SSt,kSt,ESt,TSt,ISt,jSt]}const wSt={auto:"auto",full:"1 / -1"},_St={auto:"auto",full:"1 / -1"};function SSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$row,n=>typeof n=="number"?{gridRow:`span ${n} / span ${n}`}:{gridRow:wSt[n]})}function kSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$rowStart,n=>({gridRowStart:`${n}`}))}function ESt(t){const{media:e}=Jt(t.theme);return $i(e,t.$rowEnd,n=>({gridRowEnd:`${n}`}))}function TSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$column,n=>typeof n=="number"?{gridColumn:`span ${n} / span ${n}`}:{gridColumn:_St[n]})}function ISt(t){const{media:e}=Jt(t.theme);return $i(e,t.$columnStart,n=>({gridColumnStart:`${n}`}))}function jSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$columnEnd,n=>({gridColumnEnd:`${n}`}))}const ASt={"&&:not([hidden])":{display:"grid"},'&[data-as="ul"],&[data-as="ol"]':{listStyle:"none"}},RSt={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"},DSt={auto:"auto",min:"min-content",max:"max-content",fr:"minmax(0, 1fr)"};function OSt(){return[ASt,PSt,$St,MSt,LSt,FSt,NSt,BSt,VSt]}function PSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$autoFlow,n=>({gridAutoFlow:n}))}function $St(t){const{media:e}=Jt(t.theme);return $i(e,t.$autoRows,n=>({gridAutoRows:n&&DSt[n]}))}function MSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$autoCols,n=>({gridAutoColumns:n&&RSt[n]}))}function LSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$columns,n=>({gridTemplateColumns:n&&`repeat(${n},minmax(0,1fr));`}))}function FSt(t){const{media:e}=Jt(t.theme);return $i(e,t.$rows,n=>({gridTemplateRows:n&&`repeat(${n},minmax(0,1fr));`}))}function NSt(t){const{media:e,space:n}=Jt(t.theme);return $i(e,t.$gap,r=>({gridGap:r?qt(n[r]):void 0}))}function BSt(t){const{media:e,space:n}=Jt(t.theme);return $i(e,t.$gapX,r=>({columnGap:r?qt(n[r]):void 0}))}function VSt(t){const{media:e,space:n}=Jt(t.theme);return $i(e,t.$gapY,r=>({rowGap:r?qt(n[r]):void 0}))}function lde(t){const{$fontSize:e,$iconLeft:n,$iconRight:r,$padding:i,$space:o}=t,{font:s,media:a,space:l}=Jt(t.theme),c=Math.max(i.length,o.length,e.length),u=[],f=[],h=[];for(let p=0;p{const g=s.text.sizes[h[m]]||s.text.sizes[2],y=g.lineHeight-g.ascenderHeight-g.descenderHeight,b=l[u[m]],v=l[f[m]],x={paddingTop:qt(b-g.ascenderHeight),paddingRight:qt(b),paddingBottom:qt(b-g.descenderHeight),paddingLeft:qt(b)};return r&&(x.paddingRight=qt(b+y+v)),n&&(x.paddingLeft=qt(b+y+v)),x})}function zSt(t){return lde({...t,$iconRight:!0})}const HSt=st` + &:not([hidden]) { + display: flex; + } + + align-items: center; +`;function XWe(){return HSt}function ZWe(t){const{$scheme:e,$tone:n,$weight:r}=t,{color:i,font:o}=Jt(t.theme);return st` + appearance: none; + background: none; + border: 0; + border-radius: 0; + outline: none; + width: 100%; + box-sizing: border-box; + font-family: ${o.text.family}; + font-weight: ${r&&o.text.weights[r]||o.text.weights.regular}; + margin: 0; + position: relative; + z-index: 1; + display: block; + + /* NOTE: This is a hack to disable Chrome’s autofill styles */ + &:-webkit-autofill, + &:-webkit-autofill:hover, + &:-webkit-autofill:focus, + &:-webkit-autofill:active { + -webkit-text-fill-color: var(--input-fg-color) !important; + transition: background-color 5000s; + transition-delay: 86400s /* 24h */; + } + + /* &:is(textarea) */ + &[data-as='textarea'] { + resize: none; + } + + color: var(--input-fg-color); + + &::placeholder { + color: var(--input-placeholder-color); + } + + &[data-scheme='${e}'][data-tone='${n}'] { + --input-fg-color: ${i.input.default.enabled.fg}; + --input-placeholder-color: ${i.input.default.enabled.placeholder}; + + /* enabled */ + &:not(:invalid):not(:disabled):not(:read-only) { + --input-fg-color: ${i.input.default.enabled.fg}; + --input-placeholder-color: ${i.input.default.enabled.placeholder}; + } + + /* disabled */ + &:not(:invalid):disabled { + --input-fg-color: ${i.input.default.disabled.fg}; + --input-placeholder-color: ${i.input.default.disabled.placeholder}; + } + + /* invalid */ + &:invalid { + --input-fg-color: ${i.input.invalid.enabled.fg}; + --input-placeholder-color: ${i.input.invalid.enabled.placeholder}; + } + + /* readOnly */ + &:read-only { + --input-fg-color: ${i.input.default.readOnly.fg}; + --input-placeholder-color: ${i.input.default.readOnly.placeholder}; + } + } + `}function QWe(t){const{font:e,media:n}=Jt(t.theme);return $i(n,t.$fontSize,r=>{const i=e.text.sizes[r]||e.text.sizes[2];return{fontSize:qt(i.fontSize),lineHeight:`${i.lineHeight/i.fontSize}`}})}function JWe(t){const{$hasPrefix:e,$hasSuffix:n,$scheme:r,$tone:i,$unstableDisableFocusRing:o}=t,{color:s,input:a}=Jt(t.theme);return st` + --input-box-shadow: none; + + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + display: block; + pointer-events: none; + z-index: 0; + + background-color: var(--card-bg-color); + box-shadow: var(--input-box-shadow); + + border-top-left-radius: ${e?0:void 0}; + border-bottom-left-radius: ${e?0:void 0}; + border-top-right-radius: ${n?0:void 0}; + border-bottom-right-radius: ${n?0:void 0}; + + &[data-scheme='${r}'][data-tone='${i}'] { + --card-bg-color: ${s.input.default.enabled.bg}; + --card-fg-color: ${s.input.default.enabled.fg}; + + /* enabled */ + *:not(:disabled) + &[data-border] { + --input-box-shadow: ${Dc({color:s.input.default.enabled.border,width:a.border.width})}; + } + + /* invalid */ + *:not(:disabled):invalid + & { + --card-bg-color: ${s.input.invalid.enabled.bg}; + --card-fg-color: ${s.input.invalid.enabled.fg}; + + &[data-border] { + --input-box-shadow: ${Dc({color:s.input.invalid.enabled.border,width:a.border.width})}; + } + } + + /* focused */ + *:not(:disabled):focus + & { + &[data-border] { + --input-box-shadow: ${o?void 0:Up({border:{color:s.input.default.enabled.border,width:a.border.width},focusRing:a.text.focusRing})}; + } + + &:not([data-border]) { + --input-box-shadow: ${o?void 0:Up({focusRing:a.text.focusRing})}; + } + } + + /* disabled */ + *:not(:invalid):disabled + & { + --card-bg-color: ${s.input.default.disabled.bg} !important; + --card-fg-color: ${s.input.default.disabled.fg} !important; + --card-icon-color: ${s.input.default.disabled.fg} !important; + + &[data-border] { + --input-box-shadow: ${Dc({color:s.input.default.disabled.border,width:a.border.width})}; + } + } + + *:invalid:disabled + & { + --card-bg-color: ${s.input.invalid.disabled.bg} !important; + --card-fg-color: ${s.input.invalid.disabled.fg} !important; + --card-icon-color: ${s.input.invalid.disabled.fg} !important; + + &[data-border] { + --input-box-shadow: ${Dc({color:s.input.invalid.disabled.border,width:a.border.width})}; + } + } + + /* readOnly */ + *:not(:invalid):read-only + & { + --card-bg-color: ${s.input.default.readOnly.bg} !important; + --card-fg-color: ${s.input.default.readOnly.fg} !important; + } + + *:invalid:read-only + & { + --card-bg-color: ${s.input.invalid.readOnly.bg} !important; + --card-fg-color: ${s.input.invalid.readOnly.fg} !important; + } + + /* hovered */ + @media (hover: hover) { + *:not(:disabled):not(:read-only):not(:invalid):hover + & { + --card-bg-color: ${s.input.default.hovered.bg}; + --card-fg-color: ${s.input.default.hovered.fg}; + } + + *:invalid:not(:disabled):not(:read-only):hover + & { + --card-bg-color: ${s.input.invalid.hovered.bg}; + --card-fg-color: ${s.input.invalid.hovered.fg}; + } + + *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border] { + --input-box-shadow: ${Dc({color:s.input.default.hovered.border,width:a.border.width})}; + } + + *:invalid:not(:disabled):not(:read-only):not(:focus):hover + &[data-border] { + --input-box-shadow: ${Dc({color:s.input.invalid.hovered.border,width:a.border.width})}; + } + } + } + `}function USt(t){const{theme:e}=t;return[v2(e,["margin"],t.$margin),v2(e,["marginLeft","marginRight"],t.$marginX),v2(e,["marginTop","marginBottom"],t.$marginY),v2(e,["marginTop"],t.$marginTop),v2(e,["marginRight"],t.$marginRight),v2(e,["marginBottom"],t.$marginBottom),v2(e,["marginLeft"],t.$marginLeft)].filter(Boolean)}function eqe(t){const{theme:e}=t;return[v2(e,["padding"],t.$padding),v2(e,["paddingLeft","paddingRight"],t.$paddingX),v2(e,["paddingTop","paddingBottom"],t.$paddingY),v2(e,["paddingTop"],t.$paddingTop),v2(e,["paddingRight"],t.$paddingRight),v2(e,["paddingBottom"],t.$paddingBottom),v2(e,["paddingLeft"],t.$paddingLeft)].filter(Boolean)}function K7(t){const{media:e,radius:n}=Jt(t.theme);return $i(e,t.$radius,r=>{let i=0;return typeof r=="number"&&(i=qt(n[r])),r==="full"&&(i="9999px"),{borderRadius:i}})}function eY(t,e){return`${t.map(qt).join(" ")} ${e}`}function WSt(t,e=1){if(!t)return r8;const n=`0 0 0 ${qt(e)} var(--card-shadow-outline-color)`,r=eY(t.umbra,"var(--card-shadow-umbra-color)"),i=eY(t.penumbra,"var(--card-shadow-penumbra-color)"),o=eY(t.ambient,"var(--card-shadow-ambient-color)");return{boxShadow:`${n}, ${r}, ${i}, ${o}`}}function qSt(t){const{card:e,media:n,shadow:r}=Jt(t.theme);return $i(n,t.$shadow,i=>WSt(r[i],e.shadow.outline))}const cde=de.span.withConfig({displayName:"SpanWithTextOverflow",componentId:"sc-ol2i3b-0"})`display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;overflow:clip;`;function GSt(t){const{$accent:e,$muted:n}=t,{font:r}=Jt(t.theme);return st` + text-transform: uppercase; + + ${e&&st` + color: var(--card-accent-fg-color); + `} + + ${n&&st` + color: var(--card-muted-fg-color); + `} + + & code { + font-family: ${r.code.family}; + border-radius: 1px; + } + + & a { + text-decoration: none; + border-radius: 1px; + } + + & svg { + /* Certain popular CSS libraries changes the defaults for SVG display */ + /* Make sure SVGs are rendered as inline elements */ + display: inline; + } + + & [data-sanity-icon] { + vertical-align: baseline; + } + `}const YSt=de.div.withConfig({displayName:"StyledLabel",componentId:"sc-1luap7z-0"})(Y_t,sde,GSt),h1=E.forwardRef(function(t,e){const n=Ut.c(26);let r,i,o,s,a,l,c,u;n[0]!==t?({accent:r,align:i,children:o,muted:a,size:l,textOverflow:c,weight:u,...s}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8]);const f=a===void 0?!1:a,h=l===void 0?2:l;let p=o;if(c==="ellipsis"){let b;n[9]!==p?(b=d.jsx(cde,{children:p}),n[9]=p,n[10]=b):b=n[10],p=b}else{let b;n[11]!==p?(b=d.jsx("span",{children:p}),n[11]=p,n[12]=b):b=n[12],p=b}let m;n[13]!==i?(m=fn(i),n[13]=i,n[14]=m):m=n[14];let g;n[15]!==h?(g=fn(h),n[15]=h,n[16]=g):g=n[16];let y;return n[17]!==r||n[18]!==p||n[19]!==f||n[20]!==e||n[21]!==s||n[22]!==m||n[23]!==g||n[24]!==u?(y=d.jsx(YSt,{"data-ui":"Label",...s,$accent:r,$align:m,$muted:f,$size:g,$weight:u,ref:e,children:p}),n[17]=r,n[18]=p,n[19]=f,n[20]=e,n[21]=s,n[22]=m,n[23]=g,n[24]=u,n[25]=y):y=n[25],y});h1.displayName="ForwardRef(Label)";const dS={root:XSt,arrow:KSt,bgStroke:ekt,stroke:tkt,initials:JSt,image:QSt};function KSt(){return{position:"absolute",boxSizing:"border-box",zIndex:"0",opacity:"0",transition:"all 0.2s linear",transform:"rotate(-90deg) translate3d(0, 6px, 0)",left:0,right:0,top:0,bottom:0,"& > svg":{width:"11px",height:"7px",position:"absolute",top:"-5px",left:"50%",transform:"translateX(-6px)","&:not([hidden])":{display:"block"}},"[data-arrow-position='inside'] > &":{transform:"rotate(-90deg) translate3d(0, 6px, 0)",opacity:"0"},"[data-arrow-position='top'] > &":{opacity:"1",transform:"rotate(0deg)"},"[data-arrow-position='bottom'] > &":{opacity:"1",transform:"rotate(-180deg)"}}}function XSt(t){const{$color:e}=t,{avatar:n}=Jt(t.theme);return{"--avatar-bg-color":`var(--card-avatar-${e}-bg-color)`,"--avatar-fg-color":`var(--card-avatar-${e}-fg-color)`,backgroundColor:"var(--avatar-bg-color)",position:"relative",boxSizing:"border-box",userSelect:"none",boxShadow:"0 0 0 1px var(--card-bg-color)",'&[data-status="inactive"]':{opacity:"0.5"},"&>svg":{"&:not([hidden])":{display:"block"}},'&[data-as="button"]':{WebkitFontSmoothing:"inherit",appearance:"none",margin:0,padding:0,border:0,font:"inherit",color:"inherit",outline:"none","&:focus":{boxShadow:Up({focusRing:n.focusRing})},"&:focus:not(:focus-visible)":{boxShadow:"none"}}}}function ZSt(t){const{avatar:e,media:n}=Jt(t.theme);return $i(n,t.$size,r=>{const i=e.sizes[r]||e.sizes[0];return{width:qt(i.size),height:qt(i.size),borderRadius:qt(i.size/2),"&>svg":{width:qt(i.size),height:qt(i.size),borderRadius:qt(i.size/2)}}})}function QSt(){return{position:"relative"}}function JSt(){return{width:"100%",height:"100%",color:"var(--avatar-fg-color)",alignItems:"center",justifyContent:"center",textTransform:"uppercase",textAlign:"center",borderRadius:"50%","&:not([hidden])":{display:"flex"}}}function ekt(){return{strokeWidth:"4px",stroke:"var(--card-bg-color)"}}function tkt(){return{strokeWidth:"2px",stroke:"var(--avatar-bg-color)",'[data-status="editing"] &':{strokeDasharray:"2 4",strokeLinecap:"round"}}}const nkt=de.div.withConfig({displayName:"StyledAvatar",componentId:"sc-1rj7kl0-0"})(ZSt,dS.root),rkt=de.div.withConfig({displayName:"Arrow",componentId:"sc-1rj7kl0-1"})(dS.arrow),ikt=de.ellipse.withConfig({displayName:"BgStroke",componentId:"sc-1rj7kl0-2"})(dS.bgStroke),okt=de.ellipse.withConfig({displayName:"Stroke",componentId:"sc-1rj7kl0-3"})(dS.stroke),skt=de.div.withConfig({displayName:"Initials",componentId:"sc-1rj7kl0-4"})(dS.initials),akt=de(h1).withConfig({displayName:"InitialsLabel",componentId:"sc-1rj7kl0-5"})({color:"inherit"}),lkt=de.svg.withConfig({displayName:"AvatarImage",componentId:"sc-1rj7kl0-6"})(dS.image),ude=E.forwardRef(function(t,e){const n=Ut.c(46);let r,i,o,s,a,l,c,u,f,h,p,m;n[0]!==t?({__unstable_hideInnerStroke:r,as:s,color:f,src:u,title:m,initials:a,onImageLoadError:l,arrowPosition:o,animateArrowFrom:i,status:h,size:p,...c}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h,n[11]=p,n[12]=m):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10],p=n[11],m=n[12]);const g=f===void 0?"gray":f,y=h===void 0?"online":h,b=p===void 0?1:p,{avatar:v}=Y7(),x=FHe.isValidElementType(s)?s:"div",C=fn(b),w=(v.sizes[C[0]]||v.sizes[0]).size,_=w/2,S=E.useId(),[k,I]=E.useState(i||o||"inside"),[j,A]=E.useState(!1),D=`avatar-image-${S}`;let O,P;n[13]!==k||n[14]!==o?(O=()=>{if(k===o)return;const ee=requestAnimationFrame(()=>I(o));return()=>cancelAnimationFrame(ee)},P=[k,o],n[13]=k,n[14]=o,n[15]=O,n[16]=P):(O=n[15],P=n[16]),E.useEffect(O,P);let $,M;n[17]!==u?($=()=>{u&&A(!1)},M=[u],n[17]=u,n[18]=$,n[19]=M):($=n[18],M=n[19]),E.useEffect($,M);let L;n[20]!==l?(L=()=>{A(!0),l&&l(new Error("Avatar: the image failed to load"))},n[20]=l,n[21]=L):L=n[21];const B=L,W=nkt,N=typeof x=="string"?x:void 0,V="Avatar";let G;n[22]!==g?(G=d.jsx(rkt,{children:d.jsx("svg",{width:"11",height:"7",viewBox:"0 0 11 7",fill:"none",children:d.jsx("path",{d:"M6.67948 1.50115L11 7L0 7L4.32052 1.50115C4.92109 0.736796 6.07891 0.736795 6.67948 1.50115Z",fill:g})})}),n[22]=g,n[23]=G):G=n[23];let z;n[24]!==r||n[25]!==_||n[26]!==w||n[27]!==B||n[28]!==j||n[29]!==D||n[30]!==u?(z=!j&&u&&d.jsxs(lkt,{viewBox:`0 0 ${w} ${w}`,fill:"none",children:[d.jsx("defs",{children:d.jsx("pattern",{id:D,patternContentUnits:"objectBoundingBox",width:"1",height:"1",children:d.jsx("image",{href:u,width:"1",height:"1",onError:B})})}),d.jsx("circle",{cx:_,cy:_,r:_,fill:`url(#${D})`}),!r&&d.jsx(ikt,{cx:_,cy:_,rx:_,ry:_,vectorEffect:"non-scaling-stroke"}),d.jsx(okt,{cx:_,cy:_,rx:_,ry:_,vectorEffect:"non-scaling-stroke"})]}),n[24]=r,n[25]=_,n[26]=w,n[27]=B,n[28]=j,n[29]=D,n[30]=u,n[31]=z):z=n[31];const Y=(j||!u)&&a&&d.jsx(d.Fragment,{children:d.jsx(skt,{children:d.jsx(akt,{forwardedAs:"span",size:C.map(ckt),weight:"medium",children:a})})});let Z;return n[32]!==W||n[33]!==k||n[34]!==x||n[35]!==g||n[36]!==e||n[37]!==c||n[38]!==C||n[39]!==y||n[40]!==G||n[41]!==z||n[42]!==Y||n[43]!==N||n[44]!==m?(Z=d.jsxs(W,{as:x,"data-as":N,"data-ui":V,...c,$color:g,$size:C,"aria-label":m,"data-arrow-position":k,"data-status":y,ref:e,title:m,children:[G,z,Y]}),n[32]=W,n[33]=k,n[34]=x,n[35]=g,n[36]=e,n[37]=c,n[38]=C,n[39]=y,n[40]=G,n[41]=z,n[42]=Y,n[43]=N,n[44]=m,n[45]=Z):Z=n[45],Z});ude.displayName="ForwardRef(Avatar)";function ckt(t){return t===1?1:t===2?3:t===3?5:0}function ukt(t){const{avatar:e,media:n}=Jt(t.theme);return $i(n,t.$size,r=>{const i=e.sizes[r];return i?{borderRadius:qt(i.size/2),minWidth:qt(i.size),height:qt(i.size)}:r8})}function dkt(t){const{space:e}=Jt(t.theme);return st` + align-items: center; + justify-content: center; + box-sizing: border-box; + user-select: none; + color: inherit; + color: var(--card-fg-color); + background: var(--card-bg-color); + box-shadow: + 0 0 0 1px var(--card-bg-color), + inset 0 0 0 1px var(--card-hairline-hard-color); + padding: 0 ${qt(e[2])}; + + &:not([hidden]) { + display: flex; + } + `}const fkt=de.div.withConfig({displayName:"StyledAvatarCounter",componentId:"sc-1ydx86y-0"})(ukt,dkt),BF=E.forwardRef(function(t,e){const n=Ut.c(20),{count:r,size:i}=t,o=i===void 0?1:i;let s,a,l,c,u,f,h;if(n[0]!==e||n[1]!==o){const g=fn(o);a=fkt,u=g,f="AvatarCounter",h=e,s=h1,l="span",c=g.map(hkt),n[0]=e,n[1]=o,n[2]=s,n[3]=a,n[4]=l,n[5]=c,n[6]=u,n[7]=f,n[8]=h}else s=n[2],a=n[3],l=n[4],c=n[5],u=n[6],f=n[7],h=n[8];let p;n[9]!==s||n[10]!==r||n[11]!==l||n[12]!==c?(p=d.jsx(s,{as:l,size:c,weight:"medium",children:r}),n[9]=s,n[10]=r,n[11]=l,n[12]=c,n[13]=p):p=n[13];let m;return n[14]!==a||n[15]!==u||n[16]!==f||n[17]!==h||n[18]!==p?(m=d.jsx(a,{$size:u,"data-ui":f,ref:h,children:p}),n[14]=a,n[15]=u,n[16]=f,n[17]=h,n[18]=p,n[19]=m):m=n[19],m});BF.displayName="ForwardRef(AvatarCounter)";function hkt(t){return t===1?1:t===2?3:t===3?5:0}const pkt=st` + white-space: nowrap; + + & > div { + vertical-align: top; + + &:not([hidden]) { + display: inline-block; + } + } +`;function mkt(){return pkt}function gkt(t){const{avatar:e,media:n}=Jt(t.theme);return $i(n,t.$size,r=>{const i=e.sizes[r];return i?{"& > div + div":{marginLeft:qt(i.distance)}}:r8})}const ykt=de.div.withConfig({displayName:"StyledAvatarStack",componentId:"sc-cysmbb-0"})(gkt,mkt),aR=E.forwardRef(function(t,e){const n=Ut.c(38);let r,i,o,s;n[0]!==t?({children:r,maxLength:o,size:s,...i}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s):(r=n[1],i=n[2],o=n[3],s=n[4]);const a=o===void 0?4:o,l=s===void 0?1:s;let c,u,f,h,p,m,g,y;if(n[5]!==r||n[6]!==a||n[7]!==e||n[8]!==i||n[9]!==l){const v=E.Children.toArray(r).filter(E.isValidElement),x=Math.max(a,0);let C;n[18]!==l?(C=fn(l),n[18]=l,n[19]=C):C=n[19];const w=C,_=v.length,S=x-1,k=_-S,I=k>1?v.slice(k,_):v;c=ykt,u="AvatarStack",f=i,h=e,p=w,n[20]!==_||n[21]!==w?(m=_===0&&d.jsx("div",{children:d.jsx(BF,{count:_,size:w})}),n[20]=_,n[21]=w,n[22]=m):m=n[22],n[23]!==k||n[24]!==_||n[25]!==w?(g=_!==0&&k>1&&d.jsx("div",{children:d.jsx(BF,{count:k,size:w})}),n[23]=k,n[24]=_,n[25]=w,n[26]=g):g=n[26];let j;n[27]!==w?(j=(A,D)=>d.jsx("div",{children:E.cloneElement(A,{size:w})},String(D)),n[27]=w,n[28]=j):j=n[28],y=I.map(j),n[5]=r,n[6]=a,n[7]=e,n[8]=i,n[9]=l,n[10]=c,n[11]=u,n[12]=f,n[13]=h,n[14]=p,n[15]=m,n[16]=g,n[17]=y}else c=n[10],u=n[11],f=n[12],h=n[13],p=n[14],m=n[15],g=n[16],y=n[17];let b;return n[29]!==c||n[30]!==u||n[31]!==f||n[32]!==h||n[33]!==p||n[34]!==m||n[35]!==g||n[36]!==y?(b=d.jsxs(c,{"data-ui":u,...f,ref:h,$size:p,children:[m,g,y]}),n[29]=c,n[30]=u,n[31]=f,n[32]=h,n[33]=p,n[34]=m,n[35]=g,n[36]=y,n[37]=b):b=n[37],b});aR.displayName="ForwardRef(AvatarStack)";const bkt=de.div.withConfig({displayName:"StyledBox",componentId:"sc-1hhky9f-0"})(sSt,KWe,aSt,CSt,USt,eqe),me=E.forwardRef(function(t,e){const n=Ut.c(109);let r,i,o,s,a,l,c,u,f,h,p,m,g,y,b,v,x,C,w,_,S,k,I,j,A,D,O;n[0]!==t?({as:j,column:r,columnStart:o,columnEnd:i,display:A,flex:s,height:a,margin:D,marginX:h,marginY:p,marginTop:f,marginRight:u,marginBottom:l,marginLeft:c,overflow:m,padding:O,paddingX:x,paddingY:C,paddingTop:v,paddingRight:b,paddingBottom:g,paddingLeft:y,row:_,rowStart:k,rowEnd:S,sizing:I,...w}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h,n[11]=p,n[12]=m,n[13]=g,n[14]=y,n[15]=b,n[16]=v,n[17]=x,n[18]=C,n[19]=w,n[20]=_,n[21]=S,n[22]=k,n[23]=I,n[24]=j,n[25]=A,n[26]=D,n[27]=O):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10],p=n[11],m=n[12],g=n[13],y=n[14],b=n[15],v=n[16],x=n[17],C=n[18],w=n[19],_=n[20],S=n[21],k=n[22],I=n[23],j=n[24],A=n[25],D=n[26],O=n[27]);const P=j===void 0?"div":j,$=A===void 0?"block":A,M=D===void 0?0:D,L=O===void 0?0:O,B=typeof P=="string"?P:void 0;let W;n[28]!==r?(W=fn(r),n[28]=r,n[29]=W):W=n[29];let N;n[30]!==o?(N=fn(o),n[30]=o,n[31]=N):N=n[31];let V;n[32]!==i?(V=fn(i),n[32]=i,n[33]=V):V=n[33];let G;n[34]!==$?(G=fn($),n[34]=$,n[35]=G):G=n[35];let z;n[36]!==s?(z=fn(s),n[36]=s,n[37]=z):z=n[37];let Y;n[38]!==a?(Y=fn(a),n[38]=a,n[39]=Y):Y=n[39];let Z;n[40]!==M?(Z=fn(M),n[40]=M,n[41]=Z):Z=n[41];let ee;n[42]!==h?(ee=fn(h),n[42]=h,n[43]=ee):ee=n[43];let K;n[44]!==p?(K=fn(p),n[44]=p,n[45]=K):K=n[45];let q;n[46]!==f?(q=fn(f),n[46]=f,n[47]=q):q=n[47];let re;n[48]!==u?(re=fn(u),n[48]=u,n[49]=re):re=n[49];let te;n[50]!==l?(te=fn(l),n[50]=l,n[51]=te):te=n[51];let ae;n[52]!==c?(ae=fn(c),n[52]=c,n[53]=ae):ae=n[53];let se;n[54]!==m?(se=fn(m),n[54]=m,n[55]=se):se=n[55];let le;n[56]!==L?(le=fn(L),n[56]=L,n[57]=le):le=n[57];let pe;n[58]!==x?(pe=fn(x),n[58]=x,n[59]=pe):pe=n[59];let be;n[60]!==C?(be=fn(C),n[60]=C,n[61]=be):be=n[61];let xe;n[62]!==v?(xe=fn(v),n[62]=v,n[63]=xe):xe=n[63];let Ce;n[64]!==b?(Ce=fn(b),n[64]=b,n[65]=Ce):Ce=n[65];let Te;n[66]!==g?(Te=fn(g),n[66]=g,n[67]=Te):Te=n[67];let _e;n[68]!==y?(_e=fn(y),n[68]=y,n[69]=_e):_e=n[69];let Ie;n[70]!==_?(Ie=fn(_),n[70]=_,n[71]=Ie):Ie=n[71];let ye;n[72]!==k?(ye=fn(k),n[72]=k,n[73]=ye):ye=n[73];let fe;n[74]!==S?(fe=fn(S),n[74]=S,n[75]=fe):fe=n[75];let ve;n[76]!==I?(ve=fn(I),n[76]=I,n[77]=ve):ve=n[77];let Se;return n[78]!==P||n[79]!==t.children||n[80]!==e||n[81]!==w||n[82]!==Y||n[83]!==Z||n[84]!==ee||n[85]!==K||n[86]!==q||n[87]!==re||n[88]!==te||n[89]!==ae||n[90]!==se||n[91]!==le||n[92]!==pe||n[93]!==be||n[94]!==xe||n[95]!==Ce||n[96]!==Te||n[97]!==_e||n[98]!==Ie||n[99]!==ye||n[100]!==fe||n[101]!==ve||n[102]!==B||n[103]!==W||n[104]!==N||n[105]!==V||n[106]!==G||n[107]!==z?(Se=d.jsx(bkt,{"data-as":B,"data-ui":"Box",...w,$column:W,$columnStart:N,$columnEnd:V,$display:G,$flex:z,$height:Y,$margin:Z,$marginX:ee,$marginY:K,$marginTop:q,$marginRight:re,$marginBottom:te,$marginLeft:ae,$overflow:se,$padding:le,$paddingX:pe,$paddingY:be,$paddingTop:xe,$paddingRight:Ce,$paddingBottom:Te,$paddingLeft:_e,$row:Ie,$rowStart:ye,$rowEnd:fe,$sizing:ve,as:P,ref:e,children:t.children}),n[78]=P,n[79]=t.children,n[80]=e,n[81]=w,n[82]=Y,n[83]=Z,n[84]=ee,n[85]=K,n[86]=q,n[87]=re,n[88]=te,n[89]=ae,n[90]=se,n[91]=le,n[92]=pe,n[93]=be,n[94]=xe,n[95]=Ce,n[96]=Te,n[97]=_e,n[98]=Ie,n[99]=ye,n[100]=fe,n[101]=ve,n[102]=B,n[103]=W,n[104]=N,n[105]=V,n[106]=G,n[107]=z,n[108]=Se):Se=n[108],Se});me.displayName="ForwardRef(Box)";function vkt(t){const{$accent:e,$muted:n}=t,{font:r}=Jt(t.theme);return st` + color: var(--card-fg-color); + + ${e&&st` + color: var(--card-accent-fg-color); + `} + + ${n&&st` + color: var(--card-muted-fg-color); + `} + + & code { + font-family: ${r.code.family}; + border-radius: 1px; + background-color: var(--card-code-bg-color); + color: var(--card-code-fg-color); + } + + & a { + text-decoration: none; + border-radius: 1px; + color: var(--card-link-color); + outline: none; + + @media (hover: hover) { + &:hover { + text-decoration: underline; + } + } + + &:focus { + box-shadow: + 0 0 0 1px var(--card-bg-color), + 0 0 0 3px var(--card-focus-ring-color); + } + + &:focus:not(:focus-visible) { + box-shadow: none; + } + } + + & strong { + font-weight: ${r.text.weights.bold}; + } + + & svg { + /* Certain popular CSS libraries changes the defaults for SVG display */ + /* Make sure SVGs are rendered as inline elements */ + display: inline; + } + + & [data-sanity-icon] { + vertical-align: baseline; + color: var(--card-icon-color); + + & path { + vector-effect: non-scaling-stroke !important; + } + } + `}const xkt=de.div.withConfig({displayName:"StyledText",componentId:"sc-11ov82j-0"})(K_t,sde,vkt),oe=E.forwardRef(function(t,e){const n=Ut.c(26);let r,i,o,s,a,l,c,u;n[0]!==t?({accent:s,align:r,children:i,muted:a,size:l,textOverflow:c,weight:u,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8]);const f=s===void 0?!1:s,h=a===void 0?!1:a,p=l===void 0?2:l;let m=i;if(c==="ellipsis"){let x;n[9]!==m?(x=d.jsx(cde,{children:m}),n[9]=m,n[10]=x):x=n[10],m=x}let g;n[11]!==r?(g=fn(r),n[11]=r,n[12]=g):g=n[12];let y;n[13]!==p?(y=fn(p),n[13]=p,n[14]=y):y=n[14];let b;n[15]!==m?(b=d.jsx("span",{children:m}),n[15]=m,n[16]=b):b=n[16];let v;return n[17]!==f||n[18]!==h||n[19]!==e||n[20]!==o||n[21]!==g||n[22]!==y||n[23]!==b||n[24]!==u?(v=d.jsx(xkt,{"data-ui":"Text",...o,$accent:f,$align:g,$muted:h,ref:e,$size:y,$weight:u,children:b}),n[17]=f,n[18]=h,n[19]=e,n[20]=o,n[21]=g,n[22]=y,n[23]=b,n[24]=u,n[25]=v):v=n[25],v});oe.displayName="ForwardRef(Text)";function Ckt(t){const{$tone:e}=t;return{"--card-bg-color":`var(--card-badge-${e}-bg-color)`,"--card-fg-color":`var(--card-badge-${e}-fg-color)`,backgroundColor:"var(--card-bg-color)",cursor:"default","&:not([hidden])":{display:"inline-block",verticalAlign:"top"}}}const wkt=de(me).withConfig({displayName:"StyledBadge",componentId:"sc-5u140l-0"})(K7,Ckt),Ys=E.forwardRef(function(t,e){const n=Ut.c(21);let r,i,o,s,a,l;if(n[0]!==t){const{children:b,fontSize:v,mode:x,padding:C,radius:w,tone:_,...S}=t;r=b,o=v,s=C,a=w,l=_,i=S,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l}else r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6];const c=o===void 0?1:o,u=s===void 0?1:s,f=a===void 0?"full":a,h=l===void 0?"default":l;let p;n[7]!==f?(p=fn(f),n[7]=f,n[8]=p):p=n[8];let m;n[9]!==u?(m=fn(u),n[9]=u,n[10]=m):m=n[10];let g;n[11]!==r||n[12]!==c?(g=d.jsx(oe,{size:c,children:r}),n[11]=r,n[12]=c,n[13]=g):g=n[13];let y;return n[14]!==e||n[15]!==i||n[16]!==p||n[17]!==m||n[18]!==g||n[19]!==h?(y=d.jsx(wkt,{"data-ui":"Badge",...i,$tone:h,$radius:p,padding:m,ref:e,children:g}),n[14]=e,n[15]=i,n[16]=p,n[17]=m,n[18]=g,n[19]=h,n[20]=y):y=n[20],y});Ys.displayName="ForwardRef(Badge)";const _kt=de(me).withConfig({displayName:"StyledFlex",componentId:"sc-oxesg3-0"})(KWe,mSt),ge=E.forwardRef(function(t,e){const n=Ut.c(27);let r,i,o,s,a,l,c;n[0]!==t?({align:r,as:i,direction:l,gap:o,justify:s,wrap:c,...a}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7]);const u=l===void 0?"row":l;let f;n[8]!==r?(f=fn(r),n[8]=r,n[9]=f):f=n[9];let h;n[10]!==u?(h=fn(u),n[10]=u,n[11]=h):h=n[11];let p;n[12]!==o?(p=fn(o),n[12]=o,n[13]=p):p=n[13];let m;n[14]!==s?(m=fn(s),n[14]=s,n[15]=m):m=n[15];let g;n[16]!==c?(g=fn(c),n[16]=c,n[17]=g):g=n[17];let y;return n[18]!==i||n[19]!==e||n[20]!==a||n[21]!==f||n[22]!==h||n[23]!==p||n[24]!==m||n[25]!==g?(y=d.jsx(_kt,{"data-ui":"Flex",...a,$align:f,$direction:h,$gap:p,$justify:m,$wrap:g,forwardedAs:i,ref:e}),n[18]=i,n[19]=e,n[20]=a,n[21]=f,n[22]=h,n[23]=p,n[24]=m,n[25]=g,n[26]=y):y=n[26],y});ge.displayName="ForwardRef(Flex)";const Skt=Vf` + from { + transform: rotate(0deg); + } + + to { + transform: rotate(360deg); + } +`,kkt=de(oe).withConfig({displayName:"StyledSpinner",componentId:"sc-124hnd0-0"})`& > span > svg{animation:${Skt} 500ms linear infinite;}`,Js=E.forwardRef(function(t,e){const n=Ut.c(4);let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=d.jsx(H7,{}),n[0]=r):r=n[0];let i;return n[1]!==t||n[2]!==e?(i=d.jsx(kkt,{"data-ui":"Spinner",...t,ref:e,children:r}),n[1]=t,n[2]=e,n[3]=i):i=n[3],i});Js.displayName="ForwardRef(Spinner)";function Ua(t,e,n=!1){return{"--card-backdrop-color":t.backdrop,"--card-focus-ring-color":t.focusRing,"--card-shadow-outline-color":t.shadow.outline,"--card-shadow-umbra-color":t.shadow.umbra,"--card-shadow-penumbra-color":t.shadow.penumbra,"--card-shadow-ambient-color":t.shadow.ambient,"--card-accent-fg-color":e.accent.fg,"--card-avatar-gray-bg-color":e.avatar.gray.bg,"--card-avatar-gray-fg-color":e.avatar.gray.fg,"--card-avatar-blue-bg-color":e.avatar.blue.bg,"--card-avatar-blue-fg-color":e.avatar.blue.fg,"--card-avatar-purple-bg-color":e.avatar.purple.bg,"--card-avatar-purple-fg-color":e.avatar.purple.fg,"--card-avatar-magenta-bg-color":e.avatar.magenta.bg,"--card-avatar-magenta-fg-color":e.avatar.magenta.fg,"--card-avatar-red-bg-color":e.avatar.red.bg,"--card-avatar-red-fg-color":e.avatar.red.fg,"--card-avatar-orange-bg-color":e.avatar.orange.bg,"--card-avatar-orange-fg-color":e.avatar.orange.fg,"--card-avatar-yellow-bg-color":e.avatar.yellow.bg,"--card-avatar-yellow-fg-color":e.avatar.yellow.fg,"--card-avatar-green-bg-color":e.avatar.green.bg,"--card-avatar-green-fg-color":e.avatar.green.fg,"--card-avatar-cyan-bg-color":e.avatar.cyan.bg,"--card-avatar-cyan-fg-color":e.avatar.cyan.fg,"--card-bg-color":e.bg,"--card-bg-image":n?`repeating-conic-gradient(${e.bg} 0% 25%, ${e.muted.bg} 0% 50%)`:void 0,"--card-border-color":e.border,"--card-badge-default-bg-color":e.badge.default.bg,"--card-badge-default-dot-color":e.badge.default.dot,"--card-badge-default-fg-color":e.badge.default.fg,"--card-badge-default-icon-color":e.badge.default.icon,"--card-badge-neutral-bg-color":e.badge.neutral?.bg,"--card-badge-neutral-dot-color":e.badge.neutral?.dot,"--card-badge-neutral-fg-color":e.badge.neutral?.fg,"--card-badge-neutral-icon-color":e.badge.neutral?.icon,"--card-badge-primary-bg-color":e.badge.primary.bg,"--card-badge-primary-dot-color":e.badge.primary.dot,"--card-badge-primary-fg-color":e.badge.primary.fg,"--card-badge-primary-icon-color":e.badge.primary.icon,"--card-badge-suggest-bg-color":e.badge.suggest?.bg,"--card-badge-suggest-dot-color":e.badge.suggest?.dot,"--card-badge-suggest-fg-color":e.badge.suggest?.fg,"--card-badge-suggest-icon-color":e.badge.suggest?.icon,"--card-badge-positive-bg-color":e.badge.positive.bg,"--card-badge-positive-dot-color":e.badge.positive.dot,"--card-badge-positive-fg-color":e.badge.positive.fg,"--card-badge-positive-icon-color":e.badge.positive.icon,"--card-badge-caution-bg-color":e.badge.caution.bg,"--card-badge-caution-dot-color":e.badge.caution.dot,"--card-badge-caution-fg-color":e.badge.caution.fg,"--card-badge-caution-icon-color":e.badge.caution.icon,"--card-badge-critical-bg-color":e.badge.critical.bg,"--card-badge-critical-dot-color":e.badge.critical.dot,"--card-badge-critical-fg-color":e.badge.critical.fg,"--card-badge-critical-icon-color":e.badge.critical.icon,"--card-code-bg-color":e.code.bg,"--card-code-fg-color":e.code.fg,"--card-fg-color":e.fg,"--card-icon-color":e.icon,"--card-kbd-bg-color":e.kbd.bg,"--card-kbd-border-color":e.kbd.border,"--card-kbd-fg-color":e.kbd.fg,"--card-link-fg-color":e.link.fg,"--card-muted-bg-color":e.muted.bg,"--card-muted-fg-color":e.muted.fg,"--card-skeleton-color-from":e.skeleton.from,"--card-skeleton-color-to":e.skeleton.to,"--card-bg2-color":e.muted.bg,"--card-link-color":e.link.fg,"--card-hairline-soft-color":e.border,"--card-hairline-hard-color":e.border}}function Ekt(t){const{$width:e}=t,{style:n}=Jt(t.theme);return st` + ${n?.button}; + + -webkit-font-smoothing: inherit; + appearance: none; + display: inline-flex; + align-items: center; + font: inherit; + border: 0; + outline: none; + user-select: none; + text-decoration: none; + border: 0; + box-sizing: border-box; + padding: 0; + margin: 0; + white-space: nowrap; + text-align: left; + position: relative; + vertical-align: top; + + ${e==="fill"&&st` + width: -moz-available; + width: -webkit-fill-available; + width: stretch; + `} + + & > span { + display: block; + flex: 1; + min-width: 0; + border-radius: inherit; + } + + &::-moz-focus-inner { + border: 0; + padding: 0; + } + `}function n8e(...t){return t.filter(Boolean).join(",")}function Tkt(t){const{$mode:e}=t,{button:n,color:r,style:i}=Jt(t.theme),o=t.$mode==="ghost",s=r.button[e]||r.button.default,a=s[t.$tone]||s.default,l={width:n.border.width,color:"var(--card-border-color)"},c=void 0;return[Ua(r,a.enabled),{backgroundColor:"var(--card-bg-color)",color:"var(--card-fg-color)",boxShadow:Dc(l),'&:disabled, &[data-disabled="true"]':Ua(r,a.disabled),"&:not([data-disabled='true'])":{boxShadow:n8e(Dc(l),o?c:void 0),"&:focus":{boxShadow:Up({base:r,border:{width:2,color:r.bg},focusRing:n.focusRing})},"&:focus:not(:focus-visible)":{boxShadow:n8e(Dc(l),o?c:void 0)},"@media (hover: hover)":{"&:hover":Ua(r,a.hovered),"&:active":Ua(r,a.pressed),"&[data-hovered]":Ua(r,a.hovered)},"&[data-selected]":Ua(r,a.pressed)}},i?.button?.root].filter(Boolean)}const Ikt=de.button.withConfig({displayName:"StyledButton",componentId:"sc-aaekt4-0"})(K7,Ekt,Tkt),jkt=de.div.withConfig({displayName:"LoadingBox",componentId:"sc-aaekt4-1"})`position:absolute;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;background-color:var(--card-bg-color);border-radius:inherit;z-index:1;box-shadow:inherit;`,vn=E.forwardRef(function(t,e){const n=Ut.c(86);let r,i,o,s,a,l,c,u,f,h,p,m,g,y,b,v,x,C,w,_,S,k,I,j,A,D;n[0]!==t?({children:o,disabled:s,fontSize:y,icon:r,iconRight:i,justify:b,loading:a,mode:v,padding:x,paddingX:h,paddingY:p,paddingTop:f,paddingBottom:l,paddingLeft:c,paddingRight:u,radius:C,selected:g,space:w,text:I,textAlign:j,textWeight:A,tone:_,type:S,muted:k,width:D,...m}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h,n[11]=p,n[12]=m,n[13]=g,n[14]=y,n[15]=b,n[16]=v,n[17]=x,n[18]=C,n[19]=w,n[20]=_,n[21]=S,n[22]=k,n[23]=I,n[24]=j,n[25]=A,n[26]=D):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10],p=n[11],m=n[12],g=n[13],y=n[14],b=n[15],v=n[16],x=n[17],C=n[18],w=n[19],_=n[20],S=n[21],k=n[22],I=n[23],j=n[24],A=n[25],D=n[26]);const O=y===void 0?1:y,P=b===void 0?"center":b,$=v===void 0?"default":v,M=x===void 0?3:x,L=C===void 0?2:C,B=w===void 0?3:w,W=_===void 0?"default":_,N=S===void 0?"button":S,V=k===void 0?!1:k,{button:G}=Y7();let z;n[27]!==P?(z=fn(P),n[27]=P,n[28]=z):z=n[28];const Y=z;let Z;n[29]!==M?(Z=fn(M),n[29]=M,n[30]=Z):Z=n[30];const ee=Z;let K;n[31]!==h?(K=fn(h),n[31]=h,n[32]=K):K=n[32];const q=K;let re;n[33]!==p?(re=fn(p),n[33]=p,n[34]=re):re=n[34];const te=re;let ae;n[35]!==f?(ae=fn(f),n[35]=f,n[36]=ae):ae=n[36];const se=ae;let le;n[37]!==l?(le=fn(l),n[37]=l,n[38]=le):le=n[38];const pe=le;let be;n[39]!==c?(be=fn(c),n[39]=c,n[40]=be):be=n[40];const xe=be;let Ce;n[41]!==u?(Ce=fn(u),n[41]=u,n[42]=Ce):Ce=n[42];const Te=Ce;let _e;n[43]!==L?(_e=fn(L),n[43]=L,n[44]=_e):_e=n[44];const Ie=_e;let ye;n[45]!==B?(ye=fn(B),n[45]=B,n[46]=ye):ye=n[46];const fe=ye;let ve;n[47]!==ee||n[48]!==pe||n[49]!==xe||n[50]!==Te||n[51]!==se||n[52]!==q||n[53]!==te?(ve={padding:ee,paddingX:q,paddingY:te,paddingTop:se,paddingBottom:pe,paddingLeft:xe,paddingRight:Te},n[47]=ee,n[48]=pe,n[49]=xe,n[50]=Te,n[51]=se,n[52]=q,n[53]=te,n[54]=ve):ve=n[54];const Se=ve,Ee=!!(a||s),je=g?"":void 0,Me=!!(a||s);let Fe;n[55]!==a?(Fe=!!a&&d.jsx(jkt,{children:d.jsx(Js,{})}),n[55]=a,n[56]=Fe):Fe=n[56];let $e;n[57]!==r||n[58]!==i||n[59]!==Se||n[60]!==G||n[61]!==O||n[62]!==Y||n[63]!==V||n[64]!==fe||n[65]!==I||n[66]!==j||n[67]!==A?($e=(r||I||i)&&d.jsx(me,{as:"span",...Se,children:d.jsxs(ge,{as:"span",justify:Y,gap:fe,children:[r&&d.jsxs(oe,{size:O,children:[E.isValidElement(r)&&r,ma.isValidElementType(r)&&d.jsx(r,{})]}),I&&d.jsx(me,{children:d.jsx(oe,{muted:V,align:j,size:O,textOverflow:"ellipsis",weight:A??G.textWeight,children:I})}),i&&d.jsxs(oe,{size:O,children:[E.isValidElement(i)&&i,ma.isValidElementType(i)&&d.jsx(i,{})]})]})}),n[57]=r,n[58]=i,n[59]=Se,n[60]=G,n[61]=O,n[62]=Y,n[63]=V,n[64]=fe,n[65]=I,n[66]=j,n[67]=A,n[68]=$e):$e=n[68];let Ye;n[69]!==Se||n[70]!==o?(Ye=o&&d.jsx(me,{as:"span",...Se,children:o}),n[69]=Se,n[70]=o,n[71]=Ye):Ye=n[71];let qe;return n[72]!==$||n[73]!==Ie||n[74]!==e||n[75]!==m||n[76]!==Ee||n[77]!==je||n[78]!==Me||n[79]!==Fe||n[80]!==$e||n[81]!==Ye||n[82]!==W||n[83]!==N||n[84]!==D?(qe=d.jsxs(Ikt,{"data-ui":"Button",...m,$mode:$,$radius:Ie,$tone:W,"data-disabled":Ee,"data-selected":je,disabled:Me,ref:e,type:N,$width:D,children:[Fe,$e,Ye]}),n[72]=$,n[73]=Ie,n[74]=e,n[75]=m,n[76]=Ee,n[77]=je,n[78]=Me,n[79]=Fe,n[80]=$e,n[81]=Ye,n[82]=W,n[83]=N,n[84]=D,n[85]=qe):qe=n[85],qe});vn.displayName="ForwardRef(Button)";function Akt(t){return[Rkt(t),Dkt(t)]}function Rkt(t){const{$checkered:e}=t,{space:n}=Jt(t.theme);return st` + ${e&&st` + background-size: ${n[3]}px ${n[3]}px; + background-position: 50% 50%; + background-image: var(--card-bg-image); + `} + + &[data-as='button'] { + -webkit-font-smoothing: inherit; + appearance: none; + outline: none; + font: inherit; + text-align: inherit; + border: 0; + width: -moz-available; + width: -webkit-fill-available; + width: stretch; + } + + /* &:is(a) */ + &[data-as='a'] { + outline: none; + text-decoration: none; + } + + /* &:is(pre) */ + &[data-as='pre'] { + font: inherit; + } + `}function Dkt(t){const{$checkered:e,$focusRing:n,$muted:r}=t,{card:i,color:o,style:s}=Jt(t.theme),a={width:i.border.width,color:"var(--card-border-color)"};return st` + color-scheme: ${o._dark?"dark":"light"}; + + ${Ua(o,o,e)} + + background-color: ${r?"var(--card-muted-bg-color)":"var(--card-bg-color)"}; + color: var(--card-fg-color); + + /* &:is(button) */ + &[data-as='button'] { + --card-focus-ring-box-shadow: none; + + cursor: default; + box-shadow: var(--card-focus-ring-box-shadow); + + &:disabled { + ${Ua(o,o.selectable.default.disabled,e)} + } + + &:not(:disabled) { + &[data-pressed] { + ${Ua(o,o.selectable.default.pressed,e)} + } + + &[data-selected] { + ${Ua(o,o.selectable.default.selected,e)} + } + + @media (hover: hover) { + &:not([data-pressed]):not([data-selected]) { + &[data-hovered], + &:hover { + ${Ua(o,o.selectable.default.hovered,e)} + } + + &:active { + ${Ua(o,o.selectable.default.pressed,e)} + } + } + } + + &:focus-visible { + --card-focus-ring-box-shadow: ${n?Up({base:o,border:a,focusRing:i.focusRing}):void 0}; + } + } + } + + /* &:is(a) */ + &[data-as='a'] { + cursor: pointer; + box-shadow: var(--card-focus-ring-box-shadow); + + &[data-disabled] { + ${Ua(o,o.selectable.default.disabled,e)} + } + + &:not([data-disabled]) { + &[data-pressed] { + ${Ua(o,o.selectable.default.pressed,e)} + } + + &[data-selected] { + ${Ua(o,o.selectable.default.selected,e)} + } + + @media (hover: hover) { + &:not([data-pressed]):not([data-selected]) { + &[data-hovered], + &:hover { + ${Ua(o,o.selectable.default.hovered,e)} + } + + &:active { + ${Ua(o,o.selectable.default.pressed,e)} + } + } + } + + &:focus-visible { + --card-focus-ring-box-shadow: ${n?Up({base:o,border:a,focusRing:i.focusRing}):void 0}; + } + } + } + + ${s?.card?.root} + `}const Okt=de(me).withConfig({displayName:"StyledCard",componentId:"sc-osnro2-0"})(Z_t,K7,qSt,Akt),Be=E.forwardRef(function(t,e){const n=Ut.c(56);let r,i,o,s,a,l,c,u,f,h,p,m,g,y,b,v;n[0]!==t?({__unstable_checkered:g,__unstable_focusRing:y,as:r,border:i,borderTop:l,borderRight:a,borderBottom:o,borderLeft:s,muted:c,pressed:u,radius:b,scheme:h,selected:p,shadow:m,tone:v,...f}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h,n[11]=p,n[12]=m,n[13]=g,n[14]=y,n[15]=b,n[16]=v):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10],p=n[11],m=n[12],g=n[13],y=n[14],b=n[15],v=n[16]);const x=g===void 0?!1:g,C=y===void 0?!1:y,w=b===void 0?0:b,_=v===void 0?"default":v,S=ma.isValidElementType(r)?r:"div",k=H8(),I=_==="inherit"?k.tone:_,j=typeof S=="string"?S:void 0,A=k.scheme;let D;n[17]!==i?(D=fn(i),n[17]=i,n[18]=D):D=n[18];let O;n[19]!==l?(O=fn(l),n[19]=l,n[20]=O):O=n[20];let P;n[21]!==a?(P=fn(a),n[21]=a,n[22]=P):P=n[22];let $;n[23]!==o?($=fn(o),n[23]=o,n[24]=$):$=n[24];let M;n[25]!==s?(M=fn(s),n[25]=s,n[26]=M):M=n[26];let L;n[27]!==w?(L=fn(w),n[27]=w,n[28]=L):L=n[28];let B;n[29]!==m?(B=fn(m),n[29]=m,n[30]=B):B=n[30];const W=x?"":void 0,N=u?"":void 0,V=p?"":void 0;let G;n[31]!==S||n[32]!==x||n[33]!==C||n[34]!==c||n[35]!==e||n[36]!==f||n[37]!==k.scheme||n[38]!==p||n[39]!==M||n[40]!==L||n[41]!==B||n[42]!==W||n[43]!==N||n[44]!==V||n[45]!==j||n[46]!==D||n[47]!==O||n[48]!==P||n[49]!==$||n[50]!==I?(G=d.jsx(Okt,{"data-as":j,"data-scheme":A,"data-ui":"Card","data-tone":I,...f,$border:D,$borderTop:O,$borderRight:P,$borderBottom:$,$borderLeft:M,$checkered:x,$focusRing:C,$muted:c,$radius:L,$shadow:B,$tone:I,"data-checkered":W,"data-pressed":N,"data-selected":V,forwardedAs:S,ref:e,selected:p}),n[31]=S,n[32]=x,n[33]=C,n[34]=c,n[35]=e,n[36]=f,n[37]=k.scheme,n[38]=p,n[39]=M,n[40]=L,n[41]=B,n[42]=W,n[43]=N,n[44]=V,n[45]=j,n[46]=D,n[47]=O,n[48]=P,n[49]=$,n[50]=I,n[51]=G):G=n[51];let z;return n[52]!==h||n[53]!==G||n[54]!==I?(z=d.jsx(ade,{scheme:h,tone:I,children:G}),n[52]=h,n[53]=G,n[54]=I,n[55]=z):z=n[55],z});Be.displayName="ForwardRef(Card)";function ho(t,e,n){const r=Ut.c(9),i=e===void 0?Pkt:e;let o;r[0]!==n||r[1]!==i||r[2]!==t?(o=u=>{if(!t)return;const f=u.target;if(!(f instanceof Node))return;const h=n?.();if(h&&!h.contains(f))return;const p=i().flat();for(const m of p)if(m&&(f===m||m.contains(f)))return;t(u)},r[0]=n,r[1]=i,r[2]=t,r[3]=o):o=r[3];const s=uv(o),a=!!t;let l;r[4]!==a||r[5]!==s?(l=()=>{if(!a)return;const u=f=>s(f);return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},r[4]=a,r[5]=s,r[6]=l):l=r[6];let c;r[7]!==a?(c=[a],r[7]=a,r[8]=c):c=r[8],E.useEffect(l,c),E.useDebugValue(t?"MouseDown On":"MouseDown Off")}function Pkt(){return uS}function lR(t,e){const n=Ut.c(4);let r,i;n[0]!==e||n[1]!==t?(r=()=>{t.current?.setCustomValidity(e||"")},i=[e,t],n[0]=e,n[1]=t,n[2]=r,n[3]=i):(r=n[2],i=n[3]),E.useEffect(r,i)}const tqe=typeof document<"u"&&typeof window<"u"&&window.ResizeObserver?window.ResizeObserver:az,$kt=Lkt();function Mkt(){return{subscribe(t,e){const n=new tqe(([r])=>{e({_contentRect:r.contentRect,border:{width:r.borderBoxSize[0].inlineSize,height:r.borderBoxSize[0].blockSize},content:{width:r.contentRect.width,height:r.contentRect.height}})});return n.observe(t),()=>{n.unobserve(t),n.disconnect()}}}}function Lkt(){const t=new WeakMap,e=new WeakMap;return{subscribe(n,r){const i=e.get(n)||[];let o=t.get(n);return e.has(n)||(e.set(n,i),o=Mkt().subscribe(n,s=>{for(const a of i)a(s)})),i.push(r),()=>{const s=i.indexOf(r);s>-1&&i.splice(s,1),i.length===0&&o&&o()}}}}function fS(t){const e=Ut.c(3),[n,r]=E.useState(null);let i,o;return e[0]!==t?(i=()=>{if(t)return $kt.subscribe(t,r)},o=[t],e[0]=t,e[1]=i,e[2]=o):(i=e[1],o=e[2]),E.useEffect(i,o),n}function Vc(t,e){const n=Ut.c(7);let r;n[0]!==t?(r=a=>t(a),n[0]=t,n[1]=r):r=n[1];const i=uv(r);let o;n[2]!==i||n[3]!==e?(o=()=>{const a=l=>i(l);return window.addEventListener("keydown",a,e),()=>window.removeEventListener("keydown",a,e)},n[2]=i,n[3]=e,n[4]=o):o=n[4];let s;n[5]!==e?(s=[e],n[5]=e,n[6]=s):s=n[6],E.useEffect(o,s)}function nqe(t,e){const n=Ut.c(4);E.useDebugValue(t);let r;n[0]!==t?(r=o=>{const s=window.matchMedia(t);return s.addEventListener("change",o),()=>s.removeEventListener("change",o)},n[0]=t,n[1]=r):r=n[1];let i;return n[2]!==t?(i=()=>window.matchMedia(t).matches,n[2]=t,n[3]=i):i=n[3],E.useSyncExternalStore(r,i,e)}function Fkt(t,e){return e===0?`screen and (max-width: ${t[e]-1}px)`:e===t.length?`screen and (min-width: ${t[e-1]}px)`:`screen and (min-width: ${t[e-1]}px) and (max-width: ${t[e]-1}px)`}function Nkt(t){const e=t.length;let n;const r=()=>{if(!n){n=[];for(let i=e;i>-1;i-=1){const o=Fkt(t,i);n.push({index:i,mq:window.matchMedia(o)})}}return n};return{getSnapshot:()=>{for(const{index:i,mq:o}of r())if(o.matches)return i;return 0},subscribe:i=>{const o=[];for(const{mq:s}of r()){const a=()=>{s.matches&&i()};s.addEventListener("change",a),o.push(()=>s.removeEventListener("change",a))}return()=>{for(const s of o)s()}}}}function Bkt(){return 0}function rm(){const t=Ut.c(2),{media:e}=Y7();let n;t[0]!==e?(n=Nkt(e),t[0]=e,t[1]=n):n=t[1];const r=n;return E.useSyncExternalStore(r.subscribe,r.getSnapshot,Bkt)}function rqe(t){return nqe("(prefers-color-scheme: dark)",Vkt)}function Vkt(){return!1}function lz(t){return nqe("(prefers-reduced-motion: reduce)",zkt)}function zkt(){return!1}function Hkt(){return st` + position: relative; + display: inline-block; + `}function Ukt(t){const{color:e,input:n,radius:r}=Jt(t.theme),{focusRing:i}=n.checkbox;return st` + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + outline: none; + opacity: 0; + z-index: 1; + padding: 0; + margin: 0; + + & + span { + position: relative; + display: block; + height: ${qt(n.checkbox.size)}; + width: ${qt(n.checkbox.size)}; + box-sizing: border-box; + box-shadow: ${Dc({color:e.input.default.enabled.border,width:n.border.width})}; + border-radius: ${qt(r[2])}; + line-height: 1; + background-color: ${e.input.default.enabled.bg}; + + & > svg { + display: block; + position: absolute; + opacity: 0; + height: 100%; + width: 100%; + + & > path { + vector-effect: non-scaling-stroke; + stroke-width: 1.5px !important; + } + } + } + + &:checked + span { + background: ${e.input.default.enabled.fg}; + box-shadow: ${Dc({color:e.input.default.enabled.fg,width:n.border.width})}; + color: ${e.input.default.enabled.bg}; + } + + /* focus */ + &:not(:disabled):focus:focus-visible + span { + box-shadow: ${Up({focusRing:i})}; + } + + /* focus when checked - uses a different offset */ + &:not(:disabled):focus:focus-visible&:checked + span { + box-shadow: ${Up({focusRing:{width:1,offset:1}})}; + } + + &[data-error] + span { + background-color: ${e.input.invalid.enabled.border}; + box-shadow: ${Dc({width:n.border.width,color:e.input.invalid.enabled.muted.bg})}; + color: ${e.input.default.disabled.fg}; + } + &[data-error]&:checked + span { + background-color: ${e.input.invalid.enabled.muted.bg}; + color: ${e.input.default.enabled.bg}; + } + &[data-error]&:checked&:not(:disabled):focus:focus-visible + span { + box-shadow: ${Up({border:{width:n.border.width,color:e.input.invalid.readOnly.muted.bg},focusRing:{width:1,offset:1}})}; + } + + &:disabled + span { + background-color: ${e.input.default.disabled.bg}; + box-shadow: ${Dc({width:n.border.width,color:e.input.default.disabled.border})}; + color: ${e.input.default.disabled.fg}; + } + &:disabled&:checked + span { + background-color: ${e.input.default.disabled.muted.bg}; + } + + &[data-read-only] + span { + background-color: ${e.input.default.readOnly.bg}; + box-shadow: ${Dc({width:n.border.width,color:e.input.default.readOnly.border})}; + color: ${e.input.default.readOnly.fg}; + } + + &[data-read-only]&:checked + span { + background-color: ${e.input.default.readOnly.muted.bg}; + } + + &:checked + span > svg:first-child { + opacity: 1; + } + &:indeterminate + span > svg:last-child { + opacity: 1; + } + `}const Wkt=de.div.withConfig({displayName:"StyledCheckbox",componentId:"sc-1l5mt2l-0"})(Hkt),qkt=de.input.withConfig({displayName:"Input",componentId:"sc-1l5mt2l-1"})(Ukt),zf=E.forwardRef(function(t,e){const n=Ut.c(25);let r,i,o,s,a,l,c,u;n[0]!==t?({checked:r,className:i,disabled:s,indeterminate:a,customValidity:o,readOnly:l,style:u,...c}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8]);const f=E.useRef(null);let h;n[9]===Symbol.for("react.memo_cache_sentinel")?(h=()=>f.current,n[9]=h):h=n[9],E.useImperativeHandle(e,h);let p,m;n[10]!==a?(p=()=>{f.current&&(f.current.indeterminate=a||!1)},m=[a],n[10]=a,n[11]=p,n[12]=m):(p=n[11],m=n[12]),E.useEffect(p,m),lR(f,o);const g=!s&&l?"":void 0,y=o?"":void 0,b=s||l;let v;n[13]!==r||n[14]!==l||n[15]!==c||n[16]!==g||n[17]!==y||n[18]!==b?(v=d.jsx(qkt,{"data-read-only":g,"data-error":y,...c,checked:r,disabled:b,type:"checkbox",readOnly:l,ref:f}),n[13]=r,n[14]=l,n[15]=c,n[16]=g,n[17]=y,n[18]=b,n[19]=v):v=n[19];let x;n[20]===Symbol.for("react.memo_cache_sentinel")?(x=d.jsxs("span",{children:[d.jsx(qu,{}),d.jsx(Dce,{})]}),n[20]=x):x=n[20];let C;return n[21]!==i||n[22]!==u||n[23]!==v?(C=d.jsxs(Wkt,{className:i,"data-ui":"Checkbox",style:u,children:[v,x]}),n[21]=i,n[22]=u,n[23]=v,n[24]=C):C=n[24],C});zf.displayName="ForwardRef(Checkbox)";function Gkt({theme:t}){const{color:{syntax:e}}=Jt(t);return{"&.atrule":{color:e.atrule},"&.attr-name":{color:e.attrName},"&.attr-value":{color:e.attrValue},"&.attribute":{color:e.attribute},"&.boolean":{color:e.boolean},"&.builtin":{color:e.builtin},"&.cdata":{color:e.cdata},"&.char":{color:e.char},"&.class":{color:e.class},"&.class-name":{color:e.className},"&.comment":{color:e.comment},"&.constant":{color:e.constant},"&.deleted":{color:e.deleted},"&.doctype":{color:e.doctype},"&.entity":{color:e.entity},"&.function":{color:e.function},"&.hexcode":{color:e.hexcode},"&.id":{color:e.id},"&.important":{color:e.important},"&.inserted":{color:e.inserted},"&.keyword":{color:e.keyword},"&.number":{color:e.number},"&.operator":{color:e.operator},"&.prolog":{color:e.prolog},"&.property":{color:e.property},"&.pseudo-class":{color:e.pseudoClass},"&.pseudo-element":{color:e.pseudoElement},"&.punctuation":{color:e.punctuation},"&.regex":{color:e.regex},"&.selector":{color:e.selector},"&.string":{color:e.string},"&.symbol":{color:e.symbol},"&.tag":{color:e.tag},"&.unit":{color:e.unit},"&.url":{color:e.url},"&.variable":{color:e.variable}}}function Ykt(){return st` + color: var(--card-code-fg-color); + + & code { + font-family: inherit; + + &.refractor .token { + ${Gkt} + } + } + + & a { + color: inherit; + text-decoration: underline; + border-radius: 1px; + } + + & svg { + /* Certain popular CSS libraries changes the defaults for SVG display */ + /* Make sure SVGs are rendered as inline elements */ + display: inline; + } + + & [data-sanity-icon] { + vertical-align: baseline; + } + `}const Kkt=E.lazy(()=>wc(()=>import("./refractor-LmlFOfGa.js"),[])),Xkt=de.pre.withConfig({displayName:"StyledCode",componentId:"sc-4dymyn-0"})(Ykt,q_t),zu=E.forwardRef(function(t,e){const n=Ut.c(22);let r,i,o,s,a;n[0]!==t?({children:r,language:i,size:s,weight:a,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5]);const l=s===void 0?2:s;let c;n[6]!==l?(c=fn(l),n[6]=l,n[7]=c):c=n[7];let u;n[8]!==r?(u=d.jsx("code",{children:r}),n[8]=r,n[9]=u):u=n[9];let f;n[10]!==r||n[11]!==i?(f=d.jsx(Kkt,{language:i,value:r}),n[10]=r,n[11]=i,n[12]=f):f=n[12];let h;n[13]!==u||n[14]!==f?(h=d.jsx(E.Suspense,{fallback:u,children:f}),n[13]=u,n[14]=f,n[15]=h):h=n[15];let p;return n[16]!==e||n[17]!==o||n[18]!==c||n[19]!==h||n[20]!==a?(p=d.jsx(Xkt,{"data-ui":"Code",...o,$size:c,$weight:a,ref:e,children:h}),n[16]=e,n[17]=o,n[18]=c,n[19]=h,n[20]=a,n[21]=p):p=n[21],p});zu.displayName="ForwardRef(Code)";const Zkt={width:"100%",margin:"0 auto"};function Qkt(){return Zkt}function Jkt(t){const{container:e,media:n}=Jt(t.theme);return $i(n,t.$width,r=>({maxWidth:r==="auto"?"none":qt(e[r])}))}const eEt=de(me).withConfig({displayName:"StyledContainer",componentId:"sc-wyroop-0"})(Qkt,Jkt),_o=E.forwardRef(function(t,e){const n=Ut.c(11);let r,i,o;n[0]!==t?({as:r,width:o,...i}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o):(r=n[1],i=n[2],o=n[3]);const s=o===void 0?2:o;let a;n[4]!==s?(a=fn(s),n[4]=s,n[5]=a):a=n[5];let l;return n[6]!==r||n[7]!==e||n[8]!==i||n[9]!==a?(l=d.jsx(eEt,{"data-ui":"Container",...i,$width:a,forwardedAs:r,ref:e}),n[6]=r,n[7]=e,n[8]=i,n[9]=a,n[10]=l):l=n[10],l});_o.displayName="ForwardRef(Container)";const tEt=de(me).withConfig({displayName:"StyledGrid",componentId:"sc-v8t8oz-0"})(OSt),zo=E.forwardRef(function(t,e){const n=Ut.c(42);let r,i,o,s,a,l,c,u,f,h,p;n[0]!==t?({as:r,autoRows:s,autoCols:i,autoFlow:o,columns:l,gap:c,gapX:u,gapY:f,rows:p,children:a,...h}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h,n[11]=p):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10],p=n[11]);const m=typeof r=="string"?r:void 0;let g;n[12]!==s?(g=fn(s),n[12]=s,n[13]=g):g=n[13];let y;n[14]!==i?(y=fn(i),n[14]=i,n[15]=y):y=n[15];let b;n[16]!==o?(b=fn(o),n[16]=o,n[17]=b):b=n[17];let v;n[18]!==l?(v=fn(l),n[18]=l,n[19]=v):v=n[19];let x;n[20]!==c?(x=fn(c),n[20]=c,n[21]=x):x=n[21];let C;n[22]!==u?(C=fn(u),n[22]=u,n[23]=C):C=n[23];let w;n[24]!==f?(w=fn(f),n[24]=f,n[25]=w):w=n[25];let _;n[26]!==p?(_=fn(p),n[26]=p,n[27]=_):_=n[27];let S;return n[28]!==r||n[29]!==a||n[30]!==e||n[31]!==h||n[32]!==m||n[33]!==g||n[34]!==y||n[35]!==b||n[36]!==v||n[37]!==x||n[38]!==C||n[39]!==w||n[40]!==_?(S=d.jsx(tEt,{"data-as":m,"data-ui":"Grid",...h,$autoRows:g,$autoCols:y,$autoFlow:b,$columns:v,$gap:x,$gapX:C,$gapY:w,$rows:_,forwardedAs:r,ref:e,children:a}),n[28]=r,n[29]=a,n[30]=e,n[31]=h,n[32]=m,n[33]=g,n[34]=y,n[35]=b,n[36]=v,n[37]=x,n[38]=C,n[39]=w,n[40]=_,n[41]=S):S=n[41],S});zo.displayName="ForwardRef(Grid)";function nEt(t){const{$accent:e,$muted:n}=t,{font:r}=Jt(t.theme);return st` + ${e&&st` + color: var(--card-accent-fg-color); + `} + + ${n&&st` + color: var(--card-muted-fg-color); + `} + + & code { + font-family: ${r.code.family}; + border-radius: 1px; + } + + & a { + text-decoration: none; + border-radius: 1px; + color: var(--card-link-color); + outline: none; + + @media (hover: hover) { + &:hover { + text-decoration: underline; + } + } + + &:focus { + box-shadow: + 0 0 0 1px var(--card-bg-color), + 0 0 0 3px var(--card-focus-ring-color); + } + + &:focus:not(:focus-visible) { + box-shadow: none; + } + } + + & strong { + font-weight: ${r.heading.weights.bold}; + } + + & svg { + /* Certain popular CSS libraries changes the defaults for SVG display */ + /* Make sure SVGs are rendered as inline elements */ + display: inline; + } + + & [data-sanity-icon] { + vertical-align: baseline; + } + `}const rEt=de.div.withConfig({displayName:"StyledHeading",componentId:"sc-137lwim-0"})(nEt,sde,G_t),Al=E.forwardRef(function(t,e){const n=Ut.c(26);let r,i,o,s,a,l,c,u;n[0]!==t?({accent:s,align:r,children:i,muted:a,size:l,textOverflow:c,weight:u,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8]);const f=s===void 0?!1:s,h=a===void 0?!1:a,p=l===void 0?2:l;let m=i;if(c==="ellipsis"){let x;n[9]!==m?(x=d.jsx(cde,{children:m}),n[9]=m,n[10]=x):x=n[10],m=x}let g;n[11]!==r?(g=fn(r),n[11]=r,n[12]=g):g=n[12];let y;n[13]!==p?(y=fn(p),n[13]=p,n[14]=y):y=n[14];let b;n[15]!==m?(b=d.jsx("span",{children:m}),n[15]=m,n[16]=b):b=n[16];let v;return n[17]!==f||n[18]!==h||n[19]!==e||n[20]!==o||n[21]!==g||n[22]!==y||n[23]!==b||n[24]!==u?(v=d.jsx(rEt,{"data-ui":"Heading",...o,$accent:f,$align:g,$muted:h,$size:y,$weight:u,ref:e,children:b}),n[17]=f,n[18]=h,n[19]=e,n[20]=o,n[21]=g,n[22]=y,n[23]=b,n[24]=u,n[25]=v):v=n[25],v});Al.displayName="ForwardRef(Heading)";function iEt(){return{lineHeight:"0","&&:not([hidden])":{display:"block"},"& > div":{display:"inline-block",verticalAlign:"middle"}}}function oEt(t){const{media:e,space:n}=Jt(t.theme);return $i(e,t.$space,r=>{const i=qt(r===.5?n[1]/2:n[r]);return{margin:`-${i} 0 0 -${i}`,"& > div":{padding:`${i} 0 0 ${i}`}}})}const sEt=de(me).withConfig({displayName:"StyledInline",componentId:"sc-1pkiy6j-0"})(iEt,oEt),Pr=E.forwardRef(function(t,e){const n=Ut.c(15);let r,i,o,s;n[0]!==t?({as:r,children:i,space:s,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s):(r=n[1],i=n[2],o=n[3],s=n[4]);let a;n[5]!==i?(a=E.Children.map(i,aEt),n[5]=i,n[6]=a):a=n[6];const l=a;let c;n[7]!==s?(c=fn(s),n[7]=s,n[8]=c):c=n[8];const u=e;let f;return n[9]!==r||n[10]!==l||n[11]!==o||n[12]!==c||n[13]!==u?(f=d.jsx(sEt,{"data-ui":"Inline",...o,$space:c,forwardedAs:r,ref:u,children:l}),n[9]=r,n[10]=l,n[11]=o,n[12]=c,n[13]=u,n[14]=f):f=n[14],f});Pr.displayName="ForwardRef(Inline)";function aEt(t){return t&&d.jsx("div",{children:t})}function lEt(){return st` + --card-bg-color: var(--card-kbd-bg-color); + --card-border-color: var(--card-kbd-border-color); + --card-fg-color: var(--card-kbd-fg-color); + + box-shadow: inset 0 0 0 1px var(--card-border-color); + background: var(--card-bg-color); + font: inherit; + + vertical-align: top; + + &:not([hidden]) { + display: inline-block; + } + `}const cEt=de.kbd.withConfig({displayName:"StyledKBD",componentId:"sc-1w7yd8w-0"})(K7,lEt),iqe=E.forwardRef(function(t,e){const n=Ut.c(19);let r,i,o,s,a;n[0]!==t?({children:r,fontSize:o,padding:s,radius:a,...i}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5]);const l=o===void 0?0:o,c=s===void 0?1:s,u=a===void 0?2:a;let f;n[6]!==u?(f=fn(u),n[6]=u,n[7]=f):f=n[7];let h;n[8]!==r||n[9]!==l?(h=d.jsx(oe,{as:"span",size:l,weight:"semibold",children:r}),n[8]=r,n[9]=l,n[10]=h):h=n[10];let p;n[11]!==c||n[12]!==h?(p=d.jsx(me,{as:"span",padding:c,children:h}),n[11]=c,n[12]=h,n[13]=p):p=n[13];let m;return n[14]!==e||n[15]!==i||n[16]!==f||n[17]!==p?(m=d.jsx(cEt,{"data-ui":"KBD",...i,$radius:f,ref:e,children:p}),n[14]=e,n[15]=i,n[16]=f,n[17]=p,n[18]=m):m=n[18],m});iqe.displayName="ForwardRef(KBD)";const oqe={name:"@sanity/ui/origin",fn({middlewareData:t,placement:e,rects:n}){const[r]=e.split("-"),i=n.floating.width,o=n.floating.height,s=t.shift?.x||0,a=t.shift?.y||0;if(i<=0||o<=0)return{};const l=["bottom","top"].includes(r),{originX:c,originY:u}=l?{originX:r8e(.5-s/i,0,1),originY:r==="bottom"?0:1}:{originX:r==="left"?1:0,originY:r8e(.5-a/o,0,1)};return{data:{originX:c,originY:u}}}};function r8e(t,e,n){return Math.min(Math.max(t,e),n)}function i8e(t,e,n){const r=e.x-t.x,i=e.y-t.y,o=Math.sqrt(r*r+i*i);return Nie(t,e,Math.min(1,n/o))}function Nie(t,e,n){return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}}function uEt(t){const e=t.length,n=[];for(let r=0;re.type==="point"?`${n===0?"M":"L"} ${e.x} ${e.y}`:e.type==="curve"?`C ${e.startControl.x} ${e.startControl.y} ${e.endControl.x} ${e.endControl.y} ${e.curveEnd.x} ${e.curveEnd.y}`:"").join(" ")}const fEt=de.div.withConfig({displayName:"StyledArrow",componentId:"sc-12vzy6c-0"})(({$w:t})=>st` + position: absolute; + width: ${t}px; + height: ${t}px; + + :empty + & { + display: none; + } + + & > svg { + display: block; + line-height: 0; + transform-origin: ${t/2}px ${t/2}px; + } + + [data-placement^='top'] > & { + bottom: -${t}px; + + & > svg { + transform: rotate(0); + } + } + + [data-placement^='right'] > & { + left: -${t}px; + + & > svg { + transform: rotate(90deg); + } + } + + [data-placement^='left'] > & { + right: -${t}px; + + & > svg { + transform: rotate(-90deg); + } + } + + [data-placement^='bottom'] > & { + top: -${t}px; + + & > svg { + transform: rotate(180deg); + } + } + `),hEt=de.path.withConfig({displayName:"StrokePath",componentId:"sc-12vzy6c-1"})`stroke:var(--card-shadow-outline-color);`,pEt=de.path.withConfig({displayName:"ShapePath",componentId:"sc-12vzy6c-2"})`fill:var(--card-bg-color);`,dde=E.forwardRef(function(t,e){const n=Ut.c(29);let r,i,o,s;n[0]!==t?({width:s,height:r,radius:o,...i}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s):(r=n[1],i=n[2],o=n[3],s=n[4]);const a=o===void 0?0:o,{card:l}=Y7(),c=l.shadow.outline,u=s/2;let f;if(n[5]!==u||n[6]!==r||n[7]!==a||n[8]!==s){const _=[{x:0,y:0},{x:a,y:0,radius:a},{x:u,y:r-1,radius:a},{x:s-a,y:0,radius:a},{x:s,y:0}],S=uEt(_);f=dEt(S),n[5]=u,n[6]=r,n[7]=a,n[8]=s,n[9]=f}else f=n[9];const h=f,p=`${h}`,m=`${h} M ${s} -1 M 0 -1 Z`,g=`0 0 ${s} ${s}`;let y;n[10]!==c||n[11]!==s?(y=d.jsx("mask",{id:"stroke-mask",children:d.jsx("rect",{x:0,y:c,width:s,height:s,fill:"white"})}),n[10]=c,n[11]=s,n[12]=y):y=n[12];const b=c*2;let v;n[13]!==p||n[14]!==b?(v=d.jsx(hEt,{d:p,mask:"url(#stroke-mask)",strokeWidth:b}),n[13]=p,n[14]=b,n[15]=v):v=n[15];let x;n[16]!==m?(x=d.jsx(pEt,{d:m}),n[16]=m,n[17]=x):x=n[17];let C;n[18]!==g||n[19]!==y||n[20]!==v||n[21]!==x||n[22]!==s?(C=d.jsxs("svg",{width:s,height:s,viewBox:g,children:[y,v,x]}),n[18]=g,n[19]=y,n[20]=v,n[21]=x,n[22]=s,n[23]=C):C=n[23];let w;return n[24]!==e||n[25]!==i||n[26]!==C||n[27]!==s?(w=d.jsx(fEt,{...i,$w:s,ref:e,children:C}),n[24]=e,n[25]=i,n[26]=C,n[27]=s,n[28]=w):w=n[28],w});dde.displayName="ForwardRef(Arrow)";const sqe=q7("@sanity/ui/context/boundaryElement",null);function Fh(t){const e=Ut.c(5),{children:n,element:r}=t;let i;e[0]!==r?(i={version:0,element:r},e[0]=r,e[1]=i):i=e[1];const o=i;let s;return e[2]!==n||e[3]!==o?(s=d.jsx(sqe.Provider,{value:o,children:n}),e[2]=n,e[3]=o,e[4]=s):s=e[4],s}Fh.displayName="BoundaryElementProvider";function cR(t){return!!(t&&typeof t=="object"&&!Array.isArray(t))}const mEt={version:0,element:null};function U8(){const t=E.useContext(sqe);if(t&&(!cR(t)||t.version!==0))throw new Error("useBoundaryElement(): the context value is not compatible");return t||mEt}function gEt(t,e){const n=[];for(let r=0;re&&n.push(r);return n}function yEt(t,e){const n=[];for(let r=0;rl,y=[l],n[10]=l,n[11]=g,n[12]=y):(g=n[11],y=n[12]),E.useImperativeHandle(e,g,y);let b;return n[13]!==o||n[14]!==h||n[15]!==m||n[16]!==s?(b=d.jsx("div",{"data-ui":"ElementQuery",...s,"data-eq-max":h,"data-eq-min":m,ref:c,children:o}),n[13]=o,n[14]=h,n[15]=m,n[16]=s,n[17]=b):b=n[17],b});uR.displayName="ForwardRef(ElementQuery)";function aqe(t){if(!cR(t)||t.version!==0)throw new Error("the context value is not compatible");if(!t)throw new Error("components using `useLayer()` should be wrapped in a .");if(t.version===0)return t;throw new Error("could not get layer context")}const Bie=q7("@sanity/ui/context/layer",null);function O2(t){const e=Ut.c(21),{children:n,zOffset:r}=t,i=r===void 0?0:r,o=E.useContext(Bie);let s;e[0]!==o?(s=o&&aqe(o),e[0]=o,e[1]=s):s=e[1];const a=s,l=a?.registerChild,c=(a?.level??0)+1;let u;e[2]!==i?(u=fn(i),e[2]=i,e[3]=u):u=e[3];const f=u,h=f.length-1,p=Math.min(rm(),h),m=a?a.zIndex+f[p]:f[p];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g={},e[4]=g):g=e[4];const[,y]=E.useState(g),[b,v]=E.useState(0),x=b===0;let C;e[5]!==l||e[6]!==y?(C=A=>{const D=l?.(A);return A!==void 0?y(O=>{const P=O[A]??0,$={...O,[A]:P+1};return v(Object.keys($).length),$}):v(vEt),()=>{A!==void 0?y(O=>{const P={...O};return P[A]===1?(delete P[A],v(Object.keys(P).length)):P[A]=P[A]-1,P}):v(bEt),D?.()}},e[5]=l,e[6]=y,e[7]=C):C=e[7];const w=C;let _,S;e[8]!==c||e[9]!==l?(_=()=>l?.(c),S=[c,l],e[8]=c,e[9]=l,e[10]=_,e[11]=S):(_=e[10],S=e[11]),E.useEffect(_,S);let k;e[12]!==x||e[13]!==c||e[14]!==w||e[15]!==b||e[16]!==m?(k={version:0,isTopLayer:x,level:c,registerChild:w,size:b,zIndex:m},e[12]=x,e[13]=c,e[14]=w,e[15]=b,e[16]=m,e[17]=k):k=e[17];const I=k;let j;return e[18]!==n||e[19]!==I?(j=d.jsx(Bie.Provider,{value:I,children:n}),e[18]=n,e[19]=I,e[20]=j):j=e[20],j}function bEt(t){return t-1}function vEt(t){return t+1}O2.displayName="LayerProvider";function Qu(){const t=Ut.c(2),e=E.useContext(Bie);if(!e)throw new Error("useLayer(): missing context value");try{let n;return t[0]!==e?(n=aqe(e),t[0]=e,t[1]=n):n=t[1],n}catch(n){const r=n;throw r instanceof Error?new Error(`useLayer(): ${r.message}`):new Error(`useLayer(): ${r}`)}}const xEt=de.div.withConfig({displayName:"StyledLayer",componentId:"sc-16kojrv-0"})({position:"relative"}),CEt=E.forwardRef(function(t,e){const n=Ut.c(22);let r,i,o,s,a;n[0]!==t?({children:r,onActivate:i,onFocus:o,style:a,...s}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5]);const l=a===void 0?r8:a,{zIndex:c,isTopLayer:u}=Qu(),f=E.useRef(null),h=E.useRef(null),p=E.useRef(u);let m;n[6]===Symbol.for("react.memo_cache_sentinel")?(m=()=>h.current,n[6]=m):m=n[6],E.useImperativeHandle(e,m);let g,y;n[7]!==u||n[8]!==i?(g=()=>{p.current!==u&&u&&i?.({activeElement:f.current}),p.current=u},y=[u,i],n[7]=u,n[8]=i,n[9]=g,n[10]=y):(g=n[9],y=n[10]),E.useEffect(g,y);let b;n[11]!==u||n[12]!==o?(b=w=>{o?.(w);const _=h.current,S=document.activeElement;!u||!_||!S||Fg(S)&&Lie(_,S)&&(f.current=S)},n[11]=u,n[12]=o,n[13]=b):b=n[13];const v=b;let x;n[14]!==l||n[15]!==c?(x={...l,zIndex:c},n[14]=l,n[15]=c,n[16]=x):x=n[16];let C;return n[17]!==r||n[18]!==v||n[19]!==s||n[20]!==x?(C=d.jsx(xEt,{...s,"data-ui":"Layer",onFocus:v,ref:h,style:x,children:r}),n[17]=r,n[18]=v,n[19]=s,n[20]=x,n[21]=C):C=n[21],C}),Hf=E.forwardRef(function(t,e){const n=Ut.c(11);let r,i,o;n[0]!==t?({children:r,zOffset:o,...i}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o):(r=n[1],i=n[2],o=n[3]);const s=o===void 0?1:o;let a;n[4]!==r||n[5]!==e||n[6]!==i?(a=d.jsx(CEt,{...i,ref:e,children:r}),n[4]=r,n[5]=e,n[6]=i,n[7]=a):a=n[7];let l;return n[8]!==a||n[9]!==s?(l=d.jsx(O2,{zOffset:s,children:a}),n[8]=a,n[9]=s,n[10]=l):l=n[10],l});Hf.displayName="ForwardRef(Layer)";const lqe="@sanity/ui/context/portal",cC=Symbol.for(`${lqe}/element`);Q3[cC]=null;const wEt={version:0,boundaryElement:null,get element(){return typeof document>"u"?null:(Q3[cC]||(Q3[cC]=document.createElement("div"),Q3[cC].setAttribute("data-portal",""),document.body.appendChild(Q3[cC])),Q3[cC])}},cqe=q7(lqe,wEt);function im(){const t=E.useContext(cqe);if(!t)throw new Error("usePortal(): missing context value");if(!cR(t)||t.version!==0)throw new Error("usePortal(): the context value is not compatible");return t}function X7(t){const e=Ut.c(3),{children:n,__unstable_name:r}=t,i=im(),o=(r?i.elements&&i.elements[r]:i.element)||i.elements?.default;if(!o)return null;let s;return e[0]!==n||e[1]!==o?(s=r0.createPortal(n,o),e[0]=n,e[1]=o,e[2]=s):s=e[2],s}X7.displayName="Portal";function N2(t){const e=Ut.c(7),{boundaryElement:n,children:r,element:i,__unstable_elements:o}=t,s=E.useSyncExternalStore(kEt,SEt,_Et),a=n||null,l=i||s;let c;e[0]!==o||e[1]!==a||e[2]!==l?(c={version:0,boundaryElement:a,element:l,elements:o},e[0]=o,e[1]=a,e[2]=l,e[3]=c):c=e[3];const u=c;let f;return e[4]!==r||e[5]!==u?(f=d.jsx(cqe.Provider,{value:u,children:r}),e[4]=r,e[5]=u,e[6]=f):f=e[6],f}function _Et(){return null}function SEt(){return document.body}N2.displayName="PortalProvider";const kEt=()=>()=>{},EEt=de.div.withConfig({displayName:"StyledSrOnly",componentId:"sc-mubr0c-0"})`display:block;width:0;height:0;position:absolute;overflow:hidden;overflow:clip;`,TEt=E.forwardRef(function(t,e){const n=Ut.c(4),{as:r,children:i}=t;let o;return n[0]!==r||n[1]!==i||n[2]!==e?(o=d.jsx(EEt,{"aria-hidden":!0,as:r,"data-ui":"SrOnly",ref:e,children:i}),n[0]=r,n[1]=i,n[2]=e,n[3]=o):o=n[3],o});TEt.displayName="ForwardRef(SrOnly)";const IEt=de.div.withConfig({displayName:"StyledVirtualList",componentId:"sc-dlqsj4-0"})`position:relative;`,o8e=de.div.withConfig({displayName:"ItemWrapper",componentId:"sc-dlqsj4-1"})`position:absolute;left:0;right:0;`,uqe=E.forwardRef(function(t,e){const n=Ut.c(44);let r,i,o,s,a,l,c;n[0]!==t?({as:a,gap:l,getItemKey:r,items:c,onChange:i,renderItem:o,...s}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7]);const u=a===void 0?"div":a,f=l===void 0?0:l;let h;n[8]!==c?(h=c===void 0?[]:c,n[8]=c,n[9]=h):h=n[9];const p=h,{space:m}=Y7(),g=E.useRef(null),y=E.useRef(null),[b,v]=E.useState(0),[x,C]=E.useState(0),[w,_]=E.useState(-1);let S;n[10]===Symbol.for("react.memo_cache_sentinel")?(S=()=>g.current,n[10]=S):S=n[10],E.useImperativeHandle(e,S);let k;n[11]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{if(!y.current)return;const z=y.current.firstChild;z instanceof HTMLElement&&_(z.offsetHeight)},n[11]=k):k=n[11];let I;n[12]!==o?(I=[o],n[12]=o,n[13]=I):I=n[13],E.useEffect(k,I);let j,A;n[14]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{if(!g.current)return;const z=AEt(g.current.parentNode);if(z){if(!(z instanceof HTMLElement))return;const ee=()=>{v(z.scrollTop)};z.addEventListener("scroll",ee,{passive:!0});const K=new tqe(q=>{C(q[0].contentRect.height)});return K.observe(z),ee(),()=>{z.removeEventListener("scroll",ee),K.unobserve(z),K.disconnect()}}const Y=()=>{v(window.scrollY)},Z=()=>{C(window.innerHeight)};return window.addEventListener("scroll",Y,{passive:!0}),window.addEventListener("resize",Z),C(window.innerHeight),Y(),()=>{window.removeEventListener("scroll",Y),window.removeEventListener("resize",Z)}},A=[],n[14]=j,n[15]=A):(j=n[14],A=n[15]),E.useEffect(j,A);const D=p.length,O=w?D*(w+m[f])-m[f]:0,P=O?Math.max(Math.floor(b/O*D)-2,0):0,$=O?Math.ceil((b+x)/O*D)+1:0;let M,L;n[16]!==P||n[17]!==f||n[18]!==w||n[19]!==i||n[20]!==x||n[21]!==b||n[22]!==m||n[23]!==$?(L=()=>{i&&i({fromIndex:P,gap:m[f],itemHeight:w,scrollHeight:x,scrollTop:b,toIndex:$})},M=[P,f,w,i,x,b,m,$],n[16]=P,n[17]=f,n[18]=w,n[19]=i,n[20]=x,n[21]=b,n[22]=m,n[23]=$,n[24]=M,n[25]=L):(M=n[24],L=n[25]),E.useEffect(L,M);let B;n[26]!==P||n[27]!==f||n[28]!==r||n[29]!==w||n[30]!==p||n[31]!==o||n[32]!==m||n[33]!==$?(B={fromIndex:P,gap:f,itemHeight:w,space:m,toIndex:$,getItemKey:r,items:p,renderItem:o},n[26]=P,n[27]=f,n[28]=r,n[29]=w,n[30]=p,n[31]=o,n[32]=m,n[33]=$,n[34]=B):B=n[34];const W=jEt(B);let N;n[35]!==O?(N={height:O},n[35]=O,n[36]=N):N=n[36];let V;n[37]!==W||n[38]!==N?(V=d.jsx("div",{ref:y,style:N,children:W}),n[37]=W,n[38]=N,n[39]=V):V=n[39];let G;return n[40]!==u||n[41]!==s||n[42]!==V?(G=d.jsx(IEt,{as:u,"data-ui":"VirtualList",...s,ref:g,children:V}),n[40]=u,n[41]=s,n[42]=V,n[43]=G):G=n[43],G});uqe.displayName="ForwardRef(VirtualList)";function jEt(t){const e=Ut.c(21),{fromIndex:n,gap:r,getItemKey:i,itemHeight:o,items:s,renderItem:a,space:l,toIndex:c}=t;if(!a||s.length===0)return null;if(o===-1){let f;e[0]!==s[0]||e[1]!==a?(f=a(s[0]),e[0]=s[0],e[1]=a,e[2]=f):f=e[2];let h;return e[3]!==f?(h=[d.jsx(o8e,{children:f},0)],e[3]=f,e[4]=h):h=e[4],h}let u;if(e[5]!==n||e[6]!==r||e[7]!==i||e[8]!==o||e[9]!==s||e[10]!==a||e[11]!==l||e[12]!==c){let f;e[14]!==n||e[15]!==r||e[16]!==i||e[17]!==o||e[18]!==a||e[19]!==l?(f=(h,p)=>{const m=n+p,g=a(h),y=i?i(h,m):m;return d.jsx(o8e,{style:{top:m*(o+l[r])},children:g},y)},e[14]=n,e[15]=r,e[16]=i,e[17]=o,e[18]=a,e[19]=l,e[20]=f):f=e[20],u=s.slice(n,c).map(f),e[5]=n,e[6]=r,e[7]=i,e[8]=o,e[9]=s,e[10]=a,e[11]=l,e[12]=c,e[13]=u}else u=e[13];return u}function AEt(t){let e=t;for(;e&&!H_t(e);)e=e.parentNode;return e}function dqe(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const REt=4,uC=4,DEt=19,OEt=8,PEt=2,fqe=[0,0,0,0],$Et={top:["bottom","left","right"],"top-start":["bottom-start","left-start","right-start"],"top-end":["bottom-end","left-end","right-end"],bottom:["top","left","right"],"bottom-start":["top-start","left-start","right-start"],"bottom-end":["top-end","left-end","right-end"],left:["right","top","bottom"],"left-start":["right-start","top-start","bottom-start"],"left-end":["right-end","top-end","bottom-end"],right:["left","top","bottom"],"right-start":["left-start","top-start","bottom-start"],"right-end":["left-end","top-end","bottom-end"]};function MEt(t){const{constrainSize:e,margins:n,matchReferenceWidth:r,maxWidthRef:i,padding:o=0,referenceWidthRef:s,setReferenceWidth:a,widthRef:l}=t;return{name:"@sanity/ui/size",async fn(c){const{elements:u,placement:f,platform:h,rects:p}=c,{floating:m,reference:g}=p,y=await QHe(c,{altBoundary:!0,boundary:t.boundaryElement||void 0,elementContext:"floating",padding:o,rootBoundary:"viewport"});let b=1/0,v=1/0;const x=m.width,C=m.height;f.includes("top")&&(b=x-(y.left+y.right),v=C-y.top),f.includes("right")&&(b=x-y.right,v=C-(y.top+y.bottom)),f.includes("bottom")&&(b=x-(y.left+y.right),v=C-y.bottom),f.includes("left")&&(b=x-y.left,v=C-(y.top+y.bottom));const w=b-n[1]-n[3],_=v-n[0]-n[2],S=g.width-n[1]-n[3];s.current=S,a(S),r?u.floating.style.width=`${S}px`:l.current!==void 0&&(u.floating.style.width=`${l.current}px`),e&&(u.floating.style.maxWidth=`${Math.min(w,i.current??1/0)}px`,u.floating.style.maxHeight=`${_}px`);const k=await h.getDimensions(u.floating),I=k.height,j=k.width;return x!==j||C!==I?{reset:{rects:!0}}:{}}}}function LEt(t){const{container:e,mediaIndex:n,width:r}=t,i=r[n],o=i===void 0?r[r.length-1]:i;return typeof o=="number"?e[o]:void 0}function FEt(t){const{boundaryWidth:e,currentWidth:n}=t;if(!(n===void 0&&e===void 0))return Math.min(n??1/0,(e||1/0)-uC*2)}const NEt=de(ei.create(Be)).withConfig({displayName:"MotionCard",componentId:"sc-ihg31s-0"})`&:not([hidden]){display:flex;}flex-direction:column;width:max-content;min-width:min-content;will-change:transform;`,BEt=de(ei.create(ge)).withConfig({displayName:"MotionFlex",componentId:"sc-ihg31s-1"})`will-change:opacity;`,hqe=E.forwardRef(function(t,e){const n=Ut.c(66);let r,i,o,s,a,l,c,u,f,h,p,m,g,y,b,v,x,C,w,_,S,k;n[0]!==t?({__unstable_margins:c,animate:r,arrow:i,arrowRef:o,arrowX:s,arrowY:a,children:l,padding:p,placement:m,originX:u,originY:f,overflow:h,radius:g,scheme:b,shadow:v,strategy:x,style:C,tone:w,width:_,x:S,y:k,...y}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h,n[11]=p,n[12]=m,n[13]=g,n[14]=y,n[15]=b,n[16]=v,n[17]=x,n[18]=C,n[19]=w,n[20]=_,n[21]=S,n[22]=k):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10],p=n[11],m=n[12],g=n[13],y=n[14],b=n[15],v=n[16],x=n[17],C=n[18],w=n[19],_=n[20],S=n[21],k=n[22]);const{zIndex:I}=Qu(),j=c||fqe,A=(S??0)+j[3],D=(k??0)+j[0],O=r?"transform":void 0;let P;n[23]!==u||n[24]!==f||n[25]!==x||n[26]!==C||n[27]!==O||n[28]!==_||n[29]!==A||n[30]!==D||n[31]!==I?(P={left:A,originX:u,originY:f,position:x,top:D,width:_,zIndex:I,willChange:O,...C},n[23]=u,n[24]=f,n[25]=x,n[26]=C,n[27]=O,n[28]=_,n[29]=A,n[30]=D,n[31]=I,n[32]=P):P=n[32];const $=P,M=s!==null?s:void 0,L=a!==null?a:void 0;let B;n[33]!==M||n[34]!==L?(B={left:M,top:L,right:void 0,bottom:void 0},n[33]=M,n[34]=L,n[35]=B):B=n[35];const W=B,N=y;let V;n[36]!==r?(V=r?["hidden","initial"]:void 0,n[36]=r,n[37]=V):V=n[37];let G;n[38]!==r?(G=r?["visible","scaleIn"]:void 0,n[38]=r,n[39]=G):G=n[39];let z;n[40]!==r?(z=r?["hidden","scaleOut"]:void 0,n[40]=r,n[41]=z):z=n[41];let Y;n[42]!==l||n[43]!==p?(Y=d.jsx(ge,{direction:"column",flex:1,padding:p,children:l}),n[42]=l,n[43]=p,n[44]=Y):Y=n[44];let Z;n[45]!==h||n[46]!==Y?(Z=d.jsx(BEt,{"data-ui":"Popover__wrapper",direction:"column",flex:1,overflow:h,variants:NC.children,transition:NC.transition,children:Y}),n[45]=h,n[46]=Y,n[47]=Z):Z=n[47];let ee;n[48]!==i||n[49]!==o||n[50]!==W?(ee=i&&d.jsx(dde,{ref:o,style:W,width:DEt,height:OEt,radius:PEt}),n[48]=i,n[49]=o,n[50]=W,n[51]=ee):ee=n[51];let K;return n[52]!==m||n[53]!==g||n[54]!==e||n[55]!==$||n[56]!==b||n[57]!==v||n[58]!==Z||n[59]!==ee||n[60]!==N||n[61]!==V||n[62]!==G||n[63]!==z||n[64]!==w?(K=d.jsxs(NEt,{"data-ui":"Popover",...N,"data-placement":m,radius:g,ref:e,scheme:b,shadow:v,sizing:"border",style:$,tone:w,variants:NC.card,transition:NC.transition,initial:V,animate:G,exit:z,children:[Z,ee]}),n[52]=m,n[53]=g,n[54]=e,n[55]=$,n[56]=b,n[57]=v,n[58]=Z,n[59]=ee,n[60]=N,n[61]=V,n[62]=G,n[63]=z,n[64]=w,n[65]=K):K=n[65],K});hqe.displayName="ForwardRef(PopoverCard)";const VEt=()=>{const t=Ut.c(2),{zIndex:e}=Qu();let n;return t[0]!==e?(n=d.jsx("div",{style:{height:"100vh",inset:0,position:"fixed",width:"100vw",zIndex:e}}),t[0]=e,t[1]=n):n=t[1],n},Ng=E.forwardRef(function(t,e){const n=Ut.c(126),{container:r,layer:i}=Y7(),o=U8();let s,a,l,c,u,f,h,p,m,g,y,b,v,x,C,w,_,S,k,I,j,A,D,O,P,$,M,L,B;if(n[0]!==t){const{__unstable_margins:En,animate:lr,arrow:ti,boundaryElement:Br,children:ni,constrainSize:Eo,content:is,disabled:Fo,fallbackPlacements:Cr,matchReferenceWidth:zi,floatingBoundary:ln,modal:wr,onActivate:sr,open:vr,overflow:kr,padding:ri,placement:bl,placementStrategy:ba,portal:ia,preventOverflow:Rl,radius:Dl,referenceBoundary:cc,referenceElement:fu,scheme:hi,shadow:To,tone:el,width:Ur,zOffset:ii,updateRef:Io,...oa}=t;_=En,S=lr,j=ti,s=Br,f=ni,A=Eo,h=is,p=Fo,a=Cr,m=zi,l=ln,g=wr,y=vr,D=kr,b=ri,O=bl,P=ba,v=ia,$=Rl,M=Dl,c=cc,x=fu,w=hi,L=To,k=el,I=Ur,u=ii,B=Io,C=oa,n[0]=t,n[1]=s,n[2]=a,n[3]=l,n[4]=c,n[5]=u,n[6]=f,n[7]=h,n[8]=p,n[9]=m,n[10]=g,n[11]=y,n[12]=b,n[13]=v,n[14]=x,n[15]=C,n[16]=w,n[17]=_,n[18]=S,n[19]=k,n[20]=I,n[21]=j,n[22]=A,n[23]=D,n[24]=O,n[25]=P,n[26]=$,n[27]=M,n[28]=L,n[29]=B}else s=n[1],a=n[2],l=n[3],c=n[4],u=n[5],f=n[6],h=n[7],p=n[8],m=n[9],g=n[10],y=n[11],b=n[12],v=n[13],x=n[14],C=n[15],w=n[16],_=n[17],S=n[18],k=n[19],I=n[20],j=n[21],A=n[22],D=n[23],O=n[24],P=n[25],$=n[26],M=n[27],L=n[28],B=n[29];const W=_===void 0?fqe:_,N=S===void 0?!1:S,V=j===void 0?!1:j,G=A===void 0?!1:A,z=D===void 0?"hidden":D,Y=O===void 0?"bottom":O,Z=P===void 0?"flip":P,ee=$===void 0?!0:$,K=M===void 0?3:M,q=L===void 0?3:L,re=k===void 0?"inherit":k,te=I===void 0?"auto":I,ae=s??o?.element,se=a??$Et[t.placement??"bottom"],le=l??t.boundaryElement??o.element,pe=c??t.boundaryElement??o.element,be=u??i.popover.zOffset,xe=lz()?!1:N,Ce=fS(ae)?.border;let Te;n[30]!==b?(Te=fn(b),n[30]=b,n[31]=Te):Te=n[31];const _e=Te;let Ie;n[32]!==K?(Ie=fn(K),n[32]=K,n[33]=Ie):Ie=n[33];const ye=Ie;let fe;n[34]!==q?(fe=fn(q),n[34]=q,n[35]=fe):fe=n[35];const ve=fe,Se=fn(te);let Ee;n[36]!==be?(Ee=fn(be),n[36]=be,n[37]=Ee):Ee=n[37];const je=Ee,Me=E.useRef(null),Fe=E.useRef(null);let $e;n[38]===Symbol.for("react.memo_cache_sentinel")?($e=()=>Me.current,n[38]=$e):$e=n[38],E.useImperativeHandle(e,$e);const Ye=rm(),qe=G||ee?Ce?.width:void 0,He=LEt({container:r,mediaIndex:Ye,width:Se}),Ge=E.useRef(He);let Ze,nt;n[39]!==He?(Ze=()=>{Ge.current=He},nt=[He],n[39]=He,n[40]=Ze,n[41]=nt):(Ze=n[40],nt=n[41]),E.useEffect(Ze,nt);let Le;n[42]!==qe||n[43]!==He?(Le=FEt({boundaryWidth:qe,currentWidth:He}),n[42]=qe,n[43]=He,n[44]=Le):Le=n[44];const Ne=Le,tt=E.useRef(Ne);let ot,rt;n[45]!==Ne?(ot=()=>{tt.current=Ne},rt=[Ne],n[45]=Ne,n[46]=ot,n[47]=rt):(ot=n[46],rt=n[47]),E.useEffect(ot,rt);const dt=E.useRef(void 0);let mt,ht;n[48]!==m||n[49]!==Ne||n[50]!==y||n[51]!==He?(mt=()=>{const En=Me.current;if(!y||!En)return;const lr=dt.current;m?lr!==void 0&&(En.style.width=`${lr}px`):He!==void 0&&(En.style.width=`${He}px`),typeof Ne=="number"&&(En.style.maxWidth=`${Ne}px`)},ht=[He,m,Ne,y],n[48]=m,n[49]=Ne,n[50]=y,n[51]=He,n[52]=mt,n[53]=ht):(mt=n[52],ht=n[53]),E.useEffect(mt,ht);const[ft,at]=E.useState(void 0);let et;n[54]!==xe||n[55]!==V||n[56]!==G||n[57]!==se||n[58]!==le||n[59]!==W||n[60]!==m||n[61]!==Y||n[62]!==Z||n[63]!==ee||n[64]!==pe?(et={animate:xe,arrowProp:V,arrowRef:Fe,constrainSize:G,fallbackPlacements:se,floatingBoundary:le,margins:W,matchReferenceWidth:m,maxWidthRef:tt,placementProp:Y,placementStrategy:Z,preventOverflow:ee,referenceBoundary:pe,referenceWidthRef:dt,rootBoundary:"viewport",setReferenceWidth:at,widthRef:Ge},n[54]=xe,n[55]=V,n[56]=G,n[57]=se,n[58]=le,n[59]=W,n[60]=m,n[61]=Y,n[62]=Z,n[63]=ee,n[64]=pe,n[65]=et):et=n[65];const xt=zEt(et);let lt;n[66]!==x?(lt=x?{reference:x}:void 0,n[66]=x,n[67]=lt):lt=n[67];let Ct;n[68]!==xt||n[69]!==Y||n[70]!==lt?(Ct={middleware:xt,placement:Y,whileElementsMounted:nR,elements:lt},n[68]=xt,n[69]=Y,n[70]=lt,n[71]=Ct):Ct=n[71];const{x:Dt,y:Ot,middlewareData:Rt,placement:Nt,refs:Mt,strategy:Gt,update:en}=QV(Ct),Yt=Rt.hide?.referenceHidden,zt=Rt.arrow?.x,jt=Rt.arrow?.y,un=Rt["@sanity/ui/origin"]?.originX,yn=Rt["@sanity/ui/origin"]?.originY;let bn;n[72]===Symbol.for("react.memo_cache_sentinel")?(bn=En=>{Fe.current=En},n[72]=bn):bn=n[72];const In=bn;let Jn;n[73]!==Mt?(Jn=En=>{Me.current=En,Mt.setFloating(En)},n[73]=Mt,n[74]=Jn):Jn=n[74];const gn=Jn;let gt;n[75]!==f?(gt=f?dqe(f):null,n[75]=f,n[76]=gt):gt=n[76];let _n;n[77]!==Mt.reference.current?(_n=()=>Mt.reference.current,n[77]=Mt.reference.current,n[78]=_n):_n=n[78],E.useImperativeHandle(gt,_n);let Xt;e:{if(x){Xt=f;break e}if(!f){Xt=null;break e}let En;n[79]!==f||n[80]!==Mt.setReference?(En=E.cloneElement(f,{ref:Mt.setReference}),n[79]=f,n[80]=Mt.setReference,n[81]=En):En=n[81],Xt=En}const An=Xt;let Bn,Vn;if(n[82]!==en?(Bn=()=>en,Vn=[en],n[82]=en,n[83]=Bn,n[84]=Vn):(Bn=n[83],Vn=n[84]),E.useImperativeHandle(B,Bn,Vn),p){let En;return n[85]!==f?(En=f||d.jsx(d.Fragment,{}),n[85]=f,n[86]=En):En=n[86],En}let ir;n[87]!==g?(ir=g&&d.jsx(VEt,{}),n[87]=g,n[88]=ir):ir=n[88];const rn=m?ft:He;let Pn;n[89]!==xe||n[90]!==V||n[91]!==zt||n[92]!==jt||n[93]!==h||n[94]!==W||n[95]!==un||n[96]!==yn||n[97]!==z||n[98]!==_e||n[99]!==Nt||n[100]!==ye||n[101]!==Yt||n[102]!==C||n[103]!==w||n[104]!==gn||n[105]!==ve||n[106]!==Gt||n[107]!==rn||n[108]!==re||n[109]!==Dt||n[110]!==Ot?(Pn=d.jsx(hqe,{...C,__unstable_margins:W,animate:xe,arrow:V,arrowRef:In,arrowX:zt,arrowY:jt,hidden:Yt,overflow:z,padding:_e,placement:Nt,radius:ye,ref:gn,scheme:w,shadow:ve,originX:un,originY:yn,strategy:Gt,tone:re,width:rn,x:Dt,y:Ot,children:h}),n[89]=xe,n[90]=V,n[91]=zt,n[92]=jt,n[93]=h,n[94]=W,n[95]=un,n[96]=yn,n[97]=z,n[98]=_e,n[99]=Nt,n[100]=ye,n[101]=Yt,n[102]=C,n[103]=w,n[104]=gn,n[105]=ve,n[106]=Gt,n[107]=rn,n[108]=re,n[109]=Dt,n[110]=Ot,n[111]=Pn):Pn=n[111];let er;n[112]!==ir||n[113]!==Pn||n[114]!==je?(er=d.jsxs(O2,{zOffset:je,children:[ir,Pn]}),n[112]=ir,n[113]=Pn,n[114]=je,n[115]=er):er=n[115];const jr=er;let fi;n[116]!==y||n[117]!==jr||n[118]!==v?(fi=y&&(v?d.jsx(X7,{__unstable_name:typeof v=="string"?v:void 0,children:jr}):jr),n[116]=y,n[117]=jr,n[118]=v,n[119]=fi):fi=n[119];const bi=fi;let Ti;n[120]!==xe||n[121]!==bi?(Ti=xe?d.jsx(Zu,{children:bi}):bi,n[120]=xe,n[121]=bi,n[122]=Ti):Ti=n[122];let nr;return n[123]!==An||n[124]!==Ti?(nr=d.jsxs(d.Fragment,{children:[Ti,An]}),n[123]=An,n[124]=Ti,n[125]=nr):nr=n[125],nr});Ng.displayName="ForwardRef(Popover)";function zEt(t){const e=Ut.c(42),{animate:n,arrowProp:r,arrowRef:i,constrainSize:o,fallbackPlacements:s,floatingBoundary:a,margins:l,matchReferenceWidth:c,maxWidthRef:u,placementProp:f,placementStrategy:h,preventOverflow:p,referenceBoundary:m,referenceWidthRef:g,rootBoundary:y,setReferenceWidth:b,widthRef:v}=t;let x;if(e[0]!==n||e[1]!==r||e[2]!==i||e[3]!==o||e[4]!==s||e[5]!==a||e[6]!==l||e[7]!==c||e[8]!==u||e[9]!==f||e[10]!==h||e[11]!==p||e[12]!==m||e[13]!==g||e[14]!==y||e[15]!==b||e[16]!==v){if(x=[],o||p)if(h==="autoPlacement"){let S;e[18]!==s||e[19]!==f?(S=eUe({allowedPlacements:[f].concat(s)}),e[18]=s,e[19]=f,e[20]=S):S=e[20],x.push(S)}else{const S=a||void 0;let k;e[21]!==s||e[22]!==y||e[23]!==S?(k=tz({boundary:S,fallbackPlacements:s,padding:uC,rootBoundary:y}),e[21]=s,e[22]=y,e[23]=S,e[24]=k):k=e[24],x.push(k)}let C;if(e[25]===Symbol.for("react.memo_cache_sentinel")?(C=JV({mainAxis:REt}),e[25]=C):C=e[25],x.push(C),o||c){const S=a||void 0;let k;e[26]!==o||e[27]!==l||e[28]!==c||e[29]!==u||e[30]!==g||e[31]!==b||e[32]!==S||e[33]!==v?(k=MEt({boundaryElement:S,constrainSize:o,margins:l,matchReferenceWidth:c,maxWidthRef:u,padding:uC,referenceWidthRef:g,setReferenceWidth:b,widthRef:v}),e[26]=o,e[27]=l,e[28]=c,e[29]=u,e[30]=g,e[31]=b,e[32]=S,e[33]=v,e[34]=k):k=e[34],x.push(k)}if(p){const S=a||void 0;let k;e[35]!==y||e[36]!==S?(k=ez({boundary:S,rootBoundary:y,padding:uC}),e[35]=y,e[36]=S,e[37]=k):k=e[37],x.push(k)}if(r){let S;e[38]!==i?(S=nz({element:i,padding:uC}),e[38]=i,e[39]=S):S=e[39],x.push(S)}n&&x.push(oqe);const w=m||void 0;let _;e[40]!==w?(_=tUe({boundary:w,padding:uC,strategy:"referenceHidden"}),e[40]=w,e[41]=_):_=e[41],x.push(_),e[0]=n,e[1]=r,e[2]=i,e[3]=o,e[4]=s,e[5]=a,e[6]=l,e[7]=c,e[8]=u,e[9]=f,e[10]=h,e[11]=p,e[12]=m,e[13]=g,e[14]=y,e[15]=b,e[16]=v,e[17]=x}else x=e[17];return x}function HEt(){return st` + position: relative; + + &:not([hidden]) { + display: inline-block; + } + + &[data-read-only] { + outline: 1px solid red; + } + `}function UEt(t){const{color:e,input:n}=Jt(t.theme),r=(n.radio.size-n.radio.markSize)/2;return st` + appearance: none; + position: absolute; + top: 0; + left: 0; + opacity: 0; + height: 100%; + width: 100%; + outline: none; + z-index: 1; + padding: 0; + margin: 0; + border-radius: ${qt(n.radio.size/2)}; + border: none; + + /* enabled */ + & + span { + display: block; + position: relative; + height: ${qt(n.radio.size)}; + width: ${qt(n.radio.size)}; + border-radius: ${qt(n.radio.size/2)}; + background: ${e.input.default.enabled.bg}; + box-shadow: ${Dc({color:e.input.default.enabled.border,width:n.border.width})}; + + &::after { + content: ''; + position: absolute; + top: ${qt(r)}; + left: ${qt(r)}; + height: ${qt(n.radio.markSize)}; + width: ${qt(n.radio.markSize)}; + border-radius: ${qt(n.radio.markSize/2)}; + background: ${e.input.default.enabled.fg}; + opacity: 0; + } + } + + /* focused */ + &:not(:disabled):focus + span { + box-shadow: ${Up({border:{width:n.border.width,color:e.input.default.enabled.border},focusRing:n.radio.focusRing})}; + } + + &:not(:disabled):focus:not(:focus-visible) + span { + box-shadow: ${Dc({color:e.input.default.enabled.border,width:n.border.width})}; + } + + &:checked + span::after { + opacity: 1; + } + + /* customValidity */ + &[data-error] + span { + background-color: ${e.input.invalid.enabled.border}; + box-shadow: ${Dc({width:n.border.width,color:e.input.invalid.enabled.muted.bg})}; + &::after { + background: ${e.input.invalid.enabled.muted.bg}; + } + } + + /* read only */ + &[data-read-only] + span { + box-shadow: 0 0 0 1px ${e.input.default.readOnly.border}; + background: ${e.input.default.readOnly.bg}; + + &::after { + background: ${e.input.default.readOnly.border}; + } + } + + /* disabled */ + &:not([data-read-only]):disabled + span { + box-shadow: 0 0 0 1px ${e.input.default.disabled.border}; + background: ${e.input.default.disabled.bg}; + + &::after { + background: ${e.input.default.disabled.border}; + } + } + `}const WEt=de.div.withConfig({displayName:"StyledRadio",componentId:"sc-ccrwkf-0"})(HEt),qEt=de.input.withConfig({displayName:"Input",componentId:"sc-ccrwkf-1"})(UEt),fde=E.forwardRef(function(t,e){const n=Ut.c(19);let r,i,o,s,a,l;n[0]!==t?({className:r,disabled:o,style:l,customValidity:i,readOnly:s,...a}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6]);const c=E.useRef(null);let u;n[7]===Symbol.for("react.memo_cache_sentinel")?(u=()=>c.current,n[7]=u):u=n[7],E.useImperativeHandle(e,u),lR(c,i);const f=!o&&s?"":void 0,h=i?"":void 0,p=o||s;let m;n[8]!==s||n[9]!==a||n[10]!==f||n[11]!==h||n[12]!==p?(m=d.jsx(qEt,{"data-read-only":f,"data-error":h,...a,disabled:p,readOnly:s,ref:c,type:"radio"}),n[8]=s,n[9]=a,n[10]=f,n[11]=h,n[12]=p,n[13]=m):m=n[13];let g;n[14]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx("span",{}),n[14]=g):g=n[14];let y;return n[15]!==r||n[16]!==l||n[17]!==m?(y=d.jsxs(WEt,{className:r,"data-ui":"Radio",style:l,children:[m,g]}),n[15]=r,n[16]=l,n[17]=m,n[18]=y):y=n[18],y});fde.displayName="ForwardRef(Radio)";function GEt(){return st` + position: relative; + width: -moz-available; + width: -webkit-fill-available; + width: stretch; + + &:not([hidden]) { + display: inline-block; + } + `}function YEt(t){const{font:e}=Jt(t.theme);return st` + -webkit-font-smoothing: antialiased; + appearance: none; + border: 0; + font-family: ${e.text.family}; + color: inherit; + width: 100%; + outline: none; + margin: 0; + + &:disabled { + opacity: 1; + } + `}function KEt(t){const{color:e,input:n}=Jt(t.theme);return st` + /* enabled */ + background-color: ${e.input.default.enabled.bg}; + color: ${e.input.default.enabled.fg}; + box-shadow: ${Dc({color:e.input.default.enabled.border,width:n.border.width})}; + + /* hovered */ + @media (hover: hover) { + &:not(:disabled):hover { + background-color: ${e.input.default.hovered.bg}; + color: ${e.input.default.hovered.fg}; + box-shadow: ${Dc({color:e.input.default.hovered.border,width:n.border.width})}; + } + } + + /* focused */ + &:not(:disabled):focus { + box-shadow: ${Up({border:{width:n.border.width,color:e.input.default.enabled.border},focusRing:n.select.focusRing})}; + } + + /* read-only */ + &[data-read-only] { + background-color: ${e.input.default.readOnly.bg}; + color: ${e.input.default.readOnly.fg}; + box-shadow: ${Dc({color:e.input.default.readOnly.border,width:n.border.width})}; + } + + /* disabled */ + &:not([data-read-only]):disabled { + background-color: ${e.input.default.disabled.bg}; + color: ${e.input.default.disabled.fg}; + box-shadow: ${Dc({color:e.input.default.disabled.border,width:n.border.width})}; + } + `}function XEt(t){return{fontSize:qt(t.fontSize),lineHeight:`${qt(t.lineHeight)}`}}function ZEt(t){const{$fontSize:e}=t,{font:n,media:r}=Jt(t.theme);return $i(r,e,i=>XEt(n.text.sizes[i]||n.text.sizes[2]))}function QEt(){return[K7,YEt,KEt,ZEt,zSt]}function JEt(t){const{color:e}=Jt(t.theme);return st` + pointer-events: none; + position: absolute; + top: 0; + right: 0; + + /* enabled */ + --card-fg-color: ${e.input.default.enabled.fg}; + + /* hover */ + @media (hover: hover) { + select:not(disabled):not(:read-only):hover + && { + --card-fg-color: ${e.input.default.hovered.fg}; + } + } + + /* disabled */ + select:disabled + && { + --card-fg-color: ${e.input.default.disabled.fg}; + } + + /* read-only */ + select[data-read-only] + && { + --card-fg-color: ${e.input.default.readOnly.fg}; + } + `}const hde={root:GEt,input:QEt,iconBox:JEt},eTt=de.div.withConfig({displayName:"StyledSelect",componentId:"sc-5mxno7-0"})(hde.root),tTt=de.select.withConfig({displayName:"Input",componentId:"sc-5mxno7-1"})(hde.input),nTt=de(me).withConfig({displayName:"IconBox",componentId:"sc-5mxno7-2"})(hde.iconBox),I0=E.forwardRef(function(t,e){const n=Ut.c(37);let r,i,o,s,a,l,c,u,f;n[0]!==t?({children:r,customValidity:i,disabled:o,fontSize:l,padding:c,radius:u,readOnly:s,space:f,...a}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9]);const h=l===void 0?2:l,p=c===void 0?3:c,m=u===void 0?2:u,g=f===void 0?3:f,y=E.useRef(null);let b;n[10]===Symbol.for("react.memo_cache_sentinel")?(b=()=>y.current,n[10]=b):b=n[10],E.useImperativeHandle(e,b),lR(y,i);const v=!o&&s?"":void 0;let x;n[11]!==h?(x=fn(h),n[11]=h,n[12]=x):x=n[12];let C;n[13]!==p?(C=fn(p),n[13]=p,n[14]=C):C=n[14];let w;n[15]!==m?(w=fn(m),n[15]=m,n[16]=w):w=n[16];let _;n[17]!==g?(_=fn(g),n[17]=g,n[18]=_):_=n[18];const S=o||s;let k;n[19]!==r||n[20]!==a||n[21]!==S||n[22]!==v||n[23]!==x||n[24]!==C||n[25]!==w||n[26]!==_?(k=d.jsx(tTt,{"data-read-only":v,"data-ui":"Select",...a,$fontSize:x,$padding:C,$radius:w,$space:_,disabled:S,ref:y,children:r}),n[19]=r,n[20]=a,n[21]=S,n[22]=v,n[23]=x,n[24]=C,n[25]=w,n[26]=_,n[27]=k):k=n[27];let I;n[28]===Symbol.for("react.memo_cache_sentinel")?(I=d.jsx(Ts,{}),n[28]=I):I=n[28];let j;n[29]!==h?(j=d.jsx(oe,{size:h,children:I}),n[29]=h,n[30]=j):j=n[30];let A;n[31]!==p||n[32]!==j?(A=d.jsx(nTt,{padding:p,children:j}),n[31]=p,n[32]=j,n[33]=A):A=n[33];let D;return n[34]!==k||n[35]!==A?(D=d.jsxs(eTt,{"data-ui":"Select",children:[k,A]}),n[34]=k,n[35]=A,n[36]=D):D=n[36],D});I0.displayName="ForwardRef(Select)";const rTt={"&&:not([hidden])":{display:"grid"},'&[data-as="ul"],&[data-as="ol"]':{listStyle:"none"},gridTemplateColumns:"minmax(0, 1fr)",gridAutoRows:"min-content"};function iTt(){return rTt}function oTt(t){const{media:e,space:n}=Jt(t.theme);return $i(e,t.$space,r=>({gridGap:qt(n[r])}))}const sTt=de(me).withConfig({displayName:"StyledStack",componentId:"sc-8dpfq2-0"})(iTt,oTt),ze=E.forwardRef(function(t,e){const n=Ut.c(12);let r,i,o;n[0]!==t?({as:r,space:o,...i}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o):(r=n[1],i=n[2],o=n[3]);const s=typeof r=="string"?r:void 0;let a;n[4]!==o?(a=fn(o),n[4]=o,n[5]=a):a=n[5];let l;return n[6]!==r||n[7]!==e||n[8]!==i||n[9]!==s||n[10]!==a?(l=d.jsx(sTt,{"data-as":s,"data-ui":"Stack",...i,$space:a,forwardedAs:r,ref:e}),n[6]=r,n[7]=e,n[8]=i,n[9]=s,n[10]=a,n[11]=l):l=n[11],l});ze.displayName="ForwardRef(Stack)";function aTt(){return st` + position: relative; + &:not([hidden]) { + display: inline-block; + } + `}function lTt(){return st` + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + opacity: 0; + height: 100%; + width: 100%; + outline: none; + padding: 0; + margin: 0; + + /* Place the input element above the representation element */ + z-index: 1; + `}function cTt(t){const{color:e,input:n}=Jt(t.theme);return st` + --switch-bg-color: ${e.input.default.enabled.border}; + --switch-fg-color: ${e.input.default.enabled.bg}; + --switch-box-shadow: none; + + &:not([hidden]) { + display: block; + } + position: relative; + width: ${qt(n.switch.width)}; + height: ${qt(n.switch.height)}; + border-radius: ${qt(n.switch.height/2)}; + + /* Make sure it’s not possible to interact with the wrapper element */ + pointer-events: none; + + &:after { + content: ''; + display: block; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 1; + box-shadow: var(--switch-box-shadow); + border-radius: inherit; + } + + /* Focus styles */ + input:focus + && { + --switch-box-shadow: ${Up({focusRing:n.switch.focusRing})}; + } + + input:focus:not(:focus-visible) + && { + --switch-box-shadow: none; + } + + input:checked + && { + --switch-bg-color: ${e.input.default.enabled.fg}; + --switch-fg-color: ${e.input.default.enabled.bg}; + } + + @media (hover: hover) { + input:not(:disabled):hover + && { + --switch-bg-color: ${e.input.default.hovered.border}; + --switch-fg-color: ${e.input.default.hovered.bg}; + } + + input:not(:disabled):checked:hover + && { + --switch-bg-color: ${e.input.default.enabled.fg}; + --switch-fg-color: ${e.input.default.enabled.bg}; + } + } + + input:not([data-read-only]):disabled + && { + --switch-bg-color: ${e.input.default.disabled.border}; + --switch-fg-color: ${e.input.default.disabled.bg}; + } + + input[data-read-only]:disabled + && { + --switch-bg-color: ${e.input.default.readOnly.border}; + --switch-fg-color: ${e.input.default.readOnly.bg}; + } + + input:checked[data-read-only]:disabled + && { + --switch-bg-color: ${e.input.default.readOnly.fg}; + --switch-fg-color: ${e.input.default.readOnly.bg}; + } + `}function uTt(t){const{input:e}=Jt(t.theme);return st` + &:not([hidden]) { + display: block; + } + background-color: var(--switch-bg-color); + position: absolute; + left: 0; + top: 0; + width: ${qt(e.switch.width)}; + height: ${qt(e.switch.height)}; + border-radius: ${qt(e.switch.height/2)}; + `}function dTt(t){const{$indeterminate:e}=t,{input:n}=Jt(t.theme),r=n.switch.width,i=n.switch.height,o=n.switch.padding,s=i-n.switch.padding*2,a=r-o*2-s,l=r/2-s/2-o,c=e!==!0&&t.$checked===!0;return st` + &:not([hidden]) { + display: block; + } + position: absolute; + left: ${qt(o)}; + top: ${qt(o)}; + height: ${qt(s)}; + width: ${qt(s)}; + border-radius: ${qt(s/2)}; + transition-property: transform; + transition-duration: ${n.switch.transitionDurationMs}ms; + transition-timing-function: ${n.switch.transitionTimingFunction}; + background: var(--switch-fg-color); + transform: translate3d(0, 0, 0); + box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.05); + + ${c&&st` + transform: translate3d(${a}px, 0, 0); + `} + + ${e&&st` + transform: translate3d(${l}px, 0, 0); + `} + `}const fTt=de.span.withConfig({displayName:"StyledSwitch",componentId:"sc-dw1foe-0"})(aTt),hTt=de.input.withConfig({displayName:"Input",componentId:"sc-dw1foe-1"})(lTt),pTt=de.span.withConfig({displayName:"Representation",componentId:"sc-dw1foe-2"})(cTt),mTt=de.span.withConfig({displayName:"Track",componentId:"sc-dw1foe-3"})(uTt),gTt=de.span.withConfig({displayName:"Thumb",componentId:"sc-dw1foe-4"})(dTt),hS=E.forwardRef(function(t,e){const n=Ut.c(26);let r,i,o,s,a,l,c;n[0]!==t?({checked:r,className:i,disabled:o,indeterminate:s,readOnly:a,style:c,...l}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7]);const u=E.useRef(null);let f;n[8]===Symbol.for("react.memo_cache_sentinel")?(f=()=>u.current,n[8]=f):f=n[8],E.useImperativeHandle(e,f);let h,p;n[9]!==s?(h=()=>{u.current&&(u.current.indeterminate=s||!1)},p=[s],n[9]=s,n[10]=h,n[11]=p):(h=n[10],p=n[11]),E.useEffect(h,p);const m=!o&&a?"":void 0,g=s!==!0&&r,y=o||a;let b;n[12]!==l||n[13]!==m||n[14]!==g||n[15]!==y?(b=d.jsx(hTt,{"data-read-only":m,...l,checked:g,disabled:y,type:"checkbox",ref:u}),n[12]=l,n[13]=m,n[14]=g,n[15]=y,n[16]=b):b=n[16];let v;n[17]===Symbol.for("react.memo_cache_sentinel")?(v=d.jsx(mTt,{}),n[17]=v):v=n[17];let x;n[18]!==r||n[19]!==s?(x=d.jsxs(pTt,{"aria-hidden":!0,"data-name":"representation",children:[v,d.jsx(gTt,{$checked:r,$indeterminate:s})]}),n[18]=r,n[19]=s,n[20]=x):x=n[20];let C;return n[21]!==i||n[22]!==c||n[23]!==b||n[24]!==x?(C=d.jsxs(fTt,{className:i,"data-ui":"Switch",style:c,children:[b,x]}),n[21]=i,n[22]=c,n[23]=b,n[24]=x,n[25]=C):C=n[25],C});hS.displayName="ForwardRef(Switch)";const yTt=de.span.withConfig({displayName:"StyledTextArea",componentId:"sc-1d6h1o8-0"})(XWe),bTt=de.span.withConfig({displayName:"InputRoot",componentId:"sc-1d6h1o8-1"})`flex:1;min-width:0;display:block;position:relative;`,vTt=de.textarea.withConfig({displayName:"Input",componentId:"sc-1d6h1o8-2"})(lde,ZWe,QWe),xTt=de.div.withConfig({displayName:"Presentation",componentId:"sc-1d6h1o8-3"})(K7,JWe),cz=E.forwardRef(function(t,e){const n=Ut.c(35);let r,i,o,s,a,l,c,u,f;n[0]!==t?({border:s,customValidity:i,disabled:a,fontSize:l,padding:c,radius:u,weight:f,__unstable_disableFocusRing:r,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9]);const h=s===void 0?!0:s,p=a===void 0?!1:a,m=l===void 0?2:l,g=c===void 0?3:c,y=u===void 0?2:u,b=E.useRef(null),v=H8();let x;n[10]===Symbol.for("react.memo_cache_sentinel")?(x=()=>b.current,n[10]=x):x=n[10],E.useImperativeHandle(e,x),lR(b,i);const C=v.scheme,w=v.tone;let _;n[11]!==m?(_=fn(m),n[11]=m,n[12]=_):_=n[12];let S;n[13]!==g?(S=fn(g),n[13]=g,n[14]=S):S=n[14];const k=v.scheme;let I;n[15]===Symbol.for("react.memo_cache_sentinel")?(I=fn(0),n[15]=I):I=n[15];let j;n[16]!==p||n[17]!==o||n[18]!==v.scheme||n[19]!==v.tone||n[20]!==_||n[21]!==S||n[22]!==f?(j=d.jsx(vTt,{"data-as":"textarea","data-scheme":C,"data-tone":w,...o,$fontSize:_,$padding:S,$scheme:k,$space:I,$tone:v.tone,$weight:f,disabled:p,ref:b}),n[16]=p,n[17]=o,n[18]=v.scheme,n[19]=v.tone,n[20]=_,n[21]=S,n[22]=f,n[23]=j):j=n[23];let A;n[24]!==y?(A=fn(y),n[24]=y,n[25]=A):A=n[25];const D=h?"":void 0;let O;n[26]!==r||n[27]!==v.scheme||n[28]!==v.tone||n[29]!==A||n[30]!==D?(O=d.jsx(xTt,{$radius:A,$unstableDisableFocusRing:r,$scheme:v.scheme,$tone:v.tone,"data-border":D,"data-scheme":v.scheme,"data-tone":v.tone}),n[26]=r,n[27]=v.scheme,n[28]=v.tone,n[29]=A,n[30]=D,n[31]=O):O=n[31];let P;return n[32]!==j||n[33]!==O?(P=d.jsx(yTt,{"data-ui":"TextArea",children:d.jsxs(bTt,{children:[j,O]})}),n[32]=j,n[33]=O,n[34]=P):P=n[34],P});cz.displayName="ForwardRef(TextArea)";const CTt={zIndex:2},wTt=de(Be).attrs({forwardedAs:"span"}).withConfig({displayName:"StyledTextInput",componentId:"sc-h62wco-0"})(XWe),_Tt=de.span.withConfig({displayName:"InputRoot",componentId:"sc-h62wco-1"})`flex:1;min-width:0;display:block;position:relative;`,STt=de(Be).attrs({forwardedAs:"span"}).withConfig({displayName:"Prefix",componentId:"sc-h62wco-2"})`border-top-right-radius:0;border-bottom-right-radius:0;& > span{display:block;margin:-1px;}`,kTt=de(Be).attrs({forwardedAs:"span"}).withConfig({displayName:"Suffix",componentId:"sc-h62wco-3"})`border-top-left-radius:0;border-bottom-left-radius:0;& > span{display:block;margin:-1px;}`,ETt=de.input.withConfig({displayName:"Input",componentId:"sc-h62wco-4"})(lde,ZWe,QWe),TTt=de.span.withConfig({displayName:"Presentation",componentId:"sc-h62wco-5"})(K7,JWe),ITt=de(me).withConfig({displayName:"LeftBox",componentId:"sc-h62wco-6"})`position:absolute;top:0;left:0;`,jTt=de(me).withConfig({displayName:"RightBox",componentId:"sc-h62wco-7"})`position:absolute;top:0;right:0;`,ATt=de(Be).withConfig({displayName:"RightCard",componentId:"sc-h62wco-8"})`background-color:transparent;position:absolute;top:0;right:0;`,RTt=de(vn).withConfig({displayName:"TextInputClearButton",componentId:"sc-h62wco-9"})({"&:not([hidden])":{display:"block"}}),Ls=E.forwardRef(function(t,e){const n=Ut.c(92);let r,i,o,s,a,l,c,u,f,h,p,m,g,y,b,v,x,C;n[0]!==t?({__unstable_disableFocusRing:o,border:p,clearButton:s,disabled:m,fontSize:g,icon:r,iconRight:i,onClear:l,padding:y,prefix:c,radius:b,readOnly:u,space:v,suffix:h,customValidity:a,type:x,weight:C,...f}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h,n[11]=p,n[12]=m,n[13]=g,n[14]=y,n[15]=b,n[16]=v,n[17]=x,n[18]=C):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10],p=n[11],m=n[12],g=n[13],y=n[14],b=n[15],v=n[16],x=n[17],C=n[18]);const w=p===void 0?!0:p,_=m===void 0?!1:m,S=g===void 0?2:g,k=y===void 0?3:y,I=b===void 0?2:b,j=v===void 0?3:v,A=x===void 0?"text":x,D=E.useRef(null),O=H8();let P;n[19]!==S?(P=fn(S),n[19]=S,n[20]=P):P=n[20];const $=P;let M;n[21]!==k?(M=fn(k),n[21]=k,n[22]=M):M=n[22];const L=M;let B;n[23]!==I?(B=fn(I),n[23]=I,n[24]=B):B=n[24];const W=B;let N;n[25]!==j?(N=fn(j),n[25]=j,n[26]=N):N=n[26];const V=N,G=!!s,z=!!r,Y=!!i,Z=!!h,ee=!!c;let K;n[27]===Symbol.for("react.memo_cache_sentinel")?(K=()=>D.current,n[27]=K):K=n[27],E.useImperativeHandle(e,K),lR(D,a);const q=DTt;let re;n[28]!==l?(re=qe=>{qe.preventDefault(),qe.stopPropagation(),l&&l(),D.current?.focus()},n[28]=l,n[29]=re):re=n[29];const te=re;let ae;n[30]!==c||n[31]!==W?(ae=c&&d.jsx(STt,{borderTop:!0,borderLeft:!0,borderBottom:!0,radius:W,sizing:"border",tone:"inherit",children:d.jsx("span",{children:c})}),n[30]=c,n[31]=W,n[32]=ae):ae=n[32];const se=ae,le=w?"":void 0;let pe;n[33]!==r||n[34]!==$||n[35]!==L?(pe=r&&d.jsx(ITt,{padding:L,children:d.jsxs(oe,{size:$,children:[E.isValidElement(r)&&r,ma.isValidElementType(r)&&d.jsx(r,{})]})}),n[33]=r,n[34]=$,n[35]=L,n[36]=pe):pe=n[36];let be;n[37]!==G||n[38]!==i||n[39]!==$||n[40]!==L?(be=!G&&i&&d.jsx(jTt,{padding:L,children:d.jsxs(oe,{size:$,children:[E.isValidElement(i)&&i,ma.isValidElementType(i)&&d.jsx(i,{})]})}),n[37]=G,n[38]=i,n[39]=$,n[40]=L,n[41]=be):be=n[41];let xe;n[42]!==ee||n[43]!==Z||n[44]!==o||n[45]!==W||n[46]!==O.scheme||n[47]!==O.tone||n[48]!==le||n[49]!==pe||n[50]!==be?(xe=d.jsxs(TTt,{$hasPrefix:ee,$unstableDisableFocusRing:o,$hasSuffix:Z,$radius:W,$scheme:O.scheme,$tone:O.tone,"data-border":le,"data-scheme":O.scheme,"data-tone":O.tone,children:[pe,be]}),n[42]=ee,n[43]=Z,n[44]=o,n[45]=W,n[46]=O.scheme,n[47]=O.tone,n[48]=le,n[49]=pe,n[50]=be,n[51]=xe):xe=n[51];const Ce=xe;let Te;n[52]!==L?(Te=L.map(OTt),n[52]=L,n[53]=Te):Te=n[53];const _e=Te;let Ie;n[54]!==L?(Ie=L.map(PTt),n[54]=L,n[55]=Ie):Ie=n[55];const ye=Ie,fe=typeof s=="object"?s:r8;let ve;n[56]!==s||n[57]!==_e||n[58]!==ye||n[59]!==fe||n[60]!==a||n[61]!==_||n[62]!==$||n[63]!==te||n[64]!==W||n[65]!==u?(ve=!_&&!u&&s&&d.jsx(ATt,{forwardedAs:"span",padding:_e,style:CTt,tone:a?"critical":"inherit",children:d.jsx(RTt,{"aria-label":"Clear","data-qa":"clear-button",fontSize:$,icon:ao,mode:"bleed",padding:ye,radius:W,...fe,onClick:te,onMouseDown:q})}),n[56]=s,n[57]=_e,n[58]=ye,n[59]=fe,n[60]=a,n[61]=_,n[62]=$,n[63]=te,n[64]=W,n[65]=u,n[66]=ve):ve=n[66];const Se=ve;let Ee;n[67]!==W||n[68]!==h?(Ee=h&&d.jsx(kTt,{borderTop:!0,borderRight:!0,borderBottom:!0,radius:W,sizing:"border",tone:"inherit",children:d.jsx("span",{children:h})}),n[67]=W,n[68]=h,n[69]=Ee):Ee=n[69];const je=Ee,Me=Y||G;let Fe;n[70]!==z||n[71]!==_||n[72]!==$||n[73]!==L||n[74]!==u||n[75]!==f||n[76]!==O.scheme||n[77]!==O.tone||n[78]!==V||n[79]!==Me||n[80]!==A||n[81]!==C?(Fe=d.jsx(ETt,{"data-as":"input","data-scheme":O.scheme,"data-tone":O.tone,...f,$fontSize:$,$iconLeft:z,$iconRight:Me,$padding:L,$scheme:O.scheme,$space:V,$tone:O.tone,$weight:C,disabled:_,readOnly:u,ref:D,type:A}),n[70]=z,n[71]=_,n[72]=$,n[73]=L,n[74]=u,n[75]=f,n[76]=O.scheme,n[77]=O.tone,n[78]=V,n[79]=Me,n[80]=A,n[81]=C,n[82]=Fe):Fe=n[82];let $e;n[83]!==Se||n[84]!==Ce||n[85]!==Fe?($e=d.jsxs(_Tt,{children:[Fe,Ce,Se]}),n[83]=Se,n[84]=Ce,n[85]=Fe,n[86]=$e):$e=n[86];let Ye;return n[87]!==se||n[88]!==O.tone||n[89]!==je||n[90]!==$e?(Ye=d.jsxs(wTt,{"data-ui":"TextInput",tone:O.tone,children:[se,$e,je]}),n[87]=se,n[88]=O.tone,n[89]=je,n[90]=$e,n[91]=Ye):Ye=n[91],Ye});Ls.displayName="ForwardRef(TextInput)";function DTt(t){t.preventDefault(),t.stopPropagation()}function OTt(t){return t===0?0:t===1||t===2?1:t-2}function PTt(t){return t===0||t===1?0:t===2?1:t-1}function Vie(t){const e=Ut.c(3),[n,r]=E.useState(t),i=E.useRef(void 0);let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(l,c)=>{const u=()=>{r(l)};if(i.current&&(clearTimeout(i.current),i.current=void 0),!c)return u();i.current=setTimeout(u,c)},e[0]=o):o=e[0];const s=o;let a;return e[1]!==n?(a=[n,s],e[1]=n,e[2]=a):a=e[2],a}const $Tt=15,MTt=6,LTt=2,FTt=4,zM=4,NTt={top:["top-end","top-start","bottom","left","right"],"top-start":["top","top-end","bottom-start","left-start","right-start"],"top-end":["top","top-start","bottom-end","left-end","right-end"],bottom:["bottom-end","bottom-start","top","left","right"],"bottom-start":["bottom","bottom-end","top-start","left-start","right-start"],"bottom-end":["bottom","bottom-start","top-end","left-end","right-end"],left:["left-end","left-start","right","top","bottom"],"left-start":["left","left-end","right-start","top-start","bottom-start"],"left-end":["left","left-start","right-end","top-end","bottom-end"],right:["right-end","right-start","left","top","bottom"],"right-start":["right","right-end","left-start","top-start","bottom-start"],"right-end":["right","right-start","left-end","top-end","bottom-end"]},BTt=de(ei.create(Be)).withConfig({displayName:"MotionCard",componentId:"sc-1xn138w-0"})`will-change:transform;`,pqe=E.forwardRef(function(t,e){const n=Ut.c(48);let r,i,o,s,a,l,c,u,f,h,p,m,g,y,b;n[0]!==t?({animate:r,arrow:i,arrowRef:o,arrowX:s,arrowY:a,children:l,originX:c,originY:u,padding:f,placement:h,radius:p,scheme:g,shadow:y,style:b,...m}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h,n[11]=p,n[12]=m,n[13]=g,n[14]=y,n[15]=b):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10],p=n[11],m=n[12],g=n[13],y=n[14],b=n[15]);const v=r?"transform":void 0;let x;n[16]!==c||n[17]!==u||n[18]!==b||n[19]!==v?(x={originX:c,originY:u,willChange:v,...b},n[16]=c,n[17]=u,n[18]=b,n[19]=v,n[20]=x):x=n[20];const C=x,w=s!==null?s:void 0,_=a!==null?a:void 0;let S;n[21]!==w||n[22]!==_?(S={left:w,top:_,right:void 0,bottom:void 0},n[21]=w,n[22]=_,n[23]=S):S=n[23];const k=S,I=m;let j;n[24]!==r?(j=r?["hidden","initial"]:void 0,n[24]=r,n[25]=j):j=n[25];let A;n[26]!==r?(A=r?["visible","scaleIn"]:void 0,n[26]=r,n[27]=A):A=n[27];let D;n[28]!==r?(D=r?["hidden","scaleOut"]:void 0,n[28]=r,n[29]=D):D=n[29];let O;n[30]!==i||n[31]!==o||n[32]!==k?(O=i&&d.jsx(dde,{ref:o,style:k,width:$Tt,height:MTt,radius:LTt}),n[30]=i,n[31]=o,n[32]=k,n[33]=O):O=n[33];let P;return n[34]!==l||n[35]!==f||n[36]!==h||n[37]!==p||n[38]!==e||n[39]!==C||n[40]!==g||n[41]!==y||n[42]!==I||n[43]!==j||n[44]!==A||n[45]!==D||n[46]!==O?(P=d.jsxs(BTt,{"data-ui":"Tooltip__card",...I,"data-placement":h,padding:f,radius:p,ref:e,scheme:g,shadow:y,style:C,variants:NC.card,transition:NC.transition,initial:j,animate:A,exit:D,children:[l,O]}),n[34]=l,n[35]=f,n[36]=h,n[37]=p,n[38]=e,n[39]=C,n[40]=g,n[41]=y,n[42]=I,n[43]=j,n[44]=A,n[45]=D,n[46]=O,n[47]=P):P=n[47],P});pqe.displayName="ForwardRef(TooltipCard)";const mqe=q7("@sanity/ui/context/tooltipDelayGroup",null);function gqe(t){const e=Ut.c(9),{children:n,delay:r}=t,[i,o]=Vie(!1),[s,a]=Vie(null),l=typeof r=="number"?r:r?.open||0,c=typeof r=="number"?r:r?.close||0,u=i?1:l;let f;e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==u?(f={setIsGroupActive:o,openTooltipId:s,setOpenTooltipId:a,openDelay:u,closeDelay:c},e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=u,e[5]=f):f=e[5];const h=f;let p;return e[6]!==n||e[7]!==h?(p=d.jsx(mqe.Provider,{value:h,children:n}),e[6]=n,e[7]=h,e[8]=p):p=e[8],p}gqe.displayName="TooltipDelayGroupProvider";function VTt(){return E.useContext(mqe)}const zTt=de(Hf).withConfig({displayName:"StyledTooltip",componentId:"sc-13f2zvh-0"})`pointer-events:none;`,$f=E.forwardRef(function(t,e){const n=Ut.c(137),r=U8(),{layer:i}=Y7();let o,s,a,l,c,u,f,h,p,m,g,y,b,v,x,C;n[0]!==t?({animate:g,arrow:y,boundaryElement:o,children:l,content:c,disabled:f,fallbackPlacements:s,padding:b,placement:v,portal:h,radius:x,scheme:m,shadow:C,zOffset:a,delay:u,...p}=t,n[0]=t,n[1]=o,n[2]=s,n[3]=a,n[4]=l,n[5]=c,n[6]=u,n[7]=f,n[8]=h,n[9]=p,n[10]=m,n[11]=g,n[12]=y,n[13]=b,n[14]=v,n[15]=x,n[16]=C):(o=n[1],s=n[2],a=n[3],l=n[4],c=n[5],u=n[6],f=n[7],h=n[8],p=n[9],m=n[10],g=n[11],y=n[12],b=n[13],v=n[14],x=n[15],C=n[16]);const w=g===void 0?!1:g,_=y===void 0?!1:y,S=b===void 0?2:b,k=v===void 0?"bottom":v,I=x===void 0?2:x,j=C===void 0?2:C,A=o??r?.element,D=s??NTt[t.placement??"bottom"],O=a??i.tooltip.zOffset,P=lz()?!1:w;let $;n[17]!==D?($=fn(D),n[17]=D,n[18]=$):$=n[18];const M=$,L=E.useRef(null),[B,W]=E.useState(null),N=E.useRef(null),[V,G]=E.useState(0);let z;n[19]===Symbol.for("react.memo_cache_sentinel")?(z=()=>L.current,n[19]=z):z=n[19],E.useImperativeHandle(e,z);const Y=im(),Z=typeof h=="string"?Y.elements?.[h]||null:Y.element;let ee;n[20]!==P||n[21]!==_||n[22]!==A||n[23]!==M?(ee={animate:P,arrowProp:_,arrowRef:N,boundaryElement:A,fallbackPlacements:M,rootBoundary:"viewport"},n[20]=P,n[21]=_,n[22]=A,n[23]=M,n[24]=ee):ee=n[24];const K=HTt(ee);let q;n[25]!==B?(q={reference:B},n[25]=B,n[26]=q):q=n[26];let re;n[27]!==K||n[28]!==k||n[29]!==q?(re={middleware:K,placement:k,whileElementsMounted:nR,elements:q},n[27]=K,n[28]=k,n[29]=q,n[30]=re):re=n[30];const{floatingStyles:te,placement:ae,middlewareData:se,refs:le,update:pe}=QV(re),be=se.arrow?.x,xe=se.arrow?.y,Ce=se["@sanity/ui/origin"]?.originX,Te=se["@sanity/ui/origin"]?.originY,_e=E.useId(),[Ie,ye]=Vie(!1),fe=VTt();let ve;n[31]!==fe?(ve=fe||{},n[31]=fe,n[32]=ve):ve=n[32];const{setIsGroupActive:Se,setOpenTooltipId:Ee}=ve,je=Ie||fe?.openTooltipId===_e,Me=fe!==null,Fe=typeof u=="number"?u:u?.open||0,$e=typeof u=="number"?u:u?.close||0,Ye=Me?fe.openDelay:Fe,qe=Me?fe.closeDelay:$e;let He;n[33]!==qe||n[34]!==Me||n[35]!==Ye||n[36]!==Se||n[37]!==ye||n[38]!==Ee||n[39]!==_e?(He=(rn,Pn)=>{if(Me)if(rn){const er=Pn?0:Ye;Se?.(rn,er),Ee?.(_e,er)}else{const er=qe>200?qe:200;Se?.(rn,er),Ee?.(null,Pn?0:qe)}else ye(rn,Pn?0:rn?Ye:qe)},n[33]=qe,n[34]=Me,n[35]=Ye,n[36]=Se,n[37]=ye,n[38]=Ee,n[39]=_e,n[40]=He):He=n[40];const Ge=He;let Ze;n[41]!==l?.props||n[42]!==Ge?(Ze=rn=>{Ge(!1),l?.props?.onBlur?.(rn)},n[41]=l?.props,n[42]=Ge,n[43]=Ze):Ze=n[43];const nt=Ze;let Le;n[44]!==l?.props||n[45]!==Ge?(Le=rn=>{Ge(!1,!0),l?.props.onClick?.(rn)},n[44]=l?.props,n[45]=Ge,n[46]=Le):Le=n[46];const Ne=Le;let tt;n[47]!==l?.props||n[48]!==Ge?(tt=rn=>{Ge(!1,!0),l?.props.onContextMenu?.(rn)},n[47]=l?.props,n[48]=Ge,n[49]=tt):tt=n[49];const ot=tt;let rt;n[50]!==l?.props||n[51]!==Ge?(rt=rn=>{Ge(!0),l?.props?.onFocus?.(rn)},n[50]=l?.props,n[51]=Ge,n[52]=rt):rt=n[52];const dt=rt;let mt;n[53]!==l?.props||n[54]!==Ge?(mt=rn=>{Ge(!0),l?.props?.onMouseEnter?.(rn)},n[53]=l?.props,n[54]=Ge,n[55]=mt):mt=n[55];const ht=mt;let ft;n[56]!==l?.props||n[57]!==Ge?(ft=rn=>{Ge(!1),l?.props?.onMouseLeave?.(rn)},n[56]=l?.props,n[57]=Ge,n[58]=ft):ft=n[58];const at=ft;let et;n[59]!==Ge||n[60]!==Me||n[61]!==B||n[62]!==je?(et={handleIsOpenChange:Ge,referenceElement:B,showTooltip:je,isInsideGroup:Me},n[59]=Ge,n[60]=Me,n[61]=B,n[62]=je,n[63]=et):et=n[63],UTt(et);let xt,lt;n[64]!==f||n[65]!==Ge||n[66]!==je?(xt=()=>{f&&je&&Ge(!1)},lt=[f,Ge,je],n[64]=f,n[65]=Ge,n[66]=je,n[67]=xt,n[68]=lt):(xt=n[67],lt=n[68]),E.useEffect(xt,lt);let Ct,Dt;n[69]!==c||n[70]!==Ge||n[71]!==je?(Ct=()=>{!c&&je&&Ge(!1)},Dt=[c,Ge,je],n[69]=c,n[70]=Ge,n[71]=je,n[72]=Ct,n[73]=Dt):(Ct=n[72],Dt=n[73]),E.useEffect(Ct,Dt);let Ot,Rt;n[74]!==Ge||n[75]!==je?(Ot=()=>{if(!je)return;const rn=function(Pn){Pn.key==="Escape"&&Ge(!1,!0)};return window.addEventListener("keydown",rn),()=>{window.removeEventListener("keydown",rn)}},Rt=[Ge,je],n[74]=Ge,n[75]=je,n[76]=Ot,n[77]=Rt):(Ot=n[76],Rt=n[77]),E.useEffect(Ot,Rt);let Nt;n[78]!==A||n[79]!==Z?.offsetWidth?(Nt=()=>{const rn=[...A?[A.offsetWidth]:[],Z?.offsetWidth||document.body.offsetWidth];G(Math.min(...rn)-zM*2)},n[78]=A,n[79]=Z?.offsetWidth,n[80]=Nt):Nt=n[80];let Mt;n[81]!==A||n[82]!==Z?(Mt=[A,Z],n[81]=A,n[82]=Z,n[83]=Mt):Mt=n[83],E.useLayoutEffect(Nt,Mt);let Gt;n[84]!==pe?(Gt=rn=>{N.current=rn,pe()},n[84]=pe,n[85]=Gt):Gt=n[85];const en=Gt;let Yt;n[86]!==le?(Yt=rn=>{L.current=rn,le.setFloating(rn)},n[86]=le,n[87]=Yt):Yt=n[87];const zt=Yt;let jt;e:{if(!l){jt=null;break e}let rn;n[88]!==l||n[89]!==nt||n[90]!==Ne||n[91]!==ot||n[92]!==dt||n[93]!==ht||n[94]!==at?(rn=E.cloneElement(l,{onBlur:nt,onFocus:dt,onMouseEnter:ht,onMouseLeave:at,onClick:Ne,onContextMenu:ot,ref:W}),n[88]=l,n[89]=nt,n[90]=Ne,n[91]=ot,n[92]=dt,n[93]=ht,n[94]=at,n[95]=rn):rn=n[95],jt=rn}const un=jt;let yn;n[96]!==l?(yn=l?dqe(l):null,n[96]=l,n[97]=yn):yn=n[97];let bn,In;if(n[98]!==B?(bn=()=>B,In=[B],n[98]=B,n[99]=bn,n[100]=In):(bn=n[99],In=n[100]),E.useImperativeHandle(yn,bn,In),!un){let rn;return n[101]===Symbol.for("react.memo_cache_sentinel")?(rn=d.jsx(d.Fragment,{}),n[101]=rn):rn=n[101],rn}if(f)return un;const Jn=V>0?`${V}px`:void 0;let gn;n[102]!==te||n[103]!==Jn?(gn={...te,maxWidth:Jn},n[102]=te,n[103]=Jn,n[104]=gn):gn=n[104];let gt;n[105]!==P||n[106]!==_||n[107]!==be||n[108]!==xe||n[109]!==c||n[110]!==Ce||n[111]!==Te||n[112]!==S||n[113]!==ae||n[114]!==I||n[115]!==p||n[116]!==m||n[117]!==en||n[118]!==zt||n[119]!==j?(gt=d.jsx(pqe,{...p,animate:P,arrow:_,arrowRef:en,arrowX:be,arrowY:xe,originX:Ce,originY:Te,padding:S,placement:ae,radius:I,ref:zt,scheme:m,shadow:j,children:c}),n[105]=P,n[106]=_,n[107]=be,n[108]=xe,n[109]=c,n[110]=Ce,n[111]=Te,n[112]=S,n[113]=ae,n[114]=I,n[115]=p,n[116]=m,n[117]=en,n[118]=zt,n[119]=j,n[120]=gt):gt=n[120];let _n;n[121]!==p||n[122]!==zt||n[123]!==gn||n[124]!==gt||n[125]!==O?(_n=d.jsx(zTt,{"data-ui":"Tooltip",...p,ref:zt,style:gn,zOffset:O,children:gt}),n[121]=p,n[122]=zt,n[123]=gn,n[124]=gt,n[125]=O,n[126]=_n):_n=n[126];const Xt=_n;let An;n[127]!==h||n[128]!==je||n[129]!==Xt?(An=je&&(h?d.jsx(X7,{__unstable_name:typeof h=="string"?h:void 0,children:Xt}):Xt),n[127]=h,n[128]=je,n[129]=Xt,n[130]=An):An=n[130];const Bn=An;let Vn;n[131]!==P||n[132]!==Bn?(Vn=P?d.jsx(Zu,{children:Bn}):Bn,n[131]=P,n[132]=Bn,n[133]=Vn):Vn=n[133];let ir;return n[134]!==un||n[135]!==Vn?(ir=d.jsxs(d.Fragment,{children:[Vn,un]}),n[134]=un,n[135]=Vn,n[136]=ir):ir=n[136],ir});$f.displayName="ForwardRef(Tooltip)";function HTt(t){const e=Ut.c(17),{animate:n,arrowProp:r,arrowRef:i,boundaryElement:o,fallbackPlacements:s,rootBoundary:a}=t;let l;if(e[0]!==n||e[1]!==r||e[2]!==i||e[3]!==o||e[4]!==s||e[5]!==a){l=[];const c=o||void 0;let u;e[7]!==s||e[8]!==a||e[9]!==c?(u=tz({boundary:c,fallbackPlacements:s,padding:zM,rootBoundary:a}),e[7]=s,e[8]=a,e[9]=c,e[10]=u):u=e[10],l.push(u);let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=JV({mainAxis:FTt}),e[11]=f):f=e[11],l.push(f);const h=o||void 0;let p;if(e[12]!==a||e[13]!==h?(p=ez({boundary:h,rootBoundary:a,padding:zM}),e[12]=a,e[13]=h,e[14]=p):p=e[14],l.push(p),r){let m;e[15]!==i?(m=nz({element:i,padding:zM}),e[15]=i,e[16]=m):m=e[16],l.push(m)}n&&l.push(oqe),e[0]=n,e[1]=r,e[2]=i,e[3]=o,e[4]=s,e[5]=a,e[6]=l}else l=e[6];return l}function UTt(t){const e=Ut.c(10),{handleIsOpenChange:n,referenceElement:r,showTooltip:i,isInsideGroup:o}=t;let s;e[0]!==n||e[1]!==r?(s=(u,f)=>{r&&(r===u||u instanceof Node&&r.contains(u)||(n(!1),f()))},e[0]=n,e[1]=r,e[2]=s):s=e[2];const a=uv(s);let l;e[3]!==o||e[4]!==a||e[5]!==i?(l=()=>{if(!i||o)return;const u=f=>{a(f.target,()=>window.removeEventListener("mousemove",u))};return window.addEventListener("mousemove",u),()=>window.removeEventListener("mousemove",u)},e[3]=o,e[4]=a,e[5]=i,e[6]=l):l=e[6];let c;e[7]!==o||e[8]!==i?(c=[o,i],e[7]=o,e[8]=i,e[9]=c):c=e[9],E.useEffect(l,c)}const WTt=de.kbd.withConfig({displayName:"StyledHotkeys",componentId:"sc-b37mge-0"})`font:inherit;padding:1px;&:not([hidden]){display:block;}`,qTt=de(iqe).withConfig({displayName:"Key",componentId:"sc-b37mge-1"})`&:not([hidden]){display:block;}`,pde=E.forwardRef(function(t,e){const n=Ut.c(26);let r,i,o,s,a,l;n[0]!==t?({fontSize:r,keys:i,padding:o,radius:s,space:l,...a}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6]);const c=l===void 0?.5:l;let u;n[7]!==c?(u=fn(c),n[7]=c,n[8]=u):u=n[8];const f=u;if(!i||i.length===0){let g;return n[9]===Symbol.for("react.memo_cache_sentinel")?(g=d.jsx(d.Fragment,{}),n[9]=g):g=n[9],g}let h;if(n[10]!==r||n[11]!==i||n[12]!==o||n[13]!==s){let g;n[15]!==r||n[16]!==o||n[17]!==s?(g=(y,b)=>d.jsx(qTt,{fontSize:r,padding:o,radius:s,children:y},b),n[15]=r,n[16]=o,n[17]=s,n[18]=g):g=n[18],h=i.map(g),n[10]=r,n[11]=i,n[12]=o,n[13]=s,n[14]=h}else h=n[14];let p;n[19]!==f||n[20]!==h?(p=d.jsx(Pr,{as:"span",space:f,children:h}),n[19]=f,n[20]=h,n[21]=p):p=n[21];let m;return n[22]!==e||n[23]!==a||n[24]!==p?(m=d.jsx(WTt,{"data-ui":"Hotkeys",...a,ref:e,children:p}),n[22]=e,n[23]=a,n[24]=p,n[25]=m):m=n[25],m});pde.displayName="ForwardRef(Hotkeys)";const yqe=q7("@sanity/ui/context/menu",null);function GTt(t){return ide(t)&&t.getAttribute("data-disabled")!=="true"||ode(t)&&!t.disabled}function Fx(t){return t.filter(GTt)}function YTt(t,e){const n=[];let r=e;for(;r!==t;){const i=r.parentElement;if(!i)return n;const o=Array.from(i.childNodes).indexOf(r);if(n.unshift(o),i===t)return n;r=i}return n}const s8e=[];function KTt(t,e){if(!t)return;const n=new WeakMap;for(const i of e)n.set(i,YTt(t,i));const r=(i,o)=>{const s=n.get(i)||s8e,a=n.get(o)||s8e,l=Math.max(s.length,a.length);for(let c=0;c{c(j),u.current=j,h(a.current[j]||null)},e[1]=p):p=e[1];const m=p;let g;e[2]!==o?(g=(j,A)=>{if(!j)return ZTt;if(a.current.indexOf(j)===-1&&(a.current.push(j),KTt(o.current,a.current)),A){const D=a.current.indexOf(j);m(D)}return()=>{const D=a.current.indexOf(j);D>-1&&a.current.splice(D,1)}},e[2]=o,e[3]=g):g=e[3];const y=g;let b;e[4]!==n||e[5]!==r?(b=j=>{if(j.key==="Tab"){r&&r.focus();return}if(j.key==="Home"){j.preventDefault(),j.stopPropagation();const A=Fx(a.current)[0];if(!A)return;const D=a.current.indexOf(A);m(D);return}if(j.key==="End"){j.preventDefault(),j.stopPropagation();const A=Fx(a.current),D=A[A.length-1];if(!D)return;const O=a.current.indexOf(D);m(O);return}if(j.key==="ArrowUp"){j.preventDefault(),j.stopPropagation();const A=Fx(a.current),D=A.length;if(D===0)return;const O=a.current[u.current];let P=A.indexOf(O);P=(P-1+D)%D;const $=A[P],M=a.current.indexOf($);m(M);return}if(j.key==="ArrowDown"){j.preventDefault(),j.stopPropagation();const A=Fx(a.current),D=A.length;if(D===0)return;const O=a.current[u.current];let P=A.indexOf(O);P=(P+1)%D;const $=A[P],M=a.current.indexOf($);m(M);return}n&&n(j)},e[4]=n,e[5]=r,e[6]=b):b=e[6];const v=b;let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=j=>{const A=j.currentTarget,D=a.current.indexOf(A);m(D)},e[7]=x):x=e[7];const C=x;let w;e[8]!==o?(w=()=>{m(-2),o.current?.focus()},e[8]=o,e[9]=w):w=e[9];const _=w;let S,k;e[10]!==l||e[11]!==o||e[12]!==i?(S=()=>{if(!o.current)return;const j=requestAnimationFrame(()=>{if(l===-1){if(i==="first"){const A=Fx(a.current)[0];if(A){const D=a.current.indexOf(A);m(D)}}if(i==="last"){const A=Fx(a.current),D=A[A.length-1];if(D){const O=a.current.indexOf(D);m(O)}}return}(a.current[l]||null)?.focus()});return()=>cancelAnimationFrame(j)},k=[l,o,m,i],e[10]=l,e[11]=o,e[12]=i,e[13]=S,e[14]=k):(S=e[13],k=e[14]),E.useEffect(S,k);let I;return e[15]!==f||e[16]!==l||e[17]!==_||e[18]!==v||e[19]!==y?(I={activeElement:f,activeIndex:l,handleItemMouseEnter:C,handleItemMouseLeave:_,handleKeyDown:v,mount:y},e[15]=f,e[16]=l,e[17]=_,e[18]=v,e[19]=y,e[20]=I):I=e[20],I}function ZTt(){}const QTt=de(me).withConfig({displayName:"StyledMenu",componentId:"sc-xt0tnv-0"})`outline:none;overflow:auto;`,dr=E.forwardRef(function(t,e){const n=Ut.c(49);let r,i,o,s,a,l,c,u,f,h,p,m;if(n[0]!==t){const{children:Y,focusFirst:Z,focusLast:ee,onClickOutside:K,onEscape:q,onItemClick:re,onItemSelect:te,onKeyDown:ae,originElement:se,padding:le,registerElement:pe,shouldFocus:be,space:xe,...Ce}=t;i=Y,o=K,s=q,a=re,l=te,c=ae,u=se,p=le,f=pe,r=be,m=xe,h=Ce,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h,n[11]=p,n[12]=m}else r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10],p=n[11],m=n[12];const g=p===void 0?1:p,y=m===void 0?1:m,b=r??(t.focusFirst&&"first"||t.focusLast&&"last"||null),v=E.useRef(null);let x;n[13]===Symbol.for("react.memo_cache_sentinel")?(x=()=>v.current,n[13]=x):x=n[13],E.useImperativeHandle(e,x);const{isTopLayer:C}=Qu();let w;n[14]!==c||n[15]!==u||n[16]!==b?(w={onKeyDown:c,originElement:u,shouldFocus:b,rootElementRef:v},n[14]=c,n[15]=u,n[16]=b,n[17]=w):w=n[17];const{activeElement:_,activeIndex:S,handleItemMouseEnter:k,handleItemMouseLeave:I,handleKeyDown:j,mount:A}=XTt(w),D=E.useRef(null);let O;n[18]!==f?(O=Y=>{D.current&&(D.current(),D.current=null),v.current=Y,v.current&&f&&(D.current=f(v.current))},n[18]=f,n[19]=O):O=n[19];const P=O;let $,M;n[20]!==S||n[21]!==l?($=()=>{l&&l(S)},M=[S,l],n[20]=S,n[21]=l,n[22]=$,n[23]=M):($=n[22],M=n[23]),E.useEffect($,M);let L;n[24]===Symbol.for("react.memo_cache_sentinel")?(L=()=>[v.current],n[24]=L):L=n[24],ho(C&&o,L);let B;n[25]!==C||n[26]!==s?(B=Y=>{C&&Y.key==="Escape"&&(Y.stopPropagation(),s&&s())},n[25]=C,n[26]=s,n[27]=B):B=n[27],Vc(B);let W;n[28]!==_||n[29]!==k||n[30]!==I||n[31]!==A||n[32]!==o||n[33]!==s||n[34]!==a||n[35]!==f?(W={version:2,activeElement:_,mount:A,onClickOutside:o,onEscape:s,onItemClick:a,onItemMouseEnter:k,onItemMouseLeave:I,registerElement:f},n[28]=_,n[29]=k,n[30]=I,n[31]=A,n[32]=o,n[33]=s,n[34]=a,n[35]=f,n[36]=W):W=n[36];const N=W;let V;n[37]!==i||n[38]!==y?(V=d.jsx(ze,{space:y,children:i}),n[37]=i,n[38]=y,n[39]=V):V=n[39];let G;n[40]!==j||n[41]!==P||n[42]!==g||n[43]!==h||n[44]!==V?(G=d.jsx(QTt,{"data-ui":"Menu",...h,onKeyDown:j,padding:g,ref:P,role:"menu",tabIndex:-1,children:V}),n[40]=j,n[41]=P,n[42]=g,n[43]=h,n[44]=V,n[45]=G):G=n[45];let z;return n[46]!==G||n[47]!==N?(z=d.jsx(yqe.Provider,{value:N,children:G}),n[46]=G,n[47]=N,n[48]=z):z=n[48],z});dr.displayName="ForwardRef(Menu)";const go=de.hr.withConfig({displayName:"MenuDivider",componentId:"sc-uhoxwu-0"})`height:1px;border:0;background:var(--card-hairline-soft-color);margin:0;`;go.displayName="MenuDivider";function JTt(){return st` + background-color: inherit; + color: inherit; + + &[data-as='button'] { + -webkit-font-smoothing: inherit; + appearance: none; + outline: none; + font: inherit; + text-align: inherit; + border: 0; + width: -moz-available; + width: -webkit-fill-available; + width: stretch; + } + + /* &:is(a) */ + &[data-as='a'] { + text-decoration: none; + } + `}function eIt(t){const{$tone:e}=t,{color:n,style:r}=Jt(t.theme),i=n.selectable[e];return st` + ${Ua(n,i.enabled)} + + background-color: var(--card-bg-color); + color: var(--card-fg-color); + outline: none; + + /* &:is(button) */ + &[data-as='button'] { + &:disabled { + ${Ua(n,i.disabled)} + } + + &:not(:disabled) { + &[aria-pressed='true'] { + ${Ua(n,i.pressed)} + } + + &[data-selected], + &[aria-selected='true'] > & { + ${Ua(n,i.selected)} + } + + @media (hover: hover) { + &:not([data-selected]) { + &[data-hovered], + &:hover { + ${Ua(n,i.hovered)} + } + + &:active { + ${Ua(n,i.pressed)} + } + } + } + } + } + + /* &:is(a) */ + &[data-as='a'] { + &[data-disabled] { + ${Ua(n,i.disabled)} + } + + &:not([data-disabled]) { + &[data-pressed] { + ${Ua(n,i.pressed)} + } + + &[data-selected] { + ${Ua(n,i.selected)} + } + + @media (hover: hover) { + &:not([data-selected]) { + &[data-hovered], + &:hover { + ${Ua(n,i.hovered)} + } + &:active { + ${Ua(n,i.pressed)} + } + } + } + } + } + + ${r?.card?.root} + `}const mde=de(me).withConfig({displayName:"Selectable",componentId:"sc-1w01ang-0"})(K7,JTt,eIt);mde.displayName="Selectable";function bqe(){const t=E.useContext(yqe);if(!t)throw new Error("useMenu(): missing context value");if(!cR(t)||t.version!==2)throw new Error("useMenu(): the context value is not compatible");return t}function gde(t){const e=Ut.c(81);let n,r,i,o,s,a,l,c,u,f,h,p,m;e[0]!==t?({as:l,children:r,fontSize:c,icon:n,menu:i,onClick:o,padding:u,popover:s,radius:f,space:h,text:m,tone:p,...a}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=o,e[5]=s,e[6]=a,e[7]=l,e[8]=c,e[9]=u,e[10]=f,e[11]=h,e[12]=p,e[13]=m):(n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],u=e[9],f=e[10],h=e[11],p=e[12],m=e[13]);const g=l===void 0?"button":l,y=c===void 0?1:c,b=u===void 0?3:u,v=f===void 0?2:f,x=h===void 0?3:h,C=p===void 0?"default":p,w=bqe(),{scheme:_}=H8(),{activeElement:S,mount:k,onClickOutside:I,onEscape:j,onItemClick:A,onItemMouseEnter:D,registerElement:O}=w,P=D??w.onItemMouseEnter,[$,M]=E.useState(null),[L,B]=E.useState(!1),[W,N]=E.useState(null),V=!!S&&S===$,[G,z]=E.useState(!1);let Y;e[14]!==P?(Y=tt=>{z(!1),P(tt),B(!0)},e[14]=P,e[15]=Y):Y=e[15];const Z=Y;let ee;e[16]!==$?(ee=tt=>{tt.key==="ArrowLeft"&&(tt.stopPropagation(),B(!1),requestAnimationFrame(()=>{$?.focus()}))},e[16]=$,e[17]=ee):ee=e[17];const K=ee;let q;e[18]!==o?(q=tt=>{o?.(tt),N("first"),B(!0)},e[18]=o,e[19]=q):q=e[19];const re=q;let te;e[20]!==A?(te=()=>{B(!1),A?.()},e[20]=A,e[21]=te):te=e[21];const ae=te;let se;e[22]===Symbol.for("react.memo_cache_sentinel")?(se=()=>z(!0),e[22]=se):se=e[22];const le=se;let pe,be;e[23]!==k||e[24]!==$?(pe=()=>k($),be=[k,$],e[23]=k,e[24]=$,e[25]=pe,e[26]=be):(pe=e[25],be=e[26]),E.useEffect(pe,be);let xe,Ce;e[27]!==V?(xe=()=>{V||B(!1)},Ce=[V],e[27]=V,e[28]=xe,e[29]=Ce):(xe=e[28],Ce=e[29]),E.useEffect(xe,Ce);let Te,_e;e[30]!==L?(Te=()=>{L||z(!1)},_e=[L],e[30]=L,e[31]=Te,e[32]=_e):(Te=e[31],_e=e[32]),E.useEffect(Te,_e);let Ie,ye;e[33]!==W?(Ie=()=>{if(!W)return;const tt=requestAnimationFrame(()=>N(null));return()=>cancelAnimationFrame(tt)},ye=[W],e[33]=W,e[34]=Ie,e[35]=ye):(Ie=e[34],ye=e[35]),E.useEffect(Ie,ye);let fe;e[36]!==r||e[37]!==ae||e[38]!==K||e[39]!==i||e[40]!==I||e[41]!==j||e[42]!==O||e[43]!==W?(fe=d.jsx(dr,{...i,onClickOutside:I,onEscape:j,onItemClick:ae,onKeyDown:K,onMouseEnter:le,registerElement:O,shouldFocus:W,children:r}),e[36]=r,e[37]=ae,e[38]=K,e[39]=i,e[40]=I,e[41]=j,e[42]=O,e[43]=W,e[44]=fe):fe=e[44];const ve=fe;let Se;e[45]===Symbol.for("react.memo_cache_sentinel")?(Se=tt=>{const ot=tt.currentTarget;if(document.activeElement===ot&&tt.key==="ArrowRight"){N("first"),B(!0),z(!0);return}},e[45]=Se):Se=e[45];const Ee=Se,je=g==="button"?G:void 0,Me=g!=="button"?G:void 0,Fe=!G&&V?"":void 0;let $e;e[46]!==v?($e=fn(v),e[46]=v,e[47]=$e):$e=e[47];const Ye=g==="button"?"button":void 0;let qe;e[48]!==n||e[49]!==y?(qe=n&&d.jsxs(oe,{size:y,children:[E.isValidElement(n)&&n,ma.isValidElementType(n)&&d.jsx(n,{})]}),e[48]=n,e[49]=y,e[50]=qe):qe=e[50];let He;e[51]!==y||e[52]!==m?(He=d.jsx(me,{flex:1,children:d.jsx(oe,{size:y,textOverflow:"ellipsis",weight:"medium",children:m})}),e[51]=y,e[52]=m,e[53]=He):He=e[53];let Ge;e[54]===Symbol.for("react.memo_cache_sentinel")?(Ge=d.jsx(wd,{}),e[54]=Ge):Ge=e[54];let Ze;e[55]!==y?(Ze=d.jsx(oe,{size:y,children:Ge}),e[55]=y,e[56]=Ze):Ze=e[56];let nt;e[57]!==b||e[58]!==x||e[59]!==qe||e[60]!==He||e[61]!==Ze?(nt=d.jsxs(ge,{gap:x,padding:b,children:[qe,He,Ze]}),e[57]=b,e[58]=x,e[59]=qe,e[60]=He,e[61]=Ze,e[62]=nt):nt=e[62];let Le;e[63]!==g||e[64]!==re||e[65]!==Z||e[66]!==a||e[67]!==_||e[68]!==je||e[69]!==Me||e[70]!==Fe||e[71]!==$e||e[72]!==Ye||e[73]!==nt||e[74]!==C?(Le=d.jsx(mde,{"data-as":g,"data-ui":"MenuGroup",forwardedAs:g,...a,"aria-pressed":je,"data-pressed":Me,"data-selected":Fe,$radius:$e,$tone:C,$scheme:_,onClick:re,onKeyDown:Ee,onMouseEnter:Z,ref:M,tabIndex:-1,type:Ye,children:nt}),e[63]=g,e[64]=re,e[65]=Z,e[66]=a,e[67]=_,e[68]=je,e[69]=Me,e[70]=Fe,e[71]=$e,e[72]=Ye,e[73]=nt,e[74]=C,e[75]=Le):Le=e[75];let Ne;return e[76]!==ve||e[77]!==L||e[78]!==s||e[79]!==Le?(Ne=d.jsx(Ng,{...s,content:ve,"data-ui":"MenuGroup__popover",open:L,children:Le}),e[76]=ve,e[77]=L,e[78]=s,e[79]=Le,e[80]=Ne):Ne=e[80],Ne}gde.displayName="MenuGroup";const Wl=E.forwardRef(function(t,e){const n=Ut.c(75);let r,i,o,s,a,l,c,u,f,h,p,m,g,y,b,v,x,C,w,_,S,k;n[0]!==t?({as:v,children:o,disabled:s,fontSize:x,hotkeys:a,icon:r,iconRight:i,onClick:l,padding:C,paddingX:p,paddingY:m,paddingTop:h,paddingRight:f,paddingBottom:c,paddingLeft:u,pressed:g,radius:w,selected:b,space:_,text:k,tone:S,...y}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h,n[11]=p,n[12]=m,n[13]=g,n[14]=y,n[15]=b,n[16]=v,n[17]=x,n[18]=C,n[19]=w,n[20]=_,n[21]=S,n[22]=k):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10],p=n[11],m=n[12],g=n[13],y=n[14],b=n[15],v=n[16],x=n[17],C=n[18],w=n[19],_=n[20],S=n[21],k=n[22]);const I=v===void 0?"button":v,j=x===void 0?1:x,A=C===void 0?3:C,D=w===void 0?2:w,O=_===void 0?3:_,P=S===void 0?"default":S,{scheme:$}=H8(),M=bqe(),{activeElement:L,mount:B,onItemClick:W,onItemMouseEnter:N,onItemMouseLeave:V}=M,G=N??M.onItemMouseEnter,z=V??M.onItemMouseLeave,[Y,Z]=E.useState(null),ee=!!L&&L===Y,K=E.useRef(null);let q;n[23]===Symbol.for("react.memo_cache_sentinel")?(q=()=>K.current,n[23]=q):q=n[23],E.useImperativeHandle(e,q);let re,te;n[24]!==B||n[25]!==Y||n[26]!==b?(re=()=>B(Y,b),te=[B,Y,b],n[24]=B,n[25]=Y,n[26]=b,n[27]=re,n[28]=te):(re=n[27],te=n[28]),E.useEffect(re,te);let ae;n[29]!==s||n[30]!==l||n[31]!==W?(ae=$e=>{s||(l&&l($e),W&&W())},n[29]=s,n[30]=l,n[31]=W,n[32]=ae):ae=n[32];const se=ae;let le;n[33]!==A||n[34]!==c||n[35]!==u||n[36]!==f||n[37]!==h||n[38]!==p||n[39]!==m?(le={padding:A,paddingX:p,paddingY:m,paddingTop:h,paddingRight:f,paddingBottom:c,paddingLeft:u},n[33]=A,n[34]=c,n[35]=u,n[36]=f,n[37]=h,n[38]=p,n[39]=m,n[40]=le):le=n[40];const pe=le;let be;n[41]!==j?(be=fn(j).map(tIt),n[41]=j,n[42]=be):be=n[42];const xe=be;let Ce;n[43]===Symbol.for("react.memo_cache_sentinel")?(Ce=$e=>{K.current=$e,Z($e)},n[43]=Ce):Ce=n[43];const Te=Ce,_e=I!=="button"&&g?"":void 0,Ie=ee?"":void 0,ye=s?"":void 0;let fe;n[44]!==D?(fe=fn(D),n[44]=D,n[45]=fe):fe=n[45];let ve;n[46]===Symbol.for("react.memo_cache_sentinel")?(ve=fn(0),n[46]=ve):ve=n[46];const Se=s?"default":P,Ee=I==="button"?"button":void 0;let je;n[47]!==r||n[48]!==i||n[49]!==j||n[50]!==a||n[51]!==xe||n[52]!==pe||n[53]!==O||n[54]!==k?(je=(r||k||i)&&d.jsxs(ge,{as:"span",gap:O,align:"center",...pe,children:[r&&d.jsxs(oe,{size:j,children:[E.isValidElement(r)&&r,ma.isValidElementType(r)&&d.jsx(r,{})]}),k&&d.jsx(me,{flex:1,children:d.jsx(oe,{size:j,textOverflow:"ellipsis",weight:"medium",children:k})}),a&&d.jsx(pde,{fontSize:xe,keys:a,style:{marginTop:-4,marginBottom:-4}}),i&&d.jsxs(oe,{size:j,children:[E.isValidElement(i)&&i,ma.isValidElementType(i)&&d.jsx(i,{})]})]}),n[47]=r,n[48]=i,n[49]=j,n[50]=a,n[51]=xe,n[52]=pe,n[53]=O,n[54]=k,n[55]=je):je=n[55];let Me;n[56]!==o||n[57]!==pe?(Me=o&&d.jsx(me,{as:"span",...pe,children:o}),n[56]=o,n[57]=pe,n[58]=Me):Me=n[58];let Fe;return n[59]!==I||n[60]!==s||n[61]!==se||n[62]!==G||n[63]!==z||n[64]!==y||n[65]!==$||n[66]!==_e||n[67]!==Ie||n[68]!==ye||n[69]!==fe||n[70]!==Se||n[71]!==Ee||n[72]!==je||n[73]!==Me?(Fe=d.jsxs(mde,{"data-ui":"MenuItem",role:"menuitem",...y,"data-pressed":_e,"data-selected":Ie,"data-disabled":ye,forwardedAs:I,$radius:fe,$padding:ve,$tone:Se,$scheme:$,disabled:s,onClick:se,onMouseEnter:G,onMouseLeave:z,ref:Te,tabIndex:-1,type:Ee,children:[je,Me]}),n[59]=I,n[60]=s,n[61]=se,n[62]=G,n[63]=z,n[64]=y,n[65]=$,n[66]=_e,n[67]=Ie,n[68]=ye,n[69]=fe,n[70]=Se,n[71]=Ee,n[72]=je,n[73]=Me,n[74]=Fe):Fe=n[74],Fe});Wl.displayName="ForwardRef(MenuItem)";function tIt(t){return t-1}const nIt=de(vn).withConfig({displayName:"CustomButton",componentId:"sc-1kns779-0"})`max-width:100%;`,Cj=E.forwardRef(function(t,e){const n=Ut.c(30);let r,i,o,s,a,l,c,u,f,h;n[0]!==t?({icon:i,id:o,focused:r,fontSize:f,label:s,onClick:a,onFocus:l,padding:h,selected:u,...c}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10]);const p=f===void 0?1:f,m=h===void 0?2:h,g=E.useRef(null),y=E.useRef(!1);let b;n[11]===Symbol.for("react.memo_cache_sentinel")?(b=()=>g.current,n[11]=b):b=n[11],E.useImperativeHandle(e,b);let v;n[12]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{y.current=!1},n[12]=v):v=n[12];const x=v;let C;n[13]!==l?(C=A=>{y.current=!0,l&&l(A)},n[13]=l,n[14]=C):C=n[14];const w=C;let _,S;n[15]!==r?(_=()=>{r&&!y.current&&(g.current&&g.current.focus(),y.current=!0)},S=[r],n[15]=r,n[16]=_,n[17]=S):(_=n[16],S=n[17]),E.useEffect(_,S);const k=u?"true":"false",I=u?0:-1;let j;return n[18]!==p||n[19]!==w||n[20]!==i||n[21]!==o||n[22]!==s||n[23]!==a||n[24]!==m||n[25]!==c||n[26]!==u||n[27]!==k||n[28]!==I?(j=d.jsx(nIt,{"data-ui":"Tab",...c,"aria-selected":k,fontSize:p,icon:i,id:o,mode:"bleed",onClick:a,onBlur:x,onFocus:w,padding:m,ref:g,role:"tab",selected:u,tabIndex:I,text:s,type:"button"}),n[18]=p,n[19]=w,n[20]=i,n[21]=o,n[22]=s,n[23]=a,n[24]=m,n[25]=c,n[26]=u,n[27]=k,n[28]=I,n[29]=j):j=n[29],j});Cj.displayName="ForwardRef(Tab)";const rIt=de(Pr).withConfig({displayName:"CustomInline",componentId:"sc-5cm04m-0"})`& > div{display:inline-block;vertical-align:middle;max-width:100%;box-sizing:border-box;}`,Bg=E.forwardRef(function(t,e){const n=Ut.c(15);let r,i;n[0]!==t?({children:r,...i}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]);const[o,s]=E.useState(-1);let a;if(n[3]!==r||n[4]!==o){const p=E.Children.toArray(r).filter(E.isValidElement);let m;n[6]!==o?(m=(g,y)=>E.cloneElement(g,{focused:o===y,key:y,onFocus:()=>s(y)}),n[6]=o,n[7]=m):m=n[7],a=p.map(m),n[3]=r,n[4]=o,n[5]=a}else a=n[5];const l=a,c=l.length;let u;n[8]!==c?(u=p=>{p.key==="ArrowLeft"&&s(m=>(m+c-1)%c),p.key==="ArrowRight"&&s(m=>(m+1)%c)},n[8]=c,n[9]=u):u=n[9];const f=u;let h;return n[10]!==f||n[11]!==e||n[12]!==i||n[13]!==l?(h=d.jsx(rIt,{"data-ui":"TabList",...i,onKeyDown:f,ref:e,role:"tablist",children:l}),n[10]=f,n[11]=e,n[12]=i,n[13]=l,n[14]=h):h=n[14],h});Bg.displayName="ForwardRef(TabList)";function zie(t){const e=requestAnimationFrame(t);return()=>{cancelAnimationFrame(e)}}function iIt(t){let e=null;const n=zie(()=>{e=zie(t)});return()=>{e&&e(),n()}}function oIt(t){return!!document.activeElement&&t.contains(document.activeElement)}function sIt(t){return t.tabIndex>0||t.tabIndex===0&&t.getAttribute("tabIndex")!==null?!0:ide(t)?!!t.href&&t.rel!=="ignore":B_t(t)?t.type!=="hidden"&&t.type!=="file"&&!t.disabled:ode(t)||V_t(t)||z_t(t)?!t.disabled:!1}function vqe(t){if(!sIt(t))return!1;try{t.focus()}catch{}return document.activeElement===t}function m8(t){for(let e=0;e=0;e--){const n=t.childNodes[e];if(Fg(n)&&(vqe(n)||yde(n)))return!0}return!1}function bP(t,e){const n=Ut.c(3);let r;return n[0]!==e||n[1]!==t?(r=fn(t,e),n[0]=e,n[1]=t,n[2]=r):r=n[2],r}function a8e(t,e){const n=[t];for(const r of e)Array.isArray(r)?n.push(...r):n.push(r);return n.filter(Boolean)}function aIt(t,e,n){const r=Ut.c(12),i=e===void 0?uS:e,[o,s]=E.useState(null);let a;r[0]!==o||r[1]!==i?(a=()=>a8e(o,i),r[0]=o,r[1]=i,r[2]=a):a=r[2];const[l,c]=E.useState(a),u=E.useRef(l);let f,h;r[3]!==o||r[4]!==i?(f=()=>{const g=u.current,y=a8e(o,i);if(g.length!==y.length){c(y),u.current=y;return}for(const b of g)if(!y.includes(b)){c(y),u.current=y;return}for(const b of y)if(!g.includes(b)){c(y),u.current=y;return}},h=[o,i],r[3]=o,r[4]=i,r[5]=f,r[6]=h):(f=r[5],h=r[6]),E.useEffect(f,h);let p,m;return r[7]!==n||r[8]!==l||r[9]!==t?(p=()=>{if(!t)return;const g=y=>{const b=y.target;if(b instanceof Node){for(const v of l)if(b===v||v.contains(b))return;t(y)}};return window.addEventListener("mousedown",g),()=>{window.removeEventListener("mousedown",g)}},m=[n,t,l],r[7]=n,r[8]=l,r[9]=t,r[10]=p,r[11]=m):(p=r[10],m=r[11]),E.useEffect(p,m),s}function Qw(t){return fS(t)?._contentRect||null}let xqe=class extends E.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,n){this.props.onCatch({error:e,info:n})}render(){const{error:e}=this.state;if(e){const n=typeof e?.message=="string"?e.message:"Error";return d.jsx(zu,{children:n})}return this.props.children}};const lIt=de.div.withConfig({displayName:"StyledAutocomplete",componentId:"sc-1igauft-0"})`line-height:0;`,cIt=de(me).withConfig({displayName:"ListBox",componentId:"sc-1igauft-1"})`& > ul{list-style:none;padding:0;margin:0;}`,uIt=Vf` + from { + transform: rotate(0deg); + } + + to { + transform: rotate(360deg); + } +`,dIt=de(H7).withConfig({displayName:"AnimatedSpinnerIcon",componentId:"sc-1igauft-2"})`animation:${uIt} 500ms linear infinite;`;function fIt(t){const e=Ut.c(11),{children:n,id:r,onSelect:i,selected:o,value:s}=t;let a;e[0]!==i||e[1]!==s?(a=()=>{setTimeout(()=>{i(s)},0)},e[0]=i,e[1]=s,e[2]=a):a=e[2];const l=a;let c;e[3]!==l?(c=h=>{h.key==="Enter"&&!N_t(h.currentTarget)&&l()},e[3]=l,e[4]=c):c=e[4];const u=c;let f;return e[5]!==n||e[6]!==l||e[7]!==u||e[8]!==r||e[9]!==o?(f=d.jsx("li",{"aria-selected":o,"data-ui":"AutocompleteOption",id:r,role:"option",onClick:l,onKeyDown:u,children:n}),e[5]=n,e[6]=l,e[7]=u,e[8]=r,e[9]=o,e[10]=f):f=e[10],f}function hIt(t,e){return e.type==="input/change"?{...t,activeValue:null,focused:!0,query:e.query}:e.type==="input/focus"?{...t,focused:!0}:e.type==="root/blur"?{...t,focused:!1,query:null}:e.type==="root/clear"?{...t,activeValue:null,query:null,value:null}:e.type==="root/escape"?{...t,focused:!1,query:null}:e.type==="root/open"?{...t,query:t.query||e.query}:e.type==="root/setActiveValue"?{...t,activeValue:e.value,listFocused:e.listFocused||t.listFocused}:e.type==="root/setListFocused"?{...t,listFocused:e.listFocused}:e.type==="value/change"?{...t,activeValue:e.value,query:null,value:e.value}:t}const pIt=["Control","Shift","Alt","Enter","Home","End","PageUp","PageDown","Meta","Tab","CapsLock"],mIt="bottom-start",gIt=["bottom-start","top-start"],yIt=(t,e)=>e?e.value:t,bIt=(t,e)=>e.value.toLowerCase().indexOf(t.toLowerCase())>-1,Cqe=E.forwardRef(function(t,e){const n=Ut.c(181);let r,i,o,s,a,l,c,u,f,h,p,m,g,y,b,v,x,C,w,_,S,k,I,j,A,D,O,P,$;n[0]!==t?({border:k,customValidity:r,disabled:i,filterOption:o,fontSize:I,icon:s,id:a,listBox:j,loading:l,onBlur:c,onChange:u,onFocus:f,onQueryChange:h,onSelect:p,openButton:m,openOnFocus:g,options:y,padding:A,popover:D,prefix:b,radius:O,readOnly:v,relatedElements:x,renderOption:C,renderPopover:w,renderValue:P,suffix:S,value:$,..._}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h,n[11]=p,n[12]=m,n[13]=g,n[14]=y,n[15]=b,n[16]=v,n[17]=x,n[18]=C,n[19]=w,n[20]=_,n[21]=S,n[22]=k,n[23]=I,n[24]=j,n[25]=A,n[26]=D,n[27]=O,n[28]=P,n[29]=$):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10],p=n[11],m=n[12],g=n[13],y=n[14],b=n[15],v=n[16],x=n[17],C=n[18],w=n[19],_=n[20],S=n[21],k=n[22],I=n[23],j=n[24],A=n[25],D=n[26],O=n[27],P=n[28],$=n[29]);const M=k===void 0?!0:k,L=I===void 0?2:I,B=j===void 0?r8:j,W=A===void 0?3:A,N=D===void 0?r8:D,V=O===void 0?2:O,G=P===void 0?yIt:P,z=$||null,Y=$||null;let Z;n[30]!==z||n[31]!==Y?(Z={activeValue:z,focused:!1,listFocused:!1,query:null,value:Y},n[30]=z,n[31]=Y,n[32]=Z):Z=n[32];const[ee,K]=E.useReducer(hIt,Z),{activeValue:q,focused:re,listFocused:te,query:ae,value:se}=ee;let le;n[33]!==L||n[34]!==W?(le=ln=>{const{value:wr}=ln;return d.jsx(Be,{"data-as":"button",padding:W,radius:2,tone:"inherit",children:d.jsx(oe,{size:L,textOverflow:"ellipsis",children:wr})})},n[33]=L,n[34]=W,n[35]=le):le=n[35];const pe=typeof C=="function"?C:le,be=typeof o=="function"?o:bIt,xe=E.useRef(null),Ce=E.useRef(null),Te=E.useRef(null),_e=E.useRef(null),[Ie,ye]=E.useState(null);let fe;n[36]===Symbol.for("react.memo_cache_sentinel")?(fe=ln=>{E.startTransition(()=>ye(ln))},n[36]=fe):fe=n[36];const ve=fe,Se=E.useRef(!1),Ee=E.useRef(se),je=E.useRef($),Me=E.useRef(!1);let Fe,$e;n[37]!==Ie?(Fe=()=>Ie,$e=[Ie],n[37]=Ie,n[38]=Fe,n[39]=$e):(Fe=n[38],$e=n[39]),E.useImperativeHandle(Te,Fe,$e);let Ye,qe;n[40]!==Ie?(Ye=()=>Ie,qe=[Ie],n[40]=Ie,n[41]=Ye,n[42]=qe):(Ye=n[41],qe=n[42]),E.useImperativeHandle(e,Ye,qe);const He=`${a}-listbox`,Ge=Array.isArray(y)?y:uS,Ze=fn(W);let nt;n[43]!==Ge||n[44]!==se?(nt=se!==null?Ge.find(ln=>ln.value===se):void 0,n[43]=Ge,n[44]=se,n[45]=nt):nt=n[45];const Le=nt;let Ne;if(n[46]!==be||n[47]!==Ge||n[48]!==ae){let ln;n[50]!==be||n[51]!==ae?(ln=wr=>ae?be(ae,wr):!0,n[50]=be,n[51]=ae,n[52]=ln):ln=n[52],Ne=Ge.filter(ln),n[46]=be,n[47]=Ge,n[48]=ae,n[49]=Ne}else Ne=n[49];const tt=Ne,ot=tt.length,rt=q?`${a}-option-${q}`:void 0,dt=ae!==null&&l||re&&ae!==null;let mt;n[53]!==c||n[54]!==h||n[55]!==x?(mt=ln=>{setTimeout(()=>{if(Me.current)return;const wr=(x||[]).concat(xe.current?[xe.current]:[],Ce.current?[Ce.current]:[]);let sr=!1;if(document.activeElement){for(const vr of wr)if(vr===document.activeElement||vr.contains(document.activeElement)){sr=!0;break}}sr===!1&&(K({type:"root/blur"}),Me.current=!1,h&&h(null),c&&c(ln))},0)},n[53]=c,n[54]=h,n[55]=x,n[56]=mt):mt=n[56];const ht=mt;let ft;n[57]===Symbol.for("react.memo_cache_sentinel")?(ft=ln=>{const wr=_e.current,sr=ln.target instanceof HTMLElement?ln.target:null,vr=wr?.contains(sr)||!1;vr!==Se.current&&(Se.current=vr,K({type:"root/setListFocused",listFocused:vr}))},n[57]=ft):ft=n[57];const at=ft;let et;n[58]!==u||n[59]!==h||n[60]!==p?(et=ln=>{K({type:"value/change",value:ln}),Me.current=!1,p&&p(ln),Ee.current=ln,u&&u(ln),h&&h(null),Te.current?.focus()},n[58]=u,n[59]=h,n[60]=p,n[61]=et):et=n[61];const xt=et;let lt;n[62]!==q||n[63]!==tt||n[64]!==ot||n[65]!==h?(lt=ln=>{if(ln.key==="ArrowDown"){if(ln.preventDefault(),!ot)return;const vr=tt.find(bl=>bl.value===q),kr=vr?tt.indexOf(vr):-1,ri=tt[(kr+1)%ot];ri&&K({type:"root/setActiveValue",value:ri.value,listFocused:!0});return}if(ln.key==="ArrowUp"){if(ln.preventDefault(),!ot)return;const vr=tt.find(bl=>bl.value===q),kr=vr?tt.indexOf(vr):-1,ri=tt[kr===-1?ot-1:(ot+kr-1)%ot];ri&&K({type:"root/setActiveValue",value:ri.value,listFocused:!0});return}if(ln.key==="Escape"){K({type:"root/escape"}),Me.current=!1,h&&h(null),Te.current?.focus();return}const wr=ln.target,sr=_e.current;if((sr===wr||sr?.contains(wr))&&!pIt.includes(ln.key)){Te.current?.focus();return}},n[62]=q,n[63]=tt,n[64]=ot,n[65]=h,n[66]=lt):lt=n[66];const Ct=lt;let Dt;n[67]!==h?(Dt=ln=>{const wr=ln.currentTarget.value;K({type:"input/change",query:wr}),h&&h(wr)},n[67]=h,n[68]=Dt):Dt=n[68];const Ot=Dt;let Rt;n[69]!==Le||n[70]!==G||n[71]!==se?(Rt=()=>{K({type:"root/open",query:se?G(se,Le):""})},n[69]=Le,n[70]=G,n[71]=se,n[72]=Rt):Rt=n[72];const Nt=Rt;let Mt;n[73]!==Nt||n[74]!==re||n[75]!==f||n[76]!==g?(Mt=ln=>{re||(K({type:"input/focus"}),f&&f(ln),g&&Nt())},n[73]=Nt,n[74]=re,n[75]=f,n[76]=g,n[77]=Mt):Mt=n[77];const Gt=Mt;let en;n[78]===Symbol.for("react.memo_cache_sentinel")?(en=()=>{Me.current=!0},n[78]=en):en=n[78];const Yt=en;let zt;n[79]===Symbol.for("react.memo_cache_sentinel")?(zt=()=>{Me.current=!1},n[79]=zt):zt=n[79];const jt=zt;let un;n[80]!==u||n[81]!==h?(un=()=>{K({type:"root/clear"}),Ee.current="",u&&u(""),h&&h(null),Te.current?.focus()},n[80]=u,n[81]=h,n[82]=un):un=n[82];const yn=un;let bn;n[83]===Symbol.for("react.memo_cache_sentinel")?(bn=()=>{K({type:"input/focus"})},n[83]=bn):bn=n[83];const In=bn;let Jn,gn;n[84]!==$?(Jn=()=>{if($!==je.current){je.current=$,$!==void 0&&(K({type:"value/change",value:$}),Ee.current=$);return}$!==Ee.current&&(Ee.current=$||null,K({type:"value/change",value:$||null}))},gn=[$],n[84]=$,n[85]=Jn,n[86]=gn):(Jn=n[85],gn=n[86]),E.useEffect(Jn,gn);let gt,_n;n[87]!==re?(gt=()=>{!re&&Ee.current&&K({type:"root/setActiveValue",value:Ee.current})},_n=[re],n[87]=re,n[88]=gt,n[89]=_n):(gt=n[88],_n=n[89]),E.useEffect(gt,_n);let Xt,An;n[90]!==q||n[91]!==tt?(Xt=()=>{const ln=_e.current;if(!ln)return;const wr=tt.find(sr=>sr.value===q);if(wr){const sr=tt.indexOf(wr),vr=ln.childNodes[sr];if(vr){if(oIt(vr))return;m8(vr)}}},An=[q,tt],n[90]=q,n[91]=tt,n[92]=Xt,n[93]=An):(Xt=n[92],An=n[93]),E.useEffect(Xt,An);let Bn;e:{if(!l&&!i&&se){let ln;n[94]===Symbol.for("react.memo_cache_sentinel")?(ln={"aria-label":"Clear",onFocus:In},n[94]=ln):ln=n[94],Bn=ln;break e}Bn=void 0}const Vn=Bn,ir=Ze.map(xIt),rn=Ze.map(CIt),Pn=typeof m=="object"?m:r8;let er;n[95]!==Nt||n[96]!==Pn?(er=ln=>{Nt(),Pn.onClick&&Pn.onClick(ln),zie(()=>Te.current?.focus())},n[95]=Nt,n[96]=Pn,n[97]=er):er=n[97];const jr=er;let fi;n[98]!==i||n[99]!==dt||n[100]!==L||n[101]!==jr||n[102]!==m||n[103]!==ir||n[104]!==rn||n[105]!==Pn||n[106]!==v?(fi=!i&&!v&&m?d.jsx(me,{"aria-hidden":dt,padding:ir,children:d.jsx(vn,{"aria-label":"Open",disabled:dt,fontSize:L,icon:Ts,mode:"bleed",padding:rn,...Pn,onClick:jr})}):void 0,n[98]=i,n[99]=dt,n[100]=L,n[101]=jr,n[102]=m,n[103]=ir,n[104]=rn,n[105]=Pn,n[106]=v,n[107]=fi):fi=n[107];const bi=fi;let Ti;e:{if(ae===null){if(se!==null){let ln;n[108]!==Le||n[109]!==G||n[110]!==se?(ln=G(se,Le),n[108]=Le,n[109]=G,n[110]=se,n[111]=ln):ln=n[111],Ti=ln;break e}Ti="";break e}Ti=ae}const nr=Ti;let En;n[112]!==te?(En=ln=>{ln.key==="Tab"&&te&&Te.current?.focus()},n[112]=te,n[113]=En):En=n[113];const lr=En;let ti;e:{if(tt.length===0){ti=null;break e}let ln;if(n[114]!==q||n[115]!==Le||n[116]!==tt||n[117]!==xt||n[118]!==a||n[119]!==te||n[120]!==l||n[121]!==pe){let vr;n[123]!==q||n[124]!==Le||n[125]!==xt||n[126]!==a||n[127]!==te||n[128]!==l||n[129]!==pe?(vr=kr=>{const ri=q!==null?kr.value===q:Le===kr;return d.jsx(fIt,{id:`${a}-option-${kr.value}`,onSelect:xt,selected:ri,value:kr.value,children:E.cloneElement(pe(kr),{disabled:l,selected:ri,tabIndex:te&&ri?0:-1})},kr.value)},n[123]=q,n[124]=Le,n[125]=xt,n[126]=a,n[127]=te,n[128]=l,n[129]=pe,n[130]=vr):vr=n[130],ln=tt.map(vr),n[114]=q,n[115]=Le,n[116]=tt,n[117]=xt,n[118]=a,n[119]=te,n[120]=l,n[121]=pe,n[122]=ln}else ln=n[122];let wr;n[131]!==He||n[132]!==ln?(wr=d.jsx(ze,{as:"ul","aria-multiselectable":!1,"data-ui":"AutoComplete__resultsList",id:He,ref:_e,role:"listbox",space:1,children:ln}),n[131]=He,n[132]=ln,n[133]=wr):wr=n[133];let sr;n[134]!==lr||n[135]!==B||n[136]!==wr?(sr=d.jsx(cIt,{"data-ui":"AutoComplete__results",onKeyDown:lr,padding:1,...B,tabIndex:-1,children:wr}),n[134]=lr,n[135]=B,n[136]=wr,n[137]=sr):sr=n[137],ti=sr}const Br=ti;let ni;e:{if(w){const wr=!dt;let sr;n[138]!==Br||n[139]!==Yt||n[140]!==jt||n[141]!==Ie||n[142]!==w||n[143]!==wr?(sr=d.jsx(vIt,{content:Br,hidden:wr,inputElement:Ie,onMouseEnter:Yt,onMouseLeave:jt,resultsPopoverElementRef:Ce,renderPopover:w}),n[138]=Br,n[139]=Yt,n[140]=jt,n[141]=Ie,n[142]=w,n[143]=wr,n[144]=sr):sr=n[144],ni=sr;break e}if(ot===0){ni=null;break e}let ln;n[145]!==Br||n[146]!==dt||n[147]!==Yt||n[148]!==jt||n[149]!==Ie||n[150]!==N||n[151]!==V?(ln=d.jsx(Ng,{arrow:!1,constrainSize:!0,content:Br,fallbackPlacements:gIt,matchReferenceWidth:!0,onMouseEnter:Yt,onMouseLeave:jt,open:dt,overflow:"auto",placement:mIt,portal:!0,radius:V,ref:Ce,referenceElement:Ie,...N}),n[145]=Br,n[146]=dt,n[147]=Yt,n[148]=jt,n[149]=Ie,n[150]=N,n[151]=V,n[152]=ln):ln=n[152],ni=ln}const Eo=ni,is=l&&dIt,Fo=S||bi;let Cr;n[153]!==rt||n[154]!==M||n[155]!==Vn||n[156]!==r||n[157]!==i||n[158]!==dt||n[159]!==L||n[160]!==yn||n[161]!==Ot||n[162]!==Gt||n[163]!==s||n[164]!==a||n[165]!==nr||n[166]!==He||n[167]!==Ze||n[168]!==b||n[169]!==V||n[170]!==v||n[171]!==_||n[172]!==is||n[173]!==Fo?(Cr=d.jsx(Ls,{..._,"aria-activedescendant":rt,"aria-autocomplete":"list","aria-expanded":dt,"aria-owns":He,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",border:M,clearButton:Vn,customValidity:r,disabled:i,fontSize:L,icon:s,iconRight:is,id:a,inputMode:"search",onChange:Ot,onClear:yn,onFocus:Gt,padding:Ze,prefix:b,radius:V,readOnly:v,ref:ve,role:"combobox",spellCheck:!1,suffix:Fo,value:nr}),n[153]=rt,n[154]=M,n[155]=Vn,n[156]=r,n[157]=i,n[158]=dt,n[159]=L,n[160]=yn,n[161]=Ot,n[162]=Gt,n[163]=s,n[164]=a,n[165]=nr,n[166]=He,n[167]=Ze,n[168]=b,n[169]=V,n[170]=v,n[171]=_,n[172]=is,n[173]=Fo,n[174]=Cr):Cr=n[174];let zi;return n[175]!==ht||n[176]!==at||n[177]!==Ct||n[178]!==Eo||n[179]!==Cr?(zi=d.jsxs(lIt,{"data-ui":"Autocomplete",onBlur:ht,onFocus:at,onKeyDown:Ct,ref:xe,children:[Cr,Eo]}),n[175]=ht,n[176]=at,n[177]=Ct,n[178]=Eo,n[179]=Cr,n[180]=zi):zi=n[180],zi});function vIt({renderPopover:t,content:e,hidden:n,inputElement:r,onMouseEnter:i,onMouseLeave:o,resultsPopoverElementRef:s}){return t({content:e,hidden:n,inputElement:r,onMouseEnter:i,onMouseLeave:o},s)}Cqe.displayName="ForwardRef(Autocomplete)";const pS=Cqe;function xIt(t){return t===0?0:t===1||t===2?1:t-2}function CIt(t){return Math.max(t-1,0)}const wIt=de.ol.withConfig({displayName:"StyledBreadcrumbs",componentId:"sc-1es8h8q-0"})`margin:0;padding:0;display:flex;list-style:none;align-items:center;white-space:nowrap;line-height:0;`,_It=de(vn).withConfig({displayName:"ExpandButton",componentId:"sc-1es8h8q-1"})`appearance:none;margin:-4px;`,uz=E.forwardRef(function(t,e){const n=Ut.c(29);let r,i,o,s,a;n[0]!==t?({children:r,maxLength:i,separator:s,space:a,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5]);const l=a===void 0?2:a;let c;n[6]!==l?(c=fn(l),n[6]=l,n[7]=c):c=n[7];const u=c,[f,h]=E.useState(!1),p=E.useRef(null),m=E.useRef(null);let g;n[8]===Symbol.for("react.memo_cache_sentinel")?(g=()=>h(!1),n[8]=g):g=n[8];const y=g;let b;n[9]===Symbol.for("react.memo_cache_sentinel")?(b=()=>h(!0),n[9]=b):b=n[9];const v=b;let x;n[10]===Symbol.for("react.memo_cache_sentinel")?(x=()=>[p.current,m.current],n[10]=x):x=n[10],ho(y,x);let C;n[11]!==r?(C=E.Children.toArray(r).filter(E.isValidElement),n[11]=r,n[12]=C):C=n[12];const w=C;let _;n[13]!==i||n[14]!==f||n[15]!==w||n[16]!==u?(_={collapse:y,expand:v,expandElementRef:p,maxLength:i,open:f,popoverElementRef:m,rawItems:w,space:u},n[13]=i,n[14]=f,n[15]=w,n[16]=u,n[17]=_):_=n[17];const S=SIt(_);let k;if(n[18]!==S||n[19]!==s||n[20]!==u){let j;n[22]!==s||n[23]!==u?(j=(A,D)=>d.jsxs(E.Fragment,{children:[D>0&&d.jsx(me,{"aria-hidden":!0,as:"li",paddingX:u,children:s||d.jsx(oe,{muted:!0,children:"/"})}),d.jsx(me,{as:"li",children:A})]},D),n[22]=s,n[23]=u,n[24]=j):j=n[24],k=S.map(j),n[18]=S,n[19]=s,n[20]=u,n[21]=k}else k=n[21];let I;return n[25]!==e||n[26]!==o||n[27]!==k?(I=d.jsx(wIt,{"data-ui":"Breadcrumbs",...o,ref:e,children:k}),n[25]=e,n[26]=o,n[27]=k,n[28]=I):I=n[28],I});uz.displayName="ForwardRef(Breadcrumbs)";function SIt(t){const e=Ut.c(28),{collapse:n,expand:r,expandElementRef:i,maxLength:o,open:s,popoverElementRef:a,rawItems:l,space:c}=t,u=l.length;if(o&&u>o){const f=Math.ceil(o/2),h=Math.floor(o/2);let p;if(e[0]!==h||e[1]!==f||e[2]!==n||e[3]!==r||e[4]!==i||e[5]!==u||e[6]!==s||e[7]!==a||e[8]!==l||e[9]!==c){const m=l.slice(0,f-1);let g;e[11]!==h||e[12]!==f||e[13]!==u||e[14]!==l?(g=l.slice(f-1,u-h),e[11]=h,e[12]=f,e[13]=u,e[14]=l,e[15]=g):g=e[15];let y;e[16]!==c||e[17]!==g?(y=d.jsx(ze,{as:"ol",overflow:"auto",padding:c,space:c,children:g}),e[16]=c,e[17]=g,e[18]=y):y=e[18];const b=s?n:r;let v;e[19]!==i||e[20]!==s||e[21]!==b?(v=d.jsx(_It,{fontSize:1,mode:"bleed",onClick:b,padding:1,ref:i,selected:s,text:"…"}),e[19]=i,e[20]=s,e[21]=b,e[22]=v):v=e[22];let x;e[23]!==s||e[24]!==a||e[25]!==y||e[26]!==v?(x=d.jsx(Ng,{constrainSize:!0,content:y,open:s,placement:"top",portal:!0,ref:a,children:v},"button"),e[23]=s,e[24]=a,e[25]=y,e[26]=v,e[27]=x):x=e[27],p=[...m,x,...l.slice(u-h)],e[0]=h,e[1]=f,e[2]=n,e[3]=r,e[4]=i,e[5]=u,e[6]=s,e[7]=a,e[8]=l,e[9]=c,e[10]=p}else p=e[10];return p}return l}function kIt({theme:t}){const{color:e}=Jt(t);return{"&:not([hidden])":{display:"flex"},top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center",outline:"none",background:e.backdrop}}function EIt(t){const{media:e}=Jt(t.theme);return $i(e,t.$position,n=>({"&&":{position:n}}))}function TIt(t){return t.$animate?st` + @keyframes zoomIn { + from { + opacity: 0; + transform: scale(0.95); + } + to { + opacity: 1; + transform: scale(1); + } + } + @keyframes fadeIn { + from { + opacity: 0; + } + to { + opacity: 1; + } + } + + animation: fadeIn 200ms ease-out; + // Animates the dialog card. + & > [data-ui='DialogCard'] { + animation: zoomIn 200ms ease-out; + } + `:st``}const wqe=q7("@sanity/ui/context/dialog",{version:0});function IIt(){return E.useContext(wqe)}function Hie(t,e,n){return!t||!e?!0:Lie(t,n)||Lie(e,n)}const jIt=de(Hf).withConfig({displayName:"StyledDialog",componentId:"sc-4n4xb3-0"})(eqe,kIt,EIt,TIt),AIt=de(_o).withConfig({displayName:"DialogContainer",componentId:"sc-4n4xb3-1"})`&:not([hidden]){display:flex;}width:100%;height:100%;flex-direction:column;align-items:center;justify-content:center;`,RIt=de(Be).withConfig({displayName:"DialogCardRoot",componentId:"sc-4n4xb3-2"})`&:not([hidden]){display:flex;}width:100%;min-height:0;max-height:100%;overflow:hidden;overflow:clip;`,DIt=de(ge).withConfig({displayName:"DialogLayout",componentId:"sc-4n4xb3-3"})`flex:1;min-height:0;width:100%;`,OIt=de(me).withConfig({displayName:"DialogHeader",componentId:"sc-4n4xb3-4"})`position:relative;z-index:2;`,PIt=de(me).withConfig({displayName:"DialogContent",componentId:"sc-4n4xb3-5"})`position:relative;z-index:1;overflow:auto;outline:none;`,$It=de(me).withConfig({displayName:"DialogFooter",componentId:"sc-4n4xb3-6"})`position:relative;z-index:3;`,_qe=E.forwardRef(function(t,e){const n=Ut.c(44),{__unstable_autoFocus:r,__unstable_hideCloseButton:i,children:o,contentRef:s,footer:a,header:l,id:c,onClickOutside:u,onClose:f,portal:h,radius:p,scheme:m,shadow:g,width:y}=t,b=im(),v=h?b.elements?.[h]||null:b.element,x=U8().element;let C;n[0]!==p?(C=fn(p),n[0]=p,n[1]=C):C=n[1];const w=C;let _;n[2]!==g?(_=fn(g),n[2]=g,n[3]=_):_=n[3];const S=_;let k;n[4]!==y?(k=fn(y),n[4]=y,n[5]=k):k=n[5];const I=k,j=E.useRef(null),A=E.useRef(null),D=Qu(),{isTopLayer:O}=D,P=`${c}_label`,$=!!f&&i===!1,M=!!l||$;let L;n[6]===Symbol.for("react.memo_cache_sentinel")?(L=()=>j.current,n[6]=L):L=n[6],E.useImperativeHandle(e,L);let B;n[7]===Symbol.for("react.memo_cache_sentinel")?(B=()=>A.current,n[7]=B):B=n[7],E.useImperativeHandle(s,B);let W,N;n[8]!==r?(W=()=>{r&&j.current&&m8(j.current)},N=[r,j],n[8]=r,n[9]=W,n[10]=N):(W=n[9],N=n[10]),E.useEffect(W,N);let V;n[11]!==x||n[12]!==O||n[13]!==f||n[14]!==v?(V=te=>{if(!O||!f)return;const ae=document.activeElement;ae&&!Hie(x,v,ae)||te.key==="Escape"&&(te.preventDefault(),te.stopPropagation(),f())},n[11]=x,n[12]=O,n[13]=f,n[14]=v,n[15]=V):V=n[15],Vc(V);let G;n[16]!==x||n[17]!==O||n[18]!==u||n[19]!==v?(G=O&&u&&(te=>{const ae=te.target;ae&&!Hie(x,v,ae)||u()}),n[16]=x,n[17]=O,n[18]=u,n[19]=v,n[20]=G):G=n[20];let z;n[21]===Symbol.for("react.memo_cache_sentinel")?(z=()=>[j.current],n[21]=z):z=n[21],ho(G,z);let Y;n[22]!==l||n[23]!==P||n[24]!==f||n[25]!==$||n[26]!==M?(Y=M&&d.jsx(OIt,{children:d.jsxs(ge,{align:"flex-start",padding:3,children:[d.jsx(me,{flex:1,padding:2,children:l&&d.jsx(oe,{id:P,size:1,weight:"semibold",children:l})}),$&&d.jsx(me,{flex:"none",children:d.jsx(vn,{"aria-label":"Close dialog",disabled:!f,icon:ao,mode:"bleed",onClick:f,padding:2})})]})}),n[22]=l,n[23]=P,n[24]=f,n[25]=$,n[26]=M,n[27]=Y):Y=n[27];let Z;n[28]!==o?(Z=d.jsx(PIt,{flex:1,ref:A,tabIndex:-1,children:o}),n[28]=o,n[29]=Z):Z=n[29];let ee;n[30]!==a?(ee=a&&d.jsx($It,{children:a}),n[30]=a,n[31]=ee):ee=n[31];let K;n[32]!==Y||n[33]!==Z||n[34]!==ee?(K=d.jsxs(DIt,{direction:"column",children:[Y,Z,ee]}),n[32]=Y,n[33]=Z,n[34]=ee,n[35]=K):K=n[35];let q;n[36]!==w||n[37]!==m||n[38]!==S||n[39]!==K?(q=d.jsx(RIt,{radius:w,ref:j,scheme:m,shadow:S,children:K}),n[36]=w,n[37]=m,n[38]=S,n[39]=K,n[40]=q):q=n[40];let re;return n[41]!==q||n[42]!==I?(re=d.jsx(AIt,{"data-ui":"DialogCard",width:I,children:q}),n[41]=q,n[42]=I,n[43]=re):re=n[43],re});_qe.displayName="ForwardRef(DialogCard)";const W8=E.forwardRef(function(t,e){const n=Ut.c(70),r=IIt(),{layer:i}=Y7();let o,s,a,l,c,u,f,h,p,m,g,y,b,v,x,C,w,_,S,k,I;n[0]!==t?({__unstable_autoFocus:x,__unstable_hideCloseButton:C,cardRadius:w,cardShadow:_,children:a,contentRef:l,footer:c,header:u,id:f,onActivate:h,onClickOutside:p,onClose:m,onFocus:g,padding:S,portal:y,position:o,scheme:v,width:k,zOffset:s,animate:I,...b}=t,n[0]=t,n[1]=o,n[2]=s,n[3]=a,n[4]=l,n[5]=c,n[6]=u,n[7]=f,n[8]=h,n[9]=p,n[10]=m,n[11]=g,n[12]=y,n[13]=b,n[14]=v,n[15]=x,n[16]=C,n[17]=w,n[18]=_,n[19]=S,n[20]=k,n[21]=I):(o=n[1],s=n[2],a=n[3],l=n[4],c=n[5],u=n[6],f=n[7],h=n[8],p=n[9],m=n[10],g=n[11],y=n[12],b=n[13],v=n[14],x=n[15],C=n[16],w=n[17],_=n[18],S=n[19],k=n[20],I=n[21]);const j=x===void 0?!0:x,A=C===void 0?!1:C,D=w===void 0?4:w,O=_===void 0?3:_,P=S===void 0?3:S,$=k===void 0?0:k,M=I===void 0?!1:I,L=o??(r.position||"fixed"),B=s??(r.zOffset||i.dialog.zOffset),W=lz()?!1:M,N=im(),V=y?N.elements?.[y]||null:N.element,G=U8().element;let z;n[22]!==D?(z=fn(D),n[22]=D,n[23]=z):z=n[23];const Y=z;let Z;n[24]!==P?(Z=fn(P),n[24]=P,n[25]=Z):Z=n[25];const ee=Z;let K;n[26]!==L?(K=fn(L),n[26]=L,n[27]=K):K=n[27];const q=K;let re;n[28]!==$?(re=fn($),n[28]=$,n[29]=re):re=n[29];const te=re;let ae;n[30]!==B?(ae=fn(B),n[30]=B,n[31]=ae):ae=n[31];const se=ae,le=E.useRef(null),pe=E.useRef(null),be=E.useRef(null),xe=E.useRef(null);let Ce;n[32]!==g?(Ce=Fe=>{g?.(Fe);const $e=Fe.target,Ye=be.current;if(Ye&&$e===le.current){yde(Ye);return}if(Ye&&$e===pe.current){m8(Ye);return}Fg(Fe.target)&&(xe.current=Fe.target)},n[32]=g,n[33]=Ce):Ce=n[33];const Te=Ce,_e=`${f}_label`,Ie=E.useRef(void 0);let ye;n[34]!==G||n[35]!==V?(ye=()=>{Ie.current&&clearTimeout(Ie.current),Ie.current=setTimeout(()=>{const Fe=document.activeElement;if(Fe&&!Hie(G,V,Fe)){const $e=xe.current;if(!$e||!document.body.contains($e)){const Ye=be.current;Ye&&m8(Ye);return}$e.focus()}},0)},n[34]=G,n[35]=V,n[36]=ye):ye=n[36];const fe=ye;let ve;n[37]===Symbol.for("react.memo_cache_sentinel")?(ve=d.jsx("div",{ref:le,tabIndex:0}),n[37]=ve):ve=n[37];let Se;n[38]!==j||n[39]!==Y||n[40]!==O||n[41]!==a||n[42]!==l||n[43]!==c||n[44]!==u||n[45]!==A||n[46]!==f||n[47]!==p||n[48]!==m||n[49]!==y||n[50]!==v||n[51]!==te?(Se=d.jsx(_qe,{__unstable_autoFocus:j,__unstable_hideCloseButton:A,contentRef:l,footer:c,header:u,id:f,onClickOutside:p,onClose:m,portal:y,radius:Y,ref:be,scheme:v,shadow:O,width:te,children:a}),n[38]=j,n[39]=Y,n[40]=O,n[41]=a,n[42]=l,n[43]=c,n[44]=u,n[45]=A,n[46]=f,n[47]=p,n[48]=m,n[49]=y,n[50]=v,n[51]=te,n[52]=Se):Se=n[52];let Ee;n[53]===Symbol.for("react.memo_cache_sentinel")?(Ee=d.jsx("div",{ref:pe,tabIndex:0}),n[53]=Ee):Ee=n[53];let je;n[54]!==W||n[55]!==Te||n[56]!==fe||n[57]!==f||n[58]!==_e||n[59]!==h||n[60]!==ee||n[61]!==q||n[62]!==e||n[63]!==b||n[64]!==Se||n[65]!==se?(je=d.jsxs(jIt,{...b,$animate:W,$padding:ee,$position:q,"aria-labelledby":_e,"aria-modal":!0,"data-ui":"Dialog",id:f,onActivate:h,onClick:fe,onFocus:Te,ref:e,role:"dialog",zOffset:se,children:[ve,Se,Ee]}),n[54]=W,n[55]=Te,n[56]=fe,n[57]=f,n[58]=_e,n[59]=h,n[60]=ee,n[61]=q,n[62]=e,n[63]=b,n[64]=Se,n[65]=se,n[66]=je):je=n[66];let Me;return n[67]!==y||n[68]!==je?(Me=d.jsx(X7,{__unstable_name:y,children:je}),n[67]=y,n[68]=je,n[69]=Me):Me=n[69],Me});W8.displayName="ForwardRef(Dialog)";function mS(t){const e=Ut.c(6),{children:n,position:r,zOffset:i}=t;let o;e[0]!==r||e[1]!==i?(o={version:0,position:r,zOffset:i},e[0]=r,e[1]=i,e[2]=o):o=e[2];const s=o;let a;return e[3]!==n||e[4]!==s?(a=d.jsx(wqe.Provider,{value:s,children:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5],a}mS.displayName="DialogProvider";const j0=E.forwardRef(function(t,e){const n=Ut.c(62),{__unstable_disableRestoreFocusOnClose:r,boundaryElement:i,button:o,id:s,menu:a,onClose:l,onOpen:c,placement:u,popoverScheme:f,portal:h,popover:p,popoverRadius:m,preventOverflow:g}=t,y=r===void 0?!1:r,b=h===void 0?!0:h,[v,x]=E.useState(!1),[C,w]=E.useState(null),[_,S]=E.useState(null);let k;n[0]===Symbol.for("react.memo_cache_sentinel")?(k=[],n[0]=k):k=n[0];const[I,j]=E.useState(k),A=E.useRef(v);let D,O;n[1]!==c||n[2]!==v?(D=()=>{c&&v&&!A.current&&c()},O=[c,v],n[1]=c,n[2]=v,n[3]=D,n[4]=O):(D=n[3],O=n[4]),E.useEffect(D,O);let P,$;n[5]!==l||n[6]!==v?(P=()=>{l&&!v&&A.current&&l()},$=[l,v],n[5]=l,n[6]=v,n[7]=P,n[8]=$):(P=n[7],$=n[8]),E.useEffect(P,$);let M,L;n[9]!==v?(M=()=>{A.current=v},L=[v],n[9]=v,n[10]=M,n[11]=L):(M=n[10],L=n[11]),E.useEffect(M,L);let B;n[12]===Symbol.for("react.memo_cache_sentinel")?(B=()=>{x(MIt),w(null)},n[12]=B):B=n[12];const W=B;let N;n[13]!==v?(N=Ee=>{v&&Ee.preventDefault()},n[13]=v,n[14]=N):N=n[14];const V=N;let G;n[15]===Symbol.for("react.memo_cache_sentinel")?(G=Ee=>{if(Ee.key==="ArrowDown"||Ee.key==="Enter"||Ee.key===" "){Ee.preventDefault(),x(!0),w("first");return}if(Ee.key==="ArrowUp"){Ee.preventDefault(),x(!0),w("last");return}},n[15]=G):G=n[15];const z=G;let Y;n[16]!==_||n[17]!==I?(Y=Ee=>{const je=Ee.target;if(je instanceof Node&&!(_&&(je===_||_.contains(je)))){for(const Me of I)if(je===Me||Me.contains(je))return;x(!1)}},n[16]=_,n[17]=I,n[18]=Y):Y=n[18];const Z=Y;let ee;n[19]!==_||n[20]!==y?(ee=()=>{x(!1),!y&&_&&_.focus()},n[19]=_,n[20]=y,n[21]=ee):ee=n[21];const K=ee;let q;n[22]!==I?(q=Ee=>{const je=Ee.relatedTarget;if(je instanceof Node){for(const Me of I)if(Me===je||Me.contains(je))return;x(!1)}},n[22]=I,n[23]=q):q=n[23];const re=q;let te;n[24]!==_||n[25]!==y?(te=()=>{x(!1),!y&&_&&_.focus()},n[24]=_,n[25]=y,n[26]=te):te=n[26];const ae=te;let se;n[27]===Symbol.for("react.memo_cache_sentinel")?(se=Ee=>(j(je=>je.concat([Ee])),()=>j(je=>je.filter(Me=>Me!==Ee))),n[27]=se):se=n[27];const le=se;let pe;n[28]!==_||n[29]!==re||n[30]!==ae||n[31]!==Z||n[32]!==K||n[33]!==s||n[34]!==a||n[35]!==C?(pe=a&&E.cloneElement(a,{"aria-labelledby":s,onBlurCapture:re,onClickOutside:Z,onEscape:K,onItemClick:ae,originElement:_,registerElement:le,shouldFocus:C}),n[28]=_,n[29]=re,n[30]=ae,n[31]=Z,n[32]=K,n[33]=s,n[34]=a,n[35]=C,n[36]=pe):pe=n[36];const be=pe;let xe;n[37]!==o||n[38]!==V||n[39]!==s||n[40]!==v?(xe=o&&E.cloneElement(o,{"data-ui":"MenuButton",id:s,onClick:W,onKeyDown:z,onMouseDown:V,"aria-haspopup":!0,"aria-expanded":v,ref:S,selected:o.props.selected??v}),n[37]=o,n[38]=V,n[39]=s,n[40]=v,n[41]=xe):xe=n[41];const Ce=xe;let Te,_e;n[42]!==_?(Te=()=>_,_e=[_],n[42]=_,n[43]=Te,n[44]=_e):(Te=n[43],_e=n[44]),E.useImperativeHandle(e,Te,_e);let Ie;n[45]!==p?(Ie=p||{},n[45]=p,n[46]=Ie):Ie=n[46];let ye;n[47]!==i||n[48]!==u||n[49]!==m||n[50]!==f||n[51]!==b||n[52]!==g||n[53]!==Ie?(ye={boundaryElement:i,overflow:"auto",placement:u,portal:b,preventOverflow:g,radius:m,scheme:f,...Ie},n[47]=i,n[48]=u,n[49]=m,n[50]=f,n[51]=b,n[52]=g,n[53]=Ie,n[54]=ye):ye=n[54];const fe=ye;let ve;n[55]!==Ce?(ve=Ce||d.jsx(d.Fragment,{}),n[55]=Ce,n[56]=ve):ve=n[56];let Se;return n[57]!==be||n[58]!==v||n[59]!==fe||n[60]!==ve?(Se=d.jsx(Ng,{"data-ui":"MenuButton__popover",...fe,content:be,open:v,children:ve}),n[57]=be,n[58]=v,n[59]=fe,n[60]=ve,n[61]=Se):Se=n[61],Se});j0.displayName="ForwardRef(MenuButton)";function MIt(t){return!t}const LIt=Vf` + 0% { + background-position: 100%; + } + 100% { + background-position: -100%; + } +`,FIt=st` + background-image: linear-gradient( + to right, + var(--card-skeleton-color-from), + var(--card-skeleton-color-to), + var(--card-skeleton-color-from), + var(--card-skeleton-color-from), + var(--card-skeleton-color-from) + ); + background-position: 100%; + background-size: 200% 100%; + background-attachment: fixed; + animation-name: ${LIt}; + animation-timing-function: ease-in-out; + animation-iteration-count: infinite; + animation-duration: 2000ms; +`,NIt=st` + opacity: ${({$visible:t})=>t?1:0}; + transition: opacity 200ms ease-in; + + @media screen and (prefers-reduced-motion: no-preference) { + ${({$animated:t})=>t?FIt:st` + background-color: var(--card-skeleton-color-from); + `} + } + + @media screen and (prefers-reduced-motion: reduce) { + background-color: var(--card-skeleton-color-from); + } +`,BIt=de(me).withConfig({displayName:"StyledSkeleton",componentId:"sc-ebtpni-0"})(K7,NIt),cu=E.forwardRef(function(t,e){const n=Ut.c(16);let r,i,o,s;n[0]!==t?({animated:s,delay:r,radius:i,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s):(r=n[1],i=n[2],o=n[3],s=n[4]);const a=s===void 0?!1:s,[l,c]=E.useState(!r);let u,f;n[5]!==r?(u=()=>{if(!r)return;const g=setTimeout(()=>{c(!0)},r);return()=>{clearTimeout(g)}},f=[r],n[5]=r,n[6]=u,n[7]=f):(u=n[6],f=n[7]),E.useEffect(u,f);let h;n[8]!==i?(h=fn(i),n[8]=i,n[9]=h):h=n[9];const p=r?l:!0;let m;return n[10]!==a||n[11]!==e||n[12]!==o||n[13]!==h||n[14]!==p?(m=d.jsx(BIt,{...o,$animated:a,$radius:h,$visible:p,ref:e}),n[10]=a,n[11]=e,n[12]=o,n[13]=h,n[14]=p,n[15]=m):m=n[15],m});cu.displayName="ForwardRef(Skeleton)";const dz=de(cu).withConfig({displayName:"StyledSkeleton",componentId:"sc-2p7a1v-0"})(t=>{const{$size:e,$style:n}=t,{font:r,media:i}=Jt(t.theme),o=r[n];return $i(i,e,s=>{const a=o.sizes[s];return{height:a.lineHeight-a.ascenderHeight-a.descenderHeight}})}),Es=E.forwardRef(function(t,e){const n=Ut.c(9);let r,i;n[0]!==t?({size:i,...r}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]);const o=i===void 0?2:i;let s;n[3]!==o?(s=fn(o),n[3]=o,n[4]=s):s=n[4];const a=s;let l;return n[5]!==a||n[6]!==e||n[7]!==r?(l=d.jsx(dz,{...r,$size:a,ref:e,$style:"text"}),n[5]=a,n[6]=e,n[7]=r,n[8]=l):l=n[8],l});Es.displayName="ForwardRef(TextSkeleton)";const VIt=E.forwardRef(function(t,e){const n=Ut.c(9);let r,i;n[0]!==t?({size:i,...r}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]);const o=i===void 0?2:i;let s;n[3]!==o?(s=fn(o),n[3]=o,n[4]=s):s=n[4];const a=s;let l;return n[5]!==a||n[6]!==e||n[7]!==r?(l=d.jsx(dz,{...r,$size:a,ref:e,$style:"label"}),n[5]=a,n[6]=e,n[7]=r,n[8]=l):l=n[8],l});VIt.displayName="ForwardRef(LabelSkeleton)";const zIt=E.forwardRef(function(t,e){const n=Ut.c(9);let r,i;n[0]!==t?({size:i,...r}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]);const o=i===void 0?2:i;let s;n[3]!==o?(s=fn(o),n[3]=o,n[4]=s):s=n[4];const a=s;let l;return n[5]!==a||n[6]!==e||n[7]!==r?(l=d.jsx(dz,{...r,$size:a,ref:e,$style:"heading"}),n[5]=a,n[6]=e,n[7]=r,n[8]=l):l=n[8],l});zIt.displayName="ForwardRef(HeadingSkeleton)";const HIt=E.forwardRef(function(t,e){const n=Ut.c(9);let r,i;n[0]!==t?({size:i,...r}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]);const o=i===void 0?2:i;let s;n[3]!==o?(s=fn(o),n[3]=o,n[4]=s):s=n[4];const a=s;let l;return n[5]!==a||n[6]!==e||n[7]!==r?(l=d.jsx(dz,{...r,$size:a,ref:e,$style:"code"}),n[5]=a,n[6]=e,n[7]=r,n[8]=l):l=n[8],l});HIt.displayName="ForwardRef(CodeSkeleton)";const w9=E.forwardRef(function(t,e){const n=Ut.c(9);let r,i;n[0]!==t?({flex:r,...i}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]);const o=t.tabIndex===void 0?0:t.tabIndex;let s;return n[3]!==r||n[4]!==t.children||n[5]!==e||n[6]!==i||n[7]!==o?(s=d.jsx(me,{"data-ui":"TabPanel",...i,flex:r,ref:e,role:"tabpanel",tabIndex:o,children:t.children}),n[3]=r,n[4]=t.children,n[5]=e,n[6]=i,n[7]=o,n[8]=s):s=n[8],s});w9.displayName="ForwardRef(TabPanel)";const HM=2,UIt={error:"critical",warning:"caution",success:"positive",info:"neutral"},WIt={error:"critical",warning:"caution",success:"positive",info:"neutral"},qIt=de(ge).withConfig({displayName:"TextBox",componentId:"sc-1rr7rxo-0"})`overflow-x:auto;`,GIt=de(Be).withConfig({displayName:"StyledToast",componentId:"sc-1rr7rxo-1"})`pointer-events:all;width:100%;position:relative;overflow:hidden;overflow:clip;&[data-has-duration]{padding-bottom:calc(${HM}px / 2);}`,YIt=de.div.withConfig({displayName:"LoadingBar",componentId:"sc-1rr7rxo-2"})`display:flex;position:absolute;bottom:0px;top:0px;left:0px;right:0px;pointer-events:none;z-index:-1;overflow:hidden;overflow:clip;background:transparent;align-items:flex-end;will-change:opacity;`,KIt=de(Be).withConfig({displayName:"LoadingBarMask",componentId:"sc-1rr7rxo-3"})`position:absolute;top:0;left:-${HM}px;right:-${HM}px;bottom:${HM}px;z-index:1;`,XIt=de(Be).withConfig({displayName:"LoadingBarProgress",componentId:"sc-1rr7rxo-4"})`display:block;height:100%;width:100%;transform-origin:0% 50%;background-color:${t=>{const{color:e}=Jt(t.theme);return e.button.default[t.tone].enabled.bg}};`,ZIt={error:"alert",warning:"alert",success:"alert",info:"alert"},QIt=1e3*60*60*24*24;function Sqe(t){const e=Ut.c(50);let n,r,i,o,s,a,l,c,u;e[0]!==t?({closable:n,description:r,duration:i,onClose:o,radius:l,title:c,status:a,updatedAt:u,...s}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=o,e[5]=s,e[6]=a,e[7]=l,e[8]=c,e[9]=u):(n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],u=e[9]);const f=l===void 0?3:l,h=a?UIt[a]:"default",p=a?WIt[a]:"default",m=a?ZIt[a]:"status",g=lz()?0:.26;let y;e[10]!==g?(y=g?{type:"spring",visualDuration:g,bounce:.25}:{duration:0},e[10]=g,e[11]=y):y=e[11];const b=y,v=i&&isFinite(i)&&it?{opacity:1,transition:{when:"beforeChildren",staggerChildren:t/3,duration:t/3}}:{opacity:1},slideIn:{y:0,scale:1},slideOut:{zIndex:0,scale:.75}},tY={initial:{willChange:"transform"},hidden:{opacity:0},visible:{opacity:1}},ejt=ei.create(GIt),tjt=ei.create(ge),njt=ei.create(oe),rjt=ei.create(YIt),ijt=ei.create(XIt);function ojt(){return E.useSyncExternalStore(ljt,ajt,sjt)}function sjt(){return!1}function ajt(){return!0}const ljt=()=>()=>{},kqe=q7("@sanity/ui/context/toast",null);function Eqe(t){const e=Ut.c(9),{children:n,padding:r,paddingX:i,paddingY:o,gap:s}=t,a=r===void 0?4:r,l=s===void 0?3:s,{zIndex:c}=Qu();let u;e[0]!==c?(u={zIndex:c},e[0]=c,e[1]=u):u=e[1];let f;return e[2]!==n||e[3]!==l||e[4]!==a||e[5]!==i||e[6]!==o||e[7]!==u?(f=d.jsx(cjt,{forwardedAs:"ul","data-ui":"ToastProvider",padding:a,paddingX:i,paddingY:o,gap:l,columns:1,style:u,children:n}),e[2]=n,e[3]=l,e[4]=a,e[5]=i,e[6]=o,e[7]=u,e[8]=f):f=e[8],f}Eqe.displayName="ToastLayer";const cjt=de(zo).withConfig({displayName:"StyledLayer",componentId:"sc-1tbwn58-0"})`box-sizing:border-box;position:fixed;right:0;bottom:0;list-style:none;pointer-events:none;max-width:420px;width:100%;`;let ujt=0;function djt(){return String(ujt++)}function Tqe(t){const e=Ut.c(13),{children:n,padding:r,paddingX:i,paddingY:o,gap:s,zOffset:a}=t,l=a===void 0?1:a;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=[],e[0]=c):c=e[0];const[u,f]=E.useState(c),h=ojt();let p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p={version:0,push:b=>{const v=b.id||djt(),x=b.duration||5e3;return E.startTransition(()=>{f(C=>{if(x===.01)return C.filter(_=>_.id!==v);const w=()=>E.startTransition(()=>f(_=>_.filter(S=>S.id!==v)));return[...C.filter(_=>_.id!==v),{dismiss:w,id:v,updatedAt:Date.now(),params:{...b,duration:x}}]})}),v}},e[1]=p):p=e[1];const m=p;let g;e[2]!==s||e[3]!==h||e[4]!==r||e[5]!==i||e[6]!==o||e[7]!==u||e[8]!==l?(g=h&&d.jsx(O2,{zOffset:l,children:d.jsx(Eqe,{padding:r,paddingX:i,paddingY:o,gap:s,children:d.jsx(Zu,{initial:!1,mode:"popLayout",children:u.map(fjt)})})}),e[2]=s,e[3]=h,e[4]=r,e[5]=i,e[6]=o,e[7]=u,e[8]=l,e[9]=g):g=e[9];let y;return e[10]!==n||e[11]!==g?(y=d.jsxs(kqe.Provider,{value:m,children:[n,g]}),e[10]=n,e[11]=g,e[12]=y):y=e[12],y}function fjt(t){const{dismiss:e,id:n,params:r,updatedAt:i}=t;return d.jsx(Sqe,{closable:r.closable,description:r.description,onClose:e,status:r.status,title:r.title,duration:r.duration,updatedAt:i},n)}Tqe.displayName="ToastProvider";function fr(){const t=E.useContext(kqe);if(!t)throw new Error("useToast(): missing context value");if(!cR(t)||t.version!==0)throw new Error("useToast(): the context value is not compatible");return t}function hjt(t,e,n){const r=e.indexOf(n),i=e.slice(0,r),o=i.length;for(let s=o-1;s>=0;s-=1){const a=i[s].getAttribute("data-tree-key");if(!a)continue;const l=a.split("/");l.pop();const c=[];let u=!0;for(let f=0;fl.current,n[8]=w):w=n[8],E.useImperativeHandle(e,w);let _,S;n[9]!==c?(_=()=>{f.current=c},S=[c],n[9]=c,n[10]=_,n[11]=S):(_=n[10],S=n[11]),E.useEffect(_,S);let k,I;n[12]!==v?(k=()=>{C.current=v},I=[v],n[12]=v,n[13]=k,n[14]=I):(k=n[13],I=n[14]),E.useEffect(k,I);let j;n[15]===Symbol.for("react.memo_cache_sentinel")?(j=(Z,ee,K,q)=>(x(re=>({...re,[ee]:{element:Z,expanded:K}})),q&&u(Z),()=>{x(re=>{const te={...re};return delete te[ee],te})}),n[15]=j):j=n[15];const A=j;let D;n[16]===Symbol.for("react.memo_cache_sentinel")?(D=(Z,ee)=>{x(K=>{const q=K[Z];return q?{...K,[Z]:{...q,expanded:ee}}:K})},n[16]=D):D=n[16];const O=D,P=c||g[0]||null;let $;n[17]!==a||n[18]!==v||n[19]!==P?($={version:0,focusedElement:P,level:0,path:p,registerItem:A,setExpanded:O,setFocusedElement:u,space:a,state:v},n[17]=a,n[18]=v,n[19]=P,n[20]=$):$=n[20];const M=$;let L;n[21]!==g?(L=Z=>{if(f.current){if(Z.key==="ArrowDown"){Z.preventDefault();const ee=pjt(C.current,g,f.current);ee&&(l8e(ee),u(ee));return}if(Z.key==="ArrowUp"){Z.preventDefault();const ee=hjt(C.current,g,f.current);ee&&(l8e(ee),u(ee));return}if(Z.key==="ArrowLeft"){Z.preventDefault();const ee=f.current.getAttribute("data-tree-key");if(!ee)return;const K=C.current[ee];if(!K)return;if(K.expanded)x(q=>{const re=q[ee];return re?{...q,[ee]:{...re,expanded:!1}}:q});else{const q=ee.split("/");q.pop();const re=q.join("/"),te=re&&C.current[re];te&&(te.element.focus(),u(te.element))}return}if(Z.key==="ArrowRight"){Z.preventDefault();const ee=f.current.getAttribute("data-tree-key");if(!ee)return;C.current[ee]?.expanded||x(K=>{const q=K[ee];return q?{...K,[ee]:{...q,expanded:!0}}:K});return}}},n[21]=g,n[22]=L):L=n[22];const B=L;let W;n[23]!==i?(W=Z=>{u(Z.target),i?.(Z)},n[23]=i,n[24]=W):W=n[24];const N=W;let V;n[25]===Symbol.for("react.memo_cache_sentinel")?(V=()=>{if(!l.current)return;const Z=Array.from(l.current.querySelectorAll('[data-ui="TreeItem"]'));y(Z)},n[25]=V):V=n[25];let G;n[26]!==r?(G=[r],n[26]=r,n[27]=G):G=n[27],E.useEffect(V,G);let z;n[28]!==r||n[29]!==N||n[30]!==B||n[31]!==o||n[32]!==a?(z=d.jsx(ze,{as:"ul","data-ui":"Tree",...o,onFocus:N,onKeyDown:B,ref:l,role:"tree",space:a,children:r}),n[28]=r,n[29]=N,n[30]=B,n[31]=o,n[32]=a,n[33]=z):z=n[33];let Y;return n[34]!==M||n[35]!==z?(Y=d.jsx(mjt.Provider,{value:M,children:z}),n[34]=M,n[35]=z,n[36]=Y):Y=n[36],Y});gjt.displayName="ForwardRef(Tree)";de(oe).withConfig({displayName:"ToggleArrowText",componentId:"sc-iiskig-2"})`& > svg{transition:transform 100ms;}`;function Nx(t,e,n){let r=n.initialDeps??[],i,o=!0;function s(){var a,l,c;let u;n.key&&((a=n.debug)!=null&&a.call(n))&&(u=Date.now());const f=t();if(!(f.length!==r.length||f.some((m,g)=>r[g]!==m)))return i;r=f;let p;if(n.key&&((l=n.debug)!=null&&l.call(n))&&(p=Date.now()),i=e(...f),n.key&&((c=n.debug)!=null&&c.call(n))){const m=Math.round((Date.now()-u)*100)/100,g=Math.round((Date.now()-p)*100)/100,y=g/16,b=(v,x)=>{for(v=String(v);v.length{r=a},s}function c8e(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const yjt=(t,e)=>Math.abs(t-e)<1.01,bjt=(t,e,n)=>{let r;return function(...i){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,i),n)}},u8e=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},vjt=t=>t,Iqe=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),r=[];for(let i=e;i<=n;i++)r.push(i);return r},xjt=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const i=s=>{const{width:a,height:l}=s;e({width:Math.round(a),height:Math.round(l)})};if(i(u8e(n)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(s=>{const a=()=>{const l=s[0];if(l?.borderBoxSize){const c=l.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(u8e(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},d8e={passive:!0},f8e=typeof window>"u"?!0:"onscrollend"in window,Cjt=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;let i=0;const o=t.options.useScrollendEvent&&f8e?()=>{}:bjt(r,()=>{e(i,!1)},t.options.isScrollingResetDelay),s=u=>()=>{const{horizontal:f,isRtl:h}=t.options;i=f?n.scrollLeft*(h&&-1||1):n.scrollTop,o(),e(i,u)},a=s(!0),l=s(!1);n.addEventListener("scroll",a,d8e);const c=t.options.useScrollendEvent&&f8e;return c&&n.addEventListener("scrollend",l,d8e),()=>{n.removeEventListener("scroll",a),c&&n.removeEventListener("scrollend",l)}},wjt=(t,e,n)=>{if(e?.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},jqe=(t,{adjustments:e=0,behavior:n},r)=>{var i,o;const s=t+e;(o=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[r.options.horizontal?"left":"top"]:s,behavior:n})};class _jt{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(o=>{const s=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var o;return(o=r())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=r())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:vjt,rangeExtractor:Iqe,onChange:()=>{},measureElement:wjt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=Nx(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const i=new Map,o=new Map;for(let s=r-1;s>=0;s--){const a=n[s];if(i.has(a.lane))continue;const l=o.get(a.lane);if(l==null||a.end>l.end?o.set(a.lane,a):a.ends.end===a.end?s.index-a.index:s.end-a.end)[0]:void 0},this.getMeasurementOptions=Nx(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,r,i,o,s,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:i,getItemKey:o,enabled:s,lanes:a}),{key:!1}),this.getMeasurements=Nx(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:i,getItemKey:o,enabled:s,lanes:a},l)=>{if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const h of this.laneAssignments.keys())h>=n&&this.laneAssignments.delete(h);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const u=this.measurementsCache.slice(0,c),f=new Array(a).fill(void 0);for(let h=0;h1){g=m;const C=f[g],w=C!==void 0?u[C]:void 0;y=w?w.end+this.options.gap:r+i}else{const C=this.options.lanes===1?u[h-1]:this.getFurthestMeasurement(u,h);y=C?C.end+this.options.gap:r+i,g=C?C.lane:h%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(h,g)}const b=l.get(p),v=typeof b=="number"?b:this.options.estimateSize(h),x=y+v;u[h]={index:h,start:y,size:v,end:x,key:p,lane:g},f[g]=h}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Nx(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,i,o)=>this.range=n.length>0&&r>0?Sjt({measurements:n,outerSize:r,scrollOffset:i,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Nx(()=>{let n=null,r=null;const i=this.calculateRange();return i&&(n=i.startIndex,r=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,i,o,s)=>o===null||s===null?[]:n({startIndex:o,endIndex:s,overscan:r,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const i=this.indexFromElement(n),o=this.measurementsCache[i];if(!o)return;const s=o.key,a=this.elementsCache.get(s);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(s,n)),n.isConnected&&this.resizeItem(i,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const i=this.measurementsCache[n];if(!i)return;const o=this.itemSizeCache.get(i.key)??i.size,s=r-o;s!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,s,this):i.start{if(!n){this.elementsCache.forEach((r,i)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(i))});return}this._measureElement(n,void 0)},this.getVirtualItems=Nx(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let o=0,s=n.length;othis.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return c8e(r[Aqe(0,r.length-1,i=>c8e(r[i]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,r,i=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),s=this.getScrollOffset();r==="auto"&&(r=n>=s+o?"end":"start"),r==="center"?n+=(i-o)/2:r==="end"&&(n-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.measurementsCache[n];if(!i)return;const o=this.getSize(),s=this.getScrollOffset();if(r==="auto")if(i.end>=s+o-this.options.scrollPaddingEnd)r="end";else if(i.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,i.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:i})},this.scrollToIndex=(n,{align:r="auto",behavior:i}={})=>{i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1)),this.currentScrollToIndex=n;let o=0;const s=10,a=c=>{if(!this.targetWindow)return;const u=this.getOffsetForIndex(n,c);if(!u){console.warn("Failed to get offset for index:",n);return}const[f,h]=u;this._scrollToOffset(f,{adjustments:void 0,behavior:i}),this.targetWindow.requestAnimationFrame(()=>{if(!this.targetWindow)return;const p=()=>{if(this.currentScrollToIndex!==n)return;const m=this.getScrollOffset(),g=this.getOffsetForIndex(n,h);if(!g){console.warn("Failed to get offset for index:",n);return}yjt(g[0],m)||l(h)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(p):p()})},l=c=>{this.targetWindow&&this.currentScrollToIndex===n&&(o++,oa(c)):console.warn(`Failed to scroll to index ${n} after ${s} attempts.`))};a(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((n=r[r.length-1])==null?void 0:n.end)??0;else{const o=Array(this.options.lanes).fill(null);let s=r.length-1;for(;s>=0&&o.some(a=>a===null);){const a=r[s];o[a.lane]===null&&(o[a.lane]=a.end),s--}i=Math.max(...o.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}}const Aqe=(t,e,n,r)=>{for(;t<=e;){const i=(t+e)/2|0,o=n(i);if(or)e=i-1;else return i}return t>0?t-1:0};function Sjt({measurements:t,outerSize:e,scrollOffset:n,lanes:r}){const i=t.length-1,o=l=>t[l].start;if(t.length<=r)return{startIndex:0,endIndex:i};let s=Aqe(0,i,o,n),a=s;if(r===1)for(;a1){const l=Array(r).fill(0);for(;au=0&&c.some(u=>u>=n);){const u=t[s];c[u.lane]=u.start,s--}s=Math.max(0,s-s%r),a=Math.min(i,a+(r-1-a%r))}return{startIndex:s,endIndex:a}}const h8e=typeof document<"u"?E.useLayoutEffect:E.useEffect;function kjt({useFlushSync:t=!0,...e}){const n=E.useReducer(()=>({}),{})[1],r={...e,onChange:(o,s)=>{var a;t&&s?r0.flushSync(n):n(),(a=e.onChange)==null||a.call(e,o,s)}},[i]=E.useState(()=>new _jt(r));return i.setOptions(r),h8e(()=>i._didMount(),[]),h8e(()=>i._willUpdate()),i}function dR(t){return kjt({observeElementRect:xjt,observeElementOffset:Cjt,scrollToFn:jqe,...t})}var Rqe=typeof global=="object"&&global&&global.Object===Object&&global,Ejt=typeof self=="object"&&self&&self.Object===Object&&self,om=Rqe||Ejt||Function("return this")(),Kp=om.Symbol,Dqe=Object.prototype,Tjt=Dqe.hasOwnProperty,Ijt=Dqe.toString,DE=Kp?Kp.toStringTag:void 0;function jjt(t){var e=Tjt.call(t,DE),n=t[DE];try{t[DE]=void 0;var r=!0}catch{}var i=Ijt.call(t);return r&&(e?t[DE]=n:delete t[DE]),i}var Ajt=Object.prototype,Rjt=Ajt.toString;function Djt(t){return Rjt.call(t)}var Ojt="[object Null]",Pjt="[object Undefined]",p8e=Kp?Kp.toStringTag:void 0;function q8(t){return t==null?t===void 0?Pjt:Ojt:p8e&&p8e in Object(t)?jjt(t):Djt(t)}function Xp(t){return t!=null&&typeof t=="object"}var $jt="[object Symbol]";function A0(t){return typeof t=="symbol"||Xp(t)&&q8(t)==$jt}function p0(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n0){if(++e>=pAt)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function bAt(t){return function(){return t}}var zF=(function(){try{var t=fv(Object,"defineProperty");return t({},"",{}),t}catch{}})(),vAt=zF?function(t,e){return zF(t,"toString",{configurable:!0,enumerable:!1,value:bAt(e),writable:!0})}:Vg,Mqe=yAt(vAt);function xAt(t,e){for(var n=-1,r=t==null?0:t.length;++n-1}var _At=9007199254740991,SAt=/^(?:0|[1-9]\d*)$/;function fz(t,e){var n=typeof t;return e=e??_At,!!e&&(n=="number"||n!="symbol"&&SAt.test(t))&&t>-1&&t%1==0&&t-1&&t%1==0&&t<=TAt}function G8(t){return t!=null&&kde(t.length)&&!Pqe(t)}function Wie(t,e,n){if(!Ks(n))return!1;var r=typeof e;return(r=="number"?G8(n)&&fz(e,n.length):r=="string"&&e in n)?pz(n[e],t):!1}var IAt=Object.prototype;function mz(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||IAt;return t===n}function jAt(t,e){for(var n=-1,r=Array(t);++n-1}function MRt(t,e){var n=this.__data__,r=bz(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function Z7(t){var e=-1,n=t==null?0:t.length;for(this.clear();++ei?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r=r?t:Gqe(t,e,n)}var eDt="\\ud800-\\udfff",tDt="\\u0300-\\u036f",nDt="\\ufe20-\\ufe2f",rDt="\\u20d0-\\u20ff",iDt=tDt+nDt+rDt,oDt="\\ufe0e\\ufe0f",sDt="\\u200d",aDt=RegExp("["+sDt+eDt+iDt+oDt+"]");function Kqe(t){return aDt.test(t)}function lDt(t){return t.split("")}var Xqe="\\ud800-\\udfff",cDt="\\u0300-\\u036f",uDt="\\ufe20-\\ufe2f",dDt="\\u20d0-\\u20ff",fDt=cDt+uDt+dDt,hDt="\\ufe0e\\ufe0f",pDt="["+Xqe+"]",qie="["+fDt+"]",Gie="\\ud83c[\\udffb-\\udfff]",mDt="(?:"+qie+"|"+Gie+")",Zqe="[^"+Xqe+"]",Qqe="(?:\\ud83c[\\udde6-\\uddff]){2}",Jqe="[\\ud800-\\udbff][\\udc00-\\udfff]",gDt="\\u200d",eGe=mDt+"?",tGe="["+hDt+"]?",yDt="(?:"+gDt+"(?:"+[Zqe,Qqe,Jqe].join("|")+")"+tGe+eGe+")*",bDt=tGe+eGe+yDt,vDt="(?:"+[Zqe+qie+"?",qie,Qqe,Jqe,pDt].join("|")+")",xDt=RegExp(Gie+"(?="+Gie+")|"+vDt+bDt,"g");function CDt(t){return t.match(xDt)||[]}function Yie(t){return Kqe(t)?CDt(t):lDt(t)}function wDt(t){return function(e){e=Hg(e);var n=Kqe(e)?Yie(e):void 0,r=n?n[0]:e.charAt(0),i=n?Yqe(n,1).join(""):e.slice(1);return r[t]()+i}}var xz=wDt("toUpperCase");function xg(t){return xz(Hg(t).toLowerCase())}function _Dt(t,e,n,r){for(var i=-1,o=t==null?0:t.length;++ia))return!1;var c=o.get(t),u=o.get(e);if(c&&u)return c==e&&u==t;var f=-1,h=!0,p=n&GPt?new k9:void 0;for(o.set(t,e),o.set(e,t);++f=e||S<0||f&&k>=o}function b(){var _=oY();if(y(_))return v(_);a=setTimeout(b,g(_))}function v(_){return a=void 0,h&&r?p(_):(r=i=void 0,s)}function x(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function C(){return a===void 0?s:v(oY())}function w(){var _=oY(),S=y(_);if(r=arguments,i=this,l=_,S){if(a===void 0)return m(l);if(f)return clearTimeout(a),a=setTimeout(b,e),p(l)}return a===void 0&&(a=setTimeout(b,e)),s}return w.cancel=x,w.flush=C,w}function Ij(t){return Xp(t)&&G8(t)}var L$t=200;function jGe(t,e,n,r){var i=-1,o=_de,s=!0,a=t.length,l=[],c=e.length;if(!a)return l;e.length>=L$t&&(o=Tj,s=!1,e=new k9(e));e:for(;++i-1?i[o?e[s]:s]:void 0}}var W$t=Math.max;function Bde(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:Ujt(n);return i<0&&(i=W$t(r+i,0)),Lqe(t,K8(e),i)}var DGe=U$t(Bde);function OGe(t,e){var n=-1,r=G8(t)?Array(t.length):[];return IGe(t,function(i,o,s){r[++n]=e(i,o,s)}),r}function q$t(t,e){var n=_c(t)?p0:OGe;return n(t,K8(e))}function G$t(t,e){return yS(q$t(t,e))}var Y$t="Expected a function",K$t=8,X$t=32,Z$t=128,Q$t=256;function J$t(t){return Ade(function(e){for(var n=e.length,r=n,i=g8.prototype.thru;r--;){var o=e[r];if(typeof o!="function")throw new TypeError(Y$t);if(i&&!s&&WM(o)=="wrapper")var s=new g8([],!0)}for(r=s?r:n;++re}var iMt="[object String]";function PGe(t){return typeof t=="string"||!_c(t)&&Xp(t)&&q8(t)==iMt}function oMt(t,e){return p0(e,function(n){return t[n]})}function $Ge(t){return t==null?[]:oMt(t,Y8(t))}var sMt=Math.min;function aMt(t,e,n){for(var r=_de,i=t[0].length,o=t.length,s=o,a=Array(o),l=1/0,c=[];s--;){var u=t[s];l=sMt(u.length,l),a[s]=i>=120&&u.length>=120?new k9(s&&u):void 0}u=t[0];var f=-1,h=a[0];e:for(;++f1),o}),fR(t,$de(t),n),r&&(n=uw(n,EMt|TMt|IMt,kMt));for(var i=e.length;i--;)SMt(n,e[i]);return n});function BGe(t,e,n,r){if(!Ks(t))return t;e=gS(e,t);for(var i=-1,o=e.length,s=o-1,a=t;a!=null&&++ie||o&&s&&l&&!a&&!c||r&&s&&l||!n&&l||!i)return 1;if(!r&&!o&&!c&&t=a)return l;var c=n[r];return l*(c=="desc"?-1:1)}}return t.index-e.index}function HGe(t,e,n){e.length?e=p0(e,function(o){return _c(o)?function(s){return pR(s,o.length===1?o[0]:o)}:o}):e=[Vg];var r=-1;e=p0(e,yz(K8));var i=OGe(t,function(o,s,a){var l=p0(e,function(c){return c(o)});return{criteria:l,index:++r,value:o}});return AMt(i,function(o,s){return DMt(o,s,n)})}function bS(t,e,n,r){return t==null?[]:(_c(e)||(e=e==null?[]:[e]),n=n,_c(n)||(n=n==null?[]:[n]),HGe(t,e,n))}var gR=Fde(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]});function OMt(t,e){return VGe(t,e,function(n,r){return TGe(t,r)})}var Zi=Ade(function(t,e){return t==null?{}:OMt(t,e)}),PMt=Math.floor,$Mt=Math.random;function MMt(t,e){return t+PMt($Mt()*(e-t+1))}var LMt=Math.ceil,FMt=Math.max;function NMt(t,e,n,r){for(var i=-1,o=FMt(LMt((e-t)/(n||1)),0),s=Array(o);o--;)s[++i]=t,t+=n;return s}function BMt(t){return function(e,n,r){return r&&typeof r!="number"&&Wie(e,n,r)&&(n=r=void 0),e=UM(e),n===void 0?(n=e,e=0):n=UM(n),r=r===void 0?e1&&Wie(t,e[0],e[1])?e=[]:n>2&&Wie(e[0],e[1],e[2])&&(e=[e[0]]),HGe(t,yS(e),[])}),UMt=4294967295,WMt=UMt-1,qMt=Math.floor,GMt=Math.min;function YMt(t,e,n,r){var i=0,o=t==null?0:t.length;if(o===0)return 0;e=n(e);for(var s=e!==e,a=e===null,l=A0(e),c=e===void 0;i>>1;function ZMt(t,e,n){var r=0,i=t==null?r:t.length;if(typeof e=="number"&&e===e&&i<=XMt){for(;r>>1,s=t[o];s!==null&&!A0(s)&&s-1;);return n}function rLt(t,e){for(var n=-1,r=t.length;++n-1;);return n}function iLt(t,e,n){if(t=Hg(t),t&&e===void 0)return Oqe(t);if(!t||!(e=bde(e)))return t;var r=Yie(t),i=Yie(e),o=rLt(r,i),s=nLt(r,i)+1;return Yqe(r,o,s).join("")}var oLt=1/0,sLt=cw&&1/Lde(new cw([,-0]))[1]==oLt?function(t){return new cw(t)}:p7,aLt=200;function jj(t,e,n){var r=-1,i=_de,o=t.length,s=!0,a=[],l=a;if(o>=aLt){var c=e?null:sLt(t);if(c)return Lde(c);s=!1,i=Tj,l=new k9}else l=e?[]:a;e:for(;++r{const i=[n,{code:e,...r||{}}];if(t?.services?.logger?.forward)return t.services.logger.forward(i,"warn","react-i18next::",!0);Zb(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),t?.services?.logger?.warn?t.services.logger.warn(...i):console?.warn&&console.warn(...i)},Q8e={},Jie=(t,e,n,r)=>{Zb(n)&&Q8e[n]||(Zb(n)&&(Q8e[n]=new Date),dLt(t,e,n,r))},GGe=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},eoe=(t,e,n)=>{t.loadNamespaces(e,GGe(t,n))},J8e=(t,e,n,r)=>{if(Zb(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return eoe(t,n,r);n.forEach(i=>{t.options.ns.indexOf(i)<0&&t.options.ns.push(i)}),t.loadLanguages(e,GGe(t,r))},fLt=(t,e,n={})=>!e.languages||!e.languages.length?(Jie(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:n.lng,precheck:(r,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!i(r.isLanguageChangingTo,t))return!1}}),Zb=t=>typeof t=="string",hLt=t=>typeof t=="object"&&t!==null,pLt=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,mLt={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},gLt=t=>mLt[t],yLt=t=>t.replace(pLt,gLt);let toe={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:yLt};const bLt=(t={})=>{toe={...toe,...t}},vLt=()=>toe;let YGe;const xLt=t=>{YGe=t},CLt=()=>YGe,wLt={type:"3rdParty",init(t){bLt(t.options.react),xLt(t)}},KGe=E.createContext();class _Lt{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const SLt=(t,e)=>{const n=E.useRef();return E.useEffect(()=>{n.current=t},[t,e]),n.current},XGe=(t,e,n,r)=>t.getFixedT(e,n,r),kLt=(t,e,n,r)=>E.useCallback(XGe(t,e,n,r),[t,e,n,r]),Hde=(t,e={})=>{const{i18n:n}=e,{i18n:r,defaultNS:i}=E.useContext(KGe)||{},o=n||r||CLt();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new _Lt),!o){Jie(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const C=(_,S)=>Zb(S)?S:hLt(S)&&Zb(S.defaultValue)?S.defaultValue:Array.isArray(_)?_[_.length-1]:_,w=[C,{},!1];return w.t=C,w.i18n={},w.ready=!1,w}o.options.react?.wait&&Jie(o,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const s={...vLt(),...o.options.react,...e},{useSuspense:a,keyPrefix:l}=s;let c=t||i||o.options?.defaultNS;c=Zb(c)?[c]:c||["translation"],o.reportNamespaces.addUsedNamespaces?.(c);const u=(o.isInitialized||o.initializedStoreOnce)&&c.every(C=>fLt(C,o,s)),f=kLt(o,e.lng||null,s.nsMode==="fallback"?c:c[0],l),h=()=>f,p=()=>XGe(o,e.lng||null,s.nsMode==="fallback"?c:c[0],l),[m,g]=E.useState(h);let y=c.join();e.lng&&(y=`${e.lng}${y}`);const b=SLt(y),v=E.useRef(!0);E.useEffect(()=>{const{bindI18n:C,bindI18nStore:w}=s;v.current=!0,!u&&!a&&(e.lng?J8e(o,e.lng,c,()=>{v.current&&g(p)}):eoe(o,c,()=>{v.current&&g(p)})),u&&b&&b!==y&&v.current&&g(p);const _=()=>{v.current&&g(p)};return C&&o?.on(C,_),w&&o?.store.on(w,_),()=>{v.current=!1,o&&C&&C?.split(" ").forEach(S=>o.off(S,_)),w&&o&&w.split(" ").forEach(S=>o.store.off(S,_))}},[o,y]),E.useEffect(()=>{v.current&&u&&g(h)},[o,l,u]);const x=[m,o,u];if(x.t=m,x.i18n=o,x.ready=u,u||!u&&!a)return x;throw new Promise(C=>{e.lng?J8e(o,e.lng,c,()=>C()):eoe(o,c,()=>C())})};function ELt({i18n:t,defaultNS:e,children:n}){const r=E.useMemo(()=>({i18n:t,defaultNS:e}),[t,e]);return E.createElement(KGe.Provider,{value:r},n)}const ZGe=!(typeof navigator>"u")&&navigator.product==="ReactNative",QGe={timeout:ZGe?6e4:12e4},TLt=function(t){const e={...QGe,...typeof t=="string"?{url:t}:t};if(e.timeout=JGe(e.timeout),e.query){const{url:n,searchParams:r}=(function(i){const o=i.indexOf("?");if(o===-1)return{url:i,searchParams:new URLSearchParams};const s=i.slice(0,o),a=i.slice(o+1);if(!ZGe)return{url:s,searchParams:new URLSearchParams(a)};if(typeof decodeURIComponent!="function")throw new Error("Broken `URLSearchParams` implementation, and `decodeURIComponent` is not defined");const l=new URLSearchParams;for(const c of a.split("&")){const[u,f]=c.split("=");u&&l.append(e6e(u),e6e(f||""))}return{url:s,searchParams:l}})(e.url);for(const[i,o]of Object.entries(e.query)){if(o!==void 0)if(Array.isArray(o))for(const a of o)r.append(i,a);else r.append(i,o);const s=r.toString();s&&(e.url=`${n}?${s}`)}}return e.method=e.body&&!e.method?"POST":(e.method||"GET").toUpperCase(),e};function e6e(t){return decodeURIComponent(t.replace(/\+/g," "))}function JGe(t){if(t===!1||t===0)return!1;if(t.connect||t.socket)return t;const e=Number(t);return isNaN(e)?JGe(QGe.timeout):{connect:e,socket:e}}const ILt=/^https?:\/\//i,jLt=function(t){if(!ILt.test(t.url))throw new Error(`"${t.url}" is not a valid URL`)};function eYe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}const ALt=["request","response","progress","error","abort"],t6e=["processOptions","validateOptions","interceptRequest","finalizeOptions","onRequest","onResponse","onError","onReturn","onHeaders"];function tYe(t,e){const n=[],r=t6e.reduce((o,s)=>(o[s]=o[s]||[],o),{processOptions:[TLt],validateOptions:[jLt]});function i(o){const s=ALt.reduce((p,m)=>(p[m]=(function(){const g=Object.create(null);let y=0;return{publish:function(b){for(const v in g)g[v](b)},subscribe:function(b){const v=y++;return g[v]=b,function(){delete g[v]}}}})(),p),{}),a=(p=>function(m,g,...y){const b=m==="onError";let v=g;for(let x=0;x{u=e(p,(m,g)=>((y,b,v)=>{let x=y,C=b;if(!x)try{C=a("onResponse",b,v)}catch(w){C=null,x=w}x=x&&a("onError",x,v),x?s.error.publish(x):C&&s.response.publish(C)})(m,g,p))});s.abort.subscribe(()=>{f(),u&&u.abort()});const h=a("onReturn",s,c);return h===s&&s.request.publish(c),h}return i.use=function(o){if(!o)throw new Error("Tried to add middleware that resolved to falsey value");if(typeof o=="function")throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");if(o.onReturn&&r.onReturn.length>0)throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");return t6e.forEach(s=>{o[s]&&r[s].push(o[s])}),n.push(o),i},i.clone=()=>tYe(n,e),t.forEach(i.use),i}var n6e,r6e,RLt=eYe((function(){if(r6e)return n6e;r6e=1;var t=function(n){return n.replace(/^\s+|\s+$/g,"")},e=function(n){return Object.prototype.toString.call(n)==="[object Array]"};return n6e=function(n){if(!n)return{};for(var r=Object.create(null),i=t(n).split(` +`),o=0;o"u"?r[l]=c:e(r[l])?r[l].push(c):r[l]=[r[l],c]}return r}})());let noe=class{onabort;onerror;onreadystatechange;ontimeout;readyState=0;response;responseText="";responseType="";status;statusText;withCredentials;#t;#e;#n;#o={};#r;#s={};#a;open(e,n,r){this.#t=e,this.#e=n,this.#n="",this.readyState=1,this.onreadystatechange?.(),this.#r=void 0}abort(){this.#r&&this.#r.abort()}getAllResponseHeaders(){return this.#n}setRequestHeader(e,n){this.#o[e]=n}setInit(e,n=!0){this.#s=e,this.#a=n}send(e){const n=this.responseType!=="arraybuffer",r={...this.#s,method:this.#t,headers:this.#o,body:e};typeof AbortController=="function"&&this.#a&&(this.#r=new AbortController,typeof EventTarget<"u"&&this.#r.signal instanceof EventTarget&&(r.signal=this.#r.signal)),typeof document<"u"&&(r.credentials=this.withCredentials?"include":"omit"),fetch(this.#e,r).then(i=>(i.headers.forEach((o,s)=>{this.#n+=`${s}: ${o}\r +`}),this.status=i.status,this.statusText=i.statusText,this.readyState=3,this.onreadystatechange?.(),n?i.text():i.arrayBuffer())).then(i=>{typeof i=="string"?this.responseText=i:this.response=i,this.readyState=4,this.onreadystatechange?.()}).catch(i=>{i.name!=="AbortError"?this.onerror?.(i):this.onabort?.()})}};const roe=typeof XMLHttpRequest=="function"?"xhr":"fetch",DLt=roe==="xhr"?XMLHttpRequest:noe,OLt=(t,e)=>{const n=t.options,r=t.applyMiddleware("finalizeOptions",n),i={},o=t.applyMiddleware("interceptRequest",void 0,{adapter:roe,context:t});if(o){const g=setTimeout(e,0,null,o);return{abort:()=>clearTimeout(g)}}let s=new DLt;s instanceof noe&&typeof r.fetch=="object"&&s.setInit(r.fetch,r.useAbortSignal??!0);const a=r.headers,l=r.timeout;let c=!1,u=!1,f=!1;if(s.onerror=g=>{m(s instanceof noe?g instanceof Error?g:new Error(`Request error while attempting to reach is ${r.url}`,{cause:g}):new Error(`Request error while attempting to reach is ${r.url}${g.lengthComputable?`(${g.loaded} of ${g.total} bytes transferred)`:""}`))},s.ontimeout=g=>{m(new Error(`Request timeout while attempting to reach ${r.url}${g.lengthComputable?`(${g.loaded} of ${g.total} bytes transferred)`:""}`))},s.onabort=()=>{p(!0),c=!0},s.onreadystatechange=function(){l&&(p(),i.socket=setTimeout(()=>h("ESOCKETTIMEDOUT"),l.socket)),!c&&s&&s.readyState===4&&s.status!==0&&(function(){if(!(c||u||f)){if(s.status===0)return void m(new Error("Unknown XHR error"));p(),u=!0,e(null,{body:s.response||(s.responseType===""||s.responseType==="text"?s.responseText:""),url:r.url,method:r.method,headers:RLt(s.getAllResponseHeaders()),statusCode:s.status,statusMessage:s.statusText})}})()},s.open(r.method,r.url,!0),s.withCredentials=!!r.withCredentials,a&&s.setRequestHeader)for(const g in a)a.hasOwnProperty(g)&&s.setRequestHeader(g,a[g]);return r.rawBody&&(s.responseType="arraybuffer"),t.applyMiddleware("onRequest",{options:r,adapter:roe,request:s,context:t}),s.send(r.body||null),l&&(i.connect=setTimeout(()=>h("ETIMEDOUT"),l.connect)),{abort:function(){c=!0,s&&s.abort()}};function h(g){f=!0,s.abort();const y=new Error(g==="ESOCKETTIMEDOUT"?`Socket timed out on request to ${r.url}`:`Connection timed out on request to ${r.url}`);y.code=g,t.channels.error.publish(y)}function p(g){(g||c||s&&s.readyState>=2&&i.connect)&&clearTimeout(i.connect),i.socket&&clearTimeout(i.socket)}function m(g){if(u)return;p(!0),u=!0,s=null;const y=g||new Error(`Network error while attempting to reach ${r.url}`);y.isNetworkError=!0,y.request=r,e(y)}},PLt=(t=[],e=OLt)=>tYe(t,e);var $Lt={},i6e,o6e,s6e,a6e,l6e,sY={exports:{}};l6e||(l6e=1,(function(t,e){e.formatArgs=function(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const i="color: "+this.color;r.splice(1,0,i,"color: inherit");let o=0,s=0;r[0].replace(/%[a-zA-Z%]/g,a=>{a!=="%%"&&(o++,a==="%c"&&(s=o))}),r.splice(s,0,i)},e.save=function(r){try{r?e.storage.setItem("debug",r):e.storage.removeItem("debug")}catch{}},e.load=function(){let r;try{r=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=$Lt.DEBUG),r},e.useColors=function(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=(function(){try{return localStorage}catch{}})(),e.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=(a6e?s6e:(a6e=1,s6e=function(r){function i(a){let l,c,u,f=null;function h(...p){if(!h.enabled)return;const m=h,g=Number(new Date),y=g-(l||g);m.diff=y,m.prev=l,m.curr=g,l=g,p[0]=i.coerce(p[0]),typeof p[0]!="string"&&p.unshift("%O");let b=0;p[0]=p[0].replace(/%([a-zA-Z%])/g,(v,x)=>{if(v==="%%")return"%";b++;const C=i.formatters[x];if(typeof C=="function"){const w=p[b];v=C.call(m,w),p.splice(b,1),b--}return v}),i.formatArgs.call(m,p),(m.log||i.log).apply(m,p)}return h.namespace=a,h.useColors=i.useColors(),h.color=i.selectColor(a),h.extend=o,h.destroy=i.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(c!==i.namespaces&&(c=i.namespaces,u=i.enabled(a)),u),set:p=>{f=p}}),typeof i.init=="function"&&i.init(h),h}function o(a,l){const c=i(this.namespace+(typeof l>"u"?":":l)+a);return c.log=this.log,c}function s(a,l){let c=0,u=0,f=-1,h=0;for(;c"-"+l)].join(",");return i.enable(""),a},i.enable=function(a){i.save(a),i.namespaces=a,i.names=[],i.skips=[];const l=(typeof a=="string"?a:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const c of l)c[0]==="-"?i.skips.push(c.slice(1)):i.names.push(c)},i.enabled=function(a){for(const l of i.skips)if(s(a,l))return!1;for(const l of i.names)if(s(a,l))return!0;return!1},i.humanize=(function(){if(o6e)return i6e;o6e=1;var a=1e3,l=60*a,c=60*l,u=24*c,f=7*u;function h(p,m,g,y){var b=m>=1.5*g;return Math.round(p/g)+" "+y+(b?"s":"")}return i6e=function(p,m){m=m||{};var g,y,b=typeof p;if(b==="string"&&p.length>0)return(function(v){if(!((v=String(v)).length>100)){var x=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(v);if(x){var C=parseFloat(x[1]);switch((x[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*C;case"weeks":case"week":case"w":return C*f;case"days":case"day":case"d":return C*u;case"hours":case"hour":case"hrs":case"hr":case"h":return C*c;case"minutes":case"minute":case"mins":case"min":case"m":return C*l;case"seconds":case"second":case"secs":case"sec":case"s":return C*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return C;default:return}}}})(p);if(b==="number"&&isFinite(p))return m.long?(g=p,(y=Math.abs(g))>=u?h(g,y,u,"day"):y>=c?h(g,y,c,"hour"):y>=l?h(g,y,l,"minute"):y>=a?h(g,y,a,"second"):g+" ms"):(function(v){var x=Math.abs(v);return x>=u?Math.round(v/u)+"d":x>=c?Math.round(v/c)+"h":x>=l?Math.round(v/l)+"m":x>=a?Math.round(v/a)+"s":v+"ms"})(p);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(p))}})(),i.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(r).forEach(a=>{i[a]=r[a]}),i.names=[],i.skips=[],i.formatters={},i.selectColor=function(a){let l=0;for(let c=0;c"u"?()=>!1:t=>Buffer.isBuffer(t);function c6e(t){return Object.prototype.toString.call(t)==="[object Object]"}function LLt(t){if(c6e(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(c6e(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)}const FLt=["boolean","string","number"];function NLt(){return{processOptions:t=>{const e=t.body;return!e||typeof e.pipe=="function"||MLt(e)||FLt.indexOf(typeof e)===-1&&!Array.isArray(e)&&!LLt(e)?t:Object.assign({},t,{body:JSON.stringify(t.body),headers:Object.assign({},t.headers,{"Content-Type":"application/json"})})}}}function BLt(t){return{onResponse:n=>{const r=n.headers["content-type"]||"",i=t&&t.force||r.indexOf("application/json")!==-1;return n.body&&r&&i?Object.assign({},n,{body:e(n.body)}):n},processOptions:n=>Object.assign({},n,{headers:Object.assign({Accept:"application/json"},n.headers)})};function e(n){try{return JSON.parse(n)}catch(r){throw r.message=`Failed to parsed response body as JSON: ${r.message}`,r}}}let FT={};typeof globalThis<"u"?FT=globalThis:typeof window<"u"?FT=window:typeof global<"u"?FT=global:typeof self<"u"&&(FT=self);var VLt=FT;function zLt(t={}){const e=t.implementation||VLt.Observable;if(!e)throw new Error("`Observable` is not available in global scope, and no implementation was passed");return{onReturn:(n,r)=>new e(i=>(n.error.subscribe(o=>i.error(o)),n.progress.subscribe(o=>i.next(Object.assign({type:"progress"},o))),n.response.subscribe(o=>{i.next(Object.assign({type:"response"},o)),i.complete()}),n.request.publish(r),()=>n.abort.publish()))}}function HLt(){return{onRequest:t=>{if(t.adapter!=="xhr")return;const e=t.request,n=t.context;function r(i){return o=>{const s=o.lengthComputable?o.loaded/o.total*100:-1;n.channels.progress.publish({stage:i,percent:s,total:o.total,loaded:o.loaded,lengthComputable:o.lengthComputable})}}"upload"in e&&"onprogress"in e.upload&&(e.upload.onprogress=r("upload")),"onprogress"in e&&(e.onprogress=r("download"))}}}var nYe=(t,e,n)=>(n.method==="GET"||n.method==="HEAD")&&(t.isNetworkError||!1);function ULt(t){return 100*Math.pow(2,t)+100*Math.random()}const Ude=(t={})=>(e=>{const n=e.maxRetries||5,r=e.retryDelay||ULt,i=e.shouldRetry;return{onError:(o,s)=>{const a=s.options,l=a.maxRetries||n,c=a.retryDelay||r,u=a.shouldRetry||i,f=a.attemptNumber||0;if((h=a.body)!==null&&typeof h=="object"&&typeof h.pipe=="function"||!u(o,f,a)||f>=l)return o;var h;const p=Object.assign({},s,{options:Object.assign({},a,{attemptNumber:f+1})});return setTimeout(()=>s.channels.request.publish(p),c(f)),null}}})({shouldRetry:nYe,...t});Ude.shouldRetry=nYe;function rYe(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var iYe={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},oYe={0:8203,1:8204,2:8205,3:65279};new Array(4).fill(String.fromCodePoint(oYe[0])).join("");Object.fromEntries(Object.entries(oYe).map(t=>t.reverse()));Object.fromEntries(Object.entries(iYe).map(t=>t.reverse()));var WLt=`${Object.values(iYe).map(t=>`\\u{${t.toString(16)}}`).join("")}`,u6e=new RegExp(`[${WLt}]{4,}`,"gu");function qLt(t){var e;return{cleaned:t.replace(u6e,""),encoded:((e=t.match(u6e))==null?void 0:e[0])||""}}function GLt(t){return t&&JSON.parse(qLt(JSON.stringify(t)).cleaned)}function YLt(t){return GLt(t)}function d6e(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const KLt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Wde=/_key\s*==\s*['"](.*)['"]/,XLt=/^\d*:\d*$/;function qde(t){return typeof t=="number"||typeof t=="string"&&/^\[\d+\]$/.test(t)}function Tz(t){return typeof t=="string"?Wde.test(t.trim()):typeof t=="object"&&"_key"in t}function sYe(t){if(typeof t=="string"&&XLt.test(t))return!0;if(!Array.isArray(t)||t.length!==2)return!1;const[e,n]=t;return(typeof e=="number"||e==="")&&(typeof n=="number"||n==="")}function ZLt(t,e,n){const r=typeof e=="string"?aYe(e):e;if(!Array.isArray(r))throw new Error("Path must be an array or a string");let i=t;for(let o=0;oa._key===s._key)}if(typeof s=="string"&&(i=typeof i=="object"&&i!==null?i[s]:void 0),typeof i>"u")return n}return i}function QLt(t){if(!Array.isArray(t))throw new Error("Path is not an array");return t.reduce((e,n,r)=>{const i=typeof n;if(i==="number")return`${e}[${n}]`;if(i==="string")return`${e}${r===0?"":"."}${n}`;if(Tz(n)&&n._key)return`${e}[_key=="${n._key}"]`;if(Array.isArray(n)){const[o,s]=n;return`${e}[${o}:${s}]`}throw new Error(`Unsupported path segment \`${JSON.stringify(n)}\``)},"")}function aYe(t){if(typeof t!="string")throw new Error("Path is not a string");const e=t.match(KLt);if(!e)throw new Error("Invalid path string");return e.map(JLt)}function JLt(t){return qde(t)?eFt(t):Tz(t)?tFt(t):sYe(t)?nFt(t):t}function eFt(t){return Number(t.replace(/[^\d]/g,""))}function tFt(t){return{_key:t.match(Wde)[1]}}function nFt(t){const[e,n]=t.split(":").map(r=>r===""?r:Number(r));return[e,n]}var lli=Object.freeze({__proto__:null,fromString:aYe,get:ZLt,isIndexSegment:qde,isIndexTuple:sYe,isKeySegment:Tz,reKeySegment:Wde,toString:QLt});const rFt="drafts",iFt="versions",t_=".",WF=`${rFt}${t_}`,lYe=`${iFt}${t_}`;function tf(t){return t.startsWith(WF)}function zc(t){return t.startsWith(lYe)}function m0(t){return!tf(t)&&!zc(t)}function ga(t){if(zc(t)){const e=pn(t);return WF+e}return tf(t)?t:WF+t}function Ya(t,e){if(e==="drafts"||e==="published")throw new Error('Version can not be "published" or "drafts"');return`${lYe}${e}${t_}${pn(t)}`}function Kr(t){if(!zc(t))return;const[e,n,...r]=t.split(t_);return n}function pn(t){return zc(t)?t.split(t_).slice(2).join(t_):tf(t)?t.slice(WF.length):t}const qF={"\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","'":"\\'","\\":"\\\\"},f6e={"\\f":"\f","\\n":` +`,"\\r":"\r","\\t":" ","\\'":"'","\\\\":"\\"};function oFt(t){return`$${t.map(e=>typeof e=="string"?`['${e.replace(/[\f\n\r\t'\\]/g,n=>qF[n])}']`:typeof e=="number"?`[${e}]`:e._key!==""?`[?(@._key=='${e._key.replace(/['\\]/g,n=>qF[n])}')]`:`[${e._index}]`).join("")}`}function sFt(t){return t.map(e=>typeof e=="string"?`['${e.replace(/[\f\n\r\t'\\]/g,n=>qF[n])}']`:typeof e=="number"?`[${e}]`:e._key!==""?`[?(@._key=='${e._key.replace(/['\\]/g,n=>qF[n])}')]`:`[${e._index}]`)}function cli(t){const e=[],n=/\['(.*?)'\]|\[(\d+)\]|\[\?\(@\._key=='(.*?)'\)\]/g;let r;for(;(r=n.exec(t))!==null;){if(r[1]!==void 0){const i=r[1].replace(/\\(\\|f|n|r|t|')/g,o=>f6e[o]);e.push(i);continue}if(r[2]!==void 0){e.push(parseInt(r[2],10));continue}if(r[3]!==void 0){const i=r[3].replace(/\\(\\')/g,o=>f6e[o]);e.push({_key:i,_index:-1});continue}}return e}function h6e(t){return t.map(e=>{if(typeof e=="string"||typeof e=="number")return e;if(e._index!==-1)return e._index;throw new Error(`invalid segment:${JSON.stringify(e)}`)})}function uli(t,e){if(!e?.mappings)return;const n=oFt(h6e(t));if(e.mappings[n]!==void 0)return{mapping:e.mappings[n],matchedPath:n,pathSuffix:""};const r=sFt(h6e(t));for(let i=r.length-1;i>=0;i--){const o=`$${r.slice(0,i).join("")}`,s=e.mappings[o];if(s){const a=n.substring(o.length);return{mapping:s,matchedPath:o,pathSuffix:a}}}}function aFt(t){return t!==null&&Array.isArray(t)}function OE(t,e,n=[]){if(aFt(t))return t.map((r,i)=>{if(d6e(r)){const o=r._key;if(typeof o=="string")return OE(r,e,n.concat({_key:o,_index:i}))}return OE(r,e,n.concat(i))});if(d6e(t)){if(t._type==="block"||t._type==="span"){const r={...t};return t._type==="block"?r.children=OE(t.children,e,n.concat("children")):t._type==="span"&&(r.text=OE(t.text,e,n.concat("text"))),r}return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,OE(i,e,n.concat(r))]))}return e(t,n)}let lFt=t=>crypto.getRandomValues(new Uint8Array(t)),cFt=(t,e,n)=>{let r=(2<{let s="";for(;;){let a=n(i),l=i|0;for(;l--;)if(s+=t[a[l]&r]||"",s.length===o)return s}}},Gde=(t,e=21)=>cFt(t,e,lFt),Iz=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,n)=>(n&=63,n<36?e+=n.toString(36):n<62?e+=(n-26).toString(36).toUpperCase():n>62?e+="-":e+="_",e),"");const p6e=/\r\n|[\n\r\u2028\u2029]/;function uFt(t,e,n){const r=t.split(p6e),i={start:m6e(e.start,r),end:e.end?m6e(e.end,r):void 0},{start:o,end:s,markerLines:a}=dFt(i,r),l=`${s}`.length;return t.split(p6e,s).slice(o,s).map((c,u)=>{const f=o+1+u,h=` ${` ${f}`.slice(-l)} |`,p=a[f],m=!a[f+1];if(!p)return` ${h}${c.length>0?` ${c}`:""}`;let g="";if(Array.isArray(p)){const y=c.slice(0,Math.max(p[0]-1,0)).replace(/[^\t]/g," "),b=p[1]||1;g=[` + `,h.replace(/\d/g," ")," ",y,"^".repeat(b)].join(""),m&&n&&(g+=" "+n)}return[">",h,c.length>0?` ${c}`:"",g].join("")}).join(` +`)}function dFt(t,e){const n={...t.start},r={...n,...t.end},i=2,o=3,s=n.line??-1,a=n.column??0,l=r.line,c=r.column;let u=Math.max(s-(i+1),0),f=Math.min(e.length,l+o);s===-1&&(u=0),l===-1&&(f=e.length);const h=l-s,p={};if(h)for(let m=0;m<=h;m++){const g=m+s;if(!a)p[g]=!0;else if(m===0){const y=e[g-1].length;p[g]=[a,y-a+1]}else if(m===h)p[g]=[0,c];else{const y=e[g-m].length;p[g]=[0,y]}}else a===c?a?p[s]=[a,0]:p[s]=!0:p[s]=[a,c-a];return{start:u,end:f,markerLines:p}}function m6e(t,e){let n=0;for(let r=0;rt)return{line:r+1,column:t-n};n+=i}return{line:e.length,column:e[e.length-1]?.length??0}}const aY=5;class jz extends Error{response;statusCode=400;responseBody;details;constructor(e,n){const r=uYe(e,n);super(r.message),Object.assign(this,r)}}class cYe extends Error{response;statusCode=500;responseBody;details;constructor(e){const n=uYe(e);super(n.message),Object.assign(this,n)}}function uYe(t,e){const n=t.body,r={response:t,statusCode:t.statusCode,responseBody:pFt(n,t),message:"",details:void 0};if(!rYe(n))return r.message=lY(t,n),r;const i=n.error;if(typeof i=="string"&&typeof n.message=="string")return r.message=`${i} - ${n.message}`,r;if(typeof i!="object"||i===null)return typeof i=="string"?r.message=i:typeof n.message=="string"?r.message=n.message:r.message=lY(t,n),r;if(fFt(i)||hFt(i)){const o=i.items||[],s=o.slice(0,aY).map(l=>l.error?.description).filter(Boolean);let a=s.length?`: +- ${s.join(` +- `)}`:"";return o.length>aY&&(a+=` +...and ${o.length-aY} more`),r.message=`${i.description}${a}`,r.details=n.error,r}if(dYe(i)){const o=e?.options?.query?.tag;return r.message=fYe(i,o),r.details=n.error,r}return"description"in i&&typeof i.description=="string"?(r.message=i.description,r.details=i,r):(r.message=lY(t,n),r)}function fFt(t){return"type"in t&&t.type==="mutationError"&&"description"in t&&typeof t.description=="string"}function hFt(t){return"type"in t&&t.type==="actionError"&&"description"in t&&typeof t.description=="string"}function dYe(t){return rYe(t)&&t.type==="queryParseError"&&typeof t.query=="string"&&typeof t.start=="number"&&typeof t.end=="number"}function fYe(t,e){const{query:n,start:r,end:i,description:o}=t;if(!n||typeof r>"u")return`GROQ query parse error: ${o}`;const s=e?` + +Tag: ${e}`:"";return`GROQ query parse error: +${uFt(n,{start:r,end:i},o)}${s}`}function lY(t,e){const n=typeof e=="string"?` (${mFt(e,100)})`:"",r=t.statusMessage?` ${t.statusMessage}`:"";return`${t.method}-request to ${t.url} resulted in HTTP ${t.statusCode}${r}${n}`}function pFt(t,e){return(e.headers["content-type"]||"").toLowerCase().indexOf("application/json")!==-1?JSON.stringify(t,null,2):t}function mFt(t,e){return t.length>e?`${t.slice(0,e)}…`:t}let gFt=class extends Error{projectId;addOriginUrl;constructor({projectId:e}){super("CorsOriginError"),this.name="CorsOriginError",this.projectId=e;const n=new URL(`https://sanity.io/manage/project/${e}/api`);if(typeof location<"u"){const{origin:r}=location;n.searchParams.set("cors","add"),n.searchParams.set("origin",r),this.addOriginUrl=n,this.message=`The current origin is not allowed to connect to the Live Content API. Add it here: ${n}`}else this.message=`The current origin is not allowed to connect to the Live Content API. Change your configuration here: ${n}`}};const yFt={onResponse:(t,e)=>{if(t.statusCode>=500)throw new cYe(t);if(t.statusCode>=400)throw new jz(t,e);return t}};function bFt(t={}){const e={},n=r=>t.ignoreWarnings===void 0?!1:(Array.isArray(t.ignoreWarnings)?t.ignoreWarnings:[t.ignoreWarnings]).some(i=>typeof i=="string"?r.includes(i):i instanceof RegExp?i.test(r):!1);return{onResponse:r=>{const i=r.headers["x-sanity-warning"],o=Array.isArray(i)?i:[i];for(const s of o)!s||e[s]||n(s)||(e[s]=!0,console.warn(s));return r}}}function g6e(t,e={}){return PLt([Ude({shouldRetry:vFt}),...t,bFt(e),NLt(),BLt(),HLt(),yFt,zLt({implementation:mi})])}function vFt(t,e,n){if(n.maxRetries===0)return!1;const r=n.method==="GET"||n.method==="HEAD",i=(n.uri||n.url).startsWith("/data/query"),o=t.response&&(t.response.statusCode===429||t.response.statusCode===502||t.response.statusCode===503);return(r||i)&&o?!0:Ude.shouldRetry(t,e,n)}const xFt="https://www.sanity.io/help/";function Yde(t){return xFt+t}const y6e=["image","file"],b6e=["before","after","replace"],n_=t=>{if(!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(t))throw new Error("Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters")},CFt=t=>{if(!/^[-a-z0-9]+$/i.test(t))throw new Error("`projectId` can only contain only a-z, 0-9 and dashes")},wFt=t=>{if(y6e.indexOf(t)===-1)throw new Error(`Invalid asset type: ${t}. Must be one of ${y6e.join(", ")}`)},_I=(t,e)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new Error(`${t}() takes an object of properties`)},GF=(t,e)=>{if(typeof e!="string"||!/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(e)||e.includes(".."))throw new Error(`${t}(): "${e}" is not a valid document ID`)},r_=(t,e)=>{if(!e._id)throw new Error(`${t}() requires that the document contains an ID ("_id" property)`);GF(t,e._id)},_Ft=(t,e)=>{if(typeof e!="string")throw new Error(`\`${t}()\`: \`${e}\` is not a valid document type`)},hYe=(t,e)=>{if(!e._type)throw new Error(`\`${t}()\` requires that the document contains a type (\`_type\` property)`);_Ft(t,e._type)},SFt=(t,e)=>{if(e._id&&e._id!==t)throw new Error(`The provided document ID (\`${e._id}\`) does not match the generated version ID (\`${t}\`)`)},kFt=(t,e,n)=>{const r="insert(at, selector, items)";if(b6e.indexOf(t)===-1){const i=b6e.map(o=>`"${o}"`).join(", ");throw new Error(`${r} takes an "at"-argument which is one of: ${i}`)}if(typeof e!="string")throw new Error(`${r} takes a "selector"-argument which must be a string`);if(!Array.isArray(n))throw new Error(`${r} takes an "items"-argument which must be an array`)},pv=t=>{if(t.dataset)return t.dataset;const e=t.resource;if(e&&e.type==="dataset"){const n=e.id.split(".");if(n.length!==2)throw new Error('Dataset resource ID must be in the format "project.dataset"');return n[1]}throw new Error("`dataset` must be provided to perform queries")},pYe=t=>{if(typeof t!="string"||!/^[a-z0-9._-]{1,75}$/i.test(t))throw new Error("Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.");return t},mYe=t=>{const e=t.resource;if(!e)throw new Error("`resource` must be provided to perform resource queries");const{type:n,id:r}=e;switch(n){case"dataset":{if(r.split(".").length!==2)throw new Error('Dataset resource ID must be in the format "project.dataset"');return}case"dashboard":case"media-library":case"canvas":return;default:throw new Error(`Unsupported resource type: ${n.toString()}`)}},D5=(t,e)=>{if(e.resource)throw new Error(`\`${t}\` does not support resource-based operations`)};function EFt(t){let e=!1,n;return(...r)=>(e||(n=t(...r),e=!0),n)}const J7=t=>EFt((...e)=>console.warn(t.join(" "),...e)),TFt=J7(["Because you set `withCredentials` to true, we will override your `useCdn`","setting to be false since (cookie-based) credentials are never set on the CDN"]),IFt=J7(["Since you haven't set a value for `useCdn`, we will deliver content using our","global, edge-cached API-CDN. If you wish to have content delivered faster, set","`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]),jFt=J7(["The Sanity client is configured with the `perspective` set to `drafts` or `previewDrafts`, which doesn't support the API-CDN.","The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."]),AFt=J7(["The `previewDrafts` perspective has been renamed to `drafts` and will be removed in a future API version"]),RFt=J7(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",`See ${Yde("js-client-browser-token")} for more information and how to hide this warning.`]),DFt=J7(["You have configured Sanity client to use a token, but also provided `withCredentials: true`.","This is no longer supported - only token will be used - remove `withCredentials: true`."]),OFt=J7(["Using the Sanity client without specifying an API version is deprecated.",`See ${Yde("js-client-api-version")}`]),PFt=J7(["You have called `createVersion()` with a defined `document`. The recommended approach is to provide a `baseId` and `releaseId` instead."]),$Ft=J7(["The `~experimental_resource` configuration property has been renamed to `resource`.","Please update your client configuration to use `resource` instead. Support for `~experimental_resource` will be removed in a future version."]),MFt="apicdn.sanity.io",SI={apiHost:"https://api.sanity.io",apiVersion:"1",useProjectHostname:!0,stega:{enabled:!1}},LFt=["localhost","127.0.0.1","0.0.0.0"],FFt=t=>LFt.indexOf(t)!==-1;function NFt(t){if(t==="1"||t==="X")return;const e=new Date(t);if(!(/^\d{4}-\d{2}-\d{2}$/.test(t)&&e instanceof Date&&e.getTime()>0))throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`")}function gYe(t){if(Array.isArray(t)&&t.length>1&&t.includes("raw"))throw new TypeError('Invalid API perspective value: "raw". The raw-perspective can not be combined with other perspectives')}const yYe=(t,e)=>{const n={...e,...t,stega:{...typeof e.stega=="boolean"?{enabled:e.stega}:e.stega||SI.stega,...typeof t.stega=="boolean"?{enabled:t.stega}:t.stega||{}}};n.apiVersion||OFt();const r={...SI,...n};r["~experimental_resource"]&&!r.resource&&($Ft(),r.resource=r["~experimental_resource"]);const i=r.resource,o=r.useProjectHostname&&!i;if(typeof Promise>"u"){const p=Yde("js-client-promise-polyfill");throw new Error(`No native Promise-implementation found, polyfill needed - see ${p}`)}if(o&&!r.projectId)throw new Error("Configuration must contain `projectId`");if(i&&mYe(r),typeof r.perspective<"u"&&gYe(r.perspective),"encodeSourceMap"in r)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?");if("encodeSourceMapAtPath"in r)throw new Error("It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?");if(typeof r.stega.enabled!="boolean")throw new Error(`stega.enabled must be a boolean, received ${r.stega.enabled}`);if(r.stega.enabled&&r.stega.studioUrl===void 0)throw new Error("stega.studioUrl must be defined when stega.enabled is true");if(r.stega.enabled&&typeof r.stega.studioUrl!="string"&&typeof r.stega.studioUrl!="function")throw new Error(`stega.studioUrl must be a string or a function, received ${r.stega.studioUrl}`);const s=typeof window<"u"&&window.location&&window.location.hostname,a=s&&FFt(window.location.hostname),l=!!r.token;r.withCredentials&&l&&(DFt(),r.withCredentials=!1),s&&a&&l&&r.ignoreBrowserTokenWarning!==!0?RFt():typeof r.useCdn>"u"&&IFt(),o&&CFt(r.projectId),r.dataset&&n_(r.dataset),"requestTagPrefix"in r&&(r.requestTagPrefix=r.requestTagPrefix?pYe(r.requestTagPrefix).replace(/\.+$/,""):void 0),r.apiVersion=`${r.apiVersion}`.replace(/^v/,""),r.isDefaultApi=r.apiHost===SI.apiHost,r.useCdn===!0&&r.withCredentials&&TFt(),r.useCdn=r.useCdn!==!1&&!r.withCredentials,NFt(r.apiVersion);const c=r.apiHost.split("://",2),u=c[0],f=c[1],h=r.isDefaultApi?MFt:f;return o?(r.url=`${u}://${r.projectId}.${f}/v${r.apiVersion}`,r.cdnUrl=`${u}://${r.projectId}.${h}/v${r.apiVersion}`):(r.url=`${r.apiHost}/v${r.apiVersion}`,r.cdnUrl=r.url),r};class bYe extends Error{name="ConnectionFailedError"}class BFt extends Error{name="DisconnectError";reason;constructor(e,n,r={}){super(e,r),this.reason=n}}class vYe extends Error{name="ChannelError";data;constructor(e,n){super(e),this.data=n}}class VFt extends Error{name="MessageError";data;constructor(e,n,r={}){super(e,r),this.data=n}}class v6e extends Error{name="MessageParseError"}const zFt=["channelError","disconnect"];function xYe(t,e){return Ga(()=>{const n=t();return Qce(n)?n:Ke(n)}).pipe(Kt(n=>HFt(n,e)))}function HFt(t,e){return new mi(n=>{const r=e.includes("open"),i=e.includes("reconnect");function o(c){if("data"in c){const[u,f]=x6e(c);n.error(u?new v6e("Unable to parse EventSource error message",{cause:f}):new VFt((f?.data).message,f));return}t.readyState===t.CLOSED?n.error(new bYe("EventSource connection failed")):i&&n.next({type:"reconnect"})}function s(){n.next({type:"open"})}function a(c){const[u,f]=x6e(c);if(u){n.error(new v6e("Unable to parse EventSource message",{cause:u}));return}if(c.type==="channelError"){const h=new URL(t.url).searchParams.get("tag");n.error(new vYe(UFt(f?.data,h),f.data));return}if(c.type==="disconnect"){n.error(new BFt(`Server disconnected client: ${f.data?.reason||"unknown error"}`));return}n.next({type:c.type,id:c.lastEventId,...f.data?{data:f.data}:{}})}t.addEventListener("error",o),r&&t.addEventListener("open",s);const l=[...new Set([...zFt,...e])].filter(c=>c!=="error"&&c!=="open"&&c!=="reconnect");return l.forEach(c=>t.addEventListener(c,a)),()=>{t.removeEventListener("error",o),r&&t.removeEventListener("open",s),l.forEach(c=>t.removeEventListener(c,a)),t.close()}})}function x6e(t){try{const e=typeof t.data=="string"&&JSON.parse(t.data);return[null,{type:t.type,id:t.lastEventId,...WFt(e)?{}:{data:e}}]}catch(e){return[e,null]}}function UFt(t,e){const n=t.error;return n?dYe(n)?fYe(n,e):n.description?n.description:typeof n=="string"?n:JSON.stringify(n,null,2):t.message||"Unknown listener error"}function WFt(t){for(const e in t)return!1;return!0}function CYe(t){if(typeof t=="string")return{id:t};if(Array.isArray(t))return{query:"*[_id in $ids]",params:{ids:t}};if(typeof t=="object"&&t!==null&&"query"in t&&typeof t.query=="string")return"params"in t&&typeof t.params=="object"&&t.params!==null?{query:t.query,params:t.params}:{query:t.query};const e=["* Document ID ()","* Array of document IDs","* Object containing `query`"].join(` +`);throw new Error(`Unknown selection - must be one of: + +${e}`)}class wYe{selection;operations;constructor(e,n={}){this.selection=e,this.operations=n}set(e){return this._assign("set",e)}setIfMissing(e){return this._assign("setIfMissing",e)}diffMatchPatch(e){return _I("diffMatchPatch",e),this._assign("diffMatchPatch",e)}unset(e){if(!Array.isArray(e))throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");return this.operations=Object.assign({},this.operations,{unset:e}),this}inc(e){return this._assign("inc",e)}dec(e){return this._assign("dec",e)}insert(e,n,r){return kFt(e,n,r),this._assign("insert",{[e]:n,items:r})}append(e,n){return this.insert("after",`${e}[-1]`,n)}prepend(e,n){return this.insert("before",`${e}[0]`,n)}splice(e,n,r,i){const o=typeof r>"u"||r===-1,s=n<0?n-1:n,a=o?-1:Math.max(0,n+r),l=s<0&&a>=0?"":a,c=`${e}[${s}:${l}]`;return this.insert("replace",c,i||[])}ifRevisionId(e){return this.operations.ifRevisionID=e,this}serialize(){return{...CYe(this.selection),...this.operations}}toJSON(){return this.serialize()}reset(){return this.operations={},this}_assign(e,n,r=!0){return _I(e,n),this.operations=Object.assign({},this.operations,{[e]:Object.assign({},r&&this.operations[e]||{},n)}),this}_set(e,n){return this._assign(e,n,!1)}}class Qb extends wYe{#t;constructor(e,n,r){super(e,n),this.#t=r}clone(){return new Qb(this.selection,{...this.operations},this.#t)}commit(e){if(!this.#t)throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const n=typeof this.selection=="string",r=Object.assign({returnFirst:n,returnDocuments:!0},e);return this.#t.mutate({patch:this.serialize()},r)}}class K4 extends wYe{#t;constructor(e,n,r){super(e,n),this.#t=r}clone(){return new K4(this.selection,{...this.operations},this.#t)}commit(e){if(!this.#t)throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");const n=typeof this.selection=="string",r=Object.assign({returnFirst:n,returnDocuments:!0},e);return this.#t.mutate({patch:this.serialize()},r)}}const _Ye={returnDocuments:!1};class SYe{operations;trxId;constructor(e=[],n){this.operations=e,this.trxId=n}create(e){return _I("create",e),this._add({create:e})}createIfNotExists(e){const n="createIfNotExists";return _I(n,e),r_(n,e),this._add({[n]:e})}createOrReplace(e){const n="createOrReplace";return _I(n,e),r_(n,e),this._add({[n]:e})}delete(e){return GF("delete",e),this._add({delete:{id:e}})}transactionId(e){return e?(this.trxId=e,this):this.trxId}serialize(){return[...this.operations]}toJSON(){return this.serialize()}reset(){return this.operations=[],this}_add(e){return this.operations.push(e),this}}class Az extends SYe{#t;constructor(e,n,r){super(e,r),this.#t=n}clone(){return new Az([...this.operations],this.#t,this.trxId)}commit(e){if(!this.#t)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.#t.mutate(this.serialize(),Object.assign({transactionId:this.trxId},_Ye,e||{}))}patch(e,n){const r=typeof n=="function",i=typeof e!="string"&&e instanceof K4,o=typeof e=="object"&&("query"in e||"id"in e);if(i)return this._add({patch:e.serialize()});if(r){const s=n(new K4(e,{},this.#t));if(!(s instanceof K4))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:s.serialize()})}if(o){const s=new K4(e,n||{},this.#t);return this._add({patch:s.serialize()})}return this._add({patch:{id:e,...n}})}}class Rz extends SYe{#t;constructor(e,n,r){super(e,r),this.#t=n}clone(){return new Rz([...this.operations],this.#t,this.trxId)}commit(e){if(!this.#t)throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");return this.#t.mutate(this.serialize(),Object.assign({transactionId:this.trxId},_Ye,e||{}))}patch(e,n){const r=typeof n=="function";if(typeof e!="string"&&e instanceof Qb)return this._add({patch:e.serialize()});if(r){const i=n(new Qb(e,{},this.#t));if(!(i instanceof Qb))throw new Error("function passed to `patch()` must return the patch");return this._add({patch:i.serialize()})}return this._add({patch:{id:e,...n}})}}const qFt="X-Sanity-Project-ID";function GFt(t,e={}){const n={};t.headers&&Object.assign(n,t.headers);const r=e.token||t.token;r&&(n.Authorization=`Bearer ${r}`),!e.useGlobalApi&&!t.useProjectHostname&&t.projectId&&(n[qFt]=t.projectId);const i=!!(typeof e.withCredentials>"u"?t.withCredentials:e.withCredentials),o=typeof e.timeout>"u"?t.timeout:e.timeout;return Object.assign({},e,{headers:Object.assign({},n,e.headers||{}),timeout:typeof o>"u"?300*1e3:o,proxy:e.proxy||t.proxy,json:!0,withCredentials:i,fetch:typeof e.fetch=="object"&&typeof t.fetch=="object"?{...t.fetch,...e.fetch}:e.fetch||t.fetch})}const kYe=({query:t,params:e={},options:n={}})=>{const r=new URLSearchParams,{tag:i,includeMutations:o,returnQuery:s,...a}=n;i&&r.append("tag",i),r.append("query",t);for(const[l,c]of Object.entries(e))c!==void 0&&r.append(`$${l}`,JSON.stringify(c));for(const[l,c]of Object.entries(a))c&&r.append(l,`${c}`);return s===!1&&r.append("returnQuery","false"),o===!1&&r.append("includeMutations","false"),`?${r}`},YFt=(t,e)=>t===!1?void 0:typeof t>"u"?e:t,KFt=(t={})=>({dryRun:t.dryRun,returnIds:!0,returnDocuments:YFt(t.returnDocuments,!0),visibility:t.visibility||"sync",autoGenerateArrayKeys:t.autoGenerateArrayKeys,skipCrossDatasetReferenceValidation:t.skipCrossDatasetReferenceValidation}),Kde=t=>t.type==="response",XFt=t=>t.body,ZFt=(t,e)=>t.reduce((n,r)=>(n[e(r)]=r,n),Object.create(null)),QFt=11264;function EYe(t,e,n,r,i={},o={}){const s="stega"in o?{...n||{},...typeof o.stega=="boolean"?{enabled:o.stega}:o.stega||{}}:n,a=s.enabled?YLt(i):i,l=o.filterResponse===!1?m=>m:m=>m.result,{cache:c,next:u,...f}={useAbortSignal:typeof o.signal<"u",resultSourceMap:s.enabled?"withKeyArraySelector":o.resultSourceMap,...o,returnQuery:o.filterResponse===!1&&o.returnQuery!==!1},h=typeof c<"u"||typeof u<"u"?{...f,fetch:{cache:c,next:u}}:f,p=mv(t,e,"query",{query:r,params:a},h);return s.enabled?p.pipe(P4t(Ei(wc(()=>import("./stegaEncodeSourceMap-BX0HOpUT.js"),[]).then(function(m){return m.stegaEncodeSourceMap$1}).then(({stegaEncodeSourceMap:m})=>m))),Je(([m,g])=>{const y=g(m.result,m.resultSourceMap,s);return l({...m,result:y})})):p.pipe(Je(l))}function i_(t,e,n,r={}){const i=(()=>{if(!r.releaseId)return n;const s=Kr(n);if(!s){if(tf(n))throw new Error(`The document ID (\`${n}\`) is a draft, but \`options.releaseId\` is set as \`${r.releaseId}\``);return Ya(n,r.releaseId)}if(s!==r.releaseId)throw new Error(`The document ID (\`${n}\`) is already a version of \`${s}\` release, but this does not match the provided \`options.releaseId\` (\`${r.releaseId}\`)`);return n})(),o={uri:sm(t,"doc",i),json:!0,tag:r.tag,signal:r.signal,query:r.includeAllVersions!==void 0?{includeAllVersions:r.includeAllVersions}:void 0};return bR(t,e,o).pipe(nn(Kde),Je(s=>{const a=s.body.documents;return a?r.includeAllVersions?a:a[0]:r.includeAllVersions?[]:void 0}))}function TYe(t,e,n,r={}){const i={uri:sm(t,"doc",n.join(",")),json:!0,tag:r.tag,signal:r.signal};return bR(t,e,i).pipe(nn(Kde),Je(o=>{const s=ZFt(o.body.documents||[],a=>a._id);return n.map(a=>s[a]||null)}))}function IYe(t,e,n,r={}){return mv(t,e,"query",{query:"*[sanity::partOfRelease($releaseId)]",params:{releaseId:n}},r)}function jYe(t,e,n,r){return r_("createIfNotExists",n),Dz(t,e,n,"createIfNotExists",r)}function AYe(t,e,n,r){return r_("createOrReplace",n),Dz(t,e,n,"createOrReplace",r)}function RYe(t,e,n,r,i){return r_("createVersion",n),hYe("createVersion",n),PFt(),gc(t,e,{actionType:"sanity.action.document.version.create",publishedId:r,document:n},i)}function DYe(t,e,n,r,i,o,s){if(!r)throw new Error("`createVersion()` requires `baseId` when no `document` is provided");if(!n)throw new Error("`createVersion()` requires `publishedId` when `baseId` is provided");GF("createVersion",r),GF("createVersion",n);const a={actionType:"sanity.action.document.version.create",publishedId:n,baseId:r,versionId:i?Ya(n,i):ga(n),ifBaseRevisionId:o};return gc(t,e,a,s)}function OYe(t,e,n,r){return mv(t,e,"mutate",{mutations:[{delete:CYe(n)}]},r)}function PYe(t,e,n,r=!1,i){return gc(t,e,{actionType:"sanity.action.document.version.discard",versionId:n,purge:r},i)}function $Ye(t,e,n,r){return r_("replaceVersion",n),hYe("replaceVersion",n),gc(t,e,{actionType:"sanity.action.document.version.replace",document:n},r)}function MYe(t,e,n,r,i){return gc(t,e,{actionType:"sanity.action.document.version.unpublish",versionId:n,publishedId:r},i)}function LYe(t,e,n,r){let i;n instanceof K4||n instanceof Qb?i={patch:n.serialize()}:n instanceof Az||n instanceof Rz?i=n.serialize():i=n;const o=Array.isArray(i)?i:[i],s=r&&r.transactionId||void 0;return mv(t,e,"mutate",{mutations:o,transactionId:s},r)}function gc(t,e,n,r){const i=Array.isArray(n)?n:[n],o=r&&r.transactionId||void 0,s=r&&r.skipCrossDatasetReferenceValidation||void 0,a=r&&r.dryRun||void 0;return mv(t,e,"actions",{actions:i,transactionId:o,skipCrossDatasetReferenceValidation:s,dryRun:a},r)}function mv(t,e,n,r,i={}){const o=n==="mutate",s=n==="actions",a=n==="query",l=o||s?"":kYe(r),c=!o&&!s&&l.length{if(!o)return w;const _=w.results||[];if(i.returnDocuments)return f?_[0]&&_[0].document:_.map(I=>I.document);const S=f?"documentId":"documentIds",k=f?_[0]&&_[0].id:_.map(I=>I.id);return{transactionId:w.transactionId,results:_,[S]:k}}))}function Dz(t,e,n,r,i={}){const o={[r]:n},s=Object.assign({returnFirst:!0,returnDocuments:!0},i);return mv(t,e,"mutate",{mutations:[o]},s)}const yR=t=>{const e=t.config();return e.dataset!==void 0&&e.projectId!==void 0||e.resource!==void 0},FYe=(t,e)=>yR(t)&&e.startsWith(sm(t,"query")),JFt=(t,e)=>yR(t)&&e.startsWith(sm(t,"mutate")),eNt=(t,e)=>yR(t)&&e.startsWith(sm(t,"doc","")),tNt=(t,e)=>yR(t)&&e.startsWith(sm(t,"listen")),nNt=(t,e)=>yR(t)&&e.startsWith(sm(t,"history","")),rNt=(t,e)=>e.startsWith("/data/")||FYe(t,e)||JFt(t,e)||eNt(t,e)||tNt(t,e)||nNt(t,e);function bR(t,e,n){const r=n.url||n.uri,i=t.config(),o=typeof n.canUseCdn>"u"?["GET","HEAD"].indexOf(n.method||"GET")>=0&&rNt(t,r):n.canUseCdn;let s=(n.useCdn??i.useCdn)&&o;const a=n.tag&&i.requestTagPrefix?[i.requestTagPrefix,n.tag].join("."):n.tag||i.requestTagPrefix;if(a&&n.tag!==null&&(n.query={tag:pYe(a),...n.query}),["GET","HEAD","POST"].indexOf(n.method||"GET")>=0&&FYe(t,r)){const u=n.resultSourceMap??i.resultSourceMap;u!==void 0&&u!==!1&&(n.query={resultSourceMap:u,...n.query});const f=n.perspective||i.perspective;typeof f<"u"&&(f==="previewDrafts"&&AFt(),gYe(f),n.query={perspective:Array.isArray(f)?f.join(","):f,...n.query},(Array.isArray(f)&&f.length>0||f==="previewDrafts"||f==="drafts")&&s&&(s=!1,jFt())),n.lastLiveEventId&&(n.query={...n.query,lastLiveEventId:n.lastLiveEventId}),n.returnQuery===!1&&(n.query={returnQuery:"false",...n.query}),s&&n.cacheMode=="noStale"&&(n.query={cacheMode:"noStale",...n.query})}const l=GFt(i,Object.assign({},n,{url:Xde(t,r,s)})),c=new mi(u=>e(l,i.requester).subscribe(u));return n.signal?c.pipe(iNt(n.signal)):c}function iu(t,e,n){return bR(t,e,n).pipe(nn(r=>r.type==="response"),Je(r=>r.body))}function sm(t,e,n){const r=t.config();if(r.resource){mYe(r);const s=aNt(r),a=n!==void 0?`${e}/${n}`:e;return`${s}/${a}`.replace(/\/($|\?)/,"$1")}const i=pv(r),o=`/${e}/${i}`;return`/data${n!==void 0?`${o}/${n}`:o}`.replace(/\/($|\?)/,"$1")}function Xde(t,e,n=!1){const{url:r,cdnUrl:i}=t.config();return`${n?i:r}/${e.replace(/^\//,"")}`}function iNt(t){return e=>new mi(n=>{const r=()=>n.error(sNt(t));if(t&&t.aborted){r();return}const i=e.subscribe(n);return t.addEventListener("abort",r),()=>{t.removeEventListener("abort",r),i.unsubscribe()}})}const oNt=!!globalThis.DOMException;function sNt(t){if(oNt)return new DOMException(t?.reason??"The operation was aborted.","AbortError");const e=new Error(t?.reason??"The operation was aborted.");return e.name="AbortError",e}const aNt=t=>{const e=t.resource;if(!e)throw new Error("`resource` must be provided to perform resource queries");const{type:n,id:r}=e;switch(n){case"dataset":{const i=r.split(".");if(i.length!==2)throw new Error('Dataset ID must be in the format "project.dataset"');return`/projects/${i[0]}/datasets/${i[1]}`}case"canvas":return`/canvases/${r}`;case"media-library":return`/media-libraries/${r}`;case"dashboard":return`/dashboards/${r}`;default:throw new Error(`Unsupported resource type: ${n.toString()}`)}};function NYe(t,e,n){const r=pv(t.config());return iu(t,e,{method:"POST",uri:`/agent/action/generate/${r}`,body:n})}function lNt(t,e,n){const r=pv(t.config());return iu(t,e,{method:"POST",uri:`/agent/action/patch/${r}`,body:n})}function cNt(t,e,n){const r=pv(t.config());return iu(t,e,{method:"POST",uri:`/agent/action/prompt/${r}`,body:n})}function BYe(t,e,n){const r=pv(t.config());return iu(t,e,{method:"POST",uri:`/agent/action/transform/${r}`,body:n})}function VYe(t,e,n){const r=pv(t.config());return iu(t,e,{method:"POST",uri:`/agent/action/translate/${r}`,body:n})}class uNt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}generate(e){return NYe(this.#t,this.#e,e)}transform(e){return BYe(this.#t,this.#e,e)}translate(e){return VYe(this.#t,this.#e,e)}}class dNt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}generate(e){return co(NYe(this.#t,this.#e,e))}transform(e){return co(BYe(this.#t,this.#e,e))}translate(e){return co(VYe(this.#t,this.#e,e))}prompt(e){return co(cNt(this.#t,this.#e,e))}patch(e){return co(lNt(this.#t,this.#e,e))}}class fNt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}upload(e,n,r){return zYe(this.#t,this.#e,e,n,r)}}class hNt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}upload(e,n,r){const i=zYe(this.#t,this.#e,e,n,r);return co(i.pipe(nn(o=>o.type==="response"),Je(o=>o.body.document)))}}function zYe(t,e,n,r,i={}){wFt(n);let o=i.extract||void 0;o&&!o.length&&(o=["none"]);const s=t.config(),a=mNt(i,r),{tag:l,label:c,title:u,description:f,creditLine:h,filename:p,source:m}=a,g=s.resource?.type==="media-library",y=g?{title:u,filename:p}:{label:c,title:u,description:f,filename:p,meta:o,creditLine:h};return m&&!g&&(y.sourceId=m.id,y.sourceName=m.name,y.sourceUrl=m.url),bR(t,e,{tag:l,method:"POST",timeout:a.timeout||0,uri:pNt(s,n),headers:a.contentType?{"Content-Type":a.contentType}:{},query:y,body:r})}function pNt(t,e){const n=e==="image"?"images":"files",r=t.resource;if(r){const{type:o,id:s}=r;switch(o){case"dataset":throw new Error("Assets are not supported for dataset resources, yet. Configure the client with `{projectId: , dataset: }` instead.");case"canvas":return`/canvases/${s}/assets/${n}`;case"media-library":return`/media-libraries/${s}/upload`;case"dashboard":return`/dashboards/${s}/assets/${n}`;default:throw new Error(`Unsupported resource type: ${o.toString()}`)}}const i=pv(t);return`assets/${n}/${i}`}function mNt(t,e){return typeof File>"u"||!(e instanceof File)?t:Object.assign({filename:t.preserveFilename===!1?void 0:e.name,contentType:e.type},t)}var gNt=(t,e)=>Object.keys(e).concat(Object.keys(t)).reduce((n,r)=>(n[r]=typeof t[r]>"u"?e[r]:t[r],n),{});const yNt=(t,e)=>e.reduce((n,r)=>(typeof t[r]>"u"||(n[r]=t[r]),n),{}),HYe=Ga(()=>wc(()=>import("./browser-BzyRemDg.js").then(t=>t.b),[])).pipe(Je(({default:t})=>t),bo(1));function UYe(){return function(t){return t.pipe(tr((e,n)=>e instanceof bYe?Ka(Ke({type:"reconnect"}),Cs(1e3).pipe(Kt(()=>n))):Bd(()=>e)))}}const bNt=14800,vNt=["includePreviousRevision","includeResult","includeMutations","includeAllVersions","visibility","effectFormat","enableResume","tag"],xNt={includeResult:!0};function WYe(t,e,n={}){const{url:r,token:i,withCredentials:o,requestTagPrefix:s,headers:a}=this.config(),l=n.tag&&s?[s,n.tag].join("."):n.tag,c={...gNt(n,xNt),tag:l},u=yNt(c,vNt),f=kYe({query:t,params:e,options:{tag:l,...u}}),h=`${r}${sm(this,"listen",f)}`;if(h.length>bNt)return Bd(()=>new Error("Query too large for listener"));const p=c.events?c.events:["mutation"],m={};return o&&(m.withCredentials=!0),(i||a)&&(m.headers={},i&&(m.headers.Authorization=`Bearer ${i}`),a&&Object.assign(m.headers,a)),xYe(()=>(typeof EventSource>"u"||m.headers?HYe:Ke(EventSource)).pipe(Je(g=>new g(h,m))),p).pipe(UYe(),nn(g=>p.includes(g.type)),Je(g=>({type:g.type,..."data"in g?g.data:{}})))}function CNt(t,e){return wNt(typeof t=="function"?{predicate:t,...e}:t)}function wNt(t){return e=>{let n,r=!1;const{predicate:i,...o}=t,s=e.pipe(Oi(l=>{t.predicate(l)&&(r=!0,n=l)}),$g(()=>{r=!1,n=void 0}),sc(o)),a=new mi(l=>{r&&l.next(n),l.complete()});return ki(s,a)}}const C6e="2021-03-25";class qYe{#t;constructor(e){this.#t=e}events({includeDrafts:e=!1,tag:n}={}){const{projectId:r,apiVersion:i,token:o,withCredentials:s,requestTagPrefix:a,headers:l}=this.#t.config(),c=i.replace(/^v/,"");if(c!=="X"&&c(typeof EventSource>"u"||p.headers?HYe:Ke(EventSource)).pipe(Je(x=>new x(f.href,p))),["message","restart","welcome","reconnect","goaway"]),b=_Nt(f,{method:"OPTIONS",mode:"cors",credentials:p.withCredentials?"include":"omit",headers:p.headers}).pipe(tr(()=>{throw new gFt({projectId:r})})),v=y.pipe(UYe(),Kt(x=>x.type==="reconnect"?b.pipe(Kt(()=>Ke(x))):Ke(x)),tr(x=>b.pipe(Kt(()=>{throw x}))),Je(x=>{if(x.type==="message"){const{data:C,...w}=x;return{...w,tags:C.tags}}return x})).pipe($g(()=>cY.delete(m)),CNt({predicate:x=>x.type==="welcome"}));return cY.set(m,v),v}}function _Nt(t,e){return new mi(n=>{const r=new AbortController,i=r.signal;return fetch(t,{...e,signal:r.signal}).then(o=>{n.next(o),n.complete()},o=>{i.aborted||n.error(o)}),()=>r.abort()})}const cY=new Map;class SNt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}create(e,n){return fw(this.#t,this.#e,"PUT",e,n)}edit(e,n){return fw(this.#t,this.#e,"PATCH",e,n)}delete(e){return fw(this.#t,this.#e,"DELETE",e)}list(){D5("dataset",this.#t.config());const e=this.#t.config(),n=e.projectId;let r="/datasets";return e.useProjectHostname===!1&&(r=`/projects/${n}/datasets`),iu(this.#t,this.#e,{uri:r,tag:null})}getEmbeddingsSettings(e){return D5("dataset",this.#t.config()),n_(e),iu(this.#t,this.#e,{uri:YF(this.#t,e),tag:null})}editEmbeddingsSettings(e,n){return D5("dataset",this.#t.config()),n_(e),iu(this.#t,this.#e,{method:"PUT",uri:YF(this.#t,e),body:n,tag:null})}}class kNt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}create(e,n){return D5("dataset",this.#t.config()),co(fw(this.#t,this.#e,"PUT",e,n))}edit(e,n){return D5("dataset",this.#t.config()),co(fw(this.#t,this.#e,"PATCH",e,n))}delete(e){return D5("dataset",this.#t.config()),co(fw(this.#t,this.#e,"DELETE",e))}list(){D5("dataset",this.#t.config());const e=this.#t.config(),n=e.projectId;let r="/datasets";return e.useProjectHostname===!1&&(r=`/projects/${n}/datasets`),co(iu(this.#t,this.#e,{uri:r,tag:null}))}getEmbeddingsSettings(e){return D5("dataset",this.#t.config()),n_(e),co(iu(this.#t,this.#e,{uri:YF(this.#t,e),tag:null}))}editEmbeddingsSettings(e,n){return D5("dataset",this.#t.config()),n_(e),co(iu(this.#t,this.#e,{method:"PUT",uri:YF(this.#t,e),body:n,tag:null}))}}function YF(t,e){const n=t.config();return n.useProjectHostname===!1?`/projects/${n.projectId}/datasets/${e}/settings/embeddings`:`/datasets/${e}/settings/embeddings`}function fw(t,e,n,r,i){return D5("dataset",t.config()),n_(r),iu(t,e,{method:n,uri:`/datasets/${r}`,body:i,tag:null})}class GYe{#t;#e;constructor(e,n){this.#t=e,this.#e=n}getPlaybackInfo(e,n={}){const r=this.#t.config(),i=(r.resource||r["~experimental_resource"])?.id,{instanceId:o,libraryId:s}=jNt(e),a=s||i;if(!a)throw new Error("Could not determine Media Library ID - you need to provide a valid Media Library ID in the client config or a Media Library GDR");const l=ANt(o,a),c=RNt(n);return iu(this.#t,this.#e,{method:"GET",uri:l,query:c})}}class ENt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}getPlaybackInfo(e,n={}){return co(new GYe(this.#t.observable,this.#e).getPlaybackInfo(e,n))}}const TNt=/^media-library:(ml[^:]+):([^:]+)$/;function INt(t){return typeof t=="object"&&"_ref"in t}function jNt(t){const e=INt(t)?t._ref:t,n=TNt.exec(e);if(n){const[,r,i]=n;return{libraryId:r,instanceId:i}}if(typeof t=="string"&&t.startsWith("video-"))return{instanceId:t};throw new Error(`Invalid video asset instance identifier "${e}": must be a valid video instance id or a Global Dataset Reference (GDR) to the video asset in the Media Library`)}function ANt(t,e){return`/media-libraries/${e}/video/${t}/playback-info`}function RNt(t){const e={};if(t.transformations){const{thumbnail:n,animated:r,storyboard:i}=t.transformations;n&&(n.width&&(e.thumbnailWidth=n.width),n.height&&(e.thumbnailHeight=n.height),n.time!==void 0&&(e.thumbnailTime=n.time),n.fit&&(e.thumbnailFit=n.fit),n.format&&(e.thumbnailFormat=n.format)),r&&(r.width&&(e.animatedWidth=r.width),r.height&&(e.animatedHeight=r.height),r.start!==void 0&&(e.animatedStart=r.start),r.end!==void 0&&(e.animatedEnd=r.end),r.fps&&(e.animatedFps=r.fps),r.format&&(e.animatedFormat=r.format)),i&&i.format&&(e.storyboardFormat=i.format)}return t.expiration&&(e.expiration=t.expiration),e}class DNt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}list(e){const n={},r="/projects";return e?.includeMembers===!1&&(n.includeMembers="false"),e?.organizationId&&(n.organizationId=e.organizationId),iu(this.#t,this.#e,{uri:r,query:n})}getById(e){return iu(this.#t,this.#e,{uri:`/projects/${e}`})}}class ONt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}list(e){const n={},r="/projects";return e?.includeMembers===!1&&(n.includeMembers="false"),e?.organizationId&&(n.organizationId=e.organizationId),co(iu(this.#t,this.#e,{uri:r,query:n}))}getById(e){return co(iu(this.#t,this.#e,{uri:`/projects/${e}`}))}}const w6e=Gde("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",8),KF=(t,e)=>e?Ya(t,e):ga(t);function XF(t,{releaseId:e,publishedId:n,document:r}){if(n&&r._id){const i=KF(n,e);return SFt(i,r),i}if(r._id){const i=tf(r._id),o=zc(r._id);if(!i&&!o)throw new Error(`\`${t}()\` requires a document with an \`_id\` that is a version or draft ID`);if(e){if(i)throw new Error(`\`${t}()\` was called with a document ID (\`${r._id}\`) that is a draft ID, but a release ID (\`${e}\`) was also provided.`);const s=Kr(r._id);if(s!==e)throw new Error(`\`${t}()\` was called with a document ID (\`${r._id}\`) that is a version ID, but the release ID (\`${e}\`) does not match the document's version ID (\`${s}\`).`)}return r._id}if(n)return KF(n,e);throw new Error(`\`${t}()\` requires either a publishedId or a document with an \`_id\``)}const PNt=(t,e)=>{if(typeof t=="object"&&t!==null&&("releaseId"in t||"metadata"in t)){const{releaseId:n=w6e(),metadata:r={}}=t;return[n,r,e]}return[w6e(),{},t]},YYe=(t,e)=>{const[n,r,i]=PNt(t,e),o={...r,releaseType:r.releaseType||"undecided"};return{action:{actionType:"sanity.action.release.create",releaseId:n,metadata:o},options:i}};class $Nt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}get({releaseId:e},n){return i_(this.#t,this.#e,`_.releases.${e}`,n)}create(e,n){const{action:r,options:i}=YYe(e,n),{releaseId:o,metadata:s}=r;return gc(this.#t,this.#e,r,i).pipe(Je(a=>({...a,releaseId:o,metadata:s})))}edit({releaseId:e,patch:n},r){const i={actionType:"sanity.action.release.edit",releaseId:e,patch:n};return gc(this.#t,this.#e,i,r)}publish({releaseId:e},n){const r={actionType:"sanity.action.release.publish",releaseId:e};return gc(this.#t,this.#e,r,n)}archive({releaseId:e},n){const r={actionType:"sanity.action.release.archive",releaseId:e};return gc(this.#t,this.#e,r,n)}unarchive({releaseId:e},n){const r={actionType:"sanity.action.release.unarchive",releaseId:e};return gc(this.#t,this.#e,r,n)}schedule({releaseId:e,publishAt:n},r){const i={actionType:"sanity.action.release.schedule",releaseId:e,publishAt:n};return gc(this.#t,this.#e,i,r)}unschedule({releaseId:e},n){const r={actionType:"sanity.action.release.unschedule",releaseId:e};return gc(this.#t,this.#e,r,n)}delete({releaseId:e},n){const r={actionType:"sanity.action.release.delete",releaseId:e};return gc(this.#t,this.#e,r,n)}fetchDocuments({releaseId:e},n){return IYe(this.#t,this.#e,e,n)}}class MNt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}get({releaseId:e},n){return co(i_(this.#t,this.#e,`_.releases.${e}`,n))}async create(e,n){const{action:r,options:i}=YYe(e,n),{releaseId:o,metadata:s}=r;return{...await co(gc(this.#t,this.#e,r,i)),releaseId:o,metadata:s}}edit({releaseId:e,patch:n},r){const i={actionType:"sanity.action.release.edit",releaseId:e,patch:n};return co(gc(this.#t,this.#e,i,r))}publish({releaseId:e},n){const r={actionType:"sanity.action.release.publish",releaseId:e};return co(gc(this.#t,this.#e,r,n))}archive({releaseId:e},n){const r={actionType:"sanity.action.release.archive",releaseId:e};return co(gc(this.#t,this.#e,r,n))}unarchive({releaseId:e},n){const r={actionType:"sanity.action.release.unarchive",releaseId:e};return co(gc(this.#t,this.#e,r,n))}schedule({releaseId:e,publishAt:n},r){const i={actionType:"sanity.action.release.schedule",releaseId:e,publishAt:n};return co(gc(this.#t,this.#e,i,r))}unschedule({releaseId:e},n){const r={actionType:"sanity.action.release.unschedule",releaseId:e};return co(gc(this.#t,this.#e,r,n))}delete({releaseId:e},n){const r={actionType:"sanity.action.release.delete",releaseId:e};return co(gc(this.#t,this.#e,r,n))}fetchDocuments({releaseId:e},n){return co(IYe(this.#t,this.#e,e,n))}}class LNt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}getById(e){return iu(this.#t,this.#e,{uri:`/users/${e}`})}}class FNt{#t;#e;constructor(e,n){this.#t=e,this.#e=n}getById(e){return co(iu(this.#t,this.#e,{uri:`/users/${e}`}))}}class ZF{assets;datasets;live;mediaLibrary;projects;users;agent;releases;#t;#e;listen=WYe;constructor(e,n=SI){this.config(n),this.#e=e,this.assets=new fNt(this,this.#e),this.datasets=new SNt(this,this.#e),this.live=new qYe(this),this.mediaLibrary={video:new GYe(this,this.#e)},this.projects=new DNt(this,this.#e),this.users=new LNt(this,this.#e),this.agent={action:new uNt(this,this.#e)},this.releases=new $Nt(this,this.#e)}clone(){return new ZF(this.#e,this.config())}config(e){if(e===void 0)return{...this.#t};if(this.#t&&this.#t.allowReconfigure===!1)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.#t=yYe(e,this.#t||{}),this}withConfig(e){const n=this.config();return new ZF(this.#e,{...n,...e,stega:{...n.stega||{},...typeof e?.stega=="boolean"?{enabled:e.stega}:e?.stega||{}}})}fetch(e,n,r){return EYe(this,this.#e,this.#t.stega,e,n,r)}getDocument(e,n){if(n?.includeAllVersions===!0)return i_(this,this.#e,e,{...n,includeAllVersions:!0});const r={signal:n?.signal,tag:n?.tag,releaseId:n?.releaseId,...n&&"includeAllVersions"in n?{includeAllVersions:!1}:{}};return i_(this,this.#e,e,r)}getDocuments(e,n){return TYe(this,this.#e,e,n)}create(e,n){return Dz(this,this.#e,e,"create",n)}createIfNotExists(e,n){return jYe(this,this.#e,e,n)}createOrReplace(e,n){return AYe(this,this.#e,e,n)}createVersion({document:e,publishedId:n,releaseId:r,baseId:i,ifBaseRevisionId:o},s){if(!e)return DYe(this,this.#e,n,i,r,o,s);const a=XF("createVersion",{document:e,publishedId:n,releaseId:r}),l={...e,_id:a},c=n||pn(e._id);return RYe(this,this.#e,l,c,s)}delete(e,n){return OYe(this,this.#e,e,n)}discardVersion({releaseId:e,publishedId:n},r,i){const o=KF(n,e);return PYe(this,this.#e,o,r,i)}replaceVersion({document:e,publishedId:n,releaseId:r},i){const o=XF("replaceVersion",{document:e,publishedId:n,releaseId:r}),s={...e,_id:o};return $Ye(this,this.#e,s,i)}unpublishVersion({releaseId:e,publishedId:n},r){const i=Ya(n,e);return MYe(this,this.#e,i,n,r)}mutate(e,n){return LYe(this,this.#e,e,n)}patch(e,n){return new Qb(e,n,this)}transaction(e){return new Rz(e,this)}action(e,n){return gc(this,this.#e,e,n)}request(e){return iu(this,this.#e,e)}getUrl(e,n){return Xde(this,e,n)}getDataUrl(e,n){return sm(this,e,n)}}class QF{assets;datasets;live;mediaLibrary;projects;users;agent;releases;observable;#t;#e;listen=WYe;constructor(e,n=SI){this.config(n),this.#e=e,this.assets=new hNt(this,this.#e),this.datasets=new kNt(this,this.#e),this.live=new qYe(this),this.mediaLibrary={video:new ENt(this,this.#e)},this.projects=new ONt(this,this.#e),this.users=new FNt(this,this.#e),this.agent={action:new dNt(this,this.#e)},this.releases=new MNt(this,this.#e),this.observable=new ZF(e,n)}clone(){return new QF(this.#e,this.config())}config(e){if(e===void 0)return{...this.#t};if(this.#t&&this.#t.allowReconfigure===!1)throw new Error("Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client");return this.observable&&this.observable.config(e),this.#t=yYe(e,this.#t||{}),this}withConfig(e){const n=this.config();return new QF(this.#e,{...n,...e,stega:{...n.stega||{},...typeof e?.stega=="boolean"?{enabled:e.stega}:e?.stega||{}}})}fetch(e,n,r){return co(EYe(this,this.#e,this.#t.stega,e,n,r))}getDocument(e,n){if(n?.includeAllVersions===!0)return co(i_(this,this.#e,e,{...n,includeAllVersions:!0}));const r={signal:n?.signal,tag:n?.tag,releaseId:n?.releaseId,...n&&"includeAllVersions"in n?{includeAllVersions:!1}:{}};return co(i_(this,this.#e,e,r))}getDocuments(e,n){return co(TYe(this,this.#e,e,n))}create(e,n){return co(Dz(this,this.#e,e,"create",n))}createIfNotExists(e,n){return co(jYe(this,this.#e,e,n))}createOrReplace(e,n){return co(AYe(this,this.#e,e,n))}createVersion({document:e,publishedId:n,releaseId:r,baseId:i,ifBaseRevisionId:o},s){if(!e)return zp(DYe(this,this.#e,n,i,r,o,s));const a=XF("createVersion",{document:e,publishedId:n,releaseId:r}),l={...e,_id:a},c=n||pn(e._id);return zp(RYe(this,this.#e,l,c,s))}delete(e,n){return co(OYe(this,this.#e,e,n))}discardVersion({releaseId:e,publishedId:n},r,i){const o=KF(n,e);return co(PYe(this,this.#e,o,r,i))}replaceVersion({document:e,publishedId:n,releaseId:r},i){const o=XF("replaceVersion",{document:e,publishedId:n,releaseId:r}),s={...e,_id:o};return zp($Ye(this,this.#e,s,i))}unpublishVersion({releaseId:e,publishedId:n},r){const i=Ya(n,e);return co(MYe(this,this.#e,i,n,r))}mutate(e,n){return co(LYe(this,this.#e,e,n))}patch(e,n){return new K4(e,n,this)}transaction(e){return new Az(e,this)}action(e,n){return co(gc(this,this.#e,e,n))}request(e){return co(iu(this,this.#e,e))}dataRequest(e,n,r){return co(mv(this,this.#e,e,n,r))}getUrl(e,n){return Xde(this,e,n)}getDataUrl(e,n){return sm(this,e,n)}}function NNt(t,e){return{requester:g6e(t),createClient:n=>{const r=g6e(t,{ignoreWarnings:n.ignoreWarnings});return new e((i,o)=>(o||r)({maxRedirects:0,maxRetries:n.maxRetries,retryDelay:n.retryDelay,lineage:n.lineage,...i}),n)}}}var BNt=[];const VNt=NNt(BNt,QF),KYe=VNt.createClient,zNt={space:3,padding:3},HNt={space:2,padding:2},UNt=de.span.withConfig({displayName:"TooltipButtonWrapper",componentId:"sc-jrh35q-0"})`display:inline-flex;`,pt=E.forwardRef(function(t,e){const n=H.c(22);let r,i,o,s,a,l,c;n[0]!==t?({size:s,mode:a,paddingY:i,paddingLeft:r,tone:l,tooltipProps:c,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7]);const u=s===void 0?"default":s,f=a===void 0?"default":a,h=l===void 0?"default":l,p=u==="default"?HNt:zNt;let m;n[8]!==f||n[9]!==r||n[10]!==i||n[11]!==e||n[12]!==o||n[13]!==p||n[14]!==h?(m=d.jsx(vn,{...o,...p,paddingY:i,paddingLeft:r,ref:e,mode:f,tone:h}),n[8]=f,n[9]=r,n[10]=i,n[11]=e,n[12]=o,n[13]=p,n[14]=h,n[15]=m):m=n[15];const g=m;if(c){const y=c?.content;let b;n[16]!==g?(b=d.jsx(UNt,{children:g}),n[16]=g,n[17]=b):b=n[17];let v;return n[18]!==y||n[19]!==b||n[20]!==c?(v=d.jsx(Kn,{content:y,portal:!0,...c,children:b}),n[18]=y,n[19]=b,n[20]=c,n[21]=v):v=n[21],v}return g}),Yi=E.forwardRef(function(t,e){const n=H.c(23);let r,i,o,s,a,l,c;n[0]!==t?({animate:a,bodyHeight:r,children:i,footer:o,padding:l,zOffset:c,...s}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7]);const u=a===void 0?!0:a,f=l===void 0?!0:l,{t:h}=Hde();let p;n[8]!==o||n[9]!==s||n[10]!==h?(p=(o?.confirmButton||o?.cancelButton)&&d.jsxs(ge,{width:"full",gap:3,justify:"flex-end",padding:3,align:"center",children:[o?.description&&d.jsx(me,{flex:1,paddingLeft:1,children:d.jsx(oe,{size:1,muted:!0,children:o.description})}),s.onClose&&d.jsx(vn,{mode:"bleed",padding:2,text:h("common.dialog.cancel-button.text"),tone:"default",onClick:s.onClose,"data-testid":"cancel-button",...o.cancelButton}),o.confirmButton&&d.jsx(vn,{mode:"default",padding:2,text:h("common.dialog.confirm-button.text"),tone:"critical","data-testid":"confirm-button",...o.confirmButton})]}),n[8]=o,n[9]=s,n[10]=h,n[11]=p):p=n[11];const m=f?4:0;let g;n[12]!==r||n[13]!==i||n[14]!==m?(g=d.jsx(me,{height:r,padding:m,children:i}),n[12]=r,n[13]=i,n[14]=m,n[15]=g):g=n[15];let y;return n[16]!==u||n[17]!==s||n[18]!==e||n[19]!==p||n[20]!==g||n[21]!==c?(y=d.jsx(W8,{...s,animate:u,zOffset:c,ref:e,footer:p,children:g}),n[16]=u,n[17]=s,n[18]=e,n[19]=p,n[20]=g,n[21]=c,n[22]=y):y=n[22],y});function X8(t){const e=H.c(9);let n,r;e[0]!==t?({onCatch:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);const i=E.useContext(hI);let o;e[3]!==n||e[4]!==i?(o=l=>{const{error:c,info:u}=l,f=()=>{i?.onUncaughtError?.(c,u)};try{f()}catch(h){const p=h;p.message=`Encountered an additional error when calling custom "onUncaughtError()": ${p.message}`,console.error(p)}n?.({error:c,info:u})},e[3]=n,e[4]=i,e[5]=o):o=e[5];const s=o;let a;return e[6]!==s||e[7]!==r?(a=d.jsx(xqe,{...r,onCatch:s}),e[6]=s,e[7]=r,e[8]=a):a=e[8],a}const ui=E.forwardRef(function(t,e){const n=H.c(6);let r;n[0]!==t.popover?(r={...t.popover,animate:!0},n[0]=t.popover,n[1]=r):r=n[1];let i;return n[2]!==t||n[3]!==e||n[4]!==r?(i=d.jsx(j0,{...t,ref:e,popover:r}),n[2]=t,n[3]=e,n[4]=r,n[5]=i):i=n[5],i});function Zde(t){const e=H.c(12);let n,r,i;e[0]!==t?({makePlatformAware:r,keys:i,...n}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);const o=r===void 0?!0:r;let s;e[4]!==i?(s=i===void 0?[]:i,e[4]=i,e[5]=s):s=e[5];const a=s;let l;e[6]!==a||e[7]!==o?(l=o?a.map(WNt):a,e[6]=a,e[7]=o,e[8]=l):l=e[8];const c=l;let u;return e[9]!==c||e[10]!==n?(u=d.jsx(pde,{...n,keys:c}),e[9]=c,e[10]=n,e[11]=u):u=e[11],u}const _6e=typeof navigator>"u"||typeof navigator.platform!="string"?!1:/Mac|iPod|iPhone|iPad/.test(navigator.platform||"");function WNt(t){const e=t.toLowerCase();return e==="alt"&&_6e?S6e(t,"option"):e==="option"&&!_6e?S6e(t,"alt"):t}function S6e(t,e){const n=t.length;return e.replace(/./g,(r,i)=>i"u"&&typeof f=="function"?f(_):_,n[32]=l,n[33]=_,n[34]=f,n[35]=I):I=n[35];let j;n[36]!==c||n[37]!==e||n[38]!==h||n[39]!==S||n[40]!==k||n[41]!==I?(j=d.jsx(Wl,{disabled:c,paddingLeft:S,paddingRight:3,paddingY:k,ref:e,...h,children:I}),n[36]=c,n[37]=e,n[38]=h,n[39]=S,n[40]=k,n[41]=I,n[42]=j):j=n[42];const A=j;if(g){const D=g?.content;let O;n[43]!==A?(O=d.jsx("div",{children:A}),n[43]=A,n[44]=O):O=n[44];let P;return n[45]!==D||n[46]!==O||n[47]!==g?(P=d.jsx(Kn,{content:D,portal:!0,...g,children:O}),n[45]=D,n[46]=O,n[47]=g,n[48]=P):P=n[48],P}return A}),po=E.forwardRef(function(t,e){const n=H.c(7);let r,i;n[0]!==t?({animate:i,...r}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]);const o=i===void 0?!0:i;let s;return n[3]!==o||n[4]!==e||n[5]!==r?(s=d.jsx(Ng,{...r,animate:o,ref:e}),n[3]=o,n[4]=e,n[5]=r,n[6]=s):s=n[6],s}),g0=E.forwardRef(function(t,e){const n=H.c(7);let r,i;n[0]!==t?({tone:i,...r}=t,n[0]=t,n[1]=r,n[2]=i):(r=n[1],i=n[2]);const o=i===void 0?"default":i;let s;return n[3]!==r||n[4]!==e||n[5]!==o?(s=d.jsx(Cj,{...r,muted:!0,padding:2,ref:e,tone:o}),n[3]=r,n[4]=e,n[5]=o,n[6]=s):s=n[6],s}),Cd=t=>{const e=H.c(2);let n;return e[0]!==t.children?(n=d.jsx(gqe,{delay:XYe,children:t.children}),e[0]=t.children,e[1]=n):n=e[1],n};var KNt=function(t){return t};function vR(t){t===void 0&&(t=KNt);var e=new qs;return[e.pipe(t),function(n){return e.next(n)}]}function E6e(t){return typeof t=="function"?t():t}const xP=new WeakMap,XNt={};function br(t,e,n){const r=Ut.c(10),i=XNt,{disabled:o}=i,s=o===void 0?!1:o;if(!xP.has(t)){const p={didEmit:!1},m={state:p,observable:t.pipe(Je(tBt),tr(eBt),Oi(g=>{const{snapshot:y,error:b}=g;p.didEmit=!0,p.snapshot=y,p.error=b}),Je(JNt),$g(()=>xP.delete(t)),sc({resetOnRefCountZero:QNt})),getSnapshot:g=>{if(p.error)throw p.error;return p.didEmit?p.snapshot:E6e(g)}};m.observable.subscribe().unsubscribe(),xP.set(t,m)}let a;r[0]!==t?(a=xP.get(t),r[0]=t,r[1]=a):a=r[1];const l=a;let c;r[2]!==s||r[3]!==l.observable?(c=p=>{if(s)return ZNt;const m=l.observable.subscribe(p);return()=>{m.unsubscribe()}},r[2]=s,r[3]=l.observable,r[4]=c):c=r[4];const u=c;let f;r[5]!==e||r[6]!==l?(f=()=>l.getSnapshot(e),r[5]=e,r[6]=l,r[7]=f):f=r[7];let h;return r[8]!==e?(h=typeof e>"u"?void 0:()=>E6e(e),r[8]=e,r[9]=h):h=r[9],E.useSyncExternalStore(u,f,h)}function ZNt(){}function QNt(){return Cs(0,uVe)}function JNt(t){}function eBt(t){return Ke({snapshot:void 0,error:t})}function tBt(t){return{snapshot:t,error:void 0}}function xR(t){const e=Ut.c(7),[n]=E.useState(nBt),[r,i]=n;let o;e[0]!==t?(o=c=>t(c),e[0]=t,e[1]=o):o=e[1];const s=uv(o);let a;e[2]!==r||e[3]!==s?(a=()=>{const c=r.pipe(u=>s(u)).subscribe();return()=>c.unsubscribe()},e[2]=r,e[3]=s,e[4]=a):a=e[4];let l;return e[5]!==r?(l=[r],e[5]=r,e[6]=l):l=e[6],E.useEffect(a,l),i}function nBt(){return vR()}var JF=function(){return JF=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0)return s(u);if(h==="number"&&isFinite(u))return f.long?l(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function s(u){if(u=String(u),!(u.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(f){var h=parseFloat(f[1]),p=(f[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"yrs":case"yr":case"y":return h*o;case"weeks":case"week":case"w":return h*i;case"days":case"day":case"d":return h*r;case"hours":case"hour":case"hrs":case"hr":case"h":return h*n;case"minutes":case"minute":case"mins":case"min":case"m":return h*e;case"seconds":case"second":case"secs":case"sec":case"s":return h*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function a(u){var f=Math.abs(u);return f>=r?Math.round(u/r)+"d":f>=n?Math.round(u/n)+"h":f>=e?Math.round(u/e)+"m":f>=t?Math.round(u/t)+"s":u+"ms"}function l(u){var f=Math.abs(u);return f>=r?c(u,f,r,"day"):f>=n?c(u,f,n,"hour"):f>=e?c(u,f,e,"minute"):f>=t?c(u,f,t,"second"):u+" ms"}function c(u,f,h,p){var m=f>=h*1.5;return Math.round(u/h)+" "+p+(m?"s":"")}return dY}var fY,R6e;function pBt(){if(R6e)return fY;R6e=1;function t(e){r.debug=r,r.default=r,r.coerce=c,r.disable=a,r.enable=o,r.enabled=l,r.humanize=hBt(),r.destroy=u,Object.keys(e).forEach(f=>{r[f]=e[f]}),r.names=[],r.skips=[],r.formatters={};function n(f){let h=0;for(let p=0;p{if(S==="%%")return"%";w++;const I=r.formatters[k];if(typeof I=="function"){const j=b[w];S=I.call(v,j),b.splice(w,1),w--}return S}),r.formatArgs.call(v,b),(v.log||r.log).apply(v,b)}return y.namespace=f,y.useColors=r.useColors(),y.color=r.selectColor(f),y.extend=i,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(m!==r.namespaces&&(m=r.namespaces,g=r.enabled(f)),g),set:b=>{p=b}}),typeof r.init=="function"&&r.init(y),y}function i(f,h){const p=r(this.namespace+(typeof h>"u"?":":h)+f);return p.log=this.log,p}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];const h=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of h)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function s(f,h){let p=0,m=0,g=-1,y=0;for(;p"-"+h)].join(",");return r.enable(""),f}function l(f){for(const h of r.skips)if(s(f,h))return!1;for(const h of r.names)if(s(f,h))return!0;return!1}function c(f){return f instanceof Error?f.stack||f.message:f}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}return fY=t,fY}var D6e;function mBt(){return D6e||(D6e=1,(function(t,e){var n={};e.formatArgs=i,e.save=o,e.load=s,e.useColors=r,e.storage=a(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function i(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let f=0,h=0;c[0].replace(/%[a-zA-Z%]/g,p=>{p!=="%%"&&(f++,p==="%c"&&(h=f))}),c.splice(h,0,u)}e.log=console.debug||console.log||(()=>{});function o(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function s(){let c;try{c=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=n.DEBUG),c}function a(){try{return localStorage}catch{}}t.exports=pBt()(e);const{formatters:l}=t.exports;l.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(CP,CP.exports)),CP.exports}var gBt=mBt();const dl=rs(gBt),yBt=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),hY={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},ZYe={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:yBt?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Qde={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222};for(var wP=1;wP<20;wP++)Qde["f"+wP]=111+wP;function gv(t,e,n){e&&!("byKey"in e)&&(n=e,e=null),Array.isArray(t)||(t=[t]);const r=t.map(o=>bBt(o,e)),i=o=>r.some(s=>vBt(s,o));return n==null?i:i(n)}function bBt(t,e){const n=e&&e.byKey,r={};t=t.replace("++","+add");const i=t.split("+"),{length:o}=i;for(const s in hY)r[hY[s]]=!1;for(let s of i){const a=s.endsWith("?")&&s.length>1;a&&(s=s.slice(0,-1));const l=QYe(s),c=hY[l];if(s.length>1&&!c&&!ZYe[s]&&!Qde[l])throw new TypeError(`Unknown modifier: "${s}"`);(o===1||!c)&&(n?r.key=l:r.which=xBt(s)),c&&(r[c]=a?null:!0)}return r}function vBt(t,e){for(const n in t){const r=t[n];let i;if(r!=null&&(n==="key"&&e.key!=null?i=e.key.toLowerCase():n==="which"?i=r===91&&e.which===93?91:e.which:i=e[n],!(i==null&&r===!1)&&i!==r))return!1}return!0}function xBt(t){return t=QYe(t),Qde[t]||t.toUpperCase().charCodeAt(0)}function QYe(t){return t=t.toLowerCase(),t=ZYe[t]||t,t}function JYe(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Gr(){return Gr=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0}).sort(GBt)},KBt=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],r1e=KBt.join(","),XBt="".concat(r1e,", [data-focus-guard]"),pKe=function(t,e){return Ug((t.shadowRoot||t).children).reduce(function(n,r){return n.concat(r.matches(e?XBt:r1e)?[r]:[],pKe(r))},[])},ZBt=function(t,e){var n;return t instanceof HTMLIFrameElement&&(!((n=t.contentDocument)===null||n===void 0)&&n.body)?o_([t.contentDocument.body],e):[t]},o_=function(t,e){return t.reduce(function(n,r){var i,o=pKe(r,e),s=(i=[]).concat.apply(i,o.map(function(a){return ZBt(a,e)}));return n.concat(s,r.parentNode?Ug(r.parentNode.querySelectorAll(r1e)).filter(function(a){return a===r}):[])},[])},QBt=function(t){var e=t.querySelectorAll("[".concat(EBt,"]"));return Ug(e).map(function(n){return o_([n])}).reduce(function(n,r){return n.concat(r)},[])},i1e=function(t,e){return Ug(t).filter(function(n){return cKe(e,n)}).filter(function(n){return UBt(n)})},L6e=function(t,e){return e===void 0&&(e=new Map),Ug(t).filter(function(n){return uKe(e,n)})},o1e=function(t,e,n){return n1e(i1e(o_(t,n),e),!0,n)},Aj=function(t,e){return n1e(i1e(o_(t),e),!1)},JBt=function(t,e){return i1e(QBt(t),e)},Jb=function(t,e){return t.shadowRoot?Jb(t.shadowRoot,e):Object.getPrototypeOf(t).contains!==void 0&&Object.getPrototypeOf(t).contains.call(t,e)?!0:Ug(t.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var i=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return i?Jb(i,e):!1}return Jb(n,e)})},eVt=function(t){for(var e=new Set,n=t.length,r=0;r0&&e.add(i),(o&Node.DOCUMENT_POSITION_CONTAINS)>0&&e.add(r)}return t.filter(function(s,a){return!e.has(a)})},mKe=function(t){return t.parentNode?mKe(t.parentNode):t},s1e=function(t){var e=I9(t);return e.filter(Boolean).reduce(function(n,r){var i=r.getAttribute(ioe);return n.push.apply(n,i?eVt(Ug(mKe(r).querySelectorAll("[".concat(ioe,'="').concat(i,'"]:not([').concat(eKe,'="disabled"])')))):[r]),n},[])},tVt=function(t){try{return t()}catch{return}},Rj=function(t){if(t===void 0&&(t=document),!(!t||!t.activeElement)){var e=t.activeElement;return e.shadowRoot?Rj(e.shadowRoot):e instanceof HTMLIFrameElement&&tVt(function(){return e.contentWindow.document})?Rj(e.contentWindow.document):e}},nVt=function(t,e){return t===e},rVt=function(t,e){return!!Ug(t.querySelectorAll("iframe")).some(function(n){return nVt(n,e)})},gKe=function(t,e){return e===void 0&&(e=Rj(sKe(t).ownerDocument)),!e||e.dataset&&e.dataset.focusGuard?!1:s1e(t).some(function(n){return Jb(n,e)||rVt(n,e)})},iVt=function(t){t===void 0&&(t=document);var e=Rj(t);return e?Ug(t.querySelectorAll("[".concat(kBt,"]"))).some(function(n){return Jb(n,e)}):!1},oVt=function(t,e){return e.filter(hKe).filter(function(n){return n.name===t.name}).filter(function(n){return n.checked})[0]||t},a1e=function(t,e){return hKe(t)&&t.name?oVt(t,e):t},sVt=function(t){var e=new Set;return t.forEach(function(n){return e.add(a1e(n,t))}),t.filter(function(n){return e.has(n)})},F6e=function(t){return t[0]&&t.length>1?a1e(t[0],t):t[0]},N6e=function(t,e){return t.indexOf(a1e(e,t))},soe="NEW_FOCUS",aVt=function(t,e,n,r,i){var o=t.length,s=t[0],a=t[o-1],l=t1e(r);if(!(r&&t.indexOf(r)>=0)){var c=r!==void 0?n.indexOf(r):-1,u=i?n.indexOf(i):c,f=i?t.indexOf(i):-1;if(c===-1)return f!==-1?f:soe;if(f===-1)return soe;var h=c-u,p=n.indexOf(s),m=n.indexOf(a),g=sVt(n),y=r!==void 0?g.indexOf(r):-1,b=i?g.indexOf(i):y,v=g.filter(function(k){return k.tabIndex>=0}),x=r!==void 0?v.indexOf(r):-1,C=i?v.indexOf(i):x,w=x>=0&&C>=0?C-x:b-y;if(!h&&f>=0||e.length===0)return f;var _=N6e(t,e[0]),S=N6e(t,e[e.length-1]);if(c<=p&&l&&Math.abs(h)>1)return S;if(c>=m&&l&&Math.abs(h)>1)return _;if(h&&Math.abs(w)>1)return f;if(c<=p)return S;if(c>m)return _;if(h)return Math.abs(h)>1?f:(o+f+h)%o}},lVt=function(t){return function(e){var n,r=(n=dKe(e))===null||n===void 0?void 0:n.autofocus;return e.autofocus||r!==void 0&&r!=="false"||t.indexOf(e)>=0}},B6e=function(t,e,n){var r=t.map(function(o){var s=o.node;return s}),i=L6e(r.filter(lVt(n)));return i&&i.length?F6e(i):F6e(L6e(e))},aoe=function(t,e){return e===void 0&&(e=[]),e.push(t),t.parentNode&&aoe(t.parentNode.host||t.parentNode,e),e},vY=function(t,e){for(var n=aoe(t),r=aoe(e),i=0;i=0)return o}return!1},yKe=function(t,e,n){var r=I9(t),i=I9(e),o=r[0],s=!1;return i.filter(Boolean).forEach(function(a){s=vY(s||a,a)||s,n.filter(Boolean).forEach(function(l){var c=vY(o,l);c&&(!s||Jb(c,s)?s=c:s=vY(c,s))})}),s},V6e=function(t,e){return t.reduce(function(n,r){return n.concat(JBt(r,e))},[])},cVt=function(t,e){var n=new Map;return e.forEach(function(r){return n.set(r.node,r)}),t.map(function(r){return n.get(r)}).filter(qBt)},uVt=function(t,e){var n=Rj(I9(t).length>0?document:sKe(t).ownerDocument),r=s1e(t).filter(ooe),i=yKe(n||t,t,r),o=new Map,s=Aj(r,o),a=s.filter(function(m){var g=m.node;return ooe(g)});if(a[0]){var l=Aj([i],o).map(function(m){var g=m.node;return g}),c=cVt(l,a),u=c.map(function(m){var g=m.node;return g}),f=c.filter(function(m){var g=m.tabIndex;return g>=0}).map(function(m){var g=m.node;return g}),h=aVt(u,f,l,n,e);if(h===soe){var p=B6e(s,f,V6e(r,o))||B6e(s,u,V6e(r,o));if(p)return{node:p};console.warn("focus-lock: cannot find any node to move focus into");return}return h===void 0?h:c[h]}},dVt=function(t){var e=s1e(t).filter(ooe),n=yKe(t,t,e),r=n1e(o_([n],!0),!0,!0),i=o_(e,!1);return r.map(function(o){var s=o.node,a=o.index;return{node:s,index:a,lockItem:i.indexOf(s)>=0,guard:t1e(s)}})},l1e=function(t,e){t&&("focus"in t&&t.focus(e),"contentWindow"in t&&t.contentWindow&&t.contentWindow.focus())},xY=0,CY=!1,bKe=function(t,e,n){n===void 0&&(n={});var r=uVt(t,e);if(!CY&&r){if(xY>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),CY=!0,setTimeout(function(){CY=!1},1);return}xY++,l1e(r.node,n.focusOptions),xY--}};function PE(t){if(!t)return null;if(typeof WeakRef>"u")return function(){return t||null};var e=t?new WeakRef(t):null;return function(){return e?.deref()||null}}var fVt=function(t){if(!t)return null;for(var e=[],n=t;n&&n!==document.body;)e.push({current:PE(n),parent:PE(n.parentElement),left:PE(n.previousElementSibling),right:PE(n.nextElementSibling)}),n=n.parentElement;return{element:PE(t),stack:e,ownerDocument:t.ownerDocument}},hVt=function(t){var e,n,r,i,o;if(t)for(var s=t.stack,a=t.ownerDocument,l=new Map,c=0,u=s;c-1&&(y.filter(function(v){var x=v.guard,C=v.node;return x&&C.dataset.focusAutoGuard}).forEach(function(v){var x=v.node;return x.removeAttribute("tabIndex")}),H6e(b,y.length,1,y),H6e(b,-1,-1,y))}}}return e},SKe=function(e){tN()&&e&&(e.stopPropagation(),e.preventDefault())},d1e=function(){return c1e(tN)},RVt=function(e){var n=e.target,r=e.currentTarget;r.contains(n)||kVt(r,n)},DVt=function(){return null},kKe=function(){u1e=!0},EKe=function(){u1e=!1,Dj="just",c1e(function(){Dj="meanwhile"})},OVt=function(){document.addEventListener("focusin",SKe),document.addEventListener("focusout",d1e),window.addEventListener("focus",kKe),window.addEventListener("blur",EKe)},PVt=function(){document.removeEventListener("focusin",SKe),document.removeEventListener("focusout",d1e),window.removeEventListener("focus",kKe),window.removeEventListener("blur",EKe)};function $Vt(t){return t.filter(function(e){var n=e.disabled;return!n})}var TKe={moveFocusInside:bKe,focusInside:gKe,focusNextElement:yVt,focusPrevElement:bVt,focusFirstElement:vVt,focusLastElement:xVt,captureFocusRestore:vKe};function MVt(t){var e=t.slice(-1)[0];e&&!hw&&OVt();var n=hw,r=n&&e&&e.id===n.id;hw=e,n&&!r&&(n.onDeactivation(),t.filter(function(i){var o=i.id;return o===n.id}).length||n.returnFocus(!e)),e?(p2=null,(!r||n.observed!==e.observed)&&e.onActivation(TKe),tN(),c1e(tN)):(PVt(),p2=null)}rKe.assignSyncMedium(RVt);iKe.assignMedium(d1e);DBt.assignMedium(function(t){return t(TKe)});const LVt=FBt($Vt,MVt)(DVt);var am=E.forwardRef(function(e,n){return vt.createElement(e1e,Gr({sideCar:LVt,ref:n},e))}),IKe=e1e.propTypes||{};IKe.sideCar;JYe(IKe,["sideCar"]);am.propTypes={};var wl="0123456789abcdefghjkmnpqrstvwxyz",Rr=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,10,11,12,13,14,15,16,17,255,18,19,255,20,21,255,22,23,24,25,26,255,27,28,29,30,31,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]);function wY(t){const e=new Array(26).fill("");if(t.length!==16)throw new Error("Invalid length");return e[0]=wl[(t[0]&224)>>5],e[1]=wl[t[0]&31],e[2]=wl[(t[1]&248)>>3],e[3]=wl[(t[1]&7)<<2|(t[2]&192)>>6],e[4]=wl[(t[2]&62)>>1],e[5]=wl[(t[2]&1)<<4|(t[3]&240)>>4],e[6]=wl[(t[3]&15)<<1|(t[4]&128)>>7],e[7]=wl[(t[4]&124)>>2],e[8]=wl[(t[4]&3)<<3|(t[5]&224)>>5],e[9]=wl[t[5]&31],e[10]=wl[(t[6]&248)>>3],e[11]=wl[(t[6]&7)<<2|(t[7]&192)>>6],e[12]=wl[(t[7]&62)>>1],e[13]=wl[(t[7]&1)<<4|(t[8]&240)>>4],e[14]=wl[(t[8]&15)<<1|(t[9]&128)>>7],e[15]=wl[(t[9]&124)>>2],e[16]=wl[(t[9]&3)<<3|(t[10]&224)>>5],e[17]=wl[t[10]&31],e[18]=wl[(t[11]&248)>>3],e[19]=wl[(t[11]&7)<<2|(t[12]&192)>>6],e[20]=wl[(t[12]&62)>>1],e[21]=wl[(t[12]&1)<<4|(t[13]&240)>>4],e[22]=wl[(t[13]&15)<<1|(t[14]&128)>>7],e[23]=wl[(t[14]&124)>>2],e[24]=wl[(t[14]&3)<<3|(t[15]&224)>>5],e[25]=wl[t[15]&31],e.join("")}function U6e(t){if(t.length!==26)throw new Error("Invalid length");const n=new TextEncoder().encode(t);if(Rr[n[0]]===255||Rr[n[1]]===255||Rr[n[2]]===255||Rr[n[3]]===255||Rr[n[4]]===255||Rr[n[5]]===255||Rr[n[6]]===255||Rr[n[7]]===255||Rr[n[8]]===255||Rr[n[9]]===255||Rr[n[10]]===255||Rr[n[11]]===255||Rr[n[12]]===255||Rr[n[13]]===255||Rr[n[14]]===255||Rr[n[15]]===255||Rr[n[16]]===255||Rr[n[17]]===255||Rr[n[18]]===255||Rr[n[19]]===255||Rr[n[20]]===255||Rr[n[21]]===255||Rr[n[22]]===255||Rr[n[23]]===255||Rr[n[24]]===255||Rr[n[25]]===255)throw new Error("Invalid base32 character");const r=new Uint8Array(16);return r[0]=Rr[n[0]]<<5|Rr[n[1]],r[1]=Rr[n[2]]<<3|Rr[n[3]]>>2,r[2]=(Rr[n[3]]&3)<<6|Rr[n[4]]<<1|Rr[n[5]]>>4,r[3]=(Rr[n[5]]&15)<<4|Rr[n[6]]>>1,r[4]=(Rr[n[6]]&1)<<7|Rr[n[7]]<<2|Rr[n[8]]>>3,r[5]=(Rr[n[8]]&7)<<5|Rr[n[9]],r[6]=Rr[n[10]]<<3|Rr[n[11]]>>2,r[7]=(Rr[n[11]]&3)<<6|Rr[n[12]]<<1|Rr[n[13]]>>4,r[8]=(Rr[n[13]]&15)<<4|Rr[n[14]]>>1,r[9]=(Rr[n[14]]&1)<<7|Rr[n[15]]<<2|Rr[n[16]]>>3,r[10]=(Rr[n[16]]&7)<<5|Rr[n[17]],r[11]=Rr[n[18]]<<3|Rr[n[19]]>>2,r[12]=(Rr[n[19]]&3)<<6|Rr[n[20]]<<1|Rr[n[21]]>>4,r[13]=(Rr[n[21]]&15)<<4|Rr[n[22]]>>1,r[14]=(Rr[n[22]]&1)<<7|Rr[n[23]]<<2|Rr[n[24]]>>3,r[15]=(Rr[n[24]]&7)<<5|Rr[n[25]],r}function FVt(t){let e;const n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=e&255,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=e&255,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=e&255,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=e&255,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=e&255,n}var Rb=Math.pow,W6e="0123456789abcdef",nN=class{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,n,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||t<0||e<0||n<0||r<0||t>0xffffffffffff||e>4095||n>1073741823||r>4294967295)throw new RangeError("invalid field value");const i=new Uint8Array(16);return i[0]=t/Rb(2,40),i[1]=t/Rb(2,32),i[2]=t/Rb(2,24),i[3]=t/Rb(2,16),i[4]=t/Rb(2,8),i[5]=t,i[6]=112|e>>>8,i[7]=e,i[8]=128|n>>>24,i[9]=n>>>16,i[10]=n>>>8,i[11]=n,i[12]=r>>>24,i[13]=r>>>16,i[14]=r>>>8,i[15]=r,new nN(i)}toString(){let t="";for(let e=0;e>>4),t+=W6e.charAt(this.bytes[e]&15),(e===3||e===5||e===7||e===9)&&(t+="-");return t}clone(){return new nN(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let e=0;e<16;e++){const n=this.bytes[e]-t.bytes[e];if(n!==0)return Math.sign(n)}return 0}},NVt=class{constructor(){this.timestamp=0,this.counter=0,this.random=new BVt}generate(){const t=this.generateOrAbort();return t!==void 0?t:(this.timestamp=0,this.generateOrAbort())}generateOrAbort(){const n=Date.now();if(n>this.timestamp)this.timestamp=n,this.resetCounter();else if(n+1e4>this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return nN.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Rb(2,30)),this.counter&Rb(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}},jKe=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;ecrypto.getRandomValues(t));var BVt=class{constructor(){this.buffer=new Uint32Array(8),this.cursor=99}nextUint32(){return this.cursor>=this.buffer.length&&(jKe(this.buffer),this.cursor=0),this.buffer[this.cursor++]}},q6e,VVt=()=>(q6e||(q6e=new NVt)).generate();function zVt(t){if(t.length>63)return!1;let e,n,r;for(n=0,r=t.length;n96&&e<123))return!1;return!0}var NT=class{constructor(t,e=""){if(this.prefix=t,this.suffix=e,!zVt(t))throw new Error("Invalid prefix. Must be at most 63 ascii letters [a-z]");if(this.prefix=t,e)this.suffix=e;else{const n=VVt();this.suffix=wY(n.bytes)}if(this.suffix.length!==26)throw new Error(`Invalid length. Suffix should have 26 characters, got ${e.length}`);if(this.suffix[0]>"7")throw new Error("Invalid suffix. First character must be in the range [0-7]");U6e(this.suffix)}getType(){return this.prefix}getSuffix(){return this.suffix}asType(t){const e=this;if(e.prefix!==t)throw new Error(`Cannot convert TypeID of type ${e.prefix} to type ${t}`);return e}toUUIDBytes(){return U6e(this.suffix)}toUUID(){return new nN(this.toUUIDBytes()).toString()}toString(){return this.prefix===""?this.suffix:`${this.prefix}_${this.suffix}`}static fromString(t){const e=t.split("_");if(e.length===1)return new NT("",e[0]);if(e.length===2){if(e[0]==="")throw new Error(`Invalid TypeID. Prefix cannot be empty when there's a separator: ${t}`);return new NT(e[0],e[1])}throw new Error(`Invalid TypeID string: ${t}`)}static fromUUIDBytes(t,e){const n=wY(e);return new NT(t,n)}static fromUUID(t,e){const n=wY(FVt(e));return new NT(t,n)}};function AKe(t="",e=""){return new NT(t,e)}const G6e={capture:!0};function qM(t,e,n){return t.addEventListener(e,n,G6e),()=>t.removeEventListener(e,n,G6e)}function HVt(t){if("onpagehide"in window)return qM(window,"pagehide",t);const e=qM(window,"unload",t),n=qM(window,"unload",t);return()=>{e(),n()}}function UVt(t){return qM(document,"visibilitychange",()=>{document.visibilityState==="hidden"&&t()})}function WVt(){const t={updateUserProperties(){},trace:e,log:n};function e(r){return{start(){},log(i){},complete(){},newContext(i){return t},error(i){},await:i=>i}}function n(r,i){}return t}const qVt=WVt();function GVt(){return AKe("session").toString()}function YVt(){return AKe("trace").toString()}function KVt(t,e){return e<1?[t,""]:[t.substring(0,e),t.substring(e)]}const Y6e=1024;function XVt(t){const e=t.indexOf(` +`),n=e===-1?Y6e:Math.min(e,Y6e),[r,i]=KVt(t,n);return r+(i?"… (+".concat(i.length,")"):"")}function ZVt(t){const e=new qs,n=new WeakMap;function r(c,u,f,h){e.next({sessionId:t,type:"trace.error",traceId:c,name:u.name,version:u.version,data:{message:XVt(f.message)},context:h,createdAt:new Date().toISOString()})}function i(c,u,f,h,p){e.next({sessionId:t,type:c,traceId:u,name:f.name,version:f.version,data:h,context:p,createdAt:new Date().toISOString()})}function o(c,u,f){e.next({sessionId:t,type:c,version:u.version,name:u.name,data:f,createdAt:new Date().toISOString()})}function s(c){e.next({sessionId:t,type:"userProperties",properties:c,createdAt:new Date().toISOString()})}function a(c,u,f){return{start(){i("trace.start",c,u,void 0,f)},newContext(h){return{trace(p){return a("".concat(c,".").concat(h),p,f)},updateUserProperties(){},log:l}},log(h){i("trace.log",c,u,h,f)},complete(){i("trace.complete",c,u,void 0,f)},error(h){r(c,u,h,f)},await(h,p){return this.start(),h.then(m=>(this.log(p||m),this.complete(),m),m=>{throw this.error(m),m}),h}}}function l(c,u){if(typeof c.maxSampleRate=="number"&&c.maxSampleRate>0){const f=n.get(c),h=new Date;(!f||h.getTime()-f.getTime()>c.maxSampleRate)&&(n.set(c,h),o("log",c,u))}else o("log",c,u)}return{events$:e.asObservable(),logger:{updateUserProperties(c){s(c)},trace:(c,u)=>{const f=YVt();return a(f,c,u)},log:l}}}const QVt=t=>new mi(e=>{const n=setTimeout(()=>{e.next(),e.complete()},t);return typeof n.unref=="function"&&n.unref(),()=>clearTimeout(n)});function JVt(t,e){var n;const r=ZVt(t);function i(){return e.resolveConsent().catch(m=>({status:"undetermined"}))}const o=[];function s(){const m=o.slice();return o.length=0,m}function a(){const m=s();return m.length===0?Xr:ms([Ke(m),i()]).pipe(Kt(g=>{let[y,b]=g;return y.length===0||b.status!=="granted"?Xr:Ei(e.sendEvents(y)).pipe(tr(v=>(o.unshift(...y),Xr)))}))}const l=(n=e.flushInterval)!=null?n:3e4,c=r.events$.pipe(Oi(m=>o.push(m)),Je(()=>{}),iue(()=>QVt(l),{leading:!1,trailing:!0}),W7(()=>a()));function u(){return co(a(),{defaultValue:void 0}).then(()=>{})}const f=c.subscribe();function h(){if(!e.sendBeacon)return p(),!0;const m=s();return f.unsubscribe(),m.length>0?e.sendBeacon(m):!0}function p(){return u().then(()=>{},()=>{}).finally(()=>{f.unsubscribe()})}return{end:p,endWithBeacon:h,flush:u,logger:r.logger}}function Fn(t){return{type:"log",name:t.name,version:t.version,description:t.description,maxSampleRate:t.maxSampleRate,schema:void 0}}function ezt(t){E.useEffect(()=>UVt(t.flush),[t.flush]),E.useEffect(()=>HVt(t.endWithBeacon),[t.endWithBeacon])}const RKe=E.createContext(qVt);function tzt(t){let{children:e,store:n}=t;return ezt(n),d.jsx(RKe.Provider,{value:n.logger,children:e})}function Vi(){return E.useContext(RKe)}function nzt(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const rzt={},BT={};function Lb(t,e){try{const r=(rzt[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in BT?BT[r]:K6e(r,r.split(":"))}catch{if(t in BT)return BT[t];const n=t?.match(izt);return n?K6e(t,n.slice(1)):NaN}}const izt=/([+-]\d\d):?(\d\d)?/;function K6e(t,e){const n=+(e[0]||0),r=+(e[1]||0),i=+(e[2]||0)/60;return BT[t]=n*60+r>0?n*60+r+i:n*60-r-i}class kh extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Lb(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),DKe(this),loe(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new kh(...n,e):new kh(Date.now(),e)}withTimeZone(e){return new kh(+this,e)}getTimezoneOffset(){const e=-Lb(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),loe(this),+this}[Symbol.for("constructDateFrom")](e){return new kh(+new Date(e),this.timeZone)}}const X6e=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!X6e.test(t))return;const e=t.replace(X6e,"$1UTC");kh.prototype[e]&&(t.startsWith("get")?kh.prototype[t]=function(){return this.internal[e]()}:(kh.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),ozt(this),+this},kh.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),loe(this),+this}))});function loe(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-Lb(t.timeZone,t)*60))}function ozt(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),DKe(t)}function DKe(t){const e=Lb(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const i=-new Date(+t).getTimezoneOffset(),o=-new Date(+r).getTimezoneOffset(),s=i-o,a=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();s&&a&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+s);const l=i-n;l&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+l);const c=new Date(+t);c.setUTCSeconds(0);const u=i>0?c.getSeconds():(c.getSeconds()-60)%60,f=Math.round(-(Lb(t.timeZone,t)*60))%60;(f||u)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+f),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+f+u));const h=Lb(t.timeZone,t),p=h>0?Math.floor(h):Math.ceil(h),g=-new Date(+t).getTimezoneOffset()-p,y=p!==n,b=g-l;if(y&&b){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+b);const v=Lb(t.timeZone,t),x=v>0?Math.floor(v):Math.ceil(v),C=p-x;C&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+C),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+C))}}class G5 extends kh{static tz(e,...n){return n.length?new G5(...n,e):new G5(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),i=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,i]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,i]=this.tzComponents();return`${e} GMT${n}${r}${i} (${nzt(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[n,r,i]}withTimeZone(e){return new G5(+this,e)}[Symbol.for("constructDateFrom")](e){return new G5(+new Date(e),this.timeZone)}}const f1e=t=>e=>G5.tz(t,+new Date(e));class OKe extends Date{constructor(){super(),this.setTime(arguments.length===0?Date.now():arguments.length===1?typeof arguments[0]=="string"?+new Date(arguments[0]):arguments[0]:Date.UTC(...arguments))}getTimezoneOffset(){return 0}}const Z6e=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(Z6e.test(t)){const e=Date.prototype[t.replace(Z6e,"$1UTC")];e&&(OKe.prototype[t]=e)}});const PKe=6048e5,szt=864e5,Oz=6e4,CR=36e5,azt=1e3,_P=43200,Q6e=1440,J6e=Symbol.for("constructDateFrom");function ta(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&J6e in t?t[J6e](e):t instanceof Date?new t.constructor(e):new Date(e)}function wi(t,e){return ta(e||t,t)}function cl(t,e,n){const r=wi(t,n?.in);return isNaN(e)?ta(n?.in||t,NaN):(e&&r.setDate(r.getDate()+e),r)}function wR(t,e,n){const r=wi(t,n?.in);if(isNaN(e))return ta(t,NaN);if(!e)return r;const i=r.getDate(),o=ta(t,r.getTime());o.setMonth(r.getMonth()+e+1,0);const s=o.getDate();return i>=s?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}function $Ke(t,e){const n=wi(t,e?.in).getDay();return n===0||n===6}function lzt(t,e,n){return ta(t,+wi(t)+e)}function czt(t,e,n){return lzt(t,e*CR)}let uzt={};function Z8(){return uzt}function k2(t,e){const n=Z8(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=wi(t,e?.in),o=i.getDay(),s=(o=o.getTime()?r+1:n.getTime()>=a.getTime()?r:r-1}function a_(t){const e=wi(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Zh(t,...e){const n=ta.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function D7(t,e){const n=wi(t,e?.in);return n.setHours(0,0,0,0),n}function h1e(t,e,n){const[r,i]=Zh(n?.in,t,e),o=D7(r),s=D7(i),a=+o-a_(o),l=+s-a_(s);return Math.round((a-l)/szt)}function dzt(t,e){const n=MKe(t,e),r=ta(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),s_(r)}function e9(t,e,n){return cl(t,e*7,n)}function mw(t,e){const n=+wi(t)-+wi(e);return n<0?-1:n>0?1:n}function LKe(t){return ta(t,Date.now())}function l1(t,e,n){const[r,i]=Zh(n?.in,t,e);return+D7(r)==+D7(i)}function fzt(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function nf(t){return!(!fzt(t)&&typeof t!="number"||isNaN(+wi(t)))}function hzt(t,e,n){const[r,i]=Zh(n?.in,t,e),o=r.getFullYear()-i.getFullYear(),s=r.getMonth()-i.getMonth();return o*12+s}function pzt(t,e,n){const[r,i]=Zh(n?.in,t,e);return r.getFullYear()-i.getFullYear()}function FKe(t,e,n){const[r,i]=Zh(n?.in,t,e),o=ebe(r,i),s=Math.abs(h1e(r,i));r.setDate(r.getDate()-o*s);const a=+(ebe(r,i)===-o),l=o*(s-a);return l===0?0:l}function ebe(t,e){const n=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return n<0?-1:n>0?1:n}function Pz(t){return e=>{const r=(t?Math[t]:Math.trunc)(e);return r===0?0:r}}function mzt(t,e,n){const[r,i]=Zh(n?.in,t,e),o=(+r-+i)/CR;return Pz(n?.roundingMethod)(o)}function NKe(t,e){return+wi(t)-+wi(e)}function gzt(t,e,n){const r=NKe(t,e)/Oz;return Pz(n?.roundingMethod)(r)}function l_(t,e){const n=wi(t,e?.in);return n.setHours(23,59,59,999),n}function yzt(t,e){const n=wi(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function bzt(t,e){const n=wi(t,e?.in);return+l_(n,e)==+yzt(n,e)}function BKe(t,e,n){const[r,i,o]=Zh(n?.in,t,t,e),s=mw(i,o),a=Math.abs(hzt(i,o));if(a<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-s*a);let l=mw(i,o)===-s;bzt(r)&&a===1&&mw(r,o)===1&&(l=!1);const c=s*(a-+l);return c===0?0:c}function VKe(t,e,n){const r=NKe(t,e)/1e3;return Pz(n?.roundingMethod)(r)}function vzt(t,e,n){const r=FKe(t,e,n)/7;return Pz(n?.roundingMethod)(r)}function xzt(t,e,n){const[r,i]=Zh(n?.in,t,e),o=mw(r,i),s=Math.abs(pzt(r,i));r.setFullYear(1584),i.setFullYear(1584);const a=mw(r,i)===-o,l=o*(s-+a);return l===0?0:l}function Czt(t,e){const[n,r]=Zh(t,e.start,e.end);return{start:n,end:r}}function p1e(t,e){const{start:n,end:r}=Czt(e?.in,t);let i=+n>+r;const o=k2(i?r:n,e),s=k2(i?n:r,e);o.setHours(15),s.setHours(15);const a=+s.getTime();let l=o,c=e?.step??1;if(!c)return[];c<0&&(c=-c,i=!i);const u=[];for(;+l<=a;)l.setHours(0),u.push(ta(n,l)),l=e9(l,c),l.setHours(15);return i?u.reverse():u}function m1e(t,e){const n=wi(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function wzt(t,e){const n=wi(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function tbe(t,e){const n=wi(t,e?.in);return n.setSeconds(59,999),n}const _zt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Szt=(t,e,n)=>{let r;const i=_zt[t];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function _Y(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const kzt={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ezt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Tzt={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Izt={date:_Y({formats:kzt,defaultWidth:"full"}),time:_Y({formats:Ezt,defaultWidth:"full"}),dateTime:_Y({formats:Tzt,defaultWidth:"full"})},jzt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Azt=(t,e,n,r)=>jzt[t];function $E(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let i;if(r==="formatting"&&t.formattingValues){const s=t.defaultFormattingWidth||t.defaultWidth,a=n?.width?String(n.width):s;i=t.formattingValues[a]||t.formattingValues[s]}else{const s=t.defaultWidth,a=n?.width?String(n.width):t.defaultWidth;i=t.values[a]||t.values[s]}const o=t.argumentCallback?t.argumentCallback(e):e;return i[o]}}const Rzt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Dzt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Ozt={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Pzt={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},$zt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Mzt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Lzt=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Fzt={ordinalNumber:Lzt,era:$E({values:Rzt,defaultWidth:"wide"}),quarter:$E({values:Dzt,defaultWidth:"wide",argumentCallback:t=>t-1}),month:$E({values:Ozt,defaultWidth:"wide"}),day:$E({values:Pzt,defaultWidth:"wide"}),dayPeriod:$E({values:$zt,defaultWidth:"wide",formattingValues:Mzt,defaultFormattingWidth:"wide"})};function ME(t){return(e,n={})=>{const r=n.width,i=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],o=e.match(i);if(!o)return null;const s=o[0],a=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?Bzt(a,f=>f.test(s)):Nzt(a,f=>f.test(s));let c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=e.slice(s.length);return{value:c,rest:u}}}function Nzt(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Bzt(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const i=r[0],o=e.match(t.parsePattern);if(!o)return null;let s=t.valueCallback?t.valueCallback(o[0]):o[0];s=n.valueCallback?n.valueCallback(s):s;const a=e.slice(i.length);return{value:s,rest:a}}}const zzt=/^(\d+)(th|st|nd|rd)?/i,Hzt=/\d+/i,Uzt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Wzt={any:[/^b/i,/^(a|c)/i]},qzt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Gzt={any:[/1/i,/2/i,/3/i,/4/i]},Yzt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Kzt={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Xzt={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Zzt={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Qzt={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Jzt={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},eHt={ordinalNumber:Vzt({matchPattern:zzt,parsePattern:Hzt,valueCallback:t=>parseInt(t,10)}),era:ME({matchPatterns:Uzt,defaultMatchWidth:"wide",parsePatterns:Wzt,defaultParseWidth:"any"}),quarter:ME({matchPatterns:qzt,defaultMatchWidth:"wide",parsePatterns:Gzt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:ME({matchPatterns:Yzt,defaultMatchWidth:"wide",parsePatterns:Kzt,defaultParseWidth:"any"}),day:ME({matchPatterns:Xzt,defaultMatchWidth:"wide",parsePatterns:Zzt,defaultParseWidth:"any"}),dayPeriod:ME({matchPatterns:Qzt,defaultMatchWidth:"any",parsePatterns:Jzt,defaultParseWidth:"any"})},$z={code:"en-US",formatDistance:Szt,formatLong:Izt,formatRelative:Azt,localize:Fzt,match:eHt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function tHt(t,e){const n=wi(t,e?.in);return h1e(n,wzt(n))+1}function zKe(t,e){const n=wi(t,e?.in),r=+s_(n)-+dzt(n);return Math.round(r/PKe)+1}function g1e(t,e){const n=wi(t,e?.in),r=n.getFullYear(),i=Z8(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,s=ta(e?.in||t,0);s.setFullYear(r+1,0,o),s.setHours(0,0,0,0);const a=k2(s,e),l=ta(e?.in||t,0);l.setFullYear(r,0,o),l.setHours(0,0,0,0);const c=k2(l,e);return+n>=+a?r+1:+n>=+c?r:r-1}function nHt(t,e){const n=Z8(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=g1e(t,e),o=ta(e?.in||t,0);return o.setFullYear(i,0,r),o.setHours(0,0,0,0),k2(o,e)}function _R(t,e){const n=wi(t,e?.in),r=+k2(n,e)-+nHt(n,e);return Math.round(r/PKe)+1}function Ia(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const C4={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Ia(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Ia(n+1,2)},d(t,e){return Ia(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Ia(t.getHours()%12||12,e.length)},H(t,e){return Ia(t.getHours(),e.length)},m(t,e){return Ia(t.getMinutes(),e.length)},s(t,e){return Ia(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return Ia(i,e.length)}},Bx={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},nbe={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return C4.y(t,e)},Y:function(t,e,n,r){const i=g1e(t,r),o=i>0?i:1-i;if(e==="YY"){const s=o%100;return Ia(s,2)}return e==="Yo"?n.ordinalNumber(o,{unit:"year"}):Ia(o,e.length)},R:function(t,e){const n=MKe(t);return Ia(n,e.length)},u:function(t,e){const n=t.getFullYear();return Ia(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Ia(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Ia(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return C4.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Ia(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const i=_R(t,r);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):Ia(i,e.length)},I:function(t,e,n){const r=zKe(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Ia(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):C4.d(t,e)},D:function(t,e,n){const r=tHt(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Ia(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const i=t.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return Ia(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const i=t.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return Ia(o,e.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return Ia(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let i;switch(r===12?i=Bx.noon:r===0?i=Bx.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let i;switch(r>=17?i=Bx.evening:r>=12?i=Bx.afternoon:r>=4?i=Bx.morning:i=Bx.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return C4.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):C4.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Ia(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Ia(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):C4.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):C4.s(t,e)},S:function(t,e){return C4.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ibe(r);case"XXXX":case"XX":return Cb(r);default:return Cb(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return ibe(r);case"xxxx":case"xx":return Cb(r);default:return Cb(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+rbe(r,":");default:return"GMT"+Cb(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+rbe(r,":");default:return"GMT"+Cb(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Ia(r,e.length)},T:function(t,e,n){return Ia(+t,e.length)}};function rbe(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Math.trunc(r/60),o=r%60;return o===0?n+String(i):n+String(i)+e+Ia(o,2)}function ibe(t,e){return t%60===0?(t>0?"-":"+")+Ia(Math.abs(t)/60,2):Cb(t,e)}function Cb(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Ia(Math.trunc(r/60),2),o=Ia(r%60,2);return n+i+e+o}const obe=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},HKe=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},rHt=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return obe(t,e);let o;switch(r){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",obe(r,e)).replace("{{time}}",HKe(i,e))},coe={p:HKe,P:rHt},iHt=/^D+$/,oHt=/^Y+$/,sHt=["D","DD","YY","YYYY"];function UKe(t){return iHt.test(t)}function WKe(t){return oHt.test(t)}function uoe(t,e,n){const r=aHt(t,e,n);if(console.warn(r),sHt.includes(t))throw new RangeError(r)}function aHt(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const lHt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,cHt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,uHt=/^'([^]*?)'?$/,dHt=/''/g,fHt=/[a-zA-Z]/;function Xs(t,e,n){const r=Z8(),i=n?.locale??r.locale??$z,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=wi(t,n?.in);if(!nf(a))throw new RangeError("Invalid time value");let l=e.match(cHt).map(u=>{const f=u[0];if(f==="p"||f==="P"){const h=coe[f];return h(u,i.formatLong)}return u}).join("").match(lHt).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const f=u[0];if(f==="'")return{isToken:!1,value:hHt(u)};if(nbe[f])return{isToken:!0,value:u};if(f.match(fHt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+f+"`");return{isToken:!1,value:u}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const c={firstWeekContainsDate:o,weekStartsOn:s,locale:i};return l.map(u=>{if(!u.isToken)return u.value;const f=u.value;(!n?.useAdditionalWeekYearTokens&&WKe(f)||!n?.useAdditionalDayOfYearTokens&&UKe(f))&&uoe(f,e,String(t));const h=nbe[f[0]];return h(a,f,i.localize,c)}).join("")}function hHt(t){const e=t.match(uHt);return e?e[1].replace(dHt,"'"):t}function pHt(t,e,n){const r=Z8(),i=n?.locale??r.locale??$z,o=2520,s=mw(t,e);if(isNaN(s))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:s}),[l,c]=Zh(n?.in,...s>0?[e,t]:[t,e]),u=VKe(c,l),f=(a_(c)-a_(l))/1e3,h=Math.round((u-f)/60);let p;if(h<2)return n?.includeSeconds?u<5?i.formatDistance("lessThanXSeconds",5,a):u<10?i.formatDistance("lessThanXSeconds",10,a):u<20?i.formatDistance("lessThanXSeconds",20,a):u<40?i.formatDistance("halfAMinute",0,a):u<60?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",1,a):h===0?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",h,a);if(h<45)return i.formatDistance("xMinutes",h,a);if(h<90)return i.formatDistance("aboutXHours",1,a);if(h+wi(e)}function cg(t,e){return+wi(t)<+wi(e)}function bHt(t,e){const n=vHt(e)?new e(0):ta(e,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),n}function vHt(t){return typeof t=="function"&&t.prototype?.constructor===t}const xHt=10;class YKe{subPriority=0;validate(e,n){return!0}}class CHt extends YKe{constructor(e,n,r,i,o){super(),this.value=e,this.validateValue=n,this.setValue=r,this.priority=i,o&&(this.subPriority=o)}validate(e,n){return this.validateValue(e,this.value,n)}set(e,n,r){return this.setValue(e,n,this.value,r)}}class wHt extends YKe{priority=xHt;subPriority=-1;constructor(e,n){super(),this.context=e||(r=>ta(n,r))}set(e,n){return n.timestampIsSet?e:ta(e,bHt(e,this.context))}}let na=class{run(e,n,r,i){const o=this.parse(e,n,r,i);return o?{setter:new CHt(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(e,n,r){return!0}};class _Ht extends na{priority=140;parse(e,n,r){switch(n){case"G":case"GG":case"GGG":return r.era(e,{width:"abbreviated"})||r.era(e,{width:"narrow"});case"GGGGG":return r.era(e,{width:"narrow"});default:return r.era(e,{width:"wide"})||r.era(e,{width:"abbreviated"})||r.era(e,{width:"narrow"})}}set(e,n,r){return n.era=r,e.setFullYear(r,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]}const nu={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},B5={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function ru(t,e){return t&&{value:e(t.value),rest:t.rest}}function vc(t,e){const n=e.match(t);return n?{value:parseInt(n[0],10),rest:e.slice(n[0].length)}:null}function V5(t,e){const n=e.match(t);if(!n)return null;if(n[0]==="Z")return{value:0,rest:e.slice(1)};const r=n[1]==="+"?1:-1,i=n[2]?parseInt(n[2],10):0,o=n[3]?parseInt(n[3],10):0,s=n[5]?parseInt(n[5],10):0;return{value:r*(i*CR+o*Oz+s*azt),rest:e.slice(n[0].length)}}function KKe(t){return vc(nu.anyDigitsSigned,t)}function Nc(t,e){switch(t){case 1:return vc(nu.singleDigit,e);case 2:return vc(nu.twoDigits,e);case 3:return vc(nu.threeDigits,e);case 4:return vc(nu.fourDigits,e);default:return vc(new RegExp("^\\d{1,"+t+"}"),e)}}function rN(t,e){switch(t){case 1:return vc(nu.singleDigitSigned,e);case 2:return vc(nu.twoDigitsSigned,e);case 3:return vc(nu.threeDigitsSigned,e);case 4:return vc(nu.fourDigitsSigned,e);default:return vc(new RegExp("^-?\\d{1,"+t+"}"),e)}}function b1e(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}function XKe(t,e){const n=e>0,r=n?e:1-e;let i;if(r<=50)i=t||100;else{const o=r+50,s=Math.trunc(o/100)*100,a=t>=o%100;i=t+s-(a?100:0)}return n?i:1-i}function ZKe(t){return t%400===0||t%4===0&&t%100!==0}class SHt extends na{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,n,r){const i=o=>({year:o,isTwoDigitYear:n==="yy"});switch(n){case"y":return ru(Nc(4,e),i);case"yo":return ru(r.ordinalNumber(e,{unit:"year"}),i);default:return ru(Nc(n.length,e),i)}}validate(e,n){return n.isTwoDigitYear||n.year>0}set(e,n,r){const i=e.getFullYear();if(r.isTwoDigitYear){const s=XKe(r.year,i);return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}const o=!("era"in n)||n.era===1?r.year:1-r.year;return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}}class kHt extends na{priority=130;parse(e,n,r){const i=o=>({year:o,isTwoDigitYear:n==="YY"});switch(n){case"Y":return ru(Nc(4,e),i);case"Yo":return ru(r.ordinalNumber(e,{unit:"year"}),i);default:return ru(Nc(n.length,e),i)}}validate(e,n){return n.isTwoDigitYear||n.year>0}set(e,n,r,i){const o=g1e(e,i);if(r.isTwoDigitYear){const a=XKe(r.year,o);return e.setFullYear(a,0,i.firstWeekContainsDate),e.setHours(0,0,0,0),k2(e,i)}const s=!("era"in n)||n.era===1?r.year:1-r.year;return e.setFullYear(s,0,i.firstWeekContainsDate),e.setHours(0,0,0,0),k2(e,i)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]}class EHt extends na{priority=130;parse(e,n){return rN(n==="R"?4:n.length,e)}set(e,n,r){const i=ta(e,0);return i.setFullYear(r,0,4),i.setHours(0,0,0,0),s_(i)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]}class THt extends na{priority=130;parse(e,n){return rN(n==="u"?4:n.length,e)}set(e,n,r){return e.setFullYear(r,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]}class IHt extends na{priority=120;parse(e,n,r){switch(n){case"Q":case"QQ":return Nc(n.length,e);case"Qo":return r.ordinalNumber(e,{unit:"quarter"});case"QQQ":return r.quarter(e,{width:"abbreviated",context:"formatting"})||r.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return r.quarter(e,{width:"narrow",context:"formatting"});default:return r.quarter(e,{width:"wide",context:"formatting"})||r.quarter(e,{width:"abbreviated",context:"formatting"})||r.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,n){return n>=1&&n<=4}set(e,n,r){return e.setMonth((r-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]}class jHt extends na{priority=120;parse(e,n,r){switch(n){case"q":case"qq":return Nc(n.length,e);case"qo":return r.ordinalNumber(e,{unit:"quarter"});case"qqq":return r.quarter(e,{width:"abbreviated",context:"standalone"})||r.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return r.quarter(e,{width:"narrow",context:"standalone"});default:return r.quarter(e,{width:"wide",context:"standalone"})||r.quarter(e,{width:"abbreviated",context:"standalone"})||r.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,n){return n>=1&&n<=4}set(e,n,r){return e.setMonth((r-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]}class AHt extends na{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,n,r){const i=o=>o-1;switch(n){case"M":return ru(vc(nu.month,e),i);case"MM":return ru(Nc(2,e),i);case"Mo":return ru(r.ordinalNumber(e,{unit:"month"}),i);case"MMM":return r.month(e,{width:"abbreviated",context:"formatting"})||r.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return r.month(e,{width:"narrow",context:"formatting"});default:return r.month(e,{width:"wide",context:"formatting"})||r.month(e,{width:"abbreviated",context:"formatting"})||r.month(e,{width:"narrow",context:"formatting"})}}validate(e,n){return n>=0&&n<=11}set(e,n,r){return e.setMonth(r,1),e.setHours(0,0,0,0),e}}class RHt extends na{priority=110;parse(e,n,r){const i=o=>o-1;switch(n){case"L":return ru(vc(nu.month,e),i);case"LL":return ru(Nc(2,e),i);case"Lo":return ru(r.ordinalNumber(e,{unit:"month"}),i);case"LLL":return r.month(e,{width:"abbreviated",context:"standalone"})||r.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return r.month(e,{width:"narrow",context:"standalone"});default:return r.month(e,{width:"wide",context:"standalone"})||r.month(e,{width:"abbreviated",context:"standalone"})||r.month(e,{width:"narrow",context:"standalone"})}}validate(e,n){return n>=0&&n<=11}set(e,n,r){return e.setMonth(r,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]}function DHt(t,e,n){const r=wi(t,n?.in),i=_R(r,n)-e;return r.setDate(r.getDate()-i*7),wi(r,n?.in)}class OHt extends na{priority=100;parse(e,n,r){switch(n){case"w":return vc(nu.week,e);case"wo":return r.ordinalNumber(e,{unit:"week"});default:return Nc(n.length,e)}}validate(e,n){return n>=1&&n<=53}set(e,n,r,i){return k2(DHt(e,r,i),i)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]}function PHt(t,e,n){const r=wi(t,n?.in),i=zKe(r,n)-e;return r.setDate(r.getDate()-i*7),r}class $Ht extends na{priority=100;parse(e,n,r){switch(n){case"I":return vc(nu.week,e);case"Io":return r.ordinalNumber(e,{unit:"week"});default:return Nc(n.length,e)}}validate(e,n){return n>=1&&n<=53}set(e,n,r){return s_(PHt(e,r))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]}const MHt=[31,28,31,30,31,30,31,31,30,31,30,31],LHt=[31,29,31,30,31,30,31,31,30,31,30,31];class FHt extends na{priority=90;subPriority=1;parse(e,n,r){switch(n){case"d":return vc(nu.date,e);case"do":return r.ordinalNumber(e,{unit:"date"});default:return Nc(n.length,e)}}validate(e,n){const r=e.getFullYear(),i=ZKe(r),o=e.getMonth();return i?n>=1&&n<=LHt[o]:n>=1&&n<=MHt[o]}set(e,n,r){return e.setDate(r),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]}class NHt extends na{priority=90;subpriority=1;parse(e,n,r){switch(n){case"D":case"DD":return vc(nu.dayOfYear,e);case"Do":return r.ordinalNumber(e,{unit:"date"});default:return Nc(n.length,e)}}validate(e,n){const r=e.getFullYear();return ZKe(r)?n>=1&&n<=366:n>=1&&n<=365}set(e,n,r){return e.setMonth(0,r),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]}function v1e(t,e,n){const r=Z8(),i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=wi(t,n?.in),s=o.getDay(),l=(e%7+7)%7,c=7-i,u=e<0||e>6?e-(s+c)%7:(l+c)%7-(s+c)%7;return cl(o,u,n)}class BHt extends na{priority=90;parse(e,n,r){switch(n){case"E":case"EE":case"EEE":return r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return r.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});default:return r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"})}}validate(e,n){return n>=0&&n<=6}set(e,n,r,i){return e=v1e(e,r,i),e.setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]}class VHt extends na{priority=90;parse(e,n,r,i){const o=s=>{const a=Math.floor((s-1)/7)*7;return(s+i.weekStartsOn+6)%7+a};switch(n){case"e":case"ee":return ru(Nc(n.length,e),o);case"eo":return ru(r.ordinalNumber(e,{unit:"day"}),o);case"eee":return r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"eeeee":return r.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});default:return r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"})}}validate(e,n){return n>=0&&n<=6}set(e,n,r,i){return e=v1e(e,r,i),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]}class zHt extends na{priority=90;parse(e,n,r,i){const o=s=>{const a=Math.floor((s-1)/7)*7;return(s+i.weekStartsOn+6)%7+a};switch(n){case"c":case"cc":return ru(Nc(n.length,e),o);case"co":return ru(r.ordinalNumber(e,{unit:"day"}),o);case"ccc":return r.day(e,{width:"abbreviated",context:"standalone"})||r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"});case"ccccc":return r.day(e,{width:"narrow",context:"standalone"});case"cccccc":return r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"});default:return r.day(e,{width:"wide",context:"standalone"})||r.day(e,{width:"abbreviated",context:"standalone"})||r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"})}}validate(e,n){return n>=0&&n<=6}set(e,n,r,i){return e=v1e(e,r,i),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]}function HHt(t,e,n){const r=wi(t,n?.in),i=yHt(r,n),o=e-i;return cl(r,o,n)}class UHt extends na{priority=90;parse(e,n,r){const i=o=>o===0?7:o;switch(n){case"i":case"ii":return Nc(n.length,e);case"io":return r.ordinalNumber(e,{unit:"day"});case"iii":return ru(r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"}),i);case"iiiii":return ru(r.day(e,{width:"narrow",context:"formatting"}),i);case"iiiiii":return ru(r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"}),i);default:return ru(r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"}),i)}}validate(e,n){return n>=1&&n<=7}set(e,n,r){return e=HHt(e,r),e.setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]}class WHt extends na{priority=80;parse(e,n,r){switch(n){case"a":case"aa":case"aaa":return r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return r.dayPeriod(e,{width:"narrow",context:"formatting"});default:return r.dayPeriod(e,{width:"wide",context:"formatting"})||r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,n,r){return e.setHours(b1e(r),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]}class qHt extends na{priority=80;parse(e,n,r){switch(n){case"b":case"bb":case"bbb":return r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return r.dayPeriod(e,{width:"narrow",context:"formatting"});default:return r.dayPeriod(e,{width:"wide",context:"formatting"})||r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,n,r){return e.setHours(b1e(r),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]}class GHt extends na{priority=80;parse(e,n,r){switch(n){case"B":case"BB":case"BBB":return r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return r.dayPeriod(e,{width:"narrow",context:"formatting"});default:return r.dayPeriod(e,{width:"wide",context:"formatting"})||r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,n,r){return e.setHours(b1e(r),0,0,0),e}incompatibleTokens=["a","b","t","T"]}class YHt extends na{priority=70;parse(e,n,r){switch(n){case"h":return vc(nu.hour12h,e);case"ho":return r.ordinalNumber(e,{unit:"hour"});default:return Nc(n.length,e)}}validate(e,n){return n>=1&&n<=12}set(e,n,r){const i=e.getHours()>=12;return i&&r<12?e.setHours(r+12,0,0,0):!i&&r===12?e.setHours(0,0,0,0):e.setHours(r,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]}class KHt extends na{priority=70;parse(e,n,r){switch(n){case"H":return vc(nu.hour23h,e);case"Ho":return r.ordinalNumber(e,{unit:"hour"});default:return Nc(n.length,e)}}validate(e,n){return n>=0&&n<=23}set(e,n,r){return e.setHours(r,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]}class XHt extends na{priority=70;parse(e,n,r){switch(n){case"K":return vc(nu.hour11h,e);case"Ko":return r.ordinalNumber(e,{unit:"hour"});default:return Nc(n.length,e)}}validate(e,n){return n>=0&&n<=11}set(e,n,r){return e.getHours()>=12&&r<12?e.setHours(r+12,0,0,0):e.setHours(r,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]}class ZHt extends na{priority=70;parse(e,n,r){switch(n){case"k":return vc(nu.hour24h,e);case"ko":return r.ordinalNumber(e,{unit:"hour"});default:return Nc(n.length,e)}}validate(e,n){return n>=1&&n<=24}set(e,n,r){const i=r<=24?r%24:r;return e.setHours(i,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]}class QHt extends na{priority=60;parse(e,n,r){switch(n){case"m":return vc(nu.minute,e);case"mo":return r.ordinalNumber(e,{unit:"minute"});default:return Nc(n.length,e)}}validate(e,n){return n>=0&&n<=59}set(e,n,r){return e.setMinutes(r,0,0),e}incompatibleTokens=["t","T"]}class JHt extends na{priority=50;parse(e,n,r){switch(n){case"s":return vc(nu.second,e);case"so":return r.ordinalNumber(e,{unit:"second"});default:return Nc(n.length,e)}}validate(e,n){return n>=0&&n<=59}set(e,n,r){return e.setSeconds(r,0),e}incompatibleTokens=["t","T"]}class eUt extends na{priority=30;parse(e,n){const r=i=>Math.trunc(i*Math.pow(10,-n.length+3));return ru(Nc(n.length,e),r)}set(e,n,r){return e.setMilliseconds(r),e}incompatibleTokens=["t","T"]}class tUt extends na{priority=10;parse(e,n){switch(n){case"X":return V5(B5.basicOptionalMinutes,e);case"XX":return V5(B5.basic,e);case"XXXX":return V5(B5.basicOptionalSeconds,e);case"XXXXX":return V5(B5.extendedOptionalSeconds,e);default:return V5(B5.extended,e)}}set(e,n,r){return n.timestampIsSet?e:ta(e,e.getTime()-a_(e)-r)}incompatibleTokens=["t","T","x"]}class nUt extends na{priority=10;parse(e,n){switch(n){case"x":return V5(B5.basicOptionalMinutes,e);case"xx":return V5(B5.basic,e);case"xxxx":return V5(B5.basicOptionalSeconds,e);case"xxxxx":return V5(B5.extendedOptionalSeconds,e);default:return V5(B5.extended,e)}}set(e,n,r){return n.timestampIsSet?e:ta(e,e.getTime()-a_(e)-r)}incompatibleTokens=["t","T","X"]}class rUt extends na{priority=40;parse(e){return KKe(e)}set(e,n,r){return[ta(e,r*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"}class iUt extends na{priority=20;parse(e){return KKe(e)}set(e,n,r){return[ta(e,r),{timestampIsSet:!0}]}incompatibleTokens="*"}const oUt={G:new _Ht,y:new SHt,Y:new kHt,R:new EHt,u:new THt,Q:new IHt,q:new jHt,M:new AHt,L:new RHt,w:new OHt,I:new $Ht,d:new FHt,D:new NHt,E:new BHt,e:new VHt,c:new zHt,i:new UHt,a:new WHt,b:new qHt,B:new GHt,h:new YHt,H:new KHt,K:new XHt,k:new ZHt,m:new QHt,s:new JHt,S:new eUt,X:new tUt,x:new nUt,t:new rUt,T:new iUt},sUt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,aUt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,lUt=/^'([^]*?)'?$/,cUt=/''/g,uUt=/\S/,dUt=/[a-zA-Z]/;function Wg(t,e,n,r){const i=()=>ta(n,NaN),o=gHt(),s=o.locale??$z,a=o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,l=o.weekStartsOn??o.locale?.options?.weekStartsOn??0;if(!e)return t?i():wi(n,r?.in);const c={firstWeekContainsDate:a,weekStartsOn:l,locale:s},u=[new wHt(r?.in,n)],f=e.match(aUt).map(y=>{const b=y[0];if(b in coe){const v=coe[b];return v(y,s.formatLong)}return y}).join("").match(sUt),h=[];for(let y of f){WKe(y)&&uoe(y,e,t),UKe(y)&&uoe(y,e,t);const b=y[0],v=oUt[b];if(v){const{incompatibleTokens:x}=v;if(Array.isArray(x)){const w=h.find(_=>x.includes(_.token)||_.token===b);if(w)throw new RangeError(`The format string mustn't contain \`${w.fullToken}\` and \`${y}\` at the same time`)}else if(v.incompatibleTokens==="*"&&h.length>0)throw new RangeError(`The format string mustn't contain \`${y}\` and any other token at the same time`);h.push({token:b,fullToken:y});const C=v.run(t,y,s.match,c);if(!C)return i();u.push(C.setter),t=C.rest}else{if(b.match(dUt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");if(y==="''"?y="'":b==="'"&&(y=fUt(y)),t.indexOf(y)===0)t=t.slice(y.length);else return i()}}if(t.length>0&&uUt.test(t))return i();const p=u.map(y=>y.priority).sort((y,b)=>b-y).filter((y,b,v)=>v.indexOf(y)===b).map(y=>u.filter(b=>b.priority===y).sort((b,v)=>v.subPriority-b.subPriority)).map(y=>y[0]);let m=wi(n,r?.in);if(isNaN(+m))return i();const g={};for(const y of p){if(!y.validate(m,c))return i();const b=y.set(m,g,c);Array.isArray(b)?(m=b[0],Object.assign(g,b[1])):m=b}return m}function fUt(t){return t.match(lUt)[1].replace(cUt,"'")}function Mz(t){return+wi(t)ta(e?.in,NaN),i=wUt(t);let o;if(i.date){const c=_Ut(i.date,2);o=SUt(c.restDateString,c.year)}if(!o||isNaN(+o))return n();const s=+o;let a=0,l;if(i.time&&(a=kUt(i.time),isNaN(a)))return n();if(i.timezone){if(l=EUt(i.timezone),isNaN(l))return n()}else{const c=new Date(s+a),u=wi(0,e?.in);return u.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),u.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),u}return wi(s+a+l,e?.in)}const SP={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},vUt=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,xUt=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,CUt=/^([+-])(\d{2})(?::?(\d{2}))?$/;function wUt(t){const e={},n=t.split(SP.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],SP.timeZoneDelimiter.test(e.date)&&(e.date=t.split(SP.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const i=SP.timezone.exec(r);i?(e.time=r.replace(i[1],""),e.timezone=i[1]):e.time=r}return e}function _Ut(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const i=r[1]?parseInt(r[1]):null,o=r[2]?parseInt(r[2]):null;return{year:o===null?i:o*100,restDateString:t.slice((r[1]||r[2]).length)}}function SUt(t,e){if(e===null)return new Date(NaN);const n=t.match(vUt);if(!n)return new Date(NaN);const r=!!n[4],i=LE(n[1]),o=LE(n[2])-1,s=LE(n[3]),a=LE(n[4]),l=LE(n[5])-1;if(r)return RUt(e,a,l)?TUt(e,a,l):new Date(NaN);{const c=new Date(0);return!jUt(e,o,s)||!AUt(e,i)?new Date(NaN):(c.setUTCFullYear(e,o,Math.max(i,s)),c)}}function LE(t){return t?parseInt(t):1}function kUt(t){const e=t.match(xUt);if(!e)return NaN;const n=SY(e[1]),r=SY(e[2]),i=SY(e[3]);return DUt(n,r,i)?n*CR+r*Oz+i*1e3:NaN}function SY(t){return t&&parseFloat(t.replace(",","."))||0}function EUt(t){if(t==="Z")return 0;const e=t.match(CUt);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),i=e[3]&&parseInt(e[3])||0;return OUt(r,i)?n*(r*CR+i*Oz):NaN}function TUt(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const i=r.getUTCDay()||7,o=(e-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+o),r}const IUt=[31,null,31,30,31,30,31,31,30,31,30,31];function QKe(t){return t%400===0||t%4===0&&t%100!==0}function jUt(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(IUt[e]||(QKe(t)?29:28))}function AUt(t,e){return e>=1&&e<=(QKe(t)?366:365)}function RUt(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function DUt(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function OUt(t,e){return e>=0&&e<=59}function x1e(t,e,n){const r=wi(t,n?.in),i=r.getFullYear(),o=r.getDate(),s=ta(t,0);s.setFullYear(i,e,15),s.setHours(0,0,0,0);const a=mHt(s);return r.setMonth(e,Math.min(o,a)),r}function PUt(t,e,n){let r=wi(t,n?.in);return isNaN(+r)?ta(t,NaN):(e.year!=null&&r.setFullYear(e.year),e.month!=null&&(r=x1e(r,e.month)),e.date!=null&&r.setDate(e.date),e.hours!=null&&r.setHours(e.hours),e.minutes!=null&&r.setMinutes(e.minutes),e.seconds!=null&&r.setSeconds(e.seconds),e.milliseconds!=null&&r.setMilliseconds(e.milliseconds),r)}function JKe(t,e,n){const r=wi(t,n?.in);return r.setDate(e),r}function t9(t,e,n){const r=wi(t,n?.in);return r.setHours(e),r}function m7(t,e,n){const r=wi(t,n?.in);return r.setMinutes(e),r}function eXe(t,e,n){const r=wi(t,n?.in);return isNaN(+r)?ta(t,NaN):(r.setFullYear(e),r)}function sbe(t){return D7(Date.now(),t)}function $Ut(t,e,n){return wR(t,-e,n)}function abe(t,e,n){const{years:r=0,months:i=0,weeks:o=0,days:s=0,hours:a=0,minutes:l=0,seconds:c=0}=e,u=$Ut(t,i+r*12,n),f=bUt(u,s+o*7,n),h=l+a*60,m=(c+h*60)*1e3;return ta(t,+f-m)}const c_=t=>t.replace(/@posix$/,"");function lbe(t,e="long",n="en-US"){const r=c_(n);return new Intl.DateTimeFormat(r,{month:e}).format(t)}function kY(t,e="long",n="en-US"){const r=c_(n);return new Intl.DateTimeFormat(r,{weekday:e}).format(t)}function x5(t,e,n="en-US"){const r=c_(n);return new Intl.DateTimeFormat(r,e).format(t)}function hh(t,e){return String(t).padStart(e,"0")}function sb(t){const e=t%10,n=t%100;return e===1&&n!==11?`${t}st`:e===2&&n!==12?`${t}nd`:e===3&&n!==13?`${t}rd`:`${t}th`}function C1e(t){const e=t.getDay();return e===0?7:e}function tXe(t){const e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())),n=C1e(e);return e.setUTCDate(e.getUTCDate()-n+4),e.getUTCFullYear()}function MUt(t){const e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())),n=C1e(e);e.setUTCDate(e.getUTCDate()-n+4);const r=new Date(Date.UTC(e.getUTCFullYear(),0,1));return Math.ceil(((e.valueOf()-r.valueOf())/864e5+1)/7)}function EY(t){const e=new Date(Date.UTC(t.getFullYear(),0,1)),n=t.valueOf()-e.valueOf()+(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4;return Math.floor(n/(1e3*60*60*24))+1}function LUt(t){return tXe(t)}function FUt(t,e){const n=hh(t.getMilliseconds(),3);return e===1?n.slice(0,1):e===2?n.slice(0,2):e===3?n:`${n}0`}function cbe(t){const e=new Intl.DateTimeFormat(c_("en-US"),{timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName");return e?e.value:""}function NUt(t,e){const n=[],r=e.replace(/\[([^\]]+)\]/g,(x,C)=>(n.push(C),"")),i=t.getFullYear(),o=t.getMonth(),s=t.getDate(),a=t.getDay(),l=t.getHours(),c=t.getMinutes(),u=t.getSeconds(),f=MUt(t),h=tXe(t),p=LUt(t),m=t.getTime(),g=Math.floor(m/1e3),y=[{key:"YYYY",getValue:()=>String(i)},{key:"YY",getValue:()=>String(i).slice(-2)},{key:"Y",getValue:()=>String(i)},{key:"YYYYY",getValue:()=>hh(i,5)},{key:"GGGG",getValue:()=>String(h)},{key:"GG",getValue:()=>String(h).slice(-2)},{key:"gggg",getValue:()=>String(p)},{key:"gg",getValue:()=>String(p).slice(-2)},{key:"Q",getValue:()=>String(Math.floor(o/3)+1)},{key:"Qo",getValue:()=>sb(Math.floor(o/3)+1)},{key:"MMMM",getValue:()=>lbe(t,"long")},{key:"MMM",getValue:()=>lbe(t,"short")},{key:"MM",getValue:()=>hh(o+1,2)},{key:"M",getValue:()=>String(o+1)},{key:"Mo",getValue:()=>sb(o+1)},{key:"DD",getValue:()=>hh(s,2)},{key:"D",getValue:()=>String(s)},{key:"Do",getValue:()=>sb(s)},{key:"dddd",getValue:()=>kY(t,"long")},{key:"ddd",getValue:()=>kY(t,"short")},{key:"dd",getValue:()=>kY(t,"short").slice(0,2)},{key:"d",getValue:()=>String(a)},{key:"do",getValue:()=>sb(a+1)},{key:"DDDD",getValue:()=>hh(EY(t),3)},{key:"DDD",getValue:()=>String(EY(t))},{key:"DDDo",getValue:()=>sb(EY(t))},{key:"E",getValue:()=>String(C1e(t))},{key:"w",getValue:()=>hh(f,2)},{key:"wo",getValue:()=>sb(f)},{key:"ww",getValue:()=>hh(f,2)},{key:"WW",getValue:()=>hh(f,2)},{key:"W",getValue:()=>String(f)},{key:"Wo",getValue:()=>sb(f)},{key:"HH",getValue:()=>hh(l,2)},{key:"H",getValue:()=>String(l)},{key:"hh",getValue:()=>hh((l+11)%12+1,2)},{key:"h",getValue:()=>String((l+11)%12+1)},{key:"k",getValue:()=>String(l||24)},{key:"kk",getValue:()=>hh(l||24,2)},{key:"mm",getValue:()=>hh(c,2)},{key:"m",getValue:()=>String(c)},{key:"ss",getValue:()=>hh(u,2)},{key:"s",getValue:()=>String(u)},{key:"A",getValue:()=>l<12?"AM":"PM"},{key:"a",getValue:()=>l<12?"am":"pm"},{key:"X",getValue:()=>String(g)},{key:"x",getValue:()=>String(m)},{key:"N",getValue:()=>i<0?"BC":"AD"},{key:"NN",getValue:()=>i<0?"BC":"AD"},{key:"NNN",getValue:()=>i<0?"BC":"AD"},{key:"NNNN",getValue:()=>i<0?"Before Christ":"Anno Domini"},{key:"NNNNN",getValue:()=>i<0?"BC":"AD"},{key:"z",getValue:()=>cbe(t)},{key:"zz",getValue:()=>cbe(t)},{key:"Z",getValue:()=>Xs(t,"xxx")},{key:"ZZ",getValue:()=>Xs(t,"xx")},{key:"LTS",getValue:()=>x5(t,{timeStyle:"medium"})},{key:"LT",getValue:()=>x5(t,{timeStyle:"short"})},{key:"LLLL",getValue:()=>x5(t,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"})},{key:"LLL",getValue:()=>x5(t,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"})},{key:"LL",getValue:()=>x5(t,{year:"numeric",month:"long",day:"numeric"})},{key:"L",getValue:()=>x5(t,{year:"numeric",month:"2-digit",day:"2-digit"})},{key:"llll",getValue:()=>x5(t,{weekday:"short",year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"})},{key:"lll",getValue:()=>x5(t,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"})},{key:"ll",getValue:()=>x5(t,{year:"numeric",month:"short",day:"numeric"})},{key:"l",getValue:()=>x5(t,{year:"numeric",month:"numeric",day:"numeric"})}];y.sort((x,C)=>C.key.length-x.key.length);const b=new RegExp("(?FUt(t,x.length));for(const{key:x,getValue:C}of y){const w=x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`(^|[^A-Z0-9a-z])(${w})(?![A-Z0-9a-z])`,"g");if(v.match(_)){const S=C();v=v.replace(_,`$1${S}`)}}return v=v.replace(new RegExp("","g"),()=>n.shift()||""),v}function BUt(t){const e={YYYY:"yyyy",YY:"yy",MMMM:"MMMM",MMM:"MMM",MM:"MM",M:"M",DD:"dd",D:"d",dddd:"EEEE",ddd:"EEE",HH:"HH",H:"H",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",A:"a",a:"a"};return Object.keys(e).reduce((n,r)=>n.replace(new RegExp(r,"g"),e[r]),t)}const Q8="YYYY-MM-DD",w1e="HH:mm",VUt=Intl.DateTimeFormat().resolvedOptions().timeZone;function g7(t,e,n={useUTC:!1,timeZone:void 0}){const{useUTC:r,timeZone:i}=n;return NUt(r?new OKe(t):i?new kh(t,i||VUt):new Date(t),e)}function SR(t,e,n){const r=e?BUt(e):void 0,i=r?Wg(t,r,new Date):R9(t);if(i&&!isNaN(i.getTime())){let o=i;return n&&doe(n)&&e?o=new kh(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds(),n):n&&doe(n)&&(o=new kh(i,n)),{isValid:!0,date:o}}return{isValid:!1,error:`Invalid date. Must be on the format "${e}"`}}function doe(t){return Intl.supportedValuesOf("timeZone").includes(t)}const GM="https://cdn.sanity.io",zUt=/^https:\/\/cdn\.sanity\./,HUt=/^https:\/\/cdn\.[^/]+\/(images|files)\/[^/]+\/.*?[a-zA-Z0-9_]{24,40}.*$/,nXe=/^([a-zA-Z0-9_]{24,40}|[a-f0-9]{40})+\.[a-z0-9]+$/,_1e=/^file-([a-zA-Z0-9_]{24,40}|[a-f0-9]{40})+-[a-z0-9]+$/,S1e=/^([a-zA-Z0-9_]{24,40}|[a-f0-9]{40})-\d+x\d+\.[a-z0-9]+$/,rXe=/^image-([a-zA-Z0-9_]{24,40}|[a-f0-9]{40})+-\d+x\d+-[a-z0-9]+$/,k1e=/^(images|files)\/([a-z0-9]+)\/([a-z0-9][-\w]*)\//,iXe=/^(?:image-(?:[a-zA-Z0-9_]{24,40}|[a-f0-9]{40})+-\d+x\d+-[a-z0-9]+|file-(?:[a-zA-Z0-9_]{24,40}|[a-f0-9]{40})+-[a-z0-9]+)$/,UUt="upload-in-progress-placeholder";class Fz extends Error{constructor(e,n="Failed to resolve asset ID from source"){super(n),this.unresolvable=!0,this.input=e}}function WUt(t){const e=t;return!!(e.unresolvable&&"input"in e)}function E1e(t){return(...e)=>{try{return t(...e)}catch(n){if(WUt(n))return;throw n}}}function xS(t){return t!==null&&!Array.isArray(t)&&typeof t=="object"}function qUt(t){return xS(t)&&typeof t._ref=="string"}function GUt(t){return xS(t)&&typeof t._id=="string"}function YUt(t){return xS(t)&&typeof t.path=="string"}function KUt(t){return xS(t)&&typeof t.url=="string"}function XUt(t){return rXe.test(t)}function ZUt(t){return _1e.test(t)}function foe(t){const e=t;return xS(e)&&!!e.asset&&typeof e.asset=="object"}function oXe(t){const e=t;return xS(e)&&!!e._upload&&!("asset"in e)}function T1e(t){return zUt.test(t)||HUt.test(t)}const QUt=Object.freeze({left:0,top:0,bottom:0,right:0}),JUt=Object.freeze({x:.5,y:.5,height:1,width:1}),eWt=t=>{const{top:e,bottom:n,left:r,right:i}=t,{top:o,bottom:s,left:a,right:l}=QUt;return e===o&&n===s&&r===a&&i===l},tWt=t=>{const{x:e,y:n,width:r,height:i}=t,{x:o,y:s,width:a,height:l}=JUt;return e===o&&n===s&&r===a&&i===l};function sXe(t){if(k1e.test(t))return t;if(!T1e(t))throw new Fz(`Failed to resolve path from URL "${t}"`);return new URL(t).pathname.replace(/^\/+/,"")}const nWt=E1e(sXe);function rWt(t){const e=(nWt(t)||t).replace(/^(images|files)\/[a-z0-9]+\/[a-z0-9][-\w]\/*/,"");if(!aXe(e))throw new Fz(`Failed to resolve filename from URL "${t}"`);return e}const iWt=E1e(rWt);function aXe(t){return nXe.test(t)||S1e.test(t)}const oWt="file-027401f31c3ac1e6d78c5d539ccd1beff72b9b11-pdf",sWt="image-027401f31c3ac1e6d78c5d539ccd1beff72b9b11-2000x3000-jpg";function aWt(t){if(rXe.test(t))return lXe(t);if(_1e.test(t))return lWt(t);throw new Error(`Invalid image/file asset ID: ${t}`)}function lWt(t){if(!_1e.test(t))throw new Error(`Malformed file asset ID '${t}'. Expected an id like "${oWt}"`);const[,e,n]=t.split("-");return{type:"file",assetId:e,extension:n}}function lXe(t){const[,e,n,r]=t.split("-"),[i,o]=(n||"").split("x").map(Number);if(!e||!n||!r||!(i>0)||!(o>0))throw new Error(`Malformed asset ID '${t}'. Expected an id like "${sWt}".`);return{type:"image",assetId:e,width:i,height:o,extension:r}}function cWt(t){const e=iWt(t)||"";if(!aXe(e))throw new Error(`Invalid image/file asset filename: ${t}`);try{const n=S1e.test(e)?"image":"file",r=e.replace(/\.([a-z0-9+]+)$/i,"-$1");return aWt(`${n}-${r}`)}catch{throw new Error(`Invalid image/file asset filename: ${t}`)}}function cXe(t){if(!T1e(t))throw new Error(`URL is not a valid Sanity asset URL: ${t}`);const e=new URL(t).pathname.replace(/^\/+/,""),[n,,r,i]=e.match(k1e)||[];if(!n||!r||!i)throw new Error(`URL is not a valid Sanity asset URL: ${t}`);const[o,s]=e.slice(n.length).split("/");return{...cWt(o),projectId:r,dataset:i,vanityFilename:s}}function uWt(t){const e=cXe(t);if(e.type!=="image")throw new Error(`URL is not a valid Sanity image asset URL: ${t}`);return e}function dWt(t){try{return cXe(t).type}catch{return!1}}function uXe(t){if(oXe(t))return{width:0,height:0,aspectRatio:0};const e=dXe(t),{width:n,height:r}=lXe(e),i=n/r;return{width:n,height:r,aspectRatio:i}}function dXe(t){if(oXe(t))return UUt;const e=foe(t)?t.asset:t;let n="";if(typeof e=="string"?n=fWt(e):qUt(e)?n=e._ref:GUt(e)?n=e._id:YUt(e)?n=BC(`${GM}/${e.path}`):KUt(e)&&(n=BC(e.url)),!(n&&iXe.test(n)))throw new Fz(t);return n}const fXe=E1e(dXe);function fWt(t){if(iXe.test(t))return t;const e=T1e(t)?new URL(t).pathname:t;if(e.indexOf("/images")===0||e.indexOf("/files")===0)return BC(t);if(k1e.test(t))return BC(`${GM}/${t}`);if(pWt(t))return BC(`${GM}/files/a/b/${t}`);if(hWt(t))return BC(`${GM}/images/a/b/${t}`);throw new Fz(t)}function BC(t){const e=sXe(t),[n,,,r]=e.split("/");return`${n.replace(/s$/,"")}-${r.replace(/\./g,"-")}`}function hWt(t){return S1e.test(t)}function pWt(t){return nXe.test(t)}function hXe(t){const e=fXe(t);return e?e.startsWith("file-"):!1}function CS(t){const e=fXe(t);return e?e.startsWith("image-"):!1}function ube(t){return dWt(t)==="image"}const dbe="image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg";function mWt(t){const[,e,n,r]=t.split("-");if(!e||!n||!r)throw new Error(`Malformed asset _ref '${t}'. Expected an id like "${dbe}".`);const[i,o]=n.split("x"),s=+i,a=+o;if(!(isFinite(s)&&isFinite(a)))throw new Error(`Malformed asset _ref '${t}'. Expected an id like "${dbe}".`);return{id:e,width:s,height:a,format:r}}const gWt=t=>{const e=t;return e?typeof e._ref=="string":!1},yWt=t=>{const e=t;return e?typeof e._id=="string":!1},bWt=t=>{const e=t;return e&&e.asset?typeof e.asset.url=="string":!1},vWt=t=>{if(typeof t=="object"&&t!==null){const e=t;return e._upload&&(!e.asset||!e.asset._ref)}return!1};function xWt(t){if(!t)return null;let e;if(typeof t=="string"&&CWt(t))e={asset:{_ref:fbe(t)}};else if(typeof t=="string")e={asset:{_ref:t}};else if(gWt(t))e={asset:t};else if(yWt(t))e={asset:{_ref:t._id||""}};else if(bWt(t))e={asset:{_ref:fbe(t.asset.url)}};else if(typeof t.asset=="object")e={...t};else return null;const n=t;return n.crop&&(e.crop=n.crop),n.hotspot&&(e.hotspot=n.hotspot),wWt(e)}function CWt(t){return/^https?:\/\//.test(`${t}`)}function fbe(t){return`image-${t.split("/").slice(-1)[0]}`.replace(/\.([a-z]+)$/,"-$1")}function wWt(t){if(t.crop&&t.hotspot)return t;const e={...t};return e.crop||(e.crop={left:0,top:0,bottom:0,right:0}),e.hotspot||(e.hotspot={x:.5,y:.5,height:1,width:1}),e}const pXe=[["width","w"],["height","h"],["format","fm"],["download","dl"],["blur","blur"],["sharpen","sharp"],["invert","invert"],["orientation","or"],["minHeight","min-h"],["maxHeight","max-h"],["minWidth","min-w"],["maxWidth","max-w"],["quality","q"],["fit","fit"],["crop","crop"],["saturation","sat"],["auto","auto"],["dpr","dpr"],["pad","pad"],["frame","frame"]];function _Wt(t){let e={...t||{}};const n=e.source;delete e.source;const r=xWt(n);if(!r){if(n&&vWt(n))return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8HwQACfsD/QNViZkAAAAASUVORK5CYII=";throw new Error(`Unable to resolve image URL from source (${JSON.stringify(n)})`)}const i=r.asset._ref||r.asset._id||"",o=mWt(i),s=Math.round(r.crop.left*o.width),a=Math.round(r.crop.top*o.height),l={left:s,top:a,width:Math.round(o.width-r.crop.right*o.width-s),height:Math.round(o.height-r.crop.bottom*o.height-a)},c=r.hotspot.height*o.height/2,u=r.hotspot.width*o.width/2,f=r.hotspot.x*o.width,h=r.hotspot.y*o.height,p={left:f-u,top:h-c,right:f+u,bottom:h+c};return e.rect||e.focalPoint||e.ignoreImageParams||e.crop||(e={...e,...kWt({crop:l,hotspot:p},e)}),SWt({...e,asset:o})}function SWt(t){const e=(t.baseUrl||"https://cdn.sanity.io").replace(/\/+$/,""),n=t.vanityName?`/${t.vanityName}`:"",r=`${t.asset.id}-${t.asset.width}x${t.asset.height}.${t.asset.format}${n}`,i=t.mediaLibraryId?`${e}/media-libraries/${t.mediaLibraryId}/images/${r}`:`${e}/images/${t.projectId}/${t.dataset}/${r}`,o=[];if(t.rect){const{left:a,top:l,width:c,height:u}=t.rect;(a!==0||l!==0||u!==t.asset.height||c!==t.asset.width)&&o.push(`rect=${a},${l},${c},${u}`)}t.bg&&o.push(`bg=${t.bg}`),t.focalPoint&&(o.push(`fp-x=${t.focalPoint.x}`),o.push(`fp-y=${t.focalPoint.y}`));const s=[t.flipHorizontal&&"h",t.flipVertical&&"v"].filter(Boolean).join("");return s&&o.push(`flip=${s}`),pXe.forEach(a=>{const[l,c]=a;typeof t[l]<"u"?o.push(`${c}=${encodeURIComponent(t[l])}`):typeof t[c]<"u"&&o.push(`${c}=${encodeURIComponent(t[c])}`)}),o.length===0?i:`${i}?${o.join("&")}`}function kWt(t,e){let n;const r=e.width,i=e.height;if(!(r&&i))return{width:r,height:i,rect:t.crop};const o=t.crop,s=t.hotspot,a=r/i;if(o.width/o.height>a){const l=Math.round(o.height),c=Math.round(l*a),u=Math.max(0,Math.round(o.top)),f=Math.round((s.right-s.left)/2+s.left);let h=Math.max(0,Math.round(f-c/2));ho.left+o.width&&(h=o.left+o.width-c),n={left:h,top:u,width:c,height:l}}else{const l=o.width,c=Math.round(l/a),u=Math.max(0,Math.round(o.left)),f=Math.round((s.bottom-s.top)/2+s.top);let h=Math.max(0,Math.round(f-c/2));ho.top+o.height&&(h=o.top+o.height-c),n={left:u,top:h,width:l,height:c}}return{width:r,height:i,rect:n}}const EWt=["clip","crop","fill","fillmax","max","scale","min"],TWt=["top","bottom","left","right","center","focalpoint","entropy"],IWt=["format"];function jWt(t){return t&&"config"in t?typeof t.config=="function":!1}function AWt(t){return t&&"clientConfig"in t?typeof t.clientConfig=="object":!1}function hbe(t){const{apiHost:e,projectId:n,dataset:r}=t,i={baseUrl:(e||"https://api.sanity.io").replace(/^https:\/\/api\./,"https://cdn.")},o=t["~experimental_resource"];if(o?.type==="media-library"){if(typeof o.id!="string"||o.id.length===0)throw new Error('Media library clients must include an id in "~experimental_resource"');return{...i,mediaLibraryId:o.id}}return{...i,projectId:n,dataset:r}}function RWt(t){const e=pXe;for(const n of e){const[r,i]=n;if(t===r||t===i)return r}return t}function mXe(t){let e={};return jWt(t)?e=hbe(t.config()):AWt(t)?e=hbe(t.clientConfig):e=t||{},e}function DWt(t,e){const n=mXe(e);return new t(null,n)}function wS(t){return DWt(iN,t)}function OWt(t,e){const n=e.baseUrl||t.baseUrl,r={baseUrl:n};for(const i in e)if(e.hasOwnProperty(i)){const o=RWt(i);r[o]=e[i]}return{baseUrl:n,...r}}class iN{options;constructor(e,n){this.options=e?{...e.options||{},...n||{}}:{...n||{}}}withOptions(e){const n=OWt(this.options,e);return new iN(this,n)}image(e){return this.withOptions({source:e})}dataset(e){return this.withOptions({dataset:e})}projectId(e){return this.withOptions({projectId:e})}withClient(e){const n=mXe(e),r={...this.options};return delete r.baseUrl,delete r.projectId,delete r.dataset,delete r.mediaLibraryId,new iN(null,{...n,...r})}bg(e){return this.withOptions({bg:e})}dpr(e){return this.withOptions(e&&e!==1?{dpr:e}:{})}width(e){return this.withOptions({width:e})}height(e){return this.withOptions({height:e})}focalPoint(e,n){return this.withOptions({focalPoint:{x:e,y:n}})}maxWidth(e){return this.withOptions({maxWidth:e})}minWidth(e){return this.withOptions({minWidth:e})}maxHeight(e){return this.withOptions({maxHeight:e})}minHeight(e){return this.withOptions({minHeight:e})}size(e,n){return this.withOptions({width:e,height:n})}blur(e){return this.withOptions({blur:e})}sharpen(e){return this.withOptions({sharpen:e})}rect(e,n,r,i){return this.withOptions({rect:{left:e,top:n,width:r,height:i}})}format(e){return this.withOptions({format:e})}invert(e){return this.withOptions({invert:e})}orientation(e){return this.withOptions({orientation:e})}quality(e){return this.withOptions({quality:e})}forceDownload(e){return this.withOptions({download:e})}flipHorizontal(){return this.withOptions({flipHorizontal:!0})}flipVertical(){return this.withOptions({flipVertical:!0})}ignoreImageParams(){return this.withOptions({ignoreImageParams:!0})}fit(e){if(EWt.indexOf(e)===-1)throw new Error(`Invalid fit mode "${e}"`);return this.withOptions({fit:e})}crop(e){if(TWt.indexOf(e)===-1)throw new Error(`Invalid crop mode "${e}"`);return this.withOptions({crop:e})}saturation(e){return this.withOptions({saturation:e})}auto(e){if(IWt.indexOf(e)===-1)throw new Error(`Invalid auto mode "${e}"`);return this.withOptions({auto:e})}pad(e){return this.withOptions({pad:e})}vanityName(e){return this.withOptions({vanityName:e})}frame(e){if(e!==1)throw new Error(`Invalid frame value "${e}"`);return this.withOptions({frame:e})}url(){return _Wt(this.options)}toString(){return this.url()}}var TY,pbe;function PWt(){if(pbe)return TY;pbe=1;var t=(function(){function p(g,y){if(typeof g!="function")throw new TypeError("DataLoader must be constructed with a function which accepts "+("Array and returns Promise>, but got: "+g+"."));this._batchLoadFn=g,this._maxBatchSize=a(y),this._batchScheduleFn=l(y),this._cacheKeyFn=c(y),this._cacheMap=u(y),this._batch=null,this.name=f(y)}var m=p.prototype;return m.load=function(y){if(y==null)throw new TypeError("The loader.load() function must be called with a value, "+("but got: "+String(y)+"."));var b=r(this),v=this._cacheMap,x;if(v){x=this._cacheKeyFn(y);var C=v.get(x);if(C){var w=b.cacheHits||(b.cacheHits=[]);return new Promise(function(S){w.push(function(){S(C)})})}}b.keys.push(y);var _=new Promise(function(S,k){b.callbacks.push({resolve:S,reject:k})});return v&&v.set(x,_),_},m.loadMany=function(y){if(!h(y))throw new TypeError("The loader.loadMany() function must be called with Array "+("but got: "+y+"."));for(var b=[],v=0;v and returns Promise>, but the function "+("errored synchronously: "+String(y)+".")))}if(!g||typeof g.then!="function")return o(p,m,new TypeError("DataLoader must be constructed with a function which accepts Array and returns Promise>, but the function did "+("not return a Promise: "+String(g)+".")));g.then(function(y){if(!h(y))throw new TypeError("DataLoader must be constructed with a function which accepts Array and returns Promise>, but the function did "+("not return a Promise of an Array: "+String(y)+"."));if(y.length!==m.keys.length)throw new TypeError("DataLoader must be constructed with a function which accepts Array and returns Promise>, but the function did not return a Promise of an Array of the same length as the Array of keys."+(` + +Keys: +`+String(m.keys))+(` + +Values: +`+String(y)));s(m);for(var b=0;b0&&Object.prototype.hasOwnProperty.call(p,p.length-1))}return TY=t,TY}var $Wt=PWt();const I1e=rs($Wt);function MWt(t){const e=wg(t),[n,r]=E.useState(e),{defaultDpr:i,maxDpr:o,round:s}={};return E.useEffect(()=>{if(!(typeof window<"u"&&"matchMedia"in window))return;const l=()=>r(wg({defaultDpr:i,maxDpr:o,round:s})),c=window.matchMedia(`screen and (resolution: ${n}dppx)`);return c.addEventListener?c.addEventListener("change",l):c.addListener(l),()=>{c.removeEventListener?c.removeEventListener("change",l):c.removeListener(l)}},[n,i,o,s]),n}function wg(t){const{defaultDpr:e=1,maxDpr:n=3,round:r=!0}=t||{},o=typeof window<"u"&&typeof window.devicePixelRatio=="number"?window.devicePixelRatio:e;return Math.min(Math.max(1,r?Math.floor(o):o),n)}const LWt={current:[],added:[],removed:[]},FWt=[];function Oj(t,e=(n,r)=>n===r){return n=>{const r=n.pipe(sc()),i=r.pipe(Xa((c,u)=>{const f=u.filter(p=>!c.current.find(m=>e(m,p))),h=c.current.filter(p=>!u.find(m=>e(m,p)));return{current:u,added:mbe(f,e),removed:mbe(h,e)}},LWt)).pipe(sc(),nn(c=>c.added.length>0||c.removed.length>0)),o=i.pipe(Kt(c=>c.removed)),s=i.pipe(Kt(c=>c.added)),a=r.pipe(nn(c=>c.length===0),Je(()=>FWt)),l=s.pipe(Kt(c=>{const u=o.pipe(nn(f=>e(f,c))).pipe(sc());return ki(u.pipe(Je(()=>({type:"remove",element:c}))),t(c).pipe(lv(u),Je(f=>({type:"emit",element:c,projected:f}))))}),su(r),Xa((c,[u,f])=>f.flatMap(h=>e(h,u.element)?u.type==="remove"?[]:{item:h,emitted:!0,value:u.projected}:c.find(p=>p&&e(p.item,h))),[]),nn(c=>c.every(u=>u?.emitted)),Je(c=>c.map(u=>u.value)));return ki(a,l)}}function mbe(t,e){const n=[];let r=!1;for(const i of t)n.find(o=>e(o,i))?r=!0:n.push(i);return r?n:t}var ab={},gbe;function NWt(){if(gbe)return ab;gbe=1,Object.defineProperty(ab,"__esModule",{value:!0}),ab.make=ab.identity=void 0;function t(n){return n}ab.identity=t;function e(n){return n?function(r){return n(r),r}:t}return ab.make=e,ab}var Nz=NWt(),IY,ybe;function BWt(){if(ybe)return IY;ybe=1;function t(e,n,r,i){for(var o=-1,s=e==null?0:e.length;++o-1&&r%1==0&&r-1&&n%1==0&&n<=t}return UY=e,UY}var WY,$be;function YWt(){if($be)return WY;$be=1;var t=SS(),e=D1e(),n=ey(),r="[object Arguments]",i="[object Array]",o="[object Boolean]",s="[object Date]",a="[object Error]",l="[object Function]",c="[object Map]",u="[object Number]",f="[object Object]",h="[object RegExp]",p="[object Set]",m="[object String]",g="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",v="[object Float32Array]",x="[object Float64Array]",C="[object Int8Array]",w="[object Int16Array]",_="[object Int32Array]",S="[object Uint8Array]",k="[object Uint8ClampedArray]",I="[object Uint16Array]",j="[object Uint32Array]",A={};A[v]=A[x]=A[C]=A[w]=A[_]=A[S]=A[k]=A[I]=A[j]=!0,A[r]=A[i]=A[y]=A[o]=A[b]=A[s]=A[a]=A[l]=A[c]=A[u]=A[f]=A[h]=A[p]=A[m]=A[g]=!1;function D(O){return n(O)&&e(O.length)&&!!A[t(O)]}return WY=D,WY}var qY,Mbe;function Bz(){if(Mbe)return qY;Mbe=1;function t(e){return function(n){return e(n)}}return qY=t,qY}var zT={exports:{}};zT.exports;var Lbe;function O1e(){return Lbe||(Lbe=1,(function(t,e){var n=gXe(),r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o&&n.process,a=(function(){try{var l=i&&i.require&&i.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}})();t.exports=a})(zT,zT.exports)),zT.exports}var GY,Fbe;function yXe(){if(Fbe)return GY;Fbe=1;var t=YWt(),e=Bz(),n=O1e(),r=n&&n.isTypedArray,i=r?e(r):t;return GY=i,GY}var YY,Nbe;function bXe(){if(Nbe)return YY;Nbe=1;var t=HWt(),e=j1e(),n=B2(),r=A1e(),i=R1e(),o=yXe(),s=Object.prototype,a=s.hasOwnProperty;function l(c,u){var f=n(c),h=!f&&e(c),p=!f&&!h&&r(c),m=!f&&!h&&!p&&o(c),g=f||h||p||m,y=g?t(c.length,String):[],b=y.length;for(var v in c)(u||a.call(c,v))&&!(g&&(v=="length"||p&&(v=="offset"||v=="parent")||m&&(v=="buffer"||v=="byteLength"||v=="byteOffset")||i(v,b)))&&y.push(v);return y}return YY=l,YY}var KY,Bbe;function P1e(){if(Bbe)return KY;Bbe=1;var t=Object.prototype;function e(n){var r=n&&n.constructor,i=typeof r=="function"&&r.prototype||t;return n===i}return KY=e,KY}var XY,Vbe;function vXe(){if(Vbe)return XY;Vbe=1;function t(e,n){return function(r){return e(n(r))}}return XY=t,XY}var ZY,zbe;function KWt(){if(zbe)return ZY;zbe=1;var t=vXe(),e=t(Object.keys,Object);return ZY=e,ZY}var QY,Hbe;function XWt(){if(Hbe)return QY;Hbe=1;var t=P1e(),e=KWt(),n=Object.prototype,r=n.hasOwnProperty;function i(o){if(!t(o))return e(o);var s=[];for(var a in Object(o))r.call(o,a)&&a!="constructor"&&s.push(a);return s}return QY=i,QY}var JY,Ube;function J8(){if(Ube)return JY;Ube=1;function t(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}return JY=t,JY}var eK,Wbe;function xXe(){if(Wbe)return eK;Wbe=1;var t=SS(),e=J8(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function s(a){if(!e(a))return!1;var l=t(a);return l==r||l==i||l==n||l==o}return eK=s,eK}var tK,qbe;function kR(){if(qbe)return tK;qbe=1;var t=xXe(),e=D1e();function n(r){return r!=null&&e(r.length)&&!t(r)}return tK=n,tK}var nK,Gbe;function ER(){if(Gbe)return nK;Gbe=1;var t=bXe(),e=XWt(),n=kR();function r(i){return n(i)?t(i):e(i)}return nK=r,nK}var rK,Ybe;function ZWt(){if(Ybe)return rK;Ybe=1;var t=zWt(),e=ER();function n(r,i){return r&&t(r,i,e)}return rK=n,rK}var iK,Kbe;function QWt(){if(Kbe)return iK;Kbe=1;var t=kR();function e(n,r){return function(i,o){if(i==null)return i;if(!t(i))return n(i,o);for(var s=i.length,a=r?s:-1,l=Object(i);(r?a--:++a-1}return fK=e,fK}var hK,i9e;function iqt(){if(i9e)return hK;i9e=1;var t=Vz();function e(n,r){var i=this.__data__,o=t(i,n);return o<0?(++this.size,i.push([n,r])):i[o][1]=r,this}return hK=e,hK}var pK,o9e;function zz(){if(o9e)return pK;o9e=1;var t=eqt(),e=tqt(),n=nqt(),r=rqt(),i=iqt();function o(s){var a=-1,l=s==null?0:s.length;for(this.clear();++ap))return!1;var g=f.get(s),y=f.get(a);if(g&&y)return g==a&&y==s;var b=-1,v=!0,x=l&i?new t:void 0;for(f.set(s,a),f.set(a,s);++b1&&arguments[1]!==void 0?arguments[1]:0,n=(t1[t[e+0]]+t1[t[e+1]]+t1[t[e+2]]+t1[t[e+3]]+"-"+t1[t[e+4]]+t1[t[e+5]]+"-"+t1[t[e+6]]+t1[t[e+7]]+"-"+t1[t[e+8]]+t1[t[e+9]]+"-"+t1[t[e+10]]+t1[t[e+11]]+t1[t[e+12]]+t1[t[e+13]]+t1[t[e+14]]+t1[t[e+15]]).toLowerCase();if(!nGt(n))throw TypeError("Stringified UUID is invalid");return n}function ac(t,e,n){t=t||{};var r=t.random||(t.rng||eGt)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return rGt(r)}var zX,Dve;function iGt(){if(Dve)return zX;Dve=1;function t(e){return function(n){return e?.[n]}}return zX=t,zX}var HX,Ove;function oGt(){if(Ove)return HX;Ove=1;var t=iGt(),e={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},n=t(e);return HX=n,HX}var UX,Pve;function PXe(){if(Pve)return UX;Pve=1;var t=oGt(),e=ES(),n=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,r="\\u0300-\\u036f",i="\\ufe20-\\ufe2f",o="\\u20d0-\\u20ff",s=r+i+o,a="["+s+"]",l=RegExp(a,"g");function c(u){return u=e(u),u&&u.replace(n,t).replace(l,"")}return UX=c,UX}PXe();const oN=/^[a-z-A-Z0-9._-]+$/,sGt="drafts",aGt="versions",G1e=".",VC=`${sGt}${G1e}`,Fb=`${aGt}${G1e}`;function lGt(t){return{success:!1,error:t}}function cGt(t){return{success:!0,value:t}}function uGt(t){try{return cGt(t())}catch(e){return lGt(e instanceof Error?e:new Error(String(e)))}}function dGt(t,e){return Qqt(t,e)}Nz.make(t=>{Yz(t);const e=[LXe,$Xe,MXe].map(i=>uGt(()=>i(t))),[n,r]=dGt(e,i=>i.success);if(n.length>0)return t;if(r.length>0)throw new AggregateError(r.map(i=>i.error),`Invalid Document ID + - ${r.map(i=>i.error.message).join(` + - `)}`);return t});Nz.make(t=>{Yz(t),$Xe(t)});Nz.make(t=>{Yz(t),LXe(t)});Nz.make(t=>{Yz(t),MXe(t)});function Yz(t){if(t.length===0)throw new Error("Must be a non-empty string");if(!oN.test(t))throw new Error(`Not a valid document ID: "${t}" – Must match the ${oN} RegExp`);return t}function $Xe(t){if(!t.startsWith(VC))throw new Error(`Not a valid draft ID: "${t}" – must start with "${VC}"`);if(t.length===VC.length)throw new Error(`Not a valid draft ID: "${t}" – must have at least one character followed by "${VC}"`);return t}function MXe(t){if(!t.startsWith(Fb))throw new Error(`Not a valid version ID: "${t}" – must start with "${Fb}"`);if(t.length===Fb.length)throw new Error(`Not a valid version ID: "${t}" – must have at least one character followed by "${Fb}"`);const[,e,...n]=t.split(".");if(!e||!oN.test(e))throw new Error(`Not a valid version ID: "${t}" – VERSION must match the ${oN} RegExp in versions.[VERSION].id`);if(n.length===0)throw new Error(`Not a valid version ID: "${t}" – missing document ID in versions.bundle.[ID]`);if(e==="drafts"||e==="versions")throw new Error(`Not a valid version ID: "${t}" – invalid VERSION "${e}" in versions.[VERSION].id`);return t}function LXe(t){if(t.startsWith(VC)||t.startsWith(Fb))throw new Error(`Not a valid published ID: "${t}" – cannot start with "${VC}" or "${Fb}"`);return t}function fGt(t){return t.startsWith(Fb)}function hGt(t){const[,e]=t.split(G1e);return e}var WX={exports:{}},qX={};var $ve;function pGt(){if($ve)return qX;$ve=1;var t=Rg();function e(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function a(f,h){var p=h(),m=r({inst:{value:p,getSnapshot:h}}),g=m[0].inst,y=m[1];return o(function(){g.value=p,g.getSnapshot=h,l(g)&&y({inst:g})},[f,p,h]),i(function(){return l(g)&&y({inst:g}),f(function(){l(g)&&y({inst:g})})},[f]),s(p),p}function l(f){var h=f.getSnapshot;f=f.value;try{var p=h();return!n(f,p)}catch{return!0}}function c(f,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return qX.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,qX}var Mve;function FXe(){return Mve||(Mve=1,WX.exports=pGt()),WX.exports}var mGt=FXe();class Y1e extends Map{#t=0;#e=new Map;#n=new Map;#o;#r;#s;constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if(typeof e.maxAge=="number"&&e.maxAge===0)throw new TypeError("`maxAge` must be a number greater than 0");this.#o=e.maxSize,this.#r=e.maxAge||Number.POSITIVE_INFINITY,this.#s=e.onEviction}get __oldCache(){return this.#n}#a(e){if(typeof this.#s=="function")for(const[n,r]of e)this.#s(n,r.value)}#i(e,n){return typeof n.expiry=="number"&&n.expiry<=Date.now()?(typeof this.#s=="function"&&this.#s(e,n.value),this.delete(e)):!1}#f(e,n){if(this.#i(e,n)===!1)return n.value}#c(e,n){return n.expiry?this.#f(e,n):n.value}#u(e,n){const r=n.get(e);return this.#c(e,r)}#d(e,n){this.#e.set(e,n),this.#t++,this.#t>=this.#o&&(this.#t=0,this.#a(this.#n),this.#n=this.#e,this.#e=new Map)}#h(e,n){this.#n.delete(e),this.#d(e,n)}*#l(){for(const e of this.#n){const[n,r]=e;this.#e.has(n)||this.#i(n,r)===!1&&(yield e)}for(const e of this.#e){const[n,r]=e;this.#i(n,r)===!1&&(yield e)}}get(e){if(this.#e.has(e)){const n=this.#e.get(e);return this.#c(e,n)}if(this.#n.has(e)){const n=this.#n.get(e);if(this.#i(e,n)===!1)return this.#h(e,n),n.value}}set(e,n,{maxAge:r=this.#r}={}){const i=typeof r=="number"&&r!==Number.POSITIVE_INFINITY?Date.now()+r:void 0;return this.#e.has(e)?this.#e.set(e,{value:n,expiry:i}):this.#d(e,{value:n,expiry:i}),this}has(e){return this.#e.has(e)?!this.#i(e,this.#e.get(e)):this.#n.has(e)?!this.#i(e,this.#n.get(e)):!1}peek(e){if(this.#e.has(e))return this.#u(e,this.#e);if(this.#n.has(e))return this.#u(e,this.#n)}expiresIn(e){const n=this.#e.get(e)??this.#n.get(e);if(n)return n.expiry?n.expiry-Date.now():Number.POSITIVE_INFINITY}delete(e){const n=this.#e.delete(e);return n&&this.#t--,this.#n.delete(e)||n}clear(){this.#e.clear(),this.#n.clear(),this.#t=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const n=[...this.#l()],r=n.length-e;r<0?(this.#e=new Map(n),this.#n=new Map,this.#t=n.length):(r>0&&this.#a(n.slice(0,r)),this.#n=new Map(n.slice(r)),this.#e=new Map,this.#t=0),this.#o=e}evict(e=1){const n=Number(e);if(!n||n<=0)return;const r=[...this.#l()],i=Math.trunc(Math.min(n,Math.max(r.length-1,0)));i<=0||(this.#a(r.slice(0,i)),this.#n=new Map(r.slice(i)),this.#e=new Map,this.#t=0)}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.#e){const[n,r]=e;this.#i(n,r)===!1&&(yield[n,r.value])}for(const e of this.#n){const[n,r]=e;this.#e.has(n)||this.#i(n,r)===!1&&(yield[n,r.value])}}*entriesDescending(){let e=[...this.#e];for(let n=e.length-1;n>=0;--n){const r=e[n],[i,o]=r;this.#i(i,o)===!1&&(yield[i,o.value])}e=[...this.#n];for(let n=e.length-1;n>=0;--n){const r=e[n],[i,o]=r;this.#e.has(i)||this.#i(i,o)===!1&&(yield[i,o.value])}}*entriesAscending(){for(const[e,n]of this.#l())yield[e,n.value]}get size(){if(!this.#t)return this.#n.size;let e=0;for(const n of this.#n.keys())this.#e.has(n)||e++;return Math.min(this.#t+e,this.#o)}get maxSize(){return this.#o}get maxAge(){return this.#r}entries(){return this.entriesAscending()}forEach(e,n=this){for(const[r,i]of this.entriesAscending())e.call(n,i,r,this)}get[Symbol.toStringTag](){return"QuickLRU"}toString(){return`QuickLRU(${this.size}/${this.maxSize})`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}var GX={exports:{}};var Lve;function gGt(){return Lve||(Lve=1,(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var o="",s=0;s=8e3)&&(EP=new ArrayBuffer(8e3),FE=0),this._byte=new Uint8Array(EP,FE,80),this._word=new Int32Array(EP,FE,20),FE+=80}update(e){if(typeof e=="string")return this._utf8(e);if(e==null)throw new TypeError("Invalid type: "+typeof e);const n=e.byteOffset,r=e.byteLength;let i=r/64|0,o=0;if(i&&!(n&3)&&!(this._size%64)){const a=new Int32Array(e.buffer,n,i*16);for(;i--;)this._int32(a,o>>2),o+=64;this._size+=o}if(e.BYTES_PER_ELEMENT!==1&&e.buffer){const a=new Uint8Array(e.buffer,n+o,r-o);return this._uint8(a)}return o===r?this:this._uint8(e,o)}_uint8(e,n){const{_byte:r,_word:i}=this,o=e.length;for(n=n|0;n=64&&this._int32(i),this._size+=a-s}return this}_utf8(e){const{_byte:n,_word:r}=this,i=e.length;let o=this._sp;for(let s=0;s>>6,n[l++]=128|c&63):c<55296||c>57343?(n[l++]=224|c>>>12,n[l++]=128|c>>>6&63,n[l++]=128|c&63):o?(c=((o&1023)<<10)+(c&1023)+65536,n[l++]=240|c>>>18,n[l++]=128|c>>>12&63,n[l++]=128|c>>>6&63,n[l++]=128|c&63,o=0):o=c}l>=64&&(this._int32(r),r[0]=r[16]),this._size+=l-a}return this._sp=o,this}_int32(e,n){let{A:r,B:i,C:o,D:s,E:a,F:l,G:c,H:u}=this,f=0;for(n=n|0;f<16;)lb[f++]=Bm(e[n++]);for(f=16;f<64;f++)lb[f]=IGt(lb[f-2])+lb[f-7]+TGt(lb[f-15])+lb[f-16]|0;for(f=0;f<64;f++){const h=u+EGt(a)+_Gt(a,l,c)+vGt[f]+lb[f]|0,p=kGt(r)+SGt(r,i,o)|0;u=c,c=l,l=a,a=s+h|0,s=o,o=i,i=r,r=h+p|0}this.A=r+this.A|0,this.B=i+this.B|0,this.C=o+this.C|0,this.D=s+this.D|0,this.E=a+this.E|0,this.F=l+this.F|0,this.G=c+this.G|0,this.H=u+this.H|0}digest(e){const{_byte:n,_word:r}=this;let i=this._size%64|0;for(n[i++]=128;i&3;)n[i++]=0;if(i>>=2,i>14){for(;i<16;)r[i++]=0;i=0,this._int32(r)}for(;i<16;)r[i++]=0;const o=this._size*8,s=(o&4294967295)>>>0,a=(o-s)/4294967296;return a&&(r[14]=Bm(a)),s&&(r[15]=Bm(s)),this._int32(r),e==="hex"?this._hex():this._bin()}_hex(){const{A:e,B:n,C:r,D:i,E:o,F:s,G:a,H:l}=this;return w4(e)+w4(n)+w4(r)+w4(i)+w4(o)+w4(s)+w4(a)+w4(l)}_bin(){const{A:e,B:n,C:r,D:i,E:o,F:s,G:a,H:l,_byte:c,_word:u}=this;return u[0]=Bm(e),u[1]=Bm(n),u[2]=Bm(r),u[3]=Bm(i),u[4]=Bm(o),u[5]=Bm(s),u[6]=Bm(a),u[7]=Bm(l),c.slice(0,32)}}const lb=new Int32Array(64);let EP,FE=0;const w4=t=>(t+4294967296).toString(16).substr(-8),CGt=(t=>t<<24&4278190080|t<<8&16711680|t>>8&65280|t>>24&255),wGt=(t=>t),Bm=jGt()?wGt:CGt,_Gt=(t,e,n)=>n^t&(e^n),SGt=(t,e,n)=>t&e|n&(t|e),kGt=t=>(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),EGt=t=>(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7),TGt=t=>(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3,IGt=t=>(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10;function jGt(){return new Uint8Array(new Uint16Array([65279]).buffer)[0]===254}function AGt(t,e){for(let n=0;ne[n])return 1}return 0}function Fve(t){for(let e=0;ehoe(a,l)),this.encodeByte(111);for(const a of r)this.hash.update(a);return this.encodeByte(79),i||e}}encodeObjectWithType(e,n){const r={type:e},i=[];for(const[s,a]of Object.entries(n)){if(a===void 0)continue;const l=new kI(this.rewriteMap);l.encodeString(s),r[s]=l.encodeValue(a),i.push(l.getDigest())}const o=new kI(this.rewriteMap);o.encodeString("type"),o.encodeValue(e),i.push(o.getDigest()),i.sort((s,a)=>hoe(s,a)),this.encodeByte(111);for(const s of i)this.hash.update(s);return this.encodeByte(79),r}getDigest(){return this.hash.digest()}}function DGt(t,e=""){let n=e;for(let r=0;r=31)throw new Error("numBuckets must be less than 31");this.byteSize=e,this.numBuckets=n,this.arr=new Uint8Array(this.byteSize*this.numBuckets)}toggle(e,n){for(let r=0;r=e)return null;const s=o*this.byteSize,a=this.arr.slice(s,s+this.byteSize);n.toggle(a),this.toggle(a,l=>{l!==o&&r.set(l)}),i++}}return Fve(this.arr)?n:null}looksPure(e){const n=e*this.byteSize,r=this.arr.subarray(n,n+this.byteSize);if(Fve(r))return!1;let i=0;for(let o=0;o{e.push(Array.from(n))}),e.sort((n,r)=>hoe(n,r)),e}}class $Gt{bitset;queue;constructor(e){this.bitset=(1<r)}set(e){const n=1<{this.sketch.toggle(i)},rewriteMap:this.rewriteMap});this.objectValues[r.id]=r,this.keys.push(r.id)}addSet(e){this.setValues[e.set.id]=e,this.sketch.toggle(e.digest),this.keys.push(e.set.id)}build(e){this.keys.sort();let n;return{set:Nve(e,{keys:this.keys},{withDigest:r=>{n=r}}),digest:n,objectValues:this.objectValues,setValues:this.setValues,sketch:this.sketch}}}function LGt(t,e){const n=t.set.id;if(!e)return{id:n};if(e.type==="complete")return null;const r=[];for(const i of e.missingIds){const o=NXe(t,i);if(!o)throw new Error("Synchronization server is requested an unknonwn descriptor");r.push(o)}return{id:n,descriptors:r}}function NXe(t,e){if(t.set.id===e)return t.set;const n=t.objectValues[e];if(n)return n;for(const r of Object.values(t.setValues)){const i=NXe(r,e);if(i)return i}return null}var YX,Vve;function FGt(){return Vve||(Vve=1,YX=e=>e==null?[]:Array.isArray(e)?e:typeof e=="string"?[e]:typeof e[Symbol.iterator]=="function"?[...e]:[e]),YX}var NGt=FGt();const V2=rs(NGt),rf=["jsonType","type","name","title","description","options","fieldsets","validation","readOnly","hidden","components","diffComponent","initialValue","deprecated"],Ho="_internal_ownProps",X1e="all-fields";function Bo(t,e,n,r={}){return Object.defineProperty(t,e,{configurable:!0,enumerable:r.enumerable!==!1,get(){const i=n();return Object.defineProperty(t,e,{value:i,writable:!!r.writable,configurable:!1}),i}}),t}function ml(t,e,n){Object.defineProperty(t,e,{enumerable:!1,writable:!1,configurable:!1,value:n})}const zve=[...rf],KX={name:"any",type:null,jsonType:"any"},BGt={get(){return KX},extend(t,e){const n={...t,of:t.of.map(o=>({name:o.name,type:e(Mf(o,"name"))}))},r=Object.assign(Zi(KX,zve),n,{type:KX});return ml(r,Ho,n),i(r);function i(o){return{get(){return o},extend:s=>{if(s.of)throw new Error('Cannot override `of` property of subtypes of "array"');const a=Zi(s,zve),l=Object.assign({},o,a,{type:o});return ml(l,Ho,a),i(l)}}}}},Hve=[...rf],XX={name:"array",type:null,jsonType:"array",of:[]},VGt={get(){return XX},extend(t,e){const n=Object.assign(Zi(XX,Hve),t,{type:XX});return Bo(n,"of",()=>t.of.map(i=>e.cached(i))),Bo(n,Ho,()=>({...t,of:n.of}),{enumerable:!1,writable:!1}),r(n);function r(i){return{get(){return i},extend:o=>{if(o.of)throw new Error('Cannot override `of` property of subtypes of "array"');const s=Zi(o,Hve),a=Object.assign({},i,s,{type:i});return ml(a,Ho,s),r(a)}}}}};function zGt(t){t.options&&t.options.preview&&console.warn(`Heads up! The preview config is no longer defined on "options", but instead on the type/field itself. +Please move {options: {preview: ...}} to {..., preview: ...} on the type/field definition of "${t.name}". +`)}function HGt(t){const e=t.preview||(t.options||{}).preview;e&&"fields"in e&&console.warn(`Heads up! "preview.fields" should be renamed to "preview.select". Please update the preview config for "${t.name}". +`)}function UGt(t){for(const e in t)if(t.hasOwnProperty(e))return!1;return!0}function poe(t,e,n){if(n>e.maxDepth)return"...";if(Array.isArray(t)){if(t.length===0)return"[empty]";const i=Math.max(t.length-e.maxBreadth),o=t.slice(0,e.maxBreadth).map((s,a)=>poe(s,e,n+1)).concat(i>0?`…+${i}`:[]).join(", ");return n===0?o:`[${o}]`}if(typeof t=="object"&&t!==null){const i=Object.keys(t).filter(s=>!e.ignoreKeys.includes(s)&&typeof t[s]<"u");if(UGt(Zi(t,i)))return"{empty}";const o=i.slice(0,e.maxBreadth).map(s=>`${s}: ${poe(t[s],e,n+1)}`).join(", ");return n===0?o:`{${o}}`}const r=String(t);return r===""?'""':r}function WGt(t,e={}){const n={maxDepth:"maxDepth"in e?e.maxDepth:2,maxBreadth:"maxBreadth"in e?e.maxBreadth:2,ignoreKeys:"ignoreKeys"in e?e.ignoreKeys:[]};return poe(t,n,0)}const qGt={maxEntries:2,maxDepth:2,maxBreadth:2,ignoreKeys:["_id","_type","_key","_ref"]};function GGt(t){return e=>({title:WGt(Zi(e,t),qGt)})}function YGt(t){return t.type==="array"&&t.of&&t.of.some(e=>e.type==="block")||!1}const BXe=["title","name","label","heading","header","caption"],KGt=["description",...BXe];function VXe(t,e){return V2(t.to||[]).some(n=>n.type===e)}function Uve(t){return VXe(t,"sanity.imageAsset")}function XGt(t){const e=t.fields||[],n=e.find(Uve);if(n)return n.name;const r=e.find(i=>(i.fields||[]).some(Uve));return r?`${r.name}.asset`:void 0}function Wve(t){return VXe(t,"sanity.fileAsset")}function ZGt(t){const e=t.fields||[],n=e.find(Wve);if(n)return n.name;const r=e.find(i=>(i.fields||[]).some(Wve));return r?`${r.name}.asset`:void 0}function QGt(t){const e={fields:[],...t},n=e.fields.filter(l=>l.type==="string").map(l=>l.name),r=e.fields.filter(YGt).map(l=>l.name);let i=BXe.find(l=>n.includes(l)||r.includes(l)),o=KGt.find(l=>l!==i&&(n.includes(l)||r.includes(l)));i||(i=n[0]||r[0],o=n[1]||r[1]);const s=e.fields.find(l=>l.type==="image"),a=XGt(e);if(!i){const l=ZGt(e);l&&(i=`${l}.originalFilename`),a&&(i=`${a}.originalFilename`)}if(!i&&!a){const l=e.fields.map(c=>c.name);return{select:l.reduce((c,u)=>(c[u]=u,c),{}),prepare:GGt(l)}}return{select:jMt({title:i,description:o,media:s?s.name:a},gMt)}}function JGt(t){return t.reduce((e,n)=>(e[n]=n,e),{})}function eYt(t){if(!t)return t;const e=t.select||t.fields||{};return Array.isArray(e)?{...Zi(t,["prepare","component"]),select:JGt(e)}:{...Zi(t,["prepare","component"]),select:e}}function IR(t){return function(){return zGt(t),HGt(t),eYt(t.preview||(t.options||{}).preview)||QGt(t)}}const tYt={type:"object",name:"link",title:"Link",i18nTitleKey:"inputs.portable-text.annotation.link",options:{modal:{type:"popover"}},fields:[{name:"href",type:"url",title:"Link",description:"A valid web, email, phone, or relative link.",validation:t=>t.uri({scheme:["http","https","tel","mailto"],allowRelative:!0})}]},nYt={type:"text",name:"text",title:"Text"},rYt={name:"marks",type:"array",of:[{type:"string"}],title:"Marks"},qve={bullet:{title:"Bulleted list",value:"bullet",i18nTitleKey:"inputs.portable-text.list-type.bullet"},numbered:{title:"Numbered list",value:"number",i18nTitleKey:"inputs.portable-text.list-type.number"}},iYt=[qve.bullet,qve.numbered],B3={normal:{title:"Normal",value:"normal",i18nTitleKey:"inputs.portable-text.style.normal"},h1:{title:"Heading 1",value:"h1",i18nTitleKey:"inputs.portable-text.style.h1"},h2:{title:"Heading 2",value:"h2",i18nTitleKey:"inputs.portable-text.style.h2"},h3:{title:"Heading 3",value:"h3",i18nTitleKey:"inputs.portable-text.style.h3"},h4:{title:"Heading 4",value:"h4",i18nTitleKey:"inputs.portable-text.style.h4"},h5:{title:"Heading 5",value:"h5",i18nTitleKey:"inputs.portable-text.style.h5"},h6:{title:"Heading 6",value:"h6",i18nTitleKey:"inputs.portable-text.style.h6"},blockquote:{title:"Quote",value:"blockquote",i18nTitleKey:"inputs.portable-text.style.quote"}},oYt=[B3.normal,B3.h1,B3.h2,B3.h3,B3.h4,B3.h5,B3.h6,B3.blockquote],sYt={title:"Strong",value:"strong",i18nTitleKey:"inputs.portable-text.decorator.strong"},aYt={title:"Italic",value:"em",i18nTitleKey:"inputs.portable-text.decorator.emphasis"},lYt={title:"Code",value:"code",i18nTitleKey:"inputs.portable-text.decorator.code"},cYt={title:"Underline",value:"underline",i18nTitleKey:"inputs.portable-text.decorator.underline"},uYt={title:"Strike",value:"strike-through",i18nTitleKey:"inputs.portable-text.decorator.strike-through"},NE={strong:sYt,em:aYt,code:lYt,underline:cYt,strikeThrough:uYt},dYt=[NE.strong,NE.em,NE.code,NE.underline,NE.strikeThrough],zXe=[tYt],Gve=["type","name","title","jsonType","description","options","fieldsets","icon"],ZX={name:"block",title:"Block",type:null,jsonType:"object"},fYt={},hYt={get(){return ZX},extend(t,e){const n={...t.options||fYt},{marks:r,styles:i,lists:o,of:s,...a}=t,l=yYt(r,s),c=mYt(i),u=gYt(o),f={name:"markDefs",title:"Mark definitions",type:"array",of:r?.annotations||zXe},h=[l,c,u,f,{name:"level",title:"Indentation",type:"number"}].concat(t.fields||[]),p={...a,options:n},m=Object.assign(Zi(ZX,Gve),p,{type:ZX});return Bo(m,"fields",()=>h.map(y=>e.cachedField(y))),Bo(m,"preview",IR(t)),Bo(m,Ho,()=>({...p,fields:m.fields,preview:m.preview}),{enumerable:!1,writable:!1}),g(m);function g(y){return{get(){return y},extend:b=>{if(b.fields)throw new Error('Cannot override `fields` of subtypes of "block"');const v=Zi(b,Gve),x=Object.assign({},y,v,{type:y});return ml(x,Ho,v),g(x)}}}}};function pYt(t){return t.some(e=>e.value==="normal")?t:[B3.normal,...t]}function mYt(t){return{name:"style",title:"Style",type:"string",options:{list:pYt(t||oYt)}}}function gYt(t){return{name:"listItem",title:"List type",type:"string",options:{list:t||iYt}}}function yYt(t,e=[]){return{name:"children",title:"Content",type:"array",of:[{type:"span",fields:[nYt,rYt],annotations:t&&t.annotations?t.annotations:zXe,decorators:t&&t.decorators?t.decorators:dYt},...e.filter(n=>n.type!=="span")]}}const Yve=["type","name","title","jsonType","description","options","fieldsets","icon"],QX={name:"span",title:"Span",type:null,jsonType:"object"},bYt={name:"marks",title:"Marks",type:"array",of:[{type:"string"}]},vYt={name:"text",title:"Text",type:"string"},xYt={},CYt={get(){return QX},extend(t,e){const n={...t.options||xYt},{annotations:r=[],marks:i=[]}=t,o=[bYt,vYt],s={...t,options:n},a=Object.assign(Zi(QX,Yve),s,{type:QX});return Bo(a,"fields",()=>o.map(c=>e.cachedField(c))),Bo(a,"annotations",()=>r.map(e)),Bo(a,"marks",()=>i.map(e)),Bo(a,"preview",IR(t)),Bo(a,Ho,()=>({...s,fields:a.fields,annotations:a.annotations,marks:a.marks,preview:a.preview}),{enumerable:!1,writable:!1}),l(a);function l(c){return{get(){return c},extend:u=>{if(u.fields)throw new Error('Cannot override `fields` of subtypes of "span"');const f=Zi(u,Yve),h=Object.assign({},c,f,{type:c});return ml(h,Ho,f),l(h)}}}}};var e6={prepare:t=>({title:String(t)})};const Kve=[...rf],JX={name:"boolean",title:"Boolean",type:null,jsonType:"boolean"},wYt={get(){return JX},extend(t){const e={...t,preview:e6},n=Object.assign(Zi(JX,Kve),e,{type:JX});return ml(n,Ho,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=Zi(o,Kve),a=Object.assign({},i,s,{type:i});return ml(a,Ho,s),r(a)}}}}},D9=5,eZ={},HXe=t=>(eZ[t]||(eZ[t]=Symbol(`__cachedStringFields_${t}`)),eZ[t]),_Yt=t=>t.type&&t.type.name==="reference",SYt=["style","list"],Z1e=t=>t.name==="block"||t.type&&Z1e(t.type),kYt=t=>t.jsonType==="array"&&Array.isArray(t.of)&&t.of.some(Z1e);function Kz(t,e,n,r=[],i){if(i<0)return n;const o=e(n,t,r);return t.jsonType==="array"&&Array.isArray(t.of)?EYt(t,e,o,r,i):t.jsonType==="object"&&Array.isArray(t.fields)&&!_Yt(t)?TYt(t,e,o,r,i):o}function EYt(t,e,n,r,i){return t.of.reduce((o,s)=>Kz(s,e,o,r,i-1),n)}function TYt(t,e,n,r,i){const o=Z1e(t);return t.fields.reduce((s,a)=>{if(o&&SYt.includes(a.name))return s;const l=[a.name].concat(a.type.jsonType==="array"?[[]]:[]);return Kz(a.type,e,s,r.concat(l),i-1)},n)}const UXe=[{weight:1,path:["_id"]},{weight:1,path:["_type"]}],Xve={title:10,subtitle:5,description:1.5};function WXe(t,e){const n=t?.preview?.select;if(!n)return[];const r=[];for(const i of Object.keys(n)){if(!(i in Xve))continue;const o=n[i].split(".");e>-1&&o.length-1>e||r.push({weight:Xve[i],path:o})}return r}function IYt(t,e){const n=HXe(e);return t[n]||(t[n]=Cg([...UXe,...WXe(t,e),...AYt(t,e).map(r=>({weight:1,path:r})),...RYt(t,e).map(r=>({weight:1,path:r,mapWith:"pt::text"}))],r=>r.path.join("."))),t[n]}function jYt(t,e){const n=HXe(e);return t[n]||(t[n]=Cg([...UXe,...WXe(t,e)],r=>r.path.join("."))),t[n]}function AYt(t,e){return Kz(t,(n,r,i)=>r.jsonType==="string"?[...n,i]:n,[],[],e)}function RYt(t,e){return Kz(t,(n,r,i)=>kYt(r)?[...n,i]:n,[],[],e)}function DYt(t,e){return jYt(t,qXe(e))}function OYt(t,e){return IYt(t,qXe(e))}function qXe(t){return!MGe(t)||t<1||t>D9?D9-1:t-1}const PYt={name:"_ref",title:"Referenced document ID",type:"string"},$Yt={name:"_weak",title:"Weak reference marker",type:"boolean"},MYt={name:"_dataset",title:"Target dataset",type:"string"},LYt={name:"_projectId",title:"Target project ID",type:"string",hidden:!0},FYt=[PYt,$Yt,MYt,LYt],Zve=[...rf],tZ={name:"crossDatasetReference",type:null,jsonType:"object"};function NYt(t,e){const n=t.length;if(n===1)return t[0];const r=t.slice(0,n-1),i=t[n-1];return`${r.join(", ")} ${e} ${i}`}function BYt(t){return!t.to||t.to.length===0?"Cross dataset Reference":`Cross dataset reference to ${NYt(V2(t.to).map(e=>e.title||xg(e.type)),"or").toLowerCase()}`}const VYt={get(){return tZ},extend(t,e){if(!t.to)throw new Error(`Missing "to" field in cross dataset reference definition. Check the type ${t.name}`);const n=Object.assign(Zi(tZ,Zve),t,{type:tZ});return Bo(n,"fields",()=>FYt.map(i=>e.cachedField(i))),Bo(n,"to",()=>V2(t.to).map(i=>({...i,__experimental_search:DYt(i)}))),Bo(n,"title",()=>t.title||BYt(n)),Bo(n,Ho,()=>({...t,fields:n.fields,to:n.to,title:n.title}),{enumerable:!1,writable:!1}),r(n);function r(i){return{get(){return i},extend:o=>{if(o.of)throw new Error('Cannot override `of` of subtypes of "reference"');const s=Zi(o,Zve),a=Object.assign({},i,s,{type:i});return ml(a,Ho,s),r(a)}}}}},Qve=[...rf],nZ={name:"date",title:"Datetime",type:null,jsonType:"string"},zYt={get(){return nZ},extend(t){const e={...t,preview:e6},n=Object.assign(Zi(nZ,Qve),e,{type:nZ});return ml(n,Ho,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=Zi(o,Qve),a=Object.assign({},i,s,{type:i});return ml(a,Ho,s),r(a)}}}}},Jve=[...rf],rZ={name:"datetime",title:"Datetime",type:null,jsonType:"string"},HYt={get(){return rZ},extend(t){const e={...t,preview:e6},n=Object.assign(Zi(rZ,Jve),e,{type:rZ});return ml(n,Ho,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=Zi(o,Jve),a=Object.assign({},i,s,{type:i});return ml(a,Ho,s),r(a)}}}}},UYt=["title","name","label","heading","header","caption","description"],WYt=["string","boolean","number"],exe=t=>WYt.includes(t.type);function qYt(t){let e=UYt.filter(n=>t.fields.some(r=>exe(r)&&r.name===n));return e.length===0&&(e=t.fields.filter(exe).map(n=>n.name)),e.map(n=>({name:n,i18n:{title:{key:`default-orderings.${n}`,ns:"studio"}},title:xg(Yo(n)),by:[{field:n,direction:"asc"}]}))}function txe(t){if(!Array.isArray(t))throw new Error("The search config of a document type must be an array of search config objects");return t.map(e=>{if(e==="defaults")return e;if(!ea(e))throw new Error("Search config must be an object of {path: string, weight: number}");return{weight:"weight"in e?e.weight:1,path:tLt(e.path),mapWith:typeof e.mapWith=="string"?e.mapWith:void 0}})}const iZ=[...rf,"orderings","__experimental_search","blockEditor","icon"],GXe={get(){return{name:"object",title:"Object",type:null,jsonType:"object"}},extend(t,e){const n={fields:[],...t},r={...n.options},i={...n,title:n.title||(n.name?Yo(n.name):"Object"),options:r,orderings:n.orderings||qYt(n),fields:n.fields.map(a=>e.cachedObjectField(a))},o=Object.assign(Zi(this.get(),iZ),i,{type:this.get()});return Bo(o,"fieldsets",()=>Xz(n,o.fields)),Bo(o,"groups",()=>GYt(n,o.fields)),Bo(o,"preview",IR(n)),Bo(o,Ho,()=>({...i,preview:o.preview}),{enumerable:!1,writable:!1}),Bo(o,"__experimental_search",()=>{const a=n.__experimental_search?txe(n.__experimental_search):null;return a?a.map(l=>l==="defaults"?txe(n):l):OYt(o)},{enumerable:!1}),s(o);function s(a){return{get(){return a},extend:l=>{if(l.fields)throw new Error('Cannot override `fields` of subtypes of "object"');const c=Zi(l,iZ);c.title=l.title||n.title||(n.name?Yo(n.name):"Object");const u=Object.assign({},a,Zi(l,iZ),{type:a});return Bo(u,"__experimental_search",()=>a.__experimental_search),ml(u,Ho,c),s(u)}}}}};function Xz(t,e){const n={};for(const i of t.fieldsets||[]){if(n[i.name])throw new Error(`Duplicate fieldset name "${i.name}" found for type '${t.title?t.title:Yo(t.name)}'`);n[i.name]={title:Yo(i.name),...i,fields:[]}}const r=new Set;for(const i of e){if(!i.fieldset){r.add({single:!0,field:i});continue}const o=n[i.fieldset];if(!o)throw new Error(`Fieldset '${i.fieldset}' is not defined in schema for type '${t.name}'`);o.fields.push(i),r.add(o)}return Array.from(r)}function GYt(t,e){const n={};let r=0;for(const i of t.groups||[]){if(n[i.name])throw new Error(`Duplicate group name "${i.name}" found for type '${t.title?t.title:Yo(t.name)}'`);if(n[i.name]={title:Yo(i.name),...i,fields:[]},i.default&&++r>1)throw new Error(`More than one field group defined as default for type '${t.title?t.title:Yo(t.name)}' - only 1 is supported`)}return e.forEach(i=>{const o=Ej(i.group||[]);o.length!==0&&o.forEach(s=>{const a=n[s];if(!a)throw new Error(`Field group '${s}' is not defined in schema for type '${t.title?t.name:Yo(t.name)}'`);a.fields.push(i)})}),G$t(n).filter(i=>i.fields.length>0||i.name===X1e)}const YYt={name:"document",title:"Document",type:null,jsonType:"object"},KYt={get(){return YYt},extend:GXe.extend},nxe=[...rf],EI={name:"email",title:"Email",type:null,jsonType:"string"};Bo(EI,Ho,()=>({...EI,validation:t=>t.email()}),{enumerable:!1});const XYt={get(){return EI},extend(t){const e={...t,preview:e6},n=Object.assign(Zi(EI,nxe),e,{type:EI});return ml(n,Ho,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=Zi(o,nxe),a=Object.assign({},i,s,{type:i});return ml(a,Ho,s),r(a)}}}}},ZYt={name:"asset",type:"reference",to:{type:"sanity.fileAsset"}},QYt={name:"media",type:"globalDocumentReference",hidden:!0,to:[{type:"sanity.asset"}]},rxe=[...rf],TP={name:"file",title:"File",type:null,jsonType:"object"},JYt={accept:""},eKt={get(){return TP},extend(t,e){const n={...t.options||JYt},r=[ZYt,QYt,...t.fields||[]],i={...t,fields:r},o=Object.assign(Zi(TP,rxe),i,{type:TP,title:i.title||(i.name?Yo(i.name):TP.title),options:n,fields:i.fields.map(a=>{const{name:l,fieldset:c,...u}=a,f={name:l,fieldset:c,isCustomized:!!t.fields};return Bo(f,"type",()=>e({...u,title:a.title||Yo(l)}))})});return Bo(o,"fieldsets",()=>Xz(i,o.fields)),Bo(o,"preview",IR(Object.assign({},i,{fields:r}))),Bo(o,Ho,()=>({...i,options:n,fields:o.fields,title:o.title,fieldsets:o.fieldsets,preview:o.preview}),{enumerable:!1,writable:!1}),s(o);function s(a){return{get(){return a},extend:l=>{if(l.fields)throw new Error('Cannot override `fields` of subtypes of "file"');const c=Zi(l,rxe),u=Object.assign({},a,c,{type:a});return ml(u,Ho,c),s(u)}}}}},tKt={name:"_ref",title:"Referenced document ID",type:"string"},nKt={name:"_weak",title:"Weak reference",type:"boolean"},rKt=[tKt,nKt],ixe=[...rf],oZ={name:"globalDocumentReference",title:"Global Document Reference",type:null,jsonType:"object"};function iKt(t,e){const n=t.length;if(n===1)return t[0];const r=t.slice(0,n-1),i=t[n-1];return`${r.join(", ")} ${e} ${i}`}function oKt(t){return!t.to||t.to.length===0?"Global Document Reference":`Global Document Reference to ${iKt(V2(t.to).map(e=>e.title),"or").toLowerCase()}`}const sKt={get(){return oZ},extend(t,e){if(!t.to)throw new Error(`Missing "to" field in global document reference definition. Check the type ${t.name}`);const n=Object.assign(Zi(oZ,ixe),t,{type:oZ});return Bo(n,"fields",()=>rKt.map(i=>e.cachedField(i))),Bo(n,"to",()=>V2(t.to).map(i=>({...i}))),Bo(n,"title",()=>t.title||oKt(n)),Bo(n,Ho,()=>({...t,fields:n.fields,to:n.to,title:n.title}),{enumerable:!1,writable:!1}),r(n);function r(i){return{get(){return i},extend:o=>{if(o.of)throw new Error('Cannot override `of` of subtypes of "globalDocumentReference"');const s=Zi(o,ixe),a=Object.assign({},i,s,{type:i});return ml(a,Ho,s),r(a)}}}}},aKt={name:"asset",type:"reference",to:[{type:"sanity.imageAsset"}]},lKt={name:"hotspot",type:"sanity.imageHotspot"},cKt={name:"crop",type:"sanity.imageCrop"},uKt={name:"media",type:"globalDocumentReference",hidden:!0,to:[{type:"sanity.asset"}]},oxe=[...rf],sZ={name:"image",title:"Image",type:null,jsonType:"object"},dKt={},fKt={get(){return sZ},extend(t,e){const n={...t.options||dKt};let r=[lKt,cKt];n.hotspot||(r=r.map(l=>({...l,hidden:!0})));const i=[aKt,uKt,...r,...t.fields||[]],o={...t,fields:i},s=Object.assign(Zi(this.get(),oxe),o,{type:sZ,title:o.title||(o.name?Yo(o.name):sZ.title),options:n,fields:o.fields.map(l=>{const{name:c,fieldset:u,...f}=l,h={name:c,fieldset:u,isCustomized:!!t.fields};return Bo(h,"type",()=>e({...f,title:l.title||Yo(c)}))})});return Bo(s,"fieldsets",()=>Xz(o,s.fields)),Bo(s,"preview",IR(Object.assign({},o,{fields:i}))),Bo(s,Ho,()=>({...o,options:n,fields:s.fields,title:s.title,fieldsets:s.fieldsets,preview:s.preview}),{enumerable:!1,writable:!1}),a(s);function a(l){return{get(){return l},extend:c=>{if(c.fields)throw new Error('Cannot override `fields` of subtypes of "image"');const u=Zi(c,oxe),f=Object.assign({},l,u,{type:l});return ml(f,Ho,u),a(f)}}}}},sxe=[...rf],aZ={name:"number",title:"Number",type:null,jsonType:"number"},hKt={get(){return aZ},extend(t){const e={...t,preview:e6},n=Object.assign(Zi(aZ,sxe),e,{type:aZ});return ml(n,Ho,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=Zi(o,sxe),a=Object.assign({},i,s,{type:i});return ml(a,Ho,s),r(a)}}}}},pKt={name:"_ref",title:"Referenced document ID",type:"string"},mKt={name:"_weak",title:"Weak reference",type:"boolean"},gKt=[pKt,mKt],axe=[...rf],lZ={name:"reference",title:"Reference",type:null,jsonType:"object"};function yKt(t,e){const n=t.length;if(n===1)return t[0];const r=t.slice(0,n-1),i=t[n-1];return`${r.join(", ")} ${e} ${i}`}function bKt(t){return!t.to||t.to.length===0?"Reference":`Reference to ${yKt(V2(t.to).map(e=>e.title),"or").toLowerCase()}`}const vKt={get(){return lZ},extend(t,e){if(!t.to)throw new Error(`Missing "to" field in reference definition. Check the type ${t.name}`);const n=Object.assign(Zi(lZ,axe),t,{type:lZ});return Bo(n,"fields",()=>gKt.map(i=>e.cachedField(i))),Bo(n,"fieldsets",()=>Xz(t,n.fields)),Bo(n,"to",()=>V2(t.to).map(i=>e(i))),Bo(n,"title",()=>t.title||bKt(n)),Bo(n,Ho,()=>({...t,fields:n.fields,fieldsets:n.fieldsets,to:n.to,title:n.title}),{enumerable:!1,writable:!1}),r(n);function r(i){return{get(){return i},extend:o=>{if(o.of)throw new Error('Cannot override `of` of subtypes of "reference"');const s=Zi(o,axe),a=Object.assign({},i,s,{type:i});return ml(a,Ho,s),r(a)}}}}},lxe=[...rf],cZ={name:"string",title:"String",type:null,jsonType:"string"},xKt={get(){return cZ},extend(t){const e={...t,preview:e6},n=Object.assign(Zi(cZ,lxe),e,{type:cZ});return ml(n,Ho,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=Zi(o,lxe),a=Object.assign({},i,s,{type:i});return ml(a,Ho,s),r(a)}}}}},cxe=[...rf,"rows"],uZ={name:"text",title:"Text",type:null,jsonType:"string"},CKt={get(){return uZ},extend(t){const e={...t,preview:e6},n=Object.assign(Zi(uZ,cxe),e,{type:uZ});return ml(n,Ho,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=Zi(o,cxe),a=Object.assign({},i,s,{type:i});return ml(a,Ho,s),r(a)}}}}},uxe=[...rf],dZ={name:"url",title:"Url",type:null,jsonType:"string"},wKt={get(){return dZ},extend(t){const e={...t,preview:e6},n=Object.assign(Zi(dZ,uxe),e,{type:dZ});return ml(n,Ho,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=Zi(o,uxe),a=Object.assign({},i,s,{type:i});return ml(a,Ho,s),r(a)}}}}};var dxe=Object.freeze({__proto__:null,any:BGt,array:VGt,block:hYt,boolean:wYt,crossDatasetReference:VYt,date:zYt,datetime:HYt,document:KYt,email:XYt,file:eKt,globalDocumentReference:sKt,image:fKt,number:hKt,object:GXe,reference:vKt,span:CYt,string:xKt,text:CKt,url:wKt});function _Kt(t){const e=Object.create(null);let n;t.parent?(Object.assign(e,t.parent._registry),n=[]):(Object.assign(e,dxe),n=Object.keys(dxe));const r=t.types.reduce((f,h)=>{if(f[h.name])throw new Error(`Duplicate type name added to schema: ${h.name}`);return f[h.name]=h,f},{}),i=new Map,o=new Map,s=new Map,a=Object.assign(c,{cached(f){let h=i.get(f);return h||(h=c(f),i.set(f,h)),h},cachedField(f){let h=o.get(f);if(!h){const{name:p,...m}=f;h={name:p,type:c(m)},o.set(f,h)}return h},cachedObjectField(f){let h=s.get(f);if(!h){const{name:p,fieldset:m,group:g,...y}=f;h={name:p,group:g,fieldset:m},Bo(h,"type",()=>c({...y,title:f.title||Yo(p)})),s.set(f,h)}return h}});return t.types.forEach(u),{registry:e,localTypeNames:n};function l(f){if(!e[f]){if(!r[f])throw new Error(`Unknown type: ${f}`);u(r[f])}}function c(f){return l(f.type),e[f.type].extend(f,a).get()}function u(f){l(f.type),!e[f.name]&&(n.push(f.name),e[f.name]=e[f.type].extend(f,c))}}let YXe=class KXe{_original;_registry;#t;static compile(e){return new KXe(e)}constructor(e){this._original=e;const{registry:n,localTypeNames:r}=_Kt(e);this._registry=n,this.#t=r}get name(){return this._original.name}get parent(){return this._original.parent}get(e){return this._registry[e]&&this._registry[e].get()}has(e){return e in this._registry}getTypeNames(){return Object.keys(this._registry)}getLocalTypeNames(){return this.#t}};const fxe=Symbol.for("@sanity/schema/field-ref"),SKt=["Array","Boolean","Date","Number","Object","String"],XXe=class j5{static FIELD_REF=fxe;static array=e=>new j5(e).type("Array");static object=e=>new j5(e).type("Object");static string=e=>new j5(e).type("String");static number=e=>new j5(e).type("Number");static boolean=e=>new j5(e).type("Boolean");static dateTime=e=>new j5(e).type("Date");static valueOfField=e=>({type:fxe,path:e});_type=void 0;_level=void 0;_required=void 0;_typeDef=void 0;_message=void 0;_rules=[];_fieldRules=void 0;constructor(e){this._typeDef=e,this.reset()}_mergeRequired(e){if(this._required==="required"||e._required==="required")return"required";if(this._required==="optional"||e._required==="optional")return"optional"}valueOfField=j5.valueOfField.bind(j5);error(e){const n=this.clone();return n._level="error",n._message=e||void 0,n}warning(e){const n=this.clone();return n._level="warning",n._message=e||void 0,n}info(e){const n=this.clone();return n._level="info",n._message=e||void 0,n}reset(){return this._type=this._type||void 0,this._rules=(this._rules||[]).filter(e=>e.flag==="type"),this._message=void 0,this._required=void 0,this._level="error",this._fieldRules=void 0,this}isRequired(){return this._required==="required"}clone(){const e=new j5;return e._type=this._type,e._message=this._message,e._required=this._required,e._rules=VPt(this._rules),e._level=this._level,e._fieldRules=this._fieldRules,e._typeDef=this._typeDef,e}cloneWithRules(e){const n=this.clone(),r=new Set;return e.forEach(i=>{i.flag==="type"&&(n._type=i.constraint),r.add(i.flag)}),n._rules=n._rules.filter(i=>{const o=["type","uri","email"].includes(i.flag),s=r.has(i.flag);return!(o&&s)}).concat(e),n}merge(e){if(this._type&&e._type&&this._type!==e._type)throw new Error("merge() failed: conflicting types");const n=this.cloneWithRules(e._rules);return n._type=this._type||e._type,n._message=this._message||e._message,n._required=this._mergeRequired(e),n._level=this._level==="error"?e._level:this._level,n}type(e){const n=`${e.slice(0,1).toUpperCase()}${e.slice(1)}`;if(!SKt.includes(n))throw new Error(`Unknown type "${e}"`);const r=this.cloneWithRules([{flag:"type",constraint:n}]);return r._type=n,r}all(e){return this.cloneWithRules([{flag:"all",constraint:e}])}either(e){return this.cloneWithRules([{flag:"either",constraint:e}])}optional(){const e=this.cloneWithRules([{flag:"presence",constraint:"optional"}]);return e._required="optional",e}skip(){const e=this.clone();return e._rules=[],e._required="optional",e._message=void 0,e._level="error",e._fieldRules=void 0,e}required(){const e=this.cloneWithRules([{flag:"presence",constraint:"required"}]);return e._required="required",e}custom(e,n={}){return n.bypassConcurrencyLimit&&Object.assign(e,{bypassConcurrencyLimit:!0}),this.cloneWithRules([{flag:"custom",constraint:e}])}min(e){return this.cloneWithRules([{flag:"min",constraint:e}])}max(e){return this.cloneWithRules([{flag:"max",constraint:e}])}length(e){return this.cloneWithRules([{flag:"length",constraint:e}])}valid(e){const n=Array.isArray(e)?e:[e];return this.cloneWithRules([{flag:"valid",constraint:n}])}integer(){return this.cloneWithRules([{flag:"integer"}])}precision(e){return this.cloneWithRules([{flag:"precision",constraint:e}])}positive(){return this.cloneWithRules([{flag:"min",constraint:0}])}negative(){return this.cloneWithRules([{flag:"lessThan",constraint:0}])}greaterThan(e){return this.cloneWithRules([{flag:"greaterThan",constraint:e}])}lessThan(e){return this.cloneWithRules([{flag:"lessThan",constraint:e}])}uppercase(){return this.cloneWithRules([{flag:"stringCasing",constraint:"uppercase"}])}lowercase(){return this.cloneWithRules([{flag:"stringCasing",constraint:"lowercase"}])}regex(e,n,r){const i=typeof n=="string"?n:n?.name??r?.name,o=typeof n=="string"?!1:n?.invert??r?.invert,s={pattern:e,name:i,invert:o||!1};return this.cloneWithRules([{flag:"regex",constraint:s}])}email(){return this.cloneWithRules([{flag:"email"}])}uri(e){const n=e?.scheme||["http","https"],r=Array.isArray(n)?n:[n];if(!r.length)throw new Error("scheme must have at least 1 scheme specified");const i={options:{scheme:r.map(o=>{if(!(o instanceof RegExp)&&typeof o!="string")throw new Error("scheme must be a RegExp or a String");return typeof o=="string"?new RegExp(`^${kKt(o)}$`):o}),allowRelative:e?.allowRelative||!1,relativeOnly:e?.relativeOnly||!1,allowCredentials:e?.allowCredentials||!1}};return this.cloneWithRules([{flag:"uri",constraint:i}])}unique(){return this.cloneWithRules([{flag:"unique"}])}reference(){return this.cloneWithRules([{flag:"reference"}])}fields(e){if(this._type!=="Object")throw new Error("fields() can only be called on an object type");const n=this.cloneWithRules([]);return n._fieldRules=e,n}assetRequired(){const e=ZXe(this._typeDef);let n;return e&&["image","file"].includes(e.name)?n=e.name==="image"?"image":"file":n="asset",this.cloneWithRules([{flag:"assetRequired",constraint:{assetType:n}}])}media(e){return this.cloneWithRules([{flag:"media",constraint:e}])}async validate(e,n){throw new Error("validate() method must be implemented by extending Rule class")}};function ZXe(t){return t&&t.type?ZXe(t.type):t}function kKt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var fZ,hxe;function EKt(){return hxe||(hxe=1,fZ=function(e,n){if(!Array.isArray(e))throw new TypeError("humanize-list expected an array");n=n||{},n.conjunction=n.conjunction||"and";var r=e.length;if(r===1)return e[0];if(n.skipConjunction)return e.join(", ");for(var i="",o=0;o{if(r===i)return 0;const o=r;r.length>i.length&&(r=i,i=o);let s=r.length,a=i.length;for(;s>0&&r.charCodeAt(~-s)===i.charCodeAt(~-a);)s--,a--;let l=0;for(;lu?h>u?u+1:h:h>f?f+1:h;return u};return IP.exports=n,IP.exports.default=n,IP.exports}var jKt=IKt();const AKt=rs(jKt),RKt={},DKt=Object.freeze(Object.defineProperty({__proto__:null,default:RKt},Symbol.toStringTag,{value:"Module"})),Q1e=n3t(DKt);var hZ,mxe;function OKt(){if(mxe)return hZ;mxe=1;var t=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&t?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,n=t&&e&&typeof e.get=="function"?e.get:null,r=t&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,o=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,s=i&&o&&typeof o.get=="function"?o.get:null,a=i&&Set.prototype.forEach,l=typeof WeakMap=="function"&&WeakMap.prototype,c=l?WeakMap.prototype.has:null,u=typeof WeakSet=="function"&&WeakSet.prototype,f=u?WeakSet.prototype.has:null,h=typeof WeakRef=="function"&&WeakRef.prototype,p=h?WeakRef.prototype.deref:null,m=Boolean.prototype.valueOf,g=Object.prototype.toString,y=Function.prototype.toString,b=String.prototype.match,v=String.prototype.slice,x=String.prototype.replace,C=String.prototype.toUpperCase,w=String.prototype.toLowerCase,_=RegExp.prototype.test,S=Array.prototype.concat,k=Array.prototype.join,I=Array.prototype.slice,j=Math.floor,A=typeof BigInt=="function"?BigInt.prototype.valueOf:null,D=Object.getOwnPropertySymbols,O=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,P=typeof Symbol=="function"&&typeof Symbol.iterator=="object",$=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===P||!0)?Symbol.toStringTag:null,M=Object.prototype.propertyIsEnumerable,L=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(Le){return Le.__proto__}:null);function B(Le,Ne){if(Le===1/0||Le===-1/0||Le!==Le||Le&&Le>-1e3&&Le<1e3||_.call(/e/,Ne))return Ne;var tt=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof Le=="number"){var ot=Le<0?-j(-Le):j(Le);if(ot!==Le){var rt=String(ot),dt=v.call(Ne,rt.length+1);return x.call(rt,tt,"$&_")+"."+x.call(x.call(dt,/([0-9]{3})/g,"$&_"),/_$/,"")}}return x.call(Ne,tt,"$&_")}var W=Q1e,N=W.custom,V=pe(N)?N:null,G={__proto__:null,double:'"',single:"'"},z={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};hZ=function Le(Ne,tt,ot,rt){var dt=tt||{};if(Ce(dt,"quoteStyle")&&!Ce(G,dt.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ce(dt,"maxStringLength")&&(typeof dt.maxStringLength=="number"?dt.maxStringLength<0&&dt.maxStringLength!==1/0:dt.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var mt=Ce(dt,"customInspect")?dt.customInspect:!0;if(typeof mt!="boolean"&&mt!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ce(dt,"indent")&&dt.indent!==null&&dt.indent!==" "&&!(parseInt(dt.indent,10)===dt.indent&&dt.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ce(dt,"numericSeparator")&&typeof dt.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var ht=dt.numericSeparator;if(typeof Ne>"u")return"undefined";if(Ne===null)return"null";if(typeof Ne=="boolean")return Ne?"true":"false";if(typeof Ne=="string")return Me(Ne,dt);if(typeof Ne=="number"){if(Ne===0)return 1/0/Ne>0?"0":"-0";var ft=String(Ne);return ht?B(Ne,ft):ft}if(typeof Ne=="bigint"){var at=String(Ne)+"n";return ht?B(Ne,at):at}var et=typeof dt.depth>"u"?5:dt.depth;if(typeof ot>"u"&&(ot=0),ot>=et&&et>0&&typeof Ne=="object")return K(Ne)?"[Array]":"[Object]";var xt=Ge(dt,ot);if(typeof rt>"u")rt=[];else if(Ie(rt,Ne)>=0)return"[Circular]";function lt(gn,gt,_n){if(gt&&(rt=I.call(rt),rt.push(gt)),_n){var Xt={depth:dt.depth};return Ce(dt,"quoteStyle")&&(Xt.quoteStyle=dt.quoteStyle),Le(gn,Xt,ot+1,rt)}return Le(gn,dt,ot+1,rt)}if(typeof Ne=="function"&&!re(Ne)){var Ct=_e(Ne),Dt=nt(Ne,lt);return"[Function"+(Ct?": "+Ct:" (anonymous)")+"]"+(Dt.length>0?" { "+k.call(Dt,", ")+" }":"")}if(pe(Ne)){var Ot=P?x.call(String(Ne),/^(Symbol\(.*\))_[^)]*$/,"$1"):O.call(Ne);return typeof Ne=="object"&&!P?$e(Ot):Ot}if(je(Ne)){for(var Rt="<"+w.call(String(Ne.nodeName)),Nt=Ne.attributes||[],Mt=0;Mt",Rt}if(K(Ne)){if(Ne.length===0)return"[]";var Gt=nt(Ne,lt);return xt&&!He(Gt)?"["+Ze(Gt,xt)+"]":"[ "+k.call(Gt,", ")+" ]"}if(te(Ne)){var en=nt(Ne,lt);return!("cause"in Error.prototype)&&"cause"in Ne&&!M.call(Ne,"cause")?"{ ["+String(Ne)+"] "+k.call(S.call("[cause]: "+lt(Ne.cause),en),", ")+" }":en.length===0?"["+String(Ne)+"]":"{ ["+String(Ne)+"] "+k.call(en,", ")+" }"}if(typeof Ne=="object"&&mt){if(V&&typeof Ne[V]=="function"&&W)return W(Ne,{depth:et-ot});if(mt!=="symbol"&&typeof Ne.inspect=="function")return Ne.inspect()}if(ye(Ne)){var Yt=[];return r&&r.call(Ne,function(gn,gt){Yt.push(lt(gt,Ne,!0)+" => "+lt(gn,Ne))}),qe("Map",n.call(Ne),Yt,xt)}if(Se(Ne)){var zt=[];return a&&a.call(Ne,function(gn){zt.push(lt(gn,Ne))}),qe("Set",s.call(Ne),zt,xt)}if(fe(Ne))return Ye("WeakMap");if(Ee(Ne))return Ye("WeakSet");if(ve(Ne))return Ye("WeakRef");if(se(Ne))return $e(lt(Number(Ne)));if(be(Ne))return $e(lt(A.call(Ne)));if(le(Ne))return $e(m.call(Ne));if(ae(Ne))return $e(lt(String(Ne)));if(typeof window<"u"&&Ne===window)return"{ [object Window] }";if(typeof globalThis<"u"&&Ne===globalThis||typeof Ob<"u"&&Ne===Ob)return"{ [object globalThis] }";if(!q(Ne)&&!re(Ne)){var jt=nt(Ne,lt),un=L?L(Ne)===Object.prototype:Ne instanceof Object||Ne.constructor===Object,yn=Ne instanceof Object?"":"null prototype",bn=!un&&$&&Object(Ne)===Ne&&$ in Ne?v.call(Te(Ne),8,-1):yn?"Object":"",In=un||typeof Ne.constructor!="function"?"":Ne.constructor.name?Ne.constructor.name+" ":"",Jn=In+(bn||yn?"["+k.call(S.call([],bn||[],yn||[]),": ")+"] ":"");return jt.length===0?Jn+"{}":xt?Jn+"{"+Ze(jt,xt)+"}":Jn+"{ "+k.call(jt,", ")+" }"}return String(Ne)};function Y(Le,Ne,tt){var ot=tt.quoteStyle||Ne,rt=G[ot];return rt+Le+rt}function Z(Le){return x.call(String(Le),/"/g,""")}function ee(Le){return!$||!(typeof Le=="object"&&($ in Le||typeof Le[$]<"u"))}function K(Le){return Te(Le)==="[object Array]"&&ee(Le)}function q(Le){return Te(Le)==="[object Date]"&&ee(Le)}function re(Le){return Te(Le)==="[object RegExp]"&&ee(Le)}function te(Le){return Te(Le)==="[object Error]"&&ee(Le)}function ae(Le){return Te(Le)==="[object String]"&&ee(Le)}function se(Le){return Te(Le)==="[object Number]"&&ee(Le)}function le(Le){return Te(Le)==="[object Boolean]"&&ee(Le)}function pe(Le){if(P)return Le&&typeof Le=="object"&&Le instanceof Symbol;if(typeof Le=="symbol")return!0;if(!Le||typeof Le!="object"||!O)return!1;try{return O.call(Le),!0}catch{}return!1}function be(Le){if(!Le||typeof Le!="object"||!A)return!1;try{return A.call(Le),!0}catch{}return!1}var xe=Object.prototype.hasOwnProperty||function(Le){return Le in this};function Ce(Le,Ne){return xe.call(Le,Ne)}function Te(Le){return g.call(Le)}function _e(Le){if(Le.name)return Le.name;var Ne=b.call(y.call(Le),/^function\s*([\w$]+)/);return Ne?Ne[1]:null}function Ie(Le,Ne){if(Le.indexOf)return Le.indexOf(Ne);for(var tt=0,ot=Le.length;ttNe.maxStringLength){var tt=Le.length-Ne.maxStringLength,ot="... "+tt+" more character"+(tt>1?"s":"");return Me(v.call(Le,0,Ne.maxStringLength),Ne)+ot}var rt=z[Ne.quoteStyle||"single"];rt.lastIndex=0;var dt=x.call(x.call(Le,rt,"\\$1"),/[\x00-\x1f]/g,Fe);return Y(dt,"single",Ne)}function Fe(Le){var Ne=Le.charCodeAt(0),tt={8:"b",9:"t",10:"n",12:"f",13:"r"}[Ne];return tt?"\\"+tt:"\\x"+(Ne<16?"0":"")+C.call(Ne.toString(16))}function $e(Le){return"Object("+Le+")"}function Ye(Le){return Le+" { ? }"}function qe(Le,Ne,tt,ot){var rt=ot?Ze(tt,ot):k.call(tt,", ");return Le+" ("+Ne+") {"+rt+"}"}function He(Le){for(var Ne=0;Ne=0)return!1;return!0}function Ge(Le,Ne){var tt;if(Le.indent===" ")tt=" ";else if(typeof Le.indent=="number"&&Le.indent>0)tt=k.call(Array(Le.indent+1)," ");else return null;return{base:tt,prev:k.call(Array(Ne+1),tt)}}function Ze(Le,Ne){if(Le.length===0)return"";var tt=` +`+Ne.prev+Ne.base;return tt+k.call(Le,","+tt)+` +`+Ne.prev}function nt(Le,Ne){var tt=K(Le),ot=[];if(tt){ot.length=Le.length;for(var rt=0;rt"u"?"null":Array.isArray(t)?"array":t instanceof QXe?"path":t instanceof u_?"datetime":typeof t}class Zz{type="stream";generator;ticker;isDone;data;constructor(e){this.generator=e,this.ticker=null,this.isDone=!1,this.data=[]}isArray(){return!0}async get(){const e=[];for await(const n of this)e.push(await n.get());return e}async asStatic(){return new F0(await this.get(),"array")}async*[Symbol.asyncIterator](){let e=0;for(;;){for(;e{this.ticker=new Promise((s,a)=>{e=s,n=a})},i=()=>{e(),r()},o=async()=>{try{for await(const s of this.generator())this.data.push(s),i();this.isDone=!0,i()}catch(s){n(s)}};return r(),o(),this.ticker}}function HT(t,e){return t.type==="string"&&e.type==="string"||t.type==="boolean"&&e.type==="boolean"||t.type==="null"&&e.type==="null"||t.type==="number"&&e.type==="number"?t.data===e.data:t.type==="datetime"&&e.type==="datetime"?t.data.equals(e.data):!1}function TI(t,e){if(t===null||e===null)return t===e;const n=typeof t,r=typeof e;if(n==="undefined"&&r==="undefined")return!0;if(n==="function"&&r==="function")return t===e;if(n==="object"&&r==="object"){const i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(const s of i)if(!TI(t[s],e[s]))return!1;return!0}return t===e}const zKt=/([^!@#$%^&*(),\\/?";:{}|[\]+<>\s-])+/g,HKt=/([^!@#$%^&(),\\/?";:{}|[\]+<>\s-])+/g,JXe=/(\b\.+|\.+\b)/g;function UKt(t,e){return t.length===0||e.length===0?!1:e.every(n=>n(t))}function eZe(t){return t.replace(JXe,"").match(zKt)||[]}function WKt(t){return tZe(t).map(e=>n=>n.some(r=>e.test(r)))}function tZe(t){return(t.replace(JXe,"").match(HKt)||[]).map(e=>new RegExp(`^${e.slice(0,1024).replace(/\*/g,".*")}$`,"i"))}function sN(t,e){if(t.type==="string")return{parts:e(t.data),success:!0};if(t.type==="array"){let n=!0;const r=[];for(const i of t.data)typeof i=="string"?r.push(...e(i)):n=!1;return{parts:r,success:n}}return t.type==="stream"?(async()=>{let n=!0;const r=[];for await(const i of t)i.type==="string"?r.push(...e(i.data)):n=!1;return{parts:r,success:n}})():{parts:[],success:!1}}const gxe={datetime:1,number:2,string:3,boolean:4};function Nb(t,e){const n=O7(t),r=O7(e);if(n!==r)return null;switch(n){case"number":case"boolean":return t-e;case"string":return te?1:0;case"datetime":return t.compareTo(e);default:return null}}function qKt(t,e){const n=O7(t),r=O7(e),i=gxe[n]||100,o=gxe[r]||100;if(i!==o)return i-o;let s=Nb(t,e);return s===null&&(s=0),s}const yxe={"==":function(t,e){return HT(t,e)?kl:nc},"!=":function(t,e){return HT(t,e)?nc:kl},">":function(t,e){if(t.type==="stream"||e.type==="stream")return Xn;const n=Nb(t.data,e.data);return n===null?Xn:n>0?kl:nc},">=":function(t,e){if(t.type==="stream"||e.type==="stream")return Xn;const n=Nb(t.data,e.data);return n===null?Xn:n>=0?kl:nc},"<":function(t,e){if(t.type==="stream"||e.type==="stream")return Xn;const n=Nb(t.data,e.data);return n===null?Xn:n<0?kl:nc},"<=":function(t,e){if(t.type==="stream"||e.type==="stream")return Xn;const n=Nb(t.data,e.data);return n===null?Xn:n<=0?kl:nc},in:function(t,e){if(e.type==="path")return t.type!=="string"?Xn:e.data.matches(t.data)?kl:nc;if(e.type==="array"){for(const n of e.data)if(HT(t,vs(n)))return kl;return nc}return e.type==="stream"?(async()=>{for await(const n of e)if(HT(t,n))return kl;return nc})():Xn},match:function(t,e){const n=sN(t,o=>eZe(o)),r=sN(e,o=>WKt(o)),i=(o,s)=>s.success&&UKt(o.parts,s.parts)?kl:nc;return"then"in n||"then"in r?(async()=>i(await n,await r))():i(n,r)},"+":function(t,e){return t.type==="datetime"&&e.type==="number"?YM(t.data.add(e.data)):t.type==="number"&&e.type==="datetime"?YM(e.data.add(t.data)):t.type==="number"&&e.type==="number"?G1(t.data+e.data):t.type==="string"&&e.type==="string"?Dh(t.data+e.data):t.type==="object"&&e.type==="object"?vs({...t.data,...e.data}):t.type==="array"&&e.type==="array"?vs(t.data.concat(e.data)):t.isArray()&&e.isArray()?new Zz(async function*(){for await(const n of t)yield n;for await(const n of e)yield n}):Xn},"-":function(t,e){return t.type==="datetime"&&e.type==="number"?YM(t.data.add(-e.data)):t.type==="datetime"&&e.type==="datetime"?G1(t.data.difference(e.data)):t.type==="number"&&e.type==="number"?G1(t.data-e.data):Xn},"*":jP((t,e)=>t*e),"/":jP((t,e)=>t/e),"%":jP((t,e)=>t%e),"**":jP((t,e)=>Math.pow(t,e))};function jP(t){return function(e,n){if(e.type==="number"&&n.type==="number"){const r=t(e.data,n.data);return G1(r)}return Xn}}let nZe=class moe{params;source;value;parent;context;isHidden=!1;constructor(e,n,r,i,o){this.params=e,this.source=n,this.value=r,this.context=i,this.parent=o}createNested(e){return this.isHidden?new moe(this.params,this.source,e,this.context,this.parent):new moe(this.params,this.source,e,this.context,this)}createHidden(e){const n=this.createNested(e);return n.isHidden=!0,n}};function rZe(t,e){return ws(t,e)}function Ha(t,e){return iZe[t.type].executeSync(t,e)}function ws(t,e){return iZe[t.type].executeAsync(t,e)}function Qz(t){return{executeSync(){throw new Error("executeSync not supported")},executeAsync:t}}function ha(t){return{executeSync(e,n){const r=t(e,n);if(r.type==="stream")throw new Error("Stream encountered in evaluateSync");return r},async executeAsync(e,n){return t(e,n)}}}function Bl(t,e){return{executeSync(n,r){const i=t(n).map(s=>Ha(s,r)),o=e(n,...i);if(o.type==="stream")throw new Error("Stream/iterator not supported in synchronous mode");return o},async executeAsync(n,r){const i=t(n),o=await Promise.all(i.map(s=>ws(s,r).then(a=>a.asStatic())));return e(n,...o)}}}const n9=Symbol();function jR(t,e,n,r){return{executeSync(i,o){const{array:s,args:a=[]}=t(i),l=Ha(s,o);if(l.type!=="array")return Xn;const c=a.map(f=>Ha(f,o));let u=e(i,...c);for(const f of l.data){const h=n(i,u,f,...c);if(h===n9)return Xn;u=h}return r(u)},async executeAsync(i,o){const{array:s,args:a=[]}=t(i),l=await ws(s,o);if(l.type!=="array"&&l.type!=="stream")return Xn;const c=await Promise.all(a.map(f=>ws(f,o).then(h=>h.asStatic())));let u=e(i,...c);if(l.type==="stream")for await(const f of l){const h=n(i,u,await f.get(),...c);if(h===n9)return Xn;u=h}else for(const f of l.data){const h=n(i,u,f,...c);if(h===n9)return Xn;u=h}return r(u)}}}function gw(t,e,{hidden:n=!1}={}){return{executeSync(r,i){const o=t(r),s=Ha(o.array,i);if(s.type!=="array")return Xn;const a=[];for(const l of s.data){let c;if(o.inner){const u=n?i.createHidden(vs(l)):i.createNested(vs(l));c=Ha(o.inner,u).data}for(const u of e(r,l,c,o.state))a.push(u)}return y7(a)},async executeAsync(r,i){const o=t(r),s=await ws(o.array,i);return s.isArray()?new Zz(async function*(){for await(const a of s){let l;if(o.inner){const c=n?i.createHidden(a):i.createNested(a);l=await(await ws(o.inner,c)).get()}for(const c of e(r,await a.get(),l,o.state))yield vs(c)}}):Xn}}}const iZe={This:ha((t,e)=>e.value),SelectorNested:ha(()=>{throw new Error("Unexpected node type: SelectorNested")}),SelectorFuncCall:ha(()=>{throw new Error("Unexpected node type: SelectorFuncCall")}),Everything:ha((t,e)=>e.source),Parameter:ha(({name:t},e)=>vs(e.params[t])),Context:ha(({key:t},e)=>{if(t==="before"||t==="after")return e.context[t]||Xn;throw new Error(`unknown context key: ${t}`)}),Parent:ha(({n:t},e)=>{let n=e;for(let r=0;r[t,e,n],({isInclusive:t},e,n,r)=>{const i=Nb(e.data,n.data);if(i===null)return Xn;const o=Nb(e.data,r.data);return o===null?Xn:t?i>=0&&o<=0?kl:nc:i>=0&&o<0?kl:nc}),Filter:gw(({base:t,expr:e})=>({array:t,inner:e}),function*(t,e,n){n===!0&&(yield e)}),Projection:{executeSync({base:t,expr:e},n){const r=Ha(t,n);if(r.type!=="object")return Xn;const i=n.createNested(r);return Ha(e,i)},async executeAsync({base:t,expr:e},n){const r=await ws(t,n);if(r.type!=="object")return Xn;const i=n.createNested(r);return ws(e,i)}},FuncCall:{executeAsync({func:t,args:e},n){return t.executeAsync(e,n)},executeSync({func:t,args:e},n){return t.executeSync(e,n)}},PipeFuncCall:{async executeAsync({func:t,base:e,args:n},r){const i=await ws(e,r);return i.type!=="stream"&&i.type!=="array"?Xn:t.executeAsync({base:i,args:n},r)},executeSync({func:t,base:e,args:n},r){const i=Ha(e,r);return i.type!=="array"?Xn:t.executeSync({base:i,args:n},r)}},AccessAttribute:Bl(({base:t})=>[t||{type:"This"}],({name:t},e)=>e.type==="object"&&e.data.hasOwnProperty(t)?vs(e.data[t]):Xn),AccessElement:Bl(({base:t})=>[t],({index:t},e)=>{if(e.type!=="array")return Xn;const n=e.data,r=t<0?t+n.length:t;return vs(n[r])}),Slice:Bl(({base:t})=>[t],({left:t,right:e,isInclusive:n},r)=>{if(r.type!=="array")return Xn;const i=r.data;let o=t,s=e;return o<0&&(o=i.length+o),s<0&&(s=i.length+s),n&&s++,o<0&&(o=0),s<0&&(s=0),y7(i.slice(o,s))}),Deref:{executeSync({base:t},e){const n=Ha(t,e);if(n.type!=="object")return Xn;const r=n.data._ref;if(typeof r!="string")return Xn;if(e.context.dereference){const i=e.context.dereference({_ref:r});if(i&&typeof i=="object"&&"then"in i)throw new Error("Dereference returned promise in synchronous mode");return vs(i)}if(e.source.type!=="array")return Xn;for(const i of e.source.data)if(i&&typeof i=="object"&&"_id"in i&&r===i._id)return vs(i);return Xn},async executeAsync({base:t},e){const n=await ws(t,e);if(!e.source.isArray()||n.type!=="object")return Xn;const r=n.data._ref;if(typeof r!="string")return Xn;if(e.context.dereference)return vs(await e.context.dereference({_ref:r}));for await(const i of e.source)if(i.type==="object"&&r===i.data._id)return i;return Xn}},Value:ha(({value:t})=>vs(t)),Group:{executeSync({base:t},e){return Ha(t,e)},executeAsync({base:t},e){return ws(t,e)}},Object:{executeSync({attributes:t},e){const n={};for(const r of t){const i=r.type;switch(r.type){case"ObjectAttributeValue":{const o=Ha(r.value,e);n[r.name]=o.data;break}case"ObjectConditionalSplat":{const o=Ha(r.condition,e);if(o.type!=="boolean"||o.data===!1)continue;const s=Ha(r.value,e);s.type==="object"&&Object.assign(n,s.data);break}case"ObjectSplat":{const o=Ha(r.value,e);o.type==="object"&&Object.assign(n,o.data);break}default:throw new Error(`Unknown node type: ${i}`)}}return vs(n)},async executeAsync({attributes:t},e){const n={};for(const r of t){const i=r.type;switch(r.type){case"ObjectAttributeValue":{const o=await ws(r.value,e);n[r.name]=await o.get();break}case"ObjectConditionalSplat":{const o=await ws(r.condition,e);if(o.type!=="boolean"||o.data===!1)continue;const s=await ws(r.value,e);s.type==="object"&&Object.assign(n,s.data);break}case"ObjectSplat":{const o=await ws(r.value,e);o.type==="object"&&Object.assign(n,o.data);break}default:throw new Error(`Unknown node type: ${i}`)}}return vs(n)}},Array:{executeSync({elements:t},e){const n=[];for(const r of t){const i=Ha(r.value,e);if(r.isSplat){if(i.type==="array")for(const o of i.data)n.push(o)}else n.push(i.data)}return y7(n)},async executeAsync({elements:t},e){return new Zz(async function*(){for(const n of t){const r=await ws(n.value,e);if(n.isSplat){if(r.isArray())for await(const i of r)yield i}else yield r}})}},Tuple:ha(()=>{throw new Error("tuples can not be evaluated")}),Or:Bl(({left:t,right:e})=>[t,e],(t,e,n)=>e.type==="boolean"&&e.data===!0||n.type==="boolean"&&n.data===!0?kl:e.type!=="boolean"||n.type!=="boolean"?Xn:nc),And:Bl(({left:t,right:e})=>[t,e],(t,e,n)=>e.type==="boolean"&&e.data===!1||n.type==="boolean"&&n.data===!1?nc:e.type!=="boolean"||n.type!=="boolean"?Xn:kl),Not:Bl(({base:t})=>[t],(t,e)=>e.type!=="boolean"?Xn:e.data?nc:kl),Neg:Bl(({base:t})=>[t],(t,e)=>e.type!=="number"?Xn:G1(-e.data)),Pos:Bl(({base:t})=>[t],(t,e)=>e.type!=="number"?Xn:G1(e.data)),Asc:ha(()=>Xn),Desc:ha(()=>Xn),ArrayCoerce:{executeSync({base:t},e){const n=Ha(t,e);return n.isArray()?n:Xn},async executeAsync({base:t},e){const n=await ws(t,e);return n.isArray()?n:Xn}},Map:gw(({base:t,expr:e})=>({array:t,inner:e}),function*(t,e,n){yield n},{hidden:!0}),FlatMap:gw(({base:t,expr:e})=>({array:t,inner:e}),function*(t,e,n){if(Array.isArray(n))for(const r of n)yield r;else yield n},{hidden:!0})};function oZe(t,e={}){return ws(t,GKt(e))}function GKt(t){const e=vs(t.root),n=vs(t.dataset),r={...t.params};return new nZe(r,n,e,{timestamp:t.timestamp||new Date,identity:t.identity===void 0?"me":t.identity,sanity:t.sanity,after:t.after?vs(t.after):null,before:t.before?vs(t.before):null,dereference:t.dereference},null)}function UT(t){switch(t.type){case"Group":return UT(t.base);case"Value":case"Parameter":return!0;case"Pos":case"Neg":return UT(t.base);case"OpCall":switch(t.op){case"+":case"-":case"*":case"/":case"%":case"**":return UT(t.left)&&UT(t.right);default:return!1}default:return!1}}const YKt=new nZe({},Xn,Xn,{timestamp:new Date(0),identity:"me",before:null,after:null},null);function AP(t){return UT(t)?KKt(t):null}function KKt(t){return Ha(t,YKt)}function Jz(t){return["AccessAttribute","SelectorFuncCall","Group","Tuple","ArrayCoerce","Filter","SelectorNested"].includes(t.type)}function XKt(t){return["AccessAttribute","ArrayCoerce","Filter","Group","Tuple","SelectorNested"].includes(t.type)}const ty={};ty.join=Bl(t=>t,(t,e,n)=>{if(e.type!=="array"||n.type!=="string")return Xn;let r="",i=!1;for(const o of e.data){switch(i&&(r+=n.data),O7(o)){case"number":case"string":case"boolean":case"datetime":r+=`${o}`;break;default:return Xn}i=!0}return Dh(r)});ty.join.arity=2;ty.compact=gw(([t])=>({array:t}),function*(t,e){e!==null&&(yield e)});ty.compact.arity=1;ty.unique=gw(t=>({array:t[0],state:new Set}),function*(t,e,n,r){switch(O7(e)){case"number":case"string":case"boolean":case"datetime":r.has(e)||(r.add(e),yield e);break;default:yield e}});ty.unique.arity=1;ty.intersects=Bl(t=>t,(t,e,n)=>{if(e.type!=="array"||n.type!=="array")return Xn;for(const r of e.data)for(const i of n.data)if(HT(vs(r),vs(i)))return kl;return nc});ty.intersects.arity=2;const J1e={};J1e.now=ha((t,e)=>YM(new u_(e.context.timestamp)));J1e.now.arity=0;async function o7(t,e){function n(i,o){try{return i[o]}catch{return}}let r=await t.get();for(const i of e)if(r=n(r,i),!r)break;return r}function ZKt(t,e){return e.every((n,r)=>t[r]===n)}async function*QKt(t,e){const n=[[]];for(;n.length>0;){const r=n.shift()||[],i=vs(await o7(t,r)),o=vs(await o7(e,r));if(o.type!==i.type)yield r;else if(o.type==="string"&&i.type==="string"||o.type==="boolean"&&i.type==="boolean"||o.type==="null"&&i.type==="null"||o.type==="number"&&i.type==="number")o.data!==i.data&&(yield r);else if(o.type==="datetime"&&i.type==="datetime")o.data.equals(i.data)||(yield r);else if(o.type==="object"&&i.type==="object"){if(!TI(o.data,i.data)){const s=Object.keys(o.data),a=Object.keys(i.data);new Set(s.concat(a)).forEach(l=>{n.push([...r,l])})}}else if(o.type==="array"&&i.type==="array"){if(o.data.length!==i.data.length)yield r;else if(!TI(o.data,i.data))for(let s=0;s[...i,t.name]):[[t.name]];case"ArrayCoerce":{const i=await xp(t.base,e,n),o=[];for(const s of i){const a=await o7(e,s);if(Array.isArray(a))for(let l=0;l0&&s.push([...a,c])}}return s}case"SelectorFuncCall":return goe(t.arg,n.createHidden(e));case"SelectorNested":{const{base:i,nested:o}=t,s=await xp(i,e,n),a=[];for(const l of s){const c=await o7(e,l);switch(o.type){case"AccessAttribute":case"ArrayCoerce":case"Filter":const u=await xp(o,vs(c),n);for(let h=0;h{const n=t[0],r=t[1],i=t[2];if(!Jz(i))throw new Error("changedAny third argument must be a selector");const o=await ws(n,e),s=await ws(r,e);return sZe(o,s,i,e)});AR.changedAny.arity=3;AR.changedOnly=Qz(async(t,e)=>{const n=t[0],r=t[1],i=t[2];if(!Jz(i))throw new Error("changedOnly third argument must be a selector");const o=await ws(n,e),s=await ws(r,e);return aZe(o,s,i,e)});AR.changedOnly.arity=3;const t6={};t6.operation=ha((t,e)=>{const n=e.context.before!==null,r=e.context.after!==null;return n&&r?Dh("update"):r?Dh("create"):n?Dh("delete"):Xn});t6.changedAny=Qz(async(t,e)=>{const n=e.context.before||Xn,r=e.context.after||Xn,i=t[0];if(!Jz(i))throw new Error("changedAny first argument must be a selector");return sZe(n,r,i,e)});t6.changedAny.arity=1;t6.changedAny.mode="delta";t6.changedOnly=Qz(async(t,e)=>{const n=e.context.before||Xn,r=e.context.after||Xn,i=t[0];if(!Jz(i))throw new Error("changedOnly first argument must be a selector");return aZe(n,r,i,e)});t6.changedOnly.arity=1;t6.changedOnly.mode="delta";const eH={};eH.get=ha(()=>{throw new Error("not implemented")});eH.incomingRefCount=ha(()=>{throw new Error("not implemented")});eH.incomingGlobalDocumentReferenceCount=ha(()=>{throw new Error("not implemented")});const RR={};RR.latLng=ha(()=>{throw new Error("not implemented")});RR.contains=ha(()=>{throw new Error("not implemented")});RR.intersects=ha(()=>{throw new Error("not implemented")});RR.distance=ha(()=>{throw new Error("not implemented")});const N0={};N0.lower=Bl(t=>t,(t,e)=>e.type!=="string"?Xn:Dh(e.data.toLowerCase()));N0.lower.arity=1;N0.upper=Bl(t=>t,(t,e)=>e.type!=="string"?Xn:Dh(e.data.toUpperCase()));N0.upper.arity=1;N0.split=Bl(t=>t,(t,e,n)=>e.type!=="string"||n.type!=="string"?Xn:e.data.length===0?y7([]):n.data.length===0?y7(Array.from(e.data)):y7(e.data.split(n.data)));N0.split.arity=2;N0.startsWith=Bl(t=>t,(t,e,n)=>e.type!=="string"||n.type!=="string"?Xn:e.data.startsWith(n.data)?kl:nc);N0.startsWith.arity=2;const Za={};Za.anywhere=ha(()=>{throw new Error("not implemented")});Za.anywhere.arity=1;Za.coalesce={async executeAsync(t,e){for(const n of t){const r=await ws(n,e);if(r.type!=="null")return r}return Xn},executeSync(t,e){for(const n of t){const r=Ha(n,e);if(r.type!=="null")return r}return Xn}};Za.count=jR(t=>({array:t[0]}),()=>0,(t,e)=>e+1,G1);Za.count.arity=1;Za.dateTime=Bl(t=>t,(t,e)=>e.type==="datetime"?e:e.type!=="string"?Xn:u_.parseToValue(e.data));Za.dateTime.arity=1;Za.defined=Bl(t=>t,(t,e)=>e.type==="null"?nc:kl);Za.defined.arity=1;Za.identity=ha((t,e)=>Dh(e.context.identity));Za.identity.arity=0;Za.length=Bl(t=>t,(t,e)=>e.type==="string"?G1(JKt(e.data)):e.type==="array"?G1(e.data.length):Xn);Za.length.arity=1;Za.path=Bl(t=>t,(t,e)=>e.type!=="string"?Xn:BKt(new QXe(e.data)));Za.path.arity=1;Za.string=Bl(t=>t,(t,e)=>{switch(e.type){case"number":case"string":case"boolean":case"datetime":return Dh(`${e.data}`);default:return Xn}});Za.string.arity=1;Za.references=Bl(t=>[{type:"This"},...t],(t,e,...n)=>{const r=new Set;for(const i of n)if(i.type==="string")r.add(i.data);else if(i.type==="array")for(const o of i.data)typeof o=="string"&&r.add(o);return r.size===0?nc:yoe(e,r)?kl:nc});Za.references.arity=t=>t>=1;Za.round=Bl(t=>t,(t,e,n)=>{if(e.type!=="number")return Xn;const r=e.data;let i=0;if(n){if(n.type!=="number"||n.data<0||!Number.isInteger(n.data))return Xn;i=n.data}return i===0?r<0?G1(-Math.round(-r)):G1(Math.round(r)):G1(Number(r.toFixed(i)))});Za.round.arity=t=>t>=1&&t<=2;Za.now=ha((t,e)=>Dh(e.context.timestamp.toISOString()));Za.now.arity=0;Za.boost=ha(()=>{throw new Error("unexpected boost call")});Za.boost.arity=2;Za.lower=N0.lower;Za.upper=N0.upper;function JKt(t){let e=0;for(let n=0;n=55296&&r<=56319||e++}return e}function yoe(t,e){switch(O7(t)){case"array":for(const n of t)if(yoe(n,e))return!0;break;case"object":if(t._ref)return e.has(t._ref);for(const n of Object.values(t))if(yoe(n,e))return!0;break}return!1}const ny={};ny.min=jR(t=>({array:t[0]}),()=>{},(t,e,n)=>n===null?e:typeof n!="number"?n9:e===void 0||nt===void 0?Xn:G1(t));ny.min.arity=1;ny.max=jR(t=>({array:t[0]}),()=>{},(t,e,n)=>n===null?e:typeof n!="number"?n9:e===void 0||n>e?n:e,t=>t===void 0?Xn:G1(t));ny.max.arity=1;ny.sum=jR(t=>({array:t[0]}),()=>0,(t,e,n)=>n===null?e:typeof n!="number"?n9:e+n,G1);ny.sum.arity=1;ny.avg=jR(t=>({array:t[0]}),()=>({count:0,sum:0}),(t,{count:e,sum:n},r)=>r===null?{count:e,sum:n}:typeof r!="number"?n9:{count:e+1,sum:n+r},({count:t,sum:e})=>t===0?Xn:G1(e/t));ny.avg.arity=1;const efe={};efe.aspect=ha(()=>{throw new Error("not implemented")});efe.aspect.arity=2;function eXt(t){if(t.type==="object")return cZe(t.data);if(t.type==="array"){const e=lZe(t.data);if(e.length>0)return e.join(` + +`)}return null}function lZe(t,e=[]){for(const n of t)if(Array.isArray(n))lZe(n,e);else if(typeof n=="object"&&n){const r=cZe(n);r!==null&&e.push(r)}return e}function cZe(t){if(typeof t._type!="string")return null;const e=t.children;if(!Array.isArray(e))return null;let n="";for(const r of e)r&&typeof r=="object"&&typeof r._type=="string"&&r._type==="span"&&typeof r.text=="string"&&(n+=r.text);return n}const tfe={};tfe.text=Bl(t=>t,(t,e)=>{const n=eXt(e);return n===null?Xn:Dh(n)});tfe.text.arity=1;const nfe={};nfe.all=gw(()=>({array:{type:"Everything"}}),function*(t,e){typeof e=="object"&&e&&"_type"in e&&e._type==="system.release"&&(yield e)});nfe.all.arity=0;const vv={};vv.projectId=ha((t,e)=>e.context.sanity?Dh(e.context.sanity.projectId):Xn);vv.dataset=ha((t,e)=>e.context.sanity?Dh(e.context.sanity.dataset):Xn);vv.versionOf=Bl(([t])=>[t,{type:"This"}],(t,e,n)=>{if(e.type!=="string")return Xn;const r=e.data;if(n.type!=="object"||typeof n.data._id!="string")return Xn;if(n.data._id===r)return kl;const i=n.data._id.split(".");return i.length>=2&&i[0]==="drafts"&&i.slice(1).join(".")===r||i.length>=3&&i[0]==="versions"&&i.slice(2).join(".")===r?kl:nc});vv.versionOf.arity=1;vv.partOfRelease=Bl(t=>[t[0],{type:"This"}],(t,e,n)=>{if(e.type!=="string")return Xn;const r=e.data;if(n.type!=="object"||typeof n.data._id!="string")return Xn;const i=n.data._id.split(".");return i.length>=3&&i[0]==="versions"&&i[1]===r?kl:nc});vv.partOfRelease.arity=1;const DR={};DR.query=ha(()=>{throw new Error("not implemented")});DR.query.arity=1;DR.embedding=ha(()=>{throw new Error("not implemented")});DR.embedding.arity=1;const uZe={};uZe.attributes=ha(()=>{throw new Error("not implemented")});const bxe=1.2;async function fC(t,e){if(t.type==="OpCall"&&t.op==="match")return nXt(t.left,t.right,e);if(t.type==="FuncCall"&&t.name==="boost"){const n=await fC(t.args[0],e),r=await ws(t.args[1],e);return r.type==="number"&&n>0?n+r.data:0}switch(t.type){case"Or":{const n=await fC(t.left,e),r=await fC(t.right,e);return n+r}case"And":{const n=await fC(t.left,e),r=await fC(t.right,e);return n===0||r===0?0:n+r}default:{const n=await ws(t,e);return n.type==="boolean"&&n.data===!0?1:0}}}function hC(t,e){if(t.type==="OpCall"&&t.op==="match")return tXt(t.left,t.right,e);if(t.type==="FuncCall"&&t.name==="boost"){const n=hC(t.args[0],e),r=Ha(t.args[1],e);return r.type==="number"&&n>0?n+r.data:0}switch(t.type){case"Or":{const n=hC(t.left,e),r=hC(t.right,e);return n+r}case"And":{const n=hC(t.left,e),r=hC(t.right,e);return n===0||r===0?0:n+r}default:{const n=Ha(t,e);return n.type==="boolean"&&n.data===!0?1:0}}}function tXt(t,e,n){const r=Ha(t,n),i=Ha(e,n),o=dZe(r,i);if(typeof o=="number")return o;throw new Error("Found synchronous value in match()")}async function nXt(t,e,n){const r=await ws(t,n),i=await ws(e,n);return dZe(r,i)}function dZe(t,e){const n=sN(t,o=>eZe(o)),r=sN(e,o=>tZe(o)),i=(o,s)=>{if(!s.success||o.parts.length===0||s.parts.length===0)return 0;let a=0;for(const l of s.parts){const c=o.parts.reduce((u,f)=>u+(l.test(f)?1:0),0);a+=c*(bxe+1)/(c+bxe)}return a};return"then"in n||"then"in r?(async()=>i(await n,await r))():i(n,r)}function vxe(t){const e=[],n=[];for(let r of t){let i="asc";r.type==="Desc"?(i="desc",r=r.base):r.type==="Asc"&&(r=r.base),e.push(r),n.push(i)}return{mappers:e,directions:n}}function xxe(t,e){return t.sort((n,r)=>{for(let i=0;in[0])}const OR={};OR.order={executeSync({base:t,args:e},n){const{mappers:r,directions:i}=vxe(e),o=[];let s=0;const a=i.length;for(const l of t.data){const c=n.createNested(vs(l)),u=[l,s];for(let f=0;ft>=1;OR.score={async executeAsync({base:t,args:e},n){const r=[],i=[];for await(const o of t){if(o.type!=="object"){r.push(await o.get());continue}const s=n.createNested(o);let a=typeof o.data._score=="number"?o.data._score:0;for(const c of e)a+=await fC(c,s);const l=Object.assign({},o.data,{_score:a});i.push(l)}return i.sort((o,s)=>s._score-o._score),vs(i)},executeSync({base:t,args:e},n){const r=[];for(const i of t.data){if(O7(i)!=="object")continue;const o=i,s=n.createNested(vs(i));let a=typeof o._score=="number"?o._score:0;for(const c of e)a+=hC(c,s);const l=Object.assign({},o,{_score:a});r.push(l)}return r.sort((i,o)=>o._score-i._score),y7(r)}};OR.score.arity=t=>t>=1;const rXt={global:Za,string:N0,array:ty,pt:tfe,delta:t6,diff:AR,media:efe,sanity:vv,math:ny,dateTime:J1e,releases:nfe,text:DR,geo:RR,documents:eH,user:uZe};class rfe{_string;marks;index;customFunctions;parseOptions;allowBoost=!1;constructor(e,n,r,i){this._string=e,this.marks=n,this.customFunctions=r,this.index=0,this.parseOptions=i}hasMark(e=0){return this.index+e":{if(n>1||s<=1)break e;let u=Ta(t,Tr(t,c+2),1);if(u.type==="error")return u;o=o.concat(u.marks),o.unshift({name:"pair",position:r}),e=u.position,s=1;break}case"=":{if(n>4||s<=4)break e;let u=Ta(t,Tr(t,c+2),5);if(u.type==="error")return u;o.unshift({name:"comp",position:r}),o.push({name:"op",position:c},{name:"op_end",position:c+2}),o=o.concat(u.marks),e=u.position,s=4;break}default:break e}break}case"+":{if(n>6||s<6)break e;let u=Ta(t,Tr(t,c+1),7);if(u.type==="error")return u;o=o.concat(u.marks),o.unshift({name:"add",position:r}),e=u.position,s=6;break}case"-":{if(n>6||s<6)break e;let u=Ta(t,Tr(t,c+1),7);if(u.type==="error")return u;o=o.concat(u.marks),o.unshift({name:"sub",position:r}),e=u.position,s=6;break}case"*":{if(t[c+1]==="*"){if(n>8||s<=8)break e;let f=Ta(t,Tr(t,c+2),8);if(f.type==="error")return f;o=o.concat(f.marks),o.unshift({name:"pow",position:r}),e=f.position,s=8;break}if(n>7||s<7)break e;let u=Ta(t,Tr(t,c+1),8);if(u.type==="error")return u;o=o.concat(u.marks),o.unshift({name:"mul",position:r}),e=u.position,s=7;break}case"/":{if(n>7||s<7)break e;let u=Ta(t,Tr(t,c+1),8);if(u.type==="error")return u;o=o.concat(u.marks),o.unshift({name:"div",position:r}),e=u.position,s=7;break}case"%":{if(n>7||s<7)break e;let u=Ta(t,Tr(t,c+1),8);if(u.type==="error")return u;o=o.concat(u.marks),o.unshift({name:"mod",position:r}),e=u.position,s=7;break}case"<":case">":{if(n>4||s<=4)break e;let u=c+1;t[u]==="="&&u++;let f=Ta(t,Tr(t,u),5);if(f.type==="error")return f;o.unshift({name:"comp",position:r}),o.push({name:"op",position:c},{name:"op_end",position:u}),o=o.concat(f.marks),e=f.position,s=4;break}case"|":{if(t[c+1]==="|"){if(n>2||s<2)break e;let u=Ta(t,Tr(t,c+2),3);if(u.type==="error")return u;o=o.concat(u.marks),o.unshift({name:"or",position:r}),e=u.position,s=2}else{if(n>11||s<11)break e;let u=Tr(t,c+1),f=O5(t,u,Y5);if(!f)return{type:"error",message:"Expected identifier",position:u};if(e=u+f,t[e]==="("||t[e]===":"){let h=wxe(t,u,e);if(h.type==="error")return h;o=o.concat(h.marks),o.unshift({name:"pipecall",position:r}),e=h.position,s=11}}break}case"&":{if(t[c+1]!="&"||n>3||s<3)break e;let u=Ta(t,Tr(t,c+2),4);if(u.type==="error")return u;o=o.concat(u.marks),o.unshift({name:"and",position:r}),e=u.position,s=3;break}case"!":{if(t[c+1]!=="="||n>4||s<=4)break e;let u=Ta(t,Tr(t,c+2),5);if(u.type==="error")return u;o.unshift({name:"comp",position:r}),o.push({name:"op",position:c},{name:"op_end",position:c+2}),o=o.concat(u.marks),e=u.position,s=4;break}case"d":{if(t.slice(c,c+4)!=="desc"||n>4||s<4)break e;o.unshift({name:"desc",position:r}),e=c+4,s=4;break}case"a":{if(t.slice(c,c+3)!=="asc"||n>4||s<4)break e;o.unshift({name:"asc",position:r}),e=c+3,s=4;break}default:switch(KM(t,c,Y5)){case"in":{if(n>4||s<=4)break e;e=Tr(t,c+2);let u=!1;t[e]==="("&&(u=!0,e=Tr(t,e+1));let f=e,h=Ta(t,e,5);if(h.type==="error")return h;if(e=Tr(t,h.position),t[e]==="."&&t[e+1]==="."){let p="inc_range";t[e+2]==="."?(p="exc_range",e=Tr(t,e+3)):e=Tr(t,e+2);let m=Ta(t,e,5);if(m.type==="error")return m;o.unshift({name:"in_range",position:r}),o=o.concat({name:p,position:f},h.marks,m.marks),e=m.position}else o.unshift({name:"comp",position:r}),o.push({name:"op",position:c},{name:"op_end",position:c+2}),o=o.concat(h.marks);if(u){if(e=Tr(t,e),t[e]!==")")return{type:"error",message:'Expected ")" in group',position:e};e++}s=4;break}case"match":{if(n>4||s<=4)break e;let u=Ta(t,Tr(t,c+5),5);if(u.type==="error")return u;o.unshift({name:"comp",position:r}),o.push({name:"op",position:c},{name:"op_end",position:c+5}),o=o.concat(u.marks),e=u.position,s=4;break}default:break e}}}let l=a?.type==="error"&&a.position;return{type:"success",marks:o,position:e,failPosition:l}}function fZe(t,e){const n=e;let r,i=Ta(t,Tr(t,e+1),0);if(i.type==="error")return i;switch(e=Tr(t,i.position),t[e]){case",":{for(r=[{name:"tuple",position:n}].concat(i.marks),e=Tr(t,e+1);;){if(i=Ta(t,e,0),i.type==="error")return i;if(r.push(...i.marks),e=Tr(t,i.position),t[e]!==",")break;e=Tr(t,e+1)}if(t[e]!==")")return{type:"error",message:'Expected ")" after tuple expression',position:e};e++,r.push({name:"tuple_end",position:e});break}case")":{e++,r=[{name:"group",position:n}].concat(i.marks);break}default:return{type:"error",message:`Unexpected character "${t[e]}"`,position:e}}return{type:"success",marks:r,position:e}}function Cxe(t,e){let n=e;switch(t[e]){case".":{if(e=Tr(t,e+1),t[e]==="(")return fZe(t,e);let s=e,a=O5(t,e,Y5);return a?(e+=a,{type:"success",marks:[{name:"attr_access",position:n},{name:"ident",position:s},{name:"ident_end",position:e}],position:e}):{type:"error",message:'Expected identifier after "."',position:e}}case"-":if(t[e+1]!==">")return{type:"error",message:'Expected ">" in reference',position:e};let r=[{name:"deref",position:n}];e+=2;let i=Tr(t,e),o=O5(t,i,Y5);return o&&(e=i+o,r.push({name:"deref_attr",position:i},{name:"ident",position:i},{name:"ident_end",position:e})),{type:"success",marks:r,position:e};case"[":{if(e=Tr(t,e+1),t[e]==="]")return{type:"success",marks:[{name:"array_postfix",position:n}],position:e+1};let s=e,a=Ta(t,e,0);if(a.type==="error")return a;if(e=Tr(t,a.position),t[e]==="."&&t[e+1]==="."){let l="inc_range";t[e+2]==="."?(l="exc_range",e+=3):e+=2,e=Tr(t,e);let c=Ta(t,e,0);return c.type==="error"?c:(e=Tr(t,c.position),t[e]!=="]"?{type:"error",message:'Expected "]" after array expression',position:e}:{type:"success",marks:[{name:"slice",position:n},{name:l,position:s}].concat(a.marks,c.marks),position:e+1})}return t[e]!=="]"?{type:"error",message:'Expected "]" after array expression',position:e}:{type:"success",marks:[{name:"square_bracket",position:n}].concat(a.marks),position:e+1}}case"|":{if(e=Tr(t,e+1),t[e]==="{"){let s=boe(t,e);return s.type==="error"||s.marks.unshift({name:"projection",position:n}),s}break}case"{":{let s=boe(t,e);return s.type==="error"||s.marks.unshift({name:"projection",position:n}),s}}return{type:"error",message:"Unexpected character in traversal",position:e}}function wxe(t,e,n){let r=[];if(r.push({name:"func_call",position:e}),t[n]===":"&&t[n+1]===":"){r.push({name:"namespace",position:e}),r.push({name:"ident",position:e},{name:"ident_end",position:n}),n=Tr(t,n+2);let o=O5(t,n,Y5);if(!o)return{type:"error",message:"Expected function name",position:n};if(r.push({name:"ident",position:n},{name:"ident_end",position:n+o}),n=Tr(t,n+o),t[n]!=="(")return{type:"error",message:'Expected "(" after function name',position:n};n++,n=Tr(t,n)}else r.push({name:"ident",position:e},{name:"ident_end",position:n}),n=Tr(t,n+1);let i=n;if(t[n]!==")")for(;;){let o=Ta(t,n,0);if(o.type==="error")return o;if(r=r.concat(o.marks),i=o.position,n=Tr(t,o.position),t[n]!==","||(n=Tr(t,n+1),t[n]===")"))break}return t[n]!==")"?{type:"error",message:'Expected ")" after function arguments',position:n}:(r.push({name:"func_args_end",position:i}),{type:"success",marks:r,position:n+1})}function boe(t,e){let n=[{name:"object",position:e}];for(e=Tr(t,e+1);t[e]!=="}";){let r=e;if(t.slice(e,e+3)==="...")if(e=Tr(t,e+3),t[e]!=="}"&&t[e]!==","){let i=Ta(t,e,0);if(i.type==="error")return i;n.push({name:"object_splat",position:r}),n=n.concat(i.marks),e=i.position}else n.push({name:"object_splat_this",position:r});else{let i=Ta(t,e,0);if(i.type==="error")return i;let o=Tr(t,i.position);if(i.marks[0].name==="str"&&t[o]===":"){let s=Ta(t,Tr(t,o+1),0);if(s.type==="error")return s;n.push({name:"object_pair",position:r}),n=n.concat(i.marks,s.marks),e=s.position}else n=n.concat({name:"object_expr",position:e},i.marks),e=i.position}if(e=Tr(t,e),t[e]!==",")break;e=Tr(t,e+1)}return t[e]!=="}"?{type:"error",message:'Expected "}" after object',position:e}:(e++,n.push({name:"object_end",position:e}),{type:"success",marks:n,position:e})}function sXt(t,e){let n=t[e];e=e+1;const r=[{name:"str",position:e}];e:for(;;e++){if(e>t.length)return{type:"error",message:"Unexpected end of query",position:e};switch(t[e]){case n:{r.push({name:"str_end",position:e}),e++;break e}case"\\":r.push({name:"str_pause",position:e}),t[e+1]==="u"?t[e+2]==="{"?(r.push({name:"unicode_hex",position:e+3}),e=t.indexOf("}",e+3),r.push({name:"unicode_hex_end",position:e})):(r.push({name:"unicode_hex",position:e+2}),r.push({name:"unicode_hex_end",position:e+6}),e+=5):(r.push({name:"single_escape",position:e+1}),e+=1),r.push({name:"str_start",position:e+1})}}return{type:"success",marks:r,position:e}}function Tr(t,e){return e+O5(t,e,iXt)}function O5(t,e,n){let r=n.exec(t.slice(e));return r?r[0].length:0}function KM(t,e,n){let r=n.exec(t.slice(e));return r?r[0]:null}function aXt(t,e){let n=e,r=[],i="",o="";if(t.substring(n,n+2)!=="fn")return{type:"success",position:n,marks:r};r.push({name:"func_decl",position:e}),n=Tr(t,n+2);let s=n;if(i=KM(t,n,Y5),!i)return{type:"error",message:"Expected function name",position:n};if(r.push({name:"ident",position:s},{name:"ident_end",position:n+i.length}),n=Tr(t,n+i.length),t.substring(n,n+2)!=="::")return{type:"error",message:'Expected "::" after namespace',position:n};if(n=Tr(t,n+2),o=KM(t,n,Y5),!o)return{type:"error",message:"Expected function name",position:n};if(r.push({name:"ident",position:n},{name:"ident_end",position:n+o.length}),n=Tr(t,n+o.length),t[n]!=="(")return{type:"error",message:'Expected "("',position:n};for(n=Tr(t,n+1);ne(t(n))}function voe(t){return e=>({type:"Map",base:e,expr:t({type:"This"})})}function lXt(t){return e=>({type:"FlatMap",base:e,expr:t({type:"This"})})}function RP(t,e){if(!e)return{type:"a-a",build:t};switch(e.type){case"a-a":return{type:"a-a",build:Op(t,e.build)};case"a-b":return{type:"a-b",build:Op(t,e.build)};case"b-b":return{type:"a-a",build:Op(t,voe(e.build))};case"b-a":return{type:"a-a",build:Op(t,lXt(e.build))};default:throw new Error(`unknown type: ${e.type}`)}}function mZ(t,e){if(!e)return{type:"b-b",build:t};switch(e.type){case"a-a":case"b-a":return{type:"b-a",build:Op(t,e.build)};case"a-b":case"b-b":return{type:"b-b",build:Op(t,e.build)};default:throw new Error(`unknown type: ${e.type}`)}}function cXt(t,e){if(!e)return{type:"a-b",build:t};switch(e.type){case"a-a":case"b-a":return{type:"a-a",build:Op(t,e.build)};case"a-b":case"b-b":return{type:"a-b",build:Op(t,e.build)};default:throw new Error(`unknown type: ${e.type}`)}}function uXt(t,e){if(!e)return{type:"b-b",build:t};switch(e.type){case"a-a":return{type:"a-a",build:Op(voe(t),e.build)};case"a-b":return{type:"a-b",build:Op(voe(t),e.build)};case"b-a":return{type:"b-a",build:Op(t,e.build)};case"b-b":return{type:"b-b",build:Op(t,e.build)};default:throw new Error(`unknown type: ${e.type}`)}}function ka(t,e=0){switch(t.type){case"Projection":return{...t,base:ka(t.base,e),expr:ka(t.expr,e+1)};case"Filter":return{...t,base:ka(t.base,e),expr:ka(t.expr,e+1)};case"Parent":{if(e-t.n<0)throw new Error(`Invalid use of parent operator (^). No parent n ${t.n} at level ${e}.`);return t}case"Parameter":throw new Error(`Function parameters are not allowed outside function declarations: ${t.name}`);case"Array":return{...t,elements:t.elements.map(n=>({...n,value:ka(n.value,e)}))};case"PipeFuncCall":return{...t,base:ka(t.base,e),args:t.args.map(n=>ka(n,e))};case"Object":return{...t,attributes:t.attributes.map(n=>{switch(n.type){case"ObjectAttributeValue":return{...n,value:ka(n.value,e)};case"ObjectConditionalSplat":return{...n,condition:ka(n.condition,e),value:ka(n.value,e)};case"ObjectSplat":return{...n,value:ka(n.value,e)};default:return n}})};case"FlatMap":case"Map":return{...t,expr:ka(t.expr,e),base:ka(t.base,e)};case"FuncCall":return{...t,args:t.args.map(n=>ka(n,e))};case"Tuple":return{...t,members:t.members.map(n=>ka(n,e))};case"Select":{const n=t.alternatives.map(r=>({...r,condition:ka(r.condition,e),value:ka(r.value,e)}));return t.fallback?{...t,alternatives:n,fallback:ka(t.fallback,e)}:{...t,alternatives:n}}case"SelectorNested":return{...t,base:ka(t.base,e),nested:ka(t.nested,e)};case"SelectorFuncCall":return{...t,arg:ka(t.arg,e)};case"AccessAttribute":case"AccessElement":case"ArrayCoerce":case"Asc":case"Desc":case"Deref":case"Group":case"Neg":case"Not":case"Slice":case"Pos":return t.base?{...t,base:ka(t.base,e)}:t;case"InRange":return{...t,base:ka(t.base,e),left:ka(t.left,e),right:ka(t.right,e)};case"OpCall":case"And":case"Or":return{...t,left:ka(t.left,e),right:ka(t.right,e)};case"Everything":case"This":case"Value":case"Context":return t;default:throw new Error(`Handle all cases: ${t.type}`)}}const dXt={"'":"'",'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:` +`,r:"\r",t:" "};function fXt(t){const e=parseInt(t,16);return String.fromCharCode(e)}class Du extends Error{name="GroqQueryError"}function hZe(t=new Set){const e={group(o){return{type:"Group",base:o.process(e)}},everything(){return{type:"Everything"}},this(){return{type:"This"}},parent(){return{type:"Parent",n:1}},dblparent(o){return{type:"Parent",n:o.process(e).n+1}},traverse(o){const s=o.process(e),a=[];for(;o.getMark().name!=="traversal_end";)a.push(o.process(r));o.shift();let l=null;for(let c=a.length-1;c>=0;c--)l=a[c](l);if((s.type==="Everything"||s.type==="Array"||s.type==="PipeFuncCall")&&(l=RP(c=>c,l)),l===null)throw new Error("BUG: unexpected empty traversal");return l.build(s)},this_attr(o){const s=o.processString();return s==="null"?{type:"Value",value:null}:s==="true"?{type:"Value",value:!0}:s==="false"?{type:"Value",value:!1}:{type:"AccessAttribute",name:s}},neg(o){return{type:"Neg",base:o.process(e)}},pos(o){return{type:"Pos",base:o.process(e)}},add(o){const s=o.process(e),a=o.process(e);return{type:"OpCall",op:"+",left:s,right:a}},sub(o){const s=o.process(e),a=o.process(e);return{type:"OpCall",op:"-",left:s,right:a}},mul(o){const s=o.process(e),a=o.process(e);return{type:"OpCall",op:"*",left:s,right:a}},div(o){const s=o.process(e),a=o.process(e);return{type:"OpCall",op:"/",left:s,right:a}},mod(o){const s=o.process(e),a=o.process(e);return{type:"OpCall",op:"%",left:s,right:a}},pow(o){const s=o.process(e),a=o.process(e);return{type:"OpCall",op:"**",left:s,right:a}},comp(o){const s=o.process(e),a=o.processString(),l=o.process(e);return{type:"OpCall",op:a,left:s,right:l}},in_range(o){const s=o.process(e),a=o.getMark().name==="inc_range";o.shift();const l=o.process(e),c=o.process(e);return{type:"InRange",base:s,left:l,right:c,isInclusive:a}},str(o){let s="";e:for(;o.hasMark();){const a=o.getMark();switch(a.name){case"str_end":s+=o.processStringEnd();break e;case"str_pause":s+=o.processStringEnd();break;case"str_start":o.shift();break;case"single_escape":{const l=o.slice(1);o.shift(),s+=dXt[l];break}case"unicode_hex":o.shift(),s+=fXt(o.processStringEnd());break;default:throw new Error(`unexpected mark: ${a.name}`)}}return{type:"Value",value:s}},integer(o){const s=o.processStringEnd();return{type:"Value",value:Number(s)}},float(o){const s=o.processStringEnd();return{type:"Value",value:Number(s)}},sci(o){const s=o.processStringEnd();return{type:"Value",value:Number(s)}},object(o){const s=[];for(;o.getMark().name!=="object_end";)s.push(o.process(n));return o.shift(),{type:"Object",attributes:s}},array(o){const s=[];for(;o.getMark().name!=="array_end";){let a=!1;o.getMark().name==="array_splat"&&(a=!0,o.shift());const l=o.process(e);s.push({type:"ArrayElement",value:l,isSplat:a})}return o.shift(),{type:"Array",elements:s}},tuple(o){const s=[];for(;o.getMark().name!=="tuple_end";)s.push(o.process(e));return o.shift(),{type:"Tuple",members:s}},func_call(o){let s="global";o.getMark().name==="namespace"&&(o.shift(),s=o.processString());const a=o.processString();if(s==="global"&&a==="select"){const h={type:"Select",alternatives:[]};for(;o.getMark().name!=="func_args_end";)if(o.getMark().name==="pair"){if(h.fallback)throw new Du("unexpected argument to select()");o.shift();const p=o.process(e),m=o.process(e);h.alternatives.push({type:"SelectAlternative",condition:p,value:m})}else{if(h.fallback)throw new Du("unexpected argument to select()");const p=o.process(e);h.fallback=p}return o.shift(),h}const l=[];for(;o.getMark().name!=="func_args_end";)pXt(s,a,l.length)?l.push(o.process(i)):l.push(o.process(e));if(o.shift(),s==="global"&&(a==="before"||a==="after")&&o.parseOptions.mode==="delta")return{type:"Context",key:a};if(s==="global"&&a==="boost"&&!o.allowBoost)throw new Du("unexpected boost");const c=o.customFunctions[`${s}::${a}`];if(c!==void 0){const h=gZe(t),p=new rfe(o.string,c.marks,o.customFunctions,{}).process(h);return gZ(a,p.params.length,l.length),mZe(p.body,m=>ka(m),m=>hXt(m,p.params,l))}const u=rXt[s];if(!u)throw new Du(`Undefined namespace: ${s}`);const f=u[a];if(!f)throw new Du(`Undefined function: ${a}`);if(f.arity!==void 0&&gZ(a,f.arity,l.length),f.mode!==void 0&&f.mode!==o.parseOptions.mode)throw new Du(`Undefined function: ${a}`);return{type:"FuncCall",namespace:s,name:a,args:l,func:f}},pipecall(o){const s=o.process(e);o.shift();let a="global";if(o.getMark().name==="namespace"&&(o.shift(),a=o.processString()),a!=="global")throw new Du(`Undefined namespace: ${a}`);const l=o.processString(),c=[],u=o.allowBoost;for(l==="score"&&(o.allowBoost=!0);;){const h=o.getMark().name;if(h==="func_args_end")break;if(l==="order"){if(h==="asc"){o.shift(),c.push({type:"Asc",base:o.process(e)});continue}else if(h==="desc"){o.shift(),c.push({type:"Desc",base:o.process(e)});continue}}c.push(o.process(e))}o.shift(),o.allowBoost=u;const f=OR[l];if(!f)throw new Du(`Undefined pipe function: ${l}`);return f.arity&&gZ(l,f.arity,c.length),{type:"PipeFuncCall",func:f,base:s,name:l,args:c}},pair(){throw new Du("unexpected =>")},and(o){const s=o.process(e),a=o.process(e);return{type:"And",left:s,right:a}},or(o){const s=o.process(e),a=o.process(e);return{type:"Or",left:s,right:a}},not(o){return{type:"Not",base:o.process(e)}},asc(){throw new Du("unexpected asc")},desc(){throw new Du("unexpected desc")},param(o){const s=o.processString();return o.parseOptions.params&&o.parseOptions.params.hasOwnProperty(s)?{type:"Value",value:o.parseOptions.params[s]}:{type:"Parameter",name:s}}},n={object_expr(o){if(o.getMark().name==="pair"){o.shift();const a=o.process(e),l=o.process(e);return{type:"ObjectConditionalSplat",condition:a,value:l}}const s=o.process(e);return{type:"ObjectAttributeValue",name:pZe(s),value:s}},object_pair(o){const s=o.process(e);if(s.type!=="Value")throw new Error("name must be string");const a=o.process(e);return{type:"ObjectAttributeValue",name:s.value,value:a}},object_splat(o){return{type:"ObjectSplat",value:o.process(e)}},object_splat_this(){return{type:"ObjectSplat",value:{type:"This"}}}},r={square_bracket(o){const s=o.process(e),a=AP(s);return a&&a.type==="number"?l=>cXt(c=>({type:"AccessElement",base:c,index:a.data}),l):a&&a.type==="string"?l=>mZ(c=>({type:"AccessAttribute",base:c,name:a.data}),l):l=>RP(c=>({type:"Filter",base:c,expr:s}),l)},slice(o){const s=o.getMark().name==="inc_range";o.shift();const a=o.process(e),l=o.process(e),c=AP(a),u=AP(l);if(!c||!u||c.type!=="number"||u.type!=="number")throw new Du("slicing must use constant numbers");return f=>RP(h=>({type:"Slice",base:h,left:c.data,right:u.data,isInclusive:s}),f)},projection(o){const s=o.process(e);return a=>uXt(l=>({type:"Projection",base:l,expr:s}),a)},attr_access(o){const s=o.processString();return a=>mZ(l=>({type:"AccessAttribute",base:l,name:s}),a)},deref(o){let s=null;o.getMark().name==="deref_attr"&&(o.shift(),s=o.processString());const a=l=>s?{type:"AccessAttribute",base:l,name:s}:l;return l=>mZ(c=>a({type:"Deref",base:c}),l)},array_postfix(){return o=>RP(s=>({type:"ArrayCoerce",base:s}),o)}},i={group(o){return o.process(i)},everything(){throw new Error("Invalid selector syntax")},this(){throw new Error("Invalid selector syntax")},parent(){throw new Error("Invalid selector syntax")},dblparent(){throw new Error("Invalid selector syntax")},traverse(o){let s=o.process(i);for(;o.getMark().name!=="traversal_end";)if(o.getMark().name==="array_postfix")o.shift(),s={type:"ArrayCoerce",base:s};else if(o.getMark().name==="square_bracket"){o.shift();const a=o.process(e),l=AP(a);if(l&&l.type==="number")throw new Error("Invalid array access expression");l&&l.type==="string"?s={type:"AccessAttribute",base:s,name:l.data}:s={type:"Filter",base:s,expr:a}}else if(o.getMark().name==="attr_access"){o.shift();const a=o.processString();s={type:"AccessAttribute",base:s,name:a}}else if(o.getMark().name==="tuple"||o.getMark().name==="group"){const a=o.process(i);if(!XKt(a))throw new Error(`Unexpected result parsing nested selector: ${a.type}`);s={type:"SelectorNested",base:s,nested:a}}else throw new Error("Invalid selector syntax");return o.shift(),s},this_attr(o){return{type:"AccessAttribute",name:o.processString()}},attr_access(){throw new Error("Invalid selector syntax")},neg(){throw new Error("Invalid selector syntax")},pos(){throw new Error("Invalid selector syntax")},add(){throw new Error("Invalid selector syntax")},sub(){throw new Error("Invalid selector syntax")},mul(){throw new Error("Invalid selector syntax")},div(){throw new Error("Invalid selector syntax")},mod(){throw new Error("Invalid selector syntax")},pow(){throw new Error("Invalid selector syntax")},comp(){throw new Error("Invalid selector syntax")},in_range(){throw new Error("Invalid selector syntax")},str(){throw new Error("Invalid selector syntax")},integer(){throw new Error("Invalid selector syntax")},float(){throw new Error("Invalid selector syntax")},sci(){throw new Error("Invalid selector syntax")},object(){throw new Error("Invalid selector syntax")},array(){throw new Error("Invalid selector syntax")},tuple(o){const s=[];for(;o.getMark().name!=="tuple_end";)s.push(o.process(i));return o.shift(),{type:"Tuple",members:s}},func_call(o,s){const a=e.func_call(o,s);if(a.name==="anywhere"&&a.args.length===1)return{type:"SelectorFuncCall",name:"anywhere",arg:a.args[0]};throw new Error("Invalid selector syntax")},pipecall(){throw new Error("Invalid selector syntax")},pair(){throw new Error("Invalid selector syntax")},and(){throw new Error("Invalid selector syntax")},or(){throw new Error("Invalid selector syntax")},not(){throw new Error("Invalid selector syntax")},asc(){throw new Error("Invalid selector syntax")},desc(){throw new Error("Invalid selector syntax")},param(){throw new Error("Invalid selector syntax")}};return e}function pZe(t){if(t.type==="AccessAttribute"&&!t.base)return t.name;if(t.type==="PipeFuncCall"||t.type==="Deref"||t.type==="Map"||t.type==="Projection"||t.type==="Slice"||t.type==="Filter"||t.type==="AccessElement"||t.type==="ArrayCoerce"||t.type==="Group")return pZe(t.base);throw new Du(`Cannot determine property key for type: ${t.type}`)}function gZ(t,e,n){if(typeof e=="number"){if(n!==e)throw new Du(`Incorrect number of arguments to function ${t}(). Expected ${e}, got ${n}.`)}else if(e&&!e(n))throw new Du(`Incorrect number of arguments to function ${t}().`)}function hXt(t,e,n){if(t.type!=="Parameter")throw new Du(`Expected parameter node, got ${t.type}`);const r=e.findIndex(i=>i.name===t.name);if(r===-1)throw new Du(`Missing argument for parameter ${t.name} in function call`);return n[r]}function mZe(t,e,n=r=>r){if(t.type==="Projection"){if(t.base.type==="Parameter")return{type:"Projection",base:n(t.base),expr:e(t.expr)};if(t.base.type==="Deref"&&t.base.base.type==="Parameter")return{type:"Projection",base:{type:"Deref",base:n(t.base.base)},expr:e(t.expr)}}if(t.type==="Map"&&t.base.type==="ArrayCoerce"&&t.base.base.type==="Parameter")return{type:"Map",base:{type:"ArrayCoerce",base:n(t.base.base)},expr:e(t.expr)};throw new Du(`Unexpected function body, must be a projection. Got "${t.type}"`)}function pXt(t,e,n){const r=["changedAny","changedOnly"];return t=="diff"&&n==2&&r.includes(e)}class mXt extends Error{position;name="GroqSyntaxError";constructor(e,n){super(`Syntax error in GROQ query at position ${e}${n?`: ${n}`:""}`),this.position=e}}function ife(t,e={}){const n=oXt(t);if(n.type==="error")throw new mXt(n.position,n.message);gXt(t,n.customFunctions);const r=new rfe(t,n.marks,n.customFunctions,e),i=hZe();return r.process(i)}function gZe(t=new Set){return{func_decl(e){const n=e.processString(),r=e.processString(),i=`${n}::${r}`;if(t.has(i))throw new Du(`Recursive function definition detected for ${i}`);const o=hZe(new Set([...t,i])),s=[];for(;e.getMark().name!=="func_params_end";){const l=e.process(o);if(l.type!=="Parameter")throw new Error("expected parameter");s.push(l)}if(s.length!==1)throw new Du("Custom functions can only have one parameter");e.shift();const a=e.process(o);return{type:"FuncDeclaration",namespace:n,name:r,params:s,body:a}}}}function gXt(t,e){for(const n in e){if(!e.hasOwnProperty(n))continue;const r=e[n],i=new rfe(t,r.marks,e,{}),o=gZe(),s=i.process(o);mZe(s.body,a=>ka(a))}}const{compare:pli}=new Intl.Collator("en"),yXt=dl("typeEvaluator:scope:trace");yXt.log=console.log.bind(console);const bXt=dl("typeEvaluator:evaluate:trace");bXt.log=console.log.bind(console);const vXt=dl("typeEvaluator:evaluate:debug");vXt.log=console.log.bind(console);dl("typeEvaluator:evaluate:warn");const xXt=8.333333333333334;class CXt{#t=[];#e;constructor(e){this.#e=performance.now(),this.#t=e}async map(e,n){const r=[];for(const i of e){const o=this._tryPause();o&&await o,r.push(n(i))}return r}async forEach(e,n){for(const r of e){const i=this._tryPause();i&&await i,n(r)}}async forEachIter(e,n){for(const r of e){const i=this._tryPause();i&&await i,n(r)}}end(){this.#t.push(performance.now()-this.#e)}_tryPause(){const e=performance.now()-this.#e;if(!(e{const r=()=>{this.#e=performance.now(),n()};typeof requestIdleCallback=="function"?requestIdleCallback(r,{timeout:1}):typeof requestAnimationFrame=="function"?requestAnimationFrame(r):setTimeout(r,0)})}}const wXt={async map(t,e){return t.map(e)},async forEach(t,e){return t.forEach(e)},async forEachIter(t,e){for(const n of t)e(n)}},_Xt=5;class SXt{cache=new WeakMap;async get(e,n){let r=this.cache.get(e);if(r)return r;let i;const o=n?.scheduler||(n?.pauseDurations?i=new CXt(n.pauseDurations):wXt),s={fields:new Map,duplicateFields:new Map,arrayElements:new Map,duplicateArrayElements:new Map},a=await o.map(e.getLocalTypeNames(),u=>{const f=ofe(e.get(u),u,s);return{name:u,typeDef:f}}),l=new Map;for(const[u,f]of s.duplicateFields.entries())l.set(u,{__type:"hoisted",key:f});for(const[u,f]of s.duplicateArrayElements.entries())l.set(u,{__type:"hoisted",key:f});const c=new MGt({rewriteMap:l});return await o.forEachIter(s.duplicateFields.entries(),([u,f])=>{c.addObject("sanity.schema.hoisted",{key:f,value:{...u}})}),await o.forEachIter(s.duplicateArrayElements.entries(),([u,f])=>{c.addObject("sanity.schema.hoisted",{key:f,value:{...u}})}),await o.forEach(a,u=>{c.addObject("sanity.schema.namedType",u)}),e.parent&&c.addSet(await this.get(e.parent,{scheduler:o})),r=c.build("sanity.schema.registry"),this.cache.set(e,r),i&&i.end(),r}}function kXt(t,e,n){const r=Ho in t?t[Ho]:t;let i;Array.isArray(r.fields)&&(i=r.fields.map(c=>{const u=`${e}.${c.name}`,f=n.fields.get(c);if(f){const b=n.duplicateFields.get(f);return(!b||xZe(u,b))&&n.duplicateFields.set(f,u),f}const{name:h,group:p,fieldset:m,type:g}=c,y={name:h,typeDef:ofe(g,u,n),groups:TXt(p),fieldset:m};return n.fields.set(c,y),y}));let o;Array.isArray(r.fieldsets)&&(o=Coe("name",r.fieldsets.map(({name:c,title:u,description:f,group:h,hidden:p,readOnly:m,options:g})=>({name:c,title:Vx(u),description:Vx(f),group:Vx(h),hidden:BE(p),readOnly:BE(m),options:b7(g)}))));let s;Array.isArray(r.groups)&&(s=Coe("name",r.groups.map(({name:c,title:u,hidden:f,default:h,i18n:p})=>({name:c,title:Vx(u),hidden:BE(f),default:xoe(h),i18n:vZe(p)}))));const a=r.deprecated?.reason;let l;return Array.isArray(r.orderings)&&(l=r.orderings.map(NXt).filter(c=>c!==void 0)),{title:Vx(r.title),description:DXt(r.description),readOnly:BE(r.readOnly),hidden:BE(r.hidden),liveEdit:xoe(r.liveEdit),options:b7(r.options),initialValue:b7(r.initialValue),deprecated:typeof a=="string"?{reason:a}:void 0,placeholder:Vx(r.placeholder),rows:EXt(r.rows),fields:i,fieldsets:o,groups:s,validation:OXt(r),orderings:l}}function ofe(t,e,n){const r=kXt(t,e,n);if(!t.type)return{extends:null,jsonType:t.jsonType,...r};switch(t.type.name){case"array":return{extends:"array",of:t.of.map((i,o)=>{const s=`${e}.${i.name}`,a=n.arrayElements.get(i);if(a){const c=n.duplicateArrayElements.get(a);return(!c||xZe(s,c))&&n.duplicateArrayElements.set(a,s),a}const l={name:i.name,typeDef:ofe(i,`${e}.${i.name}`,n)};return n.arrayElements.set(i,l),l}),...r};case"reference":case"globalDocumentReference":case"crossDatasetReference":return{extends:t.type.name,to:Coe("name",t.to.map(i=>({name:i.name||i.type?.name||i.type}))),...r};default:return{extends:t.type.name,...r}}}function Vx(t){return typeof t=="string"?t:void 0}function EXt(t){return typeof t=="number"?t.toString():void 0}function xoe(t){return t===!0?!0:void 0}function BE(t){return typeof t=="function"?yZe:xoe(t)}function Coe(t,e){return e.filter(n=>typeof n[t]=="string")}function TXt(t){if(typeof t=="string")return[t];if(Array.isArray(t))return t.filter(e=>typeof e=="string")}const yZe={__type:"function"},IXt={__type:"unknown"},jXt={__type:"undefined"},AXt={__type:"cyclic"},RXt={__type:"maxDepth"};function b7(t,e=new Set,n=_Xt){if(n===0)return RXt;if(typeof t=="string"||typeof t=="boolean"||t===null||t===void 0)return t;if(typeof t=="number")return{__type:"number",value:t.toString()};if(typeof t=="function")return yZe;if(e.has(t))return AXt;if(e.add(t),Ks(t)){if(Array.isArray(t))return t.map(o=>{const s=b7(o,e,n-1);return s===void 0?jXt:s});if("$$typeof"in t&&"type"in t&&"props"in t){const{type:o,props:s}=t,a=typeof o=="function"?o.name:o;return typeof a!="string"?void 0:{__type:"jsx",type:a,props:b7(s,e,n-1)}}let r=!1;const i={};for(const[o,s]of Object.entries(t))o==="__type"&&(r=!0),i[o]=b7(s,e,n-1);return r?{__type:"object",value:i}:i}return IXt}function DXt(t){if(typeof t=="string")return t;if(Ks(t)&&"$$typeof"in t&&"type"in t&&"props"in t){const{type:e,props:n}=t,r=typeof e=="function"?e.name:e;return typeof r!="string"?void 0:{__type:"jsx",type:r,props:b7(n)}}}function OXt(t){if(!Ks(t)||!("type"in t))return;const e=[];switch("options"in t&&Ks(t.options)&&"list"in t.options&&Array.isArray(t.options.list)&&e.push({type:"enum",values:t.options.list.map(i=>b7(PXt(i,t))).filter(i=>i!==void 0)}),t.type){case"url":e.push({type:"uri",allowRelative:!1});break;case"slug":e.push({type:"custom"});break;case"reference":e.push({type:"reference"});break;case"email":e.push({type:"email"});break}if(!("validation"in t)||!t.validation)return e.length>0?[{level:"error",rules:e}]:void 0;const n=[],r=Array.isArray(t.validation)?t.validation:[t.validation];for(const i of r){const o=aN(i);if(o===void 0)continue;const s=e.filter(a=>!o.rules.some(l=>Mo(l,a)));s.length>0&&o.rules.unshift(...s),!n.some(a=>Mo(a,o))&&n.push(o)}return n.length>0?n:void 0}function bZe(t){return!t||typeof t!="object"?!1:"fields"in t?Array.isArray(t.fields)?t.fields.some(e=>e.name==="value"):!1:"type"in t&&t.type?bZe(t.type):!1}function PXt(t,e){return e.jsonType==="object"&&bZe(e)?t:Ks(t)&&"value"in t&&t.value?t.value:t}function aN(t){if(t){if(MXt(t))try{const e=t(new XXe);if(_xe(e))return aN(e);throw new Error("failed to convert to plain rule")}catch{return{level:"error",rules:[{type:"custom",name:"function"}]}}if(_xe(t)){const e=t._level||"error",n=$Xt(t._message),r=[];for(const i of t._rules||[]){const o=t._required==="optional"||void 0,s=LXt(i,o);s!==void 0&&(r.some(a=>Mo(a,s))||r.push(s))}return r.length===0?void 0:{level:e,rules:r,...n&&{message:n}}}}}function _xe(t){return Ks(t)&&"_rules"in t}function $Xt(t){if(typeof t=="string")return t;if(!Ks(t)||Array.isArray(t))return;const e={};for(const[n,r]of Object.entries(t))typeof n!="string"||typeof r!="string"||(e[n]=r);return Object.keys(e).length>0?e:void 0}function MXt(t){return typeof t=="function"}function LXt(t,e){if(!Ks(t)||!("flag"in t))return;const n="constraint"in t?t.constraint:void 0;switch(t.flag){case"integer":return{type:"integer"};case"email":return{type:"email"};case"unique":return{type:"uniqueItems"};case"reference":return{type:"reference"};case"assetRequired":return{type:"assetRequired"};case"stringCasing":return n==="uppercase"?{type:"uppercase"}:n==="lowercase"?{type:"lowercase"}:void 0;case"all":if(Array.isArray(n)){const r=n.map(i=>aN(i)).filter(i=>i!==void 0);if(r.length>0)return{type:"allOf",children:r}}return;case"either":if(Array.isArray(n)){const r=n.map(i=>aN(i)).filter(i=>i!==void 0);if(r.length>0)return{type:"anyOf",children:r}}return;case"valid":return Array.isArray(n)?{type:"enum",values:n.map(r=>b7(r)).filter(r=>r!==void 0)}:void 0;case"min":return{type:"minimum",value:zx(n)};case"max":return{type:"maximum",value:zx(n)};case"length":return{type:"length",value:zx(n)};case"precision":return{type:"precision",value:zx(n)};case"lessThan":return{type:"exclusiveMaximum",value:zx(n)};case"greaterThan":return{type:"exclusiveMinimum",value:zx(n)};case"regex":if(Ks(n)&&"pattern"in n){const{pattern:r}=n,i="invert"in n?Sxe(n.invert):void 0;if(r instanceof RegExp)return{type:"regex",pattern:r.source,...i&&{invert:!0}}}return;case"uri":{const r=Ks(n)&&"options"in n&&Ks(n.options)&&"allowRelative"in n.options?Sxe(n.options.allowRelative):void 0;return{type:"uri",...r!==void 0&&{allowRelative:r}}}case"custom":return{type:"custom",...e&&{optional:e}};case"media":return{type:"custom",name:"media"};case"type":return;case"presence":return n==="required"?{type:"required"}:void 0;default:return}}function zx(t){return Ks(t)&&"type"in t&&"path"in t&&t.type&&t.path?{type:"fieldReference",path:Array.isArray(t.path)?t.path:[t.path]}:String(t)}function Sxe(t){if(typeof t=="boolean")return t}function vZe(t){if(!Ks(t)||Array.isArray(t))return;const e={};for(const n of Object.entries(t))if(FXt(n)){const[r,i]=n;e[r]={ns:i.ns,key:i.key}}return Object.keys(e).length>0?e:void 0}function FXt(t){const[e,n]=t;return typeof e=="string"&&!!n&&typeof n=="object"&&"key"in n&&"ns"in n&&typeof n.key=="string"&&typeof n.ns=="string"}function NXt(t){if(!Ks(t)||Array.isArray(t))return;const e="name"in t&&typeof t.name=="string"?t.name:void 0;if(e===void 0)return;const n="title"in t&&typeof t.title=="string"?t.title:e,r="by"in t&&Array.isArray(t.by)?t.by:[],i=[];for(const s of r){const a=BXt(s);a&&i.push(a)}if(i.length===0)return;const o="i18n"in t?vZe(t.i18n):void 0;return{name:e,title:n,by:i,...o&&{i18n:o}}}function BXt(t){if(!Ks(t)||Array.isArray(t))return;const e="field"in t&&typeof t.field=="string"?t.field:void 0,n="direction"in t&&(t.direction==="asc"||t.direction==="desc")?t.direction:void 0;if(!(!e||!n))return{field:e,direction:n}}function xZe(t,e){return t.lengthwoe in t?t[woe]:CZe,HXt=(t,e)=>{if(!Array.isArray(e))throw new Error(`The value of .${woe} should be an array with any of the actions ${yZ.join(", ")}`);const n=E9(e,yZ);if(n.length>0)throw new Error(`Invalid action${n.length>1?"s":""} configured for schema type "${t}": ${n.join(", ")}. Valid actions are: ${yZ.join(", ")}`);return e},UXt=t=>HXt(t.name,zXt(t)),kxe=(t,e)=>UXt(t).includes(e);var WXt={name:"sanity.assetSourceData",title:"Asset Source Data",type:"object",fields:[{name:"name",title:"Source name",description:"A canonical name for the source this asset is originating from",type:"string"},{name:"id",title:"Asset Source ID",description:"The unique ID for the asset within the originating source so you can programatically find back to it",type:"string"},{name:"url",title:"Asset information URL",description:"A URL to find more information about this asset in the originating source",type:"string"}]},qXt={name:"sanity.fileAsset",title:"File",type:"document",fieldsets:[{name:"system",title:"System fields",description:"These fields are managed by the system and not editable"}],fields:[{name:"originalFilename",type:"string",title:"Original file name",readOnly:!0},{name:"label",type:"string",title:"Label"},{name:"title",type:"string",title:"Title"},{name:"description",type:"string",title:"Description"},{name:"altText",type:"string",title:"Alternative text"},{name:"sha1hash",type:"string",title:"SHA1 hash",readOnly:!0,fieldset:"system"},{name:"extension",type:"string",title:"File extension",readOnly:!0,fieldset:"system"},{name:"mimeType",type:"string",title:"Mime type",readOnly:!0,fieldset:"system"},{name:"size",type:"number",title:"File size in bytes",readOnly:!0,fieldset:"system"},{name:"assetId",type:"string",title:"Asset ID",readOnly:!0,fieldset:"system"},{name:"uploadId",type:"string",readOnly:!0,hidden:!0,fieldset:"system"},{name:"path",type:"string",title:"Path",readOnly:!0,fieldset:"system"},{name:"url",type:"string",title:"Url",readOnly:!0,fieldset:"system"},{name:"source",type:"sanity.assetSourceData",title:"Source",readOnly:!0,fieldset:"system"}],preview:{select:{title:"originalFilename",path:"path",mimeType:"mimeType",size:"size"},prepare(t){return{title:t.title||t.path.split("/").slice(-1)[0],subtitle:`${t.mimeType} (${(t.size/1024/1024).toFixed(2)} MB)`}}},orderings:[{title:"File size",name:"fileSizeDesc",by:[{field:"size",direction:"desc"}]}]},GXt={title:"Geographical Point",name:"geopoint",type:"object",fields:[{name:"lat",type:"number",title:"Latitude"},{name:"lng",type:"number",title:"Longitude"},{name:"alt",type:"number",title:"Altitude"}]},YXt={name:"sanity.imageAsset",title:"Image",type:"document",fieldsets:[{name:"system",title:"System fields",description:"These fields are managed by the system and not editable"}],fields:[{name:"originalFilename",type:"string",title:"Original file name",readOnly:!0},{name:"label",type:"string",title:"Label"},{name:"title",type:"string",title:"Title"},{name:"description",type:"string",title:"Description"},{name:"altText",type:"string",title:"Alternative text"},{name:"sha1hash",type:"string",title:"SHA1 hash",readOnly:!0,fieldset:"system"},{name:"extension",type:"string",readOnly:!0,title:"File extension",fieldset:"system"},{name:"mimeType",type:"string",readOnly:!0,title:"Mime type",fieldset:"system"},{name:"size",type:"number",title:"File size in bytes",readOnly:!0,fieldset:"system"},{name:"assetId",type:"string",title:"Asset ID",readOnly:!0,fieldset:"system"},{name:"uploadId",type:"string",readOnly:!0,hidden:!0,fieldset:"system"},{name:"path",type:"string",title:"Path",readOnly:!0,fieldset:"system"},{name:"url",type:"string",title:"Url",readOnly:!0,fieldset:"system"},{name:"metadata",type:"sanity.imageMetadata",title:"Metadata"},{name:"source",type:"sanity.assetSourceData",title:"Source",readOnly:!0,fieldset:"system"}],preview:{select:{id:"_id",title:"originalFilename",mimeType:"mimeType",size:"size",media:"media"},prepare(t){return{title:t.title||typeof t.path=="string"&&t.path.split("/").slice(-1)[0],media:{asset:{_ref:t.id},...t.media?{media:t.media}:{}},subtitle:`${t.mimeType} (${(Number(t.size)/1024/1024).toFixed(2)} MB)`}}},orderings:[{title:"File size",name:"fileSizeDesc",by:[{field:"size",direction:"desc"}]}]},KXt={name:"sanity.imageCrop",title:"Image crop",type:"object",fields:[{name:"top",type:"number",validation:t=>t.required()},{name:"bottom",type:"number",validation:t=>t.required()},{name:"left",type:"number",validation:t=>t.required()},{name:"right",type:"number",validation:t=>t.required()}]},XXt={name:"sanity.imageDimensions",type:"object",title:"Image dimensions",fields:[{name:"height",type:"number",title:"Height",readOnly:!0,validation:t=>t.required()},{name:"width",type:"number",title:"Width",readOnly:!0,validation:t=>t.required()},{name:"aspectRatio",type:"number",title:"Aspect ratio",readOnly:!0,validation:t=>t.required()}]},ZXt={name:"sanity.imageHotspot",title:"Image hotspot",type:"object",fields:[{name:"x",type:"number",validation:t=>t.required()},{name:"y",type:"number",validation:t=>t.required()},{name:"height",type:"number",validation:t=>t.required()},{name:"width",type:"number",validation:t=>t.required()}]},QXt={name:"sanity.imageMetadata",title:"Image metadata",type:"object",fieldsets:[{name:"extra",title:"Extra metadata…",options:{collapsable:!0}}],fields:[{name:"location",type:"geopoint"},{name:"dimensions",title:"Dimensions",type:"sanity.imageDimensions",fieldset:"extra"},{name:"palette",type:"sanity.imagePalette",title:"Palette",fieldset:"extra"},{name:"lqip",title:"LQIP (Low-Quality Image Placeholder)",type:"string",readOnly:!0},{name:"blurHash",title:"BlurHash",type:"string",readOnly:!0},{name:"thumbHash",title:"ThumbHash",type:"string",readOnly:!0},{name:"hasAlpha",title:"Has alpha channel",type:"boolean",readOnly:!0},{name:"isOpaque",title:"Is opaque",type:"boolean",readOnly:!0}]},JXt={name:"sanity.imagePalette",title:"Image palette",type:"object",fields:[{name:"darkMuted",type:"sanity.imagePaletteSwatch",title:"Dark Muted"},{name:"lightVibrant",type:"sanity.imagePaletteSwatch",title:"Light Vibrant"},{name:"darkVibrant",type:"sanity.imagePaletteSwatch",title:"Dark Vibrant"},{name:"vibrant",type:"sanity.imagePaletteSwatch",title:"Vibrant"},{name:"dominant",type:"sanity.imagePaletteSwatch",title:"Dominant"},{name:"lightMuted",type:"sanity.imagePaletteSwatch",title:"Light Muted"},{name:"muted",type:"sanity.imagePaletteSwatch",title:"Muted"}]},eZt={name:"sanity.imagePaletteSwatch",title:"Image palette swatch",type:"object",fields:[{name:"background",type:"string",title:"Background",readOnly:!0},{name:"foreground",type:"string",title:"Foreground",readOnly:!0},{name:"population",type:"number",title:"Population",readOnly:!0},{name:"title",type:"string",title:"String",readOnly:!0}]},tZt={title:"Slug",name:"slug",type:"object",fields:[{name:"current",title:"Current slug",type:"string",validation:t=>t.required()},{name:"source",title:"Source field",type:"string",hidden:!0}]};const wZe=[WXt,tZt,GXt,YXt,qXt,KXt,ZXt,QXt,XXt,JXt,eZt],gr={TYPE_INVALID:"schema-type-invalid",TYPE_IS_ESM_MODULE:"schema-type-is-esm-module",TYPE_NAME_RESERVED:"schema-type-name-reserved",TYPE_MISSING_NAME:"schema-type-missing-name-or-type",TYPE_MISSING_TYPE:"schema-type-missing-name-or-type",TYPE_TITLE_RECOMMENDED:"schema-type-title-is-recommended",TYPE_TITLE_INVALID:"schema-type-title-is-recommended",OBJECT_FIELDS_INVALID:"schema-object-fields-invalid",OBJECT_FIELD_NOT_UNIQUE:"schema-object-fields-invalid",OBJECT_FIELD_NAME_INVALID:"schema-object-fields-invalid",OBJECT_FIELD_DEFINITION_INVALID_TYPE:"schema-object-fields-invalid",ARRAY_PREDEFINED_CHOICES_INVALID:"schema-predefined-choices-invalid",ARRAY_OF_ARRAY:"schema-array-of-array",ARRAY_OF_INVALID:"schema-array-of-invalid",ARRAY_OF_NOT_UNIQUE:"schema-array-of-invalid",ARRAY_OF_DUPLICATE_PRIMITIVE_JSON_TYPE:"schema-array-of-duplicate-primitive-json-type",ARRAY_OF_TYPE_GLOBAL_TYPE_CONFLICT:"schema-array-of-type-global-type-conflict",ARRAY_OF_TYPE_BUILTIN_TYPE_CONFLICT:"schema-array-of-type-builtin-type-conflict",REFERENCE_TO_INVALID:"schema-reference-to-invalid",REFERENCE_TO_NOT_UNIQUE:"schema-reference-to-invalid",REFERENCE_INVALID_OPTIONS:"schema-reference-invalid-options",REFERENCE_INVALID_OPTIONS_LOCATION:"schema-reference-options-nesting",REFERENCE_INVALID_FILTER_PARAMS_COMBINATION:"schema-reference-filter-params-combination",SLUG_SLUGIFY_FN_RENAMED:"slug-slugifyfn-renamed",ASSET_METADATA_FIELD_INVALID:"asset-metadata-field-invalid",CROSS_DATASET_REFERENCE_INVALID:"cross-dataset-reference-invalid",GLOBAL_DOCUMENT_REFERENCE_INVALID:"global-document-reference-invalid",DEPRECATED_BLOCKEDITOR_KEY:"schema-deprecated-blockeditor-key",STANDALONE_BLOCK_TYPE:"schema-standalone-block-type",FIELD_TYPE_IS_DOCUMENT:"schema-field-type-is-document"};function _Ze(t,e,n){if(n&&!Object.keys(gr).some(r=>gr[r]===n))throw new Error(`Used the unknown helpId "${n}", please add it to the array in createValidationResult.js`);return{severity:t,message:e,helpId:n}}const Cn=(t,e)=>_Ze("error",t,e),Vl=(t,e)=>_Ze("warning",t,e);function nZt(t){return jl(t.map(e=>SZe(e))).filter(e=>e.problems.length>0)}function xv(t,e=n=>ds(n,t)){return function(n,r){const i=[...r,{kind:"type",type:n.type,name:n.name}],o=e(n)||[],s=Array.isArray(o)?o.map(a=>{const l={kind:"property",name:t},c=[...i,l];return SZe(a,c)}):[[{path:i,problems:[Cn(`Member declaration (${t}) is not an array`)]}]];return[{path:i,problems:n._problems||[]},...jl(s)]}}const rZt=t=>Array.isArray(t)?t:typeof t>"u"&&[]||[t],Exe=xv("fields"),iZt=xv("fields"),oZt=xv("fields"),sZt=xv("of"),aZt=xv("to",t=>"to"in t?rZt(t.to):[]),lZt=xv("marks.annotations"),cZt=xv("of"),uZt=(t,e)=>[...lZt(t,e),...cZt(t,e)];function dZt(t,e=[]){return[{path:[...e,{kind:"type",type:t.type,name:t.name}],problems:t._problems||[]}]}function SZe(t,e=[]){switch(t.type){case"object":return Exe(t,e);case"document":return Exe(t,e);case"array":return sZt(t,e);case"reference":return aZt(t,e);case"block":return uZt(t,e);case"image":return iZt(t,e);case"file":return oZt(t,e);default:return dZt(t,e)}}function PR(t,e=n=>n){const n=t.reduce((r,i)=>{const o=e(i);return r[o]||(r[o]=[]),r[o].push(i),r},{});return Object.keys(n).map(r=>n[r].length>1?n[r]:null).filter(Boolean)}const fZt=t=>t,hZt={name:"type",type:null},pZt=["any","time","date"];function mZt(t=[],e=[],n=fZt){const r=Object.create(null),i=Object.create(null),o=e.map(m=>m.name),s=pZt.concat(o),a=t.map(m=>m&&m.name).filter(Boolean);e.forEach(m=>{r[m.name]=m}),t.forEach((m,g)=>{i[m&&m.name||`__unnamed_${g}`]={}});function l(m){return m==="type"?hZt:r[m]||i[m]||null}const c=Rh(jl(PR(a)));function u(m){return c.includes(m)}function f(){return a.concat(o)}function h(m){return m==="type"||s.includes(m)}const p=m=>(g,y)=>n(g,{visit:p(!1),isRoot:m,getType:l,getTypeNames:f,isReserved:h,isDuplicate:u,index:y});return e.forEach(m=>{Object.assign(r[m.name],p(m))}),t.forEach((m,g)=>{Object.assign(i[m&&m.name||`__unnamed_${g}`],p(!0)(m,g))}),{get(m){const g=i[m]||r[m];if(g)return g;throw new Error(`No such type: ${m}`)},has(m){return m in i||m in r},getTypeNames(){return Object.keys(i)},getTypes(){return this.getTypeNames().map(this.get)},toJSON(){return this.getTypes()}}}const kZe=[{name:"array",jsonType:"array",type:"type"},{name:"block",jsonType:"object",type:"type"},{name:"boolean",jsonType:"boolean",type:"type"},{name:"datetime",jsonType:"string",type:"type"},{name:"date",jsonType:"string",type:"type"},{name:"document",jsonType:"object",type:"type"},{name:"email",jsonType:"string",type:"type"},{name:"file",jsonType:"object",type:"type"},{name:"geopoint",jsonType:"object",type:"type"},{name:"image",jsonType:"object",type:"type"},{name:"number",jsonType:"number",type:"type"},{name:"object",jsonType:"object",type:"type"},{name:"reference",jsonType:"object",type:"type"},{name:"crossDatasetReference",jsonType:"object",type:"type"},{name:"globalDocumentReference",jsonType:"object",type:"type"},{name:"slug",jsonType:"object",type:"type"},{name:"span",jsonType:"object",type:"type"},{name:"string",jsonType:"string",type:"type"},{name:"telephone",jsonType:"string",type:"type"},{name:"text",jsonType:"string",type:"type"},{name:"url",jsonType:"string",type:"type"}],EZe=kZe.map(t=>t.name);function gZt(t,e){return mZt(t,kZe,e)}function bZ(t){return t==="string"||t==="number"||t==="boolean"}function TZe(t,e){if("jsonType"in t)return t.jsonType;const n=e.getType(t.type);if(n)return TZe(n,e)}function yZt(t,e){return(typeof e.name=="string"?e.name:e.type)===t}function HC(t){return`"${t}"`}function Txe(t,e="s"){return t.length===1?"":e}function Ixe(t){return Array.isArray(t)?`array with ${t.length} entries`:typeof t=="object"&&t!==null?`object with keys ${Tp(Object.keys(t).map(HC))}`:HC(t)}var bZt=(t,e)=>{const n=Array.isArray(t.of);if(n){const u=t.of.reduce((f,h,p)=>{if(typeof h.name=="string"&&h.name!==h.type&&EZe.includes(h.name))return f.concat(Cn(`Found array member declaration with the same type name as a built-in type ("${h.name}"). Array members can not be given the same name as a built-in type.`,gr.ARRAY_OF_TYPE_BUILTIN_TYPE_CONFLICT));if(h.type==="object"&&h.name&&e.getType(h.name))return f.concat(Vl(`Found array member declaration with the same name as the global schema type "${h.name}". It's recommended to use a unique name to avoid possibly incompatible data types that shares the same name.`,gr.ARRAY_OF_TYPE_GLOBAL_TYPE_CONFLICT));if(h.type==="array")return f.concat(Cn('Found array member declaration of type "array" - multidimensional arrays are not currently supported by Sanity',gr.ARRAY_OF_ARRAY));if(h)return f;const m=`Found ${h===null?"null":typeof h}, expected member declaration`;return f.concat(Cn(`Found invalid type member declaration in array at index ${p}: ${m}`,gr.ARRAY_OF_INVALID))},[]);if(u.length>0)return{...t,of:[],_problems:u}}const r=jl([n?PR(t.of,u=>`${u.name};${u.type}`).map(u=>Cn(`Found ${u.length} members with same type, but not unique names "${u[0].type}" in array. This makes it impossible to tell their values apart and you should consider naming them`,gr.ARRAY_OF_NOT_UNIQUE)):Cn('The array type is missing or having an invalid value for the required "of" property',gr.ARRAY_OF_INVALID)]),i=n?t.of:[],o=i.some(u=>u.type==="object"&&typeof u.name>"u");i.some(u=>u.type==="block")&&o&&r.push(Cn("The array type's 'of' property can't have an object type without a 'name' property as member, when the 'block' type is also a member of that array.",gr.ARRAY_OF_INVALID));const[s,a]=gR(i,u=>bZ(u.type)||bZ(e.getType(u.type)?.jsonType)),l=s.length>0&&a.length>0;if(l){const u=s.map(h=>h.type),f=a.map(h=>h.type);r.push(Cn(`The array type's 'of' property can't have both object types and primitive types (found primitive type ${Txe(u)} ${Tp(u.map(HC))} and object type${Txe(f)} ${Tp(f.map(HC))})`,gr.ARRAY_OF_INVALID))}if(s.length>1){const u=new Map;for(const f of s){const h=TZe(f,e);if(h&&bZ(h)){const p=u.get(h)||[];p.push(f),u.set(h,p)}}for(const[f,h]of u)if(h.length>1){const p=h.map(m=>m.name||m.type);r.push(Vl(`Array cannot contain multiple members with JSON type "${f}" (${Tp(p.map(HC))}) as there is no way to distinguish between them`,gr.ARRAY_OF_DUPLICATE_PRIMITIVE_JSON_TYPE))}}const c=t?.options?.list;return!l&&Array.isArray(c)&&(s.length>0?c.forEach(u=>{const f=u?.value??u;if(!s.some(h=>typeof f===e.getType(h.type).jsonType)){const h=Tp(s.map(p=>p.name||p.type),{conjunction:"or"});r.push(Cn(`An invalid entry found in options.list: ${Ixe(f)}. Must be either a value of type ${h}, or an object with {title: string, value: ${h}}`,gr.ARRAY_PREDEFINED_CHOICES_INVALID))}}):c.forEach(u=>{const f=u._type||"object";a.some(h=>yZt(f,h))||r.push(Cn(`An invalid entry found in options.list: ${Ixe(u)}. Must be an object with "_type" set to ${Tp(a.map(h=>h.name||h.type).map(h=>h==="object"?"undefined":HC(h)),{conjunction:"or"})}`,gr.ARRAY_PREDEFINED_CHOICES_INVALID))})),t?.options?.list&&t?.options?.layout==="tags"&&r.push(Vl("Found array member declaration with both tags layout and a list of predefined values. If you want to display a list of predefined values, remove the tags layout from `options`.")),{...t,of:i.map((u,f)=>{const h=e.visit(u,f);return u.type&&typeof u.type=="string"&&e.getType(u.type)?.type==="document"?{...h,_problems:[...h._problems||[],Vl(`The type "${u.type}" is a document type and should not be used as a field type directly. Use a "reference" if you want to create a link to the document, or use "object" if you want to embed fields inline.`,gr.FIELD_TYPE_IS_DOCUMENT)]}:h}),_problems:r}};function IZe(t,e,n){if("jsonType"in t)return t.jsonType===e;const r=n.getType(t.type);if(!r)throw new Error(`Could not resolve jsonType of ${t.name}. No parent type found`);return IZe(r,e,n)}const Oh=t=>Array.isArray(t)?"array":typeof t,$R=t=>`"${t}"`,vZt=["components","lists","marks","name","of","options","styles","title","type","validation"],xZt=["decorators","annotations"],CZt=["blockEditor","title","value","icon","component"],wZt=["blockEditor","title","value","icon","component","i18nTitleKey"],_Zt=["title","value","icon","component"],jxe=["file","image","object","reference","crossDatasetReference","globalDocumentReference"];function SZt(t,e){const n=[];let r=t.styles,i=t.lists,o=t.marks,s=t.of;const a=Object.keys(t).filter(l=>!vZt.includes(l)&&!l.startsWith("_"));return a.length>0&&n.push(Cn(`Found unknown properties for block declaration: ${Tp(a.map($R))}`)),o&&(o=kZt(t.marks,e,n)),r&&(r=TZt(r,e,n)),i&&(i=EZt(i,e,n)),s&&(s=AZt(s,e,n)),{...Mf(t,a),marks:o,styles:r,name:t.name||t.type,of:s,_problems:n}}function kZt(t,e,n){let r=t.decorators,i=t.annotations;if(!ea(t))return n.push(Cn(`"marks" declaration should be an object, got ${Oh(t)}`)),n;const o=Object.keys(t).filter(s=>!xZt.includes(s)&&!s.startsWith("_"));return o.length>0&&n.push(Cn(`Found unknown properties for block declaration: ${Tp(o.map($R))}`)),r&&!Array.isArray(r)?n.push(Cn(`"marks.decorators" declaration should be an array, got ${Oh(r)}`)):r&&(r.filter(s=>!!s.blockEditor).forEach(s=>{s.icon=s.blockEditor.icon,s.component=s.blockEditor.render}),r=IZt(r,e,n)),i&&!Array.isArray(i)?n.push(Cn(`"marks.annotations" declaration should be an array, got ${Oh(i)}`)):i&&(i=jZt(i,e,n)),{...t,decorators:r,annotations:i}}function EZt(t,e,n){return Array.isArray(t)?(t.forEach((r,i)=>{if(!ea(r)){n.push(Cn(`List must be an object, got ${Oh(r)}`));return}const o=r.value||`#${i}`,s=Object.keys(r).filter(a=>!_Zt.includes(a)&&!a.startsWith("_"));s.length>0&&n.push(Cn(`Found unknown properties for list ${o}: ${Tp(s.map($R))}`)),r.value?typeof r.value!="string"?n.push(Cn(`List type #${i} has an invalid "value" property, expected string, got ${Oh(r.value)}`)):r.title||n.push(Vl(`List type ${o} is missing recommended "title" property`)):n.push(Cn(`List #${i} is missing required "value" property`))}),t):(n.push(Cn(`"lists" declaration should be an array, got ${Oh(t)}`)),n)}function TZt(t,e,n){return Array.isArray(t)?(t.forEach((r,i)=>{if(!ea(r)){n.push(Cn(`Style must be an object, got ${Oh(r)}`));return}const o=r.value||`#${i}`,s=Object.keys(r).filter(a=>!CZt.includes(a)&&!a.startsWith("_"));s.length>0&&n.push(Cn(`Found unknown properties for style ${o}: ${Tp(s.map($R))}`)),r.value?typeof r.value!="string"?n.push(Cn(`Style #${i} has an invalid "value" property, expected string, got ${Oh(r.value)}`)):r.title||n.push(Vl(`Style ${o} is missing recommended "title" property`)):n.push(Cn(`Style #${i} is missing required "value" property`)),typeof r.blockEditor<"u"&&(n.push(Vl('Style has deprecated key "blockEditor", please refer to the documentation on how to configure the block type for version 3.',gr.DEPRECATED_BLOCKEDITOR_KEY)),r.component=r.component||r.blockEditor.render)}),t):(n.push(Cn(`"styles" declaration should be an array, got ${Oh(t)}`)),n)}function IZt(t,e,n){return t.forEach((r,i)=>{if(!ea(r)){n.push(Cn(`Annotation must be an object, got ${Oh(r)}`));return}const o=r.value||`#${i}`,s=Object.keys(r).filter(a=>!wZt.includes(a)&&!a.startsWith("_"));s.length>0&&n.push(Cn(`Found unknown properties for decorator ${o}: ${Tp(s.map($R))}`)),r.value?typeof r.value!="string"?n.push(Cn(`Decorator #${i} has an invalid "value" property, expected string, got ${Oh(r.value)}`)):r.title||n.push(Vl(`Decorator ${o} is missing recommended "title" property`)):n.push(Cn(`Decorator #${i} is missing required "value" property`)),typeof r.blockEditor<"u"&&(n.push(Vl(`Decorator "${o}" has deprecated key "blockEditor", please refer to the documentation on how to configure the block type for version 3.`,gr.DEPRECATED_BLOCKEDITOR_KEY)),r.icon=r.icon||r.blockEditor.icon,r.component=r.component||r.blockEditor.render)}),t}function jZt(t,e,n){return t.map(r=>{if(!ea(r))return{...r,_problems:[Cn(`Annotation must be an object, got ${Oh(r)}`)]};const{_problems:i}=e.visit(r,e),o=r.type&&e.getType(r.type);return o&&("jsonType"in o||"type"in o)&&!IZe(o,"object",e)&&i.push(Cn(`Annotation cannot have type "${r.type}" - annotation types must inherit from object`)),typeof r.blockEditor<"u"&&(n.push(Vl('Annotation has deprecated key "blockEditor", please refer to the documentation on how to configure the block type for version 3.',gr.DEPRECATED_BLOCKEDITOR_KEY)),r.icon=r.icon||r.blockEditor.icon,r.blockEditor?.render&&!r.components?.annotation&&(r.components=r.components||{},r.components.annotation=r.components.annotation||r.blockEditor.render)),{...r,_problems:i}})}function AZt(t,e,n){if(!Array.isArray(t)){n.push(Cn(`"of" declaration should be an array, got ${Oh(t)}`));return}return t.map(r=>{const{_problems:i}=e.visit(r,e);if(r.type==="object"&&r.name&&e.getType(r.name))return{...r,_problems:[Vl(`Found array member declaration with the same name as the global schema type "${r.name}". It's recommended to use a unique name to avoid possibly incompatible data types that shares the same name.`,gr.ARRAY_OF_TYPE_GLOBAL_TYPE_CONFLICT)]};let o=r;for(;o&&!o.jsonType;)o=e.getType(o.type);const s=EZe.filter(a=>!jxe.includes(a));return o&&o.jsonType!=="object"||s.some(a=>a===r.type)?{...r,_problems:[Cn(`Block member types must be a supported object-like type. The following built-in types are supported: '${jxe.join("', '")}'. You can also use shorthands for previously defined object types like {type: 'myObjectType'}`,gr.ARRAY_OF_TYPE_BUILTIN_TYPE_CONFLICT)]}:{...r,_problems:i}})}function RZt(t,e){if(!("fields"in t))return[];let n=t;for(;n&&!n.jsonType;)n=e.getType(n.type);return n&&n.jsonType!=="object"?[Cn('Type has propery "fields", but is not an object/document type.')]:[]}const DZt=t=>`"${t}"`;function OZt(t,e){const n=e.getTypeNames();if(!t)return[Cn("Type is missing a type.",gr.TYPE_MISSING_TYPE)];if(typeof t!="string")return[Cn('Type has an invalid "type"-property - should be a string.',gr.TYPE_MISSING_TYPE)];if(!n.includes(t)){const r=n.map(o=>[AKt(t,o),o]).filter(([o])=>o<3).map(([o,s])=>s),i=r.length>0?` Did you mean ${Tp(r.map(DZt),{conjunction:"or"})}?`:"";return[Cn(`Unknown type: ${t}.${i}`)]}return[]}function PZt(t){const e=[];return t?.inputComponent&&e.push(Vl('The "inputComponent" property is deprecated. Use "components.input" instead.')),t?.preview?.component&&e.push(Vl('The "preview.component" property is deprecated. Use "components.preview" instead.')),t?.diffComponent&&e.push(Vl('The "diffComponent" property is deprecated. Use "components.diff" instead.')),t?.options?.editModal&&e.push(Vl('The "options.editModal" property is deprecated. Use "options.modal" instead.')),t?.options?.isHighlighted&&e.push(Vl('The "options.isHighlighted" property is deprecated. You can put fields behind a collapsed fieldset if you want to hide them from plain sight.')),e}var $Zt=(t,e)=>({...t,_problems:[...OZt(t.type,e),...RZt(t,e),...PZt(t)].filter(Boolean)});function MZt(t){return Array.isArray(t.to)?t.to:t.to?[t.to]:t.to}const LZt=/^[a-z0-9~][-_a-z0-9]+$/;function FZt(t){return t.length>=2&&t.toLowerCase()===t&&LZt.test(t)||`The provided dataset "${t}" doesn't look like a valid dataset. Dataset names must be more than 2 characters, can only contain lowercase characters, numbers, underscores and dashes and can not start with a dash or an underscore`}var NZt=(t,e)=>{const n=Array.isArray(t.to)||ea(t.to),r=MZt(t),i=jl([n?PR(r,o=>`${o.name};${o.type}`).map(o=>Cn(`Found ${o.length} members with same type, but not unique names "${o[0].type}" in reference. This makes it impossible to tell their values apart and you should consider naming them`,gr.CROSS_DATASET_REFERENCE_INVALID)):Cn('The cross dataset reference type is missing or having an invalid value for the required "to" property. It should be an array of accepted types.',gr.CROSS_DATASET_REFERENCE_INVALID)]);if(n&&r.length===0&&i.push(Cn('The cross dataset reference type should define at least one referenced type. Please check the "to" property.',gr.CROSS_DATASET_REFERENCE_INVALID)),r.forEach((o,s)=>{o.type||i.push(Cn(`The referenced type at index ${s} must be named. Specify the name of the type you want to create references to.`,gr.CROSS_DATASET_REFERENCE_INVALID)),ea(o.preview)||i.push(Cn(`Missing required preview config for the referenced type "${o.type||""}"`,gr.CROSS_DATASET_REFERENCE_INVALID))}),typeof t.dataset=="string"){const o=FZt(t.dataset);o!==!0&&i.push(Cn(o,gr.CROSS_DATASET_REFERENCE_INVALID))}else i.push(Cn("A cross dataset reference must specify a `dataset`",gr.CROSS_DATASET_REFERENCE_INVALID));return t.studioUrl&&typeof t.studioUrl!="function"&&i.push(Cn('The "studioUrl" property on a cross dataset reference must be a function taking "{id, type}" as argument and returning a studio url.',gr.CROSS_DATASET_REFERENCE_INVALID)),i.push(...BZt(t)),{...t,_problems:i}};function BZt(t){const{options:e}=t,n=[];return n.push(...["filter","filterParams"].filter(r=>r in t).map(r=>Cn(`\`${r}\` is not allowed on a reference type definition - did you mean \`options.${r}\`?`,gr.REFERENCE_INVALID_OPTIONS_LOCATION))),e?ea(e)?typeof e.filter=="function"&&typeof e.filterParams<"u"?n.concat(Cn("`filterParams` cannot be used if `filter` is a function. Either statically define `filter` as a string, or return `params` from the `filter`-function.",gr.REFERENCE_INVALID_FILTER_PARAMS_COMBINATION)):typeof e.filter=="function"||!e.filter&&!e.filterParams?n:typeof e.filter!="string"?n.concat(Cn(`If set, \`filter\` must be a string. Got ${typeof e.filter}`)):typeof e.filterParams<"u"&&!ea(e.filterParams)?n.concat(Cn("If set, `filterParams` must be an object.")):e.filterParams?n.concat(Object.keys(e.filterParams).filter(r=>r.startsWith("__")||r.startsWith("$")).map(r=>Cn(`Filter parameter cannot be prefixed with "$" or "__". Got ${r}".`))):n:n.concat(Cn("The reference type expects `options` to be an object",gr.REFERENCE_INVALID_OPTIONS)):n}const VZt=/^Symbol\(react\..+\)$/;function DP(t){return typeof t=="function"||typeof t?.$$typeof=="symbol"&&VZt.test(String(t?.$$typeof))}function jZe(t){const e="components"in t?t.components:!1;if(!e)return[];const n=[];return e.input&&!DP(e.input)&&n.push(Vl(`The \`components.input\` property is set but does not appear to be a valid React component (expected a function, but saw ${zC(e.input)}). If you have imported a custom input component, please verify that you have imported the correct named/default export.`)),e.field&&!DP(e.field)&&n.push(Vl(`The \`components.field\` property is set but does not appear to be a valid React component (expected a function, but saw ${zC(e.field)}). If you have imported a custom field component, please verify that you have imported the correct named/default export.`)),e.item&&!DP(e.item)&&n.push(Vl(`The \`components.item\` property is set but does not appear to be a valid React component (expected a function, but saw ${zC(e.item)}). If you have imported a custom item component, please verify that you have imported the correct named/default export.`)),e.preview&&!DP(e.preview)&&n.push(Vl(`The \`components.preview\` property is set but does not appear to be a valid React component (expected a function, but saw ${zC(e.preview)}). If you have imported a custom preview component, please verify that you have imported the correct named/default export.`)),n}const Axe=/^[A-Za-z]+[0-9A-Za-z_]*$/,zZt=/^[A-Za-z_]+[0-9A-Za-z_]*$/;function HZt(t){return typeof t!="string"?[Cn(`Field names must be strings. Saw "${zC(t)}"`,gr.OBJECT_FIELD_NAME_INVALID)]:t.startsWith("_")?[Cn(`Invalid field name "${t}". Field names cannot start with underscores "_" as it's reserved for system fields.`,gr.OBJECT_FIELD_NAME_INVALID)]:Axe.test(t)?zZt.test(t)?[]:[Vl("Thats an interesting field name for sure! But it is... how to put it... a bit... unconventional? It may be wise to keep special characters out of field names for easier access later on."),gr.OBJECT_FIELD_NAME_INVALID]:[Cn(`Invalid field name: "${t}". Fields can only contain characters from A-Z, numbers and underscores and should not start with a number (must pass the regular expression ${String(Axe)}).`,gr.OBJECT_FIELD_NAME_INVALID)]}function sfe(t,e){if(!ea(t))return[Cn(`Incorrect type for field definition - should be an object, saw ${zC(t)}`,gr.OBJECT_FIELD_DEFINITION_INVALID_TYPE)];const n=[];return n.push(..."name"in t?HZt(t.name):[Cn("Missing field name",gr.OBJECT_FIELD_NAME_INVALID)]),n.push(...jZe(t)),t.type&&typeof t.type=="string"&&e.getType(t.type)?.type==="document"&&n.push(Vl(`The type "${t.type}" is a document type and should not be used as a field type directly. Use a "reference" if you want to create a link to the document, or use "object" if you want to embed fields inline.`,gr.FIELD_TYPE_IS_DOCUMENT)),n}function UZt(t){const e={};return t.forEach(n=>{e[n.name]||(e[n.name]=[]),e[n.name].push(n)}),Object.keys(e).map(n=>e[n].length>1?e[n]:null).filter(Boolean)}function afe(t,e={allowEmpty:!1}){const n=[];if(!Array.isArray(t))return[Cn(`The "fields" property must be an array of fields. Instead saw "${typeof t}"`,gr.OBJECT_FIELDS_INVALID)];const r=t.filter(o=>typeof o.name=="string");UZt(r).forEach(o=>{n.push(Cn(`Found ${o.length} fields with name "${o[0].name}" in object`,gr.OBJECT_FIELD_NOT_UNIQUE))}),t.length===0&&!e.allowEmpty&&n.push(Cn("Object should have at least one field",gr.OBJECT_FIELDS_INVALID));const i=t.filter(o=>o.type==="block").map(o=>`"${o.name}"`);if(i.length>0){const o=i.join(", ");n.push(Cn(`Invalid standalone block field(s) ${o}. Block content must be defined as an array of blocks`,gr.STANDALONE_BLOCK_TYPE))}return n}function WZt(t){return ea(t)?typeof t.prepare<"u"&&typeof t.prepare!="function"?[Cn(`The "preview.prepare" property must be a function, instead saw "${typeof t.prepare}"`)]:t.select?ea(t.select)?Object.keys(t.select).reduce((e,n)=>typeof t.select[n]=="string"?e:e.concat(Cn(`The key "${n}" of "preview.select" must be a string, instead saw "${typeof t.select[n]}"`)),[]):[Cn(`The "preview.select" property must be an object, instead saw "${typeof t.prepare}"`)]:[]:[Cn(`The "preview" property must be an object, instead saw "${typeof t}"`)]}var AZe=(t,e)=>{let n=afe(t.fields),r=t.preview;if(r){const i=WZt(t.preview);n=n.concat(i),r=i.some(o=>o.severity==="error")?{}:r}return t.type!=="document"&&t.type!=="object"&&typeof t.initialValue<"u"&&n.push(Cn('The "initialValue" property is currently only supported for document & object types.')),{...t,preview:r,fields:(Array.isArray(t.fields)?t.fields:[]).map((i,o)=>{const{name:s,...a}=i,{_problems:l,...c}=e.visit(a,o);return{name:s,...c,_problems:sfe(i,e).concat(l||[])}}),_problems:n}},qZt=(t,e)=>{const n=AZe(t,e),{initialValue:r,initialValues:i}=n;return typeof r<"u"&&!ea(r)&&typeof r!="function"&&n._problems.push(Cn('The "initialValue" property must be either a plain object or a function')),typeof i<"u"&&n._problems.push(Cn('Found property "initialValues" - did you mean "initialValue"?')),n},GZt=(t,e)=>{const n=[],r=t.fields;r&&n.push(...afe(r,{allowEmpty:!0}));const i=Array.isArray(r)?r?.filter(o=>o.name==="asset"):[];return t.options&&typeof t.options.metadata<"u"&&!Array.isArray(t.options.metadata)?n.push(Cn("Invalid type for file `metadata` field - must be an array of strings",gr.ASSET_METADATA_FIELD_INVALID)):i.length>0&&n.push(Cn("The name `asset` is not a valid field name for type `file`.")),{...t,fields:(Array.isArray(r)?r:[]).map((o,s)=>{const{name:a,...l}=o,{_problems:c,...u}=e.visit(l,s);return{name:a,...u,_problems:sfe(o,e).concat(c||[])}}),_problems:n}};function YZt(t){return Array.isArray(t.to)?t.to:t.to?[t.to]:[]}function KZt(t){return t?t!="media-library"&&t!="dataset"?'The resource type must be either "media-library" or "dataset"':!0:"The resource type must be a non-empty string"}function XZt(t,e){return e?t==="dataset"?e.split(".").length!==2?'The resource ID for a dataset reference must be on the form "."':!0:t==="media-library"?!0:`Cannot validate resource ID for resource type: ${t}`:"The resource ID must be a non-empty string"}var ZZt=(t,e)=>{const n=Array.isArray(t.to)||ea(t.to),r=YZt(t),i=jl([n?PR(r,o=>`${o.name};${o.type}`).map(o=>Cn(`Found ${o.length} members with same type, but not unique names "${o[0].type}" in reference. This makes it impossible to tell their values apart and you should consider naming them`,gr.GLOBAL_DOCUMENT_REFERENCE_INVALID)):Cn('The global document reference type is missing or having an invalid value for the required "to" property. It should be an array of accepted types.',gr.GLOBAL_DOCUMENT_REFERENCE_INVALID)]);if(n&&r.length===0&&i.push(Cn('The global document reference type should define at least one referenced type. Please check the "to" property.',gr.GLOBAL_DOCUMENT_REFERENCE_INVALID)),r.forEach((o,s)=>{o.type||i.push(Cn(`The referenced type at index ${s} must be named. Specify the name of the type you want to create references to.`,gr.GLOBAL_DOCUMENT_REFERENCE_INVALID)),ea(o.preview)||i.push(Cn(`Missing required preview config for the referenced type "${o.type||""}"`,gr.GLOBAL_DOCUMENT_REFERENCE_INVALID))}),typeof t.resourceType=="string"){const o=KZt(t.resourceType);o!==!0&&i.push(Cn(o,gr.GLOBAL_DOCUMENT_REFERENCE_INVALID))}else i.push(Cn("A global document reference must specify a `resourceType`",gr.GLOBAL_DOCUMENT_REFERENCE_INVALID));if(typeof t.resourceId=="string"){const o=XZt(t.resourceType,t.resourceId);o!==!0&&i.push(Cn(o,gr.GLOBAL_DOCUMENT_REFERENCE_INVALID))}else i.push(Cn("A global document reference must specify a `resourceId`",gr.GLOBAL_DOCUMENT_REFERENCE_INVALID));return t.studioUrl&&typeof t.studioUrl!="function"&&typeof t.studioUrl!="string"&&i.push(Cn('The "studioUrl" property on a global document reference must either be a function taking "{id, type}" as argument and returning a studio url, or a string being the base url pointing to a studio.',gr.GLOBAL_DOCUMENT_REFERENCE_INVALID)),i.push(...QZt(t)),{...t,_problems:i}};function QZt(t){const{options:e}=t,n=[];return n.push(...["filter","filterParams"].filter(r=>r in t).map(r=>Cn(`\`${r}\` is not allowed on a reference type definition - did you mean \`options.${r}\`?`,gr.REFERENCE_INVALID_OPTIONS_LOCATION))),e?ea(e)?typeof e.filter=="function"&&typeof e.filterParams<"u"?n.concat(Cn("`filterParams` cannot be used if `filter` is a function. Either statically define `filter` as a string, or return `params` from the `filter`-function.",gr.REFERENCE_INVALID_FILTER_PARAMS_COMBINATION)):typeof e.filter=="function"||!e.filter&&!e.filterParams?n:typeof e.filter!="string"?n.concat(Cn(`If set, \`filter\` must be a string. Got ${typeof e.filter}`)):typeof e.filterParams<"u"&&!ea(e.filterParams)?n.concat(Cn("If set, `filterParams` must be an object.")):e.filterParams?n.concat(Object.keys(e.filterParams).filter(r=>r.startsWith("__")||r.startsWith("$")).map(r=>Cn(`Filter parameter cannot be prefixed with "$" or "__". Got ${r}".`))):n:n.concat(Cn("The reference type expects `options` to be an object",gr.REFERENCE_INVALID_OPTIONS)):n}const Rxe=["dimensions","hasAlpha","isOpaque"];var JZt=(t,e)=>{const n=[],r=t.fields;r&&n.push(...afe(r,{allowEmpty:!0}));let i=t.options;const o=i?.metadata,s=Array.isArray(o)?o.filter(c=>Rxe.includes(c)):[],a=["asset","hotspot","crop"],l=Array.isArray(r)?r?.filter(c=>a.includes(c.name)):[];return typeof o<"u"&&!Array.isArray(o)?n.push(Cn("Invalid type for image `metadata` field - must be an array of strings",gr.ASSET_METADATA_FIELD_INVALID)):s.length>0?(n.push(Vl(`Image \`metadata\` field contains superfluous properties (they are always included): ${s.join(", ")}`)),i={...i,metadata:o.filter(c=>!Rxe.includes(c))}):l.length>0&&n.push(Cn(`The names \`${a.join("`, `")}\` are invalid field names for type \`image\`.`)),{...t,options:i,fields:(Array.isArray(r)?r:[]).map((c,u)=>{const{name:f,...h}=c,{_problems:p,...m}=e.visit(h,u);return{name:f,...m,_problems:sfe(c,e).concat(p||[])}}),_problems:n}};function eQt(t){return Array.isArray(t.to)?t.to:t.to?[t.to]:t.to}var tQt=(t,e)=>{const n=Array.isArray(t.to)||ea(t.to),r=eQt(t),i=jl([n?PR(r,o=>`${o.name};${o.type}`).map(o=>Cn(`Found ${o.length} members with same type, but not unique names "${o[0].type}" in reference. This makes it impossible to tell their values apart and you should consider naming them`,gr.REFERENCE_TO_INVALID)):Cn('The reference type is missing or having an invalid value for the required "to" property. It should be an array of accepted types.',gr.REFERENCE_TO_INVALID)]);return n&&r.length===0&&i.push(Cn('The reference type should define at least one accepted type. Please check the "to" property.',gr.REFERENCE_TO_INVALID)),i.push(...nQt(t)),{...t,to:(n?r:[]).map(e.visit),_problems:i}};function nQt(t){const{options:e}=t,n=[];return n.push(...["filter","filterParams"].filter(r=>r in t).map(r=>Cn(`\`${r}\` is not allowed on a reference type definition - did you mean \`options.${r}\`?`,gr.REFERENCE_INVALID_OPTIONS_LOCATION))),e?ea(e)?typeof e.filter=="function"&&typeof e.filterParams<"u"?n.concat(Cn("`filterParams` cannot be used if `filter` is a function. Either statically define `filter` as a string, or return `params` from the `filter`-function.",gr.REFERENCE_INVALID_FILTER_PARAMS_COMBINATION)):typeof e.filter=="function"||!e.filter&&!e.filterParams?n:typeof e.filter!="string"?n.concat(Cn(`If set, \`filter\` must be a string. Got ${typeof e.filter}`)):typeof e.filterParams<"u"&&!ea(e.filterParams)?n.concat(Cn("If set, `filterParams` must be an object.")):e.filterParams?n.concat(Object.keys(e.filterParams).filter(r=>r.startsWith("__")||r.startsWith("$")).map(r=>Cn(`Filter parameter cannot be prefixed with "$" or "__". Got ${r}".`))):n:n.concat(Cn("The reference type expects `options` to be an object",gr.REFERENCE_INVALID_OPTIONS)):n}var rQt=(t,e)=>{const n=!!t.name;if(!n&&Object.keys(t).length===1)return{...t,_problems:[Cn("Invalid/undefined type declaration, check declaration or the import/export of the schema type.",gr.TYPE_INVALID)]};const r=[];return iQt(t)?r.push(Cn("Type appears to be an ES6 module imported through CommonJS require - use an import statement or access the `.default` property",gr.TYPE_IS_ESM_MODULE)):n?e.isReserved(t.name)&&r.push(Cn(`Invalid type name: "${t.name}" is a reserved name.`,gr.TYPE_NAME_RESERVED)):r.push(Cn("Missing type name",gr.TYPE_MISSING_NAME)),e.isDuplicate(t.name)&&r.push(Cn(`Invalid type name: A type with name "${t.name}" is already defined in the schema.`)),r.push(...jZe(t)),"title"in t&&typeof t.title!="string"&&r.push(Vl("Type title is not a string.",gr.TYPE_TITLE_INVALID)),{...t,_problems:r}};function iQt(t){return!t.name&&t.default&&(t.default.name||t.default.title)}var oQt=(t,e)=>{const n=[];return t.options&&t.options.slugifyFn&&(n.push(Vl('Heads up! The "slugifyFn" option has been renamed to "slugify".',gr.SLUG_SLUGIFY_FN_RENAMED)),t.options.slugify=t.options.slugifyFn),{...t,_problems:n}};const sQt={array:bZt,object:AZe,slug:oQt,file:GZt,image:JZt,block:SZt,document:qZt,reference:tQt,crossDatasetReference:NZt,globalDocumentReference:ZZt},aQt=t=>e=>({name:``,...e,_problems:[]});function Dxe(...t){return(e,n)=>t.reduce((r,i)=>{const o=i(r,n);return{...o,_problems:r._problems.concat(o._problems)}},{_problems:[],...e})}function lQt(t,{transformTypeVisitors:e=r=>r,transformCommonVisitors:n=r=>r}={}){return gZt(t,(r,i)=>{const o=r&&r.type&&e(sQt)[r.type]||aQt(i),s=n([$Zt]);return i.isRoot?Dxe(rQt,...s,o)(r,i):Dxe(...s,o)(r,i)})}YXe.compile({name:"studio",types:wZe});function Lo(){const t=E.useContext(NV);if(!t)throw new Error("Router: missing context value");return t}function cQt(t){return t.button===0}function uQt(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function lfe(t){const e=H.c(8),{onClick:n,href:r,target:i,replace:o}=t,s=o===void 0?!1:o,{navigateUrl:a}=Lo();let l;e[0]!==r||e[1]!==a||e[2]!==n||e[3]!==s||e[4]!==i?(l=f=>{f.isDefaultPrevented()||r&&(n&&n(f),!(uQt(f)||!cQt(f))&&(i||(f.preventDefault(),a({path:r,replace:s}))))},e[0]=r,e[1]=a,e[2]=n,e[3]=s,e[4]=i,e[5]=l):l=e[5];const c=l;let u;return e[6]!==c?(u={onClick:c},e[6]=c,e[7]=u):u=e[7],u}function n6(t){const e=H.c(13),{intent:n,onClick:r,params:i,replace:o,target:s,searchParams:a}=t,{resolveIntentLink:l}=Lo();let c;e[0]!==n||e[1]!==i||e[2]!==l||e[3]!==a?(c=l(n,i,a),e[0]=n,e[1]=i,e[2]=l,e[3]=a,e[4]=c):c=e[4];const u=c;let f;e[5]!==u||e[6]!==r||e[7]!==o||e[8]!==s?(f={href:u,onClick:r,replace:o,target:s},e[5]=u,e[6]=r,e[7]=o,e[8]=s,e[9]=f):f=e[9];const{onClick:h}=lfe(f);let p;return e[10]!==u||e[11]!==h?(p={onClick:h,href:u},e[10]=u,e[11]=h,e[12]=p):p=e[12],p}const Sd=E.forwardRef(function(t,e){const n=H.c(18);let r,i,o,s,a;n[0]!==t?({intent:r,params:i,target:a,searchParams:s,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5]);let l;n[6]!==r||n[7]!==i||n[8]!==t.onClick||n[9]!==s||n[10]!==a?(l={intent:r,params:i,target:a,onClick:t.onClick,searchParams:s},n[6]=r,n[7]=i,n[8]=t.onClick,n[9]=s,n[10]=a,n[11]=l):l=n[11];const{onClick:c,href:u}=n6(l);let f;return n[12]!==u||n[13]!==c||n[14]!==e||n[15]!==o||n[16]!==a?(f=d.jsx("a",{...o,href:u,onClick:c,ref:e,target:a}),n[12]=u,n[13]=c,n[14]=e,n[15]=o,n[16]=a,n[17]=f):f=n[17],f}),dQt=E.forwardRef(function(t,e){const n=H.c(17);let r,i,o,s,a;n[0]!==t?({onClick:i,href:r,target:a,replace:o,...s}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5]);let l;n[6]!==r||n[7]!==i||n[8]!==o||n[9]!==a?(l={onClick:i,href:r,target:a,replace:o},n[6]=r,n[7]=i,n[8]=o,n[9]=a,n[10]=l):l=n[10];const{onClick:c}=lfe(l);let u;return n[11]!==r||n[12]!==c||n[13]!==e||n[14]!==s||n[15]!==a?(u=d.jsx("a",{...s,onClick:c,href:r,target:a,ref:e}),n[11]=r,n[12]=c,n[13]=e,n[14]=s,n[15]=a,n[16]=u):u=n[16],u}),fQt=/^[a-zA-Z0-9_-]+$/;function hQt(t){if(!t)return null;if(t.startsWith(":")){const e=t.slice(1);if(!fQt.test(e)){const n=t.includes("*")?" Splats are not supported. Consider using child routes instead":"";console.error(new Error(`Warning: Param segments "${t}" includes invalid characters.${n}`))}return{type:"param",name:e}}return{type:"dir",name:t}}function pQt(t){const[e]=t.split("?"),n=e.split("/").map(hQt).filter(Boolean);return{raw:t,segments:n}}function RZe(t){return Array.isArray(t)?t:t?[t]:[]}function Oxe(t){return ea(t)}function vZ(t,e,n){return{type:"error",node:t,missingKeys:e,unmappableStateKeys:n}}function xZ(t,e,n,r){return{type:"ok",node:t,matchedState:e,searchParams:n,child:r}}function DZe(t,e){if(!e)return xZ(t,{},[]);const n=t.scope?e[t.scope]:e,{_searchParams:r=[],...i}=n||{},o=t.route.segments.filter(g=>g.type==="param").map(g=>g.name),s=Oxe(i)?Object.keys(i):[],a=UF(s,o),l=E9(o,a),c=E9(s,a);if(l.length>0)return vZ(t,l,[]);const u=r.map(([g,y])=>[[g],y]),f=Zi(i,a);if(c.length===0)return xZ(t,f,u);const h=RZe((typeof t.children=="function"?t.children(Oxe(i)?i:{}):t.children)||[]);if(c.length>0&&h.length===0)return vZ(t,[],c);const p=Zi(i,c),m=h.map(g=>DZe(g,p)).find(g=>g.type==="ok");return m?xZ(t,f,u,m):vZ(t,[],c)}function OZe(t,e){const n=[...String(t)];let r="";for(let i=0;i0)throw new Error(`Unable to find matching route for state. Could not map the following state key${s.length==1?"":"s"} to a valid url: ${s.map(Pxe).join(", ")}`);const a=n.missingKeys;throw new Error(`Unable to find matching route for state. State object is missing the following key${a.length==1?"":"s"} defined in route: ${a.map(Pxe).join(", ")}`)}const{path:r,searchParams:i}=PZe(n),o=i.length>0?yQt(i):"";return`/${r.join("/")}${o?`?${o}`:""}`}function gQt(t){return`[${t}]`}function yQt(t){return t.flatMap(([e,n])=>n===void 0?[]:[xQt(bQt(e)),vQt(n)].join("=")).join("&")}function bQt(t){const[e,...n]=t;return n.length>0?[e,...n.map(gQt)].join(""):e}function vQt(t){return OZe(t,"/")}function xQt(t){return OZe(t,"[]")}function PZe(t){const e=t.matchedState,n=t.node.route.segments.map(o=>{if(o.type==="dir")return o.name;const s=t.node.transform&&t.node.transform[o.name];return s?s.toPath(e[o.name]):e[o.name]}),r=t.child?PZe(t.child):void 0,i=r?.searchParams?[...t.searchParams,...r.searchParams]:t.searchParams;return{searchParams:CQt(t.node,i),path:[...n||[],...r?.path||[]]}}function CQt(t,e){const n=t.scope;return n&&!t.__unsafe_disableScopedSearchParams?e.map(([r,i])=>[[n,...r],i]):e}function Pxe(t){return`"${t}"`}function wQt(t){return t.map(([e,n])=>[_Qt(e),n])}const CZ=1,$xe=0;function _Qt(t){const e=[];let n=0,r=$xe;for(;nn&&(e.push(t.slice(n,i)),n=i);const o=t.indexOf("]",i);if(o===-1){if(r===CZ)throw new Error("Unclosed bracket");break}r=$xe,e.push(t.slice(n+1,o)),n=o+1}return e}function $Ze(t,e,n){const r=e.split("/").filter(Boolean),i=t.route.segments.length;if(r.length{if(h.type==="dir")return h.name===r[p];const m=t.transform&&t.transform[h.name];return o[h.name]=m?m.toState(r[p]):r[p],!0}))return null;const s=r.slice(i);let a=null;const l=typeof t.children=="function"?RZe(t.children(o)):t.children,c=kQt(t.scope,n);if(l.some(h=>{if(h){const p=h.scope?c.filter(([m])=>h.scope===m[0]):c;return a=$Ze(h,s.join("/"),p),a}}),s.length>0&&!a)return null;const u=c.flatMap(([h,p])=>h.length===1?[[h[0],p]]:[]),f={...o,...a===null?{}:a,...u.length>0?{_searchParams:u}:{}};return t.scope?{[t.scope]:f}:f}function SQt(t,e){_oe("resolving state from path %s",e);const[n,r]=e.split("?"),i=Array.from(new URLSearchParams(r).entries()),o=$Ze(t,n,wQt(i));return _oe("resolved: %o",o||null),o||null}function kQt(t,e){return t?e.map(([n,r])=>[n[0]===t?n.slice(1):n,r]):e}function EQt(t){return jQt(t).replace(/\//g,"_").replace(/\+/g,"-").replace(/[=]+$/,"")}function TQt(t){return RQt(t.replace(/-/g,"+").replace(/_/g,"/"))}function IQt(t){return String.fromCharCode(parseInt(t.slice(1),16))}function jQt(t){return btoa(encodeURIComponent(t).replace(/%[0-9A-F]{2}/g,IQt))}function AQt(t){return`%${`00${t.charCodeAt(0).toString(16)}`.slice(-2)}`}function RQt(t){return decodeURIComponent(Array.from(atob(t),AQt).join(""))}function MZe(t=""){const e=decodeURIComponent(t);if(!e)return{};try{return JSON.parse(TQt(e))}catch{}try{return JSON.parse(atob(e))}catch{}try{return JSON.parse(e)}catch{console.warn("Failed to parse JSON parameters")}return{}}function tH(t){return t?EQt(JSON.stringify(t)):""}function DQt(t){return t.split(";").reduce((e,n)=>{const[r,i]=n.split("=");return e[decodeURIComponent(r)]=decodeURIComponent(i),e},{})}function OQt(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join(";")}const El={create:(t,e,n)=>Nxe(Lxe(t,e,n)),intents:t=>{const e=$Qt(t).join("/");return El.create(`${e}/:intent`,[El.create(":params",{transform:{params:{toState:DQt,toPath:OQt}}},[El.create(":payload",{transform:{payload:{toState:MZe,toPath:tH}}})])])},scope(t,e,n,r){const i=Lxe(e,n,r);return Nxe({...i,scope:t})}};function Mxe(t){return Array.isArray(t)||typeof t=="function"?t:t?[t]:[]}function PQt(t){return t&&"_isRoute"in t}function Lxe(t,e,n){return typeof t=="object"?t:Array.isArray(e)||typeof e=="function"||PQt(e)?{path:t,children:Mxe(e)}:n?{path:t,...e,children:Mxe(n)}:{path:t,...e}}function $Qt(...t){return t.reduce((e,n)=>e.concat(n.split("/")),[]).filter(Boolean)}const MQt={};function Fxe(t){return t.split("/").every(e=>!e)}function Nxe(t){const{path:e,scope:n,transform:r,children:i,__unsafe_disableScopedSearchParams:o}=t;if(!e)throw new TypeError("Missing path");const s=pQt(e);return{_isRoute:!0,scope:n,__unsafe_disableScopedSearchParams:o,route:s,children:i||[],transform:r,encode(a){return mQt(this,a)},decode(a){return SQt(this,a)},isRoot:Fxe,isNotFound(a){return this.decode(a)===null},getBasePath(){return this.encode(MQt)},getRedirectBase(a){if(Fxe(a)){const l=this.getBasePath();if(a!==l)return l}return null}}}const IS=["perspective","excludedPerspectives","displayInlineChanges"],Pj=t=>{if(typeof t!="object"||t===null||Array.isArray(t)||!("replace"in t||"stickyParams"in t||"state"in t))return!1;if("state"in t){const{state:e}=t;return e==null||typeof e=="object"}return!0};function LQt(t){const e=H.c(44),{onNavigate:n,router:r,state:i}=t;let o;e[0]!==r||e[1]!==i._searchParams?(o=(S,k,I)=>{const[j,A]=Array.isArray(k)?k:[k];return r.encode({intent:S,params:j,payload:A,_searchParams:AGe({...Qie((i._searchParams??[]).filter(BQt)),...Qie(I??[])})})},e[0]=r,e[1]=i._searchParams,e[2]=o):o=e[2];const s=o;let a;e[3]!==r||e[4]!==i._searchParams?(a=S=>{const k=i._searchParams||[],I=S?._searchParams||[],j=IS.reduce((A,D)=>VQt(A,D,Bxe(I,D)??Bxe(k,D)),I||[]);return r.encode({...S,_searchParams:j})},e[3]=r,e[4]=i._searchParams,e[5]=a):a=e[5];const l=a;let c;e[6]!==n||e[7]!==l||e[8]!==i?(c=(S,k)=>{const I=Pj(S)&&!k?S:k||{},j=Pj(S)?HQt(S,i)??i:S,A=i._searchParams||[],D=I.stickyParams??Object.fromEntries(A.filter(NQt));UQt(D);const O=j._searchParams||[],P=zQt(O,D);n({path:l({...j,_searchParams:P}),replace:I.replace})},e[6]=n,e[7]=l,e[8]=i,e[9]=c):c=e[9];const u=c;let f;e[10]!==u?(f=(S,k)=>u({stickyParams:S,...k===void 0?{}:k,state:void 0}),e[10]=u,e[11]=f):f=e[11];const h=f;let p;e[12]!==n||e[13]!==s?(p=(S,k,I)=>{const j=I===void 0?{}:I;n({path:s(S,k),replace:j.replace})},e[12]=n,e[13]=s,e[14]=p):p=e[14];const m=p;let g;e:{if(!i._searchParams){let P;e[15]!==i?(P=[i,null],e[15]=i,e[16]=P):P=e[16],g=P;break e}let S,k;e[17]!==i?({_searchParams:S,...k}=i,e[17]=i,e[18]=S,e[19]=k):(S=e[18],k=e[19]);let I;e[20]!==S?(I=gR(S,FQt),e[20]=S,e[21]=I):I=e[21];const[j,A]=I;if(j.length===0){let P;e[22]!==i?(P=[i,null],e[22]=i,e[23]=P):P=e[23],g=P;break e}let D;e[24]!==k||e[25]!==A?(D={...k,_searchParams:A},e[24]=k,e[25]=A,e[26]=D):D=e[26];let O;e[27]!==j||e[28]!==D?(O=[D,j],e[27]=j,e[28]=D,e[29]=O):O=e[29],g=O}const[y,b]=g;let v;e[30]!==b?(v=Object.fromEntries(b||[]),e[30]=b,e[31]=v):v=e[31];const x=v;let C;e[32]!==h||e[33]!==u||e[34]!==m||e[35]!==n||e[36]!==s||e[37]!==l||e[38]!==y||e[39]!==x?(C={navigate:u,navigateIntent:m,navigateStickyParams:h,navigateUrl:n,resolveIntentLink:s,resolvePathFromState:l,state:y,stickyParams:x},e[32]=h,e[33]=u,e[34]=m,e[35]=n,e[36]=s,e[37]=l,e[38]=y,e[39]=x,e[40]=C):C=e[40];const w=C;let _;return e[41]!==t.children||e[42]!==w?(_=d.jsx(NV.Provider,{value:w,children:t.children}),e[41]=t.children,e[42]=w,e[43]=_):_=e[43],_}function FQt(t){const[e]=t;return IS.includes(e)}function NQt(t){const[e]=t;return IS.includes(e)}function BQt(t){const[e]=t;return IS.includes(e)}function VQt(t,e,n){const r=t.filter(([i])=>i!==e);return n===void 0||n==""?r:[...r,[e,n]]}function zQt(t,e){if(!e)return t;const n=t.filter(([s])=>!Object.hasOwn(e,s)),r=s=>s[1]!==void 0,i=s=>[s[0],s[1]===null?"":s[1]],o=Object.entries(e).filter(r).map(i);return[...n,...o]}function Bxe(t,e){const n=t.find(([r])=>r===e);return n?n[1]:void 0}function HQt(t,e){return Pj(t)?t.state===null?{}:t.state??e:null}function UQt(t){if(Object.keys(t).some(e=>!IS.includes(e)))throw new Error("One or more parameters are not sticky")}function WQt(t,e,n){return n&&{...t,[e]:n}}const LZe=function(t){const e=H.c(24),{children:n,scope:r,__unsafe_disableScopedSearchParams:i}=t,o=Lo(),{resolvePathFromState:s,navigate:a}=o,l=E.useRef(o.state);let c,u;e[0]!==o.state?(c=()=>{l.current=o.state},u=[o.state],e[0]=o.state,e[1]=c,e[2]=u):(c=e[1],u=e[2]),E.useEffect(c,u);let f;e[3]!==i||e[4]!==r?(f=_=>{if(_===null)return null;const{_searchParams:S,...k}=_||{},I=WQt(l.current,r,k);return i?I._searchParams=S:I[r]._searchParams=S,I},e[3]=i,e[4]=r,e[5]=f):f=e[5];const h=f;let p;e[6]!==s||e[7]!==h?(p=_=>s(h(_)),e[6]=s,e[7]=h,e[8]=p):p=e[8];const m=p;let g;e[9]!==a||e[10]!==h?(g=(_,S)=>{if(Pj(_)&&!S){const I=_,{state:j}=I;if(j){const A=h(j);return a(A===null?{}:A,I)}return a(I)}const k=Pj(_)?h(null):h(_);return a(k===null?{}:k,S||{})},e[9]=a,e[10]=h,e[11]=g):g=e[11];const y=g,b=o.state;let v;e[12]!==i||e[13]!==b||e[14]!==r?(v=typeof b[r]=="object"?{...b[r]}:{},i&&(v._searchParams=b._searchParams),e[12]=i,e[13]=b,e[14]=r,e[15]=v):v=e[15];let x;e[16]!==v||e[17]!==y||e[18]!==o||e[19]!==m?(x={...o,navigate:y,resolvePathFromState:m,state:v},e[16]=v,e[17]=y,e[18]=o,e[19]=m,e[20]=x):x=e[20];const C=x;let w;return e[21]!==C||e[22]!==n?(w=d.jsx(NV.Provider,{value:C,children:n}),e[21]=C,e[22]=n,e[23]=w):w=e[23],w};LZe.displayName="RouteScope";const Vxe={};function cfe(t){const e=H.c(11),{onClick:n,replace:r,state:i,target:o,toIndex:s}=t,a=s===void 0?!1:s;if(i&&a)throw new Error("Passing both `state` and `toIndex={true}` as props to StateLink is invalid");!i&&!a&&console.error(new Error("No state passed to StateLink. If you want to link to an empty state, its better to use the the `toIndex` property"));const{resolvePathFromState:l}=Lo(),c=a?Vxe:i||Vxe;let u;e[0]!==l||e[1]!==c?(u=l(c),e[0]=l,e[1]=c,e[2]=u):u=e[2];const f=u;let h;e[3]!==f||e[4]!==n||e[5]!==r||e[6]!==o?(h={href:f,onClick:n,replace:r,target:o},e[3]=f,e[4]=n,e[5]=r,e[6]=o,e[7]=h):h=e[7];const{onClick:p}=lfe(h);let m;return e[8]!==f||e[9]!==p?(m={onClick:p,href:f},e[8]=f,e[9]=p,e[10]=m):m=e[10],m}const nH=E.forwardRef(function(t,e){const n=H.c(18);let r,i,o,s,a,l;n[0]!==t?({onClick:r,replace:i,state:s,target:l,toIndex:a,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6]);const c=a===void 0?!1:a;let u;n[7]!==r||n[8]!==i||n[9]!==s||n[10]!==l||n[11]!==c?(u={onClick:r,replace:i,state:s,target:l,toIndex:c},n[7]=r,n[8]=i,n[9]=s,n[10]=l,n[11]=c,n[12]=u):u=n[12];const{onClick:f,href:h}=cfe(u);let p;return n[13]!==h||n[14]!==f||n[15]!==e||n[16]!==o?(p=d.jsx("a",{...o,href:h,onClick:f,ref:e}),n[13]=h,n[14]=f,n[15]=e,n[16]=o,n[17]=p):p=n[17],p});function ry(t){const e=H.c(3),n=t===void 0?Vg:t,{state:r}=Lo();let i;return e[0]!==n||e[1]!==r?(i=n(r),e[0]=n,e[1]=r,e[2]=i):i=e[2],i}var wZ,zxe;function qQt(){if(zxe)return wZ;zxe=1,wZ=t;function t(i,o,s){var a=i===null,l=o===null;if(a!==l)return!1;var c=Array.isArray(i),u=Array.isArray(o);if(c!==u)return!1;var f=typeof i,h=typeof o;return f!==h?!1:r(f)?s?s(i,o):i===o:c?e(i,o,s):n(i,o,s)}function e(i,o,s){var a=i.length;if(a!==o.length)return!1;if(s){for(var l=0;l{let t;return()=>{if(t)return t;t=[];for(let e=0;e<256;++e)t[e]=(e+256).toString(16).slice(1);return t}})();function QQt(t=16){const e=new Uint8Array(t);return crypto.getRandomValues(e),e}function MR(t){const e=ZQt();return QQt(t).reduce((n,r)=>n+e[r],"").slice(0,t)}const JQt=Object.prototype.toString;function eJt(t){switch(JQt.call(t)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}if(typeof t=="object"&&t&&typeof t.length=="number")try{if(typeof t.callee=="function")return"arguments"}catch(e){if(e instanceof TypeError)return"arguments"}return t===null?"null":t===void 0?"undefined":t&&t.nodeType===1?"element":t===Object(t)?"object":typeof t}function V1(t){const e=eJt(t);if(e!=="object")return e;const n=t;return"_type"in n&&n._type||e}function tJt(){for(var t=arguments.length,e=new Array(t),n=0;nr=>{e.forEach(i=>i(r))},e)}const rH=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function jS(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function dfe(t){return"nodeType"in t}function z2(t){var e,n;return t?jS(t)?t:dfe(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function ffe(t){const{Document:e}=z2(t);return t instanceof e}function LR(t){return jS(t)?!1:t instanceof z2(t).HTMLElement}function NZe(t){return t instanceof z2(t).SVGElement}function AS(t){return t?jS(t)?t.document:dfe(t)?ffe(t)?t:LR(t)||NZe(t)?t.ownerDocument:document:document:document}const _g=rH?E.useLayoutEffect:E.useEffect;function hfe(t){const e=E.useRef(t);return _g(()=>{e.current=t}),E.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{t.current=setInterval(r,i)},[]),n=E.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function $j(t,e){e===void 0&&(e=[t]);const n=E.useRef(t);return _g(()=>{n.current!==t&&(n.current=t)},e),n}function FR(t,e){const n=E.useRef();return E.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function lN(t){const e=hfe(t),n=E.useRef(null),r=E.useCallback(i=>{i!==n.current&&e?.(i,n.current),n.current=i},[]);return[n,r]}function Soe(t){const e=E.useRef();return E.useEffect(()=>{e.current=t},[t]),e.current}let _Z={};function NR(t,e){return E.useMemo(()=>{if(e)return e;const n=_Z[t]==null?0:_Z[t]+1;return _Z[t]=n,t+"-"+n},[t,e])}function BZe(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const a=Object.entries(s);for(const[l,c]of a){const u=o[l];u!=null&&(o[l]=u+t*c)}return o},{...e})}}const yw=BZe(1),Mj=BZe(-1);function rJt(t){return"clientX"in t&&"clientY"in t}function pfe(t){if(!t)return!1;const{KeyboardEvent:e}=z2(t.target);return e&&t instanceof e}function iJt(t){if(!t)return!1;const{TouchEvent:e}=z2(t.target);return e&&t instanceof e}function koe(t){if(iJt(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return rJt(t)?{x:t.clientX,y:t.clientY}:null}const Lj=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[Lj.Translate.toString(t),Lj.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),Hxe="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function oJt(t){return t.matches(Hxe)?t:t.querySelector(Hxe)}const sJt={display:"none"};function aJt(t){let{id:e,value:n}=t;return vt.createElement("div",{id:e,style:sJt},n)}function lJt(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return vt.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function cJt(){const[t,e]=E.useState("");return{announce:E.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const VZe=E.createContext(null);function uJt(t){const e=E.useContext(VZe);E.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function dJt(){const[t]=E.useState(()=>new Set),e=E.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[E.useCallback(r=>{let{type:i,event:o}=r;t.forEach(s=>{var a;return(a=s[i])==null?void 0:a.call(s,o)})},[t]),e]}const fJt={draggable:` + To pick up a draggable item, press the space bar. + While dragging, use the arrow keys to move the item. + Press space again to drop the item in its new position, or press escape to cancel. + `},hJt={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function pJt(t){let{announcements:e=hJt,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=fJt}=t;const{announce:o,announcement:s}=cJt(),a=NR("DndLiveRegion"),[l,c]=E.useState(!1);if(E.useEffect(()=>{c(!0)},[]),uJt(E.useMemo(()=>({onDragStart(f){let{active:h}=f;o(e.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;e.onDragMove&&o(e.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;o(e.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;o(e.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;o(e.onDragCancel({active:h,over:p}))}}),[o,e])),!l)return null;const u=vt.createElement(vt.Fragment,null,vt.createElement(aJt,{id:r,value:i.draggable}),vt.createElement(lJt,{id:a,announcement:s}));return n?r0.createPortal(u,n):u}var dd;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(dd||(dd={}));function cN(){}function Uxe(t,e){return E.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function mJt(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(r=>r!=null),[...e])}const R0=Object.freeze({x:0,y:0});function zZe(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function HZe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function gJt(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function Wxe(t){let{left:e,top:n,height:r,width:i}=t;return[{x:e,y:n},{x:e+i,y:n},{x:e,y:n+r},{x:e+i,y:n+r}]}function UZe(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function qxe(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const yJt=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=qxe(e,e.left,e.top),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=zZe(qxe(l),i);o.push({id:a,data:{droppableContainer:s,value:c}})}}return o.sort(HZe)},bJt=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=Wxe(e),o=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=Wxe(l),u=i.reduce((h,p,m)=>h+zZe(c[m],p),0),f=Number((u/4).toFixed(4));o.push({id:a,data:{droppableContainer:s,value:f}})}}return o.sort(HZe)};function vJt(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),i=Math.min(e.left+e.width,t.left+t.width),o=Math.min(e.top+e.height,t.top+t.height),s=i-r,a=o-n;if(r{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=[];for(const o of r){const{id:s}=o,a=n.get(s);if(a){const l=vJt(a,e);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(gJt)};function CJt(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function WZe(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:R0}function wJt(t){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...s,top:s.top+t*a.y,bottom:s.bottom+t*a.y,left:s.left+t*a.x,right:s.right+t*a.x}),{...n})}}const _Jt=wJt(1);function SJt(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function kJt(t,e,n){const r=SJt(e);if(!r)return t;const{scaleX:i,scaleY:o,x:s,y:a}=r,l=t.left-s-(1-i)*parseFloat(n),c=t.top-a-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=i?t.width/i:t.width,f=o?t.height/o:t.height;return{width:u,height:f,top:c,right:l+u,bottom:c+f,left:l}}const EJt={ignoreTransform:!1};function RS(t,e){e===void 0&&(e=EJt);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:u}=z2(t).getComputedStyle(t);c&&(n=kJt(n,c,u))}const{top:r,left:i,width:o,height:s,bottom:a,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:a,right:l}}function Gxe(t){return RS(t,{ignoreTransform:!0})}function TJt(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function IJt(t,e){return e===void 0&&(e=z2(t).getComputedStyle(t)),e.position==="fixed"}function jJt(t,e){e===void 0&&(e=z2(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=e[i];return typeof o=="string"?n.test(o):!1})}function iH(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(ffe(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!LR(i)||NZe(i)||n.includes(i))return n;const o=z2(t).getComputedStyle(i);return i!==t&&jJt(i,o)&&n.push(i),IJt(i,o)?n:r(i.parentNode)}return t?r(t):n}function qZe(t){const[e]=iH(t,1);return e??null}function SZ(t){return!rH||!t?null:jS(t)?t:dfe(t)?ffe(t)||t===AS(t).scrollingElement?window:LR(t)?t:null:null}function GZe(t){return jS(t)?t.scrollX:t.scrollLeft}function YZe(t){return jS(t)?t.scrollY:t.scrollTop}function Eoe(t){return{x:GZe(t),y:YZe(t)}}var Ld;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Ld||(Ld={}));function KZe(t){return!rH||!t?!1:t===document.scrollingElement}function XZe(t){const e={x:0,y:0},n=KZe(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},i=t.scrollTop<=e.y,o=t.scrollLeft<=e.x,s=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:a,maxScroll:r,minScroll:e}}const AJt={x:.2,y:.2};function RJt(t,e,n,r,i){let{top:o,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=AJt);const{isTop:c,isBottom:u,isLeft:f,isRight:h}=XZe(t),p={x:0,y:0},m={x:0,y:0},g={height:e.height*i.y,width:e.width*i.x};return!c&&o<=e.top+g.height?(p.y=Ld.Backward,m.y=r*Math.abs((e.top+g.height-o)/g.height)):!u&&l>=e.bottom-g.height&&(p.y=Ld.Forward,m.y=r*Math.abs((e.bottom-g.height-l)/g.height)),!h&&a>=e.right-g.width?(p.x=Ld.Forward,m.x=r*Math.abs((e.right-g.width-a)/g.width)):!f&&s<=e.left+g.width&&(p.x=Ld.Backward,m.x=r*Math.abs((e.left+g.width-s)/g.width)),{direction:p,speed:m}}function DJt(t){if(t===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:e,left:n,right:r,bottom:i}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:i,width:t.clientWidth,height:t.clientHeight}}function ZZe(t){return t.reduce((e,n)=>yw(e,Eoe(n)),R0)}function OJt(t){return t.reduce((e,n)=>e+GZe(n),0)}function PJt(t){return t.reduce((e,n)=>e+YZe(n),0)}function $Jt(t,e){if(e===void 0&&(e=RS),!t)return;const{top:n,left:r,bottom:i,right:o}=e(t);qZe(t)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const MJt=[["x",["left","right"],OJt],["y",["top","bottom"],PJt]];class mfe{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=iH(n),i=ZZe(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[o,s,a]of MJt)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=i[o]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class II{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var i;(i=this.target)==null||i.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function LJt(t){const{EventTarget:e}=z2(t);return t instanceof e?t:AS(t)}function kZ(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var _p;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(_p||(_p={}));function Yxe(t){t.preventDefault()}function FJt(t){t.stopPropagation()}var hs;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(hs||(hs={}));const QZe={start:[hs.Space,hs.Enter],cancel:[hs.Esc],end:[hs.Space,hs.Enter,hs.Tab]},NJt=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case hs.Right:return{...n,x:n.x+25};case hs.Left:return{...n,x:n.x-25};case hs.Down:return{...n,y:n.y+25};case hs.Up:return{...n,y:n.y-25}}};class gfe{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new II(AS(n)),this.windowListeners=new II(z2(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(_p.Resize,this.handleCancel),this.windowListeners.add(_p.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(_p.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&$Jt(r),n(R0)}handleKeyDown(e){if(pfe(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=QZe,coordinateGetter:s=NJt,scrollBehavior:a="smooth"}=i,{code:l}=e;if(o.end.includes(l)){this.handleEnd(e);return}if(o.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:R0;this.referenceCoordinates||(this.referenceCoordinates=u);const f=s(e,{active:n,context:r.current,currentCoordinates:u});if(f){const h=Mj(f,u),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const y=e.code,{isTop:b,isRight:v,isLeft:x,isBottom:C,maxScroll:w,minScroll:_}=XZe(g),S=DJt(g),k={x:Math.min(y===hs.Right?S.right-S.width/2:S.right,Math.max(y===hs.Right?S.left:S.left+S.width/2,f.x)),y:Math.min(y===hs.Down?S.bottom-S.height/2:S.bottom,Math.max(y===hs.Down?S.top:S.top+S.height/2,f.y))},I=y===hs.Right&&!v||y===hs.Left&&!x,j=y===hs.Down&&!C||y===hs.Up&&!b;if(I&&k.x!==f.x){const A=g.scrollLeft+h.x,D=y===hs.Right&&A<=w.x||y===hs.Left&&A>=_.x;if(D&&!h.y){g.scrollTo({left:A,behavior:a});return}D?p.x=g.scrollLeft-A:p.x=y===hs.Right?g.scrollLeft-w.x:g.scrollLeft-_.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}else if(j&&k.y!==f.y){const A=g.scrollTop+h.y,D=y===hs.Down&&A<=w.y||y===hs.Up&&A>=_.y;if(D&&!h.x){g.scrollTo({top:A,behavior:a});return}D?p.y=g.scrollTop-A:p.y=y===hs.Down?g.scrollTop-w.y:g.scrollTop-_.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,yw(Mj(f,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}gfe.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=QZe,onActivation:i}=e,{active:o}=n;const{code:s}=t.nativeEvent;if(r.start.includes(s)){const a=o.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),i?.({event:t.nativeEvent}),!0)}return!1}}];function Kxe(t){return!!(t&&"distance"in t)}function Xxe(t){return!!(t&&"delay"in t)}class yfe{constructor(e,n,r){var i;r===void 0&&(r=LJt(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:o}=e,{target:s}=o;this.props=e,this.events=n,this.document=AS(s),this.documentListeners=new II(this.document),this.listeners=new II(r),this.windowListeners=new II(z2(s)),this.initialCoordinates=(i=koe(o))!=null?i:R0,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(_p.Resize,this.handleCancel),this.windowListeners.add(_p.DragStart,Yxe),this.windowListeners.add(_p.VisibilityChange,this.handleCancel),this.windowListeners.add(_p.ContextMenu,Yxe),this.documentListeners.add(_p.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Xxe(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Kxe(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:i}=this.props;i(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(_p.Click,FJt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(_p.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!i)return;const l=(n=koe(e))!=null?n:R0,c=Mj(i,l);if(!r&&a){if(Kxe(a)){if(a.tolerance!=null&&kZ(c,a.tolerance))return this.handleCancel();if(kZ(c,a.distance))return this.handleStart()}if(Xxe(a)&&kZ(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}e.cancelable&&e.preventDefault(),s(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===hs.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const BJt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class bfe extends yfe{constructor(e){const{event:n}=e,r=AS(n.target);super(e,BJt,r)}}bfe.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const VJt={move:{name:"mousemove"},end:{name:"mouseup"}};var Toe;(function(t){t[t.RightClick=2]="RightClick"})(Toe||(Toe={}));class zJt extends yfe{constructor(e){super(e,VJt,AS(e.event.target))}}zJt.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===Toe.RightClick?!1:(r?.({event:n}),!0)}}];const EZ={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class HJt extends yfe{constructor(e){super(e,EZ)}static setup(){return window.addEventListener(EZ.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(EZ.move.name,e)};function e(){}}}HJt.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var jI;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(jI||(jI={}));var uN;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(uN||(uN={}));function UJt(t){let{acceleration:e,activator:n=jI.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:a=uN.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:f,threshold:h}=t;const p=qJt({delta:f,disabled:!o}),[m,g]=nJt(),y=E.useRef({x:0,y:0}),b=E.useRef({x:0,y:0}),v=E.useMemo(()=>{switch(n){case jI.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case jI.DraggableRect:return i}},[n,i,l]),x=E.useRef(null),C=E.useCallback(()=>{const _=x.current;if(!_)return;const S=y.current.x*b.current.x,k=y.current.y*b.current.y;_.scrollBy(S,k)},[]),w=E.useMemo(()=>a===uN.TreeOrder?[...c].reverse():c,[a,c]);E.useEffect(()=>{if(!o||!c.length||!v){g();return}for(const _ of w){if(r?.(_)===!1)continue;const S=c.indexOf(_),k=u[S];if(!k)continue;const{direction:I,speed:j}=RJt(_,k,v,e,h);for(const A of["x","y"])p[A][I[A]]||(j[A]=0,I[A]=0);if(j.x>0||j.y>0){g(),x.current=_,m(C,s),y.current=j,b.current=I;return}}y.current={x:0,y:0},b.current={x:0,y:0},g()},[e,C,r,g,o,s,JSON.stringify(v),JSON.stringify(p),m,c,w,u,JSON.stringify(h)])}const WJt={x:{[Ld.Backward]:!1,[Ld.Forward]:!1},y:{[Ld.Backward]:!1,[Ld.Forward]:!1}};function qJt(t){let{delta:e,disabled:n}=t;const r=Soe(e);return FR(i=>{if(n||!r||!i)return WJt;const o={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Ld.Backward]:i.x[Ld.Backward]||o.x===-1,[Ld.Forward]:i.x[Ld.Forward]||o.x===1},y:{[Ld.Backward]:i.y[Ld.Backward]||o.y===-1,[Ld.Forward]:i.y[Ld.Forward]||o.y===1}}},[n,e,r])}function GJt(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return FR(i=>{var o;return e==null?null:(o=r??i)!=null?o:null},[r,e])}function YJt(t,e){return E.useMemo(()=>t.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:e(s.handler,r)}));return[...n,...o]},[]),[t,e])}var Fj;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Fj||(Fj={}));var Ioe;(function(t){t.Optimized="optimized"})(Ioe||(Ioe={}));const Zxe=new Map;function KJt(t,e){let{dragging:n,dependencies:r,config:i}=e;const[o,s]=E.useState(null),{frequency:a,measure:l,strategy:c}=i,u=E.useRef(t),f=y(),h=$j(f),p=E.useCallback(function(b){b===void 0&&(b=[]),!h.current&&s(v=>v===null?b:v.concat(b.filter(x=>!v.includes(x))))},[h]),m=E.useRef(null),g=FR(b=>{if(f&&!n)return Zxe;if(!b||b===Zxe||u.current!==t||o!=null){const v=new Map;for(let x of t){if(!x)continue;if(o&&o.length>0&&!o.includes(x.id)&&x.rect.current){v.set(x.id,x.rect.current);continue}const C=x.node.current,w=C?new mfe(l(C),C):null;x.rect.current=w,w&&v.set(x.id,w)}return v}return b},[t,o,n,f,l]);return E.useEffect(()=>{u.current=t},[t]),E.useEffect(()=>{f||p()},[n,f]),E.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),E.useEffect(()=>{f||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},a))},[a,f,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:o!=null};function y(){switch(c){case Fj.Always:return!1;case Fj.BeforeDragging:return n;default:return!n}}}function JZe(t,e){return FR(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function XJt(t,e){return JZe(t,e)}function ZJt(t){let{callback:e,disabled:n}=t;const r=hfe(e),i=E.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return E.useEffect(()=>()=>i?.disconnect(),[i]),i}function oH(t){let{callback:e,disabled:n}=t;const r=hfe(e),i=E.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return E.useEffect(()=>()=>i?.disconnect(),[i]),i}function QJt(t){return new mfe(RS(t),t)}function Qxe(t,e,n){e===void 0&&(e=QJt);const[r,i]=E.useState(null);function o(){i(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=e(t);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=ZJt({callback(l){if(t)for(const c of l){const{type:u,target:f}=c;if(u==="childList"&&f instanceof HTMLElement&&f.contains(t)){o();break}}}}),a=oH({callback:o});return _g(()=>{o(),t?(a?.observe(t),s?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),s?.disconnect())},[t]),r}function JJt(t){const e=JZe(t);return WZe(t,e)}const Jxe=[];function een(t){const e=E.useRef(t),n=FR(r=>t?r&&r!==Jxe&&t&&e.current&&t.parentNode===e.current.parentNode?r:iH(t):Jxe,[t]);return E.useEffect(()=>{e.current=t},[t]),n}function ten(t){const[e,n]=E.useState(null),r=E.useRef(t),i=E.useCallback(o=>{const s=SZ(o.target);s&&n(a=>a?(a.set(s,Eoe(s)),new Map(a)):null)},[]);return E.useEffect(()=>{const o=r.current;if(t!==o){s(o);const a=t.map(l=>{const c=SZ(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,Eoe(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{s(t),s(o)};function s(a){a.forEach(l=>{const c=SZ(l);c?.removeEventListener("scroll",i)})}},[i,t]),E.useMemo(()=>t.length?e?Array.from(e.values()).reduce((o,s)=>yw(o,s),R0):ZZe(t):R0,[t,e])}function eCe(t,e){e===void 0&&(e=[]);const n=E.useRef(null);return E.useEffect(()=>{n.current=null},e),E.useEffect(()=>{const r=t!==R0;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?Mj(t,n.current):R0}function nen(t){E.useEffect(()=>{if(!rH)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function ren(t,e){return E.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,e)},n},{}),[t,e])}function eQe(t){return E.useMemo(()=>t?TJt(t):null,[t])}const tCe=[];function ien(t,e){e===void 0&&(e=RS);const[n]=t,r=eQe(n?z2(n):null),[i,o]=E.useState(tCe);function s(){o(()=>t.length?t.map(l=>KZe(l)?r:new mfe(e(l),l)):tCe)}const a=oH({callback:s});return _g(()=>{a?.disconnect(),s(),t.forEach(l=>a?.observe(l))},[t]),i}function oen(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return LR(e)?e:t}function sen(t){let{measure:e}=t;const[n,r]=E.useState(null),i=E.useCallback(c=>{for(const{target:u}of c)if(LR(u)){r(f=>{const h=e(u);return f?{...f,width:h.width,height:h.height}:h});break}},[e]),o=oH({callback:i}),s=E.useCallback(c=>{const u=oen(c);o?.disconnect(),u&&o?.observe(u),r(u?e(u):null)},[e,o]),[a,l]=lN(s);return E.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const aen=[{sensor:bfe,options:{}},{sensor:gfe,options:{}}],len={current:{}},XM={draggable:{measure:Gxe},droppable:{measure:Gxe,strategy:Fj.WhileDragging,frequency:Ioe.Optimized},dragOverlay:{measure:RS}};class AI extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const cen={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new AI,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:cN},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:XM,measureDroppableContainers:cN,windowRect:null,measuringScheduled:!1},uen={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:cN,draggableNodes:new Map,over:null,measureDroppableContainers:cN},sH=E.createContext(uen),tQe=E.createContext(cen);function den(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new AI}}}function fen(t,e){switch(e.type){case dd.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case dd.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case dd.DragEnd:case dd.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case dd.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new AI(t.droppable.containers);return i.set(r,n),{...t,droppable:{...t.droppable,containers:i}}}case dd.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=e,o=t.droppable.containers.get(n);if(!o||r!==o.key)return t;const s=new AI(t.droppable.containers);return s.set(n,{...o,disabled:i}),{...t,droppable:{...t.droppable,containers:s}}}case dd.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const o=new AI(t.droppable.containers);return o.delete(n),{...t,droppable:{...t.droppable,containers:o}}}default:return t}}function hen(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=E.useContext(sH),o=Soe(r),s=Soe(n?.id);return E.useEffect(()=>{if(!e&&!r&&o&&s!=null){if(!pfe(o)||document.activeElement===o.target)return;const a=i.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const f=oJt(u);if(f){f.focus();break}}})}},[r,e,i,s,o]),null}function pen(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((i,o)=>o({transform:i,...r}),n):n}function men(t){return E.useMemo(()=>({draggable:{...XM.draggable,...t?.draggable},droppable:{...XM.droppable,...t?.droppable},dragOverlay:{...XM.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function gen(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const o=E.useRef(!1),{x:s,y:a}=typeof i=="boolean"?{x:i,y:i}:i;_g(()=>{if(!s&&!a||!e){o.current=!1;return}if(o.current||!r)return;const c=e?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),f=WZe(u,r);if(s||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=qZe(c);h&&h.scrollBy({top:f.y,left:f.x})}},[e,s,a,r,n])}const nQe=E.createContext({...R0,scaleX:1,scaleY:1});var D4;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(D4||(D4={}));const yen=E.memo(function(e){var n,r,i,o;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=aen,collisionDetection:f=xJt,measuring:h,modifiers:p,...m}=e;const g=E.useReducer(fen,void 0,den),[y,b]=g,[v,x]=dJt(),[C,w]=E.useState(D4.Uninitialized),_=C===D4.Initialized,{draggable:{active:S,nodes:k,translate:I},droppable:{containers:j}}=y,A=S!=null?k.get(S):null,D=E.useRef({initial:null,translated:null}),O=E.useMemo(()=>{var mt;return S!=null?{id:S,data:(mt=A?.data)!=null?mt:len,rect:D}:null},[S,A]),P=E.useRef(null),[$,M]=E.useState(null),[L,B]=E.useState(null),W=$j(m,Object.values(m)),N=NR("DndDescribedBy",s),V=E.useMemo(()=>j.getEnabled(),[j]),G=men(h),{droppableRects:z,measureDroppableContainers:Y,measuringScheduled:Z}=KJt(V,{dragging:_,dependencies:[I.x,I.y],config:G.droppable}),ee=GJt(k,S),K=E.useMemo(()=>L?koe(L):null,[L]),q=dt(),re=XJt(ee,G.draggable.measure);gen({activeNode:S!=null?k.get(S):null,config:q.layoutShiftCompensation,initialRect:re,measure:G.draggable.measure});const te=Qxe(ee,G.draggable.measure,re),ae=Qxe(ee?ee.parentElement:null),se=E.useRef({activatorEvent:null,active:null,activeNode:ee,collisionRect:null,collisions:null,droppableRects:z,draggableNodes:k,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),le=j.getNodeFor((n=se.current.over)==null?void 0:n.id),pe=sen({measure:G.dragOverlay.measure}),be=(r=pe.nodeRef.current)!=null?r:ee,xe=_?(i=pe.rect)!=null?i:te:null,Ce=!!(pe.nodeRef.current&&pe.rect),Te=JJt(Ce?null:te),_e=eQe(be?z2(be):null),Ie=een(_?le??ee:null),ye=ien(Ie),fe=pen(p,{transform:{x:I.x-Te.x,y:I.y-Te.y,scaleX:1,scaleY:1},activatorEvent:L,active:O,activeNodeRect:te,containerNodeRect:ae,draggingNodeRect:xe,over:se.current.over,overlayNodeRect:pe.rect,scrollableAncestors:Ie,scrollableAncestorRects:ye,windowRect:_e}),ve=K?yw(K,I):null,Se=ten(Ie),Ee=eCe(Se),je=eCe(Se,[te]),Me=yw(fe,Ee),Fe=xe?_Jt(xe,fe):null,$e=O&&Fe?f({active:O,collisionRect:Fe,droppableRects:z,droppableContainers:V,pointerCoordinates:ve}):null,Ye=UZe($e,"id"),[qe,He]=E.useState(null),Ge=Ce?fe:yw(fe,je),Ze=CJt(Ge,(o=qe?.rect)!=null?o:null,te),nt=E.useRef(null),Le=E.useCallback((mt,ht)=>{let{sensor:ft,options:at}=ht;if(P.current==null)return;const et=k.get(P.current);if(!et)return;const xt=mt.nativeEvent,lt=new ft({active:P.current,activeNode:et,event:xt,options:at,context:se,onAbort(Dt){if(!k.get(Dt))return;const{onDragAbort:Rt}=W.current,Nt={id:Dt};Rt?.(Nt),v({type:"onDragAbort",event:Nt})},onPending(Dt,Ot,Rt,Nt){if(!k.get(Dt))return;const{onDragPending:Gt}=W.current,en={id:Dt,constraint:Ot,initialCoordinates:Rt,offset:Nt};Gt?.(en),v({type:"onDragPending",event:en})},onStart(Dt){const Ot=P.current;if(Ot==null)return;const Rt=k.get(Ot);if(!Rt)return;const{onDragStart:Nt}=W.current,Mt={activatorEvent:xt,active:{id:Ot,data:Rt.data,rect:D}};r0.unstable_batchedUpdates(()=>{Nt?.(Mt),w(D4.Initializing),b({type:dd.DragStart,initialCoordinates:Dt,active:Ot}),v({type:"onDragStart",event:Mt}),M(nt.current),B(xt)})},onMove(Dt){b({type:dd.DragMove,coordinates:Dt})},onEnd:Ct(dd.DragEnd),onCancel:Ct(dd.DragCancel)});nt.current=lt;function Ct(Dt){return async function(){const{active:Rt,collisions:Nt,over:Mt,scrollAdjustedTranslate:Gt}=se.current;let en=null;if(Rt&&Gt){const{cancelDrop:Yt}=W.current;en={activatorEvent:xt,active:Rt,collisions:Nt,delta:Gt,over:Mt},Dt===dd.DragEnd&&typeof Yt=="function"&&await Promise.resolve(Yt(en))&&(Dt=dd.DragCancel)}P.current=null,r0.unstable_batchedUpdates(()=>{b({type:Dt}),w(D4.Uninitialized),He(null),M(null),B(null),nt.current=null;const Yt=Dt===dd.DragEnd?"onDragEnd":"onDragCancel";if(en){const zt=W.current[Yt];zt?.(en),v({type:Yt,event:en})}})}}},[k]),Ne=E.useCallback((mt,ht)=>(ft,at)=>{const et=ft.nativeEvent,xt=k.get(at);if(P.current!==null||!xt||et.dndKit||et.defaultPrevented)return;const lt={active:xt};mt(ft,ht.options,lt)===!0&&(et.dndKit={capturedBy:ht.sensor},P.current=at,Le(ft,ht))},[k,Le]),tt=YJt(u,Ne);nen(u),_g(()=>{te&&C===D4.Initializing&&w(D4.Initialized)},[te,C]),E.useEffect(()=>{const{onDragMove:mt}=W.current,{active:ht,activatorEvent:ft,collisions:at,over:et}=se.current;if(!ht||!ft)return;const xt={active:ht,activatorEvent:ft,collisions:at,delta:{x:Me.x,y:Me.y},over:et};r0.unstable_batchedUpdates(()=>{mt?.(xt),v({type:"onDragMove",event:xt})})},[Me.x,Me.y]),E.useEffect(()=>{const{active:mt,activatorEvent:ht,collisions:ft,droppableContainers:at,scrollAdjustedTranslate:et}=se.current;if(!mt||P.current==null||!ht||!et)return;const{onDragOver:xt}=W.current,lt=at.get(Ye),Ct=lt&<.rect.current?{id:lt.id,rect:lt.rect.current,data:lt.data,disabled:lt.disabled}:null,Dt={active:mt,activatorEvent:ht,collisions:ft,delta:{x:et.x,y:et.y},over:Ct};r0.unstable_batchedUpdates(()=>{He(Ct),xt?.(Dt),v({type:"onDragOver",event:Dt})})},[Ye]),_g(()=>{se.current={activatorEvent:L,active:O,activeNode:ee,collisionRect:Fe,collisions:$e,droppableRects:z,draggableNodes:k,draggingNode:be,draggingNodeRect:xe,droppableContainers:j,over:qe,scrollableAncestors:Ie,scrollAdjustedTranslate:Me},D.current={initial:xe,translated:Fe}},[O,ee,$e,Fe,k,be,xe,z,j,qe,Ie,Me]),UJt({...q,delta:I,draggingRect:Fe,pointerCoordinates:ve,scrollableAncestors:Ie,scrollableAncestorRects:ye});const ot=E.useMemo(()=>({active:O,activeNode:ee,activeNodeRect:te,activatorEvent:L,collisions:$e,containerNodeRect:ae,dragOverlay:pe,draggableNodes:k,droppableContainers:j,droppableRects:z,over:qe,measureDroppableContainers:Y,scrollableAncestors:Ie,scrollableAncestorRects:ye,measuringConfiguration:G,measuringScheduled:Z,windowRect:_e}),[O,ee,te,L,$e,ae,pe,k,j,z,qe,Y,Ie,ye,G,Z,_e]),rt=E.useMemo(()=>({activatorEvent:L,activators:tt,active:O,activeNodeRect:te,ariaDescribedById:{draggable:N},dispatch:b,draggableNodes:k,over:qe,measureDroppableContainers:Y}),[L,tt,O,te,b,N,k,qe,Y]);return vt.createElement(VZe.Provider,{value:x},vt.createElement(sH.Provider,{value:rt},vt.createElement(tQe.Provider,{value:ot},vt.createElement(nQe.Provider,{value:Ze},c)),vt.createElement(hen,{disabled:a?.restoreFocus===!1})),vt.createElement(pJt,{...a,hiddenTextDescribedById:N}));function dt(){const mt=$?.autoScrollEnabled===!1,ht=typeof l=="object"?l.enabled===!1:l===!1,ft=_&&!mt&&!ht;return typeof l=="object"?{...l,enabled:ft}:{enabled:ft}}}),ben=E.createContext(null),nCe="button",ven="Draggable";function xen(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const o=NR(ven),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:f,over:h}=E.useContext(sH),{role:p=nCe,roleDescription:m="draggable",tabIndex:g=0}=i??{},y=l?.id===e,b=E.useContext(y?nQe:ben),[v,x]=lN(),[C,w]=lN(),_=ren(s,e),S=$j(n);_g(()=>(f.set(e,{id:e,key:o,node:v,activatorNode:C,data:S}),()=>{const I=f.get(e);I&&I.key===o&&f.delete(e)}),[f,e]);const k=E.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":y&&p===nCe?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,g,y,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:k,isDragging:y,listeners:r?void 0:_,node:v,over:h,setNodeRef:x,setActivatorNodeRef:w,transform:b}}function Cen(){return E.useContext(tQe)}const wen="Droppable",_en={timeout:25};function Sen(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const o=NR(wen),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=E.useContext(sH),u=E.useRef({disabled:n}),f=E.useRef(!1),h=E.useRef(null),p=E.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:y}={..._en,...i},b=$j(g??r),v=E.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),p.current=null},y)},[y]),x=oH({callback:v,disabled:m||!s}),C=E.useCallback((k,I)=>{x&&(I&&(x.unobserve(I),f.current=!1),k&&x.observe(k))},[x]),[w,_]=lN(C),S=$j(e);return E.useEffect(()=>{!x||!w.current||(x.disconnect(),f.current=!1,x.observe(w.current))},[w,x]),E.useEffect(()=>(a({type:dd.RegisterDroppable,element:{id:r,key:o,disabled:n,node:w,rect:h,data:S}}),()=>a({type:dd.UnregisterDroppable,key:o,id:r})),[r]),E.useEffect(()=>{n!==u.current.disabled&&(a({type:dd.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,a]),{active:s,rect:h,isOver:l?.id===r,node:w,over:l,setNodeRef:_}}const ken=t=>{let{transform:e}=t;return{...e,y:0}},Een=t=>{let{transform:e}=t;return{...e,x:0}};function rQe(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function Ten(t,e){return t.reduce((n,r,i)=>{const o=e.get(r);return o&&(n[i]=o),n},Array(t.length))}function OP(t){return t!==null&&t>=0}function Ien(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n{var e;let{rects:n,activeNodeRect:r,activeIndex:i,overIndex:o,index:s}=t;const a=(e=n[i])!=null?e:r;if(!a)return null;const l=Ren(n,s,i);if(s===i){const c=n[o];return c?{x:ii&&s<=o?{x:-a.width-l,y:0,...PP}:s=o?{x:a.width+l,y:0,...PP}:{x:0,y:0,...PP}};function Ren(t,e,n){const r=t[e],i=t[e-1],o=t[e+1];return!r||!i&&!o?0:n{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const o=rQe(e,r,n),s=e[i],a=o[i];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},$P={scaleX:1,scaleY:1},Den=t=>{var e;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:s}=t;const a=(e=o[n])!=null?e:r;if(!a)return null;if(i===n){const c=o[s];return c?{x:0,y:nn&&i<=s?{x:0,y:-a.height-l,...$P}:i=s?{x:0,y:a.height+l,...$P}:{x:0,y:0,...$P}};function Oen(t,e,n){const r=t[e],i=t[e-1],o=t[e+1];return r?nr.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),m=s!=null,g=s?p.indexOf(s.id):-1,y=c?p.indexOf(c.id):-1,b=E.useRef(p),v=!Ien(p,b.current),x=y!==-1&&g===-1||v,C=jen(o);_g(()=>{v&&m&&u(p)},[v,p,m,u]),E.useEffect(()=>{b.current=p},[p]);const w=E.useMemo(()=>({activeIndex:g,containerId:f,disabled:C,disableTransforms:x,items:p,overIndex:y,useDragOverlay:h,sortedRects:Ten(p,l),strategy:i}),[g,f,C.draggable,C.droppable,x,p,y,l,h,i]);return vt.createElement(sQe.Provider,{value:w},e)}const $en=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return rQe(n,r,i).indexOf(e)},Men=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=t;return!c||!r||a!==o&&i===s?!1:n?!0:s!==i&&e===l},Len={duration:200,easing:"ease"},aQe="transform",Fen=Lj.Transition.toString({property:aQe,duration:0,easing:"linear"}),Nen={roleDescription:"sortable"};function Ben(t){let{disabled:e,index:n,node:r,rect:i}=t;const[o,s]=E.useState(null),a=E.useRef(n);return _g(()=>{if(!e&&n!==a.current&&r.current){const l=i.current;if(l){const c=RS(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[e,n,r,i]),E.useEffect(()=>{o&&s(null)},[o]),o}function lQe(t){let{animateLayoutChanges:e=Men,attributes:n,disabled:r,data:i,getNewIndex:o=$en,id:s,strategy:a,resizeObserverConfig:l,transition:c=Len}=t;const{items:u,containerId:f,activeIndex:h,disabled:p,disableTransforms:m,sortedRects:g,overIndex:y,useDragOverlay:b,strategy:v}=E.useContext(sQe),x=Ven(r,p),C=u.indexOf(s),w=E.useMemo(()=>({sortable:{containerId:f,index:C,items:u},...i}),[f,i,C,u]),_=E.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:S,node:k,isOver:I,setNodeRef:j}=Sen({id:s,data:w,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...l}}),{active:A,activatorEvent:D,activeNodeRect:O,attributes:P,setNodeRef:$,listeners:M,isDragging:L,over:B,setActivatorNodeRef:W,transform:N}=xen({id:s,data:w,attributes:{...Nen,...n},disabled:x.draggable}),V=tJt(j,$),G=!!A,z=G&&!m&&OP(h)&&OP(y),Y=!b&&L,Z=Y&&z?N:null,K=z?Z??(a??v)({rects:g,activeNodeRect:O,activeIndex:h,overIndex:y,index:C}):null,q=OP(h)&&OP(y)?o({id:s,items:u,activeIndex:h,overIndex:y}):C,re=A?.id,te=E.useRef({activeId:re,items:u,newIndex:q,containerId:f}),ae=u!==te.current.items,se=e({active:A,containerId:f,isDragging:L,isSorting:G,id:s,index:C,items:u,newIndex:te.current.newIndex,previousItems:te.current.items,previousContainerId:te.current.containerId,transition:c,wasDragging:te.current.activeId!=null}),le=Ben({disabled:!se,index:C,node:k,rect:S});return E.useEffect(()=>{G&&te.current.newIndex!==q&&(te.current.newIndex=q),f!==te.current.containerId&&(te.current.containerId=f),u!==te.current.items&&(te.current.items=u)},[G,q,f,u]),E.useEffect(()=>{if(re===te.current.activeId)return;if(re&&!te.current.activeId){te.current.activeId=re;return}const be=setTimeout(()=>{te.current.activeId=re},50);return()=>clearTimeout(be)},[re]),{active:A,activeIndex:h,attributes:P,data:w,rect:S,index:C,newIndex:q,items:u,isOver:I,isSorting:G,isDragging:L,listeners:M,node:k,overIndex:y,over:B,setNodeRef:V,setActivatorNodeRef:W,setDroppableNodeRef:j,setDraggableNodeRef:$,transform:le??K,transition:pe()};function pe(){if(le||ae&&te.current.newIndex===C)return Fen;if(!(Y&&!pfe(D)||!c)&&(G||se))return Lj.Transition.toString({...c,property:aQe})}}function Ven(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function dN(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const zen=[hs.Down,hs.Right,hs.Up,hs.Left],Hen=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}}=e;if(zen.includes(t.code)){if(t.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(t.code){case hs.Down:r.toph.top&&l.push(f);break;case hs.Left:r.left>h.left&&l.push(f);break;case hs.Right:r.left1&&(u=c[1].id),u!=null){const f=o.get(n.id),h=o.get(u),p=h?i.get(h.id):null,m=h?.node.current;if(m&&p&&f&&h){const y=iH(m).some((_,S)=>a[S]!==_),b=cQe(f,h),v=Uen(f,h),x=y||!b?{x:0,y:0}:{x:v?r.width-p.width:0,y:v?r.height-p.height:0},C={x:p.left,y:p.top};return x.x&&x.y?C:Mj(C,x)}}}};function cQe(t,e){return!dN(t)||!dN(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Uen(t,e){return!dN(t)||!dN(e)||!cQe(t,e)?!1:t.data.current.sortable.indextypeof e=="string"))}function y1(t){return typeof t._type=="string"&&t._type[0]!=="@"&&(!("markDefs"in t)||!t.markDefs||Array.isArray(t.markDefs)&&t.markDefs.every(e=>typeof e._key=="string"))&&"children"in t&&Array.isArray(t.children)&&t.children.every(e=>typeof e=="object"&&"_type"in e)}function d_(t){return y1(t)&&"listItem"in t&&typeof t.listItem=="string"&&(t.level===void 0||typeof t.level=="number")}function vfe(t){return t._type==="@list"}function aH(t){return t._type==="@span"}function lH(t){return t._type==="@text"}const rCe=["strong","em","code","underline","strike-through"];function Wen(t,e,n){if(!Nj(t)||!t.marks||!t.marks.length)return[];let r=t.marks.slice(),i={};return r.forEach(o=>{i[o]=1;for(let s=e+1;sqen(i,o,s))}function qen(t,e,n){let r=t[e],i=t[n];if(r!==i)return i-r;let o=rCe.indexOf(e),s=rCe.indexOf(n);return o===s?e.localeCompare(n):o-s}function cH(t){let{children:e}=t,n=t.markDefs??[];if(!e||!e.length)return[];let r=e.map(Wen),i={_type:"@span",children:[],markType:""},o=[i];for(let s=0;s1)for(;cm._key===f),p={_type:"@span",_key:a._key,children:[],markDef:h,markType:h?h._type:f,markKey:f};u.children.push(p),o.push(p),u=p}if(Nj(a)){let f=a.text.split(` +`);for(let h=f.length;h-- >1;)f.splice(h,0,` +`);u.children=u.children.concat(f.map(h=>({_type:"@text",text:h})))}else u.children=u.children.concat(a)}}return i.children}function uQe(t,e){let n=[],r;for(let i=0;ir.level){let s=MP(o,i,e);if(e==="html"){let a=r.children[r.children.length-1],l={...a,children:[...a.children,s]};r.children[r.children.length-1]=l}else r.children.push(s);r=s;continue}if((o.level||1){lH(n)?e+=n.text:aH(n)&&(e+=uH(n))}),e}const Yen=/^\s/,Ken=/\s$/;function y8(t){let e=Array.isArray(t)?t:[t],n="";return e.forEach((r,i)=>{if(!y1(r))return;let o=!1;r.children.forEach(s=>{Nj(s)?(n+=o&&n&&!Ken.test(n)&&!Yen.test(s.text)?" ":"",n+=s.text,o=!1):o=!0}),i!==e.length-1&&(n+=` + +`)}),n}const Xen="html",Zen={number:({children:t})=>d.jsx("ol",{children:t}),bullet:({children:t})=>d.jsx("ul",{children:t})},Qen=({children:t})=>d.jsx("li",{children:t}),Jen=({children:t,value:e})=>d.jsx("a",{href:e?.href,children:t}),etn={textDecoration:"underline"},ttn={em:({children:t})=>d.jsx("em",{children:t}),strong:({children:t})=>d.jsx("strong",{children:t}),code:({children:t})=>d.jsx("code",{children:t}),underline:({children:t})=>d.jsx("span",{style:etn,children:t}),"strike-through":({children:t})=>d.jsx("del",{children:t}),link:Jen},BR=(t,e)=>`[@portabletext/react] Unknown ${t}, specify a component for it in the \`components.${e}\` prop`,dQe=t=>BR(`block type "${t}"`,"types"),ntn=t=>BR(`mark type "${t}"`,"marks"),rtn=t=>BR(`block style "${t}"`,"block"),itn=t=>BR(`list style "${t}"`,"list"),otn=t=>BR(`list item style "${t}"`,"listItem");function stn(t){console.warn(t)}const atn={display:"none"},iCe={types:{},block:{normal:({children:t})=>d.jsx("p",{children:t}),blockquote:({children:t})=>d.jsx("blockquote",{children:t}),h1:({children:t})=>d.jsx("h1",{children:t}),h2:({children:t})=>d.jsx("h2",{children:t}),h3:({children:t})=>d.jsx("h3",{children:t}),h4:({children:t})=>d.jsx("h4",{children:t}),h5:({children:t})=>d.jsx("h5",{children:t}),h6:({children:t})=>d.jsx("h6",{children:t})},marks:ttn,list:Zen,listItem:Qen,hardBreak:()=>d.jsx("br",{}),unknownType:({value:t,isInline:e})=>{let n=dQe(t._type);return d.jsx(e?"span":"div",{style:atn,children:n})},unknownMark:({markType:t,children:e})=>d.jsx("span",{className:`unknown__pt__mark__${t}`,children:e}),unknownList:({children:t})=>d.jsx("ul",{children:t}),unknownListItem:({children:t})=>d.jsx("li",{children:t}),unknownBlockStyle:({children:t})=>d.jsx("p",{children:t})};function ltn(t,e){let{block:n,list:r,listItem:i,marks:o,types:s,...a}=e;return{...t,block:VE(t,e,"block"),list:VE(t,e,"list"),listItem:VE(t,e,"listItem"),marks:VE(t,e,"marks"),types:VE(t,e,"types"),...a}}function VE(t,e,n){let r=e[n],i=t[n];return typeof r=="function"||r&&typeof i=="function"?r:r?{...i,...r}:i}function fQe({value:t,components:e,listNestingMode:n,onMissingComponent:r=stn}){let i=r||utn,o=uQe(Array.isArray(t)?t:[t],n||Xen),s=E.useMemo(()=>e?ltn(iCe,e):iCe,[e]),a=E.useMemo(()=>ctn(s,i),[s,i]);return d.jsx(d.Fragment,{children:o.map((l,c)=>a({node:l,index:c,isInline:!1,renderNode:a}))})}const ctn=(t,e)=>{function n(f){let{node:h,index:p,isInline:m}=f,g=h._key||`node-${p}`;return vfe(h)?o(h,p,g):d_(h)?i(h,p,g):aH(h)?s(h,p,g):r(h)?u(h,p,g,m):y1(h)?a(h,p,g,m):lH(h)?l(h,g):c(h,p,g,m)}function r(f){return f._type in t.types}function i(f,h,p){let m=oCe({node:f,index:h,isInline:!1,renderNode:n}),g=t.listItem,y=(typeof g=="function"?g:g[f.listItem])||t.unknownListItem;if(y===t.unknownListItem){let v=f.listItem||"bullet";e(otn(v),{type:v,nodeType:"listItemStyle"})}let b=m.children;if(f.style&&f.style!=="normal"){let{listItem:v,...x}=f;b=n({node:x,index:h,isInline:!1})}return d.jsx(y,{value:f,index:h,isInline:!1,renderNode:n,children:b},p)}function o(f,h,p){let m=f.children.map((b,v)=>n({node:b._key?b:{...b,_key:`li-${h}-${v}`},index:v,isInline:!1})),g=t.list,y=(typeof g=="function"?g:g[f.listItem])||t.unknownList;if(y===t.unknownList){let b=f.listItem||"bullet";e(itn(b),{nodeType:"listStyle",type:b})}return d.jsx(y,{value:f,index:h,isInline:!1,renderNode:n,children:m},p)}function s(f,h,p){let{markDef:m,markType:g,markKey:y}=f,b=t.marks[g]||t.unknownMark,v=f.children.map((x,C)=>n({node:x,index:C,isInline:!0}));return b===t.unknownMark&&e(ntn(g),{nodeType:"mark",type:g}),d.jsx(b,{text:uH(f),value:m,markType:g,markKey:y,renderNode:n,children:v},p)}function a(f,h,p,m){let{_key:g,...y}=oCe({node:f,index:h,isInline:m,renderNode:n}),b=y.node.style||"normal",v=(typeof t.block=="function"?t.block:t.block[b])||t.unknownBlockStyle;return v===t.unknownBlockStyle&&e(rtn(b),{nodeType:"blockStyle",type:b}),d.jsx(v,{...y,value:y.node,renderNode:n},p)}function l(f,h){if(f.text===` +`){let p=t.hardBreak;return p?d.jsx(p,{},h):` +`}return f.text}function c(f,h,p,m){let g={value:f,isInline:m,index:h,renderNode:n};e(dQe(f._type),{nodeType:"block",type:f._type});let y=t.unknownType;return d.jsx(y,{...g},p)}function u(f,h,p,m){let g={value:f,isInline:m,index:h,renderNode:n},y=t.types[f._type];return y?d.jsx(y,{...g},p):null}return n};function oCe(t){let{node:e,index:n,isInline:r,renderNode:i}=t,o=cH(e).map((s,a)=>i({node:s,isInline:!0,index:a,renderNode:i}));return{_key:e._key||`block-${n}`,children:o,index:n,isInline:r,node:e}}function utn(){}var fN=E.useLayoutEffect;function dtn(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function ftn(){const t=dtn();if(t.__xstate__)return t.__xstate__}const htn=t=>{if(typeof window>"u")return;const e=ftn();e&&e.register(t)};class sCe{constructor(e){this._process=e,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(e){const n={value:e,next:null};if(this._current){this._last.next=n,this._last=n;return}this._current=n,this._last=n,this._active&&this.flush()}flush(){for(;this._current;){const e=this._current;this._process(e.value),this._current=e.next}this._last=null}}const hQe=".",ptn="",pQe="",mtn="#",gtn="*",mQe="xstate.init",ytn="xstate.error",O9="xstate.stop";function btn(t,e){return{type:`xstate.after.${t}.${e}`}}function Aoe(t,e){return{type:`xstate.done.state.${t}`,output:e}}function vtn(t,e){return{type:`xstate.done.actor.${t}`,output:e,actorId:t}}function gQe(t,e){return{type:`xstate.error.actor.${t}`,error:e,actorId:t}}function yQe(t){return{type:mQe,input:t}}function C5(t){setTimeout(()=>{throw t})}const xtn=typeof Symbol=="function"&&Symbol.observable||"@@observable";function bQe(t,e){const n=aCe(t),r=aCe(e);return typeof r=="string"?typeof n=="string"?r===n:!1:typeof n=="string"?n in r:Object.keys(n).every(i=>i in r?bQe(n[i],r[i]):!1)}function xfe(t){if(xQe(t))return t;const e=[];let n="";for(let r=0;rtypeof e>"u"||typeof e=="string"?{target:e}:e)}function CQe(t){if(!(t===void 0||t===ptn))return s7(t)}function hN(t,e,n){const r=typeof t=="object",i=r?t:void 0;return{next:(r?t.next:t)?.bind(i),error:(r?t.error:e)?.bind(i),complete:(r?t.complete:n)?.bind(i)}}function cCe(t,e){return`${e}.${t}`}function Cfe(t,e){const n=e.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return t.implementations.actors[e];const[,r,i]=n,s=t.getStateNodeById(i).config.invoke;return(Array.isArray(s)?s[r]:s).src}function wQe(t,e){if(e===t||e===gtn)return!0;if(!e.endsWith(".*"))return!1;const n=e.split("."),r=t.split(".");for(let i=0;i{const b={source:h,target:p,event:m,delay:g,id:y,startedAt:Date.now()},v=uCe(h,y);f._snapshot._scheduledEvents[v]=b;const x=a.setTimeout(()=>{delete s[v],delete f._snapshot._scheduledEvents[v],f._relay(h,p,m)},g);s[v]=x},cancel:(h,p)=>{const m=uCe(h,p),g=s[m];delete s[m],delete f._snapshot._scheduledEvents[m],g!==void 0&&a.clearTimeout(g)},cancelAll:h=>{for(const p in f._snapshot._scheduledEvents){const m=f._snapshot._scheduledEvents[p];m.source===h&&c.cancel(h,m.id)}}},u=h=>{if(!o.size)return;const p={...h,rootId:t.sessionId};o.forEach(m=>m.next?.(p))},f={_snapshot:{_scheduledEvents:(e?.snapshot&&e.snapshot.scheduler)??{}},_bookId:()=>`x:${_tn++}`,_register:(h,p)=>(n.set(h,p),h),_unregister:h=>{n.delete(h.sessionId);const p=i.get(h);p!==void 0&&(r.delete(p),i.delete(h))},get:h=>r.get(h),getAll:()=>Object.fromEntries(r.entries()),_set:(h,p)=>{const m=r.get(h);if(m&&m!==p)throw new Error(`Actor with system ID '${h}' already exists.`);r.set(h,p),i.set(p,h)},inspect:h=>{const p=hN(h);return o.add(p),{unsubscribe(){o.delete(p)}}},_sendInspectionEvent:u,_relay:(h,p,m)=>{f._sendInspectionEvent({type:"@xstate.event",sourceRef:h,actorRef:p,event:m}),p._send(m)},scheduler:c,getSnapshot:()=>({_scheduledEvents:{...f._snapshot._scheduledEvents}}),start:()=>{const h=f._snapshot._scheduledEvents;f._snapshot._scheduledEvents={};for(const p in h){const{source:m,target:g,event:y,delay:b,id:v}=h[p];c.schedule(m,g,y,b,v)}},_clock:a,_logger:l};return f}let TZ=!1;const wfe=1;let m2=(function(t){return t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped",t})({});const ktn={clock:{setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t)},logger:console.log.bind(console),devTools:!1};class Etn{constructor(e,n){this.logic=e,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new sCe(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=m2.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];const r={...ktn,...n},{clock:i,logger:o,parent:s,syncSnapshot:a,id:l,systemId:c,inspect:u}=r;this.system=s?s.system:Stn(this,{clock:i,logger:o}),u&&!s&&this.system.inspect(hN(u)),this.sessionId=this.system._bookId(),this.id=l??this.sessionId,this.logger=n?.logger??this.system._logger,this.clock=n?.clock??this.system._clock,this._parent=s,this._syncSnapshot=a,this.options=r,this.src=r.src??e,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:f=>{this._deferred.push(f)},system:this.system,stopChild:f=>{if(f._parent!==this)throw new Error(`Cannot stop child actor ${f.id} of ${this.id} because it is not a child`);f._stop()},emit:f=>{const h=this.eventListeners.get(f.type),p=this.eventListeners.get("*");if(!h&&!p)return;const m=[...h?h.values():[],...p?p.values():[]];for(const g of m)try{g(f)}catch(y){C5(y)}},actionExecutor:f=>{const h=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:f.type,params:f.params}}),!f.exec)return;const p=TZ;try{TZ=!0,f.exec(f.info,f.params)}finally{TZ=p}};this._processingStatus===m2.Running?h():this._deferred.push(h)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),c&&(this.systemId=c,this.system._set(c,this)),this._initState(n?.snapshot??n?.state),c&&this._snapshot.status!=="active"&&this.system._unregister(this)}_initState(e){try{this._snapshot=e?this.logic.restoreSnapshot?this.logic.restoreSnapshot(e,this._actorScope):e:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(n){this._snapshot={status:"error",output:void 0,error:n}}}update(e,n){this._snapshot=e;let r;for(;r=this._deferred.shift();)try{r()}catch(i){this._deferred.length=0,this._snapshot={...e,status:"error",error:i}}switch(this._snapshot.status){case"active":for(const i of this.observers)try{i.next?.(e)}catch(o){C5(o)}break;case"done":for(const i of this.observers)try{i.next?.(e)}catch(o){C5(o)}this._stopProcedure(),this._complete(),this._doneEvent=vtn(this.id,this._snapshot.output),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:n,snapshot:e})}subscribe(e,n,r){const i=hN(e,n,r);if(this._processingStatus!==m2.Stopped)this.observers.add(i);else switch(this._snapshot.status){case"done":try{i.complete?.()}catch(o){C5(o)}break;case"error":{const o=this._snapshot.error;if(!i.error)C5(o);else try{i.error(o)}catch(s){C5(s)}break}}return{unsubscribe:()=>{this.observers.delete(i)}}}on(e,n){let r=this.eventListeners.get(e);r||(r=new Set,this.eventListeners.set(e,r));const i=n.bind(void 0);return r.add(i),{unsubscribe:()=>{r.delete(i)}}}start(){if(this._processingStatus===m2.Running)return this;this._syncSnapshot&&this.subscribe({next:r=>{r.status==="active"&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:r})},error:()=>{}}),this.system._register(this.sessionId,this),this.systemId&&this.system._set(this.systemId,this),this._processingStatus=m2.Running;const e=yQe(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:e}),this._snapshot.status){case"done":return this.update(this._snapshot,e),this;case"error":return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(r){return this._snapshot={...this._snapshot,status:"error",error:r},this._error(r),this}return this.update(this._snapshot,e),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(e){let n,r;try{n=this.logic.transition(this._snapshot,e,this._actorScope)}catch(i){r={err:i}}if(r){const{err:i}=r;this._snapshot={...this._snapshot,status:"error",error:i},this._error(i);return}this.update(n,e),e.type===O9&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===m2.Stopped?this:(this.mailbox.clear(),this._processingStatus===m2.NotStarted?(this._processingStatus=m2.Stopped,this):(this.mailbox.enqueue({type:O9}),this))}stop(){if(this._parent)throw new Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(const e of this.observers)try{e.complete?.()}catch(n){C5(n)}this.observers.clear(),this.eventListeners.clear()}_reportError(e){if(!this.observers.size){this._parent||C5(e),this.eventListeners.clear();return}let n=!1;for(const r of this.observers){const i=r.error;n||=!i;try{i?.(e)}catch(o){C5(o)}}this.observers.clear(),this.eventListeners.clear(),n&&C5(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,gQe(this.id,e))}_stopProcedure(){return this._processingStatus!==m2.Running?this:(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new sCe(this._process.bind(this)),this._processingStatus=m2.Stopped,this.system._unregister(this),this)}_send(e){this._processingStatus!==m2.Stopped&&this.mailbox.enqueue(e)}send(e){this.system._relay(void 0,this,e)}attachDevTools(){const{devTools:e}=this.options;e&&(typeof e=="function"?e:htn)(this)}toJSON(){return{xstate$$type:wfe,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[xtn](){return this}getSnapshot(){return this._snapshot}}function Zp(t,...[e]){return new Etn(t,e)}function Ttn(t,e,n,r,{sendId:i}){const o=typeof i=="function"?i(n,r):i;return[e,{sendId:o},void 0]}function Itn(t,e){t.defer(()=>{t.system.scheduler.cancel(t.self,e.sendId)})}function _fe(t){function e(n,r){}return e.type="xstate.cancel",e.sendId=t,e.resolve=Ttn,e.execute=Itn,e}function jtn(t,e,n,r,{id:i,systemId:o,src:s,input:a,syncSnapshot:l}){const c=typeof s=="string"?Cfe(e.machine,s):s,u=typeof i=="function"?i(n):i;let f,h;return c&&(h=typeof a=="function"?a({context:e.context,event:n.event,self:t.self}):a,f=Zp(c,{id:u,src:s,parent:t.self,syncSnapshot:l,systemId:o,input:h})),[P9(e,{children:{...e.children,[u]:f}}),{id:i,systemId:o,actorRef:f,src:s,input:h},void 0]}function Atn(t,{actorRef:e}){e&&t.defer(()=>{e._processingStatus!==m2.Stopped&&e.start()})}function Sfe(...[t,{id:e,systemId:n,input:r,syncSnapshot:i=!1}={}]){function o(s,a){}return o.type="xstate.spawnChild",o.id=e,o.systemId=n,o.src=t,o.input=r,o.syncSnapshot=i,o.resolve=jtn,o.execute=Atn,o}function Rtn(t,e,n,r,{actorRef:i}){const o=typeof i=="function"?i(n,r):i,s=typeof o=="string"?e.children[o]:o;let a=e.children;return s&&(a={...a},delete a[s.id]),[P9(e,{children:a}),s,void 0]}function _Qe(t,e){const n=e.getSnapshot();if(n&&"children"in n)for(const r of Object.values(n.children))_Qe(t,r);t.system._unregister(e)}function Dtn(t,e){if(e){if(_Qe(t,e),e._processingStatus!==m2.Running){t.stopChild(e);return}t.defer(()=>{t.stopChild(e)})}}function DS(t){function e(n,r){}return e.type="xstate.stopChild",e.actorRef=t,e.resolve=Rtn,e.execute=Dtn,e}function Otn(t,{context:e,event:n},{guards:r}){return!OS(r[0],e,n,t)}function ZM(t){function e(n,r){return!1}return e.check=Otn,e.guards=[t],e}function Ptn(t,{context:e,event:n},{guards:r}){return r.every(i=>OS(i,e,n,t))}function bw(t){function e(n,r){return!1}return e.check=Ptn,e.guards=t,e}function OS(t,e,n,r){const{machine:i}=r,o=typeof t=="function",s=o?t:i.implementations.guards[typeof t=="string"?t:t.type];if(!o&&!s)throw new Error(`Guard '${typeof t=="string"?t:t.type}' is not implemented.'.`);if(typeof s!="function")return OS(s,e,n,r);const a={context:e,event:n},l=o||typeof t=="string"?void 0:"params"in t?typeof t.params=="function"?t.params({context:e,event:n}):t.params:void 0;return"check"in s?s.check(r,a,s):s(a,l)}function kfe(t){return t.type==="atomic"||t.type==="final"}function f_(t){return Object.values(t.states).filter(e=>e.type!=="history")}function VR(t,e){const n=[];if(e===t)return n;let r=t.parent;for(;r&&r!==e;)n.push(r),r=r.parent;return n}function pN(t){const e=new Set(t),n=kQe(e);for(const r of e)if(r.type==="compound"&&(!n.get(r)||!n.get(r).length))dCe(r).forEach(i=>e.add(i));else if(r.type==="parallel"){for(const i of f_(r))if(i.type!=="history"&&!e.has(i)){const o=dCe(i);for(const s of o)e.add(s)}}for(const r of e){let i=r.parent;for(;i;)e.add(i),i=i.parent}return e}function SQe(t,e){const n=e.get(t);if(!n)return{};if(t.type==="compound"){const i=n[0];if(i){if(kfe(i))return i.key}else return{}}const r={};for(const i of n)r[i.key]=SQe(i,e);return r}function kQe(t){const e=new Map;for(const n of t)e.has(n)||e.set(n,[]),n.parent&&(e.has(n.parent)||e.set(n.parent,[]),e.get(n.parent).push(n));return e}function EQe(t,e){const n=pN(e);return SQe(t,kQe(n))}function Efe(t,e){return e.type==="compound"?f_(e).some(n=>n.type==="final"&&t.has(n)):e.type==="parallel"?f_(e).every(n=>Efe(t,n)):e.type==="final"}const dH=t=>t[0]===mtn;function $tn(t,e){return t.transitions.get(e)||[...t.transitions.keys()].filter(r=>wQe(e,r)).sort((r,i)=>i.length-r.length).flatMap(r=>t.transitions.get(r))}function Mtn(t){const e=t.config.after;if(!e)return[];const n=i=>{const o=btn(i,t.id),s=o.type;return t.entry.push(w2(o,{id:s,delay:i})),t.exit.push(_fe(s)),s};return Object.keys(e).flatMap(i=>{const o=e[i],s=typeof o=="string"?{target:o}:o,a=Number.isNaN(+i)?i:+i,l=n(a);return s7(s).map(c=>({...c,event:l,delay:a}))}).map(i=>{const{delay:o}=i;return{...B4(t,i.event,i),delay:o}})}function B4(t,e,n){const r=CQe(n.target),i=n.reenter??!1,o=Btn(t,r),s={...n,actions:s7(n.actions),guard:n.guard,target:o,source:t,reenter:i,eventType:e,toJSON:()=>({...s,source:`#${t.id}`,target:o?o.map(a=>`#${a.id}`):void 0})};return s}function Ltn(t){const e=new Map;if(t.config.on)for(const n of Object.keys(t.config.on)){if(n===pQe)throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');const r=t.config.on[n];e.set(n,pC(r).map(i=>B4(t,n,i)))}if(t.config.onDone){const n=`xstate.done.state.${t.id}`;e.set(n,pC(t.config.onDone).map(r=>B4(t,n,r)))}for(const n of t.invoke){if(n.onDone){const r=`xstate.done.actor.${n.id}`;e.set(r,pC(n.onDone).map(i=>B4(t,r,i)))}if(n.onError){const r=`xstate.error.actor.${n.id}`;e.set(r,pC(n.onError).map(i=>B4(t,r,i)))}if(n.onSnapshot){const r=`xstate.snapshot.${n.id}`;e.set(r,pC(n.onSnapshot).map(i=>B4(t,r,i)))}}for(const n of t.after){let r=e.get(n.eventType);r||(r=[],e.set(n.eventType,r)),r.push(n)}return e}function Ftn(t){const e=[],n=r=>{Object.values(r).forEach(i=>{if(i.config.route&&i.config.id){const o=i.config.id,s=i.config.route.guard,a=(c,u)=>c.event.to!==`#${o}`?!1:s&&typeof s=="function"?s(c,u):!0,l={...i.config.route,guard:a,target:`#${o}`};e.push(B4(t,"xstate.route",l))}i.states&&n(i.states)})};n(t.states),e.length>0&&t.transitions.set("xstate.route",e)}function Ntn(t,e){const n=typeof e=="string"?t.states[e]:e?t.states[e.target]:void 0;if(!n&&e)throw new Error(`Initial state node "${e}" not found on parent state node #${t.id}`);const r={source:t,actions:!e||typeof e=="string"?[]:s7(e.actions),eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...r,source:`#${t.id}`,target:n?[`#${n.id}`]:[]})};return r}function Btn(t,e){if(e!==void 0)return e.map(n=>{if(typeof n!="string")return n;if(dH(n))return t.machine.getStateNodeById(n);const r=n[0]===hQe;if(r&&!t.parent)return mN(t,n.slice(1));const i=r?t.key+n:n;if(t.parent)try{return mN(t.parent,i)}catch(o){throw new Error(`Invalid transition definition for state node '${t.id}': +${o.message}`)}else throw new Error(`Invalid target: "${n}" is not a valid target from the root node. Did you mean ".${n}"?`)})}function TQe(t){const e=CQe(t.config.target);return e?{target:e.map(n=>typeof n=="string"?mN(t.parent,n):n)}:t.parent.initial}function Bb(t){return t.type==="history"}function dCe(t){const e=IQe(t);for(const n of e)for(const r of VR(n,t))e.add(r);return e}function IQe(t){const e=new Set;function n(r){if(!e.has(r)){if(e.add(r),r.type==="compound")n(r.initial.target[0]);else if(r.type==="parallel")for(const i of f_(r))n(i)}}return n(t),e}function h_(t,e){if(dH(e))return t.machine.getStateNodeById(e);if(!t.states)throw new Error(`Unable to retrieve child state '${e}' from '${t.id}'; no child states exist.`);const n=t.states[e];if(!n)throw new Error(`Child state '${e}' does not exist on '${t.id}'`);return n}function mN(t,e){if(typeof e=="string"&&dH(e))try{return t.machine.getStateNodeById(e)}catch{}const n=xfe(e).slice();let r=t;for(;n.length;){const i=n.shift();if(!i.length)break;r=h_(r,i)}return r}function gN(t,e){if(typeof e=="string"){const i=t.states[e];if(!i)throw new Error(`State '${e}' does not exist on '${t.id}'`);return[t,i]}const n=Object.keys(e),r=n.map(i=>h_(t,i)).filter(Boolean);return[t.machine.root,t].concat(r,n.reduce((i,o)=>{const s=h_(t,o);if(!s)return i;const a=gN(s,e[o]);return i.concat(a)},[]))}function Vtn(t,e,n,r){const o=h_(t,e).next(n,r);return!o||!o.length?t.next(n,r):o}function ztn(t,e,n,r){const i=Object.keys(e),o=h_(t,i[0]),s=Tfe(o,e[i[0]],n,r);return!s||!s.length?t.next(n,r):s}function Htn(t,e,n,r){const i=[];for(const o of Object.keys(e)){const s=e[o];if(!s)continue;const a=h_(t,o),l=Tfe(a,s,n,r);l&&i.push(...l)}return i.length?i:t.next(n,r)}function Tfe(t,e,n,r){return typeof e=="string"?Vtn(t,e,n,r):Object.keys(e).length===1?ztn(t,e,n,r):Htn(t,e,n,r)}function Utn(t){return Object.keys(t.states).map(e=>t.states[e]).filter(e=>e.type==="history")}function b8(t,e){let n=t;for(;n.parent&&n.parent!==e;)n=n.parent;return n.parent===e}function Wtn(t,e){const n=new Set(t),r=new Set(e);for(const i of n)if(r.has(i))return!0;for(const i of r)if(n.has(i))return!0;return!1}function jQe(t,e,n){const r=new Set;for(const i of t){let o=!1;const s=new Set;for(const a of r)if(Wtn(Doe([i],e,n),Doe([a],e,n)))if(b8(i.source,a.source))s.add(a);else{o=!0;break}if(!o){for(const a of s)r.delete(a);r.add(i)}}return Array.from(r)}function qtn(t){const[e,...n]=t;for(const r of VR(e,void 0))if(n.every(i=>b8(i,r)))return r}function Ife(t,e){if(!t.target)return[];const n=new Set;for(const r of t.target)if(Bb(r))if(e[r.id])for(const i of e[r.id])n.add(i);else for(const i of Ife(TQe(r),e))n.add(i);else n.add(r);return[...n]}function AQe(t,e){const n=Ife(t,e);if(!n)return;if(!t.reenter&&n.every(i=>i===t.source||b8(i,t.source)))return t.source;const r=qtn(n.concat(t.source));if(r)return r;if(!t.reenter)return t.source.machine.root}function Doe(t,e,n){const r=new Set;for(const i of t)if(i.target?.length){const o=AQe(i,n);i.reenter&&i.source===o&&r.add(o);for(const s of e)b8(s,o)&&r.add(s)}return[...r]}function Gtn(t,e){if(t.length!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function Ytn(t,e,n,r,i){return Ooe([{target:[...IQe(t)],source:t,reenter:!0,actions:[],eventType:null,toJSON:null}],e,n,r,!0,i)}function Ooe(t,e,n,r,i,o){const s=[];if(!t.length)return[e,s];const a=n.actionExecutor;n.actionExecutor=l=>{s.push(l),a(l)};try{const l=new Set(e._nodes);let c=e.historyValue;const u=jQe(t,l,c);let f=e;i||([f,c]=Qtn(f,r,n,u,l,c,o,n.actionExecutor)),f=p_(f,r,n,u.flatMap(p=>p.actions),o,void 0),f=Xtn(f,r,n,u,l,o,c,i);const h=[...l];f.status==="done"&&(f=p_(f,r,n,h.sort((p,m)=>m.order-p.order).flatMap(p=>p.exit),o,void 0));try{return c===e.historyValue&&Gtn(e._nodes,l)?[f,s]:[P9(f,{_nodes:h,historyValue:c}),s]}catch(p){throw p}}finally{n.actionExecutor=a}}function Ktn(t,e,n,r,i){if(r.output===void 0)return;const o=Aoe(i.id,i.output!==void 0&&i.parent?Roe(i.output,t.context,e,n.self):void 0);return Roe(r.output,t.context,o,n.self)}function Xtn(t,e,n,r,i,o,s,a){let l=t;const c=new Set,u=new Set;Ztn(r,s,u,c),a&&u.add(t.machine.root);const f=new Set;for(const h of[...c].sort((p,m)=>p.order-m.order)){i.add(h);const p=[];p.push(...h.entry);for(const m of h.invoke)p.push(Sfe(m.src,{...m,syncSnapshot:!!m.onSnapshot}));if(u.has(h)){const m=h.initial.actions;p.push(...m)}if(l=p_(l,e,n,p,o,h.invoke.map(m=>m.id)),h.type==="final"){const m=h.parent;let g=m?.type==="parallel"?m:m?.parent,y=g||h;for(m?.type==="compound"&&o.push(Aoe(m.id,h.output!==void 0?Roe(h.output,l.context,e,n.self):void 0));g?.type==="parallel"&&!f.has(g)&&Efe(i,g);)f.add(g),o.push(Aoe(g.id)),y=g,g=g.parent;if(g)continue;l=P9(l,{status:"done",output:Ktn(l,e,n,l.machine.root,y)})}}return l}function Ztn(t,e,n,r){for(const i of t){const o=AQe(i,e);for(const a of i.target||[])!Bb(a)&&(i.source!==a||i.source!==o||i.reenter)&&(r.add(a),n.add(a)),UC(a,e,n,r);const s=Ife(i,e);for(const a of s){const l=VR(a,o);o?.type==="parallel"&&l.push(o),RQe(r,e,n,l,!i.source.parent&&i.reenter?void 0:o)}}}function UC(t,e,n,r){if(Bb(t))if(e[t.id]){const i=e[t.id];for(const o of i)r.add(o),UC(o,e,n,r);for(const o of i)IZ(o,t.parent,r,e,n)}else{const i=TQe(t);for(const o of i.target)r.add(o),i===t.parent?.initial&&n.add(t.parent),UC(o,e,n,r);for(const o of i.target)IZ(o,t.parent,r,e,n)}else if(t.type==="compound"){const[i]=t.initial.target;Bb(i)||(r.add(i),n.add(i)),UC(i,e,n,r),IZ(i,t,r,e,n)}else if(t.type==="parallel")for(const i of f_(t).filter(o=>!Bb(o)))[...r].some(o=>b8(o,i))||(Bb(i)||(r.add(i),n.add(i)),UC(i,e,n,r))}function RQe(t,e,n,r,i){for(const o of r)if((!i||b8(o,i))&&t.add(o),o.type==="parallel")for(const s of f_(o).filter(a=>!Bb(a)))[...t].some(a=>b8(a,s))||(t.add(s),UC(s,e,n,t))}function IZ(t,e,n,r,i){RQe(n,r,i,VR(t,e))}function Qtn(t,e,n,r,i,o,s,a){let l=t;const c=Doe(r,i,o);c.sort((f,h)=>h.order-f.order);let u;for(const f of c)for(const h of Utn(f)){let p;h.history==="deep"?p=m=>kfe(m)&&b8(m,f):p=m=>m.parent===f,u??={...o},u[h.id]=Array.from(i).filter(p)}for(const f of c)l=p_(l,e,n,[...f.exit,...f.invoke.map(h=>DS(h.id))],s,void 0),i.delete(f);return[l,u||o]}function Jtn(t,e){return t.implementations.actions[e]}function DQe(t,e,n,r,i,o){const{machine:s}=t;let a=t;for(const l of r){const c=typeof l=="function",u=c?l:Jtn(s,typeof l=="string"?l:l.type),f={context:a.context,event:e,self:n.self,system:n.system},h=c||typeof l=="string"?void 0:"params"in l?typeof l.params=="function"?l.params({context:a.context,event:e}):l.params:void 0;if(!u||!("resolve"in u)){n.actionExecutor({type:typeof l=="string"?l:typeof l=="object"?l.type:l.name||"(anonymous)",info:f,params:h,exec:u});continue}const p=u,[m,g,y]=p.resolve(n,a,f,h,u,i);a=m,"retryResolve"in p&&o?.push([p,g]),"execute"in p&&n.actionExecutor({type:p.type,info:f,params:g,exec:p.execute.bind(null,n,g)}),y&&(a=DQe(a,e,n,y,i,o))}return a}function p_(t,e,n,r,i,o){const s=o?[]:void 0,a=DQe(t,e,n,r,{internalQueue:i,deferredActorIds:o},s);return s?.forEach(([l,c])=>{l.retryResolve(n,a,c)}),a}function jZ(t,e,n,r){let i=t;const o=[];function s(c,u,f){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:u,snapshot:c[0],_transitions:f}),o.push(c)}if(e.type===O9)return i=P9(fCe(i,e,n),{status:"stopped"}),s([i,[]],e,[]),{snapshot:i,microsteps:o};let a=e;if(a.type!==mQe){const c=a,u=wtn(c),f=hCe(c,i);if(u&&!f.length)return i=P9(t,{status:"error",error:c.error}),s([i,[]],c,[]),{snapshot:i,microsteps:o};const h=Ooe(f,t,n,a,!1,r);i=h[0],s(h,c,f)}let l=!0;for(;i.status==="active";){let c=l?enn(i,a):[];const u=c.length?i:void 0;if(!c.length){if(!r.length)break;a=r.shift(),c=hCe(a,i)}const f=Ooe(c,i,n,a,!1,r);i=f[0],l=i!==u,s(f,a,c)}return i.status!=="active"&&fCe(i,a,n),{snapshot:i,microsteps:o}}function fCe(t,e,n){return p_(t,e,n,Object.values(t.children).map(r=>DS(r)),[],void 0)}function hCe(t,e){return e.machine.getTransitionData(e,t)}function enn(t,e){const n=new Set,r=t._nodes.filter(kfe);for(const i of r)e:for(const o of[i].concat(VR(i,void 0)))if(o.always){for(const s of o.always)if(s.guard===void 0||OS(s.guard,t.context,e,t)){n.add(s);break e}}return jQe(Array.from(n),new Set(t._nodes),t.historyValue)}function tnn(t,e){const n=pN(gN(t,e));return EQe(t,[...n])}function nnn(t){return!!t&&typeof t=="object"&&"machine"in t&&"value"in t}const rnn=function(e){return bQe(e,this.value)},inn=function(e){return this.tags.has(e)},onn=function(e){const n=this.machine.getTransitionData(this,e);return!!n?.length&&n.some(r=>r.target!==void 0||r.actions.length)},snn=function(){const{_nodes:e,tags:n,machine:r,getMeta:i,toJSON:o,can:s,hasTag:a,matches:l,...c}=this;return{...c,tags:Array.from(n)}},ann=function(){return this._nodes.reduce((e,n)=>(n.meta!==void 0&&(e[n.id]=n.meta),e),{})};function QM(t,e){return{status:t.status,output:t.output,error:t.error,machine:e,context:t.context,_nodes:t._nodes,value:EQe(e.root,t._nodes),tags:new Set(t._nodes.flatMap(n=>n.tags)),children:t.children,historyValue:t.historyValue||{},matches:rnn,hasTag:inn,can:onn,getMeta:ann,toJSON:snn}}function P9(t,e={}){return QM({...t,...e},t.machine)}function lnn(t){if(typeof t!="object"||t===null)return{};const e={};for(const n in t){const r=t[n];Array.isArray(r)&&(e[n]=r.map(i=>({id:i.id})))}return e}function cnn(t,e){const{_nodes:n,tags:r,machine:i,children:o,context:s,can:a,hasTag:l,matches:c,getMeta:u,toJSON:f,...h}=t,p={};for(const g in o){const y=o[g];p[g]={snapshot:y.getPersistedSnapshot(e),src:y.src,systemId:y.systemId,syncSnapshot:y._syncSnapshot}}return{...h,context:OQe(s),children:p,historyValue:lnn(h.historyValue)}}function OQe(t){let e;for(const n in t){const r=t[n];if(r&&typeof r=="object")if("sessionId"in r&&"send"in r&&"ref"in r)e??=Array.isArray(t)?t.slice():{...t},e[n]={xstate$$type:wfe,id:r.id};else{const i=OQe(r);i!==r&&(e??=Array.isArray(t)?t.slice():{...t},e[n]=i)}}return e??t}function unn(t,e,n,r,{event:i,id:o,delay:s},{internalQueue:a}){const l=e.machine.implementations.delays;if(typeof i=="string")throw new Error(`Only event objects may be used with raise; use raise({ type: "${i}" }) instead`);const c=typeof i=="function"?i(n,r):i;let u;if(typeof s=="string"){const f=l&&l[s];u=typeof f=="function"?f(n,r):f}else u=typeof s=="function"?s(n,r):s;return typeof u!="number"&&a.push(c),[e,{event:c,id:o,delay:u},void 0]}function dnn(t,e){const{event:n,delay:r,id:i}=e;if(typeof r=="number"){t.defer(()=>{const o=t.self;t.system.scheduler.schedule(o,o,n,r,i)});return}}function w2(t,e){function n(r,i){}return n.type="xstate.raise",n.event=t,n.id=e?.id,n.delay=e?.delay,n.resolve=unn,n.execute=dnn,n}const AZ=new WeakMap;function y0(t){return{config:t,start:(n,r)=>{const{self:i,system:o,emit:s}=r,a={receivers:void 0,dispose:void 0};AZ.set(i,a),a.dispose=t({input:n.input,system:o,self:i,sendBack:l=>{i.getSnapshot().status!=="stopped"&&i._parent&&o._relay(i,i._parent,l)},receive:l=>{a.receivers??=new Set,a.receivers.add(l)},emit:s})},transition:(n,r,i)=>{const o=AZ.get(i.self);return r.type===O9?(n={...n,status:"stopped",error:void 0},AZ.delete(i.self),o.receivers?.clear(),o.dispose?.(),n):(o.receivers?.forEach(s=>s(r)),n)},getInitialSnapshot:(n,r)=>({status:"active",output:void 0,error:void 0,input:r}),getPersistedSnapshot:n=>n,restoreSnapshot:n=>n}}const pCe="xstate.observable.next",yN="xstate.observable.error",bN="xstate.observable.complete";function mli(t){return{config:t,transition:(n,r)=>{if(n.status!=="active")return n;switch(r.type){case pCe:return{...n,context:r.data};case yN:return{...n,status:"error",error:r.data,input:void 0,_subscription:void 0};case bN:return{...n,status:"done",input:void 0,_subscription:void 0};case O9:return n._subscription.unsubscribe(),{...n,status:"stopped",input:void 0,_subscription:void 0};default:return n}},getInitialSnapshot:(n,r)=>({status:"active",output:void 0,error:void 0,context:void 0,input:r,_subscription:void 0}),start:(n,{self:r,system:i,emit:o})=>{n.status!=="done"&&(n._subscription=t({input:n.input,system:i,self:r,emit:o}).subscribe({next:s=>{i._relay(r,r,{type:pCe,data:s})},error:s=>{i._relay(r,r,{type:yN,data:s})},complete:()=>{i._relay(r,r,{type:bN})}}))},getPersistedSnapshot:({_subscription:n,...r})=>r,restoreSnapshot:n=>({...n,_subscription:void 0})}}function PQe(t){return{config:t,transition:(n,r)=>{if(n.status!=="active")return n;switch(r.type){case yN:return{...n,status:"error",error:r.data,input:void 0,_subscription:void 0};case bN:return{...n,status:"done",input:void 0,_subscription:void 0};case O9:return n._subscription.unsubscribe(),{...n,status:"stopped",input:void 0,_subscription:void 0};default:return n}},getInitialSnapshot:(n,r)=>({status:"active",output:void 0,error:void 0,context:void 0,input:r,_subscription:void 0}),start:(n,{self:r,system:i,emit:o})=>{n.status!=="done"&&(n._subscription=t({input:n.input,system:i,self:r,emit:o}).subscribe({next:s=>{r._parent&&i._relay(r,r._parent,s)},error:s=>{i._relay(r,r,{type:yN,data:s})},complete:()=>{i._relay(r,r,{type:bN})}}))},getPersistedSnapshot:({_subscription:n,...r})=>r,restoreSnapshot:n=>({...n,_subscription:void 0})}}const mCe="xstate.promise.resolve",gCe="xstate.promise.reject",zE=new WeakMap;function gli(t){return{config:t,transition:(n,r,i)=>{if(n.status!=="active")return n;switch(r.type){case mCe:{const o=r.data;return{...n,status:"done",output:o,input:void 0}}case gCe:return{...n,status:"error",error:r.data,input:void 0};case O9:return zE.get(i.self)?.abort(),zE.delete(i.self),{...n,status:"stopped",input:void 0};default:return n}},start:(n,{self:r,system:i,emit:o})=>{if(n.status!=="active")return;const s=new AbortController;zE.set(r,s),Promise.resolve(t({input:n.input,system:i,self:r,signal:s.signal,emit:o})).then(l=>{r.getSnapshot().status==="active"&&(zE.delete(r),i._relay(r,r,{type:mCe,data:l}))},l=>{r.getSnapshot().status==="active"&&(zE.delete(r),i._relay(r,r,{type:gCe,data:l}))})},getInitialSnapshot:(n,r)=>({status:"active",output:void 0,error:void 0,input:r}),getPersistedSnapshot:n=>n,restoreSnapshot:n=>n}}function fnn(t,{machine:e,context:n},r,i){const o=(s,a)=>{if(typeof s=="string"){const l=Cfe(e,s);if(!l)throw new Error(`Actor logic '${s}' not implemented in machine '${e.id}'`);const c=Zp(l,{id:a?.id,parent:t.self,syncSnapshot:a?.syncSnapshot,input:typeof a?.input=="function"?a.input({context:n,event:r,self:t.self}):a?.input,src:s,systemId:a?.systemId});return i[c.id]=c,c}else return Zp(s,{id:a?.id,parent:t.self,syncSnapshot:a?.syncSnapshot,input:a?.input,src:s,systemId:a?.systemId})};return(s,a)=>{const l=o(s,a);return i[l.id]=l,t.defer(()=>{l._processingStatus!==m2.Stopped&&l.start()}),l}}function hnn(t,e,n,r,{assignment:i}){if(!e.context)throw new Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");const o={},s={context:e.context,event:n.event,spawn:fnn(t,e,n.event,o),self:t.self,system:t.system};let a={};if(typeof i=="function")a=i(s,r);else for(const c of Object.keys(i)){const u=i[c];a[c]=typeof u=="function"?u(s,r):u}const l=Object.assign({},e.context,a);return[P9(e,{context:l,children:Object.keys(o).length?{...e.children,...o}:e.children}),void 0,void 0]}function qi(t){function e(n,r){}return e.type="xstate.assign",e.assignment=t,e.resolve=hnn,e}const yCe=new WeakMap;function Hx(t,e,n){let r=yCe.get(t);return r?e in r||(r[e]=n()):(r={[e]:n()},yCe.set(t,r)),r[e]}const pnn={},HE=t=>typeof t=="string"?{type:t}:typeof t=="function"?"resolve"in t?{type:t.type}:{type:t.name}:t;class vN{constructor(e,n){if(this.config=e,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=n._parent,this.key=n._key,this.machine=n._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(hQe),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?lCe(this.config.states,(r,i)=>new vN(r,{_parent:this,_key:i,_machine:this.machine})):pnn,this.type==="compound"&&!this.config.initial)throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=this.config.history===!0?"shallow":this.config.history||!1,this.entry=s7(this.config.entry).slice(),this.exit=s7(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type==="final"||!this.parent?this.config.output:void 0,this.tags=s7(e.tags).slice()}_initialize(){this.transitions=Ltn(this),this.config.always&&(this.always=pC(this.config.always).map(e=>B4(this,pQe,e))),Object.keys(this.states).forEach(e=>{this.states[e]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(HE),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map(HE),eventType:null})}:void 0,history:this.history,states:lCe(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map(HE)})),entry:this.entry.map(HE),exit:this.exit.map(HE),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return Hx(this,"invoke",()=>s7(this.config.invoke).map((e,n)=>{const{src:r,systemId:i}=e,o=e.id??cCe(this.id,n),s=typeof r=="string"?r:`xstate.invoke.${cCe(this.id,n)}`;return{...e,src:s,id:o,systemId:i,toJSON(){const{onDone:a,onError:l,...c}=e;return{...c,type:"xstate.invoke",src:s,id:o}}}}))}get on(){return Hx(this,"on",()=>[...this.transitions].flatMap(([n,r])=>r.map(i=>[n,i])).reduce((n,[r,i])=>(n[r]=n[r]||[],n[r].push(i),n),{}))}get after(){return Hx(this,"delayedTransitions",()=>Mtn(this))}get initial(){return Hx(this,"initial",()=>Ntn(this,this.config.initial))}next(e,n){const r=n.type,i=[];let o;const s=Hx(this,`candidates-${r}`,()=>$tn(this,r));for(const a of s){const{guard:l}=a,c=e.context;let u=!1;try{u=!l||OS(l,c,n,e)}catch(f){const h=typeof l=="string"?l:typeof l=="object"?l.type:void 0;throw new Error(`Unable to evaluate guard ${h?`'${h}' `:""}in transition for event '${r}' in state node '${this.id}': +${f.message}`)}if(u){i.push(...a.actions),o=a;break}}return o?[o]:void 0}get events(){return Hx(this,"events",()=>{const{states:e}=this,n=new Set(this.ownEvents);if(e)for(const r of Object.keys(e)){const i=e[r];if(i.states)for(const o of i.events)n.add(`${o}`)}return Array.from(n)})}get ownEvents(){const e=Object.keys(Object.fromEntries(this.transitions)),n=new Set(e.filter(r=>this.transitions.get(r).some(i=>!(!i.target&&!i.actions.length&&!i.reenter))));return Array.from(n)}}const mnn="#";class jfe{constructor(e,n){this.config=e,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=e.id||"(machine)",this.implementations={actors:n?.actors??{},actions:n?.actions??{},delays:n?.delays??{},guards:n?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new vN(e,{_key:this.id,_machine:this}),this.root._initialize(),Ftn(this.root),this.states=this.root.states,this.events=this.root.events}provide(e){const{actions:n,guards:r,actors:i,delays:o}=this.implementations;return new jfe(this.config,{actions:{...n,...e.actions},guards:{...r,...e.guards},actors:{...i,...e.actors},delays:{...o,...e.delays}})}resolveState(e){const n=tnn(this.root,e.value),r=pN(gN(this.root,n));return QM({_nodes:[...r],context:e.context||{},children:{},status:Efe(r,this.root)?"done":e.status||"active",output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,n,r){return jZ(e,n,r,[]).snapshot}microstep(e,n,r){return jZ(e,n,r,[]).microsteps.map(([i])=>i)}getTransitionData(e,n){return Tfe(this.root,e.value,e,n)||[]}_getPreInitialState(e,n,r){const{context:i}=this.config,o=QM({context:typeof i!="function"&&i?i:{},_nodes:[this.root],children:{},status:"active"},this);return typeof i=="function"?p_(o,n,e,[qi(({spawn:a,event:l,self:c})=>i({spawn:a,input:l.input,self:c}))],r,void 0):o}getInitialSnapshot(e,n){const r=yQe(n),i=[],o=this._getPreInitialState(e,r,i),[s]=Ytn(this.root,o,e,r,i),{snapshot:a}=jZ(s,r,e,i);return a}start(e){Object.values(e.children).forEach(n=>{n.getSnapshot().status==="active"&&n.start()})}getStateNodeById(e){const n=xfe(e),r=n.slice(1),i=dH(n[0])?n[0].slice(mnn.length):n[0],o=this.idMap.get(i);if(!o)throw new Error(`Child state node '#${i}' does not exist on machine '${this.id}'`);return mN(o,r)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,n){return cnn(e,n)}restoreSnapshot(e,n){const r={},i=e.children;Object.keys(i).forEach(f=>{const h=i[f],p=h.snapshot,m=h.src,g=typeof m=="string"?Cfe(this,m):m;if(!g)return;const y=Zp(g,{id:f,parent:n.self,syncSnapshot:h.syncSnapshot,snapshot:p,src:m,systemId:h.systemId});r[f]=y});function o(f,h){if(h instanceof vN)return h;try{return f.machine.getStateNodeById(h.id)}catch{}}function s(f,h){if(!h||typeof h!="object")return{};const p={};for(const m in h){const g=h[m];for(const y of g){const b=o(f,y);b&&(p[m]??=[],p[m].push(b))}}return p}const a=s(this.root,e.historyValue),l=QM({...e,children:r,_nodes:Array.from(pN(gN(this.root,e.value))),historyValue:a},this),c=new Set;function u(f,h){if(!c.has(f)){c.add(f);for(const p in f){const m=f[p];if(m&&typeof m=="object"){if("xstate$$type"in m&&m.xstate$$type===wfe){f[p]=h[m.id];continue}u(m,h)}}}}return u(l.context,r),l}}function gnn(t,e,n,r,{event:i}){const o=typeof i=="function"?i(n,r):i;return[e,{event:o},void 0]}function ynn(t,{event:e}){t.defer(()=>t.emit(e))}function yc(t){function e(n,r){}return e.type="xstate.emit",e.event=t,e.resolve=gnn,e.execute=ynn,e}let Poe=(function(t){return t.Parent="#_parent",t.Internal="#_internal",t})({});function bnn(t,e,n,r,{to:i,event:o,id:s,delay:a},l){const c=e.machine.implementations.delays;if(typeof o=="string")throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${o}" }) instead`);const u=typeof o=="function"?o(n,r):o;let f;if(typeof a=="string"){const m=c&&c[a];f=typeof m=="function"?m(n,r):m}else f=typeof a=="function"?a(n,r):a;const h=typeof i=="function"?i(n,r):i;let p;if(typeof h=="string"){if(h===Poe.Parent?p=t.self._parent:h===Poe.Internal?p=t.self:h.startsWith("#_")?p=e.children[h.slice(2)]:p=l.deferredActorIds?.includes(h)?h:e.children[h],!p)throw new Error(`Unable to send event to actor '${h}' from machine '${e.machine.id}'.`)}else p=h||t.self;return[e,{to:p,targetId:typeof h=="string"?h:void 0,event:u,id:s,delay:f},void 0]}function vnn(t,e,n){typeof n.to=="string"&&(n.to=e.children[n.to])}function xnn(t,e){t.defer(()=>{const{to:n,event:r,delay:i,id:o}=e;if(typeof i=="number"){t.system.scheduler.schedule(t.self,n,r,i,o);return}t.system._relay(t.self,n,r.type===ytn?gQe(t.self.id,r.data):r)})}function vw(t,e,n){function r(i,o){}return r.type="xstate.sendTo",r.to=t,r.event=e,r.id=n?.id,r.delay=n?.delay,r.resolve=bnn,r.retryResolve=vnn,r.execute=xnn,r}function Cnn(t,e){return vw(Poe.Parent,t,e)}function wnn(t,e,n,r,{collect:i}){const o=[],s=function(l){o.push(l)};return s.assign=(...a)=>{o.push(qi(...a))},s.cancel=(...a)=>{o.push(_fe(...a))},s.raise=(...a)=>{o.push(w2(...a))},s.sendTo=(...a)=>{o.push(vw(...a))},s.sendParent=(...a)=>{o.push(Cnn(...a))},s.spawnChild=(...a)=>{o.push(Sfe(...a))},s.stopChild=(...a)=>{o.push(DS(...a))},s.emit=(...a)=>{o.push(yc(...a))},i({context:n.context,event:n.event,enqueue:s,check:a=>OS(a,e.context,n.event,e),self:t.self,system:t.system},r),[e,void 0,o]}function _2(t){function e(n,r){}return e.type="xstate.enqueueActions",e.collect=t,e.resolve=wnn,e}function _nn(t,e,n,r,{value:i,label:o}){return[e,{value:typeof i=="function"?i(n,r):i,label:o},void 0]}function Snn({logger:t},{value:e,label:n}){n?t(n,e):t(e)}function knn(t=({context:n,event:r})=>({context:n,event:r}),e){function n(r,i){}return n.type="xstate.log",n.value=t,n.label=e,n.resolve=_nn,n.execute=Snn,n}function Ws(t,e){const n=s7(e);if(!n.some(i=>wQe(t.type,i))){const i=n.length===1?`type matching "${n[0]}"`:`one of types matching "${n.join('", "')}"`;throw new Error(`Expected event ${JSON.stringify(t)} to have ${i}`)}}function Enn(t,e){return new jfe(t,e)}function lm({schemas:t,actors:e,actions:n,guards:r,delays:i}){return{assign:qi,sendTo:vw,raise:w2,log:knn,cancel:_fe,stopChild:DS,enqueueActions:_2,emit:yc,spawnChild:Sfe,createStateConfig:o=>o,createAction:o=>o,createMachine:o=>Enn({...o,schemas:t},{actors:e,actions:n,guards:r,delays:i}),extend:o=>lm({schemas:t,actors:e,actions:{...n,...o.actions},guards:{...r,...o.guards},delays:{...i,...o.delays}})}}var RZ={exports:{}},DZ={};var bCe;function Tnn(){if(bCe)return DZ;bCe=1;var t=Rg(),e=FXe();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;return DZ.useSyncExternalStoreWithSelector=function(c,u,f,h,p){var m=o(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=a(function(){function b(_){if(!v){if(v=!0,x=_,_=h(_),p!==void 0&&g.hasValue){var S=g.value;if(p(S,_))return C=S}return C=_}if(S=C,r(x,_))return S;var k=h(_);return p!==void 0&&p(S,k)?(x=_,S):(x=_,C=k)}var v=!1,x,C,w=f===void 0?null:f;return[function(){return b(u())},w===null?void 0:function(){return b(w())}]},[u,f,h,p]);var y=i(c,m[0],m[1]);return s(function(){g.hasValue=!0,g.value=y},[y]),l(y),y},DZ}var vCe;function Inn(){return vCe||(vCe=1,RZ.exports=Tnn()),RZ.exports}var jnn=Inn();const $Qe=(t,e)=>{e(t);const n=t.getSnapshot().children;n&&Object.values(n).forEach(r=>{$Qe(r,e)})};function Ann(t){const e=[];$Qe(t,r=>{e.push([r,r.getSnapshot()]),r.observers=new Set});const n=t.system.getSnapshot?.();t.stop(),t.system._snapshot=n,e.forEach(([r,i])=>{r._processingStatus=0,r._snapshot=i})}function Rnn(t,...[e]){let[[n,r],i]=E.useState(()=>{const o=Zp(t,e);return[t.config,o]});if(t.config!==n){const o=Zp(t,{...e,snapshot:r.getPersistedSnapshot({__unsafeAllowInlineActors:!0})});i([t.config,o]),r=o}return fN(()=>{r.logic.implementations=t.implementations}),r}function xN(t,...[e,n]){const r=Rnn(t,e);return E.useEffect(()=>{if(!n)return;const i=r.subscribe(hN(n));return()=>{i.unsubscribe()}},[n]),E.useEffect(()=>(r.start(),()=>{Ann(r)}),[r]),r}function Dnn(t,e){return t===e}function $9(t,e,n=Dnn){const r=E.useCallback(s=>{if(!t)return()=>{};const{unsubscribe:a}=t.subscribe({next:s,error:s});return a},[t]),i=E.useCallback(()=>{const s=t?.getSnapshot();if(s&&"status"in s&&s.status==="error")throw s.error;return s},[t]);return jnn.useSyncExternalStoreWithSelector(r,i,i,e,n)}var Vm={},xCe;function Onn(){if(xCe)return Vm;xCe=1,Object.defineProperty(Vm,"__esModule",{value:!0});for(var t=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),e={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},n={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:t?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},r={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},i=1;i<20;i++)r["f"+i]=111+i;function o(h,p,m){p&&!("byKey"in p)&&(m=p,p=null),Array.isArray(h)||(h=[h]);var g=h.map(function(v){return l(v,p)}),y=function(x){return g.some(function(C){return c(C,x)})},b=m==null?y:y(m);return b}function s(h,p){return o(h,p)}function a(h,p){return o(h,{byKey:!0},p)}function l(h,p){var m=p&&p.byKey,g={};h=h.replace("++","+add");var y=h.split("+"),b=y.length;for(var v in e)g[e[v]]=!1;var x=!0,C=!1,w=void 0;try{for(var _=y[Symbol.iterator](),S;!(x=(S=_.next()).done);x=!0){var k=S.value,I=k.endsWith("?")&&k.length>1;I&&(k=k.slice(0,-1));var j=f(k),A=e[j];if(k.length>1&&!A&&!n[k]&&!r[j])throw new TypeError('Unknown modifier: "'+k+'"');(b===1||!A)&&(m?g.key=j:g.which=u(k)),A&&(g[A]=I?null:!0)}}catch(D){C=!0,w=D}finally{try{!x&&_.return&&_.return()}finally{if(C)throw w}}return g}function c(h,p){for(var m in h){var g=h[m],y=void 0;if(g!=null&&(m==="key"&&p.key!=null?y=p.key.toLowerCase():m==="which"?y=g===91&&p.which===93?91:p.which:y=p[m],!(y==null&&g===!1)&&y!==g))return!1}return!0}function u(h){h=f(h);var p=r[h]||h.toUpperCase().charCodeAt(0);return p}function f(h){return h=h.toLowerCase(),h=n[h]||h,h}return Vm.default=o,Vm.isHotkey=o,Vm.isCodeHotkey=s,Vm.isKeyHotkey=a,Vm.parseHotkey=l,Vm.compareHotkey=c,Vm.toKeyCode=u,Vm.toKeyName=f,Vm}var OZ=Onn();function Afe(t){const e=(t.styles??[]).map(r=>({...r,value:r.name})),n=[];if(t.block?.fields)for(const r of t.block.fields){if(r.name==="_type"||r.name==="_key"||r.name==="children"||r.name==="markDefs"||r.name==="style"||r.name==="listItem"||r.name==="level"){console.warn(`"${r.name}" is a reserved field name on Portable Text blocks`);continue}n.push(r)}return{block:{name:t.block?.name??"block",...n.length>0?{fields:n}:{}},span:{name:"span"},styles:e.some(r=>r.value==="normal")?e:[{value:"normal",name:"normal",title:"Normal"},...e],lists:(t.lists??[]).map(r=>({...r,value:r.name})),decorators:(t.decorators??[]).map(r=>({...r,value:r.name})),annotations:(t.annotations??[]).map(r=>({...r,fields:r.fields??[]})),blockObjects:(t.blockObjects??[]).map(r=>({...r,fields:r.fields??[]})),inlineObjects:(t.inlineObjects??[]).map(r=>({...r,fields:r.fields??[]}))}}function MQe(t){return Pnn(t)&&typeof t._type=="string"}function Pnn(t){return!!t&&(typeof t=="object"||typeof t=="function")}function qn(t,e){return!(!MQe(e)||e._type!==t.schema.block.name||!Array.isArray(e.children))}function Ci(t,e){return!(!MQe(e)||e._type!==t.schema.span.name||typeof e.text!="string")}function yd({context:t,block:e}){if(qn(t,e.node)){const n=e.node.children[e.node.children.length-1];if(n)return{path:[...e.path,"children",{_key:n._key}],offset:Ci(t,n)?n.text.length:0}}return{path:e.path,offset:0}}function Nh({context:t,block:e}){if(qn(t,e.node)){const n=e.node.children[0];return{path:[...e.path,"children",{_key:n?._key??""}],offset:0}}return{path:e.path,offset:0}}function Y1(t){return typeof t=="object"&&t!==null&&"_key"in t}function LQe(t,e){return t===e?!0:t===void 0||e===void 0?!1:(typeof t=="string"||typeof t=="number")&&(typeof e=="string"||typeof e=="number")?t===e:Y1(t)&&Y1(e)?t._key===e._key:Array.isArray(t)&&Array.isArray(e)?t[0]===e[0]&&t[1]===e[1]:!1}function Rfe(t,e){if(t.length!==e.length)return!1;for(let n=0;na.text.length){r-=a.text.length;continue}if(r<=a.text.length&&(i={path:[...e.path,"children",{_key:a._key}],offset:r},r-=a.text.length,r!==0))break}return i}function m_({context:t,selectionPoint:e}){let n=0;const r=Wa(e),i=b1(e);if(!(!r||!i)){for(const o of t.value)if(o._key===r&&qn(t,o)){for(const s of o.children)if(Ci(t,s)){if(s._key===i)return{path:[{_key:o._key}],offset:n+e.offset};n+=s.text.length}}}}function D0(t){return t?t.backward?t.anchor:t.focus:null}function Bh(t){return t?t.backward?t.focus:t.anchor:null}function pd(t,e){return t.offset===e.offset&&Rfe(t.path,e.path)}function PS(t){return FQe(t)&&typeof t._type=="string"}function FQe(t){return!!t&&(typeof t=="object"||typeof t=="function")}function $nn({context:t,blocks:e,options:n}){return Array.isArray(e)?e.flatMap(r=>{const i=b0({context:t,block:r,options:n});return i?[i]:[]}):[]}function b0({context:t,block:e,options:n}){return Lnn({block:e,context:t,options:n})??Mnn({blockObject:e,context:t,options:n})}function Mnn({blockObject:t,context:e,options:n}){if(!PS(t))return;const r=e.schema.blockObjects.find(({name:i})=>i===t._type);if(r)return fH({object:t,context:{keyGenerator:e.keyGenerator,schemaType:r},options:n})}function I2(t,e){return qn(t,e)&&e.level!==void 0&&e.listItem!==void 0}function Lnn({block:t,context:e,options:n}){if(!PS(t))return;const r={};for(const h of Object.keys(t))h==="_type"||h==="_key"||h==="children"||h==="markDefs"||h==="style"||h==="listItem"||h==="level"||(n.validateFields?e.schema.block.fields?.some(p=>p.name===h)&&(r[h]=t[h]):r[h]=t[h]);if(t._type!==e.schema.block.name)return;const i=typeof t._key=="string"?t._key:e.keyGenerator(),{markDefs:o,markDefKeyMap:s}=NQe({context:e,markDefs:t.markDefs,options:n}),a=(Array.isArray(t.children)?t.children:[]).map(h=>Fnn({child:h,context:e,markDefKeyMap:s,options:n})).filter(h=>h!==void 0),l=a.flatMap(h=>h.marks??[]),c=a.length>0?a:[{_key:e.keyGenerator(),_type:e.schema.span.name,text:"",marks:[]}],u=n.normalize?c.reduce((h,p,m)=>{if(Ci(e,p))return[...h,p];const g=h.at(-1);return!g||!Ci(e,g)?[...h,{_key:e.keyGenerator(),_type:e.schema.span.name,text:"",marks:[]},p,...m===c.length-1?[{_key:e.keyGenerator(),_type:e.schema.span.name,text:"",marks:[]}]:[]]:[...h,p]},[]):c,f={_type:e.schema.block.name,_key:i,children:u,...r};return typeof t.markDefs=="object"&&t.markDefs!==null&&(f.markDefs=n.removeUnusedMarkDefs?o.filter(h=>l.includes(h._key)):o),typeof t.style=="string"&&e.schema.styles.find(h=>h.name===t.style)&&(f.style=t.style),typeof t.listItem=="string"&&e.schema.lists.find(h=>h.name===t.listItem)&&(f.listItem=t.listItem),typeof t.level=="number"&&(f.level=t.level),f}function NQe({context:t,markDefs:e,options:n}){const r=Array.isArray(e)?e:[],i=new Map;return{markDefs:r.flatMap(o=>{if(!PS(o))return[];const s=t.schema.annotations.find(({name:l})=>l===o._type);if(!s)return[];if(typeof o._key!="string")return[];const a=fH({object:o,context:{schemaType:s,keyGenerator:t.keyGenerator},options:n});return a?(i.set(o._key,a._key),[a]):[]}),markDefKeyMap:i}}function Fnn({child:t,context:e,markDefKeyMap:n,options:r}){return BQe({span:t,context:e,markDefKeyMap:n,options:r})??VQe({inlineObject:t,context:e,options:r})}function BQe({span:t,context:e,markDefKeyMap:n,options:r}){if(!FQe(t))return;const i={};for(const s of Object.keys(t))s!=="_type"&&s!=="_key"&&s!=="text"&&s!=="marks"&&(i[s]=t[s]);const o=(Array.isArray(t.marks)?t.marks:[]).flatMap(s=>{if(typeof s!="string")return[];const a=n.get(s);return a!==void 0?[a]:e.schema.decorators.some(l=>l.name===s)?[s]:[]});if(!(typeof t._type=="string"&&t._type!==e.schema.span.name))return typeof t._type!="string"?typeof t.text=="string"?{_type:e.schema.span.name,_key:typeof t._key=="string"?t._key:e.keyGenerator(),text:t.text,marks:o,...r.validateFields?{}:i}:void 0:{_type:e.schema.span.name,_key:typeof t._key=="string"?t._key:e.keyGenerator(),text:typeof t.text=="string"?t.text:"",marks:o,...r.validateFields?{}:i}}function VQe({inlineObject:t,context:e,options:n}){if(!PS(t))return;const r=e.schema.inlineObjects.find(({name:i})=>i===t._type);if(r)return fH({object:t,context:{keyGenerator:e.keyGenerator,schemaType:r},options:n})}function Nnn({annotation:t,context:e,options:n}){if(!PS(t))return;const r=e.schema.annotations.find(({name:i})=>i===t._type);if(r)return fH({object:t,context:{keyGenerator:e.keyGenerator,schemaType:r},options:n})}function fH({object:t,context:e,options:n}){const{_type:r,_key:i,...o}=t,s=n.validateFields?e.schemaType.fields.reduce((a,l)=>{const c=t[l.name];return c!==void 0&&(a[l.name]=c),a},{}):o;return{_type:e.schemaType.name,_key:typeof t._key=="string"?t._key:e.keyGenerator(),...s}}const ug=()=>znn(12),Bnn=(()=>{let t;return()=>{if(t)return t;t=[];for(let e=0;e<256;++e)t[e]=(e+256).toString(16).slice(1);return t}})();function Vnn(t=16){const e=new Uint8Array(t);return crypto.getRandomValues(e),e}function znn(t){const e=Bnn();return Vnn(t).reduce((n,r)=>n+e[r],"").slice(0,t)}function CCe({context:t,blocks:e}){const n=[];if(!t.selection)return n;let r;const i=[];let o;const s=Bh(t.selection),a=D0(t.selection),l=Wa(s),c=b1(s),u=Wa(a),f=b1(a);if(!l||!u)return n;for(const m of e){if(!qn(t,m)&&m._key===l&&m._key===u){r=m;break}if(m._key===l){if(!qn(t,m)){r=m;continue}if(c){for(const g of m.children){if(g._key===c){if(Ci(t,g)){const y=g._key===f?g.text.slice(s.offset,a.offset):g.text.slice(s.offset);r={...m,children:[{...g,text:y}]}}else r={...m,children:[g]};if(m._key===u&&c===f)break;continue}if(r&&qn(t,r)&&(f&&g._key===f&&Ci(t,g)?r.children.push({...g,text:g.text.slice(0,a.offset)}):r.children.push(g),m._key===u&&f&&g._key===f))break}if(l===u)break;continue}if(r=m,l===u)break}if(m._key===u){if(!qn(t,m)){o=m;break}if(f){o={...m,children:[]};for(const g of m.children)if(o&&qn(t,o)){if(g._key===f&&Ci(t,g)){o.children.push({...g,text:g.text.slice(0,a.offset)});break}if(o.children.push(g),f&&g._key===f)break}break}o=m;break}r&&i.push(b0({context:{schema:t.schema,keyGenerator:t.keyGenerator??ug},block:m,options:{normalize:!1,removeUnusedMarkDefs:!0,validateFields:!1}})??m)}const h=r?b0({context:{schema:t.schema,keyGenerator:t.keyGenerator??ug},block:r,options:{normalize:!1,removeUnusedMarkDefs:!0,validateFields:!1}}):void 0,p=o?b0({context:{schema:t.schema,keyGenerator:t.keyGenerator??ug},block:o,options:{normalize:!1,removeUnusedMarkDefs:!0,validateFields:!1}}):void 0;return[...h?[h]:[],...i,...p?[p]:[]]}const wCe=t=>typeof t=="object"&&t!=null&&t.nodeType===1,_Ce=(t,e)=>(!e||t!=="hidden")&&t!=="visible"&&t!=="clip",LP=(t,e)=>{if(t.clientHeight{const i=(o=>{if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeightoe||o>t&&s=e&&a>=n?o-t-r:s>e&&an?s-e+i:0,Hnn=t=>{const e=t.parentElement;return e??(t.getRootNode().host||null)},SCe=(t,e)=>{var n,r,i,o;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:l,boundary:c,skipOverflowHiddenElements:u}=e,f=typeof c=="function"?c:M=>M!==c;if(!wCe(t))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let m=t;for(;wCe(m)&&f(m);){if(m=Hnn(m),m===h){p.push(m);break}m!=null&&m===document.body&&LP(m)&&!LP(document.documentElement)||m!=null&&LP(m,u)&&p.push(m)}const g=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(o=(i=window.visualViewport)==null?void 0:i.height)!=null?o:innerHeight,{scrollX:b,scrollY:v}=window,{height:x,width:C,top:w,right:_,bottom:S,left:k}=t.getBoundingClientRect(),{top:I,right:j,bottom:A,left:D}=(M=>{const L=window.getComputedStyle(M);return{top:parseFloat(L.scrollMarginTop)||0,right:parseFloat(L.scrollMarginRight)||0,bottom:parseFloat(L.scrollMarginBottom)||0,left:parseFloat(L.scrollMarginLeft)||0}})(t);let O=a==="start"||a==="nearest"?w-I:a==="end"?S+A:w+x/2-I+A,P=l==="center"?k+C/2-D+j:l==="end"?_+j:k-D;const $=[];for(let M=0;M=0&&k>=0&&S<=y&&_<=g&&(L===h&&!LP(L)||w>=N&&S<=G&&k>=z&&_<=V))return $;const Y=getComputedStyle(L),Z=parseInt(Y.borderLeftWidth,10),ee=parseInt(Y.borderTopWidth,10),K=parseInt(Y.borderRightWidth,10),q=parseInt(Y.borderBottomWidth,10);let re=0,te=0;const ae="offsetWidth"in L?L.offsetWidth-L.clientWidth-Z-K:0,se="offsetHeight"in L?L.offsetHeight-L.clientHeight-ee-q:0,le="offsetWidth"in L?L.offsetWidth===0?0:W/L.offsetWidth:0,pe="offsetHeight"in L?L.offsetHeight===0?0:B/L.offsetHeight:0;if(h===L)re=a==="start"?O:a==="end"?O-y:a==="nearest"?FP(v,v+y,y,ee,q,v+O,v+O+x,x):O-y/2,te=l==="start"?P:l==="center"?P-g/2:l==="end"?P-g:FP(b,b+g,g,Z,K,b+P,b+P+C,C),re=Math.max(0,re+v),te=Math.max(0,te+b);else{re=a==="start"?O-N-ee:a==="end"?O-G+q+se:a==="nearest"?FP(N,G,B,ee,q+se,O,O+x,x):O-(N+B/2)+se/2,te=l==="start"?P-z-Z:l==="center"?P-(z+W/2)+ae/2:l==="end"?P-V+K+ae:FP(z,V,W,Z,K+ae,P,P+C,C);const{scrollLeft:be,scrollTop:xe}=L;re=pe===0?0:Math.max(0,Math.min(xe+re/pe,L.scrollHeight-B/pe+se)),te=le===0?0:Math.max(0,Math.min(be+te/le,L.scrollWidth-W/le+ae)),O+=xe-re,P+=be-te}$.push({el:L,top:re,left:te})}return $},Unn=t=>t===!1?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&Object.keys(e).length!==0)(t)?t:{block:"start",inline:"nearest"};function M9(t,e){if(!t.isConnected||!(i=>{let o=i;for(;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(t))return;const n=(i=>{const o=window.getComputedStyle(i);return{top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(t);if((i=>typeof i=="object"&&typeof i.behavior=="function")(e))return e.behavior(SCe(t,e));const r=typeof e=="boolean"||e==null?void 0:e.behavior;for(const{el:i,top:o,left:s}of SCe(t,Unn(e))){const a=o-n.top+n.bottom,l=s-n.left+n.right;i.scroll({top:a,left:l,behavior:r})}}function zQe(t){return t.children.map(e=>e.text??"").join("")}function c1(t,e){if(!qn(t,e))return!1;const n=e.children.every(i=>Ci(t,i)),r=zQe(e);return n&&r===""}function Dfe({context:t,block:e}){const n=Bh(t.selection),r=D0(t.selection);if(!n||!r)return e;const i=Wa(n),o=Wa(r);if(i!==o||i!==e._key)return e;const s=b1(n),a=b1(r);if(!s||!a)return e;let l=!1;const c=[];for(const u of e.children){if(u._key===s){if(l=!0,Ci(t,u)){const f=u._key===a?u.text.slice(n.offset,r.offset):u.text.slice(n.offset);c.push({...u,text:f})}else c.push(u);if(s===a)break;continue}if(u._key===a){Ci(t,u)?c.push({...u,text:u.text.slice(0,r.offset)}):c.push(u);break}l&&c.push(u)}return{...e,children:c}}function kCe(t){const e=t.at(0);return t.length===1&&e!==void 0&&Wnn(e)&&"_key"in e&&typeof e._key=="string"}function Wnn(t){return!!t&&(typeof t=="object"||typeof t=="function")}function qnn(t){return t?!J3(t):!1}const B0=t=>{if(!t.context.selection)return;const e=Wa(t.context.selection.focus),n=e?t.blockIndexMap.get(e):void 0,r=n!==void 0?t.context.value.at(n):void 0;return r&&e?{node:r,path:[{_key:e}]}:void 0},$s=t=>{const e=B0(t);return e&&qn(t.context,e.node)?{node:e.node,path:e.path}:void 0},$S=t=>{if(!t.context.selection)return;const e=$s(t);if(!e)return;const n=b1(t.context.selection.focus),r=n?e.node.children.find(i=>i._key===n):void 0;return r&&n?{node:r,path:[...e.path,"children",{_key:n}]}:void 0},Sg=t=>{const e=$S(t);return e&&Ci(t.context,e.node)?{node:e.node,path:e.path}:void 0},Cv=t=>{const e=D0(t.context.selection);if(e)return B0({...t,context:{...t.context,selection:{anchor:e,focus:e}}})},i6=t=>{if(t.context.selection)return t.context.selection.backward?t.context.selection.anchor:t.context.selection.focus},HQe=t=>{const e=Cv(t),n=i6(t);if(!e||!n||!qn(t.context,e.node))return;const r=b1(n);let i=!1,o;for(const s of e.node.children){if(s._key===r){i=!0;continue}if(Ci(t.context,s)&&i){o={node:s,path:[...e.path,"children",{_key:s._key}]};break}}return o},wv=t=>{const e=Bh(t.context.selection);if(e)return B0({...t,context:{...t.context,selection:{anchor:e,focus:e}}})},qg=t=>{if(t.context.selection)return t.context.selection.backward?t.context.selection.focus:t.context.selection.anchor},UQe=t=>{const e=wv(t),n=qg(t);if(!e||!n||!qn(t.context,e.node))return;const r=b1(n);let i;for(const o of e.node.children){if(o._key===r)break;Ci(t.context,o)&&(i={node:o,path:[...e.path,"children",{_key:o._key}]})}return i};function WQe(t){const e=t?.filter;return n=>{const r=qg(n),i=i6(n);if(!r||!i)return[];const o=Wa(r),s=Wa(i),a=b1(r),l=b1(i);if(!o||!s)return[];const c=n.blockIndexMap.get(o),u=n.blockIndexMap.get(s);if(c===void 0||u===void 0)return[];const f=[],h=Math.min(c,u),p=Math.max(c,u),m=n.context.value.slice(h,p+1);let g=!1;for(const y of m){if(!qn(n.context,y))continue;const b=y._key===o,v=y._key===s,x=!b&&!v;for(const C of y.children){const w=C._key===a,_=C._key===l,S=()=>{(!e||e(C))&&f.push({node:C,path:[{_key:y._key},"children",{_key:C._key}]})};if(x){S();continue}if(w){if(g=!0,Ci(n.context,C)?r.offset0&&S():S();break}g&&S()}if(b&&o===s)break;b&&(g=!0)}return f}}const Ofe=t=>t.context.selection?WQe({filter:e=>Ci(t.context,e)})(t):[],MS=t=>{if(!t.context.selection)return;let e=t.context.selection;if(!$s(t))return;if(kCe(e.anchor.path)){const x=v8({context:t.context,blockOffset:{path:e.anchor.path,offset:e.anchor.offset},direction:e.backward?"backward":"forward"});e=x?{...e,anchor:x}:e}if(kCe(e.focus.path)){const x=v8({context:t.context,blockOffset:{path:e.focus.path,offset:e.focus.offset},direction:e.backward?"backward":"forward"});e=x?{...e,focus:x}:e}const n=Sg({...t,context:{...t.context,selection:e}});if(!n)return;if(qnn(e)){const x=Ofe({...t,context:{...t.context,selection:e}});let C=0,w=[];for(const _ of x){if(C===0)w=_.node.marks??[];else{if(_.node.marks?.length===0){w=[];continue}w=w.filter(S=>(_.node.marks??[]).some(k=>k===S))}C++}return{state:"unchanged",marks:w}}const r=t.context.schema.decorators.map(x=>x.name),i=n.node.marks??[],o=i.filter(x=>r.includes(x)),s=i.length>o.length,a=n.node.text.length===0,l=t.context.selection.anchor.offset===0,c=t.context.selection.anchor.offset===n.node.text.length,u=UQe({...t,context:{...t.context,selection:e}}),f=HQe({...t,context:{...t.context,selection:e}}),h=f?.node?.marks?.filter(x=>!r.includes(x))??[],p=i.filter(x=>!r.includes(x)),m=u?u.node.marks?.some(x=>!r.includes(x)):!1,g=u?u.node.marks?.filter(x=>!r.includes(x)).every(x=>i.includes(x)):!1,y=u?u.node.marks?.some(x=>!r.includes(x)&&i.includes(x)):!1,b=u?u.node.marks?.every(x=>i.includes(x)):!1,v=p.some(x=>h?.includes(x));if(s&&!a){if(l){if(b)return{state:"changed",previousMarks:i,marks:u?.node.marks??[]};if(g)return{state:"changed",previousMarks:i,marks:u?.node.marks??[]};if(y)return{state:"unchanged",marks:n.node.marks??[]};if(!u)return{state:"changed",previousMarks:i,marks:[]}}if(c){if(!f)return{state:"changed",previousMarks:i,marks:[]};if(h.length>0&&!v)return{state:"changed",previousMarks:i,marks:[]};if(v&&h.lengthr.includes(x))}:{state:"unchanged",marks:i}},V0=t=>{if(!t.context.selection)return[];const e=[],n=Bh(t.context.selection),r=D0(t.context.selection),i=Wa(n),o=Wa(r);if(!i||!o)return e;const s=t.blockIndexMap.get(i),a=t.blockIndexMap.get(o);if(s===void 0||a===void 0)return e;const l=t.context.value.slice(s,a+1);for(const c of l){if(c._key===i){if(e.push({node:c,path:[{_key:c._key}]}),i===o)break;continue}if(c._key===o){e.push({node:c,path:[{_key:c._key}]});break}e.length>0&&e.push({node:c,path:[{_key:c._key}]})}return e},Gnn=t=>{if(!t.context.selection)return[];const e=V0(t),n=(MS(t)?.marks??[]).filter(r=>!t.context.schema.decorators.map(i=>i.name).includes(r));return e.flatMap(r=>qn(t.context,r.node)?r.node.markDefs??[]:[]).filter(r=>n.includes(r._key))},Ynn=t=>{if(!t.context.selection)return;const e=V0(t).map(i=>i.node).filter(i=>qn(t.context,i)),n=e.at(0);if(!n)return;const r=n.listItem;if(r&&e.every(i=>i.listItem===r))return r},Knn=t=>{if(!t.context.selection)return;const e=V0(t).map(i=>i.node).filter(i=>qn(t.context,i)),n=e.at(0);if(!n)return;const r=n.style;if(r&&e.every(i=>i.style===r))return r},Xnn=t=>{const e=$s(t),n=i6(t),r=n&&Y1(n.path[2])?n.path[2]._key:void 0;if(!e||!r)return;let i=!1,o;for(const s of e.node.children){if(s._key===r){i=!0;continue}if(!Ci(t.context,s)&&i){o={node:s,path:[...e.path,"children",{_key:s._key}]};break}}return o},x8=t=>{const e=$s(t),n=qg(t),r=n&&Y1(n.path[2])?n.path[2]._key:void 0;if(!e||!r)return;let i;for(const o of e.node.children){if(o._key===r)break;Ci(t.context,o)||(i={node:o,path:[...e.path,"children",{_key:o._key}]})}return i},v7=t=>{const e=t.context.selection;if(!e)return[];const n=Bh(e),r=D0(e),i=Wa(n),o=Wa(r);if(!i||!o)return[];const s=t.blockIndexMap.get(i),a=t.blockIndexMap.get(o);if(s===void 0||a===void 0)return[];const l=t.context.value.at(s),c=l?CCe({context:t.context,blocks:[l]}).at(0):void 0;if(s===a)return c?[c]:[];const u=t.context.value.at(a),f=u?CCe({context:t.context,blocks:[u]}).at(0):void 0,h=t.context.value.slice(s+1,a);return[...c?[c]:[],...h,...f?[f]:[]]},$oe=t=>v7(t).reduce((e,n)=>qn(t.context,n)?e+n.children.reduce((r,i)=>Ci(t.context,i)?r+i.text:r,""):e,""),hl=t=>t.context.selection?Rfe(t.context.selection.anchor.path,t.context.selection.focus.path)&&t.context.selection.anchor.offset===t.context.selection.focus.offset:!1,cm=t=>t.context.selection!==null&&!hl(t),Znn=t=>{if(!t.context.selection||!hl(t))return null;const e=$s(t),n=qg(t),r=n?m_({context:t.context,selectionPoint:n}):void 0;if(!e||!n||!r)return null;const i=x8(t),o=Nh({context:t.context,block:e}),s=$oe({...t,context:{...t.context,selection:{anchor:i?{path:i.path,offset:0}:o,focus:n}}}).split(/\s+/).at(-1),a=Xnn(t),l=yd({context:t.context,block:e}),c=$oe({...t,context:{...t.context,selection:{anchor:n,focus:a?{path:a.path,offset:0}:l}}}).split(/\s+/).at(0);if((s===void 0||s==="")&&(c===void 0||c===""))return null;const u=s?{...r,offset:r.offset-s.length}:r,f=c?{...r,offset:r.offset+c.length}:r,h=v8({context:t.context,blockOffset:u,direction:"backward"}),p=v8({context:t.context,blockOffset:f,direction:"forward"});if(!h||!p)return null;const m={anchor:h,focus:p};return cm({context:{...t.context,selection:m}})?m:null},LS=t=>{const e=B0(t);return e&&!qn(t.context,e.node)?{node:e.node,path:e.path}:void 0},xw=t=>{const e=$S(t);return e&&!Ci(t.context,e.node)?{node:e.node,path:e.path}:void 0},zR=t=>{const e=$s(t);return e&&I2(t.context,e.node)?{node:e.node,path:e.path}:void 0},ECe=t=>{const e=t.context.value[t.context.value.length-1]?t.context.value[t.context.value.length-1]:void 0;return e?{node:e,path:[{_key:e._key}]}:void 0},C8=t=>{const e=Cv(t);if(!e)return;const n=t.blockIndexMap.get(e.node._key);if(n===void 0||n===t.context.value.length-1)return;const r=t.context.value.at(n+1);return r?{node:r,path:[{_key:r._key}]}:void 0},o6=t=>{const e=wv(t);if(!e)return;const n=t.blockIndexMap.get(e.node._key);if(n===void 0||n===0)return;const r=t.context.value.at(n-1);return r?{node:r,path:[{_key:r._key}]}:void 0},CN=t=>{if(!t.context.selection)return[];const e=[],n=Bh(t.context.selection),r=D0(t.context.selection),i=Wa(n),o=Wa(r);if(!i||!o)return e;const s=t.blockIndexMap.get(i),a=t.blockIndexMap.get(o);if(s===void 0||a===void 0)return e;const l=t.context.value.slice(s,a+1);for(const c of l){if(c._key===i){if(qn(t.context,c)&&e.push({node:c,path:[{_key:c._key}]}),i===o)break;continue}if(c._key===o){qn(t.context,c)&&e.push({node:c,path:[{_key:c._key}]});break}e.length>0&&qn(t.context,c)&&e.push({node:c,path:[{_key:c._key}]})}return e},Qnn=t=>{const e=D0(t.context.selection);if(e)return $S({...t,context:{...t.context,selection:{anchor:e,focus:e}}})},Jnn=t=>{const e=Bh(t.context.selection);if(e)return $S({...t,context:{...t.context,selection:{anchor:e,focus:e}}})};function Pfe(t){const e=t.context.schema;return(MS(t)?.marks??[]).filter(n=>!e.decorators.map(r=>r.name).includes(n))}function wN(t,e){return n=>{if((e?.mode??"full")==="partial")return v7(n).flatMap(o=>qn(n.context,o)?o.markDefs??[]:[]).some(o=>o._type===t);const r=V0(n).flatMap(o=>qn(n.context,o.node)?o.node.markDefs??[]:[]),i=Pfe(n);return r.filter(o=>o._type===t&&i.includes(o._key)).length>0}}function g_(t){const e=t.context.schema,n=t.decoratorState,r=MS(t),i=e.decorators.map(s=>s.name);let o=(r?.marks??[]).filter(s=>i.includes(s));for(const s in n)n[s]===!1?o=o.filter(a=>a!==s):n[s]===!0&&(o.includes(s)||o.push(s));return o}function Moe(t){return e=>{if(cm(e)){const n=Ofe(e);return n.length>0&&n.every(r=>r.node.marks?.includes(t))}return g_(e).includes(t)}}function TCe(t){return e=>Ynn(e)===t}function ICe(t){return e=>Knn(e)===t}function qQe(t){return e=>{if(!e.context.selection||!hl(e))return!1;const n=yd({context:e.context,block:t});return pd(e.context.selection.focus,n)}}function GQe(t){return e=>{if(!e.context.selection||!hl(e))return!1;const n=Nh({context:e.context,block:t});return pd(e.context.selection.focus,n)}}function Ux(t,e,n){const r=Wa(e),i=Wa(n);if(!r)throw new Error(`Cannot compare points: no block key found for ${e}`);if(!i)throw new Error(`Cannot compare points: no block key found for ${n}`);const o=t.blockIndexMap.get(r),s=t.blockIndexMap.get(i);if(o===void 0)throw new Error(`Cannot compare points: block "${r}" not found`);if(s===void 0)throw new Error(`Cannot compare points: block "${i}" not found`);if(os)return 1;const a=t.context.value.at(o);if(!a||!qn(t.context,a))return 0;const l=b1(e),c=b1(n);if(!l)throw new Error(`Cannot compare points: no child key found for ${e}`);if(!c)throw new Error(`Cannot compare points: no child key found for ${n}`);let u,f;for(let h=0;hn.offset?1:0;if(p._key===l&&(u=h),p._key===c&&(f=h),u!==void 0&&f!==void 0)break}}if(u===void 0)throw new Error(`Cannot compare points: child "${l}" not found`);if(f===void 0)throw new Error(`Cannot compare points: child "${c}" not found`);return uf?1:0}function JM(t){return e=>{const n=e.context.selection;if(!t||!n)return!1;const r=Bh(t),i=D0(t),o=Bh(n),s=D0(n),a=Wa(r),l=Wa(i),c=Wa(o),u=Wa(s);if(!a||!l||!c||!u)return!1;const f=e.blockIndexMap.get(a),h=e.blockIndexMap.get(l),p=e.blockIndexMap.get(c),m=e.blockIndexMap.get(u);if(f===void 0||h===void 0||p===void 0||m===void 0)return!1;const[g,y]=f<=h?[f,h]:[h,f],[b,v]=p<=m?[p,m]:[m,p];return yv?!1:ern(e,r,i,o,s)}}function ern(t,e,n,r,i){if(pd(e,r)&&pd(n,i))return!0;const o=Ux(t,e,r),s=Ux(t,e,i),a=Ux(t,n,r),l=Ux(t,n,i),c=Ux(t,r,e),u=Ux(t,i,n),f=o===-1,h=s===1,p=a===-1,m=l===1,g=c===-1,y=c===1,b=u===-1,v=u===1,x=pd(e,i),C=pd(n,r);return!C&&!x&&!g&&!y&&!b&&!v||p&&!C||h&&!x?!1:!g&&y&&!b&&v?!C:g&&!y&&b&&!v?!x:!h||!f||!m||!p}const Loe=t=>{if(!t.context.selection)return!1;const e=t.context.selection.backward?t.context.selection.focus:t.context.selection.anchor,n=t.context.selection.backward?t.context.selection.anchor:t.context.selection.focus,r=wv(t),i=Cv(t);if(!r||!i)return!1;const o=Nh({context:t.context,block:r}),s=yd({context:t.context,block:i});return pd(o,e)&&pd(s,n)};function v0(t){return{type:"forward",event:t}}function Et(t){return{type:"raise",event:t}}function r9(t){return{type:"effect",effect:t}}var PZ,jCe;function trn(){if(jCe)return PZ;jCe=1;function t(e,n,r,i){var o=-1,s=e==null?0:e.length;for(i&&s&&(r=e[++o]);++oo?0:o+n),r=r>o?o:r,r<0&&(r+=o),o=n>r?0:r-n>>>0,n>>>=0;for(var s=Array(o);++i=o?n:t(n,r,i)}return VZ=e,VZ}var zZ,LCe;function KQe(){if(LCe)return zZ;LCe=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=e+n+r,o="\\ufe0e\\ufe0f",s="\\u200d",a=RegExp("["+s+t+i+o+"]");function l(c){return a.test(c)}return zZ=l,zZ}var HZ,FCe;function lrn(){if(FCe)return HZ;FCe=1;function t(e){return e.split("")}return HZ=t,HZ}var UZ,NCe;function crn(){if(NCe)return UZ;NCe=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=e+n+r,o="\\ufe0e\\ufe0f",s="["+t+"]",a="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",c="(?:"+a+"|"+l+")",u="[^"+t+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",p="\\u200d",m=c+"?",g="["+o+"]?",y="(?:"+p+"(?:"+[u,f,h].join("|")+")"+g+m+")*",b=g+m+y,v="(?:"+[u+a+"?",a,f,h,s].join("|")+")",x=RegExp(l+"(?="+l+")|"+v+b,"g");function C(w){return w.match(x)||[]}return UZ=C,UZ}var WZ,BCe;function urn(){if(BCe)return WZ;BCe=1;var t=lrn(),e=KQe(),n=crn();function r(i){return e(i)?n(i):t(i)}return WZ=r,WZ}var qZ,VCe;function drn(){if(VCe)return qZ;VCe=1;var t=arn(),e=KQe(),n=urn(),r=ES();function i(o){return function(s){s=r(s);var a=e(s)?n(s):void 0,l=a?a[0]:s.charAt(0),c=a?t(a,1).join(""):s.slice(1);return l[o]()+c}}return qZ=i,qZ}var GZ,zCe;function XQe(){if(zCe)return GZ;zCe=1;var t=drn(),e=t("toUpperCase");return GZ=e,GZ}var YZ,HCe;function frn(){if(HCe)return YZ;HCe=1;var t=srn(),e=XQe(),n=t(function(r,i,o){return r+(o?" ":"")+e(i)});return YZ=n,YZ}var hrn=frn();const E2=rs(hrn);var KZ,UCe;function prn(){if(UCe)return KZ;UCe=1;function t(e,n){for(var r=-1,i=e==null?0:e.length;++r0&&o(u)?i>1?n(u,i-1,o,s,a):t(a,u):s||(a[a.length]=u)}return a}return RQ=n,RQ}var DQ,Iwe;function rJe(){if(Iwe)return DQ;Iwe=1;var t=Bfe();function e(n){var r=n==null?0:n.length;return r?t(n,1):[]}return DQ=e,DQ}var OQ,jwe;function Nrn(){if(jwe)return OQ;jwe=1;function t(e,n,r){switch(r.length){case 0:return e.call(n);case 1:return e.call(n,r[0]);case 2:return e.call(n,r[0],r[1]);case 3:return e.call(n,r[0],r[1],r[2])}return e.apply(n,r)}return OQ=t,OQ}var PQ,Awe;function iJe(){if(Awe)return PQ;Awe=1;var t=Nrn(),e=Math.max;function n(r,i,o){return i=e(i===void 0?r.length-1:i,0),function(){for(var s=arguments,a=-1,l=e(s.length-i,0),c=Array(l);++a0){if(++o>=t)return arguments[0]}else o=0;return i.apply(void 0,arguments)}}return LQ=r,LQ}var FQ,Pwe;function oJe(){if(Pwe)return FQ;Pwe=1;var t=Vrn(),e=zrn(),n=e(t);return FQ=n,FQ}var NQ,$we;function sJe(){if($we)return NQ;$we=1;var t=rJe(),e=iJe(),n=oJe();function r(i){return n(e(i,void 0,t),i+"")}return NQ=r,NQ}var BQ,Mwe;function Hrn(){if(Mwe)return BQ;Mwe=1;var t=kS(),e=tJe(),n=Mrn(),r=TS(),i=HR(),o=Lrn(),s=sJe(),a=Ffe(),l=1,c=2,u=4,f=s(function(h,p){var m={};if(h==null)return m;var g=!1;p=t(p,function(b){return b=r(b,h),g||(g=b.length>1),b}),i(h,a(h),m),g&&(m=e(m,l|c|u,o));for(var y=p.length;y--;)n(m,p[y]);return m});return BQ=f,BQ}var Urn=Hrn();const Wrn=rs(Urn);var VQ,Lwe;function qrn(){if(Lwe)return VQ;Lwe=1;var t=$fe(),e=TS(),n=R1e(),r=J8(),i=bv();function o(s,a,l,c){if(!r(s))return s;a=e(a,s);for(var u=-1,f=a.length,h=f-1,p=s;p!=null&&++u-1}return tJ=e,tJ}var nJ,Qwe;function uJe(){if(Qwe)return nJ;Qwe=1;function t(e,n,r){for(var i=-1,o=e==null?0:e.length;++i=s){var b=c?null:i(l);if(b)return o(b);m=!1,h=r,y=new t}else y=c?[]:g;e:for(;++f({name:o.name,type:e(Wrn(o,"name"))}))},r=Object.assign(So(hJ,c_e),n,{type:hJ});return gl(r,ns,n),i(r);function i(o){return{get(){return o},extend:s=>{if(s.of)throw new Error('Cannot override `of` property of subtypes of "array"');const a=So(s,c_e),l=Object.assign({},o,a,{type:o});return gl(l,ns,a),i(l)}}}}},u_e=[...of],pJ={name:"array",type:null,jsonType:"array",of:[]},Oin={get(){return pJ},extend(t,e){const n=Object.assign(So(pJ,u_e),t,{type:pJ});return Vo(n,"of",()=>t.of.map(i=>e.cached(i))),Vo(n,ns,()=>({...t,of:n.of}),{enumerable:!1,writable:!1}),r(n);function r(i){return{get(){return i},extend:o=>{if(o.of)throw new Error('Cannot override `of` property of subtypes of "array"');const s=So(o,u_e),a=Object.assign({},i,s,{type:i});return gl(a,ns,s),r(a)}}}}};function Pin(t){t.options&&t.options.preview&&console.warn(`Heads up! The preview config is no longer defined on "options", but instead on the type/field itself. +Please move {options: {preview: ...}} to {..., preview: ...} on the type/field definition of "${t.name}". +`)}function $in(t){const e=t.preview||(t.options||{}).preview;e&&"fields"in e&&console.warn(`Heads up! "preview.fields" should be renamed to "preview.select". Please update the preview config for "${t.name}". +`)}function Min(t){for(const e in t)if(t.hasOwnProperty(e))return!1;return!0}function Foe(t,e,n){if(n>e.maxDepth)return"...";if(Array.isArray(t)){if(t.length===0)return"[empty]";const i=Math.max(t.length-e.maxBreadth),o=t.slice(0,e.maxBreadth).map((s,a)=>Foe(s,e,n+1)).concat(i>0?`…+${i}`:[]).join(", ");return n===0?o:`[${o}]`}if(typeof t=="object"&&t!==null){const i=Object.keys(t).filter(s=>!e.ignoreKeys.includes(s)&&typeof t[s]<"u");if(Min(So(t,i)))return"{empty}";const o=i.slice(0,e.maxBreadth).map(s=>`${s}: ${Foe(t[s],e,n+1)}`).join(", ");return n===0?o:`{${o}}`}const r=String(t);return r===""?'""':r}function Lin(t,e={}){const n={maxDepth:"maxDepth"in e?e.maxDepth:2,maxBreadth:"maxBreadth"in e?e.maxBreadth:2,ignoreKeys:"ignoreKeys"in e?e.ignoreKeys:[]};return Foe(t,n,0)}const Fin={maxEntries:2,maxDepth:2,maxBreadth:2,ignoreKeys:["_id","_type","_key","_ref"]};function Nin(t){return e=>({title:Lin(So(e,t),Fin)})}function Bin(t){return t.type==="array"&&t.of&&t.of.some(e=>e.type==="block")||!1}const hJe=["title","name","label","heading","header","caption"],Vin=["description",...hJe];function pJe(t,e){return V2(t.to||[]).some(n=>n.type===e)}function d_e(t){return pJe(t,"sanity.imageAsset")}function zin(t){const e=t.fields||[],n=e.find(d_e);if(n)return n.name;const r=e.find(i=>(i.fields||[]).some(d_e));return r?`${r.name}.asset`:void 0}function f_e(t){return pJe(t,"sanity.fileAsset")}function Hin(t){const e=t.fields||[],n=e.find(f_e);if(n)return n.name;const r=e.find(i=>(i.fields||[]).some(f_e));return r?`${r.name}.asset`:void 0}function Uin(t){const e={fields:[],...t},n=e.fields.filter(l=>l.type==="string").map(l=>l.name),r=e.fields.filter(Bin).map(l=>l.name);let i=hJe.find(l=>n.includes(l)||r.includes(l)),o=Vin.find(l=>l!==i&&(n.includes(l)||r.includes(l)));i||(i=n[0]||r[0],o=n[1]||r[1]);const s=e.fields.find(l=>l.type==="image"),a=zin(e);if(!i){const l=Hin(e);l&&(i=`${l}.originalFilename`),a&&(i=`${a}.originalFilename`)}if(!i&&!a){const l=e.fields.map(c=>c.name);return{select:l.reduce((c,u)=>(c[u]=u,c),{}),prepare:Nin(l)}}return{select:rin({title:i,description:o,media:s?s.name:a},Qrn)}}function Win(t){return t.reduce((e,n)=>(e[n]=n,e),{})}function qin(t){if(!t)return t;const e=t.select||t.fields||{};return Array.isArray(e)?{...So(t,["prepare","component"]),select:Win(e)}:{...So(t,["prepare","component"]),select:e}}function UR(t){return function(){return Pin(t),$in(t),qin(t.preview||(t.options||{}).preview)||Uin(t)}}const Gin={type:"object",name:"link",title:"Link",i18nTitleKey:"inputs.portable-text.annotation.link",options:{modal:{type:"popover"}},fields:[{name:"href",type:"url",title:"Link",description:"A valid web, email, phone, or relative link.",validation:t=>t.uri({scheme:["http","https","tel","mailto"],allowRelative:!0})}]},Yin={type:"text",name:"text",title:"Text"},Kin={name:"marks",type:"array",of:[{type:"string"}],title:"Marks"},h_e={bullet:{title:"Bulleted list",value:"bullet",i18nTitleKey:"inputs.portable-text.list-type.bullet"},numbered:{title:"Numbered list",value:"number",i18nTitleKey:"inputs.portable-text.list-type.number"}},Xin=[h_e.bullet,h_e.numbered],V3={normal:{title:"Normal",value:"normal",i18nTitleKey:"inputs.portable-text.style.normal"},h1:{title:"Heading 1",value:"h1",i18nTitleKey:"inputs.portable-text.style.h1"},h2:{title:"Heading 2",value:"h2",i18nTitleKey:"inputs.portable-text.style.h2"},h3:{title:"Heading 3",value:"h3",i18nTitleKey:"inputs.portable-text.style.h3"},h4:{title:"Heading 4",value:"h4",i18nTitleKey:"inputs.portable-text.style.h4"},h5:{title:"Heading 5",value:"h5",i18nTitleKey:"inputs.portable-text.style.h5"},h6:{title:"Heading 6",value:"h6",i18nTitleKey:"inputs.portable-text.style.h6"},blockquote:{title:"Quote",value:"blockquote",i18nTitleKey:"inputs.portable-text.style.quote"}},Zin=[V3.normal,V3.h1,V3.h2,V3.h3,V3.h4,V3.h5,V3.h6,V3.blockquote],Qin={title:"Strong",value:"strong",i18nTitleKey:"inputs.portable-text.decorator.strong"},Jin={title:"Italic",value:"em",i18nTitleKey:"inputs.portable-text.decorator.emphasis"},eon={title:"Code",value:"code",i18nTitleKey:"inputs.portable-text.decorator.code"},ton={title:"Underline",value:"underline",i18nTitleKey:"inputs.portable-text.decorator.underline"},non={title:"Strike",value:"strike-through",i18nTitleKey:"inputs.portable-text.decorator.strike-through"},UE={strong:Qin,em:Jin,code:eon,underline:ton,strikeThrough:non},ron=[UE.strong,UE.em,UE.code,UE.underline,UE.strikeThrough],p_e=["type","name","title","jsonType","description","options","fieldsets","icon"],mJ={name:"block",title:"Block",type:null,jsonType:"object"},ion={},oon={get(){return mJ},extend(t,e){const n={...t.options||ion},{marks:r,styles:i,lists:o,of:s,...a}=t,l=con(r,s),c=aon(i),u=lon(o),f={name:"markDefs",title:"Mark definitions",type:"array",of:r?.annotations||mJe},h=[l,c,u,f,{name:"level",title:"Indentation",type:"number"}].concat(t.fields||[]),p={...a,options:n},m=Object.assign(So(mJ,p_e),p,{type:mJ});return Vo(m,"fields",()=>h.map(y=>e.cachedField(y))),Vo(m,"preview",UR(t)),Vo(m,ns,()=>({...p,fields:m.fields,preview:m.preview}),{enumerable:!1,writable:!1}),g(m);function g(y){return{get(){return y},extend:b=>{if(b.fields)throw new Error('Cannot override `fields` of subtypes of "block"');const v=So(b,p_e),x=Object.assign({},y,v,{type:y});return gl(x,ns,v),g(x)}}}}};function son(t){return t.some(e=>e.value==="normal")?t:[V3.normal,...t]}function aon(t){return{name:"style",title:"Style",type:"string",options:{list:son(t||Zin)}}}function lon(t){return{name:"listItem",title:"List type",type:"string",options:{list:t||Xin}}}const mJe=[Gin];function con(t,e=[]){return{name:"children",title:"Content",type:"array",of:[{type:"span",fields:[Yin,Kin],annotations:t&&t.annotations?t.annotations:mJe,decorators:t&&t.decorators?t.decorators:ron},...e.filter(n=>n.type!=="span")]}}const m_e=["type","name","title","jsonType","description","options","fieldsets","icon"],gJ={name:"span",title:"Span",type:null,jsonType:"object"},uon={name:"marks",title:"Marks",type:"array",of:[{type:"string"}]},don={name:"text",title:"Text",type:"string"},fon={},hon={get(){return gJ},extend(t,e){const n={...t.options||fon},{annotations:r=[],marks:i=[]}=t,o=[uon,don],s={...t,options:n},a=Object.assign(So(gJ,m_e),s,{type:gJ});return Vo(a,"fields",()=>o.map(c=>e.cachedField(c))),Vo(a,"annotations",()=>r.map(e)),Vo(a,"marks",()=>i.map(e)),Vo(a,"preview",UR(t)),Vo(a,ns,()=>({...s,fields:a.fields,annotations:a.annotations,marks:a.marks,preview:a.preview}),{enumerable:!1,writable:!1}),l(a);function l(c){return{get(){return c},extend:u=>{if(u.fields)throw new Error('Cannot override `fields` of subtypes of "span"');const f=So(u,m_e),h=Object.assign({},c,f,{type:c});return gl(h,ns,f),l(h)}}}}};var s6={prepare:t=>({title:String(t)})};const g_e=[...of],yJ={name:"boolean",title:"Boolean",type:null,jsonType:"boolean"},pon={get(){return yJ},extend(t){const e={...t,preview:s6},n=Object.assign(So(yJ,g_e),e,{type:yJ});return gl(n,ns,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=So(o,g_e),a=Object.assign({},i,s,{type:i});return gl(a,ns,s),r(a)}}}}},y_e=5,bJ={},gJe=t=>(bJ[t]||(bJ[t]=Symbol(`__cachedStringFields_${t}`)),bJ[t]),mon=t=>t.type&&t.type.name==="reference",gon=["style","list"],Vfe=t=>t.name==="block"||t.type&&Vfe(t.type),yon=t=>t.jsonType==="array"&&Array.isArray(t.of)&&t.of.some(Vfe);function hH(t,e,n,r=[],i){if(i<0)return n;const o=e(n,t,r);return t.jsonType==="array"&&Array.isArray(t.of)?bon(t,e,o,r,i):t.jsonType==="object"&&Array.isArray(t.fields)&&!mon(t)?von(t,e,o,r,i):o}function bon(t,e,n,r,i){return t.of.reduce((o,s)=>hH(s,e,o,r,i-1),n)}function von(t,e,n,r,i){const o=Vfe(t);return t.fields.reduce((s,a)=>{if(o&&gon.includes(a.name))return s;const l=[a.name].concat(a.type.jsonType==="array"?[[]]:[]);return hH(a.type,e,s,r.concat(l),i-1)},n)}const yJe=[{weight:1,path:["_id"]},{weight:1,path:["_type"]}],b_e={title:10,subtitle:5,description:1.5};function bJe(t,e){const n=t?.preview?.select;if(!n)return[];const r=[];for(const i of Object.keys(n)){if(!(i in b_e))continue;const o=n[i].split(".");e>-1&&o.length-1>e||r.push({weight:b_e[i],path:o})}return r}function xon(t,e){const n=gJe(e);return t[n]||(t[n]=fJe([...yJe,...bJe(t,e),...won(t,e).map(r=>({weight:1,path:r})),..._on(t,e).map(r=>({weight:1,path:r,mapWith:"pt::text"}))],r=>r.path.join("."))),t[n]}function Con(t,e){const n=gJe(e);return t[n]||(t[n]=fJe([...yJe,...bJe(t,e)],r=>r.path.join("."))),t[n]}function won(t,e){return hH(t,(n,r,i)=>r.jsonType==="string"?[...n,i]:n,[],[],e)}function _on(t,e){return hH(t,(n,r,i)=>yon(r)?[...n,i]:n,[],[],e)}function Son(t,e){return Con(t,vJe(e))}function kon(t,e){return xon(t,vJe(e))}function vJe(t){return!lin(t)||t<1||t>y_e?y_e-1:t-1}const Eon={name:"_ref",title:"Referenced document ID",type:"string"},Ton={name:"_weak",title:"Weak reference marker",type:"boolean"},Ion={name:"_dataset",title:"Target dataset",type:"string"},jon={name:"_projectId",title:"Target project ID",type:"string",hidden:!0},Aon=[Eon,Ton,Ion,jon],v_e=[...of],vJ={name:"crossDatasetReference",type:null,jsonType:"object"};function Ron(t,e){const n=t.length;if(n===1)return t[0];const r=t.slice(0,n-1),i=t[n-1];return`${r.join(", ")} ${e} ${i}`}function Don(t){return!t.to||t.to.length===0?"Cross dataset Reference":`Cross dataset reference to ${Ron(V2(t.to).map(e=>e.title||lJe(e.type)),"or").toLowerCase()}`}const Oon={get(){return vJ},extend(t,e){if(!t.to)throw new Error(`Missing "to" field in cross dataset reference definition. Check the type ${t.name}`);const n=Object.assign(So(vJ,v_e),t,{type:vJ});return Vo(n,"fields",()=>Aon.map(i=>e.cachedField(i))),Vo(n,"to",()=>V2(t.to).map(i=>({...i,__experimental_search:Son(i)}))),Vo(n,"title",()=>t.title||Don(n)),Vo(n,ns,()=>({...t,fields:n.fields,to:n.to,title:n.title}),{enumerable:!1,writable:!1}),r(n);function r(i){return{get(){return i},extend:o=>{if(o.of)throw new Error('Cannot override `of` of subtypes of "reference"');const s=So(o,v_e),a=Object.assign({},i,s,{type:i});return gl(a,ns,s),r(a)}}}}},x_e=[...of],xJ={name:"date",title:"Datetime",type:null,jsonType:"string"},Pon={get(){return xJ},extend(t){const e={...t,preview:s6},n=Object.assign(So(xJ,x_e),e,{type:xJ});return gl(n,ns,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=So(o,x_e),a=Object.assign({},i,s,{type:i});return gl(a,ns,s),r(a)}}}}},C_e=[...of],CJ={name:"datetime",title:"Datetime",type:null,jsonType:"string"},$on={get(){return CJ},extend(t){const e={...t,preview:s6},n=Object.assign(So(CJ,C_e),e,{type:CJ});return gl(n,ns,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=So(o,C_e),a=Object.assign({},i,s,{type:i});return gl(a,ns,s),r(a)}}}}},Mon=["title","name","label","heading","header","caption","description"],Lon=["string","boolean","number"],w_e=t=>Lon.includes(t.type);function Fon(t){let e=Mon.filter(n=>t.fields.some(r=>w_e(r)&&r.name===n));return e.length===0&&(e=t.fields.filter(w_e).map(n=>n.name)),e.map(n=>({name:n,i18n:{title:{key:`default-orderings.${n}`,ns:"studio"}},title:lJe(E2(n)),by:[{field:n,direction:"asc"}]}))}function __e(t){if(!Array.isArray(t))throw new Error("The search config of a document type must be an array of search config objects");return t.map(e=>{if(e==="defaults")return e;if(!Ein(e))throw new Error("Search config must be an object of {path: string, weight: number}");return{weight:"weight"in e?e.weight:1,path:jin(e.path),mapWith:typeof e.mapWith=="string"?e.mapWith:void 0}})}const wJ=[...of,"orderings","__experimental_search","blockEditor","icon"],xJe={get(){return{name:"object",title:"Object",type:null,jsonType:"object"}},extend(t,e){const n={fields:[],...t},r={...n.options},i={...n,title:n.title||(n.name?E2(n.name):"Object"),options:r,orderings:n.orderings||Fon(n),fields:n.fields.map(a=>e.cachedObjectField(a))},o=Object.assign(So(this.get(),wJ),i,{type:this.get()});return Vo(o,"fieldsets",()=>pH(n,o.fields)),Vo(o,"groups",()=>Non(n,o.fields)),Vo(o,"preview",UR(n)),Vo(o,ns,()=>({...i,preview:o.preview}),{enumerable:!1,writable:!1}),Vo(o,"__experimental_search",()=>{const a=n.__experimental_search?__e(n.__experimental_search):null;return a?a.map(l=>l==="defaults"?__e(n):l):kon(o)},{enumerable:!1}),s(o);function s(a){return{get(){return a},extend:l=>{if(l.fields)throw new Error('Cannot override `fields` of subtypes of "object"');const c=So(l,wJ);c.title=l.title||n.title||(n.name?E2(n.name):"Object");const u=Object.assign({},a,So(l,wJ),{type:a});return Vo(u,"__experimental_search",()=>a.__experimental_search),gl(u,ns,c),s(u)}}}}};function pH(t,e){const n={};for(const i of t.fieldsets||[]){if(n[i.name])throw new Error(`Duplicate fieldset name "${i.name}" found for type '${t.title?t.title:E2(t.name)}'`);n[i.name]={title:E2(i.name),...i,fields:[]}}const r=new Set;for(const i of e){if(!i.fieldset){r.add({single:!0,field:i});continue}const o=n[i.fieldset];if(!o)throw new Error(`Fieldset '${i.fieldset}' is not defined in schema for type '${t.name}'`);o.fields.push(i),r.add(o)}return Array.from(r)}function Non(t,e){const n={};let r=0;for(const i of t.groups||[]){if(n[i.name])throw new Error(`Duplicate group name "${i.name}" found for type '${t.title?t.title:E2(t.name)}'`);if(n[i.name]={title:E2(i.name),...i,fields:[]},i.default&&++r>1)throw new Error(`More than one field group defined as default for type '${t.title?t.title:E2(t.name)}' - only 1 is supported`)}return e.forEach(i=>{const o=vin(i.group||[]);o.length!==0&&o.forEach(s=>{const a=n[s];if(!a)throw new Error(`Field group '${s}' is not defined in schema for type '${t.title?t.name:E2(t.name)}'`);a.fields.push(i)})}),Sin(n).filter(i=>i.fields.length>0||i.name===Rin)}const Bon={name:"document",title:"Document",type:null,jsonType:"object"},Von={get(){return Bon},extend:xJe.extend},S_e=[...of],RI={name:"email",title:"Email",type:null,jsonType:"string"};Vo(RI,ns,()=>({...RI,validation:t=>t.email()}),{enumerable:!1});const zon={get(){return RI},extend(t){const e={...t,preview:s6},n=Object.assign(So(RI,S_e),e,{type:RI});return gl(n,ns,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=So(o,S_e),a=Object.assign({},i,s,{type:i});return gl(a,ns,s),r(a)}}}}},Hon={name:"asset",type:"reference",to:{type:"sanity.fileAsset"}},Uon={name:"media",type:"globalDocumentReference",hidden:!0,to:[{type:"sanity.asset"}]},k_e=[...of],NP={name:"file",title:"File",type:null,jsonType:"object"},Won={accept:""},qon={get(){return NP},extend(t,e){const n={...t.options||Won},r=[Hon,Uon,...t.fields||[]],i={...t,fields:r},o=Object.assign(So(NP,k_e),i,{type:NP,title:i.title||(i.name?E2(i.name):NP.title),options:n,fields:i.fields.map(a=>{const{name:l,fieldset:c,...u}=a,f={name:l,fieldset:c,isCustomized:!!t.fields};return Vo(f,"type",()=>e({...u,title:a.title||E2(l)}))})});return Vo(o,"fieldsets",()=>pH(i,o.fields)),Vo(o,"preview",UR(Object.assign({},i,{fields:r}))),Vo(o,ns,()=>({...i,options:n,fields:o.fields,title:o.title,fieldsets:o.fieldsets,preview:o.preview}),{enumerable:!1,writable:!1}),s(o);function s(a){return{get(){return a},extend:l=>{if(l.fields)throw new Error('Cannot override `fields` of subtypes of "file"');const c=So(l,k_e),u=Object.assign({},a,c,{type:a});return gl(u,ns,c),s(u)}}}}},Gon={name:"_ref",title:"Referenced document ID",type:"string"},Yon={name:"_weak",title:"Weak reference",type:"boolean"},Kon=[Gon,Yon],E_e=[...of],_J={name:"globalDocumentReference",title:"Global Document Reference",type:null,jsonType:"object"};function Xon(t,e){const n=t.length;if(n===1)return t[0];const r=t.slice(0,n-1),i=t[n-1];return`${r.join(", ")} ${e} ${i}`}function Zon(t){return!t.to||t.to.length===0?"Global Document Reference":`Global Document Reference to ${Xon(V2(t.to).map(e=>e.title),"or").toLowerCase()}`}const Qon={get(){return _J},extend(t,e){if(!t.to)throw new Error(`Missing "to" field in global document reference definition. Check the type ${t.name}`);const n=Object.assign(So(_J,E_e),t,{type:_J});return Vo(n,"fields",()=>Kon.map(i=>e.cachedField(i))),Vo(n,"to",()=>V2(t.to).map(i=>({...i}))),Vo(n,"title",()=>t.title||Zon(n)),Vo(n,ns,()=>({...t,fields:n.fields,to:n.to,title:n.title}),{enumerable:!1,writable:!1}),r(n);function r(i){return{get(){return i},extend:o=>{if(o.of)throw new Error('Cannot override `of` of subtypes of "globalDocumentReference"');const s=So(o,E_e),a=Object.assign({},i,s,{type:i});return gl(a,ns,s),r(a)}}}}},Jon={name:"asset",type:"reference",to:[{type:"sanity.imageAsset"}]},esn={name:"hotspot",type:"sanity.imageHotspot"},tsn={name:"crop",type:"sanity.imageCrop"},nsn={name:"media",type:"globalDocumentReference",hidden:!0,to:[{type:"sanity.asset"}]},T_e=[...of],SJ={name:"image",title:"Image",type:null,jsonType:"object"},rsn={},isn={get(){return SJ},extend(t,e){const n={...t.options||rsn};let r=[esn,tsn];n.hotspot||(r=r.map(l=>({...l,hidden:!0})));const i=[Jon,nsn,...r,...t.fields||[]],o={...t,fields:i},s=Object.assign(So(this.get(),T_e),o,{type:SJ,title:o.title||(o.name?E2(o.name):SJ.title),options:n,fields:o.fields.map(l=>{const{name:c,fieldset:u,...f}=l,h={name:c,fieldset:u,isCustomized:!!t.fields};return Vo(h,"type",()=>e({...f,title:l.title||E2(c)}))})});return Vo(s,"fieldsets",()=>pH(o,s.fields)),Vo(s,"preview",UR(Object.assign({},o,{fields:i}))),Vo(s,ns,()=>({...o,options:n,fields:s.fields,title:s.title,fieldsets:s.fieldsets,preview:s.preview}),{enumerable:!1,writable:!1}),a(s);function a(l){return{get(){return l},extend:c=>{if(c.fields)throw new Error('Cannot override `fields` of subtypes of "image"');const u=So(c,T_e),f=Object.assign({},l,u,{type:l});return gl(f,ns,u),a(f)}}}}},I_e=[...of],kJ={name:"number",title:"Number",type:null,jsonType:"number"},osn={get(){return kJ},extend(t){const e={...t,preview:s6},n=Object.assign(So(kJ,I_e),e,{type:kJ});return gl(n,ns,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=So(o,I_e),a=Object.assign({},i,s,{type:i});return gl(a,ns,s),r(a)}}}}},ssn={name:"_ref",title:"Referenced document ID",type:"string"},asn={name:"_weak",title:"Weak reference",type:"boolean"},lsn=[ssn,asn],j_e=[...of],EJ={name:"reference",title:"Reference",type:null,jsonType:"object"};function csn(t,e){const n=t.length;if(n===1)return t[0];const r=t.slice(0,n-1),i=t[n-1];return`${r.join(", ")} ${e} ${i}`}function usn(t){return!t.to||t.to.length===0?"Reference":`Reference to ${csn(V2(t.to).map(e=>e.title),"or").toLowerCase()}`}const dsn={get(){return EJ},extend(t,e){if(!t.to)throw new Error(`Missing "to" field in reference definition. Check the type ${t.name}`);const n=Object.assign(So(EJ,j_e),t,{type:EJ});return Vo(n,"fields",()=>lsn.map(i=>e.cachedField(i))),Vo(n,"fieldsets",()=>pH(t,n.fields)),Vo(n,"to",()=>V2(t.to).map(i=>e(i))),Vo(n,"title",()=>t.title||usn(n)),Vo(n,ns,()=>({...t,fields:n.fields,fieldsets:n.fieldsets,to:n.to,title:n.title}),{enumerable:!1,writable:!1}),r(n);function r(i){return{get(){return i},extend:o=>{if(o.of)throw new Error('Cannot override `of` of subtypes of "reference"');const s=So(o,j_e),a=Object.assign({},i,s,{type:i});return gl(a,ns,s),r(a)}}}}},A_e=[...of],TJ={name:"string",title:"String",type:null,jsonType:"string"},fsn={get(){return TJ},extend(t){const e={...t,preview:s6},n=Object.assign(So(TJ,A_e),e,{type:TJ});return gl(n,ns,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=So(o,A_e),a=Object.assign({},i,s,{type:i});return gl(a,ns,s),r(a)}}}}},R_e=[...of,"rows"],IJ={name:"text",title:"Text",type:null,jsonType:"string"},hsn={get(){return IJ},extend(t){const e={...t,preview:s6},n=Object.assign(So(IJ,R_e),e,{type:IJ});return gl(n,ns,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=So(o,R_e),a=Object.assign({},i,s,{type:i});return gl(a,ns,s),r(a)}}}}},D_e=[...of],jJ={name:"url",title:"Url",type:null,jsonType:"string"},psn={get(){return jJ},extend(t){const e={...t,preview:s6},n=Object.assign(So(jJ,D_e),e,{type:jJ});return gl(n,ns,e),r(n);function r(i){return{get(){return i},extend:o=>{const s=So(o,D_e),a=Object.assign({},i,s,{type:i});return gl(a,ns,s),r(a)}}}}};var O_e=Object.freeze({__proto__:null,any:Din,array:Oin,block:oon,boolean:pon,crossDatasetReference:Oon,date:Pon,datetime:$on,document:Von,email:zon,file:qon,globalDocumentReference:Qon,image:isn,number:osn,object:xJe,reference:dsn,span:hon,string:fsn,text:hsn,url:psn});function msn(t){const e=Object.create(null);let n;t.parent?(Object.assign(e,t.parent._registry),n=[]):(Object.assign(e,O_e),n=Object.keys(O_e));const r=t.types.reduce((f,h)=>{if(f[h.name])throw new Error(`Duplicate type name added to schema: ${h.name}`);return f[h.name]=h,f},{}),i=new Map,o=new Map,s=new Map,a=Object.assign(c,{cached(f){let h=i.get(f);return h||(h=c(f),i.set(f,h)),h},cachedField(f){let h=o.get(f);if(!h){const{name:p,...m}=f;h={name:p,type:c(m)},o.set(f,h)}return h},cachedObjectField(f){let h=s.get(f);if(!h){const{name:p,fieldset:m,group:g,...y}=f;h={name:p,group:g,fieldset:m},Vo(h,"type",()=>c({...y,title:f.title||E2(p)})),s.set(f,h)}return h}});return t.types.forEach(u),{registry:e,localTypeNames:n};function l(f){if(!e[f]){if(!r[f])throw new Error(`Unknown type: ${f}`);u(r[f])}}function c(f){return l(f.type),e[f.type].extend(f,a).get()}function u(f){l(f.type),!e[f.name]&&(n.push(f.name),e[f.name]=e[f.type].extend(f,c))}}let CJe=class wJe{_original;_registry;#t;static compile(e){return new wJe(e)}constructor(e){this._original=e;const{registry:n,localTypeNames:r}=msn(e);this._registry=n,this.#t=r}get name(){return this._original.name}get parent(){return this._original.parent}get(e){return this._registry[e]&&this._registry[e].get()}has(e){return e in this._registry}getTypeNames(){return Object.keys(this._registry)}getLocalTypeNames(){return this.#t}};const _Je=CJe;var AJ,P_e;function gsn(){if(P_e)return AJ;P_e=1;var t=U1e();function e(n,r){return t(n,r)}return AJ=e,AJ}gsn();J8();var RJ,$_e;function ysn(){if($_e)return RJ;$_e=1;var t=N1e(),e=cJe(),n=uJe(),r=kS(),i=Bz(),o=B1e(),s=200;function a(l,c,u,f){var h=-1,p=e,m=!0,g=l.length,y=[],b=c.length;if(!g)return y;u&&(c=r(c,i(u))),f?(p=n,m=!1):c.length>=s&&(p=o,m=!1,c=new t(c));e:for(;++ht.required()},{name:"bottom",type:"number",validation:t=>t.required()},{name:"left",type:"number",validation:t=>t.required()},{name:"right",type:"number",validation:t=>t.required()}]},Tsn={name:"sanity.imageDimensions",type:"object",title:"Image dimensions",fields:[{name:"height",type:"number",title:"Height",readOnly:!0,validation:t=>t.required()},{name:"width",type:"number",title:"Width",readOnly:!0,validation:t=>t.required()},{name:"aspectRatio",type:"number",title:"Aspect ratio",readOnly:!0,validation:t=>t.required()}]},Isn={name:"sanity.imageHotspot",title:"Image hotspot",type:"object",fields:[{name:"x",type:"number",validation:t=>t.required()},{name:"y",type:"number",validation:t=>t.required()},{name:"height",type:"number",validation:t=>t.required()},{name:"width",type:"number",validation:t=>t.required()}]},jsn={name:"sanity.imageMetadata",title:"Image metadata",type:"object",fieldsets:[{name:"extra",title:"Extra metadata…",options:{collapsable:!0}}],fields:[{name:"location",type:"geopoint"},{name:"dimensions",title:"Dimensions",type:"sanity.imageDimensions",fieldset:"extra"},{name:"palette",type:"sanity.imagePalette",title:"Palette",fieldset:"extra"},{name:"lqip",title:"LQIP (Low-Quality Image Placeholder)",type:"string",readOnly:!0},{name:"blurHash",title:"BlurHash",type:"string",readOnly:!0},{name:"hasAlpha",title:"Has alpha channel",type:"boolean",readOnly:!0},{name:"isOpaque",title:"Is opaque",type:"boolean",readOnly:!0}]},Asn={name:"sanity.imagePalette",title:"Image palette",type:"object",fields:[{name:"darkMuted",type:"sanity.imagePaletteSwatch",title:"Dark Muted"},{name:"lightVibrant",type:"sanity.imagePaletteSwatch",title:"Light Vibrant"},{name:"darkVibrant",type:"sanity.imagePaletteSwatch",title:"Dark Vibrant"},{name:"vibrant",type:"sanity.imagePaletteSwatch",title:"Vibrant"},{name:"dominant",type:"sanity.imagePaletteSwatch",title:"Dominant"},{name:"lightMuted",type:"sanity.imagePaletteSwatch",title:"Light Muted"},{name:"muted",type:"sanity.imagePaletteSwatch",title:"Muted"}]},Rsn={name:"sanity.imagePaletteSwatch",title:"Image palette swatch",type:"object",fields:[{name:"background",type:"string",title:"Background",readOnly:!0},{name:"foreground",type:"string",title:"Foreground",readOnly:!0},{name:"population",type:"number",title:"Population",readOnly:!0},{name:"title",type:"string",title:"String",readOnly:!0}]},Dsn={title:"Slug",name:"slug",type:"object",fields:[{name:"current",title:"Current slug",type:"string",validation:t=>t.required()},{name:"source",title:"Source field",type:"string",hidden:!0}]};const SJe=[wsn,Dsn,Ssn,ksn,_sn,Esn,Isn,jsn,Tsn,Asn,Rsn],Osn=[{name:"array",jsonType:"array",type:"type"},{name:"block",jsonType:"object",type:"type"},{name:"boolean",jsonType:"boolean",type:"type"},{name:"datetime",jsonType:"string",type:"type"},{name:"date",jsonType:"string",type:"type"},{name:"document",jsonType:"object",type:"type"},{name:"email",jsonType:"string",type:"type"},{name:"file",jsonType:"object",type:"type"},{name:"geopoint",jsonType:"object",type:"type"},{name:"image",jsonType:"object",type:"type"},{name:"number",jsonType:"number",type:"type"},{name:"object",jsonType:"object",type:"type"},{name:"reference",jsonType:"object",type:"type"},{name:"crossDatasetReference",jsonType:"object",type:"type"},{name:"globalDocumentReference",jsonType:"object",type:"type"},{name:"slug",jsonType:"object",type:"type"},{name:"span",jsonType:"object",type:"type"},{name:"string",jsonType:"string",type:"type"},{name:"telephone",jsonType:"string",type:"type"},{name:"text",jsonType:"string",type:"type"},{name:"url",jsonType:"string",type:"type"}];Osn.map(t=>t.name);CJe.compile({name:"studio",types:SJe});function kJe(t){return!!t&&(typeof t=="object"||typeof t=="function")}function Psn(t){return kJe(t)?t.jsonType==="object":!1}function $sn(t){return kJe(t)?t.jsonType==="array":!1}function B_e(t,e){return t}function Msn(t,e){return t}function mH(t){if(!t)throw new Error("Parameter 'portabletextType' missing (required)");const e=t.of?.find(EJe);if(!e)throw new Error("Block type is not defined in this schema (required)");const n=e.fields?.find(a=>a.name==="children");if(!n)throw new Error("Children field for block type found in schema (required)");const r=n.type.of;if(!r)throw new Error("Valid types for block children not found in schema (required)");const i=r.find(a=>a.name==="span");if(!i)throw new Error("Span type not found in schema (required)");const o=r.filter(a=>a.name!=="span")||[],s=t.of?.filter(a=>a.name!==e.name)||[];return{styles:Lsn(e),decorators:Fsn(i),lists:Nsn(e),block:e,span:i,portableText:t,inlineObjects:o,blockObjects:s,annotations:i.annotations}}function Lsn(t){const e=t.fields?.find(r=>r.name==="style");if(!e)throw new Error("A field with name 'style' is not defined in the block type (required).");const n=e.type.options?.list&&e.type.options.list?.filter(r=>r.value);if(!n||n.length===0)throw new Error("The style fields need at least one style defined. I.e: {title: 'Normal', value: 'normal'}.");return n}function Fsn(t){return t.decorators}function Nsn(t){const e=t.fields?.find(r=>r.name==="listItem");if(!e)throw new Error("A field with name 'listItem' is not defined in the block type (required).");const n=e.type.options?.list&&e.type.options.list.filter(r=>r.value);if(!n)throw new Error("The list field need at least to be an empty array");return n}function EJe(t){return t.type?EJe(t.type):t.name==="block"?t:null}function TJe(t){return{annotations:t.annotations.map(e=>({name:e.name,fields:e.fields.map(n=>({name:n.name,type:n.type.jsonType,title:n.type.title})),title:e.title})),block:{name:t.block.name},blockObjects:t.blockObjects.map(e=>({name:e.name,fields:e.fields.map(n=>({name:n.name,type:n.type.jsonType,title:n.type.title})),title:e.title})),decorators:t.decorators.map(e=>({name:e.value,title:e.title,value:e.value})),inlineObjects:t.inlineObjects.map(e=>({name:e.name,fields:e.fields.map(n=>({name:n.name,type:n.type.jsonType,title:n.type.title})),title:e.title})),span:{name:t.span.name},styles:t.styles.map(e=>({name:e.value,title:e.title,value:e.value})),lists:t.lists.map(e=>({name:e.value,title:e.title,value:e.value}))}}function zfe(t){const e=mH(t.hasOwnProperty("jsonType")?t:Bsn(t));return TJe(e)}function Bsn(t){return _Je.compile({name:"blockTypeSchema",types:[t,...SJe]}).get(t.name)}const gH=()=>Hsn(12),Vsn=(()=>{let t;return()=>{if(t)return t;t=[];for(let e=0;e<256;++e)t[e]=(e+256).toString(16).slice(1);return t}})();function zsn(t=16){const e=new Uint8Array(t);return crypto.getRandomValues(e),e}function Hsn(t){const e=Vsn();return zsn(t).reduce((n,r)=>n+e[r],"").slice(0,t)}function Wx(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().split(/\s+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const IJe=`tmp-${gH()}-image`,jJe=`tmp-${gH()}-url`,AJe=`tmp-${gH()}-image`,RJe=`tmp-${gH()}-url`,Usn={image:IJe,url:jJe},Wsn={image:AJe,url:RJe},BP={[IJe]:"image",[jJe]:"url"},MJ={[AJe]:"image",[RJe]:"url"},V_e={image:"Image",url:"URL"};function qsn(t){const e=t?.blockObjects?.map(s=>B_e({type:"object",name:Usn[s.name]??s.name,title:s.title===void 0?V_e[s.name]:s.title,fields:s.fields?.map(a=>({name:a.name,type:a.type,title:a.title??Wx(a.name)}))??[]}))??[],n=t?.inlineObjects?.map(s=>B_e({type:"object",name:Wsn[s.name]??s.name,title:s.title===void 0?V_e[s.name]:s.title,fields:s.fields?.map(a=>({name:a.name,type:a.type,title:a.title??Wx(a.name)}))??[]}))??[],r=Msn({type:"array",name:"portable-text",of:[...e.map(s=>({type:s.name})),{type:"block",name:"block",of:n.map(s=>({type:s.name})),marks:{decorators:t?.decorators?.map(s=>({title:s.title??Wx(s.name),value:s.name}))??[],annotations:t?.annotations?.map(s=>({name:s.name,type:"object",title:s.title,fields:s.fields?.map(a=>({name:a.name,title:a.title??Wx(a.name),type:a.type}))??[]}))??[]},lists:t?.lists?.map(s=>({value:s.name,title:s.title??Wx(s.name)}))??[],styles:t?.styles?.map(s=>({value:s.name,title:s.title??Wx(s.name)}))??[]}]}),i=_Je.compile({types:[r,...e,...n]}).get("portable-text"),o=mH(i);return{...o,portableText:{...o.portableText,of:o.portableText.of.map(s=>{if(!Psn(s))return s;const a=BP[s.name];s.name=a??s.name;for(const l of s.fields)if(!(l.name!=="children"||!$sn(l.type)))for(const c of l.type.of){const u=MJ[c.name];u&&(c.name=u)}return s})},blockObjects:o.blockObjects.map(s=>BP[s.name]!==void 0?{...s,name:BP[s.name],type:{...s.type,name:BP[s.name]}}:s),inlineObjects:o.inlineObjects.map(s=>MJ[s.name]!==void 0?{...s,name:MJ[s.name]}:s)}}const Gsn=Object.prototype.toString;function DJe(t){switch(Gsn.call(t)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}return t===null?"null":t===void 0?"undefined":t&&typeof t=="object"&&"nodeType"in t&&t.nodeType===1?"element":t===Object(t)?"object":typeof t}function Noe(t,e){if(!t||!e)return t===e;if(t.length!==e.length)return!1;for(let n=0;n{if(ean(n))return eL(t,[n.block]);if(qn(t,n)){const r=n.children.some(o=>t.schema.blockObjects.some(s=>s.name===o._type)),i=n.children.some(o=>o._type==="__block"||o._type==="block");if(r||i){const o=tan(t,n);return o.length===1&&o[0].type==="children"&&Ysn(o[0].children,n.children)?[n]:o.flatMap(s=>s.type==="block object"?[s.block]:s.type==="block"?eL(t,[s.block]):s.children.length>0?s.children.every(a=>Ci(t,a)&&a.text.trim()==="")?[]:eL(t,[{...n,children:s.children}]):[])}return[n]}return[n]})}function ean(t){return t._type==="__block"&&Qsn(t.block)}function tan(t,e){return e.children.reduce((n,r)=>{const i=t.schema.inlineObjects.some(a=>a.name===r._type),o=t.schema.blockObjects.some(a=>a.name===r._type),s=n.pop();return!Ci(t,r)&&!i&&o?[...n,...s?[s]:[],{type:"block object",block:r}]:r._type==="__block"?[...n,...s?[s]:[],{type:"block object",block:r.block}]:r._type==="block"?[...n,...s?[s]:[],{type:"block",block:r}]:s&&s.type==="children"?[...n,{type:"children",children:[...s.children,r]}]:[...n,...s?[s]:[],{type:"children",children:[r]}]},[])}const nan=["pre","textarea","code"],y_="normal",Sf=Object.freeze({_type:"block",markDefs:[],style:y_}),a7=Object.freeze({_type:"span",marks:[]}),Bj={p:Sf,blockquote:{...Sf,style:"blockquote"}},OJe={span:{object:"text"}},_N={ol:{object:null},ul:{object:null}},w8={h1:{...Sf,style:"h1"},h2:{...Sf,style:"h2"},h3:{...Sf,style:"h3"},h4:{...Sf,style:"h4"},h5:{...Sf,style:"h5"},h6:{...Sf,style:"h6"}},ran={br:{...Sf,style:y_}},PJe={b:"strong",strong:"strong",i:"em",em:"em",u:"underline",s:"strike-through",strike:"strike-through",del:"strike-through",code:"code",sup:"sup",sub:"sub",ins:"ins",mark:"mark",small:"small"},$Je={li:{...Sf,style:y_,level:1,listItem:"bullet"}},ian={...Bj,...OJe,..._N,...$Je,...w8,...ran};[...new Set(Object.values(ian).filter(t=>"style"in t).map(t=>t.style))];[...new Set(Object.values(PJe))];function Si(t){if(t&&"tagName"in t)return t.tagName.toLowerCase()}function oan(){if(DJe(DOMParser)==="undefined")throw new Error("The native `DOMParser` global which the `Html` deserializer uses by default is not present in this environment. You must supply the `options.parseHtml` function instead.");return t=>new DOMParser().parseFromString(t,"text/html")}function san(t,e){return e.reduce((n,r,i,o)=>{if(r._type==="block")return n.push(r),n;if(r._type==="__block")return n.push(r.block),n;const s=n[n.length-1];if(i>0&&!qn({schema:t},o[i-1])&&qn({schema:t},s))return s.children.push(r),n;const a={...Sf,children:[r]};return n.push(a),n},[])}function aan(t){return Object.prototype.toString.call(t)==="[object NodeList]"}function Cw(t){return t._type==="span"}function z_e(t){return t._type==="block"}function H_e(t){return t._type==="__decorator"}function U_e(t){return t._type==="__annotation"}function no(t){return t.nodeType===1}var MJe={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},qT={0:8203,1:8204,2:8205,3:65279},lan={0:String.fromCodePoint(qT[0]),1:String.fromCodePoint(qT[1]),2:String.fromCodePoint(qT[2]),3:String.fromCodePoint(qT[3])};new Array(4).fill(String.fromCodePoint(qT[0])).join("");Object.fromEntries(Object.entries(lan).map(t=>[t[1],+t[0]]));Object.fromEntries(Object.entries(MJe).map(t=>t.reverse()));var can=`${Object.values(MJe).map(t=>`\\u{${t.toString(16)}}`).join("")}`,W_e=new RegExp(`[${can}]{4,}`,"gu");function uan(t){var e;return{cleaned:t.replace(W_e,""),encoded:((e=t.match(W_e))==null?void 0:e[0])||""}}function dan(t){return t&&JSON.parse(uan(JSON.stringify(t)).cleaned)}function Pp(){return han(12)}function fan(t=16){const e=new Uint8Array(t);return crypto.getRandomValues(e),e}const LJe=[];for(let t=0;t<256;++t)LJe[t]=(t+256).toString(16).slice(1);function han(t){return fan(t).reduce((e,n)=>e+LJe[n],"").slice(0,t)}function pan(t){return/class="(?:TextRun|NormalTextRun)[^"]*SCXW\d+[^"]*BCX\d+/.test(t)||/class="EOP[^"]*SCXW\d+/.test(t)}function man(t){return!no(t)||Si(t)!=="span"?!1:t.classList.contains("TextRun")&&!t.classList.contains("EOP")}function Boe(t){return!no(t)||Si(t)!=="span"?!1:t.classList.contains("NormalTextRun")}function q_e(t){return!no(t)||Si(t)!=="span"?!1:t.classList.contains("TextRun")&&!t.classList.contains("NormalTextRun")&&!t.classList.contains("EOP")}function gan(t){return!no(t)||Si(t)!=="span"?!1:t.classList.contains("FindHit")}function yan(t){let e=t;for(;e;){if(no(e)&&Si(e)==="word-online-block"&&/^heading \d$/.test(e.getAttribute("data-parastyle")??""))return!0;e=e.parentNode}return!1}function ban(t){let e=t;for(;e;){if(no(e)&&Si(e)==="word-online-block"&&e.getAttribute("data-parastyle")==="Quote")return!0;e=e.parentNode}return!1}function FJe(t){const e=t.getAttribute("style")??"";return t.classList.contains("MacChromeBold")||/font-weight\s*:\s*bold/.test(e)}function NJe(t){const e=t.getAttribute("style")??"";return/font-style\s*:\s*italic/.test(e)}function tL(t){const e=t.getAttribute("style")??"";return t.classList.contains("Underlined")||/text-decoration\s*:\s*underline/.test(e)}function BJe(t){const e=t.getAttribute("style")??"";return t.classList.contains("Strikethrough")||/text-decoration\s*:\s*line-through/.test(e)}function G_e(t){return FJe(t)||NJe(t)||tL(t)||BJe(t)}function van(t,e){if(!pan(t))return e;const n=Array.from(e.querySelectorAll('p.Paragraph[role="heading"]'));for(const o of n){const s=o.getAttribute("aria-level");if(s){const a=e.createElement("word-online-block");a.setAttribute("data-parastyle",`heading ${s}`);const l=o.parentNode;if(l){for(l.insertBefore(a,o);o.firstChild;)a.appendChild(o.firstChild);l.removeChild(o)}}}let r=e.body.firstChild;for(;r;){const o=r.nextSibling;if(!no(r)||!Si(r)?.includes("span")){r=o;continue}const s=Y_e(r);if(!s){r=o;continue}const a=[r];let l=o;for(;l&&!(!no(l)||Y_e(l)!==s);)a.push(l),l=l.nextSibling;const c=e.createElement("word-online-block");c.setAttribute("data-parastyle",s),e.body.insertBefore(c,r);for(const u of a)c.appendChild(u);r=l}const i=Array.from(e.body.querySelectorAll("span")).filter(q_e);for(const o of i){const s=Array.from(o.childNodes).filter(Boe);for(const a of s){let l=!0;for(;l;){const c=Array.from(a.childNodes),u=c.findIndex(m=>no(m)&&Si(m)==="span"&&m.textContent.trim()==="");if(u===-1){l=!1;break}const f=c.at(u);if(!f){l=!1;break}const h=f.textContent?.replace(/\u00a0/g," ")??"",p=!c.slice(0,u).some(m=>m.nodeType===3);if(a.removeChild(f),p){const m=Array.from(a.childNodes).find(g=>g.nodeType===3);if(m)m.textContent=h+(m.textContent||"");else{const g=e.createTextNode(h);a.insertBefore(g,a.firstChild)}}else{const m=o.nextSibling,g=G_e(o);if(m&&no(m)&&q_e(m)){const y=G_e(m);if(g&&!y){const b=Array.from(m.childNodes).find(Boe);if(b&&no(b)){const v=b.firstChild;if(v&&v.nodeType===3)v.textContent=h+(v.textContent??"");else{const x=e.createTextNode(h);b.insertBefore(x,b.firstChild)}}}else{const b=Array.from(a.childNodes).find(v=>v.nodeType===3);if(b)b.textContent=(b.textContent??"")+h;else{const v=e.createTextNode(h);a.appendChild(v)}}}else{const y=Array.from(a.childNodes).find(b=>b.nodeType===3);if(y)y.textContent=(y.textContent??"")+h;else{const b=e.createTextNode(h);a.appendChild(b)}}}}}}return e}function Y_e(t){const e=t.getAttribute("data-ccp-parastyle");if(e)return e;if(Si(t)==="span"&&t.classList.contains("TextRun")){const n=Array.from(t.querySelectorAll(".NormalTextRun"));if(n.length>0){const r=n[0].getAttribute("data-ccp-parastyle");if(r&&n.every(i=>i.getAttribute("data-ccp-parastyle")===r))return r}}}const _8={BOOLEAN_TYPE:3,ORDERED_NODE_ITERATOR_TYPE:5,UNORDERED_NODE_SNAPSHOT_TYPE:6};function xan(t,e){let n=e.evaluate('//*[@id and contains(@id, "docs-internal-guid")]',e,null,_8.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext();if(n){const r=Si(n)==="b";r||(n=e.body);const i=e.evaluate("//*",e,null,_8.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let o=i.snapshotLength-1;o>=0;o--){const s=i.snapshotItem(o);s?.setAttribute("data-is-google-docs","true"),(s?.parentElement===n||!r&&s.parentElement===e.body)&&(s?.setAttribute("data-is-root-node","true"),Si(s)),Si(s)==="li"&&s.firstChild&&Si(s?.firstChild)==="img"&&s.removeChild(s.firstChild)}return r&&e.body.firstElementChild?.replaceWith(...Array.from(n.childNodes)),e}return e}const Can=["/html/text()","/html/head/text()","/html/body/text()","/html/body/ul/text()","/html/body/ol/text()","//comment()","//style","//xml","//script","//meta","//link"];function wan(t,e){const n=e.evaluate("/html/body/text()",e,null,_8.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let i=n.snapshotLength-1;i>=0;i--){const o=n.snapshotItem(i),s=o.textContent||"";if(s.replace(/[^\S\n]+$/g,"")){const a=e.createElement("span");a.appendChild(e.createTextNode(s)),o.parentNode?.replaceChild(a,o)}else o.parentNode?.removeChild(o)}const r=e.evaluate(Can.join("|"),e,null,_8.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let i=r.snapshotLength-1;i>=0;i--){const o=r.snapshotItem(i);o&&o.parentNode?.removeChild(o)}return e}function _an(t,e){const n=//g;if(t.match(n)){const r=e.evaluate("//*",e,null,_8.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let i=r.snapshotLength-1;i>=0;i--)r.snapshotItem(i)?.setAttribute("data-is-notion","true");return e}return e}const San=["body","table","tbody","thead","tfoot","tr","ul","ol"];function kan(t,e){function n(r){if(r.nodeType===_8.BOOLEAN_TYPE&&!nan.includes(r.parentElement?.tagName.toLowerCase()||"")){const i=r.textContent?.replace(/\s\s+/g," ").replace(/[\r\n]+/g," ")||"",o=r.parentElement?.tagName.toLowerCase();o&&San.includes(o)&&i.trim()===""?r.parentNode?.removeChild(r):r.textContent=i}else for(let i=r.childNodes.length-1;i>=0;i--)n(r.childNodes[i])}return n(e.body),e}const Ean=/(class="?Mso|style=(?:"|')[^"]*?\bmso-|w:WordDocument||<\/font>)/,Tan=["//o:p","//span[@style='mso-list:Ignore']","//span[@style='mso-list: Ignore']"],Ian=["//p[@class='MsoTocHeading']","//p[@class='MsoTitle']","//p[@class='MsoToaHeading']","//p[@class='MsoSubtitle']","//span[@class='MsoSubtleEmphasis']","//span[@class='MsoIntenseEmphasis']"],jan={MsoTocHeading:["h3"],MsoTitle:["h1"],MsoToaHeading:["h2"],MsoSubtitle:["h5"],MsoSubtleEmphasis:["span","em"],MsoIntenseEmphasis:["span","em","strong"]};function Aan(t){return Ean.test(t)}function Ran(t){const e={};let n=!1;const r=t.querySelectorAll("style");for(const i of r){const o=i.textContent||"",s=/@list\s+(l\d+):(level\d+)\s*\{([^}]*)\}/g;for(let a=s.exec(o);a!==null;a=s.exec(o)){const l=a[1],c=a[2],u=a[3],f=`${l}:${c}`;/mso-level-number-format\s*:\s*bullet/i.test(u)?e[f]="bullet":e[f]="number",n=!0}}n&&t.body&&t.body.setAttribute("data-word-list-styles",JSON.stringify(e))}function Dan(t,e){if(!Aan(t))return e;Ran(e);const n=e.evaluate(Tan.join("|"),e,i=>i==="o"?"urn:schemas-microsoft-com:office:office":null,_8.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let i=n.snapshotLength-1;i>=0;i--){const o=n.snapshotItem(i);o?.parentNode&&o.parentNode.removeChild(o)}const r=e.evaluate(Ian.join("|"),e,null,_8.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let i=r.snapshotLength-1;i>=0;i--){const o=r.snapshotItem(i),s=jan[o.className],a=e.createTextNode(o.textContent||"");if(!s)continue;const l=e.createElement(s[0]);let c=l,u=l;s.slice(1).forEach(f=>{u=e.createElement(f),c.appendChild(u),c=u}),u.appendChild(a),o?.parentNode?.replaceChild(l,o)}return e}const Oan=[kan,_an,Dan,van,xan,wan];function K_e(t,e){const n={"heading 1":"h1","heading 2":"h2","heading 3":"h3","heading 4":"h4","heading 5":"h5","heading 6":"h6",Quote:"blockquote"}[e]??"normal";return t.styles.find(r=>r.name===n)?.name}function Pan(t,e){return[{deserialize(n){if(!no(n)||Si(n)!=="img")return;const r=n.className;let i="";if(typeof r=="string"?i=r:r&&typeof r=="object"&&(i=r.baseVal||""),!i.includes("WACImage"))return;const o=n.getAttribute("src")??void 0,s=n.getAttribute("alt")??void 0,a=Object.fromEntries(Array.from(n.attributes).map(c=>[c.name,c.value])),l=e.matchers?.image?.({context:{schema:t,keyGenerator:e.keyGenerator??Pp},props:{...a,...o?{src:o}:{},...s?{alt:s}:{}}});if(l)return{_type:"__block",block:l}}},{deserialize(n){if(!no(n))return;const r=n.className;let i="";if(typeof r=="string"?i=r:r&&typeof r=="object"&&(i=r.baseVal||""),!i.includes("WACImageContainer"))return;const o=n.querySelector("img");if(!o)return;const s=o.getAttribute("src")??void 0,a=o.getAttribute("alt")??void 0,l=Object.fromEntries(Array.from(o.attributes).map(f=>[f.name,f.value])),c=n.closest("li")!==null;if(n.closest("p")===null||c){const f=e.matchers?.inlineImage?.({context:{schema:t,keyGenerator:e.keyGenerator??Pp},props:{...l,...s?{src:s}:{},...a?{alt:a}:{}}});if(f)return f}const u=e.matchers?.image?.({context:{schema:t,keyGenerator:e.keyGenerator??Pp},props:{...l,...s?{src:s}:{},...a?{alt:a}:{}}});if(u)return{_type:"__block",block:u}}},{deserialize(n,r){if(!no(n)||Si(n)!=="li")return;const i=n.getAttribute("data-aria-level");if(!i)return;const o=Si(n.parentNode)==="ol"?"number":"bullet";let s=n.childNodes,a="normal";if(n.childNodes.length===1&&n.firstChild&&no(n.firstChild)){const u=Si(n.firstChild);if(u&&(Bj[u]||w8[u]||u==="word-online-block")){if(u==="word-online-block"){const f=n.firstChild.getAttribute("data-parastyle"),h=f?K_e(t,f):void 0;h&&(a=h)}s=n.firstChild.childNodes}}const l=r(s);let c=Array.isArray(l)?l:[l].filter(Boolean);for(;c.length>0;){const u=c[c.length-1];if(u&&typeof u=="object"&&"text"in u){const f=u.text.trimEnd();if(f==="")c=c.slice(0,-1);else if(f!==u.text){u.text=f;break}else break}else break}return{_type:t.block.name,children:c,markDefs:[],style:a,listItem:o,level:parseInt(i,10)}}},{deserialize(n,r){if(!no(n))return;const i=n.getAttribute("data-parastyle"),o=i?K_e(t,i):void 0;if(!o)return;const s=r(n.childNodes);return{_type:t.block.name,style:o,markDefs:[],children:Array.isArray(s)?s:s?[s]:[]}}},{deserialize(n){if(man(n)){if(!no(n)||!n.textContent)return;const r=Array.from(n.childNodes).filter(o=>Boe(o)||gan(o)).map(o=>no(o)?o.textContent??"":"").join("");if(!r)return;const i={...a7,marks:[],text:r};if(FJe(n)&&i.marks.push("strong"),NJe(n)&&!yan(n)&&!ban(n)&&i.marks.push("em"),tL(n))if(no(n)&&n.parentElement&&Si(n.parentElement)==="a"){const o=n.parentElement;if(o){const s=o.previousSibling,a=o.nextSibling,l=s&&no(s)&&tL(s),c=a&&no(a)&&tL(a);(l||c)&&i.marks.push("underline")}}else i.marks.push("underline");return BJe(n)&&i.marks.push("strike-through"),i}}}]}const VJe=Object.keys(_N);function $an(t){const e=no(t)&&t.getAttribute("style");return/font-style\s*:\s*italic/.test(e||"")}function Man(t){const e=no(t)&&t.getAttribute("style");return/font-weight\s*:\s*700/.test(e||"")}function Lan(t){if(!no(t)||Si(t.parentNode)==="a")return!1;const e=no(t)&&t.getAttribute("style");return/text-decoration\s*:\s*underline/.test(e||"")}function Fan(t){const e=no(t)&&t.getAttribute("style");return/text-decoration\s*:\s*(?:.*line-through.*;)/.test(e||"")}function WE(t){return no(t)&&!!t.getAttribute("data-is-google-docs")}function Nan(t){return no(t)&&!!t.getAttribute("data-is-root-node")}function Ban(t){const e=Si(t.parentNode);if(!(e&&!VJe.includes(e)))return Si(t.parentNode)==="ul"?"bullet":"number"}function Van(t){let e=0;if(Si(t)==="li"){let n=t.parentNode;for(;n;){const r=Si(n);r&&VJe.includes(r)&&e++,n=n.parentNode}}else e=1;return e}const zan={...Bj,...w8};function Han(t,e){const n=Si(e.firstChild),r=n&&zan[n];return r&&t.styles.some(i=>i.name===r.style)?r.style:y_}function Uan(t){return[{deserialize(e,n){if(no(e)&&Si(e)==="span"&&WE(e)){if(!e.textContent)return!e.previousSibling&&!e.nextSibling&&e.setAttribute("data-lonely-child","true"),n(e.childNodes);const r={...a7,marks:[],text:e.textContent};return Man(e)&&r.marks.push("strong"),Lan(e)&&r.marks.push("underline"),Fan(e)&&r.marks.push("strike-through"),$an(e)&&r.marks.push("em"),r}}},{deserialize(e,n){if(Si(e)==="li"&&WE(e))return{...Sf,listItem:Ban(e),level:Van(e),style:Han(t,e),children:n(e.firstChild?.childNodes||[])}}},{deserialize(e){if(Si(e)==="br"&&WE(e)&&no(e)&&e.classList.contains("apple-interchange-newline"))return{...a7,text:""};if(Si(e)==="br"&&WE(e)&&no(e)&&e?.parentNode?.textContent==="")return{...a7,text:""};if(Si(e)==="br"&&WE(e)&&no(e)&&Nan(e))return{...a7,text:""}}}]}const Wan={deserialize(t){return t.nodeName==="#text"&&qan(t)?{...a7,marks:[],text:(t.textContent??"").replace(/\s\s+/g," ")}:void 0}};function qan(t){const e=t.nodeType===3&&(t.textContent||"").replace(/[\r\n]/g," ").replace(/\s\s+/g," ")===" ",n=t.nextSibling&&t.nextSibling.nodeType!==3&&t.previousSibling&&t.previousSibling.nodeType!==3,r=t.parentNode&&Si(t.parentNode)==="span"&&!t.nextSibling&&!t.previousSibling&&t.parentNode.previousSibling&&t.parentNode.previousSibling.nodeType!==3&&t.parentNode.nextSibling&&t.parentNode.nextSibling.nodeType!==3;return(e&&(n||r)||t.textContent!==" ")&&Si(t.parentNode)!=="body"}function Gan(t,e){if(e==="ul"&&t.lists.some(n=>n.name==="bullet"))return"bullet";if(e==="ol"&&t.lists.some(n=>n.name==="number"))return"number"}function Yan(t,e){return[Wan,{deserialize(n){if(Si(n)!=="pre")return;const r=t.styles.some(i=>i.name==="code");return{_type:"block",style:"normal",markDefs:[],children:[{...a7,marks:r?["code"]:[],text:n.textContent||""}]}}},{deserialize(n,r){if(Si(n)!=="blockquote")return;const i={...Bj,...w8};delete i.blockquote;const o=Object.keys(i),s=[];return n.childNodes.forEach((a,l)=>{if(n.ownerDocument)if(a.nodeType===1&&o.includes(a.localName.toLowerCase())){const c=n.ownerDocument.createElement("span"),u=s[s.length-1];u&&u.nodeType===3&&u.textContent?.trim()&&c.appendChild(n.ownerDocument.createTextNode("\r")),a.childNodes.forEach(f=>{c.appendChild(f.cloneNode(!0))}),l!==n.childNodes.length&&c.appendChild(n.ownerDocument.createTextNode("\r")),s.push(c)}else s.push(a)}),{_type:"block",style:"blockquote",markDefs:[],children:r(s)}}},{deserialize(n,r){const i={...Bj,...w8},o=Si(n);let s=o?i[o]:void 0;if(!s)return;if(n.parentNode&&Si(n.parentNode)==="li")return r(n.childNodes);const a=s.style;return t.styles.some(l=>l.name===a)||(s=Sf),{...s,children:r(n.childNodes)}}},{deserialize(n,r){const i=Si(n);if(!(!i||!(i in OJe)))return r(n.childNodes)}},{deserialize(n,r){if(Si(n)==="div")return r(n.childNodes)}},{deserialize(n,r){const i=Si(n);if(!(!i||!(i in _N)))return r(n.childNodes)}},{deserialize(n){if(Si(n)==="br")return{...a7,text:` +`}}},{deserialize(n,r,i){const o=Si(n),s=o?$Je[o]:void 0;if(!s)return;const a=Si(n.parentNode)||"",l=_N[a]?a:"ul",c=Gan(t,l);return c?(s.listItem=c,{...s,children:r(n.childNodes)}):i({_type:"block",children:r(n.childNodes)})}},{deserialize(n,r){const i=PJe[Si(n)||""];if(!(!i||!t.decorators.some(o=>o.name===i)))return{_type:"__decorator",name:i,children:r(n.childNodes)}}},{deserialize(n,r){if(Si(n)!=="a")return;const i=t.annotations.some(s=>s.name==="link"),o=no(n)&&n.getAttribute("href");return o?i?{_type:"__annotation",markDef:{_key:e.keyGenerator?e.keyGenerator():Pp(),_type:"link",href:o},children:r(n.childNodes)}:n.appendChild(n.ownerDocument.createTextNode(` (${o})`))&&r(n.childNodes):r(n.childNodes)}},{deserialize(n,r){if(no(n)&&(Si(n)==="td"||Si(n)==="th"))return{...Sf,children:r(n.childNodes)}}},{deserialize(n){if(no(n)&&Si(n)==="img"){const r=n.getAttribute("src")??void 0,i=n.getAttribute("alt")??void 0,o=Object.fromEntries(Array.from(n.attributes).map(u=>[u.name,u.value])),s=n?.parentElement?.parentElement?.getAttribute("data-lonely-child"),a=n.closest("li")!==null;if(s&&!a){const u=e.matchers?.image?.({context:{schema:t,keyGenerator:e.keyGenerator??Pp},props:{...o,...r?{src:r}:{},...i?{alt:i}:{}}});if(u)return{_type:"__block",block:u}}const l=e.matchers?.inlineImage?.({context:{schema:t,keyGenerator:e.keyGenerator??Pp},props:{...o,...r?{src:r}:{},...i?{alt:i}:{}}});if(l)return l;const c=e.matchers?.image?.({context:{schema:t,keyGenerator:e.keyGenerator??Pp},props:{...o,...r?{src:r}:{},...i?{alt:i}:{}}});if(c)return{_type:"__block",block:c}}}}]}function Kan(t){const e=no(t)&&t.getAttribute("style");return/font-style:italic/.test(e||"")}function Xan(t){const e=no(t)&&t.getAttribute("style");return/font-weight:700/.test(e||"")||/font-weight:600/.test(e||"")}function Zan(t){const e=no(t)&&t.getAttribute("style");return/text-decoration:underline/.test(e||"")}function Qan(t){return no(t)&&!!t.getAttribute("data-is-notion")}function Jan(){return[{deserialize(t){if(no(t)&&Si(t)==="span"&&Qan(t)){const e={...a7,marks:[],text:t.textContent};return Xan(t)&&e.marks.push("strong"),Zan(t)&&e.marks.push("underline"),Kan(t)&&e.marks.push("em"),e}}}]}function eln(t){if(!no(t))return{};const e=t.closest("body")||t.ownerDocument?.body;if(!e)return{};const n=e.getAttribute("data-word-list-styles");if(!n)return{};try{return JSON.parse(n)}catch{return{}}}function tln(t){const e=no(t)&&t.getAttribute("style");if(!e)return;const n=e.match(/mso-list:\s*(l\d+)\s+(level\d+)\s+lfo\d+/);if(!n)return;const r=`${n[1]}:${n[2]}`;return eln(t)[r]||"bullet"}function nln(t){const e=no(t)&&t.getAttribute("style");if(!e)return;const n=e.match(/level\d+/);if(!n)return;const[r]=n[0].match(/\d/)||[];return(r?Number.parseInt(r,10):1)||1}function rln(t){if(!no(t))return!1;if(t.className&&(t.className==="MsoListParagraphCxSpFirst"||t.className==="MsoListParagraphCxSpMiddle"||t.className==="MsoListParagraphCxSpLast"))return!0;const e=t.getAttribute("style");return!!(e&&/mso-list:\s*l\d+\s+level\d+\s+lfo\d+/.test(e))}function iln(t){const e=Si(t);if(e&&w8[e])return w8[e]?.style}function oln(){return[{deserialize(t,e){const n=Si(t);if((n==="p"||w8[n||""])&&rln(t)){const r=iln(t);return{...Sf,listItem:tln(t),level:nln(t),style:r||y_,children:e(t.childNodes)}}}}]}function sln(t,e){return[...oln(),...Pan(t,e),...Jan(),...Uan(t),...Yan(t,e)]}function aln(t,e,n){const r=[];let i=0;for(const o of n){const s=qn(t,o)?lln(o):o;if(e==="preserve"){r.push(s);continue}if(e==="remove"){if(X_e(t,s))continue;r.push(s);continue}if(e==="normalize"){if(X_e(t,s)){i++,i===1&&r.push(s);continue}r.push(s),i=0}}return r}function X_e(t,e){return!(!qn(t,e)||e.children.some(n=>!Ci(t,n)||n.text.trim()!==""))}function lln(t){let e=0;for(const n of t.children){if(!Cw(n)){e++;continue}const r=cln(t,e),i=uln(t,e);e===0&&(n.text=n.text.replace(/^[^\S\n]+/g,"")),e===t.children.length-1&&(n.text=n.text.replace(/[^\S\n]+$/g,"")),/\s/.test(n.text.slice(Math.max(0,n.text.length-1)))&&r&&Cw(r)&&/\s/.test(r.text.slice(0,1))&&(n.text=n.text.replace(/[^\S\n]+$/g,"")),/\s/.test(n.text.slice(0,1))&&i&&Cw(i)&&/\s/.test(i.text.slice(Math.max(0,i.text.length-1)))&&(n.text=n.text.replace(/^[^\S\n]+/g,"")),n.text||t.children.splice(e,1),i&&Array.isArray(i.marks)&&Noe(i.marks,n.marks)&&Z_e(n.text)?(i.text+=" ",t.children.splice(e,1)):r&&Array.isArray(r.marks)&&Noe(r.marks,n.marks)&&Z_e(n.text)&&(r.text=` ${r.text}`,t.children.splice(e,1)),e++}return t}function cln(t,e){const n=t.children[e+1];return n&&n._type==="span"?n:null}function uln(t,e){const n=t.children[e-1];return n&&n._type==="span"?n:null}function Z_e(t){return[" "," "].includes(t)}class dln{keyGenerator;schema;rules;parseHtml;whitespaceMode;_markDefs=[];constructor(e,n={}){const{rules:r=[],unstable_whitespaceOnPasteMode:i="preserve"}=n,o=sln(e,{keyGenerator:n.keyGenerator,matchers:n.matchers});this.schema=e,this.keyGenerator=n.keyGenerator??Pp,this.rules=[...r,...o],this.whitespaceMode=i;const s=n.parseHtml||oan();this.parseHtml=a=>{const l=dan(a),c=s(l);for(const u of Oan)u(l,c);return c.body}}deserialize=e=>{this._markDefs=[];const{parseHtml:n}=this,r=n(e),i=Array.from(r.childNodes),o=aln({schema:this.schema},this.whitespaceMode,eL({schema:this.schema},san(this.schema,this.deserializeElements(i))));return this._markDefs.length>0&&o.filter(s=>qn({schema:this.schema},s)).forEach(s=>{s.markDefs=s.markDefs||[],s.markDefs=s.markDefs.concat(this._markDefs.filter(a=>s.children.flatMap(l=>l.marks||[]).includes(a._key)))}),o.map(s=>(s._type==="block"&&(s._type=this.schema.block.name),s))};deserializeElements=(e=[])=>{let n=[];return e.forEach(r=>{n=n.concat(this.deserializeElement(r))}),n};deserializeElement=e=>{const n=o=>{if(aan(o))return this.deserializeElements(Array.from(o));if(Array.isArray(o))return this.deserializeElements(o);if(o)return this.deserializeElement(o)},r=o=>({_type:"__block",block:o});let i;for(let o=0;o{Cw(c)&&c.text==="\r"&&(c.text=` +`,(u===0||u===a.children.length-1)&&a.children.splice(u,1))});break}}return i||n(e.childNodes)||[]};deserializeDecorator=e=>{const{name:n}=e,r=i=>{if(H_e(i))return this.deserializeDecorator(i);if(Cw(i))i.marks=i.marks||[],i.text.trim()&&i.marks.unshift(n);else if("children"in i&&Array.isArray(i.children)){const o=i;o.children=o.children.map(r)}return i};return e.children.reduce((i,o)=>{const s=r(o);return Array.isArray(s)?i.concat(s):(i.push(s),i)},[])};deserializeAnnotation=e=>{const{markDef:n}=e;this._markDefs.push(n);const r=i=>{if(U_e(i))return this.deserializeAnnotation(i);if(Cw(i))i.marks=i.marks||[],i.text.trim()&&i.marks.unshift(n._key);else if("children"in i&&Array.isArray(i.children)){const o=i;o.children=o.children.map(r)}return i};return e.children.reduce((i,o)=>{const s=r(o);return Array.isArray(s)?i.concat(s):(i.push(s),i)},[])}}function Hfe(t,e={}){const n={block:{name:e.blockTypeName||"block"},span:{name:"span"},styles:[],lists:[],decorators:[],annotations:[],blockObjects:[],inlineObjects:[]};if(t._type!==(e.blockTypeName||"block"))return"_key"in t?t:{...t,_key:e.keyGenerator?e.keyGenerator():Pp()};const r={_key:e.keyGenerator?e.keyGenerator():Pp(),children:[],markDefs:[],...t},i=r.children[r.children.length-1];if(!i)return r.children=[{_type:"span",_key:e.keyGenerator?e.keyGenerator():Pp(),text:"",marks:[]}],r;const o=[],s=e.allowedDecorators&&Array.isArray(e.allowedDecorators)?e.allowedDecorators:!1;return r.children=r.children.reduce((a,l)=>{const c=a[a.length-1];return c&&Ci({schema:n},l)&&Ci({schema:n},c)&&Noe(c.marks,l.marks)?(i&&i===l&&l.text===""&&r.children.length>1||(c.text+=l.text),a):(a.push(l),a)},[]).map(a=>{if(!a)throw new Error("missing child");return a._key=e.keyGenerator?e.keyGenerator():Pp(),Ci({schema:n},a)&&(a.marks?s&&(a.marks=a.marks.filter(l=>{const c=s.includes(l),u=r.markDefs?.some(f=>f._key===l);return c||u})):a.marks=[],o.push(...a.marks)),a}),r.markDefs=(r.markDefs||[]).filter(a=>o.includes(a._key)),r}function yH(t,e,n={}){const r=fln(e)?zfe(e):e;return new dln(r,n).deserialize(t).map(i=>Hfe(i,{keyGenerator:n.keyGenerator}))}function fln(t){return t.hasOwnProperty("jsonType")}const hln=["http","https","mailto","tel"],pln={"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27"};function zJe(t){return mln(t.replace(/[&<>"']/g,e=>`&${pln[e]};`))}function mln(t){return t.replace(/ {2,}/g,e=>`${" ".repeat(e.length-1)} `)}function gln(t){let e=(t||"").trim(),n=e.charAt(0);if(n==="#"||n==="/")return!0;let r=e.indexOf(":");if(r===-1)return!0;let i=e.slice(0,r).toLowerCase();if(hln.indexOf(i)!==-1)return!0;let o=e.indexOf("?");if(o!==-1&&r>o)return!0;let s=e.indexOf("#");return s!==-1&&r>s}const yln={number:({children:t})=>`
    ${t}
`,bullet:({children:t})=>`
    ${t}
`},bln=({children:t})=>`
  • ${t}
  • `,vln=({children:t,value:e})=>{let n=e?.href||"";return gln(n)?`${t}`:t},xln={em:({children:t})=>`${t}`,strong:({children:t})=>`${t}`,code:({children:t})=>`${t}`,underline:({children:t})=>`${t}`,"strike-through":({children:t})=>`${t}`,link:vln},qR=(t,e)=>`Unknown ${t}, specify a component for it in the \`components.${e}\` option`,HJe=t=>qR(`block type "${t}"`,"types"),Cln=t=>qR(`mark type "${t}"`,"marks"),wln=t=>qR(`block style "${t}"`,"block"),_ln=t=>qR(`list style "${t}"`,"list"),Sln=t=>qR(`list item style "${t}"`,"listItem");function kln(t){console.warn(t)}const Q_e={types:{},block:{normal:({children:t})=>`

    ${t}

    `,blockquote:({children:t})=>`
    ${t}
    `,h1:({children:t})=>`

    ${t}

    `,h2:({children:t})=>`

    ${t}

    `,h3:({children:t})=>`

    ${t}

    `,h4:({children:t})=>`

    ${t}

    `,h5:({children:t})=>`
    ${t}
    `,h6:({children:t})=>`
    ${t}
    `},marks:xln,list:yln,listItem:bln,hardBreak:()=>"
    ",escapeHTML:zJe,unknownType:({value:t,isInline:e})=>{let n=HJe(t._type);return e?`${n}`:`
    ${n}
    `},unknownMark:({markType:t,children:e})=>`${e}`,unknownList:({children:t})=>`
      ${t}
    `,unknownListItem:({children:t})=>`
  • ${t}
  • `,unknownBlockStyle:({children:t})=>`

    ${t}

    `};function Eln(t,e){let{block:n,list:r,listItem:i,marks:o,types:s,...a}=e;return{...t,block:qE(t,e,"block"),list:qE(t,e,"list"),listItem:qE(t,e,"listItem"),marks:qE(t,e,"marks"),types:qE(t,e,"types"),...a}}function qE(t,e,n){let r=e[n],i=t[n];return typeof r=="function"?r:r?typeof i=="function"?r:{...i,...r}:i}function Voe(t,e={}){let{components:n,onMissingComponent:r=kln}=e,i=r||Iln,o=uQe(Array.isArray(t)?t:[t],"html"),s=Tln(n?Eln(Q_e,n):Q_e,i);return o.map((a,l)=>s({node:a,index:l,isInline:!1,renderNode:s})).join("")}const Tln=(t,e)=>{function n(c){let{node:u,index:f,isInline:h}=c;return vfe(u)?i(u,f):d_(u)?r(u,f):aH(u)?o(u):y1(u)?s(u,f,h):lH(u)?a(u):l(u,f,h)}function r(c,u){let f=J_e({node:c,index:u,isInline:!1,renderNode:n}),h=t.listItem,p=(typeof h=="function"?h:h[c.listItem])||t.unknownListItem;if(p===t.unknownListItem){let g=c.listItem||"bullet";e(Sln(g),{type:g,nodeType:"listItemStyle"})}let m=f.children;if(c.style&&c.style!=="normal"){let{listItem:g,...y}=c;m=n({node:y,index:u,isInline:!1})}return p({value:c,index:u,isInline:!1,renderNode:n,children:m})}function i(c,u){let f=c.children.map((m,g)=>n({node:m._key?m:{...m,_key:`li-${u}-${g}`},index:g,isInline:!1})),h=t.list,p=(typeof h=="function"?h:h[c.listItem])||t.unknownList;if(p===t.unknownList){let m=c.listItem||"bullet";e(_ln(m),{nodeType:"listStyle",type:m})}return p({value:c,index:u,isInline:!1,renderNode:n,children:f.join("")})}function o(c){let{markDef:u,markType:f,markKey:h}=c,p=t.marks[f]||t.unknownMark,m=c.children.map((g,y)=>n({node:g,index:y,isInline:!0}));return p===t.unknownMark&&e(Cln(f),{nodeType:"mark",type:f}),p({text:uH(c),value:u,markType:f,markKey:h,renderNode:n,children:m.join("")})}function s(c,u,f){let{_key:h,...p}=J_e({node:c,index:u,isInline:f,renderNode:n}),m=p.node.style||"normal",g=(typeof t.block=="function"?t.block:t.block[m])||t.unknownBlockStyle;return g===t.unknownBlockStyle&&e(wln(m),{nodeType:"blockStyle",type:m}),g({...p,value:p.node,renderNode:n})}function a(c){if(c.text===` +`){let u=t.hardBreak;return u?u():` +`}return t.escapeHTML(c.text)}function l(c,u,f){let h=t.types[c._type];return h||e(HJe(c._type),{nodeType:"block",type:c._type}),(h||t.unknownType)({value:c,isInline:f,index:u,renderNode:n})}return n};function J_e(t){let{node:e,index:n,isInline:r,renderNode:i}=t,o=cH(e).map((s,a)=>i({node:s,isInline:!0,index:a,renderNode:i}));return{_key:e._key||`block-${n}`,children:o.join(""),index:n,isInline:r,node:e}}function Iln(){}const eSe={};function jln(t){let e=eSe[t];if(e)return e;e=eSe[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);e.push(r)}for(let n=0;n=55296&&u<=57343?i+="���":i+=String.fromCharCode(u),o+=6;continue}}if((a&248)===240&&o+91114111?i+="����":(f-=65536,i+=String.fromCharCode(55296+(f>>10),56320+(f&1023))),o+=9;continue}}i+="�"}return i})}b_.defaultChars=";/?:@&=+$,#";b_.componentChars="";const tSe={};function Aln(t){let e=tSe[t];if(e)return e;e=tSe[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);/^[0-9a-z]$/i.test(r)?e.push(r):e.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n"u"&&(n=!0);const r=Aln(e);let i="";for(let o=0,s=t.length;o=55296&&a<=57343){if(a>=55296&&a<=56319&&o+1=56320&&l<=57343){i+=encodeURIComponent(t[o]+t[o+1]),o++;continue}}i+="%EF%BF%BD";continue}i+=encodeURIComponent(t[o])}return i}GR.defaultChars=";/?:@&=+$,-_.!~*'()#";GR.componentChars="-_.!~*'()";function Ufe(t){let e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&t.hostname.indexOf(":")!==-1?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||"",e}function SN(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const Rln=/^([a-z0-9.+-]+:)/i,Dln=/:[0-9]*$/,Oln=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Pln=["<",">",'"',"`"," ","\r",` +`," "],$ln=["{","}","|","\\","^","`"].concat(Pln),Mln=["'"].concat($ln),nSe=["%","/","?",";","#"].concat(Mln),rSe=["/","?","#"],Lln=255,iSe=/^[+a-z0-9A-Z_-]{0,63}$/,Fln=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,oSe={javascript:!0,"javascript:":!0},sSe={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Wfe(t,e){if(t&&t instanceof SN)return t;const n=new SN;return n.parse(t,e),n}SN.prototype.parse=function(t,e){let n,r,i,o=t;if(o=o.trim(),!e&&t.split("#").length===1){const c=Oln.exec(o);if(c)return this.pathname=c[1],c[2]&&(this.search=c[2]),this}let s=Rln.exec(o);if(s&&(s=s[0],n=s.toLowerCase(),this.protocol=s,o=o.substr(s.length)),(e||s||o.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=o.substr(0,2)==="//",i&&!(s&&oSe[s])&&(o=o.substr(2),this.slashes=!0)),!oSe[s]&&(i||s&&!sSe[s])){let c=-1;for(let m=0;m127?v+="x":v+=b[x];if(!v.match(iSe)){const x=m.slice(0,g),C=m.slice(g+1),w=b.match(Fln);w&&(x.push(w[1]),C.unshift(w[2])),C.length&&(o=C.join(".")+o),this.hostname=x.join(".");break}}}}this.hostname.length>Lln&&(this.hostname=""),p&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const a=o.indexOf("#");a!==-1&&(this.hash=o.substr(a),o=o.slice(0,a));const l=o.indexOf("?");return l!==-1&&(this.search=o.substr(l),o=o.slice(0,l)),o&&(this.pathname=o),sSe[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};SN.prototype.parseHost=function(t){let e=Dln.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};const Nln=Object.freeze(Object.defineProperty({__proto__:null,decode:b_,encode:GR,format:Ufe,parse:Wfe},Symbol.toStringTag,{value:"Module"})),UJe=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,WJe=/[\0-\x1F\x7F-\x9F]/,Bln=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,qfe=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,qJe=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,GJe=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,Vln=Object.freeze(Object.defineProperty({__proto__:null,Any:UJe,Cc:WJe,Cf:Bln,P:qfe,S:qJe,Z:GJe},Symbol.toStringTag,{value:"Module"})),zln=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),Hln=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(t=>t.charCodeAt(0)));var LJ;const Uln=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Wln=(LJ=String.fromCodePoint)!==null&&LJ!==void 0?LJ:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function qln(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=Uln.get(t))!==null&&e!==void 0?e:t}var Nd;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(Nd||(Nd={}));const Gln=32;var Z4;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(Z4||(Z4={}));function zoe(t){return t>=Nd.ZERO&&t<=Nd.NINE}function Yln(t){return t>=Nd.UPPER_A&&t<=Nd.UPPER_F||t>=Nd.LOWER_A&&t<=Nd.LOWER_F}function Kln(t){return t>=Nd.UPPER_A&&t<=Nd.UPPER_Z||t>=Nd.LOWER_A&&t<=Nd.LOWER_Z||zoe(t)}function Xln(t){return t===Nd.EQUALS||Kln(t)}var Pd;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(Pd||(Pd={}));var V4;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(V4||(V4={}));class Zln{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=Pd.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=V4.Strict}startEntity(e){this.decodeMode=e,this.state=Pd.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case Pd.EntityStart:return e.charCodeAt(n)===Nd.NUM?(this.state=Pd.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=Pd.NamedEntity,this.stateNamedEntity(e,n));case Pd.NumericStart:return this.stateNumericStart(e,n);case Pd.NumericDecimal:return this.stateNumericDecimal(e,n);case Pd.NumericHex:return this.stateNumericHex(e,n);case Pd.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|Gln)===Nd.LOWER_X?(this.state=Pd.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=Pd.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,i){if(n!==r){const o=r-n;this.result=this.result*Math.pow(i,o)+parseInt(e.substr(n,o),i),this.consumed+=o}}stateNumericHex(e,n){const r=n;for(;n>14;for(;n>14,o!==0){if(s===Nd.SEMI)return this.emitNamedEntityData(this.treeIndex,o,this.consumed+this.excess);this.decodeMode!==V4.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,i=(r[n]&Z4.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[e]&~Z4.VALUE_LENGTH:i[e+1],r),n===3&&this.emitCodePoint(i[e+2],r),r}end(){var e;switch(this.state){case Pd.NamedEntity:return this.result!==0&&(this.decodeMode!==V4.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Pd.NumericDecimal:return this.emitNumericEntity(0,2);case Pd.NumericHex:return this.emitNumericEntity(0,3);case Pd.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Pd.EntityStart:return 0}}}function YJe(t){let e="";const n=new Zln(t,r=>e+=Wln(r));return function(i,o){let s=0,a=0;for(;(a=i.indexOf("&",a))>=0;){e+=i.slice(s,a),n.startEntity(o);const c=n.write(i,a+1);if(c<0){s=a+n.end();break}s=a+c,a=c===0?s+1:s}const l=e+i.slice(s);return e="",l}}function Qln(t,e,n,r){const i=(e&Z4.BRANCH_LENGTH)>>7,o=e&Z4.JUMP_TABLE;if(i===0)return o!==0&&r===o?n:-1;if(o){const l=r-o;return l<0||l>=i?-1:t[n+l]-1}let s=n,a=s+i-1;for(;s<=a;){const l=s+a>>>1,c=t[l];if(cr)a=l-1;else return t[l+i]}return-1}const Jln=YJe(zln);YJe(Hln);function KJe(t,e=V4.Legacy){return Jln(t,e)}function ecn(t){return Object.prototype.toString.call(t)}function Gfe(t){return ecn(t)==="[object String]"}const tcn=Object.prototype.hasOwnProperty;function ncn(t,e){return tcn.call(t,e)}function bH(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){if(n){if(typeof n!="object")throw new TypeError(n+"must be object");Object.keys(n).forEach(function(r){t[r]=n[r]})}}),t}function XJe(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))}function Yfe(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function kN(t){if(t>65535){t-=65536;const e=55296+(t>>10),n=56320+(t&1023);return String.fromCharCode(e,n)}return String.fromCharCode(t)}const ZJe=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,rcn=/&([a-z#][a-z0-9]{1,31});/gi,icn=new RegExp(ZJe.source+"|"+rcn.source,"gi"),ocn=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function scn(t,e){if(e.charCodeAt(0)===35&&ocn.test(e)){const r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return Yfe(r)?kN(r):t}const n=KJe(t);return n!==t?n:t}function acn(t){return t.indexOf("\\")<0?t:t.replace(ZJe,"$1")}function v_(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(icn,function(e,n,r){return n||scn(e,r)})}const lcn=/[&<>"]/,ccn=/[&<>"]/g,ucn={"&":"&","<":"<",">":">",'"':"""};function dcn(t){return ucn[t]}function S8(t){return lcn.test(t)?t.replace(ccn,dcn):t}const fcn=/[.?*+^$[\]\\(){}|-]/g;function hcn(t){return t.replace(fcn,"\\$&")}function Il(t){switch(t){case 9:case 32:return!0}return!1}function Vj(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function zj(t){return qfe.test(t)||qJe.test(t)}function Hj(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function vH(t){return t=t.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}const pcn={mdurl:Nln,ucmicro:Vln},mcn=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:XJe,assign:bH,escapeHtml:S8,escapeRE:hcn,fromCodePoint:kN,has:ncn,isMdAsciiPunct:Hj,isPunctChar:zj,isSpace:Il,isString:Gfe,isValidEntityCode:Yfe,isWhiteSpace:Vj,lib:pcn,normalizeReference:vH,unescapeAll:v_,unescapeMd:acn},Symbol.toStringTag,{value:"Module"}));function gcn(t,e,n){let r,i,o,s;const a=t.posMax,l=t.pos;for(t.pos=e+1,r=1;t.pos32))return o;if(r===41){if(s===0)break;s--}i++}return e===i||s!==0||(o.str=v_(t.slice(e,i)),o.pos=i,o.ok=!0),o}function bcn(t,e,n,r){let i,o=e;const s={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)s.str=r.str,s.marker=r.marker;else{if(o>=n)return s;let a=t.charCodeAt(o);if(a!==34&&a!==39&&a!==40)return s;e++,o++,a===40&&(a=41),s.marker=a}for(;o"+S8(o.content)+""};Gg.code_block=function(t,e,n,r,i){const o=t[e];return""+S8(t[e].content)+` +`};Gg.fence=function(t,e,n,r,i){const o=t[e],s=o.info?v_(o.info).trim():"";let a="",l="";if(s){const u=s.split(/(\s+)/g);a=u[0],l=u.slice(2).join("")}let c;if(n.highlight?c=n.highlight(o.content,a,l)||S8(o.content):c=S8(o.content),c.indexOf("${c} +`}return`
    ${c}
    +`};Gg.image=function(t,e,n,r,i){const o=t[e];return o.attrs[o.attrIndex("alt")][1]=i.renderInlineAsText(o.children,n,r),i.renderToken(t,e,n)};Gg.hardbreak=function(t,e,n){return n.xhtmlOut?`
    +`:`
    +`};Gg.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?`
    +`:`
    +`:` +`};Gg.text=function(t,e){return S8(t[e].content)};Gg.html_block=function(t,e){return t[e].content};Gg.html_inline=function(t,e){return t[e].content};function FS(){this.rules=bH({},Gg)}FS.prototype.renderAttrs=function(e){let n,r,i;if(!e.attrs)return"";for(i="",n=0,r=e.attrs.length;n +`:">",o};FS.prototype.renderInline=function(t,e,n){let r="";const i=this.rules;for(let o=0,s=t.length;o=0&&(r=this.attrs[n][1]),r};z0.prototype.attrJoin=function(e,n){const r=this.attrIndex(e);r<0?this.attrPush([e,n]):this.attrs[r][1]=this.attrs[r][1]+" "+n};function QJe(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}QJe.prototype.Token=z0;const xcn=/\r\n?|\n/g,Ccn=/\0/g;function wcn(t){let e;e=t.src.replace(xcn,` +`),e=e.replace(Ccn,"�"),t.src=e}function _cn(t){let e;t.inlineMode?(e=new t.Token("inline","",0),e.content=t.src,e.map=[0,1],e.children=[],t.tokens.push(e)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}function Scn(t){const e=t.tokens;for(let n=0,r=e.length;n\s]/i.test(t)}function Ecn(t){return/^<\/a\s*>/i.test(t)}function Tcn(t){const e=t.tokens;if(t.md.options.linkify)for(let n=0,r=e.length;n=0;s--){const a=i[s];if(a.type==="link_close"){for(s--;i[s].level!==a.level&&i[s].type!=="link_open";)s--;continue}if(a.type==="html_inline"&&(kcn(a.content)&&o>0&&o--,Ecn(a.content)&&o++),!(o>0)&&a.type==="text"&&t.md.linkify.test(a.content)){const l=a.content;let c=t.md.linkify.match(l);const u=[];let f=a.level,h=0;c.length>0&&c[0].index===0&&s>0&&i[s-1].type==="text_special"&&(c=c.slice(1));for(let p=0;ph){const w=new t.Token("text","",0);w.content=l.slice(h,b),w.level=f,u.push(w)}const v=new t.Token("link_open","a",1);v.attrs=[["href",g]],v.level=f++,v.markup="linkify",v.info="auto",u.push(v);const x=new t.Token("text","",0);x.content=y,x.level=f,u.push(x);const C=new t.Token("link_close","a",-1);C.level=--f,C.markup="linkify",C.info="auto",u.push(C),h=c[p].lastIndex}if(h=0;n--){const r=t[n];r.type==="text"&&!e&&(r.content=r.content.replace(jcn,Rcn)),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function Ocn(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&JJe.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function Pcn(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(Icn.test(t.tokens[e].content)&&Dcn(t.tokens[e].children),JJe.test(t.tokens[e].content)&&Ocn(t.tokens[e].children))}const $cn=/['"]/,aSe=/['"]/g,lSe="’";function VP(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function Mcn(t,e){let n;const r=[];for(let i=0;i=0&&!(r[n].level<=s);n--);if(r.length=n+1,o.type!=="text")continue;let a=o.content,l=0,c=a.length;e:for(;l=0)m=a.charCodeAt(u.index-1);else for(n=i-1;n>=0&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n--)if(t[n].content){m=t[n].content.charCodeAt(t[n].content.length-1);break}let g=32;if(l=48&&m<=57&&(h=f=!1),f&&h&&(f=y,h=b),!f&&!h){p&&(o.content=VP(o.content,u.index,lSe));continue}if(h)for(n=r.length-1;n>=0;n--){let C=r[n];if(r[n].level=0;e--)t.tokens[e].type!=="inline"||!$cn.test(t.tokens[e].content)||Mcn(t.tokens[e].children,t)}function Fcn(t){let e,n;const r=t.tokens,i=r.length;for(let o=0;o0&&this.level++,this.tokens.push(r),r};Yg.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};Yg.prototype.skipEmptyLines=function(e){for(let n=this.lineMax;en;)if(!Il(this.src.charCodeAt(--e)))return e+1;return e};Yg.prototype.skipChars=function(e,n){for(let r=this.src.length;er;)if(n!==this.src.charCodeAt(--e))return e+1;return e};Yg.prototype.getLines=function(e,n,r,i){if(e>=n)return"";const o=new Array(n-e);for(let s=0,a=e;ar?o[s]=new Array(l-r+1).join(" ")+this.src.slice(u,f):o[s]=this.src.slice(u,f)}return o.join("")};Yg.prototype.Token=z0;const Ncn=65536;function NJ(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function cSe(t){const e=[],n=t.length;let r=0,i=t.charCodeAt(r),o=!1,s=0,a="";for(;rn)return!1;let i=e+1;if(t.sCount[i]=4)return!1;let o=t.bMarks[i]+t.tShift[i];if(o>=t.eMarks[i])return!1;const s=t.src.charCodeAt(o++);if(s!==124&&s!==45&&s!==58||o>=t.eMarks[i])return!1;const a=t.src.charCodeAt(o++);if(a!==124&&a!==45&&a!==58&&!Il(a)||s===45&&Il(a))return!1;for(;o=4)return!1;c=cSe(l),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop();const f=c.length;if(f===0||f!==u.length)return!1;if(r)return!0;const h=t.parentType;t.parentType="table";const p=t.md.block.ruler.getRules("blockquote"),m=t.push("table_open","table",1),g=[e,0];m.map=g;const y=t.push("thead_open","thead",1);y.map=[e,e+1];const b=t.push("tr_open","tr",1);b.map=[e,e+1];for(let C=0;C=4||(c=cSe(l),c.length&&c[0]===""&&c.shift(),c.length&&c[c.length-1]===""&&c.pop(),x+=f-c.length,x>Ncn))break;if(i===e+2){const _=t.push("tbody_open","tbody",1);_.map=v=[e+2,0]}const w=t.push("tr_open","tr",1);w.map=[i,i+1];for(let _=0;_=4){r++,i=r;continue}break}t.line=i;const o=t.push("code_block","code",0);return o.content=t.getLines(e,i,4+t.blkIndent,!1)+` +`,o.map=[e,t.line],!0}function zcn(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||i+3>o)return!1;const s=t.src.charCodeAt(i);if(s!==126&&s!==96)return!1;let a=i;i=t.skipChars(i,s);let l=i-a;if(l<3)return!1;const c=t.src.slice(a,i),u=t.src.slice(i,o);if(s===96&&u.indexOf(String.fromCharCode(s))>=0)return!1;if(r)return!0;let f=e,h=!1;for(;f++,!(f>=n||(i=a=t.bMarks[f]+t.tShift[f],o=t.eMarks[f],i=4)&&(i=t.skipChars(i,s),!(i-a=4||t.src.charCodeAt(i)!==62)return!1;if(r)return!0;const a=[],l=[],c=[],u=[],f=t.md.block.ruler.getRules("blockquote"),h=t.parentType;t.parentType="blockquote";let p=!1,m;for(m=e;m=o)break;if(t.src.charCodeAt(i++)===62&&!x){let w=t.sCount[m]+1,_,S;t.src.charCodeAt(i)===32?(i++,w++,S=!1,_=!0):t.src.charCodeAt(i)===9?(_=!0,(t.bsCount[m]+w)%4===3?(i++,w++,S=!1):S=!0):_=!1;let k=w;for(a.push(t.bMarks[m]),t.bMarks[m]=i;i=o,l.push(t.bsCount[m]),t.bsCount[m]=t.sCount[m]+1+(_?1:0),c.push(t.sCount[m]),t.sCount[m]=k-w,u.push(t.tShift[m]),t.tShift[m]=i-t.bMarks[m];continue}if(p)break;let C=!1;for(let w=0,_=f.length;w<_;w++)if(f[w](t,m,n,!0)){C=!0;break}if(C){t.lineMax=m,t.blkIndent!==0&&(a.push(t.bMarks[m]),l.push(t.bsCount[m]),u.push(t.tShift[m]),c.push(t.sCount[m]),t.sCount[m]-=t.blkIndent);break}a.push(t.bMarks[m]),l.push(t.bsCount[m]),u.push(t.tShift[m]),c.push(t.sCount[m]),t.sCount[m]=-1}const g=t.blkIndent;t.blkIndent=0;const y=t.push("blockquote_open","blockquote",1);y.markup=">";const b=[e,0];y.map=b,t.md.block.tokenize(t,e,m);const v=t.push("blockquote_close","blockquote",-1);v.markup=">",t.lineMax=s,t.parentType=h,b[1]=t.line;for(let x=0;x=4)return!1;let o=t.bMarks[e]+t.tShift[e];const s=t.src.charCodeAt(o++);if(s!==42&&s!==45&&s!==95)return!1;let a=1;for(;o=r)return-1;let o=t.src.charCodeAt(i++);if(o<48||o>57)return-1;for(;;){if(i>=r)return-1;if(o=t.src.charCodeAt(i++),o>=48&&o<=57){if(i-n>=10)return-1;continue}if(o===41||o===46)break;return-1}return i=4||t.listIndent>=0&&t.sCount[l]-t.listIndent>=4&&t.sCount[l]=t.blkIndent&&(u=!0);let f,h,p;if((p=dSe(t,l))>=0){if(f=!0,s=t.bMarks[l]+t.tShift[l],h=Number(t.src.slice(s,p-1)),u&&h!==1)return!1}else if((p=uSe(t,l))>=0)f=!1;else return!1;if(u&&t.skipSpaces(p)>=t.eMarks[l])return!1;if(r)return!0;const m=t.src.charCodeAt(p-1),g=t.tokens.length;f?(a=t.push("ordered_list_open","ol",1),h!==1&&(a.attrs=[["start",h]])):a=t.push("bullet_list_open","ul",1);const y=[l,0];a.map=y,a.markup=String.fromCharCode(m);let b=!1;const v=t.md.block.ruler.getRules("list"),x=t.parentType;for(t.parentType="list";l=i?S=1:S=w-C,S>4&&(S=1);const k=C+S;a=t.push("list_item_open","li",1),a.markup=String.fromCharCode(m);const I=[l,0];a.map=I,f&&(a.info=t.src.slice(s,p-1));const j=t.tight,A=t.tShift[l],D=t.sCount[l],O=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=k,t.tight=!0,t.tShift[l]=_-t.bMarks[l],t.sCount[l]=w,_>=i&&t.isEmpty(l+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,l,n,!0),(!t.tight||b)&&(c=!1),b=t.line-l>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=O,t.tShift[l]=A,t.sCount[l]=D,t.tight=j,a=t.push("list_item_close","li",-1),a.markup=String.fromCharCode(m),l=t.line,I[1]=l,l>=n||t.sCount[l]=4)break;let P=!1;for(let $=0,M=v.length;$=4||t.src.charCodeAt(i)!==91)return!1;function a(v){const x=t.lineMax;if(v>=x||t.isEmpty(v))return null;let C=!1;if(t.sCount[v]-t.blkIndent>3&&(C=!0),t.sCount[v]<0&&(C=!0),!C){const S=t.md.block.ruler.getRules("reference"),k=t.parentType;t.parentType="reference";let I=!1;for(let j=0,A=S.length;j"u"&&(t.env.references={}),typeof t.env.references[b]>"u"&&(t.env.references[b]={title:y,href:f}),t.line=s),!0):!1}const Ycn=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Kcn="[a-zA-Z_:][a-zA-Z0-9:._-]*",Xcn="[^\"'=<>`\\x00-\\x20]+",Zcn="'[^']*'",Qcn='"[^"]*"',Jcn="(?:"+Xcn+"|"+Zcn+"|"+Qcn+")",eun="(?:\\s+"+Kcn+"(?:\\s*=\\s*"+Jcn+")?)",eet="<[A-Za-z][A-Za-z0-9\\-]*"+eun+"*\\s*\\/?>",tet="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",tun="",nun="<[?][\\s\\S]*?[?]>",run="]*>",iun="",oun=new RegExp("^(?:"+eet+"|"+tet+"|"+tun+"|"+nun+"|"+run+"|"+iun+")"),sun=new RegExp("^(?:"+eet+"|"+tet+")"),qx=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(sun.source+"\\s*$"),/^$/,!1]];function aun(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(i)!==60)return!1;let s=t.src.slice(i,o),a=0;for(;a=4)return!1;let s=t.src.charCodeAt(i);if(s!==35||i>=o)return!1;let a=1;for(s=t.src.charCodeAt(++i);s===35&&i6||ii&&Il(t.src.charCodeAt(l-1))&&(o=l),t.line=e+1;const c=t.push("heading_open","h"+String(a),1);c.markup="########".slice(0,a),c.map=[e,t.line];const u=t.push("inline","",0);u.content=t.src.slice(i,o).trim(),u.map=[e,t.line],u.children=[];const f=t.push("heading_close","h"+String(a),-1);return f.markup="########".slice(0,a),!0}function cun(t,e,n){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const i=t.parentType;t.parentType="paragraph";let o=0,s,a=e+1;for(;a3)continue;if(t.sCount[a]>=t.blkIndent){let p=t.bMarks[a]+t.tShift[a];const m=t.eMarks[a];if(p=m))){o=s===61?1:2;break}}if(t.sCount[a]<0)continue;let h=!1;for(let p=0,m=r.length;p3||t.sCount[o]<0)continue;let c=!1;for(let u=0,f=r.length;u=n||t.sCount[s]=o){t.line=n;break}const l=t.line;let c=!1;for(let u=0;u=t.line)throw new Error("block rule didn't increment state.line");break}if(!c)throw new Error("none of the block rules matched");t.tight=!a,t.isEmpty(t.line-1)&&(a=!0),s=t.line,s0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r};YR.prototype.scanDelims=function(t,e){const n=this.posMax,r=this.src.charCodeAt(t),i=t>0?this.src.charCodeAt(t-1):32;let o=t;for(;o0)return!1;const n=t.pos,r=t.posMax;if(n+3>r||t.src.charCodeAt(n)!==58||t.src.charCodeAt(n+1)!==47||t.src.charCodeAt(n+2)!==47)return!1;const i=t.pending.match(hun);if(!i)return!1;const o=i[1],s=t.md.linkify.matchAtStart(t.src.slice(n-o.length));if(!s)return!1;let a=s.url;if(a.length<=o.length)return!1;let l=a.length;for(;l>0&&a.charCodeAt(l-1)===42;)l--;l!==a.length&&(a=a.slice(0,l));const c=t.md.normalizeLink(a);if(!t.md.validateLink(c))return!1;if(!e){t.pending=t.pending.slice(0,-o.length);const u=t.push("link_open","a",1);u.attrs=[["href",c]],u.markup="linkify",u.info="auto";const f=t.push("text","",0);f.content=t.md.normalizeLinkText(a);const h=t.push("link_close","a",-1);h.markup="linkify",h.info="auto"}return t.pos+=a.length-o.length,!0}function mun(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==10)return!1;const r=t.pending.length-1,i=t.posMax;if(!e)if(r>=0&&t.pending.charCodeAt(r)===32)if(r>=1&&t.pending.charCodeAt(r-1)===32){let o=r-1;for(;o>=1&&t.pending.charCodeAt(o-1)===32;)o--;t.pending=t.pending.slice(0,o),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(n++;n?@[]^_`{|}~-".split("").forEach(function(t){Xfe[t.charCodeAt(0)]=1});function gun(t,e){let n=t.pos;const r=t.posMax;if(t.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=t.src.charCodeAt(n);if(i===10){for(e||t.push("hardbreak","br",0),n++;n=55296&&i<=56319&&n+1=56320&&a<=57343&&(o+=t.src[n+1],n++)}const s="\\"+o;if(!e){const a=t.push("text_special","",0);i<256&&Xfe[i]!==0?a.content=o:a.content=s,a.markup=s,a.info="escape"}return t.pos=n+1,!0}function yun(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==96)return!1;const i=n;n++;const o=t.posMax;for(;n=0;r--){const i=e[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;const o=e[i.end],s=r>0&&e[r-1].end===i.end+1&&e[r-1].marker===i.marker&&e[r-1].token===i.token-1&&e[i.end+1].token===o.token+1,a=String.fromCharCode(i.marker),l=t.tokens[i.token];l.type=s?"strong_open":"em_open",l.tag=s?"strong":"em",l.nesting=1,l.markup=s?a+a:a,l.content="";const c=t.tokens[o.token];c.type=s?"strong_close":"em_close",c.tag=s?"strong":"em",c.nesting=-1,c.markup=s?a+a:a,c.content="",s&&(t.tokens[e[r-1].token].content="",t.tokens[e[i.end+1].token].content="",r--)}}function Cun(t){const e=t.tokens_meta,n=t.tokens_meta.length;hSe(t,t.delimiters);for(let r=0;r=f)return!1;if(l=m,i=t.md.helpers.parseLinkDestination(t.src,m,t.posMax),i.ok){for(s=t.md.normalizeLink(i.str),t.md.validateLink(s)?m=i.pos:s="",l=m;m=f||t.src.charCodeAt(m)!==41)&&(c=!0),m++}if(c){if(typeof t.env.references>"u")return!1;if(m=0?r=t.src.slice(l,m++):m=p+1):m=p+1,r||(r=t.src.slice(h,p)),o=t.env.references[vH(r)],!o)return t.pos=u,!1;s=o.href,a=o.title}if(!e){t.pos=h,t.posMax=p;const g=t.push("link_open","a",1),y=[["href",s]];g.attrs=y,a&&y.push(["title",a]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=m,t.posMax=f,!0}function _un(t,e){let n,r,i,o,s,a,l,c,u="";const f=t.pos,h=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;const p=t.pos+2,m=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(m<0)return!1;if(o=m+1,o=h)return!1;for(c=o,a=t.md.helpers.parseLinkDestination(t.src,o,t.posMax),a.ok&&(u=t.md.normalizeLink(a.str),t.md.validateLink(u)?o=a.pos:u=""),c=o;o=h||t.src.charCodeAt(o)!==41)return t.pos=f,!1;o++}else{if(typeof t.env.references>"u")return!1;if(o=0?i=t.src.slice(c,o++):o=m+1):o=m+1,i||(i=t.src.slice(p,m)),s=t.env.references[vH(i)],!s)return t.pos=f,!1;u=s.href,l=s.title}if(!e){r=t.src.slice(p,m);const g=[];t.md.inline.parse(r,t.md,t.env,g);const y=t.push("image","img",0),b=[["src",u],["alt",""]];y.attrs=b,y.children=g,y.content=r,l&&b.push(["title",l])}return t.pos=o,t.posMax=h,!0}const Sun=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,kun=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Eun(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==60)return!1;const r=t.pos,i=t.posMax;for(;;){if(++n>=i)return!1;const s=t.src.charCodeAt(n);if(s===60)return!1;if(s===62)break}const o=t.src.slice(r+1,n);if(kun.test(o)){const s=t.md.normalizeLink(o);if(!t.md.validateLink(s))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",s]],a.markup="autolink",a.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(o);const c=t.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return t.pos+=o.length+2,!0}if(Sun.test(o)){const s=t.md.normalizeLink("mailto:"+o);if(!t.md.validateLink(s))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",s]],a.markup="autolink",a.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(o);const c=t.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return t.pos+=o.length+2,!0}return!1}function Tun(t){return/^\s]/i.test(t)}function Iun(t){return/^<\/a\s*>/i.test(t)}function jun(t){const e=t|32;return e>=97&&e<=122}function Aun(t,e){if(!t.md.options.html)return!1;const n=t.posMax,r=t.pos;if(t.src.charCodeAt(r)!==60||r+2>=n)return!1;const i=t.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!jun(i))return!1;const o=t.src.slice(r).match(oun);if(!o)return!1;if(!e){const s=t.push("html_inline","",0);s.content=o[0],Tun(s.content)&&t.linkLevel++,Iun(s.content)&&t.linkLevel--}return t.pos+=o[0].length,!0}const Run=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Dun=/^&([a-z][a-z0-9]{1,31});/i;function Oun(t,e){const n=t.pos,r=t.posMax;if(t.src.charCodeAt(n)!==38||n+1>=r)return!1;if(t.src.charCodeAt(n+1)===35){const o=t.src.slice(n).match(Run);if(o){if(!e){const s=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),a=t.push("text_special","",0);a.content=Yfe(s)?kN(s):kN(65533),a.markup=o[0],a.info="entity"}return t.pos+=o[0].length,!0}}else{const o=t.src.slice(n).match(Dun);if(o){const s=KJe(o[0]);if(s!==o[0]){if(!e){const a=t.push("text_special","",0);a.content=s,a.markup=o[0],a.info="entity"}return t.pos+=o[0].length,!0}}}return!1}function pSe(t){const e={},n=t.length;if(!n)return;let r=0,i=-2;const o=[];for(let s=0;sl;c-=o[c]+1){const f=t[c];if(f.marker===a.marker&&f.open&&f.end<0){let h=!1;if((f.close||a.open)&&(f.length+a.length)%3===0&&(f.length%3!==0||a.length%3!==0)&&(h=!0),!h){const p=c>0&&!t[c-1].open?o[c-1]+1:0;o[s]=s-c+p,o[c]=p,a.open=!1,f.end=s,f.close=!1,u=-1,i=-2;break}}}u!==-1&&(e[a.marker][(a.open?3:0)+(a.length||0)%3]=u)}}function Pun(t){const e=t.tokens_meta,n=t.tokens_meta.length;pSe(t.delimiters);for(let r=0;r0&&r++,i[e].type==="text"&&e+1=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;s||t.pos++,o[e]=t.pos};KR.prototype.tokenize=function(t){const e=this.ruler.getRules(""),n=e.length,r=t.posMax,i=t.md.options.maxNesting;for(;t.pos=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(s){if(t.pos>=r)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};KR.prototype.parse=function(t,e,n,r){const i=new this.State(t,e,n,r);this.tokenize(i);const o=this.ruler2.getRules(""),s=o.length;for(let a=0;a|$))",e.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function Hoe(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){t[r]=n[r]})}),t}function CH(t){return Object.prototype.toString.call(t)}function Lun(t){return CH(t)==="[object String]"}function Fun(t){return CH(t)==="[object Object]"}function Nun(t){return CH(t)==="[object RegExp]"}function mSe(t){return CH(t)==="[object Function]"}function Bun(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const iet={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function Vun(t){return Object.keys(t||{}).reduce(function(e,n){return e||iet.hasOwnProperty(n)},!1)}const zun={"http:":{validate:function(t,e,n){const r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){const r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){const r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},Hun="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",Uun="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function Wun(t){t.__index__=-1,t.__text_cache__=""}function qun(t){return function(e,n){const r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function gSe(){return function(t,e){e.normalize(t)}}function EN(t){const e=t.re=Mun(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(Hun),n.push(e.src_xn),e.src_tlds=n.join("|");function r(a){return a.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");const i=[];t.__compiled__={};function o(a,l){throw new Error('(LinkifyIt) Invalid schema "'+a+'": '+l)}Object.keys(t.__schemas__).forEach(function(a){const l=t.__schemas__[a];if(l===null)return;const c={validate:null,link:null};if(t.__compiled__[a]=c,Fun(l)){Nun(l.validate)?c.validate=qun(l.validate):mSe(l.validate)?c.validate=l.validate:o(a,l),mSe(l.normalize)?c.normalize=l.normalize:l.normalize?o(a,l):c.normalize=gSe();return}if(Lun(l)){i.push(a);return}o(a,l)}),i.forEach(function(a){t.__compiled__[t.__schemas__[a]]&&(t.__compiled__[a].validate=t.__compiled__[t.__schemas__[a]].validate,t.__compiled__[a].normalize=t.__compiled__[t.__schemas__[a]].normalize)}),t.__compiled__[""]={validate:null,normalize:gSe()};const s=Object.keys(t.__compiled__).filter(function(a){return a.length>0&&t.__compiled__[a]}).map(Bun).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+s+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+s+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),Wun(t)}function Gun(t,e){const n=t.__index__,r=t.__last_index__,i=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=i,this.text=i,this.url=i}function Uoe(t,e){const n=new Gun(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function Vh(t,e){if(!(this instanceof Vh))return new Vh(t,e);e||Vun(t)&&(e=t,t={}),this.__opts__=Hoe({},iet,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Hoe({},zun,t),this.__compiled__={},this.__tlds__=Uun,this.__tlds_replaced__=!1,this.re={},EN(this)}Vh.prototype.add=function(e,n){return this.__schemas__[e]=n,EN(this),this};Vh.prototype.set=function(e){return this.__opts__=Hoe(this.__opts__,e),this};Vh.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let n,r,i,o,s,a,l,c,u;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(n=l.exec(e))!==null;)if(o=this.testSchemaAt(e,n[2],l.lastIndex),o){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+o;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c=0&&(i=e.match(this.re.email_fuzzy))!==null&&(s=i.index+i[1].length,a=i.index+i[0].length,(this.__index__<0||sthis.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=a))),this.__index__>=0};Vh.prototype.pretest=function(e){return this.re.pretest.test(e)};Vh.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0};Vh.prototype.match=function(e){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===e&&(n.push(Uoe(this,r)),r=this.__last_index__);let i=r?e.slice(r):e;for(;this.test(i);)n.push(Uoe(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};Vh.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const n=this.re.schema_at_start.exec(e);if(!n)return null;const r=this.testSchemaAt(e,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,Uoe(this,0)):null};Vh.prototype.tlds=function(e,n){return e=Array.isArray(e)?e:[e],n?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,i,o){return r!==o[i-1]}).reverse(),EN(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,EN(this),this)};Vh.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};Vh.prototype.onCompile=function(){};const ww=2147483647,K5=36,Zfe=1,Uj=26,Yun=38,Kun=700,oet=72,set=128,aet="-",Xun=/^xn--/,Zun=/[^\0-\x7F]/,Qun=/[\x2E\u3002\uFF0E\uFF61]/g,Jun={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},zJ=K5-Zfe,X5=Math.floor,HJ=String.fromCharCode;function O4(t){throw new RangeError(Jun[t])}function edn(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function cet(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(Qun,".");const i=t.split("."),o=edn(i,e).join(".");return r+o}function uet(t){const e=[];let n=0;const r=t.length;for(;n=55296&&i<=56319&&nString.fromCodePoint(...t),ndn=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:K5},ySe=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},det=function(t,e,n){let r=0;for(t=n?X5(t/Kun):t>>1,t+=X5(t/e);t>zJ*Uj>>1;r+=K5)t=X5(t/zJ);return X5(r+(zJ+1)*t/(t+Yun))},fet=function(t){const e=[],n=t.length;let r=0,i=set,o=oet,s=t.lastIndexOf(aet);s<0&&(s=0);for(let a=0;a=128&&O4("not-basic"),e.push(t.charCodeAt(a));for(let a=s>0?s+1:0;a=n&&O4("invalid-input");const h=ndn(t.charCodeAt(a++));h>=K5&&O4("invalid-input"),h>X5((ww-r)/u)&&O4("overflow"),r+=h*u;const p=f<=o?Zfe:f>=o+Uj?Uj:f-o;if(hX5(ww/m)&&O4("overflow"),u*=m}const c=e.length+1;o=det(r-l,c,l==0),X5(r/c)>ww-i&&O4("overflow"),i+=X5(r/c),r%=c,e.splice(r++,0,i)}return String.fromCodePoint(...e)},het=function(t){const e=[];t=uet(t);const n=t.length;let r=set,i=0,o=oet;for(const l of t)l<128&&e.push(HJ(l));const s=e.length;let a=s;for(s&&e.push(aet);a=r&&uX5((ww-i)/c)&&O4("overflow"),i+=(l-r)*c,r=l;for(const u of t)if(uww&&O4("overflow"),u===r){let f=i;for(let h=K5;;h+=K5){const p=h<=o?Zfe:h>=o+Uj?Uj:h-o;if(f=0))try{e.hostname=pet.toASCII(e.hostname)}catch{}return GR(Ufe(e))}function hdn(t){const e=Wfe(t,!0);if(e.hostname&&(!e.protocol||met.indexOf(e.protocol)>=0))try{e.hostname=pet.toUnicode(e.hostname)}catch{}return b_(Ufe(e),b_.defaultChars+"%")}function Qp(t,e){if(!(this instanceof Qp))return new Qp(t,e);e||Gfe(t)||(e=t||{},t="default"),this.inline=new KR,this.block=new xH,this.core=new Kfe,this.renderer=new FS,this.linkify=new Vh,this.validateLink=ddn,this.normalizeLink=fdn,this.normalizeLinkText=hdn,this.utils=mcn,this.helpers=bH({},vcn),this.options={},this.configure(t),e&&this.set(e)}Qp.prototype.set=function(t){return bH(this.options,t),this};Qp.prototype.configure=function(t){const e=this;if(Gfe(t)){const n=t;if(t=ldn[n],!t)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)}),this};Qp.prototype.enable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};Qp.prototype.disable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};Qp.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};Qp.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");const n=new this.core.State(t,this,e);return this.core.process(n),n.tokens};Qp.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};Qp.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens};Qp.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};function Qfe(){return gdn(12)}const pdn=(()=>{let t;return()=>{if(t)return t;t=[];for(let e=0;e<256;++e)t[e]=(e+256).toString(16).slice(1);return t}})();function mdn(t=16){const e=new Uint8Array(t);return crypto.getRandomValues(e),e}function gdn(t){const e=pdn();return mdn(t).reduce((n,r)=>n+e[r],"").slice(0,t)}const ydn=Afe({});function bdn(t){const e=new Map,n=new Map;let r;for(let i=0;i{if(c===o.listItem)return;const u=[];l.forEach((f,h)=>{h>=o.level&&u.push(h)}),u.forEach(f=>{l.delete(f)})});const s=e.get(o.listItem)??new Map,a=s.get(o.level)??0;s.set(o.level,a+1),e.set(o.listItem,s),n.set(o._key,a+1),r={listItem:o.listItem,level:o.level}}return n}const vdn=(t,e)=>{function n(l){const{node:c,index:u,isInline:f}=l;return d_(c)?r(c,u):aH(c)?i(c):y1(c)?o(c,u,f):lH(c)?s(c):a(c,u,f)}function r(l,c){const u=t.listItem,f=(typeof u=="function"?u:u[l.listItem])||t.unknownListItem;let h=cH(l).map((p,m)=>n({node:p,isInline:!0,index:m})).join("");if(l.style&&l.style!=="normal"){const{listItem:p,...m}=l;h=n({node:m,index:c,isInline:!1}),h=h.replace(/\n+$/,"")}return f({value:l,index:c,listIndex:l._key?e.get(l._key):void 0,isInline:!1,renderNode:n,children:h})}function i(l){const{markDef:c,markType:u,markKey:f}=l,h=t.marks[u]||t.unknownMark,p=l.children.map((m,g)=>n({node:m,index:g,isInline:!0}));return h({text:uH(l),value:c,markType:u,markKey:f,renderNode:n,children:p.join("")})}function o(l,c,u){const{_key:f,...h}=xdn({node:l,index:c,isInline:u,renderNode:n}),p=h.node.style||"normal";return((typeof t.block=="function"?t.block:t.block[p])||t.unknownBlockStyle)({...h,value:h.node,renderNode:n})}function s(l){return l.text===` +`?t.hardBreak():l.text}function a(l,c,u){return(t.types[l._type]??t.unknownType)({value:l,isInline:u,index:c,renderNode:n})}return n};function xdn(t){const{node:e,index:n,isInline:r,renderNode:i}=t,o=cH(e).map((s,a)=>i({node:s,isInline:!0,index:a,renderNode:i}));return{_key:e._key||Qfe(),children:o.join(""),index:n,isInline:r,node:e}}const Cdn=({current:t,next:e})=>d_(t)&&d_(e)?` +`:y1(t)&&y1(e)&&t.style==="blockquote"&&e.style==="blockquote"?` +> +`:` + +`,wdn=()=>` +`,_dn=({children:t,value:e,listIndex:n})=>{const r=e.listItem||"bullet",i=e.level||1;return r==="number"?`${" ".repeat(i-1)}${n??1}. ${t}`:`${" ".repeat(i-1)}- ${t}`},Sdn=({children:t})=>`- ${t} +`;function bSe(t){return t.replace(/([[\]\\])/g,"\\$1")}function vSe(t){return t.replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,"$1")}function kdn(t){return t.replace(/([\\"])/g,"\\$1")}const Edn=({children:t})=>`_${t}_`,Tdn=({children:t})=>`**${t}**`,Idn=({children:t})=>`\`${t}\``,jdn=({children:t})=>`${t}`,Adn=({children:t})=>`~~${t}~~`,Rdn=({children:t,value:e})=>{const n=e?.href||"",r=e?.title||"";if(Ddn(n)){if(/["'][^"']*[<>]|[<>][^<>]*["']/.test(n)){const i=n.replace(/["<>() ]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`);return`[${bSe(t)}](${i})`}return`[${bSe(t)}](${n}${r?` "${kdn(r)}"`:""})`}return t};function Ddn(t){const e=(t||"").trim(),n=e.charAt(0);if(n==="#"||n==="/")return!0;const r=e.indexOf(":");if(r===-1)return!0;const i=["http","https","mailto","tel"],o=e.slice(0,r).toLowerCase();if(i.indexOf(o)!==-1)return!0;const s=e.indexOf("?");if(s!==-1&&r>s)return!0;const a=e.indexOf("#");return a!==-1&&r>a}const Odn=({children:t})=>t,Pdn=({children:t})=>!t||t.trim()===""?"":t,$dn=({children:t})=>t?t.split(` +`).map(e=>`> ${e}`).join(` +`):">",Mdn=({children:t})=>`# ${t}`,Ldn=({children:t})=>`## ${t}`,Fdn=({children:t})=>`### ${t}`,Ndn=({children:t})=>`#### ${t}`,Bdn=({children:t})=>`##### ${t}`,Vdn=({children:t})=>`###### ${t}`,zdn=({children:t})=>t??"",Hdn=({value:t,isInline:e})=>{const n=`\`\`\`json +${JSON.stringify(t,null,2)} +\`\`\``;return e?` +${n} +`:n},A3={types:{},block:{normal:Pdn,blockquote:$dn,h1:Mdn,h2:Ldn,h3:Fdn,h4:Ndn,h5:Bdn,h6:Vdn},marks:{em:Edn,strong:Tdn,code:Idn,underline:jdn,"strike-through":Adn,link:Rdn},listItem:_dn,hardBreak:wdn,unknownType:Hdn,unknownMark:Odn,unknownListItem:Sdn,unknownBlockStyle:zdn};function Udn(t,e={}){const n={block:{...A3.block,...e.block},listItem:e.listItem??A3.listItem,marks:{...A3.marks,...e.marks},types:{...A3.types,...e.types},hardBreak:e.hardBreak??A3.hardBreak,unknownType:e.unknownType??A3.unknownType,unknownBlockStyle:e.unknownBlockStyle??A3.unknownBlockStyle,unknownListItem:e.unknownListItem??A3.unknownListItem,unknownMark:e.unknownMark??A3.unknownMark},r=e.blockSpacing??Cdn,i=bdn(t),o=vdn(n,i);return t.map((s,a)=>{const l=o({node:s,index:a,isInline:!1,renderNode:o});if(a===t.length-1)return l;const c=t.at(a+1);if(!c)return l;const u=r({current:s,next:c})??` + +`;return`${l}${u}`}).join("")}const get={name:"normal"},yet={name:"h1"},bet={name:"h2"},vet={name:"h3"},xet={name:"h4"},Cet={name:"h5"},wet={name:"h6"},_et={name:"blockquote"},ket={name:"number"},Eet={name:"bullet"},Tet={name:"strong"},Iet={name:"em"},jet={name:"code"},Aet={name:"strike-through"},Ret={name:"link",fields:[{name:"href",type:"string"},{name:"title",type:"string"}]},Det={name:"code",fields:[{name:"language",type:"string"},{name:"code",type:"string"}]},Woe={name:"image",fields:[{name:"src",type:"string"},{name:"alt",type:"string"},{name:"title",type:"string"}]},Oet={name:"horizontal-rule"},Pet={name:"html",fields:[{name:"html",type:"string"}]},Wdn={name:"table",fields:[{name:"headerRows",type:"number"},{name:"rows",type:"array"}]},qdn=Afe({styles:[get,yet,bet,vet,xet,Cet,wet,_et],lists:[ket,Eet],decorators:[Tet,Iet,jet,Aet],annotations:[Ret],blockObjects:[Det,Oet,Woe,Pet,Wdn],inlineObjects:[Woe]});function _4(t){return({context:e})=>{const n=e.schema.styles.find(r=>r.name===t.name);if(n)return n.name}}function xSe(t){return({context:e})=>{const n=e.schema.lists.find(r=>r.name===t.name);if(n)return n.name}}function HP(t){return({context:e})=>{const n=e.schema.decorators.find(r=>r.name===t.name);if(n)return n.name}}function Gdn(t){return({context:e,value:n})=>{const r=e.schema.annotations.find(o=>o.name===t.name);if(!r)return;const i=r.fields.reduce((o,s)=>{const a=n[s.name];return a!==void 0&&(o[s.name]=a),o},{});return{_key:e.keyGenerator(),_type:r.name,...i}}}function TN(t){return({context:e,value:n,isInline:r})=>{const i=(r?e.schema.inlineObjects:e.schema.blockObjects).find(s=>s.name===t.name);if(!i)return;const o=i.fields.reduce((s,a)=>{const l=n[a.name];return l!==void 0&&(s[a.name]=l),s},{});return{_key:e.keyGenerator(),_type:i.name,...o}}}const Ydn=({context:t,value:e,isInline:n})=>{const r=TN(Det)({context:t,value:e,isInline:n});if(r&&"code"in r)return r},Kdn=({context:t,value:e,isInline:n})=>{const r=TN(Woe)({context:t,value:e,isInline:n});if(r&&"src"in r)return r},UP={block:{normal:_4(get),blockquote:_4(_et),h1:_4(yet),h2:_4(bet),h3:_4(vet),h4:_4(xet),h5:_4(Cet),h6:_4(wet)},listItem:{number:xSe(ket),bullet:xSe(Eet)},marks:{strong:HP(Tet),em:HP(Iet),code:HP(jet),strikeThrough:HP(Aet),link:Gdn(Ret)},types:{code:Ydn,horizontalRule:TN(Oet),html:TN(Pet),image:Kdn}};function CSe(t,e){for(const n of t.rows)for(const r of n.cells)for(const i of r.value)e.push(i)}function Xdn(t,e){const n={schema:e?.schema??qdn,keyGenerator:e?.keyGenerator??Qfe,html:{inline:e?.html?.inline??"skip"},marks:{...UP.marks,...e?.marks},block:{...UP.block,...e?.block},listItem:{...UP.listItem,...e?.listItem},types:{...UP.types,...e?.types}},r=Qp({html:!0,linkify:!0,typographer:!0}).enable(["strikethrough","table"]).parse(t,{}),i=[];let o=null;const s=[],a=[];let l=[],c=null,u=!1,f=null,h=null,p=!1;const m=x=>{g(),o={_type:"block",style:x,children:[],_key:n.keyGenerator(),markDefs:[]},l=[]},g=()=>{o&&(o.children.length===0&&o.children.push({_type:n.schema.span.name,_key:n.keyGenerator(),text:"",marks:[]}),o.markDefs=l,i.push(o),o=null,l=[])},y=x=>{if(x.length===0)return;if(!o){const w=c??n.block.normal({context:{schema:n.schema}});w?m(w):(console.warn('No default style found, using "normal"'),m("normal"))}if(!o)throw new Error("Expected current block");const C=o.children.at(-1);Ci({schema:n.schema},C)&&C.marks?.every(w=>a.includes(w))&&a.every(w=>C.marks?.includes(w))?C.text+=x:o.children.push({_type:n.schema.span.name,_key:n.keyGenerator(),text:x,marks:[...a]})},b=()=>s.length,v=x=>{if(!o){const C=c??n.block.normal({context:{schema:n.schema}});C?m(C):(console.warn('No default style found, using "normal"'),m("normal"))}if(!o)throw new Error("Expected current block");(o.listItem!==x||o.level!==b())&&(o.listItem=x,o.level=b())};for(const x of r)switch(x.type){case"paragraph_open":{if(u){if(!o){const w=s.at(-1);w&&v(w)}break}const C=c??n.block.normal({context:{schema:n.schema}});if(!C){console.warn('No default style found, using "normal"'),m("normal");break}m(C);break}case"paragraph_close":if(u)break;g();break;case"heading_open":{const C=Number(x?.tag?.slice(1)),w={1:n.block.h1,2:n.block.h2,3:n.block.h3,4:n.block.h4,5:n.block.h5,6:n.block.h6}[C],_=w?.({context:{schema:n.schema}})??n.block.normal({context:{schema:n.schema}});if(!_){console.warn('No heading style found, using "normal"'),m("normal");break}m(_);break}case"heading_close":g();break;case"blockquote_open":{g(),c=n.block.blockquote({context:{schema:n.schema}})??n.block.normal({context:{schema:n.schema}})??"normal";break}case"blockquote_close":{g(),c=null;break}case"bullet_list_open":{const C=n.listItem.bullet({context:{schema:n.schema}});if(!C){s.push(null);break}s.push(C);break}case"ordered_list_open":{const C=n.listItem.number({context:{schema:n.schema}});if(!C){s.push(null);break}s.push(C);break}case"bullet_list_close":case"ordered_list_close":s.pop();break;case"list_item_open":{const C=s.at(-1);if(C===void 0)throw new Error("Expected an open list");if(o&&g(),C===null){const w=c??n.block.normal({context:{schema:n.schema}});w?m(w):(console.warn('No default style found, using "normal"'),m("normal")),u=!0;break}v(C),u=!0;break}case"list_item_close":u=!1,g();break;case"fence":{g();const C=x.info.trim()||void 0,w=x.content.replace(/\n$/,""),_=n.types.code({context:{schema:n.schema,keyGenerator:n.keyGenerator},value:{language:C,code:w},isInline:!1});if(!_){const S=n.block.normal({context:{schema:n.schema}});S?m(S):(console.warn('No default style found, using "normal"'),m("normal")),y(w),g();break}i.push(_);break}case"hr":{g();const C=n.types.horizontalRule({context:{schema:n.schema,keyGenerator:n.keyGenerator},value:{},isInline:!1});if(!C){const w=n.block.normal({context:{schema:n.schema}});w?m(w):(console.warn('No default style found, using "normal"'),m("normal")),y("---"),g();break}i.push(C);break}case"html_block":{g();const C=x.content.trim();if(!C)break;const w=n.types.html({context:{schema:n.schema,keyGenerator:n.keyGenerator},value:{html:C},isInline:!1});if(!w){const _=n.block.normal({context:{schema:n.schema}});_?m(_):(console.warn('No default style found, using "normal"'),m("normal")),y(C),g();break}i.push(w);break}case"code_block":{g();const C=x.content.replace(/\n$/,""),w=n.types.code({context:{schema:n.schema,keyGenerator:n.keyGenerator},value:{language:void 0,code:C},isInline:!1});if(w)i.push(w);else{const _=n.block.normal({context:{schema:n.schema}});_?m(_):(console.warn('No default style found, using "normal"'),m("normal")),y(C),g()}break}case"table_open":g(),f={rows:[],headerRows:0};break;case"table_close":{if(!f)break;if(n.types.table){const C=n.types.table({context:{schema:n.schema,keyGenerator:n.keyGenerator},value:{rows:f.rows,headerRows:f.headerRows>0?f.headerRows:void 0},isInline:!1});C?i.push(C):CSe(f,i)}else CSe(f,i);f=null;break}case"thead_open":p=!0;break;case"thead_close":p=!1;break;case"tbody_open":case"tbody_close":break;case"tr_open":h=[];break;case"tr_close":f&&h&&(f.rows.push({_key:n.keyGenerator(),_type:"row",cells:h}),p&&f.headerRows++),h=null;break;case"th_open":case"td_open":{const C=n.block.normal({context:{schema:n.schema}});C?m(C):(console.warn('No default style found, using "normal"'),m("normal"));break}case"th_close":case"td_close":{g();const C=[];if(i.length>0){const _=i.at(-1);_&&_._type==="block"&&C.push(i.pop())}C.length===0&&C.push({_type:"block",style:n.block.normal({context:{schema:n.schema}})||"normal",children:[{_type:n.schema.span.name,_key:n.keyGenerator(),text:"",marks:[]}],_key:n.keyGenerator(),markDefs:[]});const w=C[0];if(C.length===1&&w&&w._type==="block"&&"children"in w&&Array.isArray(w.children)&&w.children.length===1){const _=w.children[0];typeof _=="object"&&_!==null&&"_type"in _&&_._type!==n.schema.span.name&&_._type==="image"&&(C[0]=_)}h!==null&&h.push({_type:"cell",_key:n.keyGenerator(),value:C});break}case"inline":{const C=h!==null;if(x.children?.length===1&&x.children[0]?.type==="image"){const w=x.children[0];if(!w)break;const _=w.attrs?.find(([A])=>A==="src")?.at(1)||"",S=vSe(w.content||""),k=w.attrs?.find(([A])=>A==="title")?.at(1)||void 0,I=n.types.image({context:{schema:n.schema,keyGenerator:n.keyGenerator},value:{src:_,alt:S,title:k},isInline:!1});if(I){C?o&&"children"in o&&o.children.push(I):(o&&"children"in o&&o.children.length>0?g():(o=null,l=[]),i.push(I));break}const j=n.types.image({context:{schema:n.schema,keyGenerator:n.keyGenerator},value:{src:_,alt:S,title:k},isInline:!0});if(j){if(!o)if(u){const A=s.at(-1);A&&v(A)}else{const A=n.block.normal({context:{schema:n.schema}});A&&m(A)}o&&"children"in o&&o.children.push(j);break}y(`![${S}](${_})`);break}for(const w of x.children??[])switch(w.type){case"text":y(w.content);break;case"softbreak":case"hardbreak":y(` +`);break;case"code_inline":{const _=n.marks.code({context:{schema:n.schema}});if(!_){y(w.content);break}a.push(_),y(w.content);const S=a.lastIndexOf(_);S!==-1&&a.splice(S,1);break}case"strong_open":{const _=n.marks.strong({context:{schema:n.schema}});if(!_)break;a.push(_);break}case"strong_close":{const _=n.marks.strong({context:{schema:n.schema}});if(!_)break;const S=a.lastIndexOf(_);S!==-1&&a.splice(S,1);break}case"em_open":{const _=n.marks.em({context:{schema:n.schema}});if(!_)break;a.push(_);break}case"em_close":{const _=n.marks.em({context:{schema:n.schema}});if(!_)break;const S=a.lastIndexOf(_);S!==-1&&a.splice(S,1);break}case"s_open":{const _=n.marks.strikeThrough({context:{schema:n.schema}});if(!_)break;a.push(_);break}case"s_close":{const _=n.marks.strikeThrough({context:{schema:n.schema}});if(!_)break;const S=a.lastIndexOf(_);S!==-1&&a.splice(S,1);break}case"link_open":{const _=w.attrs?.find(([I])=>I==="href")?.at(1);if(!_)break;const S=w.attrs?.find(([I])=>I==="title")?.at(1),k=n.marks.link({context:{schema:n.schema,keyGenerator:n.keyGenerator},value:{href:_,title:S}});if(!k)break;l.push(k),a.push(k._key);break}case"link_close":{const _=new Set(l.map(k=>k._key));let S;for(const k of a.reverse())if(_.has(k)){S=a.indexOf(k);break}if(S!==void 0){const k=a.length-1-S;a.splice(k,1)}break}case"image":{const _=w.attrs?.find(([A])=>A==="src")?.at(1)||"",S=vSe(w.content||""),k=n.types.image({context:{schema:n.schema,keyGenerator:n.keyGenerator},value:{src:_,alt:S,title:void 0},isInline:!0});if(k){if(!o){const A=n.block.normal({context:{schema:n.schema}});A?m(A):(console.warn('No default style found, using "normal"'),m("normal"))}if(!o)throw new Error("Expected current block after startBlock");o.children.push(k);break}const I=n.types.image({context:{schema:n.schema,keyGenerator:n.keyGenerator},value:{src:_,alt:S,title:void 0},isInline:!1});if(!I){y(`![${S}](${_})`);break}if(C){o&&"children"in o&&o.children.push(I);break}g(),i.push(I);const j=n.block.normal({context:{schema:n.schema}});j&&m(j);break}case"html_inline":{n.html.inline==="text"&&y(w.content);break}}break}}return g(),i}const wH=YXe;function XR(t){const[e,n]=t;return[e,n]}function wSe(t,e){let n=t,r=e;const i=n.length,o=r.length;if(i===0||o===0)return 0;i>o?n=n.substring(i-o):i=55296&&e<=56319}function qoe(t){const e=t.charCodeAt(0);return e>=56320&&e<=57343}function Qdn(t,e,n){const r=t.length,i=e.length,o=Math.ceil((r+i)/2),s=o,a=2*o,l=new Array(a),c=new Array(a);for(let y=0;yn);y++){for(let b=-y+h;b<=y-p;b+=2){const v=s+b;let x;b===-y||b!==y&&l[v-1]r)p+=2;else if(C>i)h+=2;else if(f){const w=s+u-b;if(w>=0&&w=_)return _Se(t,e,x,C,n)}}}for(let b=-y+m;b<=y-g;b+=2){const v=s+b;let x;b===-y||b!==y&&c[v-1]r)g+=2;else if(C>i)m+=2;else if(!f){const w=s+u-b;if(w>=0&&w=x)return _Se(t,e,_,S,n)}}}}return[[Oa,t],[fl,e]]}function _Se(t,e,n,r,i){const o=t.substring(0,n),s=e.substring(0,r),a=t.substring(n),l=e.substring(r),c=L9(o,s,{checkLines:!1,deadline:i}),u=L9(a,l,{checkLines:!1,deadline:i});return c.concat(u)}function Jdn(t,e,n=1){if(n<=0)return null;const r=t.length>e.length?t:e,i=t.length>e.length?e:t;if(r.length<4||i.length*2s[4].length?o:s;else{if(!o&&!s)return null;s?o||(a=s):a=o}if(!a)throw new Error("Unable to find a half match.");let l,c,u,f;t.length>e.length?(l=a[0],c=a[1],u=a[2],f=a[3]):(u=a[0],f=a[1],l=a[2],c=a[3]);const h=a[4];return[l,c,u,f,h]}function SSe(t,e,n){const r=t.slice(n,n+Math.floor(t.length/4));let i=-1,o="",s,a,l,c;for(;(i=e.indexOf(r,i+1))!==-1;){const u=Jfe(t.slice(n),e.slice(i)),f=_H(t.slice(0,n),e.slice(0,i));o.length=t.length?[s||"",a||"",l||"",c||"",o||""]:null}function e1n(t,e){for(let n=0;n=1&&u>=1){a.splice(l-c-u,c+u),l=l-c-u;const p=L9(f,h,{checkLines:!1,deadline:n.deadline});for(let m=p.length-1;m>=0;m--)a.splice(l,0,p[m]);l+=p.length}u=0,c=0,f="",h="";break;default:throw new Error("Unknown diff operation.")}l++}return a.pop(),a}function r1n(t,e,n){let r;if(!t)return[[fl,e]];if(!e)return[[Oa,t]];const i=t.length>e.length?t:e,o=t.length>e.length?e:t,s=i.indexOf(o);if(s!==-1)return r=[[fl,i.substring(0,s)],[uo,o],[fl,i.substring(s+o.length)]],t.length>e.length&&(r[0][0]=Oa,r[2][0]=Oa),r;if(o.length===1)return[[Oa,t],[fl,e]];const a=Jdn(t,e);if(a){const l=a[0],c=a[1],u=a[2],f=a[3],h=a[4],p=L9(l,u,n),m=L9(c,f,n);return p.concat([[uo,h]],m)}return n.checkLines&&t.length>100&&e.length>100?n1n(t,e,n):Qdn(t,e,n.deadline)}var i1n=Object.defineProperty,kSe=Object.getOwnPropertySymbols,o1n=Object.prototype.hasOwnProperty,s1n=Object.prototype.propertyIsEnumerable,ESe=(t,e,n)=>e in t?i1n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,a1n=(t,e)=>{for(var n in e||(e={}))o1n.call(e,n)&&ESe(t,n,e[n]);if(kSe)for(var n of kSe(e))s1n.call(e,n)&&ESe(t,n,e[n]);return t};const Oa=-1,fl=1,uo=0;function NS(t,e,n){if(t===null||e===null)throw new Error("Null input. (diff)");const r=L9(t,e,c1n(n||{}));return d1n(r),r}function L9(t,e,n){let r=t,i=e;if(r===i)return r?[[uo,r]]:[];let o=Jfe(r,i);const s=r.substring(0,o);r=r.substring(o),i=i.substring(o),o=_H(r,i);const a=r.substring(r.length-o);r=r.substring(0,r.length-o),i=i.substring(0,i.length-o);let l=r1n(r,i,n);return s&&l.unshift([uo,s]),a&&l.push([uo,a]),l=SH(l),l}function l1n(t){let e=1;return typeof t<"u"&&(e=t<=0?Number.MAX_VALUE:t),Date.now()+e*1e3}function c1n(t){return a1n({checkLines:!0,deadline:l1n(t.timeout||1)},t)}function WP(t,e,n){return n===1?t+e:e+t}function qP(t,e){return e===1?[t.substring(0,t.length-1),t[t.length-1]]:[t.substring(1),t[0]]}function u1n(t,e,n,r){return r===1?t[e][1][t[e][1].length-1]===t[n][1][t[n][1].length-1]:t[e][1][0]===t[n][1][0]}function TSe(t,e,n){const r=n===1?-1:1;let i=null,o=null,s=e+n;for(;s>=0&&s=s&&o++):t[i][1]=WP(t[i][1],l,r),o===null?t.splice(s,0,[Oa,l]):t[o][1]=WP(t[o][1],l,r)}function d1n(t){for(let e=0;eXR(f)),n=!1;const r=[];let i=0,o=null,s=0,a=0,l=0,c=0,u=0;for(;s0?r[i-1]:-1,a=0,l=0,c=0,u=0,o=null,n=!0)),s++;for(n&&(e=SH(e)),e=$et(e),s=1;s=m?(p>=f.length/2||p>=h.length/2)&&(e.splice(s,0,[uo,h.substring(0,p)]),e[s-1][1]=f.substring(0,f.length-p),e[s+1][1]=h.substring(p),s++):(m>=f.length/2||m>=h.length/2)&&(e.splice(s,0,[uo,f.substring(0,m)]),e[s-1][0]=fl,e[s-1][1]=h.substring(0,h.length-m),e[s+1][0]=Oa,e[s+1][1]=f.substring(m),s++),s++}s++}return e}const ISe=/[^a-zA-Z0-9]/,jSe=/\s/,ASe=/[\r\n]/,f1n=/\n\r?\n$/,h1n=/^\r?\n\r?\n/;function $et(t){const e=t.map(i=>XR(i));function n(i,o){if(!i||!o)return 6;const s=i.charAt(i.length-1),a=o.charAt(0),l=s.match(ISe),c=a.match(ISe),u=l&&s.match(jSe),f=c&&a.match(jSe),h=u&&s.match(ASe),p=f&&a.match(ASe),m=h&&i.match(f1n),g=p&&o.match(h1n);return m||g?5:h||p?4:l&&!u&&f?3:u||f?2:l||c?1:0}let r=1;for(;r=f&&(f=h,l=i,c=o,u=s)}e[r-1][1]!==l&&(l?e[r-1][1]=l:(e.splice(r-1,1),r--),e[r][1]=c,u?e[r+1][1]=u:(e.splice(r+1,1),r--))}r++}return e}function SH(t){let e=t.map(c=>XR(c));e.push([uo,""]);let n=0,r=0,i=0,o="",s="",a;for(;n1?(r!==0&&i!==0&&(a=Jfe(s,o),a!==0&&(n-r-i>0&&e[n-r-i-1][0]===uo?e[n-r-i-1][1]+=s.substring(0,a):(e.splice(0,0,[uo,s.substring(0,a)]),n++),s=s.substring(a),o=o.substring(a)),a=_H(s,o),a!==0&&(e[n][1]=s.substring(s.length-a)+e[n][1],s=s.substring(0,s.length-a),o=o.substring(0,o.length-a))),n-=r+i,e.splice(n,r+i),o.length&&(e.splice(n,0,[Oa,o]),n++),s.length&&(e.splice(n,0,[fl,s]),n++),n++):n!==0&&e[n-1][0]===uo?(e[n-1][1]+=e[n][1],e.splice(n,1)):n++,i=0,r=0,o="",s="";break;default:throw new Error("Unknown diff operation")}e[e.length-1][1]===""&&e.pop();let l=!1;for(n=1;ne+(n?1:0),0)}function kH(t,e=4){let n=t.map(h=>XR(h)),r=!1;const i=[];let o=0,s=null,a=0,l=!1,c=!1,u=!1,f=!1;for(;a0?i[o-1]:-1,u=!1,f=!1),r=!0)),a++;return r&&(n=SH(n)),n}var m1n=Object.defineProperty,RSe=Object.getOwnPropertySymbols,g1n=Object.prototype.hasOwnProperty,y1n=Object.prototype.propertyIsEnumerable,DSe=(t,e,n)=>e in t?m1n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,OSe=(t,e)=>{for(var n in e||(e={}))g1n.call(e,n)&&DSe(t,n,e[n]);if(RSe)for(var n of RSe(e))y1n.call(e,n)&&DSe(t,n,e[n]);return t};const b1n={threshold:.5,distance:1e3};function v1n(t){return OSe(OSe({},b1n),t)}const x1n=32;function C1n(t,e,n,r={}){if(e.length>x1n)throw new Error("Pattern too long for this browser.");const i=v1n(r),o=w1n(e);function s(m,g){const y=m/e.length,b=Math.abs(n-g);return i.distance?y+b/i.distance:b?1:y}let a=i.threshold,l=t.indexOf(e,n);l!==-1&&(a=Math.min(s(0,l),a),l=t.lastIndexOf(e,n+e.length),l!==-1&&(a=Math.min(s(0,l),a)));const c=1<=g;v--){const x=o[t.charAt(v-1)];if(m===0?b[v]=(b[v+1]<<1|1)&x:b[v]=(b[v+1]<<1|1)&x|((p[v+1]|p[v])<<1|1)|p[v+1],b[v]&c){const C=s(m,v-1);if(C<=a)if(a=C,l=v-1,l>n)g=Math.max(1,2*n-l);else break}}if(s(m+1,n)>a)break;p=b}return l}function w1n(t){const e={};for(let n=0;ne));s++)i=n,o=r;return t.length!==s&&t[s][0]===Oa?o:o+(e-i)}function Q4(t){let e=0;for(let n=0;n"u")throw new Error("Failed to get codepoint");e+=Let(r)}return e}function S1n(t,e,n={}){let r=0,i=0;function o(a){for(;r"u")return i;r+=Let(l),l>65535?i+=2:i+=1}if(!n.allowExceedingIndices&&r!==a)throw new Error("Failed to determine byte offset");return i}const s=[];for(const a of t)s.push({diffs:a.diffs.map(l=>XR(l)),start1:o(a.start1),start2:o(a.start2),utf8Start1:a.utf8Start1,utf8Start2:a.utf8Start2,length1:a.length1,length2:a.length2,utf8Length1:a.utf8Length1,utf8Length2:a.utf8Length2});return s}function Let(t){return t<=127?1:t<=2047?2:t<=65535?3:4}const P4=32,n2e=4;function k1n(t,e=n2e){const n=e;let r="";for(let s=1;s<=n;s++)r+=String.fromCharCode(s);for(const s of t)s.start1+=n,s.start2+=n,s.utf8Start1+=n,s.utf8Start2+=n;let i=t[0],o=i.diffs;if(o.length===0||o[0][0]!==uo)o.unshift([uo,r]),i.start1-=n,i.start2-=n,i.utf8Start1-=n,i.utf8Start2-=n,i.length1+=n,i.length2+=n,i.utf8Length1+=n,i.utf8Length2+=n;else if(n>o[0][1].length){const s=o[0][1].length,a=n-s;o[0][1]=r.substring(s)+o[0][1],i.start1-=a,i.start2-=a,i.utf8Start1-=a,i.utf8Start2-=a,i.length1+=a,i.length2+=a,i.utf8Length1+=a,i.utf8Length2+=a}if(i=t[t.length-1],o=i.diffs,o.length===0||o[o.length-1][0]!==uo)o.push([uo,r]),i.length1+=n,i.length2+=n,i.utf8Length1+=n,i.utf8Length2+=n;else if(n>o[o.length-1][1].length){const s=n-o[o.length-1][1].length;o[o.length-1][1]+=r.substring(0,s),i.length1+=s,i.length2+=s,i.utf8Length1+=s,i.utf8Length2+=s}return r}function IN(t,e){return{diffs:[],start1:t,start2:e,utf8Start1:t,utf8Start2:e,length1:0,length2:0,utf8Length1:0,utf8Length2:0}}function E1n(t,e=n2e){const n=P4;for(let r=0;r2*n?(l.length1+=p.length,l.utf8Length1+=m,o+=p.length,c=!1,l.diffs.push([h,p]),i.diffs.shift()):(p=p.substring(0,n-l.length1-e),m=Q4(p),l.length1+=p.length,l.utf8Length1+=m,o+=p.length,h===uo?(l.length2+=p.length,l.utf8Length2+=m,s+=p.length):c=!1,l.diffs.push([h,p]),p===i.diffs[0][1]?i.diffs.shift():i.diffs[0][1]=i.diffs[0][1].substring(p.length))}a=Met(l.diffs),a=a.substring(a.length-e);const u=t2e(i.diffs).substring(0,e),f=Q4(u);u!==""&&(l.length1+=u.length,l.length2+=u.length,l.utf8Length1+=f,l.utf8Length2+=f,l.diffs.length!==0&&l.diffs[l.diffs.length-1][0]===uo?l.diffs[l.diffs.length-1][1]+=u:l.diffs.push([uo,u])),c||t.splice(++r,0,l)}}}function _v(t,e,n={}){if(typeof t=="string")throw new Error("Patches must be an array - pass the patch to `parsePatch()` first");let r=e;if(t.length===0)return[r,[]];const i=S1n(t,r,{allowExceedingIndices:n.allowExceedingIndices}),o=n.margin||n2e,s=n.deleteThreshold||.4,a=k1n(i,o);r=a+r+a,E1n(i,o);let l=0;const c=[];for(let u=0;uP4?(p=UJ(r,h.substring(0,P4),f),p!==-1&&(m=UJ(r,h.substring(h.length-P4),f+h.length-P4),(m===-1||p>=m)&&(p=-1))):p=UJ(r,h,f),p===-1)c[u]=!1,l-=i[u].length2-i[u].length1;else{c[u]=!0,l=p-f;let g;if(m===-1?g=r.substring(p,p+h.length):g=r.substring(p,m+P4),h===g)r=r.substring(0,p)+Met(i[u].diffs)+r.substring(p+h.length);else{let y=NS(h,g,{checkLines:!1});if(h.length>P4&&_1n(y)/h.length>s)c[u]=!1;else{y=$et(y);let b=0,v=0;for(let x=0;xe in t?T1n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,LSe=(t,e)=>{for(var n in e||(e={}))I1n.call(e,n)&&MSe(t,n,e[n]);if($Se)for(var n of $Se(e))j1n.call(e,n)&&MSe(t,n,e[n]);return t};const A1n={margin:4};function WJ(t={}){return LSe(LSe({},A1n),t)}function EH(t,e,n){if(typeof t=="string"&&typeof e=="string"){let r=NS(t,e,{checkLines:!0});return r.length>2&&(r=e2e(r),r=kH(r)),qJ(t,r,WJ(n))}if(t&&Array.isArray(t)&&typeof e>"u")return qJ(t2e(t),t,WJ(n));if(typeof t=="string"&&e&&Array.isArray(e))return qJ(t,e,WJ(n));throw new Error("Unknown call format to make()")}function qJ(t,e,n){if(e.length===0)return[];const r=[];let i=IN(0,0),o=0,s=0,a=0,l=0,c=0,u=t,f=t;for(let h=0;h=2*n.margin&&o&&(FSe(i,u,n),r.push(i),i=IN(-1,-1),o=0,u=f,s=a,l=c);break;default:throw new Error("Unknown diff type")}m!==fl&&(s+=y,l+=b),m!==Oa&&(a+=y,c+=b)}return o&&(FSe(i,u,n),r.push(i)),r}function FSe(t,e,n){if(e.length===0)return;let r=e.substring(t.start2,t.start2+t.length1),i=0;for(;e.indexOf(r)!==e.lastIndexOf(r)&&r.length=1&&qoe(e[o])&&o--;const s=e.substring(o,t.start2);s&&t.diffs.unshift([uo,s]);const a=s.length,l=Q4(s);let c=t.start2+t.length1+i;ce.concat(n),[])}function P1n(t){return typeof t=="object"&&t!==null&&"_key"in t}function $1n(t,e){if(typeof e=="number")return e;if(P1n(e)){const n=t.findIndex(r=>r._key===e._key);return n===-1?!1:n}return!1}function M1n(t,e){const n=t.slice();if(e.path.length===0){if(e.type==="setIfMissing"){if(!Array.isArray(e.value))throw new Error("Cannot set value of an array to a non-array");return t===void 0?e.value:t}if(e.type==="set"){if(!Array.isArray(e.value))throw new Error("Cannot set value of an array to a non-array");return e.value}if(e.type==="unset")return;throw new Error(`Invalid array operation: ${e.type}`)}const[r,...i]=e.path,o=$1n(t,r);if(o===!1)return n;if(i.length===0){if(e.type==="insert"){const{position:s,items:a}=e;return O1n(t,s,o,a)}else if(e.type==="unset"){if(typeof o!="number")throw new Error(`Expected array index to be a number, instead got "${o}"`);return n.splice(o,1),n}}return n[o]=i2e(n[o],{...e,path:i}),n}function L1n(t,e){if(e.path.length>0)throw new Error(`Cannot apply deep operations on primitive values. Received patch with type "${e.type}" and path "${e.path.map(n=>JSON.stringify(n)).join(".")} that targeted the value "${JSON.stringify(t)}"`);if(e.type==="set")return e.value;if(e.type==="setIfMissing")return t===void 0?e.value:t;if(e.type!=="unset"){if(e.type==="inc"){if(typeof e.value!="number")throw new Error("Cannot increment with a non-number");return t+e.value}if(e.type==="dec"){if(typeof e.value!="number")throw new Error("Cannot decrement with a non-number");return t-e.value}throw new Error(`Received patch of unsupported type: "${JSON.stringify(e.type)}" for number. This is most likely a bug.`)}}function F1n(t,e){const n={...t};if(e.path.length===0){if(e.type==="set"){if(typeof e.value=="object"&&e.value!==null&&!Array.isArray(e.value))return e.value;throw new Error("Cannot set value of an object to a non-object")}if(e.type==="setIfMissing"){if(typeof e.value=="object"&&e.value!==null&&!Array.isArray(e.value))return t;throw new Error("Cannot setIfMissing value of an object to a non-object")}if(e.type==="unset")return;throw new Error(`Invalid object operation: ${e.type}`)}const[r,...i]=e.path;if(typeof r!="string")throw new Error(`Expected field name to be a string, instead got: ${r}`);if(i.length===0&&e.type==="unset"){const{[r]:o,...s}=n;return s}return!(r in n)&&i.length>0||(n[r]=i2e(n[r],{...e,path:i})),n}function N1n(t,e){if(e.path.length>0)throw new Error(`Cannot apply deep operations on primitive values. Received patch with type "${e.type}" and path "${e.path.map(n=>JSON.stringify(n)).join(".")} that targeted the value "${JSON.stringify(t)}"`);if(e.type==="set")return e.value;if(e.type==="setIfMissing")return t===void 0?e.value:t;if(e.type!=="unset")throw new Error(`Received patch of unsupported type: "${JSON.stringify(e.type)}" for primitives. This is most likely a bug.`)}function B1n(t,e){if(e.path.length>0)throw new Error(`Cannot apply deep operations on string values. Received patch with type "${e.type}" and path "${e.path.join(".")} that targeted the value "${JSON.stringify(t)}"`);if(e.type==="diffMatchPatch"){const[n]=_v(BS(e.value),t,{allowExceedingIndices:!0});return n}if(e.type==="setIfMissing")return t===void 0?e.value:t;if(e.type==="set")return e.value;if(e.type!=="unset")throw new Error(`Received patch of unsupported type: "${JSON.stringify(e.type)}" for string. This is most likely a bug.`)}function Qm(t,e){return e.reduce(i2e,t)}function i2e(t,e){return Array.isArray(t)?M1n(t,e):typeof t=="string"?B1n(t,e):V1n(t)?F1n(t,e):typeof t=="number"?L1n(t,e):N1n(t,e)}function V1n(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function x_(t,e=[]){return{type:"setIfMissing",path:e,value:t}}function Fet(t,e,n=[]){const r=EH(t,e),i=r2e(r);return{type:"diffMatchPatch",path:n,value:i}}function Z5(t,e,n=[]){return{type:"insert",path:n,position:e,items:t}}function eu(t,e=[]){return{type:"set",path:e,value:t}}function Mu(t=[]){return{type:"unset",path:t}}const z1n=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.userAgent);function zSe(t,e){return H1n(t,e)?t.code!==void 0&&t.code.toLowerCase()===e.code.toLowerCase()?!0:t.key!==void 0&&t.key.toLowerCase()===e.key.toLowerCase():!1}function H1n(t,e){return(t.ctrl===e.ctrlKey||t.ctrl===void 0)&&(t.meta===e.metaKey||t.meta===void 0)&&(t.shift===e.shiftKey||t.shift===void 0)&&(t.alt===e.altKey||t.alt===void 0)}function sl(t){if(z1n){const n=t.apple??t.default,r=n.at(0);return{guard:i=>n.some(o=>zSe(o,i)),keys:[...r?.meta?["⌘"]:[],...r?.ctrl?["Ctrl"]:[],...r?.alt?["Option"]:[],...r?.shift?["Shift"]:[],...r?.key!==void 0?[r.key]:r?.code!==void 0?[r.code]:[]]}}const e=t.default.at(0);return{guard:n=>t.default.some(r=>zSe(r,n)),keys:[...e?.meta?["Meta"]:[],...e?.ctrl?["Ctrl"]:[],...e?.alt?["Alt"]:[],...e?.shift?["Shift"]:[],...e?.key!==void 0?[e.key]:e?.code!==void 0?[e.code]:[]]}}const U1n=sl({default:[{key:"B",alt:!1,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"B",alt:!1,ctrl:!1,meta:!0,shift:!1}]}),W1n=sl({default:[{key:"I",alt:!1,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"I",alt:!1,ctrl:!1,meta:!0,shift:!1}]}),q1n=sl({default:[{key:"'",alt:!1,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"'",alt:!1,ctrl:!1,meta:!0,shift:!1}]}),G1n=sl({default:[{key:"U",alt:!1,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"U",alt:!1,ctrl:!1,meta:!0,shift:!1}]});sl({default:[{key:"X",alt:!1,ctrl:!0,meta:!1,shift:!0}],apple:[{key:"X",alt:!1,ctrl:!1,meta:!0,shift:!0}]});sl({default:[{key:"K",alt:!1,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"K",alt:!1,ctrl:!1,meta:!0,shift:!1}]});sl({default:[{key:"0",code:"Digit0",alt:!0,ctrl:!0,meta:!1,shift:!1},{key:"0",code:"Numpad0",alt:!0,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"0",code:"Digit0",alt:!0,ctrl:!1,meta:!0,shift:!1},{key:"0",code:"Numpad0",alt:!0,ctrl:!1,meta:!0,shift:!1}]});sl({default:[{key:"1",code:"Digit1",alt:!0,ctrl:!0,meta:!1,shift:!1},{key:"1",code:"Numpad1",alt:!0,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"1",code:"Digit1",alt:!0,ctrl:!1,meta:!0,shift:!1},{key:"1",code:"Numpad1",alt:!0,ctrl:!1,meta:!0,shift:!1}]});sl({default:[{key:"2",code:"Digit2",alt:!0,ctrl:!0,meta:!1,shift:!1},{key:"2",code:"Numpad2",alt:!0,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"2",code:"Digit2",alt:!0,ctrl:!1,meta:!0,shift:!1},{key:"2",code:"Numpad2",alt:!0,ctrl:!1,meta:!0,shift:!1}]});sl({default:[{key:"3",code:"Digit3",alt:!0,ctrl:!0,meta:!1,shift:!1},{key:"3",code:"Numpad3",alt:!0,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"3",code:"Digit3",alt:!0,ctrl:!1,meta:!0,shift:!1},{key:"3",code:"Numpad3",alt:!0,ctrl:!1,meta:!0,shift:!1}]});sl({default:[{key:"4",code:"Digit4",alt:!0,ctrl:!0,meta:!1,shift:!1},{key:"4",code:"Numpad4",alt:!0,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"4",code:"Digit4",alt:!0,ctrl:!1,meta:!0,shift:!1},{key:"4",code:"Numpad4",alt:!0,ctrl:!1,meta:!0,shift:!1}]});sl({default:[{key:"5",code:"Digit5",alt:!0,ctrl:!0,meta:!1,shift:!1},{key:"5",code:"Numpad5",alt:!0,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"5",code:"Digit5",alt:!0,ctrl:!1,meta:!0,shift:!1},{key:"5",code:"Numpad5",alt:!0,ctrl:!1,meta:!0,shift:!1}]});sl({default:[{key:"6",code:"Digit6",alt:!0,ctrl:!0,meta:!1,shift:!1},{key:"6",code:"Numpad6",alt:!0,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"6",code:"Digit6",alt:!0,ctrl:!1,meta:!0,shift:!1},{key:"6",code:"Numpad6",alt:!0,ctrl:!1,meta:!0,shift:!1}]});sl({default:[{key:"Q",alt:!1,ctrl:!0,meta:!1,shift:!0}]});const Y1n=sl({default:[{key:"Z",alt:!1,ctrl:!0,meta:!1,shift:!1}],apple:[{key:"Z",alt:!1,ctrl:!1,meta:!0,shift:!1}]}),K1n=sl({default:[{key:"Y",alt:!1,ctrl:!0,meta:!1,shift:!1},{key:"Z",alt:!1,ctrl:!0,meta:!1,shift:!0}],apple:[{key:"Z",alt:!1,ctrl:!1,meta:!0,shift:!0}]});function X1n(){if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global;throw new Error("@portabletext/editor: could not locate global scope")}const GJ=X1n();function Z1n(t,e){const n=Symbol.for(t);return typeof document>"u"?E.createContext(e):(GJ[n]=GJ[n]??E.createContext(e),GJ[n])}const Net=Z1n("@portabletext/editor/context/editor",null);function H2(){const t=vt.useContext(Net);if(!t)throw new Error("No Editor set. Use EditorProvider to set one.");return t}const HSe="pte:";function w5(t){const e=`${HSe}${t}`;return dl&&dl.enabled(e)?dl(e):dl(HSe)}const Yn={behaviors:w5("behaviors"),history:w5("history"),mutation:w5("mutation"),normalization:w5("normalization"),operation:w5("operation"),selection:w5("selection"),setup:w5("setup"),state:w5("state"),syncValue:w5("sync:value"),syncPatch:w5("sync:patch")},USe=(t,{deep:e=!1}={})=>!F1(t)||typeof t.apply=="function"?!1:e?hn.isNodeList(t.children):Array.isArray(t.children),On={isAncestor(t,{deep:e=!1}={}){return F1(t)&&hn.isNodeList(t.children,{deep:e})},isElement:USe,isElementList(t,{deep:e=!1}={}){return Array.isArray(t)&&t.every(n=>On.isElement(n,{deep:e}))},isElementProps(t){return t.children!==void 0},isElementType:(t,e,n="type")=>USe(t)&&t[n]===e,matches(t,e){for(const n in e)if(n!=="children"&&t[n]!==e[n])return!1;return!0}},Q1n={isSpan(t){return Array.isArray(t)&&t.length===2&&t.every(ut.isPath)}},WC={isNodeOperation(t){return WC.isOperation(t)&&t.type.endsWith("_node")},isOperation(t){if(!F1(t))return!1;switch(t.type){case"insert_node":return ut.isPath(t.path)&&hn.isNode(t.node);case"insert_text":return typeof t.offset=="number"&&typeof t.text=="string"&&ut.isPath(t.path);case"merge_node":return typeof t.position=="number"&&ut.isPath(t.path)&&F1(t.properties);case"move_node":return ut.isPath(t.path)&&ut.isPath(t.newPath);case"remove_node":return ut.isPath(t.path)&&hn.isNode(t.node);case"remove_text":return typeof t.offset=="number"&&typeof t.text=="string"&&ut.isPath(t.path);case"set_node":return ut.isPath(t.path)&&F1(t.properties)&&F1(t.newProperties);case"set_selection":return t.properties===null&&It.isRange(t.newProperties)||t.newProperties===null&&It.isRange(t.properties)||F1(t.properties)&&F1(t.newProperties);case"split_node":return ut.isPath(t.path)&&typeof t.position=="number"&&F1(t.properties);default:return!1}},isOperationList(t){return Array.isArray(t)&&t.every(e=>WC.isOperation(e))},isSelectionOperation(t){return WC.isOperation(t)&&t.type.endsWith("_selection")},isTextOperation(t){return WC.isOperation(t)&&t.type.endsWith("_text")},inverse(t){switch(t.type){case"insert_node":return{...t,type:"remove_node"};case"insert_text":return{...t,type:"remove_text"};case"merge_node":return{...t,type:"split_node",path:ut.previous(t.path)};case"move_node":{const{newPath:e,path:n}=t;if(ut.equals(e,n))return t;if(ut.isSibling(n,e))return{...t,path:e,newPath:n};const r=ut.transform(n,t),i=ut.transform(ut.next(n),t);return{...t,path:r,newPath:i}}case"remove_node":return{...t,type:"insert_node"};case"remove_text":return{...t,type:"insert_text"};case"set_node":{const{properties:e,newProperties:n}=t;return{...t,properties:n,newProperties:e}}case"set_selection":{const{properties:e,newProperties:n}=t;return e==null?{...t,properties:n,newProperties:null}:n==null?{...t,properties:null,newProperties:e}:{...t,properties:n,newProperties:e}}case"split_node":return{...t,type:"merge_node",path:ut.next(t.path)}}}},J1n={transform(t,e){const{current:n,affinity:r}=t;if(n==null)return;const i=ut.transform(n,e,{affinity:r});t.current=i,i==null&&t.unref()}},ut={ancestors(t,e={}){const{reverse:n=!1}=e;let r=ut.levels(t,e);return n?r=r.slice(1):r=r.slice(0,-1),r},common(t,e){const n=[];for(let r=0;re[r])return 1}return 0},endsAfter(t,e){const n=t.length-1,r=t.slice(0,n),i=e.slice(0,n),o=t[n],s=e[n];return ut.equals(r,i)&&o>s},endsAt(t,e){const n=t.length,r=t.slice(0,n),i=e.slice(0,n);return ut.equals(r,i)},endsBefore(t,e){const n=t.length-1,r=t.slice(0,n),i=e.slice(0,n),o=t[n],s=e[n];return ut.equals(r,i)&&on===e[r])},hasPrevious(t){return t[t.length-1]>0},isAfter(t,e){return ut.compare(t,e)===1},isAncestor(t,e){return t.lengthe.length&&ut.compare(t,e)===0},isParent(t,e){return t.length+1===e.length&&ut.compare(t,e)===0},isPath(t){return Array.isArray(t)&&(t.length===0||typeof t[0]=="number")},isSibling(t,e){if(t.length!==e.length)return!1;const n=t.slice(0,-1),r=e.slice(0,-1),i=t[t.length-1],o=e[e.length-1];return i!==o&&ut.equals(n,r)},levels(t,e={}){const{reverse:n=!1}=e,r=[];for(let i=0;i<=t.length;i++)r.push(t.slice(0,i));return n&&r.reverse(),r},next(t){if(t.length===0)throw new Error(`Cannot get the next path of a root path [${t}], because it has no next index.`);const e=t[t.length-1];return t.slice(0,-1).concat(e+1)},operationCanTransformPath(t){switch(t.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(t){if(t.length===0)throw new Error(`Cannot get the parent path of the root path [${t}].`);return t.slice(0,-1)},previous(t){if(t.length===0)throw new Error(`Cannot get the previous path of a root path [${t}], because it has no previous index.`);const e=t[t.length-1];if(e<=0)throw new Error(`Cannot get the previous path of a first child path [${t}] because it would result in a negative index.`);return t.slice(0,-1).concat(e-1)},relative(t,e){if(!ut.isAncestor(e,t)&&!ut.equals(t,e))throw new Error(`Cannot get the relative path of [${t}] inside ancestor [${e}], because it is not above or equal to the path.`);return t.slice(e.length)},transform(t,e,n={}){if(!t)return null;const r=[...t],{affinity:i="forward"}=n;if(t.length===0)return r;switch(e.type){case"insert_node":{const{path:o}=e;(ut.equals(o,r)||ut.endsBefore(o,r)||ut.isAncestor(o,r))&&(r[o.length-1]=r[o.length-1]+1);break}case"remove_node":{const{path:o}=e;if(ut.equals(o,r)||ut.isAncestor(o,r))return null;ut.endsBefore(o,r)&&(r[o.length-1]=r[o.length-1]-1);break}case"merge_node":{const{path:o,position:s}=e;ut.equals(o,r)||ut.endsBefore(o,r)?r[o.length-1]=r[o.length-1]-1:ut.isAncestor(o,r)&&(r[o.length-1]=r[o.length-1]-1,r[o.length]=r[o.length]+s);break}case"split_node":{const{path:o,position:s}=e;if(ut.equals(o,r)){if(i==="forward")r[r.length-1]=r[r.length-1]+1;else if(i!=="backward")return null}else ut.endsBefore(o,r)?r[o.length-1]=r[o.length-1]+1:ut.isAncestor(o,r)&&t[o.length]>=s&&(r[o.length-1]=r[o.length-1]+1,r[o.length]=r[o.length]-s);break}case"move_node":{const{path:o,newPath:s}=e;if(ut.equals(o,s))return r;if(ut.isAncestor(o,r)||ut.equals(o,r)){const a=s.slice();return ut.endsBefore(o,s)&&o.lengthe.offset?1:0:n},isAfter(t,e){return gi.compare(t,e)===1},isBefore(t,e){return gi.compare(t,e)===-1},equals(t,e){return t.offset===e.offset&&ut.equals(t.path,e.path)},isPoint(t){return F1(t)&&typeof t.offset=="number"&&ut.isPath(t.path)},transform(t,e,n={}){if(t===null)return null;const{affinity:r="forward"}=n;let{path:i,offset:o}=t;switch(e.type){case"insert_node":case"move_node":{i=ut.transform(i,e,n);break}case"insert_text":{ut.equals(e.path,i)&&(e.offset=0,o=gi.compare(e,r)<=0):(i=ut.compare(e,n.path)>=0,o=ut.compare(e,r.path)<=0),i&&o},intersection(t,e){const{anchor:n,focus:r,...i}=t,[o,s]=It.edges(t),[a,l]=It.edges(e),c=gi.isBefore(o,a)?a:o,u=gi.isBefore(s,l)?s:l;return gi.isBefore(u,c)?null:{anchor:c,focus:u,...i}},isBackward(t){const{anchor:e,focus:n}=t;return gi.isAfter(e,n)},isCollapsed(t){const{anchor:e,focus:n}=t;return gi.equals(e,n)},isExpanded(t){return!It.isCollapsed(t)},isForward(t){return!It.isBackward(t)},isRange(t){return F1(t)&&gi.isPoint(t.anchor)&&gi.isPoint(t.focus)},*points(t){yield[t.anchor,"anchor"],yield[t.focus,"focus"]},start(t){const[e]=It.edges(t);return e},transform(t,e,n={}){if(t===null)return null;const{affinity:r="inward"}=n;let i,o;if(r==="inward"){const l=It.isCollapsed(t);It.isForward(t)?(i="forward",o=l?i:"backward"):(i="backward",o=l?i:"forward")}else r==="outward"?It.isForward(t)?(i="backward",o="forward"):(i="forward",o="backward"):(i=r,o=r);const s=gi.transform(t.anchor,e,{affinity:i}),a=gi.transform(t.focus,e,{affinity:o});return!s||!a?null:{anchor:s,focus:a}}};let WSe;const fd={setScrubber(t){WSe=t},stringify(t){return JSON.stringify(t,WSe)}},F1=t=>typeof t=="object"&&t!==null,Bet=(t,e)=>{for(const n in t){const r=t[n],i=e[n];if(Array.isArray(r)&&Array.isArray(i)){if(r.length!==i.length)return!1;for(let o=0;oDn.isText(e))},isTextProps(t){return t.text!==void 0},matches(t,e){for(const n in e)if(n!=="text"&&(!t.hasOwnProperty(n)||t[n]!==e[n]))return!1;return!0},decorations(t,e){let n=[{leaf:{...t}}];for(const r of e){const{anchor:i,focus:o,merge:s,...a}=r,[l,c]=It.edges(r),u=[];let f=0;const h=l.offset,p=c.offset,m=s??Object.assign;for(const{leaf:g}of n){const{length:y}=g.text,b=f;if(f+=y,h<=b&&f<=p){m(g,a),u.push({leaf:g});continue}if(h!==p&&(h===f||p===b)||h>f||pb){const w=h-b;x={leaf:{...v,text:v.text.slice(0,w)}},v={...v,text:v.text.slice(w)}}m(v,a),x&&u.push(x),u.push({leaf:v}),C&&u.push(C)}n=u}if(n.length>1){let r=0;for(const[i,o]of n.entries()){const s=r,a=s+o.leaf.text.length,l={start:s,end:a};i===0&&(l.isFirst=!0),i===n.length-1&&(l.isLast=!0),o.position=l,r=a}}return n}},nfn={transform(t,e){let n=!1;switch(e.type){case"insert_node":{const{path:r,node:i}=e;wb(t,ut.parent(r),o=>{const s=r[r.length-1];if(s>o.length)throw new Error(`Cannot apply an "insert_node" operation at path [${r}] because the destination is past the end of the node.`);return XSe(o,s,i)}),n=!0;break}case"insert_text":{const{path:r,offset:i,text:o}=e;if(o.length===0)break;RN(t,r,s=>{const a=s.text.slice(0,i),l=s.text.slice(i);return{...s,text:a+o+l}}),n=!0;break}case"merge_node":{const{path:r}=e,i=r[r.length-1],o=ut.previous(r),s=o[o.length-1];wb(t,ut.parent(r),a=>{const l=a[i],c=a[s];let u;if(Dn.isText(l)&&Dn.isText(c))u={...c,text:c.text+l.text};else if(!Dn.isText(l)&&!Dn.isText(c))u={...c,children:c.children.concat(l.children)};else throw new Error(`Cannot apply a "merge_node" operation at path [${r}] to nodes of different interfaces: ${fd.stringify(l)} ${fd.stringify(c)}`);return Wj(a,s,2,u)}),n=!0;break}case"move_node":{const{path:r,newPath:i}=e,o=r[r.length-1];if(ut.isAncestor(r,i))throw new Error(`Cannot move a path [${r}] to new path [${i}] because the destination is inside itself.`);const s=hn.get(t,r);wb(t,ut.parent(r),c=>Goe(c,o,1));const a=ut.transform(r,e),l=a[a.length-1];wb(t,ut.parent(a),c=>XSe(c,l,s)),n=!0;break}case"remove_node":{const{path:r}=e,i=r[r.length-1];if(wb(t,ut.parent(r),o=>Goe(o,i,1)),t.selection){let o={...t.selection};for(const[s,a]of It.points(o)){const l=gi.transform(s,e);if(o!=null&&l!=null)o[a]=l;else{let c,u;for(const[h,p]of hn.texts(t))if(ut.compare(p,r)===-1)c=[h,p];else{u=[h,p];break}let f=!1;c&&u&&(ut.isSibling(c[1],r)?f=!1:ut.equals(u[1],r)?f=!0:f=ut.common(c[1],r).length{const a=s.text.slice(0,i),l=s.text.slice(i+o.length);return{...s,text:a+l}}),n=!0;break}case"set_node":{const{path:r,properties:i,newProperties:o}=e;if(r.length===0)throw new Error("Cannot set properties on the root node!");l2e(t,r,s=>{const a={...s};for(const l in o){if(l==="children"||l==="text")throw new Error(`Cannot set the "${l}" property of nodes!`);const c=o[l];c==null?delete a[l]:a[l]=c}for(const l in i)o.hasOwnProperty(l)||delete a[l];return a});break}case"set_selection":{const{newProperties:r}=e;if(r==null){t.selection=null;break}if(t.selection==null){if(!It.isRange(r))throw new Error(`Cannot apply an incomplete "set_selection" operation properties ${fd.stringify(r)} when there is no current selection.`);t.selection={...r};break}const i={...t.selection};for(const o in r){const s=r[o];if(s==null){if(o==="anchor"||o==="focus")throw new Error(`Cannot remove the "${o}" selection property`);delete i[o]}else i[o]=s}t.selection=i;break}case"split_node":{const{path:r,position:i,properties:o}=e,s=r[r.length-1];if(r.length===0)throw new Error(`Cannot apply a "split_node" operation at path [${r}] because the root node cannot be split.`);wb(t,ut.parent(r),a=>{const l=a[s];let c,u;if(Dn.isText(l)){const f=l.text.slice(0,i),h=l.text.slice(i);c={...l,text:f},u={...o,text:h}}else{const f=l.children.slice(0,i),h=l.children.slice(i);c={...l,children:f},u={...o,children:h}}return Wj(a,s,1,c,u)}),n=!0;break}}if(n&&t.selection){const r={...t.selection};for(const[i,o]of It.points(r))r[o]=gi.transform(i,e);It.equals(r,t.selection)||(t.selection=r)}}},rfn={insertNodes(t,e,n){t.insertNodes(e,n)},liftNodes(t,e){t.liftNodes(e)},mergeNodes(t,e){t.mergeNodes(e)},moveNodes(t,e){t.moveNodes(e)},removeNodes(t,e){t.removeNodes(e)},setNodes(t,e,n){t.setNodes(e,n)},splitNodes(t,e){t.splitNodes(e)},unsetNodes(t,e,n){t.unsetNodes(e,n)},unwrapNodes(t,e){t.unwrapNodes(e)},wrapNodes(t,e,n){t.wrapNodes(e,n)}},ifn={collapse(t,e){t.collapse(e)},deselect(t){t.deselect()},move(t,e){t.move(e)},select(t,e){t.select(e)},setPoint(t,e,n){t.setPoint(e,n)},setSelection(t,e){t.setSelection(e)}},o2e=t=>t.selection?t.selection:t.children.length>0?De.end(t,[]):[0],VS=(t,e)=>{const[n]=De.node(t,e);return r=>r===n},s2e=(t,e=!1)=>{const n=!e,r=e?cfn(t):t;let i=lo.None,o=lo.None,s=0,a=null,l=null;for(const c of r){const u=c.codePointAt(0);if(!u)break;const f=Cfn(c,u);if([i,o]=n?[o,f]:[f,i],qC(i,lo.ZWJ)&&qC(o,lo.ExtPict)&&(n?a=qSe(t.substring(0,s)):a=qSe(t.substring(0,t.length-s)),!a)||qC(i,lo.RI)&&qC(o,lo.RI)&&(l!==null?l=!l:n?l=!0:l=Efn(t.substring(0,t.length-s)),!l)||i!==lo.None&&o!==lo.None&&_fn(i,o))break;s+=c.length}return s||1},ofn=/\s/,sfn=/[\u002B\u0021-\u0023\u0025-\u002A\u002C-\u002F\u003A\u003B\u003F\u0040\u005B-\u005D\u005F\u007B\u007D\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E3B\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/,afn=/['\u2018\u2019]/,lfn=(t,e=!1)=>{let n=0,r=!1;for(;t.length>0;){const i=s2e(t,e),[o,s]=a2e(t,i,e);if(Vet(o,s,e))r=!0,n+=i;else if(!r)n+=i;else break;t=s}return n},a2e=(t,e,n)=>{if(n){const r=t.length-e;return[t.slice(r,t.length),t.slice(0,r)]}return[t.slice(0,e),t.slice(e)]},Vet=(t,e,n=!1)=>{if(ofn.test(t))return!1;if(afn.test(t)){const r=s2e(e,n),[i,o]=a2e(e,r,n);if(Vet(i,o,n))return!0}return!sfn.test(t)},cfn=function*(t){const e=t.length-1;for(let n=0;nt>=55296&&t<=56319,dfn=t=>t>=56320&&t<=57343,lo={None:0,Extend:1,ZWJ:2,RI:4,Prepend:8,SpacingMark:16,L:32,V:64,T:128,LV:256,LVT:512,ExtPict:1024,Any:2048},ffn=/^[\p{Gr_Ext}\p{EMod}]$/u,hfn=/^[\u0600-\u0605\u06DD\u070F\u0890-\u0891\u08E2\u0D4E\u{110BD}\u{110CD}\u{111C2}-\u{111C3}\u{1193F}\u{11941}\u{11A3A}\u{11A84}-\u{11A89}\u{11D46}]$/u,pfn=/^[\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E-\u094F\u0982-\u0983\u09BF-\u09C0\u09C7-\u09C8\u09CB-\u09CC\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB-\u0ACC\u0B02-\u0B03\u0B40\u0B47-\u0B48\u0B4B-\u0B4C\u0BBF\u0BC1-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0C01-\u0C03\u0C41-\u0C44\u0C82-\u0C83\u0CBE\u0CC0-\u0CC1\u0CC3-\u0CC4\u0CC7-\u0CC8\u0CCA-\u0CCB\u0D02-\u0D03\u0D3F-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D82-\u0D83\u0DD0-\u0DD1\u0DD8-\u0DDE\u0DF2-\u0DF3\u0E33\u0EB3\u0F3E-\u0F3F\u0F7F\u1031\u103B-\u103C\u1056-\u1057\u1084\u1715\u1734\u17B6\u17BE-\u17C5\u17C7-\u17C8\u1923-\u1926\u1929-\u192B\u1930-\u1931\u1933-\u1938\u1A19-\u1A1A\u1A55\u1A57\u1A6D-\u1A72\u1B04\u1B3B\u1B3D-\u1B41\u1B43-\u1B44\u1B82\u1BA1\u1BA6-\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2-\u1BF3\u1C24-\u1C2B\u1C34-\u1C35\u1CE1\u1CF7\uA823-\uA824\uA827\uA880-\uA881\uA8B4-\uA8C3\uA952-\uA953\uA983\uA9B4-\uA9B5\uA9BA-\uA9BB\uA9BE-\uA9C0\uAA2F-\uAA30\uAA33-\uAA34\uAA4D\uAAEB\uAAEE-\uAAEF\uAAF5\uABE3-\uABE4\uABE6-\uABE7\uABE9-\uABEA\uABEC\u{11000}\u{11002}\u{11082}\u{110B0}-\u{110B2}\u{110B7}-\u{110B8}\u{1112C}\u{11145}-\u{11146}\u{11182}\u{111B3}-\u{111B5}\u{111BF}-\u{111C0}\u{111CE}\u{1122C}-\u{1122E}\u{11232}-\u{11233}\u{11235}\u{112E0}-\u{112E2}\u{11302}-\u{11303}\u{1133F}\u{11341}-\u{11344}\u{11347}-\u{11348}\u{1134B}-\u{1134D}\u{11362}-\u{11363}\u{11435}-\u{11437}\u{11440}-\u{11441}\u{11445}\u{114B1}-\u{114B2}\u{114B9}\u{114BB}-\u{114BC}\u{114BE}\u{114C1}\u{115B0}-\u{115B1}\u{115B8}-\u{115BB}\u{115BE}\u{11630}-\u{11632}\u{1163B}-\u{1163C}\u{1163E}\u{116AC}\u{116AE}-\u{116AF}\u{116B6}\u{11726}\u{1182C}-\u{1182E}\u{11838}\u{11931}-\u{11935}\u{11937}-\u{11938}\u{1193D}\u{11940}\u{11942}\u{119D1}-\u{119D3}\u{119DC}-\u{119DF}\u{119E4}\u{11A39}\u{11A57}-\u{11A58}\u{11A97}\u{11C2F}\u{11C3E}\u{11CA9}\u{11CB1}\u{11CB4}\u{11D8A}-\u{11D8E}\u{11D93}-\u{11D94}\u{11D96}\u{11EF5}-\u{11EF6}\u{16F51}-\u{16F87}\u{16FF0}-\u{16FF1}\u{1D166}\u{1D16D}]$/u,mfn=/^[\u1100-\u115F\uA960-\uA97C]$/u,gfn=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/u,yfn=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/u,bfn=/^[\uAC00\uAC1C\uAC38\uAC54\uAC70\uAC8C\uACA8\uACC4\uACE0\uACFC\uAD18\uAD34\uAD50\uAD6C\uAD88\uADA4\uADC0\uADDC\uADF8\uAE14\uAE30\uAE4C\uAE68\uAE84\uAEA0\uAEBC\uAED8\uAEF4\uAF10\uAF2C\uAF48\uAF64\uAF80\uAF9C\uAFB8\uAFD4\uAFF0\uB00C\uB028\uB044\uB060\uB07C\uB098\uB0B4\uB0D0\uB0EC\uB108\uB124\uB140\uB15C\uB178\uB194\uB1B0\uB1CC\uB1E8\uB204\uB220\uB23C\uB258\uB274\uB290\uB2AC\uB2C8\uB2E4\uB300\uB31C\uB338\uB354\uB370\uB38C\uB3A8\uB3C4\uB3E0\uB3FC\uB418\uB434\uB450\uB46C\uB488\uB4A4\uB4C0\uB4DC\uB4F8\uB514\uB530\uB54C\uB568\uB584\uB5A0\uB5BC\uB5D8\uB5F4\uB610\uB62C\uB648\uB664\uB680\uB69C\uB6B8\uB6D4\uB6F0\uB70C\uB728\uB744\uB760\uB77C\uB798\uB7B4\uB7D0\uB7EC\uB808\uB824\uB840\uB85C\uB878\uB894\uB8B0\uB8CC\uB8E8\uB904\uB920\uB93C\uB958\uB974\uB990\uB9AC\uB9C8\uB9E4\uBA00\uBA1C\uBA38\uBA54\uBA70\uBA8C\uBAA8\uBAC4\uBAE0\uBAFC\uBB18\uBB34\uBB50\uBB6C\uBB88\uBBA4\uBBC0\uBBDC\uBBF8\uBC14\uBC30\uBC4C\uBC68\uBC84\uBCA0\uBCBC\uBCD8\uBCF4\uBD10\uBD2C\uBD48\uBD64\uBD80\uBD9C\uBDB8\uBDD4\uBDF0\uBE0C\uBE28\uBE44\uBE60\uBE7C\uBE98\uBEB4\uBED0\uBEEC\uBF08\uBF24\uBF40\uBF5C\uBF78\uBF94\uBFB0\uBFCC\uBFE8\uC004\uC020\uC03C\uC058\uC074\uC090\uC0AC\uC0C8\uC0E4\uC100\uC11C\uC138\uC154\uC170\uC18C\uC1A8\uC1C4\uC1E0\uC1FC\uC218\uC234\uC250\uC26C\uC288\uC2A4\uC2C0\uC2DC\uC2F8\uC314\uC330\uC34C\uC368\uC384\uC3A0\uC3BC\uC3D8\uC3F4\uC410\uC42C\uC448\uC464\uC480\uC49C\uC4B8\uC4D4\uC4F0\uC50C\uC528\uC544\uC560\uC57C\uC598\uC5B4\uC5D0\uC5EC\uC608\uC624\uC640\uC65C\uC678\uC694\uC6B0\uC6CC\uC6E8\uC704\uC720\uC73C\uC758\uC774\uC790\uC7AC\uC7C8\uC7E4\uC800\uC81C\uC838\uC854\uC870\uC88C\uC8A8\uC8C4\uC8E0\uC8FC\uC918\uC934\uC950\uC96C\uC988\uC9A4\uC9C0\uC9DC\uC9F8\uCA14\uCA30\uCA4C\uCA68\uCA84\uCAA0\uCABC\uCAD8\uCAF4\uCB10\uCB2C\uCB48\uCB64\uCB80\uCB9C\uCBB8\uCBD4\uCBF0\uCC0C\uCC28\uCC44\uCC60\uCC7C\uCC98\uCCB4\uCCD0\uCCEC\uCD08\uCD24\uCD40\uCD5C\uCD78\uCD94\uCDB0\uCDCC\uCDE8\uCE04\uCE20\uCE3C\uCE58\uCE74\uCE90\uCEAC\uCEC8\uCEE4\uCF00\uCF1C\uCF38\uCF54\uCF70\uCF8C\uCFA8\uCFC4\uCFE0\uCFFC\uD018\uD034\uD050\uD06C\uD088\uD0A4\uD0C0\uD0DC\uD0F8\uD114\uD130\uD14C\uD168\uD184\uD1A0\uD1BC\uD1D8\uD1F4\uD210\uD22C\uD248\uD264\uD280\uD29C\uD2B8\uD2D4\uD2F0\uD30C\uD328\uD344\uD360\uD37C\uD398\uD3B4\uD3D0\uD3EC\uD408\uD424\uD440\uD45C\uD478\uD494\uD4B0\uD4CC\uD4E8\uD504\uD520\uD53C\uD558\uD574\uD590\uD5AC\uD5C8\uD5E4\uD600\uD61C\uD638\uD654\uD670\uD68C\uD6A8\uD6C4\uD6E0\uD6FC\uD718\uD734\uD750\uD76C\uD788]$/u,vfn=/^[\uAC01-\uAC1B\uAC1D-\uAC37\uAC39-\uAC53\uAC55-\uAC6F\uAC71-\uAC8B\uAC8D-\uACA7\uACA9-\uACC3\uACC5-\uACDF\uACE1-\uACFB\uACFD-\uAD17\uAD19-\uAD33\uAD35-\uAD4F\uAD51-\uAD6B\uAD6D-\uAD87\uAD89-\uADA3\uADA5-\uADBF\uADC1-\uADDB\uADDD-\uADF7\uADF9-\uAE13\uAE15-\uAE2F\uAE31-\uAE4B\uAE4D-\uAE67\uAE69-\uAE83\uAE85-\uAE9F\uAEA1-\uAEBB\uAEBD-\uAED7\uAED9-\uAEF3\uAEF5-\uAF0F\uAF11-\uAF2B\uAF2D-\uAF47\uAF49-\uAF63\uAF65-\uAF7F\uAF81-\uAF9B\uAF9D-\uAFB7\uAFB9-\uAFD3\uAFD5-\uAFEF\uAFF1-\uB00B\uB00D-\uB027\uB029-\uB043\uB045-\uB05F\uB061-\uB07B\uB07D-\uB097\uB099-\uB0B3\uB0B5-\uB0CF\uB0D1-\uB0EB\uB0ED-\uB107\uB109-\uB123\uB125-\uB13F\uB141-\uB15B\uB15D-\uB177\uB179-\uB193\uB195-\uB1AF\uB1B1-\uB1CB\uB1CD-\uB1E7\uB1E9-\uB203\uB205-\uB21F\uB221-\uB23B\uB23D-\uB257\uB259-\uB273\uB275-\uB28F\uB291-\uB2AB\uB2AD-\uB2C7\uB2C9-\uB2E3\uB2E5-\uB2FF\uB301-\uB31B\uB31D-\uB337\uB339-\uB353\uB355-\uB36F\uB371-\uB38B\uB38D-\uB3A7\uB3A9-\uB3C3\uB3C5-\uB3DF\uB3E1-\uB3FB\uB3FD-\uB417\uB419-\uB433\uB435-\uB44F\uB451-\uB46B\uB46D-\uB487\uB489-\uB4A3\uB4A5-\uB4BF\uB4C1-\uB4DB\uB4DD-\uB4F7\uB4F9-\uB513\uB515-\uB52F\uB531-\uB54B\uB54D-\uB567\uB569-\uB583\uB585-\uB59F\uB5A1-\uB5BB\uB5BD-\uB5D7\uB5D9-\uB5F3\uB5F5-\uB60F\uB611-\uB62B\uB62D-\uB647\uB649-\uB663\uB665-\uB67F\uB681-\uB69B\uB69D-\uB6B7\uB6B9-\uB6D3\uB6D5-\uB6EF\uB6F1-\uB70B\uB70D-\uB727\uB729-\uB743\uB745-\uB75F\uB761-\uB77B\uB77D-\uB797\uB799-\uB7B3\uB7B5-\uB7CF\uB7D1-\uB7EB\uB7ED-\uB807\uB809-\uB823\uB825-\uB83F\uB841-\uB85B\uB85D-\uB877\uB879-\uB893\uB895-\uB8AF\uB8B1-\uB8CB\uB8CD-\uB8E7\uB8E9-\uB903\uB905-\uB91F\uB921-\uB93B\uB93D-\uB957\uB959-\uB973\uB975-\uB98F\uB991-\uB9AB\uB9AD-\uB9C7\uB9C9-\uB9E3\uB9E5-\uB9FF\uBA01-\uBA1B\uBA1D-\uBA37\uBA39-\uBA53\uBA55-\uBA6F\uBA71-\uBA8B\uBA8D-\uBAA7\uBAA9-\uBAC3\uBAC5-\uBADF\uBAE1-\uBAFB\uBAFD-\uBB17\uBB19-\uBB33\uBB35-\uBB4F\uBB51-\uBB6B\uBB6D-\uBB87\uBB89-\uBBA3\uBBA5-\uBBBF\uBBC1-\uBBDB\uBBDD-\uBBF7\uBBF9-\uBC13\uBC15-\uBC2F\uBC31-\uBC4B\uBC4D-\uBC67\uBC69-\uBC83\uBC85-\uBC9F\uBCA1-\uBCBB\uBCBD-\uBCD7\uBCD9-\uBCF3\uBCF5-\uBD0F\uBD11-\uBD2B\uBD2D-\uBD47\uBD49-\uBD63\uBD65-\uBD7F\uBD81-\uBD9B\uBD9D-\uBDB7\uBDB9-\uBDD3\uBDD5-\uBDEF\uBDF1-\uBE0B\uBE0D-\uBE27\uBE29-\uBE43\uBE45-\uBE5F\uBE61-\uBE7B\uBE7D-\uBE97\uBE99-\uBEB3\uBEB5-\uBECF\uBED1-\uBEEB\uBEED-\uBF07\uBF09-\uBF23\uBF25-\uBF3F\uBF41-\uBF5B\uBF5D-\uBF77\uBF79-\uBF93\uBF95-\uBFAF\uBFB1-\uBFCB\uBFCD-\uBFE7\uBFE9-\uC003\uC005-\uC01F\uC021-\uC03B\uC03D-\uC057\uC059-\uC073\uC075-\uC08F\uC091-\uC0AB\uC0AD-\uC0C7\uC0C9-\uC0E3\uC0E5-\uC0FF\uC101-\uC11B\uC11D-\uC137\uC139-\uC153\uC155-\uC16F\uC171-\uC18B\uC18D-\uC1A7\uC1A9-\uC1C3\uC1C5-\uC1DF\uC1E1-\uC1FB\uC1FD-\uC217\uC219-\uC233\uC235-\uC24F\uC251-\uC26B\uC26D-\uC287\uC289-\uC2A3\uC2A5-\uC2BF\uC2C1-\uC2DB\uC2DD-\uC2F7\uC2F9-\uC313\uC315-\uC32F\uC331-\uC34B\uC34D-\uC367\uC369-\uC383\uC385-\uC39F\uC3A1-\uC3BB\uC3BD-\uC3D7\uC3D9-\uC3F3\uC3F5-\uC40F\uC411-\uC42B\uC42D-\uC447\uC449-\uC463\uC465-\uC47F\uC481-\uC49B\uC49D-\uC4B7\uC4B9-\uC4D3\uC4D5-\uC4EF\uC4F1-\uC50B\uC50D-\uC527\uC529-\uC543\uC545-\uC55F\uC561-\uC57B\uC57D-\uC597\uC599-\uC5B3\uC5B5-\uC5CF\uC5D1-\uC5EB\uC5ED-\uC607\uC609-\uC623\uC625-\uC63F\uC641-\uC65B\uC65D-\uC677\uC679-\uC693\uC695-\uC6AF\uC6B1-\uC6CB\uC6CD-\uC6E7\uC6E9-\uC703\uC705-\uC71F\uC721-\uC73B\uC73D-\uC757\uC759-\uC773\uC775-\uC78F\uC791-\uC7AB\uC7AD-\uC7C7\uC7C9-\uC7E3\uC7E5-\uC7FF\uC801-\uC81B\uC81D-\uC837\uC839-\uC853\uC855-\uC86F\uC871-\uC88B\uC88D-\uC8A7\uC8A9-\uC8C3\uC8C5-\uC8DF\uC8E1-\uC8FB\uC8FD-\uC917\uC919-\uC933\uC935-\uC94F\uC951-\uC96B\uC96D-\uC987\uC989-\uC9A3\uC9A5-\uC9BF\uC9C1-\uC9DB\uC9DD-\uC9F7\uC9F9-\uCA13\uCA15-\uCA2F\uCA31-\uCA4B\uCA4D-\uCA67\uCA69-\uCA83\uCA85-\uCA9F\uCAA1-\uCABB\uCABD-\uCAD7\uCAD9-\uCAF3\uCAF5-\uCB0F\uCB11-\uCB2B\uCB2D-\uCB47\uCB49-\uCB63\uCB65-\uCB7F\uCB81-\uCB9B\uCB9D-\uCBB7\uCBB9-\uCBD3\uCBD5-\uCBEF\uCBF1-\uCC0B\uCC0D-\uCC27\uCC29-\uCC43\uCC45-\uCC5F\uCC61-\uCC7B\uCC7D-\uCC97\uCC99-\uCCB3\uCCB5-\uCCCF\uCCD1-\uCCEB\uCCED-\uCD07\uCD09-\uCD23\uCD25-\uCD3F\uCD41-\uCD5B\uCD5D-\uCD77\uCD79-\uCD93\uCD95-\uCDAF\uCDB1-\uCDCB\uCDCD-\uCDE7\uCDE9-\uCE03\uCE05-\uCE1F\uCE21-\uCE3B\uCE3D-\uCE57\uCE59-\uCE73\uCE75-\uCE8F\uCE91-\uCEAB\uCEAD-\uCEC7\uCEC9-\uCEE3\uCEE5-\uCEFF\uCF01-\uCF1B\uCF1D-\uCF37\uCF39-\uCF53\uCF55-\uCF6F\uCF71-\uCF8B\uCF8D-\uCFA7\uCFA9-\uCFC3\uCFC5-\uCFDF\uCFE1-\uCFFB\uCFFD-\uD017\uD019-\uD033\uD035-\uD04F\uD051-\uD06B\uD06D-\uD087\uD089-\uD0A3\uD0A5-\uD0BF\uD0C1-\uD0DB\uD0DD-\uD0F7\uD0F9-\uD113\uD115-\uD12F\uD131-\uD14B\uD14D-\uD167\uD169-\uD183\uD185-\uD19F\uD1A1-\uD1BB\uD1BD-\uD1D7\uD1D9-\uD1F3\uD1F5-\uD20F\uD211-\uD22B\uD22D-\uD247\uD249-\uD263\uD265-\uD27F\uD281-\uD29B\uD29D-\uD2B7\uD2B9-\uD2D3\uD2D5-\uD2EF\uD2F1-\uD30B\uD30D-\uD327\uD329-\uD343\uD345-\uD35F\uD361-\uD37B\uD37D-\uD397\uD399-\uD3B3\uD3B5-\uD3CF\uD3D1-\uD3EB\uD3ED-\uD407\uD409-\uD423\uD425-\uD43F\uD441-\uD45B\uD45D-\uD477\uD479-\uD493\uD495-\uD4AF\uD4B1-\uD4CB\uD4CD-\uD4E7\uD4E9-\uD503\uD505-\uD51F\uD521-\uD53B\uD53D-\uD557\uD559-\uD573\uD575-\uD58F\uD591-\uD5AB\uD5AD-\uD5C7\uD5C9-\uD5E3\uD5E5-\uD5FF\uD601-\uD61B\uD61D-\uD637\uD639-\uD653\uD655-\uD66F\uD671-\uD68B\uD68D-\uD6A7\uD6A9-\uD6C3\uD6C5-\uD6DF\uD6E1-\uD6FB\uD6FD-\uD717\uD719-\uD733\uD735-\uD74F\uD751-\uD76B\uD76D-\uD787\uD789-\uD7A3]$/u,xfn=new RegExp("^\\p{ExtPict}$","u"),Cfn=(t,e)=>{let n=lo.Any;return t.search(ffn)!==-1&&(n|=lo.Extend),e===8205&&(n|=lo.ZWJ),e>=127462&&e<=127487&&(n|=lo.RI),t.search(hfn)!==-1&&(n|=lo.Prepend),t.search(pfn)!==-1&&(n|=lo.SpacingMark),t.search(mfn)!==-1&&(n|=lo.L),t.search(gfn)!==-1&&(n|=lo.V),t.search(yfn)!==-1&&(n|=lo.T),t.search(bfn)!==-1&&(n|=lo.LV),t.search(vfn)!==-1&&(n|=lo.LVT),t.search(xfn)!==-1&&(n|=lo.ExtPict),n};function qC(t,e){return(t&e)!==0}const wfn=[[lo.L,lo.L|lo.V|lo.LV|lo.LVT],[lo.LV|lo.V,lo.V|lo.T],[lo.LVT|lo.T,lo.T],[lo.Any,lo.Extend|lo.ZWJ],[lo.Any,lo.SpacingMark],[lo.Prepend,lo.Any],[lo.ZWJ,lo.ExtPict],[lo.RI,lo.RI]];function _fn(t,e){return wfn.findIndex(n=>qC(t,n[0])&&qC(e,n[1]))===-1}const Sfn=new RegExp("\\p{ExtPict}[\\p{Gr_Ext}\\p{EMod}]*\\u200D$","u"),qSe=t=>t.search(Sfn)!==-1,kfn=new RegExp("\\p{RI}+$","gu"),Efn=t=>{const e=t.match(kfn);return e===null?!1:e[0].length/2%2===1},jN=new WeakMap,AN=new WeakMap,DI=new WeakMap,zet=new WeakMap,GSe=new WeakMap,YSe=new WeakMap,KSe=new WeakMap,Tfn={delete(t,e){t.delete(e)},insertFragment(t,e,n){t.insertFragment(e,n)},insertText(t,e,n={}){De.withoutNormalizing(t,()=>{const{voids:r=!1}=n;let{at:i=o2e(t)}=n;if(ut.isPath(i)&&(i=De.range(t,i)),It.isRange(i))if(It.isCollapsed(i))i=i.anchor;else{const a=It.end(i);if(!r&&De.void(t,{at:a}))return;const l=It.start(i),c=De.pointRef(t,l),u=De.pointRef(t,a);wt.delete(t,{at:i,voids:r});const f=c.unref(),h=u.unref();i=f||h,wt.setSelection(t,{anchor:i,focus:i})}if(!r&&De.void(t,{at:i})||De.elementReadOnly(t,{at:i}))return;const{path:o,offset:s}=i;e.length>0&&t.apply({type:"insert_text",path:o,offset:s,text:e})})}},wt={...nfn,...rfn,...ifn,...Tfn},XSe=(t,e,...n)=>[...t.slice(0,e),...n,...t.slice(e)],Wj=(t,e,n,...r)=>[...t.slice(0,e),...r,...t.slice(e+n)],Goe=Wj,l2e=(t,e,n)=>{if(e.length===0)throw new Error("Cannot modify the editor");const r=hn.get(t,e),i=e.slice();let o=n(r);for(;i.length>1;){const a=i.pop(),l=hn.get(t,i);o={...l,children:Wj(l.children,a,1,o)}}const s=i.pop();t.children=Wj(t.children,s,1,o)},wb=(t,e,n)=>{e.length===0?t.children=n(t.children):l2e(t,e,r=>{if(Dn.isText(r))throw new Error(`Cannot get the element at path [${e}] because it refers to a leaf node: ${fd.stringify(r)}`);return{...r,children:n(r.children)}})},RN=(t,e,n)=>l2e(t,e,r=>{if(!Dn.isText(r))throw new Error(`Cannot get the leaf node at path [${e}] because it refers to a non-leaf node: ${fd.stringify(r)}`);return n(r)}),hn={ancestor(t,e){const n=hn.get(t,e);if(Dn.isText(n))throw new Error(`Cannot get the ancestor node at path [${e}] because it refers to a text node instead: ${fd.stringify(n)}`);return n},*ancestors(t,e,n={}){for(const r of ut.ancestors(e,n))yield[hn.ancestor(t,r),r]},child(t,e){if(Dn.isText(t))throw new Error(`Cannot get the child of a text node: ${fd.stringify(t)}`);const n=t.children[e];if(n==null)throw new Error(`Cannot get child at index \`${e}\` in node: ${fd.stringify(t)}`);return n},*children(t,e,n={}){const{reverse:r=!1}=n,i=hn.ancestor(t,e),{children:o}=i;let s=r?o.length-1:0;for(;r?s>=0:s!It.includes(e,s)});for(const[,s]of o){if(!It.includes(e,s)){const a=s[s.length-1];wb(n,ut.parent(s),l=>Goe(l,a,1))}ut.equals(s,i.path)&&RN(n,s,a=>{const l=a.text.slice(0,i.offset);return{...a,text:l}}),ut.equals(s,r.path)&&RN(n,s,a=>{const l=a.text.slice(r.offset);return{...a,text:l}})}return n.children},get(t,e){const n=hn.getIf(t,e);if(n===void 0)throw new Error(`Cannot find a descendant at path [${e}] in node: ${fd.stringify(t)}`);return n},getIf(t,e){let n=t;for(let r=0;rhn.isNode(n,{deep:e}))},last(t,e){const n=e.slice();let r=hn.get(t,n);for(;r&&!(Dn.isText(r)||r.children.length===0);){const i=r.children.length-1;r=r.children[i],n.push(i)}return[r,n]},leaf(t,e){const n=hn.get(t,e);if(!Dn.isText(n))throw new Error(`Cannot get the leaf node at path [${e}] because it refers to a non-leaf node: ${fd.stringify(n)}`);return n},*levels(t,e,n={}){for(const r of ut.levels(e,n))yield[hn.get(t,r),r]},matches(t,e){return On.isElement(t)&&On.isElementProps(e)&&On.matches(t,e)||Dn.isText(t)&&Dn.isTextProps(e)&&Dn.matches(t,e)},*nodes(t,e={}){const{pass:n,reverse:r=!1}=e,{from:i=[],to:o}=e,s=new Set;let a=[],l=t;for(;!(o&&(r?ut.isBefore(a,o):ut.isAfter(a,o)));){if(s.has(l)||(yield[l,a]),!s.has(l)&&!Dn.isText(l)&&l.children.length!==0&&(n==null||n([l,a])===!1)){s.add(l);let c=r?l.children.length-1:0;ut.isAncestor(a,i)&&(c=i[a.length]),a=a.concat(c),l=hn.get(t,a);continue}if(a.length===0)break;if(!r){const c=ut.next(a);if(hn.has(t,c)){a=c,l=hn.get(t,a);continue}}if(r&&a[a.length-1]!==0){a=ut.previous(a),l=hn.get(t,a);continue}a=ut.parent(a),l=hn.get(t,a),s.add(l)}},parent(t,e){const n=ut.parent(e),r=hn.get(t,n);if(Dn.isText(r))throw new Error(`Cannot get the parent of path [${e}] because it does not exist in the root.`);return r},string(t){return Dn.isText(t)?t.text:t.children.map(hn.string).join("")},*texts(t,e={}){for(const[n,r]of hn.nodes(t,e))Dn.isText(n)&&(yield[n,r])}},Ifn=(t,{deep:e=!1}={})=>F1(t)?typeof t.addMark=="function"&&typeof t.apply=="function"&&typeof t.deleteFragment=="function"&&typeof t.insertBreak=="function"&&typeof t.insertSoftBreak=="function"&&typeof t.insertFragment=="function"&&typeof t.insertNode=="function"&&typeof t.insertText=="function"&&typeof t.isElementReadOnly=="function"&&typeof t.isInline=="function"&&typeof t.isSelectable=="function"&&typeof t.isVoid=="function"&&typeof t.normalizeNode=="function"&&typeof t.onChange=="function"&&typeof t.removeMark=="function"&&typeof t.getDirtyPaths=="function"&&(t.marks===null||F1(t.marks))&&(t.selection===null||It.isRange(t.selection))&&(!e||hn.isNodeList(t.children))&&WC.isOperationList(t.operations):!1,De={above(t,e){return t.above(e)},addMark(t,e,n){t.addMark(e,n)},after(t,e,n){return t.after(e,n)},before(t,e,n){return t.before(e,n)},deleteBackward(t,e={}){const{unit:n="character"}=e;t.deleteBackward(n)},deleteForward(t,e={}){const{unit:n="character"}=e;t.deleteForward(n)},deleteFragment(t,e){t.deleteFragment(e)},edges(t,e){return t.edges(e)},elementReadOnly(t,e={}){return t.elementReadOnly(e)},end(t,e){return t.end(e)},first(t,e){return t.first(e)},fragment(t,e){return t.fragment(e)},hasBlocks(t,e){return t.hasBlocks(e)},hasInlines(t,e){return t.hasInlines(e)},hasPath(t,e){return t.hasPath(e)},hasTexts(t,e){return t.hasTexts(e)},insertBreak(t){t.insertBreak()},insertFragment(t,e,n){t.insertFragment(e,n)},insertNode(t,e){t.insertNode(e)},insertSoftBreak(t){t.insertSoftBreak()},insertText(t,e){t.insertText(e)},isBlock(t,e){return t.isBlock(e)},isEdge(t,e,n){return t.isEdge(e,n)},isEditor(t){return Ifn(t)},isElementReadOnly(t,e){return t.isElementReadOnly(e)},isEmpty(t,e){return t.isEmpty(e)},isEnd(t,e,n){return t.isEnd(e,n)},isInline(t,e){return t.isInline(e)},isNormalizing(t){return t.isNormalizing()},isSelectable(t,e){return t.isSelectable(e)},isStart(t,e,n){return t.isStart(e,n)},isVoid(t,e){return t.isVoid(e)},last(t,e){return t.last(e)},leaf(t,e,n){return t.leaf(e,n)},levels(t,e){return t.levels(e)},marks(t){return t.getMarks()},next(t,e){return t.next(e)},node(t,e,n){return t.node(e,n)},nodes(t,e){return t.nodes(e)},normalize(t,e){t.normalize(e)},parent(t,e,n){return t.parent(e,n)},path(t,e,n){return t.path(e,n)},pathRef(t,e,n){return t.pathRef(e,n)},pathRefs(t){return t.pathRefs()},point(t,e,n){return t.point(e,n)},pointRef(t,e,n){return t.pointRef(e,n)},pointRefs(t){return t.pointRefs()},positions(t,e){return t.positions(e)},previous(t,e){return t.previous(e)},range(t,e,n){return t.range(e,n)},rangeRef(t,e,n){return t.rangeRef(e,n)},rangeRefs(t){return t.rangeRefs()},removeMark(t,e){t.removeMark(e)},setNormalizing(t,e){t.setNormalizing(e)},start(t,e){return t.start(e)},string(t,e,n){return t.string(e,n)},unhangRange(t,e,n){return t.unhangRange(e,n)},void(t,e){return t.void(e)},withoutNormalizing(t,e){t.withoutNormalizing(e)},shouldMergeNodesRemovePrevNode:(t,e,n)=>t.shouldMergeNodesRemovePrevNode(e,n)},nL=new WeakMap,jfn=t=>nL.get(t)||!1,Afn=(t,e,n)=>{const r=nL.get(t)||!1;nL.set(t,!0);try{e(),n()}finally{nL.set(t,r)}};function Het(t,e,n){const r=jN.get(t)||[],i=AN.get(t)||new Set;let o,s;const a=l=>{if(l){const c=l.join(",");s.has(c)||(s.add(c),o.push(l))}};if(n){o=[],s=new Set;for(const l of r){const c=n(l);a(c)}}else o=r,s=i;for(const l of e)a(l);jN.set(t,o),AN.set(t,s)}const Rfn=(t,e)=>{for(const n of De.pathRefs(t))J1n.transform(n,e);for(const n of De.pointRefs(t))efn.transform(n,e);for(const n of De.rangeRefs(t))tfn.transform(n,e);if(!jfn(t)){const n=ut.operationCanTransformPath(e)?r=>ut.transform(r,e):void 0;Het(t,t.getDirtyPaths(e),n)}wt.transform(t,e),t.operations.push(e),De.normalize(t,{operation:e}),e.type==="set_selection"&&(t.marks=null),DI.get(t)||(DI.set(t,!0),Promise.resolve().then(()=>{DI.set(t,!1),t.onChange({operation:e}),t.operations=[]}))},Dfn=(t,e)=>{switch(e.type){case"insert_text":case"remove_text":case"set_node":{const{path:n}=e;return ut.levels(n)}case"insert_node":{const{node:n,path:r}=e,i=ut.levels(r),o=Dn.isText(n)?[]:Array.from(hn.nodes(n),([,s])=>r.concat(s));return[...i,...o]}case"merge_node":{const{path:n}=e,r=ut.ancestors(n),i=ut.previous(n);return[...r,i]}case"move_node":{const{path:n,newPath:r}=e;if(ut.equals(n,r))return[];const i=[],o=[];for(const c of ut.ancestors(n)){const u=ut.transform(c,e);i.push(u)}for(const c of ut.ancestors(r)){const u=ut.transform(c,e);o.push(u)}const s=o[o.length-1],a=r[r.length-1],l=s.concat(a);return[...i,...o,l]}case"remove_node":{const{path:n}=e;return[...ut.ancestors(n)]}case"split_node":{const{path:n}=e,r=ut.levels(n),i=ut.next(n);return[...r,i]}default:return[]}},Ofn=t=>{const{selection:e}=t;return e?hn.fragment(t,e):[]},Pfn=(t,e,n)=>{const[r,i]=e;if(Dn.isText(r))return;if(On.isElement(r)&&r.children.length===0){const a=t.createSpan();wt.insertNodes(t,a,{at:i.concat(0),voids:!0});return}const o=De.isEditor(r)?!1:On.isElement(r)&&(t.isInline(r)||r.children.length===0||Dn.isText(r.children[0])||t.isInline(r.children[0]));let s=0;for(let a=0;a{const r=n*42;if(e>r)throw new Error(`Could not completely normalize the editor after ${r} iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state.`);return!0},Mfn=(t,e={})=>{const{voids:n=!1,mode:r="lowest",at:i=t.selection,match:o}=e;if(!i)return;let s=De.path(t,i);if(!It.isRange(i)||ut.equals(i.focus.path,i.anchor.path)){if(s.length===0)return;s=ut.parent(s)}const a=r==="lowest",[l]=De.levels(t,{at:s,voids:n,match:o,reverse:a});return l},Lfn=(t,e,n)=>{const{selection:r}=t;if(r){const i=(a,l)=>{if(!Dn.isText(a))return!1;const[c]=De.parent(t,l);return!t.isVoid(c)||t.markableVoid(c)},o=It.isExpanded(r);let s=!1;if(!o){const[a,l]=De.node(t,r);if(a&&i(a,l)){const[c]=De.parent(t,l);s=c&&t.markableVoid(c)}}if(o||s)wt.setNodes(t,{[e]:n},{match:i,split:!0,voids:!0});else{const a={...De.marks(t)||{},[e]:n};t.marks=a,DI.get(t)||t.onChange()}}},Ffn=(t,e,n={})=>{const r=De.point(t,e,{edge:"end"}),i=De.end(t,[]),o={anchor:r,focus:i},{distance:s=1}=n;let a=0,l;for(const c of De.positions(t,{...n,at:o})){if(a>s)break;a!==0&&(l=c),a++}return l},Nfn=(t,e,n={})=>{const r=De.start(t,[]),i=De.point(t,e,{edge:"start"}),o={anchor:r,focus:i},{distance:s=1}=n;let a=0,l;for(const c of De.positions(t,{...n,at:o,reverse:!0})){if(a>s)break;a!==0&&(l=c),a++}return l},Bfn=(t,e)=>{const{selection:n}=t;n&&It.isCollapsed(n)&&wt.delete(t,{unit:e,reverse:!0})},Vfn=(t,e)=>{const{selection:n}=t;n&&It.isCollapsed(n)&&wt.delete(t,{unit:e})},zfn=(t,{direction:e="forward"}={})=>{const{selection:n}=t;n&&It.isExpanded(n)&&wt.delete(t,{reverse:e==="backward"})},Hfn=(t,e)=>[De.start(t,e),De.end(t,e)],Ufn=(t,e={})=>De.above(t,{...e,match:n=>On.isElement(n)&&De.isElementReadOnly(t,n)}),Wfn=(t,e)=>De.point(t,e,{edge:"end"}),qfn=(t,e)=>{const n=De.path(t,e,{edge:"start"});return De.node(t,n)},Gfn=(t,e)=>{const n=De.range(t,e);return hn.fragment(t,n)},Yfn=(t,e={})=>De.above(t,{...e,match:n=>On.isElement(n)&&De.isVoid(t,n)}),Kfn=(t,e)=>e.children.some(n=>On.isElement(n)&&De.isBlock(t,n)),Xfn=(t,e)=>e.children.some(n=>Dn.isText(n)||De.isInline(t,n)),Zfn=(t,e)=>hn.has(t,e),Qfn=(t,e)=>e.children.every(n=>Dn.isText(n)),Jfn=t=>{wt.splitNodes(t,{always:!0})},e2n=(t,e,n)=>{wt.insertNodes(t,e,n)},t2n=t=>{wt.splitNodes(t,{always:!0})},n2n=(t,e,n={})=>{const{selection:r,marks:i}=t;if(r){if(i){const o={text:e,...i};wt.insertNodes(t,o,{at:n.at,voids:n.voids})}else wt.insertText(t,e,n);t.marks=null}},r2n=(t,e)=>!t.isInline(e),i2n=(t,e,n)=>De.isStart(t,e,n)||De.isEnd(t,e,n),o2n=(t,e)=>{const{children:n}=e,[r]=n;return n.length===0||n.length===1&&Dn.isText(r)&&r.text===""&&!t.isVoid(e)},s2n=(t,e,n)=>{const r=De.end(t,n);return gi.equals(e,r)},a2n=t=>{const e=zet.get(t);return e===void 0?!0:e},l2n=(t,e,n)=>{if(e.offset!==0)return!1;const r=De.start(t,n);return gi.equals(e,r)},c2n=(t,e)=>{const n=De.path(t,e,{edge:"end"});return De.node(t,n)},u2n=(t,e,n={})=>{const r=De.path(t,e,n);return[hn.leaf(t,r),r]};function*d2n(t,e={}){const{at:n=t.selection,reverse:r=!1,voids:i=!1}=e;let{match:o}=e;if(o==null&&(o=()=>!0),!n)return;const s=[],a=De.path(t,n);for(const[l,c]of hn.levels(t,a))if(o(l,c)&&(s.push([l,c]),!i&&On.isElement(l)&&De.isVoid(t,l)))break;r&&s.reverse(),yield*s}const f2n=(t,e={})=>{const{marks:n,selection:r}=t;if(!r)return null;let{anchor:i,focus:o}=r;if(n)return n;if(It.isExpanded(r)){if(It.isBackward(r)&&([o,i]=[i,o]),De.isEnd(t,i,i.path)){const f=De.after(t,i);f&&(i=f)}const[u]=De.nodes(t,{match:Dn.isText,at:{anchor:i,focus:o}});if(u){const[f]=u,{text:h,...p}=f;return p}else return{}}const{path:s}=i;let[a]=De.leaf(t,s);if(i.offset===0){const u=De.previous(t,{at:s,match:Dn.isText});if(!De.above(t,{match:f=>On.isElement(f)&&De.isVoid(t,f)&&t.markableVoid(f)})){const f=De.above(t,{match:h=>On.isElement(h)&&De.isBlock(t,h)});if(u&&f){const[h,p]=u,[,m]=f;ut.isAncestor(m,p)&&(a=h)}}}const{text:l,...c}=a;return c},h2n=(t,e={})=>{const{mode:n="lowest",voids:r=!1}=e;let{match:i,at:o=t.selection}=e;if(!o)return;const s=De.after(t,o,{voids:r});if(!s)return;const[,a]=De.last(t,[]),l=[s.path,a];if(ut.isPath(o)&&o.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(ut.isPath(o)){const[u]=De.parent(t,o);i=f=>u.children.includes(f)}else i=()=>!0;const[c]=De.nodes(t,{at:l,match:i,mode:n,voids:r});return c},p2n=(t,e,n={})=>{const r=De.path(t,e,n);return[hn.get(t,r),r]};function*m2n(t,e={}){const{at:n=t.selection,mode:r="all",universal:i=!1,reverse:o=!1,voids:s=!1,pass:a}=e;let{match:l}=e;if(l||(l=()=>!0),!n)return;let c,u;if(Q1n.isSpan(n))c=n[0],u=n[1];else{const m=De.path(t,n,{edge:"start"}),g=De.path(t,n,{edge:"end"});c=o?g:m,u=o?m:g}const f=hn.nodes(t,{reverse:o,from:c,to:u,pass:([m,g])=>a&&a([m,g])?!0:On.isElement(m)?!!(!s&&(De.isVoid(t,m)||De.isElementReadOnly(t,m))):!1}),h=[];let p;for(const[m,g]of f){const y=p&&ut.compare(g,p[1])===0;if(r==="highest"&&y)continue;if(!l(m,g)){if(i&&!y&&Dn.isText(m))return;continue}if(r==="lowest"&&y){p=[m,g];continue}const b=r==="lowest"?p:[m,g];b&&(i?h.push(b):yield b),p=[m,g]}r==="lowest"&&p&&(i?h.push(p):yield p),i&&(yield*h)}const g2n=(t,e={})=>{const{force:n=!1,operation:r}=e,i=a=>jN.get(a)||[],o=a=>AN.get(a)||new Set,s=a=>{const l=i(a).pop(),c=l.join(",");return o(a).delete(c),l};if(De.isNormalizing(t)){if(n){const a=Array.from(hn.nodes(t),([,c])=>c),l=new Set(a.map(c=>c.join(",")));jN.set(t,a),AN.set(t,l)}i(t).length!==0&&De.withoutNormalizing(t,()=>{for(const u of i(t))if(hn.has(t,u)){const f=De.node(t,u),[h]=f;On.isElement(h)&&h.children.length===0&&t.normalizeNode(f,{operation:r})}let a=i(t);const l=a.length;let c=0;for(;a.length!==0;){if(!t.shouldNormalize({dirtyPaths:a,iteration:c,initialDirtyPathsLength:l,operation:r}))return;const u=s(t);if(hn.has(t,u)){const f=De.node(t,u);t.normalizeNode(f,{operation:r})}c++,a=i(t)}})}},y2n=(t,e,n={})=>{const r=De.path(t,e,n),i=ut.parent(r);return De.node(t,i)},b2n=(t,e,n={})=>{const{affinity:r="forward"}=n,i={current:e,affinity:r,unref(){const{current:o}=i;return De.pathRefs(t).delete(i),i.current=null,o}};return De.pathRefs(t).add(i),i},v2n=t=>{let e=GSe.get(t);return e||(e=new Set,GSe.set(t,e)),e},x2n=(t,e,n={})=>{const{depth:r,edge:i}=n;if(ut.isPath(e)){if(i==="start"){const[,o]=hn.first(t,e);e=o}else if(i==="end"){const[,o]=hn.last(t,e);e=o}}return It.isRange(e)&&(i==="start"?e=It.start(e):i==="end"?e=It.end(e):e=ut.common(e.anchor.path,e.focus.path)),gi.isPoint(e)&&(e=e.path),r!=null&&(e=e.slice(0,r)),e},C2n=(t,e,n={})=>{const{affinity:r="forward"}=n,i={current:e,affinity:r,unref(){const{current:o}=i;return De.pointRefs(t).delete(i),i.current=null,o}};return De.pointRefs(t).add(i),i},w2n=t=>{let e=YSe.get(t);return e||(e=new Set,YSe.set(t,e)),e},_2n=(t,e,n={})=>{const{edge:r="start"}=n;if(ut.isPath(e)){let i;if(r==="end"){const[,s]=hn.last(t,e);i=s}else{const[,s]=hn.first(t,e);i=s}const o=hn.get(t,i);if(!Dn.isText(o))throw new Error(`Cannot get the ${r} point in the node at path [${e}] because it has no ${r} text node.`);return{path:i,offset:r==="end"?o.text.length:0}}if(It.isRange(e)){const[i,o]=It.edges(e);return r==="start"?i:o}return e};function*S2n(t,e={}){const{at:n=t.selection,unit:r="offset",reverse:i=!1,voids:o=!1}=e;if(!n)return;const s=De.range(t,n),[a,l]=It.edges(s),c=i?l:a;let u=!1,f="",h=0,p=0,m=0;const g=[];for(const[b,v]of De.nodes(t,{at:n,reverse:i,voids:o})){const x=g.some(w=>ut.isAncestor(w,v));function*C(w){x||(yield w)}if(On.isElement(b)){if(!t.isSelectable(b))if(g.push(v),i){ut.hasPrevious(v)&&(yield*C(De.end(t,ut.previous(v))));continue}else{const w=ut.next(v);De.hasPath(t,w)&&(yield*C(De.start(t,w)));continue}if(!o&&(t.isVoid(b)||t.isElementReadOnly(b))){yield*C(De.start(t,v));continue}if(t.isInline(b))continue;if(De.hasInlines(t,b)){const w=ut.isAncestor(v,l.path)?l:De.end(t,v),_=ut.isAncestor(v,a.path)?a:De.start(t,v);f=De.string(t,{anchor:_,focus:w},{voids:o}),u=!0}}if(Dn.isText(b)){const w=ut.equals(v,c.path);for(w?(p=i?c.offset:b.text.length-c.offset,m=c.offset):(p=b.text.length,m=i?p:0),(w||u||r==="offset")&&(yield*C({path:v,offset:m}),u=!1);;){if(h===0){if(f==="")break;h=y(f,r,i),f=a2e(f,h,i)[1]}if(m=i?m-h:m+h,p=p-h,p<0){h=-p;break}h=0,yield*C({path:v,offset:m})}}}function y(b,v,x){return v==="character"?s2e(b,x):v==="word"?lfn(b,x):v==="line"||v==="block"?b.length:1}}const k2n=(t,e={})=>{const{mode:n="lowest",voids:r=!1}=e;let{match:i,at:o=t.selection}=e;if(!o)return;const s=De.before(t,o,{voids:r});if(!s)return;const[,a]=De.first(t,[]),l=[s.path,a];if(ut.isPath(o)&&o.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(ut.isPath(o)){const[u]=De.parent(t,o);i=f=>u.children.includes(f)}else i=()=>!0;const[c]=De.nodes(t,{reverse:!0,at:l,match:i,mode:n,voids:r});return c},E2n=(t,e,n={})=>{const{affinity:r="forward"}=n,i={current:e,affinity:r,unref(){const{current:o}=i;return De.rangeRefs(t).delete(i),i.current=null,o}};return De.rangeRefs(t).add(i),i},T2n=t=>{let e=KSe.get(t);return e||(e=new Set,KSe.set(t,e)),e},I2n=(t,e,n)=>{if(It.isRange(e)&&!n)return e;const r=De.start(t,e),i=De.end(t,n||e);return{anchor:r,focus:i}},j2n=(t,e)=>{const{selection:n}=t;if(n){const r=(s,a)=>{if(!Dn.isText(s))return!1;const[l]=De.parent(t,a);return!t.isVoid(l)||t.markableVoid(l)},i=It.isExpanded(n);let o=!1;if(!i){const[s,a]=De.node(t,n);if(s&&r(s,a)){const[l]=De.parent(t,a);o=l&&t.markableVoid(l)}}if(i||o)wt.unsetNodes(t,e,{match:r,split:!0,voids:!0});else{const s={...De.marks(t)||{}};delete s[e],t.marks=s,DI.get(t)||t.onChange()}}},A2n=(t,e)=>{zet.set(t,e)},R2n=(t,e)=>De.point(t,e,{edge:"start"}),D2n=(t,e,n={})=>{const{voids:r=!1}=n,i=De.range(t,e),[o,s]=It.edges(i);let a="";for(const[l,c]of De.nodes(t,{at:i,match:Dn.isText,voids:r})){let u=l.text;ut.equals(c,s.path)&&(u=u.slice(0,s.offset)),ut.equals(c,o.path)&&(u=u.slice(o.offset)),a+=u}return a},O2n=(t,e,n={})=>{const{voids:r=!1}=n;let[i,o]=It.edges(e);if(i.offset!==0||o.offset!==0||It.isCollapsed(e)||ut.hasPrevious(o.path))return e;const s=De.above(t,{at:o,match:u=>On.isElement(u)&&De.isBlock(t,u),voids:r}),a=s?s[1]:[],l={anchor:De.start(t,i),focus:o};let c=!0;for(const[u,f]of De.nodes(t,{at:l,match:Dn.isText,reverse:!0,voids:r})){if(c){c=!1;continue}if(u.text!==""||ut.isBefore(f,a)){o={path:f,offset:u.text.length};break}}return{anchor:i,focus:o}},P2n=(t,e)=>{const n=De.isNormalizing(t);De.setNormalizing(t,!1);try{e()}finally{De.setNormalizing(t,n)}De.normalize(t)},$2n=(t,[e,n],[r,i])=>On.isElement(e)&&De.isEmpty(t,e)||Dn.isText(e)&&e.text===""&&n[n.length-1]!==0,M2n=(t,e,n={})=>{De.withoutNormalizing(t,()=>{const{hanging:r=!1,voids:i=!1,mode:o="lowest",batchDirty:s=!0}=n;let{at:a,match:l,select:c}=n;if(hn.isNode(e)&&(e=[e]),e.length===0)return;const u=e[0];if(a||(a=o2e(t),c!==!1&&(c=!0)),c==null&&(c=!1),It.isRange(a))if(r||(a=De.unhangRange(t,a,{voids:i})),It.isCollapsed(a))a=a.anchor;else{const[,p]=It.edges(a),m=De.pointRef(t,p);wt.delete(t,{at:a}),a=m.unref()}if(gi.isPoint(a)){l==null&&(Dn.isText(u)?l=m=>Dn.isText(m):t.isInline(u)?l=m=>Dn.isText(m)||De.isInline(t,m):l=m=>On.isElement(m)&&De.isBlock(t,m));const[p]=De.nodes(t,{at:a.path,match:l,mode:o,voids:i});if(p){const[,m]=p,g=De.pathRef(t,m),y=De.isEnd(t,a,m);wt.splitNodes(t,{at:a,match:l,mode:o,voids:i});const b=g.unref();a=y?ut.next(b):b}else return}const f=ut.parent(a);let h=a[a.length-1];if(!(!i&&De.void(t,{at:f}))){if(s){const p=[],m=ut.levels(f);Afn(t,()=>{for(const g of e){const y=f.concat(h);h++;const b={type:"insert_node",path:y,node:g};t.apply(b),a=ut.next(a),p.push(b),Dn.isText(g)?m.push(y):m.push(...Array.from(hn.nodes(g),([,v])=>y.concat(v)))}},()=>{Het(t,m,g=>{let y=g;for(const b of p)if(ut.operationCanTransformPath(b)&&(y=ut.transform(y,b),!y))return null;return y})})}else for(const p of e){const m=f.concat(h);h++,t.apply({type:"insert_node",path:m,node:p}),a=ut.next(a)}if(a=ut.previous(a),c){const p=De.end(t,a);p&&wt.select(t,p)}}})},L2n=(t,e={})=>{De.withoutNormalizing(t,()=>{const{at:n=t.selection,mode:r="lowest",voids:i=!1}=e;let{match:o}=e;if(o==null&&(o=ut.isPath(n)?VS(t,n):l=>On.isElement(l)&&De.isBlock(t,l)),!n)return;const s=De.nodes(t,{at:n,match:o,mode:r,voids:i}),a=Array.from(s,([,l])=>De.pathRef(t,l));for(const l of a){const c=l.unref();if(c.length<2)throw new Error(`Cannot lift node at a path [${c}] because it has a depth of less than \`2\`.`);const u=De.node(t,ut.parent(c)),[f,h]=u,p=c[c.length-1],{length:m}=f.children;if(m===1){const g=ut.next(h);wt.moveNodes(t,{at:c,to:g,voids:i}),wt.removeNodes(t,{at:h,voids:i})}else if(p===0)wt.moveNodes(t,{at:c,to:h,voids:i});else if(p===m-1){const g=ut.next(h);wt.moveNodes(t,{at:c,to:g,voids:i})}else{const g=ut.next(c),y=ut.next(h);wt.splitNodes(t,{at:g,voids:i}),wt.moveNodes(t,{at:c,to:y,voids:i})}}})},Uet=(t,e)=>{if(On.isElement(e)){const n=e;return De.isVoid(t,e)?!0:n.children.length===1?Uet(t,n.children[0]):!1}else return!De.isEditor(e)},F2n=(t,e={})=>{De.withoutNormalizing(t,()=>{let{match:n,at:r=t.selection}=e;const{hanging:i=!1,voids:o=!1,mode:s="lowest"}=e;if(!r)return;if(n==null)if(ut.isPath(r)){const[w]=De.parent(t,r);n=_=>w.children.includes(_)}else n=w=>On.isElement(w)&&De.isBlock(t,w);if(!i&&It.isRange(r)&&(r=De.unhangRange(t,r,{voids:o})),It.isRange(r))if(It.isCollapsed(r))r=r.anchor;else{const[,w]=It.edges(r),_=De.pointRef(t,w);wt.delete(t,{at:r}),r=_.unref(),e.at==null&&wt.select(t,r)}const[a]=De.nodes(t,{at:r,match:n,voids:o,mode:s}),l=De.previous(t,{at:r,match:n,voids:o,mode:s});if(!a||!l)return;const[c,u]=a,[f,h]=l;if(u.length===0||h.length===0)return;const p=ut.next(h),m=ut.common(u,h),g=ut.isSibling(u,h),y=Array.from(De.levels(t,{at:u}),([w])=>w).slice(m.length).slice(0,-1),b=De.above(t,{at:u,mode:"highest",match:w=>y.includes(w)&&Uet(t,w)}),v=b&&De.pathRef(t,b[1]);let x,C;if(Dn.isText(c)&&Dn.isText(f)){const{text:w,..._}=c;C=f.text.length,x=_}else if(On.isElement(c)&&On.isElement(f)){const{children:w,..._}=c;C=f.children.length,x=_}else throw new Error(`Cannot merge the node at path [${u}] with the previous sibling because it is not the same kind: ${fd.stringify(c)} ${fd.stringify(f)}`);g||wt.moveNodes(t,{at:u,to:p,voids:o}),v&&wt.removeNodes(t,{at:v.current,voids:o}),De.shouldMergeNodesRemovePrevNode(t,l,a)?wt.removeNodes(t,{at:h,voids:o}):t.apply({type:"merge_node",path:p,position:C,properties:x}),v&&v.unref()})},N2n=(t,e)=>{De.withoutNormalizing(t,()=>{const{to:n,at:r=t.selection,mode:i="lowest",voids:o=!1}=e;let{match:s}=e;if(!r)return;s==null&&(s=ut.isPath(r)?VS(t,r):u=>On.isElement(u)&&De.isBlock(t,u));const a=De.pathRef(t,n),l=De.nodes(t,{at:r,match:s,mode:i,voids:o}),c=Array.from(l,([,u])=>De.pathRef(t,u));for(const u of c){const f=u.unref(),h=a.current;f.length!==0&&t.apply({type:"move_node",path:f,newPath:h}),a.current&&ut.isSibling(h,f)&&ut.isAfter(h,f)&&(a.current=ut.next(a.current))}a.unref()})},B2n=(t,e={})=>{De.withoutNormalizing(t,()=>{const{hanging:n=!1,voids:r=!1,mode:i="lowest"}=e;let{at:o=t.selection,match:s}=e;if(!o)return;s==null&&(s=ut.isPath(o)?VS(t,o):c=>On.isElement(c)&&De.isBlock(t,c)),!n&&It.isRange(o)&&(o=De.unhangRange(t,o,{voids:r}));const a=De.nodes(t,{at:o,match:s,mode:i,voids:r}),l=Array.from(a,([,c])=>De.pathRef(t,c));for(const c of l){const u=c.unref();if(u){const[f]=De.node(t,u);t.apply({type:"remove_node",path:u,node:f})}}})},V2n=(t,e,n={})=>{De.withoutNormalizing(t,()=>{let{match:r,at:i=t.selection,compare:o,merge:s}=n;const{hanging:a=!1,mode:l="lowest",split:c=!1,voids:u=!1}=n;if(i){if(r==null&&(r=ut.isPath(i)?VS(t,i):f=>On.isElement(f)&&De.isBlock(t,f)),!a&&It.isRange(i)&&(i=De.unhangRange(t,i,{voids:u})),c&&It.isRange(i)){if(It.isCollapsed(i)&&De.leaf(t,i.anchor)[0].text.length>0)return;const f=De.rangeRef(t,i,{affinity:"inward"}),[h,p]=It.edges(i),m=l==="lowest"?"lowest":"highest",g=De.isEnd(t,p,p.path);wt.splitNodes(t,{at:p,match:r,mode:m,voids:u,always:!g});const y=De.isStart(t,h,h.path);wt.splitNodes(t,{at:h,match:r,mode:m,voids:u,always:!y}),i=f.unref(),n.at==null&&wt.select(t,i)}o||(o=(f,h)=>f!==h);for(const[f,h]of De.nodes(t,{at:i,match:r,mode:l,voids:u})){const p={},m={};if(h.length===0)continue;let g=!1;for(const y in e)y==="children"||y==="text"||o(e[y],f[y])&&(g=!0,f.hasOwnProperty(y)&&(p[y]=f[y]),s?e[y]!=null&&(m[y]=s(f[y],e[y])):e[y]!=null&&(m[y]=e[y]));g&&t.apply({type:"set_node",path:h,properties:p,newProperties:m})}}})},z2n=(t,e)=>{if(It.isCollapsed(e))return e.anchor;{const[,n]=It.edges(e),r=De.pointRef(t,n);return wt.delete(t,{at:e}),r.unref()}},H2n=(t,e={})=>{De.withoutNormalizing(t,()=>{const{mode:n="lowest",voids:r=!1}=e;let{match:i,at:o=t.selection,height:s=0,always:a=!1}=e;if(i==null&&(i=u=>On.isElement(u)&&De.isBlock(t,u)),It.isRange(o)&&(o=z2n(t,o)),ut.isPath(o)){const u=o,f=De.point(t,u),[h]=De.parent(t,u);i=p=>p===h,s=f.path.length-u.length+1,o=f,a=!0}if(!o)return;const l=De.pointRef(t,o,{affinity:"backward"});let c;try{const[u]=De.nodes(t,{at:o,match:i,mode:n,voids:r});if(!u)return;const f=De.void(t,{at:o,mode:"highest"}),h=0;if(!r&&f){const[b,v]=f;if(On.isElement(b)&&t.isInline(b)){let x=De.after(t,v);if(!x){const C=t.createSpan(),w=ut.next(v);wt.insertNodes(t,C,{at:w,voids:r}),x=De.point(t,w)}o=x,a=!0}s=o.path.length-v.length+1,a=!0}c=De.pointRef(t,o);const p=o.path.length-s,[,m]=u,g=o.path.slice(0,p);let y=s===0?o.offset:o.path[p]+h;for(const[b,v]of De.levels(t,{at:g,reverse:!0,voids:r})){let x=!1;if(v.length{Array.isArray(e)||(e=[e]);const r={};for(const i of e)r[i]=null;wt.setNodes(t,r,n)},W2n=(t,e={})=>{De.withoutNormalizing(t,()=>{const{mode:n="lowest",split:r=!1,voids:i=!1}=e;let{at:o=t.selection,match:s}=e;if(!o)return;s==null&&(s=ut.isPath(o)?VS(t,o):u=>On.isElement(u)&&De.isBlock(t,u)),ut.isPath(o)&&(o=De.range(t,o));const a=It.isRange(o)?De.rangeRef(t,o):null,l=De.nodes(t,{at:o,match:s,mode:n,voids:i}),c=Array.from(l,([,u])=>De.pathRef(t,u)).reverse();for(const u of c){const f=u.unref(),[h]=De.node(t,f);let p=De.range(t,f);r&&a&&(p=It.intersection(a.current,p)),wt.liftNodes(t,{at:p,match:m=>On.isAncestor(h)&&h.children.includes(m),voids:i})}a&&a.unref()})},q2n=(t,e,n={})=>{De.withoutNormalizing(t,()=>{const{mode:r="lowest",split:i=!1,voids:o=!1}=n;let{match:s,at:a=t.selection}=n;if(!a)return;if(s==null&&(ut.isPath(a)?s=VS(t,a):t.isInline(e)?s=c=>On.isElement(c)&&De.isInline(t,c)||Dn.isText(c):s=c=>On.isElement(c)&&De.isBlock(t,c)),i&&It.isRange(a)){const[c,u]=It.edges(a),f=De.rangeRef(t,a,{affinity:"inward"}),h=p=>{const m=De.above(t,{at:p,match:g=>On.isElement(g)&&De.isBlock(t,g)});return m&&De.isEdge(t,p,m[1])};wt.splitNodes(t,{at:u,match:s,voids:o,always:!h(u)}),wt.splitNodes(t,{at:c,match:s,voids:o,always:!h(c)}),a=f.unref(),n.at==null&&wt.select(t,a)}const l=Array.from(De.nodes(t,{at:a,match:t.isInline(e)?c=>On.isElement(c)&&De.isBlock(t,c):c=>De.isEditor(c),mode:"lowest",voids:o}));for(const[,c]of l){const u=It.isRange(a)?It.intersection(a,De.range(t,c)):a;if(!u)continue;const f=Array.from(De.nodes(t,{at:u,match:s,mode:r,voids:o}));if(f.length>0){const h=f[0],p=f[f.length-1],[,m]=h,[,g]=p;if(m.length===0&&g.length===0)continue;const y=ut.equals(m,g)?ut.parent(m):ut.common(m,g),b=De.range(t,m,g),v=De.node(t,y),[x]=v,C=y.length+1,w=ut.next(g.slice(0,C)),_={...e,children:[]};wt.insertNodes(t,_,{at:w,voids:o}),wt.moveNodes(t,{at:b,match:S=>On.isAncestor(x)&&x.children.includes(S),to:w.concat(0),voids:o})}}})},G2n=(t,e={})=>{const{edge:n="anchor"}=e,{selection:r}=t;if(r){if(n==="anchor")wt.select(t,r.anchor);else if(n==="focus")wt.select(t,r.focus);else if(n==="start"){const[i]=It.edges(r);wt.select(t,i)}else if(n==="end"){const[,i]=It.edges(r);wt.select(t,i)}}else return},Y2n=t=>{const{selection:e}=t;e&&t.apply({type:"set_selection",properties:e,newProperties:null})},K2n=(t,e={})=>{const{selection:n}=t,{distance:r=1,unit:i="character",reverse:o=!1}=e;let{edge:s=null}=e;if(!n)return;s==="start"&&(s=It.isBackward(n)?"focus":"anchor"),s==="end"&&(s=It.isBackward(n)?"anchor":"focus");const{anchor:a,focus:l}=n,c={distance:r,unit:i},u={};if(s==null||s==="anchor"){const f=o?De.before(t,a,c):De.after(t,a,c);f&&(u.anchor=f)}if(s==null||s==="focus"){const f=o?De.before(t,l,c):De.after(t,l,c);f&&(u.focus=f)}wt.setSelection(t,u)},X2n=(t,e)=>{const{selection:n}=t;if(e=De.range(t,e),n){wt.setSelection(t,e);return}if(!It.isRange(e))throw new Error(`When setting the selection and the current selection is \`null\` you must provide at least an \`anchor\` and \`focus\`, but you passed: ${fd.stringify(e)}`);t.apply({type:"set_selection",properties:n,newProperties:e})},Z2n=(t,e,n={})=>{const{selection:r}=t;let{edge:i="both"}=n;if(!r)return;i==="start"&&(i=It.isBackward(r)?"focus":"anchor"),i==="end"&&(i=It.isBackward(r)?"anchor":"focus");const{anchor:o,focus:s}=r,a=i==="anchor"?o:s;wt.setSelection(t,{[i==="anchor"?"anchor":"focus"]:{...a,...e}})},Q2n=(t,e)=>{const{selection:n}=t,r={},i={};if(n){for(const o in e)(o==="anchor"&&e.anchor!=null&&!gi.equals(e.anchor,n.anchor)||o==="focus"&&e.focus!=null&&!gi.equals(e.focus,n.focus)||o!=="anchor"&&o!=="focus"&&e[o]!==n[o])&&(r[o]=n[o],i[o]=e[o]);Object.keys(r).length>0&&t.apply({type:"set_selection",properties:r,newProperties:i})}},OI=(t,e={})=>{De.withoutNormalizing(t,()=>{const{reverse:n=!1,unit:r="character",distance:i=1,voids:o=!1}=e;let{at:s=t.selection,hanging:a=!1}=e;if(!s)return;let l=!1;if(It.isRange(s)&&It.isCollapsed(s)&&(l=!0,s=s.anchor),gi.isPoint(s)){const j=De.void(t,{at:s,mode:"highest"});if(!o&&j){const[,A]=j;s=A}else{const A={unit:r,distance:i},D=n?De.before(t,s,A)||De.start(t,[]):De.after(t,s,A)||De.end(t,[]);s={anchor:s,focus:D},a=!0}}if(ut.isPath(s)){wt.removeNodes(t,{at:s,voids:o});return}if(It.isCollapsed(s))return;if(!a){const[,j]=It.edges(s),A=De.end(t,[]);gi.equals(j,A)||(s=De.unhangRange(t,s,{voids:o}))}let[c,u]=It.edges(s);const f=De.above(t,{match:j=>On.isElement(j)&&De.isBlock(t,j),at:c,voids:o}),h=De.above(t,{match:j=>On.isElement(j)&&De.isBlock(t,j),at:u,voids:o}),p=f&&h&&!ut.equals(f[1],h[1]),m=ut.equals(c.path,u.path),g=o?null:De.void(t,{at:c,mode:"highest"})??De.elementReadOnly(t,{at:c,mode:"highest"}),y=o?null:De.void(t,{at:u,mode:"highest"})??De.elementReadOnly(t,{at:u,mode:"highest"});if(g){const j=De.before(t,c);j&&f&&ut.isAncestor(f[1],j.path)&&(c=j)}if(y){const j=De.after(t,u);j&&h&&ut.isAncestor(h[1],j.path)&&(u=j)}const b=[];let v;for(const j of De.nodes(t,{at:s,voids:o})){const[A,D]=j;v&&ut.compare(D,v)===0||(!o&&On.isElement(A)&&(De.isVoid(t,A)||De.isElementReadOnly(t,A))||!ut.isCommon(D,c.path)&&!ut.isCommon(D,u.path))&&(b.push(j),v=D)}const x=Array.from(b,([,j])=>De.pathRef(t,j)),C=De.pointRef(t,c),w=De.pointRef(t,u);let _="";if(!m&&!g){const j=C.current,[A]=De.leaf(t,j),{path:D}=j,{offset:O}=c,P=A.text.slice(O);P.length>0&&(t.apply({type:"remove_text",path:D,offset:O,text:P}),_=P)}if(x.reverse().map(j=>j.unref()).filter(j=>j!==null).forEach(j=>{wt.removeNodes(t,{at:j,voids:o})}),!y){const j=w.current,[A]=De.leaf(t,j),{path:D}=j,O=m?c.offset:0,P=A.text.slice(O,u.offset);P.length>0&&(t.apply({type:"remove_text",path:D,offset:O,text:P}),_=P)}!m&&p&&w.current&&C.current&&wt.mergeNodes(t,{at:w.current,hanging:!0,voids:o}),l&&n&&r==="character"&&_.length>1&&_.match(/[\u0980-\u09FF\u0E00-\u0E7F\u1000-\u109F\u0900-\u097F\u1780-\u17FF\u0D00-\u0D7F\u0B00-\u0B7F\u0A00-\u0A7F\u0B80-\u0BFF\u0C00-\u0C7F]+/)&&wt.insertText(t,_.slice(0,_.length-i));const S=C.unref(),k=w.unref(),I=n?S||k:k||S;e.at==null&&I&&wt.select(t,I)})},J2n=(t,e,n={})=>{De.withoutNormalizing(t,()=>{const{hanging:r=!1,voids:i=!1}=n;let{at:o=o2e(t),batchDirty:s=!0}=n;if(!e.length)return;if(It.isRange(o))if(r||(o=De.unhangRange(t,o,{voids:i})),It.isCollapsed(o))o=o.anchor;else{const[,D]=It.edges(o);if(!i&&De.void(t,{at:D}))return;const O=De.pointRef(t,D);wt.delete(t,{at:o}),o=O.unref()}else ut.isPath(o)&&(o=De.start(t,o));if(!i&&De.void(t,{at:o}))return;const a=De.above(t,{at:o,match:D=>On.isElement(D)&&De.isInline(t,D),mode:"highest",voids:i});if(a){const[,D]=a;De.isEnd(t,o,D)?o=De.after(t,D):De.isStart(t,o,D)&&(o=De.before(t,D))}const l=De.above(t,{match:D=>On.isElement(D)&&De.isBlock(t,D),at:o,voids:i}),[,c]=l,u=De.isStart(t,o,c),f=De.isEnd(t,o,c),h=u&&f,[,p]=hn.first({children:e},[]),[,m]=hn.last({children:e},[]),g=([D,O])=>O.length===0?!1:h?!0:!(!u&&ut.isAncestor(O,p)&&On.isElement(D)&&!t.isVoid(D)&&!t.isInline(D)||!f&&ut.isAncestor(O,m)&&On.isElement(D)&&!t.isVoid(D)&&!t.isInline(D));let y=!0;const b=[],v=[],x=[];for(const D of hn.nodes({children:e},{pass:g})){const[O,P]=D;y&&On.isElement(O)&&!t.isInline(O)&&!ut.isAncestor(P,p)&&(y=!1),g(D)&&(On.isElement(O)&&!t.isInline(O)?(y=!1,v.push(O)):y?b.push(O):x.push(O))}const C=Array.from(De.nodes(t,{at:o,match:D=>Dn.isText(D)||De.isInline(t,D),mode:"highest",voids:i}))[0],[,w]=C,_=De.isStart(t,o,w),S=De.isEnd(t,o,w),k=De.pathRef(t,f&&!x.length?ut.next(c):c),I=De.pathRef(t,S?ut.next(w):w),j=x.length>0;wt.splitNodes(t,{at:o,match:D=>j?On.isElement(D)&&De.isBlock(t,D):Dn.isText(D)||De.isInline(t,D),mode:j?"lowest":"highest",always:j&&(!u||b.length>0)&&(!f||x.length>0),voids:i});const A=De.pathRef(t,!_||_&&S?ut.next(w):w);if(wt.insertNodes(t,b,{at:A.current,match:D=>Dn.isText(D)||De.isInline(t,D),mode:"highest",voids:i,batchDirty:s}),h&&!b.length&&v.length&&!x.length&&wt.delete(t,{at:c,voids:i}),wt.insertNodes(t,v,{at:k.current,match:D=>On.isElement(D)&&De.isBlock(t,D),mode:"lowest",voids:i,batchDirty:s}),wt.insertNodes(t,x,{at:I.current,match:D=>Dn.isText(D)||De.isInline(t,D),mode:"highest",voids:i,batchDirty:s}),!n.at){let D;if(x.length>0&&I.current?D=ut.previous(I.current):v.length>0&&k.current?D=ut.previous(k.current):A.current&&(D=ut.previous(A.current)),D){const O=De.end(t,D);wt.select(t,O)}}A.unref(),k.unref(),I.unref()})},ehn=t=>{const e={children:[],operations:[],selection:null,marks:null,createSpan:()=>({_type:t.schema.span.name,_key:t.keyGenerator(),text:"",marks:[]}),isElementReadOnly:()=>!1,isInline:()=>!1,isSelectable:()=>!0,isVoid:()=>!1,markableVoid:()=>!1,onChange:()=>{},apply:(...n)=>Rfn(e,...n),addMark:(...n)=>Lfn(e,...n),deleteBackward:(...n)=>Bfn(e,...n),deleteForward:(...n)=>Vfn(e,...n),deleteFragment:(...n)=>zfn(e,...n),getFragment:(...n)=>Ofn(e,...n),insertBreak:(...n)=>Jfn(e,...n),insertSoftBreak:(...n)=>t2n(e,...n),insertFragment:(...n)=>J2n(e,...n),insertNode:(...n)=>e2n(e,...n),insertText:(...n)=>n2n(e,...n),normalizeNode:(...n)=>Pfn(e,...n),removeMark:(...n)=>j2n(e,...n),getDirtyPaths:(...n)=>Dfn(e,...n),shouldNormalize:(...n)=>$fn(e,...n),above:(...n)=>Mfn(e,...n),after:(...n)=>Ffn(e,...n),before:(...n)=>Nfn(e,...n),collapse:(...n)=>G2n(e,...n),delete:(...n)=>OI(e,...n),deselect:(...n)=>Y2n(e,...n),edges:(...n)=>Hfn(e,...n),elementReadOnly:(...n)=>Ufn(e,...n),end:(...n)=>Wfn(e,...n),first:(...n)=>qfn(e,...n),fragment:(...n)=>Gfn(e,...n),getMarks:(...n)=>f2n(e,...n),hasBlocks:(...n)=>Kfn(e,...n),hasInlines:(...n)=>Xfn(e,...n),hasPath:(...n)=>Zfn(e,...n),hasTexts:(...n)=>Qfn(e,...n),insertNodes:(...n)=>M2n(e,...n),isBlock:(...n)=>r2n(e,...n),isEdge:(...n)=>i2n(e,...n),isEmpty:(...n)=>o2n(e,...n),isEnd:(...n)=>s2n(e,...n),isNormalizing:(...n)=>a2n(e,...n),isStart:(...n)=>l2n(e,...n),last:(...n)=>c2n(e,...n),leaf:(...n)=>u2n(e,...n),levels:(...n)=>d2n(e,...n),liftNodes:(...n)=>L2n(e,...n),mergeNodes:(...n)=>F2n(e,...n),move:(...n)=>K2n(e,...n),moveNodes:(...n)=>N2n(e,...n),next:(...n)=>h2n(e,...n),node:(...n)=>p2n(e,...n),nodes:(...n)=>m2n(e,...n),normalize:(...n)=>g2n(e,...n),parent:(...n)=>y2n(e,...n),path:(...n)=>x2n(e,...n),pathRef:(...n)=>b2n(e,...n),pathRefs:(...n)=>v2n(e,...n),point:(...n)=>_2n(e,...n),pointRef:(...n)=>C2n(e,...n),pointRefs:(...n)=>w2n(e,...n),positions:(...n)=>S2n(e,...n),previous:(...n)=>k2n(e,...n),range:(...n)=>I2n(e,...n),rangeRef:(...n)=>E2n(e,...n),rangeRefs:(...n)=>T2n(e,...n),removeNodes:(...n)=>B2n(e,...n),select:(...n)=>X2n(e,...n),setNodes:(...n)=>V2n(e,...n),setNormalizing:(...n)=>A2n(e,...n),setPoint:(...n)=>Z2n(e,...n),setSelection:(...n)=>Q2n(e,...n),splitNodes:(...n)=>H2n(e,...n),start:(...n)=>R2n(e,...n),string:(...n)=>D2n(e,...n),unhangRange:(...n)=>O2n(e,...n),unsetNodes:(...n)=>U2n(e,...n),unwrapNodes:(...n)=>W2n(e,...n),void:(...n)=>Yfn(e,...n),withoutNormalizing:(...n)=>P2n(e,...n),wrapNodes:(...n)=>q2n(e,...n),shouldMergeNodesRemovePrevNode:(...n)=>$2n(e,...n)};return e},thn=globalThis.Text,c2e=t=>t&&t.ownerDocument&&t.ownerDocument.defaultView||null,nhn=t=>P7(t)&&t.nodeType===8,Ip=t=>P7(t)&&t.nodeType===1,P7=t=>{const e=c2e(t);return!!e&&t instanceof e.Node},Yoe=t=>{const e=t&&t.anchorNode&&c2e(t.anchorNode);return!!e&&t instanceof e.Selection},Wet=t=>P7(t)&&t.nodeType===3,rhn=t=>t.clipboardData&&t.clipboardData.getData("text/plain")!==""&&t.clipboardData.types.length===1,ihn=t=>{let[e,n]=t;if(Ip(e)&&e.childNodes.length){let r=n===e.childNodes.length,i=r?n-1:n;for([e,i]=qet(e,i,r?"backward":"forward"),r=i{let e=t&&t.parentNode;for(;e;){if(e.toString()==="[object ShadowRoot]")return!0;e=e.parentNode}return!1},qet=(t,e,n)=>{const{childNodes:r}=t;let i=r[e],o=e,s=!1,a=!1;for(;(nhn(i)||Ip(i)&&i.childNodes.length===0||Ip(i)&&i.getAttribute("contenteditable")==="false")&&!(s&&a);){if(o>=r.length){s=!0,o=e-1,n="backward";continue}if(o<0){a=!0,o=e+1,n="forward";continue}i=r[o],e=o,o+=n==="forward"?1:-1}return[i,e]},shn=(t,e,n)=>{const[r]=qet(t,e,n);return r},Get=t=>{let e="";if(Wet(t)&&t.nodeValue)return t.nodeValue;if(Ip(t)){for(const r of Array.from(t.childNodes))e+=Get(r);const n=getComputedStyle(t).getPropertyValue("display");(n==="block"||n==="list"||t.tagName==="BR")&&(e+=` +`)}return e},ahn=/data-slate-fragment="(.+?)"/m,lhn=t=>{const e=t.getData("text/html"),[,n]=e.match(ahn)||[];return n},PI=t=>"getSelection"in t&&typeof t.getSelection=="function"?t.getSelection():document.getSelection(),u2e=(t,e,n)=>{const{target:r}=e;if(Ip(r)&&r.matches('[contentEditable="false"]'))return!1;const{document:i}=Zr.getWindow(t);if(i9(i,r))return Zr.hasDOMNode(t,r,{editable:!0});const o=n.find(({addedNodes:s,removedNodes:a})=>{for(const l of s)if(l===r||i9(l,r))return!0;for(const l of a)if(l===r||i9(l,r))return!0;return!1});return!o||o===e?!1:u2e(t,o,n)},chn=()=>{let t=document.activeElement;for(;t?.shadowRoot&&t.shadowRoot?.activeElement;)t=t?.shadowRoot?.activeElement;return t},ZSe=(t,e)=>!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING),uhn=(t,e)=>!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING),QSe=(t,e)=>{if(!t)return null;let n=t;for(;n;){if(n.matches&&n.matches(e))return n;if(n.parentElement)n=n.parentElement;else if(n.parentNode&&"host"in n.parentNode)n=n.parentNode.host;else return null}return null},i9=(t,e)=>{if(!t||!e)return!1;if(t.contains(e))return!0;let n=e;for(;n;){if(n===t)return!0;if(n.parentNode)"host"in n.parentNode?n=n.parentNode.host:n=n.parentNode;else return!1}return!1},dhn=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,JSe=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),z1=typeof navigator<"u"&&/Android/.test(navigator.userAgent),GC=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_b=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),fhn=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),d2e=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Yet=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),hhn=z1&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),phn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),mhn=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),ghn=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent)&&(!d2e||Yet),rL=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&/Version\/(\\d+)/.test(navigator.userAgent)&&navigator.userAgent.match(/Version\/(\\d+)/)?.[1]&&parseInt(navigator.userAgent.match(/Version\/(\\d+)/)?.[1],10)<17;const S4=(!Yet||!hhn)&&!fhn&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function";let yhn=0,Ket=class{constructor(){this.id=`${yhn++}`}};const _w=new WeakMap,YC=new WeakMap,$I=new WeakMap,Xet=new WeakMap,MI=new WeakMap,Koe=new WeakMap,qj=new WeakMap,o9=new WeakMap,DN=new WeakMap,TH=new WeakMap,ON=new WeakMap,Q5=new WeakMap,Vb=new WeakMap,LI=new WeakMap,Xoe=new WeakMap,f2e=new WeakMap,i0=new WeakMap,l7=new WeakMap,y2=new WeakMap,$4=new WeakMap,Km=new WeakMap,Zet=new WeakMap,C_=Symbol("placeholder"),Qet=Symbol("mark-placeholder"),Zr={androidPendingDiffs:t=>y2.get(t),androidScheduleFlush:t=>{f2e.get(t)?.()},blur:t=>{const e=Zr.toDOMNode(t,t),n=Zr.findDocumentOrShadowRoot(t);Q5.set(t,!1),n.activeElement===e&&e.blur()},deselect:t=>{const{selection:e}=t,n=Zr.findDocumentOrShadowRoot(t),r=PI(n);r&&r.rangeCount>0&&r.removeAllRanges(),e&&wt.deselect(t)},findDocumentOrShadowRoot:t=>{const e=Zr.toDOMNode(t,t),n=e.getRootNode();return n instanceof Document||n instanceof ShadowRoot?n:e.ownerDocument},findEventRange:(t,e)=>{"nativeEvent"in e&&(e=e.nativeEvent);const{clientX:n,clientY:r,target:i}=e;if(n==null||r==null)throw new Error(`Cannot resolve a Slate range from a DOM event: ${e}`);const o=Zr.toSlateNode(t,e.target),s=Zr.findPath(t,o);if(On.isElement(o)&&De.isVoid(t,o)){const c=i.getBoundingClientRect(),u=t.isInline(o)?n-c.left{let n=DN.get(e);return n||(n=new Ket,DN.set(e,n)),n},findPath:(t,e)=>{const n=[];let r=e;for(;;){const i=$I.get(r);if(i==null){if(De.isEditor(r))return n;break}const o=YC.get(r);if(o==null)break;n.unshift(o),r=i}throw new Error(`Unable to find the path for Slate node: ${fd.stringify(e)}`)},focus:(t,e={retries:5})=>{if(Q5.get(t)||!MI.get(t))return;if(e.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{Zr.focus(t,{retries:e.retries-1})},10);return}const n=Zr.toDOMNode(t,t),r=Zr.findDocumentOrShadowRoot(t);if(r.activeElement!==n){if(t.selection&&r instanceof Document){const i=PI(r),o=Zr.toDOMRange(t,t.selection);i?.removeAllRanges(),i?.addRange(o)}t.selection||wt.select(t,De.start(t,[])),Q5.set(t,!0),n.focus({preventScroll:!0})}},getWindow:t=>{const e=Xet.get(t);if(!e)throw new Error("Unable to find a host window element for this editor");return e},hasDOMNode:(t,e,n={})=>{const{editable:r=!1}=n,i=Zr.toDOMNode(t,t);let o=null;try{o=Ip(e)?e:e.parentElement}catch(s){if(s instanceof Error&&!s.message.includes('Permission denied to access property "nodeType"'))throw s}return o?QSe(o,"[data-slate-editor]")===i&&(!r||o.isContentEditable?!0:typeof o.isContentEditable=="boolean"&&QSe(o,'[contenteditable="false"]')===i||!!o.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(t,e)=>P7(e)&&Zr.hasDOMNode(t,e,{editable:!0}),hasRange:(t,e)=>{const{anchor:n,focus:r}=e;return De.hasPath(t,n.path)&&De.hasPath(t,r.path)},hasSelectableTarget:(t,e)=>Zr.hasEditableTarget(t,e)||Zr.isTargetInsideNonReadonlyVoid(t,e),hasTarget:(t,e)=>P7(e)&&Zr.hasDOMNode(t,e),insertData:(t,e)=>{t.insertData(e)},insertFragmentData:(t,e)=>t.insertFragmentData(e),insertTextData:(t,e)=>t.insertTextData(e),isComposing:t=>!!Vb.get(t),isFocused:t=>!!Q5.get(t),isReadOnly:t=>!!ON.get(t),isTargetInsideNonReadonlyVoid:(t,e)=>{if(ON.get(t))return!1;const n=Zr.hasTarget(t,e)&&Zr.toSlateNode(t,e);return On.isElement(n)&&De.isVoid(t,n)},setFragmentData:(t,e,n)=>t.setFragmentData(e,n),toDOMNode:(t,e)=>{const n=TH.get(t),r=De.isEditor(e)?MI.get(t):n?.get(Zr.findKey(t,e));if(!r)throw new Error(`Cannot resolve a DOM node from Slate node: ${fd.stringify(e)}`);return r},toDOMPoint:(t,e)=>{const[n]=De.node(t,e.path),r=Zr.toDOMNode(t,n);let i;De.void(t,{at:e})&&(e={path:e.path,offset:0});const o=Array.from(r.querySelectorAll("[data-slate-string], [data-slate-zero-width]"));let s=0;for(let a=0;a{const{anchor:n,focus:r}=e,i=It.isBackward(e),o=Zr.toDOMPoint(t,n),s=It.isCollapsed(e)?o:Zr.toDOMPoint(t,r),a=Zr.getWindow(t).document.createRange(),[l,c]=i?s:o,[u,f]=i?o:s,h=!!(Ip(l)?l:l.parentElement).getAttribute("data-slate-zero-width"),p=!!(Ip(u)?u:u.parentElement).getAttribute("data-slate-zero-width");return a.setStart(l,h?1:c),a.setEnd(u,p?1:f),a},toSlateNode:(t,e)=>{let n=Ip(e)?e:e.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));const r=n?qj.get(n):null;if(!r)throw new Error(`Cannot resolve a Slate node from DOM node: ${n}`);return r},toSlatePoint:(t,e,n)=>{const{exactMatch:r,suppressThrow:i,searchDirection:o}=n,[s,a]=r?e:ihn(e),l=s.parentNode;let c=null,u=0;if(l){const h=Zr.toDOMNode(t,t),p=l.closest('[data-slate-void="true"]'),m=p&&i9(h,p)?p:null,g=l.closest('[contenteditable="false"]'),y=g&&i9(h,g)?g:null;let b=l.closest("[data-slate-leaf]"),v=null;if(b){if(c=b.closest('[data-slate-node="text"]'),c){const x=Zr.getWindow(t).document.createRange();x.setStart(c,0),x.setEnd(s,a);const C=x.cloneContents();[...Array.prototype.slice.call(C.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(C.querySelectorAll("[contenteditable=false]"))].forEach(w=>{if(z1&&!r&&w.hasAttribute("data-slate-zero-width")&&w.textContent.length>0&&w.textContext!=="\uFEFF"){w.textContent.startsWith("\uFEFF")&&(w.textContent=w.textContent.slice(1));return}w.parentNode.removeChild(w)}),u=C.textContent.length,v=c}}else if(m){const x=m.querySelectorAll("[data-slate-leaf]");for(let C=0;C{u-=C.textContent.length})):u=1}else if(y){const x=w=>w?w.querySelectorAll("[data-slate-leaf]:not(:scope [data-slate-editor] [data-slate-leaf])"):[],C=y.closest('[data-slate-node="element"]');(o==="backward"||!o)&&(b=[...x(C?.previousElementSibling),...x(C)].findLast(w=>ZSe(y,w))??null),(o==="forward"||!o)&&(b=[...x(C),...x(C?.nextElementSibling)].find(w=>uhn(y,w))??null),b&&(c=b.closest('[data-slate-node="text"]'),v=b,o==="forward"?u=0:(u=v.textContent.length,v.querySelectorAll("[data-slate-zero-width]").forEach(w=>{u-=w.textContent.length})))}v&&u===v.textContent.length&&z1&&v.getAttribute("data-slate-zero-width")==="z"&&v.textContent?.startsWith("\uFEFF")&&(l.hasAttribute("data-slate-zero-width")||GC&&v.textContent?.endsWith(` + +`))&&u--}if(z1&&!c&&!r){const h=l.hasAttribute("data-slate-node")?l:l.closest("[data-slate-node]");if(h&&Zr.hasDOMNode(t,h,{editable:!0})){const p=Zr.toSlateNode(t,h);let{path:m,offset:g}=De.start(t,Zr.findPath(t,p));return h.querySelector("[data-slate-leaf]")||(g=a),{path:m,offset:g}}}if(!c){if(i)return null;throw new Error(`Cannot resolve a Slate point from DOM point: ${e}`)}const f=Zr.toSlateNode(t,c);return{path:Zr.findPath(t,f),offset:u}},toSlateRange:(t,e,n)=>{const{exactMatch:r,suppressThrow:i}=n,o=Yoe(e)?e.anchorNode:e.startContainer;let s=null,a=0,l=null,c=0,u=!1;if(o)if(Yoe(e)){if(GC&&e.rangeCount>1){l=e.focusNode;const g=e.getRangeAt(0),y=e.getRangeAt(e.rangeCount-1);if(l instanceof HTMLTableRowElement&&g.startContainer instanceof HTMLTableRowElement&&y.startContainer instanceof HTMLTableRowElement){let b=function(_){return _.childElementCount>0?b(_.children[0]):_};const v=g.startContainer,x=y.startContainer,C=b(v.children[g.startOffset]),w=b(x.children[y.startOffset]);c=0,w.childNodes.length>0?s=w.childNodes[0]??null:s=w,C.childNodes.length>0?l=C.childNodes[0]??null:l=C,w instanceof HTMLElement?a=w.innerHTML.length:a=0}else g.startContainer===l?(s=y.endContainer,a=y.endOffset,c=g.startOffset):(s=g.startContainer,a=g.endOffset,c=y.startOffset)}else s=e.anchorNode,a=e.anchorOffset,l=e.focusNode,c=e.focusOffset;d2e&&ohn(s)||GC?u=e.anchorNode===e.focusNode&&e.anchorOffset===e.focusOffset:u=e.isCollapsed}else s=e.startContainer,a=e.startOffset,l=e.endContainer,c=e.endOffset,u=e.collapsed;if(s==null||l==null||a==null||c==null)throw new Error(`Cannot resolve a Slate range from DOM range: ${e}`);GC&&l.textContent?.endsWith(` + +`)&&c===l.textContent.length&&c--;const f=Zr.toSlatePoint(t,[s,a],{exactMatch:r,suppressThrow:i});if(!f)return null;const h=ZSe(s,l)||s===l&&cn.slice(0,r.start)+r.text+n.slice(r.end),t)}function vhn(t,e){const n=Math.min(t.length,e.length);for(let r=0;rn.start?n.text.length:0)-i),a=o.slice(r,s),l=Math.max(e.end,n.end-e.text.length+(e.end-e.start));return ett(t,{start:r,end:l,text:a})}function whn(t){const{path:e,diff:n}=t;return{anchor:{path:e,offset:n.start},focus:{path:e,offset:n.end}}}function Zoe(t,e){let{path:n,offset:r}=e;if(!De.hasPath(t,n))return null;let i=hn.get(t,n);if(!Dn.isText(i))return null;const o=De.above(t,{match:s=>On.isElement(s)&&De.isBlock(t,s),at:n});if(!o)return null;for(;r>i.text.length;){const s=De.next(t,{at:n,match:Dn.isText});if(!s||!ut.isDescendant(s[1],o[1]))return null;r-=i.text.length,i=s[0],n=s[1]}return{path:n,offset:r}}function eke(t,e){const n=Zoe(t,e.anchor);if(!n)return null;if(It.isCollapsed(e))return{anchor:n,focus:n};const r=Zoe(t,e.focus);return r?{anchor:n,focus:r}:null}function Qoe(t,e,n){const r=y2.get(t)?.find(({path:a})=>ut.equals(a,e.path));if(!r||e.offset<=r.diff.start)return gi.transform(e,n,{affinity:"backward"});const{diff:i}=r;if(e.offset<=i.start+i.text.length){const a={path:e.path,offset:i.start},l=gi.transform(a,n,{affinity:"backward"});return l?{path:l.path,offset:l.offset+e.offset-i.start}:null}const o={path:e.path,offset:e.offset-i.text.length+i.end-i.start},s=gi.transform(o,n,{affinity:"backward"});return s?n.type==="split_node"&&ut.equals(n.path,e.path)&&o.offset=r.end?t:e.offset<=r.start?{diff:{start:e.text.length+r.start,end:e.text.length+r.end,text:r.text},id:i,path:n}:{diff:{start:r.start,end:r.end+e.text.length,text:r.text},id:i,path:n};case"remove_text":return!ut.equals(e.path,n)||e.offset>=r.end?t:e.offset+e.text.length<=r.start?{diff:{start:r.start-e.text.length,end:r.end-e.text.length,text:r.text},id:i,path:n}:{diff:{start:r.start,end:r.end-e.text.length,text:r.text},id:i,path:n};case"split_node":return!ut.equals(e.path,n)||e.position>=r.end?{diff:r,id:i,path:ut.transform(n,e,{affinity:"backward"})}:e.position>r.start?{diff:{start:r.start,end:Math.min(e.position,r.end),text:r.text},id:i,path:n}:{diff:{start:r.start-e.position,end:r.end-e.position,text:r.text},id:i,path:ut.transform(n,e,{affinity:"forward"})};case"merge_node":return ut.equals(e.path,n)?{diff:{start:r.start+e.position,end:r.end+e.position,text:r.text},id:i,path:ut.transform(n,e)}:{diff:r,id:i,path:ut.transform(n,e)}}const o=ut.transform(n,e);return o?{diff:r,path:o,id:i}:null}const nke=(t,e)=>{const n=(e.top+e.bottom)/2;return t.top<=n&&t.bottom>=n},rke=(t,e,n)=>{const r=Zr.toDOMRange(t,e).getBoundingClientRect(),i=Zr.toDOMRange(t,n).getBoundingClientRect();return nke(r,i)&&nke(i,r)},Shn=(t,e)=>{const n=De.range(t,It.end(e)),r=Array.from(De.positions(t,{at:e}));let i=0,o=r.length,s=Math.floor(o/2);if(rke(t,De.range(t,r[i]),n))return De.range(t,r[i],n);if(r.length<2)return De.range(t,r[r.length-1],n);for(;s!==r.length&&s!==i;)rke(t,De.range(t,r[s]),n)?o=s:i=s,s=Math.floor((i+o)/2);return De.range(t,r[i],n)},khn=(t,e="x-slate-fragment")=>{const n=t,{apply:r,onChange:i,deleteBackward:o,addMark:s,removeMark:a}=n;return TH.set(n,new WeakMap),n.addMark=(l,c)=>{f2e.get(n)?.(),!i0.get(n)&&y2.get(n)?.length&&i0.set(n,null),l7.delete(n),s(l,c)},n.removeMark=l=>{!i0.get(n)&&y2.get(n)?.length&&i0.set(n,null),l7.delete(n),a(l)},n.deleteBackward=l=>{if(l!=="line")return o(l);if(n.selection&&It.isCollapsed(n.selection)){const c=De.above(n,{match:u=>On.isElement(u)&&De.isBlock(n,u),at:n.selection});if(c){const[,u]=c,f=De.range(n,u,n.selection.anchor),h=Shn(n,f);It.isCollapsed(h)||wt.delete(n,{at:h})}}},n.apply=l=>{const c=[],u=[],f=y2.get(n);if(f?.length){const m=f.map(g=>_hn(g,l)).filter(Boolean);y2.set(n,m)}const h=Km.get(n);h&&Km.set(n,tke(n,h,l));const p=$4.get(n);if(p?.at){const m=gi.isPoint(p?.at)?Qoe(n,p.at,l):tke(n,p.at,l);$4.set(n,m?{...p,at:m}:null)}switch(l.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...Gx(n,l.path));break}case"set_selection":{LI.get(n)?.unref(),LI.delete(n);break}case"insert_node":case"remove_node":{c.push(...Gx(n,ut.parent(l.path)));break}case"merge_node":{const m=ut.previous(l.path);c.push(...Gx(n,m));break}case"move_node":{const m=ut.common(ut.parent(l.path),ut.parent(l.newPath));c.push(...Gx(n,m));let g;ut.isBefore(l.path,l.newPath)?(c.push(...Gx(n,ut.parent(l.path))),g=l.newPath):(c.push(...Gx(n,ut.parent(l.newPath))),g=l.path);const y=hn.get(t,ut.parent(g)),b=Zr.findKey(n,y),v=De.pathRef(n,ut.parent(g));u.push([v,b]);break}}switch(r(l),l.type){case"insert_node":case"remove_node":case"merge_node":case"move_node":case"split_node":case"insert_text":case"remove_text":case"set_selection":_w.set(n,!0)}for(const[m,g]of c){const[y]=De.node(n,m);DN.set(y,g)}for(const[m,g]of u){if(m.current){const[y]=De.node(n,m.current);DN.set(y,g)}m.unref()}},n.setFragmentData=l=>{const{selection:c}=n;if(!c)return;const[u,f]=It.edges(c),h=De.void(n,{at:u.path}),p=De.void(n,{at:f.path});if(It.isCollapsed(c)&&!h)return;const m=Zr.toDOMRange(n,c);let g=m.cloneContents(),y=g.childNodes[0];if(g.childNodes.forEach(w=>{w.textContent&&w.textContent.trim()!==""&&(y=w)}),p){const[w]=p,_=m.cloneRange(),S=Zr.toDOMNode(n,w);_.setEndAfter(S),g=_.cloneContents()}if(h&&(y=g.querySelector("[data-slate-spacer]")),Array.from(g.querySelectorAll("[data-slate-zero-width]")).forEach(w=>{const _=w.getAttribute("data-slate-zero-width")==="n";w.textContent=_?` +`:""}),Wet(y)){const w=y.ownerDocument.createElement("span");w.style.whiteSpace="pre",w.appendChild(y),g.appendChild(w),y=w}const b=n.getFragment(),v=JSON.stringify(b),x=window.btoa(encodeURIComponent(v));y.setAttribute("data-slate-fragment",x),l.setData(`application/${e}`,x);const C=g.ownerDocument.createElement("div");return C.appendChild(g),C.setAttribute("hidden","true"),g.ownerDocument.body.appendChild(C),l.setData("text/html",C.innerHTML),l.setData("text/plain",Get(C)),g.ownerDocument.body.removeChild(C),l},n.insertData=l=>{n.insertFragmentData(l)||n.insertTextData(l)},n.insertFragmentData=l=>{const c=l.getData(`application/${e}`)||lhn(l);if(c){const u=decodeURIComponent(window.atob(c)),f=JSON.parse(u);return n.insertFragment(f),!0}return!1},n.insertTextData=l=>{const c=l.getData("text/plain");if(c){const u=c.split(/\r\n|\r|\n/);let f=!1;for(const h of u)f&&wt.splitNodes(n,{always:!0}),n.insertText(h),f=!0;return!0}return!1},n.onChange=l=>{const c=Xoe.get(n);c&&c(l),i(l)},n},Gx=(t,e)=>{const n=[];for(const[r,i]of De.levels(t,{at:e})){const o=Zr.findKey(t,r);n.push([i,o])}return n},Ehn=3,Thn={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",insertSoftBreak:"shift+enter",splitBlock:"enter",undo:"mod+z"},Ihn={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},jhn={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Jl=t=>{const e=Thn[t],n=Ihn[t],r=jhn[t],i=e&&OZ.isHotkey(e),o=n&&OZ.isHotkey(n),s=r&&OZ.isHotkey(r);return a=>!!(i&&i(a)||JSe&&o&&o(a)||!JSe&&s&&s(a))};var pc={isBold:Jl("bold"),isCompose:Jl("compose"),isMoveBackward:Jl("moveBackward"),isMoveForward:Jl("moveForward"),isDeleteBackward:Jl("deleteBackward"),isDeleteForward:Jl("deleteForward"),isDeleteLineBackward:Jl("deleteLineBackward"),isDeleteLineForward:Jl("deleteLineForward"),isDeleteWordBackward:Jl("deleteWordBackward"),isDeleteWordForward:Jl("deleteWordForward"),isExtendBackward:Jl("extendBackward"),isExtendForward:Jl("extendForward"),isExtendLineBackward:Jl("extendLineBackward"),isExtendLineForward:Jl("extendLineForward"),isItalic:Jl("italic"),isMoveLineBackward:Jl("moveLineBackward"),isMoveLineForward:Jl("moveLineForward"),isMoveWordBackward:Jl("moveWordBackward"),isMoveWordForward:Jl("moveWordForward"),isRedo:Jl("redo"),isSoftBreak:Jl("insertSoftBreak"),isSplitBlock:Jl("splitBlock"),isTransposeCharacter:Jl("transposeCharacter"),isUndo:Jl("undo")};const Ahn=(t,e)=>Object.keys(t).length===Object.keys(e).length&&Object.keys(t).every(n=>e.hasOwnProperty(n)&&t[n]===e[n]),ttt=(t,e)=>{const{anchor:n,focus:r,...i}=t,{anchor:o,focus:s,...a}=e;return t[C_]===e[C_]&&Ahn(i,a)},h2e=(t,e)=>{if(t===e)return!0;if(!t||!e||t.length!==e.length)return!1;for(let n=0;n{if(t===e)return!0;if(!t||!e||t.length!==e.length)return!1;for(let n=0;n{const r=Array.from(e.children,()=>[]);if(n.length===0)return r;const i=Zr.findPath(t,e),o=i.length,s=De.range(t,i),a=new Array(e.children.length),l=c=>{const u=a[c];if(u)return u;const f=De.range(t,[...i,c]);return a[c]=f,f};for(const c of n){const u=It.intersection(s,c);if(!u)continue;const[f,h]=It.edges(u),p=f.path[o],m=h.path[o];for(let g=p;g<=m;g++){const y=r[g];if(!y)continue;const b=l(g),v=It.intersection(b,c);v&&y.push({...c,...v})}}return r};function iL(t,e,n){if(!e||!n)return e===n;if(e.length!==n.length)return!1;for(let r=0;r!n.includes(o)),i=Object.keys(e).filter(o=>!n.includes(o));if(r.length!==i.length)return!1;for(const o of r){if(!(o in t)||!(o in e))return!1;const s=t[o],a=e[o];if(s!==a&&!m2e(s,a))return!1}return!0}function Ohn(t,e){return t._key!==e._key||t._type!==e._type?!1:IH(t,e,["_key","_type"])}function p2e(t,e){if(!t||!e)return t===e;if(t.length!==e.length)return!1;for(let n=0;n"u",l=typeof o.children>"u",c=(o.children||[]).map(u=>{const{_type:f,_key:h,...p}=u,m=Object.keys(p);return f===void 0&&m.length===1&&m.at(0)==="text"?{_key:h,_type:e.span.name,text:p.text}:f!==e.span.name?(s=!0,{_type:f,_key:h,children:[{_key:w_,_type:e.span.name,text:"",marks:[]}],value:p,__inline:!0}):u});return!a&&!l&&!s&&On.isElement(t)?t:{_type:n,_key:r,...i,children:c}}return{_type:n,_key:r,children:[{_key:w_,_type:"span",text:"",marks:[]}],value:i}}function __(t,e){const{_key:n,_type:r}=t;if(!n||!r)throw new Error("Not a valid block");if(r===e&&"children"in t&&Array.isArray(t.children)&&n){let o=!1;const s=t.children.map(a=>{const{_type:l}=a;if("value"in a&&l!=="span"){o=!0;const{value:c,_key:u,_type:f,__inline:h,children:p,...m}=a;return{...m,...c,_key:u,_type:f}}return a});return o?{...t,children:s,_key:n,_type:r}:t}const i="value"in t&&t.value;return{_key:n,_type:r,...typeof i=="object"?i:{}}}function Joe(t,e,n){if(!e||e.length!==1)return!1;const r=e.at(0);if(!r)return!0;if(!On.isElement(r)||r._type!==n.block.name||"listItem"in r||!("style"in r)||r.style!==n.styles.at(0)?.name||!Array.isArray(r.children)||r.children.length!==1)return!1;const i=r.children.at(0);return!(!i||!Dn.isText(i)||!("_type"in i)||i._type!==n.span.name||i.text!==""||i.marks?.join("")||"markDefs"in r&&Array.isArray(r.markDefs)&&r.markDefs.length>0||Object.keys(r).some(o=>o!=="_type"&&o!=="_key"&&o!=="children"&&o!=="markDefs"&&o!=="style")||iL({schema:n},t,[r]))}function g2e({editor:t}){if(!t.selection)return[void 0,void 0];try{return De.node(t,t.selection.focus.path.slice(0,1))??[void 0,void 0]}catch{return[void 0,void 0]}}function ike({editor:t}){if(!t.selection)return[void 0,void 0];try{const[e]=g2e({editor:t});if(!e)return[void 0,void 0];if(!t.isTextBlock(e))return[void 0,void 0];const[n,r]=De.node(t,t.selection.focus.path.slice(0,2));if(t.isTextSpan(n))return[n,r]}catch{return[void 0,void 0]}return[void 0,void 0]}function Gj({editor:t,point:e}){try{const[n]=De.node(t,e.path.slice(0,1))??[void 0,void 0];return n?[n,e.path.slice(0,1)]:[void 0,void 0]}catch{return[void 0,void 0]}}function Nhn({editor:t}){const[e,n]=g2e({editor:t}),r=t.selection?.focus.path.at(1);if(!e||!n||r===void 0)return[void 0,void 0];try{const i=hn.child(e,r);return i?[i,[...n,r]]:[void 0,void 0]}catch{return[void 0,void 0]}}function ese({editor:t,point:e}){const[n,r]=Gj({editor:t,point:e}),i=e.path.at(1);if(!n||!r||i===void 0)return[void 0,void 0];try{const o=hn.child(n,i);return o?[o,[...r,i]]:[void 0,void 0]}catch{return[void 0,void 0]}}function Bhn({editor:t}){if(t.children.length===0)return[void 0,void 0];const e=De.start(t,[]).path.at(0);try{return e!==void 0?De.node(t,[e])??[void 0,void 0]:[void 0,void 0]}catch{return[void 0,void 0]}}function Vhn({editor:t}){if(t.children.length===0)return[void 0,void 0];const e=De.end(t,[]).path.at(0);try{return e!==void 0?De.node(t,[e])??[void 0,void 0]:[void 0,void 0]}catch{return[void 0,void 0]}}function zhn({editor:t,schema:e,node:n}){if(De.isEditor(n))return;if(ske({editor:t,schema:e},n))return oke({schema:e,element:n});const r=Array.from(De.nodes(t,{mode:"highest",at:[],match:i=>ske({editor:t,schema:e},i)&&i.children.some(o=>o._key===n._key)})).at(0)?.at(0);return On.isElement(r)?oke({schema:e,element:r}):void 0}function oke({schema:t,element:e}){return __(e,t.block.name)}function ske({editor:t,schema:e},n){return On.isElement(n)&&!t.isInline(n)&&(e.block.name===n._type||e.blockObjects.some(r=>r.name===n._type))}function Hhn({editor:t,listItem:e}){if(!t.selection)return!1;const n=[...De.nodes(t,{at:t.selection,match:r=>t.isTextBlock(r)})];return n.length>0?n.every(([r])=>t.isListBlock(r)&&r.listItem===e):!1}function Uhn({editor:t,style:e}){if(!t.selection)return!1;const n=[...De.nodes(t,{at:t.selection,match:r=>t.isTextBlock(r)})];return n.length>0?n.every(([r])=>r.style===e):!1}function Ph({schema:t,editor:e,range:n}){const[r]=Gj({editor:e,point:n.anchor}),[i]=Gj({editor:e,point:n.focus});if(!r||!i)return null;const[o]=r._type===t.block.name?ese({editor:e,point:n.anchor}):[void 0,void 0],[s]=i._type===t.block.name?ese({editor:e,point:n.focus}):[void 0,void 0],a={anchor:{path:[{_key:r._key}],offset:n.anchor.offset},focus:{path:[{_key:i._key}],offset:n.focus.offset},backward:It.isBackward(n)};return o&&(a.anchor.path.push("children"),a.anchor.path.push({_key:o._key})),s&&(a.focus.path.push("children"),a.focus.path.push({_key:s._key})),a}function ake({schema:t,editor:e,point:n}){const[r]=Gj({editor:e,point:n});if(!r)return;const[i]=r._type===t.block.name?ese({editor:e,point:n}):[void 0,void 0];return i?{path:[{_key:r._key},"children",{_key:i._key}],offset:n.offset}:{path:[{_key:r._key}],offset:n.offset}}function ub({editorActor:t,slateEditor:e,event:n}){if(t.getSnapshot().matches({setup:"setting up"}))return;const r=Whn({slateEditor:e,event:n});if(!r)return;const i=zhn({editor:e,schema:t.getSnapshot().context.schema,node:r}),o=qhn({node:r,slateEditor:e,event:n}),s=Ghn({schema:t.getSnapshot().context.schema,slateEditor:e,event:n});if(i&&o&&!s&&!De.isEditor(r))return{block:o,isEditor:!1,selection:{anchor:Nh({context:t.getSnapshot().context,block:{node:i,path:[{_key:i._key}]}}),focus:yd({context:t.getSnapshot().context,block:{node:i,path:[{_key:i._key}]}})}};if(!o||!s)return;const a=Wa(s.focus);if(a!==void 0)return J3(s)&&i&&a!==i._key?{block:o,isEditor:!1,selection:{anchor:Nh({context:t.getSnapshot().context,block:{node:i,path:[{_key:i._key}]}}),focus:yd({context:t.getSnapshot().context,block:{node:i,path:[{_key:i._key}]}})}}:{block:o,isEditor:De.isEditor(r),selection:s}}function Whn({slateEditor:t,event:e}){if(!Zr.hasTarget(t,e.target))return;let n;try{n=Zr.toSlateNode(t,e.target)}catch(r){console.error(r)}return n}function qhn({node:t,slateEditor:e,event:n}){const[r]=Bhn({editor:e});if(!r)return;let i;try{i=Zr.toDOMNode(e,r)}catch(p){console.error(p)}if(!i)return;const o=i.getBoundingClientRect();if(n.pageYl.bottom)return"end";let c;try{c=Zr.toDOMNode(e,t)}catch(p){console.error(p)}if(!c)return;const u=c.getBoundingClientRect(),f=u.top,h=u.height;return Math.abs(f-n.pageY)a._key===i);if(s)n.push({_key:s._key});else return null;if(s&&t.path[1]==="children"){if(!s.children||Array.isArray(s.children)&&s.children.length===0)return null;const a=Array.isArray(s.children)&&s.children.find(l=>l._key===o);if(a)n.push("children"),n.push({_key:a._key}),r=a.text&&a.text.length>=t.offset?t.offset:a.text&&a.text.length||0;else return null}return{path:n,offset:r}}function Khn(t,e){if(!t||!e||e.length===0)return null;let n=null,r=null;const{anchor:i,focus:o}=t;return i&&e.find(s=>Y1(i.path[0])&&s._key===i.path[0]._key)&&(n=lke(i,e)),o&&e.find(s=>Y1(o.path[0])&&s._key===o.path[0]._key)&&(r=lke(o,e)),n&&r?{anchor:n,focus:r,backward:t.backward}:null}function p1(t){if(!t.context.selection)return null;if(pd(t.context.selection.anchor,t.context.selection.focus)){const r=YJ(t,t.context.selection.anchor,t.context.selection.backward?"backward":"forward");return r?{anchor:r,focus:r}:null}const e=YJ(t,t.context.selection.anchor,t.context.selection.backward?"forward":"backward"),n=YJ(t,t.context.selection.focus,t.context.selection.backward?"backward":"forward");return!e||!n?null:{anchor:e,focus:n}}function YJ(t,e,n){const r=Wa(e);if(!r)return;const i=t.blockIndexMap.get(r);if(i===void 0)return;const o=t.context.value.at(i);if(!o)return;if(!qn(t.context,o))return{path:[i,0],offset:0};let s=b1({path:e.path});const a=s?void 0:v8({context:{schema:t.context.schema,value:[o]},blockOffset:{path:[{_key:r}],offset:e.offset},direction:n});if(s=a?b1(a):s,!s)return{path:[i,0],offset:0};let l=a?.offset??e.offset,c=[],u=-1,f;for(const h of o.children)if(u++,h._key===s){f=h,Ci(t.context,h)?c=[u]:(c=[u,0],l=0);break}return c.length===0?{path:[i,0],offset:0}:{path:[i].concat(c),offset:Ci(t.context,f)?Math.min(f.text.length,l):l}}function Xhn(){const t=E.useRef(!1);return E.useEffect(()=>(t.current=!0,()=>{t.current=!1}),[]),t.current}const kg=rL?E.useLayoutEffect:E.useEffect;function Zhn(t,e,n){const[r]=E.useState(()=>new MutationObserver(e));kg(()=>{r.takeRecords()}),E.useEffect(()=>{if(!t.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(t.current,n),()=>r.disconnect()},[r,t,n])}const y2e=E.createContext(null),Uf=()=>{const t=E.useContext(y2e);if(!t)throw new Error("The `useSlateStatic` hook must be used inside the component's context.");return t},Rn=Zr,Qhn=25,Jhn=200,cke=(...t)=>{},epn=t=>t?.constructor.name==="DataTransfer";function tpn({editor:t,scheduleOnDOMSelectionChange:e,onDOMSelectionChange:n}){let r=!1,i=null,o=null,s=null,a=0,l=!1;const c=()=>{const j=Km.get(t);if(Km.delete(t),j){const{selection:A}=t,D=eke(t,j);D&&(!A||!It.equals(D,A))&&wt.select(t,D)}},u=()=>{const j=$4.get(t);if($4.delete(t),!!j){if(j.at){const A=gi.isPoint(j.at)?Zoe(t,j.at):eke(t,j.at);if(!A)return;const D=De.range(t,A);(!t.selection||!It.equals(t.selection,D))&&wt.select(t,A)}j.run()}},f=()=>{if(o&&(clearTimeout(o),o=null),s&&(clearTimeout(s),s=null),!x()&&!v()){c();return}r||(r=!0,setTimeout(()=>r=!1)),v()&&(r="action");const j=t.selection&&De.rangeRef(t,t.selection,{affinity:"forward"});l7.set(t,t.marks),cke("flush",$4.get(t),y2.get(t));let A=x(),D;for(;D=y2.get(t)?.[0];){const $=i0.get(t);$!==void 0&&(i0.delete(t),t.marks=$),$&&l===!1&&(l=null,cke("insert after mark placeholder"));const M=whn(D);(!t.selection||!It.equals(t.selection,M))&&wt.select(t,M),D.diff.text?De.insertText(t,D.diff.text):De.deleteFragment(t),y2.set(t,y2.get(t)?.filter(({id:L})=>L!==D.id)),bhn(t,D)||(A=!1,$4.delete(t),l7.delete(t),r="action",Km.delete(t),e.cancel(),n.cancel(),j?.unref())}const O=j?.unref();if(O&&!Km.get(t)&&(!t.selection||!It.equals(O,t.selection))&&wt.select(t,O),v()){u();return}A&&e(),e.flush(),n.flush(),c();const P=l7.get(t);l7.delete(t),P!==void 0&&(t.marks=P,t.onChange())},h=j=>{i&&clearTimeout(i),i=setTimeout(()=>{Vb.set(t,!1),f()},Qhn)},p=j=>{Vb.set(t,!0),i&&(clearTimeout(i),i=null)},m=(j=!1)=>{const A=Koe.get(t);if(A){if(x()||j){A.style.display="none";return}A.style.removeProperty("display")}},g=(j,A)=>{const D=y2.get(t)??[];y2.set(t,D);const O=hn.leaf(t,j),P=D.findIndex(M=>ut.equals(M.path,j));if(P<0){ett(O.text,A)&&D.push({path:j,diff:A,id:a++}),m();return}const $=Chn(O.text,D[P].diff,A);if(!$){D.splice(P,1),m();return}D[P]={...D[P],diff:$}},y=(j,{at:A}={})=>{l=!1,Km.delete(t),e.cancel(),n.cancel(),v()&&f(),$4.set(t,{at:A,run:j}),s=setTimeout(f)},b=j=>{if(o&&(clearTimeout(o),o=null),_w.get(t))return;const{inputType:A}=j;let D=null;const O=j.dataTransfer||j.data||void 0;l!==!1&&A!=="insertText"&&A!=="insertCompositionText"&&(l=!1);let[P]=j.getTargetRanges();P&&(D=Rn.toSlateRange(t,P,{exactMatch:!1,suppressThrow:!0}));const $=Rn.getWindow(t).getSelection();if(!D&&$&&(P=$,D=Rn.toSlateRange(t,$,{exactMatch:!1,suppressThrow:!0})),D=D??t.selection,!D)return;let M=!0;if(A.startsWith("delete")){const L=A.endsWith("Backward")?"backward":"forward";let[B,W]=It.edges(D),[N,V]=De.leaf(t,B.path);if(It.isExpanded(D)&&N.text.length===B.offset&&W.offset===0){const Z=De.next(t,{at:B.path,match:Dn.isText});Z&&ut.equals(Z[1],W.path)&&(L==="backward"?(D={anchor:W,focus:W},B=W,[N,V]=Z):(D={anchor:B,focus:B},W=B))}const G={text:"",start:B.offset,end:W.offset},z=y2.get(t)?.find(Z=>ut.equals(Z.path,V)),Y=z?[z.diff,G]:[G];if(Jet(N.text,...Y).length===0&&(M=!1),It.isExpanded(D)){if(M&&ut.equals(D.anchor.path,D.focus.path)){const Z={path:D.anchor.path,offset:B.offset},ee=De.range(t,Z,Z);return _(ee),g(D.anchor.path,{text:"",end:W.offset,start:B.offset})}return y(()=>De.deleteFragment(t,{direction:L}),{at:D})}}switch(A){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return y(()=>De.deleteFragment(t),{at:D});case"deleteContent":case"deleteContentForward":{const{anchor:L}=D;if(M&&It.isCollapsed(D)){const B=hn.leaf(t,L.path);if(L.offsetDe.deleteForward(t),{at:D})}case"deleteContentBackward":{const{anchor:L}=D,B=Yoe(P)?P.isCollapsed:!!P?.collapsed;return M&&B&&It.isCollapsed(D)&&L.offset>0?g(L.path,{text:"",start:L.offset-1,end:L.offset}):y(()=>De.deleteBackward(t),{at:D})}case"deleteEntireSoftLine":return y(()=>{De.deleteBackward(t,{unit:"line"}),De.deleteForward(t,{unit:"line"})},{at:D});case"deleteHardLineBackward":return y(()=>De.deleteBackward(t,{unit:"block"}),{at:D});case"deleteSoftLineBackward":return y(()=>De.deleteBackward(t,{unit:"line"}),{at:D});case"deleteHardLineForward":return y(()=>De.deleteForward(t,{unit:"block"}),{at:D});case"deleteSoftLineForward":return y(()=>De.deleteForward(t,{unit:"line"}),{at:D});case"deleteWordBackward":return y(()=>De.deleteBackward(t,{unit:"word"}),{at:D});case"deleteWordForward":return y(()=>De.deleteForward(t,{unit:"word"}),{at:D});case"insertLineBreak":return y(()=>De.insertSoftBreak(t),{at:D});case"insertParagraph":return y(()=>De.insertBreak(t),{at:D});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(epn(O))return y(()=>Rn.insertData(t,O),{at:D});let L=O??"";if(i0.get(t)&&(L=L.replace("\uFEFF","")),A==="insertText"&&/.*\n.*\n$/.test(L)&&(L=L.slice(0,-1)),L.includes(` +`))return y(()=>{const B=L.split(` +`);B.forEach((W,N)=>{W&&De.insertText(t,W),N!==B.length-1&&De.insertSoftBreak(t)})},{at:D});if(ut.equals(D.anchor.path,D.focus.path)){const[B,W]=It.edges(D),N={start:B.offset,end:W.offset,text:L};if(L&&l&&A==="insertCompositionText"){const V=l.start+l.text.search(/\S|$/);N.start+N.text.search(/\S|$/)===V+1&&N.end===l.start+l.text.length?(N.start-=1,l=null,I()):l=!1}else A==="insertText"?l===null?l=N:l&&It.isCollapsed(D)&&l.end+l.text.length===B.offset?l={...l,text:l.text+L}:l=!1:l=!1;if(M){const V=t.selection;if(g(B.path,N),V){const G={path:B.path,offset:B.offset+L.length};y(()=>{wt.select(t,{anchor:G,focus:G})},{at:G})}return}}return y(()=>De.insertText(t,L),{at:D})}}},v=()=>!!$4.get(t),x=()=>!!y2.get(t)?.length,C=()=>v()||x(),w=()=>r,_=j=>{Km.set(t,j),o&&(clearTimeout(o),o=null);const{selection:A}=t;if(!j)return;const D=!A||!ut.equals(A.anchor.path,j.anchor.path),O=!A||!ut.equals(A.anchor.path.slice(0,-1),j.anchor.path.slice(0,-1));(D&&l||O)&&(l=!1),(D||x())&&(o=setTimeout(f,Jhn))},S=()=>{(v()||!x())&&f()},k=j=>{x()||(m(!0),setTimeout(m))},I=()=>{v()||(s=setTimeout(f))};return{flush:f,scheduleFlush:I,hasPendingDiffs:x,hasPendingAction:v,hasPendingChanges:C,isFlushing:w,handleUserSelect:_,handleCompositionEnd:h,handleCompositionStart:p,handleDOMBeforeInput:b,handleKeyDown:k,handleDomMutations:j=>{x()||v()||j.some(A=>u2e(t,A,j))&&Zet.get(t)?.()},handleInput:S}}const npn={subtree:!0,childList:!0,characterData:!0},rpn=z1?({node:t,...e})=>{if(!z1)return null;const n=Uf(),r=Xhn(),[i]=E.useState(()=>tpn({editor:n,...e}));return Zhn(t,i.handleDomMutations,npn),f2e.set(n,i.scheduleFlush),r&&i.flush(),i}:()=>null;class ipn{constructor(e,n){this.editor=e,this.children=n,this.cachedKeys=new Array(n.length),this.pointerIndex=0}read(e){if(e===1)return[this.children[this.pointerIndex++]];const n=this.remaining(e);return this.pointerIndex+=e,n}remaining(e){return e===void 0?this.children.slice(this.pointerIndex):this.children.slice(this.pointerIndex,this.pointerIndex+e)}get reachedEnd(){return this.pointerIndex>=this.children.length}lookAhead(e,n){const r=this.children.indexOf(e,this.pointerIndex);if(r>-1)return r-this.pointerIndex;for(let i=this.pointerIndex;i({type:"leaf",node:r,key:this.findKey(r,n+i),index:n+i}))}findKey(e,n){const r=this.cachedKeys[n];if(r)return r;const i=Rn.findKey(this.editor,e);return this.cachedKeys[n]=i,i}}class opn{constructor(e,{chunkSize:n,debug:r}){this.root=e,this.chunkSize=n,this.debug=r??!1,this.pointerChunk=e,this.pointerIndex=-1,this.pointerIndexStack=[],this.reachedEnd=!1,this.validateState()}readLeaf(){if(this.reachedEnd)return null;for(;;)if(this.pointerIndex+1=1){this.pointerIndex--,this.cachedPointerNode=void 0;break}else if(this.pointerChunk.type==="root"){this.pointerIndex=-1;return}else this.exitChunk();this.validateState(),this.enterChunkUntilLeaf(!0)}insertBefore(e){this.returnToPreviousLeaf(),this.insertAfter(e),this.readLeaf()}insertAfter(e){if(e.length===0)return;let n=0,r=0;for(;this.pointerChunk.type==="chunk"&&this.pointerIndex===this.pointerSiblings.length-1;){const a=this.chunkSize-this.pointerSiblings.length,l=Math.min(a,e.length);if(l>0){const c=e.splice(0,l);this.rawInsertAfter(c,n)}this.exitChunk(),n++}if(e.length===0)return;const i=this.savePointer();let o=null;if(this.readLeaf())for(;this.pointerChunk.type==="chunk"&&this.pointerIndex===0;){const a=this.chunkSize-this.pointerSiblings.length,l=Math.min(a,e.length);if(l>0){const c=e.splice(-l,l);this.pointerIndex=-1,this.cachedPointerNode=void 0,this.rawInsertAfter(c,r),o||(o=this.savePointer())}this.exitChunk(),r++}this.restorePointer(i);const s=Math.max(n,r);this.rawInsertAfter(e,s),o&&this.restorePointer(o),this.validateState()}remove(){this.pointerSiblings.splice(this.pointerIndex--,1),this.cachedPointerNode=void 0,this.pointerSiblings.length===0&&this.pointerChunk.type==="chunk"?(this.exitChunk(),this.remove()):this.invalidateChunk(),this.validateState()}invalidateChunk(){for(let e=this.pointerChunk;e.type==="chunk";e=e.parent)this.root.modifiedChunks.add(e)}get atStart(){return this.pointerChunk.type==="root"&&this.pointerIndex===-1}get pointerSiblings(){return this.pointerChunk.children}getPointerNode(){return this.reachedEnd||this.pointerIndex===-1?null:this.pointerSiblings[this.pointerIndex]??null}get pointerNode(){if(this.cachedPointerNode!==void 0)return this.cachedPointerNode;const e=this.getPointerNode();return this.cachedPointerNode=e,e}getChunkPath(e){const n=[];for(let r=e;r.type==="chunk";r=r.parent){const i=r.parent.children.indexOf(r);if(i===-1)return null;n.unshift(i)}return n}savePointer(){if(this.atStart)return"start";if(!this.pointerNode)throw new Error("Cannot save pointer when pointerNode is null");return{chunk:this.pointerChunk,node:this.pointerNode}}restorePointer(e){if(e==="start"){this.pointerChunk=this.root,this.pointerIndex=-1,this.pointerIndexStack=[],this.reachedEnd=!1,this.cachedPointerNode=void 0;return}const{chunk:n,node:r}=e,i=n.children.indexOf(r);if(i===-1)throw new Error("Cannot restore point because saved node is no longer in saved chunk");const o=this.getChunkPath(n);if(!o)throw new Error("Cannot restore point because saved chunk is no longer connected to root");this.pointerChunk=n,this.pointerIndex=i,this.pointerIndexStack=o,this.reachedEnd=!1,this.cachedPointerNode=r,this.validateState()}enterChunk(e){if(this.pointerNode?.type!=="chunk")throw new Error("Cannot enter non-chunk");if(this.pointerIndexStack.push(this.pointerIndex),this.pointerChunk=this.pointerNode,this.pointerIndex=e?this.pointerSiblings.length-1:0,this.cachedPointerNode=void 0,this.validateState(),this.pointerChunk.children.length===0)throw new Error("Cannot enter empty chunk")}enterChunkUntilLeaf(e){for(;this.pointerNode?.type==="chunk";)this.enterChunk(e)}exitChunk(){if(this.pointerChunk.type==="root")throw new Error("Cannot exit root");const e=this.pointerChunk;this.pointerChunk=e.parent,this.pointerIndex=this.pointerIndexStack.pop(),this.cachedPointerNode=void 0,this.validateState()}rawInsertAfter(e,n){if(e.length===0)return;const r=(c,u,f)=>{if(f===1)return c;const h=[];for(let p=0;p{if(r.type==="chunk"){const{parent:i,children:o}=r;if(!i.children.includes(r))throw new Error(`Debug: Chunk ${r.key.id} has an incorrect parent property`);o.forEach(e)}};if(this.root.children.forEach(e),this.cachedPointerNode!==void 0&&this.cachedPointerNode!==this.getPointerNode())throw new Error("Debug: The cached pointer is incorrect and has not been invalidated");const n=this.getChunkPath(this.pointerChunk);if(!n)throw new Error("Debug: The pointer chunk is not connected to the root");if(!ut.equals(this.pointerIndexStack,n))throw new Error(`Debug: The cached index stack [${this.pointerIndexStack.join(", ")}] does not match the path of the pointer chunk [${n.join(", ")}]`)}}const spn=(t,{chunkTree:e,children:n,chunkSize:r,rerenderChildren:i=[],onInsert:o,onUpdate:s,onIndexChange:a,debug:l})=>{e.modifiedChunks.clear();const c=new opn(e,{chunkSize:r,debug:l}),u=new ipn(t,n);let f;for(;f=c.readLeaf();){const h=u.lookAhead(f.node,f.key),p=h>0&&e.movedNodeKeys.has(f.key);if(h===-1||p){c.remove();continue}const m=u.pointerIndex,g=u.read(h+1),y=g.pop();if(g.length){const v=u.toChunkLeaves(g,m);c.insertBefore(v),g.forEach((x,C)=>{o?.(x,m+C)})}const b=u.pointerIndex-1;f.node!==y&&(f.node=y,c.invalidateChunk(),s?.(y,b)),f.index!==b&&(f.index=b,a?.(y,b)),i.includes(b)&&c.invalidateChunk()}if(!u.reachedEnd){const h=u.remaining(),p=u.toChunkLeaves(h,u.pointerIndex);c.returnToPreviousLeaf(),c.insertAfter(p),h.forEach((m,g)=>{o?.(m,u.pointerIndex+g)})}e.movedNodeKeys.clear()},uke=new WeakMap,att=(t,e,n={})=>{const r=Rn.findKey(t,e);let i=uke.get(r);return i||(i={type:"root",movedNodeKeys:new Set,modifiedChunks:new Set,children:[]},uke.set(r,i)),n.reconcile&&spn(t,{chunkTree:i,children:e.children,...n.reconcile}),i},apn=({children:t})=>t,ltt=t=>{const{root:e,ancestor:n,renderElement:r,renderChunk:i=apn}=t;return n.children.map(o=>{if(o.type==="chunk"){const a=o.key.id,l=i({highest:n===e,lowest:o.children.some(c=>c.type==="leaf"),attributes:{"data-slate-chunk":!0},children:d.jsx(cpn,{root:e,ancestor:o,renderElement:r,renderChunk:i})});return d.jsx(E.Fragment,{children:l},a)}const s=o.node;return r(s,o.index,o.key)})},lpn=ltt,cpn=vt.memo(ltt,(t,e)=>t.root===e.root&&t.renderElement===e.renderElement&&t.renderChunk===e.renderChunk&&!e.root.modifiedChunks.has(e.ancestor));function ctt(t,e){const[,n]=E.useReducer(l=>l+1,0),r=E.useRef(void 0),i=E.useRef(()=>null),o=E.useRef(null);let s;try{if(t!==i.current||r.current){const l=t();e(o.current,l)?s=o.current:s=l}else s=o.current}catch(l){throw r.current&&upn(l)&&(l.message+=` +The error may be correlated with this previous error: +${r.current.stack} + +`),l}i.current=t,o.current=s,r.current=void 0;const a=E.useCallback(()=>{try{const l=i.current();if(e(o.current,l))return;o.current=l}catch(l){l instanceof Error?r.current=l:r.current=new Error(String(l))}n()},[]);return[s,a]}function upn(t){return t instanceof Error}const utt=E.createContext({}),dtt=(t,e)=>{const n=Uf(),{decorate:r,addEventListener:i}=E.useContext(utt),o=()=>{const c=Rn.findPath(n,t);return r([t,c])},s=Dn.isText(t)?ntt:h2e,[a,l]=ctt(o,s);return kg(()=>{const c=i(l);return l(),c},[i,l]),E.useMemo(()=>[...a,...e],[a,e])},dpn=t=>{const e=E.useRef(new Set),n=E.useRef(t);kg(()=>{n.current=t,e.current.forEach(o=>{o()})},[t]);const r=E.useCallback(o=>n.current(o),[]),i=E.useCallback(o=>(e.current.add(o),()=>{e.current.delete(o)}),[]);return E.useMemo(()=>({decorate:r,addEventListener:i}),[r,i])},ftt="֑-߿יִ-﷽ﹰ-ﻼ",htt="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",fpn=new RegExp(`^[^${htt}]*[${ftt}]`),hpn=new RegExp(`^[^${ftt}]*[${htt}]`);function ptt(t){const e=String(t||"");return fpn.test(e)?"rtl":hpn.test(e)?"ltr":"neutral"}const ppn=t=>{const{isLast:e,leaf:n,parent:r,text:i}=t,o=Uf(),s=Rn.findPath(o,i),a=ut.parent(s),l=!!n[Qet];return o.isVoid(r)?d.jsx(KJ,{length:hn.string(r).length}):n.text===""&&r.children[r.children.length-1]===i&&!o.isInline(r)&&De.string(o,a)===""?d.jsx(KJ,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?d.jsx(KJ,{isMarkPlaceholder:l}):e&&n.text.slice(-1)===` +`?d.jsx(dke,{isTrailing:!0,text:n.text}):d.jsx(dke,{text:n.text})},dke=t=>{const{text:e,isTrailing:n=!1}=t,r=E.useRef(null),i=()=>`${e??""}${n?` +`:""}`,[o]=E.useState(i);return kg(()=>{const s=i();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),d.jsx(mpn,{ref:r,children:o})},mpn=E.memo(E.forwardRef((t,e)=>d.jsx("span",{"data-slate-string":!0,ref:e,children:t.children}))),KJ=t=>{const{length:e=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=t,i={"data-slate-zero-width":n?"n":"z","data-slate-length":e};return r&&(i["data-slate-mark-placeholder"]=!0),d.jsxs("span",{...i,children:[!z1||!n?"\uFEFF":null,n?d.jsx("br",{}):null]})},gpn=z1?300:0;function ypn(t,e){t.current&&(t.current.disconnect(),e&&(t.current=null))}function fke(t){t.current&&(clearTimeout(t.current),t.current=null)}const bpn=t=>d.jsx(Cpn,{...t}),vpn=t=>{const{leaf:e,isLast:n,text:r,parent:i,renderPlaceholder:o,renderLeaf:s=bpn,leafPosition:a}=t,l=Uf(),c=E.useRef(null),u=E.useRef(null),[f,h]=E.useState(!1),p=E.useRef(null),m=E.useCallback(b=>{if(ypn(c,b==null),b==null)Koe.delete(l),e.onPlaceholderResize?.(null);else{if(Koe.set(l,b),!c.current){const v=window.ResizeObserver||az;c.current=new v(()=>{e.onPlaceholderResize?.(b)})}c.current.observe(b),u.current=b}},[u,e,l]);let g=d.jsx(ppn,{isLast:n,leaf:e,parent:i,text:r});const y=!!e[C_];if(E.useEffect(()=>(y?p.current||(p.current=setTimeout(()=>{h(!0),p.current=null},gpn)):(fke(p),h(!1)),()=>fke(p)),[y,h]),y&&f){const b={children:e.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:_b?"inherit":void 0},contentEditable:!1,ref:m}};g=d.jsxs(vt.Fragment,{children:[g,o(b)]})}return s({attributes:{"data-slate-leaf":!0},children:g,leaf:e,text:r,leafPosition:a})},xpn=vt.memo(vpn,(t,e)=>e.parent===t.parent&&e.isLast===t.isLast&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&e.text===t.text&&Dn.equals(e.leaf,t.leaf)&&e.leaf[C_]===t.leaf[C_]),Cpn=t=>{const{attributes:e,children:n}=t;return d.jsx("span",{...e,children:n})},wpn=t=>d.jsx(Spn,{...t}),_pn=t=>{const{decorations:e,isLast:n,parent:r,renderPlaceholder:i,renderLeaf:o,renderText:s=wpn,text:a}=t,l=Uf(),c=E.useRef(null),u=dtt(a,e),f=Dn.decorations(a,u),h=Rn.findKey(l,a),p=[];for(let g=0;g{const y=TH.get(l);g?(y?.set(h,g),o9.set(a,g),qj.set(g,a)):(y?.delete(h),o9.delete(a),c.current&&qj.delete(c.current)),c.current=g},[c,l,h,a])};return s({text:a,children:p,attributes:m})},mtt=vt.memo(_pn,(t,e)=>e.parent===t.parent&&e.isLast===t.isLast&&e.renderText===t.renderText&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&e.text===t.text&&ntt(e.decorations,t.decorations)),Spn=t=>{const{attributes:e,children:n}=t;return d.jsx("span",{...e,children:n})},kpn=t=>d.jsx(Ipn,{...t}),Epn=t=>{const{decorations:e,element:n,renderElement:r=kpn,renderChunk:i,renderPlaceholder:o,renderLeaf:s,renderText:a}=t,l=Uf(),c=Dpn(),u=l.isInline(n),f=dtt(n,e),h=Rn.findKey(l,n),p=E.useCallback(y=>{const b=TH.get(l);y?(b?.set(h,y),o9.set(n,y),qj.set(y,n)):(b?.delete(h),o9.delete(n))},[l,h,n]);let m=gtt({decorations:f,node:n,renderElement:r,renderChunk:i,renderPlaceholder:o,renderLeaf:s,renderText:a});const g={"data-slate-node":"element",ref:p};if(u&&(g["data-slate-inline"]=!0),!u&&De.hasInlines(l,n)){const y=hn.string(n),b=ptt(y);b==="rtl"&&(g.dir=b)}if(De.isVoid(l,n)){g["data-slate-void"]=!0,!c&&u&&(g.contentEditable=!1);const y=u?"span":"div",[b]=hn.texts(n),[v]=b;m=d.jsx(y,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"},children:d.jsx(mtt,{renderPlaceholder:o,decorations:[],isLast:!1,parent:n,text:v})}),YC.set(v,0),$I.set(v,n)}return r({attributes:g,children:m,element:n})},Tpn=vt.memo(Epn,(t,e)=>t.element===e.element&&t.renderElement===e.renderElement&&t.renderChunk===e.renderChunk&&t.renderText===e.renderText&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&h2e(t.decorations,e.decorations)),Ipn=t=>{const{attributes:e,children:n,element:r}=t,i=Uf().isInline(r)?"span":"div";return d.jsx(i,{...e,style:{position:"relative"},children:n})},jpn=E.createContext(null),gtt=t=>{const{decorations:e,node:n,renderElement:r,renderChunk:i,renderPlaceholder:o,renderText:s,renderLeaf:a}=t,l=Uf();_w.set(l,!1);const c=!De.isEditor(n)&&On.isElement(n)&&!l.isInline(n)&&De.hasInlines(l,n)?null:l.getChunkSize(n),u=!!c,{decorationsByChild:f,childrenToRedecorate:h}=Apn(l,n,e);u||n.children.forEach((y,b)=>{YC.set(y,b),$I.set(y,n)});const p=E.useCallback((y,b,v)=>{const x=v??Rn.findKey(l,y);return d.jsx(jpn.Provider,{value:y,children:d.jsx(Tpn,{decorations:f[b]??[],element:y,renderElement:r,renderChunk:i,renderPlaceholder:o,renderLeaf:a,renderText:s},x.id)},`provider-${x.id}`)},[l,f,r,i,o,a,s]),m=(y,b)=>{const v=Rn.findKey(l,y);return d.jsx(mtt,{decorations:f[b]??[],isLast:b===n.children.length-1,parent:n,renderPlaceholder:o,renderLeaf:a,renderText:s,text:y},v.id)};if(!u)return n.children.map((y,b)=>Dn.isText(y)?m(y,b):p(y,b));const g=att(l,n,{reconcile:{chunkSize:c,rerenderChildren:h,onInsert:(y,b)=>{YC.set(y,b),$I.set(y,n)},onUpdate:(y,b)=>{YC.set(y,b),$I.set(y,n)},onIndexChange:(y,b)=>{YC.set(y,b)}}});return d.jsx(lpn,{root:g,ancestor:g,renderElement:p,renderChunk:i})},Apn=(t,e,n)=>{const r=Rhn(t,e,n),i=E.useRef(r).current,o=[];i.length=r.length;for(let s=0;sE.useContext(ytt),jH=E.createContext({}),Opn=(t,e)=>t===e;function Ppn(t,e=Opn,{deferred:n}={}){const r=E.useContext(jH);if(!r)throw new Error("The `useSlateSelector` hook must be used inside the component's context.");const{addEventListener:i}=r,o=Uf(),s=E.useCallback(()=>t(o),[o,t]),[a,l]=ctt(s,e);return kg(()=>{const c=i(l,{deferred:n});return l(),c},[i,l,n]),a}function $pn(){const t=E.useRef(new Set),e=E.useRef(new Set),n=E.useCallback(()=>{t.current.forEach(o=>{o()})},[]),r=E.useCallback(()=>{e.current.forEach(o=>{o()}),e.current.clear()},[]),i=E.useCallback((o,{deferred:s=!1}={})=>{const a=s?()=>e.current.add(o):o;return t.current.add(a),()=>{t.current.delete(a)}},[]);return{selectorContext:E.useMemo(()=>({addEventListener:i,flushDeferred:r}),[i,r]),onChange:n}}function Mpn(){const{flushDeferred:t}=E.useContext(jH);kg(t)}const btt=()=>{const{addEventListener:t}=E.useContext(jH),[,e]=E.useReducer(n=>n+1,0);if(!t)throw new Error("The `useSlate` hook must be used inside the component's context.");return kg(()=>t(e),[t]),Uf()};function Lpn(){const t=Uf(),e=E.useRef(!1),n=E.useRef(0),r=E.useCallback(()=>{if(e.current)return;e.current=!0;const i=Rn.getWindow(t);i.cancelAnimationFrame(n.current),n.current=i.requestAnimationFrame(()=>{e.current=!1})},[t]);return E.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:e,onUserInput:r}}function Fpn(t,e){let n,r;const i=(...o)=>{r=o,n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0;const s=r;r=void 0,s&&t(...s)},e)};return i.cancel=()=>{n!==void 0&&(clearTimeout(n),n=void 0),r=void 0},i.flush=()=>{if(n!==void 0){clearTimeout(n),n=void 0;const o=r;r=void 0,o&&t(...o)}},i}function Npn(t,e){let n,r,i;const o=()=>{const l=r;r=void 0,i=Date.now(),l&&t(...l)},s=l=>{n=setTimeout(()=>{n=void 0,r&&o()},l)},a=(...l)=>{const c=Date.now();if(r=l,i===void 0){o();return}const u=c-i;u>=e?(n!==void 0&&(clearTimeout(n),n=void 0),o()):n===void 0&&s(e-u)};return a.cancel=()=>{n!==void 0&&(clearTimeout(n),n=void 0),r=void 0,i=void 0},a.flush=()=>{n!==void 0&&(clearTimeout(n),n=void 0),r&&o()},a}const Bpn=(t,e)=>{let n=[];const r=()=>{n=[]},i=s=>{if(!e.current)return;const a=s.filter(l=>u2e(t,l,s));n.push(...a)};function o(){n.length>0&&(n.reverse().forEach(s=>{s.type!=="characterData"&&(s.removedNodes.forEach(a=>{s.target.insertBefore(a,s.nextSibling)}),s.addedNodes.forEach(a=>{s.target.removeChild(a)}))}),r())}return{registerMutations:i,restoreDOM:o,clear:r}},Vpn={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class zpn extends E.Component{static contextType=y2e;context=null;manager=null;mutationObserver=null;observe(){const{node:e}=this.props;if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");this.mutationObserver?.observe(e.current,Vpn)}componentDidMount(){const{receivedUserInput:e}=this.props,n=this.context;this.manager=Bpn(n,e),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){const e=this.mutationObserver?.takeRecords();return e?.length&&this.manager?.registerMutations(e),this.mutationObserver?.disconnect(),this.manager?.restoreDOM(),null}componentDidUpdate(){this.manager?.clear(),this.observe()}componentWillUnmount(){this.mutationObserver?.disconnect()}render(){return this.props.children}}const Hpn=z1?zpn:({children:t})=>d.jsx(d.Fragment,{children:t}),Upn=t=>d.jsx(vt.Fragment,{children:gtt(t)}),Wpn=E.forwardRef((t,e)=>{const n=E.useCallback(Y=>d.jsx(qpn,{...Y}),[]),{autoFocus:r,decorate:i=Gpn,onDOMBeforeInput:o,placeholder:s,readOnly:a=!1,renderElement:l,renderChunk:c,renderLeaf:u,renderText:f,renderPlaceholder:h=n,scrollSelectionIntoView:p=Ypn,style:m={},as:g="div",disableDefaultStyles:y=!1,...b}=t,v=btt(),[x,C]=E.useState(!1),w=E.useRef(null),_=E.useRef([]),[S,k]=E.useState(),I=E.useRef(!1),{onUserInput:j,receivedUserInput:A}=Lpn(),[,D]=E.useReducer(Y=>Y+1,0);Zet.set(v,D),ON.set(v,a);const O=E.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);E.useEffect(()=>{w.current&&r&&w.current.focus()},[r]);const P=E.useRef(void 0),$=E.useMemo(()=>Npn(()=>{if(_w.get(v)){$();return}const Y=Rn.toDOMNode(v,v).getRootNode();if(!I.current&&_b&&Y instanceof ShadowRoot){I.current=!0,chn()?document.execCommand("indent"):wt.deselect(v),I.current=!1;return}const Z=P.current;if((z1||!Rn.isComposing(v))&&(!O.isUpdatingSelection||Z?.isFlushing())&&!O.isDraggingInternally){const ee=Rn.findDocumentOrShadowRoot(v),{activeElement:K}=ee,q=Rn.toDOMNode(v,v),re=PI(ee);if(K===q?(O.latestElement=K,Q5.set(v,!0)):Q5.delete(v),!re)return wt.deselect(v);const{anchorNode:te,focusNode:ae}=re,se=Rn.hasEditableTarget(v,te)||Rn.isTargetInsideNonReadonlyVoid(v,te),le=Rn.hasTarget(v,ae);if(se&&le){const pe=Rn.toSlateRange(v,re,{exactMatch:!1,suppressThrow:!0});pe&&(!Rn.isComposing(v)&&!Z?.hasPendingChanges()&&!Z?.isFlushing()?wt.select(v,pe):Z?.handleUserSelect(pe))}a&&(!se||!le)&&wt.deselect(v)}},100),[v,a,O]),M=E.useMemo(()=>Fpn($,0),[$]);P.current=rpn({node:w,onDOMSelectionChange:$,scheduleOnDOMSelectionChange:M}),kg(()=>{let Y=null;w.current&&(Y=c2e(w.current))?(Xet.set(v,Y),MI.set(v,w.current),o9.set(v,w.current),qj.set(w.current,v)):o9.delete(v);const{selection:Z}=v,ee=Rn.findDocumentOrShadowRoot(v),K=PI(ee);if(!K||!Rn.isFocused(v)||P.current?.hasPendingAction())return;const q=se=>{const le=K.type!=="None";if(!Z&&!le)return;const pe=K.focusNode;let be=null;if(GC&&K.rangeCount>1){const _e=K.getRangeAt(0),Ie=K.getRangeAt(K.rangeCount-1);_e.startContainer===pe?be=Ie.endContainer:be=_e.startContainer}else be=K.anchorNode;const xe=MI.get(v);let Ce=!1;if(i9(xe,be)&&i9(xe,pe)&&(Ce=!0),le&&Ce&&Z&&!se){const _e=Rn.toSlateRange(v,K,{exactMatch:!0,suppressThrow:!0});if(_e&&It.equals(_e,Z)&&(!O.hasMarkPlaceholder||be?.parentElement?.hasAttribute("data-slate-mark-placeholder")))return}if(Z&&!Rn.hasRange(v,Z)){v.selection=Rn.toSlateRange(v,K,{exactMatch:!1,suppressThrow:!0});return}O.isUpdatingSelection=!0;let Te=null;try{Te=Z&&Rn.toDOMRange(v,Z)}catch{}return Te?(Rn.isComposing(v)&&!z1?K.collapseToEnd():It.isBackward(Z)?K.setBaseAndExtent(Te.endContainer,Te.endOffset,Te.startContainer,Te.startOffset):K.setBaseAndExtent(Te.startContainer,Te.startOffset,Te.endContainer,Te.endOffset),p(v,Te)):K.removeAllRanges(),Te};K.rangeCount<=1&&q();const re=P.current?.isFlushing()==="action";if(!z1||!re){setTimeout(()=>{O.isUpdatingSelection=!1});return}let te=null;const ae=requestAnimationFrame(()=>{if(re){const se=le=>{try{Rn.toDOMNode(v,v).focus(),q(le)}catch{}};se(),te=setTimeout(()=>{se(!0),O.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ae),te&&clearTimeout(te)}});const L=E.useCallback(Y=>{hke(v,Y);const Z=Rn.toDOMNode(v,v).getRootNode();if(I?.current&&_b&&Z instanceof ShadowRoot){const ee=Y.getTargetRanges()[0],K=new window.Range;K.setStart(ee.startContainer,ee.startOffset),K.setEnd(ee.endContainer,ee.endOffset);const q=Rn.toSlateRange(v,K,{exactMatch:!1,suppressThrow:!1});wt.select(v,q),Y.preventDefault(),Y.stopImmediatePropagation();return}if(j(),!a&&Rn.hasEditableTarget(v,Y.target)&&!Kpn(Y,o)){if(P.current)return P.current.handleDOMBeforeInput(Y);M.flush(),$.flush();const{selection:ee}=v,{inputType:K}=Y,q=Y.dataTransfer||Y.data||void 0,re=K==="insertCompositionText"||K==="deleteCompositionText";if(re&&Rn.isComposing(v))return;let te=!1;if(K==="insertText"&&ee&&It.isCollapsed(ee)&&Y.data&&Y.data.length===1&&/[a-z ]/i.test(Y.data)&&ee.anchor.offset!==0&&(te=!0,v.marks&&(te=!1),!_w.get(v))){const{anchor:se}=ee,[le,pe]=Rn.toDOMPoint(v,se),be=le.parentElement?.closest("a"),xe=Rn.getWindow(v);if(te&&be&&Rn.hasDOMNode(v,be)){const Ce=xe?.document.createTreeWalker(be,NodeFilter.SHOW_TEXT).lastChild();Ce===le&&Ce.textContent?.length===pe&&(te=!1)}if(te&&le.parentElement&&xe?.getComputedStyle(le.parentElement)?.whiteSpace==="pre"){const Ce=De.above(v,{at:se.path,match:Te=>On.isElement(Te)&&De.isBlock(v,Te)});Ce&&hn.string(Ce[0]).includes(" ")&&(te=!1)}}if((!K.startsWith("delete")||K.startsWith("deleteBy"))&&!_w.get(v)){const[se]=Y.getTargetRanges();if(se){const le=Rn.toSlateRange(v,se,{exactMatch:!1,suppressThrow:!1});if(!ee||!It.equals(ee,le)){te=!1;const pe=!re&&v.selection&&De.rangeRef(v,v.selection);wt.select(v,le),pe&&LI.set(v,pe)}}}if(re)return;if(te||Y.preventDefault(),ee&&It.isExpanded(ee)&&K.startsWith("delete")){const se=K.endsWith("Backward")?"backward":"forward";De.deleteFragment(v,{direction:se});return}switch(K){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{De.deleteFragment(v);break}case"deleteContent":case"deleteContentForward":{De.deleteForward(v);break}case"deleteContentBackward":{De.deleteBackward(v);break}case"deleteEntireSoftLine":{De.deleteBackward(v,{unit:"line"}),De.deleteForward(v,{unit:"line"});break}case"deleteHardLineBackward":{De.deleteBackward(v,{unit:"block"});break}case"deleteSoftLineBackward":{De.deleteBackward(v,{unit:"line"});break}case"deleteHardLineForward":{De.deleteForward(v,{unit:"block"});break}case"deleteSoftLineForward":{De.deleteForward(v,{unit:"line"});break}case"deleteWordBackward":{De.deleteBackward(v,{unit:"word"});break}case"deleteWordForward":{De.deleteForward(v,{unit:"word"});break}case"insertLineBreak":De.insertSoftBreak(v);break;case"insertParagraph":{De.insertBreak(v);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{K==="insertFromComposition"&&Rn.isComposing(v)&&(C(!1),Vb.set(v,!1)),q?.constructor.name==="DataTransfer"?Rn.insertData(v,q):typeof q=="string"&&(te?_.current.push(()=>De.insertText(v,q)):De.insertText(v,q));break}}const ae=LI.get(v)?.unref();LI.delete(v),ae&&(!v.selection||!It.equals(v.selection,ae))&&wt.select(v,ae)}},[v,$,j,o,a,M]),B=E.useCallback(Y=>{Y==null?($.cancel(),M.cancel(),MI.delete(v),o9.delete(v),w.current&&S4&&w.current.removeEventListener("beforeinput",L)):S4&&Y.addEventListener("beforeinput",L),w.current=Y,typeof e=="function"?e(Y):e&&(e.current=Y)},[$,M,v,L,e]);kg(()=>{const Y=Rn.getWindow(v),Z=({target:K})=>{const q=(K instanceof HTMLElement?K:null)?.tagName;q==="INPUT"||q==="TEXTAREA"||M()};Y.document.addEventListener("selectionchange",Z);const ee=()=>{O.isDraggingInternally=!1};return Y.document.addEventListener("dragend",ee),Y.document.addEventListener("drop",ee),()=>{Y.document.removeEventListener("selectionchange",Z),Y.document.removeEventListener("dragend",ee),Y.document.removeEventListener("drop",ee)}},[M,O]);const W=i([v,[]]),N=dpn(i),V=s&&v.children.length===1&&Array.from(hn.texts(v)).length===1&&hn.string(v)===""&&!x,G=E.useCallback(Y=>{k(Y&&V?Y.getBoundingClientRect()?.height:void 0)},[V]);if(V){const Y=De.start(v,[]);W.push({[C_]:!0,placeholder:s,onPlaceholderResize:G,anchor:Y,focus:Y})}const{marks:z}=v;if(O.hasMarkPlaceholder=!1,v.selection&&It.isCollapsed(v.selection)&&z){const{anchor:Y}=v.selection,Z=hn.leaf(v,Y.path),{text:ee,...K}=Z;if(!Dn.equals(Z,z,{loose:!0})){O.hasMarkPlaceholder=!0;const q=Object.fromEntries(Object.keys(K).map(re=>[re,null]));W.push({[Qet]:!0,...q,...z,anchor:Y,focus:Y})}}return E.useEffect(()=>{setTimeout(()=>{const{selection:Y}=v;if(Y){const{anchor:Z}=Y,ee=hn.leaf(v,Z.path);if(z&&!Dn.equals(ee,z,{loose:!0})){i0.set(v,z);return}}i0.delete(v)})}),Mpn(),d.jsx(ytt.Provider,{value:a,children:d.jsx(Rpn.Provider,{value:x,children:d.jsx(utt.Provider,{value:N,children:d.jsx(Hpn,{node:w,receivedUserInput:A,children:d.jsx(g,{role:a?void 0:"textbox","aria-multiline":a?void 0:!0,translate:"no",...b,spellCheck:S4||!rL?b.spellCheck:!1,autoCorrect:S4||!rL?b.autoCorrect:"false",autoCapitalize:S4||!rL?b.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!a,zindex:-1,suppressContentEditableWarning:!0,ref:B,style:{...y?{}:{position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word",...S?{minHeight:S}:{}},...m},onBeforeInput:E.useCallback(Y=>{if(!S4&&!a&&!vf(Y,b.onBeforeInput)&&Rn.hasSelectableTarget(v,Y.target)&&(Y.preventDefault(),!Rn.isComposing(v))){const Z=Y.data;De.insertText(v,Z)}},[b.onBeforeInput,v,a]),onInput:E.useCallback(Y=>{if(!vf(Y,b.onInput)){if(P.current){P.current.handleInput();return}for(const Z of _.current)Z();_.current=[],Rn.isFocused(v)||hke(v,Y.nativeEvent)}},[b.onInput,v]),onBlur:E.useCallback(Y=>{if(a||O.isUpdatingSelection||!Rn.hasSelectableTarget(v,Y.target)||vf(Y,b.onBlur))return;const Z=Rn.findDocumentOrShadowRoot(v);if(O.latestElement===Z.activeElement)return;const{relatedTarget:ee}=Y,K=Rn.toDOMNode(v,v);if(ee!==K&&!(Ip(ee)&&ee.hasAttribute("data-slate-spacer"))){if(ee!=null&&P7(ee)&&Rn.hasDOMNode(v,ee)){const q=Rn.toSlateNode(v,ee);if(On.isElement(q)&&!v.isVoid(q))return}_b&&PI(Z)?.removeAllRanges(),Q5.delete(v)}},[a,O.isUpdatingSelection,O.latestElement,v,b.onBlur]),onClick:E.useCallback(Y=>{if(Rn.hasTarget(v,Y.target)&&!vf(Y,b.onClick)&&P7(Y.target)){const Z=Rn.toSlateNode(v,Y.target),ee=Rn.findPath(v,Z);if(!De.hasPath(v,ee)||hn.get(v,ee)!==Z)return;if(Y.detail===Ehn&&ee.length>=1){let ae=ee;On.isElement(Z)&&De.isBlock(v,Z)||(ae=De.above(v,{match:le=>On.isElement(le)&&De.isBlock(v,le),at:ee})?.[1]??ee.slice(0,1));const se=De.range(v,ae);wt.select(v,se);return}if(a)return;const K=De.start(v,ee),q=De.end(v,ee),re=De.void(v,{at:K}),te=De.void(v,{at:q});if(re&&te&&ut.equals(re[1],te[1])){const ae=De.range(v,K);wt.select(v,ae)}}},[v,b.onClick,a]),onCompositionEnd:E.useCallback(Y=>{if(!GE(Y)&&Rn.hasSelectableTarget(v,Y.target)){if(Rn.isComposing(v)&&Promise.resolve().then(()=>{C(!1),Vb.set(v,!1)}),P.current?.handleCompositionEnd(Y),vf(Y,b.onCompositionEnd)||z1)return;if(!_b&&!phn&&!dhn&&!ghn&&!mhn&&Y.data){const Z=i0.get(v);i0.delete(v),Z!==void 0&&(l7.set(v,v.marks),v.marks=Z),De.insertText(v,Y.data);const ee=l7.get(v);l7.delete(v),ee!==void 0&&(v.marks=ee)}}},[b.onCompositionEnd,v]),onCompositionUpdate:E.useCallback(Y=>{Rn.hasSelectableTarget(v,Y.target)&&!vf(Y,b.onCompositionUpdate)&&!GE(Y)&&(Rn.isComposing(v)||(C(!0),Vb.set(v,!0)))},[b.onCompositionUpdate,v]),onCompositionStart:E.useCallback(Y=>{if(!GE(Y)&&Rn.hasSelectableTarget(v,Y.target)){if(P.current?.handleCompositionStart(Y),vf(Y,b.onCompositionStart)||z1)return;C(!0);const{selection:Z}=v;if(Z&&It.isExpanded(Z)){De.deleteFragment(v);return}}},[b.onCompositionStart,v]),onCopy:E.useCallback(Y=>{Rn.hasSelectableTarget(v,Y.target)&&!vf(Y,b.onCopy)&&!GE(Y)&&(Y.preventDefault(),Rn.setFragmentData(v,Y.clipboardData,"copy"))},[b.onCopy,v]),onCut:E.useCallback(Y=>{if(!a&&Rn.hasSelectableTarget(v,Y.target)&&!vf(Y,b.onCut)&&!GE(Y)){Y.preventDefault(),Rn.setFragmentData(v,Y.clipboardData,"cut");const{selection:Z}=v;if(Z)if(It.isExpanded(Z))De.deleteFragment(v);else{const ee=hn.parent(v,Z.anchor.path);De.isVoid(v,ee)&&wt.delete(v)}}},[a,v,b.onCut]),onDragOver:E.useCallback(Y=>{if(Rn.hasTarget(v,Y.target)&&!vf(Y,b.onDragOver)){const Z=Rn.toSlateNode(v,Y.target);On.isElement(Z)&&De.isVoid(v,Z)&&Y.preventDefault()}},[b.onDragOver,v]),onDragStart:E.useCallback(Y=>{if(!a&&Rn.hasTarget(v,Y.target)&&!vf(Y,b.onDragStart)){const Z=Rn.toSlateNode(v,Y.target),ee=Rn.findPath(v,Z);if(On.isElement(Z)&&De.isVoid(v,Z)||De.void(v,{at:ee,voids:!0})){const K=De.range(v,ee);wt.select(v,K)}O.isDraggingInternally=!0,Rn.setFragmentData(v,Y.dataTransfer,"drag")}},[a,v,b.onDragStart,O]),onDrop:E.useCallback(Y=>{if(!a&&Rn.hasTarget(v,Y.target)&&!vf(Y,b.onDrop)){Y.preventDefault();const Z=v.selection,ee=Rn.findEventRange(v,Y),K=Y.dataTransfer;wt.select(v,ee),O.isDraggingInternally&&Z&&!It.equals(Z,ee)&&!De.void(v,{at:ee,voids:!0})&&wt.delete(v,{at:Z}),Rn.insertData(v,K),Rn.isFocused(v)||Rn.focus(v)}},[a,v,b.onDrop,O]),onDragEnd:E.useCallback(Y=>{!a&&O.isDraggingInternally&&b.onDragEnd&&Rn.hasTarget(v,Y.target)&&b.onDragEnd(Y)},[a,O,b,v]),onFocus:E.useCallback(Y=>{if(!a&&!O.isUpdatingSelection&&Rn.hasEditableTarget(v,Y.target)&&!vf(Y,b.onFocus)){const Z=Rn.toDOMNode(v,v),ee=Rn.findDocumentOrShadowRoot(v);if(O.latestElement=ee.activeElement,GC&&Y.target!==Z){Z.focus();return}Q5.set(v,!0)}},[a,O,v,b.onFocus]),onKeyDown:E.useCallback(Y=>{if(!a&&Rn.hasEditableTarget(v,Y.target)){P.current?.handleKeyDown(Y);const{nativeEvent:Z}=Y;if(Rn.isComposing(v)&&Z.isComposing===!1&&(Vb.set(v,!1),C(!1)),vf(Y,b.onKeyDown)||Rn.isComposing(v))return;const{selection:ee}=v,K=v.children[ee!==null?ee.focus.path[0]:0],q=ptt(hn.string(K))==="rtl";if(pc.isRedo(Z)){Y.preventDefault();const re=v;typeof re.redo=="function"&&re.redo();return}if(pc.isUndo(Z)){Y.preventDefault();const re=v;typeof re.undo=="function"&&re.undo();return}if(pc.isMoveLineBackward(Z)){Y.preventDefault(),wt.move(v,{unit:"line",reverse:!0});return}if(pc.isMoveLineForward(Z)){Y.preventDefault(),wt.move(v,{unit:"line"});return}if(pc.isExtendLineBackward(Z)){Y.preventDefault(),wt.move(v,{unit:"line",edge:"focus",reverse:!0});return}if(pc.isExtendLineForward(Z)){Y.preventDefault(),wt.move(v,{unit:"line",edge:"focus"});return}if(pc.isMoveBackward(Z)){Y.preventDefault(),ee&&It.isCollapsed(ee)?wt.move(v,{reverse:!q}):wt.collapse(v,{edge:q?"end":"start"});return}if(pc.isMoveForward(Z)){Y.preventDefault(),ee&&It.isCollapsed(ee)?wt.move(v,{reverse:q}):wt.collapse(v,{edge:q?"start":"end"});return}if(pc.isMoveWordBackward(Z)){Y.preventDefault(),ee&&It.isExpanded(ee)&&wt.collapse(v,{edge:"focus"}),wt.move(v,{unit:"word",reverse:!q});return}if(pc.isMoveWordForward(Z)){Y.preventDefault(),ee&&It.isExpanded(ee)&&wt.collapse(v,{edge:"focus"}),wt.move(v,{unit:"word",reverse:q});return}if(S4){if((d2e||_b)&&ee&&(pc.isDeleteBackward(Z)||pc.isDeleteForward(Z))&&It.isCollapsed(ee)){const re=hn.parent(v,ee.anchor.path);if(On.isElement(re)&&De.isVoid(v,re)&&(De.isInline(v,re)||De.isBlock(v,re))){Y.preventDefault(),De.deleteBackward(v,{unit:"block"});return}}}else{if(pc.isBold(Z)||pc.isItalic(Z)||pc.isTransposeCharacter(Z)){Y.preventDefault();return}if(pc.isSoftBreak(Z)){Y.preventDefault(),De.insertSoftBreak(v);return}if(pc.isSplitBlock(Z)){Y.preventDefault(),De.insertBreak(v);return}if(pc.isDeleteBackward(Z)){Y.preventDefault(),ee&&It.isExpanded(ee)?De.deleteFragment(v,{direction:"backward"}):De.deleteBackward(v);return}if(pc.isDeleteForward(Z)){Y.preventDefault(),ee&&It.isExpanded(ee)?De.deleteFragment(v,{direction:"forward"}):De.deleteForward(v);return}if(pc.isDeleteLineBackward(Z)){Y.preventDefault(),ee&&It.isExpanded(ee)?De.deleteFragment(v,{direction:"backward"}):De.deleteBackward(v,{unit:"line"});return}if(pc.isDeleteLineForward(Z)){Y.preventDefault(),ee&&It.isExpanded(ee)?De.deleteFragment(v,{direction:"forward"}):De.deleteForward(v,{unit:"line"});return}if(pc.isDeleteWordBackward(Z)){Y.preventDefault(),ee&&It.isExpanded(ee)?De.deleteFragment(v,{direction:"backward"}):De.deleteBackward(v,{unit:"word"});return}if(pc.isDeleteWordForward(Z)){Y.preventDefault(),ee&&It.isExpanded(ee)?De.deleteFragment(v,{direction:"forward"}):De.deleteForward(v,{unit:"word"});return}}}},[a,v,b.onKeyDown]),onPaste:E.useCallback(Y=>{!a&&Rn.hasEditableTarget(v,Y.target)&&!vf(Y,b.onPaste)&&(!S4||rhn(Y.nativeEvent)||_b)&&(Y.preventDefault(),Rn.insertData(v,Y.clipboardData))},[a,v,b.onPaste]),children:d.jsx(Upn,{decorations:W,node:v,renderElement:l,renderChunk:c,renderPlaceholder:h,renderLeaf:u,renderText:f})})})})})})}),qpn=({attributes:t,children:e})=>d.jsxs("span",{...t,children:[e,z1&&d.jsx("br",{})]}),Gpn=()=>[],Ypn=(t,e)=>{const n=!!t.selection&&It.isBackward(t.selection),r=e.cloneRange();if(r.collapse(n),r.getBoundingClientRect){const i=r.startContainer.parentElement,o=r.getBoundingClientRect();if(o.width===0&&o.height===0&&o.x===0&&o.y===0){const s=i.getBoundingClientRect();if(s.width>0||s.height>0)return}i.getBoundingClientRect=r.getBoundingClientRect.bind(r),M9(i,{scrollMode:"if-needed"}),delete i.getBoundingClientRect}},vf=(t,e)=>e?e(t)??(t.isDefaultPrevented()||t.isPropagationStopped()):!1,GE=t=>P7(t.target)&&(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement),Kpn=(t,e)=>e?e(t)??t.defaultPrevented:!1,hke=(t,e)=>{const n=t;if(e.inputType==="historyUndo"&&typeof n.undo=="function"){n.undo();return}if(e.inputType==="historyRedo"&&typeof n.redo=="function"){n.redo();return}},Xpn=E.createContext(!1),vtt=parseInt(vt.version.split(".")[0],10),Zpn=t=>{const{editor:e,children:n,onChange:r,onSelectionChange:i,onValueChange:o,initialValue:s,...a}=t;vt.useState(()=>{if(!hn.isNodeList(s))throw new Error(`[Slate] initialValue is invalid! Expected a list of elements but got: ${fd.stringify(s)}`);if(!De.isEditor(e))throw new Error(`[Slate] editor is invalid! You passed: ${fd.stringify(e)}`);e.children=s,Object.assign(e,a)});const{selectorContext:l,onChange:c}=$pn(),u=E.useCallback(()=>{r&&r(e.children),i&&e.operations.find(p=>p.type==="set_selection")&&i(e.selection),o&&e.operations.find(p=>p.type!=="set_selection")&&o(e.children),c()},[e,c,r,i,o]);E.useEffect(()=>(Xoe.set(e,u),()=>{Xoe.set(e,()=>{})}),[e,u]);const[f,h]=E.useState(Rn.isFocused(e));return E.useEffect(()=>{h(Rn.isFocused(e))},[e]),kg(()=>{const p=()=>h(Rn.isFocused(e));return vtt>=17?(document.addEventListener("focusin",p),document.addEventListener("focusout",p),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",p)}):(document.addEventListener("focus",p,!0),document.addEventListener("blur",p,!0),()=>{document.removeEventListener("focus",p,!0),document.removeEventListener("blur",p,!0)})},[]),d.jsx(jH.Provider,{value:l,children:d.jsx(y2e.Provider,{value:e,children:d.jsx(Xpn.Provider,{value:f,children:n})})})};function Qpn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var XJ={exports:{}},P1={};var pke;function Jpn(){if(pke)return P1;pke=1;var t=vt;function e(l){var c="https://react.dev/errors/"+l;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),XJ.exports=Jpn(),XJ.exports}var tmn=emn(),nmn=Qpn(tmn);const rmn=(t,e="x-slate-fragment")=>{let n=t;n=khn(n,e);const{onChange:r,apply:i,insertText:o}=n;return n.getChunkSize=()=>null,z1&&(n.insertText=(s,a)=>(Km.delete(n),o(s,a))),n.onChange=s=>{(vtt<18?nmn.unstable_batchedUpdates:a=>a())(()=>{r(s)})},n.apply=s=>{if(s.type==="move_node"){const a=hn.parent(n,s.path);if(n.getChunkSize(a)){const l=hn.get(n,s.path),c=att(n,a),u=Rn.findKey(n,l);c.movedNodeKeys.add(u)}}i(s)},n},a6=E.createContext({}),imn=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.userAgent),omn={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},xtt={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:imn?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Ctt={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,f13:124,f14:125,f15:126,f16:127,f17:128,f18:129,f19:130,f20:131};function gke(t,e){return amn(smn(t),e)}function smn(t){const e={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1},n=t.replace("++","+add").split("+");for(const r of n){const i=r.endsWith("?")&&r.length>1,o=i?r.slice(0,-1):r,s=wtt(o),a=omn[s],l=xtt[o],c=Ctt[s];if(o.length>1&&a===void 0&&l===void 0&&c===void 0)throw new TypeError(`Unknown modifier: "${o}"`);(n.length===1||a===void 0)&&(e.key=s,e.keyCode=lmn(o)),a!==void 0&&(e[a]=i?null:!0)}return e}function amn(t,e){return(t.altKey==null||t.altKey===e.altKey)&&(t.ctrlKey==null||t.ctrlKey===e.ctrlKey)&&(t.metaKey==null||t.metaKey===e.metaKey)&&(t.shiftKey==null||t.shiftKey===e.shiftKey)?t.keyCode!==void 0&&e.keyCode!==void 0?t.keyCode===91&&e.keyCode===93?!0:t.keyCode===e.keyCode:t.keyCode===e.keyCode||t.key===e.key.toLowerCase():!1}function lmn(t){const e=wtt(t);return Ctt[e]??e.toUpperCase().charCodeAt(0)}function wtt(t){const e=t.toLowerCase();return xtt[e]??e}const yke=["enter","tab","shift","delete","end"];function cmn({editorActor:t,editor:e,portableTextEditor:n,hotkeys:r,event:i}){t.getSnapshot().matches({"edit mode":"read only"})||Object.keys(r).forEach(o=>{if(o==="marks")for(const s in r[o]){if(yke.includes(s))throw new Error(`The hotkey ${s} is reserved!`);if(gke(s,i.nativeEvent)){i.preventDefault();const a=r[o];if(a){const l=a[s];l&&t.send({type:"behavior event",behaviorEvent:{type:"decorator.toggle",decorator:l},editor:e})}}}if(o==="custom")for(const s in r[o]){if(yke.includes(s))throw new Error(`The hotkey ${s} is reserved!`);if(gke(s,i.nativeEvent)){const a=r[o];if(a){const l=a[s];l&&l(i,n)}}}})}function umn(t,e){const n=gi.transform(t.anchor,e),r=gi.transform(t.focus,e);return n===null||r===null?null:gi.equals(n,t.anchor)&&gi.equals(r,t.focus)?t:{anchor:n,focus:r}}const dmn=({input:t,sendBack:e})=>{const n=t.slateEditor.apply;return t.slateEditor.apply=r=>{r.type!=="set_selection"&&e({type:"slate operation",operation:r}),n(r)},()=>{t.slateEditor.apply=n}},fmn=lm({actions:{"update pending range decorations":qi({pendingRangeDecorations:({context:t,event:e})=>e.type!=="range decorations updated"?t.pendingRangeDecorations:e.rangeDecorations}),"set up initial range decorations":({context:t})=>{const e=[];for(const n of t.pendingRangeDecorations){const r=p1({context:{schema:t.schema,value:t.slateEditor.value,selection:n.selection},blockIndexMap:t.slateEditor.blockIndexMap});if(!It.isRange(r)){n.onMoved?.({newSelection:null,rangeDecoration:n,origin:"local"});continue}e.push({rangeDecoration:n,...r})}t.slateEditor.decoratedRanges=e},"update range decorations":({context:t,event:e})=>{if(e.type!=="range decorations updated")return;const n=[];for(const r of e.rangeDecorations){const i=p1({context:{schema:t.schema,value:t.slateEditor.value,selection:r.selection},blockIndexMap:t.slateEditor.blockIndexMap});if(!It.isRange(i)){r.onMoved?.({newSelection:null,rangeDecoration:r,origin:"local"});continue}n.push({rangeDecoration:r,...i})}t.slateEditor.decoratedRanges=n},"move range decorations":({context:t,event:e})=>{if(e.type!=="slate operation")return;const n=[];for(const r of t.slateEditor.decoratedRanges){const i=p1({context:{schema:t.schema,value:t.slateEditor.value,selection:r.rangeDecoration.selection},blockIndexMap:t.slateEditor.blockIndexMap});if(!It.isRange(i)){r.rangeDecoration.onMoved?.({newSelection:null,rangeDecoration:r.rangeDecoration,origin:"local"});continue}let o;if(o=umn(i,e.operation),o&&o!==i||o===null&&i){const s=o?Ph({schema:t.schema,editor:t.slateEditor,range:o}):null;r.rangeDecoration.onMoved?.({newSelection:s,rangeDecoration:r.rangeDecoration,origin:"local"})}o!==null&&n.push({...o||i,rangeDecoration:{...r.rangeDecoration,selection:Ph({schema:t.schema,editor:t.slateEditor,range:o})}})}t.slateEditor.decoratedRanges=n},"assign readOnly":qi({readOnly:({context:t,event:e})=>e.type!=="update read only"?t.readOnly:e.readOnly}),"update decorate":qi({decorate:({context:t})=>({fn:bke(t.schema,t.slateEditor)})})},actors:{"slate operation listener":y0(dmn)},guards:{"has pending range decorations":({context:t})=>t.pendingRangeDecorations.length>0,"has range decorations":({context:t})=>t.slateEditor.decoratedRanges.length>0,"has different decorations":({context:t,event:e})=>{if(e.type!=="range decorations updated")return!1;const n=t.slateEditor.decoratedRanges.map(i=>({anchor:i.rangeDecoration.selection?.anchor,focus:i.rangeDecoration.selection?.focus,payload:i.rangeDecoration.payload})),r=e.rangeDecorations.map(i=>({anchor:i.selection?.anchor,focus:i.selection?.focus,payload:i.payload}));return!m2e(n,r)},"not read only":({context:t})=>!t.readOnly,"should skip setup":({context:t})=>t.skipSetup}}).createMachine({id:"range decorations",context:({input:t})=>({readOnly:t.readOnly,pendingRangeDecorations:t.rangeDecorations,decoratedRanges:[],skipSetup:t.skipSetup,schema:t.schema,slateEditor:t.slateEditor,decorate:{fn:bke(t.schema,t.slateEditor)}}),invoke:{src:"slate operation listener",input:({context:t})=>({slateEditor:t.slateEditor})},on:{"update read only":{actions:["assign readOnly"]}},initial:"setting up",states:{"setting up":{always:[{guard:bw(["should skip setup","has pending range decorations"]),target:"ready",actions:["set up initial range decorations","update decorate"]},{guard:"should skip setup",target:"ready"}],on:{"range decorations updated":{actions:["update pending range decorations"]},ready:[{target:"ready",guard:"has pending range decorations",actions:["set up initial range decorations","update decorate"]},{target:"ready"}]}},ready:{initial:"idle",on:{"range decorations updated":{target:".idle",guard:"has different decorations",actions:["update range decorations","update decorate"]}},states:{idle:{on:{"slate operation":{target:"moving range decorations",guard:bw(["has range decorations","not read only"])}}},"moving range decorations":{entry:["move range decorations"],always:{target:"idle"}}}}}});function bke(t,e){return function([n,r]){const i=t.styles.at(0)?.name,o=e.value[0];if(e.value.length===1&&o&&c1({schema:t},o)&&(!o.style||o.style===i)&&!o.listItem)return[{anchor:{path:[0,0],offset:0},focus:{path:[0,0],offset:0},placeholder:!0}];if(r.length===0)return[];if(!On.isElement(n)||n.children.length===0)return[];const s=r.at(0);return s===void 0?[]:e.decoratedRanges.filter(a=>It.isCollapsed(a)?n.children.some((l,c)=>ut.equals(a.anchor.path,[s,c])&&ut.equals(a.focus.path,[s,c])):It.intersection(a,{anchor:{path:r,offset:0},focus:{path:r,offset:0}})||It.includes(a,r))}}const _tt=E.createContext({});function vke(t){const e=H.c(4);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={userSelect:"none"},e[0]=n):n=e[0];let r;return e[1]!==t.blockObject._key||e[2]!==t.blockObject._type?(r=d.jsxs("div",{style:n,children:["[",t.blockObject._type,": ",t.blockObject._key,"]"]}),e[1]=t.blockObject._key,e[2]=t.blockObject._type,e[3]=r):r=e[3],r}function xke(t){const e=H.c(4);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={userSelect:"none"},e[0]=n):n=e[0];let r;return e[1]!==t.inlineObject._key||e[2]!==t.inlineObject._type?(r=d.jsxs("span",{style:n,children:["[",t.inlineObject._type,": ",t.inlineObject._key,"]"]}),e[1]=t.inlineObject._key,e[2]=t.inlineObject._type,e[3]=r):r=e[3],r}function PN(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=d.jsx("div",{contentEditable:!1,className:"pt-drop-indicator",style:{position:"absolute",width:"100%",height:1,borderBottom:"1px solid currentColor",zIndex:5},children:d.jsx("span",{})}),t[0]=e):e=t[0],e}function AH(t){return t.map(e=>Y1(e)?e._key:e).join(".")}function M4({editorActorSnapshot:t,slateEditorInstance:e}){const n=e.selection?Ph({schema:t.context.schema,editor:e,range:e.selection}):null;return{blockIndexMap:e.blockIndexMap,context:{converters:[...t.context.converters],keyGenerator:t.context.keyGenerator,readOnly:t.matches({"edit mode":"read only"}),schema:t.context.schema,selection:n,value:e.value},decoratorState:e.decoratorState}}const KC=new Set,Stt={focusedChildPath:void 0,selectedChildPaths:KC,focusedBlockKey:void 0,selectedBlockKeys:KC},QR=E.createContext(Stt);function hmn(t){const e=H.c(5),{children:n}=t,r=E.useContext(a6),i=Uf();let o;e[0]!==i?(o=l=>{const c=M4({editorActorSnapshot:l,slateEditorInstance:i});if(!c.context.selection)return Stt;const u=hl(c);let f;if(u){const C=$S(c);C&&(f=AH(C.path))}const h=WQe()(c);let p=h.length>0?new Set(h.map(mmn)):KC;u&&f&&!p.has(f)&&(p=new Set(p),p.add(f));const m=qg(c),g=i6(c),y=m?Wa(m):void 0,b=g?Wa(g):void 0;let v=KC;if(y&&b){const C=c.blockIndexMap.get(y),w=c.blockIndexMap.get(b);if(C!==void 0&&w!==void 0){const _=Math.min(C,w),S=Math.max(C,w);v=new Set;for(const[k,I]of c.blockIndexMap)I>=_&&I<=S&&v.add(k)}}const x=u?y:void 0;return{focusedChildPath:f,selectedChildPaths:p.size>0?p:KC,focusedBlockKey:x,selectedBlockKeys:v.size>0?v:KC}},e[0]=i,e[1]=o):o=e[1];const s=$9(r,o,pmn);let a;return e[2]!==n||e[3]!==s?(a=d.jsx(QR.Provider,{value:s,children:n}),e[2]=n,e[3]=s,e[4]=a):a=e[4],a}function pmn(t,e){if(t.focusedChildPath!==e.focusedChildPath)return!1;if(t.selectedChildPaths!==e.selectedChildPaths){if(t.selectedChildPaths.size!==e.selectedChildPaths.size)return!1;for(const n of t.selectedChildPaths)if(!e.selectedChildPaths.has(n))return!1}if(t.focusedBlockKey!==e.focusedBlockKey)return!1;if(t.selectedBlockKeys!==e.selectedBlockKeys){if(t.selectedBlockKeys.size!==e.selectedBlockKeys.size)return!1;for(const n of t.selectedBlockKeys)if(!e.selectedBlockKeys.has(n))return!1}return!0}function mmn(t){return AH(t.path)}function gmn(t){const e=H.c(34),n=E.useRef(null),{selectedBlockKeys:r,focusedBlockKey:i}=E.useContext(QR);let o;e[0]!==t.element._key||e[1]!==r?(o=r.has(t.element._key),e[0]=t.element._key,e[1]=r,e[2]=o):o=e[2];const s=o,a=i===t.element._key;let l;if(e[3]!==t.element._type||e[4]!==t.legacySchema.blockObjects){let v;e[6]!==t.element._type?(v=x=>x.name===t.element._type,e[6]=t.element._type,e[7]=v):v=e[7],l=t.legacySchema.blockObjects.find(v),e[3]=t.element._type,e[4]=t.legacySchema.blockObjects,e[5]=l}else l=e[5];const c=l;c||console.error(`Unable to find Block Object "${t.element._type}" in Schema`);let u;e[8]!==t.blockObject||e[9]!==t.element._key||e[10]!==t.element._type?(u=t.blockObject??{_key:t.element._key,_type:t.element._type},e[8]=t.blockObject,e[9]=t.element._key,e[10]=t.element._type,e[11]=u):u=e[11];const f=u;let h;e[12]!==t.dropPosition?(h=t.dropPosition==="start"?d.jsx(PN,{}):null,e[12]=t.dropPosition,e[13]=h):h=e[13];const p=!t.readOnly;let m;e[14]!==f||e[15]!==a||e[16]!==c||e[17]!==t.element._key||e[18]!==t.renderBlock||e[19]!==s?(m=t.renderBlock&&c?d.jsx(ymn,{renderBlock:t.renderBlock,editorElementRef:n,focused:a,path:[{_key:t.element._key}],schemaType:c,selected:s,type:c,value:f,children:d.jsx(vke,{blockObject:f})}):d.jsx(vke,{blockObject:f}),e[14]=f,e[15]=a,e[16]=c,e[17]=t.element._key,e[18]=t.renderBlock,e[19]=s,e[20]=m):m=e[20];let g;e[21]!==p||e[22]!==m?(g=d.jsx("div",{ref:n,contentEditable:!1,draggable:p,children:m}),e[21]=p,e[22]=m,e[23]=g):g=e[23];let y;e[24]!==t.dropPosition?(y=t.dropPosition==="end"?d.jsx(PN,{}):null,e[24]=t.dropPosition,e[25]=y):y=e[25];let b;return e[26]!==t.attributes||e[27]!==t.children||e[28]!==t.element._key||e[29]!==t.element._type||e[30]!==h||e[31]!==g||e[32]!==y?(b=d.jsxs("div",{...t.attributes,className:"pt-block pt-object-block","data-block-key":t.element._key,"data-block-name":t.element._type,"data-block-type":"object",children:[h,t.children,g,y]}),e[26]=t.attributes,e[27]=t.children,e[28]=t.element._key,e[29]=t.element._type,e[30]=h,e[31]=g,e[32]=y,e[33]=b):b=e[33],b}function ymn({renderBlock:t,children:e,editorElementRef:n,focused:r,path:i,schemaType:o,selected:s,type:a,value:l}){return t({children:e,editorElementRef:n,focused:r,path:i,schemaType:o,selected:s,type:a,value:l})}function bmn(t){const e=H.c(28),n=E.useRef(null),r=Uf();let i;if(e[0]!==t.element._type||e[1]!==t.legacySchema.inlineObjects){let w;e[3]!==t.element._type?(w=_=>_.name===t.element._type,e[3]=t.element._type,e[4]=w):w=e[4],i=t.legacySchema.inlineObjects.find(w),e[0]=t.element._type,e[1]=t.legacySchema.inlineObjects,e[2]=i}else i=e[2];const o=i;o||console.error(`Unable to find Inline Object "${t.element._type}" in Schema`);const s=Zr.findPath(r,t.element),[a]=Gj({editor:r,point:{path:s,offset:0}});a||console.error(`Unable to find parent block of inline object ${t.element._key}`);const l=a?[{_key:a._key},"children",{_key:t.element._key}]:void 0,c=E.useContext(QR),u=l?AH(l):void 0,f=u?c.selectedChildPaths.has(u):!1,h=u?c.focusedChildPath===u:!1;let p;e[5]!==t.element?(p="value"in t.element&&typeof t.element.value=="object"?t.element.value:{},e[5]=t.element,e[6]=p):p=e[6];let m;e[7]!==t.element._key||e[8]!==t.element._type||e[9]!==p?(m={_key:t.element._key,_type:t.element._type,...p},e[7]=t.element._key,e[8]=t.element._type,e[9]=p,e[10]=m):m=e[10];const g=m;let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y={display:"inline-block"},e[11]=y):y=e[11];const b=!t.readOnly;let v;e[12]!==h||e[13]!==g||e[14]!==o||e[15]!==l||e[16]!==t.renderChild||e[17]!==f?(v=t.renderChild&&l&&o?d.jsx(vmn,{renderChild:t.renderChild,annotations:[],editorElementRef:n,selected:f,focused:h,path:l,schemaType:o,value:g,type:o,children:d.jsx(xke,{inlineObject:g})}):d.jsx(xke,{inlineObject:g}),e[12]=h,e[13]=g,e[14]=o,e[15]=l,e[16]=t.renderChild,e[17]=f,e[18]=v):v=e[18];let x;e[19]!==b||e[20]!==v?(x=d.jsx("span",{ref:n,style:y,draggable:b,children:v}),e[19]=b,e[20]=v,e[21]=x):x=e[21];let C;return e[22]!==g._key||e[23]!==g._type||e[24]!==t.attributes||e[25]!==t.children||e[26]!==x?(C=d.jsxs("span",{...t.attributes,className:"pt-inline-object","data-child-key":g._key,"data-child-name":g._type,"data-child-type":"object",children:[t.children,x]}),e[22]=g._key,e[23]=g._type,e[24]=t.attributes,e[25]=t.children,e[26]=x,e[27]=C):C=e[27],C}function vmn({renderChild:t,annotations:e,children:n,editorElementRef:r,focused:i,path:o,schemaType:s,selected:a,value:l,type:c}){return t({annotations:e,children:n,editorElementRef:r,focused:i,path:o,schemaType:s,selected:a,value:l,type:c})}function xmn(t){const e=H.c(76),n=E.useRef(null),{selectedBlockKeys:r,focusedBlockKey:i}=E.useContext(QR);let o;e[0]!==t.textBlock._key||e[1]!==r?(o=r.has(t.textBlock._key),e[0]=t.textBlock._key,e[1]=r,e[2]=o):o=e[2];const s=o,a=i===t.textBlock._key;let l;e[3]!==t.textBlock._key?(l=I=>I.listIndexMap.get(t.textBlock._key),e[3]=t.textBlock._key,e[4]=l):l=e[4];const c=Ppn(l);let u=t.children;if(t.renderStyle&&t.textBlock.style){let I;e[5]!==t.legacySchema||e[6]!==t.textBlock.style?(I=t.textBlock.style!==void 0?t.legacySchema.styles.find(A=>A.value===t.textBlock.style):void 0,e[5]=t.legacySchema,e[6]=t.textBlock.style,e[7]=I):I=e[7];const j=I;if(j){let A;e[8]!==t.textBlock._key?(A=[{_key:t.textBlock._key}],e[8]=t.textBlock._key,e[9]=A):A=e[9];let D;e[10]!==u||e[11]!==a||e[12]!==j||e[13]!==t.renderStyle||e[14]!==t.textBlock||e[15]!==s||e[16]!==A?(D=d.jsx(_mn,{renderStyle:t.renderStyle,block:t.textBlock,editorElementRef:n,focused:a,path:A,schemaType:j,selected:s,value:t.textBlock.style,children:u}),e[10]=u,e[11]=a,e[12]=j,e[13]=t.renderStyle,e[14]=t.textBlock,e[15]=s,e[16]=A,e[17]=D):D=e[17],u=D}else console.error(`Unable to find Schema type for text block style ${t.textBlock.style}`)}if(t.renderListItem&&t.textBlock.listItem){let I;if(e[18]!==t.legacySchema.lists||e[19]!==t.textBlock.listItem){let A;e[21]!==t.textBlock.listItem?(A=D=>D.value===t.textBlock.listItem,e[21]=t.textBlock.listItem,e[22]=A):A=e[22],I=t.legacySchema.lists.find(A),e[18]=t.legacySchema.lists,e[19]=t.textBlock.listItem,e[20]=I}else I=e[20];const j=I;if(j){const A=t.textBlock.level??1;let D;e[23]!==t.textBlock._key?(D=[{_key:t.textBlock._key}],e[23]=t.textBlock._key,e[24]=D):D=e[24];let O;e[25]!==u||e[26]!==a||e[27]!==j||e[28]!==t.renderListItem||e[29]!==t.textBlock||e[30]!==s||e[31]!==A||e[32]!==D?(O=d.jsx(wmn,{renderListItem:t.renderListItem,block:t.textBlock,editorElementRef:n,focused:a,level:A,path:D,selected:s,value:t.textBlock.listItem,schemaType:j,children:u}),e[25]=u,e[26]=a,e[27]=j,e[28]=t.renderListItem,e[29]=t.textBlock,e[30]=s,e[31]=A,e[32]=D,e[33]=O):O=e[33],u=O}else console.error(`Unable to find Schema type for text block list item ${t.textBlock.listItem}`)}const f=t.attributes;let h;e[34]!==t.textBlock.style?(h=t.textBlock.style?[`pt-text-block-style-${t.textBlock.style}`]:[],e[34]=t.textBlock.style,e[35]=h):h=e[35];let p;e[36]!==t.textBlock.level||e[37]!==t.textBlock.listItem?(p=t.textBlock.listItem?["pt-list-item",`pt-list-item-${t.textBlock.listItem}`,`pt-list-item-level-${t.textBlock.level??1}`]:[],e[36]=t.textBlock.level,e[37]=t.textBlock.listItem,e[38]=p):p=e[38];let m;e[39]!==h||e[40]!==p?(m=["pt-block","pt-text-block",...h,...p],e[39]=h,e[40]=p,e[41]=m):m=e[41];const g=m.join(" ");let y;e[42]!==t.textBlock.listItem?(y=t.textBlock.listItem!==void 0?{"data-list-item":t.textBlock.listItem}:{},e[42]=t.textBlock.listItem,e[43]=y):y=e[43];let b;e[44]!==t.textBlock.level?(b=t.textBlock.level!==void 0?{"data-level":t.textBlock.level}:{},e[44]=t.textBlock.level,e[45]=b):b=e[45];let v;e[46]!==t.textBlock.style?(v=t.textBlock.style!==void 0?{"data-style":t.textBlock.style}:{},e[46]=t.textBlock.style,e[47]=v):v=e[47];let x;e[48]!==c?(x=c!==void 0?{"data-list-index":c}:{},e[48]=c,e[49]=x):x=e[49];let C;e[50]!==t.dropPosition?(C=t.dropPosition==="start"?d.jsx(PN,{}):null,e[50]=t.dropPosition,e[51]=C):C=e[51];let w;e[52]!==u||e[53]!==a||e[54]!==t.legacySchema||e[55]!==t.renderBlock||e[56]!==t.textBlock||e[57]!==s?(w=t.renderBlock?d.jsx(Cmn,{renderBlock:t.renderBlock,editorElementRef:n,focused:a,level:t.textBlock.level,listItem:t.textBlock.listItem,path:[{_key:t.textBlock._key}],selected:s,schemaType:t.legacySchema.block,style:t.textBlock.style,type:t.legacySchema.block,value:t.textBlock,children:u}):u,e[52]=u,e[53]=a,e[54]=t.legacySchema,e[55]=t.renderBlock,e[56]=t.textBlock,e[57]=s,e[58]=w):w=e[58];let _;e[59]!==w?(_=d.jsx("div",{ref:n,children:w}),e[59]=w,e[60]=_):_=e[60];let S;e[61]!==t.dropPosition?(S=t.dropPosition==="end"?d.jsx(PN,{}):null,e[61]=t.dropPosition,e[62]=S):S=e[62];let k;return e[63]!==t.attributes||e[64]!==t.spellCheck||e[65]!==t.textBlock._key||e[66]!==t.textBlock._type||e[67]!==x||e[68]!==C||e[69]!==_||e[70]!==S||e[71]!==g||e[72]!==y||e[73]!==b||e[74]!==v?(k=d.jsxs("div",{...f,className:g,spellCheck:t.spellCheck,"data-block-key":t.textBlock._key,"data-block-name":t.textBlock._type,"data-block-type":"text",...y,...b,...v,...x,children:[C,_,S]}),e[63]=t.attributes,e[64]=t.spellCheck,e[65]=t.textBlock._key,e[66]=t.textBlock._type,e[67]=x,e[68]=C,e[69]=_,e[70]=S,e[71]=g,e[72]=y,e[73]=b,e[74]=v,e[75]=k):k=e[75],k}function Cmn({renderBlock:t,children:e,editorElementRef:n,focused:r,level:i,listItem:o,path:s,selected:a,style:l,schemaType:c,type:u,value:f}){return t({children:e,editorElementRef:n,focused:r,level:i,listItem:o,path:s,selected:a,style:l,schemaType:c,type:u,value:f})}function wmn({renderListItem:t,block:e,children:n,editorElementRef:r,focused:i,level:o,path:s,schemaType:a,selected:l,value:c}){return t({block:e,children:n,editorElementRef:r,focused:i,level:o,path:s,schemaType:a,selected:l,value:c})}function _mn({renderStyle:t,block:e,children:n,editorElementRef:r,focused:i,path:o,schemaType:s,selected:a,value:l}){return t({block:e,children:n,editorElementRef:r,focused:i,path:o,schemaType:s,selected:a,value:l})}function Smn(t){const e=H.c(36),n=E.useContext(a6),r=$9(n,Emn),i=$9(n,kmn),o=Uf();if("__inline"in t.element&&t.element.__inline===!0){let u;return e[0]!==i||e[1]!==t.attributes||e[2]!==t.children||e[3]!==t.element||e[4]!==t.readOnly||e[5]!==t.renderChild||e[6]!==r?(u=d.jsx(bmn,{attributes:t.attributes,element:t.element,legacySchema:i,readOnly:t.readOnly,renderChild:t.renderChild,schema:r,children:t.children}),e[0]=i,e[1]=t.attributes,e[2]=t.children,e[3]=t.element,e[4]=t.readOnly,e[5]=t.renderChild,e[6]=r,e[7]=u):u=e[7],u}let s,a;if(e[8]!==t.element._key||e[9]!==r||e[10]!==o.blockIndexMap||e[11]!==o.value){const u=o.blockIndexMap.get(t.element._key);s=u!==void 0?o.value.at(u):void 0,a=qn({schema:r},s),e[8]=t.element._key,e[9]=r,e[10]=o.blockIndexMap,e[11]=o.value,e[12]=s,e[13]=a}else s=e[12],a=e[13];if(a){const u=t.dropPosition?.blockKey===t.element._key?t.dropPosition.positionBlock:void 0;let f;return e[14]!==s||e[15]!==i||e[16]!==t.attributes||e[17]!==t.children||e[18]!==t.element||e[19]!==t.readOnly||e[20]!==t.renderBlock||e[21]!==t.renderListItem||e[22]!==t.renderStyle||e[23]!==t.spellCheck||e[24]!==u?(f=d.jsx(xmn,{attributes:t.attributes,dropPosition:u,element:t.element,legacySchema:i,readOnly:t.readOnly,renderBlock:t.renderBlock,renderListItem:t.renderListItem,renderStyle:t.renderStyle,spellCheck:t.spellCheck,textBlock:s,children:t.children}),e[14]=s,e[15]=i,e[16]=t.attributes,e[17]=t.children,e[18]=t.element,e[19]=t.readOnly,e[20]=t.renderBlock,e[21]=t.renderListItem,e[22]=t.renderStyle,e[23]=t.spellCheck,e[24]=u,e[25]=f):f=e[25],f}const l=t.dropPosition?.blockKey===t.element._key?t.dropPosition.positionBlock:void 0;let c;return e[26]!==s||e[27]!==i||e[28]!==t.attributes||e[29]!==t.children||e[30]!==t.element||e[31]!==t.readOnly||e[32]!==t.renderBlock||e[33]!==r||e[34]!==l?(c=d.jsx(gmn,{attributes:t.attributes,blockObject:s,dropPosition:l,element:t.element,legacySchema:i,readOnly:t.readOnly,renderBlock:t.renderBlock,schema:r,children:t.children}),e[26]=s,e[27]=i,e[28]=t.attributes,e[29]=t.children,e[30]=t.element,e[31]=t.readOnly,e[32]=t.renderBlock,e[33]=r,e[34]=l,e[35]=c):c=e[35],c}function kmn(t){return t.context.getLegacySchema()}function Emn(t){return t.context.schema}function Tmn(t){const e=H.c(36),n=Uf(),r=E.useContext(a6),i=$9(r,jmn),o=E.useRef(null),s=t.children.props.parent,a=s&&n.isTextBlock(s)?s:void 0;let l;e[0]!==a||e[1]!==t.leaf._key?(l=a?[{_key:a._key},"children",{_key:t.leaf._key}]:void 0,e[0]=a,e[1]=t.leaf._key,e[2]=l):l=e[2];const c=l,u=E.useContext(QR);let f,h;if(e[3]!==c||e[4]!==u){const b=c?AH(c):void 0;f=b?u.focusedChildPath===b:!1,h=b?u.selectedChildPaths.has(b):!1,e[3]=c,e[4]=u,e[5]=f,e[6]=h}else f=e[5],h=e[6];const p=h;let m,g;if(e[7]!==a||e[8]!==r||e[9]!==f||e[10]!==i||e[11]!==c||e[12]!==t.children||e[13]!==t.leaf.marks||e[14]!==t.renderAnnotation||e[15]!==t.renderDecorator||e[16]!==p){const b=r.getSnapshot().context.schema.decorators.map(Imn),v=[...new Set((t.leaf.marks??[]).filter(x=>b.includes(x)))];m=(t.leaf.marks??[]).flatMap(x=>{if(b.includes(x))return[];const C=a?.markDefs?.find(w=>w._key===x);return C?[C]:[]}),g=t.children;for(const x of v){const C=i.decorators.find(w=>w.value===x);c&&C&&t.renderDecorator&&(g=d.jsx(Rmn,{renderDecorator:t.renderDecorator,editorElementRef:o,focused:f,path:c,selected:p,schemaType:C,value:x,type:C,children:g}))}for(const x of m){const C=i.annotations.find(w=>w.name===x._type);C&&(a&&c&&t.renderAnnotation?g=d.jsx("span",{ref:o,children:d.jsx(Amn,{renderAnnotation:t.renderAnnotation,block:a,editorElementRef:o,focused:f,path:c,selected:p,schemaType:C,value:x,type:C,children:g})}):g=d.jsx("span",{ref:o,children:g}))}e[7]=a,e[8]=r,e[9]=f,e[10]=i,e[11]=c,e[12]=t.children,e[13]=t.leaf.marks,e[14]=t.renderAnnotation,e[15]=t.renderDecorator,e[16]=p,e[17]=m,e[18]=g}else m=e[17],g=e[18];if(a&&c&&t.renderChild){let b;if(e[19]!==a.children||e[20]!==t.leaf){let x;e[22]!==t.leaf?(x=C=>C._key===t.leaf._key,e[22]=t.leaf,e[23]=x):x=e[23],b=a.children.find(x),e[19]=a.children,e[20]=t.leaf,e[21]=b}else b=e[21];const v=b;if(v){let x;e[24]!==m||e[25]!==v||e[26]!==g||e[27]!==f||e[28]!==i.span||e[29]!==c||e[30]!==t.renderChild||e[31]!==p?(x=d.jsx(Dmn,{renderChild:t.renderChild,annotations:m,editorElementRef:o,focused:f,path:c,schemaType:i.span,selected:p,value:v,type:i.span,children:g}),e[24]=m,e[25]=v,e[26]=g,e[27]=f,e[28]=i.span,e[29]=c,e[30]=t.renderChild,e[31]=p,e[32]=x):x=e[32],g=x}}let y;return e[33]!==g||e[34]!==t.attributes?(y=d.jsx("span",{...t.attributes,ref:o,children:g}),e[33]=g,e[34]=t.attributes,e[35]=y):y=e[35],y}function Imn(t){return t.name}function jmn(t){return t.context.getLegacySchema()}function Amn({renderAnnotation:t,block:e,children:n,editorElementRef:r,focused:i,path:o,schemaType:s,selected:a,value:l,type:c}){return t({block:e,children:n,editorElementRef:r,focused:i,path:o,schemaType:s,selected:a,value:l,type:c})}function Rmn({renderDecorator:t,children:e,editorElementRef:n,focused:r,path:i,schemaType:o,selected:s,value:a,type:l}){return t({children:e,editorElementRef:n,focused:r,path:i,schemaType:o,selected:s,value:a,type:l})}function Dmn({renderChild:t,annotations:e,children:n,editorElementRef:r,focused:i,path:o,schemaType:s,selected:a,value:l,type:c}){return t({annotations:e,children:n,editorElementRef:r,focused:i,path:o,schemaType:s,selected:a,value:l,type:c})}const Omn={position:"absolute",userSelect:"none",pointerEvents:"none",left:0,right:0};function Pmn(t){const e=H.c(12),n=E.useContext(a6),r=$9(n,$mn);if(t.leaf._type!==r.span.name)return t.children;let i;e[0]!==t?(i=d.jsx(Tmn,{...t}),e[0]=t,e[1]=i):i=e[1];let o=i;if(t.renderPlaceholder&&t.leaf.placeholder&&t.text.text===""){let a;e[2]!==t.renderPlaceholder?(a=t.renderPlaceholder(),e[2]=t.renderPlaceholder,e[3]=a):a=e[3];let l;e[4]!==a?(l=d.jsx("span",{style:Omn,contentEditable:!1,children:a}),e[4]=a,e[5]=l):l=e[5];let c;return e[6]!==o||e[7]!==l?(c=d.jsxs(d.Fragment,{children:[l,o]}),e[6]=o,e[7]=l,e[8]=c):c=e[8],c}const s=t.leaf.rangeDecoration;if(s){let a;e[9]!==s||e[10]!==o?(a=s.component({children:o}),e[9]=s,e[10]=o,e[11]=a):a=e[11],o=a}return o}function $mn(t){return t.context.schema}function Mmn(t){const e=H.c(5);let n;return e[0]!==t.attributes||e[1]!==t.children||e[2]!==t.text._key||e[3]!==t.text._type?(n=d.jsx("span",{...t.attributes,"data-child-key":t.text._key,"data-child-name":t.text._type,"data-child-type":"span",children:t.children}),e[0]=t.attributes,e[1]=t.children,e[2]=t.text._key,e[3]=t.text._type,e[4]=n):n=e[4],n}function Yj(t){return{id:ug(),name:t?.name,reference:t?.reference}}const $N=Yj({name:"core"});function tse({eventSelection:t,snapshot:e}){let n=t;if(xw({...e,context:{...e.context,selection:t}}))return n;const r=hl({context:{...e.context,selection:t}}),i=$s({...e,context:{...e.context,selection:t}}),o=Sg({...e,context:{...e.context,selection:t}});r&&i&&o&&(n={anchor:Nh({context:e.context,block:i}),focus:yd({context:e.context,block:i})});const s=V0(e);if(e.context.selection&&cm(e)&&s.length>1){const a=wv(e),l=Cv(e);if(!a||!l)return n;const c=Nh({context:e.context,block:a}),u=yd({context:e.context,block:l});JM(t)({...e,context:{...e.context,selection:{anchor:c,focus:u}}})&&(n={anchor:c,focus:u})}return n}function Lmn({setDropPosition:t}){return[{behavior:{on:"drag.dragover",guard:({snapshot:e,event:n})=>{const r=B0({...e,context:{...e.context,selection:n.position.selection}});if(!r)return!1;const i=n.dragOrigin;if(!i)return!1;const o=tse({eventSelection:i.selection,snapshot:e});return V0({...e,context:{...e.context,selection:o}}).some(s=>s.node._key===r.node._key)||!Loe({...e,context:{...e.context,selection:o}})?!1:{dropFocusBlock:r}},actions:[({event:e},{dropFocusBlock:n})=>[{type:"effect",effect:()=>{t({blockKey:n.node._key,positionBlock:e.position.block})}}]]},priority:Yj({reference:{priority:$N,importance:"lower"}})},{behavior:{on:"drag.*",guard:({event:e})=>e.type!=="drag.dragover",actions:[({event:e})=>[{type:"effect",effect:()=>{t(void 0)}},v0(e)]]},priority:Yj({reference:{priority:$N,importance:"lower"}})}]}function Fmn(){const t=H.c(3),e=E.useContext(a6),[n,r]=E.useState();let i,o;return t[0]!==e?(i=()=>{const s=Lmn({setDropPosition:r});for(const a of s)e.send({type:"add behavior",behaviorConfig:a});return()=>{for(const a of s)e.send({type:"remove behavior",behaviorConfig:a})}},o=[e,r],t[0]=e,t[1]=i,t[2]=o):(i=t[1],o=t[2]),E.useEffect(i,o),n}const ktt=E.createContext(null),uu=()=>{const t=E.useContext(ktt);if(!t)throw new Error("The `usePortableTextEditor` hook must be used inside the component's context.");return t},Ett=lm({guards:{"pending operations":({context:t})=>t.slateEditor.operations.length>0}}),Cke=Ett.createAction(({context:t,event:e})=>{Bmn(t.slateEditor,e.editorElement)}),Nmn=Ett.createMachine({id:"validate selection",context:({input:t})=>({slateEditor:t.slateEditor}),initial:"idle",states:{idle:{on:{"validate selection":[{guard:"pending operations",target:"waiting"},{actions:[Cke],target:"idle"}]}},waiting:{after:{0:[{guard:"pending operations",target:".",reenter:!0},{target:"idle",actions:[Cke]}]},on:{"validate selection":{target:".",reenter:!0}}}}});function Bmn(t,e){if(!t.selection)return;let n;try{n=Rn.findDocumentOrShadowRoot(t)}catch{}if(!n||e!==n.activeElement)return;const r=Rn.getWindow(t).getSelection();if(!r||r.rangeCount===0)return;const i=r.getRangeAt(0);try{const o=Rn.toDOMRange(t,t.selection);(o.startOffset!==i.startOffset||o.endOffset!==i.endOffset)&&(Yn.selection("DOM range out of sync, validating selection"),r?.removeAllRanges(),r.addRange(o))}catch{Yn.selection("Could not resolve selection, selecting top document"),wt.deselect(t),t.children.length>0&&wt.select(t,De.start(t,[])),t.onChange()}}const RH=E.forwardRef(function(t,e){const n=H.c(179);let r,i,o,s,a,l,c,u,f,h,p,m,g,y,b,v,x,C,w,_,S,k,I,j,A,D,O;n[0]!==t?({hotkeys:r,onBlur:o,onFocus:y,onBeforeInput:i,onPaste:b,onCopy:a,onCut:l,onClick:s,onDragStart:m,onDrag:c,onDragEnd:u,onDragEnter:f,onDragOver:p,onDrop:g,onDragLeave:h,rangeDecorations:x,renderAnnotation:C,renderBlock:w,renderChild:_,renderDecorator:S,renderListItem:k,renderPlaceholder:I,renderStyle:j,selection:v,scrollSelectionIntoView:D,spellCheck:O,...A}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=a,n[6]=l,n[7]=c,n[8]=u,n[9]=f,n[10]=h,n[11]=p,n[12]=m,n[13]=g,n[14]=y,n[15]=b,n[16]=v,n[17]=x,n[18]=C,n[19]=w,n[20]=_,n[21]=S,n[22]=k,n[23]=I,n[24]=j,n[25]=A,n[26]=D,n[27]=O):(r=n[1],i=n[2],o=n[3],s=n[4],a=n[5],l=n[6],c=n[7],u=n[8],f=n[9],h=n[10],p=n[11],m=n[12],g=n[13],y=n[14],b=n[15],v=n[16],x=n[17],C=n[18],w=n[19],_=n[20],S=n[21],k=n[22],I=n[23],j=n[24],A=n[25],D=n[26],O=n[27]);const P=uu(),[$,M]=E.useState(!1),L=E.useContext(a6),B=E.useContext(_tt),W=$9(L,zmn),N=btt();let V;n[28]!==N?(V={input:{slateEditor:N}},n[28]=N,n[29]=V):V=n[29];const G=xN(Nmn,V);let z;n[30]!==x?(z=x??[],n[30]=x,n[31]=z):z=n[31];let Y;n[32]!==L?(Y=L.getSnapshot(),n[32]=L,n[33]=Y):Y=n[33];const Z=Y.context.schema;let ee;n[34]!==L?(ee=L.getSnapshot().matches({setup:"setting up"}),n[34]=L,n[35]=ee):ee=n[35];const K=!ee;let q;n[36]!==W||n[37]!==N||n[38]!==z||n[39]!==Y.context.schema||n[40]!==K?(q={input:{rangeDecorations:z,readOnly:W,schema:Z,slateEditor:N,skipSetup:K}},n[36]=W,n[37]=N,n[38]=z,n[39]=Y.context.schema,n[40]=K,n[41]=q):q=n[41];const re=xN(fmn,q),te=$9(re,Hmn),ae=Fmn();let se,le;n[42]!==re||n[43]!==W?(se=()=>{re.send({type:"update read only",readOnly:W})},le=[re,W],n[42]=re,n[43]=W,n[44]=se,n[45]=le):(se=n[44],le=n[45]),E.useEffect(se,le);let pe,be;n[46]!==x||n[47]!==re?(be=()=>{re.send({type:"range decorations updated",rangeDecorations:x??[]})},pe=[re,x],n[46]=x,n[47]=re,n[48]=pe,n[49]=be):(pe=n[48],be=n[49]),E.useEffect(be,pe);let xe;n[50]!==ae||n[51]!==W||n[52]!==w||n[53]!==_||n[54]!==k||n[55]!==j||n[56]!==O?(xe=gt=>d.jsx(Smn,{...gt,dropPosition:ae,readOnly:W,renderBlock:w,renderChild:_,renderListItem:k,renderStyle:j,spellCheck:O}),n[50]=ae,n[51]=W,n[52]=w,n[53]=_,n[54]=k,n[55]=j,n[56]=O,n[57]=xe):xe=n[57];const Ce=xe;let Te;n[58]!==W||n[59]!==C||n[60]!==_||n[61]!==S||n[62]!==I?(Te=gt=>d.jsx(Pmn,{...gt,readOnly:W,renderAnnotation:C,renderChild:_,renderDecorator:S,renderPlaceholder:I}),n[58]=W,n[59]=C,n[60]=_,n[61]=S,n[62]=I,n[63]=Te):Te=n[63];const _e=Te,Ie=Umn;let ye;n[64]!==L||n[65]!==v||n[66]!==N?(ye=()=>{if(v){Yn.selection(`Selection from props ${JSON.stringify(v)}`);const gt=Khn(v,N.value);if(gt!==null){Yn.selection(`Normalized selection from props ${JSON.stringify(gt)}`);const _n=p1({context:{schema:L.getSnapshot().context.schema,value:N.value,selection:gt},blockIndexMap:N.blockIndexMap});_n&&(wt.select(N,_n),N.operations.some(Wmn)||L.send({type:"update selection",selection:gt}),N.onChange())}}},n[64]=L,n[65]=v,n[66]=N,n[67]=ye):ye=n[67];const fe=ye;let ve,Se;n[68]!==L||n[69]!==re||n[70]!==fe?(ve=()=>{const gt=L.on("ready",()=>{re.send({type:"ready"}),fe()}),_n=L.on("invalid value",()=>{M(!0)}),Xt=L.on("value changed",()=>{M(!1)});return()=>{gt.unsubscribe(),_n.unsubscribe(),Xt.unsubscribe()}},Se=[re,L,fe],n[68]=L,n[69]=re,n[70]=fe,n[71]=ve,n[72]=Se):(ve=n[71],Se=n[72]),E.useEffect(ve,Se);let Ee,je;n[73]!==$||n[74]!==v||n[75]!==fe?(Ee=()=>{v&&!$&&fe()},je=[$,v,fe],n[73]=$,n[74]=v,n[75]=fe,n[76]=Ee,n[77]=je):(Ee=n[76],je=n[77]),E.useEffect(Ee,je);let Me;n[78]!==L||n[79]!==a||n[80]!==N?(Me=gt=>{if(a)a(gt)!==void 0&>.preventDefault();else if(gt.nativeEvent.clipboardData){gt.stopPropagation(),gt.preventDefault();const _n=N.selection?Ph({schema:L.getSnapshot().context.schema,editor:N,range:N.selection}):void 0,Xt=_n?{selection:_n}:void 0;if(!Xt){console.warn("Could not find position for copy event");return}L.send({type:"behavior event",behaviorEvent:{type:"clipboard.copy",originEvent:{dataTransfer:gt.nativeEvent.clipboardData},position:Xt},editor:N,nativeEvent:gt})}},n[78]=L,n[79]=a,n[80]=N,n[81]=Me):Me=n[81];const Fe=Me;let $e;n[82]!==L||n[83]!==l||n[84]!==N?($e=gt=>{if(l)l(gt)!==void 0&>.preventDefault();else if(gt.nativeEvent.clipboardData){gt.stopPropagation(),gt.preventDefault();const _n=L.getSnapshot().context.selection,Xt=_n?{selection:_n}:void 0;if(!Xt){console.warn("Could not find position for cut event");return}L.send({type:"behavior event",behaviorEvent:{type:"clipboard.cut",originEvent:{dataTransfer:gt.nativeEvent.clipboardData},position:Xt},editor:N,nativeEvent:gt})}},n[82]=L,n[83]=l,n[84]=N,n[85]=$e):$e=n[85];const Ye=$e;let qe;n[86]!==L||n[87]!==b||n[88]!==P||n[89]!==B||n[90]!==N?(qe=gt=>{const _n=N.value,Xt=(N.selection?Ph({schema:L.getSnapshot().context.schema,editor:N,range:N.selection}):null)?.focus.path||[],An=b?.({event:gt,value:_n,path:Xt,schemaTypes:P.schemaTypes});if(An||!N.selection)gt.preventDefault(),B.send({type:"loading"}),Promise.resolve(An).then(Bn=>{if(Yn.behaviors("Custom paste function from client resolved",Bn),!Bn||!Bn.insert){Yn.behaviors("No result from custom paste handler, pasting normally");const Vn=L.getSnapshot().context.selection,ir=Vn?{selection:Vn}:void 0;if(!ir){console.warn("Could not find position for paste event");return}L.send({type:"behavior event",behaviorEvent:{type:"clipboard.paste",originEvent:{dataTransfer:gt.clipboardData},position:ir},editor:N,nativeEvent:gt})}else Bn.insert?L.send({type:"behavior event",behaviorEvent:{type:"insert.blocks",blocks:$nn({context:{keyGenerator:L.getSnapshot().context.keyGenerator,schema:L.getSnapshot().context.schema},blocks:Bn.insert,options:{normalize:!1,removeUnusedMarkDefs:!0,validateFields:!1}}),placement:"auto"},editor:N}):console.warn("Your onPaste function returned something unexpected:",Bn)}).catch(qmn).finally(()=>{B.send({type:"done loading"})});else if(gt.nativeEvent.clipboardData){gt.preventDefault(),gt.stopPropagation();const Bn=L.getSnapshot().context.selection,Vn=Bn?{selection:Bn}:void 0;if(!Vn){console.warn("Could not find position for paste event");return}L.send({type:"behavior event",behaviorEvent:{type:"clipboard.paste",originEvent:{dataTransfer:gt.nativeEvent.clipboardData},position:Vn},editor:N,nativeEvent:gt})}Yn.behaviors("No result from custom paste handler, pasting normally")},n[86]=L,n[87]=b,n[88]=P,n[89]=B,n[90]=N,n[91]=qe):qe=n[91];const He=qe;let Ge;n[92]!==L||n[93]!==y||n[94]!==B||n[95]!==N?(Ge=gt=>{y&&y(gt),gt.isDefaultPrevented()||(B.send({type:"focused",event:gt}),!N.selection&&N.children.length===1&&c1(L.getSnapshot().context,N.value.at(0))&&(wt.select(N,De.start(N,[])),N.onChange()))},n[92]=L,n[93]=y,n[94]=B,n[95]=N,n[96]=Ge):Ge=n[96];const Ze=Ge;let nt;n[97]!==L||n[98]!==s||n[99]!==N?(nt=gt=>{if(s&&s(gt),gt.isDefaultPrevented()||gt.isPropagationStopped())return;const _n=ub({editorActor:L,slateEditor:N,event:gt.nativeEvent});_n&&L.send({type:"behavior event",behaviorEvent:{type:"mouse.click",position:_n},editor:N,nativeEvent:gt})},n[97]=L,n[98]=s,n[99]=N,n[100]=nt):nt=n[100];const Le=nt;let Ne;n[101]!==o||n[102]!==B?(Ne=gt=>{o&&o(gt),gt.isPropagationStopped()||B.send({type:"blurred",event:gt})},n[101]=o,n[102]=B,n[103]=Ne):Ne=n[103];const tt=Ne;let ot;n[104]!==i?(ot=gt=>{i&&i(gt)},n[104]=i,n[105]=ot):ot=n[105];const rt=ot;let dt;n[106]!==L||n[107]!==r||n[108]!==P||n[109]!==t||n[110]!==N?(dt=gt=>{t.onKeyDown&&t.onKeyDown(gt),gt.isDefaultPrevented()||cmn({editorActor:L,editor:N,portableTextEditor:P,hotkeys:r??{},event:gt}),gt.isDefaultPrevented()||L.send({type:"behavior event",behaviorEvent:{type:"keyboard.keydown",originEvent:{key:gt.key,code:gt.code,altKey:gt.altKey,ctrlKey:gt.ctrlKey,metaKey:gt.metaKey,shiftKey:gt.shiftKey}},editor:N,nativeEvent:gt})},n[106]=L,n[107]=r,n[108]=P,n[109]=t,n[110]=N,n[111]=dt):dt=n[111];const mt=dt;let ht;n[112]!==L||n[113]!==t||n[114]!==N?(ht=gt=>{t.onKeyUp&&t.onKeyUp(gt),gt.isDefaultPrevented()||L.send({type:"behavior event",behaviorEvent:{type:"keyboard.keyup",originEvent:{key:gt.key,code:gt.code,altKey:gt.altKey,ctrlKey:gt.ctrlKey,metaKey:gt.metaKey,shiftKey:gt.shiftKey}},editor:N,nativeEvent:gt})},n[112]=L,n[113]=t,n[114]=N,n[115]=ht):ht=n[115];const ft=ht;let at;e:{if(D===void 0){at=void 0;break e}if(D===null){at=Vmn;break e}let gt;n[116]!==P||n[117]!==D?(gt=(_n,Xt)=>{D(P,Xt)},n[116]=P,n[117]=D,n[118]=gt):gt=n[118],at=gt}const et=at;let xt,lt;n[119]!==L||n[120]!==N?(xt=()=>{const gt=Rn.getWindow(N),_n=()=>{L.send({type:"dragend"})},Xt=()=>{L.send({type:"drop"})};return gt.document.addEventListener("dragend",_n),gt.document.addEventListener("drop",Xt),()=>{gt.document.removeEventListener("dragend",_n),gt.document.removeEventListener("drop",Xt)}},lt=[N,L],n[119]=L,n[120]=N,n[121]=xt,n[122]=lt):(xt=n[121],lt=n[122]),E.useEffect(xt,lt);let Ct;n[123]!==L||n[124]!==m||n[125]!==N?(Ct=gt=>{if(m?.(gt),gt.isDefaultPrevented()||gt.isPropagationStopped())return;const _n=ub({editorActor:L,slateEditor:N,event:gt.nativeEvent});if(!_n){console.warn("Could not find position for dragstart event");return}return L.send({type:"dragstart",origin:_n}),L.send({type:"behavior event",behaviorEvent:{type:"drag.dragstart",originEvent:{clientX:gt.clientX,clientY:gt.clientY,dataTransfer:gt.dataTransfer},position:_n},editor:N}),!0},n[123]=L,n[124]=m,n[125]=N,n[126]=Ct):Ct=n[126];const Dt=Ct;let Ot;n[127]!==L||n[128]!==c||n[129]!==N?(Ot=gt=>{if(c?.(gt),!(gt.isDefaultPrevented()||gt.isPropagationStopped()||!ub({editorActor:L,slateEditor:N,event:gt.nativeEvent})))return L.send({type:"behavior event",behaviorEvent:{type:"drag.drag",originEvent:{dataTransfer:gt.dataTransfer}},editor:N}),!0},n[127]=L,n[128]=c,n[129]=N,n[130]=Ot):Ot=n[130];const Rt=Ot;let Nt;n[131]!==L||n[132]!==u||n[133]!==N?(Nt=gt=>{if(u?.(gt),!(gt.isDefaultPrevented()||gt.isPropagationStopped()))return L.send({type:"behavior event",behaviorEvent:{type:"drag.dragend",originEvent:{dataTransfer:gt.dataTransfer}},editor:N}),!0},n[131]=L,n[132]=u,n[133]=N,n[134]=Nt):Nt=n[134];const Mt=Nt;let Gt;n[135]!==L||n[136]!==f||n[137]!==N?(Gt=gt=>{if(f?.(gt),gt.isDefaultPrevented()||gt.isPropagationStopped())return;const _n=ub({editorActor:L,slateEditor:N,event:gt.nativeEvent});if(_n)return L.send({type:"behavior event",behaviorEvent:{type:"drag.dragenter",originEvent:{dataTransfer:gt.dataTransfer},position:_n},editor:N}),!0},n[135]=L,n[136]=f,n[137]=N,n[138]=Gt):Gt=n[138];const en=Gt;let Yt;n[139]!==L||n[140]!==p||n[141]!==N?(Yt=gt=>{if(p?.(gt),gt.isDefaultPrevented()||gt.isPropagationStopped())return;const _n=ub({editorActor:L,slateEditor:N,event:gt.nativeEvent});if(_n)return L.send({type:"behavior event",behaviorEvent:{type:"drag.dragover",originEvent:{dataTransfer:gt.dataTransfer},dragOrigin:L.getSnapshot().context.internalDrag?.origin,position:_n},editor:N,nativeEvent:gt}),!0},n[139]=L,n[140]=p,n[141]=N,n[142]=Yt):Yt=n[142];const zt=Yt;let jt;n[143]!==L||n[144]!==g||n[145]!==N?(jt=gt=>{if(g?.(gt),gt.isDefaultPrevented()||gt.isPropagationStopped())return;const _n=ub({editorActor:L,slateEditor:N,event:gt.nativeEvent});if(!_n){console.warn("Could not find position for drop event");return}return L.send({type:"behavior event",behaviorEvent:{type:"drag.drop",originEvent:{dataTransfer:gt.dataTransfer},dragOrigin:L.getSnapshot().context.internalDrag?.origin,position:_n},editor:N,nativeEvent:gt}),!0},n[143]=L,n[144]=g,n[145]=N,n[146]=jt):jt=n[146];const un=jt;let yn;n[147]!==L||n[148]!==h||n[149]!==N?(yn=gt=>{if(h?.(gt),!(gt.isDefaultPrevented()||gt.isPropagationStopped()||!ub({editorActor:L,slateEditor:N,event:gt.nativeEvent})))return L.send({type:"behavior event",behaviorEvent:{type:"drag.dragleave",originEvent:{dataTransfer:gt.dataTransfer}},editor:N}),!0},n[147]=L,n[148]=h,n[149]=N,n[150]=yn):yn=n[150];const bn=yn;let In;n[151]!==e||n[152]!==G?(In=gt=>{if(typeof e=="function"?e(gt):e&&(e.current=gt),gt){const _n=new MutationObserver(()=>{G.send({type:"validate selection",editorElement:gt})});return _n.observe(gt,{attributeOldValue:!1,attributes:!1,characterData:!1,childList:!0,subtree:!0}),()=>{_n.disconnect()}}},n[151]=e,n[152]=G,n[153]=In):In=n[153];const Jn=In;if(!P)return null;let gn;return n[154]!==Jn||n[155]!==te||n[156]!==Le||n[157]!==Fe||n[158]!==Ye||n[159]!==Rt||n[160]!==Mt||n[161]!==en||n[162]!==bn||n[163]!==zt||n[164]!==Dt||n[165]!==un||n[166]!==mt||n[167]!==ft||n[168]!==rt||n[169]!==tt||n[170]!==Ze||n[171]!==He||n[172]!==$||n[173]!==W||n[174]!==Ce||n[175]!==_e||n[176]!==A||n[177]!==et?(gn=$?null:d.jsx(hmn,{children:d.jsx(Wpn,{...A,ref:Jn,"data-read-only":W,autoFocus:!1,className:A.className||"pt-editable",decorate:te,onBlur:tt,onCopy:Fe,onCut:Ye,onClick:Le,onDOMBeforeInput:rt,onDragStart:Dt,onDrag:Rt,onDragEnd:Mt,onDragEnter:en,onDragOver:zt,onDrop:un,onDragLeave:bn,onFocus:Ze,onKeyDown:mt,onKeyUp:ft,onPaste:He,readOnly:W,renderPlaceholder:void 0,renderElement:Ce,renderLeaf:_e,renderText:Ie,scrollSelectionIntoView:et})}),n[154]=Jn,n[155]=te,n[156]=Le,n[157]=Fe,n[158]=Ye,n[159]=Rt,n[160]=Mt,n[161]=en,n[162]=bn,n[163]=zt,n[164]=Dt,n[165]=un,n[166]=mt,n[167]=ft,n[168]=rt,n[169]=tt,n[170]=Ze,n[171]=He,n[172]=$,n[173]=W,n[174]=Ce,n[175]=_e,n[176]=A,n[177]=et,n[178]=gn):gn=n[178],gn});RH.displayName="ForwardRef(PortableTextEditable)";function Vmn(){}function zmn(t){return t.matches({"edit mode":"read only"})}function Hmn(t){return t.context.decorate?.fn}function Umn(t){return d.jsx(Mmn,{...t})}function Wmn(t){return t.type==="set_selection"}function qmn(t){return console.warn(t),t}const Ttt=(t,e)=>{e(t);const n=t.getSnapshot().children;n&&Object.values(n).forEach(r=>{Ttt(r,e)})};function YP(t){const e=[];Ttt(t,r=>{e.push([r,r.getSnapshot()]),r.observers=new Set});const n=t.system.getSnapshot?.();t.stop(),t.system._snapshot=n,e.forEach(([r,i])=>{r._processingStatus=0,r._snapshot=i})}const Gmn={mimeType:"application/json",serialize:({snapshot:t,event:e})=>{const n=t.context.converters.find(r=>r.mimeType==="application/x-portable-text");return n?{...n.serialize({snapshot:t,event:e}),mimeType:"application/json",originEvent:e.originEvent}:{type:"serialization.failure",mimeType:"application/json",originEvent:e.originEvent,reason:"No application/x-portable-text Converter found"}},deserialize:({snapshot:t,event:e})=>{const n=t.context.converters.find(r=>r.mimeType==="application/x-portable-text");return n?{...n.deserialize({snapshot:t,event:e}),mimeType:"application/json"}:{type:"deserialization.failure",mimeType:"application/json",reason:"No application/x-portable-text Converter found"}}},Ymn={mimeType:"application/x-portable-text",serialize:({snapshot:t,event:e})=>{if(!t.context.selection)return{type:"serialization.failure",mimeType:"application/x-portable-text",originEvent:e.originEvent,reason:"No selection"};const n=v7(t);return n.length===0?{type:"serialization.failure",mimeType:"application/x-portable-text",reason:"No blocks serialized",originEvent:e.originEvent}:{type:"serialization.success",data:JSON.stringify(n),mimeType:"application/x-portable-text",originEvent:e.originEvent}},deserialize:({snapshot:t,event:e})=>{const n=JSON.parse(e.data);if(!Array.isArray(n))return{type:"deserialization.failure",mimeType:"application/x-portable-text",reason:"Data is not an array"};const r=n.flatMap(i=>{const o=b0({context:t.context,block:i,options:{normalize:!1,removeUnusedMarkDefs:!0,validateFields:!1}});return o?[o]:[]});return r.length===0&&n.length>0?{type:"deserialization.failure",mimeType:"application/x-portable-text",reason:"No blocks were parsed"}:{type:"deserialization.success",data:r,mimeType:"application/x-portable-text"}}};function Kmn(t){return{mimeType:"text/html",serialize:({snapshot:e,event:n})=>{if(!e.context.selection)return{type:"serialization.failure",mimeType:"text/html",originEvent:n.originEvent,reason:"No selection"};const r=v7(e),i=Voe(r,{onMissingComponent:!1,components:{unknownType:({children:o})=>o!==void 0?`${o}`:""}});return i===""?{type:"serialization.failure",mimeType:"text/html",originEvent:n.originEvent,reason:"Serialized HTML is empty"}:{type:"serialization.success",data:i,mimeType:"text/html",originEvent:n.originEvent}},deserialize:({snapshot:e,event:n})=>{const r=yH(n.data,t.portableText,{keyGenerator:e.context.keyGenerator,unstable_whitespaceOnPasteMode:t.block.options.unstable_whitespaceOnPasteMode}).flatMap(i=>{const o=b0({context:e.context,block:i,options:{normalize:!1,removeUnusedMarkDefs:!0,validateFields:!1}});return o?[o]:[]});return r.length===0?{type:"deserialization.failure",mimeType:"text/html",reason:"No blocks deserialized"}:{type:"deserialization.success",data:r,mimeType:"text/html"}}}}const Xmn={mimeType:"text/markdown",serialize:({snapshot:t,event:e})=>{if(!t.context.selection)return{type:"serialization.failure",mimeType:"text/markdown",reason:"No selection",originEvent:e.originEvent};const n=v7(t);return{type:"serialization.success",data:Udn(n),mimeType:"text/markdown",originEvent:e.originEvent}},deserialize:({snapshot:t,event:e})=>{const n=Xdn(e.data,{keyGenerator:t.context.keyGenerator,schema:t.context.schema}).flatMap(r=>{const i=b0({context:t.context,block:r,options:{normalize:!1,removeUnusedMarkDefs:!0,validateFields:!1}});return i?[i]:[]});return n.length===0?{type:"deserialization.failure",mimeType:"text/markdown",reason:"No blocks deserialized"}:{type:"deserialization.success",data:n,mimeType:"text/markdown"}}};function Zmn(t){return{mimeType:"text/plain",serialize:({snapshot:e,event:n})=>e.context.selection?{type:"serialization.success",data:v7(e).map(r=>qn(e.context,r)?r.children.map(i=>i._type===e.context.schema.span.name?i.text:n.originEvent==="drag.dragstart"?`[${e.context.schema.inlineObjects.find(o=>o.name===i._type)?.title??"Object"}]`:"").join(""):n.originEvent==="drag.dragstart"?`[${e.context.schema.blockObjects.find(i=>i.name===r._type)?.title??"Object"}]`:"").filter(r=>r!=="").join(` + +`),mimeType:"text/plain",originEvent:n.originEvent}:{type:"serialization.failure",mimeType:"text/plain",originEvent:n.originEvent,reason:"No selection"},deserialize:({snapshot:e,event:n})=>{const r=`${Jmn(n.data).split(/\n{2,}/).map(o=>o?`

    ${o.replace(/(?:\r\n|\r|\n)/g,"
    ")}

    `:"

    ").join("")}`,i=yH(r,t.portableText,{keyGenerator:e.context.keyGenerator}).flatMap(o=>{const s=b0({context:e.context,block:o,options:{normalize:!1,removeUnusedMarkDefs:!0,validateFields:!1}});return s?[s]:[]});return i.length===0?{type:"deserialization.failure",mimeType:"text/plain",reason:"No blocks deserialized"}:{type:"deserialization.success",data:i,mimeType:"text/plain"}}}}const Qmn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Jmn(t){return String(t).replace(/[&<>"'`=/]/g,e=>Qmn[e]??e)}function e0n(t){return[Gmn,Ymn,Xmn,Kmn(t),Zmn(t)]}function t0n(t){return wH.compile({name:"blockTypeSchema",types:[t]}).get(t.name)}function n0n(t,e){const n=e.getSnapshot().context.schema;return{focus:()=>{e.send({type:"focus",editor:t})},blur:()=>{e.send({type:"blur",editor:t})},toggleMark:r=>{e.send({type:"behavior event",behaviorEvent:{type:"decorator.toggle",decorator:r},editor:t})},toggleList:r=>{e.send({type:"behavior event",behaviorEvent:{type:"list item.toggle",listItem:r},editor:t})},toggleBlockStyle:r=>{e.send({type:"behavior event",behaviorEvent:{type:"style.toggle",style:r},editor:t})},isMarkActive:r=>{const i=M4({editorActorSnapshot:e.getSnapshot(),slateEditorInstance:t});return g_(i).includes(r)},marks:()=>{const r=M4({editorActorSnapshot:e.getSnapshot(),slateEditorInstance:t}),i=Pfe(r),o=g_(r);return[...i,...o]},undo:()=>{e.send({type:"behavior event",behaviorEvent:{type:"history.undo"},editor:t})},redo:()=>{e.send({type:"behavior event",behaviorEvent:{type:"history.redo"},editor:t})},select:r=>{const i=p1({context:{schema:e.getSnapshot().context.schema,value:t.value,selection:r},blockIndexMap:t.blockIndexMap});i?wt.select(t,i):wt.deselect(t),t.onChange()},focusBlock:()=>{if(!t.selection)return;const r=t.selection.focus.path.at(0);if(r!==void 0)return t.value.at(r)},focusChild:()=>{if(!t.selection)return;const r=t.selection.focus.path.at(0),i=t.selection.focus.path.at(1),o=r!==void 0?t.value.at(r):void 0;if(o&&qn(e.getSnapshot().context,o))return i===void 0?void 0:o.children.at(i)},insertChild:(r,i)=>(e.send({type:"behavior event",behaviorEvent:{type:"insert.child",child:{_type:r.name,...i||{}}},editor:t}),t.selection?Ph({schema:e.getSnapshot().context.schema,editor:t,range:t.selection})?.focus.path??[]:[]),insertBlock:(r,i)=>(e.send({type:"behavior event",behaviorEvent:{type:"insert.block",block:{_type:r.name,...i||{}},placement:"auto"},editor:t}),t.selection?Ph({schema:e.getSnapshot().context.schema,editor:t,range:t.selection})?.focus.path??[]:[]),hasBlockStyle:r=>{try{return Uhn({editor:t,style:r})}catch{return!1}},hasListStyle:r=>{try{return Hhn({editor:t,listItem:r})}catch{return!1}},isVoid:r=>![n.block.name,n.span.name].includes(r._type),findByPath:r=>{const i=Wa({path:r});if(!i)return[void 0,void 0];const o=t.blockIndexMap.get(i);if(o===void 0)return[void 0,void 0];const s=t.value.at(o);if(!s)return[void 0,void 0];const a=b1({path:r});if(r.length===1&&!a)return[s,[{_key:s._key}]];if(qn(e.getSnapshot().context,s)&&a){const l=s.children.find(c=>c._key===a);if(l)return[l,[{_key:s._key},"children",{_key:l._key}]]}return[void 0,void 0]},findDOMNode:r=>{let i;try{const[o]=Array.from(De.nodes(t,{at:[],match:s=>s._key===r._key})||[])[0]||[void 0];o&&(i=Rn.toDOMNode(t,o))}catch{}return i},activeAnnotations:()=>{if(!t.selection||t.selection.focus.path.length<2)return[];try{const r=[],i=De.nodes(t,{at:t.selection,match:o=>Dn.isText(o)&&o.marks!==void 0&&Array.isArray(o.marks)&&o.marks.length>0});for(const[o,s]of i){const[a]=De.node(t,s,{depth:1});t.isTextBlock(a)&&a.markDefs?.forEach(l=>{Dn.isText(o)&&o.marks&&Array.isArray(o.marks)&&o.marks.includes(l._key)&&r.push(l)})}return r}catch{return[]}},isAnnotationActive:r=>{const i=M4({editorActorSnapshot:e.getSnapshot(),slateEditorInstance:t});return wN(r)(i)},addAnnotation:(r,i)=>{const o=M4({editorActorSnapshot:e.getSnapshot(),slateEditorInstance:t}),s=v7(o),a=Sg(o),l=s.flatMap(b=>qn(o.context,b)?b.markDefs??[]:[]);e.send({type:"behavior event",behaviorEvent:{type:"annotation.add",annotation:{name:r.name,value:i??{}}},editor:t});const c=M4({editorActorSnapshot:e.getSnapshot(),slateEditorInstance:t}),u=v7(c),f=B0(c),h=Sg(c),p=h?.node.marks?.filter(b=>!a?.node.marks?.includes(b)&&!c.context.schema.decorators.map(v=>v.name).includes(b)),m=u.flatMap(b=>qn(c.context,b)?b.markDefs?.map(v=>({markDef:v,path:[{_key:b._key},"markDefs",{_key:v._key}]}))??[]:[]).filter(b=>!l.some(v=>v._key===b.markDef._key)),g=h?.path,y=m.find(b=>p?.some(v=>v===b.markDef._key));if(f&&g&&y)return{markDefPath:y.path,markDefPaths:m.map(b=>b.path),spanPath:g}},delete:(r,i)=>{r&&e.send({type:"behavior event",behaviorEvent:{type:"delete",at:r,unit:i?.mode==="blocks"?"block":i?.mode==="children"?"child":void 0},editor:t})},removeAnnotation:r=>{e.send({type:"behavior event",behaviorEvent:{type:"annotation.remove",annotation:{name:r.name}},editor:t})},getSelection:()=>{if(!t.selection)return null;if(t.selection===t.lastSlateSelection)return t.lastSelection;const r=Ph({schema:e.getSnapshot().context.schema,editor:t,range:t.selection});return t.lastSlateSelection=t.selection,t.lastSelection=r,r},getValue:()=>t.value,isCollapsedSelection:()=>!!t.selection&&It.isCollapsed(t.selection),isExpandedSelection:()=>!!t.selection&&It.isExpanded(t.selection),insertBreak:()=>{t.insertBreak(),t.onChange()},getFragment:()=>{const r=M4({editorActorSnapshot:e.getSnapshot(),slateEditorInstance:t});return v7(r)},isSelectionsOverlapping:(r,i)=>{const o=p1({context:{schema:e.getSnapshot().context.schema,value:t.value,selection:r},blockIndexMap:t.blockIndexMap}),s=p1({context:{schema:e.getSnapshot().context.schema,value:t.value,selection:i},blockIndexMap:t.blockIndexMap});return It.isRange(o)&&It.isRange(s)&&It.includes(o,s)}}}const _5=new Map;function Itt(t,{blockIndexMap:e,listIndexMap:n}){e.clear(),n.clear(),_5.clear();let r;for(let i=0;i{if(c===o.listItem)return;const u=[];l.forEach((f,h)=>{h>=o.level&&u.push(h)}),u.forEach(f=>{l.delete(f)})});const s=_5.get(o.listItem)??new Map,a=s.get(o.level)??0;s.set(o.level,a+1),_5.set(o.listItem,s),n.set(o._key,a+1),r={listItem:o.listItem,level:o.level}}}function jtt(t){return{_type:t.schema.block.name,_key:t.keyGenerator(),style:t.schema.styles[0]?.name??"normal",markDefs:[],children:[{_type:t.schema.span.name,_key:t.keyGenerator(),text:"",marks:[]}]}}function r0n(t){return function(e){const{delete:n,insertNodes:r,select:i,setSelection:o}=e;return e.delete=s=>{if(e.isNormalizingNode||e.isPerformingBehaviorOperation){n(s);return}const a=s?.at?De.range(e,s.at):void 0,l=a?Ph({schema:t.getSnapshot().context.schema,editor:e,range:a}):void 0;l?t.send({type:"behavior event",behaviorEvent:{type:"delete",at:l,direction:s?.reverse?"backward":"forward",unit:s?.unit},editor:e}):t.send({type:"behavior event",behaviorEvent:{type:"delete",direction:s?.reverse?"backward":"forward",unit:s?.unit},editor:e})},e.deleteBackward=s=>{if(e.isNormalizingNode||e.isPerformingBehaviorOperation){console.error("Unexpected call to .deleteBackward(...)");return}t.send({type:"behavior event",behaviorEvent:{type:"delete.backward",unit:s},editor:e})},e.deleteForward=s=>{if(e.isNormalizingNode||e.isPerformingBehaviorOperation){console.error("Unexpected call to .deleteForward(...)");return}t.send({type:"behavior event",behaviorEvent:{type:"delete.forward",unit:s},editor:e})},e.insertBreak=()=>{if(e.isNormalizingNode||e.isPerformingBehaviorOperation){console.error("Unexpected call to .insertBreak(...)");return}t.send({type:"behavior event",behaviorEvent:{type:"insert.break"},editor:e})},e.insertData=s=>{if(e.isNormalizingNode||e.isPerformingBehaviorOperation){console.error("Unexpected call to .insertData(...)");return}t.send({type:"behavior event",behaviorEvent:{type:"input.*",originEvent:{dataTransfer:s}},editor:e})},e.insertNodes=(s,a)=>{if(e.isNormalizingNode){const l=(hn.isNode(s)?[s]:s).map(c=>Dn.isText(c)&&typeof c._type!="string"?{...c,_type:t.getSnapshot().context.schema.span.name}:c);r(l,a);return}r(s,a)},e.insertSoftBreak=()=>{if(e.isNormalizingNode||e.isPerformingBehaviorOperation){console.error("Unexpected call to .insertSoftBreak(...)");return}t.send({type:"behavior event",behaviorEvent:{type:"insert.soft break"},editor:e})},e.insertText=s=>{if(e.isNormalizingNode||e.isPerformingBehaviorOperation){console.error("Unexpected call to .insertText(...)");return}t.send({type:"behavior event",behaviorEvent:{type:"insert.text",text:s},editor:e})},e.redo=()=>{if(e.isNormalizingNode||e.isPerformingBehaviorOperation){console.error("Unexpected call to .redo(...)");return}t.send({type:"behavior event",behaviorEvent:{type:"history.redo"},editor:e})},e.select=s=>{if(e.isNormalizingNode||e.isPerformingBehaviorOperation){i(s);return}if(e.selection){i(s);return}const a=De.range(e,s);t.send({type:"behavior event",behaviorEvent:{type:"select",at:Ph({schema:t.getSnapshot().context.schema,editor:e,range:a})},editor:e})},e.setSelection=s=>{if(e.isNormalizingNode||e.isPerformingBehaviorOperation){o(s);return}const a=s.anchor?ake({schema:t.getSnapshot().context.schema,editor:e,point:s.anchor}):void 0,l=s.focus?ake({schema:t.getSnapshot().context.schema,editor:e,point:s.focus}):void 0,c=e.selection?It.isBackward({anchor:s.anchor??e.selection.anchor,focus:s.focus??e.selection.focus}):s.anchor&&s.focus?It.isBackward({anchor:s.anchor,focus:s.focus}):void 0;if(e.selection){const u=s.anchor??e.selection.anchor,f=s.focus??e.selection.focus;if(gi.equals(u,e.selection.anchor)&&gi.equals(f,e.selection.focus)){o(s);return}}if(!a||!l){o(s);return}t.send({type:"behavior event",behaviorEvent:{type:"select",at:{anchor:a,focus:l,backward:c}},editor:e})},e.setFragmentData=()=>{console.error("Unexpected call to .setFragmentData(...)")},e.undo=()=>{if(e.isNormalizingNode||e.isPerformingBehaviorOperation){console.error("Unexpected call to .undo(...)");return}t.send({type:"behavior event",behaviorEvent:{type:"history.undo"},editor:e})},e}}function i0n({steps:t,op:e,editor:n,currentUndoStepId:r,previousUndoStepId:i}){const o=t.at(-1);if(!o)return KP(t,e,n);if(n.operations.length>0)return r===i||n.isNormalizingNode?XP(t,o,e):KP(t,e,n);if(e.type==="set_selection"&&r===void 0&&i!==void 0||e.type==="set_selection"&&r!==void 0&&i!==void 0&&i!==r)return XP(t,o,e);if(r===void 0&&i===void 0){if(e.type==="set_selection")return XP(t,o,e);const s=o.operations.at(-1);return s&&e.type==="insert_text"&&s.type==="insert_text"&&e.offset===s.offset+s.text.length&&ut.equals(e.path,s.path)&&e.text!==" "||s&&e.type==="remove_text"&&s.type==="remove_text"&&e.offset+e.text.length===s.offset&&ut.equals(e.path,s.path)?XP(t,o,e):KP(t,e,n)}return KP(t,e,n)}function KP(t,e,n){const r=n.selection===null?[e]:[{type:"set_selection",properties:{...n.selection},newProperties:{...n.selection}},e];return[...t,{operations:r,timestamp:new Date}]}function XP(t,e,n){return[...t.slice(0,-1),{timestamp:e.timestamp,operations:[...e.operations,n]}]}const o0n=1e3;function s0n({editorActor:t,subscriptions:e}){return function(n){let r=n.value,i=n.undoStepId;e.push(()=>{const s=t.on("patches",({patches:a,snapshot:l})=>{let c=!1;for(const u of a)if(!c&&u.origin!=="local"){if(u.type==="unset"&&u.path.length===0){n.history={undos:[],redos:[]},n.remotePatches.splice(0,n.remotePatches.length),n.withHistory=!0,c=!0;return}n.remotePatches.push({patch:u,time:new Date,snapshot:l,previousSnapshot:r})}r=l});return()=>{s.unsubscribe()}});const{apply:o}=n;return n.apply=s=>{if(t.getSnapshot().matches({"edit mode":"read only"})){o(s);return}if(n.isProcessingRemoteChanges){o(s);return}if(n.isUndoing||n.isRedoing){o(s);return}const a=n.withHistory,l=n.undoStepId;if(!a){i=l,o(s);return}for(s.type!=="set_selection"&&(n.history.redos=[]),n.history.undos=i0n({steps:n.history.undos,op:s,editor:n,currentUndoStepId:l,previousUndoStepId:i});n.history.undos.length>o0n;)n.history.undos.shift();i=l,o(s)},n}}function Ou(t,e){const n=t.isNormalizingNode;t.isNormalizingNode=!0,e(),t.isNormalizingNode=n}function a9(t,e){const n=t.isPatching;t.isPatching=!1,e(),t.isPatching=n}function a0n(t){return function(e){const{apply:n,normalizeNode:r}=e,i=t.getSnapshot().context.schema.styles.at(0)?.name;return e.normalizeNode=o=>{const[s,a]=o;if(De.isEditor(s)&&s.children.length===0&&a9(e,()=>{Ou(e,()=>{wt.insertNodes(e,jtt(t.getSnapshot().context),{at:[0],select:!0})})}),e.isTextBlock(s)){const l=hn.children(e,a);for(const[c,u]of l){const f=s.children[u[1]+1];if(e.isTextSpan(c)&&e.isTextSpan(f)&&c.marks?.every(h=>f.marks?.includes(h))&&f.marks?.every(h=>c.marks?.includes(h))){Yn.normalization("merging spans with same marks"),Ou(e,()=>{wt.mergeNodes(e,{at:[u[0],u[1]+1],voids:!0})});return}}}if(e.isTextBlock(s)&&!Array.isArray(s.markDefs)){Yn.normalization("adding .markDefs to block node"),Ou(e,()=>{wt.setNodes(e,{markDefs:[]},{at:a})});return}if(i&&e.isTextBlock(s)&&typeof s.style>"u"){Yn.normalization("adding .style to block node"),Ou(e,()=>{wt.setNodes(e,{style:i},{at:a})});return}if(e.isTextSpan(s)&&!Array.isArray(s.marks)){Yn.normalization("Adding .marks to span node"),Ou(e,()=>{wt.setNodes(e,{marks:[]},{at:a})});return}if(e.isTextSpan(s)){const l=ut.parent(a),[c]=De.node(e,l),u=t.getSnapshot().context.schema.decorators.map(h=>h.name),f=s.marks?.filter(h=>!u.includes(h));if(e.isTextBlock(c)&&s.text===""&&f&&f.length>0){Yn.normalization("removing annotations from empty span node"),Ou(e,()=>{wt.setNodes(e,{marks:s.marks?.filter(h=>u.includes(h))},{at:a})});return}}if(e.isTextBlock(s)){const l=t.getSnapshot().context.schema.decorators.map(c=>c.name);for(const[c,u]of hn.children(e,a))if(e.isTextSpan(c)){const f=c.marks??[],h=f.filter(p=>!l.includes(p)&&!s.markDefs?.find(m=>m._key===p));if(h.length>0){Yn.normalization("removing orphaned annotations from span node"),Ou(e,()=>{wt.setNodes(e,{marks:f.filter(p=>!h.includes(p))},{at:u})});return}}}if(e.isTextSpan(s)){const l=ut.parent(a),[c]=De.node(e,l);if(e.isTextBlock(c)){const u=t.getSnapshot().context.schema.decorators.map(p=>p.name),f=s.marks??[],h=f.filter(p=>!u.includes(p)&&!c.markDefs?.find(m=>m._key===p));if(h.length>0){Yn.normalization("removing orphaned annotations from span node"),Ou(e,()=>{wt.setNodes(e,{marks:f.filter(p=>!h.includes(p))},{at:a})});return}}}if(e.isTextBlock(s)){const l=s.markDefs??[],c=new Set,u=[];for(const f of l)c.has(f._key)||(c.add(f._key),u.push(f));if(l.length!==u.length){Yn.normalization("removing duplicate markDefs"),Ou(e,()=>{wt.setNodes(e,{markDefs:u},{at:a})});return}}if(e.isTextBlock(s)&&!e.operations.some(l=>l.type==="merge_node"&&"markDefs"in l.properties&&l.path.length===1)){const l=(s.markDefs||[]).filter(c=>s.children.find(u=>Dn.isText(u)&&Array.isArray(u.marks)&&u.marks.includes(c._key)));if(s.markDefs&&!itt(l,s.markDefs)){Yn.normalization("removing markDef not in use"),Ou(e,()=>{wt.setNodes(e,{markDefs:l},{at:a})});return}}Ou(e,()=>{r(o)})},e.apply=o=>{if(e.isProcessingRemoteChanges){n(o);return}if(e.isUndoing||e.isRedoing){n(o);return}if(o.type==="set_selection")if(o.properties&&o.newProperties&&o.properties.anchor&&o.properties.focus&&o.newProperties.anchor&&o.newProperties.focus){const s=It.isCollapsed({anchor:o.properties.anchor,focus:o.properties.focus}),a=It.isCollapsed({anchor:o.newProperties.anchor,focus:o.newProperties.focus});if(s&&a){const l=Array.from(De.nodes(e,{mode:"lowest",at:o.properties.focus,match:h=>e.isTextSpan(h),voids:!1}))[0]?.[0],c=Array.from(De.nodes(e,{mode:"lowest",at:o.newProperties.focus,match:h=>e.isTextSpan(h),voids:!1}))[0]?.[0],u=l&&c&&o.newProperties.focus.path[0]===o.properties.focus.path[0]&&o.newProperties.focus.path[1]===o.properties.focus.path[1]+1&&l.text.length===o.properties.focus.offset&&o.newProperties.focus.offset===0,f=l&&c&&o.newProperties.focus.path[0]===o.properties.focus.path[0]&&o.newProperties.focus.path[1]===o.properties.focus.path[1]-1&&o.properties.focus.offset===0&&c.text.length===o.newProperties.focus.offset;!u&&!f&&(e.decoratorState={})}}else e.decoratorState={};if(o.type==="merge_node"&&o.path.length===1&&"markDefs"in o.properties&&o.properties._type===t.getSnapshot().context.schema.block.name&&Array.isArray(o.properties.markDefs)&&o.properties.markDefs.length>0&&o.path[0]-1>=0){const[s,a]=De.node(e,[o.path[0]-1]);if(e.isTextBlock(s)){const l=Array.isArray(s.markDefs)&&s.markDefs||[],c=[...new Map([...l,...o.properties.markDefs].map(u=>[u._key,u])).values()];Yn.normalization("copying markDefs over to merged block",o),wt.setNodes(e,{markDefs:c},{at:a,voids:!1}),n(o);return}}n(o)},e}}function JR(t){const[e,n]=t;return[e,n]}function wke(t,e){let n=t,r=e;const i=n.length,o=r.length;if(i===0||o===0)return 0;i>o?n=n.substring(i-o):i=55296&&e<=56319}function c0n(t){const e=t.charCodeAt(0);return e>=56320&&e<=57343}function u0n(t,e,n){const r=t.length,i=e.length,o=Math.ceil((r+i)/2),s=o,a=2*o,l=new Array(a),c=new Array(a);for(let y=0;yn);y++){for(let b=-y+h;b<=y-p;b+=2){const v=s+b;let x;b===-y||b!==y&&l[v-1]r)p+=2;else if(C>i)h+=2;else if(f){const w=s+u-b;if(w>=0&&w=_)return _ke(t,e,x,C,n)}}}for(let b=-y+m;b<=y-g;b+=2){const v=s+b;let x;b===-y||b!==y&&c[v-1]r)g+=2;else if(C>i)m+=2;else if(!f){const w=s+u-b;if(w>=0&&w=x)return _ke(t,e,_,S,n)}}}}return[[Hl,t],[xc,e]]}function _ke(t,e,n,r,i){const o=t.substring(0,n),s=e.substring(0,r),a=t.substring(n),l=e.substring(r),c=F9(o,s,{checkLines:!1,deadline:i}),u=F9(a,l,{checkLines:!1,deadline:i});return c.concat(u)}function d0n(t,e,n=1){if(n<=0)return null;const r=t.length>e.length?t:e,i=t.length>e.length?e:t;if(r.length<4||i.length*2s[4].length?o:s;else{if(!o&&!s)return null;s?o||(a=s):a=o}if(!a)throw new Error("Unable to find a half match.");let l,c,u,f;t.length>e.length?(l=a[0],c=a[1],u=a[2],f=a[3]):(u=a[0],f=a[1],l=a[2],c=a[3]);const h=a[4];return[l,c,u,f,h]}function Ske(t,e,n){const r=t.slice(n,n+Math.floor(t.length/4));let i=-1,o="",s,a,l,c;for(;(i=e.indexOf(r,i+1))!==-1;){const u=b2e(t.slice(n),e.slice(i)),f=DH(t.slice(0,n),e.slice(0,i));o.length=t.length?[s||"",a||"",l||"",c||"",o||""]:null}function f0n(t,e){for(let n=0;n=1&&u>=1){a.splice(l-c-u,c+u),l=l-c-u;const p=F9(f,h,{checkLines:!1,deadline:n.deadline});for(let m=p.length-1;m>=0;m--)a.splice(l,0,p[m]);l+=p.length}u=0,c=0,f="",h="";break;default:throw new Error("Unknown diff operation.")}l++}return a.pop(),a}function m0n(t,e,n){let r;if(!t)return[[xc,e]];if(!e)return[[Hl,t]];const i=t.length>e.length?t:e,o=t.length>e.length?e:t,s=i.indexOf(o);if(s!==-1)return r=[[xc,i.substring(0,s)],[qo,o],[xc,i.substring(s+o.length)]],t.length>e.length&&(r[0][0]=Hl,r[2][0]=Hl),r;if(o.length===1)return[[Hl,t],[xc,e]];const a=d0n(t,e);if(a){const l=a[0],c=a[1],u=a[2],f=a[3],h=a[4],p=F9(l,u,n),m=F9(c,f,n);return p.concat([[qo,h]],m)}return n.checkLines&&t.length>100&&e.length>100?p0n(t,e,n):u0n(t,e,n.deadline)}var g0n=Object.defineProperty,kke=Object.getOwnPropertySymbols,y0n=Object.prototype.hasOwnProperty,b0n=Object.prototype.propertyIsEnumerable,Eke=(t,e,n)=>e in t?g0n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,v0n=(t,e)=>{for(var n in e||(e={}))y0n.call(e,n)&&Eke(t,n,e[n]);if(kke)for(var n of kke(e))b0n.call(e,n)&&Eke(t,n,e[n]);return t};const Hl=-1,xc=1,qo=0;function Att(t,e,n){if(t===null||e===null)throw new Error("Null input. (diff)");const r=F9(t,e,C0n(n||{}));return _0n(r),r}function F9(t,e,n){let r=t,i=e;if(r===i)return r?[[qo,r]]:[];let o=b2e(r,i);const s=r.substring(0,o);r=r.substring(o),i=i.substring(o),o=DH(r,i);const a=r.substring(r.length-o);r=r.substring(0,r.length-o),i=i.substring(0,i.length-o);let l=m0n(r,i,n);return s&&l.unshift([qo,s]),a&&l.push([qo,a]),l=OH(l),l}function x0n(t){let e=1;return typeof t<"u"&&(e=t<=0?Number.MAX_VALUE:t),Date.now()+e*1e3}function C0n(t){return v0n({checkLines:!0,deadline:x0n(t.timeout||1)},t)}function ZP(t,e,n){return n===1?t+e:e+t}function QP(t,e){return e===1?[t.substring(0,t.length-1),t[t.length-1]]:[t.substring(1),t[0]]}function w0n(t,e,n,r){return r===1?t[e][1][t[e][1].length-1]===t[n][1][t[n][1].length-1]:t[e][1][0]===t[n][1][0]}function Tke(t,e,n){const r=n===1?-1:1;let i=null,o=null,s=e+n;for(;s>=0&&s=s&&o++):t[i][1]=ZP(t[i][1],l,r),o===null?t.splice(s,0,[Hl,l]):t[o][1]=ZP(t[o][1],l,r)}function _0n(t){for(let e=0;eJR(f)),n=!1;const r=[];let i=0,o=null,s=0,a=0,l=0,c=0,u=0;for(;s0?r[i-1]:-1,a=0,l=0,c=0,u=0,o=null,n=!0)),s++;for(n&&(e=OH(e)),e=Rtt(e),s=1;s=m?(p>=f.length/2||p>=h.length/2)&&(e.splice(s,0,[qo,h.substring(0,p)]),e[s-1][1]=f.substring(0,f.length-p),e[s+1][1]=h.substring(p),s++):(m>=f.length/2||m>=h.length/2)&&(e.splice(s,0,[qo,f.substring(0,m)]),e[s-1][0]=xc,e[s-1][1]=h.substring(0,h.length-m),e[s+1][0]=Hl,e[s+1][1]=f.substring(m),s++),s++}s++}return e}const Ike=/[^a-zA-Z0-9]/,jke=/\s/,Ake=/[\r\n]/,k0n=/\n\r?\n$/,E0n=/^\r?\n\r?\n/;function Rtt(t){const e=t.map(i=>JR(i));function n(i,o){if(!i||!o)return 6;const s=i.charAt(i.length-1),a=o.charAt(0),l=s.match(Ike),c=a.match(Ike),u=l&&s.match(jke),f=c&&a.match(jke),h=u&&s.match(Ake),p=f&&a.match(Ake),m=h&&i.match(k0n),g=p&&o.match(E0n);return m||g?5:h||p?4:l&&!u&&f?3:u||f?2:l||c?1:0}let r=1;for(;r=f&&(f=h,l=i,c=o,u=s)}e[r-1][1]!==l&&(l?e[r-1][1]=l:(e.splice(r-1,1),r--),e[r][1]=c,u?e[r+1][1]=u:(e.splice(r+1,1),r--))}r++}return e}function OH(t){let e=t.map(c=>JR(c));e.push([qo,""]);let n=0,r=0,i=0,o="",s="",a;for(;n1?(r!==0&&i!==0&&(a=b2e(s,o),a!==0&&(n-r-i>0&&e[n-r-i-1][0]===qo?e[n-r-i-1][1]+=s.substring(0,a):(e.splice(0,0,[qo,s.substring(0,a)]),n++),s=s.substring(a),o=o.substring(a)),a=DH(s,o),a!==0&&(e[n][1]=s.substring(s.length-a)+e[n][1],s=s.substring(0,s.length-a),o=o.substring(0,o.length-a))),n-=r+i,e.splice(n,r+i),o.length&&(e.splice(n,0,[Hl,o]),n++),s.length&&(e.splice(n,0,[xc,s]),n++),n++):n!==0&&e[n-1][0]===qo?(e[n-1][1]+=e[n][1],e.splice(n,1)):n++,i=0,r=0,o="",s="";break;default:throw new Error("Unknown diff operation")}e[e.length-1][1]===""&&e.pop();let l=!1;for(n=1;ne+(n?1:0),0)}function I0n(t,e=4){let n=t.map(h=>JR(h)),r=!1;const i=[];let o=0,s=null,a=0,l=!1,c=!1,u=!1,f=!1;for(;a0?i[o-1]:-1,u=!1,f=!1),r=!0)),a++;return r&&(n=OH(n)),n}var j0n=Object.defineProperty,Rke=Object.getOwnPropertySymbols,A0n=Object.prototype.hasOwnProperty,R0n=Object.prototype.propertyIsEnumerable,Dke=(t,e,n)=>e in t?j0n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Oke=(t,e)=>{for(var n in e||(e={}))A0n.call(e,n)&&Dke(t,n,e[n]);if(Rke)for(var n of Rke(e))R0n.call(e,n)&&Dke(t,n,e[n]);return t};const D0n={threshold:.5,distance:1e3};function O0n(t){return Oke(Oke({},D0n),t)}const P0n=32;function $0n(t,e,n,r={}){if(e.length>P0n)throw new Error("Pattern too long for this browser.");const i=O0n(r),o=M0n(e);function s(m,g){const y=m/e.length,b=Math.abs(n-g);return i.distance?y+b/i.distance:b?1:y}let a=i.threshold,l=t.indexOf(e,n);l!==-1&&(a=Math.min(s(0,l),a),l=t.lastIndexOf(e,n+e.length),l!==-1&&(a=Math.min(s(0,l),a)));const c=1<=g;v--){const x=o[t.charAt(v-1)];if(m===0?b[v]=(b[v+1]<<1|1)&x:b[v]=(b[v+1]<<1|1)&x|((p[v+1]|p[v])<<1|1)|p[v+1],b[v]&c){const C=s(m,v-1);if(C<=a)if(a=C,l=v-1,l>n)g=Math.max(1,2*n-l);else break}}if(s(m+1,n)>a)break;p=b}return l}function M0n(t){const e={};for(let n=0;ne));s++)i=n,o=r;return t.length!==s&&t[s][0]===Hl?o:o+(e-i)}function GT(t){let e=0;for(let n=0;n"u")throw new Error("Failed to get codepoint");e+=Ptt(r)}return e}function F0n(t,e,n={}){let r=0,i=0;function o(a){for(;r"u")return i;r+=Ptt(l),l>65535?i+=2:i+=1}if(!n.allowExceedingIndices&&r!==a)throw new Error("Failed to determine byte offset");return i}const s=[];for(const a of t)s.push({diffs:a.diffs.map(l=>JR(l)),start1:o(a.start1),start2:o(a.start2),utf8Start1:a.utf8Start1,utf8Start2:a.utf8Start2,length1:a.length1,length2:a.length2,utf8Length1:a.utf8Length1,utf8Length2:a.utf8Length2});return s}function Ptt(t){return t<=127?1:t<=2047?2:t<=65535?3:4}const Sb=32,v2e=4;function N0n(t,e=v2e){const n=e;let r="";for(let s=1;s<=n;s++)r+=String.fromCharCode(s);for(const s of t)s.start1+=n,s.start2+=n,s.utf8Start1+=n,s.utf8Start2+=n;let i=t[0],o=i.diffs;if(o.length===0||o[0][0]!==qo)o.unshift([qo,r]),i.start1-=n,i.start2-=n,i.utf8Start1-=n,i.utf8Start2-=n,i.length1+=n,i.length2+=n,i.utf8Length1+=n,i.utf8Length2+=n;else if(n>o[0][1].length){const s=o[0][1].length,a=n-s;o[0][1]=r.substring(s)+o[0][1],i.start1-=a,i.start2-=a,i.utf8Start1-=a,i.utf8Start2-=a,i.length1+=a,i.length2+=a,i.utf8Length1+=a,i.utf8Length2+=a}if(i=t[t.length-1],o=i.diffs,o.length===0||o[o.length-1][0]!==qo)o.push([qo,r]),i.length1+=n,i.length2+=n,i.utf8Length1+=n,i.utf8Length2+=n;else if(n>o[o.length-1][1].length){const s=n-o[o.length-1][1].length;o[o.length-1][1]+=r.substring(0,s),i.length1+=s,i.length2+=s,i.utf8Length1+=s,i.utf8Length2+=s}return r}function $tt(t,e){return{diffs:[],start1:t,start2:e,utf8Start1:t,utf8Start2:e,length1:0,length2:0,utf8Length1:0,utf8Length2:0}}function B0n(t,e=v2e){const n=Sb;for(let r=0;r2*n?(l.length1+=p.length,l.utf8Length1+=m,o+=p.length,c=!1,l.diffs.push([h,p]),i.diffs.shift()):(p=p.substring(0,n-l.length1-e),m=GT(p),l.length1+=p.length,l.utf8Length1+=m,o+=p.length,h===qo?(l.length2+=p.length,l.utf8Length2+=m,s+=p.length):c=!1,l.diffs.push([h,p]),p===i.diffs[0][1]?i.diffs.shift():i.diffs[0][1]=i.diffs[0][1].substring(p.length))}a=Ott(l.diffs),a=a.substring(a.length-e);const u=Dtt(i.diffs).substring(0,e),f=GT(u);u!==""&&(l.length1+=u.length,l.length2+=u.length,l.utf8Length1+=f,l.utf8Length2+=f,l.diffs.length!==0&&l.diffs[l.diffs.length-1][0]===qo?l.diffs[l.diffs.length-1][1]+=u:l.diffs.push([qo,u])),c||t.splice(++r,0,l)}}}function V0n(t,e,n={}){if(typeof t=="string")throw new Error("Patches must be an array - pass the patch to `parsePatch()` first");let r=e;if(t.length===0)return[r,[]];const i=F0n(t,r,{allowExceedingIndices:n.allowExceedingIndices}),o=n.margin||v2e,s=n.deleteThreshold||.4,a=N0n(i,o);r=a+r+a,B0n(i,o);let l=0;const c=[];for(let u=0;uSb?(p=ZJ(r,h.substring(0,Sb),f),p!==-1&&(m=ZJ(r,h.substring(h.length-Sb),f+h.length-Sb),(m===-1||p>=m)&&(p=-1))):p=ZJ(r,h,f),p===-1)c[u]=!1,l-=i[u].length2-i[u].length1;else{c[u]=!0,l=p-f;let g;if(m===-1?g=r.substring(p,p+h.length):g=r.substring(p,m+Sb),h===g)r=r.substring(0,p)+Ott(i[u].diffs)+r.substring(p+h.length);else{let y=Att(h,g,{checkLines:!1});if(h.length>Sb&&L0n(y)/h.length>s)c[u]=!1;else{y=Rtt(y);let b=0,v=0;for(let x=0;x{let r=!1;try{switch(n.type){case"insert":r=W0n(t,e,n);break;case"unset":r=q0n(e,n);break;case"set":r=$ke(e,n);break;case"setIfMissing":r=$ke(e,n);break;case"diffMatchPatch":r=U0n(e,n);break}}catch(i){console.error(i)}return r}}function U0n(t,e){const n=PH(t.children,e.path);if(!n)return!1;const r=$H(n,e.path);if(!r||!(n&&t.isTextBlock(n.node)&&e.path.length===4&&e.path[1]==="children"&&e.path[3]==="text")||!Dn.isText(r.node))return!1;const i=Mtt(e.value),[o]=V0n(i,r.node.text,{allowExceedingIndices:!0}),s=I0n(Att(r.node.text,o),5);let a=0;for(const[l,c]of s)l===xc?(t.apply({type:"insert_text",path:[n.index,r.index],offset:a,text:c}),a+=c.length):l===Hl?t.apply({type:"remove_text",path:[n.index,r.index],offset:a,text:c}):l===qo&&(a+=c.length);return!0}function W0n(t,e,n){const r=PH(e.children,n.path);if(!r){if(n.path.length===1&&n.path[0]===0){const u=n.items.map(f=>s9(f,{schemaTypes:t.schema}));return wt.insertNodes(e,u,{at:[0]}),!0}return!1}if(n.path.length>1&&n.path[1]!=="children")return!1;if(n.path.length===1){const{items:u,position:f}=n,h=u.map(y=>s9(y,{schemaTypes:t.schema})),p=r.index,m=f==="after"?p+1:p,g=Joe(t.initialValue,e.value,t.schema);return wt.insertNodes(e,h,{at:[m]}),g&&typeof n.path[0]=="number"&&n.path[0]===0&&wt.removeNodes(e,{at:[f==="before"?p+h.length:p]}),!0}const{items:i,position:o}=n,s=$H(r,n.path);if(!s)return!1;const a=s9({...r.node,children:i},{schemaTypes:t.schema}),l=o==="after"?s.index+1:s.index,c=[r.index,l];return a&&On.isElement(a)&&wt.insertNodes(e,a.children,{at:c}),!0}function $ke(t,e){let n=e.value;typeof e.path[3]=="string"&&(n={},n[e.path[3]]=e.value);const r=PH(t.children,e.path);if(!r)return!1;const i=t.isTextBlock(r.node);if(e.path.length===1){const s=Qm(r.node,[{...e,path:e.path.slice(1)}]);if(t.isTextBlock(r.node)&&On.isElement(s)){wt.setNodes(t,s,{at:[r.index]});const a=t.selection;for(const[l,c]of De.nodes(t,{at:[r.index],reverse:!0,mode:"lowest"}))wt.removeNodes(t,{at:c});return wt.insertNodes(t,s.children,{at:[r.index,0]}),a&&(wt.setSelection(t,a),wt.select(t,a)),!0}else return wt.setNodes(t,s,{at:[r.index]}),!0}if(i&&e.path[1]!=="children"){const s=Qm(r.node,[{...e,path:e.path.slice(1)}]);return wt.setNodes(t,s,{at:[r.index]}),!0}const o=$H(r,e.path);if(i&&o){if(Dn.isText(o.node))if(Dn.isText(n)){if(e.type==="setIfMissing")return!1;const s=o.node.text,a=n.text;s!==a&&(t.apply({type:"remove_text",path:[r.index,o.index],offset:0,text:s}),t.apply({type:"insert_text",path:[r.index,o.index],offset:0,text:a}),t.onChange())}else{const s=e.path.slice(3),a=s.at(0);if(a===void 0||typeof a=="string"&&["_key","_type","text"].includes(a))return!1;const l=Qm(o.node,[{...e,path:s}]);wt.setNodes(t,l,{at:[r.index,o.index]})}else{const s=e.path.slice(3),a=["_key","_type","children","__inline"],l=s.at(0);if(l===void 0||typeof l=="string"&&a.includes(l))return!1;const c="value"in o.node&&typeof o.node.value=="object"?o.node.value:{},u=Qm(c,[{...e,path:e.path.slice(3)}]);wt.setNodes(t,{...o.node,value:u},{at:[r.index,o.index]})}return!0}else if(r&&"value"in r.node)if(e.path.length>1&&e.path[1]!=="children"){const s=Qm(r.node.value,[{...e,path:e.path.slice(1)}]);wt.setNodes(t,{...r.node,value:s},{at:[r.index]})}else return!1;return!0}function q0n(t,e){if(e.path.length===0){wt.deselect(t);const i=hn.children(t,[],{reverse:!0});for(const[o,s]of i)wt.removeNodes(t,{at:s});return!0}const n=PH(t.children,e.path);if(!n)return!1;if(e.path.length===1)return wt.removeNodes(t,{at:[n.index]}),!0;const r=$H(n,e.path);if(t.isTextBlock(n.node)&&r&&e.path[1]==="children"&&e.path.length===3)return wt.removeNodes(t,{at:[n.index,r.index]}),!0;if(r&&!Dn.isText(r.node)){const i=e.path.slice(3).at(0);if(i===void 0||typeof i=="string"&&["_key","_type","children","__inline"].includes(i))return!1;const o="value"in r.node&&typeof r.node.value=="object"?r.node.value:{},s=Qm(o,[{...e,path:e.path.slice(3)}]);return wt.setNodes(t,{...r.node,value:s},{at:[n.index,r.index]}),!0}if(r&&Dn.isText(r.node)){const i=e.path.slice(3),o=i.at(0);if(o===void 0||typeof o=="string"&&["_key","_type"].includes(o))return!1;if(typeof o=="string"&&o==="text")return t.apply({type:"remove_text",path:[n.index,r.index],offset:0,text:r.node.text}),!0;const s=Qm(r.node,[{...e,path:i}]),a=Object.keys(s),l=Object.keys(r.node).filter(c=>!a.includes(c));return wt.unsetNodes(t,l,{at:[n.index,r.index]}),!0}if(!r){if("value"in n.node){const i=Qm(n.node.value,[{...e,path:e.path.slice(1)}]);return wt.setNodes(t,{...n.node,value:i},{at:[n.index]}),!0}if(t.isTextBlock(n.node)){const i=e.path.slice(1).at(0);return i===void 0||typeof i!="string"||["_key","_type","children"].includes(i)?!1:(wt.unsetNodes(t,[i],{at:[n.index]}),!0)}return!1}return!1}function PH(t,e){let n=-1;const r=t.find((i,o)=>{const s=Y1(e[0])?i._key===e[0]._key:o===e[0];return s&&(n=o),s});if(r)return{node:r,index:n}}function $H(t,e){const n=t.node;if(!On.isElement(n)||e[1]!=="children")return;let r=-1;const i=n.children.find((o,s)=>{const a=Y1(e[2])?o._key===e[2]._key:s===e[2];return a&&(r=s),a});if(i)return{node:i,index:r}}function G0n(t,e,n,r){const i=qn({schema:t},e[n.path[0]])&&e[n.path[0]];if(!i)throw new Error("Could not find block");const o=qn({schema:t},i)&&Ci({schema:t},i.children[n.path[1]])&&i.children[n.path[1]];if(!o)throw new Error("Could not find child");const s=[{_key:i._key},"children",{_key:o._key},"text"],a=r[n.path[0]],l=qn({schema:t},a)&&a.children[n.path[1]],c=Ci({schema:t},l)?l.text:"",u=Fet(c,o.text,s);return u.value.length?[u]:[]}function Y0n(t,e,n,r){const i=e[n.path[0]];if(!i)throw new Error("Could not find block");const o=qn({schema:t},i)&&i.children[n.path[1]]||void 0,s=Ci({schema:t},o)?o:void 0;if(o&&!s)throw new Error("Expected span");if(!s)throw new Error("Could not find child");const a=[{_key:i._key},"children",{_key:s._key},"text"],l=r[n.path[0]],c=qn({schema:t},l)&&l.children[n.path[1]],u=Ci({schema:t},c)&&c.text,f=Fet(u||"",s.text,a);return f.value?[f]:[]}function K0n(t,e,n){const r=n.path.at(0);if(r!==void 0&&n.path.length===1){const i=e.at(r);if(!i)return console.error("Could not find block at index",r),[];if(qn({schema:t},i)){const o=[];for(const s of Object.keys(n.newProperties)){const a=n.newProperties[s];s==="_key"?o.push(eu(a,[r,"_key"])):o.push(eu(a,[{_key:i._key},s]))}for(const s of Object.keys(n.properties))s in n.newProperties||o.push(Mu([{_key:i._key},s]));return o}else{const o=[],s=n.newProperties._key;s!==void 0&&o.push(eu(s,[r,"_key"]));const a="value"in n.newProperties&&typeof n.newProperties.value=="object"?n.newProperties.value:{},l=Object.keys(a);for(const u of l){const f=a[u];o.push(eu(f,[{_key:i._key},u]))}const c="value"in n.properties&&typeof n.properties.value=="object"?n.properties.value:{};for(const u of Object.keys(c))u in a||o.push(Mu([{_key:i._key},u]));return o}}else if(n.path.length===2){const i=e[n.path[0]];if(qn({schema:t},i)){const o=i.children[n.path[1]];if(o){const s=i._key,a=o._key,l=[];if(On.isElement(o)){const f=n.newProperties._key;f!==void 0&&l.push(eu(f,[{_key:s},"children",i.children.indexOf(o),"_key"]));const h="value"in n.newProperties&&typeof n.newProperties.value=="object"?n.newProperties.value:{},p=Object.keys(h);for(const m of p){const g=h[m];l.push(eu(g,[{_key:s},"children",{_key:a},m]))}return l}const c=Object.keys(n.newProperties);for(const f of c){const h=n.newProperties[f];if(f==="_key"){l.push(eu(h,[{_key:s},"children",i.children.indexOf(o),f]));continue}l.push(eu(h,[{_key:s},"children",{_key:a},f]))}const u=Object.keys(n.properties);for(const f of u)f in n.newProperties||l.push(Mu([{_key:s},"children",{_key:a},f]));return l}throw new Error("Could not find a valid child")}throw new Error("Could not find a valid block")}else throw new Error(`Unexpected path encountered: ${JSON.stringify(n.path)}`)}function X0n(t,e,n,r){const i=r[n.path[0]];if(n.path.length===1){const o=n.path[0]===0?"before":"after",s=r[n.path[0]-1],a=n.path[0]===0?i?._key:s?._key;return a?[Z5([__(n.node,t.block.name)],o,[{_key:a}])]:[x_(r,[]),Z5([__(n.node,t.block.name)],"before",[n.path[0]])]}else if(qn({schema:t},i)&&n.path.length===2&&e[n.path[0]]){const o=i.children.length===0||!i.children[n.path[1]-1]?"before":"after",s=i.children.length<=1||!i.children[n.path[1]-1]?[{_key:i._key},"children",0]:[{_key:i._key},"children",{_key:i.children[n.path[1]-1]._key}],a=x_([],[{_key:i._key},"children"]);if(Dn.isText(n.node))return[a,Z5([n.node],o,s)];const l=n.node._type,c=n.node._key,u="value"in n.node&&typeof n.node.value=="object"?n.node.value:{};return[a,Z5([{_type:l,_key:c,...u}],o,s)]}return[]}function Z0n(t,e,n,r){const i=[],o=e[n.path[0]];if(!qn({schema:t},o))throw new Error(`Block with path ${JSON.stringify(n.path[0])} is not a text block and can't be split`);if(n.path.length===1){const s=r[n.path[0]];if(qn({schema:t},s)){const a=e[n.path[0]+1];if(!a)return i;const l=__(a,t.block.name);l&&(i.push(Z5([l],"after",[{_key:o._key}])),s.children.slice(n.position).forEach(c=>{const u=[{_key:s._key},"children",{_key:c._key}];i.push(Mu(u))}))}return i}if(n.path.length===2){const s=o.children[n.path[1]];if(Ci({schema:t},s)){const a=__({...o,children:o.children.slice(n.path[1]+1,n.path[1]+2)},t.block.name).children;i.push(x_([],[{_key:o._key},"children"])),i.push(Z5(a,"after",[{_key:o._key},"children",{_key:s._key}])),i.push(eu(s.text,[{_key:o._key},"children",{_key:s._key},"text"]))}return i}return i}function Q0n(t,e,n){const r=e[n.path[0]];if(n.path.length===1){if(r&&r._key)return[Mu([{_key:r._key}])];throw new Error("Block not found")}else if(qn({schema:t},r)&&n.path.length===2){const i=r.children[n.path[1]];return i?r.children.filter(o=>o._key===n.node._key).length>1?(console.warn(`Multiple spans have \`_key\` ${n.node._key}. It's ambiguous which one to remove.`,JSON.stringify(r,null,2)),[]):[Mu([{_key:r._key},"children",{_key:i._key}])]:[]}else return[]}function J0n(t,e,n,r){const i=[],o=r[n.path[0]],s=e[n.path[0]];if(n.path.length===1)if(o?._key){const a=e[n.path[0]-1];if(!a)throw new Error("Previous block not found!");const l=__(a,t.block.name);i.push(eu(l,[{_key:l._key}])),i.push(Mu([{_key:o._key}]))}else throw new Error("Target key not found!");else if(qn({schema:t},o)&&qn({schema:t},s)&&n.path.length===2){const a=s.children[n.path[1]-1]&&Ci({schema:t},s.children[n.path[1]-1])?s.children[n.path[1]-1]:void 0,l=o.children[n.path[1]]&&Ci({schema:t},o.children[n.path[1]])?o.children[n.path[1]]:void 0;if(a){const c=o.children.filter(u=>u._key===a._key);if(c.length===1){const u=c[0];Ci({schema:t},u)&&u.text!==a.text&&i.push(eu(a.text,[{_key:o._key},"children",{_key:a._key},"text"]))}else console.warn(`Multiple spans have \`_key\` ${a._key}. It's ambiguous which one to update.`,JSON.stringify(o,null,2))}l&&(o.children.filter(c=>c._key===l._key).length===1?i.push(Mu([{_key:o._key},"children",{_key:l._key}])):console.warn(`Multiple spans have \`_key\` ${l._key}. It's ambiguous which one to remove.`,JSON.stringify(o,null,2)))}return i}function e5n(t,e,n){const r=[],i=e[n.path[0]],o=e[n.newPath[0]];if(!o||!i)return r;if(n.path.length===1){const s=n.path[0]>n.newPath[0]?"before":"after";r.push(Mu([{_key:i._key}])),r.push(Z5([i],s,[{_key:o._key}]))}else if(n.path.length===2&&qn({schema:t},i)&&qn({schema:t},o)){const s=i.children[n.path[1]],a=o.children[n.newPath[1]],l=n.newPath[1]===o.children.length?"after":"before",c=i.children[n.path[1]];if(!s||!a||!c)return r;r.push(Mu([{_key:i._key},"children",{_key:s._key}])),r.push(x_([],[{_key:o._key},"children"])),r.push(Z5([c],l,[{_key:o._key},"children",{_key:a._key}]))}return r}function Sw(t,e){const n=t.isProcessingRemoteChanges;t.isProcessingRemoteChanges=!0,e(),t.isProcessingRemoteChanges=n}function MH(t,e){const n=t.withHistory;t.withHistory=!1,e(),t.withHistory=n}function t5n({editorActor:t,relayActor:e,subscriptions:n}){let r;const i=H0n(t.getSnapshot().context);return function(o){r=[...o.value];const{apply:s}=o;let a=[];const l=()=>{if(a.length===0)return;const u=a;a=[];let f=!1;Sw(o,()=>{De.withoutNormalizing(o,()=>{a9(o,()=>{MH(o,()=>{for(const h of u)try{f=i(o,h),f?Yn.syncPatch(`(applied) ${JSON.stringify(h,null,2)}`):Yn.syncPatch(`(ignored) ${JSON.stringify(h,null,2)}`)}catch(p){console.error(`Applying patch ${JSON.stringify(h)} failed due to: ${p instanceof Error?p.message:p}`)}})})}),f&&(o.normalize(),o.onChange())})},c=({patches:u})=>{const f=u.filter(h=>h.origin!=="local");f.length!==0&&(a=a.concat(f),l())};return n.push(()=>{Yn.syncPatch("subscribing to remote patches");const u=t.on("patches",c);return()=>{Yn.syncPatch("unsubscribing to remote patches"),u.unsubscribe()}}),o.apply=u=>{let f=[];r=o.value;const h=Joe(t.getSnapshot().context.initialValue,r,t.getSnapshot().context.schema);s(u);const p=Joe(t.getSnapshot().context.initialValue,o.value,t.getSnapshot().context.schema);if(!o.isPatching)return o;switch(h&&!p&&u.type!=="set_selection"&&f.push(Z5(r,"before",[0])),u.type){case"insert_text":f=[...f,...G0n(t.getSnapshot().context.schema,o.children,u,r)];break;case"remove_text":f=[...f,...Y0n(t.getSnapshot().context.schema,o.children,u,r)];break;case"remove_node":f=[...f,...Q0n(t.getSnapshot().context.schema,r,u)];break;case"split_node":f=[...f,...Z0n(t.getSnapshot().context.schema,o.children,u,r)];break;case"insert_node":f=[...f,...X0n(t.getSnapshot().context.schema,o.children,u,r)];break;case"set_node":f=[...f,...K0n(t.getSnapshot().context.schema,o.children,u)];break;case"merge_node":f=[...f,...J0n(t.getSnapshot().context.schema,o.children,u,r)];break;case"move_node":f=[...f,...e5n(t.getSnapshot().context.schema,r,u)];break}if(!h&&p&&["merge_node","set_node","remove_text","remove_node"].includes(u.type)&&(f=[...f,Mu([])],e.send({type:"unset",previousValue:r})),h&&f.length>0&&(f=[x_([],[]),...f]),f.length>0)for(const m of f)t.send({type:"internal.patch",patch:{...m,origin:"local"},operationId:o.undoStepId,value:o.value});return o},o}}function n5n({editorActor:t}){return function(e){e.isTextBlock=r=>De.isEditor(r)?!1:qn(t.getSnapshot().context,r),e.isTextSpan=r=>De.isEditor(r)?!1:Ci(t.getSnapshot().context,r),e.isListBlock=r=>De.isEditor(r)?!1:I2(t.getSnapshot().context,r),e.isVoid=r=>De.isEditor(r)?!1:t.getSnapshot().context.schema.block.name!==r._type&&(t.getSnapshot().context.schema.blockObjects.map(i=>i.name).includes(r._type)||t.getSnapshot().context.schema.inlineObjects.map(i=>i.name).includes(r._type)),e.isInline=r=>De.isEditor(r)?!1:t.getSnapshot().context.schema.inlineObjects.map(i=>i.name).includes(r._type)&&"__inline"in r&&r.__inline===!0;const{normalizeNode:n}=e;return e.normalizeNode=r=>{const[i,o]=r;if(i._type===void 0&&o.length===2){Yn.normalization("Setting span type on text node without a type");const s=i,a=s._key||t.getSnapshot().context.keyGenerator();Ou(e,()=>{wt.setNodes(e,{...s,_type:t.getSnapshot().context.schema.span.name,_key:a},{at:o})});return}if(i._key===void 0&&(o.length===1||o.length===2)){Yn.normalization("Setting missing key on child node without a key");const s=t.getSnapshot().context.keyGenerator();Ou(e,()=>{wt.setNodes(e,{_key:s},{at:o})});return}Ou(e,()=>{n(r)})},e}}function r5n(t){const e=t.getSnapshot().context;return function(n){const{apply:r,normalizeNode:i}=n;return n.apply=o=>{if(n.isProcessingRemoteChanges){r(o);return}if(n.isUndoing||n.isRedoing){r(o);return}if(o.type==="split_node"){const s=o.properties._key&&Mke({blockIndexMap:n.blockIndexMap,context:{schema:e.schema,value:n.value}},o.path,o.properties._key)?void 0:o.properties._key;r({...o,properties:{...o.properties,_key:s===void 0?t.getSnapshot().context.keyGenerator():s}});return}if(o.type==="insert_node"&&!De.isEditor(o.node)){const s=o.node._key&&Mke({blockIndexMap:n.blockIndexMap,context:{schema:e.schema,value:n.value}},o.path,o.node._key)?void 0:o.node._key;r({...o,node:{...o.node,_key:s===void 0?t.getSnapshot().context.keyGenerator():s}});return}if(o.type==="merge_node"){const s=o.path[o.path.length-1],a=ut.previous(o.path),l=a[a.length-1];if(o.path.length!==1||a.length!==1){r(o);return}const c=n.value.at(s),u=n.value.at(l);if(!c||!u){r(o);return}if(!qn(t.getSnapshot().context,c)||!qn(t.getSnapshot().context,u)){r(o);return}const f=u.children.map(y=>y._key),h=u.markDefs?.map(y=>y._key)??[],p=new Map,m=c.markDefs?.map(y=>{if(h.includes(y._key)){const b=t.getSnapshot().context.keyGenerator();return p.set(y._key,b),{...y,_key:b}}return y});let g=0;for(const y of c.children){if(Ci(t.getSnapshot().context,y)){const b=y.marks?.map(v=>p.get(v)||v)??[];p2e(y.marks,b)||wt.setNodes(n,{marks:b},{at:[s,g]})}f.includes(y._key)&&wt.setNodes(n,{_key:t.getSnapshot().context.keyGenerator()},{at:[s,g]}),g++}r({...o,properties:{...o.properties,markDefs:m}});return}r(o)},n.normalizeNode=o=>{const[s,a]=o;if(On.isElement(s)){const[l]=De.parent(n,a);if(l&&De.isEditor(l)){const c=new Set;for(const u of l.children){if(u._key&&c.has(u._key)){const f=t.getSnapshot().context.keyGenerator();c.add(f),Ou(n,()=>{wt.setNodes(n,{_key:f},{at:a})});return}if(!u._key){const f=t.getSnapshot().context.keyGenerator();c.add(f),Ou(n,()=>{wt.setNodes(n,{_key:f},{at:a})});return}c.add(u._key)}}}if(On.isElement(s)&&s._type===t.getSnapshot().context.schema.block.name){if(!s._key){Ou(n,()=>{wt.setNodes(n,{_key:t.getSnapshot().context.keyGenerator()},{at:a})});return}const l=new Set;for(const[c,u]of hn.children(n,a)){if(c._key&&l.has(c._key)){const f=t.getSnapshot().context.keyGenerator();l.add(f),Ou(n,()=>{wt.setNodes(n,{_key:f},{at:u})});return}if(!c._key){const f=t.getSnapshot().context.keyGenerator();l.add(f),Ou(n,()=>{wt.setNodes(n,{_key:f},{at:u})});return}l.add(c._key)}}Ou(n,()=>{i(o)})},n}}function Mke(t,e,n){if(e.length===1)return t.blockIndexMap.has(n);if(e.length>2)return!1;const r=e.at(0),i=r!==void 0?t.context.value.at(r):void 0;return!i||!qn(t.context,i)?!1:i.children.some(o=>o._key===n)}function i5n({editor:t,editorActor:e}){const n=()=>{if(t.selection)if(t.selection===t.lastSlateSelection)e.send({type:"update selection",selection:t.lastSelection});else{const i=Ph({schema:e.getSnapshot().context.schema,editor:t,range:t.selection});t.lastSlateSelection=t.selection,t.lastSelection=i,e.send({type:"update selection",selection:i})}else e.send({type:"update selection",selection:null})},{onChange:r}=t;return t.onChange=()=>{r(),e.getSnapshot().matches({setup:"setting up"})||n()},t}function nse(t){return typeof t=="object"&&t!==null?!("_type"in t)&&"children"in t&&Array.isArray(t.children):!1}function wp(t,e){return PS(e)&&e._type===t.schema.block.name}function x2e(t,e){return typeof e!="object"||e===null||"children"in e?!1:"_type"in e?e._type===t.schema.span.name:"text"in e}function YT(t,e){return!(typeof e!="object"||e===null||!("text"in e)||typeof e.text!="string"||"_type"in e&&e._type!==t.schema.span.name)}function o5n(t,e){return!nse(e)&&!wp(t,e)&&!x2e(t,e)&&!YT(t,e)}function rse(t,e){const n=e.at(0);if(!(n===void 0||e.length!==1))return t.children.at(n)}function mC(t,e,n){if(n.length===0)return e;if(n.length===1)return rse(e,n);if(n.length===2){const r=rse(e,n.slice(0,1));return!r||!wp(t,r)?void 0:r.children.at(n[1])||void 0}}function Lke(t,e,n){const r=mC(t,e,n);if(r&&x2e(t,r))return r}function YE(t,e,n){if(n.length===0)return;const r=n.slice(0,-1);if(r.length===0)return e;const i=r.at(0);if(i===void 0||r.length!==1)return;const o=e.children.at(i);if(o&&wp(t,o))return o}function s5n(t,e,n){const r={children:e};try{return a5n(t,r,n).children}catch(i){return console.error(i),e}}function a5n(t,e,n){switch(n.type){case"insert_node":{const{path:r,node:i}=n,o=YE(t,e,r),s=r[r.length-1];if(!o||s>o.children.length)return e;if(r.length===1){if(wp(t,i)){const a={...i,children:i.children.map(l=>"__inline"in l?{_key:l._key,_type:l._type,..."value"in l&&typeof l.value=="object"?l.value:{}}:l)};return{...e,children:db(e.children,s,a)}}if(On.isElement(i)&&!("__inline"in i)){const a={_key:i._key,_type:i._type,..."value"in i&&typeof i.value=="object"?i.value:{}};return{...e,children:db(e.children,s,a)}}}if(r.length===2){const a=r[0];if(!wp(t,o))return e;let l;if(YT(t,i))l=i;else if("__inline"in i)l={_key:i._key,_type:i._type,..."value"in i&&typeof i.value=="object"?i.value:{}};else return e;return S5(t,e,a,c=>({...c,children:db(c.children,s,l)}))}return e}case"insert_text":{const{path:r,offset:i,text:o}=n;if(o.length===0)return e;const s=Lke(t,e,r);if(!s)return e;const a=r[0],l=r[1],c=s.text.slice(0,i),u=s.text.slice(i),f={...s,text:c+o+u};return S5(t,e,a,h=>({...h,children:Wm(h.children,l,f)}))}case"merge_node":{const{path:r}=n;if(r.at(-1)===0)return e;const i=mC(t,e,r),o=ut.previous(r),s=mC(t,e,o),a=YE(t,e,r);if(!i||!s||!a)return e;const l=r[r.length-1];if(YT(t,i)&&YT(t,s)){const c=r[0],u={...s,text:s.text+i.text};return S5(t,e,c,f=>{const h=Wm(f.children,l-1,u);return{...f,children:Yx(h,l)}})}if(wp(t,i)&&wp(t,s)){const c={...s,children:[...s.children,...i.children]},u=Wm(e.children,l-1,c);return{...e,children:Yx(u,l)}}return e}case"move_node":{const{path:r,newPath:i}=n;if(ut.isAncestor(r,i))return e;const o=mC(t,e,r),s=YE(t,e,r),a=r[r.length-1];if(!o||!s)return e;let l;if(r.length===1)l={...e,children:Yx(e.children,a)};else if(r.length===2){const f=r[0];l=S5(t,e,f,h=>({...h,children:Yx(h.children,a)}))}else return e;const c=ut.transform(r,n),u=c[c.length-1];if(c.length===1)return{...l,children:db(l.children,u,o)};if(c.length===2){const f=c[0],h=l.children[f];return!h||!wp(t,h)?e:S5(t,l,f,p=>({...p,children:db(p.children,u,o)}))}return e}case"remove_node":{const{path:r}=n,i=r[r.length-1];if(!YE(t,e,r))return e;if(r.length===1)return{...e,children:Yx(e.children,i)};if(r.length===2){const o=r[0];return S5(t,e,o,s=>({...s,children:Yx(s.children,i)}))}return e}case"remove_text":{const{path:r,offset:i,text:o}=n;if(o.length===0)return e;const s=Lke(t,e,r);if(!s)return e;const a=r[0],l=r[1],c=s.text.slice(0,i),u=s.text.slice(i+o.length),f={...s,text:c+u};return S5(t,e,a,h=>({...h,children:Wm(h.children,l,f)}))}case"set_node":{const{path:r,properties:i,newProperties:o}=n,s=mC(t,e,r);if(!s||nse(s))return e;if(o5n(t,s)){const a="value"in i&&typeof i.value=="object"?i.value:{},l="value"in o&&typeof o.value=="object"?o.value:{},c={...s};for(const u in o){if(u==="value")continue;const f=o[u];f==null?delete c[u]:c[u]=f}for(const u in i)u!=="value"&&(o.hasOwnProperty(u)||delete c[u]);for(const u in l){const f=l[u];f==null?delete c[u]:c[u]=f}for(const u in a)l.hasOwnProperty(u)||delete c[u];return r.length===1?{...e,children:Wm(e.children,r[0],c)}:r.length===2?S5(t,e,r[0],u=>({...u,children:Wm(u.children,r[1],c)})):e}if(wp(t,s)){const a={...s};for(const l in o){if(l==="children"||l==="text")continue;const c=o[l];c==null?delete a[l]:a[l]=c}for(const l in i)o.hasOwnProperty(l)||delete a[l];return{...e,children:Wm(e.children,r[0],a)}}if(YT(t,s)){const a={...s};for(const l in o){if(l==="text")continue;const c=o[l];c==null?delete a[l]:a[l]=c}for(const l in i)o.hasOwnProperty(l)||delete a[l];return S5(t,e,r[0],l=>({...l,children:Wm(l.children,r[1],a)}))}return e}case"split_node":{const{path:r,position:i,properties:o}=n;if(r.length===0)return e;const s=YE(t,e,r),a=r[r.length-1];if(!s)return e;if(nse(s)){const l=rse(e,r);if(!l||!wp(t,l))return e;const c=l.children.slice(0,i),u=l.children.slice(i),f={...l,children:c},h={...o,children:u,_type:t.schema.block.name};return{...e,children:db(Wm(e.children,a,f),a+1,h)}}if(wp(t,s)){const l=mC(t,e,r);if(!l||!x2e(t,l))return e;const c=r[0],u=l.text.slice(0,i),f=l.text.slice(i),h={...l,text:u},p={...o,text:f};return S5(t,e,c,m=>({...m,children:db(Wm(m.children,a,h),a+1,p)}))}return e}}}function db(t,e,...n){return[...t.slice(0,e),...n,...t.slice(e)]}function Yx(t,e,n=1){return[...t.slice(0,e),...t.slice(e+n)]}function Wm(t,e,n){return[...t.slice(0,e),n,...t.slice(e+1)]}function S5(t,e,n,r){const i=e.children.at(n);if(!i||!wp(t,i))return e;const o=r(i);return{...e,children:Wm(e.children,n,o)}}function l5n(t,e){const{apply:n}=e;return e.apply=r=>{if(e.isNormalizingNode&&Yn.normalization(`(slate operation) +${JSON.stringify(r,null,2)}`),r.type==="set_selection"){n(r);return}if(e.value=s5n(t,e.value,r),r.type==="insert_text"||r.type==="remove_text"){n(r);return}Itt({schema:t.schema,value:e.value},{blockIndexMap:e.blockIndexMap,listIndexMap:e.listIndexMap}),n(r)},e}const c5n=(t,e)=>{const n=t,{editorActor:r,relayActor:i}=e,o=r5n(r),s=n5n({editorActor:r}),a=t5n({editorActor:r,relayActor:i,subscriptions:e.subscriptions}),l=s0n({editorActor:r,subscriptions:e.subscriptions}),c=a0n(r);return r0n(r)(s(o(c(l(a(l5n(r.getSnapshot().context,i5n({editorActor:r,editor:n}))))))))};function u5n(t){Yn.setup("creating new slate editor instance");const e=t.editorActor.getSnapshot().context,n=jtt(e),r=ehn({schema:e.schema,keyGenerator:e.keyGenerator});r.decoratedRanges=[],r.decoratorState={},r.blockIndexMap=new Map,r.history={undos:[],redos:[]},r.lastSelection=null,r.lastSlateSelection=null,r.listIndexMap=new Map,r.remotePatches=[],r.undoStepId=void 0,r.value=[n],r.isDeferringMutations=!1,r.isNormalizingNode=!1,r.isPatching=!0,r.isPerformingBehaviorOperation=!1,r.isProcessingRemoteChanges=!1,r.isRedoing=!1,r.isUndoing=!1,r.withHistory=!0;const i=c5n(rmn(r),{editorActor:t.editorActor,relayActor:t.relayActor,subscriptions:t.subscriptions});return Itt({schema:e.schema,value:i.value},{blockIndexMap:i.blockIndexMap,listIndexMap:i.listIndexMap}),{instance:i,initialValue:[n]}}function ise(t,e){return{getBlockNodes:n=>C2e(e,n),getChildNodes:n=>d5n(e,n),getEditorElement:()=>f5n(e),getSelectionRect:n=>h5n(n),getStartBlockElement:n=>p5n(e,n),getEndBlockElement:n=>m5n(e,n),setDragGhost:({event:n,ghost:r})=>g5n({sendBack:t,event:n,ghost:r})}}function C2e(t,e){if(!e.context.selection)return[];const n=p1(e);if(!n)return[];try{return Array.from(De.nodes(t,{at:n,mode:"highest",match:r=>!De.isEditor(r)})).map(([r])=>Zr.toDOMNode(t,r))}catch{return[]}}function d5n(t,e){if(!e.context.selection)return[];const n=p1(e);if(!n)return[];try{return Array.from(De.nodes(t,{at:n,mode:"lowest",match:r=>!De.isEditor(r)})).map(([r])=>Zr.toDOMNode(t,r))}catch{return[]}}function f5n(t){try{return Zr.toDOMNode(t,t)}catch{return}}function h5n(t){if(!t.context.selection)return null;try{const e=window.getSelection();return e?e.getRangeAt(0).getBoundingClientRect():null}catch{return null}}function p5n(t,e){const n=wv(e);if(!n)return null;const r=C2e(t,{...e,context:{...e.context,selection:{anchor:{path:n.path,offset:0},focus:{path:n.path,offset:0}}}})?.at(0);return r&&r instanceof Element?r:null}function m5n(t,e){const n=Cv(e);if(!n)return null;const r=C2e(t,{...e,context:{...e.context,selection:{anchor:{path:n.path,offset:0},focus:{path:n.path,offset:0}}}})?.at(0);return r&&r instanceof Element?r:null}function g5n({sendBack:t,event:e,ghost:n}){e.originEvent.dataTransfer.setDragImage(n.element,n.x,n.y),t({type:"set drag ghost",ghost:n.element})}const y5n={on:"annotation.add",guard:({snapshot:t,event:e})=>{const n=e.at??t.context.selection;if(!n)return!1;const r={...t,context:{...t.context,selection:n}};if(!hl(r))return!1;const i=Znn(r);return!i||!cm({context:{...r.context,selection:i}})?!1:{caretWordSelection:i}},actions:[({event:t},{caretWordSelection:e})=>[Et({type:"select",at:e}),Et({type:"annotation.add",annotation:t.annotation})]]},b5n={on:"annotation.add",guard:({snapshot:t,event:e})=>{const n=e.at??t.context.selection;if(!n)return!1;const r={...t,context:{...t.context,selection:n}};return wN(e.annotation.name,{mode:"partial"})(r)},actions:[({event:t})=>[Et({type:"annotation.remove",annotation:t.annotation,at:t.at}),Et(t)]]},v5n={on:"delete",guard:({snapshot:t,event:e})=>{const n={...t,context:{...t.context,selection:e.at??t.context.selection}};if(!cm(n))return!1;const r=Jnn(n),i=qg(n),o=Qnn(n),s=i6(n);if(!r||!o||!i||!s||r.path[2]._key!==o.path[2]._key||!Ci(t.context,r.node)||!(i.offset===0&&s.offset===r.node.text.length))return!1;const a=t.context.schema.decorators.map(m=>m.name),l=r.node.marks??[];if(!l.some(m=>!a.includes(m)))return!1;const c=UQe(n),u=HQe(n),f=c?c.node.marks?.some(m=>!a.includes(m)&&l.includes(m)):!1,h=u?u.node.marks?.some(m=>!a.includes(m)&&l.includes(m)):!1;if(f||h)return!1;const p=g_(n);return{spanPath:r.path,activeDecorators:p}},actions:[({event:t},{spanPath:e,activeDecorators:n})=>[Et({type:"child.set",at:e,props:{marks:n}}),v0(t)]]},x5n=[y5n,b5n,v5n],s1={arrowDown:sl({default:[{key:"ArrowDown",alt:!1,ctrl:!1,meta:!1,shift:!1}]}),arrowUp:sl({default:[{key:"ArrowUp",alt:!1,ctrl:!1,meta:!1,shift:!1}]}),backspace:sl({default:[{key:"Backspace",alt:!1,ctrl:!1,meta:!1,shift:!1}]}),break:sl({default:[{key:"Enter",shift:!1}]}),lineBreak:sl({default:[{key:"Enter",shift:!0}]}),decorators:{strong:U1n,em:W1n,underline:G1n,code:q1n},delete:sl({default:[{key:"Delete",alt:!1,ctrl:!1,meta:!1,shift:!1}]}),deleteWord:{backward:sl({default:[{key:"Backspace",alt:!1,ctrl:!0,meta:!1}],apple:[{key:"Backspace",alt:!0,ctrl:!1,meta:!1}]}),forward:sl({default:[{key:"Delete",alt:!1,ctrl:!0,meta:!1}],apple:[{key:"Delete",alt:!0,ctrl:!1,meta:!1}]})},history:{undo:Y1n,redo:K1n},tab:sl({default:[{key:"Tab",alt:!1,ctrl:!1,meta:!1,shift:!1}]}),shiftTab:sl({default:[{key:"Tab",alt:!1,ctrl:!1,meta:!1,shift:!0}]})},C5n={on:"keyboard.keydown",guard:({snapshot:t,event:e})=>{if(!s1.arrowDown.guard(e.originEvent)||!hl(t))return!1;const n=LS(t),r=C8(t);return n&&!r},actions:[({snapshot:t})=>[Et({type:"insert.block",block:{_type:t.context.schema.block.name},placement:"after"})]]},w5n={on:"keyboard.keydown",guard:({snapshot:t,event:e})=>{if(!s1.arrowUp.guard(e.originEvent)||!hl(t))return!1;const n=LS(t),r=o6(t);return n&&!r},actions:[({snapshot:t})=>[Et({type:"insert.block",block:{_type:t.context.schema.block.name},placement:"before"})]]},_5n={on:"insert.break",guard:({snapshot:t})=>{const e=LS(t);return hl(t)&&e!==void 0},actions:[({snapshot:t})=>[Et({type:"insert.block",block:{_type:t.context.schema.block.name},placement:"after"})]]},S5n={on:"mouse.click",guard:({snapshot:t,event:e})=>{if(t.context.readOnly||t.context.selection&&!hl(t))return!1;const n=LS({...t,context:{...t.context,selection:e.position.selection}}),r=o6({...t,context:{...t.context,selection:e.position.selection}});return e.position.isEditor&&e.position.block==="start"&&n&&!r},actions:[({snapshot:t,event:e})=>[Et({type:"select",at:e.position.selection}),Et({type:"insert.block",block:{_type:t.context.schema.block.name},placement:"before",select:"start"})]]},k5n={on:"mouse.click",guard:({snapshot:t,event:e})=>{if(t.context.readOnly||t.context.selection&&!hl(t))return!1;const n=LS({...t,context:{...t.context,selection:e.position.selection}}),r=C8({...t,context:{...t.context,selection:e.position.selection}});return e.position.isEditor&&e.position.block==="end"&&n&&!r},actions:[({snapshot:t,event:e})=>[Et({type:"select",at:e.position.selection}),Et({type:"insert.block",block:{_type:t.context.schema.block.name},placement:"after",select:"start"})]]},E5n={on:"delete.backward",guard:({snapshot:t})=>{const e=$s(t),n=hl(t),r=o6(t);return!e||!n||!r||I2(t.context,e.node)?!1:c1(t.context,e.node)&&!qn(t.context,r.node)?{focusTextBlock:e,previousBlock:r}:!1},actions:[(t,{focusTextBlock:e,previousBlock:n})=>[Et({type:"delete.block",at:e.path}),Et({type:"select",at:{anchor:{path:n.path,offset:0},focus:{path:n.path,offset:0}}})]]},T5n={on:"delete.forward",guard:({snapshot:t})=>{const e=$s(t),n=hl(t),r=C8(t);return!e||!n||!r?!1:c1(t.context,e.node)&&!qn(t.context,r.node)?{focusTextBlock:e,nextBlock:r}:!1},actions:[(t,{focusTextBlock:e,nextBlock:n})=>[Et({type:"delete.block",at:e.path}),Et({type:"select",at:{anchor:{path:n.path,offset:0},focus:{path:n.path,offset:0}}})]]},fb={arrowDownOnLonelyBlockObject:C5n,arrowUpOnLonelyBlockObject:w5n,breakingBlockObject:_5n,clickingAboveLonelyBlockObject:S5n,clickingBelowLonelyBlockObject:k5n,deletingEmptyTextBlockAfterBlockObject:E5n,deletingEmptyTextBlockBeforeBlockObject:T5n},e$={strongShortcut:{on:"keyboard.keydown",guard:({snapshot:t,event:e})=>s1.decorators.strong.guard(e.originEvent)&&t.context.schema.decorators.some(n=>n.name==="strong"),actions:[()=>[Et({type:"decorator.toggle",decorator:"strong"})]]},emShortcut:{on:"keyboard.keydown",guard:({snapshot:t,event:e})=>s1.decorators.em.guard(e.originEvent)&&t.context.schema.decorators.some(n=>n.name==="em"),actions:[()=>[Et({type:"decorator.toggle",decorator:"em"})]]},underlineShortcut:{on:"keyboard.keydown",guard:({snapshot:t,event:e})=>s1.decorators.underline.guard(e.originEvent)&&t.context.schema.decorators.some(n=>n.name==="underline"),actions:[()=>[Et({type:"decorator.toggle",decorator:"underline"})]]},codeShortcut:{on:"keyboard.keydown",guard:({snapshot:t,event:e})=>s1.decorators.code.guard(e.originEvent)&&t.context.schema.decorators.some(n=>n.name==="code"),actions:[()=>[Et({type:"decorator.toggle",decorator:"code"})]]}};function Fke(t){if(t.length===0)return new DOMRect(0,0,0,0);const e=t.filter(a=>a instanceof Element),n=e.at(0)?.getBoundingClientRect();if(!n)return new DOMRect(0,0,0,0);let r=n.left,i=n.top,o=n.right,s=n.bottom;for(let a=1;a{const r=tse({snapshot:t,eventSelection:n.position.selection}),i=Loe({...t,context:{...t.context,selection:r}}),o={blockNodes:e.getBlockNodes({...t,context:{...t.context,selection:r}}),childNodes:e.getChildNodes({...t,context:{...t.context,selection:r}})};return{dragSelection:r,draggedDomNodes:o,selectingEntireBlocks:i}},actions:[({dom:t,event:e},{dragSelection:n,draggedDomNodes:r,selectingEntireBlocks:i})=>{const o=document.createElement("div");if(i){const s=r.blockNodes.map(l=>l.cloneNode(!0));for(const l of s)l instanceof HTMLElement&&(l.style.position="relative"),o.appendChild(l);const a=o.querySelector("[data-pt-drag-ghost-element]");if(a&&o.replaceChildren(a),o.setAttribute("data-dragged",""),o.style.position="absolute",o.style.left="-99999px",o.style.boxSizing="border-box",document.body.appendChild(o),a){const l=a.getBoundingClientRect(),c=e.originEvent.clientX-l.left,u=e.originEvent.clientY-l.top;return o.style.width=`${l.width}px`,o.style.height=`${l.height}px`,[Et({type:"select",at:n}),r9(()=>{t.setDragGhost({event:e,ghost:{element:o,x:c,y:u}})}),v0(e)]}else{const l=Fke(r.blockNodes),c=e.originEvent.clientX-l.left,u=e.originEvent.clientY-l.top;return o.style.width=`${l.width}px`,o.style.height=`${l.height}px`,[Et({type:"select",at:n}),r9(()=>{t.setDragGhost({event:e,ghost:{element:o,x:c,y:u}})}),v0(e)]}}else{const s=r.childNodes.map(u=>u.cloneNode(!0));for(const u of s)o.appendChild(u);o.style.position="absolute",o.style.left="-99999px",o.style.boxSizing="border-box",document.body.appendChild(o);const a=Fke(r.childNodes),l=e.originEvent.clientX-a.left,c=e.originEvent.clientY-a.top;return o.style.width=`${a.width}px`,o.style.height=`${a.height}px`,[Et({type:"select",at:n}),r9(()=>{t.setDragGhost({event:e,ghost:{element:o,x:l,y:c}})}),v0(e)]}}]},{on:"drag.dragover",guard:({snapshot:t,event:e})=>{const n=e.dragOrigin;return n?JM(e.position.selection)({...t,context:{...t.context,selection:n.selection}}):!1},actions:[]},{on:"drag.drop",guard:({snapshot:t,event:e})=>{const n=e.dragOrigin,r=e.position.selection;return n?JM(r)({...t,context:{...t.context,selection:n.selection}}):!1},actions:[]},{on:"drag.drop",guard:({event:t})=>t.dragOrigin!==void 0,actions:[({event:t})=>[Et({type:"deserialize",originEvent:t})]]},{on:"drag.drop",actions:[({event:t})=>[Et({type:"select",at:t.position.selection}),Et({type:"deserialize",originEvent:t})]]},{on:"deserialization.success",guard:({snapshot:t,event:e})=>{if(e.originEvent.type!=="drag.drop"||e.originEvent.dragOrigin===void 0)return!1;const n=e.originEvent.dragOrigin,r=tse({eventSelection:n.selection,snapshot:t}),i=e.originEvent.position.selection,o=n?JM(i)({...t,context:{...t.context,selection:r}}):!1,s=Loe({...t,context:{...t.context,selection:r}}),a=V0({...t,context:{...t.context,selection:r}});return o?!1:{dropPosition:i,draggingEntireBlocks:s,draggedBlocks:a,dragOrigin:n,originEvent:e.originEvent}},actions:[({event:t},{draggingEntireBlocks:e,draggedBlocks:n,dragOrigin:r,dropPosition:i,originEvent:o})=>[Et({type:"select",at:i}),...e?n.map(s=>Et({type:"delete.block",at:s.path})):[Et({type:"delete",at:r.selection})],Et({type:"insert.blocks",blocks:t.data,placement:e?o.position.block==="start"?"before":o.position.block==="end"?"after":"auto":"auto"})]]}],j5n=[{on:"insert.text",guard:({snapshot:t})=>{if(!Sg(t))return!1;const e=MS(t),n=g_(t),r=Pfe(t);if(e&&e.state==="unchanged"){const i=(e.marks??[]).filter(o=>t.context.schema.decorators.map(s=>s.name).includes(o));if(i.length===n.length&&i.every(o=>n.includes(o)))return!1}return{activeDecorators:n,activeAnnotations:r}},actions:[({snapshot:t,event:e},{activeDecorators:n,activeAnnotations:r})=>[Et({type:"insert.child",child:{_type:t.context.schema.span.name,text:e.text,marks:[...n,...r]}})]]}],A5n={on:"insert.break",guard:({snapshot:t})=>{const e=$s(t),n=hl(t);if(!t.context.selection||!e||!n)return!1;const r=qQe(e)(t),i=e.node.listItem,o=e.node.level;return r?{focusListItem:i,focusLevel:o}:!1},actions:[({snapshot:t},{focusListItem:e,focusLevel:n})=>[Et({type:"insert.block",block:{_type:t.context.schema.block.name,children:[{_type:t.context.schema.span.name,text:"",marks:[]}],markDefs:[],listItem:e,level:n,style:t.context.schema.styles[0]?.name},placement:"after"})]]},R5n={on:"insert.break",guard:({snapshot:t})=>{const e=$s(t),n=hl(t);if(!t.context.selection||!e||!n)return!1;const r=Sg(t),i=r?.node.marks?.filter(l=>t.context.schema.decorators.some(c=>c.name===l)??[]),o=r?.node.marks?.filter(l=>!t.context.schema.decorators.some(c=>c.name===l))??[],s=e.node.listItem,a=e.node.level;return GQe(e)(t)?{focusAnnotations:o,focusDecorators:i,focusListItem:s,focusLevel:a}:!1},actions:[({snapshot:t},{focusAnnotations:e,focusDecorators:n,focusListItem:r,focusLevel:i})=>[Et({type:"insert.block",block:{_type:t.context.schema.block.name,children:[{_type:t.context.schema.span.name,marks:e.length===0?n:[],text:""}],listItem:r,level:i,style:t.context.schema.styles[0]?.name},placement:"before",select:"none"})]]},D5n={on:"insert.break",guard:({snapshot:t})=>{if(!t.context.selection||!cm(t))return!1;const e=V0(t),n=wv(t),r=Cv(t);if(!n||!r)return!1;const i=Nh({context:t.context,block:n}),o=Bh(t.context.selection),s=yd({context:t.context,block:r}),a=D0(t.context.selection);return pd(o,i)&&pd(a,s)?{selectedBlocks:e}:!1},actions:[({snapshot:t},{selectedBlocks:e})=>[Et({type:"insert.block",block:{_type:t.context.schema.block.name,children:[{_type:t.context.schema.span.name,text:"",marks:[]}]},placement:"before",select:"start"}),...e.map(n=>Et({type:"delete.block",at:n.path}))]]},O5n={on:"insert.break",guard:({snapshot:t})=>{const e=hl(t),n=xw(t);return e&&n},actions:[()=>[Et({type:"move.forward",distance:1}),Et({type:"split"})]]},t$={breakingAtTheEndOfTextBlock:A5n,breakingAtTheStartOfTextBlock:R5n,breakingEntireBlocks:D5n,breakingInlineObject:O5n};function Ltt({context:t,block:e}){return!qn(t,e)||!t.selection||!J3(t.selection)?!1:b1(t.selection.focus)===e.children[0]?._key&&t.selection.focus.offset===0}const w2e=10,P5n={on:"delete.backward",guard:({snapshot:t})=>{const e=$s(t);return!e||e.node.level!==1||!Ltt({context:t.context,block:e.node})?!1:{focusTextBlock:e}},actions:[(t,{focusTextBlock:e})=>[Et({type:"block.unset",props:["listItem","level"],at:e.path})]]},$5n={on:"delete.backward",guard:({snapshot:t})=>{const e=hl(t),n=$s(t),r=Sg(t);return!e||!n||!r?!1:n.node.children[0]?._key===r.node._key&&t.context.selection?.focus.offset===0&&n.node.level!==void 0&&n.node.level>1?{focusTextBlock:n,level:n.node.level-1}:!1},actions:[(t,{focusTextBlock:e,level:n})=>[Et({type:"block.set",props:{level:n},at:e.path})]]},M5n={on:"delete.forward",guard:({snapshot:t})=>{const e=zR(t),n=C8(t);return!e||!n||!qn(t.context,n.node)||!c1(t.context,e.node)?!1:{focusListBlock:e,nextBlock:n}},actions:[(t,{nextBlock:e})=>[Et({type:"insert.block",block:e.node,placement:"auto",select:"start"}),Et({type:"delete.block",at:e.path})]]},L5n={on:"delete.backward",guard:({snapshot:t})=>{const e=$s(t),n=o6(t);if(!e||!n||!Ltt({context:t.context,block:e.node})||!I2(t.context,n.node)||!c1(t.context,n.node))return!1;const r=yd({context:t.context,block:n});return{focusTextBlock:e,previousBlockEndPoint:r}},actions:[(t,{focusTextBlock:e,previousBlockEndPoint:n})=>[Et({type:"select",at:{anchor:n,focus:n}}),Et({type:"insert.block",block:e.node,placement:"auto",select:"start"}),Et({type:"delete.block",at:e.path})]]},F5n={on:"delete",guard:({snapshot:t,event:e})=>{const n=e.at??t.context.selection;if(!n)return!1;const r=V0({...t,context:{...t.context,selection:n}});if(r.length<2)return!1;const i=r.at(0)?.node,o=r.slice(1,-1),s=r.at(-1)?.node;if(!I2(t.context,i)||!I2(t.context,s))return!1;const a=qg({context:{...t.context,selection:n}}),l=i6({context:{...t.context,selection:n}});if(!a||!l)return!1;const c=Nh({context:t.context,block:{node:i,path:[{_key:i._key}]}});if(!pd(a,c))return!1;const u=yd({context:t.context,block:{node:i,path:[{_key:i._key}]}}),f=yd({context:t.context,block:{node:s,path:[{_key:s._key}]}}),h=Dfe({context:{schema:t.context.schema,selection:{anchor:l,focus:f}},block:s});return{startBlockStartPoint:c,startBlockEndPoint:u,middleBlocks:o,endBlock:s,slicedEndBlock:h}},actions:[(t,{startBlockStartPoint:e,startBlockEndPoint:n,middleBlocks:r,endBlock:i,slicedEndBlock:o})=>[...r.map(s=>Et({type:"delete.block",at:s.path})),Et({type:"delete.block",at:[{_key:i._key}]}),Et({type:"select",at:{anchor:n,focus:n}}),Et({type:"insert.block",block:o,placement:"auto",select:"none"}),Et({type:"delete",at:{anchor:e,focus:n}})]]},N5n={on:"insert.break",guard:({snapshot:t})=>{const e=hl(t),n=zR(t);return!e||!n||!c1(t.context,n.node)?!1:{focusListBlock:n}},actions:[(t,{focusListBlock:e})=>[Et({type:"block.unset",props:["listItem","level"],at:e.path})]]},B5n={on:"keyboard.keydown",guard:({snapshot:t,event:e})=>{if(!s1.tab.guard(e.originEvent))return!1;const n=V0(t),r=n.flatMap(i=>I2(t.context,i.node)?[{node:i.node,path:i.path}]:[]);return r.length===n.length?{selectedListBlocks:r}:!1},actions:[(t,{selectedListBlocks:e})=>e.map(n=>Et({type:"block.set",props:{level:Math.min(w2e,Math.max(1,n.node.level+1))},at:n.path}))]},V5n={on:"keyboard.keydown",guard:({snapshot:t,event:e})=>{if(!s1.shiftTab.guard(e.originEvent))return!1;const n=V0(t),r=n.flatMap(i=>I2(t.context,i.node)?[{node:i.node,path:i.path}]:[]);return r.length===n.length?{selectedListBlocks:r}:!1},actions:[(t,{selectedListBlocks:e})=>e.map(n=>Et({type:"block.set",props:{level:Math.min(w2e,Math.max(1,n.node.level-1))},at:n.path}))]},z5n={on:"insert.blocks",guard:({snapshot:t,event:e})=>{const n={...t,context:{...t.context,selection:e.at??t.context.selection}},r=zR(n);if(!r)return!1;const i=e.blocks.at(0),o=e.blocks.at(1),s=I2(t.context,i)?i:I2(t.context,o)?o:void 0;if(!s)return!1;const a=r.node.level-s.level;return a===0?!1:{levelDifference:a,insertedListBlock:s}},actions:[({snapshot:t,event:e},{levelDifference:n,insertedListBlock:r})=>{let i=!0,o=!1;return[Et({...e,blocks:e.blocks.map(s=>(s._key===r._key&&(o=!0),i?o&&i&&I2(t.context,s)?{...s,level:Math.min(w2e,Math.max(1,s.level+n))}:(o&&(i=!1),s):s))})]}]},H5n={on:"insert.blocks",guard:({snapshot:t,event:e})=>{const n={...t,context:{...t.context,selection:e.at??t.context.selection}},r=zR(n);if(!r||c1(t.context,r.node))return!1;const i=e.blocks.at(0),o=e.blocks.at(1),s=I2(t.context,i)?i:I2(t.context,o)?o:void 0;return!s||r.node.level!==s.level||r.node.listItem===s.listItem?!1:{listItem:r.node.listItem,insertedListBlock:s}},actions:[({snapshot:t,event:e},{listItem:n,insertedListBlock:r})=>{let i=!0,o=!1;return[Et({...e,blocks:e.blocks.map(s=>(s._key===r._key&&(o=!0),i?o&&i&&I2(t.context,s)?{...s,listItem:s.level===r.level?n:s.listItem}:(o&&(i=!1),s):s))})]}]},U5n={on:"insert.block",guard:({snapshot:t,event:e})=>{if(e.placement!=="auto"||e.block._type!==t.context.schema.block.name||e.block.listItem!==void 0)return!1;const n={...t,context:{...t.context,selection:e.at??t.context.selection}},r=zR(n);return!r||!c1(t.context,r.node)?!1:{level:r.node.level,listItem:r.node.listItem}},actions:[({event:t},{level:e,listItem:n})=>[Et({...t,block:{...t.block,level:e,listItem:n}})]]},zm={clearListOnBackspace:P5n,unindentListOnBackspace:$5n,mergeTextIntoListOnDelete:M5n,mergeTextIntoListOnBackspace:L5n,deletingListFromStart:F5n,clearListOnEnter:N5n,indentListOnTab:B5n,unindentListOnShiftTab:V5n,inheritListLevel:z5n,inheritListItem:H5n,inheritListProperties:U5n},W5n=[...x5n,e$.strongShortcut,e$.emShortcut,e$.underlineShortcut,e$.codeShortcut,...I5n,fb.clickingAboveLonelyBlockObject,fb.clickingBelowLonelyBlockObject,fb.arrowDownOnLonelyBlockObject,fb.arrowUpOnLonelyBlockObject,fb.breakingBlockObject,fb.deletingEmptyTextBlockAfterBlockObject,fb.deletingEmptyTextBlockBeforeBlockObject,...j5n,zm.clearListOnBackspace,zm.unindentListOnBackspace,zm.mergeTextIntoListOnDelete,zm.mergeTextIntoListOnBackspace,zm.deletingListFromStart,zm.clearListOnEnter,zm.indentListOnTab,zm.unindentListOnShiftTab,zm.inheritListLevel,zm.inheritListItem,zm.inheritListProperties,t$.breakingAtTheEndOfTextBlock,t$.breakingAtTheStartOfTextBlock,t$.breakingEntireBlocks,t$.breakingInlineObject];let Nke=$N;const Ftt=[];for(const t of W5n){const e=Yj({name:"core",reference:{priority:Nke,importance:"lower"}});Ftt.push({behavior:t,priority:e}),Nke=e}const q5n=Ftt;function Bke({converters:t,editor:e,keyGenerator:n,readOnly:r,schema:i}){const o=e.selection?Ph({schema:i,editor:e,range:e.selection}):null,s={converters:t,keyGenerator:n,readOnly:r,schema:i,selection:o,value:e.value};return{blockIndexMap:e.blockIndexMap,context:s,decoratorState:e.decoratorState}}const G5n=({context:t,operation:e})=>{const n=Nnn({annotation:{_type:e.annotation.name,_key:e.annotation._key,...e.annotation.value},context:t,options:{validateFields:!0}});if(!n)throw new Error(`Failed to parse annotation ${JSON.stringify(e.annotation)}`);const r=e.editor,i=e.at?p1({context:{schema:t.schema,value:e.editor.value,selection:e.at},blockIndexMap:e.editor.blockIndexMap}):null,o=i??r.selection;if(!o||It.isCollapsed(o))return;const s=i?De.rangeRef(r,i,{affinity:"inward"}):null,a=De.nodes(r,{at:o,match:c=>r.isTextBlock(c),reverse:It.isBackward(o)});let l=0;for(const[c,u]of a){if(c.children.length===0||c.children.length===1&&c.children[0]?.text==="")continue;const f=l===0?n._key:t.keyGenerator(),h=c.markDefs??[];h.find(g=>g._type===n._type&&g._key===f)===void 0&&wt.setNodes(r,{markDefs:[...h,{...n,_key:f}]},{at:u}),i?wt.setNodes(r,{},{match:Dn.isText,split:!0,at:i}):wt.setNodes(r,{},{match:Dn.isText,split:!0});const p=hn.children(r,u),m=s?.current??r.selection;for(const[g,y]of p){if(!r.isTextSpan(g)||!m||!It.includes(m,y))continue;const b=g.marks??[];wt.setNodes(r,{marks:[...b,f]},{at:y})}l++}s?.unref()},Y5n=({context:t,operation:e})=>{const n=e.editor,r=e.at?p1({context:{schema:t.schema,value:e.editor.value,selection:e.at},blockIndexMap:e.editor.blockIndexMap}):null,i=r??n.selection;if(i)if(It.isCollapsed(i)){const[o,s]=De.node(n,i,{depth:1});if(!n.isTextBlock(o))return;const a=(o.markDefs??[]).filter(p=>p._type===e.annotation.name),[l,c]=De.node(n,i,{depth:2});if(!n.isTextSpan(l))return;const u=l.marks?.find(p=>a.some(m=>m._key===p));if(!u)return;const f=[];for(const[p,m]of hn.children(n,s,{reverse:!0}))if(n.isTextSpan(p)&&ut.isBefore(m,c))if(p.marks?.includes(u))f.push([p,m]);else break;const h=[];for(const[p,m]of hn.children(n,s))if(n.isTextSpan(p)&&ut.isAfter(m,c))if(p.marks?.includes(u))h.push([p,m]);else break;for(const[p,m]of[...f,[l,c],...h])wt.setNodes(n,{marks:p.marks?.filter(g=>g!==u)},{at:m})}else{const o=r?De.rangeRef(n,r,{affinity:"inward"}):null;r?wt.setNodes(n,{},{match:l=>n.isTextSpan(l),split:!0,hanging:!0,at:r}):wt.setNodes(n,{},{match:l=>n.isTextSpan(l),split:!0,hanging:!0});const s=De.nodes(n,{at:i,match:l=>n.isTextBlock(l)}),a=o?.current??n.selection;for(const[l,c]of s){const u=hn.children(n,c);for(const[f,h]of u){if(!n.isTextSpan(f)||!a||!It.includes(a,h))continue;const p=l.markDefs??[],m=f.marks??[],g=m.filter(y=>p.find(b=>b._key===y)?._type!==e.annotation.name);g.length!==m.length&&wt.setNodes(n,{marks:g},{at:h})}}o?.unref()}},K5n=({context:t,operation:e})=>{const n=e.editor.blockIndexMap.get(e.at[0]._key);if(n===void 0)throw new Error(`Unable to find block index for block at ${JSON.stringify(e.at)}`);const r=e.editor.children.at(n);if(!r)throw new Error(`Unable to find block at ${JSON.stringify(e.at)}`);if(qn(t,r)){const i={};for(const o of Object.keys(e.props))if(!(o==="_type"||o==="children")){if(o==="style"){t.schema.styles.some(s=>s.name===e.props[o])&&(i[o]=e.props[o]);continue}if(o==="listItem"){t.schema.lists.some(s=>s.name===e.props[o])&&(i[o]=e.props[o]);continue}if(o==="level"){i[o]=e.props[o];continue}if(o==="markDefs"){const{markDefs:s}=NQe({context:t,markDefs:e.props[o],options:{validateFields:!0}});i[o]=s;continue}t.schema.block.fields?.some(s=>s.name===o)&&(i[o]=e.props[o])}wt.setNodes(e.editor,i,{at:[n]})}else{const i=t.schema.blockObjects.find(l=>l.name===r._type),o={};for(const l of Object.keys(e.props))if(l!=="_type"){if(l==="_key"){o[l]=e.props[l];continue}i?.fields.some(c=>c.name===l)&&(o[l]=e.props[l])}const s=Object.entries(o).map(([l,c])=>l==="_key"?eu(c,["_key"]):eu(c,["value",l])),a=Qm(r,s);wt.setNodes(e.editor,a,{at:[n]})}},X5n=({context:t,operation:e})=>{const n=e.at[0]._key,r=e.editor.blockIndexMap.get(n);if(r===void 0)throw new Error(`Unable to find block index for block key ${n}`);const i=r!==void 0?e.editor.children.at(r):void 0;if(!i)throw new Error(`Unable to find block at ${JSON.stringify(e.at)}`);if(qn(t,i)){const a=e.props.filter(l=>l!=="_type"&&l!=="_key"&&l!=="children");wt.unsetNodes(e.editor,a,{at:[r]}),e.props.includes("_key")&&wt.setNodes(e.editor,{_key:t.keyGenerator()},{at:[r]});return}const o=e.props.flatMap(a=>a==="_type"?[]:a==="_key"?eu(t.keyGenerator(),["_key"]):Mu(["value",a])),s=Qm(i,o);wt.setNodes(e.editor,s,{at:[r]})},Z5n=({context:t,operation:e})=>{const n=p1({context:{schema:t.schema,value:e.editor.value,selection:{anchor:{path:e.at,offset:0},focus:{path:e.at,offset:0}}},blockIndexMap:e.editor.blockIndexMap});if(!n)throw new Error(`Unable to convert ${JSON.stringify(e.at)} into a Slate Range`);const r=De.node(e.editor,n,{depth:2}),i=r?.[0],o=r?.[1];if(!i||!o)throw new Error(`Unable to find child at ${JSON.stringify(e.at)}`);if(e.editor.isTextSpan(i)){const{_type:s,text:a,...l}=e.props;wt.setNodes(e.editor,{...i,...l},{at:o}),typeof a=="string"&&i.text!==a&&(e.editor.apply({type:"remove_text",path:o,offset:0,text:i.text}),e.editor.apply({type:"insert_text",path:o,offset:0,text:a}));return}if(On.isElement(i)){const s=t.schema.inlineObjects.find(f=>f.name===i._type);if(!s)throw new Error(`Unable to find schema definition for Inline Object type ${i._type}`);const a="value"in i&&typeof i.value=="object"?i.value:{},{_type:l,_key:c,...u}=e.props;for(const f in u)s.fields.some(h=>h.name===f)||delete u[f];wt.setNodes(e.editor,{...i,_key:typeof c=="string"?c:i._key,value:{...a,...u}},{at:o});return}throw new Error(`Unable to determine the type of child at ${JSON.stringify(e.at)}`)},Q5n=({context:t,operation:e})=>{const n=e.at[0]._key,r=e.editor.blockIndexMap.get(n);if(r===void 0)throw new Error(`Unable to find block index for block key ${n}`);const i=r!==void 0?e.editor.value.at(r):void 0;if(!i)throw new Error(`Unable to find block at ${JSON.stringify(e.at)}`);if(!qn(t,i))throw new Error(`Block ${JSON.stringify(n)} is not a text block`);const o=e.at[2]._key;if(!o)throw new Error(`Unable to find child key at ${JSON.stringify(e.at)}`);const s=i.children.findIndex(u=>u._key===o);if(s===-1)throw new Error(`Unable to find child at ${JSON.stringify(e.at)}`);const a=De.node(e.editor,[r,s],{depth:2}),l=a?.[0],c=a?.[1];if(!l||!c)throw new Error(`Unable to find child at ${JSON.stringify(e.at)}`);if(e.editor.isTextSpan(l)){const u={};for(const f of e.props)if(f!=="text"&&f!=="_type"){if(f==="_key"){u._key=t.keyGenerator();continue}u[f]=null}wt.setNodes(e.editor,u,{at:c}),e.props.includes("text")&&e.editor.apply({type:"remove_text",path:c,offset:0,text:l.text});return}if(On.isElement(l)){const u="value"in l&&typeof l.value=="object"?l.value:{},f=e.props.map(p=>({type:"unset",path:[p]})),h=Qm(u,f);wt.setNodes(e.editor,{...l,_key:e.props.includes("_key")?t.keyGenerator():l._key,value:h},{at:c});return}throw new Error(`Unable to determine the type of child at ${JSON.stringify(e.at)}`)},J5n=({context:t,operation:e})=>{const n=e.editor,r=e.decorator;let i=e.at?p1({context:{schema:t.schema,value:e.editor.value,selection:e.at},blockIndexMap:e.editor.blockIndexMap}):e.editor.selection;if(i){if(It.isExpanded(i)){const o=De.rangeRef(n,i,{affinity:"inward"}),[s,a]=It.edges(i),l=De.isEnd(n,a,a.path);wt.splitNodes(n,{at:a,match:Dn.isText,mode:"lowest",voids:!1,always:!l});const c=De.isStart(n,s,s.path);if(wt.splitNodes(n,{at:s,match:Dn.isText,mode:"lowest",voids:!1,always:!c}),i=o.unref(),!i)throw new Error("Unable to add decorator without a selection");e.at||wt.select(n,i);const u=De.nodes(n,{at:i,match:Dn.isText});for(const[f,h]of u){const p=[...(Array.isArray(f.marks)?f.marks:[]).filter(m=>m!==r),r];wt.setNodes(n,{marks:p},{at:h,match:Dn.isText,split:!0,hanging:!0})}}else{if(!Array.from(De.nodes(n,{at:i,match:l=>n.isTextSpan(l)}))?.at(0))return;const[o,s]=De.node(n,i,{depth:1}),a=n.isTextBlock(o)&&o.children.length===1&&n.isTextSpan(o.children[0])&&o.children[0].text===""?o.children[0]:void 0;if(a){const l=a.marks??[],c=l.filter(u=>u!==r);wt.setNodes(n,{marks:l.length===c.length?[...l,r]:c},{at:s,match:u=>n.isTextSpan(u)})}else n.decoratorState[r]=!0}if(n.selection){const o=n.selection;n.selection={...o}}}},egn=({context:t,operation:e})=>{const n=e.editor,r=e.decorator,i=e.at?p1({context:{schema:t.schema,value:e.editor.value,selection:e.at},blockIndexMap:e.editor.blockIndexMap}):n.selection;if(i){if(It.isExpanded(i)){const o=De.rangeRef(n,i,{affinity:"inward"});wt.setNodes(n,{},{at:i,match:Dn.isText,split:!0,hanging:!0});const s=o.unref();s&&[...De.nodes(n,{at:s,match:Dn.isText})].forEach(([a,l])=>{const c=n.children[l[0]];On.isElement(c)&&c.children.includes(a)&&wt.setNodes(n,{marks:(Array.isArray(a.marks)?a.marks:[]).filter(u=>u!==r),_type:"span"},{at:l})})}else{const[o,s]=De.node(n,i,{depth:1}),a=n.isTextBlock(o)&&o.children.length===1&&n.isTextSpan(o.children[0])&&o.children[0].text===""?o.children[0]:void 0;if(a){const l=(a.marks??[]).filter(c=>c!==r);wt.setNodes(n,{marks:l},{at:s,match:c=>n.isTextSpan(c)})}else n.decoratorState[r]=!1}if(n.selection){const o=n.selection;n.selection={...o}}}},tgn=({context:t,operation:e})=>{const n=e.at?p1({context:{schema:t.schema,value:e.editor.value,selection:e.at},blockIndexMap:e.editor.blockIndexMap}):e.editor.selection;if(!n)throw new Error("Unable to delete without a selection");const[r,i]=It.edges(n);if(e.unit==="block"){const b=r.path.at(0),v=i.path.at(0);if(b===void 0||v===void 0)throw new Error("Failed to get start or end block index");wt.removeNodes(e.editor,{at:{anchor:{path:[b],offset:0},focus:{path:[v],offset:0}},mode:"highest"});return}if(e.unit==="child"){wt.removeNodes(e.editor,{at:n,match:b=>Ci(t,b)&&b._key!==w_||"__inline"in b&&b.__inline===!0});return}if(e.direction==="backward"&&e.unit==="line"){const b=De.above(e.editor,{match:v=>On.isElement(v)&&De.isBlock(e.editor,v),at:n});if(b){const[,v]=b,x=De.range(e.editor,v,n.anchor),C=ngn(e.editor,x);if(!It.isCollapsed(C)){wt.delete(e.editor,{at:C});return}}}if(e.unit==="word"&&It.isCollapsed(n)){OI(e.editor,{at:n,unit:"word",reverse:e.direction==="backward"});return}const o=De.above(e.editor,{match:b=>On.isElement(b)&&De.isBlock(e.editor,b),at:r,voids:!1}),s=De.above(e.editor,{match:b=>On.isElement(b)&&De.isBlock(e.editor,b),at:i,voids:!1}),a=o&&s&&!ut.equals(o[1],s[1]),l=De.void(e.editor,{at:r,mode:"highest"})??De.elementReadOnly(e.editor,{at:r,mode:"highest"}),c=De.void(e.editor,{at:i,mode:"highest"})??De.elementReadOnly(e.editor,{at:i,mode:"highest"}),u=[];let f;for(const b of De.nodes(e.editor,{at:n,voids:!1})){const[v,x]=b;f&&ut.compare(x,f)===0||(On.isElement(v)&&(De.isVoid(e.editor,v)||De.isElementReadOnly(e.editor,v))||!ut.isCommon(x,r.path)&&!ut.isCommon(x,i.path))&&(u.push(b),f=x)}const h=Array.from(u,([,b])=>De.pathRef(e.editor,b)),p=De.pointRef(e.editor,r),m=De.pointRef(e.editor,i);if(o&&s&&gi.equals(r,De.start(e.editor,o[1]))&&gi.equals(i,De.end(e.editor,s[1]))&&a&&!l&&!c){if(!l){const b=p.current,[v]=De.leaf(e.editor,b);v.text.length>0&&e.editor.apply({type:"remove_text",path:b.path,offset:0,text:v.text})}for(const b of h.reverse()){const v=b.unref();v&&wt.removeNodes(e.editor,{at:v,voids:!1})}if(!c){const b=m.current,[v]=De.leaf(e.editor,b),{path:x}=b,C=0,w=v.text.slice(C,i.offset);w.length>0&&e.editor.apply({type:"remove_text",path:x,offset:C,text:w})}m.current&&p.current&&wt.removeNodes(e.editor,{at:m.current,voids:!1}),p.current&&e.editor.apply({type:"set_selection",properties:e.editor.selection,newProperties:{anchor:p.current,focus:p.current}});return}const g=e.direction==="backward",y=g?i?qn(t,s)?i.offset===0:!0:!1:r?qn(t,o)?r.offset===0:!0:!1;e.at?OI(e.editor,{at:n,hanging:y,reverse:g}):OI(e.editor,{hanging:y,reverse:g})};function ngn(t,e){const n=De.range(t,It.end(e)),r=Array.from(De.positions(t,{at:e}));let i=0,o=r.length,s=Math.floor(o/2);if(Vke(t,De.range(t,r[i]),n))return De.range(t,r[i],n);if(r.length<2)return De.range(t,r[r.length-1],n);for(;s!==r.length&&s!==i;)Vke(t,De.range(t,r[s]),n)?o=s:i=s,s=Math.floor((i+o)/2);return De.range(t,r[i],n)}function Vke(t,e,n){const r=Zr.toDOMRange(t,e).getBoundingClientRect(),i=Zr.toDOMRange(t,n).getBoundingClientRect();return zke(r,i)&&zke(i,r)}function zke(t,e){const n=(e.top+e.bottom)/2;return t.top<=n&&t.bottom>=n}function Ntt(t,e,n,r,i){const o={...n};if(e.type==="insert"&&e.path.length===1){const s=e.path[0],a=(r||[]).findIndex(l=>Y1(s)&&l._key===s._key);return Yn.history(`Adjusting block path (+${e.items.length}) for '${o.type}' operation and patch '${e.type}'`),[Hke(o,e.items.length,a)]}if(e.type==="unset"&&e.path.length===1){const s=e.path[0],a=(i||[]).findIndex(l=>Y1(s)&&l._key===s._key);return"path"in o&&Array.isArray(o.path)&&o.path[0]===a?(Yn.history("Skipping transformation that targeted removed block"),[]):[Hke(o,-1,a)]}if(e.type==="unset"&&e.path.length===0)return Yn.history(`Adjusting selection for unset everything patch and ${n.type} operation`),[];if(e.type==="diffMatchPatch"){const s=rgn(t,o),a=e.path[0];return!s||!Y1(a)||s._key!==a._key?[o]:(Mtt(e.value).forEach(l=>{let c=0,u=l.utf8Start1;const{diffs:f}=l;if(f.forEach((h,p)=>{const[m,g]=h;m===xc?(c+=g.length,u+=g.length):m===Hl?(c-=g.length,u-=g.length):m===qo&&(f.slice(p).every(([y])=>y===qo)||(u+=g.length))}),o.type==="insert_text"&&u{y&&u=0&&r.type!=="set_selection"&&Array.isArray(r.path)&&r.path[0]>=n+e&&r.path[0]+e>-1){const i=[r.path[0]+e,...r.path.slice(1)];r.path=i}if(r.type==="set_selection"){const i=r.properties?.focus?{...r.properties.focus}:void 0,o=r?.properties?.anchor?{...r.properties.anchor}:void 0,s=r?.newProperties?.focus?{...r.newProperties.focus}:void 0,a=r?.newProperties?.anchor?{...r.newProperties.anchor}:void 0;(i&&o||s&&a)&&([i,o,s,a].forEach(l=>{l&&l.path[0]>=n+e&&l.path[0]+e>-1&&(l.path=[l.path[0]+e,...l.path.slice(1)])}),i&&o&&(r.properties={focus:i,anchor:o}),s&&a&&(r.newProperties={focus:s,anchor:a}))}return r}function rgn(t,e){let n;return e.type==="set_selection"&&t.selection?n=t.children[t.selection.focus.path[0]]:"path"in e&&(n=t.children[e.path[0]]),n}function ign(t,e){const n=t.isRedoing;t.isRedoing=!0,e(),t.isRedoing=n}const ogn=({operation:t})=>{const e=t.editor,{redos:n}=e.history;if(n.length>0){const r=n[n.length-1];if(r.operations.length>0){const i=e.remotePatches.filter(s=>s.time>=r.timestamp);let o=r.operations;i.forEach(s=>{o=o.flatMap(a=>Ntt(e,s.patch,a,s.snapshot,s.previousSnapshot))});try{De.withoutNormalizing(e,()=>{ign(e,()=>{MH(e,()=>{o.forEach(s=>{e.apply(s)})})})})}catch(s){console.error(`Could not perform 'history.redo' operation: ${s instanceof Error?s.message:s}`),e.remotePatches.splice(0,e.remotePatches.length),wt.deselect(e),e.history={undos:[],redos:[]},e.withHistory=!0,e.isRedoing=!1,e.onChange();return}e.history.undos.push(r),e.history.redos.pop()}}};function sgn(t,e){const n=t.isUndoing;t.isUndoing=!0,e(),t.isUndoing=n}const agn=({operation:t})=>{const e=t.editor,{undos:n}=e.history;if(n.length>0){const r=n[n.length-1];if(r.operations.length>0){const i=e.remotePatches.filter(a=>a.time>=r.timestamp);let o=r.operations;i.forEach(a=>{o=o.flatMap(l=>Ntt(e,a.patch,l,a.snapshot,a.previousSnapshot))});const s=o.map(WC.inverse).reverse();try{De.withoutNormalizing(e,()=>{sgn(e,()=>{MH(e,()=>{s.forEach(a=>{e.apply(a)})})})})}catch(a){console.error(`Could not perform 'history.undo' operation: ${a instanceof Error?a.message:a}`),e.remotePatches.splice(0,e.remotePatches.length),wt.deselect(e),e.history={undos:[],redos:[]},e.withHistory=!0,e.isUndoing=!1,e.onChange();return}e.history.redos.push(r),e.history.undos.pop()}}},lgn=({context:t,operation:e})=>{const n=b0({block:e.block,context:t,options:{normalize:!0,removeUnusedMarkDefs:!0,validateFields:!0}});if(!n)throw new Error(`Failed to parse block ${JSON.stringify(e.block)}`);const r=s9(n,{schemaTypes:t.schema});cgn({context:t,block:r,placement:e.placement,select:e.select??"start",at:e.at,editor:e.editor})};function cgn(t){const{context:e,block:n,placement:r,select:i,editor:o}=t,s=t.at?p1({context:{schema:e.schema,value:o.value,selection:t.at},blockIndexMap:o.blockIndexMap}):o.selection;if(o.children.length===0){XE(o,[0],n,i);return}const a=s?It.start(s):De.start(o,[]),l=s?It.end(s):De.end(o,[]),[c,u]=Array.from(De.nodes(o,{at:a,mode:"lowest",match:(p,m)=>On.isElement(p)&&m.length<=a.path.length})).at(0)??[void 0,void 0];let[f,h]=Array.from(De.nodes(o,{at:l,mode:"lowest",match:(p,m)=>On.isElement(p)&&m.length<=l.path.length})).at(0)??[void 0,void 0];if(!c||!u||!f||!h)throw new Error("Unable to insert block without a start and end block");if(r==="before"){XE(o,u,n,i);return}if(r==="after"){XE(o,ut.next(h),n,i);return}if(!s){if(c1(e,f)){Wke(o,h,n,i);return}if(o.isTextBlock(n)&&o.isTextBlock(f)){const p=De.end(o,h);Kx(o,n,p),i==="start"?KE(o,p):i==="none"&&Btt(o);return}XE(o,ut.next(h),n,i);return}if(It.isExpanded(s)&&!o.isTextBlock(n)){const p=De.rangeRef(o,s,{affinity:"inward"}),m=It.start(s),g=hn.get(o,[m.path[0]]),y=De.start(o,[m.path[0]]),b=On.isElement(g)&&gi.equals(m,y);qke(o,s);const v=p.unref()??o.selection,x=v?De.rangeRef(o,v,{affinity:"inward"}):void 0;if(v){const w=b?[v.anchor.path[0]]:[v.anchor.path[0]+1];if(o.apply({type:"insert_node",path:w,node:n}),i!=="none"){const _=De.start(o,w);o.apply({type:"set_selection",properties:o.selection,newProperties:{anchor:_,focus:_}})}}const C=x?.unref()??o.selection;if(i==="none"&&C&&o.apply({type:"set_selection",properties:o.selection,newProperties:C}),!o.isTextBlock(n)&&v){const w=b?[v.anchor.path[0]+1]:[v.anchor.path[0]];try{const _=hn.get(o,w);On.isElement(_)&&c1(e,_)&&o.apply({type:"remove_node",path:w,node:_})}catch{}}return}if(!o.isTextBlock(n)&&o.isTextBlock(f)&&!It.isExpanded(s)){const p=It.start(s),m=[p.path[0]],g=De.start(o,m),y=De.end(o,m),b=gi.equals(p,g),v=gi.equals(p,y);if(!b&&!v){const x=hn.get(o,m),C=p.path[1],w=p.offset;if(w>0){const j=hn.get(o,p.path);if(w0?C+1:C,{children:S,...k}=x;o.apply({type:"split_node",path:m,position:_,properties:k});const I=[m[0]+1];if(o.apply({type:"insert_node",path:I,node:n}),i==="none"){const j=De.end(o,m);o.apply({type:"set_selection",properties:o.selection,newProperties:{anchor:j,focus:j}})}else if(i==="start"){const j=De.start(o,I);o.apply({type:"set_selection",properties:o.selection,newProperties:{anchor:j,focus:j}})}else if(i==="end"){const j=De.end(o,I);o.apply({type:"set_selection",properties:o.selection,newProperties:{anchor:j,focus:j}})}return}}if(o.isTextBlock(f)&&o.isTextBlock(n)){let p=It.start(s),m=!1;if(It.isExpanded(s)){const[_,S]=It.edges(s),k=_.path[0]!==S.path[0];if(qke(o,s),k){m=!0;const A=[_.path[0]],D=hn.get(o,A);if(o.isTextBlock(D)){const O={path:[...A,_.path[1]],offset:_.offset};KE(o,O),p=O}}const[I,j]=Array.from(De.nodes(o,{at:De.end(o,[]),mode:"lowest",match:(A,D)=>On.isElement(A)&&D.length===1})).at(-1)??[void 0,void 0];I&&j&&On.isElement(I)&&(f=I,h=j)}if(!o.isTextBlock(f))return;if(c1(e,f)){Wke(o,h,n,i);return}const g=f.children.map(_=>_._key),y=f.markDefs?.map(_=>_._key)??[],b=new Map,v=n.markDefs?.map(_=>{if(y.includes(_._key)){const S=e.keyGenerator();return b.set(_._key,S),{..._,_key:S}}return _}),x=n.children.map(_=>{if(Ci(e,_)){const S=_.marks?.map(k=>b.get(k)||k)??[];if(!p2e(_.marks,S))return{..._,_key:g.includes(_._key)?e.keyGenerator():_._key,marks:S}}return g.includes(_._key)?{..._,_key:e.keyGenerator()}:_}),C=hn.get(o,h);if(On.isElement(C)&&o.isTextBlock(C)){const _={markDefs:C.markDefs},S={markDefs:[...f.markDefs??[],...v??[]]};o.apply({type:"set_node",path:h,properties:_,newProperties:S})}const w=ott(n.children,x)?n:{...n,children:x};if(i==="end"){const _=o.selection?It.end(o.selection):De.end(o,h);Kx(o,w,_);return}if(Kx(o,w,p),i==="start")KE(o,p);else if(i==="none")if(m)KE(o,p);else{const _=De.start(o,h);gi.equals(p,_)||KE(o,p)}}else{if(!o.isTextBlock(f)){XE(o,[h[0]+1],n,i);return}const p=De.start(o,h),m=De.end(o,h),g=It.start(s),y=It.end(s);if(It.isCollapsed(s)&&gi.equals(g,p)){o.apply({type:"insert_node",path:h,node:n}),i!=="none"&&j4(o,h,"start"),c1(e,f)&&c7(o,ut.next(h));return}if(It.isCollapsed(s)&&gi.equals(y,m)){const v=[h[0]+1];o.apply({type:"insert_node",path:v,node:n}),i!=="none"&&j4(o,v,"start");return}if(It.isExpanded(s)&&gi.equals(g,p)&&gi.equals(y,m)){o.apply({type:"insert_node",path:h,node:n}),c7(o,ut.next(h)),i!=="none"&&j4(o,h,i);return}if(It.isExpanded(s)&&gi.equals(g,p)){const[,v]=It.edges(s),x=hn.get(o,v.path);v.offset>0&&o.apply({type:"remove_text",path:v.path,offset:0,text:x.text.slice(0,v.offset)});for(let C=v.path[1]-1;C>=0;C--)c7(o,[...h,C]);Kx(o,n,De.start(o,h)),i!=="none"&&j4(o,h,i);return}if(It.isExpanded(s)&&gi.equals(y,m)){const[v]=It.edges(s),x=hn.get(o,h);for(let w=x.children.length-1;w>v.path[1];w--)c7(o,[...h,w]);const C=hn.get(o,v.path);v.offset0&&C0?x[1]+1:x[1],j=hn.get(o,_);if(Ie.path[1];c--)c7(t,[...r,c]);const o=[...r,e.path[1]+1],s=hn.get(t,o);if(n.offset>0){const c=s.text.slice(0,n.offset);t.apply({type:"remove_text",path:o,offset:0,text:c})}const a=hn.get(t,e.path),l=hn.get(t,o);if(Dn.isText(a)&&Dn.isText(l)){const{text:c,...u}=l;t.apply({type:"merge_node",path:o,position:a.text.length,properties:u})}}function dgn(t,e,n){const r=[e.path[0]];if(e.path.length>1){const a=hn.get(t,e.path);if(e.offsete.path[1];c--)c7(t,[...r,c])}for(let a=n.path[0]-1;a>e.path[0];a--)c7(t,[a]);const i=[e.path[0]+1];if(n.path.length>1){for(let c=0;c0){const c=l.text.slice(0,n.offset);t.apply({type:"remove_text",path:a,offset:0,text:c})}}const o=hn.get(t,r),s=hn.get(t,i);if(t.isTextBlock(o)&&t.isTextBlock(s)){const{children:a,...l}=s;t.apply({type:"merge_node",path:i,position:o.children.length,properties:l})}}function qke(t,e){const[n,r]=It.edges(e);n.path[0]===r.path[0]?ugn(t,n,r):dgn(t,n,r)}function Kx(t,e,n){if(!On.isElement(e)||!t.isTextBlock(e))return;if(n.offset>0){const o=hn.get(t,n.path);if(Dn.isText(o)){const{text:s,...a}=o;t.apply({type:"split_node",path:n.path,position:n.offset,properties:a})}}const r=ut.parent(n.path);let i=n.path[n.path.length-1]+(n.offset>0?1:0);for(const o of e.children){const s=[...r,i];t.apply({type:"insert_node",path:s,node:o}),i++}}const fgn=({context:t,operation:e})=>{const n=e.editor.selection?.focus,r=n?.path.at(0),i=n?.path.at(1);if(r===void 0||i===void 0)throw new Error("Unable to insert child without a focus");const[o,s]=g2e({editor:e.editor});if(!n||!o||!s)throw new Error("Unable to insert child without a focus block");if(!qn(t,o))throw new Error("Unable to insert child into a non-text block");const a=o.markDefs??[],l=new Map;for(const f of a)l.set(f._key,f._key);const c=BQe({span:e.child,context:t,markDefKeyMap:l,options:{validateFields:!0}});if(c){const[f]=ike({editor:e.editor});f?wt.insertNodes(e.editor,c,{at:n,select:!0}):wt.insertNodes(e.editor,c,{at:[r,i+1],select:!0}),Km.set(e.editor,e.editor.selection);return}const u=VQe({inlineObject:e.child,context:t,options:{validateFields:!0}});if(u){const{_key:f,_type:h,...p}=u,[m]=ike({editor:e.editor});m?wt.insertNodes(e.editor,{_key:f,_type:h,children:[{_key:w_,_type:"span",text:"",marks:[]}],value:p,__inline:!0},{at:n,select:!0}):wt.insertNodes(e.editor,{_key:f,_type:h,children:[{_key:w_,_type:"span",text:"",marks:[]}],value:p,__inline:!0},{at:[r,i+1],select:!0});return}throw new Error("Unable to parse child")},hgn=({operation:t})=>{wt.insertText(t.editor,t.text)},pgn=({operation:t})=>{wt.move(t.editor,{unit:"character",distance:t.distance,reverse:!0})},mgn=({operation:t})=>{const e=Wa({path:t.at});if(!e)throw new Error("Failed to get block key from selection point");const n=t.editor.blockIndexMap.get(e);if(n===void 0)throw new Error("Failed to get block index from block key");const r=Wa({path:t.to});if(!r)throw new Error("Failed to get block key from selection point");const i=t.editor.blockIndexMap.get(r);if(i===void 0)throw new Error("Failed to get block index from block key");wt.moveNodes(t.editor,{at:[n],to:[i],mode:"highest"})},ggn=({operation:t})=>{wt.move(t.editor,{unit:"character",distance:t.distance})},ygn=({context:t,operation:e})=>{const n=p1({context:{schema:t.schema,value:e.editor.value,selection:e.at},blockIndexMap:e.editor.blockIndexMap});n?wt.select(e.editor,n):wt.deselect(e.editor),Q5.get(e.editor)&&ON.get(e.editor)&&Q5.set(e.editor,!1)},Od={"annotation.add":G5n,"annotation.remove":Y5n,"block.set":K5n,"block.unset":X5n,"child.set":Z5n,"child.unset":Q5n,"decorator.add":J5n,"decorator.remove":egn,delete:tgn,"history.redo":ogn,"history.undo":agn,"insert.block":lgn,"insert.child":fgn,"insert.text":hgn,"move.backward":pgn,"move.block":mgn,"move.forward":ggn,select:ygn};function Gke({context:t,operation:e}){const n=()=>{try{switch(e.type){case"annotation.add":{Od["annotation.add"]({context:t,operation:e});break}case"annotation.remove":{Od["annotation.remove"]({context:t,operation:e});break}case"block.set":{Od["block.set"]({context:t,operation:e});break}case"block.unset":{Od["block.unset"]({context:t,operation:e});break}case"child.set":{Od["child.set"]({context:t,operation:e});break}case"child.unset":{Od["child.unset"]({context:t,operation:e});break}case"decorator.add":{Od["decorator.add"]({context:t,operation:e});break}case"decorator.remove":{Od["decorator.remove"]({context:t,operation:e});break}case"delete":{Od.delete({context:t,operation:e});break}case"history.redo":{Od["history.redo"]({context:t,operation:e});break}case"history.undo":{Od["history.undo"]({context:t,operation:e});break}case"insert.block":{Od["insert.block"]({context:t,operation:e});break}case"insert.child":{Od["insert.child"]({context:t,operation:e});break}case"insert.text":{Od["insert.text"]({context:t,operation:e});break}case"move.backward":{Od["move.backward"]({context:t,operation:e});break}case"move.block":{Od["move.block"]({context:t,operation:e});break}case"move.forward":{Od["move.forward"]({context:t,operation:e});break}default:{Od.select({context:t,operation:e});break}}}catch(r){console.error(new Error(`Performing "${e.type}" failed due to: ${r instanceof Error?r.message:r}`))}};De.isNormalizing(e.editor)?De.withoutNormalizing(e.editor,n):n()}function Yke(t,e){const n=t.isPerformingBehaviorOperation;t.isPerformingBehaviorOperation=!0,e(),t.isPerformingBehaviorOperation=n}function bgn(t,e,n){e()?De.withoutNormalizing(t,n):n()}const vgn=[{on:"annotation.set",guard:({snapshot:t,event:e})=>{const n=e.at[0]._key,r=e.at[2]._key,i=$s({...t,context:{...t.context,selection:{anchor:{path:[{_key:n}],offset:0},focus:{path:[{_key:n}],offset:0}}}});if(!i)return!1;const o=i.node.markDefs?.map(s=>s._key===r?{...s,...e.props}:s);return{blockKey:n,updatedMarkDefs:o}},actions:[(t,{blockKey:e,updatedMarkDefs:n})=>[Et({type:"block.set",at:[{_key:e}],props:{markDefs:n}})]]},{on:"annotation.toggle",guard:({snapshot:t,event:e})=>{const n=e.at??t.context.selection;if(!n)return!1;const r={...t,context:{...t.context,selection:n}};return wN(e.annotation.name)(r)},actions:[({event:t})=>[Et({type:"annotation.remove",annotation:t.annotation,at:t.at})]]},{on:"annotation.toggle",guard:({snapshot:t,event:e})=>{const n=e.at??t.context.selection;if(!n)return!1;const r={...t,context:{...t.context,selection:n}};return!wN(e.annotation.name)(r)},actions:[({event:t})=>[Et({type:"annotation.add",annotation:t.annotation,at:t.at})]]}],xgn=[{on:"decorator.toggle",guard:({snapshot:t,event:e})=>{const n=e.at??t.context.selection;if(!n)return!1;const r={...t,context:{...t.context,selection:n}};return Moe(e.decorator)(r)},actions:[({event:t})=>[Et({type:"decorator.remove",decorator:t.decorator,at:t.at})]]},{on:"decorator.toggle",guard:({snapshot:t,event:e})=>{const n=e.at??t.context.selection;if(!n)return!1;const r={...t,context:{...t.context,selection:n}};return!Moe(e.decorator)(r)},actions:[({event:t})=>[Et({...t,type:"decorator.add"})]]}],Cgn=[{on:"delete.backward",guard:({snapshot:t})=>t.context.selection,actions:[({event:t})=>[Et({type:"delete",direction:"backward",unit:t.unit})]]},{on:"delete",guard:({snapshot:t,event:e})=>{if(e.direction!=="backward")return!1;const n=e.at??t.context.selection;if(!n)return!1;const r={...t,context:{...t.context,selection:n}},i=o6(r),o=$s(r);if(!i||!o||!GQe(o)(r))return!1;const s=yd({context:t.context,block:i});return qn(t.context,i.node)?{previousBlockEndPoint:s,focusTextBlock:o}:!1},actions:[(t,{previousBlockEndPoint:e,focusTextBlock:n})=>[Et({type:"delete.block",at:n.path}),Et({type:"select",at:{anchor:e,focus:e}}),Et({type:"insert.block",block:n.node,placement:"auto",select:"start"})]]},{on:"delete.forward",guard:({snapshot:t})=>t.context.selection,actions:[({event:t})=>[Et({type:"delete",direction:"forward",unit:t.unit})]]},{on:"delete",guard:({snapshot:t,event:e})=>{if(e.direction!=="forward")return!1;const n=e.at??t.context.selection;if(!n)return!1;const r=C8({...t,context:{...t.context,selection:n}}),i=$s({...t,context:{...t.context,selection:n}});if(!r||!i||!c1(t.context,i.node))return!1;const o=Nh({context:t.context,block:r});return{focusTextBlock:i,nextBlockStartPoint:o}},actions:[(t,{focusTextBlock:e,nextBlockStartPoint:n})=>[Et({type:"delete.block",at:e.path}),Et({type:"select",at:{anchor:n,focus:n}})]]},{on:"delete",guard:({snapshot:t,event:e})=>{if(e.direction!=="forward")return!1;const n=e.at??t.context.selection;if(!n)return!1;const r={...t,context:{...t.context,selection:n}},i=C8(r),o=$s(r);return!i||!o||!qQe(o)(r)||!qn(t.context,i.node)?!1:{nextBlock:i}},actions:[(t,{nextBlock:e})=>[Et({type:"delete.block",at:e.path}),Et({type:"insert.block",block:e.node,placement:"auto",select:"none"})]]},{on:"delete.block",actions:[({event:t})=>[Et({type:"delete",at:{anchor:{path:t.at,offset:0},focus:{path:t.at,offset:0}},unit:"block"})]]},{on:"delete.child",guard:({snapshot:t,event:e})=>{const n=$S({...t,context:{...t.context,selection:{anchor:{path:e.at,offset:0},focus:{path:e.at,offset:0}}}});return n?Ci(t.context,n.node)?{selection:{anchor:{path:e.at,offset:0},focus:{path:e.at,offset:n.node.text.length}}}:{selection:{anchor:{path:e.at,offset:0},focus:{path:e.at,offset:0}}}:!1},actions:[(t,{selection:e})=>[Et({type:"delete",at:e})]]},{on:"delete.text",actions:[({event:t})=>[Et({...t,type:"delete"})]]}],QJ=["application/x-portable-text","application/json","text/markdown","text/html","text/plain"];function Kke({dataTransfer:t,startAfter:e}){const n=e?QJ.indexOf(e)+1:0;for(let r=n;r{const e=Kke({dataTransfer:t.originEvent.originEvent.dataTransfer});return e?{type:"deserialize.data",mimeType:e.mimeType,data:e.data,originEvent:t.originEvent}:!1},actions:[(t,e)=>[Et(e)]]},{on:"deserialize",actions:[({event:t})=>[Et({type:"deserialization.failure",mimeType:"*/*",reason:"No Behavior was able to handle the incoming data",originEvent:t.originEvent})]]},{on:"deserialize.data",guard:({event:t})=>{if(t.mimeType!=="text/html")return!1;const e=t.originEvent.originEvent.dataTransfer.getData("text/plain");return t.data!==e?!1:{type:"deserialize.data",mimeType:"text/plain",data:e,originEvent:t.originEvent}},actions:[(t,e)=>[Et(e)]]},{on:"deserialize.data",guard:({snapshot:t,event:e})=>{const n=t.context.converters.find(r=>r.mimeType===e.mimeType);return n?n.deserialize({snapshot:t,event:{type:"deserialize",data:e.data}}):!1},actions:[({event:t},e)=>[Et({...e,originEvent:t.originEvent})]]},{on:"deserialization.success",guard:({snapshot:t,event:e})=>{if($s(t)&&e.mimeType==="text/plain"&&e.originEvent.type!=="drag.drop"){const n=g_(t);return{activeAnnotations:Gnn(t),activeDecorators:n,textRuns:e.data.flatMap(r=>qn(t.context,r)?[zQe(r)]:[])}}return!1},actions:[(t,{activeAnnotations:e,activeDecorators:n,textRuns:r})=>r.flatMap((i,o)=>o!==r.length-1?[Et({type:"insert.span",text:i,decorators:n,annotations:e.map(({_key:s,_type:a,...l})=>({name:a,value:l}))}),Et({type:"insert.break"})]:[Et({type:"insert.span",text:i,decorators:n,annotations:e.map(({_key:s,_type:a,...l})=>({name:a,value:l}))})])]},{on:"deserialization.success",actions:[({event:t})=>[Et({type:"insert.blocks",blocks:t.data,placement:"auto"})]]},{on:"deserialization.failure",guard:({event:t})=>{if(t.mimeType==="*/*")return!1;const e=Kke({dataTransfer:t.originEvent.originEvent.dataTransfer,startAfter:t.mimeType});return e?{type:"deserialize.data",mimeType:e.mimeType,data:e.data,originEvent:t.originEvent}:!1},actions:[(t,e)=>[Et(e)]]},{on:"deserialization.failure",actions:[({event:t})=>[{type:"effect",effect:()=>{console.warn(`Deserialization of ${t.mimeType} failed with reason "${t.reason}"`)}}]]}],_gn=[{on:"input.*",guard:({snapshot:t})=>cm(t),actions:[({event:t})=>[Et({type:"delete"}),v0(t)]]},{on:"input.*",guard:({event:t})=>{const e=t.originEvent.dataTransfer.getData("text/plain"),n=t.originEvent.dataTransfer.getData("text/html"),r=t.originEvent.dataTransfer.types;return!e||e.includes(` +`)?!1:r.length===1?{text:e}:r.length>2?!1:n&&e===n?{text:e}:!1},actions:[(t,{text:e})=>[Et({type:"insert.text",text:e})]]},{on:"input.*",actions:[({event:t})=>[Et({type:"deserialize",originEvent:t})]]}];function n$(t){return e=>!t||e.blockIndexMap.has(t)?e.context.keyGenerator():t}const Sgn=[{on:"insert.blocks",guard:({event:t})=>{const e=t.blocks.length===1?t.blocks.at(0):void 0;return e?{onlyBlock:e}:!1},actions:[({event:t},{onlyBlock:e})=>[Et({type:"insert.block",block:e,placement:t.placement,select:t.select??"end",...t.at?{at:t.at}:{}})]]},{on:"insert.blocks",guard:({event:t})=>t.placement==="before"||t.placement==="after",actions:[({snapshot:t,event:e})=>{let n,r,i;const o=[];let s=-1;for(const l of e.blocks){s++;const c=n$(l._key)(t);s===0&&(n=c),s===e.blocks.length-1&&(r=c),o.push(Et({type:"insert.block",block:c!==l._key?{...l,_key:c}:l,placement:e.placement==="after"?"after":s===0?"before":"after",select:"none",...i?{at:{anchor:{path:[{_key:i}],offset:0},focus:{path:[{_key:i}],offset:0}}}:e.at?{at:e.at}:{}})),i=c}const a=e.select??"end";return a==="start"&&n&&o.push(Et({type:"select.block",at:[{_key:n}],select:"start"})),a==="end"&&r&&o.push(Et({type:"select.block",at:[{_key:r}],select:"end"})),o}]},{on:"insert.blocks",guard:({snapshot:t,event:e})=>{if(e.placement!=="auto")return!1;const n=e.at??t.context.selection;if(!n)return!1;const r={...t,context:{...t.context,selection:n}},i=$s(r);if(!i||c1(t.context,i.node))return!1;const o=Nh({context:t.context,block:i}),s=yd({context:t.context,block:i}),a=Dfe({context:{schema:t.context.schema,selection:{anchor:n.focus,focus:s}},block:i.node}),l=qn(t.context,e.blocks.at(0));return{focusTextBlock:i,focusBlockStartPoint:o,focusBlockEndPoint:s,focusTextBlockAfter:a,at:n,originalSelection:t.context.selection,isFirstBlockTextBlock:l}},actions:[({snapshot:t,event:e},{focusTextBlock:n,focusBlockEndPoint:r,focusTextBlockAfter:i,at:o,focusBlockStartPoint:s,isFirstBlockTextBlock:a,originalSelection:l})=>{let c,u;const f=[];let h=-1;for(const p of e.blocks){if(h++,h===0){pd(o.focus,r)||f.push(Et({type:"delete",at:{anchor:o.focus,focus:r}}));const g=n$(p._key)(t),y=pd(o.focus,s);qn(t.context,p)&&!y?(u=n.node._key,c=n.node._key):(u=g,c=g),f.push(Et({type:"insert.block",block:g!==p._key?{...p,_key:g}:p,placement:"auto",select:"end",...e.at?{at:e.at}:{}}));continue}if(h===e.blocks.length-1){f.push(Et({type:"insert.block",block:p,placement:"after",select:"end",at:c?{anchor:{path:[{_key:c}],offset:0},focus:{path:[{_key:c}],offset:0}}:void 0}));continue}const m=n$(p._key)(t);f.push(Et({type:"insert.block",block:m!==p._key?{...p,_key:m}:p,placement:"after",select:c?"none":"end",at:c?{anchor:{path:[{_key:c}],offset:0},focus:{path:[{_key:c}],offset:0}}:void 0})),c=m}return c1(t.context,i)||f.push(Et({type:"insert.block",block:i,placement:"auto",select:e.select==="end"?"none":"end"})),e.select==="none"&&f.push(Et({type:"select",at:l})),e.select==="start"&&((pd(o.focus,s)||!a)&&u?f.push(Et({type:"select.block",at:[{_key:u}],select:"start"})):f.push(Et({type:"select",at:{anchor:o.focus,focus:o.focus}}))),f}]},{on:"insert.blocks",guard:({snapshot:t,event:e})=>e.placement!=="auto"?!1:{originalSelection:t.context.selection},actions:[({snapshot:t,event:e},{originalSelection:n})=>{let r,i,o;const s=[];let a=-1;for(const c of e.blocks){a++;const u=n$(c._key)(t);a===0&&(r=u),a===e.blocks.length-1&&(i=u),s.push(Et({type:"insert.block",block:u!==c._key?{...c,_key:u}:c,placement:a===0?"auto":"after",select:"none",...o?{at:{anchor:{path:[{_key:o}],offset:0},focus:{path:[{_key:o}],offset:0}}}:e.at?{at:e.at}:{}})),o=u}const l=e.select??"end";return l==="none"?s.push(Et({type:"select",at:n})):l==="start"&&r?s.push(Et({type:"select.block",at:[{_key:r}],select:"start"})):i&&s.push(Et({type:"select.block",at:[{_key:i}],select:"end"})),s}]},{on:"insert.break",actions:[()=>[Et({type:"split"})]]},{on:"insert.child",guard:({snapshot:t})=>{const e=ECe(t);return!e||t.context.selection?!1:{lastBlockEndPoint:yd({context:t.context,block:e})}},actions:[({event:t},{lastBlockEndPoint:e})=>[Et({type:"select",at:{anchor:e,focus:e}}),Et(t)]]},{on:"insert.child",guard:({snapshot:t})=>{const e=$s(t);return t.context.selection&&!e},actions:[({snapshot:t,event:e})=>[Et({type:"insert.block",block:{_type:t.context.schema.block.name,children:[{_type:t.context.schema.span.name,text:"",marks:[]}]},placement:"auto",select:"end"}),Et(e)]]},{on:"insert.inline object",actions:[({event:t})=>[Et({type:"insert.child",child:{_type:t.inlineObject.name,...t.inlineObject.value}})]]},{on:"insert.soft break",actions:[()=>[Et({type:"insert.text",text:` +`})]]},{on:"insert.span",guard:({snapshot:t})=>!$s(t),actions:[({snapshot:t,event:e})=>[Et({type:"insert.block",block:{_type:t.context.schema.block.name,children:[{_type:t.context.schema.span.name,text:"",marks:[]}]},placement:"auto",select:"end"}),Et(e)]]},{on:"insert.span",guard:({snapshot:t,event:e})=>{const n=$s(t);return{markDefs:e.annotations?.map(r=>({_type:r.name,_key:t.context.keyGenerator(),...r.value}))??[],focusTextBlock:n}},actions:[({snapshot:t,event:e},{markDefs:n,focusTextBlock:r})=>[...r?[Et({type:"block.set",at:r.path,props:{markDefs:[...r.node.markDefs??[],...n]}})]:[],Et({type:"insert.child",child:{_type:t.context.schema.span.name,text:e.text,marks:[...e.decorators??[],...n.map(i=>i._key)]}})]]},{on:"insert.text",guard:({snapshot:t})=>cm(t),actions:[({event:t})=>[Et({type:"delete"}),Et(t)]]},{on:"insert.text",guard:({snapshot:t})=>{if(t.context.selection)return!1;const e=ECe(t);return e?{endPoint:yd({context:t.context,block:e})}:!1},actions:[({event:t},{endPoint:e})=>[Et({type:"select",at:{anchor:e,focus:e}}),Et(t)]]}],kgn=sl({default:[{key:"ArrowLeft",shift:!0,meta:!1,ctrl:!1,alt:!1}]}),Egn=[{on:"keyboard.keydown",guard:({snapshot:t,event:e})=>s1.backspace.guard(e.originEvent)&&hl(t)&&xw(t),actions:[()=>[Et({type:"delete.backward",unit:"character"})]]},{on:"keyboard.keydown",guard:({snapshot:t,event:e})=>s1.delete.guard(e.originEvent)&&hl(t)&&xw(t),actions:[()=>[Et({type:"delete.forward",unit:"character"})]]},{on:"keyboard.keydown",guard:({event:t})=>s1.deleteWord.backward.guard(t.originEvent),actions:[()=>[Et({type:"delete.backward",unit:"word"})]]},{on:"keyboard.keydown",guard:({event:t})=>s1.deleteWord.forward.guard(t.originEvent),actions:[()=>[Et({type:"delete.forward",unit:"word"})]]},{on:"keyboard.keydown",guard:({snapshot:t,event:e})=>s1.break.guard(e.originEvent)&&hl(t)&&xw(t),actions:[()=>[Et({type:"insert.break"})]]},{on:"keyboard.keydown",guard:({snapshot:t,event:e})=>s1.break.guard(e.originEvent)&&cm(t),actions:[()=>[Et({type:"insert.break"})]]},{on:"keyboard.keydown",guard:({event:t})=>s1.lineBreak.guard(t.originEvent),actions:[()=>[Et({type:"insert.soft break"})]]},{on:"keyboard.keydown",guard:({event:t})=>s1.history.undo.guard(t.originEvent),actions:[()=>[Et({type:"history.undo"})]]},{on:"keyboard.keydown",guard:({event:t})=>s1.history.redo.guard(t.originEvent),actions:[()=>[Et({type:"history.redo"})]]},{on:"keyboard.keydown",guard:({snapshot:t,event:e})=>{if(!t.context.selection||!kgn.guard(e.originEvent))return!1;const n=B0(t);if(!n)return!1;const r=o6({...t,context:{...t.context,selection:{anchor:{path:n.path,offset:0},focus:{path:n.path,offset:0}}}});return r&&qn(t.context,n.node)&&t.context.selection.focus.offset===0&&c1(t.context,n.node)?{previousBlock:r,selection:t.context.selection}:!1},actions:[({snapshot:t},{previousBlock:e,selection:n})=>[Et({type:"select",at:{anchor:n.anchor,focus:yd({context:t.context,block:e})}})]]}],Tgn=[{on:"list item.add",guard:({snapshot:t,event:e})=>t.context.schema.lists.some(n=>n.name===e.listItem)?{selectedTextBlocks:CN(t)}:!1,actions:[({event:t},{selectedTextBlocks:e})=>e.map(n=>Et({type:"block.set",at:n.path,props:{level:n.node.level??1,listItem:t.listItem}}))]},{on:"list item.remove",guard:({snapshot:t})=>({selectedTextBlocks:CN(t)}),actions:[(t,{selectedTextBlocks:e})=>e.map(n=>Et({type:"block.unset",at:n.path,props:["level","listItem"]}))]},{on:"list item.toggle",guard:({snapshot:t,event:e})=>TCe(e.listItem)(t),actions:[({event:t})=>[Et({type:"list item.remove",listItem:t.listItem})]]},{on:"list item.toggle",guard:({snapshot:t,event:e})=>!TCe(e.listItem)(t),actions:[({event:t})=>[Et({type:"list item.add",listItem:t.listItem})]]}],Ign=[{on:"move.block up",guard:({snapshot:t,event:e})=>{const n=o6({...t,context:{...t.context,selection:{anchor:{path:e.at,offset:0},focus:{path:e.at,offset:0}}}});return n?{previousBlock:n}:!1},actions:[({event:t},{previousBlock:e})=>[Et({type:"move.block",at:t.at,to:e.path})]]},{on:"move.block down",guard:({snapshot:t,event:e})=>{const n=C8({...t,context:{...t.context,selection:{anchor:{path:e.at,offset:0},focus:{path:e.at,offset:0}}}});return n?{nextBlock:n}:!1},actions:[({event:t},{nextBlock:e})=>[Et({type:"move.block",at:t.at,to:e.path})]]}],jgn=[{on:"select.block",guard:({snapshot:t,event:e})=>{if(e.select!=="end")return!1;const n=B0({...t,context:{...t.context,selection:{anchor:{path:e.at,offset:0},focus:{path:e.at,offset:0}}}});return n?{blockEndPoint:yd({context:t.context,block:n})}:!1},actions:[(t,{blockEndPoint:e})=>[Et({type:"select",at:{anchor:e,focus:e}})]]},{on:"select.block",actions:[({event:t})=>[Et({type:"select",at:{anchor:{path:t.at,offset:0},focus:{path:t.at,offset:0}}})]]},{on:"select.previous block",guard:({snapshot:t})=>{const e=o6(t);return e?{previousBlock:e}:!1},actions:[({event:t},{previousBlock:e})=>[Et({type:"select.block",at:e.path,select:t.select})]]},{on:"select.next block",guard:({snapshot:t})=>{const e=C8(t);return e?{nextBlock:e}:!1},actions:[({event:t},{nextBlock:e})=>[Et({type:"select.block",at:e.path,select:t.select})]]}],Agn=[{on:"serialize",actions:[({event:t})=>[Et({type:"serialize.data",mimeType:"application/x-portable-text",originEvent:t.originEvent}),Et({type:"serialize.data",mimeType:"application/json",originEvent:t.originEvent}),Et({type:"serialize.data",mimeType:"text/markdown",originEvent:t.originEvent}),Et({type:"serialize.data",mimeType:"text/html",originEvent:t.originEvent}),Et({type:"serialize.data",mimeType:"text/plain",originEvent:t.originEvent})]]},{on:"serialize.data",guard:({snapshot:t,event:e})=>{const n=t.context.converters.find(r=>r.mimeType===e.mimeType);return n?n.serialize({snapshot:t,event:{type:"serialize",originEvent:e.originEvent.type}}):!1},actions:[({event:t},e)=>[Et({...e,originEvent:t.originEvent})]]},{on:"serialization.success",actions:[({event:t})=>[{type:"effect",effect:()=>{t.originEvent.originEvent.dataTransfer.setData(t.mimeType,t.data)}}]]},{on:"serialization.failure",actions:[({event:t})=>[{type:"effect",effect:()=>{console.warn(`Serialization of ${t.mimeType} failed with reason "${t.reason}"`)}}]]}],Rgn=[{on:"split",guard:({snapshot:t})=>J3(t.context.selection)&&xw(t),actions:[]},{on:"split",guard:({snapshot:t})=>J3(t.context.selection)&&LS(t),actions:[]},{on:"split",guard:({snapshot:t})=>{const e=t.context.selection;if(!e||J3(e))return!1;const n=Bh(e),r=D0(e);if(!n||!r)return!1;const i=wv(t),o=Cv(t);if(!i||!o)return!1;const s=Nh({context:t.context,block:i}),a=yd({context:t.context,block:o});return!!(qn(t.context,i.node)&&qn(t.context,o.node)&&!pd(n,s)&&!pd(r,a))},actions:[()=>[Et({type:"delete"}),Et({type:"split"})]]},{on:"split",guard:({snapshot:t})=>cm(t),actions:[()=>[Et({type:"delete"})]]},{on:"split",guard:({snapshot:t})=>{const e=t.context.selection;if(!e||!J3(e))return!1;const n=Bh(e),r=$s(t);if(!r)return!1;const i=yd({context:t.context,block:r}),o={anchor:n,focus:i},s=b0({block:Dfe({context:{...t.context,selection:o},block:r.node}),context:t.context,options:{normalize:!1,removeUnusedMarkDefs:!0,validateFields:!1}});return s?{newTextBlock:s,newTextBlockSelection:o}:!1},actions:[(t,{newTextBlock:e,newTextBlockSelection:n})=>J3(n)?[Et({type:"insert.block",block:e,placement:"after",select:"start"})]:[Et({type:"delete",at:n}),Et({type:"insert.block",block:e,placement:"after",select:"start"})]]}],Dgn=[{on:"style.add",guard:({snapshot:t})=>({selectedTextBlocks:CN(t)}),actions:[({event:t},{selectedTextBlocks:e})=>e.map(n=>Et({type:"block.set",at:n.path,props:{style:t.style}}))]},{on:"style.remove",guard:({snapshot:t})=>({selectedTextBlocks:CN(t)}),actions:[(t,{selectedTextBlocks:e})=>e.map(n=>Et({type:"block.unset",at:n.path,props:["style"]}))]},{on:"style.toggle",guard:({snapshot:t,event:e})=>ICe(e.style)(t),actions:[({event:t})=>[Et({type:"style.remove",style:t.style})]]},{on:"style.toggle",guard:({snapshot:t,event:e})=>!ICe(e.style)(t),actions:[({event:t})=>[Et({type:"style.add",style:t.style})]]}],Ogn=[{on:"clipboard.copy",guard:({snapshot:t})=>{const e=Sg(t),n=hl(t);return e&&n},actions:[]},{on:"clipboard.copy",actions:[({event:t})=>[Et({type:"serialize",originEvent:t})]]},{on:"clipboard.cut",guard:({snapshot:t})=>{const e=Sg(t),n=hl(t);return e&&n},actions:[]},{on:"clipboard.cut",guard:({snapshot:t})=>t.context.selection,actions:[({event:t})=>[Et({type:"serialize",originEvent:t}),Et({type:"delete"})]]},{on:"drag.dragstart",actions:[({event:t})=>[Et({type:"serialize",originEvent:t})]]},{on:"clipboard.paste",guard:({snapshot:t})=>cm(t),actions:[({event:t})=>[Et({type:"delete"}),v0(t)]]},{on:"clipboard.paste",actions:[({event:t})=>[Et({type:"deserialize",originEvent:t})]]},...vgn,...xgn,...Cgn,...wgn,..._gn,...Sgn,...Egn,...Tgn,...Ign,...Dgn,...jgn,...Agn,...Rgn];function Xke(t){return!ztt(t)&&!_2e(t)&&!Vtt(t)}const Pgn=["annotation.set","annotation.toggle","decorator.toggle","delete.backward","delete.block","delete.child","delete.forward","delete.text","deserialize","deserialize.data","deserialization.success","deserialization.failure","insert.blocks","insert.break","insert.inline object","insert.soft break","insert.span","list item.add","list item.remove","list item.toggle","move.block down","move.block up","select.block","select.previous block","select.next block","serialize","serialize.data","serialization.success","serialization.failure","split","style.add","style.remove","style.toggle"];function Vtt(t){return Pgn.includes(t.type)}const $gn=["clipboard.copy","clipboard.cut","clipboard.paste","drag.dragstart","drag.drag","drag.dragend","drag.dragenter","drag.dragover","drag.dragleave","drag.drop","input.*","keyboard.keydown","keyboard.keyup","mouse.click"];function _2e(t){return $gn.includes(t.type)}function ztt(t){return t.type.startsWith("custom.")}function Mgn(t){return _2e(t)?"native":Vtt(t)?"synthetic":ztt(t)?"custom":"synthetic"}function oL({mode:t,behaviors:e,remainingEventBehaviors:n,event:r,editor:i,converters:o,keyGenerator:s,readOnly:a,schema:l,nativeEvent:c,sendBack:u}){t==="send"&&!_2e(r)&&(i.undoStepId=ug()),Yn.behaviors(`(${t}:${Mgn(r)})`,JSON.stringify(r,null,2));const f=[...n,...Ogn].filter(y=>{if(y.on==="*")return!0;const[b]=y.on.includes("*")&&y.on.includes(".")?y.on.split("."):[void 0],[v]=r.type.includes(".")?r.type.split("."):[void 0];return b!==void 0&&v!==void 0&&b===v||b!==void 0&&v===void 0&&b===r.type?!0:y.on===r.type});if(f.length===0&&Xke(r)){c?.preventDefault(),t==="send"&&(i.undoStepId=void 0),Yke(i,()=>{Yn.operation(JSON.stringify(r,null,2)),Gke({context:{keyGenerator:s,schema:l},operation:{...r,editor:i}})}),t==="send"&&i.onChange();return}const h=Bke({converters:o,editor:i,keyGenerator:s,readOnly:a,schema:l});let p=!1,m=!1,g=-1;for(const y of f){g++;let b=!1;try{b=y.guard===void 0||y.guard({snapshot:h,event:r,dom:ise(u,i)})}catch(x){console.error(new Error(`Evaluating guard for "${r.type}" failed due to: ${x instanceof Error?x.message:x}`))}if(!b)continue;m=!0,y.actions.length===0&&(p=!0);let v=-1;for(const x of y.actions){v++;const C=Bke({converters:o,editor:i,keyGenerator:s,readOnly:a,schema:l});let w=[];try{w=x({snapshot:C,event:r,dom:ise(u,i)},b)}catch(A){console.error(new Error(`Evaluating actions for "${r.type}" failed due to: ${A instanceof Error?A.message:A}`))}if(w.length===0)continue;p=w.some(A=>A.type==="raise"||A.type==="execute")||!w.some(A=>A.type==="forward");let _=!1;v>0&&(i.undoStepId=ug(),_=!0),!_&&w.some(A=>A.type==="execute")&&(i.undoStepId=ug(),_=!0);const S=w.map(A=>A.type),k=new Set(S),I=S.length>1&&k.size===1&&k.has("raise"),j=S.length>1&&k.size===1&&k.has("execute");bgn(i,()=>I||j,()=>{for(const A of w){if(A.type==="effect"){try{A.effect({send:u})}catch(D){console.error(new Error(`Executing effect as a result of "${r.type}" failed due to: ${D instanceof Error?D.message:D}`))}continue}if(A.type==="forward"){const D=f.slice(g+1);oL({mode:t==="execute"?"execute":"forward",behaviors:e,remainingEventBehaviors:D,event:A.event,editor:i,converters:o,keyGenerator:s,readOnly:a,schema:l,nativeEvent:c,sendBack:u});continue}if(A.type==="raise"){oL({mode:t==="execute"?"execute":"raise",behaviors:e,remainingEventBehaviors:t==="execute"?n:e,event:A.event,editor:i,converters:o,keyGenerator:s,readOnly:a,schema:l,nativeEvent:c,sendBack:u});continue}oL({mode:"execute",behaviors:e,remainingEventBehaviors:[],event:A.event,editor:i,converters:o,keyGenerator:s,readOnly:a,schema:l,nativeEvent:void 0,sendBack:u})}}),_&&(i.undoStepId=void 0)}break}!m&&Xke(r)?(c?.preventDefault(),t==="send"&&(i.undoStepId=void 0),Yke(i,()=>{Yn.operation(JSON.stringify(r,null,2)),Gke({context:{keyGenerator:s,schema:l},operation:{...r,editor:i}})}),t==="send"&&i.onChange()):p&&(c?.preventDefault(),t==="send"&&i.onChange())}function Lgn(t){if(t.length===0)return[];const e=t.filter(u=>u.priority!==void 0),n=t.filter(u=>u.priority===void 0);if(e.length===0)return t;const r=new Map(e.map(u=>[u.priority.id,u])),i=new Map,o=new Map;function s(u){i.has(u)||(i.set(u,new Set),o.set(u,0))}for(const u of e){const f=u.priority.id;s(f)}function a(u,f){!i.has(u)||!i.has(f)||(i.get(u)?.add(f),o.set(f,(o.get(f)??0)+1))}for(const u of e){const f=u.priority.id,h=new Set;let p=u.priority.reference;for(;p;){const m=p.priority.id;if(s(m),h.has(m))throw new Error("Circular dependency detected in priorities");h.add(m),p.importance==="higher"?a(f,m):a(m,f),p=p.priority.reference}}const l=[];for(const[u,f]of o)f===0&&l.push(u);const c=[];for(;l.length>0;){const u=l.shift(),f=r.get(u);f&&c.push(f);for(const h of i.get(u)??[]){const p=(o.get(h)??0)-1;o.set(h,p),p===0&&l.push(h)}}for(const u of e)c.includes(u)||c.push(u);return[...c,...n]}function Fgn(t,e){const n=Math.min(t.length,e.length);for(let r=0;r(Ws(e,"add behavior"),new Set([...t.behaviors,e.behaviorConfig])),behaviorsSorted:!1}),"remove behavior from context":qi({behaviors:({context:t,event:e})=>(Ws(e,"remove behavior"),t.behaviors.delete(e.behaviorConfig),new Set([...t.behaviors]))}),"add slate editor to context":qi({slateEditor:({context:t,event:e})=>e.type==="add slate editor"?e.editor:t.slateEditor}),"emit patch event":yc(({event:t})=>(Ws(t,"internal.patch"),t)),"emit mutation event":yc(({event:t})=>(Ws(t,"mutation"),t)),"emit read only":yc({type:"read only"}),"emit editable":yc({type:"editable"}),"defer event":qi({pendingEvents:({context:t,event:e})=>(Ws(e,["internal.patch","mutation"]),[...t.pendingEvents,e])}),"emit pending events":_2(({context:t,enqueue:e})=>{for(const n of t.pendingEvents)e.emit(n)}),"emit ready":yc({type:"ready"}),"clear pending events":qi({pendingEvents:[]}),"discard conflicting pending patches":qi({pendingEvents:({context:t,event:e})=>{if(e.type!=="patches")return t.pendingEvents;const n=e.patches.map(r=>r.path);return t.pendingEvents.filter(r=>r.type!=="internal.patch"?!0:!n.some(i=>Fgn(r.patch.path,i)))}}),"discard all pending events":qi({pendingEvents:[]}),"defer incoming patches":qi({pendingIncomingPatchesEvents:({context:t,event:e})=>e.type==="patches"?[...t.pendingIncomingPatchesEvents,e]:t.pendingIncomingPatchesEvents}),"emit pending incoming patches":_2(({context:t,enqueue:e})=>{for(const n of t.pendingIncomingPatchesEvents)e.emit(n)}),"clear pending incoming patches":qi({pendingIncomingPatchesEvents:[]}),"handle blur":({event:t})=>{Ws(t,"blur");try{Rn.blur(t.editor)}catch(e){console.error(new Error(`Failed to blur editor: ${e instanceof Error?e.message:e}`))}},"handle focus":({context:t})=>{const e=t.slateEditor;if(!e){console.error("No Slate editor found to focus");return}try{const n=e.selection;Rn.focus(e),n&&(wt.select(e,n),Km.set(e,e.selection),e.onChange())}catch(n){console.error(new Error(`Failed to focus editor: ${n instanceof Error?n.message:n}`))}},"handle behavior event":({context:t,event:e,self:n})=>{Ws(e,["behavior event"]);try{const r=[...t.behaviors.values()].map(i=>i.behavior);oL({mode:"send",behaviors:r,remainingEventBehaviors:r,event:e.behaviorEvent,editor:e.editor,converters:[...t.converters],keyGenerator:t.keyGenerator,schema:t.schema,readOnly:n.getSnapshot().matches({"edit mode":"read only"}),nativeEvent:e.nativeEvent,sendBack:i=>{if(i.type==="set drag ghost"){n.send(i);return}n.send(Htt({event:i,slateEditor:e.editor}))}})}catch(r){console.error(new Error(`Raising "${e.behaviorEvent.type}" failed due to: ${r instanceof Error?r.message:r}`))}},"sort behaviors":qi({behaviors:({context:t})=>t.behaviorsSorted?t.behaviors:new Set(Lgn([...t.behaviors.values()])),behaviorsSorted:!0})},guards:{"slate is busy":({context:t})=>t.slateEditor?t.slateEditor.operations.length>0:!1,"slate is normalizing node":({context:t})=>t.slateEditor?t.slateEditor.isNormalizingNode:!1}}).createMachine({id:"editor",context:({input:t})=>({behaviors:new Set(q5n),behaviorsSorted:!1,converters:new Set(t.converters??[]),getLegacySchema:t.getLegacySchema,keyGenerator:t.keyGenerator,pendingEvents:[],pendingIncomingPatchesEvents:[],schema:t.schema,selection:null,initialReadOnly:t.readOnly??!1,initialValue:t.initialValue}),on:{"add behavior":{actions:"add behavior to context"},"remove behavior":{actions:"remove behavior from context"},"add slate editor":{actions:"add slate editor to context"},"update selection":{actions:[qi({selection:({event:t})=>t.selection}),yc(({event:t})=>({...t,type:"selection"}))]},"set drag ghost":{actions:qi({dragGhost:({event:t})=>t.ghost})}},type:"parallel",states:{"edit mode":{initial:"read only",states:{"read only":{initial:"determine initial edit mode",on:{"behavior event":{actions:["sort behaviors","handle behavior event"],guard:({event:t})=>t.behaviorEvent.type==="clipboard.copy"||t.behaviorEvent.type==="mouse.click"||t.behaviorEvent.type==="serialize"||t.behaviorEvent.type==="serialization.failure"||t.behaviorEvent.type==="serialization.success"||t.behaviorEvent.type==="select"}},states:{"determine initial edit mode":{entry:[()=>{Yn.state("entry: edit mode->read only->determine initial edit mode")}],exit:[()=>{Yn.state("exit: edit mode->read only->determine initial edit mode")}],on:{"done syncing value":[{target:"#editor.edit mode.read only.read only",guard:({context:t})=>t.initialReadOnly},{target:"#editor.edit mode.editable"}]}},"read only":{entry:[()=>{Yn.state("entry: edit mode->read only->read only")}],exit:[()=>{Yn.state("exit: edit mode->read only->read only")}],on:{"update readOnly":{guard:({event:t})=>!t.readOnly,target:"#editor.edit mode.editable",actions:["emit editable"]}}}}},editable:{on:{"update readOnly":{guard:({event:t})=>t.readOnly,target:"#editor.edit mode.read only.read only",actions:["emit read only"]},"behavior event":{actions:["sort behaviors","handle behavior event"]},blur:{actions:"handle blur"},focus:{target:".focusing",actions:[qi({slateEditor:({event:t})=>t.editor})]}},initial:"idle",states:{idle:{entry:[()=>{Yn.state("entry: edit mode->editable->idle")}],exit:[()=>{Yn.state("exit: edit mode->editable-idle")}],on:{dragstart:{actions:[qi({internalDrag:({event:t})=>({origin:t.origin})})],target:"dragging internally"}}},focusing:{initial:"checking if busy",states:{"checking if busy":{entry:[()=>{Yn.state("entry: edit mode->editable->focusing->checking if busy")}],exit:[()=>{Yn.state("exit: edit mode->editable->focusing->checking if busy")}],always:[{guard:"slate is busy",target:"busy"},{target:"#editor.edit mode.editable.idle",actions:["handle focus"]}]},busy:{entry:[()=>{Yn.state("entry: edit mode->editable->focusing-busy")}],exit:[()=>{Yn.state("exit: edit mode->editable->focusing->busy")}],after:{10:{target:"checking if busy"}}}}},"dragging internally":{entry:[()=>{Yn.state("entry: edit mode->editable->dragging internally")}],exit:[()=>{Yn.state("exit: edit mode->editable->dragging internally")},({context:t})=>{if(t.dragGhost)try{t.dragGhost.parentNode?.removeChild(t.dragGhost)}catch(e){console.error(new Error(`Removing the drag ghost failed due to: ${e instanceof Error?e.message:e}`))}},qi({dragGhost:void 0}),qi({internalDrag:void 0})],tags:["dragging internally"],on:{dragend:{target:"idle"},drop:{target:"idle"}}}}}}},setup:{initial:"setting up",states:{"setting up":{entry:[()=>{Yn.state("entry: setup->setting up")}],exit:[()=>{Yn.state("exit: setup->setting up")},"emit ready","emit pending incoming patches","clear pending incoming patches"],on:{"internal.patch":{actions:"defer event"},mutation:{actions:"defer event"},"done syncing value":{target:"set up"},patches:{actions:["defer incoming patches"]}}},"set up":{type:"parallel",states:{"value sync":{initial:"idle",states:{idle:{entry:[()=>{Yn.state("entry: setup->set up->value sync->idle")}],exit:[()=>{Yn.state("exit: setup->set up->value sync->idle")}],on:{patches:{actions:[yc(({event:t})=>t)]},"syncing value":{target:"syncing value"}}},"syncing value":{entry:[()=>{Yn.state("entry: setup->set up->value sync->syncing value")}],exit:[()=>{Yn.state("exit: setup->set up->value sync->syncing value")},"emit pending incoming patches","clear pending incoming patches"],on:{patches:{actions:["defer incoming patches"]},"done syncing value":{target:"idle"}}}}},writing:{initial:"pristine",states:{pristine:{initial:"idle",states:{idle:{entry:[()=>{Yn.state("entry: setup->set up->writing->pristine->idle")}],exit:[()=>{Yn.state("exit: setup->set up->writing->pristine->idle")}],on:{"internal.patch":[{guard:"slate is normalizing node",actions:"defer event"},{actions:"defer event",target:"#editor.setup.set up.writing.dirty"}],mutation:[{guard:"slate is normalizing node",actions:"defer event"},{actions:"defer event",target:"#editor.setup.set up.writing.dirty"}],patches:{actions:"discard conflicting pending patches"},"syncing value":{actions:"discard all pending events"}}}}},dirty:{entry:[()=>{Yn.state("entry: setup->set up->writing->dirty")},"emit pending events","clear pending events"],exit:[()=>{Yn.state("exit: setup->set up->writing->dirty")}],on:{"internal.patch":{actions:"emit patch event"},mutation:{actions:"emit mutation event"}}}}}}}}}}}),Bgn=lm({actions:{"assign readOnly":qi({readOnly:({context:t,event:e})=>e.type==="update readOnly"?e.readOnly:t.readOnly}),"emit patch":yc(({event:t})=>(Ws(t,"patch"),{type:"patch",patch:t.patch})),"set is deferring mutations":({context:t})=>{t.slateEditor.isDeferringMutations=!0},"emit mutations":_2(({context:t,enqueue:e})=>{for(const n of t.pendingMutations)e.emit({type:"mutation",patches:n.patches,snapshot:n.value});t.slateEditor.isDeferringMutations=!1}),"clear pending mutations":qi({pendingMutations:[]}),"defer mutation":qi({pendingMutations:({context:t,event:e})=>{if(Ws(e,"patch"),t.pendingMutations.length===0)return[{operationId:e.operationId,value:e.value,patches:[e.patch]}];const n=t.pendingMutations.at(-1);return n&&n.operationId===e.operationId?t.pendingMutations.slice(0,-1).concat({value:e.value,operationId:n.operationId,patches:[...n.patches,e.patch]}):t.pendingMutations.concat({value:e.value,operationId:e.operationId,patches:[e.patch]})}}),"clear pending patch events":qi({pendingPatchEvents:[]}),"defer patch":qi({pendingPatchEvents:({context:t,event:e})=>e.type==="patch"?[...t.pendingPatchEvents,e]:t.pendingPatchEvents}),"emit pending patch events":_2(({context:t,enqueue:e})=>{for(const n of t.pendingPatchEvents)e.emit(n)})},actors:{"type listener":y0(({input:t,sendBack:e})=>{const n=t.slateEditor.apply;return t.slateEditor.apply=r=>{r.type==="insert_text"||r.type==="remove_text"?e({type:"typing"}):e({type:"not typing"}),n(r)},()=>{t.slateEditor.apply=n}}),"mutation interval":y0(({sendBack:t})=>{const e=setInterval(()=>{t({type:"emit changes"})},1e3);return()=>{clearInterval(e)}})},guards:{"is read-only":({context:t})=>t.readOnly,"slate is normalizing":({context:t})=>De.isNormalizing(t.slateEditor)},delays:{"type debounce":250}}).createMachine({id:"mutation",context:({input:t})=>({pendingMutations:[],pendingPatchEvents:[],readOnly:t.readOnly,schema:t.schema,slateEditor:t.slateEditor}),on:{"update readOnly":{actions:["assign readOnly"]}},type:"parallel",states:{typing:{initial:"idle",invoke:{src:"type listener",input:({context:t})=>({slateEditor:t.slateEditor})},states:{idle:{entry:[()=>{Yn.mutation("entry: typing->idle")}],exit:[()=>{Yn.mutation("exit: typing->idle"),Yn.mutation("entry: typing->typing")}],on:{typing:{target:"typing"}}},typing:{after:{"type debounce":{target:"idle",actions:[w2({type:"emit changes"}),()=>{Yn.mutation("exit: typing->typing")}]}},on:{"not typing":{target:"idle",actions:[w2({type:"emit changes"})]},typing:{target:"typing",reenter:!0}}}}},mutations:{initial:"idle",states:{idle:{entry:[()=>{Yn.mutation("entry: mutations->idle")}],exit:[()=>{Yn.mutation("exit: mutations->idle")}],on:{patch:[{guard:"is read-only",actions:["set is deferring mutations","defer patch","defer mutation"],target:"has pending mutations"},{actions:["set is deferring mutations","emit patch","defer mutation"],target:"has pending mutations"}]}},"has pending mutations":{entry:[()=>{Yn.mutation("entry: mutations->has pending mutations")}],exit:[()=>{Yn.mutation("exit: mutations->has pending mutations")}],invoke:{src:"mutation interval"},on:{"emit changes":{guard:bw([ZM("is read-only"),"slate is normalizing"]),target:"idle",actions:["emit pending patch events","clear pending patch events","emit mutations","clear pending mutations"]},patch:[{guard:"is read-only",actions:["defer patch","defer mutation"]},{actions:["emit patch","defer mutation"]}]}}}}}}),Vgn=lm({}).createMachine({id:"relay",context:{prevSelection:null,lastEventWasFocused:!1},on:{focused:{actions:[qi({lastEventWasFocused:!0}),yc(({event:t})=>t)]},selection:[{guard:({context:t})=>t.lastEventWasFocused,actions:[qi({prevSelection:({event:t})=>t.selection}),yc(({event:t})=>t),qi({lastEventWasFocused:!1})]},{guard:({context:t,event:e})=>t.prevSelection!==e.selection,actions:[qi({prevSelection:({event:t})=>t.selection}),yc(({event:t})=>t),qi({lastEventWasFocused:!1})]}],"*":{actions:[yc(({event:t})=>t),qi({lastEventWasFocused:!1})]}}});function Zke(t,e,n){let r=null,i=!0;const o=[e.span.name,...e.inlineObjects.map(a=>a.name)],s=[e.block.name,...e.blockObjects.map(a=>a.name)];return t===void 0?{valid:!0,resolution:null,value:t}:!Array.isArray(t)||t.length===0?{valid:!1,resolution:{patches:[Mu([])],description:"Editor value must be an array of Portable Text blocks, or undefined.",action:"Unset the value",item:t,i18n:{description:"inputs.portable-text.invalid-value.not-an-array.description",action:"inputs.portable-text.invalid-value.not-an-array.action"}},value:t}:(t.some((a,l)=>{if(typeof a!="object"||a===null)return r={patches:[Mu([l])],description:`Block must be an object, got ${String(a)}`,action:"Unset invalid item",item:a,i18n:{description:"inputs.portable-text.invalid-value.not-an-object.description",action:"inputs.portable-text.invalid-value.not-an-object.action",values:{index:l}}},!0;if(!a._key||typeof a._key!="string")return r={patches:[eu({...a,_key:n()},[l])],description:`Block at index ${l} is missing required _key.`,action:"Set the block with a random _key value",item:a,i18n:{description:"inputs.portable-text.invalid-value.missing-key.description",action:"inputs.portable-text.invalid-value.missing-key.action",values:{index:l}}},!0;if(!a._type||!s.includes(a._type)){if(a._type==="block"){const c=e.block.name;return r={patches:[eu({...a,_type:c},[{_key:a._key}])],description:`Block with _key '${a._key}' has invalid type name '${a._type}'. According to the schema, the block type name is '${c}'`,action:`Use type '${c}'`,item:a,i18n:{description:"inputs.portable-text.invalid-value.incorrect-block-type.description",action:"inputs.portable-text.invalid-value.incorrect-block-type.action",values:{key:a._key,expectedTypeName:c}}},!0}return!a._type&&qn({schema:e},{...a,_type:e.block.name})?(r={patches:[eu({...a,_type:e.block.name},[{_key:a._key}])],description:`Block with _key '${a._key}' is missing a type name. According to the schema, the block type name is '${e.block.name}'`,action:`Use type '${e.block.name}'`,item:a,i18n:{description:"inputs.portable-text.invalid-value.missing-block-type.description",action:"inputs.portable-text.invalid-value.missing-block-type.action",values:{key:a._key,expectedTypeName:e.block.name}}},!0):a._type?(r={patches:[Mu([{_key:a._key}])],description:`Block with _key '${a._key}' has invalid _type '${a._type}'`,action:"Remove the block",item:a,i18n:{description:"inputs.portable-text.invalid-value.disallowed-type.description",action:"inputs.portable-text.invalid-value.disallowed-type.action",values:{key:a._key,typeName:a._type}}},!0):(r={patches:[Mu([{_key:a._key}])],description:`Block with _key '${a._key}' is missing an _type property`,action:"Remove the block",item:a,i18n:{description:"inputs.portable-text.invalid-value.missing-type.description",action:"inputs.portable-text.invalid-value.missing-type.action",values:{key:a._key}}},!0)}if(a._type===e.block.name){const c=a;if(c.children&&!Array.isArray(c.children))return r={patches:[eu({children:[]},[{_key:c._key}])],description:`Text block with _key '${c._key}' has a invalid required property 'children'.`,action:"Reset the children property",item:c,i18n:{description:"inputs.portable-text.invalid-value.missing-or-invalid-children.description",action:"inputs.portable-text.invalid-value.missing-or-invalid-children.action",values:{key:c._key}}},!0;if(c.children===void 0||Array.isArray(c.children)&&c.children.length===0){const h={_type:e.span.name,_key:n(),text:"",marks:[]};return r={autoResolve:!0,patches:[x_([],[{_key:a._key},"children"]),Z5([h],"after",[{_key:a._key},"children",0])],description:`Children for text block with _key '${a._key}' is empty.`,action:"Insert an empty text",item:a,i18n:{description:"inputs.portable-text.invalid-value.empty-children.description",action:"inputs.portable-text.invalid-value.empty-children.action",values:{key:a._key}}},!0}const u=[...new Set(c.children.filter(h=>Ci({schema:e},h)).flatMap(h=>h.marks||[]))];if(Array.isArray(a.markDefs)&&a.markDefs.length>0){const h=[...new Set(a.markDefs.map(p=>p._key).filter(p=>!u.includes(p)))];if(h.length>0)return r={autoResolve:!0,patches:h.map(p=>Mu([{_key:a._key},"markDefs",{_key:p}])),description:`Block contains orphaned data (unused mark definitions): ${h.join(", ")}.`,action:"Remove unused mark definition item",item:a,i18n:{description:"inputs.portable-text.invalid-value.orphaned-mark-defs.description",action:"inputs.portable-text.invalid-value.orphaned-mark-defs.action",values:{key:a._key,unusedMarkDefs:h.map(p=>p.toString())}}},!0}const f=u.filter(h=>!e.decorators.map(p=>p.name).includes(h)).filter(h=>c.markDefs===void 0||!c.markDefs.find(p=>p._key===h));if(f.length>0){const h=c.children.filter(p=>p._type===e.span.name&&Array.isArray(p.marks)&&p.marks.some(m=>f.includes(m)));if(h){const p=f.join(", ");return r={autoResolve:!0,patches:h.map(m=>eu((m.marks||[]).filter(g=>!f.includes(g)),[{_key:a._key},"children",{_key:m._key},"marks"])),description:`Block with _key '${a._key}' contains marks (${p}) not supported by the current content model.`,action:"Remove invalid marks",item:a,i18n:{description:"inputs.portable-text.invalid-value.orphaned-marks.description",action:"inputs.portable-text.invalid-value.orphaned-marks.action",values:{key:a._key,orphanedMarks:f.map(m=>m.toString())}}},!0}}c.children.some((h,p)=>{if(typeof h!="object"||h===null)return r={patches:[Mu([{_key:a._key},"children",p])],description:`Child at index '${p}' in block with key '${a._key}' is not an object.`,action:"Remove the item",item:a,i18n:{description:"inputs.portable-text.invalid-value.non-object-child.description",action:"inputs.portable-text.invalid-value.non-object-child.action",values:{key:a._key,index:p}}},!0;if(!h._key||typeof h._key!="string"){const m={...h,_key:n()};return r={autoResolve:!0,patches:[eu(m,[{_key:a._key},"children",p])],description:`Child at index ${p} is missing required _key in block with _key ${a._key}.`,action:"Set a new random _key on the object",item:a,i18n:{description:"inputs.portable-text.invalid-value.missing-child-key.description",action:"inputs.portable-text.invalid-value.missing-child-key.action",values:{key:a._key,index:p}}},!0}return h._type?o.includes(h._type)?h._type===e.span.name&&typeof h.text!="string"?(r={patches:[eu({...h,text:""},[{_key:a._key},"children",{_key:h._key}])],description:`Child with _key '${h._key}' in block with key '${a._key}' has missing or invalid text property!`,action:"Write an empty text property to the object",item:a,i18n:{description:"inputs.portable-text.invalid-value.invalid-span-text.description",action:"inputs.portable-text.invalid-value.invalid-span-text.action",values:{key:a._key,childKey:h._key}}},!0):!1:(r={patches:[Mu([{_key:a._key},"children",{_key:h._key}])],description:`Child with _key '${h._key}' in block with key '${a._key}' has invalid '_type' property (${h._type}).`,action:"Remove the object",item:a,i18n:{description:"inputs.portable-text.invalid-value.disallowed-child-type.description",action:"inputs.portable-text.invalid-value.disallowed-child-type.action",values:{key:a._key,childKey:h._key,childType:h._type}}},!0):(r={patches:[Mu([{_key:a._key},"children",{_key:h._key}])],description:`Child with _key '${h._key}' in block with key '${a._key}' is missing '_type' property.`,action:"Remove the object",item:a,i18n:{description:"inputs.portable-text.invalid-value.missing-child-type.description",action:"inputs.portable-text.invalid-value.missing-child-type.action",values:{key:a._key,childKey:h._key}}},!0)})&&(i=!1)}return!1})&&(i=!1),{valid:i,resolution:r,value:t})}const zgn=({sendBack:t,input:e})=>{Wgn({context:e.context,sendBack:t,slateEditor:e.slateEditor,value:e.value,streamBlocks:e.streamBlocks})},Hgn=y0(zgn),Ugn=lm({actions:{"assign initial value synced":qi({initialValueSynced:!0}),"assign readOnly":qi({readOnly:({event:t})=>(Ws(t,"update readOnly"),t.readOnly)}),"assign pending value":qi({pendingValue:({event:t})=>(Ws(t,"update value"),t.value)}),"clear pending value":qi({pendingValue:void 0}),"assign previous value":qi({previousValue:({event:t})=>(Ws(t,"done syncing"),t.value)}),"emit done syncing value":yc({type:"done syncing value"}),"emit syncing value":yc({type:"syncing value"})},guards:{"initial value synced":({context:t})=>t.initialValueSynced,"is busy":({context:t})=>{const e=t.slateEditor.isDeferringMutations||t.slateEditor.isProcessingRemoteChanges;return Yn.syncValue(JSON.stringify({isBusy:e,isDeferringMutations:t.slateEditor.isDeferringMutations,isProcessingRemoteChanges:t.slateEditor.isProcessingRemoteChanges})),e},"is empty value":({event:t})=>t.type==="update value"&&t.value===void 0,"is empty array":({event:t})=>t.type==="update value"&&Array.isArray(t.value)&&t.value.length===0,"is new value":({context:t,event:e})=>e.type!=="update value"||t.previousValue===e.value?!1:!iL({schema:t.schema},t.previousValue,e.value),"value changed while syncing":({context:t,event:e})=>e.type!=="done syncing"||t.pendingValue===e.value?!1:!iL({schema:t.schema},t.pendingValue,e.value),"pending value equals previous value":({context:t})=>iL({schema:t.schema},t.pendingValue,t.previousValue)},actors:{"sync value":Hgn}}).createMachine({id:"sync",context:({input:t})=>({initialValue:t.initialValue,initialValueSynced:!1,keyGenerator:t.keyGenerator,schema:t.schema,readOnly:t.readOnly,slateEditor:t.slateEditor,pendingValue:void 0,previousValue:void 0}),entry:[w2(({context:t})=>({type:"update value",value:t.initialValue}))],on:{"update readOnly":{actions:["assign readOnly"]}},initial:"idle",states:{idle:{entry:[()=>{Yn.syncValue("entry: syncing->idle")}],exit:[()=>{Yn.syncValue("exit: syncing->idle")}],on:{"update value":[{guard:bw(["is empty value",ZM("initial value synced")]),actions:["assign initial value synced","emit done syncing value"]},{guard:bw(["is empty array",ZM("initial value synced")]),actions:["assign initial value synced",yc({type:"value changed",value:[]}),"emit done syncing value"]},{guard:bw(["is busy","is new value"]),target:"busy",actions:["assign pending value"]},{guard:"is new value",target:"syncing",actions:["assign pending value"]},{guard:ZM("initial value synced"),actions:[()=>{Yn.syncValue("no new value – setting initial value as synced")},"assign initial value synced","emit done syncing value"]},{actions:[()=>{Yn.syncValue("no new value and initial value already synced")}]}]}},busy:{entry:[()=>{Yn.syncValue("entry: syncing->busy")}],exit:[()=>{Yn.syncValue("exit: syncing->busy")}],after:{1e3:[{guard:"is busy",target:".",reenter:!0,actions:[()=>{Yn.syncValue("reenter: syncing->busy")}]},{target:"syncing"}]},on:{"update value":[{guard:"is new value",actions:["assign pending value"]}]}},syncing:{entry:[()=>{Yn.syncValue("entry: syncing->syncing")},"emit syncing value"],exit:[()=>{Yn.syncValue("exit: syncing->syncing")},"emit done syncing value"],invoke:{src:"sync value",id:"sync value",input:({context:t})=>({context:{keyGenerator:t.keyGenerator,previousValue:t.previousValue,readOnly:t.readOnly,schema:t.schema},slateEditor:t.slateEditor,streamBlocks:!t.initialValueSynced,value:t.pendingValue})},on:{"update value":{guard:"is new value",actions:["assign pending value"]},patch:{actions:[yc(({event:t})=>t)]},"invalid value":{actions:[yc(({event:t})=>t)]},"value changed":{actions:[yc(({event:t})=>t)]},"done syncing":[{guard:"value changed while syncing",actions:["assign previous value","assign initial value synced"],target:"syncing",reenter:!0},{target:"idle",actions:["clear pending value","assign previous value","assign initial value synced"]}]}}}});async function Wgn({context:t,sendBack:e,slateEditor:n,streamBlocks:r,value:i}){let o=!1,s=!1,a=!0;const l=!!n.selection;if((!i||i.length===0)&&(Ggn({slateEditor:n,doneSyncing:o}),s=!0),i&&i.length>0)if(r)await new Promise(c=>{if(o){c();return}s=Qke({slateEditor:n,value:i}),(async()=>{for await(const[u,f]of qgn({value:i})){const{blockChanged:h,blockValid:p}=Jke({context:t,sendBack:e,block:u,index:f,slateEditor:n,value:i});if(s=h||s,a=a&&p,!a)break}c()})()});else{if(o)return;s=Qke({slateEditor:n,value:i});let c=0;for(const u of i){const{blockChanged:f,blockValid:h}=Jke({context:t,sendBack:e,block:u,index:c,slateEditor:n,value:i});if(s=f||s,a=a&&h,!h)break;c++}}if(!a){Yn.syncValue("Invalid value, returning"),o=!0,e({type:"done syncing",value:i});return}if(s){Yn.syncValue("remote value changed, syncing local value");try{n.onChange()}catch(c){console.error(c),e({type:"invalid value",resolution:null,value:i}),o=!0,e({type:"done syncing",value:i});return}l&&!n.selection&&n.children.length>0&&(wt.select(n,De.start(n,[])),n.onChange()),e({type:"value changed",value:i})}else Yn.syncValue("remote value and local value are equal, no need to sync");o=!0,e({type:"done syncing",value:i})}async function*qgn({value:t}){let e=0;for await(const n of t)e%10===0&&await new Promise(r=>setTimeout(r,0)),yield[n,e],e++}function Ggn({slateEditor:t,doneSyncing:e}){De.withoutNormalizing(t,()=>{MH(t,()=>{Sw(t,()=>{a9(t,()=>{if(e)return;const n=t.children.length;t.children.forEach((r,i)=>{wt.removeNodes(t,{at:[n-1-i]})})})})})})}function Qke({slateEditor:t,value:e}){let n=!1;return De.withoutNormalizing(t,()=>{Sw(t,()=>{a9(t,()=>{const r=t.children.length;if(e.lengthe.length-1;i--)wt.removeNodes(t,{at:[i]});n=!0}})})}),n}function Jke({context:t,sendBack:e,block:n,index:r,slateEditor:i,value:o}){const s=i.children.at(r),a=i.value.at(r);if(!s||!a){const u=Zke([n],t.schema,t.keyGenerator);if(Yn.syncValue("Validating and inserting new block in the end of the value",n),u.valid||u.resolution?.autoResolve){const f=s9(n,{schemaTypes:t.schema});return De.withoutNormalizing(i,()=>{Sw(i,()=>{a9(i,()=>{wt.insertNodes(i,f,{at:[r]})})})}),{blockChanged:!0,blockValid:!0}}return Yn.syncValue("Invalid",u),e({type:"invalid value",resolution:u.resolution,value:o}),{blockChanged:!1,blockValid:!1}}if(rtt(t,n,a))return{blockChanged:!1,blockValid:!0};const l=o[r];if(!l)return{blockChanged:!1,blockValid:!0};const c=Zke([l],t.schema,t.keyGenerator);return!c.valid&&c.resolution?.autoResolve&&c.resolution?.patches.length>0&&!t.readOnly&&t.previousValue&&t.previousValue!==o&&(console.warn(`${c.resolution.action} for block with _key '${l._key}'. ${c.resolution?.description}`),c.resolution.patches.forEach(u=>{e({type:"patch",patch:u})})),c.valid||c.resolution?.autoResolve?(a._key===n._key&&a._type===n._type?(Yn.syncValue("Updating block",a,n),De.withoutNormalizing(i,()=>{Sw(i,()=>{a9(i,()=>{Kgn({context:t,slateEditor:i,oldSlateBlock:s,block:n,index:r})})})})):(Yn.syncValue("Replacing block",a,n),De.withoutNormalizing(i,()=>{Sw(i,()=>{a9(i,()=>{Ygn({context:t,slateEditor:i,block:n,index:r})})})})),{blockChanged:!0,blockValid:!0}):(e({type:"invalid value",resolution:c.resolution,value:o}),{blockChanged:!1,blockValid:!1})}function Ygn({context:t,slateEditor:e,block:n,index:r}){const i=s9(n,{schemaTypes:t.schema}),o=e.selection,s=o&&o.focus.path[0]===r;s&&wt.deselect(e),wt.removeNodes(e,{at:[r]}),wt.insertNodes(e,i,{at:[r]}),e.onChange(),s&&wt.select(e,o)}function Kgn({context:t,slateEditor:e,oldSlateBlock:n,block:r,index:i}){const o=s9(r,{schemaTypes:t.schema});if(wt.setNodes(e,o,{at:[i]}),e.isTextBlock(o)&&e.isTextBlock(n)){const s=n.children.length;o.children.length{const c=s-1-l;c>0&&(Yn.syncValue("Removing child"),wt.removeNodes(e,{at:[i,c]}))}),o.children.forEach((a,l)=>{const c=n.children.at(l),u=!c||!stt(a,c),f=c&&Dn.isText(c)&&a.text!==c.text,h=[i,l];if(u)if(a._key===c?._key&&a._type===c?._type){Yn.syncValue("Updating changed child",a,c),wt.setNodes(e,a,{at:h});const p=Ci({schema:t.schema},a)&&Ci({schema:t.schema},c);p&&f?(c.text.length>0&&OI(e,{at:{focus:{path:h,offset:0},anchor:{path:h,offset:c.text.length}}}),wt.insertText(e,a.text,{at:h}),e.onChange()):p||(Yn.syncValue("Updating changed inline object child",a),wt.setNodes(e,{_key:w_},{at:[...h,0],voids:!0}))}else c?(Yn.syncValue("Replacing child",a),wt.removeNodes(e,{at:[i,l]}),wt.insertNodes(e,a,{at:[i,l]}),e.onChange()):c||(Yn.syncValue("Inserting new child",a),wt.insertNodes(e,a,{at:[i,l]}),e.onChange())})}}function Xgn(t){Yn.setup("creating new editor instance");const e=[],n=Zp(Ngn,{input:Zgn(t)}),r=Zp(Vgn),i=u5n({editorActor:n,relayActor:r,subscriptions:e}),o=n0n(i.instance,n),{mutationActor:s,syncActor:a}=Jgn({editorActor:n,relayActor:r,slateEditor:i.instance,subscriptions:e}),l={dom:ise(c=>n.send(c),i.instance),getSnapshot:()=>M4({editorActorSnapshot:n.getSnapshot(),slateEditorInstance:i.instance}),registerBehavior:c=>{const u=Yj({name:"custom",reference:{priority:$N,importance:"higher"}}),f={...c,priority:u};return n.send({type:"add behavior",behaviorConfig:f}),()=>{n.send({type:"remove behavior",behaviorConfig:f})}},send:c=>{switch(c.type){case"update value":a.send(c);break;case"update readOnly":case"patches":n.send(c);break;default:n.send(Htt({event:c,slateEditor:i.instance}))}},on:(c,u)=>r.on(c,f=>{switch(f.type){case"blurred":case"done loading":case"editable":case"focused":case"invalid value":case"loading":case"mutation":case"patch":case"read only":case"ready":case"selection":case"value changed":u(f);break}}),_internal:{editable:o,editorActor:n,slateEditor:i}};return{actors:{editorActor:n,mutationActor:s,relayActor:r,syncActor:a},editor:l,subscriptions:e}}function Zgn(t){const{legacySchema:e,schema:n}=Qgn(t);return{converters:e0n(e),getLegacySchema:()=>e,keyGenerator:t.keyGenerator??ug,readOnly:t.readOnly,schema:n,initialValue:t.initialValue}}function Qgn(t){const e=t.schemaDefinition?qsn(t.schemaDefinition):mH(t.schema.hasOwnProperty("jsonType")?t.schema:t0n(t.schema)),n=t.schemaDefinition?Afe(t.schemaDefinition):TJe(e);return{legacySchema:e,schema:n}}function Jgn(t){Yn.setup("creating new actors");const e=Zp(Bgn,{input:{readOnly:t.editorActor.getSnapshot().matches({"edit mode":"read only"}),schema:t.editorActor.getSnapshot().context.schema,slateEditor:t.slateEditor}}),n=Zp(Ugn,{input:{initialValue:t.editorActor.getSnapshot().context.initialValue,keyGenerator:t.editorActor.getSnapshot().context.keyGenerator,readOnly:t.editorActor.getSnapshot().matches({"edit mode":"read only"}),schema:t.editorActor.getSnapshot().context.schema,slateEditor:t.slateEditor}});return t.subscriptions.push(()=>{const r=e.on("*",i=>{i.type==="mutation"&&t.editorActor.send({type:"mutation",patches:i.patches,value:i.snapshot}),i.type==="patch"&&t.relayActor.send(i)});return()=>{e.send({type:"emit changes"}),r.unsubscribe()}}),t.subscriptions.push(()=>{const r=n.on("*",i=>{switch(i.type){case"invalid value":t.relayActor.send(i);break;case"value changed":t.relayActor.send(i);break;case"patch":t.editorActor.send({...i,type:"internal.patch",value:t.slateEditor.value});break;default:t.editorActor.send(i)}});return()=>{r.unsubscribe()}}),t.subscriptions.push(()=>{const r=t.editorActor.subscribe(i=>{i.matches({"edit mode":"read only"})?(e.send({type:"update readOnly",readOnly:!0}),n.send({type:"update readOnly",readOnly:!0})):(e.send({type:"update readOnly",readOnly:!1}),n.send({type:"update readOnly",readOnly:!1}))});return()=>{r.unsubscribe()}}),t.subscriptions.push(()=>{const r=t.editorActor.on("*",i=>{switch(i.type){case"editable":case"mutation":case"ready":case"read only":case"selection":t.relayActor.send(i);break;case"internal.patch":e.send({...i,type:"patch"});break}});return()=>{r.unsubscribe()}}),{mutationActor:e,syncActor:n}}function e3n(t){switch(t.type){case"blurred":return{type:"blur",event:t.event};case"patch":return t;case"loading":return{type:"loading",isLoading:!0};case"done loading":return{type:"loading",isLoading:!1};case"focused":return{type:"focus",event:t.event};case"value changed":return{type:"value",value:t.value};case"invalid value":return{type:"invalidValue",resolution:t.resolution,value:t.value};case"mutation":return{type:"mutation",patches:t.patches,snapshot:t.value};case"ready":return t;case"selection":return t;case"unset":return t}}class _r{change$=new qs;constructor(e){this.editor=e.editor,this.schemaTypes=e.editor._internal.editorActor.getSnapshot().context.getLegacySchema(),this.editable=e.editor._internal.editable}setEditable=e=>{this.editor._internal.editable={...this.editor._internal.editable,...e}};static activeAnnotations=e=>e&&e.editable?e.editable.activeAnnotations():[];static isAnnotationActive=(e,n)=>e&&e.editable?e.editable.isAnnotationActive(n):!1;static addAnnotation=(e,n,r)=>e.editable?.addAnnotation(n,r);static blur=e=>{e.editable?.blur()};static delete=(e,n,r)=>e.editable?.delete(n,r);static findDOMNode=(e,n)=>e.editable?.findDOMNode(n);static findByPath=(e,n)=>e.editable?.findByPath(n)||[];static focus=e=>{e.editable?.focus()};static focusBlock=e=>e.editable?.focusBlock();static focusChild=e=>e.editable?.focusChild();static getSelection=e=>e.editable?e.editable.getSelection():null;static getValue=e=>e.editable?.getValue();static hasBlockStyle=(e,n)=>e.editable?.hasBlockStyle(n);static hasListStyle=(e,n)=>e.editable?.hasListStyle(n);static isCollapsedSelection=e=>e.editable?.isCollapsedSelection();static isExpandedSelection=e=>e.editable?.isExpandedSelection();static isMarkActive=(e,n)=>e.editable?.isMarkActive(n);static insertChild=(e,n,r)=>e.editable?.insertChild(n,r);static insertBlock=(e,n,r)=>e.editable?.insertBlock(n,r);static insertBreak=e=>e.editable?.insertBreak();static isVoid=(e,n)=>e.editable?.isVoid(n);static isObjectPath=(e,n)=>{if(!n||!Array.isArray(n))return!1;const r=n.length>3&&n[1]==="children";return n.length>1&&n[1]!=="children"||r};static marks=e=>e.editable?.marks();static select=(e,n)=>{e.editable?.select(n)};static removeAnnotation=(e,n)=>e.editable?.removeAnnotation(n);static toggleBlockStyle=(e,n)=>e.editable?.toggleBlockStyle(n);static toggleList=(e,n)=>e.editable?.toggleList(n);static toggleMark=(e,n)=>{e.editable?.toggleMark(n)};static getFragment=e=>e.editable?.getFragment();static undo=e=>{e.editable?.undo()};static redo=e=>{e.editable?.redo()};static isSelectionsOverlapping=(e,n,r)=>e.editable?.isSelectionsOverlapping(n,r)}function S2e(t){const e=H.c(29);let n;e[0]!==t.initialConfig?(n=()=>{const p=Xgn(t.initialConfig),m=new _r({editor:p.editor});return{internalEditor:p,portableTextEditor:m}},e[0]=t.initialConfig,e[1]=n):n=e[1];const[r]=E.useState(n),{internalEditor:i,portableTextEditor:o}=r;let s;e[2]!==i.actors.editorActor||e[3]!==i.actors.mutationActor||e[4]!==i.actors.relayActor||e[5]!==i.actors.syncActor||e[6]!==i.editor._internal.slateEditor.instance||e[7]!==i.subscriptions||e[8]!==o?(s=()=>{const p=[];for(const g of i.subscriptions)p.push(g());const m=i.actors.relayActor.on("*",g=>{const y=e3n(g);y&&o.change$.next(y)});return p.push(m.unsubscribe),i.actors.editorActor.start(),i.actors.editorActor.send({type:"add slate editor",editor:i.editor._internal.slateEditor.instance}),i.actors.mutationActor.start(),i.actors.relayActor.start(),i.actors.syncActor.start(),()=>{for(const g of p)g();YP(i.actors.editorActor),YP(i.actors.mutationActor),YP(i.actors.relayActor),YP(i.actors.syncActor)}},e[2]=i.actors.editorActor,e[3]=i.actors.mutationActor,e[4]=i.actors.relayActor,e[5]=i.actors.syncActor,e[6]=i.editor._internal.slateEditor.instance,e[7]=i.subscriptions,e[8]=o,e[9]=s):s=e[9];let a;e[10]!==i||e[11]!==o?(a=[i,o],e[10]=i,e[11]=o,e[12]=a):a=e[12],E.useEffect(s,a);let l;e[13]!==o||e[14]!==t.children?(l=d.jsx(ktt.Provider,{value:o,children:t.children}),e[13]=o,e[14]=t.children,e[15]=l):l=e[15];let c;e[16]!==i.editor._internal.slateEditor.initialValue||e[17]!==i.editor._internal.slateEditor.instance||e[18]!==l?(c=d.jsx(Zpn,{editor:i.editor._internal.slateEditor.instance,initialValue:i.editor._internal.slateEditor.initialValue,children:l}),e[16]=i.editor._internal.slateEditor.initialValue,e[17]=i.editor._internal.slateEditor.instance,e[18]=l,e[19]=c):c=e[19];let u;e[20]!==i.actors.relayActor||e[21]!==c?(u=d.jsx(_tt.Provider,{value:i.actors.relayActor,children:c}),e[20]=i.actors.relayActor,e[21]=c,e[22]=u):u=e[22];let f;e[23]!==i.actors.editorActor||e[24]!==u?(f=d.jsx(a6.Provider,{value:i.actors.editorActor,children:u}),e[23]=i.actors.editorActor,e[24]=u,e[25]=f):f=e[25];let h;return e[26]!==i.editor||e[27]!==f?(h=d.jsx(Net.Provider,{value:i.editor,children:f}),e[26]=i.editor,e[27]=f,e[28]=h):h=e[28],h}const Sv=()=>{const t=H.c(5),e=E.useContext(a6);let n;t[0]!==e?(n=e.getSnapshot(),t[0]=e,t[1]=n):n=t[1];const[r,i]=E.useState(n.context.selection);let o,s;return t[2]!==e?(o=()=>{const a=e.on("selection",l=>{E.startTransition(()=>{i(l.selection)})});return()=>{a.unsubscribe()}},s=[e],t[2]=e,t[3]=o,t[4]=s):(o=t[3],s=t[4]),E.useEffect(o,s),r};function ose(t){const e=H.c(4),n=H2();let r,i;return e[0]!==n||e[1]!==t.behaviors?(r=()=>{const o=t.behaviors.map(s=>n.registerBehavior({behavior:s}));return()=>{o.forEach(t3n)}},i=[n,t.behaviors],e[0]=n,e[1]=t.behaviors,e[2]=r,e[3]=i):(r=e[2],i=e[3]),E.useEffect(r,i),null}function t3n(t){t()}const n3n=vt.forwardRef((t,e)=>{const n=H.c(2),r=H2(),i=vt.useRef(r);let o,s;return n[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>i.current,s=[],n[0]=o,n[1]=s):(o=n[0],s=n[1]),vt.useImperativeHandle(e,o,s),null});n3n.displayName="EditorRefPlugin";function k2e(t){const e=H.c(4),n=H2();let r,i;return e[0]!==n||e[1]!==t.on?(r=()=>{const o=n.on("*",t.on);return()=>{o.unsubscribe()}},i=[n,t.on],e[0]=n,e[1]=t.on,e[2]=r,e[3]=i):(r=e[2],i=e[3]),E.useEffect(r,i),null}const Utt=t=>{if(!t.context.selection)return;const e=qg(t),n=i6(t);if(!e||!n)return;const r=m_({context:t.context,selectionPoint:e}),i=m_({context:t.context,selectionPoint:n});return r&&i?{start:r,end:i}:void 0},r3n=t=>{const e=$s(t),n=i6(t),r=n&&Y1(n.path[2])?n.path[2]._key:void 0;if(!e||!r)return[];let i=!1;const o=[];for(const s of e.node.children){if(s._key===r){i=!0;continue}if(!Ci(t.context,s)&&i){o.push({node:s,path:[...e.path,"children",{_key:s._key}]});break}}return o},i3n=t=>{const e=$s(t),n=qg(t),r=n&&Y1(n.path[2])?n.path[2]._key:void 0;if(!e||!r)return[];const i=[];for(const o of e.node.children){if(o._key===r)break;Ci(t.context,o)||i.push({node:o,path:[...e.path,"children",{_key:o._key}]})}return i},Wtt=t=>{if(!t.context.selection)return"";const e=Bh(t.context.selection),n=B0({...t,context:{...t.context,selection:{anchor:e,focus:e}}});if(!n)return"";const r=Nh({context:t.context,block:n});return $oe({...t,context:{...t.context,selection:{anchor:r,focus:e}}})};function o3n({context:t,blockOffset:e}){let n;for(const r of t.value)if(r._key===e.path[0]._key){n={path:[{_key:r._key}],offset:e.offset};break}return n}function eEe({context:t,blockOffset:e,direction:n}){return v8({context:t,blockOffset:e,direction:n})||o3n({context:t,blockOffset:e})}function s3n({context:t,offsets:e,backward:n}){const r=eEe({context:t,blockOffset:e.anchor,direction:n?"backward":"forward"}),i=eEe({context:t,blockOffset:e.focus,direction:n?"forward":"backward"});return!r||!i?null:{anchor:r,focus:i,backward:n}}function tEe({context:t,selectionPoint:e}){let n=0;const r=Wa(e),i=b1(e);if(!(!r||!i)){for(const o of t.value)if(o._key===r&&qn(t,o))for(const s of o.children){if(s._key===i)return{path:[{_key:o._key}],offset:n+e.offset};Ci(t,s)&&(n+=s.text.length)}}}function a3n(t,e){return!t&&!e?!0:!t||!e?!1:pd(t.anchor,e.anchor)&&pd(t.focus,e.focus)}function l3n({context:t,targetBlock:e,incomingBlock:n}){const r=b0({context:t,block:n,options:{normalize:!1,removeUnusedMarkDefs:!0,validateFields:!1}});return!r||!qn(t,r)?e:{...e,children:[...e.children,...r.children],markDefs:[...e.markDefs??[],...r.markDefs??[]]}}const c3n=[{on:"insert.break",guard:({snapshot:t})=>t.context.selection&&cm(t)?{selection:t.context.selection}:!1,actions:[(t,{selection:e})=>[Et({type:"delete",at:e})]]},{on:"insert.break",actions:[]},{on:"insert.block",guard:({event:t})=>t.placement==="before"||t.placement==="after",actions:[]},{on:"insert.block",guard:({snapshot:t,event:e})=>!$s(t)||!qn(t.context,e.block)?!1:e.placement!=="auto"||e.select!=="end",actions:[({event:t})=>[Et({type:"insert.block",block:t.block,placement:"auto",select:"end"})]]},{on:"insert.block",guard:({snapshot:t,event:e})=>$s(t)?!qn(t.context,e.block):!0,actions:[]},{on:"insert.blocks",guard:({snapshot:t,event:e})=>{const n=e.blocks.filter(r=>qn(t.context,r));return n.length===0?!1:n.reduce((r,i)=>l3n({context:t.context,targetBlock:r,incomingBlock:i}))},actions:[(t,e)=>[Et({type:"insert.block",block:e,placement:"auto"})]]},{on:"insert.blocks",actions:[]}];function E2e(){const t=H.c(3),e=H2();let n,r;return t[0]!==e?(n=()=>{const i=c3n.map(o=>e.registerBehavior({behavior:o}));return()=>{for(const o of i)o()}},r=[e],t[0]=e,t[1]=n,t[2]=r):(n=t[1],r=t[2]),E.useEffect(n,r),null}const fs=dl("mutator-document");class R5{_value;path;constructor(e,n){this._value=e,this.path=n||[]}containerType(){return Array.isArray(this._value)?"array":this._value!==null&&typeof this._value=="object"?"object":"primitive"}valueType(){return this._value===null?"null":Array.isArray(this._value)?"array":typeof this._value}get(){return this._value}length(){if(!Array.isArray(this._value))throw new Error("Won't return length of non-indexable _value");return this._value.length}getIndex(e){return Array.isArray(this._value)?e>=this.length()?null:new R5(this._value[e],this.path.concat(e)):!1}hasAttribute(e){return ZE(this._value)?this._value.hasOwnProperty(e):!1}attributeKeys(){return ZE(this._value)?Object.keys(this._value):[]}getAttribute(e){if(!ZE(this._value))throw new Error("getAttribute only applies to plain objects");return this.hasAttribute(e)?new R5(this._value[e],this.path.concat(e)):null}set(e){return e===this._value?this:new R5(e,this.path)}setIndex(e,n){if(!Array.isArray(this._value))throw new Error("setIndex only applies to arrays");if(Object.is(n,this._value[e]))return this;const r=this._value.slice();return r[e]=n,new R5(r,this.path)}setIndexAccessor(e,n){return this.setIndex(e,n.get())}unsetIndices(e){if(!Array.isArray(this._value))throw new Error("unsetIndices only applies to arrays");const n=this._value.length,r=[];for(let i=0;i{e+=d3n(n,r===0)}),e}function d3n(t,e){if(typeof t=="number")return`[${t}]`;if(sL(t)){const n=t;return Object.keys(t).map(r=>f3n(n[r])?`[${r}=="${n[r]}"]`:"").join("")}return typeof t=="string"&&u3n.test(t)?e?t:`.${t}`:`['${t}']`}function f3n(t){switch(typeof t){case"number":case"string":case"boolean":return!0;default:return!1}}function h3n(t){const[e,n]=qtt(t);if(!e)throw new Error("Head cannot be null");return m3n(e,n)}function qtt(t){if(t.type!=="path")return[t,null];const e=t.nodes;return e.length===0?[null,null]:e.length===1?[e[0],null]:[e[0],{type:"path",nodes:e.slice(1)}]}function p3n(t,e){if(!t&&!e)return null;const n=t?t.nodes:[],r=e?e.nodes:[];return{type:"path",nodes:n.concat(r)}}function m3n(t,e){return t.type!=="union"?[[t,e]]:t.nodes.map(n=>{if(n.type==="path"){const[r,i]=qtt(n);return[r,p3n(i,e)]}return[n,e]})}const g3n=/[0-9]/,JJ=/^[a-zA-Z0-9_]$/,y3n=/^[a-zA-Z_]$/,Gtt={operator:["..",".",",",":","?"],comparator:[">=","<=","<",">","==","!="],keyword:["$","@"],boolean:["true","false"],paren:["[","]"]},b3n=Object.keys(Gtt);class v3n{source;i;length;tokenizers;constructor(e){this.source=e,this.length=e.length,this.i=0,this.tokenizers=[this.tokenizeSymbol,this.tokenizeIdentifier,this.tokenizeNumber,this.tokenizeQuoted].map(n=>n.bind(this))}tokenize(){const e=[];for(;!this.EOF();){this.chompWhitespace();let n=null;if(!this.tokenizers.some(r=>(n=r(),!!n))||!n)throw new Error(`Invalid tokens in jsonpath '${this.source}' @ ${this.i}`);e.push(n)}return e}takeWhile(e){const n=this.i;let r="";for(;!this.EOF();){const i=e(this.source[this.i]);if(i===null)break;r+=i,this.i++}return this.i===n?null:r}EOF(){return this.i>=this.length}peek(){return this.EOF()?null:this.source[this.i]}consume(e){if(this.i+e.length>this.length)throw new Error(`Expected ${e} at end of jsonpath`);if(e===this.source.slice(this.i,this.i+e.length))this.i+=e.length;else throw new Error(`Expected "${e}", but source contained "${this.source.slice()}`)}tryConsume(e){if(this.i+e.length>this.length)return null;if(e===this.source.slice(this.i,this.i+e.length)){if(e[0].match(JJ)&&this.length>this.i+e.length){const n=this.source[this.i+e.length];if(n&&n.match(JJ))return null}return this.i+=e.length,e}return null}chompWhitespace(){this.takeWhile(e=>e===" "?"":null)}tokenizeQuoted(){const e=this.peek();if(e==="'"||e==='"'){this.consume(e);let n=!1;const r=this.takeWhile(i=>n?(n=!1,i):i==="\\"?(n=!0,""):i!=e?i:null);return this.consume(e),{type:"quoted",value:r,quote:e==='"'?"double":"single"}}return null}tokenizeIdentifier(){let e=!0;const n=this.takeWhile(r=>e?(e=!1,r.match(y3n)?r:null):r.match(JJ)?r:null);return n!==null?{type:"identifier",name:n}:null}tokenizeNumber(){const e=this.i;let n=!1,r=!1,i=!1;this.peek()==="-"&&(i=!0,this.consume("-"));const o=this.takeWhile(s=>s==="."&&!n&&r?(n=!0,s):(r=!0,s.match(g3n)?s:null));return o!==null?{type:"number",value:i?-Number(o):+o,raw:i?`-${o}`:o}:(this.i=e,null)}tokenizeSymbol(){for(const e of b3n){const n=Gtt[e].find(r=>this.tryConsume(r));if(n)return{type:e,symbol:n}}return null}}function x3n(t){return new v3n(t).tokenize()}class C3n{tokens;length;i;constructor(e){this.tokens=x3n(e),this.length=this.tokens.length,this.i=0}parse(){return this.parsePath()}EOF(){return this.i>=this.length}peek(){return this.EOF()?null:this.tokens[this.i]}consume(){const e=this.peek();return this.i+=1,e}probe(e){const n=this.peek();if(!n)return null;const r=n;return Object.keys(e).every(i=>i in n&&e[i]===r[i])?n:null}match(e){return this.probe(e)?this.consume():null}parseAttribute(){const e=this.match({type:"identifier"});if(e&&e.type==="identifier")return{type:"attribute",name:e.name};const n=this.match({type:"quoted",quote:"single"});return n&&n.type==="quoted"?{type:"attribute",name:n.value||""}:null}parseAlias(){return this.match({type:"keyword",symbol:"@"})||this.match({type:"keyword",symbol:"$"})?{type:"alias",target:"self"}:null}parseNumber(){const e=this.match({type:"number"});return e&&e.type==="number"?{type:"number",value:e.value}:null}parseNumberValue(){const e=this.parseNumber();return e?e.value:null}parseSliceSelector(){const e=this.i,n=this.parseNumberValue();if(!this.match({type:"operator",symbol:":"}))return n===null?(this.i=e,null):{type:"index",value:n};const r={type:"range",start:n,end:this.parseNumberValue()};return this.match({type:"operator",symbol:":"})&&(r.step=this.parseNumberValue()),r.start===null&&r.end===null?(this.i=e,null):r}parseValueReference(){return this.parseAttribute()||this.parseSliceSelector()}parseLiteralValue(){const e=this.match({type:"quoted",quote:"double"});if(e&&e.type==="quoted")return{type:"string",value:e.value||""};const n=this.match({type:"boolean"});return n&&n.type==="boolean"?{type:"boolean",value:n.symbol==="true"}:this.parseNumber()}parseFilterExpression(){const e=this.i,n=this.parseAttribute()||this.parseAlias();if(!n)return null;if(this.match({type:"operator",symbol:"?"}))return{type:"constraint",operator:"?",lhs:n};const r=this.match({type:"comparator"});if(!r||r.type!=="comparator")return this.i=e,null;const i=n,o=this.parseLiteralValue();if(!o)throw new Error(`Operator ${r.symbol} needs a literal value at the right hand side`);return{type:"constraint",operator:r.symbol,lhs:i,rhs:o}}parseExpression(){return this.parseFilterExpression()||this.parseValueReference()}parseUnion(){if(!this.match({type:"paren",symbol:"["}))return null;const e=[];let n=this.parseFilterExpression()||this.parsePath()||this.parseValueReference();for(;n&&(e.push(n),!this.match({type:"paren",symbol:"]"}));){if(!this.match({type:"operator",symbol:","}))throw new Error("Expected ]");if(n=this.parseFilterExpression()||this.parsePath()||this.parseValueReference(),!n)throw new Error("Expected expression following ','")}return{type:"union",nodes:e}}parseRecursive(){if(!this.match({type:"operator",symbol:".."}))return null;const e=this.parsePath();if(!e)throw new Error("Expected path following '..' operator");return{type:"recursive",term:e}}parsePath(){const e=[],n=this.parseAttribute()||this.parseUnion()||this.parseRecursive();if(!n)return null;for(e.push(n);!this.EOF();)if(this.match({type:"operator",symbol:"."})){const r=this.parseAttribute();if(!r)throw new Error("Expected attribute name following '.");e.push(r);continue}else if(this.probe({type:"paren",symbol:"["})){const r=this.parseUnion();if(!r)throw new Error("Expected union following '['");e.push(r)}else{const r=this.parseRecursive();r&&e.push(r);break}return e.length===1?e[0]:{type:"path",nodes:e}}}function Ytt(t){const e=new C3n(t).parse();if(!e)throw new Error(`Failed to parse JSON path "${t}"`);return e}function Ktt(t){return gC(t,!1)}function gC(t,e){switch(t.type){case"attribute":return t.name;case"alias":return t.target==="self"?"@":"$";case"number":return`${t.value}`;case"range":{const n=[];return e||n.push("["),t.start&&n.push(`${t.start}`),n.push(":"),t.end&&n.push(`${t.end}`),t.step&&n.push(`:${t.step}`),e||n.push("]"),n.join("")}case"index":return e?`${t.value}`:`[${t.value}]`;case"constraint":{const n=t.rhs?` ${gC(t.rhs,!1)}`:"",r=`${gC(t.lhs,!1)} ${t.operator}${n}`;return e?r:`[${r}]`}case"string":return JSON.stringify(t.value);case"path":{const n=[],r=t.nodes.slice();for(;r.length>0;){const i=r.shift();i&&n.push(Ktt(i));const o=r[0];o&&gC(o,!1)[0]!=="["&&n.push(".")}return n.join("")}case"union":return`[${t.nodes.map(n=>gC(n,!0)).join(",")}]`;default:throw new Error(`Unknown node type ${t.type}`);case"recursive":return`..${gC(t.term,!1)}`}}class bh{expr;constructor(e){if(!e)throw new Error("Attempted to create Expression from null-value");if("expr"in e?this.expr=e.expr:this.expr=e,!("type"in this.expr))throw new Error("Attempt to create Expression for expression with no type")}isPath(){return this.expr.type==="path"}isUnion(){return this.expr.type==="union"}isCollection(){return this.isPath()||this.isUnion()}isConstraint(){return this.expr.type==="constraint"}isRecursive(){return this.expr.type==="recursive"}isExistenceConstraint(){return this.expr.type==="constraint"&&this.expr.operator==="?"}isIndex(){return this.expr.type==="index"}isRange(){return this.expr.type==="range"}expandRange(e){const n=()=>{if(!e)throw new Error("expandRange() required a probe that was not passed");return e.length()};let r="start"in this.expr&&this.expr.start||0;r=eee(r,e);let i="end"in this.expr&&this.expr.end||n();i=eee(i,e);const o="step"in this.expr&&this.expr.step||1;return{start:r,end:i,step:o}}isAttributeReference(){return this.expr.type==="attribute"}isIndexReference(){return this.isIndex()||this.isRange()}name(){return"name"in this.expr?this.expr.name:""}isSelfReference(){return this.expr.type==="alias"&&this.expr.target==="self"}constraintTargetIsSelf(){return this.expr.type==="constraint"&&this.expr.lhs.type==="alias"&&this.expr.lhs.target==="self"}constraintTargetIsAttribute(){return this.expr.type==="constraint"&&this.expr.lhs.type==="attribute"}testConstraint(e){const n=this.expr;if(n.type==="constraint"&&n.lhs.type==="alias"&&n.lhs.target==="self"){if(e.containerType()!=="primitive")return!1;if(n.type==="constraint"&&n.operator==="?")return!0;const s=e.get(),a=n.rhs&&"value"in n.rhs?n.rhs.value:void 0;return nEe(s,n.operator,a)}if(n.type!=="constraint")return!1;const r=n.lhs;if(!r)throw new Error("No LHS of expression");if(r.type!=="attribute")throw new Error(`Constraint target ${r.type} not supported`);if(e.containerType()!=="object")return!1;const i=e.getAttribute(r.name);if(i==null||i.containerType()!=="primitive")return!1;if(this.isExistenceConstraint())return!0;const o=n.rhs&&"value"in n.rhs?n.rhs.value:void 0;return nEe(i.get(),n.operator,o)}pathNodes(){return this.expr.type==="path"?this.expr.nodes:[this.expr]}prepend(e){return e?new bh({type:"path",nodes:e.pathNodes().concat(this.pathNodes())}):this}concat(e){return e?e.prepend(this):this}descend(){return h3n(this.expr).map(e=>{const[n,r]=e;return{head:n?new bh(n):null,tail:r?new bh(r):null}})}unwrapRecursive(){if(this.expr.type!=="recursive")throw new Error(`Attempt to unwrap recursive on type ${this.expr.type}`);return new bh(this.expr.term)}toIndicies(e){if(this.expr.type!=="index"&&this.expr.type!=="range")throw new Error("Node cannot be converted to indexes");if(this.expr.type==="index")return[eee(this.expr.value,e)];const n=[],r=this.expandRange(e);let{start:i,end:o}=r;r.step<0&&([i,o]=[o,i]);for(let s=i;s":return t>n;case">=":return t>=n;case"<":return t=0)return t;if(!e)throw new Error("interpretNegativeIndex() must have a probe when < 0");return t+e.length()}class XC{head;tail;constructor(e,n){this.head=e,this.tail=n}iterate(e){let n=[this];if(this.head&&this.head.isConstraint()){let r=!0;for(;r;)n=jl(n.map(i=>i.iterateConstraints(e))),r=n.some(i=>i.head&&i.head.isConstraint())}return n}isRecursive(){return!!(this.head&&this.head.isRecursive())}hasArrived(){return this.head===null&&this.tail===null}extractRecursives(){if(this.head&&this.head.isRecursive()){const e=this.head.unwrapRecursive();return new XC(null,e.concat(this.tail)).descend()}return[]}iterateConstraints(e){const n=this.head;if(n===null||!n.isConstraint())return[this];const r=[];if(e.containerType()==="primitive"&&n.constraintTargetIsSelf())return n.testConstraint(e)&&r.push(...this.descend()),r;if(e.containerType()==="array"){const i=e.length();for(let o=0;onew XC(e.head,e.tail)):[new XC(null,null)]}toString(){const e=["<"];return this.head&&e.push(this.head.toString()),e.push("|"),this.tail&&e.push(this.tail.toString()),e.push(">"),e.join("")}}class zb{active;recursives;payload;constructor(e,n){this.active=e||[],n?(this.recursives=n.recursives,this.payload=n.payload):this.recursives=[],this.extractRecursives()}setPayload(e){return this.payload=e,this}extractRecursives(){this.active=this.active.filter(e=>e.isRecursive()?(this.recursives.push(...e.extractRecursives()),!1):!0)}activeRecursives(e){return this.recursives.filter(n=>{const r=n.head;return r?r.isConstraint()||e.containerType()==="array"&&r.isIndexReference()?!0:e.containerType()==="object"?r.isAttributeReference()&&e.hasAttribute(r.name()):!1:!1})}match(e){return this.iterate(e).extractMatches(e)}iterate(e){const n=[];return this.active.concat(this.activeRecursives(e)).forEach(r=>{n.push(...r.iterate(e))}),new zb(n,this)}isDestination(){return this.active.some(e=>e.hasArrived())}hasRecursives(){return this.recursives.length>0}extractMatches(e){const n=[],r=[];if(this.active.forEach(i=>{if(i.hasArrived()){r.push(new bh({type:"alias",target:"self"}));return}const o=i.head;if(o&&!(e.containerType()==="array"&&!o.isIndexReference())&&!(e.containerType()==="object"&&!o.isAttributeReference()))if(i.tail){const s=new zb(i.descend(),this);o.toFieldReferences().forEach(()=>{n.push({target:o,matcher:s})})}else r.push(o)}),this.hasRecursives()){const i=new zb([],this);if(e.containerType()==="array"){const o=e.length();for(let s=0;s{n.push({target:bh.attributeReference(o),matcher:i})})}return r.length>0?{leads:n,delivery:{targets:r,payload:this.payload}}:{leads:n}}static fromPath(e){const n=Ytt(e);if(!n)throw new Error(`Failed to parse path from "${e}"`);const r=new XC(null,new bh(n));return new zb(r.descend())}}class MN{_value;path;constructor(e,n){this._value=e,this.path=n||[]}containerType(){return Array.isArray(this._value)?"array":this._value!==null&&typeof this._value=="object"?"object":"primitive"}length(){if(!Array.isArray(this._value))throw new Error("Won't return length of non-indexable _value");return this._value.length}getIndex(e){return Array.isArray(this._value)?e>=this.length()?null:new MN(this._value[e],this.path.concat(e)):!1}hasAttribute(e){return sL(this._value)?this._value.hasOwnProperty(e):!1}attributeKeys(){return sL(this._value)?Object.keys(this._value):[]}getAttribute(e){if(!sL(this._value))throw new Error("getAttribute only applies to plain objects");return this.hasAttribute(e)?new MN(this._value[e],this.path.concat(e)):null}get(){return this._value}}function w3n(t,e){const n=[],r=zb.fromPath(t).setPayload(function(o){n.push(...o)}),i=new MN(e);return Xtt(r,i),n}function Xtt(t,e){const{leads:n,delivery:r}=t.match(e);n.forEach(i=>{rEe(i.target,e).forEach(o=>{Xtt(i.matcher,o)})}),r&&r.targets.forEach(i=>{typeof r.payload=="function"&&r.payload(rEe(i,e))})}function rEe(t,e){const n=[];if(t.isIndexReference())t.toIndicies(e).forEach(r=>{n.push(e.getIndex(r))});else if(t.isAttributeReference())n.push(e.getAttribute(t.name()));else if(t.isSelfReference())n.push(e);else throw new Error(`Unable to derive accessor for target ${t.toString()}`);return Cz(n)}function Kj(t,e){return w3n(t,e).map(n=>({path:n.path,value:n.get()}))}function iEe(t,e){if(typeof e!="string")return e;const[n]=_v(t,e,{allowExceedingIndices:!0});return n}class _3n{path;dmpPatch;id;constructor(e,n,r){this.id=e,this.path=n,this.dmpPatch=BS(r)}apply(e,n){let r=n;if(r.containerType()==="primitive")return r;for(const i of e){if(i.isIndexReference()){for(const o of i.toIndicies(n)){const s=r.getIndex(o);if(!s)continue;const a=s.get(),l=iEe(this.dmpPatch,a);r=r.setIndex(o,l)}continue}if(i.isAttributeReference()&&r.hasAttribute(i.name())){const o=r.getAttribute(i.name());if(!o)continue;const s=o.get(),a=iEe(this.dmpPatch,s);r=r.setAttribute(i.name(),a);continue}throw new Error(`Unable to apply diffMatchPatch to target ${i.toString()}`)}return r}}function oEe(t,e){return typeof t!="number"||!Number.isFinite(t)?t:t+e}class sEe{path;value;id;constructor(e,n,r){this.path=n,this.value=r,this.id=e}apply(e,n){let r=n;if(r.containerType()==="primitive")return r;for(const i of e){if(i.isIndexReference()){for(const o of i.toIndicies(n)){const s=r.getIndex(o);if(!s)continue;const a=s.get();r=r.setIndex(o,oEe(a,this.value))}continue}if(i.isAttributeReference()){const o=r.getAttribute(i.name());if(!o)continue;const s=o.get();r=r.setAttribute(i.name(),oEe(s,this.value));continue}throw new Error(`Unable to apply to target ${i.toString()}`)}return r}}function LH(t,e){const n=[];return t.forEach(r=>{r.isIndexReference()&&n.push(...r.toIndicies(e))}),n.sort((r,i)=>r-i)}class S3n{location;path;items;id;constructor(e,n,r,i){this.id=e,this.location=n,this.path=r,this.items=i}apply(e,n){let r=n;if(n.containerType()!=="array"){const i=n.valueType();throw new Error(`Attempt to apply insert patch to value of type "${i}" at path "${n.path.join(" → ")}"`)}switch(this.location){case"before":{const i=k3n(e,n);r=r.insertItemsAt(i,this.items);break}case"after":{const i=E3n(e,n);r=r.insertItemsAt(i+1,this.items);break}case"replace":{const i=LH(e,n);r=r.unsetIndices(i),r=r.insertItemsAt(i[0],this.items);break}default:throw new Error(`Unsupported location atm: ${this.location}`)}return r}}function k3n(t,e){let n=xMt(LH(t,e))||0;return t.forEach(r=>{if(r.isRange()){const{start:i}=r.expandRange();i{if(r.isRange()){const{end:i}=r.expandRange();i>n&&(n=i)}}),n}class Ztt{id;path;value;constructor(e,n,r){this.id=e,this.path=n,this.value=r}apply(e,n){let r=n;return e.forEach(i=>{if(!i.isIndexReference())if(i.isAttributeReference())r.containerType()==="primitive"?r=r.set({[i.name()]:this.value}):r.hasAttribute(i.name())||(r=n.setAttribute(i.name(),this.value));else throw new Error(`Unable to apply to target ${i.toString()}`)}),r}}class Qtt{id;path;value;constructor(e,n,r){this.id=e,this.path=n,this.value=r}apply(e,n){let r=n;return e.forEach(i=>{if(i.isSelfReference())r=r.set(this.value);else if(i.isIndexReference())i.toIndicies(n).forEach(o=>{r=r.setIndex(o,this.value)});else if(i.isAttributeReference())r.containerType()==="primitive"?r=r.set({[i.name()]:this.value}):r=r.setAttribute(i.name(),this.value);else throw new Error(`Unable to apply to target ${i.toString()}`)}),r}}class T3n{id;path;value;constructor(e,n){this.id=e,this.path=n}apply(e,n){let r=n;switch(n.containerType()){case"array":r=r.unsetIndices(LH(e,n));break;case"object":e.forEach(i=>{r=r.unsetAttribute(i.name())});break;default:throw new Error("Target value is neither indexable or an object. This error should potentially just be silently ignored?")}return r}}function Jtt(t){const e=[];if(Array.isArray(t))return t.reduce((c,u)=>c.concat(Jtt(u)),e);const{set:n,setIfMissing:r,unset:i,diffMatchPatch:o,inc:s,dec:a,insert:l}=t;if(r&&Object.keys(r).forEach(c=>{e.push(new Ztt(t.id,c,r[c]))}),n&&Object.keys(n).forEach(c=>{e.push(new Qtt(t.id,c,n[c]))}),i&&i.forEach(c=>{e.push(new T3n(t.id,c))}),o&&Object.keys(o).forEach(c=>{e.push(new _3n(t.id,c,o[c]))}),s&&Object.keys(s).forEach(c=>{e.push(new sEe(t.id,c,s[c]))}),a&&Object.keys(a).forEach(c=>{e.push(new sEe(t.id,c,-a[c]))}),l){let c,u;const f=l;if("before"in f)c="before",u=f.before;else if("after"in f)c="after",u=f.after;else if("replace"in f)c="replace",u=f.replace;else throw new Error("Invalid insert patch");e.push(new S3n(t.id,c,u,f.items))}return e}let I3n=class{patches;constructor(e){this.patches=Jtt(e)}apply(e){const n=new R5(e);return this.applyViaAccessor(n).get()}applyViaAccessor(e){let n=e;const r=e.getAttribute("_id");if(!r)throw new Error("Cannot apply patch to document with no _id");const i=r.get();for(const o of this.patches){if(o.id!==i)continue;const s=zb.fromPath(o.path).setPayload(o);n=sse(s,n)}return n}};function sse(t,e){const n=t.payload instanceof Qtt||t.payload instanceof Ztt;let r=e;const{leads:i,delivery:o}=t.match(e);return i.forEach(s=>{if(s.target.isIndexReference())s.target.toIndicies().forEach(a=>{const l=r.getIndex(a);if(!l)throw new Error("Index out of bounds");r=r.setIndexAccessor(a,sse(s.matcher,l))});else if(s.target.isAttributeReference()){n&&r.containerType()==="primitive"&&(r=r.set({}));let a=r.getAttribute(s.target.name());if(!a&&n&&(r=r.setAttribute(s.target.name(),{}),a=r.getAttribute(s.target.name())),!a)return;const l=sse(s.matcher,a);a!==l&&(r=r.setAttributeAccessor(s.target.name(),l))}else throw new Error(`Unable to handle target ${s.target.toString()}`)}),o&&j3n(o.payload)&&(r=o.payload.apply(o.targets,r)),r}function j3n(t){return!!(t&&typeof t=="object"&&t!==null&&"apply"in t&&typeof t.apply=="function")}const A3n=ac;class dg{params;compiled;_appliesToMissingDocument;constructor(e){this.params=e}get transactionId(){return this.params.transactionId}get transition(){return this.params.transition}get identity(){return this.params.identity}get previousRev(){return this.params.previousRev}get resultRev(){return this.params.resultRev}get mutations(){return this.params.mutations}get timestamp(){if(typeof this.params.timestamp=="string")return new Date(this.params.timestamp)}get effects(){return this.params.effects}assignRandomTransactionId(){this.params.transactionId=A3n(),this.params.resultRev=this.params.transactionId}appliesToMissingDocument(){if(typeof this._appliesToMissingDocument<"u")return this._appliesToMissingDocument;const e=this.mutations[0];return e?this._appliesToMissingDocument=!!(e.create||e.createIfNotExists||e.createOrReplace):this._appliesToMissingDocument=!0,this._appliesToMissingDocument}compile(){const e=[],n=o=>o?._createdAt||this.params.timestamp||new Date().toISOString();this.mutations.forEach(o=>{if(o.create){const s=o.create||{};e.push(a=>a||Object.assign(s,{_createdAt:n(s)}));return}if(o.createIfNotExists){const s=o.createIfNotExists||{};e.push(a=>a===null?Object.assign(s,{_createdAt:n(s)}):a);return}if(o.createOrReplace){const s=o.createOrReplace||{};e.push(()=>Object.assign(s,{_createdAt:n(s)}));return}if(o.delete){e.push(()=>null);return}if(o.patch){if("query"in o.patch)return;const s=new I3n(o.patch);e.push(a=>s.apply(a));return}throw new Error(`Unsupported mutation ${JSON.stringify(o,null,2)}`)}),typeof this.params.timestamp=="string"&&e.push(o=>o?Object.assign(o,{_updatedAt:this.params.timestamp}):null);const r=this.previousRev,i=this.resultRev||this.transactionId;this.compiled=o=>{if(r&&o&&r!==o._rev)throw new Error(`Previous revision for this mutation was ${r}, but the document revision is ${o._rev}`);let s=o;for(const a of e)s=a(s);return s&&i&&(s===o&&(s=Object.assign({},o)),s._rev=i),s}}apply(e){fs("Applying mutation %O to document %O",this.mutations,e),this.compiled||this.compile();const n=this.compiled(e);return fs(" => %O",n),n}static applyAll(e,n){return n.reduce((r,i)=>i.apply(r),e)}static squash(e,n){const r=n.reduce((i,o)=>i.concat(...o.mutations),[]);return new dg({mutations:r})}}let R3n=class{incoming=[];submitted=[];pending=[];HEAD;EDGE;onRebase;onMutation;onConsistencyChanged;onRemoteMutation;inconsistentAt=null;lastStagedAt=null;constructor(e){this.reset(e),this.HEAD=e,this.EDGE=e}reset(e){this.incoming=[],this.submitted=[],this.pending=[],this.inconsistentAt=null,this.HEAD=e,this.EDGE=e,this.considerIncoming(),this.updateConsistencyFlag()}arrive(e){this.incoming.push(e),this.considerIncoming(),this.updateConsistencyFlag()}stage(e,n){if(!e.transactionId)throw new Error("Mutations _must_ have transactionId when submitted");this.lastStagedAt=new Date,fs("Staging mutation %s (pushed to pending)",e.transactionId),this.pending.push(e),this.EDGE=e.apply(this.EDGE),this.onMutation&&!n&&this.onMutation({mutation:e,document:this.EDGE,remote:!1});const r=e.transactionId;return this.updateConsistencyFlag(),{success:()=>{this.pendingSuccessfullySubmitted(r),this.updateConsistencyFlag()},failure:()=>{this.pendingFailed(r),this.updateConsistencyFlag()}}}isConsistent(){return!this.inconsistentAt}considerIncoming(){let e=!1,n;const r=[];if(this.HEAD&&this.HEAD._updatedAt){const o=new Date(this.HEAD._updatedAt);this.incoming.find(s=>s.timestamp&&s.timestamps.timestamp&&s.timestamps.previousRev===o._rev):void 0}else n=this.incoming.find(o=>o.appliesToMissingDocument());if(n){const o=this.applyIncoming(n);if(e=e||o,e&&r.push(n),i++>10)throw new Error(`Mutator stuck flushing incoming mutations. Probably stuck here: ${JSON.stringify(n)}`)}}while(n);this.incoming.length>0&&fs.enabled&&fs("Unable to apply mutations %s",this.incoming.map(o=>o.transactionId).join(", ")),e&&this.rebase(r)}updateConsistencyFlag(){const e=this.isConsistent(),n=this.pending.length===0&&this.submitted.length===0&&this.incoming.length===0;n?this.inconsistentAt=null:this.inconsistentAt||(this.inconsistentAt=new Date),e!=n&&this.onConsistencyChanged&&(fs(n?"Buffered document is inconsistent":"Buffered document is consistent"),this.onConsistencyChanged(n))}applyIncoming(e){if(!e)return!1;if(!e.transactionId)throw new Error("Received incoming mutation without a transaction ID");if(fs("Applying mutation %s -> %s to rev %s",e.previousRev,e.resultRev,this.HEAD&&this.HEAD._rev),this.HEAD=e.apply(this.HEAD),this.onRemoteMutation&&this.onRemoteMutation(e),this.incoming=this.incoming.filter(n=>n.transactionId!==e.transactionId),this.hasUnresolvedMutations()){const n=this.consumeUnresolved(e.transactionId);return fs.enabled&&(fs(`Incoming mutation ${e.transactionId} appeared while there were pending or submitted local mutations`),fs(`Submitted txnIds: ${this.submitted.map(r=>r.transactionId).join(", ")}`),fs(`Pending txnIds: ${this.pending.map(r=>r.transactionId).join(", ")}`),fs("needRebase === %s",n)),n}return fs("Remote mutation %s arrived w/o any pending or submitted local mutations",e.transactionId),this.EDGE=this.HEAD,this.onMutation&&this.onMutation({mutation:e,document:this.EDGE,remote:!0}),!1}hasUnresolvedMutations(){return this.submitted.length>0||this.pending.length>0}consumeUnresolved(e){if(this.submitted.length===0&&this.pending.length===0)return!1;if(this.submitted.length!==0){if(this.submitted[0].transactionId===e)return fs("Remote mutation %s matches upcoming submitted mutation, consumed from 'submitted' buffer",e),this.submitted.shift(),!1}else if(this.pending.length>0&&this.pending[0].transactionId===e)return fs("Remote mutation %s matches upcoming pending mutation, consumed from 'pending' buffer",e),this.pending.shift(),!1;return fs("The mutation was not the upcoming mutation, scrubbing. Pending: %d, Submitted: %d",this.pending.length,this.submitted.length),this.submitted=this.submitted.filter(n=>n.transactionId!==e),this.pending=this.pending.filter(n=>n.transactionId!==e),fs("After scrubbing: Pending: %d, Submitted: %d",this.pending.length,this.submitted.length),!0}pendingSuccessfullySubmitted(e){if(this.pending.length===0)return;const n=this.pending[0];if(n.transactionId===e){this.pending.shift(),this.submitted.push(n);return}let r;const i=[];this.pending.forEach(o=>{if(o.transactionId===e){r=o;return}i.push(o)}),r&&this.submitted.push(r),this.pending=i,this.rebase([])}pendingFailed(e){this.pending=this.pending.filter(n=>n.transactionId!==e),this.rebase([])}rebase(e){const n=this.EDGE;this.EDGE=dg.applyAll(this.HEAD,this.submitted.concat(this.pending)),n!==null&&this.EDGE!==null&&(n._rev=this.EDGE._rev),!Mo(this.EDGE,n)&&this.onRebase&&this.onRebase(this.EDGE,e,this.pending)}};class r${BASIS;PRESTAGE;setOperations;documentPresent;out=[];staged;constructor(e){e?fs("Reset mutation buffer to rev %s",e._rev):fs("Reset mutation buffer state to document being deleted"),this.staged=[],this.setOperations={},this.documentPresent=!1,this.BASIS=e,this.PRESTAGE=e}add(e){e.mutations.forEach(n=>this.addOperation(n))}hasChanges(){return this.out.length>0||Object.keys(this.setOperations).length>0}purge(e){this.stashStagedOperations();let n=null;return this.out.length>0&&(fs("Purged mutation buffer"),n=new dg({mutations:this.out,resultRev:e,transactionId:e})),this.out=[],this.documentPresent=!1,n}addOperation(e){if(e.patch&&e.patch.set&&"id"in e.patch&&e.patch.id===this.PRESTAGE?._id&&Object.keys(e.patch).length===2){const n=e.patch.set,r={};for(const i of Object.keys(n))n.hasOwnProperty(i)&&(this.optimiseSetOperation(i,n[i])||(r[i]=n[i]));Object.keys(r).length>0&&(fs("Unoptimizable set-operation detected, purging optimization buffer"),this.staged.push({patch:{id:this.PRESTAGE._id,set:r}}),this.stashStagedOperations());return}if(e.createIfNotExists&&this.PRESTAGE&&e.createIfNotExists._id===this.PRESTAGE._id){this.documentPresent||(this.staged.push(e),this.documentPresent=!0,this.stashStagedOperations());return}fs("Unoptimizable mutation detected, purging optimization buffer"),this.staged.push(e),this.stashStagedOperations()}optimiseSetOperation(e,n){if(typeof n=="object")return!1;const r=Kj(e,this.PRESTAGE);if(r.length!==1)return!1;const i=r[0];if(typeof i.value=="object"||!this.PRESTAGE)return!1;let o=null;if(i.value===n)o=null;else if(typeof i.value=="string"&&typeof n=="string")try{const a=r2e(EH(i.value,n));o={patch:{id:this.PRESTAGE._id,diffMatchPatch:{[e]:a}}}}catch{return!1}else o={patch:{id:this.PRESTAGE._id,set:{[e]:n}}};const s=T2e(i.path);return o?this.setOperations[s]=o:delete this.setOperations[s],!0}stashStagedOperations(){const e=[];Object.keys(this.setOperations).forEach(n=>{const r=this.setOperations[n];r&&e.push(r)}),e.push(...this.staged),e.length>0&&(this.PRESTAGE=new dg({mutations:e}).apply(this.PRESTAGE),this.staged=[],this.setOperations={}),this.out.push(...e)}rebase(e){return this.stashStagedOperations(),e===null?(this.out=[],this.BASIS=e,this.PRESTAGE=e,this.documentPresent=!1):(this.BASIS=e,this.out?this.PRESTAGE=new dg({mutations:this.out}).apply(this.BASIS):this.PRESTAGE=this.BASIS),this.PRESTAGE}}const D3n=1e3*60;class O3n{mutations;tries;resolve;reject;constructor(e,{resolve:n,reject:r}){this.mutations=e,this.tries=0,this.resolve=n,this.reject=r}apply(e){return dg.applyAll(e,this.mutations)}squash(e){const n=dg.squash(e,this.mutations);return n.assignRandomTransactionId(),n}}const aEe=(t,e)=>t.concat(e.mutations);class P3n{mutations;document;LOCAL;commits;buffer;onMutation;onRemoteMutation;onRebase;onDelete;onConsistencyChanged;commitHandler;committerRunning=!1;constructor(e){this.buffer=new r$(e),this.document=new R3n(e),this.document.onMutation=n=>this.handleDocMutation(n),this.document.onRemoteMutation=n=>this.onRemoteMutation&&this.onRemoteMutation(n),this.document.onRebase=(n,r,i)=>this.handleDocRebase(n,r,i),this.document.onConsistencyChanged=n=>this.handleDocConsistencyChanged(n),this.LOCAL=e,this.mutations=[],this.commits=[]}reset(e){e?fs("Document state reset to revision %s",e._rev):fs("Document state reset to being deleted"),this.document.reset(e),this.rebase([],[]),this.handleDocConsistencyChanged(this.document.isConsistent())}add(e){this.onConsistencyChanged&&this.onConsistencyChanged(!1),fs("Staged local mutation"),this.buffer.add(e);const n=this.LOCAL;this.LOCAL=e.apply(this.LOCAL),this.onMutation&&n!==this.LOCAL&&(fs("onMutation fired"),this.onMutation({mutation:e,document:this.LOCAL,remote:!1}),this.LOCAL===null&&this.onDelete&&this.onDelete(this.LOCAL))}arrive(e){if(fs("Remote mutation arrived %s -> %s",e.previousRev,e.resultRev),e.previousRev===e.resultRev)throw new Error(`Mutation ${e.transactionId} has previousRev === resultRev (${e.previousRev})`);return this.document.arrive(e)}commit(){return new Promise((e,n)=>{if(!this.buffer.hasChanges()){e();return}fs("Committing local changes");const r=this.buffer.purge();this.commits.push(new O3n(r?[r]:[],{resolve:e,reject:n})),this.buffer=new r$(this.LOCAL),this.performCommits()})}performCommits(){if(!this.commitHandler)throw new Error("No commitHandler configured for this BufferedDocument");this.committerRunning||this._cycleCommitter()}_cycleCommitter(){const e=this.commits.shift();if(!e){this.committerRunning=!1;return}this.committerRunning=!0;const n=e.squash(this.LOCAL),r=this.document.stage(n,!0),i={success:()=>{fs("Commit succeeded"),r.success(),e.resolve(),this._cycleCommitter()},failure:()=>{fs("Commit failed"),e.tries+=1,this.LOCAL!==null&&this.commits.unshift(e),r.failure(),e.tries<200&&setTimeout(()=>this._cycleCommitter(),Math.min(e.tries*1e3,D3n))},cancel:o=>{this.commits.forEach(s=>s.reject(o)),this.commits=[],this.reset(this.document.HEAD),this.buffer=new r$(this.LOCAL),this.committerRunning=!1}};fs("Posting commit"),this.commitHandler&&this.commitHandler({mutation:n,success:i.success,failure:i.failure,cancel:i.cancel})}handleDocRebase(e,n,r){this.rebase(n,r)}handleDocumentDeleted(){fs("Document deleted"),this.LOCAL!==null&&this.onDelete&&this.onDelete(this.LOCAL),this.commits=[],this.mutations=[]}handleDocMutation(e){if(this.commits.length===0&&!this.buffer.hasChanges()){fs("Document mutated from remote with no local changes"),this.LOCAL=this.document.EDGE,this.buffer=new r$(this.LOCAL),this.onMutation&&this.onMutation(e);return}fs("Document mutated from remote with local changes"),this.document.EDGE===null&&this.handleDocumentDeleted(),this.rebase([e.mutation],[])}rebase(e,n){fs("Rebasing document"),this.document.EDGE===null&&this.handleDocumentDeleted();const r=this.LOCAL;this.LOCAL=this.commits.reduce((i,o)=>o.apply(i),this.document.EDGE),this.LOCAL=this.buffer.rebase(this.LOCAL),r!==null&&this.LOCAL!==null&&(r._rev=this.LOCAL._rev),!Mo(this.LOCAL,r)&&this.onRebase&&this.onRebase(this.LOCAL,e.reduce(aEe,[]),n.reduce(aEe,[]))}handleDocConsistencyChanged(e){if(!this.onConsistencyChanged)return;const n=this.commits.length>0||this.buffer.hasChanges();e&&!n&&this.onConsistencyChanged(!0),e||this.onConsistencyChanged(!1)}}const Xi=t=>typeof t=="string",QE=()=>{let t,e;const n=new Promise((r,i)=>{t=r,e=i});return n.resolve=t,n.reject=e,n},lEe=t=>t==null?"":""+t,$3n=(t,e,n)=>{t.forEach(r=>{e[r]&&(n[r]=e[r])})},M3n=/###/g,cEe=t=>t&&t.indexOf("###")>-1?t.replace(M3n,"."):t,uEe=t=>!t||Xi(t),FI=(t,e,n)=>{const r=Xi(e)?e.split("."):e;let i=0;for(;i{const{obj:r,k:i}=FI(t,e,Object);if(r!==void 0||e.length===1){r[i]=n;return}let o=e[e.length-1],s=e.slice(0,e.length-1),a=FI(t,s,Object);for(;a.obj===void 0&&s.length;)o=`${s[s.length-1]}.${o}`,s=s.slice(0,s.length-1),a=FI(t,s,Object),a&&a.obj&&typeof a.obj[`${a.k}.${o}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${o}`]=n},L3n=(t,e,n,r)=>{const{obj:i,k:o}=FI(t,e,Object);i[o]=i[o]||[],i[o].push(n)},LN=(t,e)=>{const{obj:n,k:r}=FI(t,e);if(n)return n[r]},F3n=(t,e,n)=>{const r=LN(t,n);return r!==void 0?r:LN(e,n)},ent=(t,e,n)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?Xi(t[r])||t[r]instanceof String||Xi(e[r])||e[r]instanceof String?n&&(t[r]=e[r]):ent(t[r],e[r],n):t[r]=e[r]);return t},Xx=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var N3n={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const B3n=t=>Xi(t)?t.replace(/[&<>"'\/]/g,e=>N3n[e]):t;class V3n{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}const z3n=[" ",",","?","!",";"],H3n=new V3n(20),U3n=(t,e,n)=>{e=e||"",n=n||"";const r=z3n.filter(s=>e.indexOf(s)<0&&n.indexOf(s)<0);if(r.length===0)return!0;const i=H3n.getRegExp(`(${r.map(s=>s==="?"?"\\?":s).join("|")})`);let o=!i.test(t);if(!o){const s=t.indexOf(n);s>0&&!i.test(t.substring(0,s))&&(o=!0)}return o},ase=function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!t)return;if(t[e])return t[e];const r=e.split(n);let i=t;for(let o=0;o-1&&lt&&t.replace("_","-"),W3n={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console&&console[t]&&console[t].apply(console,e)}};class NN{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(e,n)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=e||W3n,this.options=n,this.debug=n.debug}log(){for(var e=arguments.length,n=new Array(e),r=0;r{this.observers[r]||(this.observers[r]=new Map);const i=this.observers[r].get(n)||0;this.observers[r].set(n,i+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}emit(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{let[a,l]=s;for(let c=0;c{let[a,l]=s;for(let c=0;c1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,s=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,n],r&&(Array.isArray(r)?a.push(...r):Xi(r)&&o?a.push(...r.split(o)):a.push(r)));const l=LN(this.data,a);return!l&&!n&&!r&&e.indexOf(".")>-1&&(e=a[0],n=a[1],r=a.slice(2).join(".")),l||!s||!Xi(r)?l:ase(this.data&&this.data[e]&&this.data[e][n],r,o)}addResource(e,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const s=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let a=[e,n];r&&(a=a.concat(s?r.split(s):r)),e.indexOf(".")>-1&&(a=e.split("."),i=n,n=a[1]),this.addNamespaces(n),dEe(this.data,a,i),o.silent||this.emit("added",e,n,r,i)}addResources(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(Xi(r[o])||Array.isArray(r[o]))&&this.addResource(e,n,o,r[o],{silent:!0});i.silent||this.emit("added",e,n,r)}addResourceBundle(e,n,r,i,o){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},a=[e,n];e.indexOf(".")>-1&&(a=e.split("."),i=r,r=n,n=a[1]),this.addNamespaces(n);let l=LN(this.data,a)||{};s.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?ent(l,r,o):l={...l,...r},dEe(this.data,a,l),s.silent||this.emit("added",e,n,r)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(e,n)}:this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var tnt={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,r,i){return t.forEach(o=>{this.processors[o]&&(e=this.processors[o].process(e,n,r,i))}),e}};const hEe={};class BN extends FH{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),$3n(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=J5.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(e==null)return!1;const r=this.resolve(e,n);return r&&r.res!==void 0}extractFromKey(e,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const s=r&&e.indexOf(r)>-1,a=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!U3n(e,r,i);if(s&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:Xi(o)?[o]:o};const c=e.split(r);(r!==i||r===i&&this.options.ns.indexOf(c[0])>-1)&&(o=c.shift()),e=c.join(i)}return{key:e,namespaces:Xi(o)?[o]:o}}translate(e,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),e==null)return"";Array.isArray(e)||(e=[String(e)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:s,namespaces:a}=this.extractFromKey(e[e.length-1],n),l=a[a.length-1],c=n.lng||this.language,u=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(c&&c.toLowerCase()==="cimode"){if(u){const C=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${C}${s}`,usedKey:s,exactUsedKey:s,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${C}${s}`}return i?{res:s,usedKey:s,exactUsedKey:s,usedLng:c,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:s}const f=this.resolve(e,n);let h=f&&f.res;const p=f&&f.usedKey||s,m=f&&f.exactUsedKey||s,g=Object.prototype.toString.apply(h),y=["[object Number]","[object Function]","[object RegExp]"],b=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,x=!Xi(h)&&typeof h!="boolean"&&typeof h!="number";if(v&&h&&x&&y.indexOf(g)<0&&!(Xi(b)&&Array.isArray(h))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const C=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,h,{...n,ns:a}):`key '${s} (${this.language})' returned an object instead of string.`;return i?(f.res=C,f.usedParams=this.getUsedParamsDetails(n),f):C}if(o){const C=Array.isArray(h),w=C?[]:{},_=C?m:p;for(const S in h)if(Object.prototype.hasOwnProperty.call(h,S)){const k=`${_}${o}${S}`;w[S]=this.translate(k,{...n,joinArrays:!1,ns:a}),w[S]===k&&(w[S]=h[S])}h=w}}else if(v&&Xi(b)&&Array.isArray(h))h=h.join(b),h&&(h=this.extendTranslation(h,e,n,r));else{let C=!1,w=!1;const _=n.count!==void 0&&!Xi(n.count),S=BN.hasDefaultValue(n),k=_?this.pluralResolver.getSuffix(c,n.count,n):"",I=n.ordinal&&_?this.pluralResolver.getSuffix(c,n.count,{ordinal:!1}):"",j=_&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),A=j&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${k}`]||n[`defaultValue${I}`]||n.defaultValue;!this.isValidLookup(h)&&S&&(C=!0,h=A),this.isValidLookup(h)||(w=!0,h=s);const O=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&w?void 0:h,P=S&&A!==h&&this.options.updateMissing;if(w||C||P){if(this.logger.log(P?"updateKey":"missingKey",c,l,s,P?A:h),o){const B=this.resolve(s,{...n,keySeparator:!1});B&&B.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let $=[];const M=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&M&&M[0])for(let B=0;B{const V=S&&N!==h?N:O;this.options.missingKeyHandler?this.options.missingKeyHandler(B,l,W,V,P,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(B,l,W,V,P,n),this.emit("missingKey",B,l,W,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&_?$.forEach(B=>{const W=this.pluralResolver.getSuffixes(B,n);j&&n[`defaultValue${this.options.pluralSeparator}zero`]&&W.indexOf(`${this.options.pluralSeparator}zero`)<0&&W.push(`${this.options.pluralSeparator}zero`),W.forEach(N=>{L([B],s+N,n[`defaultValue${N}`]||A)})}):L($,s,A))}h=this.extendTranslation(h,e,n,f,r),w&&h===s&&this.options.appendNamespaceToMissingKey&&(h=`${l}:${s}`),(w||C)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?h=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${s}`:s,C?h:void 0):h=this.options.parseMissingKeyHandler(h))}return i?(f.res=h,f.usedParams=this.getUsedParamsDetails(n),f):h}extendTranslation(e,n,r,i,o){var s=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const c=Xi(e)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(c){const h=e.match(this.interpolator.nestingRegexp);u=h&&h.length}let f=r.replace&&!Xi(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),e=this.interpolator.interpolate(e,f,r.lng||this.language||i.usedLng,r),c){const h=e.match(this.interpolator.nestingRegexp),p=h&&h.length;u1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,s,a;return Xi(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(r))return;const c=this.extractFromKey(l,n),u=c.key;i=u;let f=c.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const h=n.count!==void 0&&!Xi(n.count),p=h&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),m=n.context!==void 0&&(Xi(n.context)||typeof n.context=="number")&&n.context!=="",g=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(y=>{this.isValidLookup(r)||(a=y,!hEe[`${g[0]}-${y}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(a)&&(hEe[`${g[0]}-${y}`]=!0,this.logger.warn(`key "${i}" for languages "${g.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(b=>{if(this.isValidLookup(r))return;s=b;const v=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,u,b,y,n);else{let C;h&&(C=this.pluralResolver.getSuffix(b,n.count,n));const w=`${this.options.pluralSeparator}zero`,_=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(v.push(u+C),n.ordinal&&C.indexOf(_)===0&&v.push(u+C.replace(_,this.options.pluralSeparator)),p&&v.push(u+w)),m){const S=`${u}${this.options.contextSeparator}${n.context}`;v.push(S),h&&(v.push(S+C),n.ordinal&&C.indexOf(_)===0&&v.push(S+C.replace(_,this.options.pluralSeparator)),p&&v.push(S+w))}}let x;for(;x=v.pop();)this.isValidLookup(r)||(o=x,r=this.getResource(b,y,x,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:s,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,n,r,i):this.resourceStore.getResource(e,n,r,i)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!Xi(e.replace);let i=r?e.replace:e;if(r&&typeof e.count<"u"&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const o of n)delete i[o]}return i}static hasDefaultValue(e){const n="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n===r.substring(0,n.length)&&e[r]!==void 0)return!0;return!1}}const tee=t=>t.charAt(0).toUpperCase()+t.slice(1);class pEe{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=J5.create("languageUtils")}getScriptPartFromCode(e){if(e=FN(e),!e||e.indexOf("-")<0)return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=FN(e),!e||e.indexOf("-")<0)return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(Xi(e)&&e.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let i=Intl.getCanonicalLocales(e)[0];if(i&&this.options.lowerCaseLng&&(i=i.toLowerCase()),i)return i}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=e.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=tee(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=tee(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=tee(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&e.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&(o.indexOf("-")>0&&i.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===i||o.indexOf(i)===0&&i.length>1))return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),Xi(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let r=e[n];return r||(r=e[this.getScriptPartFromCode(n)]),r||(r=e[this.formatLanguageCode(n)]),r||(r=e[this.getLanguagePartFromCode(n)]),r||(r=e.default),r||[]}toResolveHierarchy(e,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],e),i=[],o=s=>{s&&(this.isSupportedCode(s)?i.push(s):this.logger.warn(`rejecting language code not found in supportedLngs: ${s}`))};return Xi(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(e))):Xi(e)&&o(this.formatLanguageCode(e)),r.forEach(s=>{i.indexOf(s)<0&&o(this.formatLanguageCode(s))}),i}}let q3n=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],G3n={1:t=>+(t>1),2:t=>+(t!=1),3:t=>0,4:t=>t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2,5:t=>t==0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5,6:t=>t==1?0:t>=2&&t<=4?1:2,7:t=>t==1?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2,8:t=>t==1?0:t==2?1:t!=8&&t!=11?2:3,9:t=>+(t>=2),10:t=>t==1?0:t==2?1:t<7?2:t<11?3:4,11:t=>t==1||t==11?0:t==2||t==12?1:t>2&&t<20?2:3,12:t=>+(t%10!=1||t%100==11),13:t=>+(t!==0),14:t=>t==1?0:t==2?1:t==3?2:3,15:t=>t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2,16:t=>t%10==1&&t%100!=11?0:t!==0?1:2,17:t=>t==1||t%10==1&&t%100!=11?0:1,18:t=>t==0?0:t==1?1:2,19:t=>t==1?0:t==0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3,20:t=>t==1?0:t==0||t%100>0&&t%100<20?1:2,21:t=>t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0,22:t=>t==1?0:t==2?1:(t<0||t>10)&&t%10==0?2:3};const Y3n=["v1","v2","v3"],K3n=["v4"],mEe={zero:0,one:1,two:2,few:3,many:4,other:5},X3n=()=>{const t={};return q3n.forEach(e=>{e.lngs.forEach(n=>{t[n]={numbers:e.nr,plurals:G3n[e.fc]}})}),t};class Z3n{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=e,this.options=n,this.logger=J5.create("pluralResolver"),(!this.options.compatibilityJSON||K3n.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=X3n(),this.pluralRulesCache={}}addRule(e,n){this.rules[e]=n}clearCache(){this.pluralRulesCache={}}getRule(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi()){const r=FN(e==="dev"?"en":e),i=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:i});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let s;try{s=new Intl.PluralRules(r,{type:i})}catch{if(!e.match(/-|_/))return;const l=this.languageUtils.getLanguagePartFromCode(e);s=this.getRule(l,n)}return this.pluralRulesCache[o]=s,s}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(e,r).map(i=>`${n}${i}`)}getSuffixes(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,o)=>mEe[i]-mEe[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(e,i,n)):[]}getSuffix(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(e,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,n){const r=e.noAbs?e.plurals(n):e.plurals(Math.abs(n));let i=e.numbers[r];this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const o=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&e.numbers.length===2&&e.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!Y3n.includes(this.options.compatibilityJSON)}}const gEe=function(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=F3n(t,e,n);return!o&&i&&Xi(n)&&(o=ase(t,n,r),o===void 0&&(o=ase(e,n,r))),o},nee=t=>t.replace(/\$/g,"$$$$");class Q3n{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=J5.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(n=>n),this.init(e)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:i,prefix:o,prefixEscaped:s,suffix:a,suffixEscaped:l,formatSeparator:c,unescapeSuffix:u,unescapePrefix:f,nestingPrefix:h,nestingPrefixEscaped:p,nestingSuffix:m,nestingSuffixEscaped:g,nestingOptionsSeparator:y,maxReplaces:b,alwaysFormat:v}=e.interpolation;this.escape=n!==void 0?n:B3n,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=o?Xx(o):s||"{{",this.suffix=a?Xx(a):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=u?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=h?Xx(h):p||Xx("$t("),this.nestingSuffix=m?Xx(m):g||Xx(")"),this.nestingOptionsSeparator=y||",",this.maxReplaces=b||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,n,r,i){let o,s,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=p=>{if(p.indexOf(this.formatSeparator)<0){const b=gEe(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(b,void 0,r,{...i,...n,interpolationkey:p}):b}const m=p.split(this.formatSeparator),g=m.shift().trim(),y=m.join(this.formatSeparator).trim();return this.format(gEe(n,l,g,this.options.keySeparator,this.options.ignoreJSONStructure),y,r,{...i,...n,interpolationkey:g})};this.resetRegExp();const u=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>nee(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?nee(this.escape(p)):nee(p)}].forEach(p=>{for(a=0;o=p.regex.exec(e);){const m=o[1].trim();if(s=c(m),s===void 0)if(typeof u=="function"){const y=u(e,o,i);s=Xi(y)?y:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))s="";else if(f){s=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`),s="";else!Xi(s)&&!this.useRawValueToEscape&&(s=lEe(s));const g=p.safeValue(s);if(e=e.replace(o[0],g),f?(p.regex.lastIndex+=s.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,s;const a=(l,c)=>{const u=this.nestingOptionsSeparator;if(l.indexOf(u)<0)return l;const f=l.split(new RegExp(`${u}[ ]*{`));let h=`{${f[1]}`;l=f[0],h=this.interpolate(h,s);const p=h.match(/'/g),m=h.match(/"/g);(p&&p.length%2===0&&!m||m.length%2!==0)&&(h=h.replace(/'/g,'"'));try{s=JSON.parse(h),c&&(s={...c,...s})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,g),`${l}${u}${h}`}return s.defaultValue&&s.defaultValue.indexOf(this.prefix)>-1&&delete s.defaultValue,l};for(;i=this.nestingRegexp.exec(e);){let l=[];s={...r},s=s.replace&&!Xi(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let c=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const u=i[1].split(this.formatSeparator).map(f=>f.trim());i[1]=u.shift(),l=u,c=!0}if(o=n(a.call(this,i[1].trim(),s),s),o&&i[0]===e&&!Xi(o))return o;Xi(o)||(o=lEe(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),o=""),c&&(o=l.reduce((u,f)=>this.format(u,f,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),e=e.replace(i[0],o),this.regexp.lastIndex=0}return e}}const J3n=t=>{let e=t.toLowerCase().trim();const n={};if(t.indexOf("(")>-1){const r=t.split("(");e=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);e==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):e==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(s=>{if(s){const[a,...l]=s.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),u=a.trim();n[u]||(n[u]=c),c==="false"&&(n[u]=!1),c==="true"&&(n[u]=!0),isNaN(c)||(n[u]=parseInt(c,10))}})}return{formatName:e,formatOptions:n}},Zx=t=>{const e={};return(n,r,i)=>{let o=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(o={...o,[i.interpolationkey]:void 0});const s=r+JSON.stringify(o);let a=e[s];return a||(a=t(FN(r),i),e[s]=a),a(n)}};class e7n{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=J5.create("formatter"),this.options=e,this.formats={number:Zx((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:Zx((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:Zx((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:Zx((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:Zx((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(e)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=Zx(n)}format(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(a=>a.indexOf(")")>-1)){const a=o.findIndex(l=>l.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,a)].join(this.formatSeparator)}return o.reduce((a,l)=>{const{formatName:c,formatOptions:u}=J3n(l);if(this.formats[c]){let f=a;try{const h=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},p=h.locale||h.lng||i.locale||i.lng||r;f=this.formats[c](a,p,{...u,...i,...h})}catch(h){this.logger.warn(h)}return f}else this.logger.warn(`there was no format function for ${c}`);return a},e)}}const t7n=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};let n7n=class extends FH{constructor(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=e,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=J5.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(e,n,r,i){const o={},s={},a={},l={};return e.forEach(c=>{let u=!0;n.forEach(f=>{const h=`${c}|${f}`;!r.reload&&this.store.hasResourceBundle(c,f)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?s[h]===void 0&&(s[h]=!0):(this.state[h]=1,u=!1,s[h]===void 0&&(s[h]=!0),o[h]===void 0&&(o[h]=!0),l[f]===void 0&&(l[f]=!0)))}),u||(a[c]=!0)}),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,n,r){const i=e.split("|"),o=i[0],s=i[1];n&&this.emit("failedLoading",o,s,n),!n&&r&&this.store.addResourceBundle(o,s,r,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&r&&(this.state[e]=0);const a={};this.queue.forEach(l=>{L3n(l.loaded,[o],s),t7n(l,e),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{a[c]||(a[c]={});const u=l.loaded[c];u.length&&u.forEach(f=>{a[c][f]===void 0&&(a[c][f]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;if(!e.length)return s(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:r,tried:i,wait:o,callback:s});return}this.readingCalls++;const a=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(c&&u&&i{this.read.call(this,e,n,r,i+1,o*2,s)},o);return}s(c,u)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const c=l(e,n);c&&typeof c.then=="function"?c.then(u=>a(null,u)).catch(a):a(null,c)}catch(c){a(c)}return}return l(e,n,a)}prepareLoading(e,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();Xi(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Xi(n)&&(n=[n]);const o=this.queueLoad(e,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(s=>{this.loadOne(s)})}load(e,n,r){this.prepareLoading(e,n,{},r)}reload(e,n,r){this.prepareLoading(e,n,{reload:!0},r)}loadOne(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(s,a)=>{s&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,s),!s&&a&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,a),this.loaded(e,s,a)})}saveMissing(e,n,r,i,o){let s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...s,isUpdate:o},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,n,r,i,l):u=c(e,n,r,i),u&&typeof u.then=="function"?u.then(f=>a(null,f)).catch(a):a(null,u)}catch(u){a(u)}else c(e,n,r,i,a,l)}!e||!e[0]||this.store.addResource(e[0],n,r,i)}}};const yEe=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),Xi(t[1])&&(e.defaultValue=t[1]),Xi(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(r=>{e[r]=n[r]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),bEe=t=>(Xi(t.ns)&&(t.ns=[t.ns]),Xi(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),Xi(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t),i$=()=>{},r7n=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class Xj extends FH{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=bEe(e),this.services={},this.logger=J5,this.modules={external:[]},r7n(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(){var e=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(Xi(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=yEe();this.options={...i,...this.options,...bEe(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const o=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?J5.init(o(this.modules.logger),this.options):J5.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=e7n);const f=new pEe(this.options);this.store=new fEe(this.options.resources,this.options);const h=this.services;h.logger=J5,h.resourceStore=this.store,h.languageUtils=f,h.pluralResolver=new Z3n(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(h.formatter=o(u),h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new Q3n(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new n7n(o(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",function(p){for(var m=arguments.length,g=new Array(m>1?m-1:0),y=1;y1?m-1:0),y=1;y{p.init&&p.init(this)})}if(this.format=this.options.interpolation.format,r||(r=i$),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=function(){return e.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return e.store[u](...arguments),e}});const l=QE(),c=()=>{const u=(f,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(h),r(f,h)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initImmediate?c():setTimeout(c,0),l}loadResources(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i$;const i=Xi(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const o=[],s=a=>{if(!a||a==="cimode")return;this.services.languageUtils.toResolveHierarchy(a).forEach(c=>{c!=="cimode"&&o.indexOf(c)<0&&o.push(c)})};i?s(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>s(l)),this.options.preload&&this.options.preload.forEach(a=>s(a)),this.services.backendConnector.load(o,this.options.ns,a=>{!a&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(a)})}else r(null)}reloadResources(e,n,r){const i=QE();return typeof e=="function"&&(r=e,e=void 0),typeof n=="function"&&(r=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),r||(r=i$),this.services.backendConnector.reload(e,n,o=>{i.resolve(),r(o)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&tnt.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(e,n){var r=this;this.isLanguageChangingTo=e;const i=QE();this.emit("languageChanging",e);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},s=(l,c)=>{c?(o(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},a=l=>{!e&&!l&&this.services.languageDetector&&(l=[]);const c=Xi(l)?l:this.services.languageUtils.getBestMatchFromCodes(l);c&&(this.language||o(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(c)),this.loadResources(c,u=>{s(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),i}getFixedT(e,n,r){var i=this;const o=function(s,a){let l;if(typeof a!="object"){for(var c=arguments.length,u=new Array(c>2?c-2:0),f=2;f`${l.keyPrefix}${h}${m}`):p=l.keyPrefix?`${l.keyPrefix}${h}${s}`:s,i.t(p,l)};return Xi(e)?o.lng=e:o.lngs=e,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const s=(a,l)=>{const c=this.services.backendConnector.state[`${a}|${l}`];return c===-1||c===0||c===2};if(n.precheck){const a=n.precheck(this,s);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||s(r,e)&&(!i||s(o,e)))}loadNamespaces(e,n){const r=QE();return this.options.ns?(Xi(e)&&(e=[e]),e.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(e,n){const r=QE();Xi(e)&&(e=[e]);const i=this.options.preload||[],o=e.filter(s=>i.indexOf(s)<0&&this.services.languageUtils.isSupportedCode(s));return o.length?(this.options.preload=i.concat(o),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new pEe(yEe());return n.indexOf(r.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Xj(e,n)}cloneInstance(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i$;const r=e.forkResourceStore;r&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},o=new Xj(i);return(e.debug!==void 0||e.prefix!==void 0)&&(o.logger=o.logger.clone(e)),["store","services","language"].forEach(a=>{o[a]=this[a]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new fEe(this.store.data,i),o.services.resourceStore=o.store),o.translator=new BN(o.services,i),o.translator.on("*",function(a){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;u{k.key==="Escape"&&f&&a()},e[0]=f,e[1]=a,e[2]=p):p=e[2],Vc(p);let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=()=>[h.current],e[3]=m):m=e[3],ho(f&&a,m);let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g={minWidth:280,maxWidth:350},e[4]=g):g=e[4];let y;e[5]!==s?(y=d.jsx(me,{flex:1,overflow:"auto",padding:4,children:d.jsx(oe,{size:1,children:s})}),e[5]=s,e[6]=y):y=e[6];let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b={borderTop:"1px solid var(--card-border-color)"},e[7]=b):b=e[7];let v;e[8]!==r||e[9]!==u?(v=r||u("common.dialog.cancel-button.text"),e[8]=r,e[9]=u,e[10]=v):v=e[10];let x;e[11]!==n||e[12]!==a||e[13]!==v?(x=d.jsx(vn,{"data-testid":"confirm-popover-cancel-button",icon:n,onClick:a,mode:"ghost",padding:2,text:v,size:1}),e[11]=n,e[12]=a,e[13]=v,e[14]=x):x=e[14];let C;e[15]!==o||e[16]!==u?(C=o||u("common.dialog.confirm-button.text"),e[15]=o,e[16]=u,e[17]=C):C=e[17];let w;e[18]!==i||e[19]!==l||e[20]!==C||e[21]!==c?(w=d.jsx(vn,{"data-testid":"confirm-popover-confirm-button",icon:i,onClick:l,padding:2,text:C,tone:c,size:1}),e[18]=i,e[19]=l,e[20]=C,e[21]=c,e[22]=w):w=e[22];let _;e[23]!==x||e[24]!==w?(_=d.jsx(me,{paddingX:4,paddingY:3,style:b,children:d.jsxs(zo,{columns:2,gap:2,children:[x,w]})}),e[23]=x,e[24]=w,e[25]=_):_=e[25];let S;return e[26]!==_||e[27]!==y?(S=d.jsxs(ge,{direction:"column",ref:h,style:g,children:[y,_]}),e[26]=_,e[27]=y,e[28]=S):S=e[28],S}const eD=t=>{const e=H.c(8),{tooltipProps:n}=t;let r;e[0]!==t?(r=d.jsx(gde,{...t,fontSize:1,padding:3}),e[0]=t,e[1]=r):r=e[1];const i=r;if(n){const o=n?.content;let s;e[2]!==i?(s=d.jsx("div",{children:i}),e[2]=i,e[3]=s):s=e[3];let a;return e[4]!==o||e[5]!==s||e[6]!==n?(a=d.jsx(Kn,{content:o,portal:!0,...n,children:s}),e[4]=o,e[5]=s,e[6]=n,e[7]=a):a=e[7],a}return i};var hb={},JE={};var vEe;function o7n(){if(vEe)return JE;vEe=1;var t=Rg(),e=ZV();function n(Q){var ne="https://react.dev/errors/"+Q;if(1>>16)&65535)<<16)&4294967295,We=We<<15|We>>>17,We=461845907*(We&65535)+((461845907*(We>>>16)&65535)<<16)&4294967295,Pe^=We,Pe=Pe<<13|Pe>>>19,Pe=5*(Pe&65535)+((5*(Pe>>>16)&65535)<<16)&4294967295,Pe=(Pe&65535)+27492+(((Pe>>>16)+58964&65535)<<16)}switch(We=0,he){case 3:We^=(Q.charCodeAt(ne+2)&255)<<16;case 2:We^=(Q.charCodeAt(ne+1)&255)<<8;case 1:We^=Q.charCodeAt(ne)&255,We=3432918353*(We&65535)+((3432918353*(We>>>16)&65535)<<16)&4294967295,We=We<<15|We>>>17,Pe^=461845907*(We&65535)+((461845907*(We>>>16)&65535)<<16)&4294967295}return Pe^=Q.length,Pe^=Pe>>>16,Pe=2246822507*(Pe&65535)+((2246822507*(Pe>>>16)&65535)<<16)&4294967295,Pe^=Pe>>>13,Pe=3266489909*(Pe&65535)+((3266489909*(Pe>>>16)&65535)<<16)&4294967295,(Pe^Pe>>>16)>>>0}var k=Object.assign,I=Object.prototype.hasOwnProperty,j=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),A={},D={};function O(Q){return I.call(D,Q)?!0:I.call(A,Q)?!1:j.test(Q)?D[Q]=!0:(A[Q]=!0,!1)}var P=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" ")),$=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),M=/["'&<>]/;function L(Q){if(typeof Q=="boolean"||typeof Q=="number"||typeof Q=="bigint")return""+Q;Q=""+Q;var ne=M.exec(Q);if(ne){var he="",ke,Pe=0;for(ke=ne.index;keQ.insertionMode)return ae(3,null,ke,null);break;case"html":if(Q.insertionMode===0)return ae(1,null,ke,null)}return 6<=Q.insertionMode||2>Q.insertionMode?ae(2,null,ke,null):Q.tagScope!==ke?ae(Q.insertionMode,Q.selectedValue,ke,null):Q}function le(Q){return Q===null?null:{update:Q.update,enter:"none",exit:"none",share:Q.update,name:Q.autoName,autoName:Q.autoName,nameIdx:0}}function pe(Q,ne){return ne.tagScope&32&&(Q.instructions|=128),ae(ne.insertionMode,ne.selectedValue,ne.tagScope|12,le(ne.viewTransition))}function be(Q,ne){Q=le(ne.viewTransition);var he=ne.tagScope|16;return Q!==null&&Q.share!=="none"&&(he|=64),ae(ne.insertionMode,ne.selectedValue,he,Q)}var xe=new Map;function Ce(Q,ne){if(typeof ne!="object")throw Error(n(62));var he=!0,ke;for(ke in ne)if(I.call(ne,ke)){var Pe=ne[ke];if(Pe!=null&&typeof Pe!="boolean"&&Pe!==""){if(ke.indexOf("--")===0){var We=L(ke);Pe=L((""+Pe).trim())}else We=xe.get(ke),We===void 0&&(We=L(ke.replace(B,"-$1").toLowerCase().replace(W,"-ms-")),xe.set(ke,We)),Pe=typeof Pe=="number"?Pe===0||P.has(ke)?""+Pe:Pe+"px":L((""+Pe).trim());he?(he=!1,Q.push(' style="',We,":",Pe)):Q.push(";",We,":",Pe)}}he||Q.push('"')}function Te(Q,ne,he){he&&typeof he!="function"&&typeof he!="symbol"&&Q.push(" ",ne,'=""')}function _e(Q,ne,he){typeof he!="function"&&typeof he!="symbol"&&typeof he!="boolean"&&Q.push(" ",ne,'="',L(he),'"')}var Ie=L("javascript:throw new Error('React form unexpectedly submitted.')");function ye(Q,ne){this.push('")}function fe(Q){if(typeof Q!="string")throw Error(n(480))}function ve(Q,ne){if(typeof ne.$$FORM_ACTION=="function"){var he=Q.nextFormID++;Q=Q.idPrefix+he;try{var ke=ne.$$FORM_ACTION(Q);if(ke){var Pe=ke.data;Pe?.forEach(fe)}return ke}catch(We){if(typeof We=="object"&&We!==null&&typeof We.then=="function")throw We}}return null}function Se(Q,ne,he,ke,Pe,We,it,Vt){var _t=null;if(typeof ke=="function"){var Ht=ve(ne,ke);Ht!==null?(Vt=Ht.name,ke=Ht.action||"",Pe=Ht.encType,We=Ht.method,it=Ht.target,_t=Ht.data):(Q.push(" ","formAction",'="',Ie,'"'),it=We=Pe=ke=Vt=null,Fe(ne,he))}return Vt!=null&&Ee(Q,"name",Vt),ke!=null&&Ee(Q,"formAction",ke),Pe!=null&&Ee(Q,"formEncType",Pe),We!=null&&Ee(Q,"formMethod",We),it!=null&&Ee(Q,"formTarget",it),_t}function Ee(Q,ne,he){switch(ne){case"className":_e(Q,"class",he);break;case"tabIndex":_e(Q,"tabindex",he);break;case"dir":case"role":case"viewBox":case"width":case"height":_e(Q,ne,he);break;case"style":Ce(Q,he);break;case"src":case"href":if(he==="")break;case"action":case"formAction":if(he==null||typeof he=="function"||typeof he=="symbol"||typeof he=="boolean")break;he=V(""+he),Q.push(" ",ne,'="',L(he),'"');break;case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":case"ref":break;case"autoFocus":case"multiple":case"muted":Te(Q,ne.toLowerCase(),he);break;case"xlinkHref":if(typeof he=="function"||typeof he=="symbol"||typeof he=="boolean")break;he=V(""+he),Q.push(" ","xlink:href",'="',L(he),'"');break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":typeof he!="function"&&typeof he!="symbol"&&Q.push(" ",ne,'="',L(he),'"');break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":he&&typeof he!="function"&&typeof he!="symbol"&&Q.push(" ",ne,'=""');break;case"capture":case"download":he===!0?Q.push(" ",ne,'=""'):he!==!1&&typeof he!="function"&&typeof he!="symbol"&&Q.push(" ",ne,'="',L(he),'"');break;case"cols":case"rows":case"size":case"span":typeof he!="function"&&typeof he!="symbol"&&!isNaN(he)&&1<=he&&Q.push(" ",ne,'="',L(he),'"');break;case"rowSpan":case"start":typeof he=="function"||typeof he=="symbol"||isNaN(he)||Q.push(" ",ne,'="',L(he),'"');break;case"xlinkActuate":_e(Q,"xlink:actuate",he);break;case"xlinkArcrole":_e(Q,"xlink:arcrole",he);break;case"xlinkRole":_e(Q,"xlink:role",he);break;case"xlinkShow":_e(Q,"xlink:show",he);break;case"xlinkTitle":_e(Q,"xlink:title",he);break;case"xlinkType":_e(Q,"xlink:type",he);break;case"xmlBase":_e(Q,"xml:base",he);break;case"xmlLang":_e(Q,"xml:lang",he);break;case"xmlSpace":_e(Q,"xml:space",he);break;default:if((!(2",`addEventListener("submit",function(a){if(!a.defaultPrevented){var c=a.target,d=a.submitter,e=c.action,b=d;if(d){var f=d.getAttribute("formAction");null!=f&&(e=f,b=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===e&&(a.preventDefault(),b?(a=document.createElement("input"),a.name=b.name,a.value=b.value,b.parentNode.insertBefore(a,b),b=new FormData(c),a.parentNode.removeChild(a)):b=new FormData(c),a=c.ownerDocument||c,(a.$$reactFormReplay=a.$$reactFormReplay||[]).push(c,d,b))}});`,"<\/script>")):ke.unshift(ne.startInlineScript,">",`addEventListener("submit",function(a){if(!a.defaultPrevented){var c=a.target,d=a.submitter,e=c.action,b=d;if(d){var f=d.getAttribute("formAction");null!=f&&(e=f,b=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===e&&(a.preventDefault(),b?(a=document.createElement("input"),a.name=b.name,a.value=b.value,b.parentNode.insertBefore(a,b),b=new FormData(c),a.parentNode.removeChild(a)):b=new FormData(c),a=c.ownerDocument||c,(a.$$reactFormReplay=a.$$reactFormReplay||[]).push(c,d,b))}});`,"<\/script>")}}function $e(Q,ne){Q.push(ot("link"));for(var he in ne)if(I.call(ne,he)){var ke=ne[he];if(ke!=null)switch(he){case"children":case"dangerouslySetInnerHTML":throw Error(n(399,"link"));default:Ee(Q,he,ke)}}return Q.push("/>"),null}var Ye=/(<\/|<)(s)(tyle)/gi;function qe(Q,ne,he,ke){return""+ne+(he==="s"?"\\73 ":"\\53 ")+ke}function He(Q,ne,he){Q.push(ot(he));for(var ke in ne)if(I.call(ne,ke)){var Pe=ne[ke];if(Pe!=null)switch(ke){case"children":case"dangerouslySetInnerHTML":throw Error(n(399,he));default:Ee(Q,ke,Pe)}}return Q.push("/>"),null}function Ge(Q,ne){Q.push(ot("title"));var he=null,ke=null,Pe;for(Pe in ne)if(I.call(ne,Pe)){var We=ne[Pe];if(We!=null)switch(Pe){case"children":he=We;break;case"dangerouslySetInnerHTML":ke=We;break;default:Ee(Q,Pe,We)}}return Q.push(">"),ne=Array.isArray(he)?2>he.length?he[0]:null:he,typeof ne!="function"&&typeof ne!="symbol"&&ne!==null&&ne!==void 0&&Q.push(L(""+ne)),je(Q,ke,he),Q.push(mt("title")),null}function Ze(Q,ne){Q.push(ot("script"));var he=null,ke=null,Pe;for(Pe in ne)if(I.call(ne,Pe)){var We=ne[Pe];if(We!=null)switch(Pe){case"children":he=We;break;case"dangerouslySetInnerHTML":ke=We;break;default:Ee(Q,Pe,We)}}return Q.push(">"),je(Q,ke,he),typeof he=="string"&&Q.push((""+he).replace(q,re)),Q.push(mt("script")),null}function nt(Q,ne,he){Q.push(ot(he));var ke=he=null,Pe;for(Pe in ne)if(I.call(ne,Pe)){var We=ne[Pe];if(We!=null)switch(Pe){case"children":he=We;break;case"dangerouslySetInnerHTML":ke=We;break;default:Ee(Q,Pe,We)}}return Q.push(">"),je(Q,ke,he),he}function Le(Q,ne,he){Q.push(ot(he));var ke=he=null,Pe;for(Pe in ne)if(I.call(ne,Pe)){var We=ne[Pe];if(We!=null)switch(Pe){case"children":he=We;break;case"dangerouslySetInnerHTML":ke=We;break;default:Ee(Q,Pe,We)}}return Q.push(">"),je(Q,ke,he),typeof he=="string"?(Q.push(L(he)),null):he}var Ne=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,tt=new Map;function ot(Q){var ne=tt.get(Q);if(ne===void 0){if(!Ne.test(Q))throw Error(n(65,Q));ne="<"+Q,tt.set(Q,ne)}return ne}function rt(Q,ne,he,ke,Pe,We,it,Vt,_t){switch(ne){case"div":case"span":case"svg":case"path":break;case"a":Q.push(ot("a"));var Ht=null,cn=null,Qt;for(Qt in he)if(I.call(he,Qt)){var Nn=he[Qt];if(Nn!=null)switch(Qt){case"children":Ht=Nn;break;case"dangerouslySetInnerHTML":cn=Nn;break;case"href":Nn===""?_e(Q,"href",""):Ee(Q,Qt,Nn);break;default:Ee(Q,Qt,Nn)}}if(Q.push(">"),je(Q,cn,Ht),typeof Ht=="string"){Q.push(L(Ht));var Er=null}else Er=Ht;return Er;case"g":case"p":case"li":break;case"select":Q.push(ot("select"));var Ji=null,Fi=null,Mi;for(Mi in he)if(I.call(he,Mi)){var Ii=he[Mi];if(Ii!=null)switch(Mi){case"children":Ji=Ii;break;case"dangerouslySetInnerHTML":Fi=Ii;break;case"defaultValue":case"value":break;default:Ee(Q,Mi,Ii)}}return Q.push(">"),je(Q,Fi,Ji),Ji;case"option":var Hi=Vt.selectedValue;Q.push(ot("option"));var ys=null,Fa=null,Ao=null,Ro=null,Uo;for(Uo in he)if(I.call(he,Uo)){var la=he[Uo];if(la!=null)switch(Uo){case"children":ys=la;break;case"selected":Ao=la;break;case"dangerouslySetInnerHTML":Ro=la;break;case"value":Fa=la;default:Ee(Q,Uo,la)}}if(Hi!=null){var No=Fa!==null?""+Fa:Me(ys);if(_(Hi)){for(var Pl=0;Pl"),je(Q,Ro,ys),ys;case"textarea":Q.push(ot("textarea"));var bs=null,tl=null,Ca=null,ca;for(ca in he)if(I.call(he,ca)){var vu=he[ca];if(vu!=null)switch(ca){case"children":Ca=vu;break;case"value":bs=vu;break;case"defaultValue":tl=vu;break;case"dangerouslySetInnerHTML":throw Error(n(91));default:Ee(Q,ca,vu)}}if(bs===null&&tl!==null&&(bs=tl),Q.push(">"),Ca!=null){if(bs!=null)throw Error(n(92));if(_(Ca)){if(1"),Cu?.forEach(ye,Q),null;case"button":Q.push(ot("button"));var qd=null,Fy=null,l3=null,Ny=null,By=null,Ml=null,ua=null,Ki;for(Ki in he)if(I.call(he,Ki)){var Gc=he[Ki];if(Gc!=null)switch(Ki){case"children":qd=Gc;break;case"dangerouslySetInnerHTML":Fy=Gc;break;case"name":l3=Gc;break;case"formAction":Ny=Gc;break;case"formEncType":By=Gc;break;case"formMethod":Ml=Gc;break;case"formTarget":ua=Gc;break;default:Ee(Q,Ki,Gc)}}var Tc=Se(Q,ke,Pe,Ny,By,Ml,ua,l3);if(Q.push(">"),Tc?.forEach(ye,Q),je(Q,Fy,qd),typeof qd=="string"){Q.push(L(qd));var n5=null}else n5=qd;return n5;case"form":Q.push(ot("form"));var rd=null,Vy=null,Gd=null,e2=null,T1=null,lp=null,Z2;for(Z2 in he)if(I.call(he,Z2)){var ff=he[Z2];if(ff!=null)switch(Z2){case"children":rd=ff;break;case"dangerouslySetInnerHTML":Vy=ff;break;case"action":Gd=ff;break;case"encType":e2=ff;break;case"method":T1=ff;break;case"target":lp=ff;break;default:Ee(Q,Z2,ff)}}var Q2=null,Bs=null;if(typeof Gd=="function"){var id=ve(ke,Gd);id!==null?(Gd=id.action||"",e2=id.encType,T1=id.method,lp=id.target,Q2=id.data,Bs=id.name):(Q.push(" ","action",'="',Ie,'"'),lp=T1=e2=Gd=null,Fe(ke,Pe))}if(Gd!=null&&Ee(Q,"action",Gd),e2!=null&&Ee(Q,"encType",e2),T1!=null&&Ee(Q,"method",T1),lp!=null&&Ee(Q,"target",lp),Q.push(">"),Bs!==null&&(Q.push('"),Q2?.forEach(ye,Q)),je(Q,Vy,rd),typeof rd=="string"){Q.push(L(rd));var Id=null}else Id=rd;return Id;case"menuitem":Q.push(ot("menuitem"));for(var t2 in he)if(I.call(he,t2)){var r5=he[t2];if(r5!=null)switch(t2){case"children":case"dangerouslySetInnerHTML":throw Error(n(400));default:Ee(Q,t2,r5)}}return Q.push(">"),null;case"object":Q.push(ot("object"));var Yc=null,hf=null,Yd;for(Yd in he)if(I.call(he,Yd)){var js=he[Yd];if(js!=null)switch(Yd){case"children":Yc=js;break;case"dangerouslySetInnerHTML":hf=js;break;case"data":var Xl=V(""+js);if(Xl==="")break;Q.push(" ","data",'="',L(Xl),'"');break;default:Ee(Q,Yd,js)}}if(Q.push(">"),je(Q,hf,Yc),typeof Yc=="string"){Q.push(L(Yc));var Em=null}else Em=Yc;return Em;case"title":var wu=Vt.tagScope&1,$6=Vt.tagScope&4;if(Vt.insertionMode===4||wu||he.itemProp!=null)var c3=Ge(Q,he);else $6?c3=null:(Ge(Pe.hoistableChunks,he),c3=void 0);return c3;case"link":var Na=Vt.tagScope&1,zy=Vt.tagScope&4,i5=he.rel,Kd=he.href,J2=he.precedence;if(Vt.insertionMode===4||Na||he.itemProp!=null||typeof i5!="string"||typeof Kd!="string"||Kd===""){$e(Q,he);var Xd=null}else if(he.rel==="stylesheet")if(typeof J2!="string"||he.disabled!=null||he.onLoad||he.onError)Xd=$e(Q,he);else{var xl=Pe.styles.get(J2),o5=ke.styleResources.hasOwnProperty(Kd)?ke.styleResources[Kd]:void 0;if(o5!==null){ke.styleResources[Kd]=null,xl||(xl={precedence:L(J2),rules:[],hrefs:[],sheets:new Map},Pe.styles.set(J2,xl));var Tm={state:0,props:k({},he,{"data-precedence":he.precedence,precedence:null})};if(o5){o5.length===2&&Pn(Tm.props,o5);var Hy=Pe.preloads.stylesheets.get(Kd);Hy&&0"),Xd=null}else he.onLoad||he.onError?Xd=$e(Q,he):(_t&&Q.push(""),Xd=zy?null:$e(Pe.hoistableChunks,he));return Xd;case"script":var eh=Vt.tagScope&1,s5=he.async;if(typeof he.src!="string"||!he.src||!s5||typeof s5=="function"||typeof s5=="symbol"||he.onLoad||he.onError||Vt.insertionMode===4||eh||he.itemProp!=null)var a5=Ze(Q,he);else{var Cl=he.src;if(he.type==="module")var th=ke.moduleScriptResources,cp=Pe.preloads.moduleScripts;else th=ke.scriptResources,cp=Pe.preloads.scripts;var nh=th.hasOwnProperty(Cl)?th[Cl]:void 0;if(nh!==null){th[Cl]=null;var up=he;if(nh){nh.length===2&&(up=k({},he),Pn(up,nh));var d3=cp.get(Cl);d3&&(d3.length=0)}var l5=[];Pe.scripts.add(l5),Ze(l5,up)}_t&&Q.push(""),a5=null}return a5;case"style":var pf=Vt.tagScope&1,od=he.precedence,jd=he.href,Uy=he.nonce;if(Vt.insertionMode===4||pf||he.itemProp!=null||typeof od!="string"||typeof jd!="string"||jd===""){Q.push(ot("style"));var Zd=null,Im=null,I1;for(I1 in he)if(I.call(he,I1)){var mf=he[I1];if(mf!=null)switch(I1){case"children":Zd=mf;break;case"dangerouslySetInnerHTML":Im=mf;break;default:Ee(Q,I1,mf)}}Q.push(">");var j1=Array.isArray(Zd)?2>Zd.length?Zd[0]:null:Zd;typeof j1!="function"&&typeof j1!="symbol"&&j1!==null&&j1!==void 0&&Q.push((""+j1).replace(Ye,qe)),je(Q,Im,Zd),Q.push(mt("style"));var jm=null}else{var sd=Pe.styles.get(od);if((ke.styleResources.hasOwnProperty(jd)?ke.styleResources[jd]:void 0)!==null){ke.styleResources[jd]=null,sd||(sd={precedence:L(od),rules:[],hrefs:[],sheets:new Map},Pe.styles.set(od,sd));var Wy=Pe.nonce.style;if(!Wy||Wy===Uy){sd.hrefs.push(L(jd));var n2=sd.rules,gf=null,Am=null,Ad;for(Ad in he)if(I.call(he,Ad)){var _u=he[Ad];if(_u!=null)switch(Ad){case"children":gf=_u;break;case"dangerouslySetInnerHTML":Am=_u}}var A1=Array.isArray(gf)?2>gf.length?gf[0]:null:gf;typeof A1!="function"&&typeof A1!="symbol"&&A1!==null&&A1!==void 0&&n2.push((""+A1).replace(Ye,qe)),je(n2,Am,gf)}}sd&&it&&it.styles.add(sd),_t&&Q.push(""),jm=void 0}return jm;case"meta":var Rd=Vt.tagScope&1,c5=Vt.tagScope&4;if(Vt.insertionMode===4||Rd||he.itemProp!=null)var Rm=He(Q,he,"meta");else _t&&Q.push(""),Rm=c5?null:typeof he.charSet=="string"?He(Pe.charsetChunks,he,"meta"):he.name==="viewport"?He(Pe.viewportChunks,he,"meta"):He(Pe.hoistableChunks,he,"meta");return Rm;case"listing":case"pre":Q.push(ot(ne));var r2=null,X=null,J;for(J in he)if(I.call(he,J)){var ue=he[J];if(ue!=null)switch(J){case"children":r2=ue;break;case"dangerouslySetInnerHTML":X=ue;break;default:Ee(Q,J,ue)}}if(Q.push(">"),X!=null){if(r2!=null)throw Error(n(60));if(typeof X!="object"||!("__html"in X))throw Error(n(61));var we=X.__html;we!=null&&(typeof we=="string"&&0Pe.highImagePreloads.size)&&(Tt.delete(ct),Pe.highImagePreloads.add(Lt));else if(!ke.imageResources.hasOwnProperty(ct)){ke.imageResources[ct]=ee;var Wt=he.crossOrigin,Tn=typeof Wt=="string"?Wt==="use-credentials"?Wt:"":void 0,jn=Pe.headers,Wr;jn&&0jn.highImagePreloads.length)&&(Wr=er(Ve,"image",{imageSrcSet:he.srcSet,imageSizes:he.sizes,crossOrigin:Tn,integrity:he.integrity,nonce:he.nonce,type:he.type,fetchPriority:he.fetchPriority,referrerPolicy:he.refererPolicy}),0<=(jn.remainingCapacity-=Wr.length+2))?(Pe.resets.image[ct]=ee,jn.highImagePreloads&&(jn.highImagePreloads+=", "),jn.highImagePreloads+=Wr):(Lt=[],$e(Lt,{rel:"preload",as:"image",href:Qe?void 0:Ve,imageSrcSet:Qe,imageSizes:kt,crossOrigin:Tn,integrity:he.integrity,type:he.type,fetchPriority:he.fetchPriority,referrerPolicy:he.referrerPolicy}),he.fetchPriority==="high"||10>Pe.highImagePreloads.size?Pe.highImagePreloads.add(Lt):(Pe.bulkPreloads.add(Lt),Tt.set(ct,Lt)))}}return He(Q,he,"img");case"base":case"area":case"br":case"col":case"embed":case"hr":case"keygen":case"param":case"source":case"track":case"wbr":return He(Q,he,ne);case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":break;case"head":if(2>Vt.insertionMode){var Ui=We||Pe.preamble;if(Ui.headChunks)throw Error(n(545,"``"));We!==null&&Q.push(""),Ui.headChunks=[];var Li=nt(Ui.headChunks,he,"head")}else Li=Le(Q,he,"head");return Li;case"body":if(2>Vt.insertionMode){var pr=We||Pe.preamble;if(pr.bodyChunks)throw Error(n(545,"``"));We!==null&&Q.push(""),pr.bodyChunks=[];var qr=nt(pr.bodyChunks,he,"body")}else qr=Le(Q,he,"body");return qr;case"html":if(Vt.insertionMode===0){var Do=We||Pe.preamble;if(Do.htmlChunks)throw Error(n(545,"``"));We!==null&&Q.push(""),Do.htmlChunks=[""];var Kc=nt(Do.htmlChunks,he,"html")}else Kc=Le(Q,he,"html");return Kc;default:if(ne.indexOf("-")!==-1){Q.push(ot(ne));var Xc=null,oi=null,hc;for(hc in he)if(I.call(he,hc)){var da=he[hc];if(da!=null){var Zl=hc;switch(hc){case"children":Xc=da;break;case"dangerouslySetInnerHTML":oi=da;break;case"style":Ce(Q,da);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"ref":break;case"className":Zl="class";default:if(O(hc)&&typeof da!="function"&&typeof da!="symbol"&&da!==!1){if(da===!0)da="";else if(typeof da=="object")continue;Q.push(" ",Zl,'="',L(da),'"')}}}}return Q.push(">"),je(Q,oi,Xc),Xc}}return Le(Q,he,ne)}var dt=new Map;function mt(Q){var ne=dt.get(Q);return ne===void 0&&(ne="",dt.set(Q,ne)),ne}function ht(Q,ne){Q=Q.preamble,Q.htmlChunks===null&&ne.htmlChunks&&(Q.htmlChunks=ne.htmlChunks),Q.headChunks===null&&ne.headChunks&&(Q.headChunks=ne.headChunks),Q.bodyChunks===null&&ne.bodyChunks&&(Q.bodyChunks=ne.bodyChunks)}function ft(Q,ne){ne=ne.bootstrapChunks;for(var he=0;he')}function et(Q,ne,he,ke){switch(he.insertionMode){case 0:case 1:case 3:case 2:return Q.push('