@malloy-publisher/app 0.0.191 → 0.0.192
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-doc.yaml +9 -2
- package/dist/assets/{HomePage-Dn3E4CuB.js → HomePage-H1OH-VW5.js} +1 -1
- package/dist/assets/{MainPage-BzB3yoqi.js → MainPage-GL06aMke.js} +1 -1
- package/dist/assets/{ModelPage-C9O_sAXT.js → ModelPage-Crau5hgZ.js} +1 -1
- package/dist/assets/{PackagePage-DcxKEjBX.js → PackagePage-CbubRhgE.js} +1 -1
- package/dist/assets/{ProjectPage-BDj307rF.js → ProjectPage-DUlJkYJ4.js} +1 -1
- package/dist/assets/{RouteError-DAShbVCG.js → RouteError-DrNXNihc.js} +1 -1
- package/dist/assets/{WorkbookPage-Cs_XYEaB.js → WorkbookPage-CBBv7n5U.js} +1 -1
- package/dist/assets/{core-CjeTkq8O.es-BqRc6yhC.js → core-Dzx75uJR.es-DwnFZnyO.js} +1 -1
- package/dist/assets/{index-D68X76-7.js → index-CzjyS9cx.js} +1 -1
- package/dist/assets/{index-Bb2jqquW.js → index-HHdhLUpv.js} +1 -1
- package/dist/assets/{index-15BOvhp0.js → index-d5rvmoZ7.js} +4 -4
- package/dist/assets/{index.umd-DGBekgSu.js → index.umd-CetYIBQY.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +2 -2
package/dist/api-doc.yaml
CHANGED
|
@@ -735,6 +735,12 @@ paths:
|
|
|
735
735
|
required: true
|
|
736
736
|
schema:
|
|
737
737
|
$ref: "#/components/schemas/IdentifierPattern"
|
|
738
|
+
- name: options
|
|
739
|
+
in: query
|
|
740
|
+
description: Options (deprecated; pass in body instead)
|
|
741
|
+
required: false
|
|
742
|
+
schema:
|
|
743
|
+
type: string
|
|
738
744
|
requestBody:
|
|
739
745
|
description: SQL statement to execute
|
|
740
746
|
required: true
|
|
@@ -2259,7 +2265,8 @@ components:
|
|
|
2259
2265
|
filterParams:
|
|
2260
2266
|
type: object
|
|
2261
2267
|
description: Filter parameter values keyed by filter name. Used with sources
|
|
2262
|
-
that declare \#(filter) annotations. Each value is either a string
|
|
2268
|
+
that declare \#(filter) annotations. Each value is either a string
|
|
2269
|
+
or an array of strings.
|
|
2263
2270
|
additionalProperties: true
|
|
2264
2271
|
bypassFilters:
|
|
2265
2272
|
type: boolean
|
|
@@ -3033,4 +3040,4 @@ components:
|
|
|
3033
3040
|
required: true
|
|
3034
3041
|
description: ID of the materialization
|
|
3035
3042
|
schema:
|
|
3036
|
-
type: string
|
|
3043
|
+
type: string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as o,j as a,i as e}from"./index-
|
|
1
|
+
import{d as o,j as a,i as e}from"./index-d5rvmoZ7.js";function i(){const t=o();return a.jsx(e,{onClickProject:t})}export{i as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as V,g as F,r as g,R as _,a as X,b as S,c as M,e as A,j as t,s as m,f as w,h as v,k as I,P as Y,m as R,l as J,n as z,B as K,o as N,p as Z,T as U,q,t as oo,d as eo,v as b,C as j,w as ro,x as to,I as so,M as ao,y as $,S as no,z as lo,A as io,O as co}from"./index-
|
|
1
|
+
import{u as V,g as F,r as g,R as _,a as X,b as S,c as M,e as A,j as t,s as m,f as w,h as v,k as I,P as Y,m as R,l as J,n as z,B as K,o as N,p as Z,T as U,q,t as oo,d as eo,v as b,C as j,w as ro,x as to,I as so,M as ao,y as $,S as no,z as lo,A as io,O as co}from"./index-d5rvmoZ7.js";function po(o,e,r,s,n){const[a,i]=g.useState(()=>n&&r?r(o).matches:s?s(o).matches:e);return X(()=>{if(!r)return;const p=r(o),u=()=>{i(p.matches)};return u(),p.addEventListener("change",u),()=>{p.removeEventListener("change",u)}},[o,r]),a}const uo={..._},L=uo.useSyncExternalStore;function go(o,e,r,s,n){const a=g.useCallback(()=>e,[e]),i=g.useMemo(()=>{if(n&&r)return()=>r(o).matches;if(s!==null){const{matches:c}=s(o);return()=>c}return a},[a,o,s,n,r]),[p,u]=g.useMemo(()=>{if(r===null)return[a,()=>()=>{}];const c=r(o);return[()=>c.matches,l=>(c.addEventListener("change",l),()=>{c.removeEventListener("change",l)})]},[a,r,o]);return L(u,p,i)}function O(o={}){const{themeId:e}=o;return function(s,n={}){let a=V();a&&e&&(a=a[e]||a);const i=typeof window<"u"&&typeof window.matchMedia<"u",{defaultMatches:p=!1,matchMedia:u=i?window.matchMedia:null,ssrMatchMedia:d=null,noSsr:c=!1}=F({name:"MuiUseMediaQuery",props:n,theme:a});let l=typeof s=="function"?s(a):s;return l=l.replace(/^@media( ?)/m,""),l.includes("print")&&console.warn(["MUI: You have provided a `print` query to the `useMediaQuery` hook.","Using the print media query to modify print styles can lead to unexpected results.","Consider using the `displayPrint` field in the `sx` prop instead.","More information about `displayPrint` on our docs: https://mui.com/system/display/#display-in-print."].join(`
|
|
2
2
|
`)),(L!==void 0?go:po)(l,p,u,d,c)}}O();function xo(o){return S("MuiAppBar",o)}M("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const mo=o=>{const{color:e,position:r,classes:s}=o,n={root:["root",`color${v(e)}`,`position${v(r)}`]};return I(n,xo,s)},D=(o,e)=>o?`${o?.replace(")","")}, ${e})`:e,bo=m(Y,{name:"MuiAppBar",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:r}=o;return[e.root,e[`position${v(r.position)}`],e[`color${v(r.color)}`]]}})(R(({theme:o})=>({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0,variants:[{props:{position:"fixed"},style:{position:"fixed",zIndex:(o.vars||o).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}}},{props:{position:"absolute"},style:{position:"absolute",zIndex:(o.vars||o).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"sticky"},style:{position:"sticky",zIndex:(o.vars||o).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"static"},style:{position:"static"}},{props:{position:"relative"},style:{position:"relative"}},{props:{color:"inherit"},style:{"--AppBar-color":"inherit"}},{props:{color:"default"},style:{"--AppBar-background":o.vars?o.vars.palette.AppBar.defaultBg:o.palette.grey[100],"--AppBar-color":o.vars?o.vars.palette.text.primary:o.palette.getContrastText(o.palette.grey[100]),...o.applyStyles("dark",{"--AppBar-background":o.vars?o.vars.palette.AppBar.defaultBg:o.palette.grey[900],"--AppBar-color":o.vars?o.vars.palette.text.primary:o.palette.getContrastText(o.palette.grey[900])})}},...Object.entries(o.palette).filter(J(["contrastText"])).map(([e])=>({props:{color:e},style:{"--AppBar-background":(o.vars??o).palette[e].main,"--AppBar-color":(o.vars??o).palette[e].contrastText}})),{props:e=>e.enableColorOnDark===!0&&!["inherit","transparent"].includes(e.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:e=>e.enableColorOnDark===!1&&!["inherit","transparent"].includes(e.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...o.applyStyles("dark",{backgroundColor:o.vars?D(o.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:o.vars?D(o.vars.palette.AppBar.darkColor,"var(--AppBar-color)"):null})}},{props:{color:"transparent"},style:{"--AppBar-background":"transparent","--AppBar-color":"inherit",backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...o.applyStyles("dark",{backgroundImage:"none"})}}]}))),fo=g.forwardRef(function(e,r){const s=A({props:e,name:"MuiAppBar"}),{className:n,color:a="primary",enableColorOnDark:i=!1,position:p="fixed",...u}=s,d={...s,color:a,position:p,enableColorOnDark:i},c=mo(d);return t.jsx(bo,{square:!0,component:"header",ownerState:d,elevation:4,className:w(c.root,n,p==="fixed"&&"mui-fixed"),ref:r,...u})}),ho=z(t.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),yo=m(K,{name:"MuiBreadcrumbCollapsed"})(R(({theme:o})=>({display:"flex",marginLeft:`calc(${o.spacing(1)} * 0.5)`,marginRight:`calc(${o.spacing(1)} * 0.5)`,...o.palette.mode==="light"?{backgroundColor:o.palette.grey[100],color:o.palette.grey[700]}:{backgroundColor:o.palette.grey[700],color:o.palette.grey[100]},borderRadius:2,"&:hover, &:focus":{...o.palette.mode==="light"?{backgroundColor:o.palette.grey[200]}:{backgroundColor:o.palette.grey[600]}},"&:active":{boxShadow:o.shadows[0],...o.palette.mode==="light"?{backgroundColor:N(o.palette.grey[200],.12)}:{backgroundColor:N(o.palette.grey[600],.12)}}}))),vo=m(ho)({width:24,height:16});function Bo(o){const{slots:e={},slotProps:r={},...s}=o,n=o;return t.jsx("li",{children:t.jsx(yo,{focusRipple:!0,...s,ownerState:n,children:t.jsx(vo,{as:e.CollapsedIcon,ownerState:n,...r.collapsedIcon})})})}function ko(o){return S("MuiBreadcrumbs",o)}const Co=M("MuiBreadcrumbs",["root","ol","li","separator"]),jo=o=>{const{classes:e}=o;return I({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},ko,e)},So=m(U,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(o,e)=>[{[`& .${Co.li}`]:e.li},e.root]})({}),Mo=m("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),Ao=m("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function wo(o,e,r,s){return o.reduce((n,a,i)=>(i<o.length-1?n=n.concat(a,t.jsx(Ao,{"aria-hidden":!0,className:e,ownerState:s,children:r},`separator-${i}`)):n.push(a),n),[])}const Io=g.forwardRef(function(e,r){const s=A({props:e,name:"MuiBreadcrumbs"}),{children:n,className:a,component:i="nav",slots:p={},slotProps:u={},expandText:d="Show path",itemsAfterCollapse:c=1,itemsBeforeCollapse:l=1,maxItems:h=8,separator:B="/",...Q}=s,[T,W]=g.useState(!1),f={...s,component:i,expanded:T,expandText:d,itemsAfterCollapse:c,itemsBeforeCollapse:l,maxItems:h,separator:B},y=jo(f),H=Z({elementType:p.CollapsedIcon,externalSlotProps:u.collapsedIcon,ownerState:f}),P=g.useRef(null),G=x=>{const C=()=>{W(!0);const E=P.current.querySelector("a[href],button,[tabindex]");E&&E.focus()};return l+c>=x.length?x:[...x.slice(0,l),t.jsx(Bo,{"aria-label":d,slots:{CollapsedIcon:p.CollapsedIcon},slotProps:{collapsedIcon:H},onClick:C},"ellipsis"),...x.slice(x.length-c,x.length)]},k=g.Children.toArray(n).filter(x=>g.isValidElement(x)).map((x,C)=>t.jsx("li",{className:y.li,children:x},`child-${C}`));return t.jsx(So,{ref:r,component:i,color:"textSecondary",className:w(y.root,a),ownerState:f,...Q,children:t.jsx(Mo,{className:y.ol,ref:P,ownerState:f,children:wo(T||h&&k.length<=h?k:G(k),y.separator,B,f)})})});function Ro(o){return S("MuiToolbar",o)}M("MuiToolbar",["root","gutters","regular","dense"]);const zo=o=>{const{classes:e,disableGutters:r,variant:s}=o;return I({root:["root",!r&&"gutters",s]},Ro,e)},To=m("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:r}=o;return[e.root,!r.disableGutters&&e.gutters,e[r.variant]]}})(R(({theme:o})=>({position:"relative",display:"flex",alignItems:"center",variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:o.spacing(2),paddingRight:o.spacing(2),[o.breakpoints.up("sm")]:{paddingLeft:o.spacing(3),paddingRight:o.spacing(3)}}},{props:{variant:"dense"},style:{minHeight:48}},{props:{variant:"regular"},style:o.mixins.toolbar}]}))),Po=g.forwardRef(function(e,r){const s=A({props:e,name:"MuiToolbar"}),{className:n,component:a="div",disableGutters:i=!1,variant:p="regular",...u}=s,d={...s,component:a,disableGutters:i,variant:p},c=zo(d);return t.jsx(To,{as:a,className:w(c.root,n),ref:r,ownerState:d,...u})}),Eo=O({themeId:q}),No=z(t.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),$o=z(t.jsx("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}));function Do(){const o=oo(),e=o["*"],r=eo();return t.jsx(b,{sx:{display:"flex",alignItems:"center"},children:t.jsxs(Io,{"aria-label":"breadcrumb",separator:t.jsx(No,{sx:{fontSize:14,color:"text.secondary"}}),sx:{"& .MuiBreadcrumbs-separator":{margin:"0 6px"}},children:[o.projectName&&t.jsx(j,{onClick:s=>r(`/${o.projectName}/`,s),label:o.projectName,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"1rem",cursor:"pointer","&:hover":{backgroundColor:"primary.100"}}}),o.packageName&&t.jsx(j,{onClick:s=>r(`/${o.projectName}/${o.packageName}/`,s),label:o.packageName,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"1rem",cursor:"pointer","&:hover":{backgroundColor:"secondary.100"}}}),e&&t.jsx(j,{onClick:s=>r(`/${o.projectName}/${o.packageName}/${e}`,s),label:e,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"1rem",cursor:"pointer","&:hover":{backgroundColor:"grey.200"}}})]})})}function Uo({logoHeader:o,endCap:e}){const r=ro(),s=to(),n=Eo(s.breakpoints.down("sm")),[a,i]=g.useState(null),p=!!a,u=l=>{i(l.currentTarget)},d=()=>i(null),c=[{label:"Malloy Docs",link:"https://docs.malloydata.dev/documentation/",sx:{color:"#14b3cb"}},{label:"Publisher Docs",link:"https://github.com/malloydata/publisher/blob/main/README.md",sx:{color:"#14b3cb"}},{label:"Publisher API",link:"/api-doc.html",sx:{color:"#14b3cb"}}];return t.jsxs(fo,{position:"sticky",elevation:0,sx:{backgroundColor:"background.paper",borderBottom:"1px solid",borderColor:"divider"},children:[t.jsxs(Po,{sx:{justifyContent:"space-between",flexWrap:"nowrap",minHeight:44},children:[o||t.jsxs(b,{sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer"},onClick:()=>r("/"),children:[t.jsx(b,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:28,height:28}}),t.jsx(U,{variant:"h6",sx:{color:"text.primary",fontWeight:700,letterSpacing:"-0.025em",fontSize:{xs:"1.1rem",sm:"1.25rem"}},children:"Malloy Publisher"})]}),n?t.jsxs(t.Fragment,{children:[t.jsx(so,{color:"inherit",onClick:u,children:t.jsx($o,{})}),t.jsxs(ao,{anchorEl:a,open:p,onClose:d,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:[c.map(l=>t.jsx($,{onClick:()=>{d(),window.location.href=l.link},sx:l.sx,children:l.label},l.label)),e&&t.jsx($,{children:e})]})]}):t.jsxs(no,{direction:"row",spacing:2,alignItems:"center",children:[c.map(l=>t.jsx(lo,{href:l.link,sx:l.sx,children:l.label},l.label)),e]})]}),t.jsx(b,{sx:{borderTop:"1px solid white",paddingLeft:"16px",paddingRight:"16px",marginBottom:"1px",overflowX:"auto"},children:t.jsx(Do,{})})]})}function Oo({headerProps:o}){return t.jsxs(b,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh"},children:[t.jsx(Uo,{...o}),t.jsx(io,{maxWidth:"xl",component:"main",sx:{flex:1,display:"flex",flexDirection:"column",py:2,gap:2},children:t.jsx(b,{sx:{flex:1},children:t.jsx(co,{})})})]})}export{Oo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as n,j as e,D as i,E as t,F as c}from"./index-
|
|
1
|
+
import{t as n,j as e,D as i,E as t,F as c}from"./index-d5rvmoZ7.js";function o(){const a=n(),r=a["*"];if(!a.projectName)return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})});if(!a.packageName)return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});const s=i({projectName:a.projectName,packageName:a.packageName,modelPath:r});return r?.endsWith(".malloy")?e.jsx(t,{resourceUri:s,runOnDemand:!0,maxResultSize:512*1024}):r?.endsWith(".malloynb")?e.jsx(c,{resourceUri:s,maxResultSize:1024*1024}):e.jsx("div",{children:e.jsxs("h2",{children:["Unrecognized file type: ",r]})})}export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as n,d as c,j as e,D as t,G as o}from"./index-
|
|
1
|
+
import{t as n,d as c,j as e,D as t,G as o}from"./index-d5rvmoZ7.js";function l(){const{projectName:s,packageName:a}=n(),r=c();if(s)if(a){const i=t({projectName:s,packageName:a});return e.jsx(o,{onClickPackageFile:r,resourceUri:i})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})})}export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as a,t as n,j as e,D as o,H as c}from"./index-
|
|
1
|
+
import{d as a,t as n,j as e,D as o,H as c}from"./index-d5rvmoZ7.js";function u(){const r=a(),{projectName:s}=n();if(s){const t=o({projectName:s});return e.jsx(c,{onSelectPackage:r,resourceUri:t})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})})}export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{J as o,j as r,A as s,S as n,v as t,T as a}from"./index-
|
|
1
|
+
import{J as o,j as r,A as s,S as n,v as t,T as a}from"./index-d5rvmoZ7.js";function x(){const e=o();return console.error(e),r.jsx(s,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:r.jsxs(n,{sx:{m:"auto",flexDirection:"column"},children:[r.jsx(t,{sx:{height:"300px"}}),r.jsx("img",{src:"/error.png"}),r.jsx(a,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as a,j as e,D as t,Z as c}from"./index-
|
|
1
|
+
import{t as a,j as e,D as t,Z as c}from"./index-d5rvmoZ7.js";function d(){const{workspace:r,workbookPath:s,projectName:i,packageName:n}=a();if(r)if(s)if(i)if(n){const o=t({projectName:i,packageName:n});return e.jsx(c,{workbookPath:{path:s,workspace:r},resourceUri:o},`${s}`)}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing workbook path"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing workspace"})})}export{d as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createOnigurumaEngine as At,getDefaultWasmLoader as Gr,loadWasm as Mr}from"./engine-oniguruma-C4vnmooL.es-jdkXmgTr.js";import{Q as Cn,K as Br,L as Or,N as Fr,U as jr,V as Dr,W as Wr,X as Dt,Y as xt}from"./index-15BOvhp0.js";let V=class extends Error{constructor(t){super(t),this.name="ShikiError"}},Ee=!1,wn=!1;function Zi(t=!0,e=!1){Ee=t,wn=e}function F(t,e=3){if(Ee&&!(typeof Ee=="number"&&e>Ee)){if(wn)throw new Error(`[SHIKI DEPRECATE]: ${t}`);console.trace(`[SHIKI DEPRECATE]: ${t}`)}}function Ur(t){return vt(t)}function vt(t){return Array.isArray(t)?qr(t):t instanceof RegExp?t:typeof t=="object"?Hr(t):t}function qr(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=vt(t[n]);return e}function Hr(t){let e={};for(let n in t)e[n]=vt(t[n]);return e}function Sn(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function An(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?An(t.substring(0,t.length-1)):t.substr(~e+1)}var Ke=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,we=class{static hasCaptures(t){return t===null?!1:(Ke.lastIndex=0,Ke.test(t))}static replaceCaptures(t,e,n){return t.replace(Ke,(r,s,a,o)=>{let i=n[parseInt(s||a,10)];if(i){let c=e.substring(i.start,i.end);for(;c[0]===".";)c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function xn(t,e){return t<e?-1:t>e?1:0}function vn(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let a=xn(t[s],e[s]);if(a!==0)return a}return 0}return n-r}function Wt(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function En(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Nn=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},Re=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Qr(t),e)}static createFromParsedTheme(t,e){return Zr(t,e)}_cachedMatchRoot=new Nn(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,n=this._cachedMatchRoot.get(e).find(r=>zr(t.parent,r.parentScopes));return n?new In(n.fontStyle,n.foreground,n.background):null}},Ye=class Ne{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Ne(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new Ne(n,e[r]);return n}push(e){return new Ne(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function zr(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!Vr(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Vr(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var In=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Qr(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,a=e.length;s<a;s++){let o=e[s];if(!o.settings)continue;let i;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),i=h.split(",")}else Array.isArray(o.scope)?i=o.scope:i=[""];let c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let d=0,p=h.length;d<p;d++)switch(h[d]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;typeof o.settings.foreground=="string"&&Wt(o.settings.foreground)&&(l=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&Wt(o.settings.background)&&(u=o.settings.background);for(let h=0,d=i.length;h<d;h++){let p=i[h].trim().split(" "),g=p[p.length-1],k=null;p.length>1&&(k=p.slice(0,p.length-1),k.reverse()),n[r++]=new Xr(g,k,s,c,l,u)}}return n}var Xr=class{constructor(t,e,n,r,s,a){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=a}},z=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(z||{});function Zr(t,e){t.sort((c,l)=>{let u=xn(c.scope,l.scope);return u!==0||(u=vn(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let c=t.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let a=new Kr(e),o=new In(n,a.getId(r),a.getId(s)),i=new Jr(new ut(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let u=t[c];i.insert(0,u.scope,u.parentScopes,u.fontStyle,a.getId(u.foreground),a.getId(u.background))}return new Re(a,o,i)}var Kr=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},Yr=Object.freeze([]),ut=class $n{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,a){this.scopeDepth=e,this.parentScopes=n||Yr,this.fontStyle=r,this.foreground=s,this.background=a}clone(){return new $n(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},Jr=class ht{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){const a=n.parentScopes[s].length-e.parentScopes[r].length;if(a!==0)return a;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,a;if(r===-1?(s=e,a=""):(s=e.substring(0,r),a=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(a)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(ht._cmpBySpecificity),n}insert(e,n,r,s,a,o){if(n===""){this._doInsertHere(e,r,s,a,o);return}let i=n.indexOf("."),c,l;i===-1?(c=n,l=""):(c=n.substring(0,i),l=n.substring(i+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new ht(this._mainRule.clone(),ut.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(e+1,l,r,s,a,o)}_doInsertHere(e,n,r,s,a){if(n===null){this._mainRule.acceptOverwrite(e,r,s,a);return}for(let o=0,i=this._rulesWithParentScopes.length;o<i;o++){let c=this._rulesWithParentScopes[o];if(vn(c.parentScopes,n)===0){c.acceptOverwrite(e,r,s,a);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),a===0&&(a=this._mainRule.background),this._rulesWithParentScopes.push(new ut(e,n,r,s,a))}},ie=class M{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=M.getLanguageId(e),r=M.getTokenType(e),s=M.getFontStyle(e),a=M.getForeground(e),o=M.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,a,o,i){let c=M.getLanguageId(e),l=M.getTokenType(e),u=M.containsBalancedBrackets(e)?1:0,h=M.getFontStyle(e),d=M.getForeground(e),p=M.getBackground(e);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),a!==-1&&(h=a),o!==0&&(d=o),i!==0&&(p=i),(c<<0|l<<8|u<<10|h<<11|d<<15|p<<24)>>>0}};function Pe(t,e){const n=[],r=es(t);let s=r.next();for(;s!==null;){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=o();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function a(){if(s==="-"){s=r.next();const c=a();return l=>!!c&&!c(l)}if(s==="("){s=r.next();const c=i();return s===")"&&(s=r.next()),c}if(Ut(s)){const c=[];do c.push(s),s=r.next();while(Ut(s));return l=>e(c,l)}return null}function o(){const c=[];let l=a();for(;l;)c.push(l),l=a();return u=>c.every(h=>h(u))}function i(){const c=[];let l=o();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=o()}return u=>c.some(h=>h(u))}}function Ut(t){return!!t&&!!t.match(/[\w\.:]+/)}function es(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function Rn(t){typeof t.dispose=="function"&&t.dispose()}var de=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},ts=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},ns=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},rs=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new de(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new ns;for(const n of t)ss(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof de){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function ss(t,e,n,r){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const a=n.lookup(e);t instanceof de?Ie({baseGrammar:a,selfGrammar:s},r):pt(t.ruleName,{baseGrammar:a,selfGrammar:s,repository:s.repository},r);const o=n.injections(t.scopeName);if(o)for(const i of o)r.add(new de(i))}function pt(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];Te([r],e,n)}}function Ie(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Te(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Te(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Te(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Sn({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&Te(r.patterns,{...e,repository:s},n);const a=r.include;if(!a)continue;const o=Pn(a);switch(o.kind){case 0:Ie({...e,selfGrammar:e.baseGrammar},n);break;case 1:Ie(e,n);break;case 2:pt(o.ruleName,{...e,repository:s},n);break;case 3:case 4:const i=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(i){const c={baseGrammar:e.baseGrammar,selfGrammar:i,repository:s};o.kind===4?pt(o.ruleName,c,n):Ie(c,n)}else o.kind===4?n.add(new ts(o.scopeName,o.ruleName)):n.add(new de(o.scopeName));break}}}var as=class{kind=0},os=class{kind=1},is=class{constructor(t){this.ruleName=t}kind=2},cs=class{constructor(t){this.scopeName=t}kind=3},ls=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Pn(t){if(t==="$base")return new as;if(t==="$self")return new os;const e=t.indexOf("#");if(e===-1)return new cs(t);if(e===0)return new is(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new ls(n,r)}}var us=/\\(\d+)/,qt=/\\(\d+)/g,hs=-1,Tn=-2,ke=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=we.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=we.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${An(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:we.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:we.replaceCaptures(this._contentName,t,e)}},ps=class extends ke{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},ds=class extends ke{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new ge(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new fe,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ht=class extends ke{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new fe,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},dt=class extends ke{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,a,o,i,c,l){super(t,e,n,r),this._begin=new ge(s,this.id),this.beginCaptures=a,this._end=new ge(o||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=i,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new fe;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},Le=class extends ke{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,a,o,i,c){super(t,e,n,r),this._begin=new ge(s,this.id),this.beginCaptures=a,this.whileCaptures=i,this._while=new ge(o,Tn),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new fe;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new fe,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||""),this._cachedCompiledWhilePatterns}},Ln=class R{static createCaptureRule(e,n,r,s,a){return e.registerRule(o=>new ps(n,o,r,s,a))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new ds(e.$vscodeTextmateLocation,e.id,e.name,e.match,R._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=Sn({},r,e.repository));let a=e.patterns;return typeof a>"u"&&e.include&&(a=[{include:e.include}]),new Ht(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,R._compilePatterns(a,n,r))}return e.while?new Le(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,R._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,R._compileCaptures(e.whileCaptures||e.captures,n,r),R._compilePatterns(e.patterns,n,r)):new dt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,R._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,R._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,R._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let a=0;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const i=parseInt(o,10);i>a&&(a=i)}for(let o=0;o<=a;o++)s[o]=null;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const i=parseInt(o,10);let c=0;e[o].patterns&&(c=R.getCompiledRuleId(e[o],n,r)),s[i]=R.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,c)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let a=0,o=e.length;a<o;a++){const i=e[a];let c=-1;if(i.include){const l=Pn(i.include);switch(l.kind){case 0:case 1:c=R.getCompiledRuleId(r[i.include],n,r);break;case 2:let u=r[l.ruleName];u&&(c=R.getCompiledRuleId(u,n,r));break;case 3:case 4:const h=l.scopeName,d=l.kind===4?l.ruleName:null,p=n.getExternalGrammar(h,r);if(p)if(d){let g=p.repository[d];g&&(c=R.getCompiledRuleId(g,n,p.repository))}else c=R.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else c=R.getCompiledRuleId(i,n,r);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof Ht||l instanceof dt||l instanceof Le)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},ge=class Gn{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,a=[],o=!1;for(let i=0;i<r;i++)if(e.charAt(i)==="\\"&&i+1<r){const c=e.charAt(i+1);c==="z"?(a.push(e.substring(s,i)),a.push("$(?!\\n)(?<!\\n)"),s=i+2):(c==="A"||c==="G")&&(o=!0),i++}this.hasAnchor=o,s===0?this.source=e:(a.push(e.substring(s,r)),this.source=a.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=us.test(this.source):this.hasBackReferences=!1}clone(){return new Gn(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>e.substring(s.start,s.end));return qt.lastIndex=0,this.source.replace(qt,(s,a)=>En(r[parseInt(a,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],r=[],s=[],a,o,i,c;for(a=0,o=this.source.length;a<o;a++)i=this.source.charAt(a),e[a]=i,n[a]=i,r[a]=i,s[a]=i,i==="\\"&&a+1<o&&(c=this.source.charAt(a+1),c==="A"?(e[a+1]="",n[a+1]="",r[a+1]="A",s[a+1]="A"):c==="G"?(e[a+1]="",n[a+1]="G",r[a+1]="",s[a+1]="G"):(e[a+1]=c,n[a+1]=c,r[a+1]=c,s[a+1]=c),a++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},fe=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new zt(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(s=>s.resolveAnchors(e,n));return new zt(t,r,this._items.map(s=>s.ruleId))}},zt=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
1
|
+
import{createOnigurumaEngine as At,getDefaultWasmLoader as Gr,loadWasm as Mr}from"./engine-oniguruma-C4vnmooL.es-jdkXmgTr.js";import{Q as Cn,K as Br,L as Or,N as Fr,U as jr,V as Dr,W as Wr,X as Dt,Y as xt}from"./index-d5rvmoZ7.js";let V=class extends Error{constructor(t){super(t),this.name="ShikiError"}},Ee=!1,wn=!1;function Zi(t=!0,e=!1){Ee=t,wn=e}function F(t,e=3){if(Ee&&!(typeof Ee=="number"&&e>Ee)){if(wn)throw new Error(`[SHIKI DEPRECATE]: ${t}`);console.trace(`[SHIKI DEPRECATE]: ${t}`)}}function Ur(t){return vt(t)}function vt(t){return Array.isArray(t)?qr(t):t instanceof RegExp?t:typeof t=="object"?Hr(t):t}function qr(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=vt(t[n]);return e}function Hr(t){let e={};for(let n in t)e[n]=vt(t[n]);return e}function Sn(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function An(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?An(t.substring(0,t.length-1)):t.substr(~e+1)}var Ke=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,we=class{static hasCaptures(t){return t===null?!1:(Ke.lastIndex=0,Ke.test(t))}static replaceCaptures(t,e,n){return t.replace(Ke,(r,s,a,o)=>{let i=n[parseInt(s||a,10)];if(i){let c=e.substring(i.start,i.end);for(;c[0]===".";)c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function xn(t,e){return t<e?-1:t>e?1:0}function vn(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let a=xn(t[s],e[s]);if(a!==0)return a}return 0}return n-r}function Wt(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function En(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Nn=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},Re=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Qr(t),e)}static createFromParsedTheme(t,e){return Zr(t,e)}_cachedMatchRoot=new Nn(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,n=this._cachedMatchRoot.get(e).find(r=>zr(t.parent,r.parentScopes));return n?new In(n.fontStyle,n.foreground,n.background):null}},Ye=class Ne{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Ne(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new Ne(n,e[r]);return n}push(e){return new Ne(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function zr(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!Vr(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Vr(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var In=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Qr(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,a=e.length;s<a;s++){let o=e[s];if(!o.settings)continue;let i;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),i=h.split(",")}else Array.isArray(o.scope)?i=o.scope:i=[""];let c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let d=0,p=h.length;d<p;d++)switch(h[d]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;typeof o.settings.foreground=="string"&&Wt(o.settings.foreground)&&(l=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&Wt(o.settings.background)&&(u=o.settings.background);for(let h=0,d=i.length;h<d;h++){let p=i[h].trim().split(" "),g=p[p.length-1],k=null;p.length>1&&(k=p.slice(0,p.length-1),k.reverse()),n[r++]=new Xr(g,k,s,c,l,u)}}return n}var Xr=class{constructor(t,e,n,r,s,a){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=a}},z=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(z||{});function Zr(t,e){t.sort((c,l)=>{let u=xn(c.scope,l.scope);return u!==0||(u=vn(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let c=t.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let a=new Kr(e),o=new In(n,a.getId(r),a.getId(s)),i=new Jr(new ut(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let u=t[c];i.insert(0,u.scope,u.parentScopes,u.fontStyle,a.getId(u.foreground),a.getId(u.background))}return new Re(a,o,i)}var Kr=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},Yr=Object.freeze([]),ut=class $n{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,a){this.scopeDepth=e,this.parentScopes=n||Yr,this.fontStyle=r,this.foreground=s,this.background=a}clone(){return new $n(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},Jr=class ht{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){const a=n.parentScopes[s].length-e.parentScopes[r].length;if(a!==0)return a;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,a;if(r===-1?(s=e,a=""):(s=e.substring(0,r),a=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(a)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(ht._cmpBySpecificity),n}insert(e,n,r,s,a,o){if(n===""){this._doInsertHere(e,r,s,a,o);return}let i=n.indexOf("."),c,l;i===-1?(c=n,l=""):(c=n.substring(0,i),l=n.substring(i+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new ht(this._mainRule.clone(),ut.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(e+1,l,r,s,a,o)}_doInsertHere(e,n,r,s,a){if(n===null){this._mainRule.acceptOverwrite(e,r,s,a);return}for(let o=0,i=this._rulesWithParentScopes.length;o<i;o++){let c=this._rulesWithParentScopes[o];if(vn(c.parentScopes,n)===0){c.acceptOverwrite(e,r,s,a);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),a===0&&(a=this._mainRule.background),this._rulesWithParentScopes.push(new ut(e,n,r,s,a))}},ie=class M{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=M.getLanguageId(e),r=M.getTokenType(e),s=M.getFontStyle(e),a=M.getForeground(e),o=M.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,a,o,i){let c=M.getLanguageId(e),l=M.getTokenType(e),u=M.containsBalancedBrackets(e)?1:0,h=M.getFontStyle(e),d=M.getForeground(e),p=M.getBackground(e);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),a!==-1&&(h=a),o!==0&&(d=o),i!==0&&(p=i),(c<<0|l<<8|u<<10|h<<11|d<<15|p<<24)>>>0}};function Pe(t,e){const n=[],r=es(t);let s=r.next();for(;s!==null;){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=o();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function a(){if(s==="-"){s=r.next();const c=a();return l=>!!c&&!c(l)}if(s==="("){s=r.next();const c=i();return s===")"&&(s=r.next()),c}if(Ut(s)){const c=[];do c.push(s),s=r.next();while(Ut(s));return l=>e(c,l)}return null}function o(){const c=[];let l=a();for(;l;)c.push(l),l=a();return u=>c.every(h=>h(u))}function i(){const c=[];let l=o();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=o()}return u=>c.some(h=>h(u))}}function Ut(t){return!!t&&!!t.match(/[\w\.:]+/)}function es(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function Rn(t){typeof t.dispose=="function"&&t.dispose()}var de=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},ts=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},ns=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},rs=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new de(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new ns;for(const n of t)ss(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof de){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function ss(t,e,n,r){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const a=n.lookup(e);t instanceof de?Ie({baseGrammar:a,selfGrammar:s},r):pt(t.ruleName,{baseGrammar:a,selfGrammar:s,repository:s.repository},r);const o=n.injections(t.scopeName);if(o)for(const i of o)r.add(new de(i))}function pt(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];Te([r],e,n)}}function Ie(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Te(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Te(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Te(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Sn({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&Te(r.patterns,{...e,repository:s},n);const a=r.include;if(!a)continue;const o=Pn(a);switch(o.kind){case 0:Ie({...e,selfGrammar:e.baseGrammar},n);break;case 1:Ie(e,n);break;case 2:pt(o.ruleName,{...e,repository:s},n);break;case 3:case 4:const i=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(i){const c={baseGrammar:e.baseGrammar,selfGrammar:i,repository:s};o.kind===4?pt(o.ruleName,c,n):Ie(c,n)}else o.kind===4?n.add(new ts(o.scopeName,o.ruleName)):n.add(new de(o.scopeName));break}}}var as=class{kind=0},os=class{kind=1},is=class{constructor(t){this.ruleName=t}kind=2},cs=class{constructor(t){this.scopeName=t}kind=3},ls=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Pn(t){if(t==="$base")return new as;if(t==="$self")return new os;const e=t.indexOf("#");if(e===-1)return new cs(t);if(e===0)return new is(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new ls(n,r)}}var us=/\\(\d+)/,qt=/\\(\d+)/g,hs=-1,Tn=-2,ke=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=we.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=we.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${An(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:we.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:we.replaceCaptures(this._contentName,t,e)}},ps=class extends ke{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},ds=class extends ke{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new ge(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new fe,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ht=class extends ke{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new fe,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},dt=class extends ke{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,a,o,i,c,l){super(t,e,n,r),this._begin=new ge(s,this.id),this.beginCaptures=a,this._end=new ge(o||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=i,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new fe;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},Le=class extends ke{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,a,o,i,c){super(t,e,n,r),this._begin=new ge(s,this.id),this.beginCaptures=a,this.whileCaptures=i,this._while=new ge(o,Tn),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new fe;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new fe,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||""),this._cachedCompiledWhilePatterns}},Ln=class R{static createCaptureRule(e,n,r,s,a){return e.registerRule(o=>new ps(n,o,r,s,a))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new ds(e.$vscodeTextmateLocation,e.id,e.name,e.match,R._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=Sn({},r,e.repository));let a=e.patterns;return typeof a>"u"&&e.include&&(a=[{include:e.include}]),new Ht(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,R._compilePatterns(a,n,r))}return e.while?new Le(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,R._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,R._compileCaptures(e.whileCaptures||e.captures,n,r),R._compilePatterns(e.patterns,n,r)):new dt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,R._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,R._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,R._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let a=0;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const i=parseInt(o,10);i>a&&(a=i)}for(let o=0;o<=a;o++)s[o]=null;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const i=parseInt(o,10);let c=0;e[o].patterns&&(c=R.getCompiledRuleId(e[o],n,r)),s[i]=R.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,c)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let a=0,o=e.length;a<o;a++){const i=e[a];let c=-1;if(i.include){const l=Pn(i.include);switch(l.kind){case 0:case 1:c=R.getCompiledRuleId(r[i.include],n,r);break;case 2:let u=r[l.ruleName];u&&(c=R.getCompiledRuleId(u,n,r));break;case 3:case 4:const h=l.scopeName,d=l.kind===4?l.ruleName:null,p=n.getExternalGrammar(h,r);if(p)if(d){let g=p.repository[d];g&&(c=R.getCompiledRuleId(g,n,p.repository))}else c=R.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else c=R.getCompiledRuleId(i,n,r);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof Ht||l instanceof dt||l instanceof Le)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},ge=class Gn{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,a=[],o=!1;for(let i=0;i<r;i++)if(e.charAt(i)==="\\"&&i+1<r){const c=e.charAt(i+1);c==="z"?(a.push(e.substring(s,i)),a.push("$(?!\\n)(?<!\\n)"),s=i+2):(c==="A"||c==="G")&&(o=!0),i++}this.hasAnchor=o,s===0?this.source=e:(a.push(e.substring(s,r)),this.source=a.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=us.test(this.source):this.hasBackReferences=!1}clone(){return new Gn(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>e.substring(s.start,s.end));return qt.lastIndex=0,this.source.replace(qt,(s,a)=>En(r[parseInt(a,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],r=[],s=[],a,o,i,c;for(a=0,o=this.source.length;a<o;a++)i=this.source.charAt(a),e[a]=i,n[a]=i,r[a]=i,s[a]=i,i==="\\"&&a+1<o&&(c=this.source.charAt(a+1),c==="A"?(e[a+1]="",n[a+1]="",r[a+1]="A",s[a+1]="A"):c==="G"?(e[a+1]="",n[a+1]="G",r[a+1]="",s[a+1]="G"):(e[a+1]=c,n[a+1]=c,r[a+1]=c,s[a+1]=c),a++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},fe=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new zt(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(s=>s.resolveAnchors(e,n));return new zt(t,r,this._items.map(s=>s.ruleId))}},zt=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
2
2
|
`)}findNextMatchSync(t,e,n){const r=this.scanner.findNextMatchSync(t,e,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Je=class{constructor(t,e){this.languageId=t,this.tokenType=e}},gs=class gt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new Je(e,8),this._embeddedLanguagesMatcher=new fs(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?gt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new Je(0,0);_getBasicScopeAttributes=new Nn(e=>{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new Je(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(gt.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},fs=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,r])=>En(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},Vt=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Mn(t,e,n,r,s,a,o,i){const c=e.content.length;let l=!1,u=-1;if(o){const p=ms(t,e,n,r,s,a);s=p.stack,r=p.linePos,n=p.isFirstLine,u=p.anchorPosition}const h=Date.now();for(;!l;){if(i!==0&&Date.now()-h>i)return new Vt(s,!0);d()}return new Vt(s,!1);function d(){const p=bs(t,e,n,r,s,u);if(!p){a.produce(s,c),l=!0;return}const g=p.captureIndices,k=p.matchedRuleId,m=g&&g.length>0?g[0].end>r:!1;if(k===hs){const C=s.getRule(t);a.produce(s,g[0].start),s=s.withContentNameScopesList(s.nameScopesList),ue(t,e,n,s,a,C.endCaptures,g),a.produce(s,g[0].end);const b=s;if(s=s.parent,u=b.getAnchorPos(),!m&&b.getEnterPos()===r){s=b,a.produce(s,c),l=!0;return}}else{const C=t.getRule(k);a.produce(s,g[0].start);const b=s,w=C.getName(e.content,g),I=s.contentNameScopesList.pushAttributed(w,t);if(s=s.push(k,r,u,g[0].end===c,null,I,I),C instanceof dt){const v=C;ue(t,e,n,s,a,v.beginCaptures,g),a.produce(s,g[0].end),u=g[0].end;const j=v.getContentName(e.content,g),L=I.pushAttributed(j,t);if(s=s.withContentNameScopesList(L),v.endHasBackReferences&&(s=s.withEndRule(v.getEndWithResolvedBackReferences(e.content,g))),!m&&b.hasSameRuleAs(s)){s=s.pop(),a.produce(s,c),l=!0;return}}else if(C instanceof Le){const v=C;ue(t,e,n,s,a,v.beginCaptures,g),a.produce(s,g[0].end),u=g[0].end;const j=v.getContentName(e.content,g),L=I.pushAttributed(j,t);if(s=s.withContentNameScopesList(L),v.whileHasBackReferences&&(s=s.withEndRule(v.getWhileWithResolvedBackReferences(e.content,g))),!m&&b.hasSameRuleAs(s)){s=s.pop(),a.produce(s,c),l=!0;return}}else if(ue(t,e,n,s,a,C.captures,g),a.produce(s,g[0].end),s=s.pop(),!m){s=s.safePop(),a.produce(s,c),l=!0;return}}g[0].end>r&&(r=g[0].end,n=!1)}}function ms(t,e,n,r,s,a){let o=s.beginRuleCapturedEOL?0:-1;const i=[];for(let c=s;c;c=c.pop()){const l=c.getRule(t);l instanceof Le&&i.push({rule:l,stack:c})}for(let c=i.pop();c;c=i.pop()){const{ruleScanner:l,findOptions:u}=ks(c.rule,t,c.stack.endRule,n,r===o),h=l.findNextMatchSync(e,r,u);if(h){if(h.ruleId!==Tn){s=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(a.produce(c.stack,h.captureIndices[0].start),ue(t,e,n,c.stack,a,c.rule.whileCaptures,h.captureIndices),a.produce(c.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>r&&(r=h.captureIndices[0].end,n=!1))}else{s=c.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:o,isFirstLine:n}}function bs(t,e,n,r,s,a){const o=ys(t,e,n,r,s,a),i=t.getInjections();if(i.length===0)return o;const c=_s(i,t,e,n,r,s,a);if(!c)return o;if(!o)return c;const l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function ys(t,e,n,r,s,a){const o=s.getRule(t),{ruleScanner:i,findOptions:c}=Bn(o,t,s.endRule,n,r===a),l=i.findNextMatchSync(e,r,c);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function _s(t,e,n,r,s,a,o){let i=Number.MAX_VALUE,c=null,l,u=0;const h=a.contentNameScopesList.getScopeNames();for(let d=0,p=t.length;d<p;d++){const g=t[d];if(!g.matcher(h))continue;const k=e.getRule(g.ruleId),{ruleScanner:m,findOptions:C}=Bn(k,e,null,r,s===o),b=m.findNextMatchSync(n,s,C);if(!b)continue;const w=b.captureIndices[0].start;if(!(w>=i)&&(i=w,c=b.captureIndices,l=b.ruleId,u=g.priority,i===s))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Bn(t,e,n,r,s){return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function ks(t,e,n,r,s){return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function ue(t,e,n,r,s,a,o){if(a.length===0)return;const i=e.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let h=0;h<c;h++){const d=a[h];if(d===null)continue;const p=o[h];if(p.length===0)continue;if(p.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=p.start;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?s.produceFromScopes(l[l.length-1].scopes,p.start):s.produce(r,p.start),d.retokenizeCapturedWithRuleId){const k=d.getName(i,o),m=r.contentNameScopesList.pushAttributed(k,t),C=d.getContentName(i,o),b=m.pushAttributed(C,t),w=r.push(d.retokenizeCapturedWithRuleId,p.start,-1,!1,null,m,b),I=t.createOnigString(i.substring(0,p.end));Mn(t,I,n&&p.start===0,p.start,w,s,!1,0),Rn(I);continue}const g=d.getName(i,o);if(g!==null){const k=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(g,t);l.push(new Cs(k,p.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Cs=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function ws(t,e,n,r,s,a,o,i){return new As(t,e,n,r,s,a,o,i)}function Qt(t,e,n,r,s){const a=Pe(e,Ge),o=Ln.getCompiledRuleId(n,r,s.repository);for(const i of a)t.push({debugSelector:e,matcher:i.matcher,ruleId:o,grammar:s,priority:i.priority})}function Ge(t,e){if(e.length<t.length)return!1;let n=0;return t.every(r=>{for(let s=n;s<e.length;s++)if(Ss(e[s],r))return n=s+1,!0;return!1})}function Ss(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var As=class{constructor(t,e,n,r,s,a,o,i){if(this._rootScopeName=t,this.balancedBracketSelectors=a,this._onigLib=i,this._basicScopeAttributesProvider=new gs(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Xt(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const c of Object.keys(s)){const l=Pe(c,Ge);for(const u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){const s=r.injections;if(s)for(let o in s)Qt(e,o,s[o],this,r);const a=this._grammarRepository.injections(n);a&&a.forEach(o=>{const i=this.getExternalGrammar(o);if(i){const c=i.injectionSelector;c&&Qt(e,c,i,this,i)}})}return e.sort((s,a)=>s.priority-a.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=Xt(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=Ln.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===ft.NULL){s=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=ie.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),d=this.getRule(this._rootId).getName(null,null);let p;d?p=he.createRootAndLookUpScopeName(d,h,this):p=he.createRoot("unknown",h),e=new ft(null,this._rootId,-1,-1,!1,null,p,p)}else s=!1,e.reset();t=t+`
|
|
3
3
|
`;const a=this.createOnigString(t),o=a.content.length,i=new vs(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Mn(this,a,s,0,e,i,!0,r);return Rn(a),{lineLength:o,lineTokens:i,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Xt(t,e){return t=Ur(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var he=class D{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=e?.scopePath??null;for(const a of n)s=Ye.push(s,a.scopeNames),r=new D(r,s,a.encodedTokenAttributes);return r}static createRoot(e,n){return new D(null,new Ye(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const s=r.getMetadataForScope(e),a=new Ye(null,e),o=r.themeProvider.themeMatch(a),i=D.mergeAttributes(n,s,o);return new D(null,a,i)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return D.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let s=-1,a=0,o=0;return r!==null&&(s=r.fontStyle,a=r.foregroundId,o=r.backgroundId),ie.set(e,n.languageId,n.tokenType,null,s,a,o)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return D._pushAttributed(this,e,n);const r=e.split(/ /g);let s=this;for(const a of r)s=D._pushAttributed(s,a,n);return s}static _pushAttributed(e,n,r){const s=r.getMetadataForScope(n),a=e.scopePath.push(n),o=r.themeProvider.themeMatch(a),i=D.mergeAttributes(e.tokenAttributes,s,o);return new D(e,a,i)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},ft=class Y{constructor(e,n,r,s,a,o,i,c){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=a,this.endRule=o,this.nameScopesList=i,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new Y(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:Y._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?he.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){Y._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,s,a,o,i){return new Y(this,e,n,r,s,a,o,i)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new Y(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const r=he.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new Y(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,he.fromExtension(r,n.contentNameScopesList))}},xs=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Pe(n,Ge).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>Pe(n,Ge).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},vs=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const a=t?.getScopeNames()??[];for(const o of this._tokenTypeOverrides)o.matcher(a)&&(r=ie.set(r,0,o.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(a))}if(s&&(r=ie.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},Es=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,r,s){if(!this._grammars.has(t)){let a=this._rawGrammars.get(t);if(!a)return null;this._grammars.set(t,ws(t,a,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},Ns=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new Es(Re.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,e){this._syncRegistry.setTheme(Re.createFromRawTheme(t,e))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,e,n){return this.loadGrammarWithConfiguration(t,e,{embeddedLanguages:n})}loadGrammarWithConfiguration(t,e,n){return this._loadGrammar(t,e,n.embeddedLanguages,n.tokenTypes,new xs(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,e,n,r,s){const a=new rs(this._syncRegistry,t);for(;a.Q.length>0;)a.Q.map(o=>this._loadSingleGrammar(o.scopeName)),a.processQueue();return this._grammarForScopeName(t,e,n,r,s)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const e=this._options.loadGrammar(t);if(e){const n=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(e,n)}}addGrammar(t,e=[],n=0,r=null){return this._syncRegistry.addGrammar(t,e),this._grammarForScopeName(t.scopeName,n,r)}_grammarForScopeName(t,e=0,n=null,r=null,s=null){return this._syncRegistry.grammarForScopeName(t,e,n,r,s)}},mt=ft.NULL;const Is=/["&'<>`]/g,$s=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Rs=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Ps=/[|\\{}()[\]^$+*?.]/g,Zt=new WeakMap;function Ts(t,e){if(t=t.replace(e.subset?Ls(e.subset):Is,r),e.subset||e.escapeOnly)return t;return t.replace($s,n).replace(Rs,r);function n(s,a,o){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(a+2),e)}function r(s,a,o){return e.format(s.charCodeAt(0),o.charCodeAt(a+1),e)}}function Ls(t){let e=Zt.get(t);return e||(e=Gs(t),Zt.set(t,e)),e}function Gs(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Ps,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const Ms=/[\dA-Fa-f]/;function Bs(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!Ms.test(String.fromCharCode(e))?r:r+";"}const Os=/\d/;function Fs(t,e,n){const r="&#"+String(t);return n&&e&&!Os.test(String.fromCharCode(e))?r:r+";"}const js=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],et={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Ds=["cent","copy","divide","gt","lt","not","para","times"],On={}.hasOwnProperty,bt={};let Se;for(Se in et)On.call(et,Se)&&(bt[et[Se]]=Se);const Ws=/[^\dA-Za-z]/;function Us(t,e,n,r){const s=String.fromCharCode(t);if(On.call(bt,s)){const a=bt[s],o="&"+a;return n&&js.includes(a)&&!Ds.includes(a)&&(!r||e&&e!==61&&Ws.test(String.fromCharCode(e)))?o:o+";"}return""}function qs(t,e,n){let r=Bs(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=Us(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const a=Fs(t,e,n.omitOptionalSemicolons);a.length<r.length&&(r=a)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function ae(t,e){return Ts(t,Object.assign({format:qs},e))}const Hs=/^>|^->|<!--|-->|--!>|<!-$/g,zs=[">"],Vs=["<",">"];function Qs(t,e,n,r){return r.settings.bogusComments?"<?"+ae(t.value,Object.assign({},r.settings.characterReferences,{subset:zs}))+">":"<!--"+t.value.replace(Hs,s)+"-->";function s(a){return ae(a,Object.assign({},r.settings.characterReferences,{subset:Vs}))}}function Xs(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const N=jn(1),Fn=jn(-1),Zs=[];function jn(t){return e;function e(n,r,s){const a=n?n.children:Zs;let o=(r||0)+t,i=a[o];if(!s)for(;i&&xt(i);)o+=t,i=a[o];return i}}const Ks={}.hasOwnProperty;function Dn(t){return e;function e(n,r,s){return Ks.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const Et=Dn({body:Js,caption:tt,colgroup:tt,dd:ra,dt:na,head:tt,html:Ys,li:ta,optgroup:sa,option:aa,p:ea,rp:Kt,rt:Kt,tbody:ia,td:Yt,tfoot:ca,th:Yt,thead:oa,tr:la});function tt(t,e,n){const r=N(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&xt(r.value.charAt(0)))}function Ys(t,e,n){const r=N(n,e);return!r||r.type!=="comment"}function Js(t,e,n){const r=N(n,e);return!r||r.type!=="comment"}function ea(t,e,n){const r=N(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function ta(t,e,n){const r=N(n,e);return!r||r.type==="element"&&r.tagName==="li"}function na(t,e,n){const r=N(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function ra(t,e,n){const r=N(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Kt(t,e,n){const r=N(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function sa(t,e,n){const r=N(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function aa(t,e,n){const r=N(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function oa(t,e,n){const r=N(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function ia(t,e,n){const r=N(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function ca(t,e,n){return!N(n,e)}function la(t,e,n){const r=N(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function Yt(t,e,n){const r=N(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const ua=Dn({body:da,colgroup:ga,head:pa,html:ha,tbody:fa});function ha(t){const e=N(t,-1);return!e||e.type!=="comment"}function pa(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function da(t){const e=N(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&xt(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function ga(t,e,n){const r=Fn(n,e),s=N(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Et(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function fa(t,e,n){const r=Fn(n,e),s=N(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Et(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Ae={name:[[`
|
|
4
4
|
\f\r &/=>`.split(""),`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as vO,r as D,j as w,$ as gr,R as N4,a0 as F4,a1 as oo}from"./index-15BOvhp0.js";import{r as I4,a as G2,b as k4,c as M4,d as P4,e as B4,f as $4,g as q4,h as j4,j as W2,k as V2,l as N0,m as Gh,n as U4,o as CO,p as Q4,q as H4,s as G4,t as I3,u as k3,v as M3,w as At}from"./index-Bb2jqquW.js";import{a as w1}from"./index.umd-DGBekgSu.js";var va={},ay={},Hr={},uy={},pC;function st(){return pC||(pC=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TD=e.ValueType=void 0,e.safeRecordGet=r,e.mkSafeRecord=s,e.exprHasKids=a,e.exprHasE=o,e.exprIsLeaf=c,e.isAsymmetricExpr=d,e.mkTemporal=f,e.isRawCast=u,e.isFilterExprType=p,e.isTimeLiteral=h,e.isParameterType=m,e.paramHasValue=x,e.expressionIsScalar=E,e.expressionIsAggregate=v,e.expressionIsUngroupedAggregate=g,e.expressionInvolvesAggregate=_,e.expressionIsCalculation=S,e.expressionIsAnalytic=R,e.isExpressionTypeLEQ=b,e.maxExpressionType=T,e.maxOfExpressionTypes=N,e.hasExpression=k,e.isTemporalType=L,e.isBasicAtomicType=F,e.isAtomicFieldType=M,e.canOrderBy=q,e.fieldIsIntrinsic=B,e.mkFieldDef=P,e.mkArrayDef=Y,e.mkArrayTypeDef=ee,e.isRepeatedRecordFunctionParam=oe,e.isRepeatedRecord=I,e.isRecordOrRepeatedRecord=X,e.isBasicArray=G,e.isMatrixOperation=te,e.isJoinable=V,e.isJoined=se,e.isJoinedSource=Ee,e.isDateUnit=ve,e.isTimestampUnit=le,e.isExtractUnit=ae,e.refIsStructDef=ce,e.segmentHasErrors=ie,e.structHasErrors=xe,e.isReduceSegment=me,e.isPartialSegment=Te,e.isProjectSegment=ye,e.isQuerySegment=be,e.isSamplingRows=pe,e.isSamplingPercent=Pe,e.isSamplingEnable=qe,e.isRawSegment=Ue,e.isIndexSegment=pt,e.bareFieldUsage=gt,e.isSegmentSQL=St,e.isSegmentSource=Ot,e.isSourceRegistryReference=Qt,e.sourceBase=br,e.isSourceDef=rr,e.isPersistableSourceDef=Le,e.isBaseTable=We,e.isLiteral=wt,e.mergeEvalSpaces=He,e.isBasicAtomic=de,e.getIdentifier=he,e.isUserTypeDef=ke,e.isCompoundArrayData=Be,e.isTurtle=Ke,e.isAtomic=ot,e.isValueString=rt,e.isValueNumber=Nt,e.isValueBoolean=Rt,e.isValueTimestamp=Se,e.isValueDate=it,e.mergeUniqueKeyRequirement=Ge;const t=Object.prototype.hasOwnProperty;function r(re,we){return t.call(re,we)?re[we]:void 0}function s(){return Object.create(null)}function a(re){return"kids"in re}function o(re){return"e"in re}function c(re){return!(a(re)||o(re))}function d(re){return re.node==="aggregate"&&["sum","avg","count","distinct"].includes(re.function)}function l(re){return re.node!=="arrayLiteral"&&re.node!=="recordLiteral"}function f(re,we){if(!("typeDef"in re)){const Ye=typeof we=="string"?{type:we}:we;if(l(re))return{...re,typeDef:{...Ye}}}return re}function u(re){return"dstSQLType"in re}function p(re){return["string","number","boolean","date","timestamp","timestamptz"].includes(re)}function h(re){return re.node==="dateLiteral"||re.node==="timestampLiteral"||re.node==="timestamptzLiteral"}function m(re){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(re)}function x(re){return re.value!==null}function E(re){return re===void 0||re==="scalar"}function v(re){return re==="aggregate"||re==="ungrouped_aggregate"}function g(re){return re==="ungrouped_aggregate"}function _(re){return re==="aggregate"||re==="ungrouped_aggregate"||re==="aggregate_analytic"}function S(re){return re==="aggregate"||re==="scalar_analytic"||re==="aggregate_analytic"||re==="ungrouped_aggregate"}function R(re){return re==="aggregate_analytic"||re==="scalar_analytic"}function C(re){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[re]}function b(re,we){return re===we||C(re)<C(we)}function T(re,we){let Ye="scalar";return(re==="aggregate"||we==="aggregate")&&(Ye="aggregate"),(re==="ungrouped_aggregate"||we==="ungrouped_aggregate")&&(Ye="ungrouped_aggregate"),(re==="scalar_analytic"||we==="scalar_analytic")&&(Ye="scalar_analytic"),(re==="aggregate_analytic"||we==="aggregate_analytic")&&(Ye="aggregate_analytic"),(re==="scalar_analytic"&&we==="aggregate"||re==="aggregate"&&we==="scalar_analytic")&&(Ye="aggregate_analytic"),Ye}function N(re){return re.reduce(T,"scalar")}function k(re){return"e"in re&&re.e!==void 0}function L(re){return re==="date"||re==="timestamp"||re==="timestamptz"}function F(re){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(re)}function M(re){return F(re)||re==="record"||re==="array"}function q(re){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(re)}function B(re){return M(re.type)&&!k(re)}function P(re,we){if(G(re))return Y(re.elementTypeDef,we);if(I(re)){const{type:ze,fields:mt,elementTypeDef:vt}=re;return{type:ze,fields:mt,elementTypeDef:vt,join:"many",name:we}}if(re.type==="record"){const{type:ze,fields:mt}=re;return{type:ze,fields:mt,join:"one",name:we}}const Ye={name:we,type:re.type};switch(re.type){case"sql native":return{...Ye,rawType:re.rawType};case"number":{const ze=re.numberType;return ze?{...Ye,numberType:ze}:Ye}case"date":{const ze=re.timeframe;return ze?{name:we,type:"date",timeframe:ze}:Ye}case"timestamp":{const ze={name:we,type:"timestamp"};return re.timeframe&&(ze.timeframe=re.timeframe),ze}case"timestamptz":{const ze={name:we,type:"timestamptz"};return re.timeframe&&(ze.timeframe=re.timeframe),ze}}return Ye}function Y(re,we){if(re.type==="record")return{type:"array",join:"many",name:we,elementTypeDef:{type:"record_element"},fields:re.fields};const Ye=P(re,"value");return{type:"array",join:"many",name:we,elementTypeDef:re,fields:[Ye,{...Ye,name:"each",e:{node:"field",path:["value"]}}]}}function ee(re){return re.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:re.fields}:{type:"array",elementTypeDef:re}}function oe(re){return re.type==="array"&&re.elementTypeDef.type==="record_element"}function I(re){return re.type==="array"&&re.elementTypeDef.type==="record_element"}function X(re){return re.type==="record"||re.type==="array"&&"elementTypeDef"in re&&re.elementTypeDef.type==="record_element"}function G(re){return re.type==="array"&&re.elementTypeDef.type!=="record_element"}function te(re){return["left","right","full","inner"].includes(re)}function V(re){return["composite","table","sql_select","query_source","virtual","array","record"].includes(re.type)}function se(re){return"join"in re}function Ee(re){return rr(re)&&se(re)}function ve(re){return["day","week","month","quarter","year"].includes(re)}function le(re){return ve(re)||["hour","minute","second"].includes(re)}function ae(re){return le(re)||re==="day_of_week"||re==="day_of_year"}var Z;(function(re){re.Date="date",re.Timestamp="timestamp",re.Number="number",re.String="string"})(Z||(e.ValueType=Z={}));function ce(re){return typeof re!="string"}function ie(re){return!!((re.type==="reduce"||re.type==="project"||re.type==="partial")&&(re.extendSource&&re.extendSource.some(we=>we.type==="error")||re.queryFields.some(we=>we.type==="error")))}function xe(re){return re.fields.some(we=>we.type==="error")}function me(re){return re.type==="reduce"}function Te(re){return re.type==="partial"}function ye(re){return re.type==="project"}function be(re){return ye(re)||me(re)}function pe(re){return re.rows!==void 0}function Pe(re){return re.percent!==void 0}function qe(re){return re.enable!==void 0}function Ue(re){return re.type==="raw"}function pt(re){return re.type==="index"}function gt(re){return re.uniqueKeyRequirement===void 0&&re.analyticFunctionUse===void 0}function St(re){return"sql"in re}function Ot(re){return"type"in re&&(re.type==="sql_select"||re.type==="query_source")}function Qt(re){return re.type==="source_registry_reference"}function br(re){return{...re}}function rr(re){return re.type==="table"||re.type==="sql_select"||re.type==="query_source"||re.type==="query_result"||re.type==="finalize"||re.type==="nest_source"||re.type==="virtual"||re.type==="composite"}function Le(re){return re.type==="sql_select"||re.type==="query_source"}function We(re){return Ee(re)?!1:!!rr(re)}function wt(re){return re==="literal"}function He(...re){return re.length<=1&&re.every(we=>we==="literal")?"literal":re.every(we=>we==="constant"||we==="literal")?"constant":re.every(we=>we==="output"||we==="constant"||we==="literal")?"output":"input"}function de(re){return re.type==="string"||L(re.type)||re.type==="number"||re.type==="boolean"||re.type==="json"||re.type==="sql native"||re.type==="error"}function he(re){return re.as!==void 0?re.as:re.name}function ke(re){return re.type==="userType"}function Be(re){return Array.isArray(re)&&(re.length===0||typeof re[0]=="object"&&re[0]!==null&&!Array.isArray(re[0]))}function Ke(re){return re.type==="turtle"}function ot(re){return M(re.type)}function rt(re,we){return we.type==="string"}function Nt(re,we){return we.type==="number"}function Rt(re,we){return we.type==="boolean"}function Se(re,we){return we.type==="timestamp"}function it(re,we){return we.type==="date"}e.TD={isAtomic(re){return re!==void 0&&M(re.type)},isBasicAtomic(re){return re!==void 0&&de({type:re.type})},isString:re=>re?.type==="string",isNumber:re=>re?.type==="number",isBoolean:re=>re?.type==="boolean",isJSON:re=>re?.type==="json",isSQL:re=>re?.type==="sql native",isDate:re=>re?.type==="date",isTimestamp:re=>re?.type==="timestamp",isTimestamptz:re=>re?.type==="timestamptz",isAnyTimestamp(re){return re?.type==="timestamp"||re?.type==="timestamptz"},isTemporal(re){var we;const Ye=(we=re?.type)!==null&&we!==void 0?we:"";return L(Ye)},isError:re=>re?.type==="error",eq(re,we){if(re===void 0||we===void 0)return!1;function Ye(ze,mt){const vt={},Tt=ze.fields||[],at=mt.fields||[];if(Tt.length!==at.length)return!1;for(const Ct of Tt)if(Ct.name)vt[Ct.name]=Ct;else return!1;for(const Ct of at)if(!e.TD.eq(vt[Ct.name],Ct))return!1;return!0}return re.type==="array"&&we.type==="array"?re.elementTypeDef.type!==we.elementTypeDef.type?!1:re.elementTypeDef.type!=="record_element"&&we.elementTypeDef.type!=="record_element"?e.TD.eq(re.elementTypeDef,we.elementTypeDef):e.TD.isAtomic(re)&&e.TD.isAtomic(we)&&Ye(re,we):re.type==="record"&&we.type==="record"?e.TD.isAtomic(re)&&e.TD.isAtomic(we)&&Ye(re,we):re.type==="sql native"&&we.type==="sql native"?re.rawType!==void 0&&re.rawType===we.rawType:re.type===we.type}};function Ge(re,we){return re?we?{isCount:re.isCount||we.isCount}:re:we}})(uy)),uy}var mC;function ho(){if(mC)return Hr;mC=1,Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.arg=t,Hr.spread=r,Hr.sql=s,Hr.constant=a,Hr.output=o,Hr.literal=c,Hr.variadicParam=d,Hr.param=l,Hr.makeParam=f,Hr.maxScalar=u,Hr.maxAggregate=p,Hr.anyExprType=h,Hr.maxUngroupedAggregate=m,Hr.maxAnalytic=x,Hr.minScalar=E,Hr.minAggregate=v,Hr.minAnalytic=g,Hr.overload=_,Hr.expandBlueprintMap=te,Hr.expandOverrideMapFromBase=Ee,Hr.def=le;const e=st();function t(ae){return{node:"function_parameter",name:ae}}function r(ae,Z=void 0,ce=void 0){return{node:"spread",e:ae,prefix:Z,suffix:ce}}function s(ae,...Z){const ce={node:"genericSQLExpr",kids:{args:[]},src:[]},ie=[...Z];let xe="";for(const me of ae){xe+=me;const Te=ie.shift();Te!==void 0&&(typeof Te=="string"?xe+=Te:(ce.src.push(xe),ce.kids.args.push(Te),xe=""))}return xe.length>0&&ce.src.push(xe),ce}function a(ae){return{...ae,evalSpace:"constant"}}function o(ae){return{...ae,evalSpace:"output"}}function c(ae){return{...ae,evalSpace:"literal"}}function d(ae,...Z){return{name:ae,isVariadic:!0,allowedTypes:Z}}function l(ae,...Z){return{name:ae,isVariadic:!1,allowedTypes:Z}}function f(ae,...Z){return{param:l(ae,...Z),arg:t(ae)}}function u(ae){return{...ae,expressionType:"scalar",evalSpace:"input"}}function p(ae){return{...ae,expressionType:"aggregate",evalSpace:"input"}}function h(ae){return{...ae,expressionType:void 0,evalSpace:"input"}}function m(ae){return{...ae,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function x(ae){return{...ae,expressionType:"aggregate_analytic",evalSpace:"input"}}function E(ae){return{...ae,expressionType:"scalar",evalSpace:"input"}}function v(ae){return{...ae,expressionType:"aggregate",evalSpace:"input"}}function g(ae){return{...ae,expressionType:"scalar_analytic",evalSpace:"input"}}function _(ae,Z,ce,ie){return{returnType:ae,params:Z,e:ce,needsWindowOrderBy:ie?.needsWindowOrderBy,between:ie?.between,isSymmetric:ie?.isSymmetric,supportsOrderBy:ie?.supportsOrderBy,defaultOrderByArgIndex:ie?.defaultOrderByArgIndex,supportsLimit:ie?.supportsLimit}}function S(ae,Z=!0,ce=!0){if(!Z&&ae==="any")throw new Error("Return type cannot include any");if(typeof ae=="string")return{type:ae};if("array"in ae){const ie=Z?S(ae.array,!0):S(ae.array,!1);return ie.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ie.fields}:{type:"array",elementTypeDef:ie}}else if("record"in ae){const ie=[];for(const[xe,me]of Object.entries(ae.record)){const Te=Z?S(me,!0):S(me,!1);e.TD.isAtomic(Te)&&ie.push((0,e.mkFieldDef)(Te,xe))}return{type:"record",fields:ie}}else if("generic"in ae){if(!ce)throw new Error("Cannot use generic");return{type:"generic",generic:ae.generic}}else if("sql_native"in ae)return{type:"sql native",rawType:ae.sql_native};throw new Error("Cannot figure out type")}function R(ae){if(ae==="any")throw new Error("Cannot return any type");if(typeof ae=="string")return E({type:ae});if("array"in ae)return h(S(ae,!1));if("record"in ae)return h(S(ae,!1));if("generic"in ae)return E(S(ae,!1));if("literal"in ae)return c(E(S(ae.literal,!1)));if("constant"in ae)return a(E(S(ae.constant,!1)));if("dimension"in ae)return E(S(ae.dimension,!1));if("measure"in ae)return v(S(ae.measure,!1));if("sql_native"in ae)return h({type:"sql native",rawType:ae.sql_native});if("calculation"in ae)return g(S(ae.calculation,!1));throw new Error("Invalid function blueprint")}function C(ae){return typeof ae=="string"||"array"in ae||"record"in ae||"generic"in ae||"literal"in ae||"constant"in ae||"dimension"in ae||"measure"in ae||"calculation"in ae||"sql_native"in ae}function b(ae){return C(ae)?[ae]:Array.isArray(ae)?ae:C(ae.variadic)?[ae.variadic]:ae.variadic}function T(ae){if(typeof ae=="string")return h({type:ae});if("generic"in ae)return h(S(ae));if("literal"in ae)return c(u(S(ae.literal)));if("constant"in ae)return a(u(S(ae.constant)));if("dimension"in ae)return u(S(ae.dimension));if("measure"in ae)return p(S(ae.measure));if("array"in ae)return h(S(ae,!1));if("record"in ae)return h(S(ae,!1));if("sql_native"in ae)return h({type:"sql native",rawType:ae.sql_native});if("calculation"in ae)return x(S(ae.calculation));throw new Error("Invalid function blueprint")}function N(ae){return ae.map(Z=>T(Z))}function k(ae){return typeof ae!="string"&&"variadic"in ae}function L(ae,Z){return{name:ae,allowedTypes:N(b(Z)),isVariadic:k(Z)}}function F(ae){return Object.entries(ae).map(ce=>L(ce[0],ce[1]))}function M(ae){const Z=[],ce=[];let ie=ae;for(;ie.length>0;){const me=ie.indexOf("${");if(me===-1){Z.push(ie);break}const Te=ie.slice(0,me);ie=ie.slice(me);const ye=ie.indexOf("}");if(ye===-1){Z.push(Te+ie);break}const be=ie.slice(2,ye);ie=ie.slice(ye+1);const pe=be.startsWith("..."),Pe=be.endsWith(":"),qe=pe?be.slice(3):Pe?be.slice(0,-1):be,Ue={node:"function_parameter",name:qe};Z.push(Te),pe?ce.push({node:"spread",e:Ue,prefix:"",suffix:""}):Pe&&qe==="order_by"?ce.push({node:"aggregate_order_by"}):Pe&&qe==="limit"?ce.push({node:"aggregate_limit"}):ce.push(Ue)}return{node:"genericSQLExpr",kids:{args:ce},src:Z}}function q(ae,Z){return k(Z)?{node:"spread",e:{node:"function_parameter",name:ae},prefix:"",suffix:""}:{node:"function_parameter",name:ae}}function B(ae,Z){const ce=Object.entries(Z.takes),ie=ce.length>0?ce.length-1:0;return{node:"genericSQLExpr",kids:{args:ce.map(xe=>q(xe[0],xe[1]))},src:[`${ae}(`,...Array(ie).fill(","),")"]}}function P(ae){return"sql"in ae.impl?M(ae.impl.sql):"expr"in ae.impl?ae.impl.expr:B(ae.impl.function,ae)}function Y(ae){return{e:P(ae),between:ae.impl.between,needsWindowOrderBy:ae.impl.needsWindowOrderBy,defaultOrderByArgIndex:ae.impl.defaultOrderByArgIndex}}function ee(ae){if(ae!==void 0)return Object.entries(ae).map(([Z,ce])=>({name:Z,acceptibleTypes:ce.map(ie=>S(ie,!0,!1))}))}function oe(ae){return{returnType:R(ae.returns),params:F(ae.takes),isSymmetric:ae.isSymmetric,supportsOrderBy:ae.supportsOrderBy,supportsLimit:ae.supportsLimit,genericTypes:ee(ae.generic),...Y(ae)}}function I(ae){return"takes"in ae&&"returns"in ae&&"impl"in ae}function X(ae){return"function"in ae||"sql"in ae||"expr"in ae}function G(ae){return I(ae)?[oe(ae)]:Object.values(ae).flatMap(Z=>oe(Z))}function te(ae){const Z={};for(const ce in ae)Z[ce]=G(ae[ce]);return Z}function V(ae,Z){return[oe({...ae,impl:Z})]}function se(ae,Z,ce){if(X(ce)){if(!I(Z))throw new Error(`Malformed function override: ${ae}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(Z)})`);return V(Z,ce)}else{if(I(Z))throw new Error(`Malformed function override: ${ae}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(ce)})`);return Object.entries(ce).flatMap(([ie,xe])=>{const me=Z[ie];if(me===void 0)throw new Error(`Malformed function override: ${ae}. No overload named ${ie}`);return V(me,xe)})}}function Ee(ae,Z){const ce={};for(const ie in Z){if(!(ie in ae))throw new Error(`Malformed function override: ${ie}. No such function in Malloy standard`);ce[ie]=se(ie,ae[ie],Z[ie])}return ce}function*ve(ae){if(typeof ae!="string"){if("generic"in ae)yield ae;else if("record"in ae)for(const Z of Object.values(ae.record))yield*ve(Z);else for(const Z of["array","literal","measure","dimension","measure","constant","cacluation"])if(Z in ae){yield*ve(ae[Z]);return}}}function le(ae,Z,ce,ie={}){let xe=!1;const me={};for(const ye of Object.values(Z))for(const be of ve(ye))me[be.generic]=["any"],xe=!0;xe&&ie.generic===void 0&&(ie.generic=me);const Te={takes:Z,returns:ce,impl:{function:ae.toUpperCase()},...ie};return{[ae]:Te}}return Hr}var ly={},gC;function za(){return gC||(gC=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Dialect=e.dayIndex=e.MAX_DECIMAL38=e.MIN_DECIMAL38=e.MAX_INT128=e.MIN_INT128=e.MAX_INT64=e.MIN_INT64=e.MAX_INT32=e.MIN_INT32=void 0,e.inDays=s,e.qtz=a;const t=st();e.MIN_INT32=-2147483648,e.MAX_INT32=2147483647,e.MIN_INT64=BigInt("-9223372036854775808"),e.MAX_INT64=BigInt("9223372036854775807"),e.MIN_INT128=BigInt("-170141183460469231731687303715884105728"),e.MAX_INT128=BigInt("170141183460469231731687303715884105727"),e.MIN_DECIMAL38=BigInt("-99999999999999999999999999999999999999"),e.MAX_DECIMAL38=BigInt("99999999999999999999999999999999999999");const r=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];e.dayIndex=r.indexOf("day");function s(c){return r.indexOf(c)>=e.dayIndex}function a(c){const d=c.queryTimezone;if(!(d===void 0||d===c.systemTimezone))return d}class o{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsArraysInData=!0,this.hasTimestamptz=!1,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsBigIntPrecision=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.maxIdentifierLength=128,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.requiresExplicitUnnestOrdering=!1,this.hasLateralColumnAliasInSelect=!1,this.supportsCountApprox=!1,this.supportsHyperLogLog=!1,this.supportsFullJoin=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0,this.booleanType="supported",this.likeEscape=!0,this.integerTypeMappings=[{min:BigInt(e.MIN_INT32),max:BigInt(e.MAX_INT32),numberType:"integer"},{min:e.MIN_INT64,max:e.MAX_INT64,numberType:"bigint"}]}sqlLateralJoinBag(d){throw this.cantPartitionWindowFunctionsOnExpressions?new Error(`Dialect '${this.name}' sets cantPartitionWindowFunctionsOnExpressions but does not implement sqlLateralJoinBag`):new Error("Internal error: sqlLateralJoinBag called but cantPartitionWindowFunctionsOnExpressions is false")}literalNumberType(d){if(!/^-?\d+$/.test(d))return{type:"number",numberType:"float"};const f=BigInt(d);for(const u of this.integerTypeMappings)if(f>=u.min&&f<=u.max)return{type:"number",numberType:u.numberType};return{type:"number",numberType:"bigint"}}static makeTimeLiteralNode(d,l,f,u,p){var h;const m=(h=d?.hasTimestamptz)!==null&&h!==void 0?h:!1;return p==="date"?{node:"dateLiteral",literal:l,typeDef:{type:"date",timeframe:u!==void 0&&(0,t.isDateUnit)(u)?u:void 0}}:f&&m?{node:"timestamptzLiteral",literal:l,typeDef:{type:"timestamptz",timeframe:u},timezone:f}:f?{node:"timestampLiteral",literal:l,typeDef:{type:"timestamp",timeframe:u},timezone:f}:{node:"timestampLiteral",literal:l,typeDef:{type:"timestamp",timeframe:u}}}sqlTurtleOrderByClause(d){const l=d.map(f=>` ${f.field} ${f.dir.toUpperCase()}`);return" "+this.sqlOrderBy(l,"turtle")}sqlFinalStage(d,l){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(d){return this.castToString(`DATE(${d})`)}sqlLiteralNumber(d){return d}ignoreInProject(d){return!1}needsCivilTimeComputation(d,l,f,u){const p=["day","week","month","quarter","year"],h=l!==void 0&&p.includes(l),m=f!==void 0&&p.includes(f),x=a(u);return{needed:t.TD.isAnyTimestamp(d)&&(h||m)&&x!==void 0,tz:x}}sqlTruncAndOffset(d,l,f,u){if(t.TD.isAnyTimestamp(d.typeDef)){const{needed:h,tz:m}=this.needsCivilTimeComputation(d.typeDef,f,u?.unit,l);if(h&&m){const x=this.sqlConvertToCivilTime(d.sql,m,d.typeDef);let E=x.sql;const v=x.typeDef;return f&&(E=this.sqlTruncate(E,f,v,!0,m)),u&&(E=this.sqlOffsetTime(E,u.op,u.magnitude,u.unit,v,!0,m)),this.sqlConvertFromCivilTime(E,m,d.typeDef)}}let p=d.sql;return f&&(p=this.sqlTruncate(p,f,d.typeDef,!1,a(l))),u&&(p=this.sqlOffsetTime(p,u.op,u.magnitude,u.unit,d.typeDef,!1,a(l))),p}exprToSQL(d,l){switch(l.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(l);case"delta":{const f=l.kids.base;return f.node==="trunc"?this.sqlTruncAndOffset(f.e,d,f.units,{op:l.op,magnitude:l.kids.delta.sql,unit:l.units}):this.sqlTruncAndOffset(f,d,void 0,{op:l.op,magnitude:l.kids.delta.sql,unit:l.units})}case"trunc":return this.sqlTruncAndOffset(l.e,d,l.units);case"extract":return this.sqlTimeExtractExpr(d,l);case"cast":return this.sqlCast(d,l);case"regexpMatch":return this.sqlRegexpMatch(l);case"/":return this.divisionIsInteger?`${l.kids.left.sql}*1.0/${l.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${l.kids.left.sql},${l.kids.right.sql})`;case"dateLiteral":return this.sqlDateLiteral(d,l.literal);case"timestampLiteral":return this.sqlTimestampLiteral(d,l.literal,l.timezone);case"timestamptzLiteral":return this.sqlTimestamptzLiteral(d,l.literal,l.timezone);case"stringLiteral":return this.sqlLiteralString(l.literal);case"numberLiteral":return this.sqlLiteralNumber(l.literal);case"regexpLiteral":return this.sqlLiteralRegexp(l.literal);case"recordLiteral":return this.sqlLiteralRecord(l);case"arrayLiteral":return this.sqlLiteralArray(l)}}sqlSumDistinct(d,l,f){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(d,l,f){return"sqlAggDistinct called but not implemented"}sqlSampleTable(d,l){if(l!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return d}sqlOrderBy(d,l){return`ORDER BY ${d.join(",")}`}sqlTzStr(d){return`"${d.queryTimezone}"`}sqlMakeUnnestKey(d,l){return this.concat(d,"'x'",l)}sqlStringAggDistinct(d,l,f){const u="__STRING_AGG_KS__",p="__STRING_AGG_KE__";return`REGEXP_REPLACE(
|
|
1
|
+
import{_ as vO,r as D,j as w,$ as gr,R as N4,a0 as F4,a1 as oo}from"./index-d5rvmoZ7.js";import{r as I4,a as G2,b as k4,c as M4,d as P4,e as B4,f as $4,g as q4,h as j4,j as W2,k as V2,l as N0,m as Gh,n as U4,o as CO,p as Q4,q as H4,s as G4,t as I3,u as k3,v as M3,w as At}from"./index-HHdhLUpv.js";import{a as w1}from"./index.umd-CetYIBQY.js";var va={},ay={},Hr={},uy={},pC;function st(){return pC||(pC=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TD=e.ValueType=void 0,e.safeRecordGet=r,e.mkSafeRecord=s,e.exprHasKids=a,e.exprHasE=o,e.exprIsLeaf=c,e.isAsymmetricExpr=d,e.mkTemporal=f,e.isRawCast=u,e.isFilterExprType=p,e.isTimeLiteral=h,e.isParameterType=m,e.paramHasValue=x,e.expressionIsScalar=E,e.expressionIsAggregate=v,e.expressionIsUngroupedAggregate=g,e.expressionInvolvesAggregate=_,e.expressionIsCalculation=S,e.expressionIsAnalytic=R,e.isExpressionTypeLEQ=b,e.maxExpressionType=T,e.maxOfExpressionTypes=N,e.hasExpression=k,e.isTemporalType=L,e.isBasicAtomicType=F,e.isAtomicFieldType=M,e.canOrderBy=q,e.fieldIsIntrinsic=B,e.mkFieldDef=P,e.mkArrayDef=Y,e.mkArrayTypeDef=ee,e.isRepeatedRecordFunctionParam=oe,e.isRepeatedRecord=I,e.isRecordOrRepeatedRecord=X,e.isBasicArray=G,e.isMatrixOperation=te,e.isJoinable=V,e.isJoined=se,e.isJoinedSource=Ee,e.isDateUnit=ve,e.isTimestampUnit=le,e.isExtractUnit=ae,e.refIsStructDef=ce,e.segmentHasErrors=ie,e.structHasErrors=xe,e.isReduceSegment=me,e.isPartialSegment=Te,e.isProjectSegment=ye,e.isQuerySegment=be,e.isSamplingRows=pe,e.isSamplingPercent=Pe,e.isSamplingEnable=qe,e.isRawSegment=Ue,e.isIndexSegment=pt,e.bareFieldUsage=gt,e.isSegmentSQL=St,e.isSegmentSource=Ot,e.isSourceRegistryReference=Qt,e.sourceBase=br,e.isSourceDef=rr,e.isPersistableSourceDef=Le,e.isBaseTable=We,e.isLiteral=wt,e.mergeEvalSpaces=He,e.isBasicAtomic=de,e.getIdentifier=he,e.isUserTypeDef=ke,e.isCompoundArrayData=Be,e.isTurtle=Ke,e.isAtomic=ot,e.isValueString=rt,e.isValueNumber=Nt,e.isValueBoolean=Rt,e.isValueTimestamp=Se,e.isValueDate=it,e.mergeUniqueKeyRequirement=Ge;const t=Object.prototype.hasOwnProperty;function r(re,we){return t.call(re,we)?re[we]:void 0}function s(){return Object.create(null)}function a(re){return"kids"in re}function o(re){return"e"in re}function c(re){return!(a(re)||o(re))}function d(re){return re.node==="aggregate"&&["sum","avg","count","distinct"].includes(re.function)}function l(re){return re.node!=="arrayLiteral"&&re.node!=="recordLiteral"}function f(re,we){if(!("typeDef"in re)){const Ye=typeof we=="string"?{type:we}:we;if(l(re))return{...re,typeDef:{...Ye}}}return re}function u(re){return"dstSQLType"in re}function p(re){return["string","number","boolean","date","timestamp","timestamptz"].includes(re)}function h(re){return re.node==="dateLiteral"||re.node==="timestampLiteral"||re.node==="timestamptzLiteral"}function m(re){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(re)}function x(re){return re.value!==null}function E(re){return re===void 0||re==="scalar"}function v(re){return re==="aggregate"||re==="ungrouped_aggregate"}function g(re){return re==="ungrouped_aggregate"}function _(re){return re==="aggregate"||re==="ungrouped_aggregate"||re==="aggregate_analytic"}function S(re){return re==="aggregate"||re==="scalar_analytic"||re==="aggregate_analytic"||re==="ungrouped_aggregate"}function R(re){return re==="aggregate_analytic"||re==="scalar_analytic"}function C(re){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[re]}function b(re,we){return re===we||C(re)<C(we)}function T(re,we){let Ye="scalar";return(re==="aggregate"||we==="aggregate")&&(Ye="aggregate"),(re==="ungrouped_aggregate"||we==="ungrouped_aggregate")&&(Ye="ungrouped_aggregate"),(re==="scalar_analytic"||we==="scalar_analytic")&&(Ye="scalar_analytic"),(re==="aggregate_analytic"||we==="aggregate_analytic")&&(Ye="aggregate_analytic"),(re==="scalar_analytic"&&we==="aggregate"||re==="aggregate"&&we==="scalar_analytic")&&(Ye="aggregate_analytic"),Ye}function N(re){return re.reduce(T,"scalar")}function k(re){return"e"in re&&re.e!==void 0}function L(re){return re==="date"||re==="timestamp"||re==="timestamptz"}function F(re){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(re)}function M(re){return F(re)||re==="record"||re==="array"}function q(re){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(re)}function B(re){return M(re.type)&&!k(re)}function P(re,we){if(G(re))return Y(re.elementTypeDef,we);if(I(re)){const{type:ze,fields:mt,elementTypeDef:vt}=re;return{type:ze,fields:mt,elementTypeDef:vt,join:"many",name:we}}if(re.type==="record"){const{type:ze,fields:mt}=re;return{type:ze,fields:mt,join:"one",name:we}}const Ye={name:we,type:re.type};switch(re.type){case"sql native":return{...Ye,rawType:re.rawType};case"number":{const ze=re.numberType;return ze?{...Ye,numberType:ze}:Ye}case"date":{const ze=re.timeframe;return ze?{name:we,type:"date",timeframe:ze}:Ye}case"timestamp":{const ze={name:we,type:"timestamp"};return re.timeframe&&(ze.timeframe=re.timeframe),ze}case"timestamptz":{const ze={name:we,type:"timestamptz"};return re.timeframe&&(ze.timeframe=re.timeframe),ze}}return Ye}function Y(re,we){if(re.type==="record")return{type:"array",join:"many",name:we,elementTypeDef:{type:"record_element"},fields:re.fields};const Ye=P(re,"value");return{type:"array",join:"many",name:we,elementTypeDef:re,fields:[Ye,{...Ye,name:"each",e:{node:"field",path:["value"]}}]}}function ee(re){return re.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:re.fields}:{type:"array",elementTypeDef:re}}function oe(re){return re.type==="array"&&re.elementTypeDef.type==="record_element"}function I(re){return re.type==="array"&&re.elementTypeDef.type==="record_element"}function X(re){return re.type==="record"||re.type==="array"&&"elementTypeDef"in re&&re.elementTypeDef.type==="record_element"}function G(re){return re.type==="array"&&re.elementTypeDef.type!=="record_element"}function te(re){return["left","right","full","inner"].includes(re)}function V(re){return["composite","table","sql_select","query_source","virtual","array","record"].includes(re.type)}function se(re){return"join"in re}function Ee(re){return rr(re)&&se(re)}function ve(re){return["day","week","month","quarter","year"].includes(re)}function le(re){return ve(re)||["hour","minute","second"].includes(re)}function ae(re){return le(re)||re==="day_of_week"||re==="day_of_year"}var Z;(function(re){re.Date="date",re.Timestamp="timestamp",re.Number="number",re.String="string"})(Z||(e.ValueType=Z={}));function ce(re){return typeof re!="string"}function ie(re){return!!((re.type==="reduce"||re.type==="project"||re.type==="partial")&&(re.extendSource&&re.extendSource.some(we=>we.type==="error")||re.queryFields.some(we=>we.type==="error")))}function xe(re){return re.fields.some(we=>we.type==="error")}function me(re){return re.type==="reduce"}function Te(re){return re.type==="partial"}function ye(re){return re.type==="project"}function be(re){return ye(re)||me(re)}function pe(re){return re.rows!==void 0}function Pe(re){return re.percent!==void 0}function qe(re){return re.enable!==void 0}function Ue(re){return re.type==="raw"}function pt(re){return re.type==="index"}function gt(re){return re.uniqueKeyRequirement===void 0&&re.analyticFunctionUse===void 0}function St(re){return"sql"in re}function Ot(re){return"type"in re&&(re.type==="sql_select"||re.type==="query_source")}function Qt(re){return re.type==="source_registry_reference"}function br(re){return{...re}}function rr(re){return re.type==="table"||re.type==="sql_select"||re.type==="query_source"||re.type==="query_result"||re.type==="finalize"||re.type==="nest_source"||re.type==="virtual"||re.type==="composite"}function Le(re){return re.type==="sql_select"||re.type==="query_source"}function We(re){return Ee(re)?!1:!!rr(re)}function wt(re){return re==="literal"}function He(...re){return re.length<=1&&re.every(we=>we==="literal")?"literal":re.every(we=>we==="constant"||we==="literal")?"constant":re.every(we=>we==="output"||we==="constant"||we==="literal")?"output":"input"}function de(re){return re.type==="string"||L(re.type)||re.type==="number"||re.type==="boolean"||re.type==="json"||re.type==="sql native"||re.type==="error"}function he(re){return re.as!==void 0?re.as:re.name}function ke(re){return re.type==="userType"}function Be(re){return Array.isArray(re)&&(re.length===0||typeof re[0]=="object"&&re[0]!==null&&!Array.isArray(re[0]))}function Ke(re){return re.type==="turtle"}function ot(re){return M(re.type)}function rt(re,we){return we.type==="string"}function Nt(re,we){return we.type==="number"}function Rt(re,we){return we.type==="boolean"}function Se(re,we){return we.type==="timestamp"}function it(re,we){return we.type==="date"}e.TD={isAtomic(re){return re!==void 0&&M(re.type)},isBasicAtomic(re){return re!==void 0&&de({type:re.type})},isString:re=>re?.type==="string",isNumber:re=>re?.type==="number",isBoolean:re=>re?.type==="boolean",isJSON:re=>re?.type==="json",isSQL:re=>re?.type==="sql native",isDate:re=>re?.type==="date",isTimestamp:re=>re?.type==="timestamp",isTimestamptz:re=>re?.type==="timestamptz",isAnyTimestamp(re){return re?.type==="timestamp"||re?.type==="timestamptz"},isTemporal(re){var we;const Ye=(we=re?.type)!==null&&we!==void 0?we:"";return L(Ye)},isError:re=>re?.type==="error",eq(re,we){if(re===void 0||we===void 0)return!1;function Ye(ze,mt){const vt={},Tt=ze.fields||[],at=mt.fields||[];if(Tt.length!==at.length)return!1;for(const Ct of Tt)if(Ct.name)vt[Ct.name]=Ct;else return!1;for(const Ct of at)if(!e.TD.eq(vt[Ct.name],Ct))return!1;return!0}return re.type==="array"&&we.type==="array"?re.elementTypeDef.type!==we.elementTypeDef.type?!1:re.elementTypeDef.type!=="record_element"&&we.elementTypeDef.type!=="record_element"?e.TD.eq(re.elementTypeDef,we.elementTypeDef):e.TD.isAtomic(re)&&e.TD.isAtomic(we)&&Ye(re,we):re.type==="record"&&we.type==="record"?e.TD.isAtomic(re)&&e.TD.isAtomic(we)&&Ye(re,we):re.type==="sql native"&&we.type==="sql native"?re.rawType!==void 0&&re.rawType===we.rawType:re.type===we.type}};function Ge(re,we){return re?we?{isCount:re.isCount||we.isCount}:re:we}})(uy)),uy}var mC;function ho(){if(mC)return Hr;mC=1,Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.arg=t,Hr.spread=r,Hr.sql=s,Hr.constant=a,Hr.output=o,Hr.literal=c,Hr.variadicParam=d,Hr.param=l,Hr.makeParam=f,Hr.maxScalar=u,Hr.maxAggregate=p,Hr.anyExprType=h,Hr.maxUngroupedAggregate=m,Hr.maxAnalytic=x,Hr.minScalar=E,Hr.minAggregate=v,Hr.minAnalytic=g,Hr.overload=_,Hr.expandBlueprintMap=te,Hr.expandOverrideMapFromBase=Ee,Hr.def=le;const e=st();function t(ae){return{node:"function_parameter",name:ae}}function r(ae,Z=void 0,ce=void 0){return{node:"spread",e:ae,prefix:Z,suffix:ce}}function s(ae,...Z){const ce={node:"genericSQLExpr",kids:{args:[]},src:[]},ie=[...Z];let xe="";for(const me of ae){xe+=me;const Te=ie.shift();Te!==void 0&&(typeof Te=="string"?xe+=Te:(ce.src.push(xe),ce.kids.args.push(Te),xe=""))}return xe.length>0&&ce.src.push(xe),ce}function a(ae){return{...ae,evalSpace:"constant"}}function o(ae){return{...ae,evalSpace:"output"}}function c(ae){return{...ae,evalSpace:"literal"}}function d(ae,...Z){return{name:ae,isVariadic:!0,allowedTypes:Z}}function l(ae,...Z){return{name:ae,isVariadic:!1,allowedTypes:Z}}function f(ae,...Z){return{param:l(ae,...Z),arg:t(ae)}}function u(ae){return{...ae,expressionType:"scalar",evalSpace:"input"}}function p(ae){return{...ae,expressionType:"aggregate",evalSpace:"input"}}function h(ae){return{...ae,expressionType:void 0,evalSpace:"input"}}function m(ae){return{...ae,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function x(ae){return{...ae,expressionType:"aggregate_analytic",evalSpace:"input"}}function E(ae){return{...ae,expressionType:"scalar",evalSpace:"input"}}function v(ae){return{...ae,expressionType:"aggregate",evalSpace:"input"}}function g(ae){return{...ae,expressionType:"scalar_analytic",evalSpace:"input"}}function _(ae,Z,ce,ie){return{returnType:ae,params:Z,e:ce,needsWindowOrderBy:ie?.needsWindowOrderBy,between:ie?.between,isSymmetric:ie?.isSymmetric,supportsOrderBy:ie?.supportsOrderBy,defaultOrderByArgIndex:ie?.defaultOrderByArgIndex,supportsLimit:ie?.supportsLimit}}function S(ae,Z=!0,ce=!0){if(!Z&&ae==="any")throw new Error("Return type cannot include any");if(typeof ae=="string")return{type:ae};if("array"in ae){const ie=Z?S(ae.array,!0):S(ae.array,!1);return ie.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ie.fields}:{type:"array",elementTypeDef:ie}}else if("record"in ae){const ie=[];for(const[xe,me]of Object.entries(ae.record)){const Te=Z?S(me,!0):S(me,!1);e.TD.isAtomic(Te)&&ie.push((0,e.mkFieldDef)(Te,xe))}return{type:"record",fields:ie}}else if("generic"in ae){if(!ce)throw new Error("Cannot use generic");return{type:"generic",generic:ae.generic}}else if("sql_native"in ae)return{type:"sql native",rawType:ae.sql_native};throw new Error("Cannot figure out type")}function R(ae){if(ae==="any")throw new Error("Cannot return any type");if(typeof ae=="string")return E({type:ae});if("array"in ae)return h(S(ae,!1));if("record"in ae)return h(S(ae,!1));if("generic"in ae)return E(S(ae,!1));if("literal"in ae)return c(E(S(ae.literal,!1)));if("constant"in ae)return a(E(S(ae.constant,!1)));if("dimension"in ae)return E(S(ae.dimension,!1));if("measure"in ae)return v(S(ae.measure,!1));if("sql_native"in ae)return h({type:"sql native",rawType:ae.sql_native});if("calculation"in ae)return g(S(ae.calculation,!1));throw new Error("Invalid function blueprint")}function C(ae){return typeof ae=="string"||"array"in ae||"record"in ae||"generic"in ae||"literal"in ae||"constant"in ae||"dimension"in ae||"measure"in ae||"calculation"in ae||"sql_native"in ae}function b(ae){return C(ae)?[ae]:Array.isArray(ae)?ae:C(ae.variadic)?[ae.variadic]:ae.variadic}function T(ae){if(typeof ae=="string")return h({type:ae});if("generic"in ae)return h(S(ae));if("literal"in ae)return c(u(S(ae.literal)));if("constant"in ae)return a(u(S(ae.constant)));if("dimension"in ae)return u(S(ae.dimension));if("measure"in ae)return p(S(ae.measure));if("array"in ae)return h(S(ae,!1));if("record"in ae)return h(S(ae,!1));if("sql_native"in ae)return h({type:"sql native",rawType:ae.sql_native});if("calculation"in ae)return x(S(ae.calculation));throw new Error("Invalid function blueprint")}function N(ae){return ae.map(Z=>T(Z))}function k(ae){return typeof ae!="string"&&"variadic"in ae}function L(ae,Z){return{name:ae,allowedTypes:N(b(Z)),isVariadic:k(Z)}}function F(ae){return Object.entries(ae).map(ce=>L(ce[0],ce[1]))}function M(ae){const Z=[],ce=[];let ie=ae;for(;ie.length>0;){const me=ie.indexOf("${");if(me===-1){Z.push(ie);break}const Te=ie.slice(0,me);ie=ie.slice(me);const ye=ie.indexOf("}");if(ye===-1){Z.push(Te+ie);break}const be=ie.slice(2,ye);ie=ie.slice(ye+1);const pe=be.startsWith("..."),Pe=be.endsWith(":"),qe=pe?be.slice(3):Pe?be.slice(0,-1):be,Ue={node:"function_parameter",name:qe};Z.push(Te),pe?ce.push({node:"spread",e:Ue,prefix:"",suffix:""}):Pe&&qe==="order_by"?ce.push({node:"aggregate_order_by"}):Pe&&qe==="limit"?ce.push({node:"aggregate_limit"}):ce.push(Ue)}return{node:"genericSQLExpr",kids:{args:ce},src:Z}}function q(ae,Z){return k(Z)?{node:"spread",e:{node:"function_parameter",name:ae},prefix:"",suffix:""}:{node:"function_parameter",name:ae}}function B(ae,Z){const ce=Object.entries(Z.takes),ie=ce.length>0?ce.length-1:0;return{node:"genericSQLExpr",kids:{args:ce.map(xe=>q(xe[0],xe[1]))},src:[`${ae}(`,...Array(ie).fill(","),")"]}}function P(ae){return"sql"in ae.impl?M(ae.impl.sql):"expr"in ae.impl?ae.impl.expr:B(ae.impl.function,ae)}function Y(ae){return{e:P(ae),between:ae.impl.between,needsWindowOrderBy:ae.impl.needsWindowOrderBy,defaultOrderByArgIndex:ae.impl.defaultOrderByArgIndex}}function ee(ae){if(ae!==void 0)return Object.entries(ae).map(([Z,ce])=>({name:Z,acceptibleTypes:ce.map(ie=>S(ie,!0,!1))}))}function oe(ae){return{returnType:R(ae.returns),params:F(ae.takes),isSymmetric:ae.isSymmetric,supportsOrderBy:ae.supportsOrderBy,supportsLimit:ae.supportsLimit,genericTypes:ee(ae.generic),...Y(ae)}}function I(ae){return"takes"in ae&&"returns"in ae&&"impl"in ae}function X(ae){return"function"in ae||"sql"in ae||"expr"in ae}function G(ae){return I(ae)?[oe(ae)]:Object.values(ae).flatMap(Z=>oe(Z))}function te(ae){const Z={};for(const ce in ae)Z[ce]=G(ae[ce]);return Z}function V(ae,Z){return[oe({...ae,impl:Z})]}function se(ae,Z,ce){if(X(ce)){if(!I(Z))throw new Error(`Malformed function override: ${ae}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(Z)})`);return V(Z,ce)}else{if(I(Z))throw new Error(`Malformed function override: ${ae}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(ce)})`);return Object.entries(ce).flatMap(([ie,xe])=>{const me=Z[ie];if(me===void 0)throw new Error(`Malformed function override: ${ae}. No overload named ${ie}`);return V(me,xe)})}}function Ee(ae,Z){const ce={};for(const ie in Z){if(!(ie in ae))throw new Error(`Malformed function override: ${ie}. No such function in Malloy standard`);ce[ie]=se(ie,ae[ie],Z[ie])}return ce}function*ve(ae){if(typeof ae!="string"){if("generic"in ae)yield ae;else if("record"in ae)for(const Z of Object.values(ae.record))yield*ve(Z);else for(const Z of["array","literal","measure","dimension","measure","constant","cacluation"])if(Z in ae){yield*ve(ae[Z]);return}}}function le(ae,Z,ce,ie={}){let xe=!1;const me={};for(const ye of Object.values(Z))for(const be of ve(ye))me[be.generic]=["any"],xe=!0;xe&&ie.generic===void 0&&(ie.generic=me);const Te={takes:Z,returns:ce,impl:{function:ae.toUpperCase()},...ie};return{[ae]:Te}}return Hr}var ly={},gC;function za(){return gC||(gC=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Dialect=e.dayIndex=e.MAX_DECIMAL38=e.MIN_DECIMAL38=e.MAX_INT128=e.MIN_INT128=e.MAX_INT64=e.MIN_INT64=e.MAX_INT32=e.MIN_INT32=void 0,e.inDays=s,e.qtz=a;const t=st();e.MIN_INT32=-2147483648,e.MAX_INT32=2147483647,e.MIN_INT64=BigInt("-9223372036854775808"),e.MAX_INT64=BigInt("9223372036854775807"),e.MIN_INT128=BigInt("-170141183460469231731687303715884105728"),e.MAX_INT128=BigInt("170141183460469231731687303715884105727"),e.MIN_DECIMAL38=BigInt("-99999999999999999999999999999999999999"),e.MAX_DECIMAL38=BigInt("99999999999999999999999999999999999999");const r=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];e.dayIndex=r.indexOf("day");function s(c){return r.indexOf(c)>=e.dayIndex}function a(c){const d=c.queryTimezone;if(!(d===void 0||d===c.systemTimezone))return d}class o{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsArraysInData=!0,this.hasTimestamptz=!1,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsBigIntPrecision=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.maxIdentifierLength=128,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.requiresExplicitUnnestOrdering=!1,this.hasLateralColumnAliasInSelect=!1,this.supportsCountApprox=!1,this.supportsHyperLogLog=!1,this.supportsFullJoin=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0,this.booleanType="supported",this.likeEscape=!0,this.integerTypeMappings=[{min:BigInt(e.MIN_INT32),max:BigInt(e.MAX_INT32),numberType:"integer"},{min:e.MIN_INT64,max:e.MAX_INT64,numberType:"bigint"}]}sqlLateralJoinBag(d){throw this.cantPartitionWindowFunctionsOnExpressions?new Error(`Dialect '${this.name}' sets cantPartitionWindowFunctionsOnExpressions but does not implement sqlLateralJoinBag`):new Error("Internal error: sqlLateralJoinBag called but cantPartitionWindowFunctionsOnExpressions is false")}literalNumberType(d){if(!/^-?\d+$/.test(d))return{type:"number",numberType:"float"};const f=BigInt(d);for(const u of this.integerTypeMappings)if(f>=u.min&&f<=u.max)return{type:"number",numberType:u.numberType};return{type:"number",numberType:"bigint"}}static makeTimeLiteralNode(d,l,f,u,p){var h;const m=(h=d?.hasTimestamptz)!==null&&h!==void 0?h:!1;return p==="date"?{node:"dateLiteral",literal:l,typeDef:{type:"date",timeframe:u!==void 0&&(0,t.isDateUnit)(u)?u:void 0}}:f&&m?{node:"timestamptzLiteral",literal:l,typeDef:{type:"timestamptz",timeframe:u},timezone:f}:f?{node:"timestampLiteral",literal:l,typeDef:{type:"timestamp",timeframe:u},timezone:f}:{node:"timestampLiteral",literal:l,typeDef:{type:"timestamp",timeframe:u}}}sqlTurtleOrderByClause(d){const l=d.map(f=>` ${f.field} ${f.dir.toUpperCase()}`);return" "+this.sqlOrderBy(l,"turtle")}sqlFinalStage(d,l){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(d){return this.castToString(`DATE(${d})`)}sqlLiteralNumber(d){return d}ignoreInProject(d){return!1}needsCivilTimeComputation(d,l,f,u){const p=["day","week","month","quarter","year"],h=l!==void 0&&p.includes(l),m=f!==void 0&&p.includes(f),x=a(u);return{needed:t.TD.isAnyTimestamp(d)&&(h||m)&&x!==void 0,tz:x}}sqlTruncAndOffset(d,l,f,u){if(t.TD.isAnyTimestamp(d.typeDef)){const{needed:h,tz:m}=this.needsCivilTimeComputation(d.typeDef,f,u?.unit,l);if(h&&m){const x=this.sqlConvertToCivilTime(d.sql,m,d.typeDef);let E=x.sql;const v=x.typeDef;return f&&(E=this.sqlTruncate(E,f,v,!0,m)),u&&(E=this.sqlOffsetTime(E,u.op,u.magnitude,u.unit,v,!0,m)),this.sqlConvertFromCivilTime(E,m,d.typeDef)}}let p=d.sql;return f&&(p=this.sqlTruncate(p,f,d.typeDef,!1,a(l))),u&&(p=this.sqlOffsetTime(p,u.op,u.magnitude,u.unit,d.typeDef,!1,a(l))),p}exprToSQL(d,l){switch(l.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(l);case"delta":{const f=l.kids.base;return f.node==="trunc"?this.sqlTruncAndOffset(f.e,d,f.units,{op:l.op,magnitude:l.kids.delta.sql,unit:l.units}):this.sqlTruncAndOffset(f,d,void 0,{op:l.op,magnitude:l.kids.delta.sql,unit:l.units})}case"trunc":return this.sqlTruncAndOffset(l.e,d,l.units);case"extract":return this.sqlTimeExtractExpr(d,l);case"cast":return this.sqlCast(d,l);case"regexpMatch":return this.sqlRegexpMatch(l);case"/":return this.divisionIsInteger?`${l.kids.left.sql}*1.0/${l.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${l.kids.left.sql},${l.kids.right.sql})`;case"dateLiteral":return this.sqlDateLiteral(d,l.literal);case"timestampLiteral":return this.sqlTimestampLiteral(d,l.literal,l.timezone);case"timestamptzLiteral":return this.sqlTimestamptzLiteral(d,l.literal,l.timezone);case"stringLiteral":return this.sqlLiteralString(l.literal);case"numberLiteral":return this.sqlLiteralNumber(l.literal);case"regexpLiteral":return this.sqlLiteralRegexp(l.literal);case"recordLiteral":return this.sqlLiteralRecord(l);case"arrayLiteral":return this.sqlLiteralArray(l)}}sqlSumDistinct(d,l,f){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(d,l,f){return"sqlAggDistinct called but not implemented"}sqlSampleTable(d,l){if(l!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return d}sqlOrderBy(d,l){return`ORDER BY ${d.join(",")}`}sqlTzStr(d){return`"${d.queryTimezone}"`}sqlMakeUnnestKey(d,l){return this.concat(d,"'x'",l)}sqlStringAggDistinct(d,l,f){const u="__STRING_AGG_KS__",p="__STRING_AGG_KE__";return`REGEXP_REPLACE(
|
|
2
2
|
STRING_AGG(DISTINCT ${`concat('${u}', ${d}, '${p}', ${l})`}${f.length>0?","+f:""}),
|
|
3
3
|
'${u}.*?${p}',
|
|
4
4
|
''
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a2 as I0,a3 as Mp}from"./index-
|
|
1
|
+
import{a2 as I0,a3 as Mp}from"./index-d5rvmoZ7.js";function qp(a,d){for(var y=0;y<d.length;y++){const m=d[y];if(typeof m!="string"&&!Array.isArray(m)){for(const h in m)if(h!=="default"&&!(h in a)){const u=Object.getOwnPropertyDescriptor(m,h);u&&Object.defineProperty(a,h,u.get?u:{enumerable:!0,get:()=>m[h]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}var mo={},Cr={},Xe={},Ma;function pe(){if(Ma)return Xe;Ma=1;/*!
|
|
2
2
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
3
3
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
4
4
|
*/Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.SuppressWarnings=Xe.Override=Xe.Nullable=Xe.NotNull=void 0;function a(h,u,r){}Xe.NotNull=a;function d(h,u,r){}Xe.Nullable=d;function y(h,u,r){}Xe.Override=y;function m(h){return(u,r,o)=>{}}return Xe.SuppressWarnings=m,Xe}var Or={},Dr={},qa;function Ve(){if(qa)return Dr;qa=1;/*!
|