@malloy-publisher/server 0.11.2 → 0.12.0

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.
Files changed (29) hide show
  1. package/README.docker.md +1 -1
  2. package/dist/app/api-doc.yaml +127 -5
  3. package/dist/app/assets/{EnvironmentPage-Dfn26tY2.js → EnvironmentPage-xh4aL2P9.js} +1 -1
  4. package/dist/app/assets/{HomePage-CNuMPINA.js → HomePage-B1w1b7e1.js} +1 -1
  5. package/dist/app/assets/{MainPage-DWjs4_e3.js → MainPage-BrYzrVlB.js} +1 -1
  6. package/dist/app/assets/{ModelPage-GZ6hXGgw.js → ModelPage-DC5HfNar.js} +2 -2
  7. package/dist/app/assets/{PackagePage-_5vFWxqm.js → PackagePage-DRKFqQHw.js} +1 -1
  8. package/dist/app/assets/{PackageSplatRoute-CTxtXKZO.js → PackageSplatRoute-CU3-BYcC.js} +2 -2
  9. package/dist/app/assets/{RenderedResult-r3dg2xOJ.es-t-MnqNaH.js → RenderedResult-D8bCgThO.es-bV5QVotj.js} +1 -1
  10. package/dist/app/assets/{RouteError-y4xkvszw.js → RouteError-Dmo0qwGV.js} +1 -1
  11. package/dist/app/assets/{ThemeEditorPage-BffGFYK5.js → ThemeEditorPage-ByJldD0t.js} +1 -1
  12. package/dist/app/assets/{ToggleButtonGroup-BfTJg9cJ.js → ToggleButtonGroup-Dxax2bOe.js} +1 -1
  13. package/dist/app/assets/{documentRoutes-DnpGGXs4.js → documentRoutes-DFdmdaBX.js} +1 -1
  14. package/dist/app/assets/{editPageMounted-efTmRdGK.js → editPageMounted-CjmdfOM1.js} +2 -2
  15. package/dist/app/assets/{index-CW23I6Cr.js → index-9_OOEQph.js} +1 -1
  16. package/dist/app/assets/{index-D8JKtZm5.js → index-BLi0H5mL.js} +5 -5
  17. package/dist/app/assets/{index-CG6r_Zwr.js → index-BsumQDtR.js} +1 -1
  18. package/dist/app/assets/{index-g1sInkiO.js → index-BvJ7NTSs.js} +1 -1
  19. package/dist/app/assets/{index.es-AXVff-Xr.js → index.es-CbR1CwU4.js} +1 -1
  20. package/dist/app/assets/usePackageLinkNavigate-SMJdqHGs.js +1 -0
  21. package/dist/app/assets/{usePackageRoute-BUdFd5dP.js → usePackageRoute-DzmKqWKq.js} +1 -1
  22. package/dist/app/index.html +1 -1
  23. package/dist/instrumentation.mjs +5 -1
  24. package/dist/package_load_worker.mjs +241 -109
  25. package/dist/server.mjs +18399 -13618
  26. package/dist/{sshcrypto-a4xyg5e8.node → sshcrypto-fqcyz88x.node} +0 -0
  27. package/package.json +1 -1
  28. package/publisher.config.example.duckdb.json +4 -0
  29. package/dist/app/assets/usePackageLinkNavigate-DpGlRKnc.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CW23I6Cr.js","assets/index-CRAwrhYM.js","assets/index-CG6r_Zwr.js","assets/core-B8oMW4sm.es-hOkwvru5.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/index-g1sInkiO.js","assets/index-DgBiwYeC.js","assets/MainPage-DWjs4_e3.js","assets/editPageMounted-efTmRdGK.js","assets/documentRoutes-DnpGGXs4.js","assets/usePackageRoute-BUdFd5dP.js","assets/PackageSplatRoute-CTxtXKZO.js","assets/PackagePage-_5vFWxqm.js","assets/usePackageLinkNavigate-DpGlRKnc.js","assets/ThemeEditorPage-BffGFYK5.js","assets/ToggleButtonGroup-BfTJg9cJ.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-9_OOEQph.js","assets/index-CRAwrhYM.js","assets/index-BsumQDtR.js","assets/core-B8oMW4sm.es-hOkwvru5.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/index-BvJ7NTSs.js","assets/index-DgBiwYeC.js","assets/MainPage-BrYzrVlB.js","assets/editPageMounted-CjmdfOM1.js","assets/documentRoutes-DFdmdaBX.js","assets/usePackageRoute-DzmKqWKq.js","assets/PackageSplatRoute-CU3-BYcC.js","assets/PackagePage-DRKFqQHw.js","assets/usePackageLinkNavigate-SMJdqHGs.js","assets/ThemeEditorPage-ByJldD0t.js","assets/ToggleButtonGroup-Dxax2bOe.js"])))=>i.map(i=>d[i]);
2
2
  function ON(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const a=Object.getOwnPropertyDescriptor(r,o);a&&Object.defineProperty(e,o,a.get?a:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();var wSe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ak(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $S={exports:{}},rm={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -271,7 +271,7 @@ export default theme;`}function g2(e){return typeof e=="number"?`${(e*100).toFix
271
271
  `);i=s===-1?"":a.slice(s+1)}if(!r.stack)r.stack=i;else if(i){const s=i.indexOf(`
272
272
  `),c=s===-1?-1:i.indexOf(`
273
273
  `,s+1),f=c===-1?"":i.slice(c+1);String(r.stack).endsWith(f)||(r.stack+=`
274
- `+i)}}catch{}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ed(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&$b.assertOptions(r,{silentJSONParsing:da.transitional(da.boolean),forcedJSONParsing:da.transitional(da.boolean),clarifyTimeoutError:da.transitional(da.boolean),legacyInterceptorReqResOrdering:da.transitional(da.boolean),advertiseZstdAcceptEncoding:da.transitional(da.boolean),validateStatusUndefinedResolves:da.transitional(da.boolean)},!1),o!=null&&(Pe.isFunction(o)?n.paramsSerializer={serialize:o}:$b.assertOptions(o,{encode:da.function,serialize:da.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),$b.assertOptions(n,{baseUrl:da.spelling("baseURL"),withXsrfToken:da.spelling("withXSRFToken")},!0),n.method=(Pe.getSafeProp(n,"method")||Pe.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=a&&Pe.merge(a.common,a[n.method]);a&&Pe.forEach($5.concat("common"),b=>{delete a[b]}),n.headers=ga.concat(i,a);const s=[];let c=!0;this.interceptors.request.forEach(function(S){if(typeof S.runWhen=="function"&&S.runWhen(n)===!1)return;c=c&&S.synchronous;const w=n.transitional||YR;w&&w.legacyInterceptorReqResOrdering?s.unshift(S.fulfilled,S.rejected):s.push(S.fulfilled,S.rejected)});const f=[];this.interceptors.response.forEach(function(S){f.push(S.fulfilled,S.rejected)});let u,h=0,g;if(!c){const b=[iw.bind(this),void 0];for(b.unshift(...s),b.push(...f),g=b.length,u=Promise.resolve(n);h<g;)u=u.then(b[h++],b[h++]);return u}g=s.length;let y=n;for(;h<g;){const b=s[h++],S=s[h++];try{y=b?b(y):y}catch(w){if(!S){u=Promise.reject(w);break}try{const x=S.call(this,w);Pe.isThenable(x)&&(u=Promise.resolve(x).then(()=>iw.call(this,y)))}catch(x){u=Promise.reject(x)}break}}if(!u)try{u=iw.call(this,y)}catch(b){u=Promise.reject(b)}for(h=0,g=f.length;h<g;)u=u.then(f[h++],f[h++]);return u}getUri(t){t=Ed(this.defaults,t);const n=A5(t.baseURL,t.url,t.allowAbsoluteUrls,t);return k5(n,t.params,t.paramsSerializer)}};Pe.forEach(["delete","get","head","options"],function(t){pd.prototype[t]=function(n,r){return this.request(Ed(r||{},{method:t,url:n,data:r&&Pe.hasOwnProp(r,"data")?r.data:void 0}))}});Pe.forEach(["post","put","patch","query"],function(t){function n(r){return function(a,i,s){return this.request(Ed(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}pd.prototype[t]=n(),t!=="query"&&(pd.prototype[t+"Form"]=n(!0))});let fee=class L5{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(o=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(s=>{r.subscribe(s),a=s}).then(o);return i.cancel=function(){r.unsubscribe(a)},i},t(function(a,i,s){r.reason||(r.reason=new my(a,i,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new L5(function(o){t=o}),cancel:t}}};function pee(e){return function(n){return e.apply(null,n)}}function hee(e){return Pe.isObject(e)&&e.isAxiosError===!0}const Mb={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Mb).forEach(([e,t])=>{Mb[t]===void 0&&(Mb[t]=e)});function z5(e){const t=new pd(e),n=l5(pd.prototype.request,t);return Pe.extend(n,pd.prototype,t,{allOwnKeys:!0}),Pe.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return z5(Ed(e,o))},n}const Ft=z5(hy);Ft.Axios=pd;Ft.CanceledError=my;Ft.CancelToken=fee;Ft.isCancel=M5;Ft.VERSION=GR;Ft.toFormData=dx;Ft.AxiosError=Ht;Ft.Cancel=Ft.CanceledError;Ft.all=function(t){return Promise.all(t)};Ft.spread=pee;Ft.isAxiosError=hee;Ft.mergeConfig=Ed;Ft.AxiosHeaders=ga;Ft.formToJSON=e=>T5(Pe.isHTMLForm(e)?new FormData(e):e);Ft.getAdapter=I5.getAdapter;Ft.HttpStatusCode=Mb;Ft.default=Ft;const{Axios:OSe,AxiosError:PSe,CanceledError:ASe,isCancel:DSe,CancelToken:jSe,VERSION:NSe,all:ISe,Cancel:LSe,isAxiosError:zSe,spread:FSe,toFormData:_Se,AxiosHeaders:USe,HttpStatusCode:BSe,formToJSON:VSe,getAdapter:HSe,mergeConfig:qSe,create:WSe}=Ft,XP="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",yi={radius:{control:"6px",tile:"8px",menu:"10px",dialog:"12px"},size:{control:32,chip:24},type:{pageTitle:{fontSize:24,fontWeight:600,letterSpacing:"-0.01em"},tileTitle:{fontSize:14,fontWeight:600,lineHeight:1.4},prose:{fontSize:15,lineHeight:1.6},control:{fontSize:13,fontWeight:500},caption:{fontSize:12,lineHeight:1.4},label:{fontSize:12,fontWeight:600,lineHeight:1.4},code:{fontSize:11.5,fontFamily:XP}},font:{mono:XP},shadow:{menu:"0 8px 24px rgba(16, 24, 40, 0.12)"}};function mee(e){if(!e)return yi;const t={...yi.font,...e.font},n={...yi.type};n.code={...n.code,fontFamily:t.mono};for(const[r,o]of Object.entries(e.type??{}))n[r]={...n[r],...o};return{radius:{...yi.radius,...e.radius},size:{...yi.size,...e.size},type:n,font:t,shadow:{...yi.shadow,...e.shadow}}}const qr={blue:"#2563eb",violet:"#7c3aed",pink:"#be185d",red:"#dc2626",orange:"#c2410c",amber:"#b45309",lime:"#4d7c0f",emerald:"#059669",teal:"#0f766e",cyan:"#0e7490"},XR={environment:qr.emerald,package:qr.teal,connection:qr.orange},Uo='"JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", monospace',gee=dt(dY)({display:"flex",flexDirection:"column",height:"100%",boxShadow:"none",border:"none",backgroundColor:"transparent"}),yee=dt(mY)({display:"flex",flexDirection:"column",padding:"0",flexGrow:1}),F5=dt(SY)({padding:"0"}),_5=dt("div")({backgroundColor:"transparent",paddingTop:"12px",paddingBottom:"2px",borderRadius:"8px",border:"none",boxShadow:"none",marginBottom:"0"}),vee=dt("div")({height:"100%"}),U5=dt("div")({height:"75vh",width:"100%",overflowY:"auto"}),bee={light:{accent:qr.blue,accentHover:"#1d4ed8",accentContrast:"#ffffff"},dark:{accent:"#60a5fa",accentHover:"#93c5fd",accentContrast:"#0f172a"}},xee={light:"#ffffff",dark:"#0f172a"},See=3,gg=e=>{const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return;const n=t[1].length===3?[...t[1]].map(r=>r+r).join(""):t[1];return[0,2,4].map(r=>parseInt(n.slice(r,r+2),16))},B5=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`,zC=(e,t,n)=>B5(e.map(r=>r+(t-r)*n)),FC=e=>{const[t,n,r]=e.map(o=>{const a=o/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r},n0=(e,t)=>{const[n,r]=[FC(e),FC(t)].sort((o,a)=>a-o);return(n+.05)/(r+.05)},wee=[15,23,42];function _C(e,t,n=See){const r=gg(e),o=gg(t);if(!r||!o||n0(r,o)>=n)return e;const a=FC(o)<.5?255:0;for(let i=.05;i<1;i+=.05){const s=gg(zC(r,a,i));if(s&&n0(s,o)>=n)return B5(s)}return a===255?"#ffffff":"#000000"}function UC(e,t,n=xee[t]){const r=bee[t];if(!e||e.toLowerCase()===qr.blue)return r;if(!gg(e))return t==="light"?{...r,accent:e,accentHover:e}:r;const o=_C(e,n),a=gg(o),i=t==="dark"?zC(a,255,.25):zC(a,0,.2),s=n0(a,[255,255,255]),c=n0(a,wee);return{accent:o,accentHover:i,accentContrast:s>=c?"#ffffff":"#0f172a"}}const Cee=[qr.blue,qr.orange,qr.emerald,qr.pink,qr.violet,qr.amber,qr.cyan,qr.lime],kee="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",BC={palette:{series:Cee,background:{light:"#ffffff",dark:"#0f172a"},tableHeader:{light:"#475569",dark:"#cbd5e1"},tableHeaderBackground:{light:"#f8fafc",dark:"#1e293b"},tableBody:{light:"#475569",dark:"#e2e8f0"},tile:{light:"#ffffff",dark:"#0f172a"},tileTitle:{light:"#475569",dark:"#94a3b8"},mapColor:{light:qr.blue,dark:qr.blue},border:{light:"#e2e8f0",dark:"#334155"},cardBorder:{light:"#cbd5e1",dark:"#475569"},axis:{light:"#cbd5e1",dark:"#475569"},gridline:{light:"#cbd5e1",dark:"#475569"},chartText:{light:"#0f172a",dark:"#e2e8f0"},value:{light:"#0f172a",dark:"#f1f5f9"}},font:{family:kee,size:12}},Ree=["background","tableHeader","tableHeaderBackground","tableBody","tile","tileTitle","mapColor","border","cardBorder","axis","gridline","chartText","value"];function V5(e,t){const n=BC.palette??{},r=BC.font??{family:"sans-serif",size:12};let o=[...n.series??[]],a=!1,i=r.family??"sans-serif",s=r.size??12;const c={background:{...n.background??{}},tableHeader:{...n.tableHeader??{}},tableHeaderBackground:{...n.tableHeaderBackground??{}},tableBody:{...n.tableBody??{}},tile:{...n.tile??{}},tileTitle:{...n.tileTitle??{}},mapColor:{...n.mapColor??{}},border:{...n.border??{}},cardBorder:{...n.cardBorder??{}},axis:{...n.axis??{}},gridline:{...n.gridline??{}},chartText:{...n.chartText??{}},value:{...n.value??{}}},f={light:new Set,dark:new Set};for(const b of e)if(b){Array.isArray(b.palette?.series)&&(o=[...b.palette.series],a=!0);for(const S of Ree){const w=b.palette?.[S];w&&(c[S]={...c[S],...w},w.light!==void 0&&f.light.add(S),w.dark!==void 0&&f.dark.add(S))}typeof b.font?.family=="string"&&(i=b.font.family),typeof b.font?.size=="number"&&(s=b.font.size)}const u=t==="dark",h=b=>c[b][t]??n[b]?.[t],g=h("background"),y=u&&f.light.has("mapColor")&&!f.dark.has("mapColor")?_C(c.mapColor.light,g):h("mapColor");return{mode:t,ui:yi,series:u&&a?o.map(b=>_C(b,g)):o,...UC(o[0],t,g),font:{family:i,size:s},background:g,tableHeader:h("tableHeader"),tableHeaderBackground:h("tableHeaderBackground"),tableBody:h("tableBody"),tile:h("tile"),tileTitle:h("tileTitle"),mapColor:y,tableBackground:g,border:`1px solid ${h("border")}`,cardBorder:`1px solid ${h("cardBorder")}`,pinnedBorder:`1px solid ${h("cardBorder")}`,valueColor:h("value"),foreground:h("chartText"),axisFaint:h("axis"),gridline:h("gridline"),shadow:u?{lift:"0 2px 12px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08)",drag:"0 12px 32px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.12)"}:{lift:"0 2px 10px rgba(0, 0, 0, 0.10)",drag:"0 12px 32px rgba(0, 0, 0, 0.22)"},dashboardRoot:u?"#0f172a":"#ffffff",drillLink:UC(void 0,t).accent}}function YSe(e,t){const n=t.palette?.series;if(!Array.isArray(n)||n.length!==1)return t;const r=n[0],o=e.reduce((f,u)=>Array.isArray(u?.palette?.series)?u.palette.series:f,BC.palette?.series??[]),a=f=>f.toLowerCase()===r.toLowerCase(),[i,...s]=o,c=s.length>0?s.map(f=>a(f)?i:f):[i].filter(f=>f!==void 0&&!a(f));return{...t,palette:{...t.palette,series:[r,...c]}}}function Eee(e,t,n){const r=t??e??"light";return r==="auto"?n?"dark":"light":r}const H5=C.createContext(void 0);function Tee({layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o=!0,ui:a,children:i}){const s=JSON.stringify(a??null),c=C.useMemo(()=>mee(a),[s]),f=C.useMemo(()=>({...V5(e,t),ui:c}),[e,t,c]),u=C.useMemo(()=>({theme:f,layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o}),[f,e,t,n,r,o]);return m.jsx(H5.Provider,{value:u,children:i})}function eo(){return C.useContext(H5)||{theme:V5([],"light"),layers:[],mode:"light",userChoice:void 0,setMode:()=>{},allowUserToggle:!1}}const pn="http://localhost/api/v0".replace(/\/+$/,"");let $i=class{constructor(t,n=pn,r=Ft){this.basePath=n,this.axios=r,t&&(this.configuration=t,this.basePath=t.basePath??n)}configuration},$ee=class extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}};const gn={},yn="https://example.com",et=function(e,t,n){if(n==null)throw new $ee(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function VC(e,t,n=""){t!=null&&(typeof t=="object"?Array.isArray(t)||t instanceof Set?t.forEach(r=>VC(e,r,n)):Object.keys(t).forEach(r=>VC(e,t[r],`${n}${n!==""?".":""}${r}`)):e.has(n)?e.append(n,t):e.set(n,t))}const vn=function(e,...t){const n=new URLSearchParams(e.search);VC(n,t),e.search=n.toString()},Mee=function(e,t){return t instanceof Set?Array.from(t):t},Eo=function(e,t,n){const r=typeof e!="string";return(r&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):r)?JSON.stringify(e!==void 0?e:{},Mee):e||""},bn=function(e){return e.pathname+e.search+e.hash},xn=function(e,t,n,r){return(o=t,a=n)=>{const i={...e.options,url:(o.defaults.baseURL?"":r?.basePath??a)+e.url};return o.request(i)}},q5={Bigquery:"bigquery",Snowflake:"snowflake",Postgres:"postgres",Gcs:"gcs",S3:"s3",Azure:"azure"},ZP={Postgres:"postgres",Bigquery:"bigquery",Snowflake:"snowflake",Trino:"trino",Databricks:"databricks",Mysql:"mysql",Sqlserver:"sqlserver",Duckdb:"duckdb",Motherduck:"motherduck",Ducklake:"ducklake",Publisher:"publisher"},Ra={Pending:"PENDING",ManifestRowsReady:"MANIFEST_ROWS_READY",ManifestFileReady:"MANIFEST_FILE_READY",Failed:"FAILED",Cancelled:"CANCELLED"},Wv={Version:"version",Package:"package"},Oee=function(e){return{createConnection:async(t,n,r,o={})=>{et("createConnection","environmentName",t),et("createConnection","connectionName",n),et("createConnection","connection",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}},deleteConnection:async(t,n,r={})=>{et("deleteConnection","environmentName",t),et("deleteConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},c={},f={};c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},{url:bn(a),options:s}},getConnection:async(t,n,r={})=>{et("getConnection","environmentName",t),et("getConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},c={},f={};c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},{url:bn(a),options:s}},getTable:async(t,n,r,o,a={})=>{et("getTable","environmentName",t),et("getTable","connectionName",n),et("getTable","schemaName",r),et("getTable","tablePath",o);const i="/environments/{environmentName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))).replace("{tablePath}",encodeURIComponent(String(o))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},getTableInPackage:async(t,n,r,o,a,i,s={})=>{et("getTableInPackage","environmentName",t),et("getTableInPackage","packageName",n),et("getTableInPackage","connectionName",r),et("getTableInPackage","schemaName",o),et("getTableInPackage","tablePath",a);const c="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))).replace("{schemaName}",encodeURIComponent(String(o))).replace("{tablePath}",encodeURIComponent(String(a))),f=new URL(c,yn);let u;e&&(u=e.baseOptions);const h={method:"GET",...u,...s},g={},y={};i!==void 0&&(y.versionId=i),g.Accept="application/json",vn(f,y);let b=u&&u.headers?u.headers:{};return h.headers={...g,...b,...s.headers},{url:bn(f),options:h}},listConnections:async(t,n={})=>{et("listConnections","environmentName",t);const r="/environments/{environmentName}/connections".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},c={};s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},{url:bn(o),options:i}},listSchemas:async(t,n,r={})=>{et("listSchemas","environmentName",t),et("listSchemas","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},c={},f={};c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},{url:bn(a),options:s}},listSchemasInPackage:async(t,n,r,o,a={})=>{et("listSchemasInPackage","environmentName",t),et("listSchemasInPackage","packageName",n),et("listSchemasInPackage","connectionName",r);const i="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};o!==void 0&&(h.versionId=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listTables:async(t,n,r,o,a={})=>{et("listTables","environmentName",t),et("listTables","connectionName",n),et("listTables","schemaName",r);const i="/environments/{environmentName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};o&&(h.tableNames=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listTablesInPackage:async(t,n,r,o,a,i,s={})=>{et("listTablesInPackage","environmentName",t),et("listTablesInPackage","packageName",n),et("listTablesInPackage","connectionName",r),et("listTablesInPackage","schemaName",o);const c="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))).replace("{schemaName}",encodeURIComponent(String(o))),f=new URL(c,yn);let u;e&&(u=e.baseOptions);const h={method:"GET",...u,...s},g={},y={};a&&(y.tableNames=a),i!==void 0&&(y.versionId=i),g.Accept="application/json",vn(f,y);let b=u&&u.headers?u.headers:{};return h.headers={...g,...b,...s.headers},{url:bn(f),options:h}},postQuerydata:async(t,n,r,o={})=>{et("postQuerydata","environmentName",t),et("postQuerydata","connectionName",n),et("postQuerydata","postQuerydataRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}},postQuerydataInPackage:async(t,n,r,o,a,i={})=>{et("postQuerydataInPackage","environmentName",t),et("postQuerydataInPackage","packageName",n),et("postQuerydataInPackage","connectionName",r),et("postQuerydataInPackage","postQuerydataRequest",o);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"POST",...f,...i},h={},g={};a!==void 0&&(g.versionId=a),h["Content-Type"]="application/json",h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},u.data=Eo(o,u,e),{url:bn(c),options:u}},postSqlsource:async(t,n,r,o={})=>{et("postSqlsource","environmentName",t),et("postSqlsource","connectionName",n),et("postSqlsource","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}},postSqlsourceInPackage:async(t,n,r,o,a,i={})=>{et("postSqlsourceInPackage","environmentName",t),et("postSqlsourceInPackage","packageName",n),et("postSqlsourceInPackage","connectionName",r),et("postSqlsourceInPackage","postSqlsourceRequest",o);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"POST",...f,...i},h={},g={};a!==void 0&&(g.versionId=a),h["Content-Type"]="application/json",h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},u.data=Eo(o,u,e),{url:bn(c),options:u}},postTemporarytable:async(t,n,r,o={})=>{et("postTemporarytable","environmentName",t),et("postTemporarytable","connectionName",n),et("postTemporarytable","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}},postTemporarytableInPackage:async(t,n,r,o,a,i={})=>{et("postTemporarytableInPackage","environmentName",t),et("postTemporarytableInPackage","packageName",n),et("postTemporarytableInPackage","connectionName",r),et("postTemporarytableInPackage","postSqlsourceRequest",o);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"POST",...f,...i},h={},g={};a!==void 0&&(g.versionId=a),h["Content-Type"]="application/json",h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},u.data=Eo(o,u,e),{url:bn(c),options:u}},updateConnection:async(t,n,r,o={})=>{et("updateConnection","environmentName",t),et("updateConnection","connectionName",n),et("updateConnection","updateConnectionRequest",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"PATCH",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}}}},oa=function(e){const t=Oee(e);return{async createConnection(n,r,o,a){const i=await t.createConnection(n,r,o,a),s=e?.serverIndex??0,c=gn["ConnectionsApi.createConnection"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async deleteConnection(n,r,o){const a=await t.deleteConnection(n,r,o),i=e?.serverIndex??0,s=gn["ConnectionsApi.deleteConnection"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async getConnection(n,r,o){const a=await t.getConnection(n,r,o),i=e?.serverIndex??0,s=gn["ConnectionsApi.getConnection"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async getTable(n,r,o,a,i){const s=await t.getTable(n,r,o,a,i),c=e?.serverIndex??0,f=gn["ConnectionsApi.getTable"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async getTableInPackage(n,r,o,a,i,s,c){const f=await t.getTableInPackage(n,r,o,a,i,s,c),u=e?.serverIndex??0,h=gn["ConnectionsApi.getTableInPackage"]?.[u]?.url;return(g,y)=>xn(f,Ft,pn,e)(g,h||y)},async listConnections(n,r){const o=await t.listConnections(n,r),a=e?.serverIndex??0,i=gn["ConnectionsApi.listConnections"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)},async listSchemas(n,r,o){const a=await t.listSchemas(n,r,o),i=e?.serverIndex??0,s=gn["ConnectionsApi.listSchemas"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async listSchemasInPackage(n,r,o,a,i){const s=await t.listSchemasInPackage(n,r,o,a,i),c=e?.serverIndex??0,f=gn["ConnectionsApi.listSchemasInPackage"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listTables(n,r,o,a,i){const s=await t.listTables(n,r,o,a,i),c=e?.serverIndex??0,f=gn["ConnectionsApi.listTables"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listTablesInPackage(n,r,o,a,i,s,c){const f=await t.listTablesInPackage(n,r,o,a,i,s,c),u=e?.serverIndex??0,h=gn["ConnectionsApi.listTablesInPackage"]?.[u]?.url;return(g,y)=>xn(f,Ft,pn,e)(g,h||y)},async postQuerydata(n,r,o,a){const i=await t.postQuerydata(n,r,o,a),s=e?.serverIndex??0,c=gn["ConnectionsApi.postQuerydata"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async postQuerydataInPackage(n,r,o,a,i,s){const c=await t.postQuerydataInPackage(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ConnectionsApi.postQuerydataInPackage"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async postSqlsource(n,r,o,a){const i=await t.postSqlsource(n,r,o,a),s=e?.serverIndex??0,c=gn["ConnectionsApi.postSqlsource"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async postSqlsourceInPackage(n,r,o,a,i,s){const c=await t.postSqlsourceInPackage(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ConnectionsApi.postSqlsourceInPackage"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async postTemporarytable(n,r,o,a){const i=await t.postTemporarytable(n,r,o,a),s=e?.serverIndex??0,c=gn["ConnectionsApi.postTemporarytable"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async postTemporarytableInPackage(n,r,o,a,i,s){const c=await t.postTemporarytableInPackage(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ConnectionsApi.postTemporarytableInPackage"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async updateConnection(n,r,o,a){const i=await t.updateConnection(n,r,o,a),s=e?.serverIndex??0,c=gn["ConnectionsApi.updateConnection"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let Pee=class extends $i{createConnection(t,n,r,o){return oa(this.configuration).createConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteConnection(t,n,r){return oa(this.configuration).deleteConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getConnection(t,n,r){return oa(this.configuration).getConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getTable(t,n,r,o,a){return oa(this.configuration).getTable(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getTableInPackage(t,n,r,o,a,i,s){return oa(this.configuration).getTableInPackage(t,n,r,o,a,i,s).then(c=>c(this.axios,this.basePath))}listConnections(t,n){return oa(this.configuration).listConnections(t,n).then(r=>r(this.axios,this.basePath))}listSchemas(t,n,r){return oa(this.configuration).listSchemas(t,n,r).then(o=>o(this.axios,this.basePath))}listSchemasInPackage(t,n,r,o,a){return oa(this.configuration).listSchemasInPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listTables(t,n,r,o,a){return oa(this.configuration).listTables(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listTablesInPackage(t,n,r,o,a,i,s){return oa(this.configuration).listTablesInPackage(t,n,r,o,a,i,s).then(c=>c(this.axios,this.basePath))}postQuerydata(t,n,r,o){return oa(this.configuration).postQuerydata(t,n,r,o).then(a=>a(this.axios,this.basePath))}postQuerydataInPackage(t,n,r,o,a,i){return oa(this.configuration).postQuerydataInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}postSqlsource(t,n,r,o){return oa(this.configuration).postSqlsource(t,n,r,o).then(a=>a(this.axios,this.basePath))}postSqlsourceInPackage(t,n,r,o,a,i){return oa(this.configuration).postSqlsourceInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}postTemporarytable(t,n,r,o){return oa(this.configuration).postTemporarytable(t,n,r,o).then(a=>a(this.axios,this.basePath))}postTemporarytableInPackage(t,n,r,o,a,i){return oa(this.configuration).postTemporarytableInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}updateConnection(t,n,r,o){return oa(this.configuration).updateConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Aee=function(e){return{getDashboard:async(t,n,r,o,a={})=>{et("getDashboard","environmentName",t),et("getDashboard","packageName",n),et("getDashboard","dashboardName",r);const i="/environments/{environmentName}/packages/{packageName}/dashboards/{dashboardName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{dashboardName}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};o!==void 0&&(h.versionId=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listDashboards:async(t,n,r,o={})=>{et("listDashboards","environmentName",t),et("listDashboards","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/dashboards".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};r!==void 0&&(u.versionId=r),f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}}}},JP=function(e){const t=Aee(e);return{async getDashboard(n,r,o,a,i){const s=await t.getDashboard(n,r,o,a,i),c=e?.serverIndex??0,f=gn["DashboardsApi.getDashboard"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listDashboards(n,r,o,a){const i=await t.listDashboards(n,r,o,a),s=e?.serverIndex??0,c=gn["DashboardsApi.listDashboards"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let Dee=class extends $i{getDashboard(t,n,r,o,a){return JP(this.configuration).getDashboard(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listDashboards(t,n,r,o){return JP(this.configuration).listDashboards(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const jee=function(e){return{listDataApps:async(t,n,r,o={})=>{et("listDataApps","environmentName",t),et("listDataApps","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/data-apps".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};r!==void 0&&(u.versionId=r),f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}}}},Nee=function(e){const t=jee(e);return{async listDataApps(n,r,o,a){const i=await t.listDataApps(n,r,o,a),s=e?.serverIndex??0,c=gn["DataAppsApi.listDataApps"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let Iee=class extends $i{listDataApps(t,n,r,o){return Nee(this.configuration).listDataApps(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Lee=function(e){return{listDatabases:async(t,n,r,o={})=>{et("listDatabases","environmentName",t),et("listDatabases","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/databases".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};r!==void 0&&(u.versionId=r),f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}}}},zee=function(e){const t=Lee(e);return{async listDatabases(n,r,o,a){const i=await t.listDatabases(n,r,o,a),s=e?.serverIndex??0,c=gn["DatabasesApi.listDatabases"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};class Fee extends $i{listDatabases(t,n,r,o){return zee(this.configuration).listDatabases(t,n,r,o).then(a=>a(this.axios,this.basePath))}}const _ee=function(e){return{createEnvironment:async(t,n={})=>{et("createEnvironment","environment",t);const r="/environments",o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},c={};s["Content-Type"]="application/json",s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},i.data=Eo(t,i,e),{url:bn(o),options:i}},deleteEnvironment:async(t,n={})=>{et("deleteEnvironment","environmentName",t);const r="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"DELETE",...a,...n},s={},c={};s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},{url:bn(o),options:i}},getEnvironment:async(t,n,r={})=>{et("getEnvironment","environmentName",t);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},c={},f={};n!==void 0&&(f.reload=n),c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},{url:bn(a),options:s}},listEnvironments:async(t={})=>{const n="/environments",r=new URL(n,yn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",vn(r,s);let c=o&&o.headers?o.headers:{};return a.headers={...i,...c,...t.headers},{url:bn(r),options:a}},updateEnvironment:async(t,n,r={})=>{et("updateEnvironment","environmentName",t),et("updateEnvironment","environment",n);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"PATCH",...i,...r},c={},f={};c["Content-Type"]="application/json",c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},s.data=Eo(n,s,e),{url:bn(a),options:s}}}},vm=function(e){const t=_ee(e);return{async createEnvironment(n,r){const o=await t.createEnvironment(n,r),a=e?.serverIndex??0,i=gn["EnvironmentsApi.createEnvironment"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)},async deleteEnvironment(n,r){const o=await t.deleteEnvironment(n,r),a=e?.serverIndex??0,i=gn["EnvironmentsApi.deleteEnvironment"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)},async getEnvironment(n,r,o){const a=await t.getEnvironment(n,r,o),i=e?.serverIndex??0,s=gn["EnvironmentsApi.getEnvironment"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async listEnvironments(n){const r=await t.listEnvironments(n),o=e?.serverIndex??0,a=gn["EnvironmentsApi.listEnvironments"]?.[o]?.url;return(i,s)=>xn(r,Ft,pn,e)(i,a||s)},async updateEnvironment(n,r,o){const a=await t.updateEnvironment(n,r,o),i=e?.serverIndex??0,s=gn["EnvironmentsApi.updateEnvironment"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)}}};let Uee=class extends $i{createEnvironment(t,n){return vm(this.configuration).createEnvironment(t,n).then(r=>r(this.axios,this.basePath))}deleteEnvironment(t,n){return vm(this.configuration).deleteEnvironment(t,n).then(r=>r(this.axios,this.basePath))}getEnvironment(t,n,r){return vm(this.configuration).getEnvironment(t,n,r).then(o=>o(this.axios,this.basePath))}listEnvironments(t){return vm(this.configuration).listEnvironments(t).then(n=>n(this.axios,this.basePath))}updateEnvironment(t,n,r){return vm(this.configuration).updateEnvironment(t,n,r).then(o=>o(this.axios,this.basePath))}};const Bee=function(e){return{createMaterialization:async(t,n,r,o={})=>{et("createMaterialization","environmentName",t),et("createMaterialization","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}},deleteMaterialization:async(t,n,r,o,a,i={})=>{et("deleteMaterialization","environmentName",t),et("deleteMaterialization","packageName",n),et("deleteMaterialization","materializationId",r);const s="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{materializationId}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"DELETE",...f,...i},h={},g={};o!==void 0&&(g.dropTables=o),a!==void 0&&(g.versionId=a),h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},{url:bn(c),options:u}},getMaterialization:async(t,n,r,o,a={})=>{et("getMaterialization","environmentName",t),et("getMaterialization","packageName",n),et("getMaterialization","materializationId",r);const i="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{materializationId}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};o!==void 0&&(h.versionId=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listMaterializations:async(t,n,r,o,a,i={})=>{et("listMaterializations","environmentName",t),et("listMaterializations","packageName",n);const s="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"GET",...f,...i},h={},g={};r!==void 0&&(g.limit=r),o!==void 0&&(g.offset=o),a!==void 0&&(g.versionId=a),h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},{url:bn(c),options:u}},materializationAction:async(t,n,r,o,a,i={})=>{et("materializationAction","environmentName",t),et("materializationAction","packageName",n),et("materializationAction","materializationId",r),et("materializationAction","action",o);const s="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{materializationId}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"POST",...f,...i},h={},g={};o!==void 0&&(g.action=o),a!==void 0&&(g.versionId=a),h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},{url:bn(c),options:u}}}},bm=function(e){const t=Bee(e);return{async createMaterialization(n,r,o,a){const i=await t.createMaterialization(n,r,o,a),s=e?.serverIndex??0,c=gn["MaterializationsApi.createMaterialization"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async deleteMaterialization(n,r,o,a,i,s){const c=await t.deleteMaterialization(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["MaterializationsApi.deleteMaterialization"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async getMaterialization(n,r,o,a,i){const s=await t.getMaterialization(n,r,o,a,i),c=e?.serverIndex??0,f=gn["MaterializationsApi.getMaterialization"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listMaterializations(n,r,o,a,i,s){const c=await t.listMaterializations(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["MaterializationsApi.listMaterializations"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async materializationAction(n,r,o,a,i,s){const c=await t.materializationAction(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["MaterializationsApi.materializationAction"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)}}};let Vee=class extends $i{createMaterialization(t,n,r,o){return bm(this.configuration).createMaterialization(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteMaterialization(t,n,r,o,a,i){return bm(this.configuration).deleteMaterialization(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}getMaterialization(t,n,r,o,a){return bm(this.configuration).getMaterialization(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listMaterializations(t,n,r,o,a,i){return bm(this.configuration).listMaterializations(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}materializationAction(t,n,r,o,a,i){return bm(this.configuration).materializationAction(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const Hee={Stop:"stop"},qee=function(e){return{compileModelSource:async(t,n,r,o,a,i={})=>{et("compileModelSource","environmentName",t),et("compileModelSource","packageName",n),et("compileModelSource","path",r),et("compileModelSource","compileRequest",o);const s="/environments/{environmentName}/packages/{packageName}/models/{path}/compile".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"POST",...f,...i},h={},g={};a!==void 0&&(g.versionId=a),h["Content-Type"]="application/json",h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},u.data=Eo(o,u,e),{url:bn(c),options:u}},executeQueryModel:async(t,n,r,o,a,i={})=>{et("executeQueryModel","environmentName",t),et("executeQueryModel","packageName",n),et("executeQueryModel","path",r),et("executeQueryModel","queryRequest",o);const s="/environments/{environmentName}/packages/{packageName}/models/{path}/query".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"POST",...f,...i},h={},g={};a!==void 0&&(g.includeHiddenFilesAndSources=a),h["Content-Type"]="application/json",h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},u.data=Eo(o,u,e),{url:bn(c),options:u}},getModel:async(t,n,r,o,a,i={})=>{et("getModel","environmentName",t),et("getModel","packageName",n),et("getModel","path",r);const s="/environments/{environmentName}/packages/{packageName}/models/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"GET",...f,...i},h={},g={};o!==void 0&&(g.versionId=o),a!==void 0&&(g.includeHiddenFilesAndSources=a),h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},{url:bn(c),options:u}},listModels:async(t,n,r,o,a={})=>{et("listModels","environmentName",t),et("listModels","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/models".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};r!==void 0&&(h.versionId=r),o!==void 0&&(h.includeHiddenFilesAndSources=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},updateModelSource:async(t,n,r,o,a,i={})=>{et("updateModelSource","environmentName",t),et("updateModelSource","packageName",n),et("updateModelSource","path",r),et("updateModelSource","modelSourceWriteRequest",o);const s="/environments/{environmentName}/packages/{packageName}/models/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"PUT",...f,...i},h={},g={};a!==void 0&&(g.versionId=a),h["Content-Type"]="application/json",h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},u.data=Eo(o,u,e),{url:bn(c),options:u}}}},xm=function(e){const t=qee(e);return{async compileModelSource(n,r,o,a,i,s){const c=await t.compileModelSource(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ModelsApi.compileModelSource"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async executeQueryModel(n,r,o,a,i,s){const c=await t.executeQueryModel(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ModelsApi.executeQueryModel"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async getModel(n,r,o,a,i,s){const c=await t.getModel(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ModelsApi.getModel"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async listModels(n,r,o,a,i){const s=await t.listModels(n,r,o,a,i),c=e?.serverIndex??0,f=gn["ModelsApi.listModels"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async updateModelSource(n,r,o,a,i,s){const c=await t.updateModelSource(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ModelsApi.updateModelSource"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)}}};let Wee=class extends $i{compileModelSource(t,n,r,o,a,i){return xm(this.configuration).compileModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}executeQueryModel(t,n,r,o,a,i){return xm(this.configuration).executeQueryModel(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}getModel(t,n,r,o,a,i){return xm(this.configuration).getModel(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}listModels(t,n,r,o,a){return xm(this.configuration).listModels(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updateModelSource(t,n,r,o,a,i){return xm(this.configuration).updateModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const Yee=function(e){return{executeNotebookCell:async(t,n,r,o,a,i,s,c,f={})=>{et("executeNotebookCell","environmentName",t),et("executeNotebookCell","packageName",n),et("executeNotebookCell","path",r),et("executeNotebookCell","cellIndex",o);const u="/environments/{environmentName}/packages/{packageName}/notebooks/{path}/cells/{cellIndex}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))).replace("{cellIndex}",encodeURIComponent(String(o))),h=new URL(u,yn);let g;e&&(g=e.baseOptions);const y={method:"GET",...g,...f},b={},S={};a!==void 0&&(S.versionId=a),i!==void 0&&(S.filter_params=i),s!==void 0&&(S.bypass_filters=s),c!==void 0&&(S.givens=c),b.Accept="application/json",vn(h,S);let w=g&&g.headers?g.headers:{};return y.headers={...b,...w,...f.headers},{url:bn(h),options:y}},getNotebook:async(t,n,r,o,a={})=>{et("getNotebook","environmentName",t),et("getNotebook","packageName",n),et("getNotebook","path",r);const i="/environments/{environmentName}/packages/{packageName}/notebooks/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};o!==void 0&&(h.versionId=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listNotebooks:async(t,n,r,o={})=>{et("listNotebooks","environmentName",t),et("listNotebooks","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/notebooks".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};r!==void 0&&(u.versionId=r),f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}}}},sw=function(e){const t=Yee(e);return{async executeNotebookCell(n,r,o,a,i,s,c,f,u){const h=await t.executeNotebookCell(n,r,o,a,i,s,c,f,u),g=e?.serverIndex??0,y=gn["NotebooksApi.executeNotebookCell"]?.[g]?.url;return(b,S)=>xn(h,Ft,pn,e)(b,y||S)},async getNotebook(n,r,o,a,i){const s=await t.getNotebook(n,r,o,a,i),c=e?.serverIndex??0,f=gn["NotebooksApi.getNotebook"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listNotebooks(n,r,o,a){const i=await t.listNotebooks(n,r,o,a),s=e?.serverIndex??0,c=gn["NotebooksApi.listNotebooks"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let Kee=class extends $i{executeNotebookCell(t,n,r,o,a,i,s,c,f){return sw(this.configuration).executeNotebookCell(t,n,r,o,a,i,s,c,f).then(u=>u(this.axios,this.basePath))}getNotebook(t,n,r,o,a){return sw(this.configuration).getNotebook(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listNotebooks(t,n,r,o){return sw(this.configuration).listNotebooks(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Gee=function(e){return{createPackage:async(t,n,r={})=>{et("createPackage","environmentName",t),et("createPackage","_package",n);const o="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"POST",...i,...r},c={},f={};c["Content-Type"]="application/json",c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},s.data=Eo(n,s,e),{url:bn(a),options:s}},deletePackage:async(t,n,r={})=>{et("deletePackage","environmentName",t),et("deletePackage","packageName",n);const o="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},c={},f={};c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},{url:bn(a),options:s}},getPackage:async(t,n,r,o,a={})=>{et("getPackage","environmentName",t),et("getPackage","packageName",n);const i="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};r!==void 0&&(h.versionId=r),o!==void 0&&(h.reload=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listPackages:async(t,n={})=>{et("listPackages","environmentName",t);const r="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},c={};s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},{url:bn(o),options:i}},updatePackage:async(t,n,r,o={})=>{et("updatePackage","environmentName",t),et("updatePackage","packageName",n),et("updatePackage","_package",r);const a="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"PATCH",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}}}},Sm=function(e){const t=Gee(e);return{async createPackage(n,r,o){const a=await t.createPackage(n,r,o),i=e?.serverIndex??0,s=gn["PackagesApi.createPackage"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async deletePackage(n,r,o){const a=await t.deletePackage(n,r,o),i=e?.serverIndex??0,s=gn["PackagesApi.deletePackage"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async getPackage(n,r,o,a,i){const s=await t.getPackage(n,r,o,a,i),c=e?.serverIndex??0,f=gn["PackagesApi.getPackage"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listPackages(n,r){const o=await t.listPackages(n,r),a=e?.serverIndex??0,i=gn["PackagesApi.listPackages"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)},async updatePackage(n,r,o,a){const i=await t.updatePackage(n,r,o,a),s=e?.serverIndex??0,c=gn["PackagesApi.updatePackage"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let Qee=class extends $i{createPackage(t,n,r){return Sm(this.configuration).createPackage(t,n,r).then(o=>o(this.axios,this.basePath))}deletePackage(t,n,r){return Sm(this.configuration).deletePackage(t,n,r).then(o=>o(this.axios,this.basePath))}getPackage(t,n,r,o,a){return Sm(this.configuration).getPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listPackages(t,n){return Sm(this.configuration).listPackages(t,n).then(r=>r(this.axios,this.basePath))}updatePackage(t,n,r,o){return Sm(this.configuration).updatePackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Xee=function(e){return{deleteTheme:async(t={})=>{const n="/theme",r=new URL(n,yn);let o;e&&(o=e.baseOptions);const a={method:"DELETE",...o,...t},i={},s={};i.Accept="application/json",vn(r,s);let c=o&&o.headers?o.headers:{};return a.headers={...i,...c,...t.headers},{url:bn(r),options:a}},getStatus:async(t,n={})=>{const r="/status",o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},c={};t!==void 0&&(c.includeLoading=t),s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},{url:bn(o),options:i}},getTheme:async(t={})=>{const n="/theme",r=new URL(n,yn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",vn(r,s);let c=o&&o.headers?o.headers:{};return a.headers={...i,...c,...t.headers},{url:bn(r),options:a}},updateTheme:async(t,n={})=>{et("updateTheme","theme",t);const r="/theme",o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"PUT",...a,...n},s={},c={};s["Content-Type"]="application/json",s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},i.data=Eo(t,i,e),{url:bn(o),options:i}}}},Yv=function(e){const t=Xee(e);return{async deleteTheme(n){const r=await t.deleteTheme(n),o=e?.serverIndex??0,a=gn["PublisherApi.deleteTheme"]?.[o]?.url;return(i,s)=>xn(r,Ft,pn,e)(i,a||s)},async getStatus(n,r){const o=await t.getStatus(n,r),a=e?.serverIndex??0,i=gn["PublisherApi.getStatus"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)},async getTheme(n){const r=await t.getTheme(n),o=e?.serverIndex??0,a=gn["PublisherApi.getTheme"]?.[o]?.url;return(i,s)=>xn(r,Ft,pn,e)(i,a||s)},async updateTheme(n,r){const o=await t.updateTheme(n,r),a=e?.serverIndex??0,i=gn["PublisherApi.updateTheme"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)}}};let Zee=class extends $i{deleteTheme(t){return Yv(this.configuration).deleteTheme(t).then(n=>n(this.axios,this.basePath))}getStatus(t,n){return Yv(this.configuration).getStatus(t,n).then(r=>r(this.axios,this.basePath))}getTheme(t){return Yv(this.configuration).getTheme(t).then(n=>n(this.axios,this.basePath))}updateTheme(t,n){return Yv(this.configuration).updateTheme(t,n).then(r=>r(this.axios,this.basePath))}};const Jee=function(e){return{getReport:async(t,n,r,o,a={})=>{et("getReport","environmentName",t),et("getReport","packageName",n),et("getReport","path",r);const i="/environments/{environmentName}/packages/{packageName}/reports/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};o!==void 0&&(h.versionId=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listReports:async(t,n,r,o={})=>{et("listReports","environmentName",t),et("listReports","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/reports".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};r!==void 0&&(u.versionId=r),f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}}}},eA=function(e){const t=Jee(e);return{async getReport(n,r,o,a,i){const s=await t.getReport(n,r,o,a,i),c=e?.serverIndex??0,f=gn["ReportsApi.getReport"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listReports(n,r,o,a){const i=await t.listReports(n,r,o,a),s=e?.serverIndex??0,c=gn["ReportsApi.listReports"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let ete=class extends $i{getReport(t,n,r,o,a){return eA(this.configuration).getReport(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listReports(t,n,r,o){return eA(this.configuration).listReports(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const tte=function(e){return{deletePackageVersion:async(t,n,r,o={})=>{et("deletePackageVersion","environmentName",t),et("deletePackageVersion","packageName",n),et("deletePackageVersion","version",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{version}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"DELETE",...s,...o},f={},u={};f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}},getPackageVersion:async(t,n,r,o={})=>{et("getPackageVersion","environmentName",t),et("getPackageVersion","packageName",n),et("getPackageVersion","version",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{version}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}},listPackageVersions:async(t,n,r={})=>{et("listPackageVersions","environmentName",t),et("listPackageVersions","packageName",n);const o="/environments/{environmentName}/packages/{packageName}/versions".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},c={},f={};c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},{url:bn(a),options:s}},setPackageLatestVersion:async(t,n,r,o={})=>{et("setPackageLatestVersion","environmentName",t),et("setPackageLatestVersion","packageName",n),et("setPackageLatestVersion","packageLatestVersion",r);const a="/environments/{environmentName}/packages/{packageName}/latest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"PUT",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}},setPackageVersionManifest:async(t,n,r,o,a={})=>{et("setPackageVersionManifest","environmentName",t),et("setPackageVersionManifest","packageName",n),et("setPackageVersionManifest","version",r),et("setPackageVersionManifest","packageVersionManifest",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{version}/manifest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"PUT",...c,...a},u={},h={};u["Content-Type"]="application/json",u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},f.data=Eo(o,f,e),{url:bn(s),options:f}},updatePackageVersion:async(t,n,r,o,a={})=>{et("updatePackageVersion","environmentName",t),et("updatePackageVersion","packageName",n),et("updatePackageVersion","version",r),et("updatePackageVersion","packageVersionUpdate",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{version}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"PATCH",...c,...a},u={},h={};u["Content-Type"]="application/json",u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},f.data=Eo(o,f,e),{url:bn(s),options:f}}}},_f=function(e){const t=tte(e);return{async deletePackageVersion(n,r,o,a){const i=await t.deletePackageVersion(n,r,o,a),s=e?.serverIndex??0,c=gn["VersionsApi.deletePackageVersion"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async getPackageVersion(n,r,o,a){const i=await t.getPackageVersion(n,r,o,a),s=e?.serverIndex??0,c=gn["VersionsApi.getPackageVersion"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async listPackageVersions(n,r,o){const a=await t.listPackageVersions(n,r,o),i=e?.serverIndex??0,s=gn["VersionsApi.listPackageVersions"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async setPackageLatestVersion(n,r,o,a){const i=await t.setPackageLatestVersion(n,r,o,a),s=e?.serverIndex??0,c=gn["VersionsApi.setPackageLatestVersion"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async setPackageVersionManifest(n,r,o,a,i){const s=await t.setPackageVersionManifest(n,r,o,a,i),c=e?.serverIndex??0,f=gn["VersionsApi.setPackageVersionManifest"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async updatePackageVersion(n,r,o,a,i){const s=await t.updatePackageVersion(n,r,o,a,i),c=e?.serverIndex??0,f=gn["VersionsApi.updatePackageVersion"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)}}};let nte=class extends $i{deletePackageVersion(t,n,r,o){return _f(this.configuration).deletePackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageVersion(t,n,r,o){return _f(this.configuration).getPackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}listPackageVersions(t,n,r){return _f(this.configuration).listPackageVersions(t,n,r).then(o=>o(this.axios,this.basePath))}setPackageLatestVersion(t,n,r,o){return _f(this.configuration).setPackageLatestVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}setPackageVersionManifest(t,n,r,o,a){return _f(this.configuration).setPackageVersionManifest(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updatePackageVersion(t,n,r,o,a){return _f(this.configuration).updatePackageVersion(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}};const rte=function(e){return{getWatchStatus:async(t={})=>{const n="/watch-mode/status",r=new URL(n,yn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",vn(r,s);let c=o&&o.headers?o.headers:{};return a.headers={...i,...c,...t.headers},{url:bn(r),options:a}},startWatching:async(t,n={})=>{et("startWatching","startWatchRequest",t);const r="/watch-mode/start",o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},c={};s["Content-Type"]="application/json",s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},i.data=Eo(t,i,e),{url:bn(o),options:i}},stopWatching:async(t={})=>{const n="/watch-mode/stop",r=new URL(n,yn);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...t},i={},s={};i.Accept="application/json",vn(r,s);let c=o&&o.headers?o.headers:{};return a.headers={...i,...c,...t.headers},{url:bn(r),options:a}},streamPackageEvents:async(t,n,r,o={})=>{et("streamPackageEvents","environmentName",t),et("streamPackageEvents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/events".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};r!==void 0&&(u.versionId=r),f.Accept="text/event-stream,application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}}}},Kv=function(e){const t=rte(e);return{async getWatchStatus(n){const r=await t.getWatchStatus(n),o=e?.serverIndex??0,a=gn["WatchModeApi.getWatchStatus"]?.[o]?.url;return(i,s)=>xn(r,Ft,pn,e)(i,a||s)},async startWatching(n,r){const o=await t.startWatching(n,r),a=e?.serverIndex??0,i=gn["WatchModeApi.startWatching"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)},async stopWatching(n){const r=await t.stopWatching(n),o=e?.serverIndex??0,a=gn["WatchModeApi.stopWatching"]?.[o]?.url;return(i,s)=>xn(r,Ft,pn,e)(i,a||s)},async streamPackageEvents(n,r,o,a){const i=await t.streamPackageEvents(n,r,o,a),s=e?.serverIndex??0,c=gn["WatchModeApi.streamPackageEvents"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let ote=class extends $i{getWatchStatus(t){return Kv(this.configuration).getWatchStatus(t).then(n=>n(this.axios,this.basePath))}startWatching(t,n){return Kv(this.configuration).startWatching(t,n).then(r=>r(this.axios,this.basePath))}stopWatching(t){return Kv(this.configuration).stopWatching(t).then(n=>n(this.axios,this.basePath))}streamPackageEvents(t,n,r,o){return Kv(this.configuration).streamPackageEvents(t,n,r,o).then(a=>a(this.axios,this.basePath))}},ate=class{apiKey;username;password;accessToken;awsv4;basePath;serverIndex;baseOptions;formDataCtor;constructor(t={}){this.apiKey=t.apiKey,this.username=t.username,this.password=t.password,this.accessToken=t.accessToken,this.awsv4=t.awsv4,this.basePath=t.basePath,this.serverIndex=t.serverIndex,this.baseOptions={...t.baseOptions,headers:{...t.baseOptions?.headers}},this.formDataCtor=t.formDataCtor}isJsonMime(t){return t!==null&&/^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$/i.test(t)}};const ZR=new eZ({defaultOptions:{queries:{retry:!1,throwOnError:!1,refetchOnWindowFocus:!1},mutations:{retry:!1,throwOnError:!1}}}),ite={staleTime:300*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!1},HC="publisher:themeMode";function ste(){if(!(typeof window>"u"))try{const e=window.localStorage.getItem(HC);if(e==="light"||e==="dark"||e==="auto")return e}catch{}}function lte(e){if(!(typeof window>"u"))try{e===void 0?window.localStorage.removeItem(HC):window.localStorage.setItem(HC,e)}catch{}}function cte(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}Ft.defaults.baseURL||(Ft.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet");const W5=C.createContext(void 0),ute=(e,t)=>{const n=`${window.location.protocol}//${window.location.host}/api/v0`,r=Ft.create({baseURL:e||n,withCredentials:!0,timeout:6e5});r.interceptors.request.use(async a=>{const i=await t?.();return a.headers.Authorization=i||"",a});const o=new ate({basePath:n});return{models:new Wee(o,n,r),publisher:new Zee(o,n,r),environments:new Uee(o,n,r),packages:new Qee(o,n,r),dashboards:new Dee(o,n,r),dataApps:new Iee(o,n,r),notebooks:new Kee(o,n,r),reports:new ete(o,n,r),connections:new Pee(o,n,r),databases:new Fee(o,n,r),materializations:new Vee(o,n,r),watchMode:new ote(o,n,r),versions:new nte(o,n,r)}},dte=e=>m.jsx(tZ,{client:ZR,children:m.jsx(fte,{...e})}),fte=({children:e,getAccessToken:t,baseURL:n,mutable:r,theme:o,ui:a})=>{const i=C.useMemo(()=>ute(n,t),[n,t]),s=n||`${window.location.protocol}//${window.location.host}/api/v0`,c=VR({queryKey:["status"],queryFn:async()=>(await i.publisher.getStatus()).data});c.error&&console.error("Failed to fetch publisher status:",c.error);const f=c.data?.frozenConfig,u=c.data?.theme,h=c.isLoading;let g;c.isLoading||c.error?g=r:f?g=!1:g=r??!0;const y=C.useMemo(()=>[u,o],[u,o]),[b,S]=C.useState(ste),[w,x]=C.useState(cte);C.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const I=window.matchMedia("(prefers-color-scheme: dark)"),j=_=>x(_.matches);return I.addEventListener("change",j),()=>I.removeEventListener("change",j)},[]);const R=C.useCallback(I=>{S(I),lte(I)},[]),k=u?.allowUserToggle??!0,T=k?b:void 0,O=C.useMemo(()=>Eee(u?.defaultMode,T,w),[u?.defaultMode,T,w]),A={server:s,getAccessToken:t,apiClients:i,mutable:g,isLoadingStatus:h,instanceTheme:u};return m.jsx(W5.Provider,{value:A,children:m.jsx(Tee,{layers:y,mode:O,userChoice:T,setMode:R,allowUserToggle:k,...a?{ui:a}:{},children:e})})},hr=()=>{const e=C.useContext(W5);if(e===void 0)throw new Error("useServer must be used within a ServerProvider");return e};function nd(){return nd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nd.apply(this,arguments)}const pte=["children","options"],tA=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{class:"className",for:"htmlFor"}),nA={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},hte=["style","script","pre"],mte=["src","href","data","formAction","srcDoc","action"],gte=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,yte=/mailto:/i,vte=/\n{2,}$/,rA=/^(\s*>[\s\S]*?)(?=\n\n|$)/,bte=/^ *> ?/gm,xte=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Ste=/^ {2,}\n/,wte=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,oA=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,aA=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,Cte=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,kte=/^(?:\n *)*\n/,Rte=/\r\n?/g,Ete=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,Tte=/^\[\^([^\]]+)]/,$te=/\f/g,Mte=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,Ote=/^\s*?\[(x|\s)\]/,iA=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,sA=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,lA=/^([^\n]+)\n *(=|-){3,} *\n/,lw=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,Pte=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,cA=/^<!--[\s\S]*?(?:-->)/,Ate=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,cw=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,Dte=/^\{.*\}$/,jte=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,Nte=/^<([^ >]+@[^ >]+)>/,Ite=/^<([^ >]+:\/[^ >]+)>/,Lte=/-([a-z])?/gi,uA=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,zte=/^[^\n]+(?: \n|\n{2,})/,Fte=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,_te=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,Ute=/^\[([^\]]*)\] ?\[([^\]]*)\]/,Bte=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,Vte=/\t/g,Hte=/(^ *\||\| *$)/g,qte=/^ *:-+: *$/,Wte=/^ *:-+ *$/,Yte=/^ *-+: *$/,px=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,hx="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",Kte=RegExp(`^([*_])\\1${px(1)}${hx}\\1\\1(?!\\1)`),Gte=RegExp(`^([*_])${px(0)}${hx}\\1(?!\\1)`),Qte=RegExp(`^(==)${px(0)}${hx}\\1`),Xte=RegExp(`^(~~)${px(0)}${hx}\\1`),Zte=/^(:[a-zA-Z0-9-_]+:)/,Jte=/^\\([^0-9A-Za-z\s])/,ene=/\\([^0-9A-Za-z\s])/g,tne=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,nne=/^\n+/,rne=/^([ \t]*)/,one=/(?:^|\n)( *)$/,JR="(?:\\d+\\.)",eE="(?:[*+-])";function Y5(e){return"( *)("+(e===1?JR:eE)+") +"}const K5=Y5(1),G5=Y5(2);function Q5(e){return RegExp("^"+(e===1?K5:G5))}const ane=Q5(1),ine=Q5(2);function X5(e){return RegExp("^"+(e===1?K5:G5)+"[^\\n]*(?:\\n(?!\\1"+(e===1?JR:eE)+" )[^\\n]*)*(\\n|$)","gm")}const sne=X5(1),lne=X5(2);function Z5(e){const t=e===1?JR:eE;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const J5=Z5(1),ez=Z5(2);function dA(e,t){const n=t===1,r=n?J5:ez,o=n?sne:lne,a=n?ane:ine;return{t:i=>a.test(i),o:Tp(function(i,s){const c=one.exec(s.prevCapture);return c&&(s.list||!s.inline&&!s.simple)?r.exec(i=c[1]+i):null}),i:1,u(i,s,c){const f=n?+i[2]:void 0,u=i[0].replace(vte,`
274
+ `+i)}}catch{}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ed(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&$b.assertOptions(r,{silentJSONParsing:da.transitional(da.boolean),forcedJSONParsing:da.transitional(da.boolean),clarifyTimeoutError:da.transitional(da.boolean),legacyInterceptorReqResOrdering:da.transitional(da.boolean),advertiseZstdAcceptEncoding:da.transitional(da.boolean),validateStatusUndefinedResolves:da.transitional(da.boolean)},!1),o!=null&&(Pe.isFunction(o)?n.paramsSerializer={serialize:o}:$b.assertOptions(o,{encode:da.function,serialize:da.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),$b.assertOptions(n,{baseUrl:da.spelling("baseURL"),withXsrfToken:da.spelling("withXSRFToken")},!0),n.method=(Pe.getSafeProp(n,"method")||Pe.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=a&&Pe.merge(a.common,a[n.method]);a&&Pe.forEach($5.concat("common"),b=>{delete a[b]}),n.headers=ga.concat(i,a);const s=[];let c=!0;this.interceptors.request.forEach(function(S){if(typeof S.runWhen=="function"&&S.runWhen(n)===!1)return;c=c&&S.synchronous;const w=n.transitional||YR;w&&w.legacyInterceptorReqResOrdering?s.unshift(S.fulfilled,S.rejected):s.push(S.fulfilled,S.rejected)});const f=[];this.interceptors.response.forEach(function(S){f.push(S.fulfilled,S.rejected)});let u,h=0,g;if(!c){const b=[iw.bind(this),void 0];for(b.unshift(...s),b.push(...f),g=b.length,u=Promise.resolve(n);h<g;)u=u.then(b[h++],b[h++]);return u}g=s.length;let y=n;for(;h<g;){const b=s[h++],S=s[h++];try{y=b?b(y):y}catch(w){if(!S){u=Promise.reject(w);break}try{const x=S.call(this,w);Pe.isThenable(x)&&(u=Promise.resolve(x).then(()=>iw.call(this,y)))}catch(x){u=Promise.reject(x)}break}}if(!u)try{u=iw.call(this,y)}catch(b){u=Promise.reject(b)}for(h=0,g=f.length;h<g;)u=u.then(f[h++],f[h++]);return u}getUri(t){t=Ed(this.defaults,t);const n=A5(t.baseURL,t.url,t.allowAbsoluteUrls,t);return k5(n,t.params,t.paramsSerializer)}};Pe.forEach(["delete","get","head","options"],function(t){pd.prototype[t]=function(n,r){return this.request(Ed(r||{},{method:t,url:n,data:r&&Pe.hasOwnProp(r,"data")?r.data:void 0}))}});Pe.forEach(["post","put","patch","query"],function(t){function n(r){return function(a,i,s){return this.request(Ed(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}pd.prototype[t]=n(),t!=="query"&&(pd.prototype[t+"Form"]=n(!0))});let fee=class L5{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(o=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(s=>{r.subscribe(s),a=s}).then(o);return i.cancel=function(){r.unsubscribe(a)},i},t(function(a,i,s){r.reason||(r.reason=new my(a,i,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new L5(function(o){t=o}),cancel:t}}};function pee(e){return function(n){return e.apply(null,n)}}function hee(e){return Pe.isObject(e)&&e.isAxiosError===!0}const Mb={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Mb).forEach(([e,t])=>{Mb[t]===void 0&&(Mb[t]=e)});function z5(e){const t=new pd(e),n=l5(pd.prototype.request,t);return Pe.extend(n,pd.prototype,t,{allOwnKeys:!0}),Pe.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return z5(Ed(e,o))},n}const Ft=z5(hy);Ft.Axios=pd;Ft.CanceledError=my;Ft.CancelToken=fee;Ft.isCancel=M5;Ft.VERSION=GR;Ft.toFormData=dx;Ft.AxiosError=Ht;Ft.Cancel=Ft.CanceledError;Ft.all=function(t){return Promise.all(t)};Ft.spread=pee;Ft.isAxiosError=hee;Ft.mergeConfig=Ed;Ft.AxiosHeaders=ga;Ft.formToJSON=e=>T5(Pe.isHTMLForm(e)?new FormData(e):e);Ft.getAdapter=I5.getAdapter;Ft.HttpStatusCode=Mb;Ft.default=Ft;const{Axios:OSe,AxiosError:PSe,CanceledError:ASe,isCancel:DSe,CancelToken:jSe,VERSION:NSe,all:ISe,Cancel:LSe,isAxiosError:zSe,spread:FSe,toFormData:_Se,AxiosHeaders:USe,HttpStatusCode:BSe,formToJSON:VSe,getAdapter:HSe,mergeConfig:qSe,create:WSe}=Ft,XP="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",yi={radius:{control:"6px",tile:"8px",menu:"10px",dialog:"12px"},size:{control:32,chip:24},type:{pageTitle:{fontSize:24,fontWeight:600,letterSpacing:"-0.01em"},tileTitle:{fontSize:14,fontWeight:600,lineHeight:1.4},prose:{fontSize:15,lineHeight:1.6},control:{fontSize:13,fontWeight:500},caption:{fontSize:12,lineHeight:1.4},label:{fontSize:12,fontWeight:600,lineHeight:1.4},code:{fontSize:11.5,fontFamily:XP}},font:{mono:XP},shadow:{menu:"0 8px 24px rgba(16, 24, 40, 0.12)"}};function mee(e){if(!e)return yi;const t={...yi.font,...e.font},n={...yi.type};n.code={...n.code,fontFamily:t.mono};for(const[r,o]of Object.entries(e.type??{}))n[r]={...n[r],...o};return{radius:{...yi.radius,...e.radius},size:{...yi.size,...e.size},type:n,font:t,shadow:{...yi.shadow,...e.shadow}}}const qr={blue:"#2563eb",violet:"#7c3aed",pink:"#be185d",red:"#dc2626",orange:"#c2410c",amber:"#b45309",lime:"#4d7c0f",emerald:"#059669",teal:"#0f766e",cyan:"#0e7490"},XR={environment:qr.emerald,package:qr.teal,connection:qr.orange},Uo='"JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", monospace',gee=dt(dY)({display:"flex",flexDirection:"column",height:"100%",boxShadow:"none",border:"none",backgroundColor:"transparent"}),yee=dt(mY)({display:"flex",flexDirection:"column",padding:"0",flexGrow:1}),F5=dt(SY)({padding:"0"}),_5=dt("div")({backgroundColor:"transparent",paddingTop:"12px",paddingBottom:"2px",borderRadius:"8px",border:"none",boxShadow:"none",marginBottom:"0"}),vee=dt("div")({height:"100%"}),U5=dt("div")({height:"75vh",width:"100%",overflowY:"auto"}),bee={light:{accent:qr.blue,accentHover:"#1d4ed8",accentContrast:"#ffffff"},dark:{accent:"#60a5fa",accentHover:"#93c5fd",accentContrast:"#0f172a"}},xee={light:"#ffffff",dark:"#0f172a"},See=3,gg=e=>{const t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return;const n=t[1].length===3?[...t[1]].map(r=>r+r).join(""):t[1];return[0,2,4].map(r=>parseInt(n.slice(r,r+2),16))},B5=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`,zC=(e,t,n)=>B5(e.map(r=>r+(t-r)*n)),FC=e=>{const[t,n,r]=e.map(o=>{const a=o/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r},n0=(e,t)=>{const[n,r]=[FC(e),FC(t)].sort((o,a)=>a-o);return(n+.05)/(r+.05)},wee=[15,23,42];function _C(e,t,n=See){const r=gg(e),o=gg(t);if(!r||!o||n0(r,o)>=n)return e;const a=FC(o)<.5?255:0;for(let i=.05;i<1;i+=.05){const s=gg(zC(r,a,i));if(s&&n0(s,o)>=n)return B5(s)}return a===255?"#ffffff":"#000000"}function UC(e,t,n=xee[t]){const r=bee[t];if(!e||e.toLowerCase()===qr.blue)return r;if(!gg(e))return t==="light"?{...r,accent:e,accentHover:e}:r;const o=_C(e,n),a=gg(o),i=t==="dark"?zC(a,255,.25):zC(a,0,.2),s=n0(a,[255,255,255]),c=n0(a,wee);return{accent:o,accentHover:i,accentContrast:s>=c?"#ffffff":"#0f172a"}}const Cee=[qr.blue,qr.orange,qr.emerald,qr.pink,qr.violet,qr.amber,qr.cyan,qr.lime],kee="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",BC={palette:{series:Cee,background:{light:"#ffffff",dark:"#0f172a"},tableHeader:{light:"#475569",dark:"#cbd5e1"},tableHeaderBackground:{light:"#f8fafc",dark:"#1e293b"},tableBody:{light:"#475569",dark:"#e2e8f0"},tile:{light:"#ffffff",dark:"#0f172a"},tileTitle:{light:"#475569",dark:"#94a3b8"},mapColor:{light:qr.blue,dark:qr.blue},border:{light:"#e2e8f0",dark:"#334155"},cardBorder:{light:"#cbd5e1",dark:"#475569"},axis:{light:"#cbd5e1",dark:"#475569"},gridline:{light:"#cbd5e1",dark:"#475569"},chartText:{light:"#0f172a",dark:"#e2e8f0"},value:{light:"#0f172a",dark:"#f1f5f9"}},font:{family:kee,size:12}},Ree=["background","tableHeader","tableHeaderBackground","tableBody","tile","tileTitle","mapColor","border","cardBorder","axis","gridline","chartText","value"];function V5(e,t){const n=BC.palette??{},r=BC.font??{family:"sans-serif",size:12};let o=[...n.series??[]],a=!1,i=r.family??"sans-serif",s=r.size??12;const c={background:{...n.background??{}},tableHeader:{...n.tableHeader??{}},tableHeaderBackground:{...n.tableHeaderBackground??{}},tableBody:{...n.tableBody??{}},tile:{...n.tile??{}},tileTitle:{...n.tileTitle??{}},mapColor:{...n.mapColor??{}},border:{...n.border??{}},cardBorder:{...n.cardBorder??{}},axis:{...n.axis??{}},gridline:{...n.gridline??{}},chartText:{...n.chartText??{}},value:{...n.value??{}}},f={light:new Set,dark:new Set};for(const b of e)if(b){Array.isArray(b.palette?.series)&&(o=[...b.palette.series],a=!0);for(const S of Ree){const w=b.palette?.[S];w&&(c[S]={...c[S],...w},w.light!==void 0&&f.light.add(S),w.dark!==void 0&&f.dark.add(S))}typeof b.font?.family=="string"&&(i=b.font.family),typeof b.font?.size=="number"&&(s=b.font.size)}const u=t==="dark",h=b=>c[b][t]??n[b]?.[t],g=h("background"),y=u&&f.light.has("mapColor")&&!f.dark.has("mapColor")?_C(c.mapColor.light,g):h("mapColor");return{mode:t,ui:yi,series:u&&a?o.map(b=>_C(b,g)):o,...UC(o[0],t,g),font:{family:i,size:s},background:g,tableHeader:h("tableHeader"),tableHeaderBackground:h("tableHeaderBackground"),tableBody:h("tableBody"),tile:h("tile"),tileTitle:h("tileTitle"),mapColor:y,tableBackground:g,border:`1px solid ${h("border")}`,cardBorder:`1px solid ${h("cardBorder")}`,pinnedBorder:`1px solid ${h("cardBorder")}`,valueColor:h("value"),foreground:h("chartText"),axisFaint:h("axis"),gridline:h("gridline"),shadow:u?{lift:"0 2px 12px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08)",drag:"0 12px 32px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.12)"}:{lift:"0 2px 10px rgba(0, 0, 0, 0.10)",drag:"0 12px 32px rgba(0, 0, 0, 0.22)"},dashboardRoot:u?"#0f172a":"#ffffff",drillLink:UC(void 0,t).accent}}function YSe(e,t){const n=t.palette?.series;if(!Array.isArray(n)||n.length!==1)return t;const r=n[0],o=e.reduce((f,u)=>Array.isArray(u?.palette?.series)?u.palette.series:f,BC.palette?.series??[]),a=f=>f.toLowerCase()===r.toLowerCase(),[i,...s]=o,c=s.length>0?s.map(f=>a(f)?i:f):[i].filter(f=>f!==void 0&&!a(f));return{...t,palette:{...t.palette,series:[r,...c]}}}function Eee(e,t,n){const r=t??e??"light";return r==="auto"?n?"dark":"light":r}const H5=C.createContext(void 0);function Tee({layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o=!0,ui:a,children:i}){const s=JSON.stringify(a??null),c=C.useMemo(()=>mee(a),[s]),f=C.useMemo(()=>({...V5(e,t),ui:c}),[e,t,c]),u=C.useMemo(()=>({theme:f,layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o}),[f,e,t,n,r,o]);return m.jsx(H5.Provider,{value:u,children:i})}function eo(){return C.useContext(H5)||{theme:V5([],"light"),layers:[],mode:"light",userChoice:void 0,setMode:()=>{},allowUserToggle:!1}}const pn="http://localhost/api/v0".replace(/\/+$/,"");let $i=class{constructor(t,n=pn,r=Ft){this.basePath=n,this.axios=r,t&&(this.configuration=t,this.basePath=t.basePath??n)}configuration},$ee=class extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}};const gn={},yn="https://example.com",et=function(e,t,n){if(n==null)throw new $ee(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function VC(e,t,n=""){t!=null&&(typeof t=="object"?Array.isArray(t)||t instanceof Set?t.forEach(r=>VC(e,r,n)):Object.keys(t).forEach(r=>VC(e,t[r],`${n}${n!==""?".":""}${r}`)):e.has(n)?e.append(n,t):e.set(n,t))}const vn=function(e,...t){const n=new URLSearchParams(e.search);VC(n,t),e.search=n.toString()},Mee=function(e,t){return t instanceof Set?Array.from(t):t},Eo=function(e,t,n){const r=typeof e!="string";return(r&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):r)?JSON.stringify(e!==void 0?e:{},Mee):e||""},bn=function(e){return e.pathname+e.search+e.hash},xn=function(e,t,n,r){return(o=t,a=n)=>{const i={...e.options,url:(o.defaults.baseURL?"":r?.basePath??a)+e.url};return o.request(i)}},q5={Bigquery:"bigquery",Snowflake:"snowflake",Postgres:"postgres",Gcs:"gcs",S3:"s3",Azure:"azure"},ZP={Postgres:"postgres",Bigquery:"bigquery",Snowflake:"snowflake",Trino:"trino",Databricks:"databricks",Mysql:"mysql",Sqlserver:"sqlserver",Duckdb:"duckdb",Motherduck:"motherduck",Ducklake:"ducklake",Publisher:"publisher"},Ra={Pending:"PENDING",ManifestRowsReady:"MANIFEST_ROWS_READY",ManifestFileReady:"MANIFEST_FILE_READY",Failed:"FAILED",Cancelled:"CANCELLED"},Wv={Version:"version",Package:"package"},Oee=function(e){return{createConnection:async(t,n,r,o={})=>{et("createConnection","environmentName",t),et("createConnection","connectionName",n),et("createConnection","connection",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}},deleteConnection:async(t,n,r={})=>{et("deleteConnection","environmentName",t),et("deleteConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},c={},f={};c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},{url:bn(a),options:s}},getConnection:async(t,n,r={})=>{et("getConnection","environmentName",t),et("getConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},c={},f={};c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},{url:bn(a),options:s}},getTable:async(t,n,r,o,a={})=>{et("getTable","environmentName",t),et("getTable","connectionName",n),et("getTable","schemaName",r),et("getTable","tablePath",o);const i="/environments/{environmentName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))).replace("{tablePath}",encodeURIComponent(String(o))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},getTableInPackage:async(t,n,r,o,a,i,s={})=>{et("getTableInPackage","environmentName",t),et("getTableInPackage","packageName",n),et("getTableInPackage","connectionName",r),et("getTableInPackage","schemaName",o),et("getTableInPackage","tablePath",a);const c="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))).replace("{schemaName}",encodeURIComponent(String(o))).replace("{tablePath}",encodeURIComponent(String(a))),f=new URL(c,yn);let u;e&&(u=e.baseOptions);const h={method:"GET",...u,...s},g={},y={};i!==void 0&&(y.versionId=i),g.Accept="application/json",vn(f,y);let b=u&&u.headers?u.headers:{};return h.headers={...g,...b,...s.headers},{url:bn(f),options:h}},listConnections:async(t,n={})=>{et("listConnections","environmentName",t);const r="/environments/{environmentName}/connections".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},c={};s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},{url:bn(o),options:i}},listSchemas:async(t,n,r={})=>{et("listSchemas","environmentName",t),et("listSchemas","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},c={},f={};c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},{url:bn(a),options:s}},listSchemasInPackage:async(t,n,r,o,a={})=>{et("listSchemasInPackage","environmentName",t),et("listSchemasInPackage","packageName",n),et("listSchemasInPackage","connectionName",r);const i="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};o!==void 0&&(h.versionId=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listTables:async(t,n,r,o,a={})=>{et("listTables","environmentName",t),et("listTables","connectionName",n),et("listTables","schemaName",r);const i="/environments/{environmentName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};o&&(h.tableNames=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listTablesInPackage:async(t,n,r,o,a,i,s={})=>{et("listTablesInPackage","environmentName",t),et("listTablesInPackage","packageName",n),et("listTablesInPackage","connectionName",r),et("listTablesInPackage","schemaName",o);const c="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))).replace("{schemaName}",encodeURIComponent(String(o))),f=new URL(c,yn);let u;e&&(u=e.baseOptions);const h={method:"GET",...u,...s},g={},y={};a&&(y.tableNames=a),i!==void 0&&(y.versionId=i),g.Accept="application/json",vn(f,y);let b=u&&u.headers?u.headers:{};return h.headers={...g,...b,...s.headers},{url:bn(f),options:h}},postQuerydata:async(t,n,r,o={})=>{et("postQuerydata","environmentName",t),et("postQuerydata","connectionName",n),et("postQuerydata","postQuerydataRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}},postQuerydataInPackage:async(t,n,r,o,a,i={})=>{et("postQuerydataInPackage","environmentName",t),et("postQuerydataInPackage","packageName",n),et("postQuerydataInPackage","connectionName",r),et("postQuerydataInPackage","postQuerydataRequest",o);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"POST",...f,...i},h={},g={};a!==void 0&&(g.versionId=a),h["Content-Type"]="application/json",h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},u.data=Eo(o,u,e),{url:bn(c),options:u}},postSqlsource:async(t,n,r,o={})=>{et("postSqlsource","environmentName",t),et("postSqlsource","connectionName",n),et("postSqlsource","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}},postSqlsourceInPackage:async(t,n,r,o,a,i={})=>{et("postSqlsourceInPackage","environmentName",t),et("postSqlsourceInPackage","packageName",n),et("postSqlsourceInPackage","connectionName",r),et("postSqlsourceInPackage","postSqlsourceRequest",o);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"POST",...f,...i},h={},g={};a!==void 0&&(g.versionId=a),h["Content-Type"]="application/json",h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},u.data=Eo(o,u,e),{url:bn(c),options:u}},postTemporarytable:async(t,n,r,o={})=>{et("postTemporarytable","environmentName",t),et("postTemporarytable","connectionName",n),et("postTemporarytable","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}},postTemporarytableInPackage:async(t,n,r,o,a,i={})=>{et("postTemporarytableInPackage","environmentName",t),et("postTemporarytableInPackage","packageName",n),et("postTemporarytableInPackage","connectionName",r),et("postTemporarytableInPackage","postSqlsourceRequest",o);const s="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"POST",...f,...i},h={},g={};a!==void 0&&(g.versionId=a),h["Content-Type"]="application/json",h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},u.data=Eo(o,u,e),{url:bn(c),options:u}},updateConnection:async(t,n,r,o={})=>{et("updateConnection","environmentName",t),et("updateConnection","connectionName",n),et("updateConnection","updateConnectionRequest",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"PATCH",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}}}},oa=function(e){const t=Oee(e);return{async createConnection(n,r,o,a){const i=await t.createConnection(n,r,o,a),s=e?.serverIndex??0,c=gn["ConnectionsApi.createConnection"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async deleteConnection(n,r,o){const a=await t.deleteConnection(n,r,o),i=e?.serverIndex??0,s=gn["ConnectionsApi.deleteConnection"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async getConnection(n,r,o){const a=await t.getConnection(n,r,o),i=e?.serverIndex??0,s=gn["ConnectionsApi.getConnection"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async getTable(n,r,o,a,i){const s=await t.getTable(n,r,o,a,i),c=e?.serverIndex??0,f=gn["ConnectionsApi.getTable"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async getTableInPackage(n,r,o,a,i,s,c){const f=await t.getTableInPackage(n,r,o,a,i,s,c),u=e?.serverIndex??0,h=gn["ConnectionsApi.getTableInPackage"]?.[u]?.url;return(g,y)=>xn(f,Ft,pn,e)(g,h||y)},async listConnections(n,r){const o=await t.listConnections(n,r),a=e?.serverIndex??0,i=gn["ConnectionsApi.listConnections"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)},async listSchemas(n,r,o){const a=await t.listSchemas(n,r,o),i=e?.serverIndex??0,s=gn["ConnectionsApi.listSchemas"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async listSchemasInPackage(n,r,o,a,i){const s=await t.listSchemasInPackage(n,r,o,a,i),c=e?.serverIndex??0,f=gn["ConnectionsApi.listSchemasInPackage"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listTables(n,r,o,a,i){const s=await t.listTables(n,r,o,a,i),c=e?.serverIndex??0,f=gn["ConnectionsApi.listTables"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listTablesInPackage(n,r,o,a,i,s,c){const f=await t.listTablesInPackage(n,r,o,a,i,s,c),u=e?.serverIndex??0,h=gn["ConnectionsApi.listTablesInPackage"]?.[u]?.url;return(g,y)=>xn(f,Ft,pn,e)(g,h||y)},async postQuerydata(n,r,o,a){const i=await t.postQuerydata(n,r,o,a),s=e?.serverIndex??0,c=gn["ConnectionsApi.postQuerydata"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async postQuerydataInPackage(n,r,o,a,i,s){const c=await t.postQuerydataInPackage(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ConnectionsApi.postQuerydataInPackage"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async postSqlsource(n,r,o,a){const i=await t.postSqlsource(n,r,o,a),s=e?.serverIndex??0,c=gn["ConnectionsApi.postSqlsource"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async postSqlsourceInPackage(n,r,o,a,i,s){const c=await t.postSqlsourceInPackage(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ConnectionsApi.postSqlsourceInPackage"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async postTemporarytable(n,r,o,a){const i=await t.postTemporarytable(n,r,o,a),s=e?.serverIndex??0,c=gn["ConnectionsApi.postTemporarytable"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async postTemporarytableInPackage(n,r,o,a,i,s){const c=await t.postTemporarytableInPackage(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ConnectionsApi.postTemporarytableInPackage"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async updateConnection(n,r,o,a){const i=await t.updateConnection(n,r,o,a),s=e?.serverIndex??0,c=gn["ConnectionsApi.updateConnection"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let Pee=class extends $i{createConnection(t,n,r,o){return oa(this.configuration).createConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteConnection(t,n,r){return oa(this.configuration).deleteConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getConnection(t,n,r){return oa(this.configuration).getConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getTable(t,n,r,o,a){return oa(this.configuration).getTable(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getTableInPackage(t,n,r,o,a,i,s){return oa(this.configuration).getTableInPackage(t,n,r,o,a,i,s).then(c=>c(this.axios,this.basePath))}listConnections(t,n){return oa(this.configuration).listConnections(t,n).then(r=>r(this.axios,this.basePath))}listSchemas(t,n,r){return oa(this.configuration).listSchemas(t,n,r).then(o=>o(this.axios,this.basePath))}listSchemasInPackage(t,n,r,o,a){return oa(this.configuration).listSchemasInPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listTables(t,n,r,o,a){return oa(this.configuration).listTables(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listTablesInPackage(t,n,r,o,a,i,s){return oa(this.configuration).listTablesInPackage(t,n,r,o,a,i,s).then(c=>c(this.axios,this.basePath))}postQuerydata(t,n,r,o){return oa(this.configuration).postQuerydata(t,n,r,o).then(a=>a(this.axios,this.basePath))}postQuerydataInPackage(t,n,r,o,a,i){return oa(this.configuration).postQuerydataInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}postSqlsource(t,n,r,o){return oa(this.configuration).postSqlsource(t,n,r,o).then(a=>a(this.axios,this.basePath))}postSqlsourceInPackage(t,n,r,o,a,i){return oa(this.configuration).postSqlsourceInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}postTemporarytable(t,n,r,o){return oa(this.configuration).postTemporarytable(t,n,r,o).then(a=>a(this.axios,this.basePath))}postTemporarytableInPackage(t,n,r,o,a,i){return oa(this.configuration).postTemporarytableInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}updateConnection(t,n,r,o){return oa(this.configuration).updateConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Aee=function(e){return{getDashboard:async(t,n,r,o,a={})=>{et("getDashboard","environmentName",t),et("getDashboard","packageName",n),et("getDashboard","dashboardName",r);const i="/environments/{environmentName}/packages/{packageName}/dashboards/{dashboardName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{dashboardName}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};o!==void 0&&(h.versionId=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listDashboards:async(t,n,r,o={})=>{et("listDashboards","environmentName",t),et("listDashboards","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/dashboards".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};r!==void 0&&(u.versionId=r),f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}}}},JP=function(e){const t=Aee(e);return{async getDashboard(n,r,o,a,i){const s=await t.getDashboard(n,r,o,a,i),c=e?.serverIndex??0,f=gn["DashboardsApi.getDashboard"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listDashboards(n,r,o,a){const i=await t.listDashboards(n,r,o,a),s=e?.serverIndex??0,c=gn["DashboardsApi.listDashboards"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let Dee=class extends $i{getDashboard(t,n,r,o,a){return JP(this.configuration).getDashboard(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listDashboards(t,n,r,o){return JP(this.configuration).listDashboards(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const jee=function(e){return{listDataApps:async(t,n,r,o={})=>{et("listDataApps","environmentName",t),et("listDataApps","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/data-apps".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};r!==void 0&&(u.versionId=r),f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}}}},Nee=function(e){const t=jee(e);return{async listDataApps(n,r,o,a){const i=await t.listDataApps(n,r,o,a),s=e?.serverIndex??0,c=gn["DataAppsApi.listDataApps"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let Iee=class extends $i{listDataApps(t,n,r,o){return Nee(this.configuration).listDataApps(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Lee=function(e){return{listDatabases:async(t,n,r,o={})=>{et("listDatabases","environmentName",t),et("listDatabases","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/databases".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};r!==void 0&&(u.versionId=r),f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}}}},zee=function(e){const t=Lee(e);return{async listDatabases(n,r,o,a){const i=await t.listDatabases(n,r,o,a),s=e?.serverIndex??0,c=gn["DatabasesApi.listDatabases"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};class Fee extends $i{listDatabases(t,n,r,o){return zee(this.configuration).listDatabases(t,n,r,o).then(a=>a(this.axios,this.basePath))}}const _ee=function(e){return{createEnvironment:async(t,n={})=>{et("createEnvironment","environment",t);const r="/environments",o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},c={};s["Content-Type"]="application/json",s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},i.data=Eo(t,i,e),{url:bn(o),options:i}},deleteEnvironment:async(t,n={})=>{et("deleteEnvironment","environmentName",t);const r="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"DELETE",...a,...n},s={},c={};s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},{url:bn(o),options:i}},getEnvironment:async(t,n,r={})=>{et("getEnvironment","environmentName",t);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},c={},f={};n!==void 0&&(f.reload=n),c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},{url:bn(a),options:s}},listEnvironments:async(t={})=>{const n="/environments",r=new URL(n,yn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",vn(r,s);let c=o&&o.headers?o.headers:{};return a.headers={...i,...c,...t.headers},{url:bn(r),options:a}},updateEnvironment:async(t,n,r={})=>{et("updateEnvironment","environmentName",t),et("updateEnvironment","environment",n);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"PATCH",...i,...r},c={},f={};c["Content-Type"]="application/json",c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},s.data=Eo(n,s,e),{url:bn(a),options:s}}}},vm=function(e){const t=_ee(e);return{async createEnvironment(n,r){const o=await t.createEnvironment(n,r),a=e?.serverIndex??0,i=gn["EnvironmentsApi.createEnvironment"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)},async deleteEnvironment(n,r){const o=await t.deleteEnvironment(n,r),a=e?.serverIndex??0,i=gn["EnvironmentsApi.deleteEnvironment"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)},async getEnvironment(n,r,o){const a=await t.getEnvironment(n,r,o),i=e?.serverIndex??0,s=gn["EnvironmentsApi.getEnvironment"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async listEnvironments(n){const r=await t.listEnvironments(n),o=e?.serverIndex??0,a=gn["EnvironmentsApi.listEnvironments"]?.[o]?.url;return(i,s)=>xn(r,Ft,pn,e)(i,a||s)},async updateEnvironment(n,r,o){const a=await t.updateEnvironment(n,r,o),i=e?.serverIndex??0,s=gn["EnvironmentsApi.updateEnvironment"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)}}};let Uee=class extends $i{createEnvironment(t,n){return vm(this.configuration).createEnvironment(t,n).then(r=>r(this.axios,this.basePath))}deleteEnvironment(t,n){return vm(this.configuration).deleteEnvironment(t,n).then(r=>r(this.axios,this.basePath))}getEnvironment(t,n,r){return vm(this.configuration).getEnvironment(t,n,r).then(o=>o(this.axios,this.basePath))}listEnvironments(t){return vm(this.configuration).listEnvironments(t).then(n=>n(this.axios,this.basePath))}updateEnvironment(t,n,r){return vm(this.configuration).updateEnvironment(t,n,r).then(o=>o(this.axios,this.basePath))}};const Bee=function(e){return{createMaterialization:async(t,n,r,o={})=>{et("createMaterialization","environmentName",t),et("createMaterialization","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"POST",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}},deleteMaterialization:async(t,n,r,o,a,i={})=>{et("deleteMaterialization","environmentName",t),et("deleteMaterialization","packageName",n),et("deleteMaterialization","materializationId",r);const s="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{materializationId}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"DELETE",...f,...i},h={},g={};o!==void 0&&(g.dropTables=o),a!==void 0&&(g.versionId=a),h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},{url:bn(c),options:u}},getMaterialization:async(t,n,r,o,a={})=>{et("getMaterialization","environmentName",t),et("getMaterialization","packageName",n),et("getMaterialization","materializationId",r);const i="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{materializationId}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};o!==void 0&&(h.versionId=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listMaterializations:async(t,n,r,o,a,i={})=>{et("listMaterializations","environmentName",t),et("listMaterializations","packageName",n);const s="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"GET",...f,...i},h={},g={};r!==void 0&&(g.limit=r),o!==void 0&&(g.offset=o),a!==void 0&&(g.versionId=a),h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},{url:bn(c),options:u}},materializationAction:async(t,n,r,o,a,i={})=>{et("materializationAction","environmentName",t),et("materializationAction","packageName",n),et("materializationAction","materializationId",r),et("materializationAction","action",o);const s="/environments/{environmentName}/packages/{packageName}/materializations/{materializationId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{materializationId}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"POST",...f,...i},h={},g={};o!==void 0&&(g.action=o),a!==void 0&&(g.versionId=a),h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},{url:bn(c),options:u}}}},bm=function(e){const t=Bee(e);return{async createMaterialization(n,r,o,a){const i=await t.createMaterialization(n,r,o,a),s=e?.serverIndex??0,c=gn["MaterializationsApi.createMaterialization"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async deleteMaterialization(n,r,o,a,i,s){const c=await t.deleteMaterialization(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["MaterializationsApi.deleteMaterialization"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async getMaterialization(n,r,o,a,i){const s=await t.getMaterialization(n,r,o,a,i),c=e?.serverIndex??0,f=gn["MaterializationsApi.getMaterialization"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listMaterializations(n,r,o,a,i,s){const c=await t.listMaterializations(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["MaterializationsApi.listMaterializations"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async materializationAction(n,r,o,a,i,s){const c=await t.materializationAction(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["MaterializationsApi.materializationAction"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)}}};let Vee=class extends $i{createMaterialization(t,n,r,o){return bm(this.configuration).createMaterialization(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteMaterialization(t,n,r,o,a,i){return bm(this.configuration).deleteMaterialization(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}getMaterialization(t,n,r,o,a){return bm(this.configuration).getMaterialization(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listMaterializations(t,n,r,o,a,i){return bm(this.configuration).listMaterializations(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}materializationAction(t,n,r,o,a,i){return bm(this.configuration).materializationAction(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const Hee={Stop:"stop"},qee=function(e){return{compileModelSource:async(t,n,r,o,a,i={})=>{et("compileModelSource","environmentName",t),et("compileModelSource","packageName",n),et("compileModelSource","path",r),et("compileModelSource","compileRequest",o);const s="/environments/{environmentName}/packages/{packageName}/models/{path}/compile".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"POST",...f,...i},h={},g={};a!==void 0&&(g.versionId=a),h["Content-Type"]="application/json",h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},u.data=Eo(o,u,e),{url:bn(c),options:u}},executeQueryModel:async(t,n,r,o,a,i={})=>{et("executeQueryModel","environmentName",t),et("executeQueryModel","packageName",n),et("executeQueryModel","path",r),et("executeQueryModel","queryRequest",o);const s="/environments/{environmentName}/packages/{packageName}/models/{path}/query".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"POST",...f,...i},h={},g={};a!==void 0&&(g.includeHiddenFilesAndSources=a),h["Content-Type"]="application/json",h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},u.data=Eo(o,u,e),{url:bn(c),options:u}},getModel:async(t,n,r,o,a,i,s={})=>{et("getModel","environmentName",t),et("getModel","packageName",n),et("getModel","path",r);const c="/environments/{environmentName}/packages/{packageName}/models/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),f=new URL(c,yn);let u;e&&(u=e.baseOptions);const h={method:"GET",...u,...s},g={},y={};o!==void 0&&(y.versionId=o),a!==void 0&&(y.includeHiddenFilesAndSources=a),i!==void 0&&(y.givens=i),g.Accept="application/json",vn(f,y);let b=u&&u.headers?u.headers:{};return h.headers={...g,...b,...s.headers},{url:bn(f),options:h}},listModels:async(t,n,r,o,a={})=>{et("listModels","environmentName",t),et("listModels","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/models".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};r!==void 0&&(h.versionId=r),o!==void 0&&(h.includeHiddenFilesAndSources=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},updateModelSource:async(t,n,r,o,a,i={})=>{et("updateModelSource","environmentName",t),et("updateModelSource","packageName",n),et("updateModelSource","path",r),et("updateModelSource","modelSourceWriteRequest",o);const s="/environments/{environmentName}/packages/{packageName}/models/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),c=new URL(s,yn);let f;e&&(f=e.baseOptions);const u={method:"PUT",...f,...i},h={},g={};a!==void 0&&(g.versionId=a),h["Content-Type"]="application/json",h.Accept="application/json",vn(c,g);let y=f&&f.headers?f.headers:{};return u.headers={...h,...y,...i.headers},u.data=Eo(o,u,e),{url:bn(c),options:u}}}},xm=function(e){const t=qee(e);return{async compileModelSource(n,r,o,a,i,s){const c=await t.compileModelSource(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ModelsApi.compileModelSource"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async executeQueryModel(n,r,o,a,i,s){const c=await t.executeQueryModel(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ModelsApi.executeQueryModel"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)},async getModel(n,r,o,a,i,s,c){const f=await t.getModel(n,r,o,a,i,s,c),u=e?.serverIndex??0,h=gn["ModelsApi.getModel"]?.[u]?.url;return(g,y)=>xn(f,Ft,pn,e)(g,h||y)},async listModels(n,r,o,a,i){const s=await t.listModels(n,r,o,a,i),c=e?.serverIndex??0,f=gn["ModelsApi.listModels"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async updateModelSource(n,r,o,a,i,s){const c=await t.updateModelSource(n,r,o,a,i,s),f=e?.serverIndex??0,u=gn["ModelsApi.updateModelSource"]?.[f]?.url;return(h,g)=>xn(c,Ft,pn,e)(h,u||g)}}};let Wee=class extends $i{compileModelSource(t,n,r,o,a,i){return xm(this.configuration).compileModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}executeQueryModel(t,n,r,o,a,i){return xm(this.configuration).executeQueryModel(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}getModel(t,n,r,o,a,i,s){return xm(this.configuration).getModel(t,n,r,o,a,i,s).then(c=>c(this.axios,this.basePath))}listModels(t,n,r,o,a){return xm(this.configuration).listModels(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updateModelSource(t,n,r,o,a,i){return xm(this.configuration).updateModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const Yee=function(e){return{executeNotebookCell:async(t,n,r,o,a,i,s,c,f={})=>{et("executeNotebookCell","environmentName",t),et("executeNotebookCell","packageName",n),et("executeNotebookCell","path",r),et("executeNotebookCell","cellIndex",o);const u="/environments/{environmentName}/packages/{packageName}/notebooks/{path}/cells/{cellIndex}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))).replace("{cellIndex}",encodeURIComponent(String(o))),h=new URL(u,yn);let g;e&&(g=e.baseOptions);const y={method:"GET",...g,...f},b={},S={};a!==void 0&&(S.versionId=a),i!==void 0&&(S.filter_params=i),s!==void 0&&(S.bypass_filters=s),c!==void 0&&(S.givens=c),b.Accept="application/json",vn(h,S);let w=g&&g.headers?g.headers:{};return y.headers={...b,...w,...f.headers},{url:bn(h),options:y}},getNotebook:async(t,n,r,o,a={})=>{et("getNotebook","environmentName",t),et("getNotebook","packageName",n),et("getNotebook","path",r);const i="/environments/{environmentName}/packages/{packageName}/notebooks/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};o!==void 0&&(h.versionId=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listNotebooks:async(t,n,r,o={})=>{et("listNotebooks","environmentName",t),et("listNotebooks","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/notebooks".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};r!==void 0&&(u.versionId=r),f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}}}},sw=function(e){const t=Yee(e);return{async executeNotebookCell(n,r,o,a,i,s,c,f,u){const h=await t.executeNotebookCell(n,r,o,a,i,s,c,f,u),g=e?.serverIndex??0,y=gn["NotebooksApi.executeNotebookCell"]?.[g]?.url;return(b,S)=>xn(h,Ft,pn,e)(b,y||S)},async getNotebook(n,r,o,a,i){const s=await t.getNotebook(n,r,o,a,i),c=e?.serverIndex??0,f=gn["NotebooksApi.getNotebook"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listNotebooks(n,r,o,a){const i=await t.listNotebooks(n,r,o,a),s=e?.serverIndex??0,c=gn["NotebooksApi.listNotebooks"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let Kee=class extends $i{executeNotebookCell(t,n,r,o,a,i,s,c,f){return sw(this.configuration).executeNotebookCell(t,n,r,o,a,i,s,c,f).then(u=>u(this.axios,this.basePath))}getNotebook(t,n,r,o,a){return sw(this.configuration).getNotebook(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listNotebooks(t,n,r,o){return sw(this.configuration).listNotebooks(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Gee=function(e){return{createPackage:async(t,n,r={})=>{et("createPackage","environmentName",t),et("createPackage","_package",n);const o="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"POST",...i,...r},c={},f={};c["Content-Type"]="application/json",c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},s.data=Eo(n,s,e),{url:bn(a),options:s}},deletePackage:async(t,n,r={})=>{et("deletePackage","environmentName",t),et("deletePackage","packageName",n);const o="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},c={},f={};c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},{url:bn(a),options:s}},getPackage:async(t,n,r,o,a={})=>{et("getPackage","environmentName",t),et("getPackage","packageName",n);const i="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};r!==void 0&&(h.versionId=r),o!==void 0&&(h.reload=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listPackages:async(t,n={})=>{et("listPackages","environmentName",t);const r="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},c={};s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},{url:bn(o),options:i}},updatePackage:async(t,n,r,o={})=>{et("updatePackage","environmentName",t),et("updatePackage","packageName",n),et("updatePackage","_package",r);const a="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"PATCH",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}}}},Sm=function(e){const t=Gee(e);return{async createPackage(n,r,o){const a=await t.createPackage(n,r,o),i=e?.serverIndex??0,s=gn["PackagesApi.createPackage"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async deletePackage(n,r,o){const a=await t.deletePackage(n,r,o),i=e?.serverIndex??0,s=gn["PackagesApi.deletePackage"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async getPackage(n,r,o,a,i){const s=await t.getPackage(n,r,o,a,i),c=e?.serverIndex??0,f=gn["PackagesApi.getPackage"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listPackages(n,r){const o=await t.listPackages(n,r),a=e?.serverIndex??0,i=gn["PackagesApi.listPackages"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)},async updatePackage(n,r,o,a){const i=await t.updatePackage(n,r,o,a),s=e?.serverIndex??0,c=gn["PackagesApi.updatePackage"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let Qee=class extends $i{createPackage(t,n,r){return Sm(this.configuration).createPackage(t,n,r).then(o=>o(this.axios,this.basePath))}deletePackage(t,n,r){return Sm(this.configuration).deletePackage(t,n,r).then(o=>o(this.axios,this.basePath))}getPackage(t,n,r,o,a){return Sm(this.configuration).getPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listPackages(t,n){return Sm(this.configuration).listPackages(t,n).then(r=>r(this.axios,this.basePath))}updatePackage(t,n,r,o){return Sm(this.configuration).updatePackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Xee=function(e){return{deleteTheme:async(t={})=>{const n="/theme",r=new URL(n,yn);let o;e&&(o=e.baseOptions);const a={method:"DELETE",...o,...t},i={},s={};i.Accept="application/json",vn(r,s);let c=o&&o.headers?o.headers:{};return a.headers={...i,...c,...t.headers},{url:bn(r),options:a}},getStatus:async(t,n={})=>{const r="/status",o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},c={};t!==void 0&&(c.includeLoading=t),s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},{url:bn(o),options:i}},getTheme:async(t={})=>{const n="/theme",r=new URL(n,yn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",vn(r,s);let c=o&&o.headers?o.headers:{};return a.headers={...i,...c,...t.headers},{url:bn(r),options:a}},updateTheme:async(t,n={})=>{et("updateTheme","theme",t);const r="/theme",o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"PUT",...a,...n},s={},c={};s["Content-Type"]="application/json",s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},i.data=Eo(t,i,e),{url:bn(o),options:i}}}},Yv=function(e){const t=Xee(e);return{async deleteTheme(n){const r=await t.deleteTheme(n),o=e?.serverIndex??0,a=gn["PublisherApi.deleteTheme"]?.[o]?.url;return(i,s)=>xn(r,Ft,pn,e)(i,a||s)},async getStatus(n,r){const o=await t.getStatus(n,r),a=e?.serverIndex??0,i=gn["PublisherApi.getStatus"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)},async getTheme(n){const r=await t.getTheme(n),o=e?.serverIndex??0,a=gn["PublisherApi.getTheme"]?.[o]?.url;return(i,s)=>xn(r,Ft,pn,e)(i,a||s)},async updateTheme(n,r){const o=await t.updateTheme(n,r),a=e?.serverIndex??0,i=gn["PublisherApi.updateTheme"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)}}};let Zee=class extends $i{deleteTheme(t){return Yv(this.configuration).deleteTheme(t).then(n=>n(this.axios,this.basePath))}getStatus(t,n){return Yv(this.configuration).getStatus(t,n).then(r=>r(this.axios,this.basePath))}getTheme(t){return Yv(this.configuration).getTheme(t).then(n=>n(this.axios,this.basePath))}updateTheme(t,n){return Yv(this.configuration).updateTheme(t,n).then(r=>r(this.axios,this.basePath))}};const Jee=function(e){return{getReport:async(t,n,r,o,a={})=>{et("getReport","environmentName",t),et("getReport","packageName",n),et("getReport","path",r);const i="/environments/{environmentName}/packages/{packageName}/reports/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"GET",...c,...a},u={},h={};o!==void 0&&(h.versionId=o),u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},{url:bn(s),options:f}},listReports:async(t,n,r,o={})=>{et("listReports","environmentName",t),et("listReports","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/reports".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};r!==void 0&&(u.versionId=r),f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}}}},eA=function(e){const t=Jee(e);return{async getReport(n,r,o,a,i){const s=await t.getReport(n,r,o,a,i),c=e?.serverIndex??0,f=gn["ReportsApi.getReport"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async listReports(n,r,o,a){const i=await t.listReports(n,r,o,a),s=e?.serverIndex??0,c=gn["ReportsApi.listReports"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let ete=class extends $i{getReport(t,n,r,o,a){return eA(this.configuration).getReport(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listReports(t,n,r,o){return eA(this.configuration).listReports(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const tte=function(e){return{deletePackageVersion:async(t,n,r,o={})=>{et("deletePackageVersion","environmentName",t),et("deletePackageVersion","packageName",n),et("deletePackageVersion","version",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{version}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"DELETE",...s,...o},f={},u={};f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}},getPackageVersion:async(t,n,r,o={})=>{et("getPackageVersion","environmentName",t),et("getPackageVersion","packageName",n),et("getPackageVersion","version",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{version}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}},listPackageVersions:async(t,n,r={})=>{et("listPackageVersions","environmentName",t),et("listPackageVersions","packageName",n);const o="/environments/{environmentName}/packages/{packageName}/versions".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,yn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},c={},f={};c.Accept="application/json",vn(a,f);let u=i&&i.headers?i.headers:{};return s.headers={...c,...u,...r.headers},{url:bn(a),options:s}},setPackageLatestVersion:async(t,n,r,o={})=>{et("setPackageLatestVersion","environmentName",t),et("setPackageLatestVersion","packageName",n),et("setPackageLatestVersion","packageLatestVersion",r);const a="/environments/{environmentName}/packages/{packageName}/latest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"PUT",...s,...o},f={},u={};f["Content-Type"]="application/json",f.Accept="application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},c.data=Eo(r,c,e),{url:bn(i),options:c}},setPackageVersionManifest:async(t,n,r,o,a={})=>{et("setPackageVersionManifest","environmentName",t),et("setPackageVersionManifest","packageName",n),et("setPackageVersionManifest","version",r),et("setPackageVersionManifest","packageVersionManifest",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{version}/manifest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"PUT",...c,...a},u={},h={};u["Content-Type"]="application/json",u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},f.data=Eo(o,f,e),{url:bn(s),options:f}},updatePackageVersion:async(t,n,r,o,a={})=>{et("updatePackageVersion","environmentName",t),et("updatePackageVersion","packageName",n),et("updatePackageVersion","version",r),et("updatePackageVersion","packageVersionUpdate",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{version}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(r))),s=new URL(i,yn);let c;e&&(c=e.baseOptions);const f={method:"PATCH",...c,...a},u={},h={};u["Content-Type"]="application/json",u.Accept="application/json",vn(s,h);let g=c&&c.headers?c.headers:{};return f.headers={...u,...g,...a.headers},f.data=Eo(o,f,e),{url:bn(s),options:f}}}},_f=function(e){const t=tte(e);return{async deletePackageVersion(n,r,o,a){const i=await t.deletePackageVersion(n,r,o,a),s=e?.serverIndex??0,c=gn["VersionsApi.deletePackageVersion"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async getPackageVersion(n,r,o,a){const i=await t.getPackageVersion(n,r,o,a),s=e?.serverIndex??0,c=gn["VersionsApi.getPackageVersion"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async listPackageVersions(n,r,o){const a=await t.listPackageVersions(n,r,o),i=e?.serverIndex??0,s=gn["VersionsApi.listPackageVersions"]?.[i]?.url;return(c,f)=>xn(a,Ft,pn,e)(c,s||f)},async setPackageLatestVersion(n,r,o,a){const i=await t.setPackageLatestVersion(n,r,o,a),s=e?.serverIndex??0,c=gn["VersionsApi.setPackageLatestVersion"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)},async setPackageVersionManifest(n,r,o,a,i){const s=await t.setPackageVersionManifest(n,r,o,a,i),c=e?.serverIndex??0,f=gn["VersionsApi.setPackageVersionManifest"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)},async updatePackageVersion(n,r,o,a,i){const s=await t.updatePackageVersion(n,r,o,a,i),c=e?.serverIndex??0,f=gn["VersionsApi.updatePackageVersion"]?.[c]?.url;return(u,h)=>xn(s,Ft,pn,e)(u,f||h)}}};let nte=class extends $i{deletePackageVersion(t,n,r,o){return _f(this.configuration).deletePackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageVersion(t,n,r,o){return _f(this.configuration).getPackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}listPackageVersions(t,n,r){return _f(this.configuration).listPackageVersions(t,n,r).then(o=>o(this.axios,this.basePath))}setPackageLatestVersion(t,n,r,o){return _f(this.configuration).setPackageLatestVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}setPackageVersionManifest(t,n,r,o,a){return _f(this.configuration).setPackageVersionManifest(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updatePackageVersion(t,n,r,o,a){return _f(this.configuration).updatePackageVersion(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}};const rte=function(e){return{getWatchStatus:async(t={})=>{const n="/watch-mode/status",r=new URL(n,yn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",vn(r,s);let c=o&&o.headers?o.headers:{};return a.headers={...i,...c,...t.headers},{url:bn(r),options:a}},startWatching:async(t,n={})=>{et("startWatching","startWatchRequest",t);const r="/watch-mode/start",o=new URL(r,yn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},c={};s["Content-Type"]="application/json",s.Accept="application/json",vn(o,c);let f=a&&a.headers?a.headers:{};return i.headers={...s,...f,...n.headers},i.data=Eo(t,i,e),{url:bn(o),options:i}},stopWatching:async(t={})=>{const n="/watch-mode/stop",r=new URL(n,yn);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...t},i={},s={};i.Accept="application/json",vn(r,s);let c=o&&o.headers?o.headers:{};return a.headers={...i,...c,...t.headers},{url:bn(r),options:a}},streamPackageEvents:async(t,n,r,o={})=>{et("streamPackageEvents","environmentName",t),et("streamPackageEvents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/events".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,yn);let s;e&&(s=e.baseOptions);const c={method:"GET",...s,...o},f={},u={};r!==void 0&&(u.versionId=r),f.Accept="text/event-stream,application/json",vn(i,u);let h=s&&s.headers?s.headers:{};return c.headers={...f,...h,...o.headers},{url:bn(i),options:c}}}},Kv=function(e){const t=rte(e);return{async getWatchStatus(n){const r=await t.getWatchStatus(n),o=e?.serverIndex??0,a=gn["WatchModeApi.getWatchStatus"]?.[o]?.url;return(i,s)=>xn(r,Ft,pn,e)(i,a||s)},async startWatching(n,r){const o=await t.startWatching(n,r),a=e?.serverIndex??0,i=gn["WatchModeApi.startWatching"]?.[a]?.url;return(s,c)=>xn(o,Ft,pn,e)(s,i||c)},async stopWatching(n){const r=await t.stopWatching(n),o=e?.serverIndex??0,a=gn["WatchModeApi.stopWatching"]?.[o]?.url;return(i,s)=>xn(r,Ft,pn,e)(i,a||s)},async streamPackageEvents(n,r,o,a){const i=await t.streamPackageEvents(n,r,o,a),s=e?.serverIndex??0,c=gn["WatchModeApi.streamPackageEvents"]?.[s]?.url;return(f,u)=>xn(i,Ft,pn,e)(f,c||u)}}};let ote=class extends $i{getWatchStatus(t){return Kv(this.configuration).getWatchStatus(t).then(n=>n(this.axios,this.basePath))}startWatching(t,n){return Kv(this.configuration).startWatching(t,n).then(r=>r(this.axios,this.basePath))}stopWatching(t){return Kv(this.configuration).stopWatching(t).then(n=>n(this.axios,this.basePath))}streamPackageEvents(t,n,r,o){return Kv(this.configuration).streamPackageEvents(t,n,r,o).then(a=>a(this.axios,this.basePath))}},ate=class{apiKey;username;password;accessToken;awsv4;basePath;serverIndex;baseOptions;formDataCtor;constructor(t={}){this.apiKey=t.apiKey,this.username=t.username,this.password=t.password,this.accessToken=t.accessToken,this.awsv4=t.awsv4,this.basePath=t.basePath,this.serverIndex=t.serverIndex,this.baseOptions={...t.baseOptions,headers:{...t.baseOptions?.headers}},this.formDataCtor=t.formDataCtor}isJsonMime(t){return t!==null&&/^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$/i.test(t)}};const ZR=new eZ({defaultOptions:{queries:{retry:!1,throwOnError:!1,refetchOnWindowFocus:!1},mutations:{retry:!1,throwOnError:!1}}}),ite={staleTime:300*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!1},HC="publisher:themeMode";function ste(){if(!(typeof window>"u"))try{const e=window.localStorage.getItem(HC);if(e==="light"||e==="dark"||e==="auto")return e}catch{}}function lte(e){if(!(typeof window>"u"))try{e===void 0?window.localStorage.removeItem(HC):window.localStorage.setItem(HC,e)}catch{}}function cte(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}Ft.defaults.baseURL||(Ft.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet");const W5=C.createContext(void 0),ute=(e,t)=>{const n=`${window.location.protocol}//${window.location.host}/api/v0`,r=Ft.create({baseURL:e||n,withCredentials:!0,timeout:6e5});r.interceptors.request.use(async a=>{const i=await t?.();return a.headers.Authorization=i||"",a});const o=new ate({basePath:n});return{models:new Wee(o,n,r),publisher:new Zee(o,n,r),environments:new Uee(o,n,r),packages:new Qee(o,n,r),dashboards:new Dee(o,n,r),dataApps:new Iee(o,n,r),notebooks:new Kee(o,n,r),reports:new ete(o,n,r),connections:new Pee(o,n,r),databases:new Fee(o,n,r),materializations:new Vee(o,n,r),watchMode:new ote(o,n,r),versions:new nte(o,n,r)}},dte=e=>m.jsx(tZ,{client:ZR,children:m.jsx(fte,{...e})}),fte=({children:e,getAccessToken:t,baseURL:n,mutable:r,theme:o,ui:a})=>{const i=C.useMemo(()=>ute(n,t),[n,t]),s=n||`${window.location.protocol}//${window.location.host}/api/v0`,c=VR({queryKey:["status"],queryFn:async()=>(await i.publisher.getStatus()).data});c.error&&console.error("Failed to fetch publisher status:",c.error);const f=c.data?.frozenConfig,u=c.data?.theme,h=c.isLoading;let g;c.isLoading||c.error?g=r:f?g=!1:g=r??!0;const y=C.useMemo(()=>[u,o],[u,o]),[b,S]=C.useState(ste),[w,x]=C.useState(cte);C.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const I=window.matchMedia("(prefers-color-scheme: dark)"),j=_=>x(_.matches);return I.addEventListener("change",j),()=>I.removeEventListener("change",j)},[]);const R=C.useCallback(I=>{S(I),lte(I)},[]),k=u?.allowUserToggle??!0,T=k?b:void 0,O=C.useMemo(()=>Eee(u?.defaultMode,T,w),[u?.defaultMode,T,w]),A={server:s,getAccessToken:t,apiClients:i,mutable:g,isLoadingStatus:h,instanceTheme:u};return m.jsx(W5.Provider,{value:A,children:m.jsx(Tee,{layers:y,mode:O,userChoice:T,setMode:R,allowUserToggle:k,...a?{ui:a}:{},children:e})})},hr=()=>{const e=C.useContext(W5);if(e===void 0)throw new Error("useServer must be used within a ServerProvider");return e};function nd(){return nd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nd.apply(this,arguments)}const pte=["children","options"],tA=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{class:"className",for:"htmlFor"}),nA={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},hte=["style","script","pre"],mte=["src","href","data","formAction","srcDoc","action"],gte=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,yte=/mailto:/i,vte=/\n{2,}$/,rA=/^(\s*>[\s\S]*?)(?=\n\n|$)/,bte=/^ *> ?/gm,xte=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Ste=/^ {2,}\n/,wte=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,oA=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,aA=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,Cte=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,kte=/^(?:\n *)*\n/,Rte=/\r\n?/g,Ete=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,Tte=/^\[\^([^\]]+)]/,$te=/\f/g,Mte=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,Ote=/^\s*?\[(x|\s)\]/,iA=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,sA=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,lA=/^([^\n]+)\n *(=|-){3,} *\n/,lw=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,Pte=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,cA=/^<!--[\s\S]*?(?:-->)/,Ate=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,cw=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,Dte=/^\{.*\}$/,jte=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,Nte=/^<([^ >]+@[^ >]+)>/,Ite=/^<([^ >]+:\/[^ >]+)>/,Lte=/-([a-z])?/gi,uA=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,zte=/^[^\n]+(?: \n|\n{2,})/,Fte=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,_te=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,Ute=/^\[([^\]]*)\] ?\[([^\]]*)\]/,Bte=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,Vte=/\t/g,Hte=/(^ *\||\| *$)/g,qte=/^ *:-+: *$/,Wte=/^ *:-+ *$/,Yte=/^ *-+: *$/,px=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,hx="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",Kte=RegExp(`^([*_])\\1${px(1)}${hx}\\1\\1(?!\\1)`),Gte=RegExp(`^([*_])${px(0)}${hx}\\1(?!\\1)`),Qte=RegExp(`^(==)${px(0)}${hx}\\1`),Xte=RegExp(`^(~~)${px(0)}${hx}\\1`),Zte=/^(:[a-zA-Z0-9-_]+:)/,Jte=/^\\([^0-9A-Za-z\s])/,ene=/\\([^0-9A-Za-z\s])/g,tne=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,nne=/^\n+/,rne=/^([ \t]*)/,one=/(?:^|\n)( *)$/,JR="(?:\\d+\\.)",eE="(?:[*+-])";function Y5(e){return"( *)("+(e===1?JR:eE)+") +"}const K5=Y5(1),G5=Y5(2);function Q5(e){return RegExp("^"+(e===1?K5:G5))}const ane=Q5(1),ine=Q5(2);function X5(e){return RegExp("^"+(e===1?K5:G5)+"[^\\n]*(?:\\n(?!\\1"+(e===1?JR:eE)+" )[^\\n]*)*(\\n|$)","gm")}const sne=X5(1),lne=X5(2);function Z5(e){const t=e===1?JR:eE;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const J5=Z5(1),ez=Z5(2);function dA(e,t){const n=t===1,r=n?J5:ez,o=n?sne:lne,a=n?ane:ine;return{t:i=>a.test(i),o:Tp(function(i,s){const c=one.exec(s.prevCapture);return c&&(s.list||!s.inline&&!s.simple)?r.exec(i=c[1]+i):null}),i:1,u(i,s,c){const f=n?+i[2]:void 0,u=i[0].replace(vte,`
275
275
  `).match(o);let h=!1;return{items:u.map(function(g,y){const b=a.exec(g)[0].length,S=RegExp("^ {1,"+b+"}","gm"),w=g.replace(S,"").replace(a,""),x=y===u.length-1,R=w.indexOf(`
276
276
 
277
277
  `)!==-1||x&&h;h=R;const k=c.inline,T=c.list;let O;c.list=!0,R?(c.inline=!1,O=yg(w)+`
@@ -468,7 +468,7 @@ ${t}`}function Zie(e){return e?.status===403}const md=1e3,vE=200;function a4(e){
468
468
  `));u&&j.current&&j.current.getSectionContent(O.startIndex).focus()},[]),{interactions:F,returnedValue:{autoFocus:u,readOnly:n,focused:f??L,sectionListRef:_,onBlur:re,onClick:W,onFocus:Y,onInput:K,onPaste:ae,enableAccessibleFieldDOMStructure:!0,elements:fe,tabIndex:S===0?-1:0,contentEditable:ce,value:me,onChange:he,areAllSectionsEmpty:A}}},sp=e=>e.replace(/[\u2066\u2067\u2068\u2069]/g,""),nhe=(e,t,n)=>{let r=0,o=n?1:0;const a=[];for(let i=0;i<e.length;i+=1){const s=e[i],c=kE(s,n?"input-rtl":"input-ltr",t),f=`${s.startSeparator}${c}${s.endSeparator}`,u=sp(f).length,h=f.length,g=sp(c),y=o+(g===""?0:c.indexOf(g[0]))+s.startSeparator.length,b=y+g.length;a.push(ze({},s,{start:r,end:r+u,startInInput:y,endInInput:b})),r+=u,o+=h}return a},rhe=e=>{const t=As(),n=C.useRef(void 0),r=C.useRef(void 0),{forwardedProps:{onFocus:o,onClick:a,onPaste:i,onBlur:s,inputRef:c,placeholder:f},internalProps:{readOnly:u=!1,disabled:h=!1},parsedSelectedSections:g,activeSectionIndex:y,state:b,fieldValueManager:S,valueManager:w,applyCharacterEditing:x,resetCharacterQuery:R,updateSectionValue:k,updateValueFromValueStr:T,clearActiveSection:O,clearValue:A,setTempAndroidValueStr:I,setSelectedSections:j,getSectionsFromValue:_,areAllSectionsEmpty:z,localizedDigits:B}=e,E=C.useRef(null),L=yr(c,E),N=C.useMemo(()=>nhe(b.sections,B,t),[b.sections,B,t]),F=C.useMemo(()=>({syncSelectionToDOM:()=>{if(!E.current)return;if(g==null){E.current.scrollLeft&&(E.current.scrollLeft=0);return}if(E.current!==Fa(document))return;const ee=E.current.scrollTop;if(g==="all")E.current.select();else{const te=N[g],de=te.type==="empty"?te.startInInput-te.startSeparator.length:te.startInInput,ce=te.type==="empty"?te.endInInput+te.endSeparator.length:te.endInInput;(de!==E.current.selectionStart||ce!==E.current.selectionEnd)&&E.current===Fa(document)&&E.current.setSelectionRange(de,ce),clearTimeout(r.current),r.current=setTimeout(()=>{E.current&&E.current===Fa(document)&&E.current.selectionStart===E.current.selectionEnd&&(E.current.selectionStart!==de||E.current.selectionEnd!==ce)&&F.syncSelectionToDOM()})}E.current.scrollTop=ee},getActiveSectionIndexFromDOM:()=>{const ee=E.current.selectionStart??0,te=E.current.selectionEnd??0;if(ee===0&&te===0)return null;const de=ee<=N[0].startInInput?1:N.findIndex(ce=>ce.startInInput-ce.startSeparator.length>ee);return de===-1?N.length-1:de-1},focusField:(ee=0)=>{Fa(document)!==E.current&&(E.current?.focus(),j(ee))},setSelectedSections:ee=>j(ee),isFieldFocused:()=>E.current===Fa(document)}),[E,g,N,j]),D=()=>{const ee=E.current.selectionStart??0;let te;ee<=N[0].startInInput||ee>=N[N.length-1].endInInput?te=1:te=N.findIndex(ce=>ce.startInInput-ce.startSeparator.length>ee);const de=te===-1?N.length-1:te-1;j(de)},W=qt((...ee)=>{o?.(...ee);const te=E.current;clearTimeout(n.current),n.current=setTimeout(()=>{!te||te!==E.current||y==null&&(te.value.length&&Number(te.selectionEnd)-Number(te.selectionStart)===te.value.length?j("all"):D())})}),K=qt((ee,...te)=>{ee.isDefaultPrevented()||(a?.(ee,...te),D())}),ae=qt(ee=>{if(i?.(ee),ee.preventDefault(),u||h)return;const te=ee.clipboardData.getData("text");if(typeof g=="number"){const de=b.sections[g],ce=/^[a-zA-Z]+$/.test(te),fe=/^[0-9]+$/.test(te),he=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(te);if(de.contentType==="letter"&&ce||de.contentType==="digit"&&fe||de.contentType==="digit-with-letter"&&he){R(),k({activeSection:de,newSectionValue:te,shouldGoToNextSection:!0});return}if(ce||fe)return}R(),T(te)}),Y=qt((...ee)=>{s?.(...ee),j(null)}),re=qt(ee=>{if(u)return;const te=ee.target.value;if(te===""){R(),A();return}const de=ee.nativeEvent.data,ce=de&&de.length>1,fe=ce?de:te,he=sp(fe);if(g==="all"&&j(y),y==null||ce){T(ce?de:he);return}let me;if(g==="all"&&he.length===1)me=he;else{const le=sp(S.getV6InputValueFromSections(N,B,t));let be=-1,Ie=-1;for(let se=0;se<le.length;se+=1)be===-1&&le[se]!==he[se]&&(be=se),Ie===-1&&le[le.length-se-1]!==he[he.length-se-1]&&(Ie=se);const Ne=N[y];if(be<Ne.start||le.length-Ie-1>Ne.end)return;const ge=he.length-le.length+Ne.end-sp(Ne.endSeparator||"").length;me=he.slice(Ne.start+sp(Ne.startSeparator||"").length,ge)}if(me.length===0){sle()&&I(fe),R(),O();return}x({keyPressed:me,sectionIndex:y})}),ue=C.useMemo(()=>f!==void 0?f:S.getV6InputValueFromSections(_(w.emptyValue),B,t),[f,S,_,w.emptyValue,B,t]),X=C.useMemo(()=>b.tempValueStrAndroid??S.getV6InputValueFromSections(b.sections,B,t),[b.sections,S,b.tempValueStrAndroid,B,t]);C.useEffect(()=>(E.current&&E.current===Fa(document)&&j("all"),()=>{clearTimeout(n.current),clearTimeout(r.current)}),[]);const oe=C.useMemo(()=>y==null||b.sections[y].contentType==="letter"?"text":"numeric",[y,b.sections]),J=!(E.current&&E.current===Fa(document))&&z;return{interactions:F,returnedValue:{readOnly:u,onBlur:Y,onClick:K,onFocus:W,onPaste:ae,inputRef:L,enableAccessibleFieldDOMStructure:!1,placeholder:ue,inputMode:oe,autoComplete:"off",value:J?"":X,onChange:re}}},ohe=e=>{const t=Kr(),{internalProps:n,internalProps:{unstableFieldRef:r,minutesStep:o,enableAccessibleFieldDOMStructure:a=!1,disabled:i=!1,readOnly:s=!1},forwardedProps:{onKeyDown:c,error:f,clearable:u,onClear:h},fieldValueManager:g,valueManager:y,validator:b}=e,S=As(),w=Zpe(e),{state:x,activeSectionIndex:R,parsedSelectedSections:k,setSelectedSections:T,clearValue:O,clearActiveSection:A,updateSectionValue:I,setTempAndroidValueStr:j,sectionsValueBoundaries:_,localizedDigits:z,timezone:B}=w,E=ehe({sections:x.sections,updateSectionValue:I,sectionsValueBoundaries:_,localizedDigits:z,setTempAndroidValueStr:j,timezone:B}),{resetCharacterQuery:L}=E,N=y.areValuesEqual(t,x.value,y.emptyValue),F=a?the:rhe,D=C.useMemo(()=>lle(x.sections,S&&!a),[x.sections,S,a]),{returnedValue:W,interactions:K}=F(ze({},e,w,E,{areAllSectionsEmpty:N,sectionOrder:D})),ae=qt(J=>{if(c?.(J),!i)switch(!0){case((J.ctrlKey||J.metaKey)&&String.fromCharCode(J.keyCode)==="A"&&!J.shiftKey&&!J.altKey):{J.preventDefault(),T("all");break}case J.key==="ArrowRight":{if(J.preventDefault(),k==null)T(D.startIndex);else if(k==="all")T(D.endIndex);else{const ee=D.neighbors[k].rightIndex;ee!==null&&T(ee)}break}case J.key==="ArrowLeft":{if(J.preventDefault(),k==null)T(D.endIndex);else if(k==="all")T(D.startIndex);else{const ee=D.neighbors[k].leftIndex;ee!==null&&T(ee)}break}case J.key==="Delete":{if(J.preventDefault(),s)break;k==null||k==="all"?O():A(),L();break}case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(J.key):{if(J.preventDefault(),s||R==null)break;k==="all"&&T(R);const ee=x.sections[R],te=g.getActiveDateManager(t,x,ee),de=ele(t,B,ee,J.key,_,z,te.date,{minutesStep:o});I({activeSection:ee,newSectionValue:de,shouldGoToNextSection:!1});break}}});Ho(()=>{K.syncSelectionToDOM()});const{hasValidationError:Y}=$4({props:n,validator:b,timezone:B,value:x.value,onError:n.onError}),re=C.useMemo(()=>f!==void 0?f:Y,[Y,f]);C.useEffect(()=>{!re&&R==null&&L()},[x.referenceValue,R,re]),C.useEffect(()=>{x.tempValueStrAndroid!=null&&R!=null&&(L(),A())},[x.sections]),C.useImperativeHandle(r,()=>({getSections:()=>x.sections,getActiveSectionIndex:K.getActiveSectionIndexFromDOM,setSelectedSections:K.setSelectedSections,focusField:K.focusField,isFieldFocused:K.isFieldFocused}));const ue=qt((J,...ee)=>{J.preventDefault(),h?.(J,...ee),O(),K.isFieldFocused()?T(D.startIndex):K.focusField(0)}),X={onKeyDown:ae,onClear:ue,error:re,clearable:!!(u&&!N&&!s&&!i)},oe={disabled:i,readOnly:s};return ze({},e.forwardedProps,X,oe,W)},ahe=["clearable","onClear","InputProps","sx","slots","slotProps"],ihe=["ownerState"],she=e=>{const t=lc(),{clearable:n,onClear:r,InputProps:o,sx:a,slots:i,slotProps:s}=e,c=Vn(e,ahe),f=i?.clearButton??pu,u=wr({elementType:f,externalSlotProps:s?.clearButton,ownerState:{},className:"clearButton",additionalProps:{title:t.fieldClearLabel}}),h=Vn(u,ihe),g=i?.clearIcon??gfe,y=wr({elementType:g,externalSlotProps:s?.clearIcon,ownerState:{}});return ze({},c,{InputProps:ze({},o,{endAdornment:m.jsxs(C.Fragment,{children:[n&&m.jsx(M4,{position:"end",sx:{marginRight:o?.endAdornment?-1:-1.5},children:m.jsx(f,ze({},h,{onClick:r,children:m.jsx(g,ze({fontSize:"small"},y))}))}),o?.endAdornment]})}),sx:[{"& .clearButton":{opacity:1},"@media (pointer: fine)":{"& .clearButton":{opacity:0},"&:hover, &:focus-within":{".clearButton":{opacity:1}}}},...Array.isArray(a)?a:[a]]})},lhe=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator"],che=(e,t)=>C.useMemo(()=>{const n=ze({},e),r={},o=a=>{n.hasOwnProperty(a)&&(r[a]=n[a],delete n[a])};return lhe.forEach(o),E4.forEach(o),{forwardedProps:n,internalProps:r}},[e,t]),uhe=e=>{const t=Kr(),n=ky();return ze({},e,{disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,format:e.format??t.formats.keyboardDate,minDate:rs(t,e.minDate,n.minDate),maxDate:rs(t,e.maxDate,n.maxDate)})},dhe=e=>{const t=uhe(e),{forwardedProps:n,internalProps:r}=che(t,"date");return ohe({forwardedProps:n,internalProps:r,valueManager:ml,fieldValueManager:fle,validator:Ry,valueType:"date"})};function fhe(e){return un("MuiPickersTextField",e)}nn("MuiPickersTextField",["root","focused","disabled","error","required"]);function phe(e){return un("MuiPickersInputBase",e)}const yp=nn("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input"]);function hhe(e){return un("MuiPickersSectionList",e)}const Am=nn("MuiPickersSectionList",["root","section","sectionContent"]),mhe=["slots","slotProps","elements","sectionListRef"],fF=Ze("div",{name:"MuiPickersSectionList",slot:"Root",overridesResolver:(e,t)=>t.root})({direction:"ltr /*! @noflip */",outline:"none"}),pF=Ze("span",{name:"MuiPickersSectionList",slot:"Section",overridesResolver:(e,t)=>t.section})({}),hF=Ze("span",{name:"MuiPickersSectionList",slot:"SectionSeparator",overridesResolver:(e,t)=>t.sectionSeparator})({whiteSpace:"pre"}),mF=Ze("span",{name:"MuiPickersSectionList",slot:"SectionContent",overridesResolver:(e,t)=>t.sectionContent})({outline:"none"}),ghe=e=>{const{classes:t}=e;return ln({root:["root"],section:["section"],sectionContent:["sectionContent"]},hhe,t)};function yhe(e){const{slots:t,slotProps:n,element:r,classes:o}=e,a=t?.section??pF,i=wr({elementType:a,externalSlotProps:n?.section,externalForwardedProps:r.container,className:o.section,ownerState:{}}),s=t?.sectionContent??mF,c=wr({elementType:s,externalSlotProps:n?.sectionContent,externalForwardedProps:r.content,additionalProps:{suppressContentEditableWarning:!0},className:o.sectionContent,ownerState:{}}),f=t?.sectionSeparator??hF,u=wr({elementType:f,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.before,ownerState:{position:"before"}}),h=wr({elementType:f,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.after,ownerState:{position:"after"}});return m.jsxs(a,ze({},i,{children:[m.jsx(f,ze({},u)),m.jsx(s,ze({},c)),m.jsx(f,ze({},h))]}))}const vhe=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersSectionList"}),{slots:r,slotProps:o,elements:a,sectionListRef:i}=n,s=Vn(n,mhe),c=ghe(n),f=C.useRef(null),u=yr(t,f),h=b=>{if(!f.current)throw new Error(`MUI X: Cannot call sectionListRef.${b} before the mount of the component.`);return f.current};C.useImperativeHandle(i,()=>({getRoot(){return h("getRoot")},getSectionContainer(b){return h("getSectionContainer").querySelector(`.${Am.section}[data-sectionindex="${b}"]`)},getSectionContent(b){return h("getSectionContent").querySelector(`.${Am.section}[data-sectionindex="${b}"] .${Am.sectionContent}`)},getSectionIndexFromDOMElement(b){const S=h("getSectionIndexFromDOMElement");if(b==null||!S.contains(b))return null;let w=null;return b.classList.contains(Am.section)?w=b:b.classList.contains(Am.sectionContent)&&(w=b.parentElement),w==null?null:Number(w.dataset.sectionindex)}}));const g=r?.root??fF,y=wr({elementType:g,externalSlotProps:o?.root,externalForwardedProps:s,additionalProps:{ref:u,suppressContentEditableWarning:!0},className:c.root,ownerState:{}});return m.jsx(g,ze({},y,{children:y.contentEditable?a.map(({content:b,before:S,after:w})=>`${S.children}${b.children}${w.children}`).join(""):m.jsx(C.Fragment,{children:a.map((b,S)=>m.jsx(yhe,{slots:r,slotProps:o,element:b,classes:c},S))})}))}),bhe=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef"],xhe=e=>Math.round(e*1e5)/1e5,Kx=Ze("div",{name:"MuiPickersInputBase",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>ze({},e.typography.body1,{color:(e.vars||e).palette.text.primary,cursor:"text",padding:0,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",boxSizing:"border-box",letterSpacing:`${xhe(.15/16)}em`,variants:[{props:{fullWidth:!0},style:{width:"100%"}}]})),qE=Ze(fF,{name:"MuiPickersInputBase",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})(({theme:e})=>({padding:"4px 0 5px",fontFamily:e.typography.fontFamily,fontSize:"inherit",lineHeight:"1.4375em",flexGrow:1,outline:"none",display:"flex",flexWrap:"nowrap",overflow:"hidden",letterSpacing:"inherit",width:"182px",variants:[{props:{isRtl:!0},style:{textAlign:"right /*! @noflip */"}},{props:{size:"small"},style:{paddingTop:1}},{props:{adornedStart:!1,focused:!1,filled:!1},style:{color:"currentColor",opacity:0}},{props:({adornedStart:t,focused:n,filled:r,label:o})=>!t&&!n&&!r&&o==null,style:e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:e.palette.mode==="light"?.42:.5}}]})),She=Ze(pF,{name:"MuiPickersInputBase",slot:"Section",overridesResolver:(e,t)=>t.section})(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit",letterSpacing:"inherit",lineHeight:"1.4375em",display:"inline-block",whiteSpace:"nowrap"})),whe=Ze(mF,{name:"MuiPickersInputBase",slot:"SectionContent",overridesResolver:(e,t)=>t.content})(({theme:e})=>({fontFamily:e.typography.fontFamily,lineHeight:"1.4375em",letterSpacing:"inherit",width:"fit-content",outline:"none"})),Che=Ze(hF,{name:"MuiPickersInputBase",slot:"Separator",overridesResolver:(e,t)=>t.separator})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),khe=Ze("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(e,t)=>t.hiddenInput})(ze({},_se)),Rhe=e=>{const{focused:t,disabled:n,error:r,classes:o,fullWidth:a,readOnly:i,color:s,size:c,endAdornment:f,startAdornment:u}=e,h={root:["root",t&&!n&&"focused",n&&"disabled",i&&"readOnly",r&&"error",a&&"fullWidth",`color${Et(s)}`,c==="small"&&"inputSizeSmall",!!u&&"adornedStart",!!f&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"]};return ln(h,phe,o)},WE=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersInputBase"}),{elements:r,areAllSectionsEmpty:o,value:a,onChange:i,id:s,endAdornment:c,startAdornment:f,renderSuffix:u,slots:h,slotProps:g,contentEditable:y,tabIndex:b,onInput:S,onPaste:w,onKeyDown:x,name:R,readOnly:k,inputProps:T,inputRef:O,sectionListRef:A}=n,I=Vn(n,bhe),j=C.useRef(null),_=yr(t,j),z=yr(T?.ref,O),B=As(),E=Oi();if(!E)throw new Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");const L=ae=>{if(E.disabled){ae.stopPropagation();return}E.onFocus?.(ae)};C.useEffect(()=>{E&&E.setAdornedStart(!!f)},[E,f]),C.useEffect(()=>{E&&(o?E.onEmpty():E.onFilled())},[E,o]);const N=ze({},n,E,{isRtl:B}),F=Rhe(N),D=h?.root||Kx,W=wr({elementType:D,externalSlotProps:g?.root,externalForwardedProps:I,additionalProps:{"aria-invalid":E.error,ref:_},className:F.root,ownerState:N}),K=h?.input||qE;return m.jsxs(D,ze({},W,{children:[f,m.jsx(vhe,{sectionListRef:A,elements:r,contentEditable:y,tabIndex:b,className:F.sectionsContainer,onFocus:L,onBlur:E.onBlur,onInput:S,onPaste:w,onKeyDown:x,slots:{root:K,section:She,sectionContent:whe,sectionSeparator:Che},slotProps:{root:{ownerState:N},sectionContent:{className:yp.sectionContent},sectionSeparator:({position:ae})=>({className:ae==="before"?yp.sectionBefore:yp.sectionAfter})}}),c,u?u(ze({},E)):null,m.jsx(khe,ze({name:R,className:F.input,value:a,onChange:i,id:s,"aria-hidden":"true",tabIndex:-1,readOnly:k,required:E.required,disabled:E.disabled},T,{ref:z}))]}))});function Ehe(e){return un("MuiPickersOutlinedInput",e)}const Rs=ze({},yp,nn("MuiPickersOutlinedInput",["root","notchedOutline","input"])),The=["children","className","label","notched","shrink"],$he=Ze("fieldset",{name:"MuiPickersOutlinedInput",slot:"NotchedOutline",overridesResolver:(e,t)=>t.notchedOutline})(({theme:e})=>{const t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%",borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}}),wj=Ze("span")(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit"})),Mhe=Ze("legend")(({theme:e})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:{withLabel:!1},style:{padding:0,lineHeight:"11px",transition:e.transitions.create("width",{duration:150,easing:e.transitions.easing.easeOut})}},{props:{withLabel:!0},style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:e.transitions.create("max-width",{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:{withLabel:!0,notched:!0},style:{maxWidth:"100%",transition:e.transitions.create("max-width",{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]}));function Ohe(e){const{className:t,label:n}=e,r=Vn(e,The),o=n!=null&&n!=="",a=ze({},e,{withLabel:o});return m.jsx($he,ze({"aria-hidden":!0,className:t},r,{ownerState:a,children:m.jsx(Mhe,{ownerState:a,children:o?m.jsx(wj,{children:n}):m.jsx(wj,{className:"notranslate",children:"​"})})}))}const Phe=["label","autoFocus","ownerState","notched"],Ahe=Ze(Kx,{name:"MuiPickersOutlinedInput",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>{const t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{padding:"0 14px",borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${Rs.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${Rs.notchedOutline}`]:{borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}},[`&.${Rs.focused} .${Rs.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${Rs.disabled}`]:{[`& .${Rs.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled},"*":{color:(e.vars||e).palette.action.disabled}},[`&.${Rs.error} .${Rs.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},variants:Object.keys((e.vars??e).palette).filter(n=>(e.vars??e).palette[n]?.main??!1).map(n=>({props:{color:n},style:{[`&.${Rs.focused}:not(.${Rs.error}) .${Rs.notchedOutline}`]:{borderColor:(e.vars||e).palette[n].main}}}))}}),Dhe=Ze(qE,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({padding:"16.5px 0",variants:[{props:{size:"small"},style:{padding:"8.5px 0"}}]}),jhe=e=>{const{classes:t}=e,n=ln({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},Ehe,t);return ze({},t,n)},gF=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersOutlinedInput"}),{label:r,ownerState:o,notched:a}=n,i=Vn(n,Phe),s=Oi(),c=ze({},n,o,s,{color:s?.color||"primary"}),f=jhe(c);return m.jsx(WE,ze({slots:{root:Ahe,input:Dhe},renderSuffix:u=>m.jsx(Ohe,{shrink:!!(a||u.adornedStart||u.focused||u.filled),notched:!!(a||u.adornedStart||u.focused||u.filled),className:f.notchedOutline,label:r!=null&&r!==""&&s?.required?m.jsxs(C.Fragment,{children:[r," ","*"]}):r,ownerState:c})},i,{label:r,classes:f,ref:t}))});gF.muiName="Input";function Nhe(e){return un("MuiPickersFilledInput",e)}const Ku=ze({},yp,nn("MuiPickersFilledInput",["root","underline","input"])),Ihe=["label","autoFocus","disableUnderline","ownerState"],Lhe=Ze(Kx,{name:"MuiPickersFilledInput",slot:"Root",overridesResolver:(e,t)=>t.root,shouldForwardProp:e=>xb(e)&&e!=="disableUnderline"})(({theme:e})=>{const t=e.palette.mode==="light",n=t?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)",r=t?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)",o=t?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)",a=t?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)";return{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:o,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r}},[`&.${Ku.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${Ku.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:a},variants:[...Object.keys((e.vars??e).palette).filter(i=>(e.vars??e).palette[i].main).map(i=>({props:{color:i,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[i]?.main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Ku.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Ku.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`:n}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${Ku.disabled}, .${Ku.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${Ku.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:({startAdornment:i})=>!!i,style:{paddingLeft:12}},{props:({endAdornment:i})=>!!i,style:{paddingRight:12}}]}}),zhe=Ze(qE,{name:"MuiPickersFilledInput",slot:"sectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,variants:[{props:{size:"small"},style:{paddingTop:21,paddingBottom:4}},{props:({startAdornment:e})=>!!e,style:{paddingLeft:0}},{props:({endAdornment:e})=>!!e,style:{paddingRight:0}},{props:{hiddenLabel:!0},style:{paddingTop:16,paddingBottom:17}},{props:{hiddenLabel:!0,size:"small"},style:{paddingTop:8,paddingBottom:9}}]}),Fhe=e=>{const{classes:t,disableUnderline:n}=e,r=ln({root:["root",!n&&"underline"],input:["input"]},Nhe,t);return ze({},t,r)},yF=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersFilledInput"}),{label:r,disableUnderline:o=!1,ownerState:a}=n,i=Vn(n,Ihe),s=Oi(),c=ze({},n,a,s,{color:s?.color||"primary"}),f=Fhe(c);return m.jsx(WE,ze({slots:{root:Lhe,input:zhe},slotProps:{root:{disableUnderline:o}}},i,{label:r,classes:f,ref:t}))});yF.muiName="Input";function _he(e){return un("MuiPickersFilledInput",e)}const Dm=ze({},yp,nn("MuiPickersInput",["root","input"])),Uhe=["label","autoFocus","disableUnderline","ownerState"],Bhe=Ze(Kx,{name:"MuiPickersInput",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>{let t=e.palette.mode==="light"?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return e.vars&&(t=`rgba(${e.vars.palette.common.onBackgroundChannel} / ${e.vars.opacity.inputUnderline})`),{"label + &":{marginTop:16},variants:[...Object.keys((e.vars??e).palette).filter(n=>(e.vars??e).palette[n].main).map(n=>({props:{color:n},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[n].main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{background:"red",left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Dm.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Dm.error}`]:{"&:before, &:after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${Dm.disabled}, .${Dm.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${Dm.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),Vhe=e=>{const{classes:t,disableUnderline:n}=e,r=ln({root:["root",!n&&"underline"],input:["input"]},_he,t);return ze({},t,r)},vF=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersInput"}),{label:r,disableUnderline:o=!1,ownerState:a}=n,i=Vn(n,Uhe),s=Oi(),c=ze({},n,a,s,{disableUnderline:o,color:s?.color||"primary"}),f=Vhe(c);return m.jsx(WE,ze({slots:{root:Bhe}},i,{label:r,classes:f,ref:t}))});vF.muiName="Input";const Hhe=["onFocus","onBlur","className","color","disabled","error","variant","required","InputProps","inputProps","inputRef","sectionListRef","elements","areAllSectionsEmpty","onClick","onKeyDown","onKeyUp","onPaste","onInput","endAdornment","startAdornment","tabIndex","contentEditable","focused","value","onChange","fullWidth","id","name","helperText","FormHelperTextProps","label","InputLabelProps"],qhe={standard:vF,filled:yF,outlined:gF},Whe=Ze(tF,{name:"MuiPickersTextField",slot:"Root",overridesResolver:(e,t)=>t.root})({maxWidth:"100%"}),Yhe=e=>{const{focused:t,disabled:n,classes:r,required:o}=e;return ln({root:["root",t&&!n&&"focused",n&&"disabled",o&&"required"]},fhe,r)},Khe=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersTextField"}),{onFocus:r,onBlur:o,className:a,color:i="primary",disabled:s=!1,error:c=!1,variant:f="outlined",required:u=!1,InputProps:h,inputProps:g,inputRef:y,sectionListRef:b,elements:S,areAllSectionsEmpty:w,onClick:x,onKeyDown:R,onKeyUp:k,onPaste:T,onInput:O,endAdornment:A,startAdornment:I,tabIndex:j,contentEditable:_,focused:z,value:B,onChange:E,fullWidth:L,id:N,name:F,helperText:D,FormHelperTextProps:W,label:K,InputLabelProps:ae}=n,Y=Vn(n,Hhe),re=C.useRef(null),ue=yr(t,re),X=Ds(N),oe=D&&X?`${X}-helper-text`:void 0,J=K&&X?`${X}-label`:void 0,ee=ze({},n,{color:i,disabled:s,error:c,focused:z,required:u,variant:f}),te=Yhe(ee),de=qhe[f];return m.jsxs(Whe,ze({className:Bt(te.root,a),ref:ue,focused:z,onFocus:r,onBlur:o,disabled:s,variant:f,error:c,color:i,fullWidth:L,required:u,ownerState:ee},Y,{children:[m.jsx(eF,ze({htmlFor:X,id:J},ae,{children:K})),m.jsx(de,ze({elements:S,areAllSectionsEmpty:w,onClick:x,onKeyDown:R,onKeyUp:k,onInput:O,onPaste:T,endAdornment:A,startAdornment:I,tabIndex:j,contentEditable:_,value:B,onChange:E,id:X,fullWidth:L,inputProps:g,inputRef:y,sectionListRef:b,label:K,name:F,role:"group","aria-labelledby":J,"aria-describedby":oe,"aria-live":oe?"polite":void 0},h)),D&&m.jsx(nF,ze({id:oe},W,{children:D}))]}))}),Ghe=["enableAccessibleFieldDOMStructure"],Qhe=["InputProps","readOnly"],Xhe=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef"],Zhe=e=>{let{enableAccessibleFieldDOMStructure:t}=e,n=Vn(e,Ghe);if(t){const{InputProps:h,readOnly:g}=n,y=Vn(n,Qhe);return ze({},y,{InputProps:ze({},h??{},{readOnly:g})})}const{onPaste:r,onKeyDown:o,inputMode:a,readOnly:i,InputProps:s,inputProps:c,inputRef:f}=n,u=Vn(n,Xhe);return ze({},u,{InputProps:ze({},s??{},{readOnly:i}),inputProps:ze({},c??{},{inputMode:a,onPaste:r,onKeyDown:o,ref:f})})},Jhe=["slots","slotProps","InputProps","inputProps"],bF=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiDateField"}),{slots:r,slotProps:o,InputProps:a,inputProps:i}=n,s=Vn(n,Jhe),c=n,f=r?.textField??(e.enableAccessibleFieldDOMStructure?Khe:gr),u=wr({elementType:f,externalSlotProps:o?.textField,externalForwardedProps:s,additionalProps:{ref:t},ownerState:c});u.inputProps=ze({},i,u.inputProps),u.InputProps=ze({},a,u.InputProps);const h=dhe(u),g=Zhe(h),y=she(ze({},g,{slots:r,slotProps:o}));return m.jsx(f,ze({},y))}),xF=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:a,disablePast:i,timezone:s})=>{const c=Ld();return C.useCallback(f=>Ry({adapter:c,value:f,timezone:s,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:a,disablePast:i}})!==null,[c,e,t,n,r,o,a,i,s])},eme=(e,t,n)=>(r,o)=>{switch(o.type){case"changeMonth":return ze({},r,{slideDirection:o.direction,currentMonth:o.newMonth,isMonthSwitchingAnimating:!e});case"changeMonthTimezone":{const a=o.newTimezone;if(n.getTimezone(r.currentMonth)===a)return r;let i=n.setTimezone(r.currentMonth,a);return n.getMonth(i)!==n.getMonth(r.currentMonth)&&(i=n.setMonth(i,n.getMonth(r.currentMonth))),ze({},r,{currentMonth:i})}case"finishMonthSwitchingAnimation":return ze({},r,{isMonthSwitchingAnimating:!1});case"changeFocusedDay":{if(r.focusedDay!=null&&o.focusedDay!=null&&n.isSameDay(o.focusedDay,r.focusedDay))return r;const a=o.focusedDay!=null&&!t&&!n.isSameMonth(r.currentMonth,o.focusedDay);return ze({},r,{focusedDay:o.focusedDay,isMonthSwitchingAnimating:a&&!e&&!o.withoutMonthSwitchingAnimation,currentMonth:a?n.startOfMonth(o.focusedDay):r.currentMonth,slideDirection:o.focusedDay!=null&&n.isAfterDay(o.focusedDay,r.currentMonth)?"left":"right"})}default:throw new Error("missing support")}},tme=e=>{const{value:t,referenceDate:n,disableFuture:r,disablePast:o,disableSwitchToMonthOnDayFocus:a=!1,maxDate:i,minDate:s,onMonthChange:c,reduceAnimations:f,shouldDisableDate:u,timezone:h}=e,g=Kr(),y=C.useRef(eme(!!f,a,g)).current,b=C.useMemo(()=>ml.getInitialReferenceValue({value:t,utils:g,timezone:h,props:e,referenceDate:n,granularity:nl.day}),[n,h]),[S,w]=C.useReducer(y,{isMonthSwitchingAnimating:!1,focusedDay:b,currentMonth:g.startOfMonth(b),slideDirection:"left"});C.useEffect(()=>{w({type:"changeMonthTimezone",newTimezone:g.getTimezone(b)})},[b,g]);const x=C.useCallback(A=>{w(ze({type:"changeMonth"},A)),c&&c(A.newMonth)},[c]),R=C.useCallback(A=>{const I=A;g.isSameMonth(I,S.currentMonth)||x({newMonth:g.startOfMonth(I),direction:g.isAfterDay(I,S.currentMonth)?"left":"right"})},[S.currentMonth,x,g]),k=xF({shouldDisableDate:u,minDate:s,maxDate:i,disableFuture:r,disablePast:o,timezone:h}),T=C.useCallback(()=>{w({type:"finishMonthSwitchingAnimation"})},[]),O=qt((A,I)=>{k(A)||w({type:"changeFocusedDay",focusedDay:A,withoutMonthSwitchingAnimation:I})});return{referenceDate:b,calendarState:S,changeMonth:R,changeFocusedDay:O,isDateDisabled:k,onMonthSwitchingAnimationEnd:T,handleChangeMonth:x}},nme=e=>un("MuiPickersFadeTransitionGroup",e);nn("MuiPickersFadeTransitionGroup",["root"]);const rme=e=>{const{classes:t}=e;return ln({root:["root"]},nme,t)},ome=Ze(Ey,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function SF(e){const t=Yr({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:o,transKey:a}=t,i=rme(t),s=Nd();return o?n:m.jsx(ome,{className:Bt(i.root,r),children:m.jsx(Md,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:s.transitions.duration.enteringScreen,enter:s.transitions.duration.enteringScreen,exit:0},children:n},a)})}function ame(e){return un("MuiPickersDay",e)}const Gu=nn("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),ime=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],sme=e=>{const{selected:t,disableMargin:n,disableHighlightToday:r,today:o,disabled:a,outsideCurrentMonth:i,showDaysOutsideCurrentMonth:s,classes:c}=e,f=i&&!s;return ln({root:["root",t&&!f&&"selected",a&&"disabled",!n&&"dayWithMargin",!r&&o&&"today",i&&s&&"dayOutsideMonth",f&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},ame,c)},wF=({theme:e})=>ze({},e.typography.caption,{width:Wg,height:Wg,borderRadius:"50%",padding:0,backgroundColor:"transparent",transition:e.transitions.create("background-color",{duration:e.transitions.duration.short}),color:(e.vars||e).palette.text.primary,"@media (pointer: fine)":{"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.hoverOpacity})`:Ps(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:Ps(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${Gu.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${Gu.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,fontWeight:e.typography.fontWeightMedium,"&:hover":{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${Gu.disabled}:not(.${Gu.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${Gu.disabled}&.${Gu.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:`0 ${Bx}px`}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${Gu.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),CF=(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disableMargin&&t.dayWithMargin,!n.disableHighlightToday&&n.today&&t.today,!n.outsideCurrentMonth&&n.showDaysOutsideCurrentMonth&&t.dayOutsideMonth,n.outsideCurrentMonth&&!n.showDaysOutsideCurrentMonth&&t.hiddenDaySpacingFiller]},lme=Ze($d,{name:"MuiPickersDay",slot:"Root",overridesResolver:CF})(wF),cme=Ze("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:CF})(({theme:e})=>ze({},wF({theme:e}),{opacity:0,pointerEvents:"none"})),jm=()=>{},ume=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersDay"}),{autoFocus:r=!1,className:o,day:a,disabled:i=!1,disableHighlightToday:s=!1,disableMargin:c=!1,isAnimating:f,onClick:u,onDaySelect:h,onFocus:g=jm,onBlur:y=jm,onKeyDown:b=jm,onMouseDown:S=jm,onMouseEnter:w=jm,outsideCurrentMonth:x,selected:R=!1,showDaysOutsideCurrentMonth:k=!1,children:T,today:O=!1}=n,A=Vn(n,ime),I=ze({},n,{autoFocus:r,disabled:i,disableHighlightToday:s,disableMargin:c,selected:R,showDaysOutsideCurrentMonth:k,today:O}),j=sme(I),_=Kr(),z=C.useRef(null),B=yr(z,t);Ho(()=>{r&&!i&&!f&&!x&&z.current.focus()},[r,i,f,x]);const E=N=>{S(N),x&&N.preventDefault()},L=N=>{i||h(a),x&&N.currentTarget.focus(),u&&u(N)};return x&&!k?m.jsx(cme,{className:Bt(j.root,j.hiddenDaySpacingFiller,o),ownerState:I,role:A.role}):m.jsx(lme,ze({className:Bt(j.root,o),ref:B,centerRipple:!0,disabled:i,tabIndex:R?0:-1,onKeyDown:N=>b(N,a),onFocus:N=>g(N,a),onBlur:N=>y(N,a),onMouseEnter:N=>w(N,a),onClick:L,onMouseDown:E},A,{ownerState:I,children:T||_.format(a,"dayOfMonth")}))}),dme=C.memo(ume),fme=e=>un("MuiPickersSlideTransition",e),Ui=nn("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),pme=["children","className","reduceAnimations","slideDirection","transKey","classes"],hme=e=>{const{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return ln(r,fme,t)},mme=Ze(Ey,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${Ui["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${Ui["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${Ui.slideEnterActive}`]:t.slideEnterActive},{[`.${Ui.slideExit}`]:t.slideExit},{[`.${Ui["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${Ui["slideExitActiveLeft-right"]}`]:t["slideExitActiveLeft-right"]}]})(({theme:e})=>{const t=e.transitions.create("transform",{duration:e.transitions.duration.complex,easing:"cubic-bezier(0.35, 0.8, 0.4, 1)"});return{display:"block",position:"relative",overflowX:"hidden","& > *":{position:"absolute",top:0,right:0,left:0},[`& .${Ui["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${Ui["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${Ui.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${Ui.slideExit}`]:{transform:"translate(0%)"},[`& .${Ui["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${Ui["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}});function gme(e){const t=Yr({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:o,transKey:a}=t,i=Vn(t,pme),s=hme(t),c=Nd();if(o)return m.jsx("div",{className:Bt(s.root,r),children:n});const f={exit:s.exit,enterActive:s.enterActive,enter:s.enter,exitActive:s.exitActive};return m.jsx(mme,{className:Bt(s.root,r),childFactory:u=>C.cloneElement(u,{classNames:f}),role:"presentation",children:m.jsx(EE,ze({mountOnEnter:!0,unmountOnExit:!0,timeout:c.transitions.duration.complex,classNames:f},i,{children:n}),a)})}const yme=e=>un("MuiDayCalendar",e);nn("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const vme=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],bme=["ownerState"],xme=e=>{const{classes:t}=e;return ln({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},yme,t)},kF=(Wg+Bx*2)*6,Sme=Ze("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),wme=Ze("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),Cme=Ze(Sr,{name:"MuiDayCalendar",slot:"WeekDayLabel",overridesResolver:(e,t)=>t.weekDayLabel})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:(e.vars||e).palette.text.secondary})),kme=Ze(Sr,{name:"MuiDayCalendar",slot:"WeekNumberLabel",overridesResolver:(e,t)=>t.weekNumberLabel})(({theme:e})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:e.palette.text.disabled})),Rme=Ze(Sr,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>ze({},e.typography.caption,{width:Wg,height:Wg,padding:0,margin:`0 ${Bx}px`,color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),Eme=Ze("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:kF}),Tme=Ze(gme,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:kF}),$me=Ze("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),Mme=Ze("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:`${Bx}px 0`,display:"flex",justifyContent:"center"});function Ome(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:o,isDateDisabled:a,currentMonthNumber:i,isViewFocused:s}=e,c=Vn(e,vme);const{disabled:f,disableHighlightToday:u,isMonthSwitchingAnimating:h,showDaysOutsideCurrentMonth:g,slots:y,slotProps:b,timezone:S}=t,w=Kr(),x=Fx(S),R=r!==null&&w.isSameDay(n,r),k=o.some(E=>w.isSameDay(E,n)),T=w.isSameDay(n,x),O=y?.day??dme,A=wr({elementType:O,externalSlotProps:b?.day,additionalProps:ze({disableHighlightToday:u,showDaysOutsideCurrentMonth:g,role:"gridcell",isAnimating:h,"data-timestamp":w.toJsDate(n).valueOf()},c),ownerState:ze({},t,{day:n,selected:k})}),I=Vn(A,bme),j=C.useMemo(()=>f||a(n),[f,a,n]),_=C.useMemo(()=>w.getMonth(n)!==i,[w,n,i]),z=C.useMemo(()=>{const E=w.startOfMonth(w.setMonth(n,i));return g?w.isSameDay(n,w.startOfWeek(E)):w.isSameDay(n,E)},[i,n,g,w]),B=C.useMemo(()=>{const E=w.endOfMonth(w.setMonth(n,i));return g?w.isSameDay(n,w.endOfWeek(E)):w.isSameDay(n,E)},[i,n,g,w]);return m.jsx(O,ze({},I,{day:n,disabled:j,autoFocus:s&&R,today:T,outsideCurrentMonth:_,isFirstVisibleCell:z,isLastVisibleCell:B,selected:k,tabIndex:R?0:-1,"aria-selected":k,"aria-current":T?"date":void 0}))}function Pme(e){const t=Yr({props:e,name:"MuiDayCalendar"}),n=Kr(),{onFocusedDayChange:r,className:o,currentMonth:a,selectedDays:i,focusedDay:s,loading:c,onSelectedDaysChange:f,onMonthSwitchingAnimationEnd:u,readOnly:h,reduceAnimations:g,renderLoading:y=()=>m.jsx("span",{children:"..."}),slideDirection:b,TransitionProps:S,disablePast:w,disableFuture:x,minDate:R,maxDate:k,shouldDisableDate:T,shouldDisableMonth:O,shouldDisableYear:A,dayOfWeekFormatter:I=Ne=>n.format(Ne,"weekdayShort").charAt(0).toUpperCase(),hasFocus:j,onFocusedViewChange:_,gridLabelId:z,displayWeekNumber:B,fixedWeekNumber:E,autoFocus:L,timezone:N}=t,F=Fx(N),D=xme(t),W=As(),K=xF({shouldDisableDate:T,shouldDisableMonth:O,shouldDisableYear:A,minDate:R,maxDate:k,disablePast:w,disableFuture:x,timezone:N}),ae=lc(),[Y,re]=Ci({name:"DayCalendar",state:"hasFocus",controlled:j,default:L??!1}),[ue,X]=C.useState(()=>s||F),oe=qt(Ne=>{h||f(Ne)}),J=Ne=>{K(Ne)||(r(Ne),X(Ne),_?.(!0),re(!0))},ee=qt((Ne,ge)=>{switch(Ne.key){case"ArrowUp":J(n.addDays(ge,-7)),Ne.preventDefault();break;case"ArrowDown":J(n.addDays(ge,7)),Ne.preventDefault();break;case"ArrowLeft":{const se=n.addDays(ge,W?1:-1),Ge=n.addMonths(ge,W?1:-1),Ae=bg({utils:n,date:se,minDate:W?se:n.startOfMonth(Ge),maxDate:W?n.endOfMonth(Ge):se,isDateDisabled:K,timezone:N});J(Ae||se),Ne.preventDefault();break}case"ArrowRight":{const se=n.addDays(ge,W?-1:1),Ge=n.addMonths(ge,W?-1:1),Ae=bg({utils:n,date:se,minDate:W?n.startOfMonth(Ge):se,maxDate:W?se:n.endOfMonth(Ge),isDateDisabled:K,timezone:N});J(Ae||se),Ne.preventDefault();break}case"Home":J(n.startOfWeek(ge)),Ne.preventDefault();break;case"End":J(n.endOfWeek(ge)),Ne.preventDefault();break;case"PageUp":J(n.addMonths(ge,1)),Ne.preventDefault();break;case"PageDown":J(n.addMonths(ge,-1)),Ne.preventDefault();break}}),te=qt((Ne,ge)=>J(ge)),de=qt((Ne,ge)=>{Y&&n.isSameDay(ue,ge)&&_?.(!1)}),ce=n.getMonth(a),fe=n.getYear(a),he=C.useMemo(()=>i.filter(Ne=>!!Ne).map(Ne=>n.startOfDay(Ne)),[n,i]),me=`${fe}-${ce}`,le=C.useMemo(()=>C.createRef(),[me]),be=C.useMemo(()=>{const Ne=n.startOfMonth(a),ge=n.endOfMonth(a);return K(ue)||n.isAfterDay(ue,ge)||n.isBeforeDay(ue,Ne)?bg({utils:n,date:ue,minDate:Ne,maxDate:ge,disablePast:w,disableFuture:x,isDateDisabled:K,timezone:N}):ue},[a,x,w,ue,K,n,N]),Ie=C.useMemo(()=>{const Ne=n.getWeekArray(a);let ge=n.addMonths(a,1);for(;E&&Ne.length<E;){const se=n.getWeekArray(ge),Ge=n.isSameDay(Ne[Ne.length-1][0],se[0][0]);se.slice(Ge?1:0).forEach(Ae=>{Ne.length<E&&Ne.push(Ae)}),ge=n.addMonths(ge,1)}return Ne},[a,E,n]);return m.jsxs(Sme,{role:"grid","aria-labelledby":z,className:D.root,children:[m.jsxs(wme,{role:"row",className:D.header,children:[B&&m.jsx(kme,{variant:"caption",role:"columnheader","aria-label":ae.calendarWeekNumberHeaderLabel,className:D.weekNumberLabel,children:ae.calendarWeekNumberHeaderText}),qse(n,F).map((Ne,ge)=>m.jsx(Cme,{variant:"caption",role:"columnheader","aria-label":n.format(Ne,"weekday"),className:D.weekDayLabel,children:I(Ne)},ge.toString()))]}),c?m.jsx(Eme,{className:D.loadingContainer,children:y()}):m.jsx(Tme,ze({transKey:me,onExited:u,reduceAnimations:g,slideDirection:b,className:Bt(o,D.slideTransition)},S,{nodeRef:le,children:m.jsx($me,{ref:le,role:"rowgroup",className:D.monthContainer,children:Ie.map((Ne,ge)=>m.jsxs(Mme,{role:"row",className:D.weekContainer,"aria-rowindex":ge+1,children:[B&&m.jsx(Rme,{className:D.weekNumber,role:"rowheader","aria-label":ae.calendarWeekNumberAriaLabelText(n.getWeekNumber(Ne[0])),children:ae.calendarWeekNumberText(n.getWeekNumber(Ne[0]))}),Ne.map((se,Ge)=>m.jsx(Ome,{parentProps:t,day:se,selectedDays:he,focusableDay:be,onKeyDown:ee,onFocus:te,onBlur:de,onDaySelect:oe,isDateDisabled:K,currentMonthNumber:ce,isViewFocused:Y,"aria-colindex":Ge+1},se.toString()))]},`week-${Ne[0]}`))})}))]})}function Ame(e){return un("MuiPickersMonth",e)}const ab=nn("MuiPickersMonth",["root","monthButton","disabled","selected"]),Dme=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],jme=e=>{const{disabled:t,selected:n,classes:r}=e;return ln({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},Ame,r)},Nme=Ze("div",{name:"MuiPickersMonth",slot:"Root",overridesResolver:(e,t)=>[t.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{monthsPerRow:4},style:{flexBasis:"25%"}}]}),Ime=Ze("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${ab.disabled}`]:t.disabled},{[`&.${ab.selected}`]:t.selected}]})(({theme:e})=>ze({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{margin:"8px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Ps(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Ps(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${ab.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${ab.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),Lme=C.memo(function(e){const t=Yr({props:e,name:"MuiPickersMonth"}),{autoFocus:n,className:r,children:o,disabled:a,selected:i,value:s,tabIndex:c,onClick:f,onKeyDown:u,onFocus:h,onBlur:g,"aria-current":y,"aria-label":b,slots:S,slotProps:w}=t,x=Vn(t,Dme),R=C.useRef(null),k=jme(t);Ho(()=>{n&&R.current?.focus()},[n]);const T=S?.monthButton??Ime,O=wr({elementType:T,externalSlotProps:w?.monthButton,additionalProps:{children:o,disabled:a,tabIndex:c,ref:R,type:"button",role:"radio","aria-current":y,"aria-checked":i,"aria-label":b,onClick:A=>f(A,s),onKeyDown:A=>u(A,s),onFocus:A=>h(A,s),onBlur:A=>g(A,s)},ownerState:t,className:k.monthButton});return m.jsx(Nme,ze({className:Bt(k.root,r),ownerState:t},x,{children:m.jsx(T,ze({},O))}))});function zme(e){return un("MuiMonthCalendar",e)}nn("MuiMonthCalendar",["root"]);const Fme=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],_me=e=>{const{classes:t}=e;return ln({root:["root"]},zme,t)};function Ume(e,t){const n=Kr(),r=ky(),o=Yr({props:e,name:t});return ze({disableFuture:!1,disablePast:!1},o,{minDate:rs(n,o.minDate,r.minDate),maxDate:rs(n,o.maxDate,r.maxDate)})}const Bme=Ze("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:Vx,boxSizing:"border-box"}),Vme=C.forwardRef(function(e,t){const n=Ume(e,"MuiMonthCalendar"),{className:r,value:o,defaultValue:a,referenceDate:i,disabled:s,disableFuture:c,disablePast:f,maxDate:u,minDate:h,onChange:g,shouldDisableMonth:y,readOnly:b,autoFocus:S=!1,onMonthFocus:w,hasFocus:x,onFocusedViewChange:R,monthsPerRow:k=3,timezone:T,gridLabelId:O,slots:A,slotProps:I}=n,j=Vn(n,Fme),{value:_,handleValueChange:z,timezone:B}=LE({name:"MonthCalendar",timezone:T,value:o,defaultValue:a,referenceDate:i,onChange:g,valueManager:ml}),E=Fx(B),L=As(),N=Kr(),F=C.useMemo(()=>ml.getInitialReferenceValue({value:_,utils:N,props:n,timezone:B,referenceDate:i,granularity:nl.month}),[]),D=n,W=_me(D),K=C.useMemo(()=>N.getMonth(E),[N,E]),ae=C.useMemo(()=>_!=null?N.getMonth(_):null,[_,N]),[Y,re]=C.useState(()=>ae||N.getMonth(F)),[ue,X]=Ci({name:"MonthCalendar",state:"hasFocus",controlled:x,default:S??!1}),oe=qt(he=>{X(he),R&&R(he)}),J=C.useCallback(he=>{const me=N.startOfMonth(f&&N.isAfter(E,h)?E:h),le=N.startOfMonth(c&&N.isBefore(E,u)?E:u),be=N.startOfMonth(he);return N.isBefore(be,me)||N.isAfter(be,le)?!0:y?y(be):!1},[c,f,u,h,E,y,N]),ee=qt((he,me)=>{if(b)return;const le=N.setMonth(_??F,me);z(le)}),te=qt(he=>{J(N.setMonth(_??F,he))||(re(he),oe(!0),w&&w(he))});C.useEffect(()=>{re(he=>ae!==null&&he!==ae?ae:he)},[ae]);const de=qt((he,me)=>{switch(he.key){case"ArrowUp":te((12+me-3)%12),he.preventDefault();break;case"ArrowDown":te((12+me+3)%12),he.preventDefault();break;case"ArrowLeft":te((12+me+(L?1:-1))%12),he.preventDefault();break;case"ArrowRight":te((12+me+(L?-1:1))%12),he.preventDefault();break}}),ce=qt((he,me)=>{te(me)}),fe=qt((he,me)=>{Y===me&&oe(!1)});return m.jsx(Bme,ze({ref:t,className:Bt(W.root,r),ownerState:D,role:"radiogroup","aria-labelledby":O},j,{children:SE(N,_??F).map(he=>{const me=N.getMonth(he),le=N.format(he,"monthShort"),be=N.format(he,"month"),Ie=me===ae,Ne=s||J(he);return m.jsx(Lme,{selected:Ie,value:me,onClick:ee,onKeyDown:de,autoFocus:ue&&me===Y,disabled:Ne,tabIndex:me===Y&&!Ne?0:-1,onFocus:ce,onBlur:fe,"aria-current":K===me?"date":void 0,"aria-label":be,monthsPerRow:k,slots:A,slotProps:I,children:le},le)})}))});function Hme(e){return un("MuiPickersYear",e)}const ib=nn("MuiPickersYear",["root","yearButton","selected","disabled"]),qme=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],Wme=e=>{const{disabled:t,selected:n,classes:r}=e;return ln({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},Hme,r)},Yme=Ze("div",{name:"MuiPickersYear",slot:"Root",overridesResolver:(e,t)=>[t.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{yearsPerRow:4},style:{flexBasis:"25%"}}]}),Kme=Ze("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${ib.disabled}`]:t.disabled},{[`&.${ib.selected}`]:t.selected}]})(({theme:e})=>ze({color:"unset",backgroundColor:"transparent",border:0,outline:0},e.typography.subtitle1,{margin:"6px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.focusOpacity})`:Ps(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:Ps(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${ib.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${ib.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),Gme=C.memo(function(e){const t=Yr({props:e,name:"MuiPickersYear"}),{autoFocus:n,className:r,children:o,disabled:a,selected:i,value:s,tabIndex:c,onClick:f,onKeyDown:u,onFocus:h,onBlur:g,"aria-current":y,slots:b,slotProps:S}=t,w=Vn(t,qme),x=C.useRef(null),R=Wme(t);Ho(()=>{n&&x.current?.focus()},[n]);const k=b?.yearButton??Kme,T=wr({elementType:k,externalSlotProps:S?.yearButton,additionalProps:{children:o,disabled:a,tabIndex:c,ref:x,type:"button",role:"radio","aria-current":y,"aria-checked":i,onClick:O=>f(O,s),onKeyDown:O=>u(O,s),onFocus:O=>h(O,s),onBlur:O=>g(O,s)},ownerState:t,className:R.yearButton});return m.jsx(Yme,ze({className:Bt(R.root,r),ownerState:t},w,{children:m.jsx(k,ze({},T))}))});function Qme(e){return un("MuiYearCalendar",e)}nn("MuiYearCalendar",["root"]);const Xme=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],Zme=e=>{const{classes:t}=e;return ln({root:["root"]},Qme,t)};function Jme(e,t){const n=Kr(),r=ky(),o=Yr({props:e,name:t});return ze({disablePast:!1,disableFuture:!1},o,{yearsPerRow:o.yearsPerRow??3,minDate:rs(n,o.minDate,r.minDate),maxDate:rs(n,o.maxDate,r.maxDate)})}const ege=Ze("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:Vx,maxHeight:Xde,boxSizing:"border-box",position:"relative"}),tge=C.forwardRef(function(e,t){const n=Jme(e,"MuiYearCalendar"),{autoFocus:r,className:o,value:a,defaultValue:i,referenceDate:s,disabled:c,disableFuture:f,disablePast:u,maxDate:h,minDate:g,onChange:y,readOnly:b,shouldDisableYear:S,onYearFocus:w,hasFocus:x,onFocusedViewChange:R,yearsOrder:k="asc",yearsPerRow:T,timezone:O,gridLabelId:A,slots:I,slotProps:j}=n,_=Vn(n,Xme),{value:z,handleValueChange:B,timezone:E}=LE({name:"YearCalendar",timezone:O,value:a,defaultValue:i,referenceDate:s,onChange:y,valueManager:ml}),L=Fx(E),N=As(),F=Kr(),D=C.useMemo(()=>ml.getInitialReferenceValue({value:z,utils:F,props:n,timezone:E,referenceDate:s,granularity:nl.year}),[]),W=n,K=Zme(W),ae=C.useMemo(()=>F.getYear(L),[F,L]),Y=C.useMemo(()=>z!=null?F.getYear(z):null,[z,F]),[re,ue]=C.useState(()=>Y||F.getYear(D)),[X,oe]=Ci({name:"YearCalendar",state:"hasFocus",controlled:x,default:r??!1}),J=qt(ge=>{oe(ge),R&&R(ge)}),ee=C.useCallback(ge=>{if(u&&F.isBeforeYear(ge,L)||f&&F.isAfterYear(ge,L)||g&&F.isBeforeYear(ge,g)||h&&F.isAfterYear(ge,h))return!0;if(!S)return!1;const se=F.startOfYear(ge);return S(se)},[f,u,h,g,L,S,F]),te=qt((ge,se)=>{if(b)return;const Ge=F.setYear(z??D,se);B(Ge)}),de=qt(ge=>{ee(F.setYear(z??D,ge))||(ue(ge),J(!0),w?.(ge))});C.useEffect(()=>{ue(ge=>Y!==null&&ge!==Y?Y:ge)},[Y]);const ce=k!=="desc"?T*1:T*-1,fe=N&&k==="asc"||!N&&k==="desc"?-1:1,he=qt((ge,se)=>{switch(ge.key){case"ArrowUp":de(se-ce),ge.preventDefault();break;case"ArrowDown":de(se+ce),ge.preventDefault();break;case"ArrowLeft":de(se-fe),ge.preventDefault();break;case"ArrowRight":de(se+fe),ge.preventDefault();break}}),me=qt((ge,se)=>{de(se)}),le=qt((ge,se)=>{re===se&&J(!1)}),be=C.useRef(null),Ie=yr(t,be);C.useEffect(()=>{if(r||be.current===null)return;const ge=be.current.querySelector('[tabindex="0"]');if(!ge)return;const se=ge.offsetHeight,Ge=ge.offsetTop,Ae=be.current.clientHeight,Qe=be.current.scrollTop,rt=Ge+se;se>Ae||Ge<Qe||(be.current.scrollTop=rt-Ae/2-se/2)},[r]);const Ne=F.getYearRange([g,h]);return k==="desc"&&Ne.reverse(),m.jsx(ege,ze({ref:Ie,className:Bt(K.root,o),ownerState:W,role:"radiogroup","aria-labelledby":A},_,{children:Ne.map(ge=>{const se=F.getYear(ge),Ge=se===Y,Ae=c||ee(ge);return m.jsx(Gme,{selected:Ge,value:se,onClick:te,onKeyDown:he,autoFocus:X&&se===re,disabled:Ae,tabIndex:se===re&&!Ae?0:-1,onFocus:me,onBlur:le,"aria-current":ae===se?"date":void 0,yearsPerRow:T,slots:I,slotProps:j,children:F.format(ge,"year")},F.format(ge,"year"))})}))}),nge=e=>un("MuiPickersCalendarHeader",e),rge=nn("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]);function oge(e){return un("MuiPickersArrowSwitcher",e)}nn("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const age=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],ige=["ownerState"],sge=["ownerState"],lge=Ze("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),cge=Ze("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),Cj=Ze(pu,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),uge=e=>{const{classes:t}=e;return ln({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},oge,t)},dge=C.forwardRef(function(e,t){const n=As(),r=Yr({props:e,name:"MuiPickersArrowSwitcher"}),{children:o,className:a,slots:i,slotProps:s,isNextDisabled:c,isNextHidden:f,onGoToNext:u,nextLabel:h,isPreviousDisabled:g,isPreviousHidden:y,onGoToPrevious:b,previousLabel:S,labelId:w}=r,x=Vn(r,age),R=r,k=uge(R),T={isDisabled:c,isHidden:f,goTo:u,label:h},O={isDisabled:g,isHidden:y,goTo:b,label:S},A=i?.previousIconButton??Cj,I=wr({elementType:A,externalSlotProps:s?.previousIconButton,additionalProps:{size:"medium",title:O.label,"aria-label":O.label,disabled:O.isDisabled,edge:"end",onClick:O.goTo},ownerState:ze({},R,{hidden:O.isHidden}),className:Bt(k.button,k.previousIconButton)}),j=i?.nextIconButton??Cj,_=wr({elementType:j,externalSlotProps:s?.nextIconButton,additionalProps:{size:"medium",title:T.label,"aria-label":T.label,disabled:T.isDisabled,edge:"start",onClick:T.goTo},ownerState:ze({},R,{hidden:T.isHidden}),className:Bt(k.button,k.nextIconButton)}),z=i?.leftArrowIcon??pfe,B=wr({elementType:z,externalSlotProps:s?.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:R,className:k.leftArrowIcon}),E=Vn(B,ige),L=i?.rightArrowIcon??hfe,N=wr({elementType:L,externalSlotProps:s?.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:R,className:k.rightArrowIcon}),F=Vn(N,sge);return m.jsxs(lge,ze({ref:t,className:Bt(k.root,a),ownerState:R},x,{children:[m.jsx(A,ze({},I,{children:n?m.jsx(L,ze({},F)):m.jsx(z,ze({},E))})),o?m.jsx(Sr,{variant:"subtitle1",component:"span",id:w,children:o}):m.jsx(cge,{className:k.spacer,ownerState:R}),m.jsx(j,ze({},_,{children:n?m.jsx(z,ze({},E)):m.jsx(L,ze({},F))}))]}))});function fge(e,{disableFuture:t,maxDate:n,timezone:r}){const o=Kr();return C.useMemo(()=>{const a=o.date(void 0,r),i=o.startOfMonth(t&&o.isBefore(a,n)?a:n);return!o.isAfter(i,e)},[t,n,e,o,r])}function pge(e,{disablePast:t,minDate:n,timezone:r}){const o=Kr();return C.useMemo(()=>{const a=o.date(void 0,r),i=o.startOfMonth(t&&o.isAfter(a,n)?a:n);return!o.isBefore(i,e)},[t,n,e,o,r])}const hge=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],mge=["ownerState"],gge=e=>{const{classes:t}=e;return ln({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},nge,t)},yge=Ze("div",{name:"MuiPickersCalendarHeader",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",alignItems:"center",marginTop:12,marginBottom:4,paddingLeft:24,paddingRight:12,maxHeight:40,minHeight:40}),vge=Ze("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>ze({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),bge=Ze("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),xge=Ze(pu,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${rge.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),Sge=Ze(ffe,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),wge=C.forwardRef(function(e,t){const n=lc(),r=Kr(),o=Yr({props:e,name:"MuiPickersCalendarHeader"}),{slots:a,slotProps:i,currentMonth:s,disabled:c,disableFuture:f,disablePast:u,maxDate:h,minDate:g,onMonthChange:y,onViewChange:b,view:S,reduceAnimations:w,views:x,labelId:R,className:k,timezone:T,format:O=`${r.formats.month} ${r.formats.year}`}=o,A=Vn(o,hge),I=o,j=gge(o),_=a?.switchViewButton??xge,z=wr({elementType:_,externalSlotProps:i?.switchViewButton,additionalProps:{size:"small","aria-label":n.calendarViewSwitchingButtonAriaLabel(S)},ownerState:I,className:j.switchViewButton}),B=a?.switchViewIcon??Sge,E=wr({elementType:B,externalSlotProps:i?.switchViewIcon,ownerState:I,className:j.switchViewIcon}),L=Vn(E,mge),N=()=>y(r.addMonths(s,1),"left"),F=()=>y(r.addMonths(s,-1),"right"),D=fge(s,{disableFuture:f,maxDate:h,timezone:T}),W=pge(s,{disablePast:u,minDate:g,timezone:T}),K=()=>{if(!(x.length===1||!b||c))if(x.length===2)b(x.find(Y=>Y!==S)||x[0]);else{const Y=x.indexOf(S)!==0?0:1;b(x[Y])}};if(x.length===1&&x[0]==="year")return null;const ae=r.formatByString(s,O);return m.jsxs(yge,ze({},A,{ownerState:I,className:Bt(j.root,k),ref:t,children:[m.jsxs(vge,{role:"presentation",onClick:K,ownerState:I,"aria-live":"polite",className:j.labelContainer,children:[m.jsx(SF,{reduceAnimations:w,transKey:ae,children:m.jsx(bge,{id:R,ownerState:I,className:j.label,children:ae})}),x.length>1&&!c&&m.jsx(_,ze({},z,{children:m.jsx(B,ze({},L))}))]}),m.jsx(Md,{in:S==="day",appear:!w,enter:!w,children:m.jsx(dge,{slots:a,slotProps:i,onGoToPrevious:F,isPreviousDisabled:W,previousLabel:n.previousMonth,onGoToNext:N,isNextDisabled:D,nextLabel:n.nextMonth})})]}))}),Cge=Ze("div")({overflow:"hidden",width:Vx,maxHeight:zE,display:"flex",flexDirection:"column",margin:"0 auto"}),kge=e=>un("MuiDateCalendar",e);nn("MuiDateCalendar",["root","viewTransitionContainer"]);const Rge=["autoFocus","onViewChange","value","defaultValue","referenceDate","disableFuture","disablePast","onChange","onYearChange","onMonthChange","reduceAnimations","shouldDisableDate","shouldDisableMonth","shouldDisableYear","view","views","openTo","className","disabled","readOnly","minDate","maxDate","disableHighlightToday","focusedView","onFocusedViewChange","showDaysOutsideCurrentMonth","fixedWeekNumber","dayOfWeekFormatter","slots","slotProps","loading","renderLoading","displayWeekNumber","yearsOrder","yearsPerRow","monthsPerRow","timezone"],Ege=e=>{const{classes:t}=e;return ln({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},kge,t)};function Tge(e,t){const n=Kr(),r=ky(),o=H4(),a=Yr({props:e,name:t});return ze({},a,{loading:a.loading??!1,disablePast:a.disablePast??!1,disableFuture:a.disableFuture??!1,openTo:a.openTo??"day",views:a.views??["year","day"],reduceAnimations:a.reduceAnimations??o,renderLoading:a.renderLoading??(()=>m.jsx("span",{children:"..."})),minDate:rs(n,a.minDate,r.minDate),maxDate:rs(n,a.maxDate,r.maxDate)})}const $ge=Ze(Cge,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:zE}),Mge=Ze(SF,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),Oge=C.forwardRef(function(e,t){const n=Kr(),r=Ds(),o=Tge(e,"MuiDateCalendar"),{autoFocus:a,onViewChange:i,value:s,defaultValue:c,referenceDate:f,disableFuture:u,disablePast:h,onChange:g,onYearChange:y,onMonthChange:b,reduceAnimations:S,shouldDisableDate:w,shouldDisableMonth:x,shouldDisableYear:R,view:k,views:T,openTo:O,className:A,disabled:I,readOnly:j,minDate:_,maxDate:z,disableHighlightToday:B,focusedView:E,onFocusedViewChange:L,showDaysOutsideCurrentMonth:N,fixedWeekNumber:F,dayOfWeekFormatter:D,slots:W,slotProps:K,loading:ae,renderLoading:Y,displayWeekNumber:re,yearsOrder:ue,yearsPerRow:X,monthsPerRow:oe,timezone:J}=o,ee=Vn(o,Rge),{value:te,handleValueChange:de,timezone:ce}=LE({name:"DateCalendar",timezone:J,value:s,defaultValue:c,referenceDate:f,onChange:g,valueManager:ml}),{view:fe,setView:he,focusedView:me,setFocusedView:le,goToNextView:be,setValueAndGoToNextView:Ie}=q4({view:k,views:T,openTo:O,onChange:de,onViewChange:i,autoFocus:a,focusedView:E,onFocusedViewChange:L}),{referenceDate:Ne,calendarState:ge,changeFocusedDay:se,changeMonth:Ge,handleChangeMonth:Ae,isDateDisabled:Qe,onMonthSwitchingAnimationEnd:rt}=tme({value:te,referenceDate:f,reduceAnimations:S,onMonthChange:b,minDate:_,maxDate:z,shouldDisableDate:w,disablePast:h,disableFuture:u,timezone:ce}),_t=I&&te||_,Ut=I&&te||z,ot=`${r}-grid-label`,tt=me!==null,ft=W?.calendarHeader??wge,Le=wr({elementType:ft,externalSlotProps:K?.calendarHeader,additionalProps:{views:T,view:fe,currentMonth:ge.currentMonth,onViewChange:he,onMonthChange:(en,En)=>Ae({newMonth:en,direction:En}),minDate:_t,maxDate:Ut,disabled:I,disablePast:h,disableFuture:u,reduceAnimations:S,timezone:ce,labelId:ot},ownerState:o}),xe=qt(en=>{const En=n.startOfMonth(en),$n=n.endOfMonth(en),Fn=Qe(en)?bg({utils:n,date:en,minDate:n.isBefore(_,En)?En:_,maxDate:n.isAfter(z,$n)?$n:z,disablePast:h,disableFuture:u,isDateDisabled:Qe,timezone:ce}):en;Fn?(Ie(Fn,"finish"),b?.(En)):(be(),Ge(En)),se(Fn,!0)}),He=qt(en=>{const En=n.startOfYear(en),$n=n.endOfYear(en),Fn=Qe(en)?bg({utils:n,date:en,minDate:n.isBefore(_,En)?En:_,maxDate:n.isAfter(z,$n)?$n:z,disablePast:h,disableFuture:u,isDateDisabled:Qe,timezone:ce}):en;Fn?(Ie(Fn,"finish"),y?.(Fn)):(be(),Ge(En)),se(Fn,!0)}),$e=qt(en=>de(en&&c0(n,en,te??Ne),"finish",fe));C.useEffect(()=>{te!=null&&n.isValid(te)&&Ge(te)},[te]);const kt=o,Rt=Ege(kt),bt={disablePast:h,disableFuture:u,maxDate:z,minDate:_},st={disableHighlightToday:B,readOnly:j,disabled:I,timezone:ce,gridLabelId:ot,slots:W,slotProps:K},ct=C.useRef(fe);C.useEffect(()=>{ct.current!==fe&&(me===ct.current&&le(fe,!0),ct.current=fe)},[me,le,fe]);const Lt=C.useMemo(()=>[te],[te]);return m.jsxs($ge,ze({ref:t,className:Bt(Rt.root,A),ownerState:kt},ee,{children:[m.jsx(ft,ze({},Le,{slots:W,slotProps:K})),m.jsx(Mge,{reduceAnimations:S,className:Rt.viewTransitionContainer,transKey:fe,ownerState:kt,children:m.jsxs("div",{children:[fe==="year"&&m.jsx(tge,ze({},bt,st,{value:te,onChange:He,shouldDisableYear:R,hasFocus:tt,onFocusedViewChange:en=>le("year",en),yearsOrder:ue,yearsPerRow:X,referenceDate:Ne})),fe==="month"&&m.jsx(Vme,ze({},bt,st,{hasFocus:tt,className:A,value:te,onChange:xe,shouldDisableMonth:x,onFocusedViewChange:en=>le("month",en),monthsPerRow:oe,referenceDate:Ne})),fe==="day"&&m.jsx(Pme,ze({},ge,bt,st,{onMonthSwitchingAnimationEnd:rt,onFocusedDayChange:se,reduceAnimations:S,selectedDays:Lt,onSelectedDaysChange:$e,shouldDisableDate:w,shouldDisableMonth:x,shouldDisableYear:R,hasFocus:tt,onFocusedViewChange:en=>le("day",en),showDaysOutsideCurrentMonth:N,fixedWeekNumber:F,dayOfWeekFormatter:D,displayWeekNumber:re,loading:ae,renderLoading:Y}))]})})]}))}),vp=({view:e,onViewChange:t,views:n,focusedView:r,onFocusedViewChange:o,value:a,defaultValue:i,referenceDate:s,onChange:c,className:f,classes:u,disableFuture:h,disablePast:g,minDate:y,maxDate:b,shouldDisableDate:S,shouldDisableMonth:w,shouldDisableYear:x,reduceAnimations:R,onMonthChange:k,monthsPerRow:T,onYearChange:O,yearsOrder:A,yearsPerRow:I,slots:j,slotProps:_,loading:z,renderLoading:B,disableHighlightToday:E,readOnly:L,disabled:N,showDaysOutsideCurrentMonth:F,dayOfWeekFormatter:D,sx:W,autoFocus:K,fixedWeekNumber:ae,displayWeekNumber:Y,timezone:re})=>m.jsx(Oge,{view:e,onViewChange:t,views:n.filter(PD),focusedView:r&&PD(r)?r:null,onFocusedViewChange:o,value:a,defaultValue:i,referenceDate:s,onChange:c,className:f,classes:u,disableFuture:h,disablePast:g,minDate:y,maxDate:b,shouldDisableDate:S,shouldDisableMonth:w,shouldDisableYear:x,reduceAnimations:R,onMonthChange:k,monthsPerRow:T,onYearChange:O,yearsOrder:A,yearsPerRow:I,slots:j,slotProps:_,loading:z,renderLoading:B,disableHighlightToday:E,readOnly:L,disabled:N,showDaysOutsideCurrentMonth:F,dayOfWeekFormatter:D,sx:W,autoFocus:K,fixedWeekNumber:ae,displayWeekNumber:Y,timezone:re}),RF=C.forwardRef(function(e,t){const n=lc(),r=Kr(),o=R4(e,"MuiDesktopDatePicker"),a=ze({day:vp,month:vp,year:vp},o.viewRenderers),i=ze({},o,{viewRenderers:a,format:wE(r,o,!1),yearsPerRow:o.yearsPerRow??4,slots:ze({openPickerIcon:mfe,field:bF},o.slots),slotProps:ze({},o.slotProps,{field:c=>ze({},Lx(o.slotProps?.field,c),T4(o),{ref:t}),toolbar:ze({hidden:!0},o.slotProps?.toolbar)})}),{renderPicker:s}=dfe({props:i,valueManager:ml,valueType:"date",getOpenDialogAriaText:C4({utils:r,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:i.localeText?.openDatePickerDialogue}),validator:Ry});return s()});RF.propTypes={autoFocus:it.bool,className:it.string,closeOnSelect:it.bool,dayOfWeekFormatter:it.func,defaultValue:it.object,disabled:it.bool,disableFuture:it.bool,disableHighlightToday:it.bool,disableOpenPicker:it.bool,disablePast:it.bool,displayWeekNumber:it.bool,enableAccessibleFieldDOMStructure:it.any,fixedWeekNumber:it.number,format:it.string,formatDensity:it.oneOf(["dense","spacious"]),inputRef:u4,label:it.node,loading:it.bool,localeText:it.object,maxDate:it.object,minDate:it.object,monthsPerRow:it.oneOf([3,4]),name:it.string,onAccept:it.func,onChange:it.func,onClose:it.func,onError:it.func,onMonthChange:it.func,onOpen:it.func,onSelectedSectionsChange:it.func,onViewChange:it.func,onYearChange:it.func,open:it.bool,openTo:it.oneOf(["day","month","year"]),orientation:it.oneOf(["landscape","portrait"]),readOnly:it.bool,reduceAnimations:it.bool,referenceDate:it.object,renderLoading:it.func,selectedSections:it.oneOfType([it.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),it.number]),shouldDisableDate:it.func,shouldDisableMonth:it.func,shouldDisableYear:it.func,showDaysOutsideCurrentMonth:it.bool,slotProps:it.object,slots:it.object,sx:it.oneOfType([it.arrayOf(it.oneOfType([it.func,it.object,it.bool])),it.func,it.object]),timezone:it.string,value:it.object,view:it.oneOf(["day","month","year"]),viewRenderers:it.shape({day:it.func,month:it.func,year:it.func}),views:it.arrayOf(it.oneOf(["day","month","year"]).isRequired),yearsOrder:it.oneOf(["asc","desc"]),yearsPerRow:it.oneOf([3,4])};function Pge(e){return un("MuiDialogContent",e)}nn("MuiDialogContent",["root","dividers"]);const Age=nn("MuiDialogTitle",["root"]),Dge=e=>{const{classes:t,dividers:n}=e;return ln({root:["root",n&&"dividers"]},Pge,t)},jge=Ze("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(Yn(({theme:e})=>({flex:"1 1 auto",WebkitOverflowScrolling:"touch",overflowY:"auto",padding:"20px 24px",variants:[{props:({ownerState:t})=>t.dividers,style:{padding:"16px 24px",borderTop:`1px solid ${(e.vars||e).palette.divider}`,borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:t})=>!t.dividers,style:{[`.${Age.root} + &`]:{paddingTop:0}}}]}))),Nge=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiDialogContent"}),{className:r,dividers:o=!1,...a}=n,i={...n,dividers:o},s=Dge(i);return m.jsx(jge,{className:Bt(s.root,r),ownerState:i,ref:t,...a})});function Ige(e){return un("MuiDialog",e)}const kg=nn("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),Lge=C.createContext({}),zge=Ze(oF,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),Fge=e=>{const{classes:t,scroll:n,maxWidth:r,fullWidth:o,fullScreen:a}=e,i={root:["root"],container:["container",`scroll${Et(n)}`],paper:["paper",`paperScroll${Et(n)}`,`paperWidth${Et(String(r))}`,o&&"paperFullWidth",a&&"paperFullScreen"]};return ln(i,Ige,t)},_ge=Ze(aF,{name:"MuiDialog",slot:"Root"})({"@media print":{position:"absolute !important"}}),Uge=Ze("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${Et(n.scroll)}`]]}})({height:"100%","@media print":{height:"auto"},outline:0,variants:[{props:{scroll:"paper"},style:{display:"flex",justifyContent:"center",alignItems:"center"}},{props:{scroll:"body"},style:{overflowY:"auto",overflowX:"hidden",textAlign:"center","&::after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}}}]}),Bge=Ze(zd,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`scrollPaper${Et(n.scroll)}`],t[`paperWidth${Et(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(Yn(({theme:e})=>({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"},variants:[{props:{scroll:"paper"},style:{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"}},{props:{scroll:"body"},style:{display:"inline-block",verticalAlign:"middle",textAlign:"initial"}},{props:({ownerState:t})=>!t.maxWidth,style:{maxWidth:"calc(100% - 64px)"}},{props:{maxWidth:"xs"},style:{maxWidth:e.breakpoints.unit==="px"?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`,[`&.${kg.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+64)]:{maxWidth:"calc(100% - 64px)"}}}},...Object.keys(e.breakpoints.values).filter(t=>t!=="xs").map(t=>({props:{maxWidth:t},style:{maxWidth:`${e.breakpoints.values[t]}${e.breakpoints.unit}`,[`&.${kg.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t]+64)]:{maxWidth:"calc(100% - 64px)"}}}})),{props:({ownerState:t})=>t.fullWidth,style:{width:"calc(100% - 64px)"}},{props:({ownerState:t})=>t.fullScreen,style:{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0,[`&.${kg.paperScrollBody}`]:{margin:0,maxWidth:"100%"}}}]}))),Vge=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiDialog"}),r=Nd(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":i,"aria-modal":s=!0,BackdropComponent:c,BackdropProps:f,children:u,className:h,disableEscapeKeyDown:g=!1,fullScreen:y=!1,fullWidth:b=!1,maxWidth:S="sm",onClick:w,onClose:x,open:R,PaperComponent:k=zd,PaperProps:T={},scroll:O="paper",slots:A={},slotProps:I={},TransitionComponent:j=Md,transitionDuration:_=o,TransitionProps:z,...B}=n,E={...n,disableEscapeKeyDown:g,fullScreen:y,fullWidth:b,maxWidth:S,scroll:O},L=Fge(E),N=C.useRef(),F=me=>{N.current=me.target===me.currentTarget},D=me=>{w&&w(me),N.current&&(N.current=null,x&&x(me,"backdropClick"))},W=Ds(i),K=C.useMemo(()=>({titleId:W}),[W]),ae={transition:j,...A},Y={transition:z,paper:T,backdrop:f,...I},re={slots:ae,slotProps:Y},[ue,X]=cr("root",{elementType:_ge,shouldForwardComponentProp:!0,externalForwardedProps:re,ownerState:E,className:Bt(L.root,h),ref:t}),[oe,J]=cr("backdrop",{elementType:zge,shouldForwardComponentProp:!0,externalForwardedProps:re,ownerState:E}),[ee,te]=cr("paper",{elementType:Bge,shouldForwardComponentProp:!0,externalForwardedProps:re,ownerState:E,className:Bt(L.paper,T.className)}),[de,ce]=cr("container",{elementType:Uge,externalForwardedProps:re,ownerState:E,className:L.container}),[fe,he]=cr("transition",{elementType:Md,externalForwardedProps:re,ownerState:E,additionalProps:{appear:!0,in:R,timeout:_,role:"presentation"}});return m.jsx(ue,{closeAfterTransition:!0,slots:{backdrop:oe},slotProps:{backdrop:{transitionDuration:_,as:c,...J}},disableEscapeKeyDown:g,onClose:x,open:R,onClick:D,...X,...B,children:m.jsx(fe,{...he,children:m.jsx(de,{onMouseDown:F,...ce,children:m.jsx(ee,{as:k,elevation:24,role:"dialog","aria-describedby":a,"aria-labelledby":W,"aria-modal":s,...te,children:m.jsx(Lge.Provider,{value:K,children:u})})})})})}),Hge=Ze(Vge)({[`& .${kg.container}`]:{outline:0},[`& .${kg.paper}`]:{outline:0,minWidth:Vx}}),qge=Ze(Nge)({"&:first-of-type":{padding:0}});function Wge(e){const{children:t,onDismiss:n,open:r,slots:o,slotProps:a}=e,i=o?.dialog??Hge,s=o?.mobileTransition??Md;return m.jsx(i,ze({open:r,onClose:n},a?.dialog,{TransitionComponent:s,TransitionProps:a?.mobileTransition,PaperComponent:o?.mobilePaper,PaperProps:a?.mobilePaper,children:m.jsx(qge,{children:t})}))}const Yge=["props","getOpenDialogAriaText"],Kge=e=>{let{props:t,getOpenDialogAriaText:n}=e,r=Vn(e,Yge);const{slots:o,slotProps:a,className:i,sx:s,format:c,formatDensity:f,enableAccessibleFieldDOMStructure:u,selectedSections:h,onSelectedSectionsChange:g,timezone:y,name:b,label:S,inputRef:w,readOnly:x,disabled:R,localeText:k}=t,T=C.useRef(null),O=Ds(),A=a?.toolbar?.hidden??!1,{open:I,actions:j,layoutProps:_,renderCurrentView:z,fieldProps:B,contextValue:E}=W4(ze({},r,{props:t,fieldRef:T,autoFocusView:!0,additionalViewProps:{},wrapperVariant:"mobile"})),L=o.field,N=wr({elementType:L,externalSlotProps:a?.field,additionalProps:ze({},B,A&&{id:O},!(R||x)&&{onClick:j.onOpen,onKeyDown:Xue(j.onOpen)},{readOnly:x??!0,disabled:R,className:i,sx:s,format:c,formatDensity:f,enableAccessibleFieldDOMStructure:u,selectedSections:h,onSelectedSectionsChange:g,timezone:y,label:S,name:b},w?{inputRef:w}:{}),ownerState:t});N.inputProps=ze({},N.inputProps,{"aria-label":n(B.value)});const F=ze({textField:o.textField},N.slots),D=o.layout??Z4;let W=O;A&&(S?W=`${O}-label`:W=void 0);const K=ze({},a,{toolbar:ze({},a?.toolbar,{titleId:O}),mobilePaper:ze({"aria-labelledby":W},a?.mobilePaper)}),ae=yr(T,N.unstableFieldRef);return{renderPicker:()=>m.jsxs(J4,{contextValue:E,localeText:k,children:[m.jsx(L,ze({},N,{slots:F,slotProps:K,unstableFieldRef:ae})),m.jsx(Wge,ze({},j,{open:I,slots:o,slotProps:K,children:m.jsx(D,ze({},_,K?.layout,{slots:o,slotProps:K,children:z()}))}))]})}},EF=C.forwardRef(function(e,t){const n=lc(),r=Kr(),o=R4(e,"MuiMobileDatePicker"),a=ze({day:vp,month:vp,year:vp},o.viewRenderers),i=ze({},o,{viewRenderers:a,format:wE(r,o,!1),slots:ze({field:bF},o.slots),slotProps:ze({},o.slotProps,{field:c=>ze({},Lx(o.slotProps?.field,c),T4(o),{ref:t}),toolbar:ze({hidden:!1},o.slotProps?.toolbar)})}),{renderPicker:s}=Kge({props:i,valueManager:ml,valueType:"date",getOpenDialogAriaText:C4({utils:r,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:i.localeText?.openDatePickerDialogue}),validator:Ry});return s()});EF.propTypes={autoFocus:it.bool,className:it.string,closeOnSelect:it.bool,dayOfWeekFormatter:it.func,defaultValue:it.object,disabled:it.bool,disableFuture:it.bool,disableHighlightToday:it.bool,disableOpenPicker:it.bool,disablePast:it.bool,displayWeekNumber:it.bool,enableAccessibleFieldDOMStructure:it.any,fixedWeekNumber:it.number,format:it.string,formatDensity:it.oneOf(["dense","spacious"]),inputRef:u4,label:it.node,loading:it.bool,localeText:it.object,maxDate:it.object,minDate:it.object,monthsPerRow:it.oneOf([3,4]),name:it.string,onAccept:it.func,onChange:it.func,onClose:it.func,onError:it.func,onMonthChange:it.func,onOpen:it.func,onSelectedSectionsChange:it.func,onViewChange:it.func,onYearChange:it.func,open:it.bool,openTo:it.oneOf(["day","month","year"]),orientation:it.oneOf(["landscape","portrait"]),readOnly:it.bool,reduceAnimations:it.bool,referenceDate:it.object,renderLoading:it.func,selectedSections:it.oneOfType([it.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),it.number]),shouldDisableDate:it.func,shouldDisableMonth:it.func,shouldDisableYear:it.func,showDaysOutsideCurrentMonth:it.bool,slotProps:it.object,slots:it.object,sx:it.oneOfType([it.arrayOf(it.oneOfType([it.func,it.object,it.bool])),it.func,it.object]),timezone:it.string,value:it.object,view:it.oneOf(["day","month","year"]),viewRenderers:it.shape({day:it.func,month:it.func,year:it.func}),views:it.arrayOf(it.oneOf(["day","month","year"]).isRequired),yearsOrder:it.oneOf(["asc","desc"]),yearsPerRow:it.oneOf([3,4])};const Gge=["desktopModeMediaQuery"],Qge=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiDatePicker"}),{desktopModeMediaQuery:r=Zue}=n,o=Vn(n,Gge);return c4(r,{defaultMatches:!0})?m.jsx(RF,ze({ref:t},o)):m.jsx(EF,ze({ref:t},o))}),TF=400;function Xge(e,t){const[n,r]=C.useState(e);return C.useEffect(()=>{const o=setTimeout(()=>r(e),t);return()=>clearTimeout(o)},[e,t]),n}function $F(e,t,{same:n=Object.is,unset:r=!1}={}){const[o,a]=C.useState(e),[i,s]=C.useState(!1),c=C.useRef(!1),f=C.useRef(null),u=C.useRef(!1),h=C.useRef({draft:o,committed:e,focused:i,unset:r,commit:t,same:n});C.useEffect(()=>{h.current={draft:o,committed:e,focused:i,unset:r,commit:t,same:n}});const g=()=>{const k=h.current,T=f.current?f.current.value:k.committed;return c.current&&(k.unset||!k.same(k.draft,T))},y=()=>{const k=h.current;f.current={value:k.draft},k.commit(k.draft),k.unset&&k.same(k.draft,k.committed)&&(c.current=!1)},b=()=>{g()&&y()},[S,w]=C.useState(0),x=C.useMemo(()=>({draft:o,gen:S}),[o,S]),R=Xge(x,TF);return C.useEffect(()=>{const k=h.current;k.same(R.draft,k.draft)&&g()&&!u.current&&y()},[R]),C.useEffect(()=>()=>b(),[]),C.useEffect(()=>{if(f.current&&n(f.current.value,e)&&(f.current=null),n(o,e)){!r&&!f.current&&(c.current=!1);return}(!i||!c.current)&&a(e)},[e,i,o,r,n]),{draft:o,change:k=>{c.current=!0,a(k),!h.current.focused&&!n(k,e)&&t(k)},reset:k=>{c.current=!1,f.current=null,a(k)},bind:{onFocus:()=>s(!0),onBlur:()=>{s(!1),b(),f.current=null},onKeyDown:k=>{k.key==="Enter"&&!k.nativeEvent.isComposing&&b()},onCompositionStart:()=>{u.current=!0},onCompositionEnd:()=>{u.current=!1,w(k=>k+1)}}}}const Zge=250,Jge=300*1e3;function eye(e,t){const n=C.useContext(BR),r=t.trim(),[o,a]=C.useState("");C.useEffect(()=>{const h=setTimeout(()=>a(r),Zge);return()=>clearTimeout(h)},[r]);const[i,s]=C.useState(),c=e?JSON.stringify(e.key):void 0;C.useEffect(()=>{if(!e||!n||o==="")return;let h=!0;return n.fetchQuery({queryKey:[...e.key,o],queryFn:({signal:g})=>e.run(o,g),staleTime:Jge}).then(g=>{h&&s({key:c,text:o,page:g})}).catch(()=>{h&&s({key:c,text:o,failed:!0})}),()=>{h=!1}},[n,c,o]);const f=e!==void 0&&n!==void 0&&r!=="",u=i!==void 0&&i.key===c&&i.text===r;return{active:f,searching:f&&!u,page:f&&u?i.page:void 0,failed:f&&u&&i.failed===!0}}function YE(e,t){if(!t)return;const n=t.trim();if(!n)return;const r=e??"string";if(r==="date"||r==="timestamp"||r==="timestamptz")return n.replace(/^@/,"");if(r.startsWith("filter<")){const o=n.replace(/^f(?=['"])/,""),a=o.match(/^'([^'\\]*)'$/)??o.match(/^"([^"\\]*)"$/);return a?a[1]:o}return r==="string"?tye(n):n}function tye(e){const t=e[0];return e.length>=2&&(t==="'"||t==='"')&&e[e.length-1]===t?e.slice(1,-1).replace(/\\(["'\\ntr])/g,(n,r)=>r==="n"?`
469
469
  `:r==="t"?" ":r==="r"?"\r":r):e}Ar.extend(hE);const kj=14,nye=42;function rye(e){const t=(e.annotations??[]).filter(r=>r.trim().startsWith("#("));if(t.length===0)return;const n=[];for(const r of t){const o=r.trim(),a=o.match(/description="([^"]*)"/);if(a){n.push(a[1]);continue}const i=o.replace(/^#\(/,"").replace(/\)\s*$/,"").trim();i&&n.push(i)}return n.length>0?n.join(`
470
470
  `):void 0}function MF({given:e,value:t,onChange:n,options:r,optionsLoading:o,optionsFailed:a,optionsTruncated:i,optionSearch:s}){const c=e.label??e.name??"",{theme:f}=eo(),u=e.type??"string",h=rye(e),g=YE(u,e.default),y=g!==void 0?`Default: ${g===""?"(empty)":g}`:void 0,b=h||y?m.jsxs(m.Fragment,{children:[h,h&&y?m.jsx("br",{}):null,y]}):void 0,S=u==="string"||Jc(u)==="string",w=!Kc(u)||typeof t!="string"||Wz(t),x=oe=>m.jsx(wi,{label:c,value:String(t),error:!0,inputProps:{readOnly:!0},helperText:m.jsxs(m.Fragment,{children:[`Not a ${oe}. Clear it to pick one.`,b?m.jsx("br",{}):null,b]}),slotProps:{input:{endAdornment:m.jsx(OF,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"}),R=Kc(u),k=e.control==="multiselect"&&R,T=Kc(u),O=e.control==="select"||e.control==="multiselect",A=O?T?typeof t=="string"?qz(t):[]:typeof t=="string"&&t!==""?[t]:[]:[],[I,j]=C.useState(""),[_,z]=C.useState(null),B=C.useRef(null),E=eye(O?s:void 0,I);if(O&&S&&w&&!(!k&&A.length>1)){const oe=ee=>{const te=T?mE(ee):void 0;if(ee.length===0||te===""){n(null);return}n(T?te:ee[0])},J=cye(E,i,s);return m.jsx(PF.Provider,{value:J,children:m.jsx(Y7,{multiple:k,disableCloseOnSelect:k,freeSolo:!0,forcePopupIcon:!0,autoSelect:!k,options:E.page?.values??r??[],...E.page?{filterOptions:ee=>ee}:{},onInputChange:(ee,te,de)=>j(de==="input"?te:""),loading:o||E.searching,loadingText:E.searching?"Searching…":"Loading…",noOptionsText:a?"Options unavailable":"No matching values",slots:{paper:lye},value:k?A:A[0]??null,onChange:(ee,te)=>oe(te===null?[]:Array.isArray(te)?te:[te]),renderInput:ee=>m.jsx(wi,{...ee,label:c,size:"small",placeholder:A.length!==0?void 0:t===""?"All":g??"All",error:a,helperText:a?m.jsxs(m.Fragment,{children:["Could not load the options for this control. Type a value to filter anyway.",b?m.jsx("br",{}):null,b]}):b,slotProps:{input:{...ee.InputProps,endAdornment:m.jsxs(m.Fragment,{children:[o&&m.jsx(ly,{size:16}),ee.InputProps.endAdornment]})},htmlInput:{...ee.inputProps,onBlur:te=>{if(ee.inputProps.onBlur?.(te),!k)return;const de=te.target.value.trim();de!==""&&!A.includes(de)&&oe([...A,de])}}}}),fullWidth:!0})})}const L=Kc(u)&&Jc(u)==="number",{rangeMin:N,rangeMax:F}=e,D=L&&typeof t=="string"?Kz(t):void 0,W=L&&typeof t=="string"?Gz(t):void 0;if((L||u==="number")&&N!==void 0&&F!==void 0&&(!L||t===void 0||t===null||t===""||D!==void 0||W!==void 0)){const oe=W??(D!==void 0?[D,F]:void 0),J=L?oe?.[0]:typeof t=="number"?t:void 0;if(J===void 0&&t!==void 0&&t!==null&&t!=="")return x("number");const ee=_!==null,te=ee?Array.isArray(_)?_[0]:_:J??N,de=Array.isArray(_)?[_[0],_[1]]:oe??[N,F],ce=de[1]>=F?`≥ ${de[0]}`:`${de[0]} to ${de[1]}`,fe=L&&t===""&&!ee,he=J!==void 0||fe||ee;return m.jsxs(SC,{fullWidth:!0,children:[m.jsxs(mt,{component:"fieldset",sx:me=>({m:0,minWidth:0,border:f.cardBorder,borderRadius:2,px:`${kj}px`,pt:0,pb:.75,minHeight:nye,transition:"border-color 120ms ease-in","&:hover":{borderColor:me.palette.text.secondary},"&:focus-within":{borderColor:me.palette.text.primary}}),children:[m.jsx(Ct,{component:"legend",variant:"caption",color:"text.secondary",sx:{px:.5,lineHeight:1},children:c}),m.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1,children:[m.jsx(Ct,{variant:"body2",sx:{fontWeight:"fontWeightMedium"},children:he?fe?"Any":L?ce:String(te):L?"Any":g??"Unset"}),he&&m.jsx(Yg,{onClear:()=>n(null),sx:{p:0}})]}),m.jsx(NQ,{size:"small",min:N,max:F,value:L?de:te,disableSwap:L,valueLabelDisplay:"auto","aria-label":L?void 0:c,getAriaLabel:L?me=>me===0?`${c} from`:`${c} to`:void 0,sx:{py:0,mt:.5},onChange:(me,le)=>{B.current=le,z(le)},onChangeCommitted:()=>{const me=B.current;if(B.current=null,z(null),me!==null){if(L){const[le,be]=Array.isArray(me)?[me[0],me[1]]:[me,me];if(le<=N&&be>=F){n(null);return}n(be>=F?Nie(le):Iie(le,be));return}n(Array.isArray(me)?me[0]:me)}}}),m.jsxs(Wn,{direction:"row",justifyContent:"space-between",children:[m.jsx(Ct,{variant:"caption",color:"text.secondary",children:N}),m.jsx(Ct,{variant:"caption",color:"text.secondary",children:F})]})]}),b&&m.jsx(wC,{sx:{mx:`${kj}px`},children:b})]})}const K=Kc(u)?Jc(u):void 0,ae=K==="date"||K==="timestamp"||K==="timestamptz",Y=typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t),re=t==null||Y;if(ae&&!Y){const oe=iye(t);if(oe!==void 0)return m.jsx(sye,{label:c,state:oe,onChange:n,helperNode:b,defaultDisplay:g})}if(ae&&re){const oe=Y?Ar.utc(t):null;return m.jsx(m0,{label:c,committed:oe?.isValid()?oe:null,toValue:J=>J.format("YYYY-MM-DD"),onChange:n,helperText:b})}if(Jc(u)==="boolean"){const oe=typeof t=="string"?jie(t):void 0;if(t==null||t===""||oe!==void 0)return m.jsx(aye,{label:c,picked:oe,emptyOverride:t==="",onChange:n,helperNode:b,defaultDisplay:g})}if(u==="boolean"){const oe=typeof t=="boolean";if(!oe&&t!==void 0&&t!==null)return x("true or false");const J=e.default?.trim()==="true";return m.jsxs(SC,{children:[m.jsxs(Wn,{direction:"row",alignItems:"center",children:[m.jsx($R,{control:m.jsx(NY,{checked:oe?t:J,onChange:ee=>n(ee.target.checked)}),label:c}),oe&&m.jsx(Yg,{onClear:()=>n(null),edge:"end"})]}),b&&m.jsx(wC,{children:b})]})}if(u==="number"){const oe=t!=null;return oe&&t!==""&&typeof t!="number"?x("number"):m.jsx(Rj,{label:c,type:"number",committed:typeof t=="number"?String(t):"",onCommit:J=>n(J===""?null:Number(J)),placeholder:g,helperText:b,isOverridden:oe,onClear:()=>n(null)})}if(u==="date"||u==="timestamp"||u==="timestamptz"){const oe=t instanceof Date?t:typeof t=="string"?(ee=>ee instanceof Date?ee:null)(o4(u,t)):null,J=oe?Ar.utc(oe):null;return t!=null&&t!==""&&oe===null?x("date"):m.jsx(m0,{label:c,committed:J,toValue:ee=>Vie(ee,oe??void 0),onChange:n,helperText:b})}const ue=typeof t=="string"?t:"",X=t!=null;return m.jsx(Rj,{label:c,committed:ue,onCommit:n,placeholder:X?void 0:g??(u.startsWith("filter<")?u:void 0),helperText:b,isOverridden:X,emptyOverrides:!0,onClear:()=>n(null)})}function Rj({label:e,type:t,committed:n,onCommit:r,placeholder:o,helperText:a,isOverridden:i,emptyOverrides:s=!1,onClear:c}){const{draft:f,change:u,reset:h,bind:g}=$F(n,r,{unset:s&&!i});return m.jsx(wi,{label:e,type:t,value:f,onChange:y=>u(y.target.value),placeholder:o,helperText:a,slotProps:{input:{endAdornment:i&&m.jsx(OF,{onClear:()=>{h(""),c()}})}},...g,fullWidth:!0,size:"small"})}const oye=(e,t)=>e===null||t===null?e===t:e.year()===t.year()&&e.month()===t.month()&&e.date()===t.date();function m0({label:e,committed:t,toValue:n,onChange:r,helperText:o,minDate:a}){const{draft:i,change:s,reset:c,bind:f}=$F(t,u=>{u===null?r(null):u.isValid()&&r(n(u))},{same:oye});return m.jsx(w4,{dateAdapter:Ase,children:m.jsx(Qge,{label:e,value:i,minDate:a,onChange:s,slotProps:{textField:{fullWidth:!0,size:"small",helperText:o,...f},field:{clearable:!0,onClear:()=>{c(null),r(null)}},clearButton:{onMouseDown:u=>u.preventDefault()}}})})}function Yg({onClear:e,edge:t,sx:n}){return m.jsx(xo,{size:"small","aria-label":"Clear value",onClick:e,edge:t,sx:[{minWidth:24,minHeight:24},...Array.isArray(n)?n:[n]],children:m.jsx(lse,{fontSize:"small"})})}function OF({onClear:e}){return m.jsx(OR,{position:"end",onMouseDown:t=>t.preventDefault(),children:m.jsx(Yg,{onClear:e,edge:"end"})})}const sb="__any__";function aye({label:e,picked:t,emptyOverride:n,onChange:r,helperNode:o,defaultDisplay:a}){const i=t??(n?sb:"");return m.jsx(mt,{"data-testid":"boolean-filter",children:m.jsxs(wi,{select:!0,label:e,value:i,size:"small",fullWidth:!0,helperText:o,slotProps:{select:{displayEmpty:!0,renderValue:s=>s==="true"||s==="false"?s:s===sb?"Any":a||"Any"},input:{endAdornment:i!==""?m.jsx(Yg,{onClear:()=>r(null),sx:{mr:2}}):void 0}},onChange:s=>{s.target.value!==sb&&r(s.target.value)},children:[n&&m.jsx(Qo,{value:sb,children:"Any"}),m.jsx(Qo,{value:"true",children:"true"}),m.jsx(Qo,{value:"false",children:"false"})]})})}function iye(e){if(e==null)return{kind:"unset"};if(typeof e!="string")return;if(e==="")return{kind:"any"};const t=Qz(e);if(t!==void 0)return{kind:"preset",key:t};const n=Xz(e);if(n!==void 0)return{kind:"days",...n}}const lb="__custom__",Nw="__any__";function sye({label:e,state:t,onChange:n,helperNode:r,defaultDisplay:o}){const a=t.kind==="days"?`days:${t.firstDay}/${t.lastDay}`:t.kind==="preset"?`preset:${t.key}`:t.kind,[i,s]=C.useState(t.kind==="days"),[c,f]=C.useState(t.kind==="days"?{from:t.firstDay,to:t.lastDay}:{});C.useEffect(()=>{t.kind==="days"?(s(!0),f({from:t.firstDay,to:t.lastDay})):t.kind!=="unset"&&s(!1)},[a]);const u=t.kind!=="unset",h=i?lb:t.kind==="preset"?t.key:t.kind==="any"?Nw:"",g=b=>{f(b),b.from&&b.to&&!Ar.utc(b.to).isBefore(Ar.utc(b.from))&&n(Fie(b.from,b.to))},y=b=>{const S=b?Ar.utc(b):null;return S?.isValid()?S:null};return m.jsxs(Wn,{direction:"row",spacing:1,"data-testid":"time-range",children:[m.jsxs(wi,{select:!0,label:e,value:h,size:"small",fullWidth:!0,helperText:r,slotProps:{select:{displayEmpty:!0,renderValue:b=>{if(b===lb)return"Custom range";if(b===Nw)return"Any time";const S=Bg.find(w=>w.key===b);return S?S.label:o??"Any time"}},input:{endAdornment:u?m.jsx(Yg,{onClear:()=>{s(!1),f({}),n(null)},sx:{mr:2}}):void 0}},onChange:b=>{const S=b.target.value;if(S===lb){s(!0);return}s(!1);const w=Lie(S);w!==void 0&&n(w)},children:[t.kind==="any"&&m.jsx(Qo,{value:Nw,children:"Any time"}),Bg.map(b=>m.jsx(Qo,{value:b.key,children:b.label},b.key)),m.jsx(Qo,{value:lb,children:"Custom range"})]}),i&&m.jsxs(m.Fragment,{children:[m.jsx(m0,{label:"From",committed:y(c.from),toValue:b=>b.format("YYYY-MM-DD"),onChange:b=>g({...c,from:b===null?void 0:String(b)})}),m.jsx(m0,{label:"To",committed:y(c.to),minDate:y(c.from)??void 0,toValue:b=>b.format("YYYY-MM-DD"),onChange:b=>g({...c,to:b===null?void 0:String(b)})})]})]})}const PF=C.createContext(void 0);function lye({children:e,...t}){const n=C.useContext(PF);return m.jsxs(Ka,{...t,children:[e,n&&m.jsx(mt,{role:"note",sx:{px:2,py:1,borderTop:1,borderColor:"divider",color:"text.secondary",typography:"caption"},children:n})]})}const cb=e=>e.toLocaleString("en-US");function cye(e,t,n){if(e.active)return e.searching?"Searching all values…":e.failed?`Could not search all values. Showing matches in the first ${cb(md)}.`:e.page?.truncated?`Showing the first ${cb(vE)} matches. Keep typing to narrow them.`:void 0;if(t)return n?`Showing the first ${cb(md)} values. Type to search them all.`:`Showing the first ${cb(md)} values. A value not listed can still be typed.`}const uye=C.createContext(void 0),eh=()=>C.useContext(uye),og="remove-badge",dye={[`& .${og}`]:{opacity:0},[`&:hover .${og}, &:focus-within .${og}`]:{opacity:1},"@media (hover: none)":{[`& .${og}`]:{opacity:1}}};function fye({label:e,onRemove:t,disabledReason:n,inset:r=0}){const{theme:o}=eo(),a=n!==void 0,i=m.jsx(xo,{className:og,"aria-label":e,"aria-disabled":a||void 0,...a?{"aria-description":n}:{},onClick:s=>{s.stopPropagation(),a||t()},onPointerDown:s=>s.stopPropagation(),sx:s=>({position:"absolute",top:-8-r,right:-8-r,zIndex:3,width:18,height:18,p:0,borderRadius:"50%",border:`1px solid ${Id(o.cardBorder)}`,bgcolor:s.palette.background.paper,color:s.palette.text.secondary,cursor:a?"default":"pointer",transition:`opacity ${wy}`,...Cy,"&:hover":{bgcolor:s.palette.background.paper,color:a?s.palette.text.secondary:s.palette.text.primary,borderColor:jz(o.cardBorder,o.tileTitle)}}),children:m.jsx(Xp,{sx:{fontSize:12}})});return a?m.jsx(Jo,{title:n,children:i}):i}const KE=e=>e.required===!0,pye=(e,t)=>e==null||e===""&&!r4(t);function hye(e,t,n){return e.filter(r=>r.name!==void 0&&KE(r)&&pye(t.get(r.name),r.type)&&(n?.[r.name]===void 0||n[r.name]===null))}function mye(e,t){if(!t||e.length===0)return[];const n=new Set(t);return e.filter(r=>r.name&&n.has(r.name))}const AF=e=>e.label??e.name??"";function DF(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function gye(e){const t=e.map(AF);return`Pick a value for ${DF(t)} to see this report.`}function yye(e){return`Waiting for ${DF(e.map(AF))}.`}const xk=28,vye=/^\d{4}-\d{2}-\d{2}$/,jF=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"});function Iw(e){if(!vye.test(e))return e;const t=new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())?e:jF.format(t)}function bye(e){if(e.length===0)return"";const t=e.join(", ");return t.length<=xk||e.length===1?g0(t):`${g0(e[0]??"")} +${e.length-1}`}function g0(e){return e.length>xk?`${e.slice(0,xk-1)}…`:e}function xye(e){if(KE(e))return"Required";const t=e.type??"string",n=YE(t,e.default);if(n!==void 0&&n!=="")return NF(t,n);const r=Jc(t)??t;return e.control==="select"||e.control==="multiselect"||r==="string"?"All":"Any"}function NF(e,t){if(!Kc(e))return g0(Iw(t));const n=Jc(e);if(n==="string"&&Wz(t))return bye(qz(t));if(n==="number"){const r=Gz(t);if(r)return`${r[0]}–${r[1]}`;const o=Kz(t);if(o!==void 0)return`≥ ${o}`}if(n==="date"||n==="timestamp"||n==="timestamptz"){const r=Qz(t);if(r)return Bg.find(a=>a.key===r)?.label??t;const o=Xz(t);if(o)return`${Iw(o.firstDay)} – ${Iw(o.lastDay)}`}return g0(t)}function Sye(e,t){return t==null?xye(e):t instanceof Date?Number.isNaN(t.getTime())?"":jF.format(t):typeof t=="boolean"?t?"Yes":"No":typeof t=="number"?String(t):t===""?"(empty)":NF(e.type??"string",t)}function wye(e){const{given:t,value:n,onChange:r}=e,{theme:o}=eo(),a=o.ui,i=eh(),[s,c]=C.useState(null),f=t.name??"",u=t.label??f,h=n!=null,g=Sye(t,n),y=s!==null,b=i?.stateOf(f),S=b?.problem,w=b?.fixed,x=m.jsxs(IF,{name:f,set:h,open:y,problem:S,fixed:w!==void 0,required:!h&&KE(t),children:[m.jsxs(dl,{"aria-haspopup":"dialog","aria-expanded":y,"aria-label":`${u}: ${g}`,onClick:R=>c(R.currentTarget),sx:R=>({height:"100%",borderRadius:a.radius.control,pl:"10px",pr:h?"4px":"8px",gap:"6px",fontFamily:"inherit",fontSize:a.type.control.fontSize,lineHeight:1,minWidth:0,color:R.palette.text.primary}),children:[m.jsx(mt,{component:"span",sx:R=>({color:h?o.accent:R.palette.text.secondary,whiteSpace:"nowrap"}),children:u}),m.jsx(mt,{component:"span",sx:{fontWeight:a.type.control.fontWeight,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:g}),!h&&m.jsx(jae,{"aria-hidden":!0,sx:R=>({fontSize:16,color:R.palette.text.secondary,transform:y?"rotate(180deg)":"none"})})]}),h&&m.jsx(xo,{"aria-label":`Clear ${u}`,onClick:()=>r(null),sx:{width:22,height:22,mr:"4px",borderRadius:"4px",color:o.accent},children:m.jsx(Xp,{sx:{fontSize:14}})})]});return m.jsxs(m.Fragment,{children:[S?m.jsx(Jo,{title:S,children:x}):x,m.jsxs(LL,{className:hl.filterPopover,open:y,anchorEl:s,onClose:()=>c(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{role:"dialog","aria-label":`${u} filter`,sx:{mt:.75,p:1.5,width:300,maxWidth:"calc(100vw - 32px)",boxSizing:"border-box",borderRadius:a.radius.tile,border:o.cardBorder,boxShadow:o.shadow.lift}}},children:[m.jsx(MF,{...e}),i&&m.jsxs(mt,{sx:R=>({mt:1.5,pt:1,borderTop:`1px solid ${R.palette.divider}`,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:.5}),children:[S&&m.jsx(Ct,{sx:{...a.type.caption,color:"warning.main"},children:S}),w!==void 0&&m.jsx(Ct,{sx:R=>({...a.type.caption,color:R.palette.text.secondary}),children:w}),m.jsx(Rye,{name:f,type:t.type,text:Cye(n,t.type)}),w===void 0?m.jsx(tr,{size:"small","aria-label":`Edit filter ${f}`,"aria-haspopup":"dialog",onClick:()=>{c(null),i.onEdit(f)},sx:{px:.75,minWidth:0,...a.type.control},children:"Filter settings…"}):b?.openModel&&m.jsx(tr,{size:"small",onClick:()=>{c(null),b.openModel?.()},sx:{px:.75,minWidth:0,...a.type.control},children:"Open the model"})]})]})]})}function Cye(e,t){if(e!=null)return t4(e,t)}function kye(e,t){return e===void 0||!t?.startsWith("filter<")?e:/^f(['"])([\s\S]*)\1$/.exec(e)?.[2]??e}function Rye({name:e,type:t,text:n}){const r=eh(),o=eo().theme.ui;if(!r?.setStartingValue)return null;const a=r.setStartingValue,i=kye(r.startingValueOf?.(e),t),s=r.stateOf(e)?.origin==="dashboard",c={px:.75,minWidth:0,...o.type.control};return m.jsxs(m.Fragment,{children:[i!==void 0&&i===n&&m.jsxs(Ct,{sx:f=>({...o.type.caption,color:f.palette.text.secondary,px:.75,display:"flex",alignItems:"center",gap:.5}),children:[m.jsx(Dz,{"aria-hidden":!0,sx:{fontSize:14}}),"Report default"]}),n!==void 0&&n!==i&&m.jsx(tr,{size:"small",onClick:()=>a(e,n),sx:c,children:"Make this the report's default"}),i!==void 0&&m.jsx(tr,{size:"small",onClick:()=>a(e,void 0),sx:c,children:s?"Use the filter's default":"Use the model's default"})]})}function IF({name:e,set:t=!1,open:n=!1,unused:r=!1,problem:o,fixed:a=!1,required:i=!1,children:s}){const{theme:c}=eo(),f=c.ui,u=eh();return m.jsxs(mt,{className:hl.filter,"data-filter":e,"data-set":t||void 0,"data-problem":o?!0:void 0,"data-required":i||void 0,sx:h=>({position:"relative",display:"inline-flex",alignItems:"center",height:f.size.control,boxSizing:"border-box",borderRadius:f.radius.control,border:"1px solid",borderStyle:r?"dashed":"solid",borderColor:o||i?h.palette.warning.main:t?`color-mix(in srgb, ${c.accent} 45%, transparent)`:n?c.accent:Id(c.cardBorder),bgcolor:t?`color-mix(in srgb, ${c.accent} 8%, ${h.palette.background.paper})`:h.palette.background.paper,opacity:r?.75:1,transition:`border-color ${wy}`,...Cy,"&:hover":{borderColor:t||n||o?void 0:jz(c.cardBorder,c.tileTitle)},maxWidth:"100%",...dye}),children:[s,u&&!a&&m.jsx(fye,{label:`Remove filter ${e}`,onRemove:()=>u.onRemove(e)})]})}function Eye({name:e,label:t,unused:n=!0}){const r=eh(),o=eo().theme.ui;if(!r)return null;const a=r.stateOf(e)?.problem,i=m.jsx(IF,{name:e,unused:n,problem:a,children:m.jsxs(dl,{"aria-label":`Edit filter ${e}`,"aria-haspopup":"dialog",onClick:()=>r.onEdit(e),sx:s=>({height:"100%",borderRadius:o.radius.control,px:"10px",gap:"6px",fontFamily:"inherit",fontSize:o.type.control.fontSize,lineHeight:1,color:s.palette.text.secondary,whiteSpace:"nowrap"}),children:[m.jsx("span",{children:t}),n&&m.jsx(mt,{component:"span",sx:{fontStyle:"italic"},children:"Unused"})]})});return a?m.jsx(Jo,{title:a,children:i}):i}function Tye(){const{theme:e}=eo(),t=e.ui,n=eh();if(!n)return null;const r=n.addDisabledReason!==void 0;return m.jsx(Jo,{title:n.addDisabledReason??"",children:m.jsx("span",{children:m.jsx(tr,{variant:"outlined",startIcon:m.jsx(Ox,{}),"aria-label":"Add filter","aria-haspopup":"dialog",disabled:r,onClick:()=>n.onAdd(),sx:o=>({height:t.size.control,minHeight:t.size.control,px:1.25,borderRadius:t.radius.control,borderStyle:"dashed",borderColor:Id(e.cardBorder),color:o.palette.text.secondary,boxShadow:"none",...t.type.control,"& .MuiButton-startIcon":{mr:.5},"& .MuiButton-startIcon svg":{fontSize:16}}),children:"Filter"})})})}function GE({givens:e,values:t,onChange:n,onReset:r,canReset:o,layout:a="panel",options:i,optionsLoading:s,optionsFailed:c,optionsTruncated:f,optionSearch:u,apply:h,title:g}){const y=eh();if(e.length===0&&!(y&&a==="bar"))return null;const b=Array.from(t.values()).some(k=>k!==null),S=o??b,w=k=>{if(k===void 0)return{};const T=u?.get(k);return{...f?.has(k)?{optionsTruncated:!0}:{},...T?{optionSearch:T}:{}}},x=e.map(k=>m.jsx(mt,{children:m.jsx(MF,{given:k,value:k.name?t.get(k.name):void 0,onChange:T=>k.name&&n(k.name,T),options:k.name?i?.get(k.name):void 0,optionsLoading:s,optionsFailed:k.name?c?.has(k.name):void 0,...w(k.name)})},k.name)),R=m.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1,children:[h&&m.jsx(tr,{variant:"contained",size:"small",disableElevation:!0,onClick:()=>h.pending&&h.onApply(),"aria-disabled":!h.pending,sx:{"&[aria-disabled='true']":{cursor:"default",color:"action.disabled",backgroundColor:"action.disabledBackground","&:hover":{backgroundColor:"action.disabledBackground"}}},children:"Apply"}),S&&m.jsx(tr,{variant:"text",size:"small",onClick:r,children:"Reset"})]});return a==="bar"?m.jsxs(Wn,{direction:"row",role:"group","aria-label":g??"Filters",useFlexGap:!0,sx:{flexWrap:"wrap",alignItems:"center",gap:1},children:[e.map(k=>m.jsx(wye,{given:k,value:k.name?t.get(k.name):void 0,onChange:T=>k.name&&n(k.name,T),options:k.name?i?.get(k.name):void 0,optionsLoading:s,optionsFailed:k.name?c?.has(k.name):void 0,...w(k.name)},k.name)),y?.unrendered.map(k=>m.jsx(Eye,{name:k.name,label:k.label},k.name)),m.jsx(Tye,{}),m.jsx(mt,{sx:{ml:"auto"},children:R})]}):m.jsxs(Ka,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[m.jsxs(Wn,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:2},children:[m.jsx(Ct,{variant:"subtitle2",sx:{fontWeight:"fontWeightMedium",color:"text.primary"},children:g??"Filters"}),R]}),m.jsx(mt,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",alignItems:"start",columnGap:3,rowGap:2.5},children:x})]})}const $ye=/^(https?|mailto|tel):/i,Mye=/^[a-z][a-z0-9+.-]*:/i;function Oye({href:e,title:t,children:n,context:r}){const o=!!e&&Mye.test(e),a=!!e&&!o&&!e.startsWith("/")&&!e.startsWith("#");if(!e||!a||!r){const h=o&&!$ye.test(e??"");return m.jsx("a",{href:h?void 0:e,title:t,...o?{target:"_blank",rel:"noopener noreferrer"}:{},children:n})}const i=r.sourcePath&&r.sourcePath.includes("/")?r.sourcePath.slice(0,r.sourcePath.lastIndexOf("/")+1):"",s=new URL(e,`https://malloy.invalid/${i}`),c=s.pathname.slice(1)+s.search+s.hash,f=`/${r.environmentName}/${r.packageName}/${c}`,{onNavigate:u}=r;return m.jsx("a",{href:f,title:t,onClick:u?h=>{h.preventDefault(),u(f,h)}:void 0,children:n})}const Pye=e=>({document:{"& > :first-child, & > div:only-child > :first-child":{mt:0},"& > :last-child, & > div:only-child > :last-child":{mb:0},"& h1, & h2, & h3, & h4, & h5, & h6":{fontWeight:"fontWeightMedium",color:"text.primary",mb:1,mt:2},"& h1":{fontSize:"28px"},"& h2":{fontSize:"24px"},"& h3":{fontSize:"20px"},"& p, & ul, & ol":{color:"text.primary",...e.type.prose,mb:1,maxWidth:Iae},"& li":{mb:.5}},caption:{color:"text.secondary",typography:"body2","& > :first-of-type":{mt:0},"& > :last-child":{mb:0},"& h1, & h2, & h3, & h4, & h5, & h6":{fontSize:"inherit",fontWeight:"fontWeightMedium",m:"0.5em 0 0.25em"},"& p":{m:"0.5em 0"},"& ul, & ol":{m:"0.5em 0",pl:3},"& code":{fontFamily:e.font.mono,fontSize:"0.9em"}}});function Aye({alt:e}){return m.jsx(m.Fragment,{children:e})}function Lp({children:e,variant:t="caption",links:n,sx:r}){const{theme:o}=eo();return m.jsx(mt,{sx:[Pye(o.ui)[t],{fontFamily:o.font.family},...Array.isArray(r)?r:[r]],children:m.jsx(xne,{options:{forceBlock:t==="document",disableParsingRawHTML:!0,overrides:{a:{component:Oye,props:{context:n}},img:{component:Aye}}},children:e})})}const zp={opening:e=>e?`Opening the ${e}…`:"Opening…",running:"Running…",loading:"Loading…"};function va({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:a=2,textVariant:i="body2"}){const s=m.jsxs(mt,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:a},children:[m.jsx(ly,{size:t,color:n,thickness:r}),e&&m.jsx(Ct,{variant:i,color:"text.secondary",children:e})]});return o?m.jsx(mt,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:s}):s}let Nm;function Dye(){return Nm||(Nm=Ro(()=>import("./index-DgBiwYeC.js"),[]),Nm.catch(()=>{Nm=void 0})),Nm}function LF(){typeof window>"u"||Dye().catch(()=>{})}const zF=kn(m.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}));function bp({sx:e,...t}){const{theme:n}=eo();return m.jsx(xo,{size:"small",...t,sx:[{width:32,height:32,bgcolor:n.tile,border:n.border,color:n.tileTitle,"&:hover":{bgcolor:n.tile,color:n.drillLink},"& .MuiSvgIcon-root":{fontSize:18}},...Array.isArray(e)?e:[e]]})}const jye=new Set(["warn","error"]);function Nye(e){if(!e?.length)return;const t=[];let n=!1;for(const r of e)!r.message||!jye.has(r.severity??"")||(r.severity==="error"&&(n=!0),t.includes(r.message)||t.push(r.message));if(t.length)return{severity:n?"error":"warn",title:t.join(`
471
- `)}}const Iye=C.lazy(()=>Ro(()=>import("./RenderedResult-r3dg2xOJ.es-t-MnqNaH.js"),[]).then(e=>e.c));function QE({result:e,maxHeight:t,tableMaxHeight:n,firstPaintHeight:r,maxResultSize:o=0,renderLogs:a,drill:i,fill:s=!1,compactToFit:c=!1}){const f=C.useRef(null);C.useEffect(()=>LF(),[]);const[u,h]=C.useState(void 0),[g,y]=C.useState(void 0),[b,S]=C.useState(void 0),w=C.useCallback((F,D)=>{h(F),S(D)},[]),[x,R]=C.useState(!1),[k,T]=C.useState(void 0),O=Nye(a);C.useEffect(()=>{const F=f.current;if(!s||!F)return;const D=new ResizeObserver(([W])=>{T(Math.round(W.contentRect.height)),_(Math.round(W.contentRect.width))});return D.observe(F),()=>D.disconnect()},[s,!!e,x]);const[A,I]=C.useState(void 0),[j,_]=C.useState(void 0),z=s&&c&&u==="content";if(C.useEffect(()=>{I(void 0)},[e,j,z]),C.useEffect(()=>{z&&(k===void 0||g===void 0||(A===void 0&&g>k+1?I(g):A!==void 0&&k>=A&&I(void 0)))},[z,k,g,A]),!e)return null;if(o>0&&e.length>o&&!x)return m.jsxs(mt,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[m.jsx(zne,{sx:{fontSize:48,color:"#757575"}}),m.jsx(Ct,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),m.jsx(tr,{variant:"contained",color:"primary",onClick:()=>R(!0),children:"Proceed"})]});const B=m.jsx(va,{text:zp.loading,centered:!0,size:32}),E=rie({renderAs:b,maxHeight:t,tableMaxHeight:n}),L=pD({sizing:u,contentHeight:g,maxHeight:E,fillHeight:s?k:void 0,firstPaintHeight:r}),N=m.jsx(C.Suspense,{fallback:B,children:m.jsx(Iye,{result:e,height:L,onSizeChange:y,onSizing:w,drill:i,fill:s})});return m.jsxs(mt,{ref:f,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflowX:"hidden",overflowY:s?"hidden":"auto",...s&&{flex:`1 1 ${pD({sizing:u,contentHeight:g,maxHeight:E,firstPaintHeight:r})}px`,minHeight:0}},children:[s?m.jsx(mt,{className:uie,...z&&A!==void 0?{[cie]:""}:{},sx:{position:"absolute",inset:0,overflowX:"hidden",overflowY:"auto"},children:N}):N,O&&m.jsx(mt,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:m.jsx(Jo,{title:O.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:m.jsx(bp,{"aria-label":"Render tag warnings",children:m.jsx(zF,{fontSize:"small",color:O.severity==="error"?"error":"warning"})})})})]})}function XE({state:e,context:t,loadingText:n=zp.running,maxHeight:r,tableMaxHeight:o,firstPaintHeight:a,maxResultSize:i,drill:s,fill:c,compactToFit:f,transform:u}){const{data:h,isSuccess:g,isError:y,error:b,fetchStatus:S,isPlaceholderData:w}=e,x=g||S==="fetching";C.useEffect(()=>{x&&LF()},[x]);const R=h?.data.result,k=C.useMemo(()=>R!==void 0&&u?u(R):R,[R,u]),T=C.useMemo(()=>Vae(k),[k]);if(y)return m.jsx(mt,{sx:{p:2},children:m.jsx(Ma,{context:t,error:b})});if(!g)return m.jsx(va,{text:S==="idle"?zp.loading:n});if(T)return m.jsx(mt,{sx:{p:2},children:m.jsx(Ct,{variant:"body2",role:"status",color:"text.secondary",children:T})});const O=m.jsx(QE,{result:k,maxHeight:r,tableMaxHeight:o,...a!==void 0?{firstPaintHeight:a}:{},maxResultSize:i,renderLogs:h.data.renderLogs,drill:s,fill:c,compactToFit:f});return m.jsxs(mt,{"aria-busy":w||void 0,sx:{position:"relative",display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...c?{height:"100%"}:{},"& > .result-body":{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...c?{height:"100%"}:{},opacity:w?.55:1,transition:w?"opacity 160ms ease 200ms":"opacity 120ms ease","@media (prefers-reduced-motion: reduce)":{transition:"none"}}},children:[w&&m.jsx(DL,{"aria-label":n,sx:{position:"absolute",top:0,left:0,right:0,height:2,zIndex:1,bgcolor:"transparent",borderRadius:1}}),m.jsx(mt,{className:"result-body",children:O})]})}const yd=()=>typeof performance<"u"?performance.now():Date.now(),Lye=kn(m.jsx("path",{d:"m16.95 6-3.57 4.55 1.43 1.43c1.03-1.31 4.98-6.37 4.98-6.37C20.3 4.95 19.83 4 19 4H6.83l2 2zM2.81 2.81 1.39 4.22 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-2.17l5.78 5.78 1.41-1.41z"})),zye=3;function Fye(e,t){if(e===void 0)return[];const n=new Set(e);return t.flatMap(r=>r.name&&!n.has(r.name)?[r.label??r.name]:[])}function _ye(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function Uye({ignored:e}){const{theme:t}=eo();if(e.length===0)return null;const n=e.length>zye?`Doesn't respond to ${e.length} filters`:`Doesn't respond to ${e.join(", ")}`;return m.jsxs(mt,{"data-testid":"tile-filter-tag",title:`This tile's query never reads ${_ye(e)}, so changing ${e.length===1?"it":"them"} won't change this tile`,sx:{display:"inline-flex",alignItems:"center",gap:.5,maxWidth:"100%",mb:1,alignSelf:"flex-start",px:.75,py:.125,border:1,borderColor:"warning.main",borderRadius:1,fontSize:11,lineHeight:1.6,color:"warning.main",fontFamily:t.font.family},children:[m.jsx(Lye,{sx:{fontSize:12}}),m.jsx(mt,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]})}const Bye=/\.malloy(nb)?$/,Gx=e=>e&&e.slice(e.lastIndexOf("/")+1).replace(Bye,"")||void 0,Vye=e=>e.replace(/\.malloy$/,"").split("/").map(encodeURIComponent).join("/"),FF=(e,t,n)=>`/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${Vye(n)}`,Hye="edit",qye=(e,t,n)=>`${FF(e,t,n)}?${Hye}`,ZE=e=>e.layout==="linear"?"linear":"grid",Sk=e=>({layout:ZE(e),path:e.path,editable:e.editable!==!1});function Wye(e,t){const n=t.find(r=>r.path===e);return n?.path?Sk({...n,path:n.path}):void 0}function Yye(e){return e===""||e.startsWith("/")?!1:e.split("/").every(t=>t!==""&&t!=="."&&t!=="..")}function Kye(e,t){if(!Yye(e))return{kind:"unresolved"};for(const n of[`${e}.malloy`,e]){const r=Wye(n,t);if(r)return{kind:"path",report:r}}return{kind:"unresolved"}}const Gye=(e,t,n)=>["reports",e,t,n];async function Qye(e,t,n,r){try{return(await e.reports.listReports(t,n,r)).data}catch(o){if(o?.response?.status===404)return[];throw o}}function _F(e,t,n,r=!0){const{apiClients:o}=hr(),a=To({queryKey:Gye(e,t,n),queryFn:()=>Qye(o,e,t,n),enabled:r,staleTime:6e4});return{reports:a.data??[],settled:a.isSuccess||a.isError,isFetching:a.isFetching,isError:a.isError,error:a.error,refetch:a.refetch}}const UF=20,Xye={radius:"8px",padding:`${UF}px`};function Qwe(e,t=Xye){return{"--malloy-render--font-family":e.font.family,"--malloy-render--table-font-size":`${e.font.size}px`,"--malloy-render--table-header-color":e.tableHeader,"--malloy-render--table-body-color":e.tableBody,"--malloy-render--table-border":e.border,"--malloy-render--table-pinned-border":e.pinnedBorder,"--malloy-render--tile-background":e.tile,"--publisher-dashboard-root":e.dashboardRoot,"--malloy-render--label-color":e.tileTitle,"--malloy-render--value-color":e.valueColor,"--publisher-drill-link":e.drillLink,"--publisher-dashboard-card-radius":t.radius,"--publisher-dashboard-card-padding":t.padding,"--publisher-dashboard-card-border":e.cardBorder}}const Zye={query:120,text:72};function y0({borderless:e=!1,chrome:t="card",kind:n="query",sx:r,cardRef:o,children:a}){const{theme:i}=eo(),s=i.ui,c=e||t==="none";return m.jsx(Ka,{ref:o,className:hl.tile,elevation:0,"data-chrome":t,"data-tile-kind":n,sx:[{border:c?"none":i.cardBorder,borderRadius:c?0:s.radius.tile,background:c?"none":i.tile,overflow:"hidden",isolation:"isolate",display:"flex",flexDirection:"column",minWidth:0,minHeight:t==="none"?0:Zye[n],p:t==="none"?0:e?"12px 0":`${UF}px`},...Array.isArray(r)?r:[r]],children:a})}const Jye=hl.tileHeading;function BF({title:e,subtitle:t,tooltip:n,action:r,quiet:o=!1}){const{theme:a}=eo(),i=a.ui;return m.jsxs(mt,{className:Jye,sx:{pb:o?.5:1.5,display:"flex",alignItems:"flex-start",gap:1},children:[m.jsxs(mt,{sx:{minWidth:0,flex:1},children:[m.jsx(Ct,{component:"div",sx:{...i.type.tileTitle,display:"block",color:a.tileTitle,fontFamily:a.font.family},title:n,children:e}),t!==void 0&&m.jsx(Ct,{component:"div",sx:{...i.type.caption,display:"block",mt:"2px",color:a.tileTitle,fontFamily:a.font.family,opacity:.75},children:t})]}),r]})}const eve=-1;function tve(e){const t=e.ownerDocument;for(let n=e.parentElement;n&&n!==t.body&&n!==t.documentElement;n=n.parentElement)if(/(auto|scroll|overlay)/.test(getComputedStyle(n).overflowY))return n}function nve(e,t){if((t?t.scrollTop:window.scrollY)<=0)return!1;const n=parseFloat(getComputedStyle(e).top);if(Number.isNaN(n))return!1;const r=t?t.getBoundingClientRect().top+t.clientTop:0;return e.getBoundingClientRect().top-r<=n+.5}function rve(){const[e,t]=C.useState(!1),n=C.useRef(null);return{stickyRef:C.useCallback(r=>{if(n.current?.(),n.current=null,!r||typeof window>"u")return;const o=tve(r),a=o??window;let i=0;const s=()=>{i=0,t(nve(r,o))},c=()=>{i===0&&(i=requestAnimationFrame(s))};a.addEventListener("scroll",c,{passive:!0}),window.addEventListener("resize",c),s(),n.current=()=>{a.removeEventListener("scroll",c),window.removeEventListener("resize",c),i!==0&&cancelAnimationFrame(i)}},[]),stuck:e}}const ove=4,ave="--publisher-sticky-top",ive=2;function wk({layout:e,notice:t,header:n,controls:r,children:o,sx:a}){return m.jsxs(Wn,{className:hl.report,"data-layout":e,sx:[{gap:ive},...Array.isArray(a)?a:[a]],children:[t,n,r,o]})}function VF({title:e,description:t,actions:n}){const r=eo().theme.ui;return m.jsxs(Wn,{className:hl.header,sx:{gap:1.5},children:[m.jsxs(Wn,{direction:"row",sx:{alignItems:"center",gap:2},children:[m.jsx(Ct,{component:"h1",className:hl.title,sx:{...r.type.pageTitle,m:0,flex:1,minWidth:0},children:e}),n&&m.jsx(mt,{sx:{my:"-4px"},children:n})]}),t]})}function Qx({sx:e,children:t}){return m.jsx(y0,{chrome:"none",kind:"text",...e?{sx:e}:{},children:t})}function HF({children:e}){const{theme:t}=eo(),{stickyRef:n,stuck:r}=rve();return m.jsx(mt,{ref:n,className:hl.filterRow,"data-stuck":r||void 0,sx:{position:"sticky",top:`calc(var(${ave}, 0px) + ${eve}px)`,zIndex:ove,bgcolor:r?"background.default":"transparent",pb:1,pt:1,mt:-1,boxShadow:r?`0 1px 0 ${Id(t.cardBorder)}`:"none",transition:`box-shadow ${wy}`,...Cy},children:e})}const to=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 a=r[o];a==="environments"?n.environmentName=decodeURI(r[o+1])||void 0:a==="packages"?n.packageName=decodeURI(r[o+1])||void 0:a==="connections"?n.connectionName=decodeURI(r[o+1])||void 0:a==="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},Xx=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=${encodeURIComponent(e.versionId)}`),t};function JE(e,t){if(e[t])return e;const n=e.default;return n?.[t]?n:e}const sve=e=>JE(e,"MalloyTranslator"),lve=e=>JE(e,"parseAnnotation"),cve=e=>JE(e,"ASTQuery");async function Xwe(){return sve(await Ro(()=>import("./index-CW23I6Cr.js").then(e=>e.i),__vite__mapDeps([0,1])))}async function Zwe(){return lve(await Ro(()=>Promise.resolve().then(()=>Kne),void 0))}async function uve(){return cve(await Ro(()=>import("./index-CG6r_Zwr.js").then(e=>e.i),__vite__mapDeps([2,1])))}async function dve(e){const t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return Array.from(new Uint8Array(t),n=>n.toString(16).padStart(2,"0")).join("")}function qF(e){return e.find(t=>t.authoritative)??e.find(t=>t.writeable)}function fve({authoritative:e,mutable:t,versionId:n,canStore:r,readFailed:o}){const a=e?"host":t?"package":"browser",i=n!==void 0&&a==="package";return{savesTo:a,pinnedPackageSave:i,writer:o?void 0:e?r?"storage":void 0:i?void 0:t?"package":r?"storage":void 0}}async function Jwe(e,t){return e??(t===void 0?void 0:await dve(t))}function eCe({authoritative:e,mutable:t,pinnedPackageSave:n,workspace:r,readFailure:o,versionId:a}){return o!==void 0?`The saved copy could not be read, so Save is off: ${o}`:e&&r?r.writeable?r.description:`${r.description}: you cannot save into it.`:n?`Reading version ${a}: a version is a fixed point in history, so Save is off.`:t?"Save writes the file into the package.":r?`${r.description}: this server does not take writes.`:"This server does not take writes."}function tCe(e){return e instanceof Error?e.message:String(e)}function pve(e){const t=e.response?.data;return t?.message?t.message:e instanceof Error?e.message:String(e)}async function nCe({apiClients:e,queryClient:t,environmentName:n,packageName:r,modelPath:o,source:a,expectedHash:i,invalidateOnError:s,invalidate:c,afterWrite:f}){let u;try{u=await e.models.updateModelSource(n,r,o,{source:a,expectedHash:i})}catch(g){for(const y of s)t.invalidateQueries({queryKey:y});throw new Error(pve(g))}const h=u.data.contentHash;await f?.(h);for(const{queryKey:g,refetchType:y,wait:b}of c){const S=t.invalidateQueries({queryKey:g,...y?{refetchType:y}:{}});b&&await S}return h}function rCe(e,t){return t===void 0||!/\.(saved|save_undone)$/.test(e.type)||e.where==="package"?e:{...e,workspace:t}}function oCe(e){if(!("resourceUri"in e))return{environmentName:e.environmentName,packageName:e.packageName,versionId:void 0,namesBoth:!0};let t;try{t=to(e.resourceUri)}catch{t=void 0}return{environmentName:t?.environmentName??"",packageName:t?.packageName??"",versionId:t?.versionId,namesBoth:!!t?.environmentName&&!!t?.packageName}}class WF extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const YF=e=>e instanceof WF||e instanceof Error&&e.name==="DocumentNotFoundError",hve=String.raw`##?\|?[ \t]*(?:[([{<][ \t]*)?(?:(?:(?:row|source)[-_]?)?authorize|access[-_]?filter)(?=[)\]}>]|[ \t]|$)`;function KF(e,t){if(/[\r\n]/.test(t))return`A ${e} is one line; it cannot hold a line break.`;if(new RegExp(hve,"iu").test(t))return`A ${e} cannot contain what reads as an access-control tag (authorize, row_authorize, source_authorize or access_filter).`}const Im=e=>gy(e)?e:`\`${e}\``;function eT(e){const{title:t,modelPath:n,source:r,view:o}=e;if(t.trim()==="")return"A title cannot be empty.";const a=KF("title",t);if(a)return a;if(t.includes("|##"))return"A title cannot contain `|##`, which closes the report's artifact tag.";if(/["\\\r\n]/.test(n)||n.trim()==="")return`The model path ${JSON.stringify(n)} cannot be written as an import.`;for(const[i,s]of[["source",r],["view",o]])if(s.trim()===""||/[`\r\n\\]/.test(s))return`The ${i} name ${JSON.stringify(s)} cannot be written as a Malloy name.`}const mve=e=>{const t=e.replace(/[-_]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},Ej=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,gve="report.malloy";function tT(e,t,n=gve){const r=eT(e);if(r)throw new Error(r);const{modelPath:o,source:a,view:i}=e,s=e.title.trim(),c=Ej(s),f=Im(`${a}_tiles`),u=Im(`${i}_tile`),h=`"${f} -> ${u}"`;return["##! experimental.givens",`##| artifact { layout=${t} title=${c}`," tiles=[",` ${h}`," ]",t==="grid"?"} dashboard { columns=12 }":"}","|##",`import { ${Im(a)} } from "${_z(o,n)}"`,"",`source: ${f} is ${Im(a)} extend {`,` # label=${Ej(mve(i))}`,` view: ${u} is ${Im(i)}`,"}",""].join(`
471
+ `)}}const Iye=C.lazy(()=>Ro(()=>import("./RenderedResult-D8bCgThO.es-bV5QVotj.js"),[]).then(e=>e.c));function QE({result:e,maxHeight:t,tableMaxHeight:n,firstPaintHeight:r,maxResultSize:o=0,renderLogs:a,drill:i,fill:s=!1,compactToFit:c=!1}){const f=C.useRef(null);C.useEffect(()=>LF(),[]);const[u,h]=C.useState(void 0),[g,y]=C.useState(void 0),[b,S]=C.useState(void 0),w=C.useCallback((F,D)=>{h(F),S(D)},[]),[x,R]=C.useState(!1),[k,T]=C.useState(void 0),O=Nye(a);C.useEffect(()=>{const F=f.current;if(!s||!F)return;const D=new ResizeObserver(([W])=>{T(Math.round(W.contentRect.height)),_(Math.round(W.contentRect.width))});return D.observe(F),()=>D.disconnect()},[s,!!e,x]);const[A,I]=C.useState(void 0),[j,_]=C.useState(void 0),z=s&&c&&u==="content";if(C.useEffect(()=>{I(void 0)},[e,j,z]),C.useEffect(()=>{z&&(k===void 0||g===void 0||(A===void 0&&g>k+1?I(g):A!==void 0&&k>=A&&I(void 0)))},[z,k,g,A]),!e)return null;if(o>0&&e.length>o&&!x)return m.jsxs(mt,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[m.jsx(zne,{sx:{fontSize:48,color:"#757575"}}),m.jsx(Ct,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),m.jsx(tr,{variant:"contained",color:"primary",onClick:()=>R(!0),children:"Proceed"})]});const B=m.jsx(va,{text:zp.loading,centered:!0,size:32}),E=rie({renderAs:b,maxHeight:t,tableMaxHeight:n}),L=pD({sizing:u,contentHeight:g,maxHeight:E,fillHeight:s?k:void 0,firstPaintHeight:r}),N=m.jsx(C.Suspense,{fallback:B,children:m.jsx(Iye,{result:e,height:L,onSizeChange:y,onSizing:w,drill:i,fill:s})});return m.jsxs(mt,{ref:f,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflowX:"hidden",overflowY:s?"hidden":"auto",...s&&{flex:`1 1 ${pD({sizing:u,contentHeight:g,maxHeight:E,firstPaintHeight:r})}px`,minHeight:0}},children:[s?m.jsx(mt,{className:uie,...z&&A!==void 0?{[cie]:""}:{},sx:{position:"absolute",inset:0,overflowX:"hidden",overflowY:"auto"},children:N}):N,O&&m.jsx(mt,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:m.jsx(Jo,{title:O.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:m.jsx(bp,{"aria-label":"Render tag warnings",children:m.jsx(zF,{fontSize:"small",color:O.severity==="error"?"error":"warning"})})})})]})}function XE({state:e,context:t,loadingText:n=zp.running,maxHeight:r,tableMaxHeight:o,firstPaintHeight:a,maxResultSize:i,drill:s,fill:c,compactToFit:f,transform:u}){const{data:h,isSuccess:g,isError:y,error:b,fetchStatus:S,isPlaceholderData:w}=e,x=g||S==="fetching";C.useEffect(()=>{x&&LF()},[x]);const R=h?.data.result,k=C.useMemo(()=>R!==void 0&&u?u(R):R,[R,u]),T=C.useMemo(()=>Vae(k),[k]);if(y)return m.jsx(mt,{sx:{p:2},children:m.jsx(Ma,{context:t,error:b})});if(!g)return m.jsx(va,{text:S==="idle"?zp.loading:n});if(T)return m.jsx(mt,{sx:{p:2},children:m.jsx(Ct,{variant:"body2",role:"status",color:"text.secondary",children:T})});const O=m.jsx(QE,{result:k,maxHeight:r,tableMaxHeight:o,...a!==void 0?{firstPaintHeight:a}:{},maxResultSize:i,renderLogs:h.data.renderLogs,drill:s,fill:c,compactToFit:f});return m.jsxs(mt,{"aria-busy":w||void 0,sx:{position:"relative",display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...c?{height:"100%"}:{},"& > .result-body":{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...c?{height:"100%"}:{},opacity:w?.55:1,transition:w?"opacity 160ms ease 200ms":"opacity 120ms ease","@media (prefers-reduced-motion: reduce)":{transition:"none"}}},children:[w&&m.jsx(DL,{"aria-label":n,sx:{position:"absolute",top:0,left:0,right:0,height:2,zIndex:1,bgcolor:"transparent",borderRadius:1}}),m.jsx(mt,{className:"result-body",children:O})]})}const yd=()=>typeof performance<"u"?performance.now():Date.now(),Lye=kn(m.jsx("path",{d:"m16.95 6-3.57 4.55 1.43 1.43c1.03-1.31 4.98-6.37 4.98-6.37C20.3 4.95 19.83 4 19 4H6.83l2 2zM2.81 2.81 1.39 4.22 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-2.17l5.78 5.78 1.41-1.41z"})),zye=3;function Fye(e,t){if(e===void 0)return[];const n=new Set(e);return t.flatMap(r=>r.name&&!n.has(r.name)?[r.label??r.name]:[])}function _ye(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function Uye({ignored:e}){const{theme:t}=eo();if(e.length===0)return null;const n=e.length>zye?`Doesn't respond to ${e.length} filters`:`Doesn't respond to ${e.join(", ")}`;return m.jsxs(mt,{"data-testid":"tile-filter-tag",title:`This tile's query never reads ${_ye(e)}, so changing ${e.length===1?"it":"them"} won't change this tile`,sx:{display:"inline-flex",alignItems:"center",gap:.5,maxWidth:"100%",mb:1,alignSelf:"flex-start",px:.75,py:.125,border:1,borderColor:"warning.main",borderRadius:1,fontSize:11,lineHeight:1.6,color:"warning.main",fontFamily:t.font.family},children:[m.jsx(Lye,{sx:{fontSize:12}}),m.jsx(mt,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]})}const Bye=/\.malloy(nb)?$/,Gx=e=>e&&e.slice(e.lastIndexOf("/")+1).replace(Bye,"")||void 0,Vye=e=>e.replace(/\.malloy$/,"").split("/").map(encodeURIComponent).join("/"),FF=(e,t,n)=>`/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${Vye(n)}`,Hye="edit",qye=(e,t,n)=>`${FF(e,t,n)}?${Hye}`,ZE=e=>e.layout==="linear"?"linear":"grid",Sk=e=>({layout:ZE(e),path:e.path,editable:e.editable!==!1});function Wye(e,t){const n=t.find(r=>r.path===e);return n?.path?Sk({...n,path:n.path}):void 0}function Yye(e){return e===""||e.startsWith("/")?!1:e.split("/").every(t=>t!==""&&t!=="."&&t!=="..")}function Kye(e,t){if(!Yye(e))return{kind:"unresolved"};for(const n of[`${e}.malloy`,e]){const r=Wye(n,t);if(r)return{kind:"path",report:r}}return{kind:"unresolved"}}const Gye=(e,t,n)=>["reports",e,t,n];async function Qye(e,t,n,r){try{return(await e.reports.listReports(t,n,r)).data}catch(o){if(o?.response?.status===404)return[];throw o}}function _F(e,t,n,r=!0){const{apiClients:o}=hr(),a=To({queryKey:Gye(e,t,n),queryFn:()=>Qye(o,e,t,n),enabled:r,staleTime:6e4});return{reports:a.data??[],settled:a.isSuccess||a.isError,isFetching:a.isFetching,isError:a.isError,error:a.error,refetch:a.refetch}}const UF=20,Xye={radius:"8px",padding:`${UF}px`};function Qwe(e,t=Xye){return{"--malloy-render--font-family":e.font.family,"--malloy-render--table-font-size":`${e.font.size}px`,"--malloy-render--table-header-color":e.tableHeader,"--malloy-render--table-body-color":e.tableBody,"--malloy-render--table-border":e.border,"--malloy-render--table-pinned-border":e.pinnedBorder,"--malloy-render--tile-background":e.tile,"--publisher-dashboard-root":e.dashboardRoot,"--malloy-render--label-color":e.tileTitle,"--malloy-render--value-color":e.valueColor,"--publisher-drill-link":e.drillLink,"--publisher-dashboard-card-radius":t.radius,"--publisher-dashboard-card-padding":t.padding,"--publisher-dashboard-card-border":e.cardBorder}}const Zye={query:120,text:72};function y0({borderless:e=!1,chrome:t="card",kind:n="query",sx:r,cardRef:o,children:a}){const{theme:i}=eo(),s=i.ui,c=e||t==="none";return m.jsx(Ka,{ref:o,className:hl.tile,elevation:0,"data-chrome":t,"data-tile-kind":n,sx:[{border:c?"none":i.cardBorder,borderRadius:c?0:s.radius.tile,background:c?"none":i.tile,overflow:"hidden",isolation:"isolate",display:"flex",flexDirection:"column",minWidth:0,minHeight:t==="none"?0:Zye[n],p:t==="none"?0:e?"12px 0":`${UF}px`},...Array.isArray(r)?r:[r]],children:a})}const Jye=hl.tileHeading;function BF({title:e,subtitle:t,tooltip:n,action:r,quiet:o=!1}){const{theme:a}=eo(),i=a.ui;return m.jsxs(mt,{className:Jye,sx:{pb:o?.5:1.5,display:"flex",alignItems:"flex-start",gap:1},children:[m.jsxs(mt,{sx:{minWidth:0,flex:1},children:[m.jsx(Ct,{component:"div",sx:{...i.type.tileTitle,display:"block",color:a.tileTitle,fontFamily:a.font.family},title:n,children:e}),t!==void 0&&m.jsx(Ct,{component:"div",sx:{...i.type.caption,display:"block",mt:"2px",color:a.tileTitle,fontFamily:a.font.family,opacity:.75},children:t})]}),r]})}const eve=-1;function tve(e){const t=e.ownerDocument;for(let n=e.parentElement;n&&n!==t.body&&n!==t.documentElement;n=n.parentElement)if(/(auto|scroll|overlay)/.test(getComputedStyle(n).overflowY))return n}function nve(e,t){if((t?t.scrollTop:window.scrollY)<=0)return!1;const n=parseFloat(getComputedStyle(e).top);if(Number.isNaN(n))return!1;const r=t?t.getBoundingClientRect().top+t.clientTop:0;return e.getBoundingClientRect().top-r<=n+.5}function rve(){const[e,t]=C.useState(!1),n=C.useRef(null);return{stickyRef:C.useCallback(r=>{if(n.current?.(),n.current=null,!r||typeof window>"u")return;const o=tve(r),a=o??window;let i=0;const s=()=>{i=0,t(nve(r,o))},c=()=>{i===0&&(i=requestAnimationFrame(s))};a.addEventListener("scroll",c,{passive:!0}),window.addEventListener("resize",c),s(),n.current=()=>{a.removeEventListener("scroll",c),window.removeEventListener("resize",c),i!==0&&cancelAnimationFrame(i)}},[]),stuck:e}}const ove=4,ave="--publisher-sticky-top",ive=2;function wk({layout:e,notice:t,header:n,controls:r,children:o,sx:a}){return m.jsxs(Wn,{className:hl.report,"data-layout":e,sx:[{gap:ive},...Array.isArray(a)?a:[a]],children:[t,n,r,o]})}function VF({title:e,description:t,actions:n}){const r=eo().theme.ui;return m.jsxs(Wn,{className:hl.header,sx:{gap:1.5},children:[m.jsxs(Wn,{direction:"row",sx:{alignItems:"center",gap:2},children:[m.jsx(Ct,{component:"h1",className:hl.title,sx:{...r.type.pageTitle,m:0,flex:1,minWidth:0},children:e}),n&&m.jsx(mt,{sx:{my:"-4px"},children:n})]}),t]})}function Qx({sx:e,children:t}){return m.jsx(y0,{chrome:"none",kind:"text",...e?{sx:e}:{},children:t})}function HF({children:e}){const{theme:t}=eo(),{stickyRef:n,stuck:r}=rve();return m.jsx(mt,{ref:n,className:hl.filterRow,"data-stuck":r||void 0,sx:{position:"sticky",top:`calc(var(${ave}, 0px) + ${eve}px)`,zIndex:ove,bgcolor:r?"background.default":"transparent",pb:1,pt:1,mt:-1,boxShadow:r?`0 1px 0 ${Id(t.cardBorder)}`:"none",transition:`box-shadow ${wy}`,...Cy},children:e})}const to=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 a=r[o];a==="environments"?n.environmentName=decodeURI(r[o+1])||void 0:a==="packages"?n.packageName=decodeURI(r[o+1])||void 0:a==="connections"?n.connectionName=decodeURI(r[o+1])||void 0:a==="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},Xx=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=${encodeURIComponent(e.versionId)}`),t};function JE(e,t){if(e[t])return e;const n=e.default;return n?.[t]?n:e}const sve=e=>JE(e,"MalloyTranslator"),lve=e=>JE(e,"parseAnnotation"),cve=e=>JE(e,"ASTQuery");async function Xwe(){return sve(await Ro(()=>import("./index-9_OOEQph.js").then(e=>e.i),__vite__mapDeps([0,1])))}async function Zwe(){return lve(await Ro(()=>Promise.resolve().then(()=>Kne),void 0))}async function uve(){return cve(await Ro(()=>import("./index-BsumQDtR.js").then(e=>e.i),__vite__mapDeps([2,1])))}async function dve(e){const t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return Array.from(new Uint8Array(t),n=>n.toString(16).padStart(2,"0")).join("")}function qF(e){return e.find(t=>t.authoritative)??e.find(t=>t.writeable)}function fve({authoritative:e,mutable:t,versionId:n,canStore:r,readFailed:o}){const a=e?"host":t?"package":"browser",i=n!==void 0&&a==="package";return{savesTo:a,pinnedPackageSave:i,writer:o?void 0:e?r?"storage":void 0:i?void 0:t?"package":r?"storage":void 0}}async function Jwe(e,t){return e??(t===void 0?void 0:await dve(t))}function eCe({authoritative:e,mutable:t,pinnedPackageSave:n,workspace:r,readFailure:o,versionId:a}){return o!==void 0?`The saved copy could not be read, so Save is off: ${o}`:e&&r?r.writeable?r.description:`${r.description}: you cannot save into it.`:n?`Reading version ${a}: a version is a fixed point in history, so Save is off.`:t?"Save writes the file into the package.":r?`${r.description}: this server does not take writes.`:"This server does not take writes."}function tCe(e){return e instanceof Error?e.message:String(e)}function pve(e){const t=e.response?.data;return t?.message?t.message:e instanceof Error?e.message:String(e)}async function nCe({apiClients:e,queryClient:t,environmentName:n,packageName:r,modelPath:o,source:a,expectedHash:i,invalidateOnError:s,invalidate:c,afterWrite:f}){let u;try{u=await e.models.updateModelSource(n,r,o,{source:a,expectedHash:i})}catch(g){for(const y of s)t.invalidateQueries({queryKey:y});throw new Error(pve(g))}const h=u.data.contentHash;await f?.(h);for(const{queryKey:g,refetchType:y,wait:b}of c){const S=t.invalidateQueries({queryKey:g,...y?{refetchType:y}:{}});b&&await S}return h}function rCe(e,t){return t===void 0||!/\.(saved|save_undone)$/.test(e.type)||e.where==="package"?e:{...e,workspace:t}}function oCe(e){if(!("resourceUri"in e))return{environmentName:e.environmentName,packageName:e.packageName,versionId:void 0,namesBoth:!0};let t;try{t=to(e.resourceUri)}catch{t=void 0}return{environmentName:t?.environmentName??"",packageName:t?.packageName??"",versionId:t?.versionId,namesBoth:!!t?.environmentName&&!!t?.packageName}}class WF extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const YF=e=>e instanceof WF||e instanceof Error&&e.name==="DocumentNotFoundError",hve=String.raw`##?\|?[ \t]*(?:[([{<][ \t]*)?(?:(?:(?:row|source)[-_]?)?authorize|access[-_]?filter)(?=[)\]}>]|[ \t]|$)`;function KF(e,t){if(/[\r\n]/.test(t))return`A ${e} is one line; it cannot hold a line break.`;if(new RegExp(hve,"iu").test(t))return`A ${e} cannot contain what reads as an access-control tag (authorize, row_authorize, source_authorize or access_filter).`}const Im=e=>gy(e)?e:`\`${e}\``;function eT(e){const{title:t,modelPath:n,source:r,view:o}=e;if(t.trim()==="")return"A title cannot be empty.";const a=KF("title",t);if(a)return a;if(t.includes("|##"))return"A title cannot contain `|##`, which closes the report's artifact tag.";if(/["\\\r\n]/.test(n)||n.trim()==="")return`The model path ${JSON.stringify(n)} cannot be written as an import.`;for(const[i,s]of[["source",r],["view",o]])if(s.trim()===""||/[`\r\n\\]/.test(s))return`The ${i} name ${JSON.stringify(s)} cannot be written as a Malloy name.`}const mve=e=>{const t=e.replace(/[-_]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},Ej=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,gve="report.malloy";function tT(e,t,n=gve){const r=eT(e);if(r)throw new Error(r);const{modelPath:o,source:a,view:i}=e,s=e.title.trim(),c=Ej(s),f=Im(`${a}_tiles`),u=Im(`${i}_tile`),h=`"${f} -> ${u}"`;return["##! experimental.givens",`##| artifact { layout=${t} title=${c}`," tiles=[",` ${h}`," ]",t==="grid"?"} dashboard { columns=12 }":"}","|##",`import { ${Im(a)} } from "${_z(o,n)}"`,"",`source: ${f} is ${Im(a)} extend {`,` # label=${Ej(mve(i))}`,` view: ${u} is ${Im(i)}`,"}",""].join(`
472
472
  `)}function aCe(e,t){return tT(e,"linear",t)}function yve(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,80)}function vve({title:e,modelPath:t,source:n,view:r}){for(const[o,a]of[["source",n],["view",r]])if(!gy(a))return`The ${o} name ${JSON.stringify(a)} cannot be written as a Malloy name.`;return/["\\\r\n]/.test(t)?`The model path ${JSON.stringify(t)} cannot be written into an import.`:KF("title",e)}function iCe(e,t){const n=vve(e);if(n)throw new Error(n);return tT(e,"grid",t)}const GF=e=>(e??"").trim().replace(/\\/g,"/").split("/").filter(t=>t!=="").join("/");function bve(e,t){const n=GF(t);return`${n===""?"":`${n}/`}${e}.malloy`}function xve(e){return yve(e)||"untitled"}function QF(e,t=1,n){const r=xve(e);return bve(t>1?`${r}-${t}`:r,n)}const Kg=(e,t,n)=>`${e}/${t}/${n}`,Sve=(e,t,n,r,o)=>({workspace:t,type:e,path:Kg(n,r,o)}),nT=20;function wve(e){const{savesTo:t,writer:n}=fve({...e,readFailed:!1});return t==="browser"?void 0:n}const Tj=e=>e.slice(e.lastIndexOf("/")+1).replace(/\.malloy$/,"");function XF(e){if(!e.endsWith(".malloy"))return"A report's file name ends in .malloy.";const t=e.split("/");if(t.some(n=>n===""||n==="."||n===".."))return"A location is a path inside the package, such as sales/q3.malloy.";if(t.at(-1)===".malloy")return"A report's file needs a name.";if(t[0].toLowerCase()==="public")return"A report cannot live under public/, which is served as plain files.";if(e.toLowerCase()==="index.malloy")return"The package's index.malloy is its surface, never a report."}async function Cve(e){const t=e.layout??"linear",n=yd();let r;try{r=await kve(e,t)}catch(o){throw ek({path:e.path??"",layout:t},e.onEvent).emit({type:"report.create_refused",reason:o instanceof Error?o.message:String(o)}),o}return ek({path:r.path,layout:t},e.onEvent).emit({type:"report.created",where:e.target.route==="package"?"package":"host",durationMs:yd()-n}),e.onCreated?.(r),r}async function kve(e,t){const{document:n,target:r}=e,o=eT(n);if(o)throw new Error(o);const a=GF(e.directory),i=e.path!==void 0?[e.path]:Array.from({length:nT},(S,w)=>QF(n.title,w+1,a));for(const S of i){const w=XF(S);if(w)throw new Error(w)}const s=S=>tT(n,t,S);if(r.route==="package"){const S=new Set(r.existing);let w;for(const x of i)if(!S.has(x))try{await r.write(x,s(x)),w=x;break}catch(R){if(!Rve(R))throw R}if(w===void 0)throw $j(n.title,e.path);return{layout:t,path:w,slug:Tj(w)}}const{storage:c,workspace:f,environmentName:u,packageName:h}=r,g=new Set(r.existing),y=new Set((await c.listDocuments(f)).map(S=>S.path));let b;for(const S of i){const w=Sve(t,f.name,u,h,S),x=await c.resolveDocumentPath?.(w)??S;if(y.has(w.path)||g.has(S)||g.has(x))continue;let R=!0;try{await c.getDocument(w)}catch(k){if(!YF(k))throw k;R=!1}if(!R){b={layout:t,path:x,slug:Tj(x),locator:w};break}}if(b===void 0)throw $j(n.title,e.path);return await c.saveDocument(b.locator,s(b.path)),b}const Rve=e=>e?.response?.status===409,$j=(e,t)=>new Error(t!==void 0?`${t} already exists. Fix: choose a different location.`:`No free file name for "${e}" after ${nT} tries. Fix: choose a different title.`);function Eve(e){try{const t=JSON.parse(e??"");return new Set((t.entries??[]).flatMap(n=>n.kind==="source"&&typeof n.name=="string"?[n.name]:[]))}catch{return new Set}}function Mj(e){for(const t of e??[]){const n=/^#\(doc\)\s*(.*)$/s.exec(t.trim());if(n)return n[1].trim()}}function Tve(e){for(const t of e??[]){const n=/^#\s*(?:-[A-Za-z_]+\s+)*([a-z_]+)/.exec(t.trim())?.[1];if(n&&Pz.includes(n))return n}}function $ve({environmentName:e,packageName:t,versionId:n,models:r,enabled:o}){const{apiClients:a,server:i}=hr(),s=s5({queries:r.map(b=>({queryKey:["new-document-model",e,t,n,b,i],queryFn:async()=>(await a.models.getModel(e,t,b,n)).data,enabled:o,retry:!1,staleTime:300*1e3,refetchOnWindowFocus:!1}))}),c=s.map(b=>b.dataUpdatedAt).join(),f=C.useMemo(()=>{const b=new Map;return s.forEach((S,w)=>{const x=[],R=Eve(S.data?.modelInfo);for(const k of S.data?.sources??[]){if(typeof k.name!="string"||!R.has(k.name))continue;const T=Mj(k.annotations);for(const O of k.views??[])if(typeof O.name=="string"){const A=Mj(O.annotations),I=Tve(O.annotations);x.push({source:k.name,view:O.name,...A?{description:A}:{},...I?{chart:I}:{},...T?{sourceDescription:T}:{}})}}x.length>0&&b.set(r[w],x)}),b},[c,r]),u=s.some(b=>b.isLoading),h=u?[]:r.filter((b,S)=>s[S]?.isError),g=!u&&s.some(b=>b.isError&&rz(b.error)),y=()=>{s.forEach(b=>{b.isError&&b.refetch()})};return{choices:f,isLoading:u,isSuccess:s.length>0&&s.every(b=>!b.isPending),failed:h,retry:y,canRetry:g}}const ZF=C.createContext(void 0);function Mve({children:e,documentStorage:t}){const n=C.useMemo(()=>({documentStorage:t}),[t]);return m.jsx(ZF.Provider,{value:n,children:e})}function JF(){return C.useContext(ZF)}function Ove(e,{environmentName:t,packageName:n,path:r,versionId:o},a){return{queryKey:["report",t,n,o,r],queryFn:async({signal:i})=>(await e.reports.getReport(t,n,r,o,{signal:i})).data,...a===void 0?{}:{staleTime:a}}}const sCe=1e4,e3=e=>e==="notebook"?"linear":"grid",lCe=(e,t)=>`${e}s/${t}.malloy`;function Pve(e,t,n){return[["dashboards"],["notebooks"],["dashboard"],...n===void 0?[]:[[Xx({environmentName:e,packageName:t,modelPath:n})]]]}function Ave(e,t,n,r){for(const o of[["report"],["reports"],...Pve(t,n,r)])e.invalidateQueries({queryKey:o})}function To(e){const{server:t}=hr(),n={...e,queryKey:[...e.queryKey,t],queryFn:async r=>{try{return await e.queryFn(r)}catch(o){if(o&&typeof o=="object"&&"response"in o){const a=o;if(a.response?.data){const i=new Error(a.response.data.message||a.message);throw i.status=a.response.status,i.data=a.response.data,i}}throw o}},retry:!1,throwOnError:!1};return VR(n,ZR)}function al(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 a=new Error(o.response.data.message||o.message);throw a.status=o.response.status,a.data=o.response.data,a}}throw r}},retry:!1,throwOnError:!1};return Rb(t,ZR)}function Dve(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath,e.queryName,e.query,e.sourceName,JSON.stringify(e.givens??{})]}function cCe(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath]}function rT(e,{enabled:t=!0}={}){const{apiClients:n}=hr(),r=Dve(e);return To({queryKey:r,queryFn:({signal:o})=>n.models.executeQueryModel(e.environmentName,e.packageName,e.modelPath,{queryName:e.queryName,query:e.query,sourceName:e.sourceName,givens:e.givens,versionId:e.versionId},void 0,{signal:o}),enabled:t,placeholderData:(o,a)=>a&&Nve(a.queryKey,r)?o:void 0,...ite})}const jve=8;function Nve(e,t){return e.every((n,r)=>r===jve||r>=t.length||n===t[r])}const Ive=/<\/?[A-Za-z][^>]*>|<!--|<![A-Za-z]/;function t3(e){let t=!1;for(const[n,r]of Array.from(e.entries())){if(r.deleted)continue;if(n==="image"||n==="link"){e.delete(n),t=!0;continue}if(n==="label"){let a;try{a=e.text("label")}catch{a=void 0}if(a!==void 0&&Ive.test(a)){e.delete("label"),t=!0;continue}}const o=Array.isArray(r.eq)?r.eq:[];for(const a of[r,...o])t3(a)&&(t=!0)}return t}function Lve(e){const t=e.trim();if(!/^#(?:\||[ \t\r\n]|$)/.test(t))return e;if(t.includes("@env."))return"";let n;try{n=rE.parseAnnotation(t)}catch{return""}return n.log.length>0?"":t3(n.tag)?`${n.tag.toString()}
473
473
  `:e}function Ck(e){if(Array.isArray(e)){for(const n of e)Ck(n);return}if(e===null||typeof e!="object")return;const t=e;for(const[n,r]of Object.entries(t))if(n==="annotations"&&Array.isArray(r))for(const o of r){const a=o;typeof a?.value=="string"&&(a.value=Lve(a.value))}else Ck(r)}function n3(e){let t;try{t=JSON.parse(e)}catch{return e}const n=JSON.stringify(t);Ck(t);const r=JSON.stringify(t);return r===n?e:r}const zve=new Set(["bar_chart","line_chart","scatter_chart","combo_chart","shape_map","segment_map","point_map","big_value","sparkline","list","list_detail","dashboard","transpose","table","json","image","link","text"]),Fve={value:`# big_value
474
474
  `};function _ve(e){const t=e.schema?.fields;if(!Array.isArray(t)||t.length===0||!t.every(r=>JC(r)))return!1;const n=e.data;return n?n.kind==="record_cell"?!0:n.kind==="array_cell"&&Array.isArray(n.array_value)&&n.array_value.length===1:!1}function Uve(e){for(const t of e){const n=t.trim();if(!n.startsWith("#")||n.startsWith("#(")||n.startsWith('#"'))continue;const r=Px(n.slice(1));for(const o of r.split(/[\s{}=.,[\]]+/))if(zve.has(o))return!0}return!1}function r3(e){let t;try{t=JSON.parse(e)}catch{return e}if(!t||typeof t!="object"||!_ve(t))return e;const n=Array.isArray(t.annotations)?t.annotations:[],r=n.map(o=>o?.value).filter(o=>typeof o=="string");return Uve(r)?e:JSON.stringify({...t,annotations:[Fve,...n]})}const Bve=e=>n3(r3(e));function Oj(e){const t=e.split("->").at(-1)?.trim()??e;return/^[A-Za-z_][\w-]*$/.test(t)?Jz(t):e}function o3({environmentName:e,packageName:t,versionId:n,modelPath:r,queryName:o,tile:a,annotation:i,label:s,subtitle:c,heading:f,borderless:u,givens:h,hostGivens:g,declaredTypes:y,givenNames:b,height:S,tableMaxHeight:w,fixedHeight:x,maxResultSize:R,drill:k,onExplore:T,chrome:O="card",ignoredFilters:A,preamble:I,restricted:j,waitingFor:_,index:z}){const{theme:B}=eo(),[E,L]=yie(),N=rT({environmentName:e,packageName:t,modelPath:r,versionId:n,queryName:o,query:a!==void 0?Ix(I??"",`${i?`${i}
@@ -478,6 +478,6 @@ ${t}`}function Zie(e){return e?.status===403}const md=1e3,vE=200;function a4(e){
478
478
  `)??[];return n.length===0&&(n.push(`# ${e.name}`),n.push("")),(e.readme?.length??0)>0&&t?n.splice(2,1,t):t&&n.push(t),n.join(`
479
479
  `)};function Zj(){const[e,t]=C.useState(!1),{apiClients:n}=hr(),r=()=>{t(!0)},o=()=>{t(!1)},a=th({mutationFn(s){return n.environments.createEnvironment({name:s.name,readme:E3({name:s.name,readme:""},s.description)})},success:"Environment created",invalidates:[["environments"]],closeDialog:o,resource:"environment",action:"create"}),i=async s=>{s.preventDefault();const c=new FormData(s.currentTarget),f=c.get("name")?.toString(),u=c.get("description")?.toString();if(!f)throw new Error("Name is required");a.mutate({name:f,description:u})};return m.jsxs(Sn.Fragment,{children:[m.jsx(xy,{label:"Environment",onClick:r}),m.jsx($o,{open:e,onClose:o,title:"New environment",description:"An environment holds packages and the connections they query through.",actions:m.jsxs(m.Fragment,{children:[m.jsx(yo,{disabled:a.isPending,onClick:o,children:"Cancel"}),m.jsx(yo,{type:"submit",form:"environment-form",variant:"contained",loading:a.isPending,children:"Create environment"})]}),children:m.jsx("form",{onSubmit:i,id:"environment-form",children:m.jsxs(Jx,{sx:{gap:2},children:[m.jsx(gr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),m.jsx(gr,{id:"description",name:"description",label:"Description",placeholder:"Explore semantic models, run queries, and build reports",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}})]})})}),a.notice]})}function L0e({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=hr(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=th({mutationFn:()=>o.environments.deleteEnvironment(e.name),success:"Environment deleted",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"delete"});return m.jsxs(Sn.Fragment,{children:[m.jsxs(Qo,{onClick:a,children:[m.jsx(il,{children:m.jsx(yx,{fontSize:"small"})}),m.jsx(bi,{children:"Delete"})]}),m.jsx($o,{open:n,onClose:i,title:"Delete environment",actions:m.jsxs(m.Fragment,{children:[m.jsx(yo,{onClick:i,children:"Cancel"}),m.jsx(yo,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>s.mutate(),loading:s.isPending,children:"Delete environment"})]}),children:m.jsxs(Sr,{variant:"body2",children:["Delete ",m.jsx("strong",{children:e.name}),"? Its packages stop being served and this cannot be undone."]})}),s.notice]})}function z0e({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=hr(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=th({mutationFn(f){return o.environments.updateEnvironment(e.name,{name:e.name,readme:E3({name:e.name,readme:e.readme},f.description)})},success:"Environment updated",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"update"}),c=f=>{f.preventDefault();const u=new FormData(f.currentTarget).get("description")?.toString();s.mutate({description:u})};return m.jsxs(Sn.Fragment,{children:[m.jsxs(Qo,{onClick:a,children:[m.jsx(il,{children:m.jsx(nE,{fontSize:"small"})}),m.jsx(bi,{children:"Edit"})]}),m.jsx($o,{open:n,onClose:i,title:"Edit environment",description:"What this environment is, for the people who open it.",actions:m.jsxs(m.Fragment,{children:[m.jsx(yo,{disabled:s.isPending,onClick:i,children:"Cancel"}),m.jsx(yo,{type:"submit",form:"environment-form",variant:"contained",loading:s.isPending,children:"Save changes"})]}),children:m.jsx("form",{onSubmit:c,id:"environment-form",children:m.jsxs(Jx,{sx:{gap:2},children:[m.jsx(gr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",disabled:!0,type:"text",fullWidth:!0,size:"small",defaultValue:e.name,InputLabelProps:{shrink:!0}}),m.jsx(gr,{id:"description",name:"description",label:"Description",type:"text",fullWidth:!0,size:"small",defaultValue:R3(e.readme),InputLabelProps:{shrink:!0}})]})})}),s.notice]})}const F0e=[{title:"Model",body:"An agent writes what the data means in Malloy — sources, joins, measures — from a warehouse or a file, and validates each edit without a restart.",href:qc.publishing},{title:"Analyze",body:"Claude, Cursor, Codex or an agent you build asks over MCP; applications and BI tools use REST. Every question runs against the model, never the raw tables.",href:qc.mcpAgents},{title:"Surface",body:"Reports declared in Malloy, laid out as a grid or read top to bottom, and no-build HTML data apps, all shipped inside the package, plus this Console for browsing them.",href:qc.surfaces},{title:"Govern",body:"Runtime parameters, row-level filters and per-source gates are declared in the model, so every surface reads the same rules rather than writing its own.",href:qc.givens},{title:"Optimize",body:"One annotation materializes an expensive source into a table, and another rolls a measure up to a coarser grain, rebuilt on demand or on a schedule.",href:qc.materialization},{title:"Run anywhere",body:"DuckDB is built in for CSV, Parquet, JSON and Excel; BigQuery, Snowflake, Postgres, Databricks, MotherDuck and more connect by configuration.",href:qc.connections}];function _0e({href:e,children:t}){return m.jsx(mt,{component:"a",href:e,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary",textDecoration:"underline"},children:t})}function gCe({onClickEnvironment:e}){const{apiClients:t,mutable:n}=hr(),{data:r,isSuccess:o,isError:a,error:i}=To({queryKey:["environments"],queryFn:()=>t.environments.listEnvironments()});if(a)return m.jsx(Ma,{error:i,context:"Environments List"});if(!o)return m.jsx(va,{text:"Loading environments..."});const s=r.data??[];return m.jsxs(Qb,{maxWidth:"md",sx:{py:6},children:[m.jsxs(mt,{sx:{mb:5},children:[m.jsx(Ct,{variant:"h3",component:"h1",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Publisher"}),m.jsx(Ct,{variant:"body1",color:"text.secondary",sx:{mb:3},children:"The analytics engine for Malloy."}),m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{maxWidth:720,lineHeight:1.6},children:"One data model, served over MCP and REST to AI agents, applications and BI tools. Write down what your data means — the sources, the joins, the measures, who may see what — and every surface asks the same model, so the same question returns the same numbers tomorrow."})]}),m.jsx(ap,{container:!0,spacing:4,sx:{mb:5},children:F0e.map(c=>m.jsx(ap,{size:{xs:12,sm:6},children:m.jsxs(Wn,{spacing:1,children:[m.jsx(Ct,{variant:"body2",component:"a",href:c.href,target:"_blank",rel:"noopener noreferrer",sx:{fontWeight:500,color:"text.primary",textDecoration:"none","&:hover":{textDecoration:"underline"}},children:c.title}),m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{lineHeight:1.6},children:c.body})]})},c.title))}),m.jsx(pl,{sx:{my:4}}),s.length>0?m.jsx($s,{title:"Environments",count:s.length,description:"Published environments available on this server",...n?{action:m.jsx(Zj,{})}:{},children:m.jsx(Wn,{children:s.map(c=>m.jsx(U0e,{environment:c,...e?{onClickEnvironment:e}:{}},c.name))})}):m.jsxs(mt,{sx:{mb:4},children:[m.jsx(Ct,{variant:"h5",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Get started"}),m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{mb:3,maxWidth:600},children:"Create your first Malloy environment to start exploring semantic models and building data experiences."}),n?m.jsx(Zj,{}):m.jsx(tr,{variant:"contained",color:"primary",href:qc.publishing,target:"_blank",rel:"noopener noreferrer",children:"Learn how to create models"})]}),m.jsx(pl,{sx:{my:4}}),m.jsxs(Ct,{variant:"body2",color:"text.secondary",sx:{maxWidth:720,lineHeight:1.6,mt:2},children:["Join the"," ",m.jsx(_0e,{href:"https://join.slack.com/t/malloy-community/shared_invite/zt-1kgfwgi5g-CrsdaRqs81QY67QW0~t_uw",children:"Malloy Slack community"})," ","to ask questions, share ideas, and contribute."]})]})}function U0e({environment:e,onClickEnvironment:t}){const{mutable:n}=hr(),[r,o]=C.useState(null),a=!!r,i=R3(e.readme),s=f=>{f.stopPropagation(),o(f.currentTarget)},c=()=>o(null);return m.jsx(Zx,{icon:m.jsx(I0e,{sx:{fontSize:18}}),tint:XR.environment,label:e.name??"",ariaLabel:e.name??"",...i?{description:i}:{},...e.name&&t?{onClick:f=>t(`/${e.name}/`,f)}:{},...n?{trailingAction:m.jsxs(m.Fragment,{children:[m.jsx(xo,{size:"small",onClick:s,"aria-label":`Environment actions for ${e.name}`,children:m.jsx(vx,{fontSize:"small"})}),m.jsxs(nc,{anchorEl:r,open:a,onClose:c,onClick:f=>f.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[m.jsx(z0e,{environment:e,onCloseDialog:c}),m.jsx(L0e,{environment:e,onCloseDialog:c})]})]})}:{}})}var Kf={},ui={},zm={},Gf={},Jj={},eN;function B0e(){return eN||(eN=1,Object.defineProperty(Jj,"__esModule",{value:!0})),Jj}var Fm={},_m={},tN;function _d(){if(tN)return _m;tN=1,Object.defineProperty(_m,"__esModule",{value:!0}),_m.CronField=void 0;let e=class T3{#e=!1;#t=!1;#n=!1;#o=[];options={rawValue:""};static get min(){throw new Error("min must be overridden")}static get max(){throw new Error("max must be overridden")}static get chars(){return Object.freeze([])}static get validChars(){return/^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}static get constraints(){return{min:this.min,max:this.max,chars:this.chars,validChars:this.validChars}}constructor(n,r={rawValue:""}){if(!Array.isArray(n))throw new Error(`${this.constructor.name} Validation error, values is not an array`);if(!(n.length>0))throw new Error(`${this.constructor.name} Validation error, values contains no values`);this.options={...r,rawValue:r.rawValue??""},this.#o=n.sort(T3.sorter),this.#n=this.options.wildcard!==void 0?this.options.wildcard:this.#r(),this.#e=this.options.rawValue.includes("L")||n.includes("L"),this.#t=this.options.rawValue.includes("?")||n.includes("?")}get min(){return this.constructor.min}get max(){return this.constructor.max}get chars(){return this.constructor.chars}get hasLastChar(){return this.#e}get hasQuestionMarkChar(){return this.#t}get isWildcard(){return this.#n}get values(){return this.#o}static sorter(n,r){const o=typeof n=="number",a=typeof r=="number";return o&&a?n-r:!o&&!a?n.localeCompare(r):o?-1:1}static findNearestValueInList(n,r,o){if(o){for(let a=n.length-1;a>=0;a--)if(n[a]<r)return n[a];return null}for(let a=0;a<n.length;a++)if(n[a]>r)return n[a];return null}findNearestValue(n,r){return this.constructor.findNearestValueInList(this.values,n,r)}serialize(){return{wildcard:this.#n,values:this.#o}}validate(){let n;const r=this.chars.length>0?` or chars ${this.chars.join("")}`:"",o=s=>c=>new RegExp(`^\\d{0,2}${c}$`).test(s),a=s=>(n=s,typeof s=="number"?s>=this.min&&s<=this.max:this.chars.some(o(s)));if(!this.#o.every(a))throw new Error(`${this.constructor.name} Validation error, got value ${n} expected range ${this.min}-${this.max}${r}`);const i=this.#o.find((s,c)=>this.#o.indexOf(s)!==c);if(i)throw new Error(`${this.constructor.name} Validation error, duplicate values found: ${i}`)}#r(){return this.options.rawValue.length>0?["*","?"].includes(this.options.rawValue):Array.from({length:this.max-this.min+1},(n,r)=>r+this.min).every(n=>this.#o.includes(n))}};return _m.CronField=e,_m}var nN;function V0e(){if(nN)return Fm;nN=1,Object.defineProperty(Fm,"__esModule",{value:!0}),Fm.CronDayOfMonth=void 0;const e=_d(),t=1,n=31,r=Object.freeze(["L"]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}static get validChars(){return/^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return Fm.CronDayOfMonth=o,Fm}var Um={},rN;function H0e(){if(rN)return Um;rN=1,Object.defineProperty(Um,"__esModule",{value:!0}),Um.CronDayOfWeek=void 0;const e=_d(),t=0,n=7,r=Object.freeze(["L"]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}static get validChars(){return/^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}};return Um.CronDayOfWeek=o,Um}var Bm={},oN;function q0e(){if(oN)return Bm;oN=1,Object.defineProperty(Bm,"__esModule",{value:!0}),Bm.CronHour=void 0;const e=_d(),t=0,n=23,r=Object.freeze([]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return Bm.CronHour=o,Bm}var Vm={},aN;function W0e(){if(aN)return Vm;aN=1,Object.defineProperty(Vm,"__esModule",{value:!0}),Vm.CronMinute=void 0;const e=_d(),t=0,n=59,r=Object.freeze([]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return Vm.CronMinute=o,Vm}var Hm={},iN={},za={},sN;function Y0e(){if(sN)return za;sN=1,Object.defineProperty(za,"__esModule",{value:!0});class e extends Error{}class t extends e{constructor(M){super(`Invalid DateTime: ${M.toMessage()}`)}}class n extends e{constructor(M){super(`Invalid Interval: ${M.toMessage()}`)}}class r extends e{constructor(M){super(`Invalid Duration: ${M.toMessage()}`)}}class o extends e{}class a extends e{constructor(M){super(`Invalid unit ${M}`)}}class i extends e{}class s extends e{constructor(){super("Zone is an abstract class")}}const c="numeric",f="short",u="long",h={year:c,month:c,day:c},g={year:c,month:f,day:c},y={year:c,month:f,day:c,weekday:f},b={year:c,month:u,day:c},S={year:c,month:u,day:c,weekday:u},w={hour:c,minute:c},x={hour:c,minute:c,second:c},R={hour:c,minute:c,second:c,timeZoneName:f},k={hour:c,minute:c,second:c,timeZoneName:u},T={hour:c,minute:c,hourCycle:"h23"},O={hour:c,minute:c,second:c,hourCycle:"h23"},A={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:f},I={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:u},j={year:c,month:c,day:c,hour:c,minute:c},_={year:c,month:c,day:c,hour:c,minute:c,second:c},z={year:c,month:f,day:c,hour:c,minute:c},B={year:c,month:f,day:c,hour:c,minute:c,second:c},E={year:c,month:f,day:c,weekday:f,hour:c,minute:c},L={year:c,month:u,day:c,hour:c,minute:c,timeZoneName:f},N={year:c,month:u,day:c,hour:c,minute:c,second:c,timeZoneName:f},F={year:c,month:u,day:c,weekday:u,hour:c,minute:c,timeZoneName:u},D={year:c,month:u,day:c,weekday:u,hour:c,minute:c,second:c,timeZoneName:u};class W{get type(){throw new s}get name(){throw new s}get ianaName(){return this.name}get isUniversal(){throw new s}offsetName(M,V){throw new s}formatOffset(M,V){throw new s}offset(M){throw new s}equals(M){throw new s}get isValid(){throw new s}}let K=null;class ae extends W{static get instance(){return K===null&&(K=new ae),K}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(M,{format:V,locale:Q}){return mu(M,V,Q)}formatOffset(M,V){return Ns(this.offset(M),V)}offset(M){return-new Date(M).getTimezoneOffset()}equals(M){return M.type==="system"}get isValid(){return!0}}const Y=new Map;function re(q){let M=Y.get(q);return M===void 0&&(M=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:q,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Y.set(q,M)),M}const ue={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function X(q,M){const V=q.format(M).replace(/\u200E/g,""),Q=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(V),[,ie,Ce,De,Ue,Ye,Pt,Rn]=Q;return[De,ie,Ce,Ue,Ye,Pt,Rn]}function oe(q,M){const V=q.formatToParts(M),Q=[];for(let ie=0;ie<V.length;ie++){const{type:Ce,value:De}=V[ie],Ue=ue[Ce];Ce==="era"?Q[Ue]=De:Ve(Ue)||(Q[Ue]=parseInt(De,10))}return Q}const J=new Map;class ee extends W{static create(M){let V=J.get(M);return V===void 0&&J.set(M,V=new ee(M)),V}static resetCache(){J.clear(),Y.clear()}static isValidSpecifier(M){return this.isValidZone(M)}static isValidZone(M){if(!M)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:M}).format(),!0}catch{return!1}}constructor(M){super(),this.zoneName=M,this.valid=ee.isValidZone(M)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(M,{format:V,locale:Q}){return mu(M,V,Q,this.name)}formatOffset(M,V){return Ns(this.offset(M),V)}offset(M){if(!this.valid)return NaN;const V=new Date(M);if(isNaN(V))return NaN;const Q=re(this.name);let[ie,Ce,De,Ue,Ye,Pt,Rn]=Q.formatToParts?oe(Q,V):X(Q,V);Ue==="BC"&&(ie=-Math.abs(ie)+1);const Ln=Xa({year:ie,month:Ce,day:De,hour:Ye===24?0:Ye,minute:Pt,second:Rn,millisecond:0});let fr=+V;const Mn=fr%1e3;return fr-=Mn>=0?Mn:1e3+Mn,(Ln-fr)/(60*1e3)}equals(M){return M.type==="iana"&&M.name===this.name}get isValid(){return this.valid}}let te={};function de(q,M={}){const V=JSON.stringify([q,M]);let Q=te[V];return Q||(Q=new Intl.ListFormat(q,M),te[V]=Q),Q}const ce=new Map;function fe(q,M={}){const V=JSON.stringify([q,M]);let Q=ce.get(V);return Q===void 0&&(Q=new Intl.DateTimeFormat(q,M),ce.set(V,Q)),Q}const he=new Map;function me(q,M={}){const V=JSON.stringify([q,M]);let Q=he.get(V);return Q===void 0&&(Q=new Intl.NumberFormat(q,M),he.set(V,Q)),Q}const le=new Map;function be(q,M={}){const{base:V,...Q}=M,ie=JSON.stringify([q,Q]);let Ce=le.get(ie);return Ce===void 0&&(Ce=new Intl.RelativeTimeFormat(q,M),le.set(ie,Ce)),Ce}let Ie=null;function Ne(){return Ie||(Ie=new Intl.DateTimeFormat().resolvedOptions().locale,Ie)}const ge=new Map;function se(q){let M=ge.get(q);return M===void 0&&(M=new Intl.DateTimeFormat(q).resolvedOptions(),ge.set(q,M)),M}const Ge=new Map;function Ae(q){let M=Ge.get(q);if(!M){const V=new Intl.Locale(q);M="getWeekInfo"in V?V.getWeekInfo():V.weekInfo,"minimalDays"in M||(M={...He,...M}),Ge.set(q,M)}return M}function Qe(q){const M=q.indexOf("-x-");M!==-1&&(q=q.substring(0,M));const V=q.indexOf("-u-");if(V===-1)return[q];{let Q,ie;try{Q=fe(q).resolvedOptions(),ie=q}catch{const Ue=q.substring(0,V);Q=fe(Ue).resolvedOptions(),ie=Ue}const{numberingSystem:Ce,calendar:De}=Q;return[ie,Ce,De]}}function rt(q,M,V){return(V||M)&&(q.includes("-u-")||(q+="-u"),V&&(q+=`-ca-${V}`),M&&(q+=`-nu-${M}`)),q}function _t(q){const M=[];for(let V=1;V<=12;V++){const Q=Cn.utc(2009,V,1);M.push(q(Q))}return M}function Ut(q){const M=[];for(let V=1;V<=7;V++){const Q=Cn.utc(2016,11,13+V);M.push(q(Q))}return M}function ot(q,M,V,Q){const ie=q.listingMode();return ie==="error"?null:ie==="en"?V(M):Q(M)}function tt(q){return q.numberingSystem&&q.numberingSystem!=="latn"?!1:q.numberingSystem==="latn"||!q.locale||q.locale.startsWith("en")||se(q.locale).numberingSystem==="latn"}class ft{constructor(M,V,Q){this.padTo=Q.padTo||0,this.floor=Q.floor||!1;const{padTo:ie,floor:Ce,...De}=Q;if(!V||Object.keys(De).length>0){const Ue={useGrouping:!1,...Q};Q.padTo>0&&(Ue.minimumIntegerDigits=Q.padTo),this.inf=me(M,Ue)}}format(M){if(this.inf){const V=this.floor?Math.floor(M):M;return this.inf.format(V)}else{const V=this.floor?Math.floor(M):ds(M,3);return Zt(V,this.padTo)}}}class Le{constructor(M,V,Q){this.opts=Q,this.originalZone=void 0;let ie;if(this.opts.timeZone)this.dt=M;else if(M.zone.type==="fixed"){const De=-1*(M.offset/60),Ue=De>=0?`Etc/GMT+${De}`:`Etc/GMT${De}`;M.offset!==0&&ee.create(Ue).valid?(ie=Ue,this.dt=M):(ie="UTC",this.dt=M.offset===0?M:M.setZone("UTC").plus({minutes:M.offset}),this.originalZone=M.zone)}else M.zone.type==="system"?this.dt=M:M.zone.type==="iana"?(this.dt=M,ie=M.zone.name):(ie="UTC",this.dt=M.setZone("UTC").plus({minutes:M.offset}),this.originalZone=M.zone);const Ce={...this.opts};Ce.timeZone=Ce.timeZone||ie,this.dtf=fe(V,Ce)}format(){return this.originalZone?this.formatToParts().map(({value:M})=>M).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const M=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?M.map(V=>{if(V.type==="timeZoneName"){const Q=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...V,value:Q}}else return V}):M}resolvedOptions(){return this.dtf.resolvedOptions()}}class xe{constructor(M,V,Q){this.opts={style:"long",...Q},!V&&Me()&&(this.rtf=be(M,Q))}format(M,V){return this.rtf?this.rtf.format(M,V):fc(V,M,this.opts.numeric,this.opts.style!=="long")}formatToParts(M,V){return this.rtf?this.rtf.formatToParts(M,V):[]}}const He={firstDay:1,minimalDays:4,weekend:[6,7]};class $e{static fromOpts(M){return $e.create(M.locale,M.numberingSystem,M.outputCalendar,M.weekSettings,M.defaultToEN)}static create(M,V,Q,ie,Ce=!1){const De=M||an.defaultLocale,Ue=De||(Ce?"en-US":Ne()),Ye=V||an.defaultNumberingSystem,Pt=Q||an.defaultOutputCalendar,Rn=Jt(ie)||an.defaultWeekSettings;return new $e(Ue,Ye,Pt,Rn,De)}static resetCache(){Ie=null,ce.clear(),he.clear(),le.clear(),ge.clear(),Ge.clear()}static fromObject({locale:M,numberingSystem:V,outputCalendar:Q,weekSettings:ie}={}){return $e.create(M,V,Q,ie)}constructor(M,V,Q,ie,Ce){const[De,Ue,Ye]=Qe(M);this.locale=De,this.numberingSystem=V||Ue||null,this.outputCalendar=Q||Ye||null,this.weekSettings=ie,this.intl=rt(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=Ce,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=tt(this)),this.fastNumbersCached}listingMode(){const M=this.isEnglish(),V=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return M&&V?"en":"intl"}clone(M){return!M||Object.getOwnPropertyNames(M).length===0?this:$e.create(M.locale||this.specifiedLocale,M.numberingSystem||this.numberingSystem,M.outputCalendar||this.outputCalendar,Jt(M.weekSettings)||this.weekSettings,M.defaultToEN||!1)}redefaultToEN(M={}){return this.clone({...M,defaultToEN:!0})}redefaultToSystem(M={}){return this.clone({...M,defaultToEN:!1})}months(M,V=!1){return ot(this,M,kl,()=>{const Q=this.intl==="ja"||this.intl.startsWith("ja-");V&=!Q;const ie=V?{month:M,day:"numeric"}:{month:M},Ce=V?"format":"standalone";if(!this.monthsCache[Ce][M]){const De=Q?Ue=>this.dtFormatter(Ue,ie).format():Ue=>this.extract(Ue,ie,"month");this.monthsCache[Ce][M]=_t(De)}return this.monthsCache[Ce][M]})}weekdays(M,V=!1){return ot(this,M,hs,()=>{const Q=V?{weekday:M,year:"numeric",month:"long",day:"numeric"}:{weekday:M},ie=V?"format":"standalone";return this.weekdaysCache[ie][M]||(this.weekdaysCache[ie][M]=Ut(Ce=>this.extract(Ce,Q,"weekday"))),this.weekdaysCache[ie][M]})}meridiems(){return ot(this,void 0,()=>yu,()=>{if(!this.meridiemCache){const M={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Cn.utc(2016,11,13,9),Cn.utc(2016,11,13,19)].map(V=>this.extract(V,M,"dayperiod"))}return this.meridiemCache})}eras(M){return ot(this,M,Pa,()=>{const V={era:M};return this.eraCache[M]||(this.eraCache[M]=[Cn.utc(-40,1,1),Cn.utc(2017,1,1)].map(Q=>this.extract(Q,V,"era"))),this.eraCache[M]})}extract(M,V,Q){const ie=this.dtFormatter(M,V),Ce=ie.formatToParts(),De=Ce.find(Ue=>Ue.type.toLowerCase()===Q);return De?De.value:null}numberFormatter(M={}){return new ft(this.intl,M.forceSimple||this.fastNumbers,M)}dtFormatter(M,V={}){return new Le(M,this.intl,V)}relFormatter(M={}){return new xe(this.intl,this.isEnglish(),M)}listFormatter(M={}){return de(this.intl,M)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||se(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:ut()?Ae(this.locale):He}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(M){return this.locale===M.locale&&this.numberingSystem===M.numberingSystem&&this.outputCalendar===M.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let kt=null;class Rt extends W{static get utcInstance(){return kt===null&&(kt=new Rt(0)),kt}static instance(M){return M===0?Rt.utcInstance:new Rt(M)}static parseSpecifier(M){if(M){const V=M.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(V)return new Rt(wl(V[1],V[2]))}return null}constructor(M){super(),this.fixed=M}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Ns(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Ns(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(M,V){return Ns(this.fixed,V)}get isUniversal(){return!0}offset(){return this.fixed}equals(M){return M.type==="fixed"&&M.fixed===this.fixed}get isValid(){return!0}}class bt extends W{constructor(M){super(),this.zoneName=M}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function st(q,M){if(Ve(q)||q===null)return M;if(q instanceof W)return q;if(rn(q)){const V=q.toLowerCase();return V==="default"?M:V==="local"||V==="system"?ae.instance:V==="utc"||V==="gmt"?Rt.utcInstance:Rt.parseSpecifier(V)||ee.create(q)}else return At(q)?Rt.instance(q):typeof q=="object"&&"offset"in q&&typeof q.offset=="function"?q:new bt(q)}const ct={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Lt={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},en=ct.hanidec.replace(/[\[|\]]/g,"").split("");function En(q){let M=parseInt(q,10);if(isNaN(M)){M="";for(let V=0;V<q.length;V++){const Q=q.charCodeAt(V);if(q[V].search(ct.hanidec)!==-1)M+=en.indexOf(q[V]);else for(const ie in Lt){const[Ce,De]=Lt[ie];Q>=Ce&&Q<=De&&(M+=Q-Ce)}}return parseInt(M,10)}else return M}const $n=new Map;function Fn(){$n.clear()}function Wt({numberingSystem:q},M=""){const V=q||"latn";let Q=$n.get(V);Q===void 0&&(Q=new Map,$n.set(V,Q));let ie=Q.get(M);return ie===void 0&&(ie=new RegExp(`${ct[V]}${M}`),Q.set(M,ie)),ie}let Nn=()=>Date.now(),Re="system",Hn=null,On=null,tn=null,Dt=60,Fr,Bn=null;class an{static get now(){return Nn}static set now(M){Nn=M}static set defaultZone(M){Re=M}static get defaultZone(){return st(Re,ae.instance)}static get defaultLocale(){return Hn}static set defaultLocale(M){Hn=M}static get defaultNumberingSystem(){return On}static set defaultNumberingSystem(M){On=M}static get defaultOutputCalendar(){return tn}static set defaultOutputCalendar(M){tn=M}static get defaultWeekSettings(){return Bn}static set defaultWeekSettings(M){Bn=Jt(M)}static get twoDigitCutoffYear(){return Dt}static set twoDigitCutoffYear(M){Dt=M%100}static get throwOnInvalid(){return Fr}static set throwOnInvalid(M){Fr=M}static resetCaches(){$e.resetCache(),ee.resetCache(),Cn.resetCache(),Fn()}}class _n{constructor(M,V){this.reason=M,this.explanation=V}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Se=[0,31,59,90,120,151,181,212,243,273,304,334],Te=[0,31,60,91,121,152,182,213,244,274,305,335];function Fe(q,M){return new _n("unit out of range",`you specified ${M} (of type ${typeof M}) as a ${q}, which is invalid`)}function qe(q,M,V){const Q=new Date(Date.UTC(q,M-1,V));q<100&&q>=0&&Q.setUTCFullYear(Q.getUTCFullYear()-1900);const ie=Q.getUTCDay();return ie===0?7:ie}function at(q,M,V){return V+(ia(q)?Te:Se)[M-1]}function Tt(q,M){const V=ia(q)?Te:Se,Q=V.findIndex(Ce=>Ce<M),ie=M-V[Q];return{month:Q+1,day:ie}}function St(q,M){return(q-M+7)%7+1}function $t(q,M=4,V=1){const{year:Q,month:ie,day:Ce}=q,De=at(Q,ie,Ce),Ue=St(qe(Q,ie,Ce),V);let Ye=Math.floor((De-Ue+14-M)/7),Pt;return Ye<1?(Pt=Q-1,Ye=fs(Pt,M,V)):Ye>fs(Q,M,V)?(Pt=Q+1,Ye=1):Pt=Q,{weekYear:Pt,weekNumber:Ye,weekday:Ue,...Cl(q)}}function jt(q,M=4,V=1){const{weekYear:Q,weekNumber:ie,weekday:Ce}=q,De=St(qe(Q,1,M),V),Ue=dr(Q);let Ye=ie*7+Ce-De-7+M,Pt;Ye<1?(Pt=Q-1,Ye+=dr(Pt)):Ye>Ue?(Pt=Q+1,Ye-=dr(Q)):Pt=Q;const{month:Rn,day:Ln}=Tt(Pt,Ye);return{year:Pt,month:Rn,day:Ln,...Cl(q)}}function Qt(q){const{year:M,month:V,day:Q}=q,ie=at(M,V,Q);return{year:M,ordinal:ie,...Cl(q)}}function Nt(q){const{year:M,ordinal:V}=q,{month:Q,day:ie}=Tt(M,V);return{year:M,month:Q,day:ie,...Cl(q)}}function Vt(q,M){if(!Ve(q.localWeekday)||!Ve(q.localWeekNumber)||!Ve(q.localWeekYear)){if(!Ve(q.weekday)||!Ve(q.weekNumber)||!Ve(q.weekYear))throw new o("Cannot mix locale-based week fields with ISO-based week fields");return Ve(q.localWeekday)||(q.weekday=q.localWeekday),Ve(q.localWeekNumber)||(q.weekNumber=q.localWeekNumber),Ve(q.localWeekYear)||(q.weekYear=q.localWeekYear),delete q.localWeekday,delete q.localWeekNumber,delete q.localWeekYear,{minDaysInFirstWeek:M.getMinDaysInFirstWeek(),startOfWeek:M.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function ye(q,M=4,V=1){const Q=Kt(q.weekYear),ie=Tn(q.weekNumber,1,fs(q.weekYear,M,V)),Ce=Tn(q.weekday,1,7);return Q?ie?Ce?!1:Fe("weekday",q.weekday):Fe("week",q.weekNumber):Fe("weekYear",q.weekYear)}function ve(q){const M=Kt(q.year),V=Tn(q.ordinal,1,dr(q.year));return M?V?!1:Fe("ordinal",q.ordinal):Fe("year",q.year)}function _e(q){const M=Kt(q.year),V=Tn(q.month,1,12),Q=Tn(q.day,1,_r(q.year,q.month));return M?V?Q?!1:Fe("day",q.day):Fe("month",q.month):Fe("year",q.year)}function gt(q){const{hour:M,minute:V,second:Q,millisecond:ie}=q,Ce=Tn(M,0,23)||M===24&&V===0&&Q===0&&ie===0,De=Tn(V,0,59),Ue=Tn(Q,0,59),Ye=Tn(ie,0,999);return Ce?De?Ue?Ye?!1:Fe("millisecond",ie):Fe("second",Q):Fe("minute",V):Fe("hour",M)}function Ve(q){return typeof q>"u"}function At(q){return typeof q=="number"}function Kt(q){return typeof q=="number"&&q%1===0}function rn(q){return typeof q=="string"}function we(q){return Object.prototype.toString.call(q)==="[object Date]"}function Me(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function ut(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function wt(q){return Array.isArray(q)?q:[q]}function Mt(q,M,V){if(q.length!==0)return q.reduce((Q,ie)=>{const Ce=[M(ie),ie];return Q&&V(Q[0],Ce[0])===Q[0]?Q:Ce},null)[1]}function Ot(q,M){return M.reduce((V,Q)=>(V[Q]=q[Q],V),{})}function It(q,M){return Object.prototype.hasOwnProperty.call(q,M)}function Jt(q){if(q==null)return null;if(typeof q!="object")throw new i("Week settings must be an object");if(!Tn(q.firstDay,1,7)||!Tn(q.minimalDays,1,7)||!Array.isArray(q.weekend)||q.weekend.some(M=>!Tn(M,1,7)))throw new i("Invalid week settings");return{firstDay:q.firstDay,minimalDays:q.minimalDays,weekend:Array.from(q.weekend)}}function Tn(q,M,V){return Kt(q)&&q>=M&&q<=V}function rr(q,M){return q-M*Math.floor(q/M)}function Zt(q,M=2){const V=q<0;let Q;return V?Q="-"+(""+-q).padStart(M,"0"):Q=(""+q).padStart(M,"0"),Q}function Dr(q){if(!(Ve(q)||q===null||q===""))return parseInt(q,10)}function io(q){if(!(Ve(q)||q===null||q===""))return parseFloat(q)}function Po(q){if(!(Ve(q)||q===null||q==="")){const M=parseFloat("0."+q)*1e3;return Math.floor(M)}}function ds(q,M,V="round"){const Q=10**M;switch(V){case"expand":return q>0?Math.ceil(q*Q)/Q:Math.floor(q*Q)/Q;case"trunc":return Math.trunc(q*Q)/Q;case"round":return Math.round(q*Q)/Q;case"floor":return Math.floor(q*Q)/Q;case"ceil":return Math.ceil(q*Q)/Q;default:throw new RangeError(`Value rounding ${V} is out of range`)}}function ia(q){return q%4===0&&(q%100!==0||q%400===0)}function dr(q){return ia(q)?366:365}function _r(q,M){const V=rr(M-1,12)+1,Q=q+(M-V)/12;return V===2?ia(Q)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][V-1]}function Xa(q){let M=Date.UTC(q.year,q.month-1,q.day,q.hour,q.minute,q.second,q.millisecond);return q.year<100&&q.year>=0&&(M=new Date(M),M.setUTCFullYear(q.year,q.month-1,q.day)),+M}function Sl(q,M,V){return-St(qe(q,1,M),V)+M-1}function fs(q,M=4,V=1){const Q=Sl(q,M,V),ie=Sl(q+1,M,V);return(dr(q)-Q+ie)/7}function Pi(q){return q>99?q:q>an.twoDigitCutoffYear?1900+q:2e3+q}function mu(q,M,V,Q=null){const ie=new Date(q),Ce={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};Q&&(Ce.timeZone=Q);const De={timeZoneName:M,...Ce},Ue=new Intl.DateTimeFormat(V,De).formatToParts(ie).find(Ye=>Ye.type.toLowerCase()==="timezonename");return Ue?Ue.value:null}function wl(q,M){let V=parseInt(q,10);Number.isNaN(V)&&(V=0);const Q=parseInt(M,10)||0,ie=V<0||Object.is(V,-0)?-Q:Q;return V*60+ie}function ps(q){const M=Number(q);if(typeof q=="boolean"||q===""||!Number.isFinite(M))throw new i(`Invalid unit value ${q}`);return M}function cc(q,M){const V={};for(const Q in q)if(It(q,Q)){const ie=q[Q];if(ie==null)continue;V[M(Q)]=ps(ie)}return V}function Ns(q,M){const V=Math.trunc(Math.abs(q/60)),Q=Math.trunc(Math.abs(q%60)),ie=q>=0?"+":"-";switch(M){case"short":return`${ie}${Zt(V,2)}:${Zt(Q,2)}`;case"narrow":return`${ie}${V}${Q>0?`:${Q}`:""}`;case"techie":return`${ie}${Zt(V,2)}${Zt(Q,2)}`;default:throw new RangeError(`Value format ${M} is out of range for property format`)}}function Cl(q){return Ot(q,["hour","minute","second","millisecond"])}const gu=["January","February","March","April","May","June","July","August","September","October","November","December"],Ud=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],nh=["J","F","M","A","M","J","J","A","S","O","N","D"];function kl(q){switch(q){case"narrow":return[...nh];case"short":return[...Ud];case"long":return[...gu];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const uc=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],dc=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Is=["M","T","W","T","F","S","S"];function hs(q){switch(q){case"narrow":return[...Is];case"short":return[...dc];case"long":return[...uc];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const yu=["AM","PM"],vu=["Before Christ","Anno Domini"],Bd=["BC","AD"],Rl=["B","A"];function Pa(q){switch(q){case"narrow":return[...Rl];case"short":return[...Bd];case"long":return[...vu];default:return null}}function bu(q){return yu[q.hour<12?0:1]}function El(q,M){return hs(M)[q.weekday-1]}function Ai(q,M){return kl(M)[q.month-1]}function xu(q,M){return Pa(M)[q.year<0?0:1]}function fc(q,M,V="always",Q=!1){const ie={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},Ce=["hours","minutes","seconds"].indexOf(q)===-1;if(V==="auto"&&Ce){const Ln=q==="days";switch(M){case 1:return Ln?"tomorrow":`next ${ie[q][0]}`;case-1:return Ln?"yesterday":`last ${ie[q][0]}`;case 0:return Ln?"today":`this ${ie[q][0]}`}}const De=Object.is(M,-0)||M<0,Ue=Math.abs(M),Ye=Ue===1,Pt=ie[q],Rn=Q?Ye?Pt[1]:Pt[2]||Pt[1]:Ye?ie[q][0]:q;return De?`${Ue} ${Rn} ago`:`in ${Ue} ${Rn}`}function Su(q,M){let V="";for(const Q of q)Q.literal?V+=Q.val:V+=M(Q.val);return V}const pc={D:h,DD:g,DDD:b,DDDD:S,t:w,tt:x,ttt:R,tttt:k,T,TT:O,TTT:A,TTTT:I,f:j,ff:z,fff:L,ffff:F,F:_,FF:B,FFF:N,FFFF:D};class no{static create(M,V={}){return new no(M,V)}static parseFormat(M){let V=null,Q="",ie=!1;const Ce=[];for(let De=0;De<M.length;De++){const Ue=M.charAt(De);Ue==="'"?((Q.length>0||ie)&&Ce.push({literal:ie||/^\s+$/.test(Q),val:Q===""?"'":Q}),V=null,Q="",ie=!ie):ie||Ue===V?Q+=Ue:(Q.length>0&&Ce.push({literal:/^\s+$/.test(Q),val:Q}),Q=Ue,V=Ue)}return Q.length>0&&Ce.push({literal:ie||/^\s+$/.test(Q),val:Q}),Ce}static macroTokenToFormatOpts(M){return pc[M]}constructor(M,V){this.opts=V,this.loc=M,this.systemLoc=null}formatWithSystemDefault(M,V){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(M,{...this.opts,...V}).format()}dtFormatter(M,V={}){return this.loc.dtFormatter(M,{...this.opts,...V})}formatDateTime(M,V){return this.dtFormatter(M,V).format()}formatDateTimeParts(M,V){return this.dtFormatter(M,V).formatToParts()}formatInterval(M,V){return this.dtFormatter(M.start,V).dtf.formatRange(M.start.toJSDate(),M.end.toJSDate())}resolvedOptions(M,V){return this.dtFormatter(M,V).resolvedOptions()}num(M,V=0,Q=void 0){if(this.opts.forceSimple)return Zt(M,V);const ie={...this.opts};return V>0&&(ie.padTo=V),Q&&(ie.signDisplay=Q),this.loc.numberFormatter(ie).format(M)}formatDateTimeFromString(M,V){const Q=this.loc.listingMode()==="en",ie=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",Ce=(Mn,Qr)=>this.loc.extract(M,Mn,Qr),De=Mn=>M.isOffsetFixed&&M.offset===0&&Mn.allowZ?"Z":M.isValid?M.zone.formatOffset(M.ts,Mn.format):"",Ue=()=>Q?bu(M):Ce({hour:"numeric",hourCycle:"h12"},"dayperiod"),Ye=(Mn,Qr)=>Q?Ai(M,Mn):Ce(Qr?{month:Mn}:{month:Mn,day:"numeric"},"month"),Pt=(Mn,Qr)=>Q?El(M,Mn):Ce(Qr?{weekday:Mn}:{weekday:Mn,month:"long",day:"numeric"},"weekday"),Rn=Mn=>{const Qr=no.macroTokenToFormatOpts(Mn);return Qr?this.formatWithSystemDefault(M,Qr):Mn},Ln=Mn=>Q?xu(M,Mn):Ce({era:Mn},"era"),fr=Mn=>{switch(Mn){case"S":return this.num(M.millisecond);case"u":case"SSS":return this.num(M.millisecond,3);case"s":return this.num(M.second);case"ss":return this.num(M.second,2);case"uu":return this.num(Math.floor(M.millisecond/10),2);case"uuu":return this.num(Math.floor(M.millisecond/100));case"m":return this.num(M.minute);case"mm":return this.num(M.minute,2);case"h":return this.num(M.hour%12===0?12:M.hour%12);case"hh":return this.num(M.hour%12===0?12:M.hour%12,2);case"H":return this.num(M.hour);case"HH":return this.num(M.hour,2);case"Z":return De({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return De({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return De({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return M.zone.offsetName(M.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return M.zone.offsetName(M.ts,{format:"long",locale:this.loc.locale});case"z":return M.zoneName;case"a":return Ue();case"d":return ie?Ce({day:"numeric"},"day"):this.num(M.day);case"dd":return ie?Ce({day:"2-digit"},"day"):this.num(M.day,2);case"c":return this.num(M.weekday);case"ccc":return Pt("short",!0);case"cccc":return Pt("long",!0);case"ccccc":return Pt("narrow",!0);case"E":return this.num(M.weekday);case"EEE":return Pt("short",!1);case"EEEE":return Pt("long",!1);case"EEEEE":return Pt("narrow",!1);case"L":return ie?Ce({month:"numeric",day:"numeric"},"month"):this.num(M.month);case"LL":return ie?Ce({month:"2-digit",day:"numeric"},"month"):this.num(M.month,2);case"LLL":return Ye("short",!0);case"LLLL":return Ye("long",!0);case"LLLLL":return Ye("narrow",!0);case"M":return ie?Ce({month:"numeric"},"month"):this.num(M.month);case"MM":return ie?Ce({month:"2-digit"},"month"):this.num(M.month,2);case"MMM":return Ye("short",!1);case"MMMM":return Ye("long",!1);case"MMMMM":return Ye("narrow",!1);case"y":return ie?Ce({year:"numeric"},"year"):this.num(M.year);case"yy":return ie?Ce({year:"2-digit"},"year"):this.num(M.year.toString().slice(-2),2);case"yyyy":return ie?Ce({year:"numeric"},"year"):this.num(M.year,4);case"yyyyyy":return ie?Ce({year:"numeric"},"year"):this.num(M.year,6);case"G":return Ln("short");case"GG":return Ln("long");case"GGGGG":return Ln("narrow");case"kk":return this.num(M.weekYear.toString().slice(-2),2);case"kkkk":return this.num(M.weekYear,4);case"W":return this.num(M.weekNumber);case"WW":return this.num(M.weekNumber,2);case"n":return this.num(M.localWeekNumber);case"nn":return this.num(M.localWeekNumber,2);case"ii":return this.num(M.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(M.localWeekYear,4);case"o":return this.num(M.ordinal);case"ooo":return this.num(M.ordinal,3);case"q":return this.num(M.quarter);case"qq":return this.num(M.quarter,2);case"X":return this.num(Math.floor(M.ts/1e3));case"x":return this.num(M.ts);default:return Rn(Mn)}};return Su(no.parseFormat(V),fr)}formatDurationFromString(M,V){const Q=this.opts.signMode==="negativeLargestOnly"?-1:1,ie=Rn=>{switch(Rn[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},Ce=(Rn,Ln)=>fr=>{const Mn=ie(fr);if(Mn){const Qr=Ln.isNegativeDuration&&Mn!==Ln.largestUnit?Q:1;let Wo;return this.opts.signMode==="negativeLargestOnly"&&Mn!==Ln.largestUnit?Wo="never":this.opts.signMode==="all"?Wo="always":Wo="auto",this.num(Rn.get(Mn)*Qr,fr.length,Wo)}else return fr},De=no.parseFormat(V),Ue=De.reduce((Rn,{literal:Ln,val:fr})=>Ln?Rn:Rn.concat(fr),[]),Ye=M.shiftTo(...Ue.map(ie).filter(Rn=>Rn)),Pt={isNegativeDuration:Ye<0,largestUnit:Object.keys(Ye.values)[0]};return Su(De,Ce(Ye,Pt))}}const wu=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function U(...q){const M=q.reduce((V,Q)=>V+Q.source,"");return RegExp(`^${M}$`)}function So(...q){return M=>q.reduce(([V,Q,ie],Ce)=>{const[De,Ue,Ye]=Ce(M,ie);return[{...V,...De},Ue||Q,Ye]},[{},null,1]).slice(0,2)}function ro(q,...M){if(q==null)return[null,null];for(const[V,Q]of M){const ie=V.exec(q);if(ie)return Q(ie)}return[null,null]}function Za(...q){return(M,V)=>{const Q={};let ie;for(ie=0;ie<q.length;ie++)Q[q[ie]]=Dr(M[V+ie]);return[Q,null,V+ie]}}const Oe=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,ms=`(?:${Oe.source}?(?:\\[(${wu.source})\\])?)?`,In=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,qo=RegExp(`${In.source}${ms}`),Ls=RegExp(`(?:[Tt]${qo.source})?`),Cu=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Vd=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Hd=/(\d{4})-?(\d{3})/,nt=Za("weekYear","weekNumber","weekDay"),ku=Za("year","ordinal"),Ru=/(\d{4})-(\d\d)-(\d\d)/,hc=RegExp(`${In.source} ?(?:${Oe.source}|(${wu.source}))?`),qd=RegExp(`(?: ${hc.source})?`);function zs(q,M,V){const Q=q[M];return Ve(Q)?V:Dr(Q)}function Tl(q,M){return[{year:zs(q,M),month:zs(q,M+1,1),day:zs(q,M+2,1)},null,M+3]}function gs(q,M){return[{hours:zs(q,M,0),minutes:zs(q,M+1,0),seconds:zs(q,M+2,0),milliseconds:Po(q[M+3])},null,M+4]}function Fs(q,M){const V=!q[M]&&!q[M+1],Q=wl(q[M+1],q[M+2]),ie=V?null:Rt.instance(Q);return[{},ie,M+3]}function sa(q,M){const V=q[M]?ee.create(q[M]):null;return[{},V,M+1]}const rh=RegExp(`^T?${In.source}$`),oh=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function $l(q){const[M,V,Q,ie,Ce,De,Ue,Ye,Pt]=q,Rn=M[0]==="-",Ln=Ye&&Ye[0]==="-",fr=(Mn,Qr=!1)=>Mn!==void 0&&(Qr||Mn&&Rn)?-Mn:Mn;return[{years:fr(io(V)),months:fr(io(Q)),weeks:fr(io(ie)),days:fr(io(Ce)),hours:fr(io(De)),minutes:fr(io(Ue)),seconds:fr(io(Ye),Ye==="-0"),milliseconds:fr(Po(Pt),Ln)}]}const Wd={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Eu(q,M,V,Q,ie,Ce,De){const Ue={year:M.length===2?Pi(Dr(M)):Dr(M),month:Ud.indexOf(V)+1,day:Dr(Q),hour:Dr(ie),minute:Dr(Ce)};return De&&(Ue.second=Dr(De)),q&&(Ue.weekday=q.length>3?uc.indexOf(q)+1:dc.indexOf(q)+1),Ue}const ah=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Yd(q){const[,M,V,Q,ie,Ce,De,Ue,Ye,Pt,Rn,Ln]=q,fr=Eu(M,ie,Q,V,Ce,De,Ue);let Mn;return Ye?Mn=Wd[Ye]:Pt?Mn=0:Mn=wl(Rn,Ln),[fr,new Rt(Mn)]}function ih(q){return q.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const Kd=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Tu=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,sh=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function mc(q){const[,M,V,Q,ie,Ce,De,Ue]=q;return[Eu(M,ie,Q,V,Ce,De,Ue),Rt.utcInstance]}function lh(q){const[,M,V,Q,ie,Ce,De,Ue]=q;return[Eu(M,Ue,V,Q,ie,Ce,De),Rt.utcInstance]}const ch=U(Cu,Ls),uh=U(Vd,Ls),dh=U(Hd,Ls),$u=U(qo),_s=So(Tl,gs,Fs,sa),fh=So(nt,gs,Fs,sa),Gd=So(ku,gs,Fs,sa),Qd=So(gs,Fs,sa);function Xd(q){return ro(q,[ch,_s],[uh,fh],[dh,Gd],[$u,Qd])}function Zd(q){return ro(ih(q),[ah,Yd])}function Jd(q){return ro(q,[Kd,mc],[Tu,mc],[sh,lh])}function Us(q){return ro(q,[oh,$l])}const ph=So(gs);function hh(q){return ro(q,[rh,ph])}const mh=U(Ru,qd),ef=U(hc),tf=So(gs,Fs,sa);function Ml(q){return ro(q,[mh,_s],[ef,tf])}const or="Invalid Duration",ys={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Gr={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...ys},H=146097/400,Z=146097/4800,G={years:{quarters:4,months:12,weeks:H/7,days:H,hours:H*24,minutes:H*24*60,seconds:H*24*60*60,milliseconds:H*24*60*60*1e3},quarters:{months:3,weeks:H/28,days:H/4,hours:H*24/4,minutes:H*24*60/4,seconds:H*24*60*60/4,milliseconds:H*24*60*60*1e3/4},months:{weeks:Z/7,days:Z,hours:Z*24,minutes:Z*24*60,seconds:Z*24*60*60,milliseconds:Z*24*60*60*1e3},...ys},Ee=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Xt=Ee.slice(0).reverse();function Yt(q,M,V=!1){const Q={values:V?M.values:{...q.values,...M.values||{}},loc:q.loc.clone(M.loc),conversionAccuracy:M.conversionAccuracy||q.conversionAccuracy,matrix:M.matrix||q.matrix};return new Gt(Q)}function Pn(q,M){var V;let Q=(V=M.milliseconds)!=null?V:0;for(const ie of Xt.slice(1))M[ie]&&(Q+=M[ie]*q[ie].milliseconds);return Q}function Gn(q,M){const V=Pn(q,M)<0?-1:1;Ee.reduceRight((Q,ie)=>{if(Ve(M[ie]))return Q;if(Q){const Ce=M[Q]*V,De=q[ie][Q],Ue=Math.floor(Ce/De);M[ie]+=Ue*V,M[Q]-=Ue*De*V}return ie},null),Ee.reduce((Q,ie)=>{if(Ve(M[ie]))return Q;if(Q){const Ce=M[Q]%1;M[Q]-=Ce,M[ie]+=Ce*q[Q][ie]}return ie},null)}function Qn(q){const M={};for(const[V,Q]of Object.entries(q))Q!==0&&(M[V]=Q);return M}class Gt{constructor(M){const V=M.conversionAccuracy==="longterm"||!1;let Q=V?G:Gr;M.matrix&&(Q=M.matrix),this.values=M.values,this.loc=M.loc||$e.create(),this.conversionAccuracy=V?"longterm":"casual",this.invalid=M.invalid||null,this.matrix=Q,this.isLuxonDuration=!0}static fromMillis(M,V){return Gt.fromObject({milliseconds:M},V)}static fromObject(M,V={}){if(M==null||typeof M!="object")throw new i(`Duration.fromObject: argument expected to be an object, got ${M===null?"null":typeof M}`);return new Gt({values:cc(M,Gt.normalizeUnit),loc:$e.fromObject(V),conversionAccuracy:V.conversionAccuracy,matrix:V.matrix})}static fromDurationLike(M){if(At(M))return Gt.fromMillis(M);if(Gt.isDuration(M))return M;if(typeof M=="object")return Gt.fromObject(M);throw new i(`Unknown duration argument ${M} of type ${typeof M}`)}static fromISO(M,V){const[Q]=Us(M);return Q?Gt.fromObject(Q,V):Gt.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static fromISOTime(M,V){const[Q]=hh(M);return Q?Gt.fromObject(Q,V):Gt.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static invalid(M,V=null){if(!M)throw new i("need to specify a reason the Duration is invalid");const Q=M instanceof _n?M:new _n(M,V);if(an.throwOnInvalid)throw new r(Q);return new Gt({invalid:Q})}static normalizeUnit(M){const V={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[M&&M.toLowerCase()];if(!V)throw new a(M);return V}static isDuration(M){return M&&M.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(M,V={}){const Q={...V,floor:V.round!==!1&&V.floor!==!1};return this.isValid?no.create(this.loc,Q).formatDurationFromString(this,M):or}toHuman(M={}){if(!this.isValid)return or;const V=M.showZeros!==!1,Q=Ee.map(ie=>{const Ce=this.values[ie];return Ve(Ce)||Ce===0&&!V?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...M,unit:ie.slice(0,-1)}).format(Ce)}).filter(ie=>ie);return this.loc.listFormatter({type:"conjunction",style:M.listStyle||"narrow",...M}).format(Q)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let M="P";return this.years!==0&&(M+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(M+=this.months+this.quarters*3+"M"),this.weeks!==0&&(M+=this.weeks+"W"),this.days!==0&&(M+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(M+="T"),this.hours!==0&&(M+=this.hours+"H"),this.minutes!==0&&(M+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(M+=ds(this.seconds+this.milliseconds/1e3,3)+"S"),M==="P"&&(M+="T0S"),M}toISOTime(M={}){if(!this.isValid)return null;const V=this.toMillis();return V<0||V>=864e5?null:(M={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...M,includeOffset:!1},Cn.fromMillis(V,{zone:"UTC"}).toISOTime(M))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?Pn(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(M){if(!this.isValid)return this;const V=Gt.fromDurationLike(M),Q={};for(const ie of Ee)(It(V.values,ie)||It(this.values,ie))&&(Q[ie]=V.get(ie)+this.get(ie));return Yt(this,{values:Q},!0)}minus(M){if(!this.isValid)return this;const V=Gt.fromDurationLike(M);return this.plus(V.negate())}mapUnits(M){if(!this.isValid)return this;const V={};for(const Q of Object.keys(this.values))V[Q]=ps(M(this.values[Q],Q));return Yt(this,{values:V},!0)}get(M){return this[Gt.normalizeUnit(M)]}set(M){if(!this.isValid)return this;const V={...this.values,...cc(M,Gt.normalizeUnit)};return Yt(this,{values:V})}reconfigure({locale:M,numberingSystem:V,conversionAccuracy:Q,matrix:ie}={}){const Ce={loc:this.loc.clone({locale:M,numberingSystem:V}),matrix:ie,conversionAccuracy:Q};return Yt(this,Ce)}as(M){return this.isValid?this.shiftTo(M).get(M):NaN}normalize(){if(!this.isValid)return this;const M=this.toObject();return Gn(this.matrix,M),Yt(this,{values:M},!0)}rescale(){if(!this.isValid)return this;const M=Qn(this.normalize().shiftToAll().toObject());return Yt(this,{values:M},!0)}shiftTo(...M){if(!this.isValid)return this;if(M.length===0)return this;M=M.map(De=>Gt.normalizeUnit(De));const V={},Q={},ie=this.toObject();let Ce;for(const De of Ee)if(M.indexOf(De)>=0){Ce=De;let Ue=0;for(const Pt in Q)Ue+=this.matrix[Pt][De]*Q[Pt],Q[Pt]=0;At(ie[De])&&(Ue+=ie[De]);const Ye=Math.trunc(Ue);V[De]=Ye,Q[De]=(Ue*1e3-Ye*1e3)/1e3}else At(ie[De])&&(Q[De]=ie[De]);for(const De in Q)Q[De]!==0&&(V[Ce]+=De===Ce?Q[De]:Q[De]/this.matrix[Ce][De]);return Gn(this.matrix,V),Yt(this,{values:V},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const M={};for(const V of Object.keys(this.values))M[V]=this.values[V]===0?0:-this.values[V];return Yt(this,{values:M},!0)}removeZeros(){if(!this.isValid)return this;const M=Qn(this.values);return Yt(this,{values:M},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(M){if(!this.isValid||!M.isValid||!this.loc.equals(M.loc))return!1;function V(Q,ie){return Q===void 0||Q===0?ie===void 0||ie===0:Q===ie}for(const Q of Ee)if(!V(this.values[Q],M.values[Q]))return!1;return!0}}const kr="Invalid Interval";function Rr(q,M){return!q||!q.isValid?cn.invalid("missing or invalid start"):!M||!M.isValid?cn.invalid("missing or invalid end"):M<q?cn.invalid("end before start",`The end of an interval must be after its start, but you had start=${q.toISO()} and end=${M.toISO()}`):null}class cn{constructor(M){this.s=M.start,this.e=M.end,this.invalid=M.invalid||null,this.isLuxonInterval=!0}static invalid(M,V=null){if(!M)throw new i("need to specify a reason the Interval is invalid");const Q=M instanceof _n?M:new _n(M,V);if(an.throwOnInvalid)throw new n(Q);return new cn({invalid:Q})}static fromDateTimes(M,V){const Q=oi(M),ie=oi(V);return Rr(Q,ie)??new cn({start:Q,end:ie})}static after(M,V){const Q=Gt.fromDurationLike(V),ie=oi(M);return cn.fromDateTimes(ie,ie.plus(Q))}static before(M,V){const Q=Gt.fromDurationLike(V),ie=oi(M);return cn.fromDateTimes(ie.minus(Q),ie)}static fromISO(M,V){const[Q,ie]=(M||"").split("/",2);if(Q&&ie){let Ce,De;try{Ce=Cn.fromISO(Q,V),De=Ce.isValid}catch{De=!1}let Ue,Ye;try{Ue=Cn.fromISO(ie,V),Ye=Ue.isValid}catch{Ye=!1}if(De&&Ye)return cn.fromDateTimes(Ce,Ue);if(De){const Pt=Gt.fromISO(ie,V);if(Pt.isValid)return cn.after(Ce,Pt)}else if(Ye){const Pt=Gt.fromISO(Q,V);if(Pt.isValid)return cn.before(Ue,Pt)}}return cn.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static isInterval(M){return M&&M.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(M="milliseconds"){return this.isValid?this.toDuration(M).get(M):NaN}count(M="milliseconds",V){if(!this.isValid)return NaN;const Q=this.start.startOf(M,V);let ie;return V!=null&&V.useLocaleWeeks?ie=this.end.reconfigure({locale:Q.locale}):ie=this.end,ie=ie.startOf(M,V),Math.floor(ie.diff(Q,M).get(M))+(ie.valueOf()!==this.end.valueOf())}hasSame(M){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,M):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(M){return this.isValid?this.s>M:!1}isBefore(M){return this.isValid?this.e<=M:!1}contains(M){return this.isValid?this.s<=M&&this.e>M:!1}set({start:M,end:V}={}){return this.isValid?cn.fromDateTimes(M||this.s,V||this.e):this}splitAt(...M){if(!this.isValid)return[];const V=M.map(oi).filter(De=>this.contains(De)).sort((De,Ue)=>De.toMillis()-Ue.toMillis()),Q=[];let{s:ie}=this,Ce=0;for(;ie<this.e;){const De=V[Ce]||this.e,Ue=+De>+this.e?this.e:De;Q.push(cn.fromDateTimes(ie,Ue)),ie=Ue,Ce+=1}return Q}splitBy(M){const V=Gt.fromDurationLike(M);if(!this.isValid||!V.isValid||V.as("milliseconds")===0)return[];let{s:Q}=this,ie=1,Ce;const De=[];for(;Q<this.e;){const Ue=this.start.plus(V.mapUnits(Ye=>Ye*ie));Ce=+Ue>+this.e?this.e:Ue,De.push(cn.fromDateTimes(Q,Ce)),Q=Ce,ie+=1}return De}divideEqually(M){return this.isValid?this.splitBy(this.length()/M).slice(0,M):[]}overlaps(M){return this.e>M.s&&this.s<M.e}abutsStart(M){return this.isValid?+this.e==+M.s:!1}abutsEnd(M){return this.isValid?+M.e==+this.s:!1}engulfs(M){return this.isValid?this.s<=M.s&&this.e>=M.e:!1}equals(M){return!this.isValid||!M.isValid?!1:this.s.equals(M.s)&&this.e.equals(M.e)}intersection(M){if(!this.isValid)return this;const V=this.s>M.s?this.s:M.s,Q=this.e<M.e?this.e:M.e;return V>=Q?null:cn.fromDateTimes(V,Q)}union(M){if(!this.isValid)return this;const V=this.s<M.s?this.s:M.s,Q=this.e>M.e?this.e:M.e;return cn.fromDateTimes(V,Q)}static merge(M){const[V,Q]=M.sort((ie,Ce)=>ie.s-Ce.s).reduce(([ie,Ce],De)=>Ce?Ce.overlaps(De)||Ce.abutsStart(De)?[ie,Ce.union(De)]:[ie.concat([Ce]),De]:[ie,De],[[],null]);return Q&&V.push(Q),V}static xor(M){let V=null,Q=0;const ie=[],Ce=M.map(Ye=>[{time:Ye.s,type:"s"},{time:Ye.e,type:"e"}]),De=Array.prototype.concat(...Ce),Ue=De.sort((Ye,Pt)=>Ye.time-Pt.time);for(const Ye of Ue)Q+=Ye.type==="s"?1:-1,Q===1?V=Ye.time:(V&&+V!=+Ye.time&&ie.push(cn.fromDateTimes(V,Ye.time)),V=null);return cn.merge(ie)}difference(...M){return cn.xor([this].concat(M)).map(V=>this.intersection(V)).filter(V=>V&&!V.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:kr}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(M=h,V={}){return this.isValid?no.create(this.s.loc.clone(V),M).formatInterval(this):kr}toISO(M){return this.isValid?`${this.s.toISO(M)}/${this.e.toISO(M)}`:kr}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:kr}toISOTime(M){return this.isValid?`${this.s.toISOTime(M)}/${this.e.toISOTime(M)}`:kr}toFormat(M,{separator:V=" – "}={}){return this.isValid?`${this.s.toFormat(M)}${V}${this.e.toFormat(M)}`:kr}toDuration(M,V){return this.isValid?this.e.diff(this.s,M,V):Gt.invalid(this.invalidReason)}mapEndpoints(M){return cn.fromDateTimes(M(this.s),M(this.e))}}class vr{static hasDST(M=an.defaultZone){const V=Cn.now().setZone(M).set({month:12});return!M.isUniversal&&V.offset!==V.set({month:6}).offset}static isValidIANAZone(M){return ee.isValidZone(M)}static normalizeZone(M){return st(M,an.defaultZone)}static getStartOfWeek({locale:M=null,locObj:V=null}={}){return(V||$e.create(M)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:M=null,locObj:V=null}={}){return(V||$e.create(M)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:M=null,locObj:V=null}={}){return(V||$e.create(M)).getWeekendDays().slice()}static months(M="long",{locale:V=null,numberingSystem:Q=null,locObj:ie=null,outputCalendar:Ce="gregory"}={}){return(ie||$e.create(V,Q,Ce)).months(M)}static monthsFormat(M="long",{locale:V=null,numberingSystem:Q=null,locObj:ie=null,outputCalendar:Ce="gregory"}={}){return(ie||$e.create(V,Q,Ce)).months(M,!0)}static weekdays(M="long",{locale:V=null,numberingSystem:Q=null,locObj:ie=null}={}){return(ie||$e.create(V,Q,null)).weekdays(M)}static weekdaysFormat(M="long",{locale:V=null,numberingSystem:Q=null,locObj:ie=null}={}){return(ie||$e.create(V,Q,null)).weekdays(M,!0)}static meridiems({locale:M=null}={}){return $e.create(M).meridiems()}static eras(M="short",{locale:V=null}={}){return $e.create(V,null,"gregory").eras(M)}static features(){return{relative:Me(),localeWeek:ut()}}}function Vr(q,M){const V=ie=>ie.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),Q=V(M)-V(q);return Math.floor(Gt.fromMillis(Q).as("days"))}function Wr(q,M,V){const Q=[["years",(Ye,Pt)=>Pt.year-Ye.year],["quarters",(Ye,Pt)=>Pt.quarter-Ye.quarter+(Pt.year-Ye.year)*4],["months",(Ye,Pt)=>Pt.month-Ye.month+(Pt.year-Ye.year)*12],["weeks",(Ye,Pt)=>{const Rn=Vr(Ye,Pt);return(Rn-Rn%7)/7}],["days",Vr]],ie={},Ce=q;let De,Ue;for(const[Ye,Pt]of Q)V.indexOf(Ye)>=0&&(De=Ye,ie[Ye]=Pt(q,M),Ue=Ce.plus(ie),Ue>M?(ie[Ye]--,q=Ce.plus(ie),q>M&&(Ue=q,ie[Ye]--,q=Ce.plus(ie))):q=Ue);return[q,ie,Ue,De]}function Ja(q,M,V,Q){let[ie,Ce,De,Ue]=Wr(q,M,V);const Ye=M-ie,Pt=V.filter(Ln=>["hours","minutes","seconds","milliseconds"].indexOf(Ln)>=0);Pt.length===0&&(De<M&&(De=ie.plus({[Ue]:1})),De!==ie&&(Ce[Ue]=(Ce[Ue]||0)+Ye/(De-ie)));const Rn=Gt.fromObject(Ce,Q);return Pt.length>0?Gt.fromMillis(Ye,Q).shiftTo(...Pt).plus(Rn):Rn}const ba="missing Intl.DateTimeFormat.formatToParts support";function Un(q,M=V=>V){return{regex:q,deser:([V])=>M(En(V))}}const Ol="[  ]",xa=new RegExp(Ol,"g");function vs(q){return q.replace(/\./g,"\\.?").replace(xa,Ol)}function la(q){return q.replace(/\./g,"").replace(xa," ").toLowerCase()}function oo(q,M){return q===null?null:{regex:RegExp(q.map(vs).join("|")),deser:([V])=>q.findIndex(Q=>la(V)===la(Q))+M}}function Pl(q,M){return{regex:q,deser:([,V,Q])=>wl(V,Q),groups:M}}function wo(q){return{regex:q,deser:([M])=>M}}function gc(q){return q.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function gh(q,M){const V=Wt(M),Q=Wt(M,"{2}"),ie=Wt(M,"{3}"),Ce=Wt(M,"{4}"),De=Wt(M,"{6}"),Ue=Wt(M,"{1,2}"),Ye=Wt(M,"{1,3}"),Pt=Wt(M,"{1,6}"),Rn=Wt(M,"{1,9}"),Ln=Wt(M,"{2,4}"),fr=Wt(M,"{4,6}"),Mn=Wo=>({regex:RegExp(gc(Wo.val)),deser:([Aa])=>Aa,literal:!0}),Qr=(Wo=>{if(q.literal)return Mn(Wo);switch(Wo.val){case"G":return oo(M.eras("short"),0);case"GG":return oo(M.eras("long"),0);case"y":return Un(Pt);case"yy":return Un(Ln,Pi);case"yyyy":return Un(Ce);case"yyyyy":return Un(fr);case"yyyyyy":return Un(De);case"M":return Un(Ue);case"MM":return Un(Q);case"MMM":return oo(M.months("short",!0),1);case"MMMM":return oo(M.months("long",!0),1);case"L":return Un(Ue);case"LL":return Un(Q);case"LLL":return oo(M.months("short",!1),1);case"LLLL":return oo(M.months("long",!1),1);case"d":return Un(Ue);case"dd":return Un(Q);case"o":return Un(Ye);case"ooo":return Un(ie);case"HH":return Un(Q);case"H":return Un(Ue);case"hh":return Un(Q);case"h":return Un(Ue);case"mm":return Un(Q);case"m":return Un(Ue);case"q":return Un(Ue);case"qq":return Un(Q);case"s":return Un(Ue);case"ss":return Un(Q);case"S":return Un(Ye);case"SSS":return Un(ie);case"u":return wo(Rn);case"uu":return wo(Ue);case"uuu":return Un(V);case"a":return oo(M.meridiems(),0);case"kkkk":return Un(Ce);case"kk":return Un(Ln,Pi);case"W":return Un(Ue);case"WW":return Un(Q);case"E":case"c":return Un(V);case"EEE":return oo(M.weekdays("short",!1),1);case"EEEE":return oo(M.weekdays("long",!1),1);case"ccc":return oo(M.weekdays("short",!0),1);case"cccc":return oo(M.weekdays("long",!0),1);case"Z":case"ZZ":return Pl(new RegExp(`([+-]${Ue.source})(?::(${Q.source}))?`),2);case"ZZZ":return Pl(new RegExp(`([+-]${Ue.source})(${Q.source})?`),2);case"z":return wo(/[a-z_+-/]{1,256}?/i);case" ":return wo(/[^\S\n\r]/);default:return Mn(Wo)}})(q)||{invalidReason:ba};return Qr.token=q,Qr}const Oy={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Al(q,M,V){const{type:Q,value:ie}=q;if(Q==="literal"){const Ye=/^\s+$/.test(ie);return{literal:!Ye,val:Ye?" ":ie}}const Ce=M[Q];let De=Q;Q==="hour"&&(M.hour12!=null?De=M.hour12?"hour12":"hour24":M.hourCycle!=null?M.hourCycle==="h11"||M.hourCycle==="h12"?De="hour12":De="hour24":De=V.hour12?"hour12":"hour24");let Ue=Oy[De];if(typeof Ue=="object"&&(Ue=Ue[Ce]),Ue)return{literal:!1,val:Ue}}function Py(q){return[`^${q.map(M=>M.regex).reduce((M,V)=>`${M}(${V.source})`,"")}$`,q]}function Ay(q,M,V){const Q=q.match(M);if(Q){const ie={};let Ce=1;for(const De in V)if(It(V,De)){const Ue=V[De],Ye=Ue.groups?Ue.groups+1:1;!Ue.literal&&Ue.token&&(ie[Ue.token.val[0]]=Ue.deser(Q.slice(Ce,Ce+Ye))),Ce+=Ye}return[Q,ie]}else return[Q,{}]}function Dy(q){const M=ie=>{switch(ie){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let V=null,Q;return Ve(q.z)||(V=ee.create(q.z)),Ve(q.Z)||(V||(V=new Rt(q.Z)),Q=q.Z),Ve(q.q)||(q.M=(q.q-1)*3+1),Ve(q.h)||(q.h<12&&q.a===1?q.h+=12:q.h===12&&q.a===0&&(q.h=0)),q.G===0&&q.y&&(q.y=-q.y),Ve(q.u)||(q.S=Po(q.u)),[Object.keys(q).reduce((ie,Ce)=>{const De=M(Ce);return De&&(ie[De]=q[Ce]),ie},{}),V,Q]}let yh=null;function e1(){return yh||(yh=Cn.fromMillis(1555555555555)),yh}function t1(q,M){if(q.literal)return q;const V=no.macroTokenToFormatOpts(q.val),Q=xh(V,M);return Q==null||Q.includes(void 0)?q:Q}function vh(q,M){return Array.prototype.concat(...q.map(V=>t1(V,M)))}class bh{constructor(M,V){if(this.locale=M,this.format=V,this.tokens=vh(no.parseFormat(V),M),this.units=this.tokens.map(Q=>gh(Q,M)),this.disqualifyingUnit=this.units.find(Q=>Q.invalidReason),!this.disqualifyingUnit){const[Q,ie]=Py(this.units);this.regex=RegExp(Q,"i"),this.handlers=ie}}explainFromTokens(M){if(this.isValid){const[V,Q]=Ay(M,this.regex,this.handlers),[ie,Ce,De]=Q?Dy(Q):[null,null,void 0];if(It(Q,"a")&&It(Q,"H"))throw new o("Can't include meridiem when specifying 24-hour format");return{input:M,tokens:this.tokens,regex:this.regex,rawMatches:V,matches:Q,result:ie,zone:Ce,specificOffset:De}}else return{input:M,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function nf(q,M,V){return new bh(q,V).explainFromTokens(M)}function ei(q,M,V){const{result:Q,zone:ie,specificOffset:Ce,invalidReason:De}=nf(q,M,V);return[Q,ie,Ce,De]}function xh(q,M){if(!q)return null;const V=no.create(M,q).dtFormatter(e1()),Q=V.formatToParts(),ie=V.resolvedOptions();return Q.map(Ce=>Al(Ce,q,ie))}const ca="Invalid DateTime",Sa=864e13;function Di(q){return new _n("unsupported zone",`the zone "${q.name}" is not supported`)}function Mu(q){return q.weekData===null&&(q.weekData=$t(q.c)),q.weekData}function yc(q){return q.localWeekData===null&&(q.localWeekData=$t(q.c,q.loc.getMinDaysInFirstWeek(),q.loc.getStartOfWeek())),q.localWeekData}function ji(q,M){const V={ts:q.ts,zone:q.zone,c:q.c,o:q.o,loc:q.loc,invalid:q.invalid};return new Cn({...V,...M,old:V})}function rf(q,M,V){let Q=q-M*60*1e3;const ie=V.offset(Q);if(M===ie)return[Q,M];Q-=(ie-M)*60*1e3;const Ce=V.offset(Q);return ie===Ce?[Q,ie]:[q-Math.min(ie,Ce)*60*1e3,Math.max(ie,Ce)]}function bs(q,M){q+=M*60*1e3;const V=new Date(q);return{year:V.getUTCFullYear(),month:V.getUTCMonth()+1,day:V.getUTCDate(),hour:V.getUTCHours(),minute:V.getUTCMinutes(),second:V.getUTCSeconds(),millisecond:V.getUTCMilliseconds()}}function Ou(q,M,V){return rf(Xa(q),M,V)}function Pu(q,M){const V=q.o,Q=q.c.year+Math.trunc(M.years),ie=q.c.month+Math.trunc(M.months)+Math.trunc(M.quarters)*3,Ce={...q.c,year:Q,month:ie,day:Math.min(q.c.day,_r(Q,ie))+Math.trunc(M.days)+Math.trunc(M.weeks)*7},De=Gt.fromObject({years:M.years-Math.trunc(M.years),quarters:M.quarters-Math.trunc(M.quarters),months:M.months-Math.trunc(M.months),weeks:M.weeks-Math.trunc(M.weeks),days:M.days-Math.trunc(M.days),hours:M.hours,minutes:M.minutes,seconds:M.seconds,milliseconds:M.milliseconds}).as("milliseconds"),Ue=Xa(Ce);let[Ye,Pt]=rf(Ue,V,q.zone);return De!==0&&(Ye+=De,Pt=q.zone.offset(Ye)),{ts:Ye,o:Pt}}function ti(q,M,V,Q,ie,Ce){const{setZone:De,zone:Ue}=V;if(q&&Object.keys(q).length!==0||M){const Ye=M||Ue,Pt=Cn.fromObject(q,{...V,zone:Ye,specificOffset:Ce});return De?Pt:Pt.setZone(Ue)}else return Cn.invalid(new _n("unparsable",`the input "${ie}" can't be parsed as ${Q}`))}function of(q,M,V=!0){return q.isValid?no.create($e.create("en-US"),{allowZ:V,forceSimple:!0}).formatDateTimeFromString(q,M):null}function ea(q,M,V){const Q=q.c.year>9999||q.c.year<0;let ie="";if(Q&&q.c.year>=0&&(ie+="+"),ie+=Zt(q.c.year,Q?6:4),V==="year")return ie;if(M){if(ie+="-",ie+=Zt(q.c.month),V==="month")return ie;ie+="-"}else if(ie+=Zt(q.c.month),V==="month")return ie;return ie+=Zt(q.c.day),ie}function af(q,M,V,Q,ie,Ce,De){let Ue=!V||q.c.millisecond!==0||q.c.second!==0,Ye="";switch(De){case"day":case"month":case"year":break;default:if(Ye+=Zt(q.c.hour),De==="hour")break;if(M){if(Ye+=":",Ye+=Zt(q.c.minute),De==="minute")break;Ue&&(Ye+=":",Ye+=Zt(q.c.second))}else{if(Ye+=Zt(q.c.minute),De==="minute")break;Ue&&(Ye+=Zt(q.c.second))}if(De==="second")break;Ue&&(!Q||q.c.millisecond!==0)&&(Ye+=".",Ye+=Zt(q.c.millisecond,3))}return ie&&(q.isOffsetFixed&&q.offset===0&&!Ce?Ye+="Z":q.o<0?(Ye+="-",Ye+=Zt(Math.trunc(-q.o/60)),Ye+=":",Ye+=Zt(Math.trunc(-q.o%60))):(Ye+="+",Ye+=Zt(Math.trunc(q.o/60)),Ye+=":",Ye+=Zt(Math.trunc(q.o%60)))),Ce&&(Ye+="["+q.zone.ianaName+"]"),Ye}const Ni={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},jy={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},sf={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ii=["year","month","day","hour","minute","second","millisecond"],Sh=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],wh=["year","ordinal","hour","minute","second","millisecond"];function xs(q){const M={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[q.toLowerCase()];if(!M)throw new a(q);return M}function Dl(q){switch(q.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return xs(q)}}function lf(q){if(ni===void 0&&(ni=an.now()),q.type!=="iana")return q.offset(ni);const M=q.name;let V=ri.get(M);return V===void 0&&(V=q.offset(ni),ri.set(M,V)),V}function Au(q,M){const V=st(M.zone,an.defaultZone);if(!V.isValid)return Cn.invalid(Di(V));const Q=$e.fromObject(M);let ie,Ce;if(Ve(q.year))ie=an.now();else{for(const Ye of Ii)Ve(q[Ye])&&(q[Ye]=Ni[Ye]);const De=_e(q)||gt(q);if(De)return Cn.invalid(De);const Ue=lf(V);[ie,Ce]=Ou(q,Ue,V)}return new Cn({ts:ie,zone:V,loc:Q,o:Ce})}function wa(q,M,V){const Q=Ve(V.round)?!0:V.round,ie=Ve(V.rounding)?"trunc":V.rounding,Ce=(Ue,Ye)=>(Ue=ds(Ue,Q||V.calendary?0:2,V.calendary?"round":ie),M.loc.clone(V).relFormatter(V).format(Ue,Ye)),De=Ue=>V.calendary?M.hasSame(q,Ue)?0:M.startOf(Ue).diff(q.startOf(Ue),Ue).get(Ue):M.diff(q,Ue).get(Ue);if(V.unit)return Ce(De(V.unit),V.unit);for(const Ue of V.units){const Ye=De(Ue);if(Math.abs(Ye)>=1)return Ce(Ye,Ue)}return Ce(q>M?-0:0,V.units[V.units.length-1])}function Ca(q){let M={},V;return q.length>0&&typeof q[q.length-1]=="object"?(M=q[q.length-1],V=Array.from(q).slice(0,q.length-1)):V=Array.from(q),[M,V]}let ni;const ri=new Map;class Cn{constructor(M){const V=M.zone||an.defaultZone;let Q=M.invalid||(Number.isNaN(M.ts)?new _n("invalid input"):null)||(V.isValid?null:Di(V));this.ts=Ve(M.ts)?an.now():M.ts;let ie=null,Ce=null;if(!Q)if(M.old&&M.old.ts===this.ts&&M.old.zone.equals(V))[ie,Ce]=[M.old.c,M.old.o];else{const De=At(M.o)&&!M.old?M.o:V.offset(this.ts);ie=bs(this.ts,De),Q=Number.isNaN(ie.year)?new _n("invalid input"):null,ie=Q?null:ie,Ce=Q?null:De}this._zone=V,this.loc=M.loc||$e.create(),this.invalid=Q,this.weekData=null,this.localWeekData=null,this.c=ie,this.o=Ce,this.isLuxonDateTime=!0}static now(){return new Cn({})}static local(){const[M,V]=Ca(arguments),[Q,ie,Ce,De,Ue,Ye,Pt]=V;return Au({year:Q,month:ie,day:Ce,hour:De,minute:Ue,second:Ye,millisecond:Pt},M)}static utc(){const[M,V]=Ca(arguments),[Q,ie,Ce,De,Ue,Ye,Pt]=V;return M.zone=Rt.utcInstance,Au({year:Q,month:ie,day:Ce,hour:De,minute:Ue,second:Ye,millisecond:Pt},M)}static fromJSDate(M,V={}){const Q=we(M)?M.valueOf():NaN;if(Number.isNaN(Q))return Cn.invalid("invalid input");const ie=st(V.zone,an.defaultZone);return ie.isValid?new Cn({ts:Q,zone:ie,loc:$e.fromObject(V)}):Cn.invalid(Di(ie))}static fromMillis(M,V={}){if(At(M))return M<-Sa||M>Sa?Cn.invalid("Timestamp out of range"):new Cn({ts:M,zone:st(V.zone,an.defaultZone),loc:$e.fromObject(V)});throw new i(`fromMillis requires a numerical input, but received a ${typeof M} with value ${M}`)}static fromSeconds(M,V={}){if(At(M))return new Cn({ts:M*1e3,zone:st(V.zone,an.defaultZone),loc:$e.fromObject(V)});throw new i("fromSeconds requires a numerical input")}static fromObject(M,V={}){M=M||{};const Q=st(V.zone,an.defaultZone);if(!Q.isValid)return Cn.invalid(Di(Q));const ie=$e.fromObject(V),Ce=cc(M,Dl),{minDaysInFirstWeek:De,startOfWeek:Ue}=Vt(Ce,ie),Ye=an.now(),Pt=Ve(V.specificOffset)?Q.offset(Ye):V.specificOffset,Rn=!Ve(Ce.ordinal),Ln=!Ve(Ce.year),fr=!Ve(Ce.month)||!Ve(Ce.day),Mn=Ln||fr,Qr=Ce.weekYear||Ce.weekNumber;if((Mn||Rn)&&Qr)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(fr&&Rn)throw new o("Can't mix ordinal dates with month/day");const Wo=Qr||Ce.weekday&&!Mn;let Aa,Da,ja=bs(Ye,Pt);Wo?(Aa=Sh,Da=jy,ja=$t(ja,De,Ue)):Rn?(Aa=wh,Da=sf,ja=Qt(ja)):(Aa=Ii,Da=Ni);let Li=!1;for(const Bs of Aa){const Iy=Ce[Bs];Ve(Iy)?Li?Ce[Bs]=Da[Bs]:Ce[Bs]=ja[Bs]:Li=!0}const Ch=Wo?ye(Ce,De,Ue):Rn?ve(Ce):_e(Ce),cf=Ch||gt(Ce);if(cf)return Cn.invalid(cf);const Du=Wo?jt(Ce,De,Ue):Rn?Nt(Ce):Ce,[uf,jl]=Ou(Du,Pt,Q),so=new Cn({ts:uf,zone:Q,o:jl,loc:ie});return Ce.weekday&&Mn&&M.weekday!==so.weekday?Cn.invalid("mismatched weekday",`you can't specify both a weekday of ${Ce.weekday} and a date of ${so.toISO()}`):so.isValid?so:Cn.invalid(so.invalid)}static fromISO(M,V={}){const[Q,ie]=Xd(M);return ti(Q,ie,V,"ISO 8601",M)}static fromRFC2822(M,V={}){const[Q,ie]=Zd(M);return ti(Q,ie,V,"RFC 2822",M)}static fromHTTP(M,V={}){const[Q,ie]=Jd(M);return ti(Q,ie,V,"HTTP",V)}static fromFormat(M,V,Q={}){if(Ve(M)||Ve(V))throw new i("fromFormat requires an input string and a format");const{locale:ie=null,numberingSystem:Ce=null}=Q,De=$e.fromOpts({locale:ie,numberingSystem:Ce,defaultToEN:!0}),[Ue,Ye,Pt,Rn]=ei(De,M,V);return Rn?Cn.invalid(Rn):ti(Ue,Ye,Q,`format ${V}`,M,Pt)}static fromString(M,V,Q={}){return Cn.fromFormat(M,V,Q)}static fromSQL(M,V={}){const[Q,ie]=Ml(M);return ti(Q,ie,V,"SQL",M)}static invalid(M,V=null){if(!M)throw new i("need to specify a reason the DateTime is invalid");const Q=M instanceof _n?M:new _n(M,V);if(an.throwOnInvalid)throw new t(Q);return new Cn({invalid:Q})}static isDateTime(M){return M&&M.isLuxonDateTime||!1}static parseFormatForOpts(M,V={}){const Q=xh(M,$e.fromObject(V));return Q?Q.map(ie=>ie?ie.val:null).join(""):null}static expandFormat(M,V={}){return vh(no.parseFormat(M),$e.fromObject(V)).map(Q=>Q.val).join("")}static resetCache(){ni=void 0,ri.clear()}get(M){return this[M]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Mu(this).weekYear:NaN}get weekNumber(){return this.isValid?Mu(this).weekNumber:NaN}get weekday(){return this.isValid?Mu(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?yc(this).weekday:NaN}get localWeekNumber(){return this.isValid?yc(this).weekNumber:NaN}get localWeekYear(){return this.isValid?yc(this).weekYear:NaN}get ordinal(){return this.isValid?Qt(this.c).ordinal:NaN}get monthShort(){return this.isValid?vr.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?vr.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?vr.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?vr.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const M=864e5,V=6e4,Q=Xa(this.c),ie=this.zone.offset(Q-M),Ce=this.zone.offset(Q+M),De=this.zone.offset(Q-ie*V),Ue=this.zone.offset(Q-Ce*V);if(De===Ue)return[this];const Ye=Q-De*V,Pt=Q-Ue*V,Rn=bs(Ye,De),Ln=bs(Pt,Ue);return Rn.hour===Ln.hour&&Rn.minute===Ln.minute&&Rn.second===Ln.second&&Rn.millisecond===Ln.millisecond?[ji(this,{ts:Ye}),ji(this,{ts:Pt})]:[this]}get isInLeapYear(){return ia(this.year)}get daysInMonth(){return _r(this.year,this.month)}get daysInYear(){return this.isValid?dr(this.year):NaN}get weeksInWeekYear(){return this.isValid?fs(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?fs(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(M={}){const{locale:V,numberingSystem:Q,calendar:ie}=no.create(this.loc.clone(M),M).resolvedOptions(this);return{locale:V,numberingSystem:Q,outputCalendar:ie}}toUTC(M=0,V={}){return this.setZone(Rt.instance(M),V)}toLocal(){return this.setZone(an.defaultZone)}setZone(M,{keepLocalTime:V=!1,keepCalendarTime:Q=!1}={}){if(M=st(M,an.defaultZone),M.equals(this.zone))return this;if(M.isValid){let ie=this.ts;if(V||Q){const Ce=M.offset(this.ts),De=this.toObject();[ie]=Ou(De,Ce,M)}return ji(this,{ts:ie,zone:M})}else return Cn.invalid(Di(M))}reconfigure({locale:M,numberingSystem:V,outputCalendar:Q}={}){const ie=this.loc.clone({locale:M,numberingSystem:V,outputCalendar:Q});return ji(this,{loc:ie})}setLocale(M){return this.reconfigure({locale:M})}set(M){if(!this.isValid)return this;const V=cc(M,Dl),{minDaysInFirstWeek:Q,startOfWeek:ie}=Vt(V,this.loc),Ce=!Ve(V.weekYear)||!Ve(V.weekNumber)||!Ve(V.weekday),De=!Ve(V.ordinal),Ue=!Ve(V.year),Ye=!Ve(V.month)||!Ve(V.day),Pt=Ue||Ye,Rn=V.weekYear||V.weekNumber;if((Pt||De)&&Rn)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(Ye&&De)throw new o("Can't mix ordinal dates with month/day");let Ln;Ce?Ln=jt({...$t(this.c,Q,ie),...V},Q,ie):Ve(V.ordinal)?(Ln={...this.toObject(),...V},Ve(V.day)&&(Ln.day=Math.min(_r(Ln.year,Ln.month),Ln.day))):Ln=Nt({...Qt(this.c),...V});const[fr,Mn]=Ou(Ln,this.o,this.zone);return ji(this,{ts:fr,o:Mn})}plus(M){if(!this.isValid)return this;const V=Gt.fromDurationLike(M);return ji(this,Pu(this,V))}minus(M){if(!this.isValid)return this;const V=Gt.fromDurationLike(M).negate();return ji(this,Pu(this,V))}startOf(M,{useLocaleWeeks:V=!1}={}){if(!this.isValid)return this;const Q={},ie=Gt.normalizeUnit(M);switch(ie){case"years":Q.month=1;case"quarters":case"months":Q.day=1;case"weeks":case"days":Q.hour=0;case"hours":Q.minute=0;case"minutes":Q.second=0;case"seconds":Q.millisecond=0;break}if(ie==="weeks")if(V){const Ce=this.loc.getStartOfWeek(),{weekday:De}=this;De<Ce&&(Q.weekNumber=this.weekNumber-1),Q.weekday=Ce}else Q.weekday=1;if(ie==="quarters"){const Ce=Math.ceil(this.month/3);Q.month=(Ce-1)*3+1}return this.set(Q)}endOf(M,V){return this.isValid?this.plus({[M]:1}).startOf(M,V).minus(1):this}toFormat(M,V={}){return this.isValid?no.create(this.loc.redefaultToEN(V)).formatDateTimeFromString(this,M):ca}toLocaleString(M=h,V={}){return this.isValid?no.create(this.loc.clone(V),M).formatDateTime(this):ca}toLocaleParts(M={}){return this.isValid?no.create(this.loc.clone(M),M).formatDateTimeParts(this):[]}toISO({format:M="extended",suppressSeconds:V=!1,suppressMilliseconds:Q=!1,includeOffset:ie=!0,extendedZone:Ce=!1,precision:De="milliseconds"}={}){if(!this.isValid)return null;De=xs(De);const Ue=M==="extended";let Ye=ea(this,Ue,De);return Ii.indexOf(De)>=3&&(Ye+="T"),Ye+=af(this,Ue,V,Q,ie,Ce,De),Ye}toISODate({format:M="extended",precision:V="day"}={}){return this.isValid?ea(this,M==="extended",xs(V)):null}toISOWeekDate(){return of(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:M=!1,suppressSeconds:V=!1,includeOffset:Q=!0,includePrefix:ie=!1,extendedZone:Ce=!1,format:De="extended",precision:Ue="milliseconds"}={}){return this.isValid?(Ue=xs(Ue),(ie&&Ii.indexOf(Ue)>=3?"T":"")+af(this,De==="extended",V,M,Q,Ce,Ue)):null}toRFC2822(){return of(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return of(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ea(this,!0):null}toSQLTime({includeOffset:M=!0,includeZone:V=!1,includeOffsetSpace:Q=!0}={}){let ie="HH:mm:ss.SSS";return(V||M)&&(Q&&(ie+=" "),V?ie+="z":M&&(ie+="ZZ")),of(this,ie,!0)}toSQL(M={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(M)}`:null}toString(){return this.isValid?this.toISO():ca}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(M={}){if(!this.isValid)return{};const V={...this.c};return M.includeConfig&&(V.outputCalendar=this.outputCalendar,V.numberingSystem=this.loc.numberingSystem,V.locale=this.loc.locale),V}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(M,V="milliseconds",Q={}){if(!this.isValid||!M.isValid)return Gt.invalid("created by diffing an invalid DateTime");const ie={locale:this.locale,numberingSystem:this.numberingSystem,...Q},Ce=wt(V).map(Gt.normalizeUnit),De=M.valueOf()>this.valueOf(),Ue=De?this:M,Ye=De?M:this,Pt=Ja(Ue,Ye,Ce,ie);return De?Pt.negate():Pt}diffNow(M="milliseconds",V={}){return this.diff(Cn.now(),M,V)}until(M){return this.isValid?cn.fromDateTimes(this,M):this}hasSame(M,V,Q){if(!this.isValid)return!1;const ie=M.valueOf(),Ce=this.setZone(M.zone,{keepLocalTime:!0});return Ce.startOf(V,Q)<=ie&&ie<=Ce.endOf(V,Q)}equals(M){return this.isValid&&M.isValid&&this.valueOf()===M.valueOf()&&this.zone.equals(M.zone)&&this.loc.equals(M.loc)}toRelative(M={}){if(!this.isValid)return null;const V=M.base||Cn.fromObject({},{zone:this.zone}),Q=M.padding?this<V?-M.padding:M.padding:0;let ie=["years","months","days","hours","minutes","seconds"],Ce=M.unit;return Array.isArray(M.unit)&&(ie=M.unit,Ce=void 0),wa(V,this.plus(Q),{...M,numeric:"always",units:ie,unit:Ce})}toRelativeCalendar(M={}){return this.isValid?wa(M.base||Cn.fromObject({},{zone:this.zone}),this,{...M,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...M){if(!M.every(Cn.isDateTime))throw new i("min requires all arguments be DateTimes");return Mt(M,V=>V.valueOf(),Math.min)}static max(...M){if(!M.every(Cn.isDateTime))throw new i("max requires all arguments be DateTimes");return Mt(M,V=>V.valueOf(),Math.max)}static fromFormatExplain(M,V,Q={}){const{locale:ie=null,numberingSystem:Ce=null}=Q,De=$e.fromOpts({locale:ie,numberingSystem:Ce,defaultToEN:!0});return nf(De,M,V)}static fromStringExplain(M,V,Q={}){return Cn.fromFormatExplain(M,V,Q)}static buildFormatParser(M,V={}){const{locale:Q=null,numberingSystem:ie=null}=V,Ce=$e.fromOpts({locale:Q,numberingSystem:ie,defaultToEN:!0});return new bh(Ce,M)}static fromFormatParser(M,V,Q={}){if(Ve(M)||Ve(V))throw new i("fromFormatParser requires an input string and a format parser");const{locale:ie=null,numberingSystem:Ce=null}=Q,De=$e.fromOpts({locale:ie,numberingSystem:Ce,defaultToEN:!0});if(!De.equals(V.locale))throw new i(`fromFormatParser called with a locale of ${De}, but the format parser was created for ${V.locale}`);const{result:Ue,zone:Ye,specificOffset:Pt,invalidReason:Rn}=V.explainFromTokens(M);return Rn?Cn.invalid(Rn):ti(Ue,Ye,Q,`format ${V.format}`,M,Pt)}static get DATE_SHORT(){return h}static get DATE_MED(){return g}static get DATE_MED_WITH_WEEKDAY(){return y}static get DATE_FULL(){return b}static get DATE_HUGE(){return S}static get TIME_SIMPLE(){return w}static get TIME_WITH_SECONDS(){return x}static get TIME_WITH_SHORT_OFFSET(){return R}static get TIME_WITH_LONG_OFFSET(){return k}static get TIME_24_SIMPLE(){return T}static get TIME_24_WITH_SECONDS(){return O}static get TIME_24_WITH_SHORT_OFFSET(){return A}static get TIME_24_WITH_LONG_OFFSET(){return I}static get DATETIME_SHORT(){return j}static get DATETIME_SHORT_WITH_SECONDS(){return _}static get DATETIME_MED(){return z}static get DATETIME_MED_WITH_SECONDS(){return B}static get DATETIME_MED_WITH_WEEKDAY(){return E}static get DATETIME_FULL(){return L}static get DATETIME_FULL_WITH_SECONDS(){return N}static get DATETIME_HUGE(){return F}static get DATETIME_HUGE_WITH_SECONDS(){return D}}function oi(q){if(Cn.isDateTime(q))return q;if(q&&q.valueOf&&At(q.valueOf()))return Cn.fromJSDate(q);if(q&&typeof q=="object")return Cn.fromObject(q);throw new i(`Unknown datetime argument: ${q}, of type ${typeof q}`)}const Ny="3.7.2";return za.DateTime=Cn,za.Duration=Gt,za.FixedOffsetZone=Rt,za.IANAZone=ee,za.Info=vr,za.Interval=cn,za.InvalidZone=bt,za.Settings=an,za.SystemZone=ae,za.VERSION=Ny,za.Zone=W,za}var lN;function iT(){return lN||(lN=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CronDate=e.DAYS_IN_MONTH=e.DateMathOp=e.TimeUnit=void 0;const t=Y0e();var n;(function(a){a.Second="Second",a.Minute="Minute",a.Hour="Hour",a.Day="Day",a.Month="Month",a.Year="Year"})(n||(e.TimeUnit=n={}));var r;(function(a){a.Add="Add",a.Subtract="Subtract"})(r||(e.DateMathOp=r={})),e.DAYS_IN_MONTH=Object.freeze([31,29,31,30,31,30,31,31,30,31,30,31]);class o{#e;#t=null;#n=null;constructor(i,s){const c={zone:s};if(i?i instanceof o?(this.#e=i.#e,this.#t=i.#t,this.#n=i.#n):i instanceof Date?this.#e=t.DateTime.fromJSDate(i,c):typeof i=="number"?this.#e=t.DateTime.fromMillis(i,c):(this.#e=t.DateTime.fromISO(i,c),this.#e.isValid||(this.#e=t.DateTime.fromRFC2822(i,c)),this.#e.isValid||(this.#e=t.DateTime.fromSQL(i,c)),this.#e.isValid||(this.#e=t.DateTime.fromFormat(i,"EEE, d MMM yyyy HH:mm:ss",c))):this.#e=t.DateTime.local(),!this.#e.isValid)throw new Error(`CronDate: unhandled timestamp: ${i}`);s&&s!==this.#e.zoneName&&(this.#e=this.#e.setZone(s))}static#o(i){return i%4===0&&i%100!==0||i%400===0}get dstStart(){return this.#t}set dstStart(i){this.#t=i}get dstEnd(){return this.#n}set dstEnd(i){this.#n=i}addYear(){this.#e=this.#e.plus({years:1})}addMonth(){this.#e=this.#e.plus({months:1}).startOf("month")}addDay(){this.#e=this.#e.plus({days:1}).startOf("day")}addHour(){this.#e=this.#e.plus({hours:1}).startOf("hour")}addMinute(){this.#e=this.#e.plus({minutes:1}).startOf("minute")}addSecond(){this.#e=this.#e.plus({seconds:1})}subtractYear(){this.#e=this.#e.minus({years:1})}subtractMonth(){this.#e=this.#e.minus({months:1}).endOf("month").startOf("second")}subtractDay(){this.#e=this.#e.minus({days:1}).endOf("day").startOf("second")}subtractHour(){this.#e=this.#e.minus({hours:1}).endOf("hour").startOf("second")}subtractMinute(){this.#e=this.#e.minus({minutes:1}).endOf("minute").startOf("second")}subtractSecond(){this.#e=this.#e.minus({seconds:1})}addUnit(i){switch(i){case n.Year:return this.addYear();case n.Month:return this.addMonth();case n.Day:return this.addDay();case n.Hour:return this.addHour();case n.Minute:return this.addMinute();case n.Second:return this.addSecond()}}subtractUnit(i){switch(i){case n.Year:return this.subtractYear();case n.Month:return this.subtractMonth();case n.Day:return this.subtractDay();case n.Hour:return this.subtractHour();case n.Minute:return this.subtractMinute();case n.Second:return this.subtractSecond()}}invokeDateOperation(i,s){if(i===r.Add){this.addUnit(s);return}if(i===r.Subtract){this.subtractUnit(s);return}throw new Error(`Invalid verb: ${i}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){const i=this.#e.weekday;return i===7?0:i}getMonth(){return this.#e.month-1}getHours(){return this.#e.hour}getMinutes(){return this.#e.minute}getSeconds(){return this.#e.second}getMilliseconds(){return this.#e.millisecond}getUTCOffset(){return this.#e.offset}setStartOfDay(){this.#e=this.#e.startOf("day")}setEndOfDay(){this.#e=this.#e.endOf("day")}getTime(){return this.#e.valueOf()}getUTCDate(){return this.#r().day}getUTCFullYear(){return this.#r().year}getUTCDay(){const i=this.#r().weekday;return i===7?0:i}getUTCMonth(){return this.#r().month-1}getUTCHours(){return this.#r().hour}getUTCMinutes(){return this.#r().minute}getUTCSeconds(){return this.#r().second}toISOString(){return this.#e.toUTC().toISO()}toJSON(){return this.#e.toJSON()}setDate(i){this.#e=this.#e.set({day:i})}setFullYear(i){this.#e=this.#e.set({year:i})}setDay(i){this.#e=this.#e.set({weekday:i})}setMonth(i){this.#e=this.#e.set({month:i+1})}setHours(i){this.#e=this.#e.set({hour:i})}setMinutes(i){this.#e=this.#e.set({minute:i})}setSeconds(i){this.#e=this.#e.set({second:i})}setMilliseconds(i){this.#e=this.#e.set({millisecond:i})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){const{day:i,month:s}=this.#e;if(s===2){const c=o.#o(this.#e.year);return i===e.DAYS_IN_MONTH[s-1]-(c?0:1)}return i===e.DAYS_IN_MONTH[s-1]}isLastWeekdayOfMonth(){const{day:i,month:s}=this.#e;let c;return s===2?c=e.DAYS_IN_MONTH[s-1]-(o.#o(this.#e.year)?0:1):c=e.DAYS_IN_MONTH[s-1],i>c-7}applyDateOperation(i,s,c){if(s===n.Month||s===n.Day){this.invokeDateOperation(i,s);return}const f=this.getHours();this.invokeDateOperation(i,s);const u=this.getHours(),h=u-f;h===2?c!==24&&(this.dstStart=f+1):h===0&&this.getMinutes()===0&&this.getSeconds()===0&&c!==24&&(this.dstEnd=u)}#r(){return this.#e.toUTC()}}e.CronDate=o,e.default=o})(iN)),iN}var cN;function K0e(){if(cN)return Hm;cN=1,Object.defineProperty(Hm,"__esModule",{value:!0}),Hm.CronMonth=void 0;const e=iT(),t=_d(),n=1,r=12,o=Object.freeze([]);let a=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return o}static get daysInMonth(){return e.DAYS_IN_MONTH}constructor(i,s){super(i,s),this.validate()}get values(){return super.values}};return Hm.CronMonth=a,Hm}var qm={},uN;function G0e(){if(uN)return qm;uN=1,Object.defineProperty(qm,"__esModule",{value:!0}),qm.CronSecond=void 0;const e=_d(),t=0,n=59,r=Object.freeze([]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return qm.CronSecond=o,qm}var dN;function sT(){return dN||(dN=1,(function(e){var t=Gf&&Gf.__createBinding||(Object.create?(function(r,o,a,i){i===void 0&&(i=a);var s=Object.getOwnPropertyDescriptor(o,a);(!s||("get"in s?!o.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(r,i,s)}):(function(r,o,a,i){i===void 0&&(i=a),r[i]=o[a]})),n=Gf&&Gf.__exportStar||function(r,o){for(var a in r)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,r,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(B0e(),e),n(V0e(),e),n(H0e(),e),n(_d(),e),n(q0e(),e),n(W0e(),e),n(K0e(),e),n(G0e(),e)})(Gf)),Gf}var fN;function $3(){if(fN)return zm;fN=1,Object.defineProperty(zm,"__esModule",{value:!0}),zm.CronFieldCollection=void 0;const e=sT();let t=class lg{#e;#t;#n;#o;#r;#a;static from(r,o){return new lg({second:this.resolveField(e.CronSecond,r.second,o.second),minute:this.resolveField(e.CronMinute,r.minute,o.minute),hour:this.resolveField(e.CronHour,r.hour,o.hour),dayOfMonth:this.resolveField(e.CronDayOfMonth,r.dayOfMonth,o.dayOfMonth),month:this.resolveField(e.CronMonth,r.month,o.month),dayOfWeek:this.resolveField(e.CronDayOfWeek,r.dayOfWeek,o.dayOfWeek)})}static resolveField(r,o,a){return a?a instanceof e.CronField?a:new r(a):o}constructor({second:r,minute:o,hour:a,dayOfMonth:i,month:s,dayOfWeek:c}){if(!r)throw new Error("Validation error, Field second is missing");if(!o)throw new Error("Validation error, Field minute is missing");if(!a)throw new Error("Validation error, Field hour is missing");if(!i)throw new Error("Validation error, Field dayOfMonth is missing");if(!s)throw new Error("Validation error, Field month is missing");if(!c)throw new Error("Validation error, Field dayOfWeek is missing");if(s.values.length===1&&!i.hasLastChar&&c.isWildcard&&!(parseInt(i.values[0],10)<=e.CronMonth.daysInMonth[s.values[0]-1]))throw new Error("Invalid explicit day of month definition");this.#e=r,this.#t=o,this.#n=a,this.#r=s,this.#a=c,this.#o=i}get second(){return this.#e}get minute(){return this.#t}get hour(){return this.#n}get dayOfMonth(){return this.#o}get month(){return this.#r}get dayOfWeek(){return this.#a}static compactField(r){if(r.length===0)return[];const o=[];let a;return r.forEach((i,s,c)=>{if(a===void 0){a={start:i,count:1};return}const f=c[s-1]||a.start,u=c[s+1];if(i==="L"||i==="W"){o.push(a),o.push({start:i,count:1}),a=void 0;return}if(a.step===void 0&&u!==void 0){const h=i-f,g=u-i;if(h<=g){a={...a,count:2,end:i,step:h};return}a.step=1}i-(a.end??0)===a.step?(a.count++,a.end=i):(a.count===1?o.push({start:a.start,count:1}):a.count===2?(o.push({start:a.start,count:1}),o.push({start:a.end??f,count:1})):o.push(a),a={start:i,count:1})}),a&&o.push(a),o}static#s(r,o,a){const i=o.step;return i?i===1&&o.start===r.min&&o.end&&o.end>=a?r.hasQuestionMarkChar?"?":"*":i!==1&&o.start===r.min&&o.end&&o.end>=a-i+1?`*/${i}`:null:null}static#i(r,o){const a=r.step;if(a===1)return`${r.start}-${r.end}`;const i=r.start===0?r.count-1:r.count;if(!a)throw new Error("Unexpected range step");if(!r.end)throw new Error("Unexpected range end");if(a*i>r.end){const s=(f,u)=>{if(typeof r.start!="number")throw new Error("Unexpected range start");return u%a===0?r.start+u:null};if(typeof r.start!="number")throw new Error("Unexpected range start");const c={length:r.end-r.start+1};return Array.from(c,s).filter(f=>f!==null).join(",")}return r.end===o-a+1?`${r.start}/${a}`:`${r.start}-${r.end}/${a}`}stringifyField(r){let o=r.max,a=r.values;if(r instanceof e.CronDayOfWeek){o=6;const s=this.#a.values;a=s[s.length-1]===7?s.slice(0,-1):s}r instanceof e.CronDayOfMonth&&(o=this.#r.values.length===1?e.CronMonth.daysInMonth[this.#r.values[0]-1]:r.max);const i=lg.compactField(a);if(i.length===1){const s=lg.#s(r,i[0],o);if(s)return s}return i.map(s=>{const c=s.count===1?s.start.toString():lg.#i(s,o);return r instanceof e.CronDayOfWeek&&r.nthDay>0?`${c}#${r.nthDay}`:c}).join(",")}stringify(r=!1){const o=[];return r&&o.push(this.stringifyField(this.#e)),o.push(this.stringifyField(this.#t),this.stringifyField(this.#n),this.stringifyField(this.#o),this.stringifyField(this.#r),this.stringifyField(this.#a)),o.join(" ")}serialize(){return{second:this.#e.serialize(),minute:this.#t.serialize(),hour:this.#n.serialize(),dayOfMonth:this.#o.serialize(),month:this.#r.serialize(),dayOfWeek:this.#a.serialize()}}};return zm.CronFieldCollection=t,zm}var pN={},hN;function M3(){return hN||(hN=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CronExpression=e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=void 0;const t=iT();e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE="Out of the time span range",e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE="Invalid expression, loop limit exceeded";const n=1e4;class r{#e;#t;#n;#o;#r;#a;#s=null;#i=!1;constructor(a,i){this.#e=i,this.#t=i.tz,this.#o=i.startDate?new t.CronDate(i.startDate,this.#t):null,this.#r=i.endDate?new t.CronDate(i.endDate,this.#t):null;let s=i.currentDate??i.startDate;if(s){const c=new t.CronDate(s,this.#t);this.#o&&c.getTime()<this.#o.getTime()?s=this.#o:this.#r&&c.getTime()>this.#r.getTime()&&(s=this.#r)}this.#n=new t.CronDate(s,this.#t),this.#a=a}get fields(){return this.#a}static fieldsToExpression(a,i){return new r(a,i||{})}static#c(a,i){return i.some(s=>s===a)}#l(a,i){return a[i?a.length-1:0]}#d(a){const i=`${a.getFullYear()}-${a.getMonth()+1}-${a.getDate()}`;if(this.#s===i)return this.#i;const s=new t.CronDate(a);s.setStartOfDay();const c=new t.CronDate(a);return c.setEndOfDay(),this.#s=i,this.#i=s.getUTCOffset()!==c.getUTCOffset(),this.#i}#u(a,i,s){const c=this.#a.second.values,f=a.getSeconds(),u=this.#a.second.findNearestValue(f,s);if(u!==null){a.setSeconds(u);return}a.applyDateOperation(i,t.TimeUnit.Minute,this.#a.hour.values.length),a.setSeconds(this.#l(c,s))}#p(a,i,s){const c=this.#a.minute.values,f=this.#a.second.values,u=a.getMinutes(),h=this.#a.minute.findNearestValue(u,s);if(h!==null){a.setMinutes(h),a.setSeconds(this.#l(f,s));return}a.applyDateOperation(i,t.TimeUnit.Hour,this.#a.hour.values.length),a.setMinutes(this.#l(c,s)),a.setSeconds(this.#l(f,s))}static#f(a,i){const s=i.isLastWeekdayOfMonth();return a.some(c=>{const f=parseInt(c.toString().charAt(0),10)%7;if(Number.isNaN(f))throw new Error(`Invalid last weekday of the month expression: ${c}`);return i.getDay()===f&&s})}next(){return this.#h()}prev(){return this.#h(!0)}hasNext(){const a=this.#n;try{return this.#h(),!0}catch{return!1}finally{this.#n=a}}hasPrev(){const a=this.#n;try{return this.#h(!0),!0}catch{return!1}finally{this.#n=a}}take(a){const i=[];if(a>=0)for(let s=0;s<a;s++)try{i.push(this.next())}catch{return i}else for(let s=0;s>a;s--)try{i.push(this.prev())}catch{return i}return i}reset(a){this.#n=new t.CronDate(a||this.#e.currentDate,this.#t)}stringify(a=!1){return this.#a.stringify(a)}includesDate(a){const{second:i,minute:s,hour:c,month:f}=this.#a,u=new t.CronDate(a,this.#t);return!(!i.values.includes(u.getSeconds())||!s.values.includes(u.getMinutes())||!c.values.includes(u.getHours())||!f.values.includes(u.getMonth()+1)||!this.#m(u)||this.#a.dayOfWeek.nthDay>0&&Math.ceil(u.getDate()/7)!==this.#a.dayOfWeek.nthDay)}toString(){return this.#e.expression||this.stringify(!0)}#m(a){const i=this.#a.dayOfMonth.isWildcard,s=!i,c=this.#a.dayOfWeek.isWildcard,f=!c,u=r.#c(a.getDate(),this.#a.dayOfMonth.values)||this.#a.dayOfMonth.hasLastChar&&a.isLastDayOfMonth(),h=r.#c(a.getDay(),this.#a.dayOfWeek.values)||this.#a.dayOfWeek.hasLastChar&&r.#f(this.#a.dayOfWeek.values,a);return!!(s&&f&&(u||h)||u&&!f||i&&!c&&h)}#g(a,i,s){const c=this.#a.hour.values,f=c,u=a.getHours(),h=r.#c(u,c),g=a.dstEnd===u;if(a.dstStart!==null&&a.dstStart===u-1&&r.#c(a.dstStart,c))return!0;if(g&&!s)return a.dstEnd=null,a.applyDateOperation(t.DateMathOp.Add,t.TimeUnit.Hour,f.length),!1;if(h)return!0;a.dstStart=null;const y=this.#a.hour.findNearestValue(u,s);if(y===null)return a.applyDateOperation(i,t.TimeUnit.Day,f.length),!1;if(this.#d(a)){const b=s?u-y:y-u;for(let S=0;S<b&&(a.applyDateOperation(i,t.TimeUnit.Hour,f.length),!(!s&&a.getHours()>=y||s&&a.getHours()<=y));S++);}else a.setHours(y);return a.setMinutes(this.#l(this.#a.minute.values,s)),a.setSeconds(this.#l(this.#a.second.values,s)),!1}#y(a){if(!this.#o&&!this.#r)return;const i=a.getTime();if(this.#o&&i<this.#o.getTime())throw new Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE);if(this.#r&&i>this.#r.getTime())throw new Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#h(a=!1){const i=a?t.DateMathOp.Subtract:t.DateMathOp.Add,s=new t.CronDate(this.#n),c=s.getTime();let f=0;for(;++f<n;){if(this.#y(s),!this.#m(s)){s.applyDateOperation(i,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!(this.#a.dayOfWeek.nthDay<=0||Math.ceil(s.getDate()/7)===this.#a.dayOfWeek.nthDay)){s.applyDateOperation(i,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!r.#c(s.getMonth()+1,this.#a.month.values)){s.applyDateOperation(i,t.TimeUnit.Month,this.#a.hour.values.length);continue}if(this.#g(s,i,a)){if(!r.#c(s.getMinutes(),this.#a.minute.values)){this.#p(s,i,a);continue}if(!r.#c(s.getSeconds(),this.#a.second.values)){this.#u(s,i,a);continue}if(c===s.getTime()){(i==="Add"||s.getMilliseconds()===0)&&s.applyDateOperation(i,t.TimeUnit.Second,this.#a.hour.values.length);continue}break}}if(f>n)throw new Error(e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return s.getMilliseconds()!==0&&s.setMilliseconds(0),this.#n=s,s}[Symbol.iterator](){return{next:()=>{try{return{value:this.#h(),done:!1}}catch{return{value:void 0,done:!0}}}}}}e.CronExpression=r,e.default=r})(pN)),pN}var db={},mN;function Q0e(){if(mN)return db;mN=1,Object.defineProperty(db,"__esModule",{value:!0}),db.seededRandom=n;function e(r){let o=2166136261;for(let a=0;a<r.length;a++)o^=r.charCodeAt(a),o=Math.imul(o,16777619);return()=>o>>>0}function t(r){return()=>{let o=r+=1831565813;return o=Math.imul(o^o>>>15,o|1),o^=o+Math.imul(o^o>>>7,o|61),((o^o>>>14)>>>0)/4294967296}}function n(r){const o=r?e(r)():Math.floor(Math.random()*1e10);return t(o)}return db}var gN;function $k(){if(gN)return ui;gN=1,Object.defineProperty(ui,"__esModule",{value:!0}),ui.CronExpressionParser=ui.DayOfWeek=ui.Months=ui.CronUnit=ui.PredefinedExpressions=void 0;const e=$3(),t=M3(),n=Q0e(),r=sT();var o;(function(f){f["@yearly"]="0 0 0 1 1 *",f["@annually"]="0 0 0 1 1 *",f["@monthly"]="0 0 0 1 * *",f["@weekly"]="0 0 0 * * 0",f["@daily"]="0 0 0 * * *",f["@hourly"]="0 0 * * * *",f["@minutely"]="0 * * * * *",f["@secondly"]="* * * * * *",f["@weekdays"]="0 0 0 * * 1-5",f["@weekends"]="0 0 0 * * 0,6"})(o||(ui.PredefinedExpressions=o={}));var a;(function(f){f.Second="Second",f.Minute="Minute",f.Hour="Hour",f.DayOfMonth="DayOfMonth",f.Month="Month",f.DayOfWeek="DayOfWeek"})(a||(ui.CronUnit=a={}));var i;(function(f){f[f.jan=1]="jan",f[f.feb=2]="feb",f[f.mar=3]="mar",f[f.apr=4]="apr",f[f.may=5]="may",f[f.jun=6]="jun",f[f.jul=7]="jul",f[f.aug=8]="aug",f[f.sep=9]="sep",f[f.oct=10]="oct",f[f.nov=11]="nov",f[f.dec=12]="dec"})(i||(ui.Months=i={}));var s;(function(f){f[f.sun=0]="sun",f[f.mon=1]="mon",f[f.tue=2]="tue",f[f.wed=3]="wed",f[f.thu=4]="thu",f[f.fri=5]="fri",f[f.sat=6]="sat"})(s||(ui.DayOfWeek=s={}));let c=class di{static parse(u,h={}){const{strict:g=!1,hashSeed:y}=h,b=(0,n.seededRandom)(y);u=o[u]||u;const S=di.#e(u,g);if(!(S.dayOfMonth==="*"||S.dayOfWeek==="*"||!g))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");const w=di.#t(a.Second,S.second,r.CronSecond.constraints,b),x=di.#t(a.Minute,S.minute,r.CronMinute.constraints,b),R=di.#t(a.Hour,S.hour,r.CronHour.constraints,b),k=di.#t(a.Month,S.month,r.CronMonth.constraints,b),T=di.#t(a.DayOfMonth,S.dayOfMonth,r.CronDayOfMonth.constraints,b),{dayOfWeek:O,nthDayOfWeek:A}=di.#d(S.dayOfWeek),I=di.#t(a.DayOfWeek,O,r.CronDayOfWeek.constraints,b),j=new e.CronFieldCollection({second:new r.CronSecond(w,{rawValue:S.second}),minute:new r.CronMinute(x,{rawValue:S.minute}),hour:new r.CronHour(R,{rawValue:S.hour}),dayOfMonth:new r.CronDayOfMonth(T,{rawValue:S.dayOfMonth}),month:new r.CronMonth(k,{rawValue:S.month}),dayOfWeek:new r.CronDayOfWeek(I,{rawValue:S.dayOfWeek,nthDayOfWeek:A})});return new t.CronExpression(j,{...h,expression:u})}static#e(u,h){if(h&&!u.length)throw new Error("Invalid cron expression");u=u||"0 * * * * *";const g=u.trim().split(/\s+/);if(h&&g.length<6)throw new Error("Invalid cron expression, expected 6 fields");if(g.length>6)throw new Error("Invalid cron expression, too many fields");const y=["*","*","*","*","*","0"];g.length<y.length&&g.unshift(...y.slice(g.length));const[b,S,w,x,R,k]=g;return{second:b,minute:S,hour:w,dayOfMonth:x,month:R,dayOfWeek:k}}static#t(u,h,g,y){if((u===a.Month||u===a.DayOfWeek)&&(h=h.replace(/[a-z]{3}/gi,b=>{b=b.toLowerCase();const S=i[b]||s[b];if(S===void 0)throw new Error(`Validation error, cannot resolve alias "${b}"`);return S.toString()})),!g.validChars.test(h))throw new Error(`Invalid characters, got value: ${h}`);return h=this.#n(h,g),h=this.#o(h,g,y),this.#r(u,h,g)}static#n(u,h){return u.replace(/[*?]/g,h.min+"-"+h.max)}static#o(u,h,g){const y=g();return u.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(b,S,w,x)=>{if(S&&w&&x){const R=parseInt(S,10),k=parseInt(w,10),T=parseInt(x,10);if(R>k)throw new Error(`Invalid range: ${R}-${k}, min > max`);if(T<=0)throw new Error(`Invalid step: ${T}, must be positive`);const O=Math.max(R,h.min),A=Math.floor(y*T),I=[];for(let j=Math.floor(O/T)*T+A;j<=k;j+=T)j>=O&&I.push(j);return I.join(",")}else if(S&&w){const R=parseInt(S,10),k=parseInt(w,10);if(R>k)throw new Error(`Invalid range: ${R}-${k}, min > max`);return String(Math.floor(y*(k-R+1))+R)}else if(x){const R=parseInt(x,10);if(R<=0)throw new Error(`Invalid step: ${R}, must be positive`);const k=Math.floor(y*R),T=[];for(let O=Math.floor(h.min/R)*R+k;O<=h.max;O+=R)O>=h.min&&T.push(O);return T.join(",")}else return String(Math.floor(y*(h.max-h.min+1)+h.min))})}static#r(u,h,g){const y=[];function b(S,w){if(Array.isArray(S))y.push(...S);else if(di.#u(w,S))y.push(S);else{const x=parseInt(S.toString(),10);if(!(x>=w.min&&x<=w.max))throw new Error(`Constraint error, got value ${S} expected range ${w.min}-${w.max}`);y.push(u===a.DayOfWeek?x%7:S)}}return h.split(",").forEach(S=>{if(!(S.length>0))throw new Error("Invalid list value format");b(di.#a(u,S,g),g)}),y}static#a(u,h,g){const y=h.split("/");if(y.length>2)throw new Error(`Invalid repeat: ${h}`);return y.length===2?(y[0].includes("-")||(y[0]=`${y[0]}-${g.max}`),di.#l(u,y[0],parseInt(y[1],10),g)):di.#l(u,h,1,g)}static#s(u,h,g){if(!(!isNaN(u)&&!isNaN(h)&&u>=g.min&&h<=g.max))throw new Error(`Constraint error, got range ${u}-${h} expected range ${g.min}-${g.max}`);if(u>h)throw new Error(`Invalid range: ${u}-${h}, min(${u}) > max(${h})`)}static#i(u){if(!(!isNaN(u)&&u>0))throw new Error(`Constraint error, cannot repeat at every ${u} time.`)}static#c(u,h,g,y){const b=[];u===a.DayOfWeek&&g%7===0&&b.push(0);for(let S=h;S<=g;S+=y)b.indexOf(S)===-1&&b.push(S);return b}static#l(u,h,g,y){const b=h.split("-");if(b.length<=1)return isNaN(+h)?h:+h;const[S,w]=b.map(x=>parseInt(x,10));return this.#s(S,w,y),this.#i(g),this.#c(u,S,w,g)}static#d(u){const h=u.split("#");if(h.length<=1)return{dayOfWeek:h[0]};const g=+h[h.length-1],y=u.match(/([,-/])/);if(y!==null)throw new Error(`Constraint error, invalid dayOfWeek \`#\` and \`${y?.[0]}\` special characters are incompatible`);if(!(h.length<=2&&!isNaN(g)&&g>=1&&g<=5))throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return{dayOfWeek:h[0],nthDayOfWeek:g}}static#u(u,h){return u.chars.some(g=>h.toString().includes(g))}};return ui.CronExpressionParser=c,ui}var Es={};const X0e={},Z0e=Object.freeze(Object.defineProperty({__proto__:null,default:X0e},Symbol.toStringTag,{value:"Module"})),yN=Qne(Z0e);var vN;function J0e(){if(vN)return Es;vN=1;var e=Es&&Es.__createBinding||(Object.create?(function(a,i,s,c){c===void 0&&(c=s);var f=Object.getOwnPropertyDescriptor(i,s);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(a,c,f)}):(function(a,i,s,c){c===void 0&&(c=s),a[c]=i[s]})),t=Es&&Es.__setModuleDefault||(Object.create?(function(a,i){Object.defineProperty(a,"default",{enumerable:!0,value:i})}):function(a,i){a.default=i}),n=Es&&Es.__importStar||(function(){var a=function(i){return a=Object.getOwnPropertyNames||function(s){var c=[];for(var f in s)Object.prototype.hasOwnProperty.call(s,f)&&(c[c.length]=f);return c},a(i)};return function(i){if(i&&i.__esModule)return i;var s={};if(i!=null)for(var c=a(i),f=0;f<c.length;f++)c[f]!=="default"&&e(s,i,c[f]);return t(s,i),s}})();Object.defineProperty(Es,"__esModule",{value:!0}),Es.CronFileParser=void 0;const r=$k();let o=class Lb{static async parseFile(i){const{readFile:s}=await Promise.resolve().then(()=>n(yN)),c=await s(i,"utf8");return Lb.#e(c)}static parseFileSync(i){const{readFileSync:s}=yN,c=s(i,"utf8");return Lb.#e(c)}static#e(i){const s=i.split(`
480
480
  `),c={variables:{},expressions:[],errors:{}};for(const f of s){const u=f.trim();if(u.length===0||u.startsWith("#"))continue;const h=u.match(/^(.*)=(.*)$/);if(h){const[,g,y]=h;c.variables[g]=y.replace(/["']/g,"");continue}try{const g=Lb.#t(u);c.expressions.push(g.interval)}catch(g){c.errors[u]=g}}return c}static#t(i){const s=i.split(" ");return{interval:r.CronExpressionParser.parse(s.slice(0,5).join(" ")),command:s.slice(5,s.length)}}};return Es.CronFileParser=o,Es}var bN;function exe(){return bN||(bN=1,(function(e){var t=Kf&&Kf.__createBinding||(Object.create?(function(f,u,h,g){g===void 0&&(g=h);var y=Object.getOwnPropertyDescriptor(u,h);(!y||("get"in y?!u.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return u[h]}}),Object.defineProperty(f,g,y)}):(function(f,u,h,g){g===void 0&&(g=h),f[g]=u[h]})),n=Kf&&Kf.__exportStar||function(f,u){for(var h in f)h!=="default"&&!Object.prototype.hasOwnProperty.call(u,h)&&t(u,f,h)};Object.defineProperty(e,"__esModule",{value:!0}),e.CronFileParser=e.CronExpressionParser=e.CronExpression=e.CronFieldCollection=e.CronDate=void 0;const r=$k();var o=iT();Object.defineProperty(e,"CronDate",{enumerable:!0,get:function(){return o.CronDate}});var a=$3();Object.defineProperty(e,"CronFieldCollection",{enumerable:!0,get:function(){return a.CronFieldCollection}});var i=M3();Object.defineProperty(e,"CronExpression",{enumerable:!0,get:function(){return i.CronExpression}});var s=$k();Object.defineProperty(e,"CronExpressionParser",{enumerable:!0,get:function(){return s.CronExpressionParser}});var c=J0e();Object.defineProperty(e,"CronFileParser",{enumerable:!0,get:function(){return c.CronFileParser}}),n(sT(),e),e.default=r.CronExpressionParser})(Kf)),Kf}var txe=exe(),xN={exports:{}},SN;function nxe(){return SN||(SN=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,()=>(()=>{var n={949:((i,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CronParser=void 0;var f=c(515),u=(function(){function h(g,y,b){y===void 0&&(y=!0),b===void 0&&(b=!1),this.expression=g,this.dayOfWeekStartIndexZero=y,this.monthStartIndexZero=b}return h.prototype.parse=function(){var g,y,b=(g=this.expression)!==null&&g!==void 0?g:"";if(b==="@reboot")return y=["@reboot","","","","","",""],y;if(b.startsWith("@")){var S=this.parseSpecial(this.expression);y=this.extractParts(S)}else y=this.extractParts(this.expression);return this.normalize(y),this.validate(y),y},h.prototype.parseSpecial=function(g){var y={"@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *","@reboot":"@reboot"},b=y[g];if(!b)throw new Error("Unknown special expression.");return b},h.prototype.extractParts=function(g){if(!this.expression)throw new Error("cron expression is empty");for(var y=g.trim().split(/[ ]+/),b=0;b<y.length;b++)if(y[b].includes(",")){var S=y[b].split(",").map(function(x){return x.trim()}).filter(function(x){return x!==""}).map(function(x){return isNaN(Number(x))?x:Number(x)}).filter(function(x){return x!==null&&x!==""});S.length===0&&S.push("*"),S.sort(function(x,R){return x!==null&&R!==null?x-R:0}),y[b]=S.map(function(x){return x!==null?x.toString():""}).join(",")}if(y.length<5)throw new Error("Expression has only ".concat(y.length," part").concat(y.length==1?"":"s",". At least 5 parts are required."));if(y.length==5)y.unshift(""),y.push("");else if(y.length==6){var w=/\d{4}$/.test(y[5])||y[4]=="?"||y[2]=="?";w?y.unshift(""):y.push("")}else if(y.length>7)throw new Error("Expression has ".concat(y.length," parts; too many!"));return y},h.prototype.normalize=function(g){var y=this;if(g[3]=g[3].replace("?","*"),g[5]=g[5].replace("?","*"),g[2]=g[2].replace("?","*"),g[0].indexOf("0/")==0&&(g[0]=g[0].replace("0/","*/")),g[1].indexOf("0/")==0&&(g[1]=g[1].replace("0/","*/")),g[2].indexOf("0/")==0&&(g[2]=g[2].replace("0/","*/")),g[3].indexOf("1/")==0&&(g[3]=g[3].replace("1/","*/")),g[4].indexOf("1/")==0&&(g[4]=g[4].replace("1/","*/")),g[6].indexOf("1/")==0&&(g[6]=g[6].replace("1/","*/")),g[5]=g[5].replace(/(^\d)|([^#/\s]\d)/g,function(O){var A=O.replace(/\D/,""),I=A;return y.dayOfWeekStartIndexZero?A=="7"&&(I="0"):I=(parseInt(A)-1).toString(),O.replace(A,I)}),g[5]=="L"&&(g[5]="6"),g[3]=="?"&&(g[3]="*"),g[3].indexOf("W")>-1&&(g[3].indexOf(",")>-1||g[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var b={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var S in b)g[5]=g[5].replace(new RegExp(S,"gi"),b[S].toString());g[4]=g[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(O){var A=O.replace(/\D/,""),I=A;return y.monthStartIndexZero&&(I=(parseInt(A)+1).toString()),O.replace(A,I)});var w={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var x in w)g[4]=g[4].replace(new RegExp(x,"gi"),w[x].toString());g[0]=="0"&&(g[0]=""),!/\*|\-|\,|\//.test(g[2])&&(/\*|\//.test(g[1])||/\*|\//.test(g[0]))&&(g[2]+="-".concat(g[2]));for(var R=0;R<g.length;R++)if(g[R].indexOf(",")!=-1&&(g[R]=g[R].split(",").filter(function(O){return O!==""}).join(",")||"*"),g[R]=="*/1"&&(g[R]="*"),g[R].indexOf("/")>-1&&!/^\*|\-|\,/.test(g[R])){var k=null;switch(R){case 4:k="12";break;case 5:k="6";break;case 6:k="9999";break;default:k=null;break}if(k!==null){var T=g[R].split("/");g[R]="".concat(T[0],"-").concat(k,"/").concat(T[1])}}},h.prototype.validate=function(g){var y="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(g[0],y),this.validateOnlyExpectedCharactersFound(g[1],y),this.validateOnlyExpectedCharactersFound(g[2],y),this.validateOnlyExpectedCharactersFound(g[3],"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(g[4],y),this.validateOnlyExpectedCharactersFound(g[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(g[6],y),this.validateAnyRanges(g)},h.prototype.validateAnyRanges=function(g){f.default.secondRange(g[0]),f.default.minuteRange(g[1]),f.default.hourRange(g[2]),f.default.dayOfMonthRange(g[3]),f.default.monthRange(g[4],this.monthStartIndexZero),f.default.dayOfWeekRange(g[5],this.dayOfWeekStartIndexZero)},h.prototype.validateOnlyExpectedCharactersFound=function(g,y){var b=g.match(new RegExp("[^".concat(y,"]+"),"gi"));if(b&&b.length)throw new Error("Expression contains invalid values: '".concat(b.toString(),"'"))},h})();s.CronParser=u}),333:((i,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExpressionDescriptor=void 0;var f=c(823),u=c(949),h=(function(){function g(y,b){if(this.expression=y,this.options=b,this.expressionParts=new Array(5),!this.options.locale&&g.defaultLocale&&(this.options.locale=g.defaultLocale),!g.locales[this.options.locale]){var S=Object.keys(g.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(S,"'.")),this.options.locale=S}this.i18n=g.locales[this.options.locale],b.use24HourTimeFormat===void 0&&(b.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return g.toString=function(y,b){var S=b===void 0?{}:b,w=S.throwExceptionOnParseError,x=w===void 0?!0:w,R=S.verbose,k=R===void 0?!1:R,T=S.dayOfWeekStartIndexZero,O=T===void 0?!0:T,A=S.monthStartIndexZero,I=A===void 0?!1:A,j=S.use24HourTimeFormat,_=S.locale,z=_===void 0?null:_,B={throwExceptionOnParseError:x,verbose:k,dayOfWeekStartIndexZero:O,monthStartIndexZero:I,use24HourTimeFormat:j,locale:z};B.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var E=new g(y,B);return E.getFullDescription()},g.initialize=function(y,b){b===void 0&&(b="en"),g.specialCharacters=["/","-",",","*"],g.defaultLocale=b,y.load(g.locales)},g.prototype.getFullDescription=function(){var y,b,S="";try{var w=new u.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=w.parse(),this.expressionParts[0]==="@reboot")return((b=(y=this.i18n).atReboot)===null||b===void 0?void 0:b.call(y))||"Run once, at startup";var x=this.getTimeOfDayDescription(),R=this.getDayOfMonthDescription(),k=this.getMonthDescription(),T=this.getDayOfWeekDescription(),O=this.getYearDescription();S+=x+R+T+k+O,S=this.transformVerbosity(S,!!this.options.verbose),S=S.charAt(0).toLocaleUpperCase()+S.substr(1)}catch(A){if(!this.options.throwExceptionOnParseError)S=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(A)}return S},g.prototype.getTimeOfDayDescription=function(){var y=this.expressionParts[0],b=this.expressionParts[1],S=this.expressionParts[2],w="";if(!f.StringUtilities.containsAny(b,g.specialCharacters)&&!f.StringUtilities.containsAny(S,g.specialCharacters)&&!f.StringUtilities.containsAny(y,g.specialCharacters))w+=this.i18n.atSpace()+this.formatTime(S,b,y);else if(!y&&b.indexOf("-")>-1&&!(b.indexOf(",")>-1)&&!(b.indexOf("/")>-1)&&!f.StringUtilities.containsAny(S,g.specialCharacters)){var x=b.split("-");w+=f.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(S,x[0],""),this.formatTime(S,x[1],""))}else if(!y&&S.indexOf(",")>-1&&S.indexOf("-")==-1&&S.indexOf("/")==-1&&!f.StringUtilities.containsAny(b,g.specialCharacters)){var R=S.split(",");w+=this.i18n.at();for(var k=0;k<R.length;k++)w+=" ",w+=this.formatTime(R[k],b,""),k<R.length-2&&(w+=","),k==R.length-2&&(w+=this.i18n.spaceAnd())}else{var T=this.getSecondsDescription(),O=this.getMinutesDescription(),A=this.getHoursDescription();if(w+=T,w&&O&&(w+=", "),w+=O,O===A)return w;w&&A&&(w+=", "),w+=A}return w},g.prototype.getSecondsDescription=function(){var y=this,b=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(S){return S},function(S){return f.StringUtilities.format(y.i18n.everyX0Seconds(S),S)},function(S){return y.i18n.secondsX0ThroughX1PastTheMinute()},function(S){return S=="0"?"":parseInt(S)<20?y.i18n.atX0SecondsPastTheMinute(S):y.i18n.atX0SecondsPastTheMinuteGt20()||y.i18n.atX0SecondsPastTheMinute(S)});return b},g.prototype.getMinutesDescription=function(){var y=this,b=this.expressionParts[0],S=this.expressionParts[2],w=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(x){return x},function(x){return f.StringUtilities.format(y.i18n.everyX0Minutes(x),x)},function(x){return y.i18n.minutesX0ThroughX1PastTheHour()},function(x){try{return x=="0"&&S.indexOf("/")==-1&&b==""?y.i18n.everyHour():parseInt(x)<20?y.i18n.atX0MinutesPastTheHour(x):y.i18n.atX0MinutesPastTheHourGt20()||y.i18n.atX0MinutesPastTheHour(x)}catch{return y.i18n.atX0MinutesPastTheHour(x)}});return w},g.prototype.getHoursDescription=function(){var y=this,b=this.expressionParts[2],S=0,w=[];b.split("/")[0].split(",").forEach(function(k){var T=k.split("-");T.length===2&&w.push({value:T[1],index:S+1}),S+=T.length});var x=0,R=this.getSegmentDescription(b,this.i18n.everyHour(),function(k){var T=w.find(function(A){return A.value===k&&A.index===x}),O=T&&y.expressionParts[1]!=="0";return x++,O?y.formatTime(k,"59",""):y.formatTime(k,"0","")},function(k){return f.StringUtilities.format(y.i18n.everyX0Hours(k),k)},function(k){return y.i18n.betweenX0AndX1()},function(k){return y.i18n.atX0()});return R},g.prototype.getDayOfWeekDescription=function(){var y=this,b=this.i18n.daysOfTheWeek(),S=null;return this.expressionParts[5]=="*"?S="":S=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(w,x){var R=w;w.indexOf("#")>-1?R=w.substring(0,w.indexOf("#")):w.indexOf("L")>-1&&(R=R.replace("L",""));var k=parseInt(R),T=y.i18n.daysOfTheWeekInCase?y.i18n.daysOfTheWeekInCase(x)[k]:b[k];if(w.indexOf("#")>-1){var O=null,A=w.substring(w.indexOf("#")+1),I=w.substring(0,w.indexOf("#"));switch(A){case"1":O=y.i18n.first(I);break;case"2":O=y.i18n.second(I);break;case"3":O=y.i18n.third(I);break;case"4":O=y.i18n.fourth(I);break;case"5":O=y.i18n.fifth(I);break}T=O+" "+T}return T},function(w){return parseInt(w)==1?"":f.StringUtilities.format(y.i18n.commaEveryX0DaysOfTheWeek(w),w)},function(w){var x=w.substring(0,w.indexOf("-")),R=y.expressionParts[3]!="*";return R?y.i18n.commaAndX0ThroughX1(x):y.i18n.commaX0ThroughX1(x)},function(w){var x=null;if(w.indexOf("#")>-1){var R=w.substring(w.indexOf("#")+1),k=w.substring(0,w.indexOf("#"));x=y.i18n.commaOnThe(R,k).trim()+y.i18n.spaceX0OfTheMonth()}else if(w.indexOf("L")>-1)x=y.i18n.commaOnTheLastX0OfTheMonth(w.replace("L",""));else{var T=y.expressionParts[3]!="*";x=T?y.i18n.commaAndOnX0():y.i18n.commaOnlyOnX0(w)}return x}),S},g.prototype.getMonthDescription=function(){var y=this,b=this.i18n.monthsOfTheYear(),S=this.getSegmentDescription(this.expressionParts[4],"",function(w,x){return x&&y.i18n.monthsOfTheYearInCase?y.i18n.monthsOfTheYearInCase(x)[parseInt(w)-1]:b[parseInt(w)-1]},function(w){return parseInt(w)==1?"":f.StringUtilities.format(y.i18n.commaEveryX0Months(w),w)},function(w){return y.i18n.commaMonthX0ThroughMonthX1()||y.i18n.commaX0ThroughX1()},function(w){return y.i18n.commaOnlyInMonthX0?y.i18n.commaOnlyInMonthX0():y.i18n.commaOnlyInX0()});return S},g.prototype.getDayOfMonthDescription=function(){var y=this,b=null,S=this.expressionParts[3];switch(S){case"L":b=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":b=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var w=S.match(/(\d{1,2}W)|(W\d{1,2})/);if(w){var x=parseInt(w[0].replace("W","")),R=x==1?this.i18n.firstWeekday():f.StringUtilities.format(this.i18n.weekdayNearestDayX0(),x.toString());b=f.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),R);break}else{var k=S.match(/L-(\d{1,2})/);if(k){var T=k[1];b=f.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(T),T);break}else{if(S=="*"&&this.expressionParts[5]!="*")return"";b=this.getSegmentDescription(S,this.i18n.commaEveryDay(),function(O){return O=="L"?y.i18n.lastDay():y.i18n.dayX0?f.StringUtilities.format(y.i18n.dayX0(),O):O},function(O){return O=="1"?y.i18n.commaEveryDay():y.i18n.commaEveryX0Days(O)},function(O){return y.i18n.commaBetweenDayX0AndX1OfTheMonth(O)},function(O){return y.i18n.commaOnDayX0OfTheMonth(O)})}break}}return b},g.prototype.getYearDescription=function(){var y=this,b=this.getSegmentDescription(this.expressionParts[6],"",function(S){return/^\d+$/.test(S)?new Date(parseInt(S),1).getFullYear().toString():S},function(S){return f.StringUtilities.format(y.i18n.commaEveryX0Years(S),S)},function(S){return y.i18n.commaYearX0ThroughYearX1()||y.i18n.commaX0ThroughX1()},function(S){return y.i18n.commaOnlyInYearX0?y.i18n.commaOnlyInYearX0():y.i18n.commaOnlyInX0()});return b},g.prototype.getSegmentDescription=function(y,b,S,w,x,R){var k=null,T=y.indexOf("/")>-1,O=y.indexOf("-")>-1,A=y.indexOf(",")>-1;if(!y)k="";else if(y==="*")k=b;else if(!T&&!O&&!A)k=f.StringUtilities.format(R(y),S(y));else if(A){for(var I=y.split(","),j="",_=0;_<I.length;_++)if(_>0&&I.length>2&&(j+=",",_<I.length-1&&(j+=" ")),_>0&&I.length>1&&(_==I.length-1||I.length==2)&&(j+="".concat(this.i18n.spaceAnd()," ")),I[_].indexOf("/")>-1||I[_].indexOf("-")>-1){var z=I[_].indexOf("-")>-1&&I[_].indexOf("/")==-1,B=this.getSegmentDescription(I[_],b,S,w,z?this.i18n.commaX0ThroughX1:x,R);z&&(B=B.replace(", ","")),j+=B}else T?j+=this.getSegmentDescription(I[_],b,S,w,x,R):j+=S(I[_]);T?k=j:k=f.StringUtilities.format(R(y),j)}else if(T){var I=y.split("/");if(k=f.StringUtilities.format(w(I[1]),I[1]),I[0].indexOf("-")>-1){var E=this.generateRangeSegmentDescription(I[0],x,S);E.indexOf(", ")!=0&&(k+=", "),k+=E}else if(I[0].indexOf("*")==-1){var L=f.StringUtilities.format(R(I[0]),S(I[0]));L=L.replace(", ",""),k+=f.StringUtilities.format(this.i18n.commaStartingX0(),L)}}else O&&(k=this.generateRangeSegmentDescription(y,x,S));return k},g.prototype.generateRangeSegmentDescription=function(y,b,S){var w="",x=y.split("-"),R=S(x[0],1),k=S(x[1],2),T=b(y);return w+=f.StringUtilities.format(T,R,k),w},g.prototype.formatTime=function(y,b,S){var w=0,x=0,R=parseInt(y)+w,k=parseInt(b)+x;k>=60?(k-=60,R+=1):k<0&&(k+=60,R-=1),R>=24?R=R-24:R<0&&(R=24+R);var T="",O=!1;this.options.use24HourTimeFormat||(O=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),T=O?"".concat(this.getPeriod(R)," "):" ".concat(this.getPeriod(R)),R>12&&(R-=12),R===0&&(R=12));var A="";return S&&(A=":".concat(("00"+S).substring(S.length))),"".concat(O?T:"").concat(("00"+R.toString()).substring(R.toString().length),":").concat(("00"+k.toString()).substring(k.toString().length)).concat(A).concat(O?"":T)},g.prototype.transformVerbosity=function(y,b){if(!b&&(y=y.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),y=y.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),y=y.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),y=y.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var S=0,w=Object.entries(this.i18n.conciseVerbosityReplacements());S<w.length;S++){var x=w[S],R=x[0],k=x[1];y=y.replace(new RegExp(R,"g"),k)}return y},g.prototype.getPeriod=function(y){return y>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},g.locales={},g})();s.ExpressionDescriptor=h}),747:((i,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.enLocaleLoader=void 0;var f=c(486),u=(function(){function h(){}return h.prototype.load=function(g){g.en=new f.en},h})();s.enLocaleLoader=u}),486:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.en=void 0;var c=(function(){function f(){}return f.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},f.prototype.atX0MinutesPastTheHourGt20=function(){return null},f.prototype.commaMonthX0ThroughMonthX1=function(){return null},f.prototype.commaYearX0ThroughYearX1=function(){return null},f.prototype.use24HourTimeFormatByDefault=function(){return!1},f.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},f.prototype.everyMinute=function(){return"every minute"},f.prototype.everyHour=function(){return"every hour"},f.prototype.atSpace=function(){return"At "},f.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},f.prototype.at=function(){return"At"},f.prototype.spaceAnd=function(){return" and"},f.prototype.everySecond=function(){return"every second"},f.prototype.everyX0Seconds=function(){return"every %s seconds"},f.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},f.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},f.prototype.everyX0Minutes=function(){return"every %s minutes"},f.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},f.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},f.prototype.everyX0Hours=function(){return"every %s hours"},f.prototype.betweenX0AndX1=function(){return"between %s and %s"},f.prototype.atX0=function(){return"at %s"},f.prototype.commaEveryDay=function(){return", every day"},f.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},f.prototype.commaX0ThroughX1=function(){return", %s through %s"},f.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},f.prototype.first=function(){return"first"},f.prototype.second=function(){return"second"},f.prototype.third=function(){return"third"},f.prototype.fourth=function(){return"fourth"},f.prototype.fifth=function(){return"fifth"},f.prototype.commaOnThe=function(){return", on the "},f.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},f.prototype.lastDay=function(){return"the last day"},f.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},f.prototype.commaOnlyOnX0=function(){return", only on %s"},f.prototype.commaAndOnX0=function(){return", and on %s"},f.prototype.commaEveryX0Months=function(){return", every %s months"},f.prototype.commaOnlyInX0=function(){return", only in %s"},f.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},f.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},f.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},f.prototype.firstWeekday=function(){return"first weekday"},f.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},f.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},f.prototype.commaEveryX0Days=function(){return", every %s days"},f.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},f.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},f.prototype.commaEveryHour=function(){return", every hour"},f.prototype.commaEveryX0Years=function(){return", every %s years"},f.prototype.commaStartingX0=function(){return", starting %s"},f.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},f.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},f.prototype.atReboot=function(){return"Run once, at startup"},f})();s.en=c}),515:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0});function c(u,h){if(!u)throw new Error(h)}var f=(function(){function u(){}return u.secondRange=function(h){for(var g=h.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var b=parseInt(g[y],10);c(b>=0&&b<=59,"seconds part must be >= 0 and <= 59")}},u.minuteRange=function(h){for(var g=h.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var b=parseInt(g[y],10);c(b>=0&&b<=59,"minutes part must be >= 0 and <= 59")}},u.hourRange=function(h){for(var g=h.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var b=parseInt(g[y],10);c(b>=0&&b<=23,"hours part must be >= 0 and <= 23")}},u.dayOfMonthRange=function(h){for(var g=h.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var b=parseInt(g[y],10);c(b>=1&&b<=31,"DOM part must be >= 1 and <= 31")}},u.monthRange=function(h,g){for(var y=h.split(","),b=0;b<y.length;b++)if(!isNaN(parseInt(y[b],10))){var S=parseInt(y[b],10);c(S>=1&&S<=12,g?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},u.dayOfWeekRange=function(h,g){for(var y=h.split(","),b=0;b<y.length;b++)if(!isNaN(parseInt(y[b],10))){var S=parseInt(y[b],10);c(S>=0&&S<=6,g?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},u})();s.default=f}),823:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.StringUtilities=void 0;var c=(function(){function f(){}return f.format=function(u){for(var h=[],g=1;g<arguments.length;g++)h[g-1]=arguments[g];return u.replace(/%s/g,function(y){return h.shift()})},f.containsAny=function(u,h){return h.some(function(g){return u.indexOf(g)>-1})},f})();s.StringUtilities=c})},r={};function o(i){var s=r[i];if(s!==void 0)return s.exports;var c=r[i]={exports:{}};return n[i](c,c.exports,o),c.exports}var a={};return(()=>{var i=a;Object.defineProperty(i,"__esModule",{value:!0}),i.toString=void 0;var s=o(333),c=o(747);s.ExpressionDescriptor.initialize(new c.enLocaleLoader),i.default=s.ExpressionDescriptor;var f=s.ExpressionDescriptor.toString;i.toString=f})(),a})())})(xN)),xN.exports}var rxe=nxe();const oxe=sc(rxe),axe=new Set(["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC","SUN","MON","TUE","WED","THU","FRI","SAT"]);function ixe(e){for(const t of e.trim().split(/\s+/)){if(/[#?]/.test(t))return!1;for(const n of t.split(/[,\-/]/))if(!(n===""||n==="*")&&/[A-Za-z]/.test(n)&&!axe.has(n.toUpperCase()))return!1}return!0}function lT(e){const t=(e??"").trim();if(t.split(/\s+/).filter(Boolean).length!==5)return{valid:!1,description:"",nextRun:null,error:"Expected a 5-field UNIX cron: minute hour day-of-month month day-of-week."};if(!ixe(t))return{valid:!1,description:"",nextRun:null,error:"Unsupported cron syntax: L, W, #, and ? extensions are not allowed (plain 5-field UNIX cron only)."};try{const n=oxe.toString(t,{use24HourTimeFormat:!0,verbose:!1}),r=txe.CronExpressionParser.parse(t,{tz:"UTC"}).next().toDate();return{valid:!0,description:n,nextRun:r}}catch(n){return{valid:!1,description:"",nextRun:null,error:n instanceof Error?n.message:"Invalid cron expression."}}}function O3(e){return e?e.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",timeZone:"UTC",hour12:!1})+" UTC":"—"}function sxe({onSubmit:e,isSubmitting:t,disabled:n,disabledReason:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(!1),c=()=>a(!1),f=async()=>{try{await e({forceRefresh:i}),a(!1)}catch{}},u=m.jsx("span",{children:m.jsx(xy,{label:"Materialization",onClick:()=>a(!0),disabled:n})});return m.jsxs(m.Fragment,{children:[n&&r?m.jsx(Jo,{title:r,children:u}):u,m.jsx($o,{open:o,onClose:c,title:"New materialization",description:"Compile the package, build a table for every persist source, and load them so queries serve from the tables.",actions:m.jsxs(m.Fragment,{children:[m.jsx(tr,{onClick:c,children:"Cancel"}),m.jsx(tr,{variant:"contained",loading:t,onClick:f,children:"Materialize"})]}),children:m.jsx(UK,{children:m.jsx($R,{control:m.jsx(VL,{checked:i,onChange:h=>s(h.target.checked)}),label:"Force refresh (rebuild even if unchanged)"})})})]})}function zb({children:e}){return m.jsx(Ct,{variant:"caption",component:"h6",sx:{display:"block",textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:"text.secondary",mb:1},children:e})}function S0(e){return e===Ra.Pending||e===Ra.ManifestRowsReady}function lxe(e){return e===Ra.ManifestFileReady||e===Ra.Failed||e===Ra.Cancelled}function P3(e){switch(e){case Ra.ManifestFileReady:return"Done";case Ra.Failed:return"Failed";case Ra.Cancelled:return"Cancelled";case Ra.Pending:case Ra.ManifestRowsReady:return"Pending";default:return"Unknown"}}function Mk(e){switch(e){case Ra.ManifestRowsReady:return"info";case Ra.ManifestFileReady:return"success";case Ra.Failed:return"error";case Ra.Cancelled:return"warning";case Ra.Pending:default:return"default"}}function cxe(e){const t=Object.values(cT(e).refusedSources??{}).map(r=>({name:r.name,message:r.message})),n=Object.values(e.manifest?.failures??{}).filter(r=>r.refused).map(r=>({name:r.sourceName??r.sourceEntityId,message:r.reason}));return[...t,...n].sort((r,o)=>r.name.localeCompare(o.name))}function A3(e,t){const n=[`${e.sourcesBuilt??0} built`,`${e.sourcesReused??0} reused`];return e.sourcesRefused&&n.push(`${e.sourcesRefused} refused`),n.join(t)}function cT(e){return e.metadata??{}}function uxe(e){return e.trigger==="SCHEDULER"?"Scheduled":"Manual"}function D3(e,t){if(!e)return"-";const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),o=Math.max(0,r-n);if(o<1e3)return`${o}ms`;const a=Math.round(o/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60),s=a%60;if(i<60)return`${i}m ${s}s`;const c=Math.floor(i/60),f=i%60;return`${c}h ${f}m`}function Ok(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function dxe(e){if(!e)return"-";const t=new Date(e).getTime(),n=Math.round((Date.now()-t)/1e3);if(n<60)return"just now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function fxe({entries:e,builtAt:t}){const n=Object.entries(e??{});return m.jsxs(mt,{children:[m.jsxs(Wn,{direction:"row",alignItems:"baseline",justifyContent:"space-between",children:[m.jsx(zb,{children:"Build manifest"}),t&&m.jsxs(Ct,{variant:"caption",color:"text.secondary",children:["Built ",Ok(t)]})]}),n.length===0?m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"No materialized tables yet."}):m.jsxs(ix,{size:"small",children:[m.jsx(cx,{children:m.jsxs(iu,{children:[m.jsx(ur,{children:"Source"}),m.jsx(ur,{children:"Table name"}),m.jsx(ur,{children:"Connection"}),m.jsx(ur,{children:"Realization"}),m.jsx(ur,{align:"right",children:"Rows"})]})}),m.jsx(lx,{children:n.map(([r,o])=>m.jsxs(iu,{children:[m.jsx(ur,{sx:{fontFamily:Uo},children:o.sourceName??r}),m.jsx(ur,{sx:{fontFamily:Uo},children:o.physicalTableName??"-"}),m.jsx(ur,{sx:{fontFamily:Uo},children:o.connectionName??"-"}),m.jsx(ur,{children:o.realization??"-"}),m.jsx(ur,{align:"right",children:o.rowCount??"-"})]},r))})]})]})}function j3({meta:e}){const t=e.trigger==="SCHEDULER";return m.jsx(Jo,{title:t?"Fired by the materialization schedule":"Triggered manually",children:m.jsx(Ct,{variant:"body2",color:"text.secondary",children:uxe(e)})})}function pxe({materialization:e,buildPlan:t,onClose:n}){const r=e?cT(e):{},o=e?cxe(e):[],a=Object.values(t?.sources??{});return m.jsx(rx,{open:e!==null,onClose:n,maxWidth:"md",fullWidth:!0,"aria-labelledby":"materialization-detail-title",children:e&&m.jsxs(m.Fragment,{children:[m.jsxs(ax,{sx:{pr:6,pb:1.5},id:"materialization-detail-title",children:[m.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1,sx:{mb:.75},children:[m.jsx(ER,{size:"small",label:P3(e.status),color:Mk(e.status),variant:S0(e.status)?"filled":"outlined"}),m.jsx(j3,{meta:r})]}),m.jsx(Ct,{variant:"subtitle1",sx:{fontWeight:600},children:e.packageName??"Materialization"}),m.jsx(Ct,{variant:"caption",color:"text.secondary",sx:{fontFamily:Uo,wordBreak:"break-all"},children:e.id}),m.jsx(xo,{"aria-label":"close",onClick:n,sx:{position:"absolute",right:8,top:8},children:m.jsx(Xp,{fontSize:"small"})})]}),m.jsxs(ox,{dividers:!0,children:[m.jsxs(mt,{sx:{bgcolor:"action.hover",borderRadius:2,p:2,mb:3,display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:2},children:[m.jsx(Wm,{label:"Started",value:Ok(e.startedAt??e.createdAt)}),m.jsx(Wm,{label:"Completed",value:Ok(e.completedAt)}),m.jsx(Wm,{label:"Duration",value:D3(e.startedAt,e.completedAt)}),m.jsx(Wm,{label:"Sources",value:A3(r," · ")}),m.jsx(Wm,{label:"Force refresh",value:r.forceRefresh?"Yes":"No"})]}),e.error&&m.jsxs(mt,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"error.main"},children:[m.jsx(zb,{children:m.jsx(mt,{component:"span",sx:{color:"error.main"},children:"Error"})}),m.jsx(Ct,{variant:"body2",sx:{fontFamily:Uo,whiteSpace:"pre-wrap"},children:e.error})]}),o.length>0&&m.jsxs(mt,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"warning.main"},children:[m.jsx(zb,{children:m.jsx(mt,{component:"span",sx:{color:"warning.main"},children:"Refused sources"})}),m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{mb:1},children:"Not built, because materializing them would be unsafe. They serve live until the model changes."}),o.map(i=>m.jsxs(mt,{sx:{mt:1},children:[m.jsx(Ct,{variant:"body2",sx:{fontFamily:Uo},children:i.name}),m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-wrap"},children:i.message})]},i.name))]}),m.jsxs(mt,{sx:{mb:3},children:[m.jsx(zb,{children:"Build plan"}),a.length===0?m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"This package has no persist sources."}):m.jsxs(ix,{size:"small",children:[m.jsx(cx,{children:m.jsxs(iu,{children:[m.jsx(ur,{children:"Source"}),m.jsx(ur,{children:"Connection"}),m.jsx(ur,{children:"Dialect"}),m.jsx(ur,{align:"right",children:"Columns"}),m.jsx(ur,{children:"Source Entity ID"})]})}),m.jsx(lx,{children:a.map(i=>m.jsxs(iu,{children:[m.jsx(ur,{sx:{fontFamily:Uo},children:i.name}),m.jsx(ur,{sx:{fontFamily:Uo},children:i.connectionName}),m.jsx(ur,{children:i.dialect??"-"}),m.jsx(ur,{align:"right",children:i.columns?.length??0}),m.jsx(ur,{sx:{fontFamily:Uo,fontSize:"0.75rem",wordBreak:"break-all",maxWidth:220},children:i.sourceEntityId})]},i.sourceID))})]})]}),m.jsx(fxe,{entries:e.manifest?.entries,builtAt:e.manifest?.builtAt})]})]})})}function Wm({label:e,value:t}){return m.jsxs(mt,{children:[m.jsx(Ct,{variant:"caption",color:"text.secondary",display:"block",children:e}),m.jsx(Ct,{variant:"body2",children:t})]})}const hxe=kn(m.jsx("path",{d:"M6 6h12v12H6z"}));function mxe(e){return un("PrivateSwitchBase",e)}nn("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const gxe=e=>{const{classes:t,checked:n,disabled:r,edge:o}=e,a={root:["root",n&&"checked",r&&"disabled",o&&`edge${Et(o)}`],input:["input"]};return ln(a,mxe,t)},yxe=Ze($d,{name:"MuiSwitchBase"})({padding:9,borderRadius:"50%",variants:[{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>e==="start"&&t.size!=="small",style:{marginLeft:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>e==="end"&&t.size!=="small",style:{marginRight:-12}}]}),vxe=Ze("input",{name:"MuiSwitchBase",shouldForwardProp:Qa})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),bxe=C.forwardRef(function(e,t){const{autoFocus:n,checked:r,checkedIcon:o,defaultChecked:a,disabled:i,disableFocusRipple:s=!1,edge:c=!1,icon:f,id:u,inputProps:h,inputRef:g,name:y,onBlur:b,onChange:S,onFocus:w,readOnly:x,required:R=!1,tabIndex:k,type:T,value:O,slots:A={},slotProps:I={},...j}=e,[_,z]=Ci({controlled:r,default:!!a,name:"SwitchBase",state:"checked"}),B=Oi(),E=oe=>{w&&w(oe),B&&B.onFocus&&B.onFocus(oe)},L=oe=>{b&&b(oe),B&&B.onBlur&&B.onBlur(oe)},N=oe=>{if(oe.nativeEvent.defaultPrevented)return;const J=oe.target.checked;z(J),S&&S(oe,J)};let F=i;B&&typeof F>"u"&&(F=B.disabled);const D=T==="checkbox"||T==="radio",W={...e,checked:_,disabled:F,disableFocusRipple:s,edge:c},K=gxe(W),ae={slots:A,slotProps:{input:h,...I}},[Y,re]=cr("root",{ref:t,elementType:yxe,className:K.root,shouldForwardComponentProp:!0,externalForwardedProps:{...ae,component:"span",...j},getSlotProps:oe=>({...oe,onFocus:J=>{oe.onFocus?.(J),E(J)},onBlur:J=>{oe.onBlur?.(J),L(J)}}),ownerState:W,additionalProps:{centerRipple:!0,focusRipple:!s,disabled:F,role:void 0,tabIndex:null}}),[ue,X]=cr("input",{ref:g,elementType:vxe,className:K.input,externalForwardedProps:ae,getSlotProps:oe=>({...oe,onChange:J=>{oe.onChange?.(J),N(J)}}),ownerState:W,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:F,id:D?u:void 0,name:y,readOnly:x,required:R,tabIndex:k,type:T,...T==="checkbox"&&O===void 0?{}:{value:O}}});return m.jsxs(Y,{...re,children:[m.jsx(ue,{...X}),_?o:f]})}),xxe=kn(m.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})),Sxe=kn(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})),wxe=kn(m.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}));function Cxe(e){return un("MuiCheckbox",e)}const zw=nn("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),kxe=e=>{const{classes:t,indeterminate:n,color:r,size:o}=e,a={root:["root",n&&"indeterminate",`color${Et(r)}`,`size${Et(o)}`]},i=ln(a,Cxe,t);return{...t,...i}},Rxe=Ze(bxe,{shouldForwardProp:e=>Qa(e)||e==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${Et(n.size)}`],n.color!=="default"&&t[`color${Et(n.color)}`]]}})(Yn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Ea()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Ea()).map(([t])=>({props:{color:t},style:{[`&.${zw.checked}, &.${zw.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${zw.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),Exe=m.jsx(Sxe,{}),Txe=m.jsx(xxe,{}),$xe=m.jsx(wxe,{}),Mxe=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiCheckbox"}),{checkedIcon:r=Exe,color:o="primary",icon:a=Txe,indeterminate:i=!1,indeterminateIcon:s=$xe,inputProps:c,size:f="medium",disableRipple:u=!1,className:h,slots:g={},slotProps:y={},...b}=n,S=i?s:a,w=i?s:r,x={...n,disableRipple:u,color:o,indeterminate:i,size:f},R=kxe(x),k=y.input??c,[T,O]=cr("root",{ref:t,elementType:Rxe,className:Bt(R.root,h),shouldForwardComponentProp:!0,externalForwardedProps:{slots:g,slotProps:y,...b},ownerState:x,additionalProps:{type:"checkbox",icon:C.cloneElement(S,{fontSize:S.props.fontSize??f}),checkedIcon:C.cloneElement(w,{fontSize:w.props.fontSize??f}),disableRipple:u,slots:g,slotProps:{input:Rz(typeof k=="function"?k(x):k,{"data-indeterminate":i})}}});return m.jsx(T,{...O,classes:R})});function Oxe(e){return un("MuiFormControlLabel",e)}const cg=nn("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error","required","asterisk"]),Pxe=e=>{const{classes:t,disabled:n,labelPlacement:r,error:o,required:a}=e,i={root:["root",n&&"disabled",`labelPlacement${Et(r)}`,o&&"error",a&&"required"],label:["label",n&&"disabled"],asterisk:["asterisk",o&&"error"]};return ln(i,Oxe,t)},Axe=Ze("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${cg.label}`]:t.label},t.root,t[`labelPlacement${Et(n.labelPlacement)}`]]}})(Yn(({theme:e})=>({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${cg.disabled}`]:{cursor:"default"},[`& .${cg.label}`]:{[`&.${cg.disabled}`]:{color:(e.vars||e).palette.text.disabled}},variants:[{props:{labelPlacement:"start"},style:{flexDirection:"row-reverse",marginRight:-11}},{props:{labelPlacement:"top"},style:{flexDirection:"column-reverse"}},{props:{labelPlacement:"bottom"},style:{flexDirection:"column"}},{props:({labelPlacement:t})=>t==="start"||t==="top"||t==="bottom",style:{marginLeft:16}}]}))),Dxe=Ze("span",{name:"MuiFormControlLabel",slot:"Asterisk"})(Yn(({theme:e})=>({[`&.${cg.error}`]:{color:(e.vars||e).palette.error.main}}))),jxe=C.forwardRef(function(e,t){const n=Kn({props:e,name:"MuiFormControlLabel"}),{checked:r,className:o,componentsProps:a={},control:i,disabled:s,disableTypography:c,inputRef:f,label:u,labelPlacement:h="end",name:g,onChange:y,required:b,slots:S={},slotProps:w={},value:x,...R}=n,k=Oi(),T=s??i.props.disabled??k?.disabled,O=b??i.props.required,A={disabled:T,required:O};["checked","name","onChange","value","inputRef"].forEach(N=>{typeof i.props[N]>"u"&&typeof n[N]<"u"&&(A[N]=n[N])});const I=Fd({props:n,muiFormControl:k,states:["error"]}),j={...n,disabled:T,labelPlacement:h,required:O,error:I.error},_=Pxe(j),z={slots:S,slotProps:{...a,...w}},[B,E]=cr("typography",{elementType:Sr,externalForwardedProps:z,ownerState:j});let L=u;return L!=null&&L.type!==Sr&&!c&&(L=m.jsx(B,{component:"span",...E,className:Bt(_.label,E?.className),children:L})),m.jsxs(Axe,{className:Bt(_.root,o),ownerState:j,ref:t,...R,children:[C.cloneElement(i,A),O?m.jsxs("div",{children:[L,m.jsxs(Dxe,{ownerState:j,"aria-hidden":!0,className:_.asterisk,children:[" ","*"]})]}):L]})});function Nxe({materialization:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(!1),c=()=>a(!0),f=()=>{a(!1),s(!1),t()};return m.jsxs(Sn.Fragment,{children:[m.jsxs(_o,{"aria-label":`Delete materialization ${e?.id??""}`.trim(),onClick:u=>{u.stopPropagation(),c()},sx:{color:"error.main"},children:[m.jsx(oT,{sx:{color:"inherit"},children:m.jsx(yx,{fontSize:"small"})}),m.jsx(aT,{children:"Delete"})]}),m.jsxs($o,{open:o,onClose:f,title:"Delete materialization",actions:m.jsxs(m.Fragment,{children:[m.jsx(yo,{onClick:f,children:"Cancel"}),m.jsx(yo,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>r(i),loading:n,children:"Delete run"})]}),children:[m.jsx(Sr,{variant:"body2",children:"Delete this run's record? This cannot be undone."}),m.jsx(jxe,{control:m.jsx(Mxe,{checked:i,onChange:u=>s(u.target.checked)}),label:"Also drop the materialized tables this run produced"})]})]})}function Ixe({materializations:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){return e.length===0?m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{py:1,fontStyle:"italic"},children:"No materializations yet."}):m.jsxs(ix,{size:"small",sx:{"& td, & th":{borderColor:"divider"},"& td:first-of-type, & th:first-of-type":{pl:0},"& td:last-of-type, & th:last-of-type":{pr:0},"& th":{color:"text.secondary",fontWeight:600}},children:[m.jsx(cx,{children:m.jsxs(iu,{children:[m.jsx(ur,{children:"Status"}),m.jsx(ur,{children:"Trigger"}),m.jsx(ur,{children:"Started"}),m.jsx(ur,{children:"Duration"}),m.jsx(ur,{children:"Sources"}),m.jsx(ur,{align:"right",children:"Actions"})]})}),m.jsx(lx,{children:e.map(i=>m.jsx(Lxe,{materialization:i,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a},i.id))})]})}function Lxe({materialization:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){const[i,s]=C.useState(null),c=!!i,f=()=>s(null),u=cT(e),h=u.sourcesBuilt!==void 0||u.sourcesReused!==void 0?A3(u,", "):"-",g=S0(e.status),y=lxe(e.status),b=e.error??void 0,S=t&&(g||y);return m.jsxs(iu,{hover:!0,sx:{cursor:"pointer","&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"-2px"}},onClick:()=>a(e),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),a(e))},role:"button",tabIndex:0,"aria-label":`View materialization ${e.id??""} details`.trim(),children:[m.jsx(ur,{children:m.jsxs(mt,{sx:{display:"flex",alignItems:"center",gap:.5},children:[m.jsx(Ct,{variant:"body2",sx:{fontWeight:500,color:Mk(e.status)==="default"?"text.primary":`${Mk(e.status)}.main`},children:P3(e.status)}),b&&m.jsx(Jo,{title:b,children:m.jsx(zF,{fontSize:"small",color:"error"})})]})}),m.jsx(ur,{children:m.jsx(j3,{meta:u})}),m.jsx(ur,{children:dxe(e.startedAt??e.createdAt)}),m.jsx(ur,{children:D3(e.startedAt,e.completedAt)}),m.jsx(ur,{children:h}),m.jsx(ur,{align:"right",onClick:w=>w.stopPropagation(),children:S&&m.jsxs(m.Fragment,{children:[m.jsx(xo,{size:"small","aria-label":`Materialization actions for ${e.id??""}`.trim(),onClick:w=>s(w.currentTarget),children:m.jsx(vx,{fontSize:"small"})}),m.jsxs(nc,{anchorEl:i,open:c,onClose:f,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[t&&g&&m.jsxs(Qo,{"aria-label":`Stop materialization ${e.id??""}`.trim(),disabled:n,onClick:()=>{f(),r(e)},children:[m.jsx(il,{children:m.jsx(hxe,{fontSize:"small"})}),m.jsx(bi,{children:"Stop"})]}),t&&y&&m.jsx(Nxe,{materialization:e,isMutating:n,onCloseDialog:f,onDelete:w=>o(e,w)})]})]})})]})}const zxe=kn(m.jsx("path",{d:"m11.99 18.54-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27zm0-11.47L17.74 9 12 13.47 6.26 9z"})),Fxe={package:"Materialized artifacts are shared across versions",version:"Materialized artifacts are per published version"};function _xe({scope:e,disabled:t,disabledReason:n,isSubmitting:r,onChange:o}){const[a,i]=C.useState(null),s=async c=>{i(null),c!==e&&await o(c).catch(()=>{})};return m.jsxs(m.Fragment,{children:[m.jsx(Sy,{label:"Scope",icon:m.jsx(zxe,{}),onClick:c=>i(c.currentTarget),disabled:t||r,...n?{disabledReason:n}:{},ariaHasPopup:"menu",ariaLabel:`Scope: ${e}`}),m.jsx(nc,{anchorEl:a,open:!!a,onClose:()=>i(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:["package","version"].map(c=>m.jsxs(Qo,{selected:c===e,onClick:()=>void s(c),children:[m.jsx(il,{sx:{minWidth:32},children:c===e&&m.jsx(Dz,{fontSize:"small"})}),m.jsx(bi,{primary:c,secondary:Fxe[c]})]},c))})]})}const Uxe=kn([m.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),m.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")]),wN="0 6 * * *";function Bxe({currentSchedule:e,isSubmitting:t,disabled:n,disabledReason:r,onSubmit:o}){const[a,i]=C.useState(!1),[s,c]=C.useState(e??wN),f=()=>{c(e??wN),i(!0)},u=()=>i(!1),h=lT(s),g=async y=>{try{await o(y),i(!1)}catch{}};return m.jsxs(m.Fragment,{children:[m.jsx(Sy,{label:"Schedule",icon:m.jsx(Uxe,{}),onClick:f,disabled:n,...r?{disabledReason:r}:{},ariaHasPopup:"dialog",ariaLabel:e?"Edit schedule":"Set schedule"}),m.jsxs($o,{open:a,onClose:u,title:e?"Edit schedule":"Set schedule",description:"The publisher rebuilds this package's materializations on this cadence: a 5-field UNIX cron, in UTC. In a hosted deployment the change takes effect on your next publish.",actions:m.jsxs(m.Fragment,{children:[e&&m.jsx(tr,{color:"error",loading:t,onClick:()=>g(null),sx:{mr:"auto"},children:"Clear schedule"}),m.jsx(tr,{onClick:u,children:"Cancel"}),m.jsx(tr,{variant:"contained",loading:t,disabled:!h.valid,onClick:()=>g(s.trim()),children:"Save schedule"})]}),children:[m.jsx(wi,{autoFocus:!0,fullWidth:!0,size:"small",label:"Cron expression",value:s,onChange:y=>c(y.target.value),error:s.trim()!==""&&!h.valid,helperText:h.valid?`${h.description} · next run ${O3(h.nextRun)}`:h.error,slotProps:{htmlInput:{style:{fontFamily:Uo}}}}),m.jsxs(go,{severity:"info",children:["A schedule runs only on version-scoped packages, so saving one sets ",m.jsx("code",{children:"scope: version"})," for this package."]})]})]})}const Vxe=3e3;function Hxe({resourceUri:e,versioned:t=!1}){const{apiClients:n,mutable:r}=hr(),o=xl(),{environmentName:a,packageName:i,versionId:s}=to(e),[c,f]=C.useState(""),[u,h]=C.useState(null);if(!i)throw new Error("Materializations requires a package in the resource URI");const g=To({queryKey:["materializations",a,i,s],queryFn:()=>n.materializations.listMaterializations(a,i,void 0,void 0,s),refetchInterval:F=>(F.state.data?.data??[]).some(D=>S0(D.status))?Vxe:!1}),y=To({queryKey:["package",a,i,s],queryFn:()=>n.packages.getPackage(a,i,s)}),b=()=>o.invalidateQueries({queryKey:["materializations",a,i]}),S=al({mutationFn:Ql("materialization","create",F=>n.materializations.createMaterialization(a,i,{forceRefresh:F.forceRefresh,...s!==void 0?{versionId:s}:{}})),onSuccess(){f("Materialization requested"),b()},onError(F){f(F.message),b()}}),w=al({mutationFn:Ql("materialization","update",F=>n.materializations.materializationAction(a,i,F.id,Hee.Stop,s)),onSuccess(){f("Materialization stopped"),b()},onError(F){f(F.message)}}),x=al({mutationFn:Ql("materialization","delete",({materialization:F,dropTables:D})=>n.materializations.deleteMaterialization(a,i,F.id,D,s)),onSuccess(){f("Materialization deleted"),b()},onError(F){f(F.message)}}),R=y.data?.data,k=al({mutationFn:Ql("schedule","update",F=>n.packages.updatePackage(a,i,{name:i,description:R?.description,...F?{scope:Wv.Version}:{},materialization:{schedule:F}})),onSuccess(F,D){f(D?"Schedule updated":"Schedule cleared"),o.invalidateQueries({queryKey:["package",a,i]})},onError(F){f(F.message)}}),T=al({mutationFn:Ql("scope","update",F=>n.packages.updatePackage(a,i,{name:i,description:R?.description,scope:F})),onSuccess(){f("Scope updated"),o.invalidateQueries({queryKey:["package",a,i]})},onError(F){f(F.message)}}),O=g.data?.data??[],A=O.find(F=>F.id===u)??null,I=O.some(F=>S0(F.status)),j=S.isPending||w.isPending||x.isPending,_=R?.materialization?.schedule??null,z=R?.scope===Wv.Version?"version":"package",B=!!R?.manifestLocation,E=!!R?.materialization?.freshness,L=_?lT(_):null,N=B?"Control-plane managed: refresh is driven by the control plane, not the built-in scheduler.":[L?L.valid?`${L.description} (${_}), next run ${O3(L.nextRun)}`:`Unrecognized cron expression (${_})`:E?"Refreshed by a freshness policy; a cron schedule does not apply":"On demand only, no schedule set",`scope: ${z}`].join(" · ");return m.jsxs(m.Fragment,{children:[m.jsxs($s,{title:"Materializations",count:g.isSuccess?O.length:void 0,action:r&&m.jsxs(Wn,{direction:"row",spacing:1,alignItems:"center",children:[!B&&!t&&m.jsx(_xe,{scope:z,disabled:!!_,disabledReason:"A schedule requires version scope. Clear the schedule to change it.",isSubmitting:T.isPending,onChange:F=>T.mutateAsync(F==="version"?Wv.Version:Wv.Package)}),!B&&!t&&m.jsx(Bxe,{currentSchedule:_,isSubmitting:k.isPending,disabled:E,disabledReason:"This package declares a freshness policy; a schedule and freshness are mutually exclusive.",onSubmit:F=>k.mutateAsync(F)}),m.jsx(sxe,{onSubmit:F=>S.mutateAsync(F),isSubmitting:S.isPending,disabled:I,disabledReason:"A materialization is already pending or running for this package."})]}),children:[y.isSuccess&&m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:N}),g.isError&&m.jsx(Ma,{error:g.error,context:`${a} > ${i} > Materializations`}),!g.isSuccess&&!g.isError&&m.jsx(va,{text:"Loading materializations..."}),g.isSuccess&&m.jsx(Ixe,{materializations:O,mutable:r,isMutating:j,onStop:F=>w.mutate(F),onDelete:(F,D)=>x.mutate({materialization:F,dropTables:D}),onViewDetails:F=>h(F.id??null)})]}),m.jsx(pxe,{materialization:A,buildPlan:y.data?.data?.buildPlan??null,onClose:()=>h(null)}),m.jsx(dy,{open:c!=="",autoHideDuration:6e3,onClose:()=>f(""),message:c})]})}const N3=kn(m.jsx("path",{d:"M17 7h-4v2h4c1.65 0 3 1.35 3 3s-1.35 3-3 3h-4v2h4c2.76 0 5-2.24 5-5s-2.24-5-5-5m-6 8H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4zm-3-4h8v2H8z"})),qxe=kn(m.jsx("path",{d:"M8 5v14l11-7z"})),Fw={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"}]}}},Wxe={...Fw,patterns:[...Fw.patterns,{include:"#docvar"}],repository:{...Fw.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},Yxe={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"}]}}},Kxe="github-light",Gxe="github-dark";let _w;function Qxe(){return _w||(_w=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:a},{default:i}]=await Promise.all([Ro(()=>import("./core-B8oMW4sm.es-hOkwvru5.js"),__vite__mapDeps([3,4])),Ro(()=>import("./engine-oniguruma-C4vnmooL.es-jdkXmgTr.js"),[]),Ro(()=>import("./sql-DCkt643-.es-COK4E0Yg.js"),[]),Ro(()=>import("./json-71t8ZF9g.es-BQoSv7ci.js"),[]),Ro(()=>import("./typescript-buWNZFwO.es-Dj6nwHGl.js"),[]),Ro(()=>import("./github-light-JYsPkUQd.es-DAi9KRSo.js"),[]),Ro(()=>import("./github-dark-DenFmJkN.es-DHJKELXO.js"),[])]);return e({engine:t(Ro(()=>import("./wasm-DQxwEHae.es-CG6Dc4jp.js"),[])),themes:[a,i],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...Wxe},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...Yxe}]})})()),_w}async function I3(e,t,n="light"){return(await Qxe()).codeToHtml(e,{lang:t,theme:n==="dark"?Gxe:Kxe})}function L3({open:e,onClose:t,result:n,title:r="Results",renderLogs:o,drill:a}){return m.jsx($o,{open:e,onClose:t,title:r,maxWidth:!1,showClose:!0,children:m.jsx(mt,{sx:{height:"70vh",overflow:"auto"},children:m.jsx(QE,{result:n,maxHeight:aie,maxResultSize:1e6,renderLogs:o,drill:a})})})}function Xxe({queryName:e,annotations:t,resourceUri:n,runOnDemand:r=!1,maxResultSize:o=0}){const[a,i]=Sn.useState(),[s,c]=Sn.useState(!1),[f,u]=Sn.useState(!1),{packageName:h,environmentName:g,versionId:y,modelPath:b}=to(n),S=!r||f,w=rT({environmentName:g,packageName:h,modelPath:b,versionId:y,queryName:e},{enabled:S}),x=w.data,{mode:R}=eo();return C.useEffect(()=>{if(t&&t.length>0){const k=t.map(T=>`// ${T}`).join(`
481
- `);I3(k,"typescript",R).then(T=>{i(T)})}},[t,R]),m.jsxs(mt,{children:[a&&m.jsx(mt,{sx:{marginBottom:"16px"},children:m.jsx(Ct,{fontSize:"12px",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:m.jsx("div",{className:"content",dangerouslySetInnerHTML:{__html:a}})})}),m.jsxs(mt,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[m.jsx(Ct,{variant:"body2",sx:{fontSize:"15px",fontWeight:600,color:"text.primary",px:2,py:1,bgcolor:"action.hover",borderRadius:1.5,border:1,borderColor:"divider"},children:e}),m.jsx(bp,{"aria-label":"Expand results",onClick:()=>c(!0),children:m.jsx(Mp,{})})]}),m.jsxs(_5,{sx:{position:"relative"},children:[r&&!f&&m.jsxs(mt,{sx:{padding:"40px 20px",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[m.jsx(Ct,{variant:"body2",color:"text.secondary",children:"Click Run to execute the query"}),m.jsx(tr,{variant:"contained",startIcon:m.jsx(qxe,{}),onClick:()=>u(!0),children:"Run Query"})]}),S&&m.jsx(XE,{state:w,context:e,maxHeight:oie,maxResultSize:o})]}),m.jsx(L3,{open:s,onClose:()=>c(!1),result:x?.data?.result||"",renderLogs:x?.data?.renderLogs,title:`Query: ${e}`})]})}function Zxe(e){return e!=null}function Jxe(e,t){const n=[],r=[];for(const a of e){if(a.name===void 0||Zxe(t.get(a.name)))continue;if(a.default==null){n.push(a.name);continue}const i=YE(a.type??"string",a.default);i&&r.push(`${a.name} = ${i}`)}const o={missing:n};return r.length>0&&(o.defaultsNote=r.length===1?`Ran with the default ${r[0]}`:`Ran with defaults ${r.join(", ")}`),o}function e1e(e){return e.length===1?`This source may need a value for the given ${e[0]}. Set it in the parameters above.`:`This source may need values for the givens ${e.join(", ")}. Set them in the parameters above.`}function t1e({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a,givens:i,gate:s}){return Sn.useEffect(()=>{o&&o(t)},[t,o]),m.jsx(F5,{children:m.jsxs(o8,{spacing:2,component:"section",children:[m.jsx(r1e,{sourceAndPath:e[t],existingQuery:n,onChange:c=>{r&&r(c)},resourceUri:a,givens:i,gate:s}),m.jsx(II,{height:"5px"})]})})}function Uw(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function n1e({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a,givens:i,gate:s}){const[c,f]=Sn.useState(n||Uw()),[u,h]=Sn.useState(void 0);Sn.useEffect(()=>{n&&f(n)},[n]);const[g,y]=Sn.useState([]),{MalloyExplorerProvider:b,QueryPanel:S,ResizableCollapsiblePanel:w,ResultPanel:x,SourcePanel:R}=r;Sn.useEffect(()=>{t&&t(c)},[t,c]);const{environmentName:k,packageName:T,versionId:O}=to(a),{apiClients:A}=hr(),I=Sn.useRef(void 0),j=al({mutationFn:()=>{I.current=s,h({executionState:"running",query:c?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{j.reset(),h(void 0)},response:{}});const E=typeof c?.malloyQuery=="string"?c.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:c?.malloyQuery}).toMalloy();return f({...c,query:E}),A.models.executeQueryModel(k,T,e.modelPath,{query:E,sourceName:void 0,queryName:void 0,versionId:O,...i&&Object.keys(i).length>0?{givens:i}:{}})},onSuccess:E=>{if(E){const L=JSON.parse(E.data.result);f({...c,malloyResult:L});const N=I.current;h(F=>F?{...F,executionState:"finished",response:{result:L,...N?.defaultsNote?{messages:[{severity:"INFO",title:N.defaultsNote}]}:{}}}:void 0)}},onError:E=>{console.error("Query execution error:",E);const L=E?.data?.message??E?.message??"The query could not be run.",N=[{severity:"ERROR",title:L}],F=I.current?.missing??[];(E?.status===403||/Access denied for source/i.test(L))&&F.length>0&&N.push({severity:"WARN",title:e1e(F)}),h(D=>D?{...D,executionState:"finished",response:{messages:N}}:void 0)}}),[_,z]=Sn.useState(e.sourceInfo.name);Sn.useEffect(()=>{_!==e.sourceInfo.name&&(z(e.sourceInfo.name),f(Uw()),h(void 0))},[e,_]);const B=Sn.useCallback(E=>{f({...c,malloyQuery:E,malloyResult:void 0})},[c]);return _!==e.sourceInfo.name?m.jsx("div",{children:"Loading..."}):m.jsx(U5,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:m.jsx(b,{source:e.sourceInfo,query:c?.malloyQuery,topValues:[],onFocusedNestViewPathChange:y,focusedNestViewPath:g,onQueryChange:B,children:m.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[m.jsx(w,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:m.jsx(R,{onRefresh:()=>f(Uw())})}),m.jsx(w,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:m.jsx(S,{runQuery:()=>{console.log(`running query with: ${c?.malloyQuery}`);try{j.mutate()}catch(E){console.error("Error running query:",E)}}})}),m.jsx(x,{source:e.sourceInfo,draftQuery:c?.malloyQuery,setDraftQuery:E=>f({...c,malloyQuery:E}),submittedQuery:u,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function r1e(e){const[t,n]=C.useState(null),[r,o]=C.useState(null),[a,i]=C.useState(!0);return C.useEffect(()=>{let s=!0;return Promise.all([Ro(()=>import("./index-g1sInkiO.js"),__vite__mapDeps([5,0,1,2,6])),uve()]).then(([c,f])=>{s&&(n(c),o(f),i(!1))}).catch(c=>{console.error("Failed to load Malloy components:",c),s&&i(!1)}),()=>{s=!1}},[]),a||!t||!r?m.jsx(vee,{children:m.jsx(U5,{children:m.jsx(II,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):m.jsx(n1e,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function z3(e,t=!0){const{modelPath:n,environmentName:r,packageName:o,versionId:a}=to(e),{apiClients:i}=hr();return To({queryKey:["package",r,o,n,a],queryFn:async()=>(await i.models.getModel(r,o,n,a)).data,enabled:t})}function F3({data:e,onChange:t,existingQuery:n,initialSelectedSourceIndex:r=0,onSourceChange:o,resourceUri:a,givens:i,onGivensChange:s,startingGivens:c}){const[f,u]=Sn.useState(r);Sn.useEffect(()=>{u(r)},[r]);const{data:h,isError:g,isLoading:y,error:b}=z3(a,!e),{environmentName:S,packageName:w,modelPath:x,versionId:R}=to(a),k=e||h,T=Sn.useMemo(()=>k?.givens??[],[k]),O=bE({specs:T,loaded:!!k,params:i,onGivensChange:s,startingValues:c,documentKey:a,autorun:!0,environmentName:S??"",packageName:w??"",modelPath:x,versionId:R,documentName:x}),A=C.useMemo(()=>Zp(O.applied,O.declaredTypes),[O.applied,O.declaredTypes]),I=C.useMemo(()=>Jxe(T,O.applied),[T,O.applied]);if(y&&!e)return m.jsx(va,{text:"Fetching Model..."});if(g&&!e)return console.log("error",b),m.jsx(Ma,{error:b,context:`ModelExplorer > ${x}`});if(!k)return m.jsx(va,{text:zp.loading});const j=(k?.sourceInfos||[]).map((z,B)=>{try{return JSON.parse(z)?.name||`Source ${B+1}`}catch{return`Source ${B+1}`}}),_=j[f]||"";return m.jsxs(gee,{variant:"outlined",children:[m.jsx(yee,{children:m.jsx(Wn,{sx:{flexDirection:"row"},children:m.jsx(N0e,{size:"small",id:"size-small-standard",disablePortal:!0,options:j,value:_,onChange:(z,B)=>{if(!B)return;const E=j.indexOf(B);E>=0&&(u(E),o?.(E))},renderInput:z=>m.jsx(gr,{...z}),style:{width:350,marginTop:"3px",marginLeft:"6px",marginBottom:"8px"}})})}),m.jsx(GE,{...O.panel}),m.jsx(F5,{children:m.jsxs(Wn,{spacing:2,component:"section",children:[Array.isArray(k.sourceInfos)&&k.sourceInfos.length>0&&m.jsx(t1e,{sourceAndPaths:k.sourceInfos.map(z=>({sourceInfo:JSON.parse(z),modelPath:x})),selectedSourceIndex:f,existingQuery:n,onQueryChange:t,resourceUri:a,givens:A,gate:I}),m.jsx(mt,{height:"5px"})]})})]})}function _3({open:e,onClose:t,resourceUri:n,data:r,title:o="Data Sources",hasValidImport:a=!0,existingQuery:i,initialSelectedSourceIndex:s,onChange:c,onSourceChange:f,givens:u,onGivensChange:h,startingGivens:g}){return m.jsxs(rx,{open:e,onClose:t,fullScreen:!0,children:[m.jsxs(ax,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o,m.jsx(xo,{onClick:t,sx:{color:"text.secondary"},children:m.jsx(Xp,{})})]}),m.jsx(ox,{children:a?m.jsx(F3,{resourceUri:n,data:r,existingQuery:i,initialSelectedSourceIndex:s,onChange:c,onSourceChange:f,givens:u,onGivensChange:h,startingGivens:g}):m.jsx("div",{children:"No valid import statement found in cell"})})]})}function yCe({onChange:e,resourceUri:t,runOnDemand:n=!1,maxResultSize:r=0,givens:o,onGivensChange:a}){const{modelPath:i}=to(t),{data:s,isError:c,isLoading:f,error:u}=z3(t),[h,g]=Sn.useState(!1),[y,b]=Sn.useState(),[S,w]=Sn.useState(0),[x,R]=C.useState(""),[k,T]=Sn.useState({}),O=o??k,A=a??(E=>T(E)),I=s?.modelDef,j=Sn.useMemo(()=>{if(!I)return!1;try{const E=JSON.parse(I);return Array.isArray(E.imports)&&E.imports.length>0}catch{return!1}},[I]);if(f)return m.jsx(va,{text:"Fetching Model..."});if(c)return console.log("error",u),m.jsx(Ma,{error:u,context:`Model > ${i}`});const _=E=>{b(E),e&&e(E)},z=E=>{w(E)},B=()=>{const E=window.location.href;navigator.clipboard.writeText(E).then(()=>R("URL copied to clipboard!")).catch(()=>R("Failed to copy URL"))};return m.jsxs(m.Fragment,{children:[m.jsxs(mt,{sx:{position:"relative",maxWidth:"1200px",margin:"0 auto",paddingTop:"24px"},children:[Array.isArray(s?.sourceInfos)&&s.sourceInfos.length>0&&m.jsxs(Wn,{spacing:2,component:"section",children:[m.jsxs(mt,{sx:{padding:"0 0 16px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[m.jsx(Ct,{variant:"h1",sx:{fontSize:"28px",fontWeight:"600",color:"#1a1a1a",marginBottom:"8px",marginTop:"0",paddingLeft:"0"},children:"Sources"}),m.jsx(Jo,{title:"Copy link",children:m.jsx(xo,{size:"small","aria-label":"Copy link",onClick:B,sx:{color:"text.secondary"},children:m.jsx(N3,{fontSize:"small"})})})]}),m.jsx(F3,{data:s,onChange:_,onSourceChange:z,existingQuery:y,initialSelectedSourceIndex:S,resourceUri:t,givens:O,onGivensChange:A}),m.jsx(bp,{"aria-label":"Expand results",sx:{position:"absolute",top:"90px",right:"4px",zIndex:2},onClick:()=>g(!0),children:m.jsx(Mp,{})})]}),s?.queries?.length>0&&m.jsxs(Wn,{spacing:2,component:"section",sx:{marginTop:"24px"},children:[m.jsx(mt,{sx:{padding:"0 0 16px 0"},children:m.jsx(Ct,{variant:"h2",sx:{fontSize:"24px",fontWeight:"600",color:"#1a1a1a",marginBottom:"0",marginTop:"8px",paddingLeft:"0"},children:"Named Queries"})}),s.queries.map(E=>m.jsx(Xxe,{queryName:E.name,annotations:E.annotations,resourceUri:t,runOnDemand:n,maxResultSize:r},E.name))]}),(!Array.isArray(s?.sourceInfos)||s.sourceInfos.length===0)&&!(s?.queries&&s.queries.length>0)&&m.jsxs(mt,{sx:{textAlign:"center",py:6},children:[m.jsx(Ct,{variant:"body1",sx:{color:"text.secondary",marginBottom:"8px"},children:"This model exposes no sources or queries."}),j&&m.jsxs(Ct,{variant:"body2",color:"text.secondary",children:["It imports other files but re-exports nothing. Add"," ",m.jsxs("code",{children:["export ","{ source_name }"]})," to surface imported sources here."]})]}),m.jsx(_3,{open:h,onClose:()=>g(!1),resourceUri:t,data:s,title:`Model: ${i.split("/").pop()}`,existingQuery:y,initialSelectedSourceIndex:S,onChange:_,onSourceChange:z,givens:O,onGivensChange:A})]}),m.jsx(dy,{open:x!=="",autoHideDuration:6e3,onClose:()=>R(""),message:x})]})}function o1e({warnings:e}){const[t,n]=C.useState(!1),r=(e??[]).filter(a=>a.severity==="error"),o=(e??[]).filter(a=>a.severity!=="error");return r.length===0&&o.length===0?null:m.jsxs(Wn,{sx:{gap:1,mb:4},children:[r.length>0&&m.jsxs(go,{severity:"warning",children:[m.jsx(GW,{children:r.length===1?"1 problem in this package":`${r.length} problems in this package`}),m.jsx(CN,{findings:r})]}),o.length>0&&m.jsxs(mt,{children:[m.jsxs(tr,{size:"small","aria-expanded":t,onClick:()=>n(a=>!a),sx:{px:.5,color:"text.secondary"},children:[t?"Hide":"Show"," ",o.length," ",o.length===1?"note":"notes"]}),t&&m.jsx(mt,{sx:{pl:.5,pt:.5},children:m.jsx(CN,{findings:o})})]})]})}function CN({findings:e}){return m.jsx(Wn,{component:"ul",sx:{m:0,p:0,listStyle:"none",gap:.75},children:e.map((t,n)=>m.jsxs(Ct,{component:"li",variant:"body2",children:[t.model&&m.jsx(mt,{component:"span",sx:{fontFamily:Uo,fontSize:"0.85em",mr:1},children:t.model}),t.message]},`${t.model??""}:${t.code??""}:${n}`))})}function a1e({resourceUri:e,path:t,givens:n,onGivensChange:r,onNavigate:o,onLinkNavigate:a,height:i,maxResultSize:s,onEvent:c,chrome:f,manifestStaleTime:u,actions:h,rowsActions:g}){const y=to(e),{apiClients:b}=hr(),S=y.environmentName??"",w=y.packageName??"",x=y.versionId,R=!!y.environmentName&&!!y.packageName,{data:k,isSuccess:T,isError:O,error:A}=To({...Ove(b,{environmentName:S,packageName:w,path:t,versionId:x},u),enabled:R&&t!==""}),I=k?.layout,j=Tie({path:t,layout:I},c),_=`${e}|${t}`,z=C.useRef(void 0),B=C.useRef({key:_,at:yd()});B.current.key!==_&&(B.current={key:_,at:yd()}),C.useEffect(()=>{z.current!==_&&(R?O?(z.current=_,j.emit({type:"report.load_failed",surface:"view",category:s0(A)})):k?.notebook?.format==="malloynb"?(z.current=_,j.emit({type:"report.load_failed",surface:"view",category:"unsupported"})):T&&k&&(z.current=_,j.emit({type:"report.opened",surface:"view",from:"package",tiles:k.tiles?.length??0,durationMs:yd()-B.current.at})):(z.current=_,j.emit({type:"report.load_failed",surface:"view",category:"invalid"})))},[_,R,O,A,T,k,j]);const E=C.useCallback((F,D)=>{const W=o?.(F,D);W&&j.emit({type:"report.drill",to:"report",outcome:W})},[o,j]),L=o?E:void 0;if(!R)return m.jsxs(go,{severity:"error",children:["A report resource URI must name an environment and a package. Received: ",e]});if(O)return m.jsx(Ma,{context:`${S} > ${w} > ${t}`,error:A});if(!T||!k)return m.jsx(va,{text:zp.opening("report")});if(k.notebook?.format==="malloynb")return m.jsxs(go,{severity:"info",children:[t," is a .malloynb notebook, which Report does not run: render it with Notebook."]});const N=m.jsx(v3,{manifest:k,environmentName:S,packageName:w,versionId:x,documentName:t,givens:n,onGivensChange:r,onNavigate:L,...a?{onLinkNavigate:a}:{},height:i,maxResultSize:s,chrome:f,...h!==void 0?{actions:h}:{},...g!==void 0?{rowsActions:g}:{}});return m.jsx(Hz.Provider,{value:j,children:N})}function i1e({open:e,layout:t,kind:n,allowLayoutChange:r,allowKindChange:o,environmentName:a,packageName:i,versionId:s,models:c,modelsLoading:f=!1,modelsError:u,onRetryModels:h,target:g,savedAs:y,onClose:b,onCreated:S,onEvent:w}){const x=t??(n?e3(n):"linear"),R=r??o??!0,[k,T]=C.useState(x),[O,A]=C.useState(void 0),[I,j]=C.useState(""),[_,z]=C.useState(""),[B,E]=C.useState(""),L=C.useRef(null),[N,F]=C.useState(""),[D,W]=C.useState(!1),[K,ae]=C.useState(!1),[Y,re]=C.useState(!1),[ue,X]=C.useState(void 0),oe=u!=null,{choices:J,isLoading:ee,isSuccess:te,failed:de,retry:ce,canRetry:fe}=$ve({environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},models:c,enabled:e&&c.length>0}),he=C.useMemo(()=>J.get(I)??[],[J,I]),me=C.useMemo(()=>new Map([...J.entries()].flatMap(([ct,Lt])=>Lt.map(en=>[Bw(ct,en.source,en.view),{model:ct,source:en.source,view:en.view}]))),[J]),le=C.useMemo(()=>{const ct=J.size>1;return[...J.entries()].flatMap(([Lt,en])=>{const En=new Map;for(const $n of en)En.set($n.source,[...En.get($n.source)??[],$n]);return[...En.entries()].map(([$n,Fn])=>({key:`${Lt}::${$n}`,label:$n,ariaLabel:`${$n} in ${Lt}`,...ct||Fn[0]?.sourceDescription?{detail:[ct?Lt:void 0,Fn[0]?.sourceDescription].filter(Boolean).join(" · ")}:{},entries:Fn.map(Wt=>({key:Bw(Lt,Wt.source,Wt.view),name:Wt.view,title:Wt.description??Tw(Wt.view),...Wt.chart?{chart:Wt.chart}:{}}))}))})},[J]),be=ct=>{const Lt=me.get(ct);Lt&&(j(Lt.model),z(`${Lt.source}::${Lt.view}`))},Ie=he.find(ct=>`${ct.source}::${ct.view}`===_),Ne=Ie?Bw(I,Ie.source,Ie.view):void 0,ge=s1e(Ie,250);C.useEffect(()=>{e&&T(x)},[e,x]),C.useEffect(()=>{if(!e)return;const ct=[...J.keys()];I===""&&ct.length>0&&j(ct[0])},[e,J,I]),C.useEffect(()=>{!e||he.length===0||_!==""||z(`${he[0].source}::${he[0].view}`)},[e,he,_]),C.useEffect(()=>{!e||D||Ie===void 0||F(Tw(Ie.view))},[e,D,Ie]),C.useEffect(()=>{e||(j(""),z(""),E(""),F(""),W(!1),A(void 0),ae(!1),X(void 0))},[e]);const se=C.useMemo(()=>{if(N.trim()!=="")for(let ct=1;ct<=nT;ct++){const Lt=QF(N,ct);if(!g.existing?.includes(Lt))return Lt}},[N,g]),Ge=O?.trim(),Ae=Ge===void 0||Ge===""?void 0:Ge.endsWith(".malloy")?Ge:`${Ge}.malloy`,Qe=Ae??se,rt=Ae===void 0?void 0:XF(Ae)??(g.existing?.includes(Ae)?`${Ae} already exists; choose another location.`:void 0),_t=(Ie===void 0?void 0:eT({title:N,modelPath:I,source:Ie.source,view:Ie.view}))??(N.trim()!==""&&Qe===void 0?"No free file name for this title; choose another.":void 0),Ut=_t!==void 0&&(K||N.trim()!==""),ot=f||ee,{theme:tt}=eo(),ft=tt.ui,Le=Id(tt.cardBorder),xe=J.size===0&&(oe||de.length>0),He=ot?"Loading the model":xe?"Couldn't read the model to start from":J.size===0?"Nothing in the model to start from yet":Ie===void 0?"Pick what to start from":void 0,$e="report",kt=Y?`Creating ${$e}…`:`Create ${$e}`,Rt=_!==""&&Ie===void 0&&he.length>0,bt=async()=>{if(!(He!==void 0||Ie===void 0||Y)){if(_t!==void 0||rt!==void 0){ae(!0);return}re(!0),X(void 0);try{const ct=await Cve({layout:k,...Ae!==void 0?{path:Ae}:{},document:{title:N,modelPath:I,source:Ie.source,view:Ie.view},target:g,...w?{onEvent:w}:{}});S(ct)}catch(ct){const Lt=ct.response?.data?.message;X(Lt??(ct instanceof Error?ct.message:String(ct)))}finally{re(!1)}}},st=ct=>m.jsx(tr,{color:"inherit",size:"small",onClick:ct,children:"Retry"});return m.jsx($o,{className:`${hl.dialog} ${hl.newReportDialog}`,maxWidth:"md",initialFocus:L,open:e,onClose:Y?()=>{}:b,title:`New ${$e}`,description:"A report is a Malloy file in the package that lays out text and queries. Pick what its first query shows; the rest is the builder.",actions:m.jsxs(m.Fragment,{children:[m.jsx(tr,{onClick:b,disabled:Y,children:"Cancel"}),m.jsx(Jo,{title:Y?"":He??"",children:m.jsx("span",{children:m.jsx(tr,{variant:"contained",disabled:Y||He!==void 0,"aria-label":!Y&&He!==void 0?`${kt}: ${He}`:kt,onClick:()=>void bt(),children:kt})})})]}),children:m.jsxs(Wn,{sx:{gap:1.5},children:[oe?m.jsx(go,{severity:"error",action:h&&rz(u)?st(h):void 0,children:"Couldn't read this package's models, so no view is listed to start from."}):c.length===0?!f&&m.jsxs(go,{severity:"info",children:["This package has no models yet. Add a .malloy file that declares a source with a view, then create a ",$e," from it."]}):de.length>0?m.jsxs(go,{severity:"warning",action:fe?st(ce):void 0,children:["Couldn't read ",de.join(", "),", so nothing from"," ",de.length===1?"it":"them"," is listed."]}):te&&J.size===0&&m.jsxs(go,{severity:"info",children:["A ",$e," starts from a view of a source, and no model in this package declares one yet. Add a view to a source in a model file and this list fills in."]}),m.jsxs(mt,{sx:{mx:-3,mb:-1,borderTop:`1px solid ${Le}`,borderBottom:`1px solid ${Le}`,display:"grid",gridTemplateColumns:{xs:"1fr",md:"320px minmax(0, 1fr)"},height:{md:500}},children:[m.jsx(mt,{sx:{display:"flex",flexDirection:"column",minHeight:0,borderRight:{md:`1px solid ${Le}`},maxHeight:{xs:280,md:"none"}},children:m.jsx(Xae,{groups:le,query:B,onQuery:E,picked:Ne,onPick:be,onTake:ct=>{be(ct)},searchRef:L,disabled:Y,empty:m.jsx(Ct,{variant:"body2",sx:{color:"text.secondary",p:2},children:ot?"Reading the package's models…":"Nothing to start from."})})}),m.jsxs(mt,{sx:ct=>({p:2.5,display:"flex",flexDirection:"column",gap:2,minHeight:0,overflowY:"auto",bgcolor:`color-mix(in srgb, ${ct.palette.text.primary} 3%, ${ct.palette.background.paper})`}),children:[R&&m.jsxs(mt,{children:[m.jsx(kN,{children:"Layout"}),m.jsx(mt,{role:"radiogroup","aria-label":"Layout",sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:["linear","grid"].map(ct=>m.jsx(u1e,{layout:ct,checked:k===ct,disabled:Y,onPick:()=>T(ct)},ct))}),m.jsx(Ct,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"Switch it any time in the builder."})]}),m.jsxs(mt,{children:[m.jsx(kN,{children:"First query"}),m.jsx(mt,{role:"region","aria-label":"Preview",sx:ct=>({height:200,display:"flex",position:"relative",overflow:"hidden",borderRadius:ft.radius.tile,border:`1px solid ${Le}`,bgcolor:ct.palette.background.paper,"&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:40,pointerEvents:"none",background:`linear-gradient(to bottom, transparent, ${ct.palette.background.paper})`}}),children:Ie&&ge?m.jsx(mt,{sx:{flex:1,minWidth:0,px:2,pt:1.5},children:m.jsx(o3,{environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},modelPath:I,tile:`${ge.source} -> ${ge.view}`,label:N.trim()||Tw(ge.view),borderless:!0,givens:l1e,declaredTypes:c1e,height:180})}):m.jsx(Ct,{variant:"body2",sx:{color:"text.secondary",m:"auto"},children:Rt?"What you picked is no longer in this model; pick something else.":"Pick what to start from."})}),m.jsx(Ct,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"More are added in the builder."})]}),m.jsx(wi,{size:"small",label:"Title",value:N,disabled:Y,onChange:ct=>{W(!0),F(ct.target.value)},InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Report title"},error:Ut,helperText:Ut?_t:g.route==="package"?"Names the file too, unless you type a location.":y??`Saved as a new ${$e} in the host's store, and opened in the builder.`}),m.jsx(wi,{size:"small",label:"Location",value:O??se??"",placeholder:"report.malloy",disabled:Y,onChange:ct=>A(ct.target.value),InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Location"},error:rt!==void 0,helperText:rt??(Qe?`Written as ${Qe} in the package, and opened in the builder.`:"A path in the package; the package root by default.")}),ue&&m.jsx(go,{severity:"error",children:ue})]})]})]})})}function s1e(e,t){const[n,r]=C.useState(void 0);return C.useEffect(()=>{const o=window.setTimeout(()=>r(e),t);return()=>window.clearTimeout(o)},[e,t]),n}const Bw=(e,t,n)=>`${e}::${t}::${n}`,l1e=new Map,c1e=new Map;function kN({children:e}){const t=eo().theme.ui;return m.jsx(Ct,{component:"div",sx:{...t.type.label,color:"text.secondary",mb:.75},children:e})}function u1e({layout:e,checked:t,disabled:n,onPick:r}){const{theme:o}=eo(),a=o.ui,i=Id(o.cardBorder),s=t?o.accent:"currentColor";return m.jsxs(dl,{role:"radio","aria-checked":t,"aria-label":e==="linear"?"Linear":"Grid",disabled:n,onClick:r,sx:c=>({justifyContent:"flex-start",gap:1.25,px:1.25,py:1,borderRadius:a.radius.tile,border:`1px solid ${t?o.accent:i}`,boxShadow:t?`0 0 0 1px ${o.accent}`:"none",bgcolor:t?`color-mix(in srgb, ${o.accent} 6%, ${c.palette.background.paper})`:c.palette.background.paper,color:c.palette.text.secondary,textAlign:"left"}),children:[m.jsx("svg",{width:"34",height:"26",viewBox:"0 0 34 26","aria-hidden":!0,children:e==="linear"?m.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[m.jsx("rect",{x:"3",y:"2",width:"28",height:"7",rx:"1.5"}),m.jsx("rect",{x:"3",y:"12",width:"28",height:"5",rx:"1.5"}),m.jsx("path",{d:"M5 21.5h20",strokeLinecap:"round"})]}):m.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[m.jsx("rect",{x:"2",y:"2",width:"14",height:"10",rx:"1.5"}),m.jsx("rect",{x:"18",y:"2",width:"14",height:"10",rx:"1.5"}),m.jsx("rect",{x:"2",y:"14",width:"30",height:"10",rx:"1.5"})]})}),m.jsxs(mt,{children:[m.jsx(mt,{sx:{...a.type.control,fontWeight:t?a.type.label.fontWeight:500,color:t?o.accent:"text.primary"},children:e==="linear"?"Linear":"Grid"}),m.jsx(mt,{sx:{...a.type.caption,color:"text.secondary"},children:e==="linear"?"Read top to bottom":"Tiles side by side"})]})]})}const d1e=kn(m.jsx("path",{d:"M21 11h-1.5v-.5h-2v3h2V13H21v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1zM8 10v5H6.5v-1.5h-2V15H3v-5c0-.55.45-1 1-1h3c.55 0 1 .45 1 1m-1.5.5h-2V12h2zm7 1.5c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1h-4V9h4c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1M11 10.5v.75h2v-.75zm2 2.25h-2v.75h2z"})),f1e=kn(m.jsx("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V10h16zm0-13H4V5h16z"})),p1e=kn(m.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),h1e=kn(m.jsx("path",{d:"M4 7v2c0 .55-.45 1-1 1H2v4h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h3v-2H7c-.55 0-1-.45-1-1v-2c0-1.3-.84-2.42-2-2.83v-.34C5.16 11.42 6 10.3 6 9V7c0-.55.45-1 1-1h3V4H7C5.35 4 4 5.35 4 7m17 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-3v2h3c.55 0 1 .45 1 1v2c0 1.3.84 2.42 2 2.83v.34c-1.16.41-2 1.52-2 2.83v2c0 .55-.45 1-1 1h-3v2h3c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-4z"})),m1e=kn(m.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"})),g1e=kn(m.jsx("path",{d:"M20 10V8h-4V4h-2v4h-4V4H8v4H4v2h4v4H4v2h4v4h2v-4h4v4h2v-4h4v-2h-4v-4zm-6 4h-4v-4h4z"})),y1e=kn(m.jsx("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6m0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4m0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),v1e=kn(m.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"})),U3={dashboard:qr.blue,report:qr.violet,model:qr.cyan,dataApp:qr.pink,data:qr.lime,materialization:qr.amber,agent:qr.red};function B3({type:e,size:t=18,sx:n,...r}){return m.jsx(i0,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:b1e[e]()})}const b1e={report:x1e,model:S1e,data:w1e,materialization:C1e,dataApp:E1e,dashboard:k1e,agent:R1e};function x1e(){return m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M14 3 H6 a2 2 0 0 0 -2 2 v14 a2 2 0 0 0 2 2 h12 a2 2 0 0 0 2 -2 V9 z"}),m.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),m.jsx("path",{d:"M8 17 v-3"}),m.jsx("path",{d:"M12 17 v-6"}),m.jsx("path",{d:"M16 17 v-4"})]})}function S1e(){return m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),m.jsx("path",{d:"M4 7 l8 4 l8 -4"}),m.jsx("path",{d:"M12 11 v10"})]})}function w1e(){return m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),m.jsx("path",{d:"M3.5 9.5 H20.5"}),m.jsx("path",{d:"M9.5 3.5 V20.5"})]})}function C1e(){return m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M12 3 L21 7.5 L12 12 L3 7.5 Z"}),m.jsx("path",{d:"M3 12 L12 16.5 L21 12"}),m.jsx("path",{d:"M3 16.5 L12 21 L21 16.5"})]})}function k1e(){return m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),m.jsx("path",{d:"M3.5 9.5 H20.5"}),m.jsx("path",{d:"M12 9.5 V20.5"}),m.jsx("path",{d:"M12 15 H20.5"})]})}function R1e(){return m.jsxs(m.Fragment,{children:[m.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),m.jsx("path",{d:"M5 20 a7 7 0 0 1 14 0"})]})}function E1e(){return m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),m.jsx("path",{d:"M3.5 9.5 H20.5"}),m.jsx("path",{d:"M7 13.5 H17"}),m.jsx("path",{d:"M7 16.5 H13"})]})}function V3(e){return e>=1e9?`${(e/1e9).toFixed(1)} B rows`:e>=1e6?`${(e/1e6).toFixed(1)} M rows`:e>=1e3?`${(e/1e3).toFixed(1)} K rows`:`${e} rows`}const T1e=12;function $1e(e){const t=e?.trim().toLowerCase()??"";if(t.startsWith("array")||t.endsWith("[]"))return p1e;if(t.startsWith("record")||t.startsWith("struct"))return h1e;switch(t.split(/[\s(<]/)[0]){case"string":return d1e;case"number":return g1e;case"date":return f1e;case"timestamp":case"timestamptz":return m1e;case"boolean":return y1e;default:return v1e}}function M1e({column:e}){const t=$1e(e.type);return m.jsxs(mt,{component:"li",sx:n=>({display:"flex",alignItems:"center",gap:1.25,px:1,py:.625,borderRadius:1,transition:"background-color 0.1s","&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.06)":n.palette.grey[100]}}),children:[m.jsx(t,{"aria-hidden":!0,sx:{fontSize:18,color:"primary.main",flexShrink:0}}),m.jsxs(mt,{sx:{display:"flex",alignItems:"baseline",gap:1,minWidth:0,flex:1},children:[m.jsx(Ct,{component:"span",sx:{fontFamily:Uo,fontSize:"0.8125rem",fontWeight:500,color:"text.primary",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),e.type&&m.jsx(Ct,{component:"span",variant:"caption",color:"text.secondary",sx:{flexShrink:0,maxWidth:"50%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.type})]})]})}function O1e({database:e,onClose:t}){const n=e!==null,[r,o]=C.useState(e);e!==null&&e!==r&&o(e);const[a,i]=C.useState(""),[s,c]=C.useState(r?.path);s!==r?.path&&(c(r?.path),i(""));const f=C.useId(),u=r?.path??"",h=u.split("/").pop()||u,g=u.slice(0,Math.max(0,u.length-h.length-1)),y=r?.info?.rowCount,b=[g,y===void 0?null:V3(y)].filter(Boolean).join(" · "),S=C.useMemo(()=>r?.info?.columns??[],[r]),w=a.trim().toLowerCase(),x=C.useMemo(()=>w?S.filter(R=>R.name?.toLowerCase().includes(w)||R.type?.toLowerCase().includes(w)):S,[S,w]);return m.jsxs($o,{open:n,onClose:t,showClose:!0,title:m.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1.5,sx:{minWidth:0},children:[m.jsx(mt,{"aria-hidden":!0,sx:{width:32,height:32,borderRadius:1,bgcolor:U3.data,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:m.jsx(B3,{type:"data",size:18})}),m.jsxs(mt,{sx:{minWidth:0},children:[m.jsx(Ct,{component:"span",noWrap:!0,title:u,sx:{display:"block",fontFamily:Uo,fontSize:"1rem",fontWeight:600,letterSpacing:0,lineHeight:1.4},children:h||"Columns"}),b&&m.jsx(Ct,{component:"span",variant:"caption",color:"text.secondary",noWrap:!0,sx:{display:"block",lineHeight:1.4},children:b})]})]}),children:[r?.error&&m.jsx(go,{severity:"error",variant:"outlined",children:r.error}),r&&!r.error&&m.jsxs(mt,{component:"section","aria-labelledby":f,sx:{display:"flex",flexDirection:"column",border:"1px solid",borderColor:"divider",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",mb:2},children:[m.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1,sx:{px:1.5,py:1,minHeight:44,borderBottom:"1px solid",borderColor:"divider"},children:[m.jsxs(Ct,{id:f,component:"h3",sx:{fontSize:"0.875rem",fontWeight:600},children:["Columns",m.jsxs(Ct,{component:"span",variant:"caption",color:"text.secondary",sx:{ml:.75,fontVariantNumeric:"tabular-nums"},children:["· ",w?`${x.length} of `:"",S.length]})]}),S.length>T1e&&m.jsx(nx,{value:a,onChange:R=>i(R.target.value),placeholder:"Filter columns",inputProps:{"aria-label":"Filter columns"},startAdornment:m.jsx(OR,{position:"start",children:m.jsx(Mp,{sx:{fontSize:16,color:"text.secondary"}})}),sx:{ml:"auto !important",width:200,fontSize:"0.8125rem",px:1,py:.25,border:"1px solid",borderColor:"divider",borderRadius:1.5,"&.Mui-focused":{borderColor:"primary.main"}}})]}),m.jsx(mt,{sx:{overflowY:"auto",maxHeight:420,px:.75,py:.75},children:x.length===0?m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic",px:1,py:1},children:w?"No columns match":"No columns"}):m.jsx(mt,{component:"ul","aria-labelledby":f,sx:{listStyle:"none",m:0,p:0},children:x.map((R,k)=>m.jsx(M1e,{column:R},`${R.name}-${k}`))})})]})]})}const H3=(e,t,n)=>["packageVersions",e,t,n];async function q3(e,t,n){try{return(await e.versions.listPackageVersions(t,n)).data}catch(r){const o=r?.response?.status;if(o===404||o===501)return[];throw r}}function P1e(e,t,n={}){const{apiClients:r,server:o}=hr(),a=(n.enabled??!0)&&e!==""&&t!=="",i=VR({queryKey:H3(e,t,o),queryFn:()=>q3(r,e,t),enabled:a,staleTime:3e4,retry:!1}),{refetch:s}=i,c=C.useCallback(()=>void s(),[s]),f=i.data??[];return{versions:f,latest:f.find(u=>u.latest)?.id,isPending:a&&i.isPending,isError:a&&i.isError,refetch:c}}function A1e(e,t){const{apiClients:n,server:r}=hr(),o=xl();return C.useCallback(()=>o.fetchQuery({queryKey:H3(e,t,r),queryFn:()=>q3(n,e,t),staleTime:0,retry:!1}),[o,n,r,e,t])}function D1e(e,t){const n=xl();return C.useCallback(()=>n.invalidateQueries({predicate:r=>r.queryKey[1]===e&&r.queryKey[2]===t}),[n,e,t])}const j1e=kn(m.jsx("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27M6.24 5h11.52l.81.97H5.44zM5 19V8h14v11zm8.45-9h-2.9v3H8l4 4 4-4h-2.55z"})),N1e=kn(m.jsx("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"})),I1e=kn(m.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),L1e=kn(m.jsx("path",{d:"M14 4v5c0 1.12.37 2.16 1 3H9c.65-.86 1-1.9 1-3V4zm3-2H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3V4h1c.55 0 1-.45 1-1s-.45-1-1-1"})),z1e=kn(m.jsx("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27M6.24 5h11.52l.83 1H5.42zM5 19V8h14v11zm3-5h2.55v3h2.9v-3H16l-4-4z"})),Ym=e=>{const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error?e.message:"Unknown error"},F1e=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},cp=e=>e.archiveStatus==="archive",Vw="Tables built for this version alone (under scope: version) are dropped.";function RN(e,t){const n=!cp(e)&&t.filter(o=>!cp(o)).length<=1,r=t.length<=1;return{archive:e.latest?"The latest version can't be archived":n?"The last version in service can't be archived":void 0,delete:r?void 0:e.latest?"Pin another version as latest first":n?"The last version in service; delete the archived versions first":void 0}}function _1e({environmentName:e,packageName:t,versions:n,selectedVersionId:r,onSelectVersion:o,onReplaceVersion:a,onPackageDeleted:i,canManage:s}){const{apiClients:c}=hr(),f=xl(),u=D1e(e,t),h=A1e(e,t),[g,y]=C.useState(null),[b,S]=C.useState(null),[w,x]=C.useState(null),[R,k]=C.useState(null),[T,O]=C.useState(null),[A,I]=C.useState(null),j=C.useRef(null),_=C.useRef(null),z=C.useRef(null),B=C.useRef(new Map),E=n.find(fe=>fe.latest)?.id,L=r??E,N=()=>Promise.all([u(),f.invalidateQueries({queryKey:["packages",e]})]),F=async(fe,he)=>{const me=he??await h().catch(()=>{});if(me===void 0)return;const le=me.find(Ie=>Ie.latest)?.id,be=le??me.find(Ie=>Ie.id!==fe&&!cp(Ie))?.id;be!==void 0&&(a?a(be===le?void 0:be):o(be))},D=Rb({mutationFn:fe=>c.versions.setPackageLatestVersion(e,t,{version:fe}),onSuccess:async()=>{x(null),await N()},onError:()=>void N()}),W=Rb({mutationFn:({id:fe,archiveStatus:he})=>c.versions.updatePackageVersion(e,t,fe,{archiveStatus:he}),onSuccess:async(fe,{id:he,archiveStatus:me})=>{k(null),me==="archive"&&he===L&&await F(he),await N()},onError:(fe,{id:he,archiveStatus:me})=>{me==="unarchive"&&I(`Couldn't unarchive v${he}: ${Ym(fe)}`),N()}}),K=W.isPending?W.variables?.id:void 0,ae=Rb({mutationFn:({id:fe})=>c.versions.deletePackageVersion(e,t,fe),onSuccess:async(fe,{id:he,read:me})=>{O(null);const le=await h().catch(()=>{})??me.filter(be=>be.id!==he);if(le.length===0){await f.invalidateQueries({queryKey:["packages",e]}),i?.();return}he===L&&await F(he,le),await N()},onError:()=>void N()}),Y=()=>S(null),re=b?RN(b.version,n):{},ue=b!==null&&!cp(b.version)&&b.version.latest&&re.archive!==void 0&&re.delete!==void 0,X=T!==null&&T.versions===void 0,oe=T?.versions!==void 0&&T.versions.length<=1,J=T?.versions!==void 0?RN(T.version,T.versions).delete:void 0,ee=async fe=>{Y(),y(null),ae.reset(),O({version:fe});const he=be=>O(Ie=>Ie!==null&&Ie.version.id===fe.id&&Ie.versions===void 0?be:Ie);let me;try{me=await h()}catch(be){he(null),I(`Couldn't check v${fe.id} before deleting it: ${Ym(be)}`);return}const le=me.find(be=>be.id===fe.id);if(le===void 0){he(null),I(`v${fe.id} is no longer a version of ${t}.`),N();return}he({version:le,versions:me})},te=(fe,he)=>{!s||K===fe.id||S({version:fe,anchor:B.current.get(fe.id)??he})},de=(fe,he)=>{const me=fe.key==="ArrowRight"||fe.key==="ContextMenu"||fe.key==="F10"&&fe.shiftKey;!s||!me||(fe.preventDefault(),fe.stopPropagation(),te(he,fe.currentTarget))},ce=b&&m.jsxs(Qo,{disabled:re.delete!==void 0,onClick:()=>void ee(b.version),children:[m.jsx(il,{children:m.jsx(Uz,{fontSize:"small"})}),m.jsx(bi,{primary:"Delete version",secondary:re.delete})]},"delete");return m.jsxs(m.Fragment,{children:[m.jsx(tr,{size:"small",variant:"outlined",endIcon:m.jsx(N1e,{}),"aria-label":L?`Version v${L}, change version`:"Select a version","aria-haspopup":"menu",onClick:fe=>y(fe.currentTarget),sx:{borderRadius:999,textTransform:"none",fontWeight:500,px:1.5,minWidth:0,whiteSpace:"nowrap"},children:L?`v${L}`:"Select a version"}),m.jsx(nc,{anchorEl:g,open:g!==null,onClose:()=>y(null),slotProps:{paper:{sx:{minWidth:320,maxWidth:400,mt:1,borderRadius:3}},list:{"aria-label":`Versions of ${t}`,disabledItemsFocusable:!0}},children:n.map(fe=>{const he=fe.id===L,me=cp(fe),le=[me?"Archived":void 0,F1e(fe.createdAt),fe.gitCommitSha?fe.gitCommitSha.slice(0,7):void 0].filter(Boolean).join(" · ");return m.jsxs(Qo,{"aria-current":he?"true":void 0,"aria-disabled":me&&!s?"true":void 0,"aria-haspopup":s?"menu":void 0,"data-testid":"version-row",onKeyDown:be=>de(be,fe),onClick:be=>{if(me){te(fe,be.currentTarget);return}he||(y(null),o(fe.id,be))},sx:be=>({gap:1,borderLeft:"3px solid",borderLeftColor:he?be.palette.primary.main:"transparent",backgroundColor:he?Ps(be.palette.primary.main,.04):void 0,cursor:he||me&&!s?"default":"pointer"}),children:[m.jsx(bi,{primary:fe.id,secondary:le,sx:{opacity:me?.6:1},slotProps:{primary:{sx:{fontWeight:he?600:400}}}}),fe.latest&&m.jsx(ER,{size:"small",label:"Latest",color:"info",variant:"outlined",sx:{height:20,fontSize:11,fontWeight:600}}),s&&m.jsx(Jo,{title:K===fe.id?"Updating this version…":"",children:m.jsx("span",{children:m.jsx(xo,{ref:be=>{be?B.current.set(fe.id,be):B.current.delete(fe.id)},size:"small","aria-label":`More actions for version ${fe.id}`,"aria-haspopup":"menu",disabled:K===fe.id,onClick:be=>{be.stopPropagation(),S({version:fe,anchor:be.currentTarget})},children:m.jsx(I1e,{fontSize:"small"})})})})]},fe.id)})}),m.jsx(nc,{anchorEl:b?.anchor??null,open:b!==null,onClose:Y,slotProps:{list:{"aria-label":b?`Actions for version ${b.version.id}`:void 0,disabledItemsFocusable:!0,autoFocus:ue}},children:b&&cp(b.version)?[m.jsxs(Qo,{onClick:()=>{const{id:fe}=b.version;Y(),W.mutate({id:fe,archiveStatus:"unarchive"})},children:[m.jsx(il,{children:m.jsx(z1e,{fontSize:"small"})}),m.jsx(bi,{primary:"Unarchive"})]},"unarchive"),m.jsx(pl,{},"divider"),ce]:b&&[m.jsxs(Qo,{disabled:b.version.latest,onClick:()=>{x(b.version),D.reset(),Y(),y(null)},children:[m.jsx(il,{children:m.jsx(L1e,{fontSize:"small"})}),m.jsx(bi,{primary:"Pin as latest",secondary:b.version.latest?"Already the latest version":void 0})]},"pin-latest"),m.jsxs(Qo,{disabled:re.archive!==void 0,onClick:()=>{k(b.version),W.reset(),Y(),y(null)},children:[m.jsx(il,{children:m.jsx(j1e,{fontSize:"small"})}),m.jsx(bi,{primary:"Archive",secondary:re.archive})]},"archive"),m.jsx(pl,{},"divider"),ce]}),m.jsx($o,{open:w!==null,onClose:()=>{D.isPending||x(null)},title:w?`Pin v${w.id} as latest`:"",description:w?`Requests that name no version will be served from v${w.id}.`:void 0,initialFocus:j,actions:m.jsxs(m.Fragment,{children:[m.jsx(tr,{ref:j,disabled:D.isPending,onClick:()=>x(null),children:"Cancel"}),m.jsx(tr,{variant:"contained",loading:D.isPending,onClick:()=>w&&D.mutate(w.id),children:"Pin as latest"})]}),children:m.jsxs(Wn,{spacing:1.5,children:[E&&w&&E!==w.id&&m.jsx(Ct,{variant:"body2",color:"text.secondary",children:`The latest version is v${E} now. Links and requests that name a version keep answering as before.`}),D.isError&&w&&m.jsx(go,{severity:"error",role:"alert",children:`Couldn't pin v${w.id} as latest: ${Ym(D.error)}`})]})}),m.jsx($o,{open:R!==null,onClose:()=>{W.isPending||k(null)},title:R?`Archive v${R.id}`:"",description:R?`v${R.id} stops being served and is unloaded. Its files stay, so it can be unarchived.`:void 0,initialFocus:_,actions:m.jsxs(m.Fragment,{children:[m.jsx(tr,{ref:_,disabled:W.isPending,onClick:()=>k(null),children:"Cancel"}),m.jsx(tr,{variant:"contained",loading:W.isPending,onClick:()=>R&&W.mutate({id:R.id,archiveStatus:"archive"}),children:"Archive"})]}),children:m.jsxs(Wn,{spacing:1.5,children:[m.jsx(Ct,{variant:"body2",color:"text.secondary",children:`${Vw} Its scheduled builds stop, and once unarchived it serves live until it is built again.`}),W.isError&&R&&m.jsx(go,{severity:"error",role:"alert",children:`Couldn't archive v${R.id}: ${Ym(W.error)}`})]})}),m.jsx($o,{open:T!==null,onClose:()=>{ae.isPending||O(null)},title:T?`Delete v${T.version.id}`:"",initialFocus:z,actions:m.jsxs(m.Fragment,{children:[m.jsx(tr,{ref:z,disabled:ae.isPending,onClick:()=>O(null),children:"Cancel"}),m.jsx(tr,{variant:"contained",color:"error",loading:ae.isPending,disabled:X||J!==void 0,onClick:()=>T?.versions&&ae.mutate({id:T.version.id,read:T.versions}),children:oe?"Delete package":"Delete version"})]}),children:m.jsxs(Wn,{spacing:1.5,children:[X&&T&&m.jsx(Ct,{variant:"body2",children:`Checking ${t}'s versions before deleting v${T.version.id}…`}),T&&!X&&m.jsx(Ct,{variant:"body2",children:oe?`v${T.version.id} is the only version of ${t}, so deleting it deletes the package. ${Vw} This cannot be undone.`:`v${T.version.id} stops being served and its files are removed. ${Vw} Links that name it stop working, and this cannot be undone.`}),J!==void 0&&T&&m.jsx(go,{severity:"warning",role:"alert",children:`v${T.version.id} can't be deleted now: ${J}.`}),ae.isError&&T&&m.jsx(go,{severity:"error",role:"alert",children:`Couldn't delete v${T.version.id}: ${Ym(ae.error)}`})]})}),m.jsx(dy,{open:A!==null,autoHideDuration:8e3,onClose:()=>I(null),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:m.jsx(mt,{children:m.jsx(go,{severity:"error",variant:"filled",onClose:()=>I(null),children:A})})})]})}const U1e="README.malloynb",B1e=e=>!!e&&!e.includes("/")&&Gx(e)?.toLowerCase()==="readme";function vCe({onClickPackageFile:e,onOpenDocument:t,resourceUri:n,onEvent:r,onSelectVersion:o,onReplaceVersion:a}){const{apiClients:i,server:s,mutable:c}=hr(),f=xl(),u=e??(ge=>{window.location.href=ge}),{environmentName:h,packageName:g,versionId:y}=to(n),b=P1e(h,g),{versions:S}=b,w=S.length>0,x=!w&&!b.isPending&&!b.isError,R=o??((ge,se)=>u(`/${encodeURIComponent(h)}/${encodeURIComponent(g)}/${encodeURIComponent(ge)}`,se)),k=t??((ge,se)=>{const Ge=ge.mode==="edit"?qye(h,g,ge.path):FF(h,g,ge.path);se?u(Ge,se):u(Ge)}),[T,O]=C.useState(null),[A,I]=C.useState(!1),j=Vve(),_=JF()?.documentStorage,[z,B]=C.useState([]),[E,L]=C.useState({state:_?"pending":"ready"}),N=C.useCallback(async()=>{if(!_)return;let ge;try{ge=await _.listWorkspaces(!1)}catch{L({state:"failed"});return}L({state:"ready",chosen:qF(ge)});const se=[],Ge=Kg(h,g,"");for(const Ae of ge.filter(Qe=>Qe.writeable))for(const Qe of await _.listDocuments(Ae))Qe.path.startsWith(Ge)&&se.push({locator:Qe,where:Ae.description});B(se)},[_,h,g]);C.useEffect(()=>{N()},[N]);const F=ge=>ge.path.slice(Kg(h,g,"").length),D=To({queryKey:["package",h,g,y],queryFn:()=>i.packages.getPackage(h,g,y,!1)}),W=_F(h,g,y),K=To({queryKey:["models",h,g,y],queryFn:()=>i.models.listModels(h,g,y)}),ae=To({queryKey:["databases",h,g,y],queryFn:()=>i.databases.listDatabases(h,g,y)}),Y=To({queryKey:["data-apps",h,g,y],queryFn:async()=>{try{return await i.dataApps.listDataApps(h,g,y)}catch(ge){const se=ge?.response?.status;if(se===404||se===void 0)return{data:[]};throw ge}}}).data?.data??[],re=W.reports.filter(ge=>!!ge.path),ue=H1e(re),X=new Set(re.map(ge=>ge.path).filter(ge=>ge!==void 0)),oe=(K.data?.data??[]).slice().filter(ge=>!X.has(ge.path)).sort((ge,se)=>ge.path.localeCompare(se.path)),J=(ae.data?.data??[]).slice().sort((ge,se)=>ge.path.localeCompare(se.path)),ee=E.state==="ready"?wve({authoritative:E.chosen?.authoritative===!0,mutable:c&&x,canStore:E.chosen?.writeable===!0,...y===void 0?{}:{versionId:y}}):void 0,te=W.settled&&(K.isSuccess||K.isError),de=ee!==void 0&&te,ce=de&&!j,fe=C.useMemo(()=>{if(!de)return;const ge=[...W.reports.flatMap(se=>se.path?[se.path]:[]),...(K.data?.data??[]).flatMap(se=>se.path?[se.path]:[])];if(ee==="storage"&&_&&E.state==="ready")return E.chosen?{route:ee,storage:_,workspace:E.chosen,environmentName:h,packageName:g,existing:ge}:void 0;if(ee==="package")return{route:ee,existing:ge,write:async(se,Ge)=>{await i.models.updateModelSource(h,g,se,{source:Ge})}}},[de,ee,_,E,h,g,i,W.reports,K.data]),he=D.data?.data?.description??"",me=D.data?.data?.agents??[],le=(re.find(ge=>ge.path===U1e)??re.find(ge=>B1e(ge.path)))?.path,be=!W.settled,Ie=w?m.jsx(_1e,{environmentName:h,packageName:g,versions:S,...y!==void 0?{selectedVersionId:y}:{},onSelectVersion:R,...a?{onReplaceVersion:a}:{},onPackageDeleted:()=>u(`/${encodeURIComponent(h)}`),canManage:c}):null,Ne=m.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1.5,sx:{mb:.5},children:[m.jsx(Ct,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em"},children:g}),Ie]});if(D.isError){const ge=m.jsx(Ma,{error:D.error,context:`${h} > ${g}`});return Ie?m.jsxs(Qb,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[m.jsx(mt,{sx:{mb:4},children:Ne}),ge]}):ge}return m.jsxs(Qb,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[m.jsxs(mt,{sx:{mb:4},children:[Ne,he&&m.jsx(Ct,{variant:"body2",color:"text.secondary",children:he})]}),m.jsx(o1e,{warnings:D.data?.data?.warnings}),b.isError&&m.jsx(mt,{sx:{mb:4},children:m.jsx(go,{severity:"warning",action:m.jsx(tr,{color:"inherit",size:"small",onClick:b.refetch,children:"Retry"}),children:"Could not read this package's versions, so nothing that changes it is offered until they load."})}),be&&m.jsx(va,{text:"Loading package..."}),fe&&m.jsx(i1e,{open:A,layout:"linear",environmentName:h,packageName:g,...y!==void 0?{versionId:y}:{},models:oe.map(ge=>ge.path).filter(ge=>typeof ge=="string"&&ge.endsWith(".malloy")&&!X.has(ge)),modelsLoading:K.isPending,...K.isError?{modelsError:K.error}:{},onRetryModels:()=>void K.refetch(),target:fe,...r?{onEvent:r}:{},onClose:()=>I(!1),onCreated:ge=>{I(!1),Ave(f,h,g),f.invalidateQueries({queryKey:["models"]}),k({path:ge.path,layout:ge.layout,slug:ge.slug,mode:"edit"})}}),!be&&m.jsxs(m.Fragment,{children:[W.isError&&m.jsx(mt,{sx:{mb:4},children:m.jsx(go,{severity:"warning",action:m.jsx(tr,{color:"inherit",size:"small",onClick:()=>void W.refetch(),children:"Retry"}),children:"Could not list this package's reports, so any it has are missing from this page."})}),(ue.length>0||de)&&m.jsxs($s,{title:"Reports",count:ue.length,...ce?{action:m.jsx(xy,{label:"Report",onClick:()=>I(!0)})}:{},children:[ue.length===0&&m.jsx(Hw,{label:"No reports yet",...ce?{action:{label:"Add report",onClick:()=>I(!0)}}:{}}),ue.map(ge=>m.jsx(rp,{type:ge.layout==="grid"?"dashboard":"report",label:ge.label,rightLabel:ge.layout,...ge.secondary===void 0?{}:{description:ge.secondary},onClick:se=>ge.path.endsWith(".malloynb")?u(`/${h}/${g}/${ge.path}`,se):k({path:ge.path,layout:ge.layout,slug:ge.slug,mode:"view"},se)},ge.path))]}),x&&z.length>0&&m.jsx($s,{title:"Drafts",count:z.length,children:z.map(({locator:ge,where:se})=>m.jsx(rp,{type:ge.type==="grid"?"dashboard":"report",label:F(ge),rightLabel:se,onClick:Ge=>k({path:F(ge),layout:ge.type,slug:Gx(F(ge))??"",mode:"edit"},Ge),trailingAction:m.jsx(Jo,{title:"Delete this draft",children:m.jsx(xo,{size:"small","aria-label":`Delete draft ${F(ge)}`,onClick:Ge=>{Ge.stopPropagation(),_?.deleteDocument(ge).then(N)},children:m.jsx(Uz,{fontSize:"small"})})})},`${ge.workspace}:${ge.path}`))}),Y.length>0&&m.jsx($s,{title:"Apps",count:Y.length,children:Y.map(ge=>{const se=!!ge.title&&ge.title!==ge.path,Ge=`${x3(s)}${ge.resource}`;return m.jsx(rp,{type:"dataApp",label:se?ge.title:ge.path,rightLabel:se?ge.path:void 0,onClick:Ae=>{e?e(`/${h}/${g}/data-apps/${ge.path}`,Ae):Ae&&(Ae.metaKey||Ae.ctrlKey)?window.open(Ge,"_blank"):window.location.href=Ge},trailingAction:m.jsx(Jo,{title:"Open standalone in new tab",children:m.jsx(xo,{size:"small",href:Ge,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",onClick:Ae=>Ae.stopPropagation(),sx:{color:"text.secondary"},children:m.jsx(b3,{fontSize:"small"})})})},ge.path)})}),m.jsxs($s,{title:"Models",count:oe.length,children:[oe.map(ge=>m.jsx(rp,{type:"model",label:ge.path,onClick:se=>u(`/${h}/${g}/${ge.path}`,se)},ge.path)),oe.length===0&&m.jsx(Hw,{label:"No models"})]}),me.length>0&&m.jsx($s,{title:"Agents",count:me.length,description:"Declared in publisher.json. Name one in an agent session to work as it. Schedules are listed only; nothing runs them yet.",children:me.map(ge=>m.jsx(V1e,{agent:ge},ge.name))}),m.jsxs($s,{title:"Data",count:J.length,children:[J.map(ge=>m.jsx(rp,{type:"data",label:ge.path,rightLabel:ge.info?V3(ge.info.rowCount):"Unreadable",onClick:()=>O(ge)},ge.path)),J.length===0&&m.jsx(Hw,{label:"No data files"})]}),m.jsx(Hxe,{resourceUri:n,versioned:!x}),le&&m.jsx(mt,{sx:{mt:6},children:m.jsx(a1e,{resourceUri:Xx({environmentName:h,packageName:g,versionId:y}),path:le,onLinkNavigate:u})})]}),m.jsx(O1e,{database:T,onClose:()=>O(null)})]})}function rp({type:e,label:t,description:n,rightLabel:r,onClick:o,trailingAction:a}){return m.jsx(Zx,{icon:m.jsx(B3,{type:e}),tint:U3[e],label:t,mono:!0,...n===void 0?{}:{description:n},...r===void 0?{}:{rightLabel:r},...o===void 0?{}:{onClick:o},...a===void 0?{}:{trailingAction:a}})}function V1e({agent:e}){return m.jsxs(m.Fragment,{children:[m.jsx(rp,{type:"agent",label:e.name??"",...e.description?{description:e.description}:{},...e.model&&e.model!=="inherit"?{rightLabel:e.model}:{}}),(e.schedules??[]).map(t=>{const n=lT(t.cron??"");return m.jsxs(Ct,{variant:"caption",color:"text.secondary",sx:{display:"block",ml:6,mb:.5},children:[n.valid?n.description:t.cron," (UTC), task"," ",t.task,". Not run yet."]},`${t.cron}|${t.task}`)})]})}function H1e(e){const t=e.map(r=>({path:r.path??"",layout:ZE(r),slug:Gx(r.path)??r.path??"",title:r.title})),n=new Map;for(const r of t)n.set(r.slug,(n.get(r.slug)??0)+1);return t.map(({title:r,...o})=>{const a=!!r&&r!==o.slug&&r!==o.path,i=(n.get(o.slug)??0)>1,s=a?r:o.path.endsWith(".malloynb")?o.path:o.slug;return{...o,label:s,secondary:s!==o.path&&(a||i||o.path.includes("/"))?o.path:void 0}}).sort((r,o)=>r.label.localeCompare(o.label)||r.path.localeCompare(o.path))}function Hw({label:e,action:t}){return m.jsxs(Wn,{direction:"row",sx:{alignItems:"center",gap:1,py:1},children:[m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:e}),t&&m.jsx(tr,{size:"small",onClick:t.onClick,children:t.label})]})}const EN=/^publisher:document:(dashboard|notebook):(.+)$/;function q1e(e,t){const n=[];for(let r=0;r<e.length;r++){const o=e.key(r);o!==null&&EN.test(o)&&n.push(o)}for(const r of n){const[,o,a]=EN.exec(r),i=e.getItem(r);i!==null&&t(a,e3(o),i)&&e.removeItem(r)}}const qw={name:"Local",description:"Stored in this browser only",writeable:!0},Pk="publisher:report:",td=e=>`${Pk}${e}`;function Km(e){const t=localStorage.getItem(e);if(t!==null)try{const n=JSON.parse(t);if(typeof n.content=="string"&&(n.type==="grid"||n.type==="linear"))return{type:n.type,content:n.content}}catch{}}const Ww=(e,t)=>localStorage.setItem(td(e),JSON.stringify(t));class W1e{migrated=!1;migrate(){this.migrated||(this.migrated=!0,q1e(localStorage,(t,n,r)=>Km(td(t))!==void 0?!1:(Ww(t,{type:n,content:r}),!0)))}async listWorkspaces(t){return[qw]}async listDocuments(t,n){if(t.name!==qw.name)return[];this.migrate();const r=[];for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o);if(a===null||!a.startsWith(Pk))continue;const i=Km(a);i&&(n===void 0||i.type===n)&&r.push({workspace:qw.name,type:i.type,path:a.slice(Pk.length)})}return r}async getDocument(t){this.migrate();const n=Km(td(t.path));if(n===void 0)throw Yw(t);return n.content}async getDocumentType(t){this.migrate();const n=Km(td(t.path));if(n===void 0)throw Yw(t);return n.type}async saveDocument(t,n){this.migrate(),Ww(t.path,{type:t.type,content:n})}async deleteDocument(t){if(this.migrate(),Km(td(t.path))===void 0)throw Yw(t);localStorage.removeItem(td(t.path))}async moveDocument(t,n){const r=await this.getDocument(t);Ww(n.path,{type:n.type,content:r}),n.path!==t.path&&localStorage.removeItem(td(t.path))}}function Yw(e){return new WF(`No report at ${e.workspace}/${e.path}`)}async function Y1e(e,t,n,r){const o=qF(await e.listWorkspaces(!1));if(!o)return;const a=Kg(t,n,r);if(e.getDocumentType)try{return await e.getDocumentType({workspace:o.name,path:a})}catch(i){if(YF(i))return;throw i}return(await e.listDocuments(o)).find(i=>i.path===a)?.type}function bCe(e,t,n,r=!0){const o=JF()?.documentStorage,a=r&&o!==void 0,[i,s]=C.useState(),c=Kg(e,t,n);return C.useEffect(()=>{if(!a||!o)return;let f=!1;return Y1e(o,e,t,n).catch(()=>{}).then(u=>{f||s({key:c,layout:u})}),()=>{f=!0}},[a,o,e,t,n,c]),a?i?.key===c?{layout:i.layout,settled:!0}:{layout:void 0,settled:!1}:{layout:void 0,settled:!0}}function K1e(e){return C.useMemo(()=>{if(!e?.sources?.length)return[];const t=new Map;for(const n of e.sources)if(n.givens?.length)for(const r of n.givens)r.name&&!t.has(r.name)&&t.set(r.name,r);return Array.from(t.values())},[e])}function G1e(e){return e.type==="code"}function Q1e(e){return(e.text??"").split(`
481
+ `);I3(k,"typescript",R).then(T=>{i(T)})}},[t,R]),m.jsxs(mt,{children:[a&&m.jsx(mt,{sx:{marginBottom:"16px"},children:m.jsx(Ct,{fontSize:"12px",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:m.jsx("div",{className:"content",dangerouslySetInnerHTML:{__html:a}})})}),m.jsxs(mt,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[m.jsx(Ct,{variant:"body2",sx:{fontSize:"15px",fontWeight:600,color:"text.primary",px:2,py:1,bgcolor:"action.hover",borderRadius:1.5,border:1,borderColor:"divider"},children:e}),m.jsx(bp,{"aria-label":"Expand results",onClick:()=>c(!0),children:m.jsx(Mp,{})})]}),m.jsxs(_5,{sx:{position:"relative"},children:[r&&!f&&m.jsxs(mt,{sx:{padding:"40px 20px",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[m.jsx(Ct,{variant:"body2",color:"text.secondary",children:"Click Run to execute the query"}),m.jsx(tr,{variant:"contained",startIcon:m.jsx(qxe,{}),onClick:()=>u(!0),children:"Run Query"})]}),S&&m.jsx(XE,{state:w,context:e,maxHeight:oie,maxResultSize:o})]}),m.jsx(L3,{open:s,onClose:()=>c(!1),result:x?.data?.result||"",renderLogs:x?.data?.renderLogs,title:`Query: ${e}`})]})}function Zxe(e){return e!=null}function Jxe(e,t){const n=[],r=[];for(const a of e){if(a.name===void 0||Zxe(t.get(a.name)))continue;if(a.default==null){n.push(a.name);continue}const i=YE(a.type??"string",a.default);i&&r.push(`${a.name} = ${i}`)}const o={missing:n};return r.length>0&&(o.defaultsNote=r.length===1?`Ran with the default ${r[0]}`:`Ran with defaults ${r.join(", ")}`),o}function e1e(e){return e.length===1?`This source may need a value for the given ${e[0]}. Set it in the parameters above.`:`This source may need values for the givens ${e.join(", ")}. Set them in the parameters above.`}function t1e({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a,givens:i,gate:s}){return Sn.useEffect(()=>{o&&o(t)},[t,o]),m.jsx(F5,{children:m.jsxs(o8,{spacing:2,component:"section",children:[m.jsx(r1e,{sourceAndPath:e[t],existingQuery:n,onChange:c=>{r&&r(c)},resourceUri:a,givens:i,gate:s}),m.jsx(II,{height:"5px"})]})})}function Uw(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function n1e({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a,givens:i,gate:s}){const[c,f]=Sn.useState(n||Uw()),[u,h]=Sn.useState(void 0);Sn.useEffect(()=>{n&&f(n)},[n]);const[g,y]=Sn.useState([]),{MalloyExplorerProvider:b,QueryPanel:S,ResizableCollapsiblePanel:w,ResultPanel:x,SourcePanel:R}=r;Sn.useEffect(()=>{t&&t(c)},[t,c]);const{environmentName:k,packageName:T,versionId:O}=to(a),{apiClients:A}=hr(),I=Sn.useRef(void 0),j=al({mutationFn:()=>{I.current=s,h({executionState:"running",query:c?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{j.reset(),h(void 0)},response:{}});const E=typeof c?.malloyQuery=="string"?c.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:c?.malloyQuery}).toMalloy();return f({...c,query:E}),A.models.executeQueryModel(k,T,e.modelPath,{query:E,sourceName:void 0,queryName:void 0,versionId:O,...i&&Object.keys(i).length>0?{givens:i}:{}})},onSuccess:E=>{if(E){const L=JSON.parse(E.data.result);f({...c,malloyResult:L});const N=I.current;h(F=>F?{...F,executionState:"finished",response:{result:L,...N?.defaultsNote?{messages:[{severity:"INFO",title:N.defaultsNote}]}:{}}}:void 0)}},onError:E=>{console.error("Query execution error:",E);const L=E?.data?.message??E?.message??"The query could not be run.",N=[{severity:"ERROR",title:L}],F=I.current?.missing??[];(E?.status===403||/Access denied for source/i.test(L))&&F.length>0&&N.push({severity:"WARN",title:e1e(F)}),h(D=>D?{...D,executionState:"finished",response:{messages:N}}:void 0)}}),[_,z]=Sn.useState(e.sourceInfo.name);Sn.useEffect(()=>{_!==e.sourceInfo.name&&(z(e.sourceInfo.name),f(Uw()),h(void 0))},[e,_]);const B=Sn.useCallback(E=>{f({...c,malloyQuery:E,malloyResult:void 0})},[c]);return _!==e.sourceInfo.name?m.jsx("div",{children:"Loading..."}):m.jsx(U5,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:m.jsx(b,{source:e.sourceInfo,query:c?.malloyQuery,topValues:[],onFocusedNestViewPathChange:y,focusedNestViewPath:g,onQueryChange:B,children:m.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[m.jsx(w,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:m.jsx(R,{onRefresh:()=>f(Uw())})}),m.jsx(w,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:m.jsx(S,{runQuery:()=>{console.log(`running query with: ${c?.malloyQuery}`);try{j.mutate()}catch(E){console.error("Error running query:",E)}}})}),m.jsx(x,{source:e.sourceInfo,draftQuery:c?.malloyQuery,setDraftQuery:E=>f({...c,malloyQuery:E}),submittedQuery:u,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function r1e(e){const[t,n]=C.useState(null),[r,o]=C.useState(null),[a,i]=C.useState(!0);return C.useEffect(()=>{let s=!0;return Promise.all([Ro(()=>import("./index-BvJ7NTSs.js"),__vite__mapDeps([5,0,1,2,6])),uve()]).then(([c,f])=>{s&&(n(c),o(f),i(!1))}).catch(c=>{console.error("Failed to load Malloy components:",c),s&&i(!1)}),()=>{s=!1}},[]),a||!t||!r?m.jsx(vee,{children:m.jsx(U5,{children:m.jsx(II,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):m.jsx(n1e,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function z3(e,t=!0){const{modelPath:n,environmentName:r,packageName:o,versionId:a}=to(e),{apiClients:i}=hr();return To({queryKey:["package",r,o,n,a],queryFn:async()=>(await i.models.getModel(r,o,n,a)).data,enabled:t})}function F3({data:e,onChange:t,existingQuery:n,initialSelectedSourceIndex:r=0,onSourceChange:o,resourceUri:a,givens:i,onGivensChange:s,startingGivens:c}){const[f,u]=Sn.useState(r);Sn.useEffect(()=>{u(r)},[r]);const{data:h,isError:g,isLoading:y,error:b}=z3(a,!e),{environmentName:S,packageName:w,modelPath:x,versionId:R}=to(a),k=e||h,T=Sn.useMemo(()=>k?.givens??[],[k]),O=bE({specs:T,loaded:!!k,params:i,onGivensChange:s,startingValues:c,documentKey:a,autorun:!0,environmentName:S??"",packageName:w??"",modelPath:x,versionId:R,documentName:x}),A=C.useMemo(()=>Zp(O.applied,O.declaredTypes),[O.applied,O.declaredTypes]),I=C.useMemo(()=>Jxe(T,O.applied),[T,O.applied]);if(y&&!e)return m.jsx(va,{text:"Fetching Model..."});if(g&&!e)return console.log("error",b),m.jsx(Ma,{error:b,context:`ModelExplorer > ${x}`});if(!k)return m.jsx(va,{text:zp.loading});const j=(k?.sourceInfos||[]).map((z,B)=>{try{return JSON.parse(z)?.name||`Source ${B+1}`}catch{return`Source ${B+1}`}}),_=j[f]||"";return m.jsxs(gee,{variant:"outlined",children:[m.jsx(yee,{children:m.jsx(Wn,{sx:{flexDirection:"row"},children:m.jsx(N0e,{size:"small",id:"size-small-standard",disablePortal:!0,options:j,value:_,onChange:(z,B)=>{if(!B)return;const E=j.indexOf(B);E>=0&&(u(E),o?.(E))},renderInput:z=>m.jsx(gr,{...z}),style:{width:350,marginTop:"3px",marginLeft:"6px",marginBottom:"8px"}})})}),m.jsx(GE,{...O.panel}),m.jsx(F5,{children:m.jsxs(Wn,{spacing:2,component:"section",children:[Array.isArray(k.sourceInfos)&&k.sourceInfos.length>0&&m.jsx(t1e,{sourceAndPaths:k.sourceInfos.map(z=>({sourceInfo:JSON.parse(z),modelPath:x})),selectedSourceIndex:f,existingQuery:n,onQueryChange:t,resourceUri:a,givens:A,gate:I}),m.jsx(mt,{height:"5px"})]})})]})}function _3({open:e,onClose:t,resourceUri:n,data:r,title:o="Data Sources",hasValidImport:a=!0,existingQuery:i,initialSelectedSourceIndex:s,onChange:c,onSourceChange:f,givens:u,onGivensChange:h,startingGivens:g}){return m.jsxs(rx,{open:e,onClose:t,fullScreen:!0,children:[m.jsxs(ax,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o,m.jsx(xo,{onClick:t,sx:{color:"text.secondary"},children:m.jsx(Xp,{})})]}),m.jsx(ox,{children:a?m.jsx(F3,{resourceUri:n,data:r,existingQuery:i,initialSelectedSourceIndex:s,onChange:c,onSourceChange:f,givens:u,onGivensChange:h,startingGivens:g}):m.jsx("div",{children:"No valid import statement found in cell"})})]})}function yCe({onChange:e,resourceUri:t,runOnDemand:n=!1,maxResultSize:r=0,givens:o,onGivensChange:a}){const{modelPath:i}=to(t),{data:s,isError:c,isLoading:f,error:u}=z3(t),[h,g]=Sn.useState(!1),[y,b]=Sn.useState(),[S,w]=Sn.useState(0),[x,R]=C.useState(""),[k,T]=Sn.useState({}),O=o??k,A=a??(E=>T(E)),I=s?.modelDef,j=Sn.useMemo(()=>{if(!I)return!1;try{const E=JSON.parse(I);return Array.isArray(E.imports)&&E.imports.length>0}catch{return!1}},[I]);if(f)return m.jsx(va,{text:"Fetching Model..."});if(c)return console.log("error",u),m.jsx(Ma,{error:u,context:`Model > ${i}`});const _=E=>{b(E),e&&e(E)},z=E=>{w(E)},B=()=>{const E=window.location.href;navigator.clipboard.writeText(E).then(()=>R("URL copied to clipboard!")).catch(()=>R("Failed to copy URL"))};return m.jsxs(m.Fragment,{children:[m.jsxs(mt,{sx:{position:"relative",maxWidth:"1200px",margin:"0 auto",paddingTop:"24px"},children:[Array.isArray(s?.sourceInfos)&&s.sourceInfos.length>0&&m.jsxs(Wn,{spacing:2,component:"section",children:[m.jsxs(mt,{sx:{padding:"0 0 16px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[m.jsx(Ct,{variant:"h1",sx:{fontSize:"28px",fontWeight:"600",color:"#1a1a1a",marginBottom:"8px",marginTop:"0",paddingLeft:"0"},children:"Sources"}),m.jsx(Jo,{title:"Copy link",children:m.jsx(xo,{size:"small","aria-label":"Copy link",onClick:B,sx:{color:"text.secondary"},children:m.jsx(N3,{fontSize:"small"})})})]}),m.jsx(F3,{data:s,onChange:_,onSourceChange:z,existingQuery:y,initialSelectedSourceIndex:S,resourceUri:t,givens:O,onGivensChange:A}),m.jsx(bp,{"aria-label":"Expand results",sx:{position:"absolute",top:"90px",right:"4px",zIndex:2},onClick:()=>g(!0),children:m.jsx(Mp,{})})]}),s?.queries?.length>0&&m.jsxs(Wn,{spacing:2,component:"section",sx:{marginTop:"24px"},children:[m.jsx(mt,{sx:{padding:"0 0 16px 0"},children:m.jsx(Ct,{variant:"h2",sx:{fontSize:"24px",fontWeight:"600",color:"#1a1a1a",marginBottom:"0",marginTop:"8px",paddingLeft:"0"},children:"Named Queries"})}),s.queries.map(E=>m.jsx(Xxe,{queryName:E.name,annotations:E.annotations,resourceUri:t,runOnDemand:n,maxResultSize:r},E.name))]}),(!Array.isArray(s?.sourceInfos)||s.sourceInfos.length===0)&&!(s?.queries&&s.queries.length>0)&&m.jsxs(mt,{sx:{textAlign:"center",py:6},children:[m.jsx(Ct,{variant:"body1",sx:{color:"text.secondary",marginBottom:"8px"},children:"This model exposes no sources or queries."}),j&&m.jsxs(Ct,{variant:"body2",color:"text.secondary",children:["It imports other files but re-exports nothing. Add"," ",m.jsxs("code",{children:["export ","{ source_name }"]})," to surface imported sources here."]})]}),m.jsx(_3,{open:h,onClose:()=>g(!1),resourceUri:t,data:s,title:`Model: ${i.split("/").pop()}`,existingQuery:y,initialSelectedSourceIndex:S,onChange:_,onSourceChange:z,givens:O,onGivensChange:A})]}),m.jsx(dy,{open:x!=="",autoHideDuration:6e3,onClose:()=>R(""),message:x})]})}function o1e({warnings:e}){const[t,n]=C.useState(!1),r=(e??[]).filter(a=>a.severity==="error"),o=(e??[]).filter(a=>a.severity!=="error");return r.length===0&&o.length===0?null:m.jsxs(Wn,{sx:{gap:1,mb:4},children:[r.length>0&&m.jsxs(go,{severity:"warning",children:[m.jsx(GW,{children:r.length===1?"1 problem in this package":`${r.length} problems in this package`}),m.jsx(CN,{findings:r})]}),o.length>0&&m.jsxs(mt,{children:[m.jsxs(tr,{size:"small","aria-expanded":t,onClick:()=>n(a=>!a),sx:{px:.5,color:"text.secondary"},children:[t?"Hide":"Show"," ",o.length," ",o.length===1?"note":"notes"]}),t&&m.jsx(mt,{sx:{pl:.5,pt:.5},children:m.jsx(CN,{findings:o})})]})]})}function CN({findings:e}){return m.jsx(Wn,{component:"ul",sx:{m:0,p:0,listStyle:"none",gap:.75},children:e.map((t,n)=>m.jsxs(Ct,{component:"li",variant:"body2",children:[t.model&&m.jsx(mt,{component:"span",sx:{fontFamily:Uo,fontSize:"0.85em",mr:1},children:t.model}),t.message]},`${t.model??""}:${t.code??""}:${n}`))})}function a1e({resourceUri:e,path:t,givens:n,onGivensChange:r,onNavigate:o,onLinkNavigate:a,height:i,maxResultSize:s,onEvent:c,chrome:f,manifestStaleTime:u,actions:h,rowsActions:g}){const y=to(e),{apiClients:b}=hr(),S=y.environmentName??"",w=y.packageName??"",x=y.versionId,R=!!y.environmentName&&!!y.packageName,{data:k,isSuccess:T,isError:O,error:A}=To({...Ove(b,{environmentName:S,packageName:w,path:t,versionId:x},u),enabled:R&&t!==""}),I=k?.layout,j=Tie({path:t,layout:I},c),_=`${e}|${t}`,z=C.useRef(void 0),B=C.useRef({key:_,at:yd()});B.current.key!==_&&(B.current={key:_,at:yd()}),C.useEffect(()=>{z.current!==_&&(R?O?(z.current=_,j.emit({type:"report.load_failed",surface:"view",category:s0(A)})):k?.notebook?.format==="malloynb"?(z.current=_,j.emit({type:"report.load_failed",surface:"view",category:"unsupported"})):T&&k&&(z.current=_,j.emit({type:"report.opened",surface:"view",from:"package",tiles:k.tiles?.length??0,durationMs:yd()-B.current.at})):(z.current=_,j.emit({type:"report.load_failed",surface:"view",category:"invalid"})))},[_,R,O,A,T,k,j]);const E=C.useCallback((F,D)=>{const W=o?.(F,D);W&&j.emit({type:"report.drill",to:"report",outcome:W})},[o,j]),L=o?E:void 0;if(!R)return m.jsxs(go,{severity:"error",children:["A report resource URI must name an environment and a package. Received: ",e]});if(O)return m.jsx(Ma,{context:`${S} > ${w} > ${t}`,error:A});if(!T||!k)return m.jsx(va,{text:zp.opening("report")});if(k.notebook?.format==="malloynb")return m.jsxs(go,{severity:"info",children:[t," is a .malloynb notebook, which Report does not run: render it with Notebook."]});const N=m.jsx(v3,{manifest:k,environmentName:S,packageName:w,versionId:x,documentName:t,givens:n,onGivensChange:r,onNavigate:L,...a?{onLinkNavigate:a}:{},height:i,maxResultSize:s,chrome:f,...h!==void 0?{actions:h}:{},...g!==void 0?{rowsActions:g}:{}});return m.jsx(Hz.Provider,{value:j,children:N})}function i1e({open:e,layout:t,kind:n,allowLayoutChange:r,allowKindChange:o,environmentName:a,packageName:i,versionId:s,models:c,modelsLoading:f=!1,modelsError:u,onRetryModels:h,target:g,savedAs:y,onClose:b,onCreated:S,onEvent:w}){const x=t??(n?e3(n):"linear"),R=r??o??!0,[k,T]=C.useState(x),[O,A]=C.useState(void 0),[I,j]=C.useState(""),[_,z]=C.useState(""),[B,E]=C.useState(""),L=C.useRef(null),[N,F]=C.useState(""),[D,W]=C.useState(!1),[K,ae]=C.useState(!1),[Y,re]=C.useState(!1),[ue,X]=C.useState(void 0),oe=u!=null,{choices:J,isLoading:ee,isSuccess:te,failed:de,retry:ce,canRetry:fe}=$ve({environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},models:c,enabled:e&&c.length>0}),he=C.useMemo(()=>J.get(I)??[],[J,I]),me=C.useMemo(()=>new Map([...J.entries()].flatMap(([ct,Lt])=>Lt.map(en=>[Bw(ct,en.source,en.view),{model:ct,source:en.source,view:en.view}]))),[J]),le=C.useMemo(()=>{const ct=J.size>1;return[...J.entries()].flatMap(([Lt,en])=>{const En=new Map;for(const $n of en)En.set($n.source,[...En.get($n.source)??[],$n]);return[...En.entries()].map(([$n,Fn])=>({key:`${Lt}::${$n}`,label:$n,ariaLabel:`${$n} in ${Lt}`,...ct||Fn[0]?.sourceDescription?{detail:[ct?Lt:void 0,Fn[0]?.sourceDescription].filter(Boolean).join(" · ")}:{},entries:Fn.map(Wt=>({key:Bw(Lt,Wt.source,Wt.view),name:Wt.view,title:Wt.description??Tw(Wt.view),...Wt.chart?{chart:Wt.chart}:{}}))}))})},[J]),be=ct=>{const Lt=me.get(ct);Lt&&(j(Lt.model),z(`${Lt.source}::${Lt.view}`))},Ie=he.find(ct=>`${ct.source}::${ct.view}`===_),Ne=Ie?Bw(I,Ie.source,Ie.view):void 0,ge=s1e(Ie,250);C.useEffect(()=>{e&&T(x)},[e,x]),C.useEffect(()=>{if(!e)return;const ct=[...J.keys()];I===""&&ct.length>0&&j(ct[0])},[e,J,I]),C.useEffect(()=>{!e||he.length===0||_!==""||z(`${he[0].source}::${he[0].view}`)},[e,he,_]),C.useEffect(()=>{!e||D||Ie===void 0||F(Tw(Ie.view))},[e,D,Ie]),C.useEffect(()=>{e||(j(""),z(""),E(""),F(""),W(!1),A(void 0),ae(!1),X(void 0))},[e]);const se=C.useMemo(()=>{if(N.trim()!=="")for(let ct=1;ct<=nT;ct++){const Lt=QF(N,ct);if(!g.existing?.includes(Lt))return Lt}},[N,g]),Ge=O?.trim(),Ae=Ge===void 0||Ge===""?void 0:Ge.endsWith(".malloy")?Ge:`${Ge}.malloy`,Qe=Ae??se,rt=Ae===void 0?void 0:XF(Ae)??(g.existing?.includes(Ae)?`${Ae} already exists; choose another location.`:void 0),_t=(Ie===void 0?void 0:eT({title:N,modelPath:I,source:Ie.source,view:Ie.view}))??(N.trim()!==""&&Qe===void 0?"No free file name for this title; choose another.":void 0),Ut=_t!==void 0&&(K||N.trim()!==""),ot=f||ee,{theme:tt}=eo(),ft=tt.ui,Le=Id(tt.cardBorder),xe=J.size===0&&(oe||de.length>0),He=ot?"Loading the model":xe?"Couldn't read the model to start from":J.size===0?"Nothing in the model to start from yet":Ie===void 0?"Pick what to start from":void 0,$e="report",kt=Y?`Creating ${$e}…`:`Create ${$e}`,Rt=_!==""&&Ie===void 0&&he.length>0,bt=async()=>{if(!(He!==void 0||Ie===void 0||Y)){if(_t!==void 0||rt!==void 0){ae(!0);return}re(!0),X(void 0);try{const ct=await Cve({layout:k,...Ae!==void 0?{path:Ae}:{},document:{title:N,modelPath:I,source:Ie.source,view:Ie.view},target:g,...w?{onEvent:w}:{}});S(ct)}catch(ct){const Lt=ct.response?.data?.message;X(Lt??(ct instanceof Error?ct.message:String(ct)))}finally{re(!1)}}},st=ct=>m.jsx(tr,{color:"inherit",size:"small",onClick:ct,children:"Retry"});return m.jsx($o,{className:`${hl.dialog} ${hl.newReportDialog}`,maxWidth:"md",initialFocus:L,open:e,onClose:Y?()=>{}:b,title:`New ${$e}`,description:"A report is a Malloy file in the package that lays out text and queries. Pick what its first query shows; the rest is the builder.",actions:m.jsxs(m.Fragment,{children:[m.jsx(tr,{onClick:b,disabled:Y,children:"Cancel"}),m.jsx(Jo,{title:Y?"":He??"",children:m.jsx("span",{children:m.jsx(tr,{variant:"contained",disabled:Y||He!==void 0,"aria-label":!Y&&He!==void 0?`${kt}: ${He}`:kt,onClick:()=>void bt(),children:kt})})})]}),children:m.jsxs(Wn,{sx:{gap:1.5},children:[oe?m.jsx(go,{severity:"error",action:h&&rz(u)?st(h):void 0,children:"Couldn't read this package's models, so no view is listed to start from."}):c.length===0?!f&&m.jsxs(go,{severity:"info",children:["This package has no models yet. Add a .malloy file that declares a source with a view, then create a ",$e," from it."]}):de.length>0?m.jsxs(go,{severity:"warning",action:fe?st(ce):void 0,children:["Couldn't read ",de.join(", "),", so nothing from"," ",de.length===1?"it":"them"," is listed."]}):te&&J.size===0&&m.jsxs(go,{severity:"info",children:["A ",$e," starts from a view of a source, and no model in this package declares one yet. Add a view to a source in a model file and this list fills in."]}),m.jsxs(mt,{sx:{mx:-3,mb:-1,borderTop:`1px solid ${Le}`,borderBottom:`1px solid ${Le}`,display:"grid",gridTemplateColumns:{xs:"1fr",md:"320px minmax(0, 1fr)"},height:{md:500}},children:[m.jsx(mt,{sx:{display:"flex",flexDirection:"column",minHeight:0,borderRight:{md:`1px solid ${Le}`},maxHeight:{xs:280,md:"none"}},children:m.jsx(Xae,{groups:le,query:B,onQuery:E,picked:Ne,onPick:be,onTake:ct=>{be(ct)},searchRef:L,disabled:Y,empty:m.jsx(Ct,{variant:"body2",sx:{color:"text.secondary",p:2},children:ot?"Reading the package's models…":"Nothing to start from."})})}),m.jsxs(mt,{sx:ct=>({p:2.5,display:"flex",flexDirection:"column",gap:2,minHeight:0,overflowY:"auto",bgcolor:`color-mix(in srgb, ${ct.palette.text.primary} 3%, ${ct.palette.background.paper})`}),children:[R&&m.jsxs(mt,{children:[m.jsx(kN,{children:"Layout"}),m.jsx(mt,{role:"radiogroup","aria-label":"Layout",sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:["linear","grid"].map(ct=>m.jsx(u1e,{layout:ct,checked:k===ct,disabled:Y,onPick:()=>T(ct)},ct))}),m.jsx(Ct,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"Switch it any time in the builder."})]}),m.jsxs(mt,{children:[m.jsx(kN,{children:"First query"}),m.jsx(mt,{role:"region","aria-label":"Preview",sx:ct=>({height:200,display:"flex",position:"relative",overflow:"hidden",borderRadius:ft.radius.tile,border:`1px solid ${Le}`,bgcolor:ct.palette.background.paper,"&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:40,pointerEvents:"none",background:`linear-gradient(to bottom, transparent, ${ct.palette.background.paper})`}}),children:Ie&&ge?m.jsx(mt,{sx:{flex:1,minWidth:0,px:2,pt:1.5},children:m.jsx(o3,{environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},modelPath:I,tile:`${ge.source} -> ${ge.view}`,label:N.trim()||Tw(ge.view),borderless:!0,givens:l1e,declaredTypes:c1e,height:180})}):m.jsx(Ct,{variant:"body2",sx:{color:"text.secondary",m:"auto"},children:Rt?"What you picked is no longer in this model; pick something else.":"Pick what to start from."})}),m.jsx(Ct,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"More are added in the builder."})]}),m.jsx(wi,{size:"small",label:"Title",value:N,disabled:Y,onChange:ct=>{W(!0),F(ct.target.value)},InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Report title"},error:Ut,helperText:Ut?_t:g.route==="package"?"Names the file too, unless you type a location.":y??`Saved as a new ${$e} in the host's store, and opened in the builder.`}),m.jsx(wi,{size:"small",label:"Location",value:O??se??"",placeholder:"report.malloy",disabled:Y,onChange:ct=>A(ct.target.value),InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Location"},error:rt!==void 0,helperText:rt??(Qe?`Written as ${Qe} in the package, and opened in the builder.`:"A path in the package; the package root by default.")}),ue&&m.jsx(go,{severity:"error",children:ue})]})]})]})})}function s1e(e,t){const[n,r]=C.useState(void 0);return C.useEffect(()=>{const o=window.setTimeout(()=>r(e),t);return()=>window.clearTimeout(o)},[e,t]),n}const Bw=(e,t,n)=>`${e}::${t}::${n}`,l1e=new Map,c1e=new Map;function kN({children:e}){const t=eo().theme.ui;return m.jsx(Ct,{component:"div",sx:{...t.type.label,color:"text.secondary",mb:.75},children:e})}function u1e({layout:e,checked:t,disabled:n,onPick:r}){const{theme:o}=eo(),a=o.ui,i=Id(o.cardBorder),s=t?o.accent:"currentColor";return m.jsxs(dl,{role:"radio","aria-checked":t,"aria-label":e==="linear"?"Linear":"Grid",disabled:n,onClick:r,sx:c=>({justifyContent:"flex-start",gap:1.25,px:1.25,py:1,borderRadius:a.radius.tile,border:`1px solid ${t?o.accent:i}`,boxShadow:t?`0 0 0 1px ${o.accent}`:"none",bgcolor:t?`color-mix(in srgb, ${o.accent} 6%, ${c.palette.background.paper})`:c.palette.background.paper,color:c.palette.text.secondary,textAlign:"left"}),children:[m.jsx("svg",{width:"34",height:"26",viewBox:"0 0 34 26","aria-hidden":!0,children:e==="linear"?m.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[m.jsx("rect",{x:"3",y:"2",width:"28",height:"7",rx:"1.5"}),m.jsx("rect",{x:"3",y:"12",width:"28",height:"5",rx:"1.5"}),m.jsx("path",{d:"M5 21.5h20",strokeLinecap:"round"})]}):m.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[m.jsx("rect",{x:"2",y:"2",width:"14",height:"10",rx:"1.5"}),m.jsx("rect",{x:"18",y:"2",width:"14",height:"10",rx:"1.5"}),m.jsx("rect",{x:"2",y:"14",width:"30",height:"10",rx:"1.5"})]})}),m.jsxs(mt,{children:[m.jsx(mt,{sx:{...a.type.control,fontWeight:t?a.type.label.fontWeight:500,color:t?o.accent:"text.primary"},children:e==="linear"?"Linear":"Grid"}),m.jsx(mt,{sx:{...a.type.caption,color:"text.secondary"},children:e==="linear"?"Read top to bottom":"Tiles side by side"})]})]})}const d1e=kn(m.jsx("path",{d:"M21 11h-1.5v-.5h-2v3h2V13H21v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1zM8 10v5H6.5v-1.5h-2V15H3v-5c0-.55.45-1 1-1h3c.55 0 1 .45 1 1m-1.5.5h-2V12h2zm7 1.5c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1h-4V9h4c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1M11 10.5v.75h2v-.75zm2 2.25h-2v.75h2z"})),f1e=kn(m.jsx("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V10h16zm0-13H4V5h16z"})),p1e=kn(m.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),h1e=kn(m.jsx("path",{d:"M4 7v2c0 .55-.45 1-1 1H2v4h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h3v-2H7c-.55 0-1-.45-1-1v-2c0-1.3-.84-2.42-2-2.83v-.34C5.16 11.42 6 10.3 6 9V7c0-.55.45-1 1-1h3V4H7C5.35 4 4 5.35 4 7m17 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-3v2h3c.55 0 1 .45 1 1v2c0 1.3.84 2.42 2 2.83v.34c-1.16.41-2 1.52-2 2.83v2c0 .55-.45 1-1 1h-3v2h3c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-4z"})),m1e=kn(m.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"})),g1e=kn(m.jsx("path",{d:"M20 10V8h-4V4h-2v4h-4V4H8v4H4v2h4v4H4v2h4v4h2v-4h4v4h2v-4h4v-2h-4v-4zm-6 4h-4v-4h4z"})),y1e=kn(m.jsx("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6m0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4m0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),v1e=kn(m.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"})),U3={dashboard:qr.blue,report:qr.violet,model:qr.cyan,dataApp:qr.pink,data:qr.lime,materialization:qr.amber,agent:qr.red};function B3({type:e,size:t=18,sx:n,...r}){return m.jsx(i0,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:b1e[e]()})}const b1e={report:x1e,model:S1e,data:w1e,materialization:C1e,dataApp:E1e,dashboard:k1e,agent:R1e};function x1e(){return m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M14 3 H6 a2 2 0 0 0 -2 2 v14 a2 2 0 0 0 2 2 h12 a2 2 0 0 0 2 -2 V9 z"}),m.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),m.jsx("path",{d:"M8 17 v-3"}),m.jsx("path",{d:"M12 17 v-6"}),m.jsx("path",{d:"M16 17 v-4"})]})}function S1e(){return m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),m.jsx("path",{d:"M4 7 l8 4 l8 -4"}),m.jsx("path",{d:"M12 11 v10"})]})}function w1e(){return m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),m.jsx("path",{d:"M3.5 9.5 H20.5"}),m.jsx("path",{d:"M9.5 3.5 V20.5"})]})}function C1e(){return m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M12 3 L21 7.5 L12 12 L3 7.5 Z"}),m.jsx("path",{d:"M3 12 L12 16.5 L21 12"}),m.jsx("path",{d:"M3 16.5 L12 21 L21 16.5"})]})}function k1e(){return m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),m.jsx("path",{d:"M3.5 9.5 H20.5"}),m.jsx("path",{d:"M12 9.5 V20.5"}),m.jsx("path",{d:"M12 15 H20.5"})]})}function R1e(){return m.jsxs(m.Fragment,{children:[m.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),m.jsx("path",{d:"M5 20 a7 7 0 0 1 14 0"})]})}function E1e(){return m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),m.jsx("path",{d:"M3.5 9.5 H20.5"}),m.jsx("path",{d:"M7 13.5 H17"}),m.jsx("path",{d:"M7 16.5 H13"})]})}function V3(e){return e>=1e9?`${(e/1e9).toFixed(1)} B rows`:e>=1e6?`${(e/1e6).toFixed(1)} M rows`:e>=1e3?`${(e/1e3).toFixed(1)} K rows`:`${e} rows`}const T1e=12;function $1e(e){const t=e?.trim().toLowerCase()??"";if(t.startsWith("array")||t.endsWith("[]"))return p1e;if(t.startsWith("record")||t.startsWith("struct"))return h1e;switch(t.split(/[\s(<]/)[0]){case"string":return d1e;case"number":return g1e;case"date":return f1e;case"timestamp":case"timestamptz":return m1e;case"boolean":return y1e;default:return v1e}}function M1e({column:e}){const t=$1e(e.type);return m.jsxs(mt,{component:"li",sx:n=>({display:"flex",alignItems:"center",gap:1.25,px:1,py:.625,borderRadius:1,transition:"background-color 0.1s","&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.06)":n.palette.grey[100]}}),children:[m.jsx(t,{"aria-hidden":!0,sx:{fontSize:18,color:"primary.main",flexShrink:0}}),m.jsxs(mt,{sx:{display:"flex",alignItems:"baseline",gap:1,minWidth:0,flex:1},children:[m.jsx(Ct,{component:"span",sx:{fontFamily:Uo,fontSize:"0.8125rem",fontWeight:500,color:"text.primary",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),e.type&&m.jsx(Ct,{component:"span",variant:"caption",color:"text.secondary",sx:{flexShrink:0,maxWidth:"50%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.type})]})]})}function O1e({database:e,onClose:t}){const n=e!==null,[r,o]=C.useState(e);e!==null&&e!==r&&o(e);const[a,i]=C.useState(""),[s,c]=C.useState(r?.path);s!==r?.path&&(c(r?.path),i(""));const f=C.useId(),u=r?.path??"",h=u.split("/").pop()||u,g=u.slice(0,Math.max(0,u.length-h.length-1)),y=r?.info?.rowCount,b=[g,y===void 0?null:V3(y)].filter(Boolean).join(" · "),S=C.useMemo(()=>r?.info?.columns??[],[r]),w=a.trim().toLowerCase(),x=C.useMemo(()=>w?S.filter(R=>R.name?.toLowerCase().includes(w)||R.type?.toLowerCase().includes(w)):S,[S,w]);return m.jsxs($o,{open:n,onClose:t,showClose:!0,title:m.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1.5,sx:{minWidth:0},children:[m.jsx(mt,{"aria-hidden":!0,sx:{width:32,height:32,borderRadius:1,bgcolor:U3.data,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:m.jsx(B3,{type:"data",size:18})}),m.jsxs(mt,{sx:{minWidth:0},children:[m.jsx(Ct,{component:"span",noWrap:!0,title:u,sx:{display:"block",fontFamily:Uo,fontSize:"1rem",fontWeight:600,letterSpacing:0,lineHeight:1.4},children:h||"Columns"}),b&&m.jsx(Ct,{component:"span",variant:"caption",color:"text.secondary",noWrap:!0,sx:{display:"block",lineHeight:1.4},children:b})]})]}),children:[r?.error&&m.jsx(go,{severity:"error",variant:"outlined",children:r.error}),r&&!r.error&&m.jsxs(mt,{component:"section","aria-labelledby":f,sx:{display:"flex",flexDirection:"column",border:"1px solid",borderColor:"divider",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",mb:2},children:[m.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1,sx:{px:1.5,py:1,minHeight:44,borderBottom:"1px solid",borderColor:"divider"},children:[m.jsxs(Ct,{id:f,component:"h3",sx:{fontSize:"0.875rem",fontWeight:600},children:["Columns",m.jsxs(Ct,{component:"span",variant:"caption",color:"text.secondary",sx:{ml:.75,fontVariantNumeric:"tabular-nums"},children:["· ",w?`${x.length} of `:"",S.length]})]}),S.length>T1e&&m.jsx(nx,{value:a,onChange:R=>i(R.target.value),placeholder:"Filter columns",inputProps:{"aria-label":"Filter columns"},startAdornment:m.jsx(OR,{position:"start",children:m.jsx(Mp,{sx:{fontSize:16,color:"text.secondary"}})}),sx:{ml:"auto !important",width:200,fontSize:"0.8125rem",px:1,py:.25,border:"1px solid",borderColor:"divider",borderRadius:1.5,"&.Mui-focused":{borderColor:"primary.main"}}})]}),m.jsx(mt,{sx:{overflowY:"auto",maxHeight:420,px:.75,py:.75},children:x.length===0?m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic",px:1,py:1},children:w?"No columns match":"No columns"}):m.jsx(mt,{component:"ul","aria-labelledby":f,sx:{listStyle:"none",m:0,p:0},children:x.map((R,k)=>m.jsx(M1e,{column:R},`${R.name}-${k}`))})})]})]})}const H3=(e,t,n)=>["packageVersions",e,t,n];async function q3(e,t,n){try{return(await e.versions.listPackageVersions(t,n)).data}catch(r){const o=r?.response?.status;if(o===404||o===501)return[];throw r}}function P1e(e,t,n={}){const{apiClients:r,server:o}=hr(),a=(n.enabled??!0)&&e!==""&&t!=="",i=VR({queryKey:H3(e,t,o),queryFn:()=>q3(r,e,t),enabled:a,staleTime:3e4,retry:!1}),{refetch:s}=i,c=C.useCallback(()=>void s(),[s]),f=i.data??[];return{versions:f,latest:f.find(u=>u.latest)?.id,isPending:a&&i.isPending,isError:a&&i.isError,refetch:c}}function A1e(e,t){const{apiClients:n,server:r}=hr(),o=xl();return C.useCallback(()=>o.fetchQuery({queryKey:H3(e,t,r),queryFn:()=>q3(n,e,t),staleTime:0,retry:!1}),[o,n,r,e,t])}function D1e(e,t){const n=xl();return C.useCallback(()=>n.invalidateQueries({predicate:r=>r.queryKey[1]===e&&r.queryKey[2]===t}),[n,e,t])}const j1e=kn(m.jsx("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27M6.24 5h11.52l.81.97H5.44zM5 19V8h14v11zm8.45-9h-2.9v3H8l4 4 4-4h-2.55z"})),N1e=kn(m.jsx("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"})),I1e=kn(m.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),L1e=kn(m.jsx("path",{d:"M14 4v5c0 1.12.37 2.16 1 3H9c.65-.86 1-1.9 1-3V4zm3-2H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3V4h1c.55 0 1-.45 1-1s-.45-1-1-1"})),z1e=kn(m.jsx("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27M6.24 5h11.52l.83 1H5.42zM5 19V8h14v11zm3-5h2.55v3h2.9v-3H16l-4-4z"})),Ym=e=>{const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error?e.message:"Unknown error"},F1e=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},cp=e=>e.archiveStatus==="archive",Vw="Tables built for this version alone (under scope: version) are dropped.";function RN(e,t){const n=!cp(e)&&t.filter(o=>!cp(o)).length<=1,r=t.length<=1;return{archive:e.latest?"The latest version can't be archived":n?"The last version in service can't be archived":void 0,delete:r?void 0:e.latest?"Pin another version as latest first":n?"The last version in service; delete the archived versions first":void 0}}function _1e({environmentName:e,packageName:t,versions:n,selectedVersionId:r,onSelectVersion:o,onReplaceVersion:a,onPackageDeleted:i,canManage:s}){const{apiClients:c}=hr(),f=xl(),u=D1e(e,t),h=A1e(e,t),[g,y]=C.useState(null),[b,S]=C.useState(null),[w,x]=C.useState(null),[R,k]=C.useState(null),[T,O]=C.useState(null),[A,I]=C.useState(null),j=C.useRef(null),_=C.useRef(null),z=C.useRef(null),B=C.useRef(new Map),E=n.find(fe=>fe.latest)?.id,L=r??E,N=()=>Promise.all([u(),f.invalidateQueries({queryKey:["packages",e]})]),F=async(fe,he)=>{const me=he??await h().catch(()=>{});if(me===void 0)return;const le=me.find(Ie=>Ie.latest)?.id,be=le??me.find(Ie=>Ie.id!==fe&&!cp(Ie))?.id;be!==void 0&&(a?a(be===le?void 0:be):o(be))},D=Rb({mutationFn:fe=>c.versions.setPackageLatestVersion(e,t,{version:fe}),onSuccess:async()=>{x(null),await N()},onError:()=>void N()}),W=Rb({mutationFn:({id:fe,archiveStatus:he})=>c.versions.updatePackageVersion(e,t,fe,{archiveStatus:he}),onSuccess:async(fe,{id:he,archiveStatus:me})=>{k(null),me==="archive"&&he===L&&await F(he),await N()},onError:(fe,{id:he,archiveStatus:me})=>{me==="unarchive"&&I(`Couldn't unarchive v${he}: ${Ym(fe)}`),N()}}),K=W.isPending?W.variables?.id:void 0,ae=Rb({mutationFn:({id:fe})=>c.versions.deletePackageVersion(e,t,fe),onSuccess:async(fe,{id:he,read:me})=>{O(null);const le=await h().catch(()=>{})??me.filter(be=>be.id!==he);if(le.length===0){await f.invalidateQueries({queryKey:["packages",e]}),i?.();return}he===L&&await F(he,le),await N()},onError:()=>void N()}),Y=()=>S(null),re=b?RN(b.version,n):{},ue=b!==null&&!cp(b.version)&&b.version.latest&&re.archive!==void 0&&re.delete!==void 0,X=T!==null&&T.versions===void 0,oe=T?.versions!==void 0&&T.versions.length<=1,J=T?.versions!==void 0?RN(T.version,T.versions).delete:void 0,ee=async fe=>{Y(),y(null),ae.reset(),O({version:fe});const he=be=>O(Ie=>Ie!==null&&Ie.version.id===fe.id&&Ie.versions===void 0?be:Ie);let me;try{me=await h()}catch(be){he(null),I(`Couldn't check v${fe.id} before deleting it: ${Ym(be)}`);return}const le=me.find(be=>be.id===fe.id);if(le===void 0){he(null),I(`v${fe.id} is no longer a version of ${t}.`),N();return}he({version:le,versions:me})},te=(fe,he)=>{!s||K===fe.id||S({version:fe,anchor:B.current.get(fe.id)??he})},de=(fe,he)=>{const me=fe.key==="ArrowRight"||fe.key==="ContextMenu"||fe.key==="F10"&&fe.shiftKey;!s||!me||(fe.preventDefault(),fe.stopPropagation(),te(he,fe.currentTarget))},ce=b&&m.jsxs(Qo,{disabled:re.delete!==void 0,onClick:()=>void ee(b.version),children:[m.jsx(il,{children:m.jsx(Uz,{fontSize:"small"})}),m.jsx(bi,{primary:"Delete version",secondary:re.delete})]},"delete");return m.jsxs(m.Fragment,{children:[m.jsx(tr,{size:"small",variant:"outlined",endIcon:m.jsx(N1e,{}),"aria-label":L?`Version v${L}, change version`:"Select a version","aria-haspopup":"menu",onClick:fe=>y(fe.currentTarget),sx:{borderRadius:999,textTransform:"none",fontWeight:500,px:1.5,minWidth:0,whiteSpace:"nowrap"},children:L?`v${L}`:"Select a version"}),m.jsx(nc,{anchorEl:g,open:g!==null,onClose:()=>y(null),slotProps:{paper:{sx:{minWidth:320,maxWidth:400,mt:1,borderRadius:3}},list:{"aria-label":`Versions of ${t}`,disabledItemsFocusable:!0}},children:n.map(fe=>{const he=fe.id===L,me=cp(fe),le=[me?"Archived":void 0,F1e(fe.createdAt),fe.gitCommitSha?fe.gitCommitSha.slice(0,7):void 0].filter(Boolean).join(" · ");return m.jsxs(Qo,{"aria-current":he?"true":void 0,"aria-disabled":me&&!s?"true":void 0,"aria-haspopup":s?"menu":void 0,"data-testid":"version-row",onKeyDown:be=>de(be,fe),onClick:be=>{if(me){te(fe,be.currentTarget);return}he||(y(null),o(fe.id,be))},sx:be=>({gap:1,borderLeft:"3px solid",borderLeftColor:he?be.palette.primary.main:"transparent",backgroundColor:he?Ps(be.palette.primary.main,.04):void 0,cursor:he||me&&!s?"default":"pointer"}),children:[m.jsx(bi,{primary:fe.id,secondary:le,sx:{opacity:me?.6:1},slotProps:{primary:{sx:{fontWeight:he?600:400}}}}),fe.latest&&m.jsx(ER,{size:"small",label:"Latest",color:"info",variant:"outlined",sx:{height:20,fontSize:11,fontWeight:600}}),s&&m.jsx(Jo,{title:K===fe.id?"Updating this version…":"",children:m.jsx("span",{children:m.jsx(xo,{ref:be=>{be?B.current.set(fe.id,be):B.current.delete(fe.id)},size:"small","aria-label":`More actions for version ${fe.id}`,"aria-haspopup":"menu",disabled:K===fe.id,onClick:be=>{be.stopPropagation(),S({version:fe,anchor:be.currentTarget})},children:m.jsx(I1e,{fontSize:"small"})})})})]},fe.id)})}),m.jsx(nc,{anchorEl:b?.anchor??null,open:b!==null,onClose:Y,slotProps:{list:{"aria-label":b?`Actions for version ${b.version.id}`:void 0,disabledItemsFocusable:!0,autoFocus:ue}},children:b&&cp(b.version)?[m.jsxs(Qo,{onClick:()=>{const{id:fe}=b.version;Y(),W.mutate({id:fe,archiveStatus:"unarchive"})},children:[m.jsx(il,{children:m.jsx(z1e,{fontSize:"small"})}),m.jsx(bi,{primary:"Unarchive"})]},"unarchive"),m.jsx(pl,{},"divider"),ce]:b&&[m.jsxs(Qo,{disabled:b.version.latest,onClick:()=>{x(b.version),D.reset(),Y(),y(null)},children:[m.jsx(il,{children:m.jsx(L1e,{fontSize:"small"})}),m.jsx(bi,{primary:"Pin as latest",secondary:b.version.latest?"Already the latest version":void 0})]},"pin-latest"),m.jsxs(Qo,{disabled:re.archive!==void 0,onClick:()=>{k(b.version),W.reset(),Y(),y(null)},children:[m.jsx(il,{children:m.jsx(j1e,{fontSize:"small"})}),m.jsx(bi,{primary:"Archive",secondary:re.archive})]},"archive"),m.jsx(pl,{},"divider"),ce]}),m.jsx($o,{open:w!==null,onClose:()=>{D.isPending||x(null)},title:w?`Pin v${w.id} as latest`:"",description:w?`Requests that name no version will be served from v${w.id}.`:void 0,initialFocus:j,actions:m.jsxs(m.Fragment,{children:[m.jsx(tr,{ref:j,disabled:D.isPending,onClick:()=>x(null),children:"Cancel"}),m.jsx(tr,{variant:"contained",loading:D.isPending,onClick:()=>w&&D.mutate(w.id),children:"Pin as latest"})]}),children:m.jsxs(Wn,{spacing:1.5,children:[E&&w&&E!==w.id&&m.jsx(Ct,{variant:"body2",color:"text.secondary",children:`The latest version is v${E} now. Links and requests that name a version keep answering as before.`}),D.isError&&w&&m.jsx(go,{severity:"error",role:"alert",children:`Couldn't pin v${w.id} as latest: ${Ym(D.error)}`})]})}),m.jsx($o,{open:R!==null,onClose:()=>{W.isPending||k(null)},title:R?`Archive v${R.id}`:"",description:R?`v${R.id} stops being served and is unloaded. Its files stay, so it can be unarchived.`:void 0,initialFocus:_,actions:m.jsxs(m.Fragment,{children:[m.jsx(tr,{ref:_,disabled:W.isPending,onClick:()=>k(null),children:"Cancel"}),m.jsx(tr,{variant:"contained",loading:W.isPending,onClick:()=>R&&W.mutate({id:R.id,archiveStatus:"archive"}),children:"Archive"})]}),children:m.jsxs(Wn,{spacing:1.5,children:[m.jsx(Ct,{variant:"body2",color:"text.secondary",children:`${Vw} Its scheduled builds stop, and once unarchived it serves live until it is built again.`}),W.isError&&R&&m.jsx(go,{severity:"error",role:"alert",children:`Couldn't archive v${R.id}: ${Ym(W.error)}`})]})}),m.jsx($o,{open:T!==null,onClose:()=>{ae.isPending||O(null)},title:T?`Delete v${T.version.id}`:"",initialFocus:z,actions:m.jsxs(m.Fragment,{children:[m.jsx(tr,{ref:z,disabled:ae.isPending,onClick:()=>O(null),children:"Cancel"}),m.jsx(tr,{variant:"contained",color:"error",loading:ae.isPending,disabled:X||J!==void 0,onClick:()=>T?.versions&&ae.mutate({id:T.version.id,read:T.versions}),children:oe?"Delete package":"Delete version"})]}),children:m.jsxs(Wn,{spacing:1.5,children:[X&&T&&m.jsx(Ct,{variant:"body2",children:`Checking ${t}'s versions before deleting v${T.version.id}…`}),T&&!X&&m.jsx(Ct,{variant:"body2",children:oe?`v${T.version.id} is the only version of ${t}, so deleting it deletes the package. ${Vw} This cannot be undone.`:`v${T.version.id} stops being served and its files are removed. ${Vw} Links that name it stop working, and this cannot be undone.`}),J!==void 0&&T&&m.jsx(go,{severity:"warning",role:"alert",children:`v${T.version.id} can't be deleted now: ${J}.`}),ae.isError&&T&&m.jsx(go,{severity:"error",role:"alert",children:`Couldn't delete v${T.version.id}: ${Ym(ae.error)}`})]})}),m.jsx(dy,{open:A!==null,autoHideDuration:8e3,onClose:()=>I(null),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:m.jsx(mt,{children:m.jsx(go,{severity:"error",variant:"filled",onClose:()=>I(null),children:A})})})]})}const U1e="README.malloynb",B1e=e=>!!e&&!e.includes("/")&&Gx(e)?.toLowerCase()==="readme";function vCe({onClickPackageFile:e,onOpenDocument:t,resourceUri:n,onEvent:r,onSelectVersion:o,onReplaceVersion:a}){const{apiClients:i,server:s,mutable:c}=hr(),f=xl(),u=e??(ge=>{window.location.href=ge}),{environmentName:h,packageName:g,versionId:y}=to(n),b=P1e(h,g),{versions:S}=b,w=S.length>0,x=!w&&!b.isPending&&!b.isError,R=o??((ge,se)=>u(`/${encodeURIComponent(h)}/${encodeURIComponent(g)}/${encodeURIComponent(ge)}`,se)),k=t??((ge,se)=>{const Ge=ge.mode==="edit"?qye(h,g,ge.path):FF(h,g,ge.path);se?u(Ge,se):u(Ge)}),[T,O]=C.useState(null),[A,I]=C.useState(!1),j=Vve(),_=JF()?.documentStorage,[z,B]=C.useState([]),[E,L]=C.useState({state:_?"pending":"ready"}),N=C.useCallback(async()=>{if(!_)return;let ge;try{ge=await _.listWorkspaces(!1)}catch{L({state:"failed"});return}L({state:"ready",chosen:qF(ge)});const se=[],Ge=Kg(h,g,"");for(const Ae of ge.filter(Qe=>Qe.writeable))for(const Qe of await _.listDocuments(Ae))Qe.path.startsWith(Ge)&&se.push({locator:Qe,where:Ae.description});B(se)},[_,h,g]);C.useEffect(()=>{N()},[N]);const F=ge=>ge.path.slice(Kg(h,g,"").length),D=To({queryKey:["package",h,g,y],queryFn:()=>i.packages.getPackage(h,g,y,!1)}),W=_F(h,g,y),K=To({queryKey:["models",h,g,y],queryFn:()=>i.models.listModels(h,g,y)}),ae=To({queryKey:["databases",h,g,y],queryFn:()=>i.databases.listDatabases(h,g,y)}),Y=To({queryKey:["data-apps",h,g,y],queryFn:async()=>{try{return await i.dataApps.listDataApps(h,g,y)}catch(ge){const se=ge?.response?.status;if(se===404||se===void 0)return{data:[]};throw ge}}}).data?.data??[],re=W.reports.filter(ge=>!!ge.path),ue=H1e(re),X=new Set(re.map(ge=>ge.path).filter(ge=>ge!==void 0)),oe=(K.data?.data??[]).slice().filter(ge=>!X.has(ge.path)).sort((ge,se)=>ge.path.localeCompare(se.path)),J=(ae.data?.data??[]).slice().sort((ge,se)=>ge.path.localeCompare(se.path)),ee=E.state==="ready"?wve({authoritative:E.chosen?.authoritative===!0,mutable:c&&x,canStore:E.chosen?.writeable===!0,...y===void 0?{}:{versionId:y}}):void 0,te=W.settled&&(K.isSuccess||K.isError),de=ee!==void 0&&te,ce=de&&!j,fe=C.useMemo(()=>{if(!de)return;const ge=[...W.reports.flatMap(se=>se.path?[se.path]:[]),...(K.data?.data??[]).flatMap(se=>se.path?[se.path]:[])];if(ee==="storage"&&_&&E.state==="ready")return E.chosen?{route:ee,storage:_,workspace:E.chosen,environmentName:h,packageName:g,existing:ge}:void 0;if(ee==="package")return{route:ee,existing:ge,write:async(se,Ge)=>{await i.models.updateModelSource(h,g,se,{source:Ge})}}},[de,ee,_,E,h,g,i,W.reports,K.data]),he=D.data?.data?.description??"",me=D.data?.data?.agents??[],le=(re.find(ge=>ge.path===U1e)??re.find(ge=>B1e(ge.path)))?.path,be=!W.settled,Ie=w?m.jsx(_1e,{environmentName:h,packageName:g,versions:S,...y!==void 0?{selectedVersionId:y}:{},onSelectVersion:R,...a?{onReplaceVersion:a}:{},onPackageDeleted:()=>u(`/${encodeURIComponent(h)}`),canManage:c}):null,Ne=m.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1.5,sx:{mb:.5},children:[m.jsx(Ct,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em"},children:g}),Ie]});if(D.isError){const ge=m.jsx(Ma,{error:D.error,context:`${h} > ${g}`});return Ie?m.jsxs(Qb,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[m.jsx(mt,{sx:{mb:4},children:Ne}),ge]}):ge}return m.jsxs(Qb,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[m.jsxs(mt,{sx:{mb:4},children:[Ne,he&&m.jsx(Ct,{variant:"body2",color:"text.secondary",children:he})]}),m.jsx(o1e,{warnings:D.data?.data?.warnings}),b.isError&&m.jsx(mt,{sx:{mb:4},children:m.jsx(go,{severity:"warning",action:m.jsx(tr,{color:"inherit",size:"small",onClick:b.refetch,children:"Retry"}),children:"Could not read this package's versions, so nothing that changes it is offered until they load."})}),be&&m.jsx(va,{text:"Loading package..."}),fe&&m.jsx(i1e,{open:A,layout:"linear",environmentName:h,packageName:g,...y!==void 0?{versionId:y}:{},models:oe.map(ge=>ge.path).filter(ge=>typeof ge=="string"&&ge.endsWith(".malloy")&&!X.has(ge)),modelsLoading:K.isPending,...K.isError?{modelsError:K.error}:{},onRetryModels:()=>void K.refetch(),target:fe,...r?{onEvent:r}:{},onClose:()=>I(!1),onCreated:ge=>{I(!1),Ave(f,h,g),f.invalidateQueries({queryKey:["models"]}),k({path:ge.path,layout:ge.layout,slug:ge.slug,mode:"edit"})}}),!be&&m.jsxs(m.Fragment,{children:[W.isError&&m.jsx(mt,{sx:{mb:4},children:m.jsx(go,{severity:"warning",action:m.jsx(tr,{color:"inherit",size:"small",onClick:()=>void W.refetch(),children:"Retry"}),children:"Could not list this package's reports, so any it has are missing from this page."})}),(ue.length>0||de)&&m.jsxs($s,{title:"Reports",count:ue.length,...ce?{action:m.jsx(xy,{label:"Report",onClick:()=>I(!0)})}:{},children:[ue.length===0&&m.jsx(Hw,{label:"No reports yet",...ce?{action:{label:"Add report",onClick:()=>I(!0)}}:{}}),ue.map(ge=>m.jsx(rp,{type:ge.layout==="grid"?"dashboard":"report",label:ge.label,rightLabel:ge.layout,...ge.secondary===void 0?{}:{description:ge.secondary},onClick:se=>ge.path.endsWith(".malloynb")?u(`/${h}/${g}/${ge.path}`,se):k({path:ge.path,layout:ge.layout,slug:ge.slug,mode:"view"},se)},ge.path))]}),x&&z.length>0&&m.jsx($s,{title:"Drafts",count:z.length,children:z.map(({locator:ge,where:se})=>m.jsx(rp,{type:ge.type==="grid"?"dashboard":"report",label:F(ge),rightLabel:se,onClick:Ge=>k({path:F(ge),layout:ge.type,slug:Gx(F(ge))??"",mode:"edit"},Ge),trailingAction:m.jsx(Jo,{title:"Delete this draft",children:m.jsx(xo,{size:"small","aria-label":`Delete draft ${F(ge)}`,onClick:Ge=>{Ge.stopPropagation(),_?.deleteDocument(ge).then(N)},children:m.jsx(Uz,{fontSize:"small"})})})},`${ge.workspace}:${ge.path}`))}),Y.length>0&&m.jsx($s,{title:"Apps",count:Y.length,children:Y.map(ge=>{const se=!!ge.title&&ge.title!==ge.path,Ge=`${x3(s)}${ge.resource}`;return m.jsx(rp,{type:"dataApp",label:se?ge.title:ge.path,rightLabel:se?ge.path:void 0,onClick:Ae=>{e?e(`/${h}/${g}/data-apps/${ge.path}`,Ae):Ae&&(Ae.metaKey||Ae.ctrlKey)?window.open(Ge,"_blank"):window.location.href=Ge},trailingAction:m.jsx(Jo,{title:"Open standalone in new tab",children:m.jsx(xo,{size:"small",href:Ge,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",onClick:Ae=>Ae.stopPropagation(),sx:{color:"text.secondary"},children:m.jsx(b3,{fontSize:"small"})})})},ge.path)})}),m.jsxs($s,{title:"Models",count:oe.length,children:[oe.map(ge=>m.jsx(rp,{type:"model",label:ge.path,onClick:se=>u(`/${h}/${g}/${ge.path}`,se)},ge.path)),oe.length===0&&m.jsx(Hw,{label:"No models"})]}),me.length>0&&m.jsx($s,{title:"Agents",count:me.length,description:"Declared in publisher.json. Name one in an agent session to work as it. Schedules are listed only; nothing runs them yet.",children:me.map(ge=>m.jsx(V1e,{agent:ge},ge.name))}),m.jsxs($s,{title:"Data",count:J.length,children:[J.map(ge=>m.jsx(rp,{type:"data",label:ge.path,rightLabel:ge.info?V3(ge.info.rowCount):"Unreadable",onClick:()=>O(ge)},ge.path)),J.length===0&&m.jsx(Hw,{label:"No data files"})]}),m.jsx(Hxe,{resourceUri:n,versioned:!x}),le&&m.jsx(mt,{sx:{mt:6},children:m.jsx(a1e,{resourceUri:Xx({environmentName:h,packageName:g,versionId:y}),path:le,onLinkNavigate:u})})]}),m.jsx(O1e,{database:T,onClose:()=>O(null)})]})}function rp({type:e,label:t,description:n,rightLabel:r,onClick:o,trailingAction:a}){return m.jsx(Zx,{icon:m.jsx(B3,{type:e}),tint:U3[e],label:t,mono:!0,...n===void 0?{}:{description:n},...r===void 0?{}:{rightLabel:r},...o===void 0?{}:{onClick:o},...a===void 0?{}:{trailingAction:a}})}function V1e({agent:e}){return m.jsxs(m.Fragment,{children:[m.jsx(rp,{type:"agent",label:e.name??"",...e.description?{description:e.description}:{},...e.model&&e.model!=="inherit"?{rightLabel:e.model}:{}}),(e.schedules??[]).map(t=>{const n=lT(t.cron??"");return m.jsxs(Ct,{variant:"caption",color:"text.secondary",sx:{display:"block",ml:6,mb:.5},children:[n.valid?n.description:t.cron," (UTC), task"," ",t.task,". Not run yet."]},`${t.cron}|${t.task}`)})]})}function H1e(e){const t=e.map(r=>({path:r.path??"",layout:ZE(r),slug:Gx(r.path)??r.path??"",title:r.title})),n=new Map;for(const r of t)n.set(r.slug,(n.get(r.slug)??0)+1);return t.map(({title:r,...o})=>{const a=!!r&&r!==o.slug&&r!==o.path,i=(n.get(o.slug)??0)>1,s=a?r:o.path.endsWith(".malloynb")?o.path:o.slug;return{...o,label:s,secondary:s!==o.path&&(a||i||o.path.includes("/"))?o.path:void 0}}).sort((r,o)=>r.label.localeCompare(o.label)||r.path.localeCompare(o.path))}function Hw({label:e,action:t}){return m.jsxs(Wn,{direction:"row",sx:{alignItems:"center",gap:1,py:1},children:[m.jsx(Ct,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:e}),t&&m.jsx(tr,{size:"small",onClick:t.onClick,children:t.label})]})}const EN=/^publisher:document:(dashboard|notebook):(.+)$/;function q1e(e,t){const n=[];for(let r=0;r<e.length;r++){const o=e.key(r);o!==null&&EN.test(o)&&n.push(o)}for(const r of n){const[,o,a]=EN.exec(r),i=e.getItem(r);i!==null&&t(a,e3(o),i)&&e.removeItem(r)}}const qw={name:"Local",description:"Stored in this browser only",writeable:!0},Pk="publisher:report:",td=e=>`${Pk}${e}`;function Km(e){const t=localStorage.getItem(e);if(t!==null)try{const n=JSON.parse(t);if(typeof n.content=="string"&&(n.type==="grid"||n.type==="linear"))return{type:n.type,content:n.content}}catch{}}const Ww=(e,t)=>localStorage.setItem(td(e),JSON.stringify(t));class W1e{migrated=!1;migrate(){this.migrated||(this.migrated=!0,q1e(localStorage,(t,n,r)=>Km(td(t))!==void 0?!1:(Ww(t,{type:n,content:r}),!0)))}async listWorkspaces(t){return[qw]}async listDocuments(t,n){if(t.name!==qw.name)return[];this.migrate();const r=[];for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o);if(a===null||!a.startsWith(Pk))continue;const i=Km(a);i&&(n===void 0||i.type===n)&&r.push({workspace:qw.name,type:i.type,path:a.slice(Pk.length)})}return r}async getDocument(t){this.migrate();const n=Km(td(t.path));if(n===void 0)throw Yw(t);return n.content}async getDocumentType(t){this.migrate();const n=Km(td(t.path));if(n===void 0)throw Yw(t);return n.type}async saveDocument(t,n){this.migrate(),Ww(t.path,{type:t.type,content:n})}async deleteDocument(t){if(this.migrate(),Km(td(t.path))===void 0)throw Yw(t);localStorage.removeItem(td(t.path))}async moveDocument(t,n){const r=await this.getDocument(t);Ww(n.path,{type:n.type,content:r}),n.path!==t.path&&localStorage.removeItem(td(t.path))}}function Yw(e){return new WF(`No report at ${e.workspace}/${e.path}`)}async function Y1e(e,t,n,r){const o=qF(await e.listWorkspaces(!1));if(!o)return;const a=Kg(t,n,r);if(e.getDocumentType)try{return await e.getDocumentType({workspace:o.name,path:a})}catch(i){if(YF(i))return;throw i}return(await e.listDocuments(o)).find(i=>i.path===a)?.type}function bCe(e,t,n,r=!0){const o=JF()?.documentStorage,a=r&&o!==void 0,[i,s]=C.useState(),c=Kg(e,t,n);return C.useEffect(()=>{if(!a||!o)return;let f=!1;return Y1e(o,e,t,n).catch(()=>{}).then(u=>{f||s({key:c,layout:u})}),()=>{f=!0}},[a,o,e,t,n,c]),a?i?.key===c?{layout:i.layout,settled:!0}:{layout:void 0,settled:!1}:{layout:void 0,settled:!0}}function K1e(e){return C.useMemo(()=>{if(!e?.sources?.length)return[];const t=new Map;for(const n of e.sources)if(n.givens?.length)for(const r of n.givens)r.name&&!t.has(r.name)&&t.set(r.name,r);return Array.from(t.values())},[e])}function G1e(e){return e.type==="code"}function Q1e(e){return(e.text??"").split(`
482
482
  `).filter(t=>!t.trimStart().startsWith("##")).join(`
483
- `)}const X1e=kn(m.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}));function Z1e({cell:e,resourceUri:t,showCopyLink:n,maxResultSize:r,isExecuting:o,pendingRerun:a,onNavigate:i,onDrillSelf:s,canDrillSelf:c,onDrillNavigate:f,givens:u,givenSpecs:h}){const[g,y]=Sn.useState(!1),[b,S]=Sn.useState(!1),[w,x]=Sn.useState(),[R,k]=Sn.useState(!1),[T,O]=C.useState(""),{environmentName:A,packageName:I,modelPath:j}=to(t),_={environmentName:A,packageName:I,sourcePath:j,onNavigate:i},{drill:z,drillMenu:B}=m3({onNavigate:f,onSelf:s,canSelf:c}),E=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,L=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,N=!!e.text&&(E.test(e.text)||L.test(e.text)),F=()=>{if(!e.newSources||e.newSources.length===0)return 0;let Y=[],re="";if(e.text){const ue=e.text.match(E);ue&&(Y=ue[1].split(",").map(oe=>oe.trim()));const X=e.text.match(L);X&&(re=X[1].trim())}for(let ue=0;ue<e.newSources.length;ue++)try{const X=JSON.parse(e.newSources[ue]);if(Y.length>0&&Y.includes(X.name)||re&&re===X.path)return ue}catch{continue}return 0},D=Sn.useMemo(()=>e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:t,givens:h}:void 0,[e.newSources,t,h]),{mode:W}=eo();C.useEffect(()=>{e.type==="code"&&I3(Q1e(e),"malloy",W).then(Y=>{x(Y)})},[e,W]);const K=()=>{const Y=window.location.href;navigator.clipboard.writeText(Y).then(()=>O("URL copied to clipboard!")).catch(()=>O("Failed to copy URL"))},ae=m.jsx($o,{open:g,onClose:()=>y(!1),title:"Malloy code",maxWidth:"lg",showClose:!0,children:m.jsx(mt,{sx:Y=>({border:`1px solid ${Y.palette.divider}`,borderRadius:"8px",padding:"16px",fontFamily:Uo,fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:Y.palette.background.paper,color:Y.palette.text.primary}),children:m.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:w}})})});return e.type==="markdown"&&m.jsx(mt,{children:m.jsxs(Qx,{children:[n?m.jsxs(Wn,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[m.jsx(Lp,{variant:"document",links:_,children:e.text}),m.jsx(Jo,{title:"Copy link",children:m.jsx(xo,{"aria-label":"Copy link",onClick:K,sx:{color:"text.secondary",mt:"18px"},children:m.jsx(N3,{sx:{fontSize:"24px"}})})})]}):m.jsx(Lp,{variant:"document",links:_,children:e.text}),m.jsx(dy,{open:T!=="",autoHideDuration:6e3,onClose:()=>O(""),message:T})]})})||e.type==="code"&&m.jsxs(mt,{children:[e.newSources&&e.newSources.length>0&&m.jsx(Wn,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:m.jsx(_5,{sx:{position:"relative",padding:"0"},children:m.jsxs(mt,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[w&&m.jsx("span",{dangerouslySetInnerHTML:{__html:w},style:{fontFamily:Uo,fontSize:"14px",flex:1,marginRight:"8px"}}),N&&m.jsx(bp,{"aria-label":"Data sources",sx:{flexShrink:0},onClick:()=>k(!0),children:m.jsx(Mp,{})})]})})}),m.jsx(_3,{open:R,onClose:()=>k(!1),title:"Data Sources",hasValidImport:N,resourceUri:t,data:D,initialSelectedSourceIndex:F(),startingGivens:u}),ae,m.jsx(L3,{open:b,onClose:()=>S(!1),result:e.result||"",title:"Results",drill:z}),o&&!e.result&&!e.error&&!N&&!(e.newSources&&e.newSources.length>0)&&m.jsx(y0,{children:m.jsx(mt,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:m.jsx(ly,{size:32})})}),!e.result&&e.error&&m.jsx(Bz,{summary:"This cell could not be run.",detail:e.error}),e.result&&a&&m.jsx(DL,{"aria-label":"Re-run pending",sx:{mb:1,height:2,borderRadius:1}}),e.result&&m.jsxs(y0,{children:[m.jsx(BF,{title:"",action:m.jsxs(Wn,{direction:"row",sx:{gap:.5,mt:"-4px"},children:[m.jsx(bp,{"aria-label":"Malloy code",onClick:Y=>{Y.stopPropagation(),y(!0)},children:m.jsx(X1e,{})}),m.jsx(bp,{"aria-label":"Expand results",onClick:()=>S(!0),children:m.jsx(Mp,{})})]})}),m.jsx(QE,{result:e.result,maxHeight:tie,maxResultSize:r,drill:z}),B]})]})}function J1e({ready:e,lastRunKey:t,pendingKey:n,runKey:r,documentKey:o}){if(!e)return{cancelPending:n!==void 0,dispatch:"none"};const a=n!==void 0&&n!==r;if(t===r)return{cancelPending:a,dispatch:"none"};if(n===r)return{cancelPending:a,dispatch:"none"};const i=t===null||!t.startsWith(`${o}|`);return{cancelPending:a,dispatch:i?"now":"settle"}}const eSe=4;function tSe(e){const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error&&e.message!==""?e.message:"The server did not say why."}function nSe({resourceUri:e,title:t,description:n,maxResultSize:r=0,givens:o,onGivensChange:a,onNavigate:i,onDrillNavigate:s,notebook:c,error:f,runCell:u}){const{environmentName:h,packageName:g,versionId:y,modelPath:b}=to(e),S=c!==void 0,w=!S&&!!f,[x,R]=C.useState([]),[k,T]=C.useState(!1),[O,A]=C.useState(!1),I=C.useRef(void 0),[j,_]=C.useState(null),z=K1e(c),B=c?.autorun!==!1,E=jx(),L=bE({specs:z,loaded:S,startingValues:c?.startingGivens,params:o,onGivensChange:a,documentKey:e,autorun:B,environmentName:h,packageName:g,modelPath:b,versionId:y,documentName:b}),{applied:N,declaredTypes:F,canSelf:D,onSelf:W}=L,K=C.useCallback(fe=>{const he=Zp(fe,F);return Object.keys(he).length>0?JSON.stringify(he):void 0},[F]),ae=C.useMemo(()=>Nb(N,F),[N,F]),Y=C.useRef(0),re=C.useRef(null),ue=C.useRef(null),X=C.useRef(void 0);C.useEffect(()=>()=>{re.current?.abort(),ue.current=null,clearTimeout(X.current?.timer),X.current=void 0},[]);const oe=C.useCallback(async(fe=new Map)=>{if(!S||!c?.notebookCells)return;const he=++Y.current;re.current?.abort();const me=new AbortController;re.current=me,R(c.notebookCells.map(le=>({...le}))),T(!0),_(null);try{const le=[];for(let Ie=0;Ie<c.notebookCells.length;Ie++){const Ne=c.notebookCells[Ie];if(!G1e(Ne))continue;const ge=Ie,se=async()=>{try{const Ge=await u({cell:Ne,index:ge,givens:fe,declaredTypes:F,signal:me.signal});if(Y.current!==he)return;const Ae=Ge.result,Qe=Ne.newSources||Ge.newSources;R(rt=>{const _t=[...rt];return _t[ge]||(_t[ge]={...Ne}),_t[ge]={..._t[ge],result:Ae,newSources:Qe},_t})}catch(Ge){if(me.signal.aborted||Y.current!==he)return;E.emit({type:"report.query_failed",tile:ge,category:s0(Ge)}),E.listening||console.error(`Error executing cell ${ge}:`,Ge);const Ae=tSe(Ge);R(Qe=>{const rt=[...Qe];return rt[ge]||(rt[ge]={...Ne}),rt[ge]={...rt[ge],error:Ae},rt})}};le.push(se)}const be=[];for(const Ie of le){const Ne=Ie().then(()=>{be.splice(be.indexOf(Ne),1)});be.push(Ne),be.length>=eSe&&await Promise.race(be)}await Promise.all(be)}catch(le){if(me.signal.aborted||Y.current!==he)return;E.emit({type:"report.query_failed",category:s0(le)}),E.listening||console.error("Error executing notebook cells:",le),_(le)}finally{Y.current===he&&(T(!1),re.current=null)}},[S,c,F,u,E]),J=C.useRef(0),ee=C.useRef(void 0);ee.current!==c&&(ee.current=c,J.current+=1);const te=J.current;C.useEffect(()=>{const fe=`${e}|${te}`,he=`${fe}|${K(N)??""}`;I.current!==void 0&&I.current!==fe&&(re.current?.abort(),re.current=null),I.current=fe;const me=J1e({ready:S&&!!c?.notebookCells,lastRunKey:ue.current,pendingKey:X.current?.key,runKey:he,documentKey:fe});if(me.cancelPending&&(clearTimeout(X.current?.timer),X.current=void 0,A(!1)),me.dispatch==="none")return;const le=()=>{X.current=void 0,A(!1),ue.current=he,oe(N)};if(me.dispatch==="now"){le();return}A(!0),X.current={key:he,timer:setTimeout(le,TF)}},[S,c,te,e,N,K,oe]);const de=x.length>0?x:c?.notebookCells||[],ce=0;return m.jsxs(wk,{layout:"linear",header:t||n?m.jsx(VF,{title:t??"",description:n?m.jsx(Qx,{children:m.jsx(Lp,{variant:"document",children:n})}):void 0}):null,controls:L.panel.givens.length>0?m.jsx(HF,{children:m.jsx(GE,{...L.panel,layout:"bar"})}):void 0,children:[!S&&!w&&m.jsx(va,{text:zp.opening("report")}),S&&de.map((fe,he)=>m.jsx(Z1e,{cell:fe,showCopyLink:he===ce,resourceUri:e,maxResultSize:r,isExecuting:k,givens:ae,givenSpecs:z,pendingRerun:O,onNavigate:i,onDrillNavigate:s,onDrillSelf:z.length>0?W:void 0,canDrillSelf:D},he)),w&&f?.status===404&&m.jsxs(Ct,{variant:"body2",sx:{color:"text.secondary"},children:[m.jsx("code",{children:`${h} > ${g} > ${b}`})," ","not found."]}),w&&f?.status!==404&&m.jsx(Ma,{error:f,context:`${h} > ${g} > ${b}`}),j&&m.jsx(Ma,{error:{message:j.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})}function W3(e){const{apiClients:t}=hr(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=to(e);return To({queryKey:[e],queryFn:async()=>(await t.notebooks.getNotebook(n,r,a,o)).data})}function rSe(e){const{apiClients:t}=hr(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=to(e.resourceUri),i=W3(e.resourceUri),s=C.useCallback(async({index:c,givens:f,declaredTypes:u,signal:h})=>{const g=Zp(f,u);return(await t.notebooks.executeNotebookCell(n,r,a,c,o,void 0,void 0,Object.keys(g).length>0?JSON.stringify(g):void 0,{signal:h})).data},[t.notebooks,n,r,a,o]);return m.jsx(nSe,{...e,notebook:i.isSuccess?i.data:void 0,error:i.isError?i.error:void 0,runCell:s})}function xCe(e){const{data:t}=W3(e.resourceUri);if(t?.dashboard){const{environmentName:n,packageName:r,versionId:o,modelPath:a}=to(e.resourceUri);return m.jsx(v3,{manifest:{...t.dashboard,layout:"linear"},environmentName:n,packageName:r,versionId:o,documentName:a,givens:e.givens,onGivensChange:e.onGivensChange,onNavigate:e.onDrillNavigate,...e.onNavigate?{onLinkNavigate:e.onNavigate}:{},maxResultSize:e.maxResultSize})}return m.jsx(rSe,{...e})}function SCe(e,t,n="grid"){const r=t.filter(a=>!!a.path).filter(a=>Gx(a.path)===e),o=r.filter(a=>ZE(a)===n);return o.length===1?{found:Sk(o[0])}:r.length===1?{found:Sk(r[0])}:r.length===0?{missing:!0}:{ambiguous:r.map(a=>a.path).sort()}}const oSe=/^(dashboards|notebooks)\/([^/]+)$/;function wCe(e){const t=oSe.exec(e);if(t)return{name:t[2],prefer:t[1]==="dashboards"?"grid":"linear"}}const TN="[publisher.report]",$N="[publisher.console]";function aSe(e){switch(e.type){case"report.load_failed":case"report.query_failed":case"report.save_refused":case"report.save_undo_refused":case"report.create_refused":return!0;case"report.rows_shown":return!e.ok;case"report.drill":return e.outcome==="unresolved"||e.outcome==="malformed";default:return!1}}function CCe(e){return t=>{const n={...e,...t,at:new Date().toISOString()};aSe(t)?console.warn(TN,n):console.info(TN,n)}}function iSe(e){const t={...e,at:new Date().toISOString()};e.ok?console.info($N,t):console.warn($N,t)}const jo={white:"#FFFFFF",offWhite:"#F8FAFC",grey:{light:"#E2E8F0",mid:"#64748B"},black:"#0F172A",semantic:{success:{main:qr.emerald,light:"#D1FAE5",dark:"#047857"},warning:{main:qr.amber,light:"#FEF3C7",dark:"#92400E"},error:{main:qr.red,light:"#FEE2E2",dark:"#B91C1C"},info:{main:qr.blue,light:"#DBEAFE",dark:"#1D4ED8"}}},fb='"Inter", "Helvetica Neue", "Arial", sans-serif',Fo={50:jo.offWhite,100:"#F1F5F9",200:jo.grey.light,300:"#CBD5E1",400:"#94A3B8",500:jo.grey.mid,600:"#475569",700:"#334155",800:"#1E293B",900:jo.black},kCe={headerHeight:56},MN="0 1px 3px rgba(0, 0, 0, 0.1)",sSe="#0f172a",lSe="#1e293b",cSe="#f1f5f9",uSe="#cbd5e1",dSe="#334155",Y3=(e="light",t)=>{const n=e==="dark",r=n?sSe:jo.white,o=n?lSe:jo.white,a=n?cSe:jo.black,i=n?uSe:jo.grey.mid,s=n?dSe:jo.grey.light,{accent:c,accentHover:f,accentContrast:u}=t??UC(void 0,e);return W0({cssVariables:{nativeColor:!0},palette:{mode:e,primary:{main:c,light:jo.grey.light,dark:f,contrastText:u},secondary:{main:jo.grey.mid,light:jo.grey.light,dark:jo.black},grey:Fo,success:jo.semantic.success,warning:jo.semantic.warning,error:jo.semantic.error,info:jo.semantic.info,background:{default:r,paper:o},text:{primary:a,secondary:i},divider:s},typography:{fontFamily:fb,h1:{fontWeight:500,letterSpacing:"-0.025em"},h2:{fontWeight:500,letterSpacing:"-0.025em"},h3:{fontWeight:500,letterSpacing:"-0.025em"},h4:{fontWeight:500,letterSpacing:"-0.025em"},h5:{fontWeight:500,letterSpacing:"-0.025em"},h6:{fontWeight:500,letterSpacing:"-0.025em"},subtitle1:{fontWeight:500,letterSpacing:"-0.025em"},subtitle2:{fontWeight:500,letterSpacing:"-0.025em"},body1:{letterSpacing:"-0.025em"},body2:{letterSpacing:"-0.025em"},button:{fontWeight:500,letterSpacing:"-0.025em",textTransform:"none"}},shape:{borderRadius:6},components:{MuiButtonBase:{defaultProps:{disableRipple:!0,disableTouchRipple:!0},styleOverrides:{root:{"&:focus-visible":{outline:`2px solid ${c}`,outlineOffset:2}}}},MuiCssBaseline:{styleOverrides:{"*":{scrollbarWidth:"thin",scrollbarColor:n?"#475569 #1e293b":`${Fo[300]} ${Fo[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:n?"#1e293b":Fo[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Fo[300],borderRadius:"4px","&:hover":{background:n?"#64748b":Fo[400]}},"&::-webkit-scrollbar-corner":{background:n?"#1e293b":Fo[100]}},".malloy-table.root":{scrollbarWidth:"auto",scrollbarColor:"auto","&::-webkit-scrollbar, &::-webkit-scrollbar-track, &::-webkit-scrollbar-corner":{background:n?"#1e293b":Fo[100]},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Fo[300],border:"none",borderRadius:"4px"}},"div[data-radix-popper-content-wrapper]":{zIndex:"1300 !important"}}},MuiButton:{styleOverrides:{root:{borderRadius:6,textTransform:"none",fontWeight:500,fontSize:13,minHeight:32,paddingTop:0,paddingBottom:0,boxShadow:"none","&:hover":{boxShadow:"none"}},sizeSmall:{minHeight:32,paddingLeft:10,paddingRight:10},sizeMedium:{minHeight:32,paddingLeft:12,paddingRight:12},contained:{"&:hover":{boxShadow:"none"},"&.Mui-disabled":{backgroundColor:n?"rgba(255, 255, 255, 0.06)":Fo[200],color:n?"#64748b":Fo[500]}},outlined:{color:a,borderColor:n?"#475569":Fo[300],"&:hover":{borderColor:n?"#64748b":Fo[400],backgroundColor:n?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"}}}},MuiIconButton:{styleOverrides:{root:{borderRadius:6}}},MuiPopover:{styleOverrides:{paper:{borderRadius:8}}},MuiCard:{styleOverrides:{root:{borderRadius:8,boxShadow:MN,border:"1px solid",borderColor:s,backgroundColor:o}}},MuiChip:{styleOverrides:{root:{borderRadius:6,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:6},"& .MuiInputLabel-outlined":{backgroundColor:o,paddingLeft:4,paddingRight:4,"&.MuiInputLabel-shrink":{transform:"translate(14px, -9px) scale(0.75)"}}}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}},MuiDialog:{styleOverrides:{paper:{borderRadius:12,backgroundColor:o,boxShadow:"0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 10px 10px -5px rgba(0, 0, 0, 0.04)"}}},MuiSelect:{styleOverrides:{select:{fontFamily:fb,fontSize:"0.875rem",color:a}}},MuiInputLabel:{styleOverrides:{root:{"&.MuiInputLabel-outlined":{backgroundColor:o,paddingLeft:4,paddingRight:4}}}},MuiOutlinedInput:{styleOverrides:{notchedOutline:{border:"none"},root:{border:`1px solid ${n?Fo[600]:Fo[300]}`,borderRadius:6,transition:`border-color ${wy} ease-in`,...Cy,backgroundColor:o,"&:hover":{borderColor:n?"#64748b":Fo[400]},"&.Mui-focused":{borderColor:n?Fo[400]:Fo[500],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:fb,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:fb}}},MuiMenu:{styleOverrides:{paper:{borderRadius:8,boxShadow:"0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",border:`1px solid ${s}`,backgroundColor:o,color:a}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:Fo[400]}}}},MuiDivider:{styleOverrides:{root:{borderColor:s}},defaultProps:{sx:{my:1}}},MuiListItemButton:{styleOverrides:{root:{borderRadius:6,margin:"2px 8px",padding:"8px 16px","&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.08)":jo.offWhite},"&.Mui-selected":{backgroundColor:n?"rgba(255, 255, 255, 0.12)":jo.offWhite,color:a,"& .MuiListItemIcon-root":{color:a},"& .MuiListItemText-primary":{color:a},"&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.16)":jo.grey.light}}}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:o,color:a,boxShadow:MN}}}}})};Y3("light");function fSe({children:e}){const{mode:t,theme:n}=eo(),{accent:r,accentHover:o,accentContrast:a}=n,i=C.useMemo(()=>Y3(t,{accent:r,accentHover:o,accentContrast:a}),[t,r,o,a]);return m.jsxs(F8,{theme:i,children:[m.jsx(BY,{}),e]})}const pSe=C.lazy(()=>Ro(()=>import("./HomePage-CNuMPINA.js"),[])),hSe=C.lazy(()=>Ro(()=>import("./MainPage-DWjs4_e3.js"),__vite__mapDeps([7,8,9,10]))),mSe=C.lazy(()=>Ro(()=>import("./PackageSplatRoute-CTxtXKZO.js").then(e=>e.a),__vite__mapDeps([11,10]))),gSe=C.lazy(()=>Ro(()=>import("./PackagePage-_5vFWxqm.js"),__vite__mapDeps([12,9,10,13]))),ySe=C.lazy(()=>Ro(()=>import("./EnvironmentPage-Dfn26tY2.js"),[])),vSe=C.lazy(()=>Ro(()=>import("./RouteError-y4xkvszw.js"),[])),bSe=C.lazy(()=>Ro(()=>import("./ThemeEditorPage-BffGFYK5.js"),__vite__mapDeps([14,15]))),xSe=(e="/",t=new W1e,n)=>(Abe(iSe),OB([{path:e,element:m.jsx(dte,{children:m.jsx(Mve,{documentStorage:t,children:m.jsx(fSe,{children:m.jsx(C.Suspense,{fallback:m.jsx(va,{}),children:m.jsx(hSe,{headerProps:n})})})})}),errorElement:m.jsx(vSe,{}),children:[{index:!0,element:m.jsx(pSe,{})},{path:"settings/theme",element:m.jsx(bSe,{})},{path:"settings",element:m.jsx(oB,{to:"/settings/theme",replace:!0})},{path:":environmentName",element:m.jsx(ySe,{})},{path:":environmentName/:packageName",element:m.jsx(gSe,{})},{path:":environmentName/:packageName/*",element:m.jsx(mSe,{})}]}])),SSe=xSe("/");gU.createRoot(document.getElementById("root")).render(m.jsx(C.StrictMode,{children:m.jsx(VB,{router:SSe})}));export{RSe as $,ss as A,dl as B,CSe as C,gCe as D,ty as E,Vve as F,_F as G,Wye as H,mt as I,ER as J,xo as K,Jo as L,OL as M,AR as N,hr as O,Ka as P,VR as Q,qc as R,lC as S,Ct as T,eo as U,jL as V,il as W,bi as X,OX as Y,Sy as Z,kCe as _,hn as a,Bwe as a$,va as a0,go as a1,tr as a2,Sn as a3,Ro as a4,CCe as a5,oB as a6,Xx as a7,vCe as a8,P1e as a9,zwe as aA,cie as aB,Zwe as aC,Dye as aD,Qwe as aE,Fwe as aF,uie as aG,Uwe as aH,eie as aI,Lwe as aJ,_we as aK,Lne as aL,wSe as aM,Ak as aN,x8 as aO,id as aP,Id as aQ,jz as aR,pl as aS,jae as aT,Ox as aU,nc as aV,Kwe as aW,fie as aX,Oz as aY,Rwe as aZ,xwe as a_,mCe as aa,W6 as ab,Qb as ac,Wn as ad,R2 as ae,wi as af,LL as ag,V5 as ah,BC as ai,Qo as aj,xl as ak,Rb as al,dY as am,mY as an,dy as ao,$o as ap,Wne as aq,Xc as ar,$0 as as,vd as at,Mi as au,rE as av,hl as aw,Ree as ax,UF as ay,YSe as az,Js as b,mwe as b$,wk as b0,e3 as b1,oCe as b2,Gx as b3,yd as b4,JF as b5,To as b6,rCe as b7,ek as b8,s0 as b9,tCe as bA,Eie as bB,Jwe as bC,nCe as bD,Ave as bE,qwe as bF,Ove as bG,uCe as bH,Gwe as bI,bE as bJ,hye as bK,y0 as bL,BF as bM,o3 as bN,Fye as bO,mye as bP,yye as bQ,Twe as bR,gye as bS,GE as bT,Bae as bU,Tve as bV,cwe as bW,gwe as bX,Rne as bY,pwe as bZ,hwe as b_,eCe as ba,Ma as bb,Wwe as bc,Eve as bd,Mj as be,wy as bf,kn as bg,yi as bh,Nwe as bi,cl as bj,kwe as bk,Rae as bl,Ez as bm,$ae as bn,Mz as bo,jwe as bp,HF as bq,uye as br,Eye as bs,Tye as bt,VF as bu,Qx as bv,lCe as bw,qF as bx,Sve as by,YF as bz,Ga as c,eT as c$,vwe as c0,Xwe as c1,hA as c2,Dz as c3,dE as c4,Cwe as c5,wwe as c6,kae as c7,Sae as c8,Cy as c9,dwe as cA,Sie as cB,Ewe as cC,Owe as cD,Pwe as cE,fwe as cF,mx as cG,Mwe as cH,$we as cI,Dwe as cJ,bwe as cK,KF as cL,tz as cM,Ene as cN,Az as cO,Ax as cP,Vwe as cQ,Y7 as cR,Tw as cS,ywe as cT,uwe as cU,Fae as cV,die as cW,nT as cX,Cve as cY,wve as cZ,iCe as c_,dye as ca,fye as cb,Swe as cc,og as cd,Jye as ce,NY as cf,Iwe as cg,Uz as ch,Awe as ci,Dae as cj,Oj as ck,Mae as cl,VL as cm,gy as cn,Xae as co,Qae as cp,Lp as cq,nx as cr,Iae as cs,fve as ct,cCe as cu,sCe as cv,s5 as cw,Hwe as cx,Fz as cy,pie as cz,zt as d,aCe as d0,bve as d1,QF as d2,yve as d3,xve as d4,$ve as d5,Ag as d6,Br as d7,D0 as d8,Ps as d9,wp as da,Yye as db,Kye as dc,FF as dd,pCe as de,xCe as df,a1e as dg,kSe as dh,Ywe as di,dCe as dj,wCe as dk,SCe as dl,hI as dm,Uo as dn,bCe as dp,zp as dq,hCe as dr,gbe as ds,yCe as dt,Hye as du,qye as dv,oC as e,fn as f,dn as g,Ad as h,vl as i,m as j,bo as k,Dd as l,on as m,oL as n,ec as o,fCe as p,cL as q,C as r,dt as s,Wb as t,mn as u,sy as v,aL as w,jn as x,lt as y,Oa as z};
483
+ `)}const X1e=kn(m.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}));function Z1e({cell:e,resourceUri:t,showCopyLink:n,maxResultSize:r,isExecuting:o,pendingRerun:a,onNavigate:i,onDrillSelf:s,canDrillSelf:c,onDrillNavigate:f,givens:u,givenSpecs:h}){const[g,y]=Sn.useState(!1),[b,S]=Sn.useState(!1),[w,x]=Sn.useState(),[R,k]=Sn.useState(!1),[T,O]=C.useState(""),{environmentName:A,packageName:I,modelPath:j}=to(t),_={environmentName:A,packageName:I,sourcePath:j,onNavigate:i},{drill:z,drillMenu:B}=m3({onNavigate:f,onSelf:s,canSelf:c}),E=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,L=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,N=!!e.text&&(E.test(e.text)||L.test(e.text)),F=()=>{if(!e.newSources||e.newSources.length===0)return 0;let Y=[],re="";if(e.text){const ue=e.text.match(E);ue&&(Y=ue[1].split(",").map(oe=>oe.trim()));const X=e.text.match(L);X&&(re=X[1].trim())}for(let ue=0;ue<e.newSources.length;ue++)try{const X=JSON.parse(e.newSources[ue]);if(Y.length>0&&Y.includes(X.name)||re&&re===X.path)return ue}catch{continue}return 0},D=Sn.useMemo(()=>e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:t,givens:h}:void 0,[e.newSources,t,h]),{mode:W}=eo();C.useEffect(()=>{e.type==="code"&&I3(Q1e(e),"malloy",W).then(Y=>{x(Y)})},[e,W]);const K=()=>{const Y=window.location.href;navigator.clipboard.writeText(Y).then(()=>O("URL copied to clipboard!")).catch(()=>O("Failed to copy URL"))},ae=m.jsx($o,{open:g,onClose:()=>y(!1),title:"Malloy code",maxWidth:"lg",showClose:!0,children:m.jsx(mt,{sx:Y=>({border:`1px solid ${Y.palette.divider}`,borderRadius:"8px",padding:"16px",fontFamily:Uo,fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:Y.palette.background.paper,color:Y.palette.text.primary}),children:m.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:w}})})});return e.type==="markdown"&&m.jsx(mt,{children:m.jsxs(Qx,{children:[n?m.jsxs(Wn,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[m.jsx(Lp,{variant:"document",links:_,children:e.text}),m.jsx(Jo,{title:"Copy link",children:m.jsx(xo,{"aria-label":"Copy link",onClick:K,sx:{color:"text.secondary",mt:"18px"},children:m.jsx(N3,{sx:{fontSize:"24px"}})})})]}):m.jsx(Lp,{variant:"document",links:_,children:e.text}),m.jsx(dy,{open:T!=="",autoHideDuration:6e3,onClose:()=>O(""),message:T})]})})||e.type==="code"&&m.jsxs(mt,{children:[e.newSources&&e.newSources.length>0&&m.jsx(Wn,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:m.jsx(_5,{sx:{position:"relative",padding:"0"},children:m.jsxs(mt,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[w&&m.jsx("span",{dangerouslySetInnerHTML:{__html:w},style:{fontFamily:Uo,fontSize:"14px",flex:1,marginRight:"8px"}}),N&&m.jsx(bp,{"aria-label":"Data sources",sx:{flexShrink:0},onClick:()=>k(!0),children:m.jsx(Mp,{})})]})})}),m.jsx(_3,{open:R,onClose:()=>k(!1),title:"Data Sources",hasValidImport:N,resourceUri:t,data:D,initialSelectedSourceIndex:F(),startingGivens:u}),ae,m.jsx(L3,{open:b,onClose:()=>S(!1),result:e.result||"",title:"Results",drill:z}),o&&!e.result&&!e.error&&!N&&!(e.newSources&&e.newSources.length>0)&&m.jsx(y0,{children:m.jsx(mt,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:m.jsx(ly,{size:32})})}),!e.result&&e.error&&m.jsx(Bz,{summary:"This cell could not be run.",detail:e.error}),e.result&&a&&m.jsx(DL,{"aria-label":"Re-run pending",sx:{mb:1,height:2,borderRadius:1}}),e.result&&m.jsxs(y0,{children:[m.jsx(BF,{title:"",action:m.jsxs(Wn,{direction:"row",sx:{gap:.5,mt:"-4px"},children:[m.jsx(bp,{"aria-label":"Malloy code",onClick:Y=>{Y.stopPropagation(),y(!0)},children:m.jsx(X1e,{})}),m.jsx(bp,{"aria-label":"Expand results",onClick:()=>S(!0),children:m.jsx(Mp,{})})]})}),m.jsx(QE,{result:e.result,maxHeight:tie,maxResultSize:r,drill:z}),B]})]})}function J1e({ready:e,lastRunKey:t,pendingKey:n,runKey:r,documentKey:o}){if(!e)return{cancelPending:n!==void 0,dispatch:"none"};const a=n!==void 0&&n!==r;if(t===r)return{cancelPending:a,dispatch:"none"};if(n===r)return{cancelPending:a,dispatch:"none"};const i=t===null||!t.startsWith(`${o}|`);return{cancelPending:a,dispatch:i?"now":"settle"}}const eSe=4;function tSe(e){const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error&&e.message!==""?e.message:"The server did not say why."}function nSe({resourceUri:e,title:t,description:n,maxResultSize:r=0,givens:o,onGivensChange:a,onNavigate:i,onDrillNavigate:s,notebook:c,error:f,runCell:u}){const{environmentName:h,packageName:g,versionId:y,modelPath:b}=to(e),S=c!==void 0,w=!S&&!!f,[x,R]=C.useState([]),[k,T]=C.useState(!1),[O,A]=C.useState(!1),I=C.useRef(void 0),[j,_]=C.useState(null),z=K1e(c),B=c?.autorun!==!1,E=jx(),L=bE({specs:z,loaded:S,startingValues:c?.startingGivens,params:o,onGivensChange:a,documentKey:e,autorun:B,environmentName:h,packageName:g,modelPath:b,versionId:y,documentName:b}),{applied:N,declaredTypes:F,canSelf:D,onSelf:W}=L,K=C.useCallback(fe=>{const he=Zp(fe,F);return Object.keys(he).length>0?JSON.stringify(he):void 0},[F]),ae=C.useMemo(()=>Nb(N,F),[N,F]),Y=C.useRef(0),re=C.useRef(null),ue=C.useRef(null),X=C.useRef(void 0);C.useEffect(()=>()=>{re.current?.abort(),ue.current=null,clearTimeout(X.current?.timer),X.current=void 0},[]);const oe=C.useCallback(async(fe=new Map)=>{if(!S||!c?.notebookCells)return;const he=++Y.current;re.current?.abort();const me=new AbortController;re.current=me,R(c.notebookCells.map(le=>({...le}))),T(!0),_(null);try{const le=[];for(let Ie=0;Ie<c.notebookCells.length;Ie++){const Ne=c.notebookCells[Ie];if(!G1e(Ne))continue;const ge=Ie,se=async()=>{try{const Ge=await u({cell:Ne,index:ge,givens:fe,declaredTypes:F,signal:me.signal});if(Y.current!==he)return;const Ae=Ge.result,Qe=Ne.newSources||Ge.newSources;R(rt=>{const _t=[...rt];return _t[ge]||(_t[ge]={...Ne}),_t[ge]={..._t[ge],result:Ae,newSources:Qe},_t})}catch(Ge){if(me.signal.aborted||Y.current!==he)return;E.emit({type:"report.query_failed",tile:ge,category:s0(Ge)}),E.listening||console.error(`Error executing cell ${ge}:`,Ge);const Ae=tSe(Ge);R(Qe=>{const rt=[...Qe];return rt[ge]||(rt[ge]={...Ne}),rt[ge]={...rt[ge],error:Ae},rt})}};le.push(se)}const be=[];for(const Ie of le){const Ne=Ie().then(()=>{be.splice(be.indexOf(Ne),1)});be.push(Ne),be.length>=eSe&&await Promise.race(be)}await Promise.all(be)}catch(le){if(me.signal.aborted||Y.current!==he)return;E.emit({type:"report.query_failed",category:s0(le)}),E.listening||console.error("Error executing notebook cells:",le),_(le)}finally{Y.current===he&&(T(!1),re.current=null)}},[S,c,F,u,E]),J=C.useRef(0),ee=C.useRef(void 0);ee.current!==c&&(ee.current=c,J.current+=1);const te=J.current;C.useEffect(()=>{const fe=`${e}|${te}`,he=`${fe}|${K(N)??""}`;I.current!==void 0&&I.current!==fe&&(re.current?.abort(),re.current=null),I.current=fe;const me=J1e({ready:S&&!!c?.notebookCells,lastRunKey:ue.current,pendingKey:X.current?.key,runKey:he,documentKey:fe});if(me.cancelPending&&(clearTimeout(X.current?.timer),X.current=void 0,A(!1)),me.dispatch==="none")return;const le=()=>{X.current=void 0,A(!1),ue.current=he,oe(N)};if(me.dispatch==="now"){le();return}A(!0),X.current={key:he,timer:setTimeout(le,TF)}},[S,c,te,e,N,K,oe]);const de=x.length>0?x:c?.notebookCells||[],ce=0;return m.jsxs(wk,{layout:"linear",header:t||n?m.jsx(VF,{title:t??"",description:n?m.jsx(Qx,{children:m.jsx(Lp,{variant:"document",children:n})}):void 0}):null,controls:L.panel.givens.length>0?m.jsx(HF,{children:m.jsx(GE,{...L.panel,layout:"bar"})}):void 0,children:[!S&&!w&&m.jsx(va,{text:zp.opening("report")}),S&&de.map((fe,he)=>m.jsx(Z1e,{cell:fe,showCopyLink:he===ce,resourceUri:e,maxResultSize:r,isExecuting:k,givens:ae,givenSpecs:z,pendingRerun:O,onNavigate:i,onDrillNavigate:s,onDrillSelf:z.length>0?W:void 0,canDrillSelf:D},he)),w&&f?.status===404&&m.jsxs(Ct,{variant:"body2",sx:{color:"text.secondary"},children:[m.jsx("code",{children:`${h} > ${g} > ${b}`})," ","not found."]}),w&&f?.status!==404&&m.jsx(Ma,{error:f,context:`${h} > ${g} > ${b}`}),j&&m.jsx(Ma,{error:{message:j.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})}function W3(e){const{apiClients:t}=hr(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=to(e);return To({queryKey:[e],queryFn:async()=>(await t.notebooks.getNotebook(n,r,a,o)).data})}function rSe(e){const{apiClients:t}=hr(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=to(e.resourceUri),i=W3(e.resourceUri),s=C.useCallback(async({index:c,givens:f,declaredTypes:u,signal:h})=>{const g=Zp(f,u);return(await t.notebooks.executeNotebookCell(n,r,a,c,o,void 0,void 0,Object.keys(g).length>0?JSON.stringify(g):void 0,{signal:h})).data},[t.notebooks,n,r,a,o]);return m.jsx(nSe,{...e,notebook:i.isSuccess?i.data:void 0,error:i.isError?i.error:void 0,runCell:s})}function xCe(e){const{data:t}=W3(e.resourceUri);if(t?.dashboard){const{environmentName:n,packageName:r,versionId:o,modelPath:a}=to(e.resourceUri);return m.jsx(v3,{manifest:{...t.dashboard,layout:"linear"},environmentName:n,packageName:r,versionId:o,documentName:a,givens:e.givens,onGivensChange:e.onGivensChange,onNavigate:e.onDrillNavigate,...e.onNavigate?{onLinkNavigate:e.onNavigate}:{},maxResultSize:e.maxResultSize})}return m.jsx(rSe,{...e})}function SCe(e,t,n="grid"){const r=t.filter(a=>!!a.path).filter(a=>Gx(a.path)===e),o=r.filter(a=>ZE(a)===n);return o.length===1?{found:Sk(o[0])}:r.length===1?{found:Sk(r[0])}:r.length===0?{missing:!0}:{ambiguous:r.map(a=>a.path).sort()}}const oSe=/^(dashboards|notebooks)\/([^/]+)$/;function wCe(e){const t=oSe.exec(e);if(t)return{name:t[2],prefer:t[1]==="dashboards"?"grid":"linear"}}const TN="[publisher.report]",$N="[publisher.console]";function aSe(e){switch(e.type){case"report.load_failed":case"report.query_failed":case"report.save_refused":case"report.save_undo_refused":case"report.create_refused":return!0;case"report.rows_shown":return!e.ok;case"report.drill":return e.outcome==="unresolved"||e.outcome==="malformed";default:return!1}}function CCe(e){return t=>{const n={...e,...t,at:new Date().toISOString()};aSe(t)?console.warn(TN,n):console.info(TN,n)}}function iSe(e){const t={...e,at:new Date().toISOString()};e.ok?console.info($N,t):console.warn($N,t)}const jo={white:"#FFFFFF",offWhite:"#F8FAFC",grey:{light:"#E2E8F0",mid:"#64748B"},black:"#0F172A",semantic:{success:{main:qr.emerald,light:"#D1FAE5",dark:"#047857"},warning:{main:qr.amber,light:"#FEF3C7",dark:"#92400E"},error:{main:qr.red,light:"#FEE2E2",dark:"#B91C1C"},info:{main:qr.blue,light:"#DBEAFE",dark:"#1D4ED8"}}},fb='"Inter", "Helvetica Neue", "Arial", sans-serif',Fo={50:jo.offWhite,100:"#F1F5F9",200:jo.grey.light,300:"#CBD5E1",400:"#94A3B8",500:jo.grey.mid,600:"#475569",700:"#334155",800:"#1E293B",900:jo.black},kCe={headerHeight:56},MN="0 1px 3px rgba(0, 0, 0, 0.1)",sSe="#0f172a",lSe="#1e293b",cSe="#f1f5f9",uSe="#cbd5e1",dSe="#334155",Y3=(e="light",t)=>{const n=e==="dark",r=n?sSe:jo.white,o=n?lSe:jo.white,a=n?cSe:jo.black,i=n?uSe:jo.grey.mid,s=n?dSe:jo.grey.light,{accent:c,accentHover:f,accentContrast:u}=t??UC(void 0,e);return W0({cssVariables:{nativeColor:!0},palette:{mode:e,primary:{main:c,light:jo.grey.light,dark:f,contrastText:u},secondary:{main:jo.grey.mid,light:jo.grey.light,dark:jo.black},grey:Fo,success:jo.semantic.success,warning:jo.semantic.warning,error:jo.semantic.error,info:jo.semantic.info,background:{default:r,paper:o},text:{primary:a,secondary:i},divider:s},typography:{fontFamily:fb,h1:{fontWeight:500,letterSpacing:"-0.025em"},h2:{fontWeight:500,letterSpacing:"-0.025em"},h3:{fontWeight:500,letterSpacing:"-0.025em"},h4:{fontWeight:500,letterSpacing:"-0.025em"},h5:{fontWeight:500,letterSpacing:"-0.025em"},h6:{fontWeight:500,letterSpacing:"-0.025em"},subtitle1:{fontWeight:500,letterSpacing:"-0.025em"},subtitle2:{fontWeight:500,letterSpacing:"-0.025em"},body1:{letterSpacing:"-0.025em"},body2:{letterSpacing:"-0.025em"},button:{fontWeight:500,letterSpacing:"-0.025em",textTransform:"none"}},shape:{borderRadius:6},components:{MuiButtonBase:{defaultProps:{disableRipple:!0,disableTouchRipple:!0},styleOverrides:{root:{"&:focus-visible":{outline:`2px solid ${c}`,outlineOffset:2}}}},MuiCssBaseline:{styleOverrides:{"*":{scrollbarWidth:"thin",scrollbarColor:n?"#475569 #1e293b":`${Fo[300]} ${Fo[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:n?"#1e293b":Fo[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Fo[300],borderRadius:"4px","&:hover":{background:n?"#64748b":Fo[400]}},"&::-webkit-scrollbar-corner":{background:n?"#1e293b":Fo[100]}},".malloy-table.root":{scrollbarWidth:"auto",scrollbarColor:"auto","&::-webkit-scrollbar, &::-webkit-scrollbar-track, &::-webkit-scrollbar-corner":{background:n?"#1e293b":Fo[100]},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Fo[300],border:"none",borderRadius:"4px"}},"div[data-radix-popper-content-wrapper]":{zIndex:"1300 !important"}}},MuiButton:{styleOverrides:{root:{borderRadius:6,textTransform:"none",fontWeight:500,fontSize:13,minHeight:32,paddingTop:0,paddingBottom:0,boxShadow:"none","&:hover":{boxShadow:"none"}},sizeSmall:{minHeight:32,paddingLeft:10,paddingRight:10},sizeMedium:{minHeight:32,paddingLeft:12,paddingRight:12},contained:{"&:hover":{boxShadow:"none"},"&.Mui-disabled":{backgroundColor:n?"rgba(255, 255, 255, 0.06)":Fo[200],color:n?"#64748b":Fo[500]}},outlined:{color:a,borderColor:n?"#475569":Fo[300],"&:hover":{borderColor:n?"#64748b":Fo[400],backgroundColor:n?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"}}}},MuiIconButton:{styleOverrides:{root:{borderRadius:6}}},MuiPopover:{styleOverrides:{paper:{borderRadius:8}}},MuiCard:{styleOverrides:{root:{borderRadius:8,boxShadow:MN,border:"1px solid",borderColor:s,backgroundColor:o}}},MuiChip:{styleOverrides:{root:{borderRadius:6,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:6},"& .MuiInputLabel-outlined":{backgroundColor:o,paddingLeft:4,paddingRight:4,"&.MuiInputLabel-shrink":{transform:"translate(14px, -9px) scale(0.75)"}}}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}},MuiDialog:{styleOverrides:{paper:{borderRadius:12,backgroundColor:o,boxShadow:"0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 10px 10px -5px rgba(0, 0, 0, 0.04)"}}},MuiSelect:{styleOverrides:{select:{fontFamily:fb,fontSize:"0.875rem",color:a}}},MuiInputLabel:{styleOverrides:{root:{"&.MuiInputLabel-outlined":{backgroundColor:o,paddingLeft:4,paddingRight:4}}}},MuiOutlinedInput:{styleOverrides:{notchedOutline:{border:"none"},root:{border:`1px solid ${n?Fo[600]:Fo[300]}`,borderRadius:6,transition:`border-color ${wy} ease-in`,...Cy,backgroundColor:o,"&:hover":{borderColor:n?"#64748b":Fo[400]},"&.Mui-focused":{borderColor:n?Fo[400]:Fo[500],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:fb,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:fb}}},MuiMenu:{styleOverrides:{paper:{borderRadius:8,boxShadow:"0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",border:`1px solid ${s}`,backgroundColor:o,color:a}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:Fo[400]}}}},MuiDivider:{styleOverrides:{root:{borderColor:s}},defaultProps:{sx:{my:1}}},MuiListItemButton:{styleOverrides:{root:{borderRadius:6,margin:"2px 8px",padding:"8px 16px","&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.08)":jo.offWhite},"&.Mui-selected":{backgroundColor:n?"rgba(255, 255, 255, 0.12)":jo.offWhite,color:a,"& .MuiListItemIcon-root":{color:a},"& .MuiListItemText-primary":{color:a},"&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.16)":jo.grey.light}}}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:o,color:a,boxShadow:MN}}}}})};Y3("light");function fSe({children:e}){const{mode:t,theme:n}=eo(),{accent:r,accentHover:o,accentContrast:a}=n,i=C.useMemo(()=>Y3(t,{accent:r,accentHover:o,accentContrast:a}),[t,r,o,a]);return m.jsxs(F8,{theme:i,children:[m.jsx(BY,{}),e]})}const pSe=C.lazy(()=>Ro(()=>import("./HomePage-B1w1b7e1.js"),[])),hSe=C.lazy(()=>Ro(()=>import("./MainPage-BrYzrVlB.js"),__vite__mapDeps([7,8,9,10]))),mSe=C.lazy(()=>Ro(()=>import("./PackageSplatRoute-CU3-BYcC.js").then(e=>e.a),__vite__mapDeps([11,10]))),gSe=C.lazy(()=>Ro(()=>import("./PackagePage-DRKFqQHw.js"),__vite__mapDeps([12,9,10,13]))),ySe=C.lazy(()=>Ro(()=>import("./EnvironmentPage-xh4aL2P9.js"),[])),vSe=C.lazy(()=>Ro(()=>import("./RouteError-Dmo0qwGV.js"),[])),bSe=C.lazy(()=>Ro(()=>import("./ThemeEditorPage-ByJldD0t.js"),__vite__mapDeps([14,15]))),xSe=(e="/",t=new W1e,n)=>(Abe(iSe),OB([{path:e,element:m.jsx(dte,{children:m.jsx(Mve,{documentStorage:t,children:m.jsx(fSe,{children:m.jsx(C.Suspense,{fallback:m.jsx(va,{}),children:m.jsx(hSe,{headerProps:n})})})})}),errorElement:m.jsx(vSe,{}),children:[{index:!0,element:m.jsx(pSe,{})},{path:"settings/theme",element:m.jsx(bSe,{})},{path:"settings",element:m.jsx(oB,{to:"/settings/theme",replace:!0})},{path:":environmentName",element:m.jsx(ySe,{})},{path:":environmentName/:packageName",element:m.jsx(gSe,{})},{path:":environmentName/:packageName/*",element:m.jsx(mSe,{})}]}])),SSe=xSe("/");gU.createRoot(document.getElementById("root")).render(m.jsx(C.StrictMode,{children:m.jsx(VB,{router:SSe})}));export{RSe as $,ss as A,dl as B,CSe as C,gCe as D,ty as E,Vve as F,_F as G,Wye as H,mt as I,ER as J,xo as K,Jo as L,OL as M,AR as N,hr as O,Ka as P,VR as Q,qc as R,lC as S,Ct as T,eo as U,jL as V,il as W,bi as X,OX as Y,Sy as Z,kCe as _,hn as a,Bwe as a$,va as a0,go as a1,tr as a2,Sn as a3,Ro as a4,CCe as a5,oB as a6,Xx as a7,vCe as a8,P1e as a9,zwe as aA,cie as aB,Zwe as aC,Dye as aD,Qwe as aE,Fwe as aF,uie as aG,Uwe as aH,eie as aI,Lwe as aJ,_we as aK,Lne as aL,wSe as aM,Ak as aN,x8 as aO,id as aP,Id as aQ,jz as aR,pl as aS,jae as aT,Ox as aU,nc as aV,Kwe as aW,fie as aX,Oz as aY,Rwe as aZ,xwe as a_,mCe as aa,W6 as ab,Qb as ac,Wn as ad,R2 as ae,wi as af,LL as ag,V5 as ah,BC as ai,Qo as aj,xl as ak,Rb as al,dY as am,mY as an,dy as ao,$o as ap,Wne as aq,Xc as ar,$0 as as,vd as at,Mi as au,rE as av,hl as aw,Ree as ax,UF as ay,YSe as az,Js as b,mwe as b$,wk as b0,e3 as b1,oCe as b2,Gx as b3,yd as b4,JF as b5,To as b6,rCe as b7,ek as b8,s0 as b9,tCe as bA,Eie as bB,Jwe as bC,nCe as bD,Ave as bE,qwe as bF,Ove as bG,uCe as bH,Gwe as bI,bE as bJ,hye as bK,y0 as bL,BF as bM,o3 as bN,Fye as bO,mye as bP,yye as bQ,Twe as bR,gye as bS,GE as bT,Bae as bU,Tve as bV,cwe as bW,gwe as bX,Rne as bY,pwe as bZ,hwe as b_,eCe as ba,Ma as bb,Wwe as bc,Eve as bd,Mj as be,wy as bf,kn as bg,yi as bh,Nwe as bi,cl as bj,kwe as bk,Rae as bl,Ez as bm,$ae as bn,Mz as bo,jwe as bp,HF as bq,uye as br,Eye as bs,Tye as bt,VF as bu,Qx as bv,lCe as bw,qF as bx,Sve as by,YF as bz,Ga as c,eT as c$,vwe as c0,Xwe as c1,hA as c2,Dz as c3,dE as c4,Cwe as c5,wwe as c6,kae as c7,Sae as c8,Cy as c9,dwe as cA,Sie as cB,Ewe as cC,Owe as cD,Pwe as cE,fwe as cF,mx as cG,Mwe as cH,$we as cI,Dwe as cJ,bwe as cK,KF as cL,tz as cM,Ene as cN,Az as cO,Ax as cP,Vwe as cQ,Y7 as cR,Tw as cS,ywe as cT,uwe as cU,Fae as cV,die as cW,nT as cX,Cve as cY,wve as cZ,iCe as c_,dye as ca,fye as cb,Swe as cc,og as cd,Jye as ce,NY as cf,Iwe as cg,Uz as ch,Awe as ci,Dae as cj,Oj as ck,Mae as cl,VL as cm,gy as cn,Xae as co,Qae as cp,Lp as cq,nx as cr,Iae as cs,fve as ct,cCe as cu,sCe as cv,s5 as cw,Hwe as cx,Fz as cy,pie as cz,zt as d,aCe as d0,bve as d1,QF as d2,yve as d3,xve as d4,$ve as d5,Ag as d6,Br as d7,D0 as d8,Ps as d9,wp as da,Yye as db,Kye as dc,FF as dd,pCe as de,xCe as df,a1e as dg,kSe as dh,Ywe as di,dCe as dj,wCe as dk,SCe as dl,hI as dm,Uo as dn,bCe as dp,zp as dq,hCe as dr,gbe as ds,yCe as dt,Hye as du,qye as dv,oC as e,fn as f,dn as g,Ad as h,vl as i,m as j,bo as k,Dd as l,on as m,oL as n,ec as o,fCe as p,cL as q,C as r,dt as s,Wb as t,mn as u,sy as v,aL as w,jn as x,lt as y,Oa as z};