@malloy-publisher/sdk 0.0.202 → 0.0.203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ServerProvider-F3zU218S.cjs.js +1 -0
- package/dist/{ServerProvider-DSnbMlP3.es.js → ServerProvider-a1T2FnBE.es.js} +2 -1
- package/dist/client/api.d.ts +2 -1
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/{core-B3A61KGJ.es.js → core-BPLlx5VM.es.js} +1 -1
- package/dist/{core-CKNmRclF.cjs.js → core-GinK_1j5.cjs.js} +1 -1
- package/dist/{index-C2OvwukW.cjs.js → index-B8kmVFxA.cjs.js} +2 -2
- package/dist/{index-B0i0wzpF.es.js → index-BNOut93L.es.js} +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +2 -2
- package/package.json +1 -1
- package/dist/ServerProvider-BSyxB6sf.cjs.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const z=require("react/jsx-runtime"),j=require("@tanstack/react-query"),h=require("axios"),U=require("react"),u="http://localhost/api/v0".replace(/\/+$/,"");class I{constructor(r,a=u,n=h){this.basePath=a,this.axios=n,r&&(this.configuration=r,this.basePath=r.basePath??a)}configuration}class pe extends Error{constructor(r,a){super(a),this.field=r,this.name="RequiredError"}}const g={},V="https://example.com",m=function(l,r,a){if(a==null)throw new pe(r,`Required parameter ${r} was null or undefined when calling ${l}.`)};function F(l,r,a=""){r!=null&&(typeof r=="object"?Array.isArray(r)?r.forEach(n=>F(l,n,a)):Object.keys(r).forEach(n=>F(l,r[n],`${a}${a!==""?".":""}${n}`)):l.has(a)?l.append(a,r):l.set(a,r))}const v=function(l,...r){const a=new URLSearchParams(l.search);F(a,r),l.search=a.toString()},y=function(l,r,a){const n=typeof l!="string";return(n&&a&&a.isJsonMime?a.isJsonMime(r.headers["Content-Type"]):n)?JSON.stringify(l!==void 0?l:{}):l||""},b=function(l){return l.pathname+l.search+l.hash},O=function(l,r,a,n){return(e=r,t=a)=>{const o={...l.options,url:(e.defaults.baseURL?"":n?.basePath??t)+l.url};return e.request(o)}},me={Bigquery:"bigquery",Snowflake:"snowflake",Postgres:"postgres",Gcs:"gcs",S3:"s3",Azure:"azure"},de={ServicePrincipal:"service_principal",SasToken:"sas_token"},he={Error:"error",Warn:"warn",Debug:"debug"},ue={Success:"success",Error:"error"},Pe={Postgres:"postgres",Bigquery:"bigquery",Snowflake:"snowflake",Trino:"trino",Databricks:"databricks",Mysql:"mysql",Duckdb:"duckdb",Motherduck:"motherduck",Ducklake:"ducklake"},ge={Ok:"ok",Failed:"failed"},Ve={Embedded:"embedded",Materialized:"materialized"},ve={Equal:"equal",In:"in",Like:"like",GreaterThan:"greater_than",LessThan:"less_than"},be={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},Oe={Pending:"PENDING",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",Cancelled:"CANCELLED"},Se={Markdown:"markdown",Code:"code"},ye={Markdown:"markdown",Code:"code"},Ae={Initializing:"initializing",Serving:"serving",Draining:"draining",Throttled:"throttled"},L=function(l){return{createConnection:async(r,a,n,e={})=>{m("createConnection","environmentName",r),m("createConnection","connectionName",a),m("createConnection","connection",n);const t="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"POST",...s,...e},i={},p={};i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(n,c,l),{url:b(o),options:c}},deleteConnection:async(r,a,n={})=>{m("deleteConnection","environmentName",r),m("deleteConnection","connectionName",a);const e="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"DELETE",...o,...n},c={};v(t,{});let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},{url:b(t),options:s}},getConnection:async(r,a,n={})=>{m("getConnection","environmentName",r),m("getConnection","connectionName",a);const e="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"GET",...o,...n},c={};v(t,{});let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},{url:b(t),options:s}},getSqlsource:async(r,a,n,e={})=>{m("getSqlsource","environmentName",r),m("getSqlsource","connectionName",a);const t="/environments/{environmentName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={},p={};n!==void 0&&(p.sqlStatement=n),v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}},getSqlsourceInPackage:async(r,a,n,e,t={})=>{m("getSqlsourceInPackage","environmentName",r),m("getSqlsourceInPackage","packageName",a),m("getSqlsourceInPackage","connectionName",n);const o="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};e!==void 0&&(d.sqlStatement=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},getTable:async(r,a,n,e,t={})=>{m("getTable","environmentName",r),m("getTable","connectionName",a),m("getTable","schemaName",n),m("getTable","tablePath",e);const o="/environments/{environmentName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))).replace("{schemaName}",encodeURIComponent(String(n))).replace("{tablePath}",encodeURIComponent(String(e))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={};v(s,{});let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},getTableInPackage:async(r,a,n,e,t,o={})=>{m("getTableInPackage","environmentName",r),m("getTableInPackage","packageName",a),m("getTableInPackage","connectionName",n),m("getTableInPackage","schemaName",e),m("getTableInPackage","tablePath",t);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(e))).replace("{tablePath}",encodeURIComponent(String(t))),c=new URL(s,V);let i;l&&(i=l.baseOptions);const p={method:"GET",...i,...o},d={};v(c,{});let A=i&&i.headers?i.headers:{};return p.headers={...d,...A,...o.headers},{url:b(c),options:p}},getTemporarytable:async(r,a,n,e={})=>{m("getTemporarytable","environmentName",r),m("getTemporarytable","connectionName",a);const t="/environments/{environmentName}/connections/{connectionName}/temporaryTable".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={},p={};n!==void 0&&(p.sqlStatement=n),v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}},getTemporarytableInPackage:async(r,a,n,e,t={})=>{m("getTemporarytableInPackage","environmentName",r),m("getTemporarytableInPackage","packageName",a),m("getTemporarytableInPackage","connectionName",n);const o="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/temporaryTable".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};e!==void 0&&(d.sqlStatement=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},listConnections:async(r,a={})=>{m("listConnections","environmentName",r);const n="/environments/{environmentName}/connections".replace("{environmentName}",encodeURIComponent(String(r))),e=new URL(n,V);let t;l&&(t=l.baseOptions);const o={method:"GET",...t,...a},s={};v(e,{});let i=t&&t.headers?t.headers:{};return o.headers={...s,...i,...a.headers},{url:b(e),options:o}},listSchemas:async(r,a,n={})=>{m("listSchemas","environmentName",r),m("listSchemas","connectionName",a);const e="/environments/{environmentName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"GET",...o,...n},c={};v(t,{});let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},{url:b(t),options:s}},listSchemasInPackage:async(r,a,n,e={})=>{m("listSchemasInPackage","environmentName",r),m("listSchemasInPackage","packageName",a),m("listSchemasInPackage","connectionName",n);const t="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={};v(o,{});let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}},listTables:async(r,a,n,e,t={})=>{m("listTables","environmentName",r),m("listTables","connectionName",a),m("listTables","schemaName",n);const o="/environments/{environmentName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))).replace("{schemaName}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};e&&(d.tableNames=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},listTablesInPackage:async(r,a,n,e,t,o={})=>{m("listTablesInPackage","environmentName",r),m("listTablesInPackage","packageName",a),m("listTablesInPackage","connectionName",n),m("listTablesInPackage","schemaName",e);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(e))),c=new URL(s,V);let i;l&&(i=l.baseOptions);const p={method:"GET",...i,...o},d={},P={};t&&(P.tableNames=t),v(c,P);let A=i&&i.headers?i.headers:{};return p.headers={...d,...A,...o.headers},{url:b(c),options:p}},postQuerydata:async(r,a,n,e,t={})=>{m("postQuerydata","environmentName",r),m("postQuerydata","connectionName",a),m("postQuerydata","postQuerydataRequest",n);const o="/environments/{environmentName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"POST",...c,...t},p={},d={};e!==void 0&&(d.options=e),p["Content-Type"]="application/json",v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},i.data=y(n,i,l),{url:b(s),options:i}},postQuerydataInPackage:async(r,a,n,e,t,o={})=>{m("postQuerydataInPackage","environmentName",r),m("postQuerydataInPackage","packageName",a),m("postQuerydataInPackage","connectionName",n),m("postQuerydataInPackage","postQuerydataRequest",e);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))),c=new URL(s,V);let i;l&&(i=l.baseOptions);const p={method:"POST",...i,...o},d={},P={};t!==void 0&&(P.options=t),d["Content-Type"]="application/json",v(c,P);let A=i&&i.headers?i.headers:{};return p.headers={...d,...A,...o.headers},p.data=y(e,p,l),{url:b(c),options:p}},postSqlsource:async(r,a,n,e={})=>{m("postSqlsource","environmentName",r),m("postSqlsource","connectionName",a),m("postSqlsource","postSqlsourceRequest",n);const t="/environments/{environmentName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"POST",...s,...e},i={},p={};i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(n,c,l),{url:b(o),options:c}},postSqlsourceInPackage:async(r,a,n,e,t={})=>{m("postSqlsourceInPackage","environmentName",r),m("postSqlsourceInPackage","packageName",a),m("postSqlsourceInPackage","connectionName",n),m("postSqlsourceInPackage","postSqlsourceRequest",e);const o="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"POST",...c,...t},p={},d={};p["Content-Type"]="application/json",v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},i.data=y(e,i,l),{url:b(s),options:i}},postTemporarytable:async(r,a,n,e={})=>{m("postTemporarytable","environmentName",r),m("postTemporarytable","connectionName",a),m("postTemporarytable","postSqlsourceRequest",n);const t="/environments/{environmentName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"POST",...s,...e},i={},p={};i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(n,c,l),{url:b(o),options:c}},postTemporarytableInPackage:async(r,a,n,e,t={})=>{m("postTemporarytableInPackage","environmentName",r),m("postTemporarytableInPackage","packageName",a),m("postTemporarytableInPackage","connectionName",n),m("postTemporarytableInPackage","postSqlsourceRequest",e);const o="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"POST",...c,...t},p={},d={};p["Content-Type"]="application/json",v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},i.data=y(e,i,l),{url:b(s),options:i}},updateConnection:async(r,a,n,e={})=>{m("updateConnection","environmentName",r),m("updateConnection","connectionName",a),m("updateConnection","updateConnectionRequest",n);const t="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"PATCH",...s,...e},i={},p={};i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(n,c,l),{url:b(o),options:c}}}},S=function(l){const r=L(l);return{async createConnection(a,n,e,t){const o=await r.createConnection(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.createConnection"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async deleteConnection(a,n,e){const t=await r.deleteConnection(a,n,e),o=l?.serverIndex??0,s=g["ConnectionsApi.deleteConnection"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)},async getConnection(a,n,e){const t=await r.getConnection(a,n,e),o=l?.serverIndex??0,s=g["ConnectionsApi.getConnection"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)},async getSqlsource(a,n,e,t){const o=await r.getSqlsource(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.getSqlsource"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async getSqlsourceInPackage(a,n,e,t,o){const s=await r.getSqlsourceInPackage(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.getSqlsourceInPackage"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async getTable(a,n,e,t,o){const s=await r.getTable(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.getTable"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async getTableInPackage(a,n,e,t,o,s){const c=await r.getTableInPackage(a,n,e,t,o,s),i=l?.serverIndex??0,p=g["ConnectionsApi.getTableInPackage"]?.[i]?.url;return(d,P)=>O(c,h,u,l)(d,p||P)},async getTemporarytable(a,n,e,t){const o=await r.getTemporarytable(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.getTemporarytable"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async getTemporarytableInPackage(a,n,e,t,o){const s=await r.getTemporarytableInPackage(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.getTemporarytableInPackage"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async listConnections(a,n){const e=await r.listConnections(a,n),t=l?.serverIndex??0,o=g["ConnectionsApi.listConnections"]?.[t]?.url;return(s,c)=>O(e,h,u,l)(s,o||c)},async listSchemas(a,n,e){const t=await r.listSchemas(a,n,e),o=l?.serverIndex??0,s=g["ConnectionsApi.listSchemas"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)},async listSchemasInPackage(a,n,e,t){const o=await r.listSchemasInPackage(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.listSchemasInPackage"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async listTables(a,n,e,t,o){const s=await r.listTables(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.listTables"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async listTablesInPackage(a,n,e,t,o,s){const c=await r.listTablesInPackage(a,n,e,t,o,s),i=l?.serverIndex??0,p=g["ConnectionsApi.listTablesInPackage"]?.[i]?.url;return(d,P)=>O(c,h,u,l)(d,p||P)},async postQuerydata(a,n,e,t,o){const s=await r.postQuerydata(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.postQuerydata"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async postQuerydataInPackage(a,n,e,t,o,s){const c=await r.postQuerydataInPackage(a,n,e,t,o,s),i=l?.serverIndex??0,p=g["ConnectionsApi.postQuerydataInPackage"]?.[i]?.url;return(d,P)=>O(c,h,u,l)(d,p||P)},async postSqlsource(a,n,e,t){const o=await r.postSqlsource(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.postSqlsource"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async postSqlsourceInPackage(a,n,e,t,o){const s=await r.postSqlsourceInPackage(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.postSqlsourceInPackage"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async postTemporarytable(a,n,e,t){const o=await r.postTemporarytable(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.postTemporarytable"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async postTemporarytableInPackage(a,n,e,t,o){const s=await r.postTemporarytableInPackage(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.postTemporarytableInPackage"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async updateConnection(a,n,e,t){const o=await r.updateConnection(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.updateConnection"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)}}},Ie=function(l,r,a){const n=S(l);return{createConnection(e,t,o,s){return n.createConnection(e,t,o,s).then(c=>c(a,r))},deleteConnection(e,t,o){return n.deleteConnection(e,t,o).then(s=>s(a,r))},getConnection(e,t,o){return n.getConnection(e,t,o).then(s=>s(a,r))},getSqlsource(e,t,o,s){return n.getSqlsource(e,t,o,s).then(c=>c(a,r))},getSqlsourceInPackage(e,t,o,s,c){return n.getSqlsourceInPackage(e,t,o,s,c).then(i=>i(a,r))},getTable(e,t,o,s,c){return n.getTable(e,t,o,s,c).then(i=>i(a,r))},getTableInPackage(e,t,o,s,c,i){return n.getTableInPackage(e,t,o,s,c,i).then(p=>p(a,r))},getTemporarytable(e,t,o,s){return n.getTemporarytable(e,t,o,s).then(c=>c(a,r))},getTemporarytableInPackage(e,t,o,s,c){return n.getTemporarytableInPackage(e,t,o,s,c).then(i=>i(a,r))},listConnections(e,t){return n.listConnections(e,t).then(o=>o(a,r))},listSchemas(e,t,o){return n.listSchemas(e,t,o).then(s=>s(a,r))},listSchemasInPackage(e,t,o,s){return n.listSchemasInPackage(e,t,o,s).then(c=>c(a,r))},listTables(e,t,o,s,c){return n.listTables(e,t,o,s,c).then(i=>i(a,r))},listTablesInPackage(e,t,o,s,c,i){return n.listTablesInPackage(e,t,o,s,c,i).then(p=>p(a,r))},postQuerydata(e,t,o,s,c){return n.postQuerydata(e,t,o,s,c).then(i=>i(a,r))},postQuerydataInPackage(e,t,o,s,c,i){return n.postQuerydataInPackage(e,t,o,s,c,i).then(p=>p(a,r))},postSqlsource(e,t,o,s){return n.postSqlsource(e,t,o,s).then(c=>c(a,r))},postSqlsourceInPackage(e,t,o,s,c){return n.postSqlsourceInPackage(e,t,o,s,c).then(i=>i(a,r))},postTemporarytable(e,t,o,s){return n.postTemporarytable(e,t,o,s).then(c=>c(a,r))},postTemporarytableInPackage(e,t,o,s,c){return n.postTemporarytableInPackage(e,t,o,s,c).then(i=>i(a,r))},updateConnection(e,t,o,s){return n.updateConnection(e,t,o,s).then(c=>c(a,r))}}};class f extends I{createConnection(r,a,n,e){return S(this.configuration).createConnection(r,a,n,e).then(t=>t(this.axios,this.basePath))}deleteConnection(r,a,n){return S(this.configuration).deleteConnection(r,a,n).then(e=>e(this.axios,this.basePath))}getConnection(r,a,n){return S(this.configuration).getConnection(r,a,n).then(e=>e(this.axios,this.basePath))}getSqlsource(r,a,n,e){return S(this.configuration).getSqlsource(r,a,n,e).then(t=>t(this.axios,this.basePath))}getSqlsourceInPackage(r,a,n,e,t){return S(this.configuration).getSqlsourceInPackage(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}getTable(r,a,n,e,t){return S(this.configuration).getTable(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}getTableInPackage(r,a,n,e,t,o){return S(this.configuration).getTableInPackage(r,a,n,e,t,o).then(s=>s(this.axios,this.basePath))}getTemporarytable(r,a,n,e){return S(this.configuration).getTemporarytable(r,a,n,e).then(t=>t(this.axios,this.basePath))}getTemporarytableInPackage(r,a,n,e,t){return S(this.configuration).getTemporarytableInPackage(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}listConnections(r,a){return S(this.configuration).listConnections(r,a).then(n=>n(this.axios,this.basePath))}listSchemas(r,a,n){return S(this.configuration).listSchemas(r,a,n).then(e=>e(this.axios,this.basePath))}listSchemasInPackage(r,a,n,e){return S(this.configuration).listSchemasInPackage(r,a,n,e).then(t=>t(this.axios,this.basePath))}listTables(r,a,n,e,t){return S(this.configuration).listTables(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}listTablesInPackage(r,a,n,e,t,o){return S(this.configuration).listTablesInPackage(r,a,n,e,t,o).then(s=>s(this.axios,this.basePath))}postQuerydata(r,a,n,e,t){return S(this.configuration).postQuerydata(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}postQuerydataInPackage(r,a,n,e,t,o){return S(this.configuration).postQuerydataInPackage(r,a,n,e,t,o).then(s=>s(this.axios,this.basePath))}postSqlsource(r,a,n,e){return S(this.configuration).postSqlsource(r,a,n,e).then(t=>t(this.axios,this.basePath))}postSqlsourceInPackage(r,a,n,e,t){return S(this.configuration).postSqlsourceInPackage(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}postTemporarytable(r,a,n,e){return S(this.configuration).postTemporarytable(r,a,n,e).then(t=>t(this.axios,this.basePath))}postTemporarytableInPackage(r,a,n,e,t){return S(this.configuration).postTemporarytableInPackage(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}updateConnection(r,a,n,e){return S(this.configuration).updateConnection(r,a,n,e).then(t=>t(this.axios,this.basePath))}}const H=function(l){return{testConnectionConfiguration:async(r,a={})=>{m("testConnectionConfiguration","connection",r);const n="/connections/test",e=new URL(n,V);let t;l&&(t=l.baseOptions);const o={method:"POST",...t,...a},s={},c={};s["Content-Type"]="application/json",v(e,c);let i=t&&t.headers?t.headers:{};return o.headers={...s,...i,...a.headers},o.data=y(r,o,l),{url:b(e),options:o}}}},$=function(l){const r=H(l);return{async testConnectionConfiguration(a,n){const e=await r.testConnectionConfiguration(a,n),t=l?.serverIndex??0,o=g["ConnectionsTestApi.testConnectionConfiguration"]?.[t]?.url;return(s,c)=>O(e,h,u,l)(s,o||c)}}},Ce=function(l,r,a){const n=$(l);return{testConnectionConfiguration(e,t){return n.testConnectionConfiguration(e,t).then(o=>o(a,r))}}};class ke extends I{testConnectionConfiguration(r,a){return $(this.configuration).testConnectionConfiguration(r,a).then(n=>n(this.axios,this.basePath))}}const D=function(l){return{listDatabases:async(r,a,n,e={})=>{m("listDatabases","environmentName",r),m("listDatabases","packageName",a);const t="/environments/{environmentName}/packages/{packageName}/databases".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={},p={};n!==void 0&&(p.versionId=n),v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}}}},Q=function(l){const r=D(l);return{async listDatabases(a,n,e,t){const o=await r.listDatabases(a,n,e,t),s=l?.serverIndex??0,c=g["DatabasesApi.listDatabases"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)}}},xe=function(l,r,a){const n=Q(l);return{listDatabases(e,t,o,s){return n.listDatabases(e,t,o,s).then(c=>c(a,r))}}};class W extends I{listDatabases(r,a,n,e){return Q(this.configuration).listDatabases(r,a,n,e).then(t=>t(this.axios,this.basePath))}}const G=function(l){return{createEnvironment:async(r,a={})=>{m("createEnvironment","environment",r);const n="/environments",e=new URL(n,V);let t;l&&(t=l.baseOptions);const o={method:"POST",...t,...a},s={},c={};s["Content-Type"]="application/json",v(e,c);let i=t&&t.headers?t.headers:{};return o.headers={...s,...i,...a.headers},o.data=y(r,o,l),{url:b(e),options:o}},deleteEnvironment:async(r,a={})=>{m("deleteEnvironment","environmentName",r);const n="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(r))),e=new URL(n,V);let t;l&&(t=l.baseOptions);const o={method:"DELETE",...t,...a},s={};v(e,{});let i=t&&t.headers?t.headers:{};return o.headers={...s,...i,...a.headers},{url:b(e),options:o}},getEnvironment:async(r,a,n={})=>{m("getEnvironment","environmentName",r);const e="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(r))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"GET",...o,...n},c={},i={};a!==void 0&&(i.reload=a),v(t,i);let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},{url:b(t),options:s}},listEnvironments:async(r={})=>{const a="/environments",n=new URL(a,V);let e;l&&(e=l.baseOptions);const t={method:"GET",...e,...r},o={};v(n,{});let c=e&&e.headers?e.headers:{};return t.headers={...o,...c,...r.headers},{url:b(n),options:t}},updateEnvironment:async(r,a,n={})=>{m("updateEnvironment","environmentName",r),m("updateEnvironment","environment",a);const e="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(r))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"PATCH",...o,...n},c={},i={};c["Content-Type"]="application/json",v(t,i);let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},s.data=y(a,s,l),{url:b(t),options:s}}}},k=function(l){const r=G(l);return{async createEnvironment(a,n){const e=await r.createEnvironment(a,n),t=l?.serverIndex??0,o=g["EnvironmentsApi.createEnvironment"]?.[t]?.url;return(s,c)=>O(e,h,u,l)(s,o||c)},async deleteEnvironment(a,n){const e=await r.deleteEnvironment(a,n),t=l?.serverIndex??0,o=g["EnvironmentsApi.deleteEnvironment"]?.[t]?.url;return(s,c)=>O(e,h,u,l)(s,o||c)},async getEnvironment(a,n,e){const t=await r.getEnvironment(a,n,e),o=l?.serverIndex??0,s=g["EnvironmentsApi.getEnvironment"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)},async listEnvironments(a){const n=await r.listEnvironments(a),e=l?.serverIndex??0,t=g["EnvironmentsApi.listEnvironments"]?.[e]?.url;return(o,s)=>O(n,h,u,l)(o,t||s)},async updateEnvironment(a,n,e){const t=await r.updateEnvironment(a,n,e),o=l?.serverIndex??0,s=g["EnvironmentsApi.updateEnvironment"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)}}},Ne=function(l,r,a){const n=k(l);return{createEnvironment(e,t){return n.createEnvironment(e,t).then(o=>o(a,r))},deleteEnvironment(e,t){return n.deleteEnvironment(e,t).then(o=>o(a,r))},getEnvironment(e,t,o){return n.getEnvironment(e,t,o).then(s=>s(a,r))},listEnvironments(e){return n.listEnvironments(e).then(t=>t(a,r))},updateEnvironment(e,t,o){return n.updateEnvironment(e,t,o).then(s=>s(a,r))}}};class _ extends I{createEnvironment(r,a){return k(this.configuration).createEnvironment(r,a).then(n=>n(this.axios,this.basePath))}deleteEnvironment(r,a){return k(this.configuration).deleteEnvironment(r,a).then(n=>n(this.axios,this.basePath))}getEnvironment(r,a,n){return k(this.configuration).getEnvironment(r,a,n).then(e=>e(this.axios,this.basePath))}listEnvironments(r){return k(this.configuration).listEnvironments(r).then(a=>a(this.axios,this.basePath))}updateEnvironment(r,a,n){return k(this.configuration).updateEnvironment(r,a,n).then(e=>e(this.axios,this.basePath))}}const J=function(l){return{getManifest:async(r,a,n={})=>{m("getManifest","environmentName",r),m("getManifest","packageName",a);const e="/environments/{environmentName}/packages/{packageName}/manifest".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"GET",...o,...n},c={};v(t,{});let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},{url:b(t),options:s}},manifestAction:async(r,a,n,e={})=>{m("manifestAction","environmentName",r),m("manifestAction","packageName",a),m("manifestAction","action",n);const t="/environments/{environmentName}/packages/{packageName}/manifest".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"POST",...s,...e},i={},p={};n!==void 0&&(p.action=n),v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}}}},q=function(l){const r=J(l);return{async getManifest(a,n,e){const t=await r.getManifest(a,n,e),o=l?.serverIndex??0,s=g["ManifestsApi.getManifest"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)},async manifestAction(a,n,e,t){const o=await r.manifestAction(a,n,e,t),s=l?.serverIndex??0,c=g["ManifestsApi.manifestAction"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)}}},Re=function(l,r,a){const n=q(l);return{getManifest(e,t,o){return n.getManifest(e,t,o).then(s=>s(a,r))},manifestAction(e,t,o,s){return n.manifestAction(e,t,o,s).then(c=>c(a,r))}}};class Ue extends I{getManifest(r,a,n){return q(this.configuration).getManifest(r,a,n).then(e=>e(this.axios,this.basePath))}manifestAction(r,a,n,e){return q(this.configuration).manifestAction(r,a,n,e).then(t=>t(this.axios,this.basePath))}}const Te={Reload:"reload"},K=function(l){return{createMaterialization:async(r,a,n,e={})=>{m("createMaterialization","environmentName",r),m("createMaterialization","packageName",a);const t="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"POST",...s,...e},i={},p={};i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(n,c,l),{url:b(o),options:c}},deleteMaterialization:async(r,a,n,e={})=>{m("deleteMaterialization","environmentName",r),m("deleteMaterialization","packageName",a),m("deleteMaterialization","materializationId",n);const t="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{materializationId}",encodeURIComponent(String(n))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"DELETE",...s,...e},i={};v(o,{});let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}},getMaterialization:async(r,a,n,e={})=>{m("getMaterialization","environmentName",r),m("getMaterialization","packageName",a),m("getMaterialization","materializationId",n);const t="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{materializationId}",encodeURIComponent(String(n))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={};v(o,{});let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}},listMaterializations:async(r,a,n,e,t={})=>{m("listMaterializations","environmentName",r),m("listMaterializations","packageName",a);const o="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};n!==void 0&&(d.limit=n),e!==void 0&&(d.offset=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},materializationAction:async(r,a,n,e,t={})=>{m("materializationAction","environmentName",r),m("materializationAction","packageName",a),m("materializationAction","materializationId",n),m("materializationAction","action",e);const o="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{materializationId}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"POST",...c,...t},p={},d={};e!==void 0&&(d.action=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}}}},x=function(l){const r=K(l);return{async createMaterialization(a,n,e,t){const o=await r.createMaterialization(a,n,e,t),s=l?.serverIndex??0,c=g["MaterializationsApi.createMaterialization"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async deleteMaterialization(a,n,e,t){const o=await r.deleteMaterialization(a,n,e,t),s=l?.serverIndex??0,c=g["MaterializationsApi.deleteMaterialization"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async getMaterialization(a,n,e,t){const o=await r.getMaterialization(a,n,e,t),s=l?.serverIndex??0,c=g["MaterializationsApi.getMaterialization"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async listMaterializations(a,n,e,t,o){const s=await r.listMaterializations(a,n,e,t,o),c=l?.serverIndex??0,i=g["MaterializationsApi.listMaterializations"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async materializationAction(a,n,e,t,o){const s=await r.materializationAction(a,n,e,t,o),c=l?.serverIndex??0,i=g["MaterializationsApi.materializationAction"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)}}},Me=function(l,r,a){const n=x(l);return{createMaterialization(e,t,o,s){return n.createMaterialization(e,t,o,s).then(c=>c(a,r))},deleteMaterialization(e,t,o,s){return n.deleteMaterialization(e,t,o,s).then(c=>c(a,r))},getMaterialization(e,t,o,s){return n.getMaterialization(e,t,o,s).then(c=>c(a,r))},listMaterializations(e,t,o,s,c){return n.listMaterializations(e,t,o,s,c).then(i=>i(a,r))},materializationAction(e,t,o,s,c){return n.materializationAction(e,t,o,s,c).then(i=>i(a,r))}}};class Ee extends I{createMaterialization(r,a,n,e){return x(this.configuration).createMaterialization(r,a,n,e).then(t=>t(this.axios,this.basePath))}deleteMaterialization(r,a,n,e){return x(this.configuration).deleteMaterialization(r,a,n,e).then(t=>t(this.axios,this.basePath))}getMaterialization(r,a,n,e){return x(this.configuration).getMaterialization(r,a,n,e).then(t=>t(this.axios,this.basePath))}listMaterializations(r,a,n,e,t){return x(this.configuration).listMaterializations(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}materializationAction(r,a,n,e,t){return x(this.configuration).materializationAction(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}}const we={Start:"start",Stop:"stop"},Y=function(l){return{compileModelSource:async(r,a,n,e,t={})=>{m("compileModelSource","environmentName",r),m("compileModelSource","packageName",a),m("compileModelSource","path",n),m("compileModelSource","compileRequest",e);const o="/environments/{environmentName}/packages/{packageName}/models/{path}/compile".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{path}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"POST",...c,...t},p={},d={};p["Content-Type"]="application/json",v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},i.data=y(e,i,l),{url:b(s),options:i}},executeQueryModel:async(r,a,n,e,t={})=>{m("executeQueryModel","environmentName",r),m("executeQueryModel","packageName",a),m("executeQueryModel","path",n),m("executeQueryModel","queryRequest",e);const o="/environments/{environmentName}/packages/{packageName}/models/{path}/query".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{path}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"POST",...c,...t},p={},d={};p["Content-Type"]="application/json",v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},i.data=y(e,i,l),{url:b(s),options:i}},getModel:async(r,a,n,e,t={})=>{m("getModel","environmentName",r),m("getModel","packageName",a),m("getModel","path",n);const o="/environments/{environmentName}/packages/{packageName}/models/{path}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{path}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};e!==void 0&&(d.versionId=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},listModels:async(r,a,n,e={})=>{m("listModels","environmentName",r),m("listModels","packageName",a);const t="/environments/{environmentName}/packages/{packageName}/models".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={},p={};n!==void 0&&(p.versionId=n),v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}}}},T=function(l){const r=Y(l);return{async compileModelSource(a,n,e,t,o){const s=await r.compileModelSource(a,n,e,t,o),c=l?.serverIndex??0,i=g["ModelsApi.compileModelSource"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async executeQueryModel(a,n,e,t,o){const s=await r.executeQueryModel(a,n,e,t,o),c=l?.serverIndex??0,i=g["ModelsApi.executeQueryModel"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async getModel(a,n,e,t,o){const s=await r.getModel(a,n,e,t,o),c=l?.serverIndex??0,i=g["ModelsApi.getModel"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async listModels(a,n,e,t){const o=await r.listModels(a,n,e,t),s=l?.serverIndex??0,c=g["ModelsApi.listModels"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)}}},qe=function(l,r,a){const n=T(l);return{compileModelSource(e,t,o,s,c){return n.compileModelSource(e,t,o,s,c).then(i=>i(a,r))},executeQueryModel(e,t,o,s,c){return n.executeQueryModel(e,t,o,s,c).then(i=>i(a,r))},getModel(e,t,o,s,c){return n.getModel(e,t,o,s,c).then(i=>i(a,r))},listModels(e,t,o,s){return n.listModels(e,t,o,s).then(c=>c(a,r))}}};class X extends I{compileModelSource(r,a,n,e,t){return T(this.configuration).compileModelSource(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}executeQueryModel(r,a,n,e,t){return T(this.configuration).executeQueryModel(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}getModel(r,a,n,e,t){return T(this.configuration).getModel(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}listModels(r,a,n,e){return T(this.configuration).listModels(r,a,n,e).then(t=>t(this.axios,this.basePath))}}const Z=function(l){return{executeNotebookCell:async(r,a,n,e,t,o,s,c,i={})=>{m("executeNotebookCell","environmentName",r),m("executeNotebookCell","packageName",a),m("executeNotebookCell","path",n),m("executeNotebookCell","cellIndex",e);const p="/environments/{environmentName}/packages/{packageName}/notebooks/{path}/cells/{cellIndex}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{path}",encodeURIComponent(String(n))).replace("{cellIndex}",encodeURIComponent(String(e))),d=new URL(p,V);let P;l&&(P=l.baseOptions);const A={method:"GET",...P,...i},w={},C={};t!==void 0&&(C.versionId=t),o!==void 0&&(C.filter_params=o),s!==void 0&&(C.bypass_filters=s),c!==void 0&&(C.givens=c),v(d,C);let R=P&&P.headers?P.headers:{};return A.headers={...w,...R,...i.headers},{url:b(d),options:A}},getNotebook:async(r,a,n,e,t={})=>{m("getNotebook","environmentName",r),m("getNotebook","packageName",a),m("getNotebook","path",n);const o="/environments/{environmentName}/packages/{packageName}/notebooks/{path}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{path}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};e!==void 0&&(d.versionId=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},listNotebooks:async(r,a,n,e={})=>{m("listNotebooks","environmentName",r),m("listNotebooks","packageName",a);const t="/environments/{environmentName}/packages/{packageName}/notebooks".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={},p={};n!==void 0&&(p.versionId=n),v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}}}},M=function(l){const r=Z(l);return{async executeNotebookCell(a,n,e,t,o,s,c,i,p){const d=await r.executeNotebookCell(a,n,e,t,o,s,c,i,p),P=l?.serverIndex??0,A=g["NotebooksApi.executeNotebookCell"]?.[P]?.url;return(w,C)=>O(d,h,u,l)(w,A||C)},async getNotebook(a,n,e,t,o){const s=await r.getNotebook(a,n,e,t,o),c=l?.serverIndex??0,i=g["NotebooksApi.getNotebook"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async listNotebooks(a,n,e,t){const o=await r.listNotebooks(a,n,e,t),s=l?.serverIndex??0,c=g["NotebooksApi.listNotebooks"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)}}},Fe=function(l,r,a){const n=M(l);return{executeNotebookCell(e,t,o,s,c,i,p,d,P){return n.executeNotebookCell(e,t,o,s,c,i,p,d,P).then(A=>A(a,r))},getNotebook(e,t,o,s,c){return n.getNotebook(e,t,o,s,c).then(i=>i(a,r))},listNotebooks(e,t,o,s){return n.listNotebooks(e,t,o,s).then(c=>c(a,r))}}};class ee extends I{executeNotebookCell(r,a,n,e,t,o,s,c,i){return M(this.configuration).executeNotebookCell(r,a,n,e,t,o,s,c,i).then(p=>p(this.axios,this.basePath))}getNotebook(r,a,n,e,t){return M(this.configuration).getNotebook(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}listNotebooks(r,a,n,e){return M(this.configuration).listNotebooks(r,a,n,e).then(t=>t(this.axios,this.basePath))}}const $e={True:"true",False:"false"},ae=function(l){return{createPackage:async(r,a,n,e={})=>{m("createPackage","environmentName",r),m("createPackage","_package",a);const t="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(r))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"POST",...s,...e},i={},p={};n!==void 0&&(p.autoLoadManifest=n),i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(a,c,l),{url:b(o),options:c}},deletePackage:async(r,a,n={})=>{m("deletePackage","environmentName",r),m("deletePackage","packageName",a);const e="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"DELETE",...o,...n},c={};v(t,{});let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},{url:b(t),options:s}},getPackage:async(r,a,n,e,t={})=>{m("getPackage","environmentName",r),m("getPackage","packageName",a);const o="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};n!==void 0&&(d.versionId=n),e!==void 0&&(d.reload=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},listPackages:async(r,a={})=>{m("listPackages","environmentName",r);const n="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(r))),e=new URL(n,V);let t;l&&(t=l.baseOptions);const o={method:"GET",...t,...a},s={};v(e,{});let i=t&&t.headers?t.headers:{};return o.headers={...s,...i,...a.headers},{url:b(e),options:o}},updatePackage:async(r,a,n,e={})=>{m("updatePackage","environmentName",r),m("updatePackage","packageName",a),m("updatePackage","_package",n);const t="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"PATCH",...s,...e},i={},p={};i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(n,c,l),{url:b(o),options:c}}}},N=function(l){const r=ae(l);return{async createPackage(a,n,e,t){const o=await r.createPackage(a,n,e,t),s=l?.serverIndex??0,c=g["PackagesApi.createPackage"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async deletePackage(a,n,e){const t=await r.deletePackage(a,n,e),o=l?.serverIndex??0,s=g["PackagesApi.deletePackage"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)},async getPackage(a,n,e,t,o){const s=await r.getPackage(a,n,e,t,o),c=l?.serverIndex??0,i=g["PackagesApi.getPackage"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async listPackages(a,n){const e=await r.listPackages(a,n),t=l?.serverIndex??0,o=g["PackagesApi.listPackages"]?.[t]?.url;return(s,c)=>O(e,h,u,l)(s,o||c)},async updatePackage(a,n,e,t){const o=await r.updatePackage(a,n,e,t),s=l?.serverIndex??0,c=g["PackagesApi.updatePackage"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)}}},Qe=function(l,r,a){const n=N(l);return{createPackage(e,t,o,s){return n.createPackage(e,t,o,s).then(c=>c(a,r))},deletePackage(e,t,o){return n.deletePackage(e,t,o).then(s=>s(a,r))},getPackage(e,t,o,s,c){return n.getPackage(e,t,o,s,c).then(i=>i(a,r))},listPackages(e,t){return n.listPackages(e,t).then(o=>o(a,r))},updatePackage(e,t,o,s){return n.updatePackage(e,t,o,s).then(c=>c(a,r))}}};class te extends I{createPackage(r,a,n,e){return N(this.configuration).createPackage(r,a,n,e).then(t=>t(this.axios,this.basePath))}deletePackage(r,a,n){return N(this.configuration).deletePackage(r,a,n).then(e=>e(this.axios,this.basePath))}getPackage(r,a,n,e,t){return N(this.configuration).getPackage(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}listPackages(r,a){return N(this.configuration).listPackages(r,a).then(n=>n(this.axios,this.basePath))}updatePackage(r,a,n,e){return N(this.configuration).updatePackage(r,a,n,e).then(t=>t(this.axios,this.basePath))}}const ne=function(l){return{getStatus:async(r={})=>{const a="/status",n=new URL(a,V);let e;l&&(e=l.baseOptions);const t={method:"GET",...e,...r},o={};v(n,{});let c=e&&e.headers?e.headers:{};return t.headers={...o,...c,...r.headers},{url:b(n),options:t}}}},B=function(l){const r=ne(l);return{async getStatus(a){const n=await r.getStatus(a),e=l?.serverIndex??0,t=g["PublisherApi.getStatus"]?.[e]?.url;return(o,s)=>O(n,h,u,l)(o,t||s)}}},Be=function(l,r,a){const n=B(l);return{getStatus(e){return n.getStatus(e).then(t=>t(a,r))}}};class re extends I{getStatus(r){return B(this.configuration).getStatus(r).then(a=>a(this.axios,this.basePath))}}const oe=function(l){return{getWatchStatus:async(r={})=>{const a="/watch-mode/status",n=new URL(a,V);let e;l&&(e=l.baseOptions);const t={method:"GET",...e,...r},o={};v(n,{});let c=e&&e.headers?e.headers:{};return t.headers={...o,...c,...r.headers},{url:b(n),options:t}},startWatching:async(r,a={})=>{m("startWatching","startWatchRequest",r);const n="/watch-mode/start",e=new URL(n,V);let t;l&&(t=l.baseOptions);const o={method:"POST",...t,...a},s={},c={};s["Content-Type"]="application/json",v(e,c);let i=t&&t.headers?t.headers:{};return o.headers={...s,...i,...a.headers},o.data=y(r,o,l),{url:b(e),options:o}},stopWatching:async(r={})=>{const a="/watch-mode/stop",n=new URL(a,V);let e;l&&(e=l.baseOptions);const t={method:"POST",...e,...r},o={};v(n,{});let c=e&&e.headers?e.headers:{};return t.headers={...o,...c,...r.headers},{url:b(n),options:t}}}},E=function(l){const r=oe(l);return{async getWatchStatus(a){const n=await r.getWatchStatus(a),e=l?.serverIndex??0,t=g["WatchModeApi.getWatchStatus"]?.[e]?.url;return(o,s)=>O(n,h,u,l)(o,t||s)},async startWatching(a,n){const e=await r.startWatching(a,n),t=l?.serverIndex??0,o=g["WatchModeApi.startWatching"]?.[t]?.url;return(s,c)=>O(e,h,u,l)(s,o||c)},async stopWatching(a){const n=await r.stopWatching(a),e=l?.serverIndex??0,t=g["WatchModeApi.stopWatching"]?.[e]?.url;return(o,s)=>O(n,h,u,l)(o,t||s)}}},ze=function(l,r,a){const n=E(l);return{getWatchStatus(e){return n.getWatchStatus(e).then(t=>t(a,r))},startWatching(e,t){return n.startWatching(e,t).then(o=>o(a,r))},stopWatching(e){return n.stopWatching(e).then(t=>t(a,r))}}};class se extends I{getWatchStatus(r){return E(this.configuration).getWatchStatus(r).then(a=>a(this.axios,this.basePath))}startWatching(r,a){return E(this.configuration).startWatching(r,a).then(n=>n(this.axios,this.basePath))}stopWatching(r){return E(this.configuration).stopWatching(r).then(a=>a(this.axios,this.basePath))}}class ce{apiKey;username;password;accessToken;basePath;serverIndex;baseOptions;formDataCtor;constructor(r={}){this.apiKey=r.apiKey,this.username=r.username,this.password=r.password,this.accessToken=r.accessToken,this.basePath=r.basePath,this.serverIndex=r.serverIndex,this.baseOptions={...r.baseOptions,headers:{...r.baseOptions?.headers}},this.formDataCtor=r.formDataCtor}isJsonMime(r){const a=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return r!==null&&(a.test(r)||r.toLowerCase()==="application/json-patch+json")}}const le=new j.QueryClient({defaultOptions:{queries:{retry:!1,throwOnError:!1},mutations:{retry:!1,throwOnError:!1}}});h.defaults.baseURL||(h.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet");const ie=U.createContext(void 0),je=(l,r)=>{const a=`${window.location.protocol}//${window.location.host}/api/v0`,n=h.create({baseURL:l||a,withCredentials:!0,timeout:6e5});n.interceptors.request.use(async t=>{const o=await r?.();return t.headers.Authorization=o||"",t});const e=new ce({basePath:a});return{models:new X(e,a,n),publisher:new re(e,a,n),environments:new _(e,a,n),packages:new te(e,a,n),notebooks:new ee(e,a,n),connections:new f(e,a,n),databases:new W(e,a,n),watchMode:new se(e,a,n)}},Le=({children:l,getAccessToken:r,baseURL:a,mutable:n})=>{const e=U.useMemo(()=>je(a,r),[a,r]),t=a||`${window.location.protocol}//${window.location.host}/api/v0`,[o,s]=U.useState(n),[c,i]=U.useState(!0);U.useEffect(()=>{let d=!0;return(async()=>{try{const A=await e.publisher.getStatus();if(d){const C=A.data?.frozenConfig;let R;C?R=!1:n===void 0?R=!0:R=n,s(R),i(!1)}}catch(A){console.error("Failed to fetch publisher status:",A),d&&(s(n),i(!1))}})(),()=>{d=!1}},[e,n]);const p={server:t,getAccessToken:r,apiClients:e,mutable:o,isLoadingStatus:c};return z.jsx(j.QueryClientProvider,{client:le,children:z.jsx(ie.Provider,{value:p,children:l})})},fe=()=>{const l=U.useContext(ie);if(l===void 0)throw new Error("useServer must be used within a ServerProvider");return l};exports.AttachedDatabaseTypeEnum=me;exports.AzureConnectionAuthTypeEnum=de;exports.CompileProblemSeverityEnum=he;exports.CompileResultStatusEnum=ue;exports.Configuration=ce;exports.ConnectionStatusStatusEnum=ge;exports.ConnectionTypeEnum=Pe;exports.ConnectionsApi=f;exports.ConnectionsApiAxiosParamCreator=L;exports.ConnectionsApiFactory=Ie;exports.ConnectionsApiFp=S;exports.ConnectionsTestApi=ke;exports.ConnectionsTestApiAxiosParamCreator=H;exports.ConnectionsTestApiFactory=Ce;exports.ConnectionsTestApiFp=$;exports.DatabaseTypeEnum=Ve;exports.DatabasesApi=W;exports.DatabasesApiAxiosParamCreator=D;exports.DatabasesApiFactory=xe;exports.DatabasesApiFp=Q;exports.EnvironmentsApi=_;exports.EnvironmentsApiAxiosParamCreator=G;exports.EnvironmentsApiFactory=Ne;exports.EnvironmentsApiFp=k;exports.ExecuteNotebookCellBypassFiltersEnum=$e;exports.FilterTypeEnum=ve;exports.LogMessageSeverityEnum=be;exports.ManifestActionActionEnum=Te;exports.ManifestsApi=Ue;exports.ManifestsApiAxiosParamCreator=J;exports.ManifestsApiFactory=Re;exports.ManifestsApiFp=q;exports.MaterializationActionActionEnum=we;exports.MaterializationStatusEnum=Oe;exports.MaterializationsApi=Ee;exports.MaterializationsApiAxiosParamCreator=K;exports.MaterializationsApiFactory=Me;exports.MaterializationsApiFp=x;exports.ModelsApi=X;exports.ModelsApiAxiosParamCreator=Y;exports.ModelsApiFactory=qe;exports.ModelsApiFp=T;exports.NotebookCellResultTypeEnum=ye;exports.NotebookCellTypeEnum=Se;exports.NotebooksApi=ee;exports.NotebooksApiAxiosParamCreator=Z;exports.NotebooksApiFactory=Fe;exports.NotebooksApiFp=M;exports.PackagesApi=te;exports.PackagesApiAxiosParamCreator=ae;exports.PackagesApiFactory=Qe;exports.PackagesApiFp=N;exports.PublisherApi=re;exports.PublisherApiAxiosParamCreator=ne;exports.PublisherApiFactory=Be;exports.PublisherApiFp=B;exports.ServerProvider=Le;exports.ServerStatusOperationalStateEnum=Ae;exports.WatchModeApi=se;exports.WatchModeApiAxiosParamCreator=oe;exports.WatchModeApiFactory=ze;exports.WatchModeApiFp=E;exports.globalQueryClient=le;exports.useServer=fe;
|
package/dist/client/api.d.ts
CHANGED
|
@@ -1654,7 +1654,7 @@ export interface ServerStatus {
|
|
|
1654
1654
|
*/
|
|
1655
1655
|
'initialized'?: boolean;
|
|
1656
1656
|
/**
|
|
1657
|
-
* Status of the server; initializing when the server is loading environments, packages and connections, serving when the server is initialized and ready to serve requests,
|
|
1657
|
+
* Status of the server; initializing when the server is loading environments, packages and connections, serving when the server is initialized and ready to serve requests, draining when the server is going to shut down, and throttled when the server has hit its memory back-pressure limit and is rejecting new package loads and queries to stay under PUBLISHER_MAX_MEMORY_BYTES (see the memory governor). Already-loaded packages remain serviceable while throttled; the control plane treats a throttled worker as unhealthy for new load. Only reported when the memory governor is enabled.
|
|
1658
1658
|
* @type {string}
|
|
1659
1659
|
* @memberof ServerStatus
|
|
1660
1660
|
*/
|
|
@@ -1670,6 +1670,7 @@ export declare const ServerStatusOperationalStateEnum: {
|
|
|
1670
1670
|
readonly Initializing: "initializing";
|
|
1671
1671
|
readonly Serving: "serving";
|
|
1672
1672
|
readonly Draining: "draining";
|
|
1673
|
+
readonly Throttled: "throttled";
|
|
1673
1674
|
};
|
|
1674
1675
|
export type ServerStatusOperationalStateEnum = typeof ServerStatusOperationalStateEnum[keyof typeof ServerStatusOperationalStateEnum];
|
|
1675
1676
|
/**
|
package/dist/client/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../ServerProvider-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../ServerProvider-F3zU218S.cjs.js");exports.AttachedDatabaseTypeEnum=e.AttachedDatabaseTypeEnum;exports.AzureConnectionAuthTypeEnum=e.AzureConnectionAuthTypeEnum;exports.CompileProblemSeverityEnum=e.CompileProblemSeverityEnum;exports.CompileResultStatusEnum=e.CompileResultStatusEnum;exports.Configuration=e.Configuration;exports.ConnectionStatusStatusEnum=e.ConnectionStatusStatusEnum;exports.ConnectionTypeEnum=e.ConnectionTypeEnum;exports.ConnectionsApi=e.ConnectionsApi;exports.ConnectionsApiAxiosParamCreator=e.ConnectionsApiAxiosParamCreator;exports.ConnectionsApiFactory=e.ConnectionsApiFactory;exports.ConnectionsApiFp=e.ConnectionsApiFp;exports.ConnectionsTestApi=e.ConnectionsTestApi;exports.ConnectionsTestApiAxiosParamCreator=e.ConnectionsTestApiAxiosParamCreator;exports.ConnectionsTestApiFactory=e.ConnectionsTestApiFactory;exports.ConnectionsTestApiFp=e.ConnectionsTestApiFp;exports.DatabaseTypeEnum=e.DatabaseTypeEnum;exports.DatabasesApi=e.DatabasesApi;exports.DatabasesApiAxiosParamCreator=e.DatabasesApiAxiosParamCreator;exports.DatabasesApiFactory=e.DatabasesApiFactory;exports.DatabasesApiFp=e.DatabasesApiFp;exports.EnvironmentsApi=e.EnvironmentsApi;exports.EnvironmentsApiAxiosParamCreator=e.EnvironmentsApiAxiosParamCreator;exports.EnvironmentsApiFactory=e.EnvironmentsApiFactory;exports.EnvironmentsApiFp=e.EnvironmentsApiFp;exports.ExecuteNotebookCellBypassFiltersEnum=e.ExecuteNotebookCellBypassFiltersEnum;exports.FilterTypeEnum=e.FilterTypeEnum;exports.LogMessageSeverityEnum=e.LogMessageSeverityEnum;exports.ManifestActionActionEnum=e.ManifestActionActionEnum;exports.ManifestsApi=e.ManifestsApi;exports.ManifestsApiAxiosParamCreator=e.ManifestsApiAxiosParamCreator;exports.ManifestsApiFactory=e.ManifestsApiFactory;exports.ManifestsApiFp=e.ManifestsApiFp;exports.MaterializationActionActionEnum=e.MaterializationActionActionEnum;exports.MaterializationStatusEnum=e.MaterializationStatusEnum;exports.MaterializationsApi=e.MaterializationsApi;exports.MaterializationsApiAxiosParamCreator=e.MaterializationsApiAxiosParamCreator;exports.MaterializationsApiFactory=e.MaterializationsApiFactory;exports.MaterializationsApiFp=e.MaterializationsApiFp;exports.ModelsApi=e.ModelsApi;exports.ModelsApiAxiosParamCreator=e.ModelsApiAxiosParamCreator;exports.ModelsApiFactory=e.ModelsApiFactory;exports.ModelsApiFp=e.ModelsApiFp;exports.NotebookCellResultTypeEnum=e.NotebookCellResultTypeEnum;exports.NotebookCellTypeEnum=e.NotebookCellTypeEnum;exports.NotebooksApi=e.NotebooksApi;exports.NotebooksApiAxiosParamCreator=e.NotebooksApiAxiosParamCreator;exports.NotebooksApiFactory=e.NotebooksApiFactory;exports.NotebooksApiFp=e.NotebooksApiFp;exports.PackagesApi=e.PackagesApi;exports.PackagesApiAxiosParamCreator=e.PackagesApiAxiosParamCreator;exports.PackagesApiFactory=e.PackagesApiFactory;exports.PackagesApiFp=e.PackagesApiFp;exports.PublisherApi=e.PublisherApi;exports.PublisherApiAxiosParamCreator=e.PublisherApiAxiosParamCreator;exports.PublisherApiFactory=e.PublisherApiFactory;exports.PublisherApiFp=e.PublisherApiFp;exports.ServerProvider=e.ServerProvider;exports.ServerStatusOperationalStateEnum=e.ServerStatusOperationalStateEnum;exports.WatchModeApi=e.WatchModeApi;exports.WatchModeApiAxiosParamCreator=e.WatchModeApiAxiosParamCreator;exports.WatchModeApiFactory=e.WatchModeApiFactory;exports.WatchModeApiFp=e.WatchModeApiFp;exports.globalQueryClient=e.globalQueryClient;exports.useServer=e.useServer;
|
package/dist/client/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as i, a as e, C as o, b as t, a9 as n, d as r, c as p, k as A, h as c, j as m, i as u, o as l, l as C, n as F, m as y, D as E, s as P, p as M, r as b, q as x, w as k, E as S, v as T, t as d, Y as h, F as v, L as g, G as f, B as z, x as N, z as D, y as W, O as R, M as B, K as L, H as O, J as Q, I as j, T as q, P as w, R as G, Q as H, e as I, N as J, X as K, U, W as V, V as X, a0 as Y, Z, $ as _, _ as $, a4 as aa, a1 as sa, a3 as ia, a2 as ea, S as oa, f as ta, a8 as na, a5 as ra, a7 as pa, a6 as Aa, g as ca, u as ma } from "../ServerProvider-
|
|
1
|
+
import { A as i, a as e, C as o, b as t, a9 as n, d as r, c as p, k as A, h as c, j as m, i as u, o as l, l as C, n as F, m as y, D as E, s as P, p as M, r as b, q as x, w as k, E as S, v as T, t as d, Y as h, F as v, L as g, G as f, B as z, x as N, z as D, y as W, O as R, M as B, K as L, H as O, J as Q, I as j, T as q, P as w, R as G, Q as H, e as I, N as J, X as K, U, W as V, V as X, a0 as Y, Z, $ as _, _ as $, a4 as aa, a1 as sa, a3 as ia, a2 as ea, S as oa, f as ta, a8 as na, a5 as ra, a7 as pa, a6 as Aa, g as ca, u as ma } from "../ServerProvider-a1T2FnBE.es.js";
|
|
2
2
|
export {
|
|
3
3
|
i as AttachedDatabaseTypeEnum,
|
|
4
4
|
e as AzureConnectionAuthTypeEnum,
|
|
@@ -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-
|
|
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-BNOut93L.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-C2OvwukW.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-B8kmVFxA.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 Zy=Object.create;var bp=Object.defineProperty;var Jy=Object.getOwnPropertyDescriptor;var ex=Object.getOwnPropertyNames;var tx=Object.getPrototypeOf,nx=Object.prototype.hasOwnProperty;var rx=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ex(t))!nx.call(e,o)&&o!==n&&bp(e,o,{get:()=>t[o],enumerable:!(r=Jy(t,o))||r.enumerable});return e};var eu=(e,t,n)=>(n=e!=null?Zy(tx(e)):{},rx(t||!e||!e.__esModule?bp(n,"default",{value:e,enumerable:!0}):n,e));const d=require("react/jsx-runtime"),P=require("@mui/material"),q=require("react"),Rr=require("@tanstack/react-query"),ut=require("./ServerProvider-
|
|
1
|
+
"use strict";var Zy=Object.create;var bp=Object.defineProperty;var Jy=Object.getOwnPropertyDescriptor;var ex=Object.getOwnPropertyNames;var tx=Object.getPrototypeOf,nx=Object.prototype.hasOwnProperty;var rx=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ex(t))!nx.call(e,o)&&o!==n&&bp(e,o,{get:()=>t[o],enumerable:!(r=Jy(t,o))||r.enumerable});return e};var eu=(e,t,n)=>(n=e!=null?Zy(tx(e)):{},rx(t||!e||!e.__esModule?bp(n,"default",{value:e,enumerable:!0}):n,e));const d=require("react/jsx-runtime"),P=require("@mui/material"),q=require("react"),Rr=require("@tanstack/react-query"),ut=require("./ServerProvider-F3zU218S.cjs.js"),_s=require("markdown-to-jsx"),bn=require("@mui/icons-material"),dt=require("@mui/system"),ox=require("@emotion/styled"),ix=require("@emotion/react"),Gi=require("react-dom"),Vm=require("@react-spring/web"),ax=require("react-router-dom");function Wm(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 D=Wm(q),sx=Wm(Gi),yp=e=>e,lx=()=>{let e=yp;return{configure(t){e=t},generate(t){return e(t)},reset(){e=yp}}},qm=lx();function kr(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 ke(e){if(typeof e!="string")throw new Error(kr(7));return e.charAt(0).toUpperCase()+e.slice(1)}function xp(...e){return e.reduce((t,n)=>n==null?t:function(...o){t.apply(this,o),n.apply(this,o)},()=>{})}function Xn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tu={exports:{}},nu,Ep;function ux(){if(Ep)return nu;Ep=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return nu=e,nu}var ru,Cp;function cx(){if(Cp)return ru;Cp=1;var e=ux();function t(){}function n(){}return n.resetWarningCache=t,ru=function(){function r(a,s,l,u,c,p){if(p!==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},ru}var Tp;function dx(){return Tp||(Tp=1,tu.exports=cx()()),tu.exports}var px=dx();const de=Xn(px);function Ym(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=Ym(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ae(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Ym(e))&&(r&&(r+=" "),r+=t);return r}function Ne(e,t,n=void 0){const r={};for(const o in e){const i=e[o];let a="",s=!0;for(let l=0;l<i.length;l+=1){const u=i[l];u&&(a+=(s===!0?"":" ")+t(u),s=!1,n&&n[u]&&(a+=" "+n[u]))}r[o]=a}return r}var ou={exports:{}},xt={};/**
|
|
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(a)&&(C=`
|
|
90
90
|
`+(parseInt(a)+1)+". "),ei(r,C)}else if(e.code&&e.code.toLowerCase()==="keyd"&&e.ctrlKey){vs(e);var S={start:r.selectionStart,end:r.selectionEnd},k=S;S=ca({text:r.value,selection:S});var T=r.value.slice(S.start,S.end);s.setSelectionRange({start:S.end,end:S.end}),ei(r,`
|
|
91
91
|
`+T),s.setSelectionRange({start:k.start,end:k.end})}else e.code&&e.code.toLowerCase()==="arrowup"&&e.altKey?xh(e,-1):e.code&&e.code.toLowerCase()==="arrowdown"&&e.altKey&&xh(e,1)}var G5=["prefixCls","onChange"],Q5=["markdown","commands","fullscreen","preview","highlightEnable","extraCommands","tabSize","defaultTabEnable","autoFocusEnd","textareaWarp","dispatch"];function X5(e){var{prefixCls:t,onChange:n}=e,r=$e(e,G5),o=q.useContext(Ti),{markdown:i,commands:a,fullscreen:s,preview:l,highlightEnable:u,extraCommands:c,tabSize:p,defaultTabEnable:h,autoFocusEnd:f,textareaWarp:m,dispatch:g}=o;$e(o,Q5);var y=q.useRef(null),x=q.useRef(),E=q.useRef({fullscreen:s,preview:l});q.useEffect(()=>{E.current={fullscreen:s,preview:l,highlightEnable:u}},[s,l,u]),q.useEffect(()=>{if(y.current&&g){var S=new Dd(y.current);x.current=S,g({textarea:y.current,commandOrchestrator:S})}},[]),q.useEffect(()=>{if(f&&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 C=S=>{K5(S,p,h),L1(S,[...a||[],...c||[]],x.current,g,E.current)};return q.useEffect(()=>(y.current&&y.current.addEventListener("keydown",C),()=>{y.current&&y.current.removeEventListener("keydown",C)}),[]),d.jsx("textarea",$({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1},r,{ref:y,className:t+"-text-input "+(r.className?r.className:""),value:i,onChange:S=>{g&&g({markdown:S.target.value}),n&&n(S)}}))}var Z5=["prefixCls","className","onScroll","renderTextarea"];function J5(e){var t=e||{},{prefixCls:n,className:r,onScroll:o,renderTextarea:i}=t,a=$e(t,Z5),{markdown:s,scrollTop:l,commands:u,extraCommands:c,dispatch:p}=q.useContext(Ti),h=q.useRef(null),f=q.useRef(),m=q.createRef();q.useEffect(()=>{var y={};m.current&&(y.textareaWarp=m.current||void 0,m.current.scrollTop=l||0),p&&p($({},y))},[]),q.useEffect(()=>{if(h.current&&p){var y=new Dd(h.current);f.current=y,p({textarea:h.current,commandOrchestrator:y})}},[]);var g={WebkitTextFillColor:"initial",overflow:"auto"};return d.jsx("div",{ref:m,className:n+"-area "+(r||""),onScroll:o,children:d.jsx("div",{className:n+"-text",children:i?q.cloneElement(i($({},a,{value:s,autoComplete:"off",autoCorrect:"off",spellCheck:"false",autoCapitalize:"off",className:n+"-text-input",style:{WebkitTextFillColor:"inherit",overflow:"auto"}}),{dispatch:p,onChange:a.onChange,shortcuts:L1,useContext:{commands:u,extraCommands:c,commandOrchestrator:f.current}}),{ref:h}):d.jsx(q.Fragment,{children:d.jsx(X5,$({prefixCls:n},a,{style:g}))})})})}function e4(e){var{prefixCls:t,groupName:n,commands:r,children:o}=e||{},{barPopup:i={}}=q.useContext(Ti);return q.useMemo(()=>d.jsx("div",{className:t+"-toolbar-child "+(n&&i[n]?"active":""),onClick:a=>a.stopPropagation(),children:Array.isArray(r)?d.jsx(j1,$({commands:r},e,{isChild:!0})):o}),[r,i,n,t])}function Eh(e){var{prefixCls:t,overflow:n}=e,{fullscreen:r,preview:o,barPopup:i={},components:a,commandOrchestrator:s,dispatch:l}=q.useContext(Ti),u=q.useRef("");function c(p,h){if(l){var f={barPopup:$({},i)};p.keyCommand==="preview"&&(f.preview=p.value),p.keyCommand==="fullscreen"&&(f.fullscreen=!r),e.commands&&p.keyCommand==="group"?e.commands.forEach(m=>{h===m.groupName?f.barPopup[h]=!0:m.keyCommand&&(f.barPopup[m.groupName]=!1)}):(h||p.parent)&&Object.keys(f.barPopup||{}).forEach(m=>{f.barPopup[m]=!1}),Object.keys(f).length&&l($({},f)),s&&s.executeCommand(p)}}return q.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]),d.jsx("ul",{children:(e.commands||[]).map((p,h)=>{if(p.keyCommand==="divider")return d.jsx("li",$({},p.liProps,{className:t+"-toolbar-divider"}),h);if(!p.keyCommand)return d.jsx(q.Fragment,{},h);var f=r&&p.keyCommand==="fullscreen"||p.keyCommand==="preview"&&o===p.value,m=p.children&&typeof p.children=="function"?p.children({getState:()=>s.getState(),textApi:s?s.textApi:void 0,close:()=>c({},p.groupName),execute:()=>c({execute:p.execute}),dispatch:l}):void 0,g=i&&o&&o==="preview"&&!/(preview|fullscreen)/.test(p.keyCommand),y=a?.toolbar||p.render,x=y&&typeof y=="function"?y(p,!!g,c,h):null;return d.jsxs("li",$({},p.liProps,{className:f?"active":"",children:[x&&q.isValidElement(x)&&x,!x&&!p.buttonProps&&p.icon,!x&&p.buttonProps&&q.createElement("button",$({type:"button",key:h,disabled:g,"data-name":p.name},p.buttonProps,{onClick:E=>{E.stopPropagation(),c(p,p.groupName)}}),p.icon),p.children&&d.jsx(e4,{overflow:n,groupName:p.groupName,prefixCls:t,children:m,commands:Array.isArray(p.children)?p.children:void 0})]}),h)})})}function j1(e){e===void 0&&(e={});var{prefixCls:t,isChild:n,className:r}=e,{commands:o,extraCommands:i}=q.useContext(Ti);return d.jsxs("div",{className:t+"-toolbar "+r,children:[d.jsx(Eh,$({},e,{commands:e.commands||o||[]})),!n&&d.jsx(Eh,$({},e,{commands:i||[]}))]})}function Ch(e){var{hideToolbar:t,toolbarBottom:n,placement:r,overflow:o,prefixCls:i}=e;if(t||r==="bottom"&&!n||r==="top"&&n)return null;var a=n?"bottom":"";return d.jsx(j1,{prefixCls:i,overflow:o,className:a})}var t4=e=>{var{prefixCls:t,onChange:n}=e||{},r=q.useRef(null),o=q.useRef(),i=q.useRef(e.height);q.useEffect(()=>{i.current!==e.height&&(i.current=e.height)},[e.height]);function a(c){if(o.current){var p,h=c.clientY||((p=c.changedTouches[0])==null?void 0:p.clientY),f=o.current.height+h-o.current.dragY;f>=e.minHeight&&f<=e.maxHeight&&n&&n(o.current.height+(h-o.current.dragY))}}function s(){var c,p;o.current=void 0,document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",s),(c=r.current)==null||c.removeEventListener("touchmove",a),(p=r.current)==null||p.removeEventListener("touchend",s)}function l(c){var p,h,f;c.preventDefault();var m=c.clientY||((p=c.changedTouches[0])==null?void 0:p.clientY);o.current={height:i.current,dragY:m},document.addEventListener("mousemove",a),document.addEventListener("mouseup",s),(h=r.current)==null||h.addEventListener("touchmove",a,{passive:!1}),(f=r.current)==null||f.addEventListener("touchend",s,{passive:!1})}q.useEffect(()=>{if(document){var c,p;(c=r.current)==null||c.addEventListener("touchstart",l,{passive:!1}),(p=r.current)==null||p.addEventListener("mousedown",l)}return()=>{if(document){var h;(h=r.current)==null||h.removeEventListener("touchstart",l),document.removeEventListener("mousemove",a)}}},[]);var u=q.useMemo(()=>d.jsx("svg",{viewBox:"0 0 512 512",height:"100%",children:d.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 d.jsx("div",{className:t+"-bar",ref:r,children:u})},n4=["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 r4(e){return e===void 0&&(e={}),Object.keys(e).forEach(t=>{e[t]=!1}),e}var o4=q.forwardRef((e,t)=>{var n=e||{},{prefixCls:r="w-md-editor",className:o,value:i,commands:a=q5(),commandsFilter:s,direction:l,extraCommands:u=Y5(),height:c=200,enableScroll:p=!0,visibleDragbar:h=typeof e.visiableDragbar=="boolean"?e.visiableDragbar:!0,highlightEnable:f=!0,preview:m="live",fullscreen:g=!1,overflow:y=!0,previewOptions:x={},textareaProps:E,maxHeight:C=1200,minHeight:S=100,autoFocus:k,autoFocusEnd:T=!1,tabSize:O=2,defaultTabEnable:F=!1,onChange:B,onStatistics:R,onHeightChange:N,hideToolbar:v,toolbarBottom:L=!1,components:I,renderTextarea:A}=n,M=$e(n,n4),V=a.map(be=>s?s(be,!1):be).filter(Boolean),W=u.map(be=>s?s(be,!0):be).filter(Boolean),[H,w]=q.useReducer(f5,{markdown:i,preview:m,components:I,height:c,minHeight:S,highlightEnable:f,tabSize:O,defaultTabEnable:F,scrollTop:0,scrollTopPreview:0,commands:V,extraCommands:W,fullscreen:g,barPopup:{}}),G=q.useRef(null),re=q.useRef(null),_=q.useRef(p);q.useImperativeHandle(t,()=>$({},H,{container:G.current,dispatch:w})),q.useMemo(()=>_.current=p,[p]),q.useEffect(()=>{var be={};G.current&&(be.container=G.current||void 0),be.markdown=i||"",be.barPopup={},w&&w($({},H,be))},[]);var ae=[o,"wmde-markdown-var",l?r+"-"+l:null,r,H.preview?r+"-show-"+H.preview:null,H.fullscreen?r+"-fullscreen":null].filter(Boolean).join(" ").trim();q.useMemo(()=>i!==H.markdown&&w({markdown:i||""}),[i,H.markdown]),q.useMemo(()=>m!==H.preview&&w({preview:m}),[m]),q.useMemo(()=>O!==H.tabSize&&w({tabSize:O}),[O]),q.useMemo(()=>f!==H.highlightEnable&&w({highlightEnable:f}),[f]),q.useMemo(()=>k!==H.autoFocus&&w({autoFocus:k}),[k]),q.useMemo(()=>T!==H.autoFocusEnd&&w({autoFocusEnd:T}),[T]),q.useMemo(()=>g!==H.fullscreen&&w({fullscreen:g}),[g]),q.useMemo(()=>c!==H.height&&w({height:c}),[c]),q.useMemo(()=>c!==H.height&&N&&N(H.height,c,H),[c,N,H]),q.useMemo(()=>a!==H.commands&&w({commands:V}),[e.commands]),q.useMemo(()=>u!==H.extraCommands&&w({extraCommands:W}),[e.extraCommands]);var X=q.useRef(),U=q.useRef("preview"),J=q.useRef(!1);q.useMemo(()=>{X.current=H.textareaWarp,H.textareaWarp&&(H.textareaWarp.addEventListener("mouseover",()=>{U.current="text"}),H.textareaWarp.addEventListener("mouseleave",()=>{U.current="preview"}))},[H.textareaWarp]);var Q=(be,se)=>{if(_.current){var Re=X.current,ve=re.current?re.current:void 0;if(J.current||(U.current=se,J.current=!0),Re&&ve){var ze=(Re.scrollHeight-Re.offsetHeight)/(ve.scrollHeight-ve.offsetHeight);be.target===Re&&U.current==="text"&&(ve.scrollTop=Re.scrollTop/ze),be.target===ve&&U.current==="preview"&&(Re.scrollTop=ve.scrollTop*ze);var De=0;U.current==="text"?De=Re.scrollTop||0:U.current==="preview"&&(De=ve.scrollTop||0),w({scrollTop:De})}}},ne=r+"-preview "+(x.className||""),Z=be=>Q(be,"preview"),Y=q.useMemo(()=>d.jsx("div",{ref:re,className:ne,children:d.jsx(M1,$({},x,{onScroll:Z,source:H.markdown||""}))}),[ne,x,H.markdown]),le=I?.preview&&I?.preview(H.markdown||"",H,w);le&&q.isValidElement(le)&&(Y=d.jsx("div",{className:ne,ref:re,onScroll:Z,children:le}));var ee=$({},M.style,{height:H.height||"100%"}),te=()=>w({barPopup:$({},r4(H.barPopup))}),xe=be=>w({height:be}),pe=be=>{if(B&&B(be.target.value,be,H),E&&E.onChange&&E.onChange(be),H.textarea&&H.textarea instanceof HTMLTextAreaElement&&R){var se=new Dd(H.textarea),Re=se.getState()||{};R($({},Re,{lineCount:be.target.value.split(`
|
|
92
|
-
`).length,length:be.target.value.length}))}};return d.jsx(Ti.Provider,{value:$({},H,{dispatch:w}),children:d.jsxs("div",$({ref:G,className:ae},M,{onClick:te,style:ee,children:[d.jsx(Ch,{hideToolbar:v,toolbarBottom:L,prefixCls:r,overflow:y,placement:"top"}),d.jsxs("div",{className:r+"-content",children:[/(edit|live)/.test(H.preview||"")&&d.jsx(J5,$({className:r+"-input",prefixCls:r,autoFocus:k},E,{onChange:pe,renderTextarea:I?.textarea||A,onScroll:be=>Q(be,"text")})),/(live|preview)/.test(H.preview||"")&&Y]}),h&&!H.fullscreen&&d.jsx(t4,{prefixCls:r,height:H.height,maxHeight:C,minHeight:S,onChange:xe}),d.jsx(Ch,{hideToolbar:v,toolbarBottom:L,prefixCls:r,overflow:y,placement:"bottom"})]}))})}),$1=o4;$1.Markdown=M1;const Nu={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"}]}}},i4={...Nu,patterns:[...Nu.patterns,{include:"#docvar"}],repository:{...Nu.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},a4={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"}]}}},s4="github-light";let Fu;function l4(){return Fu||(Fu=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:i}]=await Promise.all([Promise.resolve().then(()=>require("./core-CKNmRclF.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"))]);return e({engine:t(Promise.resolve().then(()=>require("./wasm-Dw4u1m6u.cjs.js"))),themes:[i],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...i4},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...a4}]})})()),Fu}async function Zs(e,t){return(await l4()).codeToHtml(e,{lang:t,theme:s4})}function Wt(e){const{server:t}=ut.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 Rr.useQuery(n,ut.globalQueryClient)}function ur(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 Rr.useMutation(t,ut.globalQueryClient)}const Mt=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},Ua=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 wd({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:i}){return q.useEffect(()=>{o&&o(t)},[t,o]),d.jsx(Gc,{children:d.jsxs(dt.Stack,{spacing:2,component:"section",children:[d.jsx(H1,{sourceAndPath:e[t],existingQuery:n,onChange:a=>{r&&r(a)},resourceUri:i}),d.jsx(dt.Box,{height:"5px"})]})})}function Ss(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function u4({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:i}){const[a,s]=q.useState(n||Ss()),[l,u]=q.useState(void 0);q.useEffect(()=>{n&&s(n)},[n]);const[c,p]=q.useState([]),{MalloyExplorerProvider:h,QueryPanel:f,ResizableCollapsiblePanel:m,ResultPanel:g,SourcePanel:y}=r;q.useEffect(()=>{t&&t(a)},[t,a]);const{environmentName:x,packageName:E,versionId:C}=Mt(i),{apiClients:S}=ut.useServer(),k=ur({mutationFn:()=>{const B=typeof a?.malloyQuery=="string"?a.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:a?.malloyQuery}).toMalloy();return u({executionState:"running",query:a?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{k.reset(),u(void 0)},response:{result:{}}}),s({...a,query:B}),S.models.executeQueryModel(x,E,e.modelPath,{query:B,sourceName:void 0,queryName:void 0,versionId:C})},onSuccess:B=>{if(B){const R=JSON.parse(B.data.result);s({...a,malloyResult:R}),u(N=>N?{...N,executionState:"finished",response:{result:R}}:void 0)}},onError:B=>{u(void 0),console.error("Query execution error:",B)}}),[T,O]=q.useState(e.sourceInfo.name);q.useEffect(()=>{T!==e.sourceInfo.name&&(O(e.sourceInfo.name),s(Ss()),u(void 0))},[e,T]);const F=q.useCallback(B=>{s({...a,malloyQuery:B,malloyResult:void 0})},[a]);return T!==e.sourceInfo.name?d.jsx("div",{children:"Loading..."}):d.jsx(f0,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:d.jsx(h,{source:e.sourceInfo,query:a?.malloyQuery,topValues:[],onFocusedNestViewPathChange:p,focusedNestViewPath:c,onQueryChange:F,children:d.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[d.jsx(m,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:d.jsx(y,{onRefresh:()=>s(Ss())})}),d.jsx(m,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:d.jsx(f,{runQuery:()=>{console.log(`running query with: ${a?.malloyQuery}`);try{k.mutate()}catch(B){console.error("Error running query:",B)}}})}),d.jsx(g,{source:e.sourceInfo,draftQuery:a?.malloyQuery,setDraftQuery:B=>s({...a,malloyQuery:B}),submittedQuery:l,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function H1(e){const[t,n]=q.useState(null),[r,o]=q.useState(null),[i,a]=q.useState(!0);return q.useEffect(()=>{let s=!0;return Promise.all([import("@malloydata/malloy-explorer"),import("@malloydata/malloy-query-builder")]).then(([l,u])=>{s&&(n(l),o(u),a(!1))}).catch(l=>{console.error("Failed to load Malloy components:",l),s&&a(!1)}),()=>{s=!1}},[]),i||!t||!r?d.jsx(FE,{children:d.jsx(f0,{children:d.jsx(dt.Box,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):d.jsx(u4,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function un({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:i=2,textVariant:a="body2"}){const s=d.jsxs(P.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:i},children:[d.jsx(P.CircularProgress,{size:t,color:n,thickness:r}),e&&d.jsx(P.Typography,{variant:a,color:"text.secondary",children:e})]});return o?d.jsx(P.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:s}):s}const c4=q.lazy(()=>Promise.resolve().then(()=>Vj));function Si({result:e,maxHeight:t,maxResultSize:n=0}){const r=q.useRef(null),[o,i]=q.useState(t),[a,s]=q.useState(!1);if(!e)return null;if(n>0&&e.length>n&&!a)return d.jsxs(P.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[d.jsx(bn.Warning,{sx:{fontSize:48,color:"#757575"}}),d.jsx(P.Typography,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),d.jsx(P.Button,{variant:"contained",color:"primary",onClick:()=>s(!0),children:"Proceed"})]});const u=d.jsx(un,{text:"Loading...",centered:!0,size:32}),c=Math.min(t,o);return d.jsx(P.Box,{ref:r,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden"},children:e&&d.jsx(q.Suspense,{fallback:u,children:d.jsx(c4,{result:e,height:c,onSizeChange:i})})})}function d4({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},a=t.findIndex(s=>s.sourceInfo.name===e.sourceName);return d.jsx(wd,{resourceUri:n,sourceAndPaths:t,selectedSourceIndex:a>=0?a:0,existingQuery:i,onQueryChange:r,onSourceChange:o})}function p4({cell:e,editingMalloy:t,editingMarkdown:n,sourceAndPaths:r,resourceUri:o,onCellChange:i,onClose:a,onEdit:s,onDelete:l,addButtonCallback:u}){const[c,p]=q.useState(e.value),[h,f]=q.useState(!1),[m,g]=q.useState(!1),[y,x]=q.useState(),[E]=q.useState(),[C,S]=q.useState(Ss()),[k,T]=q.useState(!1),[O,F]=q.useState(e.sourceName?r.findIndex(G=>G.sourceInfo.name===e.sourceName):0);q.useEffect(()=>{e.isMarkdown||Zs(e.value,"malloy").then(G=>{x(G)})},[e]),q.useEffect(()=>{document.documentElement.setAttribute("data-color-mode","light")});const[B,R]=q.useState(!1),N=()=>{l(),R(!1)},v=r.length===0,L=q.useCallback(()=>{const G=r[O],re=G?.modelPath||e.modelPath||"",_=G?.sourceInfo.name||e.sourceName||"";i({...e,value:e.isMarkdown?c:C.query,result:C.malloyResult?JSON.stringify(C.malloyResult):void 0,queryInfo:C.malloyQuery?JSON.stringify(C.malloyQuery):void 0,sourceName:_,modelPath:re})},[e,c,C,i,O,r]),I=d.jsx(P.Tooltip,{title:"Delete Cell",children:d.jsx(P.IconButton,{size:"small",onClick:()=>R(!0),children:d.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d.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"})})})}),A=d.jsxs(P.Dialog,{open:B,onClose:()=>R(!1),children:[d.jsx(P.DialogTitle,{children:"Confirm Delete"}),d.jsx(P.DialogContent,{children:d.jsx(P.Typography,{children:"Are you sure you want to delete this cell?"})}),d.jsxs(P.DialogActions,{children:[d.jsx(P.Button,{onClick:()=>R(!1),children:"Cancel"}),d.jsx(P.Button,{onClick:N,color:"error",children:"Delete"})]})]}),M=()=>{L(),a()},V=e.isMarkdown?d.jsxs(d.Fragment,{children:[n?d.jsx(P.Tooltip,{title:"Save",children:d.jsx(P.IconButton,{size:"small",onClick:M,children:d.jsx(Ja,{})})}):d.jsx(P.Tooltip,{title:"Edit",children:d.jsx(P.IconButton,{size:"small",onClick:s,children:d.jsx(zp,{})})}),!n&&I]}):d.jsxs(d.Fragment,{children:[!t&&d.jsx(P.Tooltip,{title:h?"Hide Code":"View Code",children:d.jsx(P.IconButton,{size:"small",onClick:()=>{f(!h)},children:d.jsx(b0,{})})}),!t&&e.result&&d.jsx(P.Tooltip,{title:m?"Hide Embedding":"View Embedding",children:d.jsx(P.IconButton,{size:"small",onClick:()=>{g(!m)},children:d.jsx(Qc,{})})}),t&&d.jsx(P.Tooltip,{title:"Save",children:d.jsx(P.IconButton,{size:"small",onClick:M,children:d.jsx(Ja,{})})}),!t&&d.jsx(P.Tooltip,{title:"Edit",children:d.jsx(P.IconButton,{size:"small",onClick:s,children:d.jsx(zp,{})})}),!t&&I]}),W=t||n,H=n?d.jsx(P.Tooltip,{title:"Save",children:d.jsx(P.IconButton,{size:"small",onClick:M,children:d.jsx(Ja,{})})}):t?d.jsx(P.Tooltip,{title:"Save",children:d.jsx(P.IconButton,{size:"small",onClick:M,children:d.jsx(Ja,{})})}):null,w=k&&d.jsx(P.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:!W&&d.jsxs(d.Fragment,{children:[u(!0),u(!1),V]})||H});return d.jsxs(Us,{sx:{position:"relative",marginTop:"5px",marginBottom:"5px",borderWidth:"1.5px",backgroundColor:"#fff",minHeight:"50px"},onMouseEnter:()=>T(!0),onMouseLeave:()=>{T(!1)},children:[w,e.isMarkdown?d.jsx(d.Fragment,{children:n?d.jsx($1,{value:c,preview:"edit",autoFocus:!0,onChange:G=>{p(G),i({...e,value:G})},onBlur:()=>{L(),k||M()}}):d.jsx(P.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?d.jsx(P.Box,{onClick:s,sx:{cursor:"pointer"},children:d.jsx(_s,{children:e.value})}):d.jsxs(P.Box,{onClick:s,sx:{cursor:"pointer"},children:[d.jsx(P.Typography,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Markdown is empty"}),d.jsx(P.Typography,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})})}):d.jsxs(d.Fragment,{children:[d.jsx(P.Collapse,{in:m,timeout:"auto",unmountOnExit:!0,children:d.jsx(P.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:d.jsx(P.Typography,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:E}})})}),d.jsx(P.Collapse,{in:h,timeout:"auto",unmountOnExit:!0,children:d.jsx(P.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:d.jsx(P.Typography,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:y}})})}),t&&(v?d.jsxs(d.Fragment,{children:[d.jsx(P.Typography,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"No Model Imports"}),d.jsx(P.Typography,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Please add a model import above."})]}):d.jsx(d4,{sourceAndPaths:r,resourceUri:o,onQueryChange:G=>{S(G)},onSourceChange:G=>{F(G)},cell:e})),!t&&e.result&&d.jsx(Us,{variant:"outlined",sx:{borderRadius:0},children:d.jsx(Si,{result:e.result,maxHeight:800})}),!t&&!e.result&&d.jsxs(P.Box,{onClick:s,sx:{cursor:"pointer"},children:[d.jsx(P.Typography,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Explore is empty"}),d.jsx(P.Typography,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})]}),B&&A]})}const U1=q.createContext(void 0);function f4({children:e,workbookStorage:t}){const n=q.useMemo(()=>({workbookStorage:t}),[t]);return d.jsx(U1.Provider,{value:n,children:e})}function Id(){const e=q.useContext(U1);if(!e)throw new Error("useWorkbookStorage must be used within a WorkbookStorageProvider");return e}const Ir=lt(d.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"})),h4=lt(d.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 cn({error:e,context:t}){const n=e.data?.message||"Unknown Error";return d.jsxs(d.Fragment,{children:[t&&d.jsx(P.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:t}),d.jsx("pre",{style:{whiteSpace:"pre-wrap",color:"red",padding:"10px",margin:"auto"},children:n})]})}function m4({initialSelectedModels:e,onModelChange:t,resourceUri:n}){const{environmentName:r,packageName:o,versionId:i}=Mt(n),{apiClients:a}=ut.useServer(),{data:s,isLoading:l,isSuccess:u,isError:c,error:p}=Wt({queryKey:["models",r,o,i],queryFn:()=>a.models.listModels(r,o,i)}),[h,f]=q.useState(e||[]),[m,g]=q.useState(null);q.useEffect(()=>{f(e||[])},[e]);const y=C=>{const S=h.filter(k=>k!==C);f(S),t(S)},x=C=>{const S=[...h,C];f(S),t(S),g(null)};let E=[];return u&&s?.data&&(E=s.data.filter(C=>!h.includes(C.path)).map(C=>C.path)),c?d.jsx(cn,{error:p,context:`${r} > ${o} > Model Picker`}):d.jsxs(d.Fragment,{children:[d.jsxs(P.FormControl,{fullWidth:!0,children:[l&&d.jsx(P.Typography,{children:"Loading..."}),d.jsxs(P.Stack,{direction:"row",spacing:1,children:[h.map(C=>d.jsx(P.Chip,{label:C,onDelete:()=>y(C),deleteIcon:d.jsx(Ir,{}),sx:{marginBottom:"5px"}},C)),d.jsx(P.Button,{size:"small",startIcon:d.jsx(h4,{}),onClick:C=>g(C.currentTarget),disabled:l||c||E.length===0,children:"Add Model"})]})]}),d.jsxs(P.Menu,{anchorEl:m,open:!!m,onClose:()=>g(null),children:[d.jsx(P.Typography,{variant:"subtitle2",sx:{ml:1},children:"Models"}),d.jsx(P.Divider,{}),E.length===0?d.jsx(P.MenuItem,{disabled:!0,children:"No models available"}):E.map(C=>d.jsx(P.MenuItem,{onClick:()=>x(C),children:d.jsx(P.Typography,{variant:"body2",children:C})},C))]})]})}function z1(){const e=ax.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 g4({workbookPath:e,resourceUri:t}){const n=z1(),{server:r,getAccessToken:o}=ut.useServer(),{apiClients:i}=ut.useServer(),{workbookStorage:a}=Id(),{environmentName:s,packageName:l}=Mt(t),[u,c]=q.useState(void 0),[p,h]=q.useState(void 0);if(!a)throw new Error("Workbook storage be provided via WorkbookStorageProvider");const[f,m]=q.useState(),[g,y]=q.useState(),[x,E]=q.useState(),[C,S]=q.useState([]),[k,T]=q.useState(null),[O,F]=q.useState(null),B=!!k,R=()=>{T(null),F(null)},N=(G,re)=>{f&&(m(f.insertCell(re,{isMarkdown:G,value:""})),G?E(re):y(re),R(),console.log("handleAddCell",G,re))},[v,L]=q.useState(!1),I=()=>{L(!0)},A=async()=>{e&&a&&await a.deleteWorkbook(e).then(()=>{h(void 0),c(void 0)}).catch(G=>{h(`Error deleting workbook: ${G.message}`),c(void 0)}),L(!1),n(`/${s}/${l}`)},M=()=>{L(!1)},V=q.useCallback(async()=>{if(!f){console.log("No workbook data ref");return}try{m(await f.saveWorkbook()),h(void 0),c("Workbook saved")}catch(G){h(`Error saving workbook: ${G.message}`),c(void 0)}},[f]);if(q.useEffect(()=>{if(!f)return;(async()=>{const re=new Map(C.map(({modelPath:X,sourceInfos:U})=>[X,U])),_=[],ae=[];for(const X of f.getModels())re.has(X)?_.push({modelPath:X,sourceInfos:re.get(X)}):(console.log("Fetching model from Publisher",X),ae.push(i.models.getModel(s,l,X,void 0).then(U=>({modelPath:X,sourceInfos:U.data.sourceInfos.map(J=>JSON.parse(J))}))));if(ae.length>0){const X=await Promise.all(ae);S([..._,...X])}else S(_)})()},[o,f,l,s,r]),q.useEffect(()=>{e&&Xo.loadWorkbook(a,e).then(G=>{m(G)})},[e,a]),!f)return d.jsx("div",{children:"Loading..."});const W=G=>{const re=[];for(const _ of G)for(const ae of _.sourceInfos)re.push({modelPath:_.modelPath,sourceInfo:ae});return re},H=(G,re)=>d.jsx(P.Button,{size:"small",startIcon:d.jsx(Kc,{}),onClick:()=>N(G,re),variant:"contained",sx:{backgroundColor:"#fff",color:_=>_.palette.mode==="dark"?_.palette.grey[100]:_.palette.grey[700],boxShadow:"none","&:hover":{backgroundColor:_=>_.palette.mode==="dark"?_.palette.grey[500]:_.palette.grey[300],boxShadow:"none"}},children:G?"Markdown":"Explore"}),w=d.jsxs(P.Box,{sx:{display:"flex",gap:1,justifyContent:"center",flex:2},children:[H(!1,f.getCells().length),H(!0,f.getCells().length)]});return d.jsxs(Us,{variant:"outlined",children:[d.jsxs(p0,{children:[d.jsx(P.Box,{sx:{mb:2},children:d.jsx(P.Box,{sx:{minHeight:"24px"},children:p?d.jsx(P.Typography,{color:"error",variant:"body2",children:p}):u?d.jsx(P.Typography,{color:"success",variant:"body2",children:u}):d.jsx("span",{children:" "})})}),d.jsxs(Bo,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[d.jsxs(Bo,{direction:"row",spacing:1,alignItems:"center",children:[d.jsx(P.Typography,{variant:"overline",sx:{fontSize:"13px",fontWeight:"bold",verticalAlign:"middle"},children:"Workbook"}),d.jsx(P.Typography,{variant:"subtitle2",sx:{fontSize:"13px",fontWeight:"normal",verticalAlign:"middle",ml:1},children:`${e.workspace} > ${e.path}`})]}),d.jsxs(Bo,{sx:{display:"flex",flexDirection:"row",gap:1},children:[d.jsx(P.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:d.jsx(b4,{workbookData:f})}),d.jsxs(P.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:[d.jsx(P.Button,{color:"error",onClick:I,size:"small",children:"Delete"}),d.jsxs(P.Dialog,{open:v,onClose:M,children:[d.jsx(P.DialogTitle,{children:"Delete Workbook"}),d.jsx(P.DialogContent,{children:d.jsxs(P.DialogContentText,{children:['Are you sure you want to delete the workbook "',e.path,'"? This action cannot be undone.']})}),d.jsxs(P.DialogActions,{children:[d.jsx(P.Button,{onClick:M,color:"primary",size:"small",children:"Cancel"}),d.jsx(P.Button,{onClick:A,color:"error",autoFocus:!0,size:"small",children:"Delete"})]})]})]})]})]}),d.jsx(P.Divider,{}),d.jsxs(Bo,{sx:{display:"flex",flexDirection:"row",width:"100%",mt:2},children:[d.jsx(P.Box,{sx:{flex:1},children:d.jsx(m4,{initialSelectedModels:f.getModels(),onModelChange:G=>{m(f.setModels(G)),V()},resourceUri:t})}),d.jsx(P.Box,{sx:{flex:1}})]})]}),d.jsx(Gc,{children:d.jsxs(Bo,{children:[f.getCells().length===0&&d.jsxs(d.Fragment,{children:[d.jsx(P.Typography,{sx:{textAlign:"center",p:2,variant:"subtitle2",fontWeight:"medium"},children:"Workbook is empty"}),d.jsx(P.Typography,{variant:"body2",sx:{textAlign:"center",mb:2,variant:"body2"},children:"Click the + buttons to add a markdown or code cell."})]}),f.getCells().map((G,re)=>d.jsx(q.Fragment,{children:d.jsx(p4,{cell:G,resourceUri:t,addButtonCallback:_=>H(_,re),sourceAndPaths:W(C),editingMarkdown:x===re,editingMalloy:g===re,onDelete:()=>{m(f.deleteCell(re)),V()},onCellChange:_=>{m(f.setCell(re,_))},onEdit:()=>{G.isMarkdown?E(re):y(re)},onClose:()=>{G.isMarkdown?E(void 0):y(void 0),V()}},`${re}-${G.isMarkdown}-${e.workspace}-${e.path}`)},`${re}-${f.getCells().length}`)),w,d.jsxs(P.Menu,{anchorEl:k,open:B,onClose:R,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[d.jsx(P.MenuItem,{onClick:()=>N(!0,O??0),children:"Add Markdown"}),d.jsx(P.MenuItem,{onClick:()=>N(!1,O??0),children:"Add Malloy"})]}),d.jsx(Bo,{sx:{flexDirection:"row",justifyContent:"flex-end",p:1}})]})})]})}function b4({workbookData:e}){const[t,n]=q.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 d.jsx(P.Button,{color:"primary",onClick:r,size:"small",children:t?"Copied!":"Export"})}function V1({onWorkbookClick:e}){const{workbookStorage:t}=Id(),[n,r]=q.useState([]),[o,i]=q.useState(void 0);return q.useEffect(()=>{t&&t.listWorkspaces(!1).then(a=>{const s=[];Promise.all(a.map(async l=>{await t.listWorkbooks(l).then(u=>{s.push(...u)}).catch(u=>{i(`Error listing workbooks: ${u.message}`)})})).then(()=>{r(s),i(void 0)})})},[t]),d.jsxs(d.Fragment,{children:[o&&d.jsx(P.Box,{sx:{mb:2},children:d.jsx(P.Typography,{color:"error",variant:"body2",children:o})}),d.jsx(P.Divider,{}),d.jsx(P.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:d.jsxs(P.List,{dense:!0,children:[n.length===0&&d.jsx(P.ListItem,{children:d.jsx(P.ListItemText,{primary:"No workbooks found.",sx:{textAlign:"center"}})}),n.map(a=>d.jsx(P.ListItem,{onClick:s=>e(a,s),sx:{cursor:"pointer","&:hover":{backgroundColor:"action.hover"}},children:d.jsx(P.ListItemText,{primary:a.path})},a.path))]})})]})}const Th="Local";class y4{async listWorkspaces(t){return Promise.resolve([{name:Th,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:Th})}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 x4({onWorkbookSelect:e}){const{workbookStorage:t}=Id(),[n,r]=q.useState(""),[o,i]=q.useState(""),[a,s]=q.useState([]),[l,u]=q.useState(null),[c,p]=q.useState(!1),[h,f]=q.useState(!1),m=!!l,g=T=>{u(T.currentTarget)},y=()=>{u(null)},x=()=>{f(!1)},E=()=>{p(!1),r(""),i("")};q.useEffect(()=>{t&&(console.log("fetching workspaces"),t.listWorkspaces(!0).then(T=>{s(T),T.length===1&&i(T[0].name)}).catch(T=>{console.error("Error fetching workspaces:",T),s([])}))},[t]);const C=(T,O)=>{f(!1),e(T,O)},S=T=>{p(!1),e({path:n,workspace:o},T),r(""),i("")},k=a.length===0;return d.jsxs(d.Fragment,{children:[d.jsx(P.Button,{"aria-controls":m?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:g,variant:"contained",sx:{height:"40px",px:2,backgroundColor:"#fbbb04","&:hover":{backgroundColor:"#eab308"}},children:"Analyze Package"}),d.jsxs(P.Menu,{id:"basic-menu",anchorEl:l,open:m,onClose:y,MenuListProps:{"aria-labelledby":"basic-button",sx:{py:.5}},children:[d.jsxs(P.MenuItem,{onClick:()=>{p(!0),y()},sx:{py:1,px:2},disabled:k,children:[d.jsx(P.ListItemIcon,{children:d.jsx(bn.Add,{fontSize:"small"})}),d.jsxs(P.ListItemText,{children:[d.jsx(P.Typography,{variant:"body2",fontWeight:500,children:"New Workbook"}),k?d.jsx(P.Typography,{variant:"caption",color:"text.secondary",children:"No workspaces available"}):d.jsx(P.Typography,{variant:"caption",color:"text.secondary",children:"Create a new analysis workbook"})]})]}),d.jsxs(P.MenuItem,{onClick:()=>{f(!0),y()},sx:{py:1,px:2},children:[d.jsx(P.ListItemIcon,{children:d.jsx(bn.Launch,{fontSize:"small"})}),d.jsxs(P.ListItemText,{children:[d.jsx(P.Typography,{variant:"body2",fontWeight:500,children:"Open Workbook"}),d.jsx(P.Typography,{variant:"caption",color:"text.secondary",children:"Open an existing workbook"})]})]})]}),d.jsxs(P.Dialog,{open:c,onClose:E,maxWidth:"sm",fullWidth:!0,children:[d.jsxs(P.DialogTitle,{sx:{pb:1,pt:2,px:2},children:[d.jsx(P.Typography,{fontWeight:600,sx:{fontSize:"1.5rem",mb:.5},children:"Create New Workbook"}),d.jsx(P.Typography,{variant:"body2",color:"text.secondary",children:"Start a new analysis workbook to explore your data"})]}),d.jsx(P.DialogContent,{sx:{px:2,pb:2},children:d.jsxs(P.Stack,{spacing:2,sx:{mt:1},children:[a.length>1?d.jsxs(P.FormControl,{fullWidth:!0,size:"small",children:[d.jsx(P.InputLabel,{children:"Workspace"}),d.jsx(P.Select,{value:o,label:"Workspace",onChange:T=>i(T.target.value),children:a.map(T=>d.jsx(P.MenuItem,{value:T.name,children:d.jsxs(P.Box,{children:[d.jsx(P.Typography,{variant:"body2",fontWeight:500,children:T.name}),d.jsx(P.Typography,{variant:"caption",color:"text.secondary",children:T.description})]})},T.name))})]}):a.length===1?d.jsxs(P.Box,{sx:{p:2,border:1,borderColor:"divider",borderRadius:1,backgroundColor:"grey.50"},children:[d.jsxs(P.Typography,{variant:"body2",fontWeight:500,gutterBottom:!0,children:["Workspace: ",a[0].name]}),d.jsx(P.Typography,{variant:"caption",color:"text.secondary",children:a[0].description})]}):null,d.jsx(P.FormControl,{fullWidth:!0,children:d.jsx(P.TextField,{label:"Workbook Name",value:n,onChange:T=>r(T.target.value),placeholder:"Enter workbook name...",fullWidth:!0,autoFocus:!0,size:"small"})}),d.jsxs(P.Stack,{direction:"row",spacing:1,justifyContent:"flex-end",children:[d.jsx(P.Button,{onClick:E,variant:"outlined",size:"small",children:"Cancel"}),d.jsx(P.Button,{onClick:T=>S(T),variant:"contained",disabled:!n.trim()||a.length>1&&!o,size:"small",children:"Create Workbook"})]})]})})]}),d.jsxs(P.Dialog,{open:h,onClose:x,maxWidth:"md",fullWidth:!0,children:[d.jsxs(P.DialogTitle,{sx:{pb:1,pt:2,px:2},children:[d.jsx(P.Typography,{fontWeight:600,sx:{mb:.5,fontSize:"1.5rem"},children:"Open Workbook"}),d.jsx(P.Typography,{variant:"body2",color:"text.secondary",children:"Select an existing workbook to continue your analysis"})]}),d.jsx(P.DialogContent,{sx:{px:2,pb:2},children:d.jsx(V1,{onWorkbookClick:C})})]})]})}function E4({resourceUri:e}){const{environmentName:t}=Mt(e),{apiClients:n}=ut.useServer(),[r,o]=q.useState(!1),i=90,{data:a,isSuccess:s,isError:l,error:u}=Wt({queryKey:["about",t],queryFn:()=>n.environments.getEnvironment(t,!1)}),c=a?.data?.readme||"",p=c.split(/\s+/),h=p.length>i,f=p.slice(0,i).join(" ");return d.jsxs(d.Fragment,{children:[!s&&!l&&d.jsx(un,{text:"Fetching About..."}),s&&c&&d.jsx(h0,{children:d.jsxs(m0,{children:[d.jsx(g0,{children:"Readme"}),d.jsxs(P.Box,{sx:{mt:1,fontSize:"0.875rem",lineHeight:1.6},children:[d.jsx(_s,{options:{overrides:{h1:{component:"p",props:{style:{fontSize:"inherit",fontWeight:"italic"}}},h2:{component:"p",props:{style:{fontSize:"inherit",fontWeight:"italic"}}},h3:{component:"p",props:{style:{fontSize:"inherit",fontWeight:"italic"}}}}},children:r||!h?c:f}),h&&d.jsxs(P.Box,{sx:{mt:1},children:[" ",d.jsx(P.Button,{variant:"text",size:"small",onClick:()=>o(!r),children:r?"Read less":"Read more"})]})]})]})}),l&&d.jsx(cn,{error:u,context:`${t} > About`})]})}function C4({resourceUri:e}){const[t,n]=q.useState(!1),{apiClients:r}=ut.useServer(),o=Rr.useQueryClient(),[i,a]=q.useState(""),{environmentName:s}=Mt(e),l=ur({async mutationFn(c){return r.packages.createPackage(s,{name:c.name,description:c.description,location:c.location})},onSuccess(){n(!1),a("Package created successfully"),o.invalidateQueries({queryKey:["packages",s]})},onError(c){a(c instanceof Error?c.message:"An unknown error occurred")}}),u=c=>{c.preventDefault();const p=new FormData(c.currentTarget),h=p.get("name")?.toString(),f=p.get("description")?.toString(),m=p.get("location")?.toString();l.mutate({name:h,description:f,location:m})};return d.jsxs(d.Fragment,{children:[d.jsx(P.Button,{onClick:()=>n(!0),variant:"contained",color:"primary",startIcon:d.jsx(bn.Add,{}),children:"Add Package"}),d.jsxs(P.Dialog,{open:t,onClose:()=>n(!1),maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:2}},children:[d.jsx(P.DialogTitle,{sx:{fontSize:"1.25rem",fontWeight:600,letterSpacing:"-0.025em",pt:3,pb:1,px:3},children:"Create New Package"}),d.jsxs(P.DialogContent,{sx:{px:3,pb:0},children:[d.jsxs(P.Box,{sx:{mb:3},children:[d.jsx(P.Typography,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:"Create a new Malloy package to start exploring your data."}),d.jsx(P.Typography,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:"The location can be a GitHub/S3/GCP URL containing a package (zipped or unzipped), or an absolute path to a directory the publisher server has access to."}),d.jsxs(P.Typography,{variant:"body2",color:"text.secondary",children:["Make sure to conform to the"," ",d.jsx(P.Box,{component:"a",href:"https://github.com/malloydata/publisher/blob/main/README.md#architecture-overview",target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary",textDecoration:"underline"},children:"Malloy Package Format"}),"."]})]}),d.jsx("form",{onSubmit:u,id:"package-form",children:d.jsxs(P.Stack,{spacing:2.5,children:[d.jsx(P.TextField,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Package Name",type:"text",fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:{shrink:!0}}),d.jsx(P.TextField,{id:"description",name:"description",label:"Description",multiline:!0,rows:3,fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:{shrink:!0}}),d.jsx(P.TextField,{id:"location",name:"location",label:"Location",type:"text",placeholder:"e.g. s3://my-bucket/my-package.zip",fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:{shrink:!0}})]})})]}),d.jsxs(P.DialogActions,{sx:{px:3,pt:2,pb:3,gap:1},children:[d.jsx(P.Button,{variant:"outlined",disabled:l.isPending,onClick:()=>n(!1),children:"Cancel"}),d.jsx(P.Button,{type:"submit",form:"package-form",variant:"contained",loading:l.isPending,children:"Save Changes"})]})]}),d.jsx(P.Snackbar,{open:i!=="",autoHideDuration:6e3,onClose:()=>a(""),message:i})]})}const T4=lt(d.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),W1=lt(d.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}));function q1(e){const{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:ya(t.components[n].defaultProps,r)}function v4({props:e,name:t,defaultTheme:n,themeId:r}){let o=H2(n);return o=o[r]||o,q1({theme:o,name:t,props:e})}function kt({props:e,name:t}){return v4({props:e,name:t,defaultTheme:El,themeId:hi})}const S4=Me("MuiBox",["root"]),k4=s0(),It=dt.createBox({themeId:hi,defaultTheme:k4,defaultClassName:S4.root,generateClassName:qm.generate}),Y1=de.oneOfType([de.func,de.object]);function vh(e){try{return e.matches(":focus-visible")}catch{}return!1}const Sh={};function K1(e,t){const n=D.useRef(Sh);return n.current===Sh&&(n.current=e(t)),n}class Js{static create(){return new Js}static use(){const t=K1(Js.create).current,[n,r]=D.useState(!1);return t.shouldMount=n,t.setShouldMount=r,D.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=w4(),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 D4(){return Js.use()}function w4(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n}function Dc(e,t){return Dc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Dc(e,t)}function Ad(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Dc(e,t)}function I4(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function A4(e,t){e.classList?e.classList.add(t):I4(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function kh(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function P4(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=kh(e.className,t):e.setAttribute("class",kh(e.className&&e.className.baseVal||"",t))}const Dh={disabled:!1},el=q.createContext(null);var G1=function(t){return t.scrollTop},Ji="unmounted",so="exited",lo="entering",Wo="entered",wc="exiting",Wn=(function(e){Ad(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var a=o,s=a&&!a.isMounting?r.enter:r.appear,l;return i.appearStatus=null,r.in?s?(l=so,i.appearStatus=lo):l=Wo:r.unmountOnExit||r.mountOnEnter?l=Ji:l=so,i.state={status:l},i.nextCallback=null,i}t.getDerivedStateFromProps=function(o,i){var a=o.in;return a&&i.status===Ji?{status:so}: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 a=this.state.status;this.props.in?a!==lo&&a!==Wo&&(i=lo):(a===lo||a===Wo)&&(i=wc)}this.updateStatus(!1,i)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,i,a,s;return i=a=s=o,o!=null&&typeof o!="number"&&(i=o.exit,a=o.enter,s=o.appear!==void 0?o.appear:a),{exit:i,enter:a,appear:s}},n.updateStatus=function(o,i){if(o===void 0&&(o=!1),i!==null)if(this.cancelNextCallback(),i===lo){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:Gi.findDOMNode(this);a&&G1(a)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===so&&this.setState({status:Ji})},n.performEnter=function(o){var i=this,a=this.props.enter,s=this.context?this.context.isMounting:o,l=this.props.nodeRef?[s]:[Gi.findDOMNode(this),s],u=l[0],c=l[1],p=this.getTimeouts(),h=s?p.appear:p.enter;if(!o&&!a||Dh.disabled){this.safeSetState({status:Wo},function(){i.props.onEntered(u)});return}this.props.onEnter(u,c),this.safeSetState({status:lo},function(){i.props.onEntering(u,c),i.onTransitionEnd(h,function(){i.safeSetState({status:Wo},function(){i.props.onEntered(u,c)})})})},n.performExit=function(){var o=this,i=this.props.exit,a=this.getTimeouts(),s=this.props.nodeRef?void 0:Gi.findDOMNode(this);if(!i||Dh.disabled){this.safeSetState({status:so},function(){o.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:wc},function(){o.props.onExiting(s),o.onTransitionEnd(a.exit,function(){o.safeSetState({status:so},function(){o.props.onExited(s)})})})},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,a=!0;return this.nextCallback=function(s){a&&(a=!1,i.nextCallback=null,o(s))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},n.onTransitionEnd=function(o,i){this.setNextCallback(i);var a=this.props.nodeRef?this.props.nodeRef.current:Gi.findDOMNode(this),s=o==null&&!this.props.addEndListener;if(!a||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],u=l[0],c=l[1];this.props.addEndListener(u,c)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===Ji)return null;var i=this.props,a=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 s=$e(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return q.createElement(el.Provider,{value:null},typeof a=="function"?a(o,s):q.cloneElement(q.Children.only(a),s))},t})(q.Component);Wn.contextType=el;Wn.propTypes={};function Uo(){}Wn.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Uo,onEntering:Uo,onEntered:Uo,onExit:Uo,onExiting:Uo,onExited:Uo};Wn.UNMOUNTED=Ji;Wn.EXITED=so;Wn.ENTERING=lo;Wn.ENTERED=Wo;Wn.EXITING=wc;var R4=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return A4(t,r)})},_u=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return P4(t,r)})},Pd=(function(e){Ad(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(s,l){var u=r.resolveArguments(s,l),c=u[0],p=u[1];r.removeClasses(c,"exit"),r.addClass(c,p?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(s,l)},r.onEntering=function(s,l){var u=r.resolveArguments(s,l),c=u[0],p=u[1],h=p?"appear":"enter";r.addClass(c,h,"active"),r.props.onEntering&&r.props.onEntering(s,l)},r.onEntered=function(s,l){var u=r.resolveArguments(s,l),c=u[0],p=u[1],h=p?"appear":"enter";r.removeClasses(c,h),r.addClass(c,h,"done"),r.props.onEntered&&r.props.onEntered(s,l)},r.onExit=function(s){var l=r.resolveArguments(s),u=l[0];r.removeClasses(u,"appear"),r.removeClasses(u,"enter"),r.addClass(u,"exit","base"),r.props.onExit&&r.props.onExit(s)},r.onExiting=function(s){var l=r.resolveArguments(s),u=l[0];r.addClass(u,"exit","active"),r.props.onExiting&&r.props.onExiting(s)},r.onExited=function(s){var l=r.resolveArguments(s),u=l[0];r.removeClasses(u,"exit"),r.addClass(u,"exit","done"),r.props.onExited&&r.props.onExited(s)},r.resolveArguments=function(s,l){return r.props.nodeRef?[r.props.nodeRef.current,s]:[s,l]},r.getClassNames=function(s){var l=r.props.classNames,u=typeof l=="string",c=u&&l?l+"-":"",p=u?""+c+s:l[s],h=u?p+"-active":l[s+"Active"],f=u?p+"-done":l[s+"Done"];return{baseClassName:p,activeClassName:h,doneClassName:f}},r}var n=t.prototype;return n.addClass=function(o,i,a){var s=this.getClassNames(i)[a+"ClassName"],l=this.getClassNames("enter"),u=l.doneClassName;i==="appear"&&a==="done"&&u&&(s+=" "+u),a==="active"&&o&&G1(o),s&&(this.appliedClasses[i][a]=s,R4(o,s))},n.removeClasses=function(o,i){var a=this.appliedClasses[i],s=a.base,l=a.active,u=a.done;this.appliedClasses[i]={},s&&_u(o,s),l&&_u(o,l),u&&_u(o,u)},n.render=function(){var o=this.props;o.classNames;var i=$e(o,["classNames"]);return q.createElement(Wn,$({},i,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t})(q.Component);Pd.defaultProps={classNames:""};Pd.propTypes={};function M4(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rd(e,t){var n=function(i){return t&&q.isValidElement(i)?t(i):i},r=Object.create(null);return e&&q.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function O4(e,t){e=e||{},t=t||{};function n(c){return c in t?t[c]:e[c]}var r=Object.create(null),o=[];for(var i in e)i in t?o.length&&(r[i]=o,o=[]):o.push(i);var a,s={};for(var l in t){if(r[l])for(a=0;a<r[l].length;a++){var u=r[l][a];s[r[l][a]]=n(u)}s[l]=n(l)}for(a=0;a<o.length;a++)s[o[a]]=n(o[a]);return s}function po(e,t,n){return n[t]!=null?n[t]:e.props[t]}function L4(e,t){return Rd(e.children,function(n){return q.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:po(n,"appear",e),enter:po(n,"enter",e),exit:po(n,"exit",e)})})}function N4(e,t,n){var r=Rd(e.children),o=O4(t,r);return Object.keys(o).forEach(function(i){var a=o[i];if(q.isValidElement(a)){var s=i in t,l=i in r,u=t[i],c=q.isValidElement(u)&&!u.props.in;l&&(!s||c)?o[i]=q.cloneElement(a,{onExited:n.bind(null,a),in:!0,exit:po(a,"exit",e),enter:po(a,"enter",e)}):!l&&s&&!c?o[i]=q.cloneElement(a,{in:!1}):l&&s&&q.isValidElement(u)&&(o[i]=q.cloneElement(a,{onExited:n.bind(null,a),in:u.props.in,exit:po(a,"exit",e),enter:po(a,"enter",e)}))}}),o}var F4=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},_4={component:"div",childFactory:function(t){return t}},za=(function(e){Ad(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var a=i.handleExited.bind(M4(i));return i.state={contextValue:{isMounting:!0},handleExited:a,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 a=i.children,s=i.handleExited,l=i.firstRender;return{children:l?L4(o,s):N4(o,a,s),firstRender:!1}},n.handleExited=function(o,i){var a=Rd(this.props.children);o.key in a||(o.props.onExited&&o.props.onExited(i),this.mounted&&this.setState(function(s){var l=$({},s.children);return delete l[o.key],{children:l}}))},n.render=function(){var o=this.props,i=o.component,a=o.childFactory,s=$e(o,["component","childFactory"]),l=this.state.contextValue,u=F4(this.state.children).map(a);return delete s.appear,delete s.enter,delete s.exit,i===null?q.createElement(el.Provider,{value:l},u):q.createElement(el.Provider,{value:l},q.createElement(i,s,u))},t})(q.Component);za.propTypes={};za.defaultProps=_4;const B4=[];function j4(e){D.useEffect(e,B4)}class Md{static create(){return new Md}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 Nl(){const e=K1(Md.create).current;return j4(e.disposeEffect),e}function $4(e){const{className:t,classes:n,pulsate:r=!1,rippleX:o,rippleY:i,rippleSize:a,in:s,onExited:l,timeout:u}=e,[c,p]=D.useState(!1),h=Ae(t,n.ripple,n.rippleVisible,r&&n.ripplePulsate),f={width:a,height:a,top:-(a/2)+i,left:-(a/2)+o},m=Ae(n.child,c&&n.childLeaving,r&&n.childPulsate);return!s&&!c&&p(!0),D.useEffect(()=>{if(!s&&l!=null){const g=setTimeout(l,u);return()=>{clearTimeout(g)}}},[l,s,u]),d.jsx("span",{className:h,style:f,children:d.jsx("span",{className:m})})}const Mn=Me("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),Ic=550,H4=80,U4=dt.keyframes`
|
|
92
|
+
`).length,length:be.target.value.length}))}};return d.jsx(Ti.Provider,{value:$({},H,{dispatch:w}),children:d.jsxs("div",$({ref:G,className:ae},M,{onClick:te,style:ee,children:[d.jsx(Ch,{hideToolbar:v,toolbarBottom:L,prefixCls:r,overflow:y,placement:"top"}),d.jsxs("div",{className:r+"-content",children:[/(edit|live)/.test(H.preview||"")&&d.jsx(J5,$({className:r+"-input",prefixCls:r,autoFocus:k},E,{onChange:pe,renderTextarea:I?.textarea||A,onScroll:be=>Q(be,"text")})),/(live|preview)/.test(H.preview||"")&&Y]}),h&&!H.fullscreen&&d.jsx(t4,{prefixCls:r,height:H.height,maxHeight:C,minHeight:S,onChange:xe}),d.jsx(Ch,{hideToolbar:v,toolbarBottom:L,prefixCls:r,overflow:y,placement:"bottom"})]}))})}),$1=o4;$1.Markdown=M1;const Nu={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"}]}}},i4={...Nu,patterns:[...Nu.patterns,{include:"#docvar"}],repository:{...Nu.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},a4={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"}]}}},s4="github-light";let Fu;function l4(){return Fu||(Fu=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:i}]=await Promise.all([Promise.resolve().then(()=>require("./core-GinK_1j5.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"))]);return e({engine:t(Promise.resolve().then(()=>require("./wasm-Dw4u1m6u.cjs.js"))),themes:[i],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...i4},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...a4}]})})()),Fu}async function Zs(e,t){return(await l4()).codeToHtml(e,{lang:t,theme:s4})}function Wt(e){const{server:t}=ut.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 Rr.useQuery(n,ut.globalQueryClient)}function ur(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 Rr.useMutation(t,ut.globalQueryClient)}const Mt=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},Ua=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 wd({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:i}){return q.useEffect(()=>{o&&o(t)},[t,o]),d.jsx(Gc,{children:d.jsxs(dt.Stack,{spacing:2,component:"section",children:[d.jsx(H1,{sourceAndPath:e[t],existingQuery:n,onChange:a=>{r&&r(a)},resourceUri:i}),d.jsx(dt.Box,{height:"5px"})]})})}function Ss(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function u4({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:i}){const[a,s]=q.useState(n||Ss()),[l,u]=q.useState(void 0);q.useEffect(()=>{n&&s(n)},[n]);const[c,p]=q.useState([]),{MalloyExplorerProvider:h,QueryPanel:f,ResizableCollapsiblePanel:m,ResultPanel:g,SourcePanel:y}=r;q.useEffect(()=>{t&&t(a)},[t,a]);const{environmentName:x,packageName:E,versionId:C}=Mt(i),{apiClients:S}=ut.useServer(),k=ur({mutationFn:()=>{const B=typeof a?.malloyQuery=="string"?a.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:a?.malloyQuery}).toMalloy();return u({executionState:"running",query:a?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{k.reset(),u(void 0)},response:{result:{}}}),s({...a,query:B}),S.models.executeQueryModel(x,E,e.modelPath,{query:B,sourceName:void 0,queryName:void 0,versionId:C})},onSuccess:B=>{if(B){const R=JSON.parse(B.data.result);s({...a,malloyResult:R}),u(N=>N?{...N,executionState:"finished",response:{result:R}}:void 0)}},onError:B=>{u(void 0),console.error("Query execution error:",B)}}),[T,O]=q.useState(e.sourceInfo.name);q.useEffect(()=>{T!==e.sourceInfo.name&&(O(e.sourceInfo.name),s(Ss()),u(void 0))},[e,T]);const F=q.useCallback(B=>{s({...a,malloyQuery:B,malloyResult:void 0})},[a]);return T!==e.sourceInfo.name?d.jsx("div",{children:"Loading..."}):d.jsx(f0,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:d.jsx(h,{source:e.sourceInfo,query:a?.malloyQuery,topValues:[],onFocusedNestViewPathChange:p,focusedNestViewPath:c,onQueryChange:F,children:d.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[d.jsx(m,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:d.jsx(y,{onRefresh:()=>s(Ss())})}),d.jsx(m,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:d.jsx(f,{runQuery:()=>{console.log(`running query with: ${a?.malloyQuery}`);try{k.mutate()}catch(B){console.error("Error running query:",B)}}})}),d.jsx(g,{source:e.sourceInfo,draftQuery:a?.malloyQuery,setDraftQuery:B=>s({...a,malloyQuery:B}),submittedQuery:l,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function H1(e){const[t,n]=q.useState(null),[r,o]=q.useState(null),[i,a]=q.useState(!0);return q.useEffect(()=>{let s=!0;return Promise.all([import("@malloydata/malloy-explorer"),import("@malloydata/malloy-query-builder")]).then(([l,u])=>{s&&(n(l),o(u),a(!1))}).catch(l=>{console.error("Failed to load Malloy components:",l),s&&a(!1)}),()=>{s=!1}},[]),i||!t||!r?d.jsx(FE,{children:d.jsx(f0,{children:d.jsx(dt.Box,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):d.jsx(u4,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function un({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:i=2,textVariant:a="body2"}){const s=d.jsxs(P.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:i},children:[d.jsx(P.CircularProgress,{size:t,color:n,thickness:r}),e&&d.jsx(P.Typography,{variant:a,color:"text.secondary",children:e})]});return o?d.jsx(P.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:s}):s}const c4=q.lazy(()=>Promise.resolve().then(()=>Vj));function Si({result:e,maxHeight:t,maxResultSize:n=0}){const r=q.useRef(null),[o,i]=q.useState(t),[a,s]=q.useState(!1);if(!e)return null;if(n>0&&e.length>n&&!a)return d.jsxs(P.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[d.jsx(bn.Warning,{sx:{fontSize:48,color:"#757575"}}),d.jsx(P.Typography,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),d.jsx(P.Button,{variant:"contained",color:"primary",onClick:()=>s(!0),children:"Proceed"})]});const u=d.jsx(un,{text:"Loading...",centered:!0,size:32}),c=Math.min(t,o);return d.jsx(P.Box,{ref:r,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden"},children:e&&d.jsx(q.Suspense,{fallback:u,children:d.jsx(c4,{result:e,height:c,onSizeChange:i})})})}function d4({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},a=t.findIndex(s=>s.sourceInfo.name===e.sourceName);return d.jsx(wd,{resourceUri:n,sourceAndPaths:t,selectedSourceIndex:a>=0?a:0,existingQuery:i,onQueryChange:r,onSourceChange:o})}function p4({cell:e,editingMalloy:t,editingMarkdown:n,sourceAndPaths:r,resourceUri:o,onCellChange:i,onClose:a,onEdit:s,onDelete:l,addButtonCallback:u}){const[c,p]=q.useState(e.value),[h,f]=q.useState(!1),[m,g]=q.useState(!1),[y,x]=q.useState(),[E]=q.useState(),[C,S]=q.useState(Ss()),[k,T]=q.useState(!1),[O,F]=q.useState(e.sourceName?r.findIndex(G=>G.sourceInfo.name===e.sourceName):0);q.useEffect(()=>{e.isMarkdown||Zs(e.value,"malloy").then(G=>{x(G)})},[e]),q.useEffect(()=>{document.documentElement.setAttribute("data-color-mode","light")});const[B,R]=q.useState(!1),N=()=>{l(),R(!1)},v=r.length===0,L=q.useCallback(()=>{const G=r[O],re=G?.modelPath||e.modelPath||"",_=G?.sourceInfo.name||e.sourceName||"";i({...e,value:e.isMarkdown?c:C.query,result:C.malloyResult?JSON.stringify(C.malloyResult):void 0,queryInfo:C.malloyQuery?JSON.stringify(C.malloyQuery):void 0,sourceName:_,modelPath:re})},[e,c,C,i,O,r]),I=d.jsx(P.Tooltip,{title:"Delete Cell",children:d.jsx(P.IconButton,{size:"small",onClick:()=>R(!0),children:d.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d.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"})})})}),A=d.jsxs(P.Dialog,{open:B,onClose:()=>R(!1),children:[d.jsx(P.DialogTitle,{children:"Confirm Delete"}),d.jsx(P.DialogContent,{children:d.jsx(P.Typography,{children:"Are you sure you want to delete this cell?"})}),d.jsxs(P.DialogActions,{children:[d.jsx(P.Button,{onClick:()=>R(!1),children:"Cancel"}),d.jsx(P.Button,{onClick:N,color:"error",children:"Delete"})]})]}),M=()=>{L(),a()},V=e.isMarkdown?d.jsxs(d.Fragment,{children:[n?d.jsx(P.Tooltip,{title:"Save",children:d.jsx(P.IconButton,{size:"small",onClick:M,children:d.jsx(Ja,{})})}):d.jsx(P.Tooltip,{title:"Edit",children:d.jsx(P.IconButton,{size:"small",onClick:s,children:d.jsx(zp,{})})}),!n&&I]}):d.jsxs(d.Fragment,{children:[!t&&d.jsx(P.Tooltip,{title:h?"Hide Code":"View Code",children:d.jsx(P.IconButton,{size:"small",onClick:()=>{f(!h)},children:d.jsx(b0,{})})}),!t&&e.result&&d.jsx(P.Tooltip,{title:m?"Hide Embedding":"View Embedding",children:d.jsx(P.IconButton,{size:"small",onClick:()=>{g(!m)},children:d.jsx(Qc,{})})}),t&&d.jsx(P.Tooltip,{title:"Save",children:d.jsx(P.IconButton,{size:"small",onClick:M,children:d.jsx(Ja,{})})}),!t&&d.jsx(P.Tooltip,{title:"Edit",children:d.jsx(P.IconButton,{size:"small",onClick:s,children:d.jsx(zp,{})})}),!t&&I]}),W=t||n,H=n?d.jsx(P.Tooltip,{title:"Save",children:d.jsx(P.IconButton,{size:"small",onClick:M,children:d.jsx(Ja,{})})}):t?d.jsx(P.Tooltip,{title:"Save",children:d.jsx(P.IconButton,{size:"small",onClick:M,children:d.jsx(Ja,{})})}):null,w=k&&d.jsx(P.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:!W&&d.jsxs(d.Fragment,{children:[u(!0),u(!1),V]})||H});return d.jsxs(Us,{sx:{position:"relative",marginTop:"5px",marginBottom:"5px",borderWidth:"1.5px",backgroundColor:"#fff",minHeight:"50px"},onMouseEnter:()=>T(!0),onMouseLeave:()=>{T(!1)},children:[w,e.isMarkdown?d.jsx(d.Fragment,{children:n?d.jsx($1,{value:c,preview:"edit",autoFocus:!0,onChange:G=>{p(G),i({...e,value:G})},onBlur:()=>{L(),k||M()}}):d.jsx(P.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?d.jsx(P.Box,{onClick:s,sx:{cursor:"pointer"},children:d.jsx(_s,{children:e.value})}):d.jsxs(P.Box,{onClick:s,sx:{cursor:"pointer"},children:[d.jsx(P.Typography,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Markdown is empty"}),d.jsx(P.Typography,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})})}):d.jsxs(d.Fragment,{children:[d.jsx(P.Collapse,{in:m,timeout:"auto",unmountOnExit:!0,children:d.jsx(P.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:d.jsx(P.Typography,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:E}})})}),d.jsx(P.Collapse,{in:h,timeout:"auto",unmountOnExit:!0,children:d.jsx(P.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:d.jsx(P.Typography,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:y}})})}),t&&(v?d.jsxs(d.Fragment,{children:[d.jsx(P.Typography,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"No Model Imports"}),d.jsx(P.Typography,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Please add a model import above."})]}):d.jsx(d4,{sourceAndPaths:r,resourceUri:o,onQueryChange:G=>{S(G)},onSourceChange:G=>{F(G)},cell:e})),!t&&e.result&&d.jsx(Us,{variant:"outlined",sx:{borderRadius:0},children:d.jsx(Si,{result:e.result,maxHeight:800})}),!t&&!e.result&&d.jsxs(P.Box,{onClick:s,sx:{cursor:"pointer"},children:[d.jsx(P.Typography,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Explore is empty"}),d.jsx(P.Typography,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})]}),B&&A]})}const U1=q.createContext(void 0);function f4({children:e,workbookStorage:t}){const n=q.useMemo(()=>({workbookStorage:t}),[t]);return d.jsx(U1.Provider,{value:n,children:e})}function Id(){const e=q.useContext(U1);if(!e)throw new Error("useWorkbookStorage must be used within a WorkbookStorageProvider");return e}const Ir=lt(d.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"})),h4=lt(d.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 cn({error:e,context:t}){const n=e.data?.message||"Unknown Error";return d.jsxs(d.Fragment,{children:[t&&d.jsx(P.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:t}),d.jsx("pre",{style:{whiteSpace:"pre-wrap",color:"red",padding:"10px",margin:"auto"},children:n})]})}function m4({initialSelectedModels:e,onModelChange:t,resourceUri:n}){const{environmentName:r,packageName:o,versionId:i}=Mt(n),{apiClients:a}=ut.useServer(),{data:s,isLoading:l,isSuccess:u,isError:c,error:p}=Wt({queryKey:["models",r,o,i],queryFn:()=>a.models.listModels(r,o,i)}),[h,f]=q.useState(e||[]),[m,g]=q.useState(null);q.useEffect(()=>{f(e||[])},[e]);const y=C=>{const S=h.filter(k=>k!==C);f(S),t(S)},x=C=>{const S=[...h,C];f(S),t(S),g(null)};let E=[];return u&&s?.data&&(E=s.data.filter(C=>!h.includes(C.path)).map(C=>C.path)),c?d.jsx(cn,{error:p,context:`${r} > ${o} > Model Picker`}):d.jsxs(d.Fragment,{children:[d.jsxs(P.FormControl,{fullWidth:!0,children:[l&&d.jsx(P.Typography,{children:"Loading..."}),d.jsxs(P.Stack,{direction:"row",spacing:1,children:[h.map(C=>d.jsx(P.Chip,{label:C,onDelete:()=>y(C),deleteIcon:d.jsx(Ir,{}),sx:{marginBottom:"5px"}},C)),d.jsx(P.Button,{size:"small",startIcon:d.jsx(h4,{}),onClick:C=>g(C.currentTarget),disabled:l||c||E.length===0,children:"Add Model"})]})]}),d.jsxs(P.Menu,{anchorEl:m,open:!!m,onClose:()=>g(null),children:[d.jsx(P.Typography,{variant:"subtitle2",sx:{ml:1},children:"Models"}),d.jsx(P.Divider,{}),E.length===0?d.jsx(P.MenuItem,{disabled:!0,children:"No models available"}):E.map(C=>d.jsx(P.MenuItem,{onClick:()=>x(C),children:d.jsx(P.Typography,{variant:"body2",children:C})},C))]})]})}function z1(){const e=ax.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 g4({workbookPath:e,resourceUri:t}){const n=z1(),{server:r,getAccessToken:o}=ut.useServer(),{apiClients:i}=ut.useServer(),{workbookStorage:a}=Id(),{environmentName:s,packageName:l}=Mt(t),[u,c]=q.useState(void 0),[p,h]=q.useState(void 0);if(!a)throw new Error("Workbook storage be provided via WorkbookStorageProvider");const[f,m]=q.useState(),[g,y]=q.useState(),[x,E]=q.useState(),[C,S]=q.useState([]),[k,T]=q.useState(null),[O,F]=q.useState(null),B=!!k,R=()=>{T(null),F(null)},N=(G,re)=>{f&&(m(f.insertCell(re,{isMarkdown:G,value:""})),G?E(re):y(re),R(),console.log("handleAddCell",G,re))},[v,L]=q.useState(!1),I=()=>{L(!0)},A=async()=>{e&&a&&await a.deleteWorkbook(e).then(()=>{h(void 0),c(void 0)}).catch(G=>{h(`Error deleting workbook: ${G.message}`),c(void 0)}),L(!1),n(`/${s}/${l}`)},M=()=>{L(!1)},V=q.useCallback(async()=>{if(!f){console.log("No workbook data ref");return}try{m(await f.saveWorkbook()),h(void 0),c("Workbook saved")}catch(G){h(`Error saving workbook: ${G.message}`),c(void 0)}},[f]);if(q.useEffect(()=>{if(!f)return;(async()=>{const re=new Map(C.map(({modelPath:X,sourceInfos:U})=>[X,U])),_=[],ae=[];for(const X of f.getModels())re.has(X)?_.push({modelPath:X,sourceInfos:re.get(X)}):(console.log("Fetching model from Publisher",X),ae.push(i.models.getModel(s,l,X,void 0).then(U=>({modelPath:X,sourceInfos:U.data.sourceInfos.map(J=>JSON.parse(J))}))));if(ae.length>0){const X=await Promise.all(ae);S([..._,...X])}else S(_)})()},[o,f,l,s,r]),q.useEffect(()=>{e&&Xo.loadWorkbook(a,e).then(G=>{m(G)})},[e,a]),!f)return d.jsx("div",{children:"Loading..."});const W=G=>{const re=[];for(const _ of G)for(const ae of _.sourceInfos)re.push({modelPath:_.modelPath,sourceInfo:ae});return re},H=(G,re)=>d.jsx(P.Button,{size:"small",startIcon:d.jsx(Kc,{}),onClick:()=>N(G,re),variant:"contained",sx:{backgroundColor:"#fff",color:_=>_.palette.mode==="dark"?_.palette.grey[100]:_.palette.grey[700],boxShadow:"none","&:hover":{backgroundColor:_=>_.palette.mode==="dark"?_.palette.grey[500]:_.palette.grey[300],boxShadow:"none"}},children:G?"Markdown":"Explore"}),w=d.jsxs(P.Box,{sx:{display:"flex",gap:1,justifyContent:"center",flex:2},children:[H(!1,f.getCells().length),H(!0,f.getCells().length)]});return d.jsxs(Us,{variant:"outlined",children:[d.jsxs(p0,{children:[d.jsx(P.Box,{sx:{mb:2},children:d.jsx(P.Box,{sx:{minHeight:"24px"},children:p?d.jsx(P.Typography,{color:"error",variant:"body2",children:p}):u?d.jsx(P.Typography,{color:"success",variant:"body2",children:u}):d.jsx("span",{children:" "})})}),d.jsxs(Bo,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[d.jsxs(Bo,{direction:"row",spacing:1,alignItems:"center",children:[d.jsx(P.Typography,{variant:"overline",sx:{fontSize:"13px",fontWeight:"bold",verticalAlign:"middle"},children:"Workbook"}),d.jsx(P.Typography,{variant:"subtitle2",sx:{fontSize:"13px",fontWeight:"normal",verticalAlign:"middle",ml:1},children:`${e.workspace} > ${e.path}`})]}),d.jsxs(Bo,{sx:{display:"flex",flexDirection:"row",gap:1},children:[d.jsx(P.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:d.jsx(b4,{workbookData:f})}),d.jsxs(P.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:[d.jsx(P.Button,{color:"error",onClick:I,size:"small",children:"Delete"}),d.jsxs(P.Dialog,{open:v,onClose:M,children:[d.jsx(P.DialogTitle,{children:"Delete Workbook"}),d.jsx(P.DialogContent,{children:d.jsxs(P.DialogContentText,{children:['Are you sure you want to delete the workbook "',e.path,'"? This action cannot be undone.']})}),d.jsxs(P.DialogActions,{children:[d.jsx(P.Button,{onClick:M,color:"primary",size:"small",children:"Cancel"}),d.jsx(P.Button,{onClick:A,color:"error",autoFocus:!0,size:"small",children:"Delete"})]})]})]})]})]}),d.jsx(P.Divider,{}),d.jsxs(Bo,{sx:{display:"flex",flexDirection:"row",width:"100%",mt:2},children:[d.jsx(P.Box,{sx:{flex:1},children:d.jsx(m4,{initialSelectedModels:f.getModels(),onModelChange:G=>{m(f.setModels(G)),V()},resourceUri:t})}),d.jsx(P.Box,{sx:{flex:1}})]})]}),d.jsx(Gc,{children:d.jsxs(Bo,{children:[f.getCells().length===0&&d.jsxs(d.Fragment,{children:[d.jsx(P.Typography,{sx:{textAlign:"center",p:2,variant:"subtitle2",fontWeight:"medium"},children:"Workbook is empty"}),d.jsx(P.Typography,{variant:"body2",sx:{textAlign:"center",mb:2,variant:"body2"},children:"Click the + buttons to add a markdown or code cell."})]}),f.getCells().map((G,re)=>d.jsx(q.Fragment,{children:d.jsx(p4,{cell:G,resourceUri:t,addButtonCallback:_=>H(_,re),sourceAndPaths:W(C),editingMarkdown:x===re,editingMalloy:g===re,onDelete:()=>{m(f.deleteCell(re)),V()},onCellChange:_=>{m(f.setCell(re,_))},onEdit:()=>{G.isMarkdown?E(re):y(re)},onClose:()=>{G.isMarkdown?E(void 0):y(void 0),V()}},`${re}-${G.isMarkdown}-${e.workspace}-${e.path}`)},`${re}-${f.getCells().length}`)),w,d.jsxs(P.Menu,{anchorEl:k,open:B,onClose:R,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[d.jsx(P.MenuItem,{onClick:()=>N(!0,O??0),children:"Add Markdown"}),d.jsx(P.MenuItem,{onClick:()=>N(!1,O??0),children:"Add Malloy"})]}),d.jsx(Bo,{sx:{flexDirection:"row",justifyContent:"flex-end",p:1}})]})})]})}function b4({workbookData:e}){const[t,n]=q.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 d.jsx(P.Button,{color:"primary",onClick:r,size:"small",children:t?"Copied!":"Export"})}function V1({onWorkbookClick:e}){const{workbookStorage:t}=Id(),[n,r]=q.useState([]),[o,i]=q.useState(void 0);return q.useEffect(()=>{t&&t.listWorkspaces(!1).then(a=>{const s=[];Promise.all(a.map(async l=>{await t.listWorkbooks(l).then(u=>{s.push(...u)}).catch(u=>{i(`Error listing workbooks: ${u.message}`)})})).then(()=>{r(s),i(void 0)})})},[t]),d.jsxs(d.Fragment,{children:[o&&d.jsx(P.Box,{sx:{mb:2},children:d.jsx(P.Typography,{color:"error",variant:"body2",children:o})}),d.jsx(P.Divider,{}),d.jsx(P.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:d.jsxs(P.List,{dense:!0,children:[n.length===0&&d.jsx(P.ListItem,{children:d.jsx(P.ListItemText,{primary:"No workbooks found.",sx:{textAlign:"center"}})}),n.map(a=>d.jsx(P.ListItem,{onClick:s=>e(a,s),sx:{cursor:"pointer","&:hover":{backgroundColor:"action.hover"}},children:d.jsx(P.ListItemText,{primary:a.path})},a.path))]})})]})}const Th="Local";class y4{async listWorkspaces(t){return Promise.resolve([{name:Th,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:Th})}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 x4({onWorkbookSelect:e}){const{workbookStorage:t}=Id(),[n,r]=q.useState(""),[o,i]=q.useState(""),[a,s]=q.useState([]),[l,u]=q.useState(null),[c,p]=q.useState(!1),[h,f]=q.useState(!1),m=!!l,g=T=>{u(T.currentTarget)},y=()=>{u(null)},x=()=>{f(!1)},E=()=>{p(!1),r(""),i("")};q.useEffect(()=>{t&&(console.log("fetching workspaces"),t.listWorkspaces(!0).then(T=>{s(T),T.length===1&&i(T[0].name)}).catch(T=>{console.error("Error fetching workspaces:",T),s([])}))},[t]);const C=(T,O)=>{f(!1),e(T,O)},S=T=>{p(!1),e({path:n,workspace:o},T),r(""),i("")},k=a.length===0;return d.jsxs(d.Fragment,{children:[d.jsx(P.Button,{"aria-controls":m?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:g,variant:"contained",sx:{height:"40px",px:2,backgroundColor:"#fbbb04","&:hover":{backgroundColor:"#eab308"}},children:"Analyze Package"}),d.jsxs(P.Menu,{id:"basic-menu",anchorEl:l,open:m,onClose:y,MenuListProps:{"aria-labelledby":"basic-button",sx:{py:.5}},children:[d.jsxs(P.MenuItem,{onClick:()=>{p(!0),y()},sx:{py:1,px:2},disabled:k,children:[d.jsx(P.ListItemIcon,{children:d.jsx(bn.Add,{fontSize:"small"})}),d.jsxs(P.ListItemText,{children:[d.jsx(P.Typography,{variant:"body2",fontWeight:500,children:"New Workbook"}),k?d.jsx(P.Typography,{variant:"caption",color:"text.secondary",children:"No workspaces available"}):d.jsx(P.Typography,{variant:"caption",color:"text.secondary",children:"Create a new analysis workbook"})]})]}),d.jsxs(P.MenuItem,{onClick:()=>{f(!0),y()},sx:{py:1,px:2},children:[d.jsx(P.ListItemIcon,{children:d.jsx(bn.Launch,{fontSize:"small"})}),d.jsxs(P.ListItemText,{children:[d.jsx(P.Typography,{variant:"body2",fontWeight:500,children:"Open Workbook"}),d.jsx(P.Typography,{variant:"caption",color:"text.secondary",children:"Open an existing workbook"})]})]})]}),d.jsxs(P.Dialog,{open:c,onClose:E,maxWidth:"sm",fullWidth:!0,children:[d.jsxs(P.DialogTitle,{sx:{pb:1,pt:2,px:2},children:[d.jsx(P.Typography,{fontWeight:600,sx:{fontSize:"1.5rem",mb:.5},children:"Create New Workbook"}),d.jsx(P.Typography,{variant:"body2",color:"text.secondary",children:"Start a new analysis workbook to explore your data"})]}),d.jsx(P.DialogContent,{sx:{px:2,pb:2},children:d.jsxs(P.Stack,{spacing:2,sx:{mt:1},children:[a.length>1?d.jsxs(P.FormControl,{fullWidth:!0,size:"small",children:[d.jsx(P.InputLabel,{children:"Workspace"}),d.jsx(P.Select,{value:o,label:"Workspace",onChange:T=>i(T.target.value),children:a.map(T=>d.jsx(P.MenuItem,{value:T.name,children:d.jsxs(P.Box,{children:[d.jsx(P.Typography,{variant:"body2",fontWeight:500,children:T.name}),d.jsx(P.Typography,{variant:"caption",color:"text.secondary",children:T.description})]})},T.name))})]}):a.length===1?d.jsxs(P.Box,{sx:{p:2,border:1,borderColor:"divider",borderRadius:1,backgroundColor:"grey.50"},children:[d.jsxs(P.Typography,{variant:"body2",fontWeight:500,gutterBottom:!0,children:["Workspace: ",a[0].name]}),d.jsx(P.Typography,{variant:"caption",color:"text.secondary",children:a[0].description})]}):null,d.jsx(P.FormControl,{fullWidth:!0,children:d.jsx(P.TextField,{label:"Workbook Name",value:n,onChange:T=>r(T.target.value),placeholder:"Enter workbook name...",fullWidth:!0,autoFocus:!0,size:"small"})}),d.jsxs(P.Stack,{direction:"row",spacing:1,justifyContent:"flex-end",children:[d.jsx(P.Button,{onClick:E,variant:"outlined",size:"small",children:"Cancel"}),d.jsx(P.Button,{onClick:T=>S(T),variant:"contained",disabled:!n.trim()||a.length>1&&!o,size:"small",children:"Create Workbook"})]})]})})]}),d.jsxs(P.Dialog,{open:h,onClose:x,maxWidth:"md",fullWidth:!0,children:[d.jsxs(P.DialogTitle,{sx:{pb:1,pt:2,px:2},children:[d.jsx(P.Typography,{fontWeight:600,sx:{mb:.5,fontSize:"1.5rem"},children:"Open Workbook"}),d.jsx(P.Typography,{variant:"body2",color:"text.secondary",children:"Select an existing workbook to continue your analysis"})]}),d.jsx(P.DialogContent,{sx:{px:2,pb:2},children:d.jsx(V1,{onWorkbookClick:C})})]})]})}function E4({resourceUri:e}){const{environmentName:t}=Mt(e),{apiClients:n}=ut.useServer(),[r,o]=q.useState(!1),i=90,{data:a,isSuccess:s,isError:l,error:u}=Wt({queryKey:["about",t],queryFn:()=>n.environments.getEnvironment(t,!1)}),c=a?.data?.readme||"",p=c.split(/\s+/),h=p.length>i,f=p.slice(0,i).join(" ");return d.jsxs(d.Fragment,{children:[!s&&!l&&d.jsx(un,{text:"Fetching About..."}),s&&c&&d.jsx(h0,{children:d.jsxs(m0,{children:[d.jsx(g0,{children:"Readme"}),d.jsxs(P.Box,{sx:{mt:1,fontSize:"0.875rem",lineHeight:1.6},children:[d.jsx(_s,{options:{overrides:{h1:{component:"p",props:{style:{fontSize:"inherit",fontWeight:"italic"}}},h2:{component:"p",props:{style:{fontSize:"inherit",fontWeight:"italic"}}},h3:{component:"p",props:{style:{fontSize:"inherit",fontWeight:"italic"}}}}},children:r||!h?c:f}),h&&d.jsxs(P.Box,{sx:{mt:1},children:[" ",d.jsx(P.Button,{variant:"text",size:"small",onClick:()=>o(!r),children:r?"Read less":"Read more"})]})]})]})}),l&&d.jsx(cn,{error:u,context:`${t} > About`})]})}function C4({resourceUri:e}){const[t,n]=q.useState(!1),{apiClients:r}=ut.useServer(),o=Rr.useQueryClient(),[i,a]=q.useState(""),{environmentName:s}=Mt(e),l=ur({async mutationFn(c){return r.packages.createPackage(s,{name:c.name,description:c.description,location:c.location})},onSuccess(){n(!1),a("Package created successfully"),o.invalidateQueries({queryKey:["packages",s]})},onError(c){a(c instanceof Error?c.message:"An unknown error occurred")}}),u=c=>{c.preventDefault();const p=new FormData(c.currentTarget),h=p.get("name")?.toString(),f=p.get("description")?.toString(),m=p.get("location")?.toString();l.mutate({name:h,description:f,location:m})};return d.jsxs(d.Fragment,{children:[d.jsx(P.Button,{onClick:()=>n(!0),variant:"contained",color:"primary",startIcon:d.jsx(bn.Add,{}),children:"Add Package"}),d.jsxs(P.Dialog,{open:t,onClose:()=>n(!1),maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:2}},children:[d.jsx(P.DialogTitle,{sx:{fontSize:"1.25rem",fontWeight:600,letterSpacing:"-0.025em",pt:3,pb:1,px:3},children:"Create New Package"}),d.jsxs(P.DialogContent,{sx:{px:3,pb:0},children:[d.jsxs(P.Box,{sx:{mb:3},children:[d.jsx(P.Typography,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:"Create a new Malloy package to start exploring your data."}),d.jsx(P.Typography,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:"The location can be a GitHub/S3/GCP URL containing a package (zipped or unzipped), or an absolute path to a directory the publisher server has access to."}),d.jsxs(P.Typography,{variant:"body2",color:"text.secondary",children:["Make sure to conform to the"," ",d.jsx(P.Box,{component:"a",href:"https://github.com/malloydata/publisher/blob/main/README.md#architecture-overview",target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary",textDecoration:"underline"},children:"Malloy Package Format"}),"."]})]}),d.jsx("form",{onSubmit:u,id:"package-form",children:d.jsxs(P.Stack,{spacing:2.5,children:[d.jsx(P.TextField,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Package Name",type:"text",fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:{shrink:!0}}),d.jsx(P.TextField,{id:"description",name:"description",label:"Description",multiline:!0,rows:3,fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:{shrink:!0}}),d.jsx(P.TextField,{id:"location",name:"location",label:"Location",type:"text",placeholder:"e.g. s3://my-bucket/my-package.zip",fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:{shrink:!0}})]})})]}),d.jsxs(P.DialogActions,{sx:{px:3,pt:2,pb:3,gap:1},children:[d.jsx(P.Button,{variant:"outlined",disabled:l.isPending,onClick:()=>n(!1),children:"Cancel"}),d.jsx(P.Button,{type:"submit",form:"package-form",variant:"contained",loading:l.isPending,children:"Save Changes"})]})]}),d.jsx(P.Snackbar,{open:i!=="",autoHideDuration:6e3,onClose:()=>a(""),message:i})]})}const T4=lt(d.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),W1=lt(d.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}));function q1(e){const{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:ya(t.components[n].defaultProps,r)}function v4({props:e,name:t,defaultTheme:n,themeId:r}){let o=H2(n);return o=o[r]||o,q1({theme:o,name:t,props:e})}function kt({props:e,name:t}){return v4({props:e,name:t,defaultTheme:El,themeId:hi})}const S4=Me("MuiBox",["root"]),k4=s0(),It=dt.createBox({themeId:hi,defaultTheme:k4,defaultClassName:S4.root,generateClassName:qm.generate}),Y1=de.oneOfType([de.func,de.object]);function vh(e){try{return e.matches(":focus-visible")}catch{}return!1}const Sh={};function K1(e,t){const n=D.useRef(Sh);return n.current===Sh&&(n.current=e(t)),n}class Js{static create(){return new Js}static use(){const t=K1(Js.create).current,[n,r]=D.useState(!1);return t.shouldMount=n,t.setShouldMount=r,D.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=w4(),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 D4(){return Js.use()}function w4(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n}function Dc(e,t){return Dc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Dc(e,t)}function Ad(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Dc(e,t)}function I4(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function A4(e,t){e.classList?e.classList.add(t):I4(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function kh(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function P4(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=kh(e.className,t):e.setAttribute("class",kh(e.className&&e.className.baseVal||"",t))}const Dh={disabled:!1},el=q.createContext(null);var G1=function(t){return t.scrollTop},Ji="unmounted",so="exited",lo="entering",Wo="entered",wc="exiting",Wn=(function(e){Ad(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var a=o,s=a&&!a.isMounting?r.enter:r.appear,l;return i.appearStatus=null,r.in?s?(l=so,i.appearStatus=lo):l=Wo:r.unmountOnExit||r.mountOnEnter?l=Ji:l=so,i.state={status:l},i.nextCallback=null,i}t.getDerivedStateFromProps=function(o,i){var a=o.in;return a&&i.status===Ji?{status:so}: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 a=this.state.status;this.props.in?a!==lo&&a!==Wo&&(i=lo):(a===lo||a===Wo)&&(i=wc)}this.updateStatus(!1,i)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,i,a,s;return i=a=s=o,o!=null&&typeof o!="number"&&(i=o.exit,a=o.enter,s=o.appear!==void 0?o.appear:a),{exit:i,enter:a,appear:s}},n.updateStatus=function(o,i){if(o===void 0&&(o=!1),i!==null)if(this.cancelNextCallback(),i===lo){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:Gi.findDOMNode(this);a&&G1(a)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===so&&this.setState({status:Ji})},n.performEnter=function(o){var i=this,a=this.props.enter,s=this.context?this.context.isMounting:o,l=this.props.nodeRef?[s]:[Gi.findDOMNode(this),s],u=l[0],c=l[1],p=this.getTimeouts(),h=s?p.appear:p.enter;if(!o&&!a||Dh.disabled){this.safeSetState({status:Wo},function(){i.props.onEntered(u)});return}this.props.onEnter(u,c),this.safeSetState({status:lo},function(){i.props.onEntering(u,c),i.onTransitionEnd(h,function(){i.safeSetState({status:Wo},function(){i.props.onEntered(u,c)})})})},n.performExit=function(){var o=this,i=this.props.exit,a=this.getTimeouts(),s=this.props.nodeRef?void 0:Gi.findDOMNode(this);if(!i||Dh.disabled){this.safeSetState({status:so},function(){o.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:wc},function(){o.props.onExiting(s),o.onTransitionEnd(a.exit,function(){o.safeSetState({status:so},function(){o.props.onExited(s)})})})},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,a=!0;return this.nextCallback=function(s){a&&(a=!1,i.nextCallback=null,o(s))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},n.onTransitionEnd=function(o,i){this.setNextCallback(i);var a=this.props.nodeRef?this.props.nodeRef.current:Gi.findDOMNode(this),s=o==null&&!this.props.addEndListener;if(!a||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],u=l[0],c=l[1];this.props.addEndListener(u,c)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===Ji)return null;var i=this.props,a=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 s=$e(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return q.createElement(el.Provider,{value:null},typeof a=="function"?a(o,s):q.cloneElement(q.Children.only(a),s))},t})(q.Component);Wn.contextType=el;Wn.propTypes={};function Uo(){}Wn.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Uo,onEntering:Uo,onEntered:Uo,onExit:Uo,onExiting:Uo,onExited:Uo};Wn.UNMOUNTED=Ji;Wn.EXITED=so;Wn.ENTERING=lo;Wn.ENTERED=Wo;Wn.EXITING=wc;var R4=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return A4(t,r)})},_u=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return P4(t,r)})},Pd=(function(e){Ad(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return r=e.call.apply(e,[this].concat(i))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(s,l){var u=r.resolveArguments(s,l),c=u[0],p=u[1];r.removeClasses(c,"exit"),r.addClass(c,p?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(s,l)},r.onEntering=function(s,l){var u=r.resolveArguments(s,l),c=u[0],p=u[1],h=p?"appear":"enter";r.addClass(c,h,"active"),r.props.onEntering&&r.props.onEntering(s,l)},r.onEntered=function(s,l){var u=r.resolveArguments(s,l),c=u[0],p=u[1],h=p?"appear":"enter";r.removeClasses(c,h),r.addClass(c,h,"done"),r.props.onEntered&&r.props.onEntered(s,l)},r.onExit=function(s){var l=r.resolveArguments(s),u=l[0];r.removeClasses(u,"appear"),r.removeClasses(u,"enter"),r.addClass(u,"exit","base"),r.props.onExit&&r.props.onExit(s)},r.onExiting=function(s){var l=r.resolveArguments(s),u=l[0];r.addClass(u,"exit","active"),r.props.onExiting&&r.props.onExiting(s)},r.onExited=function(s){var l=r.resolveArguments(s),u=l[0];r.removeClasses(u,"exit"),r.addClass(u,"exit","done"),r.props.onExited&&r.props.onExited(s)},r.resolveArguments=function(s,l){return r.props.nodeRef?[r.props.nodeRef.current,s]:[s,l]},r.getClassNames=function(s){var l=r.props.classNames,u=typeof l=="string",c=u&&l?l+"-":"",p=u?""+c+s:l[s],h=u?p+"-active":l[s+"Active"],f=u?p+"-done":l[s+"Done"];return{baseClassName:p,activeClassName:h,doneClassName:f}},r}var n=t.prototype;return n.addClass=function(o,i,a){var s=this.getClassNames(i)[a+"ClassName"],l=this.getClassNames("enter"),u=l.doneClassName;i==="appear"&&a==="done"&&u&&(s+=" "+u),a==="active"&&o&&G1(o),s&&(this.appliedClasses[i][a]=s,R4(o,s))},n.removeClasses=function(o,i){var a=this.appliedClasses[i],s=a.base,l=a.active,u=a.done;this.appliedClasses[i]={},s&&_u(o,s),l&&_u(o,l),u&&_u(o,u)},n.render=function(){var o=this.props;o.classNames;var i=$e(o,["classNames"]);return q.createElement(Wn,$({},i,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t})(q.Component);Pd.defaultProps={classNames:""};Pd.propTypes={};function M4(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rd(e,t){var n=function(i){return t&&q.isValidElement(i)?t(i):i},r=Object.create(null);return e&&q.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function O4(e,t){e=e||{},t=t||{};function n(c){return c in t?t[c]:e[c]}var r=Object.create(null),o=[];for(var i in e)i in t?o.length&&(r[i]=o,o=[]):o.push(i);var a,s={};for(var l in t){if(r[l])for(a=0;a<r[l].length;a++){var u=r[l][a];s[r[l][a]]=n(u)}s[l]=n(l)}for(a=0;a<o.length;a++)s[o[a]]=n(o[a]);return s}function po(e,t,n){return n[t]!=null?n[t]:e.props[t]}function L4(e,t){return Rd(e.children,function(n){return q.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:po(n,"appear",e),enter:po(n,"enter",e),exit:po(n,"exit",e)})})}function N4(e,t,n){var r=Rd(e.children),o=O4(t,r);return Object.keys(o).forEach(function(i){var a=o[i];if(q.isValidElement(a)){var s=i in t,l=i in r,u=t[i],c=q.isValidElement(u)&&!u.props.in;l&&(!s||c)?o[i]=q.cloneElement(a,{onExited:n.bind(null,a),in:!0,exit:po(a,"exit",e),enter:po(a,"enter",e)}):!l&&s&&!c?o[i]=q.cloneElement(a,{in:!1}):l&&s&&q.isValidElement(u)&&(o[i]=q.cloneElement(a,{onExited:n.bind(null,a),in:u.props.in,exit:po(a,"exit",e),enter:po(a,"enter",e)}))}}),o}var F4=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},_4={component:"div",childFactory:function(t){return t}},za=(function(e){Ad(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var a=i.handleExited.bind(M4(i));return i.state={contextValue:{isMounting:!0},handleExited:a,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 a=i.children,s=i.handleExited,l=i.firstRender;return{children:l?L4(o,s):N4(o,a,s),firstRender:!1}},n.handleExited=function(o,i){var a=Rd(this.props.children);o.key in a||(o.props.onExited&&o.props.onExited(i),this.mounted&&this.setState(function(s){var l=$({},s.children);return delete l[o.key],{children:l}}))},n.render=function(){var o=this.props,i=o.component,a=o.childFactory,s=$e(o,["component","childFactory"]),l=this.state.contextValue,u=F4(this.state.children).map(a);return delete s.appear,delete s.enter,delete s.exit,i===null?q.createElement(el.Provider,{value:l},u):q.createElement(el.Provider,{value:l},q.createElement(i,s,u))},t})(q.Component);za.propTypes={};za.defaultProps=_4;const B4=[];function j4(e){D.useEffect(e,B4)}class Md{static create(){return new Md}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 Nl(){const e=K1(Md.create).current;return j4(e.disposeEffect),e}function $4(e){const{className:t,classes:n,pulsate:r=!1,rippleX:o,rippleY:i,rippleSize:a,in:s,onExited:l,timeout:u}=e,[c,p]=D.useState(!1),h=Ae(t,n.ripple,n.rippleVisible,r&&n.ripplePulsate),f={width:a,height:a,top:-(a/2)+i,left:-(a/2)+o},m=Ae(n.child,c&&n.childLeaving,r&&n.childPulsate);return!s&&!c&&p(!0),D.useEffect(()=>{if(!s&&l!=null){const g=setTimeout(l,u);return()=>{clearTimeout(g)}}},[l,s,u]),d.jsx("span",{className:h,style:f,children:d.jsx("span",{className:m})})}const Mn=Me("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),Ic=550,H4=80,U4=dt.keyframes`
|
|
93
93
|
0% {
|
|
94
94
|
transform: scale(0);
|
|
95
95
|
opacity: 0.1;
|
|
@@ -3,7 +3,7 @@ import { styled as sn, Card as ts, CardContent as ns, CardMedia as O2, Box as Oe
|
|
|
3
3
|
import * as D from "react";
|
|
4
4
|
import ke, { useEffect as Bt, useImperativeHandle as I0, useContext as _i, Fragment as A0, useMemo as ht, useRef as cn, useReducer as W2, useState as Ve, Suspense as yd, lazy as q2, createContext as Y2, isValidElement as Us, cloneElement as zs, Children as j2, useCallback as Dn, useLayoutEffect as K2 } from "react";
|
|
5
5
|
import { useQuery as G2, useMutation as Q2, useQueryClient as Yo } from "@tanstack/react-query";
|
|
6
|
-
import { u as Ct, g as P0, c as R0, A as M0 } from "./ServerProvider-
|
|
6
|
+
import { u as Ct, g as P0, c as R0, A as M0 } from "./ServerProvider-a1T2FnBE.es.js";
|
|
7
7
|
import pl from "markdown-to-jsx";
|
|
8
8
|
import { Warning as X2, Add as O0, Launch as Z2, Delete as Ed, Edit as xd, MoreVert as Cd, AddCircleRounded as J2 } from "@mui/icons-material";
|
|
9
9
|
import { unstable_createGetCssVar as eE, createSpacing as tE, useTheme as nE, GlobalStyles as rE, unstable_memoTheme as oE, createStack as iE, Stack as aE, Box as L0, createBox as sE, keyframes as rs, css as N0, shouldForwardProp as F0, alpha as yn } from "@mui/system";
|
|
@@ -23784,7 +23784,7 @@ function mP() {
|
|
|
23784
23784
|
{ default: o },
|
|
23785
23785
|
{ default: i }
|
|
23786
23786
|
] = await Promise.all([
|
|
23787
|
-
import("./core-
|
|
23787
|
+
import("./core-BPLlx5VM.es.js"),
|
|
23788
23788
|
import("./engine-oniguruma-C4vnmooL.es.js"),
|
|
23789
23789
|
import("./sql-DCkt643-.es.js"),
|
|
23790
23790
|
import("./json-71t8ZF9g.es.js"),
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-B8kmVFxA.cjs.js"),o=require("./ServerProvider-F3zU218S.cjs.js");exports.AnalyzePackageButton=e.AnalyzePackageButton;exports.BrowserWorkbookStorage=e.BrowserWorkbookStorage;exports.ConnectionExplorer=e.ConnectionExplorer;exports.DimensionFilter=e.DimensionFilter;exports.EmbeddedQueryResult=e.EmbeddedQueryResult;exports.Environment=e.Environment;exports.Home=e.Home;exports.Loading=e.Loading;exports.Model=e.Model;exports.ModelExplorer=e.ModelExplorer;exports.ModelExplorerDialog=e.ModelExplorerDialog;exports.Models=e.Models;exports.Notebook=e.Notebook;exports.Package=e.Package;exports.Packages=e.Packages;exports.QueryResult=e.QueryResult;exports.RenderedResult=e.RenderedResult;exports.ResultContainer=e.ResultContainer;exports.SourceExplorerComponent=e.SourceExplorerComponent;exports.SourcesExplorer=e.SourcesExplorer;exports.Workbook=e.Workbook;exports.WorkbookList=e.WorkbookList;exports.WorkbookManager=e.WorkbookManager;exports.WorkbookStorageProvider=e.WorkbookStorageProvider;exports.createEmbeddedQueryResult=e.createEmbeddedQueryResult;exports.encodeResourceUri=e.encodeResourceUri;exports.extractDimensionSpecs=e.extractDimensionSpecs;exports.extractSourceFromQuery=e.extractSourceFromQuery;exports.generateFilterClause=e.generateFilterClause;exports.getDimensionKey=e.getDimensionKey;exports.getJoinedSources=e.getJoinedSources;exports.injectWhereClause=e.injectWhereClause;exports.makeDimensionKey=e.makeDimensionKey;exports.parseAllSourceInfos=e.parseAllSourceInfos;exports.parseDimensionFilterAnnotation=e.parseDimensionFilterAnnotation;exports.parseNotebookFilterAnnotation=e.parseNotebookFilterAnnotation;exports.parseResourceUri=e.parseResourceUri;exports.useDimensionFilters=e.useDimensionFilters;exports.useDimensionFiltersFromSpec=e.useDimensionFiltersFromSpec;exports.useDimensionFiltersQuery=e.useDimensionFiltersQuery;exports.useDimensionalFilterRangeData=e.useDimensionalFilterRangeData;exports.useGivensForm=e.useGivensForm;exports.useModelData=e.useModelData;exports.useModelGivens=e.useModelGivens;exports.useRawQueryData=e.useRawQueryData;exports.useRouterClickHandler=e.useRouterClickHandler;exports.ServerProvider=o.ServerProvider;exports.useServer=o.useServer;
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as a, J as o, C as r, D as n, y as i, E as t, H as l, L as u, M as m, o as d, q as c, x as k, N as p, v as D, P as g, Q as S, R as F, F as R, r as x, S as y, W as b, G as E, K as v, I as M, B as C, a0 as Q, g as W, i as P, j as A, X as f, k as B, l as G, Y as H, p as K, m as L, n as N, $ as U, O as j, T as w, U as I, V as J, _ as h, t as q, Z as z, u as O, e as T } from "./index-
|
|
2
|
-
import { S as X, u as Y } from "./ServerProvider-
|
|
1
|
+
import { A as a, J as o, C as r, D as n, y as i, E as t, H as l, L as u, M as m, o as d, q as c, x as k, N as p, v as D, P as g, Q as S, R as F, F as R, r as x, S as y, W as b, G as E, K as v, I as M, B as C, a0 as Q, g as W, i as P, j as A, X as f, k as B, l as G, Y as H, p as K, m as L, n as N, $ as U, O as j, T as w, U as I, V as J, _ as h, t as q, Z as z, u as O, e as T } from "./index-BNOut93L.es.js";
|
|
2
|
+
import { S as X, u as Y } from "./ServerProvider-a1T2FnBE.es.js";
|
|
3
3
|
export {
|
|
4
4
|
a as AnalyzePackageButton,
|
|
5
5
|
o as BrowserWorkbookStorage,
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const z=require("react/jsx-runtime"),j=require("@tanstack/react-query"),h=require("axios"),U=require("react"),u="http://localhost/api/v0".replace(/\/+$/,"");class I{constructor(r,a=u,n=h){this.basePath=a,this.axios=n,r&&(this.configuration=r,this.basePath=r.basePath??a)}configuration}class pe extends Error{constructor(r,a){super(a),this.field=r,this.name="RequiredError"}}const g={},V="https://example.com",m=function(l,r,a){if(a==null)throw new pe(r,`Required parameter ${r} was null or undefined when calling ${l}.`)};function F(l,r,a=""){r!=null&&(typeof r=="object"?Array.isArray(r)?r.forEach(n=>F(l,n,a)):Object.keys(r).forEach(n=>F(l,r[n],`${a}${a!==""?".":""}${n}`)):l.has(a)?l.append(a,r):l.set(a,r))}const v=function(l,...r){const a=new URLSearchParams(l.search);F(a,r),l.search=a.toString()},y=function(l,r,a){const n=typeof l!="string";return(n&&a&&a.isJsonMime?a.isJsonMime(r.headers["Content-Type"]):n)?JSON.stringify(l!==void 0?l:{}):l||""},b=function(l){return l.pathname+l.search+l.hash},O=function(l,r,a,n){return(e=r,t=a)=>{const o={...l.options,url:(e.defaults.baseURL?"":n?.basePath??t)+l.url};return e.request(o)}},me={Bigquery:"bigquery",Snowflake:"snowflake",Postgres:"postgres",Gcs:"gcs",S3:"s3",Azure:"azure"},de={ServicePrincipal:"service_principal",SasToken:"sas_token"},he={Error:"error",Warn:"warn",Debug:"debug"},ue={Success:"success",Error:"error"},Pe={Postgres:"postgres",Bigquery:"bigquery",Snowflake:"snowflake",Trino:"trino",Databricks:"databricks",Mysql:"mysql",Duckdb:"duckdb",Motherduck:"motherduck",Ducklake:"ducklake"},ge={Ok:"ok",Failed:"failed"},Ve={Embedded:"embedded",Materialized:"materialized"},ve={Equal:"equal",In:"in",Like:"like",GreaterThan:"greater_than",LessThan:"less_than"},be={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},Oe={Pending:"PENDING",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",Cancelled:"CANCELLED"},Se={Markdown:"markdown",Code:"code"},ye={Markdown:"markdown",Code:"code"},Ae={Initializing:"initializing",Serving:"serving",Draining:"draining"},L=function(l){return{createConnection:async(r,a,n,e={})=>{m("createConnection","environmentName",r),m("createConnection","connectionName",a),m("createConnection","connection",n);const t="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"POST",...s,...e},i={},p={};i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(n,c,l),{url:b(o),options:c}},deleteConnection:async(r,a,n={})=>{m("deleteConnection","environmentName",r),m("deleteConnection","connectionName",a);const e="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"DELETE",...o,...n},c={};v(t,{});let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},{url:b(t),options:s}},getConnection:async(r,a,n={})=>{m("getConnection","environmentName",r),m("getConnection","connectionName",a);const e="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"GET",...o,...n},c={};v(t,{});let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},{url:b(t),options:s}},getSqlsource:async(r,a,n,e={})=>{m("getSqlsource","environmentName",r),m("getSqlsource","connectionName",a);const t="/environments/{environmentName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={},p={};n!==void 0&&(p.sqlStatement=n),v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}},getSqlsourceInPackage:async(r,a,n,e,t={})=>{m("getSqlsourceInPackage","environmentName",r),m("getSqlsourceInPackage","packageName",a),m("getSqlsourceInPackage","connectionName",n);const o="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};e!==void 0&&(d.sqlStatement=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},getTable:async(r,a,n,e,t={})=>{m("getTable","environmentName",r),m("getTable","connectionName",a),m("getTable","schemaName",n),m("getTable","tablePath",e);const o="/environments/{environmentName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))).replace("{schemaName}",encodeURIComponent(String(n))).replace("{tablePath}",encodeURIComponent(String(e))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={};v(s,{});let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},getTableInPackage:async(r,a,n,e,t,o={})=>{m("getTableInPackage","environmentName",r),m("getTableInPackage","packageName",a),m("getTableInPackage","connectionName",n),m("getTableInPackage","schemaName",e),m("getTableInPackage","tablePath",t);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(e))).replace("{tablePath}",encodeURIComponent(String(t))),c=new URL(s,V);let i;l&&(i=l.baseOptions);const p={method:"GET",...i,...o},d={};v(c,{});let A=i&&i.headers?i.headers:{};return p.headers={...d,...A,...o.headers},{url:b(c),options:p}},getTemporarytable:async(r,a,n,e={})=>{m("getTemporarytable","environmentName",r),m("getTemporarytable","connectionName",a);const t="/environments/{environmentName}/connections/{connectionName}/temporaryTable".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={},p={};n!==void 0&&(p.sqlStatement=n),v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}},getTemporarytableInPackage:async(r,a,n,e,t={})=>{m("getTemporarytableInPackage","environmentName",r),m("getTemporarytableInPackage","packageName",a),m("getTemporarytableInPackage","connectionName",n);const o="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/temporaryTable".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};e!==void 0&&(d.sqlStatement=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},listConnections:async(r,a={})=>{m("listConnections","environmentName",r);const n="/environments/{environmentName}/connections".replace("{environmentName}",encodeURIComponent(String(r))),e=new URL(n,V);let t;l&&(t=l.baseOptions);const o={method:"GET",...t,...a},s={};v(e,{});let i=t&&t.headers?t.headers:{};return o.headers={...s,...i,...a.headers},{url:b(e),options:o}},listSchemas:async(r,a,n={})=>{m("listSchemas","environmentName",r),m("listSchemas","connectionName",a);const e="/environments/{environmentName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"GET",...o,...n},c={};v(t,{});let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},{url:b(t),options:s}},listSchemasInPackage:async(r,a,n,e={})=>{m("listSchemasInPackage","environmentName",r),m("listSchemasInPackage","packageName",a),m("listSchemasInPackage","connectionName",n);const t="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={};v(o,{});let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}},listTables:async(r,a,n,e,t={})=>{m("listTables","environmentName",r),m("listTables","connectionName",a),m("listTables","schemaName",n);const o="/environments/{environmentName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))).replace("{schemaName}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};e&&(d.tableNames=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},listTablesInPackage:async(r,a,n,e,t,o={})=>{m("listTablesInPackage","environmentName",r),m("listTablesInPackage","packageName",a),m("listTablesInPackage","connectionName",n),m("listTablesInPackage","schemaName",e);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(e))),c=new URL(s,V);let i;l&&(i=l.baseOptions);const p={method:"GET",...i,...o},d={},P={};t&&(P.tableNames=t),v(c,P);let A=i&&i.headers?i.headers:{};return p.headers={...d,...A,...o.headers},{url:b(c),options:p}},postQuerydata:async(r,a,n,e,t={})=>{m("postQuerydata","environmentName",r),m("postQuerydata","connectionName",a),m("postQuerydata","postQuerydataRequest",n);const o="/environments/{environmentName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"POST",...c,...t},p={},d={};e!==void 0&&(d.options=e),p["Content-Type"]="application/json",v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},i.data=y(n,i,l),{url:b(s),options:i}},postQuerydataInPackage:async(r,a,n,e,t,o={})=>{m("postQuerydataInPackage","environmentName",r),m("postQuerydataInPackage","packageName",a),m("postQuerydataInPackage","connectionName",n),m("postQuerydataInPackage","postQuerydataRequest",e);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))),c=new URL(s,V);let i;l&&(i=l.baseOptions);const p={method:"POST",...i,...o},d={},P={};t!==void 0&&(P.options=t),d["Content-Type"]="application/json",v(c,P);let A=i&&i.headers?i.headers:{};return p.headers={...d,...A,...o.headers},p.data=y(e,p,l),{url:b(c),options:p}},postSqlsource:async(r,a,n,e={})=>{m("postSqlsource","environmentName",r),m("postSqlsource","connectionName",a),m("postSqlsource","postSqlsourceRequest",n);const t="/environments/{environmentName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"POST",...s,...e},i={},p={};i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(n,c,l),{url:b(o),options:c}},postSqlsourceInPackage:async(r,a,n,e,t={})=>{m("postSqlsourceInPackage","environmentName",r),m("postSqlsourceInPackage","packageName",a),m("postSqlsourceInPackage","connectionName",n),m("postSqlsourceInPackage","postSqlsourceRequest",e);const o="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"POST",...c,...t},p={},d={};p["Content-Type"]="application/json",v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},i.data=y(e,i,l),{url:b(s),options:i}},postTemporarytable:async(r,a,n,e={})=>{m("postTemporarytable","environmentName",r),m("postTemporarytable","connectionName",a),m("postTemporarytable","postSqlsourceRequest",n);const t="/environments/{environmentName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"POST",...s,...e},i={},p={};i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(n,c,l),{url:b(o),options:c}},postTemporarytableInPackage:async(r,a,n,e,t={})=>{m("postTemporarytableInPackage","environmentName",r),m("postTemporarytableInPackage","packageName",a),m("postTemporarytableInPackage","connectionName",n),m("postTemporarytableInPackage","postSqlsourceRequest",e);const o="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{connectionName}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"POST",...c,...t},p={},d={};p["Content-Type"]="application/json",v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},i.data=y(e,i,l),{url:b(s),options:i}},updateConnection:async(r,a,n,e={})=>{m("updateConnection","environmentName",r),m("updateConnection","connectionName",a),m("updateConnection","updateConnectionRequest",n);const t="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{connectionName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"PATCH",...s,...e},i={},p={};i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(n,c,l),{url:b(o),options:c}}}},S=function(l){const r=L(l);return{async createConnection(a,n,e,t){const o=await r.createConnection(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.createConnection"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async deleteConnection(a,n,e){const t=await r.deleteConnection(a,n,e),o=l?.serverIndex??0,s=g["ConnectionsApi.deleteConnection"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)},async getConnection(a,n,e){const t=await r.getConnection(a,n,e),o=l?.serverIndex??0,s=g["ConnectionsApi.getConnection"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)},async getSqlsource(a,n,e,t){const o=await r.getSqlsource(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.getSqlsource"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async getSqlsourceInPackage(a,n,e,t,o){const s=await r.getSqlsourceInPackage(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.getSqlsourceInPackage"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async getTable(a,n,e,t,o){const s=await r.getTable(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.getTable"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async getTableInPackage(a,n,e,t,o,s){const c=await r.getTableInPackage(a,n,e,t,o,s),i=l?.serverIndex??0,p=g["ConnectionsApi.getTableInPackage"]?.[i]?.url;return(d,P)=>O(c,h,u,l)(d,p||P)},async getTemporarytable(a,n,e,t){const o=await r.getTemporarytable(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.getTemporarytable"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async getTemporarytableInPackage(a,n,e,t,o){const s=await r.getTemporarytableInPackage(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.getTemporarytableInPackage"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async listConnections(a,n){const e=await r.listConnections(a,n),t=l?.serverIndex??0,o=g["ConnectionsApi.listConnections"]?.[t]?.url;return(s,c)=>O(e,h,u,l)(s,o||c)},async listSchemas(a,n,e){const t=await r.listSchemas(a,n,e),o=l?.serverIndex??0,s=g["ConnectionsApi.listSchemas"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)},async listSchemasInPackage(a,n,e,t){const o=await r.listSchemasInPackage(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.listSchemasInPackage"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async listTables(a,n,e,t,o){const s=await r.listTables(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.listTables"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async listTablesInPackage(a,n,e,t,o,s){const c=await r.listTablesInPackage(a,n,e,t,o,s),i=l?.serverIndex??0,p=g["ConnectionsApi.listTablesInPackage"]?.[i]?.url;return(d,P)=>O(c,h,u,l)(d,p||P)},async postQuerydata(a,n,e,t,o){const s=await r.postQuerydata(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.postQuerydata"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async postQuerydataInPackage(a,n,e,t,o,s){const c=await r.postQuerydataInPackage(a,n,e,t,o,s),i=l?.serverIndex??0,p=g["ConnectionsApi.postQuerydataInPackage"]?.[i]?.url;return(d,P)=>O(c,h,u,l)(d,p||P)},async postSqlsource(a,n,e,t){const o=await r.postSqlsource(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.postSqlsource"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async postSqlsourceInPackage(a,n,e,t,o){const s=await r.postSqlsourceInPackage(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.postSqlsourceInPackage"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async postTemporarytable(a,n,e,t){const o=await r.postTemporarytable(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.postTemporarytable"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async postTemporarytableInPackage(a,n,e,t,o){const s=await r.postTemporarytableInPackage(a,n,e,t,o),c=l?.serverIndex??0,i=g["ConnectionsApi.postTemporarytableInPackage"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async updateConnection(a,n,e,t){const o=await r.updateConnection(a,n,e,t),s=l?.serverIndex??0,c=g["ConnectionsApi.updateConnection"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)}}},Ie=function(l,r,a){const n=S(l);return{createConnection(e,t,o,s){return n.createConnection(e,t,o,s).then(c=>c(a,r))},deleteConnection(e,t,o){return n.deleteConnection(e,t,o).then(s=>s(a,r))},getConnection(e,t,o){return n.getConnection(e,t,o).then(s=>s(a,r))},getSqlsource(e,t,o,s){return n.getSqlsource(e,t,o,s).then(c=>c(a,r))},getSqlsourceInPackage(e,t,o,s,c){return n.getSqlsourceInPackage(e,t,o,s,c).then(i=>i(a,r))},getTable(e,t,o,s,c){return n.getTable(e,t,o,s,c).then(i=>i(a,r))},getTableInPackage(e,t,o,s,c,i){return n.getTableInPackage(e,t,o,s,c,i).then(p=>p(a,r))},getTemporarytable(e,t,o,s){return n.getTemporarytable(e,t,o,s).then(c=>c(a,r))},getTemporarytableInPackage(e,t,o,s,c){return n.getTemporarytableInPackage(e,t,o,s,c).then(i=>i(a,r))},listConnections(e,t){return n.listConnections(e,t).then(o=>o(a,r))},listSchemas(e,t,o){return n.listSchemas(e,t,o).then(s=>s(a,r))},listSchemasInPackage(e,t,o,s){return n.listSchemasInPackage(e,t,o,s).then(c=>c(a,r))},listTables(e,t,o,s,c){return n.listTables(e,t,o,s,c).then(i=>i(a,r))},listTablesInPackage(e,t,o,s,c,i){return n.listTablesInPackage(e,t,o,s,c,i).then(p=>p(a,r))},postQuerydata(e,t,o,s,c){return n.postQuerydata(e,t,o,s,c).then(i=>i(a,r))},postQuerydataInPackage(e,t,o,s,c,i){return n.postQuerydataInPackage(e,t,o,s,c,i).then(p=>p(a,r))},postSqlsource(e,t,o,s){return n.postSqlsource(e,t,o,s).then(c=>c(a,r))},postSqlsourceInPackage(e,t,o,s,c){return n.postSqlsourceInPackage(e,t,o,s,c).then(i=>i(a,r))},postTemporarytable(e,t,o,s){return n.postTemporarytable(e,t,o,s).then(c=>c(a,r))},postTemporarytableInPackage(e,t,o,s,c){return n.postTemporarytableInPackage(e,t,o,s,c).then(i=>i(a,r))},updateConnection(e,t,o,s){return n.updateConnection(e,t,o,s).then(c=>c(a,r))}}};class f extends I{createConnection(r,a,n,e){return S(this.configuration).createConnection(r,a,n,e).then(t=>t(this.axios,this.basePath))}deleteConnection(r,a,n){return S(this.configuration).deleteConnection(r,a,n).then(e=>e(this.axios,this.basePath))}getConnection(r,a,n){return S(this.configuration).getConnection(r,a,n).then(e=>e(this.axios,this.basePath))}getSqlsource(r,a,n,e){return S(this.configuration).getSqlsource(r,a,n,e).then(t=>t(this.axios,this.basePath))}getSqlsourceInPackage(r,a,n,e,t){return S(this.configuration).getSqlsourceInPackage(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}getTable(r,a,n,e,t){return S(this.configuration).getTable(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}getTableInPackage(r,a,n,e,t,o){return S(this.configuration).getTableInPackage(r,a,n,e,t,o).then(s=>s(this.axios,this.basePath))}getTemporarytable(r,a,n,e){return S(this.configuration).getTemporarytable(r,a,n,e).then(t=>t(this.axios,this.basePath))}getTemporarytableInPackage(r,a,n,e,t){return S(this.configuration).getTemporarytableInPackage(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}listConnections(r,a){return S(this.configuration).listConnections(r,a).then(n=>n(this.axios,this.basePath))}listSchemas(r,a,n){return S(this.configuration).listSchemas(r,a,n).then(e=>e(this.axios,this.basePath))}listSchemasInPackage(r,a,n,e){return S(this.configuration).listSchemasInPackage(r,a,n,e).then(t=>t(this.axios,this.basePath))}listTables(r,a,n,e,t){return S(this.configuration).listTables(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}listTablesInPackage(r,a,n,e,t,o){return S(this.configuration).listTablesInPackage(r,a,n,e,t,o).then(s=>s(this.axios,this.basePath))}postQuerydata(r,a,n,e,t){return S(this.configuration).postQuerydata(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}postQuerydataInPackage(r,a,n,e,t,o){return S(this.configuration).postQuerydataInPackage(r,a,n,e,t,o).then(s=>s(this.axios,this.basePath))}postSqlsource(r,a,n,e){return S(this.configuration).postSqlsource(r,a,n,e).then(t=>t(this.axios,this.basePath))}postSqlsourceInPackage(r,a,n,e,t){return S(this.configuration).postSqlsourceInPackage(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}postTemporarytable(r,a,n,e){return S(this.configuration).postTemporarytable(r,a,n,e).then(t=>t(this.axios,this.basePath))}postTemporarytableInPackage(r,a,n,e,t){return S(this.configuration).postTemporarytableInPackage(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}updateConnection(r,a,n,e){return S(this.configuration).updateConnection(r,a,n,e).then(t=>t(this.axios,this.basePath))}}const H=function(l){return{testConnectionConfiguration:async(r,a={})=>{m("testConnectionConfiguration","connection",r);const n="/connections/test",e=new URL(n,V);let t;l&&(t=l.baseOptions);const o={method:"POST",...t,...a},s={},c={};s["Content-Type"]="application/json",v(e,c);let i=t&&t.headers?t.headers:{};return o.headers={...s,...i,...a.headers},o.data=y(r,o,l),{url:b(e),options:o}}}},$=function(l){const r=H(l);return{async testConnectionConfiguration(a,n){const e=await r.testConnectionConfiguration(a,n),t=l?.serverIndex??0,o=g["ConnectionsTestApi.testConnectionConfiguration"]?.[t]?.url;return(s,c)=>O(e,h,u,l)(s,o||c)}}},Ce=function(l,r,a){const n=$(l);return{testConnectionConfiguration(e,t){return n.testConnectionConfiguration(e,t).then(o=>o(a,r))}}};class ke extends I{testConnectionConfiguration(r,a){return $(this.configuration).testConnectionConfiguration(r,a).then(n=>n(this.axios,this.basePath))}}const D=function(l){return{listDatabases:async(r,a,n,e={})=>{m("listDatabases","environmentName",r),m("listDatabases","packageName",a);const t="/environments/{environmentName}/packages/{packageName}/databases".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={},p={};n!==void 0&&(p.versionId=n),v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}}}},Q=function(l){const r=D(l);return{async listDatabases(a,n,e,t){const o=await r.listDatabases(a,n,e,t),s=l?.serverIndex??0,c=g["DatabasesApi.listDatabases"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)}}},xe=function(l,r,a){const n=Q(l);return{listDatabases(e,t,o,s){return n.listDatabases(e,t,o,s).then(c=>c(a,r))}}};class W extends I{listDatabases(r,a,n,e){return Q(this.configuration).listDatabases(r,a,n,e).then(t=>t(this.axios,this.basePath))}}const G=function(l){return{createEnvironment:async(r,a={})=>{m("createEnvironment","environment",r);const n="/environments",e=new URL(n,V);let t;l&&(t=l.baseOptions);const o={method:"POST",...t,...a},s={},c={};s["Content-Type"]="application/json",v(e,c);let i=t&&t.headers?t.headers:{};return o.headers={...s,...i,...a.headers},o.data=y(r,o,l),{url:b(e),options:o}},deleteEnvironment:async(r,a={})=>{m("deleteEnvironment","environmentName",r);const n="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(r))),e=new URL(n,V);let t;l&&(t=l.baseOptions);const o={method:"DELETE",...t,...a},s={};v(e,{});let i=t&&t.headers?t.headers:{};return o.headers={...s,...i,...a.headers},{url:b(e),options:o}},getEnvironment:async(r,a,n={})=>{m("getEnvironment","environmentName",r);const e="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(r))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"GET",...o,...n},c={},i={};a!==void 0&&(i.reload=a),v(t,i);let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},{url:b(t),options:s}},listEnvironments:async(r={})=>{const a="/environments",n=new URL(a,V);let e;l&&(e=l.baseOptions);const t={method:"GET",...e,...r},o={};v(n,{});let c=e&&e.headers?e.headers:{};return t.headers={...o,...c,...r.headers},{url:b(n),options:t}},updateEnvironment:async(r,a,n={})=>{m("updateEnvironment","environmentName",r),m("updateEnvironment","environment",a);const e="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(r))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"PATCH",...o,...n},c={},i={};c["Content-Type"]="application/json",v(t,i);let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},s.data=y(a,s,l),{url:b(t),options:s}}}},k=function(l){const r=G(l);return{async createEnvironment(a,n){const e=await r.createEnvironment(a,n),t=l?.serverIndex??0,o=g["EnvironmentsApi.createEnvironment"]?.[t]?.url;return(s,c)=>O(e,h,u,l)(s,o||c)},async deleteEnvironment(a,n){const e=await r.deleteEnvironment(a,n),t=l?.serverIndex??0,o=g["EnvironmentsApi.deleteEnvironment"]?.[t]?.url;return(s,c)=>O(e,h,u,l)(s,o||c)},async getEnvironment(a,n,e){const t=await r.getEnvironment(a,n,e),o=l?.serverIndex??0,s=g["EnvironmentsApi.getEnvironment"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)},async listEnvironments(a){const n=await r.listEnvironments(a),e=l?.serverIndex??0,t=g["EnvironmentsApi.listEnvironments"]?.[e]?.url;return(o,s)=>O(n,h,u,l)(o,t||s)},async updateEnvironment(a,n,e){const t=await r.updateEnvironment(a,n,e),o=l?.serverIndex??0,s=g["EnvironmentsApi.updateEnvironment"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)}}},Ne=function(l,r,a){const n=k(l);return{createEnvironment(e,t){return n.createEnvironment(e,t).then(o=>o(a,r))},deleteEnvironment(e,t){return n.deleteEnvironment(e,t).then(o=>o(a,r))},getEnvironment(e,t,o){return n.getEnvironment(e,t,o).then(s=>s(a,r))},listEnvironments(e){return n.listEnvironments(e).then(t=>t(a,r))},updateEnvironment(e,t,o){return n.updateEnvironment(e,t,o).then(s=>s(a,r))}}};class _ extends I{createEnvironment(r,a){return k(this.configuration).createEnvironment(r,a).then(n=>n(this.axios,this.basePath))}deleteEnvironment(r,a){return k(this.configuration).deleteEnvironment(r,a).then(n=>n(this.axios,this.basePath))}getEnvironment(r,a,n){return k(this.configuration).getEnvironment(r,a,n).then(e=>e(this.axios,this.basePath))}listEnvironments(r){return k(this.configuration).listEnvironments(r).then(a=>a(this.axios,this.basePath))}updateEnvironment(r,a,n){return k(this.configuration).updateEnvironment(r,a,n).then(e=>e(this.axios,this.basePath))}}const J=function(l){return{getManifest:async(r,a,n={})=>{m("getManifest","environmentName",r),m("getManifest","packageName",a);const e="/environments/{environmentName}/packages/{packageName}/manifest".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"GET",...o,...n},c={};v(t,{});let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},{url:b(t),options:s}},manifestAction:async(r,a,n,e={})=>{m("manifestAction","environmentName",r),m("manifestAction","packageName",a),m("manifestAction","action",n);const t="/environments/{environmentName}/packages/{packageName}/manifest".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"POST",...s,...e},i={},p={};n!==void 0&&(p.action=n),v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}}}},q=function(l){const r=J(l);return{async getManifest(a,n,e){const t=await r.getManifest(a,n,e),o=l?.serverIndex??0,s=g["ManifestsApi.getManifest"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)},async manifestAction(a,n,e,t){const o=await r.manifestAction(a,n,e,t),s=l?.serverIndex??0,c=g["ManifestsApi.manifestAction"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)}}},Re=function(l,r,a){const n=q(l);return{getManifest(e,t,o){return n.getManifest(e,t,o).then(s=>s(a,r))},manifestAction(e,t,o,s){return n.manifestAction(e,t,o,s).then(c=>c(a,r))}}};class Ue extends I{getManifest(r,a,n){return q(this.configuration).getManifest(r,a,n).then(e=>e(this.axios,this.basePath))}manifestAction(r,a,n,e){return q(this.configuration).manifestAction(r,a,n,e).then(t=>t(this.axios,this.basePath))}}const Te={Reload:"reload"},K=function(l){return{createMaterialization:async(r,a,n,e={})=>{m("createMaterialization","environmentName",r),m("createMaterialization","packageName",a);const t="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"POST",...s,...e},i={},p={};i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(n,c,l),{url:b(o),options:c}},deleteMaterialization:async(r,a,n,e={})=>{m("deleteMaterialization","environmentName",r),m("deleteMaterialization","packageName",a),m("deleteMaterialization","materializationId",n);const t="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{materializationId}",encodeURIComponent(String(n))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"DELETE",...s,...e},i={};v(o,{});let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}},getMaterialization:async(r,a,n,e={})=>{m("getMaterialization","environmentName",r),m("getMaterialization","packageName",a),m("getMaterialization","materializationId",n);const t="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{materializationId}",encodeURIComponent(String(n))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={};v(o,{});let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}},listMaterializations:async(r,a,n,e,t={})=>{m("listMaterializations","environmentName",r),m("listMaterializations","packageName",a);const o="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};n!==void 0&&(d.limit=n),e!==void 0&&(d.offset=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},materializationAction:async(r,a,n,e,t={})=>{m("materializationAction","environmentName",r),m("materializationAction","packageName",a),m("materializationAction","materializationId",n),m("materializationAction","action",e);const o="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{materializationId}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"POST",...c,...t},p={},d={};e!==void 0&&(d.action=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}}}},x=function(l){const r=K(l);return{async createMaterialization(a,n,e,t){const o=await r.createMaterialization(a,n,e,t),s=l?.serverIndex??0,c=g["MaterializationsApi.createMaterialization"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async deleteMaterialization(a,n,e,t){const o=await r.deleteMaterialization(a,n,e,t),s=l?.serverIndex??0,c=g["MaterializationsApi.deleteMaterialization"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async getMaterialization(a,n,e,t){const o=await r.getMaterialization(a,n,e,t),s=l?.serverIndex??0,c=g["MaterializationsApi.getMaterialization"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async listMaterializations(a,n,e,t,o){const s=await r.listMaterializations(a,n,e,t,o),c=l?.serverIndex??0,i=g["MaterializationsApi.listMaterializations"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async materializationAction(a,n,e,t,o){const s=await r.materializationAction(a,n,e,t,o),c=l?.serverIndex??0,i=g["MaterializationsApi.materializationAction"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)}}},Me=function(l,r,a){const n=x(l);return{createMaterialization(e,t,o,s){return n.createMaterialization(e,t,o,s).then(c=>c(a,r))},deleteMaterialization(e,t,o,s){return n.deleteMaterialization(e,t,o,s).then(c=>c(a,r))},getMaterialization(e,t,o,s){return n.getMaterialization(e,t,o,s).then(c=>c(a,r))},listMaterializations(e,t,o,s,c){return n.listMaterializations(e,t,o,s,c).then(i=>i(a,r))},materializationAction(e,t,o,s,c){return n.materializationAction(e,t,o,s,c).then(i=>i(a,r))}}};class Ee extends I{createMaterialization(r,a,n,e){return x(this.configuration).createMaterialization(r,a,n,e).then(t=>t(this.axios,this.basePath))}deleteMaterialization(r,a,n,e){return x(this.configuration).deleteMaterialization(r,a,n,e).then(t=>t(this.axios,this.basePath))}getMaterialization(r,a,n,e){return x(this.configuration).getMaterialization(r,a,n,e).then(t=>t(this.axios,this.basePath))}listMaterializations(r,a,n,e,t){return x(this.configuration).listMaterializations(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}materializationAction(r,a,n,e,t){return x(this.configuration).materializationAction(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}}const we={Start:"start",Stop:"stop"},Y=function(l){return{compileModelSource:async(r,a,n,e,t={})=>{m("compileModelSource","environmentName",r),m("compileModelSource","packageName",a),m("compileModelSource","path",n),m("compileModelSource","compileRequest",e);const o="/environments/{environmentName}/packages/{packageName}/models/{path}/compile".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{path}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"POST",...c,...t},p={},d={};p["Content-Type"]="application/json",v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},i.data=y(e,i,l),{url:b(s),options:i}},executeQueryModel:async(r,a,n,e,t={})=>{m("executeQueryModel","environmentName",r),m("executeQueryModel","packageName",a),m("executeQueryModel","path",n),m("executeQueryModel","queryRequest",e);const o="/environments/{environmentName}/packages/{packageName}/models/{path}/query".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{path}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"POST",...c,...t},p={},d={};p["Content-Type"]="application/json",v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},i.data=y(e,i,l),{url:b(s),options:i}},getModel:async(r,a,n,e,t={})=>{m("getModel","environmentName",r),m("getModel","packageName",a),m("getModel","path",n);const o="/environments/{environmentName}/packages/{packageName}/models/{path}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{path}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};e!==void 0&&(d.versionId=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},listModels:async(r,a,n,e={})=>{m("listModels","environmentName",r),m("listModels","packageName",a);const t="/environments/{environmentName}/packages/{packageName}/models".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={},p={};n!==void 0&&(p.versionId=n),v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}}}},T=function(l){const r=Y(l);return{async compileModelSource(a,n,e,t,o){const s=await r.compileModelSource(a,n,e,t,o),c=l?.serverIndex??0,i=g["ModelsApi.compileModelSource"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async executeQueryModel(a,n,e,t,o){const s=await r.executeQueryModel(a,n,e,t,o),c=l?.serverIndex??0,i=g["ModelsApi.executeQueryModel"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async getModel(a,n,e,t,o){const s=await r.getModel(a,n,e,t,o),c=l?.serverIndex??0,i=g["ModelsApi.getModel"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async listModels(a,n,e,t){const o=await r.listModels(a,n,e,t),s=l?.serverIndex??0,c=g["ModelsApi.listModels"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)}}},qe=function(l,r,a){const n=T(l);return{compileModelSource(e,t,o,s,c){return n.compileModelSource(e,t,o,s,c).then(i=>i(a,r))},executeQueryModel(e,t,o,s,c){return n.executeQueryModel(e,t,o,s,c).then(i=>i(a,r))},getModel(e,t,o,s,c){return n.getModel(e,t,o,s,c).then(i=>i(a,r))},listModels(e,t,o,s){return n.listModels(e,t,o,s).then(c=>c(a,r))}}};class X extends I{compileModelSource(r,a,n,e,t){return T(this.configuration).compileModelSource(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}executeQueryModel(r,a,n,e,t){return T(this.configuration).executeQueryModel(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}getModel(r,a,n,e,t){return T(this.configuration).getModel(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}listModels(r,a,n,e){return T(this.configuration).listModels(r,a,n,e).then(t=>t(this.axios,this.basePath))}}const Z=function(l){return{executeNotebookCell:async(r,a,n,e,t,o,s,c,i={})=>{m("executeNotebookCell","environmentName",r),m("executeNotebookCell","packageName",a),m("executeNotebookCell","path",n),m("executeNotebookCell","cellIndex",e);const p="/environments/{environmentName}/packages/{packageName}/notebooks/{path}/cells/{cellIndex}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{path}",encodeURIComponent(String(n))).replace("{cellIndex}",encodeURIComponent(String(e))),d=new URL(p,V);let P;l&&(P=l.baseOptions);const A={method:"GET",...P,...i},w={},C={};t!==void 0&&(C.versionId=t),o!==void 0&&(C.filter_params=o),s!==void 0&&(C.bypass_filters=s),c!==void 0&&(C.givens=c),v(d,C);let R=P&&P.headers?P.headers:{};return A.headers={...w,...R,...i.headers},{url:b(d),options:A}},getNotebook:async(r,a,n,e,t={})=>{m("getNotebook","environmentName",r),m("getNotebook","packageName",a),m("getNotebook","path",n);const o="/environments/{environmentName}/packages/{packageName}/notebooks/{path}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))).replace("{path}",encodeURIComponent(String(n))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};e!==void 0&&(d.versionId=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},listNotebooks:async(r,a,n,e={})=>{m("listNotebooks","environmentName",r),m("listNotebooks","packageName",a);const t="/environments/{environmentName}/packages/{packageName}/notebooks".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"GET",...s,...e},i={},p={};n!==void 0&&(p.versionId=n),v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},{url:b(o),options:c}}}},M=function(l){const r=Z(l);return{async executeNotebookCell(a,n,e,t,o,s,c,i,p){const d=await r.executeNotebookCell(a,n,e,t,o,s,c,i,p),P=l?.serverIndex??0,A=g["NotebooksApi.executeNotebookCell"]?.[P]?.url;return(w,C)=>O(d,h,u,l)(w,A||C)},async getNotebook(a,n,e,t,o){const s=await r.getNotebook(a,n,e,t,o),c=l?.serverIndex??0,i=g["NotebooksApi.getNotebook"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async listNotebooks(a,n,e,t){const o=await r.listNotebooks(a,n,e,t),s=l?.serverIndex??0,c=g["NotebooksApi.listNotebooks"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)}}},Fe=function(l,r,a){const n=M(l);return{executeNotebookCell(e,t,o,s,c,i,p,d,P){return n.executeNotebookCell(e,t,o,s,c,i,p,d,P).then(A=>A(a,r))},getNotebook(e,t,o,s,c){return n.getNotebook(e,t,o,s,c).then(i=>i(a,r))},listNotebooks(e,t,o,s){return n.listNotebooks(e,t,o,s).then(c=>c(a,r))}}};class ee extends I{executeNotebookCell(r,a,n,e,t,o,s,c,i){return M(this.configuration).executeNotebookCell(r,a,n,e,t,o,s,c,i).then(p=>p(this.axios,this.basePath))}getNotebook(r,a,n,e,t){return M(this.configuration).getNotebook(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}listNotebooks(r,a,n,e){return M(this.configuration).listNotebooks(r,a,n,e).then(t=>t(this.axios,this.basePath))}}const $e={True:"true",False:"false"},ae=function(l){return{createPackage:async(r,a,n,e={})=>{m("createPackage","environmentName",r),m("createPackage","_package",a);const t="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(r))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"POST",...s,...e},i={},p={};n!==void 0&&(p.autoLoadManifest=n),i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(a,c,l),{url:b(o),options:c}},deletePackage:async(r,a,n={})=>{m("deletePackage","environmentName",r),m("deletePackage","packageName",a);const e="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),t=new URL(e,V);let o;l&&(o=l.baseOptions);const s={method:"DELETE",...o,...n},c={};v(t,{});let p=o&&o.headers?o.headers:{};return s.headers={...c,...p,...n.headers},{url:b(t),options:s}},getPackage:async(r,a,n,e,t={})=>{m("getPackage","environmentName",r),m("getPackage","packageName",a);const o="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),s=new URL(o,V);let c;l&&(c=l.baseOptions);const i={method:"GET",...c,...t},p={},d={};n!==void 0&&(d.versionId=n),e!==void 0&&(d.reload=e),v(s,d);let P=c&&c.headers?c.headers:{};return i.headers={...p,...P,...t.headers},{url:b(s),options:i}},listPackages:async(r,a={})=>{m("listPackages","environmentName",r);const n="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(r))),e=new URL(n,V);let t;l&&(t=l.baseOptions);const o={method:"GET",...t,...a},s={};v(e,{});let i=t&&t.headers?t.headers:{};return o.headers={...s,...i,...a.headers},{url:b(e),options:o}},updatePackage:async(r,a,n,e={})=>{m("updatePackage","environmentName",r),m("updatePackage","packageName",a),m("updatePackage","_package",n);const t="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(r))).replace("{packageName}",encodeURIComponent(String(a))),o=new URL(t,V);let s;l&&(s=l.baseOptions);const c={method:"PATCH",...s,...e},i={},p={};i["Content-Type"]="application/json",v(o,p);let d=s&&s.headers?s.headers:{};return c.headers={...i,...d,...e.headers},c.data=y(n,c,l),{url:b(o),options:c}}}},N=function(l){const r=ae(l);return{async createPackage(a,n,e,t){const o=await r.createPackage(a,n,e,t),s=l?.serverIndex??0,c=g["PackagesApi.createPackage"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)},async deletePackage(a,n,e){const t=await r.deletePackage(a,n,e),o=l?.serverIndex??0,s=g["PackagesApi.deletePackage"]?.[o]?.url;return(c,i)=>O(t,h,u,l)(c,s||i)},async getPackage(a,n,e,t,o){const s=await r.getPackage(a,n,e,t,o),c=l?.serverIndex??0,i=g["PackagesApi.getPackage"]?.[c]?.url;return(p,d)=>O(s,h,u,l)(p,i||d)},async listPackages(a,n){const e=await r.listPackages(a,n),t=l?.serverIndex??0,o=g["PackagesApi.listPackages"]?.[t]?.url;return(s,c)=>O(e,h,u,l)(s,o||c)},async updatePackage(a,n,e,t){const o=await r.updatePackage(a,n,e,t),s=l?.serverIndex??0,c=g["PackagesApi.updatePackage"]?.[s]?.url;return(i,p)=>O(o,h,u,l)(i,c||p)}}},Qe=function(l,r,a){const n=N(l);return{createPackage(e,t,o,s){return n.createPackage(e,t,o,s).then(c=>c(a,r))},deletePackage(e,t,o){return n.deletePackage(e,t,o).then(s=>s(a,r))},getPackage(e,t,o,s,c){return n.getPackage(e,t,o,s,c).then(i=>i(a,r))},listPackages(e,t){return n.listPackages(e,t).then(o=>o(a,r))},updatePackage(e,t,o,s){return n.updatePackage(e,t,o,s).then(c=>c(a,r))}}};class te extends I{createPackage(r,a,n,e){return N(this.configuration).createPackage(r,a,n,e).then(t=>t(this.axios,this.basePath))}deletePackage(r,a,n){return N(this.configuration).deletePackage(r,a,n).then(e=>e(this.axios,this.basePath))}getPackage(r,a,n,e,t){return N(this.configuration).getPackage(r,a,n,e,t).then(o=>o(this.axios,this.basePath))}listPackages(r,a){return N(this.configuration).listPackages(r,a).then(n=>n(this.axios,this.basePath))}updatePackage(r,a,n,e){return N(this.configuration).updatePackage(r,a,n,e).then(t=>t(this.axios,this.basePath))}}const ne=function(l){return{getStatus:async(r={})=>{const a="/status",n=new URL(a,V);let e;l&&(e=l.baseOptions);const t={method:"GET",...e,...r},o={};v(n,{});let c=e&&e.headers?e.headers:{};return t.headers={...o,...c,...r.headers},{url:b(n),options:t}}}},B=function(l){const r=ne(l);return{async getStatus(a){const n=await r.getStatus(a),e=l?.serverIndex??0,t=g["PublisherApi.getStatus"]?.[e]?.url;return(o,s)=>O(n,h,u,l)(o,t||s)}}},Be=function(l,r,a){const n=B(l);return{getStatus(e){return n.getStatus(e).then(t=>t(a,r))}}};class re extends I{getStatus(r){return B(this.configuration).getStatus(r).then(a=>a(this.axios,this.basePath))}}const oe=function(l){return{getWatchStatus:async(r={})=>{const a="/watch-mode/status",n=new URL(a,V);let e;l&&(e=l.baseOptions);const t={method:"GET",...e,...r},o={};v(n,{});let c=e&&e.headers?e.headers:{};return t.headers={...o,...c,...r.headers},{url:b(n),options:t}},startWatching:async(r,a={})=>{m("startWatching","startWatchRequest",r);const n="/watch-mode/start",e=new URL(n,V);let t;l&&(t=l.baseOptions);const o={method:"POST",...t,...a},s={},c={};s["Content-Type"]="application/json",v(e,c);let i=t&&t.headers?t.headers:{};return o.headers={...s,...i,...a.headers},o.data=y(r,o,l),{url:b(e),options:o}},stopWatching:async(r={})=>{const a="/watch-mode/stop",n=new URL(a,V);let e;l&&(e=l.baseOptions);const t={method:"POST",...e,...r},o={};v(n,{});let c=e&&e.headers?e.headers:{};return t.headers={...o,...c,...r.headers},{url:b(n),options:t}}}},E=function(l){const r=oe(l);return{async getWatchStatus(a){const n=await r.getWatchStatus(a),e=l?.serverIndex??0,t=g["WatchModeApi.getWatchStatus"]?.[e]?.url;return(o,s)=>O(n,h,u,l)(o,t||s)},async startWatching(a,n){const e=await r.startWatching(a,n),t=l?.serverIndex??0,o=g["WatchModeApi.startWatching"]?.[t]?.url;return(s,c)=>O(e,h,u,l)(s,o||c)},async stopWatching(a){const n=await r.stopWatching(a),e=l?.serverIndex??0,t=g["WatchModeApi.stopWatching"]?.[e]?.url;return(o,s)=>O(n,h,u,l)(o,t||s)}}},ze=function(l,r,a){const n=E(l);return{getWatchStatus(e){return n.getWatchStatus(e).then(t=>t(a,r))},startWatching(e,t){return n.startWatching(e,t).then(o=>o(a,r))},stopWatching(e){return n.stopWatching(e).then(t=>t(a,r))}}};class se extends I{getWatchStatus(r){return E(this.configuration).getWatchStatus(r).then(a=>a(this.axios,this.basePath))}startWatching(r,a){return E(this.configuration).startWatching(r,a).then(n=>n(this.axios,this.basePath))}stopWatching(r){return E(this.configuration).stopWatching(r).then(a=>a(this.axios,this.basePath))}}class ce{apiKey;username;password;accessToken;basePath;serverIndex;baseOptions;formDataCtor;constructor(r={}){this.apiKey=r.apiKey,this.username=r.username,this.password=r.password,this.accessToken=r.accessToken,this.basePath=r.basePath,this.serverIndex=r.serverIndex,this.baseOptions={...r.baseOptions,headers:{...r.baseOptions?.headers}},this.formDataCtor=r.formDataCtor}isJsonMime(r){const a=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return r!==null&&(a.test(r)||r.toLowerCase()==="application/json-patch+json")}}const le=new j.QueryClient({defaultOptions:{queries:{retry:!1,throwOnError:!1},mutations:{retry:!1,throwOnError:!1}}});h.defaults.baseURL||(h.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet");const ie=U.createContext(void 0),je=(l,r)=>{const a=`${window.location.protocol}//${window.location.host}/api/v0`,n=h.create({baseURL:l||a,withCredentials:!0,timeout:6e5});n.interceptors.request.use(async t=>{const o=await r?.();return t.headers.Authorization=o||"",t});const e=new ce({basePath:a});return{models:new X(e,a,n),publisher:new re(e,a,n),environments:new _(e,a,n),packages:new te(e,a,n),notebooks:new ee(e,a,n),connections:new f(e,a,n),databases:new W(e,a,n),watchMode:new se(e,a,n)}},Le=({children:l,getAccessToken:r,baseURL:a,mutable:n})=>{const e=U.useMemo(()=>je(a,r),[a,r]),t=a||`${window.location.protocol}//${window.location.host}/api/v0`,[o,s]=U.useState(n),[c,i]=U.useState(!0);U.useEffect(()=>{let d=!0;return(async()=>{try{const A=await e.publisher.getStatus();if(d){const C=A.data?.frozenConfig;let R;C?R=!1:n===void 0?R=!0:R=n,s(R),i(!1)}}catch(A){console.error("Failed to fetch publisher status:",A),d&&(s(n),i(!1))}})(),()=>{d=!1}},[e,n]);const p={server:t,getAccessToken:r,apiClients:e,mutable:o,isLoadingStatus:c};return z.jsx(j.QueryClientProvider,{client:le,children:z.jsx(ie.Provider,{value:p,children:l})})},fe=()=>{const l=U.useContext(ie);if(l===void 0)throw new Error("useServer must be used within a ServerProvider");return l};exports.AttachedDatabaseTypeEnum=me;exports.AzureConnectionAuthTypeEnum=de;exports.CompileProblemSeverityEnum=he;exports.CompileResultStatusEnum=ue;exports.Configuration=ce;exports.ConnectionStatusStatusEnum=ge;exports.ConnectionTypeEnum=Pe;exports.ConnectionsApi=f;exports.ConnectionsApiAxiosParamCreator=L;exports.ConnectionsApiFactory=Ie;exports.ConnectionsApiFp=S;exports.ConnectionsTestApi=ke;exports.ConnectionsTestApiAxiosParamCreator=H;exports.ConnectionsTestApiFactory=Ce;exports.ConnectionsTestApiFp=$;exports.DatabaseTypeEnum=Ve;exports.DatabasesApi=W;exports.DatabasesApiAxiosParamCreator=D;exports.DatabasesApiFactory=xe;exports.DatabasesApiFp=Q;exports.EnvironmentsApi=_;exports.EnvironmentsApiAxiosParamCreator=G;exports.EnvironmentsApiFactory=Ne;exports.EnvironmentsApiFp=k;exports.ExecuteNotebookCellBypassFiltersEnum=$e;exports.FilterTypeEnum=ve;exports.LogMessageSeverityEnum=be;exports.ManifestActionActionEnum=Te;exports.ManifestsApi=Ue;exports.ManifestsApiAxiosParamCreator=J;exports.ManifestsApiFactory=Re;exports.ManifestsApiFp=q;exports.MaterializationActionActionEnum=we;exports.MaterializationStatusEnum=Oe;exports.MaterializationsApi=Ee;exports.MaterializationsApiAxiosParamCreator=K;exports.MaterializationsApiFactory=Me;exports.MaterializationsApiFp=x;exports.ModelsApi=X;exports.ModelsApiAxiosParamCreator=Y;exports.ModelsApiFactory=qe;exports.ModelsApiFp=T;exports.NotebookCellResultTypeEnum=ye;exports.NotebookCellTypeEnum=Se;exports.NotebooksApi=ee;exports.NotebooksApiAxiosParamCreator=Z;exports.NotebooksApiFactory=Fe;exports.NotebooksApiFp=M;exports.PackagesApi=te;exports.PackagesApiAxiosParamCreator=ae;exports.PackagesApiFactory=Qe;exports.PackagesApiFp=N;exports.PublisherApi=re;exports.PublisherApiAxiosParamCreator=ne;exports.PublisherApiFactory=Be;exports.PublisherApiFp=B;exports.ServerProvider=Le;exports.ServerStatusOperationalStateEnum=Ae;exports.WatchModeApi=se;exports.WatchModeApiAxiosParamCreator=oe;exports.WatchModeApiFactory=ze;exports.WatchModeApiFp=E;exports.globalQueryClient=le;exports.useServer=fe;
|