@malloy-publisher/app 0.9.13 → 0.9.14
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/assets/{EnvironmentPage-BxJoHBPQ.js → EnvironmentPage-C0Y7JsgF.js} +1 -1
- package/dist/assets/{HomePage-CtB5QVol.js → HomePage-B3LsCOlr.js} +1 -1
- package/dist/assets/{MainPage-1nhjUUzl.js → MainPage-BCDlscxh.js} +1 -1
- package/dist/assets/{ModelPage-D8aucAvE.js → ModelPage-DGXivK0m.js} +2 -2
- package/dist/assets/{PackagePage-DBSA4TbT.js → PackagePage-BBvnnh9f.js} +1 -1
- package/dist/assets/{RenderedResult-DnBtf-cI.es-DalkcU9E.js → RenderedResult-DnBtf-cI.es-Bs8KIO86.js} +1 -1
- package/dist/assets/{RouteError-BVLp9Ogi.js → RouteError-1Eclkzb_.js} +1 -1
- package/dist/assets/{ThemeEditorPage-D6bvkrka.js → ThemeEditorPage-loRmpKoQ.js} +1 -1
- package/dist/assets/{ToggleButtonGroup-CWY9-__R.js → ToggleButtonGroup-CnciHZDP.js} +1 -1
- package/dist/assets/{documentRoutes-QL_YE88h.js → documentRoutes-e6eAjpuN.js} +1 -1
- package/dist/assets/{editPageMounted-BT7ByBX-.js → editPageMounted-BiGObPJ4.js} +2 -2
- package/dist/assets/{index-DM7_2PYo.js → index-1Jwtzdx_.js} +1 -1
- package/dist/assets/{index-Dgqan3mQ.js → index-B_gOHtqJ.js} +4 -4
- package/dist/assets/{index-CHfG8VAW.js → index-Bp7WJqoi.js} +1 -1
- package/dist/assets/{index-BRzP9bJe.js → index-Dnzp7ChL.js} +1 -1
- package/dist/assets/index.es-396NBJA3.js +143 -0
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/dist/assets/index.es-BBmXDZRJ.js +0 -143
|
@@ -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-1Jwtzdx_.js","assets/index-CRAwrhYM.js","assets/index-Bp7WJqoi.js","assets/core-B8oMW4sm.es-hOkwvru5.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/index-Dnzp7ChL.js","assets/index-DFDVJFPm.js","assets/MainPage-BCDlscxh.js","assets/editPageMounted-BiGObPJ4.js","assets/documentRoutes-e6eAjpuN.js","assets/ModelPage-DGXivK0m.js","assets/PackagePage-BBvnnh9f.js","assets/ThemeEditorPage-loRmpKoQ.js","assets/ToggleButtonGroup-CnciHZDP.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function rN(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const a=Object.getOwnPropertyDescriptor(r,o);a&&Object.defineProperty(e,o,a.get?a:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();var jxe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gS={exports:{}},em={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -468,7 +468,7 @@ ${t}`}function Mae(e){return e?.status===403}const fd=1e3,QE=200;function Rz(e){
|
|
|
468
468
|
`));u&&j.current&&j.current.getSectionContent($.startIndex).focus()},[]),{interactions:V,returnedValue:{autoFocus:u,readOnly:n,focused:f??N,sectionListRef:B,onBlur:ee,onClick:W,onFocus:G,onInput:X,onPaste:ie,enableAccessibleFieldDOMStructure:!0,elements:me,tabIndex:S===0?-1:0,contentEditable:ce,value:ye,onChange:pe,areAllSectionsEmpty:A}}},ap=e=>e.replace(/[\u2066\u2067\u2068\u2069]/g,""),Pfe=(e,t,n)=>{let r=0,o=n?1:0;const a=[];for(let i=0;i<e.length;i+=1){const s=e[i],c=rR(s,n?"input-rtl":"input-ltr",t),f=`${s.startSeparator}${c}${s.endSeparator}`,u=ap(f).length,h=f.length,g=ap(c),v=o+(g===""?0:c.indexOf(g[0]))+s.startSeparator.length,b=v+g.length;a.push(Le({},s,{start:r,end:r+u,startInInput:v,endInInput:b})),r+=u,o+=h}return a},Afe=e=>{const t=$s(),n=C.useRef(void 0),r=C.useRef(void 0),{forwardedProps:{onFocus:o,onClick:a,onPaste:i,onBlur:s,inputRef:c,placeholder:f},internalProps:{readOnly:u=!1,disabled:h=!1},parsedSelectedSections:g,activeSectionIndex:v,state:b,fieldValueManager:S,valueManager:w,applyCharacterEditing:x,resetCharacterQuery:R,updateSectionValue:k,updateValueFromValueStr:T,clearActiveSection:$,clearValue:A,setTempAndroidValueStr:z,setSelectedSections:j,getSectionsFromValue:B,areAllSectionsEmpty:L,localizedDigits:F}=e,E=C.useRef(null),N=mr(c,E),D=C.useMemo(()=>Pfe(b.sections,F,t),[b.sections,F,t]),V=C.useMemo(()=>({syncSelectionToDOM:()=>{if(!E.current)return;if(g==null){E.current.scrollLeft&&(E.current.scrollLeft=0);return}if(E.current!==za(document))return;const re=E.current.scrollTop;if(g==="all")E.current.select();else{const te=D[g],oe=te.type==="empty"?te.startInInput-te.startSeparator.length:te.startInInput,ce=te.type==="empty"?te.endInInput+te.endSeparator.length:te.endInInput;(oe!==E.current.selectionStart||ce!==E.current.selectionEnd)&&E.current===za(document)&&E.current.setSelectionRange(oe,ce),clearTimeout(r.current),r.current=setTimeout(()=>{E.current&&E.current===za(document)&&E.current.selectionStart===E.current.selectionEnd&&(E.current.selectionStart!==oe||E.current.selectionEnd!==ce)&&V.syncSelectionToDOM()})}E.current.scrollTop=re},getActiveSectionIndexFromDOM:()=>{const re=E.current.selectionStart??0,te=E.current.selectionEnd??0;if(re===0&&te===0)return null;const oe=re<=D[0].startInInput?1:D.findIndex(ce=>ce.startInInput-ce.startSeparator.length>re);return oe===-1?D.length-1:oe-1},focusField:(re=0)=>{za(document)!==E.current&&(E.current?.focus(),j(re))},setSelectedSections:re=>j(re),isFieldFocused:()=>E.current===za(document)}),[E,g,D,j]),I=()=>{const re=E.current.selectionStart??0;let te;re<=D[0].startInInput||re>=D[D.length-1].endInInput?te=1:te=D.findIndex(ce=>ce.startInInput-ce.startSeparator.length>re);const oe=te===-1?D.length-1:te-1;j(oe)},W=qt((...re)=>{o?.(...re);const te=E.current;clearTimeout(n.current),n.current=setTimeout(()=>{!te||te!==E.current||v==null&&(te.value.length&&Number(te.selectionEnd)-Number(te.selectionStart)===te.value.length?j("all"):I())})}),X=qt((re,...te)=>{re.isDefaultPrevented()||(a?.(re,...te),I())}),ie=qt(re=>{if(i?.(re),re.preventDefault(),u||h)return;const te=re.clipboardData.getData("text");if(typeof g=="number"){const oe=b.sections[g],ce=/^[a-zA-Z]+$/.test(te),me=/^[0-9]+$/.test(te),pe=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(te);if(oe.contentType==="letter"&&ce||oe.contentType==="digit"&&me||oe.contentType==="digit-with-letter"&&pe){R(),k({activeSection:oe,newSectionValue:te,shouldGoToNextSection:!0});return}if(ce||me)return}R(),T(te)}),G=qt((...re)=>{s?.(...re),j(null)}),ee=qt(re=>{if(u)return;const te=re.target.value;if(te===""){R(),A();return}const oe=re.nativeEvent.data,ce=oe&&oe.length>1,me=ce?oe:te,pe=ap(me);if(g==="all"&&j(v),v==null||ce){T(ce?oe:pe);return}let ye;if(g==="all"&&pe.length===1)ye=pe;else{const ue=ap(S.getV6InputValueFromSections(D,F,t));let Se=-1,Ue=-1;for(let de=0;de<ue.length;de+=1)Se===-1&&ue[de]!==pe[de]&&(Se=de),Ue===-1&&ue[ue.length-de-1]!==pe[pe.length-de-1]&&(Ue=de);const je=D[v];if(Se<je.start||ue.length-Ue-1>je.end)return;const Re=pe.length-ue.length+je.end-ap(je.endSeparator||"").length;ye=pe.slice(je.start+ap(je.startSeparator||"").length,Re)}if(ye.length===0){Iie()&&z(me),R(),$();return}x({keyPressed:ye,sectionIndex:v})}),se=C.useMemo(()=>f!==void 0?f:S.getV6InputValueFromSections(B(w.emptyValue),F,t),[f,S,B,w.emptyValue,F,t]),Y=C.useMemo(()=>b.tempValueStrAndroid??S.getV6InputValueFromSections(b.sections,F,t),[b.sections,S,b.tempValueStrAndroid,F,t]);C.useEffect(()=>(E.current&&E.current===za(document)&&j("all"),()=>{clearTimeout(n.current),clearTimeout(r.current)}),[]);const ae=C.useMemo(()=>v==null||b.sections[v].contentType==="letter"?"text":"numeric",[v,b.sections]),J=!(E.current&&E.current===za(document))&&L;return{interactions:V,returnedValue:{readOnly:u,onBlur:G,onClick:X,onFocus:W,onPaste:ie,inputRef:N,enableAccessibleFieldDOMStructure:!1,placeholder:se,inputMode:ae,autoComplete:"off",value:J?"":Y,onChange:ee}}},Dfe=e=>{const t=Gr(),{internalProps:n,internalProps:{unstableFieldRef:r,minutesStep:o,enableAccessibleFieldDOMStructure:a=!1,disabled:i=!1,readOnly:s=!1},forwardedProps:{onKeyDown:c,error:f,clearable:u,onClear:h},fieldValueManager:g,valueManager:v,validator:b}=e,S=$s(),w=Tfe(e),{state:x,activeSectionIndex:R,parsedSelectedSections:k,setSelectedSections:T,clearValue:$,clearActiveSection:A,updateSectionValue:z,setTempAndroidValueStr:j,sectionsValueBoundaries:B,localizedDigits:L,timezone:F}=w,E=Ofe({sections:x.sections,updateSectionValue:z,sectionsValueBoundaries:B,localizedDigits:L,setTempAndroidValueStr:j,timezone:F}),{resetCharacterQuery:N}=E,D=v.areValuesEqual(t,x.value,v.emptyValue),V=a?$fe:Afe,I=C.useMemo(()=>Lie(x.sections,S&&!a),[x.sections,S,a]),{returnedValue:W,interactions:X}=V(Le({},e,w,E,{areAllSectionsEmpty:D,sectionOrder:I})),ie=qt(J=>{if(c?.(J),!i)switch(!0){case((J.ctrlKey||J.metaKey)&&String.fromCharCode(J.keyCode)==="A"&&!J.shiftKey&&!J.altKey):{J.preventDefault(),T("all");break}case J.key==="ArrowRight":{if(J.preventDefault(),k==null)T(I.startIndex);else if(k==="all")T(I.endIndex);else{const re=I.neighbors[k].rightIndex;re!==null&&T(re)}break}case J.key==="ArrowLeft":{if(J.preventDefault(),k==null)T(I.endIndex);else if(k==="all")T(I.startIndex);else{const re=I.neighbors[k].leftIndex;re!==null&&T(re)}break}case J.key==="Delete":{if(J.preventDefault(),s)break;k==null||k==="all"?$():A(),N();break}case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(J.key):{if(J.preventDefault(),s||R==null)break;k==="all"&&T(R);const re=x.sections[R],te=g.getActiveDateManager(t,x,re),oe=Oie(t,F,re,J.key,B,L,te.date,{minutesStep:o});z({activeSection:re,newSectionValue:oe,shouldGoToNextSection:!1});break}}});Bo(()=>{X.syncSelectionToDOM()});const{hasValidationError:G}=Gz({props:n,validator:b,timezone:F,value:x.value,onError:n.onError}),ee=C.useMemo(()=>f!==void 0?f:G,[G,f]);C.useEffect(()=>{!ee&&R==null&&N()},[x.referenceValue,R,ee]),C.useEffect(()=>{x.tempValueStrAndroid!=null&&R!=null&&(N(),A())},[x.sections]),C.useImperativeHandle(r,()=>({getSections:()=>x.sections,getActiveSectionIndex:X.getActiveSectionIndexFromDOM,setSelectedSections:X.setSelectedSections,focusField:X.focusField,isFieldFocused:X.isFieldFocused}));const se=qt((J,...re)=>{J.preventDefault(),h?.(J,...re),$(),X.isFieldFocused()?T(I.startIndex):X.focusField(0)}),Y={onKeyDown:ie,onClear:se,error:ee,clearable:!!(u&&!D&&!s&&!i)},ae={disabled:i,readOnly:s};return Le({},e.forwardedProps,Y,ae,W)},jfe=["clearable","onClear","InputProps","sx","slots","slotProps"],Nfe=["ownerState"],Ife=e=>{const t=nc(),{clearable:n,onClear:r,InputProps:o,sx:a,slots:i,slotProps:s}=e,c=Vn(e,jfe),f=i?.clearButton??lu,u=xr({elementType:f,externalSlotProps:s?.clearButton,ownerState:{},className:"clearButton",additionalProps:{title:t.fieldClearLabel}}),h=Vn(u,Nfe),g=i?.clearIcon??que,v=xr({elementType:g,externalSlotProps:s?.clearIcon,ownerState:{}});return Le({},c,{InputProps:Le({},o,{endAdornment:m.jsxs(C.Fragment,{children:[n&&m.jsx(Kz,{position:"end",sx:{marginRight:o?.endAdornment?-1:-1.5},children:m.jsx(f,Le({},h,{onClick:r,children:m.jsx(g,Le({fontSize:"small"},v))}))}),o?.endAdornment]})}),sx:[{"& .clearButton":{opacity:1},"@media (pointer: fine)":{"& .clearButton":{opacity:0},"&:hover, &:focus-within":{".clearButton":{opacity:1}}}},...Array.isArray(a)?a:[a]]})},Lfe=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator"],zfe=(e,t)=>C.useMemo(()=>{const n=Le({},e),r={},o=a=>{n.hasOwnProperty(a)&&(r[a]=n[a],delete n[a])};return Lfe.forEach(o),Wz.forEach(o),{forwardedProps:n,internalProps:r}},[e,t]),Ffe=e=>{const t=Gr(),n=my();return Le({},e,{disablePast:e.disablePast??!1,disableFuture:e.disableFuture??!1,format:e.format??t.formats.keyboardDate,minDate:ts(t,e.minDate,n.minDate),maxDate:ts(t,e.maxDate,n.maxDate)})},_fe=e=>{const t=Ffe(e),{forwardedProps:n,internalProps:r}=zfe(t,"date");return Dfe({forwardedProps:n,internalProps:r,valueManager:dl,fieldValueManager:Bie,validator:gy,valueType:"date"})};function Bfe(e){return un("MuiPickersTextField",e)}nn("MuiPickersTextField",["root","focused","disabled","error","required"]);function Ufe(e){return un("MuiPickersInputBase",e)}const hp=nn("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input"]);function Vfe(e){return un("MuiPickersSectionList",e)}const Mm=nn("MuiPickersSectionList",["root","section","sectionContent"]),Hfe=["slots","slotProps","elements","sectionListRef"],A4=Xe("div",{name:"MuiPickersSectionList",slot:"Root",overridesResolver:(e,t)=>t.root})({direction:"ltr /*! @noflip */",outline:"none"}),D4=Xe("span",{name:"MuiPickersSectionList",slot:"Section",overridesResolver:(e,t)=>t.section})({}),j4=Xe("span",{name:"MuiPickersSectionList",slot:"SectionSeparator",overridesResolver:(e,t)=>t.sectionSeparator})({whiteSpace:"pre"}),N4=Xe("span",{name:"MuiPickersSectionList",slot:"SectionContent",overridesResolver:(e,t)=>t.sectionContent})({outline:"none"}),qfe=e=>{const{classes:t}=e;return ln({root:["root"],section:["section"],sectionContent:["sectionContent"]},Vfe,t)};function Wfe(e){const{slots:t,slotProps:n,element:r,classes:o}=e,a=t?.section??D4,i=xr({elementType:a,externalSlotProps:n?.section,externalForwardedProps:r.container,className:o.section,ownerState:{}}),s=t?.sectionContent??N4,c=xr({elementType:s,externalSlotProps:n?.sectionContent,externalForwardedProps:r.content,additionalProps:{suppressContentEditableWarning:!0},className:o.sectionContent,ownerState:{}}),f=t?.sectionSeparator??j4,u=xr({elementType:f,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.before,ownerState:{position:"before"}}),h=xr({elementType:f,externalSlotProps:n?.sectionSeparator,externalForwardedProps:r.after,ownerState:{position:"after"}});return m.jsxs(a,Le({},i,{children:[m.jsx(f,Le({},u)),m.jsx(s,Le({},c)),m.jsx(f,Le({},h))]}))}const Yfe=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersSectionList"}),{slots:r,slotProps:o,elements:a,sectionListRef:i}=n,s=Vn(n,Hfe),c=qfe(n),f=C.useRef(null),u=mr(t,f),h=b=>{if(!f.current)throw new Error(`MUI X: Cannot call sectionListRef.${b} before the mount of the component.`);return f.current};C.useImperativeHandle(i,()=>({getRoot(){return h("getRoot")},getSectionContainer(b){return h("getSectionContainer").querySelector(`.${Mm.section}[data-sectionindex="${b}"]`)},getSectionContent(b){return h("getSectionContent").querySelector(`.${Mm.section}[data-sectionindex="${b}"] .${Mm.sectionContent}`)},getSectionIndexFromDOMElement(b){const S=h("getSectionIndexFromDOMElement");if(b==null||!S.contains(b))return null;let w=null;return b.classList.contains(Mm.section)?w=b:b.classList.contains(Mm.sectionContent)&&(w=b.parentElement),w==null?null:Number(w.dataset.sectionindex)}}));const g=r?.root??A4,v=xr({elementType:g,externalSlotProps:o?.root,externalForwardedProps:s,additionalProps:{ref:u,suppressContentEditableWarning:!0},className:c.root,ownerState:{}});return m.jsx(g,Le({},v,{children:v.contentEditable?a.map(({content:b,before:S,after:w})=>`${S.children}${b.children}${w.children}`).join(""):m.jsx(C.Fragment,{children:a.map((b,S)=>m.jsx(Wfe,{slots:r,slotProps:o,element:b,classes:c},S))})}))}),Gfe=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef"],Kfe=e=>Math.round(e*1e5)/1e5,Nx=Xe("div",{name:"MuiPickersInputBase",slot:"Root",overridesResolver:(e,t)=>t.root})(({theme:e})=>Le({},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:`${Kfe(.15/16)}em`,variants:[{props:{fullWidth:!0},style:{width:"100%"}}]})),kR=Xe(A4,{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}}]})),Xfe=Xe(D4,{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"})),Qfe=Xe(N4,{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"})),Zfe=Xe(j4,{name:"MuiPickersInputBase",slot:"Separator",overridesResolver:(e,t)=>t.separator})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),Jfe=Xe("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(e,t)=>t.hiddenInput})(Le({},mie)),epe=e=>{const{focused:t,disabled:n,error:r,classes:o,fullWidth:a,readOnly:i,color:s,size:c,endAdornment:f,startAdornment:u}=e,h={root:["root",t&&!n&&"focused",n&&"disabled",i&&"readOnly",r&&"error",a&&"fullWidth",`color${Rt(s)}`,c==="small"&&"inputSizeSmall",!!u&&"adornedStart",!!f&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"]};return ln(h,Ufe,o)},ER=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersInputBase"}),{elements:r,areAllSectionsEmpty:o,value:a,onChange:i,id:s,endAdornment:c,startAdornment:f,renderSuffix:u,slots:h,slotProps:g,contentEditable:v,tabIndex:b,onInput:S,onPaste:w,onKeyDown:x,name:R,readOnly:k,inputProps:T,inputRef:$,sectionListRef:A}=n,z=Vn(n,Gfe),j=C.useRef(null),B=mr(t,j),L=mr(T?.ref,$),F=$s(),E=Mi();if(!E)throw new Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");const N=ie=>{if(E.disabled){ie.stopPropagation();return}E.onFocus?.(ie)};C.useEffect(()=>{E&&E.setAdornedStart(!!f)},[E,f]),C.useEffect(()=>{E&&(o?E.onEmpty():E.onFilled())},[E,o]);const D=Le({},n,E,{isRtl:F}),V=epe(D),I=h?.root||Nx,W=xr({elementType:I,externalSlotProps:g?.root,externalForwardedProps:z,additionalProps:{"aria-invalid":E.error,ref:B},className:V.root,ownerState:D}),X=h?.input||kR;return m.jsxs(I,Le({},W,{children:[f,m.jsx(Yfe,{sectionListRef:A,elements:r,contentEditable:v,tabIndex:b,className:V.sectionsContainer,onFocus:N,onBlur:E.onBlur,onInput:S,onPaste:w,onKeyDown:x,slots:{root:X,section:Xfe,sectionContent:Qfe,sectionSeparator:Zfe},slotProps:{root:{ownerState:D},sectionContent:{className:hp.sectionContent},sectionSeparator:({position:ie})=>({className:ie==="before"?hp.sectionBefore:hp.sectionAfter})}}),c,u?u(Le({},E)):null,m.jsx(Jfe,Le({name:R,className:V.input,value:a,onChange:i,id:s,"aria-hidden":"true",tabIndex:-1,readOnly:k,required:E.required,disabled:E.disabled},T,{ref:L}))]}))});function tpe(e){return un("MuiPickersOutlinedInput",e)}const ks=Le({},hp,nn("MuiPickersOutlinedInput",["root","notchedOutline","input"])),npe=["children","className","label","notched","shrink"],rpe=Xe("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}}),ej=Xe("span")(({theme:e})=>({fontFamily:e.typography.fontFamily,fontSize:"inherit"})),ope=Xe("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 ape(e){const{className:t,label:n}=e,r=Vn(e,npe),o=n!=null&&n!=="",a=Le({},e,{withLabel:o});return m.jsx(rpe,Le({"aria-hidden":!0,className:t},r,{ownerState:a,children:m.jsx(ope,{ownerState:a,children:o?m.jsx(ej,{children:n}):m.jsx(ej,{className:"notranslate",children:""})})}))}const ipe=["label","autoFocus","ownerState","notched"],spe=Xe(Nx,{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 .${ks.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${ks.notchedOutline}`]:{borderColor:e.vars?`rgba(${e.vars.palette.common.onBackgroundChannel} / 0.23)`:t}},[`&.${ks.focused} .${ks.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${ks.disabled}`]:{[`& .${ks.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled},"*":{color:(e.vars||e).palette.action.disabled}},[`&.${ks.error} .${ks.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:{[`&.${ks.focused}:not(.${ks.error}) .${ks.notchedOutline}`]:{borderColor:(e.vars||e).palette[n].main}}}))}}),lpe=Xe(kR,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer",overridesResolver:(e,t)=>t.sectionsContainer})({padding:"16.5px 0",variants:[{props:{size:"small"},style:{padding:"8.5px 0"}}]}),cpe=e=>{const{classes:t}=e,n=ln({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},tpe,t);return Le({},t,n)},I4=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersOutlinedInput"}),{label:r,ownerState:o,notched:a}=n,i=Vn(n,ipe),s=Mi(),c=Le({},n,o,s,{color:s?.color||"primary"}),f=cpe(c);return m.jsx(ER,Le({slots:{root:spe,input:lpe},renderSuffix:u=>m.jsx(ape,{shrink:!!(a||u.adornedStart||u.focused||u.filled),notched:!!(a||u.adornedStart||u.focused||u.filled),className:f.notchedOutline,label:r!=null&&r!==""&&s?.required?m.jsxs(C.Fragment,{children:[r," ","*"]}):r,ownerState:c})},i,{label:r,classes:f,ref:t}))});I4.muiName="Input";function upe(e){return un("MuiPickersFilledInput",e)}const Hu=Le({},hp,nn("MuiPickersFilledInput",["root","underline","input"])),dpe=["label","autoFocus","disableUnderline","ownerState"],fpe=Xe(Nx,{name:"MuiPickersFilledInput",slot:"Root",overridesResolver:(e,t)=>t.root,shouldForwardProp:e=>ub(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}},[`&.${Hu.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:r},[`&.${Hu.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:a},variants:[...Object.keys((e.vars??e).palette).filter(i=>(e.vars??e).palette[i].main).map(i=>({props:{color:i,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[i]?.main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Hu.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Hu.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(.${Hu.disabled}, .${Hu.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${Hu.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:({startAdornment:i})=>!!i,style:{paddingLeft:12}},{props:({endAdornment:i})=>!!i,style:{paddingRight:12}}]}}),ppe=Xe(kR,{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}}]}),hpe=e=>{const{classes:t,disableUnderline:n}=e,r=ln({root:["root",!n&&"underline"],input:["input"]},upe,t);return Le({},t,r)},L4=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersFilledInput"}),{label:r,disableUnderline:o=!1,ownerState:a}=n,i=Vn(n,dpe),s=Mi(),c=Le({},n,a,s,{color:s?.color||"primary"}),f=hpe(c);return m.jsx(ER,Le({slots:{root:fpe,input:ppe},slotProps:{root:{disableUnderline:o}}},i,{label:r,classes:f,ref:t}))});L4.muiName="Input";function mpe(e){return un("MuiPickersFilledInput",e)}const Om=Le({},hp,nn("MuiPickersInput",["root","input"])),gpe=["label","autoFocus","disableUnderline","ownerState"],ype=Xe(Nx,{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"},[`&.${Om.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Om.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(.${Om.disabled}, .${Om.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${Om.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),vpe=e=>{const{classes:t,disableUnderline:n}=e,r=ln({root:["root",!n&&"underline"],input:["input"]},mpe,t);return Le({},t,r)},z4=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersInput"}),{label:r,disableUnderline:o=!1,ownerState:a}=n,i=Vn(n,gpe),s=Mi(),c=Le({},n,a,s,{disableUnderline:o,color:s?.color||"primary"}),f=vpe(c);return m.jsx(ER,Le({slots:{root:ype}},i,{label:r,classes:f,ref:t}))});z4.muiName="Input";const bpe=["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"],xpe={standard:z4,filled:L4,outlined:I4},Spe=Xe(S4,{name:"MuiPickersTextField",slot:"Root",overridesResolver:(e,t)=>t.root})({maxWidth:"100%"}),wpe=e=>{const{focused:t,disabled:n,classes:r,required:o}=e;return ln({root:["root",t&&!n&&"focused",n&&"disabled",o&&"required"]},Bfe,r)},Cpe=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersTextField"}),{onFocus:r,onBlur:o,className:a,color:i="primary",disabled:s=!1,error:c=!1,variant:f="outlined",required:u=!1,InputProps:h,inputProps:g,inputRef:v,sectionListRef:b,elements:S,areAllSectionsEmpty:w,onClick:x,onKeyDown:R,onKeyUp:k,onPaste:T,onInput:$,endAdornment:A,startAdornment:z,tabIndex:j,contentEditable:B,focused:L,value:F,onChange:E,fullWidth:N,id:D,name:V,helperText:I,FormHelperTextProps:W,label:X,InputLabelProps:ie}=n,G=Vn(n,bpe),ee=C.useRef(null),se=mr(t,ee),Y=Ps(D),ae=I&&Y?`${Y}-helper-text`:void 0,J=X&&Y?`${Y}-label`:void 0,re=Le({},n,{color:i,disabled:s,error:c,focused:L,required:u,variant:f}),te=wpe(re),oe=xpe[f];return m.jsxs(Spe,Le({className:Bt(te.root,a),ref:se,focused:L,onFocus:r,onBlur:o,disabled:s,variant:f,error:c,color:i,fullWidth:N,required:u,ownerState:re},G,{children:[m.jsx(x4,Le({htmlFor:Y,id:J},ie,{children:X})),m.jsx(oe,Le({elements:S,areAllSectionsEmpty:w,onClick:x,onKeyDown:R,onKeyUp:k,onInput:$,onPaste:T,endAdornment:A,startAdornment:z,tabIndex:j,contentEditable:B,value:F,onChange:E,id:Y,fullWidth:N,inputProps:g,inputRef:v,sectionListRef:b,label:X,name:V,role:"group","aria-labelledby":J,"aria-describedby":ae,"aria-live":ae?"polite":void 0},h)),I&&m.jsx(w4,Le({id:ae},W,{children:I}))]}))}),kpe=["enableAccessibleFieldDOMStructure"],Epe=["InputProps","readOnly"],Rpe=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef"],Tpe=e=>{let{enableAccessibleFieldDOMStructure:t}=e,n=Vn(e,kpe);if(t){const{InputProps:h,readOnly:g}=n,v=Vn(n,Epe);return Le({},v,{InputProps:Le({},h??{},{readOnly:g})})}const{onPaste:r,onKeyDown:o,inputMode:a,readOnly:i,InputProps:s,inputProps:c,inputRef:f}=n,u=Vn(n,Rpe);return Le({},u,{InputProps:Le({},s??{},{readOnly:i}),inputProps:Le({},c??{},{inputMode:a,onPaste:r,onKeyDown:o,ref:f})})},Mpe=["slots","slotProps","InputProps","inputProps"],F4=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiDateField"}),{slots:r,slotProps:o,InputProps:a,inputProps:i}=n,s=Vn(n,Mpe),c=n,f=r?.textField??(e.enableAccessibleFieldDOMStructure?Cpe:hr),u=xr({elementType:f,externalSlotProps:o?.textField,externalForwardedProps:s,additionalProps:{ref:t},ownerState:c});u.inputProps=Le({},i,u.inputProps),u.InputProps=Le({},a,u.InputProps);const h=_fe(u),g=Tpe(h),v=Ife(Le({},g,{slots:r,slotProps:o}));return m.jsx(f,Le({},v))}),_4=({shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:a,disablePast:i,timezone:s})=>{const c=Id();return C.useCallback(f=>gy({adapter:c,value:f,timezone:s,props:{shouldDisableDate:e,shouldDisableMonth:t,shouldDisableYear:n,minDate:r,maxDate:o,disableFuture:a,disablePast:i}})!==null,[c,e,t,n,r,o,a,i,s])},Ope=(e,t,n)=>(r,o)=>{switch(o.type){case"changeMonth":return Le({},r,{slideDirection:o.direction,currentMonth:o.newMonth,isMonthSwitchingAnimating:!e});case"changeMonthTimezone":{const a=o.newTimezone;if(n.getTimezone(r.currentMonth)===a)return r;let i=n.setTimezone(r.currentMonth,a);return n.getMonth(i)!==n.getMonth(r.currentMonth)&&(i=n.setMonth(i,n.getMonth(r.currentMonth))),Le({},r,{currentMonth:i})}case"finishMonthSwitchingAnimation":return Le({},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 Le({},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")}},$pe=e=>{const{value:t,referenceDate:n,disableFuture:r,disablePast:o,disableSwitchToMonthOnDayFocus:a=!1,maxDate:i,minDate:s,onMonthChange:c,reduceAnimations:f,shouldDisableDate:u,timezone:h}=e,g=Gr(),v=C.useRef(Ope(!!f,a,g)).current,b=C.useMemo(()=>dl.getInitialReferenceValue({value:t,utils:g,timezone:h,props:e,referenceDate:n,granularity:el.day}),[n,h]),[S,w]=C.useReducer(v,{isMonthSwitchingAnimating:!1,focusedDay:b,currentMonth:g.startOfMonth(b),slideDirection:"left"});C.useEffect(()=>{w({type:"changeMonthTimezone",newTimezone:g.getTimezone(b)})},[b,g]);const x=C.useCallback(A=>{w(Le({type:"changeMonth"},A)),c&&c(A.newMonth)},[c]),R=C.useCallback(A=>{const z=A;g.isSameMonth(z,S.currentMonth)||x({newMonth:g.startOfMonth(z),direction:g.isAfterDay(z,S.currentMonth)?"left":"right"})},[S.currentMonth,x,g]),k=_4({shouldDisableDate:u,minDate:s,maxDate:i,disableFuture:r,disablePast:o,timezone:h}),T=C.useCallback(()=>{w({type:"finishMonthSwitchingAnimation"})},[]),$=qt((A,z)=>{k(A)||w({type:"changeFocusedDay",focusedDay:A,withoutMonthSwitchingAnimation:z})});return{referenceDate:b,calendarState:S,changeMonth:R,changeFocusedDay:$,isDateDisabled:k,onMonthSwitchingAnimationEnd:T,handleChangeMonth:x}},Ppe=e=>un("MuiPickersFadeTransitionGroup",e);nn("MuiPickersFadeTransitionGroup",["root"]);const Ape=e=>{const{classes:t}=e;return ln({root:["root"]},Ppe,t)},Dpe=Xe(yy,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"block",position:"relative"});function B4(e){const t=Yr({props:e,name:"MuiPickersFadeTransitionGroup"}),{children:n,className:r,reduceAnimations:o,transKey:a}=t,i=Ape(t),s=jd();return o?n:m.jsx(Dpe,{className:Bt(i.root,r),children:m.jsx(Rd,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:s.transitions.duration.enteringScreen,enter:s.transitions.duration.enteringScreen,exit:0},children:n},a)})}function jpe(e){return un("MuiPickersDay",e)}const qu=nn("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),Npe=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],Ipe=e=>{const{selected:t,disableMargin:n,disableHighlightToday:r,today:o,disabled:a,outsideCurrentMonth:i,showDaysOutsideCurrentMonth:s,classes:c}=e,f=i&&!s;return ln({root:["root",t&&!f&&"selected",a&&"disabled",!n&&"dayWithMargin",!r&&o&&"today",i&&s&&"dayOutsideMonth",f&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},jpe,c)},U4=({theme:e})=>Le({},e.typography.caption,{width:Fg,height:Fg,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})`:sl(e.palette.primary.main,e.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.focusOpacity})`:sl(e.palette.primary.main,e.palette.action.focusOpacity),[`&.${qu.selected}`]:{willChange:"background-color",backgroundColor:(e.vars||e).palette.primary.dark}},[`&.${qu.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}},[`&.${qu.disabled}:not(.${qu.selected})`]:{color:(e.vars||e).palette.text.disabled},[`&.${qu.disabled}&.${qu.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:`0 ${Ox}px`}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(e.vars||e).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${qu.selected})`]:{border:`1px solid ${(e.vars||e).palette.text.secondary}`}}}]}),V4=(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]},Lpe=Xe(Ed,{name:"MuiPickersDay",slot:"Root",overridesResolver:V4})(U4),zpe=Xe("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:V4})(({theme:e})=>Le({},U4({theme:e}),{opacity:0,pointerEvents:"none"})),$m=()=>{},Fpe=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiPickersDay"}),{autoFocus:r=!1,className:o,day:a,disabled:i=!1,disableHighlightToday:s=!1,disableMargin:c=!1,isAnimating:f,onClick:u,onDaySelect:h,onFocus:g=$m,onBlur:v=$m,onKeyDown:b=$m,onMouseDown:S=$m,onMouseEnter:w=$m,outsideCurrentMonth:x,selected:R=!1,showDaysOutsideCurrentMonth:k=!1,children:T,today:$=!1}=n,A=Vn(n,Npe),z=Le({},n,{autoFocus:r,disabled:i,disableHighlightToday:s,disableMargin:c,selected:R,showDaysOutsideCurrentMonth:k,today:$}),j=Ipe(z),B=Gr(),L=C.useRef(null),F=mr(L,t);Bo(()=>{r&&!i&&!f&&!x&&L.current.focus()},[r,i,f,x]);const E=D=>{S(D),x&&D.preventDefault()},N=D=>{i||h(a),x&&D.currentTarget.focus(),u&&u(D)};return x&&!k?m.jsx(zpe,{className:Bt(j.root,j.hiddenDaySpacingFiller,o),ownerState:z,role:A.role}):m.jsx(Lpe,Le({className:Bt(j.root,o),ref:F,centerRipple:!0,disabled:i,tabIndex:R?0:-1,onKeyDown:D=>b(D,a),onFocus:D=>g(D,a),onBlur:D=>v(D,a),onMouseEnter:D=>w(D,a),onClick:N,onMouseDown:E},A,{ownerState:z,children:T||B.format(a,"dayOfMonth")}))}),_pe=C.memo(Fpe),Bpe=e=>un("MuiPickersSlideTransition",e),Fi=nn("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),Upe=["children","className","reduceAnimations","slideDirection","transKey","classes"],Vpe=e=>{const{classes:t,slideDirection:n}=e,r={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${n}`],exitActive:[`slideExitActiveLeft-${n}`]};return ln(r,Bpe,t)},Hpe=Xe(yy,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(e,t)=>[t.root,{[`.${Fi["slideEnter-left"]}`]:t["slideEnter-left"]},{[`.${Fi["slideEnter-right"]}`]:t["slideEnter-right"]},{[`.${Fi.slideEnterActive}`]:t.slideEnterActive},{[`.${Fi.slideExit}`]:t.slideExit},{[`.${Fi["slideExitActiveLeft-left"]}`]:t["slideExitActiveLeft-left"]},{[`.${Fi["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},[`& .${Fi["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${Fi["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${Fi.slideEnterActive}`]:{transform:"translate(0%)",transition:t},[`& .${Fi.slideExit}`]:{transform:"translate(0%)"},[`& .${Fi["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:t,zIndex:0},[`& .${Fi["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:t,zIndex:0}}});function qpe(e){const t=Yr({props:e,name:"MuiPickersSlideTransition"}),{children:n,className:r,reduceAnimations:o,transKey:a}=t,i=Vn(t,Upe),s=Vpe(t),c=jd();if(o)return m.jsx("div",{className:Bt(s.root,r),children:n});const f={exit:s.exit,enterActive:s.enterActive,enter:s.enter,exitActive:s.exitActive};return m.jsx(Hpe,{className:Bt(s.root,r),childFactory:u=>C.cloneElement(u,{classNames:f}),role:"presentation",children:m.jsx(aR,Le({mountOnEnter:!0,unmountOnExit:!0,timeout:c.transitions.duration.complex,classNames:f},i,{children:n}),a)})}const Wpe=e=>un("MuiDayCalendar",e);nn("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const Ype=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],Gpe=["ownerState"],Kpe=e=>{const{classes:t}=e;return ln({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},Wpe,t)},H4=(Fg+Ox*2)*6,Xpe=Xe("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({}),Qpe=Xe("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(e,t)=>t.header})({display:"flex",justifyContent:"center",alignItems:"center"}),Zpe=Xe(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})),Jpe=Xe(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})),ehe=Xe(br,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(e,t)=>t.weekNumber})(({theme:e})=>Le({},e.typography.caption,{width:Fg,height:Fg,padding:0,margin:`0 ${Ox}px`,color:e.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),the=Xe("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(e,t)=>t.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:H4}),nhe=Xe(qpe,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(e,t)=>t.slideTransition})({minHeight:H4}),rhe=Xe("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(e,t)=>t.monthContainer})({overflow:"hidden"}),ohe=Xe("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(e,t)=>t.weekContainer})({margin:`${Ox}px 0`,display:"flex",justifyContent:"center"});function ahe(e){let{parentProps:t,day:n,focusableDay:r,selectedDays:o,isDateDisabled:a,currentMonthNumber:i,isViewFocused:s}=e,c=Vn(e,Ype);const{disabled:f,disableHighlightToday:u,isMonthSwitchingAnimating:h,showDaysOutsideCurrentMonth:g,slots:v,slotProps:b,timezone:S}=t,w=Gr(),x=Rx(S),R=r!==null&&w.isSameDay(n,r),k=o.some(E=>w.isSameDay(E,n)),T=w.isSameDay(n,x),$=v?.day??_pe,A=xr({elementType:$,externalSlotProps:b?.day,additionalProps:Le({disableHighlightToday:u,showDaysOutsideCurrentMonth:g,role:"gridcell",isAnimating:h,"data-timestamp":w.toJsDate(n).valueOf()},c),ownerState:Le({},t,{day:n,selected:k})}),z=Vn(A,Gpe),j=C.useMemo(()=>f||a(n),[f,a,n]),B=C.useMemo(()=>w.getMonth(n)!==i,[w,n,i]),L=C.useMemo(()=>{const E=w.startOfMonth(w.setMonth(n,i));return g?w.isSameDay(n,w.startOfWeek(E)):w.isSameDay(n,E)},[i,n,g,w]),F=C.useMemo(()=>{const E=w.endOfMonth(w.setMonth(n,i));return g?w.isSameDay(n,w.endOfWeek(E)):w.isSameDay(n,E)},[i,n,g,w]);return m.jsx($,Le({},z,{day:n,disabled:j,autoFocus:s&&R,today:T,outsideCurrentMonth:B,isFirstVisibleCell:L,isLastVisibleCell:F,selected:k,tabIndex:R?0:-1,"aria-selected":k,"aria-current":T?"date":void 0}))}function ihe(e){const t=Yr({props:e,name:"MuiDayCalendar"}),n=Gr(),{onFocusedDayChange:r,className:o,currentMonth:a,selectedDays:i,focusedDay:s,loading:c,onSelectedDaysChange:f,onMonthSwitchingAnimationEnd:u,readOnly:h,reduceAnimations:g,renderLoading:v=()=>m.jsx("span",{children:"..."}),slideDirection:b,TransitionProps:S,disablePast:w,disableFuture:x,minDate:R,maxDate:k,shouldDisableDate:T,shouldDisableMonth:$,shouldDisableYear:A,dayOfWeekFormatter:z=je=>n.format(je,"weekdayShort").charAt(0).toUpperCase(),hasFocus:j,onFocusedViewChange:B,gridLabelId:L,displayWeekNumber:F,fixedWeekNumber:E,autoFocus:N,timezone:D}=t,V=Rx(D),I=Kpe(t),W=$s(),X=_4({shouldDisableDate:T,shouldDisableMonth:$,shouldDisableYear:A,minDate:R,maxDate:k,disablePast:w,disableFuture:x,timezone:D}),ie=nc(),[G,ee]=wi({name:"DayCalendar",state:"hasFocus",controlled:j,default:N??!1}),[se,Y]=C.useState(()=>s||V),ae=qt(je=>{h||f(je)}),J=je=>{X(je)||(r(je),Y(je),B?.(!0),ee(!0))},re=qt((je,Re)=>{switch(je.key){case"ArrowUp":J(n.addDays(Re,-7)),je.preventDefault();break;case"ArrowDown":J(n.addDays(Re,7)),je.preventDefault();break;case"ArrowLeft":{const de=n.addDays(Re,W?1:-1),tt=n.addMonths(Re,W?1:-1),Ne=fg({utils:n,date:de,minDate:W?de:n.startOfMonth(tt),maxDate:W?n.endOfMonth(tt):de,isDateDisabled:X,timezone:D});J(Ne||de),je.preventDefault();break}case"ArrowRight":{const de=n.addDays(Re,W?-1:1),tt=n.addMonths(Re,W?-1:1),Ne=fg({utils:n,date:de,minDate:W?n.startOfMonth(tt):de,maxDate:W?de:n.endOfMonth(tt),isDateDisabled:X,timezone:D});J(Ne||de),je.preventDefault();break}case"Home":J(n.startOfWeek(Re)),je.preventDefault();break;case"End":J(n.endOfWeek(Re)),je.preventDefault();break;case"PageUp":J(n.addMonths(Re,1)),je.preventDefault();break;case"PageDown":J(n.addMonths(Re,-1)),je.preventDefault();break}}),te=qt((je,Re)=>J(Re)),oe=qt((je,Re)=>{G&&n.isSameDay(se,Re)&&B?.(!1)}),ce=n.getMonth(a),me=n.getYear(a),pe=C.useMemo(()=>i.filter(je=>!!je).map(je=>n.startOfDay(je)),[n,i]),ye=`${me}-${ce}`,ue=C.useMemo(()=>C.createRef(),[ye]),Se=C.useMemo(()=>{const je=n.startOfMonth(a),Re=n.endOfMonth(a);return X(se)||n.isAfterDay(se,Re)||n.isBeforeDay(se,je)?fg({utils:n,date:se,minDate:je,maxDate:Re,disablePast:w,disableFuture:x,isDateDisabled:X,timezone:D}):se},[a,x,w,se,X,n,D]),Ue=C.useMemo(()=>{const je=n.getWeekArray(a);let Re=n.addMonths(a,1);for(;E&&je.length<E;){const de=n.getWeekArray(Re),tt=n.isSameDay(je[je.length-1][0],de[0][0]);de.slice(tt?1:0).forEach(Ne=>{je.length<E&&je.push(Ne)}),Re=n.addMonths(Re,1)}return je},[a,E,n]);return m.jsxs(Xpe,{role:"grid","aria-labelledby":L,className:I.root,children:[m.jsxs(Qpe,{role:"row",className:I.header,children:[F&&m.jsx(Jpe,{variant:"caption",role:"columnheader","aria-label":ie.calendarWeekNumberHeaderLabel,className:I.weekNumberLabel,children:ie.calendarWeekNumberHeaderText}),xie(n,V).map((je,Re)=>m.jsx(Zpe,{variant:"caption",role:"columnheader","aria-label":n.format(je,"weekday"),className:I.weekDayLabel,children:z(je)},Re.toString()))]}),c?m.jsx(the,{className:I.loadingContainer,children:v()}):m.jsx(nhe,Le({transKey:ye,onExited:u,reduceAnimations:g,slideDirection:b,className:Bt(o,I.slideTransition)},S,{nodeRef:ue,children:m.jsx(rhe,{ref:ue,role:"rowgroup",className:I.monthContainer,children:Ue.map((je,Re)=>m.jsxs(ohe,{role:"row",className:I.weekContainer,"aria-rowindex":Re+1,children:[F&&m.jsx(ehe,{className:I.weekNumber,role:"rowheader","aria-label":ie.calendarWeekNumberAriaLabelText(n.getWeekNumber(je[0])),children:ie.calendarWeekNumberText(n.getWeekNumber(je[0]))}),je.map((de,tt)=>m.jsx(ahe,{parentProps:t,day:de,selectedDays:pe,focusableDay:Se,onKeyDown:re,onFocus:te,onBlur:oe,onDaySelect:ae,isDateDisabled:X,currentMonthNumber:ce,isViewFocused:G,"aria-colindex":tt+1},de.toString()))]},`week-${je[0]}`))})}))]})}function she(e){return un("MuiPickersMonth",e)}const Kv=nn("MuiPickersMonth",["root","monthButton","disabled","selected"]),lhe=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],che=e=>{const{disabled:t,selected:n,classes:r}=e;return ln({root:["root"],monthButton:["monthButton",t&&"disabled",n&&"selected"]},she,r)},uhe=Xe("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%"}}]}),dhe=Xe("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(e,t)=>[t.monthButton,{[`&.${Kv.disabled}`]:t.disabled},{[`&.${Kv.selected}`]:t.selected}]})(({theme:e})=>Le({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})`:sl(e.palette.action.active,e.palette.action.hoverOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:sl(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Kv.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${Kv.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),fhe=C.memo(function(e){const t=Yr({props:e,name:"MuiPickersMonth"}),{autoFocus:n,className:r,children:o,disabled:a,selected:i,value:s,tabIndex:c,onClick:f,onKeyDown:u,onFocus:h,onBlur:g,"aria-current":v,"aria-label":b,slots:S,slotProps:w}=t,x=Vn(t,lhe),R=C.useRef(null),k=che(t);Bo(()=>{n&&R.current?.focus()},[n]);const T=S?.monthButton??dhe,$=xr({elementType:T,externalSlotProps:w?.monthButton,additionalProps:{children:o,disabled:a,tabIndex:c,ref:R,type:"button",role:"radio","aria-current":v,"aria-checked":i,"aria-label":b,onClick:A=>f(A,s),onKeyDown:A=>u(A,s),onFocus:A=>h(A,s),onBlur:A=>g(A,s)},ownerState:t,className:k.monthButton});return m.jsx(uhe,Le({className:Bt(k.root,r),ownerState:t},x,{children:m.jsx(T,Le({},$))}))});function phe(e){return un("MuiMonthCalendar",e)}nn("MuiMonthCalendar",["root"]);const hhe=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],mhe=e=>{const{classes:t}=e;return ln({root:["root"]},phe,t)};function ghe(e,t){const n=Gr(),r=my(),o=Yr({props:e,name:t});return Le({disableFuture:!1,disablePast:!1},o,{minDate:ts(n,o.minDate,r.minDate),maxDate:ts(n,o.maxDate,r.maxDate)})}const yhe=Xe("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:$x,boxSizing:"border-box"}),vhe=C.forwardRef(function(e,t){const n=ghe(e,"MuiMonthCalendar"),{className:r,value:o,defaultValue:a,referenceDate:i,disabled:s,disableFuture:c,disablePast:f,maxDate:u,minDate:h,onChange:g,shouldDisableMonth:v,readOnly:b,autoFocus:S=!1,onMonthFocus:w,hasFocus:x,onFocusedViewChange:R,monthsPerRow:k=3,timezone:T,gridLabelId:$,slots:A,slotProps:z}=n,j=Vn(n,hhe),{value:B,handleValueChange:L,timezone:F}=gR({name:"MonthCalendar",timezone:T,value:o,defaultValue:a,referenceDate:i,onChange:g,valueManager:dl}),E=Rx(F),N=$s(),D=Gr(),V=C.useMemo(()=>dl.getInitialReferenceValue({value:B,utils:D,props:n,timezone:F,referenceDate:i,granularity:el.month}),[]),I=n,W=mhe(I),X=C.useMemo(()=>D.getMonth(E),[D,E]),ie=C.useMemo(()=>B!=null?D.getMonth(B):null,[B,D]),[G,ee]=C.useState(()=>ie||D.getMonth(V)),[se,Y]=wi({name:"MonthCalendar",state:"hasFocus",controlled:x,default:S??!1}),ae=qt(pe=>{Y(pe),R&&R(pe)}),J=C.useCallback(pe=>{const ye=D.startOfMonth(f&&D.isAfter(E,h)?E:h),ue=D.startOfMonth(c&&D.isBefore(E,u)?E:u),Se=D.startOfMonth(pe);return D.isBefore(Se,ye)||D.isAfter(Se,ue)?!0:v?v(Se):!1},[c,f,u,h,E,v,D]),re=qt((pe,ye)=>{if(b)return;const ue=D.setMonth(B??V,ye);L(ue)}),te=qt(pe=>{J(D.setMonth(B??V,pe))||(ee(pe),ae(!0),w&&w(pe))});C.useEffect(()=>{ee(pe=>ie!==null&&pe!==ie?ie:pe)},[ie]);const oe=qt((pe,ye)=>{switch(pe.key){case"ArrowUp":te((12+ye-3)%12),pe.preventDefault();break;case"ArrowDown":te((12+ye+3)%12),pe.preventDefault();break;case"ArrowLeft":te((12+ye+(N?1:-1))%12),pe.preventDefault();break;case"ArrowRight":te((12+ye+(N?-1:1))%12),pe.preventDefault();break}}),ce=qt((pe,ye)=>{te(ye)}),me=qt((pe,ye)=>{G===ye&&ae(!1)});return m.jsx(yhe,Le({ref:t,className:Bt(W.root,r),ownerState:I,role:"radiogroup","aria-labelledby":$},j,{children:eR(D,B??V).map(pe=>{const ye=D.getMonth(pe),ue=D.format(pe,"monthShort"),Se=D.format(pe,"month"),Ue=ye===ie,je=s||J(pe);return m.jsx(fhe,{selected:Ue,value:ye,onClick:re,onKeyDown:oe,autoFocus:se&&ye===G,disabled:je,tabIndex:ye===G&&!je?0:-1,onFocus:ce,onBlur:me,"aria-current":X===ye?"date":void 0,"aria-label":Se,monthsPerRow:k,slots:A,slotProps:z,children:ue},ue)})}))});function bhe(e){return un("MuiPickersYear",e)}const Xv=nn("MuiPickersYear",["root","yearButton","selected","disabled"]),xhe=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],She=e=>{const{disabled:t,selected:n,classes:r}=e;return ln({root:["root"],yearButton:["yearButton",t&&"disabled",n&&"selected"]},bhe,r)},whe=Xe("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%"}}]}),Che=Xe("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(e,t)=>[t.yearButton,{[`&.${Xv.disabled}`]:t.disabled},{[`&.${Xv.selected}`]:t.selected}]})(({theme:e})=>Le({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})`:sl(e.palette.action.active,e.palette.action.focusOpacity)},"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.action.activeChannel} / ${e.vars.palette.action.hoverOpacity})`:sl(e.palette.action.active,e.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Xv.disabled}`]:{color:(e.vars||e).palette.text.secondary},[`&.${Xv.selected}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.main,"&:focus, &:hover":{backgroundColor:(e.vars||e).palette.primary.dark}}})),khe=C.memo(function(e){const t=Yr({props:e,name:"MuiPickersYear"}),{autoFocus:n,className:r,children:o,disabled:a,selected:i,value:s,tabIndex:c,onClick:f,onKeyDown:u,onFocus:h,onBlur:g,"aria-current":v,slots:b,slotProps:S}=t,w=Vn(t,xhe),x=C.useRef(null),R=She(t);Bo(()=>{n&&x.current?.focus()},[n]);const k=b?.yearButton??Che,T=xr({elementType:k,externalSlotProps:S?.yearButton,additionalProps:{children:o,disabled:a,tabIndex:c,ref:x,type:"button",role:"radio","aria-current":v,"aria-checked":i,onClick:$=>f($,s),onKeyDown:$=>u($,s),onFocus:$=>h($,s),onBlur:$=>g($,s)},ownerState:t,className:R.yearButton});return m.jsx(whe,Le({className:Bt(R.root,r),ownerState:t},w,{children:m.jsx(k,Le({},T))}))});function Ehe(e){return un("MuiYearCalendar",e)}nn("MuiYearCalendar",["root"]);const Rhe=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],The=e=>{const{classes:t}=e;return ln({root:["root"]},Ehe,t)};function Mhe(e,t){const n=Gr(),r=my(),o=Yr({props:e,name:t});return Le({disablePast:!1,disableFuture:!1},o,{yearsPerRow:o.yearsPerRow??3,minDate:ts(n,o.minDate,r.minDate),maxDate:ts(n,o.maxDate,r.maxDate)})}const Ohe=Xe("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:$x,maxHeight:Rue,boxSizing:"border-box",position:"relative"}),$he=C.forwardRef(function(e,t){const n=Mhe(e,"MuiYearCalendar"),{autoFocus:r,className:o,value:a,defaultValue:i,referenceDate:s,disabled:c,disableFuture:f,disablePast:u,maxDate:h,minDate:g,onChange:v,readOnly:b,shouldDisableYear:S,onYearFocus:w,hasFocus:x,onFocusedViewChange:R,yearsOrder:k="asc",yearsPerRow:T,timezone:$,gridLabelId:A,slots:z,slotProps:j}=n,B=Vn(n,Rhe),{value:L,handleValueChange:F,timezone:E}=gR({name:"YearCalendar",timezone:$,value:a,defaultValue:i,referenceDate:s,onChange:v,valueManager:dl}),N=Rx(E),D=$s(),V=Gr(),I=C.useMemo(()=>dl.getInitialReferenceValue({value:L,utils:V,props:n,timezone:E,referenceDate:s,granularity:el.year}),[]),W=n,X=The(W),ie=C.useMemo(()=>V.getYear(N),[V,N]),G=C.useMemo(()=>L!=null?V.getYear(L):null,[L,V]),[ee,se]=C.useState(()=>G||V.getYear(I)),[Y,ae]=wi({name:"YearCalendar",state:"hasFocus",controlled:x,default:r??!1}),J=qt(Re=>{ae(Re),R&&R(Re)}),re=C.useCallback(Re=>{if(u&&V.isBeforeYear(Re,N)||f&&V.isAfterYear(Re,N)||g&&V.isBeforeYear(Re,g)||h&&V.isAfterYear(Re,h))return!0;if(!S)return!1;const de=V.startOfYear(Re);return S(de)},[f,u,h,g,N,S,V]),te=qt((Re,de)=>{if(b)return;const tt=V.setYear(L??I,de);F(tt)}),oe=qt(Re=>{re(V.setYear(L??I,Re))||(se(Re),J(!0),w?.(Re))});C.useEffect(()=>{se(Re=>G!==null&&Re!==G?G:Re)},[G]);const ce=k!=="desc"?T*1:T*-1,me=D&&k==="asc"||!D&&k==="desc"?-1:1,pe=qt((Re,de)=>{switch(Re.key){case"ArrowUp":oe(de-ce),Re.preventDefault();break;case"ArrowDown":oe(de+ce),Re.preventDefault();break;case"ArrowLeft":oe(de-me),Re.preventDefault();break;case"ArrowRight":oe(de+me),Re.preventDefault();break}}),ye=qt((Re,de)=>{oe(de)}),ue=qt((Re,de)=>{ee===de&&J(!1)}),Se=C.useRef(null),Ue=mr(t,Se);C.useEffect(()=>{if(r||Se.current===null)return;const Re=Se.current.querySelector('[tabindex="0"]');if(!Re)return;const de=Re.offsetHeight,tt=Re.offsetTop,Ne=Se.current.clientHeight,Qe=Se.current.scrollTop,nt=tt+de;de>Ne||tt<Qe||(Se.current.scrollTop=nt-Ne/2-de/2)},[r]);const je=V.getYearRange([g,h]);return k==="desc"&&je.reverse(),m.jsx(Ohe,Le({ref:Ue,className:Bt(X.root,o),ownerState:W,role:"radiogroup","aria-labelledby":A},B,{children:je.map(Re=>{const de=V.getYear(Re),tt=de===G,Ne=c||re(Re);return m.jsx(khe,{selected:tt,value:de,onClick:te,onKeyDown:pe,autoFocus:Y&&de===ee,disabled:Ne,tabIndex:de===ee&&!Ne?0:-1,onFocus:ye,onBlur:ue,"aria-current":ie===de?"date":void 0,yearsPerRow:T,slots:z,slotProps:j,children:V.format(Re,"year")},V.format(Re,"year"))})}))}),Phe=e=>un("MuiPickersCalendarHeader",e),Ahe=nn("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]);function Dhe(e){return un("MuiPickersArrowSwitcher",e)}nn("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const jhe=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],Nhe=["ownerState"],Ihe=["ownerState"],Lhe=Xe("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex"}),zhe=Xe("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})(({theme:e})=>({width:e.spacing(3)})),tj=Xe(lu,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(e,t)=>t.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),Fhe=e=>{const{classes:t}=e;return ln({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},Dhe,t)},_he=C.forwardRef(function(e,t){const n=$s(),r=Yr({props:e,name:"MuiPickersArrowSwitcher"}),{children:o,className:a,slots:i,slotProps:s,isNextDisabled:c,isNextHidden:f,onGoToNext:u,nextLabel:h,isPreviousDisabled:g,isPreviousHidden:v,onGoToPrevious:b,previousLabel:S,labelId:w}=r,x=Vn(r,jhe),R=r,k=Fhe(R),T={isDisabled:c,isHidden:f,goTo:u,label:h},$={isDisabled:g,isHidden:v,goTo:b,label:S},A=i?.previousIconButton??tj,z=xr({elementType:A,externalSlotProps:s?.previousIconButton,additionalProps:{size:"medium",title:$.label,"aria-label":$.label,disabled:$.isDisabled,edge:"end",onClick:$.goTo},ownerState:Le({},R,{hidden:$.isHidden}),className:Bt(k.button,k.previousIconButton)}),j=i?.nextIconButton??tj,B=xr({elementType:j,externalSlotProps:s?.nextIconButton,additionalProps:{size:"medium",title:T.label,"aria-label":T.label,disabled:T.isDisabled,edge:"start",onClick:T.goTo},ownerState:Le({},R,{hidden:T.isHidden}),className:Bt(k.button,k.nextIconButton)}),L=i?.leftArrowIcon??Uue,F=xr({elementType:L,externalSlotProps:s?.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:R,className:k.leftArrowIcon}),E=Vn(F,Nhe),N=i?.rightArrowIcon??Vue,D=xr({elementType:N,externalSlotProps:s?.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:R,className:k.rightArrowIcon}),V=Vn(D,Ihe);return m.jsxs(Lhe,Le({ref:t,className:Bt(k.root,a),ownerState:R},x,{children:[m.jsx(A,Le({},z,{children:n?m.jsx(N,Le({},V)):m.jsx(L,Le({},E))})),o?m.jsx(br,{variant:"subtitle1",component:"span",id:w,children:o}):m.jsx(zhe,{className:k.spacer,ownerState:R}),m.jsx(j,Le({},B,{children:n?m.jsx(L,Le({},E)):m.jsx(N,Le({},V))}))]}))});function Bhe(e,{disableFuture:t,maxDate:n,timezone:r}){const o=Gr();return C.useMemo(()=>{const a=o.date(void 0,r),i=o.startOfMonth(t&&o.isBefore(a,n)?a:n);return!o.isAfter(i,e)},[t,n,e,o,r])}function Uhe(e,{disablePast:t,minDate:n,timezone:r}){const o=Gr();return C.useMemo(()=>{const a=o.date(void 0,r),i=o.startOfMonth(t&&o.isAfter(a,n)?a:n);return!o.isBefore(i,e)},[t,n,e,o,r])}const Vhe=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],Hhe=["ownerState"],qhe=e=>{const{classes:t}=e;return ln({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},Phe,t)},Whe=Xe("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}),Yhe=Xe("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(e,t)=>t.labelContainer})(({theme:e})=>Le({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},e.typography.body1,{fontWeight:e.typography.fontWeightMedium})),Ghe=Xe("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(e,t)=>t.label})({marginRight:6}),Khe=Xe(lu,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(e,t)=>t.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${Ahe.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),Xhe=Xe(Bue,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(e,t)=>t.switchViewIcon})(({theme:e})=>({willChange:"transform",transition:e.transitions.create("transform"),transform:"rotate(0deg)"})),Qhe=C.forwardRef(function(e,t){const n=nc(),r=Gr(),o=Yr({props:e,name:"MuiPickersCalendarHeader"}),{slots:a,slotProps:i,currentMonth:s,disabled:c,disableFuture:f,disablePast:u,maxDate:h,minDate:g,onMonthChange:v,onViewChange:b,view:S,reduceAnimations:w,views:x,labelId:R,className:k,timezone:T,format:$=`${r.formats.month} ${r.formats.year}`}=o,A=Vn(o,Vhe),z=o,j=qhe(o),B=a?.switchViewButton??Khe,L=xr({elementType:B,externalSlotProps:i?.switchViewButton,additionalProps:{size:"small","aria-label":n.calendarViewSwitchingButtonAriaLabel(S)},ownerState:z,className:j.switchViewButton}),F=a?.switchViewIcon??Xhe,E=xr({elementType:F,externalSlotProps:i?.switchViewIcon,ownerState:z,className:j.switchViewIcon}),N=Vn(E,Hhe),D=()=>v(r.addMonths(s,1),"left"),V=()=>v(r.addMonths(s,-1),"right"),I=Bhe(s,{disableFuture:f,maxDate:h,timezone:T}),W=Uhe(s,{disablePast:u,minDate:g,timezone:T}),X=()=>{if(!(x.length===1||!b||c))if(x.length===2)b(x.find(G=>G!==S)||x[0]);else{const G=x.indexOf(S)!==0?0:1;b(x[G])}};if(x.length===1&&x[0]==="year")return null;const ie=r.formatByString(s,$);return m.jsxs(Whe,Le({},A,{ownerState:z,className:Bt(j.root,k),ref:t,children:[m.jsxs(Yhe,{role:"presentation",onClick:X,ownerState:z,"aria-live":"polite",className:j.labelContainer,children:[m.jsx(B4,{reduceAnimations:w,transKey:ie,children:m.jsx(Ghe,{id:R,ownerState:z,className:j.label,children:ie})}),x.length>1&&!c&&m.jsx(B,Le({},L,{children:m.jsx(F,Le({},N))}))]}),m.jsx(Rd,{in:S==="day",appear:!w,enter:!w,children:m.jsx(_he,{slots:a,slotProps:i,onGoToPrevious:V,isPreviousDisabled:W,previousLabel:n.previousMonth,onGoToNext:D,isNextDisabled:I,nextLabel:n.nextMonth})})]}))}),Zhe=Xe("div")({overflow:"hidden",width:$x,maxHeight:yR,display:"flex",flexDirection:"column",margin:"0 auto"}),Jhe=e=>un("MuiDateCalendar",e);nn("MuiDateCalendar",["root","viewTransitionContainer"]);const eme=["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"],tme=e=>{const{classes:t}=e;return ln({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},Jhe,t)};function nme(e,t){const n=Gr(),r=my(),o=u4(),a=Yr({props:e,name:t});return Le({},a,{loading:a.loading??!1,disablePast:a.disablePast??!1,disableFuture:a.disableFuture??!1,openTo:a.openTo??"day",views:a.views??["year","day"],reduceAnimations:a.reduceAnimations??o,renderLoading:a.renderLoading??(()=>m.jsx("span",{children:"..."})),minDate:ts(n,a.minDate,r.minDate),maxDate:ts(n,a.maxDate,r.maxDate)})}const rme=Xe(Zhe,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"flex",flexDirection:"column",height:yR}),ome=Xe(B4,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(e,t)=>t.viewTransitionContainer})({}),ame=C.forwardRef(function(e,t){const n=Gr(),r=Ps(),o=nme(e,"MuiDateCalendar"),{autoFocus:a,onViewChange:i,value:s,defaultValue:c,referenceDate:f,disableFuture:u,disablePast:h,onChange:g,onYearChange:v,onMonthChange:b,reduceAnimations:S,shouldDisableDate:w,shouldDisableMonth:x,shouldDisableYear:R,view:k,views:T,openTo:$,className:A,disabled:z,readOnly:j,minDate:B,maxDate:L,disableHighlightToday:F,focusedView:E,onFocusedViewChange:N,showDaysOutsideCurrentMonth:D,fixedWeekNumber:V,dayOfWeekFormatter:I,slots:W,slotProps:X,loading:ie,renderLoading:G,displayWeekNumber:ee,yearsOrder:se,yearsPerRow:Y,monthsPerRow:ae,timezone:J}=o,re=Vn(o,eme),{value:te,handleValueChange:oe,timezone:ce}=gR({name:"DateCalendar",timezone:J,value:s,defaultValue:c,referenceDate:f,onChange:g,valueManager:dl}),{view:me,setView:pe,focusedView:ye,setFocusedView:ue,goToNextView:Se,setValueAndGoToNextView:Ue}=d4({view:k,views:T,openTo:$,onChange:oe,onViewChange:i,autoFocus:a,focusedView:E,onFocusedViewChange:N}),{referenceDate:je,calendarState:Re,changeFocusedDay:de,changeMonth:tt,handleChangeMonth:Ne,isDateDisabled:Qe,onMonthSwitchingAnimationEnd:nt}=$pe({value:te,referenceDate:f,reduceAnimations:S,onMonthChange:b,minDate:B,maxDate:L,shouldDisableDate:w,disablePast:h,disableFuture:u,timezone:ce}),Ft=z&&te||B,_t=z&&te||L,rt=`${r}-grid-label`,Je=ye!==null,dt=W?.calendarHeader??Qhe,Ie=xr({elementType:dt,externalSlotProps:X?.calendarHeader,additionalProps:{views:T,view:me,currentMonth:Re.currentMonth,onViewChange:pe,onMonthChange:(en,xn)=>Ne({newMonth:en,direction:xn}),minDate:Ft,maxDate:_t,disabled:z,disablePast:h,disableFuture:u,reduceAnimations:S,timezone:ce,labelId:rt},ownerState:o}),ve=qt(en=>{const xn=n.startOfMonth(en),Tn=n.endOfMonth(en),Fn=Qe(en)?fg({utils:n,date:en,minDate:n.isBefore(B,xn)?xn:B,maxDate:n.isAfter(L,Tn)?Tn:L,disablePast:h,disableFuture:u,isDateDisabled:Qe,timezone:ce}):en;Fn?(Ue(Fn,"finish"),b?.(xn)):(Se(),tt(xn)),de(Fn,!0)}),He=qt(en=>{const xn=n.startOfYear(en),Tn=n.endOfYear(en),Fn=Qe(en)?fg({utils:n,date:en,minDate:n.isBefore(B,xn)?xn:B,maxDate:n.isAfter(L,Tn)?Tn:L,disablePast:h,disableFuture:u,isDateDisabled:Qe,timezone:ce}):en;Fn?(Ue(Fn,"finish"),v?.(Fn)):(Se(),tt(xn)),de(Fn,!0)}),Me=qt(en=>oe(en&&Jb(n,en,te??je),"finish",me));C.useEffect(()=>{te!=null&&n.isValid(te)&&tt(te)},[te]);const Ct=o,kt=tme(Ct),bt={disablePast:h,disableFuture:u,maxDate:L,minDate:B},it={disableHighlightToday:F,readOnly:j,disabled:z,timezone:ce,gridLabelId:rt,slots:W,slotProps:X},lt=C.useRef(me);C.useEffect(()=>{lt.current!==me&&(ye===lt.current&&ue(me,!0),lt.current=me)},[ye,ue,me]);const Lt=C.useMemo(()=>[te],[te]);return m.jsxs(rme,Le({ref:t,className:Bt(kt.root,A),ownerState:Ct},re,{children:[m.jsx(dt,Le({},Ie,{slots:W,slotProps:X})),m.jsx(ome,{reduceAnimations:S,className:kt.viewTransitionContainer,transKey:me,ownerState:Ct,children:m.jsxs("div",{children:[me==="year"&&m.jsx($he,Le({},bt,it,{value:te,onChange:He,shouldDisableYear:R,hasFocus:Je,onFocusedViewChange:en=>ue("year",en),yearsOrder:se,yearsPerRow:Y,referenceDate:je})),me==="month"&&m.jsx(vhe,Le({},bt,it,{hasFocus:Je,className:A,value:te,onChange:ve,shouldDisableMonth:x,onFocusedViewChange:en=>ue("month",en),monthsPerRow:ae,referenceDate:je})),me==="day"&&m.jsx(ihe,Le({},Re,bt,it,{onMonthSwitchingAnimationEnd:nt,onFocusedDayChange:de,reduceAnimations:S,selectedDays:Lt,onSelectedDaysChange:Me,shouldDisableDate:w,shouldDisableMonth:x,shouldDisableYear:R,hasFocus:Je,onFocusedViewChange:en=>ue("day",en),showDaysOutsideCurrentMonth:D,fixedWeekNumber:V,dayOfWeekFormatter:I,displayWeekNumber:ee,loading:ie,renderLoading:G}))]})})]}))}),mp=({view:e,onViewChange:t,views:n,focusedView:r,onFocusedViewChange:o,value:a,defaultValue:i,referenceDate:s,onChange:c,className:f,classes:u,disableFuture:h,disablePast:g,minDate:v,maxDate:b,shouldDisableDate:S,shouldDisableMonth:w,shouldDisableYear:x,reduceAnimations:R,onMonthChange:k,monthsPerRow:T,onYearChange:$,yearsOrder:A,yearsPerRow:z,slots:j,slotProps:B,loading:L,renderLoading:F,disableHighlightToday:E,readOnly:N,disabled:D,showDaysOutsideCurrentMonth:V,dayOfWeekFormatter:I,sx:W,autoFocus:X,fixedWeekNumber:ie,displayWeekNumber:G,timezone:ee})=>m.jsx(ame,{view:e,onViewChange:t,views:n.filter(cD),focusedView:r&&cD(r)?r:null,onFocusedViewChange:o,value:a,defaultValue:i,referenceDate:s,onChange:c,className:f,classes:u,disableFuture:h,disablePast:g,minDate:v,maxDate:b,shouldDisableDate:S,shouldDisableMonth:w,shouldDisableYear:x,reduceAnimations:R,onMonthChange:k,monthsPerRow:T,onYearChange:$,yearsOrder:A,yearsPerRow:z,slots:j,slotProps:B,loading:L,renderLoading:F,disableHighlightToday:E,readOnly:N,disabled:D,showDaysOutsideCurrentMonth:V,dayOfWeekFormatter:I,sx:W,autoFocus:X,fixedWeekNumber:ie,displayWeekNumber:G,timezone:ee}),q4=C.forwardRef(function(e,t){const n=nc(),r=Gr(),o=qz(e,"MuiDesktopDatePicker"),a=Le({day:mp,month:mp,year:mp},o.viewRenderers),i=Le({},o,{viewRenderers:a,format:tR(r,o,!1),yearsPerRow:o.yearsPerRow??4,slots:Le({openPickerIcon:Hue,field:F4},o.slots),slotProps:Le({},o.slotProps,{field:c=>Le({},kx(o.slotProps?.field,c),Yz(o),{ref:t}),toolbar:Le({hidden:!0},o.slotProps?.toolbar)})}),{renderPicker:s}=_ue({props:i,valueManager:dl,valueType:"date",getOpenDialogAriaText:Vz({utils:r,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:i.localeText?.openDatePickerDialogue}),validator:gy});return s()});q4.propTypes={autoFocus:at.bool,className:at.string,closeOnSelect:at.bool,dayOfWeekFormatter:at.func,defaultValue:at.object,disabled:at.bool,disableFuture:at.bool,disableHighlightToday:at.bool,disableOpenPicker:at.bool,disablePast:at.bool,displayWeekNumber:at.bool,enableAccessibleFieldDOMStructure:at.any,fixedWeekNumber:at.number,format:at.string,formatDensity:at.oneOf(["dense","spacious"]),inputRef:Pz,label:at.node,loading:at.bool,localeText:at.object,maxDate:at.object,minDate:at.object,monthsPerRow:at.oneOf([3,4]),name:at.string,onAccept:at.func,onChange:at.func,onClose:at.func,onError:at.func,onMonthChange:at.func,onOpen:at.func,onSelectedSectionsChange:at.func,onViewChange:at.func,onYearChange:at.func,open:at.bool,openTo:at.oneOf(["day","month","year"]),orientation:at.oneOf(["landscape","portrait"]),readOnly:at.bool,reduceAnimations:at.bool,referenceDate:at.object,renderLoading:at.func,selectedSections:at.oneOfType([at.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),at.number]),shouldDisableDate:at.func,shouldDisableMonth:at.func,shouldDisableYear:at.func,showDaysOutsideCurrentMonth:at.bool,slotProps:at.object,slots:at.object,sx:at.oneOfType([at.arrayOf(at.oneOfType([at.func,at.object,at.bool])),at.func,at.object]),timezone:at.string,value:at.object,view:at.oneOf(["day","month","year"]),viewRenderers:at.shape({day:at.func,month:at.func,year:at.func}),views:at.arrayOf(at.oneOf(["day","month","year"]).isRequired),yearsOrder:at.oneOf(["asc","desc"]),yearsPerRow:at.oneOf([3,4])};function ime(e){return un("MuiDialogContent",e)}nn("MuiDialogContent",["root","dividers"]);const sme=nn("MuiDialogTitle",["root"]),lme=e=>{const{classes:t,dividers:n}=e;return ln({root:["root",n&&"dividers"]},ime,t)},cme=Xe("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.dividers&&t.dividers]}})(Wn(({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:{[`.${sme.root} + &`]:{paddingTop:0}}}]}))),ume=C.forwardRef(function(e,t){const n=Yn({props:e,name:"MuiDialogContent"}),{className:r,dividers:o=!1,...a}=n,i={...n,dividers:o},s=lme(i);return m.jsx(cme,{className:Bt(s.root,r),ownerState:i,ref:t,...a})});function dme(e){return un("MuiDialog",e)}const yg=nn("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),fme=C.createContext({}),pme=Xe(k4,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),hme=e=>{const{classes:t,scroll:n,maxWidth:r,fullWidth:o,fullScreen:a}=e,i={root:["root"],container:["container",`scroll${Rt(n)}`],paper:["paper",`paperScroll${Rt(n)}`,`paperWidth${Rt(String(r))}`,o&&"paperFullWidth",a&&"paperFullScreen"]};return ln(i,dme,t)},mme=Xe(E4,{name:"MuiDialog",slot:"Root"})({"@media print":{position:"absolute !important"}}),gme=Xe("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${Rt(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"}}}]}),yme=Xe(Ld,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`scrollPaper${Rt(n.scroll)}`],t[`paperWidth${Rt(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(Wn(({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)`,[`&.${yg.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}`,[`&.${yg.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,[`&.${yg.paperScrollBody}`]:{margin:0,maxWidth:"100%"}}}]}))),vme=C.forwardRef(function(e,t){const n=Yn({props:e,name:"MuiDialog"}),r=jd(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":i,"aria-modal":s=!0,BackdropComponent:c,BackdropProps:f,children:u,className:h,disableEscapeKeyDown:g=!1,fullScreen:v=!1,fullWidth:b=!1,maxWidth:S="sm",onClick:w,onClose:x,open:R,PaperComponent:k=Ld,PaperProps:T={},scroll:$="paper",slots:A={},slotProps:z={},TransitionComponent:j=Rd,transitionDuration:B=o,TransitionProps:L,...F}=n,E={...n,disableEscapeKeyDown:g,fullScreen:v,fullWidth:b,maxWidth:S,scroll:$},N=hme(E),D=C.useRef(),V=ye=>{D.current=ye.target===ye.currentTarget},I=ye=>{w&&w(ye),D.current&&(D.current=null,x&&x(ye,"backdropClick"))},W=Ps(i),X=C.useMemo(()=>({titleId:W}),[W]),ie={transition:j,...A},G={transition:L,paper:T,backdrop:f,...z},ee={slots:ie,slotProps:G},[se,Y]=sr("root",{elementType:mme,shouldForwardComponentProp:!0,externalForwardedProps:ee,ownerState:E,className:Bt(N.root,h),ref:t}),[ae,J]=sr("backdrop",{elementType:pme,shouldForwardComponentProp:!0,externalForwardedProps:ee,ownerState:E}),[re,te]=sr("paper",{elementType:yme,shouldForwardComponentProp:!0,externalForwardedProps:ee,ownerState:E,className:Bt(N.paper,T.className)}),[oe,ce]=sr("container",{elementType:gme,externalForwardedProps:ee,ownerState:E,className:N.container}),[me,pe]=sr("transition",{elementType:Rd,externalForwardedProps:ee,ownerState:E,additionalProps:{appear:!0,in:R,timeout:B,role:"presentation"}});return m.jsx(se,{closeAfterTransition:!0,slots:{backdrop:ae},slotProps:{backdrop:{transitionDuration:B,as:c,...J}},disableEscapeKeyDown:g,onClose:x,open:R,onClick:I,...Y,...F,children:m.jsx(me,{...pe,children:m.jsx(oe,{onMouseDown:V,...ce,children:m.jsx(re,{as:k,elevation:24,role:"dialog","aria-describedby":a,"aria-labelledby":W,"aria-modal":s,...te,children:m.jsx(fme.Provider,{value:X,children:u})})})})})}),bme=Xe(vme)({[`& .${yg.container}`]:{outline:0},[`& .${yg.paper}`]:{outline:0,minWidth:$x}}),xme=Xe(ume)({"&:first-of-type":{padding:0}});function Sme(e){const{children:t,onDismiss:n,open:r,slots:o,slotProps:a}=e,i=o?.dialog??bme,s=o?.mobileTransition??Rd;return m.jsx(i,Le({open:r,onClose:n},a?.dialog,{TransitionComponent:s,TransitionProps:a?.mobileTransition,PaperComponent:o?.mobilePaper,PaperProps:a?.mobilePaper,children:m.jsx(xme,{children:t})}))}const wme=["props","getOpenDialogAriaText"],Cme=e=>{let{props:t,getOpenDialogAriaText:n}=e,r=Vn(e,wme);const{slots:o,slotProps:a,className:i,sx:s,format:c,formatDensity:f,enableAccessibleFieldDOMStructure:u,selectedSections:h,onSelectedSectionsChange:g,timezone:v,name:b,label:S,inputRef:w,readOnly:x,disabled:R,localeText:k}=t,T=C.useRef(null),$=Ps(),A=a?.toolbar?.hidden??!1,{open:z,actions:j,layoutProps:B,renderCurrentView:L,fieldProps:F,contextValue:E}=f4(Le({},r,{props:t,fieldRef:T,autoFocusView:!0,additionalViewProps:{},wrapperVariant:"mobile"})),N=o.field,D=xr({elementType:N,externalSlotProps:a?.field,additionalProps:Le({},F,A&&{id:$},!(R||x)&&{onClick:j.onOpen,onKeyDown:Rce(j.onOpen)},{readOnly:x??!0,disabled:R,className:i,sx:s,format:c,formatDensity:f,enableAccessibleFieldDOMStructure:u,selectedSections:h,onSelectedSectionsChange:g,timezone:v,label:S,name:b},w?{inputRef:w}:{}),ownerState:t});D.inputProps=Le({},D.inputProps,{"aria-label":n(F.value)});const V=Le({textField:o.textField},D.slots),I=o.layout??v4;let W=$;A&&(S?W=`${$}-label`:W=void 0);const X=Le({},a,{toolbar:Le({},a?.toolbar,{titleId:$}),mobilePaper:Le({"aria-labelledby":W},a?.mobilePaper)}),ie=mr(T,D.unstableFieldRef);return{renderPicker:()=>m.jsxs(b4,{contextValue:E,localeText:k,children:[m.jsx(N,Le({},D,{slots:V,slotProps:X,unstableFieldRef:ie})),m.jsx(Sme,Le({},j,{open:z,slots:o,slotProps:X,children:m.jsx(I,Le({},B,X?.layout,{slots:o,slotProps:X,children:L()}))}))]})}},W4=C.forwardRef(function(e,t){const n=nc(),r=Gr(),o=qz(e,"MuiMobileDatePicker"),a=Le({day:mp,month:mp,year:mp},o.viewRenderers),i=Le({},o,{viewRenderers:a,format:tR(r,o,!1),slots:Le({field:F4},o.slots),slotProps:Le({},o.slotProps,{field:c=>Le({},kx(o.slotProps?.field,c),Yz(o),{ref:t}),toolbar:Le({hidden:!1},o.slotProps?.toolbar)})}),{renderPicker:s}=Cme({props:i,valueManager:dl,valueType:"date",getOpenDialogAriaText:Vz({utils:r,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:i.localeText?.openDatePickerDialogue}),validator:gy});return s()});W4.propTypes={autoFocus:at.bool,className:at.string,closeOnSelect:at.bool,dayOfWeekFormatter:at.func,defaultValue:at.object,disabled:at.bool,disableFuture:at.bool,disableHighlightToday:at.bool,disableOpenPicker:at.bool,disablePast:at.bool,displayWeekNumber:at.bool,enableAccessibleFieldDOMStructure:at.any,fixedWeekNumber:at.number,format:at.string,formatDensity:at.oneOf(["dense","spacious"]),inputRef:Pz,label:at.node,loading:at.bool,localeText:at.object,maxDate:at.object,minDate:at.object,monthsPerRow:at.oneOf([3,4]),name:at.string,onAccept:at.func,onChange:at.func,onClose:at.func,onError:at.func,onMonthChange:at.func,onOpen:at.func,onSelectedSectionsChange:at.func,onViewChange:at.func,onYearChange:at.func,open:at.bool,openTo:at.oneOf(["day","month","year"]),orientation:at.oneOf(["landscape","portrait"]),readOnly:at.bool,reduceAnimations:at.bool,referenceDate:at.object,renderLoading:at.func,selectedSections:at.oneOfType([at.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),at.number]),shouldDisableDate:at.func,shouldDisableMonth:at.func,shouldDisableYear:at.func,showDaysOutsideCurrentMonth:at.bool,slotProps:at.object,slots:at.object,sx:at.oneOfType([at.arrayOf(at.oneOfType([at.func,at.object,at.bool])),at.func,at.object]),timezone:at.string,value:at.object,view:at.oneOf(["day","month","year"]),viewRenderers:at.shape({day:at.func,month:at.func,year:at.func}),views:at.arrayOf(at.oneOf(["day","month","year"]).isRequired),yearsOrder:at.oneOf(["asc","desc"]),yearsPerRow:at.oneOf([3,4])};const kme=["desktopModeMediaQuery"],i0=C.forwardRef(function(e,t){const n=Yr({props:e,name:"MuiDatePicker"}),{desktopModeMediaQuery:r=Tce}=n,o=Vn(n,kme);return $z(r,{defaultMatches:!0})?m.jsx(q4,Le({ref:t},o)):m.jsx(W4,Le({ref:t},o))}),Eme=250,Rme=300*1e3;function Tme(e,t){const n=C.useContext(EE),r=t.trim(),[o,a]=C.useState("");C.useEffect(()=>{const h=setTimeout(()=>a(r),Eme);return()=>clearTimeout(h)},[r]);const[i,s]=C.useState(),c=e?JSON.stringify(e.key):void 0;C.useEffect(()=>{if(!e||!n||o==="")return;let h=!0;return n.fetchQuery({queryKey:[...e.key,o],queryFn:({signal:g})=>e.run(o,g),staleTime:Rme}).then(g=>{h&&s({key:c,text:o,page:g})}).catch(()=>{h&&s({key:c,text:o,failed:!0})}),()=>{h=!1}},[n,c,o]);const f=e!==void 0&&n!==void 0&&r!=="",u=i!==void 0&&i.key===c&&i.text===r;return{active:f,searching:f&&!u,page:f&&u?i.page:void 0,failed:f&&u&&i.failed===!0}}function RR(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"?Mme(n):n}function Mme(e){const t=e[0];return e.length>=2&&(t==="'"||t==='"')&&e[e.length-1]===t?e.slice(1,-1).replace(/\\(["'\\ntr])/g,(n,r)=>r==="n"?`
|
|
469
469
|
`:r==="t"?" ":r==="r"?"\r":r):e}Ar.extend(YE);const nj=14,Ome=42;function $me(e){const t=(e.annotations??[]).filter(r=>r.trim().startsWith("#("));if(t.length===0)return;const n=[];for(const r of t){const o=r.trim(),a=o.match(/description="([^"]*)"/);if(a){n.push(a[1]);continue}const i=o.replace(/^#\(/,"").replace(/\)\s*$/,"").trim();i&&n.push(i)}return n.length>0?n.join(`
|
|
470
470
|
`):void 0}function Y4({given:e,value:t,onChange:n,options:r,optionsLoading:o,optionsFailed:a,optionsTruncated:i,optionSearch:s}){const c=e.label??e.name??"",{theme:f}=eo(),u=e.type??"string",h=$me(e),g=RR(u,e.default),v=g!==void 0?`Default: ${g===""?"(empty)":g}`:void 0,b=h||v?m.jsxs(m.Fragment,{children:[h,h&&v?m.jsx("br",{}):null,v]}):void 0,S=u==="string"||Wc(u)==="string",w=!Bc(u)||typeof t!="string"||dz(t),x=ee=>m.jsx(_a,{label:c,value:String(t),error:!0,inputProps:{readOnly:!0},helperText:m.jsxs(m.Fragment,{children:[`Not a ${ee}. Clear it to pick one.`,b?m.jsx("br",{}):null,b]}),slotProps:{input:{endAdornment:m.jsx(kw,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"}),R=Bc(u),k=e.control==="multiselect"&&R,T=Bc(u),$=e.control==="select"||e.control==="multiselect",A=$?T?typeof t=="string"?uz(t):[]:typeof t=="string"&&t!==""?[t]:[]:[],[z,j]=C.useState(""),B=Tme($?s:void 0,z);if($&&S&&w&&!(!k&&A.length>1)){const ee=Y=>{const ae=T?GE(Y):void 0;if(Y.length===0||ae===""){n(null);return}n(T?ae:Y[0])},se=Nme(B,i,s);return m.jsx(G4.Provider,{value:se,children:m.jsx(e7,{multiple:k,disableCloseOnSelect:k,freeSolo:!0,forcePopupIcon:!0,autoSelect:!k,options:B.page?.values??r??[],...B.page?{filterOptions:Y=>Y}:{},onInputChange:(Y,ae,J)=>j(J==="input"?ae:""),loading:o||B.searching,loadingText:B.searching?"Searching…":"Loading…",noOptionsText:a?"Options unavailable":"No matching values",slots:{paper:jme},value:k?A:A[0]??null,onChange:(Y,ae)=>ee(ae===null?[]:Array.isArray(ae)?ae:[ae]),renderInput:Y=>m.jsx(_a,{...Y,label:c,size:"small",placeholder:A.length!==0?void 0:t===""?"All":g??"All",error:a,helperText:a?m.jsxs(m.Fragment,{children:["Could not load the options for this control. Type a value to filter anyway.",b?m.jsx("br",{}):null,b]}):b,slotProps:{input:{...Y.InputProps,endAdornment:m.jsxs(m.Fragment,{children:[o&&m.jsx(ty,{size:16}),Y.InputProps.endAdornment]})},htmlInput:{...Y.inputProps,onBlur:ae=>{if(Y.inputProps.onBlur?.(ae),!k)return;const J=ae.target.value.trim();J!==""&&!A.includes(J)&&ee([...A,J])}}}}),fullWidth:!0})})}const L=Bc(u)&&Wc(u)==="number",{rangeMin:F,rangeMax:E}=e,N=L&&typeof t=="string"?pz(t):void 0,D=L&&typeof t=="string"?hz(t):void 0;if((L||u==="number")&&F!==void 0&&E!==void 0&&(!L||t===void 0||t===null||t===""||N!==void 0||D!==void 0)){const ee=D??(N!==void 0?[N,E]:void 0),se=L?ee?.[0]:typeof t=="number"?t:void 0;if(se===void 0&&t!==void 0&&t!==null&&t!=="")return x("number");const Y=se??F,ae=ee??[F,E],J=ae[1]>=E?`≥ ${ae[0]}`:`${ae[0]} to ${ae[1]}`,re=L&&t==="",te=se!==void 0||re;return m.jsxs(lC,{fullWidth:!0,children:[m.jsxs(yt,{component:"fieldset",sx:oe=>({m:0,minWidth:0,border:f.cardBorder,borderRadius:2,px:`${nj}px`,pt:0,pb:.75,minHeight:Ome,transition:"border-color 120ms ease-in","&:hover":{borderColor:oe.palette.text.secondary},"&:focus-within":{borderColor:oe.palette.text.primary}}),children:[m.jsx(Et,{component:"legend",variant:"caption",color:"text.secondary",sx:{px:.5,lineHeight:1},children:c}),m.jsxs(lr,{direction:"row",alignItems:"center",spacing:1,children:[m.jsx(Et,{variant:"body2",sx:{fontWeight:"fontWeightMedium"},children:te?re?"Any":L?J:String(Y):L?"Any":g??"Unset"}),te&&m.jsx(_g,{onClear:()=>n(null),sx:{p:0}})]}),m.jsx(UK,{size:"small",min:F,max:E,value:L?ae:Y,disableSwap:L,valueLabelDisplay:"auto","aria-label":L?void 0:c,getAriaLabel:L?oe=>oe===0?`${c} from`:`${c} to`:void 0,sx:{py:0,mt:.5},onChange:(oe,ce)=>{if(L){const[me,pe]=Array.isArray(ce)?[ce[0],ce[1]]:[ce,ce];if(me<=F&&pe>=E){n(null);return}n(pe>=E?fae(me):pae(me,pe));return}n(Array.isArray(ce)?ce[0]:ce)}}),m.jsxs(lr,{direction:"row",justifyContent:"space-between",children:[m.jsx(Et,{variant:"caption",color:"text.secondary",children:F}),m.jsx(Et,{variant:"caption",color:"text.secondary",children:E})]})]}),b&&m.jsx(cC,{sx:{mx:`${nj}px`},children:b})]})}const V=Bc(u)?Wc(u):void 0,I=V==="date"||V==="timestamp"||V==="timestamptz",W=typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t),X=t==null||W;if(I&&!W){const ee=Ame(t);if(ee!==void 0)return m.jsx(Dme,{label:c,state:ee,onChange:n,helperNode:b,defaultDisplay:g})}if(I&&X){const ee=W?Ar.utc(t):null;return m.jsx(e0,{dateAdapter:qC,children:m.jsx(i0,{label:c,value:ee?.isValid()?ee:null,onChange:se=>n(se?se.format("YYYY-MM-DD"):null),slotProps:{textField:{fullWidth:!0,size:"small",helperText:b},field:{clearable:!0,onClear:()=>n(null)}}})})}if(Wc(u)==="boolean"){const ee=typeof t=="string"?dae(t):void 0;if(t==null||t===""||ee!==void 0)return m.jsx(Pme,{label:c,picked:ee,emptyOverride:t==="",onChange:n,helperNode:b,defaultDisplay:g})}if(u==="boolean"){const ee=typeof t=="boolean";if(!ee&&t!==void 0&&t!==null)return x("true or false");const se=e.default?.trim()==="true";return m.jsxs(lC,{children:[m.jsxs(lr,{direction:"row",alignItems:"center",children:[m.jsx(dE,{control:m.jsx(U7,{checked:ee?t:se,onChange:Y=>n(Y.target.checked)}),label:c}),ee&&m.jsx(_g,{onClear:()=>n(null),edge:"end"})]}),b&&m.jsx(cC,{children:b})]})}if(u==="number"){const ee=typeof t=="number"?t:"",se=t!=null;return se&&t!==""&&typeof t!="number"?x("number"):m.jsx(_a,{label:c,type:"number",value:ee,onChange:Y=>{const ae=Y.target.value;n(ae===""?null:Number(ae))},placeholder:g,helperText:b,slotProps:{input:{endAdornment:se&&m.jsx(kw,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"})}if(u==="date"||u==="timestamp"||u==="timestamptz"){const ee=t instanceof Date?t:typeof t=="string"?(Y=>Y instanceof Date?Y:null)(kz(u,t)):null,se=ee?Ar.utc(ee):null;return t!=null&&t!==""&&ee===null?x("date"):m.jsx(e0,{dateAdapter:qC,children:m.jsx(i0,{label:c,value:se,onChange:Y=>n(Y?xae(Y,ee??void 0):null),slotProps:{textField:{fullWidth:!0,size:"small",helperText:b},field:{clearable:!0,onClear:()=>n(null)}}})})}const ie=typeof t=="string"?t:"",G=t!=null;return m.jsx(_a,{label:c,value:ie,onChange:ee=>n(ee.target.value),placeholder:G?void 0:g??(u.startsWith("filter<")?u:void 0),helperText:b,slotProps:{input:{endAdornment:G&&m.jsx(kw,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"})}function _g({onClear:e,edge:t,sx:n}){return m.jsx(Eo,{size:"small","aria-label":"Clear value",onClick:e,edge:t,sx:[{minWidth:24,minHeight:24},...Array.isArray(n)?n:[n]],children:m.jsx(zae,{fontSize:"small"})})}function kw({onClear:e}){return m.jsx(pE,{position:"end",children:m.jsx(_g,{onClear:e,edge:"end"})})}const Qv="__any__";function Pme({label:e,picked:t,emptyOverride:n,onChange:r,helperNode:o,defaultDisplay:a}){const i=t??(n?Qv:"");return m.jsx(yt,{"data-testid":"boolean-filter",children:m.jsxs(_a,{select:!0,label:e,value:i,size:"small",fullWidth:!0,helperText:o,slotProps:{select:{displayEmpty:!0,renderValue:s=>s==="true"||s==="false"?s:s===Qv?"Any":a||"Any"},input:{endAdornment:i!==""?m.jsx(_g,{onClear:()=>r(null),sx:{mr:2}}):void 0}},onChange:s=>{s.target.value!==Qv&&r(s.target.value)},children:[n&&m.jsx(Si,{value:Qv,children:"Any"}),m.jsx(Si,{value:"true",children:"true"}),m.jsx(Si,{value:"false",children:"false"})]})})}function Ame(e){if(e==null)return{kind:"unset"};if(typeof e!="string")return;if(e==="")return{kind:"any"};const t=mz(e);if(t!==void 0)return{kind:"preset",key:t};const n=gz(e);if(n!==void 0)return{kind:"days",...n}}const Zv="__custom__",Ew="__any__";function Dme({label:e,state:t,onChange:n,helperNode:r,defaultDisplay:o}){const a=t.kind==="days"?`days:${t.firstDay}/${t.lastDay}`:t.kind==="preset"?`preset:${t.key}`:t.kind,[i,s]=C.useState(t.kind==="days"),[c,f]=C.useState(t.kind==="days"?{from:t.firstDay,to:t.lastDay}:{});C.useEffect(()=>{t.kind==="days"?(s(!0),f({from:t.firstDay,to:t.lastDay})):t.kind!=="unset"&&s(!1)},[a]);const u=t.kind!=="unset",h=i?Zv:t.kind==="preset"?t.key:t.kind==="any"?Ew:"",g=b=>{f(b),b.from&&b.to&&!Ar.utc(b.to).isBefore(Ar.utc(b.from))&&n(gae(b.from,b.to))},v=b=>{const S=b?Ar.utc(b):null;return S?.isValid()?S:null};return m.jsxs(lr,{direction:"row",spacing:1,"data-testid":"time-range",children:[m.jsxs(_a,{select:!0,label:e,value:h,size:"small",fullWidth:!0,helperText:r,slotProps:{select:{displayEmpty:!0,renderValue:b=>{if(b===Zv)return"Custom range";if(b===Ew)return"Any time";const S=Ng.find(w=>w.key===b);return S?S.label:o??"Any time"}},input:{endAdornment:u?m.jsx(_g,{onClear:()=>{s(!1),f({}),n(null)},sx:{mr:2}}):void 0}},onChange:b=>{const S=b.target.value;if(S===Zv){s(!0);return}s(!1);const w=hae(S);w!==void 0&&n(w)},children:[t.kind==="any"&&m.jsx(Si,{value:Ew,children:"Any time"}),Ng.map(b=>m.jsx(Si,{value:b.key,children:b.label},b.key)),m.jsx(Si,{value:Zv,children:"Custom range"})]}),i&&m.jsxs(e0,{dateAdapter:qC,children:[m.jsx(i0,{label:"From",value:v(c.from),onChange:b=>g({...c,from:b?b.format("YYYY-MM-DD"):void 0}),slotProps:{textField:{size:"small"}}}),m.jsx(i0,{label:"To",value:v(c.to),minDate:v(c.from)??void 0,onChange:b=>g({...c,to:b?b.format("YYYY-MM-DD"):void 0}),slotProps:{textField:{size:"small"}}})]})]})}const G4=C.createContext(void 0);function jme({children:e,...t}){const n=C.useContext(G4);return m.jsxs(Ga,{...t,children:[e,n&&m.jsx(yt,{role:"note",sx:{px:2,py:1,borderTop:1,borderColor:"divider",color:"text.secondary",typography:"caption"},children:n})]})}const Jv=e=>e.toLocaleString("en-US");function Nme(e,t,n){if(e.active)return e.searching?"Searching all values…":e.failed?`Could not search all values. Showing matches in the first ${Jv(fd)}.`:e.page?.truncated?`Showing the first ${Jv(QE)} matches. Keep typing to narrow them.`:void 0;if(t)return n?`Showing the first ${Jv(fd)} values. Type to search them all.`:`Showing the first ${Jv(fd)} values. A value not listed can still be typed.`}const Ime=C.createContext(void 0),Qp=()=>C.useContext(Ime),Jm="remove-badge",Lme={[`& .${Jm}`]:{opacity:0},[`&:hover .${Jm}, &:focus-within .${Jm}`]:{opacity:1},"@media (hover: none)":{[`& .${Jm}`]:{opacity:1}}};function zme({label:e,onRemove:t,disabledReason:n,inset:r=0}){const{theme:o}=eo(),a=n!==void 0,i=m.jsx(Eo,{className:Jm,"aria-label":e,"aria-disabled":a||void 0,...a?{"aria-description":n}:{},onClick:s=>{s.stopPropagation(),a||t()},onPointerDown:s=>s.stopPropagation(),sx:s=>({position:"absolute",top:-8-r,right:-8-r,zIndex:3,width:18,height:18,p:0,borderRadius:"50%",border:`1px solid ${Nd(o.cardBorder)}`,bgcolor:s.palette.background.paper,color:s.palette.text.secondary,cursor:a?"default":"pointer",transition:`opacity ${py}`,...hy,"&:hover":{bgcolor:s.palette.background.paper,color:a?s.palette.text.secondary:s.palette.text.primary,borderColor:nz(o.cardBorder,o.tileTitle)}}),children:m.jsx(Gp,{sx:{fontSize:12}})});return a?m.jsx(ga,{title:n,children:i}):i}const TR=e=>e.required===!0,Fme=(e,t)=>e==null||e===""&&!Cz(t);function _me(e,t,n){return e.filter(r=>r.name!==void 0&&TR(r)&&Fme(t.get(r.name),r.type)&&(n?.[r.name]===void 0||n[r.name]===null))}function Bme(e,t){if(!t||e.length===0)return[];const n=new Set(t);return e.filter(r=>r.name&&n.has(r.name))}const K4=e=>e.label??e.name??"";function X4(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function Ume(e){const t=e.map(K4);return`Pick a value for ${X4(t)} to see this report.`}function Vme(e){return`Waiting for ${X4(e.map(K4))}.`}const rk=28,Hme=/^\d{4}-\d{2}-\d{2}$/,Q4=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"});function Rw(e){if(!Hme.test(e))return e;const t=new Date(`${e}T00:00:00Z`);return Number.isNaN(t.getTime())?e:Q4.format(t)}function qme(e){if(e.length===0)return"";const t=e.join(", ");return t.length<=rk||e.length===1?s0(t):`${s0(e[0]??"")} +${e.length-1}`}function s0(e){return e.length>rk?`${e.slice(0,rk-1)}…`:e}function Wme(e){if(TR(e))return"Required";const t=e.type??"string",n=RR(t,e.default);if(n!==void 0&&n!=="")return Z4(t,n);const r=Wc(t)??t;return e.control==="select"||e.control==="multiselect"||r==="string"?"All":"Any"}function Z4(e,t){if(!Bc(e))return s0(Rw(t));const n=Wc(e);if(n==="string"&&dz(t))return qme(uz(t));if(n==="number"){const r=hz(t);if(r)return`${r[0]}–${r[1]}`;const o=pz(t);if(o!==void 0)return`≥ ${o}`}if(n==="date"||n==="timestamp"||n==="timestamptz"){const r=mz(t);if(r)return Ng.find(a=>a.key===r)?.label??t;const o=gz(t);if(o)return`${Rw(o.firstDay)} – ${Rw(o.lastDay)}`}return s0(t)}function Yme(e,t){return t==null?Wme(e):t instanceof Date?Number.isNaN(t.getTime())?"":Q4.format(t):typeof t=="boolean"?t?"Yes":"No":typeof t=="number"?String(t):t===""?"(empty)":Z4(e.type??"string",t)}function Gme(e){const{given:t,value:n,onChange:r}=e,{theme:o}=eo(),a=o.ui,i=Qp(),[s,c]=C.useState(null),f=t.name??"",u=t.label??f,h=n!=null,g=Yme(t,n),v=s!==null,b=i?.stateOf(f),S=b?.problem,w=b?.fixed,x=m.jsxs(J4,{name:f,set:h,open:v,problem:S,fixed:w!==void 0,required:!h&&TR(t),children:[m.jsxs(ll,{"aria-haspopup":"dialog","aria-expanded":v,"aria-label":`${u}: ${g}`,onClick:R=>c(R.currentTarget),sx:R=>({height:"100%",borderRadius:a.radius.control,pl:"10px",pr:h?"4px":"8px",gap:"6px",fontFamily:"inherit",fontSize:a.type.control.fontSize,lineHeight:1,minWidth:0,color:R.palette.text.primary}),children:[m.jsx(yt,{component:"span",sx:R=>({color:h?o.accent:R.palette.text.secondary,whiteSpace:"nowrap"}),children:u}),m.jsx(yt,{component:"span",sx:{fontWeight:a.type.control.fontWeight,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:g}),!h&&m.jsx(Doe,{"aria-hidden":!0,sx:R=>({fontSize:16,color:R.palette.text.secondary,transform:v?"rotate(180deg)":"none"})})]}),h&&m.jsx(Eo,{"aria-label":`Clear ${u}`,onClick:()=>r(null),sx:{width:22,height:22,mr:"4px",borderRadius:"4px",color:o.accent},children:m.jsx(Gp,{sx:{fontSize:14}})})]});return m.jsxs(m.Fragment,{children:[S?m.jsx(ga,{title:S,children:x}):x,m.jsxs(dL,{className:ul.filterPopover,open:v,anchorEl:s,onClose:()=>c(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{role:"dialog","aria-label":`${u} filter`,sx:{mt:.75,p:1.5,width:300,maxWidth:"calc(100vw - 32px)",boxSizing:"border-box",borderRadius:a.radius.tile,border:o.cardBorder,boxShadow:o.shadow.lift}}},children:[m.jsx(Y4,{...e}),i&&m.jsxs(yt,{sx:R=>({mt:1.5,pt:1,borderTop:`1px solid ${R.palette.divider}`,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:.5}),children:[S&&m.jsx(Et,{sx:{...a.type.caption,color:"warning.main"},children:S}),w!==void 0&&m.jsx(Et,{sx:R=>({...a.type.caption,color:R.palette.text.secondary}),children:w}),m.jsx(Qme,{name:f,type:t.type,text:Kme(n,t.type)}),w===void 0?m.jsx(wr,{size:"small","aria-label":`Edit filter ${f}`,"aria-haspopup":"dialog",onClick:()=>{c(null),i.onEdit(f)},sx:{px:.75,minWidth:0,...a.type.control},children:"Filter settings…"}):b?.openModel&&m.jsx(wr,{size:"small",onClick:()=>{c(null),b.openModel?.()},sx:{px:.75,minWidth:0,...a.type.control},children:"Open the model"})]})]})]})}function Kme(e,t){if(e!=null)return Sz(e,t)}function Xme(e,t){return e===void 0||!t?.startsWith("filter<")?e:/^f(['"])([\s\S]*)\1$/.exec(e)?.[2]??e}function Qme({name:e,type:t,text:n}){const r=Qp(),o=eo().theme.ui;if(!r?.setStartingValue)return null;const a=r.setStartingValue,i=Xme(r.startingValueOf?.(e),t),s={px:.75,minWidth:0,...o.type.control};return m.jsxs(m.Fragment,{children:[i!==void 0&&i===n&&m.jsx(Et,{sx:c=>({...o.type.caption,color:c.palette.text.secondary,px:.75}),children:"The report opens with this value."}),n!==void 0&&n!==i&&m.jsx(wr,{size:"small",onClick:()=>a(e,n),sx:s,children:"Open the report with this value"}),i!==void 0&&m.jsx(wr,{size:"small",onClick:()=>a(e,void 0),sx:s,children:"Open at the default instead"})]})}function J4({name:e,set:t=!1,open:n=!1,unused:r=!1,problem:o,fixed:a=!1,required:i=!1,children:s}){const{theme:c}=eo(),f=c.ui,u=Qp();return m.jsxs(yt,{className:ul.filter,"data-filter":e,"data-set":t||void 0,"data-problem":o?!0:void 0,"data-required":i||void 0,sx:h=>({position:"relative",display:"inline-flex",alignItems:"center",height:f.size.control,boxSizing:"border-box",borderRadius:f.radius.control,border:"1px solid",borderStyle:r?"dashed":"solid",borderColor:o||i?h.palette.warning.main:t?`color-mix(in srgb, ${c.accent} 45%, transparent)`:n?c.accent:Nd(c.cardBorder),bgcolor:t?`color-mix(in srgb, ${c.accent} 8%, ${h.palette.background.paper})`:h.palette.background.paper,opacity:r?.75:1,transition:`border-color ${py}`,...hy,"&:hover":{borderColor:t||n||o?void 0:nz(c.cardBorder,c.tileTitle)},maxWidth:"100%",...Lme}),children:[s,u&&!a&&m.jsx(zme,{label:`Remove filter ${e}`,onRemove:()=>u.onRemove(e)})]})}function Zme({name:e,label:t,unused:n=!0}){const r=Qp(),o=eo().theme.ui;if(!r)return null;const a=r.stateOf(e)?.problem,i=m.jsx(J4,{name:e,unused:n,problem:a,children:m.jsxs(ll,{"aria-label":`Edit filter ${e}`,"aria-haspopup":"dialog",onClick:()=>r.onEdit(e),sx:s=>({height:"100%",borderRadius:o.radius.control,px:"10px",gap:"6px",fontFamily:"inherit",fontSize:o.type.control.fontSize,lineHeight:1,color:s.palette.text.secondary,whiteSpace:"nowrap"}),children:[m.jsx("span",{children:t}),n&&m.jsx(yt,{component:"span",sx:{fontStyle:"italic"},children:"Unused"})]})});return a?m.jsx(ga,{title:a,children:i}):i}function Jme(){const{theme:e}=eo(),t=e.ui,n=Qp();if(!n)return null;const r=n.addDisabledReason!==void 0;return m.jsx(ga,{title:n.addDisabledReason??"",children:m.jsx("span",{children:m.jsx(wr,{variant:"outlined",startIcon:m.jsx(Sx,{}),"aria-label":"Add filter","aria-haspopup":"dialog",disabled:r,onClick:()=>n.onAdd(),sx:o=>({height:t.size.control,minHeight:t.size.control,px:1.25,borderRadius:t.radius.control,borderStyle:"dashed",borderColor:Nd(e.cardBorder),color:o.palette.text.secondary,boxShadow:"none",...t.type.control,"& .MuiButton-startIcon":{mr:.5},"& .MuiButton-startIcon svg":{fontSize:16}}),children:"Filter"})})})}function MR({givens:e,values:t,onChange:n,onReset:r,canReset:o,layout:a="panel",options:i,optionsLoading:s,optionsFailed:c,optionsTruncated:f,optionSearch:u,apply:h,title:g}){const v=Qp();if(e.length===0&&!(v&&a==="bar"))return null;const b=Array.from(t.values()).some(k=>k!==null),S=o??b,w=k=>{if(k===void 0)return{};const T=u?.get(k);return{...f?.has(k)?{optionsTruncated:!0}:{},...T?{optionSearch:T}:{}}},x=e.map(k=>m.jsx(yt,{children:m.jsx(Y4,{given:k,value:k.name?t.get(k.name):void 0,onChange:T=>k.name&&n(k.name,T),options:k.name?i?.get(k.name):void 0,optionsLoading:s,optionsFailed:k.name?c?.has(k.name):void 0,...w(k.name)})},k.name)),R=m.jsxs(lr,{direction:"row",alignItems:"center",spacing:1,children:[h&&m.jsx(wr,{variant:"contained",size:"small",disableElevation:!0,onClick:h.onApply,disabled:!h.pending,children:"Apply"}),S&&m.jsx(wr,{variant:"text",size:"small",onClick:r,children:"Reset"})]});return a==="bar"?m.jsxs(lr,{direction:"row",role:"group","aria-label":g??"Filters",useFlexGap:!0,sx:{flexWrap:"wrap",alignItems:"center",gap:1},children:[e.map(k=>m.jsx(Gme,{given:k,value:k.name?t.get(k.name):void 0,onChange:T=>k.name&&n(k.name,T),options:k.name?i?.get(k.name):void 0,optionsLoading:s,optionsFailed:k.name?c?.has(k.name):void 0,...w(k.name)},k.name)),v?.unrendered.map(k=>m.jsx(Zme,{name:k.name,label:k.label},k.name)),m.jsx(Jme,{}),m.jsx(yt,{sx:{ml:"auto"},children:R})]}):m.jsxs(Ga,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[m.jsxs(lr,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:2},children:[m.jsx(Et,{variant:"subtitle2",sx:{fontWeight:"fontWeightMedium",color:"text.primary"},children:g??"Filters"}),R]}),m.jsx(yt,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",alignItems:"start",columnGap:3,rowGap:2.5},children:x})]})}const ege=/^(https?|mailto|tel):/i,tge=/^[a-z][a-z0-9+.-]*:/i;function nge({href:e,title:t,children:n,context:r}){const o=!!e&&tge.test(e),a=!!e&&!o&&!e.startsWith("/")&&!e.startsWith("#");if(!e||!a||!r){const h=o&&!ege.test(e??"");return m.jsx("a",{href:h?void 0:e,title:t,...o?{target:"_blank",rel:"noopener noreferrer"}:{},children:n})}const i=r.sourcePath&&r.sourcePath.includes("/")?r.sourcePath.slice(0,r.sourcePath.lastIndexOf("/")+1):"",s=new URL(e,`https://malloy.invalid/${i}`),c=s.pathname.slice(1)+s.search+s.hash,f=`/${r.environmentName}/${r.packageName}/${c}`,{onNavigate:u}=r;return m.jsx("a",{href:f,title:t,onClick:u?h=>{h.preventDefault(),u(f,h)}:void 0,children:n})}const rge=e=>({document:{"& > :first-child, & > div:only-child > :first-child":{mt:0},"& > :last-child, & > div:only-child > :last-child":{mb:0},"& h1, & h2, & h3, & h4, & h5, & h6":{fontWeight:"fontWeightMedium",color:"text.primary",mb:1,mt:2},"& h1":{fontSize:"28px"},"& h2":{fontSize:"24px"},"& h3":{fontSize:"20px"},"& p, & ul, & ol":{color:"text.primary",...e.type.prose,mb:1,maxWidth:Noe},"& li":{mb:.5}},caption:{color:"text.secondary",typography:"body2","& > :first-of-type":{mt:0},"& > :last-child":{mb:0},"& h1, & h2, & h3, & h4, & h5, & h6":{fontSize:"inherit",fontWeight:"fontWeightMedium",m:"0.5em 0 0.25em"},"& p":{m:"0.5em 0"},"& ul, & ol":{m:"0.5em 0",pl:3},"& code":{fontFamily:e.font.mono,fontSize:"0.9em"}}});function oge({alt:e}){return m.jsx(m.Fragment,{children:e})}function jp({children:e,variant:t="caption",links:n,sx:r}){const{theme:o}=eo();return m.jsx(yt,{sx:[rge(o.ui)[t],{fontFamily:o.font.family},...Array.isArray(r)?r:[r]],children:m.jsx(Rte,{options:{forceBlock:t==="document",disableParsingRawHTML:!0,overrides:{a:{component:nge,props:{context:n}},img:{component:oge}}},children:e})})}const age=new Set(["bar","line","chart","scatter_chart"]),ige=new Set(["table","dashboard","shape_map","segment_map","list","list_detail","big_value","cell","link","image"]);function H1e(e,t){return t==="fill"?"container":t==="fixed"||!e?"content":age.has(e)?"container":"content"}function q1e(e,t){return t==="fixed"?!0:t==="fill"?!1:e!==void 0&&ige.has(e)}function W1e(e){return e==="dashboard"?3:2}function sge(e,t){let n=e.firstElementChild;for(let r=1;r<t&&n;r++)n=n.firstElementChild;return n}function Y1e(e,t){const n=sge(e,t);return n&&(n.scrollHeight||n.offsetHeight)||0}const lge=400,cge=700,uge=600,dge=800,fge=400,rj=2e3;function pge(e){return e===void 0?rj:Math.min(e,rj)}function oj({sizing:e,contentHeight:t,maxHeight:n,fillHeight:r}){if(e==="container")return n??fge;if(t===void 0||t<=0)return pge(n);const o=n===void 0?t:Math.min(n,t);return r===void 0?o:Math.max(o,r)}const Np={opening:e=>e?`Opening the ${e}…`:"Opening…",running:"Running…",loading:"Loading…"};function ya({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:a=2,textVariant:i="body2"}){const s=m.jsxs(yt,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:a},children:[m.jsx(ty,{size:t,color:n,thickness:r}),e&&m.jsx(Et,{variant:i,color:"text.secondary",children:e})]});return o?m.jsx(yt,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:s}):s}let Pm;function hge(){return Pm||(Pm=Co(()=>import("./index-DFDVJFPm.js"),[]),Pm.catch(()=>{Pm=void 0})),Pm}function eF(){typeof window>"u"||hge().catch(()=>{})}const tF=jn(m.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}));function gp({sx:e,...t}){const{theme:n}=eo();return m.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 mge=new Set(["warn","error"]);function gge(e){if(!e?.length)return;const t=[];let n=!1;for(const r of e)!r.message||!mge.has(r.severity??"")||(r.severity==="error"&&(n=!0),t.includes(r.message)||t.push(r.message));if(t.length)return{severity:n?"error":"warn",title:t.join(`
|
|
471
|
-
`)}}const yge=C.lazy(()=>Co(()=>import("./RenderedResult-DnBtf-cI.es-DalkcU9E.js"),[]).then(e=>e.c));function OR({result:e,maxHeight:t,maxResultSize:n=0,renderLogs:r,drill:o,fill:a=!1}){const i=C.useRef(null);C.useEffect(()=>eF(),[]);const[s,c]=C.useState(void 0),[f,u]=C.useState(void 0),[h,g]=C.useState(!1),[v,b]=C.useState(void 0),S=gge(r);if(C.useEffect(()=>{const k=i.current;if(!a||!k)return;const T=new ResizeObserver(([$])=>b(Math.round($.contentRect.height)));return T.observe(k),()=>T.disconnect()},[a,!!e,h]),!e)return null;if(n>0&&e.length>n&&!h)return m.jsxs(yt,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[m.jsx(qte,{sx:{fontSize:48,color:"#757575"}}),m.jsx(Et,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),m.jsx(wr,{variant:"contained",color:"primary",onClick:()=>g(!0),children:"Proceed"})]});const w=m.jsx(ya,{text:Np.loading,centered:!0,size:32}),x=oj({sizing:s,contentHeight:f,maxHeight:t,fillHeight:a?v:void 0}),R=m.jsx(C.Suspense,{fallback:w,children:m.jsx(yge,{result:e,height:x,onSizeChange:u,onSizing:c,drill:o,fill:a})});return m.jsxs(yt,{ref:i,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden",...a&&{flex:`1 1 ${oj({sizing:s,contentHeight:f,maxHeight:t})}px`,minHeight:0}},children:[a?m.jsx(yt,{sx:{position:"absolute",inset:0},children:R}):R,S&&m.jsx(yt,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:m.jsx(ga,{title:S.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:m.jsx(gp,{"aria-label":"Render tag warnings",children:m.jsx(tF,{fontSize:"small",color:S.severity==="error"?"error":"warning"})})})})]})}function $R({state:e,context:t,loadingText:n=Np.running,maxHeight:r,maxResultSize:o,drill:a,fill:i,transform:s}){const{data:c,isSuccess:f,isError:u,error:h,fetchStatus:g,isPlaceholderData:v}=e,b=f||g==="fetching";C.useEffect(()=>{b&&eF()},[b]);const S=c?.data.result,w=C.useMemo(()=>S!==void 0&&s?s(S):S,[S,s]);if(u)return m.jsx(yt,{sx:{p:2},children:m.jsx(Ma,{context:t,error:h})});if(!f)return m.jsx(ya,{text:g==="idle"?Np.loading:n});const x=m.jsx(OR,{result:w,maxHeight:r,maxResultSize:o,renderLogs:c.data.renderLogs,drill:a,fill:i});return m.jsxs(yt,{"aria-busy":v||void 0,sx:{position:"relative",display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...i?{height:"100%"}:{},"& > .result-body":{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...i?{height:"100%"}:{},opacity:v?.55:1,transition:v?"opacity 160ms ease 200ms":"opacity 120ms ease","@media (prefers-reduced-motion: reduce)":{transition:"none"}}},children:[v&&m.jsx(sL,{"aria-label":n,sx:{position:"absolute",top:0,left:0,right:0,height:2,zIndex:1,bgcolor:"transparent",borderRadius:1}}),m.jsx(yt,{className:"result-body",children:x})]})}const hd=()=>typeof performance<"u"?performance.now():Date.now(),vge=jn(m.jsx("path",{d:"m16.95 6-3.57 4.55 1.43 1.43c1.03-1.31 4.98-6.37 4.98-6.37C20.3 4.95 19.83 4 19 4H6.83l2 2zM2.81 2.81 1.39 4.22 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-2.17l5.78 5.78 1.41-1.41z"})),bge=3;function xge(e,t){if(e===void 0)return[];const n=new Set(e);return t.flatMap(r=>r.name&&!n.has(r.name)?[r.label??r.name]:[])}function Sge(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function wge({ignored:e}){const{theme:t}=eo();if(e.length===0)return null;const n=e.length>bge?`Doesn't respond to ${e.length} filters`:`Doesn't respond to ${e.join(", ")}`;return m.jsxs(yt,{"data-testid":"tile-filter-tag",title:`This tile's query never reads ${Sge(e)}, so changing ${e.length===1?"it":"them"} won't change this tile`,sx:{display:"inline-flex",alignItems:"center",gap:.5,maxWidth:"100%",mb:1,alignSelf:"flex-start",px:.75,py:.125,border:1,borderColor:"warning.main",borderRadius:1,fontSize:11,lineHeight:1.6,color:"warning.main",fontFamily:t.font.family},children:[m.jsx(vge,{sx:{fontSize:12}}),m.jsx(yt,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]})}function Cge(e,t){if(e==="linear")return{layout:"linear",columns:1,widths:!1,insertBetween:!0};const n=t??Moe;return{layout:"grid",columns:n,widths:n>1,insertBetween:!1}}const nF=20,kge={radius:"8px",padding:`${nF}px`};function G1e(e,t=kge){return{"--malloy-render--font-family":e.font.family,"--malloy-render--table-font-size":`${e.font.size}px`,"--malloy-render--table-header-color":e.tableHeader,"--malloy-render--table-body-color":e.tableBody,"--malloy-render--table-border":e.border,"--malloy-render--table-pinned-border":e.pinnedBorder,"--malloy-render--tile-background":e.tile,"--publisher-dashboard-root":e.dashboardRoot,"--malloy-render--label-color":e.tileTitle,"--malloy-render--value-color":e.valueColor,"--publisher-drill-link":e.drillLink,"--publisher-dashboard-card-radius":t.radius,"--publisher-dashboard-card-padding":t.padding,"--publisher-dashboard-card-border":e.cardBorder}}const Ege={query:120,text:72};function l0({borderless:e=!1,chrome:t="card",kind:n="query",sx:r,cardRef:o,children:a}){const{theme:i}=eo(),s=i.ui,c=e||t==="none";return m.jsx(Ga,{ref:o,className:ul.tile,elevation:0,"data-chrome":t,"data-tile-kind":n,sx:[{border:c?"none":i.cardBorder,borderRadius:c?0:s.radius.tile,background:c?"none":i.tile,overflow:"hidden",display:"flex",flexDirection:"column",minWidth:0,minHeight:t==="none"?0:Ege[n],p:t==="none"?0:e?"12px 0":`${nF}px`},...Array.isArray(r)?r:[r]],children:a})}const Rge=ul.tileHeading;function rF({title:e,subtitle:t,tooltip:n,action:r,quiet:o=!1}){const{theme:a}=eo(),i=a.ui;return m.jsxs(yt,{className:Rge,sx:{pb:o?.5:1.5,display:"flex",alignItems:"flex-start",gap:1},children:[m.jsxs(yt,{sx:{minWidth:0,flex:1},children:[m.jsx(Et,{component:"div",sx:{...i.type.tileTitle,display:"block",color:a.tileTitle,fontFamily:a.font.family},title:n,children:e}),t!==void 0&&m.jsx(Et,{component:"div",sx:{...i.type.caption,display:"block",mt:"2px",color:a.tileTitle,fontFamily:a.font.family,opacity:.75},children:t})]}),r]})}const Tge=-1;function Mge(){const[e,t]=C.useState(!1),n=C.useRef(null);return{stickyRef:C.useCallback(r=>{n.current?.disconnect(),n.current=null,!(!r||typeof IntersectionObserver>"u")&&(n.current=new IntersectionObserver(([o])=>{if(!o)return;const a=o.boundingClientRect.top<(o.rootBounds?.height??window.innerHeight)/2;t(o.intersectionRatio<1&&a)},{threshold:[1]}),n.current.observe(r))},[]),stuck:e}}const Oge=4,$ge=2;function ok({layout:e,notice:t,header:n,controls:r,children:o,sx:a}){return m.jsxs(lr,{className:ul.report,"data-layout":e,sx:[{gap:$ge},...Array.isArray(a)?a:[a]],children:[t,n,r,o]})}function oF({title:e,description:t,actions:n}){const r=eo().theme.ui;return m.jsxs(lr,{className:ul.header,sx:{gap:1.5},children:[m.jsxs(lr,{direction:"row",sx:{alignItems:"center",gap:2},children:[m.jsx(Et,{component:"h1",className:ul.title,sx:{...r.type.pageTitle,m:0,flex:1,minWidth:0},children:e}),n&&m.jsx(yt,{sx:{my:"-4px"},children:n})]}),t]})}function Ix({sx:e,children:t}){return m.jsx(l0,{chrome:"none",kind:"text",...e?{sx:e}:{},children:t})}function aF({children:e}){const{theme:t}=eo(),{stickyRef:n,stuck:r}=Mge();return m.jsx(yt,{ref:n,className:ul.filterRow,"data-stuck":r||void 0,sx:{position:"sticky",top:`${Tge}px`,zIndex:Oge,bgcolor:r?"background.default":"transparent",pb:1,pt:1,mt:-1,boxShadow:r?`0 1px 0 ${Nd(t.cardBorder)}`:"none",transition:`box-shadow ${py}`,...hy},children:e})}const to=e=>{const t=new URL(e),n={};if(t.protocol!=="publisher:")throw new Error(`Failed to parse resource URI: ${e}`);const r=(t.hostname+t.pathname).split("/");for(let o=0;o<r.length;o+=2){const a=r[o];a==="environments"?n.environmentName=decodeURI(r[o+1])||void 0:a==="packages"?n.packageName=decodeURI(r[o+1])||void 0:a==="connections"?n.connectionName=decodeURI(r[o+1])||void 0:a==="models"&&(n.modelPath=decodeURI(r.slice(o+1).join("/"))||void 0)}if(n.versionId=t.searchParams.get("versionId")||void 0,!n.environmentName)throw new Error(`Failed to parse resource URI: ${e}`);return n},Lx=e=>{if(!e.environmentName)throw new Error(`Failed to encode resource URI, missing environment name: ${e}`);let t=`publisher://environments/${e.environmentName}`;return e.packageName&&(t+=`/packages/${e.packageName}`),e.connectionName&&(t+=`/connections/${e.connectionName}`),e.modelPath&&(t+=`/models/${e.modelPath}`),e.packageName&&e.versionId&&(t+=`?versionId=${e.versionId}`),t};function PR(e,t){if(e[t])return e;const n=e.default;return n?.[t]?n:e}const Pge=e=>PR(e,"MalloyTranslator"),Age=e=>PR(e,"parseAnnotation"),Dge=e=>PR(e,"ASTQuery");async function K1e(){return Pge(await Co(()=>import("./index-DM7_2PYo.js").then(e=>e.i),__vite__mapDeps([0,1])))}async function X1e(){return Age(await Co(()=>Promise.resolve().then(()=>tne),void 0))}async function jge(){return Dge(await Co(()=>import("./index-CHfG8VAW.js").then(e=>e.i),__vite__mapDeps([2,1])))}async function Nge(e){const t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return Array.from(new Uint8Array(t),n=>n.toString(16).padStart(2,"0")).join("")}function iF(e){return e.find(t=>t.authoritative)??e.find(t=>t.writeable)}function Ige({authoritative:e,mutable:t,versionId:n,canStore:r,readFailed:o}){const a=e?"host":t?"package":"browser",i=n!==void 0&&a==="package";return{savesTo:a,pinnedPackageSave:i,writer:o?void 0:e?r?"storage":void 0:i?void 0:t?"package":r?"storage":void 0}}async function Q1e(e,t){return e??(t===void 0?void 0:await Nge(t))}function Z1e({authoritative:e,mutable:t,pinnedPackageSave:n,workspace:r,readFailure:o,versionId:a}){return o!==void 0?`The saved copy could not be read, so Save is off: ${o}`:e&&r?r.writeable?r.description:`${r.description}: you cannot save into it.`:n?`Reading version ${a}: a version is a fixed point in history, so Save is off.`:t?"Save writes the file into the package.":r?`${r.description}: this server does not take writes.`:"This server does not take writes."}function J1e(e){return e instanceof Error?e.message:String(e)}function Lge(e){const t=e.response?.data;return t?.message?t.message:e instanceof Error?e.message:String(e)}async function eSe({apiClients:e,queryClient:t,environmentName:n,packageName:r,modelPath:o,source:a,expectedHash:i,invalidateOnError:s,invalidate:c,afterWrite:f}){let u;try{u=await e.models.updateModelSource(n,r,o,{source:a,expectedHash:i})}catch(g){for(const v of s)t.invalidateQueries({queryKey:v});throw new Error(Lge(g))}const h=u.data.contentHash;await f?.(h);for(const{queryKey:g,refetchType:v,wait:b}of c){const S=t.invalidateQueries({queryKey:g,...v?{refetchType:v}:{}});b&&await S}return h}function tSe(e,t){return t===void 0||!/\.(saved|save_undone)$/.test(e.type)||e.where==="package"?e:{...e,workspace:t}}function nSe(e){if(!("resourceUri"in e))return{environmentName:e.environmentName,packageName:e.packageName,versionId:void 0,namesBoth:!0};let t;try{t=to(e.resourceUri)}catch{t=void 0}return{environmentName:t?.environmentName??"",packageName:t?.packageName??"",versionId:t?.versionId,namesBoth:!!t?.environmentName&&!!t?.packageName}}class sF extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const lF=e=>e instanceof sF||e instanceof Error&&e.name==="DocumentNotFoundError",zge=String.raw`##?\|?[ \t]*(?:[([{<][ \t]*)?(?:(?:(?:row|source)[-_]?)?authorize|access[-_]?filter)(?=[)\]}>]|[ \t]|$)`;function cF(e,t){if(/[\r\n]/.test(t))return`A ${e} is one line; it cannot hold a line break.`;if(new RegExp(zge,"iu").test(t))return`A ${e} cannot contain what reads as an access-control tag (authorize, row_authorize, source_authorize or access_filter).`}const Am=e=>ax(e)?e:`\`${e}\``;function AR(e){const{title:t,modelPath:n,source:r,view:o}=e;if(t.trim()==="")return"A title cannot be empty.";const a=cF("title",t);if(a)return a;if(t.includes("|##"))return"A title cannot contain `|##`, which closes the report's artifact tag.";if(/["\\\r\n]/.test(n)||n.trim()==="")return`The model path ${JSON.stringify(n)} cannot be written as an import.`;for(const[i,s]of[["source",r],["view",o]])if(s.trim()===""||/[`\r\n\\]/.test(s))return`The ${i} name ${JSON.stringify(s)} cannot be written as a Malloy name.`}const Fge=e=>{const t=e.replace(/[-_]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},aj=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,_ge="report.malloy";function DR(e,t,n=_ge){const r=AR(e);if(r)throw new Error(r);const{modelPath:o,source:a,view:i}=e,s=e.title.trim(),c=aj(s),f=Am(`${a}_tiles`),u=Am(`${i}_tile`),h=`"${f} -> ${u}"`;return["##! experimental.givens",`##| artifact { layout=${t} title=${c}`," tiles=[",` ${h}`," ]",t==="grid"?"} dashboard { columns=12 }":"}","|##",`import { ${Am(a)} } from "${iz(o,n)}"`,"",`source: ${f} is ${Am(a)} extend {`,` # label=${aj(Fge(i))}`,` view: ${u} is ${Am(i)}`,"}",""].join(`
|
|
471
|
+
`)}}const yge=C.lazy(()=>Co(()=>import("./RenderedResult-DnBtf-cI.es-Bs8KIO86.js"),[]).then(e=>e.c));function OR({result:e,maxHeight:t,maxResultSize:n=0,renderLogs:r,drill:o,fill:a=!1}){const i=C.useRef(null);C.useEffect(()=>eF(),[]);const[s,c]=C.useState(void 0),[f,u]=C.useState(void 0),[h,g]=C.useState(!1),[v,b]=C.useState(void 0),S=gge(r);if(C.useEffect(()=>{const k=i.current;if(!a||!k)return;const T=new ResizeObserver(([$])=>b(Math.round($.contentRect.height)));return T.observe(k),()=>T.disconnect()},[a,!!e,h]),!e)return null;if(n>0&&e.length>n&&!h)return m.jsxs(yt,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[m.jsx(qte,{sx:{fontSize:48,color:"#757575"}}),m.jsx(Et,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),m.jsx(wr,{variant:"contained",color:"primary",onClick:()=>g(!0),children:"Proceed"})]});const w=m.jsx(ya,{text:Np.loading,centered:!0,size:32}),x=oj({sizing:s,contentHeight:f,maxHeight:t,fillHeight:a?v:void 0}),R=m.jsx(C.Suspense,{fallback:w,children:m.jsx(yge,{result:e,height:x,onSizeChange:u,onSizing:c,drill:o,fill:a})});return m.jsxs(yt,{ref:i,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden",...a&&{flex:`1 1 ${oj({sizing:s,contentHeight:f,maxHeight:t})}px`,minHeight:0}},children:[a?m.jsx(yt,{sx:{position:"absolute",inset:0},children:R}):R,S&&m.jsx(yt,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:m.jsx(ga,{title:S.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:m.jsx(gp,{"aria-label":"Render tag warnings",children:m.jsx(tF,{fontSize:"small",color:S.severity==="error"?"error":"warning"})})})})]})}function $R({state:e,context:t,loadingText:n=Np.running,maxHeight:r,maxResultSize:o,drill:a,fill:i,transform:s}){const{data:c,isSuccess:f,isError:u,error:h,fetchStatus:g,isPlaceholderData:v}=e,b=f||g==="fetching";C.useEffect(()=>{b&&eF()},[b]);const S=c?.data.result,w=C.useMemo(()=>S!==void 0&&s?s(S):S,[S,s]);if(u)return m.jsx(yt,{sx:{p:2},children:m.jsx(Ma,{context:t,error:h})});if(!f)return m.jsx(ya,{text:g==="idle"?Np.loading:n});const x=m.jsx(OR,{result:w,maxHeight:r,maxResultSize:o,renderLogs:c.data.renderLogs,drill:a,fill:i});return m.jsxs(yt,{"aria-busy":v||void 0,sx:{position:"relative",display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...i?{height:"100%"}:{},"& > .result-body":{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,minWidth:0,...i?{height:"100%"}:{},opacity:v?.55:1,transition:v?"opacity 160ms ease 200ms":"opacity 120ms ease","@media (prefers-reduced-motion: reduce)":{transition:"none"}}},children:[v&&m.jsx(sL,{"aria-label":n,sx:{position:"absolute",top:0,left:0,right:0,height:2,zIndex:1,bgcolor:"transparent",borderRadius:1}}),m.jsx(yt,{className:"result-body",children:x})]})}const hd=()=>typeof performance<"u"?performance.now():Date.now(),vge=jn(m.jsx("path",{d:"m16.95 6-3.57 4.55 1.43 1.43c1.03-1.31 4.98-6.37 4.98-6.37C20.3 4.95 19.83 4 19 4H6.83l2 2zM2.81 2.81 1.39 4.22 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-2.17l5.78 5.78 1.41-1.41z"})),bge=3;function xge(e,t){if(e===void 0)return[];const n=new Set(e);return t.flatMap(r=>r.name&&!n.has(r.name)?[r.label??r.name]:[])}function Sge(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function wge({ignored:e}){const{theme:t}=eo();if(e.length===0)return null;const n=e.length>bge?`Doesn't respond to ${e.length} filters`:`Doesn't respond to ${e.join(", ")}`;return m.jsxs(yt,{"data-testid":"tile-filter-tag",title:`This tile's query never reads ${Sge(e)}, so changing ${e.length===1?"it":"them"} won't change this tile`,sx:{display:"inline-flex",alignItems:"center",gap:.5,maxWidth:"100%",mb:1,alignSelf:"flex-start",px:.75,py:.125,border:1,borderColor:"warning.main",borderRadius:1,fontSize:11,lineHeight:1.6,color:"warning.main",fontFamily:t.font.family},children:[m.jsx(vge,{sx:{fontSize:12}}),m.jsx(yt,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]})}function Cge(e,t){if(e==="linear")return{layout:"linear",columns:1,widths:!1,insertBetween:!0};const n=t??Moe;return{layout:"grid",columns:n,widths:n>1,insertBetween:!1}}const nF=20,kge={radius:"8px",padding:`${nF}px`};function G1e(e,t=kge){return{"--malloy-render--font-family":e.font.family,"--malloy-render--table-font-size":`${e.font.size}px`,"--malloy-render--table-header-color":e.tableHeader,"--malloy-render--table-body-color":e.tableBody,"--malloy-render--table-border":e.border,"--malloy-render--table-pinned-border":e.pinnedBorder,"--malloy-render--tile-background":e.tile,"--publisher-dashboard-root":e.dashboardRoot,"--malloy-render--label-color":e.tileTitle,"--malloy-render--value-color":e.valueColor,"--publisher-drill-link":e.drillLink,"--publisher-dashboard-card-radius":t.radius,"--publisher-dashboard-card-padding":t.padding,"--publisher-dashboard-card-border":e.cardBorder}}const Ege={query:120,text:72};function l0({borderless:e=!1,chrome:t="card",kind:n="query",sx:r,cardRef:o,children:a}){const{theme:i}=eo(),s=i.ui,c=e||t==="none";return m.jsx(Ga,{ref:o,className:ul.tile,elevation:0,"data-chrome":t,"data-tile-kind":n,sx:[{border:c?"none":i.cardBorder,borderRadius:c?0:s.radius.tile,background:c?"none":i.tile,overflow:"hidden",display:"flex",flexDirection:"column",minWidth:0,minHeight:t==="none"?0:Ege[n],p:t==="none"?0:e?"12px 0":`${nF}px`},...Array.isArray(r)?r:[r]],children:a})}const Rge=ul.tileHeading;function rF({title:e,subtitle:t,tooltip:n,action:r,quiet:o=!1}){const{theme:a}=eo(),i=a.ui;return m.jsxs(yt,{className:Rge,sx:{pb:o?.5:1.5,display:"flex",alignItems:"flex-start",gap:1},children:[m.jsxs(yt,{sx:{minWidth:0,flex:1},children:[m.jsx(Et,{component:"div",sx:{...i.type.tileTitle,display:"block",color:a.tileTitle,fontFamily:a.font.family},title:n,children:e}),t!==void 0&&m.jsx(Et,{component:"div",sx:{...i.type.caption,display:"block",mt:"2px",color:a.tileTitle,fontFamily:a.font.family,opacity:.75},children:t})]}),r]})}const Tge=-1;function Mge(){const[e,t]=C.useState(!1),n=C.useRef(null);return{stickyRef:C.useCallback(r=>{n.current?.disconnect(),n.current=null,!(!r||typeof IntersectionObserver>"u")&&(n.current=new IntersectionObserver(([o])=>{if(!o)return;const a=o.boundingClientRect.top<(o.rootBounds?.height??window.innerHeight)/2;t(o.intersectionRatio<1&&a)},{threshold:[1]}),n.current.observe(r))},[]),stuck:e}}const Oge=4,$ge=2;function ok({layout:e,notice:t,header:n,controls:r,children:o,sx:a}){return m.jsxs(lr,{className:ul.report,"data-layout":e,sx:[{gap:$ge},...Array.isArray(a)?a:[a]],children:[t,n,r,o]})}function oF({title:e,description:t,actions:n}){const r=eo().theme.ui;return m.jsxs(lr,{className:ul.header,sx:{gap:1.5},children:[m.jsxs(lr,{direction:"row",sx:{alignItems:"center",gap:2},children:[m.jsx(Et,{component:"h1",className:ul.title,sx:{...r.type.pageTitle,m:0,flex:1,minWidth:0},children:e}),n&&m.jsx(yt,{sx:{my:"-4px"},children:n})]}),t]})}function Ix({sx:e,children:t}){return m.jsx(l0,{chrome:"none",kind:"text",...e?{sx:e}:{},children:t})}function aF({children:e}){const{theme:t}=eo(),{stickyRef:n,stuck:r}=Mge();return m.jsx(yt,{ref:n,className:ul.filterRow,"data-stuck":r||void 0,sx:{position:"sticky",top:`${Tge}px`,zIndex:Oge,bgcolor:r?"background.default":"transparent",pb:1,pt:1,mt:-1,boxShadow:r?`0 1px 0 ${Nd(t.cardBorder)}`:"none",transition:`box-shadow ${py}`,...hy},children:e})}const to=e=>{const t=new URL(e),n={};if(t.protocol!=="publisher:")throw new Error(`Failed to parse resource URI: ${e}`);const r=(t.hostname+t.pathname).split("/");for(let o=0;o<r.length;o+=2){const a=r[o];a==="environments"?n.environmentName=decodeURI(r[o+1])||void 0:a==="packages"?n.packageName=decodeURI(r[o+1])||void 0:a==="connections"?n.connectionName=decodeURI(r[o+1])||void 0:a==="models"&&(n.modelPath=decodeURI(r.slice(o+1).join("/"))||void 0)}if(n.versionId=t.searchParams.get("versionId")||void 0,!n.environmentName)throw new Error(`Failed to parse resource URI: ${e}`);return n},Lx=e=>{if(!e.environmentName)throw new Error(`Failed to encode resource URI, missing environment name: ${e}`);let t=`publisher://environments/${e.environmentName}`;return e.packageName&&(t+=`/packages/${e.packageName}`),e.connectionName&&(t+=`/connections/${e.connectionName}`),e.modelPath&&(t+=`/models/${e.modelPath}`),e.packageName&&e.versionId&&(t+=`?versionId=${e.versionId}`),t};function PR(e,t){if(e[t])return e;const n=e.default;return n?.[t]?n:e}const Pge=e=>PR(e,"MalloyTranslator"),Age=e=>PR(e,"parseAnnotation"),Dge=e=>PR(e,"ASTQuery");async function K1e(){return Pge(await Co(()=>import("./index-1Jwtzdx_.js").then(e=>e.i),__vite__mapDeps([0,1])))}async function X1e(){return Age(await Co(()=>Promise.resolve().then(()=>tne),void 0))}async function jge(){return Dge(await Co(()=>import("./index-Bp7WJqoi.js").then(e=>e.i),__vite__mapDeps([2,1])))}async function Nge(e){const t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return Array.from(new Uint8Array(t),n=>n.toString(16).padStart(2,"0")).join("")}function iF(e){return e.find(t=>t.authoritative)??e.find(t=>t.writeable)}function Ige({authoritative:e,mutable:t,versionId:n,canStore:r,readFailed:o}){const a=e?"host":t?"package":"browser",i=n!==void 0&&a==="package";return{savesTo:a,pinnedPackageSave:i,writer:o?void 0:e?r?"storage":void 0:i?void 0:t?"package":r?"storage":void 0}}async function Q1e(e,t){return e??(t===void 0?void 0:await Nge(t))}function Z1e({authoritative:e,mutable:t,pinnedPackageSave:n,workspace:r,readFailure:o,versionId:a}){return o!==void 0?`The saved copy could not be read, so Save is off: ${o}`:e&&r?r.writeable?r.description:`${r.description}: you cannot save into it.`:n?`Reading version ${a}: a version is a fixed point in history, so Save is off.`:t?"Save writes the file into the package.":r?`${r.description}: this server does not take writes.`:"This server does not take writes."}function J1e(e){return e instanceof Error?e.message:String(e)}function Lge(e){const t=e.response?.data;return t?.message?t.message:e instanceof Error?e.message:String(e)}async function eSe({apiClients:e,queryClient:t,environmentName:n,packageName:r,modelPath:o,source:a,expectedHash:i,invalidateOnError:s,invalidate:c,afterWrite:f}){let u;try{u=await e.models.updateModelSource(n,r,o,{source:a,expectedHash:i})}catch(g){for(const v of s)t.invalidateQueries({queryKey:v});throw new Error(Lge(g))}const h=u.data.contentHash;await f?.(h);for(const{queryKey:g,refetchType:v,wait:b}of c){const S=t.invalidateQueries({queryKey:g,...v?{refetchType:v}:{}});b&&await S}return h}function tSe(e,t){return t===void 0||!/\.(saved|save_undone)$/.test(e.type)||e.where==="package"?e:{...e,workspace:t}}function nSe(e){if(!("resourceUri"in e))return{environmentName:e.environmentName,packageName:e.packageName,versionId:void 0,namesBoth:!0};let t;try{t=to(e.resourceUri)}catch{t=void 0}return{environmentName:t?.environmentName??"",packageName:t?.packageName??"",versionId:t?.versionId,namesBoth:!!t?.environmentName&&!!t?.packageName}}class sF extends Error{constructor(t){super(t),this.name="DocumentNotFoundError"}}const lF=e=>e instanceof sF||e instanceof Error&&e.name==="DocumentNotFoundError",zge=String.raw`##?\|?[ \t]*(?:[([{<][ \t]*)?(?:(?:(?:row|source)[-_]?)?authorize|access[-_]?filter)(?=[)\]}>]|[ \t]|$)`;function cF(e,t){if(/[\r\n]/.test(t))return`A ${e} is one line; it cannot hold a line break.`;if(new RegExp(zge,"iu").test(t))return`A ${e} cannot contain what reads as an access-control tag (authorize, row_authorize, source_authorize or access_filter).`}const Am=e=>ax(e)?e:`\`${e}\``;function AR(e){const{title:t,modelPath:n,source:r,view:o}=e;if(t.trim()==="")return"A title cannot be empty.";const a=cF("title",t);if(a)return a;if(t.includes("|##"))return"A title cannot contain `|##`, which closes the report's artifact tag.";if(/["\\\r\n]/.test(n)||n.trim()==="")return`The model path ${JSON.stringify(n)} cannot be written as an import.`;for(const[i,s]of[["source",r],["view",o]])if(s.trim()===""||/[`\r\n\\]/.test(s))return`The ${i} name ${JSON.stringify(s)} cannot be written as a Malloy name.`}const Fge=e=>{const t=e.replace(/[-_]+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},aj=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,_ge="report.malloy";function DR(e,t,n=_ge){const r=AR(e);if(r)throw new Error(r);const{modelPath:o,source:a,view:i}=e,s=e.title.trim(),c=aj(s),f=Am(`${a}_tiles`),u=Am(`${i}_tile`),h=`"${f} -> ${u}"`;return["##! experimental.givens",`##| artifact { layout=${t} title=${c}`," tiles=[",` ${h}`," ]",t==="grid"?"} dashboard { columns=12 }":"}","|##",`import { ${Am(a)} } from "${iz(o,n)}"`,"",`source: ${f} is ${Am(a)} extend {`,` # label=${aj(Fge(i))}`,` view: ${u} is ${Am(i)}`,"}",""].join(`
|
|
472
472
|
`)}function rSe(e,t){return DR(e,"linear",t)}function Bge(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,80)}function Uge({title:e,modelPath:t,source:n,view:r}){for(const[o,a]of[["source",n],["view",r]])if(!ax(a))return`The ${o} name ${JSON.stringify(a)} cannot be written as a Malloy name.`;return/["\\\r\n]/.test(t)?`The model path ${JSON.stringify(t)} cannot be written into an import.`:cF("title",e)}function oSe(e,t){const n=Uge(e);if(n)throw new Error(n);return DR(e,"grid",t)}const uF=e=>(e??"").trim().replace(/\\/g,"/").split("/").filter(t=>t!=="").join("/");function Vge(e,t){const n=uF(t);return`${n===""?"":`${n}/`}${e}.malloy`}function Hge(e){return Bge(e)||"untitled"}function dF(e,t=1,n){const r=Hge(e);return Vge(t>1?`${r}-${t}`:r,n)}const Bg=(e,t,n)=>`${e}/${t}/${n}`,qge=(e,t,n,r,o)=>({workspace:t,type:e,path:Bg(n,r,o)}),jR=20;function Wge(e){const{savesTo:t,writer:n}=Ige({...e,readFailed:!1});return t==="browser"?void 0:n}const ij=e=>e.slice(e.lastIndexOf("/")+1).replace(/\.malloy$/,"");function fF(e){if(!e.endsWith(".malloy"))return"A report's file name ends in .malloy.";const t=e.split("/");if(t.some(n=>n===""||n==="."||n===".."))return"A location is a path inside the package, such as sales/q3.malloy.";if(t.at(-1)===".malloy")return"A report's file needs a name.";if(t[0].toLowerCase()==="public")return"A report cannot live under public/, which is served as plain files.";if(e.toLowerCase()==="index.malloy")return"The package's index.malloy is its surface, never a report."}async function Yge(e){const t=e.layout??"linear",n=hd();let r;try{r=await Gge(e,t)}catch(o){throw LC({path:e.path??"",layout:t},e.onEvent).emit({type:"report.create_refused",reason:o instanceof Error?o.message:String(o)}),o}return LC({path:r.path,layout:t},e.onEvent).emit({type:"report.created",where:e.target.route==="package"?"package":"host",durationMs:hd()-n}),e.onCreated?.(r),r}async function Gge(e,t){const{document:n,target:r}=e,o=AR(n);if(o)throw new Error(o);const a=uF(e.directory),i=e.path!==void 0?[e.path]:Array.from({length:jR},(S,w)=>dF(n.title,w+1,a));for(const S of i){const w=fF(S);if(w)throw new Error(w)}const s=S=>DR(n,t,S);if(r.route==="package"){const S=new Set(r.existing);let w;for(const x of i)if(!S.has(x))try{await r.write(x,s(x)),w=x;break}catch(R){if(!Kge(R))throw R}if(w===void 0)throw sj(n.title,e.path);return{layout:t,path:w,slug:ij(w)}}const{storage:c,workspace:f,environmentName:u,packageName:h}=r,g=new Set(r.existing),v=new Set((await c.listDocuments(f)).map(S=>S.path));let b;for(const S of i){const w=qge(t,f.name,u,h,S),x=await c.resolveDocumentPath?.(w)??S;if(v.has(w.path)||g.has(S)||g.has(x))continue;let R=!0;try{await c.getDocument(w)}catch(k){if(!lF(k))throw k;R=!1}if(!R){b={layout:t,path:x,slug:ij(x),locator:w};break}}if(b===void 0)throw sj(n.title,e.path);return await c.saveDocument(b.locator,s(b.path)),b}const Kge=e=>e?.response?.status===409,sj=(e,t)=>new Error(t!==void 0?`${t} already exists. Fix: choose a different location.`:`No free file name for "${e}" after ${jR} tries. Fix: choose a different title.`);function Xge(e){try{const t=JSON.parse(e??"");return new Set((t.entries??[]).flatMap(n=>n.kind==="source"&&typeof n.name=="string"?[n.name]:[]))}catch{return new Set}}const pF=["bar_chart","line_chart","scatter_chart","shape_map","segment_map","big_value","sparkline"],hF=["line_chart","bar_chart","big_value","scatter_chart","shape_map","segment_map"],Qge=e=>hF.includes(e),ak=new Set([...pF,"viz"]);function zx(e){const t=e.trim();if(!/^#[ \t]/.test(t)||/[{=]/.test(t))return;const n=t.slice(1).trim().split(/[ \t]+/),r=[];let o;for(const a of n)if(a.startsWith("-")){if(o!==void 0)return;const i=a.slice(1);if(!ak.has(i))return;r.push(i)}else{if(o!==void 0||!ak.has(a))return;o=a}return{negated:r,...o!==void 0&&{pick:o}}}function mF(e){const t=e.trim();return!/^#[ \t]/.test(t)||zx(t)?!1:(t.replace(/"(?:[^"\\]|\\.)*"/g,'""').match(/[A-Za-z_]+/g)??[]).some(n=>ak.has(n))}function aSe(e,t){return["#",...hF.filter(n=>n!==e&&(t===void 0||t.includes(n))).map(n=>`-${n}`),"-viz",...e==="none"?[]:[e]].join(" ")}function Zge(e){return e.pick!==void 0?Qge(e.pick)?e.pick:"custom":e.negated.includes("viz")?"none":"custom"}function Jge(e){if(e.length===0)return"default";if(e.length>1)return"custom";const t=zx(e[0]);return t?Zge(t):"custom"}function iSe(e){const t=e.filter(n=>zx(n));return e.some(mF)?"custom":t.length===0?void 0:Jge(t)}const sSe=e=>e.filter(t=>zx(t)||mF(t));function lj(e){for(const t of e??[]){const n=/^#\(doc\)\s*(.*)$/s.exec(t.trim());if(n)return n[1].trim()}}function eye(e){for(const t of e??[]){const n=/^#\s*(?:-[A-Za-z_]+\s+)*([a-z_]+)/.exec(t.trim())?.[1];if(n&&pF.includes(n))return n}}function tye({environmentName:e,packageName:t,versionId:n,models:r,enabled:o}){const{apiClients:a,server:i}=Cr(),s=NL({queries:r.map(b=>({queryKey:["new-document-model",e,t,n,b,i],queryFn:async()=>(await a.models.getModel(e,t,b,n)).data,enabled:o,retry:!1,staleTime:300*1e3,refetchOnWindowFocus:!1}))}),c=s.map(b=>b.dataUpdatedAt).join(),f=C.useMemo(()=>{const b=new Map;return s.forEach((S,w)=>{const x=[],R=Xge(S.data?.modelInfo);for(const k of S.data?.sources??[]){if(typeof k.name!="string"||!R.has(k.name))continue;const T=lj(k.annotations);for(const $ of k.views??[])if(typeof $.name=="string"){const A=lj($.annotations),z=eye($.annotations);x.push({source:k.name,view:$.name,...A?{description:A}:{},...z?{chart:z}:{},...T?{sourceDescription:T}:{}})}}x.length>0&&b.set(r[w],x)}),b},[c,r]),u=s.some(b=>b.isLoading),h=u?[]:r.filter((b,S)=>s[S]?.isError),g=!u&&s.some(b=>b.isError&&P5(b.error)),v=()=>{s.forEach(b=>{b.isError&&b.refetch()})};return{choices:f,isLoading:u,isSuccess:s.length>0&&s.every(b=>!b.isPending),failed:h,retry:v,canRetry:g}}const gF=C.createContext(void 0);function nye({children:e,documentStorage:t}){const n=C.useMemo(()=>({documentStorage:t}),[t]);return m.jsx(gF.Provider,{value:n,children:e})}function yF(){return C.useContext(gF)}function rye(e,{environmentName:t,packageName:n,path:r,versionId:o},a){return{queryKey:["report",t,n,o,r],queryFn:async({signal:i})=>(await e.reports.getReport(t,n,r,o,{signal:i})).data,...a===void 0?{}:{staleTime:a}}}const lSe=1e4,vF=e=>e==="notebook"?"linear":"grid",cSe=(e,t)=>`${e}s/${t}.malloy`,oye=/\.malloy(nb)?$/,Fx=e=>e&&e.slice(e.lastIndexOf("/")+1).replace(oye,"")||void 0,aye=e=>e.replace(/\.malloy$/,"").split("/").map(encodeURIComponent).join("/"),bF=(e,t,n)=>`/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${aye(n)}`,iye="edit",sye=(e,t,n)=>`${bF(e,t,n)}?${iye}`,NR=e=>e.layout==="linear"?"linear":"grid",ik=e=>({layout:NR(e),path:e.path,editable:e.editable!==!1});function lye(e,t){const n=t.find(r=>r.path===e);return n?.path?ik({...n,path:n.path}):void 0}function cye(e){return e===""||e.startsWith("/")?!1:e.split("/").every(t=>t!==""&&t!=="."&&t!=="..")}function uSe(e,t){if(!cye(e))return{kind:"unresolved"};for(const n of[`${e}.malloy`,e]){const r=lye(n,t);if(r)return{kind:"path",report:r}}return{kind:"unresolved"}}function uye(e,t,n){return[["dashboards"],["notebooks"],["dashboard"],...n===void 0?[]:[[Lx({environmentName:e,packageName:t,modelPath:n})]]]}function dye(e,t,n,r){for(const o of[["report"],["reports"],...uye(t,n,r)])e.invalidateQueries({queryKey:o})}const fye=(e,t,n)=>["reports",e,t,n];async function pye(e,t,n,r){try{return(await e.reports.listReports(t,n,r)).data}catch(o){if(o?.response?.status===404)return[];throw o}}function hye(e,t,n,r=!0){const{apiClients:o}=Cr(),a=ko({queryKey:fye(e,t,n),queryFn:()=>pye(o,e,t,n),enabled:r,staleTime:6e4});return{reports:a.data??[],settled:a.isSuccess||a.isError,isFetching:a.isFetching,isError:a.isError,error:a.error,refetch:a.refetch}}function ko(e){const{server:t}=Cr(),n={...e,queryKey:[...e.queryKey,t],queryFn:async r=>{try{return await e.queryFn(r)}catch(o){if(o&&typeof o=="object"&&"response"in o){const a=o;if(a.response?.data){const i=new Error(a.response.data.message||a.message);throw i.status=a.response.status,i.data=a.response.data,i}}throw o}},retry:!1,throwOnError:!1};return IL(n,jE)}function rl(e){const t={...e,mutationFn:async n=>{try{return await e.mutationFn(n)}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const a=new Error(o.response.data.message||o.message);throw a.status=o.response.status,a.data=o.response.data,a}}throw r}},retry:!1,throwOnError:!1};return fQ(t,jE)}function mye(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath,e.queryName,e.query,e.sourceName,JSON.stringify(e.givens??{})]}function dSe(e){return["queryResult",e.environmentName,e.packageName,e.versionId,e.modelPath]}function IR(e,{enabled:t=!0}={}){const{apiClients:n}=Cr(),r=mye(e);return ko({queryKey:r,queryFn:({signal:o})=>n.models.executeQueryModel(e.environmentName,e.packageName,e.modelPath,{queryName:e.queryName,query:e.query,sourceName:e.sourceName,givens:e.givens,versionId:e.versionId},void 0,{signal:o}),enabled:t,placeholderData:(o,a)=>a&&yye(a.queryKey,r)?o:void 0,...fee})}const gye=8;function yye(e,t){return e.every((n,r)=>r===gye||r>=t.length||n===t[r])}const vye=/<\/?[A-Za-z][^>]*>|<!--|<![A-Za-z]/;function xF(e){let t=!1;for(const[n,r]of Array.from(e.entries())){if(r.deleted)continue;if(n==="image"||n==="link"){e.delete(n),t=!0;continue}if(n==="label"){let a;try{a=e.text("label")}catch{a=void 0}if(a!==void 0&&vye.test(a)){e.delete("label"),t=!0;continue}}const o=Array.isArray(r.eq)?r.eq:[];for(const a of[r,...o])xF(a)&&(t=!0)}return t}function bye(e){const t=e.trim();if(!/^#(?:\||[ \t\r\n]|$)/.test(t))return e;if(t.includes("@env."))return"";let n;try{n=FE.parseAnnotation(t)}catch{return""}return n.log.length>0?"":xF(n.tag)?`${n.tag.toString()}
|
|
473
473
|
`:e}function sk(e){if(Array.isArray(e)){for(const n of e)sk(n);return}if(e===null||typeof e!="object")return;const t=e;for(const[n,r]of Object.entries(t))if(n==="annotations"&&Array.isArray(r))for(const o of r){const a=o;typeof a?.value=="string"&&(a.value=bye(a.value))}else sk(r)}function SF(e){let t;try{t=JSON.parse(e)}catch{return e}const n=JSON.stringify(t);sk(t);const r=JSON.stringify(t);return r===n?e:r}const xye=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"]),Sye={value:`# big_value
|
|
474
474
|
`},wye=/^#\(malloy\)[\s\S]*\bcalculation\b/;function Cye(e){return e?e.kind==="measure"?!0:(e.annotations??[]).some(t=>typeof t?.value=="string"&&wye.test(t.value.trim())):!1}function kye(e){const t=e.schema?.fields;if(!Array.isArray(t)||t.length===0||!t.every(Cye))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 Eye(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(xye.has(o))return!0}return!1}function wF(e){let t;try{t=JSON.parse(e)}catch{return e}if(!t||typeof t!="object"||!kye(t))return e;const n=Array.isArray(t.annotations)?t.annotations:[],r=n.map(o=>o?.value).filter(o=>typeof o=="string");return Eye(r)?e:JSON.stringify({...t,annotations:[Sye,...n]})}const Rye=e=>SF(wF(e));function cj(e){const t=e.split("->").at(-1)?.trim()??e;return/^[A-Za-z_][\w-]*$/.test(t)?vz(t):e}function CF({environmentName:e,packageName:t,versionId:n,modelPath:r,queryName:o,tile:a,annotation:i,label:s,subtitle:c,heading:f,borderless:u,givens:h,hostGivens:g,declaredTypes:v,givenNames:b,height:S,maxResultSize:w,drill:x,onExplore:R,chrome:k="card",ignoredFilters:T,preamble:$,restricted:A,waitingFor:z,index:j}){const{theme:B}=eo(),[L,F]=Koe(),E=IR({environmentName:e,packageName:t,modelPath:r,versionId:n,queryName:o,query:a!==void 0?Ez($??"",`${i?`${i}
|
|
@@ -476,6 +476,6 @@ ${t}`}function Mae(e){return e?.status===403}const fd=1e3,QE=200;function Rz(e){
|
|
|
476
476
|
`)??[];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(`
|
|
477
477
|
`)};function Rj(){const[e,t]=C.useState(!1),{apiClients:n}=Cr(),r=()=>{t(!0)},o=()=>{t(!1)},a=Zp({mutationFn(s){return n.environments.createEnvironment({name:s.name,readme:NF({name:s.name,readme:""},s.description)})},success:"Environment created",invalidates:[["environments"]],closeDialog:o,resource:"environment",action:"create"}),i=async s=>{s.preventDefault();const c=new FormData(s.currentTarget),f=c.get("name")?.toString(),u=c.get("description")?.toString();if(!f)throw new Error("Name is required");a.mutate({name:f,description:u})};return m.jsxs(mn.Fragment,{children:[m.jsx(dy,{label:"Environment",onClick:r}),m.jsx(Xo,{open:e,onClose:o,title:"New environment",description:"An environment holds packages and the connections they query through.",actions:m.jsxs(m.Fragment,{children:[m.jsx(go,{disabled:a.isPending,onClick:o,children:"Cancel"}),m.jsx(go,{type:"submit",form:"environment-form",variant:"contained",loading:a.isPending,children:"Create environment"})]}),children:m.jsx("form",{onSubmit:i,id:"environment-form",children:m.jsxs(Bx,{sx:{gap:2},children:[m.jsx(hr,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Name",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}}),m.jsx(hr,{id:"description",name:"description",label:"Description",placeholder:"Explore semantic models, run queries, and build reports",type:"text",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0}})]})})}),a.notice]})}function obe({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=Cr(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=Zp({mutationFn:()=>o.environments.deleteEnvironment(e.name),success:"Environment deleted",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"delete"});return m.jsxs(mn.Fragment,{children:[m.jsxs(Si,{onClick:a,children:[m.jsx(Up,{children:m.jsx(lx,{fontSize:"small"})}),m.jsx(su,{children:"Delete"})]}),m.jsx(Xo,{open:n,onClose:i,title:"Delete environment",actions:m.jsxs(m.Fragment,{children:[m.jsx(go,{onClick:i,children:"Cancel"}),m.jsx(go,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>s.mutate(),loading:s.isPending,children:"Delete environment"})]}),children:m.jsxs(br,{variant:"body2",children:["Delete ",m.jsx("strong",{children:e.name}),"? Its packages stop being served and this cannot be undone."]})}),s.notice]})}function abe({environment:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=Cr(),a=()=>{r(!0)},i=()=>{r(!1),t()},s=Zp({mutationFn(f){return o.environments.updateEnvironment(e.name,{name:e.name,readme:NF({name:e.name,readme:e.readme},f.description)})},success:"Environment updated",invalidates:[["environments"]],closeDialog:i,resource:"environment",action:"update"}),c=f=>{f.preventDefault();const u=new FormData(f.currentTarget).get("description")?.toString();s.mutate({description:u})};return m.jsxs(mn.Fragment,{children:[m.jsxs(Si,{onClick:a,children:[m.jsx(Up,{children:m.jsx(zE,{fontSize:"small"})}),m.jsx(su,{children:"Edit"})]}),m.jsx(Xo,{open:n,onClose:i,title:"Edit environment",description:"What this environment is, for the people who open it.",actions:m.jsxs(m.Fragment,{children:[m.jsx(go,{disabled:s.isPending,onClick:i,children:"Cancel"}),m.jsx(go,{type:"submit",form:"environment-form",variant:"contained",loading:s.isPending,children:"Save changes"})]}),children:m.jsx("form",{onSubmit:c,id:"environment-form",children:m.jsxs(Bx,{sx:{gap:2},children:[m.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}}),m.jsx(hr,{id:"description",name:"description",label:"Description",type:"text",fullWidth:!0,size:"small",defaultValue:jF(e.readme),InputLabelProps:{shrink:!0}})]})})}),s.notice]})}const ibe=[{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:zc.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:zc.mcpAgents},{title:"Surface",body:"Reports declared in Malloy, laid out as a grid or read top to bottom, and no-build HTML data apps, all shipped inside the package, plus this Console for browsing them.",href:zc.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:zc.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:zc.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:zc.connections}];function sbe({href:e,children:t}){return m.jsx(yt,{component:"a",href:e,target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary",textDecoration:"underline"},children:t})}function vSe({onClickEnvironment:e}){const{apiClients:t,mutable:n}=Cr(),{data:r,isSuccess:o,isError:a,error:i}=ko({queryKey:["environments"],queryFn:()=>t.environments.listEnvironments()});if(a)return m.jsx(Ma,{error:i,context:"Environments List"});if(!o)return m.jsx(ya,{text:"Loading environments..."});const s=r.data??[];return m.jsxs(cE,{maxWidth:"md",sx:{py:6},children:[m.jsxs(yt,{sx:{mb:5},children:[m.jsx(Et,{variant:"h3",component:"h1",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Publisher"}),m.jsx(Et,{variant:"body1",color:"text.secondary",sx:{mb:3},children:"The analytics engine for Malloy."}),m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{maxWidth:720,lineHeight:1.6},children:"One data model, served over MCP and REST to AI agents, applications and BI tools. Write down what your data means — the sources, the joins, the measures, who may see what — and every surface asks the same model, so the same question returns the same numbers tomorrow."})]}),m.jsx(rp,{container:!0,spacing:4,sx:{mb:5},children:ibe.map(c=>m.jsx(rp,{size:{xs:12,sm:6},children:m.jsxs(lr,{spacing:1,children:[m.jsx(Et,{variant:"body2",component:"a",href:c.href,target:"_blank",rel:"noopener noreferrer",sx:{fontWeight:500,color:"text.primary",textDecoration:"none","&:hover":{textDecoration:"underline"}},children:c.title}),m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{lineHeight:1.6},children:c.body})]})},c.title))}),m.jsx(Jc,{sx:{my:4}}),s.length>0?m.jsx(Ts,{title:"Environments",count:s.length,description:"Published environments available on this server",...n?{action:m.jsx(Rj,{})}:{},children:m.jsx(lr,{children:s.map(c=>m.jsx(lbe,{environment:c,...e?{onClickEnvironment:e}:{}},c.name))})}):m.jsxs(yt,{sx:{mb:4},children:[m.jsx(Et,{variant:"h5",sx:{fontWeight:500,letterSpacing:"-0.025em",mb:1},children:"Get started"}),m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{mb:3,maxWidth:600},children:"Create your first Malloy environment to start exploring semantic models and building data experiences."}),n?m.jsx(Rj,{}):m.jsx(wr,{variant:"contained",color:"primary",href:zc.publishing,target:"_blank",rel:"noopener noreferrer",children:"Learn how to create models"})]}),m.jsx(Jc,{sx:{my:4}}),m.jsxs(Et,{variant:"body2",color:"text.secondary",sx:{maxWidth:720,lineHeight:1.6,mt:2},children:["Join the"," ",m.jsx(sbe,{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 lbe({environment:e,onClickEnvironment:t}){const{mutable:n}=Cr(),[r,o]=C.useState(null),a=!!r,i=jF(e.readme),s=f=>{f.stopPropagation(),o(f.currentTarget)},c=()=>o(null);return m.jsx(_x,{icon:m.jsx(rbe,{sx:{fontSize:18}}),tint:DE.environment,label:e.name??"",ariaLabel:e.name??"",...i?{description:i}:{},...e.name&&t?{onClick:f=>t(`/${e.name}/`,f)}:{},...n?{trailingAction:m.jsxs(m.Fragment,{children:[m.jsx(Eo,{size:"small",onClick:s,"aria-label":`Environment actions for ${e.name}`,children:m.jsx(cx,{fontSize:"small"})}),m.jsxs(Pd,{anchorEl:r,open:a,onClose:c,onClick:f=>f.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[m.jsx(abe,{environment:e,onCloseDialog:c}),m.jsx(obe,{environment:e,onCloseDialog:c})]})]})}:{}})}var Wf={},ui={},jm={},Yf={},Tj={},Mj;function cbe(){return Mj||(Mj=1,Object.defineProperty(Tj,"__esModule",{value:!0})),Tj}var Nm={},Im={},Oj;function Fd(){if(Oj)return Im;Oj=1,Object.defineProperty(Im,"__esModule",{value:!0}),Im.CronField=void 0;let e=class IF{#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(IF.sorter),this.#n=this.options.wildcard!==void 0?this.options.wildcard:this.#r(),this.#e=this.options.rawValue.includes("L")||n.includes("L"),this.#t=this.options.rawValue.includes("?")||n.includes("?")}get min(){return this.constructor.min}get max(){return this.constructor.max}get chars(){return this.constructor.chars}get hasLastChar(){return this.#e}get hasQuestionMarkChar(){return this.#t}get isWildcard(){return this.#n}get values(){return this.#o}static sorter(n,r){const o=typeof n=="number",a=typeof r=="number";return o&&a?n-r:!o&&!a?n.localeCompare(r):o?-1:1}static findNearestValueInList(n,r,o){if(o){for(let a=n.length-1;a>=0;a--)if(n[a]<r)return n[a];return null}for(let a=0;a<n.length;a++)if(n[a]>r)return n[a];return null}findNearestValue(n,r){return this.constructor.findNearestValueInList(this.values,n,r)}serialize(){return{wildcard:this.#n,values:this.#o}}validate(){let n;const r=this.chars.length>0?` or chars ${this.chars.join("")}`:"",o=s=>c=>new RegExp(`^\\d{0,2}${c}$`).test(s),a=s=>(n=s,typeof s=="number"?s>=this.min&&s<=this.max:this.chars.some(o(s)));if(!this.#o.every(a))throw new Error(`${this.constructor.name} Validation error, got value ${n} expected range ${this.min}-${this.max}${r}`);const i=this.#o.find((s,c)=>this.#o.indexOf(s)!==c);if(i)throw new Error(`${this.constructor.name} Validation error, duplicate values found: ${i}`)}#r(){return this.options.rawValue.length>0?["*","?"].includes(this.options.rawValue):Array.from({length:this.max-this.min+1},(n,r)=>r+this.min).every(n=>this.#o.includes(n))}};return Im.CronField=e,Im}var $j;function ube(){if($j)return Nm;$j=1,Object.defineProperty(Nm,"__esModule",{value:!0}),Nm.CronDayOfMonth=void 0;const e=Fd(),t=1,n=31,r=Object.freeze(["L"]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}static get validChars(){return/^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return Nm.CronDayOfMonth=o,Nm}var Lm={},Pj;function dbe(){if(Pj)return Lm;Pj=1,Object.defineProperty(Lm,"__esModule",{value:!0}),Lm.CronDayOfWeek=void 0;const e=Fd(),t=0,n=7,r=Object.freeze(["L"]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}static get validChars(){return/^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}};return Lm.CronDayOfWeek=o,Lm}var zm={},Aj;function fbe(){if(Aj)return zm;Aj=1,Object.defineProperty(zm,"__esModule",{value:!0}),zm.CronHour=void 0;const e=Fd(),t=0,n=23,r=Object.freeze([]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return zm.CronHour=o,zm}var Fm={},Dj;function pbe(){if(Dj)return Fm;Dj=1,Object.defineProperty(Fm,"__esModule",{value:!0}),Fm.CronMinute=void 0;const e=Fd(),t=0,n=59,r=Object.freeze([]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return Fm.CronMinute=o,Fm}var _m={},jj={},La={},Nj;function hbe(){if(Nj)return La;Nj=1,Object.defineProperty(La,"__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 i extends e{}class s extends e{constructor(){super("Zone is an abstract class")}}const c="numeric",f="short",u="long",h={year:c,month:c,day:c},g={year:c,month:f,day:c},v={year:c,month:f,day:c,weekday:f},b={year:c,month:u,day:c},S={year:c,month:u,day:c,weekday:u},w={hour:c,minute:c},x={hour:c,minute:c,second:c},R={hour:c,minute:c,second:c,timeZoneName:f},k={hour:c,minute:c,second:c,timeZoneName:u},T={hour:c,minute:c,hourCycle:"h23"},$={hour:c,minute:c,second:c,hourCycle:"h23"},A={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:f},z={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:u},j={year:c,month:c,day:c,hour:c,minute:c},B={year:c,month:c,day:c,hour:c,minute:c,second:c},L={year:c,month:f,day:c,hour:c,minute:c},F={year:c,month:f,day:c,hour:c,minute:c,second:c},E={year:c,month:f,day:c,weekday:f,hour:c,minute:c},N={year:c,month:u,day:c,hour:c,minute:c,timeZoneName:f},D={year:c,month:u,day:c,hour:c,minute:c,second:c,timeZoneName:f},V={year:c,month:u,day:c,weekday:u,hour:c,minute:c,timeZoneName:u},I={year:c,month:u,day:c,weekday:u,hour:c,minute:c,second:c,timeZoneName:u};class W{get type(){throw new s}get name(){throw new s}get ianaName(){return this.name}get isUniversal(){throw new s}offsetName(O,U){throw new s}formatOffset(O,U){throw new s}offset(O){throw new s}equals(O){throw new s}get isValid(){throw new s}}let X=null;class ie extends W{static get instance(){return X===null&&(X=new ie),X}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(O,{format:U,locale:Q}){return uu(O,U,Q)}formatOffset(O,U){return Ds(this.offset(O),U)}offset(O){return-new Date(O).getTimezoneOffset()}equals(O){return O.type==="system"}get isValid(){return!0}}const G=new Map;function ee(q){let O=G.get(q);return O===void 0&&(O=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:q,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),G.set(q,O)),O}const se={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Y(q,O){const U=q.format(O).replace(/\u200E/g,""),Q=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(U),[,le,we,Ae,_e,Ye,Pt,vn]=Q;return[Ae,le,we,_e,Ye,Pt,vn]}function ae(q,O){const U=q.formatToParts(O),Q=[];for(let le=0;le<U.length;le++){const{type:we,value:Ae}=U[le],_e=se[we];we==="era"?Q[_e]=Ae:Ve(_e)||(Q[_e]=parseInt(Ae,10))}return Q}const J=new Map;class re extends W{static create(O){let U=J.get(O);return U===void 0&&J.set(O,U=new re(O)),U}static resetCache(){J.clear(),G.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=re.isValidZone(O)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(O,{format:U,locale:Q}){return uu(O,U,Q,this.name)}formatOffset(O,U){return Ds(this.offset(O),U)}offset(O){if(!this.valid)return NaN;const U=new Date(O);if(isNaN(U))return NaN;const Q=ee(this.name);let[le,we,Ae,_e,Ye,Pt,vn]=Q.formatToParts?ae(Q,U):Y(Q,U);_e==="BC"&&(le=-Math.abs(le)+1);const Ln=Qa({year:le,month:we,day:Ae,hour:Ye===24?0:Ye,minute:Pt,second:vn,millisecond:0});let dr=+U;const Mn=dr%1e3;return dr-=Mn>=0?Mn:1e3+Mn,(Ln-dr)/(60*1e3)}equals(O){return O.type==="iana"&&O.name===this.name}get isValid(){return this.valid}}let te={};function oe(q,O={}){const U=JSON.stringify([q,O]);let Q=te[U];return Q||(Q=new Intl.ListFormat(q,O),te[U]=Q),Q}const ce=new Map;function me(q,O={}){const U=JSON.stringify([q,O]);let Q=ce.get(U);return Q===void 0&&(Q=new Intl.DateTimeFormat(q,O),ce.set(U,Q)),Q}const pe=new Map;function ye(q,O={}){const U=JSON.stringify([q,O]);let Q=pe.get(U);return Q===void 0&&(Q=new Intl.NumberFormat(q,O),pe.set(U,Q)),Q}const ue=new Map;function Se(q,O={}){const{base:U,...Q}=O,le=JSON.stringify([q,Q]);let we=ue.get(le);return we===void 0&&(we=new Intl.RelativeTimeFormat(q,O),ue.set(le,we)),we}let Ue=null;function je(){return Ue||(Ue=new Intl.DateTimeFormat().resolvedOptions().locale,Ue)}const Re=new Map;function de(q){let O=Re.get(q);return O===void 0&&(O=new Intl.DateTimeFormat(q).resolvedOptions(),Re.set(q,O)),O}const tt=new Map;function Ne(q){let O=tt.get(q);if(!O){const U=new Intl.Locale(q);O="getWeekInfo"in U?U.getWeekInfo():U.weekInfo,"minimalDays"in O||(O={...He,...O}),tt.set(q,O)}return O}function Qe(q){const O=q.indexOf("-x-");O!==-1&&(q=q.substring(0,O));const U=q.indexOf("-u-");if(U===-1)return[q];{let Q,le;try{Q=me(q).resolvedOptions(),le=q}catch{const _e=q.substring(0,U);Q=me(_e).resolvedOptions(),le=_e}const{numberingSystem:we,calendar:Ae}=Q;return[le,we,Ae]}}function nt(q,O,U){return(U||O)&&(q.includes("-u-")||(q+="-u"),U&&(q+=`-ca-${U}`),O&&(q+=`-nu-${O}`)),q}function Ft(q){const O=[];for(let U=1;U<=12;U++){const Q=yn.utc(2009,U,1);O.push(q(Q))}return O}function _t(q){const O=[];for(let U=1;U<=7;U++){const Q=yn.utc(2016,11,13+U);O.push(q(Q))}return O}function rt(q,O,U,Q){const le=q.listingMode();return le==="error"?null:le==="en"?U(O):Q(O)}function Je(q){return q.numberingSystem&&q.numberingSystem!=="latn"?!1:q.numberingSystem==="latn"||!q.locale||q.locale.startsWith("en")||de(q.locale).numberingSystem==="latn"}class dt{constructor(O,U,Q){this.padTo=Q.padTo||0,this.floor=Q.floor||!1;const{padTo:le,floor:we,...Ae}=Q;if(!U||Object.keys(Ae).length>0){const _e={useGrouping:!1,...Q};Q.padTo>0&&(_e.minimumIntegerDigits=Q.padTo),this.inf=ye(O,_e)}}format(O){if(this.inf){const U=this.floor?Math.floor(O):O;return this.inf.format(U)}else{const U=this.floor?Math.floor(O):us(O,3);return Zt(U,this.padTo)}}}class Ie{constructor(O,U,Q){this.opts=Q,this.originalZone=void 0;let le;if(this.opts.timeZone)this.dt=O;else if(O.zone.type==="fixed"){const Ae=-1*(O.offset/60),_e=Ae>=0?`Etc/GMT+${Ae}`:`Etc/GMT${Ae}`;O.offset!==0&&re.create(_e).valid?(le=_e,this.dt=O):(le="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,le=O.zone.name):(le="UTC",this.dt=O.setZone("UTC").plus({minutes:O.offset}),this.originalZone=O.zone);const we={...this.opts};we.timeZone=we.timeZone||le,this.dtf=me(U,we)}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(U=>{if(U.type==="timeZoneName"){const Q=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...U,value:Q}}else return U}):O}resolvedOptions(){return this.dtf.resolvedOptions()}}class ve{constructor(O,U,Q){this.opts={style:"long",...Q},!U&&Oe()&&(this.rtf=Se(O,Q))}format(O,U){return this.rtf?this.rtf.format(O,U):ic(U,O,this.opts.numeric,this.opts.style!=="long")}formatToParts(O,U){return this.rtf?this.rtf.formatToParts(O,U):[]}}const He={firstDay:1,minimalDays:4,weekend:[6,7]};class Me{static fromOpts(O){return Me.create(O.locale,O.numberingSystem,O.outputCalendar,O.weekSettings,O.defaultToEN)}static create(O,U,Q,le,we=!1){const Ae=O||an.defaultLocale,_e=Ae||(we?"en-US":je()),Ye=U||an.defaultNumberingSystem,Pt=Q||an.defaultOutputCalendar,vn=Jt(le)||an.defaultWeekSettings;return new Me(_e,Ye,Pt,vn,Ae)}static resetCache(){Ue=null,ce.clear(),pe.clear(),ue.clear(),Re.clear(),tt.clear()}static fromObject({locale:O,numberingSystem:U,outputCalendar:Q,weekSettings:le}={}){return Me.create(O,U,Q,le)}constructor(O,U,Q,le,we){const[Ae,_e,Ye]=Qe(O);this.locale=Ae,this.numberingSystem=U||_e||null,this.outputCalendar=Q||Ye||null,this.weekSettings=le,this.intl=nt(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=we,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=Je(this)),this.fastNumbersCached}listingMode(){const O=this.isEnglish(),U=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return O&&U?"en":"intl"}clone(O){return!O||Object.getOwnPropertyNames(O).length===0?this:Me.create(O.locale||this.specifiedLocale,O.numberingSystem||this.numberingSystem,O.outputCalendar||this.outputCalendar,Jt(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,U=!1){return rt(this,O,bl,()=>{const Q=this.intl==="ja"||this.intl.startsWith("ja-");U&=!Q;const le=U?{month:O,day:"numeric"}:{month:O},we=U?"format":"standalone";if(!this.monthsCache[we][O]){const Ae=Q?_e=>this.dtFormatter(_e,le).format():_e=>this.extract(_e,le,"month");this.monthsCache[we][O]=Ft(Ae)}return this.monthsCache[we][O]})}weekdays(O,U=!1){return rt(this,O,ps,()=>{const Q=U?{weekday:O,year:"numeric",month:"long",day:"numeric"}:{weekday:O},le=U?"format":"standalone";return this.weekdaysCache[le][O]||(this.weekdaysCache[le][O]=_t(we=>this.extract(we,Q,"weekday"))),this.weekdaysCache[le][O]})}meridiems(){return rt(this,void 0,()=>fu,()=>{if(!this.meridiemCache){const O={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[yn.utc(2016,11,13,9),yn.utc(2016,11,13,19)].map(U=>this.extract(U,O,"dayperiod"))}return this.meridiemCache})}eras(O){return rt(this,O,$a,()=>{const U={era:O};return this.eraCache[O]||(this.eraCache[O]=[yn.utc(-40,1,1),yn.utc(2017,1,1)].map(Q=>this.extract(Q,U,"era"))),this.eraCache[O]})}extract(O,U,Q){const le=this.dtFormatter(O,U),we=le.formatToParts(),Ae=we.find(_e=>_e.type.toLowerCase()===Q);return Ae?Ae.value:null}numberFormatter(O={}){return new dt(this.intl,O.forceSimple||this.fastNumbers,O)}dtFormatter(O,U={}){return new Ie(O,this.intl,U)}relFormatter(O={}){return new ve(this.intl,this.isEnglish(),O)}listFormatter(O={}){return oe(this.intl,O)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||de(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:ct()?Ne(this.locale):He}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 Ct=null;class kt extends W{static get utcInstance(){return Ct===null&&(Ct=new kt(0)),Ct}static instance(O){return O===0?kt.utcInstance:new kt(O)}static parseSpecifier(O){if(O){const U=O.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(U)return new kt(yl(U[1],U[2]))}return null}constructor(O){super(),this.fixed=O}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Ds(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Ds(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(O,U){return Ds(this.fixed,U)}get isUniversal(){return!0}offset(){return this.fixed}equals(O){return O.type==="fixed"&&O.fixed===this.fixed}get isValid(){return!0}}class bt extends W{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 it(q,O){if(Ve(q)||q===null)return O;if(q instanceof W)return q;if(rn(q)){const U=q.toLowerCase();return U==="default"?O:U==="local"||U==="system"?ie.instance:U==="utc"||U==="gmt"?kt.utcInstance:kt.parseSpecifier(U)||re.create(q)}else return At(q)?kt.instance(q):typeof q=="object"&&"offset"in q&&typeof q.offset=="function"?q:new bt(q)}const lt={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Lt={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},en=lt.hanidec.replace(/[\[|\]]/g,"").split("");function xn(q){let O=parseInt(q,10);if(isNaN(O)){O="";for(let U=0;U<q.length;U++){const Q=q.charCodeAt(U);if(q[U].search(lt.hanidec)!==-1)O+=en.indexOf(q[U]);else for(const le in Lt){const[we,Ae]=Lt[le];Q>=we&&Q<=Ae&&(O+=Q-we)}}return parseInt(O,10)}else return O}const Tn=new Map;function Fn(){Tn.clear()}function Wt({numberingSystem:q},O=""){const U=q||"latn";let Q=Tn.get(U);Q===void 0&&(Q=new Map,Tn.set(U,Q));let le=Q.get(O);return le===void 0&&(le=new RegExp(`${lt[U]}${O}`),Q.set(O,le)),le}let Nn=()=>Date.now(),ke="system",Hn=null,On=null,tn=null,Dt=60,Fr,Un=null;class an{static get now(){return Nn}static set now(O){Nn=O}static set defaultZone(O){ke=O}static get defaultZone(){return it(ke,ie.instance)}static get defaultLocale(){return Hn}static set defaultLocale(O){Hn=O}static get defaultNumberingSystem(){return On}static set defaultNumberingSystem(O){On=O}static get defaultOutputCalendar(){return tn}static set defaultOutputCalendar(O){tn=O}static get defaultWeekSettings(){return Un}static set defaultWeekSettings(O){Un=Jt(O)}static get twoDigitCutoffYear(){return Dt}static set twoDigitCutoffYear(O){Dt=O%100}static get throwOnInvalid(){return Fr}static set throwOnInvalid(O){Fr=O}static resetCaches(){Me.resetCache(),re.resetCache(),yn.resetCache(),Fn()}}class _n{constructor(O,U){this.reason=O,this.explanation=U}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const be=[0,31,59,90,120,151,181,212,243,273,304,334],Te=[0,31,60,91,121,152,182,213,244,274,305,335];function ze(q,O){return new _n("unit out of range",`you specified ${O} (of type ${typeof O}) as a ${q}, which is invalid`)}function qe(q,O,U){const Q=new Date(Date.UTC(q,O-1,U));q<100&&q>=0&&Q.setUTCFullYear(Q.getUTCFullYear()-1900);const le=Q.getUTCDay();return le===0?7:le}function ot(q,O,U){return U+(ra(q)?Te:be)[O-1]}function Tt(q,O){const U=ra(q)?Te:be,Q=U.findIndex(we=>we<O),le=O-U[Q];return{month:Q+1,day:le}}function St(q,O){return(q-O+7)%7+1}function Mt(q,O=4,U=1){const{year:Q,month:le,day:we}=q,Ae=ot(Q,le,we),_e=St(qe(Q,le,we),U);let Ye=Math.floor((Ae-_e+14-O)/7),Pt;return Ye<1?(Pt=Q-1,Ye=ds(Pt,O,U)):Ye>ds(Q,O,U)?(Pt=Q+1,Ye=1):Pt=Q,{weekYear:Pt,weekNumber:Ye,weekday:_e,...vl(q)}}function jt(q,O=4,U=1){const{weekYear:Q,weekNumber:le,weekday:we}=q,Ae=St(qe(Q,1,O),U),_e=ur(Q);let Ye=le*7+we-Ae-7+O,Pt;Ye<1?(Pt=Q-1,Ye+=ur(Pt)):Ye>_e?(Pt=Q+1,Ye-=ur(Q)):Pt=Q;const{month:vn,day:Ln}=Tt(Pt,Ye);return{year:Pt,month:vn,day:Ln,...vl(q)}}function Xt(q){const{year:O,month:U,day:Q}=q,le=ot(O,U,Q);return{year:O,ordinal:le,...vl(q)}}function Nt(q){const{year:O,ordinal:U}=q,{month:Q,day:le}=Tt(O,U);return{year:O,month:Q,day:le,...vl(q)}}function Ut(q,O){if(!Ve(q.localWeekday)||!Ve(q.localWeekNumber)||!Ve(q.localWeekYear)){if(!Ve(q.weekday)||!Ve(q.weekNumber)||!Ve(q.weekYear))throw new o("Cannot mix locale-based week fields with ISO-based week fields");return Ve(q.localWeekday)||(q.weekday=q.localWeekday),Ve(q.localWeekNumber)||(q.weekNumber=q.localWeekNumber),Ve(q.localWeekYear)||(q.weekYear=q.localWeekYear),delete q.localWeekday,delete q.localWeekNumber,delete q.localWeekYear,{minDaysInFirstWeek:O.getMinDaysInFirstWeek(),startOfWeek:O.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function he(q,O=4,U=1){const Q=Gt(q.weekYear),le=Sn(q.weekNumber,1,ds(q.weekYear,O,U)),we=Sn(q.weekday,1,7);return Q?le?we?!1:ze("weekday",q.weekday):ze("week",q.weekNumber):ze("weekYear",q.weekYear)}function ge(q){const O=Gt(q.year),U=Sn(q.ordinal,1,ur(q.year));return O?U?!1:ze("ordinal",q.ordinal):ze("year",q.year)}function Fe(q){const O=Gt(q.year),U=Sn(q.month,1,12),Q=Sn(q.day,1,_r(q.year,q.month));return O?U?Q?!1:ze("day",q.day):ze("month",q.month):ze("year",q.year)}function mt(q){const{hour:O,minute:U,second:Q,millisecond:le}=q,we=Sn(O,0,23)||O===24&&U===0&&Q===0&&le===0,Ae=Sn(U,0,59),_e=Sn(Q,0,59),Ye=Sn(le,0,999);return we?Ae?_e?Ye?!1:ze("millisecond",le):ze("second",Q):ze("minute",U):ze("hour",O)}function Ve(q){return typeof q>"u"}function At(q){return typeof q=="number"}function Gt(q){return typeof q=="number"&&q%1===0}function rn(q){return typeof q=="string"}function xe(q){return Object.prototype.toString.call(q)==="[object Date]"}function Oe(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function ct(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function wt(q){return Array.isArray(q)?q:[q]}function Ot(q,O,U){if(q.length!==0)return q.reduce((Q,le)=>{const we=[O(le),le];return Q&&U(Q[0],we[0])===Q[0]?Q:we},null)[1]}function $t(q,O){return O.reduce((U,Q)=>(U[Q]=q[Q],U),{})}function It(q,O){return Object.prototype.hasOwnProperty.call(q,O)}function Jt(q){if(q==null)return null;if(typeof q!="object")throw new i("Week settings must be an object");if(!Sn(q.firstDay,1,7)||!Sn(q.minimalDays,1,7)||!Array.isArray(q.weekend)||q.weekend.some(O=>!Sn(O,1,7)))throw new i("Invalid week settings");return{firstDay:q.firstDay,minimalDays:q.minimalDays,weekend:Array.from(q.weekend)}}function Sn(q,O,U){return Gt(q)&&q>=O&&q<=U}function tr(q,O){return q-O*Math.floor(q/O)}function Zt(q,O=2){const U=q<0;let Q;return U?Q="-"+(""+-q).padStart(O,"0"):Q=(""+q).padStart(O,"0"),Q}function Dr(q){if(!(Ve(q)||q===null||q===""))return parseInt(q,10)}function io(q){if(!(Ve(q)||q===null||q===""))return parseFloat(q)}function Mo(q){if(!(Ve(q)||q===null||q==="")){const O=parseFloat("0."+q)*1e3;return Math.floor(O)}}function us(q,O,U="round"){const Q=10**O;switch(U){case"expand":return q>0?Math.ceil(q*Q)/Q:Math.floor(q*Q)/Q;case"trunc":return Math.trunc(q*Q)/Q;case"round":return Math.round(q*Q)/Q;case"floor":return Math.floor(q*Q)/Q;case"ceil":return Math.ceil(q*Q)/Q;default:throw new RangeError(`Value rounding ${U} is out of range`)}}function ra(q){return q%4===0&&(q%100!==0||q%400===0)}function ur(q){return ra(q)?366:365}function _r(q,O){const U=tr(O-1,12)+1,Q=q+(O-U)/12;return U===2?ra(Q)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][U-1]}function Qa(q){let O=Date.UTC(q.year,q.month-1,q.day,q.hour,q.minute,q.second,q.millisecond);return q.year<100&&q.year>=0&&(O=new Date(O),O.setUTCFullYear(q.year,q.month-1,q.day)),+O}function gl(q,O,U){return-St(qe(q,1,O),U)+O-1}function ds(q,O=4,U=1){const Q=gl(q,O,U),le=gl(q+1,O,U);return(ur(q)-Q+le)/7}function Oi(q){return q>99?q:q>an.twoDigitCutoffYear?1900+q:2e3+q}function uu(q,O,U,Q=null){const le=new Date(q),we={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};Q&&(we.timeZone=Q);const Ae={timeZoneName:O,...we},_e=new Intl.DateTimeFormat(U,Ae).formatToParts(le).find(Ye=>Ye.type.toLowerCase()==="timezonename");return _e?_e.value:null}function yl(q,O){let U=parseInt(q,10);Number.isNaN(U)&&(U=0);const Q=parseInt(O,10)||0,le=U<0||Object.is(U,-0)?-Q:Q;return U*60+le}function fs(q){const O=Number(q);if(typeof q=="boolean"||q===""||!Number.isFinite(O))throw new i(`Invalid unit value ${q}`);return O}function rc(q,O){const U={};for(const Q in q)if(It(q,Q)){const le=q[Q];if(le==null)continue;U[O(Q)]=fs(le)}return U}function Ds(q,O){const U=Math.trunc(Math.abs(q/60)),Q=Math.trunc(Math.abs(q%60)),le=q>=0?"+":"-";switch(O){case"short":return`${le}${Zt(U,2)}:${Zt(Q,2)}`;case"narrow":return`${le}${U}${Q>0?`:${Q}`:""}`;case"techie":return`${le}${Zt(U,2)}${Zt(Q,2)}`;default:throw new RangeError(`Value format ${O} is out of range for property format`)}}function vl(q){return $t(q,["hour","minute","second","millisecond"])}const du=["January","February","March","April","May","June","July","August","September","October","November","December"],_d=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Jp=["J","F","M","A","M","J","J","A","S","O","N","D"];function bl(q){switch(q){case"narrow":return[...Jp];case"short":return[..._d];case"long":return[...du];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 oc=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ac=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],js=["M","T","W","T","F","S","S"];function ps(q){switch(q){case"narrow":return[...js];case"short":return[...ac];case"long":return[...oc];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const fu=["AM","PM"],pu=["Before Christ","Anno Domini"],Bd=["BC","AD"],xl=["B","A"];function $a(q){switch(q){case"narrow":return[...xl];case"short":return[...Bd];case"long":return[...pu];default:return null}}function hu(q){return fu[q.hour<12?0:1]}function Sl(q,O){return ps(O)[q.weekday-1]}function $i(q,O){return bl(O)[q.month-1]}function mu(q,O){return $a(O)[q.year<0?0:1]}function ic(q,O,U="always",Q=!1){const le={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."]},we=["hours","minutes","seconds"].indexOf(q)===-1;if(U==="auto"&&we){const Ln=q==="days";switch(O){case 1:return Ln?"tomorrow":`next ${le[q][0]}`;case-1:return Ln?"yesterday":`last ${le[q][0]}`;case 0:return Ln?"today":`this ${le[q][0]}`}}const Ae=Object.is(O,-0)||O<0,_e=Math.abs(O),Ye=_e===1,Pt=le[q],vn=Q?Ye?Pt[1]:Pt[2]||Pt[1]:Ye?le[q][0]:q;return Ae?`${_e} ${vn} ago`:`in ${_e} ${vn}`}function gu(q,O){let U="";for(const Q of q)Q.literal?U+=Q.val:U+=O(Q.val);return U}const sc={D:h,DD:g,DDD:b,DDDD:S,t:w,tt:x,ttt:R,tttt:k,T,TT:$,TTT:A,TTTT:z,f:j,ff:L,fff:N,ffff:V,F:B,FF:F,FFF:D,FFFF:I};class no{static create(O,U={}){return new no(O,U)}static parseFormat(O){let U=null,Q="",le=!1;const we=[];for(let Ae=0;Ae<O.length;Ae++){const _e=O.charAt(Ae);_e==="'"?((Q.length>0||le)&&we.push({literal:le||/^\s+$/.test(Q),val:Q===""?"'":Q}),U=null,Q="",le=!le):le||_e===U?Q+=_e:(Q.length>0&&we.push({literal:/^\s+$/.test(Q),val:Q}),Q=_e,U=_e)}return Q.length>0&&we.push({literal:le||/^\s+$/.test(Q),val:Q}),we}static macroTokenToFormatOpts(O){return sc[O]}constructor(O,U){this.opts=U,this.loc=O,this.systemLoc=null}formatWithSystemDefault(O,U){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(O,{...this.opts,...U}).format()}dtFormatter(O,U={}){return this.loc.dtFormatter(O,{...this.opts,...U})}formatDateTime(O,U){return this.dtFormatter(O,U).format()}formatDateTimeParts(O,U){return this.dtFormatter(O,U).formatToParts()}formatInterval(O,U){return this.dtFormatter(O.start,U).dtf.formatRange(O.start.toJSDate(),O.end.toJSDate())}resolvedOptions(O,U){return this.dtFormatter(O,U).resolvedOptions()}num(O,U=0,Q=void 0){if(this.opts.forceSimple)return Zt(O,U);const le={...this.opts};return U>0&&(le.padTo=U),Q&&(le.signDisplay=Q),this.loc.numberFormatter(le).format(O)}formatDateTimeFromString(O,U){const Q=this.loc.listingMode()==="en",le=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",we=(Mn,Xr)=>this.loc.extract(O,Mn,Xr),Ae=Mn=>O.isOffsetFixed&&O.offset===0&&Mn.allowZ?"Z":O.isValid?O.zone.formatOffset(O.ts,Mn.format):"",_e=()=>Q?hu(O):we({hour:"numeric",hourCycle:"h12"},"dayperiod"),Ye=(Mn,Xr)=>Q?$i(O,Mn):we(Xr?{month:Mn}:{month:Mn,day:"numeric"},"month"),Pt=(Mn,Xr)=>Q?Sl(O,Mn):we(Xr?{weekday:Mn}:{weekday:Mn,month:"long",day:"numeric"},"weekday"),vn=Mn=>{const Xr=no.macroTokenToFormatOpts(Mn);return Xr?this.formatWithSystemDefault(O,Xr):Mn},Ln=Mn=>Q?mu(O,Mn):we({era:Mn},"era"),dr=Mn=>{switch(Mn){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 Ae({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return Ae({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return Ae({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 _e();case"d":return le?we({day:"numeric"},"day"):this.num(O.day);case"dd":return le?we({day:"2-digit"},"day"):this.num(O.day,2);case"c":return this.num(O.weekday);case"ccc":return Pt("short",!0);case"cccc":return Pt("long",!0);case"ccccc":return Pt("narrow",!0);case"E":return this.num(O.weekday);case"EEE":return Pt("short",!1);case"EEEE":return Pt("long",!1);case"EEEEE":return Pt("narrow",!1);case"L":return le?we({month:"numeric",day:"numeric"},"month"):this.num(O.month);case"LL":return le?we({month:"2-digit",day:"numeric"},"month"):this.num(O.month,2);case"LLL":return Ye("short",!0);case"LLLL":return Ye("long",!0);case"LLLLL":return Ye("narrow",!0);case"M":return le?we({month:"numeric"},"month"):this.num(O.month);case"MM":return le?we({month:"2-digit"},"month"):this.num(O.month,2);case"MMM":return Ye("short",!1);case"MMMM":return Ye("long",!1);case"MMMMM":return Ye("narrow",!1);case"y":return le?we({year:"numeric"},"year"):this.num(O.year);case"yy":return le?we({year:"2-digit"},"year"):this.num(O.year.toString().slice(-2),2);case"yyyy":return le?we({year:"numeric"},"year"):this.num(O.year,4);case"yyyyyy":return le?we({year:"numeric"},"year"):this.num(O.year,6);case"G":return Ln("short");case"GG":return Ln("long");case"GGGGG":return Ln("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 vn(Mn)}};return gu(no.parseFormat(U),dr)}formatDurationFromString(O,U){const Q=this.opts.signMode==="negativeLargestOnly"?-1:1,le=vn=>{switch(vn[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}},we=(vn,Ln)=>dr=>{const Mn=le(dr);if(Mn){const Xr=Ln.isNegativeDuration&&Mn!==Ln.largestUnit?Q:1;let Vo;return this.opts.signMode==="negativeLargestOnly"&&Mn!==Ln.largestUnit?Vo="never":this.opts.signMode==="all"?Vo="always":Vo="auto",this.num(vn.get(Mn)*Xr,dr.length,Vo)}else return dr},Ae=no.parseFormat(U),_e=Ae.reduce((vn,{literal:Ln,val:dr})=>Ln?vn:vn.concat(dr),[]),Ye=O.shiftTo(..._e.map(le).filter(vn=>vn)),Pt={isNegativeDuration:Ye<0,largestUnit:Object.keys(Ye.values)[0]};return gu(Ae,we(Ye,Pt))}}const yu=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function _(...q){const O=q.reduce((U,Q)=>U+Q.source,"");return RegExp(`^${O}$`)}function bo(...q){return O=>q.reduce(([U,Q,le],we)=>{const[Ae,_e,Ye]=we(O,le);return[{...U,...Ae},_e||Q,Ye]},[{},null,1]).slice(0,2)}function ro(q,...O){if(q==null)return[null,null];for(const[U,Q]of O){const le=U.exec(q);if(le)return Q(le)}return[null,null]}function Za(...q){return(O,U)=>{const Q={};let le;for(le=0;le<q.length;le++)Q[q[le]]=Dr(O[U+le]);return[Q,null,U+le]}}const $e=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,hs=`(?:${$e.source}?(?:\\[(${yu.source})\\])?)?`,In=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,Uo=RegExp(`${In.source}${hs}`),Ns=RegExp(`(?:[Tt]${Uo.source})?`),vu=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Ud=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Vd=/(\d{4})-?(\d{3})/,et=Za("weekYear","weekNumber","weekDay"),bu=Za("year","ordinal"),xu=/(\d{4})-(\d\d)-(\d\d)/,lc=RegExp(`${In.source} ?(?:${$e.source}|(${yu.source}))?`),Hd=RegExp(`(?: ${lc.source})?`);function Is(q,O,U){const Q=q[O];return Ve(Q)?U:Dr(Q)}function wl(q,O){return[{year:Is(q,O),month:Is(q,O+1,1),day:Is(q,O+2,1)},null,O+3]}function ms(q,O){return[{hours:Is(q,O,0),minutes:Is(q,O+1,0),seconds:Is(q,O+2,0),milliseconds:Mo(q[O+3])},null,O+4]}function Ls(q,O){const U=!q[O]&&!q[O+1],Q=yl(q[O+1],q[O+2]),le=U?null:kt.instance(Q);return[{},le,O+3]}function oa(q,O){const U=q[O]?re.create(q[O]):null;return[{},U,O+1]}const eh=RegExp(`^T?${In.source}$`),th=/^-?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 Cl(q){const[O,U,Q,le,we,Ae,_e,Ye,Pt]=q,vn=O[0]==="-",Ln=Ye&&Ye[0]==="-",dr=(Mn,Xr=!1)=>Mn!==void 0&&(Xr||Mn&&vn)?-Mn:Mn;return[{years:dr(io(U)),months:dr(io(Q)),weeks:dr(io(le)),days:dr(io(we)),hours:dr(io(Ae)),minutes:dr(io(_e)),seconds:dr(io(Ye),Ye==="-0"),milliseconds:dr(Mo(Pt),Ln)}]}const qd={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Su(q,O,U,Q,le,we,Ae){const _e={year:O.length===2?Oi(Dr(O)):Dr(O),month:_d.indexOf(U)+1,day:Dr(Q),hour:Dr(le),minute:Dr(we)};return Ae&&(_e.second=Dr(Ae)),q&&(_e.weekday=q.length>3?oc.indexOf(q)+1:ac.indexOf(q)+1),_e}const nh=/^(?:(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 Wd(q){const[,O,U,Q,le,we,Ae,_e,Ye,Pt,vn,Ln]=q,dr=Su(O,le,Q,U,we,Ae,_e);let Mn;return Ye?Mn=qd[Ye]:Pt?Mn=0:Mn=yl(vn,Ln),[dr,new kt(Mn)]}function rh(q){return q.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const Yd=/^(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$/,wu=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,oh=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function cc(q){const[,O,U,Q,le,we,Ae,_e]=q;return[Su(O,le,Q,U,we,Ae,_e),kt.utcInstance]}function ah(q){const[,O,U,Q,le,we,Ae,_e]=q;return[Su(O,_e,U,Q,le,we,Ae),kt.utcInstance]}const ih=_(vu,Ns),sh=_(Ud,Ns),lh=_(Vd,Ns),Cu=_(Uo),zs=bo(wl,ms,Ls,oa),ch=bo(et,ms,Ls,oa),Gd=bo(bu,ms,Ls,oa),Kd=bo(ms,Ls,oa);function Xd(q){return ro(q,[ih,zs],[sh,ch],[lh,Gd],[Cu,Kd])}function Qd(q){return ro(rh(q),[nh,Wd])}function Zd(q){return ro(q,[Yd,cc],[wu,cc],[oh,ah])}function Fs(q){return ro(q,[th,Cl])}const uh=bo(ms);function dh(q){return ro(q,[eh,uh])}const fh=_(xu,Hd),Jd=_(lc),ef=bo(ms,Ls,oa);function kl(q){return ro(q,[fh,zs],[Jd,ef])}const nr="Invalid Duration",gs={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}},Kr={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},...gs},H=146097/400,Z=146097/4800,K={years:{quarters:4,months:12,weeks:H/7,days:H,hours:H*24,minutes:H*24*60,seconds:H*24*60*60,milliseconds:H*24*60*60*1e3},quarters:{months:3,weeks:H/28,days:H/4,hours:H*24/4,minutes:H*24*60/4,seconds:H*24*60*60/4,milliseconds:H*24*60*60*1e3/4},months:{weeks:Z/7,days:Z,hours:Z*24,minutes:Z*24*60,seconds:Z*24*60*60,milliseconds:Z*24*60*60*1e3},...gs},Ee=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Qt=Ee.slice(0).reverse();function Yt(q,O,U=!1){const Q={values:U?O.values:{...q.values,...O.values||{}},loc:q.loc.clone(O.loc),conversionAccuracy:O.conversionAccuracy||q.conversionAccuracy,matrix:O.matrix||q.matrix};return new Kt(Q)}function $n(q,O){var U;let Q=(U=O.milliseconds)!=null?U:0;for(const le of Qt.slice(1))O[le]&&(Q+=O[le]*q[le].milliseconds);return Q}function Gn(q,O){const U=$n(q,O)<0?-1:1;Ee.reduceRight((Q,le)=>{if(Ve(O[le]))return Q;if(Q){const we=O[Q]*U,Ae=q[le][Q],_e=Math.floor(we/Ae);O[le]+=_e*U,O[Q]-=_e*Ae*U}return le},null),Ee.reduce((Q,le)=>{if(Ve(O[le]))return Q;if(Q){const we=O[Q]%1;O[Q]-=we,O[le]+=we*q[Q][le]}return le},null)}function Kn(q){const O={};for(const[U,Q]of Object.entries(q))Q!==0&&(O[U]=Q);return O}class Kt{constructor(O){const U=O.conversionAccuracy==="longterm"||!1;let Q=U?K:Kr;O.matrix&&(Q=O.matrix),this.values=O.values,this.loc=O.loc||Me.create(),this.conversionAccuracy=U?"longterm":"casual",this.invalid=O.invalid||null,this.matrix=Q,this.isLuxonDuration=!0}static fromMillis(O,U){return Kt.fromObject({milliseconds:O},U)}static fromObject(O,U={}){if(O==null||typeof O!="object")throw new i(`Duration.fromObject: argument expected to be an object, got ${O===null?"null":typeof O}`);return new Kt({values:rc(O,Kt.normalizeUnit),loc:Me.fromObject(U),conversionAccuracy:U.conversionAccuracy,matrix:U.matrix})}static fromDurationLike(O){if(At(O))return Kt.fromMillis(O);if(Kt.isDuration(O))return O;if(typeof O=="object")return Kt.fromObject(O);throw new i(`Unknown duration argument ${O} of type ${typeof O}`)}static fromISO(O,U){const[Q]=Fs(O);return Q?Kt.fromObject(Q,U):Kt.invalid("unparsable",`the input "${O}" can't be parsed as ISO 8601`)}static fromISOTime(O,U){const[Q]=dh(O);return Q?Kt.fromObject(Q,U):Kt.invalid("unparsable",`the input "${O}" can't be parsed as ISO 8601`)}static invalid(O,U=null){if(!O)throw new i("need to specify a reason the Duration is invalid");const Q=O instanceof _n?O:new _n(O,U);if(an.throwOnInvalid)throw new r(Q);return new Kt({invalid:Q})}static normalizeUnit(O){const U={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(!U)throw new a(O);return U}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,U={}){const Q={...U,floor:U.round!==!1&&U.floor!==!1};return this.isValid?no.create(this.loc,Q).formatDurationFromString(this,O):nr}toHuman(O={}){if(!this.isValid)return nr;const U=O.showZeros!==!1,Q=Ee.map(le=>{const we=this.values[le];return Ve(we)||we===0&&!U?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...O,unit:le.slice(0,-1)}).format(we)}).filter(le=>le);return this.loc.listFormatter({type:"conjunction",style:O.listStyle||"narrow",...O}).format(Q)}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+=us(this.seconds+this.milliseconds/1e3,3)+"S"),O==="P"&&(O+="T0S"),O}toISOTime(O={}){if(!this.isValid)return null;const U=this.toMillis();return U<0||U>=864e5?null:(O={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...O,includeOffset:!1},yn.fromMillis(U,{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?$n(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(O){if(!this.isValid)return this;const U=Kt.fromDurationLike(O),Q={};for(const le of Ee)(It(U.values,le)||It(this.values,le))&&(Q[le]=U.get(le)+this.get(le));return Yt(this,{values:Q},!0)}minus(O){if(!this.isValid)return this;const U=Kt.fromDurationLike(O);return this.plus(U.negate())}mapUnits(O){if(!this.isValid)return this;const U={};for(const Q of Object.keys(this.values))U[Q]=fs(O(this.values[Q],Q));return Yt(this,{values:U},!0)}get(O){return this[Kt.normalizeUnit(O)]}set(O){if(!this.isValid)return this;const U={...this.values,...rc(O,Kt.normalizeUnit)};return Yt(this,{values:U})}reconfigure({locale:O,numberingSystem:U,conversionAccuracy:Q,matrix:le}={}){const we={loc:this.loc.clone({locale:O,numberingSystem:U}),matrix:le,conversionAccuracy:Q};return Yt(this,we)}as(O){return this.isValid?this.shiftTo(O).get(O):NaN}normalize(){if(!this.isValid)return this;const O=this.toObject();return Gn(this.matrix,O),Yt(this,{values:O},!0)}rescale(){if(!this.isValid)return this;const O=Kn(this.normalize().shiftToAll().toObject());return Yt(this,{values:O},!0)}shiftTo(...O){if(!this.isValid)return this;if(O.length===0)return this;O=O.map(Ae=>Kt.normalizeUnit(Ae));const U={},Q={},le=this.toObject();let we;for(const Ae of Ee)if(O.indexOf(Ae)>=0){we=Ae;let _e=0;for(const Pt in Q)_e+=this.matrix[Pt][Ae]*Q[Pt],Q[Pt]=0;At(le[Ae])&&(_e+=le[Ae]);const Ye=Math.trunc(_e);U[Ae]=Ye,Q[Ae]=(_e*1e3-Ye*1e3)/1e3}else At(le[Ae])&&(Q[Ae]=le[Ae]);for(const Ae in Q)Q[Ae]!==0&&(U[we]+=Ae===we?Q[Ae]:Q[Ae]/this.matrix[we][Ae]);return Gn(this.matrix,U),Yt(this,{values:U},!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 U of Object.keys(this.values))O[U]=this.values[U]===0?0:-this.values[U];return Yt(this,{values:O},!0)}removeZeros(){if(!this.isValid)return this;const O=Kn(this.values);return Yt(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 U(Q,le){return Q===void 0||Q===0?le===void 0||le===0:Q===le}for(const Q of Ee)if(!U(this.values[Q],O.values[Q]))return!1;return!0}}const kr="Invalid Interval";function Er(q,O){return!q||!q.isValid?cn.invalid("missing or invalid start"):!O||!O.isValid?cn.invalid("missing or invalid end"):O<q?cn.invalid("end before start",`The end of an interval must be after its start, but you had start=${q.toISO()} and end=${O.toISO()}`):null}class cn{constructor(O){this.s=O.start,this.e=O.end,this.invalid=O.invalid||null,this.isLuxonInterval=!0}static invalid(O,U=null){if(!O)throw new i("need to specify a reason the Interval is invalid");const Q=O instanceof _n?O:new _n(O,U);if(an.throwOnInvalid)throw new n(Q);return new cn({invalid:Q})}static fromDateTimes(O,U){const Q=oi(O),le=oi(U);return Er(Q,le)??new cn({start:Q,end:le})}static after(O,U){const Q=Kt.fromDurationLike(U),le=oi(O);return cn.fromDateTimes(le,le.plus(Q))}static before(O,U){const Q=Kt.fromDurationLike(U),le=oi(O);return cn.fromDateTimes(le.minus(Q),le)}static fromISO(O,U){const[Q,le]=(O||"").split("/",2);if(Q&&le){let we,Ae;try{we=yn.fromISO(Q,U),Ae=we.isValid}catch{Ae=!1}let _e,Ye;try{_e=yn.fromISO(le,U),Ye=_e.isValid}catch{Ye=!1}if(Ae&&Ye)return cn.fromDateTimes(we,_e);if(Ae){const Pt=Kt.fromISO(le,U);if(Pt.isValid)return cn.after(we,Pt)}else if(Ye){const Pt=Kt.fromISO(Q,U);if(Pt.isValid)return cn.before(_e,Pt)}}return cn.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",U){if(!this.isValid)return NaN;const Q=this.start.startOf(O,U);let le;return U!=null&&U.useLocaleWeeks?le=this.end.reconfigure({locale:Q.locale}):le=this.end,le=le.startOf(O,U),Math.floor(le.diff(Q,O).get(O))+(le.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:U}={}){return this.isValid?cn.fromDateTimes(O||this.s,U||this.e):this}splitAt(...O){if(!this.isValid)return[];const U=O.map(oi).filter(Ae=>this.contains(Ae)).sort((Ae,_e)=>Ae.toMillis()-_e.toMillis()),Q=[];let{s:le}=this,we=0;for(;le<this.e;){const Ae=U[we]||this.e,_e=+Ae>+this.e?this.e:Ae;Q.push(cn.fromDateTimes(le,_e)),le=_e,we+=1}return Q}splitBy(O){const U=Kt.fromDurationLike(O);if(!this.isValid||!U.isValid||U.as("milliseconds")===0)return[];let{s:Q}=this,le=1,we;const Ae=[];for(;Q<this.e;){const _e=this.start.plus(U.mapUnits(Ye=>Ye*le));we=+_e>+this.e?this.e:_e,Ae.push(cn.fromDateTimes(Q,we)),Q=we,le+=1}return Ae}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 U=this.s>O.s?this.s:O.s,Q=this.e<O.e?this.e:O.e;return U>=Q?null:cn.fromDateTimes(U,Q)}union(O){if(!this.isValid)return this;const U=this.s<O.s?this.s:O.s,Q=this.e>O.e?this.e:O.e;return cn.fromDateTimes(U,Q)}static merge(O){const[U,Q]=O.sort((le,we)=>le.s-we.s).reduce(([le,we],Ae)=>we?we.overlaps(Ae)||we.abutsStart(Ae)?[le,we.union(Ae)]:[le.concat([we]),Ae]:[le,Ae],[[],null]);return Q&&U.push(Q),U}static xor(O){let U=null,Q=0;const le=[],we=O.map(Ye=>[{time:Ye.s,type:"s"},{time:Ye.e,type:"e"}]),Ae=Array.prototype.concat(...we),_e=Ae.sort((Ye,Pt)=>Ye.time-Pt.time);for(const Ye of _e)Q+=Ye.type==="s"?1:-1,Q===1?U=Ye.time:(U&&+U!=+Ye.time&&le.push(cn.fromDateTimes(U,Ye.time)),U=null);return cn.merge(le)}difference(...O){return cn.xor([this].concat(O)).map(U=>this.intersection(U)).filter(U=>U&&!U.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:kr}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(O=h,U={}){return this.isValid?no.create(this.s.loc.clone(U),O).formatInterval(this):kr}toISO(O){return this.isValid?`${this.s.toISO(O)}/${this.e.toISO(O)}`:kr}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:kr}toISOTime(O){return this.isValid?`${this.s.toISOTime(O)}/${this.e.toISOTime(O)}`:kr}toFormat(O,{separator:U=" – "}={}){return this.isValid?`${this.s.toFormat(O)}${U}${this.e.toFormat(O)}`:kr}toDuration(O,U){return this.isValid?this.e.diff(this.s,O,U):Kt.invalid(this.invalidReason)}mapEndpoints(O){return cn.fromDateTimes(O(this.s),O(this.e))}}class gr{static hasDST(O=an.defaultZone){const U=yn.now().setZone(O).set({month:12});return!O.isUniversal&&U.offset!==U.set({month:6}).offset}static isValidIANAZone(O){return re.isValidZone(O)}static normalizeZone(O){return it(O,an.defaultZone)}static getStartOfWeek({locale:O=null,locObj:U=null}={}){return(U||Me.create(O)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:O=null,locObj:U=null}={}){return(U||Me.create(O)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:O=null,locObj:U=null}={}){return(U||Me.create(O)).getWeekendDays().slice()}static months(O="long",{locale:U=null,numberingSystem:Q=null,locObj:le=null,outputCalendar:we="gregory"}={}){return(le||Me.create(U,Q,we)).months(O)}static monthsFormat(O="long",{locale:U=null,numberingSystem:Q=null,locObj:le=null,outputCalendar:we="gregory"}={}){return(le||Me.create(U,Q,we)).months(O,!0)}static weekdays(O="long",{locale:U=null,numberingSystem:Q=null,locObj:le=null}={}){return(le||Me.create(U,Q,null)).weekdays(O)}static weekdaysFormat(O="long",{locale:U=null,numberingSystem:Q=null,locObj:le=null}={}){return(le||Me.create(U,Q,null)).weekdays(O,!0)}static meridiems({locale:O=null}={}){return Me.create(O).meridiems()}static eras(O="short",{locale:U=null}={}){return Me.create(U,null,"gregory").eras(O)}static features(){return{relative:Oe(),localeWeek:ct()}}}function Vr(q,O){const U=le=>le.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),Q=U(O)-U(q);return Math.floor(Kt.fromMillis(Q).as("days"))}function Wr(q,O,U){const Q=[["years",(Ye,Pt)=>Pt.year-Ye.year],["quarters",(Ye,Pt)=>Pt.quarter-Ye.quarter+(Pt.year-Ye.year)*4],["months",(Ye,Pt)=>Pt.month-Ye.month+(Pt.year-Ye.year)*12],["weeks",(Ye,Pt)=>{const vn=Vr(Ye,Pt);return(vn-vn%7)/7}],["days",Vr]],le={},we=q;let Ae,_e;for(const[Ye,Pt]of Q)U.indexOf(Ye)>=0&&(Ae=Ye,le[Ye]=Pt(q,O),_e=we.plus(le),_e>O?(le[Ye]--,q=we.plus(le),q>O&&(_e=q,le[Ye]--,q=we.plus(le))):q=_e);return[q,le,_e,Ae]}function Ja(q,O,U,Q){let[le,we,Ae,_e]=Wr(q,O,U);const Ye=O-le,Pt=U.filter(Ln=>["hours","minutes","seconds","milliseconds"].indexOf(Ln)>=0);Pt.length===0&&(Ae<O&&(Ae=le.plus({[_e]:1})),Ae!==le&&(we[_e]=(we[_e]||0)+Ye/(Ae-le)));const vn=Kt.fromObject(we,Q);return Pt.length>0?Kt.fromMillis(Ye,Q).shiftTo(...Pt).plus(vn):vn}const va="missing Intl.DateTimeFormat.formatToParts support";function Bn(q,O=U=>U){return{regex:q,deser:([U])=>O(xn(U))}}const El="[ ]",ba=new RegExp(El,"g");function ys(q){return q.replace(/\./g,"\\.?").replace(ba,El)}function aa(q){return q.replace(/\./g,"").replace(ba," ").toLowerCase()}function oo(q,O){return q===null?null:{regex:RegExp(q.map(ys).join("|")),deser:([U])=>q.findIndex(Q=>aa(U)===aa(Q))+O}}function Rl(q,O){return{regex:q,deser:([,U,Q])=>yl(U,Q),groups:O}}function xo(q){return{regex:q,deser:([O])=>O}}function uc(q){return q.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function ph(q,O){const U=Wt(O),Q=Wt(O,"{2}"),le=Wt(O,"{3}"),we=Wt(O,"{4}"),Ae=Wt(O,"{6}"),_e=Wt(O,"{1,2}"),Ye=Wt(O,"{1,3}"),Pt=Wt(O,"{1,6}"),vn=Wt(O,"{1,9}"),Ln=Wt(O,"{2,4}"),dr=Wt(O,"{4,6}"),Mn=Vo=>({regex:RegExp(uc(Vo.val)),deser:([Pa])=>Pa,literal:!0}),Xr=(Vo=>{if(q.literal)return Mn(Vo);switch(Vo.val){case"G":return oo(O.eras("short"),0);case"GG":return oo(O.eras("long"),0);case"y":return Bn(Pt);case"yy":return Bn(Ln,Oi);case"yyyy":return Bn(we);case"yyyyy":return Bn(dr);case"yyyyyy":return Bn(Ae);case"M":return Bn(_e);case"MM":return Bn(Q);case"MMM":return oo(O.months("short",!0),1);case"MMMM":return oo(O.months("long",!0),1);case"L":return Bn(_e);case"LL":return Bn(Q);case"LLL":return oo(O.months("short",!1),1);case"LLLL":return oo(O.months("long",!1),1);case"d":return Bn(_e);case"dd":return Bn(Q);case"o":return Bn(Ye);case"ooo":return Bn(le);case"HH":return Bn(Q);case"H":return Bn(_e);case"hh":return Bn(Q);case"h":return Bn(_e);case"mm":return Bn(Q);case"m":return Bn(_e);case"q":return Bn(_e);case"qq":return Bn(Q);case"s":return Bn(_e);case"ss":return Bn(Q);case"S":return Bn(Ye);case"SSS":return Bn(le);case"u":return xo(vn);case"uu":return xo(_e);case"uuu":return Bn(U);case"a":return oo(O.meridiems(),0);case"kkkk":return Bn(we);case"kk":return Bn(Ln,Oi);case"W":return Bn(_e);case"WW":return Bn(Q);case"E":case"c":return Bn(U);case"EEE":return oo(O.weekdays("short",!1),1);case"EEEE":return oo(O.weekdays("long",!1),1);case"ccc":return oo(O.weekdays("short",!0),1);case"cccc":return oo(O.weekdays("long",!0),1);case"Z":case"ZZ":return Rl(new RegExp(`([+-]${_e.source})(?::(${Q.source}))?`),2);case"ZZZ":return Rl(new RegExp(`([+-]${_e.source})(${Q.source})?`),2);case"z":return xo(/[a-z_+-/]{1,256}?/i);case" ":return xo(/[^\S\n\r]/);default:return Mn(Vo)}})(q)||{invalidReason:va};return Xr.token=q,Xr}const xy={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 Tl(q,O,U){const{type:Q,value:le}=q;if(Q==="literal"){const Ye=/^\s+$/.test(le);return{literal:!Ye,val:Ye?" ":le}}const we=O[Q];let Ae=Q;Q==="hour"&&(O.hour12!=null?Ae=O.hour12?"hour12":"hour24":O.hourCycle!=null?O.hourCycle==="h11"||O.hourCycle==="h12"?Ae="hour12":Ae="hour24":Ae=U.hour12?"hour12":"hour24");let _e=xy[Ae];if(typeof _e=="object"&&(_e=_e[we]),_e)return{literal:!1,val:_e}}function Sy(q){return[`^${q.map(O=>O.regex).reduce((O,U)=>`${O}(${U.source})`,"")}$`,q]}function wy(q,O,U){const Q=q.match(O);if(Q){const le={};let we=1;for(const Ae in U)if(It(U,Ae)){const _e=U[Ae],Ye=_e.groups?_e.groups+1:1;!_e.literal&&_e.token&&(le[_e.token.val[0]]=_e.deser(Q.slice(we,we+Ye))),we+=Ye}return[Q,le]}else return[Q,{}]}function Cy(q){const O=le=>{switch(le){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 U=null,Q;return Ve(q.z)||(U=re.create(q.z)),Ve(q.Z)||(U||(U=new kt(q.Z)),Q=q.Z),Ve(q.q)||(q.M=(q.q-1)*3+1),Ve(q.h)||(q.h<12&&q.a===1?q.h+=12:q.h===12&&q.a===0&&(q.h=0)),q.G===0&&q.y&&(q.y=-q.y),Ve(q.u)||(q.S=Mo(q.u)),[Object.keys(q).reduce((le,we)=>{const Ae=O(we);return Ae&&(le[Ae]=q[we]),le},{}),U,Q]}let hh=null;function Ux(){return hh||(hh=yn.fromMillis(1555555555555)),hh}function Vx(q,O){if(q.literal)return q;const U=no.macroTokenToFormatOpts(q.val),Q=yh(U,O);return Q==null||Q.includes(void 0)?q:Q}function mh(q,O){return Array.prototype.concat(...q.map(U=>Vx(U,O)))}class gh{constructor(O,U){if(this.locale=O,this.format=U,this.tokens=mh(no.parseFormat(U),O),this.units=this.tokens.map(Q=>ph(Q,O)),this.disqualifyingUnit=this.units.find(Q=>Q.invalidReason),!this.disqualifyingUnit){const[Q,le]=Sy(this.units);this.regex=RegExp(Q,"i"),this.handlers=le}}explainFromTokens(O){if(this.isValid){const[U,Q]=wy(O,this.regex,this.handlers),[le,we,Ae]=Q?Cy(Q):[null,null,void 0];if(It(Q,"a")&&It(Q,"H"))throw new o("Can't include meridiem when specifying 24-hour format");return{input:O,tokens:this.tokens,regex:this.regex,rawMatches:U,matches:Q,result:le,zone:we,specificOffset:Ae}}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 tf(q,O,U){return new gh(q,U).explainFromTokens(O)}function ei(q,O,U){const{result:Q,zone:le,specificOffset:we,invalidReason:Ae}=tf(q,O,U);return[Q,le,we,Ae]}function yh(q,O){if(!q)return null;const U=no.create(O,q).dtFormatter(Ux()),Q=U.formatToParts(),le=U.resolvedOptions();return Q.map(we=>Tl(we,q,le))}const ia="Invalid DateTime",xa=864e13;function Pi(q){return new _n("unsupported zone",`the zone "${q.name}" is not supported`)}function ku(q){return q.weekData===null&&(q.weekData=Mt(q.c)),q.weekData}function dc(q){return q.localWeekData===null&&(q.localWeekData=Mt(q.c,q.loc.getMinDaysInFirstWeek(),q.loc.getStartOfWeek())),q.localWeekData}function Ai(q,O){const U={ts:q.ts,zone:q.zone,c:q.c,o:q.o,loc:q.loc,invalid:q.invalid};return new yn({...U,...O,old:U})}function nf(q,O,U){let Q=q-O*60*1e3;const le=U.offset(Q);if(O===le)return[Q,O];Q-=(le-O)*60*1e3;const we=U.offset(Q);return le===we?[Q,le]:[q-Math.min(le,we)*60*1e3,Math.max(le,we)]}function vs(q,O){q+=O*60*1e3;const U=new Date(q);return{year:U.getUTCFullYear(),month:U.getUTCMonth()+1,day:U.getUTCDate(),hour:U.getUTCHours(),minute:U.getUTCMinutes(),second:U.getUTCSeconds(),millisecond:U.getUTCMilliseconds()}}function Eu(q,O,U){return nf(Qa(q),O,U)}function Ru(q,O){const U=q.o,Q=q.c.year+Math.trunc(O.years),le=q.c.month+Math.trunc(O.months)+Math.trunc(O.quarters)*3,we={...q.c,year:Q,month:le,day:Math.min(q.c.day,_r(Q,le))+Math.trunc(O.days)+Math.trunc(O.weeks)*7},Ae=Kt.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"),_e=Qa(we);let[Ye,Pt]=nf(_e,U,q.zone);return Ae!==0&&(Ye+=Ae,Pt=q.zone.offset(Ye)),{ts:Ye,o:Pt}}function ti(q,O,U,Q,le,we){const{setZone:Ae,zone:_e}=U;if(q&&Object.keys(q).length!==0||O){const Ye=O||_e,Pt=yn.fromObject(q,{...U,zone:Ye,specificOffset:we});return Ae?Pt:Pt.setZone(_e)}else return yn.invalid(new _n("unparsable",`the input "${le}" can't be parsed as ${Q}`))}function rf(q,O,U=!0){return q.isValid?no.create(Me.create("en-US"),{allowZ:U,forceSimple:!0}).formatDateTimeFromString(q,O):null}function Qo(q,O,U){const Q=q.c.year>9999||q.c.year<0;let le="";if(Q&&q.c.year>=0&&(le+="+"),le+=Zt(q.c.year,Q?6:4),U==="year")return le;if(O){if(le+="-",le+=Zt(q.c.month),U==="month")return le;le+="-"}else if(le+=Zt(q.c.month),U==="month")return le;return le+=Zt(q.c.day),le}function of(q,O,U,Q,le,we,Ae){let _e=!U||q.c.millisecond!==0||q.c.second!==0,Ye="";switch(Ae){case"day":case"month":case"year":break;default:if(Ye+=Zt(q.c.hour),Ae==="hour")break;if(O){if(Ye+=":",Ye+=Zt(q.c.minute),Ae==="minute")break;_e&&(Ye+=":",Ye+=Zt(q.c.second))}else{if(Ye+=Zt(q.c.minute),Ae==="minute")break;_e&&(Ye+=Zt(q.c.second))}if(Ae==="second")break;_e&&(!Q||q.c.millisecond!==0)&&(Ye+=".",Ye+=Zt(q.c.millisecond,3))}return le&&(q.isOffsetFixed&&q.offset===0&&!we?Ye+="Z":q.o<0?(Ye+="-",Ye+=Zt(Math.trunc(-q.o/60)),Ye+=":",Ye+=Zt(Math.trunc(-q.o%60))):(Ye+="+",Ye+=Zt(Math.trunc(q.o/60)),Ye+=":",Ye+=Zt(Math.trunc(q.o%60)))),we&&(Ye+="["+q.zone.ianaName+"]"),Ye}const Di={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ky={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},af={ordinal:1,hour:0,minute:0,second:0,millisecond:0},ji=["year","month","day","hour","minute","second","millisecond"],vh=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],bh=["year","ordinal","hour","minute","second","millisecond"];function bs(q){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"}[q.toLowerCase()];if(!O)throw new a(q);return O}function Ml(q){switch(q.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return bs(q)}}function sf(q){if(ni===void 0&&(ni=an.now()),q.type!=="iana")return q.offset(ni);const O=q.name;let U=ri.get(O);return U===void 0&&(U=q.offset(ni),ri.set(O,U)),U}function Tu(q,O){const U=it(O.zone,an.defaultZone);if(!U.isValid)return yn.invalid(Pi(U));const Q=Me.fromObject(O);let le,we;if(Ve(q.year))le=an.now();else{for(const Ye of ji)Ve(q[Ye])&&(q[Ye]=Di[Ye]);const Ae=Fe(q)||mt(q);if(Ae)return yn.invalid(Ae);const _e=sf(U);[le,we]=Eu(q,_e,U)}return new yn({ts:le,zone:U,loc:Q,o:we})}function Sa(q,O,U){const Q=Ve(U.round)?!0:U.round,le=Ve(U.rounding)?"trunc":U.rounding,we=(_e,Ye)=>(_e=us(_e,Q||U.calendary?0:2,U.calendary?"round":le),O.loc.clone(U).relFormatter(U).format(_e,Ye)),Ae=_e=>U.calendary?O.hasSame(q,_e)?0:O.startOf(_e).diff(q.startOf(_e),_e).get(_e):O.diff(q,_e).get(_e);if(U.unit)return we(Ae(U.unit),U.unit);for(const _e of U.units){const Ye=Ae(_e);if(Math.abs(Ye)>=1)return we(Ye,_e)}return we(q>O?-0:0,U.units[U.units.length-1])}function wa(q){let O={},U;return q.length>0&&typeof q[q.length-1]=="object"?(O=q[q.length-1],U=Array.from(q).slice(0,q.length-1)):U=Array.from(q),[O,U]}let ni;const ri=new Map;class yn{constructor(O){const U=O.zone||an.defaultZone;let Q=O.invalid||(Number.isNaN(O.ts)?new _n("invalid input"):null)||(U.isValid?null:Pi(U));this.ts=Ve(O.ts)?an.now():O.ts;let le=null,we=null;if(!Q)if(O.old&&O.old.ts===this.ts&&O.old.zone.equals(U))[le,we]=[O.old.c,O.old.o];else{const Ae=At(O.o)&&!O.old?O.o:U.offset(this.ts);le=vs(this.ts,Ae),Q=Number.isNaN(le.year)?new _n("invalid input"):null,le=Q?null:le,we=Q?null:Ae}this._zone=U,this.loc=O.loc||Me.create(),this.invalid=Q,this.weekData=null,this.localWeekData=null,this.c=le,this.o=we,this.isLuxonDateTime=!0}static now(){return new yn({})}static local(){const[O,U]=wa(arguments),[Q,le,we,Ae,_e,Ye,Pt]=U;return Tu({year:Q,month:le,day:we,hour:Ae,minute:_e,second:Ye,millisecond:Pt},O)}static utc(){const[O,U]=wa(arguments),[Q,le,we,Ae,_e,Ye,Pt]=U;return O.zone=kt.utcInstance,Tu({year:Q,month:le,day:we,hour:Ae,minute:_e,second:Ye,millisecond:Pt},O)}static fromJSDate(O,U={}){const Q=xe(O)?O.valueOf():NaN;if(Number.isNaN(Q))return yn.invalid("invalid input");const le=it(U.zone,an.defaultZone);return le.isValid?new yn({ts:Q,zone:le,loc:Me.fromObject(U)}):yn.invalid(Pi(le))}static fromMillis(O,U={}){if(At(O))return O<-xa||O>xa?yn.invalid("Timestamp out of range"):new yn({ts:O,zone:it(U.zone,an.defaultZone),loc:Me.fromObject(U)});throw new i(`fromMillis requires a numerical input, but received a ${typeof O} with value ${O}`)}static fromSeconds(O,U={}){if(At(O))return new yn({ts:O*1e3,zone:it(U.zone,an.defaultZone),loc:Me.fromObject(U)});throw new i("fromSeconds requires a numerical input")}static fromObject(O,U={}){O=O||{};const Q=it(U.zone,an.defaultZone);if(!Q.isValid)return yn.invalid(Pi(Q));const le=Me.fromObject(U),we=rc(O,Ml),{minDaysInFirstWeek:Ae,startOfWeek:_e}=Ut(we,le),Ye=an.now(),Pt=Ve(U.specificOffset)?Q.offset(Ye):U.specificOffset,vn=!Ve(we.ordinal),Ln=!Ve(we.year),dr=!Ve(we.month)||!Ve(we.day),Mn=Ln||dr,Xr=we.weekYear||we.weekNumber;if((Mn||vn)&&Xr)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(dr&&vn)throw new o("Can't mix ordinal dates with month/day");const Vo=Xr||we.weekday&&!Mn;let Pa,Aa,Da=vs(Ye,Pt);Vo?(Pa=vh,Aa=ky,Da=Mt(Da,Ae,_e)):vn?(Pa=bh,Aa=af,Da=Xt(Da)):(Pa=ji,Aa=Di);let Ni=!1;for(const _s of Pa){const Ry=we[_s];Ve(Ry)?Ni?we[_s]=Aa[_s]:we[_s]=Da[_s]:Ni=!0}const xh=Vo?he(we,Ae,_e):vn?ge(we):Fe(we),lf=xh||mt(we);if(lf)return yn.invalid(lf);const Mu=Vo?jt(we,Ae,_e):vn?Nt(we):we,[cf,Ol]=Eu(Mu,Pt,Q),so=new yn({ts:cf,zone:Q,o:Ol,loc:le});return we.weekday&&Mn&&O.weekday!==so.weekday?yn.invalid("mismatched weekday",`you can't specify both a weekday of ${we.weekday} and a date of ${so.toISO()}`):so.isValid?so:yn.invalid(so.invalid)}static fromISO(O,U={}){const[Q,le]=Xd(O);return ti(Q,le,U,"ISO 8601",O)}static fromRFC2822(O,U={}){const[Q,le]=Qd(O);return ti(Q,le,U,"RFC 2822",O)}static fromHTTP(O,U={}){const[Q,le]=Zd(O);return ti(Q,le,U,"HTTP",U)}static fromFormat(O,U,Q={}){if(Ve(O)||Ve(U))throw new i("fromFormat requires an input string and a format");const{locale:le=null,numberingSystem:we=null}=Q,Ae=Me.fromOpts({locale:le,numberingSystem:we,defaultToEN:!0}),[_e,Ye,Pt,vn]=ei(Ae,O,U);return vn?yn.invalid(vn):ti(_e,Ye,Q,`format ${U}`,O,Pt)}static fromString(O,U,Q={}){return yn.fromFormat(O,U,Q)}static fromSQL(O,U={}){const[Q,le]=kl(O);return ti(Q,le,U,"SQL",O)}static invalid(O,U=null){if(!O)throw new i("need to specify a reason the DateTime is invalid");const Q=O instanceof _n?O:new _n(O,U);if(an.throwOnInvalid)throw new t(Q);return new yn({invalid:Q})}static isDateTime(O){return O&&O.isLuxonDateTime||!1}static parseFormatForOpts(O,U={}){const Q=yh(O,Me.fromObject(U));return Q?Q.map(le=>le?le.val:null).join(""):null}static expandFormat(O,U={}){return mh(no.parseFormat(O),Me.fromObject(U)).map(Q=>Q.val).join("")}static resetCache(){ni=void 0,ri.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?ku(this).weekYear:NaN}get weekNumber(){return this.isValid?ku(this).weekNumber:NaN}get weekday(){return this.isValid?ku(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?dc(this).weekday:NaN}get localWeekNumber(){return this.isValid?dc(this).weekNumber:NaN}get localWeekYear(){return this.isValid?dc(this).weekYear:NaN}get ordinal(){return this.isValid?Xt(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,U=6e4,Q=Qa(this.c),le=this.zone.offset(Q-O),we=this.zone.offset(Q+O),Ae=this.zone.offset(Q-le*U),_e=this.zone.offset(Q-we*U);if(Ae===_e)return[this];const Ye=Q-Ae*U,Pt=Q-_e*U,vn=vs(Ye,Ae),Ln=vs(Pt,_e);return vn.hour===Ln.hour&&vn.minute===Ln.minute&&vn.second===Ln.second&&vn.millisecond===Ln.millisecond?[Ai(this,{ts:Ye}),Ai(this,{ts:Pt})]:[this]}get isInLeapYear(){return ra(this.year)}get daysInMonth(){return _r(this.year,this.month)}get daysInYear(){return this.isValid?ur(this.year):NaN}get weeksInWeekYear(){return this.isValid?ds(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?ds(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(O={}){const{locale:U,numberingSystem:Q,calendar:le}=no.create(this.loc.clone(O),O).resolvedOptions(this);return{locale:U,numberingSystem:Q,outputCalendar:le}}toUTC(O=0,U={}){return this.setZone(kt.instance(O),U)}toLocal(){return this.setZone(an.defaultZone)}setZone(O,{keepLocalTime:U=!1,keepCalendarTime:Q=!1}={}){if(O=it(O,an.defaultZone),O.equals(this.zone))return this;if(O.isValid){let le=this.ts;if(U||Q){const we=O.offset(this.ts),Ae=this.toObject();[le]=Eu(Ae,we,O)}return Ai(this,{ts:le,zone:O})}else return yn.invalid(Pi(O))}reconfigure({locale:O,numberingSystem:U,outputCalendar:Q}={}){const le=this.loc.clone({locale:O,numberingSystem:U,outputCalendar:Q});return Ai(this,{loc:le})}setLocale(O){return this.reconfigure({locale:O})}set(O){if(!this.isValid)return this;const U=rc(O,Ml),{minDaysInFirstWeek:Q,startOfWeek:le}=Ut(U,this.loc),we=!Ve(U.weekYear)||!Ve(U.weekNumber)||!Ve(U.weekday),Ae=!Ve(U.ordinal),_e=!Ve(U.year),Ye=!Ve(U.month)||!Ve(U.day),Pt=_e||Ye,vn=U.weekYear||U.weekNumber;if((Pt||Ae)&&vn)throw new o("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(Ye&&Ae)throw new o("Can't mix ordinal dates with month/day");let Ln;we?Ln=jt({...Mt(this.c,Q,le),...U},Q,le):Ve(U.ordinal)?(Ln={...this.toObject(),...U},Ve(U.day)&&(Ln.day=Math.min(_r(Ln.year,Ln.month),Ln.day))):Ln=Nt({...Xt(this.c),...U});const[dr,Mn]=Eu(Ln,this.o,this.zone);return Ai(this,{ts:dr,o:Mn})}plus(O){if(!this.isValid)return this;const U=Kt.fromDurationLike(O);return Ai(this,Ru(this,U))}minus(O){if(!this.isValid)return this;const U=Kt.fromDurationLike(O).negate();return Ai(this,Ru(this,U))}startOf(O,{useLocaleWeeks:U=!1}={}){if(!this.isValid)return this;const Q={},le=Kt.normalizeUnit(O);switch(le){case"years":Q.month=1;case"quarters":case"months":Q.day=1;case"weeks":case"days":Q.hour=0;case"hours":Q.minute=0;case"minutes":Q.second=0;case"seconds":Q.millisecond=0;break}if(le==="weeks")if(U){const we=this.loc.getStartOfWeek(),{weekday:Ae}=this;Ae<we&&(Q.weekNumber=this.weekNumber-1),Q.weekday=we}else Q.weekday=1;if(le==="quarters"){const we=Math.ceil(this.month/3);Q.month=(we-1)*3+1}return this.set(Q)}endOf(O,U){return this.isValid?this.plus({[O]:1}).startOf(O,U).minus(1):this}toFormat(O,U={}){return this.isValid?no.create(this.loc.redefaultToEN(U)).formatDateTimeFromString(this,O):ia}toLocaleString(O=h,U={}){return this.isValid?no.create(this.loc.clone(U),O).formatDateTime(this):ia}toLocaleParts(O={}){return this.isValid?no.create(this.loc.clone(O),O).formatDateTimeParts(this):[]}toISO({format:O="extended",suppressSeconds:U=!1,suppressMilliseconds:Q=!1,includeOffset:le=!0,extendedZone:we=!1,precision:Ae="milliseconds"}={}){if(!this.isValid)return null;Ae=bs(Ae);const _e=O==="extended";let Ye=Qo(this,_e,Ae);return ji.indexOf(Ae)>=3&&(Ye+="T"),Ye+=of(this,_e,U,Q,le,we,Ae),Ye}toISODate({format:O="extended",precision:U="day"}={}){return this.isValid?Qo(this,O==="extended",bs(U)):null}toISOWeekDate(){return rf(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:O=!1,suppressSeconds:U=!1,includeOffset:Q=!0,includePrefix:le=!1,extendedZone:we=!1,format:Ae="extended",precision:_e="milliseconds"}={}){return this.isValid?(_e=bs(_e),(le&&ji.indexOf(_e)>=3?"T":"")+of(this,Ae==="extended",U,O,Q,we,_e)):null}toRFC2822(){return rf(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return rf(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Qo(this,!0):null}toSQLTime({includeOffset:O=!0,includeZone:U=!1,includeOffsetSpace:Q=!0}={}){let le="HH:mm:ss.SSS";return(U||O)&&(Q&&(le+=" "),U?le+="z":O&&(le+="ZZ")),rf(this,le,!0)}toSQL(O={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(O)}`:null}toString(){return this.isValid?this.toISO():ia}[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 U={...this.c};return O.includeConfig&&(U.outputCalendar=this.outputCalendar,U.numberingSystem=this.loc.numberingSystem,U.locale=this.loc.locale),U}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(O,U="milliseconds",Q={}){if(!this.isValid||!O.isValid)return Kt.invalid("created by diffing an invalid DateTime");const le={locale:this.locale,numberingSystem:this.numberingSystem,...Q},we=wt(U).map(Kt.normalizeUnit),Ae=O.valueOf()>this.valueOf(),_e=Ae?this:O,Ye=Ae?O:this,Pt=Ja(_e,Ye,we,le);return Ae?Pt.negate():Pt}diffNow(O="milliseconds",U={}){return this.diff(yn.now(),O,U)}until(O){return this.isValid?cn.fromDateTimes(this,O):this}hasSame(O,U,Q){if(!this.isValid)return!1;const le=O.valueOf(),we=this.setZone(O.zone,{keepLocalTime:!0});return we.startOf(U,Q)<=le&&le<=we.endOf(U,Q)}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 U=O.base||yn.fromObject({},{zone:this.zone}),Q=O.padding?this<U?-O.padding:O.padding:0;let le=["years","months","days","hours","minutes","seconds"],we=O.unit;return Array.isArray(O.unit)&&(le=O.unit,we=void 0),Sa(U,this.plus(Q),{...O,numeric:"always",units:le,unit:we})}toRelativeCalendar(O={}){return this.isValid?Sa(O.base||yn.fromObject({},{zone:this.zone}),this,{...O,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...O){if(!O.every(yn.isDateTime))throw new i("min requires all arguments be DateTimes");return Ot(O,U=>U.valueOf(),Math.min)}static max(...O){if(!O.every(yn.isDateTime))throw new i("max requires all arguments be DateTimes");return Ot(O,U=>U.valueOf(),Math.max)}static fromFormatExplain(O,U,Q={}){const{locale:le=null,numberingSystem:we=null}=Q,Ae=Me.fromOpts({locale:le,numberingSystem:we,defaultToEN:!0});return tf(Ae,O,U)}static fromStringExplain(O,U,Q={}){return yn.fromFormatExplain(O,U,Q)}static buildFormatParser(O,U={}){const{locale:Q=null,numberingSystem:le=null}=U,we=Me.fromOpts({locale:Q,numberingSystem:le,defaultToEN:!0});return new gh(we,O)}static fromFormatParser(O,U,Q={}){if(Ve(O)||Ve(U))throw new i("fromFormatParser requires an input string and a format parser");const{locale:le=null,numberingSystem:we=null}=Q,Ae=Me.fromOpts({locale:le,numberingSystem:we,defaultToEN:!0});if(!Ae.equals(U.locale))throw new i(`fromFormatParser called with a locale of ${Ae}, but the format parser was created for ${U.locale}`);const{result:_e,zone:Ye,specificOffset:Pt,invalidReason:vn}=U.explainFromTokens(O);return vn?yn.invalid(vn):ti(_e,Ye,Q,`format ${U.format}`,O,Pt)}static get DATE_SHORT(){return h}static get DATE_MED(){return g}static get DATE_MED_WITH_WEEKDAY(){return v}static get DATE_FULL(){return b}static get DATE_HUGE(){return S}static get TIME_SIMPLE(){return w}static get TIME_WITH_SECONDS(){return x}static get TIME_WITH_SHORT_OFFSET(){return R}static get TIME_WITH_LONG_OFFSET(){return k}static get TIME_24_SIMPLE(){return T}static get TIME_24_WITH_SECONDS(){return $}static get TIME_24_WITH_SHORT_OFFSET(){return A}static get TIME_24_WITH_LONG_OFFSET(){return z}static get DATETIME_SHORT(){return j}static get DATETIME_SHORT_WITH_SECONDS(){return B}static get DATETIME_MED(){return L}static get DATETIME_MED_WITH_SECONDS(){return F}static get DATETIME_MED_WITH_WEEKDAY(){return E}static get DATETIME_FULL(){return N}static get DATETIME_FULL_WITH_SECONDS(){return D}static get DATETIME_HUGE(){return V}static get DATETIME_HUGE_WITH_SECONDS(){return I}}function oi(q){if(yn.isDateTime(q))return q;if(q&&q.valueOf&&At(q.valueOf()))return yn.fromJSDate(q);if(q&&typeof q=="object")return yn.fromObject(q);throw new i(`Unknown datetime argument: ${q}, of type ${typeof q}`)}const Ey="3.7.2";return La.DateTime=yn,La.Duration=Kt,La.FixedOffsetZone=kt,La.IANAZone=re,La.Info=gr,La.Interval=cn,La.InvalidZone=bt,La.Settings=an,La.SystemZone=ie,La.VERSION=Ey,La.Zone=W,La}var Ij;function FR(){return Ij||(Ij=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CronDate=e.DAYS_IN_MONTH=e.DateMathOp=e.TimeUnit=void 0;const t=hbe();var n;(function(a){a.Second="Second",a.Minute="Minute",a.Hour="Hour",a.Day="Day",a.Month="Month",a.Year="Year"})(n||(e.TimeUnit=n={}));var r;(function(a){a.Add="Add",a.Subtract="Subtract"})(r||(e.DateMathOp=r={})),e.DAYS_IN_MONTH=Object.freeze([31,29,31,30,31,30,31,31,30,31,30,31]);class o{#e;#t=null;#n=null;constructor(i,s){const c={zone:s};if(i?i instanceof o?(this.#e=i.#e,this.#t=i.#t,this.#n=i.#n):i instanceof Date?this.#e=t.DateTime.fromJSDate(i,c):typeof i=="number"?this.#e=t.DateTime.fromMillis(i,c):(this.#e=t.DateTime.fromISO(i,c),this.#e.isValid||(this.#e=t.DateTime.fromRFC2822(i,c)),this.#e.isValid||(this.#e=t.DateTime.fromSQL(i,c)),this.#e.isValid||(this.#e=t.DateTime.fromFormat(i,"EEE, d MMM yyyy HH:mm:ss",c))):this.#e=t.DateTime.local(),!this.#e.isValid)throw new Error(`CronDate: unhandled timestamp: ${i}`);s&&s!==this.#e.zoneName&&(this.#e=this.#e.setZone(s))}static#o(i){return i%4===0&&i%100!==0||i%400===0}get dstStart(){return this.#t}set dstStart(i){this.#t=i}get dstEnd(){return this.#n}set dstEnd(i){this.#n=i}addYear(){this.#e=this.#e.plus({years:1})}addMonth(){this.#e=this.#e.plus({months:1}).startOf("month")}addDay(){this.#e=this.#e.plus({days:1}).startOf("day")}addHour(){this.#e=this.#e.plus({hours:1}).startOf("hour")}addMinute(){this.#e=this.#e.plus({minutes:1}).startOf("minute")}addSecond(){this.#e=this.#e.plus({seconds:1})}subtractYear(){this.#e=this.#e.minus({years:1})}subtractMonth(){this.#e=this.#e.minus({months:1}).endOf("month").startOf("second")}subtractDay(){this.#e=this.#e.minus({days:1}).endOf("day").startOf("second")}subtractHour(){this.#e=this.#e.minus({hours:1}).endOf("hour").startOf("second")}subtractMinute(){this.#e=this.#e.minus({minutes:1}).endOf("minute").startOf("second")}subtractSecond(){this.#e=this.#e.minus({seconds:1})}addUnit(i){switch(i){case n.Year:return this.addYear();case n.Month:return this.addMonth();case n.Day:return this.addDay();case n.Hour:return this.addHour();case n.Minute:return this.addMinute();case n.Second:return this.addSecond()}}subtractUnit(i){switch(i){case n.Year:return this.subtractYear();case n.Month:return this.subtractMonth();case n.Day:return this.subtractDay();case n.Hour:return this.subtractHour();case n.Minute:return this.subtractMinute();case n.Second:return this.subtractSecond()}}invokeDateOperation(i,s){if(i===r.Add){this.addUnit(s);return}if(i===r.Subtract){this.subtractUnit(s);return}throw new Error(`Invalid verb: ${i}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){const i=this.#e.weekday;return i===7?0:i}getMonth(){return this.#e.month-1}getHours(){return this.#e.hour}getMinutes(){return this.#e.minute}getSeconds(){return this.#e.second}getMilliseconds(){return this.#e.millisecond}getUTCOffset(){return this.#e.offset}setStartOfDay(){this.#e=this.#e.startOf("day")}setEndOfDay(){this.#e=this.#e.endOf("day")}getTime(){return this.#e.valueOf()}getUTCDate(){return this.#r().day}getUTCFullYear(){return this.#r().year}getUTCDay(){const i=this.#r().weekday;return i===7?0:i}getUTCMonth(){return this.#r().month-1}getUTCHours(){return this.#r().hour}getUTCMinutes(){return this.#r().minute}getUTCSeconds(){return this.#r().second}toISOString(){return this.#e.toUTC().toISO()}toJSON(){return this.#e.toJSON()}setDate(i){this.#e=this.#e.set({day:i})}setFullYear(i){this.#e=this.#e.set({year:i})}setDay(i){this.#e=this.#e.set({weekday:i})}setMonth(i){this.#e=this.#e.set({month:i+1})}setHours(i){this.#e=this.#e.set({hour:i})}setMinutes(i){this.#e=this.#e.set({minute:i})}setSeconds(i){this.#e=this.#e.set({second:i})}setMilliseconds(i){this.#e=this.#e.set({millisecond:i})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){const{day:i,month:s}=this.#e;if(s===2){const c=o.#o(this.#e.year);return i===e.DAYS_IN_MONTH[s-1]-(c?0:1)}return i===e.DAYS_IN_MONTH[s-1]}isLastWeekdayOfMonth(){const{day:i,month:s}=this.#e;let c;return s===2?c=e.DAYS_IN_MONTH[s-1]-(o.#o(this.#e.year)?0:1):c=e.DAYS_IN_MONTH[s-1],i>c-7}applyDateOperation(i,s,c){if(s===n.Month||s===n.Day){this.invokeDateOperation(i,s);return}const f=this.getHours();this.invokeDateOperation(i,s);const u=this.getHours(),h=u-f;h===2?c!==24&&(this.dstStart=f+1):h===0&&this.getMinutes()===0&&this.getSeconds()===0&&c!==24&&(this.dstEnd=u)}#r(){return this.#e.toUTC()}}e.CronDate=o,e.default=o})(jj)),jj}var Lj;function mbe(){if(Lj)return _m;Lj=1,Object.defineProperty(_m,"__esModule",{value:!0}),_m.CronMonth=void 0;const e=FR(),t=Fd(),n=1,r=12,o=Object.freeze([]);let a=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return o}static get daysInMonth(){return e.DAYS_IN_MONTH}constructor(i,s){super(i,s),this.validate()}get values(){return super.values}};return _m.CronMonth=a,_m}var Bm={},zj;function gbe(){if(zj)return Bm;zj=1,Object.defineProperty(Bm,"__esModule",{value:!0}),Bm.CronSecond=void 0;const e=Fd(),t=0,n=59,r=Object.freeze([]);let o=class extends e.CronField{static get min(){return t}static get max(){return n}static get chars(){return r}constructor(a,i){super(a,i),this.validate()}get values(){return super.values}};return Bm.CronSecond=o,Bm}var Fj;function _R(){return Fj||(Fj=1,(function(e){var t=Yf&&Yf.__createBinding||(Object.create?(function(r,o,a,i){i===void 0&&(i=a);var s=Object.getOwnPropertyDescriptor(o,a);(!s||("get"in s?!o.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(r,i,s)}):(function(r,o,a,i){i===void 0&&(i=a),r[i]=o[a]})),n=Yf&&Yf.__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(cbe(),e),n(ube(),e),n(dbe(),e),n(Fd(),e),n(fbe(),e),n(pbe(),e),n(mbe(),e),n(gbe(),e)})(Yf)),Yf}var _j;function LF(){if(_j)return jm;_j=1,Object.defineProperty(jm,"__esModule",{value:!0}),jm.CronFieldCollection=void 0;const e=_R();let t=class tg{#e;#t;#n;#o;#r;#a;static from(r,o){return new tg({second:this.resolveField(e.CronSecond,r.second,o.second),minute:this.resolveField(e.CronMinute,r.minute,o.minute),hour:this.resolveField(e.CronHour,r.hour,o.hour),dayOfMonth:this.resolveField(e.CronDayOfMonth,r.dayOfMonth,o.dayOfMonth),month:this.resolveField(e.CronMonth,r.month,o.month),dayOfWeek:this.resolveField(e.CronDayOfWeek,r.dayOfWeek,o.dayOfWeek)})}static resolveField(r,o,a){return a?a instanceof e.CronField?a:new r(a):o}constructor({second:r,minute:o,hour:a,dayOfMonth:i,month:s,dayOfWeek:c}){if(!r)throw new Error("Validation error, Field second is missing");if(!o)throw new Error("Validation error, Field minute is missing");if(!a)throw new Error("Validation error, Field hour is missing");if(!i)throw new Error("Validation error, Field dayOfMonth is missing");if(!s)throw new Error("Validation error, Field month is missing");if(!c)throw new Error("Validation error, Field dayOfWeek is missing");if(s.values.length===1&&!i.hasLastChar&&c.isWildcard&&!(parseInt(i.values[0],10)<=e.CronMonth.daysInMonth[s.values[0]-1]))throw new Error("Invalid explicit day of month definition");this.#e=r,this.#t=o,this.#n=a,this.#r=s,this.#a=c,this.#o=i}get second(){return this.#e}get minute(){return this.#t}get hour(){return this.#n}get dayOfMonth(){return this.#o}get month(){return this.#r}get dayOfWeek(){return this.#a}static compactField(r){if(r.length===0)return[];const o=[];let a;return r.forEach((i,s,c)=>{if(a===void 0){a={start:i,count:1};return}const f=c[s-1]||a.start,u=c[s+1];if(i==="L"||i==="W"){o.push(a),o.push({start:i,count:1}),a=void 0;return}if(a.step===void 0&&u!==void 0){const h=i-f,g=u-i;if(h<=g){a={...a,count:2,end:i,step:h};return}a.step=1}i-(a.end??0)===a.step?(a.count++,a.end=i):(a.count===1?o.push({start:a.start,count:1}):a.count===2?(o.push({start:a.start,count:1}),o.push({start:a.end??f,count:1})):o.push(a),a={start:i,count:1})}),a&&o.push(a),o}static#s(r,o,a){const i=o.step;return i?i===1&&o.start===r.min&&o.end&&o.end>=a?r.hasQuestionMarkChar?"?":"*":i!==1&&o.start===r.min&&o.end&&o.end>=a-i+1?`*/${i}`:null:null}static#i(r,o){const a=r.step;if(a===1)return`${r.start}-${r.end}`;const i=r.start===0?r.count-1:r.count;if(!a)throw new Error("Unexpected range step");if(!r.end)throw new Error("Unexpected range end");if(a*i>r.end){const s=(f,u)=>{if(typeof r.start!="number")throw new Error("Unexpected range start");return u%a===0?r.start+u:null};if(typeof r.start!="number")throw new Error("Unexpected range start");const c={length:r.end-r.start+1};return Array.from(c,s).filter(f=>f!==null).join(",")}return r.end===o-a+1?`${r.start}/${a}`:`${r.start}-${r.end}/${a}`}stringifyField(r){let o=r.max,a=r.values;if(r instanceof e.CronDayOfWeek){o=6;const s=this.#a.values;a=s[s.length-1]===7?s.slice(0,-1):s}r instanceof e.CronDayOfMonth&&(o=this.#r.values.length===1?e.CronMonth.daysInMonth[this.#r.values[0]-1]:r.max);const i=tg.compactField(a);if(i.length===1){const s=tg.#s(r,i[0],o);if(s)return s}return i.map(s=>{const c=s.count===1?s.start.toString():tg.#i(s,o);return r instanceof e.CronDayOfWeek&&r.nthDay>0?`${c}#${r.nthDay}`:c}).join(",")}stringify(r=!1){const o=[];return r&&o.push(this.stringifyField(this.#e)),o.push(this.stringifyField(this.#t),this.stringifyField(this.#n),this.stringifyField(this.#o),this.stringifyField(this.#r),this.stringifyField(this.#a)),o.join(" ")}serialize(){return{second:this.#e.serialize(),minute:this.#t.serialize(),hour:this.#n.serialize(),dayOfMonth:this.#o.serialize(),month:this.#r.serialize(),dayOfWeek:this.#a.serialize()}}};return jm.CronFieldCollection=t,jm}var Bj={},Uj;function zF(){return Uj||(Uj=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=FR();e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE="Out of the time span range",e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE="Invalid expression, loop limit exceeded";const n=1e4;class r{#e;#t;#n;#o;#r;#a;#s=null;#i=!1;constructor(a,i){this.#e=i,this.#t=i.tz,this.#o=i.startDate?new t.CronDate(i.startDate,this.#t):null,this.#r=i.endDate?new t.CronDate(i.endDate,this.#t):null;let s=i.currentDate??i.startDate;if(s){const c=new t.CronDate(s,this.#t);this.#o&&c.getTime()<this.#o.getTime()?s=this.#o:this.#r&&c.getTime()>this.#r.getTime()&&(s=this.#r)}this.#n=new t.CronDate(s,this.#t),this.#a=a}get fields(){return this.#a}static fieldsToExpression(a,i){return new r(a,i||{})}static#c(a,i){return i.some(s=>s===a)}#l(a,i){return a[i?a.length-1:0]}#d(a){const i=`${a.getFullYear()}-${a.getMonth()+1}-${a.getDate()}`;if(this.#s===i)return this.#i;const s=new t.CronDate(a);s.setStartOfDay();const c=new t.CronDate(a);return c.setEndOfDay(),this.#s=i,this.#i=s.getUTCOffset()!==c.getUTCOffset(),this.#i}#u(a,i,s){const c=this.#a.second.values,f=a.getSeconds(),u=this.#a.second.findNearestValue(f,s);if(u!==null){a.setSeconds(u);return}a.applyDateOperation(i,t.TimeUnit.Minute,this.#a.hour.values.length),a.setSeconds(this.#l(c,s))}#p(a,i,s){const c=this.#a.minute.values,f=this.#a.second.values,u=a.getMinutes(),h=this.#a.minute.findNearestValue(u,s);if(h!==null){a.setMinutes(h),a.setSeconds(this.#l(f,s));return}a.applyDateOperation(i,t.TimeUnit.Hour,this.#a.hour.values.length),a.setMinutes(this.#l(c,s)),a.setSeconds(this.#l(f,s))}static#f(a,i){const s=i.isLastWeekdayOfMonth();return a.some(c=>{const f=parseInt(c.toString().charAt(0),10)%7;if(Number.isNaN(f))throw new Error(`Invalid last weekday of the month expression: ${c}`);return i.getDay()===f&&s})}next(){return this.#h()}prev(){return this.#h(!0)}hasNext(){const a=this.#n;try{return this.#h(),!0}catch{return!1}finally{this.#n=a}}hasPrev(){const a=this.#n;try{return this.#h(!0),!0}catch{return!1}finally{this.#n=a}}take(a){const i=[];if(a>=0)for(let s=0;s<a;s++)try{i.push(this.next())}catch{return i}else for(let s=0;s>a;s--)try{i.push(this.prev())}catch{return i}return i}reset(a){this.#n=new t.CronDate(a||this.#e.currentDate,this.#t)}stringify(a=!1){return this.#a.stringify(a)}includesDate(a){const{second:i,minute:s,hour:c,month:f}=this.#a,u=new t.CronDate(a,this.#t);return!(!i.values.includes(u.getSeconds())||!s.values.includes(u.getMinutes())||!c.values.includes(u.getHours())||!f.values.includes(u.getMonth()+1)||!this.#m(u)||this.#a.dayOfWeek.nthDay>0&&Math.ceil(u.getDate()/7)!==this.#a.dayOfWeek.nthDay)}toString(){return this.#e.expression||this.stringify(!0)}#m(a){const i=this.#a.dayOfMonth.isWildcard,s=!i,c=this.#a.dayOfWeek.isWildcard,f=!c,u=r.#c(a.getDate(),this.#a.dayOfMonth.values)||this.#a.dayOfMonth.hasLastChar&&a.isLastDayOfMonth(),h=r.#c(a.getDay(),this.#a.dayOfWeek.values)||this.#a.dayOfWeek.hasLastChar&&r.#f(this.#a.dayOfWeek.values,a);return!!(s&&f&&(u||h)||u&&!f||i&&!c&&h)}#g(a,i,s){const c=this.#a.hour.values,f=c,u=a.getHours(),h=r.#c(u,c),g=a.dstEnd===u;if(a.dstStart!==null&&a.dstStart===u-1&&r.#c(a.dstStart,c))return!0;if(g&&!s)return a.dstEnd=null,a.applyDateOperation(t.DateMathOp.Add,t.TimeUnit.Hour,f.length),!1;if(h)return!0;a.dstStart=null;const v=this.#a.hour.findNearestValue(u,s);if(v===null)return a.applyDateOperation(i,t.TimeUnit.Day,f.length),!1;if(this.#d(a)){const b=s?u-v:v-u;for(let S=0;S<b&&(a.applyDateOperation(i,t.TimeUnit.Hour,f.length),!(!s&&a.getHours()>=v||s&&a.getHours()<=v));S++);}else a.setHours(v);return a.setMinutes(this.#l(this.#a.minute.values,s)),a.setSeconds(this.#l(this.#a.second.values,s)),!1}#y(a){if(!this.#o&&!this.#r)return;const i=a.getTime();if(this.#o&&i<this.#o.getTime())throw new Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE);if(this.#r&&i>this.#r.getTime())throw new Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#h(a=!1){const i=a?t.DateMathOp.Subtract:t.DateMathOp.Add,s=new t.CronDate(this.#n),c=s.getTime();let f=0;for(;++f<n;){if(this.#y(s),!this.#m(s)){s.applyDateOperation(i,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!(this.#a.dayOfWeek.nthDay<=0||Math.ceil(s.getDate()/7)===this.#a.dayOfWeek.nthDay)){s.applyDateOperation(i,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!r.#c(s.getMonth()+1,this.#a.month.values)){s.applyDateOperation(i,t.TimeUnit.Month,this.#a.hour.values.length);continue}if(this.#g(s,i,a)){if(!r.#c(s.getMinutes(),this.#a.minute.values)){this.#p(s,i,a);continue}if(!r.#c(s.getSeconds(),this.#a.second.values)){this.#u(s,i,a);continue}if(c===s.getTime()){(i==="Add"||s.getMilliseconds()===0)&&s.applyDateOperation(i,t.TimeUnit.Second,this.#a.hour.values.length);continue}break}}if(f>n)throw new Error(e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return s.getMilliseconds()!==0&&s.setMilliseconds(0),this.#n=s,s}[Symbol.iterator](){return{next:()=>{try{return{value:this.#h(),done:!1}}catch{return{value:void 0,done:!0}}}}}}e.CronExpression=r,e.default=r})(Bj)),Bj}var tb={},Vj;function ybe(){if(Vj)return tb;Vj=1,Object.defineProperty(tb,"__esModule",{value:!0}),tb.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 tb}var Hj;function dk(){if(Hj)return ui;Hj=1,Object.defineProperty(ui,"__esModule",{value:!0}),ui.CronExpressionParser=ui.DayOfWeek=ui.Months=ui.CronUnit=ui.PredefinedExpressions=void 0;const e=LF(),t=zF(),n=ybe(),r=_R();var o;(function(f){f["@yearly"]="0 0 0 1 1 *",f["@annually"]="0 0 0 1 1 *",f["@monthly"]="0 0 0 1 * *",f["@weekly"]="0 0 0 * * 0",f["@daily"]="0 0 0 * * *",f["@hourly"]="0 0 * * * *",f["@minutely"]="0 * * * * *",f["@secondly"]="* * * * * *",f["@weekdays"]="0 0 0 * * 1-5",f["@weekends"]="0 0 0 * * 0,6"})(o||(ui.PredefinedExpressions=o={}));var a;(function(f){f.Second="Second",f.Minute="Minute",f.Hour="Hour",f.DayOfMonth="DayOfMonth",f.Month="Month",f.DayOfWeek="DayOfWeek"})(a||(ui.CronUnit=a={}));var i;(function(f){f[f.jan=1]="jan",f[f.feb=2]="feb",f[f.mar=3]="mar",f[f.apr=4]="apr",f[f.may=5]="may",f[f.jun=6]="jun",f[f.jul=7]="jul",f[f.aug=8]="aug",f[f.sep=9]="sep",f[f.oct=10]="oct",f[f.nov=11]="nov",f[f.dec=12]="dec"})(i||(ui.Months=i={}));var s;(function(f){f[f.sun=0]="sun",f[f.mon=1]="mon",f[f.tue=2]="tue",f[f.wed=3]="wed",f[f.thu=4]="thu",f[f.fri=5]="fri",f[f.sat=6]="sat"})(s||(ui.DayOfWeek=s={}));let c=class di{static parse(u,h={}){const{strict:g=!1,hashSeed:v}=h,b=(0,n.seededRandom)(v);u=o[u]||u;const S=di.#e(u,g);if(!(S.dayOfMonth==="*"||S.dayOfWeek==="*"||!g))throw new Error("Cannot use both dayOfMonth and dayOfWeek together in strict mode!");const w=di.#t(a.Second,S.second,r.CronSecond.constraints,b),x=di.#t(a.Minute,S.minute,r.CronMinute.constraints,b),R=di.#t(a.Hour,S.hour,r.CronHour.constraints,b),k=di.#t(a.Month,S.month,r.CronMonth.constraints,b),T=di.#t(a.DayOfMonth,S.dayOfMonth,r.CronDayOfMonth.constraints,b),{dayOfWeek:$,nthDayOfWeek:A}=di.#d(S.dayOfWeek),z=di.#t(a.DayOfWeek,$,r.CronDayOfWeek.constraints,b),j=new e.CronFieldCollection({second:new r.CronSecond(w,{rawValue:S.second}),minute:new r.CronMinute(x,{rawValue:S.minute}),hour:new r.CronHour(R,{rawValue:S.hour}),dayOfMonth:new r.CronDayOfMonth(T,{rawValue:S.dayOfMonth}),month:new r.CronMonth(k,{rawValue:S.month}),dayOfWeek:new r.CronDayOfWeek(z,{rawValue:S.dayOfWeek,nthDayOfWeek:A})});return new t.CronExpression(j,{...h,expression:u})}static#e(u,h){if(h&&!u.length)throw new Error("Invalid cron expression");u=u||"0 * * * * *";const g=u.trim().split(/\s+/);if(h&&g.length<6)throw new Error("Invalid cron expression, expected 6 fields");if(g.length>6)throw new Error("Invalid cron expression, too many fields");const v=["*","*","*","*","*","0"];g.length<v.length&&g.unshift(...v.slice(g.length));const[b,S,w,x,R,k]=g;return{second:b,minute:S,hour:w,dayOfMonth:x,month:R,dayOfWeek:k}}static#t(u,h,g,v){if((u===a.Month||u===a.DayOfWeek)&&(h=h.replace(/[a-z]{3}/gi,b=>{b=b.toLowerCase();const S=i[b]||s[b];if(S===void 0)throw new Error(`Validation error, cannot resolve alias "${b}"`);return S.toString()})),!g.validChars.test(h))throw new Error(`Invalid characters, got value: ${h}`);return h=this.#n(h,g),h=this.#o(h,g,v),this.#r(u,h,g)}static#n(u,h){return u.replace(/[*?]/g,h.min+"-"+h.max)}static#o(u,h,g){const v=g();return u.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(b,S,w,x)=>{if(S&&w&&x){const R=parseInt(S,10),k=parseInt(w,10),T=parseInt(x,10);if(R>k)throw new Error(`Invalid range: ${R}-${k}, min > max`);if(T<=0)throw new Error(`Invalid step: ${T}, must be positive`);const $=Math.max(R,h.min),A=Math.floor(v*T),z=[];for(let j=Math.floor($/T)*T+A;j<=k;j+=T)j>=$&&z.push(j);return z.join(",")}else if(S&&w){const R=parseInt(S,10),k=parseInt(w,10);if(R>k)throw new Error(`Invalid range: ${R}-${k}, min > max`);return String(Math.floor(v*(k-R+1))+R)}else if(x){const R=parseInt(x,10);if(R<=0)throw new Error(`Invalid step: ${R}, must be positive`);const k=Math.floor(v*R),T=[];for(let $=Math.floor(h.min/R)*R+k;$<=h.max;$+=R)$>=h.min&&T.push($);return T.join(",")}else return String(Math.floor(v*(h.max-h.min+1)+h.min))})}static#r(u,h,g){const v=[];function b(S,w){if(Array.isArray(S))v.push(...S);else if(di.#u(w,S))v.push(S);else{const x=parseInt(S.toString(),10);if(!(x>=w.min&&x<=w.max))throw new Error(`Constraint error, got value ${S} expected range ${w.min}-${w.max}`);v.push(u===a.DayOfWeek?x%7:S)}}return h.split(",").forEach(S=>{if(!(S.length>0))throw new Error("Invalid list value format");b(di.#a(u,S,g),g)}),v}static#a(u,h,g){const v=h.split("/");if(v.length>2)throw new Error(`Invalid repeat: ${h}`);return v.length===2?(v[0].includes("-")||(v[0]=`${v[0]}-${g.max}`),di.#l(u,v[0],parseInt(v[1],10),g)):di.#l(u,h,1,g)}static#s(u,h,g){if(!(!isNaN(u)&&!isNaN(h)&&u>=g.min&&h<=g.max))throw new Error(`Constraint error, got range ${u}-${h} expected range ${g.min}-${g.max}`);if(u>h)throw new Error(`Invalid range: ${u}-${h}, min(${u}) > max(${h})`)}static#i(u){if(!(!isNaN(u)&&u>0))throw new Error(`Constraint error, cannot repeat at every ${u} time.`)}static#c(u,h,g,v){const b=[];u===a.DayOfWeek&&g%7===0&&b.push(0);for(let S=h;S<=g;S+=v)b.indexOf(S)===-1&&b.push(S);return b}static#l(u,h,g,v){const b=h.split("-");if(b.length<=1)return isNaN(+h)?h:+h;const[S,w]=b.map(x=>parseInt(x,10));return this.#s(S,w,v),this.#i(g),this.#c(u,S,w,g)}static#d(u){const h=u.split("#");if(h.length<=1)return{dayOfWeek:h[0]};const g=+h[h.length-1],v=u.match(/([,-/])/);if(v!==null)throw new Error(`Constraint error, invalid dayOfWeek \`#\` and \`${v?.[0]}\` special characters are incompatible`);if(!(h.length<=2&&!isNaN(g)&&g>=1&&g<=5))throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return{dayOfWeek:h[0],nthDayOfWeek:g}}static#u(u,h){return u.chars.some(g=>h.toString().includes(g))}};return ui.CronExpressionParser=c,ui}var Es={};const vbe={},bbe=Object.freeze(Object.defineProperty({__proto__:null,default:vbe},Symbol.toStringTag,{value:"Module"})),qj=rne(bbe);var Wj;function xbe(){if(Wj)return Es;Wj=1;var e=Es&&Es.__createBinding||(Object.create?(function(a,i,s,c){c===void 0&&(c=s);var f=Object.getOwnPropertyDescriptor(i,s);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(a,c,f)}):(function(a,i,s,c){c===void 0&&(c=s),a[c]=i[s]})),t=Es&&Es.__setModuleDefault||(Object.create?(function(a,i){Object.defineProperty(a,"default",{enumerable:!0,value:i})}):function(a,i){a.default=i}),n=Es&&Es.__importStar||(function(){var a=function(i){return a=Object.getOwnPropertyNames||function(s){var c=[];for(var f in s)Object.prototype.hasOwnProperty.call(s,f)&&(c[c.length]=f);return c},a(i)};return function(i){if(i&&i.__esModule)return i;var s={};if(i!=null)for(var c=a(i),f=0;f<c.length;f++)c[f]!=="default"&&e(s,i,c[f]);return t(s,i),s}})();Object.defineProperty(Es,"__esModule",{value:!0}),Es.CronFileParser=void 0;const r=dk();let o=class Rb{static async parseFile(i){const{readFile:s}=await Promise.resolve().then(()=>n(qj)),c=await s(i,"utf8");return Rb.#e(c)}static parseFileSync(i){const{readFileSync:s}=qj,c=s(i,"utf8");return Rb.#e(c)}static#e(i){const s=i.split(`
|
|
478
478
|
`),c={variables:{},expressions:[],errors:{}};for(const f of s){const u=f.trim();if(u.length===0||u.startsWith("#"))continue;const h=u.match(/^(.*)=(.*)$/);if(h){const[,g,v]=h;c.variables[g]=v.replace(/["']/g,"");continue}try{const g=Rb.#t(u);c.expressions.push(g.interval)}catch(g){c.errors[u]=g}}return c}static#t(i){const s=i.split(" ");return{interval:r.CronExpressionParser.parse(s.slice(0,5).join(" ")),command:s.slice(5,s.length)}}};return Es.CronFileParser=o,Es}var Yj;function Sbe(){return Yj||(Yj=1,(function(e){var t=Wf&&Wf.__createBinding||(Object.create?(function(f,u,h,g){g===void 0&&(g=h);var v=Object.getOwnPropertyDescriptor(u,h);(!v||("get"in v?!u.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return u[h]}}),Object.defineProperty(f,g,v)}):(function(f,u,h,g){g===void 0&&(g=h),f[g]=u[h]})),n=Wf&&Wf.__exportStar||function(f,u){for(var h in f)h!=="default"&&!Object.prototype.hasOwnProperty.call(u,h)&&t(u,f,h)};Object.defineProperty(e,"__esModule",{value:!0}),e.CronFileParser=e.CronExpressionParser=e.CronExpression=e.CronFieldCollection=e.CronDate=void 0;const r=dk();var o=FR();Object.defineProperty(e,"CronDate",{enumerable:!0,get:function(){return o.CronDate}});var a=LF();Object.defineProperty(e,"CronFieldCollection",{enumerable:!0,get:function(){return a.CronFieldCollection}});var i=zF();Object.defineProperty(e,"CronExpression",{enumerable:!0,get:function(){return i.CronExpression}});var s=dk();Object.defineProperty(e,"CronExpressionParser",{enumerable:!0,get:function(){return s.CronExpressionParser}});var c=xbe();Object.defineProperty(e,"CronFileParser",{enumerable:!0,get:function(){return c.CronFileParser}}),n(_R(),e),e.default=r.CronExpressionParser})(Wf)),Wf}var wbe=Sbe(),Gj={exports:{}},Kj;function Cbe(){return Kj||(Kj=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,()=>(()=>{var n={949:((i,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CronParser=void 0;var f=c(515),u=(function(){function h(g,v,b){v===void 0&&(v=!0),b===void 0&&(b=!1),this.expression=g,this.dayOfWeekStartIndexZero=v,this.monthStartIndexZero=b}return h.prototype.parse=function(){var g,v,b=(g=this.expression)!==null&&g!==void 0?g:"";if(b==="@reboot")return v=["@reboot","","","","","",""],v;if(b.startsWith("@")){var S=this.parseSpecial(this.expression);v=this.extractParts(S)}else v=this.extractParts(this.expression);return this.normalize(v),this.validate(v),v},h.prototype.parseSpecial=function(g){var v={"@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *","@reboot":"@reboot"},b=v[g];if(!b)throw new Error("Unknown special expression.");return b},h.prototype.extractParts=function(g){if(!this.expression)throw new Error("cron expression is empty");for(var v=g.trim().split(/[ ]+/),b=0;b<v.length;b++)if(v[b].includes(",")){var S=v[b].split(",").map(function(x){return x.trim()}).filter(function(x){return x!==""}).map(function(x){return isNaN(Number(x))?x:Number(x)}).filter(function(x){return x!==null&&x!==""});S.length===0&&S.push("*"),S.sort(function(x,R){return x!==null&&R!==null?x-R:0}),v[b]=S.map(function(x){return x!==null?x.toString():""}).join(",")}if(v.length<5)throw new Error("Expression has only ".concat(v.length," part").concat(v.length==1?"":"s",". At least 5 parts are required."));if(v.length==5)v.unshift(""),v.push("");else if(v.length==6){var w=/\d{4}$/.test(v[5])||v[4]=="?"||v[2]=="?";w?v.unshift(""):v.push("")}else if(v.length>7)throw new Error("Expression has ".concat(v.length," parts; too many!"));return v},h.prototype.normalize=function(g){var v=this;if(g[3]=g[3].replace("?","*"),g[5]=g[5].replace("?","*"),g[2]=g[2].replace("?","*"),g[0].indexOf("0/")==0&&(g[0]=g[0].replace("0/","*/")),g[1].indexOf("0/")==0&&(g[1]=g[1].replace("0/","*/")),g[2].indexOf("0/")==0&&(g[2]=g[2].replace("0/","*/")),g[3].indexOf("1/")==0&&(g[3]=g[3].replace("1/","*/")),g[4].indexOf("1/")==0&&(g[4]=g[4].replace("1/","*/")),g[6].indexOf("1/")==0&&(g[6]=g[6].replace("1/","*/")),g[5]=g[5].replace(/(^\d)|([^#/\s]\d)/g,function($){var A=$.replace(/\D/,""),z=A;return v.dayOfWeekStartIndexZero?A=="7"&&(z="0"):z=(parseInt(A)-1).toString(),$.replace(A,z)}),g[5]=="L"&&(g[5]="6"),g[3]=="?"&&(g[3]="*"),g[3].indexOf("W")>-1&&(g[3].indexOf(",")>-1||g[3].indexOf("-")>-1))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var b={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var S in b)g[5]=g[5].replace(new RegExp(S,"gi"),b[S].toString());g[4]=g[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g,function($){var A=$.replace(/\D/,""),z=A;return v.monthStartIndexZero&&(z=(parseInt(A)+1).toString()),$.replace(A,z)});var w={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var x in w)g[4]=g[4].replace(new RegExp(x,"gi"),w[x].toString());g[0]=="0"&&(g[0]=""),!/\*|\-|\,|\//.test(g[2])&&(/\*|\//.test(g[1])||/\*|\//.test(g[0]))&&(g[2]+="-".concat(g[2]));for(var R=0;R<g.length;R++)if(g[R].indexOf(",")!=-1&&(g[R]=g[R].split(",").filter(function($){return $!==""}).join(",")||"*"),g[R]=="*/1"&&(g[R]="*"),g[R].indexOf("/")>-1&&!/^\*|\-|\,/.test(g[R])){var k=null;switch(R){case 4:k="12";break;case 5:k="6";break;case 6:k="9999";break;default:k=null;break}if(k!==null){var T=g[R].split("/");g[R]="".concat(T[0],"-").concat(k,"/").concat(T[1])}}},h.prototype.validate=function(g){var v="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(g[0],v),this.validateOnlyExpectedCharactersFound(g[1],v),this.validateOnlyExpectedCharactersFound(g[2],v),this.validateOnlyExpectedCharactersFound(g[3],"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(g[4],v),this.validateOnlyExpectedCharactersFound(g[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(g[6],v),this.validateAnyRanges(g)},h.prototype.validateAnyRanges=function(g){f.default.secondRange(g[0]),f.default.minuteRange(g[1]),f.default.hourRange(g[2]),f.default.dayOfMonthRange(g[3]),f.default.monthRange(g[4],this.monthStartIndexZero),f.default.dayOfWeekRange(g[5],this.dayOfWeekStartIndexZero)},h.prototype.validateOnlyExpectedCharactersFound=function(g,v){var b=g.match(new RegExp("[^".concat(v,"]+"),"gi"));if(b&&b.length)throw new Error("Expression contains invalid values: '".concat(b.toString(),"'"))},h})();s.CronParser=u}),333:((i,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ExpressionDescriptor=void 0;var f=c(823),u=c(949),h=(function(){function g(v,b){if(this.expression=v,this.options=b,this.expressionParts=new Array(5),!this.options.locale&&g.defaultLocale&&(this.options.locale=g.defaultLocale),!g.locales[this.options.locale]){var S=Object.keys(g.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(S,"'.")),this.options.locale=S}this.i18n=g.locales[this.options.locale],b.use24HourTimeFormat===void 0&&(b.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return g.toString=function(v,b){var S=b===void 0?{}:b,w=S.throwExceptionOnParseError,x=w===void 0?!0:w,R=S.verbose,k=R===void 0?!1:R,T=S.dayOfWeekStartIndexZero,$=T===void 0?!0:T,A=S.monthStartIndexZero,z=A===void 0?!1:A,j=S.use24HourTimeFormat,B=S.locale,L=B===void 0?null:B,F={throwExceptionOnParseError:x,verbose:k,dayOfWeekStartIndexZero:$,monthStartIndexZero:z,use24HourTimeFormat:j,locale:L};F.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var E=new g(v,F);return E.getFullDescription()},g.initialize=function(v,b){b===void 0&&(b="en"),g.specialCharacters=["/","-",",","*"],g.defaultLocale=b,v.load(g.locales)},g.prototype.getFullDescription=function(){var v,b,S="";try{var w=new u.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=w.parse(),this.expressionParts[0]==="@reboot")return((b=(v=this.i18n).atReboot)===null||b===void 0?void 0:b.call(v))||"Run once, at startup";var x=this.getTimeOfDayDescription(),R=this.getDayOfMonthDescription(),k=this.getMonthDescription(),T=this.getDayOfWeekDescription(),$=this.getYearDescription();S+=x+R+T+k+$,S=this.transformVerbosity(S,!!this.options.verbose),S=S.charAt(0).toLocaleUpperCase()+S.substr(1)}catch(A){if(!this.options.throwExceptionOnParseError)S=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(A)}return S},g.prototype.getTimeOfDayDescription=function(){var v=this.expressionParts[0],b=this.expressionParts[1],S=this.expressionParts[2],w="";if(!f.StringUtilities.containsAny(b,g.specialCharacters)&&!f.StringUtilities.containsAny(S,g.specialCharacters)&&!f.StringUtilities.containsAny(v,g.specialCharacters))w+=this.i18n.atSpace()+this.formatTime(S,b,v);else if(!v&&b.indexOf("-")>-1&&!(b.indexOf(",")>-1)&&!(b.indexOf("/")>-1)&&!f.StringUtilities.containsAny(S,g.specialCharacters)){var x=b.split("-");w+=f.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(S,x[0],""),this.formatTime(S,x[1],""))}else if(!v&&S.indexOf(",")>-1&&S.indexOf("-")==-1&&S.indexOf("/")==-1&&!f.StringUtilities.containsAny(b,g.specialCharacters)){var R=S.split(",");w+=this.i18n.at();for(var k=0;k<R.length;k++)w+=" ",w+=this.formatTime(R[k],b,""),k<R.length-2&&(w+=","),k==R.length-2&&(w+=this.i18n.spaceAnd())}else{var T=this.getSecondsDescription(),$=this.getMinutesDescription(),A=this.getHoursDescription();if(w+=T,w&&$&&(w+=", "),w+=$,$===A)return w;w&&A&&(w+=", "),w+=A}return w},g.prototype.getSecondsDescription=function(){var v=this,b=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(S){return S},function(S){return f.StringUtilities.format(v.i18n.everyX0Seconds(S),S)},function(S){return v.i18n.secondsX0ThroughX1PastTheMinute()},function(S){return S=="0"?"":parseInt(S)<20?v.i18n.atX0SecondsPastTheMinute(S):v.i18n.atX0SecondsPastTheMinuteGt20()||v.i18n.atX0SecondsPastTheMinute(S)});return b},g.prototype.getMinutesDescription=function(){var v=this,b=this.expressionParts[0],S=this.expressionParts[2],w=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(x){return x},function(x){return f.StringUtilities.format(v.i18n.everyX0Minutes(x),x)},function(x){return v.i18n.minutesX0ThroughX1PastTheHour()},function(x){try{return x=="0"&&S.indexOf("/")==-1&&b==""?v.i18n.everyHour():parseInt(x)<20?v.i18n.atX0MinutesPastTheHour(x):v.i18n.atX0MinutesPastTheHourGt20()||v.i18n.atX0MinutesPastTheHour(x)}catch{return v.i18n.atX0MinutesPastTheHour(x)}});return w},g.prototype.getHoursDescription=function(){var v=this,b=this.expressionParts[2],S=0,w=[];b.split("/")[0].split(",").forEach(function(k){var T=k.split("-");T.length===2&&w.push({value:T[1],index:S+1}),S+=T.length});var x=0,R=this.getSegmentDescription(b,this.i18n.everyHour(),function(k){var T=w.find(function(A){return A.value===k&&A.index===x}),$=T&&v.expressionParts[1]!=="0";return x++,$?v.formatTime(k,"59",""):v.formatTime(k,"0","")},function(k){return f.StringUtilities.format(v.i18n.everyX0Hours(k),k)},function(k){return v.i18n.betweenX0AndX1()},function(k){return v.i18n.atX0()});return R},g.prototype.getDayOfWeekDescription=function(){var v=this,b=this.i18n.daysOfTheWeek(),S=null;return this.expressionParts[5]=="*"?S="":S=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(w,x){var R=w;w.indexOf("#")>-1?R=w.substring(0,w.indexOf("#")):w.indexOf("L")>-1&&(R=R.replace("L",""));var k=parseInt(R),T=v.i18n.daysOfTheWeekInCase?v.i18n.daysOfTheWeekInCase(x)[k]:b[k];if(w.indexOf("#")>-1){var $=null,A=w.substring(w.indexOf("#")+1),z=w.substring(0,w.indexOf("#"));switch(A){case"1":$=v.i18n.first(z);break;case"2":$=v.i18n.second(z);break;case"3":$=v.i18n.third(z);break;case"4":$=v.i18n.fourth(z);break;case"5":$=v.i18n.fifth(z);break}T=$+" "+T}return T},function(w){return parseInt(w)==1?"":f.StringUtilities.format(v.i18n.commaEveryX0DaysOfTheWeek(w),w)},function(w){var x=w.substring(0,w.indexOf("-")),R=v.expressionParts[3]!="*";return R?v.i18n.commaAndX0ThroughX1(x):v.i18n.commaX0ThroughX1(x)},function(w){var x=null;if(w.indexOf("#")>-1){var R=w.substring(w.indexOf("#")+1),k=w.substring(0,w.indexOf("#"));x=v.i18n.commaOnThe(R,k).trim()+v.i18n.spaceX0OfTheMonth()}else if(w.indexOf("L")>-1)x=v.i18n.commaOnTheLastX0OfTheMonth(w.replace("L",""));else{var T=v.expressionParts[3]!="*";x=T?v.i18n.commaAndOnX0():v.i18n.commaOnlyOnX0(w)}return x}),S},g.prototype.getMonthDescription=function(){var v=this,b=this.i18n.monthsOfTheYear(),S=this.getSegmentDescription(this.expressionParts[4],"",function(w,x){return x&&v.i18n.monthsOfTheYearInCase?v.i18n.monthsOfTheYearInCase(x)[parseInt(w)-1]:b[parseInt(w)-1]},function(w){return parseInt(w)==1?"":f.StringUtilities.format(v.i18n.commaEveryX0Months(w),w)},function(w){return v.i18n.commaMonthX0ThroughMonthX1()||v.i18n.commaX0ThroughX1()},function(w){return v.i18n.commaOnlyInMonthX0?v.i18n.commaOnlyInMonthX0():v.i18n.commaOnlyInX0()});return S},g.prototype.getDayOfMonthDescription=function(){var v=this,b=null,S=this.expressionParts[3];switch(S){case"L":b=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":b=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var w=S.match(/(\d{1,2}W)|(W\d{1,2})/);if(w){var x=parseInt(w[0].replace("W","")),R=x==1?this.i18n.firstWeekday():f.StringUtilities.format(this.i18n.weekdayNearestDayX0(),x.toString());b=f.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),R);break}else{var k=S.match(/L-(\d{1,2})/);if(k){var T=k[1];b=f.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(T),T);break}else{if(S=="*"&&this.expressionParts[5]!="*")return"";b=this.getSegmentDescription(S,this.i18n.commaEveryDay(),function($){return $=="L"?v.i18n.lastDay():v.i18n.dayX0?f.StringUtilities.format(v.i18n.dayX0(),$):$},function($){return $=="1"?v.i18n.commaEveryDay():v.i18n.commaEveryX0Days($)},function($){return v.i18n.commaBetweenDayX0AndX1OfTheMonth($)},function($){return v.i18n.commaOnDayX0OfTheMonth($)})}break}}return b},g.prototype.getYearDescription=function(){var v=this,b=this.getSegmentDescription(this.expressionParts[6],"",function(S){return/^\d+$/.test(S)?new Date(parseInt(S),1).getFullYear().toString():S},function(S){return f.StringUtilities.format(v.i18n.commaEveryX0Years(S),S)},function(S){return v.i18n.commaYearX0ThroughYearX1()||v.i18n.commaX0ThroughX1()},function(S){return v.i18n.commaOnlyInYearX0?v.i18n.commaOnlyInYearX0():v.i18n.commaOnlyInX0()});return b},g.prototype.getSegmentDescription=function(v,b,S,w,x,R){var k=null,T=v.indexOf("/")>-1,$=v.indexOf("-")>-1,A=v.indexOf(",")>-1;if(!v)k="";else if(v==="*")k=b;else if(!T&&!$&&!A)k=f.StringUtilities.format(R(v),S(v));else if(A){for(var z=v.split(","),j="",B=0;B<z.length;B++)if(B>0&&z.length>2&&(j+=",",B<z.length-1&&(j+=" ")),B>0&&z.length>1&&(B==z.length-1||z.length==2)&&(j+="".concat(this.i18n.spaceAnd()," ")),z[B].indexOf("/")>-1||z[B].indexOf("-")>-1){var L=z[B].indexOf("-")>-1&&z[B].indexOf("/")==-1,F=this.getSegmentDescription(z[B],b,S,w,L?this.i18n.commaX0ThroughX1:x,R);L&&(F=F.replace(", ","")),j+=F}else T?j+=this.getSegmentDescription(z[B],b,S,w,x,R):j+=S(z[B]);T?k=j:k=f.StringUtilities.format(R(v),j)}else if(T){var z=v.split("/");if(k=f.StringUtilities.format(w(z[1]),z[1]),z[0].indexOf("-")>-1){var E=this.generateRangeSegmentDescription(z[0],x,S);E.indexOf(", ")!=0&&(k+=", "),k+=E}else if(z[0].indexOf("*")==-1){var N=f.StringUtilities.format(R(z[0]),S(z[0]));N=N.replace(", ",""),k+=f.StringUtilities.format(this.i18n.commaStartingX0(),N)}}else $&&(k=this.generateRangeSegmentDescription(v,x,S));return k},g.prototype.generateRangeSegmentDescription=function(v,b,S){var w="",x=v.split("-"),R=S(x[0],1),k=S(x[1],2),T=b(v);return w+=f.StringUtilities.format(T,R,k),w},g.prototype.formatTime=function(v,b,S){var w=0,x=0,R=parseInt(v)+w,k=parseInt(b)+x;k>=60?(k-=60,R+=1):k<0&&(k+=60,R-=1),R>=24?R=R-24:R<0&&(R=24+R);var T="",$=!1;this.options.use24HourTimeFormat||($=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),T=$?"".concat(this.getPeriod(R)," "):" ".concat(this.getPeriod(R)),R>12&&(R-=12),R===0&&(R=12));var A="";return S&&(A=":".concat(("00"+S).substring(S.length))),"".concat($?T:"").concat(("00"+R.toString()).substring(R.toString().length),":").concat(("00"+k.toString()).substring(k.toString().length)).concat(A).concat($?"":T)},g.prototype.transformVerbosity=function(v,b){if(!b&&(v=v.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),v=v.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),v=v.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),v=v.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var S=0,w=Object.entries(this.i18n.conciseVerbosityReplacements());S<w.length;S++){var x=w[S],R=x[0],k=x[1];v=v.replace(new RegExp(R,"g"),k)}return v},g.prototype.getPeriod=function(v){return v>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},g.locales={},g})();s.ExpressionDescriptor=h}),747:((i,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.enLocaleLoader=void 0;var f=c(486),u=(function(){function h(){}return h.prototype.load=function(g){g.en=new f.en},h})();s.enLocaleLoader=u}),486:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.en=void 0;var c=(function(){function f(){}return f.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},f.prototype.atX0MinutesPastTheHourGt20=function(){return null},f.prototype.commaMonthX0ThroughMonthX1=function(){return null},f.prototype.commaYearX0ThroughYearX1=function(){return null},f.prototype.use24HourTimeFormatByDefault=function(){return!1},f.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},f.prototype.everyMinute=function(){return"every minute"},f.prototype.everyHour=function(){return"every hour"},f.prototype.atSpace=function(){return"At "},f.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},f.prototype.at=function(){return"At"},f.prototype.spaceAnd=function(){return" and"},f.prototype.everySecond=function(){return"every second"},f.prototype.everyX0Seconds=function(){return"every %s seconds"},f.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},f.prototype.atX0SecondsPastTheMinute=function(){return"at %s seconds past the minute"},f.prototype.everyX0Minutes=function(){return"every %s minutes"},f.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},f.prototype.atX0MinutesPastTheHour=function(){return"at %s minutes past the hour"},f.prototype.everyX0Hours=function(){return"every %s hours"},f.prototype.betweenX0AndX1=function(){return"between %s and %s"},f.prototype.atX0=function(){return"at %s"},f.prototype.commaEveryDay=function(){return", every day"},f.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},f.prototype.commaX0ThroughX1=function(){return", %s through %s"},f.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},f.prototype.first=function(){return"first"},f.prototype.second=function(){return"second"},f.prototype.third=function(){return"third"},f.prototype.fourth=function(){return"fourth"},f.prototype.fifth=function(){return"fifth"},f.prototype.commaOnThe=function(){return", on the "},f.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},f.prototype.lastDay=function(){return"the last day"},f.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},f.prototype.commaOnlyOnX0=function(){return", only on %s"},f.prototype.commaAndOnX0=function(){return", and on %s"},f.prototype.commaEveryX0Months=function(){return", every %s months"},f.prototype.commaOnlyInX0=function(){return", only in %s"},f.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},f.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},f.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(){return", %s days before the last day of the month"},f.prototype.firstWeekday=function(){return"first weekday"},f.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},f.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},f.prototype.commaEveryX0Days=function(){return", every %s days"},f.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},f.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},f.prototype.commaEveryHour=function(){return", every hour"},f.prototype.commaEveryX0Years=function(){return", every %s years"},f.prototype.commaStartingX0=function(){return", starting %s"},f.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},f.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},f.prototype.atReboot=function(){return"Run once, at startup"},f})();s.en=c}),515:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0});function c(u,h){if(!u)throw new Error(h)}var f=(function(){function u(){}return u.secondRange=function(h){for(var g=h.split(","),v=0;v<g.length;v++)if(!isNaN(parseInt(g[v],10))){var b=parseInt(g[v],10);c(b>=0&&b<=59,"seconds part must be >= 0 and <= 59")}},u.minuteRange=function(h){for(var g=h.split(","),v=0;v<g.length;v++)if(!isNaN(parseInt(g[v],10))){var b=parseInt(g[v],10);c(b>=0&&b<=59,"minutes part must be >= 0 and <= 59")}},u.hourRange=function(h){for(var g=h.split(","),v=0;v<g.length;v++)if(!isNaN(parseInt(g[v],10))){var b=parseInt(g[v],10);c(b>=0&&b<=23,"hours part must be >= 0 and <= 23")}},u.dayOfMonthRange=function(h){for(var g=h.split(","),v=0;v<g.length;v++)if(!isNaN(parseInt(g[v],10))){var b=parseInt(g[v],10);c(b>=1&&b<=31,"DOM part must be >= 1 and <= 31")}},u.monthRange=function(h,g){for(var v=h.split(","),b=0;b<v.length;b++)if(!isNaN(parseInt(v[b],10))){var S=parseInt(v[b],10);c(S>=1&&S<=12,g?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},u.dayOfWeekRange=function(h,g){for(var v=h.split(","),b=0;b<v.length;b++)if(!isNaN(parseInt(v[b],10))){var S=parseInt(v[b],10);c(S>=0&&S<=6,g?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}},u})();s.default=f}),823:((i,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.StringUtilities=void 0;var c=(function(){function f(){}return f.format=function(u){for(var h=[],g=1;g<arguments.length;g++)h[g-1]=arguments[g];return u.replace(/%s/g,function(v){return h.shift()})},f.containsAny=function(u,h){return h.some(function(g){return u.indexOf(g)>-1})},f})();s.StringUtilities=c})},r={};function o(i){var s=r[i];if(s!==void 0)return s.exports;var c=r[i]={exports:{}};return n[i](c,c.exports,o),c.exports}var a={};return(()=>{var i=a;Object.defineProperty(i,"__esModule",{value:!0}),i.toString=void 0;var s=o(333),c=o(747);s.ExpressionDescriptor.initialize(new c.enLocaleLoader),i.default=s.ExpressionDescriptor;var f=s.ExpressionDescriptor.toString;i.toString=f})(),a})())})(Gj)),Gj.exports}var kbe=Cbe();const Ebe=tc(kbe),Rbe=new Set(["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC","SUN","MON","TUE","WED","THU","FRI","SAT"]);function Tbe(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)&&!Rbe.has(n.toUpperCase()))return!1}return!0}function BR(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(!Tbe(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=Ebe.toString(t,{use24HourTimeFormat:!0,verbose:!1}),r=wbe.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 FF(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 Mbe({onSubmit:e,isSubmitting:t,disabled:n,disabledReason:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(!1),c=()=>a(!1),f=async()=>{try{await e({forceRefresh:i}),a(!1)}catch{}},u=m.jsx("span",{children:m.jsx(dy,{label:"Materialization",onClick:()=>a(!0),disabled:n})});return m.jsxs(m.Fragment,{children:[n&&r?m.jsx(ga,{title:r,children:u}):u,m.jsx(Xo,{open:o,onClose:c,title:"New materialization",description:"Compile the package, build a table for every persist source, and load them so queries serve from the tables.",actions:m.jsxs(m.Fragment,{children:[m.jsx(wr,{onClick:c,children:"Cancel"}),m.jsx(wr,{variant:"contained",loading:t,onClick:f,children:"Materialize"})]}),children:m.jsx(GY,{children:m.jsx(dE,{control:m.jsx(yL,{checked:i,onChange:h=>s(h.target.checked)}),label:"Force refresh (rebuild even if unchanged)"})})})]})}function Tb({children:e}){return m.jsx(Et,{variant:"caption",component:"h6",sx:{display:"block",textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:"text.secondary",mb:1},children:e})}function u0(e){return e===ka.Pending||e===ka.ManifestRowsReady}function Obe(e){return e===ka.ManifestFileReady||e===ka.Failed||e===ka.Cancelled}function _F(e){switch(e){case ka.ManifestFileReady:return"Done";case ka.Failed:return"Failed";case ka.Cancelled:return"Cancelled";case ka.Pending:case ka.ManifestRowsReady:return"Pending";default:return"Unknown"}}function fk(e){switch(e){case ka.ManifestRowsReady:return"info";case ka.ManifestFileReady:return"success";case ka.Failed:return"error";case ka.Cancelled:return"warning";case ka.Pending:default:return"default"}}function $be(e){const t=Object.values(UR(e).refusedSources??{}).map(r=>({name:r.name,message:r.message})),n=Object.values(e.manifest?.failures??{}).filter(r=>r.refused).map(r=>({name:r.sourceName??r.sourceEntityId,message:r.reason}));return[...t,...n].sort((r,o)=>r.name.localeCompare(o.name))}function BF(e,t){const n=[`${e.sourcesBuilt??0} built`,`${e.sourcesReused??0} reused`];return e.sourcesRefused&&n.push(`${e.sourcesRefused} refused`),n.join(t)}function UR(e){return e.metadata??{}}function Pbe(e){return e.trigger==="SCHEDULER"?"Scheduled":"Manual"}function UF(e,t){if(!e)return"-";const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),o=Math.max(0,r-n);if(o<1e3)return`${o}ms`;const a=Math.round(o/1e3);if(a<60)return`${a}s`;const i=Math.floor(a/60),s=a%60;if(i<60)return`${i}m ${s}s`;const c=Math.floor(i/60),f=i%60;return`${c}h ${f}m`}function pk(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 Abe(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 Dbe({entries:e,builtAt:t}){const n=Object.entries(e??{});return m.jsxs(yt,{children:[m.jsxs(lr,{direction:"row",alignItems:"baseline",justifyContent:"space-between",children:[m.jsx(Tb,{children:"Build manifest"}),t&&m.jsxs(Et,{variant:"caption",color:"text.secondary",children:["Built ",pk(t)]})]}),n.length===0?m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"No materialized tables yet."}):m.jsxs(X0,{size:"small",children:[m.jsx(J0,{children:m.jsxs(eu,{children:[m.jsx(cr,{children:"Source"}),m.jsx(cr,{children:"Table name"}),m.jsx(cr,{children:"Connection"}),m.jsx(cr,{children:"Realization"}),m.jsx(cr,{align:"right",children:"Rows"})]})}),m.jsx(Z0,{children:n.map(([r,o])=>m.jsxs(eu,{children:[m.jsx(cr,{sx:{fontFamily:zo},children:o.sourceName??r}),m.jsx(cr,{sx:{fontFamily:zo},children:o.physicalTableName??"-"}),m.jsx(cr,{sx:{fontFamily:zo},children:o.connectionName??"-"}),m.jsx(cr,{children:o.realization??"-"}),m.jsx(cr,{align:"right",children:o.rowCount??"-"})]},r))})]})]})}function VF({meta:e}){const t=e.trigger==="SCHEDULER";return m.jsx(ga,{title:t?"Fired by the materialization schedule":"Triggered manually",children:m.jsx(Et,{variant:"body2",color:"text.secondary",children:Pbe(e)})})}function jbe({materialization:e,buildPlan:t,onClose:n}){const r=e?UR(e):{},o=e?$be(e):[],a=Object.values(t?.sources??{});return m.jsx(W0,{open:e!==null,onClose:n,maxWidth:"md",fullWidth:!0,"aria-labelledby":"materialization-detail-title",children:e&&m.jsxs(m.Fragment,{children:[m.jsxs(G0,{sx:{pr:6,pb:1.5},id:"materialization-detail-title",children:[m.jsxs(lr,{direction:"row",alignItems:"center",spacing:1,sx:{mb:.75},children:[m.jsx(QI,{size:"small",label:_F(e.status),color:fk(e.status),variant:u0(e.status)?"filled":"outlined"}),m.jsx(VF,{meta:r})]}),m.jsx(Et,{variant:"subtitle1",sx:{fontWeight:600},children:e.packageName??"Materialization"}),m.jsx(Et,{variant:"caption",color:"text.secondary",sx:{fontFamily:zo,wordBreak:"break-all"},children:e.id}),m.jsx(Eo,{"aria-label":"close",onClick:n,sx:{position:"absolute",right:8,top:8},children:m.jsx(Gp,{fontSize:"small"})})]}),m.jsxs(Y0,{dividers:!0,children:[m.jsxs(yt,{sx:{bgcolor:"action.hover",borderRadius:2,p:2,mb:3,display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:2},children:[m.jsx(Um,{label:"Started",value:pk(e.startedAt??e.createdAt)}),m.jsx(Um,{label:"Completed",value:pk(e.completedAt)}),m.jsx(Um,{label:"Duration",value:UF(e.startedAt,e.completedAt)}),m.jsx(Um,{label:"Sources",value:BF(r," · ")}),m.jsx(Um,{label:"Force refresh",value:r.forceRefresh?"Yes":"No"})]}),e.error&&m.jsxs(yt,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"error.main"},children:[m.jsx(Tb,{children:m.jsx(yt,{component:"span",sx:{color:"error.main"},children:"Error"})}),m.jsx(Et,{variant:"body2",sx:{fontFamily:zo,whiteSpace:"pre-wrap"},children:e.error})]}),o.length>0&&m.jsxs(yt,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"warning.main"},children:[m.jsx(Tb,{children:m.jsx(yt,{component:"span",sx:{color:"warning.main"},children:"Refused sources"})}),m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{mb:1},children:"Not built, because materializing them would be unsafe. They serve live until the model changes."}),o.map(i=>m.jsxs(yt,{sx:{mt:1},children:[m.jsx(Et,{variant:"body2",sx:{fontFamily:zo},children:i.name}),m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-wrap"},children:i.message})]},i.name))]}),m.jsxs(yt,{sx:{mb:3},children:[m.jsx(Tb,{children:"Build plan"}),a.length===0?m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"This package has no persist sources."}):m.jsxs(X0,{size:"small",children:[m.jsx(J0,{children:m.jsxs(eu,{children:[m.jsx(cr,{children:"Source"}),m.jsx(cr,{children:"Connection"}),m.jsx(cr,{children:"Dialect"}),m.jsx(cr,{align:"right",children:"Columns"}),m.jsx(cr,{children:"Source Entity ID"})]})}),m.jsx(Z0,{children:a.map(i=>m.jsxs(eu,{children:[m.jsx(cr,{sx:{fontFamily:zo},children:i.name}),m.jsx(cr,{sx:{fontFamily:zo},children:i.connectionName}),m.jsx(cr,{children:i.dialect??"-"}),m.jsx(cr,{align:"right",children:i.columns?.length??0}),m.jsx(cr,{sx:{fontFamily:zo,fontSize:"0.75rem",wordBreak:"break-all",maxWidth:220},children:i.sourceEntityId})]},i.sourceID))})]})]}),m.jsx(Dbe,{entries:e.manifest?.entries,builtAt:e.manifest?.builtAt})]})]})})}function Um({label:e,value:t}){return m.jsxs(yt,{children:[m.jsx(Et,{variant:"caption",color:"text.secondary",display:"block",children:e}),m.jsx(Et,{variant:"body2",children:t})]})}const Nbe=jn(m.jsx("path",{d:"M6 6h12v12H6z"}));function Ibe(e){return un("PrivateSwitchBase",e)}nn("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const Lbe=e=>{const{classes:t,checked:n,disabled:r,edge:o}=e,a={root:["root",n&&"checked",r&&"disabled",o&&`edge${Rt(o)}`],input:["input"]};return ln(a,Ibe,t)},zbe=Xe(Ed,{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}}]}),Fbe=Xe("input",{name:"MuiSwitchBase",shouldForwardProp:Xa})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),_be=C.forwardRef(function(e,t){const{autoFocus:n,checked:r,checkedIcon:o,defaultChecked:a,disabled:i,disableFocusRipple:s=!1,edge:c=!1,icon:f,id:u,inputProps:h,inputRef:g,name:v,onBlur:b,onChange:S,onFocus:w,readOnly:x,required:R=!1,tabIndex:k,type:T,value:$,slots:A={},slotProps:z={},...j}=e,[B,L]=wi({controlled:r,default:!!a,name:"SwitchBase",state:"checked"}),F=Mi(),E=ae=>{w&&w(ae),F&&F.onFocus&&F.onFocus(ae)},N=ae=>{b&&b(ae),F&&F.onBlur&&F.onBlur(ae)},D=ae=>{if(ae.nativeEvent.defaultPrevented)return;const J=ae.target.checked;L(J),S&&S(ae,J)};let V=i;F&&typeof V>"u"&&(V=F.disabled);const I=T==="checkbox"||T==="radio",W={...e,checked:B,disabled:V,disableFocusRipple:s,edge:c},X=Lbe(W),ie={slots:A,slotProps:{input:h,...z}},[G,ee]=sr("root",{ref:t,elementType:zbe,className:X.root,shouldForwardComponentProp:!0,externalForwardedProps:{...ie,component:"span",...j},getSlotProps:ae=>({...ae,onFocus:J=>{ae.onFocus?.(J),E(J)},onBlur:J=>{ae.onBlur?.(J),N(J)}}),ownerState:W,additionalProps:{centerRipple:!0,focusRipple:!s,disabled:V,role:void 0,tabIndex:null}}),[se,Y]=sr("input",{ref:g,elementType:Fbe,className:X.input,externalForwardedProps:ie,getSlotProps:ae=>({...ae,onChange:J=>{ae.onChange?.(J),D(J)}}),ownerState:W,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:V,id:I?u:void 0,name:v,readOnly:x,required:R,tabIndex:k,type:T,...T==="checkbox"&&$===void 0?{}:{value:$}}});return m.jsxs(G,{...ee,children:[m.jsx(se,{...Y}),B?o:f]})}),Bbe=jn(m.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})),Ube=jn(m.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})),Vbe=jn(m.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}));function Hbe(e){return un("MuiCheckbox",e)}const Tw=nn("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),qbe=e=>{const{classes:t,indeterminate:n,color:r,size:o}=e,a={root:["root",n&&"indeterminate",`color${Rt(r)}`,`size${Rt(o)}`]},i=ln(a,Hbe,t);return{...t,...i}},Wbe=Xe(_be,{shouldForwardProp:e=>Xa(e)||e==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${Rt(n.size)}`],n.color!=="default"&&t[`color${Rt(n.color)}`]]}})(Wn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(Ea()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(Ea()).map(([t])=>({props:{color:t},style:{[`&.${Tw.checked}, &.${Tw.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${Tw.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),Ybe=m.jsx(Ube,{}),Gbe=m.jsx(Bbe,{}),Kbe=m.jsx(Vbe,{}),Xbe=C.forwardRef(function(e,t){const n=Yn({props:e,name:"MuiCheckbox"}),{checkedIcon:r=Ybe,color:o="primary",icon:a=Gbe,indeterminate:i=!1,indeterminateIcon:s=Kbe,inputProps:c,size:f="medium",disableRipple:u=!1,className:h,slots:g={},slotProps:v={},...b}=n,S=i?s:a,w=i?s:r,x={...n,disableRipple:u,color:o,indeterminate:i,size:f},R=qbe(x),k=v.input??c,[T,$]=sr("root",{ref:t,elementType:Wbe,className:Bt(R.root,h),shouldForwardComponentProp:!0,externalForwardedProps:{slots:g,slotProps:v,...b},ownerState:x,additionalProps:{type:"checkbox",icon:C.cloneElement(S,{fontSize:S.props.fontSize??f}),checkedIcon:C.cloneElement(w,{fontSize:w.props.fontSize??f}),disableRipple:u,slots:g,slotProps:{input:J5(typeof k=="function"?k(x):k,{"data-indeterminate":i})}}});return m.jsx(T,{...$,classes:R})});function Qbe(e){return un("MuiFormControlLabel",e)}const ng=nn("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error","required","asterisk"]),Zbe=e=>{const{classes:t,disabled:n,labelPlacement:r,error:o,required:a}=e,i={root:["root",n&&"disabled",`labelPlacement${Rt(r)}`,o&&"error",a&&"required"],label:["label",n&&"disabled"],asterisk:["asterisk",o&&"error"]};return ln(i,Qbe,t)},Jbe=Xe("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${ng.label}`]:t.label},t.root,t[`labelPlacement${Rt(n.labelPlacement)}`]]}})(Wn(({theme:e})=>({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${ng.disabled}`]:{cursor:"default"},[`& .${ng.label}`]:{[`&.${ng.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}}]}))),e0e=Xe("span",{name:"MuiFormControlLabel",slot:"Asterisk"})(Wn(({theme:e})=>({[`&.${ng.error}`]:{color:(e.vars||e).palette.error.main}}))),t0e=C.forwardRef(function(e,t){const n=Yn({props:e,name:"MuiFormControlLabel"}),{checked:r,className:o,componentsProps:a={},control:i,disabled:s,disableTypography:c,inputRef:f,label:u,labelPlacement:h="end",name:g,onChange:v,required:b,slots:S={},slotProps:w={},value:x,...R}=n,k=Mi(),T=s??i.props.disabled??k?.disabled,$=b??i.props.required,A={disabled:T,required:$};["checked","name","onChange","value","inputRef"].forEach(D=>{typeof i.props[D]>"u"&&typeof n[D]<"u"&&(A[D]=n[D])});const z=zd({props:n,muiFormControl:k,states:["error"]}),j={...n,disabled:T,labelPlacement:h,required:$,error:z.error},B=Zbe(j),L={slots:S,slotProps:{...a,...w}},[F,E]=sr("typography",{elementType:br,externalForwardedProps:L,ownerState:j});let N=u;return N!=null&&N.type!==br&&!c&&(N=m.jsx(F,{component:"span",...E,className:Bt(B.label,E?.className),children:N})),m.jsxs(Jbe,{className:Bt(B.root,o),ownerState:j,ref:t,...R,children:[C.cloneElement(i,A),$?m.jsxs("div",{children:[N,m.jsxs(e0e,{ownerState:j,"aria-hidden":!0,className:B.asterisk,children:[" ","*"]})]}):N]})});function n0e({materialization:e,onCloseDialog:t,isMutating:n,onDelete:r}){const[o,a]=C.useState(!1),[i,s]=C.useState(!1),c=()=>a(!0),f=()=>{a(!1),s(!1),t()};return m.jsxs(mn.Fragment,{children:[m.jsxs(Lo,{"aria-label":`Delete materialization ${e?.id??""}`.trim(),onClick:u=>{u.stopPropagation(),c()},sx:{color:"error.main"},children:[m.jsx(LR,{sx:{color:"inherit"},children:m.jsx(lx,{fontSize:"small"})}),m.jsx(zR,{children:"Delete"})]}),m.jsxs(Xo,{open:o,onClose:f,title:"Delete materialization",actions:m.jsxs(m.Fragment,{children:[m.jsx(go,{onClick:f,children:"Cancel"}),m.jsx(go,{variant:"contained",color:"error",autoFocus:!0,onClick:()=>r(i),loading:n,children:"Delete run"})]}),children:[m.jsx(br,{variant:"body2",children:"Delete this run's record? This cannot be undone."}),m.jsx(t0e,{control:m.jsx(Xbe,{checked:i,onChange:u=>s(u.target.checked)}),label:"Also drop the materialized tables this run produced"})]})]})}function r0e({materializations:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){return e.length===0?m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{py:1,fontStyle:"italic"},children:"No materializations yet."}):m.jsxs(X0,{size:"small",sx:{"& td, & th":{borderColor:"divider"},"& td:first-of-type, & th:first-of-type":{pl:0},"& td:last-of-type, & th:last-of-type":{pr:0},"& th":{color:"text.secondary",fontWeight:600}},children:[m.jsx(J0,{children:m.jsxs(eu,{children:[m.jsx(cr,{children:"Status"}),m.jsx(cr,{children:"Trigger"}),m.jsx(cr,{children:"Started"}),m.jsx(cr,{children:"Duration"}),m.jsx(cr,{children:"Sources"}),m.jsx(cr,{align:"right",children:"Actions"})]})}),m.jsx(Z0,{children:e.map(i=>m.jsx(o0e,{materialization:i,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a},i.id))})]})}function o0e({materialization:e,mutable:t,isMutating:n,onStop:r,onDelete:o,onViewDetails:a}){const[i,s]=C.useState(null),c=!!i,f=()=>s(null),u=UR(e),h=u.sourcesBuilt!==void 0||u.sourcesReused!==void 0?BF(u,", "):"-",g=u0(e.status),v=Obe(e.status),b=e.error??void 0,S=t&&(g||v);return m.jsxs(eu,{hover:!0,sx:{cursor:"pointer","&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:"-2px"}},onClick:()=>a(e),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),a(e))},role:"button",tabIndex:0,"aria-label":`View materialization ${e.id??""} details`.trim(),children:[m.jsx(cr,{children:m.jsxs(yt,{sx:{display:"flex",alignItems:"center",gap:.5},children:[m.jsx(Et,{variant:"body2",sx:{fontWeight:500,color:fk(e.status)==="default"?"text.primary":`${fk(e.status)}.main`},children:_F(e.status)}),b&&m.jsx(ga,{title:b,children:m.jsx(tF,{fontSize:"small",color:"error"})})]})}),m.jsx(cr,{children:m.jsx(VF,{meta:u})}),m.jsx(cr,{children:Abe(e.startedAt??e.createdAt)}),m.jsx(cr,{children:UF(e.startedAt,e.completedAt)}),m.jsx(cr,{children:h}),m.jsx(cr,{align:"right",onClick:w=>w.stopPropagation(),children:S&&m.jsxs(m.Fragment,{children:[m.jsx(Eo,{size:"small","aria-label":`Materialization actions for ${e.id??""}`.trim(),onClick:w=>s(w.currentTarget),children:m.jsx(cx,{fontSize:"small"})}),m.jsxs(Pd,{anchorEl:i,open:c,onClose:f,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[t&&g&&m.jsxs(Si,{"aria-label":`Stop materialization ${e.id??""}`.trim(),disabled:n,onClick:()=>{f(),r(e)},children:[m.jsx(Up,{children:m.jsx(Nbe,{fontSize:"small"})}),m.jsx(su,{children:"Stop"})]}),t&&v&&m.jsx(n0e,{materialization:e,isMutating:n,onCloseDialog:f,onDelete:w=>o(e,w)})]})]})})]})}const a0e=jn(m.jsx("path",{d:"m11.99 18.54-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27zm0-11.47L17.74 9 12 13.47 6.26 9z"})),i0e={package:"Materialized artifacts are shared across versions",version:"Materialized artifacts are per published version"};function s0e({scope:e,disabled:t,disabledReason:n,isSubmitting:r,onChange:o}){const[a,i]=C.useState(null),s=async c=>{i(null),c!==e&&await o(c).catch(()=>{})};return m.jsxs(m.Fragment,{children:[m.jsx(fy,{label:"Scope",icon:m.jsx(a0e,{}),onClick:c=>i(c.currentTarget),disabled:t||r,...n?{disabledReason:n}:{},ariaHasPopup:"menu",ariaLabel:`Scope: ${e}`}),m.jsx(Pd,{anchorEl:a,open:!!a,onClose:()=>i(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:["package","version"].map(c=>m.jsxs(Si,{selected:c===e,onClick:()=>void s(c),children:[m.jsx(Up,{sx:{minWidth:32},children:c===e&&m.jsx(Aoe,{fontSize:"small"})}),m.jsx(su,{primary:c,secondary:i0e[c]})]},c))})]})}const l0e=jn([m.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),m.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")]),Xj="0 6 * * *";function c0e({currentSchedule:e,isSubmitting:t,disabled:n,disabledReason:r,onSubmit:o}){const[a,i]=C.useState(!1),[s,c]=C.useState(e??Xj),f=()=>{c(e??Xj),i(!0)},u=()=>i(!1),h=BR(s),g=async v=>{try{await o(v),i(!1)}catch{}};return m.jsxs(m.Fragment,{children:[m.jsx(fy,{label:"Schedule",icon:m.jsx(l0e,{}),onClick:f,disabled:n,...r?{disabledReason:r}:{},ariaHasPopup:"dialog",ariaLabel:e?"Edit schedule":"Set schedule"}),m.jsxs(Xo,{open:a,onClose:u,title:e?"Edit schedule":"Set schedule",description:"The publisher rebuilds this package's materializations on this cadence: a 5-field UNIX cron, in UTC. In a hosted deployment the change takes effect on your next publish.",actions:m.jsxs(m.Fragment,{children:[e&&m.jsx(wr,{color:"error",loading:t,onClick:()=>g(null),sx:{mr:"auto"},children:"Clear schedule"}),m.jsx(wr,{onClick:u,children:"Cancel"}),m.jsx(wr,{variant:"contained",loading:t,disabled:!h.valid,onClick:()=>g(s.trim()),children:"Save schedule"})]}),children:[m.jsx(_a,{autoFocus:!0,fullWidth:!0,size:"small",label:"Cron expression",value:s,onChange:v=>c(v.target.value),error:s.trim()!==""&&!h.valid,helperText:h.valid?`${h.description} · next run ${FF(h.nextRun)}`:h.error,slotProps:{htmlInput:{style:{fontFamily:zo}}}}),m.jsxs(pa,{severity:"info",children:["A schedule runs only on version-scoped packages, so saving one sets ",m.jsx("code",{children:"scope: version"})," for this package."]})]})]})}const u0e=3e3;function d0e({resourceUri:e}){const{apiClients:t,mutable:n}=Cr(),r=Dd(),{environmentName:o,packageName:a}=to(e),[i,s]=C.useState(""),[c,f]=C.useState(null);if(!a)throw new Error("Materializations requires a package in the resource URI");const u=ko({queryKey:["materializations",o,a],queryFn:()=>t.materializations.listMaterializations(o,a),refetchInterval:N=>(N.state.data?.data??[]).some(D=>u0(D.status))?u0e:!1}),h=ko({queryKey:["package",o,a],queryFn:()=>t.packages.getPackage(o,a)}),g=()=>r.invalidateQueries({queryKey:["materializations",o,a]}),v=rl({mutationFn:ql("materialization","create",N=>t.materializations.createMaterialization(o,a,{forceRefresh:N.forceRefresh})),onSuccess(){s("Materialization requested"),g()},onError(N){s(N.message),g()}}),b=rl({mutationFn:ql("materialization","update",N=>t.materializations.materializationAction(o,a,N.id,ZJ.Stop)),onSuccess(){s("Materialization stopped"),g()},onError(N){s(N.message)}}),S=rl({mutationFn:ql("materialization","delete",({materialization:N,dropTables:D})=>t.materializations.deleteMaterialization(o,a,N.id,D)),onSuccess(){s("Materialization deleted"),g()},onError(N){s(N.message)}}),w=h.data?.data,x=rl({mutationFn:ql("schedule","update",N=>t.packages.updatePackage(o,a,{name:a,description:w?.description,...N?{scope:Iv.Version}:{},materialization:{schedule:N}})),onSuccess(N,D){s(D?"Schedule updated":"Schedule cleared"),r.invalidateQueries({queryKey:["package",o,a]})},onError(N){s(N.message)}}),R=rl({mutationFn:ql("scope","update",N=>t.packages.updatePackage(o,a,{name:a,description:w?.description,scope:N})),onSuccess(){s("Scope updated"),r.invalidateQueries({queryKey:["package",o,a]})},onError(N){s(N.message)}}),k=u.data?.data??[],T=k.find(N=>N.id===c)??null,$=k.some(N=>u0(N.status)),A=v.isPending||b.isPending||S.isPending,z=w?.materialization?.schedule??null,j=w?.scope===Iv.Version?"version":"package",B=!!w?.manifestLocation,L=!!w?.materialization?.freshness,F=z?BR(z):null,E=B?"Control-plane managed: refresh is driven by the control plane, not the built-in scheduler.":[F?F.valid?`${F.description} (${z}), next run ${FF(F.nextRun)}`:`Unrecognized cron expression (${z})`:L?"Refreshed by a freshness policy; a cron schedule does not apply":"On demand only, no schedule set",`scope: ${j}`].join(" · ");return m.jsxs(m.Fragment,{children:[m.jsxs(Ts,{title:"Materializations",count:u.isSuccess?k.length:void 0,action:n&&m.jsxs(lr,{direction:"row",spacing:1,alignItems:"center",children:[!B&&m.jsx(s0e,{scope:j,disabled:!!z,disabledReason:"A schedule requires version scope. Clear the schedule to change it.",isSubmitting:R.isPending,onChange:N=>R.mutateAsync(N==="version"?Iv.Version:Iv.Package)}),!B&&m.jsx(c0e,{currentSchedule:z,isSubmitting:x.isPending,disabled:L,disabledReason:"This package declares a freshness policy; a schedule and freshness are mutually exclusive.",onSubmit:N=>x.mutateAsync(N)}),m.jsx(Mbe,{onSubmit:N=>v.mutateAsync(N),isSubmitting:v.isPending,disabled:$,disabledReason:"A materialization is already pending or running for this package."})]}),children:[h.isSuccess&&m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:E}),u.isError&&m.jsx(Ma,{error:u.error,context:`${o} > ${a} > Materializations`}),!u.isSuccess&&!u.isError&&m.jsx(ya,{text:"Loading materializations..."}),u.isSuccess&&m.jsx(r0e,{materializations:k,mutable:n,isMutating:A,onStop:N=>b.mutate(N),onDelete:(N,D)=>S.mutate({materialization:N,dropTables:D}),onViewDetails:N=>f(N.id??null)})]}),m.jsx(jbe,{materialization:T,buildPlan:h.data?.data?.buildPlan??null,onClose:()=>f(null)}),m.jsx(K0,{open:i!=="",autoHideDuration:6e3,onClose:()=>s(""),message:i})]})}const HF=jn(m.jsx("path",{d:"M17 7h-4v2h4c1.65 0 3 1.35 3 3s-1.35 3-3 3h-4v2h4c2.76 0 5-2.24 5-5s-2.24-5-5-5m-6 8H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4zm-3-4h8v2H8z"})),f0e=jn(m.jsx("path",{d:"M8 5v14l11-7z"})),Mw={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"}]}}},p0e={...Mw,patterns:[...Mw.patterns,{include:"#docvar"}],repository:{...Mw.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},h0e={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"}]}}},m0e="github-light",g0e="github-dark";let Ow;function y0e(){return Ow||(Ow=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:a},{default:i}]=await Promise.all([Co(()=>import("./core-B8oMW4sm.es-hOkwvru5.js"),__vite__mapDeps([3,4])),Co(()=>import("./engine-oniguruma-C4vnmooL.es-jdkXmgTr.js"),[]),Co(()=>import("./sql-DCkt643-.es-COK4E0Yg.js"),[]),Co(()=>import("./json-71t8ZF9g.es-BQoSv7ci.js"),[]),Co(()=>import("./typescript-buWNZFwO.es-Dj6nwHGl.js"),[]),Co(()=>import("./github-light-JYsPkUQd.es-DAi9KRSo.js"),[]),Co(()=>import("./github-dark-DenFmJkN.es-DHJKELXO.js"),[])]);return e({engine:t(Co(()=>import("./wasm-DQxwEHae.es-CG6Dc4jp.js"),[])),themes:[a,i],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...p0e},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...h0e}]})})()),Ow}async function qF(e,t,n="light"){return(await y0e()).codeToHtml(e,{lang:t,theme:n==="dark"?g0e:m0e})}function WF({open:e,onClose:t,result:n,title:r="Results",renderLogs:o,drill:a}){return m.jsx(Xo,{open:e,onClose:t,title:r,maxWidth:!1,showClose:!0,children:m.jsx(yt,{sx:{height:"70vh",overflow:"auto"},children:m.jsx(OR,{result:n,maxHeight:dge,maxResultSize:1e6,renderLogs:o,drill:a})})})}function v0e({queryName:e,annotations:t,resourceUri:n,runOnDemand:r=!1,maxResultSize:o=0}){const[a,i]=mn.useState(),[s,c]=mn.useState(!1),[f,u]=mn.useState(!1),{packageName:h,environmentName:g,versionId:v,modelPath:b}=to(n),S=!r||f,w=IR({environmentName:g,packageName:h,modelPath:b,versionId:v,queryName:e},{enabled:S}),x=w.data,{mode:R}=eo();return C.useEffect(()=>{if(t&&t.length>0){const k=t.map(T=>`// ${T}`).join(`
|
|
479
|
-
`);qF(k,"typescript",R).then(T=>{i(T)})}},[t,R]),m.jsxs(yt,{children:[a&&m.jsx(yt,{sx:{marginBottom:"16px"},children:m.jsx(Et,{fontSize:"12px",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:m.jsx("div",{className:"content",dangerouslySetInnerHTML:{__html:a}})})}),m.jsxs(yt,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[m.jsx(Et,{variant:"body2",sx:{fontSize:"15px",fontWeight:600,color:"text.primary",px:2,py:1,bgcolor:"action.hover",borderRadius:1.5,border:1,borderColor:"divider"},children:e}),m.jsx(gp,{"aria-label":"Expand results",onClick:()=>c(!0),children:m.jsx(Rp,{})})]}),m.jsxs(m5,{sx:{position:"relative"},children:[r&&!f&&m.jsxs(yt,{sx:{padding:"40px 20px",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[m.jsx(Et,{variant:"body2",color:"text.secondary",children:"Click Run to execute the query"}),m.jsx(wr,{variant:"contained",startIcon:m.jsx(f0e,{}),onClick:()=>u(!0),children:"Run Query"})]}),S&&m.jsx($R,{state:w,context:e,maxHeight:uge,maxResultSize:o})]}),m.jsx(WF,{open:s,onClose:()=>c(!1),result:x?.data?.result||"",renderLogs:x?.data?.renderLogs,title:`Query: ${e}`})]})}function b0e(e){return e!=null}function x0e(e,t){const n=[],r=[];for(const a of e){if(a.name===void 0||b0e(t.get(a.name)))continue;if(a.default==null){n.push(a.name);continue}const i=RR(a.type??"string",a.default);i&&r.push(`${a.name} = ${i}`)}const o={missing:n};return r.length>0&&(o.defaultsNote=r.length===1?`Ran with the default ${r[0]}`:`Ran with defaults ${r.join(", ")}`),o}function S0e(e){return e.length===1?`This source may need a value for the given ${e[0]}. Set it in the parameters above.`:`This source may need values for the givens ${e.join(", ")}. Set them in the parameters above.`}function w0e({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a,givens:i,gate:s}){return mn.useEffect(()=>{o&&o(t)},[t,o]),m.jsx(h5,{children:m.jsxs(dq,{spacing:2,component:"section",children:[m.jsx(k0e,{sourceAndPath:e[t],existingQuery:n,onChange:c=>{r&&r(c)},resourceUri:a,givens:i,gate:s}),m.jsx(cI,{height:"5px"})]})})}function $w(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function C0e({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a,givens:i,gate:s}){const[c,f]=mn.useState(n||$w()),[u,h]=mn.useState(void 0);mn.useEffect(()=>{n&&f(n)},[n]);const[g,v]=mn.useState([]),{MalloyExplorerProvider:b,QueryPanel:S,ResizableCollapsiblePanel:w,ResultPanel:x,SourcePanel:R}=r;mn.useEffect(()=>{t&&t(c)},[t,c]);const{environmentName:k,packageName:T,versionId:$}=to(a),{apiClients:A}=Cr(),z=mn.useRef(void 0),j=rl({mutationFn:()=>{z.current=s,h({executionState:"running",query:c?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{j.reset(),h(void 0)},response:{}});const E=typeof c?.malloyQuery=="string"?c.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:c?.malloyQuery}).toMalloy();return f({...c,query:E}),A.models.executeQueryModel(k,T,e.modelPath,{query:E,sourceName:void 0,queryName:void 0,versionId:$,...i&&Object.keys(i).length>0?{givens:i}:{}})},onSuccess:E=>{if(E){const N=JSON.parse(E.data.result);f({...c,malloyResult:N});const D=z.current;h(V=>V?{...V,executionState:"finished",response:{result:N,...D?.defaultsNote?{messages:[{severity:"INFO",title:D.defaultsNote}]}:{}}}:void 0)}},onError:E=>{console.error("Query execution error:",E);const N=E?.data?.message??E?.message??"The query could not be run.",D=[{severity:"ERROR",title:N}],V=z.current?.missing??[];(E?.status===403||/Access denied for source/i.test(N))&&V.length>0&&D.push({severity:"WARN",title:S0e(V)}),h(I=>I?{...I,executionState:"finished",response:{messages:D}}:void 0)}}),[B,L]=mn.useState(e.sourceInfo.name);mn.useEffect(()=>{B!==e.sourceInfo.name&&(L(e.sourceInfo.name),f($w()),h(void 0))},[e,B]);const F=mn.useCallback(E=>{f({...c,malloyQuery:E,malloyResult:void 0})},[c]);return B!==e.sourceInfo.name?m.jsx("div",{children:"Loading..."}):m.jsx(g5,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:m.jsx(b,{source:e.sourceInfo,query:c?.malloyQuery,topValues:[],onFocusedNestViewPathChange:v,focusedNestViewPath:g,onQueryChange:F,children:m.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[m.jsx(w,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:m.jsx(R,{onRefresh:()=>f($w())})}),m.jsx(w,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:m.jsx(S,{runQuery:()=>{console.log(`running query with: ${c?.malloyQuery}`);try{j.mutate()}catch(E){console.error("Error running query:",E)}}})}),m.jsx(x,{source:e.sourceInfo,draftQuery:c?.malloyQuery,setDraftQuery:E=>f({...c,malloyQuery:E}),submittedQuery:u,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function k0e(e){const[t,n]=C.useState(null),[r,o]=C.useState(null),[a,i]=C.useState(!0);return C.useEffect(()=>{let s=!0;return Promise.all([Co(()=>import("./index-BRzP9bJe.js"),__vite__mapDeps([5,0,1,2,6])),jge()]).then(([c,f])=>{s&&(n(c),o(f),i(!1))}).catch(c=>{console.error("Failed to load Malloy components:",c),s&&i(!1)}),()=>{s=!1}},[]),a||!t||!r?m.jsx(RJ,{children:m.jsx(g5,{children:m.jsx(cI,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):m.jsx(C0e,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function YF(e,t=!0){const{modelPath:n,environmentName:r,packageName:o,versionId:a}=to(e),{apiClients:i}=Cr();return ko({queryKey:["package",r,o,n,a],queryFn:async()=>(await i.models.getModel(r,o,n,a)).data,enabled:t})}function GF({data:e,onChange:t,existingQuery:n,initialSelectedSourceIndex:r=0,onSourceChange:o,resourceUri:a,givens:i,onGivensChange:s,startingGivens:c}){const[f,u]=mn.useState(r);mn.useEffect(()=>{u(r)},[r]);const{data:h,isError:g,isLoading:v,error:b}=YF(a,!e),{environmentName:S,packageName:w,modelPath:x,versionId:R}=to(a),k=e||h,T=mn.useMemo(()=>k?.givens??[],[k]),$=ZE({specs:T,loaded:!!k,params:i,onGivensChange:s,startingValues:c,documentKey:a,autorun:!0,environmentName:S??"",packageName:w??"",modelPath:x,versionId:R,documentName:x}),A=C.useMemo(()=>Kp($.applied,$.declaredTypes),[$.applied,$.declaredTypes]),z=C.useMemo(()=>x0e(T,$.applied),[T,$.applied]);if(v&&!e)return m.jsx(ya,{text:"Fetching Model..."});if(g&&!e)return console.log("error",b),m.jsx(Ma,{error:b,context:`ModelExplorer > ${x}`});if(!k)return m.jsx(ya,{text:Np.loading});const j=(k?.sourceInfos||[]).map((L,F)=>{try{return JSON.parse(L)?.name||`Source ${F+1}`}catch{return`Source ${F+1}`}}),B=j[f]||"";return m.jsxs(kJ,{variant:"outlined",children:[m.jsx(EJ,{children:m.jsx(lr,{sx:{flexDirection:"row"},children:m.jsx(nbe,{size:"small",id:"size-small-standard",disablePortal:!0,options:j,value:B,onChange:(L,F)=>{if(!F)return;const E=j.indexOf(F);E>=0&&(u(E),o?.(E))},renderInput:L=>m.jsx(hr,{...L}),style:{width:350,marginTop:"3px",marginLeft:"6px",marginBottom:"8px"}})})}),m.jsx(MR,{...$.panel}),m.jsx(h5,{children:m.jsxs(lr,{spacing:2,component:"section",children:[Array.isArray(k.sourceInfos)&&k.sourceInfos.length>0&&m.jsx(w0e,{sourceAndPaths:k.sourceInfos.map(L=>({sourceInfo:JSON.parse(L),modelPath:x})),selectedSourceIndex:f,existingQuery:n,onQueryChange:t,resourceUri:a,givens:A,gate:z}),m.jsx(yt,{height:"5px"})]})})]})}function KF({open:e,onClose:t,resourceUri:n,data:r,title:o="Data Sources",hasValidImport:a=!0,existingQuery:i,initialSelectedSourceIndex:s,onChange:c,onSourceChange:f,givens:u,onGivensChange:h,startingGivens:g}){return m.jsxs(W0,{open:e,onClose:t,fullScreen:!0,children:[m.jsxs(G0,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o,m.jsx(Eo,{onClick:t,sx:{color:"text.secondary"},children:m.jsx(Gp,{})})]}),m.jsx(Y0,{children:a?m.jsx(GF,{resourceUri:n,data:r,existingQuery:i,initialSelectedSourceIndex:s,onChange:c,onSourceChange:f,givens:u,onGivensChange:h,startingGivens:g}):m.jsx("div",{children:"No valid import statement found in cell"})})]})}function bSe({onChange:e,resourceUri:t,runOnDemand:n=!1,maxResultSize:r=0,givens:o,onGivensChange:a}){const{modelPath:i}=to(t),{data:s,isError:c,isLoading:f,error:u}=YF(t),[h,g]=mn.useState(!1),[v,b]=mn.useState(),[S,w]=mn.useState(0),[x,R]=C.useState(""),[k,T]=mn.useState({}),$=o??k,A=a??(E=>T(E)),z=s?.modelDef,j=mn.useMemo(()=>{if(!z)return!1;try{const E=JSON.parse(z);return Array.isArray(E.imports)&&E.imports.length>0}catch{return!1}},[z]);if(f)return m.jsx(ya,{text:"Fetching Model..."});if(c)return console.log("error",u),m.jsx(Ma,{error:u,context:`Model > ${i}`});const B=E=>{b(E),e&&e(E)},L=E=>{w(E)},F=()=>{const E=window.location.href;navigator.clipboard.writeText(E).then(()=>R("URL copied to clipboard!")).catch(()=>R("Failed to copy URL"))};return m.jsxs(m.Fragment,{children:[m.jsxs(yt,{sx:{position:"relative",maxWidth:"1200px",margin:"0 auto",paddingTop:"24px"},children:[Array.isArray(s?.sourceInfos)&&s.sourceInfos.length>0&&m.jsxs(lr,{spacing:2,component:"section",children:[m.jsxs(yt,{sx:{padding:"0 0 16px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[m.jsx(Et,{variant:"h1",sx:{fontSize:"28px",fontWeight:"600",color:"#1a1a1a",marginBottom:"8px",marginTop:"0",paddingLeft:"0"},children:"Sources"}),m.jsx(ga,{title:"Copy link",children:m.jsx(Eo,{size:"small","aria-label":"Copy link",onClick:F,sx:{color:"text.secondary"},children:m.jsx(HF,{fontSize:"small"})})})]}),m.jsx(GF,{data:s,onChange:B,onSourceChange:L,existingQuery:v,initialSelectedSourceIndex:S,resourceUri:t,givens:$,onGivensChange:A}),m.jsx(gp,{"aria-label":"Expand results",sx:{position:"absolute",top:"90px",right:"4px",zIndex:2},onClick:()=>g(!0),children:m.jsx(Rp,{})})]}),s?.queries?.length>0&&m.jsxs(lr,{spacing:2,component:"section",sx:{marginTop:"24px"},children:[m.jsx(yt,{sx:{padding:"0 0 16px 0"},children:m.jsx(Et,{variant:"h2",sx:{fontSize:"24px",fontWeight:"600",color:"#1a1a1a",marginBottom:"0",marginTop:"8px",paddingLeft:"0"},children:"Named Queries"})}),s.queries.map(E=>m.jsx(v0e,{queryName:E.name,annotations:E.annotations,resourceUri:t,runOnDemand:n,maxResultSize:r},E.name))]}),(!Array.isArray(s?.sourceInfos)||s.sourceInfos.length===0)&&!(s?.queries&&s.queries.length>0)&&m.jsxs(yt,{sx:{textAlign:"center",py:6},children:[m.jsx(Et,{variant:"body1",sx:{color:"text.secondary",marginBottom:"8px"},children:"This model exposes no sources or queries."}),j&&m.jsxs(Et,{variant:"body2",color:"text.secondary",children:["It imports other files but re-exports nothing. Add"," ",m.jsxs("code",{children:["export ","{ source_name }"]})," to surface imported sources here."]})]}),m.jsx(KF,{open:h,onClose:()=>g(!1),resourceUri:t,data:s,title:`Model: ${i.split("/").pop()}`,existingQuery:v,initialSelectedSourceIndex:S,onChange:B,onSourceChange:L,givens:$,onGivensChange:A})]}),m.jsx(K0,{open:x!=="",autoHideDuration:6e3,onClose:()=>R(""),message:x})]})}function E0e({warnings:e}){const[t,n]=C.useState(!1),r=(e??[]).filter(a=>a.severity==="error"),o=(e??[]).filter(a=>a.severity!=="error");return r.length===0&&o.length===0?null:m.jsxs(lr,{sx:{gap:1,mb:4},children:[r.length>0&&m.jsxs(pa,{severity:"warning",children:[m.jsx(nW,{children:r.length===1?"1 problem in this package":`${r.length} problems in this package`}),m.jsx(Qj,{findings:r})]}),o.length>0&&m.jsxs(yt,{children:[m.jsxs(wr,{size:"small","aria-expanded":t,onClick:()=>n(a=>!a),sx:{px:.5,color:"text.secondary"},children:[t?"Hide":"Show"," ",o.length," ",o.length===1?"note":"notes"]}),t&&m.jsx(yt,{sx:{pl:.5,pt:.5},children:m.jsx(Qj,{findings:o})})]})]})}function Qj({findings:e}){return m.jsx(lr,{component:"ul",sx:{m:0,p:0,listStyle:"none",gap:.75},children:e.map((t,n)=>m.jsxs(Et,{component:"li",variant:"body2",children:[t.model&&m.jsx(yt,{component:"span",sx:{fontFamily:zo,fontSize:"0.85em",mr:1},children:t.model}),t.message]},`${t.model??""}:${t.code??""}:${n}`))})}function R0e({resourceUri:e,path:t,givens:n,onGivensChange:r,onNavigate:o,onLinkNavigate:a,height:i,maxResultSize:s,onEvent:c,chrome:f,manifestStaleTime:u}){const h=to(e),{apiClients:g}=Cr(),v=h.environmentName??"",b=h.packageName??"",S=h.versionId,w=!!h.environmentName&&!!h.packageName,{data:x,isSuccess:R,isError:k,error:T}=ko({...rye(g,{environmentName:v,packageName:b,path:t,versionId:S},u),enabled:w&&t!==""}),$=x?.layout,A=oae({path:t,layout:$},c),z=`${e}|${t}`,j=C.useRef(void 0),B=C.useRef({key:z,at:hd()});B.current.key!==z&&(B.current={key:z,at:hd()}),C.useEffect(()=>{j.current!==z&&(w?k?(j.current=z,A.emit({type:"report.load_failed",surface:"view",category:Qb(T)})):x?.notebook?.format==="malloynb"?(j.current=z,A.emit({type:"report.load_failed",surface:"view",category:"unsupported"})):R&&x&&(j.current=z,A.emit({type:"report.opened",surface:"view",from:"package",tiles:x.tiles?.length??0,durationMs:hd()-B.current.at})):(j.current=z,A.emit({type:"report.load_failed",surface:"view",category:"invalid"})))},[z,w,k,T,R,x,A]);const L=C.useCallback((N,D)=>{const V=o?.(N,D);V&&A.emit({type:"report.drill",to:"report",outcome:V})},[o,A]),F=o?L:void 0;if(!w)return m.jsxs(pa,{severity:"error",children:["A report resource URI must name an environment and a package. Received: ",e]});if(k)return m.jsx(Ma,{context:`${v} > ${b} > ${t}`,error:T});if(!R||!x)return m.jsx(ya,{text:Np.opening("report")});if(x.notebook?.format==="malloynb")return m.jsxs(pa,{severity:"info",children:[t," is a .malloynb notebook, which Report does not run: render it with Notebook."]});const E=m.jsx(TF,{manifest:x,environmentName:v,packageName:b,versionId:S,documentName:t,givens:n,onGivensChange:r,onNavigate:F,...a?{onLinkNavigate:a}:{},height:i,maxResultSize:s,chrome:f});return m.jsx(cz.Provider,{value:A,children:E})}function T0e({open:e,layout:t,kind:n,allowLayoutChange:r,allowKindChange:o,environmentName:a,packageName:i,versionId:s,models:c,modelsLoading:f=!1,modelsError:u,onRetryModels:h,target:g,savedAs:v,onClose:b,onCreated:S,onEvent:w}){const x=t??(n?vF(n):"linear"),R=r??o??!0,[k,T]=C.useState(x),[$,A]=C.useState(void 0),[z,j]=C.useState(""),[B,L]=C.useState(""),[F,E]=C.useState(""),N=C.useRef(null),[D,V]=C.useState(""),[I,W]=C.useState(!1),[X,ie]=C.useState(!1),[G,ee]=C.useState(!1),[se,Y]=C.useState(void 0),ae=u!=null,{choices:J,isLoading:re,isSuccess:te,failed:oe,retry:ce,canRetry:me}=tye({environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},models:c,enabled:e&&c.length>0}),pe=C.useMemo(()=>J.get(z)??[],[J,z]),ye=C.useMemo(()=>new Map([...J.entries()].flatMap(([lt,Lt])=>Lt.map(en=>[Pw(lt,en.source,en.view),{model:lt,source:en.source,view:en.view}]))),[J]),ue=C.useMemo(()=>{const lt=J.size>1;return[...J.entries()].flatMap(([Lt,en])=>{const xn=new Map;for(const Tn of en)xn.set(Tn.source,[...xn.get(Tn.source)??[],Tn]);return[...xn.entries()].map(([Tn,Fn])=>({key:`${Lt}::${Tn}`,label:Tn,ariaLabel:`${Tn} in ${Lt}`,...lt||Fn[0]?.sourceDescription?{detail:[lt?Lt:void 0,Fn[0]?.sourceDescription].filter(Boolean).join(" · ")}:{},entries:Fn.map(Wt=>({key:Pw(Lt,Wt.source,Wt.view),name:Wt.view,title:Wt.description??mw(Wt.view),...Wt.chart?{chart:Wt.chart}:{}}))}))})},[J]),Se=lt=>{const Lt=ye.get(lt);Lt&&(j(Lt.model),L(`${Lt.source}::${Lt.view}`))},Ue=pe.find(lt=>`${lt.source}::${lt.view}`===B),je=Ue?Pw(z,Ue.source,Ue.view):void 0,Re=M0e(Ue,250);C.useEffect(()=>{e&&T(x)},[e,x]),C.useEffect(()=>{if(!e)return;const lt=[...J.keys()];z===""&<.length>0&&j(lt[0])},[e,J,z]),C.useEffect(()=>{!e||pe.length===0||B!==""||L(`${pe[0].source}::${pe[0].view}`)},[e,pe,B]),C.useEffect(()=>{!e||I||Ue===void 0||V(mw(Ue.view))},[e,I,Ue]),C.useEffect(()=>{e||(j(""),L(""),E(""),V(""),W(!1),A(void 0),ie(!1),Y(void 0))},[e]);const de=C.useMemo(()=>{if(D.trim()!=="")for(let lt=1;lt<=jR;lt++){const Lt=dF(D,lt);if(!g.existing?.includes(Lt))return Lt}},[D,g]),tt=$?.trim(),Ne=tt===void 0||tt===""?void 0:tt.endsWith(".malloy")?tt:`${tt}.malloy`,Qe=Ne??de,nt=Ne===void 0?void 0:fF(Ne)??(g.existing?.includes(Ne)?`${Ne} already exists; choose another location.`:void 0),Ft=(Ue===void 0?void 0:AR({title:D,modelPath:z,source:Ue.source,view:Ue.view}))??(D.trim()!==""&&Qe===void 0?"No free file name for this title; choose another.":void 0),_t=Ft!==void 0&&(X||D.trim()!==""),rt=f||re,{theme:Je}=eo(),dt=Je.ui,Ie=Nd(Je.cardBorder),ve=J.size===0&&(ae||oe.length>0),He=rt?"Loading model views":ve?"Couldn't read the model views to start from":J.size===0?"No model view to start from yet":Ue===void 0?"Pick a view to start from":void 0,Me="report",Ct=G?`Creating ${Me}…`:`Create ${Me}`,kt=B!==""&&Ue===void 0&&pe.length>0,bt=async()=>{if(!(He!==void 0||Ue===void 0||G)){if(Ft!==void 0||nt!==void 0){ie(!0);return}ee(!0),Y(void 0);try{const lt=await Yge({layout:k,...Ne!==void 0?{path:Ne}:{},document:{title:D,modelPath:z,source:Ue.source,view:Ue.view},target:g,...w?{onEvent:w}:{}});S(lt)}catch(lt){const Lt=lt.response?.data?.message;Y(Lt??(lt instanceof Error?lt.message:String(lt)))}finally{ee(!1)}}},it=lt=>m.jsx(wr,{color:"inherit",size:"small",onClick:lt,children:"Retry"});return m.jsx(Xo,{className:`${ul.dialog} ${ul.newReportDialog}`,maxWidth:"md",initialFocus:N,open:e,onClose:G?()=>{}:b,title:`New ${Me}`,description:"A report is a Malloy file in the package that lays out text and queries. Pick the view its first query shows; the rest is the builder.",actions:m.jsxs(m.Fragment,{children:[m.jsx(wr,{onClick:b,disabled:G,children:"Cancel"}),m.jsx(ga,{title:G?"":He??"",children:m.jsx("span",{children:m.jsx(wr,{variant:"contained",disabled:G||He!==void 0,"aria-label":!G&&He!==void 0?`${Ct}: ${He}`:Ct,onClick:()=>void bt(),children:Ct})})})]}),children:m.jsxs(lr,{sx:{gap:1.5},children:[ae?m.jsx(pa,{severity:"error",action:h&&P5(u)?it(h):void 0,children:"Couldn't read this package's models, so no view is listed to start from."}):c.length===0?!f&&m.jsxs(pa,{severity:"info",children:["This package has no models yet. Add a .malloy file that declares a source with a view, then create a ",Me," from it."]}):oe.length>0?m.jsxs(pa,{severity:"warning",action:me?it(ce):void 0,children:["Couldn't read ",oe.join(", "),", so"," ",oe.length===1?"its":"their"," views aren't listed."]}):te&&J.size===0&&m.jsxs(pa,{severity:"info",children:["A ",Me," starts from a view of a source, and no model in this package declares one yet. Add a view to a source in a model file and this list fills in."]}),m.jsxs(yt,{sx:{mx:-3,mb:-1,borderTop:`1px solid ${Ie}`,borderBottom:`1px solid ${Ie}`,display:"grid",gridTemplateColumns:{xs:"1fr",md:"320px minmax(0, 1fr)"},height:{md:500}},children:[m.jsx(yt,{sx:{display:"flex",flexDirection:"column",minHeight:0,borderRight:{md:`1px solid ${Ie}`},maxHeight:{xs:280,md:"none"}},children:m.jsx(Voe,{groups:ue,query:F,onQuery:E,picked:je,onPick:Se,onTake:lt=>{Se(lt)},searchRef:N,disabled:G,empty:m.jsx(Et,{variant:"body2",sx:{color:"text.secondary",p:2},children:rt?"Reading the package's models…":"No view to start from."})})}),m.jsxs(yt,{sx:lt=>({p:2.5,display:"flex",flexDirection:"column",gap:2,minHeight:0,overflowY:"auto",bgcolor:`color-mix(in srgb, ${lt.palette.text.primary} 3%, ${lt.palette.background.paper})`}),children:[R&&m.jsxs(yt,{children:[m.jsx(Zj,{children:"Layout"}),m.jsx(yt,{role:"radiogroup","aria-label":"Layout",sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:["linear","grid"].map(lt=>m.jsx(P0e,{layout:lt,checked:k===lt,disabled:G,onPick:()=>T(lt)},lt))}),m.jsx(Et,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"Switch it any time in the builder."})]}),m.jsxs(yt,{children:[m.jsx(Zj,{children:"First query"}),m.jsx(yt,{role:"region","aria-label":"Preview",sx:lt=>({height:200,display:"flex",position:"relative",overflow:"hidden",borderRadius:dt.radius.tile,border:`1px solid ${Ie}`,bgcolor:lt.palette.background.paper,"&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:40,pointerEvents:"none",background:`linear-gradient(to bottom, transparent, ${lt.palette.background.paper})`}}),children:Ue&&Re?m.jsx(yt,{sx:{flex:1,minWidth:0,px:2,pt:1.5},children:m.jsx(CF,{environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},modelPath:z,tile:`${Re.source} -> ${Re.view}`,label:D.trim()||mw(Re.view),borderless:!0,givens:O0e,declaredTypes:$0e,height:180})}):m.jsx(Et,{variant:"body2",sx:{color:"text.secondary",m:"auto"},children:kt?"The view you picked is no longer in this model; pick another.":"Pick a view to start from."})}),m.jsx(Et,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"More are added in the builder."})]}),m.jsx(_a,{size:"small",label:"Title",value:D,disabled:G,onChange:lt=>{W(!0),V(lt.target.value)},InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Report title"},error:_t,helperText:_t?Ft:g.route==="package"?"Names the file too, unless you type a location.":v??`Saved as a new ${Me} in the host's store, and opened in the builder.`}),m.jsx(_a,{size:"small",label:"Location",value:$??de??"",placeholder:"report.malloy",disabled:G,onChange:lt=>A(lt.target.value),InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Location"},error:nt!==void 0,helperText:nt??(Qe?`Written as ${Qe} in the package, and opened in the builder.`:"A path in the package; the package root by default.")}),se&&m.jsx(pa,{severity:"error",children:se})]})]})]})})}function M0e(e,t){const[n,r]=C.useState(void 0);return C.useEffect(()=>{const o=window.setTimeout(()=>r(e),t);return()=>window.clearTimeout(o)},[e,t]),n}const Pw=(e,t,n)=>`${e}::${t}::${n}`,O0e=new Map,$0e=new Map;function Zj({children:e}){const t=eo().theme.ui;return m.jsx(Et,{component:"div",sx:{...t.type.label,color:"text.secondary",mb:.75},children:e})}function P0e({layout:e,checked:t,disabled:n,onPick:r}){const{theme:o}=eo(),a=o.ui,i=Nd(o.cardBorder),s=t?o.accent:"currentColor";return m.jsxs(ll,{role:"radio","aria-checked":t,"aria-label":e==="linear"?"Linear":"Grid",disabled:n,onClick:r,sx:c=>({justifyContent:"flex-start",gap:1.25,px:1.25,py:1,borderRadius:a.radius.tile,border:`1px solid ${t?o.accent:i}`,boxShadow:t?`0 0 0 1px ${o.accent}`:"none",bgcolor:t?`color-mix(in srgb, ${o.accent} 6%, ${c.palette.background.paper})`:c.palette.background.paper,color:c.palette.text.secondary,textAlign:"left"}),children:[m.jsx("svg",{width:"34",height:"26",viewBox:"0 0 34 26","aria-hidden":!0,children:e==="linear"?m.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[m.jsx("rect",{x:"3",y:"2",width:"28",height:"7",rx:"1.5"}),m.jsx("rect",{x:"3",y:"12",width:"28",height:"5",rx:"1.5"}),m.jsx("path",{d:"M5 21.5h20",strokeLinecap:"round"})]}):m.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[m.jsx("rect",{x:"2",y:"2",width:"14",height:"10",rx:"1.5"}),m.jsx("rect",{x:"18",y:"2",width:"14",height:"10",rx:"1.5"}),m.jsx("rect",{x:"2",y:"14",width:"30",height:"10",rx:"1.5"})]})}),m.jsxs(yt,{children:[m.jsx(yt,{sx:{...a.type.control,fontWeight:t?a.type.label.fontWeight:500,color:t?o.accent:"text.primary"},children:e==="linear"?"Linear":"Grid"}),m.jsx(yt,{sx:{...a.type.caption,color:"text.secondary"},children:e==="linear"?"Read top to bottom":"Tiles side by side"})]})]})}const A0e=jn(m.jsx("path",{d:"M21 11h-1.5v-.5h-2v3h2V13H21v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1zM8 10v5H6.5v-1.5h-2V15H3v-5c0-.55.45-1 1-1h3c.55 0 1 .45 1 1m-1.5.5h-2V12h2zm7 1.5c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1h-4V9h4c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1M11 10.5v.75h2v-.75zm2 2.25h-2v.75h2z"})),D0e=jn(m.jsx("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V10h16zm0-13H4V5h16z"})),j0e=jn(m.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),N0e=jn(m.jsx("path",{d:"M4 7v2c0 .55-.45 1-1 1H2v4h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h3v-2H7c-.55 0-1-.45-1-1v-2c0-1.3-.84-2.42-2-2.83v-.34C5.16 11.42 6 10.3 6 9V7c0-.55.45-1 1-1h3V4H7C5.35 4 4 5.35 4 7m17 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-3v2h3c.55 0 1 .45 1 1v2c0 1.3.84 2.42 2 2.83v.34c-1.16.41-2 1.52-2 2.83v2c0 .55-.45 1-1 1h-3v2h3c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-4z"})),I0e=jn(m.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"})),L0e=jn(m.jsx("path",{d:"M20 10V8h-4V4h-2v4h-4V4H8v4H4v2h4v4H4v2h4v4h2v-4h4v4h2v-4h4v-2h-4v-4zm-6 4h-4v-4h4z"})),z0e=jn(m.jsx("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6m0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4m0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),F0e=jn(m.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"})),XF={dashboard:qr.blue,report:qr.violet,model:qr.cyan,dataApp:qr.pink,data:qr.lime,materialization:qr.amber,agent:qr.red};function QF({type:e,size:t=18,sx:n,...r}){return m.jsx(Xb,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:_0e[e]()})}const _0e={report:B0e,model:U0e,data:V0e,materialization:H0e,dataApp:Y0e,dashboard:q0e,agent:W0e};function B0e(){return m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M14 3 H6 a2 2 0 0 0 -2 2 v14 a2 2 0 0 0 2 2 h12 a2 2 0 0 0 2 -2 V9 z"}),m.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),m.jsx("path",{d:"M8 17 v-3"}),m.jsx("path",{d:"M12 17 v-6"}),m.jsx("path",{d:"M16 17 v-4"})]})}function U0e(){return m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),m.jsx("path",{d:"M4 7 l8 4 l8 -4"}),m.jsx("path",{d:"M12 11 v10"})]})}function V0e(){return m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),m.jsx("path",{d:"M3.5 9.5 H20.5"}),m.jsx("path",{d:"M9.5 3.5 V20.5"})]})}function H0e(){return m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M12 3 L21 7.5 L12 12 L3 7.5 Z"}),m.jsx("path",{d:"M3 12 L12 16.5 L21 12"}),m.jsx("path",{d:"M3 16.5 L12 21 L21 16.5"})]})}function q0e(){return m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),m.jsx("path",{d:"M3.5 9.5 H20.5"}),m.jsx("path",{d:"M12 9.5 V20.5"}),m.jsx("path",{d:"M12 15 H20.5"})]})}function W0e(){return m.jsxs(m.Fragment,{children:[m.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),m.jsx("path",{d:"M5 20 a7 7 0 0 1 14 0"})]})}function Y0e(){return m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),m.jsx("path",{d:"M3.5 9.5 H20.5"}),m.jsx("path",{d:"M7 13.5 H17"}),m.jsx("path",{d:"M7 16.5 H13"})]})}function ZF(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 G0e=12;function K0e(e){const t=e?.trim().toLowerCase()??"";if(t.startsWith("array")||t.endsWith("[]"))return j0e;if(t.startsWith("record")||t.startsWith("struct"))return N0e;switch(t.split(/[\s(<]/)[0]){case"string":return A0e;case"number":return L0e;case"date":return D0e;case"timestamp":case"timestamptz":return I0e;case"boolean":return z0e;default:return F0e}}function X0e({column:e}){const t=K0e(e.type);return m.jsxs(yt,{component:"li",sx:n=>({display:"flex",alignItems:"center",gap:1.25,px:1,py:.625,borderRadius:1,transition:"background-color 0.1s","&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.06)":n.palette.grey[100]}}),children:[m.jsx(t,{"aria-hidden":!0,sx:{fontSize:18,color:"primary.main",flexShrink:0}}),m.jsxs(yt,{sx:{display:"flex",alignItems:"baseline",gap:1,minWidth:0,flex:1},children:[m.jsx(Et,{component:"span",sx:{fontFamily:zo,fontSize:"0.8125rem",fontWeight:500,color:"text.primary",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),e.type&&m.jsx(Et,{component:"span",variant:"caption",color:"text.secondary",sx:{flexShrink:0,maxWidth:"50%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.type})]})]})}function Q0e({database:e,onClose:t}){const n=e!==null,[r,o]=C.useState(e);e!==null&&e!==r&&o(e);const[a,i]=C.useState(""),[s,c]=C.useState(r?.path);s!==r?.path&&(c(r?.path),i(""));const f=C.useId(),u=r?.path??"",h=u.split("/").pop()||u,g=u.slice(0,Math.max(0,u.length-h.length-1)),v=r?.info?.rowCount,b=[g,v===void 0?null:ZF(v)].filter(Boolean).join(" · "),S=C.useMemo(()=>r?.info?.columns??[],[r]),w=a.trim().toLowerCase(),x=C.useMemo(()=>w?S.filter(R=>R.name?.toLowerCase().includes(w)||R.type?.toLowerCase().includes(w)):S,[S,w]);return m.jsxs(Xo,{open:n,onClose:t,showClose:!0,title:m.jsxs(lr,{direction:"row",alignItems:"center",spacing:1.5,sx:{minWidth:0},children:[m.jsx(yt,{"aria-hidden":!0,sx:{width:32,height:32,borderRadius:1,bgcolor:XF.data,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:m.jsx(QF,{type:"data",size:18})}),m.jsxs(yt,{sx:{minWidth:0},children:[m.jsx(Et,{component:"span",noWrap:!0,title:u,sx:{display:"block",fontFamily:zo,fontSize:"1rem",fontWeight:600,letterSpacing:0,lineHeight:1.4},children:h||"Columns"}),b&&m.jsx(Et,{component:"span",variant:"caption",color:"text.secondary",noWrap:!0,sx:{display:"block",lineHeight:1.4},children:b})]})]}),children:[r?.error&&m.jsx(pa,{severity:"error",variant:"outlined",children:r.error}),r&&!r.error&&m.jsxs(yt,{component:"section","aria-labelledby":f,sx:{display:"flex",flexDirection:"column",border:"1px solid",borderColor:"divider",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",mb:2},children:[m.jsxs(lr,{direction:"row",alignItems:"center",spacing:1,sx:{px:1.5,py:1,minHeight:44,borderBottom:"1px solid",borderColor:"divider"},children:[m.jsxs(Et,{id:f,component:"h3",sx:{fontSize:"0.875rem",fontWeight:600},children:["Columns",m.jsxs(Et,{component:"span",variant:"caption",color:"text.secondary",sx:{ml:.75,fontVariantNumeric:"tabular-nums"},children:["· ",w?`${x.length} of `:"",S.length]})]}),S.length>G0e&&m.jsx(q0,{value:a,onChange:R=>i(R.target.value),placeholder:"Filter columns",inputProps:{"aria-label":"Filter columns"},startAdornment:m.jsx(pE,{position:"start",children:m.jsx(Rp,{sx:{fontSize:16,color:"text.secondary"}})}),sx:{ml:"auto !important",width:200,fontSize:"0.8125rem",px:1,py:.25,border:"1px solid",borderColor:"divider",borderRadius:1.5,"&.Mui-focused":{borderColor:"primary.main"}}})]}),m.jsx(yt,{sx:{overflowY:"auto",maxHeight:420,px:.75,py:.75},children:x.length===0?m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic",px:1,py:1},children:w?"No columns match":"No columns"}):m.jsx(yt,{component:"ul","aria-labelledby":f,sx:{listStyle:"none",m:0,p:0},children:x.map((R,k)=>m.jsx(X0e,{column:R},`${R.name}-${k}`))})})]})]})}const Z0e="README.malloynb",J0e=e=>!!e&&!e.includes("/")&&Fx(e)?.toLowerCase()==="readme";function xSe({onClickPackageFile:e,onOpenDocument:t,resourceUri:n,onEvent:r}){const{apiClients:o,server:a,mutable:i}=Cr(),s=Dd(),c=e??(oe=>{window.location.href=oe}),{environmentName:f,packageName:u,versionId:h}=to(n),g=t??((oe,ce)=>{const me=oe.mode==="edit"?sye(f,u,oe.path):bF(f,u,oe.path);ce?c(me,ce):c(me)}),[v,b]=C.useState(null),[S,w]=C.useState(!1),x=Tye(),R=yF()?.documentStorage,[k,T]=C.useState([]),[$,A]=C.useState({state:R?"pending":"ready"}),z=C.useCallback(async()=>{if(!R)return;let oe;try{oe=await R.listWorkspaces(!1)}catch{A({state:"failed"});return}A({state:"ready",chosen:iF(oe)});const ce=[],me=Bg(f,u,"");for(const pe of oe.filter(ye=>ye.writeable))for(const ye of await R.listDocuments(pe))ye.path.startsWith(me)&&ce.push({locator:ye,where:pe.description});T(ce)},[R,f,u]);C.useEffect(()=>{z()},[z]);const j=oe=>oe.path.slice(Bg(f,u,"").length),B=ko({queryKey:["package",f,u,h],queryFn:()=>o.packages.getPackage(f,u,h,!1)}),L=hye(f,u,h),F=ko({queryKey:["models",f,u,h],queryFn:()=>o.models.listModels(f,u,h)}),E=ko({queryKey:["databases",f,u,h],queryFn:()=>o.databases.listDatabases(f,u,h)}),N=ko({queryKey:["data-apps",f,u],queryFn:async()=>{try{return await o.dataApps.listDataApps(f,u)}catch(oe){const ce=oe?.response?.status;if(ce===404||ce===void 0)return{data:[]};throw oe}}}).data?.data??[],D=L.reports.filter(oe=>!!oe.path),V=txe(D),I=new Set(D.map(oe=>oe.path).filter(oe=>oe!==void 0)),W=(F.data?.data??[]).slice().filter(oe=>!I.has(oe.path)).sort((oe,ce)=>oe.path.localeCompare(ce.path)),X=(E.data?.data??[]).slice().sort((oe,ce)=>oe.path.localeCompare(ce.path)),ie=$.state==="ready"?Wge({authoritative:$.chosen?.authoritative===!0,mutable:i,canStore:$.chosen?.writeable===!0,...h===void 0?{}:{versionId:h}}):void 0,G=L.settled&&(F.isSuccess||F.isError),ee=ie!==void 0&&G,se=ee&&!x,Y=C.useMemo(()=>{if(!ee)return;const oe=[...L.reports.flatMap(ce=>ce.path?[ce.path]:[]),...(F.data?.data??[]).flatMap(ce=>ce.path?[ce.path]:[])];if(ie==="storage"&&R&&$.state==="ready")return $.chosen?{route:ie,storage:R,workspace:$.chosen,environmentName:f,packageName:u,existing:oe}:void 0;if(ie==="package")return{route:ie,existing:oe,write:async(ce,me)=>{await o.models.updateModelSource(f,u,ce,{source:me})}}},[ee,ie,R,$,f,u,o,L.reports,F.data]),ae=B.data?.data?.description??"",J=B.data?.data?.agents??[],re=(D.find(oe=>oe.path===Z0e)??D.find(oe=>J0e(oe.path)))?.path,te=!L.settled;return B.isError?m.jsx(Ma,{error:B.error,context:`${f} > ${u}`}):m.jsxs(cE,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[m.jsxs(yt,{sx:{mb:4},children:[m.jsx(Et,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:u}),ae&&m.jsx(Et,{variant:"body2",color:"text.secondary",children:ae})]}),m.jsx(E0e,{warnings:B.data?.data?.warnings}),te&&m.jsx(ya,{text:"Loading package..."}),Y&&m.jsx(T0e,{open:S,layout:"linear",environmentName:f,packageName:u,...h!==void 0?{versionId:h}:{},models:W.map(oe=>oe.path).filter(oe=>typeof oe=="string"&&oe.endsWith(".malloy")&&!I.has(oe)),modelsLoading:F.isPending,...F.isError?{modelsError:F.error}:{},onRetryModels:()=>void F.refetch(),target:Y,...r?{onEvent:r}:{},onClose:()=>w(!1),onCreated:oe=>{w(!1),dye(s,f,u),s.invalidateQueries({queryKey:["models"]}),g({path:oe.path,layout:oe.layout,slug:oe.slug,mode:"edit"})}}),!te&&m.jsxs(m.Fragment,{children:[L.isError&&m.jsx(yt,{sx:{mb:4},children:m.jsx(pa,{severity:"warning",action:m.jsx(wr,{color:"inherit",size:"small",onClick:()=>void L.refetch(),children:"Retry"}),children:"Could not list this package's reports, so any it has are missing from this page."})}),(V.length>0||ee)&&m.jsxs(Ts,{title:"Reports",count:V.length,...se?{action:m.jsx(dy,{label:"Report",onClick:()=>w(!0)})}:{},children:[V.length===0&&m.jsx(Aw,{label:"No reports yet",...se?{action:{label:"Add report",onClick:()=>w(!0)}}:{}}),V.map(oe=>m.jsx(tp,{type:oe.layout==="grid"?"dashboard":"report",label:oe.label,rightLabel:oe.layout,...oe.secondary===void 0?{}:{description:oe.secondary},onClick:ce=>oe.path.endsWith(".malloynb")?c(`/${f}/${u}/${oe.path}`,ce):g({path:oe.path,layout:oe.layout,slug:oe.slug,mode:"view"},ce)},oe.path))]}),k.length>0&&m.jsx(Ts,{title:"Drafts",count:k.length,children:k.map(({locator:oe,where:ce})=>m.jsx(tp,{type:oe.type==="grid"?"dashboard":"report",label:j(oe),rightLabel:ce,onClick:me=>g({path:j(oe),layout:oe.type,slug:Fx(j(oe))??"",mode:"edit"},me),trailingAction:m.jsx(ga,{title:"Delete this draft",children:m.jsx(Eo,{size:"small","aria-label":`Delete draft ${j(oe)}`,onClick:me=>{me.stopPropagation(),R?.deleteDocument(oe).then(z)},children:m.jsx(qoe,{fontSize:"small"})})})},`${oe.workspace}:${oe.path}`))}),N.length>0&&m.jsx(Ts,{title:"Apps",count:N.length,children:N.map(oe=>{const ce=!!oe.title&&oe.title!==oe.path,me=`${OF(a)}${oe.resource}`;return m.jsx(tp,{type:"dataApp",label:ce?oe.title:oe.path,rightLabel:ce?oe.path:void 0,onClick:pe=>{e?e(`/${f}/${u}/data-apps/${oe.path}`,pe):pe&&(pe.metaKey||pe.ctrlKey)?window.open(me,"_blank"):window.location.href=me},trailingAction:m.jsx(ga,{title:"Open standalone in new tab",children:m.jsx(Eo,{size:"small",href:me,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",onClick:pe=>pe.stopPropagation(),sx:{color:"text.secondary"},children:m.jsx(MF,{fontSize:"small"})})})},oe.path)})}),m.jsxs(Ts,{title:"Models",count:W.length,children:[W.map(oe=>m.jsx(tp,{type:"model",label:oe.path,onClick:ce=>c(`/${f}/${u}/${oe.path}`,ce)},oe.path)),W.length===0&&m.jsx(Aw,{label:"No models"})]}),J.length>0&&m.jsx(Ts,{title:"Agents",count:J.length,description:"Declared in publisher.json. Name one in an agent session to work as it. Schedules are listed only; nothing runs them yet.",children:J.map(oe=>m.jsx(exe,{agent:oe},oe.name))}),m.jsxs(Ts,{title:"Data",count:X.length,children:[X.map(oe=>m.jsx(tp,{type:"data",label:oe.path,rightLabel:oe.info?ZF(oe.info.rowCount):"Unreadable",onClick:()=>b(oe)},oe.path)),X.length===0&&m.jsx(Aw,{label:"No data files"})]}),m.jsx(d0e,{resourceUri:n}),re&&m.jsx(yt,{sx:{mt:6},children:m.jsx(R0e,{resourceUri:Lx({environmentName:f,packageName:u,versionId:h}),path:re,onLinkNavigate:c})})]}),m.jsx(Q0e,{database:v,onClose:()=>b(null)})]})}function tp({type:e,label:t,description:n,rightLabel:r,onClick:o,trailingAction:a}){return m.jsx(_x,{icon:m.jsx(QF,{type:e}),tint:XF[e],label:t,mono:!0,...n===void 0?{}:{description:n},...r===void 0?{}:{rightLabel:r},...o===void 0?{}:{onClick:o},...a===void 0?{}:{trailingAction:a}})}function exe({agent:e}){return m.jsxs(m.Fragment,{children:[m.jsx(tp,{type:"agent",label:e.name??"",...e.description?{description:e.description}:{},...e.model&&e.model!=="inherit"?{rightLabel:e.model}:{}}),(e.schedules??[]).map(t=>{const n=BR(t.cron??"");return m.jsxs(Et,{variant:"caption",color:"text.secondary",sx:{display:"block",ml:6,mb:.5},children:[n.valid?n.description:t.cron," (UTC), task"," ",t.task,". Not run yet."]},`${t.cron}|${t.task}`)})]})}function txe(e){const t=e.map(r=>({path:r.path??"",layout:NR(r),slug:Fx(r.path)??r.path??"",title:r.title})),n=new Map;for(const r of t)n.set(r.slug,(n.get(r.slug)??0)+1);return t.map(({title:r,...o})=>{const a=!!r&&r!==o.slug&&r!==o.path,i=(n.get(o.slug)??0)>1,s=a?r:o.path.endsWith(".malloynb")?o.path:o.slug;return{...o,label:s,secondary:s!==o.path&&(a||i||o.path.includes("/"))?o.path:void 0}}).sort((r,o)=>r.label.localeCompare(o.label)||r.path.localeCompare(o.path))}function Aw({label:e,action:t}){return m.jsxs(lr,{direction:"row",sx:{alignItems:"center",gap:1,py:1},children:[m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:e}),t&&m.jsx(wr,{size:"small",onClick:t.onClick,children:t.label})]})}const Jj=/^publisher:document:(dashboard|notebook):(.+)$/;function nxe(e,t){const n=[];for(let r=0;r<e.length;r++){const o=e.key(r);o!==null&&Jj.test(o)&&n.push(o)}for(const r of n){const[,o,a]=Jj.exec(r),i=e.getItem(r);i!==null&&t(a,vF(o),i)&&e.removeItem(r)}}const Dw={name:"Local",description:"Stored in this browser only",writeable:!0},hk="publisher:report:",Qu=e=>`${hk}${e}`;function Vm(e){const t=localStorage.getItem(e);if(t!==null)try{const n=JSON.parse(t);if(typeof n.content=="string"&&(n.type==="grid"||n.type==="linear"))return{type:n.type,content:n.content}}catch{}}const jw=(e,t)=>localStorage.setItem(Qu(e),JSON.stringify(t));class rxe{migrated=!1;migrate(){this.migrated||(this.migrated=!0,nxe(localStorage,(t,n,r)=>Vm(Qu(t))!==void 0?!1:(jw(t,{type:n,content:r}),!0)))}async listWorkspaces(t){return[Dw]}async listDocuments(t,n){if(t.name!==Dw.name)return[];this.migrate();const r=[];for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o);if(a===null||!a.startsWith(hk))continue;const i=Vm(a);i&&(n===void 0||i.type===n)&&r.push({workspace:Dw.name,type:i.type,path:a.slice(hk.length)})}return r}async getDocument(t){this.migrate();const n=Vm(Qu(t.path));if(n===void 0)throw Nw(t);return n.content}async getDocumentType(t){this.migrate();const n=Vm(Qu(t.path));if(n===void 0)throw Nw(t);return n.type}async saveDocument(t,n){this.migrate(),jw(t.path,{type:t.type,content:n})}async deleteDocument(t){if(this.migrate(),Vm(Qu(t.path))===void 0)throw Nw(t);localStorage.removeItem(Qu(t.path))}async moveDocument(t,n){const r=await this.getDocument(t);jw(n.path,{type:n.type,content:r}),n.path!==t.path&&localStorage.removeItem(Qu(t.path))}}function Nw(e){return new sF(`No report at ${e.workspace}/${e.path}`)}async function oxe(e,t,n,r){const o=iF(await e.listWorkspaces(!1));if(!o)return;const a=Bg(t,n,r);if(e.getDocumentType)try{return await e.getDocumentType({workspace:o.name,path:a})}catch(i){if(lF(i))return;throw i}return(await e.listDocuments(o)).find(i=>i.path===a)?.type}function SSe(e,t,n,r=!0){const o=yF()?.documentStorage,a=r&&o!==void 0,[i,s]=C.useState(),c=Bg(e,t,n);return C.useEffect(()=>{if(!a||!o)return;let f=!1;return oxe(o,e,t,n).catch(()=>{}).then(u=>{f||s({key:c,layout:u})}),()=>{f=!0}},[a,o,e,t,n,c]),a?i?.key===c?{layout:i.layout,settled:!0}:{layout:void 0,settled:!1}:{layout:void 0,settled:!0}}function axe(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 ixe=400;function sxe(e){return e.type==="code"}function lxe(e){return(e.text??"").split(`
|
|
479
|
+
`);qF(k,"typescript",R).then(T=>{i(T)})}},[t,R]),m.jsxs(yt,{children:[a&&m.jsx(yt,{sx:{marginBottom:"16px"},children:m.jsx(Et,{fontSize:"12px",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},children:m.jsx("div",{className:"content",dangerouslySetInnerHTML:{__html:a}})})}),m.jsxs(yt,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[m.jsx(Et,{variant:"body2",sx:{fontSize:"15px",fontWeight:600,color:"text.primary",px:2,py:1,bgcolor:"action.hover",borderRadius:1.5,border:1,borderColor:"divider"},children:e}),m.jsx(gp,{"aria-label":"Expand results",onClick:()=>c(!0),children:m.jsx(Rp,{})})]}),m.jsxs(m5,{sx:{position:"relative"},children:[r&&!f&&m.jsxs(yt,{sx:{padding:"40px 20px",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[m.jsx(Et,{variant:"body2",color:"text.secondary",children:"Click Run to execute the query"}),m.jsx(wr,{variant:"contained",startIcon:m.jsx(f0e,{}),onClick:()=>u(!0),children:"Run Query"})]}),S&&m.jsx($R,{state:w,context:e,maxHeight:uge,maxResultSize:o})]}),m.jsx(WF,{open:s,onClose:()=>c(!1),result:x?.data?.result||"",renderLogs:x?.data?.renderLogs,title:`Query: ${e}`})]})}function b0e(e){return e!=null}function x0e(e,t){const n=[],r=[];for(const a of e){if(a.name===void 0||b0e(t.get(a.name)))continue;if(a.default==null){n.push(a.name);continue}const i=RR(a.type??"string",a.default);i&&r.push(`${a.name} = ${i}`)}const o={missing:n};return r.length>0&&(o.defaultsNote=r.length===1?`Ran with the default ${r[0]}`:`Ran with defaults ${r.join(", ")}`),o}function S0e(e){return e.length===1?`This source may need a value for the given ${e[0]}. Set it in the parameters above.`:`This source may need values for the givens ${e.join(", ")}. Set them in the parameters above.`}function w0e({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a,givens:i,gate:s}){return mn.useEffect(()=>{o&&o(t)},[t,o]),m.jsx(h5,{children:m.jsxs(dq,{spacing:2,component:"section",children:[m.jsx(k0e,{sourceAndPath:e[t],existingQuery:n,onChange:c=>{r&&r(c)},resourceUri:a,givens:i,gate:s}),m.jsx(cI,{height:"5px"})]})})}function $w(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function C0e({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a,givens:i,gate:s}){const[c,f]=mn.useState(n||$w()),[u,h]=mn.useState(void 0);mn.useEffect(()=>{n&&f(n)},[n]);const[g,v]=mn.useState([]),{MalloyExplorerProvider:b,QueryPanel:S,ResizableCollapsiblePanel:w,ResultPanel:x,SourcePanel:R}=r;mn.useEffect(()=>{t&&t(c)},[t,c]);const{environmentName:k,packageName:T,versionId:$}=to(a),{apiClients:A}=Cr(),z=mn.useRef(void 0),j=rl({mutationFn:()=>{z.current=s,h({executionState:"running",query:c?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{j.reset(),h(void 0)},response:{}});const E=typeof c?.malloyQuery=="string"?c.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:c?.malloyQuery}).toMalloy();return f({...c,query:E}),A.models.executeQueryModel(k,T,e.modelPath,{query:E,sourceName:void 0,queryName:void 0,versionId:$,...i&&Object.keys(i).length>0?{givens:i}:{}})},onSuccess:E=>{if(E){const N=JSON.parse(E.data.result);f({...c,malloyResult:N});const D=z.current;h(V=>V?{...V,executionState:"finished",response:{result:N,...D?.defaultsNote?{messages:[{severity:"INFO",title:D.defaultsNote}]}:{}}}:void 0)}},onError:E=>{console.error("Query execution error:",E);const N=E?.data?.message??E?.message??"The query could not be run.",D=[{severity:"ERROR",title:N}],V=z.current?.missing??[];(E?.status===403||/Access denied for source/i.test(N))&&V.length>0&&D.push({severity:"WARN",title:S0e(V)}),h(I=>I?{...I,executionState:"finished",response:{messages:D}}:void 0)}}),[B,L]=mn.useState(e.sourceInfo.name);mn.useEffect(()=>{B!==e.sourceInfo.name&&(L(e.sourceInfo.name),f($w()),h(void 0))},[e,B]);const F=mn.useCallback(E=>{f({...c,malloyQuery:E,malloyResult:void 0})},[c]);return B!==e.sourceInfo.name?m.jsx("div",{children:"Loading..."}):m.jsx(g5,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:m.jsx(b,{source:e.sourceInfo,query:c?.malloyQuery,topValues:[],onFocusedNestViewPathChange:v,focusedNestViewPath:g,onQueryChange:F,children:m.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[m.jsx(w,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:m.jsx(R,{onRefresh:()=>f($w())})}),m.jsx(w,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:m.jsx(S,{runQuery:()=>{console.log(`running query with: ${c?.malloyQuery}`);try{j.mutate()}catch(E){console.error("Error running query:",E)}}})}),m.jsx(x,{source:e.sourceInfo,draftQuery:c?.malloyQuery,setDraftQuery:E=>f({...c,malloyQuery:E}),submittedQuery:u,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function k0e(e){const[t,n]=C.useState(null),[r,o]=C.useState(null),[a,i]=C.useState(!0);return C.useEffect(()=>{let s=!0;return Promise.all([Co(()=>import("./index-Dnzp7ChL.js"),__vite__mapDeps([5,0,1,2,6])),jge()]).then(([c,f])=>{s&&(n(c),o(f),i(!1))}).catch(c=>{console.error("Failed to load Malloy components:",c),s&&i(!1)}),()=>{s=!1}},[]),a||!t||!r?m.jsx(RJ,{children:m.jsx(g5,{children:m.jsx(cI,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):m.jsx(C0e,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function YF(e,t=!0){const{modelPath:n,environmentName:r,packageName:o,versionId:a}=to(e),{apiClients:i}=Cr();return ko({queryKey:["package",r,o,n,a],queryFn:async()=>(await i.models.getModel(r,o,n,a)).data,enabled:t})}function GF({data:e,onChange:t,existingQuery:n,initialSelectedSourceIndex:r=0,onSourceChange:o,resourceUri:a,givens:i,onGivensChange:s,startingGivens:c}){const[f,u]=mn.useState(r);mn.useEffect(()=>{u(r)},[r]);const{data:h,isError:g,isLoading:v,error:b}=YF(a,!e),{environmentName:S,packageName:w,modelPath:x,versionId:R}=to(a),k=e||h,T=mn.useMemo(()=>k?.givens??[],[k]),$=ZE({specs:T,loaded:!!k,params:i,onGivensChange:s,startingValues:c,documentKey:a,autorun:!0,environmentName:S??"",packageName:w??"",modelPath:x,versionId:R,documentName:x}),A=C.useMemo(()=>Kp($.applied,$.declaredTypes),[$.applied,$.declaredTypes]),z=C.useMemo(()=>x0e(T,$.applied),[T,$.applied]);if(v&&!e)return m.jsx(ya,{text:"Fetching Model..."});if(g&&!e)return console.log("error",b),m.jsx(Ma,{error:b,context:`ModelExplorer > ${x}`});if(!k)return m.jsx(ya,{text:Np.loading});const j=(k?.sourceInfos||[]).map((L,F)=>{try{return JSON.parse(L)?.name||`Source ${F+1}`}catch{return`Source ${F+1}`}}),B=j[f]||"";return m.jsxs(kJ,{variant:"outlined",children:[m.jsx(EJ,{children:m.jsx(lr,{sx:{flexDirection:"row"},children:m.jsx(nbe,{size:"small",id:"size-small-standard",disablePortal:!0,options:j,value:B,onChange:(L,F)=>{if(!F)return;const E=j.indexOf(F);E>=0&&(u(E),o?.(E))},renderInput:L=>m.jsx(hr,{...L}),style:{width:350,marginTop:"3px",marginLeft:"6px",marginBottom:"8px"}})})}),m.jsx(MR,{...$.panel}),m.jsx(h5,{children:m.jsxs(lr,{spacing:2,component:"section",children:[Array.isArray(k.sourceInfos)&&k.sourceInfos.length>0&&m.jsx(w0e,{sourceAndPaths:k.sourceInfos.map(L=>({sourceInfo:JSON.parse(L),modelPath:x})),selectedSourceIndex:f,existingQuery:n,onQueryChange:t,resourceUri:a,givens:A,gate:z}),m.jsx(yt,{height:"5px"})]})})]})}function KF({open:e,onClose:t,resourceUri:n,data:r,title:o="Data Sources",hasValidImport:a=!0,existingQuery:i,initialSelectedSourceIndex:s,onChange:c,onSourceChange:f,givens:u,onGivensChange:h,startingGivens:g}){return m.jsxs(W0,{open:e,onClose:t,fullScreen:!0,children:[m.jsxs(G0,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o,m.jsx(Eo,{onClick:t,sx:{color:"text.secondary"},children:m.jsx(Gp,{})})]}),m.jsx(Y0,{children:a?m.jsx(GF,{resourceUri:n,data:r,existingQuery:i,initialSelectedSourceIndex:s,onChange:c,onSourceChange:f,givens:u,onGivensChange:h,startingGivens:g}):m.jsx("div",{children:"No valid import statement found in cell"})})]})}function bSe({onChange:e,resourceUri:t,runOnDemand:n=!1,maxResultSize:r=0,givens:o,onGivensChange:a}){const{modelPath:i}=to(t),{data:s,isError:c,isLoading:f,error:u}=YF(t),[h,g]=mn.useState(!1),[v,b]=mn.useState(),[S,w]=mn.useState(0),[x,R]=C.useState(""),[k,T]=mn.useState({}),$=o??k,A=a??(E=>T(E)),z=s?.modelDef,j=mn.useMemo(()=>{if(!z)return!1;try{const E=JSON.parse(z);return Array.isArray(E.imports)&&E.imports.length>0}catch{return!1}},[z]);if(f)return m.jsx(ya,{text:"Fetching Model..."});if(c)return console.log("error",u),m.jsx(Ma,{error:u,context:`Model > ${i}`});const B=E=>{b(E),e&&e(E)},L=E=>{w(E)},F=()=>{const E=window.location.href;navigator.clipboard.writeText(E).then(()=>R("URL copied to clipboard!")).catch(()=>R("Failed to copy URL"))};return m.jsxs(m.Fragment,{children:[m.jsxs(yt,{sx:{position:"relative",maxWidth:"1200px",margin:"0 auto",paddingTop:"24px"},children:[Array.isArray(s?.sourceInfos)&&s.sourceInfos.length>0&&m.jsxs(lr,{spacing:2,component:"section",children:[m.jsxs(yt,{sx:{padding:"0 0 16px 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[m.jsx(Et,{variant:"h1",sx:{fontSize:"28px",fontWeight:"600",color:"#1a1a1a",marginBottom:"8px",marginTop:"0",paddingLeft:"0"},children:"Sources"}),m.jsx(ga,{title:"Copy link",children:m.jsx(Eo,{size:"small","aria-label":"Copy link",onClick:F,sx:{color:"text.secondary"},children:m.jsx(HF,{fontSize:"small"})})})]}),m.jsx(GF,{data:s,onChange:B,onSourceChange:L,existingQuery:v,initialSelectedSourceIndex:S,resourceUri:t,givens:$,onGivensChange:A}),m.jsx(gp,{"aria-label":"Expand results",sx:{position:"absolute",top:"90px",right:"4px",zIndex:2},onClick:()=>g(!0),children:m.jsx(Rp,{})})]}),s?.queries?.length>0&&m.jsxs(lr,{spacing:2,component:"section",sx:{marginTop:"24px"},children:[m.jsx(yt,{sx:{padding:"0 0 16px 0"},children:m.jsx(Et,{variant:"h2",sx:{fontSize:"24px",fontWeight:"600",color:"#1a1a1a",marginBottom:"0",marginTop:"8px",paddingLeft:"0"},children:"Named Queries"})}),s.queries.map(E=>m.jsx(v0e,{queryName:E.name,annotations:E.annotations,resourceUri:t,runOnDemand:n,maxResultSize:r},E.name))]}),(!Array.isArray(s?.sourceInfos)||s.sourceInfos.length===0)&&!(s?.queries&&s.queries.length>0)&&m.jsxs(yt,{sx:{textAlign:"center",py:6},children:[m.jsx(Et,{variant:"body1",sx:{color:"text.secondary",marginBottom:"8px"},children:"This model exposes no sources or queries."}),j&&m.jsxs(Et,{variant:"body2",color:"text.secondary",children:["It imports other files but re-exports nothing. Add"," ",m.jsxs("code",{children:["export ","{ source_name }"]})," to surface imported sources here."]})]}),m.jsx(KF,{open:h,onClose:()=>g(!1),resourceUri:t,data:s,title:`Model: ${i.split("/").pop()}`,existingQuery:v,initialSelectedSourceIndex:S,onChange:B,onSourceChange:L,givens:$,onGivensChange:A})]}),m.jsx(K0,{open:x!=="",autoHideDuration:6e3,onClose:()=>R(""),message:x})]})}function E0e({warnings:e}){const[t,n]=C.useState(!1),r=(e??[]).filter(a=>a.severity==="error"),o=(e??[]).filter(a=>a.severity!=="error");return r.length===0&&o.length===0?null:m.jsxs(lr,{sx:{gap:1,mb:4},children:[r.length>0&&m.jsxs(pa,{severity:"warning",children:[m.jsx(nW,{children:r.length===1?"1 problem in this package":`${r.length} problems in this package`}),m.jsx(Qj,{findings:r})]}),o.length>0&&m.jsxs(yt,{children:[m.jsxs(wr,{size:"small","aria-expanded":t,onClick:()=>n(a=>!a),sx:{px:.5,color:"text.secondary"},children:[t?"Hide":"Show"," ",o.length," ",o.length===1?"note":"notes"]}),t&&m.jsx(yt,{sx:{pl:.5,pt:.5},children:m.jsx(Qj,{findings:o})})]})]})}function Qj({findings:e}){return m.jsx(lr,{component:"ul",sx:{m:0,p:0,listStyle:"none",gap:.75},children:e.map((t,n)=>m.jsxs(Et,{component:"li",variant:"body2",children:[t.model&&m.jsx(yt,{component:"span",sx:{fontFamily:zo,fontSize:"0.85em",mr:1},children:t.model}),t.message]},`${t.model??""}:${t.code??""}:${n}`))})}function R0e({resourceUri:e,path:t,givens:n,onGivensChange:r,onNavigate:o,onLinkNavigate:a,height:i,maxResultSize:s,onEvent:c,chrome:f,manifestStaleTime:u}){const h=to(e),{apiClients:g}=Cr(),v=h.environmentName??"",b=h.packageName??"",S=h.versionId,w=!!h.environmentName&&!!h.packageName,{data:x,isSuccess:R,isError:k,error:T}=ko({...rye(g,{environmentName:v,packageName:b,path:t,versionId:S},u),enabled:w&&t!==""}),$=x?.layout,A=oae({path:t,layout:$},c),z=`${e}|${t}`,j=C.useRef(void 0),B=C.useRef({key:z,at:hd()});B.current.key!==z&&(B.current={key:z,at:hd()}),C.useEffect(()=>{j.current!==z&&(w?k?(j.current=z,A.emit({type:"report.load_failed",surface:"view",category:Qb(T)})):x?.notebook?.format==="malloynb"?(j.current=z,A.emit({type:"report.load_failed",surface:"view",category:"unsupported"})):R&&x&&(j.current=z,A.emit({type:"report.opened",surface:"view",from:"package",tiles:x.tiles?.length??0,durationMs:hd()-B.current.at})):(j.current=z,A.emit({type:"report.load_failed",surface:"view",category:"invalid"})))},[z,w,k,T,R,x,A]);const L=C.useCallback((N,D)=>{const V=o?.(N,D);V&&A.emit({type:"report.drill",to:"report",outcome:V})},[o,A]),F=o?L:void 0;if(!w)return m.jsxs(pa,{severity:"error",children:["A report resource URI must name an environment and a package. Received: ",e]});if(k)return m.jsx(Ma,{context:`${v} > ${b} > ${t}`,error:T});if(!R||!x)return m.jsx(ya,{text:Np.opening("report")});if(x.notebook?.format==="malloynb")return m.jsxs(pa,{severity:"info",children:[t," is a .malloynb notebook, which Report does not run: render it with Notebook."]});const E=m.jsx(TF,{manifest:x,environmentName:v,packageName:b,versionId:S,documentName:t,givens:n,onGivensChange:r,onNavigate:F,...a?{onLinkNavigate:a}:{},height:i,maxResultSize:s,chrome:f});return m.jsx(cz.Provider,{value:A,children:E})}function T0e({open:e,layout:t,kind:n,allowLayoutChange:r,allowKindChange:o,environmentName:a,packageName:i,versionId:s,models:c,modelsLoading:f=!1,modelsError:u,onRetryModels:h,target:g,savedAs:v,onClose:b,onCreated:S,onEvent:w}){const x=t??(n?vF(n):"linear"),R=r??o??!0,[k,T]=C.useState(x),[$,A]=C.useState(void 0),[z,j]=C.useState(""),[B,L]=C.useState(""),[F,E]=C.useState(""),N=C.useRef(null),[D,V]=C.useState(""),[I,W]=C.useState(!1),[X,ie]=C.useState(!1),[G,ee]=C.useState(!1),[se,Y]=C.useState(void 0),ae=u!=null,{choices:J,isLoading:re,isSuccess:te,failed:oe,retry:ce,canRetry:me}=tye({environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},models:c,enabled:e&&c.length>0}),pe=C.useMemo(()=>J.get(z)??[],[J,z]),ye=C.useMemo(()=>new Map([...J.entries()].flatMap(([lt,Lt])=>Lt.map(en=>[Pw(lt,en.source,en.view),{model:lt,source:en.source,view:en.view}]))),[J]),ue=C.useMemo(()=>{const lt=J.size>1;return[...J.entries()].flatMap(([Lt,en])=>{const xn=new Map;for(const Tn of en)xn.set(Tn.source,[...xn.get(Tn.source)??[],Tn]);return[...xn.entries()].map(([Tn,Fn])=>({key:`${Lt}::${Tn}`,label:Tn,ariaLabel:`${Tn} in ${Lt}`,...lt||Fn[0]?.sourceDescription?{detail:[lt?Lt:void 0,Fn[0]?.sourceDescription].filter(Boolean).join(" · ")}:{},entries:Fn.map(Wt=>({key:Pw(Lt,Wt.source,Wt.view),name:Wt.view,title:Wt.description??mw(Wt.view),...Wt.chart?{chart:Wt.chart}:{}}))}))})},[J]),Se=lt=>{const Lt=ye.get(lt);Lt&&(j(Lt.model),L(`${Lt.source}::${Lt.view}`))},Ue=pe.find(lt=>`${lt.source}::${lt.view}`===B),je=Ue?Pw(z,Ue.source,Ue.view):void 0,Re=M0e(Ue,250);C.useEffect(()=>{e&&T(x)},[e,x]),C.useEffect(()=>{if(!e)return;const lt=[...J.keys()];z===""&<.length>0&&j(lt[0])},[e,J,z]),C.useEffect(()=>{!e||pe.length===0||B!==""||L(`${pe[0].source}::${pe[0].view}`)},[e,pe,B]),C.useEffect(()=>{!e||I||Ue===void 0||V(mw(Ue.view))},[e,I,Ue]),C.useEffect(()=>{e||(j(""),L(""),E(""),V(""),W(!1),A(void 0),ie(!1),Y(void 0))},[e]);const de=C.useMemo(()=>{if(D.trim()!=="")for(let lt=1;lt<=jR;lt++){const Lt=dF(D,lt);if(!g.existing?.includes(Lt))return Lt}},[D,g]),tt=$?.trim(),Ne=tt===void 0||tt===""?void 0:tt.endsWith(".malloy")?tt:`${tt}.malloy`,Qe=Ne??de,nt=Ne===void 0?void 0:fF(Ne)??(g.existing?.includes(Ne)?`${Ne} already exists; choose another location.`:void 0),Ft=(Ue===void 0?void 0:AR({title:D,modelPath:z,source:Ue.source,view:Ue.view}))??(D.trim()!==""&&Qe===void 0?"No free file name for this title; choose another.":void 0),_t=Ft!==void 0&&(X||D.trim()!==""),rt=f||re,{theme:Je}=eo(),dt=Je.ui,Ie=Nd(Je.cardBorder),ve=J.size===0&&(ae||oe.length>0),He=rt?"Loading model views":ve?"Couldn't read the model views to start from":J.size===0?"No model view to start from yet":Ue===void 0?"Pick a view to start from":void 0,Me="report",Ct=G?`Creating ${Me}…`:`Create ${Me}`,kt=B!==""&&Ue===void 0&&pe.length>0,bt=async()=>{if(!(He!==void 0||Ue===void 0||G)){if(Ft!==void 0||nt!==void 0){ie(!0);return}ee(!0),Y(void 0);try{const lt=await Yge({layout:k,...Ne!==void 0?{path:Ne}:{},document:{title:D,modelPath:z,source:Ue.source,view:Ue.view},target:g,...w?{onEvent:w}:{}});S(lt)}catch(lt){const Lt=lt.response?.data?.message;Y(Lt??(lt instanceof Error?lt.message:String(lt)))}finally{ee(!1)}}},it=lt=>m.jsx(wr,{color:"inherit",size:"small",onClick:lt,children:"Retry"});return m.jsx(Xo,{className:`${ul.dialog} ${ul.newReportDialog}`,maxWidth:"md",initialFocus:N,open:e,onClose:G?()=>{}:b,title:`New ${Me}`,description:"A report is a Malloy file in the package that lays out text and queries. Pick the view its first query shows; the rest is the builder.",actions:m.jsxs(m.Fragment,{children:[m.jsx(wr,{onClick:b,disabled:G,children:"Cancel"}),m.jsx(ga,{title:G?"":He??"",children:m.jsx("span",{children:m.jsx(wr,{variant:"contained",disabled:G||He!==void 0,"aria-label":!G&&He!==void 0?`${Ct}: ${He}`:Ct,onClick:()=>void bt(),children:Ct})})})]}),children:m.jsxs(lr,{sx:{gap:1.5},children:[ae?m.jsx(pa,{severity:"error",action:h&&P5(u)?it(h):void 0,children:"Couldn't read this package's models, so no view is listed to start from."}):c.length===0?!f&&m.jsxs(pa,{severity:"info",children:["This package has no models yet. Add a .malloy file that declares a source with a view, then create a ",Me," from it."]}):oe.length>0?m.jsxs(pa,{severity:"warning",action:me?it(ce):void 0,children:["Couldn't read ",oe.join(", "),", so"," ",oe.length===1?"its":"their"," views aren't listed."]}):te&&J.size===0&&m.jsxs(pa,{severity:"info",children:["A ",Me," starts from a view of a source, and no model in this package declares one yet. Add a view to a source in a model file and this list fills in."]}),m.jsxs(yt,{sx:{mx:-3,mb:-1,borderTop:`1px solid ${Ie}`,borderBottom:`1px solid ${Ie}`,display:"grid",gridTemplateColumns:{xs:"1fr",md:"320px minmax(0, 1fr)"},height:{md:500}},children:[m.jsx(yt,{sx:{display:"flex",flexDirection:"column",minHeight:0,borderRight:{md:`1px solid ${Ie}`},maxHeight:{xs:280,md:"none"}},children:m.jsx(Voe,{groups:ue,query:F,onQuery:E,picked:je,onPick:Se,onTake:lt=>{Se(lt)},searchRef:N,disabled:G,empty:m.jsx(Et,{variant:"body2",sx:{color:"text.secondary",p:2},children:rt?"Reading the package's models…":"No view to start from."})})}),m.jsxs(yt,{sx:lt=>({p:2.5,display:"flex",flexDirection:"column",gap:2,minHeight:0,overflowY:"auto",bgcolor:`color-mix(in srgb, ${lt.palette.text.primary} 3%, ${lt.palette.background.paper})`}),children:[R&&m.jsxs(yt,{children:[m.jsx(Zj,{children:"Layout"}),m.jsx(yt,{role:"radiogroup","aria-label":"Layout",sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:["linear","grid"].map(lt=>m.jsx(P0e,{layout:lt,checked:k===lt,disabled:G,onPick:()=>T(lt)},lt))}),m.jsx(Et,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"Switch it any time in the builder."})]}),m.jsxs(yt,{children:[m.jsx(Zj,{children:"First query"}),m.jsx(yt,{role:"region","aria-label":"Preview",sx:lt=>({height:200,display:"flex",position:"relative",overflow:"hidden",borderRadius:dt.radius.tile,border:`1px solid ${Ie}`,bgcolor:lt.palette.background.paper,"&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:40,pointerEvents:"none",background:`linear-gradient(to bottom, transparent, ${lt.palette.background.paper})`}}),children:Ue&&Re?m.jsx(yt,{sx:{flex:1,minWidth:0,px:2,pt:1.5},children:m.jsx(CF,{environmentName:a,packageName:i,...s!==void 0?{versionId:s}:{},modelPath:z,tile:`${Re.source} -> ${Re.view}`,label:D.trim()||mw(Re.view),borderless:!0,givens:O0e,declaredTypes:$0e,height:180})}):m.jsx(Et,{variant:"body2",sx:{color:"text.secondary",m:"auto"},children:kt?"The view you picked is no longer in this model; pick another.":"Pick a view to start from."})}),m.jsx(Et,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:"More are added in the builder."})]}),m.jsx(_a,{size:"small",label:"Title",value:D,disabled:G,onChange:lt=>{W(!0),V(lt.target.value)},InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Report title"},error:_t,helperText:_t?Ft:g.route==="package"?"Names the file too, unless you type a location.":v??`Saved as a new ${Me} in the host's store, and opened in the builder.`}),m.jsx(_a,{size:"small",label:"Location",value:$??de??"",placeholder:"report.malloy",disabled:G,onChange:lt=>A(lt.target.value),InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Location"},error:nt!==void 0,helperText:nt??(Qe?`Written as ${Qe} in the package, and opened in the builder.`:"A path in the package; the package root by default.")}),se&&m.jsx(pa,{severity:"error",children:se})]})]})]})})}function M0e(e,t){const[n,r]=C.useState(void 0);return C.useEffect(()=>{const o=window.setTimeout(()=>r(e),t);return()=>window.clearTimeout(o)},[e,t]),n}const Pw=(e,t,n)=>`${e}::${t}::${n}`,O0e=new Map,$0e=new Map;function Zj({children:e}){const t=eo().theme.ui;return m.jsx(Et,{component:"div",sx:{...t.type.label,color:"text.secondary",mb:.75},children:e})}function P0e({layout:e,checked:t,disabled:n,onPick:r}){const{theme:o}=eo(),a=o.ui,i=Nd(o.cardBorder),s=t?o.accent:"currentColor";return m.jsxs(ll,{role:"radio","aria-checked":t,"aria-label":e==="linear"?"Linear":"Grid",disabled:n,onClick:r,sx:c=>({justifyContent:"flex-start",gap:1.25,px:1.25,py:1,borderRadius:a.radius.tile,border:`1px solid ${t?o.accent:i}`,boxShadow:t?`0 0 0 1px ${o.accent}`:"none",bgcolor:t?`color-mix(in srgb, ${o.accent} 6%, ${c.palette.background.paper})`:c.palette.background.paper,color:c.palette.text.secondary,textAlign:"left"}),children:[m.jsx("svg",{width:"34",height:"26",viewBox:"0 0 34 26","aria-hidden":!0,children:e==="linear"?m.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[m.jsx("rect",{x:"3",y:"2",width:"28",height:"7",rx:"1.5"}),m.jsx("rect",{x:"3",y:"12",width:"28",height:"5",rx:"1.5"}),m.jsx("path",{d:"M5 21.5h20",strokeLinecap:"round"})]}):m.jsxs("g",{fill:"none",stroke:s,strokeWidth:"1.5",children:[m.jsx("rect",{x:"2",y:"2",width:"14",height:"10",rx:"1.5"}),m.jsx("rect",{x:"18",y:"2",width:"14",height:"10",rx:"1.5"}),m.jsx("rect",{x:"2",y:"14",width:"30",height:"10",rx:"1.5"})]})}),m.jsxs(yt,{children:[m.jsx(yt,{sx:{...a.type.control,fontWeight:t?a.type.label.fontWeight:500,color:t?o.accent:"text.primary"},children:e==="linear"?"Linear":"Grid"}),m.jsx(yt,{sx:{...a.type.caption,color:"text.secondary"},children:e==="linear"?"Read top to bottom":"Tiles side by side"})]})]})}const A0e=jn(m.jsx("path",{d:"M21 11h-1.5v-.5h-2v3h2V13H21v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1zM8 10v5H6.5v-1.5h-2V15H3v-5c0-.55.45-1 1-1h3c.55 0 1 .45 1 1m-1.5.5h-2V12h2zm7 1.5c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1h-4V9h4c.55 0 1 .45 1 1v1c0 .55-.45 1-1 1M11 10.5v.75h2v-.75zm2 2.25h-2v.75h2z"})),D0e=jn(m.jsx("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V10h16zm0-13H4V5h16z"})),j0e=jn(m.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"})),N0e=jn(m.jsx("path",{d:"M4 7v2c0 .55-.45 1-1 1H2v4h1c.55 0 1 .45 1 1v2c0 1.65 1.35 3 3 3h3v-2H7c-.55 0-1-.45-1-1v-2c0-1.3-.84-2.42-2-2.83v-.34C5.16 11.42 6 10.3 6 9V7c0-.55.45-1 1-1h3V4H7C5.35 4 4 5.35 4 7m17 3c-.55 0-1-.45-1-1V7c0-1.65-1.35-3-3-3h-3v2h3c.55 0 1 .45 1 1v2c0 1.3.84 2.42 2 2.83v.34c-1.16.41-2 1.52-2 2.83v2c0 .55-.45 1-1 1h-3v2h3c1.65 0 3-1.35 3-3v-2c0-.55.45-1 1-1h1v-4z"})),I0e=jn(m.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"})),L0e=jn(m.jsx("path",{d:"M20 10V8h-4V4h-2v4h-4V4H8v4H4v2h4v4H4v2h4v4h2v-4h4v4h2v-4h4v-2h-4v-4zm-6 4h-4v-4h4z"})),z0e=jn(m.jsx("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6m0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4m0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"})),F0e=jn(m.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"})),XF={dashboard:qr.blue,report:qr.violet,model:qr.cyan,dataApp:qr.pink,data:qr.lime,materialization:qr.amber,agent:qr.red};function QF({type:e,size:t=18,sx:n,...r}){return m.jsx(Xb,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:_0e[e]()})}const _0e={report:B0e,model:U0e,data:V0e,materialization:H0e,dataApp:Y0e,dashboard:q0e,agent:W0e};function B0e(){return m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M14 3 H6 a2 2 0 0 0 -2 2 v14 a2 2 0 0 0 2 2 h12 a2 2 0 0 0 2 -2 V9 z"}),m.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),m.jsx("path",{d:"M8 17 v-3"}),m.jsx("path",{d:"M12 17 v-6"}),m.jsx("path",{d:"M16 17 v-4"})]})}function U0e(){return m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),m.jsx("path",{d:"M4 7 l8 4 l8 -4"}),m.jsx("path",{d:"M12 11 v10"})]})}function V0e(){return m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),m.jsx("path",{d:"M3.5 9.5 H20.5"}),m.jsx("path",{d:"M9.5 3.5 V20.5"})]})}function H0e(){return m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M12 3 L21 7.5 L12 12 L3 7.5 Z"}),m.jsx("path",{d:"M3 12 L12 16.5 L21 12"}),m.jsx("path",{d:"M3 16.5 L12 21 L21 16.5"})]})}function q0e(){return m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),m.jsx("path",{d:"M3.5 9.5 H20.5"}),m.jsx("path",{d:"M12 9.5 V20.5"}),m.jsx("path",{d:"M12 15 H20.5"})]})}function W0e(){return m.jsxs(m.Fragment,{children:[m.jsx("circle",{cx:"12",cy:"8",r:"3.5"}),m.jsx("path",{d:"M5 20 a7 7 0 0 1 14 0"})]})}function Y0e(){return m.jsxs(m.Fragment,{children:[m.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),m.jsx("path",{d:"M3.5 9.5 H20.5"}),m.jsx("path",{d:"M7 13.5 H17"}),m.jsx("path",{d:"M7 16.5 H13"})]})}function ZF(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 G0e=12;function K0e(e){const t=e?.trim().toLowerCase()??"";if(t.startsWith("array")||t.endsWith("[]"))return j0e;if(t.startsWith("record")||t.startsWith("struct"))return N0e;switch(t.split(/[\s(<]/)[0]){case"string":return A0e;case"number":return L0e;case"date":return D0e;case"timestamp":case"timestamptz":return I0e;case"boolean":return z0e;default:return F0e}}function X0e({column:e}){const t=K0e(e.type);return m.jsxs(yt,{component:"li",sx:n=>({display:"flex",alignItems:"center",gap:1.25,px:1,py:.625,borderRadius:1,transition:"background-color 0.1s","&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.06)":n.palette.grey[100]}}),children:[m.jsx(t,{"aria-hidden":!0,sx:{fontSize:18,color:"primary.main",flexShrink:0}}),m.jsxs(yt,{sx:{display:"flex",alignItems:"baseline",gap:1,minWidth:0,flex:1},children:[m.jsx(Et,{component:"span",sx:{fontFamily:zo,fontSize:"0.8125rem",fontWeight:500,color:"text.primary",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),e.type&&m.jsx(Et,{component:"span",variant:"caption",color:"text.secondary",sx:{flexShrink:0,maxWidth:"50%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.type})]})]})}function Q0e({database:e,onClose:t}){const n=e!==null,[r,o]=C.useState(e);e!==null&&e!==r&&o(e);const[a,i]=C.useState(""),[s,c]=C.useState(r?.path);s!==r?.path&&(c(r?.path),i(""));const f=C.useId(),u=r?.path??"",h=u.split("/").pop()||u,g=u.slice(0,Math.max(0,u.length-h.length-1)),v=r?.info?.rowCount,b=[g,v===void 0?null:ZF(v)].filter(Boolean).join(" · "),S=C.useMemo(()=>r?.info?.columns??[],[r]),w=a.trim().toLowerCase(),x=C.useMemo(()=>w?S.filter(R=>R.name?.toLowerCase().includes(w)||R.type?.toLowerCase().includes(w)):S,[S,w]);return m.jsxs(Xo,{open:n,onClose:t,showClose:!0,title:m.jsxs(lr,{direction:"row",alignItems:"center",spacing:1.5,sx:{minWidth:0},children:[m.jsx(yt,{"aria-hidden":!0,sx:{width:32,height:32,borderRadius:1,bgcolor:XF.data,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:m.jsx(QF,{type:"data",size:18})}),m.jsxs(yt,{sx:{minWidth:0},children:[m.jsx(Et,{component:"span",noWrap:!0,title:u,sx:{display:"block",fontFamily:zo,fontSize:"1rem",fontWeight:600,letterSpacing:0,lineHeight:1.4},children:h||"Columns"}),b&&m.jsx(Et,{component:"span",variant:"caption",color:"text.secondary",noWrap:!0,sx:{display:"block",lineHeight:1.4},children:b})]})]}),children:[r?.error&&m.jsx(pa,{severity:"error",variant:"outlined",children:r.error}),r&&!r.error&&m.jsxs(yt,{component:"section","aria-labelledby":f,sx:{display:"flex",flexDirection:"column",border:"1px solid",borderColor:"divider",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",mb:2},children:[m.jsxs(lr,{direction:"row",alignItems:"center",spacing:1,sx:{px:1.5,py:1,minHeight:44,borderBottom:"1px solid",borderColor:"divider"},children:[m.jsxs(Et,{id:f,component:"h3",sx:{fontSize:"0.875rem",fontWeight:600},children:["Columns",m.jsxs(Et,{component:"span",variant:"caption",color:"text.secondary",sx:{ml:.75,fontVariantNumeric:"tabular-nums"},children:["· ",w?`${x.length} of `:"",S.length]})]}),S.length>G0e&&m.jsx(q0,{value:a,onChange:R=>i(R.target.value),placeholder:"Filter columns",inputProps:{"aria-label":"Filter columns"},startAdornment:m.jsx(pE,{position:"start",children:m.jsx(Rp,{sx:{fontSize:16,color:"text.secondary"}})}),sx:{ml:"auto !important",width:200,fontSize:"0.8125rem",px:1,py:.25,border:"1px solid",borderColor:"divider",borderRadius:1.5,"&.Mui-focused":{borderColor:"primary.main"}}})]}),m.jsx(yt,{sx:{overflowY:"auto",maxHeight:420,px:.75,py:.75},children:x.length===0?m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic",px:1,py:1},children:w?"No columns match":"No columns"}):m.jsx(yt,{component:"ul","aria-labelledby":f,sx:{listStyle:"none",m:0,p:0},children:x.map((R,k)=>m.jsx(X0e,{column:R},`${R.name}-${k}`))})})]})]})}const Z0e="README.malloynb",J0e=e=>!!e&&!e.includes("/")&&Fx(e)?.toLowerCase()==="readme";function xSe({onClickPackageFile:e,onOpenDocument:t,resourceUri:n,onEvent:r}){const{apiClients:o,server:a,mutable:i}=Cr(),s=Dd(),c=e??(oe=>{window.location.href=oe}),{environmentName:f,packageName:u,versionId:h}=to(n),g=t??((oe,ce)=>{const me=oe.mode==="edit"?sye(f,u,oe.path):bF(f,u,oe.path);ce?c(me,ce):c(me)}),[v,b]=C.useState(null),[S,w]=C.useState(!1),x=Tye(),R=yF()?.documentStorage,[k,T]=C.useState([]),[$,A]=C.useState({state:R?"pending":"ready"}),z=C.useCallback(async()=>{if(!R)return;let oe;try{oe=await R.listWorkspaces(!1)}catch{A({state:"failed"});return}A({state:"ready",chosen:iF(oe)});const ce=[],me=Bg(f,u,"");for(const pe of oe.filter(ye=>ye.writeable))for(const ye of await R.listDocuments(pe))ye.path.startsWith(me)&&ce.push({locator:ye,where:pe.description});T(ce)},[R,f,u]);C.useEffect(()=>{z()},[z]);const j=oe=>oe.path.slice(Bg(f,u,"").length),B=ko({queryKey:["package",f,u,h],queryFn:()=>o.packages.getPackage(f,u,h,!1)}),L=hye(f,u,h),F=ko({queryKey:["models",f,u,h],queryFn:()=>o.models.listModels(f,u,h)}),E=ko({queryKey:["databases",f,u,h],queryFn:()=>o.databases.listDatabases(f,u,h)}),N=ko({queryKey:["data-apps",f,u],queryFn:async()=>{try{return await o.dataApps.listDataApps(f,u)}catch(oe){const ce=oe?.response?.status;if(ce===404||ce===void 0)return{data:[]};throw oe}}}).data?.data??[],D=L.reports.filter(oe=>!!oe.path),V=txe(D),I=new Set(D.map(oe=>oe.path).filter(oe=>oe!==void 0)),W=(F.data?.data??[]).slice().filter(oe=>!I.has(oe.path)).sort((oe,ce)=>oe.path.localeCompare(ce.path)),X=(E.data?.data??[]).slice().sort((oe,ce)=>oe.path.localeCompare(ce.path)),ie=$.state==="ready"?Wge({authoritative:$.chosen?.authoritative===!0,mutable:i,canStore:$.chosen?.writeable===!0,...h===void 0?{}:{versionId:h}}):void 0,G=L.settled&&(F.isSuccess||F.isError),ee=ie!==void 0&&G,se=ee&&!x,Y=C.useMemo(()=>{if(!ee)return;const oe=[...L.reports.flatMap(ce=>ce.path?[ce.path]:[]),...(F.data?.data??[]).flatMap(ce=>ce.path?[ce.path]:[])];if(ie==="storage"&&R&&$.state==="ready")return $.chosen?{route:ie,storage:R,workspace:$.chosen,environmentName:f,packageName:u,existing:oe}:void 0;if(ie==="package")return{route:ie,existing:oe,write:async(ce,me)=>{await o.models.updateModelSource(f,u,ce,{source:me})}}},[ee,ie,R,$,f,u,o,L.reports,F.data]),ae=B.data?.data?.description??"",J=B.data?.data?.agents??[],re=(D.find(oe=>oe.path===Z0e)??D.find(oe=>J0e(oe.path)))?.path,te=!L.settled;return B.isError?m.jsx(Ma,{error:B.error,context:`${f} > ${u}`}):m.jsxs(cE,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[m.jsxs(yt,{sx:{mb:4},children:[m.jsx(Et,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:u}),ae&&m.jsx(Et,{variant:"body2",color:"text.secondary",children:ae})]}),m.jsx(E0e,{warnings:B.data?.data?.warnings}),te&&m.jsx(ya,{text:"Loading package..."}),Y&&m.jsx(T0e,{open:S,layout:"linear",environmentName:f,packageName:u,...h!==void 0?{versionId:h}:{},models:W.map(oe=>oe.path).filter(oe=>typeof oe=="string"&&oe.endsWith(".malloy")&&!I.has(oe)),modelsLoading:F.isPending,...F.isError?{modelsError:F.error}:{},onRetryModels:()=>void F.refetch(),target:Y,...r?{onEvent:r}:{},onClose:()=>w(!1),onCreated:oe=>{w(!1),dye(s,f,u),s.invalidateQueries({queryKey:["models"]}),g({path:oe.path,layout:oe.layout,slug:oe.slug,mode:"edit"})}}),!te&&m.jsxs(m.Fragment,{children:[L.isError&&m.jsx(yt,{sx:{mb:4},children:m.jsx(pa,{severity:"warning",action:m.jsx(wr,{color:"inherit",size:"small",onClick:()=>void L.refetch(),children:"Retry"}),children:"Could not list this package's reports, so any it has are missing from this page."})}),(V.length>0||ee)&&m.jsxs(Ts,{title:"Reports",count:V.length,...se?{action:m.jsx(dy,{label:"Report",onClick:()=>w(!0)})}:{},children:[V.length===0&&m.jsx(Aw,{label:"No reports yet",...se?{action:{label:"Add report",onClick:()=>w(!0)}}:{}}),V.map(oe=>m.jsx(tp,{type:oe.layout==="grid"?"dashboard":"report",label:oe.label,rightLabel:oe.layout,...oe.secondary===void 0?{}:{description:oe.secondary},onClick:ce=>oe.path.endsWith(".malloynb")?c(`/${f}/${u}/${oe.path}`,ce):g({path:oe.path,layout:oe.layout,slug:oe.slug,mode:"view"},ce)},oe.path))]}),k.length>0&&m.jsx(Ts,{title:"Drafts",count:k.length,children:k.map(({locator:oe,where:ce})=>m.jsx(tp,{type:oe.type==="grid"?"dashboard":"report",label:j(oe),rightLabel:ce,onClick:me=>g({path:j(oe),layout:oe.type,slug:Fx(j(oe))??"",mode:"edit"},me),trailingAction:m.jsx(ga,{title:"Delete this draft",children:m.jsx(Eo,{size:"small","aria-label":`Delete draft ${j(oe)}`,onClick:me=>{me.stopPropagation(),R?.deleteDocument(oe).then(z)},children:m.jsx(qoe,{fontSize:"small"})})})},`${oe.workspace}:${oe.path}`))}),N.length>0&&m.jsx(Ts,{title:"Apps",count:N.length,children:N.map(oe=>{const ce=!!oe.title&&oe.title!==oe.path,me=`${OF(a)}${oe.resource}`;return m.jsx(tp,{type:"dataApp",label:ce?oe.title:oe.path,rightLabel:ce?oe.path:void 0,onClick:pe=>{e?e(`/${f}/${u}/data-apps/${oe.path}`,pe):pe&&(pe.metaKey||pe.ctrlKey)?window.open(me,"_blank"):window.location.href=me},trailingAction:m.jsx(ga,{title:"Open standalone in new tab",children:m.jsx(Eo,{size:"small",href:me,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",onClick:pe=>pe.stopPropagation(),sx:{color:"text.secondary"},children:m.jsx(MF,{fontSize:"small"})})})},oe.path)})}),m.jsxs(Ts,{title:"Models",count:W.length,children:[W.map(oe=>m.jsx(tp,{type:"model",label:oe.path,onClick:ce=>c(`/${f}/${u}/${oe.path}`,ce)},oe.path)),W.length===0&&m.jsx(Aw,{label:"No models"})]}),J.length>0&&m.jsx(Ts,{title:"Agents",count:J.length,description:"Declared in publisher.json. Name one in an agent session to work as it. Schedules are listed only; nothing runs them yet.",children:J.map(oe=>m.jsx(exe,{agent:oe},oe.name))}),m.jsxs(Ts,{title:"Data",count:X.length,children:[X.map(oe=>m.jsx(tp,{type:"data",label:oe.path,rightLabel:oe.info?ZF(oe.info.rowCount):"Unreadable",onClick:()=>b(oe)},oe.path)),X.length===0&&m.jsx(Aw,{label:"No data files"})]}),m.jsx(d0e,{resourceUri:n}),re&&m.jsx(yt,{sx:{mt:6},children:m.jsx(R0e,{resourceUri:Lx({environmentName:f,packageName:u,versionId:h}),path:re,onLinkNavigate:c})})]}),m.jsx(Q0e,{database:v,onClose:()=>b(null)})]})}function tp({type:e,label:t,description:n,rightLabel:r,onClick:o,trailingAction:a}){return m.jsx(_x,{icon:m.jsx(QF,{type:e}),tint:XF[e],label:t,mono:!0,...n===void 0?{}:{description:n},...r===void 0?{}:{rightLabel:r},...o===void 0?{}:{onClick:o},...a===void 0?{}:{trailingAction:a}})}function exe({agent:e}){return m.jsxs(m.Fragment,{children:[m.jsx(tp,{type:"agent",label:e.name??"",...e.description?{description:e.description}:{},...e.model&&e.model!=="inherit"?{rightLabel:e.model}:{}}),(e.schedules??[]).map(t=>{const n=BR(t.cron??"");return m.jsxs(Et,{variant:"caption",color:"text.secondary",sx:{display:"block",ml:6,mb:.5},children:[n.valid?n.description:t.cron," (UTC), task"," ",t.task,". Not run yet."]},`${t.cron}|${t.task}`)})]})}function txe(e){const t=e.map(r=>({path:r.path??"",layout:NR(r),slug:Fx(r.path)??r.path??"",title:r.title})),n=new Map;for(const r of t)n.set(r.slug,(n.get(r.slug)??0)+1);return t.map(({title:r,...o})=>{const a=!!r&&r!==o.slug&&r!==o.path,i=(n.get(o.slug)??0)>1,s=a?r:o.path.endsWith(".malloynb")?o.path:o.slug;return{...o,label:s,secondary:s!==o.path&&(a||i||o.path.includes("/"))?o.path:void 0}}).sort((r,o)=>r.label.localeCompare(o.label)||r.path.localeCompare(o.path))}function Aw({label:e,action:t}){return m.jsxs(lr,{direction:"row",sx:{alignItems:"center",gap:1,py:1},children:[m.jsx(Et,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:e}),t&&m.jsx(wr,{size:"small",onClick:t.onClick,children:t.label})]})}const Jj=/^publisher:document:(dashboard|notebook):(.+)$/;function nxe(e,t){const n=[];for(let r=0;r<e.length;r++){const o=e.key(r);o!==null&&Jj.test(o)&&n.push(o)}for(const r of n){const[,o,a]=Jj.exec(r),i=e.getItem(r);i!==null&&t(a,vF(o),i)&&e.removeItem(r)}}const Dw={name:"Local",description:"Stored in this browser only",writeable:!0},hk="publisher:report:",Qu=e=>`${hk}${e}`;function Vm(e){const t=localStorage.getItem(e);if(t!==null)try{const n=JSON.parse(t);if(typeof n.content=="string"&&(n.type==="grid"||n.type==="linear"))return{type:n.type,content:n.content}}catch{}}const jw=(e,t)=>localStorage.setItem(Qu(e),JSON.stringify(t));class rxe{migrated=!1;migrate(){this.migrated||(this.migrated=!0,nxe(localStorage,(t,n,r)=>Vm(Qu(t))!==void 0?!1:(jw(t,{type:n,content:r}),!0)))}async listWorkspaces(t){return[Dw]}async listDocuments(t,n){if(t.name!==Dw.name)return[];this.migrate();const r=[];for(let o=0;o<localStorage.length;o++){const a=localStorage.key(o);if(a===null||!a.startsWith(hk))continue;const i=Vm(a);i&&(n===void 0||i.type===n)&&r.push({workspace:Dw.name,type:i.type,path:a.slice(hk.length)})}return r}async getDocument(t){this.migrate();const n=Vm(Qu(t.path));if(n===void 0)throw Nw(t);return n.content}async getDocumentType(t){this.migrate();const n=Vm(Qu(t.path));if(n===void 0)throw Nw(t);return n.type}async saveDocument(t,n){this.migrate(),jw(t.path,{type:t.type,content:n})}async deleteDocument(t){if(this.migrate(),Vm(Qu(t.path))===void 0)throw Nw(t);localStorage.removeItem(Qu(t.path))}async moveDocument(t,n){const r=await this.getDocument(t);jw(n.path,{type:n.type,content:r}),n.path!==t.path&&localStorage.removeItem(Qu(t.path))}}function Nw(e){return new sF(`No report at ${e.workspace}/${e.path}`)}async function oxe(e,t,n,r){const o=iF(await e.listWorkspaces(!1));if(!o)return;const a=Bg(t,n,r);if(e.getDocumentType)try{return await e.getDocumentType({workspace:o.name,path:a})}catch(i){if(lF(i))return;throw i}return(await e.listDocuments(o)).find(i=>i.path===a)?.type}function SSe(e,t,n,r=!0){const o=yF()?.documentStorage,a=r&&o!==void 0,[i,s]=C.useState(),c=Bg(e,t,n);return C.useEffect(()=>{if(!a||!o)return;let f=!1;return oxe(o,e,t,n).catch(()=>{}).then(u=>{f||s({key:c,layout:u})}),()=>{f=!0}},[a,o,e,t,n,c]),a?i?.key===c?{layout:i.layout,settled:!0}:{layout:void 0,settled:!1}:{layout:void 0,settled:!0}}function axe(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 ixe=400;function sxe(e){return e.type==="code"}function lxe(e){return(e.text??"").split(`
|
|
480
480
|
`).filter(t=>!t.trimStart().startsWith("##")).join(`
|
|
481
|
-
`)}const cxe=jn(m.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}));function uxe({cell:e,resourceUri:t,showCopyLink:n,maxResultSize:r,isExecuting:o,pendingRerun:a,onNavigate:i,onDrillSelf:s,canDrillSelf:c,onDrillNavigate:f,givens:u,givenSpecs:h}){const[g,v]=mn.useState(!1),[b,S]=mn.useState(!1),[w,x]=mn.useState(),[R,k]=mn.useState(!1),[T,$]=C.useState(""),{environmentName:A,packageName:z,modelPath:j}=to(t),B={environmentName:A,packageName:z,sourcePath:j,onNavigate:i},{drill:L,drillMenu:F}=EF({onNavigate:f,onSelf:s,canSelf:c,selfLabel:"Filter this report"}),E=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,N=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,D=!!e.text&&(E.test(e.text)||N.test(e.text)),V=()=>{if(!e.newSources||e.newSources.length===0)return 0;let G=[],ee="";if(e.text){const se=e.text.match(E);se&&(G=se[1].split(",").map(ae=>ae.trim()));const Y=e.text.match(N);Y&&(ee=Y[1].trim())}for(let se=0;se<e.newSources.length;se++)try{const Y=JSON.parse(e.newSources[se]);if(G.length>0&&G.includes(Y.name)||ee&&ee===Y.path)return se}catch{continue}return 0},I=mn.useMemo(()=>e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:t,givens:h}:void 0,[e.newSources,t,h]),{mode:W}=eo();C.useEffect(()=>{e.type==="code"&&qF(lxe(e),"malloy",W).then(G=>{x(G)})},[e,W]);const X=()=>{const G=window.location.href;navigator.clipboard.writeText(G).then(()=>$("URL copied to clipboard!")).catch(()=>$("Failed to copy URL"))},ie=m.jsx(Xo,{open:g,onClose:()=>v(!1),title:"Malloy code",maxWidth:"lg",showClose:!0,children:m.jsx(yt,{sx:G=>({border:`1px solid ${G.palette.divider}`,borderRadius:"8px",padding:"16px",fontFamily:zo,fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:G.palette.background.paper,color:G.palette.text.primary}),children:m.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:w}})})});return e.type==="markdown"&&m.jsx(yt,{children:m.jsxs(Ix,{children:[n?m.jsxs(lr,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[m.jsx(jp,{variant:"document",links:B,children:e.text}),m.jsx(ga,{title:"Copy link",children:m.jsx(Eo,{"aria-label":"Copy link",onClick:X,sx:{color:"text.secondary",mt:"18px"},children:m.jsx(HF,{sx:{fontSize:"24px"}})})})]}):m.jsx(jp,{variant:"document",links:B,children:e.text}),m.jsx(K0,{open:T!=="",autoHideDuration:6e3,onClose:()=>$(""),message:T})]})})||e.type==="code"&&m.jsxs(yt,{children:[e.newSources&&e.newSources.length>0&&m.jsx(lr,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:m.jsx(m5,{sx:{position:"relative",padding:"0"},children:m.jsxs(yt,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[w&&m.jsx("span",{dangerouslySetInnerHTML:{__html:w},style:{fontFamily:zo,fontSize:"14px",flex:1,marginRight:"8px"}}),D&&m.jsx(gp,{"aria-label":"Data sources",sx:{flexShrink:0},onClick:()=>k(!0),children:m.jsx(Rp,{})})]})})}),m.jsx(KF,{open:R,onClose:()=>k(!1),title:"Data Sources",hasValidImport:D,resourceUri:t,data:I,initialSelectedSourceIndex:V(),startingGivens:u}),ie,m.jsx(WF,{open:b,onClose:()=>S(!1),result:e.result||"",title:"Results",drill:L}),o&&!e.result&&!e.error&&!D&&!(e.newSources&&e.newSources.length>0)&&m.jsx(l0,{children:m.jsx(yt,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:m.jsx(ty,{size:32})})}),!e.result&&e.error&&m.jsx(sz,{summary:"This cell could not be run.",detail:e.error}),e.result&&a&&m.jsx(sL,{"aria-label":"Re-run pending",sx:{mb:1,height:2,borderRadius:1}}),e.result&&m.jsxs(l0,{children:[m.jsx(rF,{title:"",action:m.jsxs(lr,{direction:"row",sx:{gap:.5,mt:"-4px"},children:[m.jsx(gp,{"aria-label":"Malloy code",onClick:G=>{G.stopPropagation(),v(!0)},children:m.jsx(cxe,{})}),m.jsx(gp,{"aria-label":"Expand results",onClick:()=>S(!0),children:m.jsx(Rp,{})})]})}),m.jsx(OR,{result:e.result,maxHeight:cge,maxResultSize:r,drill:L}),F]})]})}function dxe({ready:e,lastRunKey:t,pendingKey:n,runKey:r,documentKey:o}){if(!e)return{cancelPending:n!==void 0,dispatch:"none"};const a=n!==void 0&&n!==r;if(t===r)return{cancelPending:a,dispatch:"none"};if(n===r)return{cancelPending:a,dispatch:"none"};const i=t===null||!t.startsWith(`${o}|`);return{cancelPending:a,dispatch:i?"now":"settle"}}const fxe=4;function pxe(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 hxe({resourceUri:e,title:t,description:n,maxResultSize:r=0,givens:o,onGivensChange:a,onNavigate:i,onDrillNavigate:s,notebook:c,error:f,runCell:u}){const{environmentName:h,packageName:g,versionId:v,modelPath:b}=to(e),S=c!==void 0,w=!S&&!!f,[x,R]=C.useState([]),[k,T]=C.useState(!1),[$,A]=C.useState(!1),z=C.useRef(void 0),[j,B]=C.useState(null),L=axe(c),F=c?.autorun!==!1,E=wx(),N=ZE({specs:L,loaded:S,startingValues:c?.startingGivens,params:o,onGivensChange:a,documentKey:e,autorun:F,environmentName:h,packageName:g,modelPath:b,versionId:v,documentName:b}),{applied:D,declaredTypes:V,canSelf:I,onSelf:W}=N,X=C.useCallback(me=>{const pe=Kp(me,V);return Object.keys(pe).length>0?JSON.stringify(pe):void 0},[V]),ie=C.useMemo(()=>kb(D,V),[D,V]),G=C.useRef(0),ee=C.useRef(null),se=C.useRef(null),Y=C.useRef(void 0);C.useEffect(()=>()=>{ee.current?.abort(),se.current=null,clearTimeout(Y.current?.timer),Y.current=void 0},[]);const ae=C.useCallback(async(me=new Map)=>{if(!S||!c?.notebookCells)return;const pe=++G.current;ee.current?.abort();const ye=new AbortController;ee.current=ye,R(c.notebookCells.map(ue=>({...ue}))),T(!0),B(null);try{const ue=[];for(let Ue=0;Ue<c.notebookCells.length;Ue++){const je=c.notebookCells[Ue];if(!sxe(je))continue;const Re=Ue,de=async()=>{try{const tt=await u({cell:je,index:Re,givens:me,declaredTypes:V,signal:ye.signal});if(G.current!==pe)return;const Ne=tt.result,Qe=je.newSources||tt.newSources;R(nt=>{const Ft=[...nt];return Ft[Re]||(Ft[Re]={...je}),Ft[Re]={...Ft[Re],result:Ne,newSources:Qe},Ft})}catch(tt){if(ye.signal.aborted||G.current!==pe)return;E.emit({type:"report.query_failed",tile:Re,category:Qb(tt)}),E.listening||console.error(`Error executing cell ${Re}:`,tt);const Ne=pxe(tt);R(Qe=>{const nt=[...Qe];return nt[Re]||(nt[Re]={...je}),nt[Re]={...nt[Re],error:Ne},nt})}};ue.push(de)}const Se=[];for(const Ue of ue){const je=Ue().then(()=>{Se.splice(Se.indexOf(je),1)});Se.push(je),Se.length>=fxe&&await Promise.race(Se)}await Promise.all(Se)}catch(ue){if(ye.signal.aborted||G.current!==pe)return;E.emit({type:"report.query_failed",category:Qb(ue)}),E.listening||console.error("Error executing notebook cells:",ue),B(ue)}finally{G.current===pe&&(T(!1),ee.current=null)}},[S,c,V,u,E]),J=C.useRef(0),re=C.useRef(void 0);re.current!==c&&(re.current=c,J.current+=1);const te=J.current;C.useEffect(()=>{const me=`${e}|${te}`,pe=`${me}|${X(D)??""}`;z.current!==void 0&&z.current!==me&&(ee.current?.abort(),ee.current=null),z.current=me;const ye=dxe({ready:S&&!!c?.notebookCells,lastRunKey:se.current,pendingKey:Y.current?.key,runKey:pe,documentKey:me});if(ye.cancelPending&&(clearTimeout(Y.current?.timer),Y.current=void 0,A(!1)),ye.dispatch==="none")return;const ue=()=>{Y.current=void 0,A(!1),se.current=pe,ae(D)};if(ye.dispatch==="now"){ue();return}A(!0),Y.current={key:pe,timer:setTimeout(ue,ixe)}},[S,c,te,e,D,X,ae]);const oe=x.length>0?x:c?.notebookCells||[],ce=0;return m.jsxs(ok,{layout:"linear",header:t||n?m.jsx(oF,{title:t??"",description:n?m.jsx(Ix,{children:m.jsx(jp,{variant:"document",children:n})}):void 0}):null,controls:N.panel.givens.length>0?m.jsx(aF,{children:m.jsx(MR,{...N.panel,layout:"bar"})}):void 0,children:[!S&&!w&&m.jsx(ya,{text:Np.opening("report")}),S&&oe.map((me,pe)=>m.jsx(uxe,{cell:me,showCopyLink:pe===ce,resourceUri:e,maxResultSize:r,isExecuting:k,givens:ie,givenSpecs:L,pendingRerun:$,onNavigate:i,onDrillNavigate:s,onDrillSelf:L.length>0?W:void 0,canDrillSelf:I},pe)),w&&f?.status===404&&m.jsxs(Et,{variant:"body2",sx:{color:"text.secondary"},children:[m.jsx("code",{children:`${h} > ${g} > ${b}`})," ","not found."]}),w&&f?.status!==404&&m.jsx(Ma,{error:f,context:`${h} > ${g} > ${b}`}),j&&m.jsx(Ma,{error:{message:j.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})}function JF(e){const{apiClients:t}=Cr(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=to(e);return ko({queryKey:[e],queryFn:async()=>(await t.notebooks.getNotebook(n,r,a,o)).data})}function mxe(e){const{apiClients:t}=Cr(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=to(e.resourceUri),i=JF(e.resourceUri),s=C.useCallback(async({index:c,givens:f,declaredTypes:u,signal:h})=>{const g=Kp(f,u);return(await t.notebooks.executeNotebookCell(n,r,a,c,o,void 0,void 0,Object.keys(g).length>0?JSON.stringify(g):void 0,{signal:h})).data},[t.notebooks,n,r,a,o]);return m.jsx(hxe,{...e,notebook:i.isSuccess?i.data:void 0,error:i.isError?i.error:void 0,runCell:s})}function wSe(e){const{data:t}=JF(e.resourceUri);if(t?.dashboard){const{environmentName:n,packageName:r,versionId:o,modelPath:a}=to(e.resourceUri);return m.jsx(TF,{manifest:{...t.dashboard,layout:"linear"},environmentName:n,packageName:r,versionId:o,documentName:a,givens:e.givens,onGivensChange:e.onGivensChange,onNavigate:e.onDrillNavigate,...e.onNavigate?{onLinkNavigate:e.onNavigate}:{},maxResultSize:e.maxResultSize})}return m.jsx(mxe,{...e})}function CSe(e,t,n="grid"){const r=t.filter(a=>!!a.path).filter(a=>Fx(a.path)===e),o=r.filter(a=>NR(a)===n);return o.length===1?{found:ik(o[0])}:r.length===1?{found:ik(r[0])}:r.length===0?{missing:!0}:{ambiguous:r.map(a=>a.path).sort()}}const gxe=/^(dashboards|notebooks)\/([^/]+)$/;function kSe(e){const t=gxe.exec(e);if(t)return{name:t[2],prefer:t[1]==="dashboards"?"grid":"linear"}}const eN="[publisher.report]",tN="[publisher.console]";function yxe(e){switch(e.type){case"report.load_failed":case"report.query_failed":case"report.save_refused":case"report.save_undo_refused":case"report.create_refused":return!0;case"report.rows_shown":return!e.ok;case"report.drill":return e.outcome==="unresolved"||e.outcome==="malformed";default:return!1}}function ESe(e){return t=>{const n={...e,...t,at:new Date().toISOString()};yxe(t)?console.warn(eN,n):console.info(eN,n)}}function vxe(e){const t={...e,at:new Date().toISOString()};e.ok?console.info(tN,t):console.warn(tN,t)}const Po={white:"#FFFFFF",offWhite:"#F8FAFC",grey:{light:"#E2E8F0",mid:"#64748B"},black:"#0F172A",semantic:{success:{main:qr.emerald,light:"#D1FAE5",dark:"#047857"},warning:{main:qr.amber,light:"#FEF3C7",dark:"#92400E"},error:{main:qr.red,light:"#FEE2E2",dark:"#B91C1C"},info:{main:qr.blue,light:"#DBEAFE",dark:"#1D4ED8"}}},nb='"Inter", "Helvetica Neue", "Arial", sans-serif',Io={50:Po.offWhite,100:"#F1F5F9",200:Po.grey.light,300:"#CBD5E1",400:"#94A3B8",500:Po.grey.mid,600:"#475569",700:"#334155",800:"#1E293B",900:Po.black},RSe={headerHeight:56},nN="0 1px 3px rgba(0, 0, 0, 0.1)",bxe="#0f172a",xxe="#1e293b",Sxe="#f1f5f9",wxe="#cbd5e1",Cxe="#334155",e3=(e="light",t)=>{const n=e==="dark",r=n?bxe:Po.white,o=n?xxe:Po.white,a=n?Sxe:Po.black,i=n?wxe:Po.grey.mid,s=n?Cxe:Po.grey.light,{accent:c,accentHover:f,accentContrast:u}=t??MC(void 0,e);return N0({cssVariables:{nativeColor:!0},palette:{mode:e,primary:{main:c,light:Po.grey.light,dark:f,contrastText:u},secondary:{main:Po.grey.mid,light:Po.grey.light,dark:Po.black},grey:Io,success:Po.semantic.success,warning:Po.semantic.warning,error:Po.semantic.error,info:Po.semantic.info,background:{default:r,paper:o},text:{primary:a,secondary:i},divider:s},typography:{fontFamily:nb,h1:{fontWeight:500,letterSpacing:"-0.025em"},h2:{fontWeight:500,letterSpacing:"-0.025em"},h3:{fontWeight:500,letterSpacing:"-0.025em"},h4:{fontWeight:500,letterSpacing:"-0.025em"},h5:{fontWeight:500,letterSpacing:"-0.025em"},h6:{fontWeight:500,letterSpacing:"-0.025em"},subtitle1:{fontWeight:500,letterSpacing:"-0.025em"},subtitle2:{fontWeight:500,letterSpacing:"-0.025em"},body1:{letterSpacing:"-0.025em"},body2:{letterSpacing:"-0.025em"},button:{fontWeight:500,letterSpacing:"-0.025em",textTransform:"none"}},shape:{borderRadius:6},components:{MuiButtonBase:{defaultProps:{disableRipple:!0,disableTouchRipple:!0},styleOverrides:{root:{"&:focus-visible":{outline:`2px solid ${c}`,outlineOffset:2}}}},MuiCssBaseline:{styleOverrides:{"*":{scrollbarWidth:"thin",scrollbarColor:n?"#475569 #1e293b":`${Io[300]} ${Io[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:n?"#1e293b":Io[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Io[300],borderRadius:"4px","&:hover":{background:n?"#64748b":Io[400]}},"&::-webkit-scrollbar-corner":{background:n?"#1e293b":Io[100]}},".malloy-table.root":{scrollbarWidth:"auto",scrollbarColor:"auto","&::-webkit-scrollbar, &::-webkit-scrollbar-track, &::-webkit-scrollbar-corner":{background:n?"#1e293b":Io[100]},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Io[300],border:"none",borderRadius:"4px"}},"div[data-radix-popper-content-wrapper]":{zIndex:"1300 !important"}}},MuiButton:{styleOverrides:{root:{borderRadius:6,textTransform:"none",fontWeight:500,fontSize:13,minHeight:32,paddingTop:0,paddingBottom:0,boxShadow:"none","&:hover":{boxShadow:"none"}},sizeSmall:{minHeight:32,paddingLeft:10,paddingRight:10},sizeMedium:{minHeight:32,paddingLeft:12,paddingRight:12},contained:{"&:hover":{boxShadow:"none"},"&.Mui-disabled":{backgroundColor:n?"rgba(255, 255, 255, 0.06)":Io[200],color:n?"#64748b":Io[500]}},outlined:{color:a,borderColor:n?"#475569":Io[300],"&:hover":{borderColor:n?"#64748b":Io[400],backgroundColor:n?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"}}}},MuiIconButton:{styleOverrides:{root:{borderRadius:6}}},MuiPopover:{styleOverrides:{paper:{borderRadius:8}}},MuiCard:{styleOverrides:{root:{borderRadius:8,boxShadow:nN,border:"1px solid",borderColor:s,backgroundColor:o}}},MuiChip:{styleOverrides:{root:{borderRadius:6,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:6},"& .MuiInputLabel-outlined":{backgroundColor:o,paddingLeft:4,paddingRight:4,"&.MuiInputLabel-shrink":{transform:"translate(14px, -9px) scale(0.75)"}}}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}},MuiDialog:{styleOverrides:{paper:{borderRadius:12,backgroundColor:o,boxShadow:"0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 10px 10px -5px rgba(0, 0, 0, 0.04)"}}},MuiSelect:{styleOverrides:{select:{fontFamily:nb,fontSize:"0.875rem",color:a}}},MuiInputLabel:{styleOverrides:{root:{"&.MuiInputLabel-outlined":{backgroundColor:o,paddingLeft:4,paddingRight:4}}}},MuiOutlinedInput:{styleOverrides:{notchedOutline:{border:"none"},root:{border:`1px solid ${n?Io[600]:Io[300]}`,borderRadius:6,transition:`border-color ${py} ease-in`,...hy,backgroundColor:o,"&:hover":{borderColor:n?"#64748b":Io[400]},"&.Mui-focused":{borderColor:n?Io[400]:Io[500],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:nb,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:nb}}},MuiMenu:{styleOverrides:{paper:{borderRadius:8,boxShadow:"0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",border:`1px solid ${s}`,backgroundColor:o,color:a}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:Io[400]}}}},MuiDivider:{styleOverrides:{root:{borderColor:s}},defaultProps:{sx:{my:1}}},MuiListItemButton:{styleOverrides:{root:{borderRadius:6,margin:"2px 8px",padding:"8px 16px","&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.08)":Po.offWhite},"&.Mui-selected":{backgroundColor:n?"rgba(255, 255, 255, 0.12)":Po.offWhite,color:a,"& .MuiListItemIcon-root":{color:a},"& .MuiListItemText-primary":{color:a},"&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.16)":Po.grey.light}}}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:o,color:a,boxShadow:nN}}}}})};e3("light");function kxe({children:e}){const{mode:t,theme:n}=eo(),{accent:r,accentHover:o,accentContrast:a}=n,i=C.useMemo(()=>e3(t,{accent:r,accentHover:o,accentContrast:a}),[t,r,o,a]);return m.jsxs(Wq,{theme:i,children:[m.jsx(K7,{}),e]})}const Exe=C.lazy(()=>Co(()=>import("./HomePage-CtB5QVol.js"),[])),Rxe=C.lazy(()=>Co(()=>import("./MainPage-1nhjUUzl.js"),__vite__mapDeps([7,8,9]))),Txe=C.lazy(()=>Co(()=>import("./ModelPage-D8aucAvE.js"),__vite__mapDeps([10,9,8]))),Mxe=C.lazy(()=>Co(()=>import("./PackagePage-DBSA4TbT.js"),__vite__mapDeps([11,9]))),Oxe=C.lazy(()=>Co(()=>import("./EnvironmentPage-BxJoHBPQ.js"),[])),$xe=C.lazy(()=>Co(()=>import("./RouteError-BVLp9Ogi.js"),[])),Pxe=C.lazy(()=>Co(()=>import("./ThemeEditorPage-D6bvkrka.js"),__vite__mapDeps([12,13]))),Axe=(e="/",t=new rxe,n)=>(Jye(vxe),LU([{path:e,element:m.jsx(yee,{children:m.jsx(nye,{documentStorage:t,children:m.jsx(kxe,{children:m.jsx(C.Suspense,{fallback:m.jsx(ya,{}),children:m.jsx(Rxe,{headerProps:n})})})})}),errorElement:m.jsx($xe,{}),children:[{index:!0,element:m.jsx(Exe,{})},{path:"settings/theme",element:m.jsx(Pxe,{})},{path:"settings",element:m.jsx(dU,{to:"/settings/theme",replace:!0})},{path:":environmentName",element:m.jsx(Oxe,{})},{path:":environmentName/:packageName",element:m.jsx(Mxe,{})},{path:":environmentName/:packageName/*",element:m.jsx(Txe,{})}]}])),Dxe=Axe("/");C_.createRoot(document.getElementById("root")).render(m.jsx(C.StrictMode,{children:m.jsx(XU,{router:Dxe})}));export{Lxe as $,Oa as A,ll as B,as as C,Nxe as D,Gg as E,hye as F,fy as G,lye as H,yt as I,QI as J,Eo as K,ga as L,oL as M,mE as N,Cr as O,Ga as P,IL as Q,zc as R,Xw as S,Et as T,Tye as U,eo as V,lL as W,Up as X,su as Y,LX as Z,RSe as _,Ka as a,Y1e as a$,ya as a0,w0 as a1,sl as a2,Ur as a3,bp as a4,cye as a5,uSe as a6,bF as a7,mSe as a8,ESe as a9,ySe as aA,JB as aB,cE as aC,lr as aD,o$ as aE,_a as aF,dL as aG,v5 as aH,PP as aI,Si as aJ,Dd as aK,fQ as aL,v7 as aM,w7 as aN,K0 as aO,Xo as aP,Hc as aQ,md as aR,Ti as aS,FE as aT,DJ as aU,nF as aV,H1e as aW,X1e as aX,hge as aY,G1e as aZ,q1e as a_,wSe as aa,Lx as ab,R0e as ac,Co as ad,ul as ae,Ixe as af,D1e as ag,_1e as ah,pSe as ai,y0 as aj,wr as ak,mn as al,kSe as am,CSe as an,dU as ao,BN as ap,zo as aq,SSe as ar,pa as as,Np as at,gSe as au,Lye as av,bSe as aw,xSe as ax,iye as ay,sye as az,pn as b,rF as b$,sge as b0,W1e as b1,Hte as b2,Jte as b3,jxe as b4,mk as b5,Tq as b6,nd as b7,Nd as b8,nz as b9,yi as bA,j1e as bB,dd as bC,Poe as bD,aF as bE,Ime as bF,Zme as bG,Jme as bH,oF as bI,Ix as bJ,cSe as bK,iF as bL,qge as bM,lF as bN,J1e as bO,rae as bP,Q1e as bQ,eSe as bR,dye as bS,z1e as bT,rye as bU,lSe as bV,fSe as bW,U1e as bX,ZE as bY,_me as bZ,l0 as b_,Jc as ba,Doe as bb,Sx as bc,Pd as bd,B1e as be,Cge as bf,A1e as bg,$1e as bh,ok as bi,vF as bj,nSe as bk,Fx as bl,hd as bm,yF as bn,ko as bo,tSe as bp,LC as bq,Qb as br,Z1e as bs,Ma as bt,F1e as bu,Xge as bv,eye as bw,lj as bx,py as by,jn as bz,hSe as c,Vge as c$,CF as c0,lge as c1,xge as c2,Bme as c3,Vme as c4,aSe as c5,Ume as c6,MR as c7,x1e as c8,T1e as c9,dSe as cA,NL as cB,L1e as cC,w1e as cD,Zoe as cE,Qge as cF,C1e as cG,ix as cH,iSe as cI,sSe as cJ,O1e as cK,cF as cL,Ate as cM,mF as cN,zx as cO,I1e as cP,e7 as cQ,mw as cR,M1e as cS,Wb as cT,S1e as cU,jR as cV,Yge as cW,Wge as cX,oSe as cY,AR as cZ,rSe as c_,Pte as ca,k1e as cb,E1e as cc,R1e as cd,Nte as ce,K1e as cf,GP as cg,Aoe as ch,hy as ci,Lme as cj,zme as ck,P1e as cl,Jm as cm,Rge as cn,U7 as co,N1e as cp,qoe as cq,cj as cr,yL as cs,ax as ct,Voe as cu,Uoe as cv,jp as cw,q0 as cx,Noe as cy,Ige as cz,Qs as d,dF as d0,Bge as d1,Hge as d2,tye as d3,Eg as d4,Ww as e,zt as f,dn as g,fn as h,Od as i,m as j,hl as k,vo as l,on as m,$d as n,Kl as o,PI as p,II as q,C as r,ut as s,Nb as t,hn as u,ey as v,AI as w,vSe as x,Dn as y,st as z};
|
|
481
|
+
`)}const cxe=jn(m.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}));function uxe({cell:e,resourceUri:t,showCopyLink:n,maxResultSize:r,isExecuting:o,pendingRerun:a,onNavigate:i,onDrillSelf:s,canDrillSelf:c,onDrillNavigate:f,givens:u,givenSpecs:h}){const[g,v]=mn.useState(!1),[b,S]=mn.useState(!1),[w,x]=mn.useState(),[R,k]=mn.useState(!1),[T,$]=C.useState(""),{environmentName:A,packageName:z,modelPath:j}=to(t),B={environmentName:A,packageName:z,sourcePath:j,onNavigate:i},{drill:L,drillMenu:F}=EF({onNavigate:f,onSelf:s,canSelf:c,selfLabel:"Filter this report"}),E=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,N=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,D=!!e.text&&(E.test(e.text)||N.test(e.text)),V=()=>{if(!e.newSources||e.newSources.length===0)return 0;let G=[],ee="";if(e.text){const se=e.text.match(E);se&&(G=se[1].split(",").map(ae=>ae.trim()));const Y=e.text.match(N);Y&&(ee=Y[1].trim())}for(let se=0;se<e.newSources.length;se++)try{const Y=JSON.parse(e.newSources[se]);if(G.length>0&&G.includes(Y.name)||ee&&ee===Y.path)return se}catch{continue}return 0},I=mn.useMemo(()=>e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:t,givens:h}:void 0,[e.newSources,t,h]),{mode:W}=eo();C.useEffect(()=>{e.type==="code"&&qF(lxe(e),"malloy",W).then(G=>{x(G)})},[e,W]);const X=()=>{const G=window.location.href;navigator.clipboard.writeText(G).then(()=>$("URL copied to clipboard!")).catch(()=>$("Failed to copy URL"))},ie=m.jsx(Xo,{open:g,onClose:()=>v(!1),title:"Malloy code",maxWidth:"lg",showClose:!0,children:m.jsx(yt,{sx:G=>({border:`1px solid ${G.palette.divider}`,borderRadius:"8px",padding:"16px",fontFamily:zo,fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:G.palette.background.paper,color:G.palette.text.primary}),children:m.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:w}})})});return e.type==="markdown"&&m.jsx(yt,{children:m.jsxs(Ix,{children:[n?m.jsxs(lr,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[m.jsx(jp,{variant:"document",links:B,children:e.text}),m.jsx(ga,{title:"Copy link",children:m.jsx(Eo,{"aria-label":"Copy link",onClick:X,sx:{color:"text.secondary",mt:"18px"},children:m.jsx(HF,{sx:{fontSize:"24px"}})})})]}):m.jsx(jp,{variant:"document",links:B,children:e.text}),m.jsx(K0,{open:T!=="",autoHideDuration:6e3,onClose:()=>$(""),message:T})]})})||e.type==="code"&&m.jsxs(yt,{children:[e.newSources&&e.newSources.length>0&&m.jsx(lr,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:m.jsx(m5,{sx:{position:"relative",padding:"0"},children:m.jsxs(yt,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[w&&m.jsx("span",{dangerouslySetInnerHTML:{__html:w},style:{fontFamily:zo,fontSize:"14px",flex:1,marginRight:"8px"}}),D&&m.jsx(gp,{"aria-label":"Data sources",sx:{flexShrink:0},onClick:()=>k(!0),children:m.jsx(Rp,{})})]})})}),m.jsx(KF,{open:R,onClose:()=>k(!1),title:"Data Sources",hasValidImport:D,resourceUri:t,data:I,initialSelectedSourceIndex:V(),startingGivens:u}),ie,m.jsx(WF,{open:b,onClose:()=>S(!1),result:e.result||"",title:"Results",drill:L}),o&&!e.result&&!e.error&&!D&&!(e.newSources&&e.newSources.length>0)&&m.jsx(l0,{children:m.jsx(yt,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:m.jsx(ty,{size:32})})}),!e.result&&e.error&&m.jsx(sz,{summary:"This cell could not be run.",detail:e.error}),e.result&&a&&m.jsx(sL,{"aria-label":"Re-run pending",sx:{mb:1,height:2,borderRadius:1}}),e.result&&m.jsxs(l0,{children:[m.jsx(rF,{title:"",action:m.jsxs(lr,{direction:"row",sx:{gap:.5,mt:"-4px"},children:[m.jsx(gp,{"aria-label":"Malloy code",onClick:G=>{G.stopPropagation(),v(!0)},children:m.jsx(cxe,{})}),m.jsx(gp,{"aria-label":"Expand results",onClick:()=>S(!0),children:m.jsx(Rp,{})})]})}),m.jsx(OR,{result:e.result,maxHeight:cge,maxResultSize:r,drill:L}),F]})]})}function dxe({ready:e,lastRunKey:t,pendingKey:n,runKey:r,documentKey:o}){if(!e)return{cancelPending:n!==void 0,dispatch:"none"};const a=n!==void 0&&n!==r;if(t===r)return{cancelPending:a,dispatch:"none"};if(n===r)return{cancelPending:a,dispatch:"none"};const i=t===null||!t.startsWith(`${o}|`);return{cancelPending:a,dispatch:i?"now":"settle"}}const fxe=4;function pxe(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 hxe({resourceUri:e,title:t,description:n,maxResultSize:r=0,givens:o,onGivensChange:a,onNavigate:i,onDrillNavigate:s,notebook:c,error:f,runCell:u}){const{environmentName:h,packageName:g,versionId:v,modelPath:b}=to(e),S=c!==void 0,w=!S&&!!f,[x,R]=C.useState([]),[k,T]=C.useState(!1),[$,A]=C.useState(!1),z=C.useRef(void 0),[j,B]=C.useState(null),L=axe(c),F=c?.autorun!==!1,E=wx(),N=ZE({specs:L,loaded:S,startingValues:c?.startingGivens,params:o,onGivensChange:a,documentKey:e,autorun:F,environmentName:h,packageName:g,modelPath:b,versionId:v,documentName:b}),{applied:D,declaredTypes:V,canSelf:I,onSelf:W}=N,X=C.useCallback(me=>{const pe=Kp(me,V);return Object.keys(pe).length>0?JSON.stringify(pe):void 0},[V]),ie=C.useMemo(()=>kb(D,V),[D,V]),G=C.useRef(0),ee=C.useRef(null),se=C.useRef(null),Y=C.useRef(void 0);C.useEffect(()=>()=>{ee.current?.abort(),se.current=null,clearTimeout(Y.current?.timer),Y.current=void 0},[]);const ae=C.useCallback(async(me=new Map)=>{if(!S||!c?.notebookCells)return;const pe=++G.current;ee.current?.abort();const ye=new AbortController;ee.current=ye,R(c.notebookCells.map(ue=>({...ue}))),T(!0),B(null);try{const ue=[];for(let Ue=0;Ue<c.notebookCells.length;Ue++){const je=c.notebookCells[Ue];if(!sxe(je))continue;const Re=Ue,de=async()=>{try{const tt=await u({cell:je,index:Re,givens:me,declaredTypes:V,signal:ye.signal});if(G.current!==pe)return;const Ne=tt.result,Qe=je.newSources||tt.newSources;R(nt=>{const Ft=[...nt];return Ft[Re]||(Ft[Re]={...je}),Ft[Re]={...Ft[Re],result:Ne,newSources:Qe},Ft})}catch(tt){if(ye.signal.aborted||G.current!==pe)return;E.emit({type:"report.query_failed",tile:Re,category:Qb(tt)}),E.listening||console.error(`Error executing cell ${Re}:`,tt);const Ne=pxe(tt);R(Qe=>{const nt=[...Qe];return nt[Re]||(nt[Re]={...je}),nt[Re]={...nt[Re],error:Ne},nt})}};ue.push(de)}const Se=[];for(const Ue of ue){const je=Ue().then(()=>{Se.splice(Se.indexOf(je),1)});Se.push(je),Se.length>=fxe&&await Promise.race(Se)}await Promise.all(Se)}catch(ue){if(ye.signal.aborted||G.current!==pe)return;E.emit({type:"report.query_failed",category:Qb(ue)}),E.listening||console.error("Error executing notebook cells:",ue),B(ue)}finally{G.current===pe&&(T(!1),ee.current=null)}},[S,c,V,u,E]),J=C.useRef(0),re=C.useRef(void 0);re.current!==c&&(re.current=c,J.current+=1);const te=J.current;C.useEffect(()=>{const me=`${e}|${te}`,pe=`${me}|${X(D)??""}`;z.current!==void 0&&z.current!==me&&(ee.current?.abort(),ee.current=null),z.current=me;const ye=dxe({ready:S&&!!c?.notebookCells,lastRunKey:se.current,pendingKey:Y.current?.key,runKey:pe,documentKey:me});if(ye.cancelPending&&(clearTimeout(Y.current?.timer),Y.current=void 0,A(!1)),ye.dispatch==="none")return;const ue=()=>{Y.current=void 0,A(!1),se.current=pe,ae(D)};if(ye.dispatch==="now"){ue();return}A(!0),Y.current={key:pe,timer:setTimeout(ue,ixe)}},[S,c,te,e,D,X,ae]);const oe=x.length>0?x:c?.notebookCells||[],ce=0;return m.jsxs(ok,{layout:"linear",header:t||n?m.jsx(oF,{title:t??"",description:n?m.jsx(Ix,{children:m.jsx(jp,{variant:"document",children:n})}):void 0}):null,controls:N.panel.givens.length>0?m.jsx(aF,{children:m.jsx(MR,{...N.panel,layout:"bar"})}):void 0,children:[!S&&!w&&m.jsx(ya,{text:Np.opening("report")}),S&&oe.map((me,pe)=>m.jsx(uxe,{cell:me,showCopyLink:pe===ce,resourceUri:e,maxResultSize:r,isExecuting:k,givens:ie,givenSpecs:L,pendingRerun:$,onNavigate:i,onDrillNavigate:s,onDrillSelf:L.length>0?W:void 0,canDrillSelf:I},pe)),w&&f?.status===404&&m.jsxs(Et,{variant:"body2",sx:{color:"text.secondary"},children:[m.jsx("code",{children:`${h} > ${g} > ${b}`})," ","not found."]}),w&&f?.status!==404&&m.jsx(Ma,{error:f,context:`${h} > ${g} > ${b}`}),j&&m.jsx(Ma,{error:{message:j.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})}function JF(e){const{apiClients:t}=Cr(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=to(e);return ko({queryKey:[e],queryFn:async()=>(await t.notebooks.getNotebook(n,r,a,o)).data})}function mxe(e){const{apiClients:t}=Cr(),{environmentName:n,packageName:r,versionId:o,modelPath:a}=to(e.resourceUri),i=JF(e.resourceUri),s=C.useCallback(async({index:c,givens:f,declaredTypes:u,signal:h})=>{const g=Kp(f,u);return(await t.notebooks.executeNotebookCell(n,r,a,c,o,void 0,void 0,Object.keys(g).length>0?JSON.stringify(g):void 0,{signal:h})).data},[t.notebooks,n,r,a,o]);return m.jsx(hxe,{...e,notebook:i.isSuccess?i.data:void 0,error:i.isError?i.error:void 0,runCell:s})}function wSe(e){const{data:t}=JF(e.resourceUri);if(t?.dashboard){const{environmentName:n,packageName:r,versionId:o,modelPath:a}=to(e.resourceUri);return m.jsx(TF,{manifest:{...t.dashboard,layout:"linear"},environmentName:n,packageName:r,versionId:o,documentName:a,givens:e.givens,onGivensChange:e.onGivensChange,onNavigate:e.onDrillNavigate,...e.onNavigate?{onLinkNavigate:e.onNavigate}:{},maxResultSize:e.maxResultSize})}return m.jsx(mxe,{...e})}function CSe(e,t,n="grid"){const r=t.filter(a=>!!a.path).filter(a=>Fx(a.path)===e),o=r.filter(a=>NR(a)===n);return o.length===1?{found:ik(o[0])}:r.length===1?{found:ik(r[0])}:r.length===0?{missing:!0}:{ambiguous:r.map(a=>a.path).sort()}}const gxe=/^(dashboards|notebooks)\/([^/]+)$/;function kSe(e){const t=gxe.exec(e);if(t)return{name:t[2],prefer:t[1]==="dashboards"?"grid":"linear"}}const eN="[publisher.report]",tN="[publisher.console]";function yxe(e){switch(e.type){case"report.load_failed":case"report.query_failed":case"report.save_refused":case"report.save_undo_refused":case"report.create_refused":return!0;case"report.rows_shown":return!e.ok;case"report.drill":return e.outcome==="unresolved"||e.outcome==="malformed";default:return!1}}function ESe(e){return t=>{const n={...e,...t,at:new Date().toISOString()};yxe(t)?console.warn(eN,n):console.info(eN,n)}}function vxe(e){const t={...e,at:new Date().toISOString()};e.ok?console.info(tN,t):console.warn(tN,t)}const Po={white:"#FFFFFF",offWhite:"#F8FAFC",grey:{light:"#E2E8F0",mid:"#64748B"},black:"#0F172A",semantic:{success:{main:qr.emerald,light:"#D1FAE5",dark:"#047857"},warning:{main:qr.amber,light:"#FEF3C7",dark:"#92400E"},error:{main:qr.red,light:"#FEE2E2",dark:"#B91C1C"},info:{main:qr.blue,light:"#DBEAFE",dark:"#1D4ED8"}}},nb='"Inter", "Helvetica Neue", "Arial", sans-serif',Io={50:Po.offWhite,100:"#F1F5F9",200:Po.grey.light,300:"#CBD5E1",400:"#94A3B8",500:Po.grey.mid,600:"#475569",700:"#334155",800:"#1E293B",900:Po.black},RSe={headerHeight:56},nN="0 1px 3px rgba(0, 0, 0, 0.1)",bxe="#0f172a",xxe="#1e293b",Sxe="#f1f5f9",wxe="#cbd5e1",Cxe="#334155",e3=(e="light",t)=>{const n=e==="dark",r=n?bxe:Po.white,o=n?xxe:Po.white,a=n?Sxe:Po.black,i=n?wxe:Po.grey.mid,s=n?Cxe:Po.grey.light,{accent:c,accentHover:f,accentContrast:u}=t??MC(void 0,e);return N0({cssVariables:{nativeColor:!0},palette:{mode:e,primary:{main:c,light:Po.grey.light,dark:f,contrastText:u},secondary:{main:Po.grey.mid,light:Po.grey.light,dark:Po.black},grey:Io,success:Po.semantic.success,warning:Po.semantic.warning,error:Po.semantic.error,info:Po.semantic.info,background:{default:r,paper:o},text:{primary:a,secondary:i},divider:s},typography:{fontFamily:nb,h1:{fontWeight:500,letterSpacing:"-0.025em"},h2:{fontWeight:500,letterSpacing:"-0.025em"},h3:{fontWeight:500,letterSpacing:"-0.025em"},h4:{fontWeight:500,letterSpacing:"-0.025em"},h5:{fontWeight:500,letterSpacing:"-0.025em"},h6:{fontWeight:500,letterSpacing:"-0.025em"},subtitle1:{fontWeight:500,letterSpacing:"-0.025em"},subtitle2:{fontWeight:500,letterSpacing:"-0.025em"},body1:{letterSpacing:"-0.025em"},body2:{letterSpacing:"-0.025em"},button:{fontWeight:500,letterSpacing:"-0.025em",textTransform:"none"}},shape:{borderRadius:6},components:{MuiButtonBase:{defaultProps:{disableRipple:!0,disableTouchRipple:!0},styleOverrides:{root:{"&:focus-visible":{outline:`2px solid ${c}`,outlineOffset:2}}}},MuiCssBaseline:{styleOverrides:{"*":{scrollbarWidth:"thin",scrollbarColor:n?"#475569 #1e293b":`${Io[300]} ${Io[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:n?"#1e293b":Io[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Io[300],borderRadius:"4px","&:hover":{background:n?"#64748b":Io[400]}},"&::-webkit-scrollbar-corner":{background:n?"#1e293b":Io[100]}},".malloy-table.root":{scrollbarWidth:"auto",scrollbarColor:"auto","&::-webkit-scrollbar, &::-webkit-scrollbar-track, &::-webkit-scrollbar-corner":{background:n?"#1e293b":Io[100]},"&::-webkit-scrollbar-thumb":{background:n?"#475569":Io[300],border:"none",borderRadius:"4px"}},"div[data-radix-popper-content-wrapper]":{zIndex:"1300 !important"}}},MuiButton:{styleOverrides:{root:{borderRadius:6,textTransform:"none",fontWeight:500,fontSize:13,minHeight:32,paddingTop:0,paddingBottom:0,boxShadow:"none","&:hover":{boxShadow:"none"}},sizeSmall:{minHeight:32,paddingLeft:10,paddingRight:10},sizeMedium:{minHeight:32,paddingLeft:12,paddingRight:12},contained:{"&:hover":{boxShadow:"none"},"&.Mui-disabled":{backgroundColor:n?"rgba(255, 255, 255, 0.06)":Io[200],color:n?"#64748b":Io[500]}},outlined:{color:a,borderColor:n?"#475569":Io[300],"&:hover":{borderColor:n?"#64748b":Io[400],backgroundColor:n?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"}}}},MuiIconButton:{styleOverrides:{root:{borderRadius:6}}},MuiPopover:{styleOverrides:{paper:{borderRadius:8}}},MuiCard:{styleOverrides:{root:{borderRadius:8,boxShadow:nN,border:"1px solid",borderColor:s,backgroundColor:o}}},MuiChip:{styleOverrides:{root:{borderRadius:6,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:6},"& .MuiInputLabel-outlined":{backgroundColor:o,paddingLeft:4,paddingRight:4,"&.MuiInputLabel-shrink":{transform:"translate(14px, -9px) scale(0.75)"}}}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}},MuiDialog:{styleOverrides:{paper:{borderRadius:12,backgroundColor:o,boxShadow:"0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 10px 10px -5px rgba(0, 0, 0, 0.04)"}}},MuiSelect:{styleOverrides:{select:{fontFamily:nb,fontSize:"0.875rem",color:a}}},MuiInputLabel:{styleOverrides:{root:{"&.MuiInputLabel-outlined":{backgroundColor:o,paddingLeft:4,paddingRight:4}}}},MuiOutlinedInput:{styleOverrides:{notchedOutline:{border:"none"},root:{border:`1px solid ${n?Io[600]:Io[300]}`,borderRadius:6,transition:`border-color ${py} ease-in`,...hy,backgroundColor:o,"&:hover":{borderColor:n?"#64748b":Io[400]},"&.Mui-focused":{borderColor:n?Io[400]:Io[500],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:nb,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:nb}}},MuiMenu:{styleOverrides:{paper:{borderRadius:8,boxShadow:"0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",border:`1px solid ${s}`,backgroundColor:o,color:a}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:Io[400]}}}},MuiDivider:{styleOverrides:{root:{borderColor:s}},defaultProps:{sx:{my:1}}},MuiListItemButton:{styleOverrides:{root:{borderRadius:6,margin:"2px 8px",padding:"8px 16px","&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.08)":Po.offWhite},"&.Mui-selected":{backgroundColor:n?"rgba(255, 255, 255, 0.12)":Po.offWhite,color:a,"& .MuiListItemIcon-root":{color:a},"& .MuiListItemText-primary":{color:a},"&:hover":{backgroundColor:n?"rgba(255, 255, 255, 0.16)":Po.grey.light}}}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:o,color:a,boxShadow:nN}}}}})};e3("light");function kxe({children:e}){const{mode:t,theme:n}=eo(),{accent:r,accentHover:o,accentContrast:a}=n,i=C.useMemo(()=>e3(t,{accent:r,accentHover:o,accentContrast:a}),[t,r,o,a]);return m.jsxs(Wq,{theme:i,children:[m.jsx(K7,{}),e]})}const Exe=C.lazy(()=>Co(()=>import("./HomePage-B3LsCOlr.js"),[])),Rxe=C.lazy(()=>Co(()=>import("./MainPage-BCDlscxh.js"),__vite__mapDeps([7,8,9]))),Txe=C.lazy(()=>Co(()=>import("./ModelPage-DGXivK0m.js"),__vite__mapDeps([10,9,8]))),Mxe=C.lazy(()=>Co(()=>import("./PackagePage-BBvnnh9f.js"),__vite__mapDeps([11,9]))),Oxe=C.lazy(()=>Co(()=>import("./EnvironmentPage-C0Y7JsgF.js"),[])),$xe=C.lazy(()=>Co(()=>import("./RouteError-1Eclkzb_.js"),[])),Pxe=C.lazy(()=>Co(()=>import("./ThemeEditorPage-loRmpKoQ.js"),__vite__mapDeps([12,13]))),Axe=(e="/",t=new rxe,n)=>(Jye(vxe),LU([{path:e,element:m.jsx(yee,{children:m.jsx(nye,{documentStorage:t,children:m.jsx(kxe,{children:m.jsx(C.Suspense,{fallback:m.jsx(ya,{}),children:m.jsx(Rxe,{headerProps:n})})})})}),errorElement:m.jsx($xe,{}),children:[{index:!0,element:m.jsx(Exe,{})},{path:"settings/theme",element:m.jsx(Pxe,{})},{path:"settings",element:m.jsx(dU,{to:"/settings/theme",replace:!0})},{path:":environmentName",element:m.jsx(Oxe,{})},{path:":environmentName/:packageName",element:m.jsx(Mxe,{})},{path:":environmentName/:packageName/*",element:m.jsx(Txe,{})}]}])),Dxe=Axe("/");C_.createRoot(document.getElementById("root")).render(m.jsx(C.StrictMode,{children:m.jsx(XU,{router:Dxe})}));export{Lxe as $,Oa as A,ll as B,as as C,Nxe as D,Gg as E,hye as F,fy as G,lye as H,yt as I,QI as J,Eo as K,ga as L,oL as M,mE as N,Cr as O,Ga as P,IL as Q,zc as R,Xw as S,Et as T,Tye as U,eo as V,lL as W,Up as X,su as Y,LX as Z,RSe as _,Ka as a,Y1e as a$,ya as a0,w0 as a1,sl as a2,Ur as a3,bp as a4,cye as a5,uSe as a6,bF as a7,mSe as a8,ESe as a9,ySe as aA,JB as aB,cE as aC,lr as aD,o$ as aE,_a as aF,dL as aG,v5 as aH,PP as aI,Si as aJ,Dd as aK,fQ as aL,v7 as aM,w7 as aN,K0 as aO,Xo as aP,Hc as aQ,md as aR,Ti as aS,FE as aT,DJ as aU,nF as aV,H1e as aW,X1e as aX,hge as aY,G1e as aZ,q1e as a_,wSe as aa,Lx as ab,R0e as ac,Co as ad,ul as ae,Ixe as af,D1e as ag,_1e as ah,pSe as ai,y0 as aj,wr as ak,mn as al,kSe as am,CSe as an,dU as ao,BN as ap,zo as aq,SSe as ar,pa as as,Np as at,gSe as au,Lye as av,bSe as aw,xSe as ax,iye as ay,sye as az,pn as b,rF as b$,sge as b0,W1e as b1,Hte as b2,Jte as b3,jxe as b4,mk as b5,Tq as b6,nd as b7,Nd as b8,nz as b9,yi as bA,j1e as bB,dd as bC,Poe as bD,aF as bE,Ime as bF,Zme as bG,Jme as bH,oF as bI,Ix as bJ,cSe as bK,iF as bL,qge as bM,lF as bN,J1e as bO,rae as bP,Q1e as bQ,eSe as bR,dye as bS,z1e as bT,rye as bU,lSe as bV,fSe as bW,U1e as bX,ZE as bY,_me as bZ,l0 as b_,Jc as ba,Doe as bb,Sx as bc,Pd as bd,B1e as be,Cge as bf,A1e as bg,$1e as bh,ok as bi,vF as bj,nSe as bk,Fx as bl,hd as bm,yF as bn,ko as bo,tSe as bp,LC as bq,Qb as br,Z1e as bs,Ma as bt,F1e as bu,Xge as bv,eye as bw,lj as bx,py as by,jn as bz,hSe as c,Vge as c$,CF as c0,lge as c1,xge as c2,Bme as c3,Vme as c4,aSe as c5,Ume as c6,MR as c7,x1e as c8,T1e as c9,dSe as cA,NL as cB,L1e as cC,w1e as cD,Zoe as cE,Qge as cF,C1e as cG,ix as cH,iSe as cI,sSe as cJ,O1e as cK,cF as cL,Ate as cM,mF as cN,zx as cO,I1e as cP,e7 as cQ,mw as cR,M1e as cS,Wb as cT,S1e as cU,jR as cV,Yge as cW,Wge as cX,oSe as cY,AR as cZ,rSe as c_,Pte as ca,k1e as cb,E1e as cc,R1e as cd,Nte as ce,K1e as cf,GP as cg,Aoe as ch,hy as ci,Lme as cj,zme as ck,P1e as cl,Jm as cm,Rge as cn,U7 as co,N1e as cp,qoe as cq,cj as cr,yL as cs,ax as ct,Voe as cu,Uoe as cv,jp as cw,q0 as cx,Noe as cy,Ige as cz,Qs as d,dF as d0,Bge as d1,Hge as d2,tye as d3,Eg as d4,Ww as e,zt as f,dn as g,fn as h,Od as i,m as j,hl as k,vo as l,on as m,$d as n,Kl as o,PI as p,II as q,C as r,ut as s,Nb as t,hn as u,ey as v,AI as w,vSe as x,Dn as y,st as z};
|