@malloy-publisher/sdk 0.0.232 → 0.0.233

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.
@@ -1,4 +1,4 @@
1
- import { A as e, a as o, C as i, b as t, aj as n, d as r, e as p, c as A, s as c, p as m, r as u, q as l, x as P, t as C, w as E, v as F, D as y, E as b, y as g, B as M, z as k, J as S, G as d, I as h, H as x, a2 as T, F as v, f as z, L as D, M as N, V as f, h as W, U as R, K as B, Q, O as j, Z as I, W as L, Y as O, X as q, i as w, N as G, a1 as H, _ as J, a0 as K, $ as U, k as V, j as X, P as Y, l as Z, a6 as _, a3 as $, a5 as aa, a4 as sa, m as ea, aa as oa, a7 as ia, a9 as ta, a8 as na, n as ra, ae as pa, ab as Aa, ad as ca, ac as ma, R as ua, S as la, o as Pa, T as Ca, ai as Ea, af as Fa, ah as ya, ag as ba, g as ga, u as Ma } from "../ServerProvider-DMk_BDrm.es.js";
1
+ import { A as e, a as o, C as i, b as t, ak as n, d as r, e as p, c as A, s as u, p as m, r as c, q as l, x as P, t as C, w as E, v as y, D as F, E as b, y as g, B as k, z as M, J as S, G as d, I as h, H as x, a3 as T, F as v, f as z, L as D, M as N, W as f, h as R, V as W, K as Q, U as B, O as L, _ as j, X as w, Z as I, Y as O, i as q, N as G, a2 as H, $ as J, a1 as K, a0 as U, k as V, j as X, P as Y, l as Z, a7 as _, a4 as $, a6 as aa, a5 as sa, m as ea, ab as oa, a8 as ia, aa as ta, a9 as na, n as ra, af as pa, ac as Aa, ae as ua, ad as ma, Q as ca, R as la, S as Pa, o as Ca, T as Ea, aj as ya, ag as Fa, ai as ba, ah as ga, g as ka, u as Ma } from "../ServerProvider-W0vDe2Mt.es.js";
2
2
  export {
3
3
  e as AttachedDatabaseTypeEnum,
4
4
  o as AzureConnectionAuthTypeEnum,
@@ -8,19 +8,19 @@ export {
8
8
  r as ConnectionProxyTypeEnum,
9
9
  p as ConnectionStatusStatusEnum,
10
10
  A as ConnectionTypeEnum,
11
- c as ConnectionsApi,
11
+ u as ConnectionsApi,
12
12
  m as ConnectionsApiAxiosParamCreator,
13
- u as ConnectionsApiFactory,
13
+ c as ConnectionsApiFactory,
14
14
  l as ConnectionsApiFp,
15
15
  P as ConnectionsTestApi,
16
16
  C as ConnectionsTestApiAxiosParamCreator,
17
17
  E as ConnectionsTestApiFactory,
18
- F as ConnectionsTestApiFp,
19
- y as DatabaseTypeEnum,
18
+ y as ConnectionsTestApiFp,
19
+ F as DatabaseTypeEnum,
20
20
  b as DatabasesApi,
21
21
  g as DatabasesApiAxiosParamCreator,
22
- M as DatabasesApiFactory,
23
- k as DatabasesApiFp,
22
+ k as DatabasesApiFactory,
23
+ M as DatabasesApiFp,
24
24
  S as EnvironmentsApi,
25
25
  d as EnvironmentsApiAxiosParamCreator,
26
26
  h as EnvironmentsApiFactory,
@@ -31,16 +31,16 @@ export {
31
31
  D as LogMessageSeverityEnum,
32
32
  N as ManifestEntryFreshnessFallbackEnum,
33
33
  f as MaterializationActionActionEnum,
34
- W as MaterializationStatus,
35
- R as MaterializationsApi,
36
- B as MaterializationsApiAxiosParamCreator,
37
- Q as MaterializationsApiFactory,
38
- j as MaterializationsApiFp,
39
- I as ModelsApi,
40
- L as ModelsApiAxiosParamCreator,
41
- O as ModelsApiFactory,
42
- q as ModelsApiFp,
43
- w as NotebookCellResultTypeEnum,
34
+ R as MaterializationStatus,
35
+ W as MaterializationsApi,
36
+ Q as MaterializationsApiAxiosParamCreator,
37
+ B as MaterializationsApiFactory,
38
+ L as MaterializationsApiFp,
39
+ j as ModelsApi,
40
+ w as ModelsApiAxiosParamCreator,
41
+ I as ModelsApiFactory,
42
+ O as ModelsApiFp,
43
+ q as NotebookCellResultTypeEnum,
44
44
  G as NotebookCellTypeEnum,
45
45
  H as NotebooksApi,
46
46
  J as NotebooksApiAxiosParamCreator,
@@ -62,16 +62,17 @@ export {
62
62
  ra as PostgresConnectionSslmodeEnum,
63
63
  pa as PublisherApi,
64
64
  Aa as PublisherApiAxiosParamCreator,
65
- ca as PublisherApiFactory,
65
+ ua as PublisherApiFactory,
66
66
  ma as PublisherApiFp,
67
- ua as Realization,
68
- la as ServerProvider,
69
- Pa as ServerStatusOperationalStateEnum,
70
- Ca as ThemeDefaultModeEnum,
71
- Ea as WatchModeApi,
67
+ ca as QueryResultQueryRowLimitSourceEnum,
68
+ la as Realization,
69
+ Pa as ServerProvider,
70
+ Ca as ServerStatusOperationalStateEnum,
71
+ Ea as ThemeDefaultModeEnum,
72
+ ya as WatchModeApi,
72
73
  Fa as WatchModeApiAxiosParamCreator,
73
- ya as WatchModeApiFactory,
74
- ba as WatchModeApiFp,
75
- ga as globalQueryClient,
74
+ ba as WatchModeApiFactory,
75
+ ga as WatchModeApiFp,
76
+ ka as globalQueryClient,
76
77
  Ma as useServer
77
78
  };
@@ -1,5 +1,5 @@
1
1
  import { createOnigurumaEngine as vt, getDefaultWasmLoader as Pr, loadWasm as Or } from "./engine-oniguruma-C4vnmooL.es.js";
2
- import { w as At, s as wn, f as Mr, a as Fr, b as Br, c as Dt, z as jr, h as Dr, d as Ur } from "./index-3Ctefu0u.es.js";
2
+ import { w as At, s as wn, f as Mr, a as Fr, b as Br, c as Dt, z as jr, h as Dr, d as Ur } from "./index-RGokBmF6.es.js";
3
3
  let V = class extends Error {
4
4
  constructor(e) {
5
5
  super(e), this.name = "ShikiError";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=require("./engine-oniguruma-BkproSVE.cjs.js"),P=require("./index-D0RRMPyp.cjs.js");let q=class extends Error{constructor(e){super(e),this.name="ShikiError"}},$e=!1,In=!1;function zr(t=!0,e=!1){$e=t,In=e}function B(t,e=3){if($e&&!(typeof $e=="number"&&e>$e)){if(In)throw new Error(`[SHIKI DEPRECATE]: ${t}`);console.trace(`[SHIKI DEPRECATE]: ${t}`)}}function Vr(t){return Tt(t)}function Tt(t){return Array.isArray(t)?Kr(t):t instanceof RegExp?t:typeof t=="object"?Qr(t):t}function Kr(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=Tt(t[n]);return e}function Qr(t){let e={};for(let n in t)e[n]=Tt(t[n]);return e}function Nn(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function xn(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?xn(t.substring(0,t.length-1)):t.substr(~e+1)}var st=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Re=class{static hasCaptures(t){return t===null?!1:(st.lastIndex=0,st.test(t))}static replaceCaptures(t,e,n){return t.replace(st,(r,s,a,i)=>{let o=n[parseInt(s||a,10)];if(o){let c=e.substring(o.start,o.end);for(;c[0]===".";)c=c.substring(1);switch(i){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Tn(t,e){return t<e?-1:t>e?1:0}function $n(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=Tn(t[s],e[s]);if(a!==0)return a}return 0}return n-r}function Qt(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 Gn(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ln=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}},Oe=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Zr(t),e)}static createFromParsedTheme(t,e){return es(t,e)}_cachedMatchRoot=new Ln(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,r=this._cachedMatchRoot.get(e).find(s=>Jr(t.parent,s.parentScopes));return r?new Pn(r.fontStyle,r.foreground,r.background):null}},at=class Ge{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Ge(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new Ge(n,e[r]);return n}push(e){return new Ge(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 Jr(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&&!Xr(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Xr(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var Pn=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Zr(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 i=e[s];if(!i.settings)continue;let o;if(typeof i.scope=="string"){let h=i.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),o=h.split(",")}else Array.isArray(i.scope)?o=i.scope:o=[""];let c=-1;if(typeof i.settings.fontStyle=="string"){c=0;let h=i.settings.fontStyle.split(" ");for(let g=0,f=h.length;g<f;g++)switch(h[g]){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 i.settings.foreground=="string"&&Qt(i.settings.foreground)&&(l=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Qt(i.settings.background)&&(u=i.settings.background);for(let h=0,g=o.length;h<g;h++){let p=o[h].trim().split(" "),b=p[p.length-1],m=null;p.length>1&&(m=p.slice(0,p.length-1),m.reverse()),n[r++]=new Yr(b,m,s,c,l,u)}}return n}var Yr=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}},H=(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))(H||{});function es(t,e){t.sort((c,l)=>{let u=Tn(c.scope,l.scope);return u!==0||(u=$n(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 ts(e),i=new Pn(n,a.getId(r),a.getId(s)),o=new rs(new Ct(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let u=t[c];o.insert(0,u.scope,u.parentScopes,u.fontStyle,a.getId(u.foreground),a.getId(u.background))}return new Oe(a,i,o)}var ts=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)}},ns=Object.freeze([]),Ct=class On{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,a){this.scopeDepth=e,this.parentScopes=n||ns,this.fontStyle=r,this.foreground=s,this.background=a}clone(){return new On(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)}},rs=class _t{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(_t._cmpBySpecificity),n}insert(e,n,r,s,a,i){if(n===""){this._doInsertHere(e,r,s,a,i);return}let o=n.indexOf("."),c,l;o===-1?(c=n,l=""):(c=n.substring(0,o),l=n.substring(o+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new _t(this._mainRule.clone(),Ct.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(e+1,l,r,s,a,i)}_doInsertHere(e,n,r,s,a){if(n===null){this._mainRule.acceptOverwrite(e,r,s,a);return}for(let i=0,o=this._rulesWithParentScopes.length;i<o;i++){let c=this._rulesWithParentScopes[i];if($n(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 Ct(e,n,r,s,a))}},ne=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),i=M.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:a,background:i})}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,i,o){let c=M.getLanguageId(e),l=M.getTokenType(e),u=M.containsBalancedBrackets(e)?1:0,h=M.getFontStyle(e),g=M.getForeground(e),f=M.getBackground(e);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),a!==-1&&(h=a),i!==0&&(g=i),o!==0&&(f=o),(c<<0|l<<8|u<<10|h<<11|g<<15|f<<24)>>>0}};function Me(t,e){const n=[],r=ss(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=i();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=o();return s===")"&&(s=r.next()),c}if(Jt(s)){const c=[];do c.push(s),s=r.next();while(Jt(s));return l=>e(c,l)}return null}function i(){const c=[];let l=a();for(;l;)c.push(l),l=a();return u=>c.every(h=>h(u))}function o(){const c=[];let l=i();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return u=>c.some(h=>h(u))}}function Jt(t){return!!t&&!!t.match(/[\w\.:]+/)}function ss(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 Mn(t){typeof t.dispose=="function"&&t.dispose()}var Ce=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},as=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},is=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))}},os=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ce(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new is;for(const n of t)cs(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Ce){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 cs(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 Ce?Le({baseGrammar:a,selfGrammar:s},r):yt(t.ruleName,{baseGrammar:a,selfGrammar:s,repository:s.repository},r);const i=n.injections(t.scopeName);if(i)for(const o of i)r.add(new Ce(o))}function yt(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];Fe([r],e,n)}}function Le(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Fe(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Fe(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Fe(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Nn({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&Fe(r.patterns,{...e,repository:s},n);const a=r.include;if(!a)continue;const i=Fn(a);switch(i.kind){case 0:Le({...e,selfGrammar:e.baseGrammar},n);break;case 1:Le(e,n);break;case 2:yt(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const o=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(o){const c={baseGrammar:e.baseGrammar,selfGrammar:o,repository:s};i.kind===4?yt(i.ruleName,c,n):Le(c,n)}else i.kind===4?n.add(new as(i.scopeName,i.ruleName)):n.add(new Ce(i.scopeName));break}}}var ls=class{kind=0},us=class{kind=1},hs=class{constructor(t){this.ruleName=t}kind=2},fs=class{constructor(t){this.scopeName=t}kind=3},ps=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Fn(t){if(t==="$base")return new ls;if(t==="$self")return new us;const e=t.indexOf("#");if(e===-1)return new fs(t);if(e===0)return new hs(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new ps(n,r)}}var gs=/\\(\d+)/,Xt=/\\(\d+)/g,ds=-1,Bn=-2;var 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=Re.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Re.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${xn(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:Re.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Re.replaceCaptures(this._contentName,t,e)}},ms=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!")}},Cs=class extends ke{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new _e(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 ye,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Zt=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 ye,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},bt=class extends ke{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,a,i,o,c,l){super(t,e,n,r),this._begin=new _e(s,this.id),this.beginCaptures=a,this._end=new _e(i||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,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 ye;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}},Be=class extends ke{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,a,i,o,c){super(t,e,n,r),this._begin=new _e(s,this.id),this.beginCaptures=a,this.whileCaptures=o,this._while=new _e(i,Bn),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 ye;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 ye,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},jn=class T{static createCaptureRule(e,n,r,s,a){return e.registerRule(i=>new ms(n,i,r,s,a))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new Cs(e.$vscodeTextmateLocation,e.id,e.name,e.match,T._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=Nn({},r,e.repository));let a=e.patterns;return typeof a>"u"&&e.include&&(a=[{include:e.include}]),new Zt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,T._compilePatterns(a,n,r))}return e.while?new Be(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,T._compileCaptures(e.whileCaptures||e.captures,n,r),T._compilePatterns(e.patterns,n,r)):new bt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,T._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,T._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let a=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const o=parseInt(i,10);o>a&&(a=o)}for(let i=0;i<=a;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const o=parseInt(i,10);let c=0;e[i].patterns&&(c=T.getCompiledRuleId(e[i],n,r)),s[o]=T.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,c)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let a=0,i=e.length;a<i;a++){const o=e[a];let c=-1;if(o.include){const l=Fn(o.include);switch(l.kind){case 0:case 1:c=T.getCompiledRuleId(r[o.include],n,r);break;case 2:let u=r[l.ruleName];u&&(c=T.getCompiledRuleId(u,n,r));break;case 3:case 4:const h=l.scopeName,g=l.kind===4?l.ruleName:null,f=n.getExternalGrammar(h,r);if(f)if(g){let p=f.repository[g];p&&(c=T.getCompiledRuleId(p,n,f.repository))}else c=T.getCompiledRuleId(f.repository.$self,n,f.repository);break}}else c=T.getCompiledRuleId(o,n,r);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof Zt||l instanceof bt||l instanceof Be)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},_e=class Dn{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,a=[],i=!1;for(let o=0;o<r;o++)if(e.charAt(o)==="\\"&&o+1<r){const l=e.charAt(o+1);l==="z"?(a.push(e.substring(s,o)),a.push("$(?!\\n)(?<!\\n)"),s=o+2):(l==="A"||l==="G")&&(i=!0),o++}this.hasAnchor=i,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=gs.test(this.source):this.hasBackReferences=!1}clone(){return new Dn(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 Xt.lastIndex=0,this.source.replace(Xt,(s,a)=>Gn(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,i,o,c;for(a=0,i=this.source.length;a<i;a++)o=this.source.charAt(a),e[a]=o,n[a]=o,r[a]=o,s[a]=o,o==="\\"&&a+1<i&&(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}},ye=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 Yt(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 Yt(t,r,this._items.map(s=>s.ruleId))}},Yt=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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=require("./engine-oniguruma-BkproSVE.cjs.js"),P=require("./index-C1vfuzAJ.cjs.js");let q=class extends Error{constructor(e){super(e),this.name="ShikiError"}},$e=!1,In=!1;function zr(t=!0,e=!1){$e=t,In=e}function B(t,e=3){if($e&&!(typeof $e=="number"&&e>$e)){if(In)throw new Error(`[SHIKI DEPRECATE]: ${t}`);console.trace(`[SHIKI DEPRECATE]: ${t}`)}}function Vr(t){return Tt(t)}function Tt(t){return Array.isArray(t)?Kr(t):t instanceof RegExp?t:typeof t=="object"?Qr(t):t}function Kr(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=Tt(t[n]);return e}function Qr(t){let e={};for(let n in t)e[n]=Tt(t[n]);return e}function Nn(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function xn(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?xn(t.substring(0,t.length-1)):t.substr(~e+1)}var st=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Re=class{static hasCaptures(t){return t===null?!1:(st.lastIndex=0,st.test(t))}static replaceCaptures(t,e,n){return t.replace(st,(r,s,a,i)=>{let o=n[parseInt(s||a,10)];if(o){let c=e.substring(o.start,o.end);for(;c[0]===".";)c=c.substring(1);switch(i){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Tn(t,e){return t<e?-1:t>e?1:0}function $n(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=Tn(t[s],e[s]);if(a!==0)return a}return 0}return n-r}function Qt(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 Gn(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ln=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}},Oe=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Zr(t),e)}static createFromParsedTheme(t,e){return es(t,e)}_cachedMatchRoot=new Ln(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,r=this._cachedMatchRoot.get(e).find(s=>Jr(t.parent,s.parentScopes));return r?new Pn(r.fontStyle,r.foreground,r.background):null}},at=class Ge{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Ge(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new Ge(n,e[r]);return n}push(e){return new Ge(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 Jr(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&&!Xr(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Xr(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var Pn=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Zr(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 i=e[s];if(!i.settings)continue;let o;if(typeof i.scope=="string"){let h=i.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),o=h.split(",")}else Array.isArray(i.scope)?o=i.scope:o=[""];let c=-1;if(typeof i.settings.fontStyle=="string"){c=0;let h=i.settings.fontStyle.split(" ");for(let g=0,f=h.length;g<f;g++)switch(h[g]){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 i.settings.foreground=="string"&&Qt(i.settings.foreground)&&(l=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Qt(i.settings.background)&&(u=i.settings.background);for(let h=0,g=o.length;h<g;h++){let p=o[h].trim().split(" "),b=p[p.length-1],m=null;p.length>1&&(m=p.slice(0,p.length-1),m.reverse()),n[r++]=new Yr(b,m,s,c,l,u)}}return n}var Yr=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}},H=(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))(H||{});function es(t,e){t.sort((c,l)=>{let u=Tn(c.scope,l.scope);return u!==0||(u=$n(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 ts(e),i=new Pn(n,a.getId(r),a.getId(s)),o=new rs(new Ct(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let u=t[c];o.insert(0,u.scope,u.parentScopes,u.fontStyle,a.getId(u.foreground),a.getId(u.background))}return new Oe(a,i,o)}var ts=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)}},ns=Object.freeze([]),Ct=class On{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,a){this.scopeDepth=e,this.parentScopes=n||ns,this.fontStyle=r,this.foreground=s,this.background=a}clone(){return new On(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)}},rs=class _t{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(_t._cmpBySpecificity),n}insert(e,n,r,s,a,i){if(n===""){this._doInsertHere(e,r,s,a,i);return}let o=n.indexOf("."),c,l;o===-1?(c=n,l=""):(c=n.substring(0,o),l=n.substring(o+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new _t(this._mainRule.clone(),Ct.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(e+1,l,r,s,a,i)}_doInsertHere(e,n,r,s,a){if(n===null){this._mainRule.acceptOverwrite(e,r,s,a);return}for(let i=0,o=this._rulesWithParentScopes.length;i<o;i++){let c=this._rulesWithParentScopes[i];if($n(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 Ct(e,n,r,s,a))}},ne=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),i=M.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:a,background:i})}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,i,o){let c=M.getLanguageId(e),l=M.getTokenType(e),u=M.containsBalancedBrackets(e)?1:0,h=M.getFontStyle(e),g=M.getForeground(e),f=M.getBackground(e);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),a!==-1&&(h=a),i!==0&&(g=i),o!==0&&(f=o),(c<<0|l<<8|u<<10|h<<11|g<<15|f<<24)>>>0}};function Me(t,e){const n=[],r=ss(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=i();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=o();return s===")"&&(s=r.next()),c}if(Jt(s)){const c=[];do c.push(s),s=r.next();while(Jt(s));return l=>e(c,l)}return null}function i(){const c=[];let l=a();for(;l;)c.push(l),l=a();return u=>c.every(h=>h(u))}function o(){const c=[];let l=i();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return u=>c.some(h=>h(u))}}function Jt(t){return!!t&&!!t.match(/[\w\.:]+/)}function ss(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 Mn(t){typeof t.dispose=="function"&&t.dispose()}var Ce=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},as=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},is=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))}},os=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ce(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new is;for(const n of t)cs(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Ce){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 cs(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 Ce?Le({baseGrammar:a,selfGrammar:s},r):yt(t.ruleName,{baseGrammar:a,selfGrammar:s,repository:s.repository},r);const i=n.injections(t.scopeName);if(i)for(const o of i)r.add(new Ce(o))}function yt(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];Fe([r],e,n)}}function Le(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Fe(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Fe(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Fe(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Nn({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&Fe(r.patterns,{...e,repository:s},n);const a=r.include;if(!a)continue;const i=Fn(a);switch(i.kind){case 0:Le({...e,selfGrammar:e.baseGrammar},n);break;case 1:Le(e,n);break;case 2:yt(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const o=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(o){const c={baseGrammar:e.baseGrammar,selfGrammar:o,repository:s};i.kind===4?yt(i.ruleName,c,n):Le(c,n)}else i.kind===4?n.add(new as(i.scopeName,i.ruleName)):n.add(new Ce(i.scopeName));break}}}var ls=class{kind=0},us=class{kind=1},hs=class{constructor(t){this.ruleName=t}kind=2},fs=class{constructor(t){this.scopeName=t}kind=3},ps=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Fn(t){if(t==="$base")return new ls;if(t==="$self")return new us;const e=t.indexOf("#");if(e===-1)return new fs(t);if(e===0)return new hs(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new ps(n,r)}}var gs=/\\(\d+)/,Xt=/\\(\d+)/g,ds=-1,Bn=-2;var 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=Re.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Re.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${xn(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:Re.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Re.replaceCaptures(this._contentName,t,e)}},ms=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!")}},Cs=class extends ke{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new _e(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 ye,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Zt=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 ye,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},bt=class extends ke{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,a,i,o,c,l){super(t,e,n,r),this._begin=new _e(s,this.id),this.beginCaptures=a,this._end=new _e(i||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,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 ye;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}},Be=class extends ke{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,a,i,o,c){super(t,e,n,r),this._begin=new _e(s,this.id),this.beginCaptures=a,this.whileCaptures=o,this._while=new _e(i,Bn),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 ye;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 ye,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},jn=class T{static createCaptureRule(e,n,r,s,a){return e.registerRule(i=>new ms(n,i,r,s,a))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new Cs(e.$vscodeTextmateLocation,e.id,e.name,e.match,T._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=Nn({},r,e.repository));let a=e.patterns;return typeof a>"u"&&e.include&&(a=[{include:e.include}]),new Zt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,T._compilePatterns(a,n,r))}return e.while?new Be(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,T._compileCaptures(e.whileCaptures||e.captures,n,r),T._compilePatterns(e.patterns,n,r)):new bt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,T._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,T._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let a=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const o=parseInt(i,10);o>a&&(a=o)}for(let i=0;i<=a;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const o=parseInt(i,10);let c=0;e[i].patterns&&(c=T.getCompiledRuleId(e[i],n,r)),s[o]=T.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,c)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let a=0,i=e.length;a<i;a++){const o=e[a];let c=-1;if(o.include){const l=Fn(o.include);switch(l.kind){case 0:case 1:c=T.getCompiledRuleId(r[o.include],n,r);break;case 2:let u=r[l.ruleName];u&&(c=T.getCompiledRuleId(u,n,r));break;case 3:case 4:const h=l.scopeName,g=l.kind===4?l.ruleName:null,f=n.getExternalGrammar(h,r);if(f)if(g){let p=f.repository[g];p&&(c=T.getCompiledRuleId(p,n,f.repository))}else c=T.getCompiledRuleId(f.repository.$self,n,f.repository);break}}else c=T.getCompiledRuleId(o,n,r);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof Zt||l instanceof bt||l instanceof Be)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},_e=class Dn{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,a=[],i=!1;for(let o=0;o<r;o++)if(e.charAt(o)==="\\"&&o+1<r){const l=e.charAt(o+1);l==="z"?(a.push(e.substring(s,o)),a.push("$(?!\\n)(?<!\\n)"),s=o+2):(l==="A"||l==="G")&&(i=!0),o++}this.hasAnchor=i,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=gs.test(this.source):this.hasBackReferences=!1}clone(){return new Dn(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 Xt.lastIndex=0,this.source.replace(Xt,(s,a)=>Gn(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,i,o,c;for(a=0,i=this.source.length;a<i;a++)o=this.source.charAt(a),e[a]=o,n[a]=o,r[a]=o,s[a]=o,o==="\\"&&a+1<i&&(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}},ye=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 Yt(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 Yt(t,r,this._items.map(s=>s.ruleId))}},Yt=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}},it=class{constructor(t,e){this.languageId=t,this.tokenType=e}},_s=class wt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new it(e,8),this._embeddedLanguagesMatcher=new ys(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?wt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new it(0,0);_getBasicScopeAttributes=new Ln(e=>{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new it(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(wt.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/},ys=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])=>Gn(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])}};typeof process<"u"&&process.env.VSCODE_TEXTMATE_DEBUG;var en=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Un(t,e,n,r,s,a,i,o){const c=e.content.length;let l=!1,u=-1;if(i){const f=bs(t,e,n,r,s,a);s=f.stack,r=f.linePos,n=f.isFirstLine,u=f.anchorPosition}const h=Date.now();for(;!l;){if(o!==0&&Date.now()-h>o)return new en(s,!0);g()}return new en(s,!1);function g(){const f=ws(t,e,n,r,s,u);if(!f){a.produce(s,c),l=!0;return}const p=f.captureIndices,b=f.matchedRuleId,m=p&&p.length>0?p[0].end>r:!1;if(b===ds){const w=s.getRule(t);a.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),pe(t,e,n,s,a,w.endCaptures,p),a.produce(s,p[0].end);const C=s;if(s=s.parent,u=C.getAnchorPos(),!m&&C.getEnterPos()===r){s=C,a.produce(s,c),l=!0;return}}else{const w=t.getRule(b);a.produce(s,p[0].start);const C=s,S=w.getName(e.content,p),N=s.contentNameScopesList.pushAttributed(S,t);if(s=s.push(b,r,u,p[0].end===c,null,N,N),w instanceof bt){const A=w;pe(t,e,n,s,a,A.beginCaptures,p),a.produce(s,p[0].end),u=p[0].end;const D=A.getContentName(e.content,p),L=N.pushAttributed(D,t);if(s=s.withContentNameScopesList(L),A.endHasBackReferences&&(s=s.withEndRule(A.getEndWithResolvedBackReferences(e.content,p))),!m&&C.hasSameRuleAs(s)){s=s.pop(),a.produce(s,c),l=!0;return}}else if(w instanceof Be){const A=w;pe(t,e,n,s,a,A.beginCaptures,p),a.produce(s,p[0].end),u=p[0].end;const D=A.getContentName(e.content,p),L=N.pushAttributed(D,t);if(s=s.withContentNameScopesList(L),A.whileHasBackReferences&&(s=s.withEndRule(A.getWhileWithResolvedBackReferences(e.content,p))),!m&&C.hasSameRuleAs(s)){s=s.pop(),a.produce(s,c),l=!0;return}}else if(pe(t,e,n,s,a,w.captures,p),a.produce(s,p[0].end),s=s.pop(),!m){s=s.safePop(),a.produce(s,c),l=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function bs(t,e,n,r,s,a){let i=s.beginRuleCapturedEOL?0:-1;const o=[];for(let c=s;c;c=c.pop()){const l=c.getRule(t);l instanceof Be&&o.push({rule:l,stack:c})}for(let c=o.pop();c;c=o.pop()){const{ruleScanner:l,findOptions:u}=vs(c.rule,t,c.stack.endRule,n,r===i),h=l.findNextMatchSync(e,r,u);if(h){if(h.ruleId!==Bn){s=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(a.produce(c.stack,h.captureIndices[0].start),pe(t,e,n,c.stack,a,c.rule.whileCaptures,h.captureIndices),a.produce(c.stack,h.captureIndices[0].end),i=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:i,isFirstLine:n}}function ws(t,e,n,r,s,a){const i=Ss(t,e,n,r,s,a),o=t.getInjections();if(o.length===0)return i;const c=ks(o,t,e,n,r,s,a);if(!c)return i;if(!i)return c;const l=i.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:i}function Ss(t,e,n,r,s,a){const i=s.getRule(t),{ruleScanner:o,findOptions:c}=Wn(i,t,s.endRule,n,r===a),l=o.findNextMatchSync(e,r,c);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function ks(t,e,n,r,s,a,i){let o=Number.MAX_VALUE,c=null,l,u=0;const h=a.contentNameScopesList.getScopeNames();for(let g=0,f=t.length;g<f;g++){const p=t[g];if(!p.matcher(h))continue;const b=e.getRule(p.ruleId),{ruleScanner:m,findOptions:w}=Wn(b,e,null,r,s===i),C=m.findNextMatchSync(n,s,w);if(!C)continue;const S=C.captureIndices[0].start;if(!(S>=o)&&(o=S,c=C.captureIndices,l=C.ruleId,u=p.priority,o===s))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Wn(t,e,n,r,s){return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function vs(t,e,n,r,s){return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function pe(t,e,n,r,s,a,i){if(a.length===0)return;const o=e.content,c=Math.min(a.length,i.length),l=[],u=i[0].end;for(let h=0;h<c;h++){const g=a[h];if(g===null)continue;const f=i[h];if(f.length===0)continue;if(f.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=f.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,f.start):s.produce(r,f.start),g.retokenizeCapturedWithRuleId){const b=g.getName(o,i),m=r.contentNameScopesList.pushAttributed(b,t),w=g.getContentName(o,i),C=m.pushAttributed(w,t),S=r.push(g.retokenizeCapturedWithRuleId,f.start,-1,!1,null,m,C),N=t.createOnigString(o.substring(0,f.end));Un(t,N,n&&f.start===0,f.start,S,s,!1,0),Mn(N);continue}const p=g.getName(o,i);if(p!==null){const m=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(p,t);l.push(new As(m,f.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var As=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function Es(t,e,n,r,s,a,i,o){return new Is(t,e,n,r,s,a,i,o)}function tn(t,e,n,r,s){const a=Me(e,je),i=jn.getCompiledRuleId(n,r,s.repository);for(const o of a)t.push({debugSelector:e,matcher:o.matcher,ruleId:i,grammar:s,priority:o.priority})}function je(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(Rs(e[s],r))return n=s+1,!0;return!1})}function Rs(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 Is=class{constructor(t,e,n,r,s,a,i,o){if(this._rootScopeName=t,this.balancedBracketSelectors=a,this._onigLib=o,this._basicScopeAttributesProvider=new _s(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=nn(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const c of Object.keys(s)){const l=Me(c,je);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 i in s)tn(e,i,s[i],this,r);const a=this._grammarRepository.injections(n);a&&a.forEach(i=>{const o=this.getExternalGrammar(i);if(o){const c=o.injectionSelector;c&&tn(e,c,o,this,o)}})}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]=nn(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=jn.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===St.NULL){s=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=ne.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),g=this.getRule(this._rootId).getName(null,null);let f;g?f=ge.createRootAndLookUpScopeName(g,h,this):f=ge.createRoot("unknown",h),e=new St(null,this._rootId,-1,-1,!1,null,f,f)}else s=!1,e.reset();t=t+`
3
3
  `;const a=this.createOnigString(t),i=a.content.length,o=new xs(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Un(this,a,s,0,e,o,!0,r);return Mn(a),{lineLength:i,lineTokens:o,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function nn(t,e){return t=Vr(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 ge=class U{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=at.push(s,a.scopeNames),r=new U(r,s,a.encodedTokenAttributes);return r}static createRoot(e,n){return new U(null,new at(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const s=r.getMetadataForScope(e),a=new at(null,e),i=r.themeProvider.themeMatch(a),o=U.mergeAttributes(n,s,i);return new U(null,a,o)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return U.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,i=0;return r!==null&&(s=r.fontStyle,a=r.foregroundId,i=r.backgroundId),ne.set(e,n.languageId,n.tokenType,null,s,a,i)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return U._pushAttributed(this,e,n);const r=e.split(/ /g);let s=this;for(const a of r)s=U._pushAttributed(s,a,n);return s}static _pushAttributed(e,n,r){const s=r.getMetadataForScope(n),a=e.scopePath.push(n),i=r.themeProvider.themeMatch(a),o=U.mergeAttributes(e.tokenAttributes,s,i);return new U(e,a,o)}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}},St=class ee{constructor(e,n,r,s,a,i,o,c){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=a,this.endRule=i,this.nameScopesList=o,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new ee(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:ee._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?ge.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(){ee._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,s,a,i,o){return new ee(this,e,n,r,s,a,i,o)}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 ee(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=ge.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new ee(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,ge.fromExtension(r,n.contentNameScopesList))}},Ns=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Me(n,je).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>Me(n,je).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}},xs=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 i of this._tokenTypeOverrides)i.matcher(a)&&(r=ne.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(a))}if(s&&(r=ne.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}},Ts=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,Es(t,a,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},$s=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Ts(Oe.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(Oe.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,r){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,n,r){return this._loadGrammar(e,n,r.embeddedLanguages,r.tokenTypes,new Ns(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,r,s,a){const i=new os(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(o=>this._loadSingleGrammar(o.scopeName)),i.processQueue();return this._grammarForScopeName(e,n,r,s,a)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,s=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,s)}_grammarForScopeName(e,n=0,r=null,s=null,a=null){return this._syncRegistry.grammarForScopeName(e,n,r,s,a)}},kt=St.NULL;const Gs=/["&'<>`]/g,Ls=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ps=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Os=/[|\\{}()[\]^$+*?.]/g,rn=new WeakMap;function Ms(t,e){if(t=t.replace(e.subset?Fs(e.subset):Gs,r),e.subset||e.escapeOnly)return t;return t.replace(Ls,n).replace(Ps,r);function n(s,a,i){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(a+2),e)}function r(s,a,i){return e.format(s.charCodeAt(0),i.charCodeAt(a+1),e)}}function Fs(t){let e=rn.get(t);return e||(e=Bs(t),rn.set(t,e)),e}function Bs(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Os,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const js=/[\dA-Fa-f]/;function Ds(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!js.test(String.fromCharCode(e))?r:r+";"}const Us=/\d/;function Ws(t,e,n){const r="&#"+String(t);return n&&e&&!Us.test(String.fromCharCode(e))?r:r+";"}const Hs=["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"],ot={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:"€"},qs=["cent","copy","divide","gt","lt","not","para","times"],Hn={}.hasOwnProperty,vt={};let Ie;for(Ie in ot)Hn.call(ot,Ie)&&(vt[ot[Ie]]=Ie);const zs=/[^\dA-Za-z]/;function Vs(t,e,n,r){const s=String.fromCharCode(t);if(Hn.call(vt,s)){const a=vt[s],i="&"+a;return n&&Hs.includes(a)&&!qs.includes(a)&&(!r||e&&e!==61&&zs.test(String.fromCharCode(e)))?i:i+";"}return""}function Ks(t,e,n){let r=Ds(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=Vs(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const a=Ws(t,e,n.omitOptionalSemicolons);a.length<r.length&&(r=a)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function oe(t,e){return Ms(t,Object.assign({format:Ks},e))}const Qs=/^>|^->|<!--|-->|--!>|<!-$/g,Js=[">"],Xs=["<",">"];function Zs(t,e,n,r){return r.settings.bogusComments?"<?"+oe(t.value,Object.assign({},r.settings.characterReferences,{subset:Js}))+">":"<!--"+t.value.replace(Qs,s)+"-->";function s(a){return oe(a,Object.assign({},r.settings.characterReferences,{subset:Xs}))}}function Ys(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const I=zn(1),qn=zn(-1),ea=[];function zn(t){return e;function e(n,r,s){const a=n?n.children:ea;let i=(r||0)+t,o=a[i];if(!s)for(;o&&P.whitespace(o);)i+=t,o=a[i];return o}}const ta={}.hasOwnProperty;function Vn(t){return e;function e(n,r,s){return ta.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const $t=Vn({body:ra,caption:ct,colgroup:ct,dd:oa,dt:ia,head:ct,html:na,li:aa,optgroup:ca,option:la,p:sa,rp:sn,rt:sn,tbody:ha,td:an,tfoot:fa,th:an,thead:ua,tr:pa});function ct(t,e,n){const r=I(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&P.whitespace(r.value.charAt(0)))}function na(t,e,n){const r=I(n,e);return!r||r.type!=="comment"}function ra(t,e,n){const r=I(n,e);return!r||r.type!=="comment"}function sa(t,e,n){const r=I(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 aa(t,e,n){const r=I(n,e);return!r||r.type==="element"&&r.tagName==="li"}function ia(t,e,n){const r=I(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function oa(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function sn(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function ca(t,e,n){const r=I(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function la(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function ua(t,e,n){const r=I(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function ha(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function fa(t,e,n){return!I(n,e)}function pa(t,e,n){const r=I(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function an(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const ga=Vn({body:Ca,colgroup:_a,head:ma,html:da,tbody:ya});function da(t){const e=I(t,-1);return!e||e.type!=="comment"}function ma(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 Ca(t){const e=I(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&P.whitespace(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function _a(t,e,n){const r=qn(n,e),s=I(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&$t(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function ya(t,e,n){const r=qn(n,e),s=I(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&$t(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Ne={name:[[`
4
4
  \f\r &/=>`.split(""),`
@@ -1,4 +1,4 @@
1
- "use strict";var Gv=Object.create;var sm=Object.defineProperty;var Qv=Object.getOwnPropertyDescriptor;var Xv=Object.getOwnPropertyNames;var Zv=Object.getPrototypeOf,Jv=Object.prototype.hasOwnProperty;var eT=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Xv(t))!Jv.call(e,o)&&o!==n&&sm(e,o,{get:()=>t[o],enumerable:!(r=Qv(t,o))||r.enumerable});return e};var qs=(e,t,n)=>(n=e!=null?Gv(Zv(e)):{},eT(t||!e||!e.__esModule?sm(n,"default",{value:e,enumerable:!0}):n,e));const c=require("react/jsx-runtime"),w=require("@mui/material"),W=require("react"),Lr=require("@tanstack/react-query"),De=require("./ServerProvider-BlufsK4M.cjs.js"),wu=require("markdown-to-jsx"),On=require("@mui/icons-material"),Ot=require("@mui/system"),tT=require("@emotion/styled"),nT=require("@emotion/react"),Ta=require("react-dom"),eb=require("@react-spring/web"),rT=require("react-router-dom");function tb(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const M=tb(W),oT=tb(Ta),am=e=>e,iT=()=>{let e=am;return{configure(t){e=t},generate(t){return e(t)},reset(){e=am}}},nb=iT();function mo(e,...t){const n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(r=>n.searchParams.append("args[]",r)),`Minified MUI error #${e}; visit ${n} for the full message.`}function Fe(e){if(typeof e!="string")throw new Error(mo(7));return e.charAt(0).toUpperCase()+e.slice(1)}function lm(...e){return e.reduce((t,n)=>n==null?t:function(...o){t.apply(this,o),n.apply(this,o)},()=>{})}function Tr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function sT(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Qc={exports:{}},Xc,um;function aT(){if(um)return Xc;um=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Xc=e,Xc}var Zc,cm;function lT(){if(cm)return Zc;cm=1;var e=aT();function t(){}function n(){}return n.resetWarningCache=t,Zc=function(){function r(s,a,l,u,d,f){if(f!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Zc}var dm;function uT(){return dm||(dm=1,Qc.exports=lT()()),Qc.exports}var cT=uT();const Ee=Tr(cT);function rb(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=rb(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ue(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=rb(e))&&(r&&(r+=" "),r+=t);return r}function Ke(e,t,n=void 0){const r={};for(const o in e){const i=e[o];let s="",a=!0;for(let l=0;l<i.length;l+=1){const u=i[l];u&&(s+=(a===!0?"":" ")+t(u),a=!1,n&&n[u]&&(s+=" "+n[u]))}r[o]=s}return r}var Jc={exports:{}},$t={};/**
1
+ "use strict";var Gv=Object.create;var sm=Object.defineProperty;var Qv=Object.getOwnPropertyDescriptor;var Xv=Object.getOwnPropertyNames;var Zv=Object.getPrototypeOf,Jv=Object.prototype.hasOwnProperty;var eT=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Xv(t))!Jv.call(e,o)&&o!==n&&sm(e,o,{get:()=>t[o],enumerable:!(r=Qv(t,o))||r.enumerable});return e};var qs=(e,t,n)=>(n=e!=null?Gv(Zv(e)):{},eT(t||!e||!e.__esModule?sm(n,"default",{value:e,enumerable:!0}):n,e));const c=require("react/jsx-runtime"),w=require("@mui/material"),W=require("react"),Lr=require("@tanstack/react-query"),De=require("./ServerProvider-_aQQHMHe.cjs.js"),wu=require("markdown-to-jsx"),On=require("@mui/icons-material"),Ot=require("@mui/system"),tT=require("@emotion/styled"),nT=require("@emotion/react"),Ta=require("react-dom"),eb=require("@react-spring/web"),rT=require("react-router-dom");function tb(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const M=tb(W),oT=tb(Ta),am=e=>e,iT=()=>{let e=am;return{configure(t){e=t},generate(t){return e(t)},reset(){e=am}}},nb=iT();function mo(e,...t){const n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(r=>n.searchParams.append("args[]",r)),`Minified MUI error #${e}; visit ${n} for the full message.`}function Fe(e){if(typeof e!="string")throw new Error(mo(7));return e.charAt(0).toUpperCase()+e.slice(1)}function lm(...e){return e.reduce((t,n)=>n==null?t:function(...o){t.apply(this,o),n.apply(this,o)},()=>{})}function Tr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function sT(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Qc={exports:{}},Xc,um;function aT(){if(um)return Xc;um=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Xc=e,Xc}var Zc,cm;function lT(){if(cm)return Zc;cm=1;var e=aT();function t(){}function n(){}return n.resetWarningCache=t,Zc=function(){function r(s,a,l,u,d,f){if(f!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Zc}var dm;function uT(){return dm||(dm=1,Qc.exports=lT()()),Qc.exports}var cT=uT();const Ee=Tr(cT);function rb(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=rb(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ue(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=rb(e))&&(r&&(r+=" "),r+=t);return r}function Ke(e,t,n=void 0){const r={};for(const o in e){const i=e[o];let s="",a=!0;for(let l=0;l<i.length;l+=1){const u=i[l];u&&(s+=(a===!0?"":" ")+t(u),a=!1,n&&n[u]&&(s+=" "+n[u]))}r[o]=s}return r}var Jc={exports:{}},$t={};/**
2
2
  * @license React
3
3
  * react-is.production.js
4
4
  *
@@ -89,7 +89,7 @@ import {${t.sourceName}}" from '${t.modelPath}'"
89
89
  - [ ] `),/^\d+.\s/.test(s)&&(v=`
90
90
  `+(parseInt(s)+1)+". "),is(r,v)}else if(e.code&&e.code.toLowerCase()==="keyd"&&e.ctrlKey){du(e);var S={start:r.selectionStart,end:r.selectionEnd},I=S;S=$a({text:r.value,selection:S});var T=r.value.slice(S.start,S.end);a.setSelectionRange({start:S.end,end:S.end}),is(r,`
91
91
  `+T),a.setSelectionRange({start:I.start,end:I.end})}else e.code&&e.code.toLowerCase()==="arrowup"&&e.altKey?ag(e,-1):e.code&&e.code.toLowerCase()==="arrowdown"&&e.altKey&&ag(e,1)}var UR=["prefixCls","onChange"],VR=["markdown","commands","fullscreen","preview","highlightEnable","extraCommands","tabSize","defaultTabEnable","autoFocusEnd","textareaWarp","dispatch"];function WR(e){var{prefixCls:t,onChange:n}=e,r=Ze(e,UR),o=W.useContext(Is),{markdown:i,commands:s,fullscreen:a,preview:l,highlightEnable:u,extraCommands:d,tabSize:f,defaultTabEnable:h,autoFocusEnd:p,textareaWarp:m,dispatch:b}=o;Ze(o,VR);var y=W.useRef(null),x=W.useRef(),C=W.useRef({fullscreen:a,preview:l});W.useEffect(()=>{C.current={fullscreen:a,preview:l,highlightEnable:u}},[a,l,u]),W.useEffect(()=>{if(y.current&&b){var S=new Sp(y.current);x.current=S,b({textarea:y.current,commandOrchestrator:S})}},[]),W.useEffect(()=>{if(p&&y.current&&m){y.current.focus();var S=y.current.value.length;y.current.setSelectionRange(S,S),setTimeout(()=>{m&&(m.scrollTop=m.scrollHeight),y.current&&(y.current.scrollTop=y.current.scrollHeight)},0)}},[m]);var v=S=>{zR(S,f,h),jx(S,[...s||[],...d||[]],x.current,b,C.current)};return W.useEffect(()=>(y.current&&y.current.addEventListener("keydown",v),()=>{y.current&&y.current.removeEventListener("keydown",v)}),[]),c.jsx("textarea",Y({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1},r,{ref:y,className:t+"-text-input "+(r.className?r.className:""),value:i,onChange:S=>{b&&b({markdown:S.target.value}),n&&n(S)}}))}var qR=["prefixCls","className","onScroll","renderTextarea"];function YR(e){var t=e||{},{prefixCls:n,className:r,onScroll:o,renderTextarea:i}=t,s=Ze(t,qR),{markdown:a,scrollTop:l,commands:u,extraCommands:d,dispatch:f}=W.useContext(Is),h=W.useRef(null),p=W.useRef(),m=W.createRef();W.useEffect(()=>{var y={};m.current&&(y.textareaWarp=m.current||void 0,m.current.scrollTop=l||0),f&&f(Y({},y))},[]),W.useEffect(()=>{if(h.current&&f){var y=new Sp(h.current);p.current=y,f({textarea:h.current,commandOrchestrator:y})}},[]);var b={WebkitTextFillColor:"initial",overflow:"auto"};return c.jsx("div",{ref:m,className:n+"-area "+(r||""),onScroll:o,children:c.jsx("div",{className:n+"-text",children:i?W.cloneElement(i(Y({},s,{value:a,autoComplete:"off",autoCorrect:"off",spellCheck:"false",autoCapitalize:"off",className:n+"-text-input",style:{WebkitTextFillColor:"inherit",overflow:"auto"}}),{dispatch:f,onChange:s.onChange,shortcuts:jx,useContext:{commands:u,extraCommands:d,commandOrchestrator:p.current}}),{ref:h}):c.jsx(W.Fragment,{children:c.jsx(WR,Y({prefixCls:n},s,{style:b}))})})})}function KR(e){var{prefixCls:t,groupName:n,commands:r,children:o}=e||{},{barPopup:i={}}=W.useContext(Is);return W.useMemo(()=>c.jsx("div",{className:t+"-toolbar-child "+(n&&i[n]?"active":""),onClick:s=>s.stopPropagation(),children:Array.isArray(r)?c.jsx(Vx,Y({commands:r},e,{isChild:!0})):o}),[r,i,n,t])}function lg(e){var{prefixCls:t,overflow:n}=e,{fullscreen:r,preview:o,barPopup:i={},components:s,commandOrchestrator:a,dispatch:l}=W.useContext(Is),u=W.useRef("");function d(f,h){if(l){var p={barPopup:Y({},i)};f.keyCommand==="preview"&&(p.preview=f.value),f.keyCommand==="fullscreen"&&(p.fullscreen=!r),e.commands&&f.keyCommand==="group"?e.commands.forEach(m=>{h===m.groupName?p.barPopup[h]=!0:m.keyCommand&&(p.barPopup[m.groupName]=!1)}):(h||f.parent)&&Object.keys(p.barPopup||{}).forEach(m=>{p.barPopup[m]=!1}),Object.keys(p).length&&l(Y({},p)),a&&a.executeCommand(f)}}return W.useEffect(()=>{document&&n&&(r?document.body.style.overflow="hidden":(u.current||(u.current=window.getComputedStyle(document.body,null).overflow),document.body.style.overflow=u.current))},[r,u,n]),c.jsx("ul",{children:(e.commands||[]).map((f,h)=>{if(f.keyCommand==="divider")return c.jsx("li",Y({},f.liProps,{className:t+"-toolbar-divider"}),h);if(!f.keyCommand)return c.jsx(W.Fragment,{},h);var p=r&&f.keyCommand==="fullscreen"||f.keyCommand==="preview"&&o===f.value,m=f.children&&typeof f.children=="function"?f.children({getState:()=>a.getState(),textApi:a?a.textApi:void 0,close:()=>d({},f.groupName),execute:()=>d({execute:f.execute}),dispatch:l}):void 0,b=i&&o&&o==="preview"&&!/(preview|fullscreen)/.test(f.keyCommand),y=s?.toolbar||f.render,x=y&&typeof y=="function"?y(f,!!b,d,h):null;return c.jsxs("li",Y({},f.liProps,{className:p?"active":"",children:[x&&W.isValidElement(x)&&x,!x&&!f.buttonProps&&f.icon,!x&&f.buttonProps&&W.createElement("button",Y({type:"button",key:h,disabled:b,"data-name":f.name},f.buttonProps,{onClick:C=>{C.stopPropagation(),d(f,f.groupName)}}),f.icon),f.children&&c.jsx(KR,{overflow:n,groupName:f.groupName,prefixCls:t,children:m,commands:Array.isArray(f.children)?f.children:void 0})]}),h)})})}function Vx(e){e===void 0&&(e={});var{prefixCls:t,isChild:n,className:r}=e,{commands:o,extraCommands:i}=W.useContext(Is);return c.jsxs("div",{className:t+"-toolbar "+r,children:[c.jsx(lg,Y({},e,{commands:e.commands||o||[]})),!n&&c.jsx(lg,Y({},e,{commands:i||[]}))]})}function ug(e){var{hideToolbar:t,toolbarBottom:n,placement:r,overflow:o,prefixCls:i}=e;if(t||r==="bottom"&&!n||r==="top"&&n)return null;var s=n?"bottom":"";return c.jsx(Vx,{prefixCls:i,overflow:o,className:s})}var GR=e=>{var{prefixCls:t,onChange:n}=e||{},r=W.useRef(null),o=W.useRef(),i=W.useRef(e.height);W.useEffect(()=>{i.current!==e.height&&(i.current=e.height)},[e.height]);function s(d){if(o.current){var f,h=d.clientY||((f=d.changedTouches[0])==null?void 0:f.clientY),p=o.current.height+h-o.current.dragY;p>=e.minHeight&&p<=e.maxHeight&&n&&n(o.current.height+(h-o.current.dragY))}}function a(){var d,f;o.current=void 0,document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",a),(d=r.current)==null||d.removeEventListener("touchmove",s),(f=r.current)==null||f.removeEventListener("touchend",a)}function l(d){var f,h,p;d.preventDefault();var m=d.clientY||((f=d.changedTouches[0])==null?void 0:f.clientY);o.current={height:i.current,dragY:m},document.addEventListener("mousemove",s),document.addEventListener("mouseup",a),(h=r.current)==null||h.addEventListener("touchmove",s,{passive:!1}),(p=r.current)==null||p.addEventListener("touchend",a,{passive:!1})}W.useEffect(()=>{if(document){var d,f;(d=r.current)==null||d.addEventListener("touchstart",l,{passive:!1}),(f=r.current)==null||f.addEventListener("mousedown",l)}return()=>{if(document){var h;(h=r.current)==null||h.removeEventListener("touchstart",l),document.removeEventListener("mousemove",s)}}},[]);var u=W.useMemo(()=>c.jsx("svg",{viewBox:"0 0 512 512",height:"100%",children:c.jsx("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})}),[]);return c.jsx("div",{className:t+"-bar",ref:r,children:u})},QR=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","autoFocusEnd","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function XR(e){return e===void 0&&(e={}),Object.keys(e).forEach(t=>{e[t]=!1}),e}var ZR=W.forwardRef((e,t)=>{var n=e||{},{prefixCls:r="w-md-editor",className:o,value:i,commands:s=$R(),commandsFilter:a,direction:l,extraCommands:u=HR(),height:d=200,enableScroll:f=!0,visibleDragbar:h=typeof e.visiableDragbar=="boolean"?e.visiableDragbar:!0,highlightEnable:p=!0,preview:m="live",fullscreen:b=!1,overflow:y=!0,previewOptions:x={},textareaProps:C,maxHeight:v=1200,minHeight:S=100,autoFocus:I,autoFocusEnd:T=!1,tabSize:N=2,defaultTabEnable:O=!1,onChange:F,onStatistics:B,onHeightChange:j,hideToolbar:D,toolbarBottom:H=!1,components:_,renderTextarea:L}=n,$=Ze(n,QR),K=s.map(we=>a?a(we,!1):we).filter(Boolean),G=u.map(we=>a?a(we,!0):we).filter(Boolean),[q,R]=W.useReducer(aR,{markdown:i,preview:m,components:_,height:d,minHeight:S,highlightEnable:p,tabSize:N,defaultTabEnable:O,scrollTop:0,scrollTopPreview:0,commands:K,extraCommands:G,fullscreen:b,barPopup:{}}),oe=W.useRef(null),se=W.useRef(null),z=W.useRef(f);W.useImperativeHandle(t,()=>Y({},q,{container:oe.current,dispatch:R})),W.useMemo(()=>z.current=f,[f]),W.useEffect(()=>{var we={};oe.current&&(we.container=oe.current||void 0),we.markdown=i||"",we.barPopup={},R&&R(Y({},q,we))},[]);var pe=[o,"wmde-markdown-var",l?r+"-"+l:null,r,q.preview?r+"-show-"+q.preview:null,q.fullscreen?r+"-fullscreen":null].filter(Boolean).join(" ").trim();W.useMemo(()=>i!==q.markdown&&R({markdown:i||""}),[i,q.markdown]),W.useMemo(()=>m!==q.preview&&R({preview:m}),[m]),W.useMemo(()=>N!==q.tabSize&&R({tabSize:N}),[N]),W.useMemo(()=>p!==q.highlightEnable&&R({highlightEnable:p}),[p]),W.useMemo(()=>I!==q.autoFocus&&R({autoFocus:I}),[I]),W.useMemo(()=>T!==q.autoFocusEnd&&R({autoFocusEnd:T}),[T]),W.useMemo(()=>b!==q.fullscreen&&R({fullscreen:b}),[b]),W.useMemo(()=>d!==q.height&&R({height:d}),[d]),W.useMemo(()=>d!==q.height&&j&&j(q.height,d,q),[d,j,q]),W.useMemo(()=>s!==q.commands&&R({commands:K}),[e.commands]),W.useMemo(()=>u!==q.extraCommands&&R({extraCommands:G}),[e.extraCommands]);var J=W.useRef(),Q=W.useRef("preview"),re=W.useRef(!1);W.useMemo(()=>{J.current=q.textareaWarp,q.textareaWarp&&(q.textareaWarp.addEventListener("mouseover",()=>{Q.current="text"}),q.textareaWarp.addEventListener("mouseleave",()=>{Q.current="preview"}))},[q.textareaWarp]);var ne=(we,ye)=>{if(z.current){var ze=J.current,Ne=se.current?se.current:void 0;if(re.current||(Q.current=ye,re.current=!0),ze&&Ne){var nt=(ze.scrollHeight-ze.offsetHeight)/(Ne.scrollHeight-Ne.offsetHeight);we.target===ze&&Q.current==="text"&&(Ne.scrollTop=ze.scrollTop/nt),we.target===Ne&&Q.current==="preview"&&(ze.scrollTop=Ne.scrollTop*nt);var _e=0;Q.current==="text"?_e=ze.scrollTop||0:Q.current==="preview"&&(_e=Ne.scrollTop||0),R({scrollTop:_e})}}},ae=r+"-preview "+(x.className||""),ie=we=>ne(we,"preview"),Z=W.useMemo(()=>c.jsx("div",{ref:se,className:ae,children:c.jsx(_x,Y({},x,{onScroll:ie,source:q.markdown||""}))}),[ae,x,q.markdown]),me=_?.preview&&_?.preview(q.markdown||"",q,R);me&&W.isValidElement(me)&&(Z=c.jsx("div",{className:ae,ref:se,onScroll:ie,children:me}));var le=Y({},$.style,{height:q.height||"100%"}),ue=()=>R({barPopup:Y({},XR(q.barPopup))}),Ie=we=>R({height:we}),Ce=we=>{if(F&&F(we.target.value,we,q),C&&C.onChange&&C.onChange(we),q.textarea&&q.textarea instanceof HTMLTextAreaElement&&B){var ye=new Sp(q.textarea),ze=ye.getState()||{};B(Y({},ze,{lineCount:we.target.value.split(`
92
- `).length,length:we.target.value.length}))}};return c.jsx(Is.Provider,{value:Y({},q,{dispatch:R}),children:c.jsxs("div",Y({ref:oe,className:pe},$,{onClick:ue,style:le,children:[c.jsx(ug,{hideToolbar:D,toolbarBottom:H,prefixCls:r,overflow:y,placement:"top"}),c.jsxs("div",{className:r+"-content",children:[/(edit|live)/.test(q.preview||"")&&c.jsx(YR,Y({className:r+"-input",prefixCls:r,autoFocus:I},C,{onChange:Ce,renderTextarea:_?.textarea||L,onScroll:we=>ne(we,"text")})),/(live|preview)/.test(q.preview||"")&&Z]}),h&&!q.fullscreen&&c.jsx(GR,{prefixCls:r,height:q.height,maxHeight:v,minHeight:S,onChange:Ie}),c.jsx(ug,{hideToolbar:D,toolbarBottom:H,prefixCls:r,overflow:y,placement:"bottom"})]}))})}),Wx=ZR;Wx.Markdown=_x;const Od={scopeName:"source.malloy",patterns:[{include:"#malloy-language"}],repository:{"malloy-language":{patterns:[{include:"#sql-string"},{include:"#comments"},{include:"#tags"},{include:"#strings"},{include:"#numbers"},{include:"#keywords"},{include:"#properties"},{include:"#functions"},{include:"#datetimes"},{include:"#identifiers-quoted"},{include:"#types"},{include:"#constants"},{include:"#timeframes"},{include:"#identifiers-unquoted"}]},"malloy-matched":{begin:"{",end:"}",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"malloy-in-sql":{begin:"%{",name:"source.malloy-in-sql",end:"}%?",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"sql-string":{patterns:[{begin:'(\\b[A-Za-z_][A-Za-z_0-9]*)(\\s*\\.\\s*)(sql)(\\s*\\(\\s*)(""")',end:'"""',beginCaptures:{1:{name:"variable.other"},3:{name:"keyword.control.sql"},5:{name:"punctuation.sql-block.open"}},endCaptures:{0:{name:"punctuation.sql-block.close"}},name:"source.sql",patterns:[{include:"#malloy-in-sql"},{include:"source.sql"}]}]},functions:{patterns:[{match:"(?i)\\b(count)(\\s*\\()(distinct)",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.function.modifier"}}},{match:"(?i)\\b(AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE|UNGROUPED)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(!)(timestamp|number|string|boolean|date)?(\\s*\\()",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.type"}}}]},datetimes:{patterns:[{match:"(?i)@[0-9]{4}-[0-9]{2}-[0-9]{2}[ T][0-9]{2}:[0-9]{2}((:[0-9]{2})(([\\.,][0-9]+)(\\[[A-Za-z_/]+\\])?)?)?",name:"constant.numeric.timestamp"},{match:"(?i)@[0-9]{4}(-Q[1-4]|-[0-9]{2}(-[0-9]{2}(-WK)?)?)?",name:"constant.numeric.date"}]},"identifiers-quoted":{patterns:[{match:"`[^`]*`",name:"variable.other.quoted"}]},"identifiers-unquoted":{patterns:[{match:"(?i)\\b[A-Za-z_][A-Za-z_0-9]*\\b",name:"variable.other"}]},timeframes:{patterns:[{match:"(?i)\\b((year|quarter|month|week|day|hour|minute|second)s?)\\b",name:"keyword.other.timeframe"},{match:"(?i)\\b(day_of_year|day_of_month)\\b",name:"keyword.other.timeframe"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]},tags:{patterns:[{match:"##\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:'#"',end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{match:"#\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:"#\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"##\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"#",end:"\\n",beginCaptures:{0:{name:"string.quoted"}},name:"string.quoted"}],repository:{"tag-values":{name:"support.type.property-name.json",match:'(-)?((?:[^\\s=#]+)|(?:"[^#]+"))(?:\\s*(=)\\s*((?:[^\\s=#]+)|(?:"[^#]+")))?',captures:{1:{name:"keyword.control.negate"},2:{name:"support.type.property-name.json"},3:{name:"keyword.operator.comparison.ts"},4:{name:"string.quoted"}}}}},strings:{patterns:[{begin:"'",end:"'",beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.single",patterns:[{include:"#escapes"}]},{begin:'"',end:'"',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.double",patterns:[{include:"#escapes"}]},{begin:'"""',end:'"""',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.triple"},{begin:"(?i)[r|/]'",end:"'",name:"string.regexp",patterns:[{include:"#regex-escapes"}]}],repository:{escapes:{name:"constant.character.escape",match:"\\\\(u[A-Fa-f0-9]{4}|.)",captures:{0:{name:"constant.character.escape"}}},"regex-escapes":{name:"constant.character.escape",match:"\\\\.",captures:{0:{name:"constant.character.escape"}}}}},numbers:{match:"(?i)(\\b((0|[1-9][0-9]*)(E[+-]?[0-9]+|\\.[0-9]*)?)|\\.[0-9]+)",name:"constant.numeric"},constants:{patterns:[{match:"(?i)\\bnull\\b",name:"constant.language.null"},{match:"(?i)\\btrue\\b",name:"constant.language.true"},{match:"(?i)\\bfalse\\b",name:"constant.language.false"}]},types:{patterns:[{match:"(?i)\\bstring\\b",name:"entity.name.type.string"},{match:"(?i)\\bnumber\\b",name:"entity.name.type.number"},{match:"(?i)\\bdate\\b",name:"entity.name.type.date"},{match:"(?i)\\btimestamp\\b",name:"entity.name.type.timestamp"},{match:"(?i)\\bboolean\\b",name:"entity.name.type.boolean"}]},properties:{patterns:[{match:"(?i)\\baccept\\b",name:"keyword.control.accept"},{match:"(?i)\\bselect\\b",name:"keyword.control.select"},{match:"(?i)\\bconnection\\b",name:"keyword.control.connection"},{match:"(?i)\\brun\\b",name:"keyword.control.run"},{match:"(?i)\\bextend\\b",name:"keyword.control.extend"},{match:"(?i)\\brefine\\b",name:"keyword.control.refine"},{match:"(?i)\\baggregate\\b",name:"keyword.control.aggregate"},{match:"(?i)\\bsample\\b",name:"keyword.control.sample"},{match:"(?i)\\bcalculate\\b",name:"keyword.control.calculate"},{match:"(?i)\\btimezone\\b",name:"keyword.control.timezone"},{match:"(?i)\\bdimension\\b",name:"keyword.control.dimension"},{match:"(?i)\\bexcept\\b",name:"keyword.control.except"},{match:"(?i)\\bsource\\b",name:"keyword.control.source"},{match:"(?i)\\bgroup_by\\b",name:"keyword.control.group_by"},{match:"(?i)\\bhaving\\b",name:"keyword.control.having"},{match:"(?i)\\bindex\\b",name:"keyword.control.index"},{match:"(?i)\\bjoin_one\\b",name:"keyword.control.join_one"},{match:"(?i)\\bwith\\b",name:"keyword.control.with"},{match:"(?i)\\bjoin_many\\b",name:"keyword.control.join_many"},{match:"(?i)\\bjoin_cross\\b",name:"keyword.control.join_cross"},{match:"(?i)\\blimit\\b",name:"keyword.control.limit"},{match:"(?i)\\bmeasure\\b",name:"keyword.control.measure"},{match:"(?i)\\bnest\\b",name:"keyword.control.nest"},{match:"(?i)\\border_by\\b",name:"keyword.control.order_by"},{match:"(?i)\\bpartition_by\\b",name:"keyword.control.partition_by"},{match:"(?i)\\bprimary_key\\b",name:"keyword.control.primary_key"},{match:"(?i)\\bproject\\b",name:"keyword.control.project"},{match:"(?i)\\bquery\\b",name:"keyword.control.query"},{match:"(?i)\\brename\\b",name:"keyword.control.rename"},{match:"(?i)\\btop\\b",name:"keyword.control.top"},{match:"(?i)\\bview\\b",name:"keyword.control.view"},{match:"(?i)\\bwhere\\b",name:"keyword.control.where"},{match:"(?i)\\bdeclare\\b",name:"keyword.control.declare"}]},keywords:{patterns:[{match:"(?i)\\bis\\b",name:"keyword.control.is"},{match:"(?i)\\bon\\b",name:"keyword.control.on"},{match:"(?i)\\bnot\\b",name:"keyword.other.not"},{match:"(?i)\\bor\\b",name:"keyword.other.or"},{match:"(?i)\\bdesc\\b",name:"keyword.control.desc"},{match:"(?i)\\bby\\b",name:"keyword.control.by"},{match:"(?i)\\band\\b",name:"keyword.other.and"},{match:"(?i)\\basc\\b",name:"keyword.control.asc"},{match:"(?i)\\bfor\\b",name:"keyword.other.for"},{match:"(?i)\\belse\\b",name:"keyword.other.else"},{match:"(?i)\\bto\\b",name:"keyword.other.to"},{match:"(?i)\\bwhen\\b",name:"keyword.other.when"},{match:"(?i)\\bpick\\b",name:"keyword.other.pick"},{match:"(?i)\\bimport\\b",name:"keyword.control.import"}]}}},JR={...Od,patterns:[...Od.patterns,{include:"#docvar"}],repository:{...Od.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},eN={name:"Malloy SQL",scopeName:"source.malloy-sql",patterns:[{include:"#malloysql-sql"}],repository:{"malloysql-sql":{beginCaptures:{0:{name:"entity.other.attribute.malloy-sql"},1:{name:"entity.other.attribute.malloy-sql"},3:{name:"comment.line.double-slash"}},name:"meta.embedded.block.malloysql.sql",patterns:[{include:"#comments"},{begin:"%{",end:"}%",beginCaptures:{0:{name:"punctuation.definition.malloy-sql"}},endCaptures:{0:{name:"punctuation.definition.malloy-sql"}},name:"meta.embedded.block.malloy",patterns:[{include:"source.malloy"}]},{include:"source.sql"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]}}},tN="github-light",nN="github-dark";let Md;function rN(){return Md||(Md=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:i},{default:s}]=await Promise.all([Promise.resolve().then(()=>require("./core-DeaXfVr8.cjs.js")),Promise.resolve().then(()=>require("./engine-oniguruma-BkproSVE.cjs.js")),Promise.resolve().then(()=>require("./sql-BqWZrLHB.cjs.js")),Promise.resolve().then(()=>require("./json-y-J1j5EW.cjs.js")),Promise.resolve().then(()=>require("./typescript-BqvpT6pB.cjs.js")),Promise.resolve().then(()=>require("./github-light-BFTOhCbz.cjs.js")),Promise.resolve().then(()=>require("./github-dark-BKL9xNgN.cjs.js"))]);return e({engine:t(Promise.resolve().then(()=>require("./wasm-Dw4u1m6u.cjs.js"))),themes:[i,s],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...JR},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...eN}]})})()),Md}async function $u(e,t,n="light"){return(await rN()).codeToHtml(e,{lang:t,theme:n==="dark"?nN:tN})}function Xt(e){const{server:t}=De.useServer(),n={...e,queryKey:[...e.queryKey,t],queryFn:async()=>{try{return await e.queryFn()}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const i=new Error(o.response.data.message||o.message);throw i.status=o.response.status,i.data=o.response.data,i}}throw r}},retry:!1,throwOnError:!1};return Lr.useQuery(n,De.globalQueryClient)}function vn(e){const t={...e,mutationFn:async n=>{try{return await e.mutationFn(n)}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const i=new Error(o.response.data.message||o.message);throw i.status=o.response.status,i.data=o.response.data,i}}throw r}},retry:!1,throwOnError:!1};return Lr.useMutation(t,De.globalQueryClient)}const Ht=e=>{const t=new URL(e),n={};if(t.protocol!=="publisher:")throw new Error(`Failed to parse resource URI: ${e}`);const r=(t.hostname+t.pathname).split("/");for(let o=0;o<r.length;o+=2){const i=r[o];i==="environments"?n.environmentName=decodeURI(r[o+1])||void 0:i==="packages"?n.packageName=decodeURI(r[o+1])||void 0:i==="connections"?n.connectionName=decodeURI(r[o+1])||void 0:i==="models"&&(n.modelPath=decodeURI(r.slice(o+1).join("/"))||void 0)}if(n.versionId=t.searchParams.get("versionId")||void 0,!n.environmentName)throw new Error(`Failed to parse resource URI: ${e}`);return n},Cl=e=>{if(!e.environmentName)throw new Error(`Failed to encode resource URI, missing environment name: ${e}`);let t=`publisher://environments/${e.environmentName}`;return e.packageName&&(t+=`/packages/${e.packageName}`),e.connectionName&&(t+=`/connections/${e.connectionName}`),e.modelPath&&(t+=`/models/${e.modelPath}`),e.packageName&&e.versionId&&(t+=`?versionId=${e.versionId}`),t};function kp({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:i}){return W.useEffect(()=>{o&&o(t)},[t,o]),c.jsx(De.StyledCardMedia,{children:c.jsxs(Ot.Stack,{spacing:2,component:"section",children:[c.jsx(qx,{sourceAndPath:e[t],existingQuery:n,onChange:s=>{r&&r(s)},resourceUri:i}),c.jsx(Ot.Box,{height:"5px"})]})})}function fu(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function oN({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:i}){const[s,a]=W.useState(n||fu()),[l,u]=W.useState(void 0);W.useEffect(()=>{n&&a(n)},[n]);const[d,f]=W.useState([]),{MalloyExplorerProvider:h,QueryPanel:p,ResizableCollapsiblePanel:m,ResultPanel:b,SourcePanel:y}=r;W.useEffect(()=>{t&&t(s)},[t,s]);const{environmentName:x,packageName:C,versionId:v}=Ht(i),{apiClients:S}=De.useServer(),I=vn({mutationFn:()=>{const F=typeof s?.malloyQuery=="string"?s.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:s?.malloyQuery}).toMalloy();return u({executionState:"running",query:s?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{I.reset(),u(void 0)},response:{result:{}}}),a({...s,query:F}),S.models.executeQueryModel(x,C,e.modelPath,{query:F,sourceName:void 0,queryName:void 0,versionId:v})},onSuccess:F=>{if(F){const B=JSON.parse(F.data.result);a({...s,malloyResult:B}),u(j=>j?{...j,executionState:"finished",response:{result:B}}:void 0)}},onError:F=>{u(void 0),console.error("Query execution error:",F)}}),[T,N]=W.useState(e.sourceInfo.name);W.useEffect(()=>{T!==e.sourceInfo.name&&(N(e.sourceInfo.name),a(fu()),u(void 0))},[e,T]);const O=W.useCallback(F=>{a({...s,malloyQuery:F,malloyResult:void 0})},[s]);return T!==e.sourceInfo.name?c.jsx("div",{children:"Loading..."}):c.jsx(De.StyledExplorerContent,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:c.jsx(h,{source:e.sourceInfo,query:s?.malloyQuery,topValues:[],onFocusedNestViewPathChange:f,focusedNestViewPath:d,onQueryChange:O,children:c.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[c.jsx(m,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:c.jsx(y,{onRefresh:()=>a(fu())})}),c.jsx(m,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:c.jsx(p,{runQuery:()=>{console.log(`running query with: ${s?.malloyQuery}`);try{I.mutate()}catch(F){console.error("Error running query:",F)}}})}),c.jsx(b,{source:e.sourceInfo,draftQuery:s?.malloyQuery,setDraftQuery:F=>a({...s,malloyQuery:F}),submittedQuery:l,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function qx(e){const[t,n]=W.useState(null),[r,o]=W.useState(null),[i,s]=W.useState(!0);return W.useEffect(()=>{let a=!0;return Promise.all([import("@malloydata/malloy-explorer"),import("@malloydata/malloy-query-builder")]).then(([l,u])=>{a&&(n(l),o(u),s(!1))}).catch(l=>{console.error("Failed to load Malloy components:",l),a&&s(!1)}),()=>{a=!1}},[]),i||!t||!r?c.jsx(De.StyledExplorerPage,{children:c.jsx(De.StyledExplorerContent,{children:c.jsx(Ot.Box,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):c.jsx(oN,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}const Yx=mt(c.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}));function Sn({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:i=2,textVariant:s="body2"}){const a=c.jsxs(w.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:i},children:[c.jsx(w.CircularProgress,{size:t,color:n,thickness:r}),e&&c.jsx(w.Typography,{variant:s,color:"text.secondary",children:e})]});return o?c.jsx(w.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:a}):a}const iN=new Set(["warn","error"]);function sN(e){if(!e?.length)return;const t=[];let n=!1;for(const r of e)!r.message||!iN.has(r.severity??"")||(r.severity==="error"&&(n=!0),t.includes(r.message)||t.push(r.message));if(t.length)return{severity:n?"error":"warn",title:t.join(`
92
+ `).length,length:we.target.value.length}))}};return c.jsx(Is.Provider,{value:Y({},q,{dispatch:R}),children:c.jsxs("div",Y({ref:oe,className:pe},$,{onClick:ue,style:le,children:[c.jsx(ug,{hideToolbar:D,toolbarBottom:H,prefixCls:r,overflow:y,placement:"top"}),c.jsxs("div",{className:r+"-content",children:[/(edit|live)/.test(q.preview||"")&&c.jsx(YR,Y({className:r+"-input",prefixCls:r,autoFocus:I},C,{onChange:Ce,renderTextarea:_?.textarea||L,onScroll:we=>ne(we,"text")})),/(live|preview)/.test(q.preview||"")&&Z]}),h&&!q.fullscreen&&c.jsx(GR,{prefixCls:r,height:q.height,maxHeight:v,minHeight:S,onChange:Ie}),c.jsx(ug,{hideToolbar:D,toolbarBottom:H,prefixCls:r,overflow:y,placement:"bottom"})]}))})}),Wx=ZR;Wx.Markdown=_x;const Od={scopeName:"source.malloy",patterns:[{include:"#malloy-language"}],repository:{"malloy-language":{patterns:[{include:"#sql-string"},{include:"#comments"},{include:"#tags"},{include:"#strings"},{include:"#numbers"},{include:"#keywords"},{include:"#properties"},{include:"#functions"},{include:"#datetimes"},{include:"#identifiers-quoted"},{include:"#types"},{include:"#constants"},{include:"#timeframes"},{include:"#identifiers-unquoted"}]},"malloy-matched":{begin:"{",end:"}",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"malloy-in-sql":{begin:"%{",name:"source.malloy-in-sql",end:"}%?",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"sql-string":{patterns:[{begin:'(\\b[A-Za-z_][A-Za-z_0-9]*)(\\s*\\.\\s*)(sql)(\\s*\\(\\s*)(""")',end:'"""',beginCaptures:{1:{name:"variable.other"},3:{name:"keyword.control.sql"},5:{name:"punctuation.sql-block.open"}},endCaptures:{0:{name:"punctuation.sql-block.close"}},name:"source.sql",patterns:[{include:"#malloy-in-sql"},{include:"source.sql"}]}]},functions:{patterns:[{match:"(?i)\\b(count)(\\s*\\()(distinct)",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.function.modifier"}}},{match:"(?i)\\b(AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE|UNGROUPED)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(!)(timestamp|number|string|boolean|date)?(\\s*\\()",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.type"}}}]},datetimes:{patterns:[{match:"(?i)@[0-9]{4}-[0-9]{2}-[0-9]{2}[ T][0-9]{2}:[0-9]{2}((:[0-9]{2})(([\\.,][0-9]+)(\\[[A-Za-z_/]+\\])?)?)?",name:"constant.numeric.timestamp"},{match:"(?i)@[0-9]{4}(-Q[1-4]|-[0-9]{2}(-[0-9]{2}(-WK)?)?)?",name:"constant.numeric.date"}]},"identifiers-quoted":{patterns:[{match:"`[^`]*`",name:"variable.other.quoted"}]},"identifiers-unquoted":{patterns:[{match:"(?i)\\b[A-Za-z_][A-Za-z_0-9]*\\b",name:"variable.other"}]},timeframes:{patterns:[{match:"(?i)\\b((year|quarter|month|week|day|hour|minute|second)s?)\\b",name:"keyword.other.timeframe"},{match:"(?i)\\b(day_of_year|day_of_month)\\b",name:"keyword.other.timeframe"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]},tags:{patterns:[{match:"##\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:'#"',end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{match:"#\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:"#\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"##\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"#",end:"\\n",beginCaptures:{0:{name:"string.quoted"}},name:"string.quoted"}],repository:{"tag-values":{name:"support.type.property-name.json",match:'(-)?((?:[^\\s=#]+)|(?:"[^#]+"))(?:\\s*(=)\\s*((?:[^\\s=#]+)|(?:"[^#]+")))?',captures:{1:{name:"keyword.control.negate"},2:{name:"support.type.property-name.json"},3:{name:"keyword.operator.comparison.ts"},4:{name:"string.quoted"}}}}},strings:{patterns:[{begin:"'",end:"'",beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.single",patterns:[{include:"#escapes"}]},{begin:'"',end:'"',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.double",patterns:[{include:"#escapes"}]},{begin:'"""',end:'"""',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.triple"},{begin:"(?i)[r|/]'",end:"'",name:"string.regexp",patterns:[{include:"#regex-escapes"}]}],repository:{escapes:{name:"constant.character.escape",match:"\\\\(u[A-Fa-f0-9]{4}|.)",captures:{0:{name:"constant.character.escape"}}},"regex-escapes":{name:"constant.character.escape",match:"\\\\.",captures:{0:{name:"constant.character.escape"}}}}},numbers:{match:"(?i)(\\b((0|[1-9][0-9]*)(E[+-]?[0-9]+|\\.[0-9]*)?)|\\.[0-9]+)",name:"constant.numeric"},constants:{patterns:[{match:"(?i)\\bnull\\b",name:"constant.language.null"},{match:"(?i)\\btrue\\b",name:"constant.language.true"},{match:"(?i)\\bfalse\\b",name:"constant.language.false"}]},types:{patterns:[{match:"(?i)\\bstring\\b",name:"entity.name.type.string"},{match:"(?i)\\bnumber\\b",name:"entity.name.type.number"},{match:"(?i)\\bdate\\b",name:"entity.name.type.date"},{match:"(?i)\\btimestamp\\b",name:"entity.name.type.timestamp"},{match:"(?i)\\bboolean\\b",name:"entity.name.type.boolean"}]},properties:{patterns:[{match:"(?i)\\baccept\\b",name:"keyword.control.accept"},{match:"(?i)\\bselect\\b",name:"keyword.control.select"},{match:"(?i)\\bconnection\\b",name:"keyword.control.connection"},{match:"(?i)\\brun\\b",name:"keyword.control.run"},{match:"(?i)\\bextend\\b",name:"keyword.control.extend"},{match:"(?i)\\brefine\\b",name:"keyword.control.refine"},{match:"(?i)\\baggregate\\b",name:"keyword.control.aggregate"},{match:"(?i)\\bsample\\b",name:"keyword.control.sample"},{match:"(?i)\\bcalculate\\b",name:"keyword.control.calculate"},{match:"(?i)\\btimezone\\b",name:"keyword.control.timezone"},{match:"(?i)\\bdimension\\b",name:"keyword.control.dimension"},{match:"(?i)\\bexcept\\b",name:"keyword.control.except"},{match:"(?i)\\bsource\\b",name:"keyword.control.source"},{match:"(?i)\\bgroup_by\\b",name:"keyword.control.group_by"},{match:"(?i)\\bhaving\\b",name:"keyword.control.having"},{match:"(?i)\\bindex\\b",name:"keyword.control.index"},{match:"(?i)\\bjoin_one\\b",name:"keyword.control.join_one"},{match:"(?i)\\bwith\\b",name:"keyword.control.with"},{match:"(?i)\\bjoin_many\\b",name:"keyword.control.join_many"},{match:"(?i)\\bjoin_cross\\b",name:"keyword.control.join_cross"},{match:"(?i)\\blimit\\b",name:"keyword.control.limit"},{match:"(?i)\\bmeasure\\b",name:"keyword.control.measure"},{match:"(?i)\\bnest\\b",name:"keyword.control.nest"},{match:"(?i)\\border_by\\b",name:"keyword.control.order_by"},{match:"(?i)\\bpartition_by\\b",name:"keyword.control.partition_by"},{match:"(?i)\\bprimary_key\\b",name:"keyword.control.primary_key"},{match:"(?i)\\bproject\\b",name:"keyword.control.project"},{match:"(?i)\\bquery\\b",name:"keyword.control.query"},{match:"(?i)\\brename\\b",name:"keyword.control.rename"},{match:"(?i)\\btop\\b",name:"keyword.control.top"},{match:"(?i)\\bview\\b",name:"keyword.control.view"},{match:"(?i)\\bwhere\\b",name:"keyword.control.where"},{match:"(?i)\\bdeclare\\b",name:"keyword.control.declare"}]},keywords:{patterns:[{match:"(?i)\\bis\\b",name:"keyword.control.is"},{match:"(?i)\\bon\\b",name:"keyword.control.on"},{match:"(?i)\\bnot\\b",name:"keyword.other.not"},{match:"(?i)\\bor\\b",name:"keyword.other.or"},{match:"(?i)\\bdesc\\b",name:"keyword.control.desc"},{match:"(?i)\\bby\\b",name:"keyword.control.by"},{match:"(?i)\\band\\b",name:"keyword.other.and"},{match:"(?i)\\basc\\b",name:"keyword.control.asc"},{match:"(?i)\\bfor\\b",name:"keyword.other.for"},{match:"(?i)\\belse\\b",name:"keyword.other.else"},{match:"(?i)\\bto\\b",name:"keyword.other.to"},{match:"(?i)\\bwhen\\b",name:"keyword.other.when"},{match:"(?i)\\bpick\\b",name:"keyword.other.pick"},{match:"(?i)\\bimport\\b",name:"keyword.control.import"}]}}},JR={...Od,patterns:[...Od.patterns,{include:"#docvar"}],repository:{...Od.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},eN={name:"Malloy SQL",scopeName:"source.malloy-sql",patterns:[{include:"#malloysql-sql"}],repository:{"malloysql-sql":{beginCaptures:{0:{name:"entity.other.attribute.malloy-sql"},1:{name:"entity.other.attribute.malloy-sql"},3:{name:"comment.line.double-slash"}},name:"meta.embedded.block.malloysql.sql",patterns:[{include:"#comments"},{begin:"%{",end:"}%",beginCaptures:{0:{name:"punctuation.definition.malloy-sql"}},endCaptures:{0:{name:"punctuation.definition.malloy-sql"}},name:"meta.embedded.block.malloy",patterns:[{include:"source.malloy"}]},{include:"source.sql"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]}}},tN="github-light",nN="github-dark";let Md;function rN(){return Md||(Md=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:i},{default:s}]=await Promise.all([Promise.resolve().then(()=>require("./core-D259xTWB.cjs.js")),Promise.resolve().then(()=>require("./engine-oniguruma-BkproSVE.cjs.js")),Promise.resolve().then(()=>require("./sql-BqWZrLHB.cjs.js")),Promise.resolve().then(()=>require("./json-y-J1j5EW.cjs.js")),Promise.resolve().then(()=>require("./typescript-BqvpT6pB.cjs.js")),Promise.resolve().then(()=>require("./github-light-BFTOhCbz.cjs.js")),Promise.resolve().then(()=>require("./github-dark-BKL9xNgN.cjs.js"))]);return e({engine:t(Promise.resolve().then(()=>require("./wasm-Dw4u1m6u.cjs.js"))),themes:[i,s],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...JR},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...eN}]})})()),Md}async function $u(e,t,n="light"){return(await rN()).codeToHtml(e,{lang:t,theme:n==="dark"?nN:tN})}function Xt(e){const{server:t}=De.useServer(),n={...e,queryKey:[...e.queryKey,t],queryFn:async()=>{try{return await e.queryFn()}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const i=new Error(o.response.data.message||o.message);throw i.status=o.response.status,i.data=o.response.data,i}}throw r}},retry:!1,throwOnError:!1};return Lr.useQuery(n,De.globalQueryClient)}function vn(e){const t={...e,mutationFn:async n=>{try{return await e.mutationFn(n)}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const i=new Error(o.response.data.message||o.message);throw i.status=o.response.status,i.data=o.response.data,i}}throw r}},retry:!1,throwOnError:!1};return Lr.useMutation(t,De.globalQueryClient)}const Ht=e=>{const t=new URL(e),n={};if(t.protocol!=="publisher:")throw new Error(`Failed to parse resource URI: ${e}`);const r=(t.hostname+t.pathname).split("/");for(let o=0;o<r.length;o+=2){const i=r[o];i==="environments"?n.environmentName=decodeURI(r[o+1])||void 0:i==="packages"?n.packageName=decodeURI(r[o+1])||void 0:i==="connections"?n.connectionName=decodeURI(r[o+1])||void 0:i==="models"&&(n.modelPath=decodeURI(r.slice(o+1).join("/"))||void 0)}if(n.versionId=t.searchParams.get("versionId")||void 0,!n.environmentName)throw new Error(`Failed to parse resource URI: ${e}`);return n},Cl=e=>{if(!e.environmentName)throw new Error(`Failed to encode resource URI, missing environment name: ${e}`);let t=`publisher://environments/${e.environmentName}`;return e.packageName&&(t+=`/packages/${e.packageName}`),e.connectionName&&(t+=`/connections/${e.connectionName}`),e.modelPath&&(t+=`/models/${e.modelPath}`),e.packageName&&e.versionId&&(t+=`?versionId=${e.versionId}`),t};function kp({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:i}){return W.useEffect(()=>{o&&o(t)},[t,o]),c.jsx(De.StyledCardMedia,{children:c.jsxs(Ot.Stack,{spacing:2,component:"section",children:[c.jsx(qx,{sourceAndPath:e[t],existingQuery:n,onChange:s=>{r&&r(s)},resourceUri:i}),c.jsx(Ot.Box,{height:"5px"})]})})}function fu(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function oN({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:i}){const[s,a]=W.useState(n||fu()),[l,u]=W.useState(void 0);W.useEffect(()=>{n&&a(n)},[n]);const[d,f]=W.useState([]),{MalloyExplorerProvider:h,QueryPanel:p,ResizableCollapsiblePanel:m,ResultPanel:b,SourcePanel:y}=r;W.useEffect(()=>{t&&t(s)},[t,s]);const{environmentName:x,packageName:C,versionId:v}=Ht(i),{apiClients:S}=De.useServer(),I=vn({mutationFn:()=>{const F=typeof s?.malloyQuery=="string"?s.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:s?.malloyQuery}).toMalloy();return u({executionState:"running",query:s?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{I.reset(),u(void 0)},response:{result:{}}}),a({...s,query:F}),S.models.executeQueryModel(x,C,e.modelPath,{query:F,sourceName:void 0,queryName:void 0,versionId:v})},onSuccess:F=>{if(F){const B=JSON.parse(F.data.result);a({...s,malloyResult:B}),u(j=>j?{...j,executionState:"finished",response:{result:B}}:void 0)}},onError:F=>{u(void 0),console.error("Query execution error:",F)}}),[T,N]=W.useState(e.sourceInfo.name);W.useEffect(()=>{T!==e.sourceInfo.name&&(N(e.sourceInfo.name),a(fu()),u(void 0))},[e,T]);const O=W.useCallback(F=>{a({...s,malloyQuery:F,malloyResult:void 0})},[s]);return T!==e.sourceInfo.name?c.jsx("div",{children:"Loading..."}):c.jsx(De.StyledExplorerContent,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:c.jsx(h,{source:e.sourceInfo,query:s?.malloyQuery,topValues:[],onFocusedNestViewPathChange:f,focusedNestViewPath:d,onQueryChange:O,children:c.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[c.jsx(m,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:c.jsx(y,{onRefresh:()=>a(fu())})}),c.jsx(m,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:c.jsx(p,{runQuery:()=>{console.log(`running query with: ${s?.malloyQuery}`);try{I.mutate()}catch(F){console.error("Error running query:",F)}}})}),c.jsx(b,{source:e.sourceInfo,draftQuery:s?.malloyQuery,setDraftQuery:F=>a({...s,malloyQuery:F}),submittedQuery:l,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function qx(e){const[t,n]=W.useState(null),[r,o]=W.useState(null),[i,s]=W.useState(!0);return W.useEffect(()=>{let a=!0;return Promise.all([import("@malloydata/malloy-explorer"),import("@malloydata/malloy-query-builder")]).then(([l,u])=>{a&&(n(l),o(u),s(!1))}).catch(l=>{console.error("Failed to load Malloy components:",l),a&&s(!1)}),()=>{a=!1}},[]),i||!t||!r?c.jsx(De.StyledExplorerPage,{children:c.jsx(De.StyledExplorerContent,{children:c.jsx(Ot.Box,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):c.jsx(oN,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}const Yx=mt(c.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}));function Sn({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:i=2,textVariant:s="body2"}){const a=c.jsxs(w.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:i},children:[c.jsx(w.CircularProgress,{size:t,color:n,thickness:r}),e&&c.jsx(w.Typography,{variant:s,color:"text.secondary",children:e})]});return o?c.jsx(w.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:a}):a}const iN=new Set(["warn","error"]);function sN(e){if(!e?.length)return;const t=[];let n=!1;for(const r of e)!r.message||!iN.has(r.severity??"")||(r.severity==="error"&&(n=!0),t.includes(r.message)||t.push(r.message));if(t.length)return{severity:n?"error":"warn",title:t.join(`
93
93
  `)}}const aN=W.lazy(()=>Promise.resolve().then(()=>_W));function Os({result:e,maxHeight:t,maxResultSize:n=0,renderLogs:r}){const o=W.useRef(null),[i,s]=W.useState(t),[a,l]=W.useState(!1),u=sN(r);if(!e)return null;if(n>0&&e.length>n&&!a)return c.jsxs(w.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[c.jsx(On.Warning,{sx:{fontSize:48,color:"#757575"}}),c.jsx(w.Typography,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),c.jsx(w.Button,{variant:"contained",color:"primary",onClick:()=>l(!0),children:"Proceed"})]});const f=c.jsx(Sn,{text:"Loading...",centered:!0,size:32}),h=Math.min(t,i);return c.jsxs(w.Box,{ref:o,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden"},children:[e&&c.jsx(W.Suspense,{fallback:f,children:c.jsx(aN,{result:e,height:h,onSizeChange:s})}),u&&c.jsx(w.Box,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:c.jsx(w.Tooltip,{title:u.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:c.jsx(w.IconButton,{size:"small","aria-label":"Render tag warnings",sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"}},children:c.jsx(Yx,{fontSize:"small",color:u.severity==="error"?"error":"warning"})})})})]})}function lN({cell:e,sourceAndPaths:t,resourceUri:n,onQueryChange:r,onSourceChange:o}){const i={query:e.value,malloyResult:e.result?JSON.parse(e.result):void 0,malloyQuery:e.queryInfo?JSON.parse(e.queryInfo):void 0},s=t.findIndex(a=>a.sourceInfo.name===e.sourceName);return c.jsx(kp,{resourceUri:n,sourceAndPaths:t,selectedSourceIndex:s>=0?s:0,existingQuery:i,onQueryChange:r,onSourceChange:o})}function uN({cell:e,editingMalloy:t,editingMarkdown:n,sourceAndPaths:r,resourceUri:o,onCellChange:i,onClose:s,onEdit:a,onDelete:l,addButtonCallback:u}){const[d,f]=W.useState(e.value),[h,p]=W.useState(!1),[m,b]=W.useState(!1),[y,x]=W.useState(),[C]=W.useState(),[v,S]=W.useState(fu()),[I,T]=W.useState(!1),[N,O]=W.useState(e.sourceName?r.findIndex(se=>se.sourceInfo.name===e.sourceName):0),{mode:F}=De.usePublisherTheme();W.useEffect(()=>{e.isMarkdown||$u(e.value,"malloy",F).then(se=>{x(se)})},[e,F]),W.useEffect(()=>{document.documentElement.setAttribute("data-color-mode","light")});const[B,j]=W.useState(!1),D=()=>{l(),j(!1)},H=r.length===0,_=W.useCallback(()=>{const se=r[N],z=se?.modelPath||e.modelPath||"",pe=se?.sourceInfo.name||e.sourceName||"";i({...e,value:e.isMarkdown?d:v.query,result:v.malloyResult?JSON.stringify(v.malloyResult):void 0,queryInfo:v.malloyQuery?JSON.stringify(v.malloyQuery):void 0,sourceName:pe,modelPath:z})},[e,d,v,i,N,r]),L=c.jsx(w.Tooltip,{title:"Delete Cell",children:c.jsx(w.IconButton,{size:"small",onClick:()=>j(!0),children:c.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:c.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m2 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14zM10 11v6M14 11v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),$=c.jsxs(w.Dialog,{open:B,onClose:()=>j(!1),children:[c.jsx(w.DialogTitle,{children:"Confirm Delete"}),c.jsx(w.DialogContent,{children:c.jsx(w.Typography,{children:"Are you sure you want to delete this cell?"})}),c.jsxs(w.DialogActions,{children:[c.jsx(w.Button,{onClick:()=>j(!1),children:"Cancel"}),c.jsx(w.Button,{onClick:D,color:"error",children:"Delete"})]})]}),K=()=>{_(),s()},G=e.isMarkdown?c.jsxs(c.Fragment,{children:[n?c.jsx(w.Tooltip,{title:"Save",children:c.jsx(w.IconButton,{size:"small",onClick:K,children:c.jsx(Hl,{})})}):c.jsx(w.Tooltip,{title:"Edit",children:c.jsx(w.IconButton,{size:"small",onClick:a,children:c.jsx(Pm,{})})}),!n&&L]}):c.jsxs(c.Fragment,{children:[!t&&c.jsx(w.Tooltip,{title:h?"Hide Code":"View Code",children:c.jsx(w.IconButton,{size:"small",onClick:()=>{p(!h)},children:c.jsx(vb,{})})}),!t&&e.result&&c.jsx(w.Tooltip,{title:m?"Hide Embedding":"View Embedding",children:c.jsx(w.IconButton,{size:"small",onClick:()=>{b(!m)},children:c.jsx(Kf,{})})}),t&&c.jsx(w.Tooltip,{title:"Save",children:c.jsx(w.IconButton,{size:"small",onClick:K,children:c.jsx(Hl,{})})}),!t&&c.jsx(w.Tooltip,{title:"Edit",children:c.jsx(w.IconButton,{size:"small",onClick:a,children:c.jsx(Pm,{})})}),!t&&L]}),q=t||n,R=n?c.jsx(w.Tooltip,{title:"Save",children:c.jsx(w.IconButton,{size:"small",onClick:K,children:c.jsx(Hl,{})})}):t?c.jsx(w.Tooltip,{title:"Save",children:c.jsx(w.IconButton,{size:"small",onClick:K,children:c.jsx(Hl,{})})}):null,oe=I&&c.jsx(w.Box,{sx:{position:"absolute",top:"4px",right:"4px",display:"flex",gap:"8px",backgroundColor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:"8px",padding:"2px 4px",boxShadow:1,zIndex:10},children:!q&&c.jsxs(c.Fragment,{children:[u(!0),u(!1),G]})||R});return c.jsxs(De.StyledCard,{sx:se=>({position:"relative",marginTop:"5px",marginBottom:"5px",borderWidth:"1.5px",backgroundColor:se.palette.background.paper,minHeight:"50px"}),onMouseEnter:()=>T(!0),onMouseLeave:()=>{T(!1)},children:[oe,e.isMarkdown?c.jsx(c.Fragment,{children:n?c.jsx(Wx,{value:d,preview:"edit",autoFocus:!0,onChange:se=>{f(se),i({...e,value:se})},onBlur:()=>{_(),I||K()}}):c.jsx(w.Box,{sx:{px:.5,pt:0,mt:0,"& h1, & h2, & h3, & h4, & h5, & h6":{mt:.5,mb:.5},"& p":{mt:.5,mb:.5},"& ul, & ol":{mt:.5,mb:.5},"& li":{mt:0,mb:0},"& pre, & code":{mt:.5,mb:.5},"& blockquote":{mt:.5,mb:.5}},children:e.value?c.jsx(w.Box,{onClick:a,sx:{cursor:"pointer"},children:c.jsx(wu,{children:e.value})}):c.jsxs(w.Box,{onClick:a,sx:{cursor:"pointer"},children:[c.jsx(w.Typography,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Markdown is empty"}),c.jsx(w.Typography,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})})}):c.jsxs(c.Fragment,{children:[c.jsx(w.Collapse,{in:m,timeout:"auto",unmountOnExit:!0,children:c.jsx(w.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:c.jsx(w.Typography,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:C}})})}),c.jsx(w.Collapse,{in:h,timeout:"auto",unmountOnExit:!0,children:c.jsx(w.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:c.jsx(w.Typography,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:y}})})}),t&&(H?c.jsxs(c.Fragment,{children:[c.jsx(w.Typography,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"No Model Imports"}),c.jsx(w.Typography,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Please add a model import above."})]}):c.jsx(lN,{sourceAndPaths:r,resourceUri:o,onQueryChange:se=>{S(se)},onSourceChange:se=>{O(se)},cell:e})),!t&&e.result&&c.jsx(De.StyledCard,{variant:"outlined",sx:{borderRadius:0},children:c.jsx(Os,{result:e.result,maxHeight:800})}),!t&&!e.result&&c.jsxs(w.Box,{onClick:a,sx:{cursor:"pointer"},children:[c.jsx(w.Typography,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Explore is empty"}),c.jsx(w.Typography,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})]}),B&&$]})}const Kx=W.createContext(void 0);function cN({children:e,workbookStorage:t}){const n=W.useMemo(()=>({workbookStorage:t}),[t]);return c.jsx(Kx.Provider,{value:n,children:e})}function wp(){const e=W.useContext(Kx);if(!e)throw new Error("useWorkbookStorage must be used within a WorkbookStorageProvider");return e}const Fr=mt(c.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),dN=mt(c.jsx("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3zM7 9l1.41 1.41L11 7.83V16h2V7.83l2.59 2.58L17 9l-5-5z"}));function kn({error:e,context:t}){const n=e.data?.message||"Unknown Error";return c.jsxs(c.Fragment,{children:[t&&c.jsx(w.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:t}),c.jsx("pre",{style:{whiteSpace:"pre-wrap",color:"red",padding:"10px",margin:"auto"},children:n})]})}function fN({initialSelectedModels:e,onModelChange:t,resourceUri:n}){const{environmentName:r,packageName:o,versionId:i}=Ht(n),{apiClients:s}=De.useServer(),{data:a,isLoading:l,isSuccess:u,isError:d,error:f}=Xt({queryKey:["models",r,o,i],queryFn:()=>s.models.listModels(r,o,i)}),[h,p]=W.useState(e||[]),[m,b]=W.useState(null);W.useEffect(()=>{p(e||[])},[e]);const y=v=>{const S=h.filter(I=>I!==v);p(S),t(S)},x=v=>{const S=[...h,v];p(S),t(S),b(null)};let C=[];return u&&a?.data&&(C=a.data.filter(v=>!h.includes(v.path)).map(v=>v.path)),d?c.jsx(kn,{error:f,context:`${r} > ${o} > Model Picker`}):c.jsxs(c.Fragment,{children:[c.jsxs(w.FormControl,{fullWidth:!0,children:[l&&c.jsx(w.Typography,{children:"Loading..."}),c.jsxs(w.Stack,{direction:"row",spacing:1,children:[h.map(v=>c.jsx(w.Chip,{label:v,onDelete:()=>y(v),deleteIcon:c.jsx(Fr,{}),sx:{marginBottom:"5px"}},v)),c.jsx(w.Button,{size:"small",startIcon:c.jsx(dN,{}),onClick:v=>b(v.currentTarget),disabled:l||d||C.length===0,children:"Add Model"})]})]}),c.jsxs(w.Menu,{anchorEl:m,open:!!m,onClose:()=>b(null),children:[c.jsx(w.Typography,{variant:"subtitle2",sx:{ml:1},children:"Models"}),c.jsx(w.Divider,{}),C.length===0?c.jsx(w.MenuItem,{disabled:!0,children:"No models available"}):C.map(v=>c.jsx(w.MenuItem,{onClick:()=>x(v),children:c.jsx(w.Typography,{variant:"body2",children:v})},v))]})]})}function Gx(){const e=rT.useNavigate();return(t,n)=>{if(!n||!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.button!==1){e(t);return}const r=new URL(t,window.location.href).href;(n.metaKey||n.ctrlKey||n.button===1||n.shiftKey)&&window.open(r,"_blank")}}function pN({workbookPath:e,resourceUri:t}){const n=Gx(),{server:r,getAccessToken:o}=De.useServer(),{apiClients:i}=De.useServer(),{workbookStorage:s}=wp(),{environmentName:a,packageName:l}=Ht(t),[u,d]=W.useState(void 0),[f,h]=W.useState(void 0);if(!s)throw new Error("Workbook storage be provided via WorkbookStorageProvider");const[p,m]=W.useState(),[b,y]=W.useState(),[x,C]=W.useState(),[v,S]=W.useState([]),[I,T]=W.useState(null),[N,O]=W.useState(null),F=!!I,B=()=>{T(null),O(null)},j=(oe,se)=>{p&&(m(p.insertCell(se,{isMarkdown:oe,value:""})),oe?C(se):y(se),B(),console.log("handleAddCell",oe,se))},[D,H]=W.useState(!1),_=()=>{H(!0)},L=async()=>{e&&s&&await s.deleteWorkbook(e).then(()=>{h(void 0),d(void 0)}).catch(oe=>{h(`Error deleting workbook: ${oe.message}`),d(void 0)}),H(!1),n(`/${a}/${l}`)},$=()=>{H(!1)},K=W.useCallback(async()=>{if(!p){console.log("No workbook data ref");return}try{m(await p.saveWorkbook()),h(void 0),d("Workbook saved")}catch(oe){h(`Error saving workbook: ${oe.message}`),d(void 0)}},[p]);if(W.useEffect(()=>{if(!p)return;(async()=>{const se=new Map(v.map(({modelPath:J,sourceInfos:Q})=>[J,Q])),z=[],pe=[];for(const J of p.getModels())se.has(J)?z.push({modelPath:J,sourceInfos:se.get(J)}):(console.log("Fetching model from Publisher",J),pe.push(i.models.getModel(a,l,J,void 0).then(Q=>({modelPath:J,sourceInfos:Q.data.sourceInfos.map(re=>JSON.parse(re))}))));if(pe.length>0){const J=await Promise.all(pe);S([...z,...J])}else S(z)})()},[o,p,l,a,r]),W.useEffect(()=>{e&&ns.loadWorkbook(s,e).then(oe=>{m(oe)})},[e,s]),!p)return c.jsx("div",{children:"Loading..."});const G=oe=>{const se=[];for(const z of oe)for(const pe of z.sourceInfos)se.push({modelPath:z.modelPath,sourceInfo:pe});return se},q=(oe,se)=>c.jsx(w.Button,{size:"small",startIcon:c.jsx(fl,{}),onClick:()=>j(oe,se),variant:"contained",sx:{backgroundColor:z=>z.palette.background.paper,color:z=>z.palette.mode==="dark"?z.palette.grey[100]:z.palette.grey[700],boxShadow:"none","&:hover":{backgroundColor:z=>z.palette.mode==="dark"?z.palette.grey[500]:z.palette.grey[300],boxShadow:"none"}},children:oe?"Markdown":"Explore"}),R=c.jsxs(w.Box,{sx:{display:"flex",gap:1,justifyContent:"center",flex:2},children:[q(!1,p.getCells().length),q(!0,p.getCells().length)]});return c.jsxs(De.StyledCard,{variant:"outlined",children:[c.jsxs(De.StyledCardContent,{children:[c.jsx(w.Box,{sx:{mb:2},children:c.jsx(w.Box,{sx:{minHeight:"24px"},children:f?c.jsx(w.Typography,{color:"error",variant:"body2",children:f}):u?c.jsx(w.Typography,{color:"success",variant:"body2",children:u}):c.jsx("span",{children:" "})})}),c.jsxs(Ui,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[c.jsxs(Ui,{direction:"row",spacing:1,alignItems:"center",children:[c.jsx(w.Typography,{variant:"overline",sx:{fontSize:"13px",fontWeight:"bold",verticalAlign:"middle"},children:"Workbook"}),c.jsx(w.Typography,{variant:"subtitle2",sx:{fontSize:"13px",fontWeight:"normal",verticalAlign:"middle",ml:1},children:`${e.workspace} > ${e.path}`})]}),c.jsxs(Ui,{sx:{display:"flex",flexDirection:"row",gap:1},children:[c.jsx(w.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:c.jsx(hN,{workbookData:p})}),c.jsxs(w.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:[c.jsx(w.Button,{color:"error",onClick:_,size:"small",children:"Delete"}),c.jsxs(w.Dialog,{open:D,onClose:$,children:[c.jsx(w.DialogTitle,{children:"Delete Workbook"}),c.jsx(w.DialogContent,{children:c.jsxs(w.DialogContentText,{children:['Are you sure you want to delete the workbook "',e.path,'"? This action cannot be undone.']})}),c.jsxs(w.DialogActions,{children:[c.jsx(w.Button,{onClick:$,color:"primary",size:"small",children:"Cancel"}),c.jsx(w.Button,{onClick:L,color:"error",autoFocus:!0,size:"small",children:"Delete"})]})]})]})]})]}),c.jsx(w.Divider,{}),c.jsxs(Ui,{sx:{display:"flex",flexDirection:"row",width:"100%",mt:2},children:[c.jsx(w.Box,{sx:{flex:1},children:c.jsx(fN,{initialSelectedModels:p.getModels(),onModelChange:oe=>{m(p.setModels(oe)),K()},resourceUri:t})}),c.jsx(w.Box,{sx:{flex:1}})]})]}),c.jsx(De.StyledCardMedia,{children:c.jsxs(Ui,{children:[p.getCells().length===0&&c.jsxs(c.Fragment,{children:[c.jsx(w.Typography,{sx:{textAlign:"center",p:2,variant:"subtitle2",fontWeight:"medium"},children:"Workbook is empty"}),c.jsx(w.Typography,{variant:"body2",sx:{textAlign:"center",mb:2,variant:"body2"},children:"Click the + buttons to add a markdown or code cell."})]}),p.getCells().map((oe,se)=>c.jsx(W.Fragment,{children:c.jsx(uN,{cell:oe,resourceUri:t,addButtonCallback:z=>q(z,se),sourceAndPaths:G(v),editingMarkdown:x===se,editingMalloy:b===se,onDelete:()=>{m(p.deleteCell(se)),K()},onCellChange:z=>{m(p.setCell(se,z))},onEdit:()=>{oe.isMarkdown?C(se):y(se)},onClose:()=>{oe.isMarkdown?C(void 0):y(void 0),K()}},`${se}-${oe.isMarkdown}-${e.workspace}-${e.path}`)},`${se}-${p.getCells().length}`)),R,c.jsxs(w.Menu,{anchorEl:I,open:F,onClose:B,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[c.jsx(w.MenuItem,{onClick:()=>j(!0,N??0),children:"Add Markdown"}),c.jsx(w.MenuItem,{onClick:()=>j(!1,N??0),children:"Add Malloy"})]}),c.jsx(Ui,{sx:{flexDirection:"row",justifyContent:"flex-end",p:1}})]})})]})}function hN({workbookData:e}){const[t,n]=W.useState(!1),r=async()=>{if(!e)return;const o=e.toMalloyWorkbook();try{await navigator.clipboard.writeText(o),n(!0),setTimeout(()=>n(!1),1500)}catch{n(!1),alert("Failed to copy to clipboard")}};return c.jsx(w.Button,{color:"primary",onClick:r,size:"small",children:t?"Copied!":"Export"})}function Qx({onWorkbookClick:e}){const{workbookStorage:t}=wp(),[n,r]=W.useState([]),[o,i]=W.useState(void 0);return W.useEffect(()=>{t&&t.listWorkspaces(!1).then(s=>{const a=[];Promise.all(s.map(async l=>{await t.listWorkbooks(l).then(u=>{a.push(...u)}).catch(u=>{i(`Error listing workbooks: ${u.message}`)})})).then(()=>{r(a),i(void 0)})})},[t]),c.jsxs(c.Fragment,{children:[o&&c.jsx(w.Box,{sx:{mb:2},children:c.jsx(w.Typography,{color:"error",variant:"body2",children:o})}),c.jsx(w.Divider,{}),c.jsx(w.Box,{sx:{maxHeight:"300px",overflow:"auto","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"rgba(0,0,0,0.2)",borderRadius:"4px"}},children:c.jsxs(w.List,{dense:!0,children:[n.length===0&&c.jsx(w.ListItem,{children:c.jsx(w.ListItemText,{primary:"No workbooks found.",sx:{textAlign:"center"}})}),n.map(s=>c.jsx(w.ListItem,{onClick:a=>e(s,a),sx:{cursor:"pointer","&:hover":{backgroundColor:"action.hover"}},children:c.jsx(w.ListItemText,{primary:s.path})},s.path))]})})]})}const cg="Local";class mN{async listWorkspaces(t){return Promise.resolve([{name:cg,description:"Stored locally- only accessible to this browser",writeable:!0}])}async listWorkbooks(t){const n=[];for(let r=0;r<localStorage.length;r++){const o=localStorage.key(r);n.push({path:o,workspace:cg})}return n}async getWorkbook(t){const n=localStorage.getItem(t.path);if(n===null)throw new Error(`Notebook not found at path: ${t}`);return n}async deleteWorkbook(t){if(localStorage.getItem(t.path)===null)throw new Error(`Notebook not found at path: ${t}`);localStorage.removeItem(t.path)}async saveWorkbook(t,n){localStorage.setItem(t.path,n)}async moveWorkbook(t,n){const r=localStorage.getItem(t.path);if(r===null)throw new Error(`Notebook not found at path: ${t.path}`);localStorage.setItem(n.path,r),localStorage.removeItem(t.path)}}function gN({onWorkbookSelect:e}){const{workbookStorage:t}=wp(),[n,r]=W.useState(""),[o,i]=W.useState(""),[s,a]=W.useState([]),[l,u]=W.useState(null),[d,f]=W.useState(!1),[h,p]=W.useState(!1),m=!!l,b=T=>{u(T.currentTarget)},y=()=>{u(null)},x=()=>{p(!1)},C=()=>{f(!1),r(""),i("")};W.useEffect(()=>{t&&(console.log("fetching workspaces"),t.listWorkspaces(!0).then(T=>{a(T),T.length===1&&i(T[0].name)}).catch(T=>{console.error("Error fetching workspaces:",T),a([])}))},[t]);const v=(T,N)=>{p(!1),e(T,N)},S=T=>{f(!1),e({path:n,workspace:o},T),r(""),i("")},I=s.length===0;return c.jsxs(c.Fragment,{children:[c.jsx(w.Button,{"aria-controls":m?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:b,variant:"contained",sx:{height:"40px",px:2,backgroundColor:"#fbbb04","&:hover":{backgroundColor:"#eab308"}},children:"Analyze Package"}),c.jsxs(w.Menu,{id:"basic-menu",anchorEl:l,open:m,onClose:y,MenuListProps:{"aria-labelledby":"basic-button",sx:{py:.5}},children:[c.jsxs(w.MenuItem,{onClick:()=>{f(!0),y()},sx:{py:1,px:2},disabled:I,children:[c.jsx(w.ListItemIcon,{children:c.jsx(On.Add,{fontSize:"small"})}),c.jsxs(w.ListItemText,{children:[c.jsx(w.Typography,{variant:"body2",fontWeight:500,children:"New Workbook"}),I?c.jsx(w.Typography,{variant:"caption",color:"text.secondary",children:"No workspaces available"}):c.jsx(w.Typography,{variant:"caption",color:"text.secondary",children:"Create a new analysis workbook"})]})]}),c.jsxs(w.MenuItem,{onClick:()=>{p(!0),y()},sx:{py:1,px:2},children:[c.jsx(w.ListItemIcon,{children:c.jsx(On.Launch,{fontSize:"small"})}),c.jsxs(w.ListItemText,{children:[c.jsx(w.Typography,{variant:"body2",fontWeight:500,children:"Open Workbook"}),c.jsx(w.Typography,{variant:"caption",color:"text.secondary",children:"Open an existing workbook"})]})]})]}),c.jsxs(w.Dialog,{open:d,onClose:C,maxWidth:"sm",fullWidth:!0,children:[c.jsxs(w.DialogTitle,{sx:{pb:1,pt:2,px:2},children:[c.jsx(w.Typography,{fontWeight:600,sx:{fontSize:"1.5rem",mb:.5},children:"Create New Workbook"}),c.jsx(w.Typography,{variant:"body2",color:"text.secondary",children:"Start a new analysis workbook to explore your data"})]}),c.jsx(w.DialogContent,{sx:{px:2,pb:2},children:c.jsxs(w.Stack,{spacing:2,sx:{mt:1},children:[s.length>1?c.jsxs(w.FormControl,{fullWidth:!0,size:"small",children:[c.jsx(w.InputLabel,{children:"Workspace"}),c.jsx(w.Select,{value:o,label:"Workspace",onChange:T=>i(T.target.value),children:s.map(T=>c.jsx(w.MenuItem,{value:T.name,children:c.jsxs(w.Box,{children:[c.jsx(w.Typography,{variant:"body2",fontWeight:500,children:T.name}),c.jsx(w.Typography,{variant:"caption",color:"text.secondary",children:T.description})]})},T.name))})]}):s.length===1?c.jsxs(w.Box,{sx:T=>({p:2,border:1,borderColor:"divider",borderRadius:1,backgroundColor:T.palette.mode==="dark"?"rgba(255, 255, 255, 0.04)":"grey.50"}),children:[c.jsxs(w.Typography,{variant:"body2",fontWeight:500,gutterBottom:!0,children:["Workspace: ",s[0].name]}),c.jsx(w.Typography,{variant:"caption",color:"text.secondary",children:s[0].description})]}):null,c.jsx(w.FormControl,{fullWidth:!0,children:c.jsx(w.TextField,{label:"Workbook Name",value:n,onChange:T=>r(T.target.value),placeholder:"Enter workbook name...",fullWidth:!0,autoFocus:!0,size:"small"})}),c.jsxs(w.Stack,{direction:"row",spacing:1,justifyContent:"flex-end",children:[c.jsx(w.Button,{onClick:C,variant:"outlined",size:"small",children:"Cancel"}),c.jsx(w.Button,{onClick:T=>S(T),variant:"contained",disabled:!n.trim()||s.length>1&&!o,size:"small",children:"Create Workbook"})]})]})})]}),c.jsxs(w.Dialog,{open:h,onClose:x,maxWidth:"md",fullWidth:!0,children:[c.jsxs(w.DialogTitle,{sx:{pb:1,pt:2,px:2},children:[c.jsx(w.Typography,{fontWeight:600,sx:{mb:.5,fontSize:"1.5rem"},children:"Open Workbook"}),c.jsx(w.Typography,{variant:"body2",color:"text.secondary",children:"Select an existing workbook to continue your analysis"})]}),c.jsx(w.DialogContent,{sx:{px:2,pb:2},children:c.jsx(Qx,{onWorkbookClick:v})})]})]})}const Xx=mt(c.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}));function bN({onSubmit:e,isSubmitting:t,disabled:n,disabledReason:r}){const[o,i]=W.useState(!1),[s,a]=W.useState(!1),l=()=>i(!1),u=async()=>{try{await e({forceRefresh:s}),i(!1)}catch{}},d=c.jsx("span",{children:c.jsx(w.Button,{variant:"contained",startIcon:c.jsx(fl,{}),onClick:()=>i(!0),disabled:n,"aria-label":"New materialization",children:"New materialization"})});return c.jsxs(c.Fragment,{children:[n&&r?c.jsx(w.Tooltip,{title:r,children:d}):d,c.jsxs(w.Dialog,{open:o,onClose:l,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"create-materialization-title",children:[c.jsx(w.DialogTitle,{id:"create-materialization-title",children:"New materialization"}),c.jsxs(w.DialogContent,{children:[c.jsx(w.DialogContentText,{sx:{mb:2},children:"Materialize every persist source in this package: compile, build the tables, and load them so queries serve from the materialized tables."}),c.jsx(w.FormGroup,{children:c.jsx(w.FormControlLabel,{control:c.jsx(w.Switch,{checked:s,onChange:f=>a(f.target.checked)}),label:"Force refresh (rebuild even if unchanged)"})})]}),c.jsxs(w.DialogActions,{children:[c.jsx(w.Button,{onClick:l,children:"Cancel"}),c.jsx(w.Button,{variant:"contained",loading:t,onClick:u,children:"Materialize"})]})]})]})}function Tf({children:e}){return c.jsx(w.Typography,{variant:"caption",component:"h6",sx:{display:"block",textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:"text.secondary",mb:1},children:e})}function Ja(e){return e===De.MaterializationStatus.Pending||e===De.MaterializationStatus.ManifestRowsReady}function yN(e){return e===De.MaterializationStatus.ManifestFileReady||e===De.MaterializationStatus.Failed||e===De.MaterializationStatus.Cancelled}function Zx(e){switch(e){case De.MaterializationStatus.ManifestFileReady:return"Done";case De.MaterializationStatus.Failed:return"Failed";case De.MaterializationStatus.Cancelled:return"Cancelled";case De.MaterializationStatus.Pending:case De.MaterializationStatus.ManifestRowsReady:return"Pending";default:return"Unknown"}}function Jx(e){switch(e){case De.MaterializationStatus.ManifestRowsReady:return"info";case De.MaterializationStatus.ManifestFileReady:return"success";case De.MaterializationStatus.Failed:return"error";case De.MaterializationStatus.Cancelled:return"warning";case De.MaterializationStatus.Pending:default:return"default"}}function e2(e){return e.metadata??{}}function xN(e){return e.trigger==="SCHEDULER"?"Scheduled":"Manual"}function t2(e,t){if(!e)return"-";const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),o=Math.max(0,r-n);if(o<1e3)return`${o}ms`;const i=Math.round(o/1e3);if(i<60)return`${i}s`;const s=Math.floor(i/60),a=i%60;if(s<60)return`${s}m ${a}s`;const l=Math.floor(s/60),u=s%60;return`${l}h ${u}m`}function Sf(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function CN(e){if(!e)return"-";const t=new Date(e).getTime(),n=Math.round((Date.now()-t)/1e3);if(n<60)return"just now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function EN({entries:e,builtAt:t}){const n=Object.entries(e??{});return c.jsxs(w.Box,{children:[c.jsxs(w.Stack,{direction:"row",alignItems:"baseline",justifyContent:"space-between",children:[c.jsx(Tf,{children:"Build manifest"}),t&&c.jsxs(w.Typography,{variant:"caption",color:"text.secondary",children:["Built ",Sf(t)]})]}),n.length===0?c.jsx(w.Typography,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"No materialized tables yet."}):c.jsxs(w.Table,{size:"small",children:[c.jsx(w.TableHead,{children:c.jsxs(w.TableRow,{children:[c.jsx(w.TableCell,{children:"Source"}),c.jsx(w.TableCell,{children:"Table name"}),c.jsx(w.TableCell,{children:"Connection"}),c.jsx(w.TableCell,{children:"Realization"}),c.jsx(w.TableCell,{align:"right",children:"Rows"})]})}),c.jsx(w.TableBody,{children:n.map(([r,o])=>c.jsxs(w.TableRow,{children:[c.jsx(w.TableCell,{sx:{fontFamily:De.MONO_FONT_FAMILY},children:o.sourceName??r}),c.jsx(w.TableCell,{sx:{fontFamily:De.MONO_FONT_FAMILY},children:o.physicalTableName??"-"}),c.jsx(w.TableCell,{sx:{fontFamily:De.MONO_FONT_FAMILY},children:o.connectionName??"-"}),c.jsx(w.TableCell,{children:o.realization??"-"}),c.jsx(w.TableCell,{align:"right",children:o.rowCount??"-"})]},r))})]})]})}const Hu=mt([c.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),c.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")]),vN=mt(c.jsx("path",{d:"M9 11.24V7.5C9 6.12 10.12 5 11.5 5S14 6.12 14 7.5v3.74c1.21-.81 2-2.18 2-3.74C16 5.01 13.99 3 11.5 3S7 5.01 7 7.5c0 1.56.79 2.93 2 3.74m9.84 4.63-4.54-2.26c-.17-.07-.35-.11-.54-.11H13v-6c0-.83-.67-1.5-1.5-1.5S10 6.67 10 7.5v10.74c-3.6-.76-3.54-.75-3.67-.75-.31 0-.59.13-.79.33l-.79.8 4.94 4.94c.27.27.65.44 1.06.44h6.79c.75 0 1.33-.55 1.44-1.28l.75-5.27c.01-.07.02-.14.02-.2 0-.62-.38-1.16-.91-1.38"}));function n2({meta:e}){const t=e.trigger==="SCHEDULER";return c.jsx(w.Tooltip,{title:t?"Fired by the materialization schedule":"Triggered manually",children:c.jsx(w.Chip,{size:"small",variant:"outlined",color:t?"info":"default",icon:t?c.jsx(Hu,{fontSize:"small"}):c.jsx(vN,{fontSize:"small"}),label:xN(e)})})}function r2({materialization:e,buildPlan:t,showBuildPlan:n=!0,onClose:r}){const o=e?e2(e):{},i=Object.values(t?.sources??{});return c.jsx(w.Dialog,{open:e!==null,onClose:r,maxWidth:"md",fullWidth:!0,"aria-labelledby":"materialization-detail-title",children:e&&c.jsxs(c.Fragment,{children:[c.jsxs(w.DialogTitle,{sx:{pr:6,pb:1.5},id:"materialization-detail-title",children:[c.jsxs(w.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{mb:.75},children:[c.jsx(w.Chip,{size:"small",label:Zx(e.status),color:Jx(e.status),variant:Ja(e.status)?"filled":"outlined"}),c.jsx(n2,{meta:o})]}),c.jsx(w.Typography,{variant:"subtitle1",sx:{fontWeight:600},children:e.packageName??"Materialization"}),c.jsx(w.Typography,{variant:"caption",color:"text.secondary",sx:{fontFamily:De.MONO_FONT_FAMILY,wordBreak:"break-all"},children:e.id}),c.jsx(w.IconButton,{"aria-label":"close",onClick:r,sx:{position:"absolute",right:8,top:8},children:c.jsx(Fr,{fontSize:"small"})})]}),c.jsxs(w.DialogContent,{dividers:!0,children:[c.jsxs(w.Box,{sx:{bgcolor:"action.hover",borderRadius:2,p:2,mb:3,display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:2},children:[c.jsx(na,{label:"Started",value:Sf(e.startedAt??e.createdAt)}),c.jsx(na,{label:"Completed",value:Sf(e.completedAt)}),c.jsx(na,{label:"Duration",value:t2(e.startedAt,e.completedAt)}),c.jsx(na,{label:"Sources",value:`${o.sourcesBuilt??0} built · ${o.sourcesReused??0} reused`}),c.jsx(na,{label:"Force refresh",value:o.forceRefresh?"Yes":"No"})]}),e.error&&c.jsxs(w.Box,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"error.main"},children:[c.jsx(Tf,{children:c.jsx(w.Box,{component:"span",sx:{color:"error.main"},children:"Error"})}),c.jsx(w.Typography,{variant:"body2",sx:{fontFamily:De.MONO_FONT_FAMILY,whiteSpace:"pre-wrap"},children:e.error})]}),n&&c.jsxs(w.Box,{sx:{mb:3},children:[c.jsx(Tf,{children:"Build plan"}),i.length===0?c.jsx(w.Typography,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"This package has no persist sources."}):c.jsxs(w.Table,{size:"small",children:[c.jsx(w.TableHead,{children:c.jsxs(w.TableRow,{children:[c.jsx(w.TableCell,{children:"Source"}),c.jsx(w.TableCell,{children:"Connection"}),c.jsx(w.TableCell,{children:"Dialect"}),c.jsx(w.TableCell,{align:"right",children:"Columns"}),c.jsx(w.TableCell,{children:"Source Entity ID"})]})}),c.jsx(w.TableBody,{children:i.map(s=>c.jsxs(w.TableRow,{children:[c.jsx(w.TableCell,{sx:{fontFamily:De.MONO_FONT_FAMILY},children:s.name}),c.jsx(w.TableCell,{sx:{fontFamily:De.MONO_FONT_FAMILY},children:s.connectionName}),c.jsx(w.TableCell,{children:s.dialect??"-"}),c.jsx(w.TableCell,{align:"right",children:s.columns?.length??0}),c.jsx(w.TableCell,{sx:{fontFamily:De.MONO_FONT_FAMILY,fontSize:"0.75rem",wordBreak:"break-all",maxWidth:220},children:s.sourceEntityId})]},s.sourceID))})]})]}),c.jsx(EN,{entries:e.manifest?.entries,builtAt:e.manifest?.builtAt})]})]})})}function na({label:e,value:t}){return c.jsxs(w.Box,{children:[c.jsx(w.Typography,{variant:"caption",color:"text.secondary",display:"block",children:e}),c.jsx(w.Typography,{variant:"body2",children:t})]})}const TN=mt(c.jsx("path",{d:"M6 6h12v12H6z"})),o2=Ee.oneOfType([Ee.func,Ee.object]);function dg(e){try{return e.matches(":focus-visible")}catch{}return!1}const fg={};function i2(e,t){const n=M.useRef(fg);return n.current===fg&&(n.current=e(t)),n}class zu{static create(){return new zu}static use(){const t=i2(zu.create).current,[n,r]=M.useState(!1);return t.shouldMount=n,t.setShouldMount=r,M.useEffect(t.mountEffect,[n]),t}constructor(){this.ref={current:null},this.mounted=null,this.didMount=!1,this.shouldMount=!1,this.setShouldMount=null}mount(){return this.mounted||(this.mounted=kN(),this.shouldMount=!0,this.setShouldMount(this.shouldMount)),this.mounted}mountEffect=()=>{this.shouldMount&&!this.didMount&&this.ref.current!==null&&(this.didMount=!0,this.mounted.resolve())};start(...t){this.mount().then(()=>this.ref.current?.start(...t))}stop(...t){this.mount().then(()=>this.ref.current?.stop(...t))}pulsate(...t){this.mount().then(()=>this.ref.current?.pulsate(...t))}}function SN(){return zu.use()}function kN(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n}function kf(e,t){return kf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},kf(e,t)}function Dp(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,kf(e,t)}function wN(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function DN(e,t){e.classList?e.classList.add(t):wN(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function pg(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function IN(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=pg(e.className,t):e.setAttribute("class",pg(e.className&&e.className.baseVal||"",t))}const hg={disabled:!1},Uu=W.createContext(null);var s2=function(t){return t.scrollTop},Da="unmounted",ei="exited",ti="entering",Qi="entered",wf="exiting",Dr=(function(e){Dp(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=o,a=s&&!s.isMounting?r.enter:r.appear,l;return i.appearStatus=null,r.in?a?(l=ei,i.appearStatus=ti):l=Qi:r.unmountOnExit||r.mountOnEnter?l=Da:l=ei,i.state={status:l},i.nextCallback=null,i}t.getDerivedStateFromProps=function(o,i){var s=o.in;return s&&i.status===Da?{status:ei}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var i=null;if(o!==this.props){var s=this.state.status;this.props.in?s!==ti&&s!==Qi&&(i=ti):(s===ti||s===Qi)&&(i=wf)}this.updateStatus(!1,i)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,i,s,a;return i=s=a=o,o!=null&&typeof o!="number"&&(i=o.exit,s=o.enter,a=o.appear!==void 0?o.appear:s),{exit:i,enter:s,appear:a}},n.updateStatus=function(o,i){if(o===void 0&&(o=!1),i!==null)if(this.cancelNextCallback(),i===ti){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:Ta.findDOMNode(this);s&&s2(s)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===ei&&this.setState({status:Da})},n.performEnter=function(o){var i=this,s=this.props.enter,a=this.context?this.context.isMounting:o,l=this.props.nodeRef?[a]:[Ta.findDOMNode(this),a],u=l[0],d=l[1],f=this.getTimeouts(),h=a?f.appear:f.enter;if(!o&&!s||hg.disabled){this.safeSetState({status:Qi},function(){i.props.onEntered(u)});return}this.props.onEnter(u,d),this.safeSetState({status:ti},function(){i.props.onEntering(u,d),i.onTransitionEnd(h,function(){i.safeSetState({status:Qi},function(){i.props.onEntered(u,d)})})})},n.performExit=function(){var o=this,i=this.props.exit,s=this.getTimeouts(),a=this.props.nodeRef?void 0:Ta.findDOMNode(this);if(!i||hg.disabled){this.safeSetState({status:ei},function(){o.props.onExited(a)});return}this.props.onExit(a),this.safeSetState({status:wf},function(){o.props.onExiting(a),o.onTransitionEnd(s.exit,function(){o.safeSetState({status:ei},function(){o.props.onExited(a)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,i){i=this.setNextCallback(i),this.setState(o,i)},n.setNextCallback=function(o){var i=this,s=!0;return this.nextCallback=function(a){s&&(s=!1,i.nextCallback=null,o(a))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},n.onTransitionEnd=function(o,i){this.setNextCallback(i);var s=this.props.nodeRef?this.props.nodeRef.current:Ta.findDOMNode(this),a=o==null&&!this.props.addEndListener;if(!s||a){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],u=l[0],d=l[1];this.props.addEndListener(u,d)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===Da)return null;var i=this.props,s=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var a=Ze(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return W.createElement(Uu.Provider,{value:null},typeof s=="function"?s(o,a):W.cloneElement(W.Children.only(s),a))},t})(W.Component);Dr.contextType=Uu;Dr.propTypes={};function Yi(){}Dr.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Yi,onEntering:Yi,onEntered:Yi,onExit:Yi,onExiting:Yi,onExited:Yi};Dr.UNMOUNTED=Da;Dr.EXITED=ei;Dr.ENTERING=ti;Dr.ENTERED=Qi;Dr.EXITING=wf;var AN=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return DN(t,r)})},Pd=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return IN(t,r)})},Ip=(function(e){Dp(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return r=e.call.apply(e,[this].concat(i))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(a,l){var u=r.resolveArguments(a,l),d=u[0],f=u[1];r.removeClasses(d,"exit"),r.addClass(d,f?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(a,l)},r.onEntering=function(a,l){var u=r.resolveArguments(a,l),d=u[0],f=u[1],h=f?"appear":"enter";r.addClass(d,h,"active"),r.props.onEntering&&r.props.onEntering(a,l)},r.onEntered=function(a,l){var u=r.resolveArguments(a,l),d=u[0],f=u[1],h=f?"appear":"enter";r.removeClasses(d,h),r.addClass(d,h,"done"),r.props.onEntered&&r.props.onEntered(a,l)},r.onExit=function(a){var l=r.resolveArguments(a),u=l[0];r.removeClasses(u,"appear"),r.removeClasses(u,"enter"),r.addClass(u,"exit","base"),r.props.onExit&&r.props.onExit(a)},r.onExiting=function(a){var l=r.resolveArguments(a),u=l[0];r.addClass(u,"exit","active"),r.props.onExiting&&r.props.onExiting(a)},r.onExited=function(a){var l=r.resolveArguments(a),u=l[0];r.removeClasses(u,"exit"),r.addClass(u,"exit","done"),r.props.onExited&&r.props.onExited(a)},r.resolveArguments=function(a,l){return r.props.nodeRef?[r.props.nodeRef.current,a]:[a,l]},r.getClassNames=function(a){var l=r.props.classNames,u=typeof l=="string",d=u&&l?l+"-":"",f=u?""+d+a:l[a],h=u?f+"-active":l[a+"Active"],p=u?f+"-done":l[a+"Done"];return{baseClassName:f,activeClassName:h,doneClassName:p}},r}var n=t.prototype;return n.addClass=function(o,i,s){var a=this.getClassNames(i)[s+"ClassName"],l=this.getClassNames("enter"),u=l.doneClassName;i==="appear"&&s==="done"&&u&&(a+=" "+u),s==="active"&&o&&s2(o),a&&(this.appliedClasses[i][s]=a,AN(o,a))},n.removeClasses=function(o,i){var s=this.appliedClasses[i],a=s.base,l=s.active,u=s.done;this.appliedClasses[i]={},a&&Pd(o,a),l&&Pd(o,l),u&&Pd(o,u)},n.render=function(){var o=this.props;o.classNames;var i=Ze(o,["classNames"]);return W.createElement(Dr,Y({},i,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t})(W.Component);Ip.defaultProps={classNames:""};Ip.propTypes={};function ON(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ap(e,t){var n=function(i){return t&&W.isValidElement(i)?t(i):i},r=Object.create(null);return e&&W.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function MN(e,t){e=e||{},t=t||{};function n(d){return d in t?t[d]:e[d]}var r=Object.create(null),o=[];for(var i in e)i in t?o.length&&(r[i]=o,o=[]):o.push(i);var s,a={};for(var l in t){if(r[l])for(s=0;s<r[l].length;s++){var u=r[l][s];a[r[l][s]]=n(u)}a[l]=n(l)}for(s=0;s<o.length;s++)a[o[s]]=n(o[s]);return a}function oi(e,t,n){return n[t]!=null?n[t]:e.props[t]}function PN(e,t){return Ap(e.children,function(n){return W.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:oi(n,"appear",e),enter:oi(n,"enter",e),exit:oi(n,"exit",e)})})}function RN(e,t,n){var r=Ap(e.children),o=MN(t,r);return Object.keys(o).forEach(function(i){var s=o[i];if(W.isValidElement(s)){var a=i in t,l=i in r,u=t[i],d=W.isValidElement(u)&&!u.props.in;l&&(!a||d)?o[i]=W.cloneElement(s,{onExited:n.bind(null,s),in:!0,exit:oi(s,"exit",e),enter:oi(s,"enter",e)}):!l&&a&&!d?o[i]=W.cloneElement(s,{in:!1}):l&&a&&W.isValidElement(u)&&(o[i]=W.cloneElement(s,{onExited:n.bind(null,s),in:u.props.in,exit:oi(s,"exit",e),enter:oi(s,"enter",e)}))}}),o}var NN=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},FN={component:"div",childFactory:function(t){return t}},El=(function(e){Dp(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=i.handleExited.bind(ON(i));return i.state={contextValue:{isMounting:!0},handleExited:s,firstRender:!0},i}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(o,i){var s=i.children,a=i.handleExited,l=i.firstRender;return{children:l?PN(o,a):RN(o,s,a),firstRender:!1}},n.handleExited=function(o,i){var s=Ap(this.props.children);o.key in s||(o.props.onExited&&o.props.onExited(i),this.mounted&&this.setState(function(a){var l=Y({},a.children);return delete l[o.key],{children:l}}))},n.render=function(){var o=this.props,i=o.component,s=o.childFactory,a=Ze(o,["component","childFactory"]),l=this.state.contextValue,u=NN(this.state.children).map(s);return delete a.appear,delete a.enter,delete a.exit,i===null?W.createElement(Uu.Provider,{value:l},u):W.createElement(Uu.Provider,{value:l},W.createElement(i,a,u))},t})(W.Component);El.propTypes={};El.defaultProps=FN;const LN=[];function _N(e){M.useEffect(e,LN)}class Op{static create(){return new Op}currentId=null;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,n()},t)}clear=()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function Sc(){const e=i2(Op.create).current;return _N(e.disposeEffect),e}function BN(e){const{className:t,classes:n,pulsate:r=!1,rippleX:o,rippleY:i,rippleSize:s,in:a,onExited:l,timeout:u}=e,[d,f]=M.useState(!1),h=Ue(t,n.ripple,n.rippleVisible,r&&n.ripplePulsate),p={width:s,height:s,top:-(s/2)+i,left:-(s/2)+o},m=Ue(n.child,d&&n.childLeaving,r&&n.childPulsate);return!a&&!d&&f(!0),M.useEffect(()=>{if(!a&&l!=null){const b=setTimeout(l,u);return()=>{clearTimeout(b)}}},[l,a,u]),c.jsx("span",{className:h,style:p,children:c.jsx("span",{className:m})})}const pr=We("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),Df=550,jN=80,$N=Ot.keyframes`
94
94
  0% {
95
95
  transform: scale(0);
@@ -3,7 +3,7 @@ import { Box as Ae, CircularProgress as Qb, Typography as ke, Button as Ht, Tool
3
3
  import * as O from "react";
4
4
  import Fe, { useEffect as sn, useImperativeHandle as ey, useContext as Ka, Fragment as ty, useMemo as Ft, useRef as In, useReducer as tS, useState as Ye, Suspense as Fp, lazy as nS, createContext as rS, isValidElement as _u, cloneElement as Bu, Children as oS, useCallback as yr, useLayoutEffect as iS } from "react";
5
5
  import { useQuery as aS, useMutation as sS, useQueryClient as Vo } from "@tanstack/react-query";
6
- import { u as _t, g as ny, ak as _p, al as lS, am as ry, an as Uc, ao as cc, ap as oy, h as jn, aq as Er, P as yu, V as iy, ar as ay, as as sy, at as ly, c as n0, A as uy, au as Ro, av as cy, aw as Hf, ax as $u, ay as uS, az as cS, aA as dS, aB as fS } from "./ServerProvider-DMk_BDrm.es.js";
6
+ import { u as _t, g as ny, al as _p, am as lS, an as ry, ao as Uc, ap as cc, aq as oy, h as jn, ar as Er, P as yu, W as iy, as as ay, at as sy, au as ly, c as n0, A as uy, av as Ro, aw as cy, ax as Hf, ay as $u, az as uS, aA as cS, aB as dS, aC as fS } from "./ServerProvider-W0vDe2Mt.es.js";
7
7
  import dc from "markdown-to-jsx";
8
8
  import { Warning as pS, Add as dy, Launch as hS, Delete as Vc, MoreVert as Wc, Edit as Bp, AddCircleRounded as mS } from "@mui/icons-material";
9
9
  import { unstable_createGetCssVar as gS, createSpacing as bS, useTheme as yS, GlobalStyles as ES, unstable_memoTheme as CS, createStack as vS, Stack as xS, Box as fy, keyframes as Hl, css as py, createBox as TS, shouldForwardProp as hy, alpha as Gn } from "@mui/system";
@@ -23678,7 +23678,7 @@ function A8() {
23678
23678
  { default: i },
23679
23679
  { default: a }
23680
23680
  ] = await Promise.all([
23681
- import("./core-CK68iv6w.es.js"),
23681
+ import("./core-C0nunIQT.es.js"),
23682
23682
  import("./engine-oniguruma-C4vnmooL.es.js"),
23683
23683
  import("./sql-DCkt643-.es.js"),
23684
23684
  import("./json-71t8ZF9g.es.js"),