@malloy-publisher/app 0.18.3 → 0.18.4

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 (23) hide show
  1. package/dist/api-doc.yaml +39 -8
  2. package/dist/assets/{EnvironmentPage-CsFUI8IX.js → EnvironmentPage-BxNqq3cN.js} +1 -1
  3. package/dist/assets/{HomePage-B_FVtnN-.js → HomePage-B4iN5rso.js} +1 -1
  4. package/dist/assets/{MainPage-wFF9nPEr.js → MainPage-DGiMH0eU.js} +1 -1
  5. package/dist/assets/{ModelPage-CxenqDcz.js → ModelPage-BJmyMnQo.js} +2 -2
  6. package/dist/assets/{PackagePage-dcF6vrvw.js → PackagePage-D2Pay_Xy.js} +1 -1
  7. package/dist/assets/{PackageSplatRoute-CASBZk0k.js → PackageSplatRoute-CQ7PxhkD.js} +2 -2
  8. package/dist/assets/{RenderedResult--fYcsY1h.es-DzOt5Lwv.js → RenderedResult-BEJ_GMaW.es-DS2oXAjc.js} +1 -1
  9. package/dist/assets/{RouteError-CUIolYwb.js → RouteError-BysHaT0t.js} +1 -1
  10. package/dist/assets/{ThemeEditorPage-DgU2YYq6.js → ThemeEditorPage-BFyTBbqA.js} +1 -1
  11. package/dist/assets/{ToggleButtonGroup-Dmr-hVlD.js → ToggleButtonGroup-eURRljZv.js} +1 -1
  12. package/dist/assets/{documentRoutes-Drv-WDwO.js → documentRoutes-DgTzGqfC.js} +1 -1
  13. package/dist/assets/{editPageMounted-C5yJiIVi.js → editPageMounted-CWBeAIbE.js} +2 -2
  14. package/dist/assets/{index-BSyL0zds.js → index-CCLHq9po.js} +15 -15
  15. package/dist/assets/{index-Dtw4eTxH.js → index-D4DhR2vg.js} +1 -1
  16. package/dist/assets/{index-BIoSdsU9.js → index-N8X9kVzc.js} +1 -1
  17. package/dist/assets/{index-DxF3kMLJ.js → index-We9Zzxmt.js} +1 -1
  18. package/dist/assets/{index.es-CX9m4CBD.js → index.es-D_O2KdNW.js} +1 -1
  19. package/dist/assets/usePackageLinkNavigate-CllycPZP.js +1 -0
  20. package/dist/assets/{usePackageRoute-wJGaZEiY.js → usePackageRoute-DEUbQLf3.js} +1 -1
  21. package/dist/index.html +1 -1
  22. package/package.json +2 -2
  23. package/dist/assets/usePackageLinkNavigate-qNjcXPcY.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BIoSdsU9.js","assets/index-B0BUzE-t.js","assets/index-DxF3kMLJ.js","assets/core-B8oMW4sm.es-hOkwvru5.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/index-Dtw4eTxH.js","assets/index-Co7C9Gew.js","assets/MainPage-wFF9nPEr.js","assets/editPageMounted-C5yJiIVi.js","assets/documentRoutes-Drv-WDwO.js","assets/usePackageRoute-wJGaZEiY.js","assets/PackageSplatRoute-CASBZk0k.js","assets/PackagePage-dcF6vrvw.js","assets/usePackageLinkNavigate-qNjcXPcY.js","assets/ThemeEditorPage-DgU2YYq6.js","assets/ToggleButtonGroup-Dmr-hVlD.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-N8X9kVzc.js","assets/index-B0BUzE-t.js","assets/index-We9Zzxmt.js","assets/core-B8oMW4sm.es-hOkwvru5.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/index-D4DhR2vg.js","assets/index-Co7C9Gew.js","assets/MainPage-DGiMH0eU.js","assets/editPageMounted-CWBeAIbE.js","assets/documentRoutes-DgTzGqfC.js","assets/usePackageRoute-DEUbQLf3.js","assets/PackageSplatRoute-CQ7PxhkD.js","assets/PackagePage-D2Pay_Xy.js","assets/usePackageLinkNavigate-CllycPZP.js","assets/ThemeEditorPage-BFyTBbqA.js","assets/ToggleButtonGroup-eURRljZv.js"])))=>i.map(i=>d[i]);
2
2
  function iL(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 LEe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function P$(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bS={exports:{}},Em={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -271,7 +271,7 @@ export default theme;`}function TP(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
  `),l=s===-1?-1:i.indexOf(`
273
273
  `,s+1),d=l===-1?"":i.slice(l+1);String(r.stack).endsWith(d)||(r.stack+=`
274
- `+i)}}catch{}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=_d(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&l0.assertOptions(r,{silentJSONParsing:ha.transitional(ha.boolean),forcedJSONParsing:ha.transitional(ha.boolean),clarifyTimeoutError:ha.transitional(ha.boolean),legacyInterceptorReqResOrdering:ha.transitional(ha.boolean),advertiseZstdAcceptEncoding:ha.transitional(ha.boolean),validateStatusUndefinedResolves:ha.transitional(ha.boolean)},!1),o!=null&&(Ae.isFunction(o)?n.paramsSerializer={serialize:o}:l0.assertOptions(o,{encode:ha.function,serialize:ha.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),l0.assertOptions(n,{baseUrl:ha.spelling("baseURL"),withXsrfToken:ha.spelling("withXSRFToken")},!0),n.method=(Ae.getSafeProp(n,"method")||Ae.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=a&&Ae.merge(a.common,a[n.method]);a&&Ae.forEach(o4.concat("common"),x=>{delete a[x]}),n.headers=xa.concat(i,a);const s=[];let l=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(n)===!1)return;l=l&&w.synchronous;const S=n.transitional||WE;S&&S.legacyInterceptorReqResOrdering?s.unshift(w.fulfilled,w.rejected):s.push(w.fulfilled,w.rejected)});const d=[];this.interceptors.response.forEach(function(w){d.push(w.fulfilled,w.rejected)});let u,m=0,g;if(!l){const x=[XS.bind(this),void 0];for(x.unshift(...s),x.push(...d),g=x.length,u=Promise.resolve(n);m<g;)u=u.then(x[m++],x[m++]);return u}g=s.length;let y=n;for(;m<g;){const x=s[m++],w=s[m++];try{y=x?x(y):y}catch(S){if(!w){u=Promise.reject(S);break}try{const b=w.call(this,S);Ae.isThenable(b)&&(u=Promise.resolve(b).then(()=>XS.call(this,y)))}catch(b){u=Promise.reject(b)}break}}if(!u)try{u=XS.call(this,y)}catch(x){u=Promise.reject(x)}for(m=0,g=d.length;m<g;)u=u.then(d[m++],d[m++]);return u}getUri(t){t=_d(this.defaults,t);const n=l4(t.baseURL,t.url,t.allowAbsoluteUrls,t);return e4(n,t.params,t.paramsSerializer)}};Ae.forEach(["delete","get","head","options"],function(t){Ed.prototype[t]=function(n,r){return this.request(_d(r||{},{method:t,url:n,data:r&&Ae.hasOwnProp(r,"data")?r.data:void 0}))}});Ae.forEach(["post","put","patch","query"],function(t){function n(r){return function(a,i,s){return this.request(_d(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}Ed.prototype[t]=n(),t!=="query"&&(Ed.prototype[t+"Form"]=n(!0))});let zne=class p4{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 Hy(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 p4(function(o){t=o}),cancel:t}}};function Fne(e){return function(n){return e.apply(null,n)}}function _ne(e){return Ae.isObject(e)&&e.isAxiosError===!0}const c0={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(c0).forEach(([e,t])=>{c0[t]===void 0&&(c0[t]=e)});function h4(e){const t=new Ed(e),n=zz(Ed.prototype.request,t);return Ae.extend(n,Ed.prototype,t,{allOwnKeys:!0}),Ae.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return h4(_d(e,o))},n}const _t=h4(qy);_t.Axios=Ed;_t.CanceledError=Hy;_t.CancelToken=zne;_t.isCancel=a4;_t.VERSION=GE;_t.toFormData=Yx;_t.AxiosError=Wt;_t.Cancel=_t.CanceledError;_t.all=function(t){return Promise.all(t)};_t.spread=Fne;_t.isAxiosError=_ne;_t.mergeConfig=_d;_t.AxiosHeaders=xa;_t.formToJSON=e=>r4(Ae.isHTMLForm(e)?new FormData(e):e);_t.getAdapter=f4.getAdapter;_t.HttpStatusCode=c0;_t.default=_t;const{Axios:HEe,AxiosError:WEe,CanceledError:YEe,isCancel:GEe,CancelToken:KEe,VERSION:QEe,all:XEe,Cancel:ZEe,isAxiosError:JEe,spread:eRe,toFormData:tRe,AxiosHeaders:nRe,HttpStatusCode:rRe,formToJSON:oRe,getAdapter:aRe,mergeConfig:iRe,create:sRe}=_t,uA="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",vi={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:uA}},font:{mono:uA},shadow:{menu:"0 8px 24px rgba(16, 24, 40, 0.12)"}};function Bne(e){if(!e)return vi;const t={...vi.font,...e.font},n={...vi.type};n.code={...n.code,fontFamily:t.mono};for(const[r,o]of Object.entries(e.type??{}))n[r]={...n[r],...o};return{radius:{...vi.radius,...e.radius},size:{...vi.size,...e.size},type:n,font:t,shadow:{...vi.shadow,...e.shadow}}}const pr={blue:"#2563eb",violet:"#7c3aed",pink:"#be185d",red:"#dc2626",orange:"#c2410c",amber:"#b45309",lime:"#4d7c0f",emerald:"#059669",teal:"#0f766e",cyan:"#0e7490",slate:"#475569"},QE={environment:pr.emerald,package:pr.teal,connection:pr.orange},Fo='"JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", monospace',Une=ct(PK)({display:"flex",flexDirection:"column",height:"100%",boxShadow:"none",border:"none",backgroundColor:"transparent"}),Vne=ct(NK)({display:"flex",flexDirection:"column",padding:"0",flexGrow:1}),m4=ct(BK)({padding:"0"}),g4=ct("div")({backgroundColor:"transparent",paddingTop:"12px",paddingBottom:"2px",borderRadius:"8px",border:"none",boxShadow:"none",marginBottom:"0"}),qne=ct("div")({height:"100%"}),y4=ct("div")({height:"75vh",width:"100%",overflowY:"auto"}),Hne={light:{accent:pr.blue,accentHover:"#1d4ed8",accentContrast:"#ffffff"},dark:{accent:"#60a5fa",accentHover:"#93c5fd",accentContrast:"#0f172a"}},Wne={light:"#ffffff",dark:"#0f172a"},Yne=3,zg=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))},v4=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`,Pk=(e,t,n)=>v4(e.map(r=>r+(t-r)*n)),jk=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},z0=(e,t)=>{const[n,r]=[jk(e),jk(t)].sort((o,a)=>a-o);return(n+.05)/(r+.05)},Gne=[15,23,42];function Ak(e,t,n=Yne){const r=zg(e),o=zg(t);if(!r||!o||z0(r,o)>=n)return e;const a=jk(o)<.5?255:0;for(let i=.05;i<1;i+=.05){const s=zg(Pk(r,a,i));if(s&&z0(s,o)>=n)return v4(s)}return a===255?"#ffffff":"#000000"}function Dk(e,t,n=Wne[t]){const r=Hne[t];if(!e||e.toLowerCase()===pr.blue)return r;if(!zg(e))return t==="light"?{...r,accent:e,accentHover:e}:r;const o=Ak(e,n),a=zg(o),i=t==="dark"?Pk(a,255,.25):Pk(a,0,.2),s=z0(a,[255,255,255]),l=z0(a,Gne);return{accent:o,accentHover:i,accentContrast:s>=l?"#ffffff":"#0f172a"}}const Kne=[pr.blue,pr.orange,pr.emerald,pr.pink,pr.violet,pr.amber,pr.cyan,pr.lime],Qne="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",Nk={palette:{series:Kne,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:pr.blue,dark:pr.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:Qne,size:12}},Xne=["background","tableHeader","tableHeaderBackground","tableBody","tile","tileTitle","mapColor","border","cardBorder","axis","gridline","chartText","value"];function b4(e,t){const n=Nk.palette??{},r=Nk.font??{family:"sans-serif",size:12};let o=[...n.series??[]],a=!1,i=r.family??"sans-serif",s=r.size??12;const l={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??{}}},d={light:new Set,dark:new Set};for(const x of e)if(x){Array.isArray(x.palette?.series)&&(o=[...x.palette.series],a=!0);for(const w of Xne){const S=x.palette?.[w];S&&(l[w]={...l[w],...S},S.light!==void 0&&d.light.add(w),S.dark!==void 0&&d.dark.add(w))}typeof x.font?.family=="string"&&(i=x.font.family),typeof x.font?.size=="number"&&(s=x.font.size)}const u=t==="dark",m=x=>l[x][t]??n[x]?.[t],g=m("background"),y=u&&d.light.has("mapColor")&&!d.dark.has("mapColor")?Ak(l.mapColor.light,g):m("mapColor");return{mode:t,ui:vi,series:u&&a?o.map(x=>Ak(x,g)):o,...Dk(o[0],t,g),font:{family:i,size:s},background:g,tableHeader:m("tableHeader"),tableHeaderBackground:m("tableHeaderBackground"),tableBody:m("tableBody"),tile:m("tile"),tileTitle:m("tileTitle"),mapColor:y,tableBackground:g,border:`1px solid ${m("border")}`,cardBorder:`1px solid ${m("cardBorder")}`,pinnedBorder:`1px solid ${m("cardBorder")}`,valueColor:m("value"),foreground:m("chartText"),axisFaint:m("axis"),gridline:m("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:Dk(void 0,t).accent}}function lRe(e,t){const n=t.palette?.series;if(!Array.isArray(n)||n.length!==1)return t;const r=n[0],o=e.reduce((d,u)=>Array.isArray(u?.palette?.series)?u.palette.series:d,Nk.palette?.series??[]),a=d=>d.toLowerCase()===r.toLowerCase(),[i,...s]=o,l=s.length>0?s.map(d=>a(d)?i:d):[i].filter(d=>d!==void 0&&!a(d));return{...t,palette:{...t.palette,series:[r,...l]}}}function Zne(e,t,n){const r=t??e??"light";return r==="auto"?n?"dark":"light":r}const x4=C.createContext(void 0);function Jne({layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o=!0,ui:a,children:i}){const s=JSON.stringify(a??null),l=C.useMemo(()=>Bne(a),[s]),d=C.useMemo(()=>({...b4(e,t),ui:l}),[e,t,l]),u=C.useMemo(()=>({theme:d,layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o}),[d,e,t,n,r,o]);return p.jsx(x4.Provider,{value:u,children:i})}function Hr(){return C.useContext(x4)||{theme:b4([],"light"),layers:[],mode:"light",userChoice:void 0,setMode:()=>{},allowUserToggle:!1}}const ln="http://localhost/api/v0".replace(/\/+$/,"");let hs=class{constructor(t,n=ln,r=_t){this.basePath=n,this.axios=r,t&&(this.configuration=t,this.basePath=t.basePath??n)}configuration},ere=class extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}};const dn={},fn="https://example.com",Ze=function(e,t,n){if(n==null)throw new ere(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Ik(e,t,n=""){t!=null&&(typeof t=="object"?Array.isArray(t)||t instanceof Set?t.forEach(r=>Ik(e,r,n)):Object.keys(t).forEach(r=>Ik(e,t[r],`${n}${n!==""?".":""}${r}`)):e.has(n)?e.append(n,t):e.set(n,t))}const pn=function(e,...t){const n=new URLSearchParams(e.search);Ik(n,t),e.search=n.toString()},tre=function(e,t){return t instanceof Set?Array.from(t):t},Mo=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:{},tre):e||""},hn=function(e){return e.pathname+e.search+e.hash},mn=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)}},w4={Bigquery:"bigquery",Snowflake:"snowflake",Postgres:"postgres",Gcs:"gcs",S3:"s3",Azure:"azure"},dA={Postgres:"postgres",Bigquery:"bigquery",Snowflake:"snowflake",Trino:"trino",Databricks:"databricks",Mysql:"mysql",Sqlserver:"sqlserver",Duckdb:"duckdb",Motherduck:"motherduck",Ducklake:"ducklake",Publisher:"publisher"},ba={Pending:"PENDING",ManifestRowsReady:"MANIFEST_ROWS_READY",ManifestFileReady:"MANIFEST_FILE_READY",Failed:"FAILED",Cancelled:"CANCELLED"},Cb={Version:"version",Package:"package"},nre=function(e){return{getAgent:async(t,n,r,o,a,i={})=>{Ze("getAgent","environmentName",t),Ze("getAgent","packageName",n),Ze("getAgent","agentName",r);const s="/environments/{environmentName}/packages/{packageName}/agents/{agentName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{agentName}",encodeURIComponent(String(r))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};o!==void 0&&(g.skills=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:hn(l),options:u}},getAgentSkillFile:async(t,n,r,o,a,i={})=>{Ze("getAgentSkillFile","environmentName",t),Ze("getAgentSkillFile","packageName",n),Ze("getAgentSkillFile","agentName",r),Ze("getAgentSkillFile","relativeFilepath",o);const s="/environments/{environmentName}/packages/{packageName}/agents/{agentName}/skills/{relativeFilepath}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{agentName}",encodeURIComponent(String(r))).replace("{relativeFilepath}",encodeURIComponent(String(o))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:hn(l),options:u}},listAgents:async(t,n,r,o={})=>{Ze("listAgents","environmentName",t),Ze("listAgents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/agents".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}}}},ZS=function(e){const t=nre(e);return{async getAgent(n,r,o,a,i,s){const l=await t.getAgent(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["AgentsApi.getAgent"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async getAgentSkillFile(n,r,o,a,i,s){const l=await t.getAgentSkillFile(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["AgentsApi.getAgentSkillFile"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async listAgents(n,r,o,a){const i=await t.listAgents(n,r,o,a),s=e?.serverIndex??0,l=dn["AgentsApi.listAgents"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};let rre=class extends hs{getAgent(t,n,r,o,a,i){return ZS(this.configuration).getAgent(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}getAgentSkillFile(t,n,r,o,a,i){return ZS(this.configuration).getAgentSkillFile(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}listAgents(t,n,r,o){return ZS(this.configuration).listAgents(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const ore=function(e){return{createConnection:async(t,n,r,o={})=>{Ze("createConnection","environmentName",t),Ze("createConnection","connectionName",n),Ze("createConnection","connection",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}},deleteConnection:async(t,n,r={})=>{Ze("deleteConnection","environmentName",t),Ze("deleteConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={},d={};l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:hn(a),options:s}},getConnection:async(t,n,r={})=>{Ze("getConnection","environmentName",t),Ze("getConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:hn(a),options:s}},getTable:async(t,n,r,o,a={})=>{Ze("getTable","environmentName",t),Ze("getTable","connectionName",n),Ze("getTable","schemaName",r),Ze("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,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},getTableInPackage:async(t,n,r,o,a,i,s={})=>{Ze("getTableInPackage","environmentName",t),Ze("getTableInPackage","packageName",n),Ze("getTableInPackage","connectionName",r),Ze("getTableInPackage","schemaName",o),Ze("getTableInPackage","tablePath",a);const l="/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))),d=new URL(l,fn);let u;e&&(u=e.baseOptions);const m={method:"GET",...u,...s},g={},y={};i!==void 0&&(y.versionId=i),g.Accept="application/json",pn(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:hn(d),options:m}},listConnections:async(t,n={})=>{Ze("listConnections","environmentName",t);const r="/environments/{environmentName}/connections".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:hn(o),options:i}},listSchemas:async(t,n,r={})=>{Ze("listSchemas","environmentName",t),Ze("listSchemas","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:hn(a),options:s}},listSchemasInPackage:async(t,n,r,o,a={})=>{Ze("listSchemasInPackage","environmentName",t),Ze("listSchemasInPackage","packageName",n),Ze("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,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},listTables:async(t,n,r,o,a={})=>{Ze("listTables","environmentName",t),Ze("listTables","connectionName",n),Ze("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,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o&&(m.tableNames=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},listTablesInPackage:async(t,n,r,o,a,i,s={})=>{Ze("listTablesInPackage","environmentName",t),Ze("listTablesInPackage","packageName",n),Ze("listTablesInPackage","connectionName",r),Ze("listTablesInPackage","schemaName",o);const l="/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))),d=new URL(l,fn);let u;e&&(u=e.baseOptions);const m={method:"GET",...u,...s},g={},y={};a&&(y.tableNames=a),i!==void 0&&(y.versionId=i),g.Accept="application/json",pn(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:hn(d),options:m}},postQuerydata:async(t,n,r,o={})=>{Ze("postQuerydata","environmentName",t),Ze("postQuerydata","connectionName",n),Ze("postQuerydata","postQuerydataRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}},postQuerydataInPackage:async(t,n,r,o,a,i={})=>{Ze("postQuerydataInPackage","environmentName",t),Ze("postQuerydataInPackage","packageName",n),Ze("postQuerydataInPackage","connectionName",r),Ze("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))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:hn(l),options:u}},postSqlsource:async(t,n,r,o={})=>{Ze("postSqlsource","environmentName",t),Ze("postSqlsource","connectionName",n),Ze("postSqlsource","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}},postSqlsourceInPackage:async(t,n,r,o,a,i={})=>{Ze("postSqlsourceInPackage","environmentName",t),Ze("postSqlsourceInPackage","packageName",n),Ze("postSqlsourceInPackage","connectionName",r),Ze("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))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:hn(l),options:u}},postTemporarytable:async(t,n,r,o={})=>{Ze("postTemporarytable","environmentName",t),Ze("postTemporarytable","connectionName",n),Ze("postTemporarytable","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}},postTemporarytableInPackage:async(t,n,r,o,a,i={})=>{Ze("postTemporarytableInPackage","environmentName",t),Ze("postTemporarytableInPackage","packageName",n),Ze("postTemporarytableInPackage","connectionName",r),Ze("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))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:hn(l),options:u}},updateConnection:async(t,n,r,o={})=>{Ze("updateConnection","environmentName",t),Ze("updateConnection","connectionName",n),Ze("updateConnection","updateConnectionRequest",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}}}},sa=function(e){const t=ore(e);return{async createConnection(n,r,o,a){const i=await t.createConnection(n,r,o,a),s=e?.serverIndex??0,l=dn["ConnectionsApi.createConnection"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async deleteConnection(n,r,o){const a=await t.deleteConnection(n,r,o),i=e?.serverIndex??0,s=dn["ConnectionsApi.deleteConnection"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)},async getConnection(n,r,o){const a=await t.getConnection(n,r,o),i=e?.serverIndex??0,s=dn["ConnectionsApi.getConnection"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)},async getTable(n,r,o,a,i){const s=await t.getTable(n,r,o,a,i),l=e?.serverIndex??0,d=dn["ConnectionsApi.getTable"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async getTableInPackage(n,r,o,a,i,s,l){const d=await t.getTableInPackage(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=dn["ConnectionsApi.getTableInPackage"]?.[u]?.url;return(g,y)=>mn(d,_t,ln,e)(g,m||y)},async listConnections(n,r){const o=await t.listConnections(n,r),a=e?.serverIndex??0,i=dn["ConnectionsApi.listConnections"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)},async listSchemas(n,r,o){const a=await t.listSchemas(n,r,o),i=e?.serverIndex??0,s=dn["ConnectionsApi.listSchemas"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)},async listSchemasInPackage(n,r,o,a,i){const s=await t.listSchemasInPackage(n,r,o,a,i),l=e?.serverIndex??0,d=dn["ConnectionsApi.listSchemasInPackage"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async listTables(n,r,o,a,i){const s=await t.listTables(n,r,o,a,i),l=e?.serverIndex??0,d=dn["ConnectionsApi.listTables"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async listTablesInPackage(n,r,o,a,i,s,l){const d=await t.listTablesInPackage(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=dn["ConnectionsApi.listTablesInPackage"]?.[u]?.url;return(g,y)=>mn(d,_t,ln,e)(g,m||y)},async postQuerydata(n,r,o,a){const i=await t.postQuerydata(n,r,o,a),s=e?.serverIndex??0,l=dn["ConnectionsApi.postQuerydata"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async postQuerydataInPackage(n,r,o,a,i,s){const l=await t.postQuerydataInPackage(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["ConnectionsApi.postQuerydataInPackage"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async postSqlsource(n,r,o,a){const i=await t.postSqlsource(n,r,o,a),s=e?.serverIndex??0,l=dn["ConnectionsApi.postSqlsource"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async postSqlsourceInPackage(n,r,o,a,i,s){const l=await t.postSqlsourceInPackage(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["ConnectionsApi.postSqlsourceInPackage"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async postTemporarytable(n,r,o,a){const i=await t.postTemporarytable(n,r,o,a),s=e?.serverIndex??0,l=dn["ConnectionsApi.postTemporarytable"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async postTemporarytableInPackage(n,r,o,a,i,s){const l=await t.postTemporarytableInPackage(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["ConnectionsApi.postTemporarytableInPackage"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async updateConnection(n,r,o,a){const i=await t.updateConnection(n,r,o,a),s=e?.serverIndex??0,l=dn["ConnectionsApi.updateConnection"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};let are=class extends hs{createConnection(t,n,r,o){return sa(this.configuration).createConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteConnection(t,n,r){return sa(this.configuration).deleteConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getConnection(t,n,r){return sa(this.configuration).getConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getTable(t,n,r,o,a){return sa(this.configuration).getTable(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getTableInPackage(t,n,r,o,a,i,s){return sa(this.configuration).getTableInPackage(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}listConnections(t,n){return sa(this.configuration).listConnections(t,n).then(r=>r(this.axios,this.basePath))}listSchemas(t,n,r){return sa(this.configuration).listSchemas(t,n,r).then(o=>o(this.axios,this.basePath))}listSchemasInPackage(t,n,r,o,a){return sa(this.configuration).listSchemasInPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listTables(t,n,r,o,a){return sa(this.configuration).listTables(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listTablesInPackage(t,n,r,o,a,i,s){return sa(this.configuration).listTablesInPackage(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}postQuerydata(t,n,r,o){return sa(this.configuration).postQuerydata(t,n,r,o).then(a=>a(this.axios,this.basePath))}postQuerydataInPackage(t,n,r,o,a,i){return sa(this.configuration).postQuerydataInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}postSqlsource(t,n,r,o){return sa(this.configuration).postSqlsource(t,n,r,o).then(a=>a(this.axios,this.basePath))}postSqlsourceInPackage(t,n,r,o,a,i){return sa(this.configuration).postSqlsourceInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}postTemporarytable(t,n,r,o){return sa(this.configuration).postTemporarytable(t,n,r,o).then(a=>a(this.axios,this.basePath))}postTemporarytableInPackage(t,n,r,o,a,i){return sa(this.configuration).postTemporarytableInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}updateConnection(t,n,r,o){return sa(this.configuration).updateConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const ire=function(e){return{listDataApps:async(t,n,r,o={})=>{Ze("listDataApps","environmentName",t),Ze("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,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}}}},sre=function(e){const t=ire(e);return{async listDataApps(n,r,o,a){const i=await t.listDataApps(n,r,o,a),s=e?.serverIndex??0,l=dn["DataAppsApi.listDataApps"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};class lre extends hs{listDataApps(t,n,r,o){return sre(this.configuration).listDataApps(t,n,r,o).then(a=>a(this.axios,this.basePath))}}const cre=function(e){return{listDatabases:async(t,n,r,o={})=>{Ze("listDatabases","environmentName",t),Ze("listDatabases","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/databases".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}}}},ure=function(e){const t=cre(e);return{async listDatabases(n,r,o,a){const i=await t.listDatabases(n,r,o,a),s=e?.serverIndex??0,l=dn["DatabasesApi.listDatabases"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};class dre extends hs{listDatabases(t,n,r,o){return ure(this.configuration).listDatabases(t,n,r,o).then(a=>a(this.axios,this.basePath))}}const fre=function(e){return{createEnvironment:async(t,n={})=>{Ze("createEnvironment","environment",t);const r="/environments",o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:hn(o),options:i}},deleteEnvironment:async(t,n={})=>{Ze("deleteEnvironment","environmentName",t);const r="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"DELETE",...a,...n},s={},l={};s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:hn(o),options:i}},getEnvironment:async(t,n,r={})=>{Ze("getEnvironment","environmentName",t);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};n!==void 0&&(d.reload=n),l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:hn(a),options:s}},listEnvironments:async(t={})=>{const n="/environments",r=new URL(n,fn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",pn(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:hn(r),options:a}},updateEnvironment:async(t,n,r={})=>{Ze("updateEnvironment","environmentName",t),Ze("updateEnvironment","environment",n);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"PATCH",...i,...r},l={},d={};l["Content-Type"]="application/json",l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},s.data=Mo(n,s,e),{url:hn(a),options:s}}}},Bm=function(e){const t=fre(e);return{async createEnvironment(n,r){const o=await t.createEnvironment(n,r),a=e?.serverIndex??0,i=dn["EnvironmentsApi.createEnvironment"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)},async deleteEnvironment(n,r){const o=await t.deleteEnvironment(n,r),a=e?.serverIndex??0,i=dn["EnvironmentsApi.deleteEnvironment"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)},async getEnvironment(n,r,o){const a=await t.getEnvironment(n,r,o),i=e?.serverIndex??0,s=dn["EnvironmentsApi.getEnvironment"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)},async listEnvironments(n){const r=await t.listEnvironments(n),o=e?.serverIndex??0,a=dn["EnvironmentsApi.listEnvironments"]?.[o]?.url;return(i,s)=>mn(r,_t,ln,e)(i,a||s)},async updateEnvironment(n,r,o){const a=await t.updateEnvironment(n,r,o),i=e?.serverIndex??0,s=dn["EnvironmentsApi.updateEnvironment"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)}}};let pre=class extends hs{createEnvironment(t,n){return Bm(this.configuration).createEnvironment(t,n).then(r=>r(this.axios,this.basePath))}deleteEnvironment(t,n){return Bm(this.configuration).deleteEnvironment(t,n).then(r=>r(this.axios,this.basePath))}getEnvironment(t,n,r){return Bm(this.configuration).getEnvironment(t,n,r).then(o=>o(this.axios,this.basePath))}listEnvironments(t){return Bm(this.configuration).listEnvironments(t).then(n=>n(this.axios,this.basePath))}updateEnvironment(t,n,r){return Bm(this.configuration).updateEnvironment(t,n,r).then(o=>o(this.axios,this.basePath))}};const hre=function(e){return{createMaterialization:async(t,n,r,o={})=>{Ze("createMaterialization","environmentName",t),Ze("createMaterialization","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}},deleteMaterialization:async(t,n,r,o,a={})=>{Ze("deleteMaterialization","environmentName",t),Ze("deleteMaterialization","packageName",n),Ze("deleteMaterialization","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,fn);let l;e&&(l=e.baseOptions);const d={method:"DELETE",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},dropMaterializedTable:async(t,n,r,o,a,i,s={})=>{Ze("dropMaterializedTable","environmentName",t),Ze("dropMaterializedTable","packageName",n),Ze("dropMaterializedTable","connectionName",r),Ze("dropMaterializedTable","tableName",o);const l="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/materializedTables/{tableName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))).replace("{tableName}",encodeURIComponent(String(o))),d=new URL(l,fn);let u;e&&(u=e.baseOptions);const m={method:"DELETE",...u,...s},g={},y={};a!==void 0&&(y.materializationId=a),i!==void 0&&(y.versionId=i),g.Accept="application/json",pn(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:hn(d),options:m}},getMaterialization:async(t,n,r,o,a={})=>{Ze("getMaterialization","environmentName",t),Ze("getMaterialization","packageName",n),Ze("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,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},listMaterializations:async(t,n,r,o,a,i={})=>{Ze("listMaterializations","environmentName",t),Ze("listMaterializations","packageName",n);const s="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};r!==void 0&&(g.limit=r),o!==void 0&&(g.offset=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:hn(l),options:u}},materializationAction:async(t,n,r,o,a,i={})=>{Ze("materializationAction","environmentName",t),Ze("materializationAction","packageName",n),Ze("materializationAction","materializationId",r),Ze("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))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};o!==void 0&&(g.action=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:hn(l),options:u}}}},np=function(e){const t=hre(e);return{async createMaterialization(n,r,o,a){const i=await t.createMaterialization(n,r,o,a),s=e?.serverIndex??0,l=dn["MaterializationsApi.createMaterialization"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async deleteMaterialization(n,r,o,a,i){const s=await t.deleteMaterialization(n,r,o,a,i),l=e?.serverIndex??0,d=dn["MaterializationsApi.deleteMaterialization"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async dropMaterializedTable(n,r,o,a,i,s,l){const d=await t.dropMaterializedTable(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=dn["MaterializationsApi.dropMaterializedTable"]?.[u]?.url;return(g,y)=>mn(d,_t,ln,e)(g,m||y)},async getMaterialization(n,r,o,a,i){const s=await t.getMaterialization(n,r,o,a,i),l=e?.serverIndex??0,d=dn["MaterializationsApi.getMaterialization"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async listMaterializations(n,r,o,a,i,s){const l=await t.listMaterializations(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["MaterializationsApi.listMaterializations"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async materializationAction(n,r,o,a,i,s){const l=await t.materializationAction(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["MaterializationsApi.materializationAction"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)}}};let mre=class extends hs{createMaterialization(t,n,r,o){return np(this.configuration).createMaterialization(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteMaterialization(t,n,r,o,a){return np(this.configuration).deleteMaterialization(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}dropMaterializedTable(t,n,r,o,a,i,s){return np(this.configuration).dropMaterializedTable(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}getMaterialization(t,n,r,o,a){return np(this.configuration).getMaterialization(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listMaterializations(t,n,r,o,a,i){return np(this.configuration).listMaterializations(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}materializationAction(t,n,r,o,a,i){return np(this.configuration).materializationAction(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const gre={Stop:"stop"},yre=function(e){return{compileModelSource:async(t,n,r,o,a,i={})=>{Ze("compileModelSource","environmentName",t),Ze("compileModelSource","packageName",n),Ze("compileModelSource","path",r),Ze("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))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:hn(l),options:u}},executeQueryModel:async(t,n,r,o,a,i,s={})=>{Ze("executeQueryModel","environmentName",t),Ze("executeQueryModel","packageName",n),Ze("executeQueryModel","path",r),Ze("executeQueryModel","queryRequest",o);const l="/environments/{environmentName}/packages/{packageName}/models/{path}/query".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),d=new URL(l,fn);let u;e&&(u=e.baseOptions);const m={method:"POST",...u,...s},g={},y={};a!==void 0&&(y.includeHiddenFilesAndSources=a),i!==void 0&&(y.versionId=i),g["Content-Type"]="application/json",g.Accept="application/json",pn(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},m.data=Mo(o,m,e),{url:hn(d),options:m}},getModel:async(t,n,r,o,a,i,s={})=>{Ze("getModel","environmentName",t),Ze("getModel","packageName",n),Ze("getModel","path",r);const l="/environments/{environmentName}/packages/{packageName}/models/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),d=new URL(l,fn);let u;e&&(u=e.baseOptions);const m={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",pn(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:hn(d),options:m}},listModels:async(t,n,r,o,a={})=>{Ze("listModels","environmentName",t),Ze("listModels","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/models".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};r!==void 0&&(m.versionId=r),o!==void 0&&(m.includeHiddenFilesAndSources=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},updateModelSource:async(t,n,r,o,a,i={})=>{Ze("updateModelSource","environmentName",t),Ze("updateModelSource","packageName",n),Ze("updateModelSource","path",r),Ze("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))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"PUT",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:hn(l),options:u}}}},Um=function(e){const t=yre(e);return{async compileModelSource(n,r,o,a,i,s){const l=await t.compileModelSource(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["ModelsApi.compileModelSource"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async executeQueryModel(n,r,o,a,i,s,l){const d=await t.executeQueryModel(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=dn["ModelsApi.executeQueryModel"]?.[u]?.url;return(g,y)=>mn(d,_t,ln,e)(g,m||y)},async getModel(n,r,o,a,i,s,l){const d=await t.getModel(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=dn["ModelsApi.getModel"]?.[u]?.url;return(g,y)=>mn(d,_t,ln,e)(g,m||y)},async listModels(n,r,o,a,i){const s=await t.listModels(n,r,o,a,i),l=e?.serverIndex??0,d=dn["ModelsApi.listModels"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async updateModelSource(n,r,o,a,i,s){const l=await t.updateModelSource(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["ModelsApi.updateModelSource"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)}}};let vre=class extends hs{compileModelSource(t,n,r,o,a,i){return Um(this.configuration).compileModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}executeQueryModel(t,n,r,o,a,i,s){return Um(this.configuration).executeQueryModel(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}getModel(t,n,r,o,a,i,s){return Um(this.configuration).getModel(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}listModels(t,n,r,o,a){return Um(this.configuration).listModels(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updateModelSource(t,n,r,o,a,i){return Um(this.configuration).updateModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const bre=function(e){return{createPackage:async(t,n,r,o={})=>{Ze("createPackage","environmentName",t),Ze("createPackage","_package",n);const a="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};r!==void 0&&(u.dryRun=r),d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(n,l,e),{url:hn(i),options:l}},deletePackage:async(t,n,r={})=>{Ze("deletePackage","environmentName",t),Ze("deletePackage","packageName",n);const o="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={},d={};l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:hn(a),options:s}},getPackage:async(t,n,r,o,a={})=>{Ze("getPackage","environmentName",t),Ze("getPackage","packageName",n);const i="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};r!==void 0&&(m.versionId=r),o!==void 0&&(m.reload=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},getPackageBuildPlan:async(t,n,r,o={})=>{Ze("getPackageBuildPlan","environmentName",t),Ze("getPackageBuildPlan","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/build-plan".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}},getPackageClassification:async(t,n,r,o={})=>{Ze("getPackageClassification","environmentName",t),Ze("getPackageClassification","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/classification".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}},getPackageEmbeddingIndex:async(t,n,r,o={})=>{Ze("getPackageEmbeddingIndex","environmentName",t),Ze("getPackageEmbeddingIndex","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/embedding-index".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}},getPackageEntities:async(t,n,r,o,a={})=>{Ze("getPackageEntities","environmentName",t),Ze("getPackageEntities","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/entities".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};r!==void 0&&(m.versionId=r),o!==void 0&&(m.includeHiddenFilesAndSources=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},getPackageStatus:async(t,n,r,o={})=>{Ze("getPackageStatus","environmentName",t),Ze("getPackageStatus","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/status".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}},listPackages:async(t,n={})=>{Ze("listPackages","environmentName",t);const r="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:hn(o),options:i}},updatePackage:async(t,n,r,o={})=>{Ze("updatePackage","environmentName",t),Ze("updatePackage","packageName",n),Ze("updatePackage","_package",r);const a="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}}}},nl=function(e){const t=bre(e);return{async createPackage(n,r,o,a){const i=await t.createPackage(n,r,o,a),s=e?.serverIndex??0,l=dn["PackagesApi.createPackage"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async deletePackage(n,r,o){const a=await t.deletePackage(n,r,o),i=e?.serverIndex??0,s=dn["PackagesApi.deletePackage"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)},async getPackage(n,r,o,a,i){const s=await t.getPackage(n,r,o,a,i),l=e?.serverIndex??0,d=dn["PackagesApi.getPackage"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async getPackageBuildPlan(n,r,o,a){const i=await t.getPackageBuildPlan(n,r,o,a),s=e?.serverIndex??0,l=dn["PackagesApi.getPackageBuildPlan"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async getPackageClassification(n,r,o,a){const i=await t.getPackageClassification(n,r,o,a),s=e?.serverIndex??0,l=dn["PackagesApi.getPackageClassification"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async getPackageEmbeddingIndex(n,r,o,a){const i=await t.getPackageEmbeddingIndex(n,r,o,a),s=e?.serverIndex??0,l=dn["PackagesApi.getPackageEmbeddingIndex"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async getPackageEntities(n,r,o,a,i){const s=await t.getPackageEntities(n,r,o,a,i),l=e?.serverIndex??0,d=dn["PackagesApi.getPackageEntities"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async getPackageStatus(n,r,o,a){const i=await t.getPackageStatus(n,r,o,a),s=e?.serverIndex??0,l=dn["PackagesApi.getPackageStatus"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async listPackages(n,r){const o=await t.listPackages(n,r),a=e?.serverIndex??0,i=dn["PackagesApi.listPackages"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)},async updatePackage(n,r,o,a){const i=await t.updatePackage(n,r,o,a),s=e?.serverIndex??0,l=dn["PackagesApi.updatePackage"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};let xre=class extends hs{createPackage(t,n,r,o){return nl(this.configuration).createPackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}deletePackage(t,n,r){return nl(this.configuration).deletePackage(t,n,r).then(o=>o(this.axios,this.basePath))}getPackage(t,n,r,o,a){return nl(this.configuration).getPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getPackageBuildPlan(t,n,r,o){return nl(this.configuration).getPackageBuildPlan(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageClassification(t,n,r,o){return nl(this.configuration).getPackageClassification(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageEmbeddingIndex(t,n,r,o){return nl(this.configuration).getPackageEmbeddingIndex(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageEntities(t,n,r,o,a){return nl(this.configuration).getPackageEntities(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getPackageStatus(t,n,r,o){return nl(this.configuration).getPackageStatus(t,n,r,o).then(a=>a(this.axios,this.basePath))}listPackages(t,n){return nl(this.configuration).listPackages(t,n).then(r=>r(this.axios,this.basePath))}updatePackage(t,n,r,o){return nl(this.configuration).updatePackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const wre=function(e){return{deleteTheme:async(t={})=>{const n="/theme",r=new URL(n,fn);let o;e&&(o=e.baseOptions);const a={method:"DELETE",...o,...t},i={},s={};i.Accept="application/json",pn(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:hn(r),options:a}},getStatus:async(t,n={})=>{const r="/status",o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};t!==void 0&&(l.includeLoading=t),s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:hn(o),options:i}},getTheme:async(t={})=>{const n="/theme",r=new URL(n,fn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",pn(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:hn(r),options:a}},updateTheme:async(t,n={})=>{Ze("updateTheme","theme",t);const r="/theme",o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"PUT",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:hn(o),options:i}}}},kb=function(e){const t=wre(e);return{async deleteTheme(n){const r=await t.deleteTheme(n),o=e?.serverIndex??0,a=dn["PublisherApi.deleteTheme"]?.[o]?.url;return(i,s)=>mn(r,_t,ln,e)(i,a||s)},async getStatus(n,r){const o=await t.getStatus(n,r),a=e?.serverIndex??0,i=dn["PublisherApi.getStatus"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)},async getTheme(n){const r=await t.getTheme(n),o=e?.serverIndex??0,a=dn["PublisherApi.getTheme"]?.[o]?.url;return(i,s)=>mn(r,_t,ln,e)(i,a||s)},async updateTheme(n,r){const o=await t.updateTheme(n,r),a=e?.serverIndex??0,i=dn["PublisherApi.updateTheme"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)}}};let Sre=class extends hs{deleteTheme(t){return kb(this.configuration).deleteTheme(t).then(n=>n(this.axios,this.basePath))}getStatus(t,n){return kb(this.configuration).getStatus(t,n).then(r=>r(this.axios,this.basePath))}getTheme(t){return kb(this.configuration).getTheme(t).then(n=>n(this.axios,this.basePath))}updateTheme(t,n){return kb(this.configuration).updateTheme(t,n).then(r=>r(this.axios,this.basePath))}};const Cre=function(e){return{getReport:async(t,n,r,o,a={})=>{Ze("getReport","environmentName",t),Ze("getReport","packageName",n),Ze("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,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},listReports:async(t,n,r,o={})=>{Ze("listReports","environmentName",t),Ze("listReports","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/reports".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}}}},fA=function(e){const t=Cre(e);return{async getReport(n,r,o,a,i){const s=await t.getReport(n,r,o,a,i),l=e?.serverIndex??0,d=dn["ReportsApi.getReport"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async listReports(n,r,o,a){const i=await t.listReports(n,r,o,a),s=e?.serverIndex??0,l=dn["ReportsApi.listReports"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};let kre=class extends hs{getReport(t,n,r,o,a){return fA(this.configuration).getReport(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listReports(t,n,r,o){return fA(this.configuration).listReports(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const $re=function(e){return{deletePackageVersion:async(t,n,r,o={})=>{Ze("deletePackageVersion","environmentName",t),Ze("deletePackageVersion","packageName",n),Ze("deletePackageVersion","versionId",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{versionId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{versionId}",encodeURIComponent(String(r))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"DELETE",...s,...o},d={},u={};d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}},getPackageVersion:async(t,n,r,o={})=>{Ze("getPackageVersion","environmentName",t),Ze("getPackageVersion","packageName",n),Ze("getPackageVersion","versionId",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{versionId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{versionId}",encodeURIComponent(String(r))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}},listPackageVersions:async(t,n,r={})=>{Ze("listPackageVersions","environmentName",t),Ze("listPackageVersions","packageName",n);const o="/environments/{environmentName}/packages/{packageName}/versions".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:hn(a),options:s}},setPackageLatestVersion:async(t,n,r,o={})=>{Ze("setPackageLatestVersion","environmentName",t),Ze("setPackageLatestVersion","packageName",n),Ze("setPackageLatestVersion","packageLatestVersion",r);const a="/environments/{environmentName}/packages/{packageName}/latest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"PUT",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}},setPackageVersionManifest:async(t,n,r,o,a={})=>{Ze("setPackageVersionManifest","environmentName",t),Ze("setPackageVersionManifest","packageName",n),Ze("setPackageVersionManifest","versionId",r),Ze("setPackageVersionManifest","packageVersionManifest",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{versionId}/manifest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{versionId}",encodeURIComponent(String(r))),s=new URL(i,fn);let l;e&&(l=e.baseOptions);const d={method:"PUT",...l,...a},u={},m={};u["Content-Type"]="application/json",u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},d.data=Mo(o,d,e),{url:hn(s),options:d}},updatePackageVersion:async(t,n,r,o,a={})=>{Ze("updatePackageVersion","environmentName",t),Ze("updatePackageVersion","packageName",n),Ze("updatePackageVersion","versionId",r),Ze("updatePackageVersion","packageVersionUpdate",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{versionId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{versionId}",encodeURIComponent(String(r))),s=new URL(i,fn);let l;e&&(l=e.baseOptions);const d={method:"PATCH",...l,...a},u={},m={};u["Content-Type"]="application/json",u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},d.data=Mo(o,d,e),{url:hn(s),options:d}}}},rp=function(e){const t=$re(e);return{async deletePackageVersion(n,r,o,a){const i=await t.deletePackageVersion(n,r,o,a),s=e?.serverIndex??0,l=dn["VersionsApi.deletePackageVersion"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async getPackageVersion(n,r,o,a){const i=await t.getPackageVersion(n,r,o,a),s=e?.serverIndex??0,l=dn["VersionsApi.getPackageVersion"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async listPackageVersions(n,r,o){const a=await t.listPackageVersions(n,r,o),i=e?.serverIndex??0,s=dn["VersionsApi.listPackageVersions"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)},async setPackageLatestVersion(n,r,o,a){const i=await t.setPackageLatestVersion(n,r,o,a),s=e?.serverIndex??0,l=dn["VersionsApi.setPackageLatestVersion"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async setPackageVersionManifest(n,r,o,a,i){const s=await t.setPackageVersionManifest(n,r,o,a,i),l=e?.serverIndex??0,d=dn["VersionsApi.setPackageVersionManifest"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async updatePackageVersion(n,r,o,a,i){const s=await t.updatePackageVersion(n,r,o,a,i),l=e?.serverIndex??0,d=dn["VersionsApi.updatePackageVersion"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)}}};let Ere=class extends hs{deletePackageVersion(t,n,r,o){return rp(this.configuration).deletePackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageVersion(t,n,r,o){return rp(this.configuration).getPackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}listPackageVersions(t,n,r){return rp(this.configuration).listPackageVersions(t,n,r).then(o=>o(this.axios,this.basePath))}setPackageLatestVersion(t,n,r,o){return rp(this.configuration).setPackageLatestVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}setPackageVersionManifest(t,n,r,o,a){return rp(this.configuration).setPackageVersionManifest(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updatePackageVersion(t,n,r,o,a){return rp(this.configuration).updatePackageVersion(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}};const Rre=function(e){return{getWatchStatus:async(t={})=>{const n="/watch-mode/status",r=new URL(n,fn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",pn(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:hn(r),options:a}},startWatching:async(t,n={})=>{Ze("startWatching","startWatchRequest",t);const r="/watch-mode/start",o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:hn(o),options:i}},stopWatching:async(t={})=>{const n="/watch-mode/stop",r=new URL(n,fn);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...t},i={},s={};i.Accept="application/json",pn(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:hn(r),options:a}},streamPackageEvents:async(t,n,r,o={})=>{Ze("streamPackageEvents","environmentName",t),Ze("streamPackageEvents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/events".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="text/event-stream,application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}}}},$b=function(e){const t=Rre(e);return{async getWatchStatus(n){const r=await t.getWatchStatus(n),o=e?.serverIndex??0,a=dn["WatchModeApi.getWatchStatus"]?.[o]?.url;return(i,s)=>mn(r,_t,ln,e)(i,a||s)},async startWatching(n,r){const o=await t.startWatching(n,r),a=e?.serverIndex??0,i=dn["WatchModeApi.startWatching"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)},async stopWatching(n){const r=await t.stopWatching(n),o=e?.serverIndex??0,a=dn["WatchModeApi.stopWatching"]?.[o]?.url;return(i,s)=>mn(r,_t,ln,e)(i,a||s)},async streamPackageEvents(n,r,o,a){const i=await t.streamPackageEvents(n,r,o,a),s=e?.serverIndex??0,l=dn["WatchModeApi.streamPackageEvents"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};let Tre=class extends hs{getWatchStatus(t){return $b(this.configuration).getWatchStatus(t).then(n=>n(this.axios,this.basePath))}startWatching(t,n){return $b(this.configuration).startWatching(t,n).then(r=>r(this.axios,this.basePath))}stopWatching(t){return $b(this.configuration).stopWatching(t).then(n=>n(this.axios,this.basePath))}streamPackageEvents(t,n,r,o){return $b(this.configuration).streamPackageEvents(t,n,r,o).then(a=>a(this.axios,this.basePath))}},Mre=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 dy=new Eee({defaultOptions:{queries:{retry:!1,throwOnError:!1,refetchOnWindowFocus:!1},mutations:{retry:!1,throwOnError:!1}}}),S4={staleTime:300*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!1};function Ore(e,t){return t||e?.modelPage==="viewer"?"viewer":"explorer"}function Pre(e){return{modelPage:Ore(e.data,e.isError&&e.data===void 0),isLoadingStatus:e.isPending}}const Lk="publisher:themeMode";function jre(){if(!(typeof window>"u"))try{const e=window.localStorage.getItem(Lk);if(e==="light"||e==="dark"||e==="auto")return e}catch{}}function Are(e){if(!(typeof window>"u"))try{e===void 0?window.localStorage.removeItem(Lk):window.localStorage.setItem(Lk,e)}catch{}}function Dre(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}_t.defaults.baseURL||(_t.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet");const C4=C.createContext(void 0),Nre=(e,t,n)=>{const r=`${window.location.protocol}//${window.location.host}/api/v0`,o=_t.create({baseURL:e||r,withCredentials:!0,timeout:6e5,...n?{adapter:n}:{}});o.interceptors.request.use(async i=>{const s=await t?.();return i.headers.Authorization=s||"",i});const a=new Mre({basePath:r});return{models:new vre(a,r,o),publisher:new Sre(a,r,o),environments:new pre(a,r,o),packages:new xre(a,r,o),agents:new rre(a,r,o),dataApps:new lre(a,r,o),reports:new kre(a,r,o),connections:new are(a,r,o),databases:new dre(a,r,o),materializations:new mre(a,r,o),watchMode:new Tre(a,r,o),versions:new Ere(a,r,o)}},Ire=e=>p.jsx(Ree,{client:dy,children:p.jsx(Lre,{...e})}),Lre=({children:e,getAccessToken:t,baseURL:n,mutable:r,theme:o,ui:a,adapter:i,mode:s})=>{const l=C.useMemo(()=>Nre(n,t,i),[n,t,i]),d=n||`${window.location.protocol}//${window.location.host}/api/v0`,u=Ld({queryKey:["status",d],retry:3,queryFn:async()=>(await l.publisher.getStatus()).data});u.error&&console.error("Failed to fetch publisher status:",u.error);const m=u.data?.frozenConfig,g=u.data?.theme,{modelPage:y,isLoadingStatus:x}=Pre(u);let w;u.isLoading||u.error?w=r:m?w=!1:w=r??!0;const S=C.useMemo(()=>[g,o],[g,o]),[b,$]=C.useState(jre),[k,R]=C.useState(Dre);C.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const L=window.matchMedia("(prefers-color-scheme: dark)"),_=E=>R(E.matches);return L.addEventListener("change",_),()=>L.removeEventListener("change",_)},[]);const O=C.useCallback(L=>{$(L),Are(L)},[]),P=g?.allowUserToggle??!0,D=P?b:void 0,A=C.useMemo(()=>s??Zne(g?.defaultMode,D,k),[s,g?.defaultMode,D,k]),F={server:d,getAccessToken:t,apiClients:l,mutable:w,isLoadingStatus:x,instanceTheme:g,modelPage:y};return p.jsx(C4.Provider,{value:F,children:p.jsx(Jne,{layers:S,mode:A,userChoice:D,setMode:O,allowUserToggle:P&&s===void 0,...a?{ui:a}:{},children:e})})},er=()=>{const e=C.useContext(C4);if(e===void 0)throw new Error("useServer must be used within a ServerProvider");return e};function gd(){return gd=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},gd.apply(this,arguments)}const zre=["children","options"],pA=["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"}),hA={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},Fre=["style","script","pre"],_re=["src","href","data","formAction","srcDoc","action"],Bre=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,Ure=/mailto:/i,Vre=/\n{2,}$/,mA=/^(\s*>[\s\S]*?)(?=\n\n|$)/,qre=/^ *> ?/gm,Hre=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Wre=/^ {2,}\n/,Yre=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,gA=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,yA=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,Gre=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,Kre=/^(?:\n *)*\n/,Qre=/\r\n?/g,Xre=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,Zre=/^\[\^([^\]]+)]/,Jre=/\f/g,eoe=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,toe=/^\s*?\[(x|\s)\]/,vA=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,bA=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,xA=/^([^\n]+)\n *(=|-){3,} *\n/,JS=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,noe=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,wA=/^<!--[\s\S]*?(?:-->)/,roe=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,eC=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,ooe=/^\{.*\}$/,aoe=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,ioe=/^<([^ >]+@[^ >]+)>/,soe=/^<([^ >]+:\/[^ >]+)>/,loe=/-([a-z])?/gi,SA=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,coe=/^[^\n]+(?: \n|\n{2,})/,uoe=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,doe=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,foe=/^\[([^\]]*)\] ?\[([^\]]*)\]/,poe=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,hoe=/\t/g,moe=/(^ *\||\| *$)/g,goe=/^ *:-+: *$/,yoe=/^ *:-+ *$/,voe=/^ *-+: *$/,Kx=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,Qx="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",boe=RegExp(`^([*_])\\1${Kx(1)}${Qx}\\1\\1(?!\\1)`),xoe=RegExp(`^([*_])${Kx(0)}${Qx}\\1(?!\\1)`),woe=RegExp(`^(==)${Kx(0)}${Qx}\\1`),Soe=RegExp(`^(~~)${Kx(0)}${Qx}\\1`),Coe=/^(:[a-zA-Z0-9-_]+:)/,koe=/^\\([^0-9A-Za-z\s])/,$oe=/\\([^0-9A-Za-z\s])/g,Eoe=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,Roe=/^\n+/,Toe=/^([ \t]*)/,Moe=/(?:^|\n)( *)$/,XE="(?:\\d+\\.)",ZE="(?:[*+-])";function k4(e){return"( *)("+(e===1?XE:ZE)+") +"}const $4=k4(1),E4=k4(2);function R4(e){return RegExp("^"+(e===1?$4:E4))}const Ooe=R4(1),Poe=R4(2);function T4(e){return RegExp("^"+(e===1?$4:E4)+"[^\\n]*(?:\\n(?!\\1"+(e===1?XE:ZE)+" )[^\\n]*)*(\\n|$)","gm")}const joe=T4(1),Aoe=T4(2);function M4(e){const t=e===1?XE:ZE;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const O4=M4(1),P4=M4(2);function CA(e,t){const n=t===1,r=n?O4:P4,o=n?joe:Aoe,a=n?Ooe:Poe;return{t:i=>a.test(i),o:Wp(function(i,s){const l=Moe.exec(s.prevCapture);return l&&(s.list||!s.inline&&!s.simple)?r.exec(i=l[1]+i):null}),i:1,u(i,s,l){const d=n?+i[2]:void 0,u=i[0].replace(Vre,`
274
+ `+i)}}catch{}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=_d(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&l0.assertOptions(r,{silentJSONParsing:ha.transitional(ha.boolean),forcedJSONParsing:ha.transitional(ha.boolean),clarifyTimeoutError:ha.transitional(ha.boolean),legacyInterceptorReqResOrdering:ha.transitional(ha.boolean),advertiseZstdAcceptEncoding:ha.transitional(ha.boolean),validateStatusUndefinedResolves:ha.transitional(ha.boolean)},!1),o!=null&&(Ae.isFunction(o)?n.paramsSerializer={serialize:o}:l0.assertOptions(o,{encode:ha.function,serialize:ha.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),l0.assertOptions(n,{baseUrl:ha.spelling("baseURL"),withXsrfToken:ha.spelling("withXSRFToken")},!0),n.method=(Ae.getSafeProp(n,"method")||Ae.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=a&&Ae.merge(a.common,a[n.method]);a&&Ae.forEach(o4.concat("common"),x=>{delete a[x]}),n.headers=xa.concat(i,a);const s=[];let l=!0;this.interceptors.request.forEach(function(w){if(typeof w.runWhen=="function"&&w.runWhen(n)===!1)return;l=l&&w.synchronous;const S=n.transitional||WE;S&&S.legacyInterceptorReqResOrdering?s.unshift(w.fulfilled,w.rejected):s.push(w.fulfilled,w.rejected)});const d=[];this.interceptors.response.forEach(function(w){d.push(w.fulfilled,w.rejected)});let u,m=0,g;if(!l){const x=[XS.bind(this),void 0];for(x.unshift(...s),x.push(...d),g=x.length,u=Promise.resolve(n);m<g;)u=u.then(x[m++],x[m++]);return u}g=s.length;let y=n;for(;m<g;){const x=s[m++],w=s[m++];try{y=x?x(y):y}catch(S){if(!w){u=Promise.reject(S);break}try{const b=w.call(this,S);Ae.isThenable(b)&&(u=Promise.resolve(b).then(()=>XS.call(this,y)))}catch(b){u=Promise.reject(b)}break}}if(!u)try{u=XS.call(this,y)}catch(x){u=Promise.reject(x)}for(m=0,g=d.length;m<g;)u=u.then(d[m++],d[m++]);return u}getUri(t){t=_d(this.defaults,t);const n=l4(t.baseURL,t.url,t.allowAbsoluteUrls,t);return e4(n,t.params,t.paramsSerializer)}};Ae.forEach(["delete","get","head","options"],function(t){Ed.prototype[t]=function(n,r){return this.request(_d(r||{},{method:t,url:n,data:r&&Ae.hasOwnProp(r,"data")?r.data:void 0}))}});Ae.forEach(["post","put","patch","query"],function(t){function n(r){return function(a,i,s){return this.request(_d(s||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}Ed.prototype[t]=n(),t!=="query"&&(Ed.prototype[t+"Form"]=n(!0))});let zne=class p4{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 Hy(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 p4(function(o){t=o}),cancel:t}}};function Fne(e){return function(n){return e.apply(null,n)}}function _ne(e){return Ae.isObject(e)&&e.isAxiosError===!0}const c0={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(c0).forEach(([e,t])=>{c0[t]===void 0&&(c0[t]=e)});function h4(e){const t=new Ed(e),n=zz(Ed.prototype.request,t);return Ae.extend(n,Ed.prototype,t,{allOwnKeys:!0}),Ae.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return h4(_d(e,o))},n}const _t=h4(qy);_t.Axios=Ed;_t.CanceledError=Hy;_t.CancelToken=zne;_t.isCancel=a4;_t.VERSION=GE;_t.toFormData=Yx;_t.AxiosError=Wt;_t.Cancel=_t.CanceledError;_t.all=function(t){return Promise.all(t)};_t.spread=Fne;_t.isAxiosError=_ne;_t.mergeConfig=_d;_t.AxiosHeaders=xa;_t.formToJSON=e=>r4(Ae.isHTMLForm(e)?new FormData(e):e);_t.getAdapter=f4.getAdapter;_t.HttpStatusCode=c0;_t.default=_t;const{Axios:HEe,AxiosError:WEe,CanceledError:YEe,isCancel:GEe,CancelToken:KEe,VERSION:QEe,all:XEe,Cancel:ZEe,isAxiosError:JEe,spread:eRe,toFormData:tRe,AxiosHeaders:nRe,HttpStatusCode:rRe,formToJSON:oRe,getAdapter:aRe,mergeConfig:iRe,create:sRe}=_t,uA="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",vi={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:uA}},font:{mono:uA},shadow:{menu:"0 8px 24px rgba(16, 24, 40, 0.12)"}};function Bne(e){if(!e)return vi;const t={...vi.font,...e.font},n={...vi.type};n.code={...n.code,fontFamily:t.mono};for(const[r,o]of Object.entries(e.type??{}))n[r]={...n[r],...o};return{radius:{...vi.radius,...e.radius},size:{...vi.size,...e.size},type:n,font:t,shadow:{...vi.shadow,...e.shadow}}}const pr={blue:"#2563eb",violet:"#7c3aed",pink:"#be185d",red:"#dc2626",orange:"#c2410c",amber:"#b45309",lime:"#4d7c0f",emerald:"#059669",teal:"#0f766e",cyan:"#0e7490",slate:"#475569"},QE={environment:pr.emerald,package:pr.teal,connection:pr.orange},Fo='"JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", monospace',Une=ct(PK)({display:"flex",flexDirection:"column",height:"100%",boxShadow:"none",border:"none",backgroundColor:"transparent"}),Vne=ct(NK)({display:"flex",flexDirection:"column",padding:"0",flexGrow:1}),m4=ct(BK)({padding:"0"}),g4=ct("div")({backgroundColor:"transparent",paddingTop:"12px",paddingBottom:"2px",borderRadius:"8px",border:"none",boxShadow:"none",marginBottom:"0"}),qne=ct("div")({height:"100%"}),y4=ct("div")({height:"75vh",width:"100%",overflowY:"auto"}),Hne={light:{accent:pr.blue,accentHover:"#1d4ed8",accentContrast:"#ffffff"},dark:{accent:"#60a5fa",accentHover:"#93c5fd",accentContrast:"#0f172a"}},Wne={light:"#ffffff",dark:"#0f172a"},Yne=3,zg=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))},v4=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`,Pk=(e,t,n)=>v4(e.map(r=>r+(t-r)*n)),jk=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},z0=(e,t)=>{const[n,r]=[jk(e),jk(t)].sort((o,a)=>a-o);return(n+.05)/(r+.05)},Gne=[15,23,42];function Ak(e,t,n=Yne){const r=zg(e),o=zg(t);if(!r||!o||z0(r,o)>=n)return e;const a=jk(o)<.5?255:0;for(let i=.05;i<1;i+=.05){const s=zg(Pk(r,a,i));if(s&&z0(s,o)>=n)return v4(s)}return a===255?"#ffffff":"#000000"}function Dk(e,t,n=Wne[t]){const r=Hne[t];if(!e||e.toLowerCase()===pr.blue)return r;if(!zg(e))return t==="light"?{...r,accent:e,accentHover:e}:r;const o=Ak(e,n),a=zg(o),i=t==="dark"?Pk(a,255,.25):Pk(a,0,.2),s=z0(a,[255,255,255]),l=z0(a,Gne);return{accent:o,accentHover:i,accentContrast:s>=l?"#ffffff":"#0f172a"}}const Kne=[pr.blue,pr.orange,pr.emerald,pr.pink,pr.violet,pr.amber,pr.cyan,pr.lime],Qne="Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",Nk={palette:{series:Kne,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:pr.blue,dark:pr.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:Qne,size:12}},Xne=["background","tableHeader","tableHeaderBackground","tableBody","tile","tileTitle","mapColor","border","cardBorder","axis","gridline","chartText","value"];function b4(e,t){const n=Nk.palette??{},r=Nk.font??{family:"sans-serif",size:12};let o=[...n.series??[]],a=!1,i=r.family??"sans-serif",s=r.size??12;const l={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??{}}},d={light:new Set,dark:new Set};for(const x of e)if(x){Array.isArray(x.palette?.series)&&(o=[...x.palette.series],a=!0);for(const w of Xne){const S=x.palette?.[w];S&&(l[w]={...l[w],...S},S.light!==void 0&&d.light.add(w),S.dark!==void 0&&d.dark.add(w))}typeof x.font?.family=="string"&&(i=x.font.family),typeof x.font?.size=="number"&&(s=x.font.size)}const u=t==="dark",m=x=>l[x][t]??n[x]?.[t],g=m("background"),y=u&&d.light.has("mapColor")&&!d.dark.has("mapColor")?Ak(l.mapColor.light,g):m("mapColor");return{mode:t,ui:vi,series:u&&a?o.map(x=>Ak(x,g)):o,...Dk(o[0],t,g),font:{family:i,size:s},background:g,tableHeader:m("tableHeader"),tableHeaderBackground:m("tableHeaderBackground"),tableBody:m("tableBody"),tile:m("tile"),tileTitle:m("tileTitle"),mapColor:y,tableBackground:g,border:`1px solid ${m("border")}`,cardBorder:`1px solid ${m("cardBorder")}`,pinnedBorder:`1px solid ${m("cardBorder")}`,valueColor:m("value"),foreground:m("chartText"),axisFaint:m("axis"),gridline:m("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:Dk(void 0,t).accent}}function lRe(e,t){const n=t.palette?.series;if(!Array.isArray(n)||n.length!==1)return t;const r=n[0],o=e.reduce((d,u)=>Array.isArray(u?.palette?.series)?u.palette.series:d,Nk.palette?.series??[]),a=d=>d.toLowerCase()===r.toLowerCase(),[i,...s]=o,l=s.length>0?s.map(d=>a(d)?i:d):[i].filter(d=>d!==void 0&&!a(d));return{...t,palette:{...t.palette,series:[r,...l]}}}function Zne(e,t,n){const r=t??e??"light";return r==="auto"?n?"dark":"light":r}const x4=C.createContext(void 0);function Jne({layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o=!0,ui:a,children:i}){const s=JSON.stringify(a??null),l=C.useMemo(()=>Bne(a),[s]),d=C.useMemo(()=>({...b4(e,t),ui:l}),[e,t,l]),u=C.useMemo(()=>({theme:d,layers:e,mode:t,userChoice:n,setMode:r,allowUserToggle:o}),[d,e,t,n,r,o]);return p.jsx(x4.Provider,{value:u,children:i})}function Hr(){return C.useContext(x4)||{theme:b4([],"light"),layers:[],mode:"light",userChoice:void 0,setMode:()=>{},allowUserToggle:!1}}const ln="http://localhost/api/v0".replace(/\/+$/,"");let hs=class{constructor(t,n=ln,r=_t){this.basePath=n,this.axios=r,t&&(this.configuration=t,this.basePath=t.basePath??n)}configuration},ere=class extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}};const dn={},fn="https://example.com",Ze=function(e,t,n){if(n==null)throw new ere(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Ik(e,t,n=""){t!=null&&(typeof t=="object"?Array.isArray(t)||t instanceof Set?t.forEach(r=>Ik(e,r,n)):Object.keys(t).forEach(r=>Ik(e,t[r],`${n}${n!==""?".":""}${r}`)):e.has(n)?e.append(n,t):e.set(n,t))}const pn=function(e,...t){const n=new URLSearchParams(e.search);Ik(n,t),e.search=n.toString()},tre=function(e,t){return t instanceof Set?Array.from(t):t},Mo=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:{},tre):e||""},hn=function(e){return e.pathname+e.search+e.hash},mn=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)}},w4={Bigquery:"bigquery",Snowflake:"snowflake",Postgres:"postgres",Gcs:"gcs",S3:"s3",Azure:"azure"},dA={Postgres:"postgres",Bigquery:"bigquery",Snowflake:"snowflake",Trino:"trino",Databricks:"databricks",Mysql:"mysql",Sqlserver:"sqlserver",Duckdb:"duckdb",Motherduck:"motherduck",Ducklake:"ducklake",Publisher:"publisher"},ba={Pending:"PENDING",ManifestRowsReady:"MANIFEST_ROWS_READY",ManifestFileReady:"MANIFEST_FILE_READY",Failed:"FAILED",Cancelled:"CANCELLED"},Cb={Version:"version",Package:"package"},nre=function(e){return{getAgent:async(t,n,r,o,a,i={})=>{Ze("getAgent","environmentName",t),Ze("getAgent","packageName",n),Ze("getAgent","agentName",r);const s="/environments/{environmentName}/packages/{packageName}/agents/{agentName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{agentName}",encodeURIComponent(String(r))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};o!==void 0&&(g.skills=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:hn(l),options:u}},getAgentSkillFile:async(t,n,r,o,a,i={})=>{Ze("getAgentSkillFile","environmentName",t),Ze("getAgentSkillFile","packageName",n),Ze("getAgentSkillFile","agentName",r),Ze("getAgentSkillFile","relativeFilepath",o);const s="/environments/{environmentName}/packages/{packageName}/agents/{agentName}/skills/{relativeFilepath}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{agentName}",encodeURIComponent(String(r))).replace("{relativeFilepath}",encodeURIComponent(String(o))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:hn(l),options:u}},listAgents:async(t,n,r,o={})=>{Ze("listAgents","environmentName",t),Ze("listAgents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/agents".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}}}},ZS=function(e){const t=nre(e);return{async getAgent(n,r,o,a,i,s){const l=await t.getAgent(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["AgentsApi.getAgent"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async getAgentSkillFile(n,r,o,a,i,s){const l=await t.getAgentSkillFile(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["AgentsApi.getAgentSkillFile"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async listAgents(n,r,o,a){const i=await t.listAgents(n,r,o,a),s=e?.serverIndex??0,l=dn["AgentsApi.listAgents"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};let rre=class extends hs{getAgent(t,n,r,o,a,i){return ZS(this.configuration).getAgent(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}getAgentSkillFile(t,n,r,o,a,i){return ZS(this.configuration).getAgentSkillFile(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}listAgents(t,n,r,o){return ZS(this.configuration).listAgents(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const ore=function(e){return{createConnection:async(t,n,r,o={})=>{Ze("createConnection","environmentName",t),Ze("createConnection","connectionName",n),Ze("createConnection","connection",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}},deleteConnection:async(t,n,r={})=>{Ze("deleteConnection","environmentName",t),Ze("deleteConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={},d={};l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:hn(a),options:s}},getConnection:async(t,n,r={})=>{Ze("getConnection","environmentName",t),Ze("getConnection","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:hn(a),options:s}},getTable:async(t,n,r,o,a={})=>{Ze("getTable","environmentName",t),Ze("getTable","connectionName",n),Ze("getTable","schemaName",r),Ze("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,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},getTableInPackage:async(t,n,r,o,a,i,s={})=>{Ze("getTableInPackage","environmentName",t),Ze("getTableInPackage","packageName",n),Ze("getTableInPackage","connectionName",r),Ze("getTableInPackage","schemaName",o),Ze("getTableInPackage","tablePath",a);const l="/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))),d=new URL(l,fn);let u;e&&(u=e.baseOptions);const m={method:"GET",...u,...s},g={},y={};i!==void 0&&(y.versionId=i),g.Accept="application/json",pn(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:hn(d),options:m}},listConnections:async(t,n={})=>{Ze("listConnections","environmentName",t);const r="/environments/{environmentName}/connections".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:hn(o),options:i}},listSchemas:async(t,n,r={})=>{Ze("listSchemas","environmentName",t),Ze("listSchemas","connectionName",n);const o="/environments/{environmentName}/connections/{connectionName}/schemas".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:hn(a),options:s}},listSchemasInPackage:async(t,n,r,o,a={})=>{Ze("listSchemasInPackage","environmentName",t),Ze("listSchemasInPackage","packageName",n),Ze("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,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},listTables:async(t,n,r,o,a={})=>{Ze("listTables","environmentName",t),Ze("listTables","connectionName",n),Ze("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,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o&&(m.tableNames=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},listTablesInPackage:async(t,n,r,o,a,i,s={})=>{Ze("listTablesInPackage","environmentName",t),Ze("listTablesInPackage","packageName",n),Ze("listTablesInPackage","connectionName",r),Ze("listTablesInPackage","schemaName",o);const l="/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))),d=new URL(l,fn);let u;e&&(u=e.baseOptions);const m={method:"GET",...u,...s},g={},y={};a&&(y.tableNames=a),i!==void 0&&(y.versionId=i),g.Accept="application/json",pn(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:hn(d),options:m}},postQuerydata:async(t,n,r,o={})=>{Ze("postQuerydata","environmentName",t),Ze("postQuerydata","connectionName",n),Ze("postQuerydata","postQuerydataRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlQuery".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}},postQuerydataInPackage:async(t,n,r,o,a,i={})=>{Ze("postQuerydataInPackage","environmentName",t),Ze("postQuerydataInPackage","packageName",n),Ze("postQuerydataInPackage","connectionName",r),Ze("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))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:hn(l),options:u}},postSqlsource:async(t,n,r,o={})=>{Ze("postSqlsource","environmentName",t),Ze("postSqlsource","connectionName",n),Ze("postSqlsource","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlSource".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}},postSqlsourceInPackage:async(t,n,r,o,a,i={})=>{Ze("postSqlsourceInPackage","environmentName",t),Ze("postSqlsourceInPackage","packageName",n),Ze("postSqlsourceInPackage","connectionName",r),Ze("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))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:hn(l),options:u}},postTemporarytable:async(t,n,r,o={})=>{Ze("postTemporarytable","environmentName",t),Ze("postTemporarytable","connectionName",n),Ze("postTemporarytable","postSqlsourceRequest",r);const a="/environments/{environmentName}/connections/{connectionName}/sqlTemporaryTable".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}},postTemporarytableInPackage:async(t,n,r,o,a,i={})=>{Ze("postTemporarytableInPackage","environmentName",t),Ze("postTemporarytableInPackage","packageName",n),Ze("postTemporarytableInPackage","connectionName",r),Ze("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))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:hn(l),options:u}},updateConnection:async(t,n,r,o={})=>{Ze("updateConnection","environmentName",t),Ze("updateConnection","connectionName",n),Ze("updateConnection","updateConnectionRequest",r);const a="/environments/{environmentName}/connections/{connectionName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}}}},sa=function(e){const t=ore(e);return{async createConnection(n,r,o,a){const i=await t.createConnection(n,r,o,a),s=e?.serverIndex??0,l=dn["ConnectionsApi.createConnection"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async deleteConnection(n,r,o){const a=await t.deleteConnection(n,r,o),i=e?.serverIndex??0,s=dn["ConnectionsApi.deleteConnection"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)},async getConnection(n,r,o){const a=await t.getConnection(n,r,o),i=e?.serverIndex??0,s=dn["ConnectionsApi.getConnection"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)},async getTable(n,r,o,a,i){const s=await t.getTable(n,r,o,a,i),l=e?.serverIndex??0,d=dn["ConnectionsApi.getTable"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async getTableInPackage(n,r,o,a,i,s,l){const d=await t.getTableInPackage(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=dn["ConnectionsApi.getTableInPackage"]?.[u]?.url;return(g,y)=>mn(d,_t,ln,e)(g,m||y)},async listConnections(n,r){const o=await t.listConnections(n,r),a=e?.serverIndex??0,i=dn["ConnectionsApi.listConnections"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)},async listSchemas(n,r,o){const a=await t.listSchemas(n,r,o),i=e?.serverIndex??0,s=dn["ConnectionsApi.listSchemas"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)},async listSchemasInPackage(n,r,o,a,i){const s=await t.listSchemasInPackage(n,r,o,a,i),l=e?.serverIndex??0,d=dn["ConnectionsApi.listSchemasInPackage"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async listTables(n,r,o,a,i){const s=await t.listTables(n,r,o,a,i),l=e?.serverIndex??0,d=dn["ConnectionsApi.listTables"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async listTablesInPackage(n,r,o,a,i,s,l){const d=await t.listTablesInPackage(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=dn["ConnectionsApi.listTablesInPackage"]?.[u]?.url;return(g,y)=>mn(d,_t,ln,e)(g,m||y)},async postQuerydata(n,r,o,a){const i=await t.postQuerydata(n,r,o,a),s=e?.serverIndex??0,l=dn["ConnectionsApi.postQuerydata"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async postQuerydataInPackage(n,r,o,a,i,s){const l=await t.postQuerydataInPackage(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["ConnectionsApi.postQuerydataInPackage"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async postSqlsource(n,r,o,a){const i=await t.postSqlsource(n,r,o,a),s=e?.serverIndex??0,l=dn["ConnectionsApi.postSqlsource"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async postSqlsourceInPackage(n,r,o,a,i,s){const l=await t.postSqlsourceInPackage(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["ConnectionsApi.postSqlsourceInPackage"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async postTemporarytable(n,r,o,a){const i=await t.postTemporarytable(n,r,o,a),s=e?.serverIndex??0,l=dn["ConnectionsApi.postTemporarytable"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async postTemporarytableInPackage(n,r,o,a,i,s){const l=await t.postTemporarytableInPackage(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["ConnectionsApi.postTemporarytableInPackage"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async updateConnection(n,r,o,a){const i=await t.updateConnection(n,r,o,a),s=e?.serverIndex??0,l=dn["ConnectionsApi.updateConnection"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};let are=class extends hs{createConnection(t,n,r,o){return sa(this.configuration).createConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteConnection(t,n,r){return sa(this.configuration).deleteConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getConnection(t,n,r){return sa(this.configuration).getConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getTable(t,n,r,o,a){return sa(this.configuration).getTable(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getTableInPackage(t,n,r,o,a,i,s){return sa(this.configuration).getTableInPackage(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}listConnections(t,n){return sa(this.configuration).listConnections(t,n).then(r=>r(this.axios,this.basePath))}listSchemas(t,n,r){return sa(this.configuration).listSchemas(t,n,r).then(o=>o(this.axios,this.basePath))}listSchemasInPackage(t,n,r,o,a){return sa(this.configuration).listSchemasInPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listTables(t,n,r,o,a){return sa(this.configuration).listTables(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listTablesInPackage(t,n,r,o,a,i,s){return sa(this.configuration).listTablesInPackage(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}postQuerydata(t,n,r,o){return sa(this.configuration).postQuerydata(t,n,r,o).then(a=>a(this.axios,this.basePath))}postQuerydataInPackage(t,n,r,o,a,i){return sa(this.configuration).postQuerydataInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}postSqlsource(t,n,r,o){return sa(this.configuration).postSqlsource(t,n,r,o).then(a=>a(this.axios,this.basePath))}postSqlsourceInPackage(t,n,r,o,a,i){return sa(this.configuration).postSqlsourceInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}postTemporarytable(t,n,r,o){return sa(this.configuration).postTemporarytable(t,n,r,o).then(a=>a(this.axios,this.basePath))}postTemporarytableInPackage(t,n,r,o,a,i){return sa(this.configuration).postTemporarytableInPackage(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}updateConnection(t,n,r,o){return sa(this.configuration).updateConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const ire=function(e){return{listDataApps:async(t,n,r,o={})=>{Ze("listDataApps","environmentName",t),Ze("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,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}}}},sre=function(e){const t=ire(e);return{async listDataApps(n,r,o,a){const i=await t.listDataApps(n,r,o,a),s=e?.serverIndex??0,l=dn["DataAppsApi.listDataApps"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};class lre extends hs{listDataApps(t,n,r,o){return sre(this.configuration).listDataApps(t,n,r,o).then(a=>a(this.axios,this.basePath))}}const cre=function(e){return{listDatabases:async(t,n,r,o={})=>{Ze("listDatabases","environmentName",t),Ze("listDatabases","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/databases".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}}}},ure=function(e){const t=cre(e);return{async listDatabases(n,r,o,a){const i=await t.listDatabases(n,r,o,a),s=e?.serverIndex??0,l=dn["DatabasesApi.listDatabases"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};let dre=class extends hs{listDatabases(t,n,r,o){return ure(this.configuration).listDatabases(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const fre=function(e){return{createEnvironment:async(t,n={})=>{Ze("createEnvironment","environment",t);const r="/environments",o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:hn(o),options:i}},deleteEnvironment:async(t,n={})=>{Ze("deleteEnvironment","environmentName",t);const r="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"DELETE",...a,...n},s={},l={};s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:hn(o),options:i}},getEnvironment:async(t,n,r={})=>{Ze("getEnvironment","environmentName",t);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};n!==void 0&&(d.reload=n),l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:hn(a),options:s}},listEnvironments:async(t={})=>{const n="/environments",r=new URL(n,fn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",pn(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:hn(r),options:a}},updateEnvironment:async(t,n,r={})=>{Ze("updateEnvironment","environmentName",t),Ze("updateEnvironment","environment",n);const o="/environments/{environmentName}".replace("{environmentName}",encodeURIComponent(String(t))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"PATCH",...i,...r},l={},d={};l["Content-Type"]="application/json",l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},s.data=Mo(n,s,e),{url:hn(a),options:s}}}},Bm=function(e){const t=fre(e);return{async createEnvironment(n,r){const o=await t.createEnvironment(n,r),a=e?.serverIndex??0,i=dn["EnvironmentsApi.createEnvironment"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)},async deleteEnvironment(n,r){const o=await t.deleteEnvironment(n,r),a=e?.serverIndex??0,i=dn["EnvironmentsApi.deleteEnvironment"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)},async getEnvironment(n,r,o){const a=await t.getEnvironment(n,r,o),i=e?.serverIndex??0,s=dn["EnvironmentsApi.getEnvironment"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)},async listEnvironments(n){const r=await t.listEnvironments(n),o=e?.serverIndex??0,a=dn["EnvironmentsApi.listEnvironments"]?.[o]?.url;return(i,s)=>mn(r,_t,ln,e)(i,a||s)},async updateEnvironment(n,r,o){const a=await t.updateEnvironment(n,r,o),i=e?.serverIndex??0,s=dn["EnvironmentsApi.updateEnvironment"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)}}};let pre=class extends hs{createEnvironment(t,n){return Bm(this.configuration).createEnvironment(t,n).then(r=>r(this.axios,this.basePath))}deleteEnvironment(t,n){return Bm(this.configuration).deleteEnvironment(t,n).then(r=>r(this.axios,this.basePath))}getEnvironment(t,n,r){return Bm(this.configuration).getEnvironment(t,n,r).then(o=>o(this.axios,this.basePath))}listEnvironments(t){return Bm(this.configuration).listEnvironments(t).then(n=>n(this.axios,this.basePath))}updateEnvironment(t,n,r){return Bm(this.configuration).updateEnvironment(t,n,r).then(o=>o(this.axios,this.basePath))}};const hre=function(e){return{createMaterialization:async(t,n,r,o={})=>{Ze("createMaterialization","environmentName",t),Ze("createMaterialization","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}},deleteMaterialization:async(t,n,r,o,a={})=>{Ze("deleteMaterialization","environmentName",t),Ze("deleteMaterialization","packageName",n),Ze("deleteMaterialization","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,fn);let l;e&&(l=e.baseOptions);const d={method:"DELETE",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},dropMaterializedTable:async(t,n,r,o,a,i,s={})=>{Ze("dropMaterializedTable","environmentName",t),Ze("dropMaterializedTable","packageName",n),Ze("dropMaterializedTable","connectionName",r),Ze("dropMaterializedTable","tableName",o);const l="/environments/{environmentName}/packages/{packageName}/connections/{connectionName}/materializedTables/{tableName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{connectionName}",encodeURIComponent(String(r))).replace("{tableName}",encodeURIComponent(String(o))),d=new URL(l,fn);let u;e&&(u=e.baseOptions);const m={method:"DELETE",...u,...s},g={},y={};a!==void 0&&(y.materializationId=a),i!==void 0&&(y.versionId=i),g.Accept="application/json",pn(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:hn(d),options:m}},getMaterialization:async(t,n,r,o,a={})=>{Ze("getMaterialization","environmentName",t),Ze("getMaterialization","packageName",n),Ze("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,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},listMaterializations:async(t,n,r,o,a,i={})=>{Ze("listMaterializations","environmentName",t),Ze("listMaterializations","packageName",n);const s="/environments/{environmentName}/packages/{packageName}/materializations".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"GET",...d,...i},m={},g={};r!==void 0&&(g.limit=r),o!==void 0&&(g.offset=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:hn(l),options:u}},materializationAction:async(t,n,r,o,a,i={})=>{Ze("materializationAction","environmentName",t),Ze("materializationAction","packageName",n),Ze("materializationAction","materializationId",r),Ze("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))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};o!==void 0&&(g.action=o),a!==void 0&&(g.versionId=a),m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},{url:hn(l),options:u}}}},np=function(e){const t=hre(e);return{async createMaterialization(n,r,o,a){const i=await t.createMaterialization(n,r,o,a),s=e?.serverIndex??0,l=dn["MaterializationsApi.createMaterialization"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async deleteMaterialization(n,r,o,a,i){const s=await t.deleteMaterialization(n,r,o,a,i),l=e?.serverIndex??0,d=dn["MaterializationsApi.deleteMaterialization"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async dropMaterializedTable(n,r,o,a,i,s,l){const d=await t.dropMaterializedTable(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=dn["MaterializationsApi.dropMaterializedTable"]?.[u]?.url;return(g,y)=>mn(d,_t,ln,e)(g,m||y)},async getMaterialization(n,r,o,a,i){const s=await t.getMaterialization(n,r,o,a,i),l=e?.serverIndex??0,d=dn["MaterializationsApi.getMaterialization"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async listMaterializations(n,r,o,a,i,s){const l=await t.listMaterializations(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["MaterializationsApi.listMaterializations"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async materializationAction(n,r,o,a,i,s){const l=await t.materializationAction(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["MaterializationsApi.materializationAction"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)}}};let mre=class extends hs{createMaterialization(t,n,r,o){return np(this.configuration).createMaterialization(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteMaterialization(t,n,r,o,a){return np(this.configuration).deleteMaterialization(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}dropMaterializedTable(t,n,r,o,a,i,s){return np(this.configuration).dropMaterializedTable(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}getMaterialization(t,n,r,o,a){return np(this.configuration).getMaterialization(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listMaterializations(t,n,r,o,a,i){return np(this.configuration).listMaterializations(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}materializationAction(t,n,r,o,a,i){return np(this.configuration).materializationAction(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const gre={Stop:"stop"},yre=function(e){return{compileModelSource:async(t,n,r,o,a,i={})=>{Ze("compileModelSource","environmentName",t),Ze("compileModelSource","packageName",n),Ze("compileModelSource","path",r),Ze("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))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"POST",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:hn(l),options:u}},executeQueryModel:async(t,n,r,o,a,i,s={})=>{Ze("executeQueryModel","environmentName",t),Ze("executeQueryModel","packageName",n),Ze("executeQueryModel","path",r),Ze("executeQueryModel","queryRequest",o);const l="/environments/{environmentName}/packages/{packageName}/models/{path}/query".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),d=new URL(l,fn);let u;e&&(u=e.baseOptions);const m={method:"POST",...u,...s},g={},y={};a!==void 0&&(y.includeHiddenFilesAndSources=a),i!==void 0&&(y.versionId=i),g["Content-Type"]="application/json",g.Accept="application/json",pn(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},m.data=Mo(o,m,e),{url:hn(d),options:m}},getModel:async(t,n,r,o,a,i,s={})=>{Ze("getModel","environmentName",t),Ze("getModel","packageName",n),Ze("getModel","path",r);const l="/environments/{environmentName}/packages/{packageName}/models/{path}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),d=new URL(l,fn);let u;e&&(u=e.baseOptions);const m={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",pn(d,y);let x=u&&u.headers?u.headers:{};return m.headers={...g,...x,...s.headers},{url:hn(d),options:m}},listModels:async(t,n,r,o,a={})=>{Ze("listModels","environmentName",t),Ze("listModels","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/models".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};r!==void 0&&(m.versionId=r),o!==void 0&&(m.includeHiddenFilesAndSources=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},updateModelSource:async(t,n,r,o,a,i={})=>{Ze("updateModelSource","environmentName",t),Ze("updateModelSource","packageName",n),Ze("updateModelSource","path",r),Ze("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))),l=new URL(s,fn);let d;e&&(d=e.baseOptions);const u={method:"PUT",...d,...i},m={},g={};a!==void 0&&(g.versionId=a),m["Content-Type"]="application/json",m.Accept="application/json",pn(l,g);let y=d&&d.headers?d.headers:{};return u.headers={...m,...y,...i.headers},u.data=Mo(o,u,e),{url:hn(l),options:u}}}},Um=function(e){const t=yre(e);return{async compileModelSource(n,r,o,a,i,s){const l=await t.compileModelSource(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["ModelsApi.compileModelSource"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)},async executeQueryModel(n,r,o,a,i,s,l){const d=await t.executeQueryModel(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=dn["ModelsApi.executeQueryModel"]?.[u]?.url;return(g,y)=>mn(d,_t,ln,e)(g,m||y)},async getModel(n,r,o,a,i,s,l){const d=await t.getModel(n,r,o,a,i,s,l),u=e?.serverIndex??0,m=dn["ModelsApi.getModel"]?.[u]?.url;return(g,y)=>mn(d,_t,ln,e)(g,m||y)},async listModels(n,r,o,a,i){const s=await t.listModels(n,r,o,a,i),l=e?.serverIndex??0,d=dn["ModelsApi.listModels"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async updateModelSource(n,r,o,a,i,s){const l=await t.updateModelSource(n,r,o,a,i,s),d=e?.serverIndex??0,u=dn["ModelsApi.updateModelSource"]?.[d]?.url;return(m,g)=>mn(l,_t,ln,e)(m,u||g)}}};let vre=class extends hs{compileModelSource(t,n,r,o,a,i){return Um(this.configuration).compileModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}executeQueryModel(t,n,r,o,a,i,s){return Um(this.configuration).executeQueryModel(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}getModel(t,n,r,o,a,i,s){return Um(this.configuration).getModel(t,n,r,o,a,i,s).then(l=>l(this.axios,this.basePath))}listModels(t,n,r,o,a){return Um(this.configuration).listModels(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updateModelSource(t,n,r,o,a,i){return Um(this.configuration).updateModelSource(t,n,r,o,a,i).then(s=>s(this.axios,this.basePath))}};const bre=function(e){return{createPackage:async(t,n,r,o={})=>{Ze("createPackage","environmentName",t),Ze("createPackage","_package",n);const a="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"POST",...s,...o},d={},u={};r!==void 0&&(u.dryRun=r),d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(n,l,e),{url:hn(i),options:l}},deletePackage:async(t,n,r={})=>{Ze("deletePackage","environmentName",t),Ze("deletePackage","packageName",n);const o="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"DELETE",...i,...r},l={},d={};l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:hn(a),options:s}},getPackage:async(t,n,r,o,a={})=>{Ze("getPackage","environmentName",t),Ze("getPackage","packageName",n);const i="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};r!==void 0&&(m.versionId=r),o!==void 0&&(m.reload=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},getPackageBuildPlan:async(t,n,r,o={})=>{Ze("getPackageBuildPlan","environmentName",t),Ze("getPackageBuildPlan","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/build-plan".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}},getPackageClassification:async(t,n,r,o={})=>{Ze("getPackageClassification","environmentName",t),Ze("getPackageClassification","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/classification".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}},getPackageEmbeddingIndex:async(t,n,r,o={})=>{Ze("getPackageEmbeddingIndex","environmentName",t),Ze("getPackageEmbeddingIndex","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/embedding-index".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}},getPackageEntities:async(t,n,r,o,a={})=>{Ze("getPackageEntities","environmentName",t),Ze("getPackageEntities","packageName",n);const i="/environments/{environmentName}/packages/{packageName}/entities".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),s=new URL(i,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};r!==void 0&&(m.versionId=r),o!==void 0&&(m.includeHiddenFilesAndSources=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},getPackageStatus:async(t,n,r,o={})=>{Ze("getPackageStatus","environmentName",t),Ze("getPackageStatus","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/status".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}},listPackages:async(t,n={})=>{Ze("listPackages","environmentName",t);const r="/environments/{environmentName}/packages".replace("{environmentName}",encodeURIComponent(String(t))),o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:hn(o),options:i}},updatePackage:async(t,n,r,o={})=>{Ze("updatePackage","environmentName",t),Ze("updatePackage","packageName",n),Ze("updatePackage","_package",r);const a="/environments/{environmentName}/packages/{packageName}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"PATCH",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}}}},nl=function(e){const t=bre(e);return{async createPackage(n,r,o,a){const i=await t.createPackage(n,r,o,a),s=e?.serverIndex??0,l=dn["PackagesApi.createPackage"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async deletePackage(n,r,o){const a=await t.deletePackage(n,r,o),i=e?.serverIndex??0,s=dn["PackagesApi.deletePackage"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)},async getPackage(n,r,o,a,i){const s=await t.getPackage(n,r,o,a,i),l=e?.serverIndex??0,d=dn["PackagesApi.getPackage"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async getPackageBuildPlan(n,r,o,a){const i=await t.getPackageBuildPlan(n,r,o,a),s=e?.serverIndex??0,l=dn["PackagesApi.getPackageBuildPlan"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async getPackageClassification(n,r,o,a){const i=await t.getPackageClassification(n,r,o,a),s=e?.serverIndex??0,l=dn["PackagesApi.getPackageClassification"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async getPackageEmbeddingIndex(n,r,o,a){const i=await t.getPackageEmbeddingIndex(n,r,o,a),s=e?.serverIndex??0,l=dn["PackagesApi.getPackageEmbeddingIndex"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async getPackageEntities(n,r,o,a,i){const s=await t.getPackageEntities(n,r,o,a,i),l=e?.serverIndex??0,d=dn["PackagesApi.getPackageEntities"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async getPackageStatus(n,r,o,a){const i=await t.getPackageStatus(n,r,o,a),s=e?.serverIndex??0,l=dn["PackagesApi.getPackageStatus"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async listPackages(n,r){const o=await t.listPackages(n,r),a=e?.serverIndex??0,i=dn["PackagesApi.listPackages"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)},async updatePackage(n,r,o,a){const i=await t.updatePackage(n,r,o,a),s=e?.serverIndex??0,l=dn["PackagesApi.updatePackage"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};let xre=class extends hs{createPackage(t,n,r,o){return nl(this.configuration).createPackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}deletePackage(t,n,r){return nl(this.configuration).deletePackage(t,n,r).then(o=>o(this.axios,this.basePath))}getPackage(t,n,r,o,a){return nl(this.configuration).getPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getPackageBuildPlan(t,n,r,o){return nl(this.configuration).getPackageBuildPlan(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageClassification(t,n,r,o){return nl(this.configuration).getPackageClassification(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageEmbeddingIndex(t,n,r,o){return nl(this.configuration).getPackageEmbeddingIndex(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageEntities(t,n,r,o,a){return nl(this.configuration).getPackageEntities(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getPackageStatus(t,n,r,o){return nl(this.configuration).getPackageStatus(t,n,r,o).then(a=>a(this.axios,this.basePath))}listPackages(t,n){return nl(this.configuration).listPackages(t,n).then(r=>r(this.axios,this.basePath))}updatePackage(t,n,r,o){return nl(this.configuration).updatePackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const wre=function(e){return{deleteTheme:async(t={})=>{const n="/theme",r=new URL(n,fn);let o;e&&(o=e.baseOptions);const a={method:"DELETE",...o,...t},i={},s={};i.Accept="application/json",pn(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:hn(r),options:a}},getStatus:async(t,n={})=>{const r="/status",o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},s={},l={};t!==void 0&&(l.includeLoading=t),s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},{url:hn(o),options:i}},getTheme:async(t={})=>{const n="/theme",r=new URL(n,fn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",pn(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:hn(r),options:a}},updateTheme:async(t,n={})=>{Ze("updateTheme","theme",t);const r="/theme",o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"PUT",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:hn(o),options:i}}}},kb=function(e){const t=wre(e);return{async deleteTheme(n){const r=await t.deleteTheme(n),o=e?.serverIndex??0,a=dn["PublisherApi.deleteTheme"]?.[o]?.url;return(i,s)=>mn(r,_t,ln,e)(i,a||s)},async getStatus(n,r){const o=await t.getStatus(n,r),a=e?.serverIndex??0,i=dn["PublisherApi.getStatus"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)},async getTheme(n){const r=await t.getTheme(n),o=e?.serverIndex??0,a=dn["PublisherApi.getTheme"]?.[o]?.url;return(i,s)=>mn(r,_t,ln,e)(i,a||s)},async updateTheme(n,r){const o=await t.updateTheme(n,r),a=e?.serverIndex??0,i=dn["PublisherApi.updateTheme"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)}}};let Sre=class extends hs{deleteTheme(t){return kb(this.configuration).deleteTheme(t).then(n=>n(this.axios,this.basePath))}getStatus(t,n){return kb(this.configuration).getStatus(t,n).then(r=>r(this.axios,this.basePath))}getTheme(t){return kb(this.configuration).getTheme(t).then(n=>n(this.axios,this.basePath))}updateTheme(t,n){return kb(this.configuration).updateTheme(t,n).then(r=>r(this.axios,this.basePath))}};const Cre=function(e){return{getReport:async(t,n,r,o,a={})=>{Ze("getReport","environmentName",t),Ze("getReport","packageName",n),Ze("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,fn);let l;e&&(l=e.baseOptions);const d={method:"GET",...l,...a},u={},m={};o!==void 0&&(m.versionId=o),u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},{url:hn(s),options:d}},listReports:async(t,n,r,o={})=>{Ze("listReports","environmentName",t),Ze("listReports","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/reports".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}}}},fA=function(e){const t=Cre(e);return{async getReport(n,r,o,a,i){const s=await t.getReport(n,r,o,a,i),l=e?.serverIndex??0,d=dn["ReportsApi.getReport"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async listReports(n,r,o,a){const i=await t.listReports(n,r,o,a),s=e?.serverIndex??0,l=dn["ReportsApi.listReports"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};let kre=class extends hs{getReport(t,n,r,o,a){return fA(this.configuration).getReport(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listReports(t,n,r,o){return fA(this.configuration).listReports(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const $re=function(e){return{deletePackageVersion:async(t,n,r,o={})=>{Ze("deletePackageVersion","environmentName",t),Ze("deletePackageVersion","packageName",n),Ze("deletePackageVersion","versionId",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{versionId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{versionId}",encodeURIComponent(String(r))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"DELETE",...s,...o},d={},u={};d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}},getPackageVersion:async(t,n,r,o={})=>{Ze("getPackageVersion","environmentName",t),Ze("getPackageVersion","packageName",n),Ze("getPackageVersion","versionId",r);const a="/environments/{environmentName}/packages/{packageName}/versions/{versionId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{versionId}",encodeURIComponent(String(r))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}},listPackageVersions:async(t,n,r={})=>{Ze("listPackageVersions","environmentName",t),Ze("listPackageVersions","packageName",n);const o="/environments/{environmentName}/packages/{packageName}/versions".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,fn);let i;e&&(i=e.baseOptions);const s={method:"GET",...i,...r},l={},d={};l.Accept="application/json",pn(a,d);let u=i&&i.headers?i.headers:{};return s.headers={...l,...u,...r.headers},{url:hn(a),options:s}},setPackageLatestVersion:async(t,n,r,o={})=>{Ze("setPackageLatestVersion","environmentName",t),Ze("setPackageLatestVersion","packageName",n),Ze("setPackageLatestVersion","packageLatestVersion",r);const a="/environments/{environmentName}/packages/{packageName}/latest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"PUT",...s,...o},d={},u={};d["Content-Type"]="application/json",d.Accept="application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},l.data=Mo(r,l,e),{url:hn(i),options:l}},setPackageVersionManifest:async(t,n,r,o,a={})=>{Ze("setPackageVersionManifest","environmentName",t),Ze("setPackageVersionManifest","packageName",n),Ze("setPackageVersionManifest","versionId",r),Ze("setPackageVersionManifest","packageVersionManifest",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{versionId}/manifest".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{versionId}",encodeURIComponent(String(r))),s=new URL(i,fn);let l;e&&(l=e.baseOptions);const d={method:"PUT",...l,...a},u={},m={};u["Content-Type"]="application/json",u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},d.data=Mo(o,d,e),{url:hn(s),options:d}},updatePackageVersion:async(t,n,r,o,a={})=>{Ze("updatePackageVersion","environmentName",t),Ze("updatePackageVersion","packageName",n),Ze("updatePackageVersion","versionId",r),Ze("updatePackageVersion","packageVersionUpdate",o);const i="/environments/{environmentName}/packages/{packageName}/versions/{versionId}".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{versionId}",encodeURIComponent(String(r))),s=new URL(i,fn);let l;e&&(l=e.baseOptions);const d={method:"PATCH",...l,...a},u={},m={};u["Content-Type"]="application/json",u.Accept="application/json",pn(s,m);let g=l&&l.headers?l.headers:{};return d.headers={...u,...g,...a.headers},d.data=Mo(o,d,e),{url:hn(s),options:d}}}},rp=function(e){const t=$re(e);return{async deletePackageVersion(n,r,o,a){const i=await t.deletePackageVersion(n,r,o,a),s=e?.serverIndex??0,l=dn["VersionsApi.deletePackageVersion"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async getPackageVersion(n,r,o,a){const i=await t.getPackageVersion(n,r,o,a),s=e?.serverIndex??0,l=dn["VersionsApi.getPackageVersion"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async listPackageVersions(n,r,o){const a=await t.listPackageVersions(n,r,o),i=e?.serverIndex??0,s=dn["VersionsApi.listPackageVersions"]?.[i]?.url;return(l,d)=>mn(a,_t,ln,e)(l,s||d)},async setPackageLatestVersion(n,r,o,a){const i=await t.setPackageLatestVersion(n,r,o,a),s=e?.serverIndex??0,l=dn["VersionsApi.setPackageLatestVersion"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)},async setPackageVersionManifest(n,r,o,a,i){const s=await t.setPackageVersionManifest(n,r,o,a,i),l=e?.serverIndex??0,d=dn["VersionsApi.setPackageVersionManifest"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)},async updatePackageVersion(n,r,o,a,i){const s=await t.updatePackageVersion(n,r,o,a,i),l=e?.serverIndex??0,d=dn["VersionsApi.updatePackageVersion"]?.[l]?.url;return(u,m)=>mn(s,_t,ln,e)(u,d||m)}}};let Ere=class extends hs{deletePackageVersion(t,n,r,o){return rp(this.configuration).deletePackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}getPackageVersion(t,n,r,o){return rp(this.configuration).getPackageVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}listPackageVersions(t,n,r){return rp(this.configuration).listPackageVersions(t,n,r).then(o=>o(this.axios,this.basePath))}setPackageLatestVersion(t,n,r,o){return rp(this.configuration).setPackageLatestVersion(t,n,r,o).then(a=>a(this.axios,this.basePath))}setPackageVersionManifest(t,n,r,o,a){return rp(this.configuration).setPackageVersionManifest(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}updatePackageVersion(t,n,r,o,a){return rp(this.configuration).updatePackageVersion(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}};const Rre=function(e){return{getWatchStatus:async(t={})=>{const n="/watch-mode/status",r=new URL(n,fn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={},s={};i.Accept="application/json",pn(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:hn(r),options:a}},startWatching:async(t,n={})=>{Ze("startWatching","startWatchRequest",t);const r="/watch-mode/start",o=new URL(r,fn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},s={},l={};s["Content-Type"]="application/json",s.Accept="application/json",pn(o,l);let d=a&&a.headers?a.headers:{};return i.headers={...s,...d,...n.headers},i.data=Mo(t,i,e),{url:hn(o),options:i}},stopWatching:async(t={})=>{const n="/watch-mode/stop",r=new URL(n,fn);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...t},i={},s={};i.Accept="application/json",pn(r,s);let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:hn(r),options:a}},streamPackageEvents:async(t,n,r,o={})=>{Ze("streamPackageEvents","environmentName",t),Ze("streamPackageEvents","packageName",n);const a="/environments/{environmentName}/packages/{packageName}/events".replace("{environmentName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,fn);let s;e&&(s=e.baseOptions);const l={method:"GET",...s,...o},d={},u={};r!==void 0&&(u.versionId=r),d.Accept="text/event-stream,application/json",pn(i,u);let m=s&&s.headers?s.headers:{};return l.headers={...d,...m,...o.headers},{url:hn(i),options:l}}}},$b=function(e){const t=Rre(e);return{async getWatchStatus(n){const r=await t.getWatchStatus(n),o=e?.serverIndex??0,a=dn["WatchModeApi.getWatchStatus"]?.[o]?.url;return(i,s)=>mn(r,_t,ln,e)(i,a||s)},async startWatching(n,r){const o=await t.startWatching(n,r),a=e?.serverIndex??0,i=dn["WatchModeApi.startWatching"]?.[a]?.url;return(s,l)=>mn(o,_t,ln,e)(s,i||l)},async stopWatching(n){const r=await t.stopWatching(n),o=e?.serverIndex??0,a=dn["WatchModeApi.stopWatching"]?.[o]?.url;return(i,s)=>mn(r,_t,ln,e)(i,a||s)},async streamPackageEvents(n,r,o,a){const i=await t.streamPackageEvents(n,r,o,a),s=e?.serverIndex??0,l=dn["WatchModeApi.streamPackageEvents"]?.[s]?.url;return(d,u)=>mn(i,_t,ln,e)(d,l||u)}}};let Tre=class extends hs{getWatchStatus(t){return $b(this.configuration).getWatchStatus(t).then(n=>n(this.axios,this.basePath))}startWatching(t,n){return $b(this.configuration).startWatching(t,n).then(r=>r(this.axios,this.basePath))}stopWatching(t){return $b(this.configuration).stopWatching(t).then(n=>n(this.axios,this.basePath))}streamPackageEvents(t,n,r,o){return $b(this.configuration).streamPackageEvents(t,n,r,o).then(a=>a(this.axios,this.basePath))}},Mre=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 dy=new Eee({defaultOptions:{queries:{retry:!1,throwOnError:!1,refetchOnWindowFocus:!1},mutations:{retry:!1,throwOnError:!1}}}),S4={staleTime:300*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!1};function Ore(e,t){return t||e?.modelPage==="viewer"?"viewer":"explorer"}function Pre(e){return{modelPage:Ore(e.data,e.isError&&e.data===void 0),isLoadingStatus:e.isPending}}const Lk="publisher:themeMode";function jre(){if(!(typeof window>"u"))try{const e=window.localStorage.getItem(Lk);if(e==="light"||e==="dark"||e==="auto")return e}catch{}}function Are(e){if(!(typeof window>"u"))try{e===void 0?window.localStorage.removeItem(Lk):window.localStorage.setItem(Lk,e)}catch{}}function Dre(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}_t.defaults.baseURL||(_t.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet");const C4=C.createContext(void 0),Nre=(e,t,n)=>{const r=`${window.location.protocol}//${window.location.host}/api/v0`,o=_t.create({baseURL:e||r,withCredentials:!0,timeout:6e5,...n?{adapter:n}:{}});o.interceptors.request.use(async i=>{const s=await t?.();return i.headers.Authorization=s||"",i});const a=new Mre({basePath:r});return{models:new vre(a,r,o),publisher:new Sre(a,r,o),environments:new pre(a,r,o),packages:new xre(a,r,o),agents:new rre(a,r,o),dataApps:new lre(a,r,o),reports:new kre(a,r,o),connections:new are(a,r,o),databases:new dre(a,r,o),materializations:new mre(a,r,o),watchMode:new Tre(a,r,o),versions:new Ere(a,r,o)}},Ire=e=>p.jsx(Ree,{client:dy,children:p.jsx(Lre,{...e})}),Lre=({children:e,getAccessToken:t,baseURL:n,mutable:r,theme:o,ui:a,adapter:i,mode:s})=>{const l=C.useMemo(()=>Nre(n,t,i),[n,t,i]),d=n||`${window.location.protocol}//${window.location.host}/api/v0`,u=Ld({queryKey:["status",d],retry:3,queryFn:async()=>(await l.publisher.getStatus()).data});u.error&&console.error("Failed to fetch publisher status:",u.error);const m=u.data?.frozenConfig,g=u.data?.theme,{modelPage:y,isLoadingStatus:x}=Pre(u);let w;u.isLoading||u.error?w=r:m?w=!1:w=r??!0;const S=C.useMemo(()=>[g,o],[g,o]),[b,$]=C.useState(jre),[k,R]=C.useState(Dre);C.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const L=window.matchMedia("(prefers-color-scheme: dark)"),_=E=>R(E.matches);return L.addEventListener("change",_),()=>L.removeEventListener("change",_)},[]);const O=C.useCallback(L=>{$(L),Are(L)},[]),P=g?.allowUserToggle??!0,D=P?b:void 0,A=C.useMemo(()=>s??Zne(g?.defaultMode,D,k),[s,g?.defaultMode,D,k]),F={server:d,getAccessToken:t,apiClients:l,mutable:w,isLoadingStatus:x,instanceTheme:g,modelPage:y};return p.jsx(C4.Provider,{value:F,children:p.jsx(Jne,{layers:S,mode:A,userChoice:D,setMode:O,allowUserToggle:P&&s===void 0,...a?{ui:a}:{},children:e})})},er=()=>{const e=C.useContext(C4);if(e===void 0)throw new Error("useServer must be used within a ServerProvider");return e};function gd(){return gd=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},gd.apply(this,arguments)}const zre=["children","options"],pA=["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"}),hA={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},Fre=["style","script","pre"],_re=["src","href","data","formAction","srcDoc","action"],Bre=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,Ure=/mailto:/i,Vre=/\n{2,}$/,mA=/^(\s*>[\s\S]*?)(?=\n\n|$)/,qre=/^ *> ?/gm,Hre=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Wre=/^ {2,}\n/,Yre=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,gA=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,yA=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,Gre=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,Kre=/^(?:\n *)*\n/,Qre=/\r\n?/g,Xre=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,Zre=/^\[\^([^\]]+)]/,Jre=/\f/g,eoe=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,toe=/^\s*?\[(x|\s)\]/,vA=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,bA=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,xA=/^([^\n]+)\n *(=|-){3,} *\n/,JS=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,noe=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,wA=/^<!--[\s\S]*?(?:-->)/,roe=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,eC=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,ooe=/^\{.*\}$/,aoe=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,ioe=/^<([^ >]+@[^ >]+)>/,soe=/^<([^ >]+:\/[^ >]+)>/,loe=/-([a-z])?/gi,SA=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,coe=/^[^\n]+(?: \n|\n{2,})/,uoe=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,doe=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,foe=/^\[([^\]]*)\] ?\[([^\]]*)\]/,poe=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,hoe=/\t/g,moe=/(^ *\||\| *$)/g,goe=/^ *:-+: *$/,yoe=/^ *:-+ *$/,voe=/^ *-+: *$/,Kx=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,Qx="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",boe=RegExp(`^([*_])\\1${Kx(1)}${Qx}\\1\\1(?!\\1)`),xoe=RegExp(`^([*_])${Kx(0)}${Qx}\\1(?!\\1)`),woe=RegExp(`^(==)${Kx(0)}${Qx}\\1`),Soe=RegExp(`^(~~)${Kx(0)}${Qx}\\1`),Coe=/^(:[a-zA-Z0-9-_]+:)/,koe=/^\\([^0-9A-Za-z\s])/,$oe=/\\([^0-9A-Za-z\s])/g,Eoe=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,Roe=/^\n+/,Toe=/^([ \t]*)/,Moe=/(?:^|\n)( *)$/,XE="(?:\\d+\\.)",ZE="(?:[*+-])";function k4(e){return"( *)("+(e===1?XE:ZE)+") +"}const $4=k4(1),E4=k4(2);function R4(e){return RegExp("^"+(e===1?$4:E4))}const Ooe=R4(1),Poe=R4(2);function T4(e){return RegExp("^"+(e===1?$4:E4)+"[^\\n]*(?:\\n(?!\\1"+(e===1?XE:ZE)+" )[^\\n]*)*(\\n|$)","gm")}const joe=T4(1),Aoe=T4(2);function M4(e){const t=e===1?XE:ZE;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const O4=M4(1),P4=M4(2);function CA(e,t){const n=t===1,r=n?O4:P4,o=n?joe:Aoe,a=n?Ooe:Poe;return{t:i=>a.test(i),o:Wp(function(i,s){const l=Moe.exec(s.prevCapture);return l&&(s.list||!s.inline&&!s.simple)?r.exec(i=l[1]+i):null}),i:1,u(i,s,l){const d=n?+i[2]:void 0,u=i[0].replace(Vre,`
275
275
  `).match(o);let m=!1;return{items:u.map(function(g,y){const x=a.exec(g)[0].length,w=RegExp("^ {1,"+x+"}","gm"),S=g.replace(w,"").replace(a,""),b=y===u.length-1,$=S.indexOf(`
276
276
 
277
277
  `)!==-1||b&&m;m=$;const k=l.inline,R=l.list;let O;l.list=!0,$?(l.inline=!1,O=Fg(S)+`
@@ -287,13 +287,13 @@ export default theme;`}function TP(e){return typeof e=="number"?`${(e*100).toFix
287
287
  `)===-1)return null;let k="";b.split(`
288
288
  `).every(O=>(O+=`
289
289
  `,!a.some(P=>P.test(O))&&(k+=O,!!O.trim())));const R=Fg(k);return R===""?null:[k,,R]}),i:3,u:tC,l:(b,$,k)=>s("p",{key:k.key},$(b.children,k))},22:{t:["["],o:Kc(uoe),i:0,u:b=>(m[b[1]]={target:b[2],title:b[4]},{}),l:rC},23:{t:["!["],o:Qc(doe),i:0,u:b=>({alt:b[1]?rl(b[1]):void 0,ref:b[2]}),l:(b,$,k)=>m[b.ref]?s("img",{key:k.key,alt:b.alt,src:r(m[b.ref].target,"img","src"),title:m[b.ref].title}):null},24:{t:b=>b[0]==="["&&b.indexOf("](")===-1,o:Kc(foe),i:0,u:(b,$,k)=>({children:$(b[1],k),fallbackChildren:b[0],ref:b[2]}),l:(b,$,k)=>m[b.ref]?s("a",{key:k.key,href:r(m[b.ref].target,"a","href"),title:m[b.ref].title},$(b.children,k)):s("span",{key:k.key},b.fallbackChildren)},25:{t:["|"],o:Jl(SA),i:1,u:zoe,l(b,$,k){const R=b;return s("table",{key:k.key},s("thead",null,s("tr",null,R.header.map(function(O,P){return s("th",{key:P,style:$A(R,P)},$(O,k))}))),s("tbody",null,R.cells.map(function(O,P){return s("tr",{key:P},O.map(function(D,A){return s("td",{key:A,style:$A(R,A)},$(D,k))}))})))}},27:{o:Wp(function(b,$){let k;return u0(b,":")&&(k=Coe.exec(b)),k||Eoe.exec(b)}),i:4,u(b){const $=b[0];return{text:$.indexOf("&")===-1?$:$.replace(noe,(k,R)=>t.namedCodesToUnicode[R]||k)}},l:b=>b.text},28:{t:["**","__"],o:Qc(boe),i:2,u:(b,$,k)=>({children:$(b[2],k)}),l:(b,$,k)=>s("strong",{key:k.key},$(b.children,k))},29:{t:b=>{const $=b[0];return($==="*"||$==="_")&&b[1]!==$},o:Qc(xoe),i:3,u:(b,$,k)=>({children:$(b[2],k)}),l:(b,$,k)=>s("em",{key:k.key},$(b.children,k))},30:{t:["\\"],o:Qc(koe),i:1,u:b=>({text:b[1],type:"27"})},31:{t:["=="],o:Qc(woe),i:3,u:tC,l:(b,$,k)=>s("mark",{key:k.key},$(b.children,k))},32:{t:["~~"],o:Qc(Soe),i:3,u:tC,l:(b,$,k)=>s("del",{key:k.key},$(b.children,k))}};t.disableParsingRawHTML===!0&&(delete g[11],delete g[13]);const y=(function(b){var $=Object.keys(b);function k(R,O){var P=[];if(O.prevCapture=O.prevCapture||"",R.trim())for(;R;)for(var D=0;D<$.length;){var A=$[D],F=b[A];if(!F.t||Ioe(R,O,F.t)){var L=F.o(R,O);if(L&&L[0]){R=R.substring(L[0].length);var _=F.u(L,k,O);O.prevCapture+=L[0],_.type||(_.type=A),P.push(_);break}D++}else D++}return O.prevCapture="",P}return $.sort(function(R,O){return b[R].i-b[O].i||(R<O?-1:1)}),function(R,O){return k((function(P){return P.replace(Qre,`
290
- `).replace(Jre,"").replace(hoe," ")})(R),O)}})(g),x=(w=(function(b,$){return function(k,R,O){const P=b[k.type].l;return $?$(()=>P(k,R,O),k,R,O):P(k,R,O)}})(g,t.renderRule),function b($,k={}){if(Array.isArray($)){const R=k.key,O=[];let P=!1;for(let D=0;D<$.length;D++){k.key=D;const A=b($[D],k),F=typeof A=="string";F&&P?O[O.length-1]+=A:A!==null&&O.push(A),P=F}return k.key=R,O}return w($,b,k)});var w;const S=l(e);return u.length?s("div",null,S,s("footer",{key:"footer"},u.map(function(b){return s("div",{id:n(b.identifier,Vm),key:b.identifier},b.identifier,x(y(b.footnote,{inline:!0})))}))):S}const Hoe=e=>{let{children:t="",options:n}=e,r=(function(o,a){if(o==null)return{};var i,s,l={},d=Object.keys(o);for(s=0;s<d.length;s++)a.indexOf(i=d[s])>=0||(l[i]=o[i]);return l})(e,zre);return C.cloneElement(qoe(t,n),r)},Woe="[A-Za-z_][A-Za-z0-9_]*",SRe=e=>e.split(/\r\n|\r|\n/),j4=e=>new RegExp(`^${Woe}$`).test(e),Yoe=new Set("accept aggregate calculate calculation connection declare dimension drill except given group_by grouped_by having index join_cross join_many join_one limit measure nest order_by partition_by primary_key query rename run sample select timezone top type view where".split(" ")),Goe=new Set("all and as asc avg boolean by case cast compose count date day desc distinct else end exclude export extend false filter for from full has hour import in include inner internal is json left like max min minute month not now null number on or pick private public quarter right second source sql string sum table then this timestamp timestamptz to true virtual week when with year".split(" ")),Wy=e=>j4(e)&&!Goe.has(e.toLowerCase()),CRe=e=>Wy(e)&&!Yoe.has(e.toLowerCase()),kRe=e=>j4(e)&&!Wy(e)?`\`${e}\``:e;function EA(e){const t=/^##\|?(?:[ \t\r\n]|$)/.exec(e);if(!t)return!1;const n=/[0-9A-Za-z_\u00C0-\u024F\u1E00-\u1EFF]+/y;let r=0,o="";for(let a=t[0].length;a<e.length;a++){const i=e[a];if(/\s/.test(i))continue;if(e.startsWith("-...",a)){a+=3,o="";continue}n.lastIndex=a;const s=n.exec(e)?.[0];if(i==='"'||i==="'"){const l=e.startsWith(i.repeat(3),a)?i.repeat(3):i;for(a+=l.length;a<e.length&&!e.startsWith(l,a);)a+=e[a]==="\\"?2:1;a+=l.length-1}else if(i==="`"){let l=a+1;for(;l<e.length&&e[l]!=="`"&&e[l]!==`
290
+ `).replace(Jre,"").replace(hoe," ")})(R),O)}})(g),x=(w=(function(b,$){return function(k,R,O){const P=b[k.type].l;return $?$(()=>P(k,R,O),k,R,O):P(k,R,O)}})(g,t.renderRule),function b($,k={}){if(Array.isArray($)){const R=k.key,O=[];let P=!1;for(let D=0;D<$.length;D++){k.key=D;const A=b($[D],k),F=typeof A=="string";F&&P?O[O.length-1]+=A:A!==null&&O.push(A),P=F}return k.key=R,O}return w($,b,k)});var w;const S=l(e);return u.length?s("div",null,S,s("footer",{key:"footer"},u.map(function(b){return s("div",{id:n(b.identifier,Vm),key:b.identifier},b.identifier,x(y(b.footnote,{inline:!0})))}))):S}const Hoe=e=>{let{children:t="",options:n}=e,r=(function(o,a){if(o==null)return{};var i,s,l={},d=Object.keys(o);for(s=0;s<d.length;s++)a.indexOf(i=d[s])>=0||(l[i]=o[i]);return l})(e,zre);return C.cloneElement(qoe(t,n),r)},Woe="[A-Za-z_][A-Za-z0-9_]*",CRe=e=>e.split(/\r\n|\r|\n/),j4=e=>new RegExp(`^${Woe}$`).test(e),Yoe=new Set("accept aggregate calculate calculation connection declare dimension drill except given group_by grouped_by having index join_cross join_many join_one limit measure nest order_by partition_by primary_key query rename run sample select timezone top type view where".split(" ")),Goe=new Set("all and as asc avg boolean by case cast compose count date day desc distinct else end exclude export extend false filter for from full has hour import in include inner internal is json left like max min minute month not now null number on or pick private public quarter right second source sql string sum table then this timestamp timestamptz to true virtual week when with year".split(" ")),Wy=e=>j4(e)&&!Goe.has(e.toLowerCase()),kRe=e=>Wy(e)&&!Yoe.has(e.toLowerCase()),$Re=e=>j4(e)&&!Wy(e)?`\`${e}\``:e;function EA(e){const t=/^##\|?(?:[ \t\r\n]|$)/.exec(e);if(!t)return!1;const n=/[0-9A-Za-z_\u00C0-\u024F\u1E00-\u1EFF]+/y;let r=0,o="";for(let a=t[0].length;a<e.length;a++){const i=e[a];if(/\s/.test(i))continue;if(e.startsWith("-...",a)){a+=3,o="";continue}n.lastIndex=a;const s=n.exec(e)?.[0];if(i==='"'||i==="'"){const l=e.startsWith(i.repeat(3),a)?i.repeat(3):i;for(a+=l.length;a<e.length&&!e.startsWith(l,a);)a+=e[a]==="\\"?2:1;a+=l.length-1}else if(i==="`"){let l=a+1;for(;l<e.length&&e[l]!=="`"&&e[l]!==`
291
291
  `;)l+=e[l]==="\\"?2:1;const d=e.slice(a+1,l);if(r===0&&d==="artifact"&&!/[=.-]/.test(o))return!0;a=l}else if(i==="#"){const l=e.indexOf(`
292
- `,a);if(l<0)return!1;a=l;continue}else if(i==="{"||i==="[")r++;else if(i==="}"||i==="]")r--;else if(s){if(r===0&&s==="artifact"&&!/[=.-]/.test(o))return!0;a+=s.length-1}o=i}return!1}function RA(e){const t=e.trim().split(/[ \t\r]/,1)[0],n=/^(#{1,2})(\|?)(?:\(markdown\)|<markdown>|\[markdown\]|\{markdown\})$/.exec(t);return n?{level:n[1].length,block:n[2]==="|"}:void 0}function Koe(e,t,n){const r=/^[ \t]*/.exec(e)[0].length;if(t!==void 0&&r!==t)return!1;const o=e.slice(r);return o.startsWith(n)&&(n!=="|#"||o.charAt(2)!=="#")}function Xx(e,t){const n=new Map;e.forEach((a,i)=>{const s=/^[ \t]*/.exec(a)?.[0].length??0;for(const l of["|##","|#"])if(Koe(a,s,l)){const d=`${s}${l}`,u=n.get(d);u?u.push(i):n.set(d,[i]);break}});const r=new Map,o=[];for(let a=0;a<e.length;a++){if(t?.(a))continue;const i=/^([ \t]*)(#{1,2})\|/.exec(e[a]);if(!i)continue;const s=`${i[1].length}${i[2]==="#"?"|#":"|##"}`,l=n.get(s)??[];let d=r.get(s)??0;for(;d<l.length&&l[d]<=a;)d++;r.set(s,d),d<l.length&&(o.push([a,l[d]]),a=l[d])}return o}function A4(e){const t=new Set;for(const[n,r]of Xx(e))for(let o=n;o<=r;o++)t.add(o);return t}function $Re(e,t){const n=new Set,r=new Set;for(const[o,a]of Xx(e,t)){const i=RA(e[o])?.level===1;for(let s=o;s<=a;s++)r.add(s),i&&n.add(s)}return e.forEach((o,a)=>{if(r.has(a)||t?.(a))return;const i=RA(o);i?.level===1&&!i.block&&n.add(a)}),n}function Qoe(e){const t=A4(e),n=e.findIndex((o,a)=>!t.has(a)&&!/^\s*##\|/.test(o)&&EA(o.trim())),r=Xx(e).find(([o,a])=>EA(e.slice(o,a).join(`
292
+ `,a);if(l<0)return!1;a=l;continue}else if(i==="{"||i==="[")r++;else if(i==="}"||i==="]")r--;else if(s){if(r===0&&s==="artifact"&&!/[=.-]/.test(o))return!0;a+=s.length-1}o=i}return!1}function RA(e){const t=e.trim().split(/[ \t\r]/,1)[0],n=/^(#{1,2})(\|?)(?:\(markdown\)|<markdown>|\[markdown\]|\{markdown\})$/.exec(t);return n?{level:n[1].length,block:n[2]==="|"}:void 0}function Koe(e,t,n){const r=/^[ \t]*/.exec(e)[0].length;if(t!==void 0&&r!==t)return!1;const o=e.slice(r);return o.startsWith(n)&&(n!=="|#"||o.charAt(2)!=="#")}function Xx(e,t){const n=new Map;e.forEach((a,i)=>{const s=/^[ \t]*/.exec(a)?.[0].length??0;for(const l of["|##","|#"])if(Koe(a,s,l)){const d=`${s}${l}`,u=n.get(d);u?u.push(i):n.set(d,[i]);break}});const r=new Map,o=[];for(let a=0;a<e.length;a++){if(t?.(a))continue;const i=/^([ \t]*)(#{1,2})\|/.exec(e[a]);if(!i)continue;const s=`${i[1].length}${i[2]==="#"?"|#":"|##"}`,l=n.get(s)??[];let d=r.get(s)??0;for(;d<l.length&&l[d]<=a;)d++;r.set(s,d),d<l.length&&(o.push([a,l[d]]),a=l[d])}return o}function A4(e){const t=new Set;for(const[n,r]of Xx(e))for(let o=n;o<=r;o++)t.add(o);return t}function ERe(e,t){const n=new Set,r=new Set;for(const[o,a]of Xx(e,t)){const i=RA(e[o])?.level===1;for(let s=o;s<=a;s++)r.add(s),i&&n.add(s)}return e.forEach((o,a)=>{if(r.has(a)||t?.(a))return;const i=RA(o);i?.level===1&&!i.block&&n.add(a)}),n}function Qoe(e){const t=A4(e),n=e.findIndex((o,a)=>!t.has(a)&&!/^\s*##\|/.test(o)&&EA(o.trim())),r=Xx(e).find(([o,a])=>EA(e.slice(o,a).join(`
293
293
  `).trim()));return r&&(n<0||r[0]<n)?{from:r[0],to:r[1],block:!0,text:e.slice(r[0],r[1]).join(`
294
- `)}:n<0?void 0:{from:n,to:n,block:!1,text:e[n]}}const ERe=e=>/^\s*##(?:\|\s*|[ \t]*)artifact\b/.test(e),RRe="The `artifact` property is not the first on its tag, so the builder cannot rewrite the tag without risking the properties before it. Move `artifact { … }` first on the tag to edit this file here.",Xoe=e=>Qoe(e)?.from??-1,TRe=e=>e.replace(/^\s*##\|?\s*/,"# "),Zoe=/^##"([ \t]|$)/;function MRe(e){const t=Xoe(e),n=A4(e),r=m=>t<0||m<t,o=m=>t>=0&&m>t,a=[];e.forEach((m,g)=>{!n.has(g)&&Zoe.test(m.trim())&&a.push({at:g,text:m.trim().slice(3).trim(),block:!1})});for(const[m,g]of Xx(e)){if(!/^[ \t]*##\|"([ \t]|$)/.test(e[m]))continue;const y=[e[m].trim().slice(4),...e.slice(m+1,g)].map(x=>x.trim()).join(`
294
+ `)}:n<0?void 0:{from:n,to:n,block:!1,text:e[n]}}const RRe=e=>/^\s*##(?:\|\s*|[ \t]*)artifact\b/.test(e),TRe="The `artifact` property is not the first on its tag, so the builder cannot rewrite the tag without risking the properties before it. Move `artifact { … }` first on the tag to edit this file here.",Xoe=e=>Qoe(e)?.from??-1,MRe=e=>e.replace(/^\s*##\|?\s*/,"# "),Zoe=/^##"([ \t]|$)/;function ORe(e){const t=Xoe(e),n=A4(e),r=m=>t<0||m<t,o=m=>t>=0&&m>t,a=[];e.forEach((m,g)=>{!n.has(g)&&Zoe.test(m.trim())&&a.push({at:g,text:m.trim().slice(3).trim(),block:!1})});for(const[m,g]of Xx(e)){if(!/^[ \t]*##\|"([ \t]|$)/.test(e[m]))continue;const y=[e[m].trim().slice(4),...e.slice(m+1,g)].map(x=>x.trim()).join(`
295
295
  `).trim();y.length>0&&a.push({at:m,text:y,block:!0})}a.sort((m,g)=>m.at-g.at);const i=a.filter(m=>r(m.at)),s=a.filter(m=>o(m.at)),l=i.some(m=>m.text.trim())?i:s,d=l.map(m=>m.text).join(`
296
- `),u=m=>m.filter(g=>!g.block).map(g=>g.at);return{read:u(l),blankAbove:l===s?u(i):[],below:u(s),belowBlock:s.some(m=>m.block),inBlock:l.some(m=>m.block),...d.trim()?{text:d}:{}}}const Joe=/^[A-Za-z_][A-Za-z0-9_]*$/;function ORe(e){const t=e.trim(),n=t.split(/[ \t\r]/,1)[0],r=/^##\|(?:\((markdown|text)\)|<(markdown|text)>|\[(markdown|text)\]|\{(markdown|text)\})$/.exec(n);if(!r)return;const o=t.slice(n.length).trim();return{route:r[1]??r[2]??r[3]??r[4],rest:o,...Joe.test(o)?{name:o}:{}}}function PRe(e){const t=(e??"").split("->").map(a=>a.trim());if(t.length!==2)return;const n=t[1].indexOf("+"),r=n<0?t[1]:t[1].slice(0,n).trim(),o=n<0?void 0:t[1].slice(n).trim();return{source:t[0],view:r,...o===void 0?{}:{refinement:o}}}const jRe=e=>/^`([A-Za-z_][A-Za-z0-9_]*)`$/.test(e)?e.slice(1,-1):e,eae=new Set([401,403,404]);function D4(e){const t=e,n=t?.response?.status??t?.status;return typeof n!="number"||!eae.has(n)}var nd={},Ms={},TA;function gh(){if(TA)return Ms;TA=1,Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isChainOp=e,Ms.isStringCondition=t,Ms.isStringFilter=n,Ms.isBooleanFilter=r,Ms.isNumberFilter=o,Ms.isTemporalFilter=a,Ms.isFilterExpression=i,Ms.isFilterable=s;function e(l){return["and","or",","].includes(l)}function t(l){return["starts","ends","contains","="].includes(l.operator)}function n(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["starts","ends","contains","=","~","null","none","empty","and","or",",","()"].includes(l.operator)}function r(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["null","none","true","false","=false","=true"].includes(l.operator)}function o(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["range","<=",">=","!=","=",">","<","and","or","()","null","none"].includes(l.operator)}function a(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["literal","before","after","to","for","in","and","or","in_last","this","last","next","()","null","none"].includes(l.operator)}function i(l){return typeof l=="object"&&l!==null&&"operator"in l}function s(l){return["string","number","boolean","timestamp","timestamptz","date"].includes(l)}return Ms}var qm={},MA;function tae(){return MA||(MA=1,Object.defineProperty(qm,"__esModule",{value:!0}),qm.BooleanFilterExpression=void 0,qm.BooleanFilterExpression={parse(e){var t;if(e.match(/^\s*$/))return{parsed:null,log:[]};const n={parsed:null,log:[]};let r=e.toLowerCase().trim().replace(/\s\s+/," "),o=!1;if(r.startsWith("not ")&&(o=!0,r=r.slice(4)),r==="true")n.parsed={operator:"true"};else if(r==="=true")n.parsed={operator:"=true"};else if(r==="false")n.parsed={operator:"false"};else if(r==="=false")n.parsed={operator:"=false"};else if(r==="null")n.parsed={operator:"null"};else if(r==="none")n.parsed={operator:"none"};else{const a=e.match(/[^\s]/),i=a&&(t=a.index)!==null&&t!==void 0?t:0;n.log=[{message:`Illegal boolean filter '${r}'. Must be one of true,=true,false,=false,null,none`,severity:"error",startIndex:i,endIndex:i+e.length-1}]}return o&&n.parsed&&(n.parsed.not=!0),n},unparse(e){return e===null?"":(e.not?"not ":"")+e.operator}}),qm}var aC={},ma={},OA;function Zx(){if(OA)return ma;OA=1,Object.defineProperty(ma,"__esModule",{value:!0}),ma.maybeNot=t,ma.unescape=n,ma.escape=r,ma.matchOp=a,ma.conjoin=s,ma.joinNumbers=l,ma.mkRange=d,ma.mkValues=u,ma.numNot=m,ma.temporalNot=g,ma.joinTemporal=y,ma.timeLiteral=x,ma.mkUnits=w;const e=gh();function t(S){const[b,$]=S;return b&&$&&(0,e.isStringFilter)($)?{...$,not:!0}:$}function n(S){return S.replace(/\\(.)/g,"$1")}function r(S){const b=S.toLowerCase();return b==="null"||b==="empty"||b==="none"?"\\"+S:S.replace(/([,; |()\\%_-])/g,"\\$1")}function o(S){let b=!1,$=!1,k=0,R=!1;const O=S.length;for(let P=0;P<O;P+=1){const D=S[P];if(D===" "||D===" "){k+=1;continue}k=0,D==="%"?(R=!0,P===0&&(b=!0),$=!0):($=!1,D==="\\"?P+=1:D==="_"&&(R=!0))}return{hasLike:R,percentEnd:$&&O>1,percentStart:b&&O>1,endSpace:k}}function a(S){let b=S.trimStart();const{hasLike:$,percentEnd:k,percentStart:R,endSpace:O}=o(b);if(O>0&&(b=b.slice(0,-O)),$){if(R&&k){const P=b.slice(1,-1);if(!o(P).hasLike&&P.length>0)return{operator:"contains",values:[n(P)]}}else if(k){const P=b.slice(0,-1);if(!o(P).hasLike)return{operator:"starts",values:[n(P)]}}else if(R){const P=b.slice(1);if(!o(P).hasLike)return{operator:"ends",values:[n(P)]}}return{operator:"~",escaped_values:[b]}}return b.toLowerCase()==="null"?{operator:"null"}:b.toLowerCase()==="empty"?{operator:"empty"}:b.toLowerCase()==="none"?{operator:"none"}:{operator:"=",values:[n(b)]}}function i(S,b){var $,k;return S.operator===b.operator&&(($=S.not)!==null&&$!==void 0?$:!1)===((k=b.not)!==null&&k!==void 0?k:!1)}function s(S,b,$){if(b=b.toLowerCase(),(0,e.isStringFilter)(S)&&(0,e.isStringFilter)($)){if(b===","){if(S.operator==="~"&&i(S,$))return{...S,escaped_values:[...S.escaped_values,...$.escaped_values]};if((0,e.isStringCondition)(S)&&i(S,$))return{...S,values:[...S.values,...$.values]}}const k=b===","?",":b==="|"?"or":b===";"?"and":void 0;if(k)return S.operator===k?{...S,members:[...S.members,$]}:{operator:k,members:[S,$]}}return null}function l(S,b,$){if(b=b.toLowerCase(),(0,e.isNumberFilter)(S)&&(0,e.isNumberFilter)($)){if(b==="or"&&S.operator==="="&&i(S,$)){const k={operator:"=",values:[...S.values,...$.values]};return S.not&&(k.not=!0),k}if(b==="and"||b==="or")return S.operator===b?{...S,members:[...S.members,$]}:{operator:b,members:[S,$]}}return null}function d(S,b,$,k){return{operator:"range",startValue:b,startOperator:S==="("?">":">=",endValue:$,endOperator:k===")"?"<":"<="}}function u(S,b){return{values:[S,...b]}}function m(S,b){return(0,e.isNumberFilter)(S)&&b?S.operator==="="?{operator:"!=",values:S.values}:S.operator==="!="?{operator:"=",values:S.values}:{...S,not:!0}:S}function g(S,b){if((0,e.isTemporalFilter)(S)&&b){if("not"in S){const $={...S};return S.not?delete $.not:$.not=!0,$}return{...S,not:!0}}return S}function y(S,b,$){return b=b.toLowerCase(),(0,e.isTemporalFilter)(S)&&(0,e.isTemporalFilter)($)&&(b==="and"||b==="or")?S.operator===b?{...S,members:[...S.members,$]}:{operator:b,members:[S,$]}:null}function x(S,b){const $={moment:"literal",literal:S};return b&&($.units=b),$}function w(S){switch(S.toLowerCase()){case"second":case"seconds":return"second";case"minute":case"minutes":return"minute";case"hour":case"hours":return"hour";case"day":case"days":return"day";case"week":case"weeks":return"week";case"month":case"months":return"month";case"quarter":case"quarters":return"quarter";case"year":case"years":return"year"}}return ma}var iC,PA;function nae(){if(PA)return iC;PA=1;const{numNot:e,mkRange:t,joinNumbers:n,mkValues:r}=Zx();function o(l,d){function u(){this.constructor=l}u.prototype=d.prototype,l.prototype=new u}function a(l,d,u,m){var g=Error.call(this,l);return Object.setPrototypeOf&&Object.setPrototypeOf(g,a.prototype),g.expected=d,g.found=u,g.location=m,g.name="SyntaxError",g}o(a,Error);function i(l,d,u){return u=u||" ",l.length>d?l:(d-=l.length,u+=u.repeat(d),l+u.slice(0,d))}a.prototype.format=function(l){var d="Error: "+this.message;if(this.location){var u=null,m;for(m=0;m<l.length;m++)if(l[m].source===this.location.source){u=l[m].text.split(/\r\n|\n|\r/g);break}var g=this.location.start,y=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(g):g,x=this.location.source+":"+y.line+":"+y.column;if(u){var w=this.location.end,S=i("",y.line.toString().length," "),b=u[g.line-1],$=g.line===w.line?w.column:b.length+1,k=$-g.column||1;d+=`
296
+ `),u=m=>m.filter(g=>!g.block).map(g=>g.at);return{read:u(l),blankAbove:l===s?u(i):[],below:u(s),belowBlock:s.some(m=>m.block),inBlock:l.some(m=>m.block),...d.trim()?{text:d}:{}}}const Joe=/^[A-Za-z_][A-Za-z0-9_]*$/;function PRe(e){const t=e.trim(),n=t.split(/[ \t\r]/,1)[0],r=/^##\|(?:\((markdown|text)\)|<(markdown|text)>|\[(markdown|text)\]|\{(markdown|text)\})$/.exec(n);if(!r)return;const o=t.slice(n.length).trim();return{route:r[1]??r[2]??r[3]??r[4],rest:o,...Joe.test(o)?{name:o}:{}}}function jRe(e){const t=(e??"").split("->").map(a=>a.trim());if(t.length!==2)return;const n=t[1].indexOf("+"),r=n<0?t[1]:t[1].slice(0,n).trim(),o=n<0?void 0:t[1].slice(n).trim();return{source:t[0],view:r,...o===void 0?{}:{refinement:o}}}const ARe=e=>/^`([A-Za-z_][A-Za-z0-9_]*)`$/.test(e)?e.slice(1,-1):e,eae=new Set([401,403,404]);function D4(e){const t=e,n=t?.response?.status??t?.status;return typeof n!="number"||!eae.has(n)}var nd={},Ms={},TA;function gh(){if(TA)return Ms;TA=1,Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.isChainOp=e,Ms.isStringCondition=t,Ms.isStringFilter=n,Ms.isBooleanFilter=r,Ms.isNumberFilter=o,Ms.isTemporalFilter=a,Ms.isFilterExpression=i,Ms.isFilterable=s;function e(l){return["and","or",","].includes(l)}function t(l){return["starts","ends","contains","="].includes(l.operator)}function n(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["starts","ends","contains","=","~","null","none","empty","and","or",",","()"].includes(l.operator)}function r(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["null","none","true","false","=false","=true"].includes(l.operator)}function o(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["range","<=",">=","!=","=",">","<","and","or","()","null","none"].includes(l.operator)}function a(l){return typeof l=="object"&&l!==null&&"operator"in l&&typeof l.operator=="string"&&["literal","before","after","to","for","in","and","or","in_last","this","last","next","()","null","none"].includes(l.operator)}function i(l){return typeof l=="object"&&l!==null&&"operator"in l}function s(l){return["string","number","boolean","timestamp","timestamptz","date"].includes(l)}return Ms}var qm={},MA;function tae(){return MA||(MA=1,Object.defineProperty(qm,"__esModule",{value:!0}),qm.BooleanFilterExpression=void 0,qm.BooleanFilterExpression={parse(e){var t;if(e.match(/^\s*$/))return{parsed:null,log:[]};const n={parsed:null,log:[]};let r=e.toLowerCase().trim().replace(/\s\s+/," "),o=!1;if(r.startsWith("not ")&&(o=!0,r=r.slice(4)),r==="true")n.parsed={operator:"true"};else if(r==="=true")n.parsed={operator:"=true"};else if(r==="false")n.parsed={operator:"false"};else if(r==="=false")n.parsed={operator:"=false"};else if(r==="null")n.parsed={operator:"null"};else if(r==="none")n.parsed={operator:"none"};else{const a=e.match(/[^\s]/),i=a&&(t=a.index)!==null&&t!==void 0?t:0;n.log=[{message:`Illegal boolean filter '${r}'. Must be one of true,=true,false,=false,null,none`,severity:"error",startIndex:i,endIndex:i+e.length-1}]}return o&&n.parsed&&(n.parsed.not=!0),n},unparse(e){return e===null?"":(e.not?"not ":"")+e.operator}}),qm}var aC={},ma={},OA;function Zx(){if(OA)return ma;OA=1,Object.defineProperty(ma,"__esModule",{value:!0}),ma.maybeNot=t,ma.unescape=n,ma.escape=r,ma.matchOp=a,ma.conjoin=s,ma.joinNumbers=l,ma.mkRange=d,ma.mkValues=u,ma.numNot=m,ma.temporalNot=g,ma.joinTemporal=y,ma.timeLiteral=x,ma.mkUnits=w;const e=gh();function t(S){const[b,$]=S;return b&&$&&(0,e.isStringFilter)($)?{...$,not:!0}:$}function n(S){return S.replace(/\\(.)/g,"$1")}function r(S){const b=S.toLowerCase();return b==="null"||b==="empty"||b==="none"?"\\"+S:S.replace(/([,; |()\\%_-])/g,"\\$1")}function o(S){let b=!1,$=!1,k=0,R=!1;const O=S.length;for(let P=0;P<O;P+=1){const D=S[P];if(D===" "||D===" "){k+=1;continue}k=0,D==="%"?(R=!0,P===0&&(b=!0),$=!0):($=!1,D==="\\"?P+=1:D==="_"&&(R=!0))}return{hasLike:R,percentEnd:$&&O>1,percentStart:b&&O>1,endSpace:k}}function a(S){let b=S.trimStart();const{hasLike:$,percentEnd:k,percentStart:R,endSpace:O}=o(b);if(O>0&&(b=b.slice(0,-O)),$){if(R&&k){const P=b.slice(1,-1);if(!o(P).hasLike&&P.length>0)return{operator:"contains",values:[n(P)]}}else if(k){const P=b.slice(0,-1);if(!o(P).hasLike)return{operator:"starts",values:[n(P)]}}else if(R){const P=b.slice(1);if(!o(P).hasLike)return{operator:"ends",values:[n(P)]}}return{operator:"~",escaped_values:[b]}}return b.toLowerCase()==="null"?{operator:"null"}:b.toLowerCase()==="empty"?{operator:"empty"}:b.toLowerCase()==="none"?{operator:"none"}:{operator:"=",values:[n(b)]}}function i(S,b){var $,k;return S.operator===b.operator&&(($=S.not)!==null&&$!==void 0?$:!1)===((k=b.not)!==null&&k!==void 0?k:!1)}function s(S,b,$){if(b=b.toLowerCase(),(0,e.isStringFilter)(S)&&(0,e.isStringFilter)($)){if(b===","){if(S.operator==="~"&&i(S,$))return{...S,escaped_values:[...S.escaped_values,...$.escaped_values]};if((0,e.isStringCondition)(S)&&i(S,$))return{...S,values:[...S.values,...$.values]}}const k=b===","?",":b==="|"?"or":b===";"?"and":void 0;if(k)return S.operator===k?{...S,members:[...S.members,$]}:{operator:k,members:[S,$]}}return null}function l(S,b,$){if(b=b.toLowerCase(),(0,e.isNumberFilter)(S)&&(0,e.isNumberFilter)($)){if(b==="or"&&S.operator==="="&&i(S,$)){const k={operator:"=",values:[...S.values,...$.values]};return S.not&&(k.not=!0),k}if(b==="and"||b==="or")return S.operator===b?{...S,members:[...S.members,$]}:{operator:b,members:[S,$]}}return null}function d(S,b,$,k){return{operator:"range",startValue:b,startOperator:S==="("?">":">=",endValue:$,endOperator:k===")"?"<":"<="}}function u(S,b){return{values:[S,...b]}}function m(S,b){return(0,e.isNumberFilter)(S)&&b?S.operator==="="?{operator:"!=",values:S.values}:S.operator==="!="?{operator:"=",values:S.values}:{...S,not:!0}:S}function g(S,b){if((0,e.isTemporalFilter)(S)&&b){if("not"in S){const $={...S};return S.not?delete $.not:$.not=!0,$}return{...S,not:!0}}return S}function y(S,b,$){return b=b.toLowerCase(),(0,e.isTemporalFilter)(S)&&(0,e.isTemporalFilter)($)&&(b==="and"||b==="or")?S.operator===b?{...S,members:[...S.members,$]}:{operator:b,members:[S,$]}:null}function x(S,b){const $={moment:"literal",literal:S};return b&&($.units=b),$}function w(S){switch(S.toLowerCase()){case"second":case"seconds":return"second";case"minute":case"minutes":return"minute";case"hour":case"hours":return"hour";case"day":case"days":return"day";case"week":case"weeks":return"week";case"month":case"months":return"month";case"quarter":case"quarters":return"quarter";case"year":case"years":return"year"}}return ma}var iC,PA;function nae(){if(PA)return iC;PA=1;const{numNot:e,mkRange:t,joinNumbers:n,mkValues:r}=Zx();function o(l,d){function u(){this.constructor=l}u.prototype=d.prototype,l.prototype=new u}function a(l,d,u,m){var g=Error.call(this,l);return Object.setPrototypeOf&&Object.setPrototypeOf(g,a.prototype),g.expected=d,g.found=u,g.location=m,g.name="SyntaxError",g}o(a,Error);function i(l,d,u){return u=u||" ",l.length>d?l:(d-=l.length,u+=u.repeat(d),l+u.slice(0,d))}a.prototype.format=function(l){var d="Error: "+this.message;if(this.location){var u=null,m;for(m=0;m<l.length;m++)if(l[m].source===this.location.source){u=l[m].text.split(/\r\n|\n|\r/g);break}var g=this.location.start,y=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(g):g,x=this.location.source+":"+y.line+":"+y.column;if(u){var w=this.location.end,S=i("",y.line.toString().length," "),b=u[g.line-1],$=g.line===w.line?w.column:b.length+1,k=$-g.column||1;d+=`
297
297
  --> `+x+`
298
298
  `+S+` |
299
299
  `+y.line+" | "+b+`
@@ -346,7 +346,7 @@ const theme = ${JSON.stringify(t,null,2)};
346
346
  theme.breakpoints = createBreakpoints(theme.breakpoints || {});
347
347
  theme.transitions = createTransitions(theme.transitions || {});
348
348
 
349
- export default theme;`}function SD(e){return typeof e=="number"?`${(e*100).toFixed(0)}%`:`calc((${e}) * 100%)`}const xse=e=>{if(!Number.isNaN(+e))return+e;const t=e.match(/\d*\.?\d+/g);if(!t)return 0;let n=0;for(let r=0;r<t.length;r+=1)n+=+t[r];return n};function wse(e){Object.assign(e,{alpha(t,n){const r=this||e;return r.colorSpace?`oklch(from ${t} l c h / ${typeof n=="string"?`calc(${n})`:n})`:r.vars?`rgba(${t.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g,"var(--$1Channel)")} / ${typeof n=="string"?`calc(${n})`:n})`:_0(t,xse(n))},lighten(t,n){const r=this||e;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${t}, #fff ${SD(n)})`:d1(t,n)},darken(t,n){const r=this||e;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${t}, #000 ${SD(n)})`:u1(t,n)}})}function Bk(e={},...t){const{breakpoints:n,mixins:r={},spacing:o,palette:a={},transitions:i={},typography:s={},shape:l,colorSpace:d,...u}=e;if(e.vars&&e.generateThemeVars===void 0)throw new Error(fc(20));const m=iR({...a,colorSpace:d}),g=sR(e);let y=wa(g,{mixins:sse(g.breakpoints,r),palette:m,shadows:pse.slice(),typography:cse(m,s),transitions:yse(i),zIndex:{...vse}});return y=wa(y,u),y=t.reduce((x,w)=>wa(x,w),y),y.unstable_sxConfig={...Ky,...u?.unstable_sxConfig},y.unstable_sx=function(x){return Yp({sx:x,theme:this})},y.toRuntimeSource=K4,wse(y),y}function Uk(e){let t;return e<1?t=5.11916*e**2:t=4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}const Sse=[...Array(25)].map((e,t)=>{if(t===0)return"none";const n=Uk(t);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function Q4(e){return{inputPlaceholder:e==="dark"?.5:.42,inputUnderline:e==="dark"?.7:.42,switchTrackDisabled:e==="dark"?.2:.12,switchTrack:e==="dark"?.3:.38}}function X4(e){return e==="dark"?Sse:[]}function Cse(e){const{palette:t={mode:"light"},opacity:n,overlays:r,colorSpace:o,...a}=e,i=iR({...t,colorSpace:o});return{palette:i,opacity:{...Q4(i.mode),...n},overlays:r||X4(i.mode),...a}}function kse(e){return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]==="palette"&&!!e[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}const $se=e=>[...[...Array(25)].map((t,n)=>`--${e?`${e}-`:""}overlays-${n}`),`--${e?`${e}-`:""}palette-AppBar-darkBg`,`--${e?`${e}-`:""}palette-AppBar-darkColor`],Ese=e=>(t,n)=>{const r=e.rootSelector||":root",o=e.colorSchemeSelector;let a=o;if(o==="class"&&(a=".%s"),o==="data"&&(a="[data-%s]"),o?.startsWith("data-")&&!o.includes("%s")&&(a=`[${o}="%s"]`),e.defaultColorScheme===t){if(t==="dark"){const i={};return $se(e.cssVarPrefix).forEach(s=>{i[s]=n[s],delete n[s]}),a==="media"?{[r]:n,"@media (prefers-color-scheme: dark)":{[r]:i}}:a?{[a.replace("%s",t)]:i,[`${r}, ${a.replace("%s",t)}`]:n}:{[r]:{...n,...i}}}if(a&&a!=="media")return`${r}, ${a.replace("%s",String(t))}`}else if(t){if(a==="media")return{[`@media (prefers-color-scheme: ${String(t)})`]:{[r]:n}};if(a)return a.replace("%s",String(t))}return r};function Rse(e,t){t.forEach(n=>{e[n]||(e[n]={})})}function mt(e,t,n){!e[t]&&n&&(e[t]=n)}function kg(e){return typeof e!="string"||!e.startsWith("hsl")?e:V4(e)}function nc(e,t){`${t}Channel`in e||(e[`${t}Channel`]=Cg(kg(e[t])))}function Tse(e){return typeof e=="number"?`${e}px`:typeof e=="string"||typeof e=="function"||Array.isArray(e)?e:"8px"}const al=e=>{try{return e()}catch{}},Mse=(e="mui")=>E5(e);function gC(e,t,n,r,o){if(!n)return;n=n===!0?{}:n;const a=o==="dark"?"dark":"light";if(!r){t[o]=Cse({...n,palette:{mode:a,...n?.palette},colorSpace:e});return}const{palette:i,...s}=Bk({...r,palette:{mode:a,...n?.palette},colorSpace:e});return t[o]={...n,palette:i,opacity:{...Q4(a),...n?.opacity},overlays:n?.overlays||X4(a)},s}function Ose(e={},...t){const{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:o=!1,cssVarPrefix:a="mui",nativeColor:i=!1,shouldSkipGeneratingVar:s=kse,colorSchemeSelector:l=n.light&&n.dark?"media":void 0,rootSelector:d=":root",...u}=e,m=Object.keys(n)[0],g=r||(n.light&&m!=="light"?"light":m),y=Mse(a),{[g]:x,light:w,dark:S,...b}=n,$={...b};let k=x;if((g==="dark"&&!("dark"in n)||g==="light"&&!("light"in n))&&(k=!0),!k)throw new Error(fc(21,g));let R;i&&(R="oklch");const O=gC(R,$,k,u,g);w&&!$.light&&gC(R,$,w,void 0,"light"),S&&!$.dark&&gC(R,$,S,void 0,"dark");let P={defaultColorScheme:g,...O,cssVarPrefix:a,colorSchemeSelector:l,rootSelector:d,getCssVar:y,colorSchemes:$,font:{...ose(O.typography),...O.font},spacing:Tse(u.spacing)};Object.keys(P.colorSchemes).forEach(_=>{const E=P.colorSchemes[_].palette,z=U=>{const N=U.split("-"),q=N[1],Y=N[2];return y(U,E[q][Y])};E.mode==="light"&&(mt(E.common,"background","#fff"),mt(E.common,"onBackground","#000")),E.mode==="dark"&&(mt(E.common,"background","#000"),mt(E.common,"onBackground","#fff"));function I(U,N,q){if(R){let Y;return U===ad&&(Y=`transparent ${((1-q)*100).toFixed(0)}%`),U===Or&&(Y=`#000 ${(q*100).toFixed(0)}%`),U===Pr&&(Y=`#fff ${(q*100).toFixed(0)}%`),`color-mix(in ${R}, ${N}, ${Y})`}return U(N,q)}if(Rse(E,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),E.mode==="light"){mt(E.Alert,"errorColor",I(Or,E.error.light,.6)),mt(E.Alert,"infoColor",I(Or,E.info.light,.6)),mt(E.Alert,"successColor",I(Or,E.success.light,.6)),mt(E.Alert,"warningColor",I(Or,E.warning.light,.6)),mt(E.Alert,"errorFilledBg",z("palette-error-main")),mt(E.Alert,"infoFilledBg",z("palette-info-main")),mt(E.Alert,"successFilledBg",z("palette-success-main")),mt(E.Alert,"warningFilledBg",z("palette-warning-main")),mt(E.Alert,"errorFilledColor",al(()=>E.getContrastText(E.error.main))),mt(E.Alert,"infoFilledColor",al(()=>E.getContrastText(E.info.main))),mt(E.Alert,"successFilledColor",al(()=>E.getContrastText(E.success.main))),mt(E.Alert,"warningFilledColor",al(()=>E.getContrastText(E.warning.main))),mt(E.Alert,"errorStandardBg",I(Pr,E.error.light,.9)),mt(E.Alert,"infoStandardBg",I(Pr,E.info.light,.9)),mt(E.Alert,"successStandardBg",I(Pr,E.success.light,.9)),mt(E.Alert,"warningStandardBg",I(Pr,E.warning.light,.9)),mt(E.Alert,"errorIconColor",z("palette-error-main")),mt(E.Alert,"infoIconColor",z("palette-info-main")),mt(E.Alert,"successIconColor",z("palette-success-main")),mt(E.Alert,"warningIconColor",z("palette-warning-main")),mt(E.AppBar,"defaultBg",z("palette-grey-100")),mt(E.Avatar,"defaultBg",z("palette-grey-400")),mt(E.Button,"inheritContainedBg",z("palette-grey-300")),mt(E.Button,"inheritContainedHoverBg",z("palette-grey-A100")),mt(E.Chip,"defaultBorder",z("palette-grey-400")),mt(E.Chip,"defaultAvatarColor",z("palette-grey-700")),mt(E.Chip,"defaultIconColor",z("palette-grey-700")),mt(E.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),mt(E.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),mt(E.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),mt(E.LinearProgress,"primaryBg",I(Pr,E.primary.main,.62)),mt(E.LinearProgress,"secondaryBg",I(Pr,E.secondary.main,.62)),mt(E.LinearProgress,"errorBg",I(Pr,E.error.main,.62)),mt(E.LinearProgress,"infoBg",I(Pr,E.info.main,.62)),mt(E.LinearProgress,"successBg",I(Pr,E.success.main,.62)),mt(E.LinearProgress,"warningBg",I(Pr,E.warning.main,.62)),mt(E.Skeleton,"bg",R?I(ad,E.text.primary,.11):`rgba(${z("palette-text-primaryChannel")} / 0.11)`),mt(E.Slider,"primaryTrack",I(Pr,E.primary.main,.62)),mt(E.Slider,"secondaryTrack",I(Pr,E.secondary.main,.62)),mt(E.Slider,"errorTrack",I(Pr,E.error.main,.62)),mt(E.Slider,"infoTrack",I(Pr,E.info.main,.62)),mt(E.Slider,"successTrack",I(Pr,E.success.main,.62)),mt(E.Slider,"warningTrack",I(Pr,E.warning.main,.62));const U=R?I(Or,E.background.default,.6825):Ob(E.background.default,.8);mt(E.SnackbarContent,"bg",U),mt(E.SnackbarContent,"color",al(()=>R?_k.text.primary:E.getContrastText(U))),mt(E.SpeedDialAction,"fabHoverBg",Ob(E.background.paper,.15)),mt(E.StepConnector,"border",z("palette-grey-400")),mt(E.StepContent,"border",z("palette-grey-400")),mt(E.Switch,"defaultColor",z("palette-common-white")),mt(E.Switch,"defaultDisabledColor",z("palette-grey-100")),mt(E.Switch,"primaryDisabledColor",I(Pr,E.primary.main,.62)),mt(E.Switch,"secondaryDisabledColor",I(Pr,E.secondary.main,.62)),mt(E.Switch,"errorDisabledColor",I(Pr,E.error.main,.62)),mt(E.Switch,"infoDisabledColor",I(Pr,E.info.main,.62)),mt(E.Switch,"successDisabledColor",I(Pr,E.success.main,.62)),mt(E.Switch,"warningDisabledColor",I(Pr,E.warning.main,.62)),mt(E.TableCell,"border",I(Pr,I(ad,E.divider,1),.88)),mt(E.Tooltip,"bg",I(ad,E.grey[700],.92))}if(E.mode==="dark"){mt(E.Alert,"errorColor",I(Pr,E.error.light,.6)),mt(E.Alert,"infoColor",I(Pr,E.info.light,.6)),mt(E.Alert,"successColor",I(Pr,E.success.light,.6)),mt(E.Alert,"warningColor",I(Pr,E.warning.light,.6)),mt(E.Alert,"errorFilledBg",z("palette-error-dark")),mt(E.Alert,"infoFilledBg",z("palette-info-dark")),mt(E.Alert,"successFilledBg",z("palette-success-dark")),mt(E.Alert,"warningFilledBg",z("palette-warning-dark")),mt(E.Alert,"errorFilledColor",al(()=>E.getContrastText(E.error.dark))),mt(E.Alert,"infoFilledColor",al(()=>E.getContrastText(E.info.dark))),mt(E.Alert,"successFilledColor",al(()=>E.getContrastText(E.success.dark))),mt(E.Alert,"warningFilledColor",al(()=>E.getContrastText(E.warning.dark))),mt(E.Alert,"errorStandardBg",I(Or,E.error.light,.9)),mt(E.Alert,"infoStandardBg",I(Or,E.info.light,.9)),mt(E.Alert,"successStandardBg",I(Or,E.success.light,.9)),mt(E.Alert,"warningStandardBg",I(Or,E.warning.light,.9)),mt(E.Alert,"errorIconColor",z("palette-error-main")),mt(E.Alert,"infoIconColor",z("palette-info-main")),mt(E.Alert,"successIconColor",z("palette-success-main")),mt(E.Alert,"warningIconColor",z("palette-warning-main")),mt(E.AppBar,"defaultBg",z("palette-grey-900")),mt(E.AppBar,"darkBg",z("palette-background-paper")),mt(E.AppBar,"darkColor",z("palette-text-primary")),mt(E.Avatar,"defaultBg",z("palette-grey-600")),mt(E.Button,"inheritContainedBg",z("palette-grey-800")),mt(E.Button,"inheritContainedHoverBg",z("palette-grey-700")),mt(E.Chip,"defaultBorder",z("palette-grey-700")),mt(E.Chip,"defaultAvatarColor",z("palette-grey-300")),mt(E.Chip,"defaultIconColor",z("palette-grey-300")),mt(E.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),mt(E.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),mt(E.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),mt(E.LinearProgress,"primaryBg",I(Or,E.primary.main,.5)),mt(E.LinearProgress,"secondaryBg",I(Or,E.secondary.main,.5)),mt(E.LinearProgress,"errorBg",I(Or,E.error.main,.5)),mt(E.LinearProgress,"infoBg",I(Or,E.info.main,.5)),mt(E.LinearProgress,"successBg",I(Or,E.success.main,.5)),mt(E.LinearProgress,"warningBg",I(Or,E.warning.main,.5)),mt(E.Skeleton,"bg",R?I(ad,E.text.primary,.13):`rgba(${z("palette-text-primaryChannel")} / 0.13)`),mt(E.Slider,"primaryTrack",I(Or,E.primary.main,.5)),mt(E.Slider,"secondaryTrack",I(Or,E.secondary.main,.5)),mt(E.Slider,"errorTrack",I(Or,E.error.main,.5)),mt(E.Slider,"infoTrack",I(Or,E.info.main,.5)),mt(E.Slider,"successTrack",I(Or,E.success.main,.5)),mt(E.Slider,"warningTrack",I(Or,E.warning.main,.5));const U=R?I(Pr,E.background.default,.985):Ob(E.background.default,.98);mt(E.SnackbarContent,"bg",U),mt(E.SnackbarContent,"color",al(()=>R?H4.text.primary:E.getContrastText(U))),mt(E.SpeedDialAction,"fabHoverBg",Ob(E.background.paper,.15)),mt(E.StepConnector,"border",z("palette-grey-600")),mt(E.StepContent,"border",z("palette-grey-600")),mt(E.Switch,"defaultColor",z("palette-grey-300")),mt(E.Switch,"defaultDisabledColor",z("palette-grey-600")),mt(E.Switch,"primaryDisabledColor",I(Or,E.primary.main,.55)),mt(E.Switch,"secondaryDisabledColor",I(Or,E.secondary.main,.55)),mt(E.Switch,"errorDisabledColor",I(Or,E.error.main,.55)),mt(E.Switch,"infoDisabledColor",I(Or,E.info.main,.55)),mt(E.Switch,"successDisabledColor",I(Or,E.success.main,.55)),mt(E.Switch,"warningDisabledColor",I(Or,E.warning.main,.55)),mt(E.TableCell,"border",I(Or,I(ad,E.divider,1),.68)),mt(E.Tooltip,"bg",I(ad,E.grey[700],.92))}nc(E.background,"default"),nc(E.background,"paper"),nc(E.common,"background"),nc(E.common,"onBackground"),nc(E,"divider"),Object.keys(E).forEach(U=>{const N=E[U];U!=="tonalOffset"&&N&&typeof N=="object"&&(N.main&&mt(E[U],"mainChannel",Cg(kg(N.main))),N.light&&mt(E[U],"lightChannel",Cg(kg(N.light))),N.dark&&mt(E[U],"darkChannel",Cg(kg(N.dark))),N.contrastText&&mt(E[U],"contrastTextChannel",Cg(kg(N.contrastText))),U==="text"&&(nc(E[U],"primary"),nc(E[U],"secondary")),U==="action"&&(N.active&&nc(E[U],"active"),N.selected&&nc(E[U],"selected")))})}),P=t.reduce((_,E)=>wa(_,E),P);const D={prefix:a,disableCssColorScheme:o,shouldSkipGeneratingVar:s,getSelector:Ese(P),enableContrastVars:i},{vars:A,generateThemeVars:F,generateStyleSheets:L}=rse(P,D);return P.vars=A,Object.entries(P.colorSchemes[P.defaultColorScheme]).forEach(([_,E])=>{P[_]=E}),P.generateThemeVars=F,P.generateStyleSheets=L,P.generateSpacing=function(){return tE(u.spacing,rR(this))},P.getColorSchemeSelector=ase(l),P.spacing=P.generateSpacing(),P.shouldSkipGeneratingVar=s,P.unstable_sxConfig={...Ky,...u?.unstable_sxConfig},P.unstable_sx=function(_){return Yp({sx:_,theme:this})},P.toRuntimeSource=K4,P}function CD(e,t,n){e.colorSchemes&&n&&(e.colorSchemes[t]={...n!==!0&&n,palette:iR({...n===!0?{}:n.palette,mode:t})})}function Z4(e={},...t){const{palette:n,cssVariables:r=!1,colorSchemes:o=n?void 0:{light:!0},defaultColorScheme:a=n?.mode,...i}=e,s=a||"light",l=o?.[s],d={...o,...n?{[s]:{...typeof l!="boolean"&&l,palette:n}}:void 0};if(r===!1){if(!("colorSchemes"in e))return Bk(e,...t);let u=n;"palette"in e||d[s]&&(d[s]!==!0?u=d[s].palette:s==="dark"&&(u={mode:"dark"}));const m=Bk({...e,palette:u},...t);return m.defaultColorScheme=s,m.colorSchemes=d,m.palette.mode==="light"&&(m.colorSchemes.light={...d.light!==!0&&d.light,palette:m.palette},CD(m,"dark",d.dark)),m.palette.mode==="dark"&&(m.colorSchemes.dark={...d.dark!==!0&&d.dark,palette:m.palette},CD(m,"light",d.light)),m}return!n&&!("light"in d)&&s==="light"&&(d.light=!0),Ose({...i,colorSchemes:d,defaultColorScheme:s,...typeof r!="boolean"&&r},...t)}const f1=Z4(),vh="$$material";function Qd(){const e=dh(f1);return e[vh]||e}function Pse(e){return p.jsx(rE,{...e,defaultTheme:f1,themeId:vh})}function jse(e){const{variants:t,...n}=e,r={variants:t,style:Rd(n),isProcessed:!0};return r.style===n||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=Rd(o.style))}),r}const Ase=sR();function yC(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function Sd(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function Dse(e){return e?(t,n)=>n[e]:null}function Nse(e,t,n){e.theme=Lse(e.theme)?n:e.theme[t]||e.theme}function f0(e,t,n){const r=typeof t=="function"?t(e):t;if(Array.isArray(r))return r.flatMap(o=>f0(e,o,n));if(Array.isArray(r?.variants)){let o;if(r.isProcessed)o=n?Sd(r.style,n):r.style;else{const{variants:a,...i}=r;o=n?Sd(Rd(i),n):i}return J4(e,r.variants,[o],n)}return r?.isProcessed?n?Sd(Rd(r.style),n):r.style:n?Sd(Rd(r),n):r}function J4(e,t,n=[],r=void 0){let o;e:for(let a=0;a<t.length;a+=1){const i=t[a];if(typeof i.props=="function"){if(o??={...e,...e.ownerState,ownerState:e.ownerState},!i.props(o))continue}else for(const s in i.props)if(e[s]!==i.props[s]&&e.ownerState?.[s]!==i.props[s])continue e;typeof i.style=="function"?(o??={...e,...e.ownerState,ownerState:e.ownerState},n.push(r?Sd(Rd(i.style(o)),r):i.style(o))):n.push(r?Sd(Rd(i.style),r):i.style)}return n}function Ise(e={}){const{themeId:t,defaultTheme:n=Ase,rootShouldForwardProp:r=yC,slotShouldForwardProp:o=yC}=e;function a(i){Nse(i,t,n)}return(i,s={})=>{_ie(i,O=>O.filter(P=>P!==Yp));const{name:l,slot:d,skipVariantsResolver:u,skipSx:m,overridesResolver:g=Dse(Fse(d)),...y}=s,x=l&&l.startsWith("Mui")||d?"components":"custom",w=u!==void 0?u:d&&d!=="Root"&&d!=="root"||!1,S=m||!1;let b=yC;d==="Root"||d==="root"?b=r:d?b=o:zse(i)&&(b=void 0);const $=Fie(i,{shouldForwardProp:b,label:void 0,...y}),k=O=>{if(O.__emotion_real===O)return O;if(typeof O=="function")return function(P){return f0(P,O,P.theme.modularCssLayers?x:void 0)};if(pl(O)){const P=jse(O);return function(D){return P.variants?f0(D,P,D.theme.modularCssLayers?x:void 0):D.theme.modularCssLayers?Sd(P.style,x):P.style}}return O},R=(...O)=>{const P=[],D=O.map(k),A=[];if(P.push(a),l&&g&&A.push(function(_){const E=_.theme.components?.[l]?.styleOverrides;if(!E)return null;const z={};for(const I in E)z[I]=f0(_,E[I],_.theme.modularCssLayers?"theme":void 0);return g(_,z)}),l&&!w&&A.push(function(_){const E=_.theme?.components?.[l]?.variants;return E?J4(_,E,[],_.theme.modularCssLayers?"theme":void 0):null}),S||A.push(Yp),Array.isArray(D[0])){const _=D.shift(),E=new Array(P.length).fill(""),z=new Array(A.length).fill("");let I;I=[...E,..._,...z],I.raw=[...E,..._.raw,...z],P.unshift(I)}const F=[...P,...D,...A],L=$(...F);return i.muiName&&(L.muiName=i.muiName),L};return $.withConfig&&(R.withConfig=$.withConfig),R}}function Lse(e){for(const t in e)return!1;return!0}function zse(e){return typeof e=="string"&&e.charCodeAt(0)>96}function Fse(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function eF(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const gs=e=>eF(e)&&e!=="classes",ot=Ise({themeId:vh,defaultTheme:f1,rootShouldForwardProp:gs});function _se(e){return function(t){return p.jsx(Pse,{styles:typeof e=="function"?n=>e({theme:n,...t}):e})}}function Bse(){return bie}const rr=k5;function tr(e){return Hie(e)}function vn(e,t,n="Mui"){const r={};return t.forEach(o=>{r[o]=kn(e,o,n)}),r}function Use(e){return kn("MuiSvgIcon",e)}vn("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Vse=e=>{const{color:t,fontSize:n,classes:r}=e,o={root:["root",t!=="inherit"&&`color${zt(t)}`,`fontSize${zt(n)}`]};return Sn(o,Use,r)},qse=ot("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${zt(n.color)}`],t[`fontSize${zt(n.fontSize)}`]]}})(rr(({theme:e})=>({userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:e.transitions?.create?.("fill",{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:t=>!t.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:e.typography?.pxToRem?.(20)||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:e.typography?.pxToRem?.(24)||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:e.typography?.pxToRem?.(35)||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,t])=>t&&t.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:"action"},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:"disabled"},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}))),U0=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiSvgIcon"}),{children:r,className:o,color:a="inherit",component:i="svg",fontSize:s="medium",htmlColor:l,inheritViewBox:d=!1,titleAccess:u,viewBox:m="0 0 24 24",...g}=n,y=C.isValidElement(r)&&r.type==="svg",x={...n,color:a,component:i,fontSize:s,instanceFontSize:e.fontSize,inheritViewBox:d,viewBox:m,hasSvgAsChild:y},w={};d||(w.viewBox=m);const S=Vse(x);return p.jsxs(qse,{as:i,className:Ht(S.root,o),focusable:"false",color:l,"aria-hidden":u?void 0:!0,role:u?"img":void 0,ref:t,...w,...g,...y&&r.props,ownerState:x,children:[y?r.props.children:r,u?p.jsx("title",{children:u}):null]})});U0.muiName="SvgIcon";function rn(e,t){function n(r,o){return p.jsx(U0,{"data-testid":void 0,ref:o,...r,children:e})}return n.muiName=U0.muiName,C.memo(C.forwardRef(n))}function tF(e,t=166){let n;function r(...o){const a=()=>{e.apply(this,o)};clearTimeout(n),n=setTimeout(a,t)}return r.clear=()=>{clearTimeout(n)},r}function p0(e,t){return C.isValidElement(e)&&t.indexOf(e.type.muiName??e.type?._payload?.value?.muiName)!==-1}function Wo(e){return e&&e.ownerDocument||document}function hc(e){return Wo(e).defaultView||window}function Vk(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Ji(e){const{controlled:t,default:n,name:r,state:o="value"}=e,{current:a}=C.useRef(t!==void 0),[i,s]=C.useState(n),l=a?t:i,d=C.useCallback(u=>{a||s(u)},[]);return[l,d]}function Yt(e){const t=C.useRef(e);return Yo(()=>{t.current=e}),C.useRef((...n)=>(0,t.current)(...n)).current}function vr(...e){const t=C.useRef(void 0),n=C.useCallback(r=>{const o=e.map(a=>{if(a==null)return null;if(typeof a=="function"){const i=a,s=i(r);return typeof s=="function"?s:()=>{i(null)}}return a.current=r,()=>{a.current=null}});return()=>{o.forEach(a=>a?.())}},e);return C.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}function Hse(e,t){const n=e.charCodeAt(2);return e[0]==="o"&&e[1]==="n"&&n>=65&&n<=90&&typeof t=="function"}function Wse(e,t){if(!e)return t;function n(i,s){const l={};return Object.keys(s).forEach(d=>{Hse(d,s[d])&&typeof i[d]=="function"&&(l[d]=(...u)=>{i[d](...u),s[d](...u)})}),l}if(typeof e=="function"||typeof t=="function")return i=>{const s=typeof t=="function"?t(i):t,l=typeof e=="function"?e({...i,...s}):e,d=Ht(i?.className,s?.className,l?.className),u=n(l,s);return{...s,...l,...u,...!!d&&{className:d},...s?.style&&l?.style&&{style:{...s.style,...l.style}},...s?.sx&&l?.sx&&{sx:[...Array.isArray(s.sx)?s.sx:[s.sx],...Array.isArray(l.sx)?l.sx:[l.sx]]}}};const r=t,o=n(e,r),a=Ht(r?.className,e?.className);return{...t,...e,...o,...!!a&&{className:a},...r?.style&&e?.style&&{style:{...r.style,...e.style}},...r?.sx&&e?.sx&&{sx:[...Array.isArray(r.sx)?r.sx:[r.sx],...Array.isArray(e.sx)?e.sx:[e.sx]]}}}const p1=rn(p.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"})),Yse=2,Gse=24,ARe=(e,t,n)=>Math.min(Math.max(e+t,1),Math.min(n,Gse)),vl=16,DRe=vl/2;function Kse(e,t){const n=Math.min(e.colspan??1,t);return e.break?`1 / span ${n}`:`span ${n}`}const lR=80,Qse=3,NRe=2,IRe=1,Xse=16,nF=e=>e*lR+(e-1)*vl,LRe=(e,t=Qse)=>Math.min(Math.max(Math.round((e+vl)/(lR+vl)),t),Xse),rF=240;function zRe(e,t,n=rF){const[r,o]=C.useState(0);return C.useEffect(()=>{const a=e.current;if(!a||typeof ResizeObserver>"u")return;o(a.getBoundingClientRect().width);const i=new ResizeObserver(([s])=>o(s?.contentRect.width??0));return i.observe(a),()=>i.disconnect()},[e]),oF(t,r,n)}function oF(e,t,n){if(!(t>0)||e<=1)return 1;const r=(t-(e-1)*vl)/e;return Math.min(e,Math.max(1,Math.ceil((n+vl)/(r+vl))))}const aF={query:5,text:2},iF=e=>e.some(t=>t.row!==void 0);function Zse(e,t,n){const r=Math.min(e.colspan??1,t),o=e.col===void 0?void 0:Math.min(e.col,t-r+1);return{gridRow:e.row===void 0?`span ${n}`:`${e.row} / span ${n}`,gridColumn:o===void 0?`span ${r}`:`${o} / span ${r}`}}const Jse=e=>e.row===void 0?1e6:e.row*1e3+(e.col??0);function ele({tiles:e,columns:t,keyOf:n,renderTile:r,minTilePx:o,rowGapPx:a=vl,defaultRowspan:i=s=>aF[s.kind==="text"?"text":"query"]}){const s=iF(e),l=C.useRef(null),[d,u]=C.useState(0);C.useEffect(()=>{const g=l.current;if(o===void 0||!g||typeof ResizeObserver>"u")return;const y=new ResizeObserver(([x])=>u(x?.contentRect.width??0));return y.observe(g),()=>y.disconnect()},[o]);const m=o===void 0?1:oF(t,d,o);return p.jsx(Ee,{ref:l,sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:`repeat(${t}, minmax(0, 1fr))`},columnGap:`${vl}px`,rowGap:`${a}px`,...s&&{gridAutoRows:`${lR}px`}},children:e.map((g,y)=>p.jsx(Ee,{sx:{display:"grid",minWidth:0,...!s&&g.rowspan!==void 0&&{height:nF(g.rowspan),alignSelf:"start"},...(s||g.rowspan!==void 0)&&{gridTemplateRows:"minmax(0, 1fr)"},...s?(()=>{const x=g.rowspan??i(g),w=Zse(g.colspan===void 0&&m>1?{...g,colspan:m}:g,t,x);return{gridRow:{xs:`span ${x}`,md:w.gridRow},gridColumn:{md:w.gridColumn},order:{xs:Jse(g),md:0}}})():{gridColumn:{md:Kse(g.colspan===void 0&&m>1?{...g,colspan:m}:g,t)}}},children:r(g,y)},n(g,y)))})}function h1(e){let t="",n=0;for(;;){const r=e.indexOf('"',n);if(r<0)break;let o=r+1;for(;o<e.length&&e[o]!=='"';)o+=e[o]==="\\"?2:1;if(o>=e.length)break;t+=`${e.slice(n,r)}""`,n=o+1}return t+e.slice(n)}const sF=["bar_chart","line_chart","scatter_chart","shape_map","segment_map","big_value","sparkline","combo_chart"],cR=["line_chart","bar_chart","big_value","scatter_chart","shape_map","segment_map","combo_chart"],tle=e=>cR.includes(e),qk=new Set([...sF,"viz"]);function m1(e){const t=e.trim();if(!/^#[ \t]/.test(t)||/[{=]/.test(t))return;const n=t.slice(1).trim().split(/[ \t]+/),r=[];let o;for(const a of n)if(a.startsWith("-")){if(o!==void 0)return;const i=a.slice(1);if(!qk.has(i))return;r.push(i)}else{if(o!==void 0||!qk.has(a))return;o=a}return{negated:r,...o!==void 0&&{pick:o}}}function lF(e){const t=e.trim();return!/^#[ \t]/.test(t)||m1(t)?!1:(h1(t).match(/[A-Za-z_]+/g)??[]).some(n=>qk.has(n))}function FRe(){return["#",...cR.filter(e=>e!=="big_value").map(e=>`-${e}`)].join(" ")}function _Re(e,t){return["#",...cR.filter(n=>n!==e&&(t===void 0||t.includes(n)||e==="none"&&n==="big_value")).map(n=>`-${n}`),"-viz",...e==="none"?[]:[e]].join(" ")}function nle(e){return e.pick!==void 0?tle(e.pick)?e.pick:"custom":e.negated.includes("viz")?"none":"custom"}function rle(e){if(e.length===0)return"default";if(e.length>1)return"custom";const t=m1(e[0]);return t?nle(t):"custom"}function BRe(e){const t=e.filter(n=>m1(n));return e.some(lF)?"custom":t.length===0?void 0:rle(t)}const ole=/^#[ \t]*theme\.palette\.series[ \t]*=[ \t]*\[[ \t]*"(#[0-9A-Fa-f]{6})"[ \t]*\][ \t]*$/;function URe(e){return ole.exec(e.trim())?.[1]?.toLowerCase()}const VRe=e=>`# theme.palette.series=["${e.toLowerCase()}"]`,qRe="# -theme.palette.series",ale=e=>/^#[0-9A-Fa-f]{6}$/.test(e);function HRe(e){const t=e.trim().toLowerCase();if(ale(t))return t;const n=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(t);return n?`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`:void 0}const WRe=e=>e.filter(t=>m1(t)||lF(t)),bh=rn(p.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function Oo({open:e,onClose:t,title:n,description:r,maxWidth:o="sm",showClose:a=!1,actions:i,initialFocus:s,className:l,children:d}){const u=C.useId(),m=Hr().theme.ui;return p.jsxs(Fx,{open:e,onClose:t,maxWidth:o,fullWidth:!0,"aria-labelledby":u,...l?{className:l}:{},PaperProps:{sx:{borderRadius:m.radius.dialog}},...s?{TransitionProps:{onEntered:()=>s.current?.focus()}}:{},children:[p.jsxs(Bx,{id:u,sx:{px:3,pt:3,pb:r?.5:1,display:"flex",alignItems:"center",justifyContent:"space-between",gap:1,fontSize:"1.25rem",fontWeight:"fontWeightMedium",letterSpacing:"-0.025em",lineHeight:1.2},children:[n,a&&p.jsx(no,{"aria-label":"Close",onClick:t,size:"small",sx:{color:"text.secondary",mr:-1},children:p.jsx(bh,{fontSize:"small"})})]}),p.jsxs(_x,{sx:{px:3,pb:1,pt:1},children:[r&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:2},children:r}),p.jsx(Wn,{sx:{gap:2,pt:r?0:1},children:d})]}),i&&p.jsx(cz,{sx:{px:3,pb:3,pt:2,gap:1},children:i})]})}function YRe({open:e,canSave:t,onKeepEditing:n,onDiscard:r,onSaveAndExit:o}){return p.jsx(Oo,{open:e,onClose:n,title:"Leave with unsaved changes?",description:t&&o?"Your edits have not been saved. Save them, or leave without them.":"Leaving now discards your unsaved edits.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{onClick:n,children:"Keep editing"}),p.jsx(Hn,{color:"error",onClick:r,children:"Discard changes"}),t&&o&&p.jsx(Hn,{variant:"contained",onClick:o,children:"Save and exit"})]}),children:null})}const cF=rn(p.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}));function Qy({label:e,onClick:t,disabled:n}){return p.jsx(Hn,{variant:"contained",color:"primary",startIcon:p.jsx(p1,{}),onClick:t,disabled:n,"aria-label":`Add ${e.toLowerCase()}`,sx:{whiteSpace:"nowrap"},children:e})}function Xy({label:e,icon:t,onClick:n,disabled:r,disabledReason:o,ariaLabel:a,ariaHasPopup:i}){const s=p.jsx("span",{children:p.jsx(Hn,{variant:"outlined",startIcon:t,onClick:n,disabled:r,"aria-label":a,"aria-haspopup":i,sx:{whiteSpace:"nowrap"},children:e})});return r&&o?p.jsx(Br,{title:o,children:s}):s}const uF=rn(p.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),Zy="120ms",Jy={"@media (prefers-reduced-motion: reduce)":{transition:"none",animation:"none"}},GRe=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",ile={"@media (hover: none)":{opacity:1}},KRe=e=>e.palette.mode==="dark"?e.palette.error.main:e.palette.error.dark;vi.size.control;vi.size.chip;vi.radius.control;vi.radius.tile;vi.radius.dialog;vi.type;const sle="72ch",Xd=e=>e.replace(/^1px solid /,""),dF=(e,t)=>`color-mix(in srgb, ${Xd(e)}, ${t} 25%)`,g1={line_chart:"A line chart",bar_chart:"A bar chart",scatter_chart:"A scatter chart",combo_chart:"A bar and line chart"},lle={line:"line_chart",bar:"bar_chart",scatter:"scatter_chart",combo:"combo_chart"},cle=new Set(["x","y","y2","series"]);function Hk(e){const t=e.trim();return!t.startsWith("#")||t.startsWith("#(")||t.startsWith('#"')?[]:h1(t.slice(1)).split(/[\s{}[\],]+/).filter(Boolean)}function fF(e){const t=[];let n;for(const r of e)for(const o of Hk(r))if(o.startsWith("-")){const a=o.slice(1);a==="viz"&&(n=void 0);const i=t.indexOf(a);i>=0&&t.splice(i,1)}else if(o.startsWith("viz="))n=lle[o.slice(4)]??o;else if(g1[o]!==void 0||o==="big_value"){const a=t.indexOf(o);a>=0&&t.splice(a,1),t.push(o)}return n??t.at(-1)}function QRe(e){const t=fF(e);return t!==void 0&&g1[t]!==void 0}function ule(e,{groupBys:t,totals:n}){if(g1[e]!==void 0){if(e==="scatter_chart")return t===0&&n<2?"no_x_axis":void 0;if(t===0)return"no_x_axis";if(e==="combo_chart")return n===2?void 0:"combo_totals";if(n===0)return"no_y_axis"}}function dle(e){const t=e.trim();if(!t.startsWith("#(malloy)"))return!1;const n=h1(t.slice(9));let r="",o=0;for(const i of n)i==="{"||i==="["?o++:i==="}"||i==="]"?o=Math.max(0,o-1):o===0&&(r+=i==="="?" = ":i);const a=r.split(/\s+/);return a.some((i,s)=>i==="calculation"&&a[s-1]!=="=")}const Wk=e=>e!==void 0&&(e.kind==="measure"||(e.annotations??[]).some(t=>dle(t?.value??""))),fle=e=>e.kind==="join"||e.type?.kind==="array_type";function ple(e){const t=e.filter(Wk).length;return{groupBys:e.filter(n=>!Wk(n)&&!fle(n)).length,totals:t}}const kD=e=>cle.has(e.split("=")[0]);function hle(e){if(!e)return;let t;try{t=JSON.parse(e)}catch{return}const n=t?.schema?.fields;if(!Array.isArray(n)||n.length===0)return;const r=(t.annotations??[]).map(l=>l?.value).filter(l=>typeof l=="string"),o=fF(r),a=o&&g1[o];if(!o||!a||r.some(l=>Hk(l).some(kD))||n.some(l=>(l.annotations??[]).some(d=>Hk(d.value??"").some(kD))))return;const{groupBys:i,totals:s}=ple(n);switch(ule(o,{groupBys:i,totals:s})){case"no_x_axis":return`This chart has no field for the x-axis. ${a} needs a group by, such as a date or a category. Show it as big numbers or a table instead, or add a group by to its query.`;case"combo_totals":return`${a} needs exactly two totals, the first drawn as bars and the second as a line. This one has ${s}.`;case"no_y_axis":return`This chart has no total for the y-axis. ${a} needs at least one aggregate, such as a count or a sum.`;default:return}}const mle=rn(p.jsx("path",{d:"M4 9h4v11H4zm12 4h4v7h-4zm-6-9h4v16h-4z"})),gle=rn(p.jsx("path",{d:"m20.5 3-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5M15 19l-6-2.11V5l6 2.11z"})),yle=rn(p.jsx("path",{d:"m20.5 10 .5-2h-4l1-4h-2l-1 4h-4l1-4h-2L9 8H5l-.5 2h4l-1 4h-4L3 16h4l-1 4h2l1-4h4l-1 4h2l1-4h4l.5-2h-4l1-4zm-7 4h-4l1-4h4z"})),vle=rn([p.jsx("circle",{cx:"7",cy:"14",r:"3"},"0"),p.jsx("circle",{cx:"11",cy:"6",r:"3"},"1"),p.jsx("circle",{cx:"16.6",cy:"17.6",r:"3"},"2")]),Gp=rn(p.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"})),ble=rn(p.jsx("path",{d:"m3.5 18.49 6-6.01 4 4L22 6.92l-1.41-1.41-7.09 7.97-4-4L2 16.99z"})),xle=rn(p.jsx("path",{d:"M10 10.02h5V21h-5zM17 21h3c1.1 0 2-.9 2-2v-9h-5zm3-18H5c-1.1 0-2 .9-2 2v3h19V5c0-1.1-.9-2-2-2M3 19c0 1.1.9 2 2 2h3V10H3z"}));function vC(e){const t=e.replace(/_+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}function wle({chart:e}){const t={fontSize:16};switch(e){case"bar_chart":case"combo_chart":return p.jsx(mle,{sx:t});case"line_chart":case"sparkline":return p.jsx(ble,{sx:t});case"scatter_chart":return p.jsx(vle,{sx:t});case"shape_map":case"segment_map":return p.jsx(gle,{sx:t});case"big_value":return p.jsx(yle,{sx:t});default:return p.jsx(xle,{sx:t})}}function Sle({groups:e,query:t,onQuery:n,picked:r,onPick:o,onTake:a,searchRef:i,empty:s,footer:l,disabled:d=!1}){const{theme:u}=Hr(),m=u.ui,g=C.useId(),y=t.trim().toLowerCase(),x=C.useMemo(()=>e.map(O=>({...O,entries:O.entries.filter(P=>y===""||[P.name,P.title,O.label,O.detail??""].join(" ").toLowerCase().includes(y))})).filter(O=>O.entries.length>0),[e,y]),w=x.flatMap(O=>O.entries),S=C.useMemo(()=>new Map(e.flatMap(O=>O.entries).map((O,P)=>[O.key,`${g}-${P}`])),[e,g]),b=O=>S.get(O)??`${g}-none`,$=w.some(O=>O.key===r)?r:void 0,k=O=>{o(O),window.requestAnimationFrame(()=>window.document.getElementById(b(O))?.scrollIntoView({block:"nearest"}))},R=O=>{if(w.length===0)return;const P=w.findIndex(A=>A.key===$),D=P===-1?O===1?0:w.length-1:Math.min(w.length-1,Math.max(0,P+O));k(w[D].key)};return p.jsxs(Ee,{sx:{display:"flex",flexDirection:"column",minHeight:0,flex:1},children:[p.jsx(Ee,{sx:{p:1.5,pb:1},children:p.jsx(ki,{size:"small",fullWidth:!0,inputRef:i,placeholder:"Search the model",value:t,disabled:d,onChange:O=>n(O.target.value),onKeyDown:O=>{if(O.key==="ArrowDown")O.preventDefault(),R(1);else if(O.key==="ArrowUp")O.preventDefault(),R(-1);else if(O.key==="Enter"){const P=$??w[0]?.key;if(P===void 0)return;O.preventDefault(),a(P)}},inputProps:{"aria-label":"Search the model",role:"combobox","aria-controls":g,"aria-expanded":!0,...$!==void 0?{"aria-activedescendant":b($)}:{}},InputProps:{startAdornment:p.jsx(ME,{position:"start",children:p.jsx(Gp,{sx:{fontSize:18,color:"text.secondary"}})})}})}),p.jsxs(Ee,{id:g,role:"listbox","aria-label":"From the model",sx:{overflowY:"auto",flex:1,minHeight:0,pb:1},children:[e.length===0&&s,e.length>0&&x.length===0&&p.jsxs(wt,{variant:"body2",sx:{color:u.tileTitle,px:2,py:1},children:["No view matches “",t.trim(),"”."]}),x.map(O=>p.jsxs(Ee,{role:"group","aria-label":O.ariaLabel??O.label,children:[p.jsxs(Ee,{"aria-hidden":!0,sx:{px:2,pt:1.25,pb:.5,...m.type.caption,color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[p.jsx(Ee,{component:"span",sx:{...m.type.label,fontSize:"0.92em",letterSpacing:"0.04em",textTransform:"uppercase"},children:O.label.replace(/_+/g," ")}),O.detail&&` · ${O.detail}`]}),O.entries.map(P=>{const D=P.key===r;return p.jsxs(Ee,{id:b(P.key),role:"option","aria-selected":D,"aria-label":`${P.title} (${P.name})`,onClick:()=>{d||k(P.key)},onDoubleClick:()=>{d||a(P.key)},sx:A=>({display:"flex",alignItems:"center",gap:1.25,mx:.75,px:1.25,py:.75,borderRadius:m.radius.control,cursor:d?"default":"pointer",bgcolor:D?`color-mix(in srgb, ${u.accent} 9%, ${A.palette.background.paper})`:"transparent","&:hover":D||d?{}:{bgcolor:A.palette.action.hover}}),children:[p.jsx(Ee,{"aria-hidden":!0,sx:A=>({width:26,height:26,flex:"none",borderRadius:m.radius.control,display:"flex",alignItems:"center",justifyContent:"center",color:D?u.accent:A.palette.text.secondary,bgcolor:D?A.palette.background.paper:A.palette.action.hover,boxShadow:D?`inset 0 0 0 1px color-mix(in srgb, ${u.accent} 35%, transparent)`:"none"}),children:p.jsx(wle,{chart:P.chart})}),p.jsxs(Ee,{sx:{minWidth:0},children:[p.jsx(Ee,{sx:{...m.type.control,fontWeight:D?m.type.label.fontWeight:400,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:P.title}),p.jsx(Ee,{sx:{...m.type.code,color:"text.secondary"},children:P.name})]})]},P.key)})]},O.key)),y===""&&l]})]})}const Cle=new Set(["bar","line","chart","scatter_chart","combo"]),kle=new Set(["table","dashboard","shape_map","segment_map","list","list_detail","big_value","cell","link","image"]);function XRe(e,t){return t==="fill"?"container":t==="fixed"||!e?"content":Cle.has(e)?"container":"content"}function ZRe(e,t){return t==="fixed"?!0:t==="fill"?!1:e!==void 0&&kle.has(e)}function JRe(e){return e==="dashboard"?3:2}function $le(e,t){let n=e.firstElementChild;for(let r=1;r<t&&n;r++)n=n.firstElementChild;return n}function e2e(e,t){const n=$le(e,t);return n&&(n.scrollHeight||n.offsetHeight)||0}const pF=400,Ele=700,Rle=700;function Tle({renderAs:e,maxHeight:t,tableMaxHeight:n}){return e!=="table"||n===void 0?t:t===void 0?n:Math.min(t,n)}const Mle=600,Ole=800,Ple=400,jle=2e3;function Ale(e,t){const n=t??jle;return e===void 0?n:Math.min(e,n)}function $D({sizing:e,contentHeight:t,maxHeight:n,fillHeight:r,firstPaintHeight:o}){if(e==="container"){const i=n??Ple;return r!==void 0&&r>0?Math.min(i,r):i}if(t===void 0||t<=0)return Ale(n,o);const a=n===void 0?t:Math.min(n,t);return r===void 0?a:Math.max(a,r)}const Dle="data-publisher-tight",Nle="publisher-result-scroller";function Ile(e,t,n=1){return e===1&&t<=2&&n===1?void 0:e}function t2e(e,t,n,r=1){const o={...e},a=Ile(t,n,r);return a===void 0?delete o.colspan:o.colspan=a,o}function Lle(e,t){if(e==="linear")return{layout:"linear",columns:1,widths:!1,insertBetween:!0,tileMaxHeight:void 0,tableMaxHeight:Rle};const n=t??Yse;return{layout:"grid",columns:n,widths:n>1,insertBetween:!1,tileMaxHeight:pF,tableMaxHeight:void 0}}const hF="document.malloy",mF=e=>e.slice(0,e.lastIndexOf("/")+1),gF=(e,t)=>new URL(e,`https://malloy.invalid/${mF(t)}`).pathname.slice(1);function yF(e,t){const n=mF(t).split("/").filter(Boolean),r=e.split("/");let o=0;for(;o<n.length&&o<r.length-1&&n[o]===r[o];)o++;const a=n.length-o;return`${"../".repeat(a)}${r.slice(o).join("/")}`}function zle(e,t,n,r=hF,o=[n]){return e.sources.some(a=>a.base===t)?!0:e.imports.some(a=>a.kind==="names"?a.names.includes(t):o.includes(gF(a.from,r)))}function n2e(e,t,n,r=hF,o=[n]){const{imports:a}=e;if(zle(e,t,n,r,o))return a;const i=a.findIndex(s=>s.kind==="names"&&o.includes(gF(s.from,r)));return i<0?[...a,{kind:"names",names:[t],from:yF(n,r)}]:a.map((s,l)=>l===i&&s.kind==="names"?{...s,names:[...s.names,t]}:s)}const vF=rn(p.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"})),Fle=rn(p.jsx("path",{d:"M12 2C6.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 8m-5.5-2.5 7.51-3.49L17.5 6.5 9.99 9.99zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1"})),_le=600,ED=()=>typeof IntersectionObserver>"u";function Ble(e){for(let t=e.parentElement;t;t=t.parentElement){const{overflowY:n}=getComputedStyle(t);if((n==="auto"||n==="scroll")&&t.scrollHeight>t.clientHeight)return t}return null}function Ule(e=_le){const[t,n]=C.useState(ED),r=C.useRef(t),o=C.useRef(null),a=C.useCallback(i=>{if(o.current?.disconnect(),o.current=null,!i||r.current||ED())return;const s=i.getBoundingClientRect(),l=Ble(i),d=l?.getBoundingClientRect()??{top:0,bottom:window.innerHeight||document.documentElement.clientHeight};if(s.bottom>=d.top-e&&s.top<=d.bottom+e){r.current=!0,n(!0);return}const u=new IntersectionObserver(m=>{m.some(g=>g.isIntersecting)&&(r.current=!0,u.disconnect(),n(!0))},{root:l,rootMargin:`${e}px 0px`});u.observe(i),o.current=u},[e]);return C.useEffect(()=>()=>o.current?.disconnect(),[]),C.useEffect(()=>{if(t||typeof window>"u")return;const i=()=>{r.current=!0,o.current?.disconnect(),n(!0)};return window.addEventListener("beforeprint",i),()=>window.removeEventListener("beforeprint",i)},[t]),[a,t]}function bF({summary:e,detail:t}){return p.jsxs(xo,{severity:"error",sx:{"& .MuiAlert-message":{minWidth:0,flex:1}},children:[e!==void 0&&p.jsx(Ee,{sx:{mb:.5},children:e}),p.jsx(Ee,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:Fo,fontSize:"0.8125rem",color:"text.secondary"},children:t})]})}function Xa({error:e,context:t}){const n=e.data?.message||"Unknown error";return p.jsx(bF,{summary:t,detail:n})}function r2e(e){const t=Vle(e);return{name:e.name,type:e.type,...t===void 0?{}:{default:t},...e.label===void 0?{}:{label:e.label},...e.description===void 0?{}:{description:e.description},...e.control===void 0?{}:{control:e.control},...e.suggest?{suggest:{...e.suggest.source===void 0?{}:{source:e.suggest.source},...e.suggest.query===void 0?{}:{query:e.suggest.query},dimension:e.suggest.dimension}}:{},...e.rangeMin===void 0?{}:{rangeMin:e.rangeMin},...e.rangeMax===void 0?{}:{rangeMax:e.rangeMax}}}function Vle(e){return e.type?.startsWith("filter<")?e.default?.match(/^f(['"])([\s\S]*)\1$/)?.[2]??e.default:e.default}function uR(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/[\u0000-\u001f]/g,t=>qle[t]??Hle(t))}const qle={"\n":"\\n","\r":"\\r"," ":"\\t","\b":"\\b","\f":"\\f"},Hle=e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`;function Wle(e,t){if(e==null||e==="")return;const n=r=>`'${uR(r)}'`;switch(t===void 0?Yle(e):t.startsWith("filter<")?"filter":t){case"filter":return Gle(String(e));case"string":return n(String(e));case"number":{const r=typeof e=="number"?e:Number(e);return Number.isFinite(r)?String(r):void 0}case"boolean":return e===!0||e==="true"?"true":"false";case"date":{const r=RD(e);return r&&`@${r}`}case"timestamp":{const r=RD(e);if(!r)return;const o=e instanceof Date?e.toISOString().slice(11,19):/[T ](\d{2}:\d{2}(?::\d{2})?)/.exec(String(e))?.[1]??"00:00:00";return`@${r} ${o}`}default:return}}function Yle(e){if(typeof e=="string")return"string";if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(e instanceof Date&&!Number.isNaN(e.getTime()))return e.toISOString().slice(11,19)==="00:00:00"?"date":"timestamp"}function Gle(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];r==="\\"?t+=n+1<e.length?r+e[++n]:"\\\\":t+=r==="'"?"\\'":r}return`f'${t}'`}function RD(e){return e instanceof Date?Number.isNaN(e.getTime())?void 0:e.toISOString().slice(0,10):/^(\d{4}-\d{2}-\d{2})/.exec(String(e))?.[1]}const Kp="malloy-publisher.report-draft:",Qp={storage:()=>window.localStorage};function o2e(e){const{server:t,environmentName:n,packageName:r,versionId:o,path:a}=e;return`${t}|${n}/${r}@${o??""}/${a}`}function a2e(e){if(typeof e=="string"){h0(e);return}const{server:t,environmentName:n,packageName:r,path:o}=e,a=`${n}/${r}@`,i=e.versionId!==void 0?`${e.versionId}/${o}`:void 0;try{const s=Qp.storage(),l=[];for(let d=0;d<s.length;d++){const u=s.key(d);if(!u?.startsWith(Kp))continue;const m=u.slice(Kp.length),g=m.indexOf("|");if(g===-1)continue;const[y,x]=[m.slice(0,g),m.slice(g+1)];if(t!==void 0&&y!==t||!x.startsWith(a))continue;const w=x.slice(a.length);(i!==void 0?w!==i:w.slice(w.indexOf("/")+1)!==o)||l.push(u)}for(const d of l)s.removeItem(d)}catch{}}function i2e(){try{const e=`${Kp}probe`;return Qp.storage().setItem(e,"1"),Qp.storage().removeItem(e),!0}catch{return!1}}function Kle(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return`${e.length}:${(t>>>0).toString(36)}`}function Qle(e){try{const t=Qp.storage().getItem(Kp+e);if(!t)return;const n=JSON.parse(t);return n?.v===1&&n.document?n:void 0}catch{return}}function Xle(e,t){try{return Qp.storage().setItem(Kp+e,JSON.stringify(t)),!0}catch{return!1}}function h0(e){try{Qp.storage().removeItem(Kp+e)}catch{}}function bC(e,t){const n=e;for(const r of Object.keys(n))delete n[r];Object.assign(n,structuredClone(t))}function s2e(e,t,n){const[r,o]=C.useState(),[a,i]=C.useState(),[s,l]=C.useState(!1),d=C.useRef(void 0),u=C.useRef(void 0),m=C.useRef(!1),g=Kle(n),y=C.useRef(t);y.current=t;const x=C.useRef(!1);C.useEffect(()=>{if(e===void 0||x.current)return;x.current=!0;const R=Qle(e);if(!R)return;const O=y.current;if(JSON.stringify(R.document)===JSON.stringify(O.document)){h0(e);return}if(R.base!==g){d.current=R,o({savedAt:R.savedAt,stale:!0,pending:!0});return}O.update(P=>bC(P,R.document)),u.current=JSON.stringify(R.document),m.current=!0,o({savedAt:R.savedAt,stale:!1,pending:!1})},[e]);const{document:w,dirty:S}=t;C.useEffect(()=>{if(e===void 0||!x.current||d.current&&!S)return;if(d.current&&(d.current=void 0,o(void 0)),u.current!==void 0){const O=JSON.stringify(w);m.current?O===u.current&&(m.current=!1):O!==u.current&&(u.current=void 0,o(void 0))}if(!S){h0(e),i(void 0),l(!1);return}const R=Date.now();Xle(e,{v:1,document:w,base:g,savedAt:R})?(i(R),l(!1)):(i(void 0),l(!0))},[e,w,S,g]);const b=C.useCallback(()=>{const R=d.current;R&&(d.current=void 0,y.current.update(O=>bC(O,R.document)),u.current=JSON.stringify(R.document),m.current=!0,o(O=>O&&{...O,pending:!1}))},[]),$=C.useCallback(()=>{d.current||(u.current=void 0,o(void 0))},[]),k=C.useCallback(()=>{if(d.current&&e!==void 0){d.current=void 0,h0(e),o(void 0);return}const R=y.current;R.update(O=>bC(O,R.saved)),u.current=void 0,o(void 0)},[e]);return{keptAt:a,keeping:!s,restored:r,dismissRestored:$,discard:k,restoreOffered:b}}const Zle=(e,t)=>({...t,...e}),xF={emit:()=>{},listening:!1};function Yk(e,t){return t?{listening:!0,emit:n=>{try{t(Zle(n,e))}catch{}}}:xF}function Jle(e,t){const n=C.useRef(t);n.current=t;const r=t!==void 0,{path:o,layout:a}=e;return C.useMemo(()=>Yk({path:o,...a?{layout:a}:{}},r?i=>n.current?.(i):void 0),[o,a,r])}const wF=C.createContext(xF),y1=()=>C.useContext(wF);function V0(e){const t=e,n=typeof t?.status=="number"?t.status:typeof t?.response?.status=="number"?t.response.status:void 0;return n===void 0?t?.code==="ERR_NETWORK"?"network":"unknown":n===404?"not_found":n===401||n===403?"forbidden":n===501?"unsupported":n>=500?"server":n>=400?"invalid":"unknown"}var Gk={exports:{}},ece=Gk.exports,TD;function tce(){return TD||(TD=1,(function(e,t){(function(n,r){e.exports=r()})(ece,(function(){var n=1e3,r=6e4,o=36e5,a="millisecond",i="second",s="minute",l="hour",d="day",u="week",m="month",g="quarter",y="year",x="date",w="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,$={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(I){var U=["th","st","nd","rd"],N=I%100;return"["+I+(U[(N-20)%10]||U[N]||U[0])+"]"}},k=function(I,U,N){var q=String(I);return!q||q.length>=U?I:""+Array(U+1-q.length).join(N)+I},R={s:k,z:function(I){var U=-I.utcOffset(),N=Math.abs(U),q=Math.floor(N/60),Y=N%60;return(U<=0?"+":"-")+k(q,2,"0")+":"+k(Y,2,"0")},m:function I(U,N){if(U.date()<N.date())return-I(N,U);var q=12*(N.year()-U.year())+(N.month()-U.month()),Y=U.clone().add(q,m),oe=N-Y<0,Q=U.clone().add(q+(oe?-1:1),m);return+(-(q+(N-Y)/(oe?Y-Q:Q-Y))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:m,y,w:u,d,D:x,h:l,m:s,s:i,ms:a,Q:g}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},O="en",P={};P[O]=$;var D="$isDayjsObject",A=function(I){return I instanceof E||!(!I||!I[D])},F=function I(U,N,q){var Y;if(!U)return O;if(typeof U=="string"){var oe=U.toLowerCase();P[oe]&&(Y=oe),N&&(P[oe]=N,Y=oe);var Q=U.split("-");if(!Y&&Q.length>1)return I(Q[0])}else{var ae=U.name;P[ae]=U,Y=ae}return!q&&Y&&(O=Y),Y||!q&&O},L=function(I,U){if(A(I))return I.clone();var N=typeof U=="object"?U:{};return N.date=I,N.args=arguments,new E(N)},_=R;_.l=F,_.i=A,_.w=function(I,U){return L(I,{locale:U.$L,utc:U.$u,x:U.$x,$offset:U.$offset})};var E=(function(){function I(N){this.$L=F(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[D]=!0}var U=I.prototype;return U.parse=function(N){this.$d=(function(q){var Y=q.date,oe=q.utc;if(Y===null)return new Date(NaN);if(_.u(Y))return new Date;if(Y instanceof Date)return new Date(Y);if(typeof Y=="string"&&!/Z$/i.test(Y)){var Q=Y.match(S);if(Q){var ae=Q[2]-1||0,de=(Q[7]||"0").substring(0,3);return oe?new Date(Date.UTC(Q[1],ae,Q[3]||1,Q[4]||0,Q[5]||0,Q[6]||0,de)):new Date(Q[1],ae,Q[3]||1,Q[4]||0,Q[5]||0,Q[6]||0,de)}}return new Date(Y)})(N),this.init()},U.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},U.$utils=function(){return _},U.isValid=function(){return this.$d.toString()!==w},U.isSame=function(N,q){var Y=L(N);return this.startOf(q)<=Y&&Y<=this.endOf(q)},U.isAfter=function(N,q){return L(N)<this.startOf(q)},U.isBefore=function(N,q){return this.endOf(q)<L(N)},U.$g=function(N,q,Y){return _.u(N)?this[q]:this.set(Y,N)},U.unix=function(){return Math.floor(this.valueOf()/1e3)},U.valueOf=function(){return this.$d.getTime()},U.startOf=function(N,q){var Y=this,oe=!!_.u(q)||q,Q=_.p(N),ae=function(ie,fe){var he=_.w(Y.$u?Date.UTC(Y.$y,fe,ie):new Date(Y.$y,fe,ie),Y);return oe?he:he.endOf(d)},de=function(ie,fe){return _.w(Y.toDate()[ie].apply(Y.toDate("s"),(oe?[0,0,0,0]:[23,59,59,999]).slice(fe)),Y)},X=this.$W,se=this.$M,J=this.$D,Z="set"+(this.$u?"UTC":"");switch(Q){case y:return oe?ae(1,0):ae(31,11);case m:return oe?ae(1,se):ae(0,se+1);case u:var G=this.$locale().weekStart||0,ue=(X<G?X+7:X)-G;return ae(oe?J-ue:J+(6-ue),se);case d:case x:return de(Z+"Hours",0);case l:return de(Z+"Minutes",1);case s:return de(Z+"Seconds",2);case i:return de(Z+"Milliseconds",3);default:return this.clone()}},U.endOf=function(N){return this.startOf(N,!1)},U.$set=function(N,q){var Y,oe=_.p(N),Q="set"+(this.$u?"UTC":""),ae=(Y={},Y[d]=Q+"Date",Y[x]=Q+"Date",Y[m]=Q+"Month",Y[y]=Q+"FullYear",Y[l]=Q+"Hours",Y[s]=Q+"Minutes",Y[i]=Q+"Seconds",Y[a]=Q+"Milliseconds",Y)[oe],de=oe===d?this.$D+(q-this.$W):q;if(oe===m||oe===y){var X=this.clone().set(x,1);X.$d[ae](de),X.init(),this.$d=X.set(x,Math.min(this.$D,X.daysInMonth())).$d}else ae&&this.$d[ae](de);return this.init(),this},U.set=function(N,q){return this.clone().$set(N,q)},U.get=function(N){return this[_.p(N)]()},U.add=function(N,q){var Y,oe=this;N=Number(N);var Q=_.p(q),ae=function(se){var J=L(oe);return _.w(J.date(J.date()+Math.round(se*N)),oe)};if(Q===m)return this.set(m,this.$M+N);if(Q===y)return this.set(y,this.$y+N);if(Q===d)return ae(1);if(Q===u)return ae(7);var de=(Y={},Y[s]=r,Y[l]=o,Y[i]=n,Y)[Q]||1,X=this.$d.getTime()+N*de;return _.w(X,this)},U.subtract=function(N,q){return this.add(-1*N,q)},U.format=function(N){var q=this,Y=this.$locale();if(!this.isValid())return Y.invalidDate||w;var oe=N||"YYYY-MM-DDTHH:mm:ssZ",Q=_.z(this),ae=this.$H,de=this.$m,X=this.$M,se=Y.weekdays,J=Y.months,Z=Y.meridiem,G=function(fe,he,me,le){return fe&&(fe[he]||fe(q,oe))||me[he].slice(0,le)},ue=function(fe){return _.s(ae%12||12,fe,"0")},ie=Z||function(fe,he,me){var le=fe<12?"AM":"PM";return me?le.toLowerCase():le};return oe.replace(b,(function(fe,he){return he||(function(me){switch(me){case"YY":return String(q.$y).slice(-2);case"YYYY":return _.s(q.$y,4,"0");case"M":return X+1;case"MM":return _.s(X+1,2,"0");case"MMM":return G(Y.monthsShort,X,J,3);case"MMMM":return G(J,X);case"D":return q.$D;case"DD":return _.s(q.$D,2,"0");case"d":return String(q.$W);case"dd":return G(Y.weekdaysMin,q.$W,se,2);case"ddd":return G(Y.weekdaysShort,q.$W,se,3);case"dddd":return se[q.$W];case"H":return String(ae);case"HH":return _.s(ae,2,"0");case"h":return ue(1);case"hh":return ue(2);case"a":return ie(ae,de,!0);case"A":return ie(ae,de,!1);case"m":return String(de);case"mm":return _.s(de,2,"0");case"s":return String(q.$s);case"ss":return _.s(q.$s,2,"0");case"SSS":return _.s(q.$ms,3,"0");case"Z":return Q}return null})(fe)||Q.replace(":","")}))},U.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},U.diff=function(N,q,Y){var oe,Q=this,ae=_.p(q),de=L(N),X=(de.utcOffset()-this.utcOffset())*r,se=this-de,J=function(){return _.m(Q,de)};switch(ae){case y:oe=J()/12;break;case m:oe=J();break;case g:oe=J()/3;break;case u:oe=(se-X)/6048e5;break;case d:oe=(se-X)/864e5;break;case l:oe=se/o;break;case s:oe=se/r;break;case i:oe=se/n;break;default:oe=se}return Y?oe:_.a(oe)},U.daysInMonth=function(){return this.endOf(m).$D},U.$locale=function(){return P[this.$L]},U.locale=function(N,q){if(!N)return this.$L;var Y=this.clone(),oe=F(N,q,!0);return oe&&(Y.$L=oe),Y},U.clone=function(){return _.w(this.$d,this)},U.toDate=function(){return new Date(this.valueOf())},U.toJSON=function(){return this.isValid()?this.toISOString():null},U.toISOString=function(){return this.$d.toISOString()},U.toString=function(){return this.$d.toUTCString()},I})(),z=E.prototype;return L.prototype=z,[["$ms",a],["$s",i],["$m",s],["$H",l],["$W",d],["$M",m],["$y",y],["$D",x]].forEach((function(I){z[I[1]]=function(U){return this.$g(U,I[0],I[1])}})),L.extend=function(I,U){return I.$i||(I(U,E,L),I.$i=!0),L},L.locale=F,L.isDayjs=A,L.unix=function(I){return L(1e3*I)},L.en=P[O],L.Ls=P,L.p={},L}))})(Gk)),Gk.exports}var nce=tce();const jr=yc(nce);var Kk={exports:{}},rce=Kk.exports,MD;function oce(){return MD||(MD=1,(function(e,t){(function(n,r){e.exports=r()})(rce,(function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,o=/([+-]|\d\d)/g;return function(a,i,s){var l=i.prototype;s.utc=function(w){var S={date:w,utc:!0,args:arguments};return new i(S)},l.utc=function(w){var S=s(this.toDate(),{locale:this.$L,utc:!0});return w?S.add(this.utcOffset(),n):S},l.local=function(){return s(this.toDate(),{locale:this.$L,utc:!1})};var d=l.parse;l.parse=function(w){w.utc&&(this.$u=!0),this.$utils().u(w.$offset)||(this.$offset=w.$offset),d.call(this,w)};var u=l.init;l.init=function(){if(this.$u){var w=this.$d;this.$y=w.getUTCFullYear(),this.$M=w.getUTCMonth(),this.$D=w.getUTCDate(),this.$W=w.getUTCDay(),this.$H=w.getUTCHours(),this.$m=w.getUTCMinutes(),this.$s=w.getUTCSeconds(),this.$ms=w.getUTCMilliseconds()}else u.call(this)};var m=l.utcOffset;l.utcOffset=function(w,S){var b=this.$utils().u;if(b(w))return this.$u?0:b(this.$offset)?m.call(this):this.$offset;if(typeof w=="string"&&(w=(function(O){O===void 0&&(O="");var P=O.match(r);if(!P)return null;var D=(""+P[0]).match(o)||["-",0,0],A=D[0],F=60*+D[1]+ +D[2];return F===0?0:A==="+"?F:-F})(w),w===null))return this;var $=Math.abs(w)<=16?60*w:w;if($===0)return this.utc(S);var k=this.clone();if(S)return k.$offset=$,k.$u=!1,k;var R=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(k=this.local().add($+R,n)).$offset=$,k.$x.$localOffset=R,k};var g=l.format;l.format=function(w){var S=w||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,S)},l.valueOf=function(){var w=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*w},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var y=l.toDate;l.toDate=function(w){return w==="s"&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var x=l.diff;l.diff=function(w,S,b){if(w&&this.$u===w.$u)return x.call(this,w,S,b);var $=this.local(),k=s(w).local();return x.call($,k,S,b)}}}))})(Kk)),Kk.exports}var ace=oce();const dR=yc(ace);jr.extend(dR);function ou(e){return(e??"").startsWith("filter<")}function ice(e){const{parsed:t}=Mi.BooleanFilterExpression.parse(e);if(!(!t||t.not))return t.operator==="true"||t.operator==="false"?t.operator:void 0}function uu(e){const t=/^filter<(.+)>$/.exec(e??"");return t?t[1]:void 0}function fR(e){const t=e.filter(n=>n.trim()!=="");return t.length===0?"":Mi.StringFilterExpression.unparse({operator:"=",values:[...t]})}function SF(e){if(e.trim()==="")return[];const{parsed:t}=Mi.StringFilterExpression.parse(e);return kF(t)?t.values:[e]}function CF(e){return e===void 0||e.trim()===""?!0:kF(Mi.StringFilterExpression.parse(e).parsed)}function kF(e){return e!==null&&Mi.isStringCondition(e)&&e.operator==="="&&e.not!==!0}function sce(e){return Mi.NumberFilterExpression.unparse({operator:">=",values:[String(e)]})}function $F(e){const t=e.trim();if(t==="")return;const{parsed:n}=Mi.NumberFilterExpression.parse(t);if(n===null||n.operator!==">="||n.not===!0||n.values?.length!==1)return;const r=Number(n.values[0]);return Number.isFinite(r)?r:void 0}function lce(e,t){return Mi.NumberFilterExpression.unparse({operator:"range",startOperator:">=",startValue:String(e),endOperator:"<=",endValue:String(t)})}function EF(e){const t=e.trim();if(t==="")return;const{parsed:n}=Mi.NumberFilterExpression.parse(t);if(n===null||n.operator!=="range"||n.not===!0||n.startOperator!==">="||n.endOperator!=="<=")return;const r=Number(n.startValue),o=Number(n.endValue);return Number.isFinite(r)&&Number.isFinite(o)&&r<=o?[r,o]:void 0}const hy=[{key:"today",label:"Today",clause:{operator:"in",in:{moment:"today"}}},{key:"7d",label:"Last 7 days",clause:{operator:"in_last",units:"day",n:"7"}},{key:"30d",label:"Last 30 days",clause:{operator:"in_last",units:"day",n:"30"}},{key:"90d",label:"Last 90 days",clause:{operator:"in_last",units:"day",n:"90"}},{key:"12m",label:"Last 12 months",clause:{operator:"in_last",units:"month",n:"12"}}];function cce(e){const t=hy.find(n=>n.key===e);return t?Mi.TemporalFilterExpression.unparse(t.clause):void 0}function RF(e){const t=e.trim();if(t==="")return;const{parsed:n}=Mi.TemporalFilterExpression.parse(t);if(n!==null)for(const r of hy){const o=r.clause;if(o.operator===n.operator&&(o.operator==="in"&&n.operator==="in"&&n.not!==!0&&n.in.moment===o.in.moment||o.operator==="in_last"&&n.operator==="in_last"&&n.not!==!0&&n.units===o.units&&Number(n.n)===Number(o.n)))return r.key}}const uce=/^\d{4}-\d{2}-\d{2}$/;function dce(e,t){const n=jr.utc(t,"YYYY-MM-DD").add(1,"day");return Mi.TemporalFilterExpression.unparse({operator:"to",fromMoment:{moment:"literal",literal:e,units:"day"},toMoment:{moment:"literal",literal:n.format("YYYY-MM-DD"),units:"day"}})}function TF(e){const t=e.trim();if(t==="")return;const{parsed:n}=Mi.TemporalFilterExpression.parse(t);if(n===null||n.operator!=="to"||n.not===!0)return;const r=OD(n.fromMoment),o=OD(n.toMoment);if(r===void 0||o===void 0)return;const a=jr.utc(o,"YYYY-MM-DD").subtract(1,"day");if(!(!a.isValid()||a.isBefore(jr.utc(r,"YYYY-MM-DD"))))return{firstDay:r,lastDay:a.format("YYYY-MM-DD")}}function OD(e){return e.moment==="literal"&&uce.test(e.literal)?e.literal:void 0}const Ym="self";function MF(e){if(!e)return[];if(e.wasDimension&&!e.wasDimension())return[];const t=e.tag?.tag("drill");return t?(t.textArray("to")??[t.text("to")].filter(PD)).filter(PD):[]}function OF(e){const t=e.replace(/[-_]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}function PF(e){return e.tag?.tag("drill")?.text("given")??e.name}function v1(e){if(typeof e=="string"){const t=fR([e]);return t===""?void 0:t}if(typeof e=="boolean")return String(e);if(typeof e=="number")return Number.isFinite(e)?String(e):void 0;if(e instanceof Date){const t=e.toISOString();return t.slice(0,t.indexOf("T"))}}function Qk(e){return e instanceof Date?v1(e)??"":String(e)}function fce(e){if(!e||e.isHeader)return;const t=e.field;if(!t)return;const n=MF(t);if(n.length===0)return;const r=v1(e.value);if(r!==void 0)return{to:n,given:PF(t),value:r,rawValue:e.value,label:Qk(e.value)}}function PD(e){return typeof e=="string"&&e!==""}function pce(e,t){if(t!==void 0&&!ou(t)){if(t==="number"){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string"||e.trim()==="")return;const n=Number(e);return Number.isFinite(n)?n:void 0}if(t==="date"||t==="timestamp"||t==="timestamptz")return e instanceof Date?e:void 0;if(t==="boolean")return typeof e=="boolean"?e:e==="true"?!0:e==="false"?!1:void 0;if(typeof e=="string")return e.trim()===""?void 0:e;if(typeof e=="number")return Number.isFinite(e)?String(e):void 0;if(typeof e=="boolean")return String(e)}return uu(t)==="string"&&typeof e=="number"?Number.isFinite(e)?fR([String(e)]):void 0:uu(t)==="number"?typeof e=="number"?Number.isFinite(e)?String(e):void 0:typeof e!="string"||e.trim()===""?void 0:Number.isFinite(Number(e))?e.trim():void 0:v1(e)}function hce({declaredTypes:e,setGiven:t,documentName:n}){const r=y1(),o=C.useMemo(()=>{const l=new Map;for(const d of e.keys())l.has(d.toLowerCase())||l.set(d.toLowerCase(),d);return l},[e]),a=C.useCallback(l=>e.has(l)?l:o.get(l.toLowerCase()),[e,o]),i=C.useCallback(l=>a(l)!==void 0,[a]),s=C.useCallback((l,d)=>{const u=a(l);if(u===void 0){r.emit({type:"report.drill",to:"self",outcome:"unresolved"}),r.listening||console.warn(`# drill { to=self } tried to set '${l}', which '${n}' does not declare as a given. Name the given with 'given=' on the drill tag.`);return}const m=e.get(u),g=pce(d,m);if(g===void 0){r.emit({type:"report.drill",to:"self",outcome:"malformed"}),r.listening||console.warn(`Drill declined: ${JSON.stringify(d)} cannot be a value for given "${u}"`+(m?` of type ${m}`:""));return}t(u,g),r.emit({type:"report.drill",to:"self",outcome:"resolved"})},[e,n,a,t,r]);return{resolveGiven:a,canSelf:i,onSelf:s}}function jF(e,t){if(e!=null){if(e instanceof Date)return pR(e,t);if(!Array.isArray(e))return String(e)}}function mce(e,t){return new Date(Date.UTC(e.year(),e.month(),e.date(),t?.getUTCHours()??0,t?.getUTCMinutes()??0,t?.getUTCSeconds()??0,t?.getUTCMilliseconds()??0))}const gce=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(\d{1,2}):(\d{2})(?::(\d{2}))?(?:\.(\d{1,9}))?)?\s*(Z|[+-]\d{2}:?\d{2}|[+-]\d{2}|UTC|GMT)?$/i;function AF(e){const t=e.trim();return t===""?e:t.replace(/^(\d{4}-\d{1,2}-\d{1,2}[T\s]+\d{1,2}:\d{2}(?::\d{2})?(?:\.\d{1,9})?)\s+(\d{2}:?\d{2}|\d{2})$/,"$1+$2")}function yce(e,t=!1){const n=AF(e);if(n==="")return;const r=gce.exec(n);if(!r)return;const[,o,a,i,s,l,d,u,m]=r,g={year:Number(o),month:Number(a),day:Number(i),hour:Number(s??0),minute:Number(l??0),second:Number(d??0),milli:Number((u??"").slice(0,3).padEnd(3,"0")||0)},y=Date.UTC(g.year,g.month-1,g.day,g.hour,g.minute,g.second,g.milli),x=new Date(y);if(!(x.getUTCFullYear()===g.year&&x.getUTCMonth()===g.month-1&&x.getUTCDate()===g.day&&x.getUTCHours()===g.hour&&x.getUTCMinutes()===g.minute&&x.getUTCSeconds()===g.second)||m!==void 0&&s===void 0)return;const w=vce(m);if(w===void 0)return;const S=new Date(y-w*6e4);if(!(t&&m!==void 0&&S.getUTCDate()!==g.day))return S}function vce(e){if(e===void 0)return 0;const t=e.toUpperCase();if(t==="Z"||t==="UTC"||t==="GMT")return 0;const n=/^([+-])(\d{2}):?(\d{2})?$/.exec(t);if(!n)return;const r=Number(n[3]??0);if(r>59)return;const o=Number(n[2])*60+r,a=n[1]!=="-";if(!(o>(a?840:720)))return a?o:-o}function DF(e){return!bce.has(e??"")}const bce=new Set(["boolean","number","date","timestamp","timestamptz"]);function NF(e,t){if(t===""&&!DF(e))return null;if(ou(e))return t;switch(e){case"number":{const n=t.trim()===""?NaN:Number(t);return Number.isFinite(n)?n:t}case"boolean":return t==="true"?!0:t==="false"?!1:t;case"date":case"timestamp":case"timestamptz":{const n=AF(t);return yce(n,e==="date")??n}default:return t}}function m0(e,t){const n={};for(const[r,o]of e){const a=jF(o,t.get(r));a!==void 0&&(n[r]=a)}return n}function pR(e,t){const n=e.toISOString();switch(t){case"timestamptz":return n;case"timestamp":return n.slice(0,-1);default:return n.slice(0,10)}}function Zd(e,t,n){const r=n?new Set(n):void 0,o={};for(const[a,i]of e)r&&!r.has(a)||i!=null&&(Array.isArray(i)||(o[a]=i instanceof Date?pR(i,t.get(a)):i));return o}function hR(e,t,n){if(!t)return e;const r=n?new Set(n):void 0,o={...e};for(const[a,i]of Object.entries(t))r&&!r.has(a)||a in o||i===null||i===void 0||(o[a]=Array.isArray(i)?[...i]:i instanceof Date?pR(i,void 0):i);return o}function jD(e,t){const n=new Map;for(const[r,o]of Object.entries(e))t.has(r)&&n.set(r,NF(t.get(r),o));return n}function xC(e,t){const n=Array.from(e.keys()).filter(o=>!t.has(o));if(n.length===0)return e;const r=new Map(e);for(const o of n)r.delete(o);return r}function AD(e){return Object.entries(e??{}).sort(([t],[n])=>t<n?-1:1)}function xce(e,t,n){for(const r of n.keys())if(e[r]!==t[r])return!1;return!0}const wce=1500;function Pb(e,t){const n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(r=>e[r]===t[r])}function IF({declaredTypes:e,startingValues:t,params:n,onParamsChange:r,documentKey:o,autorun:a}){const i=C.useMemo(()=>jD(t??{},e),[e,JSON.stringify(t)]),s=C.useRef(null),l=C.useRef([]),d=C.useRef(0),u=C.useRef({documentKey:o,params:n}),m=U=>U!==null&&xce(n??{},U,e),g=Date.now();l.current=l.current.filter(U=>g-U.at<wce);const y=(s.current===null?l.current.map(U=>U.params):[...l.current.map(U=>U.params),s.current]).findIndex(m);u.current.documentKey!==o&&(l.current=[]),(u.current.documentKey!==o||!Pb(n??{},u.current.params??{})&&y<0)&&(u.current={documentKey:o,params:n}),y>0&&(l.current=l.current.slice(y));const x=u.current.params,w=JSON.stringify(t),S=JSON.stringify(x),b=C.useMemo(()=>jD({...t??{},...x??{}},e),[e,w,S]),$=C.useMemo(()=>JSON.stringify([o??null,AD(t),AD(x)]),[o,w,S]),[k,R]=C.useState(null),O=k?.key===$?k:null;C.useEffect(()=>{k!==null&&k.key!==$&&R(null)},[k,$]);const P=C.useMemo(()=>xC(O?.draft??b,e),[O,b,e]),D=C.useMemo(()=>xC(O?.applied??b,e),[O,b,e]),A=C.useCallback(U=>U?.key===$?U:{key:$,draft:b,applied:b},[$,b]),F=C.useMemo(()=>m0(D,e),[D,e]);s.current===null&&(s.current=F,d.current=Date.now()),C.useEffect(()=>{r&&(Pb(s.current??{},F)||(s.current!==null&&(l.current=[...l.current.slice(-31),{params:s.current,at:d.current}]),s.current=F,d.current=Date.now(),r(F)))},[F,r]);const L=C.useCallback((U,N)=>{R(q=>{const Y=A(q),oe=new Map(Y.draft);return N===null?oe.delete(U):oe.set(U,N),{key:Y.key,draft:oe,applied:a?oe:Y.applied}})},[a,A]),_=C.useCallback(()=>{R(U=>({key:A(U).key,draft:i,applied:i}))},[A,i]),E=C.useCallback(()=>{R(U=>{const N=A(U);return{key:N.key,draft:N.draft,applied:N.draft}})},[A]),z=C.useMemo(()=>{if(a)return!1;if(P.size!==D.size)return!0;for(const[U,N]of P){const q=D.get(U);if(N instanceof Date&&q instanceof Date){if(N.getTime()!==q.getTime())return!0}else if(Array.isArray(N)&&Array.isArray(q)){if(String(N)!==String(q))return!0}else if(N!==q)return!0}return!1},[a,P,D]),I=C.useMemo(()=>{const U=m0(xC(i,e),e);return Pb(m0(P,e),U)&&Pb(F,U)},[i,P,F,e]);return{draft:P,applied:D,setGiven:L,reset:_,apply:E,pending:z,atStart:I}}const Sce="You don't have access to this data";function l2e(e){return(e??[]).filter(t=>t.kind==="definition"&&!t.restricted).map(t=>t.text??"").join(`
349
+ export default theme;`}function SD(e){return typeof e=="number"?`${(e*100).toFixed(0)}%`:`calc((${e}) * 100%)`}const xse=e=>{if(!Number.isNaN(+e))return+e;const t=e.match(/\d*\.?\d+/g);if(!t)return 0;let n=0;for(let r=0;r<t.length;r+=1)n+=+t[r];return n};function wse(e){Object.assign(e,{alpha(t,n){const r=this||e;return r.colorSpace?`oklch(from ${t} l c h / ${typeof n=="string"?`calc(${n})`:n})`:r.vars?`rgba(${t.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g,"var(--$1Channel)")} / ${typeof n=="string"?`calc(${n})`:n})`:_0(t,xse(n))},lighten(t,n){const r=this||e;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${t}, #fff ${SD(n)})`:d1(t,n)},darken(t,n){const r=this||e;return r.colorSpace?`color-mix(in ${r.colorSpace}, ${t}, #000 ${SD(n)})`:u1(t,n)}})}function Bk(e={},...t){const{breakpoints:n,mixins:r={},spacing:o,palette:a={},transitions:i={},typography:s={},shape:l,colorSpace:d,...u}=e;if(e.vars&&e.generateThemeVars===void 0)throw new Error(fc(20));const m=iR({...a,colorSpace:d}),g=sR(e);let y=wa(g,{mixins:sse(g.breakpoints,r),palette:m,shadows:pse.slice(),typography:cse(m,s),transitions:yse(i),zIndex:{...vse}});return y=wa(y,u),y=t.reduce((x,w)=>wa(x,w),y),y.unstable_sxConfig={...Ky,...u?.unstable_sxConfig},y.unstable_sx=function(x){return Yp({sx:x,theme:this})},y.toRuntimeSource=K4,wse(y),y}function Uk(e){let t;return e<1?t=5.11916*e**2:t=4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}const Sse=[...Array(25)].map((e,t)=>{if(t===0)return"none";const n=Uk(t);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function Q4(e){return{inputPlaceholder:e==="dark"?.5:.42,inputUnderline:e==="dark"?.7:.42,switchTrackDisabled:e==="dark"?.2:.12,switchTrack:e==="dark"?.3:.38}}function X4(e){return e==="dark"?Sse:[]}function Cse(e){const{palette:t={mode:"light"},opacity:n,overlays:r,colorSpace:o,...a}=e,i=iR({...t,colorSpace:o});return{palette:i,opacity:{...Q4(i.mode),...n},overlays:r||X4(i.mode),...a}}function kse(e){return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]==="palette"&&!!e[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}const $se=e=>[...[...Array(25)].map((t,n)=>`--${e?`${e}-`:""}overlays-${n}`),`--${e?`${e}-`:""}palette-AppBar-darkBg`,`--${e?`${e}-`:""}palette-AppBar-darkColor`],Ese=e=>(t,n)=>{const r=e.rootSelector||":root",o=e.colorSchemeSelector;let a=o;if(o==="class"&&(a=".%s"),o==="data"&&(a="[data-%s]"),o?.startsWith("data-")&&!o.includes("%s")&&(a=`[${o}="%s"]`),e.defaultColorScheme===t){if(t==="dark"){const i={};return $se(e.cssVarPrefix).forEach(s=>{i[s]=n[s],delete n[s]}),a==="media"?{[r]:n,"@media (prefers-color-scheme: dark)":{[r]:i}}:a?{[a.replace("%s",t)]:i,[`${r}, ${a.replace("%s",t)}`]:n}:{[r]:{...n,...i}}}if(a&&a!=="media")return`${r}, ${a.replace("%s",String(t))}`}else if(t){if(a==="media")return{[`@media (prefers-color-scheme: ${String(t)})`]:{[r]:n}};if(a)return a.replace("%s",String(t))}return r};function Rse(e,t){t.forEach(n=>{e[n]||(e[n]={})})}function mt(e,t,n){!e[t]&&n&&(e[t]=n)}function kg(e){return typeof e!="string"||!e.startsWith("hsl")?e:V4(e)}function nc(e,t){`${t}Channel`in e||(e[`${t}Channel`]=Cg(kg(e[t])))}function Tse(e){return typeof e=="number"?`${e}px`:typeof e=="string"||typeof e=="function"||Array.isArray(e)?e:"8px"}const al=e=>{try{return e()}catch{}},Mse=(e="mui")=>E5(e);function gC(e,t,n,r,o){if(!n)return;n=n===!0?{}:n;const a=o==="dark"?"dark":"light";if(!r){t[o]=Cse({...n,palette:{mode:a,...n?.palette},colorSpace:e});return}const{palette:i,...s}=Bk({...r,palette:{mode:a,...n?.palette},colorSpace:e});return t[o]={...n,palette:i,opacity:{...Q4(a),...n?.opacity},overlays:n?.overlays||X4(a)},s}function Ose(e={},...t){const{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:o=!1,cssVarPrefix:a="mui",nativeColor:i=!1,shouldSkipGeneratingVar:s=kse,colorSchemeSelector:l=n.light&&n.dark?"media":void 0,rootSelector:d=":root",...u}=e,m=Object.keys(n)[0],g=r||(n.light&&m!=="light"?"light":m),y=Mse(a),{[g]:x,light:w,dark:S,...b}=n,$={...b};let k=x;if((g==="dark"&&!("dark"in n)||g==="light"&&!("light"in n))&&(k=!0),!k)throw new Error(fc(21,g));let R;i&&(R="oklch");const O=gC(R,$,k,u,g);w&&!$.light&&gC(R,$,w,void 0,"light"),S&&!$.dark&&gC(R,$,S,void 0,"dark");let P={defaultColorScheme:g,...O,cssVarPrefix:a,colorSchemeSelector:l,rootSelector:d,getCssVar:y,colorSchemes:$,font:{...ose(O.typography),...O.font},spacing:Tse(u.spacing)};Object.keys(P.colorSchemes).forEach(_=>{const E=P.colorSchemes[_].palette,z=U=>{const N=U.split("-"),q=N[1],Y=N[2];return y(U,E[q][Y])};E.mode==="light"&&(mt(E.common,"background","#fff"),mt(E.common,"onBackground","#000")),E.mode==="dark"&&(mt(E.common,"background","#000"),mt(E.common,"onBackground","#fff"));function I(U,N,q){if(R){let Y;return U===ad&&(Y=`transparent ${((1-q)*100).toFixed(0)}%`),U===Or&&(Y=`#000 ${(q*100).toFixed(0)}%`),U===Pr&&(Y=`#fff ${(q*100).toFixed(0)}%`),`color-mix(in ${R}, ${N}, ${Y})`}return U(N,q)}if(Rse(E,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),E.mode==="light"){mt(E.Alert,"errorColor",I(Or,E.error.light,.6)),mt(E.Alert,"infoColor",I(Or,E.info.light,.6)),mt(E.Alert,"successColor",I(Or,E.success.light,.6)),mt(E.Alert,"warningColor",I(Or,E.warning.light,.6)),mt(E.Alert,"errorFilledBg",z("palette-error-main")),mt(E.Alert,"infoFilledBg",z("palette-info-main")),mt(E.Alert,"successFilledBg",z("palette-success-main")),mt(E.Alert,"warningFilledBg",z("palette-warning-main")),mt(E.Alert,"errorFilledColor",al(()=>E.getContrastText(E.error.main))),mt(E.Alert,"infoFilledColor",al(()=>E.getContrastText(E.info.main))),mt(E.Alert,"successFilledColor",al(()=>E.getContrastText(E.success.main))),mt(E.Alert,"warningFilledColor",al(()=>E.getContrastText(E.warning.main))),mt(E.Alert,"errorStandardBg",I(Pr,E.error.light,.9)),mt(E.Alert,"infoStandardBg",I(Pr,E.info.light,.9)),mt(E.Alert,"successStandardBg",I(Pr,E.success.light,.9)),mt(E.Alert,"warningStandardBg",I(Pr,E.warning.light,.9)),mt(E.Alert,"errorIconColor",z("palette-error-main")),mt(E.Alert,"infoIconColor",z("palette-info-main")),mt(E.Alert,"successIconColor",z("palette-success-main")),mt(E.Alert,"warningIconColor",z("palette-warning-main")),mt(E.AppBar,"defaultBg",z("palette-grey-100")),mt(E.Avatar,"defaultBg",z("palette-grey-400")),mt(E.Button,"inheritContainedBg",z("palette-grey-300")),mt(E.Button,"inheritContainedHoverBg",z("palette-grey-A100")),mt(E.Chip,"defaultBorder",z("palette-grey-400")),mt(E.Chip,"defaultAvatarColor",z("palette-grey-700")),mt(E.Chip,"defaultIconColor",z("palette-grey-700")),mt(E.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),mt(E.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),mt(E.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),mt(E.LinearProgress,"primaryBg",I(Pr,E.primary.main,.62)),mt(E.LinearProgress,"secondaryBg",I(Pr,E.secondary.main,.62)),mt(E.LinearProgress,"errorBg",I(Pr,E.error.main,.62)),mt(E.LinearProgress,"infoBg",I(Pr,E.info.main,.62)),mt(E.LinearProgress,"successBg",I(Pr,E.success.main,.62)),mt(E.LinearProgress,"warningBg",I(Pr,E.warning.main,.62)),mt(E.Skeleton,"bg",R?I(ad,E.text.primary,.11):`rgba(${z("palette-text-primaryChannel")} / 0.11)`),mt(E.Slider,"primaryTrack",I(Pr,E.primary.main,.62)),mt(E.Slider,"secondaryTrack",I(Pr,E.secondary.main,.62)),mt(E.Slider,"errorTrack",I(Pr,E.error.main,.62)),mt(E.Slider,"infoTrack",I(Pr,E.info.main,.62)),mt(E.Slider,"successTrack",I(Pr,E.success.main,.62)),mt(E.Slider,"warningTrack",I(Pr,E.warning.main,.62));const U=R?I(Or,E.background.default,.6825):Ob(E.background.default,.8);mt(E.SnackbarContent,"bg",U),mt(E.SnackbarContent,"color",al(()=>R?_k.text.primary:E.getContrastText(U))),mt(E.SpeedDialAction,"fabHoverBg",Ob(E.background.paper,.15)),mt(E.StepConnector,"border",z("palette-grey-400")),mt(E.StepContent,"border",z("palette-grey-400")),mt(E.Switch,"defaultColor",z("palette-common-white")),mt(E.Switch,"defaultDisabledColor",z("palette-grey-100")),mt(E.Switch,"primaryDisabledColor",I(Pr,E.primary.main,.62)),mt(E.Switch,"secondaryDisabledColor",I(Pr,E.secondary.main,.62)),mt(E.Switch,"errorDisabledColor",I(Pr,E.error.main,.62)),mt(E.Switch,"infoDisabledColor",I(Pr,E.info.main,.62)),mt(E.Switch,"successDisabledColor",I(Pr,E.success.main,.62)),mt(E.Switch,"warningDisabledColor",I(Pr,E.warning.main,.62)),mt(E.TableCell,"border",I(Pr,I(ad,E.divider,1),.88)),mt(E.Tooltip,"bg",I(ad,E.grey[700],.92))}if(E.mode==="dark"){mt(E.Alert,"errorColor",I(Pr,E.error.light,.6)),mt(E.Alert,"infoColor",I(Pr,E.info.light,.6)),mt(E.Alert,"successColor",I(Pr,E.success.light,.6)),mt(E.Alert,"warningColor",I(Pr,E.warning.light,.6)),mt(E.Alert,"errorFilledBg",z("palette-error-dark")),mt(E.Alert,"infoFilledBg",z("palette-info-dark")),mt(E.Alert,"successFilledBg",z("palette-success-dark")),mt(E.Alert,"warningFilledBg",z("palette-warning-dark")),mt(E.Alert,"errorFilledColor",al(()=>E.getContrastText(E.error.dark))),mt(E.Alert,"infoFilledColor",al(()=>E.getContrastText(E.info.dark))),mt(E.Alert,"successFilledColor",al(()=>E.getContrastText(E.success.dark))),mt(E.Alert,"warningFilledColor",al(()=>E.getContrastText(E.warning.dark))),mt(E.Alert,"errorStandardBg",I(Or,E.error.light,.9)),mt(E.Alert,"infoStandardBg",I(Or,E.info.light,.9)),mt(E.Alert,"successStandardBg",I(Or,E.success.light,.9)),mt(E.Alert,"warningStandardBg",I(Or,E.warning.light,.9)),mt(E.Alert,"errorIconColor",z("palette-error-main")),mt(E.Alert,"infoIconColor",z("palette-info-main")),mt(E.Alert,"successIconColor",z("palette-success-main")),mt(E.Alert,"warningIconColor",z("palette-warning-main")),mt(E.AppBar,"defaultBg",z("palette-grey-900")),mt(E.AppBar,"darkBg",z("palette-background-paper")),mt(E.AppBar,"darkColor",z("palette-text-primary")),mt(E.Avatar,"defaultBg",z("palette-grey-600")),mt(E.Button,"inheritContainedBg",z("palette-grey-800")),mt(E.Button,"inheritContainedHoverBg",z("palette-grey-700")),mt(E.Chip,"defaultBorder",z("palette-grey-700")),mt(E.Chip,"defaultAvatarColor",z("palette-grey-300")),mt(E.Chip,"defaultIconColor",z("palette-grey-300")),mt(E.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),mt(E.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),mt(E.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),mt(E.LinearProgress,"primaryBg",I(Or,E.primary.main,.5)),mt(E.LinearProgress,"secondaryBg",I(Or,E.secondary.main,.5)),mt(E.LinearProgress,"errorBg",I(Or,E.error.main,.5)),mt(E.LinearProgress,"infoBg",I(Or,E.info.main,.5)),mt(E.LinearProgress,"successBg",I(Or,E.success.main,.5)),mt(E.LinearProgress,"warningBg",I(Or,E.warning.main,.5)),mt(E.Skeleton,"bg",R?I(ad,E.text.primary,.13):`rgba(${z("palette-text-primaryChannel")} / 0.13)`),mt(E.Slider,"primaryTrack",I(Or,E.primary.main,.5)),mt(E.Slider,"secondaryTrack",I(Or,E.secondary.main,.5)),mt(E.Slider,"errorTrack",I(Or,E.error.main,.5)),mt(E.Slider,"infoTrack",I(Or,E.info.main,.5)),mt(E.Slider,"successTrack",I(Or,E.success.main,.5)),mt(E.Slider,"warningTrack",I(Or,E.warning.main,.5));const U=R?I(Pr,E.background.default,.985):Ob(E.background.default,.98);mt(E.SnackbarContent,"bg",U),mt(E.SnackbarContent,"color",al(()=>R?H4.text.primary:E.getContrastText(U))),mt(E.SpeedDialAction,"fabHoverBg",Ob(E.background.paper,.15)),mt(E.StepConnector,"border",z("palette-grey-600")),mt(E.StepContent,"border",z("palette-grey-600")),mt(E.Switch,"defaultColor",z("palette-grey-300")),mt(E.Switch,"defaultDisabledColor",z("palette-grey-600")),mt(E.Switch,"primaryDisabledColor",I(Or,E.primary.main,.55)),mt(E.Switch,"secondaryDisabledColor",I(Or,E.secondary.main,.55)),mt(E.Switch,"errorDisabledColor",I(Or,E.error.main,.55)),mt(E.Switch,"infoDisabledColor",I(Or,E.info.main,.55)),mt(E.Switch,"successDisabledColor",I(Or,E.success.main,.55)),mt(E.Switch,"warningDisabledColor",I(Or,E.warning.main,.55)),mt(E.TableCell,"border",I(Or,I(ad,E.divider,1),.68)),mt(E.Tooltip,"bg",I(ad,E.grey[700],.92))}nc(E.background,"default"),nc(E.background,"paper"),nc(E.common,"background"),nc(E.common,"onBackground"),nc(E,"divider"),Object.keys(E).forEach(U=>{const N=E[U];U!=="tonalOffset"&&N&&typeof N=="object"&&(N.main&&mt(E[U],"mainChannel",Cg(kg(N.main))),N.light&&mt(E[U],"lightChannel",Cg(kg(N.light))),N.dark&&mt(E[U],"darkChannel",Cg(kg(N.dark))),N.contrastText&&mt(E[U],"contrastTextChannel",Cg(kg(N.contrastText))),U==="text"&&(nc(E[U],"primary"),nc(E[U],"secondary")),U==="action"&&(N.active&&nc(E[U],"active"),N.selected&&nc(E[U],"selected")))})}),P=t.reduce((_,E)=>wa(_,E),P);const D={prefix:a,disableCssColorScheme:o,shouldSkipGeneratingVar:s,getSelector:Ese(P),enableContrastVars:i},{vars:A,generateThemeVars:F,generateStyleSheets:L}=rse(P,D);return P.vars=A,Object.entries(P.colorSchemes[P.defaultColorScheme]).forEach(([_,E])=>{P[_]=E}),P.generateThemeVars=F,P.generateStyleSheets=L,P.generateSpacing=function(){return tE(u.spacing,rR(this))},P.getColorSchemeSelector=ase(l),P.spacing=P.generateSpacing(),P.shouldSkipGeneratingVar=s,P.unstable_sxConfig={...Ky,...u?.unstable_sxConfig},P.unstable_sx=function(_){return Yp({sx:_,theme:this})},P.toRuntimeSource=K4,P}function CD(e,t,n){e.colorSchemes&&n&&(e.colorSchemes[t]={...n!==!0&&n,palette:iR({...n===!0?{}:n.palette,mode:t})})}function Z4(e={},...t){const{palette:n,cssVariables:r=!1,colorSchemes:o=n?void 0:{light:!0},defaultColorScheme:a=n?.mode,...i}=e,s=a||"light",l=o?.[s],d={...o,...n?{[s]:{...typeof l!="boolean"&&l,palette:n}}:void 0};if(r===!1){if(!("colorSchemes"in e))return Bk(e,...t);let u=n;"palette"in e||d[s]&&(d[s]!==!0?u=d[s].palette:s==="dark"&&(u={mode:"dark"}));const m=Bk({...e,palette:u},...t);return m.defaultColorScheme=s,m.colorSchemes=d,m.palette.mode==="light"&&(m.colorSchemes.light={...d.light!==!0&&d.light,palette:m.palette},CD(m,"dark",d.dark)),m.palette.mode==="dark"&&(m.colorSchemes.dark={...d.dark!==!0&&d.dark,palette:m.palette},CD(m,"light",d.light)),m}return!n&&!("light"in d)&&s==="light"&&(d.light=!0),Ose({...i,colorSchemes:d,defaultColorScheme:s,...typeof r!="boolean"&&r},...t)}const f1=Z4(),vh="$$material";function Qd(){const e=dh(f1);return e[vh]||e}function Pse(e){return p.jsx(rE,{...e,defaultTheme:f1,themeId:vh})}function jse(e){const{variants:t,...n}=e,r={variants:t,style:Rd(n),isProcessed:!0};return r.style===n||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=Rd(o.style))}),r}const Ase=sR();function yC(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function Sd(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function Dse(e){return e?(t,n)=>n[e]:null}function Nse(e,t,n){e.theme=Lse(e.theme)?n:e.theme[t]||e.theme}function f0(e,t,n){const r=typeof t=="function"?t(e):t;if(Array.isArray(r))return r.flatMap(o=>f0(e,o,n));if(Array.isArray(r?.variants)){let o;if(r.isProcessed)o=n?Sd(r.style,n):r.style;else{const{variants:a,...i}=r;o=n?Sd(Rd(i),n):i}return J4(e,r.variants,[o],n)}return r?.isProcessed?n?Sd(Rd(r.style),n):r.style:n?Sd(Rd(r),n):r}function J4(e,t,n=[],r=void 0){let o;e:for(let a=0;a<t.length;a+=1){const i=t[a];if(typeof i.props=="function"){if(o??={...e,...e.ownerState,ownerState:e.ownerState},!i.props(o))continue}else for(const s in i.props)if(e[s]!==i.props[s]&&e.ownerState?.[s]!==i.props[s])continue e;typeof i.style=="function"?(o??={...e,...e.ownerState,ownerState:e.ownerState},n.push(r?Sd(Rd(i.style(o)),r):i.style(o))):n.push(r?Sd(Rd(i.style),r):i.style)}return n}function Ise(e={}){const{themeId:t,defaultTheme:n=Ase,rootShouldForwardProp:r=yC,slotShouldForwardProp:o=yC}=e;function a(i){Nse(i,t,n)}return(i,s={})=>{_ie(i,O=>O.filter(P=>P!==Yp));const{name:l,slot:d,skipVariantsResolver:u,skipSx:m,overridesResolver:g=Dse(Fse(d)),...y}=s,x=l&&l.startsWith("Mui")||d?"components":"custom",w=u!==void 0?u:d&&d!=="Root"&&d!=="root"||!1,S=m||!1;let b=yC;d==="Root"||d==="root"?b=r:d?b=o:zse(i)&&(b=void 0);const $=Fie(i,{shouldForwardProp:b,label:void 0,...y}),k=O=>{if(O.__emotion_real===O)return O;if(typeof O=="function")return function(P){return f0(P,O,P.theme.modularCssLayers?x:void 0)};if(pl(O)){const P=jse(O);return function(D){return P.variants?f0(D,P,D.theme.modularCssLayers?x:void 0):D.theme.modularCssLayers?Sd(P.style,x):P.style}}return O},R=(...O)=>{const P=[],D=O.map(k),A=[];if(P.push(a),l&&g&&A.push(function(_){const E=_.theme.components?.[l]?.styleOverrides;if(!E)return null;const z={};for(const I in E)z[I]=f0(_,E[I],_.theme.modularCssLayers?"theme":void 0);return g(_,z)}),l&&!w&&A.push(function(_){const E=_.theme?.components?.[l]?.variants;return E?J4(_,E,[],_.theme.modularCssLayers?"theme":void 0):null}),S||A.push(Yp),Array.isArray(D[0])){const _=D.shift(),E=new Array(P.length).fill(""),z=new Array(A.length).fill("");let I;I=[...E,..._,...z],I.raw=[...E,..._.raw,...z],P.unshift(I)}const F=[...P,...D,...A],L=$(...F);return i.muiName&&(L.muiName=i.muiName),L};return $.withConfig&&(R.withConfig=$.withConfig),R}}function Lse(e){for(const t in e)return!1;return!0}function zse(e){return typeof e=="string"&&e.charCodeAt(0)>96}function Fse(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function eF(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const gs=e=>eF(e)&&e!=="classes",ot=Ise({themeId:vh,defaultTheme:f1,rootShouldForwardProp:gs});function _se(e){return function(t){return p.jsx(Pse,{styles:typeof e=="function"?n=>e({theme:n,...t}):e})}}function Bse(){return bie}const rr=k5;function tr(e){return Hie(e)}function vn(e,t,n="Mui"){const r={};return t.forEach(o=>{r[o]=kn(e,o,n)}),r}function Use(e){return kn("MuiSvgIcon",e)}vn("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Vse=e=>{const{color:t,fontSize:n,classes:r}=e,o={root:["root",t!=="inherit"&&`color${zt(t)}`,`fontSize${zt(n)}`]};return Sn(o,Use,r)},qse=ot("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${zt(n.color)}`],t[`fontSize${zt(n.fontSize)}`]]}})(rr(({theme:e})=>({userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:e.transitions?.create?.("fill",{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:t=>!t.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:e.typography?.pxToRem?.(20)||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:e.typography?.pxToRem?.(24)||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:e.typography?.pxToRem?.(35)||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,t])=>t&&t.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:"action"},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:"disabled"},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}))),U0=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiSvgIcon"}),{children:r,className:o,color:a="inherit",component:i="svg",fontSize:s="medium",htmlColor:l,inheritViewBox:d=!1,titleAccess:u,viewBox:m="0 0 24 24",...g}=n,y=C.isValidElement(r)&&r.type==="svg",x={...n,color:a,component:i,fontSize:s,instanceFontSize:e.fontSize,inheritViewBox:d,viewBox:m,hasSvgAsChild:y},w={};d||(w.viewBox=m);const S=Vse(x);return p.jsxs(qse,{as:i,className:Ht(S.root,o),focusable:"false",color:l,"aria-hidden":u?void 0:!0,role:u?"img":void 0,ref:t,...w,...g,...y&&r.props,ownerState:x,children:[y?r.props.children:r,u?p.jsx("title",{children:u}):null]})});U0.muiName="SvgIcon";function rn(e,t){function n(r,o){return p.jsx(U0,{"data-testid":void 0,ref:o,...r,children:e})}return n.muiName=U0.muiName,C.memo(C.forwardRef(n))}function tF(e,t=166){let n;function r(...o){const a=()=>{e.apply(this,o)};clearTimeout(n),n=setTimeout(a,t)}return r.clear=()=>{clearTimeout(n)},r}function p0(e,t){return C.isValidElement(e)&&t.indexOf(e.type.muiName??e.type?._payload?.value?.muiName)!==-1}function Wo(e){return e&&e.ownerDocument||document}function hc(e){return Wo(e).defaultView||window}function Vk(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Ji(e){const{controlled:t,default:n,name:r,state:o="value"}=e,{current:a}=C.useRef(t!==void 0),[i,s]=C.useState(n),l=a?t:i,d=C.useCallback(u=>{a||s(u)},[]);return[l,d]}function Yt(e){const t=C.useRef(e);return Yo(()=>{t.current=e}),C.useRef((...n)=>(0,t.current)(...n)).current}function vr(...e){const t=C.useRef(void 0),n=C.useCallback(r=>{const o=e.map(a=>{if(a==null)return null;if(typeof a=="function"){const i=a,s=i(r);return typeof s=="function"?s:()=>{i(null)}}return a.current=r,()=>{a.current=null}});return()=>{o.forEach(a=>a?.())}},e);return C.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}function Hse(e,t){const n=e.charCodeAt(2);return e[0]==="o"&&e[1]==="n"&&n>=65&&n<=90&&typeof t=="function"}function Wse(e,t){if(!e)return t;function n(i,s){const l={};return Object.keys(s).forEach(d=>{Hse(d,s[d])&&typeof i[d]=="function"&&(l[d]=(...u)=>{i[d](...u),s[d](...u)})}),l}if(typeof e=="function"||typeof t=="function")return i=>{const s=typeof t=="function"?t(i):t,l=typeof e=="function"?e({...i,...s}):e,d=Ht(i?.className,s?.className,l?.className),u=n(l,s);return{...s,...l,...u,...!!d&&{className:d},...s?.style&&l?.style&&{style:{...s.style,...l.style}},...s?.sx&&l?.sx&&{sx:[...Array.isArray(s.sx)?s.sx:[s.sx],...Array.isArray(l.sx)?l.sx:[l.sx]]}}};const r=t,o=n(e,r),a=Ht(r?.className,e?.className);return{...t,...e,...o,...!!a&&{className:a},...r?.style&&e?.style&&{style:{...r.style,...e.style}},...r?.sx&&e?.sx&&{sx:[...Array.isArray(r.sx)?r.sx:[r.sx],...Array.isArray(e.sx)?e.sx:[e.sx]]}}}const p1=rn(p.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"})),Yse=2,Gse=24,DRe=(e,t,n)=>Math.min(Math.max(e+t,1),Math.min(n,Gse)),vl=16,NRe=vl/2;function Kse(e,t){const n=Math.min(e.colspan??1,t);return e.break?`1 / span ${n}`:`span ${n}`}const lR=80,Qse=3,IRe=2,LRe=1,Xse=16,nF=e=>e*lR+(e-1)*vl,zRe=(e,t=Qse)=>Math.min(Math.max(Math.round((e+vl)/(lR+vl)),t),Xse),rF=240;function FRe(e,t,n=rF){const[r,o]=C.useState(0);return C.useEffect(()=>{const a=e.current;if(!a||typeof ResizeObserver>"u")return;o(a.getBoundingClientRect().width);const i=new ResizeObserver(([s])=>o(s?.contentRect.width??0));return i.observe(a),()=>i.disconnect()},[e]),oF(t,r,n)}function oF(e,t,n){if(!(t>0)||e<=1)return 1;const r=(t-(e-1)*vl)/e;return Math.min(e,Math.max(1,Math.ceil((n+vl)/(r+vl))))}const aF={query:5,text:2},iF=e=>e.some(t=>t.row!==void 0);function Zse(e,t,n){const r=Math.min(e.colspan??1,t),o=e.col===void 0?void 0:Math.min(e.col,t-r+1);return{gridRow:e.row===void 0?`span ${n}`:`${e.row} / span ${n}`,gridColumn:o===void 0?`span ${r}`:`${o} / span ${r}`}}const Jse=e=>e.row===void 0?1e6:e.row*1e3+(e.col??0);function ele({tiles:e,columns:t,keyOf:n,renderTile:r,minTilePx:o,rowGapPx:a=vl,defaultRowspan:i=s=>aF[s.kind==="text"?"text":"query"]}){const s=iF(e),l=C.useRef(null),[d,u]=C.useState(0);C.useEffect(()=>{const g=l.current;if(o===void 0||!g||typeof ResizeObserver>"u")return;const y=new ResizeObserver(([x])=>u(x?.contentRect.width??0));return y.observe(g),()=>y.disconnect()},[o]);const m=o===void 0?1:oF(t,d,o);return p.jsx(Ee,{ref:l,sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:`repeat(${t}, minmax(0, 1fr))`},columnGap:`${vl}px`,rowGap:`${a}px`,...s&&{gridAutoRows:`${lR}px`}},children:e.map((g,y)=>p.jsx(Ee,{sx:{display:"grid",minWidth:0,...!s&&g.rowspan!==void 0&&{height:nF(g.rowspan),alignSelf:"start"},...(s||g.rowspan!==void 0)&&{gridTemplateRows:"minmax(0, 1fr)"},...s?(()=>{const x=g.rowspan??i(g),w=Zse(g.colspan===void 0&&m>1?{...g,colspan:m}:g,t,x);return{gridRow:{xs:`span ${x}`,md:w.gridRow},gridColumn:{md:w.gridColumn},order:{xs:Jse(g),md:0}}})():{gridColumn:{md:Kse(g.colspan===void 0&&m>1?{...g,colspan:m}:g,t)}}},children:r(g,y)},n(g,y)))})}function h1(e){let t="",n=0;for(;;){const r=e.indexOf('"',n);if(r<0)break;let o=r+1;for(;o<e.length&&e[o]!=='"';)o+=e[o]==="\\"?2:1;if(o>=e.length)break;t+=`${e.slice(n,r)}""`,n=o+1}return t+e.slice(n)}const sF=["bar_chart","line_chart","scatter_chart","shape_map","segment_map","big_value","sparkline","combo_chart"],cR=["line_chart","bar_chart","big_value","scatter_chart","shape_map","segment_map","combo_chart"],tle=e=>cR.includes(e),qk=new Set([...sF,"viz"]);function m1(e){const t=e.trim();if(!/^#[ \t]/.test(t)||/[{=]/.test(t))return;const n=t.slice(1).trim().split(/[ \t]+/),r=[];let o;for(const a of n)if(a.startsWith("-")){if(o!==void 0)return;const i=a.slice(1);if(!qk.has(i))return;r.push(i)}else{if(o!==void 0||!qk.has(a))return;o=a}return{negated:r,...o!==void 0&&{pick:o}}}function lF(e){const t=e.trim();return!/^#[ \t]/.test(t)||m1(t)?!1:(h1(t).match(/[A-Za-z_]+/g)??[]).some(n=>qk.has(n))}function _Re(){return["#",...cR.filter(e=>e!=="big_value").map(e=>`-${e}`)].join(" ")}function BRe(e,t){return["#",...cR.filter(n=>n!==e&&(t===void 0||t.includes(n)||e==="none"&&n==="big_value")).map(n=>`-${n}`),"-viz",...e==="none"?[]:[e]].join(" ")}function nle(e){return e.pick!==void 0?tle(e.pick)?e.pick:"custom":e.negated.includes("viz")?"none":"custom"}function rle(e){if(e.length===0)return"default";if(e.length>1)return"custom";const t=m1(e[0]);return t?nle(t):"custom"}function URe(e){const t=e.filter(n=>m1(n));return e.some(lF)?"custom":t.length===0?void 0:rle(t)}const ole=/^#[ \t]*theme\.palette\.series[ \t]*=[ \t]*\[[ \t]*"(#[0-9A-Fa-f]{6})"[ \t]*\][ \t]*$/;function VRe(e){return ole.exec(e.trim())?.[1]?.toLowerCase()}const qRe=e=>`# theme.palette.series=["${e.toLowerCase()}"]`,HRe="# -theme.palette.series",ale=e=>/^#[0-9A-Fa-f]{6}$/.test(e);function WRe(e){const t=e.trim().toLowerCase();if(ale(t))return t;const n=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(t);return n?`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`:void 0}const YRe=e=>e.filter(t=>m1(t)||lF(t)),bh=rn(p.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function Oo({open:e,onClose:t,title:n,description:r,maxWidth:o="sm",showClose:a=!1,actions:i,initialFocus:s,className:l,children:d}){const u=C.useId(),m=Hr().theme.ui;return p.jsxs(Fx,{open:e,onClose:t,maxWidth:o,fullWidth:!0,"aria-labelledby":u,...l?{className:l}:{},PaperProps:{sx:{borderRadius:m.radius.dialog}},...s?{TransitionProps:{onEntered:()=>s.current?.focus()}}:{},children:[p.jsxs(Bx,{id:u,sx:{px:3,pt:3,pb:r?.5:1,display:"flex",alignItems:"center",justifyContent:"space-between",gap:1,fontSize:"1.25rem",fontWeight:"fontWeightMedium",letterSpacing:"-0.025em",lineHeight:1.2},children:[n,a&&p.jsx(no,{"aria-label":"Close",onClick:t,size:"small",sx:{color:"text.secondary",mr:-1},children:p.jsx(bh,{fontSize:"small"})})]}),p.jsxs(_x,{sx:{px:3,pb:1,pt:1},children:[r&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:2},children:r}),p.jsx(Wn,{sx:{gap:2,pt:r?0:1},children:d})]}),i&&p.jsx(cz,{sx:{px:3,pb:3,pt:2,gap:1},children:i})]})}function GRe({open:e,canSave:t,onKeepEditing:n,onDiscard:r,onSaveAndExit:o}){return p.jsx(Oo,{open:e,onClose:n,title:"Leave with unsaved changes?",description:t&&o?"Your edits have not been saved. Save them, or leave without them.":"Leaving now discards your unsaved edits.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{onClick:n,children:"Keep editing"}),p.jsx(Hn,{color:"error",onClick:r,children:"Discard changes"}),t&&o&&p.jsx(Hn,{variant:"contained",onClick:o,children:"Save and exit"})]}),children:null})}const cF=rn(p.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}));function Qy({label:e,onClick:t,disabled:n}){return p.jsx(Hn,{variant:"contained",color:"primary",startIcon:p.jsx(p1,{}),onClick:t,disabled:n,"aria-label":`Add ${e.toLowerCase()}`,sx:{whiteSpace:"nowrap"},children:e})}function Xy({label:e,icon:t,onClick:n,disabled:r,disabledReason:o,ariaLabel:a,ariaHasPopup:i}){const s=p.jsx("span",{children:p.jsx(Hn,{variant:"outlined",startIcon:t,onClick:n,disabled:r,"aria-label":a,"aria-haspopup":i,sx:{whiteSpace:"nowrap"},children:e})});return r&&o?p.jsx(Br,{title:o,children:s}):s}const uF=rn(p.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),Zy="120ms",Jy={"@media (prefers-reduced-motion: reduce)":{transition:"none",animation:"none"}},KRe=()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",ile={"@media (hover: none)":{opacity:1}},QRe=e=>e.palette.mode==="dark"?e.palette.error.main:e.palette.error.dark;vi.size.control;vi.size.chip;vi.radius.control;vi.radius.tile;vi.radius.dialog;vi.type;const sle="72ch",Xd=e=>e.replace(/^1px solid /,""),dF=(e,t)=>`color-mix(in srgb, ${Xd(e)}, ${t} 25%)`,g1={line_chart:"A line chart",bar_chart:"A bar chart",scatter_chart:"A scatter chart",combo_chart:"A bar and line chart"},lle={line:"line_chart",bar:"bar_chart",scatter:"scatter_chart",combo:"combo_chart"},cle=new Set(["x","y","y2","series"]);function Hk(e){const t=e.trim();return!t.startsWith("#")||t.startsWith("#(")||t.startsWith('#"')?[]:h1(t.slice(1)).split(/[\s{}[\],]+/).filter(Boolean)}function fF(e){const t=[];let n;for(const r of e)for(const o of Hk(r))if(o.startsWith("-")){const a=o.slice(1);a==="viz"&&(n=void 0);const i=t.indexOf(a);i>=0&&t.splice(i,1)}else if(o.startsWith("viz="))n=lle[o.slice(4)]??o;else if(g1[o]!==void 0||o==="big_value"){const a=t.indexOf(o);a>=0&&t.splice(a,1),t.push(o)}return n??t.at(-1)}function XRe(e){const t=fF(e);return t!==void 0&&g1[t]!==void 0}function ule(e,{groupBys:t,totals:n}){if(g1[e]!==void 0){if(e==="scatter_chart")return t===0&&n<2?"no_x_axis":void 0;if(t===0)return"no_x_axis";if(e==="combo_chart")return n===2?void 0:"combo_totals";if(n===0)return"no_y_axis"}}function dle(e){const t=e.trim();if(!t.startsWith("#(malloy)"))return!1;const n=h1(t.slice(9));let r="",o=0;for(const i of n)i==="{"||i==="["?o++:i==="}"||i==="]"?o=Math.max(0,o-1):o===0&&(r+=i==="="?" = ":i);const a=r.split(/\s+/);return a.some((i,s)=>i==="calculation"&&a[s-1]!=="=")}const Wk=e=>e!==void 0&&(e.kind==="measure"||(e.annotations??[]).some(t=>dle(t?.value??""))),fle=e=>e.kind==="join"||e.type?.kind==="array_type";function ple(e){const t=e.filter(Wk).length;return{groupBys:e.filter(n=>!Wk(n)&&!fle(n)).length,totals:t}}const kD=e=>cle.has(e.split("=")[0]);function hle(e){if(!e)return;let t;try{t=JSON.parse(e)}catch{return}const n=t?.schema?.fields;if(!Array.isArray(n)||n.length===0)return;const r=(t.annotations??[]).map(l=>l?.value).filter(l=>typeof l=="string"),o=fF(r),a=o&&g1[o];if(!o||!a||r.some(l=>Hk(l).some(kD))||n.some(l=>(l.annotations??[]).some(d=>Hk(d.value??"").some(kD))))return;const{groupBys:i,totals:s}=ple(n);switch(ule(o,{groupBys:i,totals:s})){case"no_x_axis":return`This chart has no field for the x-axis. ${a} needs a group by, such as a date or a category. Show it as big numbers or a table instead, or add a group by to its query.`;case"combo_totals":return`${a} needs exactly two totals, the first drawn as bars and the second as a line. This one has ${s}.`;case"no_y_axis":return`This chart has no total for the y-axis. ${a} needs at least one aggregate, such as a count or a sum.`;default:return}}const mle=rn(p.jsx("path",{d:"M4 9h4v11H4zm12 4h4v7h-4zm-6-9h4v16h-4z"})),gle=rn(p.jsx("path",{d:"m20.5 3-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5M15 19l-6-2.11V5l6 2.11z"})),yle=rn(p.jsx("path",{d:"m20.5 10 .5-2h-4l1-4h-2l-1 4h-4l1-4h-2L9 8H5l-.5 2h4l-1 4h-4L3 16h4l-1 4h2l1-4h4l-1 4h2l1-4h4l.5-2h-4l1-4zm-7 4h-4l1-4h4z"})),vle=rn([p.jsx("circle",{cx:"7",cy:"14",r:"3"},"0"),p.jsx("circle",{cx:"11",cy:"6",r:"3"},"1"),p.jsx("circle",{cx:"16.6",cy:"17.6",r:"3"},"2")]),Gp=rn(p.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"})),ble=rn(p.jsx("path",{d:"m3.5 18.49 6-6.01 4 4L22 6.92l-1.41-1.41-7.09 7.97-4-4L2 16.99z"})),xle=rn(p.jsx("path",{d:"M10 10.02h5V21h-5zM17 21h3c1.1 0 2-.9 2-2v-9h-5zm3-18H5c-1.1 0-2 .9-2 2v3h19V5c0-1.1-.9-2-2-2M3 19c0 1.1.9 2 2 2h3V10H3z"}));function vC(e){const t=e.replace(/_+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}function wle({chart:e}){const t={fontSize:16};switch(e){case"bar_chart":case"combo_chart":return p.jsx(mle,{sx:t});case"line_chart":case"sparkline":return p.jsx(ble,{sx:t});case"scatter_chart":return p.jsx(vle,{sx:t});case"shape_map":case"segment_map":return p.jsx(gle,{sx:t});case"big_value":return p.jsx(yle,{sx:t});default:return p.jsx(xle,{sx:t})}}function Sle({groups:e,query:t,onQuery:n,picked:r,onPick:o,onTake:a,searchRef:i,empty:s,footer:l,disabled:d=!1}){const{theme:u}=Hr(),m=u.ui,g=C.useId(),y=t.trim().toLowerCase(),x=C.useMemo(()=>e.map(O=>({...O,entries:O.entries.filter(P=>y===""||[P.name,P.title,O.label,O.detail??""].join(" ").toLowerCase().includes(y))})).filter(O=>O.entries.length>0),[e,y]),w=x.flatMap(O=>O.entries),S=C.useMemo(()=>new Map(e.flatMap(O=>O.entries).map((O,P)=>[O.key,`${g}-${P}`])),[e,g]),b=O=>S.get(O)??`${g}-none`,$=w.some(O=>O.key===r)?r:void 0,k=O=>{o(O),window.requestAnimationFrame(()=>window.document.getElementById(b(O))?.scrollIntoView({block:"nearest"}))},R=O=>{if(w.length===0)return;const P=w.findIndex(A=>A.key===$),D=P===-1?O===1?0:w.length-1:Math.min(w.length-1,Math.max(0,P+O));k(w[D].key)};return p.jsxs(Ee,{sx:{display:"flex",flexDirection:"column",minHeight:0,flex:1},children:[p.jsx(Ee,{sx:{p:1.5,pb:1},children:p.jsx(ki,{size:"small",fullWidth:!0,inputRef:i,placeholder:"Search the model",value:t,disabled:d,onChange:O=>n(O.target.value),onKeyDown:O=>{if(O.key==="ArrowDown")O.preventDefault(),R(1);else if(O.key==="ArrowUp")O.preventDefault(),R(-1);else if(O.key==="Enter"){const P=$??w[0]?.key;if(P===void 0)return;O.preventDefault(),a(P)}},inputProps:{"aria-label":"Search the model",role:"combobox","aria-controls":g,"aria-expanded":!0,...$!==void 0?{"aria-activedescendant":b($)}:{}},InputProps:{startAdornment:p.jsx(ME,{position:"start",children:p.jsx(Gp,{sx:{fontSize:18,color:"text.secondary"}})})}})}),p.jsxs(Ee,{id:g,role:"listbox","aria-label":"From the model",sx:{overflowY:"auto",flex:1,minHeight:0,pb:1},children:[e.length===0&&s,e.length>0&&x.length===0&&p.jsxs(wt,{variant:"body2",sx:{color:u.tileTitle,px:2,py:1},children:["No view matches “",t.trim(),"”."]}),x.map(O=>p.jsxs(Ee,{role:"group","aria-label":O.ariaLabel??O.label,children:[p.jsxs(Ee,{"aria-hidden":!0,sx:{px:2,pt:1.25,pb:.5,...m.type.caption,color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[p.jsx(Ee,{component:"span",sx:{...m.type.label,fontSize:"0.92em",letterSpacing:"0.04em",textTransform:"uppercase"},children:O.label.replace(/_+/g," ")}),O.detail&&` · ${O.detail}`]}),O.entries.map(P=>{const D=P.key===r;return p.jsxs(Ee,{id:b(P.key),role:"option","aria-selected":D,"aria-label":`${P.title} (${P.name})`,onClick:()=>{d||k(P.key)},onDoubleClick:()=>{d||a(P.key)},sx:A=>({display:"flex",alignItems:"center",gap:1.25,mx:.75,px:1.25,py:.75,borderRadius:m.radius.control,cursor:d?"default":"pointer",bgcolor:D?`color-mix(in srgb, ${u.accent} 9%, ${A.palette.background.paper})`:"transparent","&:hover":D||d?{}:{bgcolor:A.palette.action.hover}}),children:[p.jsx(Ee,{"aria-hidden":!0,sx:A=>({width:26,height:26,flex:"none",borderRadius:m.radius.control,display:"flex",alignItems:"center",justifyContent:"center",color:D?u.accent:A.palette.text.secondary,bgcolor:D?A.palette.background.paper:A.palette.action.hover,boxShadow:D?`inset 0 0 0 1px color-mix(in srgb, ${u.accent} 35%, transparent)`:"none"}),children:p.jsx(wle,{chart:P.chart})}),p.jsxs(Ee,{sx:{minWidth:0},children:[p.jsx(Ee,{sx:{...m.type.control,fontWeight:D?m.type.label.fontWeight:400,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:P.title}),p.jsx(Ee,{sx:{...m.type.code,color:"text.secondary"},children:P.name})]})]},P.key)})]},O.key)),y===""&&l]})]})}const Cle=new Set(["bar","line","chart","scatter_chart","combo"]),kle=new Set(["table","dashboard","shape_map","segment_map","list","list_detail","big_value","cell","link","image"]);function ZRe(e,t){return t==="fill"?"container":t==="fixed"||!e?"content":Cle.has(e)?"container":"content"}function JRe(e,t){return t==="fixed"?!0:t==="fill"?!1:e!==void 0&&kle.has(e)}function e2e(e){return e==="dashboard"?3:2}function $le(e,t){let n=e.firstElementChild;for(let r=1;r<t&&n;r++)n=n.firstElementChild;return n}function t2e(e,t){const n=$le(e,t);return n&&(n.scrollHeight||n.offsetHeight)||0}const pF=400,Ele=700,Rle=700;function Tle({renderAs:e,maxHeight:t,tableMaxHeight:n}){return e!=="table"||n===void 0?t:t===void 0?n:Math.min(t,n)}const Mle=600,Ole=800,Ple=400,jle=2e3;function Ale(e,t){const n=t??jle;return e===void 0?n:Math.min(e,n)}function $D({sizing:e,contentHeight:t,maxHeight:n,fillHeight:r,firstPaintHeight:o}){if(e==="container"){const i=n??Ple;return r!==void 0&&r>0?Math.min(i,r):i}if(t===void 0||t<=0)return Ale(n,o);const a=n===void 0?t:Math.min(n,t);return r===void 0?a:Math.max(a,r)}const Dle="data-publisher-tight",Nle="publisher-result-scroller";function Ile(e,t,n=1){return e===1&&t<=2&&n===1?void 0:e}function n2e(e,t,n,r=1){const o={...e},a=Ile(t,n,r);return a===void 0?delete o.colspan:o.colspan=a,o}function Lle(e,t){if(e==="linear")return{layout:"linear",columns:1,widths:!1,insertBetween:!0,tileMaxHeight:void 0,tableMaxHeight:Rle};const n=t??Yse;return{layout:"grid",columns:n,widths:n>1,insertBetween:!1,tileMaxHeight:pF,tableMaxHeight:void 0}}const hF="document.malloy",mF=e=>e.slice(0,e.lastIndexOf("/")+1),gF=(e,t)=>new URL(e,`https://malloy.invalid/${mF(t)}`).pathname.slice(1);function yF(e,t){const n=mF(t).split("/").filter(Boolean),r=e.split("/");let o=0;for(;o<n.length&&o<r.length-1&&n[o]===r[o];)o++;const a=n.length-o;return`${"../".repeat(a)}${r.slice(o).join("/")}`}function zle(e,t,n,r=hF,o=[n]){return e.sources.some(a=>a.base===t)?!0:e.imports.some(a=>a.kind==="names"?a.names.includes(t):o.includes(gF(a.from,r)))}function r2e(e,t,n,r=hF,o=[n]){const{imports:a}=e;if(zle(e,t,n,r,o))return a;const i=a.findIndex(s=>s.kind==="names"&&o.includes(gF(s.from,r)));return i<0?[...a,{kind:"names",names:[t],from:yF(n,r)}]:a.map((s,l)=>l===i&&s.kind==="names"?{...s,names:[...s.names,t]}:s)}const vF=rn(p.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"})),Fle=rn(p.jsx("path",{d:"M12 2C6.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 8m-5.5-2.5 7.51-3.49L17.5 6.5 9.99 9.99zm5.5-6.6c.61 0 1.1.49 1.1 1.1s-.49 1.1-1.1 1.1-1.1-.49-1.1-1.1.49-1.1 1.1-1.1"})),_le=600,ED=()=>typeof IntersectionObserver>"u";function Ble(e){for(let t=e.parentElement;t;t=t.parentElement){const{overflowY:n}=getComputedStyle(t);if((n==="auto"||n==="scroll")&&t.scrollHeight>t.clientHeight)return t}return null}function Ule(e=_le){const[t,n]=C.useState(ED),r=C.useRef(t),o=C.useRef(null),a=C.useCallback(i=>{if(o.current?.disconnect(),o.current=null,!i||r.current||ED())return;const s=i.getBoundingClientRect(),l=Ble(i),d=l?.getBoundingClientRect()??{top:0,bottom:window.innerHeight||document.documentElement.clientHeight};if(s.bottom>=d.top-e&&s.top<=d.bottom+e){r.current=!0,n(!0);return}const u=new IntersectionObserver(m=>{m.some(g=>g.isIntersecting)&&(r.current=!0,u.disconnect(),n(!0))},{root:l,rootMargin:`${e}px 0px`});u.observe(i),o.current=u},[e]);return C.useEffect(()=>()=>o.current?.disconnect(),[]),C.useEffect(()=>{if(t||typeof window>"u")return;const i=()=>{r.current=!0,o.current?.disconnect(),n(!0)};return window.addEventListener("beforeprint",i),()=>window.removeEventListener("beforeprint",i)},[t]),[a,t]}function bF({summary:e,detail:t}){return p.jsxs(xo,{severity:"error",sx:{"& .MuiAlert-message":{minWidth:0,flex:1}},children:[e!==void 0&&p.jsx(Ee,{sx:{mb:.5},children:e}),p.jsx(Ee,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:Fo,fontSize:"0.8125rem",color:"text.secondary"},children:t})]})}function Xa({error:e,context:t}){const n=e.data?.message||"Unknown error";return p.jsx(bF,{summary:t,detail:n})}function o2e(e){const t=Vle(e);return{name:e.name,type:e.type,...t===void 0?{}:{default:t},...e.label===void 0?{}:{label:e.label},...e.description===void 0?{}:{description:e.description},...e.control===void 0?{}:{control:e.control},...e.suggest?{suggest:{...e.suggest.source===void 0?{}:{source:e.suggest.source},...e.suggest.query===void 0?{}:{query:e.suggest.query},dimension:e.suggest.dimension}}:{},...e.rangeMin===void 0?{}:{rangeMin:e.rangeMin},...e.rangeMax===void 0?{}:{rangeMax:e.rangeMax}}}function Vle(e){return e.type?.startsWith("filter<")?e.default?.match(/^f(['"])([\s\S]*)\1$/)?.[2]??e.default:e.default}function uR(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/[\u0000-\u001f]/g,t=>qle[t]??Hle(t))}const qle={"\n":"\\n","\r":"\\r"," ":"\\t","\b":"\\b","\f":"\\f"},Hle=e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`;function Wle(e,t){if(e==null||e==="")return;const n=r=>`'${uR(r)}'`;switch(t===void 0?Yle(e):t.startsWith("filter<")?"filter":t){case"filter":return Gle(String(e));case"string":return n(String(e));case"number":{const r=typeof e=="number"?e:Number(e);return Number.isFinite(r)?String(r):void 0}case"boolean":return e===!0||e==="true"?"true":"false";case"date":{const r=RD(e);return r&&`@${r}`}case"timestamp":{const r=RD(e);if(!r)return;const o=e instanceof Date?e.toISOString().slice(11,19):/[T ](\d{2}:\d{2}(?::\d{2})?)/.exec(String(e))?.[1]??"00:00:00";return`@${r} ${o}`}default:return}}function Yle(e){if(typeof e=="string")return"string";if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(e instanceof Date&&!Number.isNaN(e.getTime()))return e.toISOString().slice(11,19)==="00:00:00"?"date":"timestamp"}function Gle(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];r==="\\"?t+=n+1<e.length?r+e[++n]:"\\\\":t+=r==="'"?"\\'":r}return`f'${t}'`}function RD(e){return e instanceof Date?Number.isNaN(e.getTime())?void 0:e.toISOString().slice(0,10):/^(\d{4}-\d{2}-\d{2})/.exec(String(e))?.[1]}const Kp="malloy-publisher.report-draft:",Qp={storage:()=>window.localStorage};function a2e(e){const{server:t,environmentName:n,packageName:r,versionId:o,path:a}=e;return`${t}|${n}/${r}@${o??""}/${a}`}function i2e(e){if(typeof e=="string"){h0(e);return}const{server:t,environmentName:n,packageName:r,path:o}=e,a=`${n}/${r}@`,i=e.versionId!==void 0?`${e.versionId}/${o}`:void 0;try{const s=Qp.storage(),l=[];for(let d=0;d<s.length;d++){const u=s.key(d);if(!u?.startsWith(Kp))continue;const m=u.slice(Kp.length),g=m.indexOf("|");if(g===-1)continue;const[y,x]=[m.slice(0,g),m.slice(g+1)];if(t!==void 0&&y!==t||!x.startsWith(a))continue;const w=x.slice(a.length);(i!==void 0?w!==i:w.slice(w.indexOf("/")+1)!==o)||l.push(u)}for(const d of l)s.removeItem(d)}catch{}}function s2e(){try{const e=`${Kp}probe`;return Qp.storage().setItem(e,"1"),Qp.storage().removeItem(e),!0}catch{return!1}}function Kle(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)|0;return`${e.length}:${(t>>>0).toString(36)}`}function Qle(e){try{const t=Qp.storage().getItem(Kp+e);if(!t)return;const n=JSON.parse(t);return n?.v===1&&n.document?n:void 0}catch{return}}function Xle(e,t){try{return Qp.storage().setItem(Kp+e,JSON.stringify(t)),!0}catch{return!1}}function h0(e){try{Qp.storage().removeItem(Kp+e)}catch{}}function bC(e,t){const n=e;for(const r of Object.keys(n))delete n[r];Object.assign(n,structuredClone(t))}function l2e(e,t,n){const[r,o]=C.useState(),[a,i]=C.useState(),[s,l]=C.useState(!1),d=C.useRef(void 0),u=C.useRef(void 0),m=C.useRef(!1),g=Kle(n),y=C.useRef(t);y.current=t;const x=C.useRef(!1);C.useEffect(()=>{if(e===void 0||x.current)return;x.current=!0;const R=Qle(e);if(!R)return;const O=y.current;if(JSON.stringify(R.document)===JSON.stringify(O.document)){h0(e);return}if(R.base!==g){d.current=R,o({savedAt:R.savedAt,stale:!0,pending:!0});return}O.update(P=>bC(P,R.document)),u.current=JSON.stringify(R.document),m.current=!0,o({savedAt:R.savedAt,stale:!1,pending:!1})},[e]);const{document:w,dirty:S}=t;C.useEffect(()=>{if(e===void 0||!x.current||d.current&&!S)return;if(d.current&&(d.current=void 0,o(void 0)),u.current!==void 0){const O=JSON.stringify(w);m.current?O===u.current&&(m.current=!1):O!==u.current&&(u.current=void 0,o(void 0))}if(!S){h0(e),i(void 0),l(!1);return}const R=Date.now();Xle(e,{v:1,document:w,base:g,savedAt:R})?(i(R),l(!1)):(i(void 0),l(!0))},[e,w,S,g]);const b=C.useCallback(()=>{const R=d.current;R&&(d.current=void 0,y.current.update(O=>bC(O,R.document)),u.current=JSON.stringify(R.document),m.current=!0,o(O=>O&&{...O,pending:!1}))},[]),$=C.useCallback(()=>{d.current||(u.current=void 0,o(void 0))},[]),k=C.useCallback(()=>{if(d.current&&e!==void 0){d.current=void 0,h0(e),o(void 0);return}const R=y.current;R.update(O=>bC(O,R.saved)),u.current=void 0,o(void 0)},[e]);return{keptAt:a,keeping:!s,restored:r,dismissRestored:$,discard:k,restoreOffered:b}}const Zle=(e,t)=>({...t,...e}),xF={emit:()=>{},listening:!1};function Yk(e,t){return t?{listening:!0,emit:n=>{try{t(Zle(n,e))}catch{}}}:xF}function Jle(e,t){const n=C.useRef(t);n.current=t;const r=t!==void 0,{path:o,layout:a}=e;return C.useMemo(()=>Yk({path:o,...a?{layout:a}:{}},r?i=>n.current?.(i):void 0),[o,a,r])}const wF=C.createContext(xF),y1=()=>C.useContext(wF);function V0(e){const t=e,n=typeof t?.status=="number"?t.status:typeof t?.response?.status=="number"?t.response.status:void 0;return n===void 0?t?.code==="ERR_NETWORK"?"network":"unknown":n===404?"not_found":n===401||n===403?"forbidden":n===501?"unsupported":n>=500?"server":n>=400?"invalid":"unknown"}var Gk={exports:{}},ece=Gk.exports,TD;function tce(){return TD||(TD=1,(function(e,t){(function(n,r){e.exports=r()})(ece,(function(){var n=1e3,r=6e4,o=36e5,a="millisecond",i="second",s="minute",l="hour",d="day",u="week",m="month",g="quarter",y="year",x="date",w="Invalid Date",S=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,$={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(I){var U=["th","st","nd","rd"],N=I%100;return"["+I+(U[(N-20)%10]||U[N]||U[0])+"]"}},k=function(I,U,N){var q=String(I);return!q||q.length>=U?I:""+Array(U+1-q.length).join(N)+I},R={s:k,z:function(I){var U=-I.utcOffset(),N=Math.abs(U),q=Math.floor(N/60),Y=N%60;return(U<=0?"+":"-")+k(q,2,"0")+":"+k(Y,2,"0")},m:function I(U,N){if(U.date()<N.date())return-I(N,U);var q=12*(N.year()-U.year())+(N.month()-U.month()),Y=U.clone().add(q,m),oe=N-Y<0,Q=U.clone().add(q+(oe?-1:1),m);return+(-(q+(N-Y)/(oe?Y-Q:Q-Y))||0)},a:function(I){return I<0?Math.ceil(I)||0:Math.floor(I)},p:function(I){return{M:m,y,w:u,d,D:x,h:l,m:s,s:i,ms:a,Q:g}[I]||String(I||"").toLowerCase().replace(/s$/,"")},u:function(I){return I===void 0}},O="en",P={};P[O]=$;var D="$isDayjsObject",A=function(I){return I instanceof E||!(!I||!I[D])},F=function I(U,N,q){var Y;if(!U)return O;if(typeof U=="string"){var oe=U.toLowerCase();P[oe]&&(Y=oe),N&&(P[oe]=N,Y=oe);var Q=U.split("-");if(!Y&&Q.length>1)return I(Q[0])}else{var ae=U.name;P[ae]=U,Y=ae}return!q&&Y&&(O=Y),Y||!q&&O},L=function(I,U){if(A(I))return I.clone();var N=typeof U=="object"?U:{};return N.date=I,N.args=arguments,new E(N)},_=R;_.l=F,_.i=A,_.w=function(I,U){return L(I,{locale:U.$L,utc:U.$u,x:U.$x,$offset:U.$offset})};var E=(function(){function I(N){this.$L=F(N.locale,null,!0),this.parse(N),this.$x=this.$x||N.x||{},this[D]=!0}var U=I.prototype;return U.parse=function(N){this.$d=(function(q){var Y=q.date,oe=q.utc;if(Y===null)return new Date(NaN);if(_.u(Y))return new Date;if(Y instanceof Date)return new Date(Y);if(typeof Y=="string"&&!/Z$/i.test(Y)){var Q=Y.match(S);if(Q){var ae=Q[2]-1||0,de=(Q[7]||"0").substring(0,3);return oe?new Date(Date.UTC(Q[1],ae,Q[3]||1,Q[4]||0,Q[5]||0,Q[6]||0,de)):new Date(Q[1],ae,Q[3]||1,Q[4]||0,Q[5]||0,Q[6]||0,de)}}return new Date(Y)})(N),this.init()},U.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},U.$utils=function(){return _},U.isValid=function(){return this.$d.toString()!==w},U.isSame=function(N,q){var Y=L(N);return this.startOf(q)<=Y&&Y<=this.endOf(q)},U.isAfter=function(N,q){return L(N)<this.startOf(q)},U.isBefore=function(N,q){return this.endOf(q)<L(N)},U.$g=function(N,q,Y){return _.u(N)?this[q]:this.set(Y,N)},U.unix=function(){return Math.floor(this.valueOf()/1e3)},U.valueOf=function(){return this.$d.getTime()},U.startOf=function(N,q){var Y=this,oe=!!_.u(q)||q,Q=_.p(N),ae=function(ie,fe){var he=_.w(Y.$u?Date.UTC(Y.$y,fe,ie):new Date(Y.$y,fe,ie),Y);return oe?he:he.endOf(d)},de=function(ie,fe){return _.w(Y.toDate()[ie].apply(Y.toDate("s"),(oe?[0,0,0,0]:[23,59,59,999]).slice(fe)),Y)},X=this.$W,se=this.$M,J=this.$D,Z="set"+(this.$u?"UTC":"");switch(Q){case y:return oe?ae(1,0):ae(31,11);case m:return oe?ae(1,se):ae(0,se+1);case u:var G=this.$locale().weekStart||0,ue=(X<G?X+7:X)-G;return ae(oe?J-ue:J+(6-ue),se);case d:case x:return de(Z+"Hours",0);case l:return de(Z+"Minutes",1);case s:return de(Z+"Seconds",2);case i:return de(Z+"Milliseconds",3);default:return this.clone()}},U.endOf=function(N){return this.startOf(N,!1)},U.$set=function(N,q){var Y,oe=_.p(N),Q="set"+(this.$u?"UTC":""),ae=(Y={},Y[d]=Q+"Date",Y[x]=Q+"Date",Y[m]=Q+"Month",Y[y]=Q+"FullYear",Y[l]=Q+"Hours",Y[s]=Q+"Minutes",Y[i]=Q+"Seconds",Y[a]=Q+"Milliseconds",Y)[oe],de=oe===d?this.$D+(q-this.$W):q;if(oe===m||oe===y){var X=this.clone().set(x,1);X.$d[ae](de),X.init(),this.$d=X.set(x,Math.min(this.$D,X.daysInMonth())).$d}else ae&&this.$d[ae](de);return this.init(),this},U.set=function(N,q){return this.clone().$set(N,q)},U.get=function(N){return this[_.p(N)]()},U.add=function(N,q){var Y,oe=this;N=Number(N);var Q=_.p(q),ae=function(se){var J=L(oe);return _.w(J.date(J.date()+Math.round(se*N)),oe)};if(Q===m)return this.set(m,this.$M+N);if(Q===y)return this.set(y,this.$y+N);if(Q===d)return ae(1);if(Q===u)return ae(7);var de=(Y={},Y[s]=r,Y[l]=o,Y[i]=n,Y)[Q]||1,X=this.$d.getTime()+N*de;return _.w(X,this)},U.subtract=function(N,q){return this.add(-1*N,q)},U.format=function(N){var q=this,Y=this.$locale();if(!this.isValid())return Y.invalidDate||w;var oe=N||"YYYY-MM-DDTHH:mm:ssZ",Q=_.z(this),ae=this.$H,de=this.$m,X=this.$M,se=Y.weekdays,J=Y.months,Z=Y.meridiem,G=function(fe,he,me,le){return fe&&(fe[he]||fe(q,oe))||me[he].slice(0,le)},ue=function(fe){return _.s(ae%12||12,fe,"0")},ie=Z||function(fe,he,me){var le=fe<12?"AM":"PM";return me?le.toLowerCase():le};return oe.replace(b,(function(fe,he){return he||(function(me){switch(me){case"YY":return String(q.$y).slice(-2);case"YYYY":return _.s(q.$y,4,"0");case"M":return X+1;case"MM":return _.s(X+1,2,"0");case"MMM":return G(Y.monthsShort,X,J,3);case"MMMM":return G(J,X);case"D":return q.$D;case"DD":return _.s(q.$D,2,"0");case"d":return String(q.$W);case"dd":return G(Y.weekdaysMin,q.$W,se,2);case"ddd":return G(Y.weekdaysShort,q.$W,se,3);case"dddd":return se[q.$W];case"H":return String(ae);case"HH":return _.s(ae,2,"0");case"h":return ue(1);case"hh":return ue(2);case"a":return ie(ae,de,!0);case"A":return ie(ae,de,!1);case"m":return String(de);case"mm":return _.s(de,2,"0");case"s":return String(q.$s);case"ss":return _.s(q.$s,2,"0");case"SSS":return _.s(q.$ms,3,"0");case"Z":return Q}return null})(fe)||Q.replace(":","")}))},U.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},U.diff=function(N,q,Y){var oe,Q=this,ae=_.p(q),de=L(N),X=(de.utcOffset()-this.utcOffset())*r,se=this-de,J=function(){return _.m(Q,de)};switch(ae){case y:oe=J()/12;break;case m:oe=J();break;case g:oe=J()/3;break;case u:oe=(se-X)/6048e5;break;case d:oe=(se-X)/864e5;break;case l:oe=se/o;break;case s:oe=se/r;break;case i:oe=se/n;break;default:oe=se}return Y?oe:_.a(oe)},U.daysInMonth=function(){return this.endOf(m).$D},U.$locale=function(){return P[this.$L]},U.locale=function(N,q){if(!N)return this.$L;var Y=this.clone(),oe=F(N,q,!0);return oe&&(Y.$L=oe),Y},U.clone=function(){return _.w(this.$d,this)},U.toDate=function(){return new Date(this.valueOf())},U.toJSON=function(){return this.isValid()?this.toISOString():null},U.toISOString=function(){return this.$d.toISOString()},U.toString=function(){return this.$d.toUTCString()},I})(),z=E.prototype;return L.prototype=z,[["$ms",a],["$s",i],["$m",s],["$H",l],["$W",d],["$M",m],["$y",y],["$D",x]].forEach((function(I){z[I[1]]=function(U){return this.$g(U,I[0],I[1])}})),L.extend=function(I,U){return I.$i||(I(U,E,L),I.$i=!0),L},L.locale=F,L.isDayjs=A,L.unix=function(I){return L(1e3*I)},L.en=P[O],L.Ls=P,L.p={},L}))})(Gk)),Gk.exports}var nce=tce();const jr=yc(nce);var Kk={exports:{}},rce=Kk.exports,MD;function oce(){return MD||(MD=1,(function(e,t){(function(n,r){e.exports=r()})(rce,(function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,o=/([+-]|\d\d)/g;return function(a,i,s){var l=i.prototype;s.utc=function(w){var S={date:w,utc:!0,args:arguments};return new i(S)},l.utc=function(w){var S=s(this.toDate(),{locale:this.$L,utc:!0});return w?S.add(this.utcOffset(),n):S},l.local=function(){return s(this.toDate(),{locale:this.$L,utc:!1})};var d=l.parse;l.parse=function(w){w.utc&&(this.$u=!0),this.$utils().u(w.$offset)||(this.$offset=w.$offset),d.call(this,w)};var u=l.init;l.init=function(){if(this.$u){var w=this.$d;this.$y=w.getUTCFullYear(),this.$M=w.getUTCMonth(),this.$D=w.getUTCDate(),this.$W=w.getUTCDay(),this.$H=w.getUTCHours(),this.$m=w.getUTCMinutes(),this.$s=w.getUTCSeconds(),this.$ms=w.getUTCMilliseconds()}else u.call(this)};var m=l.utcOffset;l.utcOffset=function(w,S){var b=this.$utils().u;if(b(w))return this.$u?0:b(this.$offset)?m.call(this):this.$offset;if(typeof w=="string"&&(w=(function(O){O===void 0&&(O="");var P=O.match(r);if(!P)return null;var D=(""+P[0]).match(o)||["-",0,0],A=D[0],F=60*+D[1]+ +D[2];return F===0?0:A==="+"?F:-F})(w),w===null))return this;var $=Math.abs(w)<=16?60*w:w;if($===0)return this.utc(S);var k=this.clone();if(S)return k.$offset=$,k.$u=!1,k;var R=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(k=this.local().add($+R,n)).$offset=$,k.$x.$localOffset=R,k};var g=l.format;l.format=function(w){var S=w||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,S)},l.valueOf=function(){var w=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*w},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var y=l.toDate;l.toDate=function(w){return w==="s"&&this.$offset?s(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():y.call(this)};var x=l.diff;l.diff=function(w,S,b){if(w&&this.$u===w.$u)return x.call(this,w,S,b);var $=this.local(),k=s(w).local();return x.call($,k,S,b)}}}))})(Kk)),Kk.exports}var ace=oce();const dR=yc(ace);jr.extend(dR);function ou(e){return(e??"").startsWith("filter<")}function ice(e){const{parsed:t}=Mi.BooleanFilterExpression.parse(e);if(!(!t||t.not))return t.operator==="true"||t.operator==="false"?t.operator:void 0}function uu(e){const t=/^filter<(.+)>$/.exec(e??"");return t?t[1]:void 0}function fR(e){const t=e.filter(n=>n.trim()!=="");return t.length===0?"":Mi.StringFilterExpression.unparse({operator:"=",values:[...t]})}function SF(e){if(e.trim()==="")return[];const{parsed:t}=Mi.StringFilterExpression.parse(e);return kF(t)?t.values:[e]}function CF(e){return e===void 0||e.trim()===""?!0:kF(Mi.StringFilterExpression.parse(e).parsed)}function kF(e){return e!==null&&Mi.isStringCondition(e)&&e.operator==="="&&e.not!==!0}function sce(e){return Mi.NumberFilterExpression.unparse({operator:">=",values:[String(e)]})}function $F(e){const t=e.trim();if(t==="")return;const{parsed:n}=Mi.NumberFilterExpression.parse(t);if(n===null||n.operator!==">="||n.not===!0||n.values?.length!==1)return;const r=Number(n.values[0]);return Number.isFinite(r)?r:void 0}function lce(e,t){return Mi.NumberFilterExpression.unparse({operator:"range",startOperator:">=",startValue:String(e),endOperator:"<=",endValue:String(t)})}function EF(e){const t=e.trim();if(t==="")return;const{parsed:n}=Mi.NumberFilterExpression.parse(t);if(n===null||n.operator!=="range"||n.not===!0||n.startOperator!==">="||n.endOperator!=="<=")return;const r=Number(n.startValue),o=Number(n.endValue);return Number.isFinite(r)&&Number.isFinite(o)&&r<=o?[r,o]:void 0}const hy=[{key:"today",label:"Today",clause:{operator:"in",in:{moment:"today"}}},{key:"7d",label:"Last 7 days",clause:{operator:"in_last",units:"day",n:"7"}},{key:"30d",label:"Last 30 days",clause:{operator:"in_last",units:"day",n:"30"}},{key:"90d",label:"Last 90 days",clause:{operator:"in_last",units:"day",n:"90"}},{key:"12m",label:"Last 12 months",clause:{operator:"in_last",units:"month",n:"12"}}];function cce(e){const t=hy.find(n=>n.key===e);return t?Mi.TemporalFilterExpression.unparse(t.clause):void 0}function RF(e){const t=e.trim();if(t==="")return;const{parsed:n}=Mi.TemporalFilterExpression.parse(t);if(n!==null)for(const r of hy){const o=r.clause;if(o.operator===n.operator&&(o.operator==="in"&&n.operator==="in"&&n.not!==!0&&n.in.moment===o.in.moment||o.operator==="in_last"&&n.operator==="in_last"&&n.not!==!0&&n.units===o.units&&Number(n.n)===Number(o.n)))return r.key}}const uce=/^\d{4}-\d{2}-\d{2}$/;function dce(e,t){const n=jr.utc(t,"YYYY-MM-DD").add(1,"day");return Mi.TemporalFilterExpression.unparse({operator:"to",fromMoment:{moment:"literal",literal:e,units:"day"},toMoment:{moment:"literal",literal:n.format("YYYY-MM-DD"),units:"day"}})}function TF(e){const t=e.trim();if(t==="")return;const{parsed:n}=Mi.TemporalFilterExpression.parse(t);if(n===null||n.operator!=="to"||n.not===!0)return;const r=OD(n.fromMoment),o=OD(n.toMoment);if(r===void 0||o===void 0)return;const a=jr.utc(o,"YYYY-MM-DD").subtract(1,"day");if(!(!a.isValid()||a.isBefore(jr.utc(r,"YYYY-MM-DD"))))return{firstDay:r,lastDay:a.format("YYYY-MM-DD")}}function OD(e){return e.moment==="literal"&&uce.test(e.literal)?e.literal:void 0}const Ym="self";function MF(e){if(!e)return[];if(e.wasDimension&&!e.wasDimension())return[];const t=e.tag?.tag("drill");return t?(t.textArray("to")??[t.text("to")].filter(PD)).filter(PD):[]}function OF(e){const t=e.replace(/[-_]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}function PF(e){return e.tag?.tag("drill")?.text("given")??e.name}function v1(e){if(typeof e=="string"){const t=fR([e]);return t===""?void 0:t}if(typeof e=="boolean")return String(e);if(typeof e=="number")return Number.isFinite(e)?String(e):void 0;if(e instanceof Date){const t=e.toISOString();return t.slice(0,t.indexOf("T"))}}function Qk(e){return e instanceof Date?v1(e)??"":String(e)}function fce(e){if(!e||e.isHeader)return;const t=e.field;if(!t)return;const n=MF(t);if(n.length===0)return;const r=v1(e.value);if(r!==void 0)return{to:n,given:PF(t),value:r,rawValue:e.value,label:Qk(e.value)}}function PD(e){return typeof e=="string"&&e!==""}function pce(e,t){if(t!==void 0&&!ou(t)){if(t==="number"){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string"||e.trim()==="")return;const n=Number(e);return Number.isFinite(n)?n:void 0}if(t==="date"||t==="timestamp"||t==="timestamptz")return e instanceof Date?e:void 0;if(t==="boolean")return typeof e=="boolean"?e:e==="true"?!0:e==="false"?!1:void 0;if(typeof e=="string")return e.trim()===""?void 0:e;if(typeof e=="number")return Number.isFinite(e)?String(e):void 0;if(typeof e=="boolean")return String(e)}return uu(t)==="string"&&typeof e=="number"?Number.isFinite(e)?fR([String(e)]):void 0:uu(t)==="number"?typeof e=="number"?Number.isFinite(e)?String(e):void 0:typeof e!="string"||e.trim()===""?void 0:Number.isFinite(Number(e))?e.trim():void 0:v1(e)}function hce({declaredTypes:e,setGiven:t,documentName:n}){const r=y1(),o=C.useMemo(()=>{const l=new Map;for(const d of e.keys())l.has(d.toLowerCase())||l.set(d.toLowerCase(),d);return l},[e]),a=C.useCallback(l=>e.has(l)?l:o.get(l.toLowerCase()),[e,o]),i=C.useCallback(l=>a(l)!==void 0,[a]),s=C.useCallback((l,d)=>{const u=a(l);if(u===void 0){r.emit({type:"report.drill",to:"self",outcome:"unresolved"}),r.listening||console.warn(`# drill { to=self } tried to set '${l}', which '${n}' does not declare as a given. Name the given with 'given=' on the drill tag.`);return}const m=e.get(u),g=pce(d,m);if(g===void 0){r.emit({type:"report.drill",to:"self",outcome:"malformed"}),r.listening||console.warn(`Drill declined: ${JSON.stringify(d)} cannot be a value for given "${u}"`+(m?` of type ${m}`:""));return}t(u,g),r.emit({type:"report.drill",to:"self",outcome:"resolved"})},[e,n,a,t,r]);return{resolveGiven:a,canSelf:i,onSelf:s}}function jF(e,t){if(e!=null){if(e instanceof Date)return pR(e,t);if(!Array.isArray(e))return String(e)}}function mce(e,t){return new Date(Date.UTC(e.year(),e.month(),e.date(),t?.getUTCHours()??0,t?.getUTCMinutes()??0,t?.getUTCSeconds()??0,t?.getUTCMilliseconds()??0))}const gce=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(\d{1,2}):(\d{2})(?::(\d{2}))?(?:\.(\d{1,9}))?)?\s*(Z|[+-]\d{2}:?\d{2}|[+-]\d{2}|UTC|GMT)?$/i;function AF(e){const t=e.trim();return t===""?e:t.replace(/^(\d{4}-\d{1,2}-\d{1,2}[T\s]+\d{1,2}:\d{2}(?::\d{2})?(?:\.\d{1,9})?)\s+(\d{2}:?\d{2}|\d{2})$/,"$1+$2")}function yce(e,t=!1){const n=AF(e);if(n==="")return;const r=gce.exec(n);if(!r)return;const[,o,a,i,s,l,d,u,m]=r,g={year:Number(o),month:Number(a),day:Number(i),hour:Number(s??0),minute:Number(l??0),second:Number(d??0),milli:Number((u??"").slice(0,3).padEnd(3,"0")||0)},y=Date.UTC(g.year,g.month-1,g.day,g.hour,g.minute,g.second,g.milli),x=new Date(y);if(!(x.getUTCFullYear()===g.year&&x.getUTCMonth()===g.month-1&&x.getUTCDate()===g.day&&x.getUTCHours()===g.hour&&x.getUTCMinutes()===g.minute&&x.getUTCSeconds()===g.second)||m!==void 0&&s===void 0)return;const w=vce(m);if(w===void 0)return;const S=new Date(y-w*6e4);if(!(t&&m!==void 0&&S.getUTCDate()!==g.day))return S}function vce(e){if(e===void 0)return 0;const t=e.toUpperCase();if(t==="Z"||t==="UTC"||t==="GMT")return 0;const n=/^([+-])(\d{2}):?(\d{2})?$/.exec(t);if(!n)return;const r=Number(n[3]??0);if(r>59)return;const o=Number(n[2])*60+r,a=n[1]!=="-";if(!(o>(a?840:720)))return a?o:-o}function DF(e){return!bce.has(e??"")}const bce=new Set(["boolean","number","date","timestamp","timestamptz"]);function NF(e,t){if(t===""&&!DF(e))return null;if(ou(e))return t;switch(e){case"number":{const n=t.trim()===""?NaN:Number(t);return Number.isFinite(n)?n:t}case"boolean":return t==="true"?!0:t==="false"?!1:t;case"date":case"timestamp":case"timestamptz":{const n=AF(t);return yce(n,e==="date")??n}default:return t}}function m0(e,t){const n={};for(const[r,o]of e){const a=jF(o,t.get(r));a!==void 0&&(n[r]=a)}return n}function pR(e,t){const n=e.toISOString();switch(t){case"timestamptz":return n;case"timestamp":return n.slice(0,-1);default:return n.slice(0,10)}}function Zd(e,t,n){const r=n?new Set(n):void 0,o={};for(const[a,i]of e)r&&!r.has(a)||i!=null&&(Array.isArray(i)||(o[a]=i instanceof Date?pR(i,t.get(a)):i));return o}function hR(e,t,n){if(!t)return e;const r=n?new Set(n):void 0,o={...e};for(const[a,i]of Object.entries(t))r&&!r.has(a)||a in o||i===null||i===void 0||(o[a]=Array.isArray(i)?[...i]:i instanceof Date?pR(i,void 0):i);return o}function jD(e,t){const n=new Map;for(const[r,o]of Object.entries(e))t.has(r)&&n.set(r,NF(t.get(r),o));return n}function xC(e,t){const n=Array.from(e.keys()).filter(o=>!t.has(o));if(n.length===0)return e;const r=new Map(e);for(const o of n)r.delete(o);return r}function AD(e){return Object.entries(e??{}).sort(([t],[n])=>t<n?-1:1)}function xce(e,t,n){for(const r of n.keys())if(e[r]!==t[r])return!1;return!0}const wce=1500;function Pb(e,t){const n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(r=>e[r]===t[r])}function IF({declaredTypes:e,startingValues:t,params:n,onParamsChange:r,documentKey:o,autorun:a}){const i=C.useMemo(()=>jD(t??{},e),[e,JSON.stringify(t)]),s=C.useRef(null),l=C.useRef([]),d=C.useRef(0),u=C.useRef({documentKey:o,params:n}),m=U=>U!==null&&xce(n??{},U,e),g=Date.now();l.current=l.current.filter(U=>g-U.at<wce);const y=(s.current===null?l.current.map(U=>U.params):[...l.current.map(U=>U.params),s.current]).findIndex(m);u.current.documentKey!==o&&(l.current=[]),(u.current.documentKey!==o||!Pb(n??{},u.current.params??{})&&y<0)&&(u.current={documentKey:o,params:n}),y>0&&(l.current=l.current.slice(y));const x=u.current.params,w=JSON.stringify(t),S=JSON.stringify(x),b=C.useMemo(()=>jD({...t??{},...x??{}},e),[e,w,S]),$=C.useMemo(()=>JSON.stringify([o??null,AD(t),AD(x)]),[o,w,S]),[k,R]=C.useState(null),O=k?.key===$?k:null;C.useEffect(()=>{k!==null&&k.key!==$&&R(null)},[k,$]);const P=C.useMemo(()=>xC(O?.draft??b,e),[O,b,e]),D=C.useMemo(()=>xC(O?.applied??b,e),[O,b,e]),A=C.useCallback(U=>U?.key===$?U:{key:$,draft:b,applied:b},[$,b]),F=C.useMemo(()=>m0(D,e),[D,e]);s.current===null&&(s.current=F,d.current=Date.now()),C.useEffect(()=>{r&&(Pb(s.current??{},F)||(s.current!==null&&(l.current=[...l.current.slice(-31),{params:s.current,at:d.current}]),s.current=F,d.current=Date.now(),r(F)))},[F,r]);const L=C.useCallback((U,N)=>{R(q=>{const Y=A(q),oe=new Map(Y.draft);return N===null?oe.delete(U):oe.set(U,N),{key:Y.key,draft:oe,applied:a?oe:Y.applied}})},[a,A]),_=C.useCallback(()=>{R(U=>({key:A(U).key,draft:i,applied:i}))},[A,i]),E=C.useCallback(()=>{R(U=>{const N=A(U);return{key:N.key,draft:N.draft,applied:N.draft}})},[A]),z=C.useMemo(()=>{if(a)return!1;if(P.size!==D.size)return!0;for(const[U,N]of P){const q=D.get(U);if(N instanceof Date&&q instanceof Date){if(N.getTime()!==q.getTime())return!0}else if(Array.isArray(N)&&Array.isArray(q)){if(String(N)!==String(q))return!0}else if(N!==q)return!0}return!1},[a,P,D]),I=C.useMemo(()=>{const U=m0(xC(i,e),e);return Pb(m0(P,e),U)&&Pb(F,U)},[i,P,F,e]);return{draft:P,applied:D,setGiven:L,reset:_,apply:E,pending:z,atStart:I}}const Sce="You don't have access to this data";function c2e(e){return(e??[]).filter(t=>t.kind==="definition"&&!t.restricted).map(t=>t.text??"").join(`
350
350
 
351
351
  `)}function b1(e,t){return e===""?t:`${e}
352
352
 
@@ -469,15 +469,15 @@ ${t}`}function Cce(e){return e?.status===403}function Xp(e){return`\`${e.replace
469
469
  `));u&&A.current&&A.current.getSectionContent(O.startIndex).focus()},[]),{interactions:U,returnedValue:{autoFocus:u,readOnly:n,focused:d??z,sectionListRef:F,onBlur:ae,onClick:q,onFocus:Q,onInput:Y,onPaste:oe,enableAccessibleFieldDOMStructure:!0,elements:fe,tabIndex:w===0?-1:0,contentEditable:ie,value:me,onChange:he,areAllSectionsEmpty:P}}},kp=e=>e.replace(/[\u2066\u2067\u2068\u2069]/g,""),Oge=(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],l=SR(s,n?"input-rtl":"input-ltr",t),d=`${s.startSeparator}${l}${s.endSeparator}`,u=kp(d).length,m=d.length,g=kp(l),y=o+(g===""?0:l.indexOf(g[0]))+s.startSeparator.length,x=y+g.length;a.push(Fe({},s,{start:r,end:r+u,startInInput:y,endInInput:x})),r+=u,o+=m}return a},Pge=e=>{const t=zs(),n=C.useRef(void 0),r=C.useRef(void 0),{forwardedProps:{onFocus:o,onClick:a,onPaste:i,onBlur:s,inputRef:l,placeholder:d},internalProps:{readOnly:u=!1,disabled:m=!1},parsedSelectedSections:g,activeSectionIndex:y,state:x,fieldValueManager:w,valueManager:S,applyCharacterEditing:b,resetCharacterQuery:$,updateSectionValue:k,updateValueFromValueStr:R,clearActiveSection:O,clearValue:P,setTempAndroidValueStr:D,setSelectedSections:A,getSectionsFromValue:F,areAllSectionsEmpty:L,localizedDigits:_}=e,E=C.useRef(null),z=vr(l,E),I=C.useMemo(()=>Oge(x.sections,_,t),[x.sections,_,t]),U=C.useMemo(()=>({syncSelectionToDOM:()=>{if(!E.current)return;if(g==null){E.current.scrollLeft&&(E.current.scrollLeft=0);return}if(E.current!==_a(document))return;const Z=E.current.scrollTop;if(g==="all")E.current.select();else{const G=I[g],ue=G.type==="empty"?G.startInInput-G.startSeparator.length:G.startInInput,ie=G.type==="empty"?G.endInInput+G.endSeparator.length:G.endInInput;(ue!==E.current.selectionStart||ie!==E.current.selectionEnd)&&E.current===_a(document)&&E.current.setSelectionRange(ue,ie),clearTimeout(r.current),r.current=setTimeout(()=>{E.current&&E.current===_a(document)&&E.current.selectionStart===E.current.selectionEnd&&(E.current.selectionStart!==ue||E.current.selectionEnd!==ie)&&U.syncSelectionToDOM()})}E.current.scrollTop=Z},getActiveSectionIndexFromDOM:()=>{const Z=E.current.selectionStart??0,G=E.current.selectionEnd??0;if(Z===0&&G===0)return null;const ue=Z<=I[0].startInInput?1:I.findIndex(ie=>ie.startInInput-ie.startSeparator.length>Z);return ue===-1?I.length-1:ue-1},focusField:(Z=0)=>{_a(document)!==E.current&&(E.current?.focus(),A(Z))},setSelectedSections:Z=>A(Z),isFieldFocused:()=>E.current===_a(document)}),[E,g,I,A]),N=()=>{const Z=E.current.selectionStart??0;let G;Z<=I[0].startInInput||Z>=I[I.length-1].endInInput?G=1:G=I.findIndex(ie=>ie.startInInput-ie.startSeparator.length>Z);const ue=G===-1?I.length-1:G-1;A(ue)},q=Yt((...Z)=>{o?.(...Z);const G=E.current;clearTimeout(n.current),n.current=setTimeout(()=>{!G||G!==E.current||y==null&&(G.value.length&&Number(G.selectionEnd)-Number(G.selectionStart)===G.value.length?A("all"):N())})}),Y=Yt((Z,...G)=>{Z.isDefaultPrevented()||(a?.(Z,...G),N())}),oe=Yt(Z=>{if(i?.(Z),Z.preventDefault(),u||m)return;const G=Z.clipboardData.getData("text");if(typeof g=="number"){const ue=x.sections[g],ie=/^[a-zA-Z]+$/.test(G),fe=/^[0-9]+$/.test(G),he=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(G);if(ue.contentType==="letter"&&ie||ue.contentType==="digit"&&fe||ue.contentType==="digit-with-letter"&&he){$(),k({activeSection:ue,newSectionValue:G,shouldGoToNextSection:!0});return}if(ie||fe)return}$(),R(G)}),Q=Yt((...Z)=>{s?.(...Z),A(null)}),ae=Yt(Z=>{if(u)return;const G=Z.target.value;if(G===""){$(),P();return}const ue=Z.nativeEvent.data,ie=ue&&ue.length>1,fe=ie?ue:G,he=kp(fe);if(g==="all"&&A(y),y==null||ie){R(ie?ue:he);return}let me;if(g==="all"&&he.length===1)me=he;else{const le=kp(w.getV6InputValueFromSections(I,_,t));let ve=-1,Le=-1;for(let ne=0;ne<le.length;ne+=1)ve===-1&&le[ne]!==he[ne]&&(ve=ne),Le===-1&&le[le.length-ne-1]!==he[he.length-ne-1]&&(Le=ne);const Ie=I[y];if(ve<Ie.start||le.length-Le-1>Ie.end)return;const Re=he.length-le.length+Ie.end-kp(Ie.endSeparator||"").length;me=he.slice(Ie.start+kp(Ie.startSeparator||"").length,Re)}if(me.length===0){Due()&&D(fe),$(),O();return}b({keyPressed:me,sectionIndex:y})}),de=C.useMemo(()=>d!==void 0?d:w.getV6InputValueFromSections(F(S.emptyValue),_,t),[d,w,F,S.emptyValue,_,t]),X=C.useMemo(()=>x.tempValueStrAndroid??w.getV6InputValueFromSections(x.sections,_,t),[x.sections,w,x.tempValueStrAndroid,_,t]);C.useEffect(()=>(E.current&&E.current===_a(document)&&A("all"),()=>{clearTimeout(n.current),clearTimeout(r.current)}),[]);const se=C.useMemo(()=>y==null||x.sections[y].contentType==="letter"?"text":"numeric",[y,x.sections]),J=!(E.current&&E.current===_a(document))&&L;return{interactions:U,returnedValue:{readOnly:u,onBlur:Q,onClick:Y,onFocus:q,onPaste:oe,inputRef:z,enableAccessibleFieldDOMStructure:!1,placeholder:de,inputMode:se,autoComplete:"off",value:J?"":X,onChange:ae}}},jge=e=>{const t=Qr(),{internalProps:n,internalProps:{unstableFieldRef:r,minutesStep:o,enableAccessibleFieldDOMStructure:a=!1,disabled:i=!1,readOnly:s=!1},forwardedProps:{onKeyDown:l,error:d,clearable:u,onClear:m},fieldValueManager:g,valueManager:y,validator:x}=e,w=zs(),S=Ege(e),{state:b,activeSectionIndex:$,parsedSelectedSections:k,setSelectedSections:R,clearValue:O,clearActiveSection:P,updateSectionValue:D,setTempAndroidValueStr:A,sectionsValueBoundaries:F,localizedDigits:L,timezone:_}=S,E=Tge({sections:b.sections,updateSectionValue:D,sectionsValueBoundaries:F,localizedDigits:L,setTempAndroidValueStr:A,timezone:_}),{resetCharacterQuery:z}=E,I=y.areValuesEqual(t,b.value,y.emptyValue),U=a?Mge:Pge,N=C.useMemo(()=>Nue(b.sections,w&&!a),[b.sections,w,a]),{returnedValue:q,interactions:Y}=U(Fe({},e,S,E,{areAllSectionsEmpty:I,sectionOrder:N})),oe=Yt(J=>{if(l?.(J),!i)switch(!0){case((J.ctrlKey||J.metaKey)&&String.fromCharCode(J.keyCode)==="A"&&!J.shiftKey&&!J.altKey):{J.preventDefault(),R("all");break}case J.key==="ArrowRight":{if(J.preventDefault(),k==null)R(N.startIndex);else if(k==="all")R(N.endIndex);else{const Z=N.neighbors[k].rightIndex;Z!==null&&R(Z)}break}case J.key==="ArrowLeft":{if(J.preventDefault(),k==null)R(N.endIndex);else if(k==="all")R(N.startIndex);else{const Z=N.neighbors[k].leftIndex;Z!==null&&R(Z)}break}case J.key==="Delete":{if(J.preventDefault(),s)break;k==null||k==="all"?O():P(),z();break}case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(J.key):{if(J.preventDefault(),s||$==null)break;k==="all"&&R($);const Z=b.sections[$],G=g.getActiveDateManager(t,b,Z),ue=Rue(t,_,Z,J.key,F,L,G.date,{minutesStep:o});D({activeSection:Z,newSectionValue:ue,shouldGoToNextSection:!1});break}}});Yo(()=>{Y.syncSelectionToDOM()});const{hasValidationError:Q}=s3({props:n,validator:x,timezone:_,value:b.value,onError:n.onError}),ae=C.useMemo(()=>d!==void 0?d:Q,[Q,d]);C.useEffect(()=>{!ae&&$==null&&z()},[b.referenceValue,$,ae]),C.useEffect(()=>{b.tempValueStrAndroid!=null&&$!=null&&(z(),P())},[b.sections]),C.useImperativeHandle(r,()=>({getSections:()=>b.sections,getActiveSectionIndex:Y.getActiveSectionIndexFromDOM,setSelectedSections:Y.setSelectedSections,focusField:Y.focusField,isFieldFocused:Y.isFieldFocused}));const de=Yt((J,...Z)=>{J.preventDefault(),m?.(J,...Z),O(),Y.isFieldFocused()?R(N.startIndex):Y.focusField(0)}),X={onKeyDown:oe,onClear:de,error:ae,clearable:!!(u&&!I&&!s&&!i)},se={disabled:i,readOnly:s};return Fe({},e.forwardedProps,X,se,q)},Age=["clearable","onClear","InputProps","sx","slots","slotProps"],Dge=["ownerState"],Nge=e=>{const t=vc(),{clearable:n,onClear:r,InputProps:o,sx:a,slots:i,slotProps:s}=e,l=qn(e,Age),d=i?.clearButton??Eu,u=Sr({elementType:d,externalSlotProps:s?.clearButton,ownerState:{},className:"clearButton",additionalProps:{title:t.fieldClearLabel}}),m=qn(u,Dge),g=i?.clearIcon??qhe,y=Sr({elementType:g,externalSlotProps:s?.clearIcon,ownerState:{}});return Fe({},l,{InputProps:Fe({},o,{endAdornment:p.jsxs(C.Fragment,{children:[n&&p.jsx(l3,{position:"end",sx:{marginRight:o?.endAdornment?-1:-1.5},children:p.jsx(d,Fe({},m,{onClick:r,children:p.jsx(g,Fe({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]]})},Ige=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator"],Lge=(e,t)=>C.useMemo(()=>{const n=Fe({},e),r={},o=a=>{n.hasOwnProperty(a)&&(r[a]=n[a],delete n[a])};return Ige.forEach(o),a3.forEach(o),{forwardedProps:n,internalProps:r}},[e,t]),zge=e=>{const t=Qr(),n=ev();return Fe({},e,{disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,format:e.format??t.formats.keyboardDate,minDate:is(t,e.minDate,n.minDate),maxDate:is(t,e.maxDate,n.maxDate)})},Fge=e=>{const t=zge(e),{forwardedProps:n,internalProps:r}=Lge(t,"date");return jge({forwardedProps:n,internalProps:r,valueManager:Cl,fieldValueManager:Fue,validator:tv,valueType:"date"})};function _ge(e){return kn("MuiPickersTextField",e)}vn("MuiPickersTextField",["root","focused","disabled","error","required"]);function Bge(e){return kn("MuiPickersInputBase",e)}const Np=vn("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input"]);function Uge(e){return kn("MuiPickersSectionList",e)}const Jm=vn("MuiPickersSectionList",["root","section","sectionContent"]),Vge=["slots","slotProps","elements","sectionListRef"],q3=ot("div",{name:"MuiPickersSectionList",slot:"Root",overridesResolver:(e,t)=>t.root})({direction:"ltr /*! @noflip */",outline:"none"}),H3=ot("span",{name:"MuiPickersSectionList",slot:"Section",overridesResolver:(e,t)=>t.section})({}),W3=ot("span",{name:"MuiPickersSectionList",slot:"SectionSeparator",overridesResolver:(e,t)=>t.sectionSeparator})({whiteSpace:"pre"}),Y3=ot("span",{name:"MuiPickersSectionList",slot:"SectionContent",overridesResolver:(e,t)=>t.sectionContent})({outline:"none"}),qge=e=>{const{classes:t}=e;return Sn({root:["root"],section:["section"],sectionContent:["sectionContent"]},Uge,t)};function Hge(e){const{slots:t,slotProps:n,element:r,classes:o}=e,a=t?.section??H3,i=Sr({elementType:a,externalSlotProps:n?.section,externalForwardedProps:r.container,className:o.section,ownerState:{}}),s=t?.sectionContent??Y3,l=Sr({elementType:s,externalSlotProps:n?.sectionContent,externalForwardedProps:r.content,additionalProps:{suppressContentEditableWarning:!0},className:o.sectionContent,ownerState:{}}),d=t?.sectionSeparator??W3,u=Sr({elementType:d,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.before,ownerState:{position:"before"}}),m=Sr({elementType:d,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.after,ownerState:{position:"after"}});return p.jsxs(a,Fe({},i,{children:[p.jsx(d,Fe({},u)),p.jsx(s,Fe({},l)),p.jsx(d,Fe({},m))]}))}const Wge=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersSectionList"}),{slots:r,slotProps:o,elements:a,sectionListRef:i}=n,s=qn(n,Vge),l=qge(n),d=C.useRef(null),u=vr(t,d),m=x=>{if(!d.current)throw new Error(`MUI X: Cannot call sectionListRef.${x} before the mount of the component.`);return d.current};C.useImperativeHandle(i,()=>({getRoot(){return m("getRoot")},getSectionContainer(x){return m("getSectionContainer").querySelector(`.${Jm.section}[data-sectionindex="${x}"]`)},getSectionContent(x){return m("getSectionContent").querySelector(`.${Jm.section}[data-sectionindex="${x}"] .${Jm.sectionContent}`)},getSectionIndexFromDOMElement(x){const w=m("getSectionIndexFromDOMElement");if(x==null||!w.contains(x))return null;let S=null;return x.classList.contains(Jm.section)?S=x:x.classList.contains(Jm.sectionContent)&&(S=x.parentElement),S==null?null:Number(S.dataset.sectionindex)}}));const g=r?.root??q3,y=Sr({elementType:g,externalSlotProps:o?.root,externalForwardedProps:s,additionalProps:{ref:u,suppressContentEditableWarning:!0},className:l.root,ownerState:{}});return p.jsx(g,Fe({},y,{children:y.contentEditable?a.map(({content:x,before:w,after:S})=>`${w.children}${x.children}${S.children}`).join(""):p.jsx(C.Fragment,{children:a.map((x,w)=>p.jsx(Hge,{slots:r,slotProps:o,element:x,classes:l},w))})}))}),Yge=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef"],Gge=e=>Math.round(e*1e5)/1e5,P1=ot("div",{name:"MuiPickersInputBase",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>Fe({},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:`${Gge(.15/16)}em`,variants:[{props:{fullWidth:!0},style:{width:"100%"}}]})),qR=ot(q3,{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}}]})),Kge=ot(H3,{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"})),Qge=ot(Y3,{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"})),Xge=ot(W3,{name:"MuiPickersInputBase",slot:"Separator",overridesResolver:(e,t)=>t.separator})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),Zge=ot("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(e,t)=>t.hiddenInput})(Fe({},pue)),Jge=e=>{const{focused:t,disabled:n,error:r,classes:o,fullWidth:a,readOnly:i,color:s,size:l,endAdornment:d,startAdornment:u}=e,m={root:["root",t&&!n&&"focused",n&&"disabled",i&&"readOnly",r&&"error",a&&"fullWidth",`color${zt(s)}`,l==="small"&&"inputSizeSmall",!!u&&"adornedStart",!!d&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"]};return Sn(m,Bge,o)},HR=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersInputBase"}),{elements:r,areAllSectionsEmpty:o,value:a,onChange:i,id:s,endAdornment:l,startAdornment:d,renderSuffix:u,slots:m,slotProps:g,contentEditable:y,tabIndex:x,onInput:w,onPaste:S,onKeyDown:b,name:$,readOnly:k,inputProps:R,inputRef:O,sectionListRef:P}=n,D=qn(n,Yge),A=C.useRef(null),F=vr(t,A),L=vr(R?.ref,O),_=zs(),E=_s();if(!E)throw new Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");const z=oe=>{if(E.disabled){oe.stopPropagation();return}E.onFocus?.(oe)};C.useEffect(()=>{E&&E.setAdornedStart(!!d)},[E,d]),C.useEffect(()=>{E&&(o?E.onEmpty():E.onFilled())},[E,o]);const I=Fe({},n,E,{isRtl:_}),U=Jge(I),N=m?.root||P1,q=Sr({elementType:N,externalSlotProps:g?.root,externalForwardedProps:D,additionalProps:{"aria-invalid":E.error,ref:F},className:U.root,ownerState:I}),Y=m?.input||qR;return p.jsxs(N,Fe({},q,{children:[d,p.jsx(Wge,{sectionListRef:P,elements:r,contentEditable:y,tabIndex:x,className:U.sectionsContainer,onFocus:z,onBlur:E.onBlur,onInput:w,onPaste:S,onKeyDown:b,slots:{root:Y,section:Kge,sectionContent:Qge,sectionSeparator:Xge},slotProps:{root:{ownerState:I},sectionContent:{className:Np.sectionContent},sectionSeparator:({position:oe})=>({className:oe==="before"?Np.sectionBefore:Np.sectionAfter})}}),l,u?u(Fe({},E)):null,p.jsx(Zge,Fe({name:$,className:U.input,value:a,onChange:i,id:s,"aria-hidden":"true",tabIndex:-1,readOnly:k,required:E.required,disabled:E.disabled},R,{ref:L}))]}))});function eye(e){return kn("MuiPickersOutlinedInput",e)}const Ps=Fe({},Np,vn("MuiPickersOutlinedInput",["root","notchedOutline","input"])),tye=["children","className","label","notched","shrink"],nye=ot("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}}),DN=ot("span")(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit"})),rye=ot("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 oye(e){const{className:t,label:n}=e,r=qn(e,tye),o=n!=null&&n!=="",a=Fe({},e,{withLabel:o});return p.jsx(nye,Fe({"aria-hidden":!0,className:t},r,{ownerState:a,children:p.jsx(rye,{ownerState:a,children:o?p.jsx(DN,{children:n}):p.jsx(DN,{className:"notranslate",children:"​"})})}))}const aye=["label","autoFocus","ownerState","notched"],iye=ot(P1,{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 .${Ps.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${Ps.notchedOutline}`]:{borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}},[`&.${Ps.focused} .${Ps.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${Ps.disabled}`]:{[`& .${Ps.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled},"*":{color:(e.vars||e).palette.action.disabled}},[`&.${Ps.error} .${Ps.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:{[`&.${Ps.focused}:not(.${Ps.error}) .${Ps.notchedOutline}`]:{borderColor:(e.vars||e).palette[n].main}}}))}}),sye=ot(qR,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({padding:"16.5px 0",variants:[{props:{size:"small"},style:{padding:"8.5px 0"}}]}),lye=e=>{const{classes:t}=e,n=Sn({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},eye,t);return Fe({},t,n)},G3=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersOutlinedInput"}),{label:r,ownerState:o,notched:a}=n,i=qn(n,aye),s=_s(),l=Fe({},n,o,s,{color:s?.color||"primary"}),d=lye(l);return p.jsx(HR,Fe({slots:{root:iye,input:sye},renderSuffix:u=>p.jsx(oye,{shrink:!!(a||u.adornedStart||u.focused||u.filled),notched:!!(a||u.adornedStart||u.focused||u.filled),className:d.notchedOutline,label:r!=null&&r!==""&&s?.required?p.jsxs(C.Fragment,{children:[r," ","*"]}):r,ownerState:l})},i,{label:r,classes:d,ref:t}))});G3.muiName="Input";function cye(e){return kn("MuiPickersFilledInput",e)}const ld=Fe({},Np,vn("MuiPickersFilledInput",["root","underline","input"])),uye=["label","autoFocus","disableUnderline","ownerState"],dye=ot(P1,{name:"MuiPickersFilledInput",slot:"Root",overridesResolver:(e,t)=>t.root,shouldForwardProp:e=>e0(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}},[`&.${ld.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${ld.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"},[`&.${ld.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${ld.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(.${ld.disabled}, .${ld.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${ld.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:({startAdornment:i})=>!!i,style:{paddingLeft:12}},{props:({endAdornment:i})=>!!i,style:{paddingRight:12}}]}}),fye=ot(qR,{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}}]}),pye=e=>{const{classes:t,disableUnderline:n}=e,r=Sn({root:["root",!n&&"underline"],input:["input"]},cye,t);return Fe({},t,r)},K3=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersFilledInput"}),{label:r,disableUnderline:o=!1,ownerState:a}=n,i=qn(n,uye),s=_s(),l=Fe({},n,a,s,{color:s?.color||"primary"}),d=pye(l);return p.jsx(HR,Fe({slots:{root:dye,input:fye},slotProps:{root:{disableUnderline:o}}},i,{label:r,classes:d,ref:t}))});K3.muiName="Input";function hye(e){return kn("MuiPickersFilledInput",e)}const eg=Fe({},Np,vn("MuiPickersInput",["root","input"])),mye=["label","autoFocus","disableUnderline","ownerState"],gye=ot(P1,{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"},[`&.${eg.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${eg.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(.${eg.disabled}, .${eg.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${eg.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),yye=e=>{const{classes:t,disableUnderline:n}=e,r=Sn({root:["root",!n&&"underline"],input:["input"]},hye,t);return Fe({},t,r)},Q3=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersInput"}),{label:r,disableUnderline:o=!1,ownerState:a}=n,i=qn(n,mye),s=_s(),l=Fe({},n,a,s,{disableUnderline:o,color:s?.color||"primary"}),d=yye(l);return p.jsx(HR,Fe({slots:{root:gye}},i,{label:r,classes:d,ref:t}))});Q3.muiName="Input";const vye=["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"],bye={standard:Q3,filled:K3,outlined:G3},xye=ot(A3,{name:"MuiPickersTextField",slot:"Root",overridesResolver:(e,t)=>t.root})({maxWidth:"100%"}),wye=e=>{const{focused:t,disabled:n,classes:r,required:o}=e;return Sn({root:["root",t&&!n&&"focused",n&&"disabled",o&&"required"]},_ge,r)},Sye=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersTextField"}),{onFocus:r,onBlur:o,className:a,color:i="primary",disabled:s=!1,error:l=!1,variant:d="outlined",required:u=!1,InputProps:m,inputProps:g,inputRef:y,sectionListRef:x,elements:w,areAllSectionsEmpty:S,onClick:b,onKeyDown:$,onKeyUp:k,onPaste:R,onInput:O,endAdornment:P,startAdornment:D,tabIndex:A,contentEditable:F,focused:L,value:_,onChange:E,fullWidth:z,id:I,name:U,helperText:N,FormHelperTextProps:q,label:Y,InputLabelProps:oe}=n,Q=qn(n,vye),ae=C.useRef(null),de=vr(t,ae),X=Fs(I),se=N&&X?`${X}-helper-text`:void 0,J=Y&&X?`${X}-label`:void 0,Z=Fe({},n,{color:i,disabled:s,error:l,focused:L,required:u,variant:d}),G=wye(Z),ue=bye[d];return p.jsxs(xye,Fe({className:Ht(G.root,a),ref:de,focused:L,onFocus:r,onBlur:o,disabled:s,variant:d,error:l,color:i,fullWidth:z,required:u,ownerState:Z},Q,{children:[p.jsx(j3,Fe({htmlFor:X,id:J},oe,{children:Y})),p.jsx(ue,Fe({elements:w,areAllSectionsEmpty:S,onClick:b,onKeyDown:$,onKeyUp:k,onInput:O,onPaste:R,endAdornment:P,startAdornment:D,tabIndex:A,contentEditable:F,value:_,onChange:E,id:X,fullWidth:z,inputProps:g,inputRef:y,sectionListRef:x,label:Y,name:U,role:"group","aria-labelledby":J,"aria-describedby":se,"aria-live":se?"polite":void 0},m)),N&&p.jsx(D3,Fe({id:se},q,{children:N}))]}))}),Cye=["enableAccessibleFieldDOMStructure"],kye=["InputProps","readOnly"],$ye=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef"],Eye=e=>{let{enableAccessibleFieldDOMStructure:t}=e,n=qn(e,Cye);if(t){const{InputProps:m,readOnly:g}=n,y=qn(n,kye);return Fe({},y,{InputProps:Fe({},m??{},{readOnly:g})})}const{onPaste:r,onKeyDown:o,inputMode:a,readOnly:i,InputProps:s,inputProps:l,inputRef:d}=n,u=qn(n,$ye);return Fe({},u,{InputProps:Fe({},s??{},{readOnly:i}),inputProps:Fe({},l??{},{inputMode:a,onPaste:r,onKeyDown:o,ref:d})})},Rye=["slots","slotProps","InputProps","inputProps"],X3=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiDateField"}),{slots:r,slotProps:o,InputProps:a,inputProps:i}=n,s=qn(n,Rye),l=n,d=r?.textField??(e.enableAccessibleFieldDOMStructure?Sye:yr),u=Sr({elementType:d,externalSlotProps:o?.textField,externalForwardedProps:s,additionalProps:{ref:t},ownerState:l});u.inputProps=Fe({},i,u.inputProps),u.InputProps=Fe({},a,u.InputProps);const m=Fge(u),g=Eye(m),y=Nge(Fe({},g,{slots:r,slotProps:o}));return p.jsx(d,Fe({},y))}),Z3=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:a,disablePast:i,timezone:s})=>{const l=Jd();return C.useCallback(d=>tv({adapter:l,value:d,timezone:s,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:a,disablePast:i}})!==null,[l,e,t,n,r,o,a,i,s])},Tye=(e,t,n)=>(r,o)=>{switch(o.type){case"changeMonth":return Fe({},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))),Fe({},r,{currentMonth:i})}case"finishMonthSwitchingAnimation":return Fe({},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 Fe({},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")}},Mye=e=>{const{value:t,referenceDate:n,disableFuture:r,disablePast:o,disableSwitchToMonthOnDayFocus:a=!1,maxDate:i,minDate:s,onMonthChange:l,reduceAnimations:d,shouldDisableDate:u,timezone:m}=e,g=Qr(),y=C.useRef(Tye(!!d,a,g)).current,x=C.useMemo(()=>Cl.getInitialReferenceValue({value:t,utils:g,timezone:m,props:e,referenceDate:n,granularity:dl.day}),[n,m]),[w,S]=C.useReducer(y,{isMonthSwitchingAnimating:!1,focusedDay:x,currentMonth:g.startOfMonth(x),slideDirection:"left"});C.useEffect(()=>{S({type:"changeMonthTimezone",newTimezone:g.getTimezone(x)})},[x,g]);const b=C.useCallback(P=>{S(Fe({type:"changeMonth"},P)),l&&l(P.newMonth)},[l]),$=C.useCallback(P=>{const D=P;g.isSameMonth(D,w.currentMonth)||b({newMonth:g.startOfMonth(D),direction:g.isAfterDay(D,w.currentMonth)?"left":"right"})},[w.currentMonth,b,g]),k=Z3({shouldDisableDate:u,minDate:s,maxDate:i,disableFuture:r,disablePast:o,timezone:m}),R=C.useCallback(()=>{S({type:"finishMonthSwitchingAnimation"})},[]),O=Yt((P,D)=>{k(P)||S({type:"changeFocusedDay",focusedDay:P,withoutMonthSwitchingAnimation:D})});return{referenceDate:x,calendarState:w,changeMonth:$,changeFocusedDay:O,isDateDisabled:k,onMonthSwitchingAnimationEnd:R,handleChangeMonth:b}},Oye=e=>kn("MuiPickersFadeTransitionGroup",e);vn("MuiPickersFadeTransitionGroup",["root"]);const Pye=e=>{const{classes:t}=e;return Sn({root:["root"]},Oye,t)},jye=ot(nv,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function J3(e){const t=Kr({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:o,transKey:a}=t,i=Pye(t),s=Qd();return o?n:p.jsx(jye,{className:Ht(i.root,r),children:p.jsx(Ud,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:s.transitions.duration.enteringScreen,enter:s.transitions.duration.enteringScreen,exit:0},children:n},a)})}function Aye(e){return kn("MuiPickersDay",e)}const cd=vn("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),Dye=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],Nye=e=>{const{selected:t,disableMargin:n,disableHighlightToday:r,today:o,disabled:a,outsideCurrentMonth:i,showDaysOutsideCurrentMonth:s,classes:l}=e,d=i&&!s;return Sn({root:["root",t&&!d&&"selected",a&&"disabled",!n&&"dayWithMargin",!r&&o&&"today",i&&s&&"dayOutsideMonth",d&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},Aye,l)},e_=({theme:e})=>Fe({},e.typography.caption,{width:vy,height:vy,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})`:ns(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:ns(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${cd.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${cd.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}},[`&.${cd.disabled}:not(.${cd.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${cd.disabled}&.${cd.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:`0 ${$1}px`}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${cd.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),t_=(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]},Iye=ot(Jp,{name:"MuiPickersDay",slot:"Root",overridesResolver:t_})(e_),Lye=ot("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:t_})(({theme:e})=>Fe({},e_({theme:e}),{opacity:0,pointerEvents:"none"})),tg=()=>{},zye=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiPickersDay"}),{autoFocus:r=!1,className:o,day:a,disabled:i=!1,disableHighlightToday:s=!1,disableMargin:l=!1,isAnimating:d,onClick:u,onDaySelect:m,onFocus:g=tg,onBlur:y=tg,onKeyDown:x=tg,onMouseDown:w=tg,onMouseEnter:S=tg,outsideCurrentMonth:b,selected:$=!1,showDaysOutsideCurrentMonth:k=!1,children:R,today:O=!1}=n,P=qn(n,Dye),D=Fe({},n,{autoFocus:r,disabled:i,disableHighlightToday:s,disableMargin:l,selected:$,showDaysOutsideCurrentMonth:k,today:O}),A=Nye(D),F=Qr(),L=C.useRef(null),_=vr(L,t);Yo(()=>{r&&!i&&!d&&!b&&L.current.focus()},[r,i,d,b]);const E=I=>{w(I),b&&I.preventDefault()},z=I=>{i||m(a),b&&I.currentTarget.focus(),u&&u(I)};return b&&!k?p.jsx(Lye,{className:Ht(A.root,A.hiddenDaySpacingFiller,o),ownerState:D,role:P.role}):p.jsx(Iye,Fe({className:Ht(A.root,o),ref:_,centerRipple:!0,disabled:i,tabIndex:$?0:-1,onKeyDown:I=>x(I,a),onFocus:I=>g(I,a),onBlur:I=>y(I,a),onMouseEnter:I=>S(I,a),onClick:z,onMouseDown:E},P,{ownerState:D,children:R||F.format(a,"dayOfMonth")}))}),Fye=C.memo(zye),_ye=e=>kn("MuiPickersSlideTransition",e),_i=vn("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),Bye=["children","className","reduceAnimations","slideDirection","transKey","classes"],Uye=e=>{const{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return Sn(r,_ye,t)},Vye=ot(nv,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${_i["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${_i["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${_i.slideEnterActive}`]:t.slideEnterActive},{[`.${_i.slideExit}`]:t.slideExit},{[`.${_i["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${_i["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},[`& .${_i["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${_i["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${_i.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${_i.slideExit}`]:{transform:"translate(0%)"},[`& .${_i["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${_i["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}});function qye(e){const t=Kr({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:o,transKey:a}=t,i=qn(t,Bye),s=Uye(t),l=Qd();if(o)return p.jsx("div",{className:Ht(s.root,r),children:n});const d={exit:s.exit,enterActive:s.enterActive,enter:s.enter,exitActive:s.exitActive};return p.jsx(Vye,{className:Ht(s.root,r),childFactory:u=>C.cloneElement(u,{classNames:d}),role:"presentation",children:p.jsx(kR,Fe({mountOnEnter:!0,unmountOnExit:!0,timeout:l.transitions.duration.complex,classNames:d},i,{children:n}),a)})}const Hye=e=>kn("MuiDayCalendar",e);vn("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const Wye=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],Yye=["ownerState"],Gye=e=>{const{classes:t}=e;return Sn({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},Hye,t)},n_=(vy+$1*2)*6,Kye=ot("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),Qye=ot("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),Xye=ot(Ar,{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})),Zye=ot(Ar,{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})),Jye=ot(Ar,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>Fe({},e.typography.caption,{width:vy,height:vy,padding:0,margin:`0 ${$1}px`,color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),eve=ot("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:n_}),tve=ot(qye,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:n_}),nve=ot("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),rve=ot("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:`${$1}px 0`,display:"flex",justifyContent:"center"});function ove(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:o,isDateDisabled:a,currentMonthNumber:i,isViewFocused:s}=e,l=qn(e,Wye);const{disabled:d,disableHighlightToday:u,isMonthSwitchingAnimating:m,showDaysOutsideCurrentMonth:g,slots:y,slotProps:x,timezone:w}=t,S=Qr(),b=S1(w),$=r!==null&&S.isSameDay(n,r),k=o.some(E=>S.isSameDay(E,n)),R=S.isSameDay(n,b),O=y?.day??Fye,P=Sr({elementType:O,externalSlotProps:x?.day,additionalProps:Fe({disableHighlightToday:u,showDaysOutsideCurrentMonth:g,role:"gridcell",isAnimating:m,"data-timestamp":S.toJsDate(n).valueOf()},l),ownerState:Fe({},t,{day:n,selected:k})}),D=qn(P,Yye),A=C.useMemo(()=>d||a(n),[d,a,n]),F=C.useMemo(()=>S.getMonth(n)!==i,[S,n,i]),L=C.useMemo(()=>{const E=S.startOfMonth(S.setMonth(n,i));return g?S.isSameDay(n,S.startOfWeek(E)):S.isSameDay(n,E)},[i,n,g,S]),_=C.useMemo(()=>{const E=S.endOfMonth(S.setMonth(n,i));return g?S.isSameDay(n,S.endOfWeek(E)):S.isSameDay(n,E)},[i,n,g,S]);return p.jsx(O,Fe({},D,{day:n,disabled:A,autoFocus:s&&$,today:R,outsideCurrentMonth:F,isFirstVisibleCell:L,isLastVisibleCell:_,selected:k,tabIndex:$?0:-1,"aria-selected":k,"aria-current":R?"date":void 0}))}function ave(e){const t=Kr({props:e,name:"MuiDayCalendar"}),n=Qr(),{onFocusedDayChange:r,className:o,currentMonth:a,selectedDays:i,focusedDay:s,loading:l,onSelectedDaysChange:d,onMonthSwitchingAnimationEnd:u,readOnly:m,reduceAnimations:g,renderLoading:y=()=>p.jsx("span",{children:"..."}),slideDirection:x,TransitionProps:w,disablePast:S,disableFuture:b,minDate:$,maxDate:k,shouldDisableDate:R,shouldDisableMonth:O,shouldDisableYear:P,dayOfWeekFormatter:D=Ie=>n.format(Ie,"weekdayShort").charAt(0).toUpperCase(),hasFocus:A,onFocusedViewChange:F,gridLabelId:L,displayWeekNumber:_,fixedWeekNumber:E,autoFocus:z,timezone:I}=t,U=S1(I),N=Gye(t),q=zs(),Y=Z3({shouldDisableDate:R,shouldDisableMonth:O,shouldDisableYear:P,minDate:$,maxDate:k,disablePast:S,disableFuture:b,timezone:I}),oe=vc(),[Q,ae]=Ji({name:"DayCalendar",state:"hasFocus",controlled:A,default:z??!1}),[de,X]=C.useState(()=>s||U),se=Yt(Ie=>{m||d(Ie)}),J=Ie=>{Y(Ie)||(r(Ie),X(Ie),F?.(!0),ae(!0))},Z=Yt((Ie,Re)=>{switch(Ie.key){case"ArrowUp":J(n.addDays(Re,-7)),Ie.preventDefault();break;case"ArrowDown":J(n.addDays(Re,7)),Ie.preventDefault();break;case"ArrowLeft":{const ne=n.addDays(Re,q?1:-1),qe=n.addMonths(Re,q?1:-1),Oe=Bg({utils:n,date:ne,minDate:q?ne:n.startOfMonth(qe),maxDate:q?n.endOfMonth(qe):ne,isDateDisabled:Y,timezone:I});J(Oe||ne),Ie.preventDefault();break}case"ArrowRight":{const ne=n.addDays(Re,q?-1:1),qe=n.addMonths(Re,q?-1:1),Oe=Bg({utils:n,date:ne,minDate:q?n.startOfMonth(qe):ne,maxDate:q?ne:n.endOfMonth(qe),isDateDisabled:Y,timezone:I});J(Oe||ne),Ie.preventDefault();break}case"Home":J(n.startOfWeek(Re)),Ie.preventDefault();break;case"End":J(n.endOfWeek(Re)),Ie.preventDefault();break;case"PageUp":J(n.addMonths(Re,1)),Ie.preventDefault();break;case"PageDown":J(n.addMonths(Re,-1)),Ie.preventDefault();break}}),G=Yt((Ie,Re)=>J(Re)),ue=Yt((Ie,Re)=>{Q&&n.isSameDay(de,Re)&&F?.(!1)}),ie=n.getMonth(a),fe=n.getYear(a),he=C.useMemo(()=>i.filter(Ie=>!!Ie).map(Ie=>n.startOfDay(Ie)),[n,i]),me=`${fe}-${ie}`,le=C.useMemo(()=>C.createRef(),[me]),ve=C.useMemo(()=>{const Ie=n.startOfMonth(a),Re=n.endOfMonth(a);return Y(de)||n.isAfterDay(de,Re)||n.isBeforeDay(de,Ie)?Bg({utils:n,date:de,minDate:Ie,maxDate:Re,disablePast:S,disableFuture:b,isDateDisabled:Y,timezone:I}):de},[a,b,S,de,Y,n,I]),Le=C.useMemo(()=>{const Ie=n.getWeekArray(a);let Re=n.addMonths(a,1);for(;E&&Ie.length<E;){const ne=n.getWeekArray(Re),qe=n.isSameDay(Ie[Ie.length-1][0],ne[0][0]);ne.slice(qe?1:0).forEach(Oe=>{Ie.length<E&&Ie.push(Oe)}),Re=n.addMonths(Re,1)}return Ie},[a,E,n]);return p.jsxs(Kye,{role:"grid","aria-labelledby":L,className:N.root,children:[p.jsxs(Qye,{role:"row",className:N.header,children:[_&&p.jsx(Zye,{variant:"caption",role:"columnheader","aria-label":oe.calendarWeekNumberHeaderLabel,className:N.weekNumberLabel,children:oe.calendarWeekNumberHeaderText}),vue(n,U).map((Ie,Re)=>p.jsx(Xye,{variant:"caption",role:"columnheader","aria-label":n.format(Ie,"weekday"),className:N.weekDayLabel,children:D(Ie)},Re.toString()))]}),l?p.jsx(eve,{className:N.loadingContainer,children:y()}):p.jsx(tve,Fe({transKey:me,onExited:u,reduceAnimations:g,slideDirection:x,className:Ht(o,N.slideTransition)},w,{nodeRef:le,children:p.jsx(nve,{ref:le,role:"rowgroup",className:N.monthContainer,children:Le.map((Ie,Re)=>p.jsxs(rve,{role:"row",className:N.weekContainer,"aria-rowindex":Re+1,children:[_&&p.jsx(Jye,{className:N.weekNumber,role:"rowheader","aria-label":oe.calendarWeekNumberAriaLabelText(n.getWeekNumber(Ie[0])),children:oe.calendarWeekNumberText(n.getWeekNumber(Ie[0]))}),Ie.map((ne,qe)=>p.jsx(ove,{parentProps:t,day:ne,selectedDays:he,focusableDay:ve,onKeyDown:Z,onFocus:G,onBlur:ue,onDaySelect:se,isDateDisabled:Y,currentMonthNumber:ie,isViewFocused:Q,"aria-colindex":qe+1},ne.toString()))]},`week-${Ie[0]}`))})}))]})}function ive(e){return kn("MuiPickersMonth",e)}const Ib=vn("MuiPickersMonth",["root","monthButton","disabled","selected"]),sve=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],lve=e=>{const{disabled:t,selected:n,classes:r}=e;return Sn({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},ive,r)},cve=ot("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%"}}]}),uve=ot("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${Ib.disabled}`]:t.disabled},{[`&.${Ib.selected}`]:t.selected}]})(({theme:e})=>Fe({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})`:ns(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:ns(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}}})),dve=C.memo(function(e){const t=Kr({props:e,name:"MuiPickersMonth"}),{autoFocus:n,className:r,children:o,disabled:a,selected:i,value:s,tabIndex:l,onClick:d,onKeyDown:u,onFocus:m,onBlur:g,"aria-current":y,"aria-label":x,slots:w,slotProps:S}=t,b=qn(t,sve),$=C.useRef(null),k=lve(t);Yo(()=>{n&&$.current?.focus()},[n]);const R=w?.monthButton??uve,O=Sr({elementType:R,externalSlotProps:S?.monthButton,additionalProps:{children:o,disabled:a,tabIndex:l,ref:$,type:"button",role:"radio","aria-current":y,"aria-checked":i,"aria-label":x,onClick:P=>d(P,s),onKeyDown:P=>u(P,s),onFocus:P=>m(P,s),onBlur:P=>g(P,s)},ownerState:t,className:k.monthButton});return p.jsx(cve,Fe({className:Ht(k.root,r),ownerState:t},b,{children:p.jsx(R,Fe({},O))}))});function fve(e){return kn("MuiMonthCalendar",e)}vn("MuiMonthCalendar",["root"]);const pve=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],hve=e=>{const{classes:t}=e;return Sn({root:["root"]},fve,t)};function mve(e,t){const n=Qr(),r=ev(),o=Kr({props:e,name:t});return Fe({disableFuture:!1,disablePast:!1},o,{minDate:is(n,o.minDate,r.minDate),maxDate:is(n,o.maxDate,r.maxDate)})}const gve=ot("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:E1,boxSizing:"border-box"}),yve=C.forwardRef(function(e,t){const n=mve(e,"MuiMonthCalendar"),{className:r,value:o,defaultValue:a,referenceDate:i,disabled:s,disableFuture:l,disablePast:d,maxDate:u,minDate:m,onChange:g,shouldDisableMonth:y,readOnly:x,autoFocus:w=!1,onMonthFocus:S,hasFocus:b,onFocusedViewChange:$,monthsPerRow:k=3,timezone:R,gridLabelId:O,slots:P,slotProps:D}=n,A=qn(n,pve),{value:F,handleValueChange:L,timezone:_}=IR({name:"MonthCalendar",timezone:R,value:o,defaultValue:a,referenceDate:i,onChange:g,valueManager:Cl}),E=S1(_),z=zs(),I=Qr(),U=C.useMemo(()=>Cl.getInitialReferenceValue({value:F,utils:I,props:n,timezone:_,referenceDate:i,granularity:dl.month}),[]),N=n,q=hve(N),Y=C.useMemo(()=>I.getMonth(E),[I,E]),oe=C.useMemo(()=>F!=null?I.getMonth(F):null,[F,I]),[Q,ae]=C.useState(()=>oe||I.getMonth(U)),[de,X]=Ji({name:"MonthCalendar",state:"hasFocus",controlled:b,default:w??!1}),se=Yt(he=>{X(he),$&&$(he)}),J=C.useCallback(he=>{const me=I.startOfMonth(d&&I.isAfter(E,m)?E:m),le=I.startOfMonth(l&&I.isBefore(E,u)?E:u),ve=I.startOfMonth(he);return I.isBefore(ve,me)||I.isAfter(ve,le)?!0:y?y(ve):!1},[l,d,u,m,E,y,I]),Z=Yt((he,me)=>{if(x)return;const le=I.setMonth(F??U,me);L(le)}),G=Yt(he=>{J(I.setMonth(F??U,he))||(ae(he),se(!0),S&&S(he))});C.useEffect(()=>{ae(he=>oe!==null&&he!==oe?oe:he)},[oe]);const ue=Yt((he,me)=>{switch(he.key){case"ArrowUp":G((12+me-3)%12),he.preventDefault();break;case"ArrowDown":G((12+me+3)%12),he.preventDefault();break;case"ArrowLeft":G((12+me+(z?1:-1))%12),he.preventDefault();break;case"ArrowRight":G((12+me+(z?-1:1))%12),he.preventDefault();break}}),ie=Yt((he,me)=>{G(me)}),fe=Yt((he,me)=>{Q===me&&se(!1)});return p.jsx(gve,Fe({ref:t,className:Ht(q.root,r),ownerState:N,role:"radiogroup","aria-labelledby":O},A,{children:bR(I,F??U).map(he=>{const me=I.getMonth(he),le=I.format(he,"monthShort"),ve=I.format(he,"month"),Le=me===oe,Ie=s||J(he);return p.jsx(dve,{selected:Le,value:me,onClick:Z,onKeyDown:ue,autoFocus:de&&me===Q,disabled:Ie,tabIndex:me===Q&&!Ie?0:-1,onFocus:ie,onBlur:fe,"aria-current":Y===me?"date":void 0,"aria-label":ve,monthsPerRow:k,slots:P,slotProps:D,children:le},le)})}))});function vve(e){return kn("MuiPickersYear",e)}const Lb=vn("MuiPickersYear",["root","yearButton","selected","disabled"]),bve=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],xve=e=>{const{disabled:t,selected:n,classes:r}=e;return Sn({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},vve,r)},wve=ot("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%"}}]}),Sve=ot("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${Lb.disabled}`]:t.disabled},{[`&.${Lb.selected}`]:t.selected}]})(({theme:e})=>Fe({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})`:ns(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:ns(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Lb.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${Lb.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),Cve=C.memo(function(e){const t=Kr({props:e,name:"MuiPickersYear"}),{autoFocus:n,className:r,children:o,disabled:a,selected:i,value:s,tabIndex:l,onClick:d,onKeyDown:u,onFocus:m,onBlur:g,"aria-current":y,slots:x,slotProps:w}=t,S=qn(t,bve),b=C.useRef(null),$=xve(t);Yo(()=>{n&&b.current?.focus()},[n]);const k=x?.yearButton??Sve,R=Sr({elementType:k,externalSlotProps:w?.yearButton,additionalProps:{children:o,disabled:a,tabIndex:l,ref:b,type:"button",role:"radio","aria-current":y,"aria-checked":i,onClick:O=>d(O,s),onKeyDown:O=>u(O,s),onFocus:O=>m(O,s),onBlur:O=>g(O,s)},ownerState:t,className:$.yearButton});return p.jsx(wve,Fe({className:Ht($.root,r),ownerState:t},S,{children:p.jsx(k,Fe({},R))}))});function kve(e){return kn("MuiYearCalendar",e)}vn("MuiYearCalendar",["root"]);const $ve=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],Eve=e=>{const{classes:t}=e;return Sn({root:["root"]},kve,t)};function Rve(e,t){const n=Qr(),r=ev(),o=Kr({props:e,name:t});return Fe({disablePast:!1,disableFuture:!1},o,{yearsPerRow:o.yearsPerRow??3,minDate:is(n,o.minDate,r.minDate),maxDate:is(n,o.maxDate,r.maxDate)})}const Tve=ot("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:E1,maxHeight:$he,boxSizing:"border-box",position:"relative"}),Mve=C.forwardRef(function(e,t){const n=Rve(e,"MuiYearCalendar"),{autoFocus:r,className:o,value:a,defaultValue:i,referenceDate:s,disabled:l,disableFuture:d,disablePast:u,maxDate:m,minDate:g,onChange:y,readOnly:x,shouldDisableYear:w,onYearFocus:S,hasFocus:b,onFocusedViewChange:$,yearsOrder:k="asc",yearsPerRow:R,timezone:O,gridLabelId:P,slots:D,slotProps:A}=n,F=qn(n,$ve),{value:L,handleValueChange:_,timezone:E}=IR({name:"YearCalendar",timezone:O,value:a,defaultValue:i,referenceDate:s,onChange:y,valueManager:Cl}),z=S1(E),I=zs(),U=Qr(),N=C.useMemo(()=>Cl.getInitialReferenceValue({value:L,utils:U,props:n,timezone:E,referenceDate:s,granularity:dl.year}),[]),q=n,Y=Eve(q),oe=C.useMemo(()=>U.getYear(z),[U,z]),Q=C.useMemo(()=>L!=null?U.getYear(L):null,[L,U]),[ae,de]=C.useState(()=>Q||U.getYear(N)),[X,se]=Ji({name:"YearCalendar",state:"hasFocus",controlled:b,default:r??!1}),J=Yt(Re=>{se(Re),$&&$(Re)}),Z=C.useCallback(Re=>{if(u&&U.isBeforeYear(Re,z)||d&&U.isAfterYear(Re,z)||g&&U.isBeforeYear(Re,g)||m&&U.isAfterYear(Re,m))return!0;if(!w)return!1;const ne=U.startOfYear(Re);return w(ne)},[d,u,m,g,z,w,U]),G=Yt((Re,ne)=>{if(x)return;const qe=U.setYear(L??N,ne);_(qe)}),ue=Yt(Re=>{Z(U.setYear(L??N,Re))||(de(Re),J(!0),S?.(Re))});C.useEffect(()=>{de(Re=>Q!==null&&Re!==Q?Q:Re)},[Q]);const ie=k!=="desc"?R*1:R*-1,fe=I&&k==="asc"||!I&&k==="desc"?-1:1,he=Yt((Re,ne)=>{switch(Re.key){case"ArrowUp":ue(ne-ie),Re.preventDefault();break;case"ArrowDown":ue(ne+ie),Re.preventDefault();break;case"ArrowLeft":ue(ne-fe),Re.preventDefault();break;case"ArrowRight":ue(ne+fe),Re.preventDefault();break}}),me=Yt((Re,ne)=>{ue(ne)}),le=Yt((Re,ne)=>{ae===ne&&J(!1)}),ve=C.useRef(null),Le=vr(t,ve);C.useEffect(()=>{if(r||ve.current===null)return;const Re=ve.current.querySelector('[tabindex="0"]');if(!Re)return;const ne=Re.offsetHeight,qe=Re.offsetTop,Oe=ve.current.clientHeight,Qe=ve.current.scrollTop,nt=qe+ne;ne>Oe||qe<Qe||(ve.current.scrollTop=nt-Oe/2-ne/2)},[r]);const Ie=U.getYearRange([g,m]);return k==="desc"&&Ie.reverse(),p.jsx(Tve,Fe({ref:Le,className:Ht(Y.root,o),ownerState:q,role:"radiogroup","aria-labelledby":P},F,{children:Ie.map(Re=>{const ne=U.getYear(Re),qe=ne===Q,Oe=l||Z(Re);return p.jsx(Cve,{selected:qe,value:ne,onClick:G,onKeyDown:he,autoFocus:X&&ne===ae,disabled:Oe,tabIndex:ne===ae&&!Oe?0:-1,onFocus:me,onBlur:le,"aria-current":oe===ne?"date":void 0,yearsPerRow:R,slots:D,slotProps:A,children:U.format(Re,"year")},U.format(Re,"year"))})}))}),Ove=e=>kn("MuiPickersCalendarHeader",e),Pve=vn("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]);function jve(e){return kn("MuiPickersArrowSwitcher",e)}vn("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const Ave=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],Dve=["ownerState"],Nve=["ownerState"],Ive=ot("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),Lve=ot("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),NN=ot(Eu,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),zve=e=>{const{classes:t}=e;return Sn({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},jve,t)},Fve=C.forwardRef(function(e,t){const n=zs(),r=Kr({props:e,name:"MuiPickersArrowSwitcher"}),{children:o,className:a,slots:i,slotProps:s,isNextDisabled:l,isNextHidden:d,onGoToNext:u,nextLabel:m,isPreviousDisabled:g,isPreviousHidden:y,onGoToPrevious:x,previousLabel:w,labelId:S}=r,b=qn(r,Ave),$=r,k=zve($),R={isDisabled:l,isHidden:d,goTo:u,label:m},O={isDisabled:g,isHidden:y,goTo:x,label:w},P=i?.previousIconButton??NN,D=Sr({elementType:P,externalSlotProps:s?.previousIconButton,additionalProps:{size:"medium",title:O.label,"aria-label":O.label,disabled:O.isDisabled,edge:"end",onClick:O.goTo},ownerState:Fe({},$,{hidden:O.isHidden}),className:Ht(k.button,k.previousIconButton)}),A=i?.nextIconButton??NN,F=Sr({elementType:A,externalSlotProps:s?.nextIconButton,additionalProps:{size:"medium",title:R.label,"aria-label":R.label,disabled:R.isDisabled,edge:"start",onClick:R.goTo},ownerState:Fe({},$,{hidden:R.isHidden}),className:Ht(k.button,k.nextIconButton)}),L=i?.leftArrowIcon??Bhe,_=Sr({elementType:L,externalSlotProps:s?.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:$,className:k.leftArrowIcon}),E=qn(_,Dve),z=i?.rightArrowIcon??Uhe,I=Sr({elementType:z,externalSlotProps:s?.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:$,className:k.rightArrowIcon}),U=qn(I,Nve);return p.jsxs(Ive,Fe({ref:t,className:Ht(k.root,a),ownerState:$},b,{children:[p.jsx(P,Fe({},D,{children:n?p.jsx(z,Fe({},U)):p.jsx(L,Fe({},E))})),o?p.jsx(Ar,{variant:"subtitle1",component:"span",id:S,children:o}):p.jsx(Lve,{className:k.spacer,ownerState:$}),p.jsx(A,Fe({},F,{children:n?p.jsx(L,Fe({},E)):p.jsx(z,Fe({},U))}))]}))});function _ve(e,{disableFuture:t,maxDate:n,timezone:r}){const o=Qr();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 Bve(e,{disablePast:t,minDate:n,timezone:r}){const o=Qr();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 Uve=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],Vve=["ownerState"],qve=e=>{const{classes:t}=e;return Sn({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},Ove,t)},Hve=ot("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}),Wve=ot("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>Fe({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),Yve=ot("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),Gve=ot(Eu,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${Pve.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),Kve=ot(_he,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),Qve=C.forwardRef(function(e,t){const n=vc(),r=Qr(),o=Kr({props:e,name:"MuiPickersCalendarHeader"}),{slots:a,slotProps:i,currentMonth:s,disabled:l,disableFuture:d,disablePast:u,maxDate:m,minDate:g,onMonthChange:y,onViewChange:x,view:w,reduceAnimations:S,views:b,labelId:$,className:k,timezone:R,format:O=`${r.formats.month} ${r.formats.year}`}=o,P=qn(o,Uve),D=o,A=qve(o),F=a?.switchViewButton??Gve,L=Sr({elementType:F,externalSlotProps:i?.switchViewButton,additionalProps:{size:"small","aria-label":n.calendarViewSwitchingButtonAriaLabel(w)},ownerState:D,className:A.switchViewButton}),_=a?.switchViewIcon??Kve,E=Sr({elementType:_,externalSlotProps:i?.switchViewIcon,ownerState:D,className:A.switchViewIcon}),z=qn(E,Vve),I=()=>y(r.addMonths(s,1),"left"),U=()=>y(r.addMonths(s,-1),"right"),N=_ve(s,{disableFuture:d,maxDate:m,timezone:R}),q=Bve(s,{disablePast:u,minDate:g,timezone:R}),Y=()=>{if(!(b.length===1||!x||l))if(b.length===2)x(b.find(Q=>Q!==w)||b[0]);else{const Q=b.indexOf(w)!==0?0:1;x(b[Q])}};if(b.length===1&&b[0]==="year")return null;const oe=r.formatByString(s,O);return p.jsxs(Hve,Fe({},P,{ownerState:D,className:Ht(A.root,k),ref:t,children:[p.jsxs(Wve,{role:"presentation",onClick:Y,ownerState:D,"aria-live":"polite",className:A.labelContainer,children:[p.jsx(J3,{reduceAnimations:S,transKey:oe,children:p.jsx(Yve,{id:$,ownerState:D,className:A.label,children:oe})}),b.length>1&&!l&&p.jsx(F,Fe({},L,{children:p.jsx(_,Fe({},z))}))]}),p.jsx(Ud,{in:w==="day",appear:!S,enter:!S,children:p.jsx(Fve,{slots:a,slotProps:i,onGoToPrevious:U,isPreviousDisabled:q,previousLabel:n.previousMonth,onGoToNext:I,isNextDisabled:N,nextLabel:n.nextMonth})})]}))}),Xve=ot("div")({overflow:"hidden",width:E1,maxHeight:LR,display:"flex",flexDirection:"column",margin:"0 auto"}),Zve=e=>kn("MuiDateCalendar",e);vn("MuiDateCalendar",["root","viewTransitionContainer"]);const Jve=["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"],ebe=e=>{const{classes:t}=e;return Sn({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},Zve,t)};function tbe(e,t){const n=Qr(),r=ev(),o=S3(),a=Kr({props:e,name:t});return Fe({},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??(()=>p.jsx("span",{children:"..."})),minDate:is(n,a.minDate,r.minDate),maxDate:is(n,a.maxDate,r.maxDate)})}const nbe=ot(Xve,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:LR}),rbe=ot(J3,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),obe=C.forwardRef(function(e,t){const n=Qr(),r=Fs(),o=tbe(e,"MuiDateCalendar"),{autoFocus:a,onViewChange:i,value:s,defaultValue:l,referenceDate:d,disableFuture:u,disablePast:m,onChange:g,onYearChange:y,onMonthChange:x,reduceAnimations:w,shouldDisableDate:S,shouldDisableMonth:b,shouldDisableYear:$,view:k,views:R,openTo:O,className:P,disabled:D,readOnly:A,minDate:F,maxDate:L,disableHighlightToday:_,focusedView:E,onFocusedViewChange:z,showDaysOutsideCurrentMonth:I,fixedWeekNumber:U,dayOfWeekFormatter:N,slots:q,slotProps:Y,loading:oe,renderLoading:Q,displayWeekNumber:ae,yearsOrder:de,yearsPerRow:X,monthsPerRow:se,timezone:J}=o,Z=qn(o,Jve),{value:G,handleValueChange:ue,timezone:ie}=IR({name:"DateCalendar",timezone:J,value:s,defaultValue:l,referenceDate:d,onChange:g,valueManager:Cl}),{view:fe,setView:he,focusedView:me,setFocusedView:le,goToNextView:ve,setValueAndGoToNextView:Le}=C3({view:k,views:R,openTo:O,onChange:ue,onViewChange:i,autoFocus:a,focusedView:E,onFocusedViewChange:z}),{referenceDate:Ie,calendarState:Re,changeFocusedDay:ne,changeMonth:qe,handleChangeMonth:Oe,isDateDisabled:Qe,onMonthSwitchingAnimationEnd:nt}=Mye({value:G,referenceDate:d,reduceAnimations:w,onMonthChange:x,minDate:F,maxDate:L,shouldDisableDate:S,disablePast:m,disableFuture:u,timezone:ie}),kt=D&&G||F,Ut=D&&G||L,at=`${r}-grid-label`,et=me!==null,pt=q?.calendarHeader??Qve,ze=Sr({elementType:pt,externalSlotProps:Y?.calendarHeader,additionalProps:{views:R,view:fe,currentMonth:Re.currentMonth,onViewChange:he,onMonthChange:(tn,Bt)=>Oe({newMonth:tn,direction:Bt}),minDate:kt,maxDate:Ut,disabled:D,disablePast:m,disableFuture:u,reduceAnimations:w,timezone:ie,labelId:at},ownerState:o}),be=Yt(tn=>{const Bt=n.startOfMonth(tn),an=n.endOfMonth(tn),$n=Qe(tn)?Bg({utils:n,date:tn,minDate:n.isBefore(F,Bt)?Bt:F,maxDate:n.isAfter(L,an)?an:L,disablePast:m,disableFuture:u,isDateDisabled:Qe,timezone:ie}):tn;$n?(Le($n,"finish"),x?.(Bt)):(ve(),qe(Bt)),ne($n,!0)}),He=Yt(tn=>{const Bt=n.startOfYear(tn),an=n.endOfYear(tn),$n=Qe(tn)?Bg({utils:n,date:tn,minDate:n.isBefore(F,Bt)?Bt:F,maxDate:n.isAfter(L,an)?an:L,disablePast:m,disableFuture:u,isDateDisabled:Qe,timezone:ie}):tn;$n?(Le($n,"finish"),y?.($n)):(ve(),qe(Bt)),ne($n,!0)}),Me=Yt(tn=>ue(tn&&H0(n,tn,G??Ie),"finish",fe));C.useEffect(()=>{G!=null&&n.isValid(G)&&qe(G)},[G]);const $t=o,Et=ebe($t),vt={disablePast:m,disableFuture:u,maxDate:L,minDate:F},it={disableHighlightToday:_,readOnly:A,disabled:D,timezone:ie,gridLabelId:at,slots:q,slotProps:Y},st=C.useRef(fe);C.useEffect(()=>{st.current!==fe&&(me===st.current&&le(fe,!0),st.current=fe)},[me,le,fe]);const At=C.useMemo(()=>[G],[G]);return p.jsxs(nbe,Fe({ref:t,className:Ht(Et.root,P),ownerState:$t},Z,{children:[p.jsx(pt,Fe({},ze,{slots:q,slotProps:Y})),p.jsx(rbe,{reduceAnimations:w,className:Et.viewTransitionContainer,transKey:fe,ownerState:$t,children:p.jsxs("div",{children:[fe==="year"&&p.jsx(Mve,Fe({},vt,it,{value:G,onChange:He,shouldDisableYear:$,hasFocus:et,onFocusedViewChange:tn=>le("year",tn),yearsOrder:de,yearsPerRow:X,referenceDate:Ie})),fe==="month"&&p.jsx(yve,Fe({},vt,it,{hasFocus:et,className:P,value:G,onChange:be,shouldDisableMonth:b,onFocusedViewChange:tn=>le("month",tn),monthsPerRow:se,referenceDate:Ie})),fe==="day"&&p.jsx(ave,Fe({},Re,vt,it,{onMonthSwitchingAnimationEnd:nt,onFocusedDayChange:ne,reduceAnimations:w,selectedDays:At,onSelectedDaysChange:Me,shouldDisableDate:S,shouldDisableMonth:b,shouldDisableYear:$,hasFocus:et,onFocusedViewChange:tn=>le("day",tn),showDaysOutsideCurrentMonth:I,fixedWeekNumber:U,dayOfWeekFormatter:N,displayWeekNumber:ae,loading:oe,renderLoading:Q}))]})})]}))}),Ip=({view:e,onViewChange:t,views:n,focusedView:r,onFocusedViewChange:o,value:a,defaultValue:i,referenceDate:s,onChange:l,className:d,classes:u,disableFuture:m,disablePast:g,minDate:y,maxDate:x,shouldDisableDate:w,shouldDisableMonth:S,shouldDisableYear:b,reduceAnimations:$,onMonthChange:k,monthsPerRow:R,onYearChange:O,yearsOrder:P,yearsPerRow:D,slots:A,slotProps:F,loading:L,renderLoading:_,disableHighlightToday:E,readOnly:z,disabled:I,showDaysOutsideCurrentMonth:U,dayOfWeekFormatter:N,sx:q,autoFocus:Y,fixedWeekNumber:oe,displayWeekNumber:Q,timezone:ae})=>p.jsx(obe,{view:e,onViewChange:t,views:n.filter(VD),focusedView:r&&VD(r)?r:null,onFocusedViewChange:o,value:a,defaultValue:i,referenceDate:s,onChange:l,className:d,classes:u,disableFuture:m,disablePast:g,minDate:y,maxDate:x,shouldDisableDate:w,shouldDisableMonth:S,shouldDisableYear:b,reduceAnimations:$,onMonthChange:k,monthsPerRow:R,onYearChange:O,yearsOrder:P,yearsPerRow:D,slots:A,slotProps:F,loading:L,renderLoading:_,disableHighlightToday:E,readOnly:z,disabled:I,showDaysOutsideCurrentMonth:U,dayOfWeekFormatter:N,sx:q,autoFocus:Y,fixedWeekNumber:oe,displayWeekNumber:Q,timezone:ae}),r_=C.forwardRef(function(e,t){const n=vc(),r=Qr(),o=o3(e,"MuiDesktopDatePicker"),a=Fe({day:Ip,month:Ip,year:Ip},o.viewRenderers),i=Fe({},o,{viewRenderers:a,format:xR(r,o,!1),yearsPerRow:o.yearsPerRow??4,slots:Fe({openPickerIcon:Vhe,field:X3},o.slots),slotProps:Fe({},o.slotProps,{field:l=>Fe({},x1(o.slotProps?.field,l),i3(o),{ref:t}),toolbar:Fe({hidden:!0},o.slotProps?.toolbar)})}),{renderPicker:s}=Fhe({props:i,valueManager:Cl,valueType:"date",getOpenDialogAriaText:n3({utils:r,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:i.localeText?.openDatePickerDialogue}),validator:tv});return s()});r_.propTypes={autoFocus:dt.bool,className:dt.string,closeOnSelect:dt.bool,dayOfWeekFormatter:dt.func,defaultValue:dt.object,disabled:dt.bool,disableFuture:dt.bool,disableHighlightToday:dt.bool,disableOpenPicker:dt.bool,disablePast:dt.bool,displayWeekNumber:dt.bool,enableAccessibleFieldDOMStructure:dt.any,fixedWeekNumber:dt.number,format:dt.string,formatDensity:dt.oneOf(["dense","spacious"]),inputRef:qF,label:dt.node,loading:dt.bool,localeText:dt.object,maxDate:dt.object,minDate:dt.object,monthsPerRow:dt.oneOf([3,4]),name:dt.string,onAccept:dt.func,onChange:dt.func,onClose:dt.func,onError:dt.func,onMonthChange:dt.func,onOpen:dt.func,onSelectedSectionsChange:dt.func,onViewChange:dt.func,onYearChange:dt.func,open:dt.bool,openTo:dt.oneOf(["day","month","year"]),orientation:dt.oneOf(["landscape","portrait"]),readOnly:dt.bool,reduceAnimations:dt.bool,referenceDate:dt.object,renderLoading:dt.func,selectedSections:dt.oneOfType([dt.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),dt.number]),shouldDisableDate:dt.func,shouldDisableMonth:dt.func,shouldDisableYear:dt.func,showDaysOutsideCurrentMonth:dt.bool,slotProps:dt.object,slots:dt.object,sx:dt.oneOfType([dt.arrayOf(dt.oneOfType([dt.func,dt.object,dt.bool])),dt.func,dt.object]),timezone:dt.string,value:dt.object,view:dt.oneOf(["day","month","year"]),viewRenderers:dt.shape({day:dt.func,month:dt.func,year:dt.func}),views:dt.arrayOf(dt.oneOf(["day","month","year"]).isRequired),yearsOrder:dt.oneOf(["asc","desc"]),yearsPerRow:dt.oneOf([3,4])};function abe(e){return kn("MuiDialogContent",e)}vn("MuiDialogContent",["root","dividers"]);const ibe=vn("MuiDialogTitle",["root"]),sbe=e=>{const{classes:t,dividers:n}=e;return Sn({root:["root",n&&"dividers"]},abe,t)},lbe=ot("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(rr(({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:{[`.${ibe.root} + &`]:{paddingTop:0}}}]}))),cbe=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiDialogContent"}),{className:r,dividers:o=!1,...a}=n,i={...n,dividers:o},s=sbe(i);return p.jsx(lbe,{className:Ht(s.root,r),ownerState:i,ref:t,...a})});function ube(e){return kn("MuiDialog",e)}const Wg=vn("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),dbe=C.createContext({}),fbe=ot(I3,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),pbe=e=>{const{classes:t,scroll:n,maxWidth:r,fullWidth:o,fullScreen:a}=e,i={root:["root"],container:["container",`scroll${zt(n)}`],paper:["paper",`paperScroll${zt(n)}`,`paperWidth${zt(String(r))}`,o&&"paperFullWidth",a&&"paperFullScreen"]};return Sn(i,ube,t)},hbe=ot(L3,{name:"MuiDialog",slot:"Root"})({"@media print":{position:"absolute !important"}}),mbe=ot("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${zt(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"}}}]}),gbe=ot(ef,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`scrollPaper${zt(n.scroll)}`],t[`paperWidth${zt(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(rr(({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)`,[`&.${Wg.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}`,[`&.${Wg.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,[`&.${Wg.paperScrollBody}`]:{margin:0,maxWidth:"100%"}}}]}))),ybe=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiDialog"}),r=Qd(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":i,"aria-modal":s=!0,BackdropComponent:l,BackdropProps:d,children:u,className:m,disableEscapeKeyDown:g=!1,fullScreen:y=!1,fullWidth:x=!1,maxWidth:w="sm",onClick:S,onClose:b,open:$,PaperComponent:k=ef,PaperProps:R={},scroll:O="paper",slots:P={},slotProps:D={},TransitionComponent:A=Ud,transitionDuration:F=o,TransitionProps:L,..._}=n,E={...n,disableEscapeKeyDown:g,fullScreen:y,fullWidth:x,maxWidth:w,scroll:O},z=pbe(E),I=C.useRef(),U=me=>{I.current=me.target===me.currentTarget},N=me=>{S&&S(me),I.current&&(I.current=null,b&&b(me,"backdropClick"))},q=Fs(i),Y=C.useMemo(()=>({titleId:q}),[q]),oe={transition:A,...P},Q={transition:L,paper:R,backdrop:d,...D},ae={slots:oe,slotProps:Q},[de,X]=mr("root",{elementType:hbe,shouldForwardComponentProp:!0,externalForwardedProps:ae,ownerState:E,className:Ht(z.root,m),ref:t}),[se,J]=mr("backdrop",{elementType:fbe,shouldForwardComponentProp:!0,externalForwardedProps:ae,ownerState:E}),[Z,G]=mr("paper",{elementType:gbe,shouldForwardComponentProp:!0,externalForwardedProps:ae,ownerState:E,className:Ht(z.paper,R.className)}),[ue,ie]=mr("container",{elementType:mbe,externalForwardedProps:ae,ownerState:E,className:z.container}),[fe,he]=mr("transition",{elementType:Ud,externalForwardedProps:ae,ownerState:E,additionalProps:{appear:!0,in:$,timeout:F,role:"presentation"}});return p.jsx(de,{closeAfterTransition:!0,slots:{backdrop:se},slotProps:{backdrop:{transitionDuration:F,as:l,...J}},disableEscapeKeyDown:g,onClose:b,open:$,onClick:N,...X,..._,children:p.jsx(fe,{...he,children:p.jsx(ue,{onMouseDown:U,...ie,children:p.jsx(Z,{as:k,elevation:24,role:"dialog","aria-describedby":a,"aria-labelledby":q,"aria-modal":s,...G,children:p.jsx(dbe.Provider,{value:Y,children:u})})})})})}),vbe=ot(ybe)({[`& .${Wg.container}`]:{outline:0},[`& .${Wg.paper}`]:{outline:0,minWidth:E1}}),bbe=ot(cbe)({"&:first-of-type":{padding:0}});function xbe(e){const{children:t,onDismiss:n,open:r,slots:o,slotProps:a}=e,i=o?.dialog??vbe,s=o?.mobileTransition??Ud;return p.jsx(i,Fe({open:r,onClose:n},a?.dialog,{TransitionComponent:s,TransitionProps:a?.mobileTransition,PaperComponent:o?.mobilePaper,PaperProps:a?.mobilePaper,children:p.jsx(bbe,{children:t})}))}const wbe=["props","getOpenDialogAriaText"],Sbe=e=>{let{props:t,getOpenDialogAriaText:n}=e,r=qn(e,wbe);const{slots:o,slotProps:a,className:i,sx:s,format:l,formatDensity:d,enableAccessibleFieldDOMStructure:u,selectedSections:m,onSelectedSectionsChange:g,timezone:y,name:x,label:w,inputRef:S,readOnly:b,disabled:$,localeText:k}=t,R=C.useRef(null),O=Fs(),P=a?.toolbar?.hidden??!1,{open:D,actions:A,layoutProps:F,renderCurrentView:L,fieldProps:_,contextValue:E}=k3(Fe({},r,{props:t,fieldRef:R,autoFocusView:!0,additionalViewProps:{},wrapperVariant:"mobile"})),z=o.field,I=Sr({elementType:z,externalSlotProps:a?.field,additionalProps:Fe({},_,P&&{id:O},!($||b)&&{onClick:A.onOpen,onKeyDown:$pe(A.onOpen)},{readOnly:b??!0,disabled:$,className:i,sx:s,format:l,formatDensity:d,enableAccessibleFieldDOMStructure:u,selectedSections:m,onSelectedSectionsChange:g,timezone:y,label:w,name:x},S?{inputRef:S}:{}),ownerState:t});I.inputProps=Fe({},I.inputProps,{"aria-label":n(_.value)});const U=Fe({textField:o.textField},I.slots),N=o.layout??O3;let q=O;P&&(w?q=`${O}-label`:q=void 0);const Y=Fe({},a,{toolbar:Fe({},a?.toolbar,{titleId:O}),mobilePaper:Fe({"aria-labelledby":q},a?.mobilePaper)}),oe=vr(R,I.unstableFieldRef);return{renderPicker:()=>p.jsxs(P3,{contextValue:E,localeText:k,children:[p.jsx(z,Fe({},I,{slots:U,slotProps:Y,unstableFieldRef:oe})),p.jsx(xbe,Fe({},A,{open:D,slots:o,slotProps:Y,children:p.jsx(N,Fe({},F,Y?.layout,{slots:o,slotProps:Y,children:L()}))}))]})}},o_=C.forwardRef(function(e,t){const n=vc(),r=Qr(),o=o3(e,"MuiMobileDatePicker"),a=Fe({day:Ip,month:Ip,year:Ip},o.viewRenderers),i=Fe({},o,{viewRenderers:a,format:xR(r,o,!1),slots:Fe({field:X3},o.slots),slotProps:Fe({},o.slotProps,{field:l=>Fe({},x1(o.slotProps?.field,l),i3(o),{ref:t}),toolbar:Fe({hidden:!1},o.slotProps?.toolbar)})}),{renderPicker:s}=Sbe({props:i,valueManager:Cl,valueType:"date",getOpenDialogAriaText:n3({utils:r,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:i.localeText?.openDatePickerDialogue}),validator:tv});return s()});o_.propTypes={autoFocus:dt.bool,className:dt.string,closeOnSelect:dt.bool,dayOfWeekFormatter:dt.func,defaultValue:dt.object,disabled:dt.bool,disableFuture:dt.bool,disableHighlightToday:dt.bool,disableOpenPicker:dt.bool,disablePast:dt.bool,displayWeekNumber:dt.bool,enableAccessibleFieldDOMStructure:dt.any,fixedWeekNumber:dt.number,format:dt.string,formatDensity:dt.oneOf(["dense","spacious"]),inputRef:qF,label:dt.node,loading:dt.bool,localeText:dt.object,maxDate:dt.object,minDate:dt.object,monthsPerRow:dt.oneOf([3,4]),name:dt.string,onAccept:dt.func,onChange:dt.func,onClose:dt.func,onError:dt.func,onMonthChange:dt.func,onOpen:dt.func,onSelectedSectionsChange:dt.func,onViewChange:dt.func,onYearChange:dt.func,open:dt.bool,openTo:dt.oneOf(["day","month","year"]),orientation:dt.oneOf(["landscape","portrait"]),readOnly:dt.bool,reduceAnimations:dt.bool,referenceDate:dt.object,renderLoading:dt.func,selectedSections:dt.oneOfType([dt.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),dt.number]),shouldDisableDate:dt.func,shouldDisableMonth:dt.func,shouldDisableYear:dt.func,showDaysOutsideCurrentMonth:dt.bool,slotProps:dt.object,slots:dt.object,sx:dt.oneOfType([dt.arrayOf(dt.oneOfType([dt.func,dt.object,dt.bool])),dt.func,dt.object]),timezone:dt.string,value:dt.object,view:dt.oneOf(["day","month","year"]),viewRenderers:dt.shape({day:dt.func,month:dt.func,year:dt.func}),views:dt.arrayOf(dt.oneOf(["day","month","year"]).isRequired),yearsOrder:dt.oneOf(["asc","desc"]),yearsPerRow:dt.oneOf([3,4])};const Cbe=["desktopModeMediaQuery"],kbe=C.forwardRef(function(e,t){const n=Kr({props:e,name:"MuiDatePicker"}),{desktopModeMediaQuery:r=Epe}=n,o=qn(n,Cbe);return VF(r,{defaultMatches:!0})?p.jsx(r_,Fe({ref:t},o)):p.jsx(o_,Fe({ref:t},o))}),a_=400;function i_(e,t){const[n,r]=C.useState(e);return C.useEffect(()=>{const o=setTimeout(()=>r(e),t);return()=>clearTimeout(o)},[e,t]),n}function s_(e,t,{same:n=Object.is,unset:r=!1}={}){const[o,a]=C.useState(e),[i,s]=C.useState(!1),l=C.useRef(!1),d=C.useRef(null),u=C.useRef(!1),m=C.useRef({draft:o,committed:e,focused:i,unset:r,commit:t,same:n});C.useEffect(()=>{m.current={draft:o,committed:e,focused:i,unset:r,commit:t,same:n}});const g=()=>{const k=m.current,R=d.current?d.current.value:k.committed;return l.current&&(k.unset||!k.same(k.draft,R))},y=()=>{const k=m.current;d.current={value:k.draft},k.commit(k.draft),k.unset&&k.same(k.draft,k.committed)&&(l.current=!1)},x=()=>{g()&&y()},[w,S]=C.useState(0),b=C.useMemo(()=>({draft:o,gen:w}),[o,w]),$=i_(b,a_);return C.useEffect(()=>{const k=m.current;k.same($.draft,k.draft)&&g()&&!u.current&&y()},[$]),C.useEffect(()=>()=>x(),[]),C.useEffect(()=>{if(d.current&&n(d.current.value,e)&&(d.current=null),n(o,e)){!r&&!d.current&&(l.current=!1);return}(!i||!l.current)&&a(e)},[e,i,o,r,n]),{draft:o,change:k=>{l.current=!0,a(k),!m.current.focused&&!n(k,e)&&t(k)},reset:k=>{l.current=!1,d.current=null,a(k)},bind:{onFocus:()=>s(!0),onBlur:()=>{s(!1),x(),d.current=null},onKeyDown:k=>{k.key==="Enter"&&!k.nativeEvent.isComposing&&x()},onCompositionStart:()=>{u.current=!0},onCompositionEnd:()=>{u.current=!1,S(k=>k+1)}}}}const $be=250,Ebe=300*1e3;function Rbe(e,t){const n=C.useContext(UE),r=t.trim(),[o,a]=C.useState("");C.useEffect(()=>{const m=setTimeout(()=>a(r),$be);return()=>clearTimeout(m)},[r]);const[i,s]=C.useState(),l=e?JSON.stringify(e.key):void 0;C.useEffect(()=>{if(!e||!n||o==="")return;let m=!0;return n.fetchQuery({queryKey:[...e.key,o],queryFn:({signal:g})=>e.run(o,g),staleTime:Ebe}).then(g=>{m&&s({key:l,text:o,page:g})}).catch(()=>{m&&s({key:l,text:o,failed:!0})}),()=>{m=!1}},[n,l,o]);const d=e!==void 0&&n!==void 0&&r!=="",u=i!==void 0&&i.key===l&&i.text===r;return{active:d,searching:d&&!u,page:d&&u?i.page:void 0,failed:d&&u&&i.failed===!0}}function j1(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"?Tbe(n):n}function Tbe(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"?`
470
470
  `:r==="t"?" ":r==="r"?"\r":r):e}jr.extend(dR);const IN=14,Mbe=42;function Obe(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(`
471
471
  `):void 0}function l_({given:e,value:t,onChange:n,options:r,optionsLoading:o,optionsFailed:a,optionsTruncated:i,optionSearch:s,onOpen:l}){const d=e.label??e.name??"",{theme:u}=Hr(),m=e.type??"string",g=Obe(e),y=j1(m,e.default),x=y!==void 0?`Default: ${y===""?"(empty)":y}`:void 0,w=g||x?p.jsxs(p.Fragment,{children:[g,g&&x?p.jsx("br",{}):null,x]}):void 0,S=m==="string"||uu(m)==="string",b=!ou(m)||typeof t!="string"||CF(t),$=J=>p.jsx(ki,{label:d,value:String(t),error:!0,inputProps:{readOnly:!0},helperText:p.jsxs(p.Fragment,{children:[`Not a ${J}. Clear it to pick one.`,w?p.jsx("br",{}):null,w]}),slotProps:{input:{endAdornment:p.jsx(c_,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"}),k=ou(m),R=e.control==="multiselect"&&k,O=ou(m),P=e.control==="select"||e.control==="multiselect",D=P?O?typeof t=="string"?SF(t):[]:typeof t=="string"&&t!==""?[t]:[]:[],[A,F]=C.useState(""),[L,_]=C.useState(null),E=C.useRef(null),z=Rbe(P?s:void 0,A);if(P&&S&&b&&!(!R&&D.length>1)){const J=G=>{const ue=O?fR(G):void 0;if(G.length===0||ue===""){n(null);return}n(O?ue:G[0])},Z=Ibe(z,i,s);return p.jsx(u_.Provider,{value:Z,children:p.jsx(pK,{multiple:R,disableCloseOnSelect:R,onOpen:l,freeSolo:!0,forcePopupIcon:!0,autoSelect:!R,options:z.page?.values??r??[],...z.page?{filterOptions:G=>G}:{},onInputChange:(G,ue,ie)=>F(ie==="input"?ue:""),loading:o||z.searching,loadingText:z.searching?"Searching…":"Loading…",noOptionsText:a?"Options unavailable":"No matching values",slots:{paper:Nbe},value:R?D:D[0]??null,onChange:(G,ue)=>J(ue===null?[]:Array.isArray(ue)?ue:[ue]),renderInput:G=>p.jsx(ki,{...G,label:d,size:"small",placeholder:D.length!==0?void 0:t===""?"All":y??"All",error:a,helperText:a?p.jsxs(p.Fragment,{children:["Could not load the options for this control. Type a value to filter anyway.",w?p.jsx("br",{}):null,w]}):w,slotProps:{input:{...G.InputProps,endAdornment:p.jsxs(p.Fragment,{children:[o&&p.jsx(Cu,{size:16}),G.InputProps.endAdornment]})},htmlInput:{...G.inputProps,onBlur:ue=>{if(G.inputProps.onBlur?.(ue),!R)return;const ie=ue.target.value.trim();ie!==""&&!D.includes(ie)&&J([...D,ie])}}}}),fullWidth:!0})})}const I=ou(m)&&uu(m)==="number",{rangeMin:U,rangeMax:N}=e,q=I&&typeof t=="string"?$F(t):void 0,Y=I&&typeof t=="string"?EF(t):void 0;if((I||m==="number")&&U!==void 0&&N!==void 0&&(!I||t===void 0||t===null||t===""||q!==void 0||Y!==void 0)){const J=Y??(q!==void 0?[q,N]:void 0),Z=I?J?.[0]:typeof t=="number"?t:void 0;if(Z===void 0&&t!==void 0&&t!==null&&t!=="")return $("number");const G=L!==null,ue=G?Array.isArray(L)?L[0]:L:Z??U,ie=Array.isArray(L)?[L[0],L[1]]:J??[U,N],fe=ie[1]>=N?`≥ ${ie[0]}`:`${ie[0]} to ${ie[1]}`,he=I&&t===""&&!G,me=Z!==void 0||he||G;return p.jsxs(mk,{fullWidth:!0,children:[p.jsxs(Ee,{component:"fieldset",sx:le=>({m:0,minWidth:0,border:u.cardBorder,borderRadius:2,px:`${IN}px`,pt:0,pb:.75,minHeight:Mbe,transition:"border-color 120ms ease-in","&:hover":{borderColor:le.palette.text.secondary},"&:focus-within":{borderColor:le.palette.text.primary}}),children:[p.jsx(wt,{component:"legend",variant:"caption",color:"text.secondary",sx:{px:.5,lineHeight:1},children:d}),p.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1,children:[p.jsx(wt,{variant:"body2",sx:{fontWeight:"fontWeightMedium"},children:me?he?"Any":I?fe:String(ue):I?"Any":y??"Unset"}),me&&p.jsx(by,{onClear:()=>n(null),sx:{p:0}})]}),p.jsx(iJ,{size:"small",min:U,max:N,value:I?ie:ue,disableSwap:I,valueLabelDisplay:"auto","aria-label":I?void 0:d,getAriaLabel:I?le=>le===0?`${d} from`:`${d} to`:void 0,sx:{py:0,mt:.5},onChange:(le,ve)=>{E.current=ve,_(ve)},onChangeCommitted:()=>{const le=E.current;if(E.current=null,_(null),le!==null){if(I){const[ve,Le]=Array.isArray(le)?[le[0],le[1]]:[le,le];if(ve<=U&&Le>=N){n(null);return}n(Le>=N?sce(ve):lce(ve,Le));return}n(Array.isArray(le)?le[0]:le)}}}),p.jsxs(Wn,{direction:"row",justifyContent:"space-between",children:[p.jsx(wt,{variant:"caption",color:"text.secondary",children:U}),p.jsx(wt,{variant:"caption",color:"text.secondary",children:N})]})]}),w&&p.jsx(gk,{sx:{mx:`${IN}px`},children:w})]})}const oe=ou(m)?uu(m):void 0,Q=oe==="date"||oe==="timestamp"||oe==="timestamptz",ae=typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t),de=t==null||ae;if(Q&&!ae){const J=Abe(t);if(J!==void 0)return p.jsx(Dbe,{label:d,state:J,onChange:n,helperNode:w,defaultDisplay:y})}if(Q&&de){const J=ae?jr.utc(t):null;return p.jsx(Q0,{label:d,committed:J?.isValid()?J:null,toValue:Z=>Z.format("YYYY-MM-DD"),onChange:n,helperText:w})}if(uu(m)==="boolean"){const J=typeof t=="string"?ice(t):void 0;if(t==null||t===""||J!==void 0)return p.jsx(jbe,{label:d,picked:J,emptyOverride:t==="",onChange:n,helperNode:w,defaultDisplay:y})}if(m==="boolean"){const J=typeof t=="boolean";if(!J&&t!==void 0&&t!==null)return $("true or false");const Z=e.default?.trim()==="true";return p.jsxs(mk,{children:[p.jsxs(Wn,{direction:"row",alignItems:"center",children:[p.jsx(RE,{control:p.jsx(tQ,{checked:J?t:Z,onChange:G=>n(G.target.checked)}),label:d}),J&&p.jsx(by,{onClear:()=>n(null),edge:"end"})]}),w&&p.jsx(gk,{children:w})]})}if(m==="number"){const J=t!=null;return J&&t!==""&&typeof t!="number"?$("number"):p.jsx(LN,{label:d,type:"number",committed:typeof t=="number"?String(t):"",onCommit:Z=>n(Z===""?null:Number(Z)),placeholder:y,helperText:w,isOverridden:J,onClear:()=>n(null)})}if(m==="date"||m==="timestamp"||m==="timestamptz"){const J=t instanceof Date?t:typeof t=="string"?(G=>G instanceof Date?G:null)(NF(m,t)):null,Z=J?jr.utc(J):null;return t!=null&&t!==""&&J===null?$("date"):p.jsx(Q0,{label:d,committed:Z,toValue:G=>mce(G,J??void 0),onChange:n,helperText:w})}const X=typeof t=="string"?t:"",se=t!=null;return p.jsx(LN,{label:d,committed:X,onCommit:n,placeholder:se?void 0:y??(m.startsWith("filter<")?m:void 0),helperText:w,isOverridden:se,emptyOverrides:!0,onClear:()=>n(null)})}function LN({label:e,type:t,committed:n,onCommit:r,placeholder:o,helperText:a,isOverridden:i,emptyOverrides:s=!1,onClear:l}){const{draft:d,change:u,reset:m,bind:g}=s_(n,r,{unset:s&&!i});return p.jsx(ki,{label:e,type:t,value:d,onChange:y=>u(y.target.value),placeholder:o,helperText:a,slotProps:{input:{endAdornment:i&&p.jsx(c_,{onClear:()=>{m(""),l()}})}},...g,fullWidth:!0,size:"small"})}const Pbe=(e,t)=>e===null||t===null?e===t:e.year()===t.year()&&e.month()===t.month()&&e.date()===t.date();function Q0({label:e,committed:t,toValue:n,onChange:r,helperText:o,minDate:a}){const{draft:i,change:s,reset:l,bind:d}=s_(t,u=>{u===null?r(null):u.isValid()&&r(n(u))},{same:Pbe});return p.jsx(t3,{dateAdapter:iue,children:p.jsx(kbe,{label:e,value:i,minDate:a,onChange:s,slotProps:{textField:{fullWidth:!0,size:"small",helperText:o,...d},field:{clearable:!0,onClear:()=>{l(null),r(null)}},clearButton:{onMouseDown:u=>u.preventDefault()}}})})}function by({onClear:e,edge:t,sx:n}){return p.jsx(no,{size:"small","aria-label":"Clear value",onClick:e,edge:t,sx:[{minWidth:24,minHeight:24},...Array.isArray(n)?n:[n]],children:p.jsx(Ice,{fontSize:"small"})})}function c_({onClear:e}){return p.jsx(ME,{position:"end",onMouseDown:t=>t.preventDefault(),children:p.jsx(by,{onClear:e,edge:"end"})})}const zb="__any__";function jbe({label:e,picked:t,emptyOverride:n,onChange:r,helperNode:o,defaultDisplay:a}){const i=t??(n?zb:"");return p.jsx(Ee,{"data-testid":"boolean-filter",children:p.jsxs(ki,{select:!0,label:e,value:i,size:"small",fullWidth:!0,helperText:o,slotProps:{select:{displayEmpty:!0,renderValue:s=>s==="true"||s==="false"?s:s===zb?"Any":a||"Any"},input:{endAdornment:i!==""?p.jsx(by,{onClear:()=>r(null),sx:{mr:2}}):void 0}},onChange:s=>{s.target.value!==zb&&r(s.target.value)},children:[n&&p.jsx(ea,{value:zb,children:"Any"}),p.jsx(ea,{value:"true",children:"true"}),p.jsx(ea,{value:"false",children:"false"})]})})}function Abe(e){if(e==null)return{kind:"unset"};if(typeof e!="string")return;if(e==="")return{kind:"any"};const t=RF(e);if(t!==void 0)return{kind:"preset",key:t};const n=TF(e);if(n!==void 0)return{kind:"days",...n}}const Fb="__custom__",EC="__any__";function Dbe({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"),[l,d]=C.useState(t.kind==="days"?{from:t.firstDay,to:t.lastDay}:{});C.useEffect(()=>{t.kind==="days"?(s(!0),d({from:t.firstDay,to:t.lastDay})):t.kind!=="unset"&&s(!1)},[a]);const u=t.kind!=="unset",m=i?Fb:t.kind==="preset"?t.key:t.kind==="any"?EC:"",g=x=>{d(x),x.from&&x.to&&!jr.utc(x.to).isBefore(jr.utc(x.from))&&n(dce(x.from,x.to))},y=x=>{const w=x?jr.utc(x):null;return w?.isValid()?w:null};return p.jsxs(Wn,{direction:"row",spacing:1,"data-testid":"time-range",children:[p.jsxs(ki,{select:!0,label:e,value:m,size:"small",fullWidth:!0,helperText:r,slotProps:{select:{displayEmpty:!0,renderValue:x=>{if(x===Fb)return"Custom range";if(x===EC)return"Any time";const w=hy.find(S=>S.key===x);return w?w.label:o??"Any time"}},input:{endAdornment:u?p.jsx(by,{onClear:()=>{s(!1),d({}),n(null)},sx:{mr:2}}):void 0}},onChange:x=>{const w=x.target.value;if(w===Fb){s(!0);return}s(!1);const S=cce(w);S!==void 0&&n(S)},children:[t.kind==="any"&&p.jsx(ea,{value:EC,children:"Any time"}),hy.map(x=>p.jsx(ea,{value:x.key,children:x.label},x.key)),p.jsx(ea,{value:Fb,children:"Custom range"})]}),i&&p.jsxs(p.Fragment,{children:[p.jsx(Q0,{label:"From",committed:y(l.from),toValue:x=>x.format("YYYY-MM-DD"),onChange:x=>g({...l,from:x===null?void 0:String(x)})}),p.jsx(Q0,{label:"To",committed:y(l.to),minDate:y(l.from)??void 0,toValue:x=>x.format("YYYY-MM-DD"),onChange:x=>g({...l,to:x===null?void 0:String(x)})})]})]})}const u_=C.createContext(void 0);function Nbe({children:e,...t}){const n=C.useContext(u_);return p.jsxs(Ga,{...t,children:[e,n&&p.jsx(Ee,{role:"note",sx:{px:2,py:1,borderTop:1,borderColor:"divider",color:"text.secondary",typography:"caption"},children:n})]})}const _b=e=>e.toLocaleString("en-US");function Ibe(e,t,n){if(e.active)return e.searching?"Searching all values…":e.failed?`Could not search all values. Showing matches in the first ${_b(Td)}.`:e.page?.truncated?`Showing the first ${_b(mR)} matches. Keep typing to narrow them.`:void 0;if(t)return n?`Showing the first ${_b(Td)} values. Type to search them all.`:`Showing the first ${_b(Td)} values. A value not listed can still be typed.`}const Lbe=C.createContext(void 0),Sh=()=>C.useContext(Lbe),Eg="remove-badge",zbe={[`& .${Eg}`]:{opacity:0},[`&:hover .${Eg}, &:focus-within .${Eg}`]:{opacity:1},"@media (hover: none)":{[`& .${Eg}`]:{opacity:1}}};function Fbe({label:e,onRemove:t,disabledReason:n,inset:r=0}){const{theme:o}=Hr(),a=n!==void 0,i=p.jsx(no,{className:Eg,"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 ${Xd(o.cardBorder)}`,bgcolor:s.palette.background.paper,color:s.palette.text.secondary,cursor:a?"default":"pointer",transition:`opacity ${Zy}`,...Jy,"&:hover":{bgcolor:s.palette.background.paper,color:a?s.palette.text.secondary:s.palette.text.primary,borderColor:dF(o.cardBorder,o.tileTitle)}}),children:p.jsx(bh,{sx:{fontSize:12}})});return a?p.jsx(Br,{title:n,children:i}):i}const WR=e=>e.required===!0,_be=(e,t)=>e==null||e===""&&!DF(t);function Bbe(e,t,n){return e.filter(r=>r.name!==void 0&&WR(r)&&_be(t.get(r.name),r.type)&&(n?.[r.name]===void 0||n[r.name]===null))}function Ube(e,t){if(!t||e.length===0)return[];const n=new Set(t);return e.filter(r=>r.name&&n.has(r.name))}const d_=e=>e.label??e.name??"";function f_(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Vbe(e){const t=e.map(d_);return`Pick a value for ${f_(t)} to see this report.`}function qbe(e){return`Waiting for ${f_(e.map(d_))}.`}const m$=28,Hbe=/^\d{4}-\d{2}-\d{2}$/,p_=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"});function RC(e){if(!Hbe.test(e))return e;const t=new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())?e:p_.format(t)}function Wbe(e,t){if(e.length===0)return"";const n=e.join(", ");return t?n:n.length<=m$||e.length===1?X0(n,t):`${X0(e[0]??"",t)} +${e.length-1}`}function X0(e,t){return!t&&e.length>m$?`${e.slice(0,m$-1)}…`:e}function Ybe(e,t){if(WR(e))return"Required";const n=e.type??"string",r=j1(n,e.default);if(r!==void 0&&r!=="")return h_(n,r,t);const o=uu(n)??n;return e.control==="select"||e.control==="multiselect"||o==="string"?"All":"Any"}function h_(e,t,n){if(!ou(e))return X0(RC(t),n);const r=uu(e);if(r==="string"&&CF(t))return Wbe(SF(t),n);if(r==="number"){const o=EF(t);if(o)return`${o[0]}–${o[1]}`;const a=$F(t);if(a!==void 0)return`≥ ${a}`}if(r==="date"||r==="timestamp"||r==="timestamptz"){const o=RF(t);if(o)return hy.find(i=>i.key===o)?.label??t;const a=TF(t);if(a)return`${RC(a.firstDay)} – ${RC(a.lastDay)}`}return X0(t,n)}function m_(e,t,n){return t==null?Ybe(e,n):t instanceof Date?Number.isNaN(t.getTime())?"":p_.format(t):typeof t=="boolean"?t?"Yes":"No":typeof t=="number"?String(t):t===""?"(empty)":h_(e.type??"string",t,n)}function Gbe(e,t){return m_(e,t,!1)}function Kbe(e,t){return m_(e,t,!0)}function Qbe(e){const{given:t,value:n,onChange:r}=e,{theme:o}=Hr(),a=o.ui,i=Sh(),[s,l]=C.useState(null),d=t.name??"",u=t.label??d,m=n!=null,g=Gbe(t,n),y=s!==null,x=i?.stateOf(d),w=x?.problem,S=x?.fixed,b=p.jsxs(g_,{name:d,set:m,open:y,problem:w,fixed:S!==void 0,required:!m&&WR(t),children:[p.jsxs(rs,{"aria-haspopup":"dialog","aria-expanded":y,"aria-label":`${u}: ${g}`,onClick:$=>{l($.currentTarget),e.onOpen?.()},sx:$=>({height:"100%",borderRadius:a.radius.control,pl:"10px",pr:m?"4px":"8px",gap:"6px",fontFamily:"inherit",fontSize:a.type.control.fontSize,lineHeight:1,minWidth:0,color:$.palette.text.primary}),children:[p.jsx(Ee,{component:"span",sx:$=>({color:m?o.accent:$.palette.text.secondary,whiteSpace:"nowrap"}),children:u}),p.jsx(Ee,{component:"span",sx:{fontWeight:a.type.control.fontWeight,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:g}),!m&&p.jsx(uF,{"aria-hidden":!0,sx:$=>({fontSize:16,color:$.palette.text.secondary,transform:y?"rotate(180deg)":"none"})})]}),m&&p.jsx(no,{"aria-label":`Clear ${u}`,onClick:()=>r(null),sx:{width:22,height:22,mr:"4px",borderRadius:"4px",color:o.accent},children:p.jsx(bh,{sx:{fontSize:14}})})]});return p.jsxs(p.Fragment,{children:[w?p.jsx(Br,{title:w,children:b}):b,p.jsxs(jE,{className:Sl.filterPopover,open:y,anchorEl:s,onClose:()=>l(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:[p.jsx(l_,{...e}),i&&p.jsxs(Ee,{sx:$=>({mt:1.5,pt:1,borderTop:`1px solid ${$.palette.divider}`,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:.5}),children:[w&&p.jsx(wt,{sx:{...a.type.caption,color:"warning.main"},children:w}),S!==void 0&&p.jsx(wt,{sx:$=>({...a.type.caption,color:$.palette.text.secondary}),children:S}),p.jsx(Jbe,{name:d,type:t.type,text:Xbe(n,t.type)}),S===void 0?p.jsx(Hn,{size:"small","aria-label":`Edit filter ${d}`,"aria-haspopup":"dialog",onClick:()=>{l(null),i.onEdit(d)},sx:{px:.75,minWidth:0,...a.type.control},children:"Filter settings…"}):x?.openModel&&p.jsx(Hn,{size:"small",onClick:()=>{l(null),x.openModel?.()},sx:{px:.75,minWidth:0,...a.type.control},children:"Open the model"})]})]})]})}function Xbe(e,t){if(e!=null)return jF(e,t)}function Zbe(e,t){return e===void 0||!t?.startsWith("filter<")?e:/^f(['"])([\s\S]*)\1$/.exec(e)?.[2]??e}function Jbe({name:e,type:t,text:n}){const r=Sh(),o=Hr().theme.ui;if(!r?.setStartingValue)return null;const a=r.setStartingValue,i=Zbe(r.startingValueOf?.(e),t),s=r.stateOf(e)?.origin==="dashboard",l={px:.75,minWidth:0,...o.type.control};return p.jsxs(p.Fragment,{children:[i!==void 0&&i===n&&p.jsxs(wt,{sx:d=>({...o.type.caption,color:d.palette.text.secondary,px:.75,display:"flex",alignItems:"center",gap:.5}),children:[p.jsx(cF,{"aria-hidden":!0,sx:{fontSize:14}}),"Report default"]}),n!==void 0&&n!==i&&p.jsx(Hn,{size:"small",onClick:()=>a(e,n),sx:l,children:"Make this the report's default"}),i!==void 0&&p.jsx(Hn,{size:"small",onClick:()=>a(e,void 0),sx:l,children:s?"Use the filter's default":"Use the model's default"})]})}function g_({name:e,set:t=!1,open:n=!1,unused:r=!1,problem:o,fixed:a=!1,required:i=!1,children:s}){const{theme:l}=Hr(),d=l.ui,u=Sh();return p.jsxs(Ee,{className:Sl.filter,"data-filter":e,"data-set":t||void 0,"data-problem":o?!0:void 0,"data-required":i||void 0,sx:m=>({position:"relative",display:"inline-flex",alignItems:"center",height:d.size.control,boxSizing:"border-box",borderRadius:d.radius.control,border:"1px solid",borderStyle:r?"dashed":"solid",borderColor:o||i?m.palette.warning.main:t?`color-mix(in srgb, ${l.accent} 45%, transparent)`:n?l.accent:Xd(l.cardBorder),bgcolor:t?`color-mix(in srgb, ${l.accent} 8%, ${m.palette.background.paper})`:m.palette.background.paper,opacity:r?.75:1,transition:`border-color ${Zy}`,...Jy,"&:hover":{borderColor:t||n||o?void 0:dF(l.cardBorder,l.tileTitle)},maxWidth:"100%",...zbe}),children:[s,u&&!a&&p.jsx(Fbe,{label:`Remove filter ${e}`,onRemove:()=>u.onRemove(e)})]})}function e0e({name:e,label:t,unused:n=!0}){const r=Sh(),o=Hr().theme.ui;if(!r)return null;const a=r.stateOf(e)?.problem,i=p.jsx(g_,{name:e,unused:n,problem:a,children:p.jsxs(rs,{"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:[p.jsx("span",{children:t}),n&&p.jsx(Ee,{component:"span",sx:{fontStyle:"italic"},children:"Unused"})]})});return a?p.jsx(Br,{title:a,children:i}):i}function t0e(){const{theme:e}=Hr(),t=e.ui,n=Sh();if(!n)return null;const r=n.addDisabledReason!==void 0;return p.jsx(Br,{title:n.addDisabledReason??"",children:p.jsx("span",{children:p.jsx(Hn,{variant:"outlined",startIcon:p.jsx(p1,{}),"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:Xd(e.cardBorder),color:o.palette.text.secondary,boxShadow:"none",...t.type.control,"& .MuiButton-startIcon":{mr:.5},"& .MuiButton-startIcon svg":{fontSize:16}}),children:"Filter"})})})}function A1({givens:e,values:t,onChange:n,onReset:r,canReset:o,layout:a="panel",options:i,optionsLoading:s,optionsFailed:l,optionsTruncated:d,optionSearch:u,apply:m,title:g,onControlOpen:y}){const x=Sh();if(e.length===0&&!(x&&a==="bar"))return null;const w=Array.from(t.values()).some(R=>R!==null),S=o??w,b=R=>{if(R===void 0)return{};const O=u?.get(R);return{...d?.has(R)?{optionsTruncated:!0}:{},...O?{optionSearch:O}:{},...y?{onOpen:()=>y(R)}:{}}},$=e.map(R=>p.jsx(Ee,{children:p.jsx(l_,{given:R,value:R.name?t.get(R.name):void 0,onChange:O=>R.name&&n(R.name,O),options:R.name?i?.get(R.name):void 0,optionsLoading:s,optionsFailed:R.name?l?.has(R.name):void 0,...b(R.name)})},R.name)),k=p.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1,children:[m&&p.jsx(Hn,{variant:"contained",size:"small",disableElevation:!0,onClick:()=>m.pending&&m.onApply(),"aria-disabled":!m.pending,sx:{"&[aria-disabled='true']":{cursor:"default",color:"action.disabled",backgroundColor:"action.disabledBackground","&:hover":{backgroundColor:"action.disabledBackground"}}},children:"Apply"}),S&&p.jsx(Hn,{variant:"text",size:"small",onClick:r,children:"Reset"})]});return a==="bar"?p.jsxs(Wn,{direction:"row",role:"group","aria-label":g??"Filters",useFlexGap:!0,sx:{flexWrap:"wrap",alignItems:"center",gap:1},children:[e.map(R=>p.jsx(Qbe,{given:R,value:R.name?t.get(R.name):void 0,onChange:O=>R.name&&n(R.name,O),options:R.name?i?.get(R.name):void 0,optionsLoading:s,optionsFailed:R.name?l?.has(R.name):void 0,...b(R.name)},R.name)),x?.unrendered.map(R=>p.jsx(e0e,{name:R.name,label:R.label},R.name)),p.jsx(t0e,{}),p.jsx(Ee,{sx:{ml:"auto"},children:k})]}):p.jsxs(Ga,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[p.jsxs(Wn,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:2},children:[p.jsx(wt,{variant:"subtitle2",sx:{fontWeight:"fontWeightMedium",color:"text.primary"},children:g??"Filters"}),k]}),p.jsx(Ee,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",alignItems:"start",columnGap:3,rowGap:2.5},children:$})]})}const n0e=/^(https?|mailto|tel):/i,r0e=/^[a-z][a-z0-9+.-]*:/i;function o0e({href:e,title:t,children:n,context:r}){const o=!!e&&r0e.test(e),a=!!e&&!o&&!e.startsWith("/")&&!e.startsWith("#");if(!e||!a||!r){const m=o&&!n0e.test(e??"");return p.jsx("a",{href:m?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}`),l=s.pathname.slice(1)+s.search+s.hash,d=`/${r.environmentName}/${r.packageName}/${l}`,{onNavigate:u}=r;return p.jsx("a",{href:d,title:t,onClick:u?m=>{m.preventDefault(),u(d,m)}:void 0,children:n})}const a0e=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:sle},"& 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 i0e({alt:e}){return p.jsx(p.Fragment,{children:e})}function xy({children:e,variant:t="caption",links:n,sx:r}){const{theme:o}=Hr();return p.jsx(Ee,{sx:[a0e(o.ui)[t],{fontFamily:o.font.family},...Array.isArray(r)?r:[r]],children:p.jsx(Hoe,{options:{forceBlock:t==="document",disableParsingRawHTML:!0,overrides:{a:{component:o0e,props:{context:n}},img:{component:i0e}}},children:e})})}const qd={opening:e=>e?`Opening the ${e}…`:"Opening…",running:"Running…",loading:"Loading…"};function Go({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:a=2,textVariant:i="body2"}){const s=p.jsxs(Ee,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:a},children:[p.jsx(Cu,{size:t,color:n,thickness:r}),e&&p.jsx(wt,{variant:i,color:"text.secondary",children:e})]});return o?p.jsx(Ee,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:s}):s}let ng;function s0e(){return ng||(ng=vo(()=>import("./index-Co7C9Gew.js"),[]),ng.catch(()=>{ng=void 0})),ng}function YR(){typeof window>"u"||s0e().catch(()=>{})}const y_=rn(p.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 Lp({sx:e,...t}){const{theme:n}=Hr();return p.jsx(no,{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 l0e=new Set(["warn","error"]);function c0e(e){if(!e?.length)return;const t=[];let n=!1;for(const r of e)!r.message||!l0e.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(`
472
- `)}}const u0e=C.lazy(()=>vo(()=>import("./RenderedResult--fYcsY1h.es-DzOt5Lwv.js"),[]).then(e=>e.c));function D1({result:e,maxHeight:t,tableMaxHeight:n,firstPaintHeight:r,maxResultSize:o=0,renderLogs:a,drill:i,fill:s=!1,compactToFit:l=!1}){const d=C.useRef(null);C.useEffect(()=>YR(),[]);const[u,m]=C.useState(void 0),[g,y]=C.useState(void 0),[x,w]=C.useState(void 0),S=C.useCallback((U,N)=>{m(U),w(N)},[]),[b,$]=C.useState(!1),[k,R]=C.useState(void 0),O=c0e(a);C.useEffect(()=>{const U=d.current;if(!s||!U)return;const N=new ResizeObserver(([q])=>{R(Math.round(q.contentRect.height)),F(Math.round(q.contentRect.width))});return N.observe(U),()=>N.disconnect()},[s,!!e,b]);const[P,D]=C.useState(void 0),[A,F]=C.useState(void 0),L=s&&l&&u==="content";if(C.useEffect(()=>{D(void 0)},[e,A,L]),C.useEffect(()=>{L&&(k===void 0||g===void 0||(P===void 0&&g>k+1?D(g):P!==void 0&&k>=P&&D(void 0)))},[L,k,g,P]),!e)return null;if(o>0&&e.length>o&&!b)return p.jsxs(Ee,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[p.jsx(cae,{sx:{fontSize:48,color:"#757575"}}),p.jsx(wt,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),p.jsx(Hn,{variant:"contained",color:"primary",onClick:()=>$(!0),children:"Proceed"})]});const _=p.jsx(Go,{text:qd.loading,centered:!0,size:32}),E=Tle({renderAs:x,maxHeight:t,tableMaxHeight:n}),z=$D({sizing:u,contentHeight:g,maxHeight:E,fillHeight:s?k:void 0,firstPaintHeight:r}),I=p.jsx(C.Suspense,{fallback:_,children:p.jsx(u0e,{result:e,height:z,onSizeChange:y,onSizing:S,drill:i,fill:s})});return p.jsxs(Ee,{ref:d,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflowX:"hidden",overflowY:s?"hidden":"auto",...s&&{flex:`1 1 ${$D({sizing:u,contentHeight:g,maxHeight:E,firstPaintHeight:r})}px`,minHeight:0}},children:[s?p.jsx(Ee,{className:Nle,...L&&P!==void 0?{[Dle]:""}:{},sx:{position:"absolute",inset:0,overflowX:"hidden",overflowY:"auto"},children:I}):I,O&&p.jsx(Ee,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:p.jsx(Br,{title:O.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:p.jsx(Lp,{"aria-label":"Render tag warnings",children:p.jsx(y_,{fontSize:"small",color:O.severity==="error"?"error":"warning"})})})})]})}function GR({state:e,context:t,loadingText:n=qd.running,maxHeight:r,tableMaxHeight:o,firstPaintHeight:a,maxResultSize:i,drill:s,fill:l,compactToFit:d,transform:u}){const{data:m,isSuccess:g,isError:y,error:x,fetchStatus:w,isPlaceholderData:S}=e,b=g||w==="fetching";C.useEffect(()=>{b&&YR()},[b]);const $=m?.data.result,k=C.useMemo(()=>$!==void 0&&u?u($):$,[$,u]),R=C.useMemo(()=>hle(k),[k]);if(y)return p.jsx(Ee,{sx:{p:2},children:p.jsx(Xa,{context:t,error:x})});if(!g)return p.jsx(Go,{text:w==="idle"?qd.loading:n});if(R)return p.jsx(Ee,{sx:{p:2},children:p.jsx(wt,{variant:"body2",role:"status",color:"text.secondary",children:R})});const O=p.jsx(D1,{result:k,maxHeight:r,tableMaxHeight:o,...a!==void 0?{firstPaintHeight:a}:{},maxResultSize:i,renderLogs:m.data.renderLogs,drill:s,fill:l,compactToFit:d});return p.jsxs(Ee,{"aria-busy":S||void 0,sx:{position:"relative",display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...l?{height:"100%"}:{},"& > .result-body":{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...l?{height:"100%"}:{},opacity:S?.55:1,transition:S?"opacity 160ms ease 200ms":"opacity 120ms ease","@media (prefers-reduced-motion: reduce)":{transition:"none"}}},children:[S&&p.jsx(uz,{"aria-label":n,sx:{position:"absolute",top:0,left:0,right:0,height:2,zIndex:1,bgcolor:"transparent",borderRadius:1}}),p.jsx(Ee,{className:"result-body",children:O})]})}const Od=()=>typeof performance<"u"?performance.now():Date.now(),d0e=rn(p.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"})),f0e=3;function p0e(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 h0e(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function m0e({ignored:e}){const{theme:t}=Hr();if(e.length===0)return null;const n=e.length>f0e?`Doesn't respond to ${e.length} filters`:`Doesn't respond to ${e.join(", ")}`;return p.jsxs(Ee,{"data-testid":"tile-filter-tag",title:`This tile's query never reads ${h0e(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:[p.jsx(d0e,{sx:{fontSize:12}}),p.jsx(Ee,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]})}const g0e=/\.malloy(nb)?$/,N1=e=>e&&e.slice(e.lastIndexOf("/")+1).replace(g0e,"")||void 0,y0e=e=>e.replace(/\.malloy$/,"").split("/").map(encodeURIComponent).join("/"),v_=(e,t,n)=>`/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${y0e(n)}`,v0e="edit",b0e=(e,t,n)=>`${v_(e,t,n)}?${v0e}`,KR=e=>e.layout==="linear"?"linear":"grid",g$=e=>({layout:KR(e),path:e.path,editable:e.editable!==!1});function x0e(e,t){const n=t.find(r=>r.path===e);return n?.path?g$({...n,path:n.path}):void 0}function w0e(e){return e===""||e.startsWith("/")?!1:e.split("/").every(t=>t!==""&&t!=="."&&t!=="..")}function S0e(e,t){if(!w0e(e))return{kind:"unresolved"};for(const n of[`${e}.malloy`,e]){const r=x0e(n,t);if(r)return{kind:"path",report:r}}return{kind:"unresolved"}}const C0e=(e,t,n)=>["reports",e,t,n];async function k0e(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 b_(e,t,n,r=!0){const{apiClients:o}=er(),a=wo({queryKey:C0e(e,t,n),queryFn:()=>k0e(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 x_=20,$0e={radius:"8px",padding:`${x_}px`};function u2e(e,t=$0e){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 E0e={query:120,text:72};function Z0({borderless:e=!1,chrome:t="card",kind:n="query",sx:r,cardRef:o,children:a}){const{theme:i}=Hr(),s=i.ui,l=e||t==="none";return p.jsx(Ga,{ref:o,className:Sl.tile,elevation:0,"data-chrome":t,"data-tile-kind":n,sx:[{border:l?"none":i.cardBorder,borderRadius:l?0:s.radius.tile,background:l?"none":i.tile,overflow:"hidden",isolation:"isolate",display:"flex",flexDirection:"column",minWidth:0,minHeight:t==="none"?0:E0e[n],p:t==="none"?0:e?"12px 0":`${x_}px`},...Array.isArray(r)?r:[r]],children:a})}const R0e=Sl.tileHeading;function w_({title:e,subtitle:t,tooltip:n,action:r,quiet:o=!1}){const{theme:a}=Hr(),i=a.ui;return p.jsxs(Ee,{className:R0e,sx:{pb:o?.5:1.5,display:"flex",alignItems:"flex-start",gap:1},children:[p.jsxs(Ee,{sx:{minWidth:0,flex:1},children:[p.jsx(wt,{component:"div",sx:{...i.type.tileTitle,display:"block",color:a.tileTitle,fontFamily:a.font.family},title:n,children:e}),t!==void 0&&p.jsx(wt,{component:"div",sx:{...i.type.caption,display:"block",mt:"2px",color:a.tileTitle,fontFamily:a.font.family,opacity:.75},children:t})]}),r]})}const T0e=-1;function M0e(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 O0e(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 P0e(){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=M0e(r),a=o??window;let i=0;const s=()=>{i=0,t(O0e(r,o))},l=()=>{i===0&&(i=requestAnimationFrame(s))};a.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),s(),n.current=()=>{a.removeEventListener("scroll",l),window.removeEventListener("resize",l),i!==0&&cancelAnimationFrame(i)}},[]),stuck:e}}const j0e=4,A0e="--publisher-sticky-top",D0e=2;function y$({layout:e,notice:t,header:n,controls:r,children:o,sx:a}){return p.jsxs(Wn,{className:Sl.report,"data-layout":e,sx:[{gap:D0e},...Array.isArray(a)?a:[a]],children:[t,n,r,o]})}function N0e({title:e,description:t,actions:n}){const r=Hr().theme.ui;return p.jsxs(Wn,{className:Sl.header,sx:{gap:1.5},children:[p.jsxs(Wn,{direction:"row",sx:{alignItems:"center",gap:2},children:[p.jsx(wt,{component:"h1",className:Sl.title,sx:{...r.type.pageTitle,m:0,flex:1,minWidth:0},children:e}),n&&p.jsx(Ee,{sx:{my:"-4px"},children:n})]}),t]})}function QR({sx:e,children:t}){return p.jsx(Z0,{chrome:"none",kind:"text",...e?{sx:e}:{},children:t})}function S_({children:e}){const{theme:t}=Hr(),{stickyRef:n,stuck:r}=P0e();return p.jsx(Ee,{ref:n,className:Sl.filterRow,"data-stuck":r||void 0,sx:{position:"sticky",top:`calc(var(${A0e}, 0px) + ${T0e}px)`,zIndex:j0e,bgcolor:r?"background.default":"transparent",pb:1,pt:1,mt:-1,boxShadow:r?`0 1px 0 ${Xd(t.cardBorder)}`:"none",transition:`box-shadow ${Zy}`,...Jy},children:e})}const ko=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},I1=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 XR(e,t){if(e[t])return e;const n=e.default;return n?.[t]?n:e}const I0e=e=>XR(e,"MalloyTranslator"),L0e=e=>XR(e,"parseAnnotation"),z0e=e=>XR(e,"ASTQuery");async function d2e(){return I0e(await vo(()=>import("./index-BIoSdsU9.js").then(e=>e.i),__vite__mapDeps([0,1])))}async function f2e(){return L0e(await vo(()=>Promise.resolve().then(()=>bae),void 0))}async function F0e(){return z0e(await vo(()=>import("./index-DxF3kMLJ.js").then(e=>e.i),__vite__mapDeps([2,1])))}async function _0e(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 C_(e){return e.find(t=>t.authoritative)??e.find(t=>t.writeable)}function B0e({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 p2e(e,t){return e??(t===void 0?void 0:await _0e(t))}function h2e({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 m2e(e){return e instanceof Error?e.message:String(e)}function U0e(e){const t=e.response?.data;return t?.message?t.message:e instanceof Error?e.message:String(e)}async function g2e({apiClients:e,queryClient:t,environmentName:n,packageName:r,modelPath:o,source:a,expectedHash:i,invalidateOnError:s,invalidate:l,afterWrite:d}){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(U0e(g))}const m=u.data.contentHash;await d?.(m);for(const{queryKey:g,refetchType:y,wait:x}of l){const w=t.invalidateQueries({queryKey:g,...y?{refetchType:y}:{}});x&&await w}return m}function y2e(e,t){return t===void 0||!/\.(saved|save_undone)$/.test(e.type)||e.where==="package"?e:{...e,workspace:t}}function v2e(e){if(!("resourceUri"in e))return{environmentName:e.environmentName,packageName:e.packageName,versionId:void 0,namesBoth:!0};let t;try{t=ko(e.resourceUri)}catch{t=void 0}return{environmentName:t?.environmentName??"",packageName:t?.packageName??"",versionId:t?.versionId,namesBoth:!!t?.environmentName&&!!t?.packageName}}class k_ extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const $_=e=>e instanceof k_||e instanceof Error&&e.name==="DocumentNotFoundError",V0e=String.raw`##?\|?[ \t]*(?:[([{<][ \t]*)?(?:(?:(?:row|source)[-_]?)?authorize|access[-_]?filter)(?=[)\]}>]|[ \t]|$)`;function E_(e,t){if(/[\r\n]/.test(t))return`A ${e} is one line; it cannot hold a line break.`;if(new RegExp(V0e,"iu").test(t))return`A ${e} cannot contain what reads as an access-control tag (authorize, row_authorize, source_authorize or access_filter).`}const rg=e=>Wy(e)?e:`\`${e}\``;function ZR(e){const{title:t,modelPath:n,source:r,view:o}=e;if(t.trim()==="")return"A title cannot be empty.";const a=E_("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 q0e=e=>{const t=e.replace(/[-_]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},zN=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,H0e="report.malloy";function JR(e,t,n=H0e){const r=ZR(e);if(r)throw new Error(r);const{modelPath:o,source:a,view:i}=e,s=e.title.trim(),l=zN(s),d=rg(`${a}_tiles`),u=rg(`${i}_tile`),m=`"${d} -> ${u}"`;return["##! experimental.givens",`##| artifact { layout=${t} title=${l}`," tiles=[",` ${m}`," ]",t==="grid"?"} dashboard { columns=12 }":"}","|##",`import { ${rg(a)} } from "${yF(o,n)}"`,"",`source: ${d} is ${rg(a)} extend {`,` # label=${zN(q0e(i))}`,` view: ${u} is ${rg(i)}`,"}",""].join(`
473
- `)}function b2e(e,t){return JR(e,"linear",t)}function W0e(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,80)}function Y0e({title:e,modelPath:t,source:n,view:r}){for(const[o,a]of[["source",n],["view",r]])if(!Wy(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.`:E_("title",e)}function x2e(e,t){const n=Y0e(e);if(n)throw new Error(n);return JR(e,"grid",t)}const R_=e=>(e??"").trim().replace(/\\/g,"/").split("/").filter(t=>t!=="").join("/");function G0e(e,t){const n=R_(t);return`${n===""?"":`${n}/`}${e}.malloy`}function K0e(e){return W0e(e)||"untitled"}function T_(e,t=1,n){const r=K0e(e);return G0e(t>1?`${r}-${t}`:r,n)}const wy=(e,t,n)=>`${e}/${t}/${n}`,Q0e=(e,t,n,r,o)=>({workspace:t,type:e,path:wy(n,r,o)}),e2=20;function X0e(e){const{savesTo:t,writer:n}=B0e({...e,readFailed:!1});return t==="browser"?void 0:n}const FN=e=>e.slice(e.lastIndexOf("/")+1).replace(/\.malloy$/,"");function M_(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 Z0e(e){const t=e.layout??"linear",n=Od();let r;try{r=await J0e(e,t)}catch(o){throw Yk({path:e.path??"",layout:t},e.onEvent).emit({type:"report.create_refused",reason:o instanceof Error?o.message:String(o)}),o}return Yk({path:r.path,layout:t},e.onEvent).emit({type:"report.created",where:e.target.route==="package"?"package":"host",durationMs:Od()-n}),e.onCreated?.(r),r}async function J0e(e,t){const{document:n,target:r}=e,o=ZR(n);if(o)throw new Error(o);const a=R_(e.directory),i=e.path!==void 0?[e.path]:Array.from({length:e2},(w,S)=>T_(n.title,S+1,a));for(const w of i){const S=M_(w);if(S)throw new Error(S)}const s=w=>JR(n,t,w);if(r.route==="package"){const w=new Set(r.existing);let S;for(const b of i)if(!w.has(b))try{await r.write(b,s(b)),S=b;break}catch($){if(!txe($))throw $}if(S===void 0)throw _N(n.title,e.path);return{layout:t,path:S,slug:FN(S)}}const{storage:l,workspace:d,environmentName:u,packageName:m}=r,g=new Set(r.existing),y=new Set((await l.listDocuments(d)).map(w=>w.path));let x;for(const w of i){const S=Q0e(t,d.name,u,m,w),b=await l.resolveDocumentPath?.(S)??w;if(y.has(S.path)||g.has(w)||g.has(b))continue;let $=!0;try{await l.getDocument(S)}catch(k){if(!$_(k))throw k;$=!1}if(!$){x={layout:t,path:b,slug:FN(b),locator:S};break}}if(x===void 0)throw _N(n.title,e.path);return await l.saveDocument(x.locator,s(x.path)),x}const exe=/^`[^`]+` already exists in the package\b/;function txe(e){const t=e?.response;if(t?.status!==409)return!1;const n=t.data?.reason;if(n==="FILE_EXISTS")return!0;if(n!=null)return!1;const r=t.data?.message;return typeof r=="string"&&exe.test(r)}const _N=(e,t)=>new Error(t!==void 0?`${t} already exists. Fix: choose a different location.`:`No free file name for "${e}" after ${e2} tries. Fix: choose a different title.`);function nxe(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 BN(e){for(const t of e??[]){const n=/^#\(doc\)\s*(.*)$/s.exec(t.trim());if(n)return n[1].trim()}}function rxe(e){for(const t of e??[]){const n=/^#\s*(?:-[A-Za-z_]+\s+)*([a-z_]+)/.exec(t.trim())?.[1];if(n&&sF.includes(n))return n}}function oxe({environmentName:e,packageName:t,versionId:n,models:r,enabled:o}){const{apiClients:a,server:i}=er(),s=Lz({queries:r.map(x=>({queryKey:["new-document-model",e,t,n,x,i],queryFn:async()=>(await a.models.getModel(e,t,x,n)).data,enabled:o,retry:!1,staleTime:300*1e3,refetchOnWindowFocus:!1}))}),l=s.map(x=>x.dataUpdatedAt).join(),d=C.useMemo(()=>{const x=new Map;return s.forEach((w,S)=>{const b=[],$=nxe(w.data?.modelInfo);for(const k of w.data?.sources??[]){if(typeof k.name!="string"||!$.has(k.name))continue;const R=BN(k.annotations);for(const O of k.views??[])if(typeof O.name=="string"){const P=BN(O.annotations),D=rxe(O.annotations);b.push({source:k.name,view:O.name,...P?{description:P}:{},...D?{chart:D}:{},...R?{sourceDescription:R}:{}})}}b.length>0&&x.set(r[S],b)}),x},[l,r]),u=s.some(x=>x.isLoading),m=u?[]:r.filter((x,w)=>s[w]?.isError),g=!u&&s.some(x=>x.isError&&D4(x.error)),y=()=>{s.forEach(x=>{x.isError&&x.refetch()})};return{choices:d,isLoading:u,isSuccess:s.length>0&&s.every(x=>!x.isPending),failed:m,retry:y,canRetry:g}}const O_=C.createContext(void 0);function axe({children:e,documentStorage:t}){const n=C.useMemo(()=>({documentStorage:t}),[t]);return p.jsx(O_.Provider,{value:n,children:e})}function P_(){return C.useContext(O_)}function ixe(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 w2e=1e4,j_=e=>e==="notebook"?"linear":"grid",S2e=(e,t)=>`${e}s/${t}.malloy`;function sxe(e){for(const t of[["report"],["reports"]])e.invalidateQueries({queryKey:t})}function wo(e){const{server:t}=er(),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 Ld(n,dy)}function hl(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 a0(t,dy)}function A_(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath,e.queryName,e.query,e.sourceName,JSON.stringify(e.givens??{})]}function C2e(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath]}function D_(e,t,n){return e.models.executeQueryModel(t.environmentName,t.packageName,t.modelPath,{queryName:t.queryName,query:t.query,sourceName:t.sourceName,givens:t.givens,versionId:t.versionId},void 0,void 0,{signal:n})}function t2(e,{enabled:t=!0}={}){const{apiClients:n}=er(),r=A_(e);return wo({queryKey:r,queryFn:({signal:o})=>D_(n,e,o),enabled:t,placeholderData:(o,a)=>a&&cxe(a.queryKey,r)?o:void 0,...S4})}const lxe=8;function cxe(e,t){return e.every((n,r)=>r===lxe||r>=t.length||n===t[r])}const uxe=/<\/?[A-Za-z][^>]*>|<!--|<![A-Za-z]/;function N_(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&&uxe.test(a)){e.delete("label"),t=!0;continue}}const o=Array.isArray(r.eq)?r.eq:[];for(const a of[r,...o])N_(a)&&(t=!0)}return t}function dxe(e){const t=e.trim();if(!/^#(?:\||[ \t\r\n]|$)/.test(t))return e;if(t.includes("@env."))return"";let n;try{n=t1.parseAnnotation(t)}catch{return""}return n.log.length>0?"":N_(n.tag)?`${n.tag.toString()}
472
+ `)}}const u0e=C.lazy(()=>vo(()=>import("./RenderedResult-BEJ_GMaW.es-DS2oXAjc.js"),[]).then(e=>e.c));function D1({result:e,maxHeight:t,tableMaxHeight:n,firstPaintHeight:r,maxResultSize:o=0,renderLogs:a,drill:i,fill:s=!1,compactToFit:l=!1}){const d=C.useRef(null);C.useEffect(()=>YR(),[]);const[u,m]=C.useState(void 0),[g,y]=C.useState(void 0),[x,w]=C.useState(void 0),S=C.useCallback((U,N)=>{m(U),w(N)},[]),[b,$]=C.useState(!1),[k,R]=C.useState(void 0),O=c0e(a);C.useEffect(()=>{const U=d.current;if(!s||!U)return;const N=new ResizeObserver(([q])=>{R(Math.round(q.contentRect.height)),F(Math.round(q.contentRect.width))});return N.observe(U),()=>N.disconnect()},[s,!!e,b]);const[P,D]=C.useState(void 0),[A,F]=C.useState(void 0),L=s&&l&&u==="content";if(C.useEffect(()=>{D(void 0)},[e,A,L]),C.useEffect(()=>{L&&(k===void 0||g===void 0||(P===void 0&&g>k+1?D(g):P!==void 0&&k>=P&&D(void 0)))},[L,k,g,P]),!e)return null;if(o>0&&e.length>o&&!b)return p.jsxs(Ee,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[p.jsx(cae,{sx:{fontSize:48,color:"#757575"}}),p.jsx(wt,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),p.jsx(Hn,{variant:"contained",color:"primary",onClick:()=>$(!0),children:"Proceed"})]});const _=p.jsx(Go,{text:qd.loading,centered:!0,size:32}),E=Tle({renderAs:x,maxHeight:t,tableMaxHeight:n}),z=$D({sizing:u,contentHeight:g,maxHeight:E,fillHeight:s?k:void 0,firstPaintHeight:r}),I=p.jsx(C.Suspense,{fallback:_,children:p.jsx(u0e,{result:e,height:z,onSizeChange:y,onSizing:S,drill:i,fill:s})});return p.jsxs(Ee,{ref:d,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflowX:"hidden",overflowY:s?"hidden":"auto",...s&&{flex:`1 1 ${$D({sizing:u,contentHeight:g,maxHeight:E,firstPaintHeight:r})}px`,minHeight:0}},children:[s?p.jsx(Ee,{className:Nle,...L&&P!==void 0?{[Dle]:""}:{},sx:{position:"absolute",inset:0,overflowX:"hidden",overflowY:"auto"},children:I}):I,O&&p.jsx(Ee,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:p.jsx(Br,{title:O.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:p.jsx(Lp,{"aria-label":"Render tag warnings",children:p.jsx(y_,{fontSize:"small",color:O.severity==="error"?"error":"warning"})})})})]})}function GR({state:e,context:t,loadingText:n=qd.running,maxHeight:r,tableMaxHeight:o,firstPaintHeight:a,maxResultSize:i,drill:s,fill:l,compactToFit:d,transform:u}){const{data:m,isSuccess:g,isError:y,error:x,fetchStatus:w,isPlaceholderData:S}=e,b=g||w==="fetching";C.useEffect(()=>{b&&YR()},[b]);const $=m?.data.result,k=C.useMemo(()=>$!==void 0&&u?u($):$,[$,u]),R=C.useMemo(()=>hle(k),[k]);if(y)return p.jsx(Ee,{sx:{p:2},children:p.jsx(Xa,{context:t,error:x})});if(!g)return p.jsx(Go,{text:w==="idle"?qd.loading:n});if(R)return p.jsx(Ee,{sx:{p:2},children:p.jsx(wt,{variant:"body2",role:"status",color:"text.secondary",children:R})});const O=p.jsx(D1,{result:k,maxHeight:r,tableMaxHeight:o,...a!==void 0?{firstPaintHeight:a}:{},maxResultSize:i,renderLogs:m.data.renderLogs,drill:s,fill:l,compactToFit:d});return p.jsxs(Ee,{"aria-busy":S||void 0,sx:{position:"relative",display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...l?{height:"100%"}:{},"& > .result-body":{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...l?{height:"100%"}:{},opacity:S?.55:1,transition:S?"opacity 160ms ease 200ms":"opacity 120ms ease","@media (prefers-reduced-motion: reduce)":{transition:"none"}}},children:[S&&p.jsx(uz,{"aria-label":n,sx:{position:"absolute",top:0,left:0,right:0,height:2,zIndex:1,bgcolor:"transparent",borderRadius:1}}),p.jsx(Ee,{className:"result-body",children:O})]})}const Od=()=>typeof performance<"u"?performance.now():Date.now(),d0e=rn(p.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"})),f0e=3;function p0e(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 h0e(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function m0e({ignored:e}){const{theme:t}=Hr();if(e.length===0)return null;const n=e.length>f0e?`Doesn't respond to ${e.length} filters`:`Doesn't respond to ${e.join(", ")}`;return p.jsxs(Ee,{"data-testid":"tile-filter-tag",title:`This tile's query never reads ${h0e(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:[p.jsx(d0e,{sx:{fontSize:12}}),p.jsx(Ee,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]})}const g0e=/\.malloy(nb)?$/,N1=e=>e&&e.slice(e.lastIndexOf("/")+1).replace(g0e,"")||void 0,y0e=e=>e.replace(/\.malloy$/,"").split("/").map(encodeURIComponent).join("/"),v_=(e,t,n)=>`/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${y0e(n)}`,v0e="edit",b0e=(e,t,n)=>`${v_(e,t,n)}?${v0e}`,KR=e=>e.layout==="linear"?"linear":"grid",g$=e=>({layout:KR(e),path:e.path,editable:e.editable!==!1});function x0e(e,t){const n=t.find(r=>r.path===e);return n?.path?g$({...n,path:n.path}):void 0}function w0e(e){return e===""||e.startsWith("/")?!1:e.split("/").every(t=>t!==""&&t!=="."&&t!=="..")}function S0e(e,t){if(!w0e(e))return{kind:"unresolved"};for(const n of[`${e}.malloy`,e]){const r=x0e(n,t);if(r)return{kind:"path",report:r}}return{kind:"unresolved"}}const C0e=(e,t,n)=>["reports",e,t,n];async function k0e(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 b_(e,t,n,r=!0){const{apiClients:o}=er(),a=wo({queryKey:C0e(e,t,n),queryFn:()=>k0e(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 x_=20,$0e={radius:"8px",padding:`${x_}px`};function d2e(e,t=$0e){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 E0e={query:120,text:72};function Z0({borderless:e=!1,chrome:t="card",kind:n="query",sx:r,cardRef:o,children:a}){const{theme:i}=Hr(),s=i.ui,l=e||t==="none";return p.jsx(Ga,{ref:o,className:Sl.tile,elevation:0,"data-chrome":t,"data-tile-kind":n,sx:[{border:l?"none":i.cardBorder,borderRadius:l?0:s.radius.tile,background:l?"none":i.tile,overflow:"hidden",isolation:"isolate",display:"flex",flexDirection:"column",minWidth:0,minHeight:t==="none"?0:E0e[n],p:t==="none"?0:e?"12px 0":`${x_}px`},...Array.isArray(r)?r:[r]],children:a})}const R0e=Sl.tileHeading;function w_({title:e,subtitle:t,tooltip:n,action:r,quiet:o=!1}){const{theme:a}=Hr(),i=a.ui;return p.jsxs(Ee,{className:R0e,sx:{pb:o?.5:1.5,display:"flex",alignItems:"flex-start",gap:1},children:[p.jsxs(Ee,{sx:{minWidth:0,flex:1},children:[p.jsx(wt,{component:"div",sx:{...i.type.tileTitle,display:"block",color:a.tileTitle,fontFamily:a.font.family},title:n,children:e}),t!==void 0&&p.jsx(wt,{component:"div",sx:{...i.type.caption,display:"block",mt:"2px",color:a.tileTitle,fontFamily:a.font.family,opacity:.75},children:t})]}),r]})}const T0e=-1;function M0e(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 O0e(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 P0e(){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=M0e(r),a=o??window;let i=0;const s=()=>{i=0,t(O0e(r,o))},l=()=>{i===0&&(i=requestAnimationFrame(s))};a.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),s(),n.current=()=>{a.removeEventListener("scroll",l),window.removeEventListener("resize",l),i!==0&&cancelAnimationFrame(i)}},[]),stuck:e}}const j0e=4,A0e="--publisher-sticky-top",D0e=2;function y$({layout:e,notice:t,header:n,controls:r,children:o,sx:a}){return p.jsxs(Wn,{className:Sl.report,"data-layout":e,sx:[{gap:D0e},...Array.isArray(a)?a:[a]],children:[t,n,r,o]})}function N0e({title:e,description:t,actions:n}){const r=Hr().theme.ui;return p.jsxs(Wn,{className:Sl.header,sx:{gap:1.5},children:[p.jsxs(Wn,{direction:"row",sx:{alignItems:"center",gap:2},children:[p.jsx(wt,{component:"h1",className:Sl.title,sx:{...r.type.pageTitle,m:0,flex:1,minWidth:0},children:e}),n&&p.jsx(Ee,{sx:{my:"-4px"},children:n})]}),t]})}function QR({sx:e,children:t}){return p.jsx(Z0,{chrome:"none",kind:"text",...e?{sx:e}:{},children:t})}function S_({children:e}){const{theme:t}=Hr(),{stickyRef:n,stuck:r}=P0e();return p.jsx(Ee,{ref:n,className:Sl.filterRow,"data-stuck":r||void 0,sx:{position:"sticky",top:`calc(var(${A0e}, 0px) + ${T0e}px)`,zIndex:j0e,bgcolor:r?"background.default":"transparent",pb:1,pt:1,mt:-1,boxShadow:r?`0 1px 0 ${Xd(t.cardBorder)}`:"none",transition:`box-shadow ${Zy}`,...Jy},children:e})}const ko=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},I1=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 XR(e,t){if(e[t])return e;const n=e.default;return n?.[t]?n:e}const I0e=e=>XR(e,"MalloyTranslator"),L0e=e=>XR(e,"parseAnnotation"),z0e=e=>XR(e,"ASTQuery");async function f2e(){return I0e(await vo(()=>import("./index-N8X9kVzc.js").then(e=>e.i),__vite__mapDeps([0,1])))}async function p2e(){return L0e(await vo(()=>Promise.resolve().then(()=>bae),void 0))}async function F0e(){return z0e(await vo(()=>import("./index-We9Zzxmt.js").then(e=>e.i),__vite__mapDeps([2,1])))}async function _0e(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 C_(e){return e.find(t=>t.authoritative)??e.find(t=>t.writeable)}function B0e({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 h2e(e,t){return e??(t===void 0?void 0:await _0e(t))}function m2e({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 g2e(e){return e instanceof Error?e.message:String(e)}function U0e(e){const t=e.response?.data;return t?.message?t.message:e instanceof Error?e.message:String(e)}async function y2e({apiClients:e,queryClient:t,environmentName:n,packageName:r,modelPath:o,source:a,expectedHash:i,invalidateOnError:s,invalidate:l,afterWrite:d}){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(U0e(g))}const m=u.data.contentHash;await d?.(m);for(const{queryKey:g,refetchType:y,wait:x}of l){const w=t.invalidateQueries({queryKey:g,...y?{refetchType:y}:{}});x&&await w}return m}function v2e(e,t){return t===void 0||!/\.(saved|save_undone)$/.test(e.type)||e.where==="package"?e:{...e,workspace:t}}function b2e(e){if(!("resourceUri"in e))return{environmentName:e.environmentName,packageName:e.packageName,versionId:void 0,namesBoth:!0};let t;try{t=ko(e.resourceUri)}catch{t=void 0}return{environmentName:t?.environmentName??"",packageName:t?.packageName??"",versionId:t?.versionId,namesBoth:!!t?.environmentName&&!!t?.packageName}}class k_ extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const $_=e=>e instanceof k_||e instanceof Error&&e.name==="DocumentNotFoundError",V0e=String.raw`##?\|?[ \t]*(?:[([{<][ \t]*)?(?:(?:(?:row|source)[-_]?)?authorize|access[-_]?filter)(?=[)\]}>]|[ \t]|$)`;function E_(e,t){if(/[\r\n]/.test(t))return`A ${e} is one line; it cannot hold a line break.`;if(new RegExp(V0e,"iu").test(t))return`A ${e} cannot contain what reads as an access-control tag (authorize, row_authorize, source_authorize or access_filter).`}const rg=e=>Wy(e)?e:`\`${e}\``;function ZR(e){const{title:t,modelPath:n,source:r,view:o}=e;if(t.trim()==="")return"A title cannot be empty.";const a=E_("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 q0e=e=>{const t=e.replace(/[-_]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},zN=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,H0e="report.malloy";function JR(e,t,n=H0e){const r=ZR(e);if(r)throw new Error(r);const{modelPath:o,source:a,view:i}=e,s=e.title.trim(),l=zN(s),d=rg(`${a}_tiles`),u=rg(`${i}_tile`),m=`"${d} -> ${u}"`;return["##! experimental.givens",`##| artifact { layout=${t} title=${l}`," tiles=[",` ${m}`," ]",t==="grid"?"} dashboard { columns=12 }":"}","|##",`import { ${rg(a)} } from "${yF(o,n)}"`,"",`source: ${d} is ${rg(a)} extend {`,` # label=${zN(q0e(i))}`,` view: ${u} is ${rg(i)}`,"}",""].join(`
473
+ `)}function x2e(e,t){return JR(e,"linear",t)}function W0e(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,80)}function Y0e({title:e,modelPath:t,source:n,view:r}){for(const[o,a]of[["source",n],["view",r]])if(!Wy(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.`:E_("title",e)}function w2e(e,t){const n=Y0e(e);if(n)throw new Error(n);return JR(e,"grid",t)}const R_=e=>(e??"").trim().replace(/\\/g,"/").split("/").filter(t=>t!=="").join("/");function G0e(e,t){const n=R_(t);return`${n===""?"":`${n}/`}${e}.malloy`}function K0e(e){return W0e(e)||"untitled"}function T_(e,t=1,n){const r=K0e(e);return G0e(t>1?`${r}-${t}`:r,n)}const wy=(e,t,n)=>`${e}/${t}/${n}`,Q0e=(e,t,n,r,o)=>({workspace:t,type:e,path:wy(n,r,o)}),e2=20;function X0e(e){const{savesTo:t,writer:n}=B0e({...e,readFailed:!1});return t==="browser"?void 0:n}const FN=e=>e.slice(e.lastIndexOf("/")+1).replace(/\.malloy$/,"");function M_(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 Z0e(e){const t=e.layout??"linear",n=Od();let r;try{r=await J0e(e,t)}catch(o){throw Yk({path:e.path??"",layout:t},e.onEvent).emit({type:"report.create_refused",reason:o instanceof Error?o.message:String(o)}),o}return Yk({path:r.path,layout:t},e.onEvent).emit({type:"report.created",where:e.target.route==="package"?"package":"host",durationMs:Od()-n}),e.onCreated?.(r),r}async function J0e(e,t){const{document:n,target:r}=e,o=ZR(n);if(o)throw new Error(o);const a=R_(e.directory),i=e.path!==void 0?[e.path]:Array.from({length:e2},(w,S)=>T_(n.title,S+1,a));for(const w of i){const S=M_(w);if(S)throw new Error(S)}const s=w=>JR(n,t,w);if(r.route==="package"){const w=new Set(r.existing);let S;for(const b of i)if(!w.has(b))try{await r.write(b,s(b)),S=b;break}catch($){if(!txe($))throw $}if(S===void 0)throw _N(n.title,e.path);return{layout:t,path:S,slug:FN(S)}}const{storage:l,workspace:d,environmentName:u,packageName:m}=r,g=new Set(r.existing),y=new Set((await l.listDocuments(d)).map(w=>w.path));let x;for(const w of i){const S=Q0e(t,d.name,u,m,w),b=await l.resolveDocumentPath?.(S)??w;if(y.has(S.path)||g.has(w)||g.has(b))continue;let $=!0;try{await l.getDocument(S)}catch(k){if(!$_(k))throw k;$=!1}if(!$){x={layout:t,path:b,slug:FN(b),locator:S};break}}if(x===void 0)throw _N(n.title,e.path);return await l.saveDocument(x.locator,s(x.path)),x}const exe=/^`[^`]+` already exists in the package\b/;function txe(e){const t=e?.response;if(t?.status!==409)return!1;const n=t.data?.reason;if(n==="FILE_EXISTS")return!0;if(n!=null)return!1;const r=t.data?.message;return typeof r=="string"&&exe.test(r)}const _N=(e,t)=>new Error(t!==void 0?`${t} already exists. Fix: choose a different location.`:`No free file name for "${e}" after ${e2} tries. Fix: choose a different title.`);function nxe(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 BN(e){for(const t of e??[]){const n=/^#\(doc\)\s*(.*)$/s.exec(t.trim());if(n)return n[1].trim()}}function rxe(e){for(const t of e??[]){const n=/^#\s*(?:-[A-Za-z_]+\s+)*([a-z_]+)/.exec(t.trim())?.[1];if(n&&sF.includes(n))return n}}function oxe({environmentName:e,packageName:t,versionId:n,models:r,enabled:o}){const{apiClients:a,server:i}=er(),s=Lz({queries:r.map(x=>({queryKey:["new-document-model",e,t,n,x,i],queryFn:async()=>(await a.models.getModel(e,t,x,n)).data,enabled:o,retry:!1,staleTime:300*1e3,refetchOnWindowFocus:!1}))}),l=s.map(x=>x.dataUpdatedAt).join(),d=C.useMemo(()=>{const x=new Map;return s.forEach((w,S)=>{const b=[],$=nxe(w.data?.modelInfo);for(const k of w.data?.sources??[]){if(typeof k.name!="string"||!$.has(k.name))continue;const R=BN(k.annotations);for(const O of k.views??[])if(typeof O.name=="string"){const P=BN(O.annotations),D=rxe(O.annotations);b.push({source:k.name,view:O.name,...P?{description:P}:{},...D?{chart:D}:{},...R?{sourceDescription:R}:{}})}}b.length>0&&x.set(r[S],b)}),x},[l,r]),u=s.some(x=>x.isLoading),m=u?[]:r.filter((x,w)=>s[w]?.isError),g=!u&&s.some(x=>x.isError&&D4(x.error)),y=()=>{s.forEach(x=>{x.isError&&x.refetch()})};return{choices:d,isLoading:u,isSuccess:s.length>0&&s.every(x=>!x.isPending),failed:m,retry:y,canRetry:g}}const O_=C.createContext(void 0);function axe({children:e,documentStorage:t}){const n=C.useMemo(()=>({documentStorage:t}),[t]);return p.jsx(O_.Provider,{value:n,children:e})}function P_(){return C.useContext(O_)}function ixe(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 S2e=1e4,j_=e=>e==="notebook"?"linear":"grid",C2e=(e,t)=>`${e}s/${t}.malloy`;function sxe(e){for(const t of[["report"],["reports"]])e.invalidateQueries({queryKey:t})}function wo(e){const{server:t}=er(),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 Ld(n,dy)}function hl(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 a0(t,dy)}function A_(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath,e.queryName,e.query,e.sourceName,JSON.stringify(e.givens??{})]}function k2e(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath]}function D_(e,t,n){return e.models.executeQueryModel(t.environmentName,t.packageName,t.modelPath,{queryName:t.queryName,query:t.query,sourceName:t.sourceName,givens:t.givens,versionId:t.versionId},void 0,void 0,{signal:n})}function t2(e,{enabled:t=!0}={}){const{apiClients:n}=er(),r=A_(e);return wo({queryKey:r,queryFn:({signal:o})=>D_(n,e,o),enabled:t,placeholderData:(o,a)=>a&&cxe(a.queryKey,r)?o:void 0,...S4})}const lxe=8;function cxe(e,t){return e.every((n,r)=>r===lxe||r>=t.length||n===t[r])}const uxe=/<\/?[A-Za-z][^>]*>|<!--|<![A-Za-z]/;function N_(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&&uxe.test(a)){e.delete("label"),t=!0;continue}}const o=Array.isArray(r.eq)?r.eq:[];for(const a of[r,...o])N_(a)&&(t=!0)}return t}function dxe(e){const t=e.trim();if(!/^#(?:\||[ \t\r\n]|$)/.test(t))return e;if(t.includes("@env."))return"";let n;try{n=t1.parseAnnotation(t)}catch{return""}return n.log.length>0?"":N_(n.tag)?`${n.tag.toString()}
474
474
  `:e}function v$(e){if(Array.isArray(e)){for(const n of e)v$(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=dxe(a.value))}else v$(r)}function I_(e){let t;try{t=JSON.parse(e)}catch{return e}const n=JSON.stringify(t);v$(t);const r=JSON.stringify(t);return r===n?e:r}const fxe=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"]),pxe={value:`# big_value
475
475
  `};function hxe(e){const t=e.schema?.fields;if(!Array.isArray(t)||t.length===0||!t.every(r=>Wk(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 mxe(e){for(const t of e){const n=t.trim();if(!n.startsWith("#")||n.startsWith("#(")||n.startsWith('#"'))continue;const r=h1(n.slice(1));for(const o of r.split(/[\s{}=.,[\]]+/))if(fxe.has(o))return!0}return!1}function L_(e){let t;try{t=JSON.parse(e)}catch{return e}if(!t||typeof t!="object"||!hxe(t))return e;const n=Array.isArray(t.annotations)?t.annotations:[],r=n.map(o=>o?.value).filter(o=>typeof o=="string");return mxe(r)?e:JSON.stringify({...t,annotations:[pxe,...n]})}const gxe=e=>I_(L_(e));function UN(e){const t=e.split("->").at(-1)?.trim()??e;return/^[A-Za-z_][\w-]*$/.test(t)?OF(t):e}function z_({environmentName:e,packageName:t,versionId:n,modelPath:r,queryName:o,tile:a,annotation:i,label:s,subtitle:l,heading:d,borderless:u,givens:m,hostGivens:g,declaredTypes:y,givenNames:x,height:w,tableMaxHeight:S,fixedHeight:b,maxResultSize:$,drill:k,onExplore:R,chrome:O="card",ignoredFilters:P,preamble:D,restricted:A,waitingFor:F,index:L}){const{theme:_}=Hr(),[E,z]=Ule(),I=t2({environmentName:e,packageName:t,modelPath:r,versionId:n,queryName:o,query:a!==void 0?b1(D??"",`${i?`${i}
476
- `:""}run: ${a}`):void 0,givens:hR(Zd(m,y,x),g,x)},{enabled:z&&A!==!0&&F===void 0}),{emit:U}=y1(),N=I.isError?I.error:void 0;C.useEffect(()=>{N!==void 0&&U({type:"report.query_failed",...L!==void 0?{tile:L}:{},category:V0(N)})},[N,U,L]);const q=A===!0||D!==void 0&&I.isError&&Cce(I.error);return p.jsxs(Z0,{cardRef:E,borderless:u,chrome:O,sx:{"& .malloy-render, & .malloy-table":{width:"100%"},"& .publisher-tile-explore":{opacity:0,transition:`opacity ${Zy}`,...Jy,...ile},"&:hover .publisher-tile-explore, & .publisher-tile-explore:focus-visible":{opacity:1}},children:[a!==void 0&&p.jsx(w_,{title:d?.title??s??UN(a),subtitle:d?d.subtitle:l,quiet:O==="none",tooltip:a,action:R&&p.jsx(Br,{title:"Explore from here",children:p.jsx(no,{className:"publisher-tile-explore",size:"small","aria-label":`Explore ${s??UN(a)}`,onClick:R,sx:{mt:-.5,mr:-.5,color:_.tileTitle},children:p.jsx(Fle,{fontSize:"small"})})})}),P&&p.jsx(m0e,{ignored:P}),F!==void 0?p.jsx(Ee,{sx:{p:2},children:p.jsx(wt,{variant:"body2",role:"status",color:"text.secondary",children:F})}):q?p.jsx(Ee,{sx:{p:2},children:p.jsx(wt,{variant:"body2",role:"status",color:"text.secondary",children:Sce})}):p.jsx(GR,{fill:!0,state:I,context:a??o??r,maxHeight:w,tableMaxHeight:S,compactToFit:b,firstPaintHeight:pF,maxResultSize:$,drill:k,transform:D!==void 0?a!==void 0?gxe:I_:a!==void 0?L_:void 0})]})}function k2e(e,{enabled:t=!0}={}){const{apiClients:n}=er();return wo({queryKey:["compiled-document",e.environmentName,e.packageName,e.modelPath,e.source,e.givens??null],queryFn:async()=>{const r=(await n.models.compileModelSource(e.environmentName,e.packageName,e.modelPath,{source:e.source,scope:"append",...e.givens&&Object.keys(e.givens).length>0?{givens:e.givens}:{}})).data;return{document:r.document,result:r}},enabled:t})}rn(p.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}));const F_="(max-width:599.95px)";function yxe(){return tee(F_,{noSsr:!0})}function vxe(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(F_).matches}function $2e({children:e}){const[t]=C.useState(vxe),[n,r]=C.useState(!1);return!t||n?p.jsx(p.Fragment,{children:e}):p.jsxs(Wn,{sx:{alignItems:"flex-start",gap:1.5,py:3},children:[p.jsx(wt,{variant:"h6",children:"Editing works best on a larger screen"}),p.jsx(wt,{variant:"body2",color:"text.secondary",children:"The editor is built for a wider window. You can still try it here."}),p.jsx(Hn,{variant:"outlined",onClick:()=>r(!0),children:"Edit anyway"})]})}function E2e(){const e=Ay();return(t,n)=>{if(!n||!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.button!==1){e(t);return}const r=new URL(t,window.location.href).href;(n.metaKey||n.ctrlKey||n.button===1||n.shiftKey)&&window.open(r,"_blank")}}function __(e,t){return e.flatMap(({filter:n})=>{if(n.kind!=="literal_equality"||n.expression.kind!=="field_reference")return[];const r=bxe(n.value,t);return r===void 0?[]:[{field:n.expression.name,label:r,expression:n.expression}]})}function B_(e,t){switch(e.kind){case"string_literal":return`'${uR(e.string_value)}'`;case"number_literal":return e.string_value!==void 0?/^-?\d+(\.\d+)?$/.test(e.string_value)?e.string_value:void 0:Number.isFinite(e.number_value)?String(e.number_value):void 0;case"boolean_literal":return String(e.boolean_value);case"date_literal":{const n=U_(e.date_value);return n&&`@${n[0]}-${n[1]}-${n[2]}`}case"timestamp_literal":{const n=q_(e.timestamp_value,t);return n&&`@${n[0]}-${n[1]}-${n[2]} ${n[3]}:${n[4]}:${n[5]}${V_(e.timestamp_value)}`}default:return}}function bxe(e,t){switch(e.kind){case"string_literal":return e.string_value;case"null_literal":return"null";case"date_literal":{const n=U_(e.date_value);return n&&VN([...n,"00","00","00"],e.granularity??"day")}case"timestamp_literal":{const n=q_(e.timestamp_value,t);return n&&VN(n,e.granularity??"second")+(e.granularity===void 0?V_(e.timestamp_value):"")}default:return B_(e)}}function U_(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);return t?[t[1],t[2],t[3]]:void 0}function V_(e){const t=/:\d{2}\.(\d+)/.exec(e)?.[1]?.replace(/0+$/,"");return t?`.${t}`:""}function q_(e,t){const n=new Date(e);if(Number.isNaN(n.getTime()))return;let r;try{r=new Intl.DateTimeFormat("en-US",{timeZone:t??"UTC",hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(n)}catch{return}const o=a=>r.find(i=>i.type===a)?.value??"";return[o("year").padStart(4,"0"),o("month"),o("day"),o("hour"),o("minute"),o("second")]}function VN([e,t,n,r,o,a],i){switch(i){case"year":return e;case"quarter":return`${e}-Q${Math.floor((Number(t)-1)/3)+1}`;case"month":return`${e}-${t}`;case"week":case"day":return`${e}-${t}-${n}`;case"hour":return`${e}-${t}-${n} ${r}`;case"minute":return`${e}-${t}-${n} ${r}:${o}`;default:return`${e}-${t}-${n} ${r}:${o}:${a}`}}const xxe="drill_metadata_corrected",J0=e=>e,oh=e=>{try{return e?.()}catch{return}},H_=e=>oh(e.isBasic?.bind(e))===!0&&oh(e.wasDimension?.bind(e))===!0,wxe=e=>[e.isString,e.isNumber,e.isBoolean,e.isTime].some(t=>oh(t?.bind(e))===!0);function ex(e){const t=e.metadataTag?.text("drill_expression","code");return t===void 0||t.trim()===""?void 0:t}function W_(e){const t=[];for(let n=e.parent;n;n=n.parent)t.push(n);return t}function Y_(e){const t=W_(e),n=(t[t.length-1]??e).metadataTag,r=n?.text("source","name");if(!r||!n?.array||n.array("source","parameters")!==void 0||n.has?.(xxe)!==!0)return;const o=[];for(const i of[...t].reverse())if(oh(i.isArray?.bind(i))===!0){if(i.metadataTag?.has?.("drillable")!==!0)return;for(const s of i.metadataTag?.array?.("drill_filters")??[]){const l=s.text("code");if(!l)return;o.push(l)}}const a=n?.text("query_name");return{source:r,filters:o,...a&&!a.startsWith("__")?{queryName:a}:{}}}function av(e){const t=new Set;for(const n of W_(e))for(const r of n.fields??[])H_(r)&&t.add(r);return[...t]}function G_(e){const t=new Set(av(e).filter(n=>oh(n.isTime?.bind(n))===!0).map(n=>oh(n.getEffectiveQueryTimezone?.bind(n))));return t.size>1?null:[...t][0]}function qN(e){return!H_(e)||ex(e)===void 0||Y_(e)===void 0||G_(e)===null?!1:av(e).every(t=>ex(t)!==void 0&&t.drillStableExpression!==void 0&&wxe(t))}function Sxe(e,t){const n=av(e),r=[],o=new Set;for(const a of t){if(a.kind==="drill")continue;const{filter:i}=a;if(i.kind!=="literal_equality")return;const s=JSON.stringify(i.expression),l=n.find(u=>JSON.stringify(u.drillStableExpression)===s),d=l&&ex(l);if(l===void 0||d===void 0)return;r.push({code:d,value:i.value}),o.add(l)}return n.every(a=>o.has(a))&&r.length>0?r:void 0}const Cxe=360;function b$(e){return e?e.getLabel?.()??e.tag?.text("label")??J0(e).metadataTag?.text("label")??e.name:""}function kxe(e,t){const n=e.drillClauses?__(e.drillClauses,e.timezone):[];if(n.length===0)return`${b$(t)}: ${e.label}`;const r=av(J0(t));return n.map(o=>{const a=JSON.stringify(o.expression),i=r.find(s=>JSON.stringify(s.drillStableExpression)===a);return`${i?b$(i):o.field}: ${o.label}`}).join(", ")}function K_({onNavigate:e,onSelf:t,destinationTitle:n,canSelf:r,onRows:o}){const[a,i]=C.useState(null),s=C.useCallback((S,b)=>S.filter($=>$===Ym?t!==void 0&&(r?.(b)??!0):e!==void 0),[e,t,r]),l=C.useCallback((S,b,$)=>{if(b===Ym){t?.(S.given,S.rawValue);return}e?.({path:b,dashboard:b,givens:{[S.given]:S.value}},$)},[e,t]),d=C.useCallback(S=>{if(!o||S.noRows||S.isHeader||!S.field)return;const b=J0(S.field);if(!qN(b))return;const $=Y_(b);if($===void 0)return;const k=S.drillClauses;let R;if(k!==void 0){const P=Sxe(b,k);if(P===void 0)return;R={dimensions:P}}else{const P=ex(b);if(P===void 0||av(b).length!==1||v1(S.value)===void 0||typeof S.value=="number"&&Number.isInteger(S.value)&&!Number.isSafeInteger(S.value))return;R={code:P}}const O=G_(b)??void 0;return{field:S.field.name,rawValue:S.value,label:Qk(S.value),target:$,...R,...S.context===void 0?{}:{context:S.context},...k===void 0?{}:{drillClauses:k},...O===void 0?{}:{timezone:O}}},[o]),u=C.useCallback(S=>{const b=fce(S),$=d(S),k=b?Array.from(new Set(s(b.to,b.given))).sort((P,D)=>+(D===Ym)-+(P===Ym)):[],R=`${b$(S.field)}: ${b?.label??Qk(S.value)}`,O=k.map(P=>({key:`to:${P}`,label:P===Ym?`Filter to ${R}`:`Open ${n?.(P)??OF(P.split("/").pop()??P)} (${R})`,run:()=>{b&&l(b,P,S.event)}}));$&&S.field&&O.push({key:"rows",label:`Show rows (${kxe($,S.field)})`,run:()=>o?.($)}),O.length!==0&&i({items:O,top:S.event?.clientY??0,left:S.event?.clientX??0})},[l,s,o,d,n]),m=C.useCallback(S=>s(MF(S),PF(S)).length>0,[s]),g=C.useCallback(S=>o!==void 0&&qN(J0(S)),[o]),y=C.useMemo(()=>({onClick:u,canDrill:S=>m(S)||g(S)}),[u,m,g]),x=C.useCallback((S,b)=>({canDrill:$=>m($)||b&&g($),onClick:$=>u({...$,...S===void 0?{}:{context:S},...b?{}:{noRows:!0}})}),[u,m,g]),w=C.useCallback(()=>i(null),[]);return{drill:y,bindingFor:x,drillMenu:p.jsx(dc,{open:a!==null,onClose:w,anchorReference:"anchorPosition",anchorPosition:{top:a?.top??0,left:a?.left??0},children:(a?.items??[]).map(S=>p.jsx(ea,{title:S.label,"aria-label":S.label,onClick:()=>{w(),S.run()},sx:{maxWidth:Cxe},children:p.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.label})},S.key))})}}const $xe=e=>{const t=C.useRef({});return C.useEffect(()=>{t.current=e}),t.current};function R2e(){const[e]=Jq(),t=Ay(),n=ds(),r=C.useMemo(()=>Object.fromEntries(e.entries()),[e]),o=C.useRef(new Set),a=C.useRef(null),i=C.useCallback(d=>{const u=a.current,m=new URLSearchParams(u?.key===n.key?u.search:n.search);d(m);const g=m.toString();a.current={key:n.key,search:g},t({search:g,hash:n.hash},{replace:!0})},[t,n]),s=C.useCallback((d,u)=>{const m=new Set([...u,...o.current]);o.current=new Set([...o.current,...Object.keys(d),...u]),i(g=>{for(const y of m)Object.prototype.hasOwnProperty.call(d,y)||g.delete(y);for(const[y,x]of Object.entries(d))g.set(y,x)})},[i]),l=C.useCallback((d,u)=>i(m=>{u===void 0?m.delete(d):m.set(d,u)}),[i]);return{params:r,onGivensChange:s,setParam:l}}const Exe=rn(p.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"}));function Rg(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function Tg(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function Rxe(e){if(e===void 0)return"";switch(e.kind){case"null_cell":return"";case"number_cell":return e.string_value??String(e.number_value);case"boolean_cell":return e.boolean_value?"true":"false";case"date_cell":return e.date_value;case"timestamp_cell":return e.timestamp_value;case"string_cell":return Tg(Rg(e.string_value));case"json_cell":return Tg(Rg(e.json_value));case"sql_native_cell":return Tg(Rg(e.sql_native_value));default:return Tg(Rg(JSON.stringify(e)))}}function Q_(e){const t=e.data;return t?.kind!=="array_cell"?[]:t.array_value.flatMap(n=>n.kind==="record_cell"?[n.record_value]:[])}function Txe(e){const t=e.schema.fields;return`\uFEFF${[t.map(n=>Tg(Rg(n.name))).join(","),...Q_(e).map(n=>t.map((r,o)=>Rxe(n[o])).join(","))].join(`\r
476
+ `:""}run: ${a}`):void 0,givens:hR(Zd(m,y,x),g,x)},{enabled:z&&A!==!0&&F===void 0}),{emit:U}=y1(),N=I.isError?I.error:void 0;C.useEffect(()=>{N!==void 0&&U({type:"report.query_failed",...L!==void 0?{tile:L}:{},category:V0(N)})},[N,U,L]);const q=A===!0||D!==void 0&&I.isError&&Cce(I.error);return p.jsxs(Z0,{cardRef:E,borderless:u,chrome:O,sx:{"& .malloy-render, & .malloy-table":{width:"100%"},"& .publisher-tile-explore":{opacity:0,transition:`opacity ${Zy}`,...Jy,...ile},"&:hover .publisher-tile-explore, & .publisher-tile-explore:focus-visible":{opacity:1}},children:[a!==void 0&&p.jsx(w_,{title:d?.title??s??UN(a),subtitle:d?d.subtitle:l,quiet:O==="none",tooltip:a,action:R&&p.jsx(Br,{title:"Explore from here",children:p.jsx(no,{className:"publisher-tile-explore",size:"small","aria-label":`Explore ${s??UN(a)}`,onClick:R,sx:{mt:-.5,mr:-.5,color:_.tileTitle},children:p.jsx(Fle,{fontSize:"small"})})})}),P&&p.jsx(m0e,{ignored:P}),F!==void 0?p.jsx(Ee,{sx:{p:2},children:p.jsx(wt,{variant:"body2",role:"status",color:"text.secondary",children:F})}):q?p.jsx(Ee,{sx:{p:2},children:p.jsx(wt,{variant:"body2",role:"status",color:"text.secondary",children:Sce})}):p.jsx(GR,{fill:!0,state:I,context:a??o??r,maxHeight:w,tableMaxHeight:S,compactToFit:b,firstPaintHeight:pF,maxResultSize:$,drill:k,transform:D!==void 0?a!==void 0?gxe:I_:a!==void 0?L_:void 0})]})}function $2e(e,{enabled:t=!0}={}){const{apiClients:n}=er();return wo({queryKey:["compiled-document",e.environmentName,e.packageName,e.modelPath,e.source,e.givens??null],queryFn:async()=>{const r=(await n.models.compileModelSource(e.environmentName,e.packageName,e.modelPath,{source:e.source,scope:"append",...e.givens&&Object.keys(e.givens).length>0?{givens:e.givens}:{}})).data;return{document:r.document,result:r}},enabled:t})}rn(p.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}));const F_="(max-width:599.95px)";function yxe(){return tee(F_,{noSsr:!0})}function vxe(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(F_).matches}function E2e({children:e}){const[t]=C.useState(vxe),[n,r]=C.useState(!1);return!t||n?p.jsx(p.Fragment,{children:e}):p.jsxs(Wn,{sx:{alignItems:"flex-start",gap:1.5,py:3},children:[p.jsx(wt,{variant:"h6",children:"Editing works best on a larger screen"}),p.jsx(wt,{variant:"body2",color:"text.secondary",children:"The editor is built for a wider window. You can still try it here."}),p.jsx(Hn,{variant:"outlined",onClick:()=>r(!0),children:"Edit anyway"})]})}function R2e(){const e=Ay();return(t,n)=>{if(!n||!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.button!==1){e(t);return}const r=new URL(t,window.location.href).href;(n.metaKey||n.ctrlKey||n.button===1||n.shiftKey)&&window.open(r,"_blank")}}function __(e,t){return e.flatMap(({filter:n})=>{if(n.kind!=="literal_equality"||n.expression.kind!=="field_reference")return[];const r=bxe(n.value,t);return r===void 0?[]:[{field:n.expression.name,label:r,expression:n.expression}]})}function B_(e,t){switch(e.kind){case"string_literal":return`'${uR(e.string_value)}'`;case"number_literal":return e.string_value!==void 0?/^-?\d+(\.\d+)?$/.test(e.string_value)?e.string_value:void 0:Number.isFinite(e.number_value)?String(e.number_value):void 0;case"boolean_literal":return String(e.boolean_value);case"date_literal":{const n=U_(e.date_value);return n&&`@${n[0]}-${n[1]}-${n[2]}`}case"timestamp_literal":{const n=q_(e.timestamp_value,t);return n&&`@${n[0]}-${n[1]}-${n[2]} ${n[3]}:${n[4]}:${n[5]}${V_(e.timestamp_value)}`}default:return}}function bxe(e,t){switch(e.kind){case"string_literal":return e.string_value;case"null_literal":return"null";case"date_literal":{const n=U_(e.date_value);return n&&VN([...n,"00","00","00"],e.granularity??"day")}case"timestamp_literal":{const n=q_(e.timestamp_value,t);return n&&VN(n,e.granularity??"second")+(e.granularity===void 0?V_(e.timestamp_value):"")}default:return B_(e)}}function U_(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);return t?[t[1],t[2],t[3]]:void 0}function V_(e){const t=/:\d{2}\.(\d+)/.exec(e)?.[1]?.replace(/0+$/,"");return t?`.${t}`:""}function q_(e,t){const n=new Date(e);if(Number.isNaN(n.getTime()))return;let r;try{r=new Intl.DateTimeFormat("en-US",{timeZone:t??"UTC",hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(n)}catch{return}const o=a=>r.find(i=>i.type===a)?.value??"";return[o("year").padStart(4,"0"),o("month"),o("day"),o("hour"),o("minute"),o("second")]}function VN([e,t,n,r,o,a],i){switch(i){case"year":return e;case"quarter":return`${e}-Q${Math.floor((Number(t)-1)/3)+1}`;case"month":return`${e}-${t}`;case"week":case"day":return`${e}-${t}-${n}`;case"hour":return`${e}-${t}-${n} ${r}`;case"minute":return`${e}-${t}-${n} ${r}:${o}`;default:return`${e}-${t}-${n} ${r}:${o}:${a}`}}const xxe="drill_metadata_corrected",J0=e=>e,oh=e=>{try{return e?.()}catch{return}},H_=e=>oh(e.isBasic?.bind(e))===!0&&oh(e.wasDimension?.bind(e))===!0,wxe=e=>[e.isString,e.isNumber,e.isBoolean,e.isTime].some(t=>oh(t?.bind(e))===!0);function ex(e){const t=e.metadataTag?.text("drill_expression","code");return t===void 0||t.trim()===""?void 0:t}function W_(e){const t=[];for(let n=e.parent;n;n=n.parent)t.push(n);return t}function Y_(e){const t=W_(e),n=(t[t.length-1]??e).metadataTag,r=n?.text("source","name");if(!r||!n?.array||n.array("source","parameters")!==void 0||n.has?.(xxe)!==!0)return;const o=[];for(const i of[...t].reverse())if(oh(i.isArray?.bind(i))===!0){if(i.metadataTag?.has?.("drillable")!==!0)return;for(const s of i.metadataTag?.array?.("drill_filters")??[]){const l=s.text("code");if(!l)return;o.push(l)}}const a=n?.text("query_name");return{source:r,filters:o,...a&&!a.startsWith("__")?{queryName:a}:{}}}function av(e){const t=new Set;for(const n of W_(e))for(const r of n.fields??[])H_(r)&&t.add(r);return[...t]}function G_(e){const t=new Set(av(e).filter(n=>oh(n.isTime?.bind(n))===!0).map(n=>oh(n.getEffectiveQueryTimezone?.bind(n))));return t.size>1?null:[...t][0]}function qN(e){return!H_(e)||ex(e)===void 0||Y_(e)===void 0||G_(e)===null?!1:av(e).every(t=>ex(t)!==void 0&&t.drillStableExpression!==void 0&&wxe(t))}function Sxe(e,t){const n=av(e),r=[],o=new Set;for(const a of t){if(a.kind==="drill")continue;const{filter:i}=a;if(i.kind!=="literal_equality")return;const s=JSON.stringify(i.expression),l=n.find(u=>JSON.stringify(u.drillStableExpression)===s),d=l&&ex(l);if(l===void 0||d===void 0)return;r.push({code:d,value:i.value}),o.add(l)}return n.every(a=>o.has(a))&&r.length>0?r:void 0}const Cxe=360;function b$(e){return e?e.getLabel?.()??e.tag?.text("label")??J0(e).metadataTag?.text("label")??e.name:""}function kxe(e,t){const n=e.drillClauses?__(e.drillClauses,e.timezone):[];if(n.length===0)return`${b$(t)}: ${e.label}`;const r=av(J0(t));return n.map(o=>{const a=JSON.stringify(o.expression),i=r.find(s=>JSON.stringify(s.drillStableExpression)===a);return`${i?b$(i):o.field}: ${o.label}`}).join(", ")}function K_({onNavigate:e,onSelf:t,destinationTitle:n,canSelf:r,onRows:o}){const[a,i]=C.useState(null),s=C.useCallback((S,b)=>S.filter($=>$===Ym?t!==void 0&&(r?.(b)??!0):e!==void 0),[e,t,r]),l=C.useCallback((S,b,$)=>{if(b===Ym){t?.(S.given,S.rawValue);return}e?.({path:b,dashboard:b,givens:{[S.given]:S.value}},$)},[e,t]),d=C.useCallback(S=>{if(!o||S.noRows||S.isHeader||!S.field)return;const b=J0(S.field);if(!qN(b))return;const $=Y_(b);if($===void 0)return;const k=S.drillClauses;let R;if(k!==void 0){const P=Sxe(b,k);if(P===void 0)return;R={dimensions:P}}else{const P=ex(b);if(P===void 0||av(b).length!==1||v1(S.value)===void 0||typeof S.value=="number"&&Number.isInteger(S.value)&&!Number.isSafeInteger(S.value))return;R={code:P}}const O=G_(b)??void 0;return{field:S.field.name,rawValue:S.value,label:Qk(S.value),target:$,...R,...S.context===void 0?{}:{context:S.context},...k===void 0?{}:{drillClauses:k},...O===void 0?{}:{timezone:O}}},[o]),u=C.useCallback(S=>{const b=fce(S),$=d(S),k=b?Array.from(new Set(s(b.to,b.given))).sort((P,D)=>+(D===Ym)-+(P===Ym)):[],R=`${b$(S.field)}: ${b?.label??Qk(S.value)}`,O=k.map(P=>({key:`to:${P}`,label:P===Ym?`Filter to ${R}`:`Open ${n?.(P)??OF(P.split("/").pop()??P)} (${R})`,run:()=>{b&&l(b,P,S.event)}}));$&&S.field&&O.push({key:"rows",label:`Show rows (${kxe($,S.field)})`,run:()=>o?.($)}),O.length!==0&&i({items:O,top:S.event?.clientY??0,left:S.event?.clientX??0})},[l,s,o,d,n]),m=C.useCallback(S=>s(MF(S),PF(S)).length>0,[s]),g=C.useCallback(S=>o!==void 0&&qN(J0(S)),[o]),y=C.useMemo(()=>({onClick:u,canDrill:S=>m(S)||g(S)}),[u,m,g]),x=C.useCallback((S,b)=>({canDrill:$=>m($)||b&&g($),onClick:$=>u({...$,...S===void 0?{}:{context:S},...b?{}:{noRows:!0}})}),[u,m,g]),w=C.useCallback(()=>i(null),[]);return{drill:y,bindingFor:x,drillMenu:p.jsx(dc,{open:a!==null,onClose:w,anchorReference:"anchorPosition",anchorPosition:{top:a?.top??0,left:a?.left??0},children:(a?.items??[]).map(S=>p.jsx(ea,{title:S.label,"aria-label":S.label,onClick:()=>{w(),S.run()},sx:{maxWidth:Cxe},children:p.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S.label})},S.key))})}}const $xe=e=>{const t=C.useRef({});return C.useEffect(()=>{t.current=e}),t.current};function T2e(){const[e]=Jq(),t=Ay(),n=ds(),r=C.useMemo(()=>Object.fromEntries(e.entries()),[e]),o=C.useRef(new Set),a=C.useRef(null),i=C.useCallback(d=>{const u=a.current,m=new URLSearchParams(u?.key===n.key?u.search:n.search);d(m);const g=m.toString();a.current={key:n.key,search:g},t({search:g,hash:n.hash},{replace:!0})},[t,n]),s=C.useCallback((d,u)=>{const m=new Set([...u,...o.current]);o.current=new Set([...o.current,...Object.keys(d),...u]),i(g=>{for(const y of m)Object.prototype.hasOwnProperty.call(d,y)||g.delete(y);for(const[y,x]of Object.entries(d))g.set(y,x)})},[i]),l=C.useCallback((d,u)=>i(m=>{u===void 0?m.delete(d):m.set(d,u)}),[i]);return{params:r,onGivensChange:s,setParam:l}}const Exe=rn(p.jsx("path",{d:"M5 20h14v-2H5zM19 9h-4V3H9v6H5l7 7z"}));function Rg(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function Tg(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function Rxe(e){if(e===void 0)return"";switch(e.kind){case"null_cell":return"";case"number_cell":return e.string_value??String(e.number_value);case"boolean_cell":return e.boolean_value?"true":"false";case"date_cell":return e.date_value;case"timestamp_cell":return e.timestamp_value;case"string_cell":return Tg(Rg(e.string_value));case"json_cell":return Tg(Rg(e.json_value));case"sql_native_cell":return Tg(Rg(e.sql_native_value));default:return Tg(Rg(JSON.stringify(e)))}}function Q_(e){const t=e.data;return t?.kind!=="array_cell"?[]:t.array_value.flatMap(n=>n.kind==="record_cell"?[n.record_value]:[])}function Txe(e){const t=e.schema.fields;return`\uFEFF${[t.map(n=>Tg(Rg(n.name))).join(","),...Q_(e).map(n=>t.map((r,o)=>Rxe(n[o])).join(","))].join(`\r
477
477
  `)}\r
478
- `}function Mxe(e,t){return[e,"rows",...t].join("_").replace(/[^A-Za-z0-9._-]+/g,"_").replace(/_+/g,"_").replace(/^[_.]+|[_.]+$/g,"").slice(0,120)||"rows"}function Oxe(e,t,n){return n==="server_default"&&t!==void 0&&e>=t?t:void 0}const HN="Download the rows behind this value as CSV, up to the server's row limit",Pxe=4e4;function jxe(e,t){const n=URL.createObjectURL(new Blob([e],{type:"text/csv;charset=utf-8"})),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),Pxe)}function Axe(e){const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error&&e.message!==""?e.message:"The request failed."}function Dxe({query:e,preamble:t,environmentName:n,packageName:r,modelPath:o,versionId:a,givens:i,fileName:s}){const{apiClients:l}=er(),[d,u]=C.useState(!1),[m,g]=C.useState(HN),[y,x]=C.useState(void 0),w=C.useRef(void 0);C.useEffect(()=>()=>w.current?.abort(),[]);const S=async()=>{w.current?.abort();const b=new AbortController;w.current=b,u(!0),x(void 0);try{const $=await l.models.executeQueryModel(n,r,o,{query:t===void 0?e:b1(t,e),givens:i,versionId:a},void 0,void 0,{signal:b.signal});if(b.signal.aborted)return;const k=$.data,R=JSON.parse(k.result??"{}"),O=Oxe(Q_(R).length,k.queryRowLimit,k.queryRowLimitSource);g(O===void 0?HN:`First ${O} rows: the server's row limit, so there may be more`),jxe(Txe(R),O===void 0?`${s}.csv`:`${s}_first_${O}_rows_server_limit.csv`)}catch($){if(b.signal.aborted)return;x(`Download failed: ${Axe($)}`)}finally{w.current===b&&(w.current=void 0,u(!1))}};return p.jsxs(Ee,{sx:{display:"flex",alignItems:"center",gap:1},children:[y&&p.jsx(wt,{role:"alert",variant:"caption",color:"error",sx:{maxWidth:320},children:y}),p.jsx(Br,{title:m,children:p.jsx("span",{children:p.jsx(Hn,{size:"small",startIcon:p.jsx(Exe,{fontSize:"small"}),onClick:()=>void S(),disabled:d,children:"Download CSV"})})})]})}const X_=200;function Nxe(e){const{target:t}=e;if(t!==void 0&&!(e.dimensions===void 0&&e.code===void 0))return{...e,target:t}}function WN(e,t=X_){const n=Lxe(e);if(n===void 0)return;const r=[...e.target.filters,...n].join(", "),o=e.timezone?`timezone: '${uR(e.timezone)}'; `:"",a=t===null?"":`; limit: ${t}`,i=Ixe(e.target.source);if(i!==void 0)return`run: ${i} -> { ${o}where: ${r}; select: *${a} }`}function Ixe(e){return Wy(e)?e:e.includes("`")?void 0:`\`${e}\``}function TC(e){return/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(e)?e:`(${e})`}function Lxe(e){if(e.dimensions){const n=[];for(const{code:r,value:o}of e.dimensions){if(o.kind==="null_literal"){n.push(`${TC(r)} is null`);continue}const a=B_(o,e.timezone);if(a===void 0)return;n.push(`${TC(r)} = ${a}`)}return n}const t=Wle(e.rawValue);return e.code!==void 0&&t?[`${TC(e.code)} = ${t}`]:void 0}const zxe="This value cannot be written as a filter, so its rows cannot be fetched.";function YN(e){const t=e.drillClauses?__(e.drillClauses,e.timezone):[];return t.length>0?t:[{field:e.field,label:e.label}]}function Fxe({request:e,environmentName:t,packageName:n,versionId:r,modelPath:o,preamble:a,givens:i,onClose:s,onDone:l,actions:d}){const{theme:u}=Hr(),m=e?WN(e):void 0,g=e?WN(e,null):void 0,y=e&&g!==void 0?{query:g,...a===void 0?{}:{preamble:a},environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r},givens:i,fileName:Mxe(e.target.source,YN(e).map(x=>x.label))}:void 0;return p.jsxs(Fx,{open:e!==void 0,onClose:s,maxWidth:"lg",fullWidth:!0,children:[p.jsxs(Bx,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",pb:.5},children:[p.jsxs(Ee,{children:[e?p.jsxs(p.Fragment,{children:["Rows where"," ",YN(e).map((x,w)=>p.jsxs(C.Fragment,{children:[w>0&&" and ",p.jsx(Ee,{component:"code",sx:{fontSize:"0.9em"},children:x.field})," ","is ",x.label]},w))]}):"Rows",p.jsx(wt,{component:"div",variant:"caption",sx:{color:u.tileTitle,mt:.25},children:e?`The first ${X_} rows of ${e.target.source} behind this value, with the tile's own filters and the controls applied.`:""})]}),p.jsxs(Ee,{sx:{display:"flex",alignItems:"center",gap:1,ml:1},children:[y&&(d?d(y):p.jsx(Dxe,{...y})),p.jsx(no,{onClick:s,"aria-label":"Close",size:"small",sx:{color:"text.secondary"},children:p.jsx(bh,{fontSize:"small"})})]})]}),p.jsxs(_x,{dividers:!0,sx:{p:0,minHeight:240},children:[m===void 0&&e&&p.jsx(wt,{variant:"body2",sx:{p:2},children:zxe}),m!==void 0&&p.jsx(_xe,{query:a===void 0?m:b1(a,m),environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:o,givens:i,...l?{onDone:l}:{}})]}),p.jsxs(cz,{sx:{px:3,py:1.5},children:[m!==void 0&&p.jsx(wt,{variant:"caption",sx:{mr:"auto",color:u.tileTitle,fontFamily:u.ui.font.mono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:m,children:m}),p.jsx(Hn,{onClick:s,children:"Close"})]})]})}function _xe({query:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:a,onDone:i}){const s=t2({environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r},query:e,givens:a}),{isSuccess:l,isError:d}=s,u=C.useRef(void 0);return C.useEffect(()=>{u.current=Od()},[e]),C.useEffect(()=>{u.current===void 0||!l&&!d||(i?.(l,Od()-u.current),u.current=void 0)},[l,d,i]),p.jsx(Ee,{sx:{p:1},children:p.jsx(GR,{state:s,context:e})})}function Bxe({manifest:e,environmentName:t,packageName:n,versionId:r,documentName:o,givens:a,onGivensChange:i,onNavigate:s,height:l,maxResultSize:d,controlsLayout:u="bar",preamble:m,runModelPath:g,hiddenGivens:y,literalReads:x,onLinkNavigate:w,actions:S,rowsActions:b}){const $=C.useMemo(()=>w?{environmentName:t,packageName:n,sourcePath:e.path??o,onNavigate:w}:void 0,[t,n,e.path,o,w]),k=C.useMemo(()=>(e.givens??[]).filter(ie=>!(m!==void 0&&ie.secure===!0)&&!(ie.name!==void 0&&y?.includes(ie.name))),[e,y,m]),R=C.useMemo(()=>a===void 0?void 0:Object.fromEntries(Object.entries(a).filter(([,ie])=>typeof ie=="string")),[a]),O=gR({specs:k,loaded:!0,startingValues:e.startingGivens,params:R,onGivensChange:i,documentKey:`${t}/${n}/${r??""}/${o}`,autorun:e.autorun!==!1,environmentName:t,packageName:n,modelPath:g??e.path,versionId:r,documentName:o,...m!==void 0?{preamble:m}:{},...a?{hostGivens:a}:{}}),{applied:P,declaredTypes:D,canSelf:A,onSelf:F}=O,L=y1(),_=C.useMemo(()=>{const ie=new Set((e.tiles??[]).flatMap(fe=>fe.givenNames??[]));return Object.fromEntries(Object.entries(a??{}).filter(([fe])=>ie.has(fe)&&!D.has(fe)))},[e,a,D]),[E,z]=C.useState(void 0),I=C.useCallback(ie=>{const fe=Nxe(ie);fe!==void 0&&z(fe)},[]),U=C.useMemo(()=>hR(Zd(P,D),_),[P,D,_]),{reports:N}=b_(t,n,r,s!==void 0),q=C.useCallback(ie=>{const fe=S0e(ie,N);if(fe.kind!=="path")return;const he=fe.report.path;return N.find(me=>me.path===he)?.title||void 0},[N]),{bindingFor:Y,drillMenu:oe}=K_({onNavigate:s,onSelf:F,canSelf:A,onRows:I,destinationTitle:q}),Q=C.useCallback((ie,fe)=>Y(ie,fe!==!0),[Y]),{columns:ae,layout:de,tileMaxHeight:X,tableMaxHeight:se}=Lle(e.layout,e.dashboardColumns),J=C.useMemo(()=>Bbe(k,P,a),[k,P,a]);if(e.error)return p.jsx(y$,{layout:de,header:p.jsx(GN,{manifest:e,links:$,actions:S}),children:p.jsx(xo,{severity:"error",children:e.error})});const Z=g??e.path,G=e.tiles??[],ue=iF(G);return p.jsxs(y$,{layout:de,header:p.jsx(GN,{manifest:e,links:$,actions:S}),controls:k.length>0?p.jsx(S_,{children:p.jsx(A1,{...O.panel,layout:u})}):void 0,children:[J.length>0&&p.jsx(xo,{severity:"info",children:Vbe(J)}),Z===void 0?p.jsx(xo,{severity:"error",children:"This dashboard has no model path, so there is nothing to run."}):G.length>0?p.jsx(ele,{tiles:G,columns:ae,minTilePx:rF,rowGapPx:vl,keyOf:(ie,fe)=>`${fe}:${ie.kind==="text"?`text:${ie.name}`:ie.query}`,renderTile:(ie,fe)=>ie.kind==="text"||ie.query===void 0?p.jsx(Ee,{sx:ie.rowspan!==void 0||ue?{minHeight:0,overflow:"auto"}:void 0,children:p.jsx(Uxe,{markdown:ie.markdown??"",links:$})}):p.jsx(z_,{index:fe,environmentName:t,packageName:n,versionId:r,modelPath:Z,tile:ie.query,label:ie.label,subtitle:ie.subtitle,borderless:ie.borderless,givens:P,hostGivens:_,declaredTypes:D,givenNames:ie.givenNames,height:ie.rowspan!==void 0||ue?nF(ie.rowspan??aF.query):de==="grid"?l??X:X,tableMaxHeight:se,fixedHeight:ie.rowspan!==void 0||ue,maxResultSize:d,drill:Q(ie.query,ie.restricted),ignoredFilters:p0e(ie.givenNames&&(ie.query&&x?.[ie.query]?[...ie.givenNames,...x[ie.query]]:ie.givenNames),k),...m!==void 0?{preamble:m,restricted:ie.restricted}:{},...(()=>{const he=Ube(J,ie.givenNames);return he.length>0?{waitingFor:qbe(he)}:{}})()})}):p.jsx(xo,{severity:"warning",children:"This dashboard names neither a query nor any tiles."}),oe,Z!==void 0&&p.jsx(Fxe,{request:E,environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:Z,...m===void 0?{}:{preamble:m},givens:U,...b===void 0?{}:{actions:b},onClose:()=>z(void 0),onDone:(ie,fe)=>{E&&L.emit({type:"report.rows_shown",source:E.target.source,view:E.target.queryName??"",field:E.field,ok:ie,durationMs:fe})}})]})}function Uxe({markdown:e,links:t}){return p.jsx(QR,{children:p.jsx(xy,{variant:"document",links:t,children:e})})}function GN({manifest:e,links:t,actions:n}){return p.jsx(N0e,{title:e.title??e.name,actions:n,description:e.description?p.jsx(QR,{children:p.jsx(xy,{variant:"document",links:t,children:e.description})}):void 0})}const Z_=rn(p.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),Vxe="publisher:resize";function qxe(e){return typeof e=="object"&&e!==null&&e.type===Vxe&&typeof e.height=="number"}const Hxe="publisher:color-scheme",Wxe="publisher:color-scheme-request",Yxe="publisher:color-scheme-applied",Gxe=e=>e==="light"||e==="dark";function Kxe(e){return typeof e=="object"&&e!==null&&e.type===Wxe}function Qxe(e){return typeof e=="object"&&e!==null&&e.type===Yxe&&Gxe(e.mode)}function J_(e){return e.replace(/\/api\/v0\/?$/,"")}function Xxe({server:e,environmentName:t,packageName:n,path:r,versionId:o}){const a=r.startsWith("public/")?r.slice(7):r,i=`${J_(e)}/environments/${encodeURIComponent(t)}/packages/${encodeURIComponent(n)}/`+a;return o===void 0?i:`${i}${i.includes("?")?"&":"?"}versionId=${encodeURIComponent(o)}`}function Zxe(e){try{const{environmentName:t,packageName:n,modelPath:r,versionId:o}=ko(e);return!t||!n||!r?null:{environmentName:t,packageName:n,dataAppPath:r,versionId:o}}catch{return null}}function T2e({resourceUri:e}){const{server:t,apiClients:n}=er(),r=Zxe(e),o=r?.environmentName??"",a=r?.packageName??"",i=r?.dataAppPath??"",s=r?.versionId,l=C.useMemo(()=>Xxe({server:t,environmentName:o,packageName:a,path:i,...s!==void 0?{versionId:s}:{}}),[t,o,a,i,s]),d=wo({queryKey:["data-apps",o,a,s],queryFn:()=>n.dataApps.listDataApps(o,a,s),enabled:!!r}).data?.data?.find(O=>O.path===i),u=d?.title??i,m=d?.fit==="viewport",g=C.useRef(null),[y,x]=C.useState(120),w=El().palette.mode==="dark"?"dark":"light",S=C.useRef(w);S.current=w;const[b,$]=C.useState(null),k=C.useMemo(()=>{try{return new URL(l,window.location.href).origin}catch{return null}},[l]),R=C.useCallback(()=>{const O=g.current?.contentWindow;!O||!k||O.postMessage({type:Hxe,mode:S.current},k)},[k]);return C.useEffect(R,[w,R]),C.useEffect(()=>{function O(P){P.source===g.current?.contentWindow&&(k&&P.origin!==k||(Kxe(P.data)?R():Qxe(P.data)&&$(P.data.mode)))}return window.addEventListener("message",O),()=>window.removeEventListener("message",O)},[k,R]),C.useEffect(()=>{if(m)return;function O(P){qxe(P.data)&&P.source===g.current?.contentWindow&&P.data.height>0&&x(Math.ceil(P.data.height))}return window.addEventListener("message",O),()=>window.removeEventListener("message",O)},[m]),r?p.jsxs(Ee,{sx:{p:3,...m?{height:"100%",display:"flex",flexDirection:"column"}:{maxWidth:1600,mx:"auto"}},children:[p.jsxs(Wn,{direction:"row",alignItems:"baseline",spacing:1,sx:{mb:1,flexShrink:0},children:[p.jsx(wt,{variant:"h6",sx:{fontWeight:"fontWeightMedium",letterSpacing:"-0.025em"},children:u}),p.jsx(wt,{variant:"caption",color:"text.secondary",sx:{fontFamily:Fo},children:i}),p.jsx(Ee,{sx:{flex:1}}),p.jsx(Br,{title:"Open standalone in new tab",children:p.jsx(no,{size:"small",href:l,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",sx:{color:"text.secondary"},children:p.jsx(Z_,{fontSize:"small"})})})]}),p.jsx(Ee,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,overflow:"hidden",backgroundColor:"background.paper",...m?{flex:1,minHeight:0}:{}},children:p.jsx("iframe",{ref:g,src:l,onLoad:()=>{$(null),R()},title:u,sandbox:"allow-scripts allow-same-origin allow-forms allow-downloads allow-popups",allow:"clipboard-write; fullscreen",style:{display:"block",width:"100%",height:m?"100%":y,border:0,...b?{colorScheme:b}:{}}})})]}):p.jsxs(Ee,{sx:{p:3,maxWidth:1600,mx:"auto"},children:[p.jsx(wt,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Can't open data app"}),p.jsxs(wt,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["This data app link is missing an environment, package, or path:",p.jsx(Ee,{component:"span",sx:{fontFamily:Fo,ml:1},children:e})]})]})}function Ds({title:e,count:t,description:n,action:r,children:o}){const a=C.useId();return p.jsxs(Ee,{component:"section","aria-labelledby":a,sx:{mb:4},children:[p.jsxs(Wn,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:n?0:1,minHeight:40},children:[p.jsxs(Wn,{direction:"row",alignItems:"baseline",spacing:1,children:[p.jsx(wt,{id:a,variant:"h6",sx:{fontWeight:600,letterSpacing:"-0.025em",lineHeight:1.2},children:e}),t!==void 0&&p.jsxs(wt,{variant:"caption",color:"text.secondary",children:["(",t,")"]})]}),r]}),n&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:n}),p.jsx(Ee,{children:o})]})}function Jxe({resourceUri:e}){const{environmentName:t}=ko(e),{apiClients:n}=er(),[r,o]=C.useState(!1),a=90,{data:i,isSuccess:s,isError:l,error:d}=wo({queryKey:["about",t],queryFn:()=>n.environments.getEnvironment(t,!1)}),u=i?.data?.readme||"",m=u.split(/\s+/),g=m.length>a,y=m.slice(0,a).join(" ");return p.jsxs(p.Fragment,{children:[!s&&!l&&p.jsx(Go,{text:"Fetching About..."}),s&&u&&p.jsxs(Ds,{title:"Readme",children:[p.jsx(xy,{variant:"caption",children:r||!g?u:y}),g&&p.jsx(Ee,{sx:{mt:1},children:p.jsx(Xy,{label:r?"Read less":"Read more",onClick:()=>o(!r)})})]}),l&&p.jsx(Xa,{error:d,context:`${t} > About`})]})}function e1e(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:a}=e,i=vR();C.useEffect(()=>{if(!o)return;function S(b){b.defaultPrevented||b.key==="Escape"&&r?.(b,"escapeKeyDown")}return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[o,r]);const s=Yt((S,b)=>{r?.(S,b)}),l=Yt(S=>{!r||S==null||i.start(S,()=>{s(null,"timeout")})});C.useEffect(()=>(o&&l(t),i.clear),[o,t,l,i]);const d=S=>{r?.(S,"clickaway")},u=i.clear,m=C.useCallback(()=>{t!=null&&l(a??t*.5)},[t,a,l]),g=S=>b=>{const $=S.onBlur;$?.(b),m()},y=S=>b=>{const $=S.onFocus;$?.(b),u()},x=S=>b=>{const $=S.onMouseEnter;$?.(b),u()},w=S=>b=>{const $=S.onMouseLeave;$?.(b),m()};return C.useEffect(()=>{if(!n&&o)return window.addEventListener("focus",m),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",m),window.removeEventListener("blur",u)}},[n,o,m,u]),{getRootProps:(S={})=>{const b={...q0(e),...q0(S)};return{role:"presentation",...S,...b,onBlur:g(b),onFocus:y(b),onMouseEnter:x(b),onMouseLeave:w(b)}},onClickAway:d}}function KN(e){return e.substring(2).toLowerCase()}function t1e(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function n1e(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:a="onTouchEnd"}=e,i=C.useRef(!1),s=C.useRef(null),l=C.useRef(!1),d=C.useRef(!1);C.useEffect(()=>(setTimeout(()=>{l.current=!0},0),()=>{l.current=!1}),[]);const u=vr(xh(t),s),m=Yt(x=>{const w=d.current;d.current=!1;const S=Wo(s.current);if(!l.current||!s.current||"clientX"in x&&t1e(x,S))return;if(i.current){i.current=!1;return}let b;x.composedPath?b=x.composedPath().includes(s.current):b=!S.documentElement.contains(x.target)||s.current.contains(x.target),!b&&(n||!w)&&o(x)}),g=x=>w=>{d.current=!0;const S=t.props[x];S&&S(w)},y={ref:u};return a!==!1&&(y[a]=g(a)),C.useEffect(()=>{if(a!==!1){const x=KN(a),w=Wo(s.current),S=()=>{i.current=!0};return w.addEventListener(x,m),w.addEventListener("touchmove",S),()=>{w.removeEventListener(x,m),w.removeEventListener("touchmove",S)}}},[m,a]),r!==!1&&(y[r]=g(r)),C.useEffect(()=>{if(r!==!1){const x=KN(r),w=Wo(s.current);return w.addEventListener(x,m),()=>{w.removeEventListener(x,m)}}},[m,r]),C.cloneElement(t,y)}function r1e(e){return kn("MuiSnackbarContent",e)}vn("MuiSnackbarContent",["root","message","action"]);const o1e=e=>{const{classes:t}=e;return Sn({root:["root"],action:["action"],message:["message"]},r1e,t)},a1e=ot(ef,{name:"MuiSnackbarContent",slot:"Root"})(rr(({theme:e})=>{const t=e.palette.mode==="light"?.8:.98;return{...e.typography.body2,color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(Fk(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:Fk(e.palette.background.default,t),display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}}})),i1e=ot("div",{name:"MuiSnackbarContent",slot:"Message"})({padding:"8px 0"}),s1e=ot("div",{name:"MuiSnackbarContent",slot:"Action"})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),l1e=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:a,role:i="alert",...s}=n,l=n,d=o1e(l);return p.jsxs(a1e,{role:i,elevation:6,className:Ht(d.root,o),ownerState:l,ref:t,...s,children:[p.jsx(i1e,{className:d.message,ownerState:l,children:a}),r?p.jsx(s1e,{className:d.action,ownerState:l,children:r}):null]})});function c1e(e){return kn("MuiSnackbar",e)}vn("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const u1e=e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${zt(n.vertical)}${zt(n.horizontal)}`]};return Sn(r,c1e,t)},d1e=ot("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${zt(n.anchorOrigin.vertical)}${zt(n.anchorOrigin.horizontal)}`]]}})(rr(({theme:e})=>({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center",variants:[{props:({ownerState:t})=>t.anchorOrigin.vertical==="top",style:{top:8,[e.breakpoints.up("sm")]:{top:24}}},{props:({ownerState:t})=>t.anchorOrigin.vertical!=="top",style:{bottom:8,[e.breakpoints.up("sm")]:{bottom:24}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="left",style:{justifyContent:"flex-start",[e.breakpoints.up("sm")]:{left:24,right:"auto"}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="right",style:{justifyContent:"flex-end",[e.breakpoints.up("sm")]:{right:24,left:"auto"}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="center",style:{[e.breakpoints.up("sm")]:{left:"50%",right:"auto",transform:"translateX(-50%)"}}}]}))),f1e=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiSnackbar"}),r=Qd(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:a,anchorOrigin:{vertical:i,horizontal:s}={vertical:"bottom",horizontal:"left"},autoHideDuration:l=null,children:d,className:u,ClickAwayListenerProps:m,ContentProps:g,disableWindowBlurListener:y=!1,message:x,onBlur:w,onClose:S,onFocus:b,onMouseEnter:$,onMouseLeave:k,open:R,resumeHideDuration:O,slots:P={},slotProps:D={},TransitionComponent:A,transitionDuration:F=o,TransitionProps:{onEnter:L,onExited:_,...E}={},...z}=n,I={...n,anchorOrigin:{vertical:i,horizontal:s},autoHideDuration:l,disableWindowBlurListener:y,TransitionComponent:A,transitionDuration:F},U=u1e(I),{getRootProps:N,onClickAway:q}=e1e({...I}),[Y,oe]=C.useState(!0),Q=me=>{oe(!0),_&&_(me)},ae=(me,le)=>{oe(!1),L&&L(me,le)},de={slots:{transition:A,...P},slotProps:{content:g,clickAwayListener:m,transition:E,...D}},[X,se]=mr("root",{ref:t,className:[U.root,u],elementType:d1e,getSlotProps:N,externalForwardedProps:{...de,...z},ownerState:I}),[J,{ownerState:Z,...G}]=mr("clickAwayListener",{elementType:n1e,externalForwardedProps:de,getSlotProps:me=>({onClickAway:(...le)=>{const ve=le[0];me.onClickAway?.(...le),!ve?.defaultMuiPrevented&&q(...le)}}),ownerState:I}),[ue,ie]=mr("content",{elementType:l1e,shouldForwardComponentProp:!0,externalForwardedProps:de,additionalProps:{message:x,action:a},ownerState:I}),[fe,he]=mr("transition",{elementType:my,externalForwardedProps:de,getSlotProps:me=>({onEnter:(...le)=>{me.onEnter?.(...le),ae(...le)},onExited:(...le)=>{me.onExited?.(...le),Q(...le)}}),additionalProps:{appear:!0,in:R,timeout:F,direction:i==="top"?"down":"up"},ownerState:I});return!R&&Y?null:p.jsx(J,{...G,...P.clickAwayListener&&{ownerState:Z},children:p.jsx(X,{...se,children:p.jsx(fe,{...he,children:d||p.jsx(ue,{...ie})})})})});let x$;function p1e(e){x$=e}function QN(e){if(x$)try{x$(e)}catch{}}function oc(e,t,n){return(async r=>{const o=Date.now();try{const a=await n(r);return QN({type:"console.mutation",resource:e,action:t,ok:!0,durationMs:Date.now()-o}),a}catch(a){throw QN({type:"console.mutation",resource:e,action:t,ok:!1,durationMs:Date.now()-o,reason:a instanceof Error?a.message:"An unknown error occurred"}),a}})}function Ch({mutationFn:e,success:t,invalidates:n,closeDialog:r,resource:o,action:a}){const i=Tl(),[s,l]=C.useState(""),d=hl({mutationFn:oc(o,a,e),onSuccess(){r();for(const u of n)i.invalidateQueries({queryKey:u});l(t)},onError(u){l(u instanceof Error?u.message:"An unknown error occurred")}});return{mutate:d.mutate,isPending:d.isPending,notice:p.jsx(f1e,{open:s!=="",autoHideDuration:6e3,onClose:()=>l(""),message:s})}}const e6="https://docs.malloydata.dev/documentation",XN=`${e6}/user_guides/publishing`,Bb="https://github.com/malloydata/publisher/blob/main/docs",tu={docsHome:`${e6}/`,publishing:`${XN}/publishing`,mcpAgents:`${XN}/mcp_agents`,surfaces:`${Bb}/choosing-a-surface.md`,givens:`${Bb}/givens.md`,materialization:`${Bb}/materialization.md`,connections:`${Bb}/connections.md`};function h1e({resourceUri:e}){const[t,n]=C.useState(!1),{apiClients:r}=er(),{environmentName:o}=ko(e),a=Ch({mutationFn(s){return r.packages.createPackage(o,{name:s.name,description:s.description,location:s.location})},success:"Package created",invalidates:[["packages",o]],closeDialog:()=>n(!1),resource:"package",action:"create"}),i=s=>{s.preventDefault();const l=new FormData(s.currentTarget),d=l.get("name")?.toString(),u=l.get("description")?.toString(),m=l.get("location")?.toString();a.mutate({name:d,description:u,location:m})};return p.jsxs(p.Fragment,{children:[p.jsx(Qy,{label:"Package",onClick:()=>n(!0)}),p.jsx(Oo,{open:t,onClose:()=>n(!1),title:"New package",description:p.jsxs(p.Fragment,{children:["A package is a directory of Malloy models and their data. Give its location as a GitHub, S3 or GCS URL, or an absolute path the server can read; see the"," ",p.jsx(Ee,{component:"a",href:tu.publishing,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary"},children:"package format"}),"."]}),actions:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{disabled:a.isPending,onClick:()=>n(!1),children:"Cancel"}),p.jsx(Hn,{type:"submit",form:"package-form",variant:"contained",loading:a.isPending,children:"Create package"})]}),children:p.jsx("form",{onSubmit:i,id:"package-form",children:p.jsxs(Wn,{sx:{gap:2},children:[p.jsx(ki,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx(ki,{id:"description",name:"description",label:"Description",multiline:!0,rows:3,fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx(ki,{id:"location",name:"location",label:"Location",type:"text",placeholder:"e.g. s3://my-bucket/my-package.zip",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}})]})})}),a.notice]})}const m1e=rn(p.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}));function L1({icon:e,tint:t,label:n,mono:r,description:o,rightLabel:a,trailingAction:i,onClick:s,ariaLabel:l}){const d=!!s;return p.jsxs(Ee,{onClick:s,onKeyDown:d?u=>{s&&(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s(u))}:void 0,role:d?"button":void 0,tabIndex:d?0:void 0,"aria-label":l,sx:u=>({display:"flex",alignItems:"center",gap:1.5,py:1,px:1,mx:-1,cursor:d?"pointer":"default",borderRadius:1.5,transition:"background-color 0.1s","&:hover":d?{backgroundColor:u.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}:void 0,"&:focus-visible":d?{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}:void 0}),children:[p.jsx(Ee,{sx:{width:32,height:32,borderRadius:1,bgcolor:t,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e}),p.jsxs(Ee,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"baseline",gap:1.5},children:[p.jsx(wt,{variant:"body2",sx:{...r?{fontFamily:Fo}:{},flexShrink:0,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),o&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o})]}),a&&p.jsx(wt,{variant:"caption",color:"text.secondary",sx:{flexShrink:0},children:a}),i&&p.jsx(Ee,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:i})]})}const t6=rn(p.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"})),g1e=vn("MuiBox",["root"]),y1e=Z4(),Ta=aE({themeId:vh,defaultTheme:y1e,defaultClassName:g1e.root,generateClassName:z4.generate}),z1=fE({createStyledComponent:ot("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>tr({props:e,name:"MuiStack"})}),ZN=vn("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);function v1e(e){return kn("MuiListItemIcon",e)}const JN=vn("MuiListItemIcon",["root","alignItemsFlexStart"]),b1e=e=>{const{alignItems:t,classes:n}=e;return Sn({root:["root",t==="flex-start"&&"alignItemsFlexStart"]},v1e,n)},x1e=ot("div",{name:"MuiListItemIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.alignItems==="flex-start"&&t.alignItemsFlexStart]}})(rr(({theme:e})=>({minWidth:56,color:(e.vars||e).palette.action.active,flexShrink:0,display:"inline-flex",variants:[{props:{alignItems:"flex-start"},style:{marginTop:8}}]}))),n2=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiListItemIcon"}),{className:r,...o}=n,a=C.useContext(sc),i={...n,alignItems:a.alignItems},s=b1e(i);return p.jsx(x1e,{className:Ht(s.root,r),ownerState:i,ref:t,...o})});function w1e(e){return kn("MuiListItemText",e)}const $p=vn("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]),S1e=e=>{const{classes:t,inset:n,primary:r,secondary:o,dense:a}=e;return Sn({root:["root",n&&"inset",a&&"dense",r&&o&&"multiline"],primary:["primary"],secondary:["secondary"]},w1e,t)},C1e=ot("div",{name:"MuiListItemText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${$p.primary}`]:t.primary},{[`& .${$p.secondary}`]:t.secondary},t.root,n.inset&&t.inset,n.primary&&n.secondary&&t.multiline,n.dense&&t.dense]}})({flex:"1 1 auto",minWidth:0,marginTop:4,marginBottom:4,[`.${QD.root}:where(& .${$p.primary})`]:{display:"block"},[`.${QD.root}:where(& .${$p.secondary})`]:{display:"block"},variants:[{props:({ownerState:e})=>e.primary&&e.secondary,style:{marginTop:6,marginBottom:6}},{props:({ownerState:e})=>e.inset,style:{paddingLeft:56}}]}),r2=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiListItemText"}),{children:r,className:o,disableTypography:a=!1,inset:i=!1,primary:s,primaryTypographyProps:l,secondary:d,secondaryTypographyProps:u,slots:m={},slotProps:g={},...y}=n,{dense:x}=C.useContext(sc);let w=s??r,S=d;const b={...n,disableTypography:a,inset:i,primary:!!w,secondary:!!S,dense:x},$=S1e(b),k={slots:m,slotProps:{primary:l,secondary:u,...g}},[R,O]=mr("root",{className:Ht($.root,o),elementType:C1e,externalForwardedProps:{...k,...y},ownerState:b,ref:t}),[P,D]=mr("primary",{className:$.primary,elementType:Ar,externalForwardedProps:k,ownerState:b}),[A,F]=mr("secondary",{className:$.secondary,elementType:Ar,externalForwardedProps:k,ownerState:b});return w!=null&&w.type!==Ar&&!a&&(w=p.jsx(P,{variant:x?"body2":"body1",component:D?.variant?void 0:"span",...D,children:w})),S!=null&&S.type!==Ar&&!a&&(S=p.jsx(A,{variant:"body2",color:"textSecondary",...F,children:S})),p.jsxs(R,{...O,children:[w,S]})});function k1e(e){return kn("MuiMenuItem",e)}const og=vn("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]),$1e=(e,t)=>{const{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},E1e=e=>{const{disabled:t,dense:n,divider:r,disableGutters:o,selected:a,classes:i}=e,s=Sn({root:["root",n&&"dense",t&&"disabled",!o&&"gutters",r&&"divider",a&&"selected"]},k1e,i);return{...i,...s}},R1e=ot(Jp,{shouldForwardProp:e=>gs(e)||e==="classes",name:"MuiMenuItem",slot:"Root",overridesResolver:$1e})(rr(({theme:e})=>({...e.typography.body1,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap","&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${og.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${og.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${og.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${og.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${og.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${ZN.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${ZN.inset}`]:{marginLeft:52},[`& .${$p.root}`]:{marginTop:0,marginBottom:0},[`& .${$p.inset}`]:{paddingLeft:36},[`& .${JN.root}`]:{minWidth:36},variants:[{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:t})=>t.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"}},{props:({ownerState:t})=>!t.dense,style:{[e.breakpoints.up("sm")]:{minHeight:"auto"}}},{props:({ownerState:t})=>t.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...e.typography.body2,[`& .${JN.root} svg`]:{fontSize:"1.25rem"}}}]}))),qo=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiMenuItem"}),{autoFocus:r=!1,component:o="li",dense:a=!1,divider:i=!1,disableGutters:s=!1,focusVisibleClassName:l,role:d="menuitem",tabIndex:u,className:m,...g}=n,y=C.useContext(sc),x=C.useMemo(()=>({dense:a||y.dense||!1,disableGutters:s}),[y.dense,a,s]),w=C.useRef(null);Yo(()=>{r&&w.current&&w.current.focus()},[r]);const S={...n,dense:x.dense,divider:i,disableGutters:s},b=E1e(n),$=vr(w,t);let k;return n.disabled||(k=u!==void 0?u:-1),p.jsx(sc.Provider,{value:x,children:p.jsx(R1e,{ref:$,role:d,tabIndex:k,component:o,focusVisibleClassName:Ht(b.focusVisible,l),className:Ht(b.root,m),...g,ownerState:S,classes:b})})}),ic={postgres:[{label:"Host",name:"host",type:"text",required:!1},{label:"Port",name:"port",type:"number",required:!1},{label:"Database Name",name:"databaseName",type:"text",required:!1},{label:"User Name",name:"userName",type:"text",required:!1},{label:"Password",name:"password",type:"password",required:!1},{label:"Connection String",name:"connectionString",type:"text",required:!1}],bigquery:[{label:"Project ID",name:"defaultProjectId",type:"text",required:!1},{label:"Billing Project ID",name:"billingProjectId",type:"text",required:!1},{label:"Location",name:"location",type:"text",required:!1},{label:"Service Account Key JSON",name:"serviceAccountKeyJson",type:"text",required:!0},{label:"Maximum Bytes Billed",name:"maximumBytesBilled",type:"text",required:!1},{label:"Query Timeout Milliseconds",name:"queryTimeoutMilliseconds",type:"text",required:!1},{label:"Database Metadata",name:"dbmeta",type:"text",required:!1,selectOptions:[{label:"No",value:"false"},{label:"Yes",value:"true"}]}],snowflake:[{label:"Account",name:"account",type:"text",required:!0},{label:"Username",name:"username",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!1},{label:"Role",name:"role",type:"text",required:!1},{label:"Warehouse",name:"warehouse",type:"text",required:!0},{label:"Database",name:"database",type:"text",required:!1},{label:"Schema",name:"schema",type:"text",required:!1},{label:"Response Timeout Milliseconds",name:"responseTimeoutMilliseconds",type:"text",required:!1},{label:"Private Key",name:"privateKey",type:"password",required:!1},{label:"Private Key Passphrase",name:"privateKeyPass",type:"password",required:!1}],trino:[{label:"Server",name:"server",type:"text",required:!0},{label:"Port",name:"port",type:"number",required:!1},{label:"Catalog",name:"catalog",type:"text",required:!1},{label:"Schema",name:"schema",type:"text",required:!1},{label:"User",name:"user",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!1},{label:"Peaka Key",name:"peakaKey",type:"password",required:!1}],databricks:[{label:"Host",name:"host",type:"text",required:!0},{label:"HTTP Path",name:"path",type:"text",required:!0},{label:"Access Token",name:"token",type:"password",required:!1},{label:"OAuth Client ID",name:"oauthClientId",type:"text",required:!1},{label:"OAuth Client Secret",name:"oauthClientSecret",type:"password",required:!1},{label:"Default Catalog",name:"defaultCatalog",type:"text",required:!1},{label:"Default Schema",name:"defaultSchema",type:"text",required:!1}],mysql:[{label:"Host",name:"host",type:"text",required:!0},{label:"Port",name:"port",type:"number",required:!0},{label:"User",name:"user",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!0},{label:"Database",name:"database",type:"text",required:!0}],sqlserver:[{label:"Server",name:"server",type:"text",required:!0},{label:"Port",name:"port",type:"number",required:!1},{label:"Database",name:"database",type:"text",required:!0},{label:"User",name:"user",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!0},{label:"Encrypt",name:"encrypt",type:"text",required:!1,selectOptions:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},{label:"Trust server certificate",name:"trustServerCertificate",type:"text",required:!1,selectOptions:[{label:"No",value:"false"},{label:"Yes",value:"true"}]},{label:"Host name in certificate",name:"hostNameInCertificate",type:"text",required:!1},{label:"Instance name",name:"instanceName",type:"text",required:!1}],duckdb:[],motherduck:[{label:"Access Token",name:"accessToken",type:"text",required:!0},{label:"Database",name:"database",type:"text",required:!1}],ducklake:[],publisher:[]},Mg={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",trino:"trinoConnection",databricks:"databricksConnection",mysql:"mysqlConnection",sqlserver:"sqlserverConnection",duckdb:"duckdbConnection",motherduck:"motherduckConnection",ducklake:"ducklakeConnection",publisher:"publisherConnection"},T1e={bigquery:{dbmeta:"boolean"},sqlserver:{port:"integer",encrypt:"boolean",trustServerCertificate:"boolean"}},M1e={sqlserver:["hostNameInCertificate","instanceName"]};function n6(e,t){const n=T1e[e],r=M1e[e];if(!n&&!r)return t;const o={...t};for(const a of r??[])o[a]===""&&delete o[a];for(const[a,i]of Object.entries(n??{})){const s=t[a];if(s!==void 0){if(s===""){delete o[a];continue}if(i==="integer"){const l=Number(s);Number.isInteger(l)&&(o[a]=l)}else(s==="true"||s==="false")&&(o[a]=s==="true")}}return o}const r6=Object.values(dA).filter(e=>e!==dA.Publisher),w$={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",gcs:"gcsConnection",s3:"s3Connection",azure:"azureConnection"},Sy=[{label:"Credential Provider",name:"provider",type:"text",required:!1,selectOptions:[{label:"Access key pair",value:"config"},{label:"Host credential chain",value:"credential_chain"}]},{label:"Access Key ID",name:"accessKeyId",type:"text",required:!1,visibleWhen:{field:"provider",value:"config"}},{label:"Secret Access Key",name:"secretAccessKey",type:"password",required:!1,visibleWhen:{field:"provider",value:"config"}},{label:"Credential Chain",name:"chain",type:"text",required:!1,visibleWhen:{field:"provider",value:"credential_chain"}},{label:"Region",name:"region",type:"text",required:!1},{label:"Endpoint",name:"endpoint",type:"text",required:!1},{label:"Session Token",name:"sessionToken",type:"password",required:!1,visibleWhen:{field:"provider",value:"config"}}],Cy=[{label:"Key ID",name:"keyId",type:"text",required:!0},{label:"Secret",name:"secret",type:"password",required:!0}],O1e=[{label:"Auth Type",name:"authType",type:"text",required:!0,selectOptions:[{label:"SAS Token",value:"sas_token"},{label:"Service Principal (SPN)",value:"service_principal"}]},{label:"SAS URL (e.g. https://account.blob.core.windows.net/container/file.parquet?sp=r&st=...)",name:"sasUrl",type:"text",required:!1,visibleWhen:{field:"authType",value:"sas_token"}},{label:"Tenant ID",name:"tenantId",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"Client ID",name:"clientId",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"Client Secret",name:"clientSecret",type:"password",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"Account Name",name:"accountName",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"File URL (e.g. abfss://container/path/file.parquet)",name:"fileUrl",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}}];function tx(e){return e==="postgres"||e==="bigquery"||e==="snowflake"?ic[e]||[]:e==="s3"?Sy:e==="gcs"?Cy:e==="azure"?O1e:[]}function P1e({onSubmit:e,isSubmitting:t}){const[n,r]=C.useState(!1),[o,a]=C.useState("postgres"),[i,s]=C.useState([]),[l,d]=C.useState("postgres"),[u,m]=C.useState("s3"),[g,y]=C.useState("config"),x=()=>{r(!0)},w=()=>{r(!1),s([]),a("postgres"),d("postgres"),m("s3"),y("config")},S=async R=>{R.preventDefault();const O=new FormData(R.currentTarget),P=O.get("name")?.toString(),D=O.get("type")?.toString(),A=ic[D];if(!P)throw new Error("Name is required");if(!D)throw new Error("Type is required");let F;if(D==="ducklake"){const L={};if(l==="postgres"){const z=ic.postgres,I={};if(z.forEach(U=>{const N=O.get(`ducklake_pg_${U.name}`)?.toString();N&&(I[U.name]=N)}),Object.keys(I).length===0)throw new Error("DuckLake requires catalog connection");L.postgresConnection=I}const _=O.get("ducklake_bucketUrl")?.toString();if(!_)throw new Error("DuckLake requires a bucket URL");const E={bucketUrl:_};if(u==="s3"){const z={};if(Sy.forEach(I=>{const U=O.get(`ducklake_s3_${I.name}`)?.toString();U&&(z[I.name]=U)}),z.provider==="credential_chain")delete z.accessKeyId,delete z.secretAccessKey,delete z.sessionToken;else{if(delete z.chain,!z.accessKeyId)throw new Error("S3 Access Key ID is required");if(!z.secretAccessKey)throw new Error("S3 Secret Access Key is required")}Object.keys(z).length>0&&(E.s3Connection=z)}else if(u==="gcs"){const z={};if(Cy.forEach(I=>{const U=O.get(`ducklake_gcs_${I.name}`)?.toString();U&&(z[I.name]=U)}),!z.keyId)throw new Error("GCS Key ID is required");if(!z.secret)throw new Error("GCS Secret is required");Object.keys(z).length>0&&(E.gcsConnection=z)}F={name:P,type:D,ducklakeConnection:{catalog:L,storage:E}}}else if(D==="duckdb"){if(i.length===0)throw new Error("DuckDB connection must have at least one attached database");const L=i.map((_,E)=>{const z=_.dbType,I=O.get(`attachedDb_${E}_name`)?.toString();if(!I)throw new Error(`Attached database at index ${E} must have a name`);const U={name:I,type:z},N=tx(z);if(N&&N.length>0){const q={};if(N.forEach(oe=>{const Q=O.get(`attachedDb_${E}_${oe.name}`)?.toString();Q&&(q[oe.name]=Q)}),z==="s3"){if(q.provider==="credential_chain")delete q.accessKeyId,delete q.secretAccessKey,delete q.sessionToken;else if(delete q.chain,!q.accessKeyId||!q.secretAccessKey)throw new Error(`Attached database "${I}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`)}const Y=w$[z];Y&&(U[Y]=q)}return U});F={name:P,type:D,duckdbConnection:{attachedDatabases:L}}}else{const L={};if(A.forEach(_=>{const E=O.get(_.name)?.toString();E&&(L[_.name]=E)}),D==="postgres"){if(!L.connectionString?.trim()){const _=["host","port","databaseName","userName","password"];for(const E of _)if(!L[E])throw new Error(`${A.find(z=>z.name===E)?.label||E} is required`)}}else if(D==="bigquery"){if(!L.serviceAccountKeyJson)throw new Error("Service Account Key JSON is required")}else if(D==="snowflake"){if(!L.account)throw new Error("Account is required");if(!L.username)throw new Error("Username is required");if(!L.warehouse)throw new Error("Warehouse is required");if(!L.password&&!L.privateKey)throw new Error("Either password or private key is required")}else if(D==="trino"){if(!L.server)throw new Error("Server is required");if(!L.user)throw new Error("User is required");if(L.server.trim().startsWith("https://")&&!L.password&&!L.peakaKey)throw new Error("Password is required for HTTPS connections (or use Peaka Key)")}else if(D==="mysql"){const _=["host","port","database","user","password"];for(const E of _)if(!L[E])throw new Error(`${A.find(z=>z.name===E)?.label||E} is required`)}else if(D==="sqlserver"){const _=["server","database","user","password"];if(!L.instanceName&&!L.port)throw new Error("Port is required unless an instance name is given");for(const E of _)if(!L[E])throw new Error(`${A.find(z=>z.name===E)?.label||E} is required`)}else if(D==="motherduck"){if(!L.accessToken)throw new Error("Access Token is required")}else if(D==="databricks"){if(!L.host)throw new Error("Host is required");if(!L.path)throw new Error("HTTP Path is required");const _=L.oauthClientId&&L.oauthClientSecret;if(!L.token&&!_)throw new Error("Either Access Token or OAuth Client ID + Secret is required")}F={name:P,type:D,[Mg[D]]:n6(D,L)}}await e(F),w()},b=()=>{s([...i,{name:"",dbType:"postgres"}])},$=R=>{s(i.filter((O,P)=>P!==R))},k=(R,O)=>{const P=[...i];P[R]={...P[R],dbType:O},s(P)};return p.jsxs(Cn.Fragment,{children:[p.jsx(Qy,{label:"Connection",onClick:x}),p.jsx(Oo,{open:n,onClose:w,title:"New connection",description:"Add a connection so packages in this environment can query your database with Malloy.",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{disabled:t,onClick:w,children:"Cancel"}),p.jsx(So,{type:"submit",form:"connection-form",variant:"contained",loading:t,children:"Create connection"})]}),children:p.jsx("form",{onSubmit:S,id:"connection-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small"}),p.jsx(yr,{id:"type",name:"type",label:"Connection Type",fullWidth:!0,size:"small",value:o,select:!0,onChange:R=>a(R.target.value),children:r6.map(R=>p.jsx(qo,{value:R,children:R},R))}),o==="ducklake"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Catalog"}),p.jsx(yr,{id:"ducklake_catalogType",label:"Catalog Type",fullWidth:!0,size:"small",value:l,select:!0,onChange:R=>d(R.target.value),children:p.jsx(qo,{value:"postgres",children:"PostgreSQL"})}),l==="postgres"&&p.jsx(p.Fragment,{children:ic.postgres.map(R=>p.jsx(yr,{id:`ducklake_pg_${R.name}`,name:`ducklake_pg_${R.name}`,label:R.label,type:R.type,fullWidth:!0,size:"small"},`pg_${R.name}`))})]}),p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Storage"}),p.jsxs(yr,{id:"ducklake_storageType",label:"Storage Type",fullWidth:!0,size:"small",value:u,select:!0,onChange:R=>m(R.target.value),children:[p.jsx(qo,{value:"s3",children:"S3"}),p.jsx(qo,{value:"gcs",children:"GCS"})]}),p.jsx(yr,{required:!0,id:"ducklake_bucketUrl",name:"ducklake_bucketUrl",label:u==="s3"?"Bucket URL (e.g. s3://my-bucket/path)":"Bucket URL (e.g. gs://my-bucket/path)",type:"text",fullWidth:!0,size:"small"}),u==="s3"&&p.jsxs(p.Fragment,{children:[p.jsx(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),Sy.filter(R=>R.visibleWhen?g===R.visibleWhen.value:!0).map(R=>p.jsx(yr,{id:`ducklake_s3_${R.name}`,name:`ducklake_s3_${R.name}`,label:R.label,type:R.selectOptions?void 0:R.type,fullWidth:!0,size:"small",required:R.required,select:!!R.selectOptions,defaultValue:R.selectOptions?g:void 0,onChange:R.name==="provider"?O=>y(O.target.value):void 0,placeholder:R.name==="region"?"us-east-1":void 0,children:R.selectOptions?.map(O=>p.jsx(qo,{value:O.value,children:O.label},O.value))},`s3_${R.name}`))]}),u==="gcs"&&p.jsxs(p.Fragment,{children:[p.jsx(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Cy.map(R=>p.jsx(yr,{id:`ducklake_gcs_${R.name}`,name:`ducklake_gcs_${R.name}`,label:R.label,type:R.type,fullWidth:!0,size:"small",required:R.required},`gcs_${R.name}`))]})]})]}):o==="duckdb"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsx(Ar,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),p.jsx(Xy,{label:"Database",icon:p.jsx(p1,{}),onClick:b,ariaLabel:"Add database"})]}),i.length===0&&p.jsx(Ar,{variant:"body2",color:"text.secondary",sx:{mb:2},children:'DuckDB connections require at least one attached database. Click "Add Database" to get started.'}),i.map((R,O)=>{const P=tx(R.dbType);return p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsxs(Ar,{variant:"subtitle2",children:["Database ",O+1]}),p.jsx(Eu,{onClick:()=>$(O),size:"small",color:"error",children:p.jsx(t6,{fontSize:"small"})})]}),p.jsx(yr,{required:!0,id:`attachedDb_${O}_name`,name:`attachedDb_${O}_name`,label:"Database Name",type:"text",fullWidth:!0,size:"small",defaultValue:R.name}),p.jsx(yr,{id:`attachedDb_${O}_type`,name:`attachedDb_${O}_type`,label:"Database Type",fullWidth:!0,size:"small",value:R.dbType,select:!0,onChange:D=>k(O,D.target.value),children:Object.values(w4).map(D=>p.jsx(qo,{value:D,children:D},D))}),P.filter(D=>D.visibleWhen?(R[D.visibleWhen.field]||P.find(A=>A.name===D.visibleWhen?.field)?.selectOptions?.[0]?.value)===D.visibleWhen.value:!0).map(D=>p.jsx(yr,{id:`attachedDb_${O}_${D.name}`,name:`attachedDb_${O}_${D.name}`,label:D.label,type:D.selectOptions?void 0:D.type,fullWidth:!0,size:"small",required:D.required,select:!!D.selectOptions,defaultValue:D.selectOptions?.[0]?.value,onChange:D.selectOptions?A=>{const F=[...i];F[O]={...F[O],[D.name]:A.target.value},s(F)}:void 0,children:D.selectOptions?.map(A=>p.jsx(qo,{value:A.value,children:A.label},A.value))},D.name))]},O)})]}):ic[o].map(R=>p.jsx(yr,{id:R.name,name:R.name,label:R.label,type:R.type,fullWidth:!0,size:"small",required:R.required,select:!!R.selectOptions,defaultValue:R.selectOptions?R.selectOptions[0]?.value:void 0,children:R.selectOptions?.map(O=>p.jsx(qo,{value:O.value,children:O.label},O.value))},R.name))]})})})]})}function j1e({connection:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),i=()=>{a(!0)},s=()=>{a(!1),t()};return p.jsxs(Cn.Fragment,{children:[p.jsxs(qo,{"aria-label":`Delete connection ${e?.name??""}`.trim(),onClick:l=>{l.stopPropagation(),i()},sx:{color:"error.main"},children:[p.jsx(n2,{sx:{color:"inherit"},children:p.jsx(Jx,{fontSize:"small"})}),p.jsx(r2,{children:"Delete"})]}),p.jsx(Oo,{open:o,onClose:s,title:"Delete connection",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{onClick:s,children:"Cancel"}),p.jsx(So,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>r(),loading:n,children:"Delete connection"})]}),children:p.jsxs(Ar,{variant:"body2",children:["Delete ",p.jsx("strong",{children:e.name}),"? Packages that query through it stop working, and this cannot be undone."]})})]})}const eI=new Set(["password","connectionString","privateKey","privateKeyPass","serviceAccountKeyJson","token","oauthClientSecret","accessToken","peakaKey","secret","secretAccessKey","sessionToken","clientSecret","sasUrl"]);function tI(e){const t=e.duckdbConnection?.attachedDatabases;return!t||t.length===0?[]:t.map(n=>({name:n.name||"",dbType:n.type||"postgres"}))}function nI(e){const t=e.ducklakeConnection;return t&&t.storage?.gcsConnection?"gcs":"s3"}function A1e({connection:e,onSubmit:t,isSubmitting:n,onCloseDialog:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(e.type),l=Cn.useMemo(()=>new Set(e.withheldFields??[]),[e.withheldFields]),[d,u]=C.useState(()=>tI(e)),[m,g]=C.useState("postgres"),[y,x]=C.useState(()=>nI(e)),[w,S]=C.useState(()=>e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),b=()=>{u(tI(e)),s(e.type),S(e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),g("postgres"),x(nI(e)),a(!0)},$=()=>{a(!1),r?.()},k=async F=>{F.preventDefault();const L=new FormData(F.currentTarget),_=L.get("name")?.toString(),E=L.get("type")?.toString(),z=ic[E];if(!_)throw new Error("Name is required");if(!E)throw new Error("Type is required");let I;if(E==="ducklake"){const U={};if(m==="postgres"){const Y=ic.postgres,oe={};if(Y.forEach(Q=>{const ae=L.get(`ducklake_pg_${Q.name}`)?.toString();ae&&(oe[Q.name]=ae)}),Object.keys(oe).length===0)throw new Error("DuckLake requires catalog connection");U.postgresConnection=oe}const N=L.get("ducklake_bucketUrl")?.toString();if(!N)throw new Error("DuckLake requires a bucket URL");const q={bucketUrl:N};if(y==="s3"){const Y={};Sy.forEach(Q=>{const ae=L.get(`ducklake_s3_${Q.name}`)?.toString();ae&&(Y[Q.name]=ae)});const oe=e.ducklakeConnection?.storage?.s3Connection;if(oe&&(!Y.provider&&oe.provider&&(Y.provider=oe.provider),!Y.chain&&oe.chain&&(Y.chain=oe.chain),!Y.accessKeyId&&oe.accessKeyId&&(Y.accessKeyId=oe.accessKeyId)),Y.provider==="credential_chain")delete Y.accessKeyId,delete Y.secretAccessKey,delete Y.sessionToken;else if(delete Y.chain,!Y.accessKeyId)throw new Error("S3 Access Key ID is required");Object.keys(Y).length>0&&(q.s3Connection=Y)}else if(y==="gcs"){const Y={};Cy.forEach(Q=>{const ae=L.get(`ducklake_gcs_${Q.name}`)?.toString();ae&&(Y[Q.name]=ae)});const oe=e.ducklakeConnection?.storage?.gcsConnection;if(oe&&!Y.keyId&&oe.keyId&&(Y.keyId=oe.keyId),!Y.keyId)throw new Error("GCS Key ID is required");Object.keys(Y).length>0&&(q.gcsConnection=Y)}I={name:_,type:E,ducklakeConnection:{catalog:U,storage:q}}}else if(E==="duckdb"){if(d.length===0)throw new Error("DuckDB connection must have at least one attached database");const U=d.map((N,q)=>{const Y=N.dbType,oe=L.get(`attachedDb_${q}_name`)?.toString();if(!oe)throw new Error(`Attached database at index ${q} must have a name`);const Q={name:oe,type:Y},ae=tx(Y);if(ae&&ae.length>0){const de={};if(ae.forEach(se=>{const J=L.get(`attachedDb_${q}_${se.name}`)?.toString();J&&(de[se.name]=J)}),Y==="s3"){if(de.provider==="credential_chain")delete de.accessKeyId,delete de.secretAccessKey,delete de.sessionToken;else if(delete de.chain,!de.accessKeyId||!de.secretAccessKey)throw new Error(`Attached database "${oe}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`)}const X=w$[Y];X&&(Q[X]=de)}return Q});I={name:_,type:E,duckdbConnection:{attachedDatabases:U}}}else{const U=e[Mg[E]]||{},N={};if(z.forEach(q=>{const Y=L.get(q.name)?.toString(),oe=U[q.name];Y?N[q.name]=Y:eI.has(q.name)||(Y!==void 0?N[q.name]=Y:oe&&(N[q.name]=oe))}),E==="postgres"){const q=["host","port","databaseName","userName"],Y=l.has("postgresConnection.connectionString");if(!(N.connectionString?.trim()||Y)){const oe=q;for(const Q of oe)if(!N[Q])throw new Error(`${z.find(ae=>ae.name===Q)?.label||Q} is required`)}}else if(E==="snowflake"){if(!N.account)throw new Error("Account is required");if(!N.username)throw new Error("Username is required");if(!N.warehouse)throw new Error("Warehouse is required")}else if(E==="trino"){if(!N.server)throw new Error("Server is required");if(!N.user)throw new Error("User is required")}else if(E==="mysql"){const q=["host","port","database","user"];for(const Y of q)if(!N[Y])throw new Error(`${z.find(oe=>oe.name===Y)?.label||Y} is required`)}else if(E==="sqlserver"){const q=["server","database","user"];if(!N.instanceName&&!N.port)throw new Error("Port is required unless an instance name is given");for(const Y of q)if(!N[Y])throw new Error(`${z.find(oe=>oe.name===Y)?.label||Y} is required`)}else if(E==="databricks"){if(!N.host)throw new Error("Host is required");if(!N.path)throw new Error("HTTP Path is required")}I={name:_,type:E,[Mg[E]]:n6(E,N)}}await t(I),$()},R=()=>{u([...d,{name:"",dbType:"postgres"}])},O=F=>{u(d.filter((L,_)=>_!==F))},P=(F,L)=>{const _=[...d];_[F]={..._[F],dbType:L},u(_)},D=(F,L)=>{const _=e.duckdbConnection?.attachedDatabases;if(!_||!_[F])return"";const E=_[F],z=w$[E.type||""];return z&&E[z]?E[z][L]??"":""},A=F=>{const L=e.ducklakeConnection;if(!L)return"";if(F.startsWith("pg_")){const _=F.replace("pg_","");return L.catalog?.postgresConnection?.[_]??""}if(F==="bucketUrl")return L.storage?.bucketUrl??"";if(F.startsWith("s3_")){const _=F.replace("s3_","");return L.storage?.s3Connection?.[_]??""}if(F.startsWith("gcs_")){const _=F.replace("gcs_","");return L.storage?.gcsConnection?.[_]??""}return""};return p.jsxs(Cn.Fragment,{children:[p.jsxs(qo,{"aria-label":`Edit connection ${e?.name??""}`.trim(),onClick:F=>{F.preventDefault(),F.stopPropagation(),b()},children:[p.jsx(n2,{children:p.jsx(eR,{fontSize:"small"})}),p.jsx(r2,{children:"Edit"})]}),p.jsx(Oo,{open:o,onClose:$,title:"Edit connection",description:"Change how packages in this environment reach your database.",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{disabled:n,onClick:$,children:"Cancel"}),p.jsx(So,{type:"submit",form:"connection-form",variant:"contained",loading:n,children:"Save changes"})]}),children:p.jsx("form",{onSubmit:k,id:"connection-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",defaultValue:e.name}),p.jsx(yr,{id:"type",name:"type",label:"Connection Type",fullWidth:!0,size:"small",value:i,select:!0,onChange:F=>s(F.target.value),children:r6.map(F=>p.jsx(qo,{value:F,children:F},F))}),i==="ducklake"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Catalog"}),p.jsx(yr,{id:"ducklake_catalogType",label:"Catalog Type",fullWidth:!0,size:"small",value:m,select:!0,onChange:F=>g(F.target.value),children:p.jsx(qo,{value:"postgres",children:"PostgreSQL"})}),m==="postgres"&&p.jsx(p.Fragment,{children:ic.postgres.map(F=>p.jsx(yr,{id:`ducklake_pg_${F.name}`,name:`ducklake_pg_${F.name}`,label:F.label,type:F.type,fullWidth:!0,size:"small",defaultValue:A(`pg_${F.name}`)},`pg_${F.name}`))})]}),p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Storage"}),p.jsxs(yr,{id:"ducklake_storageType",label:"Storage Type",fullWidth:!0,size:"small",value:y,select:!0,onChange:F=>x(F.target.value),children:[p.jsx(qo,{value:"s3",children:"S3"}),p.jsx(qo,{value:"gcs",children:"GCS"})]}),p.jsx(yr,{required:!0,id:"ducklake_bucketUrl",name:"ducklake_bucketUrl",label:y==="s3"?"Bucket URL (e.g. s3://my-bucket/path)":"Bucket URL (e.g. gs://my-bucket/path)",type:"text",fullWidth:!0,size:"small",defaultValue:A("bucketUrl")}),y==="s3"&&p.jsxs(p.Fragment,{children:[p.jsx(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),Sy.filter(F=>F.visibleWhen?w===F.visibleWhen.value:!0).map(F=>p.jsx(yr,{id:`ducklake_s3_${F.name}`,name:`ducklake_s3_${F.name}`,label:F.label,type:F.selectOptions?void 0:F.type,fullWidth:!0,size:"small",required:F.required&&F.name!=="secretAccessKey",select:!!F.selectOptions,defaultValue:F.selectOptions?w:A(`s3_${F.name}`),onChange:F.name==="provider"?L=>S(L.target.value):void 0,placeholder:F.name==="region"?"us-east-1":F.name==="secretAccessKey"&&l.has("ducklakeConnection.storage.s3Connection.secretAccessKey")?"Leave empty to keep existing":void 0,children:F.selectOptions?.map(L=>p.jsx(qo,{value:L.value,children:L.label},L.value))},`s3_${F.name}`))]}),y==="gcs"&&p.jsxs(p.Fragment,{children:[p.jsx(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Cy.map(F=>p.jsx(yr,{id:`ducklake_gcs_${F.name}`,name:`ducklake_gcs_${F.name}`,label:F.label,type:F.type,fullWidth:!0,size:"small",required:F.required&&F.name!=="secret",defaultValue:A(`gcs_${F.name}`),placeholder:F.name==="secret"&&l.has("ducklakeConnection.storage.gcsConnection.secret")?"Leave empty to keep existing":void 0},`gcs_${F.name}`))]})]})]}):i==="duckdb"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsx(Ar,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),p.jsx(Xy,{label:"Database",icon:p.jsx(p1,{}),onClick:R,ariaLabel:"Add database"})]}),d.length===0&&p.jsx(Ar,{variant:"body2",color:"text.secondary",sx:{mb:2},children:'DuckDB connections require at least one attached database. Click "Add Database" to get started.'}),d.map((F,L)=>{const _=tx(F.dbType);return p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsxs(Ar,{variant:"subtitle2",children:["Database ",L+1]}),p.jsx(Eu,{"aria-label":`Remove attached database ${L+1}`,onClick:()=>O(L),size:"small",color:"error",children:p.jsx(t6,{fontSize:"small"})})]}),p.jsx(yr,{required:!0,id:`attachedDb_${L}_name`,name:`attachedDb_${L}_name`,label:"Database Name",type:"text",fullWidth:!0,size:"small",defaultValue:F.name}),p.jsx(yr,{id:`attachedDb_${L}_type`,name:`attachedDb_${L}_type`,label:"Database Type",fullWidth:!0,size:"small",value:F.dbType,select:!0,onChange:E=>P(L,E.target.value),children:Object.values(w4).map(E=>p.jsx(qo,{value:E,children:E},E))}),_.filter(E=>E.visibleWhen?(F[E.visibleWhen.field]||D(L,E.visibleWhen.field)||_.find(z=>z.name===E.visibleWhen?.field)?.selectOptions?.[0]?.value)===E.visibleWhen.value:!0).map(E=>p.jsx(yr,{id:`attachedDb_${L}_${E.name}`,name:`attachedDb_${L}_${E.name}`,label:E.label,type:E.selectOptions?void 0:E.type,fullWidth:!0,size:"small",required:E.required,select:!!E.selectOptions,defaultValue:D(L,E.name)||E.selectOptions?.[0]?.value,onChange:E.selectOptions?z=>{const I=[...d];I[L]={...I[L],[E.name]:z.target.value},u(I)}:void 0,children:E.selectOptions?.map(z=>p.jsx(qo,{value:z.value,children:z.label},z.value))},E.name))]},L)})]}):ic[i].map(F=>{const L=e?.[Mg[i]??""]?.[F.name??""]??"",_=F.type==="password"||eI.has(F.name),E=l.has(`${Mg[i]??""}.${F.name}`),z=F.selectOptions?L===""||L===void 0?F.selectOptions[0]?.value:String(L):void 0;return p.jsx(yr,{id:F.name,name:F.name,label:F.label,type:F.type,fullWidth:!0,size:"small",required:F.required&&!_&&!L,select:!!F.selectOptions,defaultValue:F.selectOptions?z:L,placeholder:E?"Leave empty to keep existing":void 0,helperText:_?E?"Stored value is not shown. Leave empty to keep it.":"No value stored.":void 0,children:F.selectOptions?.map(I=>p.jsx(qo,{value:I.value,children:I.label},I.value))},F.name)})]})})})]})}function rI(e,t){return!e||e.type!=="duckdb"?!1:(e.duckdbConnection?.attachedDatabases||[]).some(n=>n.type==="azure"&&n.name===t)}function D1e(e){return e.startsWith("gs://")||e.startsWith("s3://")||e.startsWith("https://")||e.startsWith("abfss://")||e.startsWith("az://")}function N1e({connectionName:e,resourceUri:t,schema:n,connection:r}){const{apiClients:o}=er(),{environmentName:a}=ko(t),[i,s]=Cn.useState(null),[l,d]=Cn.useState(n||null),[u,m]=Cn.useState(!1),{data:g,isError:y,isLoading:x,error:w}=wo({queryKey:["schemas",a,e],queryFn:()=>o.connections.listSchemas(a,e)}),S=g?.data||[];return p.jsxs(Sp,{container:!0,spacing:1,children:[!n&&p.jsx(Sp,{size:{xs:12,md:4},children:p.jsxs(Ga,{sx:{p:1,m:0},children:[p.jsxs(Ee,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:0},children:[p.jsx(wt,{variant:"overline",fontWeight:"bold",children:"Table Paths"}),p.jsx(RE,{control:p.jsx(bz,{checked:u,onChange:b=>m(b.target.checked)}),label:"Hidden Schemas"})]}),p.jsx(wl,{sx:{mt:"2px"}}),p.jsxs(Ee,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[x&&p.jsx(Go,{text:"Loading schemas..."}),y&&p.jsx(Xa,{error:w,context:`${a} > ${e} > Schemas`}),!x&&!y&&S.length===0&&p.jsx(wt,{variant:"body2",children:"No Schemas"}),!x&&!y&&S.length>0&&p.jsx(PE,{dense:!0,disablePadding:!0,children:S.map(b=>{const $=b.name;return b.isHidden&&!u?null:p.jsx(dz,{selected:l===$,onClick:()=>{d($),s(null)},children:p.jsx(xi,{primary:$})},$)})})]})]})}),p.jsx(Sp,{size:{xs:12,md:n?6:4},children:l&&p.jsx(Ga,{sx:{p:1,m:0},children:p.jsx(z1e,{connectionName:e,schemaName:l,onTableSelect:b=>{s(b)},resourceUri:t,connection:r})})}),p.jsx(Sp,{size:{xs:12,md:n?6:4},children:l&&i&&p.jsx(I1e,{environmentName:a,connectionName:e,schemaName:l,tableResource:i})})]})}function I1e({environmentName:e,connectionName:t,schemaName:n,tableResource:r}){const{apiClients:o}=er(),{data:a,isLoading:i,isError:s,error:l}=wo({queryKey:["connectionTableDetail",e,t,n,r],queryFn:()=>o.connections.getTable(e,t,n,r),enabled:!!n&&!!r}),d={resource:a?.data?.resource??r,columns:a?.data?.columns??[]};return p.jsxs(Ga,{sx:{p:1,m:0},children:[s&&p.jsx(Xa,{error:l,context:`${e} > ${t} > ${n} > ${r}`}),!s&&p.jsx(L1e,{table:d,loading:i})]})}function L1e({table:e,loading:t}){return t?p.jsx(Go,{text:"Loading columns..."}):p.jsxs(p.Fragment,{children:[p.jsxs(wt,{variant:"overline",fontWeight:"bold",sx:{display:"block",wordBreak:"break-all"},children:[e.resource.includes("://")||/\.(parquet|csv|json|tsv|ndjson)$/i.test(e.resource)?"File":"Table",": ",e.resource]}),p.jsx(wl,{}),p.jsx(Ee,{sx:{mt:"10px",maxHeight:"600px",overflowY:"auto"},children:p.jsx(VJ,{children:p.jsxs(Ux,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(ur,{children:"NAME"}),p.jsx(ur,{children:"TYPE"})]})}),p.jsx(qx,{children:e.columns?.sort((n,r)=>n.name.localeCompare(r.name))?.map(n=>p.jsxs(vu,{children:[p.jsx(ur,{children:n.name}),p.jsx(ur,{children:n.type})]},n.name))})]})})})]})}function z1e({connectionName:e,schemaName:t,onTableSelect:n,resourceUri:r,connection:o}){const{environmentName:a}=ko(r),{apiClients:i}=er(),[s,l]=C.useState(""),{data:d,isSuccess:u,isError:m,error:g,isLoading:y}=wo({queryKey:["tablesInSchema",a,e,t],queryFn:()=>i.connections.listTables(a,e,t)}),x=rI(o,t),w=b=>x?b:b.split(".").pop()||b,S=u&&d?.data?d.data.filter(b=>w(b.resource).toLowerCase().includes(s.toLowerCase())).sort((b,$)=>w(b.resource).localeCompare(w($.resource))):[];return p.jsxs(p.Fragment,{children:[p.jsx(wt,{variant:"overline",fontWeight:"bold",children:D1e(t)||rI(o,t)?`Files in ${t}`:`Tables in ${t}`}),p.jsx(wl,{}),p.jsx(Ee,{sx:{mt:1,mb:1},children:p.jsx(ki,{size:"small",fullWidth:!0,placeholder:"Search tables...",value:s,onChange:b=>l(b.target.value),variant:"outlined"})}),p.jsx(wl,{}),p.jsxs(Ee,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[y&&p.jsx(Go,{text:"Fetching Tables..."}),m&&p.jsx(Xa,{error:g,context:`${a} > ${e} > ${t}`}),u&&S.length===0&&p.jsx(wt,{variant:"body2",children:"No Tables"}),u&&d?.data&&d.data.length>0&&p.jsx(PE,{dense:!0,disablePadding:!0,children:S.map(b=>{let $=w(b.resource);return!x&&b.resource.includes("://")&&($=b.resource.split("/").pop()||b.resource),p.jsx(dz,{onClick:()=>n(b.resource),children:p.jsx(xi,{primary:$,secondary:b.columns.length>0?`${b.columns.length} columns`:void 0})},b.resource)})})]})]})}const F1e={bigquery:"BigQuery",snowflake:"Snowflake",postgres:"PostgreSQL",mysql:"MySQL",sqlserver:"SQL Server",trino:"Trino",databricks:"Databricks",duckdb:"DuckDB",ducklake:"DuckLake",s3:"S3",gcs:"GCS",azure:"Azure"};function _1e(e){return e?F1e[e]??e:""}function B1e({resourceUri:e}){const{apiClients:t,mutable:n}=er(),r=Tl(),{environmentName:o}=ko(e),[a,i]=C.useState(""),[s,l]=C.useState(null),d=I1({environmentName:o,connectionName:s}),{data:u,isSuccess:m,isError:g,error:y}=wo({queryKey:["connections",o],queryFn:()=>t.connections.listConnections(o)}),x=hl({mutationFn:oc("connection","create",k=>t.environments.updateEnvironment(o,{name:o,connections:[...u.data,k]})),onSuccess(){i("Connection added successfully"),r.invalidateQueries({queryKey:["connections",o]})},onError(k){i(k.message)}}),w=hl({mutationFn:oc("connection","update",k=>t.environments.updateEnvironment(o,{name:o,connections:u.data.map(R=>R.name===k.name?k:R)})),onSuccess(k,R){i(`Connection ${R.name} updated successfully`),r.invalidateQueries({queryKey:["connections",o]})},onError(k){i(k.message)}}),S=hl({mutationFn:oc("connection","delete",k=>{if(!k.name)throw new Error("Cannot delete a connection with no name");return t.connections.deleteConnection(o,k.name)}),onSuccess(k,R){i(`Connection ${R.name} deleted successfully`),r.invalidateQueries({queryKey:["connections",o]})},onError(k){i(k.message)}}),b=m?[...u.data].sort((k,R)=>(k.name??"").localeCompare(R.name??"")):[],$=x.isPending||w.isPending||S.isPending;return p.jsxs(Ds,{title:"Connections",...m?{count:b.length}:{},description:"Database connections available to packages in this environment",...n&&m?{action:p.jsx(P1e,{onSubmit:k=>x.mutateAsync(k),isSubmitting:x.isPending})}:{},children:[!m&&!g&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:"Fetching Connections..."}),g&&p.jsx(Xa,{error:y,context:`${o} > Connections`}),m&&b.length===0&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:"No connections yet."}),m&&b.length>0&&p.jsx(Wn,{children:b.map(k=>p.jsx(U1e,{connection:k,mutable:n,isMutating:$,onOpenExplorer:()=>l(k.name??null),onEdit:R=>w.mutateAsync(R),onDelete:R=>S.mutateAsync(R)},k.name))}),p.jsx(ph,{open:a!=="",autoHideDuration:6e3,onClose:()=>i(""),message:a}),p.jsx(Oo,{open:s!==null,onClose:()=>l(null),maxWidth:"lg",title:`Connection explorer: ${s??""}`,showClose:!0,children:s&&p.jsx(N1e,{resourceUri:d,connectionName:s,connection:u?.data?.find(k=>k.name===s)})})]})}function U1e({connection:e,mutable:t,isMutating:n,onOpenExplorer:r,onEdit:o,onDelete:a}){const[i,s]=C.useState(null),l=!!i,d=m=>{m.stopPropagation(),s(m.currentTarget)},u=()=>s(null);return p.jsx(L1,{icon:p.jsx(m1e,{sx:{fontSize:18}}),tint:QE.connection,label:e.name??"",ariaLabel:e.name??"",description:_1e(e.type),onClick:r,...t?{trailingAction:p.jsxs(p.Fragment,{children:[p.jsx(no,{size:"small",onClick:d,"aria-label":`Connection actions for ${e.name??""}`.trim(),children:p.jsx(e1,{fontSize:"small"})}),p.jsxs(dc,{anchorEl:i,open:l,onClose:u,onClick:m=>m.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[p.jsx(A1e,{connection:e,onSubmit:o,isSubmitting:n,onCloseDialog:u}),p.jsx(j1e,{connection:e,onCloseDialog:u,isMutating:n,onDelete:()=>a(e)})]})]})}:{}})}const V1e=rn([p.jsx("path",{d:"M20 2H4c-1 0-2 .9-2 2v3.01c0 .72.43 1.34 1 1.69V20c0 1.1 1.1 2 2 2h14c.9 0 2-.9 2-2V8.7c.57-.35 1-.97 1-1.69V4c0-1.1-1-2-2-2m-1 18H5V9h14zm1-13H4V4h16z"},"0"),p.jsx("path",{d:"M9 12h6v2H9z"},"1")]);function q1e({resourceUri:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=er(),a=()=>{r(!0)},i=()=>{r(!1),t()},{environmentName:s,packageName:l}=ko(e),d=Ch({mutationFn:()=>o.packages.deletePackage(s,l),success:"Package deleted",invalidates:[["packages",s]],closeDialog:i,resource:"package",action:"delete"});return p.jsxs(Cn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(Jx,{fontSize:"small"})}),p.jsx(xi,{children:"Delete"})]}),p.jsx(Oo,{open:n,onClose:i,title:"Delete package",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{onClick:i,children:"Cancel"}),p.jsx(So,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>d.mutate(),loading:d.isPending,children:"Delete package"})]}),children:p.jsxs(Ar,{variant:"body2",children:["Delete ",p.jsx("strong",{children:l}),"? The package stops being served and this cannot be undone."]})}),d.notice]})}function H1e({package:e,resourceUri:t,onCloseDialog:n}){const[r,o]=C.useState(!1),{apiClients:a}=er(),i=()=>{o(!0)},s=()=>{o(!1),n()},{packageName:l,environmentName:d}=ko(t),u=Ch({mutationFn(g){return a.packages.updatePackage(d,l,{name:l,description:g.description})},success:"Package updated",invalidates:[["packages",d]],closeDialog:s,resource:"package",action:"update"}),m=g=>{g.preventDefault();const y=new FormData(g.currentTarget).get("description")?.toString();u.mutate({description:y})};return p.jsxs(Cn.Fragment,{children:[p.jsxs(ea,{onClick:i,children:[p.jsx(ml,{children:p.jsx(eR,{fontSize:"small"})}),p.jsx(xi,{children:"Edit"})]}),p.jsx(Oo,{open:r,onClose:s,title:"Edit package",description:`What ${e.name} is, for the people who open it.`,actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{disabled:u.isPending,onClick:s,children:"Cancel"}),p.jsx(So,{type:"submit",form:"package-form",variant:"contained",loading:u.isPending,children:"Save changes"})]}),children:p.jsx("form",{onSubmit:m,id:"package-form",children:p.jsxs(Wn,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",disabled:!0,type:"text",fullWidth:!0,size:"small",defaultValue:e.name,InputLabelProps:{shrink:!0}}),p.jsx(yr,{id:"description",name:"description",label:"Description",multiline:!0,fullWidth:!0,rows:4,size:"small",defaultValue:e.description,InputLabelProps:{shrink:!0}})]})})}),u.notice]})}function W1e({onSelectPackage:e,resourceUri:t}){const{apiClients:n}=er(),{environmentName:r}=ko(t),{data:o,isSuccess:a,isError:i,error:s}=wo({queryKey:["packages",r],queryFn:()=>n.packages.listPackages(r)});if(i)return p.jsx(Xa,{error:s,context:`${r} > Packages`});if(!a)return p.jsx(Go,{text:"Fetching Packages..."});const l=[...o.data].sort((d,u)=>d.name.localeCompare(u.name));return p.jsx(Wn,{children:l.map(d=>{const u=I1({environmentName:r,packageName:d.name});return p.jsx(Y1e,{pkg:d,packageResourceUri:u,onSelectPackage:e},d.name)})})}function Y1e({pkg:e,packageResourceUri:t,onSelectPackage:n}){const{mutable:r}=er(),o=e.versionId!==void 0||e.latestVersion!==void 0,[a,i]=C.useState(null),s=!!a,l=u=>{u.stopPropagation(),i(u.currentTarget)},d=()=>i(null);return p.jsx(L1,{icon:p.jsx(V1e,{sx:{fontSize:18}}),tint:QE.package,label:e.name,ariaLabel:e.name,...e.description?{description:e.description}:{},onClick:u=>n(e.name,u),...r?{trailingAction:p.jsxs(p.Fragment,{children:[p.jsx(no,{size:"small",onClick:l,"aria-label":`Package actions for ${e.name}`,children:p.jsx(e1,{fontSize:"small"})}),p.jsxs(dc,{anchorEl:a,open:s,onClose:d,onClick:u=>u.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[!o&&p.jsx(H1e,{package:e,resourceUri:t,onCloseDialog:d}),p.jsx(q1e,{resourceUri:t,onCloseDialog:d})]})]})}:{}})}function M2e({onSelectPackage:e,resourceUri:t}){const{apiClients:n,mutable:r}=er(),{environmentName:o}=ko(t),a=wo({queryKey:["packages",o],queryFn:()=>n.packages.listPackages(o)});return C.useEffect(()=>{window.scrollTo({top:0,behavior:"auto"})},[]),p.jsxs(O0,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[p.jsxs(Ee,{sx:{mb:4},children:[p.jsx(wt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:o}),p.jsx(wt,{variant:"body2",color:"text.secondary",children:"Manage packages and database connections in this environment. Open a package to explore its models and notebooks."})]}),p.jsx(Ds,{title:"Packages",...a.isSuccess?{count:a.data.data.length}:{},description:"Published packages available for use in this environment",...r?{action:p.jsx(h1e,{resourceUri:t})}:{},children:p.jsx(W1e,{onSelectPackage:e,resourceUri:t})}),p.jsx(B1e,{resourceUri:t}),p.jsx(Jxe,{resourceUri:t})]})}function oI({array1:e,array2:t,parser:n=r=>r}){return e&&t&&e.length===t.length&&e.every((r,o)=>n(r)===n(t[o]))}function aI(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function G1e(e={}){const{ignoreAccents:t=!0,ignoreCase:n=!0,limit:r,matchFrom:o="any",stringify:a,trim:i=!1}=e;return(s,{inputValue:l,getOptionLabel:d})=>{let u=i?l.trim():l;n&&(u=u.toLowerCase()),t&&(u=aI(u));const m=u?s.filter(g=>{let y=(a||d)(g);return n&&(y=y.toLowerCase()),t&&(y=aI(y)),o==="start"?y.startsWith(u):y.includes(u)}):s;return typeof r=="number"?m.slice(0,r):m}}const K1e=G1e(),iI=5,Q1e=e=>e.current!==null&&e.current.parentElement?.contains(document.activeElement),X1e=[];function sI(e,t,n,r){if(t||e==null||r)return"";const o=n(e);return typeof o=="string"?o:""}function Z1e(e){const{unstable_isActiveElementInListbox:t=Q1e,unstable_classNamePrefix:n="Mui",autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:i=!1,clearOnBlur:s=!e.freeSolo,clearOnEscape:l=!1,componentName:d="useAutocomplete",defaultValue:u=e.multiple?X1e:null,disableClearable:m=!1,disableCloseOnSelect:g=!1,disabled:y,disabledItemsFocusable:x=!1,disableListWrap:w=!1,filterOptions:S=K1e,filterSelectedOptions:b=!1,freeSolo:$=!1,getOptionDisabled:k,getOptionKey:R,getOptionLabel:O=ge=>ge.label??ge,groupBy:P,handleHomeEndKeys:D=!e.freeSolo,id:A,includeInputInList:F=!1,inputValue:L,isOptionEqualToValue:_=(ge,ye)=>ge===ye,multiple:E=!1,onChange:z,onClose:I,onHighlightChange:U,onInputChange:N,onOpen:q,open:Y,openOnFocus:oe=!1,options:Q,readOnly:ae=!1,renderValue:de,selectOnFocus:X=!e.freeSolo,value:se}=e,J=Fs(A);let Z=O;Z=ge=>{const ye=O(ge);return typeof ye!="string"?String(ye):ye};const G=C.useRef(!1),ue=C.useRef(!0),ie=C.useRef(null),fe=C.useRef(null),[he,me]=C.useState(null),[le,ve]=C.useState(-1),Le=o?0:-1,Ie=C.useRef(Le),Re=C.useRef(sI(u??se,E,Z)).current,[ne,qe]=Ji({controlled:se,default:u,name:d}),[Oe,Qe]=Ji({controlled:L,default:Re,name:d,state:"inputValue"}),[nt,kt]=C.useState(!1),Ut=C.useCallback((ge,ye,Be)=>{if(!(E?ne.length<ye.length:ye!==null)&&!s)return;const gt=sI(ye,E,Z,de);Oe!==gt&&(Qe(gt),N&&N(ge,gt,Be))},[Z,Oe,E,N,Qe,s,ne,de]),[at,et]=Ji({controlled:Y,default:!1,name:d,state:"open"}),[pt,ze]=C.useState(!0),be=!E&&ne!=null&&Oe===Z(ne),He=at&&!ae,Me=He?S(Q.filter(ge=>!(b&&(E?ne:[ne]).some(ye=>ye!==null&&_(ge,ye)))),{inputValue:be&&pt?"":Oe,getOptionLabel:Z}):[],$t=$xe({filteredOptions:Me,value:ne,inputValue:Oe});C.useEffect(()=>{const ge=ne!==$t.value;nt&&!ge||$&&!ge||Ut(null,ne,"reset")},[ne,Ut,nt,$t.value,$]);const Et=at&&Me.length>0&&!ae,vt=Yt(ge=>{if(ge===-1)ie.current.focus();else{const ye=de?"data-item-index":"data-tag-index";he.querySelector(`[${ye}="${ge}"]`).focus()}});C.useEffect(()=>{E&&le>ne.length-1&&(ve(-1),vt(-1))},[ne,E,le,vt]);function it(ge,ye){if(!fe.current||ge<0||ge>=Me.length)return-1;let Be=ge;for(;;){const gt=fe.current.querySelector(`[data-option-index="${Be}"]`),We=x?!1:!gt||gt.disabled||gt.getAttribute("aria-disabled")==="true";if(gt&&gt.hasAttribute("tabindex")&&!We)return Be;if(ye==="next"?Be=(Be+1)%Me.length:Be=(Be-1+Me.length)%Me.length,Be===ge)return-1}}const st=Yt(({event:ge,index:ye,reason:Be})=>{if(Ie.current=ye,ye===-1?ie.current.removeAttribute("aria-activedescendant"):ie.current.setAttribute("aria-activedescendant",`${J}-option-${ye}`),U&&["mouse","keyboard","touch"].includes(Be)&&U(ge,ye===-1?null:Me[ye],Be),!fe.current)return;const gt=fe.current.querySelector(`[role="option"].${n}-focused`);gt&&(gt.classList.remove(`${n}-focused`),gt.classList.remove(`${n}-focusVisible`));let We=fe.current;if(fe.current.getAttribute("role")!=="listbox"&&(We=fe.current.parentElement.querySelector('[role="listbox"]')),!We)return;if(ye===-1){We.scrollTop=0;return}const Dt=fe.current.querySelector(`[data-option-index="${ye}"]`);if(Dt&&(Dt.classList.add(`${n}-focused`),Be==="keyboard"&&Dt.classList.add(`${n}-focusVisible`),We.scrollHeight>We.clientHeight&&Be!=="mouse"&&Be!=="touch")){const Kt=Dt,sn=We.clientHeight+We.scrollTop,we=Kt.offsetTop+Kt.offsetHeight;we>sn?We.scrollTop=we-We.clientHeight:Kt.offsetTop-Kt.offsetHeight*(P?1.3:0)<We.scrollTop&&(We.scrollTop=Kt.offsetTop-Kt.offsetHeight*(P?1.3:0))}}),At=Yt(({event:ge,diff:ye,direction:Be="next",reason:gt})=>{if(!He)return;const We=it((()=>{const Dt=Me.length-1;if(ye==="reset")return Le;if(ye==="start")return 0;if(ye==="end")return Dt;const Kt=Ie.current+ye;return Kt<0?Kt===-1&&F?-1:w&&Ie.current!==-1||Math.abs(ye)>1?0:Dt:Kt>Dt?Kt===Dt+1&&F?-1:w||Math.abs(ye)>1?Dt:0:Kt})(),Be);if(st({index:We,reason:gt,event:ge}),r&&ye!=="reset")if(We===-1)ie.current.value=Oe;else{const Dt=Z(Me[We]);ie.current.value=Dt,Dt.toLowerCase().indexOf(Oe.toLowerCase())===0&&Oe.length>0&&ie.current.setSelectionRange(Oe.length,Dt.length)}}),tn=!oI({array1:$t.filteredOptions,array2:Me,parser:Z}),Bt=()=>{const ge=(ye,Be)=>{const gt=ye?Z(ye):"",We=Be?Z(Be):"";return gt===We};if(Ie.current!==-1&&!oI({array1:$t.filteredOptions,array2:Me,parser:Z})&&$t.inputValue===Oe&&(E?ne.length===$t.value.length&&$t.value.every((ye,Be)=>Z(ne[Be])===Z(ye)):ge($t.value,ne))){const ye=$t.filteredOptions[Ie.current];if(ye)return Me.findIndex(Be=>Z(Be)===Z(ye))}return-1},an=C.useCallback(()=>{if(!He)return;const ge=Bt();if(ge!==-1){Ie.current=ge;return}const ye=E?ne[0]:ne;if(Me.length===0||ye==null){At({diff:"reset"});return}if(fe.current){if(ye!=null){const Be=Me[Ie.current];if(E&&Be&&ne.findIndex(We=>_(Be,We))!==-1)return;const gt=Me.findIndex(We=>_(We,ye));gt===-1?At({diff:"reset"}):st({index:gt});return}if(Ie.current>=Me.length-1){st({index:Me.length-1});return}st({index:Ie.current})}},[Me.length,E?!1:ne,b,At,st,He,Oe,E]),$n=Yt(ge=>{Vk(fe,ge),ge&&an()});C.useEffect(()=>{tn&&an()},[an,tn]);const Vt=ge=>{at||(et(!0),ze(!0),q&&q(ge))},Pn=(ge,ye)=>{at&&(et(!1),I&&I(ge,ye))},Se=(ge,ye,Be,gt)=>{if(E){if(ne.length===ye.length&&ne.every((We,Dt)=>We===ye[Dt]))return}else if(ne===ye)return;z&&z(ge,ye,Be,gt),qe(ye)},jn=C.useRef(!1),En=(ge,ye,Be="selectOption",gt="options")=>{let We=Be,Dt=ye;if(E){Dt=Array.isArray(ne)?ne.slice():[];const Kt=Dt.findIndex(sn=>_(ye,sn));Kt===-1?Dt.push(ye):gt!=="freeSolo"&&(Dt.splice(Kt,1),We="removeOption")}Ut(ge,Dt,We),Se(ge,Dt,We,{option:ye}),!g&&(!ge||!ge.ctrlKey&&!ge.metaKey)&&Pn(ge,We),(i===!0||i==="touch"&&jn.current||i==="mouse"&&!jn.current)&&ie.current.blur()};function Jt(ge,ye){if(ge===-1)return-1;let Be=ge;for(;;){if(ye==="next"&&Be===ne.length||ye==="previous"&&Be===-1)return-1;const gt=de?"data-item-index":"data-tag-index",We=he.querySelector(`[${gt}="${Be}"]`);if(!We||!We.hasAttribute("tabindex")||We.disabled||We.getAttribute("aria-disabled")==="true")Be+=ye==="next"?1:-1;else return Be}}const Pt=(ge,ye)=>{if(!E)return;Oe===""&&Pn(ge,"toggleInput");let Be=le;le===-1?Oe===""&&ye==="previous"&&(Be=ne.length-1):(Be+=ye==="next"?1:-1,Be<0&&(Be=0),Be===ne.length&&(Be=-1)),Be=Jt(Be,ye),ve(Be),vt(Be)},Ur=ge=>{G.current=!0,Qe(""),N&&N(ge,"","clear"),Se(ge,E?[]:null,"clear")},Vn=ge=>ye=>{if(ge.onKeyDown&&ge.onKeyDown(ye),!ye.defaultMuiPrevented&&(le!==-1&&!["ArrowLeft","ArrowRight"].includes(ye.key)&&(ve(-1),vt(-1)),ye.which!==229))switch(ye.key){case"Home":He&&D&&(ye.preventDefault(),At({diff:"start",direction:"next",reason:"keyboard",event:ye}));break;case"End":He&&D&&(ye.preventDefault(),At({diff:"end",direction:"previous",reason:"keyboard",event:ye}));break;case"PageUp":ye.preventDefault(),At({diff:-iI,direction:"previous",reason:"keyboard",event:ye}),Vt(ye);break;case"PageDown":ye.preventDefault(),At({diff:iI,direction:"next",reason:"keyboard",event:ye}),Vt(ye);break;case"ArrowDown":ye.preventDefault(),At({diff:1,direction:"next",reason:"keyboard",event:ye}),Vt(ye);break;case"ArrowUp":ye.preventDefault(),At({diff:-1,direction:"previous",reason:"keyboard",event:ye}),Vt(ye);break;case"ArrowLeft":!E&&de?vt(0):Pt(ye,"previous");break;case"ArrowRight":!E&&de?vt(-1):Pt(ye,"next");break;case"Enter":if(Ie.current!==-1&&He){const Be=Me[Ie.current],gt=k?k(Be):!1;if(ye.preventDefault(),gt)return;En(ye,Be,"selectOption"),r&&ie.current.setSelectionRange(ie.current.value.length,ie.current.value.length)}else $&&Oe!==""&&be===!1&&(E&&ye.preventDefault(),En(ye,Oe,"createOption","freeSolo"));break;case"Escape":He?(ye.preventDefault(),ye.stopPropagation(),Pn(ye,"escape")):l&&(Oe!==""||E&&ne.length>0||de)&&(ye.preventDefault(),ye.stopPropagation(),Ur(ye));break;case"Backspace":if(E&&!ae&&Oe===""&&ne.length>0){const Be=le===-1?ne.length-1:le,gt=ne.slice();gt.splice(Be,1),Se(ye,gt,"removeOption",{option:ne[Be]})}!E&&de&&!ae&&(qe(null),vt(-1));break;case"Delete":if(E&&!ae&&Oe===""&&ne.length>0&&le!==-1){const Be=le,gt=ne.slice();gt.splice(Be,1),Se(ye,gt,"removeOption",{option:ne[Be]})}!E&&de&&!ae&&(qe(null),vt(-1));break}},cn=ge=>{kt(!0),oe&&!G.current&&Vt(ge)},Bn=ge=>{if(t(fe)){ie.current.focus();return}kt(!1),ue.current=!0,G.current=!1,a&&Ie.current!==-1&&He?En(ge,Me[Ie.current],"blur"):a&&$&&Oe!==""?En(ge,Oe,"blur","freeSolo"):s&&Ut(ge,ne,"blur"),Pn(ge,"blur")},xe=ge=>{const ye=ge.target.value;Oe!==ye&&(Qe(ye),ze(!1),N&&N(ge,ye,"input")),ye===""?!m&&!E&&Se(ge,null,"clear"):Vt(ge)},Te=ge=>{const ye=Number(ge.currentTarget.getAttribute("data-option-index"));Ie.current!==ye&&st({event:ge,index:ye,reason:"mouse"})},_e=ge=>{st({event:ge,index:Number(ge.currentTarget.getAttribute("data-option-index")),reason:"touch"}),jn.current=!0},Ye=ge=>{const ye=Number(ge.currentTarget.getAttribute("data-option-index"));En(ge,Me[ye],"selectOption"),jn.current=!1},ut=ge=>ye=>{const Be=ne.slice();Be.splice(ge,1),Se(ye,Be,"removeOption",{option:ne[ge]})},Rt=ge=>{Se(ge,null,"removeOption",{option:ne})},St=ge=>{at?Pn(ge,"toggleInput"):Vt(ge)},Tt=ge=>{ge.currentTarget.contains(ge.target)&&ge.target.getAttribute("id")!==J&&ge.preventDefault()},Nt=ge=>{ge.currentTarget.contains(ge.target)&&(ie.current.focus(),X&&ue.current&&ie.current.selectionEnd-ie.current.selectionStart===0&&ie.current.select(),ue.current=!1)},Xt=ge=>{!y&&(Oe===""||!at)&&St(ge)};let It=$&&Oe.length>0;It=It||(E?ne.length>0:ne!==null);let qt=Me;return P&&(qt=Me.reduce((ge,ye,Be)=>{const gt=P(ye);return ge.length>0&&ge[ge.length-1].group===gt?ge[ge.length-1].options.push(ye):ge.push({key:Be,index:Be,group:gt,options:[ye]}),ge},[])),y&&nt&&Bn(),{getRootProps:(ge={})=>({...ge,onKeyDown:Vn(ge),onMouseDown:Tt,onClick:Nt}),getInputLabelProps:()=>({id:`${J}-label`,htmlFor:J}),getInputProps:()=>({id:J,value:Oe,onBlur:Bn,onFocus:cn,onChange:xe,onMouseDown:Xt,"aria-activedescendant":He?"":null,"aria-autocomplete":r?"both":"list","aria-controls":Et?`${J}-listbox`:void 0,"aria-expanded":Et,autoComplete:"off",ref:ie,autoCapitalize:"none",spellCheck:"false",role:"combobox",disabled:y}),getClearProps:()=>({tabIndex:-1,type:"button",onClick:Ur}),getItemProps:({index:ge=0}={})=>({...E&&{key:ge},...de?{"data-item-index":ge}:{"data-tag-index":ge},tabIndex:-1,...!ae&&{onDelete:E?ut(ge):Rt}}),getPopupIndicatorProps:()=>({tabIndex:-1,type:"button",onClick:St}),getTagProps:({index:ge})=>({key:ge,"data-tag-index":ge,tabIndex:-1,...!ae&&{onDelete:ut(ge)}}),getListboxProps:()=>({role:"listbox",id:`${J}-listbox`,"aria-labelledby":`${J}-label`,ref:$n,onMouseDown:ge=>{ge.preventDefault()}}),getOptionProps:({index:ge,option:ye})=>{const Be=(E?ne:[ne]).some(We=>We!=null&&_(ye,We)),gt=k?k(ye):!1;return{key:R?.(ye)??Z(ye),tabIndex:-1,role:"option",id:`${J}-option-${ge}`,onMouseMove:Te,onClick:Ye,onTouchStart:_e,"data-option-index":ge,"aria-disabled":gt,"aria-selected":Be}},id:J,inputValue:Oe,value:ne,dirty:It,expanded:He&&he,popupOpen:He,focused:nt||le!==-1,anchorEl:he,setAnchorEl:me,focusedItem:le,focusedTag:le,groupedOptions:qt}}function J1e(e){return kn("MuiListSubheader",e)}vn("MuiListSubheader",["root","colorPrimary","colorInherit","gutters","inset","sticky"]);const ewe=e=>{const{classes:t,color:n,disableGutters:r,inset:o,disableSticky:a}=e,i={root:["root",n!=="default"&&`color${zt(n)}`,!r&&"gutters",o&&"inset",!a&&"sticky"]};return Sn(i,J1e,t)},twe=ot("li",{name:"MuiListSubheader",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${zt(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(rr(({theme:e})=>({boxSizing:"border-box",lineHeight:"48px",listStyle:"none",color:(e.vars||e).palette.text.secondary,fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(14),variants:[{props:{color:"primary"},style:{color:(e.vars||e).palette.primary.main}},{props:{color:"inherit"},style:{color:"inherit"}},{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:t})=>t.inset,style:{paddingLeft:72}},{props:({ownerState:t})=>!t.disableSticky,style:{position:"sticky",top:0,zIndex:1,backgroundColor:(e.vars||e).palette.background.paper}}]}))),S$=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiListSubheader"}),{className:r,color:o="default",component:a="li",disableGutters:i=!1,disableSticky:s=!1,inset:l=!1,...d}=n,u={...n,color:o,component:a,disableGutters:i,disableSticky:s,inset:l},m=ewe(u);return p.jsx(twe,{as:a,className:Ht(m.root,r),ref:t,ownerState:u,...d})});S$&&(S$.muiSkipListHighlight=!0);const nwe=rn(p.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function rwe(e){return kn("MuiAutocomplete",e)}const Xn=vn("MuiAutocomplete",["root","expanded","fullWidth","focused","focusVisible","tag","tagSizeSmall","tagSizeMedium","hasPopupIcon","hasClearIcon","inputRoot","input","inputFocused","endAdornment","clearIndicator","popupIndicator","popupIndicatorOpen","popper","popperDisablePortal","paper","listbox","loading","noOptions","option","groupLabel","groupUl"]);var lI,cI;const owe=e=>{const{classes:t,disablePortal:n,expanded:r,focused:o,fullWidth:a,hasClearIcon:i,hasPopupIcon:s,inputFocused:l,popupOpen:d,size:u}=e,m={root:["root",r&&"expanded",o&&"focused",a&&"fullWidth",i&&"hasClearIcon",s&&"hasPopupIcon"],inputRoot:["inputRoot"],input:["input",l&&"inputFocused"],tag:["tag",`tagSize${zt(u)}`],endAdornment:["endAdornment"],clearIndicator:["clearIndicator"],popupIndicator:["popupIndicator",d&&"popupIndicatorOpen"],popper:["popper",n&&"popperDisablePortal"],paper:["paper"],listbox:["listbox"],loading:["loading"],noOptions:["noOptions"],option:["option"],groupLabel:["groupLabel"],groupUl:["groupUl"]};return Sn(m,rwe,t)},awe=ot("div",{name:"MuiAutocomplete",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e,{fullWidth:r,hasClearIcon:o,hasPopupIcon:a,inputFocused:i,size:s}=n;return[{[`& .${Xn.tag}`]:t.tag},{[`& .${Xn.tag}`]:t[`tagSize${zt(s)}`]},{[`& .${Xn.inputRoot}`]:t.inputRoot},{[`& .${Xn.input}`]:t.input},{[`& .${Xn.input}`]:i&&t.inputFocused},t.root,r&&t.fullWidth,a&&t.hasPopupIcon,o&&t.hasClearIcon]}})({[`&.${Xn.focused} .${Xn.clearIndicator}`]:{visibility:"visible"},"@media (pointer: fine)":{[`&:hover .${Xn.clearIndicator}`]:{visibility:"visible"}},[`& .${Xn.tag}`]:{margin:3,maxWidth:"calc(100% - 6px)"},[`& .${Xn.inputRoot}`]:{[`.${Xn.hasPopupIcon}&, .${Xn.hasClearIcon}&`]:{paddingRight:30},[`.${Xn.hasPopupIcon}.${Xn.hasClearIcon}&`]:{paddingRight:56},[`& .${Xn.input}`]:{width:0,minWidth:30}},[`& .${au.root}`]:{paddingBottom:1,"& .MuiInput-input":{padding:"4px 4px 4px 0px"}},[`& .${au.root}.${gi.sizeSmall}`]:{[`& .${au.input}`]:{padding:"2px 4px 3px 0"}},[`& .${Ui.root}`]:{padding:9,[`.${Xn.hasPopupIcon}&, .${Xn.hasClearIcon}&`]:{paddingRight:39},[`.${Xn.hasPopupIcon}.${Xn.hasClearIcon}&`]:{paddingRight:65},[`& .${Xn.input}`]:{padding:"7.5px 4px 7.5px 5px"},[`& .${Xn.endAdornment}`]:{right:9}},[`& .${Ui.root}.${gi.sizeSmall}`]:{paddingTop:6,paddingBottom:6,paddingLeft:6,[`& .${Xn.input}`]:{padding:"2.5px 4px 2.5px 8px"}},[`& .${yi.root}`]:{paddingTop:19,paddingLeft:8,[`.${Xn.hasPopupIcon}&, .${Xn.hasClearIcon}&`]:{paddingRight:39},[`.${Xn.hasPopupIcon}.${Xn.hasClearIcon}&`]:{paddingRight:65},[`& .${yi.input}`]:{padding:"7px 4px"},[`& .${Xn.endAdornment}`]:{right:9}},[`& .${yi.root}.${gi.sizeSmall}`]:{paddingBottom:1,[`& .${yi.input}`]:{padding:"2.5px 4px"}},[`& .${gi.hiddenLabel}`]:{paddingTop:8},[`& .${yi.root}.${gi.hiddenLabel}`]:{paddingTop:0,paddingBottom:0,[`& .${Xn.input}`]:{paddingTop:16,paddingBottom:17}},[`& .${yi.root}.${gi.hiddenLabel}.${gi.sizeSmall}`]:{[`& .${Xn.input}`]:{paddingTop:8,paddingBottom:9}},[`& .${Xn.input}`]:{flexGrow:1,textOverflow:"ellipsis",opacity:0},variants:[{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{[`& .${Xn.tag}`]:{margin:2,maxWidth:"calc(100% - 4px)"}}},{props:{inputFocused:!0},style:{[`& .${Xn.input}`]:{opacity:1}}},{props:{multiple:!0},style:{[`& .${Xn.inputRoot}`]:{flexWrap:"wrap"}}}]}),iwe=ot("div",{name:"MuiAutocomplete",slot:"EndAdornment"})({position:"absolute",right:0,top:"50%",transform:"translate(0, -50%)"}),swe=ot(Eu,{name:"MuiAutocomplete",slot:"ClearIndicator"})({marginRight:-2,padding:4,visibility:"hidden"}),lwe=ot(Eu,{name:"MuiAutocomplete",slot:"PopupIndicator",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.popupIndicator,n.popupOpen&&t.popupIndicatorOpen]}})({padding:2,marginRight:-2,variants:[{props:{popupOpen:!0},style:{transform:"rotate(180deg)"}}]}),cwe=ot(DR,{name:"MuiAutocomplete",slot:"Popper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Xn.option}`]:t.option},t.popper,n.disablePortal&&t.popperDisablePortal]}})(rr(({theme:e})=>({zIndex:(e.vars||e).zIndex.modal,variants:[{props:{disablePortal:!0},style:{position:"absolute"}}]}))),uwe=ot(ef,{name:"MuiAutocomplete",slot:"Paper"})(rr(({theme:e})=>({...e.typography.body1,overflow:"auto"}))),dwe=ot("div",{name:"MuiAutocomplete",slot:"Loading"})(rr(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),fwe=ot("div",{name:"MuiAutocomplete",slot:"NoOptions"})(rr(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),pwe=ot("ul",{name:"MuiAutocomplete",slot:"Listbox"})(rr(({theme:e})=>({listStyle:"none",margin:0,padding:"8px 0",maxHeight:"40vh",overflow:"auto",position:"relative",[`& .${Xn.option}`]:{minHeight:48,display:"flex",overflow:"hidden",justifyContent:"flex-start",alignItems:"center",cursor:"pointer",paddingTop:6,boxSizing:"border-box",outline:"0",WebkitTapHighlightColor:"transparent",paddingBottom:6,paddingLeft:16,paddingRight:16,[e.breakpoints.up("sm")]:{minHeight:"auto"},[`&.${Xn.focused}`]:{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},'&[aria-disabled="true"]':{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:"none"},[`&.${Xn.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},'&[aria-selected="true"]':{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${Xn.focused}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:(e.vars||e).palette.action.selected}},[`&.${Xn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))),hwe=ot(S$,{name:"MuiAutocomplete",slot:"GroupLabel"})(rr(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,top:-8}))),mwe=ot("ul",{name:"MuiAutocomplete",slot:"GroupUl"})({padding:0,[`& .${Xn.option}`]:{paddingLeft:24}}),gwe=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiAutocomplete"}),{autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:i=!1,ChipProps:s,className:l,clearIcon:d=lI||(lI=p.jsx(nwe,{fontSize:"small"})),clearOnBlur:u=!n.freeSolo,clearOnEscape:m=!1,clearText:g="Clear",closeText:y="Close",componentsProps:x,defaultValue:w=n.multiple?[]:null,disableClearable:S=!1,disableCloseOnSelect:b=!1,disabled:$=!1,disabledItemsFocusable:k=!1,disableListWrap:R=!1,disablePortal:O=!1,filterOptions:P,filterSelectedOptions:D=!1,forcePopupIcon:A="auto",freeSolo:F=!1,fullWidth:L=!1,getLimitTagsText:_=we=>`+${we}`,getOptionDisabled:E,getOptionKey:z,getOptionLabel:I,isOptionEqualToValue:U,groupBy:N,handleHomeEndKeys:q=!n.freeSolo,id:Y,includeInputInList:oe=!1,inputValue:Q,limitTags:ae=-1,ListboxComponent:de,ListboxProps:X,loading:se=!1,loadingText:J="Loading…",multiple:Z=!1,noOptionsText:G="No options",onChange:ue,onClose:ie,onHighlightChange:fe,onInputChange:he,onOpen:me,open:le,openOnFocus:ve=!1,openText:Le="Open",options:Ie,PaperComponent:Re,PopperComponent:ne,popupIcon:qe=cI||(cI=p.jsx(U3,{})),readOnly:Oe=!1,renderGroup:Qe,renderInput:nt,renderOption:kt,renderTags:Ut,renderValue:at,selectOnFocus:et=!n.freeSolo,size:pt="medium",slots:ze={},slotProps:be={},value:He,...Me}=n,{getRootProps:$t,getInputProps:Et,getInputLabelProps:vt,getPopupIndicatorProps:it,getClearProps:st,getItemProps:At,getListboxProps:tn,getOptionProps:Bt,value:an,dirty:$n,expanded:Vt,id:Pn,popupOpen:Se,focused:jn,focusedItem:En,anchorEl:Jt,setAnchorEl:Pt,inputValue:Ur,groupedOptions:Vn}=Z1e({...n,componentName:"Autocomplete"}),cn=!S&&!$&&$n&&!Oe,Bn=(!F||A===!0)&&A!==!1,{onMouseDown:xe}=Et(),{ref:Te,..._e}=tn(),Ye=I||(we=>we.label??we),ut={...n,disablePortal:O,expanded:Vt,focused:jn,fullWidth:L,getOptionLabel:Ye,hasClearIcon:cn,hasPopupIcon:Bn,inputFocused:En===-1,popupOpen:Se,size:pt},Rt=owe(ut),St={slots:{paper:Re,popper:ne,...ze},slotProps:{chip:s,listbox:X,...x,...be}},[Tt,Nt]=mr("listbox",{elementType:pwe,externalForwardedProps:St,ownerState:ut,className:Rt.listbox,additionalProps:_e,ref:Te}),[Xt,It]=mr("paper",{elementType:ef,externalForwardedProps:St,ownerState:ut,className:Rt.paper}),[qt,ge]=mr("popper",{elementType:DR,externalForwardedProps:St,ownerState:ut,className:Rt.popper,additionalProps:{disablePortal:O,style:{width:Jt?Jt.clientWidth:null},role:"presentation",anchorEl:Jt,open:Se}});let ye;const Be=we=>({className:Rt.tag,disabled:$,...At(we)});if(Z?an.length>0&&(Ut?ye=Ut(an,Be,ut):at?ye=at(an,Be,ut):ye=an.map((we,Pe)=>{const{key:ft,...Ct}=Be({index:Pe});return p.jsx(M3,{label:Ye(we),size:pt,...Ct,...St.slotProps.chip},ft)})):at&&an!=null&&(ye=at(an,Be,ut)),ae>-1&&Array.isArray(ye)){const we=ye.length-ae;!jn&&we>0&&(ye=ye.splice(0,ae),ye.push(p.jsx("span",{className:Rt.tag,children:_(we)},ye.length)))}const gt=Qe||(we=>p.jsxs("li",{children:[p.jsx(hwe,{className:Rt.groupLabel,ownerState:ut,component:"div",children:we.group}),p.jsx(mwe,{className:Rt.groupUl,ownerState:ut,children:we.children})]},we.key)),We=kt||((we,Pe)=>{const{key:ft,...Ct}=we;return p.jsx("li",{...Ct,children:Ye(Pe)},ft)}),Dt=(we,Pe)=>{const ft=Bt({option:we,index:Pe});return We({...ft,className:Rt.option},we,{selected:ft["aria-selected"],index:Pe,inputValue:Ur},ut)},Kt=St.slotProps.clearIndicator,sn=St.slotProps.popupIndicator;return p.jsxs(C.Fragment,{children:[p.jsx(awe,{ref:t,className:Ht(Rt.root,l),ownerState:ut,...$t(Me),children:nt({id:Pn,disabled:$,fullWidth:!0,size:pt==="small"?"small":void 0,InputLabelProps:vt(),InputProps:{ref:Pt,className:Rt.inputRoot,startAdornment:ye,onMouseDown:we=>{we.target===we.currentTarget&&xe(we)},...(cn||Bn)&&{endAdornment:p.jsxs(iwe,{className:Rt.endAdornment,ownerState:ut,children:[cn?p.jsx(swe,{...st(),"aria-label":g,title:g,ownerState:ut,...Kt,className:Ht(Rt.clearIndicator,Kt?.className),children:d}):null,Bn?p.jsx(lwe,{...it(),disabled:$,"aria-label":Se?y:Le,title:Se?y:Le,ownerState:ut,...sn,className:Ht(Rt.popupIndicator,sn?.className),children:qe}):null]})}},inputProps:{className:Rt.input,disabled:$,readOnly:Oe,...Et()}})}),Jt?p.jsx(cwe,{as:qt,...ge,children:p.jsxs(uwe,{as:Xt,...It,children:[se&&Vn.length===0?p.jsx(dwe,{className:Rt.loading,ownerState:ut,children:J}):null,Vn.length===0&&!F&&!se?p.jsx(fwe,{className:Rt.noOptions,ownerState:ut,role:"presentation",onMouseDown:we=>{we.preventDefault()},children:G}):null,Vn.length>0?p.jsx(Tt,{as:de,...Nt,children:Vn.map((we,Pe)=>N?gt({key:we.key,group:we.group,children:we.options.map((ft,Ct)=>Dt(ft,we.index+Ct))}):Dt(we,Pe))}):null]})}):null]})});jr.extend(dR);const ywe=rn(p.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),o6=e=>{if(!e)return"Explore semantic models, run queries, and build reports";const t=e.replace(/^#+\s+/gm,"").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`]+)`/g,"$1").trim(),n=t.split(/\n\s*\n/)[1]||t;if(n.length<=120)return n;const r=n.substring(0,120).split(" ");return r.pop(),r.join(" ")+"..."},a6=(e,t)=>{const n=(e.readme||void 0)?.split(`
478
+ `}function Mxe(e,t){return[e,"rows",...t].join("_").replace(/[^A-Za-z0-9._-]+/g,"_").replace(/_+/g,"_").replace(/^[_.]+|[_.]+$/g,"").slice(0,120)||"rows"}function Oxe(e,t,n){return n==="server_default"&&t!==void 0&&e>=t?t:void 0}const HN="Download the rows behind this value as CSV, up to the server's row limit",Pxe=4e4;function jxe(e,t){const n=URL.createObjectURL(new Blob([e],{type:"text/csv;charset=utf-8"})),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),Pxe)}function Axe(e){const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error&&e.message!==""?e.message:"The request failed."}function Dxe({query:e,preamble:t,environmentName:n,packageName:r,modelPath:o,versionId:a,givens:i,fileName:s}){const{apiClients:l}=er(),[d,u]=C.useState(!1),[m,g]=C.useState(HN),[y,x]=C.useState(void 0),w=C.useRef(void 0);C.useEffect(()=>()=>w.current?.abort(),[]);const S=async()=>{w.current?.abort();const b=new AbortController;w.current=b,u(!0),x(void 0);try{const $=await l.models.executeQueryModel(n,r,o,{query:t===void 0?e:b1(t,e),givens:i,versionId:a},void 0,void 0,{signal:b.signal});if(b.signal.aborted)return;const k=$.data,R=JSON.parse(k.result??"{}"),O=Oxe(Q_(R).length,k.queryRowLimit,k.queryRowLimitSource);g(O===void 0?HN:`First ${O} rows: the server's row limit, so there may be more`),jxe(Txe(R),O===void 0?`${s}.csv`:`${s}_first_${O}_rows_server_limit.csv`)}catch($){if(b.signal.aborted)return;x(`Download failed: ${Axe($)}`)}finally{w.current===b&&(w.current=void 0,u(!1))}};return p.jsxs(Ee,{sx:{display:"flex",alignItems:"center",gap:1},children:[y&&p.jsx(wt,{role:"alert",variant:"caption",color:"error",sx:{maxWidth:320},children:y}),p.jsx(Br,{title:m,children:p.jsx("span",{children:p.jsx(Hn,{size:"small",startIcon:p.jsx(Exe,{fontSize:"small"}),onClick:()=>void S(),disabled:d,children:"Download CSV"})})})]})}const X_=200;function Nxe(e){const{target:t}=e;if(t!==void 0&&!(e.dimensions===void 0&&e.code===void 0))return{...e,target:t}}function WN(e,t=X_){const n=Lxe(e);if(n===void 0)return;const r=[...e.target.filters,...n].join(", "),o=e.timezone?`timezone: '${uR(e.timezone)}'; `:"",a=t===null?"":`; limit: ${t}`,i=Ixe(e.target.source);if(i!==void 0)return`run: ${i} -> { ${o}where: ${r}; select: *${a} }`}function Ixe(e){return Wy(e)?e:e.includes("`")?void 0:`\`${e}\``}function TC(e){return/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(e)?e:`(${e})`}function Lxe(e){if(e.dimensions){const n=[];for(const{code:r,value:o}of e.dimensions){if(o.kind==="null_literal"){n.push(`${TC(r)} is null`);continue}const a=B_(o,e.timezone);if(a===void 0)return;n.push(`${TC(r)} = ${a}`)}return n}const t=Wle(e.rawValue);return e.code!==void 0&&t?[`${TC(e.code)} = ${t}`]:void 0}const zxe="This value cannot be written as a filter, so its rows cannot be fetched.";function YN(e){const t=e.drillClauses?__(e.drillClauses,e.timezone):[];return t.length>0?t:[{field:e.field,label:e.label}]}function Fxe({request:e,environmentName:t,packageName:n,versionId:r,modelPath:o,preamble:a,givens:i,onClose:s,onDone:l,actions:d}){const{theme:u}=Hr(),m=e?WN(e):void 0,g=e?WN(e,null):void 0,y=e&&g!==void 0?{query:g,...a===void 0?{}:{preamble:a},environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r},givens:i,fileName:Mxe(e.target.source,YN(e).map(x=>x.label))}:void 0;return p.jsxs(Fx,{open:e!==void 0,onClose:s,maxWidth:"lg",fullWidth:!0,children:[p.jsxs(Bx,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",pb:.5},children:[p.jsxs(Ee,{children:[e?p.jsxs(p.Fragment,{children:["Rows where"," ",YN(e).map((x,w)=>p.jsxs(C.Fragment,{children:[w>0&&" and ",p.jsx(Ee,{component:"code",sx:{fontSize:"0.9em"},children:x.field})," ","is ",x.label]},w))]}):"Rows",p.jsx(wt,{component:"div",variant:"caption",sx:{color:u.tileTitle,mt:.25},children:e?`The first ${X_} rows of ${e.target.source} behind this value, with the tile's own filters and the controls applied.`:""})]}),p.jsxs(Ee,{sx:{display:"flex",alignItems:"center",gap:1,ml:1},children:[y&&(d?d(y):p.jsx(Dxe,{...y})),p.jsx(no,{onClick:s,"aria-label":"Close",size:"small",sx:{color:"text.secondary"},children:p.jsx(bh,{fontSize:"small"})})]})]}),p.jsxs(_x,{dividers:!0,sx:{p:0,minHeight:240},children:[m===void 0&&e&&p.jsx(wt,{variant:"body2",sx:{p:2},children:zxe}),m!==void 0&&p.jsx(_xe,{query:a===void 0?m:b1(a,m),environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:o,givens:i,...l?{onDone:l}:{}})]}),p.jsxs(cz,{sx:{px:3,py:1.5},children:[m!==void 0&&p.jsx(wt,{variant:"caption",sx:{mr:"auto",color:u.tileTitle,fontFamily:u.ui.font.mono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:m,children:m}),p.jsx(Hn,{onClick:s,children:"Close"})]})]})}function _xe({query:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:a,onDone:i}){const s=t2({environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r},query:e,givens:a}),{isSuccess:l,isError:d}=s,u=C.useRef(void 0);return C.useEffect(()=>{u.current=Od()},[e]),C.useEffect(()=>{u.current===void 0||!l&&!d||(i?.(l,Od()-u.current),u.current=void 0)},[l,d,i]),p.jsx(Ee,{sx:{p:1},children:p.jsx(GR,{state:s,context:e})})}function Bxe({manifest:e,environmentName:t,packageName:n,versionId:r,documentName:o,givens:a,onGivensChange:i,onNavigate:s,height:l,maxResultSize:d,controlsLayout:u="bar",preamble:m,runModelPath:g,hiddenGivens:y,literalReads:x,onLinkNavigate:w,actions:S,rowsActions:b}){const $=C.useMemo(()=>w?{environmentName:t,packageName:n,sourcePath:e.path??o,onNavigate:w}:void 0,[t,n,e.path,o,w]),k=C.useMemo(()=>(e.givens??[]).filter(ie=>!(m!==void 0&&ie.secure===!0)&&!(ie.name!==void 0&&y?.includes(ie.name))),[e,y,m]),R=C.useMemo(()=>a===void 0?void 0:Object.fromEntries(Object.entries(a).filter(([,ie])=>typeof ie=="string")),[a]),O=gR({specs:k,loaded:!0,startingValues:e.startingGivens,params:R,onGivensChange:i,documentKey:`${t}/${n}/${r??""}/${o}`,autorun:e.autorun!==!1,environmentName:t,packageName:n,modelPath:g??e.path,versionId:r,documentName:o,...m!==void 0?{preamble:m}:{},...a?{hostGivens:a}:{}}),{applied:P,declaredTypes:D,canSelf:A,onSelf:F}=O,L=y1(),_=C.useMemo(()=>{const ie=new Set((e.tiles??[]).flatMap(fe=>fe.givenNames??[]));return Object.fromEntries(Object.entries(a??{}).filter(([fe])=>ie.has(fe)&&!D.has(fe)))},[e,a,D]),[E,z]=C.useState(void 0),I=C.useCallback(ie=>{const fe=Nxe(ie);fe!==void 0&&z(fe)},[]),U=C.useMemo(()=>hR(Zd(P,D),_),[P,D,_]),{reports:N}=b_(t,n,r,s!==void 0),q=C.useCallback(ie=>{const fe=S0e(ie,N);if(fe.kind!=="path")return;const he=fe.report.path;return N.find(me=>me.path===he)?.title||void 0},[N]),{bindingFor:Y,drillMenu:oe}=K_({onNavigate:s,onSelf:F,canSelf:A,onRows:I,destinationTitle:q}),Q=C.useCallback((ie,fe)=>Y(ie,fe!==!0),[Y]),{columns:ae,layout:de,tileMaxHeight:X,tableMaxHeight:se}=Lle(e.layout,e.dashboardColumns),J=C.useMemo(()=>Bbe(k,P,a),[k,P,a]);if(e.error)return p.jsx(y$,{layout:de,header:p.jsx(GN,{manifest:e,links:$,actions:S}),children:p.jsx(xo,{severity:"error",children:e.error})});const Z=g??e.path,G=e.tiles??[],ue=iF(G);return p.jsxs(y$,{layout:de,header:p.jsx(GN,{manifest:e,links:$,actions:S}),controls:k.length>0?p.jsx(S_,{children:p.jsx(A1,{...O.panel,layout:u})}):void 0,children:[J.length>0&&p.jsx(xo,{severity:"info",children:Vbe(J)}),Z===void 0?p.jsx(xo,{severity:"error",children:"This dashboard has no model path, so there is nothing to run."}):G.length>0?p.jsx(ele,{tiles:G,columns:ae,minTilePx:rF,rowGapPx:vl,keyOf:(ie,fe)=>`${fe}:${ie.kind==="text"?`text:${ie.name}`:ie.query}`,renderTile:(ie,fe)=>ie.kind==="text"||ie.query===void 0?p.jsx(Ee,{sx:ie.rowspan!==void 0||ue?{minHeight:0,overflow:"auto"}:void 0,children:p.jsx(Uxe,{markdown:ie.markdown??"",links:$})}):p.jsx(z_,{index:fe,environmentName:t,packageName:n,versionId:r,modelPath:Z,tile:ie.query,label:ie.label,subtitle:ie.subtitle,borderless:ie.borderless,givens:P,hostGivens:_,declaredTypes:D,givenNames:ie.givenNames,height:ie.rowspan!==void 0||ue?nF(ie.rowspan??aF.query):de==="grid"?l??X:X,tableMaxHeight:se,fixedHeight:ie.rowspan!==void 0||ue,maxResultSize:d,drill:Q(ie.query,ie.restricted),ignoredFilters:p0e(ie.givenNames&&(ie.query&&x?.[ie.query]?[...ie.givenNames,...x[ie.query]]:ie.givenNames),k),...m!==void 0?{preamble:m,restricted:ie.restricted}:{},...(()=>{const he=Ube(J,ie.givenNames);return he.length>0?{waitingFor:qbe(he)}:{}})()})}):p.jsx(xo,{severity:"warning",children:"This dashboard names neither a query nor any tiles."}),oe,Z!==void 0&&p.jsx(Fxe,{request:E,environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:Z,...m===void 0?{}:{preamble:m},givens:U,...b===void 0?{}:{actions:b},onClose:()=>z(void 0),onDone:(ie,fe)=>{E&&L.emit({type:"report.rows_shown",source:E.target.source,view:E.target.queryName??"",field:E.field,ok:ie,durationMs:fe})}})]})}function Uxe({markdown:e,links:t}){return p.jsx(QR,{children:p.jsx(xy,{variant:"document",links:t,children:e})})}function GN({manifest:e,links:t,actions:n}){return p.jsx(N0e,{title:e.title??e.name,actions:n,description:e.description?p.jsx(QR,{children:p.jsx(xy,{variant:"document",links:t,children:e.description})}):void 0})}const Z_=rn(p.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),Vxe="publisher:resize";function qxe(e){return typeof e=="object"&&e!==null&&e.type===Vxe&&typeof e.height=="number"}const Hxe="publisher:color-scheme",Wxe="publisher:color-scheme-request",Yxe="publisher:color-scheme-applied",Gxe=e=>e==="light"||e==="dark";function Kxe(e){return typeof e=="object"&&e!==null&&e.type===Wxe}function Qxe(e){return typeof e=="object"&&e!==null&&e.type===Yxe&&Gxe(e.mode)}function J_(e){return e.replace(/\/api\/v0\/?$/,"")}function Xxe({server:e,environmentName:t,packageName:n,path:r,versionId:o}){const a=r.startsWith("public/")?r.slice(7):r,i=`${J_(e)}/environments/${encodeURIComponent(t)}/packages/${encodeURIComponent(n)}/`+a;return o===void 0?i:`${i}${i.includes("?")?"&":"?"}versionId=${encodeURIComponent(o)}`}function Zxe(e){try{const{environmentName:t,packageName:n,modelPath:r,versionId:o}=ko(e);return!t||!n||!r?null:{environmentName:t,packageName:n,dataAppPath:r,versionId:o}}catch{return null}}function M2e({resourceUri:e}){const{server:t,apiClients:n}=er(),r=Zxe(e),o=r?.environmentName??"",a=r?.packageName??"",i=r?.dataAppPath??"",s=r?.versionId,l=C.useMemo(()=>Xxe({server:t,environmentName:o,packageName:a,path:i,...s!==void 0?{versionId:s}:{}}),[t,o,a,i,s]),d=wo({queryKey:["data-apps",o,a,s],queryFn:()=>n.dataApps.listDataApps(o,a,s),enabled:!!r}).data?.data?.find(O=>O.path===i),u=d?.title??i,m=d?.fit==="viewport",g=C.useRef(null),[y,x]=C.useState(120),w=El().palette.mode==="dark"?"dark":"light",S=C.useRef(w);S.current=w;const[b,$]=C.useState(null),k=C.useMemo(()=>{try{return new URL(l,window.location.href).origin}catch{return null}},[l]),R=C.useCallback(()=>{const O=g.current?.contentWindow;!O||!k||O.postMessage({type:Hxe,mode:S.current},k)},[k]);return C.useEffect(R,[w,R]),C.useEffect(()=>{function O(P){P.source===g.current?.contentWindow&&(k&&P.origin!==k||(Kxe(P.data)?R():Qxe(P.data)&&$(P.data.mode)))}return window.addEventListener("message",O),()=>window.removeEventListener("message",O)},[k,R]),C.useEffect(()=>{if(m)return;function O(P){qxe(P.data)&&P.source===g.current?.contentWindow&&P.data.height>0&&x(Math.ceil(P.data.height))}return window.addEventListener("message",O),()=>window.removeEventListener("message",O)},[m]),r?p.jsxs(Ee,{sx:{p:3,...m?{height:"100%",display:"flex",flexDirection:"column"}:{maxWidth:1600,mx:"auto"}},children:[p.jsxs(Wn,{direction:"row",alignItems:"baseline",spacing:1,sx:{mb:1,flexShrink:0},children:[p.jsx(wt,{variant:"h6",sx:{fontWeight:"fontWeightMedium",letterSpacing:"-0.025em"},children:u}),p.jsx(wt,{variant:"caption",color:"text.secondary",sx:{fontFamily:Fo},children:i}),p.jsx(Ee,{sx:{flex:1}}),p.jsx(Br,{title:"Open standalone in new tab",children:p.jsx(no,{size:"small",href:l,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",sx:{color:"text.secondary"},children:p.jsx(Z_,{fontSize:"small"})})})]}),p.jsx(Ee,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,overflow:"hidden",backgroundColor:"background.paper",...m?{flex:1,minHeight:0}:{}},children:p.jsx("iframe",{ref:g,src:l,onLoad:()=>{$(null),R()},title:u,sandbox:"allow-scripts allow-same-origin allow-forms allow-downloads allow-popups",allow:"clipboard-write; fullscreen",style:{display:"block",width:"100%",height:m?"100%":y,border:0,...b?{colorScheme:b}:{}}})})]}):p.jsxs(Ee,{sx:{p:3,maxWidth:1600,mx:"auto"},children:[p.jsx(wt,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Can't open data app"}),p.jsxs(wt,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["This data app link is missing an environment, package, or path:",p.jsx(Ee,{component:"span",sx:{fontFamily:Fo,ml:1},children:e})]})]})}function Ds({title:e,count:t,description:n,action:r,children:o}){const a=C.useId();return p.jsxs(Ee,{component:"section","aria-labelledby":a,sx:{mb:4},children:[p.jsxs(Wn,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:n?0:1,minHeight:40},children:[p.jsxs(Wn,{direction:"row",alignItems:"baseline",spacing:1,children:[p.jsx(wt,{id:a,variant:"h6",sx:{fontWeight:600,letterSpacing:"-0.025em",lineHeight:1.2},children:e}),t!==void 0&&p.jsxs(wt,{variant:"caption",color:"text.secondary",children:["(",t,")"]})]}),r]}),n&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:n}),p.jsx(Ee,{children:o})]})}function Jxe({resourceUri:e}){const{environmentName:t}=ko(e),{apiClients:n}=er(),[r,o]=C.useState(!1),a=90,{data:i,isSuccess:s,isError:l,error:d}=wo({queryKey:["about",t],queryFn:()=>n.environments.getEnvironment(t,!1)}),u=i?.data?.readme||"",m=u.split(/\s+/),g=m.length>a,y=m.slice(0,a).join(" ");return p.jsxs(p.Fragment,{children:[!s&&!l&&p.jsx(Go,{text:"Fetching About..."}),s&&u&&p.jsxs(Ds,{title:"Readme",children:[p.jsx(xy,{variant:"caption",children:r||!g?u:y}),g&&p.jsx(Ee,{sx:{mt:1},children:p.jsx(Xy,{label:r?"Read less":"Read more",onClick:()=>o(!r)})})]}),l&&p.jsx(Xa,{error:d,context:`${t} > About`})]})}function e1e(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:a}=e,i=vR();C.useEffect(()=>{if(!o)return;function S(b){b.defaultPrevented||b.key==="Escape"&&r?.(b,"escapeKeyDown")}return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[o,r]);const s=Yt((S,b)=>{r?.(S,b)}),l=Yt(S=>{!r||S==null||i.start(S,()=>{s(null,"timeout")})});C.useEffect(()=>(o&&l(t),i.clear),[o,t,l,i]);const d=S=>{r?.(S,"clickaway")},u=i.clear,m=C.useCallback(()=>{t!=null&&l(a??t*.5)},[t,a,l]),g=S=>b=>{const $=S.onBlur;$?.(b),m()},y=S=>b=>{const $=S.onFocus;$?.(b),u()},x=S=>b=>{const $=S.onMouseEnter;$?.(b),u()},w=S=>b=>{const $=S.onMouseLeave;$?.(b),m()};return C.useEffect(()=>{if(!n&&o)return window.addEventListener("focus",m),window.addEventListener("blur",u),()=>{window.removeEventListener("focus",m),window.removeEventListener("blur",u)}},[n,o,m,u]),{getRootProps:(S={})=>{const b={...q0(e),...q0(S)};return{role:"presentation",...S,...b,onBlur:g(b),onFocus:y(b),onMouseEnter:x(b),onMouseLeave:w(b)}},onClickAway:d}}function KN(e){return e.substring(2).toLowerCase()}function t1e(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function n1e(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:a="onTouchEnd"}=e,i=C.useRef(!1),s=C.useRef(null),l=C.useRef(!1),d=C.useRef(!1);C.useEffect(()=>(setTimeout(()=>{l.current=!0},0),()=>{l.current=!1}),[]);const u=vr(xh(t),s),m=Yt(x=>{const w=d.current;d.current=!1;const S=Wo(s.current);if(!l.current||!s.current||"clientX"in x&&t1e(x,S))return;if(i.current){i.current=!1;return}let b;x.composedPath?b=x.composedPath().includes(s.current):b=!S.documentElement.contains(x.target)||s.current.contains(x.target),!b&&(n||!w)&&o(x)}),g=x=>w=>{d.current=!0;const S=t.props[x];S&&S(w)},y={ref:u};return a!==!1&&(y[a]=g(a)),C.useEffect(()=>{if(a!==!1){const x=KN(a),w=Wo(s.current),S=()=>{i.current=!0};return w.addEventListener(x,m),w.addEventListener("touchmove",S),()=>{w.removeEventListener(x,m),w.removeEventListener("touchmove",S)}}},[m,a]),r!==!1&&(y[r]=g(r)),C.useEffect(()=>{if(r!==!1){const x=KN(r),w=Wo(s.current);return w.addEventListener(x,m),()=>{w.removeEventListener(x,m)}}},[m,r]),C.cloneElement(t,y)}function r1e(e){return kn("MuiSnackbarContent",e)}vn("MuiSnackbarContent",["root","message","action"]);const o1e=e=>{const{classes:t}=e;return Sn({root:["root"],action:["action"],message:["message"]},r1e,t)},a1e=ot(ef,{name:"MuiSnackbarContent",slot:"Root"})(rr(({theme:e})=>{const t=e.palette.mode==="light"?.8:.98;return{...e.typography.body2,color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(Fk(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:Fk(e.palette.background.default,t),display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}}})),i1e=ot("div",{name:"MuiSnackbarContent",slot:"Message"})({padding:"8px 0"}),s1e=ot("div",{name:"MuiSnackbarContent",slot:"Action"})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),l1e=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:a,role:i="alert",...s}=n,l=n,d=o1e(l);return p.jsxs(a1e,{role:i,elevation:6,className:Ht(d.root,o),ownerState:l,ref:t,...s,children:[p.jsx(i1e,{className:d.message,ownerState:l,children:a}),r?p.jsx(s1e,{className:d.action,ownerState:l,children:r}):null]})});function c1e(e){return kn("MuiSnackbar",e)}vn("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const u1e=e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${zt(n.vertical)}${zt(n.horizontal)}`]};return Sn(r,c1e,t)},d1e=ot("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${zt(n.anchorOrigin.vertical)}${zt(n.anchorOrigin.horizontal)}`]]}})(rr(({theme:e})=>({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center",variants:[{props:({ownerState:t})=>t.anchorOrigin.vertical==="top",style:{top:8,[e.breakpoints.up("sm")]:{top:24}}},{props:({ownerState:t})=>t.anchorOrigin.vertical!=="top",style:{bottom:8,[e.breakpoints.up("sm")]:{bottom:24}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="left",style:{justifyContent:"flex-start",[e.breakpoints.up("sm")]:{left:24,right:"auto"}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="right",style:{justifyContent:"flex-end",[e.breakpoints.up("sm")]:{right:24,left:"auto"}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="center",style:{[e.breakpoints.up("sm")]:{left:"50%",right:"auto",transform:"translateX(-50%)"}}}]}))),f1e=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiSnackbar"}),r=Qd(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:a,anchorOrigin:{vertical:i,horizontal:s}={vertical:"bottom",horizontal:"left"},autoHideDuration:l=null,children:d,className:u,ClickAwayListenerProps:m,ContentProps:g,disableWindowBlurListener:y=!1,message:x,onBlur:w,onClose:S,onFocus:b,onMouseEnter:$,onMouseLeave:k,open:R,resumeHideDuration:O,slots:P={},slotProps:D={},TransitionComponent:A,transitionDuration:F=o,TransitionProps:{onEnter:L,onExited:_,...E}={},...z}=n,I={...n,anchorOrigin:{vertical:i,horizontal:s},autoHideDuration:l,disableWindowBlurListener:y,TransitionComponent:A,transitionDuration:F},U=u1e(I),{getRootProps:N,onClickAway:q}=e1e({...I}),[Y,oe]=C.useState(!0),Q=me=>{oe(!0),_&&_(me)},ae=(me,le)=>{oe(!1),L&&L(me,le)},de={slots:{transition:A,...P},slotProps:{content:g,clickAwayListener:m,transition:E,...D}},[X,se]=mr("root",{ref:t,className:[U.root,u],elementType:d1e,getSlotProps:N,externalForwardedProps:{...de,...z},ownerState:I}),[J,{ownerState:Z,...G}]=mr("clickAwayListener",{elementType:n1e,externalForwardedProps:de,getSlotProps:me=>({onClickAway:(...le)=>{const ve=le[0];me.onClickAway?.(...le),!ve?.defaultMuiPrevented&&q(...le)}}),ownerState:I}),[ue,ie]=mr("content",{elementType:l1e,shouldForwardComponentProp:!0,externalForwardedProps:de,additionalProps:{message:x,action:a},ownerState:I}),[fe,he]=mr("transition",{elementType:my,externalForwardedProps:de,getSlotProps:me=>({onEnter:(...le)=>{me.onEnter?.(...le),ae(...le)},onExited:(...le)=>{me.onExited?.(...le),Q(...le)}}),additionalProps:{appear:!0,in:R,timeout:F,direction:i==="top"?"down":"up"},ownerState:I});return!R&&Y?null:p.jsx(J,{...G,...P.clickAwayListener&&{ownerState:Z},children:p.jsx(X,{...se,children:p.jsx(fe,{...he,children:d||p.jsx(ue,{...ie})})})})});let x$;function p1e(e){x$=e}function QN(e){if(x$)try{x$(e)}catch{}}function oc(e,t,n){return(async r=>{const o=Date.now();try{const a=await n(r);return QN({type:"console.mutation",resource:e,action:t,ok:!0,durationMs:Date.now()-o}),a}catch(a){throw QN({type:"console.mutation",resource:e,action:t,ok:!1,durationMs:Date.now()-o,reason:a instanceof Error?a.message:"An unknown error occurred"}),a}})}function Ch({mutationFn:e,success:t,invalidates:n,closeDialog:r,resource:o,action:a}){const i=Tl(),[s,l]=C.useState(""),d=hl({mutationFn:oc(o,a,e),onSuccess(){r();for(const u of n)i.invalidateQueries({queryKey:u});l(t)},onError(u){l(u instanceof Error?u.message:"An unknown error occurred")}});return{mutate:d.mutate,isPending:d.isPending,notice:p.jsx(f1e,{open:s!=="",autoHideDuration:6e3,onClose:()=>l(""),message:s})}}const e6="https://docs.malloydata.dev/documentation",XN=`${e6}/user_guides/publishing`,Bb="https://github.com/malloydata/publisher/blob/main/docs",tu={docsHome:`${e6}/`,publishing:`${XN}/publishing`,mcpAgents:`${XN}/mcp_agents`,surfaces:`${Bb}/choosing-a-surface.md`,givens:`${Bb}/givens.md`,materialization:`${Bb}/materialization.md`,connections:`${Bb}/connections.md`};function h1e({resourceUri:e}){const[t,n]=C.useState(!1),{apiClients:r}=er(),{environmentName:o}=ko(e),a=Ch({mutationFn(s){return r.packages.createPackage(o,{name:s.name,description:s.description,location:s.location})},success:"Package created",invalidates:[["packages",o]],closeDialog:()=>n(!1),resource:"package",action:"create"}),i=s=>{s.preventDefault();const l=new FormData(s.currentTarget),d=l.get("name")?.toString(),u=l.get("description")?.toString(),m=l.get("location")?.toString();a.mutate({name:d,description:u,location:m})};return p.jsxs(p.Fragment,{children:[p.jsx(Qy,{label:"Package",onClick:()=>n(!0)}),p.jsx(Oo,{open:t,onClose:()=>n(!1),title:"New package",description:p.jsxs(p.Fragment,{children:["A package is a directory of Malloy models and their data. Give its location as a GitHub, S3 or GCS URL, or an absolute path the server can read; see the"," ",p.jsx(Ee,{component:"a",href:tu.publishing,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary"},children:"package format"}),"."]}),actions:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{disabled:a.isPending,onClick:()=>n(!1),children:"Cancel"}),p.jsx(Hn,{type:"submit",form:"package-form",variant:"contained",loading:a.isPending,children:"Create package"})]}),children:p.jsx("form",{onSubmit:i,id:"package-form",children:p.jsxs(Wn,{sx:{gap:2},children:[p.jsx(ki,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx(ki,{id:"description",name:"description",label:"Description",multiline:!0,rows:3,fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx(ki,{id:"location",name:"location",label:"Location",type:"text",placeholder:"e.g. s3://my-bucket/my-package.zip",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}})]})})}),a.notice]})}const m1e=rn(p.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}));function L1({icon:e,tint:t,label:n,mono:r,description:o,rightLabel:a,trailingAction:i,onClick:s,ariaLabel:l}){const d=!!s;return p.jsxs(Ee,{onClick:s,onKeyDown:d?u=>{s&&(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s(u))}:void 0,role:d?"button":void 0,tabIndex:d?0:void 0,"aria-label":l,sx:u=>({display:"flex",alignItems:"center",gap:1.5,py:1,px:1,mx:-1,cursor:d?"pointer":"default",borderRadius:1.5,transition:"background-color 0.1s","&:hover":d?{backgroundColor:u.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}:void 0,"&:focus-visible":d?{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}:void 0}),children:[p.jsx(Ee,{sx:{width:32,height:32,borderRadius:1,bgcolor:t,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e}),p.jsxs(Ee,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"baseline",gap:1.5},children:[p.jsx(wt,{variant:"body2",sx:{...r?{fontFamily:Fo}:{},flexShrink:0,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),o&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o})]}),a&&p.jsx(wt,{variant:"caption",color:"text.secondary",sx:{flexShrink:0},children:a}),i&&p.jsx(Ee,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:i})]})}const t6=rn(p.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"})),g1e=vn("MuiBox",["root"]),y1e=Z4(),Ta=aE({themeId:vh,defaultTheme:y1e,defaultClassName:g1e.root,generateClassName:z4.generate}),z1=fE({createStyledComponent:ot("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>tr({props:e,name:"MuiStack"})}),ZN=vn("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);function v1e(e){return kn("MuiListItemIcon",e)}const JN=vn("MuiListItemIcon",["root","alignItemsFlexStart"]),b1e=e=>{const{alignItems:t,classes:n}=e;return Sn({root:["root",t==="flex-start"&&"alignItemsFlexStart"]},v1e,n)},x1e=ot("div",{name:"MuiListItemIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.alignItems==="flex-start"&&t.alignItemsFlexStart]}})(rr(({theme:e})=>({minWidth:56,color:(e.vars||e).palette.action.active,flexShrink:0,display:"inline-flex",variants:[{props:{alignItems:"flex-start"},style:{marginTop:8}}]}))),n2=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiListItemIcon"}),{className:r,...o}=n,a=C.useContext(sc),i={...n,alignItems:a.alignItems},s=b1e(i);return p.jsx(x1e,{className:Ht(s.root,r),ownerState:i,ref:t,...o})});function w1e(e){return kn("MuiListItemText",e)}const $p=vn("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]),S1e=e=>{const{classes:t,inset:n,primary:r,secondary:o,dense:a}=e;return Sn({root:["root",n&&"inset",a&&"dense",r&&o&&"multiline"],primary:["primary"],secondary:["secondary"]},w1e,t)},C1e=ot("div",{name:"MuiListItemText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${$p.primary}`]:t.primary},{[`& .${$p.secondary}`]:t.secondary},t.root,n.inset&&t.inset,n.primary&&n.secondary&&t.multiline,n.dense&&t.dense]}})({flex:"1 1 auto",minWidth:0,marginTop:4,marginBottom:4,[`.${QD.root}:where(& .${$p.primary})`]:{display:"block"},[`.${QD.root}:where(& .${$p.secondary})`]:{display:"block"},variants:[{props:({ownerState:e})=>e.primary&&e.secondary,style:{marginTop:6,marginBottom:6}},{props:({ownerState:e})=>e.inset,style:{paddingLeft:56}}]}),r2=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiListItemText"}),{children:r,className:o,disableTypography:a=!1,inset:i=!1,primary:s,primaryTypographyProps:l,secondary:d,secondaryTypographyProps:u,slots:m={},slotProps:g={},...y}=n,{dense:x}=C.useContext(sc);let w=s??r,S=d;const b={...n,disableTypography:a,inset:i,primary:!!w,secondary:!!S,dense:x},$=S1e(b),k={slots:m,slotProps:{primary:l,secondary:u,...g}},[R,O]=mr("root",{className:Ht($.root,o),elementType:C1e,externalForwardedProps:{...k,...y},ownerState:b,ref:t}),[P,D]=mr("primary",{className:$.primary,elementType:Ar,externalForwardedProps:k,ownerState:b}),[A,F]=mr("secondary",{className:$.secondary,elementType:Ar,externalForwardedProps:k,ownerState:b});return w!=null&&w.type!==Ar&&!a&&(w=p.jsx(P,{variant:x?"body2":"body1",component:D?.variant?void 0:"span",...D,children:w})),S!=null&&S.type!==Ar&&!a&&(S=p.jsx(A,{variant:"body2",color:"textSecondary",...F,children:S})),p.jsxs(R,{...O,children:[w,S]})});function k1e(e){return kn("MuiMenuItem",e)}const og=vn("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]),$1e=(e,t)=>{const{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},E1e=e=>{const{disabled:t,dense:n,divider:r,disableGutters:o,selected:a,classes:i}=e,s=Sn({root:["root",n&&"dense",t&&"disabled",!o&&"gutters",r&&"divider",a&&"selected"]},k1e,i);return{...i,...s}},R1e=ot(Jp,{shouldForwardProp:e=>gs(e)||e==="classes",name:"MuiMenuItem",slot:"Root",overridesResolver:$1e})(rr(({theme:e})=>({...e.typography.body1,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap","&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${og.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${og.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${og.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${og.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${og.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${ZN.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${ZN.inset}`]:{marginLeft:52},[`& .${$p.root}`]:{marginTop:0,marginBottom:0},[`& .${$p.inset}`]:{paddingLeft:36},[`& .${JN.root}`]:{minWidth:36},variants:[{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:t})=>t.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"}},{props:({ownerState:t})=>!t.dense,style:{[e.breakpoints.up("sm")]:{minHeight:"auto"}}},{props:({ownerState:t})=>t.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...e.typography.body2,[`& .${JN.root} svg`]:{fontSize:"1.25rem"}}}]}))),qo=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiMenuItem"}),{autoFocus:r=!1,component:o="li",dense:a=!1,divider:i=!1,disableGutters:s=!1,focusVisibleClassName:l,role:d="menuitem",tabIndex:u,className:m,...g}=n,y=C.useContext(sc),x=C.useMemo(()=>({dense:a||y.dense||!1,disableGutters:s}),[y.dense,a,s]),w=C.useRef(null);Yo(()=>{r&&w.current&&w.current.focus()},[r]);const S={...n,dense:x.dense,divider:i,disableGutters:s},b=E1e(n),$=vr(w,t);let k;return n.disabled||(k=u!==void 0?u:-1),p.jsx(sc.Provider,{value:x,children:p.jsx(R1e,{ref:$,role:d,tabIndex:k,component:o,focusVisibleClassName:Ht(b.focusVisible,l),className:Ht(b.root,m),...g,ownerState:S,classes:b})})}),ic={postgres:[{label:"Host",name:"host",type:"text",required:!1},{label:"Port",name:"port",type:"number",required:!1},{label:"Database Name",name:"databaseName",type:"text",required:!1},{label:"User Name",name:"userName",type:"text",required:!1},{label:"Password",name:"password",type:"password",required:!1},{label:"Connection String",name:"connectionString",type:"text",required:!1}],bigquery:[{label:"Project ID",name:"defaultProjectId",type:"text",required:!1},{label:"Billing Project ID",name:"billingProjectId",type:"text",required:!1},{label:"Location",name:"location",type:"text",required:!1},{label:"Service Account Key JSON",name:"serviceAccountKeyJson",type:"text",required:!0},{label:"Maximum Bytes Billed",name:"maximumBytesBilled",type:"text",required:!1},{label:"Query Timeout Milliseconds",name:"queryTimeoutMilliseconds",type:"text",required:!1},{label:"Database Metadata",name:"dbmeta",type:"text",required:!1,selectOptions:[{label:"No",value:"false"},{label:"Yes",value:"true"}]}],snowflake:[{label:"Account",name:"account",type:"text",required:!0},{label:"Username",name:"username",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!1},{label:"Role",name:"role",type:"text",required:!1},{label:"Warehouse",name:"warehouse",type:"text",required:!0},{label:"Database",name:"database",type:"text",required:!1},{label:"Schema",name:"schema",type:"text",required:!1},{label:"Response Timeout Milliseconds",name:"responseTimeoutMilliseconds",type:"text",required:!1},{label:"Private Key",name:"privateKey",type:"password",required:!1},{label:"Private Key Passphrase",name:"privateKeyPass",type:"password",required:!1}],trino:[{label:"Server",name:"server",type:"text",required:!0},{label:"Port",name:"port",type:"number",required:!1},{label:"Catalog",name:"catalog",type:"text",required:!1},{label:"Schema",name:"schema",type:"text",required:!1},{label:"User",name:"user",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!1},{label:"Peaka Key",name:"peakaKey",type:"password",required:!1}],databricks:[{label:"Host",name:"host",type:"text",required:!0},{label:"HTTP Path",name:"path",type:"text",required:!0},{label:"Access Token",name:"token",type:"password",required:!1},{label:"OAuth Client ID",name:"oauthClientId",type:"text",required:!1},{label:"OAuth Client Secret",name:"oauthClientSecret",type:"password",required:!1},{label:"Default Catalog",name:"defaultCatalog",type:"text",required:!1},{label:"Default Schema",name:"defaultSchema",type:"text",required:!1}],mysql:[{label:"Host",name:"host",type:"text",required:!0},{label:"Port",name:"port",type:"number",required:!0},{label:"User",name:"user",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!0},{label:"Database",name:"database",type:"text",required:!0}],sqlserver:[{label:"Server",name:"server",type:"text",required:!0},{label:"Port",name:"port",type:"number",required:!1},{label:"Database",name:"database",type:"text",required:!0},{label:"User",name:"user",type:"text",required:!0},{label:"Password",name:"password",type:"password",required:!0},{label:"Encrypt",name:"encrypt",type:"text",required:!1,selectOptions:[{label:"Yes",value:"true"},{label:"No",value:"false"}]},{label:"Trust server certificate",name:"trustServerCertificate",type:"text",required:!1,selectOptions:[{label:"No",value:"false"},{label:"Yes",value:"true"}]},{label:"Host name in certificate",name:"hostNameInCertificate",type:"text",required:!1},{label:"Instance name",name:"instanceName",type:"text",required:!1}],duckdb:[],motherduck:[{label:"Access Token",name:"accessToken",type:"text",required:!0},{label:"Database",name:"database",type:"text",required:!1}],ducklake:[],publisher:[]},Mg={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",trino:"trinoConnection",databricks:"databricksConnection",mysql:"mysqlConnection",sqlserver:"sqlserverConnection",duckdb:"duckdbConnection",motherduck:"motherduckConnection",ducklake:"ducklakeConnection",publisher:"publisherConnection"},T1e={bigquery:{dbmeta:"boolean"},sqlserver:{port:"integer",encrypt:"boolean",trustServerCertificate:"boolean"}},M1e={sqlserver:["hostNameInCertificate","instanceName"]};function n6(e,t){const n=T1e[e],r=M1e[e];if(!n&&!r)return t;const o={...t};for(const a of r??[])o[a]===""&&delete o[a];for(const[a,i]of Object.entries(n??{})){const s=t[a];if(s!==void 0){if(s===""){delete o[a];continue}if(i==="integer"){const l=Number(s);Number.isInteger(l)&&(o[a]=l)}else(s==="true"||s==="false")&&(o[a]=s==="true")}}return o}const r6=Object.values(dA).filter(e=>e!==dA.Publisher),w$={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",gcs:"gcsConnection",s3:"s3Connection",azure:"azureConnection"},Sy=[{label:"Credential Provider",name:"provider",type:"text",required:!1,selectOptions:[{label:"Access key pair",value:"config"},{label:"Host credential chain",value:"credential_chain"}]},{label:"Access Key ID",name:"accessKeyId",type:"text",required:!1,visibleWhen:{field:"provider",value:"config"}},{label:"Secret Access Key",name:"secretAccessKey",type:"password",required:!1,visibleWhen:{field:"provider",value:"config"}},{label:"Credential Chain",name:"chain",type:"text",required:!1,visibleWhen:{field:"provider",value:"credential_chain"}},{label:"Region",name:"region",type:"text",required:!1},{label:"Endpoint",name:"endpoint",type:"text",required:!1},{label:"Session Token",name:"sessionToken",type:"password",required:!1,visibleWhen:{field:"provider",value:"config"}}],Cy=[{label:"Key ID",name:"keyId",type:"text",required:!0},{label:"Secret",name:"secret",type:"password",required:!0}],O1e=[{label:"Auth Type",name:"authType",type:"text",required:!0,selectOptions:[{label:"SAS Token",value:"sas_token"},{label:"Service Principal (SPN)",value:"service_principal"}]},{label:"SAS URL (e.g. https://account.blob.core.windows.net/container/file.parquet?sp=r&st=...)",name:"sasUrl",type:"text",required:!1,visibleWhen:{field:"authType",value:"sas_token"}},{label:"Tenant ID",name:"tenantId",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"Client ID",name:"clientId",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"Client Secret",name:"clientSecret",type:"password",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"Account Name",name:"accountName",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}},{label:"File URL (e.g. abfss://container/path/file.parquet)",name:"fileUrl",type:"text",required:!1,visibleWhen:{field:"authType",value:"service_principal"}}];function tx(e){return e==="postgres"||e==="bigquery"||e==="snowflake"?ic[e]||[]:e==="s3"?Sy:e==="gcs"?Cy:e==="azure"?O1e:[]}function P1e({onSubmit:e,isSubmitting:t}){const[n,r]=C.useState(!1),[o,a]=C.useState("postgres"),[i,s]=C.useState([]),[l,d]=C.useState("postgres"),[u,m]=C.useState("s3"),[g,y]=C.useState("config"),x=()=>{r(!0)},w=()=>{r(!1),s([]),a("postgres"),d("postgres"),m("s3"),y("config")},S=async R=>{R.preventDefault();const O=new FormData(R.currentTarget),P=O.get("name")?.toString(),D=O.get("type")?.toString(),A=ic[D];if(!P)throw new Error("Name is required");if(!D)throw new Error("Type is required");let F;if(D==="ducklake"){const L={};if(l==="postgres"){const z=ic.postgres,I={};if(z.forEach(U=>{const N=O.get(`ducklake_pg_${U.name}`)?.toString();N&&(I[U.name]=N)}),Object.keys(I).length===0)throw new Error("DuckLake requires catalog connection");L.postgresConnection=I}const _=O.get("ducklake_bucketUrl")?.toString();if(!_)throw new Error("DuckLake requires a bucket URL");const E={bucketUrl:_};if(u==="s3"){const z={};if(Sy.forEach(I=>{const U=O.get(`ducklake_s3_${I.name}`)?.toString();U&&(z[I.name]=U)}),z.provider==="credential_chain")delete z.accessKeyId,delete z.secretAccessKey,delete z.sessionToken;else{if(delete z.chain,!z.accessKeyId)throw new Error("S3 Access Key ID is required");if(!z.secretAccessKey)throw new Error("S3 Secret Access Key is required")}Object.keys(z).length>0&&(E.s3Connection=z)}else if(u==="gcs"){const z={};if(Cy.forEach(I=>{const U=O.get(`ducklake_gcs_${I.name}`)?.toString();U&&(z[I.name]=U)}),!z.keyId)throw new Error("GCS Key ID is required");if(!z.secret)throw new Error("GCS Secret is required");Object.keys(z).length>0&&(E.gcsConnection=z)}F={name:P,type:D,ducklakeConnection:{catalog:L,storage:E}}}else if(D==="duckdb"){if(i.length===0)throw new Error("DuckDB connection must have at least one attached database");const L=i.map((_,E)=>{const z=_.dbType,I=O.get(`attachedDb_${E}_name`)?.toString();if(!I)throw new Error(`Attached database at index ${E} must have a name`);const U={name:I,type:z},N=tx(z);if(N&&N.length>0){const q={};if(N.forEach(oe=>{const Q=O.get(`attachedDb_${E}_${oe.name}`)?.toString();Q&&(q[oe.name]=Q)}),z==="s3"){if(q.provider==="credential_chain")delete q.accessKeyId,delete q.secretAccessKey,delete q.sessionToken;else if(delete q.chain,!q.accessKeyId||!q.secretAccessKey)throw new Error(`Attached database "${I}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`)}const Y=w$[z];Y&&(U[Y]=q)}return U});F={name:P,type:D,duckdbConnection:{attachedDatabases:L}}}else{const L={};if(A.forEach(_=>{const E=O.get(_.name)?.toString();E&&(L[_.name]=E)}),D==="postgres"){if(!L.connectionString?.trim()){const _=["host","port","databaseName","userName","password"];for(const E of _)if(!L[E])throw new Error(`${A.find(z=>z.name===E)?.label||E} is required`)}}else if(D==="bigquery"){if(!L.serviceAccountKeyJson)throw new Error("Service Account Key JSON is required")}else if(D==="snowflake"){if(!L.account)throw new Error("Account is required");if(!L.username)throw new Error("Username is required");if(!L.warehouse)throw new Error("Warehouse is required");if(!L.password&&!L.privateKey)throw new Error("Either password or private key is required")}else if(D==="trino"){if(!L.server)throw new Error("Server is required");if(!L.user)throw new Error("User is required");if(L.server.trim().startsWith("https://")&&!L.password&&!L.peakaKey)throw new Error("Password is required for HTTPS connections (or use Peaka Key)")}else if(D==="mysql"){const _=["host","port","database","user","password"];for(const E of _)if(!L[E])throw new Error(`${A.find(z=>z.name===E)?.label||E} is required`)}else if(D==="sqlserver"){const _=["server","database","user","password"];if(!L.instanceName&&!L.port)throw new Error("Port is required unless an instance name is given");for(const E of _)if(!L[E])throw new Error(`${A.find(z=>z.name===E)?.label||E} is required`)}else if(D==="motherduck"){if(!L.accessToken)throw new Error("Access Token is required")}else if(D==="databricks"){if(!L.host)throw new Error("Host is required");if(!L.path)throw new Error("HTTP Path is required");const _=L.oauthClientId&&L.oauthClientSecret;if(!L.token&&!_)throw new Error("Either Access Token or OAuth Client ID + Secret is required")}F={name:P,type:D,[Mg[D]]:n6(D,L)}}await e(F),w()},b=()=>{s([...i,{name:"",dbType:"postgres"}])},$=R=>{s(i.filter((O,P)=>P!==R))},k=(R,O)=>{const P=[...i];P[R]={...P[R],dbType:O},s(P)};return p.jsxs(Cn.Fragment,{children:[p.jsx(Qy,{label:"Connection",onClick:x}),p.jsx(Oo,{open:n,onClose:w,title:"New connection",description:"Add a connection so packages in this environment can query your database with Malloy.",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{disabled:t,onClick:w,children:"Cancel"}),p.jsx(So,{type:"submit",form:"connection-form",variant:"contained",loading:t,children:"Create connection"})]}),children:p.jsx("form",{onSubmit:S,id:"connection-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small"}),p.jsx(yr,{id:"type",name:"type",label:"Connection Type",fullWidth:!0,size:"small",value:o,select:!0,onChange:R=>a(R.target.value),children:r6.map(R=>p.jsx(qo,{value:R,children:R},R))}),o==="ducklake"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Catalog"}),p.jsx(yr,{id:"ducklake_catalogType",label:"Catalog Type",fullWidth:!0,size:"small",value:l,select:!0,onChange:R=>d(R.target.value),children:p.jsx(qo,{value:"postgres",children:"PostgreSQL"})}),l==="postgres"&&p.jsx(p.Fragment,{children:ic.postgres.map(R=>p.jsx(yr,{id:`ducklake_pg_${R.name}`,name:`ducklake_pg_${R.name}`,label:R.label,type:R.type,fullWidth:!0,size:"small"},`pg_${R.name}`))})]}),p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Storage"}),p.jsxs(yr,{id:"ducklake_storageType",label:"Storage Type",fullWidth:!0,size:"small",value:u,select:!0,onChange:R=>m(R.target.value),children:[p.jsx(qo,{value:"s3",children:"S3"}),p.jsx(qo,{value:"gcs",children:"GCS"})]}),p.jsx(yr,{required:!0,id:"ducklake_bucketUrl",name:"ducklake_bucketUrl",label:u==="s3"?"Bucket URL (e.g. s3://my-bucket/path)":"Bucket URL (e.g. gs://my-bucket/path)",type:"text",fullWidth:!0,size:"small"}),u==="s3"&&p.jsxs(p.Fragment,{children:[p.jsx(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),Sy.filter(R=>R.visibleWhen?g===R.visibleWhen.value:!0).map(R=>p.jsx(yr,{id:`ducklake_s3_${R.name}`,name:`ducklake_s3_${R.name}`,label:R.label,type:R.selectOptions?void 0:R.type,fullWidth:!0,size:"small",required:R.required,select:!!R.selectOptions,defaultValue:R.selectOptions?g:void 0,onChange:R.name==="provider"?O=>y(O.target.value):void 0,placeholder:R.name==="region"?"us-east-1":void 0,children:R.selectOptions?.map(O=>p.jsx(qo,{value:O.value,children:O.label},O.value))},`s3_${R.name}`))]}),u==="gcs"&&p.jsxs(p.Fragment,{children:[p.jsx(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Cy.map(R=>p.jsx(yr,{id:`ducklake_gcs_${R.name}`,name:`ducklake_gcs_${R.name}`,label:R.label,type:R.type,fullWidth:!0,size:"small",required:R.required},`gcs_${R.name}`))]})]})]}):o==="duckdb"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsx(Ar,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),p.jsx(Xy,{label:"Database",icon:p.jsx(p1,{}),onClick:b,ariaLabel:"Add database"})]}),i.length===0&&p.jsx(Ar,{variant:"body2",color:"text.secondary",sx:{mb:2},children:'DuckDB connections require at least one attached database. Click "Add Database" to get started.'}),i.map((R,O)=>{const P=tx(R.dbType);return p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsxs(Ar,{variant:"subtitle2",children:["Database ",O+1]}),p.jsx(Eu,{onClick:()=>$(O),size:"small",color:"error",children:p.jsx(t6,{fontSize:"small"})})]}),p.jsx(yr,{required:!0,id:`attachedDb_${O}_name`,name:`attachedDb_${O}_name`,label:"Database Name",type:"text",fullWidth:!0,size:"small",defaultValue:R.name}),p.jsx(yr,{id:`attachedDb_${O}_type`,name:`attachedDb_${O}_type`,label:"Database Type",fullWidth:!0,size:"small",value:R.dbType,select:!0,onChange:D=>k(O,D.target.value),children:Object.values(w4).map(D=>p.jsx(qo,{value:D,children:D},D))}),P.filter(D=>D.visibleWhen?(R[D.visibleWhen.field]||P.find(A=>A.name===D.visibleWhen?.field)?.selectOptions?.[0]?.value)===D.visibleWhen.value:!0).map(D=>p.jsx(yr,{id:`attachedDb_${O}_${D.name}`,name:`attachedDb_${O}_${D.name}`,label:D.label,type:D.selectOptions?void 0:D.type,fullWidth:!0,size:"small",required:D.required,select:!!D.selectOptions,defaultValue:D.selectOptions?.[0]?.value,onChange:D.selectOptions?A=>{const F=[...i];F[O]={...F[O],[D.name]:A.target.value},s(F)}:void 0,children:D.selectOptions?.map(A=>p.jsx(qo,{value:A.value,children:A.label},A.value))},D.name))]},O)})]}):ic[o].map(R=>p.jsx(yr,{id:R.name,name:R.name,label:R.label,type:R.type,fullWidth:!0,size:"small",required:R.required,select:!!R.selectOptions,defaultValue:R.selectOptions?R.selectOptions[0]?.value:void 0,children:R.selectOptions?.map(O=>p.jsx(qo,{value:O.value,children:O.label},O.value))},R.name))]})})})]})}function j1e({connection:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),i=()=>{a(!0)},s=()=>{a(!1),t()};return p.jsxs(Cn.Fragment,{children:[p.jsxs(qo,{"aria-label":`Delete connection ${e?.name??""}`.trim(),onClick:l=>{l.stopPropagation(),i()},sx:{color:"error.main"},children:[p.jsx(n2,{sx:{color:"inherit"},children:p.jsx(Jx,{fontSize:"small"})}),p.jsx(r2,{children:"Delete"})]}),p.jsx(Oo,{open:o,onClose:s,title:"Delete connection",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{onClick:s,children:"Cancel"}),p.jsx(So,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>r(),loading:n,children:"Delete connection"})]}),children:p.jsxs(Ar,{variant:"body2",children:["Delete ",p.jsx("strong",{children:e.name}),"? Packages that query through it stop working, and this cannot be undone."]})})]})}const eI=new Set(["password","connectionString","privateKey","privateKeyPass","serviceAccountKeyJson","token","oauthClientSecret","accessToken","peakaKey","secret","secretAccessKey","sessionToken","clientSecret","sasUrl"]);function tI(e){const t=e.duckdbConnection?.attachedDatabases;return!t||t.length===0?[]:t.map(n=>({name:n.name||"",dbType:n.type||"postgres"}))}function nI(e){const t=e.ducklakeConnection;return t&&t.storage?.gcsConnection?"gcs":"s3"}function A1e({connection:e,onSubmit:t,isSubmitting:n,onCloseDialog:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(e.type),l=Cn.useMemo(()=>new Set(e.withheldFields??[]),[e.withheldFields]),[d,u]=C.useState(()=>tI(e)),[m,g]=C.useState("postgres"),[y,x]=C.useState(()=>nI(e)),[w,S]=C.useState(()=>e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),b=()=>{u(tI(e)),s(e.type),S(e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),g("postgres"),x(nI(e)),a(!0)},$=()=>{a(!1),r?.()},k=async F=>{F.preventDefault();const L=new FormData(F.currentTarget),_=L.get("name")?.toString(),E=L.get("type")?.toString(),z=ic[E];if(!_)throw new Error("Name is required");if(!E)throw new Error("Type is required");let I;if(E==="ducklake"){const U={};if(m==="postgres"){const Y=ic.postgres,oe={};if(Y.forEach(Q=>{const ae=L.get(`ducklake_pg_${Q.name}`)?.toString();ae&&(oe[Q.name]=ae)}),Object.keys(oe).length===0)throw new Error("DuckLake requires catalog connection");U.postgresConnection=oe}const N=L.get("ducklake_bucketUrl")?.toString();if(!N)throw new Error("DuckLake requires a bucket URL");const q={bucketUrl:N};if(y==="s3"){const Y={};Sy.forEach(Q=>{const ae=L.get(`ducklake_s3_${Q.name}`)?.toString();ae&&(Y[Q.name]=ae)});const oe=e.ducklakeConnection?.storage?.s3Connection;if(oe&&(!Y.provider&&oe.provider&&(Y.provider=oe.provider),!Y.chain&&oe.chain&&(Y.chain=oe.chain),!Y.accessKeyId&&oe.accessKeyId&&(Y.accessKeyId=oe.accessKeyId)),Y.provider==="credential_chain")delete Y.accessKeyId,delete Y.secretAccessKey,delete Y.sessionToken;else if(delete Y.chain,!Y.accessKeyId)throw new Error("S3 Access Key ID is required");Object.keys(Y).length>0&&(q.s3Connection=Y)}else if(y==="gcs"){const Y={};Cy.forEach(Q=>{const ae=L.get(`ducklake_gcs_${Q.name}`)?.toString();ae&&(Y[Q.name]=ae)});const oe=e.ducklakeConnection?.storage?.gcsConnection;if(oe&&!Y.keyId&&oe.keyId&&(Y.keyId=oe.keyId),!Y.keyId)throw new Error("GCS Key ID is required");Object.keys(Y).length>0&&(q.gcsConnection=Y)}I={name:_,type:E,ducklakeConnection:{catalog:U,storage:q}}}else if(E==="duckdb"){if(d.length===0)throw new Error("DuckDB connection must have at least one attached database");const U=d.map((N,q)=>{const Y=N.dbType,oe=L.get(`attachedDb_${q}_name`)?.toString();if(!oe)throw new Error(`Attached database at index ${q} must have a name`);const Q={name:oe,type:Y},ae=tx(Y);if(ae&&ae.length>0){const de={};if(ae.forEach(se=>{const J=L.get(`attachedDb_${q}_${se.name}`)?.toString();J&&(de[se.name]=J)}),Y==="s3"){if(de.provider==="credential_chain")delete de.accessKeyId,delete de.secretAccessKey,delete de.sessionToken;else if(delete de.chain,!de.accessKeyId||!de.secretAccessKey)throw new Error(`Attached database "${oe}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`)}const X=w$[Y];X&&(Q[X]=de)}return Q});I={name:_,type:E,duckdbConnection:{attachedDatabases:U}}}else{const U=e[Mg[E]]||{},N={};if(z.forEach(q=>{const Y=L.get(q.name)?.toString(),oe=U[q.name];Y?N[q.name]=Y:eI.has(q.name)||(Y!==void 0?N[q.name]=Y:oe&&(N[q.name]=oe))}),E==="postgres"){const q=["host","port","databaseName","userName"],Y=l.has("postgresConnection.connectionString");if(!(N.connectionString?.trim()||Y)){const oe=q;for(const Q of oe)if(!N[Q])throw new Error(`${z.find(ae=>ae.name===Q)?.label||Q} is required`)}}else if(E==="snowflake"){if(!N.account)throw new Error("Account is required");if(!N.username)throw new Error("Username is required");if(!N.warehouse)throw new Error("Warehouse is required")}else if(E==="trino"){if(!N.server)throw new Error("Server is required");if(!N.user)throw new Error("User is required")}else if(E==="mysql"){const q=["host","port","database","user"];for(const Y of q)if(!N[Y])throw new Error(`${z.find(oe=>oe.name===Y)?.label||Y} is required`)}else if(E==="sqlserver"){const q=["server","database","user"];if(!N.instanceName&&!N.port)throw new Error("Port is required unless an instance name is given");for(const Y of q)if(!N[Y])throw new Error(`${z.find(oe=>oe.name===Y)?.label||Y} is required`)}else if(E==="databricks"){if(!N.host)throw new Error("Host is required");if(!N.path)throw new Error("HTTP Path is required")}I={name:_,type:E,[Mg[E]]:n6(E,N)}}await t(I),$()},R=()=>{u([...d,{name:"",dbType:"postgres"}])},O=F=>{u(d.filter((L,_)=>_!==F))},P=(F,L)=>{const _=[...d];_[F]={..._[F],dbType:L},u(_)},D=(F,L)=>{const _=e.duckdbConnection?.attachedDatabases;if(!_||!_[F])return"";const E=_[F],z=w$[E.type||""];return z&&E[z]?E[z][L]??"":""},A=F=>{const L=e.ducklakeConnection;if(!L)return"";if(F.startsWith("pg_")){const _=F.replace("pg_","");return L.catalog?.postgresConnection?.[_]??""}if(F==="bucketUrl")return L.storage?.bucketUrl??"";if(F.startsWith("s3_")){const _=F.replace("s3_","");return L.storage?.s3Connection?.[_]??""}if(F.startsWith("gcs_")){const _=F.replace("gcs_","");return L.storage?.gcsConnection?.[_]??""}return""};return p.jsxs(Cn.Fragment,{children:[p.jsxs(qo,{"aria-label":`Edit connection ${e?.name??""}`.trim(),onClick:F=>{F.preventDefault(),F.stopPropagation(),b()},children:[p.jsx(n2,{children:p.jsx(eR,{fontSize:"small"})}),p.jsx(r2,{children:"Edit"})]}),p.jsx(Oo,{open:o,onClose:$,title:"Edit connection",description:"Change how packages in this environment reach your database.",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{disabled:n,onClick:$,children:"Cancel"}),p.jsx(So,{type:"submit",form:"connection-form",variant:"contained",loading:n,children:"Save changes"})]}),children:p.jsx("form",{onSubmit:k,id:"connection-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",defaultValue:e.name}),p.jsx(yr,{id:"type",name:"type",label:"Connection Type",fullWidth:!0,size:"small",value:i,select:!0,onChange:F=>s(F.target.value),children:r6.map(F=>p.jsx(qo,{value:F,children:F},F))}),i==="ducklake"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Catalog"}),p.jsx(yr,{id:"ducklake_catalogType",label:"Catalog Type",fullWidth:!0,size:"small",value:m,select:!0,onChange:F=>g(F.target.value),children:p.jsx(qo,{value:"postgres",children:"PostgreSQL"})}),m==="postgres"&&p.jsx(p.Fragment,{children:ic.postgres.map(F=>p.jsx(yr,{id:`ducklake_pg_${F.name}`,name:`ducklake_pg_${F.name}`,label:F.label,type:F.type,fullWidth:!0,size:"small",defaultValue:A(`pg_${F.name}`)},`pg_${F.name}`))})]}),p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsx(Ar,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Storage"}),p.jsxs(yr,{id:"ducklake_storageType",label:"Storage Type",fullWidth:!0,size:"small",value:y,select:!0,onChange:F=>x(F.target.value),children:[p.jsx(qo,{value:"s3",children:"S3"}),p.jsx(qo,{value:"gcs",children:"GCS"})]}),p.jsx(yr,{required:!0,id:"ducklake_bucketUrl",name:"ducklake_bucketUrl",label:y==="s3"?"Bucket URL (e.g. s3://my-bucket/path)":"Bucket URL (e.g. gs://my-bucket/path)",type:"text",fullWidth:!0,size:"small",defaultValue:A("bucketUrl")}),y==="s3"&&p.jsxs(p.Fragment,{children:[p.jsx(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),Sy.filter(F=>F.visibleWhen?w===F.visibleWhen.value:!0).map(F=>p.jsx(yr,{id:`ducklake_s3_${F.name}`,name:`ducklake_s3_${F.name}`,label:F.label,type:F.selectOptions?void 0:F.type,fullWidth:!0,size:"small",required:F.required&&F.name!=="secretAccessKey",select:!!F.selectOptions,defaultValue:F.selectOptions?w:A(`s3_${F.name}`),onChange:F.name==="provider"?L=>S(L.target.value):void 0,placeholder:F.name==="region"?"us-east-1":F.name==="secretAccessKey"&&l.has("ducklakeConnection.storage.s3Connection.secretAccessKey")?"Leave empty to keep existing":void 0,children:F.selectOptions?.map(L=>p.jsx(qo,{value:L.value,children:L.label},L.value))},`s3_${F.name}`))]}),y==="gcs"&&p.jsxs(p.Fragment,{children:[p.jsx(Ar,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Cy.map(F=>p.jsx(yr,{id:`ducklake_gcs_${F.name}`,name:`ducklake_gcs_${F.name}`,label:F.label,type:F.type,fullWidth:!0,size:"small",required:F.required&&F.name!=="secret",defaultValue:A(`gcs_${F.name}`),placeholder:F.name==="secret"&&l.has("ducklakeConnection.storage.gcsConnection.secret")?"Leave empty to keep existing":void 0},`gcs_${F.name}`))]})]})]}):i==="duckdb"?p.jsxs(Ta,{sx:{mt:2},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsx(Ar,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),p.jsx(Xy,{label:"Database",icon:p.jsx(p1,{}),onClick:R,ariaLabel:"Add database"})]}),d.length===0&&p.jsx(Ar,{variant:"body2",color:"text.secondary",sx:{mb:2},children:'DuckDB connections require at least one attached database. Click "Add Database" to get started.'}),d.map((F,L)=>{const _=tx(F.dbType);return p.jsxs(Ta,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[p.jsxs(Ta,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[p.jsxs(Ar,{variant:"subtitle2",children:["Database ",L+1]}),p.jsx(Eu,{"aria-label":`Remove attached database ${L+1}`,onClick:()=>O(L),size:"small",color:"error",children:p.jsx(t6,{fontSize:"small"})})]}),p.jsx(yr,{required:!0,id:`attachedDb_${L}_name`,name:`attachedDb_${L}_name`,label:"Database Name",type:"text",fullWidth:!0,size:"small",defaultValue:F.name}),p.jsx(yr,{id:`attachedDb_${L}_type`,name:`attachedDb_${L}_type`,label:"Database Type",fullWidth:!0,size:"small",value:F.dbType,select:!0,onChange:E=>P(L,E.target.value),children:Object.values(w4).map(E=>p.jsx(qo,{value:E,children:E},E))}),_.filter(E=>E.visibleWhen?(F[E.visibleWhen.field]||D(L,E.visibleWhen.field)||_.find(z=>z.name===E.visibleWhen?.field)?.selectOptions?.[0]?.value)===E.visibleWhen.value:!0).map(E=>p.jsx(yr,{id:`attachedDb_${L}_${E.name}`,name:`attachedDb_${L}_${E.name}`,label:E.label,type:E.selectOptions?void 0:E.type,fullWidth:!0,size:"small",required:E.required,select:!!E.selectOptions,defaultValue:D(L,E.name)||E.selectOptions?.[0]?.value,onChange:E.selectOptions?z=>{const I=[...d];I[L]={...I[L],[E.name]:z.target.value},u(I)}:void 0,children:E.selectOptions?.map(z=>p.jsx(qo,{value:z.value,children:z.label},z.value))},E.name))]},L)})]}):ic[i].map(F=>{const L=e?.[Mg[i]??""]?.[F.name??""]??"",_=F.type==="password"||eI.has(F.name),E=l.has(`${Mg[i]??""}.${F.name}`),z=F.selectOptions?L===""||L===void 0?F.selectOptions[0]?.value:String(L):void 0;return p.jsx(yr,{id:F.name,name:F.name,label:F.label,type:F.type,fullWidth:!0,size:"small",required:F.required&&!_&&!L,select:!!F.selectOptions,defaultValue:F.selectOptions?z:L,placeholder:E?"Leave empty to keep existing":void 0,helperText:_?E?"Stored value is not shown. Leave empty to keep it.":"No value stored.":void 0,children:F.selectOptions?.map(I=>p.jsx(qo,{value:I.value,children:I.label},I.value))},F.name)})]})})})]})}function rI(e,t){return!e||e.type!=="duckdb"?!1:(e.duckdbConnection?.attachedDatabases||[]).some(n=>n.type==="azure"&&n.name===t)}function D1e(e){return e.startsWith("gs://")||e.startsWith("s3://")||e.startsWith("https://")||e.startsWith("abfss://")||e.startsWith("az://")}function N1e({connectionName:e,resourceUri:t,schema:n,connection:r}){const{apiClients:o}=er(),{environmentName:a}=ko(t),[i,s]=Cn.useState(null),[l,d]=Cn.useState(n||null),[u,m]=Cn.useState(!1),{data:g,isError:y,isLoading:x,error:w}=wo({queryKey:["schemas",a,e],queryFn:()=>o.connections.listSchemas(a,e)}),S=g?.data||[];return p.jsxs(Sp,{container:!0,spacing:1,children:[!n&&p.jsx(Sp,{size:{xs:12,md:4},children:p.jsxs(Ga,{sx:{p:1,m:0},children:[p.jsxs(Ee,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:0},children:[p.jsx(wt,{variant:"overline",fontWeight:"bold",children:"Table Paths"}),p.jsx(RE,{control:p.jsx(bz,{checked:u,onChange:b=>m(b.target.checked)}),label:"Hidden Schemas"})]}),p.jsx(wl,{sx:{mt:"2px"}}),p.jsxs(Ee,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[x&&p.jsx(Go,{text:"Loading schemas..."}),y&&p.jsx(Xa,{error:w,context:`${a} > ${e} > Schemas`}),!x&&!y&&S.length===0&&p.jsx(wt,{variant:"body2",children:"No Schemas"}),!x&&!y&&S.length>0&&p.jsx(PE,{dense:!0,disablePadding:!0,children:S.map(b=>{const $=b.name;return b.isHidden&&!u?null:p.jsx(dz,{selected:l===$,onClick:()=>{d($),s(null)},children:p.jsx(xi,{primary:$})},$)})})]})]})}),p.jsx(Sp,{size:{xs:12,md:n?6:4},children:l&&p.jsx(Ga,{sx:{p:1,m:0},children:p.jsx(z1e,{connectionName:e,schemaName:l,onTableSelect:b=>{s(b)},resourceUri:t,connection:r})})}),p.jsx(Sp,{size:{xs:12,md:n?6:4},children:l&&i&&p.jsx(I1e,{environmentName:a,connectionName:e,schemaName:l,tableResource:i})})]})}function I1e({environmentName:e,connectionName:t,schemaName:n,tableResource:r}){const{apiClients:o}=er(),{data:a,isLoading:i,isError:s,error:l}=wo({queryKey:["connectionTableDetail",e,t,n,r],queryFn:()=>o.connections.getTable(e,t,n,r),enabled:!!n&&!!r}),d={resource:a?.data?.resource??r,columns:a?.data?.columns??[]};return p.jsxs(Ga,{sx:{p:1,m:0},children:[s&&p.jsx(Xa,{error:l,context:`${e} > ${t} > ${n} > ${r}`}),!s&&p.jsx(L1e,{table:d,loading:i})]})}function L1e({table:e,loading:t}){return t?p.jsx(Go,{text:"Loading columns..."}):p.jsxs(p.Fragment,{children:[p.jsxs(wt,{variant:"overline",fontWeight:"bold",sx:{display:"block",wordBreak:"break-all"},children:[e.resource.includes("://")||/\.(parquet|csv|json|tsv|ndjson)$/i.test(e.resource)?"File":"Table",": ",e.resource]}),p.jsx(wl,{}),p.jsx(Ee,{sx:{mt:"10px",maxHeight:"600px",overflowY:"auto"},children:p.jsx(VJ,{children:p.jsxs(Ux,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(ur,{children:"NAME"}),p.jsx(ur,{children:"TYPE"})]})}),p.jsx(qx,{children:e.columns?.sort((n,r)=>n.name.localeCompare(r.name))?.map(n=>p.jsxs(vu,{children:[p.jsx(ur,{children:n.name}),p.jsx(ur,{children:n.type})]},n.name))})]})})})]})}function z1e({connectionName:e,schemaName:t,onTableSelect:n,resourceUri:r,connection:o}){const{environmentName:a}=ko(r),{apiClients:i}=er(),[s,l]=C.useState(""),{data:d,isSuccess:u,isError:m,error:g,isLoading:y}=wo({queryKey:["tablesInSchema",a,e,t],queryFn:()=>i.connections.listTables(a,e,t)}),x=rI(o,t),w=b=>x?b:b.split(".").pop()||b,S=u&&d?.data?d.data.filter(b=>w(b.resource).toLowerCase().includes(s.toLowerCase())).sort((b,$)=>w(b.resource).localeCompare(w($.resource))):[];return p.jsxs(p.Fragment,{children:[p.jsx(wt,{variant:"overline",fontWeight:"bold",children:D1e(t)||rI(o,t)?`Files in ${t}`:`Tables in ${t}`}),p.jsx(wl,{}),p.jsx(Ee,{sx:{mt:1,mb:1},children:p.jsx(ki,{size:"small",fullWidth:!0,placeholder:"Search tables...",value:s,onChange:b=>l(b.target.value),variant:"outlined"})}),p.jsx(wl,{}),p.jsxs(Ee,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[y&&p.jsx(Go,{text:"Fetching Tables..."}),m&&p.jsx(Xa,{error:g,context:`${a} > ${e} > ${t}`}),u&&S.length===0&&p.jsx(wt,{variant:"body2",children:"No Tables"}),u&&d?.data&&d.data.length>0&&p.jsx(PE,{dense:!0,disablePadding:!0,children:S.map(b=>{let $=w(b.resource);return!x&&b.resource.includes("://")&&($=b.resource.split("/").pop()||b.resource),p.jsx(dz,{onClick:()=>n(b.resource),children:p.jsx(xi,{primary:$,secondary:b.columns.length>0?`${b.columns.length} columns`:void 0})},b.resource)})})]})]})}const F1e={bigquery:"BigQuery",snowflake:"Snowflake",postgres:"PostgreSQL",mysql:"MySQL",sqlserver:"SQL Server",trino:"Trino",databricks:"Databricks",duckdb:"DuckDB",ducklake:"DuckLake",s3:"S3",gcs:"GCS",azure:"Azure"};function _1e(e){return e?F1e[e]??e:""}function B1e({resourceUri:e}){const{apiClients:t,mutable:n}=er(),r=Tl(),{environmentName:o}=ko(e),[a,i]=C.useState(""),[s,l]=C.useState(null),d=I1({environmentName:o,connectionName:s}),{data:u,isSuccess:m,isError:g,error:y}=wo({queryKey:["connections",o],queryFn:()=>t.connections.listConnections(o)}),x=hl({mutationFn:oc("connection","create",k=>t.environments.updateEnvironment(o,{name:o,connections:[...u.data,k]})),onSuccess(){i("Connection added successfully"),r.invalidateQueries({queryKey:["connections",o]})},onError(k){i(k.message)}}),w=hl({mutationFn:oc("connection","update",k=>t.environments.updateEnvironment(o,{name:o,connections:u.data.map(R=>R.name===k.name?k:R)})),onSuccess(k,R){i(`Connection ${R.name} updated successfully`),r.invalidateQueries({queryKey:["connections",o]})},onError(k){i(k.message)}}),S=hl({mutationFn:oc("connection","delete",k=>{if(!k.name)throw new Error("Cannot delete a connection with no name");return t.connections.deleteConnection(o,k.name)}),onSuccess(k,R){i(`Connection ${R.name} deleted successfully`),r.invalidateQueries({queryKey:["connections",o]})},onError(k){i(k.message)}}),b=m?[...u.data].sort((k,R)=>(k.name??"").localeCompare(R.name??"")):[],$=x.isPending||w.isPending||S.isPending;return p.jsxs(Ds,{title:"Connections",...m?{count:b.length}:{},description:"Database connections available to packages in this environment",...n&&m?{action:p.jsx(P1e,{onSubmit:k=>x.mutateAsync(k),isSubmitting:x.isPending})}:{},children:[!m&&!g&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:"Fetching Connections..."}),g&&p.jsx(Xa,{error:y,context:`${o} > Connections`}),m&&b.length===0&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:"No connections yet."}),m&&b.length>0&&p.jsx(Wn,{children:b.map(k=>p.jsx(U1e,{connection:k,mutable:n,isMutating:$,onOpenExplorer:()=>l(k.name??null),onEdit:R=>w.mutateAsync(R),onDelete:R=>S.mutateAsync(R)},k.name))}),p.jsx(ph,{open:a!=="",autoHideDuration:6e3,onClose:()=>i(""),message:a}),p.jsx(Oo,{open:s!==null,onClose:()=>l(null),maxWidth:"lg",title:`Connection explorer: ${s??""}`,showClose:!0,children:s&&p.jsx(N1e,{resourceUri:d,connectionName:s,connection:u?.data?.find(k=>k.name===s)})})]})}function U1e({connection:e,mutable:t,isMutating:n,onOpenExplorer:r,onEdit:o,onDelete:a}){const[i,s]=C.useState(null),l=!!i,d=m=>{m.stopPropagation(),s(m.currentTarget)},u=()=>s(null);return p.jsx(L1,{icon:p.jsx(m1e,{sx:{fontSize:18}}),tint:QE.connection,label:e.name??"",ariaLabel:e.name??"",description:_1e(e.type),onClick:r,...t?{trailingAction:p.jsxs(p.Fragment,{children:[p.jsx(no,{size:"small",onClick:d,"aria-label":`Connection actions for ${e.name??""}`.trim(),children:p.jsx(e1,{fontSize:"small"})}),p.jsxs(dc,{anchorEl:i,open:l,onClose:u,onClick:m=>m.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[p.jsx(A1e,{connection:e,onSubmit:o,isSubmitting:n,onCloseDialog:u}),p.jsx(j1e,{connection:e,onCloseDialog:u,isMutating:n,onDelete:()=>a(e)})]})]})}:{}})}const V1e=rn([p.jsx("path",{d:"M20 2H4c-1 0-2 .9-2 2v3.01c0 .72.43 1.34 1 1.69V20c0 1.1 1.1 2 2 2h14c.9 0 2-.9 2-2V8.7c.57-.35 1-.97 1-1.69V4c0-1.1-1-2-2-2m-1 18H5V9h14zm1-13H4V4h16z"},"0"),p.jsx("path",{d:"M9 12h6v2H9z"},"1")]);function q1e({resourceUri:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=er(),a=()=>{r(!0)},i=()=>{r(!1),t()},{environmentName:s,packageName:l}=ko(e),d=Ch({mutationFn:()=>o.packages.deletePackage(s,l),success:"Package deleted",invalidates:[["packages",s]],closeDialog:i,resource:"package",action:"delete"});return p.jsxs(Cn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(Jx,{fontSize:"small"})}),p.jsx(xi,{children:"Delete"})]}),p.jsx(Oo,{open:n,onClose:i,title:"Delete package",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{onClick:i,children:"Cancel"}),p.jsx(So,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>d.mutate(),loading:d.isPending,children:"Delete package"})]}),children:p.jsxs(Ar,{variant:"body2",children:["Delete ",p.jsx("strong",{children:l}),"? The package stops being served and this cannot be undone."]})}),d.notice]})}function H1e({package:e,resourceUri:t,onCloseDialog:n}){const[r,o]=C.useState(!1),{apiClients:a}=er(),i=()=>{o(!0)},s=()=>{o(!1),n()},{packageName:l,environmentName:d}=ko(t),u=Ch({mutationFn(g){return a.packages.updatePackage(d,l,{name:l,description:g.description})},success:"Package updated",invalidates:[["packages",d]],closeDialog:s,resource:"package",action:"update"}),m=g=>{g.preventDefault();const y=new FormData(g.currentTarget).get("description")?.toString();u.mutate({description:y})};return p.jsxs(Cn.Fragment,{children:[p.jsxs(ea,{onClick:i,children:[p.jsx(ml,{children:p.jsx(eR,{fontSize:"small"})}),p.jsx(xi,{children:"Edit"})]}),p.jsx(Oo,{open:r,onClose:s,title:"Edit package",description:`What ${e.name} is, for the people who open it.`,actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{disabled:u.isPending,onClick:s,children:"Cancel"}),p.jsx(So,{type:"submit",form:"package-form",variant:"contained",loading:u.isPending,children:"Save changes"})]}),children:p.jsx("form",{onSubmit:m,id:"package-form",children:p.jsxs(Wn,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",disabled:!0,type:"text",fullWidth:!0,size:"small",defaultValue:e.name,InputLabelProps:{shrink:!0}}),p.jsx(yr,{id:"description",name:"description",label:"Description",multiline:!0,fullWidth:!0,rows:4,size:"small",defaultValue:e.description,InputLabelProps:{shrink:!0}})]})})}),u.notice]})}function W1e({onSelectPackage:e,resourceUri:t}){const{apiClients:n}=er(),{environmentName:r}=ko(t),{data:o,isSuccess:a,isError:i,error:s}=wo({queryKey:["packages",r],queryFn:()=>n.packages.listPackages(r)});if(i)return p.jsx(Xa,{error:s,context:`${r} > Packages`});if(!a)return p.jsx(Go,{text:"Fetching Packages..."});const l=[...o.data].sort((d,u)=>d.name.localeCompare(u.name));return p.jsx(Wn,{children:l.map(d=>{const u=I1({environmentName:r,packageName:d.name});return p.jsx(Y1e,{pkg:d,packageResourceUri:u,onSelectPackage:e},d.name)})})}function Y1e({pkg:e,packageResourceUri:t,onSelectPackage:n}){const{mutable:r}=er(),o=e.versionId!==void 0||e.latestVersion!==void 0,[a,i]=C.useState(null),s=!!a,l=u=>{u.stopPropagation(),i(u.currentTarget)},d=()=>i(null);return p.jsx(L1,{icon:p.jsx(V1e,{sx:{fontSize:18}}),tint:QE.package,label:e.name,ariaLabel:e.name,...e.description?{description:e.description}:{},onClick:u=>n(e.name,u),...r?{trailingAction:p.jsxs(p.Fragment,{children:[p.jsx(no,{size:"small",onClick:l,"aria-label":`Package actions for ${e.name}`,children:p.jsx(e1,{fontSize:"small"})}),p.jsxs(dc,{anchorEl:a,open:s,onClose:d,onClick:u=>u.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[!o&&p.jsx(H1e,{package:e,resourceUri:t,onCloseDialog:d}),p.jsx(q1e,{resourceUri:t,onCloseDialog:d})]})]})}:{}})}function O2e({onSelectPackage:e,resourceUri:t}){const{apiClients:n,mutable:r}=er(),{environmentName:o}=ko(t),a=wo({queryKey:["packages",o],queryFn:()=>n.packages.listPackages(o)});return C.useEffect(()=>{window.scrollTo({top:0,behavior:"auto"})},[]),p.jsxs(O0,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[p.jsxs(Ee,{sx:{mb:4},children:[p.jsx(wt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:o}),p.jsx(wt,{variant:"body2",color:"text.secondary",children:"Manage packages and database connections in this environment. Open a package to explore its models and notebooks."})]}),p.jsx(Ds,{title:"Packages",...a.isSuccess?{count:a.data.data.length}:{},description:"Published packages available for use in this environment",...r?{action:p.jsx(h1e,{resourceUri:t})}:{},children:p.jsx(W1e,{onSelectPackage:e,resourceUri:t})}),p.jsx(B1e,{resourceUri:t}),p.jsx(Jxe,{resourceUri:t})]})}function oI({array1:e,array2:t,parser:n=r=>r}){return e&&t&&e.length===t.length&&e.every((r,o)=>n(r)===n(t[o]))}function aI(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function G1e(e={}){const{ignoreAccents:t=!0,ignoreCase:n=!0,limit:r,matchFrom:o="any",stringify:a,trim:i=!1}=e;return(s,{inputValue:l,getOptionLabel:d})=>{let u=i?l.trim():l;n&&(u=u.toLowerCase()),t&&(u=aI(u));const m=u?s.filter(g=>{let y=(a||d)(g);return n&&(y=y.toLowerCase()),t&&(y=aI(y)),o==="start"?y.startsWith(u):y.includes(u)}):s;return typeof r=="number"?m.slice(0,r):m}}const K1e=G1e(),iI=5,Q1e=e=>e.current!==null&&e.current.parentElement?.contains(document.activeElement),X1e=[];function sI(e,t,n,r){if(t||e==null||r)return"";const o=n(e);return typeof o=="string"?o:""}function Z1e(e){const{unstable_isActiveElementInListbox:t=Q1e,unstable_classNamePrefix:n="Mui",autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:i=!1,clearOnBlur:s=!e.freeSolo,clearOnEscape:l=!1,componentName:d="useAutocomplete",defaultValue:u=e.multiple?X1e:null,disableClearable:m=!1,disableCloseOnSelect:g=!1,disabled:y,disabledItemsFocusable:x=!1,disableListWrap:w=!1,filterOptions:S=K1e,filterSelectedOptions:b=!1,freeSolo:$=!1,getOptionDisabled:k,getOptionKey:R,getOptionLabel:O=ge=>ge.label??ge,groupBy:P,handleHomeEndKeys:D=!e.freeSolo,id:A,includeInputInList:F=!1,inputValue:L,isOptionEqualToValue:_=(ge,ye)=>ge===ye,multiple:E=!1,onChange:z,onClose:I,onHighlightChange:U,onInputChange:N,onOpen:q,open:Y,openOnFocus:oe=!1,options:Q,readOnly:ae=!1,renderValue:de,selectOnFocus:X=!e.freeSolo,value:se}=e,J=Fs(A);let Z=O;Z=ge=>{const ye=O(ge);return typeof ye!="string"?String(ye):ye};const G=C.useRef(!1),ue=C.useRef(!0),ie=C.useRef(null),fe=C.useRef(null),[he,me]=C.useState(null),[le,ve]=C.useState(-1),Le=o?0:-1,Ie=C.useRef(Le),Re=C.useRef(sI(u??se,E,Z)).current,[ne,qe]=Ji({controlled:se,default:u,name:d}),[Oe,Qe]=Ji({controlled:L,default:Re,name:d,state:"inputValue"}),[nt,kt]=C.useState(!1),Ut=C.useCallback((ge,ye,Be)=>{if(!(E?ne.length<ye.length:ye!==null)&&!s)return;const gt=sI(ye,E,Z,de);Oe!==gt&&(Qe(gt),N&&N(ge,gt,Be))},[Z,Oe,E,N,Qe,s,ne,de]),[at,et]=Ji({controlled:Y,default:!1,name:d,state:"open"}),[pt,ze]=C.useState(!0),be=!E&&ne!=null&&Oe===Z(ne),He=at&&!ae,Me=He?S(Q.filter(ge=>!(b&&(E?ne:[ne]).some(ye=>ye!==null&&_(ge,ye)))),{inputValue:be&&pt?"":Oe,getOptionLabel:Z}):[],$t=$xe({filteredOptions:Me,value:ne,inputValue:Oe});C.useEffect(()=>{const ge=ne!==$t.value;nt&&!ge||$&&!ge||Ut(null,ne,"reset")},[ne,Ut,nt,$t.value,$]);const Et=at&&Me.length>0&&!ae,vt=Yt(ge=>{if(ge===-1)ie.current.focus();else{const ye=de?"data-item-index":"data-tag-index";he.querySelector(`[${ye}="${ge}"]`).focus()}});C.useEffect(()=>{E&&le>ne.length-1&&(ve(-1),vt(-1))},[ne,E,le,vt]);function it(ge,ye){if(!fe.current||ge<0||ge>=Me.length)return-1;let Be=ge;for(;;){const gt=fe.current.querySelector(`[data-option-index="${Be}"]`),We=x?!1:!gt||gt.disabled||gt.getAttribute("aria-disabled")==="true";if(gt&&gt.hasAttribute("tabindex")&&!We)return Be;if(ye==="next"?Be=(Be+1)%Me.length:Be=(Be-1+Me.length)%Me.length,Be===ge)return-1}}const st=Yt(({event:ge,index:ye,reason:Be})=>{if(Ie.current=ye,ye===-1?ie.current.removeAttribute("aria-activedescendant"):ie.current.setAttribute("aria-activedescendant",`${J}-option-${ye}`),U&&["mouse","keyboard","touch"].includes(Be)&&U(ge,ye===-1?null:Me[ye],Be),!fe.current)return;const gt=fe.current.querySelector(`[role="option"].${n}-focused`);gt&&(gt.classList.remove(`${n}-focused`),gt.classList.remove(`${n}-focusVisible`));let We=fe.current;if(fe.current.getAttribute("role")!=="listbox"&&(We=fe.current.parentElement.querySelector('[role="listbox"]')),!We)return;if(ye===-1){We.scrollTop=0;return}const Dt=fe.current.querySelector(`[data-option-index="${ye}"]`);if(Dt&&(Dt.classList.add(`${n}-focused`),Be==="keyboard"&&Dt.classList.add(`${n}-focusVisible`),We.scrollHeight>We.clientHeight&&Be!=="mouse"&&Be!=="touch")){const Kt=Dt,sn=We.clientHeight+We.scrollTop,we=Kt.offsetTop+Kt.offsetHeight;we>sn?We.scrollTop=we-We.clientHeight:Kt.offsetTop-Kt.offsetHeight*(P?1.3:0)<We.scrollTop&&(We.scrollTop=Kt.offsetTop-Kt.offsetHeight*(P?1.3:0))}}),At=Yt(({event:ge,diff:ye,direction:Be="next",reason:gt})=>{if(!He)return;const We=it((()=>{const Dt=Me.length-1;if(ye==="reset")return Le;if(ye==="start")return 0;if(ye==="end")return Dt;const Kt=Ie.current+ye;return Kt<0?Kt===-1&&F?-1:w&&Ie.current!==-1||Math.abs(ye)>1?0:Dt:Kt>Dt?Kt===Dt+1&&F?-1:w||Math.abs(ye)>1?Dt:0:Kt})(),Be);if(st({index:We,reason:gt,event:ge}),r&&ye!=="reset")if(We===-1)ie.current.value=Oe;else{const Dt=Z(Me[We]);ie.current.value=Dt,Dt.toLowerCase().indexOf(Oe.toLowerCase())===0&&Oe.length>0&&ie.current.setSelectionRange(Oe.length,Dt.length)}}),tn=!oI({array1:$t.filteredOptions,array2:Me,parser:Z}),Bt=()=>{const ge=(ye,Be)=>{const gt=ye?Z(ye):"",We=Be?Z(Be):"";return gt===We};if(Ie.current!==-1&&!oI({array1:$t.filteredOptions,array2:Me,parser:Z})&&$t.inputValue===Oe&&(E?ne.length===$t.value.length&&$t.value.every((ye,Be)=>Z(ne[Be])===Z(ye)):ge($t.value,ne))){const ye=$t.filteredOptions[Ie.current];if(ye)return Me.findIndex(Be=>Z(Be)===Z(ye))}return-1},an=C.useCallback(()=>{if(!He)return;const ge=Bt();if(ge!==-1){Ie.current=ge;return}const ye=E?ne[0]:ne;if(Me.length===0||ye==null){At({diff:"reset"});return}if(fe.current){if(ye!=null){const Be=Me[Ie.current];if(E&&Be&&ne.findIndex(We=>_(Be,We))!==-1)return;const gt=Me.findIndex(We=>_(We,ye));gt===-1?At({diff:"reset"}):st({index:gt});return}if(Ie.current>=Me.length-1){st({index:Me.length-1});return}st({index:Ie.current})}},[Me.length,E?!1:ne,b,At,st,He,Oe,E]),$n=Yt(ge=>{Vk(fe,ge),ge&&an()});C.useEffect(()=>{tn&&an()},[an,tn]);const Vt=ge=>{at||(et(!0),ze(!0),q&&q(ge))},Pn=(ge,ye)=>{at&&(et(!1),I&&I(ge,ye))},Se=(ge,ye,Be,gt)=>{if(E){if(ne.length===ye.length&&ne.every((We,Dt)=>We===ye[Dt]))return}else if(ne===ye)return;z&&z(ge,ye,Be,gt),qe(ye)},jn=C.useRef(!1),En=(ge,ye,Be="selectOption",gt="options")=>{let We=Be,Dt=ye;if(E){Dt=Array.isArray(ne)?ne.slice():[];const Kt=Dt.findIndex(sn=>_(ye,sn));Kt===-1?Dt.push(ye):gt!=="freeSolo"&&(Dt.splice(Kt,1),We="removeOption")}Ut(ge,Dt,We),Se(ge,Dt,We,{option:ye}),!g&&(!ge||!ge.ctrlKey&&!ge.metaKey)&&Pn(ge,We),(i===!0||i==="touch"&&jn.current||i==="mouse"&&!jn.current)&&ie.current.blur()};function Jt(ge,ye){if(ge===-1)return-1;let Be=ge;for(;;){if(ye==="next"&&Be===ne.length||ye==="previous"&&Be===-1)return-1;const gt=de?"data-item-index":"data-tag-index",We=he.querySelector(`[${gt}="${Be}"]`);if(!We||!We.hasAttribute("tabindex")||We.disabled||We.getAttribute("aria-disabled")==="true")Be+=ye==="next"?1:-1;else return Be}}const Pt=(ge,ye)=>{if(!E)return;Oe===""&&Pn(ge,"toggleInput");let Be=le;le===-1?Oe===""&&ye==="previous"&&(Be=ne.length-1):(Be+=ye==="next"?1:-1,Be<0&&(Be=0),Be===ne.length&&(Be=-1)),Be=Jt(Be,ye),ve(Be),vt(Be)},Ur=ge=>{G.current=!0,Qe(""),N&&N(ge,"","clear"),Se(ge,E?[]:null,"clear")},Vn=ge=>ye=>{if(ge.onKeyDown&&ge.onKeyDown(ye),!ye.defaultMuiPrevented&&(le!==-1&&!["ArrowLeft","ArrowRight"].includes(ye.key)&&(ve(-1),vt(-1)),ye.which!==229))switch(ye.key){case"Home":He&&D&&(ye.preventDefault(),At({diff:"start",direction:"next",reason:"keyboard",event:ye}));break;case"End":He&&D&&(ye.preventDefault(),At({diff:"end",direction:"previous",reason:"keyboard",event:ye}));break;case"PageUp":ye.preventDefault(),At({diff:-iI,direction:"previous",reason:"keyboard",event:ye}),Vt(ye);break;case"PageDown":ye.preventDefault(),At({diff:iI,direction:"next",reason:"keyboard",event:ye}),Vt(ye);break;case"ArrowDown":ye.preventDefault(),At({diff:1,direction:"next",reason:"keyboard",event:ye}),Vt(ye);break;case"ArrowUp":ye.preventDefault(),At({diff:-1,direction:"previous",reason:"keyboard",event:ye}),Vt(ye);break;case"ArrowLeft":!E&&de?vt(0):Pt(ye,"previous");break;case"ArrowRight":!E&&de?vt(-1):Pt(ye,"next");break;case"Enter":if(Ie.current!==-1&&He){const Be=Me[Ie.current],gt=k?k(Be):!1;if(ye.preventDefault(),gt)return;En(ye,Be,"selectOption"),r&&ie.current.setSelectionRange(ie.current.value.length,ie.current.value.length)}else $&&Oe!==""&&be===!1&&(E&&ye.preventDefault(),En(ye,Oe,"createOption","freeSolo"));break;case"Escape":He?(ye.preventDefault(),ye.stopPropagation(),Pn(ye,"escape")):l&&(Oe!==""||E&&ne.length>0||de)&&(ye.preventDefault(),ye.stopPropagation(),Ur(ye));break;case"Backspace":if(E&&!ae&&Oe===""&&ne.length>0){const Be=le===-1?ne.length-1:le,gt=ne.slice();gt.splice(Be,1),Se(ye,gt,"removeOption",{option:ne[Be]})}!E&&de&&!ae&&(qe(null),vt(-1));break;case"Delete":if(E&&!ae&&Oe===""&&ne.length>0&&le!==-1){const Be=le,gt=ne.slice();gt.splice(Be,1),Se(ye,gt,"removeOption",{option:ne[Be]})}!E&&de&&!ae&&(qe(null),vt(-1));break}},cn=ge=>{kt(!0),oe&&!G.current&&Vt(ge)},Bn=ge=>{if(t(fe)){ie.current.focus();return}kt(!1),ue.current=!0,G.current=!1,a&&Ie.current!==-1&&He?En(ge,Me[Ie.current],"blur"):a&&$&&Oe!==""?En(ge,Oe,"blur","freeSolo"):s&&Ut(ge,ne,"blur"),Pn(ge,"blur")},xe=ge=>{const ye=ge.target.value;Oe!==ye&&(Qe(ye),ze(!1),N&&N(ge,ye,"input")),ye===""?!m&&!E&&Se(ge,null,"clear"):Vt(ge)},Te=ge=>{const ye=Number(ge.currentTarget.getAttribute("data-option-index"));Ie.current!==ye&&st({event:ge,index:ye,reason:"mouse"})},_e=ge=>{st({event:ge,index:Number(ge.currentTarget.getAttribute("data-option-index")),reason:"touch"}),jn.current=!0},Ye=ge=>{const ye=Number(ge.currentTarget.getAttribute("data-option-index"));En(ge,Me[ye],"selectOption"),jn.current=!1},ut=ge=>ye=>{const Be=ne.slice();Be.splice(ge,1),Se(ye,Be,"removeOption",{option:ne[ge]})},Rt=ge=>{Se(ge,null,"removeOption",{option:ne})},St=ge=>{at?Pn(ge,"toggleInput"):Vt(ge)},Tt=ge=>{ge.currentTarget.contains(ge.target)&&ge.target.getAttribute("id")!==J&&ge.preventDefault()},Nt=ge=>{ge.currentTarget.contains(ge.target)&&(ie.current.focus(),X&&ue.current&&ie.current.selectionEnd-ie.current.selectionStart===0&&ie.current.select(),ue.current=!1)},Xt=ge=>{!y&&(Oe===""||!at)&&St(ge)};let It=$&&Oe.length>0;It=It||(E?ne.length>0:ne!==null);let qt=Me;return P&&(qt=Me.reduce((ge,ye,Be)=>{const gt=P(ye);return ge.length>0&&ge[ge.length-1].group===gt?ge[ge.length-1].options.push(ye):ge.push({key:Be,index:Be,group:gt,options:[ye]}),ge},[])),y&&nt&&Bn(),{getRootProps:(ge={})=>({...ge,onKeyDown:Vn(ge),onMouseDown:Tt,onClick:Nt}),getInputLabelProps:()=>({id:`${J}-label`,htmlFor:J}),getInputProps:()=>({id:J,value:Oe,onBlur:Bn,onFocus:cn,onChange:xe,onMouseDown:Xt,"aria-activedescendant":He?"":null,"aria-autocomplete":r?"both":"list","aria-controls":Et?`${J}-listbox`:void 0,"aria-expanded":Et,autoComplete:"off",ref:ie,autoCapitalize:"none",spellCheck:"false",role:"combobox",disabled:y}),getClearProps:()=>({tabIndex:-1,type:"button",onClick:Ur}),getItemProps:({index:ge=0}={})=>({...E&&{key:ge},...de?{"data-item-index":ge}:{"data-tag-index":ge},tabIndex:-1,...!ae&&{onDelete:E?ut(ge):Rt}}),getPopupIndicatorProps:()=>({tabIndex:-1,type:"button",onClick:St}),getTagProps:({index:ge})=>({key:ge,"data-tag-index":ge,tabIndex:-1,...!ae&&{onDelete:ut(ge)}}),getListboxProps:()=>({role:"listbox",id:`${J}-listbox`,"aria-labelledby":`${J}-label`,ref:$n,onMouseDown:ge=>{ge.preventDefault()}}),getOptionProps:({index:ge,option:ye})=>{const Be=(E?ne:[ne]).some(We=>We!=null&&_(ye,We)),gt=k?k(ye):!1;return{key:R?.(ye)??Z(ye),tabIndex:-1,role:"option",id:`${J}-option-${ge}`,onMouseMove:Te,onClick:Ye,onTouchStart:_e,"data-option-index":ge,"aria-disabled":gt,"aria-selected":Be}},id:J,inputValue:Oe,value:ne,dirty:It,expanded:He&&he,popupOpen:He,focused:nt||le!==-1,anchorEl:he,setAnchorEl:me,focusedItem:le,focusedTag:le,groupedOptions:qt}}function J1e(e){return kn("MuiListSubheader",e)}vn("MuiListSubheader",["root","colorPrimary","colorInherit","gutters","inset","sticky"]);const ewe=e=>{const{classes:t,color:n,disableGutters:r,inset:o,disableSticky:a}=e,i={root:["root",n!=="default"&&`color${zt(n)}`,!r&&"gutters",o&&"inset",!a&&"sticky"]};return Sn(i,J1e,t)},twe=ot("li",{name:"MuiListSubheader",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${zt(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(rr(({theme:e})=>({boxSizing:"border-box",lineHeight:"48px",listStyle:"none",color:(e.vars||e).palette.text.secondary,fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(14),variants:[{props:{color:"primary"},style:{color:(e.vars||e).palette.primary.main}},{props:{color:"inherit"},style:{color:"inherit"}},{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:t})=>t.inset,style:{paddingLeft:72}},{props:({ownerState:t})=>!t.disableSticky,style:{position:"sticky",top:0,zIndex:1,backgroundColor:(e.vars||e).palette.background.paper}}]}))),S$=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiListSubheader"}),{className:r,color:o="default",component:a="li",disableGutters:i=!1,disableSticky:s=!1,inset:l=!1,...d}=n,u={...n,color:o,component:a,disableGutters:i,disableSticky:s,inset:l},m=ewe(u);return p.jsx(twe,{as:a,className:Ht(m.root,r),ref:t,ownerState:u,...d})});S$&&(S$.muiSkipListHighlight=!0);const nwe=rn(p.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function rwe(e){return kn("MuiAutocomplete",e)}const Xn=vn("MuiAutocomplete",["root","expanded","fullWidth","focused","focusVisible","tag","tagSizeSmall","tagSizeMedium","hasPopupIcon","hasClearIcon","inputRoot","input","inputFocused","endAdornment","clearIndicator","popupIndicator","popupIndicatorOpen","popper","popperDisablePortal","paper","listbox","loading","noOptions","option","groupLabel","groupUl"]);var lI,cI;const owe=e=>{const{classes:t,disablePortal:n,expanded:r,focused:o,fullWidth:a,hasClearIcon:i,hasPopupIcon:s,inputFocused:l,popupOpen:d,size:u}=e,m={root:["root",r&&"expanded",o&&"focused",a&&"fullWidth",i&&"hasClearIcon",s&&"hasPopupIcon"],inputRoot:["inputRoot"],input:["input",l&&"inputFocused"],tag:["tag",`tagSize${zt(u)}`],endAdornment:["endAdornment"],clearIndicator:["clearIndicator"],popupIndicator:["popupIndicator",d&&"popupIndicatorOpen"],popper:["popper",n&&"popperDisablePortal"],paper:["paper"],listbox:["listbox"],loading:["loading"],noOptions:["noOptions"],option:["option"],groupLabel:["groupLabel"],groupUl:["groupUl"]};return Sn(m,rwe,t)},awe=ot("div",{name:"MuiAutocomplete",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e,{fullWidth:r,hasClearIcon:o,hasPopupIcon:a,inputFocused:i,size:s}=n;return[{[`& .${Xn.tag}`]:t.tag},{[`& .${Xn.tag}`]:t[`tagSize${zt(s)}`]},{[`& .${Xn.inputRoot}`]:t.inputRoot},{[`& .${Xn.input}`]:t.input},{[`& .${Xn.input}`]:i&&t.inputFocused},t.root,r&&t.fullWidth,a&&t.hasPopupIcon,o&&t.hasClearIcon]}})({[`&.${Xn.focused} .${Xn.clearIndicator}`]:{visibility:"visible"},"@media (pointer: fine)":{[`&:hover .${Xn.clearIndicator}`]:{visibility:"visible"}},[`& .${Xn.tag}`]:{margin:3,maxWidth:"calc(100% - 6px)"},[`& .${Xn.inputRoot}`]:{[`.${Xn.hasPopupIcon}&, .${Xn.hasClearIcon}&`]:{paddingRight:30},[`.${Xn.hasPopupIcon}.${Xn.hasClearIcon}&`]:{paddingRight:56},[`& .${Xn.input}`]:{width:0,minWidth:30}},[`& .${au.root}`]:{paddingBottom:1,"& .MuiInput-input":{padding:"4px 4px 4px 0px"}},[`& .${au.root}.${gi.sizeSmall}`]:{[`& .${au.input}`]:{padding:"2px 4px 3px 0"}},[`& .${Ui.root}`]:{padding:9,[`.${Xn.hasPopupIcon}&, .${Xn.hasClearIcon}&`]:{paddingRight:39},[`.${Xn.hasPopupIcon}.${Xn.hasClearIcon}&`]:{paddingRight:65},[`& .${Xn.input}`]:{padding:"7.5px 4px 7.5px 5px"},[`& .${Xn.endAdornment}`]:{right:9}},[`& .${Ui.root}.${gi.sizeSmall}`]:{paddingTop:6,paddingBottom:6,paddingLeft:6,[`& .${Xn.input}`]:{padding:"2.5px 4px 2.5px 8px"}},[`& .${yi.root}`]:{paddingTop:19,paddingLeft:8,[`.${Xn.hasPopupIcon}&, .${Xn.hasClearIcon}&`]:{paddingRight:39},[`.${Xn.hasPopupIcon}.${Xn.hasClearIcon}&`]:{paddingRight:65},[`& .${yi.input}`]:{padding:"7px 4px"},[`& .${Xn.endAdornment}`]:{right:9}},[`& .${yi.root}.${gi.sizeSmall}`]:{paddingBottom:1,[`& .${yi.input}`]:{padding:"2.5px 4px"}},[`& .${gi.hiddenLabel}`]:{paddingTop:8},[`& .${yi.root}.${gi.hiddenLabel}`]:{paddingTop:0,paddingBottom:0,[`& .${Xn.input}`]:{paddingTop:16,paddingBottom:17}},[`& .${yi.root}.${gi.hiddenLabel}.${gi.sizeSmall}`]:{[`& .${Xn.input}`]:{paddingTop:8,paddingBottom:9}},[`& .${Xn.input}`]:{flexGrow:1,textOverflow:"ellipsis",opacity:0},variants:[{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{[`& .${Xn.tag}`]:{margin:2,maxWidth:"calc(100% - 4px)"}}},{props:{inputFocused:!0},style:{[`& .${Xn.input}`]:{opacity:1}}},{props:{multiple:!0},style:{[`& .${Xn.inputRoot}`]:{flexWrap:"wrap"}}}]}),iwe=ot("div",{name:"MuiAutocomplete",slot:"EndAdornment"})({position:"absolute",right:0,top:"50%",transform:"translate(0, -50%)"}),swe=ot(Eu,{name:"MuiAutocomplete",slot:"ClearIndicator"})({marginRight:-2,padding:4,visibility:"hidden"}),lwe=ot(Eu,{name:"MuiAutocomplete",slot:"PopupIndicator",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.popupIndicator,n.popupOpen&&t.popupIndicatorOpen]}})({padding:2,marginRight:-2,variants:[{props:{popupOpen:!0},style:{transform:"rotate(180deg)"}}]}),cwe=ot(DR,{name:"MuiAutocomplete",slot:"Popper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Xn.option}`]:t.option},t.popper,n.disablePortal&&t.popperDisablePortal]}})(rr(({theme:e})=>({zIndex:(e.vars||e).zIndex.modal,variants:[{props:{disablePortal:!0},style:{position:"absolute"}}]}))),uwe=ot(ef,{name:"MuiAutocomplete",slot:"Paper"})(rr(({theme:e})=>({...e.typography.body1,overflow:"auto"}))),dwe=ot("div",{name:"MuiAutocomplete",slot:"Loading"})(rr(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),fwe=ot("div",{name:"MuiAutocomplete",slot:"NoOptions"})(rr(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),pwe=ot("ul",{name:"MuiAutocomplete",slot:"Listbox"})(rr(({theme:e})=>({listStyle:"none",margin:0,padding:"8px 0",maxHeight:"40vh",overflow:"auto",position:"relative",[`& .${Xn.option}`]:{minHeight:48,display:"flex",overflow:"hidden",justifyContent:"flex-start",alignItems:"center",cursor:"pointer",paddingTop:6,boxSizing:"border-box",outline:"0",WebkitTapHighlightColor:"transparent",paddingBottom:6,paddingLeft:16,paddingRight:16,[e.breakpoints.up("sm")]:{minHeight:"auto"},[`&.${Xn.focused}`]:{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},'&[aria-disabled="true"]':{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:"none"},[`&.${Xn.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},'&[aria-selected="true"]':{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${Xn.focused}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:(e.vars||e).palette.action.selected}},[`&.${Xn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))),hwe=ot(S$,{name:"MuiAutocomplete",slot:"GroupLabel"})(rr(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,top:-8}))),mwe=ot("ul",{name:"MuiAutocomplete",slot:"GroupUl"})({padding:0,[`& .${Xn.option}`]:{paddingLeft:24}}),gwe=C.forwardRef(function(e,t){const n=tr({props:e,name:"MuiAutocomplete"}),{autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:i=!1,ChipProps:s,className:l,clearIcon:d=lI||(lI=p.jsx(nwe,{fontSize:"small"})),clearOnBlur:u=!n.freeSolo,clearOnEscape:m=!1,clearText:g="Clear",closeText:y="Close",componentsProps:x,defaultValue:w=n.multiple?[]:null,disableClearable:S=!1,disableCloseOnSelect:b=!1,disabled:$=!1,disabledItemsFocusable:k=!1,disableListWrap:R=!1,disablePortal:O=!1,filterOptions:P,filterSelectedOptions:D=!1,forcePopupIcon:A="auto",freeSolo:F=!1,fullWidth:L=!1,getLimitTagsText:_=we=>`+${we}`,getOptionDisabled:E,getOptionKey:z,getOptionLabel:I,isOptionEqualToValue:U,groupBy:N,handleHomeEndKeys:q=!n.freeSolo,id:Y,includeInputInList:oe=!1,inputValue:Q,limitTags:ae=-1,ListboxComponent:de,ListboxProps:X,loading:se=!1,loadingText:J="Loading…",multiple:Z=!1,noOptionsText:G="No options",onChange:ue,onClose:ie,onHighlightChange:fe,onInputChange:he,onOpen:me,open:le,openOnFocus:ve=!1,openText:Le="Open",options:Ie,PaperComponent:Re,PopperComponent:ne,popupIcon:qe=cI||(cI=p.jsx(U3,{})),readOnly:Oe=!1,renderGroup:Qe,renderInput:nt,renderOption:kt,renderTags:Ut,renderValue:at,selectOnFocus:et=!n.freeSolo,size:pt="medium",slots:ze={},slotProps:be={},value:He,...Me}=n,{getRootProps:$t,getInputProps:Et,getInputLabelProps:vt,getPopupIndicatorProps:it,getClearProps:st,getItemProps:At,getListboxProps:tn,getOptionProps:Bt,value:an,dirty:$n,expanded:Vt,id:Pn,popupOpen:Se,focused:jn,focusedItem:En,anchorEl:Jt,setAnchorEl:Pt,inputValue:Ur,groupedOptions:Vn}=Z1e({...n,componentName:"Autocomplete"}),cn=!S&&!$&&$n&&!Oe,Bn=(!F||A===!0)&&A!==!1,{onMouseDown:xe}=Et(),{ref:Te,..._e}=tn(),Ye=I||(we=>we.label??we),ut={...n,disablePortal:O,expanded:Vt,focused:jn,fullWidth:L,getOptionLabel:Ye,hasClearIcon:cn,hasPopupIcon:Bn,inputFocused:En===-1,popupOpen:Se,size:pt},Rt=owe(ut),St={slots:{paper:Re,popper:ne,...ze},slotProps:{chip:s,listbox:X,...x,...be}},[Tt,Nt]=mr("listbox",{elementType:pwe,externalForwardedProps:St,ownerState:ut,className:Rt.listbox,additionalProps:_e,ref:Te}),[Xt,It]=mr("paper",{elementType:ef,externalForwardedProps:St,ownerState:ut,className:Rt.paper}),[qt,ge]=mr("popper",{elementType:DR,externalForwardedProps:St,ownerState:ut,className:Rt.popper,additionalProps:{disablePortal:O,style:{width:Jt?Jt.clientWidth:null},role:"presentation",anchorEl:Jt,open:Se}});let ye;const Be=we=>({className:Rt.tag,disabled:$,...At(we)});if(Z?an.length>0&&(Ut?ye=Ut(an,Be,ut):at?ye=at(an,Be,ut):ye=an.map((we,Pe)=>{const{key:ft,...Ct}=Be({index:Pe});return p.jsx(M3,{label:Ye(we),size:pt,...Ct,...St.slotProps.chip},ft)})):at&&an!=null&&(ye=at(an,Be,ut)),ae>-1&&Array.isArray(ye)){const we=ye.length-ae;!jn&&we>0&&(ye=ye.splice(0,ae),ye.push(p.jsx("span",{className:Rt.tag,children:_(we)},ye.length)))}const gt=Qe||(we=>p.jsxs("li",{children:[p.jsx(hwe,{className:Rt.groupLabel,ownerState:ut,component:"div",children:we.group}),p.jsx(mwe,{className:Rt.groupUl,ownerState:ut,children:we.children})]},we.key)),We=kt||((we,Pe)=>{const{key:ft,...Ct}=we;return p.jsx("li",{...Ct,children:Ye(Pe)},ft)}),Dt=(we,Pe)=>{const ft=Bt({option:we,index:Pe});return We({...ft,className:Rt.option},we,{selected:ft["aria-selected"],index:Pe,inputValue:Ur},ut)},Kt=St.slotProps.clearIndicator,sn=St.slotProps.popupIndicator;return p.jsxs(C.Fragment,{children:[p.jsx(awe,{ref:t,className:Ht(Rt.root,l),ownerState:ut,...$t(Me),children:nt({id:Pn,disabled:$,fullWidth:!0,size:pt==="small"?"small":void 0,InputLabelProps:vt(),InputProps:{ref:Pt,className:Rt.inputRoot,startAdornment:ye,onMouseDown:we=>{we.target===we.currentTarget&&xe(we)},...(cn||Bn)&&{endAdornment:p.jsxs(iwe,{className:Rt.endAdornment,ownerState:ut,children:[cn?p.jsx(swe,{...st(),"aria-label":g,title:g,ownerState:ut,...Kt,className:Ht(Rt.clearIndicator,Kt?.className),children:d}):null,Bn?p.jsx(lwe,{...it(),disabled:$,"aria-label":Se?y:Le,title:Se?y:Le,ownerState:ut,...sn,className:Ht(Rt.popupIndicator,sn?.className),children:qe}):null]})}},inputProps:{className:Rt.input,disabled:$,readOnly:Oe,...Et()}})}),Jt?p.jsx(cwe,{as:qt,...ge,children:p.jsxs(uwe,{as:Xt,...It,children:[se&&Vn.length===0?p.jsx(dwe,{className:Rt.loading,ownerState:ut,children:J}):null,Vn.length===0&&!F&&!se?p.jsx(fwe,{className:Rt.noOptions,ownerState:ut,role:"presentation",onMouseDown:we=>{we.preventDefault()},children:G}):null,Vn.length>0?p.jsx(Tt,{as:de,...Nt,children:Vn.map((we,Pe)=>N?gt({key:we.key,group:we.group,children:we.options.map((ft,Ct)=>Dt(ft,we.index+Ct))}):Dt(we,Pe))}):null]})}):null]})});jr.extend(dR);const ywe=rn(p.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),o6=e=>{if(!e)return"Explore semantic models, run queries, and build reports";const t=e.replace(/^#+\s+/gm,"").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`]+)`/g,"$1").trim(),n=t.split(/\n\s*\n/)[1]||t;if(n.length<=120)return n;const r=n.substring(0,120).split(" ");return r.pop(),r.join(" ")+"..."},a6=(e,t)=>{const n=(e.readme||void 0)?.split(`
479
479
  `)??[];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(`
480
- `)};function uI(){const[e,t]=C.useState(!1),{apiClients:n}=er(),r=()=>{t(!0)},o=()=>{t(!1)},a=Ch({mutationFn(s){return n.environments.createEnvironment({name:s.name,readme:a6({name:s.name,readme:""},s.description)})},success:"Environment created",invalidates:[["environments"]],closeDialog:o,resource:"environment",action:"create"}),i=async s=>{s.preventDefault();const l=new FormData(s.currentTarget),d=l.get("name")?.toString(),u=l.get("description")?.toString();if(!d)throw new Error("Name is required");a.mutate({name:d,description:u})};return p.jsxs(Cn.Fragment,{children:[p.jsx(Qy,{label:"Environment",onClick:r}),p.jsx(Oo,{open:e,onClose:o,title:"New environment",description:"An environment holds packages and the connections they query through.",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{disabled:a.isPending,onClick:o,children:"Cancel"}),p.jsx(So,{type:"submit",form:"environment-form",variant:"contained",loading:a.isPending,children:"Create environment"})]}),children:p.jsx("form",{onSubmit:i,id:"environment-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx(yr,{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 vwe({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=er(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=Ch({mutationFn:()=>o.environments.deleteEnvironment(e.name),success:"Environment deleted",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"delete"});return p.jsxs(Cn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(Jx,{fontSize:"small"})}),p.jsx(xi,{children:"Delete"})]}),p.jsx(Oo,{open:n,onClose:i,title:"Delete environment",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{onClick:i,children:"Cancel"}),p.jsx(So,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>s.mutate(),loading:s.isPending,children:"Delete environment"})]}),children:p.jsxs(Ar,{variant:"body2",children:["Delete ",p.jsx("strong",{children:e.name}),"? Its packages stop being served and this cannot be undone."]})}),s.notice]})}function bwe({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=er(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=Ch({mutationFn(d){return o.environments.updateEnvironment(e.name,{name:e.name,readme:a6({name:e.name,readme:e.readme},d.description)})},success:"Environment updated",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"update"}),l=d=>{d.preventDefault();const u=new FormData(d.currentTarget).get("description")?.toString();s.mutate({description:u})};return p.jsxs(Cn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(eR,{fontSize:"small"})}),p.jsx(xi,{children:"Edit"})]}),p.jsx(Oo,{open:n,onClose:i,title:"Edit environment",description:"What this environment is, for the people who open it.",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{disabled:s.isPending,onClick:i,children:"Cancel"}),p.jsx(So,{type:"submit",form:"environment-form",variant:"contained",loading:s.isPending,children:"Save changes"})]}),children:p.jsx("form",{onSubmit:l,id:"environment-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",disabled:!0,type:"text",fullWidth:!0,size:"small",defaultValue:e.name,InputLabelProps:{shrink:!0}}),p.jsx(yr,{id:"description",name:"description",label:"Description",type:"text",fullWidth:!0,size:"small",defaultValue:o6(e.readme),InputLabelProps:{shrink:!0}})]})})}),s.notice]})}const xwe=[{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:tu.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:tu.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:tu.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:tu.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:tu.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:tu.connections}];function wwe({href:e,children:t}){return p.jsx(Ee,{component:"a",href:e,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary",textDecoration:"underline"},children:t})}function O2e({onClickEnvironment:e}){const{apiClients:t,mutable:n}=er(),{data:r,isSuccess:o,isError:a,error:i}=wo({queryKey:["environments"],queryFn:()=>t.environments.listEnvironments()});if(a)return p.jsx(Xa,{error:i,context:"Environments List"});if(!o)return p.jsx(Go,{text:"Loading environments..."});const s=r.data??[];return p.jsxs(O0,{maxWidth:"md",sx:{py:6},children:[p.jsxs(Ee,{sx:{mb:5},children:[p.jsx(wt,{variant:"h3",component:"h1",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Publisher"}),p.jsx(wt,{variant:"body1",color:"text.secondary",sx:{mb:3},children:"The analytics engine for Malloy."}),p.jsx(wt,{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."})]}),p.jsx(Sp,{container:!0,spacing:4,sx:{mb:5},children:xwe.map(l=>p.jsx(Sp,{size:{xs:12,sm:6},children:p.jsxs(Wn,{spacing:1,children:[p.jsx(wt,{variant:"body2",component:"a",href:l.href,target:"_blank",rel:"noopener noreferrer",sx:{fontWeight:500,color:"text.primary",textDecoration:"none","&:hover":{textDecoration:"underline"}},children:l.title}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{lineHeight:1.6},children:l.body})]})},l.title))}),p.jsx(wl,{sx:{my:4}}),s.length>0?p.jsx(Ds,{title:"Environments",count:s.length,description:"Published environments available on this server",...n?{action:p.jsx(uI,{})}:{},children:p.jsx(Wn,{children:s.map(l=>p.jsx(Swe,{environment:l,...e?{onClickEnvironment:e}:{}},l.name))})}):p.jsxs(Ee,{sx:{mb:4},children:[p.jsx(wt,{variant:"h5",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Get started"}),p.jsx(wt,{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?p.jsx(uI,{}):p.jsx(Hn,{variant:"contained",color:"primary",href:tu.publishing,target:"_blank",rel:"noopener noreferrer",children:"Learn how to create models"})]}),p.jsx(wl,{sx:{my:4}}),p.jsxs(wt,{variant:"body2",color:"text.secondary",sx:{maxWidth:720,lineHeight:1.6,mt:2},children:["Join the"," ",p.jsx(wwe,{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 Swe({environment:e,onClickEnvironment:t}){const{mutable:n}=er(),[r,o]=C.useState(null),a=!!r,i=o6(e.readme),s=d=>{d.stopPropagation(),o(d.currentTarget)},l=()=>o(null);return p.jsx(L1,{icon:p.jsx(ywe,{sx:{fontSize:18}}),tint:QE.environment,label:e.name??"",ariaLabel:e.name??"",...i?{description:i}:{},...e.name&&t?{onClick:d=>t(`/${e.name}/`,d)}:{},...n?{trailingAction:p.jsxs(p.Fragment,{children:[p.jsx(no,{size:"small",onClick:s,"aria-label":`Environment actions for ${e.name}`,children:p.jsx(e1,{fontSize:"small"})}),p.jsxs(dc,{anchorEl:r,open:a,onClose:l,onClick:d=>d.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[p.jsx(bwe,{environment:e,onCloseDialog:l}),p.jsx(vwe,{environment:e,onCloseDialog:l})]})]})}:{}})}var dp={},di={},ag={},fp={},dI={},fI;function Cwe(){return fI||(fI=1,Object.defineProperty(dI,"__esModule",{value:!0})),dI}var ig={},sg={},pI;function tf(){if(pI)return sg;pI=1,Object.defineProperty(sg,"__esModule",{value:!0}),sg.CronField=void 0;let e=class i6{#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(i6.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=>l=>new RegExp(`^\\d{0,2}${l}$`).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,l)=>this.#o.indexOf(s)!==l);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 sg.CronField=e,sg}var hI;function kwe(){if(hI)return ig;hI=1,Object.defineProperty(ig,"__esModule",{value:!0}),ig.CronDayOfMonth=void 0;const e=tf(),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 ig.CronDayOfMonth=o,ig}var lg={},mI;function $we(){if(mI)return lg;mI=1,Object.defineProperty(lg,"__esModule",{value:!0}),lg.CronDayOfWeek=void 0;const e=tf(),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 lg.CronDayOfWeek=o,lg}var cg={},gI;function Ewe(){if(gI)return cg;gI=1,Object.defineProperty(cg,"__esModule",{value:!0}),cg.CronHour=void 0;const e=tf(),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 cg.CronHour=o,cg}var ug={},yI;function Rwe(){if(yI)return ug;yI=1,Object.defineProperty(ug,"__esModule",{value:!0}),ug.CronMinute=void 0;const e=tf(),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 ug.CronMinute=o,ug}var dg={},vI={},Fa={},bI;function Twe(){if(bI)return Fa;bI=1,Object.defineProperty(Fa,"__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 l="numeric",d="short",u="long",m={year:l,month:l,day:l},g={year:l,month:d,day:l},y={year:l,month:d,day:l,weekday:d},x={year:l,month:u,day:l},w={year:l,month:u,day:l,weekday:u},S={hour:l,minute:l},b={hour:l,minute:l,second:l},$={hour:l,minute:l,second:l,timeZoneName:d},k={hour:l,minute:l,second:l,timeZoneName:u},R={hour:l,minute:l,hourCycle:"h23"},O={hour:l,minute:l,second:l,hourCycle:"h23"},P={hour:l,minute:l,second:l,hourCycle:"h23",timeZoneName:d},D={hour:l,minute:l,second:l,hourCycle:"h23",timeZoneName:u},A={year:l,month:l,day:l,hour:l,minute:l},F={year:l,month:l,day:l,hour:l,minute:l,second:l},L={year:l,month:d,day:l,hour:l,minute:l},_={year:l,month:d,day:l,hour:l,minute:l,second:l},E={year:l,month:d,day:l,weekday:d,hour:l,minute:l},z={year:l,month:u,day:l,hour:l,minute:l,timeZoneName:d},I={year:l,month:u,day:l,hour:l,minute:l,second:l,timeZoneName:d},U={year:l,month:u,day:l,weekday:u,hour:l,minute:l,timeZoneName:u},N={year:l,month:u,day:l,weekday:u,hour:l,minute:l,second:l,timeZoneName:u};class q{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 Y=null;class oe extends q{static get instance(){return Y===null&&(Y=new oe),Y}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(M,{format:V,locale:ee}){return Mu(M,V,ee)}formatOffset(M,V){return Us(this.offset(M),V)}offset(M){return-new Date(M).getTimezoneOffset()}equals(M){return M.type==="system"}get isValid(){return!0}}const Q=new Map;function ae(W){let M=Q.get(W);return M===void 0&&(M=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:W,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Q.set(W,M)),M}const de={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function X(W,M){const V=W.format(M).replace(/\u200E/g,""),ee=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(V),[,ce,Ce,De,Ue,Ke,jt,Mn]=ee;return[De,ce,Ce,Ue,Ke,jt,Mn]}function se(W,M){const V=W.formatToParts(M),ee=[];for(let ce=0;ce<V.length;ce++){const{type:Ce,value:De}=V[ce],Ue=de[Ce];Ce==="era"?ee[Ue]=De:We(Ue)||(ee[Ue]=parseInt(De,10))}return ee}const J=new Map;class Z extends q{static create(M){let V=J.get(M);return V===void 0&&J.set(M,V=new Z(M)),V}static resetCache(){J.clear(),Q.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=Z.isValidZone(M)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(M,{format:V,locale:ee}){return Mu(M,V,ee,this.name)}formatOffset(M,V){return Us(this.offset(M),V)}offset(M){if(!this.valid)return NaN;const V=new Date(M);if(isNaN(V))return NaN;const ee=ae(this.name);let[ce,Ce,De,Ue,Ke,jt,Mn]=ee.formatToParts?se(ee,V):X(ee,V);Ue==="BC"&&(ce=-Math.abs(ce)+1);const Fn=Za({year:ce,month:Ce,day:De,hour:Ke===24?0:Ke,minute:jt,second:Mn,millisecond:0});let fr=+V;const An=fr%1e3;return fr-=An>=0?An:1e3+An,(Fn-fr)/(60*1e3)}equals(M){return M.type==="iana"&&M.name===this.name}get isValid(){return this.valid}}let G={};function ue(W,M={}){const V=JSON.stringify([W,M]);let ee=G[V];return ee||(ee=new Intl.ListFormat(W,M),G[V]=ee),ee}const ie=new Map;function fe(W,M={}){const V=JSON.stringify([W,M]);let ee=ie.get(V);return ee===void 0&&(ee=new Intl.DateTimeFormat(W,M),ie.set(V,ee)),ee}const he=new Map;function me(W,M={}){const V=JSON.stringify([W,M]);let ee=he.get(V);return ee===void 0&&(ee=new Intl.NumberFormat(W,M),he.set(V,ee)),ee}const le=new Map;function ve(W,M={}){const{base:V,...ee}=M,ce=JSON.stringify([W,ee]);let Ce=le.get(ce);return Ce===void 0&&(Ce=new Intl.RelativeTimeFormat(W,M),le.set(ce,Ce)),Ce}let Le=null;function Ie(){return Le||(Le=new Intl.DateTimeFormat().resolvedOptions().locale,Le)}const Re=new Map;function ne(W){let M=Re.get(W);return M===void 0&&(M=new Intl.DateTimeFormat(W).resolvedOptions(),Re.set(W,M)),M}const qe=new Map;function Oe(W){let M=qe.get(W);if(!M){const V=new Intl.Locale(W);M="getWeekInfo"in V?V.getWeekInfo():V.weekInfo,"minimalDays"in M||(M={...He,...M}),qe.set(W,M)}return M}function Qe(W){const M=W.indexOf("-x-");M!==-1&&(W=W.substring(0,M));const V=W.indexOf("-u-");if(V===-1)return[W];{let ee,ce;try{ee=fe(W).resolvedOptions(),ce=W}catch{const Ue=W.substring(0,V);ee=fe(Ue).resolvedOptions(),ce=Ue}const{numberingSystem:Ce,calendar:De}=ee;return[ce,Ce,De]}}function nt(W,M,V){return(V||M)&&(W.includes("-u-")||(W+="-u"),V&&(W+=`-ca-${V}`),M&&(W+=`-nu-${M}`)),W}function kt(W){const M=[];for(let V=1;V<=12;V++){const ee=Tn.utc(2009,V,1);M.push(W(ee))}return M}function Ut(W){const M=[];for(let V=1;V<=7;V++){const ee=Tn.utc(2016,11,13+V);M.push(W(ee))}return M}function at(W,M,V,ee){const ce=W.listingMode();return ce==="error"?null:ce==="en"?V(M):ee(M)}function et(W){return W.numberingSystem&&W.numberingSystem!=="latn"?!1:W.numberingSystem==="latn"||!W.locale||W.locale.startsWith("en")||ne(W.locale).numberingSystem==="latn"}class pt{constructor(M,V,ee){this.padTo=ee.padTo||0,this.floor=ee.floor||!1;const{padTo:ce,floor:Ce,...De}=ee;if(!V||Object.keys(De).length>0){const Ue={useGrouping:!1,...ee};ee.padTo>0&&(Ue.minimumIntegerDigits=ee.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):ys(M,3);return en(V,this.padTo)}}}class ze{constructor(M,V,ee){this.opts=ee,this.originalZone=void 0;let ce;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&&Z.create(Ue).valid?(ce=Ue,this.dt=M):(ce="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,ce=M.zone.name):(ce="UTC",this.dt=M.setZone("UTC").plus({minutes:M.offset}),this.originalZone=M.zone);const Ce={...this.opts};Ce.timeZone=Ce.timeZone||ce,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 ee=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...V,value:ee}}else return V}):M}resolvedOptions(){return this.dtf.resolvedOptions()}}class be{constructor(M,V,ee){this.opts={style:"long",...ee},!V&&Pe()&&(this.rtf=ve(M,ee))}format(M,V){return this.rtf?this.rtf.format(M,V):Sc(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 Me{static fromOpts(M){return Me.create(M.locale,M.numberingSystem,M.outputCalendar,M.weekSettings,M.defaultToEN)}static create(M,V,ee,ce,Ce=!1){const De=M||cn.defaultLocale,Ue=De||(Ce?"en-US":Ie()),Ke=V||cn.defaultNumberingSystem,jt=ee||cn.defaultOutputCalendar,Mn=nn(ce)||cn.defaultWeekSettings;return new Me(Ue,Ke,jt,Mn,De)}static resetCache(){Le=null,ie.clear(),he.clear(),le.clear(),Re.clear(),qe.clear()}static fromObject({locale:M,numberingSystem:V,outputCalendar:ee,weekSettings:ce}={}){return Me.create(M,V,ee,ce)}constructor(M,V,ee,ce,Ce){const[De,Ue,Ke]=Qe(M);this.locale=De,this.numberingSystem=V||Ue||null,this.outputCalendar=ee||Ke||null,this.weekSettings=ce,this.intl=nt(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=et(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:Me.create(M.locale||this.specifiedLocale,M.numberingSystem||this.numberingSystem,M.outputCalendar||this.outputCalendar,nn(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 at(this,M,jl,()=>{const ee=this.intl==="ja"||this.intl.startsWith("ja-");V&=!ee;const ce=V?{month:M,day:"numeric"}:{month:M},Ce=V?"format":"standalone";if(!this.monthsCache[Ce][M]){const De=ee?Ue=>this.dtFormatter(Ue,ce).format():Ue=>this.extract(Ue,ce,"month");this.monthsCache[Ce][M]=kt(De)}return this.monthsCache[Ce][M]})}weekdays(M,V=!1){return at(this,M,xs,()=>{const ee=V?{weekday:M,year:"numeric",month:"long",day:"numeric"}:{weekday:M},ce=V?"format":"standalone";return this.weekdaysCache[ce][M]||(this.weekdaysCache[ce][M]=Ut(Ce=>this.extract(Ce,ee,"weekday"))),this.weekdaysCache[ce][M]})}meridiems(){return at(this,void 0,()=>Pu,()=>{if(!this.meridiemCache){const M={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Tn.utc(2016,11,13,9),Tn.utc(2016,11,13,19)].map(V=>this.extract(V,M,"dayperiod"))}return this.meridiemCache})}eras(M){return at(this,M,ja,()=>{const V={era:M};return this.eraCache[M]||(this.eraCache[M]=[Tn.utc(-40,1,1),Tn.utc(2017,1,1)].map(ee=>this.extract(ee,V,"era"))),this.eraCache[M]})}extract(M,V,ee){const ce=this.dtFormatter(M,V),Ce=ce.formatToParts(),De=Ce.find(Ue=>Ue.type.toLowerCase()===ee);return De?De.value:null}numberFormatter(M={}){return new pt(this.intl,M.forceSimple||this.fastNumbers,M)}dtFormatter(M,V={}){return new ze(M,this.intl,V)}relFormatter(M={}){return new be(this.intl,this.isEnglish(),M)}listFormatter(M={}){return ue(this.intl,M)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||ne(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:ft()?Oe(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 $t=null;class Et extends q{static get utcInstance(){return $t===null&&($t=new Et(0)),$t}static instance(M){return M===0?Et.utcInstance:new Et(M)}static parseSpecifier(M){if(M){const V=M.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(V)return new Et(Ol(V[1],V[2]))}return null}constructor(M){super(),this.fixed=M}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Us(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Us(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(M,V){return Us(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 vt extends q{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 it(W,M){if(We(W)||W===null)return M;if(W instanceof q)return W;if(sn(W)){const V=W.toLowerCase();return V==="default"?M:V==="local"||V==="system"?oe.instance:V==="utc"||V==="gmt"?Et.utcInstance:Et.parseSpecifier(V)||Z.create(W)}else return Dt(W)?Et.instance(W):typeof W=="object"&&"offset"in W&&typeof W.offset=="function"?W:new vt(W)}const st={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},At={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]},tn=st.hanidec.replace(/[\[|\]]/g,"").split("");function Bt(W){let M=parseInt(W,10);if(isNaN(M)){M="";for(let V=0;V<W.length;V++){const ee=W.charCodeAt(V);if(W[V].search(st.hanidec)!==-1)M+=tn.indexOf(W[V]);else for(const ce in At){const[Ce,De]=At[ce];ee>=Ce&&ee<=De&&(M+=ee-Ce)}}return parseInt(M,10)}else return M}const an=new Map;function $n(){an.clear()}function Vt({numberingSystem:W},M=""){const V=W||"latn";let ee=an.get(V);ee===void 0&&(ee=new Map,an.set(V,ee));let ce=ee.get(M);return ce===void 0&&(ce=new RegExp(`${st[V]}${M}`),ee.set(M,ce)),ce}let Pn=()=>Date.now(),Se="system",jn=null,En=null,Jt=null,Pt=60,Ur,Vn=null;class cn{static get now(){return Pn}static set now(M){Pn=M}static set defaultZone(M){Se=M}static get defaultZone(){return it(Se,oe.instance)}static get defaultLocale(){return jn}static set defaultLocale(M){jn=M}static get defaultNumberingSystem(){return En}static set defaultNumberingSystem(M){En=M}static get defaultOutputCalendar(){return Jt}static set defaultOutputCalendar(M){Jt=M}static get defaultWeekSettings(){return Vn}static set defaultWeekSettings(M){Vn=nn(M)}static get twoDigitCutoffYear(){return Pt}static set twoDigitCutoffYear(M){Pt=M%100}static get throwOnInvalid(){return Ur}static set throwOnInvalid(M){Ur=M}static resetCaches(){Me.resetCache(),Z.resetCache(),Tn.resetCache(),$n()}}class Bn{constructor(M,V){this.reason=M,this.explanation=V}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const xe=[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 _e(W,M){return new Bn("unit out of range",`you specified ${M} (of type ${typeof M}) as a ${W}, which is invalid`)}function Ye(W,M,V){const ee=new Date(Date.UTC(W,M-1,V));W<100&&W>=0&&ee.setUTCFullYear(ee.getUTCFullYear()-1900);const ce=ee.getUTCDay();return ce===0?7:ce}function ut(W,M,V){return V+(ca(W)?Te:xe)[M-1]}function Rt(W,M){const V=ca(W)?Te:xe,ee=V.findIndex(Ce=>Ce<M),ce=M-V[ee];return{month:ee+1,day:ce}}function St(W,M){return(W-M+7)%7+1}function Tt(W,M=4,V=1){const{year:ee,month:ce,day:Ce}=W,De=ut(ee,ce,Ce),Ue=St(Ye(ee,ce,Ce),V);let Ke=Math.floor((De-Ue+14-M)/7),jt;return Ke<1?(jt=ee-1,Ke=vs(jt,M,V)):Ke>vs(ee,M,V)?(jt=ee+1,Ke=1):jt=ee,{weekYear:jt,weekNumber:Ke,weekday:Ue,...Pl(W)}}function Nt(W,M=4,V=1){const{weekYear:ee,weekNumber:ce,weekday:Ce}=W,De=St(Ye(ee,1,M),V),Ue=dr(ee);let Ke=ce*7+Ce-De-7+M,jt;Ke<1?(jt=ee-1,Ke+=dr(jt)):Ke>Ue?(jt=ee+1,Ke-=dr(ee)):jt=ee;const{month:Mn,day:Fn}=Rt(jt,Ke);return{year:jt,month:Mn,day:Fn,...Pl(W)}}function Xt(W){const{year:M,month:V,day:ee}=W,ce=ut(M,V,ee);return{year:M,ordinal:ce,...Pl(W)}}function It(W){const{year:M,ordinal:V}=W,{month:ee,day:ce}=Rt(M,V);return{year:M,month:ee,day:ce,...Pl(W)}}function qt(W,M){if(!We(W.localWeekday)||!We(W.localWeekNumber)||!We(W.localWeekYear)){if(!We(W.weekday)||!We(W.weekNumber)||!We(W.weekYear))throw new o("Cannot mix locale-based week fields with ISO-based week fields");return We(W.localWeekday)||(W.weekday=W.localWeekday),We(W.localWeekNumber)||(W.weekNumber=W.localWeekNumber),We(W.localWeekYear)||(W.weekYear=W.localWeekYear),delete W.localWeekday,delete W.localWeekNumber,delete W.localWeekYear,{minDaysInFirstWeek:M.getMinDaysInFirstWeek(),startOfWeek:M.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function ge(W,M=4,V=1){const ee=Kt(W.weekYear),ce=On(W.weekNumber,1,vs(W.weekYear,M,V)),Ce=On(W.weekday,1,7);return ee?ce?Ce?!1:_e("weekday",W.weekday):_e("week",W.weekNumber):_e("weekYear",W.weekYear)}function ye(W){const M=Kt(W.year),V=On(W.ordinal,1,dr(W.year));return M?V?!1:_e("ordinal",W.ordinal):_e("year",W.year)}function Be(W){const M=Kt(W.year),V=On(W.month,1,12),ee=On(W.day,1,Vr(W.year,W.month));return M?V?ee?!1:_e("day",W.day):_e("month",W.month):_e("year",W.year)}function gt(W){const{hour:M,minute:V,second:ee,millisecond:ce}=W,Ce=On(M,0,23)||M===24&&V===0&&ee===0&&ce===0,De=On(V,0,59),Ue=On(ee,0,59),Ke=On(ce,0,999);return Ce?De?Ue?Ke?!1:_e("millisecond",ce):_e("second",ee):_e("minute",V):_e("hour",M)}function We(W){return typeof W>"u"}function Dt(W){return typeof W=="number"}function Kt(W){return typeof W=="number"&&W%1===0}function sn(W){return typeof W=="string"}function we(W){return Object.prototype.toString.call(W)==="[object Date]"}function Pe(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function ft(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Ct(W){return Array.isArray(W)?W:[W]}function Mt(W,M,V){if(W.length!==0)return W.reduce((ee,ce)=>{const Ce=[M(ce),ce];return ee&&V(ee[0],Ce[0])===ee[0]?ee:Ce},null)[1]}function Ot(W,M){return M.reduce((V,ee)=>(V[ee]=W[ee],V),{})}function Lt(W,M){return Object.prototype.hasOwnProperty.call(W,M)}function nn(W){if(W==null)return null;if(typeof W!="object")throw new i("Week settings must be an object");if(!On(W.firstDay,1,7)||!On(W.minimalDays,1,7)||!Array.isArray(W.weekend)||W.weekend.some(M=>!On(M,1,7)))throw new i("Invalid week settings");return{firstDay:W.firstDay,minimalDays:W.minimalDays,weekend:Array.from(W.weekend)}}function On(W,M,V){return Kt(W)&&W>=M&&W<=V}function or(W,M){return W-M*Math.floor(W/M)}function en(W,M=2){const V=W<0;let ee;return V?ee="-"+(""+-W).padStart(M,"0"):ee=(""+W).padStart(M,"0"),ee}function Dr(W){if(!(We(W)||W===null||W===""))return parseInt(W,10)}function lo(W){if(!(We(W)||W===null||W===""))return parseFloat(W)}function Do(W){if(!(We(W)||W===null||W==="")){const M=parseFloat("0."+W)*1e3;return Math.floor(M)}}function ys(W,M,V="round"){const ee=10**M;switch(V){case"expand":return W>0?Math.ceil(W*ee)/ee:Math.floor(W*ee)/ee;case"trunc":return Math.trunc(W*ee)/ee;case"round":return Math.round(W*ee)/ee;case"floor":return Math.floor(W*ee)/ee;case"ceil":return Math.ceil(W*ee)/ee;default:throw new RangeError(`Value rounding ${V} is out of range`)}}function ca(W){return W%4===0&&(W%100!==0||W%400===0)}function dr(W){return ca(W)?366:365}function Vr(W,M){const V=or(M-1,12)+1,ee=W+(M-V)/12;return V===2?ca(ee)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][V-1]}function Za(W){let M=Date.UTC(W.year,W.month-1,W.day,W.hour,W.minute,W.second,W.millisecond);return W.year<100&&W.year>=0&&(M=new Date(M),M.setUTCFullYear(W.year,W.month-1,W.day)),+M}function Ml(W,M,V){return-St(Ye(W,1,M),V)+M-1}function vs(W,M=4,V=1){const ee=Ml(W,M,V),ce=Ml(W+1,M,V);return(dr(W)-ee+ce)/7}function Oi(W){return W>99?W:W>cn.twoDigitCutoffYear?1900+W:2e3+W}function Mu(W,M,V,ee=null){const ce=new Date(W),Ce={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};ee&&(Ce.timeZone=ee);const De={timeZoneName:M,...Ce},Ue=new Intl.DateTimeFormat(V,De).formatToParts(ce).find(Ke=>Ke.type.toLowerCase()==="timezonename");return Ue?Ue.value:null}function Ol(W,M){let V=parseInt(W,10);Number.isNaN(V)&&(V=0);const ee=parseInt(M,10)||0,ce=V<0||Object.is(V,-0)?-ee:ee;return V*60+ce}function bs(W){const M=Number(W);if(typeof W=="boolean"||W===""||!Number.isFinite(M))throw new i(`Invalid unit value ${W}`);return M}function bc(W,M){const V={};for(const ee in W)if(Lt(W,ee)){const ce=W[ee];if(ce==null)continue;V[M(ee)]=bs(ce)}return V}function Us(W,M){const V=Math.trunc(Math.abs(W/60)),ee=Math.trunc(Math.abs(W%60)),ce=W>=0?"+":"-";switch(M){case"short":return`${ce}${en(V,2)}:${en(ee,2)}`;case"narrow":return`${ce}${V}${ee>0?`:${ee}`:""}`;case"techie":return`${ce}${en(V,2)}${en(ee,2)}`;default:throw new RangeError(`Value format ${M} is out of range for property format`)}}function Pl(W){return Ot(W,["hour","minute","second","millisecond"])}const Ou=["January","February","March","April","May","June","July","August","September","October","November","December"],rf=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],$h=["J","F","M","A","M","J","J","A","S","O","N","D"];function jl(W){switch(W){case"narrow":return[...$h];case"short":return[...rf];case"long":return[...Ou];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 xc=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],wc=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Vs=["M","T","W","T","F","S","S"];function xs(W){switch(W){case"narrow":return[...Vs];case"short":return[...wc];case"long":return[...xc];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Pu=["AM","PM"],ju=["Before Christ","Anno Domini"],of=["BC","AD"],Al=["B","A"];function ja(W){switch(W){case"narrow":return[...Al];case"short":return[...of];case"long":return[...ju];default:return null}}function Au(W){return Pu[W.hour<12?0:1]}function Dl(W,M){return xs(M)[W.weekday-1]}function Pi(W,M){return jl(M)[W.month-1]}function Du(W,M){return ja(M)[W.year<0?0:1]}function Sc(W,M,V="always",ee=!1){const ce={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(W)===-1;if(V==="auto"&&Ce){const Fn=W==="days";switch(M){case 1:return Fn?"tomorrow":`next ${ce[W][0]}`;case-1:return Fn?"yesterday":`last ${ce[W][0]}`;case 0:return Fn?"today":`this ${ce[W][0]}`}}const De=Object.is(M,-0)||M<0,Ue=Math.abs(M),Ke=Ue===1,jt=ce[W],Mn=ee?Ke?jt[1]:jt[2]||jt[1]:Ke?ce[W][0]:W;return De?`${Ue} ${Mn} ago`:`in ${Ue} ${Mn}`}function Nu(W,M){let V="";for(const ee of W)ee.literal?V+=ee.val:V+=M(ee.val);return V}const Cc={D:m,DD:g,DDD:x,DDDD:w,t:S,tt:b,ttt:$,tttt:k,T:R,TT:O,TTT:P,TTTT:D,f:A,ff:L,fff:z,ffff:U,F,FF:_,FFF:I,FFFF:N};class ro{static create(M,V={}){return new ro(M,V)}static parseFormat(M){let V=null,ee="",ce=!1;const Ce=[];for(let De=0;De<M.length;De++){const Ue=M.charAt(De);Ue==="'"?((ee.length>0||ce)&&Ce.push({literal:ce||/^\s+$/.test(ee),val:ee===""?"'":ee}),V=null,ee="",ce=!ce):ce||Ue===V?ee+=Ue:(ee.length>0&&Ce.push({literal:/^\s+$/.test(ee),val:ee}),ee=Ue,V=Ue)}return ee.length>0&&Ce.push({literal:ce||/^\s+$/.test(ee),val:ee}),Ce}static macroTokenToFormatOpts(M){return Cc[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,ee=void 0){if(this.opts.forceSimple)return en(M,V);const ce={...this.opts};return V>0&&(ce.padTo=V),ee&&(ce.signDisplay=ee),this.loc.numberFormatter(ce).format(M)}formatDateTimeFromString(M,V){const ee=this.loc.listingMode()==="en",ce=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",Ce=(An,Zr)=>this.loc.extract(M,An,Zr),De=An=>M.isOffsetFixed&&M.offset===0&&An.allowZ?"Z":M.isValid?M.zone.formatOffset(M.ts,An.format):"",Ue=()=>ee?Au(M):Ce({hour:"numeric",hourCycle:"h12"},"dayperiod"),Ke=(An,Zr)=>ee?Pi(M,An):Ce(Zr?{month:An}:{month:An,day:"numeric"},"month"),jt=(An,Zr)=>ee?Dl(M,An):Ce(Zr?{weekday:An}:{weekday:An,month:"long",day:"numeric"},"weekday"),Mn=An=>{const Zr=ro.macroTokenToFormatOpts(An);return Zr?this.formatWithSystemDefault(M,Zr):An},Fn=An=>ee?Du(M,An):Ce({era:An},"era"),fr=An=>{switch(An){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 ce?Ce({day:"numeric"},"day"):this.num(M.day);case"dd":return ce?Ce({day:"2-digit"},"day"):this.num(M.day,2);case"c":return this.num(M.weekday);case"ccc":return jt("short",!0);case"cccc":return jt("long",!0);case"ccccc":return jt("narrow",!0);case"E":return this.num(M.weekday);case"EEE":return jt("short",!1);case"EEEE":return jt("long",!1);case"EEEEE":return jt("narrow",!1);case"L":return ce?Ce({month:"numeric",day:"numeric"},"month"):this.num(M.month);case"LL":return ce?Ce({month:"2-digit",day:"numeric"},"month"):this.num(M.month,2);case"LLL":return Ke("short",!0);case"LLLL":return Ke("long",!0);case"LLLLL":return Ke("narrow",!0);case"M":return ce?Ce({month:"numeric"},"month"):this.num(M.month);case"MM":return ce?Ce({month:"2-digit"},"month"):this.num(M.month,2);case"MMM":return Ke("short",!1);case"MMMM":return Ke("long",!1);case"MMMMM":return Ke("narrow",!1);case"y":return ce?Ce({year:"numeric"},"year"):this.num(M.year);case"yy":return ce?Ce({year:"2-digit"},"year"):this.num(M.year.toString().slice(-2),2);case"yyyy":return ce?Ce({year:"numeric"},"year"):this.num(M.year,4);case"yyyyyy":return ce?Ce({year:"numeric"},"year"):this.num(M.year,6);case"G":return Fn("short");case"GG":return Fn("long");case"GGGGG":return Fn("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 Mn(An)}};return Nu(ro.parseFormat(V),fr)}formatDurationFromString(M,V){const ee=this.opts.signMode==="negativeLargestOnly"?-1:1,ce=Mn=>{switch(Mn[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=(Mn,Fn)=>fr=>{const An=ce(fr);if(An){const Zr=Fn.isNegativeDuration&&An!==Fn.largestUnit?ee:1;let Qo;return this.opts.signMode==="negativeLargestOnly"&&An!==Fn.largestUnit?Qo="never":this.opts.signMode==="all"?Qo="always":Qo="auto",this.num(Mn.get(An)*Zr,fr.length,Qo)}else return fr},De=ro.parseFormat(V),Ue=De.reduce((Mn,{literal:Fn,val:fr})=>Fn?Mn:Mn.concat(fr),[]),Ke=M.shiftTo(...Ue.map(ce).filter(Mn=>Mn)),jt={isNegativeDuration:Ke<0,largestUnit:Object.keys(Ke.values)[0]};return Nu(De,Ce(Ke,jt))}}const Iu=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function B(...W){const M=W.reduce((V,ee)=>V+ee.source,"");return RegExp(`^${M}$`)}function $o(...W){return M=>W.reduce(([V,ee,ce],Ce)=>{const[De,Ue,Ke]=Ce(M,ce);return[{...V,...De},Ue||ee,Ke]},[{},null,1]).slice(0,2)}function oo(W,...M){if(W==null)return[null,null];for(const[V,ee]of M){const ce=V.exec(W);if(ce)return ee(ce)}return[null,null]}function Ja(...W){return(M,V)=>{const ee={};let ce;for(ce=0;ce<W.length;ce++)ee[W[ce]]=Dr(M[V+ce]);return[ee,null,V+ce]}}const je=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,ws=`(?:${je.source}?(?:\\[(${Iu.source})\\])?)?`,zn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Ko=RegExp(`${zn.source}${ws}`),qs=RegExp(`(?:[Tt]${Ko.source})?`),Lu=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,af=/(\d{4})-?W(\d\d)(?:-?(\d))?/,sf=/(\d{4})-?(\d{3})/,rt=Ja("weekYear","weekNumber","weekDay"),zu=Ja("year","ordinal"),Fu=/(\d{4})-(\d\d)-(\d\d)/,kc=RegExp(`${zn.source} ?(?:${je.source}|(${Iu.source}))?`),lf=RegExp(`(?: ${kc.source})?`);function Hs(W,M,V){const ee=W[M];return We(ee)?V:Dr(ee)}function Nl(W,M){return[{year:Hs(W,M),month:Hs(W,M+1,1),day:Hs(W,M+2,1)},null,M+3]}function Ss(W,M){return[{hours:Hs(W,M,0),minutes:Hs(W,M+1,0),seconds:Hs(W,M+2,0),milliseconds:Do(W[M+3])},null,M+4]}function Ws(W,M){const V=!W[M]&&!W[M+1],ee=Ol(W[M+1],W[M+2]),ce=V?null:Et.instance(ee);return[{},ce,M+3]}function ua(W,M){const V=W[M]?Z.create(W[M]):null;return[{},V,M+1]}const Eh=RegExp(`^T?${zn.source}$`),Rh=/^-?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 Il(W){const[M,V,ee,ce,Ce,De,Ue,Ke,jt]=W,Mn=M[0]==="-",Fn=Ke&&Ke[0]==="-",fr=(An,Zr=!1)=>An!==void 0&&(Zr||An&&Mn)?-An:An;return[{years:fr(lo(V)),months:fr(lo(ee)),weeks:fr(lo(ce)),days:fr(lo(Ce)),hours:fr(lo(De)),minutes:fr(lo(Ue)),seconds:fr(lo(Ke),Ke==="-0"),milliseconds:fr(Do(jt),Fn)}]}const cf={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function _u(W,M,V,ee,ce,Ce,De){const Ue={year:M.length===2?Oi(Dr(M)):Dr(M),month:rf.indexOf(V)+1,day:Dr(ee),hour:Dr(ce),minute:Dr(Ce)};return De&&(Ue.second=Dr(De)),W&&(Ue.weekday=W.length>3?xc.indexOf(W)+1:wc.indexOf(W)+1),Ue}const Th=/^(?:(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 uf(W){const[,M,V,ee,ce,Ce,De,Ue,Ke,jt,Mn,Fn]=W,fr=_u(M,ce,ee,V,Ce,De,Ue);let An;return Ke?An=cf[Ke]:jt?An=0:An=Ol(Mn,Fn),[fr,new Et(An)]}function Mh(W){return W.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const df=/^(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$/,Bu=/^(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$/,Oh=/^(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 $c(W){const[,M,V,ee,ce,Ce,De,Ue]=W;return[_u(M,ce,ee,V,Ce,De,Ue),Et.utcInstance]}function Ph(W){const[,M,V,ee,ce,Ce,De,Ue]=W;return[_u(M,Ue,V,ee,ce,Ce,De),Et.utcInstance]}const jh=B(Lu,qs),Ah=B(af,qs),Dh=B(sf,qs),Uu=B(Ko),Ys=$o(Nl,Ss,Ws,ua),Nh=$o(rt,Ss,Ws,ua),ff=$o(zu,Ss,Ws,ua),pf=$o(Ss,Ws,ua);function hf(W){return oo(W,[jh,Ys],[Ah,Nh],[Dh,ff],[Uu,pf])}function mf(W){return oo(Mh(W),[Th,uf])}function gf(W){return oo(W,[df,$c],[Bu,$c],[Oh,Ph])}function Gs(W){return oo(W,[Rh,Il])}const Ih=$o(Ss);function Lh(W){return oo(W,[Eh,Ih])}const zh=B(Fu,lf),yf=B(kc),vf=$o(Ss,Ws,ua);function Ll(W){return oo(W,[zh,Ys],[yf,vf])}const ar="Invalid Duration",Cs={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}},Xr={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},...Cs},H=146097/400,te=146097/4800,K={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:te/7,days:te,hours:te*24,minutes:te*24*60,seconds:te*24*60*60,milliseconds:te*24*60*60*1e3},...Cs},$e=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Zt=$e.slice(0).reverse();function Gt(W,M,V=!1){const ee={values:V?M.values:{...W.values,...M.values||{}},loc:W.loc.clone(M.loc),conversionAccuracy:M.conversionAccuracy||W.conversionAccuracy,matrix:M.matrix||W.matrix};return new Qt(ee)}function Dn(W,M){var V;let ee=(V=M.milliseconds)!=null?V:0;for(const ce of Zt.slice(1))M[ce]&&(ee+=M[ce]*W[ce].milliseconds);return ee}function Gn(W,M){const V=Dn(W,M)<0?-1:1;$e.reduceRight((ee,ce)=>{if(We(M[ce]))return ee;if(ee){const Ce=M[ee]*V,De=W[ce][ee],Ue=Math.floor(Ce/De);M[ce]+=Ue*V,M[ee]-=Ue*De*V}return ce},null),$e.reduce((ee,ce)=>{if(We(M[ce]))return ee;if(ee){const Ce=M[ee]%1;M[ee]-=Ce,M[ce]+=Ce*W[ee][ce]}return ce},null)}function Kn(W){const M={};for(const[V,ee]of Object.entries(W))ee!==0&&(M[V]=ee);return M}class Qt{constructor(M){const V=M.conversionAccuracy==="longterm"||!1;let ee=V?K:Xr;M.matrix&&(ee=M.matrix),this.values=M.values,this.loc=M.loc||Me.create(),this.conversionAccuracy=V?"longterm":"casual",this.invalid=M.invalid||null,this.matrix=ee,this.isLuxonDuration=!0}static fromMillis(M,V){return Qt.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 Qt({values:bc(M,Qt.normalizeUnit),loc:Me.fromObject(V),conversionAccuracy:V.conversionAccuracy,matrix:V.matrix})}static fromDurationLike(M){if(Dt(M))return Qt.fromMillis(M);if(Qt.isDuration(M))return M;if(typeof M=="object")return Qt.fromObject(M);throw new i(`Unknown duration argument ${M} of type ${typeof M}`)}static fromISO(M,V){const[ee]=Gs(M);return ee?Qt.fromObject(ee,V):Qt.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static fromISOTime(M,V){const[ee]=Lh(M);return ee?Qt.fromObject(ee,V):Qt.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 ee=M instanceof Bn?M:new Bn(M,V);if(cn.throwOnInvalid)throw new r(ee);return new Qt({invalid:ee})}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 ee={...V,floor:V.round!==!1&&V.floor!==!1};return this.isValid?ro.create(this.loc,ee).formatDurationFromString(this,M):ar}toHuman(M={}){if(!this.isValid)return ar;const V=M.showZeros!==!1,ee=$e.map(ce=>{const Ce=this.values[ce];return We(Ce)||Ce===0&&!V?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...M,unit:ce.slice(0,-1)}).format(Ce)}).filter(ce=>ce);return this.loc.listFormatter({type:"conjunction",style:M.listStyle||"narrow",...M}).format(ee)}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+=ys(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},Tn.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?Dn(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(M){if(!this.isValid)return this;const V=Qt.fromDurationLike(M),ee={};for(const ce of $e)(Lt(V.values,ce)||Lt(this.values,ce))&&(ee[ce]=V.get(ce)+this.get(ce));return Gt(this,{values:ee},!0)}minus(M){if(!this.isValid)return this;const V=Qt.fromDurationLike(M);return this.plus(V.negate())}mapUnits(M){if(!this.isValid)return this;const V={};for(const ee of Object.keys(this.values))V[ee]=bs(M(this.values[ee],ee));return Gt(this,{values:V},!0)}get(M){return this[Qt.normalizeUnit(M)]}set(M){if(!this.isValid)return this;const V={...this.values,...bc(M,Qt.normalizeUnit)};return Gt(this,{values:V})}reconfigure({locale:M,numberingSystem:V,conversionAccuracy:ee,matrix:ce}={}){const Ce={loc:this.loc.clone({locale:M,numberingSystem:V}),matrix:ce,conversionAccuracy:ee};return Gt(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),Gt(this,{values:M},!0)}rescale(){if(!this.isValid)return this;const M=Kn(this.normalize().shiftToAll().toObject());return Gt(this,{values:M},!0)}shiftTo(...M){if(!this.isValid)return this;if(M.length===0)return this;M=M.map(De=>Qt.normalizeUnit(De));const V={},ee={},ce=this.toObject();let Ce;for(const De of $e)if(M.indexOf(De)>=0){Ce=De;let Ue=0;for(const jt in ee)Ue+=this.matrix[jt][De]*ee[jt],ee[jt]=0;Dt(ce[De])&&(Ue+=ce[De]);const Ke=Math.trunc(Ue);V[De]=Ke,ee[De]=(Ue*1e3-Ke*1e3)/1e3}else Dt(ce[De])&&(ee[De]=ce[De]);for(const De in ee)ee[De]!==0&&(V[Ce]+=De===Ce?ee[De]:ee[De]/this.matrix[Ce][De]);return Gn(this.matrix,V),Gt(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 Gt(this,{values:M},!0)}removeZeros(){if(!this.isValid)return this;const M=Kn(this.values);return Gt(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(ee,ce){return ee===void 0||ee===0?ce===void 0||ce===0:ee===ce}for(const ee of $e)if(!V(this.values[ee],M.values[ee]))return!1;return!0}}const kr="Invalid Interval";function $r(W,M){return!W||!W.isValid?bn.invalid("missing or invalid start"):!M||!M.isValid?bn.invalid("missing or invalid end"):M<W?bn.invalid("end before start",`The end of an interval must be after its start, but you had start=${W.toISO()} and end=${M.toISO()}`):null}class bn{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 ee=M instanceof Bn?M:new Bn(M,V);if(cn.throwOnInvalid)throw new n(ee);return new bn({invalid:ee})}static fromDateTimes(M,V){const ee=ai(M),ce=ai(V);return $r(ee,ce)??new bn({start:ee,end:ce})}static after(M,V){const ee=Qt.fromDurationLike(V),ce=ai(M);return bn.fromDateTimes(ce,ce.plus(ee))}static before(M,V){const ee=Qt.fromDurationLike(V),ce=ai(M);return bn.fromDateTimes(ce.minus(ee),ce)}static fromISO(M,V){const[ee,ce]=(M||"").split("/",2);if(ee&&ce){let Ce,De;try{Ce=Tn.fromISO(ee,V),De=Ce.isValid}catch{De=!1}let Ue,Ke;try{Ue=Tn.fromISO(ce,V),Ke=Ue.isValid}catch{Ke=!1}if(De&&Ke)return bn.fromDateTimes(Ce,Ue);if(De){const jt=Qt.fromISO(ce,V);if(jt.isValid)return bn.after(Ce,jt)}else if(Ke){const jt=Qt.fromISO(ee,V);if(jt.isValid)return bn.before(Ue,jt)}}return bn.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 ee=this.start.startOf(M,V);let ce;return V!=null&&V.useLocaleWeeks?ce=this.end.reconfigure({locale:ee.locale}):ce=this.end,ce=ce.startOf(M,V),Math.floor(ce.diff(ee,M).get(M))+(ce.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?bn.fromDateTimes(M||this.s,V||this.e):this}splitAt(...M){if(!this.isValid)return[];const V=M.map(ai).filter(De=>this.contains(De)).sort((De,Ue)=>De.toMillis()-Ue.toMillis()),ee=[];let{s:ce}=this,Ce=0;for(;ce<this.e;){const De=V[Ce]||this.e,Ue=+De>+this.e?this.e:De;ee.push(bn.fromDateTimes(ce,Ue)),ce=Ue,Ce+=1}return ee}splitBy(M){const V=Qt.fromDurationLike(M);if(!this.isValid||!V.isValid||V.as("milliseconds")===0)return[];let{s:ee}=this,ce=1,Ce;const De=[];for(;ee<this.e;){const Ue=this.start.plus(V.mapUnits(Ke=>Ke*ce));Ce=+Ue>+this.e?this.e:Ue,De.push(bn.fromDateTimes(ee,Ce)),ee=Ce,ce+=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,ee=this.e<M.e?this.e:M.e;return V>=ee?null:bn.fromDateTimes(V,ee)}union(M){if(!this.isValid)return this;const V=this.s<M.s?this.s:M.s,ee=this.e>M.e?this.e:M.e;return bn.fromDateTimes(V,ee)}static merge(M){const[V,ee]=M.sort((ce,Ce)=>ce.s-Ce.s).reduce(([ce,Ce],De)=>Ce?Ce.overlaps(De)||Ce.abutsStart(De)?[ce,Ce.union(De)]:[ce.concat([Ce]),De]:[ce,De],[[],null]);return ee&&V.push(ee),V}static xor(M){let V=null,ee=0;const ce=[],Ce=M.map(Ke=>[{time:Ke.s,type:"s"},{time:Ke.e,type:"e"}]),De=Array.prototype.concat(...Ce),Ue=De.sort((Ke,jt)=>Ke.time-jt.time);for(const Ke of Ue)ee+=Ke.type==="s"?1:-1,ee===1?V=Ke.time:(V&&+V!=+Ke.time&&ce.push(bn.fromDateTimes(V,Ke.time)),V=null);return bn.merge(ce)}difference(...M){return bn.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=m,V={}){return this.isValid?ro.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):Qt.invalid(this.invalidReason)}mapEndpoints(M){return bn.fromDateTimes(M(this.s),M(this.e))}}class br{static hasDST(M=cn.defaultZone){const V=Tn.now().setZone(M).set({month:12});return!M.isUniversal&&V.offset!==V.set({month:6}).offset}static isValidIANAZone(M){return Z.isValidZone(M)}static normalizeZone(M){return it(M,cn.defaultZone)}static getStartOfWeek({locale:M=null,locObj:V=null}={}){return(V||Me.create(M)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:M=null,locObj:V=null}={}){return(V||Me.create(M)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:M=null,locObj:V=null}={}){return(V||Me.create(M)).getWeekendDays().slice()}static months(M="long",{locale:V=null,numberingSystem:ee=null,locObj:ce=null,outputCalendar:Ce="gregory"}={}){return(ce||Me.create(V,ee,Ce)).months(M)}static monthsFormat(M="long",{locale:V=null,numberingSystem:ee=null,locObj:ce=null,outputCalendar:Ce="gregory"}={}){return(ce||Me.create(V,ee,Ce)).months(M,!0)}static weekdays(M="long",{locale:V=null,numberingSystem:ee=null,locObj:ce=null}={}){return(ce||Me.create(V,ee,null)).weekdays(M)}static weekdaysFormat(M="long",{locale:V=null,numberingSystem:ee=null,locObj:ce=null}={}){return(ce||Me.create(V,ee,null)).weekdays(M,!0)}static meridiems({locale:M=null}={}){return Me.create(M).meridiems()}static eras(M="short",{locale:V=null}={}){return Me.create(V,null,"gregory").eras(M)}static features(){return{relative:Pe(),localeWeek:ft()}}}function Wr(W,M){const V=ce=>ce.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),ee=V(M)-V(W);return Math.floor(Qt.fromMillis(ee).as("days"))}function Gr(W,M,V){const ee=[["years",(Ke,jt)=>jt.year-Ke.year],["quarters",(Ke,jt)=>jt.quarter-Ke.quarter+(jt.year-Ke.year)*4],["months",(Ke,jt)=>jt.month-Ke.month+(jt.year-Ke.year)*12],["weeks",(Ke,jt)=>{const Mn=Wr(Ke,jt);return(Mn-Mn%7)/7}],["days",Wr]],ce={},Ce=W;let De,Ue;for(const[Ke,jt]of ee)V.indexOf(Ke)>=0&&(De=Ke,ce[Ke]=jt(W,M),Ue=Ce.plus(ce),Ue>M?(ce[Ke]--,W=Ce.plus(ce),W>M&&(Ue=W,ce[Ke]--,W=Ce.plus(ce))):W=Ue);return[W,ce,Ue,De]}function ei(W,M,V,ee){let[ce,Ce,De,Ue]=Gr(W,M,V);const Ke=M-ce,jt=V.filter(Fn=>["hours","minutes","seconds","milliseconds"].indexOf(Fn)>=0);jt.length===0&&(De<M&&(De=ce.plus({[Ue]:1})),De!==ce&&(Ce[Ue]=(Ce[Ue]||0)+Ke/(De-ce)));const Mn=Qt.fromObject(Ce,ee);return jt.length>0?Qt.fromMillis(Ke,ee).shiftTo(...jt).plus(Mn):Mn}const Sa="missing Intl.DateTimeFormat.formatToParts support";function Un(W,M=V=>V){return{regex:W,deser:([V])=>M(Bt(V))}}const zl="[  ]",Ca=new RegExp(zl,"g");function ks(W){return W.replace(/\./g,"\\.?").replace(Ca,zl)}function da(W){return W.replace(/\./g,"").replace(Ca," ").toLowerCase()}function ao(W,M){return W===null?null:{regex:RegExp(W.map(ks).join("|")),deser:([V])=>W.findIndex(ee=>da(V)===da(ee))+M}}function Fl(W,M){return{regex:W,deser:([,V,ee])=>Ol(V,ee),groups:M}}function Eo(W){return{regex:W,deser:([M])=>M}}function Ec(W){return W.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Fh(W,M){const V=Vt(M),ee=Vt(M,"{2}"),ce=Vt(M,"{3}"),Ce=Vt(M,"{4}"),De=Vt(M,"{6}"),Ue=Vt(M,"{1,2}"),Ke=Vt(M,"{1,3}"),jt=Vt(M,"{1,6}"),Mn=Vt(M,"{1,9}"),Fn=Vt(M,"{2,4}"),fr=Vt(M,"{4,6}"),An=Qo=>({regex:RegExp(Ec(Qo.val)),deser:([Aa])=>Aa,literal:!0}),Zr=(Qo=>{if(W.literal)return An(Qo);switch(Qo.val){case"G":return ao(M.eras("short"),0);case"GG":return ao(M.eras("long"),0);case"y":return Un(jt);case"yy":return Un(Fn,Oi);case"yyyy":return Un(Ce);case"yyyyy":return Un(fr);case"yyyyyy":return Un(De);case"M":return Un(Ue);case"MM":return Un(ee);case"MMM":return ao(M.months("short",!0),1);case"MMMM":return ao(M.months("long",!0),1);case"L":return Un(Ue);case"LL":return Un(ee);case"LLL":return ao(M.months("short",!1),1);case"LLLL":return ao(M.months("long",!1),1);case"d":return Un(Ue);case"dd":return Un(ee);case"o":return Un(Ke);case"ooo":return Un(ce);case"HH":return Un(ee);case"H":return Un(Ue);case"hh":return Un(ee);case"h":return Un(Ue);case"mm":return Un(ee);case"m":return Un(Ue);case"q":return Un(Ue);case"qq":return Un(ee);case"s":return Un(Ue);case"ss":return Un(ee);case"S":return Un(Ke);case"SSS":return Un(ce);case"u":return Eo(Mn);case"uu":return Eo(Ue);case"uuu":return Un(V);case"a":return ao(M.meridiems(),0);case"kkkk":return Un(Ce);case"kk":return Un(Fn,Oi);case"W":return Un(Ue);case"WW":return Un(ee);case"E":case"c":return Un(V);case"EEE":return ao(M.weekdays("short",!1),1);case"EEEE":return ao(M.weekdays("long",!1),1);case"ccc":return ao(M.weekdays("short",!0),1);case"cccc":return ao(M.weekdays("long",!0),1);case"Z":case"ZZ":return Fl(new RegExp(`([+-]${Ue.source})(?::(${ee.source}))?`),2);case"ZZZ":return Fl(new RegExp(`([+-]${Ue.source})(${ee.source})?`),2);case"z":return Eo(/[a-z_+-/]{1,256}?/i);case" ":return Eo(/[^\S\n\r]/);default:return An(Qo)}})(W)||{invalidReason:Sa};return Zr.token=W,Zr}const sv={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 _l(W,M,V){const{type:ee,value:ce}=W;if(ee==="literal"){const Ke=/^\s+$/.test(ce);return{literal:!Ke,val:Ke?" ":ce}}const Ce=M[ee];let De=ee;ee==="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=sv[De];if(typeof Ue=="object"&&(Ue=Ue[Ce]),Ue)return{literal:!1,val:Ue}}function lv(W){return[`^${W.map(M=>M.regex).reduce((M,V)=>`${M}(${V.source})`,"")}$`,W]}function cv(W,M,V){const ee=W.match(M);if(ee){const ce={};let Ce=1;for(const De in V)if(Lt(V,De)){const Ue=V[De],Ke=Ue.groups?Ue.groups+1:1;!Ue.literal&&Ue.token&&(ce[Ue.token.val[0]]=Ue.deser(ee.slice(Ce,Ce+Ke))),Ce+=Ke}return[ee,ce]}else return[ee,{}]}function uv(W){const M=ce=>{switch(ce){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,ee;return We(W.z)||(V=Z.create(W.z)),We(W.Z)||(V||(V=new Et(W.Z)),ee=W.Z),We(W.q)||(W.M=(W.q-1)*3+1),We(W.h)||(W.h<12&&W.a===1?W.h+=12:W.h===12&&W.a===0&&(W.h=0)),W.G===0&&W.y&&(W.y=-W.y),We(W.u)||(W.S=Do(W.u)),[Object.keys(W).reduce((ce,Ce)=>{const De=M(Ce);return De&&(ce[De]=W[Ce]),ce},{}),V,ee]}let _h=null;function H1(){return _h||(_h=Tn.fromMillis(1555555555555)),_h}function W1(W,M){if(W.literal)return W;const V=ro.macroTokenToFormatOpts(W.val),ee=Vh(V,M);return ee==null||ee.includes(void 0)?W:ee}function Bh(W,M){return Array.prototype.concat(...W.map(V=>W1(V,M)))}class Uh{constructor(M,V){if(this.locale=M,this.format=V,this.tokens=Bh(ro.parseFormat(V),M),this.units=this.tokens.map(ee=>Fh(ee,M)),this.disqualifyingUnit=this.units.find(ee=>ee.invalidReason),!this.disqualifyingUnit){const[ee,ce]=lv(this.units);this.regex=RegExp(ee,"i"),this.handlers=ce}}explainFromTokens(M){if(this.isValid){const[V,ee]=cv(M,this.regex,this.handlers),[ce,Ce,De]=ee?uv(ee):[null,null,void 0];if(Lt(ee,"a")&&Lt(ee,"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:ee,result:ce,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 bf(W,M,V){return new Uh(W,V).explainFromTokens(M)}function ti(W,M,V){const{result:ee,zone:ce,specificOffset:Ce,invalidReason:De}=bf(W,M,V);return[ee,ce,Ce,De]}function Vh(W,M){if(!W)return null;const V=ro.create(M,W).dtFormatter(H1()),ee=V.formatToParts(),ce=V.resolvedOptions();return ee.map(Ce=>_l(Ce,W,ce))}const fa="Invalid DateTime",ka=864e13;function ji(W){return new Bn("unsupported zone",`the zone "${W.name}" is not supported`)}function Vu(W){return W.weekData===null&&(W.weekData=Tt(W.c)),W.weekData}function Rc(W){return W.localWeekData===null&&(W.localWeekData=Tt(W.c,W.loc.getMinDaysInFirstWeek(),W.loc.getStartOfWeek())),W.localWeekData}function Ai(W,M){const V={ts:W.ts,zone:W.zone,c:W.c,o:W.o,loc:W.loc,invalid:W.invalid};return new Tn({...V,...M,old:V})}function xf(W,M,V){let ee=W-M*60*1e3;const ce=V.offset(ee);if(M===ce)return[ee,M];ee-=(ce-M)*60*1e3;const Ce=V.offset(ee);return ce===Ce?[ee,ce]:[W-Math.min(ce,Ce)*60*1e3,Math.max(ce,Ce)]}function $s(W,M){W+=M*60*1e3;const V=new Date(W);return{year:V.getUTCFullYear(),month:V.getUTCMonth()+1,day:V.getUTCDate(),hour:V.getUTCHours(),minute:V.getUTCMinutes(),second:V.getUTCSeconds(),millisecond:V.getUTCMilliseconds()}}function qu(W,M,V){return xf(Za(W),M,V)}function Hu(W,M){const V=W.o,ee=W.c.year+Math.trunc(M.years),ce=W.c.month+Math.trunc(M.months)+Math.trunc(M.quarters)*3,Ce={...W.c,year:ee,month:ce,day:Math.min(W.c.day,Vr(ee,ce))+Math.trunc(M.days)+Math.trunc(M.weeks)*7},De=Qt.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=Za(Ce);let[Ke,jt]=xf(Ue,V,W.zone);return De!==0&&(Ke+=De,jt=W.zone.offset(Ke)),{ts:Ke,o:jt}}function ni(W,M,V,ee,ce,Ce){const{setZone:De,zone:Ue}=V;if(W&&Object.keys(W).length!==0||M){const Ke=M||Ue,jt=Tn.fromObject(W,{...V,zone:Ke,specificOffset:Ce});return De?jt:jt.setZone(Ue)}else return Tn.invalid(new Bn("unparsable",`the input "${ce}" can't be parsed as ${ee}`))}function wf(W,M,V=!0){return W.isValid?ro.create(Me.create("en-US"),{allowZ:V,forceSimple:!0}).formatDateTimeFromString(W,M):null}function ra(W,M,V){const ee=W.c.year>9999||W.c.year<0;let ce="";if(ee&&W.c.year>=0&&(ce+="+"),ce+=en(W.c.year,ee?6:4),V==="year")return ce;if(M){if(ce+="-",ce+=en(W.c.month),V==="month")return ce;ce+="-"}else if(ce+=en(W.c.month),V==="month")return ce;return ce+=en(W.c.day),ce}function Sf(W,M,V,ee,ce,Ce,De){let Ue=!V||W.c.millisecond!==0||W.c.second!==0,Ke="";switch(De){case"day":case"month":case"year":break;default:if(Ke+=en(W.c.hour),De==="hour")break;if(M){if(Ke+=":",Ke+=en(W.c.minute),De==="minute")break;Ue&&(Ke+=":",Ke+=en(W.c.second))}else{if(Ke+=en(W.c.minute),De==="minute")break;Ue&&(Ke+=en(W.c.second))}if(De==="second")break;Ue&&(!ee||W.c.millisecond!==0)&&(Ke+=".",Ke+=en(W.c.millisecond,3))}return ce&&(W.isOffsetFixed&&W.offset===0&&!Ce?Ke+="Z":W.o<0?(Ke+="-",Ke+=en(Math.trunc(-W.o/60)),Ke+=":",Ke+=en(Math.trunc(-W.o%60))):(Ke+="+",Ke+=en(Math.trunc(W.o/60)),Ke+=":",Ke+=en(Math.trunc(W.o%60)))),Ce&&(Ke+="["+W.zone.ianaName+"]"),Ke}const Di={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},dv={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Cf={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ni=["year","month","day","hour","minute","second","millisecond"],qh=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Hh=["year","ordinal","hour","minute","second","millisecond"];function Es(W){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"}[W.toLowerCase()];if(!M)throw new a(W);return M}function Bl(W){switch(W.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Es(W)}}function kf(W){if(ri===void 0&&(ri=cn.now()),W.type!=="iana")return W.offset(ri);const M=W.name;let V=oi.get(M);return V===void 0&&(V=W.offset(ri),oi.set(M,V)),V}function Wu(W,M){const V=it(M.zone,cn.defaultZone);if(!V.isValid)return Tn.invalid(ji(V));const ee=Me.fromObject(M);let ce,Ce;if(We(W.year))ce=cn.now();else{for(const Ke of Ni)We(W[Ke])&&(W[Ke]=Di[Ke]);const De=Be(W)||gt(W);if(De)return Tn.invalid(De);const Ue=kf(V);[ce,Ce]=qu(W,Ue,V)}return new Tn({ts:ce,zone:V,loc:ee,o:Ce})}function $a(W,M,V){const ee=We(V.round)?!0:V.round,ce=We(V.rounding)?"trunc":V.rounding,Ce=(Ue,Ke)=>(Ue=ys(Ue,ee||V.calendary?0:2,V.calendary?"round":ce),M.loc.clone(V).relFormatter(V).format(Ue,Ke)),De=Ue=>V.calendary?M.hasSame(W,Ue)?0:M.startOf(Ue).diff(W.startOf(Ue),Ue).get(Ue):M.diff(W,Ue).get(Ue);if(V.unit)return Ce(De(V.unit),V.unit);for(const Ue of V.units){const Ke=De(Ue);if(Math.abs(Ke)>=1)return Ce(Ke,Ue)}return Ce(W>M?-0:0,V.units[V.units.length-1])}function Ea(W){let M={},V;return W.length>0&&typeof W[W.length-1]=="object"?(M=W[W.length-1],V=Array.from(W).slice(0,W.length-1)):V=Array.from(W),[M,V]}let ri;const oi=new Map;class Tn{constructor(M){const V=M.zone||cn.defaultZone;let ee=M.invalid||(Number.isNaN(M.ts)?new Bn("invalid input"):null)||(V.isValid?null:ji(V));this.ts=We(M.ts)?cn.now():M.ts;let ce=null,Ce=null;if(!ee)if(M.old&&M.old.ts===this.ts&&M.old.zone.equals(V))[ce,Ce]=[M.old.c,M.old.o];else{const De=Dt(M.o)&&!M.old?M.o:V.offset(this.ts);ce=$s(this.ts,De),ee=Number.isNaN(ce.year)?new Bn("invalid input"):null,ce=ee?null:ce,Ce=ee?null:De}this._zone=V,this.loc=M.loc||Me.create(),this.invalid=ee,this.weekData=null,this.localWeekData=null,this.c=ce,this.o=Ce,this.isLuxonDateTime=!0}static now(){return new Tn({})}static local(){const[M,V]=Ea(arguments),[ee,ce,Ce,De,Ue,Ke,jt]=V;return Wu({year:ee,month:ce,day:Ce,hour:De,minute:Ue,second:Ke,millisecond:jt},M)}static utc(){const[M,V]=Ea(arguments),[ee,ce,Ce,De,Ue,Ke,jt]=V;return M.zone=Et.utcInstance,Wu({year:ee,month:ce,day:Ce,hour:De,minute:Ue,second:Ke,millisecond:jt},M)}static fromJSDate(M,V={}){const ee=we(M)?M.valueOf():NaN;if(Number.isNaN(ee))return Tn.invalid("invalid input");const ce=it(V.zone,cn.defaultZone);return ce.isValid?new Tn({ts:ee,zone:ce,loc:Me.fromObject(V)}):Tn.invalid(ji(ce))}static fromMillis(M,V={}){if(Dt(M))return M<-ka||M>ka?Tn.invalid("Timestamp out of range"):new Tn({ts:M,zone:it(V.zone,cn.defaultZone),loc:Me.fromObject(V)});throw new i(`fromMillis requires a numerical input, but received a ${typeof M} with value ${M}`)}static fromSeconds(M,V={}){if(Dt(M))return new Tn({ts:M*1e3,zone:it(V.zone,cn.defaultZone),loc:Me.fromObject(V)});throw new i("fromSeconds requires a numerical input")}static fromObject(M,V={}){M=M||{};const ee=it(V.zone,cn.defaultZone);if(!ee.isValid)return Tn.invalid(ji(ee));const ce=Me.fromObject(V),Ce=bc(M,Bl),{minDaysInFirstWeek:De,startOfWeek:Ue}=qt(Ce,ce),Ke=cn.now(),jt=We(V.specificOffset)?ee.offset(Ke):V.specificOffset,Mn=!We(Ce.ordinal),Fn=!We(Ce.year),fr=!We(Ce.month)||!We(Ce.day),An=Fn||fr,Zr=Ce.weekYear||Ce.weekNumber;if((An||Mn)&&Zr)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(fr&&Mn)throw new o("Can't mix ordinal dates with month/day");const Qo=Zr||Ce.weekday&&!An;let Aa,Da,Na=$s(Ke,jt);Qo?(Aa=qh,Da=dv,Na=Tt(Na,De,Ue)):Mn?(Aa=Hh,Da=Cf,Na=Xt(Na)):(Aa=Ni,Da=Di);let Ii=!1;for(const Ks of Aa){const pv=Ce[Ks];We(pv)?Ii?Ce[Ks]=Da[Ks]:Ce[Ks]=Na[Ks]:Ii=!0}const Wh=Qo?ge(Ce,De,Ue):Mn?ye(Ce):Be(Ce),$f=Wh||gt(Ce);if($f)return Tn.invalid($f);const Yu=Qo?Nt(Ce,De,Ue):Mn?It(Ce):Ce,[Ef,Ul]=qu(Yu,jt,ee),co=new Tn({ts:Ef,zone:ee,o:Ul,loc:ce});return Ce.weekday&&An&&M.weekday!==co.weekday?Tn.invalid("mismatched weekday",`you can't specify both a weekday of ${Ce.weekday} and a date of ${co.toISO()}`):co.isValid?co:Tn.invalid(co.invalid)}static fromISO(M,V={}){const[ee,ce]=hf(M);return ni(ee,ce,V,"ISO 8601",M)}static fromRFC2822(M,V={}){const[ee,ce]=mf(M);return ni(ee,ce,V,"RFC 2822",M)}static fromHTTP(M,V={}){const[ee,ce]=gf(M);return ni(ee,ce,V,"HTTP",V)}static fromFormat(M,V,ee={}){if(We(M)||We(V))throw new i("fromFormat requires an input string and a format");const{locale:ce=null,numberingSystem:Ce=null}=ee,De=Me.fromOpts({locale:ce,numberingSystem:Ce,defaultToEN:!0}),[Ue,Ke,jt,Mn]=ti(De,M,V);return Mn?Tn.invalid(Mn):ni(Ue,Ke,ee,`format ${V}`,M,jt)}static fromString(M,V,ee={}){return Tn.fromFormat(M,V,ee)}static fromSQL(M,V={}){const[ee,ce]=Ll(M);return ni(ee,ce,V,"SQL",M)}static invalid(M,V=null){if(!M)throw new i("need to specify a reason the DateTime is invalid");const ee=M instanceof Bn?M:new Bn(M,V);if(cn.throwOnInvalid)throw new t(ee);return new Tn({invalid:ee})}static isDateTime(M){return M&&M.isLuxonDateTime||!1}static parseFormatForOpts(M,V={}){const ee=Vh(M,Me.fromObject(V));return ee?ee.map(ce=>ce?ce.val:null).join(""):null}static expandFormat(M,V={}){return Bh(ro.parseFormat(M),Me.fromObject(V)).map(ee=>ee.val).join("")}static resetCache(){ri=void 0,oi.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?Vu(this).weekYear:NaN}get weekNumber(){return this.isValid?Vu(this).weekNumber:NaN}get weekday(){return this.isValid?Vu(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Rc(this).weekday:NaN}get localWeekNumber(){return this.isValid?Rc(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Rc(this).weekYear:NaN}get ordinal(){return this.isValid?Xt(this.c).ordinal:NaN}get monthShort(){return this.isValid?br.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?br.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?br.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?br.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,ee=Za(this.c),ce=this.zone.offset(ee-M),Ce=this.zone.offset(ee+M),De=this.zone.offset(ee-ce*V),Ue=this.zone.offset(ee-Ce*V);if(De===Ue)return[this];const Ke=ee-De*V,jt=ee-Ue*V,Mn=$s(Ke,De),Fn=$s(jt,Ue);return Mn.hour===Fn.hour&&Mn.minute===Fn.minute&&Mn.second===Fn.second&&Mn.millisecond===Fn.millisecond?[Ai(this,{ts:Ke}),Ai(this,{ts:jt})]:[this]}get isInLeapYear(){return ca(this.year)}get daysInMonth(){return Vr(this.year,this.month)}get daysInYear(){return this.isValid?dr(this.year):NaN}get weeksInWeekYear(){return this.isValid?vs(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?vs(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(M={}){const{locale:V,numberingSystem:ee,calendar:ce}=ro.create(this.loc.clone(M),M).resolvedOptions(this);return{locale:V,numberingSystem:ee,outputCalendar:ce}}toUTC(M=0,V={}){return this.setZone(Et.instance(M),V)}toLocal(){return this.setZone(cn.defaultZone)}setZone(M,{keepLocalTime:V=!1,keepCalendarTime:ee=!1}={}){if(M=it(M,cn.defaultZone),M.equals(this.zone))return this;if(M.isValid){let ce=this.ts;if(V||ee){const Ce=M.offset(this.ts),De=this.toObject();[ce]=qu(De,Ce,M)}return Ai(this,{ts:ce,zone:M})}else return Tn.invalid(ji(M))}reconfigure({locale:M,numberingSystem:V,outputCalendar:ee}={}){const ce=this.loc.clone({locale:M,numberingSystem:V,outputCalendar:ee});return Ai(this,{loc:ce})}setLocale(M){return this.reconfigure({locale:M})}set(M){if(!this.isValid)return this;const V=bc(M,Bl),{minDaysInFirstWeek:ee,startOfWeek:ce}=qt(V,this.loc),Ce=!We(V.weekYear)||!We(V.weekNumber)||!We(V.weekday),De=!We(V.ordinal),Ue=!We(V.year),Ke=!We(V.month)||!We(V.day),jt=Ue||Ke,Mn=V.weekYear||V.weekNumber;if((jt||De)&&Mn)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(Ke&&De)throw new o("Can't mix ordinal dates with month/day");let Fn;Ce?Fn=Nt({...Tt(this.c,ee,ce),...V},ee,ce):We(V.ordinal)?(Fn={...this.toObject(),...V},We(V.day)&&(Fn.day=Math.min(Vr(Fn.year,Fn.month),Fn.day))):Fn=It({...Xt(this.c),...V});const[fr,An]=qu(Fn,this.o,this.zone);return Ai(this,{ts:fr,o:An})}plus(M){if(!this.isValid)return this;const V=Qt.fromDurationLike(M);return Ai(this,Hu(this,V))}minus(M){if(!this.isValid)return this;const V=Qt.fromDurationLike(M).negate();return Ai(this,Hu(this,V))}startOf(M,{useLocaleWeeks:V=!1}={}){if(!this.isValid)return this;const ee={},ce=Qt.normalizeUnit(M);switch(ce){case"years":ee.month=1;case"quarters":case"months":ee.day=1;case"weeks":case"days":ee.hour=0;case"hours":ee.minute=0;case"minutes":ee.second=0;case"seconds":ee.millisecond=0;break}if(ce==="weeks")if(V){const Ce=this.loc.getStartOfWeek(),{weekday:De}=this;De<Ce&&(ee.weekNumber=this.weekNumber-1),ee.weekday=Ce}else ee.weekday=1;if(ce==="quarters"){const Ce=Math.ceil(this.month/3);ee.month=(Ce-1)*3+1}return this.set(ee)}endOf(M,V){return this.isValid?this.plus({[M]:1}).startOf(M,V).minus(1):this}toFormat(M,V={}){return this.isValid?ro.create(this.loc.redefaultToEN(V)).formatDateTimeFromString(this,M):fa}toLocaleString(M=m,V={}){return this.isValid?ro.create(this.loc.clone(V),M).formatDateTime(this):fa}toLocaleParts(M={}){return this.isValid?ro.create(this.loc.clone(M),M).formatDateTimeParts(this):[]}toISO({format:M="extended",suppressSeconds:V=!1,suppressMilliseconds:ee=!1,includeOffset:ce=!0,extendedZone:Ce=!1,precision:De="milliseconds"}={}){if(!this.isValid)return null;De=Es(De);const Ue=M==="extended";let Ke=ra(this,Ue,De);return Ni.indexOf(De)>=3&&(Ke+="T"),Ke+=Sf(this,Ue,V,ee,ce,Ce,De),Ke}toISODate({format:M="extended",precision:V="day"}={}){return this.isValid?ra(this,M==="extended",Es(V)):null}toISOWeekDate(){return wf(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:M=!1,suppressSeconds:V=!1,includeOffset:ee=!0,includePrefix:ce=!1,extendedZone:Ce=!1,format:De="extended",precision:Ue="milliseconds"}={}){return this.isValid?(Ue=Es(Ue),(ce&&Ni.indexOf(Ue)>=3?"T":"")+Sf(this,De==="extended",V,M,ee,Ce,Ue)):null}toRFC2822(){return wf(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return wf(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ra(this,!0):null}toSQLTime({includeOffset:M=!0,includeZone:V=!1,includeOffsetSpace:ee=!0}={}){let ce="HH:mm:ss.SSS";return(V||M)&&(ee&&(ce+=" "),V?ce+="z":M&&(ce+="ZZ")),wf(this,ce,!0)}toSQL(M={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(M)}`:null}toString(){return this.isValid?this.toISO():fa}[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",ee={}){if(!this.isValid||!M.isValid)return Qt.invalid("created by diffing an invalid DateTime");const ce={locale:this.locale,numberingSystem:this.numberingSystem,...ee},Ce=Ct(V).map(Qt.normalizeUnit),De=M.valueOf()>this.valueOf(),Ue=De?this:M,Ke=De?M:this,jt=ei(Ue,Ke,Ce,ce);return De?jt.negate():jt}diffNow(M="milliseconds",V={}){return this.diff(Tn.now(),M,V)}until(M){return this.isValid?bn.fromDateTimes(this,M):this}hasSame(M,V,ee){if(!this.isValid)return!1;const ce=M.valueOf(),Ce=this.setZone(M.zone,{keepLocalTime:!0});return Ce.startOf(V,ee)<=ce&&ce<=Ce.endOf(V,ee)}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||Tn.fromObject({},{zone:this.zone}),ee=M.padding?this<V?-M.padding:M.padding:0;let ce=["years","months","days","hours","minutes","seconds"],Ce=M.unit;return Array.isArray(M.unit)&&(ce=M.unit,Ce=void 0),$a(V,this.plus(ee),{...M,numeric:"always",units:ce,unit:Ce})}toRelativeCalendar(M={}){return this.isValid?$a(M.base||Tn.fromObject({},{zone:this.zone}),this,{...M,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...M){if(!M.every(Tn.isDateTime))throw new i("min requires all arguments be DateTimes");return Mt(M,V=>V.valueOf(),Math.min)}static max(...M){if(!M.every(Tn.isDateTime))throw new i("max requires all arguments be DateTimes");return Mt(M,V=>V.valueOf(),Math.max)}static fromFormatExplain(M,V,ee={}){const{locale:ce=null,numberingSystem:Ce=null}=ee,De=Me.fromOpts({locale:ce,numberingSystem:Ce,defaultToEN:!0});return bf(De,M,V)}static fromStringExplain(M,V,ee={}){return Tn.fromFormatExplain(M,V,ee)}static buildFormatParser(M,V={}){const{locale:ee=null,numberingSystem:ce=null}=V,Ce=Me.fromOpts({locale:ee,numberingSystem:ce,defaultToEN:!0});return new Uh(Ce,M)}static fromFormatParser(M,V,ee={}){if(We(M)||We(V))throw new i("fromFormatParser requires an input string and a format parser");const{locale:ce=null,numberingSystem:Ce=null}=ee,De=Me.fromOpts({locale:ce,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:Ke,specificOffset:jt,invalidReason:Mn}=V.explainFromTokens(M);return Mn?Tn.invalid(Mn):ni(Ue,Ke,ee,`format ${V.format}`,M,jt)}static get DATE_SHORT(){return m}static get DATE_MED(){return g}static get DATE_MED_WITH_WEEKDAY(){return y}static get DATE_FULL(){return x}static get DATE_HUGE(){return w}static get TIME_SIMPLE(){return S}static get TIME_WITH_SECONDS(){return b}static get TIME_WITH_SHORT_OFFSET(){return $}static get TIME_WITH_LONG_OFFSET(){return k}static get TIME_24_SIMPLE(){return R}static get TIME_24_WITH_SECONDS(){return O}static get TIME_24_WITH_SHORT_OFFSET(){return P}static get TIME_24_WITH_LONG_OFFSET(){return D}static get DATETIME_SHORT(){return A}static get DATETIME_SHORT_WITH_SECONDS(){return F}static get DATETIME_MED(){return L}static get DATETIME_MED_WITH_SECONDS(){return _}static get DATETIME_MED_WITH_WEEKDAY(){return E}static get DATETIME_FULL(){return z}static get DATETIME_FULL_WITH_SECONDS(){return I}static get DATETIME_HUGE(){return U}static get DATETIME_HUGE_WITH_SECONDS(){return N}}function ai(W){if(Tn.isDateTime(W))return W;if(W&&W.valueOf&&Dt(W.valueOf()))return Tn.fromJSDate(W);if(W&&typeof W=="object")return Tn.fromObject(W);throw new i(`Unknown datetime argument: ${W}, of type ${typeof W}`)}const fv="3.7.2";return Fa.DateTime=Tn,Fa.Duration=Qt,Fa.FixedOffsetZone=Et,Fa.IANAZone=Z,Fa.Info=br,Fa.Interval=bn,Fa.InvalidZone=vt,Fa.Settings=cn,Fa.SystemZone=oe,Fa.VERSION=fv,Fa.Zone=q,Fa}var xI;function o2(){return xI||(xI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CronDate=e.DAYS_IN_MONTH=e.DateMathOp=e.TimeUnit=void 0;const t=Twe();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 l={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,l):typeof i=="number"?this.#e=t.DateTime.fromMillis(i,l):(this.#e=t.DateTime.fromISO(i,l),this.#e.isValid||(this.#e=t.DateTime.fromRFC2822(i,l)),this.#e.isValid||(this.#e=t.DateTime.fromSQL(i,l)),this.#e.isValid||(this.#e=t.DateTime.fromFormat(i,"EEE, d MMM yyyy HH:mm:ss",l))):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 l=o.#o(this.#e.year);return i===e.DAYS_IN_MONTH[s-1]-(l?0:1)}return i===e.DAYS_IN_MONTH[s-1]}isLastWeekdayOfMonth(){const{day:i,month:s}=this.#e;let l;return s===2?l=e.DAYS_IN_MONTH[s-1]-(o.#o(this.#e.year)?0:1):l=e.DAYS_IN_MONTH[s-1],i>l-7}applyDateOperation(i,s,l){if(s===n.Month||s===n.Day){this.invokeDateOperation(i,s);return}const d=this.getHours();this.invokeDateOperation(i,s);const u=this.getHours(),m=u-d;m===2?l!==24&&(this.dstStart=d+1):m===0&&this.getMinutes()===0&&this.getSeconds()===0&&l!==24&&(this.dstEnd=u)}#r(){return this.#e.toUTC()}}e.CronDate=o,e.default=o})(vI)),vI}var wI;function Mwe(){if(wI)return dg;wI=1,Object.defineProperty(dg,"__esModule",{value:!0}),dg.CronMonth=void 0;const e=o2(),t=tf(),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 dg.CronMonth=a,dg}var fg={},SI;function Owe(){if(SI)return fg;SI=1,Object.defineProperty(fg,"__esModule",{value:!0}),fg.CronSecond=void 0;const e=tf(),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 fg.CronSecond=o,fg}var CI;function a2(){return CI||(CI=1,(function(e){var t=fp&&fp.__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=fp&&fp.__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(Cwe(),e),n(kwe(),e),n($we(),e),n(tf(),e),n(Ewe(),e),n(Rwe(),e),n(Mwe(),e),n(Owe(),e)})(fp)),fp}var kI;function s6(){if(kI)return ag;kI=1,Object.defineProperty(ag,"__esModule",{value:!0}),ag.CronFieldCollection=void 0;const e=a2();let t=class Og{#e;#t;#n;#o;#r;#a;static from(r,o){return new Og({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:l}){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(!l)throw new Error("Validation error, Field dayOfWeek is missing");if(s.values.length===1&&!i.hasLastChar&&l.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=l,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,l)=>{if(a===void 0){a={start:i,count:1};return}const d=l[s-1]||a.start,u=l[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 m=i-d,g=u-i;if(m<=g){a={...a,count:2,end:i,step:m};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??d,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=(d,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 l={length:r.end-r.start+1};return Array.from(l,s).filter(d=>d!==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=Og.compactField(a);if(i.length===1){const s=Og.#s(r,i[0],o);if(s)return s}return i.map(s=>{const l=s.count===1?s.start.toString():Og.#i(s,o);return r instanceof e.CronDayOfWeek&&r.nthDay>0?`${l}#${r.nthDay}`:l}).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 ag.CronFieldCollection=t,ag}var $I={},EI;function l6(){return EI||(EI=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=o2();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 l=new t.CronDate(s,this.#t);this.#o&&l.getTime()<this.#o.getTime()?s=this.#o:this.#r&&l.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 l=new t.CronDate(a);return l.setEndOfDay(),this.#s=i,this.#i=s.getUTCOffset()!==l.getUTCOffset(),this.#i}#u(a,i,s){const l=this.#a.second.values,d=a.getSeconds(),u=this.#a.second.findNearestValue(d,s);if(u!==null){a.setSeconds(u);return}a.applyDateOperation(i,t.TimeUnit.Minute,this.#a.hour.values.length),a.setSeconds(this.#l(l,s))}#p(a,i,s){const l=this.#a.minute.values,d=this.#a.second.values,u=a.getMinutes(),m=this.#a.minute.findNearestValue(u,s);if(m!==null){a.setMinutes(m),a.setSeconds(this.#l(d,s));return}a.applyDateOperation(i,t.TimeUnit.Hour,this.#a.hour.values.length),a.setMinutes(this.#l(l,s)),a.setSeconds(this.#l(d,s))}static#f(a,i){const s=i.isLastWeekdayOfMonth();return a.some(l=>{const d=parseInt(l.toString().charAt(0),10)%7;if(Number.isNaN(d))throw new Error(`Invalid last weekday of the month expression: ${l}`);return i.getDay()===d&&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:l,month:d}=this.#a,u=new t.CronDate(a,this.#t);return!(!i.values.includes(u.getSeconds())||!s.values.includes(u.getMinutes())||!l.values.includes(u.getHours())||!d.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,l=this.#a.dayOfWeek.isWildcard,d=!l,u=r.#c(a.getDate(),this.#a.dayOfMonth.values)||this.#a.dayOfMonth.hasLastChar&&a.isLastDayOfMonth(),m=r.#c(a.getDay(),this.#a.dayOfWeek.values)||this.#a.dayOfWeek.hasLastChar&&r.#f(this.#a.dayOfWeek.values,a);return!!(s&&d&&(u||m)||u&&!d||i&&!l&&m)}#g(a,i,s){const l=this.#a.hour.values,d=l,u=a.getHours(),m=r.#c(u,l),g=a.dstEnd===u;if(a.dstStart!==null&&a.dstStart===u-1&&r.#c(a.dstStart,l))return!0;if(g&&!s)return a.dstEnd=null,a.applyDateOperation(t.DateMathOp.Add,t.TimeUnit.Hour,d.length),!1;if(m)return!0;a.dstStart=null;const y=this.#a.hour.findNearestValue(u,s);if(y===null)return a.applyDateOperation(i,t.TimeUnit.Day,d.length),!1;if(this.#d(a)){const x=s?u-y:y-u;for(let w=0;w<x&&(a.applyDateOperation(i,t.TimeUnit.Hour,d.length),!(!s&&a.getHours()>=y||s&&a.getHours()<=y));w++);}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),l=s.getTime();let d=0;for(;++d<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(l===s.getTime()){(i==="Add"||s.getMilliseconds()===0)&&s.applyDateOperation(i,t.TimeUnit.Second,this.#a.hour.values.length);continue}break}}if(d>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})($I)),$I}var Ub={},RI;function Pwe(){if(RI)return Ub;RI=1,Object.defineProperty(Ub,"__esModule",{value:!0}),Ub.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 Ub}var TI;function C$(){if(TI)return di;TI=1,Object.defineProperty(di,"__esModule",{value:!0}),di.CronExpressionParser=di.DayOfWeek=di.Months=di.CronUnit=di.PredefinedExpressions=void 0;const e=s6(),t=l6(),n=Pwe(),r=a2();var o;(function(d){d["@yearly"]="0 0 0 1 1 *",d["@annually"]="0 0 0 1 1 *",d["@monthly"]="0 0 0 1 * *",d["@weekly"]="0 0 0 * * 0",d["@daily"]="0 0 0 * * *",d["@hourly"]="0 0 * * * *",d["@minutely"]="0 * * * * *",d["@secondly"]="* * * * * *",d["@weekdays"]="0 0 0 * * 1-5",d["@weekends"]="0 0 0 * * 0,6"})(o||(di.PredefinedExpressions=o={}));var a;(function(d){d.Second="Second",d.Minute="Minute",d.Hour="Hour",d.DayOfMonth="DayOfMonth",d.Month="Month",d.DayOfWeek="DayOfWeek"})(a||(di.CronUnit=a={}));var i;(function(d){d[d.jan=1]="jan",d[d.feb=2]="feb",d[d.mar=3]="mar",d[d.apr=4]="apr",d[d.may=5]="may",d[d.jun=6]="jun",d[d.jul=7]="jul",d[d.aug=8]="aug",d[d.sep=9]="sep",d[d.oct=10]="oct",d[d.nov=11]="nov",d[d.dec=12]="dec"})(i||(di.Months=i={}));var s;(function(d){d[d.sun=0]="sun",d[d.mon=1]="mon",d[d.tue=2]="tue",d[d.wed=3]="wed",d[d.thu=4]="thu",d[d.fri=5]="fri",d[d.sat=6]="sat"})(s||(di.DayOfWeek=s={}));let l=class fi{static parse(u,m={}){const{strict:g=!1,hashSeed:y}=m,x=(0,n.seededRandom)(y);u=o[u]||u;const w=fi.#e(u,g);if(!(w.dayOfMonth==="*"||w.dayOfWeek==="*"||!g))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");const S=fi.#t(a.Second,w.second,r.CronSecond.constraints,x),b=fi.#t(a.Minute,w.minute,r.CronMinute.constraints,x),$=fi.#t(a.Hour,w.hour,r.CronHour.constraints,x),k=fi.#t(a.Month,w.month,r.CronMonth.constraints,x),R=fi.#t(a.DayOfMonth,w.dayOfMonth,r.CronDayOfMonth.constraints,x),{dayOfWeek:O,nthDayOfWeek:P}=fi.#d(w.dayOfWeek),D=fi.#t(a.DayOfWeek,O,r.CronDayOfWeek.constraints,x),A=new e.CronFieldCollection({second:new r.CronSecond(S,{rawValue:w.second}),minute:new r.CronMinute(b,{rawValue:w.minute}),hour:new r.CronHour($,{rawValue:w.hour}),dayOfMonth:new r.CronDayOfMonth(R,{rawValue:w.dayOfMonth}),month:new r.CronMonth(k,{rawValue:w.month}),dayOfWeek:new r.CronDayOfWeek(D,{rawValue:w.dayOfWeek,nthDayOfWeek:P})});return new t.CronExpression(A,{...m,expression:u})}static#e(u,m){if(m&&!u.length)throw new Error("Invalid cron expression");u=u||"0 * * * * *";const g=u.trim().split(/\s+/);if(m&&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[x,w,S,b,$,k]=g;return{second:x,minute:w,hour:S,dayOfMonth:b,month:$,dayOfWeek:k}}static#t(u,m,g,y){if((u===a.Month||u===a.DayOfWeek)&&(m=m.replace(/[a-z]{3}/gi,x=>{x=x.toLowerCase();const w=i[x]||s[x];if(w===void 0)throw new Error(`Validation error, cannot resolve alias "${x}"`);return w.toString()})),!g.validChars.test(m))throw new Error(`Invalid characters, got value: ${m}`);return m=this.#n(m,g),m=this.#o(m,g,y),this.#r(u,m,g)}static#n(u,m){return u.replace(/[*?]/g,m.min+"-"+m.max)}static#o(u,m,g){const y=g();return u.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(x,w,S,b)=>{if(w&&S&&b){const $=parseInt(w,10),k=parseInt(S,10),R=parseInt(b,10);if($>k)throw new Error(`Invalid range: ${$}-${k}, min > max`);if(R<=0)throw new Error(`Invalid step: ${R}, must be positive`);const O=Math.max($,m.min),P=Math.floor(y*R),D=[];for(let A=Math.floor(O/R)*R+P;A<=k;A+=R)A>=O&&D.push(A);return D.join(",")}else if(w&&S){const $=parseInt(w,10),k=parseInt(S,10);if($>k)throw new Error(`Invalid range: ${$}-${k}, min > max`);return String(Math.floor(y*(k-$+1))+$)}else if(b){const $=parseInt(b,10);if($<=0)throw new Error(`Invalid step: ${$}, must be positive`);const k=Math.floor(y*$),R=[];for(let O=Math.floor(m.min/$)*$+k;O<=m.max;O+=$)O>=m.min&&R.push(O);return R.join(",")}else return String(Math.floor(y*(m.max-m.min+1)+m.min))})}static#r(u,m,g){const y=[];function x(w,S){if(Array.isArray(w))y.push(...w);else if(fi.#u(S,w))y.push(w);else{const b=parseInt(w.toString(),10);if(!(b>=S.min&&b<=S.max))throw new Error(`Constraint error, got value ${w} expected range ${S.min}-${S.max}`);y.push(u===a.DayOfWeek?b%7:w)}}return m.split(",").forEach(w=>{if(!(w.length>0))throw new Error("Invalid list value format");x(fi.#a(u,w,g),g)}),y}static#a(u,m,g){const y=m.split("/");if(y.length>2)throw new Error(`Invalid repeat: ${m}`);return y.length===2?(y[0].includes("-")||(y[0]=`${y[0]}-${g.max}`),fi.#l(u,y[0],parseInt(y[1],10),g)):fi.#l(u,m,1,g)}static#s(u,m,g){if(!(!isNaN(u)&&!isNaN(m)&&u>=g.min&&m<=g.max))throw new Error(`Constraint error, got range ${u}-${m} expected range ${g.min}-${g.max}`);if(u>m)throw new Error(`Invalid range: ${u}-${m}, min(${u}) > max(${m})`)}static#i(u){if(!(!isNaN(u)&&u>0))throw new Error(`Constraint error, cannot repeat at every ${u} time.`)}static#c(u,m,g,y){const x=[];u===a.DayOfWeek&&g%7===0&&x.push(0);for(let w=m;w<=g;w+=y)x.indexOf(w)===-1&&x.push(w);return x}static#l(u,m,g,y){const x=m.split("-");if(x.length<=1)return isNaN(+m)?m:+m;const[w,S]=x.map(b=>parseInt(b,10));return this.#s(w,S,y),this.#i(g),this.#c(u,w,S,g)}static#d(u){const m=u.split("#");if(m.length<=1)return{dayOfWeek:m[0]};const g=+m[m.length-1],y=u.match(/([,-/])/);if(y!==null)throw new Error(`Constraint error, invalid dayOfWeek \`#\` and \`${y?.[0]}\` special characters are incompatible`);if(!(m.length<=2&&!isNaN(g)&&g>=1&&g<=5))throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return{dayOfWeek:m[0],nthDayOfWeek:g}}static#u(u,m){return u.chars.some(g=>m.toString().includes(g))}};return di.CronExpressionParser=l,di}var js={};const jwe={},Awe=Object.freeze(Object.defineProperty({__proto__:null,default:jwe},Symbol.toStringTag,{value:"Module"})),MI=wae(Awe);var OI;function Dwe(){if(OI)return js;OI=1;var e=js&&js.__createBinding||(Object.create?(function(a,i,s,l){l===void 0&&(l=s);var d=Object.getOwnPropertyDescriptor(i,s);(!d||("get"in d?!i.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(a,l,d)}):(function(a,i,s,l){l===void 0&&(l=s),a[l]=i[s]})),t=js&&js.__setModuleDefault||(Object.create?(function(a,i){Object.defineProperty(a,"default",{enumerable:!0,value:i})}):function(a,i){a.default=i}),n=js&&js.__importStar||(function(){var a=function(i){return a=Object.getOwnPropertyNames||function(s){var l=[];for(var d in s)Object.prototype.hasOwnProperty.call(s,d)&&(l[l.length]=d);return l},a(i)};return function(i){if(i&&i.__esModule)return i;var s={};if(i!=null)for(var l=a(i),d=0;d<l.length;d++)l[d]!=="default"&&e(s,i,l[d]);return t(s,i),s}})();Object.defineProperty(js,"__esModule",{value:!0}),js.CronFileParser=void 0;const r=C$();let o=class y0{static async parseFile(i){const{readFile:s}=await Promise.resolve().then(()=>n(MI)),l=await s(i,"utf8");return y0.#e(l)}static parseFileSync(i){const{readFileSync:s}=MI,l=s(i,"utf8");return y0.#e(l)}static#e(i){const s=i.split(`
480
+ `)};function uI(){const[e,t]=C.useState(!1),{apiClients:n}=er(),r=()=>{t(!0)},o=()=>{t(!1)},a=Ch({mutationFn(s){return n.environments.createEnvironment({name:s.name,readme:a6({name:s.name,readme:""},s.description)})},success:"Environment created",invalidates:[["environments"]],closeDialog:o,resource:"environment",action:"create"}),i=async s=>{s.preventDefault();const l=new FormData(s.currentTarget),d=l.get("name")?.toString(),u=l.get("description")?.toString();if(!d)throw new Error("Name is required");a.mutate({name:d,description:u})};return p.jsxs(Cn.Fragment,{children:[p.jsx(Qy,{label:"Environment",onClick:r}),p.jsx(Oo,{open:e,onClose:o,title:"New environment",description:"An environment holds packages and the connections they query through.",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{disabled:a.isPending,onClick:o,children:"Cancel"}),p.jsx(So,{type:"submit",form:"environment-form",variant:"contained",loading:a.isPending,children:"Create environment"})]}),children:p.jsx("form",{onSubmit:i,id:"environment-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),p.jsx(yr,{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 vwe({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=er(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=Ch({mutationFn:()=>o.environments.deleteEnvironment(e.name),success:"Environment deleted",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"delete"});return p.jsxs(Cn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(Jx,{fontSize:"small"})}),p.jsx(xi,{children:"Delete"})]}),p.jsx(Oo,{open:n,onClose:i,title:"Delete environment",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{onClick:i,children:"Cancel"}),p.jsx(So,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>s.mutate(),loading:s.isPending,children:"Delete environment"})]}),children:p.jsxs(Ar,{variant:"body2",children:["Delete ",p.jsx("strong",{children:e.name}),"? Its packages stop being served and this cannot be undone."]})}),s.notice]})}function bwe({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=er(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=Ch({mutationFn(d){return o.environments.updateEnvironment(e.name,{name:e.name,readme:a6({name:e.name,readme:e.readme},d.description)})},success:"Environment updated",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"update"}),l=d=>{d.preventDefault();const u=new FormData(d.currentTarget).get("description")?.toString();s.mutate({description:u})};return p.jsxs(Cn.Fragment,{children:[p.jsxs(ea,{onClick:a,children:[p.jsx(ml,{children:p.jsx(eR,{fontSize:"small"})}),p.jsx(xi,{children:"Edit"})]}),p.jsx(Oo,{open:n,onClose:i,title:"Edit environment",description:"What this environment is, for the people who open it.",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{disabled:s.isPending,onClick:i,children:"Cancel"}),p.jsx(So,{type:"submit",form:"environment-form",variant:"contained",loading:s.isPending,children:"Save changes"})]}),children:p.jsx("form",{onSubmit:l,id:"environment-form",children:p.jsxs(z1,{sx:{gap:2},children:[p.jsx(yr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",disabled:!0,type:"text",fullWidth:!0,size:"small",defaultValue:e.name,InputLabelProps:{shrink:!0}}),p.jsx(yr,{id:"description",name:"description",label:"Description",type:"text",fullWidth:!0,size:"small",defaultValue:o6(e.readme),InputLabelProps:{shrink:!0}})]})})}),s.notice]})}const xwe=[{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:tu.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:tu.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:tu.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:tu.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:tu.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:tu.connections}];function wwe({href:e,children:t}){return p.jsx(Ee,{component:"a",href:e,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary",textDecoration:"underline"},children:t})}function P2e({onClickEnvironment:e}){const{apiClients:t,mutable:n}=er(),{data:r,isSuccess:o,isError:a,error:i}=wo({queryKey:["environments"],queryFn:()=>t.environments.listEnvironments()});if(a)return p.jsx(Xa,{error:i,context:"Environments List"});if(!o)return p.jsx(Go,{text:"Loading environments..."});const s=r.data??[];return p.jsxs(O0,{maxWidth:"md",sx:{py:6},children:[p.jsxs(Ee,{sx:{mb:5},children:[p.jsx(wt,{variant:"h3",component:"h1",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Publisher"}),p.jsx(wt,{variant:"body1",color:"text.secondary",sx:{mb:3},children:"The analytics engine for Malloy."}),p.jsx(wt,{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."})]}),p.jsx(Sp,{container:!0,spacing:4,sx:{mb:5},children:xwe.map(l=>p.jsx(Sp,{size:{xs:12,sm:6},children:p.jsxs(Wn,{spacing:1,children:[p.jsx(wt,{variant:"body2",component:"a",href:l.href,target:"_blank",rel:"noopener noreferrer",sx:{fontWeight:500,color:"text.primary",textDecoration:"none","&:hover":{textDecoration:"underline"}},children:l.title}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{lineHeight:1.6},children:l.body})]})},l.title))}),p.jsx(wl,{sx:{my:4}}),s.length>0?p.jsx(Ds,{title:"Environments",count:s.length,description:"Published environments available on this server",...n?{action:p.jsx(uI,{})}:{},children:p.jsx(Wn,{children:s.map(l=>p.jsx(Swe,{environment:l,...e?{onClickEnvironment:e}:{}},l.name))})}):p.jsxs(Ee,{sx:{mb:4},children:[p.jsx(wt,{variant:"h5",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Get started"}),p.jsx(wt,{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?p.jsx(uI,{}):p.jsx(Hn,{variant:"contained",color:"primary",href:tu.publishing,target:"_blank",rel:"noopener noreferrer",children:"Learn how to create models"})]}),p.jsx(wl,{sx:{my:4}}),p.jsxs(wt,{variant:"body2",color:"text.secondary",sx:{maxWidth:720,lineHeight:1.6,mt:2},children:["Join the"," ",p.jsx(wwe,{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 Swe({environment:e,onClickEnvironment:t}){const{mutable:n}=er(),[r,o]=C.useState(null),a=!!r,i=o6(e.readme),s=d=>{d.stopPropagation(),o(d.currentTarget)},l=()=>o(null);return p.jsx(L1,{icon:p.jsx(ywe,{sx:{fontSize:18}}),tint:QE.environment,label:e.name??"",ariaLabel:e.name??"",...i?{description:i}:{},...e.name&&t?{onClick:d=>t(`/${e.name}/`,d)}:{},...n?{trailingAction:p.jsxs(p.Fragment,{children:[p.jsx(no,{size:"small",onClick:s,"aria-label":`Environment actions for ${e.name}`,children:p.jsx(e1,{fontSize:"small"})}),p.jsxs(dc,{anchorEl:r,open:a,onClose:l,onClick:d=>d.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[p.jsx(bwe,{environment:e,onCloseDialog:l}),p.jsx(vwe,{environment:e,onCloseDialog:l})]})]})}:{}})}var dp={},di={},ag={},fp={},dI={},fI;function Cwe(){return fI||(fI=1,Object.defineProperty(dI,"__esModule",{value:!0})),dI}var ig={},sg={},pI;function tf(){if(pI)return sg;pI=1,Object.defineProperty(sg,"__esModule",{value:!0}),sg.CronField=void 0;let e=class i6{#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(i6.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=>l=>new RegExp(`^\\d{0,2}${l}$`).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,l)=>this.#o.indexOf(s)!==l);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 sg.CronField=e,sg}var hI;function kwe(){if(hI)return ig;hI=1,Object.defineProperty(ig,"__esModule",{value:!0}),ig.CronDayOfMonth=void 0;const e=tf(),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 ig.CronDayOfMonth=o,ig}var lg={},mI;function $we(){if(mI)return lg;mI=1,Object.defineProperty(lg,"__esModule",{value:!0}),lg.CronDayOfWeek=void 0;const e=tf(),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 lg.CronDayOfWeek=o,lg}var cg={},gI;function Ewe(){if(gI)return cg;gI=1,Object.defineProperty(cg,"__esModule",{value:!0}),cg.CronHour=void 0;const e=tf(),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 cg.CronHour=o,cg}var ug={},yI;function Rwe(){if(yI)return ug;yI=1,Object.defineProperty(ug,"__esModule",{value:!0}),ug.CronMinute=void 0;const e=tf(),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 ug.CronMinute=o,ug}var dg={},vI={},Fa={},bI;function Twe(){if(bI)return Fa;bI=1,Object.defineProperty(Fa,"__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 l="numeric",d="short",u="long",m={year:l,month:l,day:l},g={year:l,month:d,day:l},y={year:l,month:d,day:l,weekday:d},x={year:l,month:u,day:l},w={year:l,month:u,day:l,weekday:u},S={hour:l,minute:l},b={hour:l,minute:l,second:l},$={hour:l,minute:l,second:l,timeZoneName:d},k={hour:l,minute:l,second:l,timeZoneName:u},R={hour:l,minute:l,hourCycle:"h23"},O={hour:l,minute:l,second:l,hourCycle:"h23"},P={hour:l,minute:l,second:l,hourCycle:"h23",timeZoneName:d},D={hour:l,minute:l,second:l,hourCycle:"h23",timeZoneName:u},A={year:l,month:l,day:l,hour:l,minute:l},F={year:l,month:l,day:l,hour:l,minute:l,second:l},L={year:l,month:d,day:l,hour:l,minute:l},_={year:l,month:d,day:l,hour:l,minute:l,second:l},E={year:l,month:d,day:l,weekday:d,hour:l,minute:l},z={year:l,month:u,day:l,hour:l,minute:l,timeZoneName:d},I={year:l,month:u,day:l,hour:l,minute:l,second:l,timeZoneName:d},U={year:l,month:u,day:l,weekday:u,hour:l,minute:l,timeZoneName:u},N={year:l,month:u,day:l,weekday:u,hour:l,minute:l,second:l,timeZoneName:u};class q{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 Y=null;class oe extends q{static get instance(){return Y===null&&(Y=new oe),Y}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(M,{format:V,locale:ee}){return Mu(M,V,ee)}formatOffset(M,V){return Us(this.offset(M),V)}offset(M){return-new Date(M).getTimezoneOffset()}equals(M){return M.type==="system"}get isValid(){return!0}}const Q=new Map;function ae(W){let M=Q.get(W);return M===void 0&&(M=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:W,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Q.set(W,M)),M}const de={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function X(W,M){const V=W.format(M).replace(/\u200E/g,""),ee=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(V),[,ce,Ce,De,Ue,Ke,jt,Mn]=ee;return[De,ce,Ce,Ue,Ke,jt,Mn]}function se(W,M){const V=W.formatToParts(M),ee=[];for(let ce=0;ce<V.length;ce++){const{type:Ce,value:De}=V[ce],Ue=de[Ce];Ce==="era"?ee[Ue]=De:We(Ue)||(ee[Ue]=parseInt(De,10))}return ee}const J=new Map;class Z extends q{static create(M){let V=J.get(M);return V===void 0&&J.set(M,V=new Z(M)),V}static resetCache(){J.clear(),Q.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=Z.isValidZone(M)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(M,{format:V,locale:ee}){return Mu(M,V,ee,this.name)}formatOffset(M,V){return Us(this.offset(M),V)}offset(M){if(!this.valid)return NaN;const V=new Date(M);if(isNaN(V))return NaN;const ee=ae(this.name);let[ce,Ce,De,Ue,Ke,jt,Mn]=ee.formatToParts?se(ee,V):X(ee,V);Ue==="BC"&&(ce=-Math.abs(ce)+1);const Fn=Za({year:ce,month:Ce,day:De,hour:Ke===24?0:Ke,minute:jt,second:Mn,millisecond:0});let fr=+V;const An=fr%1e3;return fr-=An>=0?An:1e3+An,(Fn-fr)/(60*1e3)}equals(M){return M.type==="iana"&&M.name===this.name}get isValid(){return this.valid}}let G={};function ue(W,M={}){const V=JSON.stringify([W,M]);let ee=G[V];return ee||(ee=new Intl.ListFormat(W,M),G[V]=ee),ee}const ie=new Map;function fe(W,M={}){const V=JSON.stringify([W,M]);let ee=ie.get(V);return ee===void 0&&(ee=new Intl.DateTimeFormat(W,M),ie.set(V,ee)),ee}const he=new Map;function me(W,M={}){const V=JSON.stringify([W,M]);let ee=he.get(V);return ee===void 0&&(ee=new Intl.NumberFormat(W,M),he.set(V,ee)),ee}const le=new Map;function ve(W,M={}){const{base:V,...ee}=M,ce=JSON.stringify([W,ee]);let Ce=le.get(ce);return Ce===void 0&&(Ce=new Intl.RelativeTimeFormat(W,M),le.set(ce,Ce)),Ce}let Le=null;function Ie(){return Le||(Le=new Intl.DateTimeFormat().resolvedOptions().locale,Le)}const Re=new Map;function ne(W){let M=Re.get(W);return M===void 0&&(M=new Intl.DateTimeFormat(W).resolvedOptions(),Re.set(W,M)),M}const qe=new Map;function Oe(W){let M=qe.get(W);if(!M){const V=new Intl.Locale(W);M="getWeekInfo"in V?V.getWeekInfo():V.weekInfo,"minimalDays"in M||(M={...He,...M}),qe.set(W,M)}return M}function Qe(W){const M=W.indexOf("-x-");M!==-1&&(W=W.substring(0,M));const V=W.indexOf("-u-");if(V===-1)return[W];{let ee,ce;try{ee=fe(W).resolvedOptions(),ce=W}catch{const Ue=W.substring(0,V);ee=fe(Ue).resolvedOptions(),ce=Ue}const{numberingSystem:Ce,calendar:De}=ee;return[ce,Ce,De]}}function nt(W,M,V){return(V||M)&&(W.includes("-u-")||(W+="-u"),V&&(W+=`-ca-${V}`),M&&(W+=`-nu-${M}`)),W}function kt(W){const M=[];for(let V=1;V<=12;V++){const ee=Tn.utc(2009,V,1);M.push(W(ee))}return M}function Ut(W){const M=[];for(let V=1;V<=7;V++){const ee=Tn.utc(2016,11,13+V);M.push(W(ee))}return M}function at(W,M,V,ee){const ce=W.listingMode();return ce==="error"?null:ce==="en"?V(M):ee(M)}function et(W){return W.numberingSystem&&W.numberingSystem!=="latn"?!1:W.numberingSystem==="latn"||!W.locale||W.locale.startsWith("en")||ne(W.locale).numberingSystem==="latn"}class pt{constructor(M,V,ee){this.padTo=ee.padTo||0,this.floor=ee.floor||!1;const{padTo:ce,floor:Ce,...De}=ee;if(!V||Object.keys(De).length>0){const Ue={useGrouping:!1,...ee};ee.padTo>0&&(Ue.minimumIntegerDigits=ee.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):ys(M,3);return en(V,this.padTo)}}}class ze{constructor(M,V,ee){this.opts=ee,this.originalZone=void 0;let ce;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&&Z.create(Ue).valid?(ce=Ue,this.dt=M):(ce="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,ce=M.zone.name):(ce="UTC",this.dt=M.setZone("UTC").plus({minutes:M.offset}),this.originalZone=M.zone);const Ce={...this.opts};Ce.timeZone=Ce.timeZone||ce,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 ee=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...V,value:ee}}else return V}):M}resolvedOptions(){return this.dtf.resolvedOptions()}}class be{constructor(M,V,ee){this.opts={style:"long",...ee},!V&&Pe()&&(this.rtf=ve(M,ee))}format(M,V){return this.rtf?this.rtf.format(M,V):Sc(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 Me{static fromOpts(M){return Me.create(M.locale,M.numberingSystem,M.outputCalendar,M.weekSettings,M.defaultToEN)}static create(M,V,ee,ce,Ce=!1){const De=M||cn.defaultLocale,Ue=De||(Ce?"en-US":Ie()),Ke=V||cn.defaultNumberingSystem,jt=ee||cn.defaultOutputCalendar,Mn=nn(ce)||cn.defaultWeekSettings;return new Me(Ue,Ke,jt,Mn,De)}static resetCache(){Le=null,ie.clear(),he.clear(),le.clear(),Re.clear(),qe.clear()}static fromObject({locale:M,numberingSystem:V,outputCalendar:ee,weekSettings:ce}={}){return Me.create(M,V,ee,ce)}constructor(M,V,ee,ce,Ce){const[De,Ue,Ke]=Qe(M);this.locale=De,this.numberingSystem=V||Ue||null,this.outputCalendar=ee||Ke||null,this.weekSettings=ce,this.intl=nt(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=et(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:Me.create(M.locale||this.specifiedLocale,M.numberingSystem||this.numberingSystem,M.outputCalendar||this.outputCalendar,nn(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 at(this,M,jl,()=>{const ee=this.intl==="ja"||this.intl.startsWith("ja-");V&=!ee;const ce=V?{month:M,day:"numeric"}:{month:M},Ce=V?"format":"standalone";if(!this.monthsCache[Ce][M]){const De=ee?Ue=>this.dtFormatter(Ue,ce).format():Ue=>this.extract(Ue,ce,"month");this.monthsCache[Ce][M]=kt(De)}return this.monthsCache[Ce][M]})}weekdays(M,V=!1){return at(this,M,xs,()=>{const ee=V?{weekday:M,year:"numeric",month:"long",day:"numeric"}:{weekday:M},ce=V?"format":"standalone";return this.weekdaysCache[ce][M]||(this.weekdaysCache[ce][M]=Ut(Ce=>this.extract(Ce,ee,"weekday"))),this.weekdaysCache[ce][M]})}meridiems(){return at(this,void 0,()=>Pu,()=>{if(!this.meridiemCache){const M={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Tn.utc(2016,11,13,9),Tn.utc(2016,11,13,19)].map(V=>this.extract(V,M,"dayperiod"))}return this.meridiemCache})}eras(M){return at(this,M,ja,()=>{const V={era:M};return this.eraCache[M]||(this.eraCache[M]=[Tn.utc(-40,1,1),Tn.utc(2017,1,1)].map(ee=>this.extract(ee,V,"era"))),this.eraCache[M]})}extract(M,V,ee){const ce=this.dtFormatter(M,V),Ce=ce.formatToParts(),De=Ce.find(Ue=>Ue.type.toLowerCase()===ee);return De?De.value:null}numberFormatter(M={}){return new pt(this.intl,M.forceSimple||this.fastNumbers,M)}dtFormatter(M,V={}){return new ze(M,this.intl,V)}relFormatter(M={}){return new be(this.intl,this.isEnglish(),M)}listFormatter(M={}){return ue(this.intl,M)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||ne(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:ft()?Oe(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 $t=null;class Et extends q{static get utcInstance(){return $t===null&&($t=new Et(0)),$t}static instance(M){return M===0?Et.utcInstance:new Et(M)}static parseSpecifier(M){if(M){const V=M.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(V)return new Et(Ol(V[1],V[2]))}return null}constructor(M){super(),this.fixed=M}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Us(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Us(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(M,V){return Us(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 vt extends q{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 it(W,M){if(We(W)||W===null)return M;if(W instanceof q)return W;if(sn(W)){const V=W.toLowerCase();return V==="default"?M:V==="local"||V==="system"?oe.instance:V==="utc"||V==="gmt"?Et.utcInstance:Et.parseSpecifier(V)||Z.create(W)}else return Dt(W)?Et.instance(W):typeof W=="object"&&"offset"in W&&typeof W.offset=="function"?W:new vt(W)}const st={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},At={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]},tn=st.hanidec.replace(/[\[|\]]/g,"").split("");function Bt(W){let M=parseInt(W,10);if(isNaN(M)){M="";for(let V=0;V<W.length;V++){const ee=W.charCodeAt(V);if(W[V].search(st.hanidec)!==-1)M+=tn.indexOf(W[V]);else for(const ce in At){const[Ce,De]=At[ce];ee>=Ce&&ee<=De&&(M+=ee-Ce)}}return parseInt(M,10)}else return M}const an=new Map;function $n(){an.clear()}function Vt({numberingSystem:W},M=""){const V=W||"latn";let ee=an.get(V);ee===void 0&&(ee=new Map,an.set(V,ee));let ce=ee.get(M);return ce===void 0&&(ce=new RegExp(`${st[V]}${M}`),ee.set(M,ce)),ce}let Pn=()=>Date.now(),Se="system",jn=null,En=null,Jt=null,Pt=60,Ur,Vn=null;class cn{static get now(){return Pn}static set now(M){Pn=M}static set defaultZone(M){Se=M}static get defaultZone(){return it(Se,oe.instance)}static get defaultLocale(){return jn}static set defaultLocale(M){jn=M}static get defaultNumberingSystem(){return En}static set defaultNumberingSystem(M){En=M}static get defaultOutputCalendar(){return Jt}static set defaultOutputCalendar(M){Jt=M}static get defaultWeekSettings(){return Vn}static set defaultWeekSettings(M){Vn=nn(M)}static get twoDigitCutoffYear(){return Pt}static set twoDigitCutoffYear(M){Pt=M%100}static get throwOnInvalid(){return Ur}static set throwOnInvalid(M){Ur=M}static resetCaches(){Me.resetCache(),Z.resetCache(),Tn.resetCache(),$n()}}class Bn{constructor(M,V){this.reason=M,this.explanation=V}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const xe=[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 _e(W,M){return new Bn("unit out of range",`you specified ${M} (of type ${typeof M}) as a ${W}, which is invalid`)}function Ye(W,M,V){const ee=new Date(Date.UTC(W,M-1,V));W<100&&W>=0&&ee.setUTCFullYear(ee.getUTCFullYear()-1900);const ce=ee.getUTCDay();return ce===0?7:ce}function ut(W,M,V){return V+(ca(W)?Te:xe)[M-1]}function Rt(W,M){const V=ca(W)?Te:xe,ee=V.findIndex(Ce=>Ce<M),ce=M-V[ee];return{month:ee+1,day:ce}}function St(W,M){return(W-M+7)%7+1}function Tt(W,M=4,V=1){const{year:ee,month:ce,day:Ce}=W,De=ut(ee,ce,Ce),Ue=St(Ye(ee,ce,Ce),V);let Ke=Math.floor((De-Ue+14-M)/7),jt;return Ke<1?(jt=ee-1,Ke=vs(jt,M,V)):Ke>vs(ee,M,V)?(jt=ee+1,Ke=1):jt=ee,{weekYear:jt,weekNumber:Ke,weekday:Ue,...Pl(W)}}function Nt(W,M=4,V=1){const{weekYear:ee,weekNumber:ce,weekday:Ce}=W,De=St(Ye(ee,1,M),V),Ue=dr(ee);let Ke=ce*7+Ce-De-7+M,jt;Ke<1?(jt=ee-1,Ke+=dr(jt)):Ke>Ue?(jt=ee+1,Ke-=dr(ee)):jt=ee;const{month:Mn,day:Fn}=Rt(jt,Ke);return{year:jt,month:Mn,day:Fn,...Pl(W)}}function Xt(W){const{year:M,month:V,day:ee}=W,ce=ut(M,V,ee);return{year:M,ordinal:ce,...Pl(W)}}function It(W){const{year:M,ordinal:V}=W,{month:ee,day:ce}=Rt(M,V);return{year:M,month:ee,day:ce,...Pl(W)}}function qt(W,M){if(!We(W.localWeekday)||!We(W.localWeekNumber)||!We(W.localWeekYear)){if(!We(W.weekday)||!We(W.weekNumber)||!We(W.weekYear))throw new o("Cannot mix locale-based week fields with ISO-based week fields");return We(W.localWeekday)||(W.weekday=W.localWeekday),We(W.localWeekNumber)||(W.weekNumber=W.localWeekNumber),We(W.localWeekYear)||(W.weekYear=W.localWeekYear),delete W.localWeekday,delete W.localWeekNumber,delete W.localWeekYear,{minDaysInFirstWeek:M.getMinDaysInFirstWeek(),startOfWeek:M.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function ge(W,M=4,V=1){const ee=Kt(W.weekYear),ce=On(W.weekNumber,1,vs(W.weekYear,M,V)),Ce=On(W.weekday,1,7);return ee?ce?Ce?!1:_e("weekday",W.weekday):_e("week",W.weekNumber):_e("weekYear",W.weekYear)}function ye(W){const M=Kt(W.year),V=On(W.ordinal,1,dr(W.year));return M?V?!1:_e("ordinal",W.ordinal):_e("year",W.year)}function Be(W){const M=Kt(W.year),V=On(W.month,1,12),ee=On(W.day,1,Vr(W.year,W.month));return M?V?ee?!1:_e("day",W.day):_e("month",W.month):_e("year",W.year)}function gt(W){const{hour:M,minute:V,second:ee,millisecond:ce}=W,Ce=On(M,0,23)||M===24&&V===0&&ee===0&&ce===0,De=On(V,0,59),Ue=On(ee,0,59),Ke=On(ce,0,999);return Ce?De?Ue?Ke?!1:_e("millisecond",ce):_e("second",ee):_e("minute",V):_e("hour",M)}function We(W){return typeof W>"u"}function Dt(W){return typeof W=="number"}function Kt(W){return typeof W=="number"&&W%1===0}function sn(W){return typeof W=="string"}function we(W){return Object.prototype.toString.call(W)==="[object Date]"}function Pe(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function ft(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Ct(W){return Array.isArray(W)?W:[W]}function Mt(W,M,V){if(W.length!==0)return W.reduce((ee,ce)=>{const Ce=[M(ce),ce];return ee&&V(ee[0],Ce[0])===ee[0]?ee:Ce},null)[1]}function Ot(W,M){return M.reduce((V,ee)=>(V[ee]=W[ee],V),{})}function Lt(W,M){return Object.prototype.hasOwnProperty.call(W,M)}function nn(W){if(W==null)return null;if(typeof W!="object")throw new i("Week settings must be an object");if(!On(W.firstDay,1,7)||!On(W.minimalDays,1,7)||!Array.isArray(W.weekend)||W.weekend.some(M=>!On(M,1,7)))throw new i("Invalid week settings");return{firstDay:W.firstDay,minimalDays:W.minimalDays,weekend:Array.from(W.weekend)}}function On(W,M,V){return Kt(W)&&W>=M&&W<=V}function or(W,M){return W-M*Math.floor(W/M)}function en(W,M=2){const V=W<0;let ee;return V?ee="-"+(""+-W).padStart(M,"0"):ee=(""+W).padStart(M,"0"),ee}function Dr(W){if(!(We(W)||W===null||W===""))return parseInt(W,10)}function lo(W){if(!(We(W)||W===null||W===""))return parseFloat(W)}function Do(W){if(!(We(W)||W===null||W==="")){const M=parseFloat("0."+W)*1e3;return Math.floor(M)}}function ys(W,M,V="round"){const ee=10**M;switch(V){case"expand":return W>0?Math.ceil(W*ee)/ee:Math.floor(W*ee)/ee;case"trunc":return Math.trunc(W*ee)/ee;case"round":return Math.round(W*ee)/ee;case"floor":return Math.floor(W*ee)/ee;case"ceil":return Math.ceil(W*ee)/ee;default:throw new RangeError(`Value rounding ${V} is out of range`)}}function ca(W){return W%4===0&&(W%100!==0||W%400===0)}function dr(W){return ca(W)?366:365}function Vr(W,M){const V=or(M-1,12)+1,ee=W+(M-V)/12;return V===2?ca(ee)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][V-1]}function Za(W){let M=Date.UTC(W.year,W.month-1,W.day,W.hour,W.minute,W.second,W.millisecond);return W.year<100&&W.year>=0&&(M=new Date(M),M.setUTCFullYear(W.year,W.month-1,W.day)),+M}function Ml(W,M,V){return-St(Ye(W,1,M),V)+M-1}function vs(W,M=4,V=1){const ee=Ml(W,M,V),ce=Ml(W+1,M,V);return(dr(W)-ee+ce)/7}function Oi(W){return W>99?W:W>cn.twoDigitCutoffYear?1900+W:2e3+W}function Mu(W,M,V,ee=null){const ce=new Date(W),Ce={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};ee&&(Ce.timeZone=ee);const De={timeZoneName:M,...Ce},Ue=new Intl.DateTimeFormat(V,De).formatToParts(ce).find(Ke=>Ke.type.toLowerCase()==="timezonename");return Ue?Ue.value:null}function Ol(W,M){let V=parseInt(W,10);Number.isNaN(V)&&(V=0);const ee=parseInt(M,10)||0,ce=V<0||Object.is(V,-0)?-ee:ee;return V*60+ce}function bs(W){const M=Number(W);if(typeof W=="boolean"||W===""||!Number.isFinite(M))throw new i(`Invalid unit value ${W}`);return M}function bc(W,M){const V={};for(const ee in W)if(Lt(W,ee)){const ce=W[ee];if(ce==null)continue;V[M(ee)]=bs(ce)}return V}function Us(W,M){const V=Math.trunc(Math.abs(W/60)),ee=Math.trunc(Math.abs(W%60)),ce=W>=0?"+":"-";switch(M){case"short":return`${ce}${en(V,2)}:${en(ee,2)}`;case"narrow":return`${ce}${V}${ee>0?`:${ee}`:""}`;case"techie":return`${ce}${en(V,2)}${en(ee,2)}`;default:throw new RangeError(`Value format ${M} is out of range for property format`)}}function Pl(W){return Ot(W,["hour","minute","second","millisecond"])}const Ou=["January","February","March","April","May","June","July","August","September","October","November","December"],rf=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],$h=["J","F","M","A","M","J","J","A","S","O","N","D"];function jl(W){switch(W){case"narrow":return[...$h];case"short":return[...rf];case"long":return[...Ou];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 xc=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],wc=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Vs=["M","T","W","T","F","S","S"];function xs(W){switch(W){case"narrow":return[...Vs];case"short":return[...wc];case"long":return[...xc];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Pu=["AM","PM"],ju=["Before Christ","Anno Domini"],of=["BC","AD"],Al=["B","A"];function ja(W){switch(W){case"narrow":return[...Al];case"short":return[...of];case"long":return[...ju];default:return null}}function Au(W){return Pu[W.hour<12?0:1]}function Dl(W,M){return xs(M)[W.weekday-1]}function Pi(W,M){return jl(M)[W.month-1]}function Du(W,M){return ja(M)[W.year<0?0:1]}function Sc(W,M,V="always",ee=!1){const ce={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(W)===-1;if(V==="auto"&&Ce){const Fn=W==="days";switch(M){case 1:return Fn?"tomorrow":`next ${ce[W][0]}`;case-1:return Fn?"yesterday":`last ${ce[W][0]}`;case 0:return Fn?"today":`this ${ce[W][0]}`}}const De=Object.is(M,-0)||M<0,Ue=Math.abs(M),Ke=Ue===1,jt=ce[W],Mn=ee?Ke?jt[1]:jt[2]||jt[1]:Ke?ce[W][0]:W;return De?`${Ue} ${Mn} ago`:`in ${Ue} ${Mn}`}function Nu(W,M){let V="";for(const ee of W)ee.literal?V+=ee.val:V+=M(ee.val);return V}const Cc={D:m,DD:g,DDD:x,DDDD:w,t:S,tt:b,ttt:$,tttt:k,T:R,TT:O,TTT:P,TTTT:D,f:A,ff:L,fff:z,ffff:U,F,FF:_,FFF:I,FFFF:N};class ro{static create(M,V={}){return new ro(M,V)}static parseFormat(M){let V=null,ee="",ce=!1;const Ce=[];for(let De=0;De<M.length;De++){const Ue=M.charAt(De);Ue==="'"?((ee.length>0||ce)&&Ce.push({literal:ce||/^\s+$/.test(ee),val:ee===""?"'":ee}),V=null,ee="",ce=!ce):ce||Ue===V?ee+=Ue:(ee.length>0&&Ce.push({literal:/^\s+$/.test(ee),val:ee}),ee=Ue,V=Ue)}return ee.length>0&&Ce.push({literal:ce||/^\s+$/.test(ee),val:ee}),Ce}static macroTokenToFormatOpts(M){return Cc[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,ee=void 0){if(this.opts.forceSimple)return en(M,V);const ce={...this.opts};return V>0&&(ce.padTo=V),ee&&(ce.signDisplay=ee),this.loc.numberFormatter(ce).format(M)}formatDateTimeFromString(M,V){const ee=this.loc.listingMode()==="en",ce=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",Ce=(An,Zr)=>this.loc.extract(M,An,Zr),De=An=>M.isOffsetFixed&&M.offset===0&&An.allowZ?"Z":M.isValid?M.zone.formatOffset(M.ts,An.format):"",Ue=()=>ee?Au(M):Ce({hour:"numeric",hourCycle:"h12"},"dayperiod"),Ke=(An,Zr)=>ee?Pi(M,An):Ce(Zr?{month:An}:{month:An,day:"numeric"},"month"),jt=(An,Zr)=>ee?Dl(M,An):Ce(Zr?{weekday:An}:{weekday:An,month:"long",day:"numeric"},"weekday"),Mn=An=>{const Zr=ro.macroTokenToFormatOpts(An);return Zr?this.formatWithSystemDefault(M,Zr):An},Fn=An=>ee?Du(M,An):Ce({era:An},"era"),fr=An=>{switch(An){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 ce?Ce({day:"numeric"},"day"):this.num(M.day);case"dd":return ce?Ce({day:"2-digit"},"day"):this.num(M.day,2);case"c":return this.num(M.weekday);case"ccc":return jt("short",!0);case"cccc":return jt("long",!0);case"ccccc":return jt("narrow",!0);case"E":return this.num(M.weekday);case"EEE":return jt("short",!1);case"EEEE":return jt("long",!1);case"EEEEE":return jt("narrow",!1);case"L":return ce?Ce({month:"numeric",day:"numeric"},"month"):this.num(M.month);case"LL":return ce?Ce({month:"2-digit",day:"numeric"},"month"):this.num(M.month,2);case"LLL":return Ke("short",!0);case"LLLL":return Ke("long",!0);case"LLLLL":return Ke("narrow",!0);case"M":return ce?Ce({month:"numeric"},"month"):this.num(M.month);case"MM":return ce?Ce({month:"2-digit"},"month"):this.num(M.month,2);case"MMM":return Ke("short",!1);case"MMMM":return Ke("long",!1);case"MMMMM":return Ke("narrow",!1);case"y":return ce?Ce({year:"numeric"},"year"):this.num(M.year);case"yy":return ce?Ce({year:"2-digit"},"year"):this.num(M.year.toString().slice(-2),2);case"yyyy":return ce?Ce({year:"numeric"},"year"):this.num(M.year,4);case"yyyyyy":return ce?Ce({year:"numeric"},"year"):this.num(M.year,6);case"G":return Fn("short");case"GG":return Fn("long");case"GGGGG":return Fn("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 Mn(An)}};return Nu(ro.parseFormat(V),fr)}formatDurationFromString(M,V){const ee=this.opts.signMode==="negativeLargestOnly"?-1:1,ce=Mn=>{switch(Mn[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=(Mn,Fn)=>fr=>{const An=ce(fr);if(An){const Zr=Fn.isNegativeDuration&&An!==Fn.largestUnit?ee:1;let Qo;return this.opts.signMode==="negativeLargestOnly"&&An!==Fn.largestUnit?Qo="never":this.opts.signMode==="all"?Qo="always":Qo="auto",this.num(Mn.get(An)*Zr,fr.length,Qo)}else return fr},De=ro.parseFormat(V),Ue=De.reduce((Mn,{literal:Fn,val:fr})=>Fn?Mn:Mn.concat(fr),[]),Ke=M.shiftTo(...Ue.map(ce).filter(Mn=>Mn)),jt={isNegativeDuration:Ke<0,largestUnit:Object.keys(Ke.values)[0]};return Nu(De,Ce(Ke,jt))}}const Iu=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function B(...W){const M=W.reduce((V,ee)=>V+ee.source,"");return RegExp(`^${M}$`)}function $o(...W){return M=>W.reduce(([V,ee,ce],Ce)=>{const[De,Ue,Ke]=Ce(M,ce);return[{...V,...De},Ue||ee,Ke]},[{},null,1]).slice(0,2)}function oo(W,...M){if(W==null)return[null,null];for(const[V,ee]of M){const ce=V.exec(W);if(ce)return ee(ce)}return[null,null]}function Ja(...W){return(M,V)=>{const ee={};let ce;for(ce=0;ce<W.length;ce++)ee[W[ce]]=Dr(M[V+ce]);return[ee,null,V+ce]}}const je=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,ws=`(?:${je.source}?(?:\\[(${Iu.source})\\])?)?`,zn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Ko=RegExp(`${zn.source}${ws}`),qs=RegExp(`(?:[Tt]${Ko.source})?`),Lu=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,af=/(\d{4})-?W(\d\d)(?:-?(\d))?/,sf=/(\d{4})-?(\d{3})/,rt=Ja("weekYear","weekNumber","weekDay"),zu=Ja("year","ordinal"),Fu=/(\d{4})-(\d\d)-(\d\d)/,kc=RegExp(`${zn.source} ?(?:${je.source}|(${Iu.source}))?`),lf=RegExp(`(?: ${kc.source})?`);function Hs(W,M,V){const ee=W[M];return We(ee)?V:Dr(ee)}function Nl(W,M){return[{year:Hs(W,M),month:Hs(W,M+1,1),day:Hs(W,M+2,1)},null,M+3]}function Ss(W,M){return[{hours:Hs(W,M,0),minutes:Hs(W,M+1,0),seconds:Hs(W,M+2,0),milliseconds:Do(W[M+3])},null,M+4]}function Ws(W,M){const V=!W[M]&&!W[M+1],ee=Ol(W[M+1],W[M+2]),ce=V?null:Et.instance(ee);return[{},ce,M+3]}function ua(W,M){const V=W[M]?Z.create(W[M]):null;return[{},V,M+1]}const Eh=RegExp(`^T?${zn.source}$`),Rh=/^-?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 Il(W){const[M,V,ee,ce,Ce,De,Ue,Ke,jt]=W,Mn=M[0]==="-",Fn=Ke&&Ke[0]==="-",fr=(An,Zr=!1)=>An!==void 0&&(Zr||An&&Mn)?-An:An;return[{years:fr(lo(V)),months:fr(lo(ee)),weeks:fr(lo(ce)),days:fr(lo(Ce)),hours:fr(lo(De)),minutes:fr(lo(Ue)),seconds:fr(lo(Ke),Ke==="-0"),milliseconds:fr(Do(jt),Fn)}]}const cf={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function _u(W,M,V,ee,ce,Ce,De){const Ue={year:M.length===2?Oi(Dr(M)):Dr(M),month:rf.indexOf(V)+1,day:Dr(ee),hour:Dr(ce),minute:Dr(Ce)};return De&&(Ue.second=Dr(De)),W&&(Ue.weekday=W.length>3?xc.indexOf(W)+1:wc.indexOf(W)+1),Ue}const Th=/^(?:(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 uf(W){const[,M,V,ee,ce,Ce,De,Ue,Ke,jt,Mn,Fn]=W,fr=_u(M,ce,ee,V,Ce,De,Ue);let An;return Ke?An=cf[Ke]:jt?An=0:An=Ol(Mn,Fn),[fr,new Et(An)]}function Mh(W){return W.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const df=/^(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$/,Bu=/^(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$/,Oh=/^(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 $c(W){const[,M,V,ee,ce,Ce,De,Ue]=W;return[_u(M,ce,ee,V,Ce,De,Ue),Et.utcInstance]}function Ph(W){const[,M,V,ee,ce,Ce,De,Ue]=W;return[_u(M,Ue,V,ee,ce,Ce,De),Et.utcInstance]}const jh=B(Lu,qs),Ah=B(af,qs),Dh=B(sf,qs),Uu=B(Ko),Ys=$o(Nl,Ss,Ws,ua),Nh=$o(rt,Ss,Ws,ua),ff=$o(zu,Ss,Ws,ua),pf=$o(Ss,Ws,ua);function hf(W){return oo(W,[jh,Ys],[Ah,Nh],[Dh,ff],[Uu,pf])}function mf(W){return oo(Mh(W),[Th,uf])}function gf(W){return oo(W,[df,$c],[Bu,$c],[Oh,Ph])}function Gs(W){return oo(W,[Rh,Il])}const Ih=$o(Ss);function Lh(W){return oo(W,[Eh,Ih])}const zh=B(Fu,lf),yf=B(kc),vf=$o(Ss,Ws,ua);function Ll(W){return oo(W,[zh,Ys],[yf,vf])}const ar="Invalid Duration",Cs={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}},Xr={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},...Cs},H=146097/400,te=146097/4800,K={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:te/7,days:te,hours:te*24,minutes:te*24*60,seconds:te*24*60*60,milliseconds:te*24*60*60*1e3},...Cs},$e=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Zt=$e.slice(0).reverse();function Gt(W,M,V=!1){const ee={values:V?M.values:{...W.values,...M.values||{}},loc:W.loc.clone(M.loc),conversionAccuracy:M.conversionAccuracy||W.conversionAccuracy,matrix:M.matrix||W.matrix};return new Qt(ee)}function Dn(W,M){var V;let ee=(V=M.milliseconds)!=null?V:0;for(const ce of Zt.slice(1))M[ce]&&(ee+=M[ce]*W[ce].milliseconds);return ee}function Gn(W,M){const V=Dn(W,M)<0?-1:1;$e.reduceRight((ee,ce)=>{if(We(M[ce]))return ee;if(ee){const Ce=M[ee]*V,De=W[ce][ee],Ue=Math.floor(Ce/De);M[ce]+=Ue*V,M[ee]-=Ue*De*V}return ce},null),$e.reduce((ee,ce)=>{if(We(M[ce]))return ee;if(ee){const Ce=M[ee]%1;M[ee]-=Ce,M[ce]+=Ce*W[ee][ce]}return ce},null)}function Kn(W){const M={};for(const[V,ee]of Object.entries(W))ee!==0&&(M[V]=ee);return M}class Qt{constructor(M){const V=M.conversionAccuracy==="longterm"||!1;let ee=V?K:Xr;M.matrix&&(ee=M.matrix),this.values=M.values,this.loc=M.loc||Me.create(),this.conversionAccuracy=V?"longterm":"casual",this.invalid=M.invalid||null,this.matrix=ee,this.isLuxonDuration=!0}static fromMillis(M,V){return Qt.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 Qt({values:bc(M,Qt.normalizeUnit),loc:Me.fromObject(V),conversionAccuracy:V.conversionAccuracy,matrix:V.matrix})}static fromDurationLike(M){if(Dt(M))return Qt.fromMillis(M);if(Qt.isDuration(M))return M;if(typeof M=="object")return Qt.fromObject(M);throw new i(`Unknown duration argument ${M} of type ${typeof M}`)}static fromISO(M,V){const[ee]=Gs(M);return ee?Qt.fromObject(ee,V):Qt.invalid("unparsable",`the input "${M}" can't be parsed as ISO 8601`)}static fromISOTime(M,V){const[ee]=Lh(M);return ee?Qt.fromObject(ee,V):Qt.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 ee=M instanceof Bn?M:new Bn(M,V);if(cn.throwOnInvalid)throw new r(ee);return new Qt({invalid:ee})}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 ee={...V,floor:V.round!==!1&&V.floor!==!1};return this.isValid?ro.create(this.loc,ee).formatDurationFromString(this,M):ar}toHuman(M={}){if(!this.isValid)return ar;const V=M.showZeros!==!1,ee=$e.map(ce=>{const Ce=this.values[ce];return We(Ce)||Ce===0&&!V?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...M,unit:ce.slice(0,-1)}).format(Ce)}).filter(ce=>ce);return this.loc.listFormatter({type:"conjunction",style:M.listStyle||"narrow",...M}).format(ee)}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+=ys(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},Tn.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?Dn(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(M){if(!this.isValid)return this;const V=Qt.fromDurationLike(M),ee={};for(const ce of $e)(Lt(V.values,ce)||Lt(this.values,ce))&&(ee[ce]=V.get(ce)+this.get(ce));return Gt(this,{values:ee},!0)}minus(M){if(!this.isValid)return this;const V=Qt.fromDurationLike(M);return this.plus(V.negate())}mapUnits(M){if(!this.isValid)return this;const V={};for(const ee of Object.keys(this.values))V[ee]=bs(M(this.values[ee],ee));return Gt(this,{values:V},!0)}get(M){return this[Qt.normalizeUnit(M)]}set(M){if(!this.isValid)return this;const V={...this.values,...bc(M,Qt.normalizeUnit)};return Gt(this,{values:V})}reconfigure({locale:M,numberingSystem:V,conversionAccuracy:ee,matrix:ce}={}){const Ce={loc:this.loc.clone({locale:M,numberingSystem:V}),matrix:ce,conversionAccuracy:ee};return Gt(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),Gt(this,{values:M},!0)}rescale(){if(!this.isValid)return this;const M=Kn(this.normalize().shiftToAll().toObject());return Gt(this,{values:M},!0)}shiftTo(...M){if(!this.isValid)return this;if(M.length===0)return this;M=M.map(De=>Qt.normalizeUnit(De));const V={},ee={},ce=this.toObject();let Ce;for(const De of $e)if(M.indexOf(De)>=0){Ce=De;let Ue=0;for(const jt in ee)Ue+=this.matrix[jt][De]*ee[jt],ee[jt]=0;Dt(ce[De])&&(Ue+=ce[De]);const Ke=Math.trunc(Ue);V[De]=Ke,ee[De]=(Ue*1e3-Ke*1e3)/1e3}else Dt(ce[De])&&(ee[De]=ce[De]);for(const De in ee)ee[De]!==0&&(V[Ce]+=De===Ce?ee[De]:ee[De]/this.matrix[Ce][De]);return Gn(this.matrix,V),Gt(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 Gt(this,{values:M},!0)}removeZeros(){if(!this.isValid)return this;const M=Kn(this.values);return Gt(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(ee,ce){return ee===void 0||ee===0?ce===void 0||ce===0:ee===ce}for(const ee of $e)if(!V(this.values[ee],M.values[ee]))return!1;return!0}}const kr="Invalid Interval";function $r(W,M){return!W||!W.isValid?bn.invalid("missing or invalid start"):!M||!M.isValid?bn.invalid("missing or invalid end"):M<W?bn.invalid("end before start",`The end of an interval must be after its start, but you had start=${W.toISO()} and end=${M.toISO()}`):null}class bn{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 ee=M instanceof Bn?M:new Bn(M,V);if(cn.throwOnInvalid)throw new n(ee);return new bn({invalid:ee})}static fromDateTimes(M,V){const ee=ai(M),ce=ai(V);return $r(ee,ce)??new bn({start:ee,end:ce})}static after(M,V){const ee=Qt.fromDurationLike(V),ce=ai(M);return bn.fromDateTimes(ce,ce.plus(ee))}static before(M,V){const ee=Qt.fromDurationLike(V),ce=ai(M);return bn.fromDateTimes(ce.minus(ee),ce)}static fromISO(M,V){const[ee,ce]=(M||"").split("/",2);if(ee&&ce){let Ce,De;try{Ce=Tn.fromISO(ee,V),De=Ce.isValid}catch{De=!1}let Ue,Ke;try{Ue=Tn.fromISO(ce,V),Ke=Ue.isValid}catch{Ke=!1}if(De&&Ke)return bn.fromDateTimes(Ce,Ue);if(De){const jt=Qt.fromISO(ce,V);if(jt.isValid)return bn.after(Ce,jt)}else if(Ke){const jt=Qt.fromISO(ee,V);if(jt.isValid)return bn.before(Ue,jt)}}return bn.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 ee=this.start.startOf(M,V);let ce;return V!=null&&V.useLocaleWeeks?ce=this.end.reconfigure({locale:ee.locale}):ce=this.end,ce=ce.startOf(M,V),Math.floor(ce.diff(ee,M).get(M))+(ce.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?bn.fromDateTimes(M||this.s,V||this.e):this}splitAt(...M){if(!this.isValid)return[];const V=M.map(ai).filter(De=>this.contains(De)).sort((De,Ue)=>De.toMillis()-Ue.toMillis()),ee=[];let{s:ce}=this,Ce=0;for(;ce<this.e;){const De=V[Ce]||this.e,Ue=+De>+this.e?this.e:De;ee.push(bn.fromDateTimes(ce,Ue)),ce=Ue,Ce+=1}return ee}splitBy(M){const V=Qt.fromDurationLike(M);if(!this.isValid||!V.isValid||V.as("milliseconds")===0)return[];let{s:ee}=this,ce=1,Ce;const De=[];for(;ee<this.e;){const Ue=this.start.plus(V.mapUnits(Ke=>Ke*ce));Ce=+Ue>+this.e?this.e:Ue,De.push(bn.fromDateTimes(ee,Ce)),ee=Ce,ce+=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,ee=this.e<M.e?this.e:M.e;return V>=ee?null:bn.fromDateTimes(V,ee)}union(M){if(!this.isValid)return this;const V=this.s<M.s?this.s:M.s,ee=this.e>M.e?this.e:M.e;return bn.fromDateTimes(V,ee)}static merge(M){const[V,ee]=M.sort((ce,Ce)=>ce.s-Ce.s).reduce(([ce,Ce],De)=>Ce?Ce.overlaps(De)||Ce.abutsStart(De)?[ce,Ce.union(De)]:[ce.concat([Ce]),De]:[ce,De],[[],null]);return ee&&V.push(ee),V}static xor(M){let V=null,ee=0;const ce=[],Ce=M.map(Ke=>[{time:Ke.s,type:"s"},{time:Ke.e,type:"e"}]),De=Array.prototype.concat(...Ce),Ue=De.sort((Ke,jt)=>Ke.time-jt.time);for(const Ke of Ue)ee+=Ke.type==="s"?1:-1,ee===1?V=Ke.time:(V&&+V!=+Ke.time&&ce.push(bn.fromDateTimes(V,Ke.time)),V=null);return bn.merge(ce)}difference(...M){return bn.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=m,V={}){return this.isValid?ro.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):Qt.invalid(this.invalidReason)}mapEndpoints(M){return bn.fromDateTimes(M(this.s),M(this.e))}}class br{static hasDST(M=cn.defaultZone){const V=Tn.now().setZone(M).set({month:12});return!M.isUniversal&&V.offset!==V.set({month:6}).offset}static isValidIANAZone(M){return Z.isValidZone(M)}static normalizeZone(M){return it(M,cn.defaultZone)}static getStartOfWeek({locale:M=null,locObj:V=null}={}){return(V||Me.create(M)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:M=null,locObj:V=null}={}){return(V||Me.create(M)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:M=null,locObj:V=null}={}){return(V||Me.create(M)).getWeekendDays().slice()}static months(M="long",{locale:V=null,numberingSystem:ee=null,locObj:ce=null,outputCalendar:Ce="gregory"}={}){return(ce||Me.create(V,ee,Ce)).months(M)}static monthsFormat(M="long",{locale:V=null,numberingSystem:ee=null,locObj:ce=null,outputCalendar:Ce="gregory"}={}){return(ce||Me.create(V,ee,Ce)).months(M,!0)}static weekdays(M="long",{locale:V=null,numberingSystem:ee=null,locObj:ce=null}={}){return(ce||Me.create(V,ee,null)).weekdays(M)}static weekdaysFormat(M="long",{locale:V=null,numberingSystem:ee=null,locObj:ce=null}={}){return(ce||Me.create(V,ee,null)).weekdays(M,!0)}static meridiems({locale:M=null}={}){return Me.create(M).meridiems()}static eras(M="short",{locale:V=null}={}){return Me.create(V,null,"gregory").eras(M)}static features(){return{relative:Pe(),localeWeek:ft()}}}function Wr(W,M){const V=ce=>ce.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),ee=V(M)-V(W);return Math.floor(Qt.fromMillis(ee).as("days"))}function Gr(W,M,V){const ee=[["years",(Ke,jt)=>jt.year-Ke.year],["quarters",(Ke,jt)=>jt.quarter-Ke.quarter+(jt.year-Ke.year)*4],["months",(Ke,jt)=>jt.month-Ke.month+(jt.year-Ke.year)*12],["weeks",(Ke,jt)=>{const Mn=Wr(Ke,jt);return(Mn-Mn%7)/7}],["days",Wr]],ce={},Ce=W;let De,Ue;for(const[Ke,jt]of ee)V.indexOf(Ke)>=0&&(De=Ke,ce[Ke]=jt(W,M),Ue=Ce.plus(ce),Ue>M?(ce[Ke]--,W=Ce.plus(ce),W>M&&(Ue=W,ce[Ke]--,W=Ce.plus(ce))):W=Ue);return[W,ce,Ue,De]}function ei(W,M,V,ee){let[ce,Ce,De,Ue]=Gr(W,M,V);const Ke=M-ce,jt=V.filter(Fn=>["hours","minutes","seconds","milliseconds"].indexOf(Fn)>=0);jt.length===0&&(De<M&&(De=ce.plus({[Ue]:1})),De!==ce&&(Ce[Ue]=(Ce[Ue]||0)+Ke/(De-ce)));const Mn=Qt.fromObject(Ce,ee);return jt.length>0?Qt.fromMillis(Ke,ee).shiftTo(...jt).plus(Mn):Mn}const Sa="missing Intl.DateTimeFormat.formatToParts support";function Un(W,M=V=>V){return{regex:W,deser:([V])=>M(Bt(V))}}const zl="[  ]",Ca=new RegExp(zl,"g");function ks(W){return W.replace(/\./g,"\\.?").replace(Ca,zl)}function da(W){return W.replace(/\./g,"").replace(Ca," ").toLowerCase()}function ao(W,M){return W===null?null:{regex:RegExp(W.map(ks).join("|")),deser:([V])=>W.findIndex(ee=>da(V)===da(ee))+M}}function Fl(W,M){return{regex:W,deser:([,V,ee])=>Ol(V,ee),groups:M}}function Eo(W){return{regex:W,deser:([M])=>M}}function Ec(W){return W.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Fh(W,M){const V=Vt(M),ee=Vt(M,"{2}"),ce=Vt(M,"{3}"),Ce=Vt(M,"{4}"),De=Vt(M,"{6}"),Ue=Vt(M,"{1,2}"),Ke=Vt(M,"{1,3}"),jt=Vt(M,"{1,6}"),Mn=Vt(M,"{1,9}"),Fn=Vt(M,"{2,4}"),fr=Vt(M,"{4,6}"),An=Qo=>({regex:RegExp(Ec(Qo.val)),deser:([Aa])=>Aa,literal:!0}),Zr=(Qo=>{if(W.literal)return An(Qo);switch(Qo.val){case"G":return ao(M.eras("short"),0);case"GG":return ao(M.eras("long"),0);case"y":return Un(jt);case"yy":return Un(Fn,Oi);case"yyyy":return Un(Ce);case"yyyyy":return Un(fr);case"yyyyyy":return Un(De);case"M":return Un(Ue);case"MM":return Un(ee);case"MMM":return ao(M.months("short",!0),1);case"MMMM":return ao(M.months("long",!0),1);case"L":return Un(Ue);case"LL":return Un(ee);case"LLL":return ao(M.months("short",!1),1);case"LLLL":return ao(M.months("long",!1),1);case"d":return Un(Ue);case"dd":return Un(ee);case"o":return Un(Ke);case"ooo":return Un(ce);case"HH":return Un(ee);case"H":return Un(Ue);case"hh":return Un(ee);case"h":return Un(Ue);case"mm":return Un(ee);case"m":return Un(Ue);case"q":return Un(Ue);case"qq":return Un(ee);case"s":return Un(Ue);case"ss":return Un(ee);case"S":return Un(Ke);case"SSS":return Un(ce);case"u":return Eo(Mn);case"uu":return Eo(Ue);case"uuu":return Un(V);case"a":return ao(M.meridiems(),0);case"kkkk":return Un(Ce);case"kk":return Un(Fn,Oi);case"W":return Un(Ue);case"WW":return Un(ee);case"E":case"c":return Un(V);case"EEE":return ao(M.weekdays("short",!1),1);case"EEEE":return ao(M.weekdays("long",!1),1);case"ccc":return ao(M.weekdays("short",!0),1);case"cccc":return ao(M.weekdays("long",!0),1);case"Z":case"ZZ":return Fl(new RegExp(`([+-]${Ue.source})(?::(${ee.source}))?`),2);case"ZZZ":return Fl(new RegExp(`([+-]${Ue.source})(${ee.source})?`),2);case"z":return Eo(/[a-z_+-/]{1,256}?/i);case" ":return Eo(/[^\S\n\r]/);default:return An(Qo)}})(W)||{invalidReason:Sa};return Zr.token=W,Zr}const sv={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 _l(W,M,V){const{type:ee,value:ce}=W;if(ee==="literal"){const Ke=/^\s+$/.test(ce);return{literal:!Ke,val:Ke?" ":ce}}const Ce=M[ee];let De=ee;ee==="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=sv[De];if(typeof Ue=="object"&&(Ue=Ue[Ce]),Ue)return{literal:!1,val:Ue}}function lv(W){return[`^${W.map(M=>M.regex).reduce((M,V)=>`${M}(${V.source})`,"")}$`,W]}function cv(W,M,V){const ee=W.match(M);if(ee){const ce={};let Ce=1;for(const De in V)if(Lt(V,De)){const Ue=V[De],Ke=Ue.groups?Ue.groups+1:1;!Ue.literal&&Ue.token&&(ce[Ue.token.val[0]]=Ue.deser(ee.slice(Ce,Ce+Ke))),Ce+=Ke}return[ee,ce]}else return[ee,{}]}function uv(W){const M=ce=>{switch(ce){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,ee;return We(W.z)||(V=Z.create(W.z)),We(W.Z)||(V||(V=new Et(W.Z)),ee=W.Z),We(W.q)||(W.M=(W.q-1)*3+1),We(W.h)||(W.h<12&&W.a===1?W.h+=12:W.h===12&&W.a===0&&(W.h=0)),W.G===0&&W.y&&(W.y=-W.y),We(W.u)||(W.S=Do(W.u)),[Object.keys(W).reduce((ce,Ce)=>{const De=M(Ce);return De&&(ce[De]=W[Ce]),ce},{}),V,ee]}let _h=null;function H1(){return _h||(_h=Tn.fromMillis(1555555555555)),_h}function W1(W,M){if(W.literal)return W;const V=ro.macroTokenToFormatOpts(W.val),ee=Vh(V,M);return ee==null||ee.includes(void 0)?W:ee}function Bh(W,M){return Array.prototype.concat(...W.map(V=>W1(V,M)))}class Uh{constructor(M,V){if(this.locale=M,this.format=V,this.tokens=Bh(ro.parseFormat(V),M),this.units=this.tokens.map(ee=>Fh(ee,M)),this.disqualifyingUnit=this.units.find(ee=>ee.invalidReason),!this.disqualifyingUnit){const[ee,ce]=lv(this.units);this.regex=RegExp(ee,"i"),this.handlers=ce}}explainFromTokens(M){if(this.isValid){const[V,ee]=cv(M,this.regex,this.handlers),[ce,Ce,De]=ee?uv(ee):[null,null,void 0];if(Lt(ee,"a")&&Lt(ee,"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:ee,result:ce,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 bf(W,M,V){return new Uh(W,V).explainFromTokens(M)}function ti(W,M,V){const{result:ee,zone:ce,specificOffset:Ce,invalidReason:De}=bf(W,M,V);return[ee,ce,Ce,De]}function Vh(W,M){if(!W)return null;const V=ro.create(M,W).dtFormatter(H1()),ee=V.formatToParts(),ce=V.resolvedOptions();return ee.map(Ce=>_l(Ce,W,ce))}const fa="Invalid DateTime",ka=864e13;function ji(W){return new Bn("unsupported zone",`the zone "${W.name}" is not supported`)}function Vu(W){return W.weekData===null&&(W.weekData=Tt(W.c)),W.weekData}function Rc(W){return W.localWeekData===null&&(W.localWeekData=Tt(W.c,W.loc.getMinDaysInFirstWeek(),W.loc.getStartOfWeek())),W.localWeekData}function Ai(W,M){const V={ts:W.ts,zone:W.zone,c:W.c,o:W.o,loc:W.loc,invalid:W.invalid};return new Tn({...V,...M,old:V})}function xf(W,M,V){let ee=W-M*60*1e3;const ce=V.offset(ee);if(M===ce)return[ee,M];ee-=(ce-M)*60*1e3;const Ce=V.offset(ee);return ce===Ce?[ee,ce]:[W-Math.min(ce,Ce)*60*1e3,Math.max(ce,Ce)]}function $s(W,M){W+=M*60*1e3;const V=new Date(W);return{year:V.getUTCFullYear(),month:V.getUTCMonth()+1,day:V.getUTCDate(),hour:V.getUTCHours(),minute:V.getUTCMinutes(),second:V.getUTCSeconds(),millisecond:V.getUTCMilliseconds()}}function qu(W,M,V){return xf(Za(W),M,V)}function Hu(W,M){const V=W.o,ee=W.c.year+Math.trunc(M.years),ce=W.c.month+Math.trunc(M.months)+Math.trunc(M.quarters)*3,Ce={...W.c,year:ee,month:ce,day:Math.min(W.c.day,Vr(ee,ce))+Math.trunc(M.days)+Math.trunc(M.weeks)*7},De=Qt.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=Za(Ce);let[Ke,jt]=xf(Ue,V,W.zone);return De!==0&&(Ke+=De,jt=W.zone.offset(Ke)),{ts:Ke,o:jt}}function ni(W,M,V,ee,ce,Ce){const{setZone:De,zone:Ue}=V;if(W&&Object.keys(W).length!==0||M){const Ke=M||Ue,jt=Tn.fromObject(W,{...V,zone:Ke,specificOffset:Ce});return De?jt:jt.setZone(Ue)}else return Tn.invalid(new Bn("unparsable",`the input "${ce}" can't be parsed as ${ee}`))}function wf(W,M,V=!0){return W.isValid?ro.create(Me.create("en-US"),{allowZ:V,forceSimple:!0}).formatDateTimeFromString(W,M):null}function ra(W,M,V){const ee=W.c.year>9999||W.c.year<0;let ce="";if(ee&&W.c.year>=0&&(ce+="+"),ce+=en(W.c.year,ee?6:4),V==="year")return ce;if(M){if(ce+="-",ce+=en(W.c.month),V==="month")return ce;ce+="-"}else if(ce+=en(W.c.month),V==="month")return ce;return ce+=en(W.c.day),ce}function Sf(W,M,V,ee,ce,Ce,De){let Ue=!V||W.c.millisecond!==0||W.c.second!==0,Ke="";switch(De){case"day":case"month":case"year":break;default:if(Ke+=en(W.c.hour),De==="hour")break;if(M){if(Ke+=":",Ke+=en(W.c.minute),De==="minute")break;Ue&&(Ke+=":",Ke+=en(W.c.second))}else{if(Ke+=en(W.c.minute),De==="minute")break;Ue&&(Ke+=en(W.c.second))}if(De==="second")break;Ue&&(!ee||W.c.millisecond!==0)&&(Ke+=".",Ke+=en(W.c.millisecond,3))}return ce&&(W.isOffsetFixed&&W.offset===0&&!Ce?Ke+="Z":W.o<0?(Ke+="-",Ke+=en(Math.trunc(-W.o/60)),Ke+=":",Ke+=en(Math.trunc(-W.o%60))):(Ke+="+",Ke+=en(Math.trunc(W.o/60)),Ke+=":",Ke+=en(Math.trunc(W.o%60)))),Ce&&(Ke+="["+W.zone.ianaName+"]"),Ke}const Di={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},dv={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Cf={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Ni=["year","month","day","hour","minute","second","millisecond"],qh=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Hh=["year","ordinal","hour","minute","second","millisecond"];function Es(W){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"}[W.toLowerCase()];if(!M)throw new a(W);return M}function Bl(W){switch(W.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Es(W)}}function kf(W){if(ri===void 0&&(ri=cn.now()),W.type!=="iana")return W.offset(ri);const M=W.name;let V=oi.get(M);return V===void 0&&(V=W.offset(ri),oi.set(M,V)),V}function Wu(W,M){const V=it(M.zone,cn.defaultZone);if(!V.isValid)return Tn.invalid(ji(V));const ee=Me.fromObject(M);let ce,Ce;if(We(W.year))ce=cn.now();else{for(const Ke of Ni)We(W[Ke])&&(W[Ke]=Di[Ke]);const De=Be(W)||gt(W);if(De)return Tn.invalid(De);const Ue=kf(V);[ce,Ce]=qu(W,Ue,V)}return new Tn({ts:ce,zone:V,loc:ee,o:Ce})}function $a(W,M,V){const ee=We(V.round)?!0:V.round,ce=We(V.rounding)?"trunc":V.rounding,Ce=(Ue,Ke)=>(Ue=ys(Ue,ee||V.calendary?0:2,V.calendary?"round":ce),M.loc.clone(V).relFormatter(V).format(Ue,Ke)),De=Ue=>V.calendary?M.hasSame(W,Ue)?0:M.startOf(Ue).diff(W.startOf(Ue),Ue).get(Ue):M.diff(W,Ue).get(Ue);if(V.unit)return Ce(De(V.unit),V.unit);for(const Ue of V.units){const Ke=De(Ue);if(Math.abs(Ke)>=1)return Ce(Ke,Ue)}return Ce(W>M?-0:0,V.units[V.units.length-1])}function Ea(W){let M={},V;return W.length>0&&typeof W[W.length-1]=="object"?(M=W[W.length-1],V=Array.from(W).slice(0,W.length-1)):V=Array.from(W),[M,V]}let ri;const oi=new Map;class Tn{constructor(M){const V=M.zone||cn.defaultZone;let ee=M.invalid||(Number.isNaN(M.ts)?new Bn("invalid input"):null)||(V.isValid?null:ji(V));this.ts=We(M.ts)?cn.now():M.ts;let ce=null,Ce=null;if(!ee)if(M.old&&M.old.ts===this.ts&&M.old.zone.equals(V))[ce,Ce]=[M.old.c,M.old.o];else{const De=Dt(M.o)&&!M.old?M.o:V.offset(this.ts);ce=$s(this.ts,De),ee=Number.isNaN(ce.year)?new Bn("invalid input"):null,ce=ee?null:ce,Ce=ee?null:De}this._zone=V,this.loc=M.loc||Me.create(),this.invalid=ee,this.weekData=null,this.localWeekData=null,this.c=ce,this.o=Ce,this.isLuxonDateTime=!0}static now(){return new Tn({})}static local(){const[M,V]=Ea(arguments),[ee,ce,Ce,De,Ue,Ke,jt]=V;return Wu({year:ee,month:ce,day:Ce,hour:De,minute:Ue,second:Ke,millisecond:jt},M)}static utc(){const[M,V]=Ea(arguments),[ee,ce,Ce,De,Ue,Ke,jt]=V;return M.zone=Et.utcInstance,Wu({year:ee,month:ce,day:Ce,hour:De,minute:Ue,second:Ke,millisecond:jt},M)}static fromJSDate(M,V={}){const ee=we(M)?M.valueOf():NaN;if(Number.isNaN(ee))return Tn.invalid("invalid input");const ce=it(V.zone,cn.defaultZone);return ce.isValid?new Tn({ts:ee,zone:ce,loc:Me.fromObject(V)}):Tn.invalid(ji(ce))}static fromMillis(M,V={}){if(Dt(M))return M<-ka||M>ka?Tn.invalid("Timestamp out of range"):new Tn({ts:M,zone:it(V.zone,cn.defaultZone),loc:Me.fromObject(V)});throw new i(`fromMillis requires a numerical input, but received a ${typeof M} with value ${M}`)}static fromSeconds(M,V={}){if(Dt(M))return new Tn({ts:M*1e3,zone:it(V.zone,cn.defaultZone),loc:Me.fromObject(V)});throw new i("fromSeconds requires a numerical input")}static fromObject(M,V={}){M=M||{};const ee=it(V.zone,cn.defaultZone);if(!ee.isValid)return Tn.invalid(ji(ee));const ce=Me.fromObject(V),Ce=bc(M,Bl),{minDaysInFirstWeek:De,startOfWeek:Ue}=qt(Ce,ce),Ke=cn.now(),jt=We(V.specificOffset)?ee.offset(Ke):V.specificOffset,Mn=!We(Ce.ordinal),Fn=!We(Ce.year),fr=!We(Ce.month)||!We(Ce.day),An=Fn||fr,Zr=Ce.weekYear||Ce.weekNumber;if((An||Mn)&&Zr)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(fr&&Mn)throw new o("Can't mix ordinal dates with month/day");const Qo=Zr||Ce.weekday&&!An;let Aa,Da,Na=$s(Ke,jt);Qo?(Aa=qh,Da=dv,Na=Tt(Na,De,Ue)):Mn?(Aa=Hh,Da=Cf,Na=Xt(Na)):(Aa=Ni,Da=Di);let Ii=!1;for(const Ks of Aa){const pv=Ce[Ks];We(pv)?Ii?Ce[Ks]=Da[Ks]:Ce[Ks]=Na[Ks]:Ii=!0}const Wh=Qo?ge(Ce,De,Ue):Mn?ye(Ce):Be(Ce),$f=Wh||gt(Ce);if($f)return Tn.invalid($f);const Yu=Qo?Nt(Ce,De,Ue):Mn?It(Ce):Ce,[Ef,Ul]=qu(Yu,jt,ee),co=new Tn({ts:Ef,zone:ee,o:Ul,loc:ce});return Ce.weekday&&An&&M.weekday!==co.weekday?Tn.invalid("mismatched weekday",`you can't specify both a weekday of ${Ce.weekday} and a date of ${co.toISO()}`):co.isValid?co:Tn.invalid(co.invalid)}static fromISO(M,V={}){const[ee,ce]=hf(M);return ni(ee,ce,V,"ISO 8601",M)}static fromRFC2822(M,V={}){const[ee,ce]=mf(M);return ni(ee,ce,V,"RFC 2822",M)}static fromHTTP(M,V={}){const[ee,ce]=gf(M);return ni(ee,ce,V,"HTTP",V)}static fromFormat(M,V,ee={}){if(We(M)||We(V))throw new i("fromFormat requires an input string and a format");const{locale:ce=null,numberingSystem:Ce=null}=ee,De=Me.fromOpts({locale:ce,numberingSystem:Ce,defaultToEN:!0}),[Ue,Ke,jt,Mn]=ti(De,M,V);return Mn?Tn.invalid(Mn):ni(Ue,Ke,ee,`format ${V}`,M,jt)}static fromString(M,V,ee={}){return Tn.fromFormat(M,V,ee)}static fromSQL(M,V={}){const[ee,ce]=Ll(M);return ni(ee,ce,V,"SQL",M)}static invalid(M,V=null){if(!M)throw new i("need to specify a reason the DateTime is invalid");const ee=M instanceof Bn?M:new Bn(M,V);if(cn.throwOnInvalid)throw new t(ee);return new Tn({invalid:ee})}static isDateTime(M){return M&&M.isLuxonDateTime||!1}static parseFormatForOpts(M,V={}){const ee=Vh(M,Me.fromObject(V));return ee?ee.map(ce=>ce?ce.val:null).join(""):null}static expandFormat(M,V={}){return Bh(ro.parseFormat(M),Me.fromObject(V)).map(ee=>ee.val).join("")}static resetCache(){ri=void 0,oi.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?Vu(this).weekYear:NaN}get weekNumber(){return this.isValid?Vu(this).weekNumber:NaN}get weekday(){return this.isValid?Vu(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Rc(this).weekday:NaN}get localWeekNumber(){return this.isValid?Rc(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Rc(this).weekYear:NaN}get ordinal(){return this.isValid?Xt(this.c).ordinal:NaN}get monthShort(){return this.isValid?br.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?br.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?br.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?br.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,ee=Za(this.c),ce=this.zone.offset(ee-M),Ce=this.zone.offset(ee+M),De=this.zone.offset(ee-ce*V),Ue=this.zone.offset(ee-Ce*V);if(De===Ue)return[this];const Ke=ee-De*V,jt=ee-Ue*V,Mn=$s(Ke,De),Fn=$s(jt,Ue);return Mn.hour===Fn.hour&&Mn.minute===Fn.minute&&Mn.second===Fn.second&&Mn.millisecond===Fn.millisecond?[Ai(this,{ts:Ke}),Ai(this,{ts:jt})]:[this]}get isInLeapYear(){return ca(this.year)}get daysInMonth(){return Vr(this.year,this.month)}get daysInYear(){return this.isValid?dr(this.year):NaN}get weeksInWeekYear(){return this.isValid?vs(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?vs(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(M={}){const{locale:V,numberingSystem:ee,calendar:ce}=ro.create(this.loc.clone(M),M).resolvedOptions(this);return{locale:V,numberingSystem:ee,outputCalendar:ce}}toUTC(M=0,V={}){return this.setZone(Et.instance(M),V)}toLocal(){return this.setZone(cn.defaultZone)}setZone(M,{keepLocalTime:V=!1,keepCalendarTime:ee=!1}={}){if(M=it(M,cn.defaultZone),M.equals(this.zone))return this;if(M.isValid){let ce=this.ts;if(V||ee){const Ce=M.offset(this.ts),De=this.toObject();[ce]=qu(De,Ce,M)}return Ai(this,{ts:ce,zone:M})}else return Tn.invalid(ji(M))}reconfigure({locale:M,numberingSystem:V,outputCalendar:ee}={}){const ce=this.loc.clone({locale:M,numberingSystem:V,outputCalendar:ee});return Ai(this,{loc:ce})}setLocale(M){return this.reconfigure({locale:M})}set(M){if(!this.isValid)return this;const V=bc(M,Bl),{minDaysInFirstWeek:ee,startOfWeek:ce}=qt(V,this.loc),Ce=!We(V.weekYear)||!We(V.weekNumber)||!We(V.weekday),De=!We(V.ordinal),Ue=!We(V.year),Ke=!We(V.month)||!We(V.day),jt=Ue||Ke,Mn=V.weekYear||V.weekNumber;if((jt||De)&&Mn)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(Ke&&De)throw new o("Can't mix ordinal dates with month/day");let Fn;Ce?Fn=Nt({...Tt(this.c,ee,ce),...V},ee,ce):We(V.ordinal)?(Fn={...this.toObject(),...V},We(V.day)&&(Fn.day=Math.min(Vr(Fn.year,Fn.month),Fn.day))):Fn=It({...Xt(this.c),...V});const[fr,An]=qu(Fn,this.o,this.zone);return Ai(this,{ts:fr,o:An})}plus(M){if(!this.isValid)return this;const V=Qt.fromDurationLike(M);return Ai(this,Hu(this,V))}minus(M){if(!this.isValid)return this;const V=Qt.fromDurationLike(M).negate();return Ai(this,Hu(this,V))}startOf(M,{useLocaleWeeks:V=!1}={}){if(!this.isValid)return this;const ee={},ce=Qt.normalizeUnit(M);switch(ce){case"years":ee.month=1;case"quarters":case"months":ee.day=1;case"weeks":case"days":ee.hour=0;case"hours":ee.minute=0;case"minutes":ee.second=0;case"seconds":ee.millisecond=0;break}if(ce==="weeks")if(V){const Ce=this.loc.getStartOfWeek(),{weekday:De}=this;De<Ce&&(ee.weekNumber=this.weekNumber-1),ee.weekday=Ce}else ee.weekday=1;if(ce==="quarters"){const Ce=Math.ceil(this.month/3);ee.month=(Ce-1)*3+1}return this.set(ee)}endOf(M,V){return this.isValid?this.plus({[M]:1}).startOf(M,V).minus(1):this}toFormat(M,V={}){return this.isValid?ro.create(this.loc.redefaultToEN(V)).formatDateTimeFromString(this,M):fa}toLocaleString(M=m,V={}){return this.isValid?ro.create(this.loc.clone(V),M).formatDateTime(this):fa}toLocaleParts(M={}){return this.isValid?ro.create(this.loc.clone(M),M).formatDateTimeParts(this):[]}toISO({format:M="extended",suppressSeconds:V=!1,suppressMilliseconds:ee=!1,includeOffset:ce=!0,extendedZone:Ce=!1,precision:De="milliseconds"}={}){if(!this.isValid)return null;De=Es(De);const Ue=M==="extended";let Ke=ra(this,Ue,De);return Ni.indexOf(De)>=3&&(Ke+="T"),Ke+=Sf(this,Ue,V,ee,ce,Ce,De),Ke}toISODate({format:M="extended",precision:V="day"}={}){return this.isValid?ra(this,M==="extended",Es(V)):null}toISOWeekDate(){return wf(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:M=!1,suppressSeconds:V=!1,includeOffset:ee=!0,includePrefix:ce=!1,extendedZone:Ce=!1,format:De="extended",precision:Ue="milliseconds"}={}){return this.isValid?(Ue=Es(Ue),(ce&&Ni.indexOf(Ue)>=3?"T":"")+Sf(this,De==="extended",V,M,ee,Ce,Ue)):null}toRFC2822(){return wf(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return wf(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ra(this,!0):null}toSQLTime({includeOffset:M=!0,includeZone:V=!1,includeOffsetSpace:ee=!0}={}){let ce="HH:mm:ss.SSS";return(V||M)&&(ee&&(ce+=" "),V?ce+="z":M&&(ce+="ZZ")),wf(this,ce,!0)}toSQL(M={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(M)}`:null}toString(){return this.isValid?this.toISO():fa}[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",ee={}){if(!this.isValid||!M.isValid)return Qt.invalid("created by diffing an invalid DateTime");const ce={locale:this.locale,numberingSystem:this.numberingSystem,...ee},Ce=Ct(V).map(Qt.normalizeUnit),De=M.valueOf()>this.valueOf(),Ue=De?this:M,Ke=De?M:this,jt=ei(Ue,Ke,Ce,ce);return De?jt.negate():jt}diffNow(M="milliseconds",V={}){return this.diff(Tn.now(),M,V)}until(M){return this.isValid?bn.fromDateTimes(this,M):this}hasSame(M,V,ee){if(!this.isValid)return!1;const ce=M.valueOf(),Ce=this.setZone(M.zone,{keepLocalTime:!0});return Ce.startOf(V,ee)<=ce&&ce<=Ce.endOf(V,ee)}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||Tn.fromObject({},{zone:this.zone}),ee=M.padding?this<V?-M.padding:M.padding:0;let ce=["years","months","days","hours","minutes","seconds"],Ce=M.unit;return Array.isArray(M.unit)&&(ce=M.unit,Ce=void 0),$a(V,this.plus(ee),{...M,numeric:"always",units:ce,unit:Ce})}toRelativeCalendar(M={}){return this.isValid?$a(M.base||Tn.fromObject({},{zone:this.zone}),this,{...M,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...M){if(!M.every(Tn.isDateTime))throw new i("min requires all arguments be DateTimes");return Mt(M,V=>V.valueOf(),Math.min)}static max(...M){if(!M.every(Tn.isDateTime))throw new i("max requires all arguments be DateTimes");return Mt(M,V=>V.valueOf(),Math.max)}static fromFormatExplain(M,V,ee={}){const{locale:ce=null,numberingSystem:Ce=null}=ee,De=Me.fromOpts({locale:ce,numberingSystem:Ce,defaultToEN:!0});return bf(De,M,V)}static fromStringExplain(M,V,ee={}){return Tn.fromFormatExplain(M,V,ee)}static buildFormatParser(M,V={}){const{locale:ee=null,numberingSystem:ce=null}=V,Ce=Me.fromOpts({locale:ee,numberingSystem:ce,defaultToEN:!0});return new Uh(Ce,M)}static fromFormatParser(M,V,ee={}){if(We(M)||We(V))throw new i("fromFormatParser requires an input string and a format parser");const{locale:ce=null,numberingSystem:Ce=null}=ee,De=Me.fromOpts({locale:ce,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:Ke,specificOffset:jt,invalidReason:Mn}=V.explainFromTokens(M);return Mn?Tn.invalid(Mn):ni(Ue,Ke,ee,`format ${V.format}`,M,jt)}static get DATE_SHORT(){return m}static get DATE_MED(){return g}static get DATE_MED_WITH_WEEKDAY(){return y}static get DATE_FULL(){return x}static get DATE_HUGE(){return w}static get TIME_SIMPLE(){return S}static get TIME_WITH_SECONDS(){return b}static get TIME_WITH_SHORT_OFFSET(){return $}static get TIME_WITH_LONG_OFFSET(){return k}static get TIME_24_SIMPLE(){return R}static get TIME_24_WITH_SECONDS(){return O}static get TIME_24_WITH_SHORT_OFFSET(){return P}static get TIME_24_WITH_LONG_OFFSET(){return D}static get DATETIME_SHORT(){return A}static get DATETIME_SHORT_WITH_SECONDS(){return F}static get DATETIME_MED(){return L}static get DATETIME_MED_WITH_SECONDS(){return _}static get DATETIME_MED_WITH_WEEKDAY(){return E}static get DATETIME_FULL(){return z}static get DATETIME_FULL_WITH_SECONDS(){return I}static get DATETIME_HUGE(){return U}static get DATETIME_HUGE_WITH_SECONDS(){return N}}function ai(W){if(Tn.isDateTime(W))return W;if(W&&W.valueOf&&Dt(W.valueOf()))return Tn.fromJSDate(W);if(W&&typeof W=="object")return Tn.fromObject(W);throw new i(`Unknown datetime argument: ${W}, of type ${typeof W}`)}const fv="3.7.2";return Fa.DateTime=Tn,Fa.Duration=Qt,Fa.FixedOffsetZone=Et,Fa.IANAZone=Z,Fa.Info=br,Fa.Interval=bn,Fa.InvalidZone=vt,Fa.Settings=cn,Fa.SystemZone=oe,Fa.VERSION=fv,Fa.Zone=q,Fa}var xI;function o2(){return xI||(xI=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CronDate=e.DAYS_IN_MONTH=e.DateMathOp=e.TimeUnit=void 0;const t=Twe();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 l={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,l):typeof i=="number"?this.#e=t.DateTime.fromMillis(i,l):(this.#e=t.DateTime.fromISO(i,l),this.#e.isValid||(this.#e=t.DateTime.fromRFC2822(i,l)),this.#e.isValid||(this.#e=t.DateTime.fromSQL(i,l)),this.#e.isValid||(this.#e=t.DateTime.fromFormat(i,"EEE, d MMM yyyy HH:mm:ss",l))):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 l=o.#o(this.#e.year);return i===e.DAYS_IN_MONTH[s-1]-(l?0:1)}return i===e.DAYS_IN_MONTH[s-1]}isLastWeekdayOfMonth(){const{day:i,month:s}=this.#e;let l;return s===2?l=e.DAYS_IN_MONTH[s-1]-(o.#o(this.#e.year)?0:1):l=e.DAYS_IN_MONTH[s-1],i>l-7}applyDateOperation(i,s,l){if(s===n.Month||s===n.Day){this.invokeDateOperation(i,s);return}const d=this.getHours();this.invokeDateOperation(i,s);const u=this.getHours(),m=u-d;m===2?l!==24&&(this.dstStart=d+1):m===0&&this.getMinutes()===0&&this.getSeconds()===0&&l!==24&&(this.dstEnd=u)}#r(){return this.#e.toUTC()}}e.CronDate=o,e.default=o})(vI)),vI}var wI;function Mwe(){if(wI)return dg;wI=1,Object.defineProperty(dg,"__esModule",{value:!0}),dg.CronMonth=void 0;const e=o2(),t=tf(),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 dg.CronMonth=a,dg}var fg={},SI;function Owe(){if(SI)return fg;SI=1,Object.defineProperty(fg,"__esModule",{value:!0}),fg.CronSecond=void 0;const e=tf(),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 fg.CronSecond=o,fg}var CI;function a2(){return CI||(CI=1,(function(e){var t=fp&&fp.__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=fp&&fp.__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(Cwe(),e),n(kwe(),e),n($we(),e),n(tf(),e),n(Ewe(),e),n(Rwe(),e),n(Mwe(),e),n(Owe(),e)})(fp)),fp}var kI;function s6(){if(kI)return ag;kI=1,Object.defineProperty(ag,"__esModule",{value:!0}),ag.CronFieldCollection=void 0;const e=a2();let t=class Og{#e;#t;#n;#o;#r;#a;static from(r,o){return new Og({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:l}){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(!l)throw new Error("Validation error, Field dayOfWeek is missing");if(s.values.length===1&&!i.hasLastChar&&l.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=l,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,l)=>{if(a===void 0){a={start:i,count:1};return}const d=l[s-1]||a.start,u=l[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 m=i-d,g=u-i;if(m<=g){a={...a,count:2,end:i,step:m};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??d,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=(d,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 l={length:r.end-r.start+1};return Array.from(l,s).filter(d=>d!==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=Og.compactField(a);if(i.length===1){const s=Og.#s(r,i[0],o);if(s)return s}return i.map(s=>{const l=s.count===1?s.start.toString():Og.#i(s,o);return r instanceof e.CronDayOfWeek&&r.nthDay>0?`${l}#${r.nthDay}`:l}).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 ag.CronFieldCollection=t,ag}var $I={},EI;function l6(){return EI||(EI=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=o2();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 l=new t.CronDate(s,this.#t);this.#o&&l.getTime()<this.#o.getTime()?s=this.#o:this.#r&&l.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 l=new t.CronDate(a);return l.setEndOfDay(),this.#s=i,this.#i=s.getUTCOffset()!==l.getUTCOffset(),this.#i}#u(a,i,s){const l=this.#a.second.values,d=a.getSeconds(),u=this.#a.second.findNearestValue(d,s);if(u!==null){a.setSeconds(u);return}a.applyDateOperation(i,t.TimeUnit.Minute,this.#a.hour.values.length),a.setSeconds(this.#l(l,s))}#p(a,i,s){const l=this.#a.minute.values,d=this.#a.second.values,u=a.getMinutes(),m=this.#a.minute.findNearestValue(u,s);if(m!==null){a.setMinutes(m),a.setSeconds(this.#l(d,s));return}a.applyDateOperation(i,t.TimeUnit.Hour,this.#a.hour.values.length),a.setMinutes(this.#l(l,s)),a.setSeconds(this.#l(d,s))}static#f(a,i){const s=i.isLastWeekdayOfMonth();return a.some(l=>{const d=parseInt(l.toString().charAt(0),10)%7;if(Number.isNaN(d))throw new Error(`Invalid last weekday of the month expression: ${l}`);return i.getDay()===d&&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:l,month:d}=this.#a,u=new t.CronDate(a,this.#t);return!(!i.values.includes(u.getSeconds())||!s.values.includes(u.getMinutes())||!l.values.includes(u.getHours())||!d.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,l=this.#a.dayOfWeek.isWildcard,d=!l,u=r.#c(a.getDate(),this.#a.dayOfMonth.values)||this.#a.dayOfMonth.hasLastChar&&a.isLastDayOfMonth(),m=r.#c(a.getDay(),this.#a.dayOfWeek.values)||this.#a.dayOfWeek.hasLastChar&&r.#f(this.#a.dayOfWeek.values,a);return!!(s&&d&&(u||m)||u&&!d||i&&!l&&m)}#g(a,i,s){const l=this.#a.hour.values,d=l,u=a.getHours(),m=r.#c(u,l),g=a.dstEnd===u;if(a.dstStart!==null&&a.dstStart===u-1&&r.#c(a.dstStart,l))return!0;if(g&&!s)return a.dstEnd=null,a.applyDateOperation(t.DateMathOp.Add,t.TimeUnit.Hour,d.length),!1;if(m)return!0;a.dstStart=null;const y=this.#a.hour.findNearestValue(u,s);if(y===null)return a.applyDateOperation(i,t.TimeUnit.Day,d.length),!1;if(this.#d(a)){const x=s?u-y:y-u;for(let w=0;w<x&&(a.applyDateOperation(i,t.TimeUnit.Hour,d.length),!(!s&&a.getHours()>=y||s&&a.getHours()<=y));w++);}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),l=s.getTime();let d=0;for(;++d<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(l===s.getTime()){(i==="Add"||s.getMilliseconds()===0)&&s.applyDateOperation(i,t.TimeUnit.Second,this.#a.hour.values.length);continue}break}}if(d>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})($I)),$I}var Ub={},RI;function Pwe(){if(RI)return Ub;RI=1,Object.defineProperty(Ub,"__esModule",{value:!0}),Ub.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 Ub}var TI;function C$(){if(TI)return di;TI=1,Object.defineProperty(di,"__esModule",{value:!0}),di.CronExpressionParser=di.DayOfWeek=di.Months=di.CronUnit=di.PredefinedExpressions=void 0;const e=s6(),t=l6(),n=Pwe(),r=a2();var o;(function(d){d["@yearly"]="0 0 0 1 1 *",d["@annually"]="0 0 0 1 1 *",d["@monthly"]="0 0 0 1 * *",d["@weekly"]="0 0 0 * * 0",d["@daily"]="0 0 0 * * *",d["@hourly"]="0 0 * * * *",d["@minutely"]="0 * * * * *",d["@secondly"]="* * * * * *",d["@weekdays"]="0 0 0 * * 1-5",d["@weekends"]="0 0 0 * * 0,6"})(o||(di.PredefinedExpressions=o={}));var a;(function(d){d.Second="Second",d.Minute="Minute",d.Hour="Hour",d.DayOfMonth="DayOfMonth",d.Month="Month",d.DayOfWeek="DayOfWeek"})(a||(di.CronUnit=a={}));var i;(function(d){d[d.jan=1]="jan",d[d.feb=2]="feb",d[d.mar=3]="mar",d[d.apr=4]="apr",d[d.may=5]="may",d[d.jun=6]="jun",d[d.jul=7]="jul",d[d.aug=8]="aug",d[d.sep=9]="sep",d[d.oct=10]="oct",d[d.nov=11]="nov",d[d.dec=12]="dec"})(i||(di.Months=i={}));var s;(function(d){d[d.sun=0]="sun",d[d.mon=1]="mon",d[d.tue=2]="tue",d[d.wed=3]="wed",d[d.thu=4]="thu",d[d.fri=5]="fri",d[d.sat=6]="sat"})(s||(di.DayOfWeek=s={}));let l=class fi{static parse(u,m={}){const{strict:g=!1,hashSeed:y}=m,x=(0,n.seededRandom)(y);u=o[u]||u;const w=fi.#e(u,g);if(!(w.dayOfMonth==="*"||w.dayOfWeek==="*"||!g))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");const S=fi.#t(a.Second,w.second,r.CronSecond.constraints,x),b=fi.#t(a.Minute,w.minute,r.CronMinute.constraints,x),$=fi.#t(a.Hour,w.hour,r.CronHour.constraints,x),k=fi.#t(a.Month,w.month,r.CronMonth.constraints,x),R=fi.#t(a.DayOfMonth,w.dayOfMonth,r.CronDayOfMonth.constraints,x),{dayOfWeek:O,nthDayOfWeek:P}=fi.#d(w.dayOfWeek),D=fi.#t(a.DayOfWeek,O,r.CronDayOfWeek.constraints,x),A=new e.CronFieldCollection({second:new r.CronSecond(S,{rawValue:w.second}),minute:new r.CronMinute(b,{rawValue:w.minute}),hour:new r.CronHour($,{rawValue:w.hour}),dayOfMonth:new r.CronDayOfMonth(R,{rawValue:w.dayOfMonth}),month:new r.CronMonth(k,{rawValue:w.month}),dayOfWeek:new r.CronDayOfWeek(D,{rawValue:w.dayOfWeek,nthDayOfWeek:P})});return new t.CronExpression(A,{...m,expression:u})}static#e(u,m){if(m&&!u.length)throw new Error("Invalid cron expression");u=u||"0 * * * * *";const g=u.trim().split(/\s+/);if(m&&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[x,w,S,b,$,k]=g;return{second:x,minute:w,hour:S,dayOfMonth:b,month:$,dayOfWeek:k}}static#t(u,m,g,y){if((u===a.Month||u===a.DayOfWeek)&&(m=m.replace(/[a-z]{3}/gi,x=>{x=x.toLowerCase();const w=i[x]||s[x];if(w===void 0)throw new Error(`Validation error, cannot resolve alias "${x}"`);return w.toString()})),!g.validChars.test(m))throw new Error(`Invalid characters, got value: ${m}`);return m=this.#n(m,g),m=this.#o(m,g,y),this.#r(u,m,g)}static#n(u,m){return u.replace(/[*?]/g,m.min+"-"+m.max)}static#o(u,m,g){const y=g();return u.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(x,w,S,b)=>{if(w&&S&&b){const $=parseInt(w,10),k=parseInt(S,10),R=parseInt(b,10);if($>k)throw new Error(`Invalid range: ${$}-${k}, min > max`);if(R<=0)throw new Error(`Invalid step: ${R}, must be positive`);const O=Math.max($,m.min),P=Math.floor(y*R),D=[];for(let A=Math.floor(O/R)*R+P;A<=k;A+=R)A>=O&&D.push(A);return D.join(",")}else if(w&&S){const $=parseInt(w,10),k=parseInt(S,10);if($>k)throw new Error(`Invalid range: ${$}-${k}, min > max`);return String(Math.floor(y*(k-$+1))+$)}else if(b){const $=parseInt(b,10);if($<=0)throw new Error(`Invalid step: ${$}, must be positive`);const k=Math.floor(y*$),R=[];for(let O=Math.floor(m.min/$)*$+k;O<=m.max;O+=$)O>=m.min&&R.push(O);return R.join(",")}else return String(Math.floor(y*(m.max-m.min+1)+m.min))})}static#r(u,m,g){const y=[];function x(w,S){if(Array.isArray(w))y.push(...w);else if(fi.#u(S,w))y.push(w);else{const b=parseInt(w.toString(),10);if(!(b>=S.min&&b<=S.max))throw new Error(`Constraint error, got value ${w} expected range ${S.min}-${S.max}`);y.push(u===a.DayOfWeek?b%7:w)}}return m.split(",").forEach(w=>{if(!(w.length>0))throw new Error("Invalid list value format");x(fi.#a(u,w,g),g)}),y}static#a(u,m,g){const y=m.split("/");if(y.length>2)throw new Error(`Invalid repeat: ${m}`);return y.length===2?(y[0].includes("-")||(y[0]=`${y[0]}-${g.max}`),fi.#l(u,y[0],parseInt(y[1],10),g)):fi.#l(u,m,1,g)}static#s(u,m,g){if(!(!isNaN(u)&&!isNaN(m)&&u>=g.min&&m<=g.max))throw new Error(`Constraint error, got range ${u}-${m} expected range ${g.min}-${g.max}`);if(u>m)throw new Error(`Invalid range: ${u}-${m}, min(${u}) > max(${m})`)}static#i(u){if(!(!isNaN(u)&&u>0))throw new Error(`Constraint error, cannot repeat at every ${u} time.`)}static#c(u,m,g,y){const x=[];u===a.DayOfWeek&&g%7===0&&x.push(0);for(let w=m;w<=g;w+=y)x.indexOf(w)===-1&&x.push(w);return x}static#l(u,m,g,y){const x=m.split("-");if(x.length<=1)return isNaN(+m)?m:+m;const[w,S]=x.map(b=>parseInt(b,10));return this.#s(w,S,y),this.#i(g),this.#c(u,w,S,g)}static#d(u){const m=u.split("#");if(m.length<=1)return{dayOfWeek:m[0]};const g=+m[m.length-1],y=u.match(/([,-/])/);if(y!==null)throw new Error(`Constraint error, invalid dayOfWeek \`#\` and \`${y?.[0]}\` special characters are incompatible`);if(!(m.length<=2&&!isNaN(g)&&g>=1&&g<=5))throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return{dayOfWeek:m[0],nthDayOfWeek:g}}static#u(u,m){return u.chars.some(g=>m.toString().includes(g))}};return di.CronExpressionParser=l,di}var js={};const jwe={},Awe=Object.freeze(Object.defineProperty({__proto__:null,default:jwe},Symbol.toStringTag,{value:"Module"})),MI=wae(Awe);var OI;function Dwe(){if(OI)return js;OI=1;var e=js&&js.__createBinding||(Object.create?(function(a,i,s,l){l===void 0&&(l=s);var d=Object.getOwnPropertyDescriptor(i,s);(!d||("get"in d?!i.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(a,l,d)}):(function(a,i,s,l){l===void 0&&(l=s),a[l]=i[s]})),t=js&&js.__setModuleDefault||(Object.create?(function(a,i){Object.defineProperty(a,"default",{enumerable:!0,value:i})}):function(a,i){a.default=i}),n=js&&js.__importStar||(function(){var a=function(i){return a=Object.getOwnPropertyNames||function(s){var l=[];for(var d in s)Object.prototype.hasOwnProperty.call(s,d)&&(l[l.length]=d);return l},a(i)};return function(i){if(i&&i.__esModule)return i;var s={};if(i!=null)for(var l=a(i),d=0;d<l.length;d++)l[d]!=="default"&&e(s,i,l[d]);return t(s,i),s}})();Object.defineProperty(js,"__esModule",{value:!0}),js.CronFileParser=void 0;const r=C$();let o=class y0{static async parseFile(i){const{readFile:s}=await Promise.resolve().then(()=>n(MI)),l=await s(i,"utf8");return y0.#e(l)}static parseFileSync(i){const{readFileSync:s}=MI,l=s(i,"utf8");return y0.#e(l)}static#e(i){const s=i.split(`
481
481
  `),l={variables:{},expressions:[],errors:{}};for(const d of s){const u=d.trim();if(u.length===0||u.startsWith("#"))continue;const m=u.match(/^(.*)=(.*)$/);if(m){const[,g,y]=m;l.variables[g]=y.replace(/["']/g,"");continue}try{const g=y0.#t(u);l.expressions.push(g.interval)}catch(g){l.errors[u]=g}}return l}static#t(i){const s=i.split(" ");return{interval:r.CronExpressionParser.parse(s.slice(0,5).join(" ")),command:s.slice(5,s.length)}}};return js.CronFileParser=o,js}var PI;function Nwe(){return PI||(PI=1,(function(e){var t=dp&&dp.__createBinding||(Object.create?(function(d,u,m,g){g===void 0&&(g=m);var y=Object.getOwnPropertyDescriptor(u,m);(!y||("get"in y?!u.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return u[m]}}),Object.defineProperty(d,g,y)}):(function(d,u,m,g){g===void 0&&(g=m),d[g]=u[m]})),n=dp&&dp.__exportStar||function(d,u){for(var m in d)m!=="default"&&!Object.prototype.hasOwnProperty.call(u,m)&&t(u,d,m)};Object.defineProperty(e,"__esModule",{value:!0}),e.CronFileParser=e.CronExpressionParser=e.CronExpression=e.CronFieldCollection=e.CronDate=void 0;const r=C$();var o=o2();Object.defineProperty(e,"CronDate",{enumerable:!0,get:function(){return o.CronDate}});var a=s6();Object.defineProperty(e,"CronFieldCollection",{enumerable:!0,get:function(){return a.CronFieldCollection}});var i=l6();Object.defineProperty(e,"CronExpression",{enumerable:!0,get:function(){return i.CronExpression}});var s=C$();Object.defineProperty(e,"CronExpressionParser",{enumerable:!0,get:function(){return s.CronExpressionParser}});var l=Dwe();Object.defineProperty(e,"CronFileParser",{enumerable:!0,get:function(){return l.CronFileParser}}),n(a2(),e),e.default=r.CronExpressionParser})(dp)),dp}var Iwe=Nwe(),jI={exports:{}},AI;function Lwe(){return AI||(AI=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,()=>(()=>{var n={949:((i,s,l)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CronParser=void 0;var d=l(515),u=(function(){function m(g,y,x){y===void 0&&(y=!0),x===void 0&&(x=!1),this.expression=g,this.dayOfWeekStartIndexZero=y,this.monthStartIndexZero=x}return m.prototype.parse=function(){var g,y,x=(g=this.expression)!==null&&g!==void 0?g:"";if(x==="@reboot")return y=["@reboot","","","","","",""],y;if(x.startsWith("@")){var w=this.parseSpecial(this.expression);y=this.extractParts(w)}else y=this.extractParts(this.expression);return this.normalize(y),this.validate(y),y},m.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"},x=y[g];if(!x)throw new Error("Unknown special expression.");return x},m.prototype.extractParts=function(g){if(!this.expression)throw new Error("cron expression is empty");for(var y=g.trim().split(/[ ]+/),x=0;x<y.length;x++)if(y[x].includes(",")){var w=y[x].split(",").map(function(b){return b.trim()}).filter(function(b){return b!==""}).map(function(b){return isNaN(Number(b))?b:Number(b)}).filter(function(b){return b!==null&&b!==""});w.length===0&&w.push("*"),w.sort(function(b,$){return b!==null&&$!==null?b-$:0}),y[x]=w.map(function(b){return b!==null?b.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 S=/\d{4}$/.test(y[5])||y[4]=="?"||y[2]=="?";S?y.unshift(""):y.push("")}else if(y.length>7)throw new Error("Expression has ".concat(y.length," parts; too many!"));return y},m.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 P=O.replace(/\D/,""),D=P;return y.dayOfWeekStartIndexZero?P=="7"&&(D="0"):D=(parseInt(P)-1).toString(),O.replace(P,D)}),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 x={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var w in x)g[5]=g[5].replace(new RegExp(w,"gi"),x[w].toString());g[4]=g[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function(O){var P=O.replace(/\D/,""),D=P;return y.monthStartIndexZero&&(D=(parseInt(P)+1).toString()),O.replace(P,D)});var S={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 b in S)g[4]=g[4].replace(new RegExp(b,"gi"),S[b].toString());g[0]=="0"&&(g[0]=""),!/\*|\-|\,|\//.test(g[2])&&(/\*|\//.test(g[1])||/\*|\//.test(g[0]))&&(g[2]+="-".concat(g[2]));for(var $=0;$<g.length;$++)if(g[$].indexOf(",")!=-1&&(g[$]=g[$].split(",").filter(function(O){return O!==""}).join(",")||"*"),g[$]=="*/1"&&(g[$]="*"),g[$].indexOf("/")>-1&&!/^\*|\-|\,/.test(g[$])){var k=null;switch($){case 4:k="12";break;case 5:k="6";break;case 6:k="9999";break;default:k=null;break}if(k!==null){var R=g[$].split("/");g[$]="".concat(R[0],"-").concat(k,"/").concat(R[1])}}},m.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)},m.prototype.validateAnyRanges=function(g){d.default.secondRange(g[0]),d.default.minuteRange(g[1]),d.default.hourRange(g[2]),d.default.dayOfMonthRange(g[3]),d.default.monthRange(g[4],this.monthStartIndexZero),d.default.dayOfWeekRange(g[5],this.dayOfWeekStartIndexZero)},m.prototype.validateOnlyExpectedCharactersFound=function(g,y){var x=g.match(new RegExp("[^".concat(y,"]+"),"gi"));if(x&&x.length)throw new Error("Expression contains invalid values: '".concat(x.toString(),"'"))},m})();s.CronParser=u}),333:((i,s,l)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExpressionDescriptor=void 0;var d=l(823),u=l(949),m=(function(){function g(y,x){if(this.expression=y,this.options=x,this.expressionParts=new Array(5),!this.options.locale&&g.defaultLocale&&(this.options.locale=g.defaultLocale),!g.locales[this.options.locale]){var w=Object.keys(g.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(w,"'.")),this.options.locale=w}this.i18n=g.locales[this.options.locale],x.use24HourTimeFormat===void 0&&(x.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return g.toString=function(y,x){var w=x===void 0?{}:x,S=w.throwExceptionOnParseError,b=S===void 0?!0:S,$=w.verbose,k=$===void 0?!1:$,R=w.dayOfWeekStartIndexZero,O=R===void 0?!0:R,P=w.monthStartIndexZero,D=P===void 0?!1:P,A=w.use24HourTimeFormat,F=w.locale,L=F===void 0?null:F,_={throwExceptionOnParseError:b,verbose:k,dayOfWeekStartIndexZero:O,monthStartIndexZero:D,use24HourTimeFormat:A,locale:L};_.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var E=new g(y,_);return E.getFullDescription()},g.initialize=function(y,x){x===void 0&&(x="en"),g.specialCharacters=["/","-",",","*"],g.defaultLocale=x,y.load(g.locales)},g.prototype.getFullDescription=function(){var y,x,w="";try{var S=new u.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=S.parse(),this.expressionParts[0]==="@reboot")return((x=(y=this.i18n).atReboot)===null||x===void 0?void 0:x.call(y))||"Run once, at startup";var b=this.getTimeOfDayDescription(),$=this.getDayOfMonthDescription(),k=this.getMonthDescription(),R=this.getDayOfWeekDescription(),O=this.getYearDescription();w+=b+$+R+k+O,w=this.transformVerbosity(w,!!this.options.verbose),w=w.charAt(0).toLocaleUpperCase()+w.substr(1)}catch(P){if(!this.options.throwExceptionOnParseError)w=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(P)}return w},g.prototype.getTimeOfDayDescription=function(){var y=this.expressionParts[0],x=this.expressionParts[1],w=this.expressionParts[2],S="";if(!d.StringUtilities.containsAny(x,g.specialCharacters)&&!d.StringUtilities.containsAny(w,g.specialCharacters)&&!d.StringUtilities.containsAny(y,g.specialCharacters))S+=this.i18n.atSpace()+this.formatTime(w,x,y);else if(!y&&x.indexOf("-")>-1&&!(x.indexOf(",")>-1)&&!(x.indexOf("/")>-1)&&!d.StringUtilities.containsAny(w,g.specialCharacters)){var b=x.split("-");S+=d.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(w,b[0],""),this.formatTime(w,b[1],""))}else if(!y&&w.indexOf(",")>-1&&w.indexOf("-")==-1&&w.indexOf("/")==-1&&!d.StringUtilities.containsAny(x,g.specialCharacters)){var $=w.split(",");S+=this.i18n.at();for(var k=0;k<$.length;k++)S+=" ",S+=this.formatTime($[k],x,""),k<$.length-2&&(S+=","),k==$.length-2&&(S+=this.i18n.spaceAnd())}else{var R=this.getSecondsDescription(),O=this.getMinutesDescription(),P=this.getHoursDescription();if(S+=R,S&&O&&(S+=", "),S+=O,O===P)return S;S&&P&&(S+=", "),S+=P}return S},g.prototype.getSecondsDescription=function(){var y=this,x=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(w){return w},function(w){return d.StringUtilities.format(y.i18n.everyX0Seconds(w),w)},function(w){return y.i18n.secondsX0ThroughX1PastTheMinute()},function(w){return w=="0"?"":parseInt(w)<20?y.i18n.atX0SecondsPastTheMinute(w):y.i18n.atX0SecondsPastTheMinuteGt20()||y.i18n.atX0SecondsPastTheMinute(w)});return x},g.prototype.getMinutesDescription=function(){var y=this,x=this.expressionParts[0],w=this.expressionParts[2],S=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(b){return b},function(b){return d.StringUtilities.format(y.i18n.everyX0Minutes(b),b)},function(b){return y.i18n.minutesX0ThroughX1PastTheHour()},function(b){try{return b=="0"&&w.indexOf("/")==-1&&x==""?y.i18n.everyHour():parseInt(b)<20?y.i18n.atX0MinutesPastTheHour(b):y.i18n.atX0MinutesPastTheHourGt20()||y.i18n.atX0MinutesPastTheHour(b)}catch{return y.i18n.atX0MinutesPastTheHour(b)}});return S},g.prototype.getHoursDescription=function(){var y=this,x=this.expressionParts[2],w=0,S=[];x.split("/")[0].split(",").forEach(function(k){var R=k.split("-");R.length===2&&S.push({value:R[1],index:w+1}),w+=R.length});var b=0,$=this.getSegmentDescription(x,this.i18n.everyHour(),function(k){var R=S.find(function(P){return P.value===k&&P.index===b}),O=R&&y.expressionParts[1]!=="0";return b++,O?y.formatTime(k,"59",""):y.formatTime(k,"0","")},function(k){return d.StringUtilities.format(y.i18n.everyX0Hours(k),k)},function(k){return y.i18n.betweenX0AndX1()},function(k){return y.i18n.atX0()});return $},g.prototype.getDayOfWeekDescription=function(){var y=this,x=this.i18n.daysOfTheWeek(),w=null;return this.expressionParts[5]=="*"?w="":w=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(S,b){var $=S;S.indexOf("#")>-1?$=S.substring(0,S.indexOf("#")):S.indexOf("L")>-1&&($=$.replace("L",""));var k=parseInt($),R=y.i18n.daysOfTheWeekInCase?y.i18n.daysOfTheWeekInCase(b)[k]:x[k];if(S.indexOf("#")>-1){var O=null,P=S.substring(S.indexOf("#")+1),D=S.substring(0,S.indexOf("#"));switch(P){case"1":O=y.i18n.first(D);break;case"2":O=y.i18n.second(D);break;case"3":O=y.i18n.third(D);break;case"4":O=y.i18n.fourth(D);break;case"5":O=y.i18n.fifth(D);break}R=O+" "+R}return R},function(S){return parseInt(S)==1?"":d.StringUtilities.format(y.i18n.commaEveryX0DaysOfTheWeek(S),S)},function(S){var b=S.substring(0,S.indexOf("-")),$=y.expressionParts[3]!="*";return $?y.i18n.commaAndX0ThroughX1(b):y.i18n.commaX0ThroughX1(b)},function(S){var b=null;if(S.indexOf("#")>-1){var $=S.substring(S.indexOf("#")+1),k=S.substring(0,S.indexOf("#"));b=y.i18n.commaOnThe($,k).trim()+y.i18n.spaceX0OfTheMonth()}else if(S.indexOf("L")>-1)b=y.i18n.commaOnTheLastX0OfTheMonth(S.replace("L",""));else{var R=y.expressionParts[3]!="*";b=R?y.i18n.commaAndOnX0():y.i18n.commaOnlyOnX0(S)}return b}),w},g.prototype.getMonthDescription=function(){var y=this,x=this.i18n.monthsOfTheYear(),w=this.getSegmentDescription(this.expressionParts[4],"",function(S,b){return b&&y.i18n.monthsOfTheYearInCase?y.i18n.monthsOfTheYearInCase(b)[parseInt(S)-1]:x[parseInt(S)-1]},function(S){return parseInt(S)==1?"":d.StringUtilities.format(y.i18n.commaEveryX0Months(S),S)},function(S){return y.i18n.commaMonthX0ThroughMonthX1()||y.i18n.commaX0ThroughX1()},function(S){return y.i18n.commaOnlyInMonthX0?y.i18n.commaOnlyInMonthX0():y.i18n.commaOnlyInX0()});return w},g.prototype.getDayOfMonthDescription=function(){var y=this,x=null,w=this.expressionParts[3];switch(w){case"L":x=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":x=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var S=w.match(/(\d{1,2}W)|(W\d{1,2})/);if(S){var b=parseInt(S[0].replace("W","")),$=b==1?this.i18n.firstWeekday():d.StringUtilities.format(this.i18n.weekdayNearestDayX0(),b.toString());x=d.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),$);break}else{var k=w.match(/L-(\d{1,2})/);if(k){var R=k[1];x=d.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(R),R);break}else{if(w=="*"&&this.expressionParts[5]!="*")return"";x=this.getSegmentDescription(w,this.i18n.commaEveryDay(),function(O){return O=="L"?y.i18n.lastDay():y.i18n.dayX0?d.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 x},g.prototype.getYearDescription=function(){var y=this,x=this.getSegmentDescription(this.expressionParts[6],"",function(w){return/^\d+$/.test(w)?new Date(parseInt(w),1).getFullYear().toString():w},function(w){return d.StringUtilities.format(y.i18n.commaEveryX0Years(w),w)},function(w){return y.i18n.commaYearX0ThroughYearX1()||y.i18n.commaX0ThroughX1()},function(w){return y.i18n.commaOnlyInYearX0?y.i18n.commaOnlyInYearX0():y.i18n.commaOnlyInX0()});return x},g.prototype.getSegmentDescription=function(y,x,w,S,b,$){var k=null,R=y.indexOf("/")>-1,O=y.indexOf("-")>-1,P=y.indexOf(",")>-1;if(!y)k="";else if(y==="*")k=x;else if(!R&&!O&&!P)k=d.StringUtilities.format($(y),w(y));else if(P){for(var D=y.split(","),A="",F=0;F<D.length;F++)if(F>0&&D.length>2&&(A+=",",F<D.length-1&&(A+=" ")),F>0&&D.length>1&&(F==D.length-1||D.length==2)&&(A+="".concat(this.i18n.spaceAnd()," ")),D[F].indexOf("/")>-1||D[F].indexOf("-")>-1){var L=D[F].indexOf("-")>-1&&D[F].indexOf("/")==-1,_=this.getSegmentDescription(D[F],x,w,S,L?this.i18n.commaX0ThroughX1:b,$);L&&(_=_.replace(", ","")),A+=_}else R?A+=this.getSegmentDescription(D[F],x,w,S,b,$):A+=w(D[F]);R?k=A:k=d.StringUtilities.format($(y),A)}else if(R){var D=y.split("/");if(k=d.StringUtilities.format(S(D[1]),D[1]),D[0].indexOf("-")>-1){var E=this.generateRangeSegmentDescription(D[0],b,w);E.indexOf(", ")!=0&&(k+=", "),k+=E}else if(D[0].indexOf("*")==-1){var z=d.StringUtilities.format($(D[0]),w(D[0]));z=z.replace(", ",""),k+=d.StringUtilities.format(this.i18n.commaStartingX0(),z)}}else O&&(k=this.generateRangeSegmentDescription(y,b,w));return k},g.prototype.generateRangeSegmentDescription=function(y,x,w){var S="",b=y.split("-"),$=w(b[0],1),k=w(b[1],2),R=x(y);return S+=d.StringUtilities.format(R,$,k),S},g.prototype.formatTime=function(y,x,w){var S=0,b=0,$=parseInt(y)+S,k=parseInt(x)+b;k>=60?(k-=60,$+=1):k<0&&(k+=60,$-=1),$>=24?$=$-24:$<0&&($=24+$);var R="",O=!1;this.options.use24HourTimeFormat||(O=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),R=O?"".concat(this.getPeriod($)," "):" ".concat(this.getPeriod($)),$>12&&($-=12),$===0&&($=12));var P="";return w&&(P=":".concat(("00"+w).substring(w.length))),"".concat(O?R:"").concat(("00"+$.toString()).substring($.toString().length),":").concat(("00"+k.toString()).substring(k.toString().length)).concat(P).concat(O?"":R)},g.prototype.transformVerbosity=function(y,x){if(!x&&(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 w=0,S=Object.entries(this.i18n.conciseVerbosityReplacements());w<S.length;w++){var b=S[w],$=b[0],k=b[1];y=y.replace(new RegExp($,"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=m}),747:((i,s,l)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.enLocaleLoader=void 0;var d=l(486),u=(function(){function m(){}return m.prototype.load=function(g){g.en=new d.en},m})();s.enLocaleLoader=u}),486:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.en=void 0;var l=(function(){function d(){}return d.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},d.prototype.atX0MinutesPastTheHourGt20=function(){return null},d.prototype.commaMonthX0ThroughMonthX1=function(){return null},d.prototype.commaYearX0ThroughYearX1=function(){return null},d.prototype.use24HourTimeFormatByDefault=function(){return!1},d.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},d.prototype.everyMinute=function(){return"every minute"},d.prototype.everyHour=function(){return"every hour"},d.prototype.atSpace=function(){return"At "},d.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},d.prototype.at=function(){return"At"},d.prototype.spaceAnd=function(){return" and"},d.prototype.everySecond=function(){return"every second"},d.prototype.everyX0Seconds=function(){return"every %s seconds"},d.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},d.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},d.prototype.everyX0Minutes=function(){return"every %s minutes"},d.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},d.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},d.prototype.everyX0Hours=function(){return"every %s hours"},d.prototype.betweenX0AndX1=function(){return"between %s and %s"},d.prototype.atX0=function(){return"at %s"},d.prototype.commaEveryDay=function(){return", every day"},d.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},d.prototype.commaX0ThroughX1=function(){return", %s through %s"},d.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},d.prototype.first=function(){return"first"},d.prototype.second=function(){return"second"},d.prototype.third=function(){return"third"},d.prototype.fourth=function(){return"fourth"},d.prototype.fifth=function(){return"fifth"},d.prototype.commaOnThe=function(){return", on the "},d.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},d.prototype.lastDay=function(){return"the last day"},d.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},d.prototype.commaOnlyOnX0=function(){return", only on %s"},d.prototype.commaAndOnX0=function(){return", and on %s"},d.prototype.commaEveryX0Months=function(){return", every %s months"},d.prototype.commaOnlyInX0=function(){return", only in %s"},d.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},d.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},d.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},d.prototype.firstWeekday=function(){return"first weekday"},d.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},d.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},d.prototype.commaEveryX0Days=function(){return", every %s days"},d.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},d.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},d.prototype.commaEveryHour=function(){return", every hour"},d.prototype.commaEveryX0Years=function(){return", every %s years"},d.prototype.commaStartingX0=function(){return", starting %s"},d.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},d.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},d.prototype.atReboot=function(){return"Run once, at startup"},d})();s.en=l}),515:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0});function l(u,m){if(!u)throw new Error(m)}var d=(function(){function u(){}return u.secondRange=function(m){for(var g=m.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var x=parseInt(g[y],10);l(x>=0&&x<=59,"seconds part must be >= 0 and <= 59")}},u.minuteRange=function(m){for(var g=m.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var x=parseInt(g[y],10);l(x>=0&&x<=59,"minutes part must be >= 0 and <= 59")}},u.hourRange=function(m){for(var g=m.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var x=parseInt(g[y],10);l(x>=0&&x<=23,"hours part must be >= 0 and <= 23")}},u.dayOfMonthRange=function(m){for(var g=m.split(","),y=0;y<g.length;y++)if(!isNaN(parseInt(g[y],10))){var x=parseInt(g[y],10);l(x>=1&&x<=31,"DOM part must be >= 1 and <= 31")}},u.monthRange=function(m,g){for(var y=m.split(","),x=0;x<y.length;x++)if(!isNaN(parseInt(y[x],10))){var w=parseInt(y[x],10);l(w>=1&&w<=12,g?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},u.dayOfWeekRange=function(m,g){for(var y=m.split(","),x=0;x<y.length;x++)if(!isNaN(parseInt(y[x],10))){var w=parseInt(y[x],10);l(w>=0&&w<=6,g?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},u})();s.default=d}),823:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.StringUtilities=void 0;var l=(function(){function d(){}return d.format=function(u){for(var m=[],g=1;g<arguments.length;g++)m[g-1]=arguments[g];return u.replace(/%s/g,function(y){return m.shift()})},d.containsAny=function(u,m){return m.some(function(g){return u.indexOf(g)>-1})},d})();s.StringUtilities=l})},r={};function o(i){var s=r[i];if(s!==void 0)return s.exports;var l=r[i]={exports:{}};return n[i](l,l.exports,o),l.exports}var a={};return(()=>{var i=a;Object.defineProperty(i,"__esModule",{value:!0}),i.toString=void 0;var s=o(333),l=o(747);s.ExpressionDescriptor.initialize(new l.enLocaleLoader),i.default=s.ExpressionDescriptor;var d=s.ExpressionDescriptor.toString;i.toString=d})(),a})())})(jI)),jI.exports}var zwe=Lwe();const Fwe=yc(zwe),_we=new Set(["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC","SUN","MON","TUE","WED","THU","FRI","SAT"]);function Bwe(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)&&!_we.has(n.toUpperCase()))return!1}return!0}function i2(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(!Bwe(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=Fwe.toString(t,{use24HourTimeFormat:!0,verbose:!1}),r=Iwe.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 c6(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 Uwe({onSubmit:e,isSubmitting:t,disabled:n,disabledReason:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(!1),l=()=>a(!1),d=async()=>{try{await e({forceRefresh:i}),a(!1)}catch{}},u=p.jsx("span",{children:p.jsx(Qy,{label:"Materialization",onClick:()=>a(!0),disabled:n})});return p.jsxs(p.Fragment,{children:[n&&r?p.jsx(Br,{title:r,children:u}):u,p.jsx(Oo,{open:o,onClose:l,title:"New materialization",description:"Compile the package, build a table for every persist source, and load them so queries serve from the tables.",actions:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{onClick:l,children:"Cancel"}),p.jsx(Hn,{variant:"contained",loading:t,onClick:d,children:"Materialize"})]}),children:p.jsx(sX,{children:p.jsx(RE,{control:p.jsx(bz,{checked:i,onChange:m=>s(m.target.checked)}),label:"Force refresh (rebuild even if unchanged)"})})})]})}function v0({children:e}){return p.jsx(wt,{variant:"caption",component:"h6",sx:{display:"block",textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:"text.secondary",mb:1},children:e})}function nx(e){return e===ba.Pending||e===ba.ManifestRowsReady}function Vwe(e){return e===ba.ManifestFileReady||e===ba.Failed||e===ba.Cancelled}function qwe(e){switch(e){case ba.ManifestFileReady:return"Done";case ba.Failed:return"Failed";case ba.Cancelled:return"Cancelled";case ba.Pending:case ba.ManifestRowsReady:return"Pending";default:return"Unknown"}}function Hwe(e){switch(e){case ba.ManifestRowsReady:return"info";case ba.ManifestFileReady:return"success";case ba.Failed:return"error";case ba.Cancelled:return"warning";case ba.Pending:default:return"default"}}function u6(e){return e.status===ba.ManifestFileReady&&F1(e).autoLoad==="failed"}function d6(e){return u6(e)?"Built, not served":qwe(e.status)}function k$(e){return u6(e)?"warning":Hwe(e.status)}function Wwe(e){const t=Object.values(F1(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 f6(e,t){const n=[`${e.sourcesBuilt??0} built`,`${e.sourcesReused??0} reused`];return e.sourcesRefused&&n.push(`${e.sourcesRefused} refused`),n.join(t)}function F1(e){return e.metadata??{}}function p6(e){return e.trigger==="scheduler"||e.trigger==="SCHEDULER"}function Ywe(e){return p6(e)?"Scheduled":"Manual"}function h6(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 l=Math.floor(i/60),d=i%60;return`${l}h ${d}m`}function $$(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 Gwe(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 Kwe({entries:e,builtAt:t}){const n=Object.entries(e??{});return p.jsxs(Ee,{children:[p.jsxs(Wn,{direction:"row",alignItems:"baseline",justifyContent:"space-between",children:[p.jsx(v0,{children:"Build manifest"}),t&&p.jsxs(wt,{variant:"caption",color:"text.secondary",children:["Built ",$$(t)]})]}),n.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"No materialized tables yet."}):p.jsxs(Ux,{size:"small",children:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(ur,{children:"Source"}),p.jsx(ur,{children:"Table name"}),p.jsx(ur,{children:"Connection"}),p.jsx(ur,{children:"Realization"}),p.jsx(ur,{align:"right",children:"Rows"})]})}),p.jsx(qx,{children:n.map(([r,o])=>p.jsxs(vu,{children:[p.jsx(ur,{sx:{fontFamily:Fo},children:o.sourceName??r}),p.jsx(ur,{sx:{fontFamily:Fo},children:o.physicalTableName??"-"}),p.jsx(ur,{sx:{fontFamily:Fo},children:o.connectionName??"-"}),p.jsx(ur,{children:o.realization??"-"}),p.jsx(ur,{align:"right",children:o.rowCount??"-"})]},r))})]})]})}function m6({meta:e}){const t=p6(e);return p.jsx(Br,{title:t?"Fired by the materialization schedule":"Triggered manually",children:p.jsx(wt,{variant:"body2",color:"text.secondary",children:Ywe(e)})})}function Qwe({materialization:e,buildPlan:t,onClose:n}){const r=e?F1(e):{},o=e?Wwe(e):[],a=t.status==="ready"?Object.values(t.plan?.sources??{}):[];return p.jsx(Fx,{open:e!==null,onClose:n,maxWidth:"md",fullWidth:!0,"aria-labelledby":"materialization-detail-title",children:e&&p.jsxs(p.Fragment,{children:[p.jsxs(Bx,{sx:{pr:6,pb:1.5},id:"materialization-detail-title",children:[p.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1,sx:{mb:.75},children:[p.jsx($E,{size:"small",label:d6(e),color:k$(e),variant:nx(e.status)?"filled":"outlined"}),p.jsx(m6,{meta:r})]}),p.jsx(wt,{variant:"subtitle1",sx:{fontWeight:600},children:e.packageName??"Materialization"}),p.jsx(wt,{variant:"caption",color:"text.secondary",sx:{fontFamily:Fo,wordBreak:"break-all"},children:e.id}),p.jsx(no,{"aria-label":"close",onClick:n,sx:{position:"absolute",right:8,top:8},children:p.jsx(bh,{fontSize:"small"})})]}),p.jsxs(_x,{dividers:!0,children:[p.jsxs(Ee,{sx:{bgcolor:"action.hover",borderRadius:2,p:2,mb:3,display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:2},children:[p.jsx(pg,{label:"Started",value:$$(e.startedAt??e.createdAt)}),p.jsx(pg,{label:"Completed",value:$$(e.completedAt)}),p.jsx(pg,{label:"Duration",value:h6(e.startedAt,e.completedAt)}),p.jsx(pg,{label:"Sources",value:f6(r," · ")}),p.jsx(pg,{label:"Force refresh",value:r.forceRefresh?"Yes":"No"})]}),e.error&&p.jsxs(Ee,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"error.main"},children:[p.jsx(v0,{children:p.jsx(Ee,{component:"span",sx:{color:"error.main"},children:"Error"})}),p.jsx(wt,{variant:"body2",sx:{fontFamily:Fo,whiteSpace:"pre-wrap"},children:e.error})]}),o.length>0&&p.jsxs(Ee,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"warning.main"},children:[p.jsx(v0,{children:p.jsx(Ee,{component:"span",sx:{color:"warning.main"},children:"Refused sources"})}),p.jsx(wt,{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=>p.jsxs(Ee,{sx:{mt:1},children:[p.jsx(wt,{variant:"body2",sx:{fontFamily:Fo},children:i.name}),p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-wrap"},children:i.message})]},i.name))]}),p.jsxs(Ee,{sx:{mb:3},children:[p.jsx(v0,{children:"Build plan"}),t.status==="loading"?p.jsx(Go,{text:qd.loading,size:16,centered:!1}):t.status==="unavailable"?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"The build plan is unavailable."}):a.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"This package has no persist sources."}):p.jsxs(Ux,{size:"small",children:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(ur,{children:"Source"}),p.jsx(ur,{children:"Connection"}),p.jsx(ur,{children:"Dialect"}),p.jsx(ur,{align:"right",children:"Columns"}),p.jsx(ur,{children:"Source Entity ID"})]})}),p.jsx(qx,{children:a.map(i=>p.jsxs(vu,{children:[p.jsx(ur,{sx:{fontFamily:Fo},children:i.name}),p.jsx(ur,{sx:{fontFamily:Fo},children:i.connectionName}),p.jsx(ur,{children:i.dialect??"-"}),p.jsx(ur,{align:"right",children:i.columns?.length??0}),p.jsx(ur,{sx:{fontFamily:Fo,fontSize:"0.75rem",wordBreak:"break-all",maxWidth:220},children:i.sourceEntityId})]},i.sourceID))})]})]}),p.jsx(Kwe,{entries:e.manifest?.entries,builtAt:e.manifest?.builtAt})]})]})})}function pg({label:e,value:t}){return p.jsxs(Ee,{children:[p.jsx(wt,{variant:"caption",color:"text.secondary",display:"block",children:e}),p.jsx(wt,{variant:"body2",children:t})]})}const Xwe=rn(p.jsx("path",{d:"M6 6h12v12H6z"}));function Zwe({materialization:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),i=()=>a(!0),s=()=>{a(!1),t()};return p.jsxs(Cn.Fragment,{children:[p.jsxs(qo,{"aria-label":`Delete materialization ${e?.id??""}`.trim(),onClick:l=>{l.stopPropagation(),i()},sx:{color:"error.main"},children:[p.jsx(n2,{sx:{color:"inherit"},children:p.jsx(Jx,{fontSize:"small"})}),p.jsx(r2,{children:"Delete"})]}),p.jsx(Oo,{open:o,onClose:s,title:"Delete materialization",actions:p.jsxs(p.Fragment,{children:[p.jsx(So,{onClick:s,children:"Cancel"}),p.jsx(So,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>r(),loading:n,children:"Delete run"})]}),children:p.jsx(Ar,{variant:"body2",children:"Delete this run's record? This cannot be undone. The tables it built stay in place: drop any you no longer need through their connection."})})]})}function Jwe({materializations:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){return e.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{py:1,fontStyle:"italic"},children:"No materializations yet."}):p.jsxs(Ux,{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:[p.jsx(Hx,{children:p.jsxs(vu,{children:[p.jsx(ur,{children:"Status"}),p.jsx(ur,{children:"Trigger"}),p.jsx(ur,{children:"Started"}),p.jsx(ur,{children:"Duration"}),p.jsx(ur,{children:"Sources"}),p.jsx(ur,{align:"right",children:"Actions"})]})}),p.jsx(qx,{children:e.map(i=>p.jsx(eSe,{materialization:i,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a},i.id))})]})}function eSe({materialization:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){const[i,s]=C.useState(null),l=!!i,d=()=>s(null),u=F1(e),m=u.sourcesBuilt!==void 0||u.sourcesReused!==void 0?f6(u,", "):"-",g=nx(e.status),y=Vwe(e.status),x=e.error??void 0,w=t&&(g||y);return p.jsxs(vu,{hover:!0,sx:{cursor:"pointer","&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"-2px"}},onClick:()=>a(e),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),a(e))},role:"button",tabIndex:0,"aria-label":`View materialization ${e.id??""} details`.trim(),children:[p.jsx(ur,{children:p.jsxs(Ee,{sx:{display:"flex",alignItems:"center",gap:.5},children:[p.jsx(wt,{variant:"body2",sx:{fontWeight:500,color:k$(e)==="default"?"text.primary":`${k$(e)}.main`},children:d6(e)}),x&&p.jsx(Br,{title:x,children:p.jsx(y_,{fontSize:"small",color:"error"})})]})}),p.jsx(ur,{children:p.jsx(m6,{meta:u})}),p.jsx(ur,{children:Gwe(e.startedAt??e.createdAt)}),p.jsx(ur,{children:h6(e.startedAt,e.completedAt)}),p.jsx(ur,{children:m}),p.jsx(ur,{align:"right",onClick:S=>S.stopPropagation(),children:w&&p.jsxs(p.Fragment,{children:[p.jsx(no,{size:"small","aria-label":`Materialization actions for ${e.id??""}`.trim(),onClick:S=>s(S.currentTarget),children:p.jsx(e1,{fontSize:"small"})}),p.jsxs(dc,{anchorEl:i,open:l,onClose:d,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[t&&g&&p.jsxs(ea,{"aria-label":`Stop materialization ${e.id??""}`.trim(),disabled:n,onClick:()=>{d(),r(e)},children:[p.jsx(ml,{children:p.jsx(Xwe,{fontSize:"small"})}),p.jsx(xi,{children:"Stop"})]}),t&&y&&p.jsx(Zwe,{materialization:e,isMutating:n,onCloseDialog:d,onDelete:()=>o(e)})]})]})})]})}const tSe=rn(p.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"})),nSe={package:"Materialized artifacts are shared across versions",version:"Materialized artifacts are per published version"};function rSe({scope:e,disabled:t,disabledReason:n,isSubmitting:r,onChange:o}){const[a,i]=C.useState(null),s=async l=>{i(null),l!==e&&await o(l).catch(()=>{})};return p.jsxs(p.Fragment,{children:[p.jsx(Xy,{label:"Scope",icon:p.jsx(tSe,{}),onClick:l=>i(l.currentTarget),disabled:t||r,...n?{disabledReason:n}:{},ariaHasPopup:"menu",ariaLabel:`Scope: ${e}`}),p.jsx(dc,{anchorEl:a,open:!!a,onClose:()=>i(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:["package","version"].map(l=>p.jsxs(ea,{selected:l===e,onClick:()=>void s(l),children:[p.jsx(ml,{sx:{minWidth:32},children:l===e&&p.jsx(cF,{fontSize:"small"})}),p.jsx(xi,{primary:l,secondary:nSe[l]})]},l))})]})}const oSe=rn([p.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"),p.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")]),DI="0 6 * * *";function aSe({currentSchedule:e,isSubmitting:t,disabled:n,disabledReason:r,onSubmit:o}){const[a,i]=C.useState(!1),[s,l]=C.useState(e??DI),d=()=>{l(e??DI),i(!0)},u=()=>i(!1),m=i2(s),g=async y=>{try{await o(y),i(!1)}catch{}};return p.jsxs(p.Fragment,{children:[p.jsx(Xy,{label:"Schedule",icon:p.jsx(oSe,{}),onClick:d,disabled:n,...r?{disabledReason:r}:{},ariaHasPopup:"dialog",ariaLabel:e?"Edit schedule":"Set schedule"}),p.jsxs(Oo,{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:p.jsxs(p.Fragment,{children:[e&&p.jsx(Hn,{color:"error",loading:t,onClick:()=>g(null),sx:{mr:"auto"},children:"Clear schedule"}),p.jsx(Hn,{onClick:u,children:"Cancel"}),p.jsx(Hn,{variant:"contained",loading:t,disabled:!m.valid,onClick:()=>g(s.trim()),children:"Save schedule"})]}),children:[p.jsx(ki,{autoFocus:!0,fullWidth:!0,size:"small",label:"Cron expression",value:s,onChange:y=>l(y.target.value),error:s.trim()!==""&&!m.valid,helperText:m.valid?`${m.description} · next run ${c6(m.nextRun)}`:m.error,slotProps:{htmlInput:{style:{fontFamily:Fo}}}}),p.jsxs(xo,{severity:"info",children:["A schedule runs only on version-scoped packages, so saving one sets ",p.jsx("code",{children:"scope: version"})," for this package."]})]})]})}const iSe=3e3;function sSe({resourceUri:e,versioned:t=!1}){const{apiClients:n,mutable:r}=er(),o=Tl(),{environmentName:a,packageName:i,versionId:s}=ko(e),[l,d]=C.useState(""),[u,m]=C.useState(null);if(!i)throw new Error("Materializations requires a package in the resource URI");const g=wo({queryKey:["materializations",a,i,s],queryFn:()=>n.materializations.listMaterializations(a,i,void 0,void 0,s),refetchInterval:q=>(q.state.data?.data??[]).some(Y=>nx(Y.status))?iSe:!1}),y=wo({queryKey:["package",a,i,s],queryFn:()=>n.packages.getPackage(a,i,s)}),x=wo({queryKey:["package-build-plan",a,i,s],queryFn:async({signal:q})=>{try{return{inline:!1,plan:(await n.packages.getPackageBuildPlan(a,i,s,{signal:q})).data}}catch(Y){if(Y?.response?.status===404)return{inline:!0,plan:null};throw Y}},enabled:u!==null}),w=()=>o.invalidateQueries({queryKey:["materializations",a,i]}),S=hl({mutationFn:oc("materialization","create",q=>n.materializations.createMaterialization(a,i,{forceRefresh:q.forceRefresh,...s!==void 0?{versionId:s}:{}})),onSuccess(){d("Materialization requested"),w()},onError(q){d(q.message),w()}}),b=hl({mutationFn:oc("materialization","update",q=>n.materializations.materializationAction(a,i,q.id,gre.Stop,s)),onSuccess(){d("Materialization stopped"),w()},onError(q){d(q.message)}}),$=hl({mutationFn:oc("materialization","delete",q=>n.materializations.deleteMaterialization(a,i,q.id,s)),onSuccess(){d("Materialization deleted"),w()},onError(q){d(q.message)}}),k=y.data?.data,R=hl({mutationFn:oc("schedule","update",q=>n.packages.updatePackage(a,i,{name:i,description:k?.description,...q?{scope:Cb.Version}:{},materialization:{schedule:q}})),onSuccess(q,Y){d(Y?"Schedule updated":"Schedule cleared"),o.invalidateQueries({queryKey:["package",a,i]})},onError(q){d(q.message)}}),O=hl({mutationFn:oc("scope","update",q=>n.packages.updatePackage(a,i,{name:i,description:k?.description,scope:q})),onSuccess(){d("Scope updated"),o.invalidateQueries({queryKey:["package",a,i]})},onError(q){d(q.message)}}),P=g.data?.data??[],D=P.find(q=>q.id===u)??null,A=P.some(q=>nx(q.status)),F=S.isPending||b.isPending||$.isPending,L=x.isError?{status:"unavailable"}:x.isSuccess?x.data.inline?y.isSuccess?{status:"ready",plan:k?.buildPlan??null}:y.isError?{status:"unavailable"}:{status:"loading"}:{status:"ready",plan:x.data.plan}:{status:"loading"},_=k?.materialization?.schedule??null,E=k?.scope===Cb.Version?"version":"package",z=!!k?.manifestLocation,I=!!k?.materialization?.freshness,U=_?i2(_):null,N=z?"Control-plane managed: refresh is driven by the control plane, not the built-in scheduler.":[U?U.valid?`${U.description} (${_}), next run ${c6(U.nextRun)}`:`Unrecognized cron expression (${_})`:I?"Refreshed by a freshness policy; a cron schedule does not apply":"On demand only, no schedule set",`scope: ${E}`].join(" · ");return p.jsxs(p.Fragment,{children:[p.jsxs(Ds,{title:"Materializations",count:g.isSuccess?P.length:void 0,action:r&&p.jsxs(Wn,{direction:"row",spacing:1,alignItems:"center",children:[!z&&!t&&p.jsx(rSe,{scope:E,disabled:!!_,disabledReason:"A schedule requires version scope. Clear the schedule to change it.",isSubmitting:O.isPending,onChange:q=>O.mutateAsync(q==="version"?Cb.Version:Cb.Package)}),!z&&!t&&p.jsx(aSe,{currentSchedule:_,isSubmitting:R.isPending,disabled:I,disabledReason:"This package declares a freshness policy; a schedule and freshness are mutually exclusive.",onSubmit:q=>R.mutateAsync(q)}),p.jsx(Uwe,{onSubmit:q=>S.mutateAsync(q),isSubmitting:S.isPending,disabled:A,disabledReason:"A materialization is already pending or running for this package."})]}),children:[y.isSuccess&&p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:N}),g.isError&&p.jsx(Xa,{error:g.error,context:`${a} > ${i} > Materializations`}),!g.isSuccess&&!g.isError&&p.jsx(Go,{text:"Loading materializations..."}),g.isSuccess&&p.jsx(Jwe,{materializations:P,mutable:r,isMutating:F,onStop:q=>b.mutate(q),onDelete:q=>$.mutate(q),onViewDetails:q=>m(q.id??null)})]}),p.jsx(Qwe,{materialization:D,buildPlan:L,onClose:()=>m(null)}),p.jsx(ph,{open:l!=="",autoHideDuration:6e3,onClose:()=>d(""),message:l})]})}const s2=rn(p.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"}));function ah(e){return g6(e).join(`
482
482
  `).trim()||void 0}function g6(e){if(!e)return[];const t=[];for(const n of e){const r=n.value?.trim();if(r){if(r.startsWith('#"'))t.push(r.slice(2).trim());else if(r.startsWith("#(doc)")){let o=r.slice(6).trim();o.length>=2&&o.startsWith('"')&&o.endsWith('"')&&(o=o.slice(1,-1)),t.push(o)}}}return t.filter(n=>n.trim()!=="")}function NI(e){const t=(e??[]).map(n=>({...n,value:n.value?.trim()??""})).filter(n=>n.value.startsWith('##"')||n.value.startsWith("##(doc)")).map(n=>({...n,value:n.value.slice(1)}));return ah(t)}function lSe(e,t){const n=e.docParts??[],r=t?.docParts??[];return(r.length>0&&r.length<n.length&&r.every((o,a)=>o===n[a])?n.slice(r.length):n).join(`
483
483
  `).trim()||void 0}function l2(e){if(!e)return[];const t=[];for(const n of e){const r=n.value?.trim();if(!r||r.startsWith('#"')||r.startsWith("#(doc)"))continue;const o=r.replace(/^#+@?\s*/,"").trim();o&&!o.startsWith("(")&&t.push(o)}return t}function cSe(e){const t=new Set;for(const n of e){const{tag:r,log:o}=t1.parseAnnotation([`# ${n}`]);if(o.length>0){const a=/^[A-Za-z_][\w.]*/.exec(n.trim())?.[0];a&&!/^\s*[\w.]+\s*=/.test(n)&&t.add(a);continue}for(const[a,i]of r.entries())i.deleted||(i.eq===void 0?t.add(a):a==="viz"&&typeof i.eq=="string"&&t.add(i.eq))}return[...t]}function uSe(e){return y6(e,"persist")}function dSe(e){return y6(e,"preaggregate")}function y6(e,t){const n=new RegExp(`^#@?\\s*${t}\\b`);return(e??[]).some(r=>n.test(r.value?.trim()??""))}function c2(e){const t=hSe(e);if(!e||!t)return t;switch(e.kind){case"number_type":return e.subtype?`${t} · ${e.subtype}`:t;case"date_type":case"timestamp_type":case"timestamptz_type":return e.timeframe?`${t} · ${e.timeframe}`:t;case"sql_native_type":return e.sql_type?`sql native · ${e.sql_type}`:"sql native";case"array_type":return`array<${c2(e.element_type)??"unknown"}>`;case"record_type":{const n=e.fields.length;return`record · ${n} ${n===1?"field":"fields"}`}default:return t}}function fSe(e){if(e?.kind==="record_type")return e.fields.map(t=>`${t.name} ${c2(t.type)??""}`.trim()).join(`
@@ -490,7 +490,7 @@ ${t}`}function Cce(e){return e?.status===403}function Xp(e){return`\`${e.replace
490
490
  `)){const i=r===0?/^source\s*:\s*`?([A-Za-z_]\w*)`?\s+is\b/.exec(a):null;i?(o(),n={name:i[1],lines:[a]}):r===0&&ISe.test(a)?o():n&&n.lines.push(a);for(const s of a)s==="{"?r+=1:s==="}"&&(r=Math.max(0,r-1))}return o(),t}function zSe(e,t,n){const r=[];let o=!1;const a=l=>{l===null||l===t||(l!==void 0&&n.has(l)?r.push(l):o=!0)},i=new RegExp(`source\\s*:\\s*\`?${nf(t)}\`?\\s+is\\s+`).exec(e);i&&a(T$(e.slice(i.index+i[0].length)));const s=/join_\w+\s*:\s*`?([A-Za-z_]\w*)`?(\s+is\s+)?/g;for(let l=s.exec(e);l;l=s.exec(e))a(l[2]?T$(e.slice(l.index+l[0].length)):l[1]);return{sources:r,unresolved:o}}function T$(e){const t=/^`?([A-Za-z_]\w*)`?/.exec(e);if(!t)return;const n=e.slice(t[0].length).trimStart();if(n.startsWith("."))return null;if(!n.startsWith("("))return t[1]}const Ey={"&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"-2px"}},C6=C.createContext(void 0);function f2({layer:e,title:t,children:n,testId:r}){const o=C.useContext(C6);if(!o||!e||!o.layers.includes(e))return p.jsx(Br,{title:t,children:p.jsx(Ee,{component:"span",tabIndex:0,role:"img","aria-label":t,"data-testid":r,sx:{display:"inline-flex",borderRadius:1,...Ey},children:n})});const a=o.openLayer===e;return p.jsx(Br,{title:t,children:p.jsx(Ee,{component:"button",type:"button",onClick:()=>o.toggle(e),"aria-expanded":a,"aria-controls":o.cardId,"aria-label":`${t} ${a?"Hide":"Show"} details.`,"data-testid":r,"data-header-chip":e,sx:{appearance:"none",border:"none",background:"none",font:"inherit",p:0,cursor:"pointer",display:"inline-flex",alignItems:"center",borderRadius:1,"& [data-pill-tone]":{transition:"filter 120ms ease",...a?{filter:"brightness(0.9)"}:{}},"&:hover [data-pill-tone]":{filter:a?"brightness(0.9)":"brightness(0.94)"},...Ey},children:n})})}function FSe(e){try{const{data:t}=JSON.parse(e);return t?.kind==="array_cell"?t.array_value.length:t?.kind==="record_cell"?1:0}catch{return}}const _Se={authorize:[],accessFilter:[]};function II(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim()!==""):[]}function BSe(e){const t=new Map,n=e?.sources;if(!Array.isArray(n))return t;for(const r of n){if(!r||typeof r!="object")continue;const o=r;if(typeof o.name!="string"||!o.name)continue;const a=II(o.authorize),i=II(o.accessFilter);a.length===0&&i.length===0||t.set(o.name,{authorize:a,accessFilter:i})}return t}function b0(e,t){return t&&e?.get(t)||_Se}function gc(e){return!!e&&e.authorize.some(t=>t.trim()!=="true")}function Tu(e){return!!e&&e.accessFilter.length>0}const LI=/^\(?\s*(?:'([^']*)'|"([^"]*)")\s+in\s+\$GROUPS\s*\)?$/;function USe(e){const t=e.trim();if(t==="false")return"no one";const n=LI.exec(t);if(n)return`members of ${n[1]??n[2]}`;for(const r of["or","and"]){const o=t.split(new RegExp(`\\s+${r}\\s+`));if(o.length<2)continue;const a=o.map(i=>LI.exec(i.trim()));if(a.every(i=>i)){const i=a.map(s=>s[1]??s[2]);return r==="or"?`members of ${i.slice(0,-1).join(", ")} or ${i[i.length-1]}`:`members of all of ${i.join(", ")}`}}}function k6(e){const t=e.authorize.filter(n=>n.trim()!=="true").map(n=>USe(n)??"readers its access rule admits");return Array.from(new Set(t)).join(", and ")}const $6="Only some readers can query this source",E6="Each reader sees only the rows they're allowed to see";function VSe(e,t){return e?gc(t)?`You can't access ${e}. It is restricted to ${k6(t)}; ask an administrator of this package for access.`:`You can't access ${e}. Ask an administrator of this package for access.`:"You don't have access to run this. Ask an administrator of this package for access."}function qSe(e,t){if(!(!Tu(e)||t===void 0))return FSe(t)===0?"Filtered to your rows: this source shows each reader only the rows they're allowed to see.":void 0}function R6(e){return gc(e)||Tu(e)}function HSe(e,t){return`This join doesn't apply the ${gc(t)&&Tu(t)?"access rule and row filter":gc(t)?"access rule":"row filter"} on ${e}: its rows are read under this source's rules.`}function WSe({access:e}){return p.jsxs(p.Fragment,{children:[gc(e)&&p.jsx(zI,{label:"Restricted",meaning:$6}),Tu(e)&&p.jsx(zI,{label:"Row filtered",meaning:E6})]})}function zI({label:e,meaning:t}){return p.jsx(f2,{layer:"access",title:`${e}: ${t}`,testId:`source-access-chip-${e==="Restricted"?"restricted":"row-filtered"}`,children:p.jsx(cs,{tone:"neutral",size:"header",children:e})})}function T6({access:e}){return p.jsxs(p.Fragment,{children:[gc(e)&&p.jsx(Br,{title:`Restricted: ${$6}`,children:p.jsx(cs,{voice:"token",tone:"neutral",sx:{alignSelf:"center"},children:"Restricted"})}),Tu(e)&&p.jsx(Br,{title:`Row filtered: ${E6}`,children:p.jsx(cs,{voice:"token",tone:"neutral",sx:{alignSelf:"center"},children:"Row filtered"})})]})}function YSe(e){return[gc(e)&&"restricted",Tu(e)&&"row filtered"].filter(Boolean).map(t=>`, ${t}`).join("")}function GSe({access:e,showRules:t}){const n=gc(e),r=Tu(e);return!n&&!r?null:p.jsxs(Ee,{"data-testid":"source-access-facts",sx:{display:"grid",gridTemplateColumns:"max-content 1fr",columnGap:"16px",rowGap:"6px",alignItems:"baseline"},children:[n&&p.jsx(ac,{label:"Restricted to",value:k6(e)}),n&&t&&e.authorize.filter(o=>o.trim()!=="true").map((o,a)=>p.jsx(ac,{label:"Access rule",value:o,mono:!0},`a${a}`)),r&&p.jsx(ac,{label:"Rows",value:"Rows are filtered for each reader"}),r&&t&&e.accessFilter.map((o,a)=>p.jsx(ac,{label:"Row filter",value:o,mono:!0},`f${a}`))]})}const FI="Private",KSe="index.malloy doesn't export this file, so only people who can edit the package see it.";function _I(){return p.jsx(f2,{title:`${FI}: ${KSe}`,testId:"model-viewer-off-surface",children:p.jsx(cs,{tone:"warning",size:"header",children:FI})})}const BI="Public",QSe="index.malloy exports this source, so everyone who can read the package can query it.";function XSe(){return p.jsx(f2,{title:`${BI}: ${QSe}`,testId:"model-viewer-public-surface",children:p.jsx(cs,{tone:"positive",size:"header",children:BI})})}function ZSe(e){const t=C.useRef(e);return e!==void 0&&(t.current=e),t.current}function MC({title:e,titleAdornments:t,kindLabel:n,meta:r,doc:o,provenance:a,actions:i,status:s,headingLevel:l="h1",modelDoc:d,access:u,showRules:m=!1,isSource:g=!0,offSurface:y,publicSurface:x=!1}){const w=gc(u)||Tu(u),S=w?["access"]:[],[b,$]=C.useState(void 0),k=b!==void 0&&S.includes(b)?b:void 0,R=ZSe(k),O=C.useId(),P={openLayer:k,layers:S,toggle:L=>$(_=>_===L?void 0:L),cardId:O},D=w||y||x||!!s,A=Hr().theme.ui.type.pageTitle,F=typeof A.fontSize=="number"?`${A.fontSize}px`:A.fontSize;return p.jsxs(Ee,{children:[p.jsxs(Ee,{"data-testid":"model-viewer-source-heading",sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1.5,pt:R$,pb:.5},children:[p.jsx(Ee,{component:l,sx:{m:0,fontSize:l==="h1"?F:`calc(${F} * 0.8)`,fontWeight:A.fontWeight??600,lineHeight:1.25,color:"text.primary",fontFamily:ts,minWidth:0,overflowWrap:"anywhere"},children:e}),t,i&&p.jsx(Ee,{sx:{ml:"auto",display:"flex",alignItems:"center",gap:1},children:i})]}),!g&&y&&p.jsx(Ee,{sx:{display:"flex",alignItems:"center",pt:.5,pb:1},children:p.jsx(_I,{})}),g&&D&&p.jsx(C6.Provider,{value:P,children:p.jsxs(Ee,{"data-testid":"model-viewer-status-row",sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1.5,pt:.5,pb:1},children:[p.jsx(WSe,{access:u}),y&&p.jsx(_I,{}),x&&p.jsx(XSe,{}),s]})}),d&&p.jsx(UI,{doc:d,label:"model description",testId:"model-viewer-model-doc"},`model:${d}`),o&&p.jsx(UI,{doc:o},o),(n!==void 0||r!==void 0||a)&&p.jsxs(Ee,{"data-testid":"model-viewer-source-meta",sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0,pb:2,fontSize:Ka.body,color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[n!==void 0&&p.jsx(Ee,{component:"span","data-testid":"model-viewer-source-kind",children:n}),n!==void 0&&(r!==void 0||a)&&p.jsx(Ee,{component:"span","aria-hidden":!0,children:"·"}),r!==void 0&&p.jsx(Ee,{component:"span",children:r}),r!==void 0&&a&&p.jsx(Ee,{component:"span","aria-hidden":!0,children:"·"}),a&&p.jsx(Ee,{component:"span",sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:a})]}),p.jsx(Bp,{in:k!==void 0,timeout:"auto",unmountOnExit:!0,children:p.jsx(Ee,{id:O,"data-testid":"model-viewer-source-detail","data-layer":R??void 0,sx:{...kh,p:$y,mb:2},children:R==="access"&&u&&p.jsx(GSe,{access:u,showRules:m})})})]})}const JSe=2;function UI({doc:e,label:t="description",testId:n="model-viewer-source-doc"}){const[r,o]=C.useState(!1),[a,i]=C.useState(!1),s=C.useRef(null);return C.useEffect(()=>{const l=s.current;if(!l||r)return;const d=()=>i(l.scrollHeight>l.clientHeight+1);if(d(),typeof ResizeObserver>"u")return;const u=new ResizeObserver(d);return u.observe(l),()=>u.disconnect()},[r,e]),p.jsxs(Ee,{"data-testid":n,sx:{pb:.5},children:[p.jsx(Ee,{ref:s,sx:{fontSize:Ka.body,lineHeight:1.5,color:"text.secondary",whiteSpace:"pre-line",...r?{}:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:JSe,overflow:"hidden"}},children:M6(e)}),(a||r)&&p.jsx(Ee,{component:"button",type:"button",onClick:()=>o(!r),"aria-expanded":r,"aria-label":r?`Show less of the ${t}`:`Show the full ${t}`,sx:{all:"unset",cursor:"pointer",fontSize:Ka.small,color:"text.secondary",textDecoration:"underline","&:hover":{color:"text.primary"},"&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}},children:r?"Less":"More"})]})}function M6(e){return e.split(/(`[^`\n]+`)/g).map((t,n)=>/^`[^`]+`$/.test(t)?p.jsx(Ee,{component:"code",sx:{fontFamily:ts,fontSize:"0.92em",color:"text.primary"},children:t.slice(1,-1)},n):t)}function U1(e){const t=e?.response?.status;return typeof t=="number"?t:void 0}function eCe(e){const t=U1(e);return t===403||t===404}function tCe(e,t){if(!e?.modelPath||!e.sourceName)return{kind:"unknown"};const n=t.get(e.modelPath);return n?n.has(e.sourceName)?{kind:"link"}:{kind:"join-only"}:{kind:"unknown"}}const p2=C.createContext([]),rx="text.primary",hg=e=>({main:e,tint:`color-mix(in srgb, ${e} 12%, transparent)`,onTint:e}),Ep={steel:hg(pr.cyan),sage:hg(pr.lime),brown:hg(pr.slate),olive:hg(pr.violet),amber:hg(pr.amber)};function VI(e){return e==="measure"?Ep.sage:e==="calculate"?Ep.amber:e==="view"?Ep.olive:Ep.steel}const qI=["steel","brown","olive","sage"];function nCe(e){return qI[e%qI.length]}const O6={small:13,caption:12},rCe={fontFamily:ts,fontSize:O6.small,fontWeight:500,color:rx},P6={fontSize:O6.caption,color:"text.secondary"};function ih({label:e,count:t,level:n="h2",testId:r,action:o,children:a}){return t===0?null:n==="h3"?p.jsxs(Ee,{component:"section","aria-label":e,"data-testid":r,sx:{mb:2},children:[p.jsx(Ee,{component:"h3",sx:{m:0,mb:1,fontSize:Ka.bodyLarge,fontWeight:E$.strong,color:rx},children:e}),a]}):p.jsxs(Ee,{component:"section","aria-label":e,"data-testid":r,sx:{mb:3},children:[p.jsxs(Ee,{sx:{mb:2},children:[p.jsx(Ee,{component:"h2",sx:{m:0,fontSize:"1.25rem",fontWeight:E$.strong,color:rx},children:e}),o&&p.jsx(Ee,{sx:{...P6,mt:.25,display:"flex",alignItems:"center"},children:o})]}),a]})}function Gg(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e.at(-1)}`}function HI(e,t){return`${e.label??e.name}: ${Kbe(e,t)}`}const qb=e=>e.label??e.name;function j6(e,t,n=void 0,r=void 0,o=!1,a="source"){const i=e??[],s=k=>n?.[k.name]!==void 0,l=k=>r?.has(k.name)===!0,d=i.filter(k=>!s(k)&&k.default===void 0),u=t??[],m=u.length===0&&d.length>0&&d.every(k=>l(k)),g=o&&m?d:[];if(g.length===0&&(d.length>0||u.length>0)){const k=d.length>0?`a value for ${d.length===1?"the given":"the givens"} ${d.map(qb).join(", ")}`:"",R=u.length>0?`${u.length===1?"the required filter":"the required filters"} ${u.join(", ")}`:"",O=d.filter(l),P=O.length===0?"":O.length===d.length?` This page can't tell whether this ${a} reads ${d.length===1?"it":"them"}.`:` This page can't tell whether this ${a} reads ${Gg(O.map(qb),"or")}.`;let D;return R===""?D=`This needs ${k}. Set ${d.length===1?"it":"them"} in the Givens section above.${P}`:k===""?D=`This needs ${R}, which this page can't set; open the source in a dashboard or notebook.`:D=`This needs ${k} (set ${d.length===1?"it":"them"} in the Givens section above) and ${R}, which this page can't set; open the source in a dashboard or notebook.${P}`,{kind:"blocked",reason:D,canRunAnyway:m}}const y=k=>k.length>0?`${k.length===1?"the default":"the defaults"} ${k.map(R=>HI(R)).join(", ")}`:"",x=[];g.length>0&&x.push(`Ran without a value for ${g.length===1?"the given":"the givens"} ${Gg(g.map(qb),"and")}, which this page can't tell this ${a} reads.`);const w=i.filter(k=>!g.includes(k)),S=w.filter(k=>!l(k)),b=y(S.filter(k=>!s(k)));b!==""&&x.push(`Ran with ${b}.`);const $=w.filter(l);if($.length>0){const k=[$.filter(s).map(R=>HI(R,n?.[R.name])).join(", "),y($.filter(R=>!s(R)))].filter(R=>R!=="").join(" and ");x.push($.length===w.length?`This page can't tell which givens this ${a} reads. Where it reads one, it ran with ${k}.`:`This page can't tell whether this ${a} reads ${Gg($.map(qb),"or")}. Where it does, it ran with ${k}.`)}return x.length>0?{kind:"noted",note:x.join(" ")}:{kind:"ok"}}const oCe=400;function aCe({givens:e,unknown:t,inheritedFrom:n,values:r,onChange:o,onReset:a,environmentName:i,packageName:s,modelPath:l,versionId:d,declaredTypes:u}){const m=C.useMemo(()=>[...e],[e]),g=C.useMemo(()=>{const D=e.filter(A=>t?.has(A.name));if(D.length!==0)return D.length===e.length?"This page can't tell which of these givens this source reads, so a value set here may not apply to it.":`This page can't tell whether this source reads ${Gg(D.map(A=>A.label??A.name),"or")}, so a value set for ${D.length===1?"it":"them"} may not apply.`},[e,t]),[y,x]=C.useState(()=>new Set),w=C.useCallback(D=>x(A=>A.has(D)?A:new Set([...A,D])),[]),S=i_(r,oCe),b=C.useMemo(()=>({values:S,declaredTypes:u}),[S,u]),{options:$,isLoading:k,failed:R,truncated:O,search:P}=FF(i,s,l,m,d,b,void 0,y,!0);return p.jsxs(ih,{label:"Givens",count:e.length,testId:"model-givens-section",children:[p.jsx(Ee,{sx:{"& .MuiPaper-root":{borderColor:"divider"}},children:p.jsx(A1,{layout:"bar",givens:m,values:r,onChange:o,onReset:a,options:$,optionsLoading:k,optionsFailed:R,optionsTruncated:O,optionSearch:P,onControlOpen:w})}),g&&p.jsx(Hd,{"data-testid":"model-givens-unknown",sx:{mt:1},children:g}),n&&n.size>0&&p.jsx(Hd,{"data-testid":"model-givens-inherited",sx:{mt:1},children:[...n].map(([D,A])=>A.length===1?`${D} is inherited from ${A[0]}, which this model doesn't export.`:`${D} is inherited from ${A.slice(0,-1).join(", ")} and ${A.at(-1)}, none of which this model exports.`).join(" ")})]})}const iCe="A source is a queryable entry point into the model — pick one to browse its dimensions, measures, views and joins.";function sCe(e,t=!1){return e===0?"No sources":`${e} ${t?"public ":""}source${e===1?"":"s"}`}const lCe=rn(p.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"})),cCe=rn(p.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),uCe=rn(p.jsx("path",{d:"M4 9h4v11H4zm12 4h4v7h-4zm-6-9h4v16h-4z"})),dCe=rn([p.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-2m0 16H5V5h14z"},"0"),p.jsx("path",{d:"M6.25 7.72h5v1.5h-5zM13 15.75h5v1.5h-5zm0-2.5h5v1.5h-5zM8 18h1.5v-2h2v-1.5h-2v-2H8v2H6V16h2zm6.09-7.05 1.41-1.41 1.41 1.41 1.06-1.06-1.41-1.42 1.41-1.41L16.91 6 15.5 7.41 14.09 6l-1.06 1.06 1.41 1.41-1.41 1.42z"},"1")]),A6=rn(p.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"})),fCe=rn(p.jsx("path",{d:"M17 20.41 18.41 19 15 15.59 13.59 17zM7.5 8H11v5.59L5.59 19 7 20.41l6-6V8h3.5L12 3.5z"})),pCe=rn(p.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"})),hCe=rn(p.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),mCe=rn(p.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"})),gCe=rn(p.jsx("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"})),yCe=rn(p.jsx("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5m0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5m0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5M7 19h14v-2H7zm0-6h14v-2H7zm0-8v2h14V5z"})),D6=rn(p.jsx("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"})),vCe=rn(p.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2M9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9zm9 14H6V10h12zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2"})),bCe=rn(p.jsx("path",{d:"m20.5 10 .5-2h-4l1-4h-2l-1 4h-4l1-4h-2L9 8H5l-.5 2h4l-1 4h-4L3 16h4l-1 4h2l1-4h4l-1 4h2l1-4h4l.5-2h-4l1-4zm-7 4h-4l1-4h4z"})),N6=rn(p.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"})),xCe=rn([p.jsx("path",{d:"m21.41 11.41-8.83-8.83c-.37-.37-.88-.58-1.41-.58H4c-1.1 0-2 .9-2 2v7.17c0 .53.21 1.04.59 1.41l8.83 8.83c.78.78 2.05.78 2.83 0l7.17-7.17c.78-.78.78-2.04-.01-2.83M12.83 20 4 11.17V4h7.17L20 12.83z"},"0"),p.jsx("circle",{cx:"6.5",cy:"6.5",r:"1.5"},"1")]),I6=rn(p.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"})),wCe=rn(p.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),L6=rn(p.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"})),SCe=rn(p.jsx("path",{d:"M12 5.99 19.53 19H4.47zM12 2 1 21h22zm1 14h-2v2h2zm0-6h-2v4h2z"}));function Ao(e,t){const n=({size:r,...o})=>p.jsx(e,{...o,sx:{fontSize:r}});return n.displayName=t,n}const CCe=Ao(lCe,"IconText"),WI=Ao(cCe,"IconOpen"),z6=Ao(uCe,"IconResult"),kCe=Ao(dCe,"IconCalculation"),$Ce=Ao(A6,"IconDate"),ECe=Ao(fCe,"IconJoin"),RCe=Ao(pCe,"IconCode"),TCe=Ao(hCe,"IconList"),MCe=Ao(mCe,"IconRecord"),OCe=Ao(gCe,"IconCollapse"),PCe=Ao(uF,"IconExpand"),jCe=Ao(yCe,"IconFields"),ACe=Ao(D6,"IconDropdown"),DCe=Ao(vCe,"IconLock"),F6=Ao(bCe,"IconNumber"),NCe=Ao(N6,"IconTimestamp"),ICe=Ao(xCe,"IconValues"),LCe=Ao(I6,"IconBoolean"),zCe=Ao(wCe,"IconGivens"),_6=Ao(L6,"IconColumn");Ao(SCe,"IconWarning");const Ry=C.createContext(void 0);function h2(){const[e,t]=C.useState(!1),n=C.useContext(Ry),[r,o]=C.useState(n?.n);return n&&n.n!==r&&(o(n.n),t(n.open)),[e,t]}function FCe({allOpen:e,onToggle:t,noun:n,disabledReason:r}){const o=e?p.jsx(OCe,{size:16,"aria-hidden":!0}):p.jsx(PCe,{size:16,"aria-hidden":!0});return p.jsx(Br,{title:r??"",children:p.jsx("span",{children:p.jsxs(rs,{disabled:!!r,onClick:t,"aria-label":r??`${e?"Collapse":"Expand"} all ${n[1]}`,sx:{font:"inherit",color:"text.secondary",gap:.25,borderRadius:1,"&:hover":{color:"text.primary",textDecoration:"underline"},...Ey,"&.Mui-disabled":{opacity:.5}},children:[o,e?"Collapse all":"Expand all"]})})})}function ox({noun:e,disabledReason:t}){const[n,r]=C.useState(void 0),o=n?.open??!1;return{command:n,action:p.jsx(FCe,{allOpen:o,onToggle:()=>r({open:!o,n:(n?.n??0)+1}),noun:e,disabledReason:t})}}let OC;function _Ce(e,t){if(OC?.text===t)return OC.parsed;const n=t.replace(/\r\n/g,`
491
491
  `);let r;try{r={lines:n.split(`
492
492
  `),symbols:e.Malloy.parse({source:n}).symbols}}catch{r=void 0}return OC={text:t,parsed:r},r}function V1(e,t){const{start:n,end:r}=t;return n.line===r.line?(e[n.line]??"").slice(n.character,r.character):[(e[n.line]??"").slice(n.character),...e.slice(n.line+1,r.line),(e[r.line]??"").slice(0,r.character)].join(`
493
- `)}let B6,Hb;function BCe(){return Hb??=vo(()=>import("./index-BIoSdsU9.js").then(e=>e.i),__vite__mapDeps([0,1])).then(e=>{const t="Malloy"in e?e:e.default;return B6=t,t}),Hb.catch(()=>{Hb=void 0}),Hb}function U6(e,t=!0){const[n,r]=C.useState(B6),[o,a]=C.useState(!1),i=!!e&&t;return C.useEffect(()=>{if(!i||n)return;let s=!0;return BCe().then(l=>s&&r(l),()=>s&&a(!0)),()=>{s=!1}},[i,n]),{parsed:C.useMemo(()=>i&&n&&e?_Ce(n,e):void 0,[i,n,e]),pending:i&&!n&&!o}}function UCe(e,t){if(!e)return;const n=e.symbols.filter(r=>r.type==="query"&&r.name.replace(/^`(.*)`$/,"$1")===t);if(n.length===1)return`query: ${V1(e.lines,n[0].range).trimEnd()}`}function V6(e){const t=e.replace(/^\n+/,"").split(`
493
+ `)}let B6,Hb;function BCe(){return Hb??=vo(()=>import("./index-N8X9kVzc.js").then(e=>e.i),__vite__mapDeps([0,1])).then(e=>{const t="Malloy"in e?e:e.default;return B6=t,t}),Hb.catch(()=>{Hb=void 0}),Hb}function U6(e,t=!0){const[n,r]=C.useState(B6),[o,a]=C.useState(!1),i=!!e&&t;return C.useEffect(()=>{if(!i||n)return;let s=!0;return BCe().then(l=>s&&r(l),()=>s&&a(!0)),()=>{s=!1}},[i,n]),{parsed:C.useMemo(()=>i&&n&&e?_Ce(n,e):void 0,[i,n,e]),pending:i&&!n&&!o}}function UCe(e,t){if(!e)return;const n=e.symbols.filter(r=>r.type==="query"&&r.name.replace(/^`(.*)`$/,"$1")===t);if(n.length===1)return`query: ${V1(e.lines,n[0].range).trimEnd()}`}function V6(e){const t=e.replace(/^\n+/,"").split(`
494
494
  `),n=[];let r=0;for(;r<t.length;){const o=t[r].trim();if(!o.startsWith("#"))break;!o.startsWith('#"')&&!o.startsWith("#(doc)")&&n.push(t[r]),r+=1}return[...n,...t.slice(r)].join(`
495
495
  `).trim()}function VCe(e,t){const n=V6(t),r=nf(e),o=new RegExp(`^(?:(?:dimension|measure|view)\\s*:\\s*)?${r}\\s+is\\s+`),a=n.replace(o,"");if(a===n||!(a.startsWith("{")&&a.endsWith("}")))return n;const i=a.slice(1,-1).replace(/^\n/,"").replace(/\s+$/,"").split(`
496
496
  `),s=i.filter(d=>d.trim()).map(d=>d.match(/^[ \t]*/)[0].length),l=s.length?Math.min(...s):0;return i.map(d=>d.slice(l)).join(`
@@ -507,6 +507,6 @@ ${o.inheritedFrom.code}`,framed:!1}):p.jsx(Ee,{sx:{p:1},children:p.jsx(q1,{messa
507
507
  `)}}function Eke(e,t){const n=(e[t.line]??"").slice(0,t.character),r=n.trim()==="";if(!r&&!QI.test(n))return[];const o=i=>{const s=[];let l=i;for(;l>=0&&e[l].trim().startsWith("#");)s.unshift(e[l--].trim());return{out:s,next:l}},a=o(t.line-1);return r&&a.next>=0&&QI.test(e[a.next])?[...o(a.next-1).out,...a.out]:a.out}const Rke=/(?<![\w:])([A-Za-z_]\w*)\s*:(?!:)/g;function Tke(e){let t;for(const n of Mke(e).matchAll(Rke))t=n[1];return t}function Mke(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];if(e.startsWith('"""',n)){const o=e.indexOf('"""',n+3),a=o===-1?e.length:o+3;t+=" ".repeat(a-n),n=a-1}else if(r==='"'||r==="'"||r==="`"){const o=Oke(e,n);t+=" ".repeat(o-n+1),n=o}else if(r==="#"||r==="/"&&e[n+1]==="/"||r==="-"&&e[n+1]==="-"){const o=e.indexOf(`
508
508
  `,n),a=o===-1?e.length:o;t+=" ".repeat(a-n),n=a-1}else t+=r}return t}function Oke(e,t){const n=e[t];for(let r=t+1;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===n)return r;return e.length}function Pke(e){return/^`?[A-Za-z_]\w*`?\s+is\s+`?([A-Za-z_]\w*)`?\s*(?:extend\b|$)/.exec(e)?.[1]}function w2(e){return e.replace(/^`(.*)`$/,"$1")}const jke=["fields","code"],XI={display:"inline-flex",alignItems:"center",color:"text.secondary",borderRadius:1,padding:"2px",flexShrink:0,"&:hover":{color:rx}};function Ake({join:e,run:t,modelPath:n,sourceName:r,link:o,entitiesByName:a,entitiesLoading:i,entitiesError:s,code:l,target:d,showRules:u=!1}){const[m,g]=h2(),{layers:y,layer:x,setLayer:w}=K6(jke),S=C.useMemo(()=>a?Z6({entities:a,loading:!!i,error:!!s}):void 0,[a,i,s]),b=e.dimensions.length+e.measures.length,$=p.jsxs(Ee,{sx:{display:"inline-flex",alignItems:"center",gap:1},children:[m&&p.jsx(Q6,{"aria-label":`Show for ${e.name}`,layers:y,value:x,onChange:w,disabledReasons:{code:l?void 0:"No Malloy code to show for this join"}}),o?.kind==="link"&&o.href&&p.jsx(P0,{href:o.href,"aria-label":`Open ${e.name}`,title:`Open ${e.name}`,sx:XI,children:p.jsx(WI,{size:14})}),o?.kind==="link"&&!o.href&&o.onOpen&&p.jsx(P0,{component:"button",type:"button",onClick:o.onOpen,"aria-label":`Open ${e.name}`,title:`Open ${e.name}`,sx:XI,children:p.jsx(WI,{size:14})}),o?.kind==="join-only"&&p.jsx(Ee,{component:"span",sx:{fontSize:Ka.micro,fontStyle:"italic",color:"text.secondary",flexShrink:0},children:"only accessible via join"})]});return p.jsxs(Ee,{"data-testid":"model-viewer-join-row","data-name":e.name,sx:m?{pb:1.25}:void 0,children:[p.jsx(x2,{glyph:p.jsx(y2,{kind:"join"}),name:e.name,typeLabel:`${b} ${b===1?"field":"fields"}`,stackPills:!0,descriptors:p.jsxs(cs,{tone:"quiet",voice:"token",sx:{alignSelf:"center",flexShrink:0},children:["join_",e.relationship]}),doc:e.doc,open:m,expandable:!0,onToggle:()=>g(k=>!k),trailing:$,pills:d&&p.jsx(T6,{access:d.access})}),p.jsx(Bp,{in:m,timeout:"auto",unmountOnExit:!0,children:p.jsx(Ee,{sx:{mx:"10px",mt:"2px"},children:x==="code"&&l?p.jsx(Ty,{testId:"model-viewer-join-code",code:l}):p.jsxs(Ee,{"data-testid":"model-viewer-join-fields",sx:{...kh,bgcolor:"transparent",p:1.5,pb:0},children:[d&&u&&p.jsx(ky,{component:"div","data-testid":"model-viewer-join-gate-warning",sx:{mb:1},children:HSe(d.sourceName,d.access)}),p.jsx(Kg,{label:"Measures",noun:["measure","measures"],level:"h3",items:e.measures,run:t,modelPath:n,sourceName:r,getFieldCode:S}),p.jsx(Kg,{label:"Dimensions",noun:["dimension","dimensions"],level:"h3",items:e.dimensions,run:t,modelPath:n,sourceName:r,getFieldCode:S})]})})})]})}function Dke({source:e,modelPath:t,entitiesByName:n,entitiesLoading:r,entitiesError:o,modelText:a,joinLinks:i,joinEntities:s,joinCodes:l,joinAccess:d,showRules:u=!1,columnDescriptions:m,run:g,queries:y,givens:x}){const w={run:g,modelPath:t,sourceName:e.name},{showField:S}=B1(),b=C.useMemo(()=>S?e.views.filter(F=>S({modelPath:t,sourceName:e.name,field:F,joined:!1})):e.views,[S,e,t]),$=ox({noun:["view","views"]}),k=ox({noun:["join","joins"]}),R=C.useMemo(()=>!r&&[...e.views,...e.measures,...e.calculations,...e.dimensions].some(F=>!n?.get(F.name)),[r,n,e]),{parsed:O,pending:P}=U6(a,R),D=C.useMemo(()=>wke(O,e.name),[O,e.name]),A=C.useMemo(()=>Z6({entities:n,loading:!!r,error:!!o,columnDescriptions:m,declarations:D,declarationsLoading:P}),[n,r,o,m,D,P]);return p.jsxs(Ee,{sx:{paddingBottom:"24px"},children:[x,p.jsx(ih,{label:"Views",count:b.length,action:$.action,children:p.jsx(Ry.Provider,{value:$.command,children:b.map(F=>p.jsx(X6,{field:F,modelPath:t,sourceName:e.name,fieldCode:A(F),run:g},F.name))})}),y,p.jsx(Kg,{label:"Measures",noun:["measure","measures"],items:e.measures,getFieldCode:A,...w}),p.jsx(Kg,{label:"Calculations",noun:["calculation","calculations"],items:e.calculations,getFieldCode:A,...w}),p.jsx(Kg,{label:"Dimensions",noun:["dimension","dimensions"],items:e.dimensions,getFieldCode:A,...w}),p.jsx(ih,{label:"Joins",count:e.joins.length,action:k.action,children:p.jsx(Ry.Provider,{value:k.command,children:e.joins.map(F=>p.jsx(Ake,{join:F,run:g,modelPath:t,sourceName:e.name,link:i?.get(F.name),entitiesByName:s?.get(F.name),code:l?.get(F.name),target:d?.get(F.name),showRules:u,entitiesLoading:r,entitiesError:o},F.name))})})]})}function M$(e){return{name:e.name,kind:e.kind,dataType:c2(e.type),typeTip:fSe(e.type),tags:pSe(e.annotations),doc:ah(e.annotations),indexed:e.kind==="dimension"?TSe(e):void 0,preaggregate:e.kind==="measure"?dSe(e.annotations):void 0}}function Nke(e){const t=[],n=[];for(const r of e.schema?.fields??[]){if(r.kind!=="dimension"&&r.kind!=="measure")continue;const o={...M$(r),indexed:!1,preaggregate:!1};r.kind==="dimension"?t.push(o):n.push(o)}return{name:e.name,relationship:e.relationship,doc:ah(e.annotations),dimensions:t,measures:n}}function Ike(e,t){const n={name:e.name,doc:ah(e.annotations),docParts:g6(e.annotations),accent:nCe(t),persist:uSe(e.annotations),dimensions:[],measures:[],calculations:[],views:[],joins:[]};for(const r of e.schema?.fields??[])switch(r.kind){case"dimension":case"measure":n[r.kind==="dimension"?"dimensions":"measures"].push(M$(r));break;case"calculate":n.calculations.push(M$(r));break;case"view":n.views.push({name:r.name,kind:"view",doc:ah(r.annotations),tags:l2(r.annotations)});break;case"join":n.joins.push(Nke(r));break}return n}function Lke(e){const t=[];for(const n of e??[]){if(!n.name)continue;const r=(n.annotations??[]).map(o=>({value:o}));t.push({name:n.name,sourceName:n.sourceName||void 0,doc:ah(r),tags:l2(r)})}return t}function J6(e){return e.dimensions.length+e.measures.length+e.calculations.length+e.views.length}function zke(e,t){if(e.length===0)return null;const n=d=>d.toLowerCase().replace(/[-_]/g,""),r=t?n((t.split("/").pop()??t).replace(/\.malloy$/,"")):void 0,o=new Map(e.map(d=>[d.name,new Set(d.views.map(u=>u.name))])),a=d=>e.some(u=>{if(u.name===d.name||u.views.length===0)return!1;const m=o.get(d.name);return u.views.length<d.views.length&&[...o.get(u.name)].every(g=>m.has(g))}),i=e.filter(d=>!a(d)),s=i.length>0?i:e;let l=s[0];for(const d of s.slice(1)){if(d.views.length!==l.views.length){d.views.length>l.views.length&&(l=d);continue}r&&n(d.name)===r&&n(l.name)!==r&&(l=d)}return l}function Fke(e,t,n){if(!e||!t)return;const r=new RegExp("source:\\s*`?"+nf(t)+"`?\\s+is\\s+`?([A-Za-z_]\\w*)`?\\s*(?:->|extend\\b)").exec(e);if(!r)return;const o=r[1];return n.has(o)?o:void 0}function DC(e,t){return`${e} ${e===1?t:`${t}s`}`}function _ke(e){const t=J6(e),n=[DC(e.views.length,"view"),DC(t,"field")];return e.joins.length>0&&n.push(DC(e.joins.length,"join")),n.join(" · ")}function Bke(e,t,n){if(n){const s=n.exportOrder,l=s.length>0&&e.some(d=>s.includes(d.name));return{sources:qke(e,d=>d.name,s),curated:!0,exportOrdered:l}}const r=e.map((s,l)=>({source:s,index:l})).filter(({source:s})=>s.name!==t?.name).sort((s,l)=>l.source.views.length-s.source.views.length||s.index-l.index).map(({source:s})=>s),o=t?[t,...r]:r,a=t?.views.length??0,i=t&&a>0&&e.every(s=>s.views.length<=a)?t.name:void 0;return{sources:o,curated:!1,exportOrdered:!1,mostViews:i}}function Uke(e){return/^`.*`$/.test(e)?e.slice(1,-1):e}function Vke(e){if(!e)return[];const t=iv(e),n=[];for(const r of t.matchAll(/(?:^|[\s;])export\s*\{([^}]*)\}/gi))for(const o of r[1].split(",")){const a=Uke(o.trim());a&&!n.includes(a)&&n.push(a)}return n}function qke(e,t,n){if(n.length===0)return[...e];const r=o=>{const a=n.indexOf(t(o));return a===-1?n.length:a};return e.map((o,a)=>({item:o,index:a})).sort((o,a)=>r(o.item)-r(a.item)||o.index-a.index).map(({item:o})=>o)}function Hke(e,t){const n=e?.trim();if(n)return{text:n,generated:!1};const r=t?.trim();return r?{text:r,generated:!0}:void 0}const Wke="This package's curated sources, in the order its index.malloy exports them.",Yke="This package's public sources.";function Gke(e){return e.mostViews?", most views":""}function Kke({anchorEl:e,onClose:t,sources:n,currentName:r,onPickSource:o,curated:a=!1,exportOrdered:i=!1}){return p.jsxs(jE,{open:!!e,anchorEl:e,onClose:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{width:460,maxWidth:"calc(100vw - 32px)",maxHeight:"min(70vh, 560px)",display:"flex",flexDirection:"column",borderRadius:"10px"},"data-testid":"model-sources-dropdown"}},children:[p.jsxs(Ee,{sx:{px:2,pt:1.5,pb:1,borderBottom:1,borderColor:"divider"},children:[p.jsx(wt,{variant:"subtitle2",component:"h2",sx:{m:0},children:"Sources"}),p.jsx(ky,{component:"p",sx:{m:0},children:a?i?Wke:Yke:iCe})]}),p.jsx(Ee,{sx:{overflowY:"auto",py:.5},children:n.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{py:4,textAlign:"center"},children:"This model defines no sources."}):n.map(s=>{const l=s.name===r;return p.jsxs(rs,{"data-item-name":s.name,"aria-label":`Open source ${s.name}${Gke(s)}${YSe(s.access)}`,"aria-current":l||void 0,onClick:()=>{t(),o(s.name)},sx:{display:"flex",width:"100%",alignItems:"flex-start",justifyContent:"flex-start",textAlign:"left",gap:1.25,px:2,py:1,bgcolor:l?yo.background.muted:void 0,"&:hover":{bgcolor:l?yo.background.strong:yo.background.muted},...Ey},children:[p.jsx(Ee,{component:"span","aria-hidden":!0,sx:{color:Ep.steel.main,display:"inline-flex",pt:"2px"},children:p.jsx(_6,{size:16})}),p.jsxs(Ee,{component:"span",sx:{minWidth:0,flex:1},children:[p.jsxs(Ee,{component:"span",sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1},children:[p.jsx(Ee,{component:"span",sx:{fontFamily:ts,fontSize:Ka.body,fontWeight:500,color:"text.primary"},children:s.name}),s.mostViews&&p.jsx(cs,{tone:"quiet",sx:{alignSelf:"center"},children:Qke}),R6(s.access)&&p.jsx(T6,{access:s.access}),s.status]}),(s.description||s.descriptionPending)&&p.jsxs(Ee,{component:"span",sx:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",mt:.25,fontSize:Ka.small,color:"text.secondary",minHeight:s.description?void 0:"1.4em"},children:[s.description?.generated&&p.jsx(cs,{tone:"quiet","data-testid":"model-sources-summary-generated",sx:{mr:.75,verticalAlign:"baseline"},children:"Generated"}),s.description&&M6(s.description.text)]}),p.jsx(ky,{"data-testid":"model-sources-row-meta",sx:{display:"block",mt:.25},children:s.meta})]})]},`source:${s.name}`)})})]})}const Qke="Most views";function Xke({sources:e,currentName:t,countLabel:n,onPickSource:r,curated:o=!1,exportOrdered:a=!1,onWarm:i}){const[s,l]=C.useState(null);return p.jsxs(p.Fragment,{children:[p.jsx(dke,{size:"small",variant:"outlined",onClick:d=>{i?.(),l(d.currentTarget)},endIcon:p.jsx(ACe,{size:20}),"aria-label":`${n}. Showing ${t}, one of the ${n} in this model`,"aria-haspopup":"dialog","aria-expanded":!!s,onPointerEnter:i,onFocus:i,sx:{ml:1,transition:"none"},children:n}),p.jsx(Kke,{anchorEl:s,onClose:()=>l(null),sources:e,currentName:t,onPickSource:r,curated:o,exportOrdered:a})]})}const Zke=[],Jke=[],e$e=[],t$e=new Map;function n$e(e){const t=e.modelDef;if(typeof t!="string")return!1;try{const n=JSON.parse(t);return Array.isArray(n.imports)&&n.imports.length>0}catch{return!1}}function r$e(e,t){if(typeof e=="string")try{const r=NI(JSON.parse(e).annotations);if(r)return r}catch{}if(!t)return;const n=t.split(`
509
509
  `).filter(r=>/^##(\(doc\)|")/.test(r.trim())).map(r=>({value:r}));return NI(n)}async function o$e(e,t,n,r,o,a){const i=await e.models.getModel(t,n,r,o,a),s=a$e(i.data);return{sourceInfos:(i.data.sourceInfos??[]).map(l=>JSON.parse(l)),queries:i.data.queries??[],sourceText:s,givens:xSe(r,i.data),access:BSe(i.data),modelDoc:r$e(i.data.modelInfo,s),hasImports:n$e(i.data)}}function a$e(e){const t=e.sourceText;return typeof t=="string"?t:void 0}function i$e(e,t,n,r,o=!1){return["model-viewer-sources",e,t,n,r??"",...o?["off-surface"]:[]]}function s$e(e,t,n,r,o,a=!1){return{queryKey:i$e(t,n,r,o,a),queryFn:()=>o$e(e,t,n,r,o,a),...o&&o!=="latest"?{staleTime:1/0}:{}}}function l$e(e,t,n,r,o=!0,a=!1){const{apiClients:i}=er(),s=Ld({...s$e(i,e,t,n,r,a),enabled:o&&!!(e&&t&&n)});return{sources:s.data?.sourceInfos??Zke,queries:s.data?.queries??Jke,sourceText:s.data?.sourceText,givens:s.data?.givens??e$e,access:s.data?.access??t$e,modelDoc:s.data?.modelDoc,hasImports:s.data?.hasImports??!1,isLoading:s.isLoading,isError:s.isError,error:s.error,refetch:s.refetch}}const c$e=new Map;function ZI(e){return(e.split("/").pop()??e).replace(/\.malloy$/,"")}function u$e(e,t){const n=jSe(e,t),r=t.filter(a=>!n.has(a.name)),o="Nothing on this page reads them.";return r.length===0?`Declared here for the models that import this file. ${o}`:r.length===t.length?`Imported from another file, for the models that import this one. ${o}`:`For the models that import this file. ${Gg(r.map(a=>a.name),"and")} ${r.length===1?"comes":"come"} from a file this one imports; the rest are declared here. ${o}`}function d$e({resourceUri:e,sourceName:t,onSourceChange:n,initialSourceName:r,includeHiddenFilesAndSources:o=!1,hostGivenNames:a,givens:i,onGivensChange:s,showAccessRules:l=!1,headingLevel:d="h1",headerActions:u,renderSourceStatus:m,entities:g,entitiesLoading:y=!1,entitiesError:x=!1,columnDescriptions:w,joinHref:S,queryMetadata:b,onQueryRun:$,maxResultSize:k,extensions:R}){const{environmentName:O,packageName:P,modelPath:D="",versionId:A}=ko(e),F=Hr().theme.ui.font.mono,{sources:L,queries:_,sourceText:E,givens:z,access:I,modelDoc:U,hasImports:N,isLoading:q,isError:Y,error:oe,refetch:Q}=l$e(O,P,D,A,!0,o),ae=C.useMemo(()=>new Set(a??[]),[a]),de=C.useMemo(()=>z.filter(Bt=>!ae.has(Bt.name)),[z,ae]),X=C.useMemo(()=>L.map(Ike),[L]),se=C.useMemo(()=>Lke(_),[_]),J=C.useMemo(()=>OSe(X),[X]),Z=C.useMemo(()=>MSe(L),[L]),G=C.useMemo(()=>wSe(de),[de]),ue=JSON.stringify(i??null),ie=C.useMemo(()=>i&&Object.fromEntries(Object.entries(i).filter(([Bt])=>G.has(Bt))),[ue,G]),fe=!q&&!Y,he=C.useCallback(Bt=>s?.(Bt,Array.from(G.keys())),[s,G]),me=IF({declaredTypes:G,params:ie,onParamsChange:fe&&s?he:void 0,documentKey:`${O}/${P}@${A??""}/${D}`,autorun:!0}),le=C.useMemo(()=>SSe(me.applied,G),[me.applied,G]),{givensBySource:ve,unknownGivensBySource:Le}=C.useMemo(()=>{const Bt=new Map,an=new Map;for(const $n of X){const Vt=DSe(E,$n.name,de);Bt.set($n.name,Vt.givens),Vt.unknown.size>0&&an.set($n.name,Vt.unknown)}return{givensBySource:Bt,unknownGivensBySource:an}},[X,E,de]),Ie=C.useMemo(()=>({projectName:O,packageName:P,versionId:A,givens:de,givensBySource:ve,unknownGivensBySource:Le,requiredFiltersBySource:Z,givenValues:le,accessBySource:I,includeHiddenFilesAndSources:o,queryMetadata:b,onQueryRun:$,maxResultSize:k}),[O,P,A,de,ve,Le,Z,le,I,o,b,$,k]),[Re,ne]=C.useState(r),qe=t!==void 0,Oe=qe?t:Re,Qe=C.useCallback(Bt=>{qe||ne(Bt),n?.(Bt)},[qe,n]),nt=C.useMemo(()=>zke(X,D),[X,D]),kt=X.find(Bt=>Bt.name===Oe)??(qe?void 0:nt),Ut=C.useMemo(()=>kt?ve.get(kt.name)??de:de,[kt,ve,de]),at=C.useMemo(()=>kt?NSe(E,kt.name,de,J):new Map,[kt,E,de,J]),et=C.useMemo(()=>Fke(E,kt?.name,J),[E,kt?.name,J]),pt=C.useMemo(()=>kt?lSe(kt,X.find(Bt=>Bt.name===et)):void 0,[kt,X,et]),ze=C.useMemo(()=>g?PSe(g):c$e,[g]),be=kt?ze.get(kt.name):void 0,{joinLinks:He,joinEntities:Me,joinCodes:$t,joinAccessRules:Et}=C.useMemo(()=>{const Bt=new Map,an=new Map,$n=new Map,Vt=new Map,Pn=new Map([[D,new Set(J)]]);for(const Se of be?.values()??[]){if(Se.fieldType!=="join")continue;Se.code&&$n.set(Se.name,Se.code);const jn=Se.joinTarget;if(jn)if(jn.modelPath===D){const En=ze.get(jn.sourceName);En&&an.set(Se.name,En);const Jt=b0(I,jn.sourceName);R6(Jt)&&Vt.set(Se.name,{sourceName:jn.sourceName,access:Jt});const Pt=tCe(jn,Pn);Bt.set(Se.name,Pt.kind==="link"?{...Pt,onOpen:()=>Qe(jn.sourceName)}:Pt)}else{const En=S?.(jn);En&&Bt.set(Se.name,{kind:"link",href:En})}}return{joinLinks:Bt,joinEntities:an,joinCodes:$n,joinAccessRules:Vt}},[be,ze,D,J,I,Qe,S]),vt=D==="index.malloy"&&!o,it=C.useMemo(()=>Bke(X,nt,vt?{exportOrder:Vke(E)}:void 0),[X,nt,vt,E]),st=R?.describePickerSource,At=C.useMemo(()=>it.sources.map(Bt=>{const an=st?.({modelPath:D,sourceName:Bt.name});return{name:Bt.name,description:Hke(Bt.doc,an?.summary),descriptionPending:!Bt.doc?.trim()&&!an?.summary&&!!an?.summaryPending,meta:_ke(Bt),mostViews:it.mostViews===Bt.name,access:b0(I,Bt.name),status:an?.status}}),[it,I,st,D]),tn=(()=>{if(q)return p.jsx(Go,{text:"Fetching Model..."});if(Y)return eCe(oe)?p.jsx(Ee,{sx:{pt:R$},children:p.jsx(Yg,{message:Y6(oe)??`${P}/${D} doesn't exist, or you don't have access to it.`})}):p.jsx(q1,{message:G6("Failed to load model",oe),onRetry:()=>void Q()});const Bt=se.length>0&&p.jsx(xke,{queries:se,sourceText:E,modelPath:D,run:Ie});if(X.length===0)return se.length===0?p.jsxs(p.Fragment,{children:[p.jsx(MC,{headingLevel:d,title:ZI(D),meta:de.length>0?`${de.length} ${de.length===1?"given":"givens"}`:void 0,actions:u,isSource:!1,offSurface:o}),p.jsx(Yg,{message:"This model defines no sources or queries.",secondary:N&&p.jsxs(p.Fragment,{children:["It imports other files but re-exports nothing. Add"," ",p.jsxs("code",{children:["export ","{ source_name }"]})," to surface imported sources here."]})}),p.jsxs(ih,{label:"Givens",count:de.length,testId:"model-viewer-declared-givens",children:[p.jsx(Hd,{"data-testid":"model-viewer-declared-givens-where",sx:{mb:1},children:u$e(E,de)}),p.jsx(u2,{givens:de})]})]}):p.jsxs(p.Fragment,{children:[p.jsx(MC,{headingLevel:d,title:ZI(D),meta:`${se.length} ${se.length===1?"query":"queries"}`,actions:u,isSource:!1,offSurface:o}),Bt]});if(!kt)return p.jsx(Ee,{sx:{pt:R$},children:p.jsx(Yg,{message:`This model has no source named ${Oe}.`,secondary:p.jsxs(Ee,{component:"span","data-testid":"model-viewer-source-links",children:["Sources in this model: ",X.map((Se,jn)=>p.jsxs("span",{children:[jn>0&&", ",p.jsx(P0,{component:"button",type:"button",onClick:()=>Qe(Se.name),sx:{fontFamily:ts,verticalAlign:"baseline"},children:Se.name})]},Se.name))]})})});const an=J6(kt),$n=et?void 0:[...be?.values()??[]].find(Se=>Se.table)?.table,Vt=et?p.jsxs(p.Fragment,{children:["from ",p.jsx(P0,{component:"button",type:"button",onClick:()=>Qe(et),sx:{fontFamily:ts,color:_1,textDecorationColor:"inherit",verticalAlign:"baseline"},children:et})]}):$n?p.jsxs(p.Fragment,{children:["reads ",p.jsx(Ee,{component:"span","data-testid":"model-viewer-source-table",sx:{fontFamily:ts},children:[$n.connectionName,$n.catalogName,$n.schemaName,$n.tableName].filter(Boolean).join(".")})]}):void 0,Pn=R?.renderSourceDetail?.({modelPath:D,sourceName:kt.name});return p.jsxs(p.Fragment,{children:[p.jsx(MC,{headingLevel:d,title:kt.name,titleAdornments:X.length>1&&p.jsx(Xke,{sources:At,currentName:kt.name,countLabel:sCe(At.length,it.curated),onPickSource:Qe,curated:it.curated,exportOrdered:it.exportOrdered}),actions:u,status:m?.(kt.name),kindLabel:"Source",meta:`${an} ${an===1?"field":"fields"}`,doc:pt,modelDoc:U,access:b0(I,kt.name),showRules:l,offSurface:o,publicSurface:vt,provenance:Vt}),Pn&&p.jsx(Ee,{"data-testid":"model-viewer-source-detail",sx:{mt:1.5},children:Pn}),p.jsx(p2.Provider,{value:de,children:p.jsx(Dke,{source:kt,modelPath:D,entitiesByName:be,entitiesLoading:y,entitiesError:x,columnDescriptions:w?.get(kt.name),modelText:E,joinLinks:He,joinAccess:Et,showRules:l,joinEntities:Me,joinCodes:$t,run:Ie,queries:Bt,givens:p.jsx(aCe,{givens:Ut,unknown:kt?Le.get(kt.name):void 0,inheritedFrom:at,values:me.draft,onChange:me.setGiven,onReset:me.reset,environmentName:O,packageName:P,modelPath:D,versionId:A,declaredTypes:G})},kt.name)})]})})();return p.jsx(w6.Provider,{value:R??{},children:p.jsx(Ee,{"data-testid":"model-viewer",sx:{...gSe,pb:2,[v6]:F},children:p.jsx(Ee,{sx:ySe,children:tn})})})}const f$e=rn(p.jsx("path",{d:"M8 5v14l11-7z"}));function eB({open:e,onClose:t,result:n,title:r="Results",renderLogs:o,drill:a}){return p.jsx(Oo,{open:e,onClose:t,title:r,maxWidth:!1,showClose:!0,children:p.jsx(Ee,{sx:{height:"70vh",overflow:"auto"},children:p.jsx(D1,{result:n,maxHeight:Ole,maxResultSize:1e6,renderLogs:o,drill:a})})})}function p$e({queryName:e,annotations:t,resourceUri:n,runOnDemand:r=!1,maxResultSize:o=0}){const[a,i]=Cn.useState(),[s,l]=Cn.useState(!1),[d,u]=Cn.useState(!1),{packageName:m,environmentName:g,versionId:y,modelPath:x}=ko(n),w=!r||d,S=t2({environmentName:g,packageName:m,modelPath:x,versionId:y,queryName:e},{enabled:w}),b=S.data,{mode:$}=Hr();return C.useEffect(()=>{if(t&&t.length>0){const k=t.map(R=>`// ${R}`).join(`
510
- `);b2(k,"typescript",$).then(R=>{i(R)})}},[t,$]),p.jsxs(Ee,{children:[a&&p.jsx(Ee,{sx:{marginBottom:"16px"},children:p.jsx(wt,{fontSize:"12px",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:p.jsx("div",{className:"content",dangerouslySetInnerHTML:{__html:a}})})}),p.jsxs(Ee,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[p.jsx(wt,{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}),p.jsx(Lp,{"aria-label":"Expand results",onClick:()=>l(!0),children:p.jsx(Gp,{})})]}),p.jsxs(g4,{sx:{position:"relative"},children:[r&&!d&&p.jsxs(Ee,{sx:{padding:"40px 20px",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[p.jsx(wt,{variant:"body2",color:"text.secondary",children:"Click Run to execute the query"}),p.jsx(Hn,{variant:"contained",startIcon:p.jsx(f$e,{}),onClick:()=>u(!0),children:"Run Query"})]}),w&&p.jsx(GR,{state:S,context:e,maxHeight:Mle,maxResultSize:o})]}),p.jsx(eB,{open:s,onClose:()=>l(!1),result:b?.data?.result||"",renderLogs:b?.data?.renderLogs,title:`Query: ${e}`})]})}function h$e(e){return e!=null}function m$e(e,t){const n=[],r=[];for(const a of e){if(a.name===void 0||h$e(t.get(a.name)))continue;if(a.default==null){n.push(a.name);continue}const i=j1(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 g$e(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 y$e({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a,givens:i,gate:s}){return Cn.useEffect(()=>{o&&o(t)},[t,o]),p.jsx(m4,{children:p.jsxs(x9,{spacing:2,component:"section",children:[p.jsx(b$e,{sourceAndPath:e[t],existingQuery:n,onChange:l=>{r&&r(l)},resourceUri:a,givens:i,gate:s}),p.jsx(f5,{height:"5px"})]})})}function NC(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function v$e({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a,givens:i,gate:s}){const[l,d]=Cn.useState(n||NC()),[u,m]=Cn.useState(void 0);Cn.useEffect(()=>{n&&d(n)},[n]);const[g,y]=Cn.useState([]),{MalloyExplorerProvider:x,QueryPanel:w,ResizableCollapsiblePanel:S,ResultPanel:b,SourcePanel:$}=r;Cn.useEffect(()=>{t&&t(l)},[t,l]);const{environmentName:k,packageName:R,versionId:O}=ko(a),{apiClients:P}=er(),D=Cn.useRef(void 0),A=hl({mutationFn:()=>{D.current=s,m({executionState:"running",query:l?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{A.reset(),m(void 0)},response:{}});const E=typeof l?.malloyQuery=="string"?l.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:l?.malloyQuery}).toMalloy();return d({...l,query:E}),P.models.executeQueryModel(k,R,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 z=JSON.parse(E.data.result);d({...l,malloyResult:z});const I=D.current;m(U=>U?{...U,executionState:"finished",response:{result:z,...I?.defaultsNote?{messages:[{severity:"INFO",title:I.defaultsNote}]}:{}}}:void 0)}},onError:E=>{console.error("Query execution error:",E);const z=E?.data?.message??E?.message??"The query could not be run.",I=[{severity:"ERROR",title:z}],U=D.current?.missing??[];(E?.status===403||/Access denied for source/i.test(z))&&U.length>0&&I.push({severity:"WARN",title:g$e(U)}),m(N=>N?{...N,executionState:"finished",response:{messages:I}}:void 0)}}),[F,L]=Cn.useState(e.sourceInfo.name);Cn.useEffect(()=>{F!==e.sourceInfo.name&&(L(e.sourceInfo.name),d(NC()),m(void 0))},[e,F]);const _=Cn.useCallback(E=>{d({...l,malloyQuery:E,malloyResult:void 0})},[l]);return F!==e.sourceInfo.name?p.jsx("div",{children:"Loading..."}):p.jsx(y4,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:p.jsx(x,{source:e.sourceInfo,query:l?.malloyQuery,topValues:[],onFocusedNestViewPathChange:y,focusedNestViewPath:g,onQueryChange:_,children:p.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[p.jsx(S,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:p.jsx($,{onRefresh:()=>d(NC())})}),p.jsx(S,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:p.jsx(w,{runQuery:()=>{console.log(`running query with: ${l?.malloyQuery}`);try{A.mutate()}catch(E){console.error("Error running query:",E)}}})}),p.jsx(b,{source:e.sourceInfo,draftQuery:l?.malloyQuery,setDraftQuery:E=>d({...l,malloyQuery:E}),submittedQuery:u,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function b$e(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([vo(()=>import("./index-Dtw4eTxH.js"),__vite__mapDeps([5,0,1,2,6])),F0e()]).then(([l,d])=>{s&&(n(l),o(d),i(!1))}).catch(l=>{console.error("Failed to load Malloy components:",l),s&&i(!1)}),()=>{s=!1}},[]),a||!t||!r?p.jsx(qne,{children:p.jsx(y4,{children:p.jsx(f5,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):p.jsx(v$e,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function tB(e,t=!0){const{modelPath:n,environmentName:r,packageName:o,versionId:a}=ko(e),{apiClients:i}=er();return wo({queryKey:["package",r,o,n,a],queryFn:async()=>(await i.models.getModel(r,o,n,a)).data,enabled:t})}function nB({data:e,onChange:t,existingQuery:n,initialSelectedSourceIndex:r=0,onSourceChange:o,resourceUri:a,givens:i,onGivensChange:s,startingGivens:l}){const[d,u]=Cn.useState(r);Cn.useEffect(()=>{u(r)},[r]);const{data:m,isError:g,isLoading:y,error:x}=tB(a,!e),{environmentName:w,packageName:S,modelPath:b,versionId:$}=ko(a),k=e||m,R=Cn.useMemo(()=>k?.givens??[],[k]),O=gR({specs:R,loaded:!!k,params:i,onGivensChange:s,startingValues:l,documentKey:a,autorun:!0,environmentName:w??"",packageName:S??"",modelPath:b,versionId:$,documentName:b}),P=C.useMemo(()=>Zd(O.applied,O.declaredTypes),[O.applied,O.declaredTypes]),D=C.useMemo(()=>m$e(R,O.applied),[R,O.applied]);if(y&&!e)return p.jsx(Go,{text:"Fetching Model..."});if(g&&!e)return console.log("error",x),p.jsx(Xa,{error:x,context:`ModelExplorer > ${b}`});if(!k)return p.jsx(Go,{text:qd.loading});const A=(k?.sourceInfos||[]).map((L,_)=>{try{return JSON.parse(L)?.name||`Source ${_+1}`}catch{return`Source ${_+1}`}}),F=A[d]||"";return p.jsxs(Une,{variant:"outlined",children:[p.jsx(Vne,{children:p.jsx(Wn,{sx:{flexDirection:"row"},children:p.jsx(gwe,{size:"small",id:"size-small-standard",disablePortal:!0,options:A,value:F,onChange:(L,_)=>{if(!_)return;const E=A.indexOf(_);E>=0&&(u(E),o?.(E))},renderInput:L=>p.jsx(yr,{...L}),style:{width:350,marginTop:"3px",marginLeft:"6px",marginBottom:"8px"}})})}),p.jsx(A1,{...O.panel}),p.jsx(m4,{children:p.jsxs(Wn,{spacing:2,component:"section",children:[Array.isArray(k.sourceInfos)&&k.sourceInfos.length>0&&p.jsx(y$e,{sourceAndPaths:k.sourceInfos.map(L=>({sourceInfo:JSON.parse(L),modelPath:b})),selectedSourceIndex:d,existingQuery:n,onQueryChange:t,resourceUri:a,givens:P,gate:D}),p.jsx(Ee,{height:"5px"})]})})]})}function rB({open:e,onClose:t,resourceUri:n,data:r,title:o="Data Sources",hasValidImport:a=!0,existingQuery:i,initialSelectedSourceIndex:s,onChange:l,onSourceChange:d,givens:u,onGivensChange:m,startingGivens:g}){return p.jsxs(Fx,{open:e,onClose:t,fullScreen:!0,children:[p.jsxs(Bx,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o,p.jsx(no,{onClick:t,sx:{color:"text.secondary"},children:p.jsx(bh,{})})]}),p.jsx(_x,{children:a?p.jsx(nB,{resourceUri:n,data:r,existingQuery:i,initialSelectedSourceIndex:s,onChange:l,onSourceChange:d,givens:u,onGivensChange:m,startingGivens:g}):p.jsx("div",{children:"No valid import statement found in cell"})})]})}function x$e({onChange:e,resourceUri:t,runOnDemand:n=!1,maxResultSize:r=0,givens:o,onGivensChange:a}){const{modelPath:i}=ko(t),{data:s,isError:l,isLoading:d,error:u}=tB(t),[m,g]=Cn.useState(!1),[y,x]=Cn.useState(),[w,S]=Cn.useState(0),[b,$]=C.useState(""),[k,R]=Cn.useState({}),O=o??k,P=a??(E=>R(E)),D=s?.modelDef,A=Cn.useMemo(()=>{if(!D)return!1;try{const E=JSON.parse(D);return Array.isArray(E.imports)&&E.imports.length>0}catch{return!1}},[D]);if(d)return p.jsx(Go,{text:"Fetching Model..."});if(l)return console.log("error",u),p.jsx(Xa,{error:u,context:`Model > ${i}`});const F=E=>{x(E),e&&e(E)},L=E=>{S(E)},_=()=>{const E=window.location.href;navigator.clipboard.writeText(E).then(()=>$("URL copied to clipboard!")).catch(()=>$("Failed to copy URL"))};return p.jsxs(p.Fragment,{children:[p.jsxs(Ee,{sx:{position:"relative",maxWidth:"1200px",margin:"0 auto",paddingTop:"24px"},children:[Array.isArray(s?.sourceInfos)&&s.sourceInfos.length>0&&p.jsxs(Wn,{spacing:2,component:"section",children:[p.jsxs(Ee,{sx:{padding:"0 0 16px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsx(wt,{variant:"h1",sx:{fontSize:"28px",fontWeight:"600",color:"#1a1a1a",marginBottom:"8px",marginTop:"0",paddingLeft:"0"},children:"Sources"}),p.jsx(Br,{title:"Copy link",children:p.jsx(no,{size:"small","aria-label":"Copy link",onClick:_,sx:{color:"text.secondary"},children:p.jsx(s2,{fontSize:"small"})})})]}),p.jsx(nB,{data:s,onChange:F,onSourceChange:L,existingQuery:y,initialSelectedSourceIndex:w,resourceUri:t,givens:O,onGivensChange:P}),p.jsx(Lp,{"aria-label":"Expand results",sx:{position:"absolute",top:"90px",right:"4px",zIndex:2},onClick:()=>g(!0),children:p.jsx(Gp,{})})]}),s?.queries?.length>0&&p.jsxs(Wn,{spacing:2,component:"section",sx:{marginTop:"24px"},children:[p.jsx(Ee,{sx:{padding:"0 0 16px 0"},children:p.jsx(wt,{variant:"h2",sx:{fontSize:"24px",fontWeight:"600",color:"#1a1a1a",marginBottom:"0",marginTop:"8px",paddingLeft:"0"},children:"Named Queries"})}),s.queries.map(E=>p.jsx(p$e,{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)&&p.jsxs(Ee,{sx:{textAlign:"center",py:6},children:[p.jsx(wt,{variant:"body1",sx:{color:"text.secondary",marginBottom:"8px"},children:"This model exposes no sources or queries."}),A&&p.jsxs(wt,{variant:"body2",color:"text.secondary",children:["It imports other files but re-exports nothing. Add"," ",p.jsxs("code",{children:["export ","{ source_name }"]})," to surface imported sources here."]})]}),p.jsx(rB,{open:m,onClose:()=>g(!1),resourceUri:t,data:s,title:`Model: ${i.split("/").pop()}`,existingQuery:y,initialSelectedSourceIndex:w,onChange:F,onSourceChange:L,givens:O,onGivensChange:P})]}),p.jsx(ph,{open:b!=="",autoHideDuration:6e3,onClose:()=>$(""),message:b})]})}function w$e(){const[e,t]=C.useState("");return p.jsxs(p.Fragment,{children:[p.jsx(Br,{title:"Copy link",children:p.jsx(no,{size:"small","aria-label":"Copy link",onClick:()=>{navigator.clipboard.writeText(window.location.href).then(()=>t("URL copied to clipboard!")).catch(()=>t("Failed to copy URL"))},sx:{color:"text.secondary"},children:p.jsx(s2,{fontSize:"small"})})}),p.jsx(ph,{open:e!=="",autoHideDuration:6e3,onClose:()=>t(""),message:e})]})}function P2e(e){const{modelPage:t,isLoadingStatus:n}=er();if(n)return p.jsx(Go,{text:"Fetching Model..."});if(t!=="viewer")return p.jsx(x$e,{...e});const{onChange:r,runOnDemand:o,headerActions:a,...i}=e;return p.jsx(d$e,{...i,headerActions:a??p.jsx(w$e,{})})}const S$e={"persist-source-refused":"persist-not-built","preaggregate-not-built":"rollup-not-built","preaggregate-join-one-key-repeated":"rollup-join-one-key-repeated","stored-native-schema-missing":"database-native-type-missing"};function C$e(e){const t=(r,o)=>`${r}\0${o.subject??""}\0${o.message??""}`,n=new Set(e.map(r=>t(r.code,r)));return e.filter(r=>{const o=r.code!==void 0?S$e[r.code]:void 0;return o===void 0||!n.has(t(o,r))})}function k$e({warnings:e}){const[t,n]=C.useState(!1),r=C$e(e??[]),o=r.filter(i=>i.severity==="error"),a=r.filter(i=>i.severity!=="error");return o.length===0&&a.length===0?null:p.jsxs(Wn,{sx:{gap:1,mb:4},children:[o.length>0&&p.jsxs(xo,{severity:"warning",children:[p.jsx(mY,{children:o.length===1?"1 problem in this package":`${o.length} problems in this package`}),p.jsx(JI,{findings:o})]}),a.length>0&&p.jsxs(Ee,{children:[p.jsxs(Hn,{size:"small","aria-expanded":t,onClick:()=>n(i=>!i),sx:{px:.5,color:"text.secondary"},children:[t?"Hide":"Show"," ",a.length," ",a.length===1?"note":"notes"]}),t&&p.jsx(Ee,{sx:{pl:.5,pt:.5},children:p.jsx(JI,{findings:a})})]})]})}function JI({findings:e}){return p.jsx(Wn,{component:"ul",sx:{m:0,p:0,listStyle:"none",gap:.75},children:e.map((t,n)=>p.jsxs(wt,{component:"li",variant:"body2",children:[t.model&&p.jsx(Ee,{component:"span",sx:{fontFamily:Fo,fontSize:"0.85em",mr:1},children:t.model}),t.message]},`${t.model??""}:${t.code??""}:${n}`))})}function $$e(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 E$e(e){return e.type==="code"}function R$e(e){return(e.text??"").split(`
510
+ `);b2(k,"typescript",$).then(R=>{i(R)})}},[t,$]),p.jsxs(Ee,{children:[a&&p.jsx(Ee,{sx:{marginBottom:"16px"},children:p.jsx(wt,{fontSize:"12px",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:p.jsx("div",{className:"content",dangerouslySetInnerHTML:{__html:a}})})}),p.jsxs(Ee,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[p.jsx(wt,{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}),p.jsx(Lp,{"aria-label":"Expand results",onClick:()=>l(!0),children:p.jsx(Gp,{})})]}),p.jsxs(g4,{sx:{position:"relative"},children:[r&&!d&&p.jsxs(Ee,{sx:{padding:"40px 20px",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[p.jsx(wt,{variant:"body2",color:"text.secondary",children:"Click Run to execute the query"}),p.jsx(Hn,{variant:"contained",startIcon:p.jsx(f$e,{}),onClick:()=>u(!0),children:"Run Query"})]}),w&&p.jsx(GR,{state:S,context:e,maxHeight:Mle,maxResultSize:o})]}),p.jsx(eB,{open:s,onClose:()=>l(!1),result:b?.data?.result||"",renderLogs:b?.data?.renderLogs,title:`Query: ${e}`})]})}function h$e(e){return e!=null}function m$e(e,t){const n=[],r=[];for(const a of e){if(a.name===void 0||h$e(t.get(a.name)))continue;if(a.default==null){n.push(a.name);continue}const i=j1(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 g$e(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 y$e({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a,givens:i,gate:s}){return Cn.useEffect(()=>{o&&o(t)},[t,o]),p.jsx(m4,{children:p.jsxs(x9,{spacing:2,component:"section",children:[p.jsx(b$e,{sourceAndPath:e[t],existingQuery:n,onChange:l=>{r&&r(l)},resourceUri:a,givens:i,gate:s}),p.jsx(f5,{height:"5px"})]})})}function NC(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function v$e({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a,givens:i,gate:s}){const[l,d]=Cn.useState(n||NC()),[u,m]=Cn.useState(void 0);Cn.useEffect(()=>{n&&d(n)},[n]);const[g,y]=Cn.useState([]),{MalloyExplorerProvider:x,QueryPanel:w,ResizableCollapsiblePanel:S,ResultPanel:b,SourcePanel:$}=r;Cn.useEffect(()=>{t&&t(l)},[t,l]);const{environmentName:k,packageName:R,versionId:O}=ko(a),{apiClients:P}=er(),D=Cn.useRef(void 0),A=hl({mutationFn:()=>{D.current=s,m({executionState:"running",query:l?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{A.reset(),m(void 0)},response:{}});const E=typeof l?.malloyQuery=="string"?l.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:l?.malloyQuery}).toMalloy();return d({...l,query:E}),P.models.executeQueryModel(k,R,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 z=JSON.parse(E.data.result);d({...l,malloyResult:z});const I=D.current;m(U=>U?{...U,executionState:"finished",response:{result:z,...I?.defaultsNote?{messages:[{severity:"INFO",title:I.defaultsNote}]}:{}}}:void 0)}},onError:E=>{console.error("Query execution error:",E);const z=E?.data?.message??E?.message??"The query could not be run.",I=[{severity:"ERROR",title:z}],U=D.current?.missing??[];(E?.status===403||/Access denied for source/i.test(z))&&U.length>0&&I.push({severity:"WARN",title:g$e(U)}),m(N=>N?{...N,executionState:"finished",response:{messages:I}}:void 0)}}),[F,L]=Cn.useState(e.sourceInfo.name);Cn.useEffect(()=>{F!==e.sourceInfo.name&&(L(e.sourceInfo.name),d(NC()),m(void 0))},[e,F]);const _=Cn.useCallback(E=>{d({...l,malloyQuery:E,malloyResult:void 0})},[l]);return F!==e.sourceInfo.name?p.jsx("div",{children:"Loading..."}):p.jsx(y4,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:p.jsx(x,{source:e.sourceInfo,query:l?.malloyQuery,topValues:[],onFocusedNestViewPathChange:y,focusedNestViewPath:g,onQueryChange:_,children:p.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[p.jsx(S,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:p.jsx($,{onRefresh:()=>d(NC())})}),p.jsx(S,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:p.jsx(w,{runQuery:()=>{console.log(`running query with: ${l?.malloyQuery}`);try{A.mutate()}catch(E){console.error("Error running query:",E)}}})}),p.jsx(b,{source:e.sourceInfo,draftQuery:l?.malloyQuery,setDraftQuery:E=>d({...l,malloyQuery:E}),submittedQuery:u,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function b$e(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([vo(()=>import("./index-D4DhR2vg.js"),__vite__mapDeps([5,0,1,2,6])),F0e()]).then(([l,d])=>{s&&(n(l),o(d),i(!1))}).catch(l=>{console.error("Failed to load Malloy components:",l),s&&i(!1)}),()=>{s=!1}},[]),a||!t||!r?p.jsx(qne,{children:p.jsx(y4,{children:p.jsx(f5,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):p.jsx(v$e,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function tB(e,t=!0){const{modelPath:n,environmentName:r,packageName:o,versionId:a}=ko(e),{apiClients:i}=er();return wo({queryKey:["package",r,o,n,a],queryFn:async()=>(await i.models.getModel(r,o,n,a)).data,enabled:t})}function nB({data:e,onChange:t,existingQuery:n,initialSelectedSourceIndex:r=0,onSourceChange:o,resourceUri:a,givens:i,onGivensChange:s,startingGivens:l}){const[d,u]=Cn.useState(r);Cn.useEffect(()=>{u(r)},[r]);const{data:m,isError:g,isLoading:y,error:x}=tB(a,!e),{environmentName:w,packageName:S,modelPath:b,versionId:$}=ko(a),k=e||m,R=Cn.useMemo(()=>k?.givens??[],[k]),O=gR({specs:R,loaded:!!k,params:i,onGivensChange:s,startingValues:l,documentKey:a,autorun:!0,environmentName:w??"",packageName:S??"",modelPath:b,versionId:$,documentName:b}),P=C.useMemo(()=>Zd(O.applied,O.declaredTypes),[O.applied,O.declaredTypes]),D=C.useMemo(()=>m$e(R,O.applied),[R,O.applied]);if(y&&!e)return p.jsx(Go,{text:"Fetching Model..."});if(g&&!e)return console.log("error",x),p.jsx(Xa,{error:x,context:`ModelExplorer > ${b}`});if(!k)return p.jsx(Go,{text:qd.loading});const A=(k?.sourceInfos||[]).map((L,_)=>{try{return JSON.parse(L)?.name||`Source ${_+1}`}catch{return`Source ${_+1}`}}),F=A[d]||"";return p.jsxs(Une,{variant:"outlined",children:[p.jsx(Vne,{children:p.jsx(Wn,{sx:{flexDirection:"row"},children:p.jsx(gwe,{size:"small",id:"size-small-standard",disablePortal:!0,options:A,value:F,onChange:(L,_)=>{if(!_)return;const E=A.indexOf(_);E>=0&&(u(E),o?.(E))},renderInput:L=>p.jsx(yr,{...L}),style:{width:350,marginTop:"3px",marginLeft:"6px",marginBottom:"8px"}})})}),p.jsx(A1,{...O.panel}),p.jsx(m4,{children:p.jsxs(Wn,{spacing:2,component:"section",children:[Array.isArray(k.sourceInfos)&&k.sourceInfos.length>0&&p.jsx(y$e,{sourceAndPaths:k.sourceInfos.map(L=>({sourceInfo:JSON.parse(L),modelPath:b})),selectedSourceIndex:d,existingQuery:n,onQueryChange:t,resourceUri:a,givens:P,gate:D}),p.jsx(Ee,{height:"5px"})]})})]})}function rB({open:e,onClose:t,resourceUri:n,data:r,title:o="Data Sources",hasValidImport:a=!0,existingQuery:i,initialSelectedSourceIndex:s,onChange:l,onSourceChange:d,givens:u,onGivensChange:m,startingGivens:g}){return p.jsxs(Fx,{open:e,onClose:t,fullScreen:!0,children:[p.jsxs(Bx,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o,p.jsx(no,{onClick:t,sx:{color:"text.secondary"},children:p.jsx(bh,{})})]}),p.jsx(_x,{children:a?p.jsx(nB,{resourceUri:n,data:r,existingQuery:i,initialSelectedSourceIndex:s,onChange:l,onSourceChange:d,givens:u,onGivensChange:m,startingGivens:g}):p.jsx("div",{children:"No valid import statement found in cell"})})]})}function x$e({onChange:e,resourceUri:t,runOnDemand:n=!1,maxResultSize:r=0,givens:o,onGivensChange:a}){const{modelPath:i}=ko(t),{data:s,isError:l,isLoading:d,error:u}=tB(t),[m,g]=Cn.useState(!1),[y,x]=Cn.useState(),[w,S]=Cn.useState(0),[b,$]=C.useState(""),[k,R]=Cn.useState({}),O=o??k,P=a??(E=>R(E)),D=s?.modelDef,A=Cn.useMemo(()=>{if(!D)return!1;try{const E=JSON.parse(D);return Array.isArray(E.imports)&&E.imports.length>0}catch{return!1}},[D]);if(d)return p.jsx(Go,{text:"Fetching Model..."});if(l)return console.log("error",u),p.jsx(Xa,{error:u,context:`Model > ${i}`});const F=E=>{x(E),e&&e(E)},L=E=>{S(E)},_=()=>{const E=window.location.href;navigator.clipboard.writeText(E).then(()=>$("URL copied to clipboard!")).catch(()=>$("Failed to copy URL"))};return p.jsxs(p.Fragment,{children:[p.jsxs(Ee,{sx:{position:"relative",maxWidth:"1200px",margin:"0 auto",paddingTop:"24px"},children:[Array.isArray(s?.sourceInfos)&&s.sourceInfos.length>0&&p.jsxs(Wn,{spacing:2,component:"section",children:[p.jsxs(Ee,{sx:{padding:"0 0 16px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[p.jsx(wt,{variant:"h1",sx:{fontSize:"28px",fontWeight:"600",color:"#1a1a1a",marginBottom:"8px",marginTop:"0",paddingLeft:"0"},children:"Sources"}),p.jsx(Br,{title:"Copy link",children:p.jsx(no,{size:"small","aria-label":"Copy link",onClick:_,sx:{color:"text.secondary"},children:p.jsx(s2,{fontSize:"small"})})})]}),p.jsx(nB,{data:s,onChange:F,onSourceChange:L,existingQuery:y,initialSelectedSourceIndex:w,resourceUri:t,givens:O,onGivensChange:P}),p.jsx(Lp,{"aria-label":"Expand results",sx:{position:"absolute",top:"90px",right:"4px",zIndex:2},onClick:()=>g(!0),children:p.jsx(Gp,{})})]}),s?.queries?.length>0&&p.jsxs(Wn,{spacing:2,component:"section",sx:{marginTop:"24px"},children:[p.jsx(Ee,{sx:{padding:"0 0 16px 0"},children:p.jsx(wt,{variant:"h2",sx:{fontSize:"24px",fontWeight:"600",color:"#1a1a1a",marginBottom:"0",marginTop:"8px",paddingLeft:"0"},children:"Named Queries"})}),s.queries.map(E=>p.jsx(p$e,{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)&&p.jsxs(Ee,{sx:{textAlign:"center",py:6},children:[p.jsx(wt,{variant:"body1",sx:{color:"text.secondary",marginBottom:"8px"},children:"This model exposes no sources or queries."}),A&&p.jsxs(wt,{variant:"body2",color:"text.secondary",children:["It imports other files but re-exports nothing. Add"," ",p.jsxs("code",{children:["export ","{ source_name }"]})," to surface imported sources here."]})]}),p.jsx(rB,{open:m,onClose:()=>g(!1),resourceUri:t,data:s,title:`Model: ${i.split("/").pop()}`,existingQuery:y,initialSelectedSourceIndex:w,onChange:F,onSourceChange:L,givens:O,onGivensChange:P})]}),p.jsx(ph,{open:b!=="",autoHideDuration:6e3,onClose:()=>$(""),message:b})]})}function w$e(){const[e,t]=C.useState("");return p.jsxs(p.Fragment,{children:[p.jsx(Br,{title:"Copy link",children:p.jsx(no,{size:"small","aria-label":"Copy link",onClick:()=>{navigator.clipboard.writeText(window.location.href).then(()=>t("URL copied to clipboard!")).catch(()=>t("Failed to copy URL"))},sx:{color:"text.secondary"},children:p.jsx(s2,{fontSize:"small"})})}),p.jsx(ph,{open:e!=="",autoHideDuration:6e3,onClose:()=>t(""),message:e})]})}function j2e(e){const{modelPage:t,isLoadingStatus:n}=er();if(n)return p.jsx(Go,{text:"Fetching Model..."});if(t!=="viewer")return p.jsx(x$e,{...e});const{onChange:r,runOnDemand:o,headerActions:a,...i}=e;return p.jsx(d$e,{...i,headerActions:a??p.jsx(w$e,{})})}const S$e={"persist-source-refused":"persist-not-built","preaggregate-not-built":"rollup-not-built","preaggregate-join-one-key-repeated":"rollup-join-one-key-repeated","stored-native-schema-missing":"database-native-type-missing"};function C$e(e){const t=(r,o)=>`${r}\0${o.subject??""}\0${o.message??""}`,n=new Set(e.map(r=>t(r.code,r)));return e.filter(r=>{const o=r.code!==void 0?S$e[r.code]:void 0;return o===void 0||!n.has(t(o,r))})}function k$e({warnings:e}){const[t,n]=C.useState(!1),r=C$e(e??[]),o=r.filter(i=>i.severity==="error"),a=r.filter(i=>i.severity!=="error");return o.length===0&&a.length===0?null:p.jsxs(Wn,{sx:{gap:1,mb:4},children:[o.length>0&&p.jsxs(xo,{severity:"warning",children:[p.jsx(mY,{children:o.length===1?"1 problem in this package":`${o.length} problems in this package`}),p.jsx(JI,{findings:o})]}),a.length>0&&p.jsxs(Ee,{children:[p.jsxs(Hn,{size:"small","aria-expanded":t,onClick:()=>n(i=>!i),sx:{px:.5,color:"text.secondary"},children:[t?"Hide":"Show"," ",a.length," ",a.length===1?"note":"notes"]}),t&&p.jsx(Ee,{sx:{pl:.5,pt:.5},children:p.jsx(JI,{findings:a})})]})]})}function JI({findings:e}){return p.jsx(Wn,{component:"ul",sx:{m:0,p:0,listStyle:"none",gap:.75},children:e.map((t,n)=>p.jsxs(wt,{component:"li",variant:"body2",children:[t.model&&p.jsx(Ee,{component:"span",sx:{fontFamily:Fo,fontSize:"0.85em",mr:1},children:t.model}),t.message]},`${t.model??""}:${t.code??""}:${n}`))})}function $$e(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 E$e(e){return e.type==="code"}function R$e(e){return(e.text??"").split(`
511
511
  `).filter(t=>!t.trimStart().startsWith("##")).join(`
512
- `)}const T$e=rn(p.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 M$e({cell:e,resourceUri:t,showCopyLink:n,maxResultSize:r,isExecuting:o,pendingRerun:a,onNavigate:i,onDrillSelf:s,canDrillSelf:l,onDrillNavigate:d,givens:u,givenSpecs:m}){const[g,y]=Cn.useState(!1),[x,w]=Cn.useState(!1),[S,b]=Cn.useState(),[$,k]=Cn.useState(!1),{modelPage:R,isLoadingStatus:O}=er(),P=!O&&R!=="viewer",[D,A]=C.useState(""),{environmentName:F,packageName:L,modelPath:_}=ko(t),E={environmentName:F,packageName:L,sourcePath:_,onNavigate:i},{drill:z,drillMenu:I}=K_({onNavigate:d,onSelf:s,canSelf:l}),U=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,N=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,q=!!e.text&&(U.test(e.text)||N.test(e.text)),Y=()=>{if(!e.newSources||e.newSources.length===0)return 0;let X=[],se="";if(e.text){const J=e.text.match(U);J&&(X=J[1].split(",").map(G=>G.trim()));const Z=e.text.match(N);Z&&(se=Z[1].trim())}for(let J=0;J<e.newSources.length;J++)try{const Z=JSON.parse(e.newSources[J]);if(X.length>0&&X.includes(Z.name)||se&&se===Z.path)return J}catch{continue}return 0},oe=Cn.useMemo(()=>e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:t,givens:m}:void 0,[e.newSources,t,m]),{mode:Q}=Hr();C.useEffect(()=>{e.type==="code"&&b2(R$e(e),"malloy",Q).then(X=>{b(X)})},[e,Q]);const ae=()=>{const X=window.location.href;navigator.clipboard.writeText(X).then(()=>A("URL copied to clipboard!")).catch(()=>A("Failed to copy URL"))},de=p.jsx(Oo,{open:g,onClose:()=>y(!1),title:"Malloy code",maxWidth:"lg",showClose:!0,children:p.jsx(Ee,{sx:X=>({border:`1px solid ${X.palette.divider}`,borderRadius:"8px",padding:"16px",fontFamily:Fo,fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:X.palette.background.paper,color:X.palette.text.primary}),children:p.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:S}})})});return e.type==="markdown"&&p.jsx(Ee,{children:p.jsxs(QR,{children:[n?p.jsxs(Wn,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[p.jsx(xy,{variant:"document",links:E,children:e.text}),p.jsx(Br,{title:"Copy link",children:p.jsx(no,{"aria-label":"Copy link",onClick:ae,sx:{color:"text.secondary",mt:"18px"},children:p.jsx(s2,{sx:{fontSize:"24px"}})})})]}):p.jsx(xy,{variant:"document",links:E,children:e.text}),p.jsx(ph,{open:D!=="",autoHideDuration:6e3,onClose:()=>A(""),message:D})]})})||e.type==="code"&&p.jsxs(Ee,{children:[e.newSources&&e.newSources.length>0&&p.jsx(Wn,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:p.jsx(g4,{sx:{position:"relative",padding:"0"},children:p.jsxs(Ee,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[S&&p.jsx("span",{dangerouslySetInnerHTML:{__html:S},style:{fontFamily:Fo,fontSize:"14px",flex:1,marginRight:"8px"}}),q&&P&&p.jsx(Lp,{"aria-label":"Data sources",sx:{flexShrink:0},onClick:()=>k(!0),children:p.jsx(Gp,{})})]})})}),p.jsx(rB,{open:$&&P,onClose:()=>k(!1),title:"Data Sources",hasValidImport:q,resourceUri:t,data:oe,initialSelectedSourceIndex:Y(),startingGivens:u}),de,p.jsx(eB,{open:x,onClose:()=>w(!1),result:e.result||"",title:"Results",drill:z}),o&&!e.result&&!e.error&&!q&&!(e.newSources&&e.newSources.length>0)&&p.jsx(Z0,{children:p.jsx(Ee,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:p.jsx(Cu,{size:32})})}),!e.result&&e.error&&p.jsx(bF,{summary:"This cell could not be run.",detail:e.error}),e.result&&a&&p.jsx(uz,{"aria-label":"Re-run pending",sx:{mb:1,height:2,borderRadius:1}}),e.result&&p.jsxs(Z0,{children:[p.jsx(w_,{title:"",action:p.jsxs(Wn,{direction:"row",sx:{gap:.5,mt:"-4px"},children:[p.jsx(Lp,{"aria-label":"Malloy code",onClick:X=>{X.stopPropagation(),y(!0)},children:p.jsx(T$e,{})}),p.jsx(Lp,{"aria-label":"Expand results",onClick:()=>w(!0),children:p.jsx(Gp,{})})]})}),p.jsx(D1,{result:e.result,maxHeight:Ele,maxResultSize:r,drill:z}),I]})]})}function O$e({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 P$e=4;function j$e(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 A$e({resourceUri:e,maxResultSize:t=0,givens:n,onGivensChange:r,onNavigate:o,onDrillNavigate:a,actions:i,notebook:s,runCell:l}){const{environmentName:d,packageName:u,versionId:m,modelPath:g}=ko(e),[y,x]=C.useState([]),[w,S]=C.useState(!1),[b,$]=C.useState(!1),k=C.useRef(void 0),[R,O]=C.useState(null),P=$$e(s),D=s.autorun!==!1,A=y1(),F=gR({specs:P,loaded:!0,startingValues:s.startingGivens,params:n,onGivensChange:r,documentKey:e,autorun:D,environmentName:d,packageName:u,modelPath:g,versionId:m,documentName:g}),{applied:L,declaredTypes:_,canSelf:E,onSelf:z}=F,I=C.useCallback(Z=>{const G=Zd(Z,_);return Object.keys(G).length>0?JSON.stringify(G):void 0},[_]),U=C.useMemo(()=>m0(L,_),[L,_]),N=C.useRef(0),q=C.useRef(null),Y=C.useRef(null),oe=C.useRef(void 0);C.useEffect(()=>()=>{q.current?.abort(),Y.current=null,clearTimeout(oe.current?.timer),oe.current=void 0},[]);const Q=C.useCallback(async(Z=new Map)=>{if(!s.notebookCells)return;const G=++N.current;q.current?.abort();const ue=new AbortController;q.current=ue,x(s.notebookCells.map(ie=>({...ie}))),S(!0),O(null);try{const ie=[];for(let he=0;he<s.notebookCells.length;he++){const me=s.notebookCells[he];if(!E$e(me))continue;const le=he,ve=async()=>{try{const Le=await l({cell:me,givens:Z,declaredTypes:_,signal:ue.signal});if(N.current!==G)return;const Ie=Le.result;x(Re=>{const ne=[...Re];return ne[le]||(ne[le]={...me}),ne[le]={...ne[le],result:Ie},ne})}catch(Le){if(ue.signal.aborted||N.current!==G)return;A.emit({type:"report.query_failed",tile:le,category:V0(Le)}),A.listening||console.error(`Error executing cell ${le}:`,Le);const Ie=j$e(Le);x(Re=>{const ne=[...Re];return ne[le]||(ne[le]={...me}),ne[le]={...ne[le],error:Ie},ne})}};ie.push(ve)}const fe=[];for(const he of ie){const me=he().then(()=>{fe.splice(fe.indexOf(me),1)});fe.push(me),fe.length>=P$e&&await Promise.race(fe)}await Promise.all(fe)}catch(ie){if(ue.signal.aborted||N.current!==G)return;A.emit({type:"report.query_failed",category:V0(ie)}),A.listening||console.error("Error executing notebook cells:",ie),O(ie)}finally{N.current===G&&(S(!1),q.current=null)}},[s,_,l,A]),ae=C.useRef(0),de=C.useRef(void 0);de.current!==s&&(de.current=s,ae.current+=1);const X=ae.current;C.useEffect(()=>{const Z=`${e}|${X}`,G=`${Z}|${I(L)??""}`;k.current!==void 0&&k.current!==Z&&(q.current?.abort(),q.current=null),k.current=Z;const ue=O$e({ready:!!s.notebookCells,lastRunKey:Y.current,pendingKey:oe.current?.key,runKey:G,documentKey:Z});if(ue.cancelPending&&(clearTimeout(oe.current?.timer),oe.current=void 0,$(!1)),ue.dispatch==="none")return;const ie=()=>{oe.current=void 0,$(!1),Y.current=G,Q(L)};if(ue.dispatch==="now"){ie();return}$(!0),oe.current={key:G,timer:setTimeout(ie,a_)}},[s,X,e,L,I,Q]);const se=y.length>0?y:s.notebookCells||[],J=0;return p.jsxs(y$,{layout:"linear",header:i?p.jsx(Wn,{direction:"row",sx:{justifyContent:"flex-end"},children:i}):null,controls:F.panel.givens.length>0?p.jsx(S_,{children:p.jsx(A1,{...F.panel,layout:"bar"})}):void 0,children:[se.map((Z,G)=>p.jsx(M$e,{cell:Z,showCopyLink:G===J,resourceUri:e,maxResultSize:t,isExecuting:w,givens:U,givenSpecs:P,pendingRerun:b,onNavigate:o,onDrillNavigate:a,onDrillSelf:P.length>0?z:void 0,canDrillSelf:E},G)),R&&p.jsx(Xa,{error:{message:R.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})}function D$e({environmentName:e,packageName:t,versionId:n,path:r,notebook:o,...a}){const{apiClients:i,server:s}=er(),l=C.useCallback(async({cell:d,givens:u,declaredTypes:m,signal:g})=>{const y=d.runQuery;if(y===void 0)return{};g.throwIfAborted();const x=Zd(u,m),w={environmentName:e,packageName:t,versionId:n,modelPath:r,query:y,givens:Object.keys(x).length>0?x:void 0},S=[...A_(w),s],b=()=>dy.fetchQuery({queryKey:S,queryFn:({signal:k})=>D_(i,w,k),...S4}),$=()=>void dy.cancelQueries({queryKey:S,exact:!0});g.addEventListener("abort",$,{once:!0});try{let k;try{k=await b()}catch(R){if(!mee(R)||g.aborted)throw R;k=await b()}return{result:k.data.result}}finally{g.removeEventListener("abort",$)}},[i,s,e,t,r,n]);return p.jsx(A$e,{...a,resourceUri:I1({environmentName:e,packageName:t,modelPath:r,versionId:n}),notebook:o,runCell:l})}function N$e({resourceUri:e,path:t,givens:n,onGivensChange:r,onNavigate:o,onLinkNavigate:a,height:i,maxResultSize:s,onEvent:l,chrome:d,manifestStaleTime:u,actions:m,rowsActions:g}){const y=ko(e),{apiClients:x}=er(),w=y.environmentName??"",S=y.packageName??"",b=y.versionId,$=!!y.environmentName&&!!y.packageName,{data:k,isSuccess:R,isError:O,error:P}=wo({...ixe(x,{environmentName:w,packageName:S,path:t,versionId:b},u),enabled:$&&t!==""}),D=k?.layout,A=Jle({path:t,layout:D},l),F=`${e}|${t}`,L=C.useRef(void 0),_=C.useRef({key:F,at:Od()});_.current.key!==F&&(_.current={key:F,at:Od()}),C.useEffect(()=>{L.current!==F&&($?O?(L.current=F,A.emit({type:"report.load_failed",surface:"view",category:V0(P)})):R&&k&&(L.current=F,A.emit({type:"report.opened",surface:"view",from:"package",tiles:k.tiles?.length??k.notebook?.notebookCells?.filter(U=>U.type==="code"&&U.runQuery!==void 0).length??0,durationMs:Od()-_.current.at})):(L.current=F,A.emit({type:"report.load_failed",surface:"view",category:"invalid"})))},[F,$,O,P,R,k,A]);const E=C.useCallback((U,N)=>{const q=o?.(U,N);q&&A.emit({type:"report.drill",to:"report",outcome:q})},[o,A]),z=o?E:void 0;if(!$)return p.jsxs(xo,{severity:"error",children:["A report resource URI must name an environment and a package. Received: ",e]});if(O)return p.jsx(Xa,{context:`${w} > ${S} > ${t}`,error:P});if(!R||!k)return p.jsx(Go,{text:qd.opening("report")});const I=k.notebook?.format==="malloynb"?p.jsx(D$e,{environmentName:w,packageName:S,versionId:b,path:t,notebook:k.notebook,givens:n,onGivensChange:r,onNavigate:a,onDrillNavigate:z,maxResultSize:s,...m!==void 0?{actions:m}:{}}):p.jsx(Bxe,{manifest:k,environmentName:w,packageName:S,versionId:b,documentName:t,givens:n,onGivensChange:r,onNavigate:z,...a?{onLinkNavigate:a}:{},height:i,maxResultSize:s,chrome:d,...m!==void 0?{actions:m}:{},...g!==void 0?{rowsActions:g}:{}});return p.jsx(wF.Provider,{value:A,children:I})}function I$e({open:e,layout:t,kind:n,allowLayoutChange:r,allowKindChange:o,environmentName:a,packageName:i,versionId:s,models:l,modelsLoading:d=!1,modelsError:u,onRetryModels:m,target:g,savedAs:y,onClose:x,onCreated:w,onEvent:S}){const b=t??(n?j_(n):"linear"),$=r??o??!0,[k,R]=C.useState(b),[O,P]=C.useState(void 0),[D,A]=C.useState(""),[F,L]=C.useState(""),[_,E]=C.useState(""),z=C.useRef(null),[I,U]=C.useState(""),[N,q]=C.useState(!1),[Y,oe]=C.useState(!1),[Q,ae]=C.useState(!1),[de,X]=C.useState(void 0),se=u!=null,{choices:J,isLoading:Z,isSuccess:G,failed:ue,retry:ie,canRetry:fe}=oxe({environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},models:l,enabled:e&&l.length>0}),he=C.useMemo(()=>J.get(D)??[],[J,D]),me=C.useMemo(()=>new Map([...J.entries()].flatMap(([st,At])=>At.map(tn=>[IC(st,tn.source,tn.view),{model:st,source:tn.source,view:tn.view}]))),[J]),le=C.useMemo(()=>{const st=J.size>1;return[...J.entries()].flatMap(([At,tn])=>{const Bt=new Map;for(const an of tn)Bt.set(an.source,[...Bt.get(an.source)??[],an]);return[...Bt.entries()].map(([an,$n])=>({key:`${At}::${an}`,label:an,ariaLabel:`${an} in ${At}`,...st||$n[0]?.sourceDescription?{detail:[st?At:void 0,$n[0]?.sourceDescription].filter(Boolean).join(" · ")}:{},entries:$n.map(Vt=>({key:IC(At,Vt.source,Vt.view),name:Vt.view,title:Vt.description??vC(Vt.view),...Vt.chart?{chart:Vt.chart}:{}}))}))})},[J]),ve=st=>{const At=me.get(st);At&&(A(At.model),L(`${At.source}::${At.view}`))},Le=he.find(st=>`${st.source}::${st.view}`===F),Ie=Le?IC(D,Le.source,Le.view):void 0,Re=L$e(Le,250);C.useEffect(()=>{e&&R(b)},[e,b]),C.useEffect(()=>{if(!e)return;const st=[...J.keys()];D===""&&st.length>0&&A(st[0])},[e,J,D]),C.useEffect(()=>{!e||he.length===0||F!==""||L(`${he[0].source}::${he[0].view}`)},[e,he,F]),C.useEffect(()=>{!e||N||Le===void 0||U(vC(Le.view))},[e,N,Le]),C.useEffect(()=>{e||(A(""),L(""),E(""),U(""),q(!1),P(void 0),oe(!1),X(void 0))},[e]);const ne=C.useMemo(()=>{if(I.trim()!=="")for(let st=1;st<=e2;st++){const At=T_(I,st);if(!g.existing?.includes(At))return At}},[I,g]),qe=O?.trim(),Oe=qe===void 0||qe===""?void 0:qe.endsWith(".malloy")?qe:`${qe}.malloy`,Qe=Oe??ne,nt=Oe===void 0?void 0:M_(Oe)??(g.existing?.includes(Oe)?`${Oe} already exists; choose another location.`:void 0),kt=(Le===void 0?void 0:ZR({title:I,modelPath:D,source:Le.source,view:Le.view}))??(I.trim()!==""&&Qe===void 0?"No free file name for this title; choose another.":void 0),Ut=kt!==void 0&&(Y||I.trim()!==""),at=d||Z,{theme:et}=Hr(),pt=et.ui,ze=Xd(et.cardBorder),be=J.size===0&&(se||ue.length>0),He=at?"Loading the model":be?"Couldn't read the model to start from":J.size===0?"Nothing in the model to start from yet":Le===void 0?"Pick what to start from":void 0,Me="report",$t=Q?`Creating ${Me}…`:`Create ${Me}`,Et=F!==""&&Le===void 0&&he.length>0,vt=async()=>{if(!(He!==void 0||Le===void 0||Q)){if(kt!==void 0||nt!==void 0){oe(!0);return}ae(!0),X(void 0);try{const st=await Z0e({layout:k,...Oe!==void 0?{path:Oe}:{},document:{title:I,modelPath:D,source:Le.source,view:Le.view},target:g,...S?{onEvent:S}:{}});w(st)}catch(st){const At=st.response?.data?.message;X(At??(st instanceof Error?st.message:String(st)))}finally{ae(!1)}}},it=st=>p.jsx(Hn,{color:"inherit",size:"small",onClick:st,children:"Retry"});return p.jsx(Oo,{className:`${Sl.dialog} ${Sl.newReportDialog}`,maxWidth:"md",initialFocus:z,open:e,onClose:Q?()=>{}:x,title:`New ${Me}`,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:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{onClick:x,disabled:Q,children:"Cancel"}),p.jsx(Br,{title:Q?"":He??"",children:p.jsx("span",{children:p.jsx(Hn,{variant:"contained",disabled:Q||He!==void 0,"aria-label":!Q&&He!==void 0?`${$t}: ${He}`:$t,onClick:()=>void vt(),children:$t})})})]}),children:p.jsxs(Wn,{sx:{gap:1.5},children:[se?p.jsx(xo,{severity:"error",action:m&&D4(u)?it(m):void 0,children:"Couldn't read this package's models, so no view is listed to start from."}):l.length===0?!d&&p.jsxs(xo,{severity:"info",children:["This package has no models yet. Add a .malloy file that declares a source with a view, then create a ",Me," from it."]}):ue.length>0?p.jsxs(xo,{severity:"warning",action:fe?it(ie):void 0,children:["Couldn't read ",ue.join(", "),", so nothing from"," ",ue.length===1?"it":"them"," is listed."]}):G&&J.size===0&&p.jsxs(xo,{severity:"info",children:["A ",Me," 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."]}),p.jsxs(Ee,{sx:{mx:-3,mb:-1,borderTop:`1px solid ${ze}`,borderBottom:`1px solid ${ze}`,display:"grid",gridTemplateColumns:{xs:"1fr",md:"320px minmax(0, 1fr)"},height:{md:500}},children:[p.jsx(Ee,{sx:{display:"flex",flexDirection:"column",minHeight:0,borderRight:{md:`1px solid ${ze}`},maxHeight:{xs:280,md:"none"}},children:p.jsx(Sle,{groups:le,query:_,onQuery:E,picked:Ie,onPick:ve,onTake:st=>{ve(st)},searchRef:z,disabled:Q,empty:p.jsx(wt,{variant:"body2",sx:{color:"text.secondary",p:2},children:at?"Reading the package's models…":"Nothing to start from."})})}),p.jsxs(Ee,{sx:st=>({p:2.5,display:"flex",flexDirection:"column",gap:2,minHeight:0,overflowY:"auto",bgcolor:`color-mix(in srgb, ${st.palette.text.primary} 3%, ${st.palette.background.paper})`}),children:[$&&p.jsxs(Ee,{children:[p.jsx(eL,{children:"Layout"}),p.jsx(Ee,{role:"radiogroup","aria-label":"Layout",sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:["linear","grid"].map(st=>p.jsx(_$e,{layout:st,checked:k===st,disabled:Q,onPick:()=>R(st)},st))}),p.jsx(wt,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"Switch it any time in the builder."})]}),p.jsxs(Ee,{children:[p.jsx(eL,{children:"First query"}),p.jsx(Ee,{role:"region","aria-label":"Preview",sx:st=>({height:200,display:"flex",position:"relative",overflow:"hidden",borderRadius:pt.radius.tile,border:`1px solid ${ze}`,bgcolor:st.palette.background.paper,"&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:40,pointerEvents:"none",background:`linear-gradient(to bottom, transparent, ${st.palette.background.paper})`}}),children:Le&&Re?p.jsx(Ee,{sx:{flex:1,minWidth:0,px:2,pt:1.5},children:p.jsx(z_,{environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},modelPath:D,tile:`${Re.source} -> ${Re.view}`,label:I.trim()||vC(Re.view),borderless:!0,givens:z$e,declaredTypes:F$e,height:180})}):p.jsx(wt,{variant:"body2",sx:{color:"text.secondary",m:"auto"},children:Et?"What you picked is no longer in this model; pick something else.":"Pick what to start from."})}),p.jsx(wt,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"More are added in the builder."})]}),p.jsx(ki,{size:"small",label:"Title",value:I,disabled:Q,onChange:st=>{q(!0),U(st.target.value)},InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Report title"},error:Ut,helperText:Ut?kt:g.route==="package"?"Names the file too, unless you type a location.":y??`Saved as a new ${Me} in the host's store, and opened in the builder.`}),p.jsx(ki,{size:"small",label:"Location",value:O??ne??"",placeholder:"report.malloy",disabled:Q,onChange:st=>P(st.target.value),InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Location"},error:nt!==void 0,helperText:nt??(Qe?`Written as ${Qe} in the package, and opened in the builder.`:"A path in the package; the package root by default.")}),de&&p.jsx(xo,{severity:"error",children:de})]})]})]})})}function L$e(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 IC=(e,t,n)=>`${e}::${t}::${n}`,z$e=new Map,F$e=new Map;function eL({children:e}){const t=Hr().theme.ui;return p.jsx(wt,{component:"div",sx:{...t.type.label,color:"text.secondary",mb:.75},children:e})}function _$e({layout:e,checked:t,disabled:n,onPick:r}){const{theme:o}=Hr(),a=o.ui,i=Xd(o.cardBorder),s=t?o.accent:"currentColor";return p.jsxs(rs,{role:"radio","aria-checked":t,"aria-label":e==="linear"?"Linear":"Grid",disabled:n,onClick:r,sx:l=>({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%, ${l.palette.background.paper})`:l.palette.background.paper,color:l.palette.text.secondary,textAlign:"left"}),children:[p.jsx("svg",{width:"34",height:"26",viewBox:"0 0 34 26","aria-hidden":!0,children:e==="linear"?p.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[p.jsx("rect",{x:"3",y:"2",width:"28",height:"7",rx:"1.5"}),p.jsx("rect",{x:"3",y:"12",width:"28",height:"5",rx:"1.5"}),p.jsx("path",{d:"M5 21.5h20",strokeLinecap:"round"})]}):p.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[p.jsx("rect",{x:"2",y:"2",width:"14",height:"10",rx:"1.5"}),p.jsx("rect",{x:"18",y:"2",width:"14",height:"10",rx:"1.5"}),p.jsx("rect",{x:"2",y:"14",width:"30",height:"10",rx:"1.5"})]})}),p.jsxs(Ee,{children:[p.jsx(Ee,{sx:{...a.type.control,fontWeight:t?a.type.label.fontWeight:500,color:t?o.accent:"text.primary"},children:e==="linear"?"Linear":"Grid"}),p.jsx(Ee,{sx:{...a.type.caption,color:"text.secondary"},children:e==="linear"?"Read top to bottom":"Tiles side by side"})]})]})}const B$e=rn(p.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"})),U$e=rn(p.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),V$e=rn(p.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"})),q$e=rn(p.jsx("path",{d:"M20 10V8h-4V4h-2v4h-4V4H8v4H4v2h4v4H4v2h4v4h2v-4h4v4h2v-4h4v-2h-4v-4zm-6 4h-4v-4h4z"})),oB={dashboard:pr.blue,report:pr.violet,model:pr.cyan,dataApp:pr.pink,data:pr.lime,materialization:pr.amber,agent:pr.red};function aB({type:e,size:t=18,sx:n,...r}){return p.jsx(U0,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:H$e[e]()})}const H$e={report:W$e,model:Y$e,data:G$e,materialization:K$e,dataApp:Z$e,dashboard:Q$e,agent:X$e};function W$e(){return p.jsxs(p.Fragment,{children:[p.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"}),p.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),p.jsx("path",{d:"M8 17 v-3"}),p.jsx("path",{d:"M12 17 v-6"}),p.jsx("path",{d:"M16 17 v-4"})]})}function Y$e(){return p.jsxs(p.Fragment,{children:[p.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),p.jsx("path",{d:"M4 7 l8 4 l8 -4"}),p.jsx("path",{d:"M12 11 v10"})]})}function G$e(){return p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),p.jsx("path",{d:"M3.5 9.5 H20.5"}),p.jsx("path",{d:"M9.5 3.5 V20.5"})]})}function K$e(){return p.jsxs(p.Fragment,{children:[p.jsx("path",{d:"M12 3 L21 7.5 L12 12 L3 7.5 Z"}),p.jsx("path",{d:"M3 12 L12 16.5 L21 12"}),p.jsx("path",{d:"M3 16.5 L12 21 L21 16.5"})]})}function Q$e(){return p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),p.jsx("path",{d:"M3.5 9.5 H20.5"}),p.jsx("path",{d:"M12 9.5 V20.5"}),p.jsx("path",{d:"M12 15 H20.5"})]})}function X$e(){return p.jsxs(p.Fragment,{children:[p.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),p.jsx("path",{d:"M5 20 a7 7 0 0 1 14 0"})]})}function Z$e(){return p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),p.jsx("path",{d:"M3.5 9.5 H20.5"}),p.jsx("path",{d:"M7 13.5 H17"}),p.jsx("path",{d:"M7 16.5 H13"})]})}function iB(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 J$e=12;function eEe(e){const t=e?.trim().toLowerCase()??"";if(t.startsWith("array")||t.endsWith("[]"))return U$e;if(t.startsWith("record")||t.startsWith("struct"))return V$e;switch(t.split(/[\s(<]/)[0]){case"string":return B$e;case"number":return q$e;case"date":return A6;case"timestamp":case"timestamptz":return N6;case"boolean":return I6;default:return L6}}function tEe({column:e}){const t=eEe(e.type);return p.jsxs(Ee,{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:[p.jsx(t,{"aria-hidden":!0,sx:{fontSize:18,color:"primary.main",flexShrink:0}}),p.jsxs(Ee,{sx:{display:"flex",alignItems:"baseline",gap:1,minWidth:0,flex:1},children:[p.jsx(wt,{component:"span",sx:{fontFamily:Fo,fontSize:"0.8125rem",fontWeight:500,color:"text.primary",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),e.type&&p.jsx(wt,{component:"span",variant:"caption",color:"text.secondary",sx:{flexShrink:0,maxWidth:"50%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.type})]})]})}function nEe({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,l]=C.useState(r?.path);s!==r?.path&&(l(r?.path),i(""));const d=C.useId(),u=r?.path??"",m=u.split("/").pop()||u,g=u.slice(0,Math.max(0,u.length-m.length-1)),y=r?.info?.rowCount,x=[g,y===void 0?null:iB(y)].filter(Boolean).join(" · "),w=C.useMemo(()=>r?.info?.columns??[],[r]),S=a.trim().toLowerCase(),b=C.useMemo(()=>S?w.filter($=>$.name?.toLowerCase().includes(S)||$.type?.toLowerCase().includes(S)):w,[w,S]);return p.jsxs(Oo,{open:n,onClose:t,showClose:!0,title:p.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1.5,sx:{minWidth:0},children:[p.jsx(Ee,{"aria-hidden":!0,sx:{width:32,height:32,borderRadius:1,bgcolor:oB.data,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:p.jsx(aB,{type:"data",size:18})}),p.jsxs(Ee,{sx:{minWidth:0},children:[p.jsx(wt,{component:"span",noWrap:!0,title:u,sx:{display:"block",fontFamily:Fo,fontSize:"1rem",fontWeight:600,letterSpacing:0,lineHeight:1.4},children:m||"Columns"}),x&&p.jsx(wt,{component:"span",variant:"caption",color:"text.secondary",noWrap:!0,sx:{display:"block",lineHeight:1.4},children:x})]})]}),children:[r?.error&&p.jsx(xo,{severity:"error",variant:"outlined",children:r.error}),r&&!r.error&&p.jsxs(Ee,{component:"section","aria-labelledby":d,sx:{display:"flex",flexDirection:"column",border:"1px solid",borderColor:"divider",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",mb:2},children:[p.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1,sx:{px:1.5,py:1,minHeight:44,borderBottom:"1px solid",borderColor:"divider"},children:[p.jsxs(wt,{id:d,component:"h3",sx:{fontSize:"0.875rem",fontWeight:600},children:["Columns",p.jsxs(wt,{component:"span",variant:"caption",color:"text.secondary",sx:{ml:.75,fontVariantNumeric:"tabular-nums"},children:["· ",S?`${b.length} of `:"",w.length]})]}),w.length>J$e&&p.jsx(zx,{value:a,onChange:$=>i($.target.value),placeholder:"Filter columns",inputProps:{"aria-label":"Filter columns"},startAdornment:p.jsx(ME,{position:"start",children:p.jsx(Gp,{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"}}})]}),p.jsx(Ee,{sx:{overflowY:"auto",maxHeight:420,px:.75,py:.75},children:b.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic",px:1,py:1},children:S?"No columns match":"No columns"}):p.jsx(Ee,{component:"ul","aria-labelledby":d,sx:{listStyle:"none",m:0,p:0},children:b.map(($,k)=>p.jsx(tEe,{column:$},`${$.name}-${k}`))})})]})]})}const sB=(e,t,n)=>["packageVersions",e,t,n];async function lB(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 rEe(e,t,n={}){const{apiClients:r,server:o}=er(),a=(n.enabled??!0)&&e!==""&&t!=="",i=Ld({queryKey:sB(e,t,o),queryFn:()=>lB(r,e,t),enabled:a,staleTime:3e4,retry:!1}),{refetch:s}=i,l=C.useCallback(()=>void s(),[s]),d=i.data??[];return{versions:d,latest:d.find(u=>u.latest)?.id,isPending:a&&i.isPending,isError:a&&i.isError,refetch:l}}function oEe(e,t){const{apiClients:n,server:r}=er(),o=Tl();return C.useCallback(()=>o.fetchQuery({queryKey:sB(e,t,r),queryFn:()=>lB(n,e,t),staleTime:0,retry:!1}),[o,n,r,e,t])}function aEe(e,t){const n=Tl();return C.useCallback(()=>n.invalidateQueries({predicate:r=>r.queryKey[1]===e&&r.queryKey[2]===t}),[n,e,t])}const iEe=rn(p.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"})),sEe=rn(p.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"})),lEe=rn(p.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"})),cEe=rn(p.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"})),mg=e=>{const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error?e.message:"Unknown error"},uEe=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},Rp=e=>e.archiveStatus==="archive",LC="Tables built for this version alone (under scope: version) are dropped.";function tL(e,t){const n=!Rp(e)&&t.filter(o=>!Rp(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 dEe({environmentName:e,packageName:t,versions:n,selectedVersionId:r,onSelectVersion:o,onReplaceVersion:a,onPackageDeleted:i,canManage:s}){const{apiClients:l}=er(),d=Tl(),u=aEe(e,t),m=oEe(e,t),[g,y]=C.useState(null),[x,w]=C.useState(null),[S,b]=C.useState(null),[$,k]=C.useState(null),[R,O]=C.useState(null),[P,D]=C.useState(null),A=C.useRef(null),F=C.useRef(null),L=C.useRef(null),_=C.useRef(new Map),E=n.find(fe=>fe.latest)?.id,z=r??E,I=()=>Promise.all([u(),d.invalidateQueries({queryKey:["packages",e]})]),U=async(fe,he)=>{const me=he??await m().catch(()=>{});if(me===void 0)return;const le=me.find(Le=>Le.latest)?.id,ve=le??me.find(Le=>Le.id!==fe&&!Rp(Le))?.id;ve!==void 0&&(a?a(ve===le?void 0:ve):o(ve))},N=a0({mutationFn:fe=>l.versions.setPackageLatestVersion(e,t,{version:fe}),onSuccess:async()=>{b(null),await I()},onError:()=>void I()}),q=a0({mutationFn:({id:fe,archiveStatus:he})=>l.versions.updatePackageVersion(e,t,fe,{archiveStatus:he}),onSuccess:async(fe,{id:he,archiveStatus:me})=>{k(null),me==="archive"&&he===z&&await U(he),await I()},onError:(fe,{id:he,archiveStatus:me})=>{me==="unarchive"&&D(`Couldn't unarchive v${he}: ${mg(fe)}`),I()}}),Y=q.isPending?q.variables?.id:void 0,oe=a0({mutationFn:({id:fe})=>l.versions.deletePackageVersion(e,t,fe),onSuccess:async(fe,{id:he,read:me})=>{O(null);const le=await m().catch(()=>{})??me.filter(ve=>ve.id!==he);if(le.length===0){await d.invalidateQueries({queryKey:["packages",e]}),i?.();return}he===z&&await U(he,le),await I()},onError:()=>void I()}),Q=()=>w(null),ae=x?tL(x.version,n):{},de=x!==null&&!Rp(x.version)&&x.version.latest&&ae.archive!==void 0&&ae.delete!==void 0,X=R!==null&&R.versions===void 0,se=R?.versions!==void 0&&R.versions.length<=1,J=R?.versions!==void 0?tL(R.version,R.versions).delete:void 0,Z=async fe=>{Q(),y(null),oe.reset(),O({version:fe});const he=ve=>O(Le=>Le!==null&&Le.version.id===fe.id&&Le.versions===void 0?ve:Le);let me;try{me=await m()}catch(ve){he(null),D(`Couldn't check v${fe.id} before deleting it: ${mg(ve)}`);return}const le=me.find(ve=>ve.id===fe.id);if(le===void 0){he(null),D(`v${fe.id} is no longer a version of ${t}.`),I();return}he({version:le,versions:me})},G=(fe,he)=>{!s||Y===fe.id||w({version:fe,anchor:_.current.get(fe.id)??he})},ue=(fe,he)=>{const me=fe.key==="ArrowRight"||fe.key==="ContextMenu"||fe.key==="F10"&&fe.shiftKey;!s||!me||(fe.preventDefault(),fe.stopPropagation(),G(he,fe.currentTarget))},ie=x&&p.jsxs(ea,{disabled:ae.delete!==void 0,onClick:()=>void Z(x.version),children:[p.jsx(ml,{children:p.jsx(vF,{fontSize:"small"})}),p.jsx(xi,{primary:"Delete version",secondary:ae.delete})]},"delete");return p.jsxs(p.Fragment,{children:[p.jsx(Hn,{size:"small",variant:"outlined",endIcon:p.jsx(D6,{}),"aria-label":z?`Version v${z}, 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:z?`v${z}`:"Select a version"}),p.jsx(dc,{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===z,me=Rp(fe),le=[me?"Archived":void 0,uEe(fe.createdAt),fe.gitCommitSha?fe.gitCommitSha.slice(0,7):void 0].filter(Boolean).join(" · ");return p.jsxs(ea,{"aria-current":he?"true":void 0,"aria-disabled":me&&!s?"true":void 0,"aria-haspopup":s?"menu":void 0,"data-testid":"version-row",onKeyDown:ve=>ue(ve,fe),onClick:ve=>{if(me){G(fe,ve.currentTarget);return}he||(y(null),o(fe.id,ve))},sx:ve=>({gap:1,borderLeft:"3px solid",borderLeftColor:he?ve.palette.primary.main:"transparent",backgroundColor:he?ns(ve.palette.primary.main,.04):void 0,cursor:he||me&&!s?"default":"pointer"}),children:[p.jsx(xi,{primary:fe.id,secondary:le,sx:{opacity:me?.6:1},slotProps:{primary:{sx:{fontWeight:he?600:400}}}}),fe.latest&&p.jsx($E,{size:"small",label:"Latest",color:"info",variant:"outlined",sx:{height:20,fontSize:11,fontWeight:600}}),s&&p.jsx(Br,{title:Y===fe.id?"Updating this version…":"",children:p.jsx("span",{children:p.jsx(no,{ref:ve=>{ve?_.current.set(fe.id,ve):_.current.delete(fe.id)},size:"small","aria-label":`More actions for version ${fe.id}`,"aria-haspopup":"menu",disabled:Y===fe.id,onClick:ve=>{ve.stopPropagation(),w({version:fe,anchor:ve.currentTarget})},children:p.jsx(sEe,{fontSize:"small"})})})})]},fe.id)})}),p.jsx(dc,{anchorEl:x?.anchor??null,open:x!==null,onClose:Q,slotProps:{list:{"aria-label":x?`Actions for version ${x.version.id}`:void 0,disabledItemsFocusable:!0,autoFocus:de}},children:x&&Rp(x.version)?[p.jsxs(ea,{onClick:()=>{const{id:fe}=x.version;Q(),q.mutate({id:fe,archiveStatus:"unarchive"})},children:[p.jsx(ml,{children:p.jsx(cEe,{fontSize:"small"})}),p.jsx(xi,{primary:"Unarchive"})]},"unarchive"),p.jsx(wl,{},"divider"),ie]:x&&[p.jsxs(ea,{disabled:x.version.latest,onClick:()=>{b(x.version),N.reset(),Q(),y(null)},children:[p.jsx(ml,{children:p.jsx(lEe,{fontSize:"small"})}),p.jsx(xi,{primary:"Pin as latest",secondary:x.version.latest?"Already the latest version":void 0})]},"pin-latest"),p.jsxs(ea,{disabled:ae.archive!==void 0,onClick:()=>{k(x.version),q.reset(),Q(),y(null)},children:[p.jsx(ml,{children:p.jsx(iEe,{fontSize:"small"})}),p.jsx(xi,{primary:"Archive",secondary:ae.archive})]},"archive"),p.jsx(wl,{},"divider"),ie]}),p.jsx(Oo,{open:S!==null,onClose:()=>{N.isPending||b(null)},title:S?`Pin v${S.id} as latest`:"",description:S?`Requests that name no version will be served from v${S.id}.`:void 0,initialFocus:A,actions:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{ref:A,disabled:N.isPending,onClick:()=>b(null),children:"Cancel"}),p.jsx(Hn,{variant:"contained",loading:N.isPending,onClick:()=>S&&N.mutate(S.id),children:"Pin as latest"})]}),children:p.jsxs(Wn,{spacing:1.5,children:[E&&S&&E!==S.id&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:`The latest version is v${E} now. Links and requests that name a version keep answering as before.`}),N.isError&&S&&p.jsx(xo,{severity:"error",role:"alert",children:`Couldn't pin v${S.id} as latest: ${mg(N.error)}`})]})}),p.jsx(Oo,{open:$!==null,onClose:()=>{q.isPending||k(null)},title:$?`Archive v${$.id}`:"",description:$?`v${$.id} stops being served and is unloaded. Its files stay, so it can be unarchived.`:void 0,initialFocus:F,actions:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{ref:F,disabled:q.isPending,onClick:()=>k(null),children:"Cancel"}),p.jsx(Hn,{variant:"contained",loading:q.isPending,onClick:()=>$&&q.mutate({id:$.id,archiveStatus:"archive"}),children:"Archive"})]}),children:p.jsxs(Wn,{spacing:1.5,children:[p.jsx(wt,{variant:"body2",color:"text.secondary",children:`${LC} Its scheduled builds stop, and once unarchived it serves live until it is built again.`}),q.isError&&$&&p.jsx(xo,{severity:"error",role:"alert",children:`Couldn't archive v${$.id}: ${mg(q.error)}`})]})}),p.jsx(Oo,{open:R!==null,onClose:()=>{oe.isPending||O(null)},title:R?`Delete v${R.version.id}`:"",initialFocus:L,actions:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{ref:L,disabled:oe.isPending,onClick:()=>O(null),children:"Cancel"}),p.jsx(Hn,{variant:"contained",color:"error",loading:oe.isPending,disabled:X||J!==void 0,onClick:()=>R?.versions&&oe.mutate({id:R.version.id,read:R.versions}),children:se?"Delete package":"Delete version"})]}),children:p.jsxs(Wn,{spacing:1.5,children:[X&&R&&p.jsx(wt,{variant:"body2",children:`Checking ${t}'s versions before deleting v${R.version.id}…`}),R&&!X&&p.jsx(wt,{variant:"body2",children:se?`v${R.version.id} is the only version of ${t}, so deleting it deletes the package. ${LC} This cannot be undone.`:`v${R.version.id} stops being served and its files are removed. ${LC} Links that name it stop working, and this cannot be undone.`}),J!==void 0&&R&&p.jsx(xo,{severity:"warning",role:"alert",children:`v${R.version.id} can't be deleted now: ${J}.`}),oe.isError&&R&&p.jsx(xo,{severity:"error",role:"alert",children:`Couldn't delete v${R.version.id}: ${mg(oe.error)}`})]})}),p.jsx(ph,{open:P!==null,autoHideDuration:8e3,onClose:()=>D(null),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:p.jsx(Ee,{children:p.jsx(xo,{severity:"error",variant:"filled",onClose:()=>D(null),children:P})})})]})}const fEe="README.malloynb",pEe=e=>!!e&&!e.includes("/")&&N1(e)?.toLowerCase()==="readme";function j2e({onClickPackageFile:e,onOpenDocument:t,resourceUri:n,onEvent:r,onSelectVersion:o,onReplaceVersion:a}){const{apiClients:i,server:s,mutable:l}=er(),d=Tl(),u=e??(ne=>{window.location.href=ne}),{environmentName:m,packageName:g,versionId:y}=ko(n),x=rEe(m,g),{versions:w}=x,S=w.length>0,b=!S&&!x.isPending&&!x.isError,$=o??((ne,qe)=>u(`/${encodeURIComponent(m)}/${encodeURIComponent(g)}/${encodeURIComponent(ne)}`,qe)),k=t??((ne,qe)=>{const Oe=ne.mode==="edit"?b0e(m,g,ne.path):v_(m,g,ne.path);qe?u(Oe,qe):u(Oe)}),[R,O]=C.useState(null),[P,D]=C.useState(!1),A=yxe(),F=P_()?.documentStorage,[L,_]=C.useState([]),[E,z]=C.useState({state:F?"pending":"ready"}),I=C.useCallback(async()=>{if(!F)return;let ne;try{ne=await F.listWorkspaces(!1)}catch{z({state:"failed"});return}z({state:"ready",chosen:C_(ne)});const qe=[],Oe=wy(m,g,"");for(const Qe of ne.filter(nt=>nt.writeable))for(const nt of await F.listDocuments(Qe))nt.path.startsWith(Oe)&&qe.push({locator:nt,where:Qe.description});_(qe)},[F,m,g]);C.useEffect(()=>{I()},[I]);const U=ne=>ne.path.slice(wy(m,g,"").length),N=wo({queryKey:["package",m,g,y],queryFn:()=>i.packages.getPackage(m,g,y,!1)}),q=wo({queryKey:["package-agents",m,g,y],queryFn:()=>i.agents.listAgents(m,g,y)}),Y=b_(m,g,y),oe=wo({queryKey:["models",m,g,y],queryFn:()=>i.models.listModels(m,g,y)}),Q=wo({queryKey:["databases",m,g,y],queryFn:()=>i.databases.listDatabases(m,g,y)}),ae=wo({queryKey:["data-apps",m,g,y],queryFn:async()=>{try{return await i.dataApps.listDataApps(m,g,y)}catch(ne){const qe=ne?.response?.status;if(qe===404||qe===void 0)return{data:[]};throw ne}}}).data?.data??[],de=Y.reports.filter(ne=>!!ne.path),X=mEe(de),se=new Set(de.map(ne=>ne.path).filter(ne=>ne!==void 0)),J=(oe.data?.data??[]).slice().filter(ne=>!se.has(ne.path)).sort((ne,qe)=>ne.path.localeCompare(qe.path)),Z=(Q.data?.data??[]).slice().sort((ne,qe)=>ne.path.localeCompare(qe.path)),G=E.state==="ready"?X0e({authoritative:E.chosen?.authoritative===!0,mutable:l&&b,canStore:E.chosen?.writeable===!0,...y===void 0?{}:{versionId:y}}):void 0,ue=Y.settled&&(oe.isSuccess||oe.isError),ie=G!==void 0&&ue,fe=ie&&!A,he=C.useMemo(()=>{if(!ie)return;const ne=[...Y.reports.flatMap(qe=>qe.path?[qe.path]:[]),...(oe.data?.data??[]).flatMap(qe=>qe.path?[qe.path]:[])];if(G==="storage"&&F&&E.state==="ready")return E.chosen?{route:G,storage:F,workspace:E.chosen,environmentName:m,packageName:g,existing:ne}:void 0;if(G==="package")return{route:G,existing:ne,write:async(qe,Oe)=>{await i.models.updateModelSource(m,g,qe,{source:Oe})}}},[ie,G,F,E,m,g,i,Y.reports,oe.data]),me=N.data?.data?.description??"",le=q.data?.data??[],ve=(de.find(ne=>ne.path===fEe)??de.find(ne=>pEe(ne.path)))?.path,Le=!Y.settled,Ie=S?p.jsx(dEe,{environmentName:m,packageName:g,versions:w,...y!==void 0?{selectedVersionId:y}:{},onSelectVersion:$,...a?{onReplaceVersion:a}:{},onPackageDeleted:()=>u(`/${encodeURIComponent(m)}`),canManage:l}):null,Re=p.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1.5,sx:{mb:.5},children:[p.jsx(wt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em"},children:g}),Ie]});if(N.isError){const ne=p.jsx(Xa,{error:N.error,context:`${m} > ${g}`});return Ie?p.jsxs(O0,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[p.jsx(Ee,{sx:{mb:4},children:Re}),ne]}):ne}return p.jsxs(O0,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[p.jsxs(Ee,{sx:{mb:4},children:[Re,me&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:me})]}),p.jsx(k$e,{warnings:N.data?.data?.warnings}),x.isError&&p.jsx(Ee,{sx:{mb:4},children:p.jsx(xo,{severity:"warning",action:p.jsx(Hn,{color:"inherit",size:"small",onClick:x.refetch,children:"Retry"}),children:"Could not read this package's versions, so nothing that changes it is offered until they load."})}),Le&&p.jsx(Go,{text:"Loading package..."}),he&&p.jsx(I$e,{open:P,layout:"linear",environmentName:m,packageName:g,...y!==void 0?{versionId:y}:{},models:J.map(ne=>ne.path).filter(ne=>typeof ne=="string"&&ne.endsWith(".malloy")&&!se.has(ne)),modelsLoading:oe.isPending,...oe.isError?{modelsError:oe.error}:{},onRetryModels:()=>void oe.refetch(),target:he,...r?{onEvent:r}:{},onClose:()=>D(!1),onCreated:ne=>{D(!1),sxe(d),d.invalidateQueries({queryKey:["models"]}),k({path:ne.path,layout:ne.layout,slug:ne.slug,mode:"edit"})}}),!Le&&p.jsxs(p.Fragment,{children:[Y.isError&&p.jsx(Ee,{sx:{mb:4},children:p.jsx(xo,{severity:"warning",action:p.jsx(Hn,{color:"inherit",size:"small",onClick:()=>void Y.refetch(),children:"Retry"}),children:"Could not list this package's reports, so any it has are missing from this page."})}),(X.length>0||ie)&&p.jsxs(Ds,{title:"Reports",count:X.length,...fe?{action:p.jsx(Qy,{label:"Report",onClick:()=>D(!0)})}:{},children:[X.length===0&&p.jsx(zC,{label:"No reports yet",...fe?{action:{label:"Add report",onClick:()=>D(!0)}}:{}}),X.map(ne=>p.jsx(xp,{type:ne.layout==="grid"?"dashboard":"report",label:ne.label,rightLabel:ne.layout,...ne.secondary===void 0?{}:{description:ne.secondary},onClick:qe=>ne.path.endsWith(".malloynb")?u(`/${m}/${g}/${ne.path}`,qe):k({path:ne.path,layout:ne.layout,slug:ne.slug,mode:"view"},qe)},ne.path))]}),b&&L.length>0&&p.jsx(Ds,{title:"Drafts",count:L.length,children:L.map(({locator:ne,where:qe})=>p.jsx(xp,{type:ne.type==="grid"?"dashboard":"report",label:U(ne),rightLabel:qe,onClick:Oe=>k({path:U(ne),layout:ne.type,slug:N1(U(ne))??"",mode:"edit"},Oe),trailingAction:p.jsx(Br,{title:"Delete this draft",children:p.jsx(no,{size:"small","aria-label":`Delete draft ${U(ne)}`,onClick:Oe=>{Oe.stopPropagation(),F?.deleteDocument(ne).then(I)},children:p.jsx(vF,{fontSize:"small"})})})},`${ne.workspace}:${ne.path}`))}),ae.length>0&&p.jsx(Ds,{title:"Apps",count:ae.length,children:ae.map(ne=>{const qe=!!ne.title&&ne.title!==ne.path,Oe=`${J_(s)}${ne.resource}`;return p.jsx(xp,{type:"dataApp",label:qe?ne.title:ne.path,rightLabel:qe?ne.path:void 0,onClick:Qe=>{e?e(`/${m}/${g}/data-apps/${ne.path}`,Qe):Qe&&(Qe.metaKey||Qe.ctrlKey)?window.open(Oe,"_blank"):window.location.href=Oe},trailingAction:p.jsx(Br,{title:"Open standalone in new tab",children:p.jsx(no,{size:"small",href:Oe,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",onClick:Qe=>Qe.stopPropagation(),sx:{color:"text.secondary"},children:p.jsx(Z_,{fontSize:"small"})})})},ne.path)})}),p.jsxs(Ds,{title:"Models",count:J.length,children:[J.map(ne=>p.jsx(xp,{type:"model",label:ne.path,onClick:qe=>u(`/${m}/${g}/${ne.path}`,qe)},ne.path)),J.length===0&&p.jsx(zC,{label:"No models"})]}),le.length>0&&p.jsx(Ds,{title:"Agents",count:le.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:le.map(ne=>p.jsx(hEe,{agent:ne},ne.name))}),p.jsxs(Ds,{title:"Data",count:Z.length,children:[Z.map(ne=>p.jsx(xp,{type:"data",label:ne.path,rightLabel:ne.info?iB(ne.info.rowCount):"Unreadable",onClick:()=>O(ne)},ne.path)),Z.length===0&&p.jsx(zC,{label:"No data files"})]}),p.jsx(sSe,{resourceUri:n,versioned:!b}),ve&&p.jsx(Ee,{sx:{mt:6},children:p.jsx(N$e,{resourceUri:I1({environmentName:m,packageName:g,versionId:y}),path:ve,onLinkNavigate:u})})]}),p.jsx(nEe,{database:R,onClose:()=>O(null)})]})}function xp({type:e,label:t,description:n,rightLabel:r,onClick:o,trailingAction:a}){return p.jsx(L1,{icon:p.jsx(aB,{type:e}),tint:oB[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 hEe({agent:e}){return p.jsxs(p.Fragment,{children:[p.jsx(xp,{type:"agent",label:e.name??"",...e.description?{description:e.description}:{},...e.model&&e.model!=="inherit"?{rightLabel:e.model}:{}}),(e.schedules??[]).map(t=>{const n=i2(t.cron??"");return p.jsxs(wt,{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 mEe(e){const t=e.map(r=>({path:r.path??"",layout:KR(r),slug:N1(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 zC({label:e,action:t}){return p.jsxs(Wn,{direction:"row",sx:{alignItems:"center",gap:1,py:1},children:[p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:e}),t&&p.jsx(Hn,{size:"small",onClick:t.onClick,children:t.label})]})}const nL=/^publisher:document:(dashboard|notebook):(.+)$/;function gEe(e,t){const n=[];for(let r=0;r<e.length;r++){const o=e.key(r);o!==null&&nL.test(o)&&n.push(o)}for(const r of n){const[,o,a]=nL.exec(r),i=e.getItem(r);i!==null&&t(a,j_(o),i)&&e.removeItem(r)}}const FC={name:"Local",description:"Stored in this browser only",writeable:!0},O$="publisher:report:",md=e=>`${O$}${e}`;function gg(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 _C=(e,t)=>localStorage.setItem(md(e),JSON.stringify(t));class yEe{migrated=!1;migrate(){this.migrated||(this.migrated=!0,gEe(localStorage,(t,n,r)=>gg(md(t))!==void 0?!1:(_C(t,{type:n,content:r}),!0)))}async listWorkspaces(t){return[FC]}async listDocuments(t,n){if(t.name!==FC.name)return[];this.migrate();const r=[];for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o);if(a===null||!a.startsWith(O$))continue;const i=gg(a);i&&(n===void 0||i.type===n)&&r.push({workspace:FC.name,type:i.type,path:a.slice(O$.length)})}return r}async getDocument(t){this.migrate();const n=gg(md(t.path));if(n===void 0)throw BC(t);return n.content}async getDocumentType(t){this.migrate();const n=gg(md(t.path));if(n===void 0)throw BC(t);return n.type}async saveDocument(t,n){this.migrate(),_C(t.path,{type:t.type,content:n})}async deleteDocument(t){if(this.migrate(),gg(md(t.path))===void 0)throw BC(t);localStorage.removeItem(md(t.path))}async moveDocument(t,n){const r=await this.getDocument(t);_C(n.path,{type:n.type,content:r}),n.path!==t.path&&localStorage.removeItem(md(t.path))}}function BC(e){return new k_(`No report at ${e.workspace}/${e.path}`)}async function vEe(e,t,n,r){const o=C_(await e.listWorkspaces(!1));if(!o)return;const a=wy(t,n,r);if(e.getDocumentType)try{return await e.getDocumentType({workspace:o.name,path:a})}catch(i){if($_(i))return;throw i}return(await e.listDocuments(o)).find(i=>i.path===a)?.type}function A2e(e,t,n,r=!0){const o=P_()?.documentStorage,a=r&&o!==void 0,[i,s]=C.useState(),l=wy(e,t,n);return C.useEffect(()=>{if(!a||!o)return;let d=!1;return vEe(o,e,t,n).catch(()=>{}).then(u=>{d||s({key:l,layout:u})}),()=>{d=!0}},[a,o,e,t,n,l]),a?i?.key===l?{layout:i.layout,settled:!0}:{layout:void 0,settled:!1}:{layout:void 0,settled:!0}}function D2e(e,t,n="grid"){const r=t.filter(a=>!!a.path).filter(a=>N1(a.path)===e),o=r.filter(a=>KR(a)===n);return o.length===1?{found:g$(o[0])}:r.length===1?{found:g$(r[0])}:r.length===0?{missing:!0}:{ambiguous:r.map(a=>a.path).sort()}}const bEe=/^(dashboards|notebooks)\/([^/]+)$/;function N2e(e){const t=bEe.exec(e);if(t)return{name:t[2],prefer:t[1]==="dashboards"?"grid":"linear"}}const rL="[publisher.report]",oL="[publisher.console]";function xEe(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 I2e(e){return t=>{const n={...e,...t,at:new Date().toISOString()};xEe(t)?console.warn(rL,n):console.info(rL,n)}}function wEe(e){const t={...e,at:new Date().toISOString()};e.ok?console.info(oL,t):console.warn(oL,t)}const Lo={white:"#FFFFFF",offWhite:"#F8FAFC",grey:{light:"#E2E8F0",mid:"#64748B"},black:"#0F172A",semantic:{success:{main:pr.emerald,light:"#D1FAE5",dark:"#047857"},warning:{main:pr.amber,light:"#FEF3C7",dark:"#92400E"},error:{main:pr.red,light:"#FEE2E2",dark:"#B91C1C"},info:{main:pr.blue,light:"#DBEAFE",dark:"#1D4ED8"}}},Wb='"Inter", "Helvetica Neue", "Arial", sans-serif',Vo={50:Lo.offWhite,100:"#F1F5F9",200:Lo.grey.light,300:"#CBD5E1",400:"#94A3B8",500:Lo.grey.mid,600:"#475569",700:"#334155",800:"#1E293B",900:Lo.black},L2e={headerHeight:56},aL="0 1px 3px rgba(0, 0, 0, 0.1)",SEe="#0f172a",CEe="#1e293b",kEe="#f1f5f9",$Ee="#cbd5e1",EEe="#334155",cB=(e="light",t)=>{const n=e==="dark",r=n?SEe:Lo.white,o=n?CEe:Lo.white,a=n?kEe:Lo.black,i=n?$Ee:Lo.grey.mid,s=n?EEe:Lo.grey.light,{accent:l,accentHover:d,accentContrast:u}=t??Dk(void 0,e);return Tx({cssVariables:{nativeColor:!0},palette:{mode:e,primary:{main:l,light:Lo.grey.light,dark:d,contrastText:u},secondary:{main:Lo.grey.mid,light:Lo.grey.light,dark:Lo.black},grey:Vo,success:Lo.semantic.success,warning:Lo.semantic.warning,error:Lo.semantic.error,info:Lo.semantic.info,background:{default:r,paper:o},text:{primary:a,secondary:i},divider:s},typography:{fontFamily:Wb,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 ${l}`,outlineOffset:2}}}},MuiCssBaseline:{styleOverrides:{"*":{scrollbarWidth:"thin",scrollbarColor:n?"#475569 #1e293b":`${Vo[300]} ${Vo[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:n?"#1e293b":Vo[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Vo[300],borderRadius:"4px","&:hover":{background:n?"#64748b":Vo[400]}},"&::-webkit-scrollbar-corner":{background:n?"#1e293b":Vo[100]}},".malloy-table.root":{scrollbarWidth:"auto",scrollbarColor:"auto","&::-webkit-scrollbar, &::-webkit-scrollbar-track, &::-webkit-scrollbar-corner":{background:n?"#1e293b":Vo[100]},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Vo[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)":Vo[200],color:n?"#64748b":Vo[500]}},outlined:{color:a,borderColor:n?"#475569":Vo[300],"&:hover":{borderColor:n?"#64748b":Vo[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:aL,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:Wb,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?Vo[600]:Vo[300]}`,borderRadius:6,transition:`border-color ${Zy} ease-in`,...Jy,backgroundColor:o,"&:hover":{borderColor:n?"#64748b":Vo[400]},"&.Mui-focused":{borderColor:n?Vo[400]:Vo[500],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:Wb,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:Wb}}},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:Vo[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)":Lo.offWhite},"&.Mui-selected":{backgroundColor:n?"rgba(255, 255, 255, 0.12)":Lo.offWhite,color:a,"& .MuiListItemIcon-root":{color:a},"& .MuiListItemText-primary":{color:a},"&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.16)":Lo.grey.light}}}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:o,color:a,boxShadow:aL}}}}})};cB("light");function REe({children:e}){const{mode:t,theme:n}=Hr(),{accent:r,accentHover:o,accentContrast:a}=n,i=C.useMemo(()=>cB(t,{accent:r,accentHover:o,accentContrast:a}),[t,r,o,a]);return p.jsxs(e7,{theme:i,children:[p.jsx(lQ,{}),e]})}const TEe=C.lazy(()=>vo(()=>import("./HomePage-B_FVtnN-.js"),[])),MEe=C.lazy(()=>vo(()=>import("./MainPage-wFF9nPEr.js"),__vite__mapDeps([7,8,9,10]))),OEe=C.lazy(()=>vo(()=>import("./PackageSplatRoute-CASBZk0k.js").then(e=>e.a),__vite__mapDeps([11,10]))),PEe=C.lazy(()=>vo(()=>import("./PackagePage-dcF6vrvw.js"),__vite__mapDeps([12,9,10,13]))),jEe=C.lazy(()=>vo(()=>import("./EnvironmentPage-CsFUI8IX.js"),[])),AEe=C.lazy(()=>vo(()=>import("./RouteError-CUIolYwb.js"),[])),DEe=C.lazy(()=>vo(()=>import("./ThemeEditorPage-DgU2YYq6.js"),__vite__mapDeps([14,15]))),NEe=(e="/",t=new yEe,n)=>(p1e(wEe),Wq([{path:e,element:p.jsx(Ire,{children:p.jsx(axe,{documentStorage:t,children:p.jsx(REe,{children:p.jsx(C.Suspense,{fallback:p.jsx(Go,{}),children:p.jsx(MEe,{headerProps:n})})})})}),errorElement:p.jsx(AEe,{}),children:[{index:!0,element:p.jsx(TEe,{})},{path:"settings/theme",element:p.jsx(DEe,{})},{path:"settings",element:p.jsx(xq,{to:"/settings/theme",replace:!0})},{path:":environmentName",element:p.jsx(jEe,{})},{path:":environmentName/:packageName",element:p.jsx(PEe,{})},{path:":environmentName/:packageName/*",element:p.jsx(OEe,{})}]}])),IEe=NEe("/");jU.createRoot(document.getElementById("root")).render(p.jsx(C.StrictMode,{children:p.jsx(aH,{router:IEe})}));export{_Ee as $,ds as A,rs as B,zEe as C,Ay as D,E2e as E,b_ as F,Xy as G,x0e as H,Ee as I,$E as J,no as K,Br as L,sz as M,PE as N,er as O,Ga as P,Ld as Q,Hr as R,nk as S,wt as T,dz as U,ml as V,xi as W,tee as X,L2e as Y,yxe as Z,tu as _,xn as a,j_ as a$,Go as a0,xo as a1,Hn as a2,Cn as a3,vo as a4,I2e as a5,xq as a6,I1 as a7,j2e as a8,rEe as a9,Xne as aA,x_ as aB,lRe as aC,XRe as aD,Dle as aE,f2e as aF,s0e as aG,u2e as aH,ZRe as aI,Nle as aJ,e2e as aK,$le as aL,QRe as aM,JRe as aN,Xd as aO,dF as aP,wl as aQ,uF as aR,p1 as aS,dc as aT,s2e as aU,Lle as aV,iF as aW,zRe as aX,ARe as aY,t2e as aZ,y$ as a_,M2e as aa,lq as ab,O0 as ac,Wn as ad,LP as ae,ki as af,jE as ag,b4 as ah,Nk as ai,ea as aj,Tl as ak,a0 as al,PK as am,NK as an,ph as ao,Oo as ap,yae as aq,su as ar,dx as as,Pd as at,Mi as au,t1 as av,lae as aw,LEe as ax,P$ as ay,Sl as az,sl as b,d2e as b$,v2e as b0,N1 as b1,Od as b2,P_ as b3,wo as b4,y2e as b5,Yk as b6,V0 as b7,h2e as b8,Xa as b9,p2e as bA,g2e as bB,sxe as bC,o2e as bD,ixe as bE,k2e as bF,l2e as bG,gR as bH,Bbe as bI,Z0 as bJ,w_ as bK,z_ as bL,p0e as bM,Ube as bN,qbe as bO,_Re as bP,Vbe as bQ,A1 as bR,ple as bS,rxe as bT,SRe as bU,MRe as bV,Qoe as bW,ERe as bX,RRe as bY,TRe as bZ,PRe as b_,a2e as ba,nxe as bb,BN as bc,Zy as bd,rn as be,vi as bf,GRe as bg,vl as bh,LRe as bi,Xse as bj,nF as bk,ele as bl,aF as bm,YRe as bn,S_ as bo,Lbe as bp,e0e as bq,t0e as br,N0e as bs,QR as bt,S2e as bu,C_ as bv,Q0e as bw,$_ as bx,m2e as by,Zle as bz,Qa as c,b2e as c$,EA as c0,cF as c1,lR as c2,IRe as c3,NRe as c4,Qse as c5,Yse as c6,Jy as c7,zbe as c8,Fbe as c9,Wle as cA,FRe as cB,VRe as cC,qRe as cD,$Re as cE,Xx as cF,URe as cG,BRe as cH,WRe as cI,jRe as cJ,E_ as cK,j4 as cL,Xoe as cM,lF as cN,m1 as cO,n2e as cP,pK as cQ,vC as cR,ORe as cS,CRe as cT,ule as cU,Ile as cV,e2 as cW,Z0e as cX,X0e as cY,x2e as cZ,ZR as c_,DRe as ca,Eg as cb,R0e as cc,Bp as cd,tQ as ce,KRe as cf,vF as cg,HRe as ch,ale as ci,UN as cj,tle as ck,bz as cl,Wy as cm,Sle as cn,wle as co,xy as cp,zx as cq,sle as cr,B0e as cs,C2e as ct,w2e as cu,Lz as cv,r2e as cw,gF as cx,zle as cy,kRe as cz,Ft as d,G0e as d0,T_ as d1,W0e as d2,K0e as d3,oxe as d4,ry as d5,_r as d6,w0e as d7,S0e as d8,v_ as d9,R2e as da,N$e as db,FEe as dc,i2e as dd,$2e as de,N2e as df,D2e as dg,qL as dh,Fo as di,A2e as dj,qd as dk,T2e as dl,Xxe as dm,P2e as dn,P0 as dp,v0e as dq,b0e as dr,ZC as e,yn as f,gn as g,El as h,Ls as i,p as j,so as k,Gd as l,on as m,N5 as n,cc as o,_5 as p,O2e as q,C as r,ct as s,_p as t,wn as u,Fy as v,I5 as w,Ln as x,lt as y,Pa as z};
512
+ `)}const T$e=rn(p.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 M$e({cell:e,resourceUri:t,showCopyLink:n,maxResultSize:r,isExecuting:o,pendingRerun:a,onNavigate:i,onDrillSelf:s,canDrillSelf:l,onDrillNavigate:d,givens:u,givenSpecs:m}){const[g,y]=Cn.useState(!1),[x,w]=Cn.useState(!1),[S,b]=Cn.useState(),[$,k]=Cn.useState(!1),{modelPage:R,isLoadingStatus:O}=er(),P=!O&&R!=="viewer",[D,A]=C.useState(""),{environmentName:F,packageName:L,modelPath:_}=ko(t),E={environmentName:F,packageName:L,sourcePath:_,onNavigate:i},{drill:z,drillMenu:I}=K_({onNavigate:d,onSelf:s,canSelf:l}),U=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,N=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,q=!!e.text&&(U.test(e.text)||N.test(e.text)),Y=()=>{if(!e.newSources||e.newSources.length===0)return 0;let X=[],se="";if(e.text){const J=e.text.match(U);J&&(X=J[1].split(",").map(G=>G.trim()));const Z=e.text.match(N);Z&&(se=Z[1].trim())}for(let J=0;J<e.newSources.length;J++)try{const Z=JSON.parse(e.newSources[J]);if(X.length>0&&X.includes(Z.name)||se&&se===Z.path)return J}catch{continue}return 0},oe=Cn.useMemo(()=>e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:t,givens:m}:void 0,[e.newSources,t,m]),{mode:Q}=Hr();C.useEffect(()=>{e.type==="code"&&b2(R$e(e),"malloy",Q).then(X=>{b(X)})},[e,Q]);const ae=()=>{const X=window.location.href;navigator.clipboard.writeText(X).then(()=>A("URL copied to clipboard!")).catch(()=>A("Failed to copy URL"))},de=p.jsx(Oo,{open:g,onClose:()=>y(!1),title:"Malloy code",maxWidth:"lg",showClose:!0,children:p.jsx(Ee,{sx:X=>({border:`1px solid ${X.palette.divider}`,borderRadius:"8px",padding:"16px",fontFamily:Fo,fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:X.palette.background.paper,color:X.palette.text.primary}),children:p.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:S}})})});return e.type==="markdown"&&p.jsx(Ee,{children:p.jsxs(QR,{children:[n?p.jsxs(Wn,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[p.jsx(xy,{variant:"document",links:E,children:e.text}),p.jsx(Br,{title:"Copy link",children:p.jsx(no,{"aria-label":"Copy link",onClick:ae,sx:{color:"text.secondary",mt:"18px"},children:p.jsx(s2,{sx:{fontSize:"24px"}})})})]}):p.jsx(xy,{variant:"document",links:E,children:e.text}),p.jsx(ph,{open:D!=="",autoHideDuration:6e3,onClose:()=>A(""),message:D})]})})||e.type==="code"&&p.jsxs(Ee,{children:[e.newSources&&e.newSources.length>0&&p.jsx(Wn,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:p.jsx(g4,{sx:{position:"relative",padding:"0"},children:p.jsxs(Ee,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[S&&p.jsx("span",{dangerouslySetInnerHTML:{__html:S},style:{fontFamily:Fo,fontSize:"14px",flex:1,marginRight:"8px"}}),q&&P&&p.jsx(Lp,{"aria-label":"Data sources",sx:{flexShrink:0},onClick:()=>k(!0),children:p.jsx(Gp,{})})]})})}),p.jsx(rB,{open:$&&P,onClose:()=>k(!1),title:"Data Sources",hasValidImport:q,resourceUri:t,data:oe,initialSelectedSourceIndex:Y(),startingGivens:u}),de,p.jsx(eB,{open:x,onClose:()=>w(!1),result:e.result||"",title:"Results",drill:z}),o&&!e.result&&!e.error&&!q&&!(e.newSources&&e.newSources.length>0)&&p.jsx(Z0,{children:p.jsx(Ee,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:p.jsx(Cu,{size:32})})}),!e.result&&e.error&&p.jsx(bF,{summary:"This cell could not be run.",detail:e.error}),e.result&&a&&p.jsx(uz,{"aria-label":"Re-run pending",sx:{mb:1,height:2,borderRadius:1}}),e.result&&p.jsxs(Z0,{children:[p.jsx(w_,{title:"",action:p.jsxs(Wn,{direction:"row",sx:{gap:.5,mt:"-4px"},children:[p.jsx(Lp,{"aria-label":"Malloy code",onClick:X=>{X.stopPropagation(),y(!0)},children:p.jsx(T$e,{})}),p.jsx(Lp,{"aria-label":"Expand results",onClick:()=>w(!0),children:p.jsx(Gp,{})})]})}),p.jsx(D1,{result:e.result,maxHeight:Ele,maxResultSize:r,drill:z}),I]})]})}function O$e({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 P$e=4;function j$e(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 A$e({resourceUri:e,maxResultSize:t=0,givens:n,onGivensChange:r,onNavigate:o,onDrillNavigate:a,actions:i,notebook:s,runCell:l}){const{environmentName:d,packageName:u,versionId:m,modelPath:g}=ko(e),[y,x]=C.useState([]),[w,S]=C.useState(!1),[b,$]=C.useState(!1),k=C.useRef(void 0),[R,O]=C.useState(null),P=$$e(s),D=s.autorun!==!1,A=y1(),F=gR({specs:P,loaded:!0,startingValues:s.startingGivens,params:n,onGivensChange:r,documentKey:e,autorun:D,environmentName:d,packageName:u,modelPath:g,versionId:m,documentName:g}),{applied:L,declaredTypes:_,canSelf:E,onSelf:z}=F,I=C.useCallback(Z=>{const G=Zd(Z,_);return Object.keys(G).length>0?JSON.stringify(G):void 0},[_]),U=C.useMemo(()=>m0(L,_),[L,_]),N=C.useRef(0),q=C.useRef(null),Y=C.useRef(null),oe=C.useRef(void 0);C.useEffect(()=>()=>{q.current?.abort(),Y.current=null,clearTimeout(oe.current?.timer),oe.current=void 0},[]);const Q=C.useCallback(async(Z=new Map)=>{if(!s.notebookCells)return;const G=++N.current;q.current?.abort();const ue=new AbortController;q.current=ue,x(s.notebookCells.map(ie=>({...ie}))),S(!0),O(null);try{const ie=[];for(let he=0;he<s.notebookCells.length;he++){const me=s.notebookCells[he];if(!E$e(me))continue;const le=he,ve=async()=>{try{const Le=await l({cell:me,givens:Z,declaredTypes:_,signal:ue.signal});if(N.current!==G)return;const Ie=Le.result;x(Re=>{const ne=[...Re];return ne[le]||(ne[le]={...me}),ne[le]={...ne[le],result:Ie},ne})}catch(Le){if(ue.signal.aborted||N.current!==G)return;A.emit({type:"report.query_failed",tile:le,category:V0(Le)}),A.listening||console.error(`Error executing cell ${le}:`,Le);const Ie=j$e(Le);x(Re=>{const ne=[...Re];return ne[le]||(ne[le]={...me}),ne[le]={...ne[le],error:Ie},ne})}};ie.push(ve)}const fe=[];for(const he of ie){const me=he().then(()=>{fe.splice(fe.indexOf(me),1)});fe.push(me),fe.length>=P$e&&await Promise.race(fe)}await Promise.all(fe)}catch(ie){if(ue.signal.aborted||N.current!==G)return;A.emit({type:"report.query_failed",category:V0(ie)}),A.listening||console.error("Error executing notebook cells:",ie),O(ie)}finally{N.current===G&&(S(!1),q.current=null)}},[s,_,l,A]),ae=C.useRef(0),de=C.useRef(void 0);de.current!==s&&(de.current=s,ae.current+=1);const X=ae.current;C.useEffect(()=>{const Z=`${e}|${X}`,G=`${Z}|${I(L)??""}`;k.current!==void 0&&k.current!==Z&&(q.current?.abort(),q.current=null),k.current=Z;const ue=O$e({ready:!!s.notebookCells,lastRunKey:Y.current,pendingKey:oe.current?.key,runKey:G,documentKey:Z});if(ue.cancelPending&&(clearTimeout(oe.current?.timer),oe.current=void 0,$(!1)),ue.dispatch==="none")return;const ie=()=>{oe.current=void 0,$(!1),Y.current=G,Q(L)};if(ue.dispatch==="now"){ie();return}$(!0),oe.current={key:G,timer:setTimeout(ie,a_)}},[s,X,e,L,I,Q]);const se=y.length>0?y:s.notebookCells||[],J=0;return p.jsxs(y$,{layout:"linear",header:i?p.jsx(Wn,{direction:"row",sx:{justifyContent:"flex-end"},children:i}):null,controls:F.panel.givens.length>0?p.jsx(S_,{children:p.jsx(A1,{...F.panel,layout:"bar"})}):void 0,children:[se.map((Z,G)=>p.jsx(M$e,{cell:Z,showCopyLink:G===J,resourceUri:e,maxResultSize:t,isExecuting:w,givens:U,givenSpecs:P,pendingRerun:b,onNavigate:o,onDrillNavigate:a,onDrillSelf:P.length>0?z:void 0,canDrillSelf:E},G)),R&&p.jsx(Xa,{error:{message:R.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})}function D$e({environmentName:e,packageName:t,versionId:n,path:r,notebook:o,...a}){const{apiClients:i,server:s}=er(),l=C.useCallback(async({cell:d,givens:u,declaredTypes:m,signal:g})=>{const y=d.runQuery;if(y===void 0)return{};g.throwIfAborted();const x=Zd(u,m),w={environmentName:e,packageName:t,versionId:n,modelPath:r,query:y,givens:Object.keys(x).length>0?x:void 0},S=[...A_(w),s],b=()=>dy.fetchQuery({queryKey:S,queryFn:({signal:k})=>D_(i,w,k),...S4}),$=()=>void dy.cancelQueries({queryKey:S,exact:!0});g.addEventListener("abort",$,{once:!0});try{let k;try{k=await b()}catch(R){if(!mee(R)||g.aborted)throw R;k=await b()}return{result:k.data.result}}finally{g.removeEventListener("abort",$)}},[i,s,e,t,r,n]);return p.jsx(A$e,{...a,resourceUri:I1({environmentName:e,packageName:t,modelPath:r,versionId:n}),notebook:o,runCell:l})}function N$e({resourceUri:e,path:t,givens:n,onGivensChange:r,onNavigate:o,onLinkNavigate:a,height:i,maxResultSize:s,onEvent:l,chrome:d,manifestStaleTime:u,actions:m,rowsActions:g}){const y=ko(e),{apiClients:x}=er(),w=y.environmentName??"",S=y.packageName??"",b=y.versionId,$=!!y.environmentName&&!!y.packageName,{data:k,isSuccess:R,isError:O,error:P}=wo({...ixe(x,{environmentName:w,packageName:S,path:t,versionId:b},u),enabled:$&&t!==""}),D=k?.layout,A=Jle({path:t,layout:D},l),F=`${e}|${t}`,L=C.useRef(void 0),_=C.useRef({key:F,at:Od()});_.current.key!==F&&(_.current={key:F,at:Od()}),C.useEffect(()=>{L.current!==F&&($?O?(L.current=F,A.emit({type:"report.load_failed",surface:"view",category:V0(P)})):R&&k&&(L.current=F,A.emit({type:"report.opened",surface:"view",from:"package",tiles:k.tiles?.length??k.notebook?.notebookCells?.filter(U=>U.type==="code"&&U.runQuery!==void 0).length??0,durationMs:Od()-_.current.at})):(L.current=F,A.emit({type:"report.load_failed",surface:"view",category:"invalid"})))},[F,$,O,P,R,k,A]);const E=C.useCallback((U,N)=>{const q=o?.(U,N);q&&A.emit({type:"report.drill",to:"report",outcome:q})},[o,A]),z=o?E:void 0;if(!$)return p.jsxs(xo,{severity:"error",children:["A report resource URI must name an environment and a package. Received: ",e]});if(O)return p.jsx(Xa,{context:`${w} > ${S} > ${t}`,error:P});if(!R||!k)return p.jsx(Go,{text:qd.opening("report")});const I=k.notebook?.format==="malloynb"?p.jsx(D$e,{environmentName:w,packageName:S,versionId:b,path:t,notebook:k.notebook,givens:n,onGivensChange:r,onNavigate:a,onDrillNavigate:z,maxResultSize:s,...m!==void 0?{actions:m}:{}}):p.jsx(Bxe,{manifest:k,environmentName:w,packageName:S,versionId:b,documentName:t,givens:n,onGivensChange:r,onNavigate:z,...a?{onLinkNavigate:a}:{},height:i,maxResultSize:s,chrome:d,...m!==void 0?{actions:m}:{},...g!==void 0?{rowsActions:g}:{}});return p.jsx(wF.Provider,{value:A,children:I})}function I$e({open:e,layout:t,kind:n,allowLayoutChange:r,allowKindChange:o,environmentName:a,packageName:i,versionId:s,models:l,modelsLoading:d=!1,modelsError:u,onRetryModels:m,target:g,savedAs:y,onClose:x,onCreated:w,onEvent:S}){const b=t??(n?j_(n):"linear"),$=r??o??!0,[k,R]=C.useState(b),[O,P]=C.useState(void 0),[D,A]=C.useState(""),[F,L]=C.useState(""),[_,E]=C.useState(""),z=C.useRef(null),[I,U]=C.useState(""),[N,q]=C.useState(!1),[Y,oe]=C.useState(!1),[Q,ae]=C.useState(!1),[de,X]=C.useState(void 0),se=u!=null,{choices:J,isLoading:Z,isSuccess:G,failed:ue,retry:ie,canRetry:fe}=oxe({environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},models:l,enabled:e&&l.length>0}),he=C.useMemo(()=>J.get(D)??[],[J,D]),me=C.useMemo(()=>new Map([...J.entries()].flatMap(([st,At])=>At.map(tn=>[IC(st,tn.source,tn.view),{model:st,source:tn.source,view:tn.view}]))),[J]),le=C.useMemo(()=>{const st=J.size>1;return[...J.entries()].flatMap(([At,tn])=>{const Bt=new Map;for(const an of tn)Bt.set(an.source,[...Bt.get(an.source)??[],an]);return[...Bt.entries()].map(([an,$n])=>({key:`${At}::${an}`,label:an,ariaLabel:`${an} in ${At}`,...st||$n[0]?.sourceDescription?{detail:[st?At:void 0,$n[0]?.sourceDescription].filter(Boolean).join(" · ")}:{},entries:$n.map(Vt=>({key:IC(At,Vt.source,Vt.view),name:Vt.view,title:Vt.description??vC(Vt.view),...Vt.chart?{chart:Vt.chart}:{}}))}))})},[J]),ve=st=>{const At=me.get(st);At&&(A(At.model),L(`${At.source}::${At.view}`))},Le=he.find(st=>`${st.source}::${st.view}`===F),Ie=Le?IC(D,Le.source,Le.view):void 0,Re=L$e(Le,250);C.useEffect(()=>{e&&R(b)},[e,b]),C.useEffect(()=>{if(!e)return;const st=[...J.keys()];D===""&&st.length>0&&A(st[0])},[e,J,D]),C.useEffect(()=>{!e||he.length===0||F!==""||L(`${he[0].source}::${he[0].view}`)},[e,he,F]),C.useEffect(()=>{!e||N||Le===void 0||U(vC(Le.view))},[e,N,Le]),C.useEffect(()=>{e||(A(""),L(""),E(""),U(""),q(!1),P(void 0),oe(!1),X(void 0))},[e]);const ne=C.useMemo(()=>{if(I.trim()!=="")for(let st=1;st<=e2;st++){const At=T_(I,st);if(!g.existing?.includes(At))return At}},[I,g]),qe=O?.trim(),Oe=qe===void 0||qe===""?void 0:qe.endsWith(".malloy")?qe:`${qe}.malloy`,Qe=Oe??ne,nt=Oe===void 0?void 0:M_(Oe)??(g.existing?.includes(Oe)?`${Oe} already exists; choose another location.`:void 0),kt=(Le===void 0?void 0:ZR({title:I,modelPath:D,source:Le.source,view:Le.view}))??(I.trim()!==""&&Qe===void 0?"No free file name for this title; choose another.":void 0),Ut=kt!==void 0&&(Y||I.trim()!==""),at=d||Z,{theme:et}=Hr(),pt=et.ui,ze=Xd(et.cardBorder),be=J.size===0&&(se||ue.length>0),He=at?"Loading the model":be?"Couldn't read the model to start from":J.size===0?"Nothing in the model to start from yet":Le===void 0?"Pick what to start from":void 0,Me="report",$t=Q?`Creating ${Me}…`:`Create ${Me}`,Et=F!==""&&Le===void 0&&he.length>0,vt=async()=>{if(!(He!==void 0||Le===void 0||Q)){if(kt!==void 0||nt!==void 0){oe(!0);return}ae(!0),X(void 0);try{const st=await Z0e({layout:k,...Oe!==void 0?{path:Oe}:{},document:{title:I,modelPath:D,source:Le.source,view:Le.view},target:g,...S?{onEvent:S}:{}});w(st)}catch(st){const At=st.response?.data?.message;X(At??(st instanceof Error?st.message:String(st)))}finally{ae(!1)}}},it=st=>p.jsx(Hn,{color:"inherit",size:"small",onClick:st,children:"Retry"});return p.jsx(Oo,{className:`${Sl.dialog} ${Sl.newReportDialog}`,maxWidth:"md",initialFocus:z,open:e,onClose:Q?()=>{}:x,title:`New ${Me}`,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:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{onClick:x,disabled:Q,children:"Cancel"}),p.jsx(Br,{title:Q?"":He??"",children:p.jsx("span",{children:p.jsx(Hn,{variant:"contained",disabled:Q||He!==void 0,"aria-label":!Q&&He!==void 0?`${$t}: ${He}`:$t,onClick:()=>void vt(),children:$t})})})]}),children:p.jsxs(Wn,{sx:{gap:1.5},children:[se?p.jsx(xo,{severity:"error",action:m&&D4(u)?it(m):void 0,children:"Couldn't read this package's models, so no view is listed to start from."}):l.length===0?!d&&p.jsxs(xo,{severity:"info",children:["This package has no models yet. Add a .malloy file that declares a source with a view, then create a ",Me," from it."]}):ue.length>0?p.jsxs(xo,{severity:"warning",action:fe?it(ie):void 0,children:["Couldn't read ",ue.join(", "),", so nothing from"," ",ue.length===1?"it":"them"," is listed."]}):G&&J.size===0&&p.jsxs(xo,{severity:"info",children:["A ",Me," 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."]}),p.jsxs(Ee,{sx:{mx:-3,mb:-1,borderTop:`1px solid ${ze}`,borderBottom:`1px solid ${ze}`,display:"grid",gridTemplateColumns:{xs:"1fr",md:"320px minmax(0, 1fr)"},height:{md:500}},children:[p.jsx(Ee,{sx:{display:"flex",flexDirection:"column",minHeight:0,borderRight:{md:`1px solid ${ze}`},maxHeight:{xs:280,md:"none"}},children:p.jsx(Sle,{groups:le,query:_,onQuery:E,picked:Ie,onPick:ve,onTake:st=>{ve(st)},searchRef:z,disabled:Q,empty:p.jsx(wt,{variant:"body2",sx:{color:"text.secondary",p:2},children:at?"Reading the package's models…":"Nothing to start from."})})}),p.jsxs(Ee,{sx:st=>({p:2.5,display:"flex",flexDirection:"column",gap:2,minHeight:0,overflowY:"auto",bgcolor:`color-mix(in srgb, ${st.palette.text.primary} 3%, ${st.palette.background.paper})`}),children:[$&&p.jsxs(Ee,{children:[p.jsx(eL,{children:"Layout"}),p.jsx(Ee,{role:"radiogroup","aria-label":"Layout",sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:["linear","grid"].map(st=>p.jsx(_$e,{layout:st,checked:k===st,disabled:Q,onPick:()=>R(st)},st))}),p.jsx(wt,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"Switch it any time in the builder."})]}),p.jsxs(Ee,{children:[p.jsx(eL,{children:"First query"}),p.jsx(Ee,{role:"region","aria-label":"Preview",sx:st=>({height:200,display:"flex",position:"relative",overflow:"hidden",borderRadius:pt.radius.tile,border:`1px solid ${ze}`,bgcolor:st.palette.background.paper,"&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:40,pointerEvents:"none",background:`linear-gradient(to bottom, transparent, ${st.palette.background.paper})`}}),children:Le&&Re?p.jsx(Ee,{sx:{flex:1,minWidth:0,px:2,pt:1.5},children:p.jsx(z_,{environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},modelPath:D,tile:`${Re.source} -> ${Re.view}`,label:I.trim()||vC(Re.view),borderless:!0,givens:z$e,declaredTypes:F$e,height:180})}):p.jsx(wt,{variant:"body2",sx:{color:"text.secondary",m:"auto"},children:Et?"What you picked is no longer in this model; pick something else.":"Pick what to start from."})}),p.jsx(wt,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"More are added in the builder."})]}),p.jsx(ki,{size:"small",label:"Title",value:I,disabled:Q,onChange:st=>{q(!0),U(st.target.value)},InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Report title"},error:Ut,helperText:Ut?kt:g.route==="package"?"Names the file too, unless you type a location.":y??`Saved as a new ${Me} in the host's store, and opened in the builder.`}),p.jsx(ki,{size:"small",label:"Location",value:O??ne??"",placeholder:"report.malloy",disabled:Q,onChange:st=>P(st.target.value),InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Location"},error:nt!==void 0,helperText:nt??(Qe?`Written as ${Qe} in the package, and opened in the builder.`:"A path in the package; the package root by default.")}),de&&p.jsx(xo,{severity:"error",children:de})]})]})]})})}function L$e(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 IC=(e,t,n)=>`${e}::${t}::${n}`,z$e=new Map,F$e=new Map;function eL({children:e}){const t=Hr().theme.ui;return p.jsx(wt,{component:"div",sx:{...t.type.label,color:"text.secondary",mb:.75},children:e})}function _$e({layout:e,checked:t,disabled:n,onPick:r}){const{theme:o}=Hr(),a=o.ui,i=Xd(o.cardBorder),s=t?o.accent:"currentColor";return p.jsxs(rs,{role:"radio","aria-checked":t,"aria-label":e==="linear"?"Linear":"Grid",disabled:n,onClick:r,sx:l=>({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%, ${l.palette.background.paper})`:l.palette.background.paper,color:l.palette.text.secondary,textAlign:"left"}),children:[p.jsx("svg",{width:"34",height:"26",viewBox:"0 0 34 26","aria-hidden":!0,children:e==="linear"?p.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[p.jsx("rect",{x:"3",y:"2",width:"28",height:"7",rx:"1.5"}),p.jsx("rect",{x:"3",y:"12",width:"28",height:"5",rx:"1.5"}),p.jsx("path",{d:"M5 21.5h20",strokeLinecap:"round"})]}):p.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[p.jsx("rect",{x:"2",y:"2",width:"14",height:"10",rx:"1.5"}),p.jsx("rect",{x:"18",y:"2",width:"14",height:"10",rx:"1.5"}),p.jsx("rect",{x:"2",y:"14",width:"30",height:"10",rx:"1.5"})]})}),p.jsxs(Ee,{children:[p.jsx(Ee,{sx:{...a.type.control,fontWeight:t?a.type.label.fontWeight:500,color:t?o.accent:"text.primary"},children:e==="linear"?"Linear":"Grid"}),p.jsx(Ee,{sx:{...a.type.caption,color:"text.secondary"},children:e==="linear"?"Read top to bottom":"Tiles side by side"})]})]})}const B$e=rn(p.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"})),U$e=rn(p.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),V$e=rn(p.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"})),q$e=rn(p.jsx("path",{d:"M20 10V8h-4V4h-2v4h-4V4H8v4H4v2h4v4H4v2h4v4h2v-4h4v4h2v-4h4v-2h-4v-4zm-6 4h-4v-4h4z"})),oB={dashboard:pr.blue,report:pr.violet,model:pr.cyan,dataApp:pr.pink,data:pr.lime,materialization:pr.amber,agent:pr.red};function aB({type:e,size:t=18,sx:n,...r}){return p.jsx(U0,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:H$e[e]()})}const H$e={report:W$e,model:Y$e,data:G$e,materialization:K$e,dataApp:Z$e,dashboard:Q$e,agent:X$e};function W$e(){return p.jsxs(p.Fragment,{children:[p.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"}),p.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),p.jsx("path",{d:"M8 17 v-3"}),p.jsx("path",{d:"M12 17 v-6"}),p.jsx("path",{d:"M16 17 v-4"})]})}function Y$e(){return p.jsxs(p.Fragment,{children:[p.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),p.jsx("path",{d:"M4 7 l8 4 l8 -4"}),p.jsx("path",{d:"M12 11 v10"})]})}function G$e(){return p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),p.jsx("path",{d:"M3.5 9.5 H20.5"}),p.jsx("path",{d:"M9.5 3.5 V20.5"})]})}function K$e(){return p.jsxs(p.Fragment,{children:[p.jsx("path",{d:"M12 3 L21 7.5 L12 12 L3 7.5 Z"}),p.jsx("path",{d:"M3 12 L12 16.5 L21 12"}),p.jsx("path",{d:"M3 16.5 L12 21 L21 16.5"})]})}function Q$e(){return p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),p.jsx("path",{d:"M3.5 9.5 H20.5"}),p.jsx("path",{d:"M12 9.5 V20.5"}),p.jsx("path",{d:"M12 15 H20.5"})]})}function X$e(){return p.jsxs(p.Fragment,{children:[p.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),p.jsx("path",{d:"M5 20 a7 7 0 0 1 14 0"})]})}function Z$e(){return p.jsxs(p.Fragment,{children:[p.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),p.jsx("path",{d:"M3.5 9.5 H20.5"}),p.jsx("path",{d:"M7 13.5 H17"}),p.jsx("path",{d:"M7 16.5 H13"})]})}function iB(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 J$e=12;function eEe(e){const t=e?.trim().toLowerCase()??"";if(t.startsWith("array")||t.endsWith("[]"))return U$e;if(t.startsWith("record")||t.startsWith("struct"))return V$e;switch(t.split(/[\s(<]/)[0]){case"string":return B$e;case"number":return q$e;case"date":return A6;case"timestamp":case"timestamptz":return N6;case"boolean":return I6;default:return L6}}function tEe({column:e}){const t=eEe(e.type);return p.jsxs(Ee,{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:[p.jsx(t,{"aria-hidden":!0,sx:{fontSize:18,color:"primary.main",flexShrink:0}}),p.jsxs(Ee,{sx:{display:"flex",alignItems:"baseline",gap:1,minWidth:0,flex:1},children:[p.jsx(wt,{component:"span",sx:{fontFamily:Fo,fontSize:"0.8125rem",fontWeight:500,color:"text.primary",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),e.type&&p.jsx(wt,{component:"span",variant:"caption",color:"text.secondary",sx:{flexShrink:0,maxWidth:"50%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.type})]})]})}function nEe({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,l]=C.useState(r?.path);s!==r?.path&&(l(r?.path),i(""));const d=C.useId(),u=r?.path??"",m=u.split("/").pop()||u,g=u.slice(0,Math.max(0,u.length-m.length-1)),y=r?.info?.rowCount,x=[g,y===void 0?null:iB(y)].filter(Boolean).join(" · "),w=C.useMemo(()=>r?.info?.columns??[],[r]),S=a.trim().toLowerCase(),b=C.useMemo(()=>S?w.filter($=>$.name?.toLowerCase().includes(S)||$.type?.toLowerCase().includes(S)):w,[w,S]);return p.jsxs(Oo,{open:n,onClose:t,showClose:!0,title:p.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1.5,sx:{minWidth:0},children:[p.jsx(Ee,{"aria-hidden":!0,sx:{width:32,height:32,borderRadius:1,bgcolor:oB.data,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:p.jsx(aB,{type:"data",size:18})}),p.jsxs(Ee,{sx:{minWidth:0},children:[p.jsx(wt,{component:"span",noWrap:!0,title:u,sx:{display:"block",fontFamily:Fo,fontSize:"1rem",fontWeight:600,letterSpacing:0,lineHeight:1.4},children:m||"Columns"}),x&&p.jsx(wt,{component:"span",variant:"caption",color:"text.secondary",noWrap:!0,sx:{display:"block",lineHeight:1.4},children:x})]})]}),children:[r?.error&&p.jsx(xo,{severity:"error",variant:"outlined",children:r.error}),r&&!r.error&&p.jsxs(Ee,{component:"section","aria-labelledby":d,sx:{display:"flex",flexDirection:"column",border:"1px solid",borderColor:"divider",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",mb:2},children:[p.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1,sx:{px:1.5,py:1,minHeight:44,borderBottom:"1px solid",borderColor:"divider"},children:[p.jsxs(wt,{id:d,component:"h3",sx:{fontSize:"0.875rem",fontWeight:600},children:["Columns",p.jsxs(wt,{component:"span",variant:"caption",color:"text.secondary",sx:{ml:.75,fontVariantNumeric:"tabular-nums"},children:["· ",S?`${b.length} of `:"",w.length]})]}),w.length>J$e&&p.jsx(zx,{value:a,onChange:$=>i($.target.value),placeholder:"Filter columns",inputProps:{"aria-label":"Filter columns"},startAdornment:p.jsx(ME,{position:"start",children:p.jsx(Gp,{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"}}})]}),p.jsx(Ee,{sx:{overflowY:"auto",maxHeight:420,px:.75,py:.75},children:b.length===0?p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic",px:1,py:1},children:S?"No columns match":"No columns"}):p.jsx(Ee,{component:"ul","aria-labelledby":d,sx:{listStyle:"none",m:0,p:0},children:b.map(($,k)=>p.jsx(tEe,{column:$},`${$.name}-${k}`))})})]})]})}const sB=(e,t,n)=>["packageVersions",e,t,n];async function lB(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 rEe(e,t,n={}){const{apiClients:r,server:o}=er(),a=(n.enabled??!0)&&e!==""&&t!=="",i=Ld({queryKey:sB(e,t,o),queryFn:()=>lB(r,e,t),enabled:a,staleTime:3e4,retry:!1}),{refetch:s}=i,l=C.useCallback(()=>void s(),[s]),d=i.data??[];return{versions:d,latest:d.find(u=>u.latest)?.id,isPending:a&&i.isPending,isError:a&&i.isError,refetch:l}}function oEe(e,t){const{apiClients:n,server:r}=er(),o=Tl();return C.useCallback(()=>o.fetchQuery({queryKey:sB(e,t,r),queryFn:()=>lB(n,e,t),staleTime:0,retry:!1}),[o,n,r,e,t])}function aEe(e,t){const n=Tl();return C.useCallback(()=>n.invalidateQueries({predicate:r=>r.queryKey[1]===e&&r.queryKey[2]===t}),[n,e,t])}const iEe=rn(p.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"})),sEe=rn(p.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"})),lEe=rn(p.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"})),cEe=rn(p.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"})),mg=e=>{const t=e?.response?.data?.message;return typeof t=="string"&&t!==""?t:e instanceof Error?e.message:"Unknown error"},uEe=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},Rp=e=>e.archiveStatus==="archive",LC="Tables built for this version alone (under scope: version) are dropped.";function tL(e,t){const n=!Rp(e)&&t.filter(o=>!Rp(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 dEe({environmentName:e,packageName:t,versions:n,selectedVersionId:r,onSelectVersion:o,onReplaceVersion:a,onPackageDeleted:i,canManage:s}){const{apiClients:l}=er(),d=Tl(),u=aEe(e,t),m=oEe(e,t),[g,y]=C.useState(null),[x,w]=C.useState(null),[S,b]=C.useState(null),[$,k]=C.useState(null),[R,O]=C.useState(null),[P,D]=C.useState(null),A=C.useRef(null),F=C.useRef(null),L=C.useRef(null),_=C.useRef(new Map),E=n.find(fe=>fe.latest)?.id,z=r??E,I=()=>Promise.all([u(),d.invalidateQueries({queryKey:["packages",e]})]),U=async(fe,he)=>{const me=he??await m().catch(()=>{});if(me===void 0)return;const le=me.find(Le=>Le.latest)?.id,ve=le??me.find(Le=>Le.id!==fe&&!Rp(Le))?.id;ve!==void 0&&(a?a(ve===le?void 0:ve):o(ve))},N=a0({mutationFn:fe=>l.versions.setPackageLatestVersion(e,t,{version:fe}),onSuccess:async()=>{b(null),await I()},onError:()=>void I()}),q=a0({mutationFn:({id:fe,archiveStatus:he})=>l.versions.updatePackageVersion(e,t,fe,{archiveStatus:he}),onSuccess:async(fe,{id:he,archiveStatus:me})=>{k(null),me==="archive"&&he===z&&await U(he),await I()},onError:(fe,{id:he,archiveStatus:me})=>{me==="unarchive"&&D(`Couldn't unarchive v${he}: ${mg(fe)}`),I()}}),Y=q.isPending?q.variables?.id:void 0,oe=a0({mutationFn:({id:fe})=>l.versions.deletePackageVersion(e,t,fe),onSuccess:async(fe,{id:he,read:me})=>{O(null);const le=await m().catch(()=>{})??me.filter(ve=>ve.id!==he);if(le.length===0){await d.invalidateQueries({queryKey:["packages",e]}),i?.();return}he===z&&await U(he,le),await I()},onError:()=>void I()}),Q=()=>w(null),ae=x?tL(x.version,n):{},de=x!==null&&!Rp(x.version)&&x.version.latest&&ae.archive!==void 0&&ae.delete!==void 0,X=R!==null&&R.versions===void 0,se=R?.versions!==void 0&&R.versions.length<=1,J=R?.versions!==void 0?tL(R.version,R.versions).delete:void 0,Z=async fe=>{Q(),y(null),oe.reset(),O({version:fe});const he=ve=>O(Le=>Le!==null&&Le.version.id===fe.id&&Le.versions===void 0?ve:Le);let me;try{me=await m()}catch(ve){he(null),D(`Couldn't check v${fe.id} before deleting it: ${mg(ve)}`);return}const le=me.find(ve=>ve.id===fe.id);if(le===void 0){he(null),D(`v${fe.id} is no longer a version of ${t}.`),I();return}he({version:le,versions:me})},G=(fe,he)=>{!s||Y===fe.id||w({version:fe,anchor:_.current.get(fe.id)??he})},ue=(fe,he)=>{const me=fe.key==="ArrowRight"||fe.key==="ContextMenu"||fe.key==="F10"&&fe.shiftKey;!s||!me||(fe.preventDefault(),fe.stopPropagation(),G(he,fe.currentTarget))},ie=x&&p.jsxs(ea,{disabled:ae.delete!==void 0,onClick:()=>void Z(x.version),children:[p.jsx(ml,{children:p.jsx(vF,{fontSize:"small"})}),p.jsx(xi,{primary:"Delete version",secondary:ae.delete})]},"delete");return p.jsxs(p.Fragment,{children:[p.jsx(Hn,{size:"small",variant:"outlined",endIcon:p.jsx(D6,{}),"aria-label":z?`Version v${z}, 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:z?`v${z}`:"Select a version"}),p.jsx(dc,{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===z,me=Rp(fe),le=[me?"Archived":void 0,uEe(fe.createdAt),fe.gitCommitSha?fe.gitCommitSha.slice(0,7):void 0].filter(Boolean).join(" · ");return p.jsxs(ea,{"aria-current":he?"true":void 0,"aria-disabled":me&&!s?"true":void 0,"aria-haspopup":s?"menu":void 0,"data-testid":"version-row",onKeyDown:ve=>ue(ve,fe),onClick:ve=>{if(me){G(fe,ve.currentTarget);return}he||(y(null),o(fe.id,ve))},sx:ve=>({gap:1,borderLeft:"3px solid",borderLeftColor:he?ve.palette.primary.main:"transparent",backgroundColor:he?ns(ve.palette.primary.main,.04):void 0,cursor:he||me&&!s?"default":"pointer"}),children:[p.jsx(xi,{primary:fe.id,secondary:le,sx:{opacity:me?.6:1},slotProps:{primary:{sx:{fontWeight:he?600:400}}}}),fe.latest&&p.jsx($E,{size:"small",label:"Latest",color:"info",variant:"outlined",sx:{height:20,fontSize:11,fontWeight:600}}),s&&p.jsx(Br,{title:Y===fe.id?"Updating this version…":"",children:p.jsx("span",{children:p.jsx(no,{ref:ve=>{ve?_.current.set(fe.id,ve):_.current.delete(fe.id)},size:"small","aria-label":`More actions for version ${fe.id}`,"aria-haspopup":"menu",disabled:Y===fe.id,onClick:ve=>{ve.stopPropagation(),w({version:fe,anchor:ve.currentTarget})},children:p.jsx(sEe,{fontSize:"small"})})})})]},fe.id)})}),p.jsx(dc,{anchorEl:x?.anchor??null,open:x!==null,onClose:Q,slotProps:{list:{"aria-label":x?`Actions for version ${x.version.id}`:void 0,disabledItemsFocusable:!0,autoFocus:de}},children:x&&Rp(x.version)?[p.jsxs(ea,{onClick:()=>{const{id:fe}=x.version;Q(),q.mutate({id:fe,archiveStatus:"unarchive"})},children:[p.jsx(ml,{children:p.jsx(cEe,{fontSize:"small"})}),p.jsx(xi,{primary:"Unarchive"})]},"unarchive"),p.jsx(wl,{},"divider"),ie]:x&&[p.jsxs(ea,{disabled:x.version.latest,onClick:()=>{b(x.version),N.reset(),Q(),y(null)},children:[p.jsx(ml,{children:p.jsx(lEe,{fontSize:"small"})}),p.jsx(xi,{primary:"Pin as latest",secondary:x.version.latest?"Already the latest version":void 0})]},"pin-latest"),p.jsxs(ea,{disabled:ae.archive!==void 0,onClick:()=>{k(x.version),q.reset(),Q(),y(null)},children:[p.jsx(ml,{children:p.jsx(iEe,{fontSize:"small"})}),p.jsx(xi,{primary:"Archive",secondary:ae.archive})]},"archive"),p.jsx(wl,{},"divider"),ie]}),p.jsx(Oo,{open:S!==null,onClose:()=>{N.isPending||b(null)},title:S?`Pin v${S.id} as latest`:"",description:S?`Requests that name no version will be served from v${S.id}.`:void 0,initialFocus:A,actions:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{ref:A,disabled:N.isPending,onClick:()=>b(null),children:"Cancel"}),p.jsx(Hn,{variant:"contained",loading:N.isPending,onClick:()=>S&&N.mutate(S.id),children:"Pin as latest"})]}),children:p.jsxs(Wn,{spacing:1.5,children:[E&&S&&E!==S.id&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:`The latest version is v${E} now. Links and requests that name a version keep answering as before.`}),N.isError&&S&&p.jsx(xo,{severity:"error",role:"alert",children:`Couldn't pin v${S.id} as latest: ${mg(N.error)}`})]})}),p.jsx(Oo,{open:$!==null,onClose:()=>{q.isPending||k(null)},title:$?`Archive v${$.id}`:"",description:$?`v${$.id} stops being served and is unloaded. Its files stay, so it can be unarchived.`:void 0,initialFocus:F,actions:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{ref:F,disabled:q.isPending,onClick:()=>k(null),children:"Cancel"}),p.jsx(Hn,{variant:"contained",loading:q.isPending,onClick:()=>$&&q.mutate({id:$.id,archiveStatus:"archive"}),children:"Archive"})]}),children:p.jsxs(Wn,{spacing:1.5,children:[p.jsx(wt,{variant:"body2",color:"text.secondary",children:`${LC} Its scheduled builds stop, and once unarchived it serves live until it is built again.`}),q.isError&&$&&p.jsx(xo,{severity:"error",role:"alert",children:`Couldn't archive v${$.id}: ${mg(q.error)}`})]})}),p.jsx(Oo,{open:R!==null,onClose:()=>{oe.isPending||O(null)},title:R?`Delete v${R.version.id}`:"",initialFocus:L,actions:p.jsxs(p.Fragment,{children:[p.jsx(Hn,{ref:L,disabled:oe.isPending,onClick:()=>O(null),children:"Cancel"}),p.jsx(Hn,{variant:"contained",color:"error",loading:oe.isPending,disabled:X||J!==void 0,onClick:()=>R?.versions&&oe.mutate({id:R.version.id,read:R.versions}),children:se?"Delete package":"Delete version"})]}),children:p.jsxs(Wn,{spacing:1.5,children:[X&&R&&p.jsx(wt,{variant:"body2",children:`Checking ${t}'s versions before deleting v${R.version.id}…`}),R&&!X&&p.jsx(wt,{variant:"body2",children:se?`v${R.version.id} is the only version of ${t}, so deleting it deletes the package. ${LC} This cannot be undone.`:`v${R.version.id} stops being served and its files are removed. ${LC} Links that name it stop working, and this cannot be undone.`}),J!==void 0&&R&&p.jsx(xo,{severity:"warning",role:"alert",children:`v${R.version.id} can't be deleted now: ${J}.`}),oe.isError&&R&&p.jsx(xo,{severity:"error",role:"alert",children:`Couldn't delete v${R.version.id}: ${mg(oe.error)}`})]})}),p.jsx(ph,{open:P!==null,autoHideDuration:8e3,onClose:()=>D(null),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:p.jsx(Ee,{children:p.jsx(xo,{severity:"error",variant:"filled",onClose:()=>D(null),children:P})})})]})}const fEe="README.malloynb",pEe=e=>!!e&&!e.includes("/")&&N1(e)?.toLowerCase()==="readme";function A2e({onClickPackageFile:e,onOpenDocument:t,resourceUri:n,onEvent:r,onSelectVersion:o,onReplaceVersion:a}){const{apiClients:i,server:s,mutable:l}=er(),d=Tl(),u=e??(ne=>{window.location.href=ne}),{environmentName:m,packageName:g,versionId:y}=ko(n),x=rEe(m,g),{versions:w}=x,S=w.length>0,b=!S&&!x.isPending&&!x.isError,$=o??((ne,qe)=>u(`/${encodeURIComponent(m)}/${encodeURIComponent(g)}/${encodeURIComponent(ne)}`,qe)),k=t??((ne,qe)=>{const Oe=ne.mode==="edit"?b0e(m,g,ne.path):v_(m,g,ne.path);qe?u(Oe,qe):u(Oe)}),[R,O]=C.useState(null),[P,D]=C.useState(!1),A=yxe(),F=P_()?.documentStorage,[L,_]=C.useState([]),[E,z]=C.useState({state:F?"pending":"ready"}),I=C.useCallback(async()=>{if(!F)return;let ne;try{ne=await F.listWorkspaces(!1)}catch{z({state:"failed"});return}z({state:"ready",chosen:C_(ne)});const qe=[],Oe=wy(m,g,"");for(const Qe of ne.filter(nt=>nt.writeable))for(const nt of await F.listDocuments(Qe))nt.path.startsWith(Oe)&&qe.push({locator:nt,where:Qe.description});_(qe)},[F,m,g]);C.useEffect(()=>{I()},[I]);const U=ne=>ne.path.slice(wy(m,g,"").length),N=wo({queryKey:["package",m,g,y],queryFn:()=>i.packages.getPackage(m,g,y,!1)}),q=wo({queryKey:["package-agents",m,g,y],queryFn:()=>i.agents.listAgents(m,g,y)}),Y=b_(m,g,y),oe=wo({queryKey:["models",m,g,y],queryFn:()=>i.models.listModels(m,g,y)}),Q=wo({queryKey:["databases",m,g,y],queryFn:()=>i.databases.listDatabases(m,g,y)}),ae=wo({queryKey:["data-apps",m,g,y],queryFn:async()=>{try{return await i.dataApps.listDataApps(m,g,y)}catch(ne){const qe=ne?.response?.status;if(qe===404||qe===void 0)return{data:[]};throw ne}}}).data?.data??[],de=Y.reports.filter(ne=>!!ne.path),X=mEe(de),se=new Set(de.map(ne=>ne.path).filter(ne=>ne!==void 0)),J=(oe.data?.data??[]).slice().filter(ne=>!se.has(ne.path)).sort((ne,qe)=>ne.path.localeCompare(qe.path)),Z=(Q.data?.data??[]).slice().sort((ne,qe)=>ne.path.localeCompare(qe.path)),G=E.state==="ready"?X0e({authoritative:E.chosen?.authoritative===!0,mutable:l&&b,canStore:E.chosen?.writeable===!0,...y===void 0?{}:{versionId:y}}):void 0,ue=Y.settled&&(oe.isSuccess||oe.isError),ie=G!==void 0&&ue,fe=ie&&!A,he=C.useMemo(()=>{if(!ie)return;const ne=[...Y.reports.flatMap(qe=>qe.path?[qe.path]:[]),...(oe.data?.data??[]).flatMap(qe=>qe.path?[qe.path]:[])];if(G==="storage"&&F&&E.state==="ready")return E.chosen?{route:G,storage:F,workspace:E.chosen,environmentName:m,packageName:g,existing:ne}:void 0;if(G==="package")return{route:G,existing:ne,write:async(qe,Oe)=>{await i.models.updateModelSource(m,g,qe,{source:Oe})}}},[ie,G,F,E,m,g,i,Y.reports,oe.data]),me=N.data?.data?.description??"",le=q.data?.data??[],ve=(de.find(ne=>ne.path===fEe)??de.find(ne=>pEe(ne.path)))?.path,Le=!Y.settled,Ie=S?p.jsx(dEe,{environmentName:m,packageName:g,versions:w,...y!==void 0?{selectedVersionId:y}:{},onSelectVersion:$,...a?{onReplaceVersion:a}:{},onPackageDeleted:()=>u(`/${encodeURIComponent(m)}`),canManage:l}):null,Re=p.jsxs(Wn,{direction:"row",alignItems:"center",spacing:1.5,sx:{mb:.5},children:[p.jsx(wt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em"},children:g}),Ie]});if(N.isError){const ne=p.jsx(Xa,{error:N.error,context:`${m} > ${g}`});return Ie?p.jsxs(O0,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[p.jsx(Ee,{sx:{mb:4},children:Re}),ne]}):ne}return p.jsxs(O0,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[p.jsxs(Ee,{sx:{mb:4},children:[Re,me&&p.jsx(wt,{variant:"body2",color:"text.secondary",children:me})]}),p.jsx(k$e,{warnings:N.data?.data?.warnings}),x.isError&&p.jsx(Ee,{sx:{mb:4},children:p.jsx(xo,{severity:"warning",action:p.jsx(Hn,{color:"inherit",size:"small",onClick:x.refetch,children:"Retry"}),children:"Could not read this package's versions, so nothing that changes it is offered until they load."})}),Le&&p.jsx(Go,{text:"Loading package..."}),he&&p.jsx(I$e,{open:P,layout:"linear",environmentName:m,packageName:g,...y!==void 0?{versionId:y}:{},models:J.map(ne=>ne.path).filter(ne=>typeof ne=="string"&&ne.endsWith(".malloy")&&!se.has(ne)),modelsLoading:oe.isPending,...oe.isError?{modelsError:oe.error}:{},onRetryModels:()=>void oe.refetch(),target:he,...r?{onEvent:r}:{},onClose:()=>D(!1),onCreated:ne=>{D(!1),sxe(d),d.invalidateQueries({queryKey:["models"]}),k({path:ne.path,layout:ne.layout,slug:ne.slug,mode:"edit"})}}),!Le&&p.jsxs(p.Fragment,{children:[Y.isError&&p.jsx(Ee,{sx:{mb:4},children:p.jsx(xo,{severity:"warning",action:p.jsx(Hn,{color:"inherit",size:"small",onClick:()=>void Y.refetch(),children:"Retry"}),children:"Could not list this package's reports, so any it has are missing from this page."})}),(X.length>0||ie)&&p.jsxs(Ds,{title:"Reports",count:X.length,...fe?{action:p.jsx(Qy,{label:"Report",onClick:()=>D(!0)})}:{},children:[X.length===0&&p.jsx(zC,{label:"No reports yet",...fe?{action:{label:"Add report",onClick:()=>D(!0)}}:{}}),X.map(ne=>p.jsx(xp,{type:ne.layout==="grid"?"dashboard":"report",label:ne.label,rightLabel:ne.layout,...ne.secondary===void 0?{}:{description:ne.secondary},onClick:qe=>ne.path.endsWith(".malloynb")?u(`/${m}/${g}/${ne.path}`,qe):k({path:ne.path,layout:ne.layout,slug:ne.slug,mode:"view"},qe)},ne.path))]}),b&&L.length>0&&p.jsx(Ds,{title:"Drafts",count:L.length,children:L.map(({locator:ne,where:qe})=>p.jsx(xp,{type:ne.type==="grid"?"dashboard":"report",label:U(ne),rightLabel:qe,onClick:Oe=>k({path:U(ne),layout:ne.type,slug:N1(U(ne))??"",mode:"edit"},Oe),trailingAction:p.jsx(Br,{title:"Delete this draft",children:p.jsx(no,{size:"small","aria-label":`Delete draft ${U(ne)}`,onClick:Oe=>{Oe.stopPropagation(),F?.deleteDocument(ne).then(I)},children:p.jsx(vF,{fontSize:"small"})})})},`${ne.workspace}:${ne.path}`))}),ae.length>0&&p.jsx(Ds,{title:"Apps",count:ae.length,children:ae.map(ne=>{const qe=!!ne.title&&ne.title!==ne.path,Oe=`${J_(s)}${ne.resource}`;return p.jsx(xp,{type:"dataApp",label:qe?ne.title:ne.path,rightLabel:qe?ne.path:void 0,onClick:Qe=>{e?e(`/${m}/${g}/data-apps/${ne.path}`,Qe):Qe&&(Qe.metaKey||Qe.ctrlKey)?window.open(Oe,"_blank"):window.location.href=Oe},trailingAction:p.jsx(Br,{title:"Open standalone in new tab",children:p.jsx(no,{size:"small",href:Oe,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",onClick:Qe=>Qe.stopPropagation(),sx:{color:"text.secondary"},children:p.jsx(Z_,{fontSize:"small"})})})},ne.path)})}),p.jsxs(Ds,{title:"Models",count:J.length,children:[J.map(ne=>p.jsx(xp,{type:"model",label:ne.path,onClick:qe=>u(`/${m}/${g}/${ne.path}`,qe)},ne.path)),J.length===0&&p.jsx(zC,{label:"No models"})]}),le.length>0&&p.jsx(Ds,{title:"Agents",count:le.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:le.map(ne=>p.jsx(hEe,{agent:ne},ne.name))}),p.jsxs(Ds,{title:"Data",count:Z.length,children:[Z.map(ne=>p.jsx(xp,{type:"data",label:ne.path,rightLabel:ne.info?iB(ne.info.rowCount):"Unreadable",onClick:()=>O(ne)},ne.path)),Z.length===0&&p.jsx(zC,{label:"No data files"})]}),p.jsx(sSe,{resourceUri:n,versioned:!b}),ve&&p.jsx(Ee,{sx:{mt:6},children:p.jsx(N$e,{resourceUri:I1({environmentName:m,packageName:g,versionId:y}),path:ve,onLinkNavigate:u})})]}),p.jsx(nEe,{database:R,onClose:()=>O(null)})]})}function xp({type:e,label:t,description:n,rightLabel:r,onClick:o,trailingAction:a}){return p.jsx(L1,{icon:p.jsx(aB,{type:e}),tint:oB[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 hEe({agent:e}){return p.jsxs(p.Fragment,{children:[p.jsx(xp,{type:"agent",label:e.name??"",...e.description?{description:e.description}:{},...e.model&&e.model!=="inherit"?{rightLabel:e.model}:{}}),(e.schedules??[]).map(t=>{const n=i2(t.cron??"");return p.jsxs(wt,{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 mEe(e){const t=e.map(r=>({path:r.path??"",layout:KR(r),slug:N1(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 zC({label:e,action:t}){return p.jsxs(Wn,{direction:"row",sx:{alignItems:"center",gap:1,py:1},children:[p.jsx(wt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:e}),t&&p.jsx(Hn,{size:"small",onClick:t.onClick,children:t.label})]})}const nL=/^publisher:document:(dashboard|notebook):(.+)$/;function gEe(e,t){const n=[];for(let r=0;r<e.length;r++){const o=e.key(r);o!==null&&nL.test(o)&&n.push(o)}for(const r of n){const[,o,a]=nL.exec(r),i=e.getItem(r);i!==null&&t(a,j_(o),i)&&e.removeItem(r)}}const FC={name:"Local",description:"Stored in this browser only",writeable:!0},O$="publisher:report:",md=e=>`${O$}${e}`;function gg(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 _C=(e,t)=>localStorage.setItem(md(e),JSON.stringify(t));class yEe{migrated=!1;migrate(){this.migrated||(this.migrated=!0,gEe(localStorage,(t,n,r)=>gg(md(t))!==void 0?!1:(_C(t,{type:n,content:r}),!0)))}async listWorkspaces(t){return[FC]}async listDocuments(t,n){if(t.name!==FC.name)return[];this.migrate();const r=[];for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o);if(a===null||!a.startsWith(O$))continue;const i=gg(a);i&&(n===void 0||i.type===n)&&r.push({workspace:FC.name,type:i.type,path:a.slice(O$.length)})}return r}async getDocument(t){this.migrate();const n=gg(md(t.path));if(n===void 0)throw BC(t);return n.content}async getDocumentType(t){this.migrate();const n=gg(md(t.path));if(n===void 0)throw BC(t);return n.type}async saveDocument(t,n){this.migrate(),_C(t.path,{type:t.type,content:n})}async deleteDocument(t){if(this.migrate(),gg(md(t.path))===void 0)throw BC(t);localStorage.removeItem(md(t.path))}async moveDocument(t,n){const r=await this.getDocument(t);_C(n.path,{type:n.type,content:r}),n.path!==t.path&&localStorage.removeItem(md(t.path))}}function BC(e){return new k_(`No report at ${e.workspace}/${e.path}`)}async function vEe(e,t,n,r){const o=C_(await e.listWorkspaces(!1));if(!o)return;const a=wy(t,n,r);if(e.getDocumentType)try{return await e.getDocumentType({workspace:o.name,path:a})}catch(i){if($_(i))return;throw i}return(await e.listDocuments(o)).find(i=>i.path===a)?.type}function D2e(e,t,n,r=!0){const o=P_()?.documentStorage,a=r&&o!==void 0,[i,s]=C.useState(),l=wy(e,t,n);return C.useEffect(()=>{if(!a||!o)return;let d=!1;return vEe(o,e,t,n).catch(()=>{}).then(u=>{d||s({key:l,layout:u})}),()=>{d=!0}},[a,o,e,t,n,l]),a?i?.key===l?{layout:i.layout,settled:!0}:{layout:void 0,settled:!1}:{layout:void 0,settled:!0}}function N2e(e,t,n="grid"){const r=t.filter(a=>!!a.path).filter(a=>N1(a.path)===e),o=r.filter(a=>KR(a)===n);return o.length===1?{found:g$(o[0])}:r.length===1?{found:g$(r[0])}:r.length===0?{missing:!0}:{ambiguous:r.map(a=>a.path).sort()}}const bEe=/^(dashboards|notebooks)\/([^/]+)$/;function I2e(e){const t=bEe.exec(e);if(t)return{name:t[2],prefer:t[1]==="dashboards"?"grid":"linear"}}const rL="[publisher.report]",oL="[publisher.console]";function xEe(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 L2e(e){return t=>{const n={...e,...t,at:new Date().toISOString()};xEe(t)?console.warn(rL,n):console.info(rL,n)}}function wEe(e){const t={...e,at:new Date().toISOString()};e.ok?console.info(oL,t):console.warn(oL,t)}const Lo={white:"#FFFFFF",offWhite:"#F8FAFC",grey:{light:"#E2E8F0",mid:"#64748B"},black:"#0F172A",semantic:{success:{main:pr.emerald,light:"#D1FAE5",dark:"#047857"},warning:{main:pr.amber,light:"#FEF3C7",dark:"#92400E"},error:{main:pr.red,light:"#FEE2E2",dark:"#B91C1C"},info:{main:pr.blue,light:"#DBEAFE",dark:"#1D4ED8"}}},Wb='"Inter", "Helvetica Neue", "Arial", sans-serif',Vo={50:Lo.offWhite,100:"#F1F5F9",200:Lo.grey.light,300:"#CBD5E1",400:"#94A3B8",500:Lo.grey.mid,600:"#475569",700:"#334155",800:"#1E293B",900:Lo.black},z2e={headerHeight:56},aL="0 1px 3px rgba(0, 0, 0, 0.1)",SEe="#0f172a",CEe="#1e293b",kEe="#f1f5f9",$Ee="#cbd5e1",EEe="#334155",cB=(e="light",t)=>{const n=e==="dark",r=n?SEe:Lo.white,o=n?CEe:Lo.white,a=n?kEe:Lo.black,i=n?$Ee:Lo.grey.mid,s=n?EEe:Lo.grey.light,{accent:l,accentHover:d,accentContrast:u}=t??Dk(void 0,e);return Tx({cssVariables:{nativeColor:!0},palette:{mode:e,primary:{main:l,light:Lo.grey.light,dark:d,contrastText:u},secondary:{main:Lo.grey.mid,light:Lo.grey.light,dark:Lo.black},grey:Vo,success:Lo.semantic.success,warning:Lo.semantic.warning,error:Lo.semantic.error,info:Lo.semantic.info,background:{default:r,paper:o},text:{primary:a,secondary:i},divider:s},typography:{fontFamily:Wb,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 ${l}`,outlineOffset:2}}}},MuiCssBaseline:{styleOverrides:{"*":{scrollbarWidth:"thin",scrollbarColor:n?"#475569 #1e293b":`${Vo[300]} ${Vo[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:n?"#1e293b":Vo[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Vo[300],borderRadius:"4px","&:hover":{background:n?"#64748b":Vo[400]}},"&::-webkit-scrollbar-corner":{background:n?"#1e293b":Vo[100]}},".malloy-table.root":{scrollbarWidth:"auto",scrollbarColor:"auto","&::-webkit-scrollbar, &::-webkit-scrollbar-track, &::-webkit-scrollbar-corner":{background:n?"#1e293b":Vo[100]},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Vo[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)":Vo[200],color:n?"#64748b":Vo[500]}},outlined:{color:a,borderColor:n?"#475569":Vo[300],"&:hover":{borderColor:n?"#64748b":Vo[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:aL,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:Wb,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?Vo[600]:Vo[300]}`,borderRadius:6,transition:`border-color ${Zy} ease-in`,...Jy,backgroundColor:o,"&:hover":{borderColor:n?"#64748b":Vo[400]},"&.Mui-focused":{borderColor:n?Vo[400]:Vo[500],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:Wb,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:Wb}}},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:Vo[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)":Lo.offWhite},"&.Mui-selected":{backgroundColor:n?"rgba(255, 255, 255, 0.12)":Lo.offWhite,color:a,"& .MuiListItemIcon-root":{color:a},"& .MuiListItemText-primary":{color:a},"&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.16)":Lo.grey.light}}}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:o,color:a,boxShadow:aL}}}}})};cB("light");function REe({children:e}){const{mode:t,theme:n}=Hr(),{accent:r,accentHover:o,accentContrast:a}=n,i=C.useMemo(()=>cB(t,{accent:r,accentHover:o,accentContrast:a}),[t,r,o,a]);return p.jsxs(e7,{theme:i,children:[p.jsx(lQ,{}),e]})}const TEe=C.lazy(()=>vo(()=>import("./HomePage-B4iN5rso.js"),[])),MEe=C.lazy(()=>vo(()=>import("./MainPage-DGiMH0eU.js"),__vite__mapDeps([7,8,9,10]))),OEe=C.lazy(()=>vo(()=>import("./PackageSplatRoute-CQ7PxhkD.js").then(e=>e.a),__vite__mapDeps([11,10]))),PEe=C.lazy(()=>vo(()=>import("./PackagePage-D2Pay_Xy.js"),__vite__mapDeps([12,9,10,13]))),jEe=C.lazy(()=>vo(()=>import("./EnvironmentPage-BxNqq3cN.js"),[])),AEe=C.lazy(()=>vo(()=>import("./RouteError-BysHaT0t.js"),[])),DEe=C.lazy(()=>vo(()=>import("./ThemeEditorPage-BFyTBbqA.js"),__vite__mapDeps([14,15]))),NEe=(e="/",t=new yEe,n)=>(p1e(wEe),Wq([{path:e,element:p.jsx(Ire,{children:p.jsx(axe,{documentStorage:t,children:p.jsx(REe,{children:p.jsx(C.Suspense,{fallback:p.jsx(Go,{}),children:p.jsx(MEe,{headerProps:n})})})})}),errorElement:p.jsx(AEe,{}),children:[{index:!0,element:p.jsx(TEe,{})},{path:"settings/theme",element:p.jsx(DEe,{})},{path:"settings",element:p.jsx(xq,{to:"/settings/theme",replace:!0})},{path:":environmentName",element:p.jsx(jEe,{})},{path:":environmentName/:packageName",element:p.jsx(PEe,{})},{path:":environmentName/:packageName/*",element:p.jsx(OEe,{})}]}])),IEe=NEe("/");jU.createRoot(document.getElementById("root")).render(p.jsx(C.StrictMode,{children:p.jsx(aH,{router:IEe})}));export{_Ee as $,ds as A,rs as B,zEe as C,Ay as D,R2e as E,b_ as F,Xy as G,x0e as H,Ee as I,$E as J,no as K,Br as L,sz as M,PE as N,er as O,Ga as P,Ld as Q,Hr as R,nk as S,wt as T,dz as U,ml as V,xi as W,tee as X,z2e as Y,yxe as Z,tu as _,xn as a,j_ as a$,Go as a0,xo as a1,Hn as a2,Cn as a3,vo as a4,L2e as a5,xq as a6,I1 as a7,A2e as a8,rEe as a9,Xne as aA,x_ as aB,lRe as aC,ZRe as aD,Dle as aE,p2e as aF,s0e as aG,d2e as aH,JRe as aI,Nle as aJ,t2e as aK,$le as aL,XRe as aM,e2e as aN,Xd as aO,dF as aP,wl as aQ,uF as aR,p1 as aS,dc as aT,l2e as aU,Lle as aV,iF as aW,FRe as aX,DRe as aY,n2e as aZ,y$ as a_,O2e as aa,lq as ab,O0 as ac,Wn as ad,LP as ae,ki as af,jE as ag,b4 as ah,Nk as ai,ea as aj,Tl as ak,a0 as al,PK as am,NK as an,ph as ao,Oo as ap,yae as aq,su as ar,dx as as,Pd as at,Mi as au,t1 as av,lae as aw,LEe as ax,P$ as ay,Sl as az,sl as b,f2e as b$,b2e as b0,N1 as b1,Od as b2,P_ as b3,wo as b4,v2e as b5,Yk as b6,V0 as b7,m2e as b8,Xa as b9,h2e as bA,y2e as bB,sxe as bC,a2e as bD,ixe as bE,$2e as bF,c2e as bG,gR as bH,Bbe as bI,Z0 as bJ,w_ as bK,z_ as bL,p0e as bM,Ube as bN,qbe as bO,BRe as bP,Vbe as bQ,A1 as bR,ple as bS,rxe as bT,CRe as bU,ORe as bV,Qoe as bW,RRe as bX,TRe as bY,MRe as bZ,jRe as b_,i2e as ba,nxe as bb,BN as bc,Zy as bd,rn as be,vi as bf,KRe as bg,vl as bh,zRe as bi,Xse as bj,nF as bk,ele as bl,aF as bm,GRe as bn,S_ as bo,Lbe as bp,e0e as bq,t0e as br,N0e as bs,QR as bt,C2e as bu,C_ as bv,Q0e as bw,$_ as bx,g2e as by,Zle as bz,Qa as c,x2e as c$,EA as c0,cF as c1,lR as c2,LRe as c3,IRe as c4,Qse as c5,Yse as c6,Jy as c7,zbe as c8,Fbe as c9,Wle as cA,_Re as cB,qRe as cC,HRe as cD,ERe as cE,Xx as cF,VRe as cG,URe as cH,YRe as cI,ARe as cJ,E_ as cK,j4 as cL,Xoe as cM,lF as cN,m1 as cO,r2e as cP,pK as cQ,vC as cR,PRe as cS,kRe as cT,ule as cU,Ile as cV,e2 as cW,Z0e as cX,X0e as cY,w2e as cZ,ZR as c_,NRe as ca,Eg as cb,R0e as cc,Bp as cd,tQ as ce,QRe as cf,vF as cg,WRe as ch,ale as ci,UN as cj,tle as ck,bz as cl,Wy as cm,Sle as cn,wle as co,xy as cp,zx as cq,sle as cr,B0e as cs,k2e as ct,S2e as cu,Lz as cv,o2e as cw,gF as cx,zle as cy,$Re as cz,Ft as d,G0e as d0,T_ as d1,W0e as d2,K0e as d3,oxe as d4,ry as d5,_r as d6,w0e as d7,S0e as d8,v_ as d9,T2e as da,N$e as db,FEe as dc,s2e as dd,E2e as de,I2e as df,N2e as dg,qL as dh,Fo as di,D2e as dj,qd as dk,M2e as dl,Xxe as dm,j2e as dn,P0 as dp,v0e as dq,b0e as dr,ZC as e,yn as f,gn as g,El as h,Ls as i,p as j,so as k,Gd as l,on as m,N5 as n,cc as o,_5 as p,P2e as q,C as r,ct as s,_p as t,wn as u,Fy as v,I5 as w,Ln as x,lt as y,Pa as z};