@malloy-publisher/app 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-doc.yaml +54 -22
- package/dist/assets/{EnvironmentPage-C4IrQrKG.js → EnvironmentPage-ufeWfqnK.js} +1 -1
- package/dist/assets/{HomePage-DDyGPzmK.js → HomePage-CN_FgmtD.js} +1 -1
- package/dist/assets/{LightMode-BpHRmI5M.js → LightMode-BFbC4W45.js} +1 -1
- package/dist/assets/{MainPage-BHleF-Kb.js → MainPage-BcCyzakx.js} +1 -1
- package/dist/assets/{ModelPage-Cgw-SbZi.js → ModelPage-wHHnxoih.js} +2 -2
- package/dist/assets/{PackagePage-Cy0c37D0.js → PackagePage-DwdO-2dp.js} +1 -1
- package/dist/assets/{RenderedResult-DSgqZUiN.es-CL0FEank.js → RenderedResult-CYyhQekT.es-DBHF8EwO.js} +2 -2
- package/dist/assets/{RouteError-DBMc9ccU.js → RouteError-Blt6a2Za.js} +1 -1
- package/dist/assets/{ThemeEditorPage-ByJlsmNu.js → ThemeEditorPage-Cb-2YbfG.js} +1 -1
- package/dist/assets/{ToggleButtonGroup-BHEVw4Ti.js → ToggleButtonGroup-BuhURn8v.js} +1 -1
- package/dist/assets/{index-c3i6ScGn.js → index-BELjGKhI.js} +1 -1
- package/dist/assets/{index-rWWmF7hn.js → index-BJyLY8XQ.js} +1 -1
- package/dist/assets/{index-Dyxfz1yO.js → index-DCizS2BO.js} +1 -1
- package/dist/assets/{index-C5BtJ1GX.js → index-Dz4y_2PE.js} +4 -4
- package/dist/assets/{index-BdwkgpbO.js → index-kt4oTEGz.js} +1 -1
- package/dist/assets/{index.es-VI5lesX5.js → index.es-u5PRRTzT.js} +4 -4
- package/dist/index.html +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-kt4oTEGz.js","assets/index-BJyLY8XQ.js","assets/index-w_0OQJgZ.js","assets/index-CRAwrhYM.js","assets/index-DCizS2BO.js","assets/index-BELjGKhI.js","assets/index-DSoCUF-f.js","assets/core-B8oMW4sm.es-hOkwvru5.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/MainPage-BcCyzakx.js","assets/LightMode-BFbC4W45.js","assets/ThemeEditorPage-Cb-2YbfG.js","assets/ToggleButtonGroup-BuhURn8v.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function s5(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 s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).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 Xpe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function TD(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jx={exports:{}},bh={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -431,12 +431,12 @@ export default theme;`}function m$(e){return typeof e=="number"?`${(e*100).toFix
|
|
|
431
431
|
`));c&&V.current&&V.current.getSectionContent($.startIndex).focus()},[]),{interactions:_,returnedValue:{autoFocus:c,readOnly:n,focused:f??I,sectionListRef:z,onBlur:G,onClick:X,onFocus:Z,onInput:Q,onPaste:te,enableAccessibleFieldDOMStructure:!0,elements:we,tabIndex:x===0?-1:0,contentEditable:ye,value:$e,onChange:Ce,areAllSectionsEmpty:P}}},Pf=e=>e.replace(/[\u2066\u2067\u2068\u2069]/g,""),$ie=(e,t,n)=>{let r=0,o=n?1:0;const a=[];for(let s=0;s<e.length;s+=1){const l=e[s],d=ck(l,n?"input-rtl":"input-ltr",t),f=`${l.startSeparator}${d}${l.endSeparator}`,c=Pf(f).length,m=f.length,y=Pf(d),b=o+(y===""?0:d.indexOf(y[0]))+l.startSeparator.length,v=b+y.length;a.push(De({},l,{start:r,end:r+c,startInInput:b,endInInput:v})),r+=c,o+=m}return a},Pie=e=>{const t=gs(),n=C.useRef(void 0),r=C.useRef(void 0),{forwardedProps:{onFocus:o,onClick:a,onPaste:s,onBlur:l,inputRef:d,placeholder:f},internalProps:{readOnly:c=!1,disabled:m=!1},parsedSelectedSections:y,activeSectionIndex:b,state:v,fieldValueManager:x,valueManager:w,applyCharacterEditing:S,resetCharacterQuery:T,updateSectionValue:M,updateValueFromValueStr:R,clearActiveSection:$,clearValue:P,setTempAndroidValueStr:N,setSelectedSections:V,getSectionsFromValue:z,areAllSectionsEmpty:W,localizedDigits:H}=e,k=C.useRef(null),I=mr(d,k),F=C.useMemo(()=>$ie(v.sections,H,t),[v.sections,H,t]),_=C.useMemo(()=>({syncSelectionToDOM:()=>{if(!k.current)return;if(y==null){k.current.scrollLeft&&(k.current.scrollLeft=0);return}if(k.current!==Ta(document))return;const ae=k.current.scrollTop;if(y==="all")k.current.select();else{const ce=F[y],ge=ce.type==="empty"?ce.startInInput-ce.startSeparator.length:ce.startInInput,ye=ce.type==="empty"?ce.endInInput+ce.endSeparator.length:ce.endInInput;(ge!==k.current.selectionStart||ye!==k.current.selectionEnd)&&k.current===Ta(document)&&k.current.setSelectionRange(ge,ye),clearTimeout(r.current),r.current=setTimeout(()=>{k.current&&k.current===Ta(document)&&k.current.selectionStart===k.current.selectionEnd&&(k.current.selectionStart!==ge||k.current.selectionEnd!==ye)&&_.syncSelectionToDOM()})}k.current.scrollTop=ae},getActiveSectionIndexFromDOM:()=>{const ae=k.current.selectionStart??0,ce=k.current.selectionEnd??0;if(ae===0&&ce===0)return null;const ge=ae<=F[0].startInInput?1:F.findIndex(ye=>ye.startInInput-ye.startSeparator.length>ae);return ge===-1?F.length-1:ge-1},focusField:(ae=0)=>{Ta(document)!==k.current&&(k.current?.focus(),V(ae))},setSelectedSections:ae=>V(ae),isFieldFocused:()=>k.current===Ta(document)}),[k,y,F,V]),j=()=>{const ae=k.current.selectionStart??0;let ce;ae<=F[0].startInInput||ae>=F[F.length-1].endInInput?ce=1:ce=F.findIndex(ye=>ye.startInInput-ye.startSeparator.length>ae);const ge=ce===-1?F.length-1:ce-1;V(ge)},X=It((...ae)=>{o?.(...ae);const ce=k.current;clearTimeout(n.current),n.current=setTimeout(()=>{!ce||ce!==k.current||b==null&&(ce.value.length&&Number(ce.selectionEnd)-Number(ce.selectionStart)===ce.value.length?V("all"):j())})}),Q=It((ae,...ce)=>{ae.isDefaultPrevented()||(a?.(ae,...ce),j())}),te=It(ae=>{if(s?.(ae),ae.preventDefault(),c||m)return;const ce=ae.clipboardData.getData("text");if(typeof y=="number"){const ge=v.sections[y],ye=/^[a-zA-Z]+$/.test(ce),we=/^[0-9]+$/.test(ce),Ce=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(ce);if(ge.contentType==="letter"&&ye||ge.contentType==="digit"&&we||ge.contentType==="digit-with-letter"&&Ce){T(),M({activeSection:ge,newSectionValue:ce,shouldGoToNextSection:!0});return}if(ye||we)return}T(),R(ce)}),Z=It((...ae)=>{l?.(...ae),V(null)}),G=It(ae=>{if(c)return;const ce=ae.target.value;if(ce===""){T(),P();return}const ge=ae.nativeEvent.data,ye=ge&&ge.length>1,we=ye?ge:ce,Ce=Pf(we);if(y==="all"&&V(b),b==null||ye){R(ye?ge:Ce);return}let $e;if(y==="all"&&Ce.length===1)$e=Ce;else{const de=Pf(x.getV6InputValueFromSections(F,H,t));let ke=-1,et=-1;for(let le=0;le<de.length;le+=1)ke===-1&&de[le]!==Ce[le]&&(ke=le),et===-1&&de[de.length-le-1]!==Ce[Ce.length-le-1]&&(et=le);const ze=F[b];if(ke<ze.start||de.length-et-1>ze.end)return;const Ae=Ce.length-de.length+ze.end-Pf(ze.endSeparator||"").length;$e=Ce.slice(ze.start+Pf(ze.startSeparator||"").length,Ae)}if($e.length===0){Nee()&&N(we),T(),$();return}S({keyPressed:$e,sectionIndex:b})}),ne=C.useMemo(()=>f!==void 0?f:x.getV6InputValueFromSections(z(w.emptyValue),H,t),[f,x,z,w.emptyValue,H,t]),se=C.useMemo(()=>v.tempValueStrAndroid??x.getV6InputValueFromSections(v.sections,H,t),[v.sections,x,v.tempValueStrAndroid,H,t]);C.useEffect(()=>(k.current&&k.current===Ta(document)&&V("all"),()=>{clearTimeout(n.current),clearTimeout(r.current)}),[]);const pe=C.useMemo(()=>b==null||v.sections[b].contentType==="letter"?"text":"numeric",[b,v.sections]),oe=!(k.current&&k.current===Ta(document))&&W;return{interactions:_,returnedValue:{readOnly:c,onBlur:Z,onClick:Q,onFocus:X,onPaste:te,inputRef:I,enableAccessibleFieldDOMStructure:!1,placeholder:ne,inputMode:pe,autoComplete:"off",value:oe?"":se,onChange:G}}},Die=e=>{const t=Hr(),{internalProps:n,internalProps:{unstableFieldRef:r,minutesStep:o,enableAccessibleFieldDOMStructure:a=!1,disabled:s=!1,readOnly:l=!1},forwardedProps:{onKeyDown:d,error:f,clearable:c,onClear:m},fieldValueManager:y,valueManager:b,validator:v}=e,x=gs(),w=Mie(e),{state:S,activeSectionIndex:T,parsedSelectedSections:M,setSelectedSections:R,clearValue:$,clearActiveSection:P,updateSectionValue:N,setTempAndroidValueStr:V,sectionsValueBoundaries:z,localizedDigits:W,timezone:H}=w,k=Oie({sections:S.sections,updateSectionValue:N,sectionsValueBoundaries:z,localizedDigits:W,setTempAndroidValueStr:V,timezone:H}),{resetCharacterQuery:I}=k,F=b.areValuesEqual(t,S.value,b.emptyValue),_=a?Rie:Pie,j=C.useMemo(()=>Iee(S.sections,x&&!a),[S.sections,x,a]),{returnedValue:X,interactions:Q}=_(De({},e,w,k,{areAllSectionsEmpty:F,sectionOrder:j})),te=It(oe=>{if(d?.(oe),!s)switch(!0){case((oe.ctrlKey||oe.metaKey)&&String.fromCharCode(oe.keyCode)==="A"&&!oe.shiftKey&&!oe.altKey):{oe.preventDefault(),R("all");break}case oe.key==="ArrowRight":{if(oe.preventDefault(),M==null)R(j.startIndex);else if(M==="all")R(j.endIndex);else{const ae=j.neighbors[M].rightIndex;ae!==null&&R(ae)}break}case oe.key==="ArrowLeft":{if(oe.preventDefault(),M==null)R(j.endIndex);else if(M==="all")R(j.startIndex);else{const ae=j.neighbors[M].leftIndex;ae!==null&&R(ae)}break}case oe.key==="Delete":{if(oe.preventDefault(),l)break;M==null||M==="all"?$():P(),I();break}case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(oe.key):{if(oe.preventDefault(),l||T==null)break;M==="all"&&R(T);const ae=S.sections[T],ce=y.getActiveDateManager(t,S,ae),ge=Oee(t,H,ae,oe.key,z,W,ce.date,{minutesStep:o});N({activeSection:ae,newSectionValue:ge,shouldGoToNextSection:!1});break}}});Po(()=>{Q.syncSelectionToDOM()});const{hasValidationError:Z}=SI({props:n,validator:v,timezone:H,value:S.value,onError:n.onError}),G=C.useMemo(()=>f!==void 0?f:Z,[Z,f]);C.useEffect(()=>{!G&&T==null&&I()},[S.referenceValue,T,G]),C.useEffect(()=>{S.tempValueStrAndroid!=null&&T!=null&&(I(),P())},[S.sections]),C.useImperativeHandle(r,()=>({getSections:()=>S.sections,getActiveSectionIndex:Q.getActiveSectionIndexFromDOM,setSelectedSections:Q.setSelectedSections,focusField:Q.focusField,isFieldFocused:Q.isFieldFocused}));const ne=It((oe,...ae)=>{oe.preventDefault(),m?.(oe,...ae),$(),Q.isFieldFocused()?R(j.startIndex):Q.focusField(0)}),se={onKeyDown:te,onClear:ne,error:G,clearable:!!(c&&!F&&!l&&!s)},pe={disabled:s,readOnly:l};return De({},e.forwardedProps,se,pe,X)},Aie=["clearable","onClear","InputProps","sx","slots","slotProps"],jie=["ownerState"],Nie=e=>{const t=_l(),{clearable:n,onClear:r,InputProps:o,sx:a,slots:s,slotProps:l}=e,d=Fn(e,Aie),f=s?.clearButton??Gc,c=xr({elementType:f,externalSlotProps:l?.clearButton,ownerState:{},className:"clearButton",additionalProps:{title:t.fieldClearLabel}}),m=Fn(c,jie),y=s?.clearIcon??Hoe,b=xr({elementType:y,externalSlotProps:l?.clearIcon,ownerState:{}});return De({},d,{InputProps:De({},o,{endAdornment:h.jsxs(C.Fragment,{children:[n&&h.jsx(wI,{position:"end",sx:{marginRight:o?.endAdornment?-1:-1.5},children:h.jsx(f,De({},m,{onClick:r,children:h.jsx(y,De({fontSize:"small"},b))}))}),o?.endAdornment]})}),sx:[{"& .clearButton":{opacity:1},"@media (pointer: fine)":{"& .clearButton":{opacity:0},"&:hover, &:focus-within":{".clearButton":{opacity:1}}}},...Array.isArray(a)?a:[a]]})},Iie=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator"],Lie=(e,t)=>C.useMemo(()=>{const n=De({},e),r={},o=a=>{n.hasOwnProperty(a)&&(r[a]=n[a],delete n[a])};return Iie.forEach(o),bI.forEach(o),{forwardedProps:n,internalProps:r}},[e,t]),zie=e=>{const t=Hr(),n=wg();return De({},e,{disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,format:e.format??t.formats.keyboardDate,minDate:_i(t,e.minDate,n.minDate),maxDate:_i(t,e.maxDate,n.maxDate)})},Fie=e=>{const t=zie(e),{forwardedProps:n,internalProps:r}=Lie(t,"date");return Die({forwardedProps:n,internalProps:r,valueManager:Js,fieldValueManager:Bee,validator:Cg,valueType:"date"})};function Bie(e){return on("MuiPickersTextField",e)}Gt("MuiPickersTextField",["root","focused","disabled","error","required"]);function Uie(e){return on("MuiPickersInputBase",e)}const Ff=Gt("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input"]);function _ie(e){return on("MuiPickersSectionList",e)}const Wh=Gt("MuiPickersSectionList",["root","section","sectionContent"]),Vie=["slots","slotProps","elements","sectionListRef"],aL=Ge("div",{name:"MuiPickersSectionList",slot:"Root",overridesResolver:(e,t)=>t.root})({direction:"ltr /*! @noflip */",outline:"none"}),iL=Ge("span",{name:"MuiPickersSectionList",slot:"Section",overridesResolver:(e,t)=>t.section})({}),sL=Ge("span",{name:"MuiPickersSectionList",slot:"SectionSeparator",overridesResolver:(e,t)=>t.sectionSeparator})({whiteSpace:"pre"}),lL=Ge("span",{name:"MuiPickersSectionList",slot:"SectionContent",overridesResolver:(e,t)=>t.sectionContent})({outline:"none"}),Hie=e=>{const{classes:t}=e;return tn({root:["root"],section:["section"],sectionContent:["sectionContent"]},_ie,t)};function Wie(e){const{slots:t,slotProps:n,element:r,classes:o}=e,a=t?.section??iL,s=xr({elementType:a,externalSlotProps:n?.section,externalForwardedProps:r.container,className:o.section,ownerState:{}}),l=t?.sectionContent??lL,d=xr({elementType:l,externalSlotProps:n?.sectionContent,externalForwardedProps:r.content,additionalProps:{suppressContentEditableWarning:!0},className:o.sectionContent,ownerState:{}}),f=t?.sectionSeparator??sL,c=xr({elementType:f,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.before,ownerState:{position:"before"}}),m=xr({elementType:f,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.after,ownerState:{position:"after"}});return h.jsxs(a,De({},s,{children:[h.jsx(f,De({},c)),h.jsx(l,De({},d)),h.jsx(f,De({},m))]}))}const qie=C.forwardRef(function(e,t){const n=Vr({props:e,name:"MuiPickersSectionList"}),{slots:r,slotProps:o,elements:a,sectionListRef:s}=n,l=Fn(n,Vie),d=Hie(n),f=C.useRef(null),c=mr(t,f),m=v=>{if(!f.current)throw new Error(`MUI X: Cannot call sectionListRef.${v} before the mount of the component.`);return f.current};C.useImperativeHandle(s,()=>({getRoot(){return m("getRoot")},getSectionContainer(v){return m("getSectionContainer").querySelector(`.${Wh.section}[data-sectionindex="${v}"]`)},getSectionContent(v){return m("getSectionContent").querySelector(`.${Wh.section}[data-sectionindex="${v}"] .${Wh.sectionContent}`)},getSectionIndexFromDOMElement(v){const x=m("getSectionIndexFromDOMElement");if(v==null||!x.contains(v))return null;let w=null;return v.classList.contains(Wh.section)?w=v:v.classList.contains(Wh.sectionContent)&&(w=v.parentElement),w==null?null:Number(w.dataset.sectionindex)}}));const y=r?.root??aL,b=xr({elementType:y,externalSlotProps:o?.root,externalForwardedProps:l,additionalProps:{ref:c,suppressContentEditableWarning:!0},className:d.root,ownerState:{}});return h.jsx(y,De({},b,{children:b.contentEditable?a.map(({content:v,before:x,after:w})=>`${x.children}${v.children}${w.children}`).join(""):h.jsx(C.Fragment,{children:a.map((v,x)=>h.jsx(Wie,{slots:r,slotProps:o,element:v,classes:d},x))})}))}),Yie=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef"],Kie=e=>Math.round(e*1e5)/1e5,w0=Ge("div",{name:"MuiPickersInputBase",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>De({},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:`${Kie(.15/16)}em`,variants:[{props:{fullWidth:!0},style:{width:"100%"}}]})),$k=Ge(aL,{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}}]})),Gie=Ge(iL,{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"})),Qie=Ge(lL,{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"})),Xie=Ge(sL,{name:"MuiPickersInputBase",slot:"Separator",overridesResolver:(e,t)=>t.separator})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),Zie=Ge("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(e,t)=>t.hiddenInput})(De({},hee)),Jie=e=>{const{focused:t,disabled:n,error:r,classes:o,fullWidth:a,readOnly:s,color:l,size:d,endAdornment:f,startAdornment:c}=e,m={root:["root",t&&!n&&"focused",n&&"disabled",s&&"readOnly",r&&"error",a&&"fullWidth",`color${Tt(l)}`,d==="small"&&"inputSizeSmall",!!c&&"adornedStart",!!f&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"]};return tn(m,Uie,o)},Pk=C.forwardRef(function(e,t){const n=Vr({props:e,name:"MuiPickersInputBase"}),{elements:r,areAllSectionsEmpty:o,value:a,onChange:s,id:l,endAdornment:d,startAdornment:f,renderSuffix:c,slots:m,slotProps:y,contentEditable:b,tabIndex:v,onInput:x,onPaste:w,onKeyDown:S,name:T,readOnly:M,inputProps:R,inputRef:$,sectionListRef:P}=n,N=Fn(n,Yie),V=C.useRef(null),z=mr(t,V),W=mr(R?.ref,$),H=gs(),k=fi();if(!k)throw new Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");const I=te=>{if(k.disabled){te.stopPropagation();return}k.onFocus?.(te)};C.useEffect(()=>{k&&k.setAdornedStart(!!f)},[k,f]),C.useEffect(()=>{k&&(o?k.onEmpty():k.onFilled())},[k,o]);const F=De({},n,k,{isRtl:H}),_=Jie(F),j=m?.root||w0,X=xr({elementType:j,externalSlotProps:y?.root,externalForwardedProps:N,additionalProps:{"aria-invalid":k.error,ref:z},className:_.root,ownerState:F}),Q=m?.input||$k;return h.jsxs(j,De({},X,{children:[f,h.jsx(qie,{sectionListRef:P,elements:r,contentEditable:b,tabIndex:v,className:_.sectionsContainer,onFocus:I,onBlur:k.onBlur,onInput:x,onPaste:w,onKeyDown:S,slots:{root:Q,section:Gie,sectionContent:Qie,sectionSeparator:Xie},slotProps:{root:{ownerState:F},sectionContent:{className:Ff.sectionContent},sectionSeparator:({position:te})=>({className:te==="before"?Ff.sectionBefore:Ff.sectionAfter})}}),d,c?c(De({},k)):null,h.jsx(Zie,De({name:T,className:_.input,value:a,onChange:s,id:l,"aria-hidden":"true",tabIndex:-1,readOnly:M,required:k.required,disabled:k.disabled},R,{ref:W}))]}))});function ese(e){return on("MuiPickersOutlinedInput",e)}const ls=De({},Ff,Gt("MuiPickersOutlinedInput",["root","notchedOutline","input"])),tse=["children","className","label","notched","shrink"],nse=Ge("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}}),TP=Ge("span")(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit"})),rse=Ge("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 ose(e){const{className:t,label:n}=e,r=Fn(e,tse),o=n!=null&&n!=="",a=De({},e,{withLabel:o});return h.jsx(nse,De({"aria-hidden":!0,className:t},r,{ownerState:a,children:h.jsx(rse,{ownerState:a,children:o?h.jsx(TP,{children:n}):h.jsx(TP,{className:"notranslate",children:""})})}))}const ase=["label","autoFocus","ownerState","notched"],ise=Ge(w0,{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 .${ls.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${ls.notchedOutline}`]:{borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}},[`&.${ls.focused} .${ls.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${ls.disabled}`]:{[`& .${ls.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled},"*":{color:(e.vars||e).palette.action.disabled}},[`&.${ls.error} .${ls.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:{[`&.${ls.focused}:not(.${ls.error}) .${ls.notchedOutline}`]:{borderColor:(e.vars||e).palette[n].main}}}))}}),sse=Ge($k,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({padding:"16.5px 0",variants:[{props:{size:"small"},style:{padding:"8.5px 0"}}]}),lse=e=>{const{classes:t}=e,n=tn({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},ese,t);return De({},t,n)},cL=C.forwardRef(function(e,t){const n=Vr({props:e,name:"MuiPickersOutlinedInput"}),{label:r,ownerState:o,notched:a}=n,s=Fn(n,ase),l=fi(),d=De({},n,o,l,{color:l?.color||"primary"}),f=lse(d);return h.jsx(Pk,De({slots:{root:ise,input:sse},renderSuffix:c=>h.jsx(ose,{shrink:!!(a||c.adornedStart||c.focused||c.filled),notched:!!(a||c.adornedStart||c.focused||c.filled),className:f.notchedOutline,label:r!=null&&r!==""&&l?.required?h.jsxs(C.Fragment,{children:[r," ","*"]}):r,ownerState:d})},s,{label:r,classes:f,ref:t}))});cL.muiName="Input";function cse(e){return on("MuiPickersFilledInput",e)}const Ru=De({},Ff,Gt("MuiPickersFilledInput",["root","underline","input"])),use=["label","autoFocus","disableUnderline","ownerState"],dse=Ge(w0,{name:"MuiPickersFilledInput",slot:"Root",overridesResolver:(e,t)=>t.root,shouldForwardProp:e=>fv(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}},[`&.${Ru.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${Ru.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:a},variants:[...Object.keys((e.vars??e).palette).filter(s=>(e.vars??e).palette[s].main).map(s=>({props:{color:s,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[s]?.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"},[`&.${Ru.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Ru.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(.${Ru.disabled}, .${Ru.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${Ru.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:({startAdornment:s})=>!!s,style:{paddingLeft:12}},{props:({endAdornment:s})=>!!s,style:{paddingRight:12}}]}}),fse=Ge($k,{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}}]}),pse=e=>{const{classes:t,disableUnderline:n}=e,r=tn({root:["root",!n&&"underline"],input:["input"]},cse,t);return De({},t,r)},uL=C.forwardRef(function(e,t){const n=Vr({props:e,name:"MuiPickersFilledInput"}),{label:r,disableUnderline:o=!1,ownerState:a}=n,s=Fn(n,use),l=fi(),d=De({},n,a,l,{color:l?.color||"primary"}),f=pse(d);return h.jsx(Pk,De({slots:{root:dse,input:fse},slotProps:{root:{disableUnderline:o}}},s,{label:r,classes:f,ref:t}))});uL.muiName="Input";function hse(e){return on("MuiPickersFilledInput",e)}const qh=De({},Ff,Gt("MuiPickersInput",["root","input"])),mse=["label","autoFocus","disableUnderline","ownerState"],gse=Ge(w0,{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"},[`&.${qh.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${qh.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(.${qh.disabled}, .${qh.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${qh.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),yse=e=>{const{classes:t,disableUnderline:n}=e,r=tn({root:["root",!n&&"underline"],input:["input"]},hse,t);return De({},t,r)},dL=C.forwardRef(function(e,t){const n=Vr({props:e,name:"MuiPickersInput"}),{label:r,disableUnderline:o=!1,ownerState:a}=n,s=Fn(n,mse),l=fi(),d=De({},n,a,l,{disableUnderline:o,color:l?.color||"primary"}),f=yse(d);return h.jsx(Pk,De({slots:{root:gse}},s,{label:r,classes:f,ref:t}))});dL.muiName="Input";const vse=["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"],bse={standard:dL,filled:uL,outlined:cL},xse=Ge(KI,{name:"MuiPickersTextField",slot:"Root",overridesResolver:(e,t)=>t.root})({maxWidth:"100%"}),Sse=e=>{const{focused:t,disabled:n,classes:r,required:o}=e;return tn({root:["root",t&&!n&&"focused",n&&"disabled",o&&"required"]},Bie,r)},wse=C.forwardRef(function(e,t){const n=Vr({props:e,name:"MuiPickersTextField"}),{onFocus:r,onBlur:o,className:a,color:s="primary",disabled:l=!1,error:d=!1,variant:f="outlined",required:c=!1,InputProps:m,inputProps:y,inputRef:b,sectionListRef:v,elements:x,areAllSectionsEmpty:w,onClick:S,onKeyDown:T,onKeyUp:M,onPaste:R,onInput:$,endAdornment:P,startAdornment:N,tabIndex:V,contentEditable:z,focused:W,value:H,onChange:k,fullWidth:I,id:F,name:_,helperText:j,FormHelperTextProps:X,label:Q,InputLabelProps:te}=n,Z=Fn(n,vse),G=C.useRef(null),ne=mr(t,G),se=ys(F),pe=j&&se?`${se}-helper-text`:void 0,oe=Q&&se?`${se}-label`:void 0,ae=De({},n,{color:s,disabled:l,error:d,focused:W,required:c,variant:f}),ce=Sse(ae),ge=bse[f];return h.jsxs(xse,De({className:jt(ce.root,a),ref:ne,focused:W,onFocus:r,onBlur:o,disabled:l,variant:f,error:d,color:s,fullWidth:I,required:c,ownerState:ae},Z,{children:[h.jsx(YI,De({htmlFor:se,id:oe},te,{children:Q})),h.jsx(ge,De({elements:x,areAllSectionsEmpty:w,onClick:S,onKeyDown:T,onKeyUp:M,onInput:$,onPaste:R,endAdornment:P,startAdornment:N,tabIndex:V,contentEditable:z,value:H,onChange:k,id:se,fullWidth:I,inputProps:y,inputRef:b,sectionListRef:v,label:Q,name:_,role:"group","aria-labelledby":oe,"aria-describedby":pe,"aria-live":pe?"polite":void 0},m)),j&&h.jsx(GI,De({id:pe},X,{children:j}))]}))}),Cse=["enableAccessibleFieldDOMStructure"],kse=["InputProps","readOnly"],Tse=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef"],Mse=e=>{let{enableAccessibleFieldDOMStructure:t}=e,n=Fn(e,Cse);if(t){const{InputProps:m,readOnly:y}=n,b=Fn(n,kse);return De({},b,{InputProps:De({},m??{},{readOnly:y})})}const{onPaste:r,onKeyDown:o,inputMode:a,readOnly:s,InputProps:l,inputProps:d,inputRef:f}=n,c=Fn(n,Tse);return De({},c,{InputProps:De({},l??{},{readOnly:s}),inputProps:De({},d??{},{inputMode:a,onPaste:r,onKeyDown:o,ref:f})})},Ese=["slots","slotProps","InputProps","inputProps"],fL=C.forwardRef(function(e,t){const n=Vr({props:e,name:"MuiDateField"}),{slots:r,slotProps:o,InputProps:a,inputProps:s}=n,l=Fn(n,Ese),d=n,f=r?.textField??(e.enableAccessibleFieldDOMStructure?wse:hr),c=xr({elementType:f,externalSlotProps:o?.textField,externalForwardedProps:l,additionalProps:{ref:t},ownerState:d});c.inputProps=De({},s,c.inputProps),c.InputProps=De({},a,c.InputProps);const m=Fie(c),y=Mse(m),b=Nie(De({},y,{slots:r,slotProps:o}));return h.jsx(f,De({},b))}),pL=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:a,disablePast:s,timezone:l})=>{const d=pd();return C.useCallback(f=>Cg({adapter:d,value:f,timezone:l,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:a,disablePast:s}})!==null,[d,e,t,n,r,o,a,s,l])},Ose=(e,t,n)=>(r,o)=>{switch(o.type){case"changeMonth":return De({},r,{slideDirection:o.direction,currentMonth:o.newMonth,isMonthSwitchingAnimating:!e});case"changeMonthTimezone":{const a=o.newTimezone;if(n.getTimezone(r.currentMonth)===a)return r;let s=n.setTimezone(r.currentMonth,a);return n.getMonth(s)!==n.getMonth(r.currentMonth)&&(s=n.setMonth(s,n.getMonth(r.currentMonth))),De({},r,{currentMonth:s})}case"finishMonthSwitchingAnimation":return De({},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 De({},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")}},Rse=e=>{const{value:t,referenceDate:n,disableFuture:r,disablePast:o,disableSwitchToMonthOnDayFocus:a=!1,maxDate:s,minDate:l,onMonthChange:d,reduceAnimations:f,shouldDisableDate:c,timezone:m}=e,y=Hr(),b=C.useRef(Ose(!!f,a,y)).current,v=C.useMemo(()=>Js.getInitialReferenceValue({value:t,utils:y,timezone:m,props:e,referenceDate:n,granularity:_s.day}),[n,m]),[x,w]=C.useReducer(b,{isMonthSwitchingAnimating:!1,focusedDay:v,currentMonth:y.startOfMonth(v),slideDirection:"left"});C.useEffect(()=>{w({type:"changeMonthTimezone",newTimezone:y.getTimezone(v)})},[v,y]);const S=C.useCallback(P=>{w(De({type:"changeMonth"},P)),d&&d(P.newMonth)},[d]),T=C.useCallback(P=>{const N=P;y.isSameMonth(N,x.currentMonth)||S({newMonth:y.startOfMonth(N),direction:y.isAfterDay(N,x.currentMonth)?"left":"right"})},[x.currentMonth,S,y]),M=pL({shouldDisableDate:c,minDate:l,maxDate:s,disableFuture:r,disablePast:o,timezone:m}),R=C.useCallback(()=>{w({type:"finishMonthSwitchingAnimation"})},[]),$=It((P,N)=>{M(P)||w({type:"changeFocusedDay",focusedDay:P,withoutMonthSwitchingAnimation:N})});return{referenceDate:v,calendarState:x,changeMonth:T,changeFocusedDay:$,isDateDisabled:M,onMonthSwitchingAnimationEnd:R,handleChangeMonth:S}},$se=e=>on("MuiPickersFadeTransitionGroup",e);Gt("MuiPickersFadeTransitionGroup",["root"]);const Pse=e=>{const{classes:t}=e;return tn({root:["root"]},$se,t)},Dse=Ge(kg,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function hL(e){const t=Vr({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:o,transKey:a}=t,s=Pse(t),l=fd();return o?n:h.jsx(Dse,{className:jt(s.root,r),children:h.jsx(ad,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:l.transitions.duration.enteringScreen,enter:l.transitions.duration.enteringScreen,exit:0},children:n},a)})}function Ase(e){return on("MuiPickersDay",e)}const $u=Gt("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),jse=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],Nse=e=>{const{selected:t,disableMargin:n,disableHighlightToday:r,today:o,disabled:a,outsideCurrentMonth:s,showDaysOutsideCurrentMonth:l,classes:d}=e,f=s&&!l;return tn({root:["root",t&&!f&&"selected",a&&"disabled",!n&&"dayWithMargin",!r&&o&&"today",s&&l&&"dayOutsideMonth",f&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},Ase,d)},mL=({theme:e})=>De({},e.typography.caption,{width:Qm,height:Qm,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})`:fs(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:fs(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${$u.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${$u.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}},[`&.${$u.disabled}:not(.${$u.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${$u.disabled}&.${$u.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:`0 ${g0}px`}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${$u.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),gL=(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]},Ise=Ge(od,{name:"MuiPickersDay",slot:"Root",overridesResolver:gL})(mL),Lse=Ge("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:gL})(({theme:e})=>De({},mL({theme:e}),{opacity:0,pointerEvents:"none"})),Yh=()=>{},zse=C.forwardRef(function(e,t){const n=Vr({props:e,name:"MuiPickersDay"}),{autoFocus:r=!1,className:o,day:a,disabled:s=!1,disableHighlightToday:l=!1,disableMargin:d=!1,isAnimating:f,onClick:c,onDaySelect:m,onFocus:y=Yh,onBlur:b=Yh,onKeyDown:v=Yh,onMouseDown:x=Yh,onMouseEnter:w=Yh,outsideCurrentMonth:S,selected:T=!1,showDaysOutsideCurrentMonth:M=!1,children:R,today:$=!1}=n,P=Fn(n,jse),N=De({},n,{autoFocus:r,disabled:s,disableHighlightToday:l,disableMargin:d,selected:T,showDaysOutsideCurrentMonth:M,today:$}),V=Nse(N),z=Hr(),W=C.useRef(null),H=mr(W,t);Po(()=>{r&&!s&&!f&&!S&&W.current.focus()},[r,s,f,S]);const k=F=>{x(F),S&&F.preventDefault()},I=F=>{s||m(a),S&&F.currentTarget.focus(),c&&c(F)};return S&&!M?h.jsx(Lse,{className:jt(V.root,V.hiddenDaySpacingFiller,o),ownerState:N,role:P.role}):h.jsx(Ise,De({className:jt(V.root,o),ref:H,centerRipple:!0,disabled:s,tabIndex:T?0:-1,onKeyDown:F=>v(F,a),onFocus:F=>y(F,a),onBlur:F=>b(F,a),onMouseEnter:F=>w(F,a),onClick:I,onMouseDown:k},P,{ownerState:N,children:R||z.format(a,"dayOfMonth")}))}),Fse=C.memo(zse),Bse=e=>on("MuiPickersSlideTransition",e),ki=Gt("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),Use=["children","className","reduceAnimations","slideDirection","transKey","classes"],_se=e=>{const{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return tn(r,Bse,t)},Vse=Ge(kg,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${ki["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${ki["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${ki.slideEnterActive}`]:t.slideEnterActive},{[`.${ki.slideExit}`]:t.slideExit},{[`.${ki["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${ki["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},[`& .${ki["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${ki["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${ki.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${ki.slideExit}`]:{transform:"translate(0%)"},[`& .${ki["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${ki["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}});function Hse(e){const t=Vr({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:o,transKey:a}=t,s=Fn(t,Use),l=_se(t),d=fd();if(o)return h.jsx("div",{className:jt(l.root,r),children:n});const f={exit:l.exit,enterActive:l.enterActive,enter:l.enter,exitActive:l.exitActive};return h.jsx(Vse,{className:jt(l.root,r),childFactory:c=>C.cloneElement(c,{classNames:f}),role:"presentation",children:h.jsx(dk,De({mountOnEnter:!0,unmountOnExit:!0,timeout:d.transitions.duration.complex,classNames:f},s,{children:n}),a)})}const Wse=e=>on("MuiDayCalendar",e);Gt("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const qse=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],Yse=["ownerState"],Kse=e=>{const{classes:t}=e;return tn({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},Wse,t)},yL=(Qm+g0*2)*6,Gse=Ge("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),Qse=Ge("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),Xse=Ge(br,{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})),Zse=Ge(br,{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})),Jse=Ge(br,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>De({},e.typography.caption,{width:Qm,height:Qm,padding:0,margin:`0 ${g0}px`,color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),ele=Ge("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:yL}),tle=Ge(Hse,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:yL}),nle=Ge("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),rle=Ge("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:`${g0}px 0`,display:"flex",justifyContent:"center"});function ole(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:o,isDateDisabled:a,currentMonthNumber:s,isViewFocused:l}=e,d=Fn(e,qse);const{disabled:f,disableHighlightToday:c,isMonthSwitchingAnimating:m,showDaysOutsideCurrentMonth:y,slots:b,slotProps:v,timezone:x}=t,w=Hr(),S=p0(x),T=r!==null&&w.isSameDay(n,r),M=o.some(k=>w.isSameDay(k,n)),R=w.isSameDay(n,S),$=b?.day??Fse,P=xr({elementType:$,externalSlotProps:v?.day,additionalProps:De({disableHighlightToday:c,showDaysOutsideCurrentMonth:y,role:"gridcell",isAnimating:m,"data-timestamp":w.toJsDate(n).valueOf()},d),ownerState:De({},t,{day:n,selected:M})}),N=Fn(P,Yse),V=C.useMemo(()=>f||a(n),[f,a,n]),z=C.useMemo(()=>w.getMonth(n)!==s,[w,n,s]),W=C.useMemo(()=>{const k=w.startOfMonth(w.setMonth(n,s));return y?w.isSameDay(n,w.startOfWeek(k)):w.isSameDay(n,k)},[s,n,y,w]),H=C.useMemo(()=>{const k=w.endOfMonth(w.setMonth(n,s));return y?w.isSameDay(n,w.endOfWeek(k)):w.isSameDay(n,k)},[s,n,y,w]);return h.jsx($,De({},N,{day:n,disabled:V,autoFocus:l&&T,today:R,outsideCurrentMonth:z,isFirstVisibleCell:W,isLastVisibleCell:H,selected:M,tabIndex:T?0:-1,"aria-selected":M,"aria-current":R?"date":void 0}))}function ale(e){const t=Vr({props:e,name:"MuiDayCalendar"}),n=Hr(),{onFocusedDayChange:r,className:o,currentMonth:a,selectedDays:s,focusedDay:l,loading:d,onSelectedDaysChange:f,onMonthSwitchingAnimationEnd:c,readOnly:m,reduceAnimations:y,renderLoading:b=()=>h.jsx("span",{children:"..."}),slideDirection:v,TransitionProps:x,disablePast:w,disableFuture:S,minDate:T,maxDate:M,shouldDisableDate:R,shouldDisableMonth:$,shouldDisableYear:P,dayOfWeekFormatter:N=ze=>n.format(ze,"weekdayShort").charAt(0).toUpperCase(),hasFocus:V,onFocusedViewChange:z,gridLabelId:W,displayWeekNumber:H,fixedWeekNumber:k,autoFocus:I,timezone:F}=t,_=p0(F),j=Kse(t),X=gs(),Q=pL({shouldDisableDate:R,shouldDisableMonth:$,shouldDisableYear:P,minDate:T,maxDate:M,disablePast:w,disableFuture:S,timezone:F}),te=_l(),[Z,G]=li({name:"DayCalendar",state:"hasFocus",controlled:V,default:I??!1}),[ne,se]=C.useState(()=>l||_),pe=It(ze=>{m||f(ze)}),oe=ze=>{Q(ze)||(r(ze),se(ze),z?.(!0),G(!0))},ae=It((ze,Ae)=>{switch(ze.key){case"ArrowUp":oe(n.addDays(Ae,-7)),ze.preventDefault();break;case"ArrowDown":oe(n.addDays(Ae,7)),ze.preventDefault();break;case"ArrowLeft":{const le=n.addDays(Ae,X?1:-1),bt=n.addMonths(Ae,X?1:-1),Fe=Tm({utils:n,date:le,minDate:X?le:n.startOfMonth(bt),maxDate:X?n.endOfMonth(bt):le,isDateDisabled:Q,timezone:F});oe(Fe||le),ze.preventDefault();break}case"ArrowRight":{const le=n.addDays(Ae,X?-1:1),bt=n.addMonths(Ae,X?-1:1),Fe=Tm({utils:n,date:le,minDate:X?n.startOfMonth(bt):le,maxDate:X?le:n.endOfMonth(bt),isDateDisabled:Q,timezone:F});oe(Fe||le),ze.preventDefault();break}case"Home":oe(n.startOfWeek(Ae)),ze.preventDefault();break;case"End":oe(n.endOfWeek(Ae)),ze.preventDefault();break;case"PageUp":oe(n.addMonths(Ae,1)),ze.preventDefault();break;case"PageDown":oe(n.addMonths(Ae,-1)),ze.preventDefault();break}}),ce=It((ze,Ae)=>oe(Ae)),ge=It((ze,Ae)=>{Z&&n.isSameDay(ne,Ae)&&z?.(!1)}),ye=n.getMonth(a),we=n.getYear(a),Ce=C.useMemo(()=>s.filter(ze=>!!ze).map(ze=>n.startOfDay(ze)),[n,s]),$e=`${we}-${ye}`,de=C.useMemo(()=>C.createRef(),[$e]),ke=C.useMemo(()=>{const ze=n.startOfMonth(a),Ae=n.endOfMonth(a);return Q(ne)||n.isAfterDay(ne,Ae)||n.isBeforeDay(ne,ze)?Tm({utils:n,date:ne,minDate:ze,maxDate:Ae,disablePast:w,disableFuture:S,isDateDisabled:Q,timezone:F}):ne},[a,S,w,ne,Q,n,F]),et=C.useMemo(()=>{const ze=n.getWeekArray(a);let Ae=n.addMonths(a,1);for(;k&&ze.length<k;){const le=n.getWeekArray(Ae),bt=n.isSameDay(ze[ze.length-1][0],le[0][0]);le.slice(bt?1:0).forEach(Fe=>{ze.length<k&&ze.push(Fe)}),Ae=n.addMonths(Ae,1)}return ze},[a,k,n]);return h.jsxs(Gse,{role:"grid","aria-labelledby":W,className:j.root,children:[h.jsxs(Qse,{role:"row",className:j.header,children:[H&&h.jsx(Zse,{variant:"caption",role:"columnheader","aria-label":te.calendarWeekNumberHeaderLabel,className:j.weekNumberLabel,children:te.calendarWeekNumberHeaderText}),bee(n,_).map((ze,Ae)=>h.jsx(Xse,{variant:"caption",role:"columnheader","aria-label":n.format(ze,"weekday"),className:j.weekDayLabel,children:N(ze)},Ae.toString()))]}),d?h.jsx(ele,{className:j.loadingContainer,children:b()}):h.jsx(tle,De({transKey:$e,onExited:c,reduceAnimations:y,slideDirection:v,className:jt(o,j.slideTransition)},x,{nodeRef:de,children:h.jsx(nle,{ref:de,role:"rowgroup",className:j.monthContainer,children:et.map((ze,Ae)=>h.jsxs(rle,{role:"row",className:j.weekContainer,"aria-rowindex":Ae+1,children:[H&&h.jsx(Jse,{className:j.weekNumber,role:"rowheader","aria-label":te.calendarWeekNumberAriaLabelText(n.getWeekNumber(ze[0])),children:te.calendarWeekNumberText(n.getWeekNumber(ze[0]))}),ze.map((le,bt)=>h.jsx(ole,{parentProps:t,day:le,selectedDays:Ce,focusableDay:ke,onKeyDown:ae,onFocus:ce,onBlur:ge,onDaySelect:pe,isDateDisabled:Q,currentMonthNumber:ye,isViewFocused:Z,"aria-colindex":bt+1},le.toString()))]},`week-${ze[0]}`))})}))]})}function ile(e){return on("MuiPickersMonth",e)}const Jy=Gt("MuiPickersMonth",["root","monthButton","disabled","selected"]),sle=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],lle=e=>{const{disabled:t,selected:n,classes:r}=e;return tn({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},ile,r)},cle=Ge("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%"}}]}),ule=Ge("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${Jy.disabled}`]:t.disabled},{[`&.${Jy.selected}`]:t.selected}]})(({theme:e})=>De({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})`:fs(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:fs(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Jy.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${Jy.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),dle=C.memo(function(e){const t=Vr({props:e,name:"MuiPickersMonth"}),{autoFocus:n,className:r,children:o,disabled:a,selected:s,value:l,tabIndex:d,onClick:f,onKeyDown:c,onFocus:m,onBlur:y,"aria-current":b,"aria-label":v,slots:x,slotProps:w}=t,S=Fn(t,sle),T=C.useRef(null),M=lle(t);Po(()=>{n&&T.current?.focus()},[n]);const R=x?.monthButton??ule,$=xr({elementType:R,externalSlotProps:w?.monthButton,additionalProps:{children:o,disabled:a,tabIndex:d,ref:T,type:"button",role:"radio","aria-current":b,"aria-checked":s,"aria-label":v,onClick:P=>f(P,l),onKeyDown:P=>c(P,l),onFocus:P=>m(P,l),onBlur:P=>y(P,l)},ownerState:t,className:M.monthButton});return h.jsx(cle,De({className:jt(M.root,r),ownerState:t},S,{children:h.jsx(R,De({},$))}))});function fle(e){return on("MuiMonthCalendar",e)}Gt("MuiMonthCalendar",["root"]);const ple=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],hle=e=>{const{classes:t}=e;return tn({root:["root"]},fle,t)};function mle(e,t){const n=Hr(),r=wg(),o=Vr({props:e,name:t});return De({disableFuture:!1,disablePast:!1},o,{minDate:_i(n,o.minDate,r.minDate),maxDate:_i(n,o.maxDate,r.maxDate)})}const gle=Ge("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:y0,boxSizing:"border-box"}),yle=C.forwardRef(function(e,t){const n=mle(e,"MuiMonthCalendar"),{className:r,value:o,defaultValue:a,referenceDate:s,disabled:l,disableFuture:d,disablePast:f,maxDate:c,minDate:m,onChange:y,shouldDisableMonth:b,readOnly:v,autoFocus:x=!1,onMonthFocus:w,hasFocus:S,onFocusedViewChange:T,monthsPerRow:M=3,timezone:R,gridLabelId:$,slots:P,slotProps:N}=n,V=Fn(n,ple),{value:z,handleValueChange:W,timezone:H}=wk({name:"MonthCalendar",timezone:R,value:o,defaultValue:a,referenceDate:s,onChange:y,valueManager:Js}),k=p0(H),I=gs(),F=Hr(),_=C.useMemo(()=>Js.getInitialReferenceValue({value:z,utils:F,props:n,timezone:H,referenceDate:s,granularity:_s.month}),[]),j=n,X=hle(j),Q=C.useMemo(()=>F.getMonth(k),[F,k]),te=C.useMemo(()=>z!=null?F.getMonth(z):null,[z,F]),[Z,G]=C.useState(()=>te||F.getMonth(_)),[ne,se]=li({name:"MonthCalendar",state:"hasFocus",controlled:S,default:x??!1}),pe=It(Ce=>{se(Ce),T&&T(Ce)}),oe=C.useCallback(Ce=>{const $e=F.startOfMonth(f&&F.isAfter(k,m)?k:m),de=F.startOfMonth(d&&F.isBefore(k,c)?k:c),ke=F.startOfMonth(Ce);return F.isBefore(ke,$e)||F.isAfter(ke,de)?!0:b?b(ke):!1},[d,f,c,m,k,b,F]),ae=It((Ce,$e)=>{if(v)return;const de=F.setMonth(z??_,$e);W(de)}),ce=It(Ce=>{oe(F.setMonth(z??_,Ce))||(G(Ce),pe(!0),w&&w(Ce))});C.useEffect(()=>{G(Ce=>te!==null&&Ce!==te?te:Ce)},[te]);const ge=It((Ce,$e)=>{switch(Ce.key){case"ArrowUp":ce((12+$e-3)%12),Ce.preventDefault();break;case"ArrowDown":ce((12+$e+3)%12),Ce.preventDefault();break;case"ArrowLeft":ce((12+$e+(I?1:-1))%12),Ce.preventDefault();break;case"ArrowRight":ce((12+$e+(I?-1:1))%12),Ce.preventDefault();break}}),ye=It((Ce,$e)=>{ce($e)}),we=It((Ce,$e)=>{Z===$e&&pe(!1)});return h.jsx(gle,De({ref:t,className:jt(X.root,r),ownerState:j,role:"radiogroup","aria-labelledby":$},V,{children:ik(F,z??_).map(Ce=>{const $e=F.getMonth(Ce),de=F.format(Ce,"monthShort"),ke=F.format(Ce,"month"),et=$e===te,ze=l||oe(Ce);return h.jsx(dle,{selected:et,value:$e,onClick:ae,onKeyDown:ge,autoFocus:ne&&$e===Z,disabled:ze,tabIndex:$e===Z&&!ze?0:-1,onFocus:ye,onBlur:we,"aria-current":Q===$e?"date":void 0,"aria-label":ke,monthsPerRow:M,slots:P,slotProps:N,children:de},de)})}))});function vle(e){return on("MuiPickersYear",e)}const ev=Gt("MuiPickersYear",["root","yearButton","selected","disabled"]),ble=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],xle=e=>{const{disabled:t,selected:n,classes:r}=e;return tn({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},vle,r)},Sle=Ge("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%"}}]}),wle=Ge("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${ev.disabled}`]:t.disabled},{[`&.${ev.selected}`]:t.selected}]})(({theme:e})=>De({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})`:fs(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:fs(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${ev.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${ev.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),Cle=C.memo(function(e){const t=Vr({props:e,name:"MuiPickersYear"}),{autoFocus:n,className:r,children:o,disabled:a,selected:s,value:l,tabIndex:d,onClick:f,onKeyDown:c,onFocus:m,onBlur:y,"aria-current":b,slots:v,slotProps:x}=t,w=Fn(t,ble),S=C.useRef(null),T=xle(t);Po(()=>{n&&S.current?.focus()},[n]);const M=v?.yearButton??wle,R=xr({elementType:M,externalSlotProps:x?.yearButton,additionalProps:{children:o,disabled:a,tabIndex:d,ref:S,type:"button",role:"radio","aria-current":b,"aria-checked":s,onClick:$=>f($,l),onKeyDown:$=>c($,l),onFocus:$=>m($,l),onBlur:$=>y($,l)},ownerState:t,className:T.yearButton});return h.jsx(Sle,De({className:jt(T.root,r),ownerState:t},w,{children:h.jsx(M,De({},R))}))});function kle(e){return on("MuiYearCalendar",e)}Gt("MuiYearCalendar",["root"]);const Tle=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],Mle=e=>{const{classes:t}=e;return tn({root:["root"]},kle,t)};function Ele(e,t){const n=Hr(),r=wg(),o=Vr({props:e,name:t});return De({disablePast:!1,disableFuture:!1},o,{yearsPerRow:o.yearsPerRow??3,minDate:_i(n,o.minDate,r.minDate),maxDate:_i(n,o.maxDate,r.maxDate)})}const Ole=Ge("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:y0,maxHeight:Toe,boxSizing:"border-box",position:"relative"}),Rle=C.forwardRef(function(e,t){const n=Ele(e,"MuiYearCalendar"),{autoFocus:r,className:o,value:a,defaultValue:s,referenceDate:l,disabled:d,disableFuture:f,disablePast:c,maxDate:m,minDate:y,onChange:b,readOnly:v,shouldDisableYear:x,onYearFocus:w,hasFocus:S,onFocusedViewChange:T,yearsOrder:M="asc",yearsPerRow:R,timezone:$,gridLabelId:P,slots:N,slotProps:V}=n,z=Fn(n,Tle),{value:W,handleValueChange:H,timezone:k}=wk({name:"YearCalendar",timezone:$,value:a,defaultValue:s,referenceDate:l,onChange:b,valueManager:Js}),I=p0(k),F=gs(),_=Hr(),j=C.useMemo(()=>Js.getInitialReferenceValue({value:W,utils:_,props:n,timezone:k,referenceDate:l,granularity:_s.year}),[]),X=n,Q=Mle(X),te=C.useMemo(()=>_.getYear(I),[_,I]),Z=C.useMemo(()=>W!=null?_.getYear(W):null,[W,_]),[G,ne]=C.useState(()=>Z||_.getYear(j)),[se,pe]=li({name:"YearCalendar",state:"hasFocus",controlled:S,default:r??!1}),oe=It(Ae=>{pe(Ae),T&&T(Ae)}),ae=C.useCallback(Ae=>{if(c&&_.isBeforeYear(Ae,I)||f&&_.isAfterYear(Ae,I)||y&&_.isBeforeYear(Ae,y)||m&&_.isAfterYear(Ae,m))return!0;if(!x)return!1;const le=_.startOfYear(Ae);return x(le)},[f,c,m,y,I,x,_]),ce=It((Ae,le)=>{if(v)return;const bt=_.setYear(W??j,le);H(bt)}),ge=It(Ae=>{ae(_.setYear(W??j,Ae))||(ne(Ae),oe(!0),w?.(Ae))});C.useEffect(()=>{ne(Ae=>Z!==null&&Ae!==Z?Z:Ae)},[Z]);const ye=M!=="desc"?R*1:R*-1,we=F&&M==="asc"||!F&&M==="desc"?-1:1,Ce=It((Ae,le)=>{switch(Ae.key){case"ArrowUp":ge(le-ye),Ae.preventDefault();break;case"ArrowDown":ge(le+ye),Ae.preventDefault();break;case"ArrowLeft":ge(le-we),Ae.preventDefault();break;case"ArrowRight":ge(le+we),Ae.preventDefault();break}}),$e=It((Ae,le)=>{ge(le)}),de=It((Ae,le)=>{G===le&&oe(!1)}),ke=C.useRef(null),et=mr(t,ke);C.useEffect(()=>{if(r||ke.current===null)return;const Ae=ke.current.querySelector('[tabindex="0"]');if(!Ae)return;const le=Ae.offsetHeight,bt=Ae.offsetTop,Fe=ke.current.clientHeight,it=ke.current.scrollTop,pt=bt+le;le>Fe||bt<it||(ke.current.scrollTop=pt-Fe/2-le/2)},[r]);const ze=_.getYearRange([y,m]);return M==="desc"&&ze.reverse(),h.jsx(Ole,De({ref:et,className:jt(Q.root,o),ownerState:X,role:"radiogroup","aria-labelledby":P},z,{children:ze.map(Ae=>{const le=_.getYear(Ae),bt=le===Z,Fe=d||ae(Ae);return h.jsx(Cle,{selected:bt,value:le,onClick:ce,onKeyDown:Ce,autoFocus:se&&le===G,disabled:Fe,tabIndex:le===G&&!Fe?0:-1,onFocus:$e,onBlur:de,"aria-current":te===le?"date":void 0,yearsPerRow:R,slots:N,slotProps:V,children:_.format(Ae,"year")},_.format(Ae,"year"))})}))}),$le=e=>on("MuiPickersCalendarHeader",e),Ple=Gt("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]);function Dle(e){return on("MuiPickersArrowSwitcher",e)}Gt("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const Ale=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],jle=["ownerState"],Nle=["ownerState"],Ile=Ge("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),Lle=Ge("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),MP=Ge(Gc,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),zle=e=>{const{classes:t}=e;return tn({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},Dle,t)},Fle=C.forwardRef(function(e,t){const n=gs(),r=Vr({props:e,name:"MuiPickersArrowSwitcher"}),{children:o,className:a,slots:s,slotProps:l,isNextDisabled:d,isNextHidden:f,onGoToNext:c,nextLabel:m,isPreviousDisabled:y,isPreviousHidden:b,onGoToPrevious:v,previousLabel:x,labelId:w}=r,S=Fn(r,Ale),T=r,M=zle(T),R={isDisabled:d,isHidden:f,goTo:c,label:m},$={isDisabled:y,isHidden:b,goTo:v,label:x},P=s?.previousIconButton??MP,N=xr({elementType:P,externalSlotProps:l?.previousIconButton,additionalProps:{size:"medium",title:$.label,"aria-label":$.label,disabled:$.isDisabled,edge:"end",onClick:$.goTo},ownerState:De({},T,{hidden:$.isHidden}),className:jt(M.button,M.previousIconButton)}),V=s?.nextIconButton??MP,z=xr({elementType:V,externalSlotProps:l?.nextIconButton,additionalProps:{size:"medium",title:R.label,"aria-label":R.label,disabled:R.isDisabled,edge:"start",onClick:R.goTo},ownerState:De({},T,{hidden:R.isHidden}),className:jt(M.button,M.nextIconButton)}),W=s?.leftArrowIcon??Uoe,H=xr({elementType:W,externalSlotProps:l?.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:T,className:M.leftArrowIcon}),k=Fn(H,jle),I=s?.rightArrowIcon??_oe,F=xr({elementType:I,externalSlotProps:l?.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:T,className:M.rightArrowIcon}),_=Fn(F,Nle);return h.jsxs(Ile,De({ref:t,className:jt(M.root,a),ownerState:T},S,{children:[h.jsx(P,De({},N,{children:n?h.jsx(I,De({},_)):h.jsx(W,De({},k))})),o?h.jsx(br,{variant:"subtitle1",component:"span",id:w,children:o}):h.jsx(Lle,{className:M.spacer,ownerState:T}),h.jsx(V,De({},z,{children:n?h.jsx(W,De({},k)):h.jsx(I,De({},_))}))]}))});function Ble(e,{disableFuture:t,maxDate:n,timezone:r}){const o=Hr();return C.useMemo(()=>{const a=o.date(void 0,r),s=o.startOfMonth(t&&o.isBefore(a,n)?a:n);return!o.isAfter(s,e)},[t,n,e,o,r])}function Ule(e,{disablePast:t,minDate:n,timezone:r}){const o=Hr();return C.useMemo(()=>{const a=o.date(void 0,r),s=o.startOfMonth(t&&o.isAfter(a,n)?a:n);return!o.isBefore(s,e)},[t,n,e,o,r])}const _le=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],Vle=["ownerState"],Hle=e=>{const{classes:t}=e;return tn({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},$le,t)},Wle=Ge("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}),qle=Ge("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>De({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),Yle=Ge("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),Kle=Ge(Gc,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${Ple.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),Gle=Ge(Boe,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),Qle=C.forwardRef(function(e,t){const n=_l(),r=Hr(),o=Vr({props:e,name:"MuiPickersCalendarHeader"}),{slots:a,slotProps:s,currentMonth:l,disabled:d,disableFuture:f,disablePast:c,maxDate:m,minDate:y,onMonthChange:b,onViewChange:v,view:x,reduceAnimations:w,views:S,labelId:T,className:M,timezone:R,format:$=`${r.formats.month} ${r.formats.year}`}=o,P=Fn(o,_le),N=o,V=Hle(o),z=a?.switchViewButton??Kle,W=xr({elementType:z,externalSlotProps:s?.switchViewButton,additionalProps:{size:"small","aria-label":n.calendarViewSwitchingButtonAriaLabel(x)},ownerState:N,className:V.switchViewButton}),H=a?.switchViewIcon??Gle,k=xr({elementType:H,externalSlotProps:s?.switchViewIcon,ownerState:N,className:V.switchViewIcon}),I=Fn(k,Vle),F=()=>b(r.addMonths(l,1),"left"),_=()=>b(r.addMonths(l,-1),"right"),j=Ble(l,{disableFuture:f,maxDate:m,timezone:R}),X=Ule(l,{disablePast:c,minDate:y,timezone:R}),Q=()=>{if(!(S.length===1||!v||d))if(S.length===2)v(S.find(Z=>Z!==x)||S[0]);else{const Z=S.indexOf(x)!==0?0:1;v(S[Z])}};if(S.length===1&&S[0]==="year")return null;const te=r.formatByString(l,$);return h.jsxs(Wle,De({},P,{ownerState:N,className:jt(V.root,M),ref:t,children:[h.jsxs(qle,{role:"presentation",onClick:Q,ownerState:N,"aria-live":"polite",className:V.labelContainer,children:[h.jsx(hL,{reduceAnimations:w,transKey:te,children:h.jsx(Yle,{id:T,ownerState:N,className:V.label,children:te})}),S.length>1&&!d&&h.jsx(z,De({},W,{children:h.jsx(H,De({},I))}))]}),h.jsx(ad,{in:x==="day",appear:!w,enter:!w,children:h.jsx(Fle,{slots:a,slotProps:s,onGoToPrevious:_,isPreviousDisabled:X,previousLabel:n.previousMonth,onGoToNext:F,isNextDisabled:j,nextLabel:n.nextMonth})})]}))}),Xle=Ge("div")({overflow:"hidden",width:y0,maxHeight:Ck,display:"flex",flexDirection:"column",margin:"0 auto"}),Zle=e=>on("MuiDateCalendar",e);Gt("MuiDateCalendar",["root","viewTransitionContainer"]);const Jle=["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"],ece=e=>{const{classes:t}=e;return tn({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},Zle,t)};function tce(e,t){const n=Hr(),r=wg(),o=LI(),a=Vr({props:e,name:t});return De({},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??(()=>h.jsx("span",{children:"..."})),minDate:_i(n,a.minDate,r.minDate),maxDate:_i(n,a.maxDate,r.maxDate)})}const nce=Ge(Xle,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:Ck}),rce=Ge(hL,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),oce=C.forwardRef(function(e,t){const n=Hr(),r=ys(),o=tce(e,"MuiDateCalendar"),{autoFocus:a,onViewChange:s,value:l,defaultValue:d,referenceDate:f,disableFuture:c,disablePast:m,onChange:y,onYearChange:b,onMonthChange:v,reduceAnimations:x,shouldDisableDate:w,shouldDisableMonth:S,shouldDisableYear:T,view:M,views:R,openTo:$,className:P,disabled:N,readOnly:V,minDate:z,maxDate:W,disableHighlightToday:H,focusedView:k,onFocusedViewChange:I,showDaysOutsideCurrentMonth:F,fixedWeekNumber:_,dayOfWeekFormatter:j,slots:X,slotProps:Q,loading:te,renderLoading:Z,displayWeekNumber:G,yearsOrder:ne,yearsPerRow:se,monthsPerRow:pe,timezone:oe}=o,ae=Fn(o,Jle),{value:ce,handleValueChange:ge,timezone:ye}=wk({name:"DateCalendar",timezone:oe,value:l,defaultValue:d,referenceDate:f,onChange:y,valueManager:Js}),{view:we,setView:Ce,focusedView:$e,setFocusedView:de,goToNextView:ke,setValueAndGoToNextView:et}=zI({view:M,views:R,openTo:$,onChange:ge,onViewChange:s,autoFocus:a,focusedView:k,onFocusedViewChange:I}),{referenceDate:ze,calendarState:Ae,changeFocusedDay:le,changeMonth:bt,handleChangeMonth:Fe,isDateDisabled:it,onMonthSwitchingAnimationEnd:pt}=Rse({value:ce,referenceDate:f,reduceAnimations:x,onMonthChange:v,minDate:z,maxDate:W,shouldDisableDate:w,disablePast:m,disableFuture:c,timezone:ye}),Ft=N&&ce||z,_t=N&&ce||W,at=`${r}-grid-label`,Xe=$e!==null,rt=X?.calendarHeader??Qle,Ne=xr({elementType:rt,externalSlotProps:Q?.calendarHeader,additionalProps:{views:R,view:we,currentMonth:Ae.currentMonth,onViewChange:Ce,onMonthChange:(un,vn)=>Fe({newMonth:un,direction:vn}),minDate:Ft,maxDate:_t,disabled:N,disablePast:m,disableFuture:c,reduceAnimations:x,timezone:ye,labelId:at},ownerState:o}),he=It(un=>{const vn=n.startOfMonth(un),Bn=n.endOfMonth(un),Wn=it(un)?Tm({utils:n,date:un,minDate:n.isBefore(z,vn)?vn:z,maxDate:n.isAfter(W,Bn)?Bn:W,disablePast:m,disableFuture:c,isDateDisabled:it,timezone:ye}):un;Wn?(et(Wn,"finish"),v?.(vn)):(ke(),bt(vn)),le(Wn,!0)}),We=It(un=>{const vn=n.startOfYear(un),Bn=n.endOfYear(un),Wn=it(un)?Tm({utils:n,date:un,minDate:n.isBefore(z,vn)?vn:z,maxDate:n.isAfter(W,Bn)?Bn:W,disablePast:m,disableFuture:c,isDateDisabled:it,timezone:ye}):un;Wn?(et(Wn,"finish"),b?.(Wn)):(ke(),bt(vn)),le(Wn,!0)}),Te=It(un=>ge(un&&Xv(n,un,ce??ze),"finish",we));C.useEffect(()=>{ce!=null&&n.isValid(ce)&&bt(ce)},[ce]);const kt=o,Mt=ece(kt),gt={disablePast:m,disableFuture:c,maxDate:W,minDate:z},ct={disableHighlightToday:H,readOnly:V,disabled:N,timezone:ye,gridLabelId:at,slots:X,slotProps:Q},$t=C.useRef(we);C.useEffect(()=>{$t.current!==we&&($e===$t.current&&de(we,!0),$t.current=we)},[$e,de,we]);const Vt=C.useMemo(()=>[ce],[ce]);return h.jsxs(nce,De({ref:t,className:jt(Mt.root,P),ownerState:kt},ae,{children:[h.jsx(rt,De({},Ne,{slots:X,slotProps:Q})),h.jsx(rce,{reduceAnimations:x,className:Mt.viewTransitionContainer,transKey:we,ownerState:kt,children:h.jsxs("div",{children:[we==="year"&&h.jsx(Rle,De({},gt,ct,{value:ce,onChange:We,shouldDisableYear:T,hasFocus:Xe,onFocusedViewChange:un=>de("year",un),yearsOrder:ne,yearsPerRow:se,referenceDate:ze})),we==="month"&&h.jsx(yle,De({},gt,ct,{hasFocus:Xe,className:P,value:ce,onChange:he,shouldDisableMonth:S,onFocusedViewChange:un=>de("month",un),monthsPerRow:pe,referenceDate:ze})),we==="day"&&h.jsx(ale,De({},Ae,gt,ct,{onMonthSwitchingAnimationEnd:pt,onFocusedDayChange:le,reduceAnimations:x,selectedDays:Vt,onSelectedDaysChange:Te,shouldDisableDate:w,shouldDisableMonth:S,shouldDisableYear:T,hasFocus:Xe,onFocusedViewChange:un=>de("day",un),showDaysOutsideCurrentMonth:F,fixedWeekNumber:_,dayOfWeekFormatter:j,displayWeekNumber:G,loading:te,renderLoading:Z}))]})})]}))}),Bf=({view:e,onViewChange:t,views:n,focusedView:r,onFocusedViewChange:o,value:a,defaultValue:s,referenceDate:l,onChange:d,className:f,classes:c,disableFuture:m,disablePast:y,minDate:b,maxDate:v,shouldDisableDate:x,shouldDisableMonth:w,shouldDisableYear:S,reduceAnimations:T,onMonthChange:M,monthsPerRow:R,onYearChange:$,yearsOrder:P,yearsPerRow:N,slots:V,slotProps:z,loading:W,renderLoading:H,disableHighlightToday:k,readOnly:I,disabled:F,showDaysOutsideCurrentMonth:_,dayOfWeekFormatter:j,sx:X,autoFocus:Q,fixedWeekNumber:te,displayWeekNumber:Z,timezone:G})=>h.jsx(oce,{view:e,onViewChange:t,views:n.filter(j$),focusedView:r&&j$(r)?r:null,onFocusedViewChange:o,value:a,defaultValue:s,referenceDate:l,onChange:d,className:f,classes:c,disableFuture:m,disablePast:y,minDate:b,maxDate:v,shouldDisableDate:x,shouldDisableMonth:w,shouldDisableYear:S,reduceAnimations:T,onMonthChange:M,monthsPerRow:R,onYearChange:$,yearsOrder:P,yearsPerRow:N,slots:V,slotProps:z,loading:W,renderLoading:H,disableHighlightToday:k,readOnly:I,disabled:F,showDaysOutsideCurrentMonth:_,dayOfWeekFormatter:j,sx:X,autoFocus:Q,fixedWeekNumber:te,displayWeekNumber:Z,timezone:G}),vL=C.forwardRef(function(e,t){const n=_l(),r=Hr(),o=vI(e,"MuiDesktopDatePicker"),a=De({day:Bf,month:Bf,year:Bf},o.viewRenderers),s=De({},o,{viewRenderers:a,format:sk(r,o,!1),yearsPerRow:o.yearsPerRow??4,slots:De({openPickerIcon:Voe,field:fL},o.slots),slotProps:De({},o.slotProps,{field:d=>De({},d0(o.slotProps?.field,d),xI(o),{ref:t}),toolbar:De({hidden:!0},o.slotProps?.toolbar)})}),{renderPicker:l}=Foe({props:s,valueManager:Js,valueType:"date",getOpenDialogAriaText:gI({utils:r,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:s.localeText?.openDatePickerDialogue}),validator:Cg});return l()});vL.propTypes={autoFocus:nt.bool,className:nt.string,closeOnSelect:nt.bool,dayOfWeekFormatter:nt.func,defaultValue:nt.object,disabled:nt.bool,disableFuture:nt.bool,disableHighlightToday:nt.bool,disableOpenPicker:nt.bool,disablePast:nt.bool,displayWeekNumber:nt.bool,enableAccessibleFieldDOMStructure:nt.any,fixedWeekNumber:nt.number,format:nt.string,formatDensity:nt.oneOf(["dense","spacious"]),inputRef:aI,label:nt.node,loading:nt.bool,localeText:nt.object,maxDate:nt.object,minDate:nt.object,monthsPerRow:nt.oneOf([3,4]),name:nt.string,onAccept:nt.func,onChange:nt.func,onClose:nt.func,onError:nt.func,onMonthChange:nt.func,onOpen:nt.func,onSelectedSectionsChange:nt.func,onViewChange:nt.func,onYearChange:nt.func,open:nt.bool,openTo:nt.oneOf(["day","month","year"]),orientation:nt.oneOf(["landscape","portrait"]),readOnly:nt.bool,reduceAnimations:nt.bool,referenceDate:nt.object,renderLoading:nt.func,selectedSections:nt.oneOfType([nt.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),nt.number]),shouldDisableDate:nt.func,shouldDisableMonth:nt.func,shouldDisableYear:nt.func,showDaysOutsideCurrentMonth:nt.bool,slotProps:nt.object,slots:nt.object,sx:nt.oneOfType([nt.arrayOf(nt.oneOfType([nt.func,nt.object,nt.bool])),nt.func,nt.object]),timezone:nt.string,value:nt.object,view:nt.oneOf(["day","month","year"]),viewRenderers:nt.shape({day:nt.func,month:nt.func,year:nt.func}),views:nt.arrayOf(nt.oneOf(["day","month","year"]).isRequired),yearsOrder:nt.oneOf(["asc","desc"]),yearsPerRow:nt.oneOf([3,4])};function ace(e){return on("MuiDialogContent",e)}Gt("MuiDialogContent",["root","dividers"]);const ice=Gt("MuiDialogTitle",["root"]),sce=e=>{const{classes:t,dividers:n}=e;return tn({root:["root",n&&"dividers"]},ace,t)},lce=Ge("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(Vn(({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:{[`.${ice.root} + &`]:{paddingTop:0}}}]}))),cce=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiDialogContent"}),{className:r,dividers:o=!1,...a}=n,s={...n,dividers:o},l=sce(s);return h.jsx(lce,{className:jt(l.root,r),ownerState:s,ref:t,...a})});function uce(e){return on("MuiDialog",e)}const $m=Gt("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),dce=C.createContext({}),fce=Ge(XI,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),pce=e=>{const{classes:t,scroll:n,maxWidth:r,fullWidth:o,fullScreen:a}=e,s={root:["root"],container:["container",`scroll${Tt(n)}`],paper:["paper",`paperScroll${Tt(n)}`,`paperWidth${Tt(String(r))}`,o&&"paperFullWidth",a&&"paperFullScreen"]};return tn(s,uce,t)},hce=Ge(ZI,{name:"MuiDialog",slot:"Root"})({"@media print":{position:"absolute !important"}}),mce=Ge("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${Tt(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"}}}]}),gce=Ge(hd,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`scrollPaper${Tt(n.scroll)}`],t[`paperWidth${Tt(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(Vn(({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)`,[`&.${$m.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}`,[`&.${$m.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,[`&.${$m.paperScrollBody}`]:{margin:0,maxWidth:"100%"}}}]}))),yce=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiDialog"}),r=fd(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":s,"aria-modal":l=!0,BackdropComponent:d,BackdropProps:f,children:c,className:m,disableEscapeKeyDown:y=!1,fullScreen:b=!1,fullWidth:v=!1,maxWidth:x="sm",onClick:w,onClose:S,open:T,PaperComponent:M=hd,PaperProps:R={},scroll:$="paper",slots:P={},slotProps:N={},TransitionComponent:V=ad,transitionDuration:z=o,TransitionProps:W,...H}=n,k={...n,disableEscapeKeyDown:y,fullScreen:b,fullWidth:v,maxWidth:x,scroll:$},I=pce(k),F=C.useRef(),_=$e=>{F.current=$e.target===$e.currentTarget},j=$e=>{w&&w($e),F.current&&(F.current=null,S&&S($e,"backdropClick"))},X=ys(s),Q=C.useMemo(()=>({titleId:X}),[X]),te={transition:V,...P},Z={transition:W,paper:R,backdrop:f,...N},G={slots:te,slotProps:Z},[ne,se]=ir("root",{elementType:hce,shouldForwardComponentProp:!0,externalForwardedProps:G,ownerState:k,className:jt(I.root,m),ref:t}),[pe,oe]=ir("backdrop",{elementType:fce,shouldForwardComponentProp:!0,externalForwardedProps:G,ownerState:k}),[ae,ce]=ir("paper",{elementType:gce,shouldForwardComponentProp:!0,externalForwardedProps:G,ownerState:k,className:jt(I.paper,R.className)}),[ge,ye]=ir("container",{elementType:mce,externalForwardedProps:G,ownerState:k,className:I.container}),[we,Ce]=ir("transition",{elementType:ad,externalForwardedProps:G,ownerState:k,additionalProps:{appear:!0,in:T,timeout:z,role:"presentation"}});return h.jsx(ne,{closeAfterTransition:!0,slots:{backdrop:pe},slotProps:{backdrop:{transitionDuration:z,as:d,...oe}},disableEscapeKeyDown:y,onClose:S,open:T,onClick:j,...se,...H,children:h.jsx(we,{...Ce,children:h.jsx(ge,{onMouseDown:_,...ye,children:h.jsx(ae,{as:M,elevation:24,role:"dialog","aria-describedby":a,"aria-labelledby":X,"aria-modal":l,...ce,children:h.jsx(dce.Provider,{value:Q,children:c})})})})})}),vce=Ge(yce)({[`& .${$m.container}`]:{outline:0},[`& .${$m.paper}`]:{outline:0,minWidth:y0}}),bce=Ge(cce)({"&:first-of-type":{padding:0}});function xce(e){const{children:t,onDismiss:n,open:r,slots:o,slotProps:a}=e,s=o?.dialog??vce,l=o?.mobileTransition??ad;return h.jsx(s,De({open:r,onClose:n},a?.dialog,{TransitionComponent:l,TransitionProps:a?.mobileTransition,PaperComponent:o?.mobilePaper,PaperProps:a?.mobilePaper,children:h.jsx(bce,{children:t})}))}const Sce=["props","getOpenDialogAriaText"],wce=e=>{let{props:t,getOpenDialogAriaText:n}=e,r=Fn(e,Sce);const{slots:o,slotProps:a,className:s,sx:l,format:d,formatDensity:f,enableAccessibleFieldDOMStructure:c,selectedSections:m,onSelectedSectionsChange:y,timezone:b,name:v,label:x,inputRef:w,readOnly:S,disabled:T,localeText:M}=t,R=C.useRef(null),$=ys(),P=a?.toolbar?.hidden??!1,{open:N,actions:V,layoutProps:z,renderCurrentView:W,fieldProps:H,contextValue:k}=FI(De({},r,{props:t,fieldRef:R,autoFocusView:!0,additionalViewProps:{},wrapperVariant:"mobile"})),I=o.field,F=xr({elementType:I,externalSlotProps:a?.field,additionalProps:De({},H,P&&{id:$},!(T||S)&&{onClick:V.onOpen,onKeyDown:Tre(V.onOpen)},{readOnly:S??!0,disabled:T,className:s,sx:l,format:d,formatDensity:f,enableAccessibleFieldDOMStructure:c,selectedSections:m,onSelectedSectionsChange:y,timezone:b,label:x,name:v},w?{inputRef:w}:{}),ownerState:t});F.inputProps=De({},F.inputProps,{"aria-label":n(H.value)});const _=De({textField:o.textField},F.slots),j=o.layout??WI;let X=$;P&&(x?X=`${$}-label`:X=void 0);const Q=De({},a,{toolbar:De({},a?.toolbar,{titleId:$}),mobilePaper:De({"aria-labelledby":X},a?.mobilePaper)}),te=mr(R,F.unstableFieldRef);return{renderPicker:()=>h.jsxs(qI,{contextValue:k,localeText:M,children:[h.jsx(I,De({},F,{slots:_,slotProps:Q,unstableFieldRef:te})),h.jsx(xce,De({},V,{open:N,slots:o,slotProps:Q,children:h.jsx(j,De({},z,Q?.layout,{slots:o,slotProps:Q,children:W()}))}))]})}},bL=C.forwardRef(function(e,t){const n=_l(),r=Hr(),o=vI(e,"MuiMobileDatePicker"),a=De({day:Bf,month:Bf,year:Bf},o.viewRenderers),s=De({},o,{viewRenderers:a,format:sk(r,o,!1),slots:De({field:fL},o.slots),slotProps:De({},o.slotProps,{field:d=>De({},d0(o.slotProps?.field,d),xI(o),{ref:t}),toolbar:De({hidden:!1},o.slotProps?.toolbar)})}),{renderPicker:l}=wce({props:s,valueManager:Js,valueType:"date",getOpenDialogAriaText:gI({utils:r,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:s.localeText?.openDatePickerDialogue}),validator:Cg});return l()});bL.propTypes={autoFocus:nt.bool,className:nt.string,closeOnSelect:nt.bool,dayOfWeekFormatter:nt.func,defaultValue:nt.object,disabled:nt.bool,disableFuture:nt.bool,disableHighlightToday:nt.bool,disableOpenPicker:nt.bool,disablePast:nt.bool,displayWeekNumber:nt.bool,enableAccessibleFieldDOMStructure:nt.any,fixedWeekNumber:nt.number,format:nt.string,formatDensity:nt.oneOf(["dense","spacious"]),inputRef:aI,label:nt.node,loading:nt.bool,localeText:nt.object,maxDate:nt.object,minDate:nt.object,monthsPerRow:nt.oneOf([3,4]),name:nt.string,onAccept:nt.func,onChange:nt.func,onClose:nt.func,onError:nt.func,onMonthChange:nt.func,onOpen:nt.func,onSelectedSectionsChange:nt.func,onViewChange:nt.func,onYearChange:nt.func,open:nt.bool,openTo:nt.oneOf(["day","month","year"]),orientation:nt.oneOf(["landscape","portrait"]),readOnly:nt.bool,reduceAnimations:nt.bool,referenceDate:nt.object,renderLoading:nt.func,selectedSections:nt.oneOfType([nt.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),nt.number]),shouldDisableDate:nt.func,shouldDisableMonth:nt.func,shouldDisableYear:nt.func,showDaysOutsideCurrentMonth:nt.bool,slotProps:nt.object,slots:nt.object,sx:nt.oneOfType([nt.arrayOf(nt.oneOfType([nt.func,nt.object,nt.bool])),nt.func,nt.object]),timezone:nt.string,value:nt.object,view:nt.oneOf(["day","month","year"]),viewRenderers:nt.shape({day:nt.func,month:nt.func,year:nt.func}),views:nt.arrayOf(nt.oneOf(["day","month","year"]).isRequired),yearsOrder:nt.oneOf(["asc","desc"]),yearsPerRow:nt.oneOf([3,4])};const Cce=["desktopModeMediaQuery"],ob=C.forwardRef(function(e,t){const n=Vr({props:e,name:"MuiDatePicker"}),{desktopModeMediaQuery:r=Mre}=n,o=Fn(n,Cce);return oI(r,{defaultMatches:!0})?h.jsx(vL,De({ref:t},o)):h.jsx(bL,De({ref:t},o))});function kce(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"?Tce(n):n}function Tce(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"?`
|
|
432
432
|
`:r==="t"?" ":r==="r"?"\r":r):e}$r.extend(nk);const EP=14,Mce=42;function Ece(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 s=o.replace(/^#\(/,"").replace(/\)\s*$/,"").trim();s&&n.push(s)}return n.length>0?n.join(`
|
|
433
433
|
`):void 0}function Oce({given:e,value:t,onChange:n,options:r,optionsLoading:o,optionsFailed:a}){const s=e.label??e.name??"",l=e.type??"string",d=Ece(e),f=kce(l,e.default),c=f!==void 0?`Default: ${f===""?"(empty)":f}`:void 0,m=d||c?h.jsxs(h.Fragment,{children:[d,d&&c?h.jsx("br",{}):null,c]}):void 0,y=l==="string"||km(l)==="string",b=!Iu(l)||typeof t!="string"||uJ(t),v=_=>h.jsx(ii,{label:s,value:String(t),error:!0,inputProps:{readOnly:!0},helperText:h.jsxs(h.Fragment,{children:[`Not a ${_}. Clear it to pick one.`,m?h.jsx("br",{}):null,m]}),slotProps:{input:{endAdornment:h.jsx(Z1,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"}),x=Iu(l),w=e.control==="multiselect"&&x,S=Iu(l),T=e.control==="select"||e.control==="multiselect",M=T?S?typeof t=="string"?cJ(t):[]:typeof t=="string"&&t!==""?[t]:[]:[];if(T&&y&&b&&!(!w&&M.length>1)){const _=j=>{const X=S?rk(j):void 0;if(j.length===0||X===""){n(null);return}n(S?X:j[0])};return h.jsx(OH,{multiple:w,disableCloseOnSelect:w,freeSolo:!0,forcePopupIcon:!0,autoSelect:!0,options:r??[],loading:o,noOptionsText:a?"Options unavailable":"No matching values",value:w?M:M[0]??null,onChange:(j,X)=>_(X===null?[]:Array.isArray(X)?X:[X]),renderInput:j=>h.jsx(ii,{...j,label:s,size:"small",placeholder:M.length!==0?void 0:t===""?"All":f??"All",error:a,helperText:a?h.jsxs(h.Fragment,{children:["Could not load the options for this control. Type a value to filter anyway.",m?h.jsx("br",{}):null,m]}):m,slotProps:{input:{...j.InputProps,endAdornment:h.jsxs(h.Fragment,{children:[o&&h.jsx(sg,{size:16}),j.InputProps.endAdornment]})}}}),fullWidth:!0})}const R=Iu(l)&&km(l)==="number",{rangeMin:$,rangeMax:P}=e,N=R&&typeof t=="string"?fJ(t):void 0,V=R&&typeof t=="string"?hJ(t):void 0;if((R||l==="number")&&$!==void 0&&P!==void 0&&(!R||t===void 0||t===null||t===""||N!==void 0||V!==void 0)){const _=V??(N!==void 0?[N,P]:void 0),j=R?_?.[0]:typeof t=="number"?t:void 0;if(j===void 0&&t!==void 0&&t!==null&&t!=="")return v("number");const X=j??$,Q=_??[$,P],te=Q[1]>=P?`≥ ${Q[0]}`:`${Q[0]} to ${Q[1]}`,Z=R&&t==="",G=j!==void 0||Z;return h.jsxs(DS,{fullWidth:!0,children:[h.jsxs(Kt,{sx:{height:Mce,px:`${EP}px`,display:"flex",flexDirection:"column",justifyContent:"center"},children:[h.jsxs(fr,{direction:"row",alignItems:"center",spacing:1,children:[h.jsx(Lt,{variant:"body2",color:"text.secondary",noWrap:!0,children:s}),h.jsx(Lt,{variant:"body2",sx:{fontWeight:600},children:G?Z?"Any":R?te:String(X):R?"Any":f??"Unset"}),G&&h.jsx(eo,{size:"small","aria-label":"clear value",onClick:()=>n(null),sx:{p:0},children:h.jsx(Gv,{fontSize:"small"})})]}),h.jsx(Tq,{size:"small",min:$,max:P,value:R?Q:X,disableSwap:R,valueLabelDisplay:"auto","aria-label":R?void 0:s,getAriaLabel:R?ne=>ne===0?`${s} from`:`${s} to`:void 0,sx:{py:0,mt:.5},onChange:(ne,se)=>{if(R){const[pe,oe]=Array.isArray(se)?[se[0],se[1]]:[se,se];if(pe<=$&&oe>=P){n(null);return}n(oe>=P?dJ(pe):pJ(pe,oe));return}n(Array.isArray(se)?se[0]:se)}})]}),m&&h.jsx(AS,{sx:{mx:`${EP}px`},children:m})]})}const z=Iu(l)?km(l):void 0,W=z==="date"||z==="timestamp"||z==="timestamptz",H=typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t),k=t==null||H;if(W&&!H){const _=Rce(t);if(_!==void 0)return h.jsx($ce,{label:s,state:_,onChange:n,helperNode:m,defaultDisplay:f})}if(W&&k){const _=H?$r.utc(t):null;return h.jsx(Zv,{dateAdapter:fw,children:h.jsx(ob,{label:s,value:_?.isValid()?_:null,onChange:j=>n(j?j.format("YYYY-MM-DD"):null),slotProps:{textField:{fullWidth:!0,size:"small",helperText:m},field:{clearable:!0,onClear:()=>n(null)}}})})}if(l==="boolean"){const _=typeof t=="boolean";if(!_&&t!==void 0&&t!==null)return v("true or false");const j=e.default?.trim()==="true";return h.jsxs(DS,{children:[h.jsxs(fr,{direction:"row",alignItems:"center",children:[h.jsx(MC,{control:h.jsx(g8,{checked:_?t:j,onChange:X=>n(X.target.checked)}),label:s}),_&&h.jsx(eo,{size:"small","aria-label":"clear value",onClick:()=>n(null),edge:"end",children:h.jsx(Gv,{fontSize:"small"})})]}),m&&h.jsx(AS,{children:m})]})}if(l==="number"){const _=typeof t=="number"?t:"",j=t!=null;return j&&t!==""&&typeof t!="number"?v("number"):h.jsx(ii,{label:s,type:"number",value:_,onChange:X=>{const Q=X.target.value;n(Q===""?null:Number(Q))},placeholder:f,helperText:m,slotProps:{input:{endAdornment:j&&h.jsx(Z1,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"})}if(l==="date"||l==="timestamp"||l==="timestamptz"){const _=t instanceof Date?t:typeof t=="string"?(X=>X instanceof Date?X:null)(QN(l,t)):null,j=_?$r.utc(_):null;return t!=null&&t!==""&&_===null?v("date"):h.jsx(Zv,{dateAdapter:fw,children:h.jsx(ob,{label:s,value:j,onChange:X=>n(X?kJ(X,_??void 0):null),slotProps:{textField:{fullWidth:!0,size:"small",helperText:m},field:{clearable:!0,onClear:()=>n(null)}}})})}const I=typeof t=="string"?t:"",F=t!=null;return h.jsx(ii,{label:s,value:I,onChange:_=>n(_.target.value),placeholder:F?void 0:f??(l.startsWith("filter<")?l:void 0),helperText:m,slotProps:{input:{endAdornment:F&&h.jsx(Z1,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"})}function Z1({onClear:e}){return h.jsx(FW,{position:"end",children:h.jsx(eo,{size:"small","aria-label":"clear value",onClick:e,edge:"end",children:h.jsx(Gv,{fontSize:"small"})})})}function Rce(e){if(e==null)return{kind:"unset"};if(typeof e!="string")return;if(e==="")return{kind:"any"};const t=gJ(e);if(t!==void 0)return{kind:"preset",key:t};const n=bJ(e);if(n!==void 0)return{kind:"days",...n}}const tv="__custom__",J1="__any__";function $ce({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,[s,l]=C.useState(t.kind==="days"),[d,f]=C.useState(t.kind==="days"?{from:t.firstDay,to:t.lastDay}:{});C.useEffect(()=>{t.kind==="days"?(l(!0),f({from:t.firstDay,to:t.lastDay})):t.kind!=="unset"&&l(!1)},[a]);const c=t.kind!=="unset",m=s?tv:t.kind==="preset"?t.key:t.kind==="any"?J1:"",y=v=>{f(v),v.from&&v.to&&!$r.utc(v.to).isBefore($r.utc(v.from))&&n(vJ(v.from,v.to))},b=v=>{const x=v?$r.utc(v):null;return x?.isValid()?x:null};return h.jsxs(fr,{direction:"row",spacing:1,"data-testid":"time-range",children:[h.jsxs(ii,{select:!0,label:e,value:m,size:"small",fullWidth:!0,helperText:r,slotProps:{select:{displayEmpty:!0,renderValue:v=>{if(v===tv)return"Custom range";if(v===J1)return"Any time";const x=Kv.find(w=>w.key===v);return x?x.label:o??"Any time"}},input:{endAdornment:c?h.jsx(eo,{size:"small","aria-label":"clear value",onClick:()=>{l(!1),f({}),n(null)},sx:{mr:2},children:h.jsx(Gv,{fontSize:"small"})}):void 0}},onChange:v=>{const x=v.target.value;if(x===tv){l(!0);return}l(!1);const w=mJ(x);w!==void 0&&n(w)},children:[t.kind==="any"&&h.jsx(Ii,{value:J1,children:"Any time"}),Kv.map(v=>h.jsx(Ii,{value:v.key,children:v.label},v.key)),h.jsx(Ii,{value:tv,children:"Custom range"})]}),s&&h.jsxs(Zv,{dateAdapter:fw,children:[h.jsx(ob,{label:"From",value:b(d.from),onChange:v=>y({...d,from:v?v.format("YYYY-MM-DD"):void 0}),slotProps:{textField:{size:"small"}}}),h.jsx(ob,{label:"To",value:b(d.to),minDate:b(d.from)??void 0,onChange:v=>y({...d,to:v?v.format("YYYY-MM-DD"):void 0}),slotProps:{textField:{size:"small"}}})]})]})}function xL({givens:e,values:t,onChange:n,onReset:r,layout:o="panel",options:a,optionsLoading:s,optionsFailed:l,apply:d,title:f}){const{theme:c}=ol();if(e.length===0)return null;const m=Array.from(t.values()).some(v=>v!==null),y=e.map(v=>h.jsx(Kt,{sx:o==="bar"?{minWidth:200,flex:"1 1 200px",maxWidth:320}:void 0,children:h.jsx(Oce,{given:v,value:v.name?t.get(v.name):void 0,onChange:x=>v.name&&n(v.name,x),options:v.name?a?.get(v.name):void 0,optionsLoading:s,optionsFailed:v.name?l?.has(v.name):void 0})},v.name)),b=h.jsxs(fr,{direction:"row",alignItems:"center",spacing:1,children:[d&&h.jsx(Ko,{variant:"contained",size:"small",disableElevation:!0,onClick:d.onApply,disabled:!d.pending,sx:{textTransform:"none"},children:"Apply"}),m&&h.jsx(Ko,{variant:"text",size:"small",onClick:r,sx:{textTransform:"none"},children:"Reset"})]});return o==="bar"?h.jsx(Na,{elevation:0,sx:{p:2,border:c.cardBorder,borderRadius:1,backgroundColor:"transparent"},children:h.jsxs(fr,{direction:"row",alignItems:"flex-start",spacing:2,useFlexGap:!0,sx:{flexWrap:"wrap"},children:[y,h.jsx(Kt,{sx:{flex:"0 0 auto",ml:"auto",pt:.5},children:b})]})}):h.jsxs(Na,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[h.jsxs(fr,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:2},children:[h.jsx(Lt,{variant:"subtitle2",sx:{fontWeight:600,color:"text.primary"},children:f??"Parameters"}),b]}),h.jsx(Kt,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",alignItems:"start",columnGap:3,rowGap:2.5},children:y})]})}const Pce=/^(https?|mailto|tel):/i,Dce=/^[a-z][a-z0-9+.-]*:/i;function Ace({href:e,title:t,children:n,context:r}){const o=!!e&&Dce.test(e),a=!!e&&!o&&!e.startsWith("/")&&!e.startsWith("#");if(!e||!a||!r){const m=o&&!Pce.test(e??"");return h.jsx("a",{href:m?void 0:e,title:t,...o?{target:"_blank",rel:"noopener noreferrer"}:{},children:n})}const s=r.sourcePath&&r.sourcePath.includes("/")?r.sourcePath.slice(0,r.sourcePath.lastIndexOf("/")+1):"",l=new URL(e,`https://malloy.invalid/${s}`),d=l.pathname.slice(1)+l.search+l.hash,f=`/${r.environmentName}/${r.packageName}/${d}`,{onNavigate:c}=r;return h.jsx("a",{href:f,title:t,onClick:c?m=>{m.preventDefault(),c(f,m)}:void 0,children:n})}const jce={document:{"& h1, & h2, & h3, & h4, & h5, & h6":{fontWeight:600,color:"text.primary",mb:1,mt:2},"& h1":{fontSize:"28px"},"& h2":{fontSize:"24px"},"& h3":{fontSize:"20px"},"& p, & ul, & ol":{color:"text.primary",lineHeight:1.7,mb:1,fontSize:"16px"},"& 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:600,m:"0.5em 0 0.25em"},"& p":{m:"0.5em 0"},"& ul, & ol":{m:"0.5em 0",pl:3},"& code":{fontFamily:"monospace",fontSize:"0.9em"}}};function ab({children:e,variant:t="caption",links:n,sx:r}){return h.jsx(Kt,{sx:[jce[t],...Array.isArray(r)?r:[r]],children:h.jsx(RQ,{options:{overrides:{a:{component:Ace,props:{context:n}}}},children:e})})}function oa({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:a=2,textVariant:s="body2"}){const l=h.jsxs(Kt,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:a},children:[h.jsx(sg,{size:t,color:n,thickness:r}),e&&h.jsx(Lt,{variant:s,color:"text.secondary",children:e})]});return o?h.jsx(Kt,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:l}):l}const Nce=new Set(["bar","line","chart","scatter_chart"]),Ice=new Set(["table","dashboard","shape_map","segment_map","list","list_detail","big_value","cell","link","image"]);function jhe(e,t){return t==="fill"?"container":t==="fixed"||!e?"content":Nce.has(e)?"container":"content"}function Nhe(e,t){return t==="fixed"?!0:t==="fill"?!1:e!==void 0&&Ice.has(e)}function Ihe(e){return e==="dashboard"?3:2}function Lce(e,t){let n=e.firstElementChild;for(let r=1;r<t&&n;r++)n=n.firstElementChild;return n}function Lhe(e,t){const n=Lce(e,t);return n&&(n.scrollHeight||n.offsetHeight)||0}const zce=400,Fce=700,Bce=600,Uce=800,_ce=400,OP=2e3;function Vce(e){return e===void 0?OP:Math.min(e,OP)}function Hce({sizing:e,contentHeight:t,maxHeight:n}){return e==="container"?n??_ce:t===void 0||t<=0?Vce(n):n===void 0?t:Math.min(n,t)}const Wce=2,qce=16;function Yce(e,t){const n=Math.min(e.colspan??1,t);return e.break?`1 / span ${n}`:`span ${n}`}function Kce({tiles:e,columns:t,keyOf:n,renderTile:r}){return h.jsx(Kt,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:`repeat(${t}, minmax(0, 1fr))`},gap:`${qce}px`},children:e.map((o,a)=>h.jsx(Kt,{sx:{display:"grid",minWidth:0,gridColumn:{md:Yce(o,t)}},children:r(o,a)},n(o,a)))})}const Gce=cr(h.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"}));function Qce(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath,e.queryName,e.query,e.sourceName,JSON.stringify(e.givens??{})]}function Dk(e,{enabled:t=!0}={}){const{apiClients:n}=zr();return co({queryKey:Qce(e),queryFn:()=>n.models.executeQueryModel(e.environmentName,e.packageName,e.modelPath,{queryName:e.queryName,query:e.query,sourceName:e.sourceName,givens:e.givens,versionId:e.versionId}),enabled:t,...sG})}const SL=cr(h.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 Uf({sx:e,...t}){const{theme:n}=ol();return h.jsx(eo,{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 Xce=new Set(["warn","error"]);function Zce(e){if(!e?.length)return;const t=[];let n=!1;for(const r of e)!r.message||!Xce.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(`
|
|
434
|
-
`)}}const Jce=C.lazy(()=>Lo(()=>import("./RenderedResult-
|
|
435
|
-
`},nue=/^#\(malloy\)[\s\S]*\bcalculation\b/;function rue(e){return e?e.kind==="measure"?!0:(e.annotations??[]).some(t=>typeof t?.value=="string"&&nue.test(t.value.trim())):!1}function oue(e){const t=e.schema?.fields;if(!Array.isArray(t)||t.length===0||!t.every(rue))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 aue(e){for(const t of e){const n=t.trim();if(!n.startsWith("#")||n.startsWith("#(")||n.startsWith('#"'))continue;const r=n.slice(1).replace(/"(?:[^"\\]|\\.)*"/g,'""');for(const o of r.split(/[\s{}=.,[\]]+/))if(eue.has(o))return!0}return!1}function iue(e){let t;try{t=JSON.parse(e)}catch{return e}if(!t||typeof t!="object"||!oue(t))return e;const n=Array.isArray(t.annotations)?t.annotations:[],r=n.map(o=>o?.value).filter(o=>typeof o=="string");return aue(r)?e:JSON.stringify({...t,annotations:[tue,...n]})}const wL=20,sue={radius:"8px",padding:`${wL}px`};function zhe(e,t=sue){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}}function lue({borderless:e=!1,sx:t,children:n}){const{theme:r}=ol();return h.jsx(Na,{elevation:0,sx:[{border:e?"none":r.cardBorder,borderRadius:e?0:1,background:e?"none":r.tile,overflow:"hidden",minWidth:0,minHeight:120,p:e?"12px 0":`${wL}px`},...Array.isArray(t)?t:[t]],children:n})}function cue({title:e,subtitle:t,tooltip:n,action:r}){const{theme:o}=ol();return h.jsxs(Kt,{sx:{pb:1.5,display:"flex",alignItems:"flex-start",gap:1},children:[h.jsxs(Kt,{sx:{minWidth:0,flex:1},children:[h.jsx(Lt,{variant:"subtitle2",sx:{fontWeight:500,color:o.tileTitle,fontFamily:o.font.family},title:n,children:e}),t!==void 0&&h.jsx(Lt,{variant:"caption",sx:{display:"block",color:o.tileTitle,fontFamily:o.font.family,opacity:.8},children:t})]}),r]})}function RP(e){const t=e.split("->").at(-1)?.trim()??e;return/^[A-Za-z_][\w-]*$/.test(t)?qN(t):e}function $P({environmentName:e,packageName:t,versionId:n,modelPath:r,queryName:o,tile:a,label:s,subtitle:l,borderless:d,givens:f,declaredTypes:c,givenNames:m,height:y,maxResultSize:b,drill:v,onExplore:x}){const{theme:w}=ol(),S=Dk({environmentName:e,packageName:t,modelPath:r,versionId:n,queryName:o,query:a!==void 0?`run: ${a}`:void 0,givens:c0(f,c,m)});return h.jsxs(lue,{borderless:d,sx:{"& .publisher-tile-explore":{opacity:0,transition:"opacity 120ms"},"&:hover .publisher-tile-explore, & .publisher-tile-explore:focus-visible":{opacity:1}},children:[a!==void 0&&h.jsx(cue,{title:s??RP(a),subtitle:l,tooltip:a,action:x&&h.jsx(Ui,{title:"Explore from here",children:h.jsx(eo,{className:"publisher-tile-explore",size:"small","aria-label":`Explore ${s??RP(a)}`,onClick:x,sx:{mt:-.5,mr:-.5,color:w.tileTitle},children:h.jsx(Gce,{fontSize:"small"})})})}),h.jsx(jk,{state:S,context:a??o??r,maxHeight:y,maxResultSize:b,drill:v,transform:a!==void 0?iue:void 0})]})}function PP({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 DP(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function uue(e={}){const{ignoreAccents:t=!0,ignoreCase:n=!0,limit:r,matchFrom:o="any",stringify:a,trim:s=!1}=e;return(l,{inputValue:d,getOptionLabel:f})=>{let c=s?d.trim():d;n&&(c=c.toLowerCase()),t&&(c=DP(c));const m=c?l.filter(y=>{let b=(a||f)(y);return n&&(b=b.toLowerCase()),t&&(b=DP(b)),o==="start"?b.startsWith(c):b.includes(c)}):l;return typeof r=="number"?m.slice(0,r):m}}const due=uue(),AP=5,fue=e=>e.current!==null&&e.current.parentElement?.contains(document.activeElement),pue=[];function jP(e,t,n,r){if(t||e==null||r)return"";const o=n(e);return typeof o=="string"?o:""}function hue(e){const{unstable_isActiveElementInListbox:t=fue,unstable_classNamePrefix:n="Mui",autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:s=!1,clearOnBlur:l=!e.freeSolo,clearOnEscape:d=!1,componentName:f="useAutocomplete",defaultValue:c=e.multiple?pue:null,disableClearable:m=!1,disableCloseOnSelect:y=!1,disabled:b,disabledItemsFocusable:v=!1,disableListWrap:x=!1,filterOptions:w=due,filterSelectedOptions:S=!1,freeSolo:T=!1,getOptionDisabled:M,getOptionKey:R,getOptionLabel:$=ue=>ue.label??ue,groupBy:P,handleHomeEndKeys:N=!e.freeSolo,id:V,includeInputInList:z=!1,inputValue:W,isOptionEqualToValue:H=(ue,fe)=>ue===fe,multiple:k=!1,onChange:I,onClose:F,onHighlightChange:_,onInputChange:j,onOpen:X,open:Q,openOnFocus:te=!1,options:Z,readOnly:G=!1,renderValue:ne,selectOnFocus:se=!e.freeSolo,value:pe}=e,oe=ys(V);let ae=$;ae=ue=>{const fe=$(ue);return typeof fe!="string"?String(fe):fe};const ce=C.useRef(!1),ge=C.useRef(!0),ye=C.useRef(null),we=C.useRef(null),[Ce,$e]=C.useState(null),[de,ke]=C.useState(-1),et=o?0:-1,ze=C.useRef(et),Ae=C.useRef(jP(c??pe,k,ae)).current,[le,bt]=li({controlled:pe,default:c,name:f}),[Fe,it]=li({controlled:W,default:Ae,name:f,state:"inputValue"}),[pt,Ft]=C.useState(!1),_t=C.useCallback((ue,fe,Ve)=>{if(!(k?le.length<fe.length:fe!==null)&&!l)return;const vt=jP(fe,k,ae,ne);Fe!==vt&&(it(vt),j&&j(ue,vt,Ve))},[ae,Fe,k,j,it,l,le,ne]),[at,Xe]=li({controlled:Q,default:!1,name:f,state:"open"}),[rt,Ne]=C.useState(!0),he=!k&&le!=null&&Fe===ae(le),We=at&&!G,Te=We?w(Z.filter(ue=>!(S&&(k?le:[le]).some(fe=>fe!==null&&H(ue,fe)))),{inputValue:he&&rt?"":Fe,getOptionLabel:ae}):[],kt=pee({filteredOptions:Te,value:le,inputValue:Fe});C.useEffect(()=>{const ue=le!==kt.value;pt&&!ue||T&&!ue||_t(null,le,"reset")},[le,_t,pt,kt.value,T]);const Mt=at&&Te.length>0&&!G,gt=It(ue=>{if(ue===-1)ye.current.focus();else{const fe=ne?"data-item-index":"data-tag-index";Ce.querySelector(`[${fe}="${ue}"]`).focus()}});C.useEffect(()=>{k&&de>le.length-1&&(ke(-1),gt(-1))},[le,k,de,gt]);function ct(ue,fe){if(!we.current||ue<0||ue>=Te.length)return-1;let Ve=ue;for(;;){const vt=we.current.querySelector(`[data-option-index="${Ve}"]`),Ke=v?!1:!vt||vt.disabled||vt.getAttribute("aria-disabled")==="true";if(vt&&vt.hasAttribute("tabindex")&&!Ke)return Ve;if(fe==="next"?Ve=(Ve+1)%Te.length:Ve=(Ve-1+Te.length)%Te.length,Ve===ue)return-1}}const $t=It(({event:ue,index:fe,reason:Ve})=>{if(ze.current=fe,fe===-1?ye.current.removeAttribute("aria-activedescendant"):ye.current.setAttribute("aria-activedescendant",`${oe}-option-${fe}`),_&&["mouse","keyboard","touch"].includes(Ve)&&_(ue,fe===-1?null:Te[fe],Ve),!we.current)return;const vt=we.current.querySelector(`[role="option"].${n}-focused`);vt&&(vt.classList.remove(`${n}-focused`),vt.classList.remove(`${n}-focusVisible`));let Ke=we.current;if(we.current.getAttribute("role")!=="listbox"&&(Ke=we.current.parentElement.querySelector('[role="listbox"]')),!Ke)return;if(fe===-1){Ke.scrollTop=0;return}const Zt=we.current.querySelector(`[data-option-index="${fe}"]`);if(Zt&&(Zt.classList.add(`${n}-focused`),Ve==="keyboard"&&Zt.classList.add(`${n}-focusVisible`),Ke.scrollHeight>Ke.clientHeight&&Ve!=="mouse"&&Ve!=="touch")){const nn=Zt,fn=Ke.clientHeight+Ke.scrollTop,me=nn.offsetTop+nn.offsetHeight;me>fn?Ke.scrollTop=me-Ke.clientHeight:nn.offsetTop-nn.offsetHeight*(P?1.3:0)<Ke.scrollTop&&(Ke.scrollTop=nn.offsetTop-nn.offsetHeight*(P?1.3:0))}}),Vt=It(({event:ue,diff:fe,direction:Ve="next",reason:vt})=>{if(!We)return;const Ke=ct((()=>{const Zt=Te.length-1;if(fe==="reset")return et;if(fe==="start")return 0;if(fe==="end")return Zt;const nn=ze.current+fe;return nn<0?nn===-1&&z?-1:x&&ze.current!==-1||Math.abs(fe)>1?0:Zt:nn>Zt?nn===Zt+1&&z?-1:x||Math.abs(fe)>1?Zt:0:nn})(),Ve);if($t({index:Ke,reason:vt,event:ue}),r&&fe!=="reset")if(Ke===-1)ye.current.value=Fe;else{const Zt=ae(Te[Ke]);ye.current.value=Zt,Zt.toLowerCase().indexOf(Fe.toLowerCase())===0&&Fe.length>0&&ye.current.setSelectionRange(Fe.length,Zt.length)}}),un=!PP({array1:kt.filteredOptions,array2:Te,parser:ae}),vn=()=>{const ue=(fe,Ve)=>{const vt=fe?ae(fe):"",Ke=Ve?ae(Ve):"";return vt===Ke};if(ze.current!==-1&&!PP({array1:kt.filteredOptions,array2:Te,parser:ae})&&kt.inputValue===Fe&&(k?le.length===kt.value.length&&kt.value.every((fe,Ve)=>ae(le[Ve])===ae(fe)):ue(kt.value,le))){const fe=kt.filteredOptions[ze.current];if(fe)return Te.findIndex(Ve=>ae(Ve)===ae(fe))}return-1},Bn=C.useCallback(()=>{if(!We)return;const ue=vn();if(ue!==-1){ze.current=ue;return}const fe=k?le[0]:le;if(Te.length===0||fe==null){Vt({diff:"reset"});return}if(we.current){if(fe!=null){const Ve=Te[ze.current];if(k&&Ve&&le.findIndex(Ke=>H(Ve,Ke))!==-1)return;const vt=Te.findIndex(Ke=>H(Ke,fe));vt===-1?Vt({diff:"reset"}):$t({index:vt});return}if(ze.current>=Te.length-1){$t({index:Te.length-1});return}$t({index:ze.current})}},[Te.length,k?!1:le,S,Vt,$t,We,Fe,k]),Wn=It(ue=>{ow(we,ue),ue&&Bn()});C.useEffect(()=>{un&&Bn()},[Bn,un]);const Qt=ue=>{at||(Xe(!0),Ne(!0),X&&X(ue))},In=(ue,fe)=>{at&&(Xe(!1),F&&F(ue,fe))},be=(ue,fe,Ve,vt)=>{if(k){if(le.length===fe.length&&le.every((Ke,Zt)=>Ke===fe[Zt]))return}else if(le===fe)return;I&&I(ue,fe,Ve,vt),bt(fe)},zn=C.useRef(!1),En=(ue,fe,Ve="selectOption",vt="options")=>{let Ke=Ve,Zt=fe;if(k){Zt=Array.isArray(le)?le.slice():[];const nn=Zt.findIndex(fn=>H(fe,fn));nn===-1?Zt.push(fe):vt!=="freeSolo"&&(Zt.splice(nn,1),Ke="removeOption")}_t(ue,Zt,Ke),be(ue,Zt,Ke,{option:fe}),!y&&(!ue||!ue.ctrlKey&&!ue.metaKey)&&In(ue,Ke),(s===!0||s==="touch"&&zn.current||s==="mouse"&&!zn.current)&&ye.current.blur()};function Xt(ue,fe){if(ue===-1)return-1;let Ve=ue;for(;;){if(fe==="next"&&Ve===le.length||fe==="previous"&&Ve===-1)return-1;const vt=ne?"data-item-index":"data-tag-index",Ke=Ce.querySelector(`[${vt}="${Ve}"]`);if(!Ke||!Ke.hasAttribute("tabindex")||Ke.disabled||Ke.getAttribute("aria-disabled")==="true")Ve+=fe==="next"?1:-1;else return Ve}}const ie=(ue,fe)=>{if(!k)return;Fe===""&&In(ue,"toggleInput");let Ve=de;de===-1?Fe===""&&fe==="previous"&&(Ve=le.length-1):(Ve+=fe==="next"?1:-1,Ve<0&&(Ve=0),Ve===le.length&&(Ve=-1)),Ve=Xt(Ve,fe),ke(Ve),gt(Ve)},Pe=ue=>{ce.current=!0,it(""),j&&j(ue,"","clear"),be(ue,k?[]:null,"clear")},Le=ue=>fe=>{if(ue.onKeyDown&&ue.onKeyDown(fe),!fe.defaultMuiPrevented&&(de!==-1&&!["ArrowLeft","ArrowRight"].includes(fe.key)&&(ke(-1),gt(-1)),fe.which!==229))switch(fe.key){case"Home":We&&N&&(fe.preventDefault(),Vt({diff:"start",direction:"next",reason:"keyboard",event:fe}));break;case"End":We&&N&&(fe.preventDefault(),Vt({diff:"end",direction:"previous",reason:"keyboard",event:fe}));break;case"PageUp":fe.preventDefault(),Vt({diff:-AP,direction:"previous",reason:"keyboard",event:fe}),Qt(fe);break;case"PageDown":fe.preventDefault(),Vt({diff:AP,direction:"next",reason:"keyboard",event:fe}),Qt(fe);break;case"ArrowDown":fe.preventDefault(),Vt({diff:1,direction:"next",reason:"keyboard",event:fe}),Qt(fe);break;case"ArrowUp":fe.preventDefault(),Vt({diff:-1,direction:"previous",reason:"keyboard",event:fe}),Qt(fe);break;case"ArrowLeft":!k&&ne?gt(0):ie(fe,"previous");break;case"ArrowRight":!k&&ne?gt(-1):ie(fe,"next");break;case"Enter":if(ze.current!==-1&&We){const Ve=Te[ze.current],vt=M?M(Ve):!1;if(fe.preventDefault(),vt)return;En(fe,Ve,"selectOption"),r&&ye.current.setSelectionRange(ye.current.value.length,ye.current.value.length)}else T&&Fe!==""&&he===!1&&(k&&fe.preventDefault(),En(fe,Fe,"createOption","freeSolo"));break;case"Escape":We?(fe.preventDefault(),fe.stopPropagation(),In(fe,"escape")):d&&(Fe!==""||k&&le.length>0||ne)&&(fe.preventDefault(),fe.stopPropagation(),Pe(fe));break;case"Backspace":if(k&&!G&&Fe===""&&le.length>0){const Ve=de===-1?le.length-1:de,vt=le.slice();vt.splice(Ve,1),be(fe,vt,"removeOption",{option:le[Ve]})}!k&&ne&&!G&&(bt(null),gt(-1));break;case"Delete":if(k&&!G&&Fe===""&&le.length>0&&de!==-1){const Ve=de,vt=le.slice();vt.splice(Ve,1),be(fe,vt,"removeOption",{option:le[Ve]})}!k&&ne&&!G&&(bt(null),gt(-1));break}},qe=ue=>{Ft(!0),te&&!ce.current&&Qt(ue)},ut=ue=>{if(t(we)){ye.current.focus();return}Ft(!1),ge.current=!0,ce.current=!1,a&&ze.current!==-1&&We?En(ue,Te[ze.current],"blur"):a&&T&&Fe!==""?En(ue,Fe,"blur","freeSolo"):l&&_t(ue,le,"blur"),In(ue,"blur")},Nt=ue=>{const fe=ue.target.value;Fe!==fe&&(it(fe),Ne(!1),j&&j(ue,fe,"input")),fe===""?!m&&!k&&be(ue,null,"clear"):Qt(ue)},Bt=ue=>{const fe=Number(ue.currentTarget.getAttribute("data-option-index"));ze.current!==fe&&$t({event:ue,index:fe,reason:"mouse"})},Dt=ue=>{$t({event:ue,index:Number(ue.currentTarget.getAttribute("data-option-index")),reason:"touch"}),zn.current=!0},mt=ue=>{const fe=Number(ue.currentTarget.getAttribute("data-option-index"));En(ue,Te[fe],"selectOption"),zn.current=!1},At=ue=>fe=>{const Ve=le.slice();Ve.splice(ue,1),be(fe,Ve,"removeOption",{option:le[ue]})},Et=ue=>{be(ue,null,"removeOption",{option:le})},wt=ue=>{at?In(ue,"toggleInput"):Qt(ue)},Ht=ue=>{ue.currentTarget.contains(ue.target)&&ue.target.getAttribute("id")!==oe&&ue.preventDefault()},On=ue=>{ue.currentTarget.contains(ue.target)&&(ye.current.focus(),se&&ge.current&&ye.current.selectionEnd-ye.current.selectionStart===0&&ye.current.select(),ge.current=!1)},qn=ue=>{!b&&(Fe===""||!at)&&wt(ue)};let bn=T&&Fe.length>0;bn=bn||(k?le.length>0:le!==null);let dn=Te;return P&&(dn=Te.reduce((ue,fe,Ve)=>{const vt=P(fe);return ue.length>0&&ue[ue.length-1].group===vt?ue[ue.length-1].options.push(fe):ue.push({key:Ve,index:Ve,group:vt,options:[fe]}),ue},[])),b&&pt&&ut(),{getRootProps:(ue={})=>({...ue,onKeyDown:Le(ue),onMouseDown:Ht,onClick:On}),getInputLabelProps:()=>({id:`${oe}-label`,htmlFor:oe}),getInputProps:()=>({id:oe,value:Fe,onBlur:ut,onFocus:qe,onChange:Nt,onMouseDown:qn,"aria-activedescendant":We?"":null,"aria-autocomplete":r?"both":"list","aria-controls":Mt?`${oe}-listbox`:void 0,"aria-expanded":Mt,autoComplete:"off",ref:ye,autoCapitalize:"none",spellCheck:"false",role:"combobox",disabled:b}),getClearProps:()=>({tabIndex:-1,type:"button",onClick:Pe}),getItemProps:({index:ue=0}={})=>({...k&&{key:ue},...ne?{"data-item-index":ue}:{"data-tag-index":ue},tabIndex:-1,...!G&&{onDelete:k?At(ue):Et}}),getPopupIndicatorProps:()=>({tabIndex:-1,type:"button",onClick:wt}),getTagProps:({index:ue})=>({key:ue,"data-tag-index":ue,tabIndex:-1,...!G&&{onDelete:At(ue)}}),getListboxProps:()=>({role:"listbox",id:`${oe}-listbox`,"aria-labelledby":`${oe}-label`,ref:Wn,onMouseDown:ue=>{ue.preventDefault()}}),getOptionProps:({index:ue,option:fe})=>{const Ve=(k?le:[le]).some(Ke=>Ke!=null&&H(fe,Ke)),vt=M?M(fe):!1;return{key:R?.(fe)??ae(fe),tabIndex:-1,role:"option",id:`${oe}-option-${ue}`,onMouseMove:Bt,onClick:mt,onTouchStart:Dt,"data-option-index":ue,"aria-disabled":vt,"aria-selected":Ve}},id:oe,inputValue:Fe,value:le,dirty:bn,expanded:We&&Ce,popupOpen:We,focused:pt||de!==-1,anchorEl:Ce,setAnchorEl:$e,focusedItem:de,focusedTag:de,groupedOptions:dn}}function mue(e){return on("MuiListSubheader",e)}Gt("MuiListSubheader",["root","colorPrimary","colorInherit","gutters","inset","sticky"]);const gue=e=>{const{classes:t,color:n,disableGutters:r,inset:o,disableSticky:a}=e,s={root:["root",n!=="default"&&`color${Tt(n)}`,!r&&"gutters",o&&"inset",!a&&"sticky"]};return tn(s,mue,t)},yue=Ge("li",{name:"MuiListSubheader",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${Tt(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(Vn(({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}}]}))),kw=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiListSubheader"}),{className:r,color:o="default",component:a="li",disableGutters:s=!1,disableSticky:l=!1,inset:d=!1,...f}=n,c={...n,color:o,component:a,disableGutters:s,disableSticky:l,inset:d},m=gue(c);return h.jsx(yue,{as:a,className:jt(m.root,r),ref:t,ownerState:c,...f})});kw&&(kw.muiSkipListHighlight=!0);const vue=cr(h.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 bue(e){return on("MuiAutocomplete",e)}const Qn=Gt("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 NP,IP;const xue=e=>{const{classes:t,disablePortal:n,expanded:r,focused:o,fullWidth:a,hasClearIcon:s,hasPopupIcon:l,inputFocused:d,popupOpen:f,size:c}=e,m={root:["root",r&&"expanded",o&&"focused",a&&"fullWidth",s&&"hasClearIcon",l&&"hasPopupIcon"],inputRoot:["inputRoot"],input:["input",d&&"inputFocused"],tag:["tag",`tagSize${Tt(c)}`],endAdornment:["endAdornment"],clearIndicator:["clearIndicator"],popupIndicator:["popupIndicator",f&&"popupIndicatorOpen"],popper:["popper",n&&"popperDisablePortal"],paper:["paper"],listbox:["listbox"],loading:["loading"],noOptions:["noOptions"],option:["option"],groupLabel:["groupLabel"],groupUl:["groupUl"]};return tn(m,bue,t)},Sue=Ge("div",{name:"MuiAutocomplete",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e,{fullWidth:r,hasClearIcon:o,hasPopupIcon:a,inputFocused:s,size:l}=n;return[{[`& .${Qn.tag}`]:t.tag},{[`& .${Qn.tag}`]:t[`tagSize${Tt(l)}`]},{[`& .${Qn.inputRoot}`]:t.inputRoot},{[`& .${Qn.input}`]:t.input},{[`& .${Qn.input}`]:s&&t.inputFocused},t.root,r&&t.fullWidth,a&&t.hasPopupIcon,o&&t.hasClearIcon]}})({[`&.${Qn.focused} .${Qn.clearIndicator}`]:{visibility:"visible"},"@media (pointer: fine)":{[`&:hover .${Qn.clearIndicator}`]:{visibility:"visible"}},[`& .${Qn.tag}`]:{margin:3,maxWidth:"calc(100% - 6px)"},[`& .${Qn.inputRoot}`]:{[`.${Qn.hasPopupIcon}&, .${Qn.hasClearIcon}&`]:{paddingRight:30},[`.${Qn.hasPopupIcon}.${Qn.hasClearIcon}&`]:{paddingRight:56},[`& .${Qn.input}`]:{width:0,minWidth:30}},[`& .${Oc.root}`]:{paddingBottom:1,"& .MuiInput-input":{padding:"4px 4px 4px 0px"}},[`& .${Oc.root}.${ni.sizeSmall}`]:{[`& .${Oc.input}`]:{padding:"2px 4px 3px 0"}},[`& .${Mi.root}`]:{padding:9,[`.${Qn.hasPopupIcon}&, .${Qn.hasClearIcon}&`]:{paddingRight:39},[`.${Qn.hasPopupIcon}.${Qn.hasClearIcon}&`]:{paddingRight:65},[`& .${Qn.input}`]:{padding:"7.5px 4px 7.5px 5px"},[`& .${Qn.endAdornment}`]:{right:9}},[`& .${Mi.root}.${ni.sizeSmall}`]:{paddingTop:6,paddingBottom:6,paddingLeft:6,[`& .${Qn.input}`]:{padding:"2.5px 4px 2.5px 8px"}},[`& .${ri.root}`]:{paddingTop:19,paddingLeft:8,[`.${Qn.hasPopupIcon}&, .${Qn.hasClearIcon}&`]:{paddingRight:39},[`.${Qn.hasPopupIcon}.${Qn.hasClearIcon}&`]:{paddingRight:65},[`& .${ri.input}`]:{padding:"7px 4px"},[`& .${Qn.endAdornment}`]:{right:9}},[`& .${ri.root}.${ni.sizeSmall}`]:{paddingBottom:1,[`& .${ri.input}`]:{padding:"2.5px 4px"}},[`& .${ni.hiddenLabel}`]:{paddingTop:8},[`& .${ri.root}.${ni.hiddenLabel}`]:{paddingTop:0,paddingBottom:0,[`& .${Qn.input}`]:{paddingTop:16,paddingBottom:17}},[`& .${ri.root}.${ni.hiddenLabel}.${ni.sizeSmall}`]:{[`& .${Qn.input}`]:{paddingTop:8,paddingBottom:9}},[`& .${Qn.input}`]:{flexGrow:1,textOverflow:"ellipsis",opacity:0},variants:[{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{[`& .${Qn.tag}`]:{margin:2,maxWidth:"calc(100% - 4px)"}}},{props:{inputFocused:!0},style:{[`& .${Qn.input}`]:{opacity:1}}},{props:{multiple:!0},style:{[`& .${Qn.inputRoot}`]:{flexWrap:"wrap"}}}]}),wue=Ge("div",{name:"MuiAutocomplete",slot:"EndAdornment"})({position:"absolute",right:0,top:"50%",transform:"translate(0, -50%)"}),Cue=Ge(Gc,{name:"MuiAutocomplete",slot:"ClearIndicator"})({marginRight:-2,padding:4,visibility:"hidden"}),kue=Ge(Gc,{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)"}}]}),Tue=Ge(xk,{name:"MuiAutocomplete",slot:"Popper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Qn.option}`]:t.option},t.popper,n.disablePortal&&t.popperDisablePortal]}})(Vn(({theme:e})=>({zIndex:(e.vars||e).zIndex.modal,variants:[{props:{disablePortal:!0},style:{position:"absolute"}}]}))),Mue=Ge(hd,{name:"MuiAutocomplete",slot:"Paper"})(Vn(({theme:e})=>({...e.typography.body1,overflow:"auto"}))),Eue=Ge("div",{name:"MuiAutocomplete",slot:"Loading"})(Vn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),Oue=Ge("div",{name:"MuiAutocomplete",slot:"NoOptions"})(Vn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),Rue=Ge("ul",{name:"MuiAutocomplete",slot:"Listbox"})(Vn(({theme:e})=>({listStyle:"none",margin:0,padding:"8px 0",maxHeight:"40vh",overflow:"auto",position:"relative",[`& .${Qn.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"},[`&.${Qn.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"},[`&.${Qn.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),[`&.${Qn.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}},[`&.${Qn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))),$ue=Ge(kw,{name:"MuiAutocomplete",slot:"GroupLabel"})(Vn(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,top:-8}))),Pue=Ge("ul",{name:"MuiAutocomplete",slot:"GroupUl"})({padding:0,[`& .${Qn.option}`]:{paddingLeft:24}}),Due=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiAutocomplete"}),{autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:s=!1,ChipProps:l,className:d,clearIcon:f=NP||(NP=h.jsx(vue,{fontSize:"small"})),clearOnBlur:c=!n.freeSolo,clearOnEscape:m=!1,clearText:y="Clear",closeText:b="Close",componentsProps:v,defaultValue:x=n.multiple?[]:null,disableClearable:w=!1,disableCloseOnSelect:S=!1,disabled:T=!1,disabledItemsFocusable:M=!1,disableListWrap:R=!1,disablePortal:$=!1,filterOptions:P,filterSelectedOptions:N=!1,forcePopupIcon:V="auto",freeSolo:z=!1,fullWidth:W=!1,getLimitTagsText:H=me=>`+${me}`,getOptionDisabled:k,getOptionKey:I,getOptionLabel:F,isOptionEqualToValue:_,groupBy:j,handleHomeEndKeys:X=!n.freeSolo,id:Q,includeInputInList:te=!1,inputValue:Z,limitTags:G=-1,ListboxComponent:ne,ListboxProps:se,loading:pe=!1,loadingText:oe="Loading…",multiple:ae=!1,noOptionsText:ce="No options",onChange:ge,onClose:ye,onHighlightChange:we,onInputChange:Ce,onOpen:$e,open:de,openOnFocus:ke=!1,openText:et="Open",options:ze,PaperComponent:Ae,PopperComponent:le,popupIcon:bt=IP||(IP=h.jsx(rL,{})),readOnly:Fe=!1,renderGroup:it,renderInput:pt,renderOption:Ft,renderTags:_t,renderValue:at,selectOnFocus:Xe=!n.freeSolo,size:rt="medium",slots:Ne={},slotProps:he={},value:We,...Te}=n,{getRootProps:kt,getInputProps:Mt,getInputLabelProps:gt,getPopupIndicatorProps:ct,getClearProps:$t,getItemProps:Vt,getListboxProps:un,getOptionProps:vn,value:Bn,dirty:Wn,expanded:Qt,id:In,popupOpen:be,focused:zn,focusedItem:En,anchorEl:Xt,setAnchorEl:ie,inputValue:Pe,groupedOptions:Le}=hue({...n,componentName:"Autocomplete"}),qe=!w&&!T&&Wn&&!Fe,ut=(!z||V===!0)&&V!==!1,{onMouseDown:Nt}=Mt(),{ref:Bt,...Dt}=un(),mt=F||(me=>me.label??me),At={...n,disablePortal:$,expanded:Qt,focused:zn,fullWidth:W,getOptionLabel:mt,hasClearIcon:qe,hasPopupIcon:ut,inputFocused:En===-1,popupOpen:be,size:rt},Et=xue(At),wt={slots:{paper:Ae,popper:le,...Ne},slotProps:{chip:l,listbox:se,...v,...he}},[Ht,On]=ir("listbox",{elementType:Rue,externalForwardedProps:wt,ownerState:At,className:Et.listbox,additionalProps:Dt,ref:Bt}),[qn,bn]=ir("paper",{elementType:hd,externalForwardedProps:wt,ownerState:At,className:Et.paper}),[dn,ue]=ir("popper",{elementType:xk,externalForwardedProps:wt,ownerState:At,className:Et.popper,additionalProps:{disablePortal:$,style:{width:Xt?Xt.clientWidth:null},role:"presentation",anchorEl:Xt,open:be}});let fe;const Ve=me=>({className:Et.tag,disabled:T,...Vt(me)});if(ae?Bn.length>0&&(_t?fe=_t(Bn,Ve,At):at?fe=at(Bn,Ve,At):fe=Bn.map((me,Ee)=>{const{key:He,...yt}=Ve({index:Ee});return h.jsx(HI,{label:mt(me),size:rt,...yt,...wt.slotProps.chip},He)})):at&&Bn!=null&&(fe=at(Bn,Ve,At)),G>-1&&Array.isArray(fe)){const me=fe.length-G;!zn&&me>0&&(fe=fe.splice(0,G),fe.push(h.jsx("span",{className:Et.tag,children:H(me)},fe.length)))}const vt=it||(me=>h.jsxs("li",{children:[h.jsx($ue,{className:Et.groupLabel,ownerState:At,component:"div",children:me.group}),h.jsx(Pue,{className:Et.groupUl,ownerState:At,children:me.children})]},me.key)),Ke=Ft||((me,Ee)=>{const{key:He,...yt}=me;return h.jsx("li",{...yt,children:mt(Ee)},He)}),Zt=(me,Ee)=>{const He=vn({option:me,index:Ee});return Ke({...He,className:Et.option},me,{selected:He["aria-selected"],index:Ee,inputValue:Pe},At)},nn=wt.slotProps.clearIndicator,fn=wt.slotProps.popupIndicator;return h.jsxs(C.Fragment,{children:[h.jsx(Sue,{ref:t,className:jt(Et.root,d),ownerState:At,...kt(Te),children:pt({id:In,disabled:T,fullWidth:!0,size:rt==="small"?"small":void 0,InputLabelProps:gt(),InputProps:{ref:ie,className:Et.inputRoot,startAdornment:fe,onMouseDown:me=>{me.target===me.currentTarget&&Nt(me)},...(qe||ut)&&{endAdornment:h.jsxs(wue,{className:Et.endAdornment,ownerState:At,children:[qe?h.jsx(Cue,{...$t(),"aria-label":y,title:y,ownerState:At,...nn,className:jt(Et.clearIndicator,nn?.className),children:f}):null,ut?h.jsx(kue,{...ct(),disabled:T,"aria-label":be?b:et,title:be?b:et,ownerState:At,...fn,className:jt(Et.popupIndicator,fn?.className),children:bt}):null]})}},inputProps:{className:Et.input,disabled:T,readOnly:Fe,...Mt()}})}),Xt?h.jsx(Tue,{as:dn,...ue,children:h.jsxs(Mue,{as:qn,...bn,children:[pe&&Le.length===0?h.jsx(Eue,{className:Et.loading,ownerState:At,children:oe}):null,Le.length===0&&!z&&!pe?h.jsx(Oue,{className:Et.noOptions,ownerState:At,role:"presentation",onMouseDown:me=>{me.preventDefault()},children:ce}):null,Le.length>0?h.jsx(Ht,{as:ne,...On,children:Le.map((me,Ee)=>j?vt({key:me.key,group:me.group,children:me.options.map((He,yt)=>Zt(He,me.index+yt))}):Zt(me,Ee))}):null]})}):null]})});function Aue({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a}){return pn.useEffect(()=>{o&&o(t)},[t,o]),h.jsx(dN,{children:h.jsxs(V6,{spacing:2,component:"section",children:[h.jsx(Nue,{sourceAndPath:e[t],existingQuery:n,onChange:s=>{r&&r(s)},resourceUri:a}),h.jsx(vA,{height:"5px"})]})})}function eS(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function jue({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a}){const[s,l]=pn.useState(n||eS()),[d,f]=pn.useState(void 0);pn.useEffect(()=>{n&&l(n)},[n]);const[c,m]=pn.useState([]),{MalloyExplorerProvider:y,QueryPanel:b,ResizableCollapsiblePanel:v,ResultPanel:x,SourcePanel:w}=r;pn.useEffect(()=>{t&&t(s)},[t,s]);const{environmentName:S,packageName:T,versionId:M}=xo(a),{apiClients:R}=zr(),$=Ws({mutationFn:()=>{const z=typeof s?.malloyQuery=="string"?s.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:s?.malloyQuery}).toMalloy();return f({executionState:"running",query:s?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{$.reset(),f(void 0)},response:{result:{}}}),l({...s,query:z}),R.models.executeQueryModel(S,T,e.modelPath,{query:z,sourceName:void 0,queryName:void 0,versionId:M})},onSuccess:z=>{if(z){const W=JSON.parse(z.data.result);l({...s,malloyResult:W}),f(H=>H?{...H,executionState:"finished",response:{result:W}}:void 0)}},onError:z=>{f(void 0),console.error("Query execution error:",z)}}),[P,N]=pn.useState(e.sourceInfo.name);pn.useEffect(()=>{P!==e.sourceInfo.name&&(N(e.sourceInfo.name),l(eS()),f(void 0))},[e,P]);const V=pn.useCallback(z=>{l({...s,malloyQuery:z,malloyResult:void 0})},[s]);return P!==e.sourceInfo.name?h.jsx("div",{children:"Loading..."}):h.jsx(fN,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:h.jsx(y,{source:e.sourceInfo,query:s?.malloyQuery,topValues:[],onFocusedNestViewPathChange:m,focusedNestViewPath:c,onQueryChange:V,children:h.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[h.jsx(v,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:h.jsx(w,{onRefresh:()=>l(eS())})}),h.jsx(v,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:h.jsx(b,{runQuery:()=>{console.log(`running query with: ${s?.malloyQuery}`);try{$.mutate()}catch(z){console.error("Error running query:",z)}}})}),h.jsx(x,{source:e.sourceInfo,draftQuery:s?.malloyQuery,setDraftQuery:z=>l({...s,malloyQuery:z}),submittedQuery:d,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function Nue(e){const[t,n]=C.useState(null),[r,o]=C.useState(null),[a,s]=C.useState(!0);return C.useEffect(()=>{let l=!0;return Promise.all([Lo(()=>import("./index-BdwkgpbO.js"),__vite__mapDeps([0,1,2,3,4,5,6])),Lo(()=>import("./index-Dyxfz1yO.js").then(d=>d.i),__vite__mapDeps([4,3,2]))]).then(([d,f])=>{l&&(n(d),o(f),s(!1))}).catch(d=>{console.error("Failed to load Malloy components:",d),l&&s(!1)}),()=>{l=!1}},[]),a||!t||!r?h.jsx(OK,{children:h.jsx(fN,{children:h.jsx(vA,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):h.jsx(jue,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function Nk(e,t=!0){const{modelPath:n,environmentName:r,packageName:o,versionId:a}=xo(e),{apiClients:s}=zr();return co({queryKey:["package",r,o,n,a],queryFn:async()=>(await s.models.getModel(r,o,n,a)).data,enabled:t})}function CL({data:e,onChange:t,existingQuery:n,initialSelectedSourceIndex:r=0,onSourceChange:o,resourceUri:a}){const[s,l]=pn.useState(r);pn.useEffect(()=>{l(r)},[r]);const{data:d,isError:f,isLoading:c,error:m}=Nk(a,!e),{modelPath:y}=xo(a),b=e||d;if(c&&!e)return h.jsx(oa,{text:"Fetching Model..."});if(f&&!e)return console.log("error",m),h.jsx(ha,{error:m,context:`ModelExplorer > ${y}`});if(!b)return h.jsx(oa,{text:"Loading..."});const v=(b?.sourceInfos||[]).map((w,S)=>{try{return JSON.parse(w)?.name||`Source ${S+1}`}catch{return`Source ${S+1}`}}),x=v[s]||"";return h.jsxs(kK,{variant:"outlined",children:[h.jsx(TK,{children:h.jsx(fr,{sx:{flexDirection:"row"},children:h.jsx(Due,{size:"small",id:"size-small-standard",disablePortal:!0,options:v,value:x,onChange:(w,S)=>{if(!S)return;const T=v.indexOf(S);T>=0&&(l(T),o?.(T))},renderInput:w=>h.jsx(hr,{...w}),style:{width:350,marginTop:"3px",marginLeft:"6px",marginBottom:"8px"}})})}),h.jsx(dN,{children:h.jsxs(fr,{spacing:2,component:"section",children:[Array.isArray(b.sourceInfos)&&b.sourceInfos.length>0&&h.jsx(Aue,{sourceAndPaths:b.sourceInfos.map(w=>({sourceInfo:JSON.parse(w),modelPath:y})),selectedSourceIndex:s,existingQuery:n,onQueryChange:t,resourceUri:a}),h.jsx(Kt,{height:"5px"})]})})]})}function Ik({open:e,onClose:t,resourceUri:n,data:r,title:o="Data Sources",hasValidImport:a=!0,existingQuery:s,initialSelectedSourceIndex:l,onChange:d,onSourceChange:f}){return h.jsxs(Yf,{open:e,onClose:t,fullScreen:!0,children:[h.jsxs(Gf,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o,h.jsx(eo,{onClick:t,sx:{color:"text.secondary"},children:h.jsx(Jf,{})})]}),h.jsx(Kf,{children:a?h.jsx(CL,{resourceUri:n,data:r,existingQuery:s,initialSelectedSourceIndex:l,onChange:d,onSourceChange:f}):h.jsx("div",{children:"No valid import statement found in cell"})})]})}function Iue(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function Lue(e,t){if(e==null||e==="")return;const n=r=>`'${Iue(r)}'`;switch(t===void 0?zue(e):t.startsWith("filter<")?"filter":t){case"filter":return`f${n(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=LP(e);return r&&`@${r}`}case"timestamp":{const r=LP(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 zue(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 LP(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 Fue="[A-Za-z_][A-Za-z0-9_]*",zP=e=>new RegExp(`^${Fue}$`).test(e),Fhe=e=>e.findIndex(t=>t.trimStart().startsWith("##")&&t.includes("artifact"));function Bue(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 FP=()=>typeof performance<"u"?performance.now():Date.now(),kL=200;function Uue(e){const t=Lue(e.rawValue);if(t!==void 0)return`run: ${e.source} -> { drill: ${e.view}.${e.field} = ${t}; select: *; limit: ${kL} }`}function Lk(e){const t=Bue(e);if(!(!t||t.refinement!==void 0||!zP(t.source)||!zP(t.view)))return{source:t.source,view:t.view}}const _ue=e=>Lk(e)?.source;function Vue({request:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:a,onClose:s,onDone:l}){const{theme:d}=ol(),f=e?Uue(e):void 0;return h.jsxs(Yf,{open:e!==void 0,onClose:s,maxWidth:"lg",fullWidth:!0,children:[h.jsxs(Gf,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",pb:.5},children:[h.jsxs(Kt,{children:[e?h.jsxs(h.Fragment,{children:["Rows where"," ",h.jsx(Kt,{component:"code",sx:{fontSize:"0.9em"},children:e.field})," ","is ",e.label]}):"Rows",h.jsx(Lt,{component:"div",variant:"caption",sx:{color:d.tileTitle,mt:.25},children:e?`The first ${kL} rows of ${e.source} behind this value, with the tile's own filters and the controls applied.`:""})]}),h.jsx(eo,{onClick:s,"aria-label":"Close",size:"small",sx:{color:"text.secondary",ml:1},children:h.jsx(Jf,{fontSize:"small"})})]}),h.jsxs(Kf,{dividers:!0,sx:{p:0,minHeight:240},children:[f===void 0&&e&&h.jsx(Lt,{variant:"body2",sx:{p:2},children:"This value cannot be written as a filter, so its rows cannot be fetched."}),f!==void 0&&h.jsx(Hue,{query:f,environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:o,givens:a,...l?{onDone:l}:{}})]}),h.jsxs(fj,{sx:{px:3,py:1.5},children:[f!==void 0&&h.jsx(Lt,{variant:"caption",sx:{mr:"auto",color:d.tileTitle,fontFamily:"ui-monospace, monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:f,children:f}),h.jsx(Ko,{onClick:s,children:"Close"})]})]})}function Hue({query:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:a,onDone:s}){const l=Dk({environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r},query:e,givens:a}),{isSuccess:d,isError:f}=l,c=C.useRef(void 0);return C.useEffect(()=>{c.current=FP()},[e]),C.useEffect(()=>{c.current===void 0||!d&&!f||(s?.(d,FP()-c.current),c.current=void 0)},[d,f,s]),h.jsx(Kt,{sx:{p:1},children:h.jsx(jk,{state:l,context:e})})}function Wue({tile:e,environmentName:t,packageName:n,versionId:r,modelPath:o,onClose:a}){const s=u0({environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r}}),{data:l}=Nk(s,e!==void 0),d=C.useMemo(()=>{const c=_ue(e);if(!l||c===void 0)return 0;const m=(l.sourceInfos??[]).findIndex(y=>{try{return JSON.parse(y)?.name===c}catch{return!1}});return m<0?0:m},[l,e]),f=C.useMemo(()=>{if(e===void 0)return;const c=Lk(e),m=c?{definition:{kind:"arrow",source:{kind:"source_reference",name:c.source},view:{kind:"view_reference",name:c.view}}}:`run: ${e}`;return{query:`run: ${e}`,malloyQuery:m,malloyResult:void 0}},[e]);return e===void 0||!l?null:h.jsx(Ik,{open:!0,onClose:a,resourceUri:s,data:l,title:`Explore: ${e}`,existingQuery:f,initialSelectedSourceIndex:d})}function Bhe({resourceUri:e,dashboard:t,givens:n,onGivensChange:r,onNavigate:o,height:a,maxResultSize:s,onEvent:l}){const d=xo(e),{apiClients:f}=zr(),c=d.environmentName??"",m=d.packageName??"",y=d.versionId,b=!!d.environmentName&&!!d.packageName,{data:v,isSuccess:x,isError:w,error:S}=co({queryKey:["dashboard",c,m,y,t],queryFn:()=>f.dashboards.getDashboard(c,m,t,y),enabled:b}),T=v?.data,M=C.useMemo(()=>T?.givens??[],[T]),R=JN({specs:M,loaded:x,startingValues:T?.startingGivens,params:n,onGivensChange:r,documentKey:`${c}/${m}/${y??""}/${t}`,autorun:T?.autorun!==!1,environmentName:c,packageName:m,modelPath:T?.path,versionId:y,documentName:t}),{applied:$,declaredTypes:P,canSelf:N,onSelf:V}=R,[z,W]=C.useState(void 0),[H,k]=C.useState(void 0),I=C.useCallback(G=>{const ne=Lk(G.context);ne!==void 0&&W({...ne,field:G.field,rawValue:G.rawValue,label:G.label})},[]),F=C.useMemo(()=>c0($,P),[$,P]),{drill:_,drillMenu:j}=eI({onNavigate:o,onSelf:V,canSelf:N,selfLabel:"Filter this dashboard",onRows:I}),X=C.useCallback(G=>({canDrill:_.canDrill,onClick:ne=>_.onClick({...ne,context:G})}),[_]);if(!b)return h.jsxs($c,{severity:"error",children:["A dashboard resource URI must name an environment and a package. Received: ",e]});if(w)return h.jsx(ha,{context:`${c} > ${m} > ${t}`,error:S});if(!x||!T)return h.jsx(oa,{text:"Loading dashboard…"});if(T.error)return h.jsxs(fr,{spacing:2,children:[h.jsx(BP,{manifest:T}),h.jsx($c,{severity:"error",children:T.error})]});const Q=T.path,te=T.tiles??[],Z=T.dashboardColumns??Wce;return h.jsxs(fr,{spacing:2,children:[h.jsx(BP,{manifest:T}),h.jsx(xL,{...R.panel,layout:"bar"}),Q===void 0?h.jsx($c,{severity:"error",children:"This dashboard has no model path, so there is nothing to run."}):T.query!==void 0?h.jsx($P,{environmentName:c,packageName:m,versionId:y,modelPath:Q,queryName:T.query,givens:$,declaredTypes:P,height:a,maxResultSize:s,drill:_}):te.length>0?h.jsx(Kce,{tiles:te,columns:Z,keyOf:(G,ne)=>`${ne}:${G.query}`,renderTile:G=>h.jsx($P,{environmentName:c,packageName:m,versionId:y,modelPath:Q,tile:G.query,label:G.label,subtitle:G.subtitle,borderless:G.borderless,givens:$,declaredTypes:P,givenNames:G.givenNames,height:a??zce,maxResultSize:s,drill:X(G.query),onExplore:()=>{k(G.query),l?.({type:"dashboard.explored",tile:G.query})}})}):h.jsx($c,{severity:"warning",children:"This dashboard names neither a query nor any tiles."}),j,Q!==void 0&&h.jsxs(h.Fragment,{children:[h.jsx(Vue,{request:z,environmentName:c,packageName:m,...y===void 0?{}:{versionId:y},modelPath:Q,givens:F,onClose:()=>W(void 0),onDone:(G,ne)=>{z&&l?.({type:"dashboard.rows_shown",source:z.source,view:z.view,field:z.field,ok:G,durationMs:ne})}}),h.jsx(Wue,{tile:H,environmentName:c,packageName:m,...y===void 0?{}:{versionId:y},modelPath:Q,onClose:()=>k(void 0)})]})]})}function BP({manifest:e}){return h.jsx(que,{title:e.title??e.name,...e.description?{description:e.description}:{}})}function que({title:e,description:t}){return h.jsxs(Kt,{children:[h.jsx(Lt,{variant:"h5",sx:{fontWeight:600},children:e}),t&&h.jsx(ab,{variant:"caption",children:t})]})}const Yue=cr(h.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),TL=C.createContext(void 0);function Kue({children:e,documentStorage:t}){const n=C.useMemo(()=>({documentStorage:t}),[t]);return h.jsx(TL.Provider,{value:n,children:e})}function Gue(){return C.useContext(TL)}class ML extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const Uhe=e=>e instanceof ML||e instanceof Error&&e.name==="DocumentNotFoundError",Que=cr(h.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}));function EL({label:e,href:t,onClick:n}){return h.jsxs(a9,{...t===void 0?{component:"button",type:"button"}:{href:t},onClick:r=>{const o=r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.button!==0;t!==void 0&&o||(r.preventDefault(),n(r))},underline:"none","aria-label":`Back to ${e}`,sx:{display:"inline-flex",alignItems:"center",gap:.5,cursor:"pointer",color:"text.secondary",fontSize:"0.875rem",mb:2,border:0,p:0,background:"none",font:"inherit","&:hover":{color:"primary.main"}},children:[h.jsx(Que,{sx:{fontSize:18}}),"Back to ",e]})}function _he(){const e=eg();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 Vhe(){const[e]=k4(),t=eg(),n=tl(),r=C.useMemo(()=>Object.fromEntries(e.entries()),[e]),o=C.useRef(new Set),a=C.useCallback((s,l)=>{const d=new Set([...l,...o.current]);o.current=new Set([...o.current,...Object.keys(s),...l]);const f=new URLSearchParams(n.search);for(const c of d)Object.prototype.hasOwnProperty.call(s,c)||f.delete(c);for(const[c,m]of Object.entries(s))f.set(c,m);t({search:f.toString(),hash:n.hash},{replace:!0})},[t,n]);return{params:r,onGivensChange:a}}const OL=cr(h.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"})),Xue="publisher:resize";function Zue(e){return typeof e=="object"&&e!==null&&e.type===Xue&&typeof e.height=="number"}function RL(e){return e.replace(/\/api\/v0\/?$/,"")}function Jue({server:e,environmentName:t,packageName:n,path:r}){const o=r.startsWith("public/")?r.slice(7):r;return`${RL(e)}/environments/${encodeURIComponent(t)}/packages/${encodeURIComponent(n)}/`+o}function ede(e){try{const{environmentName:t,packageName:n,modelPath:r}=xo(e);return!t||!n||!r?null:{environmentName:t,packageName:n,dataAppPath:r}}catch{return null}}function Hhe({resourceUri:e}){const{server:t,apiClients:n}=zr(),r=ede(e),o=r?.environmentName??"",a=r?.packageName??"",s=r?.dataAppPath??"",l=C.useMemo(()=>Jue({server:t,environmentName:o,packageName:a,path:s}),[t,o,a,s]),d=co({queryKey:["data-apps",o,a],queryFn:()=>n.dataApps.listDataApps(o,a),enabled:!!r}).data?.data?.find(v=>v.path===s),f=d?.title??s,c=d?.fit==="viewport",m=C.useRef(null),[y,b]=C.useState(120);return C.useEffect(()=>{if(c)return;function v(x){Zue(x.data)&&x.source===m.current?.contentWindow&&x.data.height>0&&b(Math.ceil(x.data.height))}return window.addEventListener("message",v),()=>window.removeEventListener("message",v)},[c]),r?h.jsxs(Kt,{sx:{p:3,...c?{height:"100%",display:"flex",flexDirection:"column"}:{maxWidth:1200,mx:"auto"}},children:[h.jsxs(fr,{direction:"row",alignItems:"baseline",spacing:1,sx:{mb:1,flexShrink:0},children:[h.jsx(Lt,{variant:"h6",sx:{fontWeight:600,letterSpacing:"-0.025em"},children:f}),h.jsx(Lt,{variant:"caption",color:"text.secondary",sx:{fontFamily:Ai},children:s}),h.jsx(Kt,{sx:{flex:1}}),h.jsx(Ui,{title:"Open standalone in new tab",children:h.jsx(eo,{size:"small",href:l,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",sx:{color:"text.secondary"},children:h.jsx(OL,{fontSize:"small"})})})]}),h.jsx(Kt,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,overflow:"hidden",backgroundColor:"background.paper",...c?{flex:1,minHeight:0}:{}},children:h.jsx("iframe",{ref:m,src:l,title:f,sandbox:"allow-scripts allow-same-origin allow-forms",style:{display:"block",width:"100%",height:c?"100%":y,border:0}})})]}):h.jsxs(Kt,{sx:{p:3,maxWidth:1200,mx:"auto"},children:[h.jsx(Lt,{variant:"h6",sx:{fontWeight:600},children:"Can't open data app"}),h.jsxs(Lt,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["This data app link is missing an environment, package, or path:",h.jsx(Kt,{component:"span",sx:{fontFamily:Ai,ml:1},children:e})]})]})}function us({title:e,count:t,description:n,action:r,children:o}){const a=C.useId();return h.jsxs(Kt,{component:"section","aria-labelledby":a,sx:{mb:4},children:[h.jsxs(fr,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:n?0:1,minHeight:40},children:[h.jsxs(fr,{direction:"row",alignItems:"baseline",spacing:1,children:[h.jsx(Lt,{id:a,variant:"h6",sx:{fontWeight:600,letterSpacing:"-0.025em",lineHeight:1.2},children:e}),t!==void 0&&h.jsxs(Lt,{variant:"caption",color:"text.secondary",children:["(",t,")"]})]}),r]}),n&&h.jsx(Lt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:n}),h.jsx(Kt,{children:o})]})}function tde({resourceUri:e}){const{environmentName:t}=xo(e),{apiClients:n}=zr(),[r,o]=C.useState(!1),a=90,{data:s,isSuccess:l,isError:d,error:f}=co({queryKey:["about",t],queryFn:()=>n.environments.getEnvironment(t,!1)}),c=s?.data?.readme||"",m=c.split(/\s+/),y=m.length>a,b=m.slice(0,a).join(" ");return h.jsxs(h.Fragment,{children:[!l&&!d&&h.jsx(oa,{text:"Fetching About..."}),l&&c&&h.jsxs(us,{title:"Readme",children:[h.jsx(ab,{variant:"caption",children:r||!y?c:b}),y&&h.jsx(Kt,{sx:{mt:1},children:h.jsx(Sg,{label:r?"Read less":"Read more",onClick:()=>o(!r)})})]}),d&&h.jsx(ha,{error:f,context:`${t} > About`})]})}function nde(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:a}=e,s=ak();C.useEffect(()=>{if(!o)return;function w(S){S.defaultPrevented||S.key==="Escape"&&r?.(S,"escapeKeyDown")}return document.addEventListener("keydown",w),()=>{document.removeEventListener("keydown",w)}},[o,r]);const l=It((w,S)=>{r?.(w,S)}),d=It(w=>{!r||w==null||s.start(w,()=>{l(null,"timeout")})});C.useEffect(()=>(o&&d(t),s.clear),[o,t,d,s]);const f=w=>{r?.(w,"clickaway")},c=s.clear,m=C.useCallback(()=>{t!=null&&d(a??t*.5)},[t,a,d]),y=w=>S=>{const T=w.onBlur;T?.(S),m()},b=w=>S=>{const T=w.onFocus;T?.(S),c()},v=w=>S=>{const T=w.onMouseEnter;T?.(S),c()},x=w=>S=>{const T=w.onMouseLeave;T?.(S),m()};return C.useEffect(()=>{if(!n&&o)return window.addEventListener("focus",m),window.addEventListener("blur",c),()=>{window.removeEventListener("focus",m),window.removeEventListener("blur",c)}},[n,o,m,c]),{getRootProps:(w={})=>{const S={...Qv(e),...Qv(w)};return{role:"presentation",...w,...S,onBlur:y(S),onFocus:b(S),onMouseEnter:v(S),onMouseLeave:x(S)}},onClickAway:f}}function UP(e){return e.substring(2).toLowerCase()}function rde(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function ode(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:a="onTouchEnd"}=e,s=C.useRef(!1),l=C.useRef(null),d=C.useRef(!1),f=C.useRef(!1);C.useEffect(()=>(setTimeout(()=>{d.current=!0},0),()=>{d.current=!1}),[]);const c=mr(gp(t),l),m=It(v=>{const x=f.current;f.current=!1;const w=$o(l.current);if(!d.current||!l.current||"clientX"in v&&rde(v,w))return;if(s.current){s.current=!1;return}let S;v.composedPath?S=v.composedPath().includes(l.current):S=!w.documentElement.contains(v.target)||l.current.contains(v.target),!S&&(n||!x)&&o(v)}),y=v=>x=>{f.current=!0;const w=t.props[v];w&&w(x)},b={ref:c};return a!==!1&&(b[a]=y(a)),C.useEffect(()=>{if(a!==!1){const v=UP(a),x=$o(l.current),w=()=>{s.current=!0};return x.addEventListener(v,m),x.addEventListener("touchmove",w),()=>{x.removeEventListener(v,m),x.removeEventListener("touchmove",w)}}},[m,a]),r!==!1&&(b[r]=y(r)),C.useEffect(()=>{if(r!==!1){const v=UP(r),x=$o(l.current);return x.addEventListener(v,m),()=>{x.removeEventListener(v,m)}}},[m,r]),C.cloneElement(t,b)}function ade(e){return on("MuiSnackbarContent",e)}Gt("MuiSnackbarContent",["root","message","action"]);const ide=e=>{const{classes:t}=e;return tn({root:["root"],action:["action"],message:["message"]},ade,t)},sde=Ge(hd,{name:"MuiSnackbarContent",slot:"Root"})(Vn(({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(ew(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:ew(e.palette.background.default,t),display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}}})),lde=Ge("div",{name:"MuiSnackbarContent",slot:"Message"})({padding:"8px 0"}),cde=Ge("div",{name:"MuiSnackbarContent",slot:"Action"})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),ude=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:a,role:s="alert",...l}=n,d=n,f=ide(d);return h.jsxs(sde,{role:s,elevation:6,className:jt(f.root,o),ownerState:d,ref:t,...l,children:[h.jsx(lde,{className:f.message,ownerState:d,children:a}),r?h.jsx(cde,{className:f.action,ownerState:d,children:r}):null]})});function dde(e){return on("MuiSnackbar",e)}Gt("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const fde=e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${Tt(n.vertical)}${Tt(n.horizontal)}`]};return tn(r,dde,t)},pde=Ge("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${Tt(n.anchorOrigin.vertical)}${Tt(n.anchorOrigin.horizontal)}`]]}})(Vn(({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%)"}}}]}))),hde=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiSnackbar"}),r=fd(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:a,anchorOrigin:{vertical:s,horizontal:l}={vertical:"bottom",horizontal:"left"},autoHideDuration:d=null,children:f,className:c,ClickAwayListenerProps:m,ContentProps:y,disableWindowBlurListener:b=!1,message:v,onBlur:x,onClose:w,onFocus:S,onMouseEnter:T,onMouseLeave:M,open:R,resumeHideDuration:$,slots:P={},slotProps:N={},TransitionComponent:V,transitionDuration:z=o,TransitionProps:{onEnter:W,onExited:H,...k}={},...I}=n,F={...n,anchorOrigin:{vertical:s,horizontal:l},autoHideDuration:d,disableWindowBlurListener:b,TransitionComponent:V,transitionDuration:z},_=fde(F),{getRootProps:j,onClickAway:X}=nde({...F}),[Q,te]=C.useState(!0),Z=$e=>{te(!0),H&&H($e)},G=($e,de)=>{te(!1),W&&W($e,de)},ne={slots:{transition:V,...P},slotProps:{content:y,clickAwayListener:m,transition:k,...N}},[se,pe]=ir("root",{ref:t,className:[_.root,c],elementType:pde,getSlotProps:j,externalForwardedProps:{...ne,...I},ownerState:F}),[oe,{ownerState:ae,...ce}]=ir("clickAwayListener",{elementType:ode,externalForwardedProps:ne,getSlotProps:$e=>({onClickAway:(...de)=>{const ke=de[0];$e.onClickAway?.(...de),!ke?.defaultMuiPrevented&&X(...de)}}),ownerState:F}),[ge,ye]=ir("content",{elementType:ude,shouldForwardComponentProp:!0,externalForwardedProps:ne,additionalProps:{message:v,action:a},ownerState:F}),[we,Ce]=ir("transition",{elementType:Ym,externalForwardedProps:ne,getSlotProps:$e=>({onEnter:(...de)=>{$e.onEnter?.(...de),G(...de)},onExited:(...de)=>{$e.onExited?.(...de),Z(...de)}}),additionalProps:{appear:!0,in:R,timeout:z,direction:s==="top"?"down":"up"},ownerState:F});return!R&&Q?null:h.jsx(oe,{...ce,...P.clickAwayListener&&{ownerState:ae},children:h.jsx(se,{...pe,children:h.jsx(we,{...Ce,children:f||h.jsx(ge,{...ye})})})})});let Tw;function mde(e){Tw=e}function _P(e){if(Tw)try{Tw(e)}catch{}}function Pl(e,t,n){return(async r=>{const o=Date.now();try{const a=await n(r);return _P({type:"console.mutation",resource:e,action:t,ok:!0,durationMs:Date.now()-o}),a}catch(a){throw _P({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 yp({mutationFn:e,success:t,invalidates:n,closeDialog:r,resource:o,action:a}){const s=dd(),[l,d]=C.useState(""),f=Ws({mutationFn:Pl(o,a,e),onSuccess(){r();for(const c of n)s.invalidateQueries({queryKey:c});d(t)},onError(c){d(c instanceof Error?c.message:"An unknown error occurred")}});return{mutate:f.mutate,isPending:f.isPending,notice:h.jsx(hde,{open:l!=="",autoHideDuration:6e3,onClose:()=>d(""),message:l})}}const $L="https://docs.malloydata.dev/documentation",VP=`${$L}/user_guides/publishing`,nv="https://github.com/malloydata/publisher/blob/main/docs",kc={docsHome:`${$L}/`,publishing:`${VP}/publishing`,mcpAgents:`${VP}/mcp_agents`,surfaces:`${nv}/choosing-a-surface.md`,givens:`${nv}/givens.md`,materialization:`${nv}/materialization.md`,connections:`${nv}/connections.md`};function gde({resourceUri:e}){const[t,n]=C.useState(!1),{apiClients:r}=zr(),{environmentName:o}=xo(e),a=yp({mutationFn(l){return r.packages.createPackage(o,{name:l.name,description:l.description,location:l.location})},success:"Package created",invalidates:[["packages",o]],closeDialog:()=>n(!1),resource:"package",action:"create"}),s=l=>{l.preventDefault();const d=new FormData(l.currentTarget),f=d.get("name")?.toString(),c=d.get("description")?.toString(),m=d.get("location")?.toString();a.mutate({name:f,description:c,location:m})};return h.jsxs(h.Fragment,{children:[h.jsx(xg,{label:"Package",onClick:()=>n(!0)}),h.jsx(aa,{open:t,onClose:()=>n(!1),title:"New package",description:h.jsxs(h.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"," ",h.jsx(Kt,{component:"a",href:kc.publishing,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary"},children:"package format"}),"."]}),actions:h.jsxs(h.Fragment,{children:[h.jsx(Ko,{disabled:a.isPending,onClick:()=>n(!1),children:"Cancel"}),h.jsx(Ko,{type:"submit",form:"package-form",variant:"contained",loading:a.isPending,children:"Create package"})]}),children:h.jsx("form",{onSubmit:s,id:"package-form",children:h.jsxs(fr,{sx:{gap:2},children:[h.jsx(ii,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),h.jsx(ii,{id:"description",name:"description",label:"Description",multiline:!0,rows:3,fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),h.jsx(ii,{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 yde=cr(h.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}));function C0({icon:e,tint:t,label:n,mono:r,description:o,rightLabel:a,trailingAction:s,onClick:l,ariaLabel:d}){const f=!!l;return h.jsxs(Kt,{onClick:l,onKeyDown:f?c=>{l&&(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),l(c))}:void 0,role:f?"button":void 0,tabIndex:f?0:void 0,"aria-label":d,sx:c=>({display:"flex",alignItems:"center",gap:1.5,py:1,px:1,mx:-1,cursor:f?"pointer":"default",borderRadius:1.5,transition:"background-color 0.1s","&:hover":f?{backgroundColor:c.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}:void 0,"&:focus-visible":f?{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}:void 0}),children:[h.jsx(Kt,{sx:{width:32,height:32,borderRadius:1,bgcolor:t,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e}),h.jsxs(Kt,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"baseline",gap:1.5},children:[h.jsx(Lt,{variant:"body2",sx:{...r?{fontFamily:Ai}:{},flexShrink:0,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),o&&h.jsx(Lt,{variant:"body2",color:"text.secondary",sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o})]}),a&&h.jsx(Lt,{variant:"caption",color:"text.secondary",sx:{flexShrink:0},children:a}),s&&h.jsx(Kt,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:s})]})}const PL=cr(h.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"})),vde=Gt("MuiBox",["root"]),bde=FN(),Ma=rC({themeId:mp,defaultTheme:bde,defaultClassName:vde.root,generateClassName:TN.generate}),k0=uC({createStyledComponent:Ge("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>Hn({props:e,name:"MuiStack"})}),HP=Gt("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);function xde(e){return on("MuiListItemIcon",e)}const WP=Gt("MuiListItemIcon",["root","alignItemsFlexStart"]),Sde=e=>{const{alignItems:t,classes:n}=e;return tn({root:["root",t==="flex-start"&&"alignItemsFlexStart"]},xde,n)},wde=Ge("div",{name:"MuiListItemIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.alignItems==="flex-start"&&t.alignItemsFlexStart]}})(Vn(({theme:e})=>({minWidth:56,color:(e.vars||e).palette.action.active,flexShrink:0,display:"inline-flex",variants:[{props:{alignItems:"flex-start"},style:{marginTop:8}}]}))),zk=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiListItemIcon"}),{className:r,...o}=n,a=C.useContext(Al),s={...n,alignItems:a.alignItems},l=Sde(s);return h.jsx(wde,{className:jt(l.root,r),ownerState:s,ref:t,...o})});function Cde(e){return on("MuiListItemText",e)}const Df=Gt("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]),kde=e=>{const{classes:t,inset:n,primary:r,secondary:o,dense:a}=e;return tn({root:["root",n&&"inset",a&&"dense",r&&o&&"multiline"],primary:["primary"],secondary:["secondary"]},Cde,t)},Tde=Ge("div",{name:"MuiListItemText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Df.primary}`]:t.primary},{[`& .${Df.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,[`.${U$.root}:where(& .${Df.primary})`]:{display:"block"},[`.${U$.root}:where(& .${Df.secondary})`]:{display:"block"},variants:[{props:({ownerState:e})=>e.primary&&e.secondary,style:{marginTop:6,marginBottom:6}},{props:({ownerState:e})=>e.inset,style:{paddingLeft:56}}]}),Fk=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiListItemText"}),{children:r,className:o,disableTypography:a=!1,inset:s=!1,primary:l,primaryTypographyProps:d,secondary:f,secondaryTypographyProps:c,slots:m={},slotProps:y={},...b}=n,{dense:v}=C.useContext(Al);let x=l??r,w=f;const S={...n,disableTypography:a,inset:s,primary:!!x,secondary:!!w,dense:v},T=kde(S),M={slots:m,slotProps:{primary:d,secondary:c,...y}},[R,$]=ir("root",{className:jt(T.root,o),elementType:Tde,externalForwardedProps:{...M,...b},ownerState:S,ref:t}),[P,N]=ir("primary",{className:T.primary,elementType:br,externalForwardedProps:M,ownerState:S}),[V,z]=ir("secondary",{className:T.secondary,elementType:br,externalForwardedProps:M,ownerState:S});return x!=null&&x.type!==br&&!a&&(x=h.jsx(P,{variant:v?"body2":"body1",component:N?.variant?void 0:"span",...N,children:x})),w!=null&&w.type!==br&&!a&&(w=h.jsx(V,{variant:"body2",color:"textSecondary",...z,children:w})),h.jsxs(R,{...$,children:[x,w]})});function Mde(e){return on("MuiMenuItem",e)}const Kh=Gt("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]),Ede=(e,t)=>{const{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},Ode=e=>{const{disabled:t,dense:n,divider:r,disableGutters:o,selected:a,classes:s}=e,l=tn({root:["root",n&&"dense",t&&"disabled",!o&&"gutters",r&&"divider",a&&"selected"]},Mde,s);return{...s,...l}},Rde=Ge(od,{shouldForwardProp:e=>La(e)||e==="classes",name:"MuiMenuItem",slot:"Root",overridesResolver:Ede})(Vn(({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"}},[`&.${Kh.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${Kh.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${Kh.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)}},[`&.${Kh.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Kh.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${HP.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${HP.inset}`]:{marginLeft:52},[`& .${Df.root}`]:{marginTop:0,marginBottom:0},[`& .${Df.inset}`]:{paddingLeft:36},[`& .${WP.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,[`& .${WP.root} svg`]:{fontSize:"1.25rem"}}}]}))),qo=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiMenuItem"}),{autoFocus:r=!1,component:o="li",dense:a=!1,divider:s=!1,disableGutters:l=!1,focusVisibleClassName:d,role:f="menuitem",tabIndex:c,className:m,...y}=n,b=C.useContext(Al),v=C.useMemo(()=>({dense:a||b.dense||!1,disableGutters:l}),[b.dense,a,l]),x=C.useRef(null);Po(()=>{r&&x.current&&x.current.focus()},[r]);const w={...n,dense:v.dense,divider:s,disableGutters:l},S=Ode(n),T=mr(x,t);let M;return n.disabled||(M=c!==void 0?c:-1),h.jsx(Al.Provider,{value:v,children:h.jsx(Rde,{ref:T,role:f,tabIndex:M,component:o,focusVisibleClassName:jt(S.focusVisible,d),className:jt(S.root,m),...y,ownerState:w,classes:S})})}),Dl={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}],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}],duckdb:[],motherduck:[{label:"Access Token",name:"accessToken",type:"text",required:!0},{label:"Database",name:"database",type:"text",required:!1}],ducklake:[],publisher:[]},hm={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",trino:"trinoConnection",databricks:"databricksConnection",mysql:"mysqlConnection",duckdb:"duckdbConnection",motherduck:"motherduckConnection",ducklake:"ducklakeConnection",publisher:"publisherConnection"},DL=Object.values(vR).filter(e=>e!==vR.Publisher),Mw={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",gcs:"gcsConnection",s3:"s3Connection",azure:"azureConnection"},Xm=[{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"}}],Zm=[{label:"Key ID",name:"keyId",type:"text",required:!0},{label:"Secret",name:"secret",type:"password",required:!0}],$de=[{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 ib(e){return e==="postgres"||e==="bigquery"||e==="snowflake"?Dl[e]||[]:e==="s3"?Xm:e==="gcs"?Zm:e==="azure"?$de:[]}function Pde({onSubmit:e,isSubmitting:t}){const[n,r]=C.useState(!1),[o,a]=C.useState("postgres"),[s,l]=C.useState([]),[d,f]=C.useState("postgres"),[c,m]=C.useState("s3"),[y,b]=C.useState("config"),v=()=>{r(!0)},x=()=>{r(!1),l([]),a("postgres"),f("postgres"),m("s3"),b("config")},w=async R=>{R.preventDefault();const $=new FormData(R.currentTarget),P=$.get("name")?.toString(),N=$.get("type")?.toString(),V=Dl[N];if(!P)throw new Error("Name is required");if(!N)throw new Error("Type is required");let z;if(N==="ducklake"){const W={};if(d==="postgres"){const I=Dl.postgres,F={};if(I.forEach(_=>{const j=$.get(`ducklake_pg_${_.name}`)?.toString();j&&(F[_.name]=j)}),Object.keys(F).length===0)throw new Error("DuckLake requires catalog connection");W.postgresConnection=F}const H=$.get("ducklake_bucketUrl")?.toString();if(!H)throw new Error("DuckLake requires a bucket URL");const k={bucketUrl:H};if(c==="s3"){const I={};if(Xm.forEach(F=>{const _=$.get(`ducklake_s3_${F.name}`)?.toString();_&&(I[F.name]=_)}),I.provider==="credential_chain")delete I.accessKeyId,delete I.secretAccessKey,delete I.sessionToken;else{if(delete I.chain,!I.accessKeyId)throw new Error("S3 Access Key ID is required");if(!I.secretAccessKey)throw new Error("S3 Secret Access Key is required")}Object.keys(I).length>0&&(k.s3Connection=I)}else if(c==="gcs"){const I={};if(Zm.forEach(F=>{const _=$.get(`ducklake_gcs_${F.name}`)?.toString();_&&(I[F.name]=_)}),!I.keyId)throw new Error("GCS Key ID is required");if(!I.secret)throw new Error("GCS Secret is required");Object.keys(I).length>0&&(k.gcsConnection=I)}z={name:P,type:N,ducklakeConnection:{catalog:W,storage:k}}}else if(N==="duckdb"){if(s.length===0)throw new Error("DuckDB connection must have at least one attached database");const W=s.map((H,k)=>{const I=H.dbType,F=$.get(`attachedDb_${k}_name`)?.toString();if(!F)throw new Error(`Attached database at index ${k} must have a name`);const _={name:F,type:I},j=ib(I);if(j&&j.length>0){const X={};if(j.forEach(te=>{const Z=$.get(`attachedDb_${k}_${te.name}`)?.toString();Z&&(X[te.name]=Z)}),I==="s3"){if(X.provider==="credential_chain")delete X.accessKeyId,delete X.secretAccessKey,delete X.sessionToken;else if(delete X.chain,!X.accessKeyId||!X.secretAccessKey)throw new Error(`Attached database "${F}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`)}const Q=Mw[I];Q&&(_[Q]=X)}return _});z={name:P,type:N,duckdbConnection:{attachedDatabases:W}}}else{const W={};if(V.forEach(H=>{const k=$.get(H.name)?.toString();k&&(W[H.name]=k)}),N==="postgres"){if(!W.connectionString?.trim()){const H=["host","port","databaseName","userName","password"];for(const k of H)if(!W[k])throw new Error(`${V.find(I=>I.name===k)?.label||k} is required`)}}else if(N==="bigquery"){if(!W.serviceAccountKeyJson)throw new Error("Service Account Key JSON is required")}else if(N==="snowflake"){if(!W.account)throw new Error("Account is required");if(!W.username)throw new Error("Username is required");if(!W.warehouse)throw new Error("Warehouse is required");if(!W.password&&!W.privateKey)throw new Error("Either password or private key is required")}else if(N==="trino"){if(!W.server)throw new Error("Server is required");if(!W.user)throw new Error("User is required");if(W.server.trim().startsWith("https://")&&!W.password&&!W.peakaKey)throw new Error("Password is required for HTTPS connections (or use Peaka Key)")}else if(N==="mysql"){const H=["host","port","database","user","password"];for(const k of H)if(!W[k])throw new Error(`${V.find(I=>I.name===k)?.label||k} is required`)}else if(N==="motherduck"){if(!W.accessToken)throw new Error("Access Token is required")}else if(N==="databricks"){if(!W.host)throw new Error("Host is required");if(!W.path)throw new Error("HTTP Path is required");const H=W.oauthClientId&&W.oauthClientSecret;if(!W.token&&!H)throw new Error("Either Access Token or OAuth Client ID + Secret is required")}z={name:P,type:N,[hm[N]]:W}}await e(z),x()},S=()=>{l([...s,{name:"",dbType:"postgres"}])},T=R=>{l(s.filter(($,P)=>P!==R))},M=(R,$)=>{const P=[...s];P[R]={...P[R],dbType:$},l(P)};return h.jsxs(pn.Fragment,{children:[h.jsx(xg,{label:"Connection",onClick:v}),h.jsx(aa,{open:n,onClose:x,title:"New connection",description:"Add a connection so packages in this environment can query your database with Malloy.",actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{disabled:t,onClick:x,children:"Cancel"}),h.jsx(uo,{type:"submit",form:"connection-form",variant:"contained",loading:t,children:"Create connection"})]}),children:h.jsx("form",{onSubmit:w,id:"connection-form",children:h.jsxs(k0,{sx:{gap:2},children:[h.jsx(hr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small"}),h.jsx(hr,{id:"type",name:"type",label:"Connection Type",fullWidth:!0,size:"small",value:o,select:!0,onChange:R=>a(R.target.value),children:DL.map(R=>h.jsx(qo,{value:R,children:R},R))}),o==="ducklake"?h.jsxs(Ma,{sx:{mt:2},children:[h.jsxs(Ma,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[h.jsx(br,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Catalog"}),h.jsx(hr,{id:"ducklake_catalogType",label:"Catalog Type",fullWidth:!0,size:"small",value:d,select:!0,onChange:R=>f(R.target.value),children:h.jsx(qo,{value:"postgres",children:"PostgreSQL"})}),d==="postgres"&&h.jsx(h.Fragment,{children:Dl.postgres.map(R=>h.jsx(hr,{id:`ducklake_pg_${R.name}`,name:`ducklake_pg_${R.name}`,label:R.label,type:R.type,fullWidth:!0,size:"small"},`pg_${R.name}`))})]}),h.jsxs(Ma,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[h.jsx(br,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Storage"}),h.jsxs(hr,{id:"ducklake_storageType",label:"Storage Type",fullWidth:!0,size:"small",value:c,select:!0,onChange:R=>m(R.target.value),children:[h.jsx(qo,{value:"s3",children:"S3"}),h.jsx(qo,{value:"gcs",children:"GCS"})]}),h.jsx(hr,{required:!0,id:"ducklake_bucketUrl",name:"ducklake_bucketUrl",label:c==="s3"?"Bucket URL (e.g. s3://my-bucket/path)":"Bucket URL (e.g. gs://my-bucket/path)",type:"text",fullWidth:!0,size:"small"}),c==="s3"&&h.jsxs(h.Fragment,{children:[h.jsx(br,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),Xm.filter(R=>R.visibleWhen?y===R.visibleWhen.value:!0).map(R=>h.jsx(hr,{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?y:void 0,onChange:R.name==="provider"?$=>b($.target.value):void 0,placeholder:R.name==="region"?"us-east-1":void 0,children:R.selectOptions?.map($=>h.jsx(qo,{value:$.value,children:$.label},$.value))},`s3_${R.name}`))]}),c==="gcs"&&h.jsxs(h.Fragment,{children:[h.jsx(br,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Zm.map(R=>h.jsx(hr,{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"?h.jsxs(Ma,{sx:{mt:2},children:[h.jsxs(Ma,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[h.jsx(br,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),h.jsx(Sg,{label:"Database",icon:h.jsx(tk,{}),onClick:S,ariaLabel:"Add database"})]}),s.length===0&&h.jsx(br,{variant:"body2",color:"text.secondary",sx:{mb:2},children:'DuckDB connections require at least one attached database. Click "Add Database" to get started.'}),s.map((R,$)=>{const P=ib(R.dbType);return h.jsxs(Ma,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[h.jsxs(Ma,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[h.jsxs(br,{variant:"subtitle2",children:["Database ",$+1]}),h.jsx(Gc,{onClick:()=>T($),size:"small",color:"error",children:h.jsx(PL,{fontSize:"small"})})]}),h.jsx(hr,{required:!0,id:`attachedDb_${$}_name`,name:`attachedDb_${$}_name`,label:"Database Name",type:"text",fullWidth:!0,size:"small",defaultValue:R.name}),h.jsx(hr,{id:`attachedDb_${$}_type`,name:`attachedDb_${$}_type`,label:"Database Type",fullWidth:!0,size:"small",value:R.dbType,select:!0,onChange:N=>M($,N.target.value),children:Object.values(mN).map(N=>h.jsx(qo,{value:N,children:N},N))}),P.filter(N=>N.visibleWhen?(R[N.visibleWhen.field]||P.find(V=>V.name===N.visibleWhen?.field)?.selectOptions?.[0]?.value)===N.visibleWhen.value:!0).map(N=>h.jsx(hr,{id:`attachedDb_${$}_${N.name}`,name:`attachedDb_${$}_${N.name}`,label:N.label,type:N.selectOptions?void 0:N.type,fullWidth:!0,size:"small",required:N.required,select:!!N.selectOptions,defaultValue:N.selectOptions?.[0]?.value,onChange:N.selectOptions?V=>{const z=[...s];z[$]={...z[$],[N.name]:V.target.value},l(z)}:void 0,children:N.selectOptions?.map(V=>h.jsx(qo,{value:V.value,children:V.label},V.value))},N.name))]},$)})]}):Dl[o].map(R=>h.jsx(hr,{id:R.name,name:R.name,label:R.label,type:R.type,fullWidth:!0,size:"small",required:R.required},R.name))]})})})]})}function Dde({connection:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),s=()=>{a(!0)},l=()=>{a(!1),t()};return h.jsxs(pn.Fragment,{children:[h.jsxs(qo,{"aria-label":`Delete connection ${e?.name??""}`.trim(),onClick:d=>{d.stopPropagation(),s()},sx:{color:"error.main"},children:[h.jsx(zk,{sx:{color:"inherit"},children:h.jsx(Gb,{fontSize:"small"})}),h.jsx(Fk,{children:"Delete"})]}),h.jsx(aa,{open:o,onClose:l,title:"Delete connection",actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{onClick:l,children:"Cancel"}),h.jsx(uo,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>r(),loading:n,children:"Delete connection"})]}),children:h.jsxs(br,{variant:"body2",children:["Delete ",h.jsx("strong",{children:e.name}),"? Packages that query through it stop working, and this cannot be undone."]})})]})}const qP=new Set(["password","connectionString","privateKey","privateKeyPass","serviceAccountKeyJson","token","oauthClientSecret","accessToken","peakaKey","secret","secretAccessKey","sessionToken","clientSecret","sasUrl"]);function YP(e){const t=e.duckdbConnection?.attachedDatabases;return!t||t.length===0?[]:t.map(n=>({name:n.name||"",dbType:n.type||"postgres"}))}function KP(e){const t=e.ducklakeConnection;return t&&t.storage?.gcsConnection?"gcs":"s3"}function Ade({connection:e,onSubmit:t,isSubmitting:n,onCloseDialog:r}){const[o,a]=C.useState(!1),[s,l]=C.useState(e.type),d=pn.useMemo(()=>new Set(e.withheldFields??[]),[e.withheldFields]),[f,c]=C.useState(()=>YP(e)),[m,y]=C.useState("postgres"),[b,v]=C.useState(()=>KP(e)),[x,w]=C.useState(()=>e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),S=()=>{c(YP(e)),l(e.type),w(e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),y("postgres"),v(KP(e)),a(!0)},T=()=>{a(!1),r?.()},M=async z=>{z.preventDefault();const W=new FormData(z.currentTarget),H=W.get("name")?.toString(),k=W.get("type")?.toString(),I=Dl[k];if(!H)throw new Error("Name is required");if(!k)throw new Error("Type is required");let F;if(k==="ducklake"){const _={};if(m==="postgres"){const Q=Dl.postgres,te={};if(Q.forEach(Z=>{const G=W.get(`ducklake_pg_${Z.name}`)?.toString();G&&(te[Z.name]=G)}),Object.keys(te).length===0)throw new Error("DuckLake requires catalog connection");_.postgresConnection=te}const j=W.get("ducklake_bucketUrl")?.toString();if(!j)throw new Error("DuckLake requires a bucket URL");const X={bucketUrl:j};if(b==="s3"){const Q={};Xm.forEach(Z=>{const G=W.get(`ducklake_s3_${Z.name}`)?.toString();G&&(Q[Z.name]=G)});const te=e.ducklakeConnection?.storage?.s3Connection;if(te&&(!Q.provider&&te.provider&&(Q.provider=te.provider),!Q.chain&&te.chain&&(Q.chain=te.chain),!Q.accessKeyId&&te.accessKeyId&&(Q.accessKeyId=te.accessKeyId)),Q.provider==="credential_chain")delete Q.accessKeyId,delete Q.secretAccessKey,delete Q.sessionToken;else if(delete Q.chain,!Q.accessKeyId)throw new Error("S3 Access Key ID is required");Object.keys(Q).length>0&&(X.s3Connection=Q)}else if(b==="gcs"){const Q={};Zm.forEach(Z=>{const G=W.get(`ducklake_gcs_${Z.name}`)?.toString();G&&(Q[Z.name]=G)});const te=e.ducklakeConnection?.storage?.gcsConnection;if(te&&!Q.keyId&&te.keyId&&(Q.keyId=te.keyId),!Q.keyId)throw new Error("GCS Key ID is required");Object.keys(Q).length>0&&(X.gcsConnection=Q)}F={name:H,type:k,ducklakeConnection:{catalog:_,storage:X}}}else if(k==="duckdb"){if(f.length===0)throw new Error("DuckDB connection must have at least one attached database");const _=f.map((j,X)=>{const Q=j.dbType,te=W.get(`attachedDb_${X}_name`)?.toString();if(!te)throw new Error(`Attached database at index ${X} must have a name`);const Z={name:te,type:Q},G=ib(Q);if(G&&G.length>0){const ne={};if(G.forEach(pe=>{const oe=W.get(`attachedDb_${X}_${pe.name}`)?.toString();oe&&(ne[pe.name]=oe)}),Q==="s3"){if(ne.provider==="credential_chain")delete ne.accessKeyId,delete ne.secretAccessKey,delete ne.sessionToken;else if(delete ne.chain,!ne.accessKeyId||!ne.secretAccessKey)throw new Error(`Attached database "${te}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`)}const se=Mw[Q];se&&(Z[se]=ne)}return Z});F={name:H,type:k,duckdbConnection:{attachedDatabases:_}}}else{const _=e[hm[k]]||{},j={};if(I.forEach(X=>{const Q=W.get(X.name)?.toString(),te=_[X.name];Q?j[X.name]=Q:qP.has(X.name)||(Q!==void 0?j[X.name]=Q:te&&(j[X.name]=te))}),k==="postgres"){const X=["host","port","databaseName","userName"],Q=d.has("postgresConnection.connectionString");if(!(j.connectionString?.trim()||Q)){const te=X;for(const Z of te)if(!j[Z])throw new Error(`${I.find(G=>G.name===Z)?.label||Z} is required`)}}else if(k==="snowflake"){if(!j.account)throw new Error("Account is required");if(!j.username)throw new Error("Username is required");if(!j.warehouse)throw new Error("Warehouse is required")}else if(k==="trino"){if(!j.server)throw new Error("Server is required");if(!j.user)throw new Error("User is required")}else if(k==="mysql"){const X=["host","port","database","user"];for(const Q of X)if(!j[Q])throw new Error(`${I.find(te=>te.name===Q)?.label||Q} is required`)}else if(k==="databricks"){if(!j.host)throw new Error("Host is required");if(!j.path)throw new Error("HTTP Path is required")}F={name:H,type:k,[hm[k]]:j}}await t(F),T()},R=()=>{c([...f,{name:"",dbType:"postgres"}])},$=z=>{c(f.filter((W,H)=>H!==z))},P=(z,W)=>{const H=[...f];H[z]={...H[z],dbType:W},c(H)},N=(z,W)=>{const H=e.duckdbConnection?.attachedDatabases;if(!H||!H[z])return"";const k=H[z],I=Mw[k.type||""];return I&&k[I]?k[I][W]??"":""},V=z=>{const W=e.ducklakeConnection;if(!W)return"";if(z.startsWith("pg_")){const H=z.replace("pg_","");return W.catalog?.postgresConnection?.[H]??""}if(z==="bucketUrl")return W.storage?.bucketUrl??"";if(z.startsWith("s3_")){const H=z.replace("s3_","");return W.storage?.s3Connection?.[H]??""}if(z.startsWith("gcs_")){const H=z.replace("gcs_","");return W.storage?.gcsConnection?.[H]??""}return""};return h.jsxs(pn.Fragment,{children:[h.jsxs(qo,{"aria-label":`Edit connection ${e?.name??""}`.trim(),onClick:z=>{z.preventDefault(),z.stopPropagation(),S()},children:[h.jsx(zk,{children:h.jsx(YC,{fontSize:"small"})}),h.jsx(Fk,{children:"Edit"})]}),h.jsx(aa,{open:o,onClose:T,title:"Edit connection",description:"Change how packages in this environment reach your database.",actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{disabled:n,onClick:T,children:"Cancel"}),h.jsx(uo,{type:"submit",form:"connection-form",variant:"contained",loading:n,children:"Save changes"})]}),children:h.jsx("form",{onSubmit:M,id:"connection-form",children:h.jsxs(k0,{sx:{gap:2},children:[h.jsx(hr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",defaultValue:e.name}),h.jsx(hr,{id:"type",name:"type",label:"Connection Type",fullWidth:!0,size:"small",value:s,select:!0,onChange:z=>l(z.target.value),children:DL.map(z=>h.jsx(qo,{value:z,children:z},z))}),s==="ducklake"?h.jsxs(Ma,{sx:{mt:2},children:[h.jsxs(Ma,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[h.jsx(br,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Catalog"}),h.jsx(hr,{id:"ducklake_catalogType",label:"Catalog Type",fullWidth:!0,size:"small",value:m,select:!0,onChange:z=>y(z.target.value),children:h.jsx(qo,{value:"postgres",children:"PostgreSQL"})}),m==="postgres"&&h.jsx(h.Fragment,{children:Dl.postgres.map(z=>h.jsx(hr,{id:`ducklake_pg_${z.name}`,name:`ducklake_pg_${z.name}`,label:z.label,type:z.type,fullWidth:!0,size:"small",defaultValue:V(`pg_${z.name}`)},`pg_${z.name}`))})]}),h.jsxs(Ma,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[h.jsx(br,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Storage"}),h.jsxs(hr,{id:"ducklake_storageType",label:"Storage Type",fullWidth:!0,size:"small",value:b,select:!0,onChange:z=>v(z.target.value),children:[h.jsx(qo,{value:"s3",children:"S3"}),h.jsx(qo,{value:"gcs",children:"GCS"})]}),h.jsx(hr,{required:!0,id:"ducklake_bucketUrl",name:"ducklake_bucketUrl",label:b==="s3"?"Bucket URL (e.g. s3://my-bucket/path)":"Bucket URL (e.g. gs://my-bucket/path)",type:"text",fullWidth:!0,size:"small",defaultValue:V("bucketUrl")}),b==="s3"&&h.jsxs(h.Fragment,{children:[h.jsx(br,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),Xm.filter(z=>z.visibleWhen?x===z.visibleWhen.value:!0).map(z=>h.jsx(hr,{id:`ducklake_s3_${z.name}`,name:`ducklake_s3_${z.name}`,label:z.label,type:z.selectOptions?void 0:z.type,fullWidth:!0,size:"small",required:z.required&&z.name!=="secretAccessKey",select:!!z.selectOptions,defaultValue:z.selectOptions?x:V(`s3_${z.name}`),onChange:z.name==="provider"?W=>w(W.target.value):void 0,placeholder:z.name==="region"?"us-east-1":z.name==="secretAccessKey"&&d.has("ducklakeConnection.storage.s3Connection.secretAccessKey")?"Leave empty to keep existing":void 0,children:z.selectOptions?.map(W=>h.jsx(qo,{value:W.value,children:W.label},W.value))},`s3_${z.name}`))]}),b==="gcs"&&h.jsxs(h.Fragment,{children:[h.jsx(br,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Zm.map(z=>h.jsx(hr,{id:`ducklake_gcs_${z.name}`,name:`ducklake_gcs_${z.name}`,label:z.label,type:z.type,fullWidth:!0,size:"small",required:z.required&&z.name!=="secret",defaultValue:V(`gcs_${z.name}`),placeholder:z.name==="secret"&&d.has("ducklakeConnection.storage.gcsConnection.secret")?"Leave empty to keep existing":void 0},`gcs_${z.name}`))]})]})]}):s==="duckdb"?h.jsxs(Ma,{sx:{mt:2},children:[h.jsxs(Ma,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[h.jsx(br,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),h.jsx(Sg,{label:"Database",icon:h.jsx(tk,{}),onClick:R,ariaLabel:"Add database"})]}),f.length===0&&h.jsx(br,{variant:"body2",color:"text.secondary",sx:{mb:2},children:'DuckDB connections require at least one attached database. Click "Add Database" to get started.'}),f.map((z,W)=>{const H=ib(z.dbType);return h.jsxs(Ma,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[h.jsxs(Ma,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[h.jsxs(br,{variant:"subtitle2",children:["Database ",W+1]}),h.jsx(Gc,{"aria-label":`Remove attached database ${W+1}`,onClick:()=>$(W),size:"small",color:"error",children:h.jsx(PL,{fontSize:"small"})})]}),h.jsx(hr,{required:!0,id:`attachedDb_${W}_name`,name:`attachedDb_${W}_name`,label:"Database Name",type:"text",fullWidth:!0,size:"small",defaultValue:z.name}),h.jsx(hr,{id:`attachedDb_${W}_type`,name:`attachedDb_${W}_type`,label:"Database Type",fullWidth:!0,size:"small",value:z.dbType,select:!0,onChange:k=>P(W,k.target.value),children:Object.values(mN).map(k=>h.jsx(qo,{value:k,children:k},k))}),H.filter(k=>k.visibleWhen?(z[k.visibleWhen.field]||N(W,k.visibleWhen.field)||H.find(I=>I.name===k.visibleWhen?.field)?.selectOptions?.[0]?.value)===k.visibleWhen.value:!0).map(k=>h.jsx(hr,{id:`attachedDb_${W}_${k.name}`,name:`attachedDb_${W}_${k.name}`,label:k.label,type:k.selectOptions?void 0:k.type,fullWidth:!0,size:"small",required:k.required,select:!!k.selectOptions,defaultValue:N(W,k.name)||k.selectOptions?.[0]?.value,onChange:k.selectOptions?I=>{const F=[...f];F[W]={...F[W],[k.name]:I.target.value},c(F)}:void 0,children:k.selectOptions?.map(I=>h.jsx(qo,{value:I.value,children:I.label},I.value))},k.name))]},W)})]}):Dl[s].map(z=>{const W=e?.[hm[s]??""]?.[z.name??""]??"",H=z.type==="password"||qP.has(z.name),k=d.has(`${hm[s]??""}.${z.name}`);return h.jsx(hr,{id:z.name,name:z.name,label:z.label,type:z.type,fullWidth:!0,size:"small",required:z.required&&!H&&!W,defaultValue:W,placeholder:k?"Leave empty to keep existing":void 0,helperText:H?k?"Stored value is not shown. Leave empty to keep it.":"No value stored.":void 0},z.name)})]})})})]})}function GP(e,t){return!e||e.type!=="duckdb"?!1:(e.duckdbConnection?.attachedDatabases||[]).some(n=>n.type==="azure"&&n.name===t)}function jde(e){return e.startsWith("gs://")||e.startsWith("s3://")||e.startsWith("https://")||e.startsWith("abfss://")||e.startsWith("az://")}function Nde({connectionName:e,resourceUri:t,schema:n,connection:r}){const{apiClients:o}=zr(),{environmentName:a}=xo(t),[s,l]=pn.useState(null),[d,f]=pn.useState(n||null),[c,m]=pn.useState(!1),{data:y,isError:b,isLoading:v,error:x}=co({queryKey:["schemas",a,e],queryFn:()=>o.connections.listSchemas(a,e)}),w=y?.data||[];return h.jsxs(Rf,{container:!0,spacing:1,children:[!n&&h.jsx(Rf,{size:{xs:12,md:4},children:h.jsxs(Na,{sx:{p:1,m:0},children:[h.jsxs(Kt,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:0},children:[h.jsx(Lt,{variant:"overline",fontWeight:"bold",children:"Table Paths"}),h.jsx(MC,{control:h.jsx(Sj,{checked:c,onChange:S=>m(S.target.checked)}),label:"Hidden Schemas"})]}),h.jsx(Bc,{sx:{mt:"2px"}}),h.jsxs(Kt,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[v&&h.jsx(oa,{text:"Loading schemas..."}),b&&h.jsx(ha,{error:x,context:`${a} > ${e} > Schemas`}),!v&&!b&&w.length===0&&h.jsx(Lt,{variant:"body2",children:"No Schemas"}),!v&&!b&&w.length>0&&h.jsx(RC,{dense:!0,disablePadding:!0,children:w.map(S=>{const T=S.name;return S.isHidden&&!c?null:h.jsx(pj,{selected:d===T,onClick:()=>{f(T),l(null)},children:h.jsx(Kc,{primary:T})},T)})})]})]})}),h.jsx(Rf,{size:{xs:12,md:n?6:4},children:d&&h.jsx(Na,{sx:{p:1,m:0},children:h.jsx(zde,{connectionName:e,schemaName:d,onTableSelect:S=>{l(S)},resourceUri:t,connection:r})})}),h.jsx(Rf,{size:{xs:12,md:n?6:4},children:d&&s&&h.jsx(Ide,{environmentName:a,connectionName:e,schemaName:d,tableResource:s})})]})}function Ide({environmentName:e,connectionName:t,schemaName:n,tableResource:r}){const{apiClients:o}=zr(),{data:a,isLoading:s,isError:l,error:d}=co({queryKey:["connectionTableDetail",e,t,n,r],queryFn:()=>o.connections.getTable(e,t,n,r),enabled:!!n&&!!r}),f={resource:a?.data?.resource??r,columns:a?.data?.columns??[]};return h.jsxs(Na,{sx:{p:1,m:0},children:[l&&h.jsx(ha,{error:d,context:`${e} > ${t} > ${n} > ${r}`}),!l&&h.jsx(Lde,{table:f,loading:s})]})}function Lde({table:e,loading:t}){return t?h.jsx(oa,{text:"Loading columns..."}):h.jsxs(h.Fragment,{children:[h.jsxs(Lt,{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]}),h.jsx(Bc,{}),h.jsx(Kt,{sx:{mt:"10px",maxHeight:"600px",overflowY:"auto"},children:h.jsx(l7,{children:h.jsxs(ug,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[h.jsx(fg,{children:h.jsxs(Zs,{children:[h.jsx(Xn,{children:"NAME"}),h.jsx(Xn,{children:"TYPE"})]})}),h.jsx(dg,{children:e.columns?.sort((n,r)=>n.name.localeCompare(r.name))?.map(n=>h.jsxs(Zs,{children:[h.jsx(Xn,{children:n.name}),h.jsx(Xn,{children:n.type})]},n.name))})]})})})]})}function zde({connectionName:e,schemaName:t,onTableSelect:n,resourceUri:r,connection:o}){const{environmentName:a}=xo(r),{apiClients:s}=zr(),[l,d]=C.useState(""),{data:f,isSuccess:c,isError:m,error:y,isLoading:b}=co({queryKey:["tablesInSchema",a,e,t],queryFn:()=>s.connections.listTables(a,e,t)}),v=GP(o,t),x=S=>v?S:S.split(".").pop()||S,w=c&&f?.data?f.data.filter(S=>x(S.resource).toLowerCase().includes(l.toLowerCase())).sort((S,T)=>x(S.resource).localeCompare(x(T.resource))):[];return h.jsxs(h.Fragment,{children:[h.jsx(Lt,{variant:"overline",fontWeight:"bold",children:jde(t)||GP(o,t)?`Files in ${t}`:`Tables in ${t}`}),h.jsx(Bc,{}),h.jsx(Kt,{sx:{mt:1,mb:1},children:h.jsx(ii,{size:"small",fullWidth:!0,placeholder:"Search tables...",value:l,onChange:S=>d(S.target.value),variant:"outlined"})}),h.jsx(Bc,{}),h.jsxs(Kt,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[b&&h.jsx(oa,{text:"Fetching Tables..."}),m&&h.jsx(ha,{error:y,context:`${a} > ${e} > ${t}`}),c&&w.length===0&&h.jsx(Lt,{variant:"body2",children:"No Tables"}),c&&f?.data&&f.data.length>0&&h.jsx(RC,{dense:!0,disablePadding:!0,children:w.map(S=>{let T=x(S.resource);return!v&&S.resource.includes("://")&&(T=S.resource.split("/").pop()||S.resource),h.jsx(pj,{onClick:()=>n(S.resource),children:h.jsx(Kc,{primary:T,secondary:S.columns.length>0?`${S.columns.length} columns`:void 0})},S.resource)})})]})]})}const Fde={bigquery:"BigQuery",snowflake:"Snowflake",postgres:"PostgreSQL",mysql:"MySQL",trino:"Trino",databricks:"Databricks",duckdb:"DuckDB",ducklake:"DuckLake",s3:"S3",gcs:"GCS",azure:"Azure"};function Bde(e){return e?Fde[e]??e:""}function Ude({resourceUri:e}){const{apiClients:t,mutable:n}=zr(),r=dd(),{environmentName:o}=xo(e),[a,s]=C.useState(""),[l,d]=C.useState(null),f=u0({environmentName:o,connectionName:l}),{data:c,isSuccess:m,isError:y,error:b}=co({queryKey:["connections",o],queryFn:()=>t.connections.listConnections(o)}),v=Ws({mutationFn:Pl("connection","create",M=>t.environments.updateEnvironment(o,{name:o,connections:[...c.data,M]})),onSuccess(){s("Connection added successfully"),r.invalidateQueries({queryKey:["connections",o]})},onError(M){s(M.message)}}),x=Ws({mutationFn:Pl("connection","update",M=>t.environments.updateEnvironment(o,{name:o,connections:c.data.map(R=>R.name===M.name?M:R)})),onSuccess(M,R){s(`Connection ${R.name} updated successfully`),r.invalidateQueries({queryKey:["connections",o]})},onError(M){s(M.message)}}),w=Ws({mutationFn:Pl("connection","delete",M=>{if(!M.name)throw new Error("Cannot delete a connection with no name");return t.connections.deleteConnection(o,M.name)}),onSuccess(M,R){s(`Connection ${R.name} deleted successfully`),r.invalidateQueries({queryKey:["connections",o]})},onError(M){s(M.message)}}),S=m?[...c.data].sort((M,R)=>(M.name??"").localeCompare(R.name??"")):[],T=v.isPending||x.isPending||w.isPending;return h.jsxs(us,{title:"Connections",...m?{count:S.length}:{},description:"Database connections available to packages in this environment",...n&&m?{action:h.jsx(Pde,{onSubmit:M=>v.mutateAsync(M),isSubmitting:v.isPending})}:{},children:[!m&&!y&&h.jsx(Lt,{variant:"body2",color:"text.secondary",children:"Fetching Connections..."}),y&&h.jsx(ha,{error:b,context:`${o} > Connections`}),m&&S.length===0&&h.jsx(Lt,{variant:"body2",color:"text.secondary",children:"No connections yet."}),m&&S.length>0&&h.jsx(fr,{children:S.map(M=>h.jsx(_de,{connection:M,mutable:n,isMutating:T,onOpenExplorer:()=>d(M.name??null),onEdit:R=>x.mutateAsync(R),onDelete:R=>w.mutateAsync(R)},M.name))}),h.jsx(Fb,{open:a!=="",autoHideDuration:6e3,onClose:()=>s(""),message:a}),h.jsx(aa,{open:l!==null,onClose:()=>d(null),maxWidth:"lg",title:`Connection explorer: ${l??""}`,showClose:!0,children:l&&h.jsx(Nde,{resourceUri:f,connectionName:l,connection:c?.data?.find(M=>M.name===l)})})]})}function _de({connection:e,mutable:t,isMutating:n,onOpenExplorer:r,onEdit:o,onDelete:a}){const[s,l]=C.useState(null),d=!!s,f=m=>{m.stopPropagation(),l(m.currentTarget)},c=()=>l(null);return h.jsx(C0,{icon:h.jsx(yde,{sx:{fontSize:18}}),tint:_C.connection,label:e.name??"",ariaLabel:e.name??"",description:Bde(e.type),onClick:r,...t?{trailingAction:h.jsxs(h.Fragment,{children:[h.jsx(eo,{size:"small",onClick:f,"aria-label":`Connection actions for ${e.name??""}`.trim(),children:h.jsx(Qb,{fontSize:"small"})}),h.jsxs(cd,{anchorEl:s,open:d,onClose:c,onClick:m=>m.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[h.jsx(Ade,{connection:e,onSubmit:o,isSubmitting:n,onCloseDialog:c}),h.jsx(Dde,{connection:e,onCloseDialog:c,isMutating:n,onDelete:()=>a(e)})]})]})}:{}})}const Vde=cr([h.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"),h.jsx("path",{d:"M9 12h6v2H9z"},"1")]);function Hde({resourceUri:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=zr(),a=()=>{r(!0)},s=()=>{r(!1),t()},{environmentName:l,packageName:d}=xo(e),f=yp({mutationFn:()=>o.packages.deletePackage(l,d),success:"Package deleted",invalidates:[["packages",l]],closeDialog:s,resource:"package",action:"delete"});return h.jsxs(pn.Fragment,{children:[h.jsxs(Ii,{onClick:a,children:[h.jsx(dp,{children:h.jsx(Gb,{fontSize:"small"})}),h.jsx(Kc,{children:"Delete"})]}),h.jsx(aa,{open:n,onClose:s,title:"Delete package",actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{onClick:s,children:"Cancel"}),h.jsx(uo,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>f.mutate(),loading:f.isPending,children:"Delete package"})]}),children:h.jsxs(br,{variant:"body2",children:["Delete ",h.jsx("strong",{children:d}),"? The package stops being served and this cannot be undone."]})}),f.notice]})}function Wde({package:e,resourceUri:t,onCloseDialog:n}){const[r,o]=C.useState(!1),{apiClients:a}=zr(),s=()=>{o(!0)},l=()=>{o(!1),n()},{packageName:d,environmentName:f}=xo(t),c=yp({mutationFn(y){return a.packages.updatePackage(f,d,{name:d,description:y.description})},success:"Package updated",invalidates:[["packages",f]],closeDialog:l,resource:"package",action:"update"}),m=y=>{y.preventDefault();const b=new FormData(y.currentTarget).get("description")?.toString();c.mutate({description:b})};return h.jsxs(pn.Fragment,{children:[h.jsxs(Ii,{onClick:s,children:[h.jsx(dp,{children:h.jsx(YC,{fontSize:"small"})}),h.jsx(Kc,{children:"Edit"})]}),h.jsx(aa,{open:r,onClose:l,title:"Edit package",description:`What ${e.name} is, for the people who open it.`,actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{disabled:c.isPending,onClick:l,children:"Cancel"}),h.jsx(uo,{type:"submit",form:"package-form",variant:"contained",loading:c.isPending,children:"Save changes"})]}),children:h.jsx("form",{onSubmit:m,id:"package-form",children:h.jsxs(fr,{sx:{gap:2},children:[h.jsx(hr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",disabled:!0,type:"text",fullWidth:!0,size:"small",defaultValue:e.name,InputLabelProps:{shrink:!0}}),h.jsx(hr,{id:"description",name:"description",label:"Description",multiline:!0,fullWidth:!0,rows:4,size:"small",defaultValue:e.description,InputLabelProps:{shrink:!0}})]})})}),c.notice]})}function qde({onSelectPackage:e,resourceUri:t}){const{apiClients:n}=zr(),{environmentName:r}=xo(t),{data:o,isSuccess:a,isError:s,error:l}=co({queryKey:["packages",r],queryFn:()=>n.packages.listPackages(r)});if(s)return h.jsx(ha,{error:l,context:`${r} > Packages`});if(!a)return h.jsx(oa,{text:"Fetching Packages..."});const d=[...o.data].sort((f,c)=>f.name.localeCompare(c.name));return h.jsx(fr,{children:d.map(f=>{const c=u0({environmentName:r,packageName:f.name});return h.jsx(Yde,{pkg:f,packageResourceUri:c,onSelectPackage:e},f.name)})})}function Yde({pkg:e,packageResourceUri:t,onSelectPackage:n}){const{mutable:r}=zr(),[o,a]=C.useState(null),s=!!o,l=f=>{f.stopPropagation(),a(f.currentTarget)},d=()=>a(null);return h.jsx(C0,{icon:h.jsx(Vde,{sx:{fontSize:18}}),tint:_C.package,label:e.name,ariaLabel:e.name,...e.description?{description:e.description}:{},onClick:f=>n(e.name,f),...r?{trailingAction:h.jsxs(h.Fragment,{children:[h.jsx(eo,{size:"small",onClick:l,"aria-label":`Package actions for ${e.name}`,children:h.jsx(Qb,{fontSize:"small"})}),h.jsxs(cd,{anchorEl:o,open:s,onClose:d,onClick:f=>f.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[h.jsx(Wde,{package:e,resourceUri:t,onCloseDialog:d}),h.jsx(Hde,{resourceUri:t,onCloseDialog:d})]})]})}:{}})}function Whe({onSelectPackage:e,resourceUri:t}){const{apiClients:n,mutable:r}=zr(),{environmentName:o}=xo(t),a=co({queryKey:["packages",o],queryFn:()=>n.packages.listPackages(o)});return C.useEffect(()=>{window.scrollTo({top:0,behavior:"auto"})},[]),h.jsxs(kC,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[h.jsxs(Kt,{sx:{mb:4},children:[h.jsx(Kt,{children:h.jsx(EL,{label:"Publisher",onClick:s=>e("/",s)})}),h.jsx(Lt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:o}),h.jsx(Lt,{variant:"body2",color:"text.secondary",children:"Manage packages and database connections in this environment. Open a package to explore its models and notebooks."})]}),h.jsx(us,{title:"Packages",...a.isSuccess?{count:a.data.data.length}:{},description:"Published packages available for use in this environment",...r?{action:h.jsx(gde,{resourceUri:t})}:{},children:h.jsx(qde,{onSelectPackage:e,resourceUri:t})}),h.jsx(Ude,{resourceUri:t}),h.jsx(tde,{resourceUri:t})]})}$r.extend(nk);const Kde=cr(h.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"})),AL=e=>{if(!e)return"Explore semantic models, run queries, and build dashboards";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(" ")+"..."},jL=(e,t)=>{const n=(e.readme||void 0)?.split(`
|
|
434
|
+
`)}}const Jce=C.lazy(()=>Lo(()=>import("./RenderedResult-CYyhQekT.es-DBHF8EwO.js"),[]).then(e=>e.c));function Ak({result:e,maxHeight:t,maxResultSize:n=0,renderLogs:r,drill:o}){const a=C.useRef(null),[s,l]=C.useState(void 0),[d,f]=C.useState(void 0),[c,m]=C.useState(!1),y=Zce(r);if(!e)return null;if(n>0&&e.length>n&&!c)return h.jsxs(Kt,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[h.jsx($Q,{sx:{fontSize:48,color:"#757575"}}),h.jsx(Lt,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),h.jsx(Ko,{variant:"contained",color:"primary",onClick:()=>m(!0),children:"Proceed"})]});const b=h.jsx(oa,{text:"Loading...",centered:!0,size:32}),v=Hce({sizing:s,contentHeight:d,maxHeight:t});return h.jsxs(Kt,{ref:a,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden"},children:[e&&h.jsx(C.Suspense,{fallback:b,children:h.jsx(Jce,{result:e,height:v,onSizeChange:f,onSizing:l,drill:o})}),y&&h.jsx(Kt,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:h.jsx(Ui,{title:y.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:h.jsx(Uf,{"aria-label":"Render tag warnings",children:h.jsx(SL,{fontSize:"small",color:y.severity==="error"?"error":"warning"})})})})]})}function jk({state:e,context:t,loadingText:n="Running…",maxHeight:r,maxResultSize:o,drill:a,transform:s}){const{data:l,isSuccess:d,isError:f,error:c}=e,m=l?.data.result,y=C.useMemo(()=>m!==void 0&&s?s(m):m,[m,s]);return f?h.jsx(Kt,{sx:{p:2},children:h.jsx(ha,{context:t,error:c})}):d?h.jsx(Ak,{result:y,maxHeight:r,maxResultSize:o,renderLogs:l.data.renderLogs,drill:a}):h.jsx(oa,{text:n})}const eue=new Set(["bar_chart","line_chart","scatter_chart","shape_map","segment_map","point_map","big_value","sparkline","list","list_detail","dashboard","transpose","table","json","image","link","text"]),tue={value:`# big_value
|
|
435
|
+
`},nue=/^#\(malloy\)[\s\S]*\bcalculation\b/;function rue(e){return e?e.kind==="measure"?!0:(e.annotations??[]).some(t=>typeof t?.value=="string"&&nue.test(t.value.trim())):!1}function oue(e){const t=e.schema?.fields;if(!Array.isArray(t)||t.length===0||!t.every(rue))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 aue(e){for(const t of e){const n=t.trim();if(!n.startsWith("#")||n.startsWith("#(")||n.startsWith('#"'))continue;const r=n.slice(1).replace(/"(?:[^"\\]|\\.)*"/g,'""');for(const o of r.split(/[\s{}=.,[\]]+/))if(eue.has(o))return!0}return!1}function iue(e){let t;try{t=JSON.parse(e)}catch{return e}if(!t||typeof t!="object"||!oue(t))return e;const n=Array.isArray(t.annotations)?t.annotations:[],r=n.map(o=>o?.value).filter(o=>typeof o=="string");return aue(r)?e:JSON.stringify({...t,annotations:[tue,...n]})}const wL=20,sue={radius:"8px",padding:`${wL}px`};function zhe(e,t=sue){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}}function lue({borderless:e=!1,sx:t,children:n}){const{theme:r}=ol();return h.jsx(Na,{elevation:0,sx:[{border:e?"none":r.cardBorder,borderRadius:e?0:1,background:e?"none":r.tile,overflow:"hidden",minWidth:0,minHeight:120,p:e?"12px 0":`${wL}px`},...Array.isArray(t)?t:[t]],children:n})}function cue({title:e,subtitle:t,tooltip:n,action:r}){const{theme:o}=ol();return h.jsxs(Kt,{sx:{pb:1.5,display:"flex",alignItems:"flex-start",gap:1},children:[h.jsxs(Kt,{sx:{minWidth:0,flex:1},children:[h.jsx(Lt,{variant:"subtitle2",sx:{fontWeight:500,color:o.tileTitle,fontFamily:o.font.family},title:n,children:e}),t!==void 0&&h.jsx(Lt,{variant:"caption",sx:{display:"block",color:o.tileTitle,fontFamily:o.font.family,opacity:.8},children:t})]}),r]})}function RP(e){const t=e.split("->").at(-1)?.trim()??e;return/^[A-Za-z_][\w-]*$/.test(t)?qN(t):e}function $P({environmentName:e,packageName:t,versionId:n,modelPath:r,queryName:o,tile:a,label:s,subtitle:l,borderless:d,givens:f,declaredTypes:c,givenNames:m,height:y,maxResultSize:b,drill:v,onExplore:x}){const{theme:w}=ol(),S=Dk({environmentName:e,packageName:t,modelPath:r,versionId:n,queryName:o,query:a!==void 0?`run: ${a}`:void 0,givens:c0(f,c,m)});return h.jsxs(lue,{borderless:d,sx:{"& .publisher-tile-explore":{opacity:0,transition:"opacity 120ms"},"&:hover .publisher-tile-explore, & .publisher-tile-explore:focus-visible":{opacity:1}},children:[a!==void 0&&h.jsx(cue,{title:s??RP(a),subtitle:l,tooltip:a,action:x&&h.jsx(Ui,{title:"Explore from here",children:h.jsx(eo,{className:"publisher-tile-explore",size:"small","aria-label":`Explore ${s??RP(a)}`,onClick:x,sx:{mt:-.5,mr:-.5,color:w.tileTitle},children:h.jsx(Gce,{fontSize:"small"})})})}),h.jsx(jk,{state:S,context:a??o??r,maxHeight:y,maxResultSize:b,drill:v,transform:a!==void 0?iue:void 0})]})}function PP({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 DP(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function uue(e={}){const{ignoreAccents:t=!0,ignoreCase:n=!0,limit:r,matchFrom:o="any",stringify:a,trim:s=!1}=e;return(l,{inputValue:d,getOptionLabel:f})=>{let c=s?d.trim():d;n&&(c=c.toLowerCase()),t&&(c=DP(c));const m=c?l.filter(y=>{let b=(a||f)(y);return n&&(b=b.toLowerCase()),t&&(b=DP(b)),o==="start"?b.startsWith(c):b.includes(c)}):l;return typeof r=="number"?m.slice(0,r):m}}const due=uue(),AP=5,fue=e=>e.current!==null&&e.current.parentElement?.contains(document.activeElement),pue=[];function jP(e,t,n,r){if(t||e==null||r)return"";const o=n(e);return typeof o=="string"?o:""}function hue(e){const{unstable_isActiveElementInListbox:t=fue,unstable_classNamePrefix:n="Mui",autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:s=!1,clearOnBlur:l=!e.freeSolo,clearOnEscape:d=!1,componentName:f="useAutocomplete",defaultValue:c=e.multiple?pue:null,disableClearable:m=!1,disableCloseOnSelect:y=!1,disabled:b,disabledItemsFocusable:v=!1,disableListWrap:x=!1,filterOptions:w=due,filterSelectedOptions:S=!1,freeSolo:T=!1,getOptionDisabled:M,getOptionKey:R,getOptionLabel:$=ue=>ue.label??ue,groupBy:P,handleHomeEndKeys:N=!e.freeSolo,id:V,includeInputInList:z=!1,inputValue:W,isOptionEqualToValue:H=(ue,fe)=>ue===fe,multiple:k=!1,onChange:I,onClose:F,onHighlightChange:_,onInputChange:j,onOpen:X,open:Q,openOnFocus:te=!1,options:Z,readOnly:G=!1,renderValue:ne,selectOnFocus:se=!e.freeSolo,value:pe}=e,oe=ys(V);let ae=$;ae=ue=>{const fe=$(ue);return typeof fe!="string"?String(fe):fe};const ce=C.useRef(!1),ge=C.useRef(!0),ye=C.useRef(null),we=C.useRef(null),[Ce,$e]=C.useState(null),[de,ke]=C.useState(-1),et=o?0:-1,ze=C.useRef(et),Ae=C.useRef(jP(c??pe,k,ae)).current,[le,bt]=li({controlled:pe,default:c,name:f}),[Fe,it]=li({controlled:W,default:Ae,name:f,state:"inputValue"}),[pt,Ft]=C.useState(!1),_t=C.useCallback((ue,fe,Ve)=>{if(!(k?le.length<fe.length:fe!==null)&&!l)return;const vt=jP(fe,k,ae,ne);Fe!==vt&&(it(vt),j&&j(ue,vt,Ve))},[ae,Fe,k,j,it,l,le,ne]),[at,Xe]=li({controlled:Q,default:!1,name:f,state:"open"}),[rt,Ne]=C.useState(!0),he=!k&&le!=null&&Fe===ae(le),We=at&&!G,Te=We?w(Z.filter(ue=>!(S&&(k?le:[le]).some(fe=>fe!==null&&H(ue,fe)))),{inputValue:he&&rt?"":Fe,getOptionLabel:ae}):[],kt=pee({filteredOptions:Te,value:le,inputValue:Fe});C.useEffect(()=>{const ue=le!==kt.value;pt&&!ue||T&&!ue||_t(null,le,"reset")},[le,_t,pt,kt.value,T]);const Mt=at&&Te.length>0&&!G,gt=It(ue=>{if(ue===-1)ye.current.focus();else{const fe=ne?"data-item-index":"data-tag-index";Ce.querySelector(`[${fe}="${ue}"]`).focus()}});C.useEffect(()=>{k&&de>le.length-1&&(ke(-1),gt(-1))},[le,k,de,gt]);function ct(ue,fe){if(!we.current||ue<0||ue>=Te.length)return-1;let Ve=ue;for(;;){const vt=we.current.querySelector(`[data-option-index="${Ve}"]`),Ke=v?!1:!vt||vt.disabled||vt.getAttribute("aria-disabled")==="true";if(vt&&vt.hasAttribute("tabindex")&&!Ke)return Ve;if(fe==="next"?Ve=(Ve+1)%Te.length:Ve=(Ve-1+Te.length)%Te.length,Ve===ue)return-1}}const $t=It(({event:ue,index:fe,reason:Ve})=>{if(ze.current=fe,fe===-1?ye.current.removeAttribute("aria-activedescendant"):ye.current.setAttribute("aria-activedescendant",`${oe}-option-${fe}`),_&&["mouse","keyboard","touch"].includes(Ve)&&_(ue,fe===-1?null:Te[fe],Ve),!we.current)return;const vt=we.current.querySelector(`[role="option"].${n}-focused`);vt&&(vt.classList.remove(`${n}-focused`),vt.classList.remove(`${n}-focusVisible`));let Ke=we.current;if(we.current.getAttribute("role")!=="listbox"&&(Ke=we.current.parentElement.querySelector('[role="listbox"]')),!Ke)return;if(fe===-1){Ke.scrollTop=0;return}const Zt=we.current.querySelector(`[data-option-index="${fe}"]`);if(Zt&&(Zt.classList.add(`${n}-focused`),Ve==="keyboard"&&Zt.classList.add(`${n}-focusVisible`),Ke.scrollHeight>Ke.clientHeight&&Ve!=="mouse"&&Ve!=="touch")){const nn=Zt,fn=Ke.clientHeight+Ke.scrollTop,me=nn.offsetTop+nn.offsetHeight;me>fn?Ke.scrollTop=me-Ke.clientHeight:nn.offsetTop-nn.offsetHeight*(P?1.3:0)<Ke.scrollTop&&(Ke.scrollTop=nn.offsetTop-nn.offsetHeight*(P?1.3:0))}}),Vt=It(({event:ue,diff:fe,direction:Ve="next",reason:vt})=>{if(!We)return;const Ke=ct((()=>{const Zt=Te.length-1;if(fe==="reset")return et;if(fe==="start")return 0;if(fe==="end")return Zt;const nn=ze.current+fe;return nn<0?nn===-1&&z?-1:x&&ze.current!==-1||Math.abs(fe)>1?0:Zt:nn>Zt?nn===Zt+1&&z?-1:x||Math.abs(fe)>1?Zt:0:nn})(),Ve);if($t({index:Ke,reason:vt,event:ue}),r&&fe!=="reset")if(Ke===-1)ye.current.value=Fe;else{const Zt=ae(Te[Ke]);ye.current.value=Zt,Zt.toLowerCase().indexOf(Fe.toLowerCase())===0&&Fe.length>0&&ye.current.setSelectionRange(Fe.length,Zt.length)}}),un=!PP({array1:kt.filteredOptions,array2:Te,parser:ae}),vn=()=>{const ue=(fe,Ve)=>{const vt=fe?ae(fe):"",Ke=Ve?ae(Ve):"";return vt===Ke};if(ze.current!==-1&&!PP({array1:kt.filteredOptions,array2:Te,parser:ae})&&kt.inputValue===Fe&&(k?le.length===kt.value.length&&kt.value.every((fe,Ve)=>ae(le[Ve])===ae(fe)):ue(kt.value,le))){const fe=kt.filteredOptions[ze.current];if(fe)return Te.findIndex(Ve=>ae(Ve)===ae(fe))}return-1},Bn=C.useCallback(()=>{if(!We)return;const ue=vn();if(ue!==-1){ze.current=ue;return}const fe=k?le[0]:le;if(Te.length===0||fe==null){Vt({diff:"reset"});return}if(we.current){if(fe!=null){const Ve=Te[ze.current];if(k&&Ve&&le.findIndex(Ke=>H(Ve,Ke))!==-1)return;const vt=Te.findIndex(Ke=>H(Ke,fe));vt===-1?Vt({diff:"reset"}):$t({index:vt});return}if(ze.current>=Te.length-1){$t({index:Te.length-1});return}$t({index:ze.current})}},[Te.length,k?!1:le,S,Vt,$t,We,Fe,k]),Wn=It(ue=>{ow(we,ue),ue&&Bn()});C.useEffect(()=>{un&&Bn()},[Bn,un]);const Qt=ue=>{at||(Xe(!0),Ne(!0),X&&X(ue))},In=(ue,fe)=>{at&&(Xe(!1),F&&F(ue,fe))},be=(ue,fe,Ve,vt)=>{if(k){if(le.length===fe.length&&le.every((Ke,Zt)=>Ke===fe[Zt]))return}else if(le===fe)return;I&&I(ue,fe,Ve,vt),bt(fe)},zn=C.useRef(!1),En=(ue,fe,Ve="selectOption",vt="options")=>{let Ke=Ve,Zt=fe;if(k){Zt=Array.isArray(le)?le.slice():[];const nn=Zt.findIndex(fn=>H(fe,fn));nn===-1?Zt.push(fe):vt!=="freeSolo"&&(Zt.splice(nn,1),Ke="removeOption")}_t(ue,Zt,Ke),be(ue,Zt,Ke,{option:fe}),!y&&(!ue||!ue.ctrlKey&&!ue.metaKey)&&In(ue,Ke),(s===!0||s==="touch"&&zn.current||s==="mouse"&&!zn.current)&&ye.current.blur()};function Xt(ue,fe){if(ue===-1)return-1;let Ve=ue;for(;;){if(fe==="next"&&Ve===le.length||fe==="previous"&&Ve===-1)return-1;const vt=ne?"data-item-index":"data-tag-index",Ke=Ce.querySelector(`[${vt}="${Ve}"]`);if(!Ke||!Ke.hasAttribute("tabindex")||Ke.disabled||Ke.getAttribute("aria-disabled")==="true")Ve+=fe==="next"?1:-1;else return Ve}}const ie=(ue,fe)=>{if(!k)return;Fe===""&&In(ue,"toggleInput");let Ve=de;de===-1?Fe===""&&fe==="previous"&&(Ve=le.length-1):(Ve+=fe==="next"?1:-1,Ve<0&&(Ve=0),Ve===le.length&&(Ve=-1)),Ve=Xt(Ve,fe),ke(Ve),gt(Ve)},Pe=ue=>{ce.current=!0,it(""),j&&j(ue,"","clear"),be(ue,k?[]:null,"clear")},Le=ue=>fe=>{if(ue.onKeyDown&&ue.onKeyDown(fe),!fe.defaultMuiPrevented&&(de!==-1&&!["ArrowLeft","ArrowRight"].includes(fe.key)&&(ke(-1),gt(-1)),fe.which!==229))switch(fe.key){case"Home":We&&N&&(fe.preventDefault(),Vt({diff:"start",direction:"next",reason:"keyboard",event:fe}));break;case"End":We&&N&&(fe.preventDefault(),Vt({diff:"end",direction:"previous",reason:"keyboard",event:fe}));break;case"PageUp":fe.preventDefault(),Vt({diff:-AP,direction:"previous",reason:"keyboard",event:fe}),Qt(fe);break;case"PageDown":fe.preventDefault(),Vt({diff:AP,direction:"next",reason:"keyboard",event:fe}),Qt(fe);break;case"ArrowDown":fe.preventDefault(),Vt({diff:1,direction:"next",reason:"keyboard",event:fe}),Qt(fe);break;case"ArrowUp":fe.preventDefault(),Vt({diff:-1,direction:"previous",reason:"keyboard",event:fe}),Qt(fe);break;case"ArrowLeft":!k&&ne?gt(0):ie(fe,"previous");break;case"ArrowRight":!k&&ne?gt(-1):ie(fe,"next");break;case"Enter":if(ze.current!==-1&&We){const Ve=Te[ze.current],vt=M?M(Ve):!1;if(fe.preventDefault(),vt)return;En(fe,Ve,"selectOption"),r&&ye.current.setSelectionRange(ye.current.value.length,ye.current.value.length)}else T&&Fe!==""&&he===!1&&(k&&fe.preventDefault(),En(fe,Fe,"createOption","freeSolo"));break;case"Escape":We?(fe.preventDefault(),fe.stopPropagation(),In(fe,"escape")):d&&(Fe!==""||k&&le.length>0||ne)&&(fe.preventDefault(),fe.stopPropagation(),Pe(fe));break;case"Backspace":if(k&&!G&&Fe===""&&le.length>0){const Ve=de===-1?le.length-1:de,vt=le.slice();vt.splice(Ve,1),be(fe,vt,"removeOption",{option:le[Ve]})}!k&&ne&&!G&&(bt(null),gt(-1));break;case"Delete":if(k&&!G&&Fe===""&&le.length>0&&de!==-1){const Ve=de,vt=le.slice();vt.splice(Ve,1),be(fe,vt,"removeOption",{option:le[Ve]})}!k&&ne&&!G&&(bt(null),gt(-1));break}},qe=ue=>{Ft(!0),te&&!ce.current&&Qt(ue)},ut=ue=>{if(t(we)){ye.current.focus();return}Ft(!1),ge.current=!0,ce.current=!1,a&&ze.current!==-1&&We?En(ue,Te[ze.current],"blur"):a&&T&&Fe!==""?En(ue,Fe,"blur","freeSolo"):l&&_t(ue,le,"blur"),In(ue,"blur")},Nt=ue=>{const fe=ue.target.value;Fe!==fe&&(it(fe),Ne(!1),j&&j(ue,fe,"input")),fe===""?!m&&!k&&be(ue,null,"clear"):Qt(ue)},Bt=ue=>{const fe=Number(ue.currentTarget.getAttribute("data-option-index"));ze.current!==fe&&$t({event:ue,index:fe,reason:"mouse"})},Dt=ue=>{$t({event:ue,index:Number(ue.currentTarget.getAttribute("data-option-index")),reason:"touch"}),zn.current=!0},mt=ue=>{const fe=Number(ue.currentTarget.getAttribute("data-option-index"));En(ue,Te[fe],"selectOption"),zn.current=!1},At=ue=>fe=>{const Ve=le.slice();Ve.splice(ue,1),be(fe,Ve,"removeOption",{option:le[ue]})},Et=ue=>{be(ue,null,"removeOption",{option:le})},wt=ue=>{at?In(ue,"toggleInput"):Qt(ue)},Ht=ue=>{ue.currentTarget.contains(ue.target)&&ue.target.getAttribute("id")!==oe&&ue.preventDefault()},On=ue=>{ue.currentTarget.contains(ue.target)&&(ye.current.focus(),se&&ge.current&&ye.current.selectionEnd-ye.current.selectionStart===0&&ye.current.select(),ge.current=!1)},qn=ue=>{!b&&(Fe===""||!at)&&wt(ue)};let bn=T&&Fe.length>0;bn=bn||(k?le.length>0:le!==null);let dn=Te;return P&&(dn=Te.reduce((ue,fe,Ve)=>{const vt=P(fe);return ue.length>0&&ue[ue.length-1].group===vt?ue[ue.length-1].options.push(fe):ue.push({key:Ve,index:Ve,group:vt,options:[fe]}),ue},[])),b&&pt&&ut(),{getRootProps:(ue={})=>({...ue,onKeyDown:Le(ue),onMouseDown:Ht,onClick:On}),getInputLabelProps:()=>({id:`${oe}-label`,htmlFor:oe}),getInputProps:()=>({id:oe,value:Fe,onBlur:ut,onFocus:qe,onChange:Nt,onMouseDown:qn,"aria-activedescendant":We?"":null,"aria-autocomplete":r?"both":"list","aria-controls":Mt?`${oe}-listbox`:void 0,"aria-expanded":Mt,autoComplete:"off",ref:ye,autoCapitalize:"none",spellCheck:"false",role:"combobox",disabled:b}),getClearProps:()=>({tabIndex:-1,type:"button",onClick:Pe}),getItemProps:({index:ue=0}={})=>({...k&&{key:ue},...ne?{"data-item-index":ue}:{"data-tag-index":ue},tabIndex:-1,...!G&&{onDelete:k?At(ue):Et}}),getPopupIndicatorProps:()=>({tabIndex:-1,type:"button",onClick:wt}),getTagProps:({index:ue})=>({key:ue,"data-tag-index":ue,tabIndex:-1,...!G&&{onDelete:At(ue)}}),getListboxProps:()=>({role:"listbox",id:`${oe}-listbox`,"aria-labelledby":`${oe}-label`,ref:Wn,onMouseDown:ue=>{ue.preventDefault()}}),getOptionProps:({index:ue,option:fe})=>{const Ve=(k?le:[le]).some(Ke=>Ke!=null&&H(fe,Ke)),vt=M?M(fe):!1;return{key:R?.(fe)??ae(fe),tabIndex:-1,role:"option",id:`${oe}-option-${ue}`,onMouseMove:Bt,onClick:mt,onTouchStart:Dt,"data-option-index":ue,"aria-disabled":vt,"aria-selected":Ve}},id:oe,inputValue:Fe,value:le,dirty:bn,expanded:We&&Ce,popupOpen:We,focused:pt||de!==-1,anchorEl:Ce,setAnchorEl:$e,focusedItem:de,focusedTag:de,groupedOptions:dn}}function mue(e){return on("MuiListSubheader",e)}Gt("MuiListSubheader",["root","colorPrimary","colorInherit","gutters","inset","sticky"]);const gue=e=>{const{classes:t,color:n,disableGutters:r,inset:o,disableSticky:a}=e,s={root:["root",n!=="default"&&`color${Tt(n)}`,!r&&"gutters",o&&"inset",!a&&"sticky"]};return tn(s,mue,t)},yue=Ge("li",{name:"MuiListSubheader",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${Tt(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(Vn(({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}}]}))),kw=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiListSubheader"}),{className:r,color:o="default",component:a="li",disableGutters:s=!1,disableSticky:l=!1,inset:d=!1,...f}=n,c={...n,color:o,component:a,disableGutters:s,disableSticky:l,inset:d},m=gue(c);return h.jsx(yue,{as:a,className:jt(m.root,r),ref:t,ownerState:c,...f})});kw&&(kw.muiSkipListHighlight=!0);const vue=cr(h.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 bue(e){return on("MuiAutocomplete",e)}const Qn=Gt("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 NP,IP;const xue=e=>{const{classes:t,disablePortal:n,expanded:r,focused:o,fullWidth:a,hasClearIcon:s,hasPopupIcon:l,inputFocused:d,popupOpen:f,size:c}=e,m={root:["root",r&&"expanded",o&&"focused",a&&"fullWidth",s&&"hasClearIcon",l&&"hasPopupIcon"],inputRoot:["inputRoot"],input:["input",d&&"inputFocused"],tag:["tag",`tagSize${Tt(c)}`],endAdornment:["endAdornment"],clearIndicator:["clearIndicator"],popupIndicator:["popupIndicator",f&&"popupIndicatorOpen"],popper:["popper",n&&"popperDisablePortal"],paper:["paper"],listbox:["listbox"],loading:["loading"],noOptions:["noOptions"],option:["option"],groupLabel:["groupLabel"],groupUl:["groupUl"]};return tn(m,bue,t)},Sue=Ge("div",{name:"MuiAutocomplete",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e,{fullWidth:r,hasClearIcon:o,hasPopupIcon:a,inputFocused:s,size:l}=n;return[{[`& .${Qn.tag}`]:t.tag},{[`& .${Qn.tag}`]:t[`tagSize${Tt(l)}`]},{[`& .${Qn.inputRoot}`]:t.inputRoot},{[`& .${Qn.input}`]:t.input},{[`& .${Qn.input}`]:s&&t.inputFocused},t.root,r&&t.fullWidth,a&&t.hasPopupIcon,o&&t.hasClearIcon]}})({[`&.${Qn.focused} .${Qn.clearIndicator}`]:{visibility:"visible"},"@media (pointer: fine)":{[`&:hover .${Qn.clearIndicator}`]:{visibility:"visible"}},[`& .${Qn.tag}`]:{margin:3,maxWidth:"calc(100% - 6px)"},[`& .${Qn.inputRoot}`]:{[`.${Qn.hasPopupIcon}&, .${Qn.hasClearIcon}&`]:{paddingRight:30},[`.${Qn.hasPopupIcon}.${Qn.hasClearIcon}&`]:{paddingRight:56},[`& .${Qn.input}`]:{width:0,minWidth:30}},[`& .${Oc.root}`]:{paddingBottom:1,"& .MuiInput-input":{padding:"4px 4px 4px 0px"}},[`& .${Oc.root}.${ni.sizeSmall}`]:{[`& .${Oc.input}`]:{padding:"2px 4px 3px 0"}},[`& .${Mi.root}`]:{padding:9,[`.${Qn.hasPopupIcon}&, .${Qn.hasClearIcon}&`]:{paddingRight:39},[`.${Qn.hasPopupIcon}.${Qn.hasClearIcon}&`]:{paddingRight:65},[`& .${Qn.input}`]:{padding:"7.5px 4px 7.5px 5px"},[`& .${Qn.endAdornment}`]:{right:9}},[`& .${Mi.root}.${ni.sizeSmall}`]:{paddingTop:6,paddingBottom:6,paddingLeft:6,[`& .${Qn.input}`]:{padding:"2.5px 4px 2.5px 8px"}},[`& .${ri.root}`]:{paddingTop:19,paddingLeft:8,[`.${Qn.hasPopupIcon}&, .${Qn.hasClearIcon}&`]:{paddingRight:39},[`.${Qn.hasPopupIcon}.${Qn.hasClearIcon}&`]:{paddingRight:65},[`& .${ri.input}`]:{padding:"7px 4px"},[`& .${Qn.endAdornment}`]:{right:9}},[`& .${ri.root}.${ni.sizeSmall}`]:{paddingBottom:1,[`& .${ri.input}`]:{padding:"2.5px 4px"}},[`& .${ni.hiddenLabel}`]:{paddingTop:8},[`& .${ri.root}.${ni.hiddenLabel}`]:{paddingTop:0,paddingBottom:0,[`& .${Qn.input}`]:{paddingTop:16,paddingBottom:17}},[`& .${ri.root}.${ni.hiddenLabel}.${ni.sizeSmall}`]:{[`& .${Qn.input}`]:{paddingTop:8,paddingBottom:9}},[`& .${Qn.input}`]:{flexGrow:1,textOverflow:"ellipsis",opacity:0},variants:[{props:{fullWidth:!0},style:{width:"100%"}},{props:{size:"small"},style:{[`& .${Qn.tag}`]:{margin:2,maxWidth:"calc(100% - 4px)"}}},{props:{inputFocused:!0},style:{[`& .${Qn.input}`]:{opacity:1}}},{props:{multiple:!0},style:{[`& .${Qn.inputRoot}`]:{flexWrap:"wrap"}}}]}),wue=Ge("div",{name:"MuiAutocomplete",slot:"EndAdornment"})({position:"absolute",right:0,top:"50%",transform:"translate(0, -50%)"}),Cue=Ge(Gc,{name:"MuiAutocomplete",slot:"ClearIndicator"})({marginRight:-2,padding:4,visibility:"hidden"}),kue=Ge(Gc,{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)"}}]}),Tue=Ge(xk,{name:"MuiAutocomplete",slot:"Popper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Qn.option}`]:t.option},t.popper,n.disablePortal&&t.popperDisablePortal]}})(Vn(({theme:e})=>({zIndex:(e.vars||e).zIndex.modal,variants:[{props:{disablePortal:!0},style:{position:"absolute"}}]}))),Mue=Ge(hd,{name:"MuiAutocomplete",slot:"Paper"})(Vn(({theme:e})=>({...e.typography.body1,overflow:"auto"}))),Eue=Ge("div",{name:"MuiAutocomplete",slot:"Loading"})(Vn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),Oue=Ge("div",{name:"MuiAutocomplete",slot:"NoOptions"})(Vn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,padding:"14px 16px"}))),Rue=Ge("ul",{name:"MuiAutocomplete",slot:"Listbox"})(Vn(({theme:e})=>({listStyle:"none",margin:0,padding:"8px 0",maxHeight:"40vh",overflow:"auto",position:"relative",[`& .${Qn.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"},[`&.${Qn.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"},[`&.${Qn.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),[`&.${Qn.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}},[`&.${Qn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}}}))),$ue=Ge(kw,{name:"MuiAutocomplete",slot:"GroupLabel"})(Vn(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,top:-8}))),Pue=Ge("ul",{name:"MuiAutocomplete",slot:"GroupUl"})({padding:0,[`& .${Qn.option}`]:{paddingLeft:24}}),Due=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiAutocomplete"}),{autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:s=!1,ChipProps:l,className:d,clearIcon:f=NP||(NP=h.jsx(vue,{fontSize:"small"})),clearOnBlur:c=!n.freeSolo,clearOnEscape:m=!1,clearText:y="Clear",closeText:b="Close",componentsProps:v,defaultValue:x=n.multiple?[]:null,disableClearable:w=!1,disableCloseOnSelect:S=!1,disabled:T=!1,disabledItemsFocusable:M=!1,disableListWrap:R=!1,disablePortal:$=!1,filterOptions:P,filterSelectedOptions:N=!1,forcePopupIcon:V="auto",freeSolo:z=!1,fullWidth:W=!1,getLimitTagsText:H=me=>`+${me}`,getOptionDisabled:k,getOptionKey:I,getOptionLabel:F,isOptionEqualToValue:_,groupBy:j,handleHomeEndKeys:X=!n.freeSolo,id:Q,includeInputInList:te=!1,inputValue:Z,limitTags:G=-1,ListboxComponent:ne,ListboxProps:se,loading:pe=!1,loadingText:oe="Loading…",multiple:ae=!1,noOptionsText:ce="No options",onChange:ge,onClose:ye,onHighlightChange:we,onInputChange:Ce,onOpen:$e,open:de,openOnFocus:ke=!1,openText:et="Open",options:ze,PaperComponent:Ae,PopperComponent:le,popupIcon:bt=IP||(IP=h.jsx(rL,{})),readOnly:Fe=!1,renderGroup:it,renderInput:pt,renderOption:Ft,renderTags:_t,renderValue:at,selectOnFocus:Xe=!n.freeSolo,size:rt="medium",slots:Ne={},slotProps:he={},value:We,...Te}=n,{getRootProps:kt,getInputProps:Mt,getInputLabelProps:gt,getPopupIndicatorProps:ct,getClearProps:$t,getItemProps:Vt,getListboxProps:un,getOptionProps:vn,value:Bn,dirty:Wn,expanded:Qt,id:In,popupOpen:be,focused:zn,focusedItem:En,anchorEl:Xt,setAnchorEl:ie,inputValue:Pe,groupedOptions:Le}=hue({...n,componentName:"Autocomplete"}),qe=!w&&!T&&Wn&&!Fe,ut=(!z||V===!0)&&V!==!1,{onMouseDown:Nt}=Mt(),{ref:Bt,...Dt}=un(),mt=F||(me=>me.label??me),At={...n,disablePortal:$,expanded:Qt,focused:zn,fullWidth:W,getOptionLabel:mt,hasClearIcon:qe,hasPopupIcon:ut,inputFocused:En===-1,popupOpen:be,size:rt},Et=xue(At),wt={slots:{paper:Ae,popper:le,...Ne},slotProps:{chip:l,listbox:se,...v,...he}},[Ht,On]=ir("listbox",{elementType:Rue,externalForwardedProps:wt,ownerState:At,className:Et.listbox,additionalProps:Dt,ref:Bt}),[qn,bn]=ir("paper",{elementType:hd,externalForwardedProps:wt,ownerState:At,className:Et.paper}),[dn,ue]=ir("popper",{elementType:xk,externalForwardedProps:wt,ownerState:At,className:Et.popper,additionalProps:{disablePortal:$,style:{width:Xt?Xt.clientWidth:null},role:"presentation",anchorEl:Xt,open:be}});let fe;const Ve=me=>({className:Et.tag,disabled:T,...Vt(me)});if(ae?Bn.length>0&&(_t?fe=_t(Bn,Ve,At):at?fe=at(Bn,Ve,At):fe=Bn.map((me,Ee)=>{const{key:He,...yt}=Ve({index:Ee});return h.jsx(HI,{label:mt(me),size:rt,...yt,...wt.slotProps.chip},He)})):at&&Bn!=null&&(fe=at(Bn,Ve,At)),G>-1&&Array.isArray(fe)){const me=fe.length-G;!zn&&me>0&&(fe=fe.splice(0,G),fe.push(h.jsx("span",{className:Et.tag,children:H(me)},fe.length)))}const vt=it||(me=>h.jsxs("li",{children:[h.jsx($ue,{className:Et.groupLabel,ownerState:At,component:"div",children:me.group}),h.jsx(Pue,{className:Et.groupUl,ownerState:At,children:me.children})]},me.key)),Ke=Ft||((me,Ee)=>{const{key:He,...yt}=me;return h.jsx("li",{...yt,children:mt(Ee)},He)}),Zt=(me,Ee)=>{const He=vn({option:me,index:Ee});return Ke({...He,className:Et.option},me,{selected:He["aria-selected"],index:Ee,inputValue:Pe},At)},nn=wt.slotProps.clearIndicator,fn=wt.slotProps.popupIndicator;return h.jsxs(C.Fragment,{children:[h.jsx(Sue,{ref:t,className:jt(Et.root,d),ownerState:At,...kt(Te),children:pt({id:In,disabled:T,fullWidth:!0,size:rt==="small"?"small":void 0,InputLabelProps:gt(),InputProps:{ref:ie,className:Et.inputRoot,startAdornment:fe,onMouseDown:me=>{me.target===me.currentTarget&&Nt(me)},...(qe||ut)&&{endAdornment:h.jsxs(wue,{className:Et.endAdornment,ownerState:At,children:[qe?h.jsx(Cue,{...$t(),"aria-label":y,title:y,ownerState:At,...nn,className:jt(Et.clearIndicator,nn?.className),children:f}):null,ut?h.jsx(kue,{...ct(),disabled:T,"aria-label":be?b:et,title:be?b:et,ownerState:At,...fn,className:jt(Et.popupIndicator,fn?.className),children:bt}):null]})}},inputProps:{className:Et.input,disabled:T,readOnly:Fe,...Mt()}})}),Xt?h.jsx(Tue,{as:dn,...ue,children:h.jsxs(Mue,{as:qn,...bn,children:[pe&&Le.length===0?h.jsx(Eue,{className:Et.loading,ownerState:At,children:oe}):null,Le.length===0&&!z&&!pe?h.jsx(Oue,{className:Et.noOptions,ownerState:At,role:"presentation",onMouseDown:me=>{me.preventDefault()},children:ce}):null,Le.length>0?h.jsx(Ht,{as:ne,...On,children:Le.map((me,Ee)=>j?vt({key:me.key,group:me.group,children:me.options.map((He,yt)=>Zt(He,me.index+yt))}):Zt(me,Ee))}):null]})}):null]})});function Aue({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a}){return pn.useEffect(()=>{o&&o(t)},[t,o]),h.jsx(dN,{children:h.jsxs(V6,{spacing:2,component:"section",children:[h.jsx(Nue,{sourceAndPath:e[t],existingQuery:n,onChange:s=>{r&&r(s)},resourceUri:a}),h.jsx(vA,{height:"5px"})]})})}function eS(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function jue({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a}){const[s,l]=pn.useState(n||eS()),[d,f]=pn.useState(void 0);pn.useEffect(()=>{n&&l(n)},[n]);const[c,m]=pn.useState([]),{MalloyExplorerProvider:y,QueryPanel:b,ResizableCollapsiblePanel:v,ResultPanel:x,SourcePanel:w}=r;pn.useEffect(()=>{t&&t(s)},[t,s]);const{environmentName:S,packageName:T,versionId:M}=xo(a),{apiClients:R}=zr(),$=Ws({mutationFn:()=>{const z=typeof s?.malloyQuery=="string"?s.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:s?.malloyQuery}).toMalloy();return f({executionState:"running",query:s?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{$.reset(),f(void 0)},response:{result:{}}}),l({...s,query:z}),R.models.executeQueryModel(S,T,e.modelPath,{query:z,sourceName:void 0,queryName:void 0,versionId:M})},onSuccess:z=>{if(z){const W=JSON.parse(z.data.result);l({...s,malloyResult:W}),f(H=>H?{...H,executionState:"finished",response:{result:W}}:void 0)}},onError:z=>{f(void 0),console.error("Query execution error:",z)}}),[P,N]=pn.useState(e.sourceInfo.name);pn.useEffect(()=>{P!==e.sourceInfo.name&&(N(e.sourceInfo.name),l(eS()),f(void 0))},[e,P]);const V=pn.useCallback(z=>{l({...s,malloyQuery:z,malloyResult:void 0})},[s]);return P!==e.sourceInfo.name?h.jsx("div",{children:"Loading..."}):h.jsx(fN,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:h.jsx(y,{source:e.sourceInfo,query:s?.malloyQuery,topValues:[],onFocusedNestViewPathChange:m,focusedNestViewPath:c,onQueryChange:V,children:h.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[h.jsx(v,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:h.jsx(w,{onRefresh:()=>l(eS())})}),h.jsx(v,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:h.jsx(b,{runQuery:()=>{console.log(`running query with: ${s?.malloyQuery}`);try{$.mutate()}catch(z){console.error("Error running query:",z)}}})}),h.jsx(x,{source:e.sourceInfo,draftQuery:s?.malloyQuery,setDraftQuery:z=>l({...s,malloyQuery:z}),submittedQuery:d,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function Nue(e){const[t,n]=C.useState(null),[r,o]=C.useState(null),[a,s]=C.useState(!0);return C.useEffect(()=>{let l=!0;return Promise.all([Lo(()=>import("./index-kt4oTEGz.js"),__vite__mapDeps([0,1,2,3,4,5,6])),Lo(()=>import("./index-DCizS2BO.js").then(d=>d.i),__vite__mapDeps([4,3,2]))]).then(([d,f])=>{l&&(n(d),o(f),s(!1))}).catch(d=>{console.error("Failed to load Malloy components:",d),l&&s(!1)}),()=>{l=!1}},[]),a||!t||!r?h.jsx(OK,{children:h.jsx(fN,{children:h.jsx(vA,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):h.jsx(jue,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function Nk(e,t=!0){const{modelPath:n,environmentName:r,packageName:o,versionId:a}=xo(e),{apiClients:s}=zr();return co({queryKey:["package",r,o,n,a],queryFn:async()=>(await s.models.getModel(r,o,n,a)).data,enabled:t})}function CL({data:e,onChange:t,existingQuery:n,initialSelectedSourceIndex:r=0,onSourceChange:o,resourceUri:a}){const[s,l]=pn.useState(r);pn.useEffect(()=>{l(r)},[r]);const{data:d,isError:f,isLoading:c,error:m}=Nk(a,!e),{modelPath:y}=xo(a),b=e||d;if(c&&!e)return h.jsx(oa,{text:"Fetching Model..."});if(f&&!e)return console.log("error",m),h.jsx(ha,{error:m,context:`ModelExplorer > ${y}`});if(!b)return h.jsx(oa,{text:"Loading..."});const v=(b?.sourceInfos||[]).map((w,S)=>{try{return JSON.parse(w)?.name||`Source ${S+1}`}catch{return`Source ${S+1}`}}),x=v[s]||"";return h.jsxs(kK,{variant:"outlined",children:[h.jsx(TK,{children:h.jsx(fr,{sx:{flexDirection:"row"},children:h.jsx(Due,{size:"small",id:"size-small-standard",disablePortal:!0,options:v,value:x,onChange:(w,S)=>{if(!S)return;const T=v.indexOf(S);T>=0&&(l(T),o?.(T))},renderInput:w=>h.jsx(hr,{...w}),style:{width:350,marginTop:"3px",marginLeft:"6px",marginBottom:"8px"}})})}),h.jsx(dN,{children:h.jsxs(fr,{spacing:2,component:"section",children:[Array.isArray(b.sourceInfos)&&b.sourceInfos.length>0&&h.jsx(Aue,{sourceAndPaths:b.sourceInfos.map(w=>({sourceInfo:JSON.parse(w),modelPath:y})),selectedSourceIndex:s,existingQuery:n,onQueryChange:t,resourceUri:a}),h.jsx(Kt,{height:"5px"})]})})]})}function Ik({open:e,onClose:t,resourceUri:n,data:r,title:o="Data Sources",hasValidImport:a=!0,existingQuery:s,initialSelectedSourceIndex:l,onChange:d,onSourceChange:f}){return h.jsxs(Yf,{open:e,onClose:t,fullScreen:!0,children:[h.jsxs(Gf,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o,h.jsx(eo,{onClick:t,sx:{color:"text.secondary"},children:h.jsx(Jf,{})})]}),h.jsx(Kf,{children:a?h.jsx(CL,{resourceUri:n,data:r,existingQuery:s,initialSelectedSourceIndex:l,onChange:d,onSourceChange:f}):h.jsx("div",{children:"No valid import statement found in cell"})})]})}function Iue(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function Lue(e,t){if(e==null||e==="")return;const n=r=>`'${Iue(r)}'`;switch(t===void 0?zue(e):t.startsWith("filter<")?"filter":t){case"filter":return`f${n(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=LP(e);return r&&`@${r}`}case"timestamp":{const r=LP(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 zue(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 LP(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 Fue="[A-Za-z_][A-Za-z0-9_]*",zP=e=>new RegExp(`^${Fue}$`).test(e),Fhe=e=>e.findIndex(t=>t.trimStart().startsWith("##")&&t.includes("artifact"));function Bue(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 FP=()=>typeof performance<"u"?performance.now():Date.now(),kL=200;function Uue(e){const t=Lue(e.rawValue);if(t!==void 0)return`run: ${e.source} -> { drill: ${e.view}.${e.field} = ${t}; select: *; limit: ${kL} }`}function Lk(e){const t=Bue(e);if(!(!t||t.refinement!==void 0||!zP(t.source)||!zP(t.view)))return{source:t.source,view:t.view}}const _ue=e=>Lk(e)?.source;function Vue({request:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:a,onClose:s,onDone:l}){const{theme:d}=ol(),f=e?Uue(e):void 0;return h.jsxs(Yf,{open:e!==void 0,onClose:s,maxWidth:"lg",fullWidth:!0,children:[h.jsxs(Gf,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",pb:.5},children:[h.jsxs(Kt,{children:[e?h.jsxs(h.Fragment,{children:["Rows where"," ",h.jsx(Kt,{component:"code",sx:{fontSize:"0.9em"},children:e.field})," ","is ",e.label]}):"Rows",h.jsx(Lt,{component:"div",variant:"caption",sx:{color:d.tileTitle,mt:.25},children:e?`The first ${kL} rows of ${e.source} behind this value, with the tile's own filters and the controls applied.`:""})]}),h.jsx(eo,{onClick:s,"aria-label":"Close",size:"small",sx:{color:"text.secondary",ml:1},children:h.jsx(Jf,{fontSize:"small"})})]}),h.jsxs(Kf,{dividers:!0,sx:{p:0,minHeight:240},children:[f===void 0&&e&&h.jsx(Lt,{variant:"body2",sx:{p:2},children:"This value cannot be written as a filter, so its rows cannot be fetched."}),f!==void 0&&h.jsx(Hue,{query:f,environmentName:t,packageName:n,...r===void 0?{}:{versionId:r},modelPath:o,givens:a,...l?{onDone:l}:{}})]}),h.jsxs(fj,{sx:{px:3,py:1.5},children:[f!==void 0&&h.jsx(Lt,{variant:"caption",sx:{mr:"auto",color:d.tileTitle,fontFamily:"ui-monospace, monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:f,children:f}),h.jsx(Ko,{onClick:s,children:"Close"})]})]})}function Hue({query:e,environmentName:t,packageName:n,versionId:r,modelPath:o,givens:a,onDone:s}){const l=Dk({environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r},query:e,givens:a}),{isSuccess:d,isError:f}=l,c=C.useRef(void 0);return C.useEffect(()=>{c.current=FP()},[e]),C.useEffect(()=>{c.current===void 0||!d&&!f||(s?.(d,FP()-c.current),c.current=void 0)},[d,f,s]),h.jsx(Kt,{sx:{p:1},children:h.jsx(jk,{state:l,context:e})})}function Wue({tile:e,environmentName:t,packageName:n,versionId:r,modelPath:o,onClose:a}){const s=u0({environmentName:t,packageName:n,modelPath:o,...r===void 0?{}:{versionId:r}}),{data:l}=Nk(s,e!==void 0),d=C.useMemo(()=>{const c=_ue(e);if(!l||c===void 0)return 0;const m=(l.sourceInfos??[]).findIndex(y=>{try{return JSON.parse(y)?.name===c}catch{return!1}});return m<0?0:m},[l,e]),f=C.useMemo(()=>{if(e===void 0)return;const c=Lk(e),m=c?{definition:{kind:"arrow",source:{kind:"source_reference",name:c.source},view:{kind:"view_reference",name:c.view}}}:`run: ${e}`;return{query:`run: ${e}`,malloyQuery:m,malloyResult:void 0}},[e]);return e===void 0||!l?null:h.jsx(Ik,{open:!0,onClose:a,resourceUri:s,data:l,title:`Explore: ${e}`,existingQuery:f,initialSelectedSourceIndex:d})}function Bhe({resourceUri:e,dashboard:t,givens:n,onGivensChange:r,onNavigate:o,height:a,maxResultSize:s,onEvent:l}){const d=xo(e),{apiClients:f}=zr(),c=d.environmentName??"",m=d.packageName??"",y=d.versionId,b=!!d.environmentName&&!!d.packageName,{data:v,isSuccess:x,isError:w,error:S}=co({queryKey:["dashboard",c,m,y,t],queryFn:()=>f.dashboards.getDashboard(c,m,t,y),enabled:b}),T=v?.data,M=C.useMemo(()=>T?.givens??[],[T]),R=JN({specs:M,loaded:x,startingValues:T?.startingGivens,params:n,onGivensChange:r,documentKey:`${c}/${m}/${y??""}/${t}`,autorun:T?.autorun!==!1,environmentName:c,packageName:m,modelPath:T?.path,versionId:y,documentName:t}),{applied:$,declaredTypes:P,canSelf:N,onSelf:V}=R,[z,W]=C.useState(void 0),[H,k]=C.useState(void 0),I=C.useCallback(G=>{const ne=Lk(G.context);ne!==void 0&&W({...ne,field:G.field,rawValue:G.rawValue,label:G.label})},[]),F=C.useMemo(()=>c0($,P),[$,P]),{drill:_,drillMenu:j}=eI({onNavigate:o,onSelf:V,canSelf:N,selfLabel:"Filter this dashboard",onRows:I}),X=C.useCallback(G=>({canDrill:_.canDrill,onClick:ne=>_.onClick({...ne,context:G})}),[_]);if(!b)return h.jsxs($c,{severity:"error",children:["A dashboard resource URI must name an environment and a package. Received: ",e]});if(w)return h.jsx(ha,{context:`${c} > ${m} > ${t}`,error:S});if(!x||!T)return h.jsx(oa,{text:"Loading dashboard…"});if(T.error)return h.jsxs(fr,{spacing:2,children:[h.jsx(BP,{manifest:T}),h.jsx($c,{severity:"error",children:T.error})]});const Q=T.path,te=T.tiles??[],Z=T.dashboardColumns??Wce;return h.jsxs(fr,{spacing:2,children:[h.jsx(BP,{manifest:T}),h.jsx(xL,{...R.panel,layout:"bar"}),Q===void 0?h.jsx($c,{severity:"error",children:"This dashboard has no model path, so there is nothing to run."}):T.query!==void 0?h.jsx($P,{environmentName:c,packageName:m,versionId:y,modelPath:Q,queryName:T.query,givens:$,declaredTypes:P,height:a,maxResultSize:s,drill:_}):te.length>0?h.jsx(Kce,{tiles:te,columns:Z,keyOf:(G,ne)=>`${ne}:${G.query}`,renderTile:G=>h.jsx($P,{environmentName:c,packageName:m,versionId:y,modelPath:Q,tile:G.query,label:G.label,subtitle:G.subtitle,borderless:G.borderless,givens:$,declaredTypes:P,givenNames:G.givenNames,height:a??zce,maxResultSize:s,drill:X(G.query),onExplore:()=>{k(G.query),l?.({type:"dashboard.explored",tile:G.query})}})}):h.jsx($c,{severity:"warning",children:"This dashboard names neither a query nor any tiles."}),j,Q!==void 0&&h.jsxs(h.Fragment,{children:[h.jsx(Vue,{request:z,environmentName:c,packageName:m,...y===void 0?{}:{versionId:y},modelPath:Q,givens:F,onClose:()=>W(void 0),onDone:(G,ne)=>{z&&l?.({type:"dashboard.rows_shown",source:z.source,view:z.view,field:z.field,ok:G,durationMs:ne})}}),h.jsx(Wue,{tile:H,environmentName:c,packageName:m,...y===void 0?{}:{versionId:y},modelPath:Q,onClose:()=>k(void 0)})]})]})}function BP({manifest:e}){return h.jsx(que,{title:e.title??e.name,...e.description?{description:e.description}:{}})}function que({title:e,description:t}){return h.jsxs(Kt,{children:[h.jsx(Lt,{variant:"h5",sx:{fontWeight:600},children:e}),t&&h.jsx(ab,{variant:"caption",children:t})]})}const Yue=cr(h.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})),TL=C.createContext(void 0);function Kue({children:e,documentStorage:t}){const n=C.useMemo(()=>({documentStorage:t}),[t]);return h.jsx(TL.Provider,{value:n,children:e})}function Gue(){return C.useContext(TL)}class ML extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const Uhe=e=>e instanceof ML||e instanceof Error&&e.name==="DocumentNotFoundError",Que=cr(h.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}));function EL({label:e,href:t,onClick:n}){return h.jsxs(a9,{...t===void 0?{component:"button",type:"button"}:{href:t},onClick:r=>{const o=r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.button!==0;t!==void 0&&o||(r.preventDefault(),n(r))},underline:"none","aria-label":`Back to ${e}`,sx:{display:"inline-flex",alignItems:"center",gap:.5,cursor:"pointer",color:"text.secondary",fontSize:"0.875rem",mb:2,border:0,p:0,background:"none",font:"inherit","&:hover":{color:"primary.main"}},children:[h.jsx(Que,{sx:{fontSize:18}}),"Back to ",e]})}function _he(){const e=eg();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 Vhe(){const[e]=k4(),t=eg(),n=tl(),r=C.useMemo(()=>Object.fromEntries(e.entries()),[e]),o=C.useRef(new Set),a=C.useCallback((s,l)=>{const d=new Set([...l,...o.current]);o.current=new Set([...o.current,...Object.keys(s),...l]);const f=new URLSearchParams(n.search);for(const c of d)Object.prototype.hasOwnProperty.call(s,c)||f.delete(c);for(const[c,m]of Object.entries(s))f.set(c,m);t({search:f.toString(),hash:n.hash},{replace:!0})},[t,n]);return{params:r,onGivensChange:a}}const OL=cr(h.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"})),Xue="publisher:resize";function Zue(e){return typeof e=="object"&&e!==null&&e.type===Xue&&typeof e.height=="number"}function RL(e){return e.replace(/\/api\/v0\/?$/,"")}function Jue({server:e,environmentName:t,packageName:n,path:r}){const o=r.startsWith("public/")?r.slice(7):r;return`${RL(e)}/environments/${encodeURIComponent(t)}/packages/${encodeURIComponent(n)}/`+o}function ede(e){try{const{environmentName:t,packageName:n,modelPath:r}=xo(e);return!t||!n||!r?null:{environmentName:t,packageName:n,dataAppPath:r}}catch{return null}}function Hhe({resourceUri:e}){const{server:t,apiClients:n}=zr(),r=ede(e),o=r?.environmentName??"",a=r?.packageName??"",s=r?.dataAppPath??"",l=C.useMemo(()=>Jue({server:t,environmentName:o,packageName:a,path:s}),[t,o,a,s]),d=co({queryKey:["data-apps",o,a],queryFn:()=>n.dataApps.listDataApps(o,a),enabled:!!r}).data?.data?.find(v=>v.path===s),f=d?.title??s,c=d?.fit==="viewport",m=C.useRef(null),[y,b]=C.useState(120);return C.useEffect(()=>{if(c)return;function v(x){Zue(x.data)&&x.source===m.current?.contentWindow&&x.data.height>0&&b(Math.ceil(x.data.height))}return window.addEventListener("message",v),()=>window.removeEventListener("message",v)},[c]),r?h.jsxs(Kt,{sx:{p:3,...c?{height:"100%",display:"flex",flexDirection:"column"}:{maxWidth:1200,mx:"auto"}},children:[h.jsxs(fr,{direction:"row",alignItems:"baseline",spacing:1,sx:{mb:1,flexShrink:0},children:[h.jsx(Lt,{variant:"h6",sx:{fontWeight:600,letterSpacing:"-0.025em"},children:f}),h.jsx(Lt,{variant:"caption",color:"text.secondary",sx:{fontFamily:Ai},children:s}),h.jsx(Kt,{sx:{flex:1}}),h.jsx(Ui,{title:"Open standalone in new tab",children:h.jsx(eo,{size:"small",href:l,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",sx:{color:"text.secondary"},children:h.jsx(OL,{fontSize:"small"})})})]}),h.jsx(Kt,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,overflow:"hidden",backgroundColor:"background.paper",...c?{flex:1,minHeight:0}:{}},children:h.jsx("iframe",{ref:m,src:l,title:f,sandbox:"allow-scripts allow-same-origin allow-forms",style:{display:"block",width:"100%",height:c?"100%":y,border:0}})})]}):h.jsxs(Kt,{sx:{p:3,maxWidth:1200,mx:"auto"},children:[h.jsx(Lt,{variant:"h6",sx:{fontWeight:600},children:"Can't open data app"}),h.jsxs(Lt,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["This data app link is missing an environment, package, or path:",h.jsx(Kt,{component:"span",sx:{fontFamily:Ai,ml:1},children:e})]})]})}function us({title:e,count:t,description:n,action:r,children:o}){const a=C.useId();return h.jsxs(Kt,{component:"section","aria-labelledby":a,sx:{mb:4},children:[h.jsxs(fr,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:n?0:1,minHeight:40},children:[h.jsxs(fr,{direction:"row",alignItems:"baseline",spacing:1,children:[h.jsx(Lt,{id:a,variant:"h6",sx:{fontWeight:600,letterSpacing:"-0.025em",lineHeight:1.2},children:e}),t!==void 0&&h.jsxs(Lt,{variant:"caption",color:"text.secondary",children:["(",t,")"]})]}),r]}),n&&h.jsx(Lt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:n}),h.jsx(Kt,{children:o})]})}function tde({resourceUri:e}){const{environmentName:t}=xo(e),{apiClients:n}=zr(),[r,o]=C.useState(!1),a=90,{data:s,isSuccess:l,isError:d,error:f}=co({queryKey:["about",t],queryFn:()=>n.environments.getEnvironment(t,!1)}),c=s?.data?.readme||"",m=c.split(/\s+/),y=m.length>a,b=m.slice(0,a).join(" ");return h.jsxs(h.Fragment,{children:[!l&&!d&&h.jsx(oa,{text:"Fetching About..."}),l&&c&&h.jsxs(us,{title:"Readme",children:[h.jsx(ab,{variant:"caption",children:r||!y?c:b}),y&&h.jsx(Kt,{sx:{mt:1},children:h.jsx(Sg,{label:r?"Read less":"Read more",onClick:()=>o(!r)})})]}),d&&h.jsx(ha,{error:f,context:`${t} > About`})]})}function nde(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:o,resumeHideDuration:a}=e,s=ak();C.useEffect(()=>{if(!o)return;function w(S){S.defaultPrevented||S.key==="Escape"&&r?.(S,"escapeKeyDown")}return document.addEventListener("keydown",w),()=>{document.removeEventListener("keydown",w)}},[o,r]);const l=It((w,S)=>{r?.(w,S)}),d=It(w=>{!r||w==null||s.start(w,()=>{l(null,"timeout")})});C.useEffect(()=>(o&&d(t),s.clear),[o,t,d,s]);const f=w=>{r?.(w,"clickaway")},c=s.clear,m=C.useCallback(()=>{t!=null&&d(a??t*.5)},[t,a,d]),y=w=>S=>{const T=w.onBlur;T?.(S),m()},b=w=>S=>{const T=w.onFocus;T?.(S),c()},v=w=>S=>{const T=w.onMouseEnter;T?.(S),c()},x=w=>S=>{const T=w.onMouseLeave;T?.(S),m()};return C.useEffect(()=>{if(!n&&o)return window.addEventListener("focus",m),window.addEventListener("blur",c),()=>{window.removeEventListener("focus",m),window.removeEventListener("blur",c)}},[n,o,m,c]),{getRootProps:(w={})=>{const S={...Qv(e),...Qv(w)};return{role:"presentation",...w,...S,onBlur:y(S),onFocus:b(S),onMouseEnter:v(S),onMouseLeave:x(S)}},onClickAway:f}}function UP(e){return e.substring(2).toLowerCase()}function rde(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function ode(e){const{children:t,disableReactTree:n=!1,mouseEvent:r="onClick",onClickAway:o,touchEvent:a="onTouchEnd"}=e,s=C.useRef(!1),l=C.useRef(null),d=C.useRef(!1),f=C.useRef(!1);C.useEffect(()=>(setTimeout(()=>{d.current=!0},0),()=>{d.current=!1}),[]);const c=mr(gp(t),l),m=It(v=>{const x=f.current;f.current=!1;const w=$o(l.current);if(!d.current||!l.current||"clientX"in v&&rde(v,w))return;if(s.current){s.current=!1;return}let S;v.composedPath?S=v.composedPath().includes(l.current):S=!w.documentElement.contains(v.target)||l.current.contains(v.target),!S&&(n||!x)&&o(v)}),y=v=>x=>{f.current=!0;const w=t.props[v];w&&w(x)},b={ref:c};return a!==!1&&(b[a]=y(a)),C.useEffect(()=>{if(a!==!1){const v=UP(a),x=$o(l.current),w=()=>{s.current=!0};return x.addEventListener(v,m),x.addEventListener("touchmove",w),()=>{x.removeEventListener(v,m),x.removeEventListener("touchmove",w)}}},[m,a]),r!==!1&&(b[r]=y(r)),C.useEffect(()=>{if(r!==!1){const v=UP(r),x=$o(l.current);return x.addEventListener(v,m),()=>{x.removeEventListener(v,m)}}},[m,r]),C.cloneElement(t,b)}function ade(e){return on("MuiSnackbarContent",e)}Gt("MuiSnackbarContent",["root","message","action"]);const ide=e=>{const{classes:t}=e;return tn({root:["root"],action:["action"],message:["message"]},ade,t)},sde=Ge(hd,{name:"MuiSnackbarContent",slot:"Root"})(Vn(({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(ew(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:ew(e.palette.background.default,t),display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}}})),lde=Ge("div",{name:"MuiSnackbarContent",slot:"Message"})({padding:"8px 0"}),cde=Ge("div",{name:"MuiSnackbarContent",slot:"Action"})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),ude=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiSnackbarContent"}),{action:r,className:o,message:a,role:s="alert",...l}=n,d=n,f=ide(d);return h.jsxs(sde,{role:s,elevation:6,className:jt(f.root,o),ownerState:d,ref:t,...l,children:[h.jsx(lde,{className:f.message,ownerState:d,children:a}),r?h.jsx(cde,{className:f.action,ownerState:d,children:r}):null]})});function dde(e){return on("MuiSnackbar",e)}Gt("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const fde=e=>{const{classes:t,anchorOrigin:n}=e,r={root:["root",`anchorOrigin${Tt(n.vertical)}${Tt(n.horizontal)}`]};return tn(r,dde,t)},pde=Ge("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`anchorOrigin${Tt(n.anchorOrigin.vertical)}${Tt(n.anchorOrigin.horizontal)}`]]}})(Vn(({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%)"}}}]}))),hde=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiSnackbar"}),r=fd(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:a,anchorOrigin:{vertical:s,horizontal:l}={vertical:"bottom",horizontal:"left"},autoHideDuration:d=null,children:f,className:c,ClickAwayListenerProps:m,ContentProps:y,disableWindowBlurListener:b=!1,message:v,onBlur:x,onClose:w,onFocus:S,onMouseEnter:T,onMouseLeave:M,open:R,resumeHideDuration:$,slots:P={},slotProps:N={},TransitionComponent:V,transitionDuration:z=o,TransitionProps:{onEnter:W,onExited:H,...k}={},...I}=n,F={...n,anchorOrigin:{vertical:s,horizontal:l},autoHideDuration:d,disableWindowBlurListener:b,TransitionComponent:V,transitionDuration:z},_=fde(F),{getRootProps:j,onClickAway:X}=nde({...F}),[Q,te]=C.useState(!0),Z=$e=>{te(!0),H&&H($e)},G=($e,de)=>{te(!1),W&&W($e,de)},ne={slots:{transition:V,...P},slotProps:{content:y,clickAwayListener:m,transition:k,...N}},[se,pe]=ir("root",{ref:t,className:[_.root,c],elementType:pde,getSlotProps:j,externalForwardedProps:{...ne,...I},ownerState:F}),[oe,{ownerState:ae,...ce}]=ir("clickAwayListener",{elementType:ode,externalForwardedProps:ne,getSlotProps:$e=>({onClickAway:(...de)=>{const ke=de[0];$e.onClickAway?.(...de),!ke?.defaultMuiPrevented&&X(...de)}}),ownerState:F}),[ge,ye]=ir("content",{elementType:ude,shouldForwardComponentProp:!0,externalForwardedProps:ne,additionalProps:{message:v,action:a},ownerState:F}),[we,Ce]=ir("transition",{elementType:Ym,externalForwardedProps:ne,getSlotProps:$e=>({onEnter:(...de)=>{$e.onEnter?.(...de),G(...de)},onExited:(...de)=>{$e.onExited?.(...de),Z(...de)}}),additionalProps:{appear:!0,in:R,timeout:z,direction:s==="top"?"down":"up"},ownerState:F});return!R&&Q?null:h.jsx(oe,{...ce,...P.clickAwayListener&&{ownerState:ae},children:h.jsx(se,{...pe,children:h.jsx(we,{...Ce,children:f||h.jsx(ge,{...ye})})})})});let Tw;function mde(e){Tw=e}function _P(e){if(Tw)try{Tw(e)}catch{}}function Pl(e,t,n){return(async r=>{const o=Date.now();try{const a=await n(r);return _P({type:"console.mutation",resource:e,action:t,ok:!0,durationMs:Date.now()-o}),a}catch(a){throw _P({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 yp({mutationFn:e,success:t,invalidates:n,closeDialog:r,resource:o,action:a}){const s=dd(),[l,d]=C.useState(""),f=Ws({mutationFn:Pl(o,a,e),onSuccess(){r();for(const c of n)s.invalidateQueries({queryKey:c});d(t)},onError(c){d(c instanceof Error?c.message:"An unknown error occurred")}});return{mutate:f.mutate,isPending:f.isPending,notice:h.jsx(hde,{open:l!=="",autoHideDuration:6e3,onClose:()=>d(""),message:l})}}const $L="https://docs.malloydata.dev/documentation",VP=`${$L}/user_guides/publishing`,nv="https://github.com/malloydata/publisher/blob/main/docs",kc={docsHome:`${$L}/`,publishing:`${VP}/publishing`,mcpAgents:`${VP}/mcp_agents`,surfaces:`${nv}/choosing-a-surface.md`,givens:`${nv}/givens.md`,materialization:`${nv}/materialization.md`,connections:`${nv}/connections.md`};function gde({resourceUri:e}){const[t,n]=C.useState(!1),{apiClients:r}=zr(),{environmentName:o}=xo(e),a=yp({mutationFn(l){return r.packages.createPackage(o,{name:l.name,description:l.description,location:l.location})},success:"Package created",invalidates:[["packages",o]],closeDialog:()=>n(!1),resource:"package",action:"create"}),s=l=>{l.preventDefault();const d=new FormData(l.currentTarget),f=d.get("name")?.toString(),c=d.get("description")?.toString(),m=d.get("location")?.toString();a.mutate({name:f,description:c,location:m})};return h.jsxs(h.Fragment,{children:[h.jsx(xg,{label:"Package",onClick:()=>n(!0)}),h.jsx(aa,{open:t,onClose:()=>n(!1),title:"New package",description:h.jsxs(h.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"," ",h.jsx(Kt,{component:"a",href:kc.publishing,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary"},children:"package format"}),"."]}),actions:h.jsxs(h.Fragment,{children:[h.jsx(Ko,{disabled:a.isPending,onClick:()=>n(!1),children:"Cancel"}),h.jsx(Ko,{type:"submit",form:"package-form",variant:"contained",loading:a.isPending,children:"Create package"})]}),children:h.jsx("form",{onSubmit:s,id:"package-form",children:h.jsxs(fr,{sx:{gap:2},children:[h.jsx(ii,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),h.jsx(ii,{id:"description",name:"description",label:"Description",multiline:!0,rows:3,fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),h.jsx(ii,{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 yde=cr(h.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}));function C0({icon:e,tint:t,label:n,mono:r,description:o,rightLabel:a,trailingAction:s,onClick:l,ariaLabel:d}){const f=!!l;return h.jsxs(Kt,{onClick:l,onKeyDown:f?c=>{l&&(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),l(c))}:void 0,role:f?"button":void 0,tabIndex:f?0:void 0,"aria-label":d,sx:c=>({display:"flex",alignItems:"center",gap:1.5,py:1,px:1,mx:-1,cursor:f?"pointer":"default",borderRadius:1.5,transition:"background-color 0.1s","&:hover":f?{backgroundColor:c.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}:void 0,"&:focus-visible":f?{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}:void 0}),children:[h.jsx(Kt,{sx:{width:32,height:32,borderRadius:1,bgcolor:t,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e}),h.jsxs(Kt,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"baseline",gap:1.5},children:[h.jsx(Lt,{variant:"body2",sx:{...r?{fontFamily:Ai}:{},flexShrink:0,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),o&&h.jsx(Lt,{variant:"body2",color:"text.secondary",sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o})]}),a&&h.jsx(Lt,{variant:"caption",color:"text.secondary",sx:{flexShrink:0},children:a}),s&&h.jsx(Kt,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:s})]})}const PL=cr(h.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"})),vde=Gt("MuiBox",["root"]),bde=FN(),Ma=rC({themeId:mp,defaultTheme:bde,defaultClassName:vde.root,generateClassName:TN.generate}),k0=uC({createStyledComponent:Ge("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>Hn({props:e,name:"MuiStack"})}),HP=Gt("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);function xde(e){return on("MuiListItemIcon",e)}const WP=Gt("MuiListItemIcon",["root","alignItemsFlexStart"]),Sde=e=>{const{alignItems:t,classes:n}=e;return tn({root:["root",t==="flex-start"&&"alignItemsFlexStart"]},xde,n)},wde=Ge("div",{name:"MuiListItemIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.alignItems==="flex-start"&&t.alignItemsFlexStart]}})(Vn(({theme:e})=>({minWidth:56,color:(e.vars||e).palette.action.active,flexShrink:0,display:"inline-flex",variants:[{props:{alignItems:"flex-start"},style:{marginTop:8}}]}))),zk=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiListItemIcon"}),{className:r,...o}=n,a=C.useContext(Al),s={...n,alignItems:a.alignItems},l=Sde(s);return h.jsx(wde,{className:jt(l.root,r),ownerState:s,ref:t,...o})});function Cde(e){return on("MuiListItemText",e)}const Df=Gt("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]),kde=e=>{const{classes:t,inset:n,primary:r,secondary:o,dense:a}=e;return tn({root:["root",n&&"inset",a&&"dense",r&&o&&"multiline"],primary:["primary"],secondary:["secondary"]},Cde,t)},Tde=Ge("div",{name:"MuiListItemText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Df.primary}`]:t.primary},{[`& .${Df.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,[`.${U$.root}:where(& .${Df.primary})`]:{display:"block"},[`.${U$.root}:where(& .${Df.secondary})`]:{display:"block"},variants:[{props:({ownerState:e})=>e.primary&&e.secondary,style:{marginTop:6,marginBottom:6}},{props:({ownerState:e})=>e.inset,style:{paddingLeft:56}}]}),Fk=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiListItemText"}),{children:r,className:o,disableTypography:a=!1,inset:s=!1,primary:l,primaryTypographyProps:d,secondary:f,secondaryTypographyProps:c,slots:m={},slotProps:y={},...b}=n,{dense:v}=C.useContext(Al);let x=l??r,w=f;const S={...n,disableTypography:a,inset:s,primary:!!x,secondary:!!w,dense:v},T=kde(S),M={slots:m,slotProps:{primary:d,secondary:c,...y}},[R,$]=ir("root",{className:jt(T.root,o),elementType:Tde,externalForwardedProps:{...M,...b},ownerState:S,ref:t}),[P,N]=ir("primary",{className:T.primary,elementType:br,externalForwardedProps:M,ownerState:S}),[V,z]=ir("secondary",{className:T.secondary,elementType:br,externalForwardedProps:M,ownerState:S});return x!=null&&x.type!==br&&!a&&(x=h.jsx(P,{variant:v?"body2":"body1",component:N?.variant?void 0:"span",...N,children:x})),w!=null&&w.type!==br&&!a&&(w=h.jsx(V,{variant:"body2",color:"textSecondary",...z,children:w})),h.jsxs(R,{...$,children:[x,w]})});function Mde(e){return on("MuiMenuItem",e)}const Kh=Gt("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]),Ede=(e,t)=>{const{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},Ode=e=>{const{disabled:t,dense:n,divider:r,disableGutters:o,selected:a,classes:s}=e,l=tn({root:["root",n&&"dense",t&&"disabled",!o&&"gutters",r&&"divider",a&&"selected"]},Mde,s);return{...s,...l}},Rde=Ge(od,{shouldForwardProp:e=>La(e)||e==="classes",name:"MuiMenuItem",slot:"Root",overridesResolver:Ede})(Vn(({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"}},[`&.${Kh.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${Kh.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${Kh.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)}},[`&.${Kh.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Kh.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${HP.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${HP.inset}`]:{marginLeft:52},[`& .${Df.root}`]:{marginTop:0,marginBottom:0},[`& .${Df.inset}`]:{paddingLeft:36},[`& .${WP.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,[`& .${WP.root} svg`]:{fontSize:"1.25rem"}}}]}))),qo=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiMenuItem"}),{autoFocus:r=!1,component:o="li",dense:a=!1,divider:s=!1,disableGutters:l=!1,focusVisibleClassName:d,role:f="menuitem",tabIndex:c,className:m,...y}=n,b=C.useContext(Al),v=C.useMemo(()=>({dense:a||b.dense||!1,disableGutters:l}),[b.dense,a,l]),x=C.useRef(null);Po(()=>{r&&x.current&&x.current.focus()},[r]);const w={...n,dense:v.dense,divider:s,disableGutters:l},S=Ode(n),T=mr(x,t);let M;return n.disabled||(M=c!==void 0?c:-1),h.jsx(Al.Provider,{value:v,children:h.jsx(Rde,{ref:T,role:f,tabIndex:M,component:o,focusVisibleClassName:jt(S.focusVisible,d),className:jt(S.root,m),...y,ownerState:w,classes:S})})}),Dl={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}],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}],duckdb:[],motherduck:[{label:"Access Token",name:"accessToken",type:"text",required:!0},{label:"Database",name:"database",type:"text",required:!1}],ducklake:[],publisher:[]},hm={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",trino:"trinoConnection",databricks:"databricksConnection",mysql:"mysqlConnection",duckdb:"duckdbConnection",motherduck:"motherduckConnection",ducklake:"ducklakeConnection",publisher:"publisherConnection"},DL=Object.values(vR).filter(e=>e!==vR.Publisher),Mw={postgres:"postgresConnection",bigquery:"bigqueryConnection",snowflake:"snowflakeConnection",gcs:"gcsConnection",s3:"s3Connection",azure:"azureConnection"},Xm=[{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"}}],Zm=[{label:"Key ID",name:"keyId",type:"text",required:!0},{label:"Secret",name:"secret",type:"password",required:!0}],$de=[{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 ib(e){return e==="postgres"||e==="bigquery"||e==="snowflake"?Dl[e]||[]:e==="s3"?Xm:e==="gcs"?Zm:e==="azure"?$de:[]}function Pde({onSubmit:e,isSubmitting:t}){const[n,r]=C.useState(!1),[o,a]=C.useState("postgres"),[s,l]=C.useState([]),[d,f]=C.useState("postgres"),[c,m]=C.useState("s3"),[y,b]=C.useState("config"),v=()=>{r(!0)},x=()=>{r(!1),l([]),a("postgres"),f("postgres"),m("s3"),b("config")},w=async R=>{R.preventDefault();const $=new FormData(R.currentTarget),P=$.get("name")?.toString(),N=$.get("type")?.toString(),V=Dl[N];if(!P)throw new Error("Name is required");if(!N)throw new Error("Type is required");let z;if(N==="ducklake"){const W={};if(d==="postgres"){const I=Dl.postgres,F={};if(I.forEach(_=>{const j=$.get(`ducklake_pg_${_.name}`)?.toString();j&&(F[_.name]=j)}),Object.keys(F).length===0)throw new Error("DuckLake requires catalog connection");W.postgresConnection=F}const H=$.get("ducklake_bucketUrl")?.toString();if(!H)throw new Error("DuckLake requires a bucket URL");const k={bucketUrl:H};if(c==="s3"){const I={};if(Xm.forEach(F=>{const _=$.get(`ducklake_s3_${F.name}`)?.toString();_&&(I[F.name]=_)}),I.provider==="credential_chain")delete I.accessKeyId,delete I.secretAccessKey,delete I.sessionToken;else{if(delete I.chain,!I.accessKeyId)throw new Error("S3 Access Key ID is required");if(!I.secretAccessKey)throw new Error("S3 Secret Access Key is required")}Object.keys(I).length>0&&(k.s3Connection=I)}else if(c==="gcs"){const I={};if(Zm.forEach(F=>{const _=$.get(`ducklake_gcs_${F.name}`)?.toString();_&&(I[F.name]=_)}),!I.keyId)throw new Error("GCS Key ID is required");if(!I.secret)throw new Error("GCS Secret is required");Object.keys(I).length>0&&(k.gcsConnection=I)}z={name:P,type:N,ducklakeConnection:{catalog:W,storage:k}}}else if(N==="duckdb"){if(s.length===0)throw new Error("DuckDB connection must have at least one attached database");const W=s.map((H,k)=>{const I=H.dbType,F=$.get(`attachedDb_${k}_name`)?.toString();if(!F)throw new Error(`Attached database at index ${k} must have a name`);const _={name:F,type:I},j=ib(I);if(j&&j.length>0){const X={};if(j.forEach(te=>{const Z=$.get(`attachedDb_${k}_${te.name}`)?.toString();Z&&(X[te.name]=Z)}),I==="s3"){if(X.provider==="credential_chain")delete X.accessKeyId,delete X.secretAccessKey,delete X.sessionToken;else if(delete X.chain,!X.accessKeyId||!X.secretAccessKey)throw new Error(`Attached database "${F}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`)}const Q=Mw[I];Q&&(_[Q]=X)}return _});z={name:P,type:N,duckdbConnection:{attachedDatabases:W}}}else{const W={};if(V.forEach(H=>{const k=$.get(H.name)?.toString();k&&(W[H.name]=k)}),N==="postgres"){if(!W.connectionString?.trim()){const H=["host","port","databaseName","userName","password"];for(const k of H)if(!W[k])throw new Error(`${V.find(I=>I.name===k)?.label||k} is required`)}}else if(N==="bigquery"){if(!W.serviceAccountKeyJson)throw new Error("Service Account Key JSON is required")}else if(N==="snowflake"){if(!W.account)throw new Error("Account is required");if(!W.username)throw new Error("Username is required");if(!W.warehouse)throw new Error("Warehouse is required");if(!W.password&&!W.privateKey)throw new Error("Either password or private key is required")}else if(N==="trino"){if(!W.server)throw new Error("Server is required");if(!W.user)throw new Error("User is required");if(W.server.trim().startsWith("https://")&&!W.password&&!W.peakaKey)throw new Error("Password is required for HTTPS connections (or use Peaka Key)")}else if(N==="mysql"){const H=["host","port","database","user","password"];for(const k of H)if(!W[k])throw new Error(`${V.find(I=>I.name===k)?.label||k} is required`)}else if(N==="motherduck"){if(!W.accessToken)throw new Error("Access Token is required")}else if(N==="databricks"){if(!W.host)throw new Error("Host is required");if(!W.path)throw new Error("HTTP Path is required");const H=W.oauthClientId&&W.oauthClientSecret;if(!W.token&&!H)throw new Error("Either Access Token or OAuth Client ID + Secret is required")}z={name:P,type:N,[hm[N]]:W}}await e(z),x()},S=()=>{l([...s,{name:"",dbType:"postgres"}])},T=R=>{l(s.filter(($,P)=>P!==R))},M=(R,$)=>{const P=[...s];P[R]={...P[R],dbType:$},l(P)};return h.jsxs(pn.Fragment,{children:[h.jsx(xg,{label:"Connection",onClick:v}),h.jsx(aa,{open:n,onClose:x,title:"New connection",description:"Add a connection so packages in this environment can query your database with Malloy.",actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{disabled:t,onClick:x,children:"Cancel"}),h.jsx(uo,{type:"submit",form:"connection-form",variant:"contained",loading:t,children:"Create connection"})]}),children:h.jsx("form",{onSubmit:w,id:"connection-form",children:h.jsxs(k0,{sx:{gap:2},children:[h.jsx(hr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small"}),h.jsx(hr,{id:"type",name:"type",label:"Connection Type",fullWidth:!0,size:"small",value:o,select:!0,onChange:R=>a(R.target.value),children:DL.map(R=>h.jsx(qo,{value:R,children:R},R))}),o==="ducklake"?h.jsxs(Ma,{sx:{mt:2},children:[h.jsxs(Ma,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[h.jsx(br,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Catalog"}),h.jsx(hr,{id:"ducklake_catalogType",label:"Catalog Type",fullWidth:!0,size:"small",value:d,select:!0,onChange:R=>f(R.target.value),children:h.jsx(qo,{value:"postgres",children:"PostgreSQL"})}),d==="postgres"&&h.jsx(h.Fragment,{children:Dl.postgres.map(R=>h.jsx(hr,{id:`ducklake_pg_${R.name}`,name:`ducklake_pg_${R.name}`,label:R.label,type:R.type,fullWidth:!0,size:"small"},`pg_${R.name}`))})]}),h.jsxs(Ma,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[h.jsx(br,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Storage"}),h.jsxs(hr,{id:"ducklake_storageType",label:"Storage Type",fullWidth:!0,size:"small",value:c,select:!0,onChange:R=>m(R.target.value),children:[h.jsx(qo,{value:"s3",children:"S3"}),h.jsx(qo,{value:"gcs",children:"GCS"})]}),h.jsx(hr,{required:!0,id:"ducklake_bucketUrl",name:"ducklake_bucketUrl",label:c==="s3"?"Bucket URL (e.g. s3://my-bucket/path)":"Bucket URL (e.g. gs://my-bucket/path)",type:"text",fullWidth:!0,size:"small"}),c==="s3"&&h.jsxs(h.Fragment,{children:[h.jsx(br,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),Xm.filter(R=>R.visibleWhen?y===R.visibleWhen.value:!0).map(R=>h.jsx(hr,{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?y:void 0,onChange:R.name==="provider"?$=>b($.target.value):void 0,placeholder:R.name==="region"?"us-east-1":void 0,children:R.selectOptions?.map($=>h.jsx(qo,{value:$.value,children:$.label},$.value))},`s3_${R.name}`))]}),c==="gcs"&&h.jsxs(h.Fragment,{children:[h.jsx(br,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Zm.map(R=>h.jsx(hr,{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"?h.jsxs(Ma,{sx:{mt:2},children:[h.jsxs(Ma,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[h.jsx(br,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),h.jsx(Sg,{label:"Database",icon:h.jsx(tk,{}),onClick:S,ariaLabel:"Add database"})]}),s.length===0&&h.jsx(br,{variant:"body2",color:"text.secondary",sx:{mb:2},children:'DuckDB connections require at least one attached database. Click "Add Database" to get started.'}),s.map((R,$)=>{const P=ib(R.dbType);return h.jsxs(Ma,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[h.jsxs(Ma,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[h.jsxs(br,{variant:"subtitle2",children:["Database ",$+1]}),h.jsx(Gc,{onClick:()=>T($),size:"small",color:"error",children:h.jsx(PL,{fontSize:"small"})})]}),h.jsx(hr,{required:!0,id:`attachedDb_${$}_name`,name:`attachedDb_${$}_name`,label:"Database Name",type:"text",fullWidth:!0,size:"small",defaultValue:R.name}),h.jsx(hr,{id:`attachedDb_${$}_type`,name:`attachedDb_${$}_type`,label:"Database Type",fullWidth:!0,size:"small",value:R.dbType,select:!0,onChange:N=>M($,N.target.value),children:Object.values(mN).map(N=>h.jsx(qo,{value:N,children:N},N))}),P.filter(N=>N.visibleWhen?(R[N.visibleWhen.field]||P.find(V=>V.name===N.visibleWhen?.field)?.selectOptions?.[0]?.value)===N.visibleWhen.value:!0).map(N=>h.jsx(hr,{id:`attachedDb_${$}_${N.name}`,name:`attachedDb_${$}_${N.name}`,label:N.label,type:N.selectOptions?void 0:N.type,fullWidth:!0,size:"small",required:N.required,select:!!N.selectOptions,defaultValue:N.selectOptions?.[0]?.value,onChange:N.selectOptions?V=>{const z=[...s];z[$]={...z[$],[N.name]:V.target.value},l(z)}:void 0,children:N.selectOptions?.map(V=>h.jsx(qo,{value:V.value,children:V.label},V.value))},N.name))]},$)})]}):Dl[o].map(R=>h.jsx(hr,{id:R.name,name:R.name,label:R.label,type:R.type,fullWidth:!0,size:"small",required:R.required},R.name))]})})})]})}function Dde({connection:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),s=()=>{a(!0)},l=()=>{a(!1),t()};return h.jsxs(pn.Fragment,{children:[h.jsxs(qo,{"aria-label":`Delete connection ${e?.name??""}`.trim(),onClick:d=>{d.stopPropagation(),s()},sx:{color:"error.main"},children:[h.jsx(zk,{sx:{color:"inherit"},children:h.jsx(Gb,{fontSize:"small"})}),h.jsx(Fk,{children:"Delete"})]}),h.jsx(aa,{open:o,onClose:l,title:"Delete connection",actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{onClick:l,children:"Cancel"}),h.jsx(uo,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>r(),loading:n,children:"Delete connection"})]}),children:h.jsxs(br,{variant:"body2",children:["Delete ",h.jsx("strong",{children:e.name}),"? Packages that query through it stop working, and this cannot be undone."]})})]})}const qP=new Set(["password","connectionString","privateKey","privateKeyPass","serviceAccountKeyJson","token","oauthClientSecret","accessToken","peakaKey","secret","secretAccessKey","sessionToken","clientSecret","sasUrl"]);function YP(e){const t=e.duckdbConnection?.attachedDatabases;return!t||t.length===0?[]:t.map(n=>({name:n.name||"",dbType:n.type||"postgres"}))}function KP(e){const t=e.ducklakeConnection;return t&&t.storage?.gcsConnection?"gcs":"s3"}function Ade({connection:e,onSubmit:t,isSubmitting:n,onCloseDialog:r}){const[o,a]=C.useState(!1),[s,l]=C.useState(e.type),d=pn.useMemo(()=>new Set(e.withheldFields??[]),[e.withheldFields]),[f,c]=C.useState(()=>YP(e)),[m,y]=C.useState("postgres"),[b,v]=C.useState(()=>KP(e)),[x,w]=C.useState(()=>e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),S=()=>{c(YP(e)),l(e.type),w(e.ducklakeConnection?.storage?.s3Connection?.provider??"config"),y("postgres"),v(KP(e)),a(!0)},T=()=>{a(!1),r?.()},M=async z=>{z.preventDefault();const W=new FormData(z.currentTarget),H=W.get("name")?.toString(),k=W.get("type")?.toString(),I=Dl[k];if(!H)throw new Error("Name is required");if(!k)throw new Error("Type is required");let F;if(k==="ducklake"){const _={};if(m==="postgres"){const Q=Dl.postgres,te={};if(Q.forEach(Z=>{const G=W.get(`ducklake_pg_${Z.name}`)?.toString();G&&(te[Z.name]=G)}),Object.keys(te).length===0)throw new Error("DuckLake requires catalog connection");_.postgresConnection=te}const j=W.get("ducklake_bucketUrl")?.toString();if(!j)throw new Error("DuckLake requires a bucket URL");const X={bucketUrl:j};if(b==="s3"){const Q={};Xm.forEach(Z=>{const G=W.get(`ducklake_s3_${Z.name}`)?.toString();G&&(Q[Z.name]=G)});const te=e.ducklakeConnection?.storage?.s3Connection;if(te&&(!Q.provider&&te.provider&&(Q.provider=te.provider),!Q.chain&&te.chain&&(Q.chain=te.chain),!Q.accessKeyId&&te.accessKeyId&&(Q.accessKeyId=te.accessKeyId)),Q.provider==="credential_chain")delete Q.accessKeyId,delete Q.secretAccessKey,delete Q.sessionToken;else if(delete Q.chain,!Q.accessKeyId)throw new Error("S3 Access Key ID is required");Object.keys(Q).length>0&&(X.s3Connection=Q)}else if(b==="gcs"){const Q={};Zm.forEach(Z=>{const G=W.get(`ducklake_gcs_${Z.name}`)?.toString();G&&(Q[Z.name]=G)});const te=e.ducklakeConnection?.storage?.gcsConnection;if(te&&!Q.keyId&&te.keyId&&(Q.keyId=te.keyId),!Q.keyId)throw new Error("GCS Key ID is required");Object.keys(Q).length>0&&(X.gcsConnection=Q)}F={name:H,type:k,ducklakeConnection:{catalog:_,storage:X}}}else if(k==="duckdb"){if(f.length===0)throw new Error("DuckDB connection must have at least one attached database");const _=f.map((j,X)=>{const Q=j.dbType,te=W.get(`attachedDb_${X}_name`)?.toString();if(!te)throw new Error(`Attached database at index ${X} must have a name`);const Z={name:te,type:Q},G=ib(Q);if(G&&G.length>0){const ne={};if(G.forEach(pe=>{const oe=W.get(`attachedDb_${X}_${pe.name}`)?.toString();oe&&(ne[pe.name]=oe)}),Q==="s3"){if(ne.provider==="credential_chain")delete ne.accessKeyId,delete ne.secretAccessKey,delete ne.sessionToken;else if(delete ne.chain,!ne.accessKeyId||!ne.secretAccessKey)throw new Error(`Attached database "${te}" requires an S3 Access Key ID and Secret Access Key, or Credential Provider set to the host credential chain`)}const se=Mw[Q];se&&(Z[se]=ne)}return Z});F={name:H,type:k,duckdbConnection:{attachedDatabases:_}}}else{const _=e[hm[k]]||{},j={};if(I.forEach(X=>{const Q=W.get(X.name)?.toString(),te=_[X.name];Q?j[X.name]=Q:qP.has(X.name)||(Q!==void 0?j[X.name]=Q:te&&(j[X.name]=te))}),k==="postgres"){const X=["host","port","databaseName","userName"],Q=d.has("postgresConnection.connectionString");if(!(j.connectionString?.trim()||Q)){const te=X;for(const Z of te)if(!j[Z])throw new Error(`${I.find(G=>G.name===Z)?.label||Z} is required`)}}else if(k==="snowflake"){if(!j.account)throw new Error("Account is required");if(!j.username)throw new Error("Username is required");if(!j.warehouse)throw new Error("Warehouse is required")}else if(k==="trino"){if(!j.server)throw new Error("Server is required");if(!j.user)throw new Error("User is required")}else if(k==="mysql"){const X=["host","port","database","user"];for(const Q of X)if(!j[Q])throw new Error(`${I.find(te=>te.name===Q)?.label||Q} is required`)}else if(k==="databricks"){if(!j.host)throw new Error("Host is required");if(!j.path)throw new Error("HTTP Path is required")}F={name:H,type:k,[hm[k]]:j}}await t(F),T()},R=()=>{c([...f,{name:"",dbType:"postgres"}])},$=z=>{c(f.filter((W,H)=>H!==z))},P=(z,W)=>{const H=[...f];H[z]={...H[z],dbType:W},c(H)},N=(z,W)=>{const H=e.duckdbConnection?.attachedDatabases;if(!H||!H[z])return"";const k=H[z],I=Mw[k.type||""];return I&&k[I]?k[I][W]??"":""},V=z=>{const W=e.ducklakeConnection;if(!W)return"";if(z.startsWith("pg_")){const H=z.replace("pg_","");return W.catalog?.postgresConnection?.[H]??""}if(z==="bucketUrl")return W.storage?.bucketUrl??"";if(z.startsWith("s3_")){const H=z.replace("s3_","");return W.storage?.s3Connection?.[H]??""}if(z.startsWith("gcs_")){const H=z.replace("gcs_","");return W.storage?.gcsConnection?.[H]??""}return""};return h.jsxs(pn.Fragment,{children:[h.jsxs(qo,{"aria-label":`Edit connection ${e?.name??""}`.trim(),onClick:z=>{z.preventDefault(),z.stopPropagation(),S()},children:[h.jsx(zk,{children:h.jsx(YC,{fontSize:"small"})}),h.jsx(Fk,{children:"Edit"})]}),h.jsx(aa,{open:o,onClose:T,title:"Edit connection",description:"Change how packages in this environment reach your database.",actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{disabled:n,onClick:T,children:"Cancel"}),h.jsx(uo,{type:"submit",form:"connection-form",variant:"contained",loading:n,children:"Save changes"})]}),children:h.jsx("form",{onSubmit:M,id:"connection-form",children:h.jsxs(k0,{sx:{gap:2},children:[h.jsx(hr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",defaultValue:e.name}),h.jsx(hr,{id:"type",name:"type",label:"Connection Type",fullWidth:!0,size:"small",value:s,select:!0,onChange:z=>l(z.target.value),children:DL.map(z=>h.jsx(qo,{value:z,children:z},z))}),s==="ducklake"?h.jsxs(Ma,{sx:{mt:2},children:[h.jsxs(Ma,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[h.jsx(br,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Catalog"}),h.jsx(hr,{id:"ducklake_catalogType",label:"Catalog Type",fullWidth:!0,size:"small",value:m,select:!0,onChange:z=>y(z.target.value),children:h.jsx(qo,{value:"postgres",children:"PostgreSQL"})}),m==="postgres"&&h.jsx(h.Fragment,{children:Dl.postgres.map(z=>h.jsx(hr,{id:`ducklake_pg_${z.name}`,name:`ducklake_pg_${z.name}`,label:z.label,type:z.type,fullWidth:!0,size:"small",defaultValue:V(`pg_${z.name}`)},`pg_${z.name}`))})]}),h.jsxs(Ma,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[h.jsx(br,{variant:"subtitle2",sx:{mb:2},fontWeight:500,children:"Storage"}),h.jsxs(hr,{id:"ducklake_storageType",label:"Storage Type",fullWidth:!0,size:"small",value:b,select:!0,onChange:z=>v(z.target.value),children:[h.jsx(qo,{value:"s3",children:"S3"}),h.jsx(qo,{value:"gcs",children:"GCS"})]}),h.jsx(hr,{required:!0,id:"ducklake_bucketUrl",name:"ducklake_bucketUrl",label:b==="s3"?"Bucket URL (e.g. s3://my-bucket/path)":"Bucket URL (e.g. gs://my-bucket/path)",type:"text",fullWidth:!0,size:"small",defaultValue:V("bucketUrl")}),b==="s3"&&h.jsxs(h.Fragment,{children:[h.jsx(br,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"S3 Credentials"}),Xm.filter(z=>z.visibleWhen?x===z.visibleWhen.value:!0).map(z=>h.jsx(hr,{id:`ducklake_s3_${z.name}`,name:`ducklake_s3_${z.name}`,label:z.label,type:z.selectOptions?void 0:z.type,fullWidth:!0,size:"small",required:z.required&&z.name!=="secretAccessKey",select:!!z.selectOptions,defaultValue:z.selectOptions?x:V(`s3_${z.name}`),onChange:z.name==="provider"?W=>w(W.target.value):void 0,placeholder:z.name==="region"?"us-east-1":z.name==="secretAccessKey"&&d.has("ducklakeConnection.storage.s3Connection.secretAccessKey")?"Leave empty to keep existing":void 0,children:z.selectOptions?.map(W=>h.jsx(qo,{value:W.value,children:W.label},W.value))},`s3_${z.name}`))]}),b==="gcs"&&h.jsxs(h.Fragment,{children:[h.jsx(br,{variant:"caption",sx:{mt:2,mb:1,display:"block"},color:"text.secondary",children:"GCS Credentials"}),Zm.map(z=>h.jsx(hr,{id:`ducklake_gcs_${z.name}`,name:`ducklake_gcs_${z.name}`,label:z.label,type:z.type,fullWidth:!0,size:"small",required:z.required&&z.name!=="secret",defaultValue:V(`gcs_${z.name}`),placeholder:z.name==="secret"&&d.has("ducklakeConnection.storage.gcsConnection.secret")?"Leave empty to keep existing":void 0},`gcs_${z.name}`))]})]})]}):s==="duckdb"?h.jsxs(Ma,{sx:{mt:2},children:[h.jsxs(Ma,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[h.jsx(br,{variant:"subtitle1",fontWeight:500,children:"Attached Databases"}),h.jsx(Sg,{label:"Database",icon:h.jsx(tk,{}),onClick:R,ariaLabel:"Add database"})]}),f.length===0&&h.jsx(br,{variant:"body2",color:"text.secondary",sx:{mb:2},children:'DuckDB connections require at least one attached database. Click "Add Database" to get started.'}),f.map((z,W)=>{const H=ib(z.dbType);return h.jsxs(Ma,{sx:{mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[h.jsxs(Ma,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[h.jsxs(br,{variant:"subtitle2",children:["Database ",W+1]}),h.jsx(Gc,{"aria-label":`Remove attached database ${W+1}`,onClick:()=>$(W),size:"small",color:"error",children:h.jsx(PL,{fontSize:"small"})})]}),h.jsx(hr,{required:!0,id:`attachedDb_${W}_name`,name:`attachedDb_${W}_name`,label:"Database Name",type:"text",fullWidth:!0,size:"small",defaultValue:z.name}),h.jsx(hr,{id:`attachedDb_${W}_type`,name:`attachedDb_${W}_type`,label:"Database Type",fullWidth:!0,size:"small",value:z.dbType,select:!0,onChange:k=>P(W,k.target.value),children:Object.values(mN).map(k=>h.jsx(qo,{value:k,children:k},k))}),H.filter(k=>k.visibleWhen?(z[k.visibleWhen.field]||N(W,k.visibleWhen.field)||H.find(I=>I.name===k.visibleWhen?.field)?.selectOptions?.[0]?.value)===k.visibleWhen.value:!0).map(k=>h.jsx(hr,{id:`attachedDb_${W}_${k.name}`,name:`attachedDb_${W}_${k.name}`,label:k.label,type:k.selectOptions?void 0:k.type,fullWidth:!0,size:"small",required:k.required,select:!!k.selectOptions,defaultValue:N(W,k.name)||k.selectOptions?.[0]?.value,onChange:k.selectOptions?I=>{const F=[...f];F[W]={...F[W],[k.name]:I.target.value},c(F)}:void 0,children:k.selectOptions?.map(I=>h.jsx(qo,{value:I.value,children:I.label},I.value))},k.name))]},W)})]}):Dl[s].map(z=>{const W=e?.[hm[s]??""]?.[z.name??""]??"",H=z.type==="password"||qP.has(z.name),k=d.has(`${hm[s]??""}.${z.name}`);return h.jsx(hr,{id:z.name,name:z.name,label:z.label,type:z.type,fullWidth:!0,size:"small",required:z.required&&!H&&!W,defaultValue:W,placeholder:k?"Leave empty to keep existing":void 0,helperText:H?k?"Stored value is not shown. Leave empty to keep it.":"No value stored.":void 0},z.name)})]})})})]})}function GP(e,t){return!e||e.type!=="duckdb"?!1:(e.duckdbConnection?.attachedDatabases||[]).some(n=>n.type==="azure"&&n.name===t)}function jde(e){return e.startsWith("gs://")||e.startsWith("s3://")||e.startsWith("https://")||e.startsWith("abfss://")||e.startsWith("az://")}function Nde({connectionName:e,resourceUri:t,schema:n,connection:r}){const{apiClients:o}=zr(),{environmentName:a}=xo(t),[s,l]=pn.useState(null),[d,f]=pn.useState(n||null),[c,m]=pn.useState(!1),{data:y,isError:b,isLoading:v,error:x}=co({queryKey:["schemas",a,e],queryFn:()=>o.connections.listSchemas(a,e)}),w=y?.data||[];return h.jsxs(Rf,{container:!0,spacing:1,children:[!n&&h.jsx(Rf,{size:{xs:12,md:4},children:h.jsxs(Na,{sx:{p:1,m:0},children:[h.jsxs(Kt,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:0},children:[h.jsx(Lt,{variant:"overline",fontWeight:"bold",children:"Table Paths"}),h.jsx(MC,{control:h.jsx(Sj,{checked:c,onChange:S=>m(S.target.checked)}),label:"Hidden Schemas"})]}),h.jsx(Bc,{sx:{mt:"2px"}}),h.jsxs(Kt,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[v&&h.jsx(oa,{text:"Loading schemas..."}),b&&h.jsx(ha,{error:x,context:`${a} > ${e} > Schemas`}),!v&&!b&&w.length===0&&h.jsx(Lt,{variant:"body2",children:"No Schemas"}),!v&&!b&&w.length>0&&h.jsx(RC,{dense:!0,disablePadding:!0,children:w.map(S=>{const T=S.name;return S.isHidden&&!c?null:h.jsx(pj,{selected:d===T,onClick:()=>{f(T),l(null)},children:h.jsx(Kc,{primary:T})},T)})})]})]})}),h.jsx(Rf,{size:{xs:12,md:n?6:4},children:d&&h.jsx(Na,{sx:{p:1,m:0},children:h.jsx(zde,{connectionName:e,schemaName:d,onTableSelect:S=>{l(S)},resourceUri:t,connection:r})})}),h.jsx(Rf,{size:{xs:12,md:n?6:4},children:d&&s&&h.jsx(Ide,{environmentName:a,connectionName:e,schemaName:d,tableResource:s})})]})}function Ide({environmentName:e,connectionName:t,schemaName:n,tableResource:r}){const{apiClients:o}=zr(),{data:a,isLoading:s,isError:l,error:d}=co({queryKey:["connectionTableDetail",e,t,n,r],queryFn:()=>o.connections.getTable(e,t,n,r),enabled:!!n&&!!r}),f={resource:a?.data?.resource??r,columns:a?.data?.columns??[]};return h.jsxs(Na,{sx:{p:1,m:0},children:[l&&h.jsx(ha,{error:d,context:`${e} > ${t} > ${n} > ${r}`}),!l&&h.jsx(Lde,{table:f,loading:s})]})}function Lde({table:e,loading:t}){return t?h.jsx(oa,{text:"Loading columns..."}):h.jsxs(h.Fragment,{children:[h.jsxs(Lt,{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]}),h.jsx(Bc,{}),h.jsx(Kt,{sx:{mt:"10px",maxHeight:"600px",overflowY:"auto"},children:h.jsx(l7,{children:h.jsxs(ug,{size:"small",sx:{"& .MuiTableCell-root":{padding:"10px"}},children:[h.jsx(fg,{children:h.jsxs(Zs,{children:[h.jsx(Xn,{children:"NAME"}),h.jsx(Xn,{children:"TYPE"})]})}),h.jsx(dg,{children:e.columns?.sort((n,r)=>n.name.localeCompare(r.name))?.map(n=>h.jsxs(Zs,{children:[h.jsx(Xn,{children:n.name}),h.jsx(Xn,{children:n.type})]},n.name))})]})})})]})}function zde({connectionName:e,schemaName:t,onTableSelect:n,resourceUri:r,connection:o}){const{environmentName:a}=xo(r),{apiClients:s}=zr(),[l,d]=C.useState(""),{data:f,isSuccess:c,isError:m,error:y,isLoading:b}=co({queryKey:["tablesInSchema",a,e,t],queryFn:()=>s.connections.listTables(a,e,t)}),v=GP(o,t),x=S=>v?S:S.split(".").pop()||S,w=c&&f?.data?f.data.filter(S=>x(S.resource).toLowerCase().includes(l.toLowerCase())).sort((S,T)=>x(S.resource).localeCompare(x(T.resource))):[];return h.jsxs(h.Fragment,{children:[h.jsx(Lt,{variant:"overline",fontWeight:"bold",children:jde(t)||GP(o,t)?`Files in ${t}`:`Tables in ${t}`}),h.jsx(Bc,{}),h.jsx(Kt,{sx:{mt:1,mb:1},children:h.jsx(ii,{size:"small",fullWidth:!0,placeholder:"Search tables...",value:l,onChange:S=>d(S.target.value),variant:"outlined"})}),h.jsx(Bc,{}),h.jsxs(Kt,{sx:{mt:"2px",maxHeight:"600px",overflowY:"auto"},children:[b&&h.jsx(oa,{text:"Fetching Tables..."}),m&&h.jsx(ha,{error:y,context:`${a} > ${e} > ${t}`}),c&&w.length===0&&h.jsx(Lt,{variant:"body2",children:"No Tables"}),c&&f?.data&&f.data.length>0&&h.jsx(RC,{dense:!0,disablePadding:!0,children:w.map(S=>{let T=x(S.resource);return!v&&S.resource.includes("://")&&(T=S.resource.split("/").pop()||S.resource),h.jsx(pj,{onClick:()=>n(S.resource),children:h.jsx(Kc,{primary:T,secondary:S.columns.length>0?`${S.columns.length} columns`:void 0})},S.resource)})})]})]})}const Fde={bigquery:"BigQuery",snowflake:"Snowflake",postgres:"PostgreSQL",mysql:"MySQL",trino:"Trino",databricks:"Databricks",duckdb:"DuckDB",ducklake:"DuckLake",s3:"S3",gcs:"GCS",azure:"Azure"};function Bde(e){return e?Fde[e]??e:""}function Ude({resourceUri:e}){const{apiClients:t,mutable:n}=zr(),r=dd(),{environmentName:o}=xo(e),[a,s]=C.useState(""),[l,d]=C.useState(null),f=u0({environmentName:o,connectionName:l}),{data:c,isSuccess:m,isError:y,error:b}=co({queryKey:["connections",o],queryFn:()=>t.connections.listConnections(o)}),v=Ws({mutationFn:Pl("connection","create",M=>t.environments.updateEnvironment(o,{name:o,connections:[...c.data,M]})),onSuccess(){s("Connection added successfully"),r.invalidateQueries({queryKey:["connections",o]})},onError(M){s(M.message)}}),x=Ws({mutationFn:Pl("connection","update",M=>t.environments.updateEnvironment(o,{name:o,connections:c.data.map(R=>R.name===M.name?M:R)})),onSuccess(M,R){s(`Connection ${R.name} updated successfully`),r.invalidateQueries({queryKey:["connections",o]})},onError(M){s(M.message)}}),w=Ws({mutationFn:Pl("connection","delete",M=>{if(!M.name)throw new Error("Cannot delete a connection with no name");return t.connections.deleteConnection(o,M.name)}),onSuccess(M,R){s(`Connection ${R.name} deleted successfully`),r.invalidateQueries({queryKey:["connections",o]})},onError(M){s(M.message)}}),S=m?[...c.data].sort((M,R)=>(M.name??"").localeCompare(R.name??"")):[],T=v.isPending||x.isPending||w.isPending;return h.jsxs(us,{title:"Connections",...m?{count:S.length}:{},description:"Database connections available to packages in this environment",...n&&m?{action:h.jsx(Pde,{onSubmit:M=>v.mutateAsync(M),isSubmitting:v.isPending})}:{},children:[!m&&!y&&h.jsx(Lt,{variant:"body2",color:"text.secondary",children:"Fetching Connections..."}),y&&h.jsx(ha,{error:b,context:`${o} > Connections`}),m&&S.length===0&&h.jsx(Lt,{variant:"body2",color:"text.secondary",children:"No connections yet."}),m&&S.length>0&&h.jsx(fr,{children:S.map(M=>h.jsx(_de,{connection:M,mutable:n,isMutating:T,onOpenExplorer:()=>d(M.name??null),onEdit:R=>x.mutateAsync(R),onDelete:R=>w.mutateAsync(R)},M.name))}),h.jsx(Fb,{open:a!=="",autoHideDuration:6e3,onClose:()=>s(""),message:a}),h.jsx(aa,{open:l!==null,onClose:()=>d(null),maxWidth:"lg",title:`Connection explorer: ${l??""}`,showClose:!0,children:l&&h.jsx(Nde,{resourceUri:f,connectionName:l,connection:c?.data?.find(M=>M.name===l)})})]})}function _de({connection:e,mutable:t,isMutating:n,onOpenExplorer:r,onEdit:o,onDelete:a}){const[s,l]=C.useState(null),d=!!s,f=m=>{m.stopPropagation(),l(m.currentTarget)},c=()=>l(null);return h.jsx(C0,{icon:h.jsx(yde,{sx:{fontSize:18}}),tint:_C.connection,label:e.name??"",ariaLabel:e.name??"",description:Bde(e.type),onClick:r,...t?{trailingAction:h.jsxs(h.Fragment,{children:[h.jsx(eo,{size:"small",onClick:f,"aria-label":`Connection actions for ${e.name??""}`.trim(),children:h.jsx(Qb,{fontSize:"small"})}),h.jsxs(cd,{anchorEl:s,open:d,onClose:c,onClick:m=>m.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[h.jsx(Ade,{connection:e,onSubmit:o,isSubmitting:n,onCloseDialog:c}),h.jsx(Dde,{connection:e,onCloseDialog:c,isMutating:n,onDelete:()=>a(e)})]})]})}:{}})}const Vde=cr([h.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"),h.jsx("path",{d:"M9 12h6v2H9z"},"1")]);function Hde({resourceUri:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=zr(),a=()=>{r(!0)},s=()=>{r(!1),t()},{environmentName:l,packageName:d}=xo(e),f=yp({mutationFn:()=>o.packages.deletePackage(l,d),success:"Package deleted",invalidates:[["packages",l]],closeDialog:s,resource:"package",action:"delete"});return h.jsxs(pn.Fragment,{children:[h.jsxs(Ii,{onClick:a,children:[h.jsx(dp,{children:h.jsx(Gb,{fontSize:"small"})}),h.jsx(Kc,{children:"Delete"})]}),h.jsx(aa,{open:n,onClose:s,title:"Delete package",actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{onClick:s,children:"Cancel"}),h.jsx(uo,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>f.mutate(),loading:f.isPending,children:"Delete package"})]}),children:h.jsxs(br,{variant:"body2",children:["Delete ",h.jsx("strong",{children:d}),"? The package stops being served and this cannot be undone."]})}),f.notice]})}function Wde({package:e,resourceUri:t,onCloseDialog:n}){const[r,o]=C.useState(!1),{apiClients:a}=zr(),s=()=>{o(!0)},l=()=>{o(!1),n()},{packageName:d,environmentName:f}=xo(t),c=yp({mutationFn(y){return a.packages.updatePackage(f,d,{name:d,description:y.description})},success:"Package updated",invalidates:[["packages",f]],closeDialog:l,resource:"package",action:"update"}),m=y=>{y.preventDefault();const b=new FormData(y.currentTarget).get("description")?.toString();c.mutate({description:b})};return h.jsxs(pn.Fragment,{children:[h.jsxs(Ii,{onClick:s,children:[h.jsx(dp,{children:h.jsx(YC,{fontSize:"small"})}),h.jsx(Kc,{children:"Edit"})]}),h.jsx(aa,{open:r,onClose:l,title:"Edit package",description:`What ${e.name} is, for the people who open it.`,actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{disabled:c.isPending,onClick:l,children:"Cancel"}),h.jsx(uo,{type:"submit",form:"package-form",variant:"contained",loading:c.isPending,children:"Save changes"})]}),children:h.jsx("form",{onSubmit:m,id:"package-form",children:h.jsxs(fr,{sx:{gap:2},children:[h.jsx(hr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",disabled:!0,type:"text",fullWidth:!0,size:"small",defaultValue:e.name,InputLabelProps:{shrink:!0}}),h.jsx(hr,{id:"description",name:"description",label:"Description",multiline:!0,fullWidth:!0,rows:4,size:"small",defaultValue:e.description,InputLabelProps:{shrink:!0}})]})})}),c.notice]})}function qde({onSelectPackage:e,resourceUri:t}){const{apiClients:n}=zr(),{environmentName:r}=xo(t),{data:o,isSuccess:a,isError:s,error:l}=co({queryKey:["packages",r],queryFn:()=>n.packages.listPackages(r)});if(s)return h.jsx(ha,{error:l,context:`${r} > Packages`});if(!a)return h.jsx(oa,{text:"Fetching Packages..."});const d=[...o.data].sort((f,c)=>f.name.localeCompare(c.name));return h.jsx(fr,{children:d.map(f=>{const c=u0({environmentName:r,packageName:f.name});return h.jsx(Yde,{pkg:f,packageResourceUri:c,onSelectPackage:e},f.name)})})}function Yde({pkg:e,packageResourceUri:t,onSelectPackage:n}){const{mutable:r}=zr(),[o,a]=C.useState(null),s=!!o,l=f=>{f.stopPropagation(),a(f.currentTarget)},d=()=>a(null);return h.jsx(C0,{icon:h.jsx(Vde,{sx:{fontSize:18}}),tint:_C.package,label:e.name,ariaLabel:e.name,...e.description?{description:e.description}:{},onClick:f=>n(e.name,f),...r?{trailingAction:h.jsxs(h.Fragment,{children:[h.jsx(eo,{size:"small",onClick:l,"aria-label":`Package actions for ${e.name}`,children:h.jsx(Qb,{fontSize:"small"})}),h.jsxs(cd,{anchorEl:o,open:s,onClose:d,onClick:f=>f.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[h.jsx(Wde,{package:e,resourceUri:t,onCloseDialog:d}),h.jsx(Hde,{resourceUri:t,onCloseDialog:d})]})]})}:{}})}function Whe({onSelectPackage:e,resourceUri:t}){const{apiClients:n,mutable:r}=zr(),{environmentName:o}=xo(t),a=co({queryKey:["packages",o],queryFn:()=>n.packages.listPackages(o)});return C.useEffect(()=>{window.scrollTo({top:0,behavior:"auto"})},[]),h.jsxs(kC,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[h.jsxs(Kt,{sx:{mb:4},children:[h.jsx(Kt,{children:h.jsx(EL,{label:"Publisher",onClick:s=>e("/",s)})}),h.jsx(Lt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:o}),h.jsx(Lt,{variant:"body2",color:"text.secondary",children:"Manage packages and database connections in this environment. Open a package to explore its models and notebooks."})]}),h.jsx(us,{title:"Packages",...a.isSuccess?{count:a.data.data.length}:{},description:"Published packages available for use in this environment",...r?{action:h.jsx(gde,{resourceUri:t})}:{},children:h.jsx(qde,{onSelectPackage:e,resourceUri:t})}),h.jsx(Ude,{resourceUri:t}),h.jsx(tde,{resourceUri:t})]})}$r.extend(nk);const Kde=cr(h.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"})),AL=e=>{if(!e)return"Explore semantic models, run queries, and build dashboards";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(" ")+"..."},jL=(e,t)=>{const n=(e.readme||void 0)?.split(`
|
|
436
436
|
`)??[];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(`
|
|
437
437
|
`)};function QP(){const[e,t]=C.useState(!1),{apiClients:n}=zr(),r=()=>{t(!0)},o=()=>{t(!1)},a=yp({mutationFn(l){return n.environments.createEnvironment({name:l.name,readme:jL({name:l.name,readme:""},l.description)})},success:"Environment created",invalidates:[["environments"]],closeDialog:o,resource:"environment",action:"create"}),s=async l=>{l.preventDefault();const d=new FormData(l.currentTarget),f=d.get("name")?.toString(),c=d.get("description")?.toString();if(!f)throw new Error("Name is required");a.mutate({name:f,description:c})};return h.jsxs(pn.Fragment,{children:[h.jsx(xg,{label:"Environment",onClick:r}),h.jsx(aa,{open:e,onClose:o,title:"New environment",description:"An environment holds packages and the connections they query through.",actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{disabled:a.isPending,onClick:o,children:"Cancel"}),h.jsx(uo,{type:"submit",form:"environment-form",variant:"contained",loading:a.isPending,children:"Create environment"})]}),children:h.jsx("form",{onSubmit:s,id:"environment-form",children:h.jsxs(k0,{sx:{gap:2},children:[h.jsx(hr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),h.jsx(hr,{id:"description",name:"description",label:"Description",placeholder:"Explore semantic models, run queries, and build dashboards",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}})]})})}),a.notice]})}function Gde({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=zr(),a=()=>{r(!0)},s=()=>{r(!1),t()},l=yp({mutationFn:()=>o.environments.deleteEnvironment(e.name),success:"Environment deleted",invalidates:[["environments"]],closeDialog:s,resource:"environment",action:"delete"});return h.jsxs(pn.Fragment,{children:[h.jsxs(Ii,{onClick:a,children:[h.jsx(dp,{children:h.jsx(Gb,{fontSize:"small"})}),h.jsx(Kc,{children:"Delete"})]}),h.jsx(aa,{open:n,onClose:s,title:"Delete environment",actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{onClick:s,children:"Cancel"}),h.jsx(uo,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>l.mutate(),loading:l.isPending,children:"Delete environment"})]}),children:h.jsxs(br,{variant:"body2",children:["Delete ",h.jsx("strong",{children:e.name}),"? Its packages stop being served and this cannot be undone."]})}),l.notice]})}function Qde({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=zr(),a=()=>{r(!0)},s=()=>{r(!1),t()},l=yp({mutationFn(f){return o.environments.updateEnvironment(e.name,{name:e.name,readme:jL({name:e.name,readme:e.readme},f.description)})},success:"Environment updated",invalidates:[["environments"]],closeDialog:s,resource:"environment",action:"update"}),d=f=>{f.preventDefault();const c=new FormData(f.currentTarget).get("description")?.toString();l.mutate({description:c})};return h.jsxs(pn.Fragment,{children:[h.jsxs(Ii,{onClick:a,children:[h.jsx(dp,{children:h.jsx(YC,{fontSize:"small"})}),h.jsx(Kc,{children:"Edit"})]}),h.jsx(aa,{open:n,onClose:s,title:"Edit environment",description:"What this environment is, for the people who open it.",actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{disabled:l.isPending,onClick:s,children:"Cancel"}),h.jsx(uo,{type:"submit",form:"environment-form",variant:"contained",loading:l.isPending,children:"Save changes"})]}),children:h.jsx("form",{onSubmit:d,id:"environment-form",children:h.jsxs(k0,{sx:{gap:2},children:[h.jsx(hr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",disabled:!0,type:"text",fullWidth:!0,size:"small",defaultValue:e.name,InputLabelProps:{shrink:!0}}),h.jsx(hr,{id:"description",name:"description",label:"Description",type:"text",fullWidth:!0,size:"small",defaultValue:AL(e.readme),InputLabelProps:{shrink:!0}})]})})}),l.notice]})}const Xde=[{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:kc.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:kc.mcpAgents},{title:"Surface",body:"Dashboards declared in Malloy, notebooks, and no-build HTML data apps, all shipped inside the package, plus this Console for browsing them.",href:kc.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:kc.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:kc.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:kc.connections}];function Zde({href:e,children:t}){return h.jsx(Kt,{component:"a",href:e,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary",textDecoration:"underline"},children:t})}function qhe({onClickEnvironment:e}){const{apiClients:t,mutable:n}=zr(),{data:r,isSuccess:o,isError:a,error:s}=co({queryKey:["environments"],queryFn:()=>t.environments.listEnvironments()});if(a)return h.jsx(ha,{error:s,context:"Environments List"});if(!o)return h.jsx(oa,{text:"Loading environments..."});const l=r.data??[];return h.jsxs(kC,{maxWidth:"md",sx:{py:6},children:[h.jsxs(Kt,{sx:{mb:5},children:[h.jsx(Lt,{variant:"h3",component:"h1",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Publisher"}),h.jsx(Lt,{variant:"body1",color:"text.secondary",sx:{mb:3},children:"The analytics engine for Malloy."}),h.jsx(Lt,{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."})]}),h.jsx(Rf,{container:!0,spacing:4,sx:{mb:5},children:Xde.map(d=>h.jsx(Rf,{size:{xs:12,sm:6},children:h.jsxs(fr,{spacing:1,children:[h.jsx(Lt,{variant:"body2",component:"a",href:d.href,target:"_blank",rel:"noopener noreferrer",sx:{fontWeight:500,color:"text.primary",textDecoration:"none","&:hover":{textDecoration:"underline"}},children:d.title}),h.jsx(Lt,{variant:"body2",color:"text.secondary",sx:{lineHeight:1.6},children:d.body})]})},d.title))}),h.jsx(Bc,{sx:{my:4}}),l.length>0?h.jsx(us,{title:"Environments",count:l.length,description:"Published environments available on this server",...n?{action:h.jsx(QP,{})}:{},children:h.jsx(fr,{children:l.map(d=>h.jsx(Jde,{environment:d,...e?{onClickEnvironment:e}:{}},d.name))})}):h.jsxs(Kt,{sx:{mb:4},children:[h.jsx(Lt,{variant:"h5",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Get started"}),h.jsx(Lt,{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?h.jsx(QP,{}):h.jsx(Ko,{variant:"contained",color:"primary",href:kc.publishing,target:"_blank",rel:"noopener noreferrer",children:"Learn how to create models"})]}),h.jsx(Bc,{sx:{my:4}}),h.jsxs(Lt,{variant:"body2",color:"text.secondary",sx:{maxWidth:720,lineHeight:1.6,mt:2},children:["Join the"," ",h.jsx(Zde,{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 Jde({environment:e,onClickEnvironment:t}){const{mutable:n}=zr(),[r,o]=C.useState(null),a=!!r,s=AL(e.readme),l=f=>{f.stopPropagation(),o(f.currentTarget)},d=()=>o(null);return h.jsx(C0,{icon:h.jsx(Kde,{sx:{fontSize:18}}),tint:_C.environment,label:e.name??"",ariaLabel:e.name??"",...s?{description:s}:{},...e.name&&t?{onClick:f=>t(`/${e.name}/`,f)}:{},...n?{trailingAction:h.jsxs(h.Fragment,{children:[h.jsx(eo,{size:"small",onClick:l,"aria-label":`Environment actions for ${e.name}`,children:h.jsx(Qb,{fontSize:"small"})}),h.jsxs(cd,{anchorEl:r,open:a,onClose:d,onClick:f=>f.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[h.jsx(Qde,{environment:e,onCloseDialog:d}),h.jsx(Gde,{environment:e,onCloseDialog:d})]})]})}:{}})}var wf={},Xa={},Gh={},Cf={},XP={},ZP;function efe(){return ZP||(ZP=1,Object.defineProperty(XP,"__esModule",{value:!0})),XP}var Qh={},Xh={},JP;function gd(){if(JP)return Xh;JP=1,Object.defineProperty(Xh,"__esModule",{value:!0}),Xh.CronField=void 0;let e=class NL{#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(NL.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=l=>d=>new RegExp(`^\\d{0,2}${d}$`).test(l),a=l=>(n=l,typeof l=="number"?l>=this.min&&l<=this.max:this.chars.some(o(l)));if(!this.#o.every(a))throw new Error(`${this.constructor.name} Validation error, got value ${n} expected range ${this.min}-${this.max}${r}`);const s=this.#o.find((l,d)=>this.#o.indexOf(l)!==d);if(s)throw new Error(`${this.constructor.name} Validation error, duplicate values found: ${s}`)}#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 Xh.CronField=e,Xh}var eD;function tfe(){if(eD)return Qh;eD=1,Object.defineProperty(Qh,"__esModule",{value:!0}),Qh.CronDayOfMonth=void 0;const e=gd(),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,s){super(a,s),this.validate()}get values(){return super.values}};return Qh.CronDayOfMonth=o,Qh}var Zh={},tD;function nfe(){if(tD)return Zh;tD=1,Object.defineProperty(Zh,"__esModule",{value:!0}),Zh.CronDayOfWeek=void 0;const e=gd(),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,s){super(a,s),this.validate()}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}};return Zh.CronDayOfWeek=o,Zh}var Jh={},nD;function rfe(){if(nD)return Jh;nD=1,Object.defineProperty(Jh,"__esModule",{value:!0}),Jh.CronHour=void 0;const e=gd(),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,s){super(a,s),this.validate()}get values(){return super.values}};return Jh.CronHour=o,Jh}var em={},rD;function ofe(){if(rD)return em;rD=1,Object.defineProperty(em,"__esModule",{value:!0}),em.CronMinute=void 0;const e=gd(),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,s){super(a,s),this.validate()}get values(){return super.values}};return em.CronMinute=o,em}var tm={},oD={},Ca={},aD;function afe(){if(aD)return Ca;aD=1,Object.defineProperty(Ca,"__esModule",{value:!0});class e extends Error{}class t extends e{constructor(O){super(`Invalid DateTime: ${O.toMessage()}`)}}class n extends e{constructor(O){super(`Invalid Interval: ${O.toMessage()}`)}}class r extends e{constructor(O){super(`Invalid Duration: ${O.toMessage()}`)}}class o extends e{}class a extends e{constructor(O){super(`Invalid unit ${O}`)}}class s extends e{}class l extends e{constructor(){super("Zone is an abstract class")}}const d="numeric",f="short",c="long",m={year:d,month:d,day:d},y={year:d,month:f,day:d},b={year:d,month:f,day:d,weekday:f},v={year:d,month:c,day:d},x={year:d,month:c,day:d,weekday:c},w={hour:d,minute:d},S={hour:d,minute:d,second:d},T={hour:d,minute:d,second:d,timeZoneName:f},M={hour:d,minute:d,second:d,timeZoneName:c},R={hour:d,minute:d,hourCycle:"h23"},$={hour:d,minute:d,second:d,hourCycle:"h23"},P={hour:d,minute:d,second:d,hourCycle:"h23",timeZoneName:f},N={hour:d,minute:d,second:d,hourCycle:"h23",timeZoneName:c},V={year:d,month:d,day:d,hour:d,minute:d},z={year:d,month:d,day:d,hour:d,minute:d,second:d},W={year:d,month:f,day:d,hour:d,minute:d},H={year:d,month:f,day:d,hour:d,minute:d,second:d},k={year:d,month:f,day:d,weekday:f,hour:d,minute:d},I={year:d,month:c,day:d,hour:d,minute:d,timeZoneName:f},F={year:d,month:c,day:d,hour:d,minute:d,second:d,timeZoneName:f},_={year:d,month:c,day:d,weekday:c,hour:d,minute:d,timeZoneName:c},j={year:d,month:c,day:d,weekday:c,hour:d,minute:d,second:d,timeZoneName:c};class X{get type(){throw new l}get name(){throw new l}get ianaName(){return this.name}get isUniversal(){throw new l}offsetName(O,L){throw new l}formatOffset(O,L){throw new l}offset(O){throw new l}equals(O){throw new l}get isValid(){throw new l}}let Q=null;class te extends X{static get instance(){return Q===null&&(Q=new te),Q}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(O,{format:L,locale:Y}){return Zc(O,L,Y)}formatOffset(O,L){return ws(this.offset(O),L)}offset(O){return-new Date(O).getTimezoneOffset()}equals(O){return O.type==="system"}get isValid(){return!0}}const Z=new Map;function G(U){let O=Z.get(U);return O===void 0&&(O=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:U,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Z.set(U,O)),O}const ne={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function se(U,O){const L=U.format(O).replace(/\u200E/g,""),Y=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(L),[,ee,ve,Oe,je,Ue,Ot,gn]=Y;return[Oe,ee,ve,je,Ue,Ot,gn]}function pe(U,O){const L=U.formatToParts(O),Y=[];for(let ee=0;ee<L.length;ee++){const{type:ve,value:Oe}=L[ee],je=ne[ve];ve==="era"?Y[je]=Oe:Ke(je)||(Y[je]=parseInt(Oe,10))}return Y}const oe=new Map;class ae extends X{static create(O){let L=oe.get(O);return L===void 0&&oe.set(O,L=new ae(O)),L}static resetCache(){oe.clear(),Z.clear()}static isValidSpecifier(O){return this.isValidZone(O)}static isValidZone(O){if(!O)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:O}).format(),!0}catch{return!1}}constructor(O){super(),this.zoneName=O,this.valid=ae.isValidZone(O)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(O,{format:L,locale:Y}){return Zc(O,L,Y,this.name)}formatOffset(O,L){return ws(this.offset(O),L)}offset(O){if(!this.valid)return NaN;const L=new Date(O);if(isNaN(L))return NaN;const Y=G(this.name);let[ee,ve,Oe,je,Ue,Ot,gn]=Y.formatToParts?pe(Y,L):se(Y,L);je==="BC"&&(ee=-Math.abs(ee)+1);const jn=Ss({year:ee,month:ve,day:Oe,hour:Ue===24?0:Ue,minute:Ot,second:gn,millisecond:0});let lr=+L;const Sn=lr%1e3;return lr-=Sn>=0?Sn:1e3+Sn,(jn-lr)/(60*1e3)}equals(O){return O.type==="iana"&&O.name===this.name}get isValid(){return this.valid}}let ce={};function ge(U,O={}){const L=JSON.stringify([U,O]);let Y=ce[L];return Y||(Y=new Intl.ListFormat(U,O),ce[L]=Y),Y}const ye=new Map;function we(U,O={}){const L=JSON.stringify([U,O]);let Y=ye.get(L);return Y===void 0&&(Y=new Intl.DateTimeFormat(U,O),ye.set(L,Y)),Y}const Ce=new Map;function $e(U,O={}){const L=JSON.stringify([U,O]);let Y=Ce.get(L);return Y===void 0&&(Y=new Intl.NumberFormat(U,O),Ce.set(L,Y)),Y}const de=new Map;function ke(U,O={}){const{base:L,...Y}=O,ee=JSON.stringify([U,Y]);let ve=de.get(ee);return ve===void 0&&(ve=new Intl.RelativeTimeFormat(U,O),de.set(ee,ve)),ve}let et=null;function ze(){return et||(et=new Intl.DateTimeFormat().resolvedOptions().locale,et)}const Ae=new Map;function le(U){let O=Ae.get(U);return O===void 0&&(O=new Intl.DateTimeFormat(U).resolvedOptions(),Ae.set(U,O)),O}const bt=new Map;function Fe(U){let O=bt.get(U);if(!O){const L=new Intl.Locale(U);O="getWeekInfo"in L?L.getWeekInfo():L.weekInfo,"minimalDays"in O||(O={...We,...O}),bt.set(U,O)}return O}function it(U){const O=U.indexOf("-x-");O!==-1&&(U=U.substring(0,O));const L=U.indexOf("-u-");if(L===-1)return[U];{let Y,ee;try{Y=we(U).resolvedOptions(),ee=U}catch{const je=U.substring(0,L);Y=we(je).resolvedOptions(),ee=je}const{numberingSystem:ve,calendar:Oe}=Y;return[ee,ve,Oe]}}function pt(U,O,L){return(L||O)&&(U.includes("-u-")||(U+="-u"),L&&(U+=`-ca-${L}`),O&&(U+=`-nu-${O}`)),U}function Ft(U){const O=[];for(let L=1;L<=12;L++){const Y=mn.utc(2009,L,1);O.push(U(Y))}return O}function _t(U){const O=[];for(let L=1;L<=7;L++){const Y=mn.utc(2016,11,13+L);O.push(U(Y))}return O}function at(U,O,L,Y){const ee=U.listingMode();return ee==="error"?null:ee==="en"?L(O):Y(O)}function Xe(U){return U.numberingSystem&&U.numberingSystem!=="latn"?!1:U.numberingSystem==="latn"||!U.locale||U.locale.startsWith("en")||le(U.locale).numberingSystem==="latn"}class rt{constructor(O,L,Y){this.padTo=Y.padTo||0,this.floor=Y.floor||!1;const{padTo:ee,floor:ve,...Oe}=Y;if(!L||Object.keys(Oe).length>0){const je={useGrouping:!1,...Y};Y.padTo>0&&(je.minimumIntegerDigits=Y.padTo),this.inf=$e(O,je)}}format(O){if(this.inf){const L=this.floor?Math.floor(O):O;return this.inf.format(L)}else{const L=this.floor?Math.floor(O):Vl(O,3);return sr(L,this.padTo)}}}class Ne{constructor(O,L,Y){this.opts=Y,this.originalZone=void 0;let ee;if(this.opts.timeZone)this.dt=O;else if(O.zone.type==="fixed"){const Oe=-1*(O.offset/60),je=Oe>=0?`Etc/GMT+${Oe}`:`Etc/GMT${Oe}`;O.offset!==0&&ae.create(je).valid?(ee=je,this.dt=O):(ee="UTC",this.dt=O.offset===0?O:O.setZone("UTC").plus({minutes:O.offset}),this.originalZone=O.zone)}else O.zone.type==="system"?this.dt=O:O.zone.type==="iana"?(this.dt=O,ee=O.zone.name):(ee="UTC",this.dt=O.setZone("UTC").plus({minutes:O.offset}),this.originalZone=O.zone);const ve={...this.opts};ve.timeZone=ve.timeZone||ee,this.dtf=we(L,ve)}format(){return this.originalZone?this.formatToParts().map(({value:O})=>O).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const O=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?O.map(L=>{if(L.type==="timeZoneName"){const Y=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...L,value:Y}}else return L}):O}resolvedOptions(){return this.dtf.resolvedOptions()}}class he{constructor(O,L,Y){this.opts={style:"long",...Y},!L&&Ee()&&(this.rtf=ke(O,Y))}format(O,L){return this.rtf?this.rtf.format(O,L):Yl(L,O,this.opts.numeric,this.opts.style!=="long")}formatToParts(O,L){return this.rtf?this.rtf.formatToParts(O,L):[]}}const We={firstDay:1,minimalDays:4,weekend:[6,7]};class Te{static fromOpts(O){return Te.create(O.locale,O.numberingSystem,O.outputCalendar,O.weekSettings,O.defaultToEN)}static create(O,L,Y,ee,ve=!1){const Oe=O||qe.defaultLocale,je=Oe||(ve?"en-US":ze()),Ue=L||qe.defaultNumberingSystem,Ot=Y||qe.defaultOutputCalendar,gn=Yt(ee)||qe.defaultWeekSettings;return new Te(je,Ue,Ot,gn,Oe)}static resetCache(){et=null,ye.clear(),Ce.clear(),de.clear(),Ae.clear(),bt.clear()}static fromObject({locale:O,numberingSystem:L,outputCalendar:Y,weekSettings:ee}={}){return Te.create(O,L,Y,ee)}constructor(O,L,Y,ee,ve){const[Oe,je,Ue]=it(O);this.locale=Oe,this.numberingSystem=L||je||null,this.outputCalendar=Y||Ue||null,this.weekSettings=ee,this.intl=pt(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=ve,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Xe(this)),this.fastNumbersCached}listingMode(){const O=this.isEnglish(),L=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return O&&L?"en":"intl"}clone(O){return!O||Object.getOwnPropertyNames(O).length===0?this:Te.create(O.locale||this.specifiedLocale,O.numberingSystem||this.numberingSystem,O.outputCalendar||this.outputCalendar,Yt(O.weekSettings)||this.weekSettings,O.defaultToEN||!1)}redefaultToEN(O={}){return this.clone({...O,defaultToEN:!0})}redefaultToSystem(O={}){return this.clone({...O,defaultToEN:!1})}months(O,L=!1){return at(this,O,sl,()=>{const Y=this.intl==="ja"||this.intl.startsWith("ja-");L&=!Y;const ee=L?{month:O,day:"numeric"}:{month:O},ve=L?"format":"standalone";if(!this.monthsCache[ve][O]){const Oe=Y?je=>this.dtFormatter(je,ee).format():je=>this.extract(je,ee,"month");this.monthsCache[ve][O]=Ft(Oe)}return this.monthsCache[ve][O]})}weekdays(O,L=!1){return at(this,O,Zi,()=>{const Y=L?{weekday:O,year:"numeric",month:"long",day:"numeric"}:{weekday:O},ee=L?"format":"standalone";return this.weekdaysCache[ee][O]||(this.weekdaysCache[ee][O]=_t(ve=>this.extract(ve,Y,"weekday"))),this.weekdaysCache[ee][O]})}meridiems(){return at(this,void 0,()=>eu,()=>{if(!this.meridiemCache){const O={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[mn.utc(2016,11,13,9),mn.utc(2016,11,13,19)].map(L=>this.extract(L,O,"dayperiod"))}return this.meridiemCache})}eras(O){return at(this,O,ga,()=>{const L={era:O};return this.eraCache[O]||(this.eraCache[O]=[mn.utc(-40,1,1),mn.utc(2017,1,1)].map(Y=>this.extract(Y,L,"era"))),this.eraCache[O]})}extract(O,L,Y){const ee=this.dtFormatter(O,L),ve=ee.formatToParts(),Oe=ve.find(je=>je.type.toLowerCase()===Y);return Oe?Oe.value:null}numberFormatter(O={}){return new rt(this.intl,O.forceSimple||this.fastNumbers,O)}dtFormatter(O,L={}){return new Ne(O,this.intl,L)}relFormatter(O={}){return new he(this.intl,this.isEnglish(),O)}listFormatter(O={}){return ge(this.intl,O)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||le(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:He()?Fe(this.locale):We}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(O){return this.locale===O.locale&&this.numberingSystem===O.numberingSystem&&this.outputCalendar===O.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let kt=null;class Mt extends X{static get utcInstance(){return kt===null&&(kt=new Mt(0)),kt}static instance(O){return O===0?Mt.utcInstance:new Mt(O)}static parseSpecifier(O){if(O){const L=O.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(L)return new Mt(al(L[1],L[2]))}return null}constructor(O){super(),this.fixed=O}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${ws(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${ws(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(O,L){return ws(this.fixed,L)}get isUniversal(){return!0}offset(){return this.fixed}equals(O){return O.type==="fixed"&&O.fixed===this.fixed}get isValid(){return!0}}class gt extends X{constructor(O){super(),this.zoneName=O}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 ct(U,O){if(Ke(U)||U===null)return O;if(U instanceof X)return U;if(fn(U)){const L=U.toLowerCase();return L==="default"?O:L==="local"||L==="system"?te.instance:L==="utc"||L==="gmt"?Mt.utcInstance:Mt.parseSpecifier(L)||ae.create(U)}else return Zt(U)?Mt.instance(U):typeof U=="object"&&"offset"in U&&typeof U.offset=="function"?U:new gt(U)}const $t={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Vt={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]},un=$t.hanidec.replace(/[\[|\]]/g,"").split("");function vn(U){let O=parseInt(U,10);if(isNaN(O)){O="";for(let L=0;L<U.length;L++){const Y=U.charCodeAt(L);if(U[L].search($t.hanidec)!==-1)O+=un.indexOf(U[L]);else for(const ee in Vt){const[ve,Oe]=Vt[ee];Y>=ve&&Y<=Oe&&(O+=Y-ve)}}return parseInt(O,10)}else return O}const Bn=new Map;function Wn(){Bn.clear()}function Qt({numberingSystem:U},O=""){const L=U||"latn";let Y=Bn.get(L);Y===void 0&&(Y=new Map,Bn.set(L,Y));let ee=Y.get(O);return ee===void 0&&(ee=new RegExp(`${$t[L]}${O}`),Y.set(O,ee)),ee}let In=()=>Date.now(),be="system",zn=null,En=null,Xt=null,ie=60,Pe,Le=null;class qe{static get now(){return In}static set now(O){In=O}static set defaultZone(O){be=O}static get defaultZone(){return ct(be,te.instance)}static get defaultLocale(){return zn}static set defaultLocale(O){zn=O}static get defaultNumberingSystem(){return En}static set defaultNumberingSystem(O){En=O}static get defaultOutputCalendar(){return Xt}static set defaultOutputCalendar(O){Xt=O}static get defaultWeekSettings(){return Le}static set defaultWeekSettings(O){Le=Yt(O)}static get twoDigitCutoffYear(){return ie}static set twoDigitCutoffYear(O){ie=O%100}static get throwOnInvalid(){return Pe}static set throwOnInvalid(O){Pe=O}static resetCaches(){Te.resetCache(),ae.resetCache(),mn.resetCache(),Wn()}}class ut{constructor(O,L){this.reason=O,this.explanation=L}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Nt=[0,31,59,90,120,151,181,212,243,273,304,334],Bt=[0,31,60,91,121,152,182,213,244,274,305,335];function Dt(U,O){return new ut("unit out of range",`you specified ${O} (of type ${typeof O}) as a ${U}, which is invalid`)}function mt(U,O,L){const Y=new Date(Date.UTC(U,O-1,L));U<100&&U>=0&&Y.setUTCFullYear(Y.getUTCFullYear()-1900);const ee=Y.getUTCDay();return ee===0?7:ee}function At(U,O,L){return L+(pi(U)?Bt:Nt)[O-1]}function Et(U,O){const L=pi(U)?Bt:Nt,Y=L.findIndex(ve=>ve<O),ee=O-L[Y];return{month:Y+1,day:ee}}function wt(U,O){return(U-O+7)%7+1}function Ht(U,O=4,L=1){const{year:Y,month:ee,day:ve}=U,Oe=At(Y,ee,ve),je=wt(mt(Y,ee,ve),L);let Ue=Math.floor((Oe-je+14-O)/7),Ot;return Ue<1?(Ot=Y-1,Ue=Qi(Ot,O,L)):Ue>Qi(Y,O,L)?(Ot=Y+1,Ue=1):Ot=Y,{weekYear:Ot,weekNumber:Ue,weekday:je,...il(U)}}function On(U,O=4,L=1){const{weekYear:Y,weekNumber:ee,weekday:ve}=U,Oe=wt(mt(Y,1,O),L),je=xs(Y);let Ue=ee*7+ve-Oe-7+O,Ot;Ue<1?(Ot=Y-1,Ue+=xs(Ot)):Ue>je?(Ot=Y+1,Ue-=xs(Y)):Ot=Y;const{month:gn,day:jn}=Et(Ot,Ue);return{year:Ot,month:gn,day:jn,...il(U)}}function qn(U){const{year:O,month:L,day:Y}=U,ee=At(O,L,Y);return{year:O,ordinal:ee,...il(U)}}function bn(U){const{year:O,ordinal:L}=U,{month:Y,day:ee}=Et(O,L);return{year:O,month:Y,day:ee,...il(U)}}function dn(U,O){if(!Ke(U.localWeekday)||!Ke(U.localWeekNumber)||!Ke(U.localWeekYear)){if(!Ke(U.weekday)||!Ke(U.weekNumber)||!Ke(U.weekYear))throw new o("Cannot mix locale-based week fields with ISO-based week fields");return Ke(U.localWeekday)||(U.weekday=U.localWeekday),Ke(U.localWeekNumber)||(U.weekNumber=U.localWeekNumber),Ke(U.localWeekYear)||(U.weekYear=U.localWeekYear),delete U.localWeekday,delete U.localWeekNumber,delete U.localWeekYear,{minDaysInFirstWeek:O.getMinDaysInFirstWeek(),startOfWeek:O.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function ue(U,O=4,L=1){const Y=nn(U.weekYear),ee=xn(U.weekNumber,1,Qi(U.weekYear,O,L)),ve=xn(U.weekday,1,7);return Y?ee?ve?!1:Dt("weekday",U.weekday):Dt("week",U.weekNumber):Dt("weekYear",U.weekYear)}function fe(U){const O=nn(U.year),L=xn(U.ordinal,1,xs(U.year));return O?L?!1:Dt("ordinal",U.ordinal):Dt("year",U.year)}function Ve(U){const O=nn(U.year),L=xn(U.month,1,12),Y=xn(U.day,1,Mo(U.year,U.month));return O?L?Y?!1:Dt("day",U.day):Dt("month",U.month):Dt("year",U.year)}function vt(U){const{hour:O,minute:L,second:Y,millisecond:ee}=U,ve=xn(O,0,23)||O===24&&L===0&&Y===0&&ee===0,Oe=xn(L,0,59),je=xn(Y,0,59),Ue=xn(ee,0,999);return ve?Oe?je?Ue?!1:Dt("millisecond",ee):Dt("second",Y):Dt("minute",L):Dt("hour",O)}function Ke(U){return typeof U>"u"}function Zt(U){return typeof U=="number"}function nn(U){return typeof U=="number"&&U%1===0}function fn(U){return typeof U=="string"}function me(U){return Object.prototype.toString.call(U)==="[object Date]"}function Ee(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function He(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function yt(U){return Array.isArray(U)?U:[U]}function Rt(U,O,L){if(U.length!==0)return U.reduce((Y,ee)=>{const ve=[O(ee),ee];return Y&&L(Y[0],ve[0])===Y[0]?Y:ve},null)[1]}function Ct(U,O){return O.reduce((L,Y)=>(L[Y]=U[Y],L),{})}function St(U,O){return Object.prototype.hasOwnProperty.call(U,O)}function Yt(U){if(U==null)return null;if(typeof U!="object")throw new s("Week settings must be an object");if(!xn(U.firstDay,1,7)||!xn(U.minimalDays,1,7)||!Array.isArray(U.weekend)||U.weekend.some(O=>!xn(O,1,7)))throw new s("Invalid week settings");return{firstDay:U.firstDay,minimalDays:U.minimalDays,weekend:Array.from(U.weekend)}}function xn(U,O,L){return nn(U)&&U>=O&&U<=L}function ur(U,O){return U-O*Math.floor(U/O)}function sr(U,O=2){const L=U<0;let Y;return L?Y="-"+(""+-U).padStart(O,"0"):Y=(""+U).padStart(O,"0"),Y}function za(U){if(!(Ke(U)||U===null||U===""))return parseInt(U,10)}function Gi(U){if(!(Ke(U)||U===null||U===""))return parseFloat(U)}function bs(U){if(!(Ke(U)||U===null||U==="")){const O=parseFloat("0."+U)*1e3;return Math.floor(O)}}function Vl(U,O,L="round"){const Y=10**O;switch(L){case"expand":return U>0?Math.ceil(U*Y)/Y:Math.floor(U*Y)/Y;case"trunc":return Math.trunc(U*Y)/Y;case"round":return Math.round(U*Y)/Y;case"floor":return Math.floor(U*Y)/Y;case"ceil":return Math.ceil(U*Y)/Y;default:throw new RangeError(`Value rounding ${L} is out of range`)}}function pi(U){return U%4===0&&(U%100!==0||U%400===0)}function xs(U){return pi(U)?366:365}function Mo(U,O){const L=ur(O-1,12)+1,Y=U+(O-L)/12;return L===2?pi(Y)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][L-1]}function Ss(U){let O=Date.UTC(U.year,U.month-1,U.day,U.hour,U.minute,U.second,U.millisecond);return U.year<100&&U.year>=0&&(O=new Date(O),O.setUTCFullYear(U.year,U.month-1,U.day)),+O}function Xc(U,O,L){return-wt(mt(U,1,O),L)+O-1}function Qi(U,O=4,L=1){const Y=Xc(U,O,L),ee=Xc(U+1,O,L);return(xs(U)-Y+ee)/7}function hi(U){return U>99?U:U>qe.twoDigitCutoffYear?1900+U:2e3+U}function Zc(U,O,L,Y=null){const ee=new Date(U),ve={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};Y&&(ve.timeZone=Y);const Oe={timeZoneName:O,...ve},je=new Intl.DateTimeFormat(L,Oe).formatToParts(ee).find(Ue=>Ue.type.toLowerCase()==="timezonename");return je?je.value:null}function al(U,O){let L=parseInt(U,10);Number.isNaN(L)&&(L=0);const Y=parseInt(O,10)||0,ee=L<0||Object.is(L,-0)?-Y:Y;return L*60+ee}function Xi(U){const O=Number(U);if(typeof U=="boolean"||U===""||!Number.isFinite(O))throw new s(`Invalid unit value ${U}`);return O}function Hl(U,O){const L={};for(const Y in U)if(St(U,Y)){const ee=U[Y];if(ee==null)continue;L[O(Y)]=Xi(ee)}return L}function ws(U,O){const L=Math.trunc(Math.abs(U/60)),Y=Math.trunc(Math.abs(U%60)),ee=U>=0?"+":"-";switch(O){case"short":return`${ee}${sr(L,2)}:${sr(Y,2)}`;case"narrow":return`${ee}${L}${Y>0?`:${Y}`:""}`;case"techie":return`${ee}${sr(L,2)}${sr(Y,2)}`;default:throw new RangeError(`Value format ${O} is out of range for property format`)}}function il(U){return Ct(U,["hour","minute","second","millisecond"])}const Jc=["January","February","March","April","May","June","July","August","September","October","November","December"],yd=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],vp=["J","F","M","A","M","J","J","A","S","O","N","D"];function sl(U){switch(U){case"narrow":return[...vp];case"short":return[...yd];case"long":return[...Jc];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 Wl=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ql=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Cs=["M","T","W","T","F","S","S"];function Zi(U){switch(U){case"narrow":return[...Cs];case"short":return[...ql];case"long":return[...Wl];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const eu=["AM","PM"],tu=["Before Christ","Anno Domini"],vd=["BC","AD"],ll=["B","A"];function ga(U){switch(U){case"narrow":return[...ll];case"short":return[...vd];case"long":return[...tu];default:return null}}function nu(U){return eu[U.hour<12?0:1]}function cl(U,O){return Zi(O)[U.weekday-1]}function mi(U,O){return sl(O)[U.month-1]}function ru(U,O){return ga(O)[U.year<0?0:1]}function Yl(U,O,L="always",Y=!1){const ee={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."]},ve=["hours","minutes","seconds"].indexOf(U)===-1;if(L==="auto"&&ve){const jn=U==="days";switch(O){case 1:return jn?"tomorrow":`next ${ee[U][0]}`;case-1:return jn?"yesterday":`last ${ee[U][0]}`;case 0:return jn?"today":`this ${ee[U][0]}`}}const Oe=Object.is(O,-0)||O<0,je=Math.abs(O),Ue=je===1,Ot=ee[U],gn=Y?Ue?Ot[1]:Ot[2]||Ot[1]:Ue?ee[U][0]:U;return Oe?`${je} ${gn} ago`:`in ${je} ${gn}`}function ou(U,O){let L="";for(const Y of U)Y.literal?L+=Y.val:L+=O(Y.val);return L}const Kl={D:m,DD:y,DDD:v,DDDD:x,t:w,tt:S,ttt:T,tttt:M,T:R,TT:$,TTT:P,TTTT:N,f:V,ff:W,fff:I,ffff:_,F:z,FF:H,FFF:F,FFFF:j};class Qr{static create(O,L={}){return new Qr(O,L)}static parseFormat(O){let L=null,Y="",ee=!1;const ve=[];for(let Oe=0;Oe<O.length;Oe++){const je=O.charAt(Oe);je==="'"?((Y.length>0||ee)&&ve.push({literal:ee||/^\s+$/.test(Y),val:Y===""?"'":Y}),L=null,Y="",ee=!ee):ee||je===L?Y+=je:(Y.length>0&&ve.push({literal:/^\s+$/.test(Y),val:Y}),Y=je,L=je)}return Y.length>0&&ve.push({literal:ee||/^\s+$/.test(Y),val:Y}),ve}static macroTokenToFormatOpts(O){return Kl[O]}constructor(O,L){this.opts=L,this.loc=O,this.systemLoc=null}formatWithSystemDefault(O,L){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(O,{...this.opts,...L}).format()}dtFormatter(O,L={}){return this.loc.dtFormatter(O,{...this.opts,...L})}formatDateTime(O,L){return this.dtFormatter(O,L).format()}formatDateTimeParts(O,L){return this.dtFormatter(O,L).formatToParts()}formatInterval(O,L){return this.dtFormatter(O.start,L).dtf.formatRange(O.start.toJSDate(),O.end.toJSDate())}resolvedOptions(O,L){return this.dtFormatter(O,L).resolvedOptions()}num(O,L=0,Y=void 0){if(this.opts.forceSimple)return sr(O,L);const ee={...this.opts};return L>0&&(ee.padTo=L),Y&&(ee.signDisplay=Y),this.loc.numberFormatter(ee).format(O)}formatDateTimeFromString(O,L){const Y=this.loc.listingMode()==="en",ee=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",ve=(Sn,qr)=>this.loc.extract(O,Sn,qr),Oe=Sn=>O.isOffsetFixed&&O.offset===0&&Sn.allowZ?"Z":O.isValid?O.zone.formatOffset(O.ts,Sn.format):"",je=()=>Y?nu(O):ve({hour:"numeric",hourCycle:"h12"},"dayperiod"),Ue=(Sn,qr)=>Y?mi(O,Sn):ve(qr?{month:Sn}:{month:Sn,day:"numeric"},"month"),Ot=(Sn,qr)=>Y?cl(O,Sn):ve(qr?{weekday:Sn}:{weekday:Sn,month:"long",day:"numeric"},"weekday"),gn=Sn=>{const qr=Qr.macroTokenToFormatOpts(Sn);return qr?this.formatWithSystemDefault(O,qr):Sn},jn=Sn=>Y?ru(O,Sn):ve({era:Sn},"era"),lr=Sn=>{switch(Sn){case"S":return this.num(O.millisecond);case"u":case"SSS":return this.num(O.millisecond,3);case"s":return this.num(O.second);case"ss":return this.num(O.second,2);case"uu":return this.num(Math.floor(O.millisecond/10),2);case"uuu":return this.num(Math.floor(O.millisecond/100));case"m":return this.num(O.minute);case"mm":return this.num(O.minute,2);case"h":return this.num(O.hour%12===0?12:O.hour%12);case"hh":return this.num(O.hour%12===0?12:O.hour%12,2);case"H":return this.num(O.hour);case"HH":return this.num(O.hour,2);case"Z":return Oe({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return Oe({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return Oe({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return O.zone.offsetName(O.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return O.zone.offsetName(O.ts,{format:"long",locale:this.loc.locale});case"z":return O.zoneName;case"a":return je();case"d":return ee?ve({day:"numeric"},"day"):this.num(O.day);case"dd":return ee?ve({day:"2-digit"},"day"):this.num(O.day,2);case"c":return this.num(O.weekday);case"ccc":return Ot("short",!0);case"cccc":return Ot("long",!0);case"ccccc":return Ot("narrow",!0);case"E":return this.num(O.weekday);case"EEE":return Ot("short",!1);case"EEEE":return Ot("long",!1);case"EEEEE":return Ot("narrow",!1);case"L":return ee?ve({month:"numeric",day:"numeric"},"month"):this.num(O.month);case"LL":return ee?ve({month:"2-digit",day:"numeric"},"month"):this.num(O.month,2);case"LLL":return Ue("short",!0);case"LLLL":return Ue("long",!0);case"LLLLL":return Ue("narrow",!0);case"M":return ee?ve({month:"numeric"},"month"):this.num(O.month);case"MM":return ee?ve({month:"2-digit"},"month"):this.num(O.month,2);case"MMM":return Ue("short",!1);case"MMMM":return Ue("long",!1);case"MMMMM":return Ue("narrow",!1);case"y":return ee?ve({year:"numeric"},"year"):this.num(O.year);case"yy":return ee?ve({year:"2-digit"},"year"):this.num(O.year.toString().slice(-2),2);case"yyyy":return ee?ve({year:"numeric"},"year"):this.num(O.year,4);case"yyyyyy":return ee?ve({year:"numeric"},"year"):this.num(O.year,6);case"G":return jn("short");case"GG":return jn("long");case"GGGGG":return jn("narrow");case"kk":return this.num(O.weekYear.toString().slice(-2),2);case"kkkk":return this.num(O.weekYear,4);case"W":return this.num(O.weekNumber);case"WW":return this.num(O.weekNumber,2);case"n":return this.num(O.localWeekNumber);case"nn":return this.num(O.localWeekNumber,2);case"ii":return this.num(O.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(O.localWeekYear,4);case"o":return this.num(O.ordinal);case"ooo":return this.num(O.ordinal,3);case"q":return this.num(O.quarter);case"qq":return this.num(O.quarter,2);case"X":return this.num(Math.floor(O.ts/1e3));case"x":return this.num(O.ts);default:return gn(Sn)}};return ou(Qr.parseFormat(L),lr)}formatDurationFromString(O,L){const Y=this.opts.signMode==="negativeLargestOnly"?-1:1,ee=gn=>{switch(gn[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}},ve=(gn,jn)=>lr=>{const Sn=ee(lr);if(Sn){const qr=jn.isNegativeDuration&&Sn!==jn.largestUnit?Y:1;let Ao;return this.opts.signMode==="negativeLargestOnly"&&Sn!==jn.largestUnit?Ao="never":this.opts.signMode==="all"?Ao="always":Ao="auto",this.num(gn.get(Sn)*qr,lr.length,Ao)}else return lr},Oe=Qr.parseFormat(L),je=Oe.reduce((gn,{literal:jn,val:lr})=>jn?gn:gn.concat(lr),[]),Ue=O.shiftTo(...je.map(ee).filter(gn=>gn)),Ot={isNegativeDuration:Ue<0,largestUnit:Object.keys(Ue.values)[0]};return ou(Oe,ve(Ue,Ot))}}const au=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function A(...U){const O=U.reduce((L,Y)=>L+Y.source,"");return RegExp(`^${O}$`)}function ho(...U){return O=>U.reduce(([L,Y,ee],ve)=>{const[Oe,je,Ue]=ve(O,ee);return[{...L,...Oe},je||Y,Ue]},[{},null,1]).slice(0,2)}function Xr(U,...O){if(U==null)return[null,null];for(const[L,Y]of O){const ee=L.exec(U);if(ee)return Y(ee)}return[null,null]}function Fa(...U){return(O,L)=>{const Y={};let ee;for(ee=0;ee<U.length;ee++)Y[U[ee]]=za(O[L+ee]);return[Y,null,L+ee]}}const Me=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,Ji=`(?:${Me.source}?(?:\\[(${au.source})\\])?)?`,An=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Do=RegExp(`${An.source}${Ji}`),ks=RegExp(`(?:[Tt]${Do.source})?`),iu=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,bd=/(\d{4})-?W(\d\d)(?:-?(\d))?/,xd=/(\d{4})-?(\d{3})/,Ze=Fa("weekYear","weekNumber","weekDay"),su=Fa("year","ordinal"),lu=/(\d{4})-(\d\d)-(\d\d)/,Gl=RegExp(`${An.source} ?(?:${Me.source}|(${au.source}))?`),Sd=RegExp(`(?: ${Gl.source})?`);function Ts(U,O,L){const Y=U[O];return Ke(Y)?L:za(Y)}function ul(U,O){return[{year:Ts(U,O),month:Ts(U,O+1,1),day:Ts(U,O+2,1)},null,O+3]}function es(U,O){return[{hours:Ts(U,O,0),minutes:Ts(U,O+1,0),seconds:Ts(U,O+2,0),milliseconds:bs(U[O+3])},null,O+4]}function Ms(U,O){const L=!U[O]&&!U[O+1],Y=al(U[O+1],U[O+2]),ee=L?null:Mt.instance(Y);return[{},ee,O+3]}function Go(U,O){const L=U[O]?ae.create(U[O]):null;return[{},L,O+1]}const bp=RegExp(`^T?${An.source}$`),xp=/^-?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 dl(U){const[O,L,Y,ee,ve,Oe,je,Ue,Ot]=U,gn=O[0]==="-",jn=Ue&&Ue[0]==="-",lr=(Sn,qr=!1)=>Sn!==void 0&&(qr||Sn&&gn)?-Sn:Sn;return[{years:lr(Gi(L)),months:lr(Gi(Y)),weeks:lr(Gi(ee)),days:lr(Gi(ve)),hours:lr(Gi(Oe)),minutes:lr(Gi(je)),seconds:lr(Gi(Ue),Ue==="-0"),milliseconds:lr(bs(Ot),jn)}]}const wd={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function cu(U,O,L,Y,ee,ve,Oe){const je={year:O.length===2?hi(za(O)):za(O),month:yd.indexOf(L)+1,day:za(Y),hour:za(ee),minute:za(ve)};return Oe&&(je.second=za(Oe)),U&&(je.weekday=U.length>3?Wl.indexOf(U)+1:ql.indexOf(U)+1),je}const Sp=/^(?:(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 Cd(U){const[,O,L,Y,ee,ve,Oe,je,Ue,Ot,gn,jn]=U,lr=cu(O,ee,Y,L,ve,Oe,je);let Sn;return Ue?Sn=wd[Ue]:Ot?Sn=0:Sn=al(gn,jn),[lr,new Mt(Sn)]}function wp(U){return U.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const kd=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,uu=/^(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$/,Cp=/^(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 Ql(U){const[,O,L,Y,ee,ve,Oe,je]=U;return[cu(O,ee,Y,L,ve,Oe,je),Mt.utcInstance]}function kp(U){const[,O,L,Y,ee,ve,Oe,je]=U;return[cu(O,je,L,Y,ee,ve,Oe),Mt.utcInstance]}const Tp=A(iu,ks),Mp=A(bd,ks),Ep=A(xd,ks),du=A(Do),Es=ho(ul,es,Ms,Go),Op=ho(Ze,es,Ms,Go),Td=ho(su,es,Ms,Go),Md=ho(es,Ms,Go);function Ed(U){return Xr(U,[Tp,Es],[Mp,Op],[Ep,Td],[du,Md])}function Od(U){return Xr(wp(U),[Sp,Cd])}function Rd(U){return Xr(U,[kd,Ql],[uu,Ql],[Cp,kp])}function Os(U){return Xr(U,[xp,dl])}const Rp=ho(es);function $p(U){return Xr(U,[bp,Rp])}const Pp=A(lu,Sd),$d=A(Gl),Pd=ho(es,Ms,Go);function fl(U){return Xr(U,[Pp,Es],[$d,Pd])}const tr="Invalid Duration",ts={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}},Wr={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},...ts},B=146097/400,K=146097/4800,q={years:{quarters:4,months:12,weeks:B/7,days:B,hours:B*24,minutes:B*24*60,seconds:B*24*60*60,milliseconds:B*24*60*60*1e3},quarters:{months:3,weeks:B/28,days:B/4,hours:B*24/4,minutes:B*24*60/4,seconds:B*24*60*60/4,milliseconds:B*24*60*60*1e3/4},months:{weeks:K/7,days:K,hours:K*24,minutes:K*24*60,seconds:K*24*60*60,milliseconds:K*24*60*60*1e3},...ts},Se=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],qt=Se.slice(0).reverse();function Ut(U,O,L=!1){const Y={values:L?O.values:{...U.values,...O.values||{}},loc:U.loc.clone(O.loc),conversionAccuracy:O.conversionAccuracy||U.conversionAccuracy,matrix:O.matrix||U.matrix};return new Wt(Y)}function Rn(U,O){var L;let Y=(L=O.milliseconds)!=null?L:0;for(const ee of qt.slice(1))O[ee]&&(Y+=O[ee]*U[ee].milliseconds);return Y}function Yn(U,O){const L=Rn(U,O)<0?-1:1;Se.reduceRight((Y,ee)=>{if(Ke(O[ee]))return Y;if(Y){const ve=O[Y]*L,Oe=U[ee][Y],je=Math.floor(ve/Oe);O[ee]+=je*L,O[Y]-=je*Oe*L}return ee},null),Se.reduce((Y,ee)=>{if(Ke(O[ee]))return Y;if(Y){const ve=O[Y]%1;O[Y]-=ve,O[ee]+=ve*U[Y][ee]}return ee},null)}function Kn(U){const O={};for(const[L,Y]of Object.entries(U))Y!==0&&(O[L]=Y);return O}class Wt{constructor(O){const L=O.conversionAccuracy==="longterm"||!1;let Y=L?q:Wr;O.matrix&&(Y=O.matrix),this.values=O.values,this.loc=O.loc||Te.create(),this.conversionAccuracy=L?"longterm":"casual",this.invalid=O.invalid||null,this.matrix=Y,this.isLuxonDuration=!0}static fromMillis(O,L){return Wt.fromObject({milliseconds:O},L)}static fromObject(O,L={}){if(O==null||typeof O!="object")throw new s(`Duration.fromObject: argument expected to be an object, got ${O===null?"null":typeof O}`);return new Wt({values:Hl(O,Wt.normalizeUnit),loc:Te.fromObject(L),conversionAccuracy:L.conversionAccuracy,matrix:L.matrix})}static fromDurationLike(O){if(Zt(O))return Wt.fromMillis(O);if(Wt.isDuration(O))return O;if(typeof O=="object")return Wt.fromObject(O);throw new s(`Unknown duration argument ${O} of type ${typeof O}`)}static fromISO(O,L){const[Y]=Os(O);return Y?Wt.fromObject(Y,L):Wt.invalid("unparsable",`the input "${O}" can't be parsed as ISO 8601`)}static fromISOTime(O,L){const[Y]=$p(O);return Y?Wt.fromObject(Y,L):Wt.invalid("unparsable",`the input "${O}" can't be parsed as ISO 8601`)}static invalid(O,L=null){if(!O)throw new s("need to specify a reason the Duration is invalid");const Y=O instanceof ut?O:new ut(O,L);if(qe.throwOnInvalid)throw new r(Y);return new Wt({invalid:Y})}static normalizeUnit(O){const L={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"}[O&&O.toLowerCase()];if(!L)throw new a(O);return L}static isDuration(O){return O&&O.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(O,L={}){const Y={...L,floor:L.round!==!1&&L.floor!==!1};return this.isValid?Qr.create(this.loc,Y).formatDurationFromString(this,O):tr}toHuman(O={}){if(!this.isValid)return tr;const L=O.showZeros!==!1,Y=Se.map(ee=>{const ve=this.values[ee];return Ke(ve)||ve===0&&!L?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...O,unit:ee.slice(0,-1)}).format(ve)}).filter(ee=>ee);return this.loc.listFormatter({type:"conjunction",style:O.listStyle||"narrow",...O}).format(Y)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let O="P";return this.years!==0&&(O+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(O+=this.months+this.quarters*3+"M"),this.weeks!==0&&(O+=this.weeks+"W"),this.days!==0&&(O+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(O+="T"),this.hours!==0&&(O+=this.hours+"H"),this.minutes!==0&&(O+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(O+=Vl(this.seconds+this.milliseconds/1e3,3)+"S"),O==="P"&&(O+="T0S"),O}toISOTime(O={}){if(!this.isValid)return null;const L=this.toMillis();return L<0||L>=864e5?null:(O={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...O,includeOffset:!1},mn.fromMillis(L,{zone:"UTC"}).toISOTime(O))}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?Rn(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(O){if(!this.isValid)return this;const L=Wt.fromDurationLike(O),Y={};for(const ee of Se)(St(L.values,ee)||St(this.values,ee))&&(Y[ee]=L.get(ee)+this.get(ee));return Ut(this,{values:Y},!0)}minus(O){if(!this.isValid)return this;const L=Wt.fromDurationLike(O);return this.plus(L.negate())}mapUnits(O){if(!this.isValid)return this;const L={};for(const Y of Object.keys(this.values))L[Y]=Xi(O(this.values[Y],Y));return Ut(this,{values:L},!0)}get(O){return this[Wt.normalizeUnit(O)]}set(O){if(!this.isValid)return this;const L={...this.values,...Hl(O,Wt.normalizeUnit)};return Ut(this,{values:L})}reconfigure({locale:O,numberingSystem:L,conversionAccuracy:Y,matrix:ee}={}){const ve={loc:this.loc.clone({locale:O,numberingSystem:L}),matrix:ee,conversionAccuracy:Y};return Ut(this,ve)}as(O){return this.isValid?this.shiftTo(O).get(O):NaN}normalize(){if(!this.isValid)return this;const O=this.toObject();return Yn(this.matrix,O),Ut(this,{values:O},!0)}rescale(){if(!this.isValid)return this;const O=Kn(this.normalize().shiftToAll().toObject());return Ut(this,{values:O},!0)}shiftTo(...O){if(!this.isValid)return this;if(O.length===0)return this;O=O.map(Oe=>Wt.normalizeUnit(Oe));const L={},Y={},ee=this.toObject();let ve;for(const Oe of Se)if(O.indexOf(Oe)>=0){ve=Oe;let je=0;for(const Ot in Y)je+=this.matrix[Ot][Oe]*Y[Ot],Y[Ot]=0;Zt(ee[Oe])&&(je+=ee[Oe]);const Ue=Math.trunc(je);L[Oe]=Ue,Y[Oe]=(je*1e3-Ue*1e3)/1e3}else Zt(ee[Oe])&&(Y[Oe]=ee[Oe]);for(const Oe in Y)Y[Oe]!==0&&(L[ve]+=Oe===ve?Y[Oe]:Y[Oe]/this.matrix[ve][Oe]);return Yn(this.matrix,L),Ut(this,{values:L},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const O={};for(const L of Object.keys(this.values))O[L]=this.values[L]===0?0:-this.values[L];return Ut(this,{values:O},!0)}removeZeros(){if(!this.isValid)return this;const O=Kn(this.values);return Ut(this,{values:O},!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(O){if(!this.isValid||!O.isValid||!this.loc.equals(O.loc))return!1;function L(Y,ee){return Y===void 0||Y===0?ee===void 0||ee===0:Y===ee}for(const Y of Se)if(!L(this.values[Y],O.values[Y]))return!1;return!0}}const wr="Invalid Interval";function Cr(U,O){return!U||!U.isValid?rn.invalid("missing or invalid start"):!O||!O.isValid?rn.invalid("missing or invalid end"):O<U?rn.invalid("end before start",`The end of an interval must be after its start, but you had start=${U.toISO()} and end=${O.toISO()}`):null}class rn{constructor(O){this.s=O.start,this.e=O.end,this.invalid=O.invalid||null,this.isLuxonInterval=!0}static invalid(O,L=null){if(!O)throw new s("need to specify a reason the Interval is invalid");const Y=O instanceof ut?O:new ut(O,L);if(qe.throwOnInvalid)throw new n(Y);return new rn({invalid:Y})}static fromDateTimes(O,L){const Y=Wa(O),ee=Wa(L);return Cr(Y,ee)??new rn({start:Y,end:ee})}static after(O,L){const Y=Wt.fromDurationLike(L),ee=Wa(O);return rn.fromDateTimes(ee,ee.plus(Y))}static before(O,L){const Y=Wt.fromDurationLike(L),ee=Wa(O);return rn.fromDateTimes(ee.minus(Y),ee)}static fromISO(O,L){const[Y,ee]=(O||"").split("/",2);if(Y&&ee){let ve,Oe;try{ve=mn.fromISO(Y,L),Oe=ve.isValid}catch{Oe=!1}let je,Ue;try{je=mn.fromISO(ee,L),Ue=je.isValid}catch{Ue=!1}if(Oe&&Ue)return rn.fromDateTimes(ve,je);if(Oe){const Ot=Wt.fromISO(ee,L);if(Ot.isValid)return rn.after(ve,Ot)}else if(Ue){const Ot=Wt.fromISO(Y,L);if(Ot.isValid)return rn.before(je,Ot)}}return rn.invalid("unparsable",`the input "${O}" can't be parsed as ISO 8601`)}static isInterval(O){return O&&O.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(O="milliseconds"){return this.isValid?this.toDuration(O).get(O):NaN}count(O="milliseconds",L){if(!this.isValid)return NaN;const Y=this.start.startOf(O,L);let ee;return L!=null&&L.useLocaleWeeks?ee=this.end.reconfigure({locale:Y.locale}):ee=this.end,ee=ee.startOf(O,L),Math.floor(ee.diff(Y,O).get(O))+(ee.valueOf()!==this.end.valueOf())}hasSame(O){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,O):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(O){return this.isValid?this.s>O:!1}isBefore(O){return this.isValid?this.e<=O:!1}contains(O){return this.isValid?this.s<=O&&this.e>O:!1}set({start:O,end:L}={}){return this.isValid?rn.fromDateTimes(O||this.s,L||this.e):this}splitAt(...O){if(!this.isValid)return[];const L=O.map(Wa).filter(Oe=>this.contains(Oe)).sort((Oe,je)=>Oe.toMillis()-je.toMillis()),Y=[];let{s:ee}=this,ve=0;for(;ee<this.e;){const Oe=L[ve]||this.e,je=+Oe>+this.e?this.e:Oe;Y.push(rn.fromDateTimes(ee,je)),ee=je,ve+=1}return Y}splitBy(O){const L=Wt.fromDurationLike(O);if(!this.isValid||!L.isValid||L.as("milliseconds")===0)return[];let{s:Y}=this,ee=1,ve;const Oe=[];for(;Y<this.e;){const je=this.start.plus(L.mapUnits(Ue=>Ue*ee));ve=+je>+this.e?this.e:je,Oe.push(rn.fromDateTimes(Y,ve)),Y=ve,ee+=1}return Oe}divideEqually(O){return this.isValid?this.splitBy(this.length()/O).slice(0,O):[]}overlaps(O){return this.e>O.s&&this.s<O.e}abutsStart(O){return this.isValid?+this.e==+O.s:!1}abutsEnd(O){return this.isValid?+O.e==+this.s:!1}engulfs(O){return this.isValid?this.s<=O.s&&this.e>=O.e:!1}equals(O){return!this.isValid||!O.isValid?!1:this.s.equals(O.s)&&this.e.equals(O.e)}intersection(O){if(!this.isValid)return this;const L=this.s>O.s?this.s:O.s,Y=this.e<O.e?this.e:O.e;return L>=Y?null:rn.fromDateTimes(L,Y)}union(O){if(!this.isValid)return this;const L=this.s<O.s?this.s:O.s,Y=this.e>O.e?this.e:O.e;return rn.fromDateTimes(L,Y)}static merge(O){const[L,Y]=O.sort((ee,ve)=>ee.s-ve.s).reduce(([ee,ve],Oe)=>ve?ve.overlaps(Oe)||ve.abutsStart(Oe)?[ee,ve.union(Oe)]:[ee.concat([ve]),Oe]:[ee,Oe],[[],null]);return Y&&L.push(Y),L}static xor(O){let L=null,Y=0;const ee=[],ve=O.map(Ue=>[{time:Ue.s,type:"s"},{time:Ue.e,type:"e"}]),Oe=Array.prototype.concat(...ve),je=Oe.sort((Ue,Ot)=>Ue.time-Ot.time);for(const Ue of je)Y+=Ue.type==="s"?1:-1,Y===1?L=Ue.time:(L&&+L!=+Ue.time&&ee.push(rn.fromDateTimes(L,Ue.time)),L=null);return rn.merge(ee)}difference(...O){return rn.xor([this].concat(O)).map(L=>this.intersection(L)).filter(L=>L&&!L.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:wr}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(O=m,L={}){return this.isValid?Qr.create(this.s.loc.clone(L),O).formatInterval(this):wr}toISO(O){return this.isValid?`${this.s.toISO(O)}/${this.e.toISO(O)}`:wr}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:wr}toISOTime(O){return this.isValid?`${this.s.toISOTime(O)}/${this.e.toISOTime(O)}`:wr}toFormat(O,{separator:L=" – "}={}){return this.isValid?`${this.s.toFormat(O)}${L}${this.e.toFormat(O)}`:wr}toDuration(O,L){return this.isValid?this.e.diff(this.s,O,L):Wt.invalid(this.invalidReason)}mapEndpoints(O){return rn.fromDateTimes(O(this.s),O(this.e))}}class gr{static hasDST(O=qe.defaultZone){const L=mn.now().setZone(O).set({month:12});return!O.isUniversal&&L.offset!==L.set({month:6}).offset}static isValidIANAZone(O){return ae.isValidZone(O)}static normalizeZone(O){return ct(O,qe.defaultZone)}static getStartOfWeek({locale:O=null,locObj:L=null}={}){return(L||Te.create(O)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:O=null,locObj:L=null}={}){return(L||Te.create(O)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:O=null,locObj:L=null}={}){return(L||Te.create(O)).getWeekendDays().slice()}static months(O="long",{locale:L=null,numberingSystem:Y=null,locObj:ee=null,outputCalendar:ve="gregory"}={}){return(ee||Te.create(L,Y,ve)).months(O)}static monthsFormat(O="long",{locale:L=null,numberingSystem:Y=null,locObj:ee=null,outputCalendar:ve="gregory"}={}){return(ee||Te.create(L,Y,ve)).months(O,!0)}static weekdays(O="long",{locale:L=null,numberingSystem:Y=null,locObj:ee=null}={}){return(ee||Te.create(L,Y,null)).weekdays(O)}static weekdaysFormat(O="long",{locale:L=null,numberingSystem:Y=null,locObj:ee=null}={}){return(ee||Te.create(L,Y,null)).weekdays(O,!0)}static meridiems({locale:O=null}={}){return Te.create(O).meridiems()}static eras(O="short",{locale:L=null}={}){return Te.create(L,null,"gregory").eras(O)}static features(){return{relative:Ee(),localeWeek:He()}}}function Fr(U,O){const L=ee=>ee.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),Y=L(O)-L(U);return Math.floor(Wt.fromMillis(Y).as("days"))}function Ur(U,O,L){const Y=[["years",(Ue,Ot)=>Ot.year-Ue.year],["quarters",(Ue,Ot)=>Ot.quarter-Ue.quarter+(Ot.year-Ue.year)*4],["months",(Ue,Ot)=>Ot.month-Ue.month+(Ot.year-Ue.year)*12],["weeks",(Ue,Ot)=>{const gn=Fr(Ue,Ot);return(gn-gn%7)/7}],["days",Fr]],ee={},ve=U;let Oe,je;for(const[Ue,Ot]of Y)L.indexOf(Ue)>=0&&(Oe=Ue,ee[Ue]=Ot(U,O),je=ve.plus(ee),je>O?(ee[Ue]--,U=ve.plus(ee),U>O&&(je=U,ee[Ue]--,U=ve.plus(ee))):U=je);return[U,ee,je,Oe]}function Ba(U,O,L,Y){let[ee,ve,Oe,je]=Ur(U,O,L);const Ue=O-ee,Ot=L.filter(jn=>["hours","minutes","seconds","milliseconds"].indexOf(jn)>=0);Ot.length===0&&(Oe<O&&(Oe=ee.plus({[je]:1})),Oe!==ee&&(ve[je]=(ve[je]||0)+Ue/(Oe-ee)));const gn=Wt.fromObject(ve,Y);return Ot.length>0?Wt.fromMillis(Ue,Y).shiftTo(...Ot).plus(gn):gn}const ia="missing Intl.DateTimeFormat.formatToParts support";function Ln(U,O=L=>L){return{regex:U,deser:([L])=>O(vn(L))}}const pl="[ ]",sa=new RegExp(pl,"g");function ns(U){return U.replace(/\./g,"\\.?").replace(sa,pl)}function Qo(U){return U.replace(/\./g,"").replace(sa," ").toLowerCase()}function Zr(U,O){return U===null?null:{regex:RegExp(U.map(ns).join("|")),deser:([L])=>U.findIndex(Y=>Qo(L)===Qo(Y))+O}}function hl(U,O){return{regex:U,deser:([,L,Y])=>al(L,Y),groups:O}}function mo(U){return{regex:U,deser:([O])=>O}}function Xl(U){return U.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Dp(U,O){const L=Qt(O),Y=Qt(O,"{2}"),ee=Qt(O,"{3}"),ve=Qt(O,"{4}"),Oe=Qt(O,"{6}"),je=Qt(O,"{1,2}"),Ue=Qt(O,"{1,3}"),Ot=Qt(O,"{1,6}"),gn=Qt(O,"{1,9}"),jn=Qt(O,"{2,4}"),lr=Qt(O,"{4,6}"),Sn=Ao=>({regex:RegExp(Xl(Ao.val)),deser:([ya])=>ya,literal:!0}),qr=(Ao=>{if(U.literal)return Sn(Ao);switch(Ao.val){case"G":return Zr(O.eras("short"),0);case"GG":return Zr(O.eras("long"),0);case"y":return Ln(Ot);case"yy":return Ln(jn,hi);case"yyyy":return Ln(ve);case"yyyyy":return Ln(lr);case"yyyyyy":return Ln(Oe);case"M":return Ln(je);case"MM":return Ln(Y);case"MMM":return Zr(O.months("short",!0),1);case"MMMM":return Zr(O.months("long",!0),1);case"L":return Ln(je);case"LL":return Ln(Y);case"LLL":return Zr(O.months("short",!1),1);case"LLLL":return Zr(O.months("long",!1),1);case"d":return Ln(je);case"dd":return Ln(Y);case"o":return Ln(Ue);case"ooo":return Ln(ee);case"HH":return Ln(Y);case"H":return Ln(je);case"hh":return Ln(Y);case"h":return Ln(je);case"mm":return Ln(Y);case"m":return Ln(je);case"q":return Ln(je);case"qq":return Ln(Y);case"s":return Ln(je);case"ss":return Ln(Y);case"S":return Ln(Ue);case"SSS":return Ln(ee);case"u":return mo(gn);case"uu":return mo(je);case"uuu":return Ln(L);case"a":return Zr(O.meridiems(),0);case"kkkk":return Ln(ve);case"kk":return Ln(jn,hi);case"W":return Ln(je);case"WW":return Ln(Y);case"E":case"c":return Ln(L);case"EEE":return Zr(O.weekdays("short",!1),1);case"EEEE":return Zr(O.weekdays("long",!1),1);case"ccc":return Zr(O.weekdays("short",!0),1);case"cccc":return Zr(O.weekdays("long",!0),1);case"Z":case"ZZ":return hl(new RegExp(`([+-]${je.source})(?::(${Y.source}))?`),2);case"ZZZ":return hl(new RegExp(`([+-]${je.source})(${Y.source})?`),2);case"z":return mo(/[a-z_+-/]{1,256}?/i);case" ":return mo(/[^\S\n\r]/);default:return Sn(Ao)}})(U)||{invalidReason:ia};return qr.token=U,qr}const Eg={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 ml(U,O,L){const{type:Y,value:ee}=U;if(Y==="literal"){const Ue=/^\s+$/.test(ee);return{literal:!Ue,val:Ue?" ":ee}}const ve=O[Y];let Oe=Y;Y==="hour"&&(O.hour12!=null?Oe=O.hour12?"hour12":"hour24":O.hourCycle!=null?O.hourCycle==="h11"||O.hourCycle==="h12"?Oe="hour12":Oe="hour24":Oe=L.hour12?"hour12":"hour24");let je=Eg[Oe];if(typeof je=="object"&&(je=je[ve]),je)return{literal:!1,val:je}}function Og(U){return[`^${U.map(O=>O.regex).reduce((O,L)=>`${O}(${L.source})`,"")}$`,U]}function Rg(U,O,L){const Y=U.match(O);if(Y){const ee={};let ve=1;for(const Oe in L)if(St(L,Oe)){const je=L[Oe],Ue=je.groups?je.groups+1:1;!je.literal&&je.token&&(ee[je.token.val[0]]=je.deser(Y.slice(ve,ve+Ue))),ve+=Ue}return[Y,ee]}else return[Y,{}]}function $g(U){const O=ee=>{switch(ee){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 L=null,Y;return Ke(U.z)||(L=ae.create(U.z)),Ke(U.Z)||(L||(L=new Mt(U.Z)),Y=U.Z),Ke(U.q)||(U.M=(U.q-1)*3+1),Ke(U.h)||(U.h<12&&U.a===1?U.h+=12:U.h===12&&U.a===0&&(U.h=0)),U.G===0&&U.y&&(U.y=-U.y),Ke(U.u)||(U.S=bs(U.u)),[Object.keys(U).reduce((ee,ve)=>{const Oe=O(ve);return Oe&&(ee[Oe]=U[ve]),ee},{}),L,Y]}let Ap=null;function T0(){return Ap||(Ap=mn.fromMillis(1555555555555)),Ap}function M0(U,O){if(U.literal)return U;const L=Qr.macroTokenToFormatOpts(U.val),Y=Ip(L,O);return Y==null||Y.includes(void 0)?U:Y}function jp(U,O){return Array.prototype.concat(...U.map(L=>M0(L,O)))}class Np{constructor(O,L){if(this.locale=O,this.format=L,this.tokens=jp(Qr.parseFormat(L),O),this.units=this.tokens.map(Y=>Dp(Y,O)),this.disqualifyingUnit=this.units.find(Y=>Y.invalidReason),!this.disqualifyingUnit){const[Y,ee]=Og(this.units);this.regex=RegExp(Y,"i"),this.handlers=ee}}explainFromTokens(O){if(this.isValid){const[L,Y]=Rg(O,this.regex,this.handlers),[ee,ve,Oe]=Y?$g(Y):[null,null,void 0];if(St(Y,"a")&&St(Y,"H"))throw new o("Can't include meridiem when specifying 24-hour format");return{input:O,tokens:this.tokens,regex:this.regex,rawMatches:L,matches:Y,result:ee,zone:ve,specificOffset:Oe}}else return{input:O,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function Dd(U,O,L){return new Np(U,L).explainFromTokens(O)}function Ua(U,O,L){const{result:Y,zone:ee,specificOffset:ve,invalidReason:Oe}=Dd(U,O,L);return[Y,ee,ve,Oe]}function Ip(U,O){if(!U)return null;const L=Qr.create(O,U).dtFormatter(T0()),Y=L.formatToParts(),ee=L.resolvedOptions();return Y.map(ve=>ml(ve,U,ee))}const Xo="Invalid DateTime",la=864e13;function gi(U){return new ut("unsupported zone",`the zone "${U.name}" is not supported`)}function fu(U){return U.weekData===null&&(U.weekData=Ht(U.c)),U.weekData}function Zl(U){return U.localWeekData===null&&(U.localWeekData=Ht(U.c,U.loc.getMinDaysInFirstWeek(),U.loc.getStartOfWeek())),U.localWeekData}function yi(U,O){const L={ts:U.ts,zone:U.zone,c:U.c,o:U.o,loc:U.loc,invalid:U.invalid};return new mn({...L,...O,old:L})}function Ad(U,O,L){let Y=U-O*60*1e3;const ee=L.offset(Y);if(O===ee)return[Y,O];Y-=(ee-O)*60*1e3;const ve=L.offset(Y);return ee===ve?[Y,ee]:[U-Math.min(ee,ve)*60*1e3,Math.max(ee,ve)]}function rs(U,O){U+=O*60*1e3;const L=new Date(U);return{year:L.getUTCFullYear(),month:L.getUTCMonth()+1,day:L.getUTCDate(),hour:L.getUTCHours(),minute:L.getUTCMinutes(),second:L.getUTCSeconds(),millisecond:L.getUTCMilliseconds()}}function pu(U,O,L){return Ad(Ss(U),O,L)}function hu(U,O){const L=U.o,Y=U.c.year+Math.trunc(O.years),ee=U.c.month+Math.trunc(O.months)+Math.trunc(O.quarters)*3,ve={...U.c,year:Y,month:ee,day:Math.min(U.c.day,Mo(Y,ee))+Math.trunc(O.days)+Math.trunc(O.weeks)*7},Oe=Wt.fromObject({years:O.years-Math.trunc(O.years),quarters:O.quarters-Math.trunc(O.quarters),months:O.months-Math.trunc(O.months),weeks:O.weeks-Math.trunc(O.weeks),days:O.days-Math.trunc(O.days),hours:O.hours,minutes:O.minutes,seconds:O.seconds,milliseconds:O.milliseconds}).as("milliseconds"),je=Ss(ve);let[Ue,Ot]=Ad(je,L,U.zone);return Oe!==0&&(Ue+=Oe,Ot=U.zone.offset(Ue)),{ts:Ue,o:Ot}}function _a(U,O,L,Y,ee,ve){const{setZone:Oe,zone:je}=L;if(U&&Object.keys(U).length!==0||O){const Ue=O||je,Ot=mn.fromObject(U,{...L,zone:Ue,specificOffset:ve});return Oe?Ot:Ot.setZone(je)}else return mn.invalid(new ut("unparsable",`the input "${ee}" can't be parsed as ${Y}`))}function jd(U,O,L=!0){return U.isValid?Qr.create(Te.create("en-US"),{allowZ:L,forceSimple:!0}).formatDateTimeFromString(U,O):null}function Bo(U,O,L){const Y=U.c.year>9999||U.c.year<0;let ee="";if(Y&&U.c.year>=0&&(ee+="+"),ee+=sr(U.c.year,Y?6:4),L==="year")return ee;if(O){if(ee+="-",ee+=sr(U.c.month),L==="month")return ee;ee+="-"}else if(ee+=sr(U.c.month),L==="month")return ee;return ee+=sr(U.c.day),ee}function Nd(U,O,L,Y,ee,ve,Oe){let je=!L||U.c.millisecond!==0||U.c.second!==0,Ue="";switch(Oe){case"day":case"month":case"year":break;default:if(Ue+=sr(U.c.hour),Oe==="hour")break;if(O){if(Ue+=":",Ue+=sr(U.c.minute),Oe==="minute")break;je&&(Ue+=":",Ue+=sr(U.c.second))}else{if(Ue+=sr(U.c.minute),Oe==="minute")break;je&&(Ue+=sr(U.c.second))}if(Oe==="second")break;je&&(!Y||U.c.millisecond!==0)&&(Ue+=".",Ue+=sr(U.c.millisecond,3))}return ee&&(U.isOffsetFixed&&U.offset===0&&!ve?Ue+="Z":U.o<0?(Ue+="-",Ue+=sr(Math.trunc(-U.o/60)),Ue+=":",Ue+=sr(Math.trunc(-U.o%60))):(Ue+="+",Ue+=sr(Math.trunc(U.o/60)),Ue+=":",Ue+=sr(Math.trunc(U.o%60)))),ve&&(Ue+="["+U.zone.ianaName+"]"),Ue}const vi={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Pg={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Id={ordinal:1,hour:0,minute:0,second:0,millisecond:0},bi=["year","month","day","hour","minute","second","millisecond"],Lp=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],zp=["year","ordinal","hour","minute","second","millisecond"];function os(U){const O={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"}[U.toLowerCase()];if(!O)throw new a(U);return O}function gl(U){switch(U.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return os(U)}}function Ld(U){if(Va===void 0&&(Va=qe.now()),U.type!=="iana")return U.offset(Va);const O=U.name;let L=Ha.get(O);return L===void 0&&(L=U.offset(Va),Ha.set(O,L)),L}function mu(U,O){const L=ct(O.zone,qe.defaultZone);if(!L.isValid)return mn.invalid(gi(L));const Y=Te.fromObject(O);let ee,ve;if(Ke(U.year))ee=qe.now();else{for(const Ue of bi)Ke(U[Ue])&&(U[Ue]=vi[Ue]);const Oe=Ve(U)||vt(U);if(Oe)return mn.invalid(Oe);const je=Ld(L);[ee,ve]=pu(U,je,L)}return new mn({ts:ee,zone:L,loc:Y,o:ve})}function ca(U,O,L){const Y=Ke(L.round)?!0:L.round,ee=Ke(L.rounding)?"trunc":L.rounding,ve=(je,Ue)=>(je=Vl(je,Y||L.calendary?0:2,L.calendary?"round":ee),O.loc.clone(L).relFormatter(L).format(je,Ue)),Oe=je=>L.calendary?O.hasSame(U,je)?0:O.startOf(je).diff(U.startOf(je),je).get(je):O.diff(U,je).get(je);if(L.unit)return ve(Oe(L.unit),L.unit);for(const je of L.units){const Ue=Oe(je);if(Math.abs(Ue)>=1)return ve(Ue,je)}return ve(U>O?-0:0,L.units[L.units.length-1])}function ua(U){let O={},L;return U.length>0&&typeof U[U.length-1]=="object"?(O=U[U.length-1],L=Array.from(U).slice(0,U.length-1)):L=Array.from(U),[O,L]}let Va;const Ha=new Map;class mn{constructor(O){const L=O.zone||qe.defaultZone;let Y=O.invalid||(Number.isNaN(O.ts)?new ut("invalid input"):null)||(L.isValid?null:gi(L));this.ts=Ke(O.ts)?qe.now():O.ts;let ee=null,ve=null;if(!Y)if(O.old&&O.old.ts===this.ts&&O.old.zone.equals(L))[ee,ve]=[O.old.c,O.old.o];else{const Oe=Zt(O.o)&&!O.old?O.o:L.offset(this.ts);ee=rs(this.ts,Oe),Y=Number.isNaN(ee.year)?new ut("invalid input"):null,ee=Y?null:ee,ve=Y?null:Oe}this._zone=L,this.loc=O.loc||Te.create(),this.invalid=Y,this.weekData=null,this.localWeekData=null,this.c=ee,this.o=ve,this.isLuxonDateTime=!0}static now(){return new mn({})}static local(){const[O,L]=ua(arguments),[Y,ee,ve,Oe,je,Ue,Ot]=L;return mu({year:Y,month:ee,day:ve,hour:Oe,minute:je,second:Ue,millisecond:Ot},O)}static utc(){const[O,L]=ua(arguments),[Y,ee,ve,Oe,je,Ue,Ot]=L;return O.zone=Mt.utcInstance,mu({year:Y,month:ee,day:ve,hour:Oe,minute:je,second:Ue,millisecond:Ot},O)}static fromJSDate(O,L={}){const Y=me(O)?O.valueOf():NaN;if(Number.isNaN(Y))return mn.invalid("invalid input");const ee=ct(L.zone,qe.defaultZone);return ee.isValid?new mn({ts:Y,zone:ee,loc:Te.fromObject(L)}):mn.invalid(gi(ee))}static fromMillis(O,L={}){if(Zt(O))return O<-la||O>la?mn.invalid("Timestamp out of range"):new mn({ts:O,zone:ct(L.zone,qe.defaultZone),loc:Te.fromObject(L)});throw new s(`fromMillis requires a numerical input, but received a ${typeof O} with value ${O}`)}static fromSeconds(O,L={}){if(Zt(O))return new mn({ts:O*1e3,zone:ct(L.zone,qe.defaultZone),loc:Te.fromObject(L)});throw new s("fromSeconds requires a numerical input")}static fromObject(O,L={}){O=O||{};const Y=ct(L.zone,qe.defaultZone);if(!Y.isValid)return mn.invalid(gi(Y));const ee=Te.fromObject(L),ve=Hl(O,gl),{minDaysInFirstWeek:Oe,startOfWeek:je}=dn(ve,ee),Ue=qe.now(),Ot=Ke(L.specificOffset)?Y.offset(Ue):L.specificOffset,gn=!Ke(ve.ordinal),jn=!Ke(ve.year),lr=!Ke(ve.month)||!Ke(ve.day),Sn=jn||lr,qr=ve.weekYear||ve.weekNumber;if((Sn||gn)&&qr)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(lr&&gn)throw new o("Can't mix ordinal dates with month/day");const Ao=qr||ve.weekday&&!Sn;let ya,va,ba=rs(Ue,Ot);Ao?(ya=Lp,va=Pg,ba=Ht(ba,Oe,je)):gn?(ya=zp,va=Id,ba=qn(ba)):(ya=bi,va=vi);let xi=!1;for(const Rs of ya){const Ag=ve[Rs];Ke(Ag)?xi?ve[Rs]=va[Rs]:ve[Rs]=ba[Rs]:xi=!0}const Fp=Ao?ue(ve,Oe,je):gn?fe(ve):Ve(ve),zd=Fp||vt(ve);if(zd)return mn.invalid(zd);const gu=Ao?On(ve,Oe,je):gn?bn(ve):ve,[Fd,yl]=pu(gu,Ot,Y),to=new mn({ts:Fd,zone:Y,o:yl,loc:ee});return ve.weekday&&Sn&&O.weekday!==to.weekday?mn.invalid("mismatched weekday",`you can't specify both a weekday of ${ve.weekday} and a date of ${to.toISO()}`):to.isValid?to:mn.invalid(to.invalid)}static fromISO(O,L={}){const[Y,ee]=Ed(O);return _a(Y,ee,L,"ISO 8601",O)}static fromRFC2822(O,L={}){const[Y,ee]=Od(O);return _a(Y,ee,L,"RFC 2822",O)}static fromHTTP(O,L={}){const[Y,ee]=Rd(O);return _a(Y,ee,L,"HTTP",L)}static fromFormat(O,L,Y={}){if(Ke(O)||Ke(L))throw new s("fromFormat requires an input string and a format");const{locale:ee=null,numberingSystem:ve=null}=Y,Oe=Te.fromOpts({locale:ee,numberingSystem:ve,defaultToEN:!0}),[je,Ue,Ot,gn]=Ua(Oe,O,L);return gn?mn.invalid(gn):_a(je,Ue,Y,`format ${L}`,O,Ot)}static fromString(O,L,Y={}){return mn.fromFormat(O,L,Y)}static fromSQL(O,L={}){const[Y,ee]=fl(O);return _a(Y,ee,L,"SQL",O)}static invalid(O,L=null){if(!O)throw new s("need to specify a reason the DateTime is invalid");const Y=O instanceof ut?O:new ut(O,L);if(qe.throwOnInvalid)throw new t(Y);return new mn({invalid:Y})}static isDateTime(O){return O&&O.isLuxonDateTime||!1}static parseFormatForOpts(O,L={}){const Y=Ip(O,Te.fromObject(L));return Y?Y.map(ee=>ee?ee.val:null).join(""):null}static expandFormat(O,L={}){return jp(Qr.parseFormat(O),Te.fromObject(L)).map(Y=>Y.val).join("")}static resetCache(){Va=void 0,Ha.clear()}get(O){return this[O]}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?fu(this).weekYear:NaN}get weekNumber(){return this.isValid?fu(this).weekNumber:NaN}get weekday(){return this.isValid?fu(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Zl(this).weekday:NaN}get localWeekNumber(){return this.isValid?Zl(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Zl(this).weekYear:NaN}get ordinal(){return this.isValid?qn(this.c).ordinal:NaN}get monthShort(){return this.isValid?gr.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?gr.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?gr.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?gr.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 O=864e5,L=6e4,Y=Ss(this.c),ee=this.zone.offset(Y-O),ve=this.zone.offset(Y+O),Oe=this.zone.offset(Y-ee*L),je=this.zone.offset(Y-ve*L);if(Oe===je)return[this];const Ue=Y-Oe*L,Ot=Y-je*L,gn=rs(Ue,Oe),jn=rs(Ot,je);return gn.hour===jn.hour&&gn.minute===jn.minute&&gn.second===jn.second&&gn.millisecond===jn.millisecond?[yi(this,{ts:Ue}),yi(this,{ts:Ot})]:[this]}get isInLeapYear(){return pi(this.year)}get daysInMonth(){return Mo(this.year,this.month)}get daysInYear(){return this.isValid?xs(this.year):NaN}get weeksInWeekYear(){return this.isValid?Qi(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?Qi(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(O={}){const{locale:L,numberingSystem:Y,calendar:ee}=Qr.create(this.loc.clone(O),O).resolvedOptions(this);return{locale:L,numberingSystem:Y,outputCalendar:ee}}toUTC(O=0,L={}){return this.setZone(Mt.instance(O),L)}toLocal(){return this.setZone(qe.defaultZone)}setZone(O,{keepLocalTime:L=!1,keepCalendarTime:Y=!1}={}){if(O=ct(O,qe.defaultZone),O.equals(this.zone))return this;if(O.isValid){let ee=this.ts;if(L||Y){const ve=O.offset(this.ts),Oe=this.toObject();[ee]=pu(Oe,ve,O)}return yi(this,{ts:ee,zone:O})}else return mn.invalid(gi(O))}reconfigure({locale:O,numberingSystem:L,outputCalendar:Y}={}){const ee=this.loc.clone({locale:O,numberingSystem:L,outputCalendar:Y});return yi(this,{loc:ee})}setLocale(O){return this.reconfigure({locale:O})}set(O){if(!this.isValid)return this;const L=Hl(O,gl),{minDaysInFirstWeek:Y,startOfWeek:ee}=dn(L,this.loc),ve=!Ke(L.weekYear)||!Ke(L.weekNumber)||!Ke(L.weekday),Oe=!Ke(L.ordinal),je=!Ke(L.year),Ue=!Ke(L.month)||!Ke(L.day),Ot=je||Ue,gn=L.weekYear||L.weekNumber;if((Ot||Oe)&&gn)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(Ue&&Oe)throw new o("Can't mix ordinal dates with month/day");let jn;ve?jn=On({...Ht(this.c,Y,ee),...L},Y,ee):Ke(L.ordinal)?(jn={...this.toObject(),...L},Ke(L.day)&&(jn.day=Math.min(Mo(jn.year,jn.month),jn.day))):jn=bn({...qn(this.c),...L});const[lr,Sn]=pu(jn,this.o,this.zone);return yi(this,{ts:lr,o:Sn})}plus(O){if(!this.isValid)return this;const L=Wt.fromDurationLike(O);return yi(this,hu(this,L))}minus(O){if(!this.isValid)return this;const L=Wt.fromDurationLike(O).negate();return yi(this,hu(this,L))}startOf(O,{useLocaleWeeks:L=!1}={}){if(!this.isValid)return this;const Y={},ee=Wt.normalizeUnit(O);switch(ee){case"years":Y.month=1;case"quarters":case"months":Y.day=1;case"weeks":case"days":Y.hour=0;case"hours":Y.minute=0;case"minutes":Y.second=0;case"seconds":Y.millisecond=0;break}if(ee==="weeks")if(L){const ve=this.loc.getStartOfWeek(),{weekday:Oe}=this;Oe<ve&&(Y.weekNumber=this.weekNumber-1),Y.weekday=ve}else Y.weekday=1;if(ee==="quarters"){const ve=Math.ceil(this.month/3);Y.month=(ve-1)*3+1}return this.set(Y)}endOf(O,L){return this.isValid?this.plus({[O]:1}).startOf(O,L).minus(1):this}toFormat(O,L={}){return this.isValid?Qr.create(this.loc.redefaultToEN(L)).formatDateTimeFromString(this,O):Xo}toLocaleString(O=m,L={}){return this.isValid?Qr.create(this.loc.clone(L),O).formatDateTime(this):Xo}toLocaleParts(O={}){return this.isValid?Qr.create(this.loc.clone(O),O).formatDateTimeParts(this):[]}toISO({format:O="extended",suppressSeconds:L=!1,suppressMilliseconds:Y=!1,includeOffset:ee=!0,extendedZone:ve=!1,precision:Oe="milliseconds"}={}){if(!this.isValid)return null;Oe=os(Oe);const je=O==="extended";let Ue=Bo(this,je,Oe);return bi.indexOf(Oe)>=3&&(Ue+="T"),Ue+=Nd(this,je,L,Y,ee,ve,Oe),Ue}toISODate({format:O="extended",precision:L="day"}={}){return this.isValid?Bo(this,O==="extended",os(L)):null}toISOWeekDate(){return jd(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:O=!1,suppressSeconds:L=!1,includeOffset:Y=!0,includePrefix:ee=!1,extendedZone:ve=!1,format:Oe="extended",precision:je="milliseconds"}={}){return this.isValid?(je=os(je),(ee&&bi.indexOf(je)>=3?"T":"")+Nd(this,Oe==="extended",L,O,Y,ve,je)):null}toRFC2822(){return jd(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return jd(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Bo(this,!0):null}toSQLTime({includeOffset:O=!0,includeZone:L=!1,includeOffsetSpace:Y=!0}={}){let ee="HH:mm:ss.SSS";return(L||O)&&(Y&&(ee+=" "),L?ee+="z":O&&(ee+="ZZ")),jd(this,ee,!0)}toSQL(O={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(O)}`:null}toString(){return this.isValid?this.toISO():Xo}[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(O={}){if(!this.isValid)return{};const L={...this.c};return O.includeConfig&&(L.outputCalendar=this.outputCalendar,L.numberingSystem=this.loc.numberingSystem,L.locale=this.loc.locale),L}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(O,L="milliseconds",Y={}){if(!this.isValid||!O.isValid)return Wt.invalid("created by diffing an invalid DateTime");const ee={locale:this.locale,numberingSystem:this.numberingSystem,...Y},ve=yt(L).map(Wt.normalizeUnit),Oe=O.valueOf()>this.valueOf(),je=Oe?this:O,Ue=Oe?O:this,Ot=Ba(je,Ue,ve,ee);return Oe?Ot.negate():Ot}diffNow(O="milliseconds",L={}){return this.diff(mn.now(),O,L)}until(O){return this.isValid?rn.fromDateTimes(this,O):this}hasSame(O,L,Y){if(!this.isValid)return!1;const ee=O.valueOf(),ve=this.setZone(O.zone,{keepLocalTime:!0});return ve.startOf(L,Y)<=ee&&ee<=ve.endOf(L,Y)}equals(O){return this.isValid&&O.isValid&&this.valueOf()===O.valueOf()&&this.zone.equals(O.zone)&&this.loc.equals(O.loc)}toRelative(O={}){if(!this.isValid)return null;const L=O.base||mn.fromObject({},{zone:this.zone}),Y=O.padding?this<L?-O.padding:O.padding:0;let ee=["years","months","days","hours","minutes","seconds"],ve=O.unit;return Array.isArray(O.unit)&&(ee=O.unit,ve=void 0),ca(L,this.plus(Y),{...O,numeric:"always",units:ee,unit:ve})}toRelativeCalendar(O={}){return this.isValid?ca(O.base||mn.fromObject({},{zone:this.zone}),this,{...O,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...O){if(!O.every(mn.isDateTime))throw new s("min requires all arguments be DateTimes");return Rt(O,L=>L.valueOf(),Math.min)}static max(...O){if(!O.every(mn.isDateTime))throw new s("max requires all arguments be DateTimes");return Rt(O,L=>L.valueOf(),Math.max)}static fromFormatExplain(O,L,Y={}){const{locale:ee=null,numberingSystem:ve=null}=Y,Oe=Te.fromOpts({locale:ee,numberingSystem:ve,defaultToEN:!0});return Dd(Oe,O,L)}static fromStringExplain(O,L,Y={}){return mn.fromFormatExplain(O,L,Y)}static buildFormatParser(O,L={}){const{locale:Y=null,numberingSystem:ee=null}=L,ve=Te.fromOpts({locale:Y,numberingSystem:ee,defaultToEN:!0});return new Np(ve,O)}static fromFormatParser(O,L,Y={}){if(Ke(O)||Ke(L))throw new s("fromFormatParser requires an input string and a format parser");const{locale:ee=null,numberingSystem:ve=null}=Y,Oe=Te.fromOpts({locale:ee,numberingSystem:ve,defaultToEN:!0});if(!Oe.equals(L.locale))throw new s(`fromFormatParser called with a locale of ${Oe}, but the format parser was created for ${L.locale}`);const{result:je,zone:Ue,specificOffset:Ot,invalidReason:gn}=L.explainFromTokens(O);return gn?mn.invalid(gn):_a(je,Ue,Y,`format ${L.format}`,O,Ot)}static get DATE_SHORT(){return m}static get DATE_MED(){return y}static get DATE_MED_WITH_WEEKDAY(){return b}static get DATE_FULL(){return v}static get DATE_HUGE(){return x}static get TIME_SIMPLE(){return w}static get TIME_WITH_SECONDS(){return S}static get TIME_WITH_SHORT_OFFSET(){return T}static get TIME_WITH_LONG_OFFSET(){return M}static get TIME_24_SIMPLE(){return R}static get TIME_24_WITH_SECONDS(){return $}static get TIME_24_WITH_SHORT_OFFSET(){return P}static get TIME_24_WITH_LONG_OFFSET(){return N}static get DATETIME_SHORT(){return V}static get DATETIME_SHORT_WITH_SECONDS(){return z}static get DATETIME_MED(){return W}static get DATETIME_MED_WITH_SECONDS(){return H}static get DATETIME_MED_WITH_WEEKDAY(){return k}static get DATETIME_FULL(){return I}static get DATETIME_FULL_WITH_SECONDS(){return F}static get DATETIME_HUGE(){return _}static get DATETIME_HUGE_WITH_SECONDS(){return j}}function Wa(U){if(mn.isDateTime(U))return U;if(U&&U.valueOf&&Zt(U.valueOf()))return mn.fromJSDate(U);if(U&&typeof U=="object")return mn.fromObject(U);throw new s(`Unknown datetime argument: ${U}, of type ${typeof U}`)}const Dg="3.7.2";return Ca.DateTime=mn,Ca.Duration=Wt,Ca.FixedOffsetZone=Mt,Ca.IANAZone=ae,Ca.Info=gr,Ca.Interval=rn,Ca.InvalidZone=gt,Ca.Settings=qe,Ca.SystemZone=te,Ca.VERSION=Dg,Ca.Zone=X,Ca}var iD;function Bk(){return iD||(iD=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CronDate=e.DAYS_IN_MONTH=e.DateMathOp=e.TimeUnit=void 0;const t=afe();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(s,l){const d={zone:l};if(s?s instanceof o?(this.#e=s.#e,this.#t=s.#t,this.#n=s.#n):s instanceof Date?this.#e=t.DateTime.fromJSDate(s,d):typeof s=="number"?this.#e=t.DateTime.fromMillis(s,d):(this.#e=t.DateTime.fromISO(s,d),this.#e.isValid||(this.#e=t.DateTime.fromRFC2822(s,d)),this.#e.isValid||(this.#e=t.DateTime.fromSQL(s,d)),this.#e.isValid||(this.#e=t.DateTime.fromFormat(s,"EEE, d MMM yyyy HH:mm:ss",d))):this.#e=t.DateTime.local(),!this.#e.isValid)throw new Error(`CronDate: unhandled timestamp: ${s}`);l&&l!==this.#e.zoneName&&(this.#e=this.#e.setZone(l))}static#o(s){return s%4===0&&s%100!==0||s%400===0}get dstStart(){return this.#t}set dstStart(s){this.#t=s}get dstEnd(){return this.#n}set dstEnd(s){this.#n=s}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(s){switch(s){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(s){switch(s){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(s,l){if(s===r.Add){this.addUnit(l);return}if(s===r.Subtract){this.subtractUnit(l);return}throw new Error(`Invalid verb: ${s}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){const s=this.#e.weekday;return s===7?0:s}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 s=this.#r().weekday;return s===7?0:s}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(s){this.#e=this.#e.set({day:s})}setFullYear(s){this.#e=this.#e.set({year:s})}setDay(s){this.#e=this.#e.set({weekday:s})}setMonth(s){this.#e=this.#e.set({month:s+1})}setHours(s){this.#e=this.#e.set({hour:s})}setMinutes(s){this.#e=this.#e.set({minute:s})}setSeconds(s){this.#e=this.#e.set({second:s})}setMilliseconds(s){this.#e=this.#e.set({millisecond:s})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){const{day:s,month:l}=this.#e;if(l===2){const d=o.#o(this.#e.year);return s===e.DAYS_IN_MONTH[l-1]-(d?0:1)}return s===e.DAYS_IN_MONTH[l-1]}isLastWeekdayOfMonth(){const{day:s,month:l}=this.#e;let d;return l===2?d=e.DAYS_IN_MONTH[l-1]-(o.#o(this.#e.year)?0:1):d=e.DAYS_IN_MONTH[l-1],s>d-7}applyDateOperation(s,l,d){if(l===n.Month||l===n.Day){this.invokeDateOperation(s,l);return}const f=this.getHours();this.invokeDateOperation(s,l);const c=this.getHours(),m=c-f;m===2?d!==24&&(this.dstStart=f+1):m===0&&this.getMinutes()===0&&this.getSeconds()===0&&d!==24&&(this.dstEnd=c)}#r(){return this.#e.toUTC()}}e.CronDate=o,e.default=o})(oD)),oD}var sD;function ife(){if(sD)return tm;sD=1,Object.defineProperty(tm,"__esModule",{value:!0}),tm.CronMonth=void 0;const e=Bk(),t=gd(),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(s,l){super(s,l),this.validate()}get values(){return super.values}};return tm.CronMonth=a,tm}var nm={},lD;function sfe(){if(lD)return nm;lD=1,Object.defineProperty(nm,"__esModule",{value:!0}),nm.CronSecond=void 0;const e=gd(),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,s){super(a,s),this.validate()}get values(){return super.values}};return nm.CronSecond=o,nm}var cD;function Uk(){return cD||(cD=1,(function(e){var t=Cf&&Cf.__createBinding||(Object.create?(function(r,o,a,s){s===void 0&&(s=a);var l=Object.getOwnPropertyDescriptor(o,a);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(r,s,l)}):(function(r,o,a,s){s===void 0&&(s=a),r[s]=o[a]})),n=Cf&&Cf.__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(efe(),e),n(tfe(),e),n(nfe(),e),n(gd(),e),n(rfe(),e),n(ofe(),e),n(ife(),e),n(sfe(),e)})(Cf)),Cf}var uD;function IL(){if(uD)return Gh;uD=1,Object.defineProperty(Gh,"__esModule",{value:!0}),Gh.CronFieldCollection=void 0;const e=Uk();let t=class mm{#e;#t;#n;#o;#r;#a;static from(r,o){return new mm({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:s,month:l,dayOfWeek:d}){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(!s)throw new Error("Validation error, Field dayOfMonth is missing");if(!l)throw new Error("Validation error, Field month is missing");if(!d)throw new Error("Validation error, Field dayOfWeek is missing");if(l.values.length===1&&!s.hasLastChar&&d.isWildcard&&!(parseInt(s.values[0],10)<=e.CronMonth.daysInMonth[l.values[0]-1]))throw new Error("Invalid explicit day of month definition");this.#e=r,this.#t=o,this.#n=a,this.#r=l,this.#a=d,this.#o=s}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((s,l,d)=>{if(a===void 0){a={start:s,count:1};return}const f=d[l-1]||a.start,c=d[l+1];if(s==="L"||s==="W"){o.push(a),o.push({start:s,count:1}),a=void 0;return}if(a.step===void 0&&c!==void 0){const m=s-f,y=c-s;if(m<=y){a={...a,count:2,end:s,step:m};return}a.step=1}s-(a.end??0)===a.step?(a.count++,a.end=s):(a.count===1?o.push({start:a.start,count:1}):a.count===2?(o.push({start:a.start,count:1}),o.push({start:a.end??f,count:1})):o.push(a),a={start:s,count:1})}),a&&o.push(a),o}static#s(r,o,a){const s=o.step;return s?s===1&&o.start===r.min&&o.end&&o.end>=a?r.hasQuestionMarkChar?"?":"*":s!==1&&o.start===r.min&&o.end&&o.end>=a-s+1?`*/${s}`:null:null}static#i(r,o){const a=r.step;if(a===1)return`${r.start}-${r.end}`;const s=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*s>r.end){const l=(f,c)=>{if(typeof r.start!="number")throw new Error("Unexpected range start");return c%a===0?r.start+c:null};if(typeof r.start!="number")throw new Error("Unexpected range start");const d={length:r.end-r.start+1};return Array.from(d,l).filter(f=>f!==null).join(",")}return r.end===o-a+1?`${r.start}/${a}`:`${r.start}-${r.end}/${a}`}stringifyField(r){let o=r.max,a=r.values;if(r instanceof e.CronDayOfWeek){o=6;const l=this.#a.values;a=l[l.length-1]===7?l.slice(0,-1):l}r instanceof e.CronDayOfMonth&&(o=this.#r.values.length===1?e.CronMonth.daysInMonth[this.#r.values[0]-1]:r.max);const s=mm.compactField(a);if(s.length===1){const l=mm.#s(r,s[0],o);if(l)return l}return s.map(l=>{const d=l.count===1?l.start.toString():mm.#i(l,o);return r instanceof e.CronDayOfWeek&&r.nthDay>0?`${d}#${r.nthDay}`:d}).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 Gh.CronFieldCollection=t,Gh}var dD={},fD;function LL(){return fD||(fD=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=Bk();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,s){this.#e=s,this.#t=s.tz,this.#o=s.startDate?new t.CronDate(s.startDate,this.#t):null,this.#r=s.endDate?new t.CronDate(s.endDate,this.#t):null;let l=s.currentDate??s.startDate;if(l){const d=new t.CronDate(l,this.#t);this.#o&&d.getTime()<this.#o.getTime()?l=this.#o:this.#r&&d.getTime()>this.#r.getTime()&&(l=this.#r)}this.#n=new t.CronDate(l,this.#t),this.#a=a}get fields(){return this.#a}static fieldsToExpression(a,s){return new r(a,s||{})}static#c(a,s){return s.some(l=>l===a)}#l(a,s){return a[s?a.length-1:0]}#d(a){const s=`${a.getFullYear()}-${a.getMonth()+1}-${a.getDate()}`;if(this.#s===s)return this.#i;const l=new t.CronDate(a);l.setStartOfDay();const d=new t.CronDate(a);return d.setEndOfDay(),this.#s=s,this.#i=l.getUTCOffset()!==d.getUTCOffset(),this.#i}#u(a,s,l){const d=this.#a.second.values,f=a.getSeconds(),c=this.#a.second.findNearestValue(f,l);if(c!==null){a.setSeconds(c);return}a.applyDateOperation(s,t.TimeUnit.Minute,this.#a.hour.values.length),a.setSeconds(this.#l(d,l))}#p(a,s,l){const d=this.#a.minute.values,f=this.#a.second.values,c=a.getMinutes(),m=this.#a.minute.findNearestValue(c,l);if(m!==null){a.setMinutes(m),a.setSeconds(this.#l(f,l));return}a.applyDateOperation(s,t.TimeUnit.Hour,this.#a.hour.values.length),a.setMinutes(this.#l(d,l)),a.setSeconds(this.#l(f,l))}static#f(a,s){const l=s.isLastWeekdayOfMonth();return a.some(d=>{const f=parseInt(d.toString().charAt(0),10)%7;if(Number.isNaN(f))throw new Error(`Invalid last weekday of the month expression: ${d}`);return s.getDay()===f&&l})}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 s=[];if(a>=0)for(let l=0;l<a;l++)try{s.push(this.next())}catch{return s}else for(let l=0;l>a;l--)try{s.push(this.prev())}catch{return s}return s}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:s,minute:l,hour:d,month:f}=this.#a,c=new t.CronDate(a,this.#t);return!(!s.values.includes(c.getSeconds())||!l.values.includes(c.getMinutes())||!d.values.includes(c.getHours())||!f.values.includes(c.getMonth()+1)||!this.#m(c)||this.#a.dayOfWeek.nthDay>0&&Math.ceil(c.getDate()/7)!==this.#a.dayOfWeek.nthDay)}toString(){return this.#e.expression||this.stringify(!0)}#m(a){const s=this.#a.dayOfMonth.isWildcard,l=!s,d=this.#a.dayOfWeek.isWildcard,f=!d,c=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!!(l&&f&&(c||m)||c&&!f||s&&!d&&m)}#g(a,s,l){const d=this.#a.hour.values,f=d,c=a.getHours(),m=r.#c(c,d),y=a.dstEnd===c;if(a.dstStart!==null&&a.dstStart===c-1&&r.#c(a.dstStart,d))return!0;if(y&&!l)return a.dstEnd=null,a.applyDateOperation(t.DateMathOp.Add,t.TimeUnit.Hour,f.length),!1;if(m)return!0;a.dstStart=null;const b=this.#a.hour.findNearestValue(c,l);if(b===null)return a.applyDateOperation(s,t.TimeUnit.Day,f.length),!1;if(this.#d(a)){const v=l?c-b:b-c;for(let x=0;x<v&&(a.applyDateOperation(s,t.TimeUnit.Hour,f.length),!(!l&&a.getHours()>=b||l&&a.getHours()<=b));x++);}else a.setHours(b);return a.setMinutes(this.#l(this.#a.minute.values,l)),a.setSeconds(this.#l(this.#a.second.values,l)),!1}#y(a){if(!this.#o&&!this.#r)return;const s=a.getTime();if(this.#o&&s<this.#o.getTime())throw new Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE);if(this.#r&&s>this.#r.getTime())throw new Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#h(a=!1){const s=a?t.DateMathOp.Subtract:t.DateMathOp.Add,l=new t.CronDate(this.#n),d=l.getTime();let f=0;for(;++f<n;){if(this.#y(l),!this.#m(l)){l.applyDateOperation(s,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!(this.#a.dayOfWeek.nthDay<=0||Math.ceil(l.getDate()/7)===this.#a.dayOfWeek.nthDay)){l.applyDateOperation(s,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!r.#c(l.getMonth()+1,this.#a.month.values)){l.applyDateOperation(s,t.TimeUnit.Month,this.#a.hour.values.length);continue}if(this.#g(l,s,a)){if(!r.#c(l.getMinutes(),this.#a.minute.values)){this.#p(l,s,a);continue}if(!r.#c(l.getSeconds(),this.#a.second.values)){this.#u(l,s,a);continue}if(d===l.getTime()){(s==="Add"||l.getMilliseconds()===0)&&l.applyDateOperation(s,t.TimeUnit.Second,this.#a.hour.values.length);continue}break}}if(f>n)throw new Error(e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return l.getMilliseconds()!==0&&l.setMilliseconds(0),this.#n=l,l}[Symbol.iterator](){return{next:()=>{try{return{value:this.#h(),done:!1}}catch{return{value:void 0,done:!0}}}}}}e.CronExpression=r,e.default=r})(dD)),dD}var rv={},pD;function lfe(){if(pD)return rv;pD=1,Object.defineProperty(rv,"__esModule",{value:!0}),rv.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 rv}var hD;function Ew(){if(hD)return Xa;hD=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.CronExpressionParser=Xa.DayOfWeek=Xa.Months=Xa.CronUnit=Xa.PredefinedExpressions=void 0;const e=IL(),t=LL(),n=lfe(),r=Uk();var o;(function(f){f["@yearly"]="0 0 0 1 1 *",f["@annually"]="0 0 0 1 1 *",f["@monthly"]="0 0 0 1 * *",f["@weekly"]="0 0 0 * * 0",f["@daily"]="0 0 0 * * *",f["@hourly"]="0 0 * * * *",f["@minutely"]="0 * * * * *",f["@secondly"]="* * * * * *",f["@weekdays"]="0 0 0 * * 1-5",f["@weekends"]="0 0 0 * * 0,6"})(o||(Xa.PredefinedExpressions=o={}));var a;(function(f){f.Second="Second",f.Minute="Minute",f.Hour="Hour",f.DayOfMonth="DayOfMonth",f.Month="Month",f.DayOfWeek="DayOfWeek"})(a||(Xa.CronUnit=a={}));var s;(function(f){f[f.jan=1]="jan",f[f.feb=2]="feb",f[f.mar=3]="mar",f[f.apr=4]="apr",f[f.may=5]="may",f[f.jun=6]="jun",f[f.jul=7]="jul",f[f.aug=8]="aug",f[f.sep=9]="sep",f[f.oct=10]="oct",f[f.nov=11]="nov",f[f.dec=12]="dec"})(s||(Xa.Months=s={}));var l;(function(f){f[f.sun=0]="sun",f[f.mon=1]="mon",f[f.tue=2]="tue",f[f.wed=3]="wed",f[f.thu=4]="thu",f[f.fri=5]="fri",f[f.sat=6]="sat"})(l||(Xa.DayOfWeek=l={}));let d=class Za{static parse(c,m={}){const{strict:y=!1,hashSeed:b}=m,v=(0,n.seededRandom)(b);c=o[c]||c;const x=Za.#e(c,y);if(!(x.dayOfMonth==="*"||x.dayOfWeek==="*"||!y))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");const w=Za.#t(a.Second,x.second,r.CronSecond.constraints,v),S=Za.#t(a.Minute,x.minute,r.CronMinute.constraints,v),T=Za.#t(a.Hour,x.hour,r.CronHour.constraints,v),M=Za.#t(a.Month,x.month,r.CronMonth.constraints,v),R=Za.#t(a.DayOfMonth,x.dayOfMonth,r.CronDayOfMonth.constraints,v),{dayOfWeek:$,nthDayOfWeek:P}=Za.#d(x.dayOfWeek),N=Za.#t(a.DayOfWeek,$,r.CronDayOfWeek.constraints,v),V=new e.CronFieldCollection({second:new r.CronSecond(w,{rawValue:x.second}),minute:new r.CronMinute(S,{rawValue:x.minute}),hour:new r.CronHour(T,{rawValue:x.hour}),dayOfMonth:new r.CronDayOfMonth(R,{rawValue:x.dayOfMonth}),month:new r.CronMonth(M,{rawValue:x.month}),dayOfWeek:new r.CronDayOfWeek(N,{rawValue:x.dayOfWeek,nthDayOfWeek:P})});return new t.CronExpression(V,{...m,expression:c})}static#e(c,m){if(m&&!c.length)throw new Error("Invalid cron expression");c=c||"0 * * * * *";const y=c.trim().split(/\s+/);if(m&&y.length<6)throw new Error("Invalid cron expression, expected 6 fields");if(y.length>6)throw new Error("Invalid cron expression, too many fields");const b=["*","*","*","*","*","0"];y.length<b.length&&y.unshift(...b.slice(y.length));const[v,x,w,S,T,M]=y;return{second:v,minute:x,hour:w,dayOfMonth:S,month:T,dayOfWeek:M}}static#t(c,m,y,b){if((c===a.Month||c===a.DayOfWeek)&&(m=m.replace(/[a-z]{3}/gi,v=>{v=v.toLowerCase();const x=s[v]||l[v];if(x===void 0)throw new Error(`Validation error, cannot resolve alias "${v}"`);return x.toString()})),!y.validChars.test(m))throw new Error(`Invalid characters, got value: ${m}`);return m=this.#n(m,y),m=this.#o(m,y,b),this.#r(c,m,y)}static#n(c,m){return c.replace(/[*?]/g,m.min+"-"+m.max)}static#o(c,m,y){const b=y();return c.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(v,x,w,S)=>{if(x&&w&&S){const T=parseInt(x,10),M=parseInt(w,10),R=parseInt(S,10);if(T>M)throw new Error(`Invalid range: ${T}-${M}, min > max`);if(R<=0)throw new Error(`Invalid step: ${R}, must be positive`);const $=Math.max(T,m.min),P=Math.floor(b*R),N=[];for(let V=Math.floor($/R)*R+P;V<=M;V+=R)V>=$&&N.push(V);return N.join(",")}else if(x&&w){const T=parseInt(x,10),M=parseInt(w,10);if(T>M)throw new Error(`Invalid range: ${T}-${M}, min > max`);return String(Math.floor(b*(M-T+1))+T)}else if(S){const T=parseInt(S,10);if(T<=0)throw new Error(`Invalid step: ${T}, must be positive`);const M=Math.floor(b*T),R=[];for(let $=Math.floor(m.min/T)*T+M;$<=m.max;$+=T)$>=m.min&&R.push($);return R.join(",")}else return String(Math.floor(b*(m.max-m.min+1)+m.min))})}static#r(c,m,y){const b=[];function v(x,w){if(Array.isArray(x))b.push(...x);else if(Za.#u(w,x))b.push(x);else{const S=parseInt(x.toString(),10);if(!(S>=w.min&&S<=w.max))throw new Error(`Constraint error, got value ${x} expected range ${w.min}-${w.max}`);b.push(c===a.DayOfWeek?S%7:x)}}return m.split(",").forEach(x=>{if(!(x.length>0))throw new Error("Invalid list value format");v(Za.#a(c,x,y),y)}),b}static#a(c,m,y){const b=m.split("/");if(b.length>2)throw new Error(`Invalid repeat: ${m}`);return b.length===2?(b[0].includes("-")||(b[0]=`${b[0]}-${y.max}`),Za.#l(c,b[0],parseInt(b[1],10),y)):Za.#l(c,m,1,y)}static#s(c,m,y){if(!(!isNaN(c)&&!isNaN(m)&&c>=y.min&&m<=y.max))throw new Error(`Constraint error, got range ${c}-${m} expected range ${y.min}-${y.max}`);if(c>m)throw new Error(`Invalid range: ${c}-${m}, min(${c}) > max(${m})`)}static#i(c){if(!(!isNaN(c)&&c>0))throw new Error(`Constraint error, cannot repeat at every ${c} time.`)}static#c(c,m,y,b){const v=[];c===a.DayOfWeek&&y%7===0&&v.push(0);for(let x=m;x<=y;x+=b)v.indexOf(x)===-1&&v.push(x);return v}static#l(c,m,y,b){const v=m.split("-");if(v.length<=1)return isNaN(+m)?m:+m;const[x,w]=v.map(S=>parseInt(S,10));return this.#s(x,w,b),this.#i(y),this.#c(c,x,w,y)}static#d(c){const m=c.split("#");if(m.length<=1)return{dayOfWeek:m[0]};const y=+m[m.length-1],b=c.match(/([,-/])/);if(b!==null)throw new Error(`Constraint error, invalid dayOfWeek \`#\` and \`${b?.[0]}\` special characters are incompatible`);if(!(m.length<=2&&!isNaN(y)&&y>=1&&y<=5))throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return{dayOfWeek:m[0],nthDayOfWeek:y}}static#u(c,m){return c.chars.some(y=>m.toString().includes(y))}};return Xa.CronExpressionParser=d,Xa}var cs={};const cfe={},ufe=Object.freeze(Object.defineProperty({__proto__:null,default:cfe},Symbol.toStringTag,{value:"Module"})),mD=DQ(ufe);var gD;function dfe(){if(gD)return cs;gD=1;var e=cs&&cs.__createBinding||(Object.create?(function(a,s,l,d){d===void 0&&(d=l);var f=Object.getOwnPropertyDescriptor(s,l);(!f||("get"in f?!s.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return s[l]}}),Object.defineProperty(a,d,f)}):(function(a,s,l,d){d===void 0&&(d=l),a[d]=s[l]})),t=cs&&cs.__setModuleDefault||(Object.create?(function(a,s){Object.defineProperty(a,"default",{enumerable:!0,value:s})}):function(a,s){a.default=s}),n=cs&&cs.__importStar||(function(){var a=function(s){return a=Object.getOwnPropertyNames||function(l){var d=[];for(var f in l)Object.prototype.hasOwnProperty.call(l,f)&&(d[d.length]=f);return d},a(s)};return function(s){if(s&&s.__esModule)return s;var l={};if(s!=null)for(var d=a(s),f=0;f<d.length;f++)d[f]!=="default"&&e(l,s,d[f]);return t(l,s),l}})();Object.defineProperty(cs,"__esModule",{value:!0}),cs.CronFileParser=void 0;const r=Ew();let o=class Tv{static async parseFile(s){const{readFile:l}=await Promise.resolve().then(()=>n(mD)),d=await l(s,"utf8");return Tv.#e(d)}static parseFileSync(s){const{readFileSync:l}=mD,d=l(s,"utf8");return Tv.#e(d)}static#e(s){const l=s.split(`
|
|
438
438
|
`),d={variables:{},expressions:[],errors:{}};for(const f of l){const c=f.trim();if(c.length===0||c.startsWith("#"))continue;const m=c.match(/^(.*)=(.*)$/);if(m){const[,y,b]=m;d.variables[y]=b.replace(/["']/g,"");continue}try{const y=Tv.#t(c);d.expressions.push(y.interval)}catch(y){d.errors[c]=y}}return d}static#t(s){const l=s.split(" ");return{interval:r.CronExpressionParser.parse(l.slice(0,5).join(" ")),command:l.slice(5,l.length)}}};return cs.CronFileParser=o,cs}var yD;function ffe(){return yD||(yD=1,(function(e){var t=wf&&wf.__createBinding||(Object.create?(function(f,c,m,y){y===void 0&&(y=m);var b=Object.getOwnPropertyDescriptor(c,m);(!b||("get"in b?!c.__esModule:b.writable||b.configurable))&&(b={enumerable:!0,get:function(){return c[m]}}),Object.defineProperty(f,y,b)}):(function(f,c,m,y){y===void 0&&(y=m),f[y]=c[m]})),n=wf&&wf.__exportStar||function(f,c){for(var m in f)m!=="default"&&!Object.prototype.hasOwnProperty.call(c,m)&&t(c,f,m)};Object.defineProperty(e,"__esModule",{value:!0}),e.CronFileParser=e.CronExpressionParser=e.CronExpression=e.CronFieldCollection=e.CronDate=void 0;const r=Ew();var o=Bk();Object.defineProperty(e,"CronDate",{enumerable:!0,get:function(){return o.CronDate}});var a=IL();Object.defineProperty(e,"CronFieldCollection",{enumerable:!0,get:function(){return a.CronFieldCollection}});var s=LL();Object.defineProperty(e,"CronExpression",{enumerable:!0,get:function(){return s.CronExpression}});var l=Ew();Object.defineProperty(e,"CronExpressionParser",{enumerable:!0,get:function(){return l.CronExpressionParser}});var d=dfe();Object.defineProperty(e,"CronFileParser",{enumerable:!0,get:function(){return d.CronFileParser}}),n(Uk(),e),e.default=r.CronExpressionParser})(wf)),wf}var pfe=ffe(),vD={exports:{}},bD;function hfe(){return bD||(bD=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,()=>(()=>{var n={949:((s,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CronParser=void 0;var f=d(515),c=(function(){function m(y,b,v){b===void 0&&(b=!0),v===void 0&&(v=!1),this.expression=y,this.dayOfWeekStartIndexZero=b,this.monthStartIndexZero=v}return m.prototype.parse=function(){var y,b,v=(y=this.expression)!==null&&y!==void 0?y:"";if(v==="@reboot")return b=["@reboot","","","","","",""],b;if(v.startsWith("@")){var x=this.parseSpecial(this.expression);b=this.extractParts(x)}else b=this.extractParts(this.expression);return this.normalize(b),this.validate(b),b},m.prototype.parseSpecial=function(y){var b={"@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"},v=b[y];if(!v)throw new Error("Unknown special expression.");return v},m.prototype.extractParts=function(y){if(!this.expression)throw new Error("cron expression is empty");for(var b=y.trim().split(/[ ]+/),v=0;v<b.length;v++)if(b[v].includes(",")){var x=b[v].split(",").map(function(S){return S.trim()}).filter(function(S){return S!==""}).map(function(S){return isNaN(Number(S))?S:Number(S)}).filter(function(S){return S!==null&&S!==""});x.length===0&&x.push("*"),x.sort(function(S,T){return S!==null&&T!==null?S-T:0}),b[v]=x.map(function(S){return S!==null?S.toString():""}).join(",")}if(b.length<5)throw new Error("Expression has only ".concat(b.length," part").concat(b.length==1?"":"s",". At least 5 parts are required."));if(b.length==5)b.unshift(""),b.push("");else if(b.length==6){var w=/\d{4}$/.test(b[5])||b[4]=="?"||b[2]=="?";w?b.unshift(""):b.push("")}else if(b.length>7)throw new Error("Expression has ".concat(b.length," parts; too many!"));return b},m.prototype.normalize=function(y){var b=this;if(y[3]=y[3].replace("?","*"),y[5]=y[5].replace("?","*"),y[2]=y[2].replace("?","*"),y[0].indexOf("0/")==0&&(y[0]=y[0].replace("0/","*/")),y[1].indexOf("0/")==0&&(y[1]=y[1].replace("0/","*/")),y[2].indexOf("0/")==0&&(y[2]=y[2].replace("0/","*/")),y[3].indexOf("1/")==0&&(y[3]=y[3].replace("1/","*/")),y[4].indexOf("1/")==0&&(y[4]=y[4].replace("1/","*/")),y[6].indexOf("1/")==0&&(y[6]=y[6].replace("1/","*/")),y[5]=y[5].replace(/(^\d)|([^#/\s]\d)/g,function($){var P=$.replace(/\D/,""),N=P;return b.dayOfWeekStartIndexZero?P=="7"&&(N="0"):N=(parseInt(P)-1).toString(),$.replace(P,N)}),y[5]=="L"&&(y[5]="6"),y[3]=="?"&&(y[3]="*"),y[3].indexOf("W")>-1&&(y[3].indexOf(",")>-1||y[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 v={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var x in v)y[5]=y[5].replace(new RegExp(x,"gi"),v[x].toString());y[4]=y[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function($){var P=$.replace(/\D/,""),N=P;return b.monthStartIndexZero&&(N=(parseInt(P)+1).toString()),$.replace(P,N)});var w={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var S in w)y[4]=y[4].replace(new RegExp(S,"gi"),w[S].toString());y[0]=="0"&&(y[0]=""),!/\*|\-|\,|\//.test(y[2])&&(/\*|\//.test(y[1])||/\*|\//.test(y[0]))&&(y[2]+="-".concat(y[2]));for(var T=0;T<y.length;T++)if(y[T].indexOf(",")!=-1&&(y[T]=y[T].split(",").filter(function($){return $!==""}).join(",")||"*"),y[T]=="*/1"&&(y[T]="*"),y[T].indexOf("/")>-1&&!/^\*|\-|\,/.test(y[T])){var M=null;switch(T){case 4:M="12";break;case 5:M="6";break;case 6:M="9999";break;default:M=null;break}if(M!==null){var R=y[T].split("/");y[T]="".concat(R[0],"-").concat(M,"/").concat(R[1])}}},m.prototype.validate=function(y){var b="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(y[0],b),this.validateOnlyExpectedCharactersFound(y[1],b),this.validateOnlyExpectedCharactersFound(y[2],b),this.validateOnlyExpectedCharactersFound(y[3],"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(y[4],b),this.validateOnlyExpectedCharactersFound(y[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(y[6],b),this.validateAnyRanges(y)},m.prototype.validateAnyRanges=function(y){f.default.secondRange(y[0]),f.default.minuteRange(y[1]),f.default.hourRange(y[2]),f.default.dayOfMonthRange(y[3]),f.default.monthRange(y[4],this.monthStartIndexZero),f.default.dayOfWeekRange(y[5],this.dayOfWeekStartIndexZero)},m.prototype.validateOnlyExpectedCharactersFound=function(y,b){var v=y.match(new RegExp("[^".concat(b,"]+"),"gi"));if(v&&v.length)throw new Error("Expression contains invalid values: '".concat(v.toString(),"'"))},m})();l.CronParser=c}),333:((s,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExpressionDescriptor=void 0;var f=d(823),c=d(949),m=(function(){function y(b,v){if(this.expression=b,this.options=v,this.expressionParts=new Array(5),!this.options.locale&&y.defaultLocale&&(this.options.locale=y.defaultLocale),!y.locales[this.options.locale]){var x=Object.keys(y.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(x,"'.")),this.options.locale=x}this.i18n=y.locales[this.options.locale],v.use24HourTimeFormat===void 0&&(v.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return y.toString=function(b,v){var x=v===void 0?{}:v,w=x.throwExceptionOnParseError,S=w===void 0?!0:w,T=x.verbose,M=T===void 0?!1:T,R=x.dayOfWeekStartIndexZero,$=R===void 0?!0:R,P=x.monthStartIndexZero,N=P===void 0?!1:P,V=x.use24HourTimeFormat,z=x.locale,W=z===void 0?null:z,H={throwExceptionOnParseError:S,verbose:M,dayOfWeekStartIndexZero:$,monthStartIndexZero:N,use24HourTimeFormat:V,locale:W};H.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var k=new y(b,H);return k.getFullDescription()},y.initialize=function(b,v){v===void 0&&(v="en"),y.specialCharacters=["/","-",",","*"],y.defaultLocale=v,b.load(y.locales)},y.prototype.getFullDescription=function(){var b,v,x="";try{var w=new c.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=w.parse(),this.expressionParts[0]==="@reboot")return((v=(b=this.i18n).atReboot)===null||v===void 0?void 0:v.call(b))||"Run once, at startup";var S=this.getTimeOfDayDescription(),T=this.getDayOfMonthDescription(),M=this.getMonthDescription(),R=this.getDayOfWeekDescription(),$=this.getYearDescription();x+=S+T+R+M+$,x=this.transformVerbosity(x,!!this.options.verbose),x=x.charAt(0).toLocaleUpperCase()+x.substr(1)}catch(P){if(!this.options.throwExceptionOnParseError)x=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(P)}return x},y.prototype.getTimeOfDayDescription=function(){var b=this.expressionParts[0],v=this.expressionParts[1],x=this.expressionParts[2],w="";if(!f.StringUtilities.containsAny(v,y.specialCharacters)&&!f.StringUtilities.containsAny(x,y.specialCharacters)&&!f.StringUtilities.containsAny(b,y.specialCharacters))w+=this.i18n.atSpace()+this.formatTime(x,v,b);else if(!b&&v.indexOf("-")>-1&&!(v.indexOf(",")>-1)&&!(v.indexOf("/")>-1)&&!f.StringUtilities.containsAny(x,y.specialCharacters)){var S=v.split("-");w+=f.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(x,S[0],""),this.formatTime(x,S[1],""))}else if(!b&&x.indexOf(",")>-1&&x.indexOf("-")==-1&&x.indexOf("/")==-1&&!f.StringUtilities.containsAny(v,y.specialCharacters)){var T=x.split(",");w+=this.i18n.at();for(var M=0;M<T.length;M++)w+=" ",w+=this.formatTime(T[M],v,""),M<T.length-2&&(w+=","),M==T.length-2&&(w+=this.i18n.spaceAnd())}else{var R=this.getSecondsDescription(),$=this.getMinutesDescription(),P=this.getHoursDescription();if(w+=R,w&&$&&(w+=", "),w+=$,$===P)return w;w&&P&&(w+=", "),w+=P}return w},y.prototype.getSecondsDescription=function(){var b=this,v=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(x){return x},function(x){return f.StringUtilities.format(b.i18n.everyX0Seconds(x),x)},function(x){return b.i18n.secondsX0ThroughX1PastTheMinute()},function(x){return x=="0"?"":parseInt(x)<20?b.i18n.atX0SecondsPastTheMinute(x):b.i18n.atX0SecondsPastTheMinuteGt20()||b.i18n.atX0SecondsPastTheMinute(x)});return v},y.prototype.getMinutesDescription=function(){var b=this,v=this.expressionParts[0],x=this.expressionParts[2],w=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(S){return S},function(S){return f.StringUtilities.format(b.i18n.everyX0Minutes(S),S)},function(S){return b.i18n.minutesX0ThroughX1PastTheHour()},function(S){try{return S=="0"&&x.indexOf("/")==-1&&v==""?b.i18n.everyHour():parseInt(S)<20?b.i18n.atX0MinutesPastTheHour(S):b.i18n.atX0MinutesPastTheHourGt20()||b.i18n.atX0MinutesPastTheHour(S)}catch{return b.i18n.atX0MinutesPastTheHour(S)}});return w},y.prototype.getHoursDescription=function(){var b=this,v=this.expressionParts[2],x=0,w=[];v.split("/")[0].split(",").forEach(function(M){var R=M.split("-");R.length===2&&w.push({value:R[1],index:x+1}),x+=R.length});var S=0,T=this.getSegmentDescription(v,this.i18n.everyHour(),function(M){var R=w.find(function(P){return P.value===M&&P.index===S}),$=R&&b.expressionParts[1]!=="0";return S++,$?b.formatTime(M,"59",""):b.formatTime(M,"0","")},function(M){return f.StringUtilities.format(b.i18n.everyX0Hours(M),M)},function(M){return b.i18n.betweenX0AndX1()},function(M){return b.i18n.atX0()});return T},y.prototype.getDayOfWeekDescription=function(){var b=this,v=this.i18n.daysOfTheWeek(),x=null;return this.expressionParts[5]=="*"?x="":x=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(w,S){var T=w;w.indexOf("#")>-1?T=w.substring(0,w.indexOf("#")):w.indexOf("L")>-1&&(T=T.replace("L",""));var M=parseInt(T),R=b.i18n.daysOfTheWeekInCase?b.i18n.daysOfTheWeekInCase(S)[M]:v[M];if(w.indexOf("#")>-1){var $=null,P=w.substring(w.indexOf("#")+1),N=w.substring(0,w.indexOf("#"));switch(P){case"1":$=b.i18n.first(N);break;case"2":$=b.i18n.second(N);break;case"3":$=b.i18n.third(N);break;case"4":$=b.i18n.fourth(N);break;case"5":$=b.i18n.fifth(N);break}R=$+" "+R}return R},function(w){return parseInt(w)==1?"":f.StringUtilities.format(b.i18n.commaEveryX0DaysOfTheWeek(w),w)},function(w){var S=w.substring(0,w.indexOf("-")),T=b.expressionParts[3]!="*";return T?b.i18n.commaAndX0ThroughX1(S):b.i18n.commaX0ThroughX1(S)},function(w){var S=null;if(w.indexOf("#")>-1){var T=w.substring(w.indexOf("#")+1),M=w.substring(0,w.indexOf("#"));S=b.i18n.commaOnThe(T,M).trim()+b.i18n.spaceX0OfTheMonth()}else if(w.indexOf("L")>-1)S=b.i18n.commaOnTheLastX0OfTheMonth(w.replace("L",""));else{var R=b.expressionParts[3]!="*";S=R?b.i18n.commaAndOnX0():b.i18n.commaOnlyOnX0(w)}return S}),x},y.prototype.getMonthDescription=function(){var b=this,v=this.i18n.monthsOfTheYear(),x=this.getSegmentDescription(this.expressionParts[4],"",function(w,S){return S&&b.i18n.monthsOfTheYearInCase?b.i18n.monthsOfTheYearInCase(S)[parseInt(w)-1]:v[parseInt(w)-1]},function(w){return parseInt(w)==1?"":f.StringUtilities.format(b.i18n.commaEveryX0Months(w),w)},function(w){return b.i18n.commaMonthX0ThroughMonthX1()||b.i18n.commaX0ThroughX1()},function(w){return b.i18n.commaOnlyInMonthX0?b.i18n.commaOnlyInMonthX0():b.i18n.commaOnlyInX0()});return x},y.prototype.getDayOfMonthDescription=function(){var b=this,v=null,x=this.expressionParts[3];switch(x){case"L":v=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":v=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var w=x.match(/(\d{1,2}W)|(W\d{1,2})/);if(w){var S=parseInt(w[0].replace("W","")),T=S==1?this.i18n.firstWeekday():f.StringUtilities.format(this.i18n.weekdayNearestDayX0(),S.toString());v=f.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),T);break}else{var M=x.match(/L-(\d{1,2})/);if(M){var R=M[1];v=f.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(R),R);break}else{if(x=="*"&&this.expressionParts[5]!="*")return"";v=this.getSegmentDescription(x,this.i18n.commaEveryDay(),function($){return $=="L"?b.i18n.lastDay():b.i18n.dayX0?f.StringUtilities.format(b.i18n.dayX0(),$):$},function($){return $=="1"?b.i18n.commaEveryDay():b.i18n.commaEveryX0Days($)},function($){return b.i18n.commaBetweenDayX0AndX1OfTheMonth($)},function($){return b.i18n.commaOnDayX0OfTheMonth($)})}break}}return v},y.prototype.getYearDescription=function(){var b=this,v=this.getSegmentDescription(this.expressionParts[6],"",function(x){return/^\d+$/.test(x)?new Date(parseInt(x),1).getFullYear().toString():x},function(x){return f.StringUtilities.format(b.i18n.commaEveryX0Years(x),x)},function(x){return b.i18n.commaYearX0ThroughYearX1()||b.i18n.commaX0ThroughX1()},function(x){return b.i18n.commaOnlyInYearX0?b.i18n.commaOnlyInYearX0():b.i18n.commaOnlyInX0()});return v},y.prototype.getSegmentDescription=function(b,v,x,w,S,T){var M=null,R=b.indexOf("/")>-1,$=b.indexOf("-")>-1,P=b.indexOf(",")>-1;if(!b)M="";else if(b==="*")M=v;else if(!R&&!$&&!P)M=f.StringUtilities.format(T(b),x(b));else if(P){for(var N=b.split(","),V="",z=0;z<N.length;z++)if(z>0&&N.length>2&&(V+=",",z<N.length-1&&(V+=" ")),z>0&&N.length>1&&(z==N.length-1||N.length==2)&&(V+="".concat(this.i18n.spaceAnd()," ")),N[z].indexOf("/")>-1||N[z].indexOf("-")>-1){var W=N[z].indexOf("-")>-1&&N[z].indexOf("/")==-1,H=this.getSegmentDescription(N[z],v,x,w,W?this.i18n.commaX0ThroughX1:S,T);W&&(H=H.replace(", ","")),V+=H}else R?V+=this.getSegmentDescription(N[z],v,x,w,S,T):V+=x(N[z]);R?M=V:M=f.StringUtilities.format(T(b),V)}else if(R){var N=b.split("/");if(M=f.StringUtilities.format(w(N[1]),N[1]),N[0].indexOf("-")>-1){var k=this.generateRangeSegmentDescription(N[0],S,x);k.indexOf(", ")!=0&&(M+=", "),M+=k}else if(N[0].indexOf("*")==-1){var I=f.StringUtilities.format(T(N[0]),x(N[0]));I=I.replace(", ",""),M+=f.StringUtilities.format(this.i18n.commaStartingX0(),I)}}else $&&(M=this.generateRangeSegmentDescription(b,S,x));return M},y.prototype.generateRangeSegmentDescription=function(b,v,x){var w="",S=b.split("-"),T=x(S[0],1),M=x(S[1],2),R=v(b);return w+=f.StringUtilities.format(R,T,M),w},y.prototype.formatTime=function(b,v,x){var w=0,S=0,T=parseInt(b)+w,M=parseInt(v)+S;M>=60?(M-=60,T+=1):M<0&&(M+=60,T-=1),T>=24?T=T-24:T<0&&(T=24+T);var R="",$=!1;this.options.use24HourTimeFormat||($=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),R=$?"".concat(this.getPeriod(T)," "):" ".concat(this.getPeriod(T)),T>12&&(T-=12),T===0&&(T=12));var P="";return x&&(P=":".concat(("00"+x).substring(x.length))),"".concat($?R:"").concat(("00"+T.toString()).substring(T.toString().length),":").concat(("00"+M.toString()).substring(M.toString().length)).concat(P).concat($?"":R)},y.prototype.transformVerbosity=function(b,v){if(!v&&(b=b.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),b=b.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),b=b.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),b=b.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var x=0,w=Object.entries(this.i18n.conciseVerbosityReplacements());x<w.length;x++){var S=w[x],T=S[0],M=S[1];b=b.replace(new RegExp(T,"g"),M)}return b},y.prototype.getPeriod=function(b){return b>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},y.locales={},y})();l.ExpressionDescriptor=m}),747:((s,l,d)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.enLocaleLoader=void 0;var f=d(486),c=(function(){function m(){}return m.prototype.load=function(y){y.en=new f.en},m})();l.enLocaleLoader=c}),486:((s,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.en=void 0;var d=(function(){function f(){}return f.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},f.prototype.atX0MinutesPastTheHourGt20=function(){return null},f.prototype.commaMonthX0ThroughMonthX1=function(){return null},f.prototype.commaYearX0ThroughYearX1=function(){return null},f.prototype.use24HourTimeFormatByDefault=function(){return!1},f.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},f.prototype.everyMinute=function(){return"every minute"},f.prototype.everyHour=function(){return"every hour"},f.prototype.atSpace=function(){return"At "},f.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},f.prototype.at=function(){return"At"},f.prototype.spaceAnd=function(){return" and"},f.prototype.everySecond=function(){return"every second"},f.prototype.everyX0Seconds=function(){return"every %s seconds"},f.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},f.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},f.prototype.everyX0Minutes=function(){return"every %s minutes"},f.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},f.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},f.prototype.everyX0Hours=function(){return"every %s hours"},f.prototype.betweenX0AndX1=function(){return"between %s and %s"},f.prototype.atX0=function(){return"at %s"},f.prototype.commaEveryDay=function(){return", every day"},f.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},f.prototype.commaX0ThroughX1=function(){return", %s through %s"},f.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},f.prototype.first=function(){return"first"},f.prototype.second=function(){return"second"},f.prototype.third=function(){return"third"},f.prototype.fourth=function(){return"fourth"},f.prototype.fifth=function(){return"fifth"},f.prototype.commaOnThe=function(){return", on the "},f.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},f.prototype.lastDay=function(){return"the last day"},f.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},f.prototype.commaOnlyOnX0=function(){return", only on %s"},f.prototype.commaAndOnX0=function(){return", and on %s"},f.prototype.commaEveryX0Months=function(){return", every %s months"},f.prototype.commaOnlyInX0=function(){return", only in %s"},f.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},f.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},f.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},f.prototype.firstWeekday=function(){return"first weekday"},f.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},f.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},f.prototype.commaEveryX0Days=function(){return", every %s days"},f.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},f.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},f.prototype.commaEveryHour=function(){return", every hour"},f.prototype.commaEveryX0Years=function(){return", every %s years"},f.prototype.commaStartingX0=function(){return", starting %s"},f.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},f.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},f.prototype.atReboot=function(){return"Run once, at startup"},f})();l.en=d}),515:((s,l)=>{Object.defineProperty(l,"__esModule",{value:!0});function d(c,m){if(!c)throw new Error(m)}var f=(function(){function c(){}return c.secondRange=function(m){for(var y=m.split(","),b=0;b<y.length;b++)if(!isNaN(parseInt(y[b],10))){var v=parseInt(y[b],10);d(v>=0&&v<=59,"seconds part must be >= 0 and <= 59")}},c.minuteRange=function(m){for(var y=m.split(","),b=0;b<y.length;b++)if(!isNaN(parseInt(y[b],10))){var v=parseInt(y[b],10);d(v>=0&&v<=59,"minutes part must be >= 0 and <= 59")}},c.hourRange=function(m){for(var y=m.split(","),b=0;b<y.length;b++)if(!isNaN(parseInt(y[b],10))){var v=parseInt(y[b],10);d(v>=0&&v<=23,"hours part must be >= 0 and <= 23")}},c.dayOfMonthRange=function(m){for(var y=m.split(","),b=0;b<y.length;b++)if(!isNaN(parseInt(y[b],10))){var v=parseInt(y[b],10);d(v>=1&&v<=31,"DOM part must be >= 1 and <= 31")}},c.monthRange=function(m,y){for(var b=m.split(","),v=0;v<b.length;v++)if(!isNaN(parseInt(b[v],10))){var x=parseInt(b[v],10);d(x>=1&&x<=12,y?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},c.dayOfWeekRange=function(m,y){for(var b=m.split(","),v=0;v<b.length;v++)if(!isNaN(parseInt(b[v],10))){var x=parseInt(b[v],10);d(x>=0&&x<=6,y?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},c})();l.default=f}),823:((s,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.StringUtilities=void 0;var d=(function(){function f(){}return f.format=function(c){for(var m=[],y=1;y<arguments.length;y++)m[y-1]=arguments[y];return c.replace(/%s/g,function(b){return m.shift()})},f.containsAny=function(c,m){return m.some(function(y){return c.indexOf(y)>-1})},f})();l.StringUtilities=d})},r={};function o(s){var l=r[s];if(l!==void 0)return l.exports;var d=r[s]={exports:{}};return n[s](d,d.exports,o),d.exports}var a={};return(()=>{var s=a;Object.defineProperty(s,"__esModule",{value:!0}),s.toString=void 0;var l=o(333),d=o(747);l.ExpressionDescriptor.initialize(new d.enLocaleLoader),s.default=l.ExpressionDescriptor;var f=l.ExpressionDescriptor.toString;s.toString=f})(),a})())})(vD)),vD.exports}var mfe=hfe();const gfe=Ul(mfe),yfe=new Set(["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC","SUN","MON","TUE","WED","THU","FRI","SAT"]);function vfe(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)&&!yfe.has(n.toUpperCase()))return!1}return!0}function zL(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(!vfe(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=gfe.toString(t,{use24HourTimeFormat:!0,verbose:!1}),r=pfe.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 FL(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 bfe({onSubmit:e,isSubmitting:t,disabled:n,disabledReason:r}){const[o,a]=C.useState(!1),[s,l]=C.useState(!1),d=()=>a(!1),f=async()=>{try{await e({forceRefresh:s}),a(!1)}catch{}},c=h.jsx("span",{children:h.jsx(xg,{label:"Materialization",onClick:()=>a(!0),disabled:n})});return h.jsxs(h.Fragment,{children:[n&&r?h.jsx(Ui,{title:r,children:c}):c,h.jsx(aa,{open:o,onClose:d,title:"New materialization",description:"Compile the package, build a table for every persist source, and load them so queries serve from the tables.",actions:h.jsxs(h.Fragment,{children:[h.jsx(Ko,{onClick:d,children:"Cancel"}),h.jsx(Ko,{variant:"contained",loading:t,onClick:f,children:"Materialize"})]}),children:h.jsx(wW,{children:h.jsx(MC,{control:h.jsx(Sj,{checked:s,onChange:m=>l(m.target.checked)}),label:"Force refresh (rebuild even if unchanged)"})})})]})}function Ow({children:e}){return h.jsx(Lt,{variant:"caption",component:"h6",sx:{display:"block",textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:"text.secondary",mb:1},children:e})}function sb(e){return e===fa.Pending||e===fa.ManifestRowsReady}function xfe(e){return e===fa.ManifestFileReady||e===fa.Failed||e===fa.Cancelled}function BL(e){switch(e){case fa.ManifestFileReady:return"Done";case fa.Failed:return"Failed";case fa.Cancelled:return"Cancelled";case fa.Pending:case fa.ManifestRowsReady:return"Pending";default:return"Unknown"}}function Rw(e){switch(e){case fa.ManifestRowsReady:return"info";case fa.ManifestFileReady:return"success";case fa.Failed:return"error";case fa.Cancelled:return"warning";case fa.Pending:default:return"default"}}function UL(e){return e.metadata??{}}function Sfe(e){return e.trigger==="SCHEDULER"?"Scheduled":"Manual"}function _L(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 s=Math.floor(a/60),l=a%60;if(s<60)return`${s}m ${l}s`;const d=Math.floor(s/60),f=s%60;return`${d}h ${f}m`}function $w(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 wfe(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 Cfe({entries:e,builtAt:t}){const n=Object.entries(e??{});return h.jsxs(Kt,{children:[h.jsxs(fr,{direction:"row",alignItems:"baseline",justifyContent:"space-between",children:[h.jsx(Ow,{children:"Build manifest"}),t&&h.jsxs(Lt,{variant:"caption",color:"text.secondary",children:["Built ",$w(t)]})]}),n.length===0?h.jsx(Lt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"No materialized tables yet."}):h.jsxs(ug,{size:"small",children:[h.jsx(fg,{children:h.jsxs(Zs,{children:[h.jsx(Xn,{children:"Source"}),h.jsx(Xn,{children:"Table name"}),h.jsx(Xn,{children:"Connection"}),h.jsx(Xn,{children:"Realization"}),h.jsx(Xn,{align:"right",children:"Rows"})]})}),h.jsx(dg,{children:n.map(([r,o])=>h.jsxs(Zs,{children:[h.jsx(Xn,{sx:{fontFamily:Ai},children:o.sourceName??r}),h.jsx(Xn,{sx:{fontFamily:Ai},children:o.physicalTableName??"-"}),h.jsx(Xn,{sx:{fontFamily:Ai},children:o.connectionName??"-"}),h.jsx(Xn,{children:o.realization??"-"}),h.jsx(Xn,{align:"right",children:o.rowCount??"-"})]},r))})]})]})}function VL({meta:e}){const t=e.trigger==="SCHEDULER";return h.jsx(Ui,{title:t?"Fired by the materialization schedule":"Triggered manually",children:h.jsx(Lt,{variant:"body2",color:"text.secondary",children:Sfe(e)})})}function kfe({materialization:e,buildPlan:t,onClose:n}){const r=e?UL(e):{},o=Object.values(t?.sources??{});return h.jsx(Yf,{open:e!==null,onClose:n,maxWidth:"md",fullWidth:!0,"aria-labelledby":"materialization-detail-title",children:e&&h.jsxs(h.Fragment,{children:[h.jsxs(Gf,{sx:{pr:6,pb:1.5},id:"materialization-detail-title",children:[h.jsxs(fr,{direction:"row",alignItems:"center",spacing:1,sx:{mb:.75},children:[h.jsx(rj,{size:"small",label:BL(e.status),color:Rw(e.status),variant:sb(e.status)?"filled":"outlined"}),h.jsx(VL,{meta:r})]}),h.jsx(Lt,{variant:"subtitle1",sx:{fontWeight:600},children:e.packageName??"Materialization"}),h.jsx(Lt,{variant:"caption",color:"text.secondary",sx:{fontFamily:Ai,wordBreak:"break-all"},children:e.id}),h.jsx(eo,{"aria-label":"close",onClick:n,sx:{position:"absolute",right:8,top:8},children:h.jsx(Jf,{fontSize:"small"})})]}),h.jsxs(Kf,{dividers:!0,children:[h.jsxs(Kt,{sx:{bgcolor:"action.hover",borderRadius:2,p:2,mb:3,display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:2},children:[h.jsx(rm,{label:"Started",value:$w(e.startedAt??e.createdAt)}),h.jsx(rm,{label:"Completed",value:$w(e.completedAt)}),h.jsx(rm,{label:"Duration",value:_L(e.startedAt,e.completedAt)}),h.jsx(rm,{label:"Sources",value:`${r.sourcesBuilt??0} built · ${r.sourcesReused??0} reused`}),h.jsx(rm,{label:"Force refresh",value:r.forceRefresh?"Yes":"No"})]}),e.error&&h.jsxs(Kt,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"error.main"},children:[h.jsx(Ow,{children:h.jsx(Kt,{component:"span",sx:{color:"error.main"},children:"Error"})}),h.jsx(Lt,{variant:"body2",sx:{fontFamily:Ai,whiteSpace:"pre-wrap"},children:e.error})]}),h.jsxs(Kt,{sx:{mb:3},children:[h.jsx(Ow,{children:"Build plan"}),o.length===0?h.jsx(Lt,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"This package has no persist sources."}):h.jsxs(ug,{size:"small",children:[h.jsx(fg,{children:h.jsxs(Zs,{children:[h.jsx(Xn,{children:"Source"}),h.jsx(Xn,{children:"Connection"}),h.jsx(Xn,{children:"Dialect"}),h.jsx(Xn,{align:"right",children:"Columns"}),h.jsx(Xn,{children:"Source Entity ID"})]})}),h.jsx(dg,{children:o.map(a=>h.jsxs(Zs,{children:[h.jsx(Xn,{sx:{fontFamily:Ai},children:a.name}),h.jsx(Xn,{sx:{fontFamily:Ai},children:a.connectionName}),h.jsx(Xn,{children:a.dialect??"-"}),h.jsx(Xn,{align:"right",children:a.columns?.length??0}),h.jsx(Xn,{sx:{fontFamily:Ai,fontSize:"0.75rem",wordBreak:"break-all",maxWidth:220},children:a.sourceEntityId})]},a.sourceID))})]})]}),h.jsx(Cfe,{entries:e.manifest?.entries,builtAt:e.manifest?.builtAt})]})]})})}function rm({label:e,value:t}){return h.jsxs(Kt,{children:[h.jsx(Lt,{variant:"caption",color:"text.secondary",display:"block",children:e}),h.jsx(Lt,{variant:"body2",children:t})]})}const Tfe=cr(h.jsx("path",{d:"M6 6h12v12H6z"}));function Mfe(e){return on("PrivateSwitchBase",e)}Gt("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const Efe=e=>{const{classes:t,checked:n,disabled:r,edge:o}=e,a={root:["root",n&&"checked",r&&"disabled",o&&`edge${Tt(o)}`],input:["input"]};return tn(a,Mfe,t)},Ofe=Ge(od,{name:"MuiSwitchBase"})({padding:9,borderRadius:"50%",variants:[{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>e==="start"&&t.size!=="small",style:{marginLeft:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>e==="end"&&t.size!=="small",style:{marginRight:-12}}]}),Rfe=Ge("input",{name:"MuiSwitchBase",shouldForwardProp:La})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),$fe=C.forwardRef(function(e,t){const{autoFocus:n,checked:r,checkedIcon:o,defaultChecked:a,disabled:s,disableFocusRipple:l=!1,edge:d=!1,icon:f,id:c,inputProps:m,inputRef:y,name:b,onBlur:v,onChange:x,onFocus:w,readOnly:S,required:T=!1,tabIndex:M,type:R,value:$,slots:P={},slotProps:N={},...V}=e,[z,W]=li({controlled:r,default:!!a,name:"SwitchBase",state:"checked"}),H=fi(),k=pe=>{w&&w(pe),H&&H.onFocus&&H.onFocus(pe)},I=pe=>{v&&v(pe),H&&H.onBlur&&H.onBlur(pe)},F=pe=>{if(pe.nativeEvent.defaultPrevented)return;const oe=pe.target.checked;W(oe),x&&x(pe,oe)};let _=s;H&&typeof _>"u"&&(_=H.disabled);const j=R==="checkbox"||R==="radio",X={...e,checked:z,disabled:_,disableFocusRipple:l,edge:d},Q=Efe(X),te={slots:P,slotProps:{input:m,...N}},[Z,G]=ir("root",{ref:t,elementType:Ofe,className:Q.root,shouldForwardComponentProp:!0,externalForwardedProps:{...te,component:"span",...V},getSlotProps:pe=>({...pe,onFocus:oe=>{pe.onFocus?.(oe),k(oe)},onBlur:oe=>{pe.onBlur?.(oe),I(oe)}}),ownerState:X,additionalProps:{centerRipple:!0,focusRipple:!l,disabled:_,role:void 0,tabIndex:null}}),[ne,se]=ir("input",{ref:y,elementType:Rfe,className:Q.input,externalForwardedProps:te,getSlotProps:pe=>({...pe,onChange:oe=>{pe.onChange?.(oe),F(oe)}}),ownerState:X,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:_,id:j?c:void 0,name:b,readOnly:S,required:T,tabIndex:M,type:R,...R==="checkbox"&&$===void 0?{}:{value:$}}});return h.jsxs(Z,{...G,children:[h.jsx(ne,{...se}),z?o:f]})}),Pfe=cr(h.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})),Dfe=cr(h.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})),Afe=cr(h.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}));function jfe(e){return on("MuiCheckbox",e)}const tS=Gt("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),Nfe=e=>{const{classes:t,indeterminate:n,color:r,size:o}=e,a={root:["root",n&&"indeterminate",`color${Tt(r)}`,`size${Tt(o)}`]},s=tn(a,jfe,t);return{...t,...s}},Ife=Ge($fe,{shouldForwardProp:e=>La(e)||e==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${Tt(n.size)}`],n.color!=="default"&&t[`color${Tt(n.color)}`]]}})(Vn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(pa()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(pa()).map(([t])=>({props:{color:t},style:{[`&.${tS.checked}, &.${tS.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${tS.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),Lfe=h.jsx(Dfe,{}),zfe=h.jsx(Pfe,{}),Ffe=h.jsx(Afe,{}),Bfe=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiCheckbox"}),{checkedIcon:r=Lfe,color:o="primary",icon:a=zfe,indeterminate:s=!1,indeterminateIcon:l=Ffe,inputProps:d,size:f="medium",disableRipple:c=!1,className:m,slots:y={},slotProps:b={},...v}=n,x=s?l:a,w=s?l:r,S={...n,disableRipple:c,color:o,indeterminate:s,size:f},T=Nfe(S),M=b.input??d,[R,$]=ir("root",{ref:t,elementType:Ife,className:jt(T.root,m),shouldForwardComponentProp:!0,externalForwardedProps:{slots:y,slotProps:b,...v},ownerState:S,additionalProps:{type:"checkbox",icon:C.cloneElement(x,{fontSize:x.props.fontSize??f}),checkedIcon:C.cloneElement(w,{fontSize:w.props.fontSize??f}),disableRipple:c,slots:y,slotProps:{input:VN(typeof M=="function"?M(S):M,{"data-indeterminate":s})}}});return h.jsx(R,{...$,classes:T})});function Ufe(e){return on("MuiFormControlLabel",e)}const gm=Gt("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error","required","asterisk"]),_fe=e=>{const{classes:t,disabled:n,labelPlacement:r,error:o,required:a}=e,s={root:["root",n&&"disabled",`labelPlacement${Tt(r)}`,o&&"error",a&&"required"],label:["label",n&&"disabled"],asterisk:["asterisk",o&&"error"]};return tn(s,Ufe,t)},Vfe=Ge("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${gm.label}`]:t.label},t.root,t[`labelPlacement${Tt(n.labelPlacement)}`]]}})(Vn(({theme:e})=>({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${gm.disabled}`]:{cursor:"default"},[`& .${gm.label}`]:{[`&.${gm.disabled}`]:{color:(e.vars||e).palette.text.disabled}},variants:[{props:{labelPlacement:"start"},style:{flexDirection:"row-reverse",marginRight:-11}},{props:{labelPlacement:"top"},style:{flexDirection:"column-reverse"}},{props:{labelPlacement:"bottom"},style:{flexDirection:"column"}},{props:({labelPlacement:t})=>t==="start"||t==="top"||t==="bottom",style:{marginLeft:16}}]}))),Hfe=Ge("span",{name:"MuiFormControlLabel",slot:"Asterisk"})(Vn(({theme:e})=>({[`&.${gm.error}`]:{color:(e.vars||e).palette.error.main}}))),Wfe=C.forwardRef(function(e,t){const n=Hn({props:e,name:"MuiFormControlLabel"}),{checked:r,className:o,componentsProps:a={},control:s,disabled:l,disableTypography:d,inputRef:f,label:c,labelPlacement:m="end",name:y,onChange:b,required:v,slots:x={},slotProps:w={},value:S,...T}=n,M=fi(),R=l??s.props.disabled??M?.disabled,$=v??s.props.required,P={disabled:R,required:$};["checked","name","onChange","value","inputRef"].forEach(F=>{typeof s.props[F]>"u"&&typeof n[F]<"u"&&(P[F]=n[F])});const N=md({props:n,muiFormControl:M,states:["error"]}),V={...n,disabled:R,labelPlacement:m,required:$,error:N.error},z=_fe(V),W={slots:x,slotProps:{...a,...w}},[H,k]=ir("typography",{elementType:br,externalForwardedProps:W,ownerState:V});let I=c;return I!=null&&I.type!==br&&!d&&(I=h.jsx(H,{component:"span",...k,className:jt(z.label,k?.className),children:I})),h.jsxs(Vfe,{className:jt(z.root,o),ownerState:V,ref:t,...T,children:[C.cloneElement(s,P),$?h.jsxs("div",{children:[I,h.jsxs(Hfe,{ownerState:V,"aria-hidden":!0,className:z.asterisk,children:[" ","*"]})]}):I]})});function qfe({materialization:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),[s,l]=C.useState(!1),d=()=>a(!0),f=()=>{a(!1),l(!1),t()};return h.jsxs(pn.Fragment,{children:[h.jsxs(qo,{"aria-label":`Delete materialization ${e?.id??""}`.trim(),onClick:c=>{c.stopPropagation(),d()},sx:{color:"error.main"},children:[h.jsx(zk,{sx:{color:"inherit"},children:h.jsx(Gb,{fontSize:"small"})}),h.jsx(Fk,{children:"Delete"})]}),h.jsxs(aa,{open:o,onClose:f,title:"Delete materialization",actions:h.jsxs(h.Fragment,{children:[h.jsx(uo,{onClick:f,children:"Cancel"}),h.jsx(uo,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>r(s),loading:n,children:"Delete run"})]}),children:[h.jsx(br,{variant:"body2",children:"Delete this run's record? This cannot be undone."}),h.jsx(Wfe,{control:h.jsx(Bfe,{checked:s,onChange:c=>l(c.target.checked)}),label:"Also drop the materialized tables this run produced"})]})]})}function Yfe({materializations:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){return e.length===0?h.jsx(Lt,{variant:"body2",color:"text.secondary",sx:{py:1,fontStyle:"italic"},children:"No materializations yet."}):h.jsxs(ug,{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:[h.jsx(fg,{children:h.jsxs(Zs,{children:[h.jsx(Xn,{children:"Status"}),h.jsx(Xn,{children:"Trigger"}),h.jsx(Xn,{children:"Started"}),h.jsx(Xn,{children:"Duration"}),h.jsx(Xn,{children:"Sources"}),h.jsx(Xn,{align:"right",children:"Actions"})]})}),h.jsx(dg,{children:e.map(s=>h.jsx(Kfe,{materialization:s,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a},s.id))})]})}function Kfe({materialization:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){const[s,l]=C.useState(null),d=!!s,f=()=>l(null),c=UL(e),m=c.sourcesBuilt!==void 0||c.sourcesReused!==void 0?`${c.sourcesBuilt??0} built, ${c.sourcesReused??0} reused`:"-",y=sb(e.status),b=xfe(e.status),v=e.error??void 0,x=t&&(y||b);return h.jsxs(Zs,{hover:!0,sx:{cursor:"pointer","&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"-2px"}},onClick:()=>a(e),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),a(e))},role:"button",tabIndex:0,"aria-label":`View materialization ${e.id??""} details`.trim(),children:[h.jsx(Xn,{children:h.jsxs(Kt,{sx:{display:"flex",alignItems:"center",gap:.5},children:[h.jsx(Lt,{variant:"body2",sx:{fontWeight:500,color:Rw(e.status)==="default"?"text.primary":`${Rw(e.status)}.main`},children:BL(e.status)}),v&&h.jsx(Ui,{title:v,children:h.jsx(SL,{fontSize:"small",color:"error"})})]})}),h.jsx(Xn,{children:h.jsx(VL,{meta:c})}),h.jsx(Xn,{children:wfe(e.startedAt??e.createdAt)}),h.jsx(Xn,{children:_L(e.startedAt,e.completedAt)}),h.jsx(Xn,{children:m}),h.jsx(Xn,{align:"right",onClick:w=>w.stopPropagation(),children:x&&h.jsxs(h.Fragment,{children:[h.jsx(eo,{size:"small","aria-label":`Materialization actions for ${e.id??""}`.trim(),onClick:w=>l(w.currentTarget),children:h.jsx(Qb,{fontSize:"small"})}),h.jsxs(cd,{anchorEl:s,open:d,onClose:f,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[t&&y&&h.jsxs(Ii,{"aria-label":`Stop materialization ${e.id??""}`.trim(),disabled:n,onClick:()=>{f(),r(e)},children:[h.jsx(dp,{children:h.jsx(Tfe,{fontSize:"small"})}),h.jsx(Kc,{children:"Stop"})]}),t&&b&&h.jsx(qfe,{materialization:e,isMutating:n,onCloseDialog:f,onDelete:w=>o(e,w)})]})]})})]})}const Gfe=cr(h.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"})),Qfe={package:"Materialized artifacts are shared across versions",version:"Materialized artifacts are per published version"};function Xfe({scope:e,disabled:t,disabledReason:n,isSubmitting:r,onChange:o}){const[a,s]=C.useState(null),l=async d=>{s(null),d!==e&&await o(d).catch(()=>{})};return h.jsxs(h.Fragment,{children:[h.jsx(Sg,{label:"Scope",icon:h.jsx(Gfe,{}),onClick:d=>s(d.currentTarget),disabled:t||r,...n?{disabledReason:n}:{},ariaHasPopup:"menu",ariaLabel:`Scope: ${e}`}),h.jsx(cd,{anchorEl:a,open:!!a,onClose:()=>s(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:["package","version"].map(d=>h.jsxs(Ii,{selected:d===e,onClick:()=>void l(d),children:[h.jsx(dp,{sx:{minWidth:32},children:d===e&&h.jsx(Yue,{fontSize:"small"})}),h.jsx(Kc,{primary:d,secondary:Qfe[d]})]},d))})]})}const Zfe=cr([h.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"),h.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")]),xD="0 6 * * *";function Jfe({currentSchedule:e,isSubmitting:t,disabled:n,disabledReason:r,onSubmit:o}){const[a,s]=C.useState(!1),[l,d]=C.useState(e??xD),f=()=>{d(e??xD),s(!0)},c=()=>s(!1),m=zL(l),y=async b=>{try{await o(b),s(!1)}catch{}};return h.jsxs(h.Fragment,{children:[h.jsx(Sg,{label:"Schedule",icon:h.jsx(Zfe,{}),onClick:f,disabled:n,...r?{disabledReason:r}:{},ariaHasPopup:"dialog",ariaLabel:e?"Edit schedule":"Set schedule"}),h.jsxs(aa,{open:a,onClose:c,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:h.jsxs(h.Fragment,{children:[e&&h.jsx(Ko,{color:"error",loading:t,onClick:()=>y(null),sx:{mr:"auto"},children:"Clear schedule"}),h.jsx(Ko,{onClick:c,children:"Cancel"}),h.jsx(Ko,{variant:"contained",loading:t,disabled:!m.valid,onClick:()=>y(l.trim()),children:"Save schedule"})]}),children:[h.jsx(ii,{autoFocus:!0,fullWidth:!0,size:"small",label:"Cron expression",value:l,onChange:b=>d(b.target.value),error:l.trim()!==""&&!m.valid,helperText:m.valid?`${m.description} · next run ${FL(m.nextRun)}`:m.error,slotProps:{htmlInput:{style:{fontFamily:Ai}}}}),h.jsxs($c,{severity:"info",children:["A schedule runs only on version-scoped packages, so saving one sets ",h.jsx("code",{children:"scope: version"})," for this package."]})]})]})}const epe=3e3;function tpe({resourceUri:e}){const{apiClients:t,mutable:n}=zr(),r=dd(),{environmentName:o,packageName:a}=xo(e),[s,l]=C.useState(""),[d,f]=C.useState(null);if(!a)throw new Error("Materializations requires a package in the resource URI");const c=co({queryKey:["materializations",o,a],queryFn:()=>t.materializations.listMaterializations(o,a),refetchInterval:I=>(I.state.data?.data??[]).some(F=>sb(F.status))?epe:!1}),m=co({queryKey:["package",o,a],queryFn:()=>t.packages.getPackage(o,a)}),y=()=>r.invalidateQueries({queryKey:["materializations",o,a]}),b=Ws({mutationFn:Pl("materialization","create",I=>t.materializations.createMaterialization(o,a,{forceRefresh:I.forceRefresh})),onSuccess(){l("Materialization requested"),y()},onError(I){l(I.message),y()}}),v=Ws({mutationFn:Pl("materialization","update",I=>t.materializations.materializationAction(o,a,I.id,GK.Stop)),onSuccess(){l("Materialization stopped"),y()},onError(I){l(I.message)}}),x=Ws({mutationFn:Pl("materialization","delete",({materialization:I,dropTables:F})=>t.materializations.deleteMaterialization(o,a,I.id,F)),onSuccess(){l("Materialization deleted"),y()},onError(I){l(I.message)}}),w=m.data?.data,S=Ws({mutationFn:Pl("schedule","update",I=>t.packages.updatePackage(o,a,{name:a,description:w?.description,...I?{scope:Vy.Version}:{},materialization:{schedule:I}})),onSuccess(I,F){l(F?"Schedule updated":"Schedule cleared"),r.invalidateQueries({queryKey:["package",o,a]})},onError(I){l(I.message)}}),T=Ws({mutationFn:Pl("scope","update",I=>t.packages.updatePackage(o,a,{name:a,description:w?.description,scope:I})),onSuccess(){l("Scope updated"),r.invalidateQueries({queryKey:["package",o,a]})},onError(I){l(I.message)}}),M=c.data?.data??[],R=M.find(I=>I.id===d)??null,$=M.some(I=>sb(I.status)),P=b.isPending||v.isPending||x.isPending,N=w?.materialization?.schedule??null,V=w?.scope===Vy.Version?"version":"package",z=!!w?.manifestLocation,W=!!w?.materialization?.freshness,H=N?zL(N):null,k=z?"Control-plane managed: refresh is driven by the control plane, not the built-in scheduler.":[H?H.valid?`${H.description} (${N}), next run ${FL(H.nextRun)}`:`Unrecognized cron expression (${N})`:W?"Refreshed by a freshness policy; a cron schedule does not apply":"On demand only, no schedule set",`scope: ${V}`].join(" · ");return h.jsxs(h.Fragment,{children:[h.jsxs(us,{title:"Materializations",count:c.isSuccess?M.length:void 0,action:n&&h.jsxs(fr,{direction:"row",spacing:1,alignItems:"center",children:[!z&&h.jsx(Xfe,{scope:V,disabled:!!N,disabledReason:"A schedule requires version scope. Clear the schedule to change it.",isSubmitting:T.isPending,onChange:I=>T.mutateAsync(I==="version"?Vy.Version:Vy.Package)}),!z&&h.jsx(Jfe,{currentSchedule:N,isSubmitting:S.isPending,disabled:W,disabledReason:"This package declares a freshness policy; a schedule and freshness are mutually exclusive.",onSubmit:I=>S.mutateAsync(I)}),h.jsx(bfe,{onSubmit:I=>b.mutateAsync(I),isSubmitting:b.isPending,disabled:$,disabledReason:"A materialization is already pending or running for this package."})]}),children:[m.isSuccess&&h.jsx(Lt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:k}),c.isError&&h.jsx(ha,{error:c.error,context:`${o} > ${a} > Materializations`}),!c.isSuccess&&!c.isError&&h.jsx(oa,{text:"Loading materializations..."}),c.isSuccess&&h.jsx(Yfe,{materializations:M,mutable:n,isMutating:P,onStop:I=>v.mutate(I),onDelete:(I,F)=>x.mutate({materialization:I,dropTables:F}),onViewDetails:I=>f(I.id??null)})]}),h.jsx(kfe,{materialization:R,buildPlan:m.data?.data?.buildPlan??null,onClose:()=>f(null)}),h.jsx(Fb,{open:s!=="",autoHideDuration:6e3,onClose:()=>l(""),message:s})]})}const HL=cr(h.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"})),lb=cr(h.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"})),npe=cr(h.jsx("path",{d:"M8 5v14l11-7z"})),nS={scopeName:"source.malloy",patterns:[{include:"#malloy-language"}],repository:{"malloy-language":{patterns:[{include:"#sql-string"},{include:"#comments"},{include:"#tags"},{include:"#strings"},{include:"#numbers"},{include:"#keywords"},{include:"#properties"},{include:"#functions"},{include:"#datetimes"},{include:"#identifiers-quoted"},{include:"#types"},{include:"#constants"},{include:"#timeframes"},{include:"#identifiers-unquoted"}]},"malloy-matched":{begin:"{",end:"}",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"malloy-in-sql":{begin:"%{",name:"source.malloy-in-sql",end:"}%?",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"sql-string":{patterns:[{begin:'(\\b[A-Za-z_][A-Za-z_0-9]*)(\\s*\\.\\s*)(sql)(\\s*\\(\\s*)(""")',end:'"""',beginCaptures:{1:{name:"variable.other"},3:{name:"keyword.control.sql"},5:{name:"punctuation.sql-block.open"}},endCaptures:{0:{name:"punctuation.sql-block.close"}},name:"source.sql",patterns:[{include:"#malloy-in-sql"},{include:"source.sql"}]}]},functions:{patterns:[{match:"(?i)\\b(count)(\\s*\\()(distinct)",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.function.modifier"}}},{match:"(?i)\\b(AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE|UNGROUPED)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(!)(timestamp|number|string|boolean|date)?(\\s*\\()",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.type"}}}]},datetimes:{patterns:[{match:"(?i)@[0-9]{4}-[0-9]{2}-[0-9]{2}[ T][0-9]{2}:[0-9]{2}((:[0-9]{2})(([\\.,][0-9]+)(\\[[A-Za-z_/]+\\])?)?)?",name:"constant.numeric.timestamp"},{match:"(?i)@[0-9]{4}(-Q[1-4]|-[0-9]{2}(-[0-9]{2}(-WK)?)?)?",name:"constant.numeric.date"}]},"identifiers-quoted":{patterns:[{match:"`[^`]*`",name:"variable.other.quoted"}]},"identifiers-unquoted":{patterns:[{match:"(?i)\\b[A-Za-z_][A-Za-z_0-9]*\\b",name:"variable.other"}]},timeframes:{patterns:[{match:"(?i)\\b((year|quarter|month|week|day|hour|minute|second)s?)\\b",name:"keyword.other.timeframe"},{match:"(?i)\\b(day_of_year|day_of_month)\\b",name:"keyword.other.timeframe"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]},tags:{patterns:[{match:"##\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:'#"',end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{match:"#\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:"#\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"##\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"#",end:"\\n",beginCaptures:{0:{name:"string.quoted"}},name:"string.quoted"}],repository:{"tag-values":{name:"support.type.property-name.json",match:'(-)?((?:[^\\s=#]+)|(?:"[^#]+"))(?:\\s*(=)\\s*((?:[^\\s=#]+)|(?:"[^#]+")))?',captures:{1:{name:"keyword.control.negate"},2:{name:"support.type.property-name.json"},3:{name:"keyword.operator.comparison.ts"},4:{name:"string.quoted"}}}}},strings:{patterns:[{begin:"'",end:"'",beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.single",patterns:[{include:"#escapes"}]},{begin:'"',end:'"',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.double",patterns:[{include:"#escapes"}]},{begin:'"""',end:'"""',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.triple"},{begin:"(?i)[r|/]'",end:"'",name:"string.regexp",patterns:[{include:"#regex-escapes"}]}],repository:{escapes:{name:"constant.character.escape",match:"\\\\(u[A-Fa-f0-9]{4}|.)",captures:{0:{name:"constant.character.escape"}}},"regex-escapes":{name:"constant.character.escape",match:"\\\\.",captures:{0:{name:"constant.character.escape"}}}}},numbers:{match:"(?i)(\\b((0|[1-9][0-9]*)(E[+-]?[0-9]+|\\.[0-9]*)?)|\\.[0-9]+)",name:"constant.numeric"},constants:{patterns:[{match:"(?i)\\bnull\\b",name:"constant.language.null"},{match:"(?i)\\btrue\\b",name:"constant.language.true"},{match:"(?i)\\bfalse\\b",name:"constant.language.false"}]},types:{patterns:[{match:"(?i)\\bstring\\b",name:"entity.name.type.string"},{match:"(?i)\\bnumber\\b",name:"entity.name.type.number"},{match:"(?i)\\bdate\\b",name:"entity.name.type.date"},{match:"(?i)\\btimestamp\\b",name:"entity.name.type.timestamp"},{match:"(?i)\\bboolean\\b",name:"entity.name.type.boolean"}]},properties:{patterns:[{match:"(?i)\\baccept\\b",name:"keyword.control.accept"},{match:"(?i)\\bselect\\b",name:"keyword.control.select"},{match:"(?i)\\bconnection\\b",name:"keyword.control.connection"},{match:"(?i)\\brun\\b",name:"keyword.control.run"},{match:"(?i)\\bextend\\b",name:"keyword.control.extend"},{match:"(?i)\\brefine\\b",name:"keyword.control.refine"},{match:"(?i)\\baggregate\\b",name:"keyword.control.aggregate"},{match:"(?i)\\bsample\\b",name:"keyword.control.sample"},{match:"(?i)\\bcalculate\\b",name:"keyword.control.calculate"},{match:"(?i)\\btimezone\\b",name:"keyword.control.timezone"},{match:"(?i)\\bdimension\\b",name:"keyword.control.dimension"},{match:"(?i)\\bexcept\\b",name:"keyword.control.except"},{match:"(?i)\\bsource\\b",name:"keyword.control.source"},{match:"(?i)\\bgroup_by\\b",name:"keyword.control.group_by"},{match:"(?i)\\bhaving\\b",name:"keyword.control.having"},{match:"(?i)\\bindex\\b",name:"keyword.control.index"},{match:"(?i)\\bjoin_one\\b",name:"keyword.control.join_one"},{match:"(?i)\\bwith\\b",name:"keyword.control.with"},{match:"(?i)\\bjoin_many\\b",name:"keyword.control.join_many"},{match:"(?i)\\bjoin_cross\\b",name:"keyword.control.join_cross"},{match:"(?i)\\blimit\\b",name:"keyword.control.limit"},{match:"(?i)\\bmeasure\\b",name:"keyword.control.measure"},{match:"(?i)\\bnest\\b",name:"keyword.control.nest"},{match:"(?i)\\border_by\\b",name:"keyword.control.order_by"},{match:"(?i)\\bpartition_by\\b",name:"keyword.control.partition_by"},{match:"(?i)\\bprimary_key\\b",name:"keyword.control.primary_key"},{match:"(?i)\\bproject\\b",name:"keyword.control.project"},{match:"(?i)\\bquery\\b",name:"keyword.control.query"},{match:"(?i)\\brename\\b",name:"keyword.control.rename"},{match:"(?i)\\btop\\b",name:"keyword.control.top"},{match:"(?i)\\bview\\b",name:"keyword.control.view"},{match:"(?i)\\bwhere\\b",name:"keyword.control.where"},{match:"(?i)\\bdeclare\\b",name:"keyword.control.declare"}]},keywords:{patterns:[{match:"(?i)\\bis\\b",name:"keyword.control.is"},{match:"(?i)\\bon\\b",name:"keyword.control.on"},{match:"(?i)\\bnot\\b",name:"keyword.other.not"},{match:"(?i)\\bor\\b",name:"keyword.other.or"},{match:"(?i)\\bdesc\\b",name:"keyword.control.desc"},{match:"(?i)\\bby\\b",name:"keyword.control.by"},{match:"(?i)\\band\\b",name:"keyword.other.and"},{match:"(?i)\\basc\\b",name:"keyword.control.asc"},{match:"(?i)\\bfor\\b",name:"keyword.other.for"},{match:"(?i)\\belse\\b",name:"keyword.other.else"},{match:"(?i)\\bto\\b",name:"keyword.other.to"},{match:"(?i)\\bwhen\\b",name:"keyword.other.when"},{match:"(?i)\\bpick\\b",name:"keyword.other.pick"},{match:"(?i)\\bimport\\b",name:"keyword.control.import"}]}}},rpe={...nS,patterns:[...nS.patterns,{include:"#docvar"}],repository:{...nS.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},ope={name:"Malloy SQL",scopeName:"source.malloy-sql",patterns:[{include:"#malloysql-sql"}],repository:{"malloysql-sql":{beginCaptures:{0:{name:"entity.other.attribute.malloy-sql"},1:{name:"entity.other.attribute.malloy-sql"},3:{name:"comment.line.double-slash"}},name:"meta.embedded.block.malloysql.sql",patterns:[{include:"#comments"},{begin:"%{",end:"}%",beginCaptures:{0:{name:"punctuation.definition.malloy-sql"}},endCaptures:{0:{name:"punctuation.definition.malloy-sql"}},name:"meta.embedded.block.malloy",patterns:[{include:"source.malloy"}]},{include:"source.sql"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]}}},ape="github-light",ipe="github-dark";let rS;function spe(){return rS||(rS=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:a},{default:s}]=await Promise.all([Lo(()=>import("./core-B8oMW4sm.es-hOkwvru5.js"),__vite__mapDeps([7,8])),Lo(()=>import("./engine-oniguruma-C4vnmooL.es-jdkXmgTr.js"),[]),Lo(()=>import("./sql-DCkt643-.es-COK4E0Yg.js"),[]),Lo(()=>import("./json-71t8ZF9g.es-BQoSv7ci.js"),[]),Lo(()=>import("./typescript-buWNZFwO.es-Dj6nwHGl.js"),[]),Lo(()=>import("./github-light-JYsPkUQd.es-DAi9KRSo.js"),[]),Lo(()=>import("./github-dark-DenFmJkN.es-DHJKELXO.js"),[])]);return e({engine:t(Lo(()=>import("./wasm-DQxwEHae.es-CG6Dc4jp.js"),[])),themes:[a,s],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...rpe},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...ope}]})})()),rS}async function Pw(e,t,n="light"){return(await spe()).codeToHtml(e,{lang:t,theme:n==="dark"?ipe:ape})}function WL({open:e,onClose:t,result:n,title:r="Results",renderLogs:o,drill:a}){return h.jsx(aa,{open:e,onClose:t,title:r,maxWidth:!1,showClose:!0,children:h.jsx(Kt,{sx:{height:"70vh",overflow:"auto"},children:h.jsx(Ak,{result:n,maxHeight:Uce,maxResultSize:1e6,renderLogs:o,drill:a})})})}function lpe({queryName:e,annotations:t,resourceUri:n,runOnDemand:r=!1,maxResultSize:o=0}){const[a,s]=pn.useState(),[l,d]=pn.useState(!1),[f,c]=pn.useState(!1),{packageName:m,environmentName:y,versionId:b,modelPath:v}=xo(n),x=!r||f,w=Dk({environmentName:y,packageName:m,modelPath:v,versionId:b,queryName:e},{enabled:x}),S=w.data,{mode:T}=ol();return C.useEffect(()=>{if(t&&t.length>0){const M=t.map(R=>`// ${R}`).join(`
|
|
439
439
|
`);Pw(M,"typescript",T).then(R=>{s(R)})}},[t,T]),h.jsxs(Kt,{children:[a&&h.jsx(Kt,{sx:{marginBottom:"16px"},children:h.jsx(Lt,{fontSize:"12px",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:h.jsx("div",{className:"content",dangerouslySetInnerHTML:{__html:a}})})}),h.jsxs(Kt,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[h.jsx(Lt,{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}),h.jsx(Uf,{"aria-label":"Expand results",onClick:()=>d(!0),children:h.jsx(lb,{})})]}),h.jsxs(um,{sx:{position:"relative"},children:[r&&!f&&h.jsxs(Kt,{sx:{padding:"40px 20px",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[h.jsx(Lt,{variant:"body2",color:"text.secondary",children:"Click Run to execute the query"}),h.jsx(Ko,{variant:"contained",startIcon:h.jsx(npe,{}),onClick:()=>c(!0),children:"Run Query"})]}),x&&h.jsx(jk,{state:w,context:e,maxHeight:Bce,maxResultSize:o})]}),h.jsx(WL,{open:l,onClose:()=>d(!1),result:S?.data?.result||"",renderLogs:S?.data?.renderLogs,title:`Query: ${e}`})]})}function Yhe({onChange:e,resourceUri:t,runOnDemand:n=!1,maxResultSize:r=0}){const{modelPath:o}=xo(t),{data:a,isError:s,isLoading:l,error:d}=Nk(t),[f,c]=pn.useState(!1),[m,y]=pn.useState(),[b,v]=pn.useState(0),[x,w]=C.useState(""),S=a?.modelDef,T=pn.useMemo(()=>{if(!S)return!1;try{const P=JSON.parse(S);return Array.isArray(P.imports)&&P.imports.length>0}catch{return!1}},[S]);if(l)return h.jsx(oa,{text:"Fetching Model..."});if(s)return console.log("error",d),h.jsx(ha,{error:d,context:`Model > ${o}`});const M=P=>{y(P),e&&e(P)},R=P=>{v(P)},$=()=>{const P=window.location.href;navigator.clipboard.writeText(P).then(()=>w("URL copied to clipboard!")).catch(()=>w("Failed to copy URL"))};return h.jsxs(h.Fragment,{children:[h.jsxs(Kt,{sx:{position:"relative",maxWidth:"1200px",margin:"0 auto",paddingTop:"24px"},children:[Array.isArray(a?.sourceInfos)&&a.sourceInfos.length>0&&h.jsxs(fr,{spacing:2,component:"section",children:[h.jsxs(Kt,{sx:{padding:"0 0 16px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[h.jsx(Lt,{variant:"h1",sx:{fontSize:"28px",fontWeight:"600",color:"#1a1a1a",marginBottom:"8px",marginTop:"0",paddingLeft:"0"},children:"Sources"}),h.jsx(Ui,{title:"Click to copy link",children:h.jsx(HL,{sx:{fontSize:"24px",color:"text.secondary",cursor:"pointer"},onClick:$})})]}),h.jsx(CL,{data:a,onChange:M,onSourceChange:R,existingQuery:m,initialSelectedSourceIndex:b,resourceUri:t}),h.jsx(Uf,{"aria-label":"Expand results",sx:{position:"absolute",top:"90px",right:"4px",zIndex:2},onClick:()=>c(!0),children:h.jsx(lb,{})})]}),a?.queries?.length>0&&h.jsxs(fr,{spacing:2,component:"section",sx:{marginTop:"24px"},children:[h.jsx(Kt,{sx:{padding:"0 0 16px 0"},children:h.jsx(Lt,{variant:"h2",sx:{fontSize:"24px",fontWeight:"600",color:"#1a1a1a",marginBottom:"0",marginTop:"8px",paddingLeft:"0"},children:"Named Queries"})}),a.queries.map(P=>h.jsx(lpe,{queryName:P.name,annotations:P.annotations,resourceUri:t,runOnDemand:n,maxResultSize:r},P.name))]}),(!Array.isArray(a?.sourceInfos)||a.sourceInfos.length===0)&&!(a?.queries&&a.queries.length>0)&&h.jsxs(Kt,{sx:{textAlign:"center",py:6},children:[h.jsx(Lt,{variant:"body1",sx:{color:"text.secondary",marginBottom:"8px"},children:"This model exposes no sources or queries."}),T&&h.jsxs(Lt,{variant:"body2",color:"text.secondary",children:["It imports other files but re-exports nothing. Add"," ",h.jsxs("code",{children:["export ","{ source_name }"]})," to surface imported sources here."]})]}),h.jsx(Ik,{open:f,onClose:()=>c(!1),resourceUri:t,data:a,title:`Model: ${o.split("/").pop()}`,existingQuery:m,initialSelectedSourceIndex:b,onChange:M,onSourceChange:R})]}),h.jsx(Fb,{open:x!=="",autoHideDuration:6e3,onClose:()=>w(""),message:x})]})}function cpe({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 s=t===null||!t.startsWith(`${o}|`);return{cancelPending:a,dispatch:s?"now":"settle"}}function upe(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])}const dpe=cr(h.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"})),fpe=cr(h.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"}));function ppe(e){const{environmentName:t,packageName:n}=xo(e.resourceUri);if(!t||!n)throw new Error("Environment and Package name must be provided for query embedding.");return JSON.stringify({...e})}function hpe({cell:e,hideCodeCellIcon:t,hideEmbeddingIcon:n,resourceUri:r,index:o,maxResultSize:a,isExecuting:s,pendingRerun:l,onNavigate:d,onDrillSelf:f,canDrillSelf:c,onDrillNavigate:m}){const[y,b]=pn.useState(!1),[v,x]=pn.useState(!1),[w,S]=pn.useState(!1),[T,M]=pn.useState(),[R,$]=pn.useState(),[P,N]=pn.useState(!1),[V,z]=C.useState(""),{environmentName:W,packageName:H,modelPath:k}=xo(r),I={environmentName:W,packageName:H,sourcePath:k,onNavigate:d},{drill:F,drillMenu:_}=eI({onNavigate:m,onSelf:f,canSelf:c,selfLabel:"Filter this notebook"}),j=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,X=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,Q=oe=>oe.split(`
|
|
440
440
|
`).filter(ae=>!ae.trimStart().startsWith("##")).join(`
|
|
441
441
|
`),te=!!e.text&&(j.test(e.text)||X.test(e.text)),Z=()=>{if(!e.newSources||e.newSources.length===0)return 0;let oe=[],ae="";if(e.text){const ce=e.text.match(j);ce&&(oe=ce[1].split(",").map(ye=>ye.trim()));const ge=e.text.match(X);ge&&(ae=ge[1].trim())}for(let ce=0;ce<e.newSources.length;ce++)try{const ge=JSON.parse(e.newSources[ce]);if(oe.length>0&&oe.includes(ge.name)||ae&&ae===ge.path)return ce}catch{continue}return 0},G=e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:r}:void 0,ne=ppe({query:e.text,resourceUri:r}),{mode:se}=ol();C.useEffect(()=>{e.type==="code"&&Pw(Q(e.text),"malloy",se).then(oe=>{M(oe)})},[e,se]),C.useEffect(()=>{Pw(ne,"typescript",se).then(oe=>{$(oe)})},[ne,se]);const pe=()=>{const oe=window.location.href;navigator.clipboard.writeText(oe).then(()=>z("URL copied to clipboard!")).catch(()=>z("Failed to copy URL"))};return e.type==="markdown"&&h.jsx(Kt,{children:h.jsxs(Kt,{children:[o===0?h.jsxs(fr,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[h.jsx(ab,{variant:"document",links:I,children:e.text}),h.jsx(Ui,{title:"Click to copy link",children:h.jsx(HL,{sx:{fontSize:"24px",color:"text.secondary",cursor:"pointer",marginTop:"26px"},onClick:pe})})]}):h.jsx(ab,{variant:"document",links:I,children:e.text}),h.jsx(Fb,{open:V!=="",autoHideDuration:6e3,onClose:()=>z(""),message:V})]})})||e.type==="code"&&h.jsxs(Kt,{children:[(!t||!n&&e.result||e.newSources&&e.newSources.length>0)&&h.jsx(fr,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:e.newSources&&e.newSources.length>0&&h.jsx(um,{sx:{position:"relative",padding:"0"},children:h.jsxs(Kt,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[T&&h.jsx("span",{dangerouslySetInnerHTML:{__html:T},style:{fontFamily:"monospace",fontSize:"14px",flex:1,marginRight:"8px"}}),te&&h.jsx(Uf,{"aria-label":"Data sources",sx:{flexShrink:0},onClick:()=>N(!0),children:h.jsx(lb,{})})]})})}),h.jsx(Ik,{open:P,onClose:()=>N(!1),title:"Data Sources",hasValidImport:te,resourceUri:r,data:G,initialSelectedSourceIndex:Z()}),h.jsxs(Yf,{open:y,onClose:()=>b(!1),maxWidth:"lg",fullWidth:!0,children:[h.jsxs(Gf,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Malloy Code",h.jsx(eo,{onClick:()=>b(!1),sx:{color:"text.secondary"},children:h.jsx(Jf,{})})]}),h.jsx(Kf,{children:h.jsx(Kt,{sx:oe=>({border:`1px solid ${oe.palette.divider}`,borderRadius:"8px",padding:"16px",fontFamily:"monospace",fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:oe.palette.background.paper,color:oe.palette.text.primary}),children:h.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:T}})})})]}),h.jsxs(Yf,{open:v,onClose:()=>x(!1),maxWidth:"lg",fullWidth:!0,children:[h.jsxs(Gf,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Embeddable Code",h.jsx(eo,{onClick:()=>x(!1),sx:{color:"text.secondary"},children:h.jsx(Jf,{})})]}),h.jsx(Kf,{children:h.jsxs(fr,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"flex-start"},children:[h.jsx(Lt,{component:"div",sx:{fontSize:"12px",fontFamily:"monospace","& .line":{textWrap:"wrap"},flex:1},dangerouslySetInnerHTML:{__html:R}}),h.jsx(Ui,{title:"Copy Embeddable Code",children:h.jsx(eo,{sx:{width:"24px",height:"24px",marginLeft:"8px",color:"text.secondary"},onClick:()=>{navigator.clipboard.writeText(ne)},children:h.jsx(fpe,{})})})]})})]}),h.jsx(WL,{open:w,onClose:()=>S(!1),result:e.result||"",title:"Results",drill:F}),s&&!e.result&&!e.error&&!te&&!(e.newSources&&e.newSources.length>0)&&h.jsx(um,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:h.jsx(sg,{size:32})}),!e.result&&e.error&&h.jsxs(um,{sx:{p:2},children:[h.jsx(Lt,{variant:"body2",sx:{color:"error.main"},children:"This cell could not be run."}),h.jsx(Lt,{variant:"body2",component:"pre",sx:{color:"text.secondary",whiteSpace:"pre-wrap",m:0,mt:1},children:e.error})]}),e.result&&l&&h.jsx(JW,{"aria-label":"a re-run is pending",sx:{mb:1,height:2,borderRadius:1}}),e.result&&h.jsxs(um,{sx:{position:"relative"},children:[h.jsx(Kt,{sx:{paddingTop:"24px"},children:h.jsx(Ak,{result:e.result,maxHeight:Fce,maxResultSize:a,drill:F})}),_,h.jsxs(fr,{sx:{position:"absolute",top:"-12px",right:"8px",flexDirection:"row",gap:"8px",alignItems:"center",zIndex:2},children:[!t&&h.jsx(Uf,{"aria-label":"Malloy code",onClick:oe=>{oe.stopPropagation(),b(!0)},children:h.jsx(dpe,{})}),h.jsx(Uf,{"aria-label":"Expand results",onClick:()=>S(!0),children:h.jsx(lb,{})})]})]})]})}const mpe=4,gpe=400;function ype(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 vpe({resourceUri:e,maxResultSize:t=0,givens:n,onGivensChange:r,onNavigate:o,onDrillNavigate:a}){const{apiClients:s}=zr(),{environmentName:l,packageName:d,versionId:f,modelPath:c}=xo(e),{data:m,isSuccess:y,isError:b,error:v}=co({queryKey:[e],queryFn:async()=>(await s.notebooks.getNotebook(l,d,c,f)).data}),[x,w]=C.useState([]),[S,T]=C.useState(!1),[M,R]=C.useState(!1),$=C.useRef(void 0),[P,N]=C.useState(null),V=upe(m),z=m?.autorun!==!1,W=JN({specs:V,loaded:y,startingValues:m?.startingGivens,params:n,onGivensChange:r,documentKey:e,autorun:z,environmentName:l,packageName:d,modelPath:c,versionId:f,documentName:c}),{applied:H,declaredTypes:k,canSelf:I,onSelf:F}=W,_=C.useCallback(pe=>{const oe=c0(pe,k);return Object.keys(oe).length>0?JSON.stringify(oe):void 0},[k]),j=C.useRef(0),X=C.useRef(null),Q=C.useRef(null),te=C.useRef(void 0);C.useEffect(()=>()=>{X.current?.abort(),Q.current=null,clearTimeout(te.current?.timer),te.current=void 0},[]);const Z=C.useCallback(async(pe=new Map)=>{if(!y||!m?.notebookCells)return;const oe=++j.current;X.current?.abort();const ae=new AbortController;X.current=ae,w(m.notebookCells.map(ge=>({...ge}))),T(!0),N(null);const ce=_(pe);try{const ge=[];for(let we=0;we<m.notebookCells.length;we++){const Ce=m.notebookCells[we];if(Ce.type==="markdown")continue;const $e=we,de=async()=>{try{const ke=await s.notebooks.executeNotebookCell(l,d,c,$e,f,void 0,void 0,ce,{signal:ae.signal});if(j.current!==oe)return;const et=ke.data,ze=et.result,Ae=Ce.newSources||et.newSources;w(le=>{const bt=[...le];return bt[$e]||(bt[$e]={...Ce}),bt[$e]={...bt[$e],result:ze,newSources:Ae},bt})}catch(ke){if(ae.signal.aborted||j.current!==oe)return;console.error(`Error executing cell ${$e}:`,ke);const et=ype(ke);w(ze=>{const Ae=[...ze];return Ae[$e]||(Ae[$e]={...Ce}),Ae[$e]={...Ae[$e],error:et},Ae})}};ge.push(de)}const ye=[];for(const we of ge){const Ce=we().then(()=>{ye.splice(ye.indexOf(Ce),1)});ye.push(Ce),ye.length>=mpe&&await Promise.race(ye)}await Promise.all(ye)}catch(ge){if(ae.signal.aborted||j.current!==oe)return;console.error("Error executing notebook cells:",ge),N(ge)}finally{j.current===oe&&(T(!1),X.current=null)}},[y,m,_,l,d,c,f,s.notebooks]),G=C.useRef(0),ne=C.useRef(void 0);ne.current!==m&&(ne.current=m,G.current+=1);const se=G.current;return C.useEffect(()=>{const pe=`${e}|${se}`,oe=`${pe}|${_(H)??""}`;$.current!==void 0&&$.current!==pe&&(X.current?.abort(),X.current=null),$.current=pe;const ae=cpe({ready:y&&!!m?.notebookCells,lastRunKey:Q.current,pendingKey:te.current?.key,runKey:oe,documentKey:pe});if(ae.cancelPending&&(clearTimeout(te.current?.timer),te.current=void 0,R(!1)),ae.dispatch==="none")return;const ce=()=>{te.current=void 0,R(!1),Q.current=oe,Z(H)};if(ae.dispatch==="now"){ce();return}R(!0),te.current={key:oe,timer:setTimeout(ce,gpe)}},[y,m,se,e,H,_,Z]),h.jsx(MK,{children:h.jsx(EK,{children:h.jsxs(fr,{spacing:3,component:"section",children:[h.jsx(xL,{...W.panel}),!y&&!b&&h.jsx(oa,{text:"Fetching Notebook..."}),y&&(x.length>0?x:m?.notebookCells||[]).map((pe,oe)=>h.jsx(hpe,{cell:pe,index:oe,resourceUri:e,maxResultSize:t,isExecuting:S,pendingRerun:M,onNavigate:o,onDrillNavigate:a,onDrillSelf:V.length>0?F:void 0,canDrillSelf:I},oe)),b&&v.status===404&&h.jsxs(Lt,{variant:"body2",sx:{color:"text.secondary"},children:[h.jsx("code",{children:`${l} > ${d} > ${c}`})," ","not found."]}),b&&v.status!==404&&h.jsx(ha,{error:v,context:`${l} > ${d} > ${c}`}),P&&h.jsx(ha,{error:{message:P.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})})})}const bpe=cr(h.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"}));function xpe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function Spe({title:e,modelPath:t,source:n,view:r}){const o=`${n}_tiles`,a=`${r}_tile`;return["##! experimental.givens",`## artifact { title=${`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`} tiles=["${o} -> ${a}"] } dashboard { columns=12 }`,`import { ${n} } from "../${t}"`,"",`source: ${o} is ${n} extend {`," # colspan=6",` view: ${a} is ${r}`,"}",""].join(`
|
|
442
|
-
`)}function wpe({open:e,environmentName:t,packageName:n,models:r,existing:o,onClose:a,onCreated:s}){const{apiClients:l}=zr(),[d,f]=C.useState(""),[c,m]=C.useState(""),[y,b]=C.useState(""),[v,x]=C.useState(!1),[w,S]=C.useState(!1),[T,M]=C.useState(void 0),R=co({queryKey:["new-dashboard-models",t,n,r],queryFn:async()=>await Promise.all(r.map(async k=>{try{const I=await l.models.getModel(t,n,k);return{path:k,sources:I.data.sources??[]}}catch{return{path:k,sources:[]}}})),enabled:e&&r.length>0}),$=C.useMemo(()=>{const k=new Map;for(const I of R.data??[]){const F=[];for(const _ of I.sources)if(typeof _.name=="string")for(const j of _.views??[])typeof j.name=="string"&&F.push({source:_.name,view:j.name});F.length>0&&k.set(I.path,F)}return k},[R.data]),P=C.useMemo(()=>$.get(d)??[],[$,d]),N=P.find(k=>`${k.source}::${k.view}`===c);C.useEffect(()=>{if(!e)return;const k=[...$.keys()];d===""&&k.length>0&&f(k[0])},[e,$,d]),C.useEffect(()=>{!e||P.length===0||N===void 0&&m(`${P[0].source}::${P[0].view}`)},[e,P,N]),C.useEffect(()=>{!e||v||N===void 0||b(N.view.replace(/_/g," "))},[e,v,N]),C.useEffect(()=>{e||(f(""),m(""),b(""),x(!1),M(void 0))},[e]);const V=xpe(y),z=o.includes(V),W=N!==void 0&&V!==""&&!z,H=async()=>{if(!(!W||N===void 0)){S(!0),M(void 0);try{await l.models.updateModelSource(t,n,`dashboards/${V}.malloy`,{source:Spe({title:y,modelPath:d,source:N.source,view:N.view})}),s(V)}catch(k){const I=k.response?.data?.message;M(I??(k instanceof Error?k.message:String(k)))}finally{S(!1)}}};return h.jsx(aa,{open:e,onClose:a,title:"New dashboard",description:"A dashboard is a Malloy file in the package. Pick what its first tile shows; the rest is the builder.",actions:h.jsxs(h.Fragment,{children:[h.jsx(Ko,{onClick:a,disabled:w,children:"Cancel"}),h.jsx(Ko,{variant:"contained",disabled:!W||w,onClick:()=>void H(),children:"Create dashboard"})]}),children:h.jsxs(fr,{sx:{gap:2,pt:1},children:[R.isSuccess&&$.size===0&&h.jsx($c,{severity:"info",children:"A dashboard starts from a view of a source, and no model in this package declares one yet. Add a view to a source and this list fills in."}),h.jsx(ii,{select:!0,size:"small",label:"Model",value:d,disabled:$.size===0,onChange:k=>{f(k.target.value),m("")},inputProps:{"aria-label":"Model"},helperText:R.isLoading?"Reading the package's models…":$.size===1?"The only model with a view to put on a tile.":"Models with a view to put on a tile.",children:[...$.keys()].map(k=>h.jsx(Ii,{value:k,children:k},k))}),h.jsx(ii,{select:!0,size:"small",label:"First tile",value:N?c:"",disabled:P.length===0,onChange:k=>m(k.target.value),inputProps:{"aria-label":"First tile"},helperText:P.length===1?"The only view this model offers; more tiles are added in the builder.":"A view of a source; more tiles are added in the builder.",children:P.map(k=>h.jsxs(Ii,{value:`${k.source}::${k.view}`,children:[k.source," → ",k.view]},`${k.source}::${k.view}`))}),h.jsx(ii,{size:"small",label:"Title",value:y,onChange:k=>{x(!0),b(k.target.value)},inputProps:{"aria-label":"Dashboard title"},error:z,helperText:z?`dashboards/${V}.malloy already exists in this package.`:V?`Written as dashboards/${V}.malloy, and opened in the builder.`:"Names the file too."}),T&&h.jsx($c,{severity:"error",children:T})]})})}const Cpe={dashboard:_r.blue,report:_r.violet,model:_r.cyan,dataApp:_r.pink,data:_r.lime,materialization:_r.amber};function kpe({type:e,size:t=18,sx:n,...r}){return h.jsx(Yv,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:Tpe[e]()})}const Tpe={report:Mpe,model:Epe,data:Ope,materialization:Rpe,dataApp:Ppe,dashboard:$pe};function Mpe(){return h.jsxs(h.Fragment,{children:[h.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"}),h.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),h.jsx("path",{d:"M8 17 v-3"}),h.jsx("path",{d:"M12 17 v-6"}),h.jsx("path",{d:"M16 17 v-4"})]})}function Epe(){return h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),h.jsx("path",{d:"M4 7 l8 4 l8 -4"}),h.jsx("path",{d:"M12 11 v10"})]})}function Ope(){return h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),h.jsx("path",{d:"M3.5 9.5 H20.5"}),h.jsx("path",{d:"M9.5 3.5 V20.5"})]})}function Rpe(){return h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 3 L21 7.5 L12 12 L3 7.5 Z"}),h.jsx("path",{d:"M3 12 L12 16.5 L21 12"}),h.jsx("path",{d:"M3 16.5 L12 21 L21 16.5"})]})}function $pe(){return h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),h.jsx("path",{d:"M3.5 9.5 H20.5"}),h.jsx("path",{d:"M12 9.5 V20.5"}),h.jsx("path",{d:"M12 15 H20.5"})]})}function Ppe(){return h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),h.jsx("path",{d:"M3.5 9.5 H20.5"}),h.jsx("path",{d:"M7 13.5 H17"}),h.jsx("path",{d:"M7 16.5 H13"})]})}const SD="README.malloynb";function Khe({onClickPackageFile:e,resourceUri:t}){const{apiClients:n,server:r,mutable:o}=zr(),a=dd(),s=e??(G=>{window.location.href=G}),{environmentName:l,packageName:d,versionId:f}=xo(t),[c,m]=C.useState(null),[y,b]=C.useState(!1),v=Gue()?.documentStorage,[x,w]=C.useState([]),S=`${l}/${d}/dashboards/`,T=C.useCallback(async()=>{if(!v)return;const G=await v.listWorkspaces(!0),ne=[];for(const se of G)for(const pe of await v.listDocuments(se,"dashboard"))pe.path.startsWith(S)&&ne.push({locator:pe,where:se.description});w(ne)},[v,S]);C.useEffect(()=>{T()},[T]);const M=G=>G.path.slice(S.length).replace(/\.malloy$/,""),R=co({queryKey:["package",l,d,f],queryFn:()=>n.packages.getPackage(l,d,f,!1)}),$=co({queryKey:["notebooks",l,d,f],queryFn:()=>n.notebooks.listNotebooks(l,d,f)}),P=co({queryKey:["models",l,d,f],queryFn:()=>n.models.listModels(l,d,f)}),N=co({queryKey:["databases",l,d,f],queryFn:()=>n.databases.listDatabases(l,d,f)}),V=co({queryKey:["data-apps",l,d],queryFn:async()=>{try{return await n.dataApps.listDataApps(l,d)}catch(G){const ne=G?.response?.status;if(ne===404||ne===void 0)return{data:[]};throw G}}}).data?.data??[],z=co({queryKey:["dashboards",l,d,f],queryFn:async()=>{try{return await n.dashboards.listDashboards(l,d,f)}catch(G){const ne=G?.response?.status;if(ne===404||ne===void 0)return{data:[]};throw G}}}),W=G=>G.title&&G.title!==G.name?G.title:G.name??"",H=G=>G.title&&G.title!==G.path?G.title:G.path??"",k=(z.data?.data??[]).slice().sort((G,ne)=>W(G).localeCompare(W(ne))),I=($.data?.data??[]).slice().sort((G,ne)=>H(G).localeCompare(H(ne))),F=new Set(k.map(G=>G.path).filter(G=>G!==void 0)),_=(P.data?.data??[]).slice().filter(G=>!F.has(G.path)).sort((G,ne)=>G.path.localeCompare(ne.path)),j=(N.data?.data??[]).slice().sort((G,ne)=>G.path.localeCompare(ne.path)),X=R.data?.data?.description??"",Q=I.some(G=>G.path===SD),te=u0({environmentName:l,packageName:d,versionId:f,modelPath:SD}),Z=!$.isSuccess&&!$.isError||!z.isSuccess&&!z.isError;return R.isError?h.jsx(ha,{error:R.error,context:`${l} > ${d}`}):h.jsxs(kC,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[h.jsxs(Kt,{sx:{mb:4},children:[h.jsx(EL,{label:l,onClick:G=>s(`/${l}/`,G)}),h.jsx(Lt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:d}),X&&h.jsx(Lt,{variant:"body2",color:"text.secondary",children:X})]}),Z&&h.jsx(oa,{text:"Loading package..."}),h.jsx(wpe,{open:y,environmentName:l,packageName:d,models:_.map(G=>G.path).filter(G=>typeof G=="string"&&G.endsWith(".malloy")&&!G.startsWith("dashboards/")),existing:k.map(G=>G.name).filter(G=>typeof G=="string"),onClose:()=>b(!1),onCreated:G=>{b(!1),a.invalidateQueries({queryKey:["dashboards"]}),s(`/${l}/${d}/dashboards/${encodeURIComponent(G)}/edit`)}}),!Z&&h.jsxs(h.Fragment,{children:[z.isError&&h.jsx(Kt,{sx:{mb:4},children:h.jsx($c,{severity:"warning",children:"Could not list this package's dashboards, so any it has are missing from this page."})}),(k.length>0||o)&&h.jsxs(us,{title:"Dashboards",count:k.length,action:o?h.jsx(xg,{label:"Dashboard",onClick:()=>b(!0)}):void 0,children:[k.length===0&&h.jsx(oS,{label:"No dashboards yet"}),k.map(G=>{const ne=!!G.title&&G.title!==G.name;return h.jsx(kf,{type:"dashboard",label:ne?G.title:G.name,rightLabel:ne?G.name:void 0,onClick:se=>s(`/${l}/${d}/dashboards/`+encodeURIComponent(G.name??""),se)},G.name)})]}),x.length>0&&h.jsx(us,{title:"Drafts",count:x.length,children:x.map(({locator:G,where:ne})=>h.jsx(kf,{type:"dashboard",label:M(G),rightLabel:ne,onClick:se=>s(`/${l}/${d}/dashboards/${encodeURIComponent(M(G))}/edit`,se),trailingAction:h.jsx(Ui,{title:"Delete this draft",children:h.jsx(eo,{size:"small","aria-label":`Delete draft ${M(G)}`,onClick:se=>{se.stopPropagation(),v?.deleteDocument(G).then(T)},children:h.jsx(bpe,{fontSize:"small"})})})},G.path))}),I.length>0&&h.jsx(us,{title:"Notebooks",count:I.length,children:I.map(G=>{const ne=!!G.title&&G.title!==G.path;return h.jsx(kf,{type:"report",label:ne?G.title:G.path,rightLabel:ne?G.path:void 0,onClick:se=>s(`/${l}/${d}/${G.path}`,se)},G.path)})}),V.length>0&&h.jsx(us,{title:"Data Apps",count:V.length,children:V.map(G=>{const ne=!!G.title&&G.title!==G.path,se=`${RL(r)}${G.resource}`;return h.jsx(kf,{type:"dataApp",label:ne?G.title:G.path,rightLabel:ne?G.path:void 0,onClick:pe=>{e?e(`/${l}/${d}/data-apps/${G.path}`,pe):pe&&(pe.metaKey||pe.ctrlKey)?window.open(se,"_blank"):window.location.href=se},trailingAction:h.jsx(Ui,{title:"Open standalone in new tab",children:h.jsx(eo,{size:"small",href:se,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",onClick:pe=>pe.stopPropagation(),sx:{color:"text.secondary"},children:h.jsx(OL,{fontSize:"small"})})})},G.path)})}),h.jsxs(us,{title:"Semantic Models",count:_.length,children:[_.map(G=>h.jsx(kf,{type:"model",label:G.path,onClick:ne=>s(`/${l}/${d}/${G.path}`,ne)},G.path)),_.length===0&&h.jsx(oS,{label:"No models"})]}),h.jsxs(us,{title:"Package Data",count:j.length,children:[j.map(G=>h.jsx(kf,{type:"data",label:G.path,rightLabel:G.info?Dpe(G.info.rowCount):"Unreadable",onClick:()=>m(G)},G.path)),j.length===0&&h.jsx(oS,{label:"No data files"})]}),h.jsx(tpe,{resourceUri:t}),Q&&h.jsx(Kt,{sx:{mt:6},children:h.jsx(vpe,{resourceUri:te,onNavigate:s})})]}),h.jsxs(aa,{open:c!==null,onClose:()=>m(null),title:c?.path??"Columns",showClose:!0,children:[c?.error&&h.jsx(Lt,{variant:"body2",color:"error",children:c.error}),c?.info?.columns&&h.jsxs(ug,{size:"small",children:[h.jsx(fg,{children:h.jsxs(Zs,{children:[h.jsx(Xn,{children:"Column"}),h.jsx(Xn,{children:"Type"})]})}),h.jsx(dg,{children:c.info.columns.map(G=>h.jsxs(Zs,{children:[h.jsx(Xn,{component:"th",scope:"row",children:G.name}),h.jsx(Xn,{children:G.type})]},G.name))})]})]})]})}function kf({type:e,label:t,rightLabel:n,onClick:r,trailingAction:o}){return h.jsx(C0,{icon:h.jsx(kpe,{type:e}),tint:Cpe[e],label:t,mono:!0,...n===void 0?{}:{rightLabel:n},...r===void 0?{}:{onClick:r},...o===void 0?{}:{trailingAction:o}})}function oS({label:e}){return h.jsx(Lt,{variant:"body2",color:"text.secondary",sx:{py:1,fontStyle:"italic"},children:e})}function Dpe(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 Dw={name:"Local",description:"Stored in this browser only",writeable:!0},Aw="publisher:document:";class Ape{async listWorkspaces(t){return[Dw]}async listDocuments(t,n){if(t.name!==Dw.name)return[];const r=[];for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o),s=a===null?void 0:jpe(a);s&&(n===void 0||s.type===n)&&r.push(s)}return r}async getDocument(t){const n=localStorage.getItem(om(t));if(n===null)throw wD(t);return n}async saveDocument(t,n){localStorage.setItem(om(t),n)}async deleteDocument(t){const n=om(t);if(localStorage.getItem(n)===null)throw wD(t);localStorage.removeItem(n)}async moveDocument(t,n){const r=await this.getDocument(t);localStorage.setItem(om(n),r),localStorage.removeItem(om(t))}}function om(e){return`${Aw}${e.type}:${e.path}`}function jpe(e){if(!e.startsWith(Aw))return;const t=e.slice(Aw.length),n=t.indexOf(":");if(n<=0)return;const r=t.slice(0,n);if(!(r!=="dashboard"&&r!=="notebook"))return{workspace:Dw.name,type:r,path:t.slice(n+1)}}function wD(e){return new ML(`No ${e.type} at ${e.workspace}/${e.path}`)}const CD="[publisher.dashboard]",kD="[publisher.console]";function Ghe(e){return t=>{const n=t.type.endsWith("_refused")||t.type==="dashboard.rows_shown"&&!t.ok,r={...e,...t,at:new Date().toISOString()};n?console.warn(CD,r):console.info(CD,r)}}function Npe(e){const t={...e,at:new Date().toISOString()};e.ok?console.info(kD,t):console.warn(kD,t)}const Co={white:"#FFFFFF",offWhite:"#F8FAFC",grey:{light:"#E2E8F0",mid:"#64748B"},black:"#0F172A",semantic:{success:{main:_r.emerald,light:"#D1FAE5",dark:"#047857"},warning:{main:_r.amber,light:"#FEF3C7",dark:"#92400E"},error:{main:_r.red,light:"#FEE2E2",dark:"#B91C1C"},info:{main:_r.blue,light:"#DBEAFE",dark:"#1D4ED8"}}},Qhe='"JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", monospace',ov='"Inter", "Helvetica Neue", "Arial", sans-serif',Wo={50:Co.offWhite,100:"#F1F5F9",200:Co.grey.light,300:"#CBD5E1",400:"#94A3B8",500:Co.grey.mid,600:"#475569",700:"#334155",800:"#1E293B",900:Co.black},Xhe={headerHeight:56},aS="0 1px 3px rgba(0, 0, 0, 0.1)",Ipe="#0f172a",Lpe="#1e293b",zpe="#f1f5f9",Fpe="#cbd5e1",Bpe="#334155",qL=(e="light")=>{const t=e==="dark",n=t?Ipe:Co.white,r=t?Lpe:Co.white,o=t?zpe:Co.black,a=t?Fpe:Co.grey.mid,s=t?Bpe:Co.grey.light,l=t?"#60a5fa":_r.blue,d=t?"#93c5fd":"#1d4ed8",f=t?"#0f172a":"#ffffff";return Rb({cssVariables:{nativeColor:!0},palette:{mode:e,primary:{main:l,light:Co.grey.light,dark:d,contrastText:f},secondary:{main:Co.grey.mid,light:Co.grey.light,dark:Co.black},grey:Wo,success:Co.semantic.success,warning:Co.semantic.warning,error:Co.semantic.error,info:Co.semantic.info,background:{default:n,paper:r},text:{primary:o,secondary:a},divider:s},typography:{fontFamily:ov,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:4},components:{MuiButtonBase:{defaultProps:{disableRipple:!0,disableTouchRipple:!0}},MuiCssBaseline:{styleOverrides:{"*":{scrollbarWidth:"thin",scrollbarColor:t?"#475569 #1e293b":`${Wo[300]} ${Wo[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:t?"#1e293b":Wo[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:t?"#475569":Wo[300],borderRadius:"4px","&:hover":{background:t?"#64748b":Wo[400]}},"&::-webkit-scrollbar-corner":{background:t?"#1e293b":Wo[100]}},"div[data-radix-popper-content-wrapper]":{zIndex:"1300 !important"}}},MuiButton:{styleOverrides:{root:{borderRadius:20,textTransform:"none",fontWeight:500,boxShadow:"none","&:hover":{boxShadow:aS}},contained:{"&:hover":{boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"},"&.Mui-disabled":{backgroundColor:t?"rgba(255, 255, 255, 0.06)":Wo[200],color:t?"#64748b":Wo[500]}},outlined:{color:o,borderColor:t?"#475569":Wo[300],"&:hover":{borderColor:t?"#64748b":Wo[400],backgroundColor:t?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"}}}},MuiCard:{styleOverrides:{root:{borderRadius:4,boxShadow:aS,border:"1px solid",borderColor:s,backgroundColor:r}}},MuiChip:{styleOverrides:{root:{borderRadius:4,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:4},"& .MuiInputLabel-outlined":{backgroundColor:r,paddingLeft:4,paddingRight:4,"&.MuiInputLabel-shrink":{transform:"translate(14px, -9px) scale(0.75)"}}}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}},MuiDialog:{styleOverrides:{paper:{borderRadius:4,backgroundColor:r,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:ov,fontSize:"0.875rem",color:o}}},MuiInputLabel:{styleOverrides:{root:{"&.MuiInputLabel-outlined":{backgroundColor:r,paddingLeft:4,paddingRight:4}}}},MuiOutlinedInput:{styleOverrides:{notchedOutline:{border:"none"},root:{border:`1px solid ${t?Wo[600]:Wo[300]}`,borderRadius:8,transition:"border-color 120ms ease-in",backgroundColor:r,"&:hover":{borderColor:t?"#64748b":Wo[400]},"&.Mui-focused":{borderColor:t?Wo[400]:Wo[500],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:ov,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:ov}}},MuiMenu:{styleOverrides:{paper:{borderRadius:4,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:r,color:o}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:Wo[400]}}}},MuiDivider:{styleOverrides:{root:{borderColor:s}},defaultProps:{sx:{my:1}}},MuiListItemButton:{styleOverrides:{root:{borderRadius:28,margin:"2px 8px",padding:"8px 16px","&:hover":{backgroundColor:t?"rgba(255, 255, 255, 0.08)":Co.offWhite},"&.Mui-selected":{backgroundColor:t?"rgba(255, 255, 255, 0.12)":Co.offWhite,color:o,"& .MuiListItemIcon-root":{color:o},"& .MuiListItemText-primary":{color:o},"&:hover":{backgroundColor:t?"rgba(255, 255, 255, 0.16)":Co.grey.light}}}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:r,color:o,boxShadow:aS}}}}})};qL("light");function Upe({children:e}){const{mode:t}=ol(),n=C.useMemo(()=>qL(t),[t]);return h.jsxs(kU,{theme:n,children:[h.jsx(C8,{}),e]})}const _pe=C.lazy(()=>Lo(()=>import("./HomePage-DDyGPzmK.js"),[])),Vpe=C.lazy(()=>Lo(()=>import("./MainPage-BHleF-Kb.js"),__vite__mapDeps([9,10]))),Hpe=C.lazy(()=>Lo(()=>import("./ModelPage-Cgw-SbZi.js"),[])),Wpe=C.lazy(()=>Lo(()=>import("./PackagePage-Cy0c37D0.js"),[])),qpe=C.lazy(()=>Lo(()=>import("./EnvironmentPage-C4IrQrKG.js"),[])),Ype=C.lazy(()=>Lo(()=>import("./RouteError-DBMc9ccU.js"),[])),Kpe=C.lazy(()=>Lo(()=>import("./ThemeEditorPage-ByJlsmNu.js"),__vite__mapDeps([11,10,12]))),Gpe=(e="/",t=new Ape,n)=>(mde(Npe),y4([{path:e,element:h.jsx(fG,{children:h.jsx(Kue,{documentStorage:t,children:h.jsx(Upe,{children:h.jsx(C.Suspense,{fallback:h.jsx(oa,{}),children:h.jsx(Vpe,{headerProps:n})})})})}),errorElement:h.jsx(Ype,{}),children:[{index:!0,element:h.jsx(_pe,{})},{path:"settings/theme",element:h.jsx(Kpe,{})},{path:"settings",element:h.jsx(qF,{to:"/settings/theme",replace:!0})},{path:":environmentName",element:h.jsx(qpe,{})},{path:":environmentName/:packageName",element:h.jsx(Wpe,{})},{path:":environmentName/:packageName/*",element:h.jsx(Hpe,{})}]}])),Qpe=Gpe("/");g5.createRoot(document.getElementById("root")).render(h.jsx(C.StrictMode,{children:h.jsx($4,{router:Qpe})}));export{kc as $,Dn as A,Xu as B,tt as C,ma as D,Ys as E,ol as F,Ui as G,eg as H,eo as I,tl as J,Zpe as K,Kt as L,uj as M,rj as N,RC as O,Na as P,_he as Q,Pm as R,xS as S,Lt as T,zr as U,Bj as V,pj as W,dp as X,Kc as Y,Xhe as Z,Jpe as _,ja as a,lue as a$,oa as a0,Vhe as a1,Ghe as a2,EL as a3,Ahe as a4,Sg as a5,Bhe as a6,u0 as a7,Lo as a8,pn as a9,wL as aA,jhe as aB,zhe as aC,Nhe as aD,Lhe as aE,Lce as aF,Ihe as aG,Rc as aH,pb as aI,Yi as aJ,SG as aK,TD as aL,Wce as aM,FP as aN,que as aO,Kce as aP,xo as aQ,Gue as aR,co as aS,Uhe as aT,ha as aU,Yue as aV,Bue as aW,qce as aX,tk as aY,cr as aZ,Bc as a_,fr as aa,vpe as ab,Hhe as ac,Yhe as ad,Jue as ae,Qhe as af,a9 as ag,Khe as ah,Whe as ai,zF as aj,kC as ak,KO as al,ii as am,C9 as an,pN as ao,yR as ap,Ii as aq,dd as ar,G7 as as,$c as at,qH as au,QH as av,Fb as aw,aa as ax,Ko as ay,PK as az,ln as b,cue as b0,g8 as b1,MC as b2,Sj as b3,JN as b4,$P as b5,zce as b6,RP as b7,xL as b8,Fhe as b9,OH as ba,Lue as bb,Fm as bc,Ir as bd,Xpe as be,Ia as c,an as d,gS as e,qhe as f,VB as g,cn as h,zs as i,h as j,Pt as k,sn as l,Jt as m,Wc as n,nl as o,po as p,ld as q,C as r,ot as s,Nl as t,eC as u,LA as v,Nv as w,_A as x,ig as y,zA as z};
|
|
442
|
+
`)}function wpe({open:e,environmentName:t,packageName:n,models:r,existing:o,onClose:a,onCreated:s}){const{apiClients:l}=zr(),[d,f]=C.useState(""),[c,m]=C.useState(""),[y,b]=C.useState(""),[v,x]=C.useState(!1),[w,S]=C.useState(!1),[T,M]=C.useState(void 0),R=co({queryKey:["new-dashboard-models",t,n,r],queryFn:async()=>await Promise.all(r.map(async k=>{try{const I=await l.models.getModel(t,n,k);return{path:k,sources:I.data.sources??[]}}catch{return{path:k,sources:[]}}})),enabled:e&&r.length>0}),$=C.useMemo(()=>{const k=new Map;for(const I of R.data??[]){const F=[];for(const _ of I.sources)if(typeof _.name=="string")for(const j of _.views??[])typeof j.name=="string"&&F.push({source:_.name,view:j.name});F.length>0&&k.set(I.path,F)}return k},[R.data]),P=C.useMemo(()=>$.get(d)??[],[$,d]),N=P.find(k=>`${k.source}::${k.view}`===c);C.useEffect(()=>{if(!e)return;const k=[...$.keys()];d===""&&k.length>0&&f(k[0])},[e,$,d]),C.useEffect(()=>{!e||P.length===0||N===void 0&&m(`${P[0].source}::${P[0].view}`)},[e,P,N]),C.useEffect(()=>{!e||v||N===void 0||b(N.view.replace(/_/g," "))},[e,v,N]),C.useEffect(()=>{e||(f(""),m(""),b(""),x(!1),M(void 0))},[e]);const V=xpe(y),z=o.includes(V),W=N!==void 0&&V!==""&&!z,H=async()=>{if(!(!W||N===void 0)){S(!0),M(void 0);try{await l.models.updateModelSource(t,n,`dashboards/${V}.malloy`,{source:Spe({title:y,modelPath:d,source:N.source,view:N.view})}),s(V)}catch(k){const I=k.response?.data?.message;M(I??(k instanceof Error?k.message:String(k)))}finally{S(!1)}}};return h.jsx(aa,{open:e,onClose:a,title:"New dashboard",description:"A dashboard is a Malloy file in the package. Pick what its first tile shows; the rest is the builder.",actions:h.jsxs(h.Fragment,{children:[h.jsx(Ko,{onClick:a,disabled:w,children:"Cancel"}),h.jsx(Ko,{variant:"contained",disabled:!W||w,onClick:()=>void H(),children:"Create dashboard"})]}),children:h.jsxs(fr,{sx:{gap:2,pt:1},children:[R.isSuccess&&$.size===0&&h.jsx($c,{severity:"info",children:"A dashboard starts from a view of a source, and no model in this package declares one yet. Add a view to a source and this list fills in."}),h.jsx(ii,{select:!0,size:"small",label:"Model",value:d,disabled:$.size===0,onChange:k=>{f(k.target.value),m("")},inputProps:{"aria-label":"Model"},helperText:R.isLoading?"Reading the package's models…":$.size===1?"The only model with a view to put on a tile.":"Models with a view to put on a tile.",children:[...$.keys()].map(k=>h.jsx(Ii,{value:k,children:k},k))}),h.jsx(ii,{select:!0,size:"small",label:"First tile",value:N?c:"",disabled:P.length===0,onChange:k=>m(k.target.value),inputProps:{"aria-label":"First tile"},helperText:P.length===1?"The only view this model offers; more tiles are added in the builder.":"A view of a source; more tiles are added in the builder.",children:P.map(k=>h.jsxs(Ii,{value:`${k.source}::${k.view}`,children:[k.source," → ",k.view]},`${k.source}::${k.view}`))}),h.jsx(ii,{size:"small",label:"Title",value:y,onChange:k=>{x(!0),b(k.target.value)},inputProps:{"aria-label":"Dashboard title"},error:z,helperText:z?`dashboards/${V}.malloy already exists in this package.`:V?`Written as dashboards/${V}.malloy, and opened in the builder.`:"Names the file too."}),T&&h.jsx($c,{severity:"error",children:T})]})})}const Cpe={dashboard:_r.blue,report:_r.violet,model:_r.cyan,dataApp:_r.pink,data:_r.lime,materialization:_r.amber};function kpe({type:e,size:t=18,sx:n,...r}){return h.jsx(Yv,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:Tpe[e]()})}const Tpe={report:Mpe,model:Epe,data:Ope,materialization:Rpe,dataApp:Ppe,dashboard:$pe};function Mpe(){return h.jsxs(h.Fragment,{children:[h.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"}),h.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),h.jsx("path",{d:"M8 17 v-3"}),h.jsx("path",{d:"M12 17 v-6"}),h.jsx("path",{d:"M16 17 v-4"})]})}function Epe(){return h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),h.jsx("path",{d:"M4 7 l8 4 l8 -4"}),h.jsx("path",{d:"M12 11 v10"})]})}function Ope(){return h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),h.jsx("path",{d:"M3.5 9.5 H20.5"}),h.jsx("path",{d:"M9.5 3.5 V20.5"})]})}function Rpe(){return h.jsxs(h.Fragment,{children:[h.jsx("path",{d:"M12 3 L21 7.5 L12 12 L3 7.5 Z"}),h.jsx("path",{d:"M3 12 L12 16.5 L21 12"}),h.jsx("path",{d:"M3 16.5 L12 21 L21 16.5"})]})}function $pe(){return h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),h.jsx("path",{d:"M3.5 9.5 H20.5"}),h.jsx("path",{d:"M12 9.5 V20.5"}),h.jsx("path",{d:"M12 15 H20.5"})]})}function Ppe(){return h.jsxs(h.Fragment,{children:[h.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),h.jsx("path",{d:"M3.5 9.5 H20.5"}),h.jsx("path",{d:"M7 13.5 H17"}),h.jsx("path",{d:"M7 16.5 H13"})]})}const SD="README.malloynb";function Khe({onClickPackageFile:e,resourceUri:t}){const{apiClients:n,server:r,mutable:o}=zr(),a=dd(),s=e??(G=>{window.location.href=G}),{environmentName:l,packageName:d,versionId:f}=xo(t),[c,m]=C.useState(null),[y,b]=C.useState(!1),v=Gue()?.documentStorage,[x,w]=C.useState([]),S=`${l}/${d}/dashboards/`,T=C.useCallback(async()=>{if(!v)return;const G=await v.listWorkspaces(!0),ne=[];for(const se of G)for(const pe of await v.listDocuments(se,"dashboard"))pe.path.startsWith(S)&&ne.push({locator:pe,where:se.description});w(ne)},[v,S]);C.useEffect(()=>{T()},[T]);const M=G=>G.path.slice(S.length).replace(/\.malloy$/,""),R=co({queryKey:["package",l,d,f],queryFn:()=>n.packages.getPackage(l,d,f,!1)}),$=co({queryKey:["notebooks",l,d,f],queryFn:()=>n.notebooks.listNotebooks(l,d,f)}),P=co({queryKey:["models",l,d,f],queryFn:()=>n.models.listModels(l,d,f)}),N=co({queryKey:["databases",l,d,f],queryFn:()=>n.databases.listDatabases(l,d,f)}),V=co({queryKey:["data-apps",l,d],queryFn:async()=>{try{return await n.dataApps.listDataApps(l,d)}catch(G){const ne=G?.response?.status;if(ne===404||ne===void 0)return{data:[]};throw G}}}).data?.data??[],z=co({queryKey:["dashboards",l,d,f],queryFn:async()=>{try{return await n.dashboards.listDashboards(l,d,f)}catch(G){const ne=G?.response?.status;if(ne===404||ne===void 0)return{data:[]};throw G}}}),W=G=>G.title&&G.title!==G.name?G.title:G.name??"",H=G=>G.title&&G.title!==G.path?G.title:G.path??"",k=(z.data?.data??[]).slice().sort((G,ne)=>W(G).localeCompare(W(ne))),I=($.data?.data??[]).slice().sort((G,ne)=>H(G).localeCompare(H(ne))),F=new Set(k.map(G=>G.path).filter(G=>G!==void 0)),_=(P.data?.data??[]).slice().filter(G=>!F.has(G.path)).sort((G,ne)=>G.path.localeCompare(ne.path)),j=(N.data?.data??[]).slice().sort((G,ne)=>G.path.localeCompare(ne.path)),X=R.data?.data?.description??"",Q=I.some(G=>G.path===SD),te=u0({environmentName:l,packageName:d,versionId:f,modelPath:SD}),Z=!$.isSuccess&&!$.isError||!z.isSuccess&&!z.isError;return R.isError?h.jsx(ha,{error:R.error,context:`${l} > ${d}`}):h.jsxs(kC,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[h.jsxs(Kt,{sx:{mb:4},children:[h.jsx(EL,{label:l,onClick:G=>s(`/${l}/`,G)}),h.jsx(Lt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:d}),X&&h.jsx(Lt,{variant:"body2",color:"text.secondary",children:X})]}),Z&&h.jsx(oa,{text:"Loading package..."}),h.jsx(wpe,{open:y,environmentName:l,packageName:d,models:_.map(G=>G.path).filter(G=>typeof G=="string"&&G.endsWith(".malloy")&&!G.startsWith("dashboards/")),existing:k.map(G=>G.name).filter(G=>typeof G=="string"),onClose:()=>b(!1),onCreated:G=>{b(!1),a.invalidateQueries({queryKey:["dashboards"]}),s(`/${l}/${d}/dashboards/${encodeURIComponent(G)}/edit`)}}),!Z&&h.jsxs(h.Fragment,{children:[z.isError&&h.jsx(Kt,{sx:{mb:4},children:h.jsx($c,{severity:"warning",children:"Could not list this package's dashboards, so any it has are missing from this page."})}),(k.length>0||o)&&h.jsxs(us,{title:"Dashboards",count:k.length,action:o?h.jsx(xg,{label:"Dashboard",onClick:()=>b(!0)}):void 0,children:[k.length===0&&h.jsx(oS,{label:"No dashboards yet"}),k.map(G=>{const ne=!!G.title&&G.title!==G.name;return h.jsx(kf,{type:"dashboard",label:ne?G.title:G.name,rightLabel:ne?G.name:void 0,onClick:se=>s(`/${l}/${d}/dashboards/`+encodeURIComponent(G.name??""),se)},G.name)})]}),x.length>0&&h.jsx(us,{title:"Drafts",count:x.length,children:x.map(({locator:G,where:ne})=>h.jsx(kf,{type:"dashboard",label:M(G),rightLabel:ne,onClick:se=>s(`/${l}/${d}/dashboards/${encodeURIComponent(M(G))}/edit`,se),trailingAction:h.jsx(Ui,{title:"Delete this draft",children:h.jsx(eo,{size:"small","aria-label":`Delete draft ${M(G)}`,onClick:se=>{se.stopPropagation(),v?.deleteDocument(G).then(T)},children:h.jsx(bpe,{fontSize:"small"})})})},G.path))}),I.length>0&&h.jsx(us,{title:"Notebooks",count:I.length,children:I.map(G=>{const ne=!!G.title&&G.title!==G.path;return h.jsx(kf,{type:"report",label:ne?G.title:G.path,rightLabel:ne?G.path:void 0,onClick:se=>s(`/${l}/${d}/${G.path}`,se)},G.path)})}),V.length>0&&h.jsx(us,{title:"Data Apps",count:V.length,children:V.map(G=>{const ne=!!G.title&&G.title!==G.path,se=`${RL(r)}${G.resource}`;return h.jsx(kf,{type:"dataApp",label:ne?G.title:G.path,rightLabel:ne?G.path:void 0,onClick:pe=>{e?e(`/${l}/${d}/data-apps/${G.path}`,pe):pe&&(pe.metaKey||pe.ctrlKey)?window.open(se,"_blank"):window.location.href=se},trailingAction:h.jsx(Ui,{title:"Open standalone in new tab",children:h.jsx(eo,{size:"small",href:se,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",onClick:pe=>pe.stopPropagation(),sx:{color:"text.secondary"},children:h.jsx(OL,{fontSize:"small"})})})},G.path)})}),h.jsxs(us,{title:"Semantic Models",count:_.length,children:[_.map(G=>h.jsx(kf,{type:"model",label:G.path,onClick:ne=>s(`/${l}/${d}/${G.path}`,ne)},G.path)),_.length===0&&h.jsx(oS,{label:"No models"})]}),h.jsxs(us,{title:"Package Data",count:j.length,children:[j.map(G=>h.jsx(kf,{type:"data",label:G.path,rightLabel:G.info?Dpe(G.info.rowCount):"Unreadable",onClick:()=>m(G)},G.path)),j.length===0&&h.jsx(oS,{label:"No data files"})]}),h.jsx(tpe,{resourceUri:t}),Q&&h.jsx(Kt,{sx:{mt:6},children:h.jsx(vpe,{resourceUri:te,onNavigate:s})})]}),h.jsxs(aa,{open:c!==null,onClose:()=>m(null),title:c?.path??"Columns",showClose:!0,children:[c?.error&&h.jsx(Lt,{variant:"body2",color:"error",children:c.error}),c?.info?.columns&&h.jsxs(ug,{size:"small",children:[h.jsx(fg,{children:h.jsxs(Zs,{children:[h.jsx(Xn,{children:"Column"}),h.jsx(Xn,{children:"Type"})]})}),h.jsx(dg,{children:c.info.columns.map(G=>h.jsxs(Zs,{children:[h.jsx(Xn,{component:"th",scope:"row",children:G.name}),h.jsx(Xn,{children:G.type})]},G.name))})]})]})]})}function kf({type:e,label:t,rightLabel:n,onClick:r,trailingAction:o}){return h.jsx(C0,{icon:h.jsx(kpe,{type:e}),tint:Cpe[e],label:t,mono:!0,...n===void 0?{}:{rightLabel:n},...r===void 0?{}:{onClick:r},...o===void 0?{}:{trailingAction:o}})}function oS({label:e}){return h.jsx(Lt,{variant:"body2",color:"text.secondary",sx:{py:1,fontStyle:"italic"},children:e})}function Dpe(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 Dw={name:"Local",description:"Stored in this browser only",writeable:!0},Aw="publisher:document:";class Ape{async listWorkspaces(t){return[Dw]}async listDocuments(t,n){if(t.name!==Dw.name)return[];const r=[];for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o),s=a===null?void 0:jpe(a);s&&(n===void 0||s.type===n)&&r.push(s)}return r}async getDocument(t){const n=localStorage.getItem(om(t));if(n===null)throw wD(t);return n}async saveDocument(t,n){localStorage.setItem(om(t),n)}async deleteDocument(t){const n=om(t);if(localStorage.getItem(n)===null)throw wD(t);localStorage.removeItem(n)}async moveDocument(t,n){const r=await this.getDocument(t);localStorage.setItem(om(n),r),localStorage.removeItem(om(t))}}function om(e){return`${Aw}${e.type}:${e.path}`}function jpe(e){if(!e.startsWith(Aw))return;const t=e.slice(Aw.length),n=t.indexOf(":");if(n<=0)return;const r=t.slice(0,n);if(!(r!=="dashboard"&&r!=="notebook"))return{workspace:Dw.name,type:r,path:t.slice(n+1)}}function wD(e){return new ML(`No ${e.type} at ${e.workspace}/${e.path}`)}const CD="[publisher.dashboard]",kD="[publisher.console]";function Ghe(e){return t=>{const n=t.type.endsWith("_refused")||t.type==="dashboard.rows_shown"&&!t.ok,r={...e,...t,at:new Date().toISOString()};n?console.warn(CD,r):console.info(CD,r)}}function Npe(e){const t={...e,at:new Date().toISOString()};e.ok?console.info(kD,t):console.warn(kD,t)}const Co={white:"#FFFFFF",offWhite:"#F8FAFC",grey:{light:"#E2E8F0",mid:"#64748B"},black:"#0F172A",semantic:{success:{main:_r.emerald,light:"#D1FAE5",dark:"#047857"},warning:{main:_r.amber,light:"#FEF3C7",dark:"#92400E"},error:{main:_r.red,light:"#FEE2E2",dark:"#B91C1C"},info:{main:_r.blue,light:"#DBEAFE",dark:"#1D4ED8"}}},Qhe='"JetBrains Mono", "ui-monospace", "SFMono-Regular", "Menlo", monospace',ov='"Inter", "Helvetica Neue", "Arial", sans-serif',Wo={50:Co.offWhite,100:"#F1F5F9",200:Co.grey.light,300:"#CBD5E1",400:"#94A3B8",500:Co.grey.mid,600:"#475569",700:"#334155",800:"#1E293B",900:Co.black},Xhe={headerHeight:56},aS="0 1px 3px rgba(0, 0, 0, 0.1)",Ipe="#0f172a",Lpe="#1e293b",zpe="#f1f5f9",Fpe="#cbd5e1",Bpe="#334155",qL=(e="light")=>{const t=e==="dark",n=t?Ipe:Co.white,r=t?Lpe:Co.white,o=t?zpe:Co.black,a=t?Fpe:Co.grey.mid,s=t?Bpe:Co.grey.light,l=t?"#60a5fa":_r.blue,d=t?"#93c5fd":"#1d4ed8",f=t?"#0f172a":"#ffffff";return Rb({cssVariables:{nativeColor:!0},palette:{mode:e,primary:{main:l,light:Co.grey.light,dark:d,contrastText:f},secondary:{main:Co.grey.mid,light:Co.grey.light,dark:Co.black},grey:Wo,success:Co.semantic.success,warning:Co.semantic.warning,error:Co.semantic.error,info:Co.semantic.info,background:{default:n,paper:r},text:{primary:o,secondary:a},divider:s},typography:{fontFamily:ov,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:4},components:{MuiButtonBase:{defaultProps:{disableRipple:!0,disableTouchRipple:!0}},MuiCssBaseline:{styleOverrides:{"*":{scrollbarWidth:"thin",scrollbarColor:t?"#475569 #1e293b":`${Wo[300]} ${Wo[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:t?"#1e293b":Wo[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:t?"#475569":Wo[300],borderRadius:"4px","&:hover":{background:t?"#64748b":Wo[400]}},"&::-webkit-scrollbar-corner":{background:t?"#1e293b":Wo[100]}},"div[data-radix-popper-content-wrapper]":{zIndex:"1300 !important"}}},MuiButton:{styleOverrides:{root:{borderRadius:20,textTransform:"none",fontWeight:500,boxShadow:"none","&:hover":{boxShadow:aS}},contained:{"&:hover":{boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"},"&.Mui-disabled":{backgroundColor:t?"rgba(255, 255, 255, 0.06)":Wo[200],color:t?"#64748b":Wo[500]}},outlined:{color:o,borderColor:t?"#475569":Wo[300],"&:hover":{borderColor:t?"#64748b":Wo[400],backgroundColor:t?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"}}}},MuiCard:{styleOverrides:{root:{borderRadius:4,boxShadow:aS,border:"1px solid",borderColor:s,backgroundColor:r}}},MuiChip:{styleOverrides:{root:{borderRadius:4,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:4},"& .MuiInputLabel-outlined":{backgroundColor:r,paddingLeft:4,paddingRight:4,"&.MuiInputLabel-shrink":{transform:"translate(14px, -9px) scale(0.75)"}}}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}},MuiDialog:{styleOverrides:{paper:{borderRadius:4,backgroundColor:r,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:ov,fontSize:"0.875rem",color:o}}},MuiInputLabel:{styleOverrides:{root:{"&.MuiInputLabel-outlined":{backgroundColor:r,paddingLeft:4,paddingRight:4}}}},MuiOutlinedInput:{styleOverrides:{notchedOutline:{border:"none"},root:{border:`1px solid ${t?Wo[600]:Wo[300]}`,borderRadius:8,transition:"border-color 120ms ease-in",backgroundColor:r,"&:hover":{borderColor:t?"#64748b":Wo[400]},"&.Mui-focused":{borderColor:t?Wo[400]:Wo[500],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:ov,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:ov}}},MuiMenu:{styleOverrides:{paper:{borderRadius:4,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:r,color:o}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:Wo[400]}}}},MuiDivider:{styleOverrides:{root:{borderColor:s}},defaultProps:{sx:{my:1}}},MuiListItemButton:{styleOverrides:{root:{borderRadius:28,margin:"2px 8px",padding:"8px 16px","&:hover":{backgroundColor:t?"rgba(255, 255, 255, 0.08)":Co.offWhite},"&.Mui-selected":{backgroundColor:t?"rgba(255, 255, 255, 0.12)":Co.offWhite,color:o,"& .MuiListItemIcon-root":{color:o},"& .MuiListItemText-primary":{color:o},"&:hover":{backgroundColor:t?"rgba(255, 255, 255, 0.16)":Co.grey.light}}}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:r,color:o,boxShadow:aS}}}}})};qL("light");function Upe({children:e}){const{mode:t}=ol(),n=C.useMemo(()=>qL(t),[t]);return h.jsxs(kU,{theme:n,children:[h.jsx(C8,{}),e]})}const _pe=C.lazy(()=>Lo(()=>import("./HomePage-CN_FgmtD.js"),[])),Vpe=C.lazy(()=>Lo(()=>import("./MainPage-BcCyzakx.js"),__vite__mapDeps([9,10]))),Hpe=C.lazy(()=>Lo(()=>import("./ModelPage-wHHnxoih.js"),[])),Wpe=C.lazy(()=>Lo(()=>import("./PackagePage-DwdO-2dp.js"),[])),qpe=C.lazy(()=>Lo(()=>import("./EnvironmentPage-ufeWfqnK.js"),[])),Ype=C.lazy(()=>Lo(()=>import("./RouteError-Blt6a2Za.js"),[])),Kpe=C.lazy(()=>Lo(()=>import("./ThemeEditorPage-Cb-2YbfG.js"),__vite__mapDeps([11,10,12]))),Gpe=(e="/",t=new Ape,n)=>(mde(Npe),y4([{path:e,element:h.jsx(fG,{children:h.jsx(Kue,{documentStorage:t,children:h.jsx(Upe,{children:h.jsx(C.Suspense,{fallback:h.jsx(oa,{}),children:h.jsx(Vpe,{headerProps:n})})})})}),errorElement:h.jsx(Ype,{}),children:[{index:!0,element:h.jsx(_pe,{})},{path:"settings/theme",element:h.jsx(Kpe,{})},{path:"settings",element:h.jsx(qF,{to:"/settings/theme",replace:!0})},{path:":environmentName",element:h.jsx(qpe,{})},{path:":environmentName/:packageName",element:h.jsx(Wpe,{})},{path:":environmentName/:packageName/*",element:h.jsx(Hpe,{})}]}])),Qpe=Gpe("/");g5.createRoot(document.getElementById("root")).render(h.jsx(C.StrictMode,{children:h.jsx($4,{router:Qpe})}));export{kc as $,Dn as A,Xu as B,tt as C,ma as D,Ys as E,ol as F,Ui as G,eg as H,eo as I,tl as J,Zpe as K,Kt as L,uj as M,rj as N,RC as O,Na as P,_he as Q,Pm as R,xS as S,Lt as T,zr as U,Bj as V,pj as W,dp as X,Kc as Y,Xhe as Z,Jpe as _,ja as a,lue as a$,oa as a0,Vhe as a1,Ghe as a2,EL as a3,Ahe as a4,Sg as a5,Bhe as a6,u0 as a7,Lo as a8,pn as a9,wL as aA,jhe as aB,zhe as aC,Nhe as aD,Lhe as aE,Lce as aF,Ihe as aG,Rc as aH,pb as aI,Yi as aJ,SG as aK,TD as aL,Wce as aM,FP as aN,que as aO,Kce as aP,xo as aQ,Gue as aR,co as aS,Uhe as aT,ha as aU,Yue as aV,Bue as aW,qce as aX,tk as aY,cr as aZ,Bc as a_,fr as aa,vpe as ab,Hhe as ac,Yhe as ad,Jue as ae,Qhe as af,a9 as ag,Khe as ah,Whe as ai,zF as aj,kC as ak,KO as al,ii as am,C9 as an,pN as ao,yR as ap,Ii as aq,dd as ar,G7 as as,$c as at,qH as au,QH as av,Fb as aw,aa as ax,Ko as ay,PK as az,ln as b,cue as b0,g8 as b1,MC as b2,Sj as b3,JN as b4,$P as b5,zce as b6,RP as b7,xL as b8,Fhe as b9,OH as ba,Lue as bb,Fm as bc,Ir as bd,Xpe as be,Ia as c,an as d,gS as e,qhe as f,VB as g,cn as h,zs as i,h as j,Pt as k,sn as l,Jt as m,Wc as n,nl as o,po as p,ld as q,C as r,ot as s,Nl as t,eC as u,LA as v,Nv as w,_A as x,ig as y,zA as z};
|