@malloy-publisher/app 0.0.200 → 0.0.201

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/core-C0vCMRDQ.es-D_ytHhjS.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/index-BGdcKsFF.js","assets/index-CTx4v4_3.js","assets/index.umd-C1Mi1uRm.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/core-B3IQNPBD.es-foBNuT8L.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/index-B5We8x8r.js","assets/index-KIvi9k3F.js","assets/index.umd-BXcsl2XW.js"])))=>i.map(i=>d[i]);
2
2
  function d7(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 Xwe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function WI(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Zwe(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var rx={exports:{}},rf={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -323,7 +323,7 @@ import {${t.sourceName}}" from '${t.modelPath}'"
323
323
  - [ ] `),/^\d+.\s/.test(i)&&(T=`
324
324
  `+(parseInt(i)+1)+". "),Sd(r,T)}else if(e.code&&e.code.toLowerCase()==="keyd"&&e.ctrlKey){Ly(e);var M={start:r.selectionStart,end:r.selectionEnd},R=M;M=dh({text:r.value,selection:M});var D=r.value.slice(M.start,M.end);l.setSelectionRange({start:M.end,end:M.end}),Sd(r,`
325
325
  `+D),l.setSelectionRange({start:R.start,end:R.end})}else e.code&&e.code.toLowerCase()==="arrowup"&&e.altKey?EP(e,-1):e.code&&e.code.toLowerCase()==="arrowdown"&&e.altKey&&EP(e,1)}var vme=["prefixCls","onChange"],xme=["markdown","commands","fullscreen","preview","highlightEnable","extraCommands","tabSize","defaultTabEnable","autoFocusEnd","textareaWarp","dispatch"];function Sme(e){var{prefixCls:t,onChange:n}=e,r=Xt(e,vme),o=E.useContext(sp),{markdown:a,commands:i,fullscreen:l,preview:c,highlightEnable:d,extraCommands:p,tabSize:h,defaultTabEnable:b,autoFocusEnd:y,textareaWarp:v,dispatch:x}=o;Xt(o,xme);var C=lt.useRef(null),S=lt.useRef(),A=lt.useRef({fullscreen:l,preview:c});E.useEffect(()=>{A.current={fullscreen:l,preview:c,highlightEnable:d}},[l,c,d]),E.useEffect(()=>{if(C.current&&x){var M=new hw(C.current);S.current=M,x({textarea:C.current,commandOrchestrator:M})}},[]),E.useEffect(()=>{if(y&&C.current&&v){C.current.focus();var M=C.current.value.length;C.current.setSelectionRange(M,M),setTimeout(()=>{v&&(v.scrollTop=v.scrollHeight),C.current&&(C.current.scrollTop=C.current.scrollHeight)},0)}},[v]);var T=M=>{bme(M,h,b),C6(M,[...i||[],...p||[]],S.current,x,A.current)};return E.useEffect(()=>(C.current&&C.current.addEventListener("keydown",T),()=>{C.current&&C.current.removeEventListener("keydown",T)}),[]),g.jsx("textarea",he({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1},r,{ref:C,className:t+"-text-input "+(r.className?r.className:""),value:a,onChange:M=>{x&&x({markdown:M.target.value}),n&&n(M)}}))}var Eme=["prefixCls","className","onScroll","renderTextarea"];function Cme(e){var t=e||{},{prefixCls:n,className:r,onScroll:o,renderTextarea:a}=t,i=Xt(t,Eme),{markdown:l,scrollTop:c,commands:d,extraCommands:p,dispatch:h}=E.useContext(sp),b=lt.useRef(null),y=lt.useRef(),v=lt.createRef();E.useEffect(()=>{var C={};v.current&&(C.textareaWarp=v.current||void 0,v.current.scrollTop=c||0),h&&h(he({},C))},[]),E.useEffect(()=>{if(b.current&&h){var C=new hw(b.current);y.current=C,h({textarea:b.current,commandOrchestrator:C})}},[]);var x={WebkitTextFillColor:"initial",overflow:"auto"};return g.jsx("div",{ref:v,className:n+"-area "+(r||""),onScroll:o,children:g.jsx("div",{className:n+"-text",children:a?lt.cloneElement(a(he({},i,{value:l,autoComplete:"off",autoCorrect:"off",spellCheck:"false",autoCapitalize:"off",className:n+"-text-input",style:{WebkitTextFillColor:"inherit",overflow:"auto"}}),{dispatch:h,onChange:i.onChange,shortcuts:C6,useContext:{commands:d,extraCommands:p,commandOrchestrator:y.current}}),{ref:b}):g.jsx(E.Fragment,{children:g.jsx(Sme,he({prefixCls:n},i,{style:x}))})})})}function Tme(e){var{prefixCls:t,groupName:n,commands:r,children:o}=e||{},{barPopup:a={}}=E.useContext(sp);return E.useMemo(()=>g.jsx("div",{className:t+"-toolbar-child "+(n&&a[n]?"active":""),onClick:i=>i.stopPropagation(),children:Array.isArray(r)?g.jsx(D6,he({commands:r},e,{isChild:!0})):o}),[r,a,n,t])}function CP(e){var{prefixCls:t,overflow:n}=e,{fullscreen:r,preview:o,barPopup:a={},components:i,commandOrchestrator:l,dispatch:c}=E.useContext(sp),d=E.useRef("");function p(h,b){if(c){var y={barPopup:he({},a)};h.keyCommand==="preview"&&(y.preview=h.value),h.keyCommand==="fullscreen"&&(y.fullscreen=!r),e.commands&&h.keyCommand==="group"?e.commands.forEach(v=>{b===v.groupName?y.barPopup[b]=!0:v.keyCommand&&(y.barPopup[v.groupName]=!1)}):(b||h.parent)&&Object.keys(y.barPopup||{}).forEach(v=>{y.barPopup[v]=!1}),Object.keys(y).length&&c(he({},y)),l&&l.executeCommand(h)}}return E.useEffect(()=>{document&&n&&(r?document.body.style.overflow="hidden":(d.current||(d.current=window.getComputedStyle(document.body,null).overflow),document.body.style.overflow=d.current))},[r,d,n]),g.jsx("ul",{children:(e.commands||[]).map((h,b)=>{if(h.keyCommand==="divider")return g.jsx("li",he({},h.liProps,{className:t+"-toolbar-divider"}),b);if(!h.keyCommand)return g.jsx(E.Fragment,{},b);var y=r&&h.keyCommand==="fullscreen"||h.keyCommand==="preview"&&o===h.value,v=h.children&&typeof h.children=="function"?h.children({getState:()=>l.getState(),textApi:l?l.textApi:void 0,close:()=>p({},h.groupName),execute:()=>p({execute:h.execute}),dispatch:c}):void 0,x=a&&o&&o==="preview"&&!/(preview|fullscreen)/.test(h.keyCommand),C=i?.toolbar||h.render,S=C&&typeof C=="function"?C(h,!!x,p,b):null;return g.jsxs("li",he({},h.liProps,{className:y?"active":"",children:[S&&lt.isValidElement(S)&&S,!S&&!h.buttonProps&&h.icon,!S&&h.buttonProps&&lt.createElement("button",he({type:"button",key:b,disabled:x,"data-name":h.name},h.buttonProps,{onClick:A=>{A.stopPropagation(),p(h,h.groupName)}}),h.icon),h.children&&g.jsx(Tme,{overflow:n,groupName:h.groupName,prefixCls:t,children:v,commands:Array.isArray(h.children)?h.children:void 0})]}),b)})})}function D6(e){e===void 0&&(e={});var{prefixCls:t,isChild:n,className:r}=e,{commands:o,extraCommands:a}=E.useContext(sp);return g.jsxs("div",{className:t+"-toolbar "+r,children:[g.jsx(CP,he({},e,{commands:e.commands||o||[]})),!n&&g.jsx(CP,he({},e,{commands:a||[]}))]})}function TP(e){var{hideToolbar:t,toolbarBottom:n,placement:r,overflow:o,prefixCls:a}=e;if(t||r==="bottom"&&!n||r==="top"&&n)return null;var i=n?"bottom":"";return g.jsx(D6,{prefixCls:a,overflow:o,className:i})}var wme=e=>{var{prefixCls:t,onChange:n}=e||{},r=E.useRef(null),o=E.useRef(),a=E.useRef(e.height);E.useEffect(()=>{a.current!==e.height&&(a.current=e.height)},[e.height]);function i(p){if(o.current){var h,b=p.clientY||((h=p.changedTouches[0])==null?void 0:h.clientY),y=o.current.height+b-o.current.dragY;y>=e.minHeight&&y<=e.maxHeight&&n&&n(o.current.height+(b-o.current.dragY))}}function l(){var p,h;o.current=void 0,document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",l),(p=r.current)==null||p.removeEventListener("touchmove",i),(h=r.current)==null||h.removeEventListener("touchend",l)}function c(p){var h,b,y;p.preventDefault();var v=p.clientY||((h=p.changedTouches[0])==null?void 0:h.clientY);o.current={height:a.current,dragY:v},document.addEventListener("mousemove",i),document.addEventListener("mouseup",l),(b=r.current)==null||b.addEventListener("touchmove",i,{passive:!1}),(y=r.current)==null||y.addEventListener("touchend",l,{passive:!1})}E.useEffect(()=>{if(document){var p,h;(p=r.current)==null||p.addEventListener("touchstart",c,{passive:!1}),(h=r.current)==null||h.addEventListener("mousedown",c)}return()=>{if(document){var b;(b=r.current)==null||b.removeEventListener("touchstart",c),document.removeEventListener("mousemove",i)}}},[]);var d=E.useMemo(()=>g.jsx("svg",{viewBox:"0 0 512 512",height:"100%",children:g.jsx("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})}),[]);return g.jsx("div",{className:t+"-bar",ref:r,children:d})},kme=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","autoFocusEnd","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function Ame(e){return e===void 0&&(e={}),Object.keys(e).forEach(t=>{e[t]=!1}),e}var Dme=lt.forwardRef((e,t)=>{var n=e||{},{prefixCls:r="w-md-editor",className:o,value:a,commands:i=gme(),commandsFilter:l,direction:c,extraCommands:d=yme(),height:p=200,enableScroll:h=!0,visibleDragbar:b=typeof e.visiableDragbar=="boolean"?e.visiableDragbar:!0,highlightEnable:y=!0,preview:v="live",fullscreen:x=!1,overflow:C=!0,previewOptions:S={},textareaProps:A,maxHeight:T=1200,minHeight:M=100,autoFocus:R,autoFocusEnd:D=!1,tabSize:F=2,defaultTabEnable:j=!1,onChange:z,onStatistics:B,onHeightChange:U,hideToolbar:w,toolbarBottom:L=!1,components:I,renderTextarea:$}=n,_=Xt(n,kme),q=i.map(be=>l?l(be,!1):be).filter(Boolean),W=d.map(be=>l?l(be,!0):be).filter(Boolean),[K,P]=E.useReducer(Fhe,{markdown:a,preview:v,components:I,height:p,minHeight:M,highlightEnable:y,tabSize:F,defaultTabEnable:j,scrollTop:0,scrollTopPreview:0,commands:q,extraCommands:W,fullscreen:x,barPopup:{}}),G=E.useRef(null),X=E.useRef(null),H=E.useRef(h);E.useImperativeHandle(t,()=>he({},K,{container:G.current,dispatch:P})),E.useMemo(()=>H.current=h,[h]),E.useEffect(()=>{var be={};G.current&&(be.container=G.current||void 0),be.markdown=a||"",be.barPopup={},P&&P(he({},K,be))},[]);var te=[o,"wmde-markdown-var",c?r+"-"+c:null,r,K.preview?r+"-show-"+K.preview:null,K.fullscreen?r+"-fullscreen":null].filter(Boolean).join(" ").trim();E.useMemo(()=>a!==K.markdown&&P({markdown:a||""}),[a,K.markdown]),E.useMemo(()=>v!==K.preview&&P({preview:v}),[v]),E.useMemo(()=>F!==K.tabSize&&P({tabSize:F}),[F]),E.useMemo(()=>y!==K.highlightEnable&&P({highlightEnable:y}),[y]),E.useMemo(()=>R!==K.autoFocus&&P({autoFocus:R}),[R]),E.useMemo(()=>D!==K.autoFocusEnd&&P({autoFocusEnd:D}),[D]),E.useMemo(()=>x!==K.fullscreen&&P({fullscreen:x}),[x]),E.useMemo(()=>p!==K.height&&P({height:p}),[p]),E.useMemo(()=>p!==K.height&&U&&U(K.height,p,K),[p,U,K]),E.useMemo(()=>i!==K.commands&&P({commands:q}),[e.commands]),E.useMemo(()=>d!==K.extraCommands&&P({extraCommands:W}),[e.extraCommands]);var Z=E.useRef(),Y=E.useRef("preview"),ne=E.useRef(!1);E.useMemo(()=>{Z.current=K.textareaWarp,K.textareaWarp&&(K.textareaWarp.addEventListener("mouseover",()=>{Y.current="text"}),K.textareaWarp.addEventListener("mouseleave",()=>{Y.current="preview"}))},[K.textareaWarp]);var J=(be,me)=>{if(H.current){var et=Z.current,Oe=X.current?X.current:void 0;if(ne.current||(Y.current=me,ne.current=!0),et&&Oe){var Ve=(et.scrollHeight-et.offsetHeight)/(Oe.scrollHeight-Oe.offsetHeight);be.target===et&&Y.current==="text"&&(Oe.scrollTop=et.scrollTop/Ve),be.target===Oe&&Y.current==="preview"&&(et.scrollTop=Oe.scrollTop*Ve);var Ue=0;Y.current==="text"?Ue=et.scrollTop||0:Y.current==="preview"&&(Ue=Oe.scrollTop||0),P({scrollTop:Ue})}}},ce=r+"-preview "+(S.className||""),fe=be=>J(be,"preview"),ue=E.useMemo(()=>g.jsx("div",{ref:X,className:ce,children:g.jsx(S6,he({},S,{onScroll:fe,source:K.markdown||""}))}),[ce,S,K.markdown]),Ce=I?.preview&&I?.preview(K.markdown||"",K,P);Ce&&lt.isValidElement(Ce)&&(ue=g.jsx("div",{className:ce,ref:X,onScroll:fe,children:Ce}));var ie=he({},_.style,{height:K.height||"100%"}),le=()=>P({barPopup:he({},Ame(K.barPopup))}),je=be=>P({height:be}),Ee=be=>{if(z&&z(be.target.value,be,K),A&&A.onChange&&A.onChange(be),K.textarea&&K.textarea instanceof HTMLTextAreaElement&&B){var me=new hw(K.textarea),et=me.getState()||{};B(he({},et,{lineCount:be.target.value.split(`
326
- `).length,length:be.target.value.length}))}};return g.jsx(sp.Provider,{value:he({},K,{dispatch:P}),children:g.jsxs("div",he({ref:G,className:te},_,{onClick:le,style:ie,children:[g.jsx(TP,{hideToolbar:w,toolbarBottom:L,prefixCls:r,overflow:C,placement:"top"}),g.jsxs("div",{className:r+"-content",children:[/(edit|live)/.test(K.preview||"")&&g.jsx(Cme,he({className:r+"-input",prefixCls:r,autoFocus:R},A,{onChange:Ee,renderTextarea:I?.textarea||$,onScroll:be=>J(be,"text")})),/(live|preview)/.test(K.preview||"")&&ue]}),b&&!K.fullscreen&&g.jsx(wme,{prefixCls:r,height:K.height,maxHeight:T,minHeight:M,onChange:je}),g.jsx(TP,{hideToolbar:w,toolbarBottom:L,prefixCls:r,overflow:C,placement:"bottom"})]}))})}),R6=Dme;R6.Markdown=S6;const yS={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"}]}}},Rme={...yS,patterns:[...yS.patterns,{include:"#docvar"}],repository:{...yS.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},Mme={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"}]}}},Ome="github-light";let bS;function Nme(){return bS||(bS=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:a}]=await Promise.all([fo(()=>import("./core-C0vCMRDQ.es-D_ytHhjS.js"),__vite__mapDeps([0,1])),fo(()=>import("./engine-oniguruma-C4vnmooL.es-jdkXmgTr.js"),[]),fo(()=>import("./sql-DCkt643-.es-COK4E0Yg.js"),[]),fo(()=>import("./json-71t8ZF9g.es-BQoSv7ci.js"),[]),fo(()=>import("./typescript-buWNZFwO.es-Dj6nwHGl.js"),[]),fo(()=>import("./github-light-JYsPkUQd.es-DAi9KRSo.js"),[])]);return e({engine:t(fo(()=>import("./wasm-DQxwEHae.es-CG6Dc4jp.js"),[])),themes:[a],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...Rme},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...Mme}]})})()),bS}async function Sb(e,t){return(await Nme()).codeToHtml(e,{lang:t,theme:Ome})}function To(e){const{server:t}=yr(),n={...e,queryKey:[...e.queryKey,t],queryFn:async()=>{try{return await e.queryFn()}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const 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 vX(n,ST)}function Yi(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 xX(t,ST)}const eo=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},mw=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 M6({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a}){return lt.useEffect(()=>{o&&o(t)},[t,o]),g.jsx(_T,{children:g.jsxs(WU,{spacing:2,component:"section",children:[g.jsx(Ime,{sourceAndPath:e[t],existingQuery:n,onChange:i=>{r&&r(i)},resourceUri:a}),g.jsx(j_,{height:"5px"})]})})}function Fy(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function Pme({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a}){const[i,l]=lt.useState(n||Fy()),[c,d]=lt.useState(void 0);lt.useEffect(()=>{n&&l(n)},[n]);const[p,h]=lt.useState([]),{MalloyExplorerProvider:b,QueryPanel:y,ResizableCollapsiblePanel:v,ResultPanel:x,SourcePanel:C}=r;lt.useEffect(()=>{t&&t(i)},[t,i]);const{environmentName:S,packageName:A,versionId:T}=eo(a),{apiClients:M}=yr(),R=Yi({mutationFn:()=>{const z=typeof i?.malloyQuery=="string"?i.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:i?.malloyQuery}).toMalloy();return d({executionState:"running",query:i?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{R.reset(),d(void 0)},response:{result:{}}}),l({...i,query:z}),M.models.executeQueryModel(S,A,e.modelPath,{query:z,sourceName:void 0,queryName:void 0,versionId:T})},onSuccess:z=>{if(z){const B=JSON.parse(z.data.result);l({...i,malloyResult:B}),d(U=>U?{...U,executionState:"finished",response:{result:B}}:void 0)}},onError:z=>{d(void 0),console.error("Query execution error:",z)}}),[D,F]=lt.useState(e.sourceInfo.name);lt.useEffect(()=>{D!==e.sourceInfo.name&&(F(e.sourceInfo.name),l(Fy()),d(void 0))},[e,D]);const j=lt.useCallback(z=>{l({...i,malloyQuery:z,malloyResult:void 0})},[i]);return D!==e.sourceInfo.name?g.jsx("div",{children:"Loading..."}):g.jsx(a3,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:g.jsx(b,{source:e.sourceInfo,query:i?.malloyQuery,topValues:[],onFocusedNestViewPathChange:h,focusedNestViewPath:p,onQueryChange:j,children:g.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[g.jsx(v,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:g.jsx(C,{onRefresh:()=>l(Fy())})}),g.jsx(v,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:g.jsx(y,{runQuery:()=>{console.log(`running query with: ${i?.malloyQuery}`);try{R.mutate()}catch(z){console.error("Error running query:",z)}}})}),g.jsx(x,{source:e.sourceInfo,draftQuery:i?.malloyQuery,setDraftQuery:z=>l({...i,malloyQuery:z}),submittedQuery:c,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function Ime(e){const[t,n]=E.useState(null),[r,o]=E.useState(null),[a,i]=E.useState(!0);return E.useEffect(()=>{let l=!0;return Promise.all([fo(()=>import("./index-BGdcKsFF.js"),__vite__mapDeps([2,3,4])),fo(()=>import("./index-CTx4v4_3.js").then(c=>c.i),[])]).then(([c,d])=>{l&&(n(c),o(d),i(!1))}).catch(c=>{console.error("Failed to load Malloy components:",c),l&&i(!1)}),()=>{l=!1}},[]),a||!t||!r?g.jsx(nre,{children:g.jsx(a3,{children:g.jsx(j_,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):g.jsx(Pme,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function Ea({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:a=2,textVariant:i="body2"}){const l=g.jsxs(Et,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:a},children:[g.jsx(tv,{size:t,color:n,thickness:r}),e&&g.jsx(gt,{variant:i,color:"text.secondary",children:e})]});return o?g.jsx(Et,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:l}):l}const _me=E.lazy(()=>Promise.resolve().then(()=>$we));function zv({result:e,maxHeight:t,maxResultSize:n=0}){const r=E.useRef(null),[o,a]=E.useState(t),[i,l]=E.useState(!1);if(!e)return null;if(n>0&&e.length>n&&!i)return g.jsxs(Et,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[g.jsx(kee,{sx:{fontSize:48,color:"#757575"}}),g.jsx(gt,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),g.jsx(Eo,{variant:"contained",color:"primary",onClick:()=>l(!0),children:"Proceed"})]});const c=g.jsx(Ea,{text:"Loading...",centered:!0,size:32}),d=Math.min(t,o);return g.jsx(Et,{ref:r,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden"},children:e&&g.jsx(E.Suspense,{fallback:c,children:g.jsx(_me,{result:e,height:d,onSizeChange:a})})})}function Lme({cell:e,sourceAndPaths:t,resourceUri:n,onQueryChange:r,onSourceChange:o}){const a={query:e.value,malloyResult:e.result?JSON.parse(e.result):void 0,malloyQuery:e.queryInfo?JSON.parse(e.queryInfo):void 0},i=t.findIndex(l=>l.sourceInfo.name===e.sourceName);return g.jsx(M6,{resourceUri:n,sourceAndPaths:t,selectedSourceIndex:i>=0?i:0,existingQuery:a,onQueryChange:r,onSourceChange:o})}function Fme({cell:e,editingMalloy:t,editingMarkdown:n,sourceAndPaths:r,resourceUri:o,onCellChange:a,onClose:i,onEdit:l,onDelete:c,addButtonCallback:d}){const[p,h]=E.useState(e.value),[b,y]=lt.useState(!1),[v,x]=lt.useState(!1),[C,S]=lt.useState(),[A]=lt.useState(),[T,M]=lt.useState(Fy()),[R,D]=lt.useState(!1),[F,j]=lt.useState(e.sourceName?r.findIndex(G=>G.sourceInfo.name===e.sourceName):0);E.useEffect(()=>{e.isMarkdown||Sb(e.value,"malloy").then(G=>{S(G)})},[e]),lt.useEffect(()=>{document.documentElement.setAttribute("data-color-mode","light")});const[z,B]=E.useState(!1),U=()=>{c(),B(!1)},w=r.length===0,L=lt.useCallback(()=>{const G=r[F],X=G?.modelPath||e.modelPath||"",H=G?.sourceInfo.name||e.sourceName||"";a({...e,value:e.isMarkdown?p:T.query,result:T.malloyResult?JSON.stringify(T.malloyResult):void 0,queryInfo:T.malloyQuery?JSON.stringify(T.malloyQuery):void 0,sourceName:H,modelPath:X})},[e,p,T,a,F,r]),I=g.jsx(Ho,{title:"Delete Cell",children:g.jsx(dr,{size:"small",onClick:()=>B(!0),children:g.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m2 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14zM10 11v6M14 11v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),$=g.jsxs(Os,{open:z,onClose:()=>B(!1),children:[g.jsx(Ps,{children:"Confirm Delete"}),g.jsx(Ns,{children:g.jsx(gt,{children:"Are you sure you want to delete this cell?"})}),g.jsxs(sT,{children:[g.jsx(Eo,{onClick:()=>B(!1),children:"Cancel"}),g.jsx(Eo,{onClick:U,color:"error",children:"Delete"})]})]}),_=()=>{L(),i()},q=e.isMarkdown?g.jsxs(g.Fragment,{children:[n?g.jsx(Ho,{title:"Save",children:g.jsx(dr,{size:"small",onClick:_,children:g.jsx(Yg,{})})}):g.jsx(Ho,{title:"Edit",children:g.jsx(dr,{size:"small",onClick:l,children:g.jsx(WO,{})})}),!n&&I]}):g.jsxs(g.Fragment,{children:[!t&&g.jsx(Ho,{title:b?"Hide Code":"View Code",children:g.jsx(dr,{size:"small",onClick:()=>{y(!b)},children:g.jsx(i3,{})})}),!t&&e.result&&g.jsx(Ho,{title:v?"Hide Embedding":"View Embedding",children:g.jsx(dr,{size:"small",onClick:()=>{x(!v)},children:g.jsx(LT,{})})}),t&&g.jsx(Ho,{title:"Save",children:g.jsx(dr,{size:"small",onClick:_,children:g.jsx(Yg,{})})}),!t&&g.jsx(Ho,{title:"Edit",children:g.jsx(dr,{size:"small",onClick:l,children:g.jsx(WO,{})})}),!t&&I]}),W=t||n,K=n?g.jsx(Ho,{title:"Save",children:g.jsx(dr,{size:"small",onClick:_,children:g.jsx(Yg,{})})}):t?g.jsx(Ho,{title:"Save",children:g.jsx(dr,{size:"small",onClick:_,children:g.jsx(Yg,{})})}):null,P=R&&g.jsx(Et,{sx:{position:"absolute",top:"4px",right:"4px",display:"flex",gap:"8px",backgroundColor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:"8px",padding:"2px 4px",boxShadow:1,zIndex:10},children:!W&&g.jsxs(g.Fragment,{children:[d(!0),d(!1),q]})||K});return g.jsxs(db,{sx:{position:"relative",marginTop:"5px",marginBottom:"5px",borderWidth:"1.5px",backgroundColor:"#fff",minHeight:"50px"},onMouseEnter:()=>D(!0),onMouseLeave:()=>{D(!1)},children:[P,e.isMarkdown?g.jsx(g.Fragment,{children:n?g.jsx(R6,{value:p,preview:"edit",autoFocus:!0,onChange:G=>{h(G),a({...e,value:G})},onBlur:()=>{L(),R||_()}}):g.jsx(Et,{sx:{px:.5,pt:0,mt:0,"& h1, & h2, & h3, & h4, & h5, & h6":{mt:.5,mb:.5},"& p":{mt:.5,mb:.5},"& ul, & ol":{mt:.5,mb:.5},"& li":{mt:0,mb:0},"& pre, & code":{mt:.5,mb:.5},"& blockquote":{mt:.5,mb:.5}},children:e.value?g.jsx(Et,{onClick:l,sx:{cursor:"pointer"},children:g.jsx(ib,{children:e.value})}):g.jsxs(Et,{onClick:l,sx:{cursor:"pointer"},children:[g.jsx(gt,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Markdown is empty"}),g.jsx(gt,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})})}):g.jsxs(g.Fragment,{children:[g.jsx(Qy,{in:v,timeout:"auto",unmountOnExit:!0,children:g.jsx(so,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:g.jsx(gt,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:A}})})}),g.jsx(Qy,{in:b,timeout:"auto",unmountOnExit:!0,children:g.jsx(so,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:g.jsx(gt,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:C}})})}),t&&(w?g.jsxs(g.Fragment,{children:[g.jsx(gt,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"No Model Imports"}),g.jsx(gt,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Please add a model import above."})]}):g.jsx(Lme,{sourceAndPaths:r,resourceUri:o,onQueryChange:G=>{M(G)},onSourceChange:G=>{j(G)},cell:e})),!t&&e.result&&g.jsx(db,{variant:"outlined",sx:{borderRadius:0},children:g.jsx(zv,{result:e.result,maxHeight:800})}),!t&&!e.result&&g.jsxs(Et,{onClick:l,sx:{cursor:"pointer"},children:[g.jsx(gt,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Explore is empty"}),g.jsx(gt,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})]}),z&&$]})}const O6=E.createContext(void 0);function Bme({children:e,workbookStorage:t}){const n=E.useMemo(()=>({workbookStorage:t}),[t]);return g.jsx(O6.Provider,{value:n,children:e})}function jme(){const e=E.useContext(O6);if(!e)throw new Error("useWorkbookStorage must be used within a WorkbookStorageProvider");return e}const Fs=fr(g.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),$me=fr(g.jsx("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3zM7 9l1.41 1.41L11 7.83V16h2V7.83l2.59 2.58L17 9l-5-5z"}));function Ca({error:e,context:t}){const n=e.data?.message||"Unknown Error";return g.jsxs(g.Fragment,{children:[t&&g.jsx(gt,{variant:"body2",sx:{p:"10px",m:"auto"},children:t}),g.jsx("pre",{style:{whiteSpace:"pre-wrap",color:"red",padding:"10px",margin:"auto"},children:n})]})}function zme({initialSelectedModels:e,onModelChange:t,resourceUri:n}){const{environmentName:r,packageName:o,versionId:a}=eo(n),{apiClients:i}=yr(),{data:l,isLoading:c,isSuccess:d,isError:p,error:h}=To({queryKey:["models",r,o,a],queryFn:()=>i.models.listModels(r,o,a)}),[b,y]=lt.useState(e||[]),[v,x]=lt.useState(null);lt.useEffect(()=>{y(e||[])},[e]);const C=T=>{const M=b.filter(R=>R!==T);y(M),t(M)},S=T=>{const M=[...b,T];y(M),t(M),x(null)};let A=[];return d&&l?.data&&(A=l.data.filter(T=>!b.includes(T.path)).map(T=>T.path)),p?g.jsx(Ca,{error:h,context:`${r} > ${o} > Model Picker`}):g.jsxs(g.Fragment,{children:[g.jsxs(_L,{fullWidth:!0,children:[c&&g.jsx(gt,{children:"Loading..."}),g.jsxs(so,{direction:"row",spacing:1,children:[b.map(T=>g.jsx(kL,{label:T,onDelete:()=>C(T),deleteIcon:g.jsx(Fs,{}),sx:{marginBottom:"5px"}},T)),g.jsx(Eo,{size:"small",startIcon:g.jsx($me,{}),onClick:T=>x(T.currentTarget),disabled:c||p||A.length===0,children:"Add Model"})]})]}),g.jsxs(Qd,{anchorEl:v,open:!!v,onClose:()=>x(null),children:[g.jsx(gt,{variant:"subtitle2",sx:{ml:1},children:"Models"}),g.jsx(Xi,{}),A.length===0?g.jsx(Bl,{disabled:!0,children:"No models available"}):A.map(T=>g.jsx(Bl,{onClick:()=>S(T),children:g.jsx(gt,{variant:"body2",children:T})},T))]})]})}function Ume(){const e=d_();return(t,n)=>{if(!n||!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.button!==1){e(t);return}const r=new URL(t,window.location.href).href;(n.metaKey||n.ctrlKey||n.button===1||n.shiftKey)&&window.open(r,"_blank")}}function Oke({workbookPath:e,resourceUri:t}){const n=Ume(),{server:r,getAccessToken:o}=yr(),{apiClients:a}=yr(),{workbookStorage:i}=jme(),{environmentName:l,packageName:c}=eo(t),[d,p]=lt.useState(void 0),[h,b]=lt.useState(void 0);if(!i)throw new Error("Workbook storage be provided via WorkbookStorageProvider");const[y,v]=lt.useState(),[x,C]=lt.useState(),[S,A]=lt.useState(),[T,M]=lt.useState([]),[R,D]=lt.useState(null),[F,j]=lt.useState(null),z=!!R,B=()=>{D(null),j(null)},U=(G,X)=>{y&&(v(y.insertCell(X,{isMarkdown:G,value:""})),G?A(X):C(X),B(),console.log("handleAddCell",G,X))},[w,L]=lt.useState(!1),I=()=>{L(!0)},$=async()=>{e&&i&&await i.deleteWorkbook(e).then(()=>{b(void 0),p(void 0)}).catch(G=>{b(`Error deleting workbook: ${G.message}`),p(void 0)}),L(!1),n(`/${l}/${c}`)},_=()=>{L(!1)},q=lt.useCallback(async()=>{if(!y){console.log("No workbook data ref");return}try{v(await y.saveWorkbook()),b(void 0),p("Workbook saved")}catch(G){b(`Error saving workbook: ${G.message}`),p(void 0)}},[y]);if(lt.useEffect(()=>{y&&(async()=>{const G=new Map(T.map(({modelPath:te,sourceInfos:Z})=>[te,Z])),X=[],H=[];for(const te of y.getModels())G.has(te)?X.push({modelPath:te,sourceInfos:G.get(te)}):(console.log("Fetching model from Publisher",te),H.push(a.models.getModel(l,c,te,void 0).then(Z=>({modelPath:te,sourceInfos:Z.data.sourceInfos.map(Y=>JSON.parse(Y))}))));if(H.length>0){const te=await Promise.all(H);M([...X,...te])}else M(X)})()},[o,y,c,l,r]),lt.useEffect(()=>{e&&th.loadWorkbook(i,e).then(G=>{v(G)})},[e,i]),!y)return g.jsx("div",{children:"Loading..."});const W=G=>{const X=[];for(const H of G)for(const te of H.sourceInfos)X.push({modelPath:H.modelPath,sourceInfo:te});return X},K=(G,X)=>g.jsx(Eo,{size:"small",startIcon:g.jsx(IT,{}),onClick:()=>U(G,X),variant:"contained",sx:{backgroundColor:"#fff",color:H=>H.palette.mode==="dark"?H.palette.grey[100]:H.palette.grey[700],boxShadow:"none","&:hover":{backgroundColor:H=>H.palette.mode==="dark"?H.palette.grey[500]:H.palette.grey[300],boxShadow:"none"}},children:G?"Markdown":"Explore"}),P=g.jsxs(Et,{sx:{display:"flex",gap:1,justifyContent:"center",flex:2},children:[K(!1,y.getCells().length),K(!0,y.getCells().length)]});return g.jsxs(db,{variant:"outlined",children:[g.jsxs(o3,{children:[g.jsx(Et,{sx:{mb:2},children:g.jsx(Et,{sx:{minHeight:"24px"},children:h?g.jsx(gt,{color:"error",variant:"body2",children:h}):d?g.jsx(gt,{color:"success",variant:"body2",children:d}):g.jsx("span",{children:" "})})}),g.jsxs(ed,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[g.jsxs(ed,{direction:"row",spacing:1,alignItems:"center",children:[g.jsx(gt,{variant:"overline",sx:{fontSize:"13px",fontWeight:"bold",verticalAlign:"middle"},children:"Workbook"}),g.jsx(gt,{variant:"subtitle2",sx:{fontSize:"13px",fontWeight:"normal",verticalAlign:"middle",ml:1},children:`${e.workspace} > ${e.path}`})]}),g.jsxs(ed,{sx:{display:"flex",flexDirection:"row",gap:1},children:[g.jsx(Et,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:g.jsx(Hme,{workbookData:y})}),g.jsxs(Et,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:[g.jsx(Eo,{color:"error",onClick:I,size:"small",children:"Delete"}),g.jsxs(Os,{open:w,onClose:_,children:[g.jsx(Ps,{children:"Delete Workbook"}),g.jsx(Ns,{children:g.jsxs(tY,{children:['Are you sure you want to delete the workbook "',e.path,'"? This action cannot be undone.']})}),g.jsxs(sT,{children:[g.jsx(Eo,{onClick:_,color:"primary",size:"small",children:"Cancel"}),g.jsx(Eo,{onClick:$,color:"error",autoFocus:!0,size:"small",children:"Delete"})]})]})]})]})]}),g.jsx(Xi,{}),g.jsxs(ed,{sx:{display:"flex",flexDirection:"row",width:"100%",mt:2},children:[g.jsx(Et,{sx:{flex:1},children:g.jsx(zme,{initialSelectedModels:y.getModels(),onModelChange:G=>{v(y.setModels(G)),q()},resourceUri:t})}),g.jsx(Et,{sx:{flex:1}})]})]}),g.jsx(_T,{children:g.jsxs(ed,{children:[y.getCells().length===0&&g.jsxs(g.Fragment,{children:[g.jsx(gt,{sx:{textAlign:"center",p:2,variant:"subtitle2",fontWeight:"medium"},children:"Workbook is empty"}),g.jsx(gt,{variant:"body2",sx:{textAlign:"center",mb:2,variant:"body2"},children:"Click the + buttons to add a markdown or code cell."})]}),y.getCells().map((G,X)=>g.jsx(lt.Fragment,{children:g.jsx(Fme,{cell:G,resourceUri:t,addButtonCallback:H=>K(H,X),sourceAndPaths:W(T),editingMarkdown:S===X,editingMalloy:x===X,onDelete:()=>{v(y.deleteCell(X)),q()},onCellChange:H=>{v(y.setCell(X,H))},onEdit:()=>{G.isMarkdown?A(X):C(X)},onClose:()=>{G.isMarkdown?A(void 0):C(void 0),q()}},`${X}-${G.isMarkdown}-${e.workspace}-${e.path}`)},`${X}-${y.getCells().length}`)),P,g.jsxs(Qd,{anchorEl:R,open:z,onClose:B,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[g.jsx(Bl,{onClick:()=>U(!0,F??0),children:"Add Markdown"}),g.jsx(Bl,{onClick:()=>U(!1,F??0),children:"Add Malloy"})]}),g.jsx(ed,{sx:{flexDirection:"row",justifyContent:"flex-end",p:1}})]})})]})}function Hme({workbookData:e}){const[t,n]=lt.useState(!1);return g.jsx(Eo,{color:"primary",onClick:async()=>{if(!e)return;const r=e.toMalloyWorkbook();try{await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1500)}catch{n(!1),alert("Failed to copy to clipboard")}},size:"small",children:t?"Copied!":"Export"})}const wP="Local";class Vme{async listWorkspaces(t){return Promise.resolve([{name:wP,description:"Stored locally- only accessible to this browser",writeable:!0}])}async listWorkbooks(t){const n=[];for(let r=0;r<localStorage.length;r++){const o=localStorage.key(r);n.push({path:o,workspace:wP})}return n}async getWorkbook(t){const n=localStorage.getItem(t.path);if(n===null)throw new Error(`Notebook not found at path: ${t}`);return n}async deleteWorkbook(t){if(localStorage.getItem(t.path)===null)throw new Error(`Notebook not found at path: ${t}`);localStorage.removeItem(t.path)}async saveWorkbook(t,n){localStorage.setItem(t.path,n)}async moveWorkbook(t,n){const r=localStorage.getItem(t.path);if(r===null)throw new Error(`Notebook not found at path: ${t.path}`);localStorage.setItem(n.path,r),localStorage.removeItem(t.path)}}function Wme({resourceUri:e}){const{environmentName:t}=eo(e),{apiClients:n}=yr(),[r,o]=E.useState(!1),a=90,{data:i,isSuccess:l,isError:c,error:d}=To({queryKey:["about",t],queryFn:()=>n.environments.getEnvironment(t,!1)}),p=i?.data?.readme||"",h=p.split(/\s+/),b=h.length>a,y=h.slice(0,a).join(" ");return g.jsxs(g.Fragment,{children:[!l&&!c&&g.jsx(Ea,{text:"Fetching About..."}),l&&p&&g.jsx(rre,{children:g.jsxs(ore,{children:[g.jsx(are,{children:"Readme"}),g.jsxs(Et,{sx:{mt:1,fontSize:"0.875rem",lineHeight:1.6},children:[g.jsx(ib,{options:{overrides:{h1:{component:"p",props:{style:{fontSize:"inherit",fontWeight:"italic"}}},h2:{component:"p",props:{style:{fontSize:"inherit",fontWeight:"italic"}}},h3:{component:"p",props:{style:{fontSize:"inherit",fontWeight:"italic"}}}}},children:r||!b?p:y}),b&&g.jsxs(Et,{sx:{mt:1},children:[" ",g.jsx(Eo,{variant:"text",size:"small",onClick:()=>o(!r),children:r?"Read less":"Read more"})]})]})]})}),c&&g.jsx(Ca,{error:d,context:`${t} > About`})]})}function qme({resourceUri:e}){const[t,n]=E.useState(!1),{apiClients:r}=yr(),o=Us(),[a,i]=E.useState(""),{environmentName:l}=eo(e),c=Yi({async mutationFn(d){return r.packages.createPackage(l,{name:d.name,description:d.description,location:d.location})},onSuccess(){n(!1),i("Package created successfully"),o.invalidateQueries({queryKey:["packages",l]})},onError(d){i(d instanceof Error?d.message:"An unknown error occurred")}});return g.jsxs(g.Fragment,{children:[g.jsx(Eo,{onClick:()=>n(!0),variant:"contained",color:"primary",startIcon:g.jsx(Tee,{}),children:"Add Package"}),g.jsxs(Os,{open:t,onClose:()=>n(!1),maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:2}},children:[g.jsx(Ps,{sx:{fontSize:"1.25rem",fontWeight:600,letterSpacing:"-0.025em",pt:3,pb:1,px:3},children:"Create New Package"}),g.jsxs(Ns,{sx:{px:3,pb:0},children:[g.jsxs(Et,{sx:{mb:3},children:[g.jsx(gt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:"Create a new Malloy package to start exploring your data."}),g.jsx(gt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:"The location can be a GitHub/S3/GCP URL containing a package (zipped or unzipped), or an absolute path to a directory the publisher server has access to."}),g.jsxs(gt,{variant:"body2",color:"text.secondary",children:["Make sure to conform to the"," ",g.jsx(Et,{component:"a",href:"https://github.com/malloydata/publisher/blob/main/README.md#architecture-overview",target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary",textDecoration:"underline"},children:"Malloy Package Format"}),"."]})]}),g.jsx("form",{onSubmit:d=>{d.preventDefault();const p=new FormData(d.currentTarget),h=p.get("name")?.toString(),b=p.get("description")?.toString(),y=p.get("location")?.toString();c.mutate({name:h,description:b,location:y})},id:"package-form",children:g.jsxs(so,{spacing:2.5,children:[g.jsx(Pc,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Package Name",type:"text",fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:{shrink:!0}}),g.jsx(Pc,{id:"description",name:"description",label:"Description",multiline:!0,rows:3,fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:{shrink:!0}}),g.jsx(Pc,{id:"location",name:"location",label:"Location",type:"text",placeholder:"e.g. s3://my-bucket/my-package.zip",fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:{shrink:!0}})]})})]}),g.jsxs(sT,{sx:{px:3,pt:2,pb:3,gap:1},children:[g.jsx(Eo,{variant:"outlined",disabled:c.isPending,onClick:()=>n(!1),children:"Cancel"}),g.jsx(Eo,{type:"submit",form:"package-form",variant:"contained",loading:c.isPending,children:"Save Changes"})]})]}),g.jsx(zs,{open:a!=="",autoHideDuration:6e3,onClose:()=>i(""),message:a})]})}const Gme=fr(g.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),N6=fr(g.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}));function P6(e){const{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:Nh(t.components[n].defaultProps,r)}function Yme({props:e,name:t,defaultTheme:n,themeId:r}){let o=ine(n);return o=o[r]||o,P6({theme:o,name:t,props:e})}function vr({props:e,name:t}){return Yme({props:e,name:t,defaultTheme:Dv,themeId:ep})}const Kme=At("MuiBox",["root"]),Qme=e3(),br=BC({themeId:ep,defaultTheme:Qme,defaultClassName:Kme.root,generateClassName:$5.generate}),I6=Le.oneOfType([Le.func,Le.object]);function kP(e){try{return e.matches(":focus-visible")}catch{}return!1}const AP={};function _6(e,t){const n=E.useRef(AP);return n.current===AP&&(n.current=e(t)),n}class Eb{static create(){return new Eb}static use(){const t=_6(Eb.create).current,[n,r]=E.useState(!1);return t.shouldMount=n,t.setShouldMount=r,E.useEffect(t.mountEffect,[n]),t}constructor(){this.ref={current:null},this.mounted=null,this.didMount=!1,this.shouldMount=!1,this.setShouldMount=null}mount(){return this.mounted||(this.mounted=Zme(),this.shouldMount=!0,this.setShouldMount(this.shouldMount)),this.mounted}mountEffect=()=>{this.shouldMount&&!this.didMount&&this.ref.current!==null&&(this.didMount=!0,this.mounted.resolve())};start(...t){this.mount().then(()=>this.ref.current?.start(...t))}stop(...t){this.mount().then(()=>this.ref.current?.stop(...t))}pulsate(...t){this.mount().then(()=>this.ref.current?.pulsate(...t))}}function Xme(){return Eb.use()}function Zme(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n}function WE(e,t){return WE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},WE(e,t)}function gw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,WE(e,t)}function Jme(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function ege(e,t){e.classList?e.classList.add(t):Jme(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function DP(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function tge(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=DP(e.className,t):e.setAttribute("class",DP(e.className&&e.className.baseVal||"",t))}const RP={disabled:!1},Cb=lt.createContext(null);var L6=function(e){return e.scrollTop},Gf="unmounted",xc="exited",Sc="entering",cd="entered",qE="exiting",Ei=(function(e){gw(t,e);function t(r,o){var a;a=e.call(this,r,o)||this;var i=o,l=i&&!i.isMounting?r.enter:r.appear,c;return a.appearStatus=null,r.in?l?(c=xc,a.appearStatus=Sc):c=cd:r.unmountOnExit||r.mountOnEnter?c=Gf:c=xc,a.state={status:c},a.nextCallback=null,a}t.getDerivedStateFromProps=function(r,o){var a=r.in;return a&&o.status===Gf?{status:xc}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(r){var o=null;if(r!==this.props){var a=this.state.status;this.props.in?a!==Sc&&a!==cd&&(o=Sc):(a===Sc||a===cd)&&(o=qE)}this.updateStatus(!1,o)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var r=this.props.timeout,o,a,i;return o=a=i=r,r!=null&&typeof r!="number"&&(o=r.exit,a=r.enter,i=r.appear!==void 0?r.appear:a),{exit:o,enter:a,appear:i}},n.updateStatus=function(r,o){if(r===void 0&&(r=!1),o!==null)if(this.cancelNextCallback(),o===Sc){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:Dl.findDOMNode(this);a&&L6(a)}this.performEnter(r)}else this.performExit();else this.props.unmountOnExit&&this.state.status===xc&&this.setState({status:Gf})},n.performEnter=function(r){var o=this,a=this.props.enter,i=this.context?this.context.isMounting:r,l=this.props.nodeRef?[i]:[Dl.findDOMNode(this),i],c=l[0],d=l[1],p=this.getTimeouts(),h=i?p.appear:p.enter;if(!r&&!a||RP.disabled){this.safeSetState({status:cd},function(){o.props.onEntered(c)});return}this.props.onEnter(c,d),this.safeSetState({status:Sc},function(){o.props.onEntering(c,d),o.onTransitionEnd(h,function(){o.safeSetState({status:cd},function(){o.props.onEntered(c,d)})})})},n.performExit=function(){var r=this,o=this.props.exit,a=this.getTimeouts(),i=this.props.nodeRef?void 0:Dl.findDOMNode(this);if(!o||RP.disabled){this.safeSetState({status:xc},function(){r.props.onExited(i)});return}this.props.onExit(i),this.safeSetState({status:qE},function(){r.props.onExiting(i),r.onTransitionEnd(a.exit,function(){r.safeSetState({status:xc},function(){r.props.onExited(i)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(r,o){o=this.setNextCallback(o),this.setState(r,o)},n.setNextCallback=function(r){var o=this,a=!0;return this.nextCallback=function(i){a&&(a=!1,o.nextCallback=null,r(i))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},n.onTransitionEnd=function(r,o){this.setNextCallback(o);var a=this.props.nodeRef?this.props.nodeRef.current:Dl.findDOMNode(this),i=r==null&&!this.props.addEndListener;if(!a||i){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],c=l[0],d=l[1];this.props.addEndListener(c,d)}r!=null&&setTimeout(this.nextCallback,r)},n.render=function(){var r=this.state.status;if(r===Gf)return null;var o=this.props,a=o.children;o.in,o.mountOnEnter,o.unmountOnExit,o.appear,o.enter,o.exit,o.timeout,o.addEndListener,o.onEnter,o.onEntering,o.onEntered,o.onExit,o.onExiting,o.onExited,o.nodeRef;var i=Xt(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return lt.createElement(Cb.Provider,{value:null},typeof a=="function"?a(r,i):lt.cloneElement(lt.Children.only(a),i))},t})(lt.Component);Ei.contextType=Cb;Ei.propTypes={};function od(){}Ei.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:od,onEntering:od,onEntered:od,onExit:od,onExiting:od,onExited:od};Ei.UNMOUNTED=Gf;Ei.EXITED=xc;Ei.ENTERING=Sc;Ei.ENTERED=cd;Ei.EXITING=qE;var nge=function(e,t){return e&&t&&t.split(" ").forEach(function(n){return ege(e,n)})},vS=function(e,t){return e&&t&&t.split(" ").forEach(function(n){return tge(e,n)})},yw=(function(e){gw(t,e);function t(){for(var r,o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return r=e.call.apply(e,[this].concat(a))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(l,c){var d=r.resolveArguments(l,c),p=d[0],h=d[1];r.removeClasses(p,"exit"),r.addClass(p,h?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(l,c)},r.onEntering=function(l,c){var d=r.resolveArguments(l,c),p=d[0],h=d[1],b=h?"appear":"enter";r.addClass(p,b,"active"),r.props.onEntering&&r.props.onEntering(l,c)},r.onEntered=function(l,c){var d=r.resolveArguments(l,c),p=d[0],h=d[1],b=h?"appear":"enter";r.removeClasses(p,b),r.addClass(p,b,"done"),r.props.onEntered&&r.props.onEntered(l,c)},r.onExit=function(l){var c=r.resolveArguments(l),d=c[0];r.removeClasses(d,"appear"),r.removeClasses(d,"enter"),r.addClass(d,"exit","base"),r.props.onExit&&r.props.onExit(l)},r.onExiting=function(l){var c=r.resolveArguments(l),d=c[0];r.addClass(d,"exit","active"),r.props.onExiting&&r.props.onExiting(l)},r.onExited=function(l){var c=r.resolveArguments(l),d=c[0];r.removeClasses(d,"exit"),r.addClass(d,"exit","done"),r.props.onExited&&r.props.onExited(l)},r.resolveArguments=function(l,c){return r.props.nodeRef?[r.props.nodeRef.current,l]:[l,c]},r.getClassNames=function(l){var c=r.props.classNames,d=typeof c=="string",p=d&&c?c+"-":"",h=d?""+p+l:c[l],b=d?h+"-active":c[l+"Active"],y=d?h+"-done":c[l+"Done"];return{baseClassName:h,activeClassName:b,doneClassName:y}},r}var n=t.prototype;return n.addClass=function(r,o,a){var i=this.getClassNames(o)[a+"ClassName"],l=this.getClassNames("enter"),c=l.doneClassName;o==="appear"&&a==="done"&&c&&(i+=" "+c),a==="active"&&r&&L6(r),i&&(this.appliedClasses[o][a]=i,nge(r,i))},n.removeClasses=function(r,o){var a=this.appliedClasses[o],i=a.base,l=a.active,c=a.done;this.appliedClasses[o]={},i&&vS(r,i),l&&vS(r,l),c&&vS(r,c)},n.render=function(){var r=this.props;r.classNames;var o=Xt(r,["classNames"]);return lt.createElement(Ei,he({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t})(lt.Component);yw.defaultProps={classNames:""};yw.propTypes={};function rge(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bw(e,t){var n=function(o){return t&&E.isValidElement(o)?t(o):o},r=Object.create(null);return e&&E.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function oge(e,t){e=e||{},t=t||{};function n(p){return p in t?t[p]:e[p]}var r=Object.create(null),o=[];for(var a in e)a in t?o.length&&(r[a]=o,o=[]):o.push(a);var i,l={};for(var c in t){if(r[c])for(i=0;i<r[c].length;i++){var d=r[c][i];l[r[c][i]]=n(d)}l[c]=n(c)}for(i=0;i<o.length;i++)l[o[i]]=n(o[i]);return l}function Mc(e,t,n){return n[t]!=null?n[t]:e.props[t]}function age(e,t){return bw(e.children,function(n){return E.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:Mc(n,"appear",e),enter:Mc(n,"enter",e),exit:Mc(n,"exit",e)})})}function ige(e,t,n){var r=bw(e.children),o=oge(t,r);return Object.keys(o).forEach(function(a){var i=o[a];if(E.isValidElement(i)){var l=a in t,c=a in r,d=t[a],p=E.isValidElement(d)&&!d.props.in;c&&(!l||p)?o[a]=E.cloneElement(i,{onExited:n.bind(null,i),in:!0,exit:Mc(i,"exit",e),enter:Mc(i,"enter",e)}):!c&&l&&!p?o[a]=E.cloneElement(i,{in:!1}):c&&l&&E.isValidElement(d)&&(o[a]=E.cloneElement(i,{onExited:n.bind(null,i),in:d.props.in,exit:Mc(i,"exit",e),enter:Mc(i,"enter",e)}))}}),o}var sge=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},lge={component:"div",childFactory:function(e){return e}},mm=(function(e){gw(t,e);function t(r,o){var a;a=e.call(this,r,o)||this;var i=a.handleExited.bind(rge(a));return a.state={contextValue:{isMounting:!0},handleExited:i,firstRender:!0},a}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(r,o){var a=o.children,i=o.handleExited,l=o.firstRender;return{children:l?age(r,i):ige(r,a,i),firstRender:!1}},n.handleExited=function(r,o){var a=bw(this.props.children);r.key in a||(r.props.onExited&&r.props.onExited(o),this.mounted&&this.setState(function(i){var l=he({},i.children);return delete l[r.key],{children:l}}))},n.render=function(){var r=this.props,o=r.component,a=r.childFactory,i=Xt(r,["component","childFactory"]),l=this.state.contextValue,c=sge(this.state.children).map(a);return delete i.appear,delete i.enter,delete i.exit,o===null?lt.createElement(Cb.Provider,{value:l},c):lt.createElement(Cb.Provider,{value:l},lt.createElement(o,i,c))},t})(lt.Component);mm.propTypes={};mm.defaultProps=lge;const cge=[];function uge(e){E.useEffect(e,cge)}class vw{static create(){return new vw}currentId=null;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,n()},t)}clear=()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function xw(){const e=_6(vw.create).current;return uge(e.disposeEffect),e}function dge(e){const{className:t,classes:n,pulsate:r=!1,rippleX:o,rippleY:a,rippleSize:i,in:l,onExited:c,timeout:d}=e,[p,h]=E.useState(!1),b=yt(t,n.ripple,n.rippleVisible,r&&n.ripplePulsate),y={width:i,height:i,top:-(i/2)+a,left:-(i/2)+o},v=yt(n.child,p&&n.childLeaving,r&&n.childPulsate);return!l&&!p&&h(!0),E.useEffect(()=>{if(!l&&c!=null){const x=setTimeout(c,d);return()=>{clearTimeout(x)}}},[c,l,d]),g.jsx("span",{className:b,style:y,children:g.jsx("span",{className:v})})}const Ua=At("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),GE=550,pge=80,fge=ts`
326
+ `).length,length:be.target.value.length}))}};return g.jsx(sp.Provider,{value:he({},K,{dispatch:P}),children:g.jsxs("div",he({ref:G,className:te},_,{onClick:le,style:ie,children:[g.jsx(TP,{hideToolbar:w,toolbarBottom:L,prefixCls:r,overflow:C,placement:"top"}),g.jsxs("div",{className:r+"-content",children:[/(edit|live)/.test(K.preview||"")&&g.jsx(Cme,he({className:r+"-input",prefixCls:r,autoFocus:R},A,{onChange:Ee,renderTextarea:I?.textarea||$,onScroll:be=>J(be,"text")})),/(live|preview)/.test(K.preview||"")&&ue]}),b&&!K.fullscreen&&g.jsx(wme,{prefixCls:r,height:K.height,maxHeight:T,minHeight:M,onChange:je}),g.jsx(TP,{hideToolbar:w,toolbarBottom:L,prefixCls:r,overflow:C,placement:"bottom"})]}))})}),R6=Dme;R6.Markdown=S6;const yS={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"}]}}},Rme={...yS,patterns:[...yS.patterns,{include:"#docvar"}],repository:{...yS.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},Mme={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"}]}}},Ome="github-light";let bS;function Nme(){return bS||(bS=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:a}]=await Promise.all([fo(()=>import("./core-B3IQNPBD.es-foBNuT8L.js"),__vite__mapDeps([0,1])),fo(()=>import("./engine-oniguruma-C4vnmooL.es-jdkXmgTr.js"),[]),fo(()=>import("./sql-DCkt643-.es-COK4E0Yg.js"),[]),fo(()=>import("./json-71t8ZF9g.es-BQoSv7ci.js"),[]),fo(()=>import("./typescript-buWNZFwO.es-Dj6nwHGl.js"),[]),fo(()=>import("./github-light-JYsPkUQd.es-DAi9KRSo.js"),[])]);return e({engine:t(fo(()=>import("./wasm-DQxwEHae.es-CG6Dc4jp.js"),[])),themes:[a],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...Rme},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...Mme}]})})()),bS}async function Sb(e,t){return(await Nme()).codeToHtml(e,{lang:t,theme:Ome})}function To(e){const{server:t}=yr(),n={...e,queryKey:[...e.queryKey,t],queryFn:async()=>{try{return await e.queryFn()}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const 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 vX(n,ST)}function Yi(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 xX(t,ST)}const eo=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},mw=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 M6({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a}){return lt.useEffect(()=>{o&&o(t)},[t,o]),g.jsx(_T,{children:g.jsxs(WU,{spacing:2,component:"section",children:[g.jsx(Ime,{sourceAndPath:e[t],existingQuery:n,onChange:i=>{r&&r(i)},resourceUri:a}),g.jsx(j_,{height:"5px"})]})})}function Fy(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function Pme({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a}){const[i,l]=lt.useState(n||Fy()),[c,d]=lt.useState(void 0);lt.useEffect(()=>{n&&l(n)},[n]);const[p,h]=lt.useState([]),{MalloyExplorerProvider:b,QueryPanel:y,ResizableCollapsiblePanel:v,ResultPanel:x,SourcePanel:C}=r;lt.useEffect(()=>{t&&t(i)},[t,i]);const{environmentName:S,packageName:A,versionId:T}=eo(a),{apiClients:M}=yr(),R=Yi({mutationFn:()=>{const z=typeof i?.malloyQuery=="string"?i.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:i?.malloyQuery}).toMalloy();return d({executionState:"running",query:i?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{R.reset(),d(void 0)},response:{result:{}}}),l({...i,query:z}),M.models.executeQueryModel(S,A,e.modelPath,{query:z,sourceName:void 0,queryName:void 0,versionId:T})},onSuccess:z=>{if(z){const B=JSON.parse(z.data.result);l({...i,malloyResult:B}),d(U=>U?{...U,executionState:"finished",response:{result:B}}:void 0)}},onError:z=>{d(void 0),console.error("Query execution error:",z)}}),[D,F]=lt.useState(e.sourceInfo.name);lt.useEffect(()=>{D!==e.sourceInfo.name&&(F(e.sourceInfo.name),l(Fy()),d(void 0))},[e,D]);const j=lt.useCallback(z=>{l({...i,malloyQuery:z,malloyResult:void 0})},[i]);return D!==e.sourceInfo.name?g.jsx("div",{children:"Loading..."}):g.jsx(a3,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:g.jsx(b,{source:e.sourceInfo,query:i?.malloyQuery,topValues:[],onFocusedNestViewPathChange:h,focusedNestViewPath:p,onQueryChange:j,children:g.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[g.jsx(v,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:g.jsx(C,{onRefresh:()=>l(Fy())})}),g.jsx(v,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:g.jsx(y,{runQuery:()=>{console.log(`running query with: ${i?.malloyQuery}`);try{R.mutate()}catch(z){console.error("Error running query:",z)}}})}),g.jsx(x,{source:e.sourceInfo,draftQuery:i?.malloyQuery,setDraftQuery:z=>l({...i,malloyQuery:z}),submittedQuery:c,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function Ime(e){const[t,n]=E.useState(null),[r,o]=E.useState(null),[a,i]=E.useState(!0);return E.useEffect(()=>{let l=!0;return Promise.all([fo(()=>import("./index-B5We8x8r.js"),__vite__mapDeps([2,3,4])),fo(()=>import("./index-KIvi9k3F.js").then(c=>c.i),[])]).then(([c,d])=>{l&&(n(c),o(d),i(!1))}).catch(c=>{console.error("Failed to load Malloy components:",c),l&&i(!1)}),()=>{l=!1}},[]),a||!t||!r?g.jsx(nre,{children:g.jsx(a3,{children:g.jsx(j_,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):g.jsx(Pme,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function Ea({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:a=2,textVariant:i="body2"}){const l=g.jsxs(Et,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:a},children:[g.jsx(tv,{size:t,color:n,thickness:r}),e&&g.jsx(gt,{variant:i,color:"text.secondary",children:e})]});return o?g.jsx(Et,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:l}):l}const _me=E.lazy(()=>Promise.resolve().then(()=>$we));function zv({result:e,maxHeight:t,maxResultSize:n=0}){const r=E.useRef(null),[o,a]=E.useState(t),[i,l]=E.useState(!1);if(!e)return null;if(n>0&&e.length>n&&!i)return g.jsxs(Et,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[g.jsx(kee,{sx:{fontSize:48,color:"#757575"}}),g.jsx(gt,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),g.jsx(Eo,{variant:"contained",color:"primary",onClick:()=>l(!0),children:"Proceed"})]});const c=g.jsx(Ea,{text:"Loading...",centered:!0,size:32}),d=Math.min(t,o);return g.jsx(Et,{ref:r,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden"},children:e&&g.jsx(E.Suspense,{fallback:c,children:g.jsx(_me,{result:e,height:d,onSizeChange:a})})})}function Lme({cell:e,sourceAndPaths:t,resourceUri:n,onQueryChange:r,onSourceChange:o}){const a={query:e.value,malloyResult:e.result?JSON.parse(e.result):void 0,malloyQuery:e.queryInfo?JSON.parse(e.queryInfo):void 0},i=t.findIndex(l=>l.sourceInfo.name===e.sourceName);return g.jsx(M6,{resourceUri:n,sourceAndPaths:t,selectedSourceIndex:i>=0?i:0,existingQuery:a,onQueryChange:r,onSourceChange:o})}function Fme({cell:e,editingMalloy:t,editingMarkdown:n,sourceAndPaths:r,resourceUri:o,onCellChange:a,onClose:i,onEdit:l,onDelete:c,addButtonCallback:d}){const[p,h]=E.useState(e.value),[b,y]=lt.useState(!1),[v,x]=lt.useState(!1),[C,S]=lt.useState(),[A]=lt.useState(),[T,M]=lt.useState(Fy()),[R,D]=lt.useState(!1),[F,j]=lt.useState(e.sourceName?r.findIndex(G=>G.sourceInfo.name===e.sourceName):0);E.useEffect(()=>{e.isMarkdown||Sb(e.value,"malloy").then(G=>{S(G)})},[e]),lt.useEffect(()=>{document.documentElement.setAttribute("data-color-mode","light")});const[z,B]=E.useState(!1),U=()=>{c(),B(!1)},w=r.length===0,L=lt.useCallback(()=>{const G=r[F],X=G?.modelPath||e.modelPath||"",H=G?.sourceInfo.name||e.sourceName||"";a({...e,value:e.isMarkdown?p:T.query,result:T.malloyResult?JSON.stringify(T.malloyResult):void 0,queryInfo:T.malloyQuery?JSON.stringify(T.malloyQuery):void 0,sourceName:H,modelPath:X})},[e,p,T,a,F,r]),I=g.jsx(Ho,{title:"Delete Cell",children:g.jsx(dr,{size:"small",onClick:()=>B(!0),children:g.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m2 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14zM10 11v6M14 11v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),$=g.jsxs(Os,{open:z,onClose:()=>B(!1),children:[g.jsx(Ps,{children:"Confirm Delete"}),g.jsx(Ns,{children:g.jsx(gt,{children:"Are you sure you want to delete this cell?"})}),g.jsxs(sT,{children:[g.jsx(Eo,{onClick:()=>B(!1),children:"Cancel"}),g.jsx(Eo,{onClick:U,color:"error",children:"Delete"})]})]}),_=()=>{L(),i()},q=e.isMarkdown?g.jsxs(g.Fragment,{children:[n?g.jsx(Ho,{title:"Save",children:g.jsx(dr,{size:"small",onClick:_,children:g.jsx(Yg,{})})}):g.jsx(Ho,{title:"Edit",children:g.jsx(dr,{size:"small",onClick:l,children:g.jsx(WO,{})})}),!n&&I]}):g.jsxs(g.Fragment,{children:[!t&&g.jsx(Ho,{title:b?"Hide Code":"View Code",children:g.jsx(dr,{size:"small",onClick:()=>{y(!b)},children:g.jsx(i3,{})})}),!t&&e.result&&g.jsx(Ho,{title:v?"Hide Embedding":"View Embedding",children:g.jsx(dr,{size:"small",onClick:()=>{x(!v)},children:g.jsx(LT,{})})}),t&&g.jsx(Ho,{title:"Save",children:g.jsx(dr,{size:"small",onClick:_,children:g.jsx(Yg,{})})}),!t&&g.jsx(Ho,{title:"Edit",children:g.jsx(dr,{size:"small",onClick:l,children:g.jsx(WO,{})})}),!t&&I]}),W=t||n,K=n?g.jsx(Ho,{title:"Save",children:g.jsx(dr,{size:"small",onClick:_,children:g.jsx(Yg,{})})}):t?g.jsx(Ho,{title:"Save",children:g.jsx(dr,{size:"small",onClick:_,children:g.jsx(Yg,{})})}):null,P=R&&g.jsx(Et,{sx:{position:"absolute",top:"4px",right:"4px",display:"flex",gap:"8px",backgroundColor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:"8px",padding:"2px 4px",boxShadow:1,zIndex:10},children:!W&&g.jsxs(g.Fragment,{children:[d(!0),d(!1),q]})||K});return g.jsxs(db,{sx:{position:"relative",marginTop:"5px",marginBottom:"5px",borderWidth:"1.5px",backgroundColor:"#fff",minHeight:"50px"},onMouseEnter:()=>D(!0),onMouseLeave:()=>{D(!1)},children:[P,e.isMarkdown?g.jsx(g.Fragment,{children:n?g.jsx(R6,{value:p,preview:"edit",autoFocus:!0,onChange:G=>{h(G),a({...e,value:G})},onBlur:()=>{L(),R||_()}}):g.jsx(Et,{sx:{px:.5,pt:0,mt:0,"& h1, & h2, & h3, & h4, & h5, & h6":{mt:.5,mb:.5},"& p":{mt:.5,mb:.5},"& ul, & ol":{mt:.5,mb:.5},"& li":{mt:0,mb:0},"& pre, & code":{mt:.5,mb:.5},"& blockquote":{mt:.5,mb:.5}},children:e.value?g.jsx(Et,{onClick:l,sx:{cursor:"pointer"},children:g.jsx(ib,{children:e.value})}):g.jsxs(Et,{onClick:l,sx:{cursor:"pointer"},children:[g.jsx(gt,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Markdown is empty"}),g.jsx(gt,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})})}):g.jsxs(g.Fragment,{children:[g.jsx(Qy,{in:v,timeout:"auto",unmountOnExit:!0,children:g.jsx(so,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:g.jsx(gt,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:A}})})}),g.jsx(Qy,{in:b,timeout:"auto",unmountOnExit:!0,children:g.jsx(so,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:g.jsx(gt,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:C}})})}),t&&(w?g.jsxs(g.Fragment,{children:[g.jsx(gt,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"No Model Imports"}),g.jsx(gt,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Please add a model import above."})]}):g.jsx(Lme,{sourceAndPaths:r,resourceUri:o,onQueryChange:G=>{M(G)},onSourceChange:G=>{j(G)},cell:e})),!t&&e.result&&g.jsx(db,{variant:"outlined",sx:{borderRadius:0},children:g.jsx(zv,{result:e.result,maxHeight:800})}),!t&&!e.result&&g.jsxs(Et,{onClick:l,sx:{cursor:"pointer"},children:[g.jsx(gt,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Explore is empty"}),g.jsx(gt,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})]}),z&&$]})}const O6=E.createContext(void 0);function Bme({children:e,workbookStorage:t}){const n=E.useMemo(()=>({workbookStorage:t}),[t]);return g.jsx(O6.Provider,{value:n,children:e})}function jme(){const e=E.useContext(O6);if(!e)throw new Error("useWorkbookStorage must be used within a WorkbookStorageProvider");return e}const Fs=fr(g.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),$me=fr(g.jsx("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3zM7 9l1.41 1.41L11 7.83V16h2V7.83l2.59 2.58L17 9l-5-5z"}));function Ca({error:e,context:t}){const n=e.data?.message||"Unknown Error";return g.jsxs(g.Fragment,{children:[t&&g.jsx(gt,{variant:"body2",sx:{p:"10px",m:"auto"},children:t}),g.jsx("pre",{style:{whiteSpace:"pre-wrap",color:"red",padding:"10px",margin:"auto"},children:n})]})}function zme({initialSelectedModels:e,onModelChange:t,resourceUri:n}){const{environmentName:r,packageName:o,versionId:a}=eo(n),{apiClients:i}=yr(),{data:l,isLoading:c,isSuccess:d,isError:p,error:h}=To({queryKey:["models",r,o,a],queryFn:()=>i.models.listModels(r,o,a)}),[b,y]=lt.useState(e||[]),[v,x]=lt.useState(null);lt.useEffect(()=>{y(e||[])},[e]);const C=T=>{const M=b.filter(R=>R!==T);y(M),t(M)},S=T=>{const M=[...b,T];y(M),t(M),x(null)};let A=[];return d&&l?.data&&(A=l.data.filter(T=>!b.includes(T.path)).map(T=>T.path)),p?g.jsx(Ca,{error:h,context:`${r} > ${o} > Model Picker`}):g.jsxs(g.Fragment,{children:[g.jsxs(_L,{fullWidth:!0,children:[c&&g.jsx(gt,{children:"Loading..."}),g.jsxs(so,{direction:"row",spacing:1,children:[b.map(T=>g.jsx(kL,{label:T,onDelete:()=>C(T),deleteIcon:g.jsx(Fs,{}),sx:{marginBottom:"5px"}},T)),g.jsx(Eo,{size:"small",startIcon:g.jsx($me,{}),onClick:T=>x(T.currentTarget),disabled:c||p||A.length===0,children:"Add Model"})]})]}),g.jsxs(Qd,{anchorEl:v,open:!!v,onClose:()=>x(null),children:[g.jsx(gt,{variant:"subtitle2",sx:{ml:1},children:"Models"}),g.jsx(Xi,{}),A.length===0?g.jsx(Bl,{disabled:!0,children:"No models available"}):A.map(T=>g.jsx(Bl,{onClick:()=>S(T),children:g.jsx(gt,{variant:"body2",children:T})},T))]})]})}function Ume(){const e=d_();return(t,n)=>{if(!n||!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.button!==1){e(t);return}const r=new URL(t,window.location.href).href;(n.metaKey||n.ctrlKey||n.button===1||n.shiftKey)&&window.open(r,"_blank")}}function Oke({workbookPath:e,resourceUri:t}){const n=Ume(),{server:r,getAccessToken:o}=yr(),{apiClients:a}=yr(),{workbookStorage:i}=jme(),{environmentName:l,packageName:c}=eo(t),[d,p]=lt.useState(void 0),[h,b]=lt.useState(void 0);if(!i)throw new Error("Workbook storage be provided via WorkbookStorageProvider");const[y,v]=lt.useState(),[x,C]=lt.useState(),[S,A]=lt.useState(),[T,M]=lt.useState([]),[R,D]=lt.useState(null),[F,j]=lt.useState(null),z=!!R,B=()=>{D(null),j(null)},U=(G,X)=>{y&&(v(y.insertCell(X,{isMarkdown:G,value:""})),G?A(X):C(X),B(),console.log("handleAddCell",G,X))},[w,L]=lt.useState(!1),I=()=>{L(!0)},$=async()=>{e&&i&&await i.deleteWorkbook(e).then(()=>{b(void 0),p(void 0)}).catch(G=>{b(`Error deleting workbook: ${G.message}`),p(void 0)}),L(!1),n(`/${l}/${c}`)},_=()=>{L(!1)},q=lt.useCallback(async()=>{if(!y){console.log("No workbook data ref");return}try{v(await y.saveWorkbook()),b(void 0),p("Workbook saved")}catch(G){b(`Error saving workbook: ${G.message}`),p(void 0)}},[y]);if(lt.useEffect(()=>{y&&(async()=>{const G=new Map(T.map(({modelPath:te,sourceInfos:Z})=>[te,Z])),X=[],H=[];for(const te of y.getModels())G.has(te)?X.push({modelPath:te,sourceInfos:G.get(te)}):(console.log("Fetching model from Publisher",te),H.push(a.models.getModel(l,c,te,void 0).then(Z=>({modelPath:te,sourceInfos:Z.data.sourceInfos.map(Y=>JSON.parse(Y))}))));if(H.length>0){const te=await Promise.all(H);M([...X,...te])}else M(X)})()},[o,y,c,l,r]),lt.useEffect(()=>{e&&th.loadWorkbook(i,e).then(G=>{v(G)})},[e,i]),!y)return g.jsx("div",{children:"Loading..."});const W=G=>{const X=[];for(const H of G)for(const te of H.sourceInfos)X.push({modelPath:H.modelPath,sourceInfo:te});return X},K=(G,X)=>g.jsx(Eo,{size:"small",startIcon:g.jsx(IT,{}),onClick:()=>U(G,X),variant:"contained",sx:{backgroundColor:"#fff",color:H=>H.palette.mode==="dark"?H.palette.grey[100]:H.palette.grey[700],boxShadow:"none","&:hover":{backgroundColor:H=>H.palette.mode==="dark"?H.palette.grey[500]:H.palette.grey[300],boxShadow:"none"}},children:G?"Markdown":"Explore"}),P=g.jsxs(Et,{sx:{display:"flex",gap:1,justifyContent:"center",flex:2},children:[K(!1,y.getCells().length),K(!0,y.getCells().length)]});return g.jsxs(db,{variant:"outlined",children:[g.jsxs(o3,{children:[g.jsx(Et,{sx:{mb:2},children:g.jsx(Et,{sx:{minHeight:"24px"},children:h?g.jsx(gt,{color:"error",variant:"body2",children:h}):d?g.jsx(gt,{color:"success",variant:"body2",children:d}):g.jsx("span",{children:" "})})}),g.jsxs(ed,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[g.jsxs(ed,{direction:"row",spacing:1,alignItems:"center",children:[g.jsx(gt,{variant:"overline",sx:{fontSize:"13px",fontWeight:"bold",verticalAlign:"middle"},children:"Workbook"}),g.jsx(gt,{variant:"subtitle2",sx:{fontSize:"13px",fontWeight:"normal",verticalAlign:"middle",ml:1},children:`${e.workspace} > ${e.path}`})]}),g.jsxs(ed,{sx:{display:"flex",flexDirection:"row",gap:1},children:[g.jsx(Et,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:g.jsx(Hme,{workbookData:y})}),g.jsxs(Et,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:[g.jsx(Eo,{color:"error",onClick:I,size:"small",children:"Delete"}),g.jsxs(Os,{open:w,onClose:_,children:[g.jsx(Ps,{children:"Delete Workbook"}),g.jsx(Ns,{children:g.jsxs(tY,{children:['Are you sure you want to delete the workbook "',e.path,'"? This action cannot be undone.']})}),g.jsxs(sT,{children:[g.jsx(Eo,{onClick:_,color:"primary",size:"small",children:"Cancel"}),g.jsx(Eo,{onClick:$,color:"error",autoFocus:!0,size:"small",children:"Delete"})]})]})]})]})]}),g.jsx(Xi,{}),g.jsxs(ed,{sx:{display:"flex",flexDirection:"row",width:"100%",mt:2},children:[g.jsx(Et,{sx:{flex:1},children:g.jsx(zme,{initialSelectedModels:y.getModels(),onModelChange:G=>{v(y.setModels(G)),q()},resourceUri:t})}),g.jsx(Et,{sx:{flex:1}})]})]}),g.jsx(_T,{children:g.jsxs(ed,{children:[y.getCells().length===0&&g.jsxs(g.Fragment,{children:[g.jsx(gt,{sx:{textAlign:"center",p:2,variant:"subtitle2",fontWeight:"medium"},children:"Workbook is empty"}),g.jsx(gt,{variant:"body2",sx:{textAlign:"center",mb:2,variant:"body2"},children:"Click the + buttons to add a markdown or code cell."})]}),y.getCells().map((G,X)=>g.jsx(lt.Fragment,{children:g.jsx(Fme,{cell:G,resourceUri:t,addButtonCallback:H=>K(H,X),sourceAndPaths:W(T),editingMarkdown:S===X,editingMalloy:x===X,onDelete:()=>{v(y.deleteCell(X)),q()},onCellChange:H=>{v(y.setCell(X,H))},onEdit:()=>{G.isMarkdown?A(X):C(X)},onClose:()=>{G.isMarkdown?A(void 0):C(void 0),q()}},`${X}-${G.isMarkdown}-${e.workspace}-${e.path}`)},`${X}-${y.getCells().length}`)),P,g.jsxs(Qd,{anchorEl:R,open:z,onClose:B,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[g.jsx(Bl,{onClick:()=>U(!0,F??0),children:"Add Markdown"}),g.jsx(Bl,{onClick:()=>U(!1,F??0),children:"Add Malloy"})]}),g.jsx(ed,{sx:{flexDirection:"row",justifyContent:"flex-end",p:1}})]})})]})}function Hme({workbookData:e}){const[t,n]=lt.useState(!1);return g.jsx(Eo,{color:"primary",onClick:async()=>{if(!e)return;const r=e.toMalloyWorkbook();try{await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1500)}catch{n(!1),alert("Failed to copy to clipboard")}},size:"small",children:t?"Copied!":"Export"})}const wP="Local";class Vme{async listWorkspaces(t){return Promise.resolve([{name:wP,description:"Stored locally- only accessible to this browser",writeable:!0}])}async listWorkbooks(t){const n=[];for(let r=0;r<localStorage.length;r++){const o=localStorage.key(r);n.push({path:o,workspace:wP})}return n}async getWorkbook(t){const n=localStorage.getItem(t.path);if(n===null)throw new Error(`Notebook not found at path: ${t}`);return n}async deleteWorkbook(t){if(localStorage.getItem(t.path)===null)throw new Error(`Notebook not found at path: ${t}`);localStorage.removeItem(t.path)}async saveWorkbook(t,n){localStorage.setItem(t.path,n)}async moveWorkbook(t,n){const r=localStorage.getItem(t.path);if(r===null)throw new Error(`Notebook not found at path: ${t.path}`);localStorage.setItem(n.path,r),localStorage.removeItem(t.path)}}function Wme({resourceUri:e}){const{environmentName:t}=eo(e),{apiClients:n}=yr(),[r,o]=E.useState(!1),a=90,{data:i,isSuccess:l,isError:c,error:d}=To({queryKey:["about",t],queryFn:()=>n.environments.getEnvironment(t,!1)}),p=i?.data?.readme||"",h=p.split(/\s+/),b=h.length>a,y=h.slice(0,a).join(" ");return g.jsxs(g.Fragment,{children:[!l&&!c&&g.jsx(Ea,{text:"Fetching About..."}),l&&p&&g.jsx(rre,{children:g.jsxs(ore,{children:[g.jsx(are,{children:"Readme"}),g.jsxs(Et,{sx:{mt:1,fontSize:"0.875rem",lineHeight:1.6},children:[g.jsx(ib,{options:{overrides:{h1:{component:"p",props:{style:{fontSize:"inherit",fontWeight:"italic"}}},h2:{component:"p",props:{style:{fontSize:"inherit",fontWeight:"italic"}}},h3:{component:"p",props:{style:{fontSize:"inherit",fontWeight:"italic"}}}}},children:r||!b?p:y}),b&&g.jsxs(Et,{sx:{mt:1},children:[" ",g.jsx(Eo,{variant:"text",size:"small",onClick:()=>o(!r),children:r?"Read less":"Read more"})]})]})]})}),c&&g.jsx(Ca,{error:d,context:`${t} > About`})]})}function qme({resourceUri:e}){const[t,n]=E.useState(!1),{apiClients:r}=yr(),o=Us(),[a,i]=E.useState(""),{environmentName:l}=eo(e),c=Yi({async mutationFn(d){return r.packages.createPackage(l,{name:d.name,description:d.description,location:d.location})},onSuccess(){n(!1),i("Package created successfully"),o.invalidateQueries({queryKey:["packages",l]})},onError(d){i(d instanceof Error?d.message:"An unknown error occurred")}});return g.jsxs(g.Fragment,{children:[g.jsx(Eo,{onClick:()=>n(!0),variant:"contained",color:"primary",startIcon:g.jsx(Tee,{}),children:"Add Package"}),g.jsxs(Os,{open:t,onClose:()=>n(!1),maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:2}},children:[g.jsx(Ps,{sx:{fontSize:"1.25rem",fontWeight:600,letterSpacing:"-0.025em",pt:3,pb:1,px:3},children:"Create New Package"}),g.jsxs(Ns,{sx:{px:3,pb:0},children:[g.jsxs(Et,{sx:{mb:3},children:[g.jsx(gt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:"Create a new Malloy package to start exploring your data."}),g.jsx(gt,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:"The location can be a GitHub/S3/GCP URL containing a package (zipped or unzipped), or an absolute path to a directory the publisher server has access to."}),g.jsxs(gt,{variant:"body2",color:"text.secondary",children:["Make sure to conform to the"," ",g.jsx(Et,{component:"a",href:"https://github.com/malloydata/publisher/blob/main/README.md#architecture-overview",target:"_blank",rel:"noopener noreferrer",sx:{color:"text.primary",textDecoration:"underline"},children:"Malloy Package Format"}),"."]})]}),g.jsx("form",{onSubmit:d=>{d.preventDefault();const p=new FormData(d.currentTarget),h=p.get("name")?.toString(),b=p.get("description")?.toString(),y=p.get("location")?.toString();c.mutate({name:h,description:b,location:y})},id:"package-form",children:g.jsxs(so,{spacing:2.5,children:[g.jsx(Pc,{autoFocus:!0,required:!0,id:"name",name:"name",label:"Package Name",type:"text",fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:{shrink:!0}}),g.jsx(Pc,{id:"description",name:"description",label:"Description",multiline:!0,rows:3,fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:{shrink:!0}}),g.jsx(Pc,{id:"location",name:"location",label:"Location",type:"text",placeholder:"e.g. s3://my-bucket/my-package.zip",fullWidth:!0,variant:"outlined",size:"small",InputLabelProps:{shrink:!0}})]})})]}),g.jsxs(sT,{sx:{px:3,pt:2,pb:3,gap:1},children:[g.jsx(Eo,{variant:"outlined",disabled:c.isPending,onClick:()=>n(!1),children:"Cancel"}),g.jsx(Eo,{type:"submit",form:"package-form",variant:"contained",loading:c.isPending,children:"Save Changes"})]})]}),g.jsx(zs,{open:a!=="",autoHideDuration:6e3,onClose:()=>i(""),message:a})]})}const Gme=fr(g.jsx("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"})),N6=fr(g.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}));function P6(e){const{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:Nh(t.components[n].defaultProps,r)}function Yme({props:e,name:t,defaultTheme:n,themeId:r}){let o=ine(n);return o=o[r]||o,P6({theme:o,name:t,props:e})}function vr({props:e,name:t}){return Yme({props:e,name:t,defaultTheme:Dv,themeId:ep})}const Kme=At("MuiBox",["root"]),Qme=e3(),br=BC({themeId:ep,defaultTheme:Qme,defaultClassName:Kme.root,generateClassName:$5.generate}),I6=Le.oneOfType([Le.func,Le.object]);function kP(e){try{return e.matches(":focus-visible")}catch{}return!1}const AP={};function _6(e,t){const n=E.useRef(AP);return n.current===AP&&(n.current=e(t)),n}class Eb{static create(){return new Eb}static use(){const t=_6(Eb.create).current,[n,r]=E.useState(!1);return t.shouldMount=n,t.setShouldMount=r,E.useEffect(t.mountEffect,[n]),t}constructor(){this.ref={current:null},this.mounted=null,this.didMount=!1,this.shouldMount=!1,this.setShouldMount=null}mount(){return this.mounted||(this.mounted=Zme(),this.shouldMount=!0,this.setShouldMount(this.shouldMount)),this.mounted}mountEffect=()=>{this.shouldMount&&!this.didMount&&this.ref.current!==null&&(this.didMount=!0,this.mounted.resolve())};start(...t){this.mount().then(()=>this.ref.current?.start(...t))}stop(...t){this.mount().then(()=>this.ref.current?.stop(...t))}pulsate(...t){this.mount().then(()=>this.ref.current?.pulsate(...t))}}function Xme(){return Eb.use()}function Zme(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n}function WE(e,t){return WE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},WE(e,t)}function gw(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,WE(e,t)}function Jme(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function ege(e,t){e.classList?e.classList.add(t):Jme(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function DP(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function tge(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=DP(e.className,t):e.setAttribute("class",DP(e.className&&e.className.baseVal||"",t))}const RP={disabled:!1},Cb=lt.createContext(null);var L6=function(e){return e.scrollTop},Gf="unmounted",xc="exited",Sc="entering",cd="entered",qE="exiting",Ei=(function(e){gw(t,e);function t(r,o){var a;a=e.call(this,r,o)||this;var i=o,l=i&&!i.isMounting?r.enter:r.appear,c;return a.appearStatus=null,r.in?l?(c=xc,a.appearStatus=Sc):c=cd:r.unmountOnExit||r.mountOnEnter?c=Gf:c=xc,a.state={status:c},a.nextCallback=null,a}t.getDerivedStateFromProps=function(r,o){var a=r.in;return a&&o.status===Gf?{status:xc}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(r){var o=null;if(r!==this.props){var a=this.state.status;this.props.in?a!==Sc&&a!==cd&&(o=Sc):(a===Sc||a===cd)&&(o=qE)}this.updateStatus(!1,o)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var r=this.props.timeout,o,a,i;return o=a=i=r,r!=null&&typeof r!="number"&&(o=r.exit,a=r.enter,i=r.appear!==void 0?r.appear:a),{exit:o,enter:a,appear:i}},n.updateStatus=function(r,o){if(r===void 0&&(r=!1),o!==null)if(this.cancelNextCallback(),o===Sc){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:Dl.findDOMNode(this);a&&L6(a)}this.performEnter(r)}else this.performExit();else this.props.unmountOnExit&&this.state.status===xc&&this.setState({status:Gf})},n.performEnter=function(r){var o=this,a=this.props.enter,i=this.context?this.context.isMounting:r,l=this.props.nodeRef?[i]:[Dl.findDOMNode(this),i],c=l[0],d=l[1],p=this.getTimeouts(),h=i?p.appear:p.enter;if(!r&&!a||RP.disabled){this.safeSetState({status:cd},function(){o.props.onEntered(c)});return}this.props.onEnter(c,d),this.safeSetState({status:Sc},function(){o.props.onEntering(c,d),o.onTransitionEnd(h,function(){o.safeSetState({status:cd},function(){o.props.onEntered(c,d)})})})},n.performExit=function(){var r=this,o=this.props.exit,a=this.getTimeouts(),i=this.props.nodeRef?void 0:Dl.findDOMNode(this);if(!o||RP.disabled){this.safeSetState({status:xc},function(){r.props.onExited(i)});return}this.props.onExit(i),this.safeSetState({status:qE},function(){r.props.onExiting(i),r.onTransitionEnd(a.exit,function(){r.safeSetState({status:xc},function(){r.props.onExited(i)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(r,o){o=this.setNextCallback(o),this.setState(r,o)},n.setNextCallback=function(r){var o=this,a=!0;return this.nextCallback=function(i){a&&(a=!1,o.nextCallback=null,r(i))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},n.onTransitionEnd=function(r,o){this.setNextCallback(o);var a=this.props.nodeRef?this.props.nodeRef.current:Dl.findDOMNode(this),i=r==null&&!this.props.addEndListener;if(!a||i){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],c=l[0],d=l[1];this.props.addEndListener(c,d)}r!=null&&setTimeout(this.nextCallback,r)},n.render=function(){var r=this.state.status;if(r===Gf)return null;var o=this.props,a=o.children;o.in,o.mountOnEnter,o.unmountOnExit,o.appear,o.enter,o.exit,o.timeout,o.addEndListener,o.onEnter,o.onEntering,o.onEntered,o.onExit,o.onExiting,o.onExited,o.nodeRef;var i=Xt(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return lt.createElement(Cb.Provider,{value:null},typeof a=="function"?a(r,i):lt.cloneElement(lt.Children.only(a),i))},t})(lt.Component);Ei.contextType=Cb;Ei.propTypes={};function od(){}Ei.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:od,onEntering:od,onEntered:od,onExit:od,onExiting:od,onExited:od};Ei.UNMOUNTED=Gf;Ei.EXITED=xc;Ei.ENTERING=Sc;Ei.ENTERED=cd;Ei.EXITING=qE;var nge=function(e,t){return e&&t&&t.split(" ").forEach(function(n){return ege(e,n)})},vS=function(e,t){return e&&t&&t.split(" ").forEach(function(n){return tge(e,n)})},yw=(function(e){gw(t,e);function t(){for(var r,o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return r=e.call.apply(e,[this].concat(a))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(l,c){var d=r.resolveArguments(l,c),p=d[0],h=d[1];r.removeClasses(p,"exit"),r.addClass(p,h?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(l,c)},r.onEntering=function(l,c){var d=r.resolveArguments(l,c),p=d[0],h=d[1],b=h?"appear":"enter";r.addClass(p,b,"active"),r.props.onEntering&&r.props.onEntering(l,c)},r.onEntered=function(l,c){var d=r.resolveArguments(l,c),p=d[0],h=d[1],b=h?"appear":"enter";r.removeClasses(p,b),r.addClass(p,b,"done"),r.props.onEntered&&r.props.onEntered(l,c)},r.onExit=function(l){var c=r.resolveArguments(l),d=c[0];r.removeClasses(d,"appear"),r.removeClasses(d,"enter"),r.addClass(d,"exit","base"),r.props.onExit&&r.props.onExit(l)},r.onExiting=function(l){var c=r.resolveArguments(l),d=c[0];r.addClass(d,"exit","active"),r.props.onExiting&&r.props.onExiting(l)},r.onExited=function(l){var c=r.resolveArguments(l),d=c[0];r.removeClasses(d,"exit"),r.addClass(d,"exit","done"),r.props.onExited&&r.props.onExited(l)},r.resolveArguments=function(l,c){return r.props.nodeRef?[r.props.nodeRef.current,l]:[l,c]},r.getClassNames=function(l){var c=r.props.classNames,d=typeof c=="string",p=d&&c?c+"-":"",h=d?""+p+l:c[l],b=d?h+"-active":c[l+"Active"],y=d?h+"-done":c[l+"Done"];return{baseClassName:h,activeClassName:b,doneClassName:y}},r}var n=t.prototype;return n.addClass=function(r,o,a){var i=this.getClassNames(o)[a+"ClassName"],l=this.getClassNames("enter"),c=l.doneClassName;o==="appear"&&a==="done"&&c&&(i+=" "+c),a==="active"&&r&&L6(r),i&&(this.appliedClasses[o][a]=i,nge(r,i))},n.removeClasses=function(r,o){var a=this.appliedClasses[o],i=a.base,l=a.active,c=a.done;this.appliedClasses[o]={},i&&vS(r,i),l&&vS(r,l),c&&vS(r,c)},n.render=function(){var r=this.props;r.classNames;var o=Xt(r,["classNames"]);return lt.createElement(Ei,he({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t})(lt.Component);yw.defaultProps={classNames:""};yw.propTypes={};function rge(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bw(e,t){var n=function(o){return t&&E.isValidElement(o)?t(o):o},r=Object.create(null);return e&&E.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function oge(e,t){e=e||{},t=t||{};function n(p){return p in t?t[p]:e[p]}var r=Object.create(null),o=[];for(var a in e)a in t?o.length&&(r[a]=o,o=[]):o.push(a);var i,l={};for(var c in t){if(r[c])for(i=0;i<r[c].length;i++){var d=r[c][i];l[r[c][i]]=n(d)}l[c]=n(c)}for(i=0;i<o.length;i++)l[o[i]]=n(o[i]);return l}function Mc(e,t,n){return n[t]!=null?n[t]:e.props[t]}function age(e,t){return bw(e.children,function(n){return E.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:Mc(n,"appear",e),enter:Mc(n,"enter",e),exit:Mc(n,"exit",e)})})}function ige(e,t,n){var r=bw(e.children),o=oge(t,r);return Object.keys(o).forEach(function(a){var i=o[a];if(E.isValidElement(i)){var l=a in t,c=a in r,d=t[a],p=E.isValidElement(d)&&!d.props.in;c&&(!l||p)?o[a]=E.cloneElement(i,{onExited:n.bind(null,i),in:!0,exit:Mc(i,"exit",e),enter:Mc(i,"enter",e)}):!c&&l&&!p?o[a]=E.cloneElement(i,{in:!1}):c&&l&&E.isValidElement(d)&&(o[a]=E.cloneElement(i,{onExited:n.bind(null,i),in:d.props.in,exit:Mc(i,"exit",e),enter:Mc(i,"enter",e)}))}}),o}var sge=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},lge={component:"div",childFactory:function(e){return e}},mm=(function(e){gw(t,e);function t(r,o){var a;a=e.call(this,r,o)||this;var i=a.handleExited.bind(rge(a));return a.state={contextValue:{isMounting:!0},handleExited:i,firstRender:!0},a}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(r,o){var a=o.children,i=o.handleExited,l=o.firstRender;return{children:l?age(r,i):ige(r,a,i),firstRender:!1}},n.handleExited=function(r,o){var a=bw(this.props.children);r.key in a||(r.props.onExited&&r.props.onExited(o),this.mounted&&this.setState(function(i){var l=he({},i.children);return delete l[r.key],{children:l}}))},n.render=function(){var r=this.props,o=r.component,a=r.childFactory,i=Xt(r,["component","childFactory"]),l=this.state.contextValue,c=sge(this.state.children).map(a);return delete i.appear,delete i.enter,delete i.exit,o===null?lt.createElement(Cb.Provider,{value:l},c):lt.createElement(Cb.Provider,{value:l},lt.createElement(o,i,c))},t})(lt.Component);mm.propTypes={};mm.defaultProps=lge;const cge=[];function uge(e){E.useEffect(e,cge)}class vw{static create(){return new vw}currentId=null;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,n()},t)}clear=()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function xw(){const e=_6(vw.create).current;return uge(e.disposeEffect),e}function dge(e){const{className:t,classes:n,pulsate:r=!1,rippleX:o,rippleY:a,rippleSize:i,in:l,onExited:c,timeout:d}=e,[p,h]=E.useState(!1),b=yt(t,n.ripple,n.rippleVisible,r&&n.ripplePulsate),y={width:i,height:i,top:-(i/2)+a,left:-(i/2)+o},v=yt(n.child,p&&n.childLeaving,r&&n.childPulsate);return!l&&!p&&h(!0),E.useEffect(()=>{if(!l&&c!=null){const x=setTimeout(c,d);return()=>{clearTimeout(x)}}},[c,l,d]),g.jsx("span",{className:b,style:y,children:g.jsx("span",{className:v})})}const Ua=At("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),GE=550,pge=80,fge=ts`
327
327
  0% {
328
328
  transform: scale(0);
329
329
  opacity: 0.1;
@@ -449,4 +449,4 @@ import {${t.sourceName}}" from '${t.modelPath}'"
449
449
  `}function ywe(e,t){const n=new Map;for(const d of t){const p=$l(d);n.set(p,[])}const r=JSON.parse(e),o=r.schema.fields,a=new Map;o.forEach((d,p)=>{a.set(d.name,p)});const i=d=>{if(!d)return null;switch(d.kind){case"string_cell":return d.string_value??null;case"number_cell":return d.number_value??null;case"boolean_cell":return d.boolean_value??null;case"null_cell":return null;default:return console.log("Unknown cell kind: "+d.kind),null}},l=(r.data?.array_value||[]).map(d=>{const p={};return d.kind==="record_cell"&&d.record_value&&d.record_value.forEach((h,b)=>{const y=o[b]?.name;if(y){const v=i(h);y==="fieldName"&&typeof v=="string"?p.fieldName=v:y==="fieldPath"&&typeof v=="string"?p.fieldPath=v:y==="fieldType"&&typeof v=="string"?p.fieldType=v:y==="fieldValue"&&typeof v=="string"?p.fieldValue=v:y==="weight"&&typeof v=="number"&&(p.weight=v)}}),p}),c=l.length===0||l.every(d=>!d.fieldName);for(const d of t){if(d.filterType==="NONE"||d.filterType==="Retrieval")continue;const p=l.filter(b=>{const y=b.fieldName||"",v=b.fieldPath||"";if(y===d.dimensionName||v===d.dimensionName||y.toLowerCase()===d.dimensionName.toLowerCase()||v.toLowerCase()===d.dimensionName.toLowerCase())return!0;const x=v.split(".").pop()||"";return x===d.dimensionName||x.toLowerCase()===d.dimensionName.toLowerCase()});if(p.length===0)continue;const h=$l(d);if(d.filterType==="Star"){const b=p.filter(y=>y.fieldType==="string").map(y=>({value:y.fieldValue??"",count:y.weight})).sort((y,v)=>(v.count??0)-(y.count??0));n.set(h,b)}else if(d.filterType==="MinMax"){console.log("MinMax dimensionEntries: "+JSON.stringify(p,null,2)),console.log("All MinMax dimension entries fieldTypes:",p.map(y=>y.fieldType));const b=p.find(y=>y.fieldType==="number");if(console.log("numericEntry: "+JSON.stringify(b,null,2)),b?.fieldValue){const y=b.fieldValue,v=y.split(" to ");if(console.log("rangeParts: "+v),v.length===2){const x=[{value:parseFloat(v[0])},{value:parseFloat(v[1])}];n.set(h,x)}else console.warn(`Could not parse numeric range for ${d.dimensionName}: ${y}`)}else console.warn(`No numeric entry found for ${d.dimensionName}. Available entries:`,p)}else if(d.filterType==="DateMinMax"){const b=p.find(y=>y.fieldType==="date"||y.fieldType==="timestamp"||y.fieldType==="string");if(console.log("dateEntry: "+JSON.stringify(b,null,2)),console.log("All date dimension entries fieldTypes:",p.map(y=>y.fieldType)),b?.fieldValue){const y=b.fieldValue,v=y.split(" to ");if(console.log("date rangeParts: "+v),v.length===2){const x=[{value:new Date(v[0].trim())},{value:new Date(v[1].trim())}];n.set(h,x)}else console.warn(`Could not parse date range for ${d.dimensionName}: ${y}`)}else console.warn(`No date entry found for ${d.dimensionName}. Available entries:`,p)}}return{values:n,noRowsMatchedFilter:c}}function bwe(e){const{environment:t,package:n,dimensionSpecs:r,versionId:o,enabled:a=!0,indexLimit:i=1e4,activeFilters:l=[]}=e,c=E.useMemo(()=>mwe(r),[r]),d=E.useMemo(()=>{const v=[];for(const[x,C]of c){const[S,A]=x.split("|"),T=gwe(S,C,i,l);T?v.push({key:x,source:S,model:A,query:T,specs:C}):console.log("No query for source: ",S,"model: ",A)}return v},[c,i,l]),p=E.useMemo(()=>a&&d.length>0&&r.some(v=>v.filterType==="Star"||v.filterType==="MinMax"||v.filterType==="DateMinMax"),[a,d,r]),{apiClients:h}=yr(),b=To({queryKey:["dimensionalFilter",t,n,r,o,l],queryFn:async()=>{if(!p){const S=new Map;for(const A of r){const T=$l(A);S.set(T,[])}return{values:S,noRowsMatchedFilter:!1}}const v=await Promise.all(d.map(async S=>{const A=await h.models.executeQueryModel(t,n,S.model,{query:S.query,versionId:o,bypassFilters:!0});return{config:S,result:ywe(A.data.result,S.specs)}})),x=new Map;let C=!1;for(const{result:S}of v){for(const[A,T]of S.values)x.set(A,T);S.noRowsMatchedFilter&&(C=!0)}return{values:x,noRowsMatchedFilter:C}},enabled:p,staleTime:300*1e3,placeholderData:v=>v}),y=b.data?.values;return{data:E.useMemo(()=>{const v=new Map;for(const x of r){const C=$l(x);x.values?v.set(C,x.values.map(S=>({value:S}))):v.set(C,[])}if(y)for(const[x,C]of y)C.length>0&&v.set(x,C);return v},[r,y]),noRowsMatchedFilter:b.data?.noRowsMatchedFilter??!1,isLoading:p?b.isPending:!1,isError:p?b.isError:!1,error:p?b.error:null,refetch:b.refetch}}function aB(e){return e.replace(/'/g,"\\'").replace(/\\/g,"\\\\")}function _i(e,t=!1){return e==null?"null":t?e instanceof Date?`@${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`:`@${e}`:typeof e=="string"?`'${aB(e)}'`:typeof e=="number"?String(e):typeof e=="boolean"?e?"true":"false":String(e)}function vwe(e){const{dimensionName:t,matchType:n,value:r,value2:o}=e,a=`\`${t}\``,i=r instanceof Date;switch(n){case"Equals":case"Semantic Search":return Array.isArray(r)&&r.length>0?`(${r.map(l=>`${a} = ${_i(l,i)}`).join(" or ")})`:Array.isArray(r)?"":`${a} = ${_i(r,i)}`;case"Contains":return typeof r=="string"?`${a} ~ f'%${aB(r)}%'`:Array.isArray(r)?"":`${a} = ${_i(r)}`;case"After":return Array.isArray(r)?"":`${a} > ${_i(r,i)}`;case"Before":return Array.isArray(r)?"":`${a} < ${_i(r,i)}`;case"Greater Than":return Array.isArray(r)?"":`${a} > ${_i(r)}`;case"Less Than":return Array.isArray(r)?"":`${a} < ${_i(r)}`;case"Between":return Array.isArray(r)?"":o!==void 0?`${a} >= ${_i(r,i)} and ${a} <= ${_i(o,i)}`:`${a} >= ${_i(r,i)}`;default:return""}}function xwe(e){const{dimensionSpecs:t}=e,[n,r]=E.useState(()=>{const d=new Map;return t.forEach(p=>{const h=$l(p);d.set(h,{spec:p,selection:null})}),d});E.useEffect(()=>{r(d=>{const p=new Map;return t.forEach(h=>{const b=$l(h),y=d.get(b);p.set(b,{spec:h,selection:y?.selection??null})}),p})},[t]);const o=E.useCallback((d,p)=>{r(h=>{const b=new Map(h),y=b.get(d);return y&&b.set(d,{...y,selection:p}),b})},[]),a=E.useCallback(d=>{o(d,null)},[o]),i=E.useCallback(()=>{r(d=>{const p=new Map(d);return p.forEach((h,b)=>{p.set(b,{...h,selection:null})}),p})},[]),l=E.useCallback(()=>{const d=[];return n.forEach(p=>{p.selection&&d.push(p.selection)}),d},[n]),c=E.useCallback(()=>{const d=l();if(d.length===0)return"";const p=d.map(h=>vwe(h)).filter(h=>h.length>0);return p.length===0?"":`where ${p.join(" and ")}`},[l]);return{filterStates:n,updateFilter:o,clearFilter:a,clearAllFilters:i,getActiveFilters:l,generateWhereClause:c}}function Swe(e){const[t,n]=E.useState(()=>new Map);E.useEffect(()=>{n(l=>{const c=new Set(e.map(p=>p.name).filter(p=>!!p)),d=new Map;return l.forEach((p,h)=>{c.has(h)&&d.set(h,p)}),d})},[e]);const r=E.useCallback((l,c)=>{n(d=>{const p=new Map(d);return c===null?p.delete(l):p.set(l,c),p})},[]),o=E.useCallback(l=>{n(c=>{if(!c.has(l))return c;const d=new Map(c);return d.delete(l),d})},[]),a=E.useCallback(()=>{n(l=>l.size===0?l:new Map)},[]),i=E.useCallback(()=>{const l=new Map;return t.forEach((c,d)=>{c!=null&&l.set(d,c)}),l},[t]);return{givenValues:t,updateGiven:r,clearGiven:o,clearAll:a,getActiveGivens:i}}function Ewe(e){return E.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 Cwe=fr(g.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));rr.extend(XF);function Twe(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(`
450
450
  `):void 0}function wwe({given:e,value:t,onChange:n}){const r=e.name??"",o=e.type??"string",a=Twe(e);if(o==="boolean")return g.jsx(LL,{control:g.jsx(dG,{checked:t===!0,onChange:l=>n(l.target.checked)}),label:r});if(o==="number"){const l=typeof t=="number"?t:"";return g.jsx(Pc,{label:r,type:"number",value:l,onChange:c=>{const d=c.target.value;n(d===""?null:Number(d))},helperText:a,slotProps:{input:{endAdornment:l!==""&&g.jsx(HI,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"})}if(o==="date"||o==="timestamp"||o==="timestamptz"){const l=t instanceof Date?rr.utc(t):null;return g.jsx(Pb,{dateAdapter:cC,children:g.jsx($y,{label:r,value:l,onChange:c=>n(c?c.toDate():null),slotProps:{textField:{fullWidth:!0,size:"small",helperText:a},field:{clearable:!0,onClear:()=>n(null)}}})})}if(o.startsWith("array<")){const l=Array.isArray(t)?t.map(String):[];return g.jsx(wq,{multiple:!0,freeSolo:!0,options:[],value:l,onChange:(c,d)=>n(d.length===0?null:d),renderInput:c=>g.jsx(Pc,{...c,label:r,size:"small",helperText:a}),fullWidth:!0})}const i=typeof t=="string"?t:"";return g.jsx(Pc,{label:r,value:i,onChange:l=>{const c=l.target.value;n(c===""?null:c)},placeholder:o.startsWith("filter<")?o:void 0,helperText:a,slotProps:{input:{endAdornment:i!==""&&g.jsx(HI,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"})}function HI({onClear:e}){return g.jsx(_Y,{position:"end",children:g.jsx(dr,{size:"small","aria-label":"clear value",onClick:e,edge:"end",children:g.jsx(Cwe,{fontSize:"small"})})})}function kwe({givens:e,values:t,onChange:n,onClearAll:r}){if(e.length===0)return null;const o=t.size>0;return g.jsxs(Za,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[g.jsxs(so,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:2},children:[g.jsx(gt,{variant:"subtitle2",sx:{fontWeight:600,color:"#333"},children:"Parameters"}),o&&g.jsx(Eo,{variant:"text",size:"small",onClick:r,sx:{textTransform:"none"},children:"Reset"})]}),g.jsx(Et,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:3},children:e.map(a=>g.jsx(Et,{children:g.jsx(wwe,{given:a,value:a.name?t.get(a.name):void 0,onChange:i=>a.name&&n(a.name,i)})},a.name))})]})}const Awe=fr(g.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"}));function Dwe(e){const{environmentName:t,packageName:n}=eo(e.resourceUri);if(!t||!n)throw new Error("Environment and Package name must be provided for query embedding.");return JSON.stringify({...e})}function Rwe({cell:e,hideCodeCellIcon:t,hideEmbeddingIcon:n,resourceUri:r,index:o,maxResultSize:a,isExecuting:i}){const[l,c]=lt.useState(!1),[d,p]=lt.useState(!1),[h,b]=lt.useState(!1),[y,v]=lt.useState(),[x,C]=lt.useState(),[S,A]=lt.useState(!1),[T,M]=E.useState(""),R=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,D=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,F=L=>L.split(`
451
451
  `).filter(I=>!I.trimStart().startsWith("##")).join(`
452
- `),j=!!e.text&&(R.test(e.text)||D.test(e.text)),z=()=>{if(!e.newSources||e.newSources.length===0)return 0;let L=[],I="";if(e.text){const $=e.text.match(R);$&&(L=$[1].split(",").map(q=>q.trim()));const _=e.text.match(D);_&&(I=_[1].trim())}for(let $=0;$<e.newSources.length;$++)try{const _=JSON.parse(e.newSources[$]);if(L.length>0&&L.includes(_.name)||I&&I===_.path)return $}catch{continue}return 0},B=e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:r}:void 0,U=Dwe({query:e.text,resourceUri:r});E.useEffect(()=>{e.type==="code"&&Sb(F(e.text),"malloy").then(L=>{v(L)})},[e]),E.useEffect(()=>{Sb(U,"typescript").then(L=>{C(L)})},[U]);const w=()=>{const L=window.location.href;navigator.clipboard.writeText(L).then(()=>M("URL copied to clipboard!")).catch(()=>M("Failed to copy URL"))};return e.type==="markdown"&&g.jsx(EE,{children:g.jsxs(Et,{sx:{"& h1, & h2, & h3, & h4, & h5, & h6":{fontWeight:"600",color:"#1a1a1a",marginBottom:"8px",marginTop:"16px"},"& h1":{fontSize:"28px"},"& h2":{fontSize:"24px"},"& h3":{fontSize:"20px"},"& p":{color:"#333333",lineHeight:"1.7",marginBottom:"8px",fontSize:"16px"},"& ul, & ol":{color:"#333333",lineHeight:"1.7",marginBottom:"8px",fontSize:"16px"},"& li":{marginBottom:"4px"}},children:[o===0?g.jsxs(so,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[g.jsx(ib,{children:e.text}),g.jsx(Ho,{title:"Click to copy link",children:g.jsx(LT,{sx:{fontSize:"24px",color:"text.secondary",cursor:"pointer",marginTop:"26px"},onClick:w})})]}):g.jsx(ib,{children:e.text}),g.jsx(zs,{open:T!=="",autoHideDuration:6e3,onClose:()=>M(""),message:T})]})})||e.type==="code"&&g.jsxs(EE,{children:[(!t||!n&&e.result||e.newSources&&e.newSources.length>0)&&g.jsx(so,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:e.newSources&&e.newSources.length>0&&g.jsx(Ry,{sx:{position:"relative",padding:"0"},children:g.jsxs(Et,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[y&&g.jsx("span",{dangerouslySetInnerHTML:{__html:y},style:{fontFamily:"monospace",fontSize:"14px",flex:1,marginRight:"8px"}}),j&&g.jsx(dr,{sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"},width:"32px",height:"32px",flexShrink:0},onClick:()=>A(!0),children:g.jsx(Ib,{sx:{fontSize:"18px",color:"text.secondary"}})})]})})}),g.jsx(rB,{open:S,onClose:()=>A(!1),title:"Data Sources",hasValidImport:j,resourceUri:r,data:B,initialSelectedSourceIndex:z()}),g.jsxs(Os,{open:l,onClose:()=>c(!1),maxWidth:"lg",fullWidth:!0,children:[g.jsxs(Ps,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Malloy Code",g.jsx(dr,{onClick:()=>c(!1),sx:{color:"text.secondary"},children:g.jsx(Fs,{})})]}),g.jsx(Ns,{children:g.jsx(Et,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",padding:"16px",fontFamily:"monospace",fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:"#ffffff"},children:g.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:y}})})})]}),g.jsxs(Os,{open:d,onClose:()=>p(!1),maxWidth:"lg",fullWidth:!0,children:[g.jsxs(Ps,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Embeddable Code",g.jsx(dr,{onClick:()=>p(!1),sx:{color:"text.secondary"},children:g.jsx(Fs,{})})]}),g.jsx(Ns,{children:g.jsxs(so,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"flex-start"},children:[g.jsx(gt,{component:"div",sx:{fontSize:"12px",fontFamily:"monospace","& .line":{textWrap:"wrap"},flex:1},dangerouslySetInnerHTML:{__html:x}}),g.jsx(Ho,{title:"Copy Embeddable Code",children:g.jsx(dr,{sx:{width:"24px",height:"24px",marginLeft:"8px",color:"text.secondary"},onClick:()=>{navigator.clipboard.writeText(U)},children:g.jsx(Awe,{})})})]})})]}),g.jsx(eB,{open:h,onClose:()=>b(!1),result:e.result||"",title:"Results"}),i&&!e.result&&!j&&!(e.newSources&&e.newSources.length>0)&&g.jsx(Ry,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:g.jsx(tv,{size:32})}),e.result&&g.jsxs(Ry,{sx:{position:"relative"},children:[g.jsx(Et,{sx:{paddingTop:"24px"},children:g.jsx(zv,{result:e.result,maxHeight:700,maxResultSize:a})}),g.jsxs(so,{sx:{position:"absolute",top:"8px",right:"8px",flexDirection:"row",gap:"8px",alignItems:"center",zIndex:2},children:[!t&&g.jsx(dr,{sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"},width:"32px",height:"32px"},onClick:L=>{L.stopPropagation(),c(!0)},children:g.jsx(i3,{sx:{fontSize:"18px",color:"text.secondary"}})}),g.jsx(dr,{sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"},width:"32px",height:"32px"},onClick:()=>b(!0),children:g.jsx(Ib,{sx:{fontSize:"18px",color:"text.secondary"}})})]})]})]})}const Mwe=4;function Owe({resourceUri:e,maxResultSize:t=0,retrievalFn:n}){const{apiClients:r}=yr(),{environmentName:o,packageName:a,versionId:i,modelPath:l}=eo(e),{data:c,isSuccess:d,isError:p,error:h}=To({queryKey:[e],queryFn:async()=>(await r.notebooks.getNotebook(o,a,l,i)).data}),[b,y]=E.useState([]),[v,x]=E.useState(!1),[C,S]=E.useState(null),A=E.useMemo(()=>c?UTe(c.annotations):null,[c]),T=E.useMemo(()=>c?.notebookCells?WTe(c.notebookCells):null,[c]),M=E.useMemo(()=>T?.sourceInfoMap??new Map,[T]),R=T?.modelPath??null,D=E.useMemo(()=>{const H=new Map;if(!c?.sources)return H;for(const te of c.sources)if(te.name&&te.filters&&te.filters.length>0){const Z=te.filters.filter(Y=>!Y.implicit);Z.length>0&&H.set(te.name,Z)}return H},[c]),F=D.size>0,j=E.useMemo(()=>{if(F&&R){const H=[];for(const[te,Z]of D)for(const Y of Z??[]){if(!Y.dimension||!Y.type)continue;let ne;const J=Y.dimensionType;J==="boolean"?ne="Boolean":J==="date"||J==="timestamp"||J==="timestamptz"?ne="DateMinMax":J==="number"?ne=Y.type==="equal"||Y.type==="in"?"Star":"MinMax":ne={equal:"Star",in:"Star",like:"Star",greater_than:"MinMax",less_than:"MinMax"}[Y.type]??"Star";const ce={equal:"Equals",in:"Equals",like:"Contains",greater_than:ne==="DateMinMax"?"After":"Greater Than",less_than:ne==="DateMinMax"?"Before":"Less Than"}[Y.type],fe=Y.name!==Y.dimension?Y.name:void 0;H.push({source:te,model:R,dimensionName:Y.dimension,filterType:ne,label:fe,filterName:Y.name??Y.dimension,defaultMatchType:ce,required:Y.required??!1})}return H}return!A||M.size===0||!R?[]:qTe(M,A.filters,R)},[F,D,A,M,R]),{filterStates:z,updateFilter:B,getActiveFilters:U}=xwe({dimensionSpecs:j}),w=E.useMemo(()=>U(),[z,U]),L=Ewe(c),{givenValues:I,updateGiven:$,clearAll:_}=Swe(L);E.useMemo(()=>{const H=new Map;for(const te of j){const Z=$l(te);H.set(Z,te.source)}return H},[j]);const{data:q}=bwe({environment:o,package:a,dimensionSpecs:j,versionId:i,enabled:j.length>0}),W=E.useCallback(H=>{if(H.length===0)return;const te=Y=>Y instanceof Date?Y.toISOString().slice(0,10):String(Y),Z={};for(const Y of H){const ne=Y.filterName??Y.dimensionName,J=Y.value;Array.isArray(J)?Z[ne]=J.map(te):J!=null&&(Z[ne]=te(J))}return Object.keys(Z).length>0?JSON.stringify(Z):void 0},[]),K=E.useCallback(H=>{if(H.size===0)return;const te=Y=>Y instanceof Date?Y.toISOString().slice(0,10):Array.isArray(Y)?Y.map(ne=>te(ne)):Y,Z={};return H.forEach((Y,ne)=>{Y!=null&&(Z[ne]=te(Y))}),Object.keys(Z).length>0?JSON.stringify(Z):void 0},[]),P=E.useCallback(async(H=[],te=new Map)=>{if(!d||!c?.notebookCells)return;y(ne=>ne.length===0?c.notebookCells.map(J=>({...J})):ne.map(J=>({...J,result:void 0}))),x(!0),S(null);const Z=F?W(H):void 0,Y=K(te);try{const ne=[];for(let ce=0;ce<c.notebookCells.length;ce++){const fe=c.notebookCells[ce];if(fe.type==="markdown")continue;const ue=ce,Ce=async()=>{try{const ie=(await r.notebooks.executeNotebookCell(o,a,l,ue,i,Z,void 0,Y)).data,le=ie.result,je=fe.newSources||ie.newSources;y(Ee=>{const be=[...Ee];return be[ue]||(be[ue]={...fe}),be[ue]={...be[ue],result:le,newSources:je},be})}catch(ie){console.error(`Error executing cell ${ue}:`,ie)}};ne.push(Ce)}const J=[];for(const ce of ne){const fe=ce().then(()=>{J.splice(J.indexOf(fe),1)});J.push(fe),J.length>=Mwe&&await Promise.race(J)}await Promise.all(J)}catch(ne){console.error("Error executing notebook cells:",ne),S(ne)}finally{x(!1)}},[d,c,F,W,K,o,a,l,i,r.notebooks]);E.useEffect(()=>{!d||!c?.notebookCells||P([],new Map)},[d,c,P]);const G=E.useRef("");E.useEffect(()=>{const H=JSON.stringify({filters:w.map(te=>({dim:te.dimensionName,type:te.matchType,val:te.value,val2:te.value2})),givens:Array.from(I.entries()).sort(([te],[Z])=>te.localeCompare(Z))});if(H!==G.current){if(G.current===""&&w.length===0&&I.size===0){G.current=H;return}G.current=H,v||P(w,I)}},[w,I,v,P]);const X=E.useCallback(H=>te=>{B(H,te)},[B]);return j.some(H=>H.filterType==="Retrieval"),g.jsx(ere,{children:g.jsx(tre,{children:g.jsxs(so,{spacing:3,component:"section",children:[g.jsx(kwe,{givens:L,values:I,onChange:$,onClearAll:_}),j.length>0&&q&&g.jsxs(Za,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[g.jsx(gt,{variant:"subtitle2",sx:{fontWeight:600,mb:2,color:"#333"},children:"Filters"}),g.jsx(Et,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:3},children:j.map(H=>{const te=$l(H),Z=q.get(te)||[],Y=z.get(te);return H.filterType==="Retrieval"&&!n?null:g.jsx(Et,{children:g.jsx(zTe,{spec:H,values:Z,selection:Y?.selection,onChange:X(te),retrievalFn:n})},te)})})]}),!d&&!p&&g.jsx(Ea,{text:"Fetching Notebook..."}),d&&(b.length>0?b:c?.notebookCells||[]).map((H,te)=>g.jsx(Rwe,{cell:H,index:te,resourceUri:e,maxResultSize:t,isExecuting:v},te)),p&&h.status===404&&g.jsxs(gt,{variant:"body2",sx:{color:"text.secondary"},children:[g.jsx("code",{children:`${o} > ${a} > ${l}`})," ","not found."]}),p&&h.status!==404&&g.jsx(Ca,{error:h,context:`${o} > ${a} > ${l}`}),C&&g.jsx(Ca,{error:{message:C.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})})})}const Nwe=fr(g.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}));function kS({type:e,size:t=18,sx:n,...r}){return g.jsxs(ub,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:[e==="report"&&g.jsx(Pwe,{}),e==="model"&&g.jsx(Iwe,{}),e==="data"&&g.jsx(_we,{})]})}function Pwe(){return g.jsxs(g.Fragment,{children:[g.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"}),g.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),g.jsx("path",{d:"M8 17 v-3"}),g.jsx("path",{d:"M12 17 v-6"}),g.jsx("path",{d:"M16 17 v-4"})]})}function Iwe(){return g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),g.jsx("path",{d:"M4 7 l8 4 l8 -4"}),g.jsx("path",{d:"M12 11 v10"})]})}function _we(){return g.jsxs(g.Fragment,{children:[g.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),g.jsx("path",{d:"M3.5 9.5 H20.5"}),g.jsx("path",{d:"M9.5 3.5 V20.5"})]})}const VI="README.malloynb";function _ke({onClickPackageFile:e,resourceUri:t,retrievalFn:n}){const{apiClients:r}=yr(),o=e??(R=>{window.location.href=R}),{environmentName:a,packageName:i,versionId:l}=eo(t),[c,d]=E.useState(null),p=To({queryKey:["package",a,i,l],queryFn:()=>r.packages.getPackage(a,i,l,!1)}),h=To({queryKey:["notebooks",a,i,l],queryFn:()=>r.notebooks.listNotebooks(a,i,l)}),b=To({queryKey:["models",a,i,l],queryFn:()=>r.models.listModels(a,i,l)}),y=To({queryKey:["databases",a,i,l],queryFn:()=>r.databases.listDatabases(a,i,l)}),v=(h.data?.data??[]).slice().sort((R,D)=>R.path.localeCompare(D.path)),x=(b.data?.data??[]).slice().sort((R,D)=>R.path.localeCompare(D.path)),C=(y.data?.data??[]).slice().sort((R,D)=>R.path.localeCompare(D.path)),S=p.data?.data?.description??"",A=v.some(R=>R.path===VI),T=mw({environmentName:a,packageName:i,versionId:l,modelPath:VI}),M=!h.isSuccess&&!h.isError;return p.isError?g.jsx(Ca,{error:p.error,context:`${a} > ${i}`}):g.jsxs(iT,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[g.jsxs(Et,{sx:{mb:4},children:[g.jsxs(WY,{onClick:R=>o(`/${a}/`,R),underline:"none",sx:{display:"inline-flex",alignItems:"center",gap:.5,cursor:"pointer",color:"text.secondary",fontSize:"0.875rem",mb:2,"&:hover":{color:"primary.main"}},children:[g.jsx(Nwe,{sx:{fontSize:18}}),"Back to ",a]}),g.jsx(gt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:i}),S&&g.jsx(gt,{variant:"body2",color:"text.secondary",children:S})]}),M&&g.jsx(Ea,{text:"Loading package..."}),!M&&g.jsxs(g.Fragment,{children:[g.jsxs(AS,{title:"Governed Reports",count:v.length,children:[v.map(R=>g.jsx(DS,{icon:g.jsx(kS,{type:"report"}),tint:Lc.teal,label:R.path,onClick:D=>o(R.path,D)},R.path)),v.length===0&&g.jsx(RS,{label:"No notebooks"})]}),g.jsxs(AS,{title:"Semantic Models",count:x.length,children:[x.map(R=>g.jsx(DS,{icon:g.jsx(kS,{type:"model"}),tint:Lc.orange,label:R.path,onClick:D=>o(R.path,D)},R.path)),x.length===0&&g.jsx(RS,{label:"No models"})]}),g.jsxs(AS,{title:"Package Data",count:C.length,children:[C.map(R=>g.jsx(DS,{icon:g.jsx(kS,{type:"data"}),tint:Lc.darkBlue,label:R.path,rightLabel:Lwe(R.info.rowCount),onClick:()=>d(R)},R.path)),C.length===0&&g.jsx(RS,{label:"No data files"})]}),A&&g.jsx(Et,{sx:{mt:6},children:g.jsx(Owe,{resourceUri:T,retrievalFn:n})})]}),g.jsxs(Os,{open:c!==null,onClose:()=>d(null),maxWidth:"sm",fullWidth:!0,children:[g.jsxs(Ps,{sx:{pr:6},children:[c?.path,g.jsx(dr,{"aria-label":"close",onClick:()=>d(null),sx:{position:"absolute",right:8,top:8},children:g.jsx(Fs,{fontSize:"small"})})]}),g.jsx(Ns,{children:c?.info?.columns&&g.jsxs(WL,{size:"small",children:[g.jsx(GL,{children:g.jsxs(nb,{children:[g.jsx(Ml,{children:"Column"}),g.jsx(Ml,{children:"Type"})]})}),g.jsx(qL,{children:c.info.columns.map(R=>g.jsxs(nb,{children:[g.jsx(Ml,{component:"th",scope:"row",children:R.name}),g.jsx(Ml,{children:R.type})]},R.name))})]})})]})]})}function AS({title:e,count:t,children:n}){return g.jsxs(Et,{sx:{mb:4},children:[g.jsxs(so,{direction:"row",alignItems:"baseline",spacing:1,sx:{mb:1},children:[g.jsx(gt,{variant:"h6",sx:{fontWeight:600,letterSpacing:"-0.025em"},children:e}),g.jsxs(gt,{variant:"caption",color:"text.secondary",children:["(",t,")"]})]}),g.jsx(Et,{children:n})]})}function DS({icon:e,tint:t,label:n,rightLabel:r,onClick:o}){const a=!!o;return g.jsxs(Et,{onClick:o,onKeyDown:a?i=>{o&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),o(i))}:void 0,role:a?"button":void 0,tabIndex:a?0:void 0,sx:{display:"flex",alignItems:"center",gap:1.5,py:1,px:1,mx:-1,cursor:a?"pointer":"default",borderRadius:1.5,transition:"background-color 0.1s","&:hover":a?{backgroundColor:"grey.100"}:void 0,"&:focus-visible":a?{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}:void 0},children:[g.jsx(Et,{sx:{width:32,height:32,borderRadius:1,bgcolor:t,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e}),g.jsx(gt,{variant:"body2",sx:{fontFamily:Jne,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),r&&g.jsx(gt,{variant:"caption",color:"text.secondary",sx:{flexShrink:0},children:r})]})}function RS({label:e}){return g.jsx(gt,{variant:"body2",color:"text.secondary",sx:{py:1,fontStyle:"italic"},children:e})}function Lwe(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 Fwe=async e=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:t}=await fo(async()=>{const{MalloyRenderer:n}=await import("./index.umd-C1Mi1uRm.js").then(r=>r.i);return{MalloyRenderer:n}},[]);return new t({onClick:e,onError:n=>{console.error("Error rendering visualization:",typeof n,n)}}).createViz()};function Bwe({result:e,height:t,onDrill:n,onSizeChange:r}){const o=E.useRef(null),a=E.useRef(!1);return E.useLayoutEffect(()=>{if(!o.current||!e)return;let i=!0;const l=o.current;for(;l.firstChild;)l.removeChild(l.firstChild);a.current=!1;let c=null,d=null;const p=()=>{if(a.current||!i||!l.firstElementChild)return;const h=l.firstElementChild.firstElementChild;if(!h)return;const b=h.firstElementChild;let y=h.scrollHeight||h.offsetHeight||0;b&&h.classList.contains("malloy-dashboard")&&(y=b.scrollHeight||b.offsetHeight||0),y>0&&(a.current=!0,r&&r(y))};return Fwe(n).then(h=>{if(i){c=new MutationObserver(()=>{d&&clearTimeout(d),d=setTimeout(()=>{p(),c?.disconnect()},100)}),c.observe(l,{childList:!0,subtree:!0,attributes:!0});try{h.setResult(JSON.parse(e)),h.render(l)}catch(b){console.error("Error rendering visualization:",b),c?.disconnect()}}}).catch(h=>{console.error("Failed to create renderer:",h)}),()=>{i=!1,c?.disconnect(),d&&clearTimeout(d)}},[e,n,r]),g.jsx("div",{ref:o,style:{width:"100%",height:t?`${t}px`:"400px"}})}function jwe(e){return typeof window>"u"?g.jsx(Et,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):g.jsx(E.Suspense,{fallback:g.jsx(Et,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:g.jsx(Bwe,{...e})})}const $we=Object.freeze(Object.defineProperty({__proto__:null,default:jwe},Symbol.toStringTag,{value:"Module"})),qn={white:"#FFFFFF",offWhite:"#F8F8F6",grey:{light:"#E6E4E1",mid:"#91908F"},black:"#30302E",semantic:{success:{main:"#7A9461",light:"#E8EDDF",dark:"#5F7A4B"},warning:{main:"#B5943A",light:"#F3ECDA",dark:"#8E7430"},error:{main:"#BF6050",light:"#F2DDD9",dark:"#9C4D40"},info:{main:"#628698",light:"#DDE6EA",dark:"#4D6B79"}}},cy='"Inter", "Helvetica Neue", "Arial", sans-serif',La={50:qn.offWhite,100:"#F4F3F1",200:qn.grey.light,300:"#D4D2CF",400:"#B3B1AF",500:qn.grey.mid,600:"#73726F",700:"#555450",800:"#424140",900:qn.black},Lke={headerHeight:56},MS="0 1px 3px rgba(0, 0, 0, 0.1)",zwe=Jb({cssVariables:{nativeColor:!0},palette:{mode:"light",primary:{main:qn.black,light:qn.grey.light,dark:qn.black,contrastText:qn.white},secondary:{main:qn.grey.mid,light:qn.grey.light,dark:qn.black},grey:La,success:qn.semantic.success,warning:qn.semantic.warning,error:qn.semantic.error,info:qn.semantic.info,background:{default:qn.white,paper:qn.white},text:{primary:qn.black,secondary:qn.grey.mid},divider:qn.grey.light},typography:{fontFamily:cy,h1:{fontWeight:500,letterSpacing:"-0.025em"},h2:{fontWeight:500,letterSpacing:"-0.025em"},h3:{fontWeight:500,letterSpacing:"-0.025em"},h4:{fontWeight:500,letterSpacing:"-0.025em"},h5:{fontWeight:500,letterSpacing:"-0.025em"},h6:{fontWeight:500,letterSpacing:"-0.025em"},subtitle1:{fontWeight:500,letterSpacing:"-0.025em"},subtitle2:{fontWeight:500,letterSpacing:"-0.025em"},body1:{letterSpacing:"-0.025em"},body2:{letterSpacing:"-0.025em"},button:{fontWeight:500,letterSpacing:"-0.025em",textTransform:"none"}},shape:{borderRadius:4},components:{MuiButtonBase:{defaultProps:{disableRipple:!0,disableTouchRipple:!0}},MuiCssBaseline:{styleOverrides:{"*":{scrollbarWidth:"thin",scrollbarColor:`${La[300]} ${La[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:La[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:La[300],borderRadius:"4px","&:hover":{background:La[400]}},"&::-webkit-scrollbar-corner":{background:La[100]}},"div[data-radix-popper-content-wrapper]":{zIndex:"1300 !important"}}},MuiButton:{styleOverrides:{root:{borderRadius:20,textTransform:"none",fontWeight:500,boxShadow:"none","&:hover":{boxShadow:MS}},contained:{"&:hover":{boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}}}},MuiCard:{styleOverrides:{root:{borderRadius:4,boxShadow:MS,border:"1px solid",borderColor:qn.grey.light}}},MuiChip:{styleOverrides:{root:{borderRadius:4,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:4},"& .MuiInputLabel-outlined":{backgroundColor:"white",paddingLeft:4,paddingRight:4,"&.MuiInputLabel-shrink":{transform:"translate(14px, -9px) scale(0.75)"}}}}},MuiDialog:{styleOverrides:{paper:{borderRadius:4,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:cy,fontSize:"0.875rem",color:La[600]}}},MuiInputLabel:{styleOverrides:{root:{"&.MuiInputLabel-outlined":{backgroundColor:"white",paddingLeft:4,paddingRight:4}}}},MuiOutlinedInput:{styleOverrides:{notchedOutline:{border:"none"},root:{border:`1px solid ${La[200]}`,borderRadius:8,transition:"border-color 120ms ease-in","&:hover":{borderColor:La[300]},"&.Mui-focused":{borderColor:La[400],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:cy,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:cy}}},MuiMenu:{styleOverrides:{paper:{borderRadius:4,boxShadow:"0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",border:`1px solid ${qn.grey.light}`}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:La[400]}}}},MuiDivider:{styleOverrides:{root:{borderColor:qn.grey.light}},defaultProps:{sx:{my:1}}},MuiListItemButton:{styleOverrides:{root:{borderRadius:28,margin:"2px 8px",padding:"8px 16px","&:hover":{backgroundColor:qn.offWhite},"&.Mui-selected":{backgroundColor:qn.offWhite,color:qn.black,"& .MuiListItemIcon-root":{color:qn.black},"& .MuiListItemText-primary":{color:qn.black},"&:hover":{backgroundColor:qn.grey.light}}}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:qn.white,color:qn.black,boxShadow:MS}}}}}),Uwe=E.lazy(()=>fo(()=>import("./HomePage-BPIpMBjW.js"),[])),Hwe=E.lazy(()=>fo(()=>import("./MainPage-CAwb8U82.js"),[])),Vwe=E.lazy(()=>fo(()=>import("./ModelPage-C0Uevsw9.js"),[])),Wwe=E.lazy(()=>fo(()=>import("./PackagePage-Cu-u9k1g.js"),[])),qwe=E.lazy(()=>fo(()=>import("./EnvironmentPage-CgKNjySu.js"),[])),Gwe=E.lazy(()=>fo(()=>import("./RouteError-DVwPh2Ql.js"),[])),Ywe=E.lazy(()=>fo(()=>import("./WorkbookPage-DW38R2Zv.js"),[])),Kwe=(e="/",t,n)=>v9([{path:e,element:g.jsx(gJ,{children:g.jsx(Bme,{workbookStorage:t,children:g.jsxs(wH,{theme:zwe,children:[g.jsx(bG,{}),g.jsx(E.Suspense,{fallback:g.jsx(Ea,{}),children:g.jsx(Hwe,{headerProps:n})})]})})}),errorElement:g.jsx(Gwe,{}),children:[{index:!0,element:g.jsx(Uwe,{})},{path:":environmentName",element:g.jsx(qwe,{})},{path:":environmentName/:packageName",element:g.jsx(Wwe,{})},{path:":environmentName/:packageName/*",element:g.jsx(Vwe,{})},{path:":environmentName/:packageName/workbook/:workspace/:workbookPath",element:g.jsx(Ywe,{})}]}]),Qwe=Kwe("/",new Vme,void 0);x7.createRoot(document.getElementById("root")).render(g.jsx(E.StrictMode,{children:g.jsx(O9,{router:Qwe})}));export{Ike as $,nn as A,zc as B,Ye as C,PL as D,Ao as E,Wi as F,Jwe as G,Et as H,kL as I,dr as J,eu as K,uT as L,Ume as M,vX as N,Ho as O,Za as P,FL as Q,bh as R,VS as S,gt as T,cv as U,Kd as V,Lke as W,yr as X,eke as Y,Ea as Z,mw as _,E as a,Owe as a0,_ke as a1,Nke as a2,U8 as a3,iT as a4,so as a5,Oke as a6,au as a7,cm as a8,eue as a9,XT as aa,Rv as ab,FT as ac,jT as ad,DN as ae,s3 as af,Zwe as ag,Xwe as ah,lt as ai,Dl as aj,Fb as ak,WI as al,xa as b,ai as c,Bt as d,$S as e,Lt as f,Vz as g,jt as h,TL as i,g as j,mt as k,Ft as l,zt as m,js as n,gi as o,_r as p,tu as q,Pke as r,Be as s,Rs as t,_C as u,iL as v,kd as w,dL as x,HC as y,sL as z};
452
+ `),j=!!e.text&&(R.test(e.text)||D.test(e.text)),z=()=>{if(!e.newSources||e.newSources.length===0)return 0;let L=[],I="";if(e.text){const $=e.text.match(R);$&&(L=$[1].split(",").map(q=>q.trim()));const _=e.text.match(D);_&&(I=_[1].trim())}for(let $=0;$<e.newSources.length;$++)try{const _=JSON.parse(e.newSources[$]);if(L.length>0&&L.includes(_.name)||I&&I===_.path)return $}catch{continue}return 0},B=e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:r}:void 0,U=Dwe({query:e.text,resourceUri:r});E.useEffect(()=>{e.type==="code"&&Sb(F(e.text),"malloy").then(L=>{v(L)})},[e]),E.useEffect(()=>{Sb(U,"typescript").then(L=>{C(L)})},[U]);const w=()=>{const L=window.location.href;navigator.clipboard.writeText(L).then(()=>M("URL copied to clipboard!")).catch(()=>M("Failed to copy URL"))};return e.type==="markdown"&&g.jsx(EE,{children:g.jsxs(Et,{sx:{"& h1, & h2, & h3, & h4, & h5, & h6":{fontWeight:"600",color:"#1a1a1a",marginBottom:"8px",marginTop:"16px"},"& h1":{fontSize:"28px"},"& h2":{fontSize:"24px"},"& h3":{fontSize:"20px"},"& p":{color:"#333333",lineHeight:"1.7",marginBottom:"8px",fontSize:"16px"},"& ul, & ol":{color:"#333333",lineHeight:"1.7",marginBottom:"8px",fontSize:"16px"},"& li":{marginBottom:"4px"}},children:[o===0?g.jsxs(so,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[g.jsx(ib,{children:e.text}),g.jsx(Ho,{title:"Click to copy link",children:g.jsx(LT,{sx:{fontSize:"24px",color:"text.secondary",cursor:"pointer",marginTop:"26px"},onClick:w})})]}):g.jsx(ib,{children:e.text}),g.jsx(zs,{open:T!=="",autoHideDuration:6e3,onClose:()=>M(""),message:T})]})})||e.type==="code"&&g.jsxs(EE,{children:[(!t||!n&&e.result||e.newSources&&e.newSources.length>0)&&g.jsx(so,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:e.newSources&&e.newSources.length>0&&g.jsx(Ry,{sx:{position:"relative",padding:"0"},children:g.jsxs(Et,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[y&&g.jsx("span",{dangerouslySetInnerHTML:{__html:y},style:{fontFamily:"monospace",fontSize:"14px",flex:1,marginRight:"8px"}}),j&&g.jsx(dr,{sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"},width:"32px",height:"32px",flexShrink:0},onClick:()=>A(!0),children:g.jsx(Ib,{sx:{fontSize:"18px",color:"text.secondary"}})})]})})}),g.jsx(rB,{open:S,onClose:()=>A(!1),title:"Data Sources",hasValidImport:j,resourceUri:r,data:B,initialSelectedSourceIndex:z()}),g.jsxs(Os,{open:l,onClose:()=>c(!1),maxWidth:"lg",fullWidth:!0,children:[g.jsxs(Ps,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Malloy Code",g.jsx(dr,{onClick:()=>c(!1),sx:{color:"text.secondary"},children:g.jsx(Fs,{})})]}),g.jsx(Ns,{children:g.jsx(Et,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",padding:"16px",fontFamily:"monospace",fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:"#ffffff"},children:g.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:y}})})})]}),g.jsxs(Os,{open:d,onClose:()=>p(!1),maxWidth:"lg",fullWidth:!0,children:[g.jsxs(Ps,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Embeddable Code",g.jsx(dr,{onClick:()=>p(!1),sx:{color:"text.secondary"},children:g.jsx(Fs,{})})]}),g.jsx(Ns,{children:g.jsxs(so,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"flex-start"},children:[g.jsx(gt,{component:"div",sx:{fontSize:"12px",fontFamily:"monospace","& .line":{textWrap:"wrap"},flex:1},dangerouslySetInnerHTML:{__html:x}}),g.jsx(Ho,{title:"Copy Embeddable Code",children:g.jsx(dr,{sx:{width:"24px",height:"24px",marginLeft:"8px",color:"text.secondary"},onClick:()=>{navigator.clipboard.writeText(U)},children:g.jsx(Awe,{})})})]})})]}),g.jsx(eB,{open:h,onClose:()=>b(!1),result:e.result||"",title:"Results"}),i&&!e.result&&!j&&!(e.newSources&&e.newSources.length>0)&&g.jsx(Ry,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:g.jsx(tv,{size:32})}),e.result&&g.jsxs(Ry,{sx:{position:"relative"},children:[g.jsx(Et,{sx:{paddingTop:"24px"},children:g.jsx(zv,{result:e.result,maxHeight:700,maxResultSize:a})}),g.jsxs(so,{sx:{position:"absolute",top:"8px",right:"8px",flexDirection:"row",gap:"8px",alignItems:"center",zIndex:2},children:[!t&&g.jsx(dr,{sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"},width:"32px",height:"32px"},onClick:L=>{L.stopPropagation(),c(!0)},children:g.jsx(i3,{sx:{fontSize:"18px",color:"text.secondary"}})}),g.jsx(dr,{sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"},width:"32px",height:"32px"},onClick:()=>b(!0),children:g.jsx(Ib,{sx:{fontSize:"18px",color:"text.secondary"}})})]})]})]})}const Mwe=4;function Owe({resourceUri:e,maxResultSize:t=0,retrievalFn:n}){const{apiClients:r}=yr(),{environmentName:o,packageName:a,versionId:i,modelPath:l}=eo(e),{data:c,isSuccess:d,isError:p,error:h}=To({queryKey:[e],queryFn:async()=>(await r.notebooks.getNotebook(o,a,l,i)).data}),[b,y]=E.useState([]),[v,x]=E.useState(!1),[C,S]=E.useState(null),A=E.useMemo(()=>c?UTe(c.annotations):null,[c]),T=E.useMemo(()=>c?.notebookCells?WTe(c.notebookCells):null,[c]),M=E.useMemo(()=>T?.sourceInfoMap??new Map,[T]),R=T?.modelPath??null,D=E.useMemo(()=>{const H=new Map;if(!c?.sources)return H;for(const te of c.sources)if(te.name&&te.filters&&te.filters.length>0){const Z=te.filters.filter(Y=>!Y.implicit);Z.length>0&&H.set(te.name,Z)}return H},[c]),F=D.size>0,j=E.useMemo(()=>{if(F&&R){const H=[];for(const[te,Z]of D)for(const Y of Z??[]){if(!Y.dimension||!Y.type)continue;let ne;const J=Y.dimensionType;J==="boolean"?ne="Boolean":J==="date"||J==="timestamp"||J==="timestamptz"?ne="DateMinMax":J==="number"?ne=Y.type==="equal"||Y.type==="in"?"Star":"MinMax":ne={equal:"Star",in:"Star",like:"Star",greater_than:"MinMax",less_than:"MinMax"}[Y.type]??"Star";const ce={equal:"Equals",in:"Equals",like:"Contains",greater_than:ne==="DateMinMax"?"After":"Greater Than",less_than:ne==="DateMinMax"?"Before":"Less Than"}[Y.type],fe=Y.name!==Y.dimension?Y.name:void 0;H.push({source:te,model:R,dimensionName:Y.dimension,filterType:ne,label:fe,filterName:Y.name??Y.dimension,defaultMatchType:ce,required:Y.required??!1})}return H}return!A||M.size===0||!R?[]:qTe(M,A.filters,R)},[F,D,A,M,R]),{filterStates:z,updateFilter:B,getActiveFilters:U}=xwe({dimensionSpecs:j}),w=E.useMemo(()=>U(),[z,U]),L=Ewe(c),{givenValues:I,updateGiven:$,clearAll:_}=Swe(L);E.useMemo(()=>{const H=new Map;for(const te of j){const Z=$l(te);H.set(Z,te.source)}return H},[j]);const{data:q}=bwe({environment:o,package:a,dimensionSpecs:j,versionId:i,enabled:j.length>0}),W=E.useCallback(H=>{if(H.length===0)return;const te=Y=>Y instanceof Date?Y.toISOString().slice(0,10):String(Y),Z={};for(const Y of H){const ne=Y.filterName??Y.dimensionName,J=Y.value;Array.isArray(J)?Z[ne]=J.map(te):J!=null&&(Z[ne]=te(J))}return Object.keys(Z).length>0?JSON.stringify(Z):void 0},[]),K=E.useCallback(H=>{if(H.size===0)return;const te=Y=>Y instanceof Date?Y.toISOString().slice(0,10):Array.isArray(Y)?Y.map(ne=>te(ne)):Y,Z={};return H.forEach((Y,ne)=>{Y!=null&&(Z[ne]=te(Y))}),Object.keys(Z).length>0?JSON.stringify(Z):void 0},[]),P=E.useCallback(async(H=[],te=new Map)=>{if(!d||!c?.notebookCells)return;y(ne=>ne.length===0?c.notebookCells.map(J=>({...J})):ne.map(J=>({...J,result:void 0}))),x(!0),S(null);const Z=F?W(H):void 0,Y=K(te);try{const ne=[];for(let ce=0;ce<c.notebookCells.length;ce++){const fe=c.notebookCells[ce];if(fe.type==="markdown")continue;const ue=ce,Ce=async()=>{try{const ie=(await r.notebooks.executeNotebookCell(o,a,l,ue,i,Z,void 0,Y)).data,le=ie.result,je=fe.newSources||ie.newSources;y(Ee=>{const be=[...Ee];return be[ue]||(be[ue]={...fe}),be[ue]={...be[ue],result:le,newSources:je},be})}catch(ie){console.error(`Error executing cell ${ue}:`,ie)}};ne.push(Ce)}const J=[];for(const ce of ne){const fe=ce().then(()=>{J.splice(J.indexOf(fe),1)});J.push(fe),J.length>=Mwe&&await Promise.race(J)}await Promise.all(J)}catch(ne){console.error("Error executing notebook cells:",ne),S(ne)}finally{x(!1)}},[d,c,F,W,K,o,a,l,i,r.notebooks]);E.useEffect(()=>{!d||!c?.notebookCells||P([],new Map)},[d,c,P]);const G=E.useRef("");E.useEffect(()=>{const H=JSON.stringify({filters:w.map(te=>({dim:te.dimensionName,type:te.matchType,val:te.value,val2:te.value2})),givens:Array.from(I.entries()).sort(([te],[Z])=>te.localeCompare(Z))});if(H!==G.current){if(G.current===""&&w.length===0&&I.size===0){G.current=H;return}G.current=H,v||P(w,I)}},[w,I,v,P]);const X=E.useCallback(H=>te=>{B(H,te)},[B]);return j.some(H=>H.filterType==="Retrieval"),g.jsx(ere,{children:g.jsx(tre,{children:g.jsxs(so,{spacing:3,component:"section",children:[g.jsx(kwe,{givens:L,values:I,onChange:$,onClearAll:_}),j.length>0&&q&&g.jsxs(Za,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[g.jsx(gt,{variant:"subtitle2",sx:{fontWeight:600,mb:2,color:"#333"},children:"Filters"}),g.jsx(Et,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:3},children:j.map(H=>{const te=$l(H),Z=q.get(te)||[],Y=z.get(te);return H.filterType==="Retrieval"&&!n?null:g.jsx(Et,{children:g.jsx(zTe,{spec:H,values:Z,selection:Y?.selection,onChange:X(te),retrievalFn:n})},te)})})]}),!d&&!p&&g.jsx(Ea,{text:"Fetching Notebook..."}),d&&(b.length>0?b:c?.notebookCells||[]).map((H,te)=>g.jsx(Rwe,{cell:H,index:te,resourceUri:e,maxResultSize:t,isExecuting:v},te)),p&&h.status===404&&g.jsxs(gt,{variant:"body2",sx:{color:"text.secondary"},children:[g.jsx("code",{children:`${o} > ${a} > ${l}`})," ","not found."]}),p&&h.status!==404&&g.jsx(Ca,{error:h,context:`${o} > ${a} > ${l}`}),C&&g.jsx(Ca,{error:{message:C.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})})})}const Nwe=fr(g.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}));function kS({type:e,size:t=18,sx:n,...r}){return g.jsxs(ub,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:[e==="report"&&g.jsx(Pwe,{}),e==="model"&&g.jsx(Iwe,{}),e==="data"&&g.jsx(_we,{})]})}function Pwe(){return g.jsxs(g.Fragment,{children:[g.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"}),g.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),g.jsx("path",{d:"M8 17 v-3"}),g.jsx("path",{d:"M12 17 v-6"}),g.jsx("path",{d:"M16 17 v-4"})]})}function Iwe(){return g.jsxs(g.Fragment,{children:[g.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),g.jsx("path",{d:"M4 7 l8 4 l8 -4"}),g.jsx("path",{d:"M12 11 v10"})]})}function _we(){return g.jsxs(g.Fragment,{children:[g.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),g.jsx("path",{d:"M3.5 9.5 H20.5"}),g.jsx("path",{d:"M9.5 3.5 V20.5"})]})}const VI="README.malloynb";function _ke({onClickPackageFile:e,resourceUri:t,retrievalFn:n}){const{apiClients:r}=yr(),o=e??(R=>{window.location.href=R}),{environmentName:a,packageName:i,versionId:l}=eo(t),[c,d]=E.useState(null),p=To({queryKey:["package",a,i,l],queryFn:()=>r.packages.getPackage(a,i,l,!1)}),h=To({queryKey:["notebooks",a,i,l],queryFn:()=>r.notebooks.listNotebooks(a,i,l)}),b=To({queryKey:["models",a,i,l],queryFn:()=>r.models.listModels(a,i,l)}),y=To({queryKey:["databases",a,i,l],queryFn:()=>r.databases.listDatabases(a,i,l)}),v=(h.data?.data??[]).slice().sort((R,D)=>R.path.localeCompare(D.path)),x=(b.data?.data??[]).slice().sort((R,D)=>R.path.localeCompare(D.path)),C=(y.data?.data??[]).slice().sort((R,D)=>R.path.localeCompare(D.path)),S=p.data?.data?.description??"",A=v.some(R=>R.path===VI),T=mw({environmentName:a,packageName:i,versionId:l,modelPath:VI}),M=!h.isSuccess&&!h.isError;return p.isError?g.jsx(Ca,{error:p.error,context:`${a} > ${i}`}):g.jsxs(iT,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[g.jsxs(Et,{sx:{mb:4},children:[g.jsxs(WY,{onClick:R=>o(`/${a}/`,R),underline:"none",sx:{display:"inline-flex",alignItems:"center",gap:.5,cursor:"pointer",color:"text.secondary",fontSize:"0.875rem",mb:2,"&:hover":{color:"primary.main"}},children:[g.jsx(Nwe,{sx:{fontSize:18}}),"Back to ",a]}),g.jsx(gt,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:i}),S&&g.jsx(gt,{variant:"body2",color:"text.secondary",children:S})]}),M&&g.jsx(Ea,{text:"Loading package..."}),!M&&g.jsxs(g.Fragment,{children:[g.jsxs(AS,{title:"Governed Reports",count:v.length,children:[v.map(R=>g.jsx(DS,{icon:g.jsx(kS,{type:"report"}),tint:Lc.teal,label:R.path,onClick:D=>o(R.path,D)},R.path)),v.length===0&&g.jsx(RS,{label:"No notebooks"})]}),g.jsxs(AS,{title:"Semantic Models",count:x.length,children:[x.map(R=>g.jsx(DS,{icon:g.jsx(kS,{type:"model"}),tint:Lc.orange,label:R.path,onClick:D=>o(R.path,D)},R.path)),x.length===0&&g.jsx(RS,{label:"No models"})]}),g.jsxs(AS,{title:"Package Data",count:C.length,children:[C.map(R=>g.jsx(DS,{icon:g.jsx(kS,{type:"data"}),tint:Lc.darkBlue,label:R.path,rightLabel:Lwe(R.info.rowCount),onClick:()=>d(R)},R.path)),C.length===0&&g.jsx(RS,{label:"No data files"})]}),A&&g.jsx(Et,{sx:{mt:6},children:g.jsx(Owe,{resourceUri:T,retrievalFn:n})})]}),g.jsxs(Os,{open:c!==null,onClose:()=>d(null),maxWidth:"sm",fullWidth:!0,children:[g.jsxs(Ps,{sx:{pr:6},children:[c?.path,g.jsx(dr,{"aria-label":"close",onClick:()=>d(null),sx:{position:"absolute",right:8,top:8},children:g.jsx(Fs,{fontSize:"small"})})]}),g.jsx(Ns,{children:c?.info?.columns&&g.jsxs(WL,{size:"small",children:[g.jsx(GL,{children:g.jsxs(nb,{children:[g.jsx(Ml,{children:"Column"}),g.jsx(Ml,{children:"Type"})]})}),g.jsx(qL,{children:c.info.columns.map(R=>g.jsxs(nb,{children:[g.jsx(Ml,{component:"th",scope:"row",children:R.name}),g.jsx(Ml,{children:R.type})]},R.name))})]})})]})]})}function AS({title:e,count:t,children:n}){return g.jsxs(Et,{sx:{mb:4},children:[g.jsxs(so,{direction:"row",alignItems:"baseline",spacing:1,sx:{mb:1},children:[g.jsx(gt,{variant:"h6",sx:{fontWeight:600,letterSpacing:"-0.025em"},children:e}),g.jsxs(gt,{variant:"caption",color:"text.secondary",children:["(",t,")"]})]}),g.jsx(Et,{children:n})]})}function DS({icon:e,tint:t,label:n,rightLabel:r,onClick:o}){const a=!!o;return g.jsxs(Et,{onClick:o,onKeyDown:a?i=>{o&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),o(i))}:void 0,role:a?"button":void 0,tabIndex:a?0:void 0,sx:{display:"flex",alignItems:"center",gap:1.5,py:1,px:1,mx:-1,cursor:a?"pointer":"default",borderRadius:1.5,transition:"background-color 0.1s","&:hover":a?{backgroundColor:"grey.100"}:void 0,"&:focus-visible":a?{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}:void 0},children:[g.jsx(Et,{sx:{width:32,height:32,borderRadius:1,bgcolor:t,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e}),g.jsx(gt,{variant:"body2",sx:{fontFamily:Jne,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),r&&g.jsx(gt,{variant:"caption",color:"text.secondary",sx:{flexShrink:0},children:r})]})}function RS({label:e}){return g.jsx(gt,{variant:"body2",color:"text.secondary",sx:{py:1,fontStyle:"italic"},children:e})}function Lwe(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 Fwe=async e=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:t}=await fo(async()=>{const{MalloyRenderer:n}=await import("./index.umd-BXcsl2XW.js").then(r=>r.i);return{MalloyRenderer:n}},[]);return new t({onClick:e,onError:n=>{console.error("Error rendering visualization:",typeof n,n)}}).createViz()};function Bwe({result:e,height:t,onDrill:n,onSizeChange:r}){const o=E.useRef(null),a=E.useRef(!1);return E.useLayoutEffect(()=>{if(!o.current||!e)return;let i=!0;const l=o.current;for(;l.firstChild;)l.removeChild(l.firstChild);a.current=!1;let c=null,d=null;const p=()=>{if(a.current||!i||!l.firstElementChild)return;const h=l.firstElementChild.firstElementChild;if(!h)return;const b=h.firstElementChild;let y=h.scrollHeight||h.offsetHeight||0;b&&h.classList.contains("malloy-dashboard")&&(y=b.scrollHeight||b.offsetHeight||0),y>0&&(a.current=!0,r&&r(y))};return Fwe(n).then(h=>{if(i){c=new MutationObserver(()=>{d&&clearTimeout(d),d=setTimeout(()=>{p(),c?.disconnect()},100)}),c.observe(l,{childList:!0,subtree:!0,attributes:!0});try{h.setResult(JSON.parse(e)),h.render(l)}catch(b){console.error("Error rendering visualization:",b),c?.disconnect()}}}).catch(h=>{console.error("Failed to create renderer:",h)}),()=>{i=!1,c?.disconnect(),d&&clearTimeout(d)}},[e,n,r]),g.jsx("div",{ref:o,style:{width:"100%",height:t?`${t}px`:"400px"}})}function jwe(e){return typeof window>"u"?g.jsx(Et,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):g.jsx(E.Suspense,{fallback:g.jsx(Et,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:g.jsx(Bwe,{...e})})}const $we=Object.freeze(Object.defineProperty({__proto__:null,default:jwe},Symbol.toStringTag,{value:"Module"})),qn={white:"#FFFFFF",offWhite:"#F8F8F6",grey:{light:"#E6E4E1",mid:"#91908F"},black:"#30302E",semantic:{success:{main:"#7A9461",light:"#E8EDDF",dark:"#5F7A4B"},warning:{main:"#B5943A",light:"#F3ECDA",dark:"#8E7430"},error:{main:"#BF6050",light:"#F2DDD9",dark:"#9C4D40"},info:{main:"#628698",light:"#DDE6EA",dark:"#4D6B79"}}},cy='"Inter", "Helvetica Neue", "Arial", sans-serif',La={50:qn.offWhite,100:"#F4F3F1",200:qn.grey.light,300:"#D4D2CF",400:"#B3B1AF",500:qn.grey.mid,600:"#73726F",700:"#555450",800:"#424140",900:qn.black},Lke={headerHeight:56},MS="0 1px 3px rgba(0, 0, 0, 0.1)",zwe=Jb({cssVariables:{nativeColor:!0},palette:{mode:"light",primary:{main:qn.black,light:qn.grey.light,dark:qn.black,contrastText:qn.white},secondary:{main:qn.grey.mid,light:qn.grey.light,dark:qn.black},grey:La,success:qn.semantic.success,warning:qn.semantic.warning,error:qn.semantic.error,info:qn.semantic.info,background:{default:qn.white,paper:qn.white},text:{primary:qn.black,secondary:qn.grey.mid},divider:qn.grey.light},typography:{fontFamily:cy,h1:{fontWeight:500,letterSpacing:"-0.025em"},h2:{fontWeight:500,letterSpacing:"-0.025em"},h3:{fontWeight:500,letterSpacing:"-0.025em"},h4:{fontWeight:500,letterSpacing:"-0.025em"},h5:{fontWeight:500,letterSpacing:"-0.025em"},h6:{fontWeight:500,letterSpacing:"-0.025em"},subtitle1:{fontWeight:500,letterSpacing:"-0.025em"},subtitle2:{fontWeight:500,letterSpacing:"-0.025em"},body1:{letterSpacing:"-0.025em"},body2:{letterSpacing:"-0.025em"},button:{fontWeight:500,letterSpacing:"-0.025em",textTransform:"none"}},shape:{borderRadius:4},components:{MuiButtonBase:{defaultProps:{disableRipple:!0,disableTouchRipple:!0}},MuiCssBaseline:{styleOverrides:{"*":{scrollbarWidth:"thin",scrollbarColor:`${La[300]} ${La[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:La[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:La[300],borderRadius:"4px","&:hover":{background:La[400]}},"&::-webkit-scrollbar-corner":{background:La[100]}},"div[data-radix-popper-content-wrapper]":{zIndex:"1300 !important"}}},MuiButton:{styleOverrides:{root:{borderRadius:20,textTransform:"none",fontWeight:500,boxShadow:"none","&:hover":{boxShadow:MS}},contained:{"&:hover":{boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}}}},MuiCard:{styleOverrides:{root:{borderRadius:4,boxShadow:MS,border:"1px solid",borderColor:qn.grey.light}}},MuiChip:{styleOverrides:{root:{borderRadius:4,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:4},"& .MuiInputLabel-outlined":{backgroundColor:"white",paddingLeft:4,paddingRight:4,"&.MuiInputLabel-shrink":{transform:"translate(14px, -9px) scale(0.75)"}}}}},MuiDialog:{styleOverrides:{paper:{borderRadius:4,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:cy,fontSize:"0.875rem",color:La[600]}}},MuiInputLabel:{styleOverrides:{root:{"&.MuiInputLabel-outlined":{backgroundColor:"white",paddingLeft:4,paddingRight:4}}}},MuiOutlinedInput:{styleOverrides:{notchedOutline:{border:"none"},root:{border:`1px solid ${La[200]}`,borderRadius:8,transition:"border-color 120ms ease-in","&:hover":{borderColor:La[300]},"&.Mui-focused":{borderColor:La[400],outline:"none"}}}},MuiMenuItem:{styleOverrides:{root:{fontFamily:cy,fontSize:"0.875rem"}}},MuiInputBase:{styleOverrides:{root:{fontFamily:cy}}},MuiMenu:{styleOverrides:{paper:{borderRadius:4,boxShadow:"0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",border:`1px solid ${qn.grey.light}`}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:La[400]}}}},MuiDivider:{styleOverrides:{root:{borderColor:qn.grey.light}},defaultProps:{sx:{my:1}}},MuiListItemButton:{styleOverrides:{root:{borderRadius:28,margin:"2px 8px",padding:"8px 16px","&:hover":{backgroundColor:qn.offWhite},"&.Mui-selected":{backgroundColor:qn.offWhite,color:qn.black,"& .MuiListItemIcon-root":{color:qn.black},"& .MuiListItemText-primary":{color:qn.black},"&:hover":{backgroundColor:qn.grey.light}}}}},MuiAppBar:{styleOverrides:{root:{backgroundColor:qn.white,color:qn.black,boxShadow:MS}}}}}),Uwe=E.lazy(()=>fo(()=>import("./HomePage-HbPwKL84.js"),[])),Hwe=E.lazy(()=>fo(()=>import("./MainPage-DfK4zDYO.js"),[])),Vwe=E.lazy(()=>fo(()=>import("./ModelPage-CUgSwGXg.js"),[])),Wwe=E.lazy(()=>fo(()=>import("./PackagePage-CUDQNL5k.js"),[])),qwe=E.lazy(()=>fo(()=>import("./EnvironmentPage-KoP4wt8H.js"),[])),Gwe=E.lazy(()=>fo(()=>import("./RouteError-sgmtBdg8.js"),[])),Ywe=E.lazy(()=>fo(()=>import("./WorkbookPage-tnWmLcrW.js"),[])),Kwe=(e="/",t,n)=>v9([{path:e,element:g.jsx(gJ,{children:g.jsx(Bme,{workbookStorage:t,children:g.jsxs(wH,{theme:zwe,children:[g.jsx(bG,{}),g.jsx(E.Suspense,{fallback:g.jsx(Ea,{}),children:g.jsx(Hwe,{headerProps:n})})]})})}),errorElement:g.jsx(Gwe,{}),children:[{index:!0,element:g.jsx(Uwe,{})},{path:":environmentName",element:g.jsx(qwe,{})},{path:":environmentName/:packageName",element:g.jsx(Wwe,{})},{path:":environmentName/:packageName/*",element:g.jsx(Vwe,{})},{path:":environmentName/:packageName/workbook/:workspace/:workbookPath",element:g.jsx(Ywe,{})}]}]),Qwe=Kwe("/",new Vme,void 0);x7.createRoot(document.getElementById("root")).render(g.jsx(E.StrictMode,{children:g.jsx(O9,{router:Qwe})}));export{Ike as $,nn as A,zc as B,Ye as C,PL as D,Ao as E,Wi as F,Jwe as G,Et as H,kL as I,dr as J,Ho as K,eu as L,Ume as M,uT as N,vX as O,Za as P,FL as Q,bh as R,VS as S,gt as T,cv as U,Kd as V,Lke as W,yr as X,eke as Y,Ea as Z,mw as _,E as a,Owe as a0,_ke as a1,Nke as a2,U8 as a3,iT as a4,so as a5,Oke as a6,au as a7,cm as a8,eue as a9,XT as aa,Rv as ab,FT as ac,jT as ad,DN as ae,s3 as af,Zwe as ag,Xwe as ah,lt as ai,Dl as aj,Fb as ak,WI as al,xa as b,ai as c,Bt as d,$S as e,Lt as f,Vz as g,jt as h,TL as i,g as j,mt as k,Ft as l,zt as m,js as n,gi as o,_r as p,tu as q,Pke as r,Be as s,Rs as t,_C as u,iL as v,kd as w,dL as x,HC as y,sL as z};