@malloy-publisher/app 0.0.188 → 0.0.189-dev

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-B4ZYB7aS.es-8Zh0TkSr.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/index-BefdHHMa.js","assets/index-BWJkzsfl.js","assets/index.umd-lY-87l4L.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/core-CjeTkq8O.es-BqRc6yhC.js","assets/engine-oniguruma-C4vnmooL.es-jdkXmgTr.js","assets/index-D68X76-7.js","assets/index-Bb2jqquW.js","assets/index.umd-DGBekgSu.js"])))=>i.map(i=>d[i]);
2
2
  function f$(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 iMe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Y5(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function sMe(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 bS={exports:{}},Fp={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -216,7 +216,7 @@ export default theme;`}function xI(e){return typeof e=="number"?`${(e*100).toFix
216
216
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[kO]=this[kO]={accessors:{}}).accessors,o=this.prototype;function a(i){const l=Qp(i);r[l]||(Xee(o,i),r[l]=!0)}return Ne.isArray(t)?t.forEach(a):a(t),this}};ea.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ne.reduceDescriptors(ea.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});Ne.freezeMethods(ea);function HS(e,t){const n=this||og,r=t||n,o=ea.from(r.headers);let a=r.data;return Ne.forEach(e,function(l){a=l.call(n,a,o.normalize(),t?t.status:void 0)}),o.normalize(),a}function vL(e){return!!(e&&e.__CANCEL__)}function If(e,t,n){en.call(this,e??"canceled",en.ERR_CANCELED,t,n),this.name="CanceledError"}Ne.inherits(If,en,{__CANCEL__:!0});function xL(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new en("Request failed with status code "+n.status,[en.ERR_BAD_REQUEST,en.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Zee(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Jee(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,a=0,i;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),f=r[a];i||(i=d),n[o]=c,r[o]=d;let h=a,g=0;for(;h!==o;)g+=n[h++],h=h%e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),d-i<t)return;const m=f&&d-f;return m?Math.round(g*1e3/m):void 0}}function ete(e,t){let n=0,r=1e3/t,o,a;const i=(d,f=Date.now())=>{n=f,o=null,a&&(clearTimeout(a),a=null),e(...d)};return[(...d)=>{const f=Date.now(),h=f-n;h>=r?i(d,f):(o=d,a||(a=setTimeout(()=>{a=null,i(o)},r-h)))},()=>o&&i(o)]}const fv=(e,t,n=3)=>{let r=0;const o=Jee(50,250);return ete(a=>{const i=a.loaded,l=a.lengthComputable?a.total:void 0,c=i-r,d=o(c),f=i<=l;r=i;const h={loaded:i,total:l,progress:l?i/l:void 0,bytes:c,rate:d||void 0,estimated:d&&l&&f?(l-i)/d:void 0,event:a,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(h)},n)},AO=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},DO=e=>(...t)=>Ne.asap(()=>e(...t)),tte=So.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,So.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(So.origin),So.navigator&&/(msie|trident)/i.test(So.navigator.userAgent)):()=>!0,nte=So.hasStandardBrowserEnv?{write(e,t,n,r,o,a){const i=[e+"="+encodeURIComponent(t)];Ne.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),Ne.isString(r)&&i.push("path="+r),Ne.isString(o)&&i.push("domain="+o),a===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function rte(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ote(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function SL(e,t,n){let r=!rte(t);return e&&(r||n==!1)?ote(e,t):t}const RO=e=>e instanceof ea?{...e}:e;function fu(e,t){t=t||{};const n={};function r(d,f,h,g){return Ne.isPlainObject(d)&&Ne.isPlainObject(f)?Ne.merge.call({caseless:g},d,f):Ne.isPlainObject(f)?Ne.merge({},f):Ne.isArray(f)?f.slice():f}function o(d,f,h,g){if(Ne.isUndefined(f)){if(!Ne.isUndefined(d))return r(void 0,d,h,g)}else return r(d,f,h,g)}function a(d,f){if(!Ne.isUndefined(f))return r(void 0,f)}function i(d,f){if(Ne.isUndefined(f)){if(!Ne.isUndefined(d))return r(void 0,d)}else return r(void 0,f)}function l(d,f,h){if(h in t)return r(d,f);if(h in e)return r(void 0,d)}const c={url:a,method:a,data:a,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:l,headers:(d,f,h)=>o(RO(d),RO(f),h,!0)};return Ne.forEach(Object.keys({...e,...t}),function(f){const h=c[f]||o,g=h(e[f],t[f],f);Ne.isUndefined(g)&&h!==l||(n[f]=g)}),n}const EL=e=>{const t=fu({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:a,headers:i,auth:l}=t;if(t.headers=i=ea.from(i),t.url=gL(SL(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),Ne.isFormData(n)){if(So.hasStandardBrowserEnv||So.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(Ne.isFunction(n.getHeaders)){const c=n.getHeaders(),d=["content-type","content-length"];Object.entries(c).forEach(([f,h])=>{d.includes(f.toLowerCase())&&i.set(f,h)})}}if(So.hasStandardBrowserEnv&&(r&&Ne.isFunction(r)&&(r=r(t)),r||r!==!1&&tte(t.url))){const c=o&&a&&nte.read(a);c&&i.set(o,c)}return t},ate=typeof XMLHttpRequest<"u",ite=ate&&function(e){return new Promise(function(n,r){const o=EL(e);let a=o.data;const i=ea.from(o.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:d}=o,f,h,g,m,v;function S(){m&&m(),v&&v(),o.cancelToken&&o.cancelToken.unsubscribe(f),o.signal&&o.signal.removeEventListener("abort",f)}let E=new XMLHttpRequest;E.open(o.method.toUpperCase(),o.url,!0),E.timeout=o.timeout;function x(){if(!E)return;const T=ea.from("getAllResponseHeaders"in E&&E.getAllResponseHeaders()),D={data:!l||l==="text"||l==="json"?E.responseText:E.response,status:E.status,statusText:E.statusText,headers:T,config:e,request:E};xL(function(F){n(F),S()},function(F){r(F),S()},D),E=null}"onloadend"in E?E.onloadend=x:E.onreadystatechange=function(){!E||E.readyState!==4||E.status===0&&!(E.responseURL&&E.responseURL.indexOf("file:")===0)||setTimeout(x)},E.onabort=function(){E&&(r(new en("Request aborted",en.ECONNABORTED,e,E)),E=null)},E.onerror=function(R){const D=R&&R.message?R.message:"Network Error",M=new en(D,en.ERR_NETWORK,e,E);M.event=R||null,r(M),E=null},E.ontimeout=function(){let R=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const D=o.transitional||yL;o.timeoutErrorMessage&&(R=o.timeoutErrorMessage),r(new en(R,D.clarifyTimeoutError?en.ETIMEDOUT:en.ECONNABORTED,e,E)),E=null},a===void 0&&i.setContentType(null),"setRequestHeader"in E&&Ne.forEach(i.toJSON(),function(R,D){E.setRequestHeader(D,R)}),Ne.isUndefined(o.withCredentials)||(E.withCredentials=!!o.withCredentials),l&&l!=="json"&&(E.responseType=o.responseType),d&&([g,v]=fv(d,!0),E.addEventListener("progress",g)),c&&E.upload&&([h,m]=fv(c),E.upload.addEventListener("progress",h),E.upload.addEventListener("loadend",m)),(o.cancelToken||o.signal)&&(f=T=>{E&&(r(!T||T.type?new If(null,e,E):T),E.abort(),E=null)},o.cancelToken&&o.cancelToken.subscribe(f),o.signal&&(o.signal.aborted?f():o.signal.addEventListener("abort",f)));const w=Zee(o.url);if(w&&So.protocols.indexOf(w)===-1){r(new en("Unsupported protocol "+w+":",en.ERR_BAD_REQUEST,e));return}E.send(a||null)})},ste=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,o;const a=function(d){if(!o){o=!0,l();const f=d instanceof Error?d:this.reason;r.abort(f instanceof en?f:new If(f instanceof Error?f.message:f))}};let i=t&&setTimeout(()=>{i=null,a(new en(`timeout ${t} of ms exceeded`,en.ETIMEDOUT))},t);const l=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(a):d.removeEventListener("abort",a)}),e=null)};e.forEach(d=>d.addEventListener("abort",a));const{signal:c}=r;return c.unsubscribe=()=>Ne.asap(l),c}},lte=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,o;for(;r<n;)o=r+t,yield e.slice(r,o),r=o},cte=async function*(e,t){for await(const n of ute(e))yield*lte(n,t)},ute=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},MO=(e,t,n,r)=>{const o=cte(e,t);let a=0,i,l=c=>{i||(i=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:d,value:f}=await o.next();if(d){l(),c.close();return}let h=f.byteLength;if(n){let g=a+=h;n(g)}c.enqueue(new Uint8Array(f))}catch(d){throw l(d),d}},cancel(c){return l(c),o.return()}},{highWaterMark:2})},IO=64*1024,{isFunction:Gy}=Ne,dte=(({Request:e,Response:t})=>({Request:e,Response:t}))(Ne.global),{ReadableStream:OO,TextEncoder:NO}=Ne.global,PO=(e,...t)=>{try{return!!e(...t)}catch{return!1}},fte=e=>{e=Ne.merge.call({skipUndefined:!0},dte,e);const{fetch:t,Request:n,Response:r}=e,o=t?Gy(t):typeof fetch=="function",a=Gy(n),i=Gy(r);if(!o)return!1;const l=o&&Gy(OO),c=o&&(typeof NO=="function"?(v=>S=>v.encode(S))(new NO):async v=>new Uint8Array(await new n(v).arrayBuffer())),d=a&&l&&PO(()=>{let v=!1;const S=new n(So.origin,{body:new OO,method:"POST",get duplex(){return v=!0,"half"}}).headers.has("Content-Type");return v&&!S}),f=i&&l&&PO(()=>Ne.isReadableStream(new r("").body)),h={stream:f&&(v=>v.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!h[v]&&(h[v]=(S,E)=>{let x=S&&S[v];if(x)return x.call(S);throw new en(`Response type '${v}' is not supported`,en.ERR_NOT_SUPPORT,E)})});const g=async v=>{if(v==null)return 0;if(Ne.isBlob(v))return v.size;if(Ne.isSpecCompliantForm(v))return(await new n(So.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(Ne.isArrayBufferView(v)||Ne.isArrayBuffer(v))return v.byteLength;if(Ne.isURLSearchParams(v)&&(v=v+""),Ne.isString(v))return(await c(v)).byteLength},m=async(v,S)=>{const E=Ne.toFiniteNumber(v.getContentLength());return E??g(S)};return async v=>{let{url:S,method:E,data:x,signal:w,cancelToken:T,timeout:R,onDownloadProgress:D,onUploadProgress:M,responseType:F,headers:B,withCredentials:H="same-origin",fetchOptions:j}=EL(v),z=t||fetch;F=F?(F+"").toLowerCase():"text";let k=ste([w,T&&T.toAbortSignal()],R),_=null;const P=k&&k.unsubscribe&&(()=>{k.unsubscribe()});let $;try{if(M&&d&&E!=="get"&&E!=="head"&&($=await m(B,x))!==0){let q=new n(S,{method:"POST",body:x,duplex:"half"}),K;if(Ne.isFormData(x)&&(K=q.headers.get("content-type"))&&B.setContentType(K),q.body){const[U,J]=AO($,fv(DO(M)));x=MO(q.body,IO,U,J)}}Ne.isString(H)||(H=H?"include":"omit");const L=a&&"credentials"in n.prototype,G={...j,signal:k,method:E.toUpperCase(),headers:B.normalize().toJSON(),body:x,duplex:"half",credentials:L?H:void 0};_=a&&new n(S,G);let V=await(a?z(_,j):z(S,G));const Y=f&&(F==="stream"||F==="response");if(f&&(D||Y&&P)){const q={};["status","statusText","headers"].forEach(Z=>{q[Z]=V[Z]});const K=Ne.toFiniteNumber(V.headers.get("content-length")),[U,J]=D&&AO(K,fv(DO(D),!0))||[];V=new r(MO(V.body,IO,U,()=>{J&&J(),P&&P()}),q)}F=F||"text";let N=await h[Ne.findKey(h,F)||"text"](V,v);return!Y&&P&&P(),await new Promise((q,K)=>{xL(q,K,{data:N,headers:ea.from(V.headers),status:V.status,statusText:V.statusText,config:v,request:_})})}catch(L){throw P&&P(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new en("Network Error",en.ERR_NETWORK,v,_),{cause:L.cause||L}):en.from(L,L&&L.code,v,_)}}},pte=new Map,CL=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:o}=t,a=[r,o,n];let i=a.length,l=i,c,d,f=pte;for(;l--;)c=a[l],d=f.get(c),d===void 0&&f.set(c,d=l?new Map:fte(t)),f=d;return d};CL();const DC={http:Mee,xhr:ite,fetch:{get:CL}};Ne.forEach(DC,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const _O=e=>`- ${e}`,hte=e=>Ne.isFunction(e)||e===null||e===!1,TL={getAdapter:(e,t)=>{e=Ne.isArray(e)?e:[e];const{length:n}=e;let r,o;const a={};for(let i=0;i<n;i++){r=e[i];let l;if(o=r,!hte(r)&&(o=DC[(l=String(r)).toLowerCase()],o===void 0))throw new en(`Unknown adapter '${l}'`);if(o&&(Ne.isFunction(o)||(o=o.get(t))))break;a[l||"#"+i]=o}if(!o){const i=Object.entries(a).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=n?i.length>1?`since :
217
217
  `+i.map(_O).join(`
218
218
  `):" "+_O(i[0]):"as no adapter specified";throw new en("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return o},adapters:DC};function VS(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new If(null,e)}function LO(e){return VS(e),e.headers=ea.from(e.headers),e.data=HS.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),TL.getAdapter(e.adapter||og.adapter,e)(e).then(function(r){return VS(e),r.data=HS.call(e,e.transformResponse,r),r.headers=ea.from(r.headers),r},function(r){return vL(r)||(VS(e),r&&r.response&&(r.response.data=HS.call(e,e.transformResponse,r.response),r.response.headers=ea.from(r.response.headers))),Promise.reject(r)})}const wL="1.12.2",x0={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{x0[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const FO={};x0.transitional=function(t,n,r){function o(a,i){return"[Axios v"+wL+"] Transitional option '"+a+"'"+i+(r?". "+r:"")}return(a,i,l)=>{if(t===!1)throw new en(o(i," has been removed"+(n?" in "+n:"")),en.ERR_DEPRECATED);return n&&!FO[i]&&(FO[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(a,i,l):!0}};x0.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function mte(e,t,n){if(typeof e!="object")throw new en("options must be an object",en.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const a=r[o],i=t[a];if(i){const l=e[a],c=l===void 0||i(l,a,e);if(c!==!0)throw new en("option "+a+" must be "+c,en.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new en("Unknown option "+a,en.ERR_BAD_OPTION)}}const kb={assertOptions:mte,validators:x0},ji=kb.validators;let eu=class{constructor(t){this.defaults=t||{},this.interceptors={request:new wO,response:new wO}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const a=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?a&&!String(r.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(r.stack+=`
219
- `+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=fu(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&kb.assertOptions(r,{silentJSONParsing:ji.transitional(ji.boolean),forcedJSONParsing:ji.transitional(ji.boolean),clarifyTimeoutError:ji.transitional(ji.boolean)},!1),o!=null&&(Ne.isFunction(o)?n.paramsSerializer={serialize:o}:kb.assertOptions(o,{encode:ji.function,serialize:ji.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),kb.assertOptions(n,{baseUrl:ji.spelling("baseURL"),withXsrfToken:ji.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=a&&Ne.merge(a.common,a[n.method]);a&&Ne.forEach(["delete","get","head","post","put","patch","common"],v=>{delete a[v]}),n.headers=ea.concat(i,a);const l=[];let c=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(n)===!1||(c=c&&S.synchronous,l.unshift(S.fulfilled,S.rejected))});const d=[];this.interceptors.response.forEach(function(S){d.push(S.fulfilled,S.rejected)});let f,h=0,g;if(!c){const v=[LO.bind(this),void 0];for(v.unshift(...l),v.push(...d),g=v.length,f=Promise.resolve(n);h<g;)f=f.then(v[h++],v[h++]);return f}g=l.length;let m=n;for(;h<g;){const v=l[h++],S=l[h++];try{m=v(m)}catch(E){S.call(this,E);break}}try{f=LO.call(this,m)}catch(v){return Promise.reject(v)}for(h=0,g=d.length;h<g;)f=f.then(d[h++],d[h++]);return f}getUri(t){t=fu(this.defaults,t);const n=SL(t.baseURL,t.url,t.allowAbsoluteUrls);return gL(n,t.params,t.paramsSerializer)}};Ne.forEach(["delete","get","head","options"],function(t){eu.prototype[t]=function(n,r){return this.request(fu(r||{},{method:t,url:n,data:(r||{}).data}))}});Ne.forEach(["post","put","patch"],function(t){function n(r){return function(a,i,l){return this.request(fu(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}eu.prototype[t]=n(),eu.prototype[t+"Form"]=n(!0)});let gte=class kL{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(o=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(l=>{r.subscribe(l),a=l}).then(o);return i.cancel=function(){r.unsubscribe(a)},i},t(function(a,i,l){r.reason||(r.reason=new If(a,i,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new kL(function(o){t=o}),cancel:t}}};function yte(e){return function(n){return e.apply(null,n)}}function bte(e){return Ne.isObject(e)&&e.isAxiosError===!0}const RC={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(RC).forEach(([e,t])=>{RC[t]=e});function AL(e){const t=new eu(e),n=oL(eu.prototype.request,t);return Ne.extend(n,eu.prototype,t,{allOwnKeys:!0}),Ne.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return AL(fu(e,o))},n}const Dt=AL(og);Dt.Axios=eu;Dt.CanceledError=If;Dt.CancelToken=gte;Dt.isCancel=vL;Dt.VERSION=wL;Dt.toFormData=v0;Dt.AxiosError=en;Dt.Cancel=Dt.CanceledError;Dt.all=function(t){return Promise.all(t)};Dt.spread=yte;Dt.isAxiosError=bte;Dt.mergeConfig=fu;Dt.AxiosHeaders=ea;Dt.formToJSON=e=>bL(Ne.isHTMLForm(e)?new FormData(e):e);Dt.getAdapter=TL.getAdapter;Dt.HttpStatusCode=RC;Dt.default=Dt;const{Axios:pMe,AxiosError:hMe,CanceledError:mMe,isCancel:gMe,CancelToken:yMe,VERSION:bMe,all:vMe,Cancel:xMe,isAxiosError:SMe,spread:EMe,toFormData:CMe,AxiosHeaders:TMe,HttpStatusCode:wMe,formToJSON:kMe,getAdapter:AMe,mergeConfig:DMe}=Dt,xn="http://localhost/api/v0".replace(/\/+$/,"");let lc=class{constructor(t,n=xn,r=Dt){this.basePath=n,this.axios=r,t&&(this.configuration=t,this.basePath=t.basePath??n)}configuration},vte=class extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}};const Cn={},Tn="https://example.com",gt=function(e,t,n){if(n==null)throw new vte(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function MC(e,t,n=""){t!=null&&(typeof t=="object"?Array.isArray(t)?t.forEach(r=>MC(e,r,n)):Object.keys(t).forEach(r=>MC(e,t[r],`${n}${n!==""?".":""}${r}`)):e.has(n)?e.append(n,t):e.set(n,t))}const wn=function(e,...t){const n=new URLSearchParams(e.search);MC(n,t),e.search=n.toString()},Xa=function(e,t,n){const r=typeof e!="string";return(r&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):r)?JSON.stringify(e!==void 0?e:{}):e||""},kn=function(e){return e.pathname+e.search+e.hash},An=function(e,t,n,r){return(o=t,a=n)=>{const i={...e.options,url:(o.defaults.baseURL?"":r?.basePath??a)+e.url};return o.request(i)}},DL={Bigquery:"bigquery",Snowflake:"snowflake",Postgres:"postgres",Gcs:"gcs",S3:"s3",Azure:"azure"},RL={Postgres:"postgres",Bigquery:"bigquery",Snowflake:"snowflake",Trino:"trino",Mysql:"mysql",Duckdb:"duckdb",Motherduck:"motherduck",Ducklake:"ducklake"},xte=function(e){return{createConnection:async(t,n,r,o={})=>{gt("createConnection","projectName",t),gt("createConnection","connectionName",n),gt("createConnection","connection",r);const a="/projects/{projectName}/connections/{connectionName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"POST",...l,...o},d={},f={};d["Content-Type"]="application/json",wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},c.data=Xa(r,c,e),{url:kn(i),options:c}},deleteConnection:async(t,n,r={})=>{gt("deleteConnection","projectName",t),gt("deleteConnection","connectionName",n);const o="/projects/{projectName}/connections/{connectionName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"DELETE",...i,...r},c={};wn(a,{});let d=i&&i.headers?i.headers:{};return l.headers={...c,...d,...r.headers},{url:kn(a),options:l}},getConnection:async(t,n,r={})=>{gt("getConnection","projectName",t),gt("getConnection","connectionName",n);const o="/projects/{projectName}/connections/{connectionName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"GET",...i,...r},c={};wn(a,{});let d=i&&i.headers?i.headers:{};return l.headers={...c,...d,...r.headers},{url:kn(a),options:l}},getQuerydata:async(t,n,r,o,a={})=>{gt("getQuerydata","projectName",t),gt("getQuerydata","connectionName",n);const i="/projects/{projectName}/connections/{connectionName}/queryData".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"GET",...c,...a},f={},h={};r!==void 0&&(h.sqlStatement=r),o!==void 0&&(h.options=o),wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},{url:kn(l),options:d}},getSqlsource:async(t,n,r,o={})=>{gt("getSqlsource","projectName",t),gt("getSqlsource","connectionName",n);const a="/projects/{projectName}/connections/{connectionName}/sqlSource".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...o},d={},f={};r!==void 0&&(f.sqlStatement=r),wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},{url:kn(i),options:c}},getTable:async(t,n,r,o,a={})=>{gt("getTable","projectName",t),gt("getTable","connectionName",n),gt("getTable","schemaName",r),gt("getTable","tablePath",o);const i="/projects/{projectName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))).replace("{tablePath}",encodeURIComponent(String(o))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"GET",...c,...a},f={};wn(l,{});let h=c&&c.headers?c.headers:{};return d.headers={...f,...h,...a.headers},{url:kn(l),options:d}},getTemporarytable:async(t,n,r,o={})=>{gt("getTemporarytable","projectName",t),gt("getTemporarytable","connectionName",n);const a="/projects/{projectName}/connections/{connectionName}/temporaryTable".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...o},d={},f={};r!==void 0&&(f.sqlStatement=r),wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},{url:kn(i),options:c}},listConnections:async(t,n={})=>{gt("listConnections","projectName",t);const r="/projects/{projectName}/connections".replace("{projectName}",encodeURIComponent(String(t))),o=new URL(r,Tn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},l={};wn(o,{});let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...n.headers},{url:kn(o),options:i}},listSchemas:async(t,n,r={})=>{gt("listSchemas","projectName",t),gt("listSchemas","connectionName",n);const o="/projects/{projectName}/connections/{connectionName}/schemas".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"GET",...i,...r},c={};wn(a,{});let d=i&&i.headers?i.headers:{};return l.headers={...c,...d,...r.headers},{url:kn(a),options:l}},listTables:async(t,n,r,o,a={})=>{gt("listTables","projectName",t),gt("listTables","connectionName",n),gt("listTables","schemaName",r);const i="/projects/{projectName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"GET",...c,...a},f={},h={};o&&(h.tableNames=o),wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},{url:kn(l),options:d}},postQuerydata:async(t,n,r,o,a={})=>{gt("postQuerydata","projectName",t),gt("postQuerydata","connectionName",n),gt("postQuerydata","postSqlsourceRequest",r);const i="/projects/{projectName}/connections/{connectionName}/sqlQuery".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"POST",...c,...a},f={},h={};o!==void 0&&(h.options=o),f["Content-Type"]="application/json",wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},d.data=Xa(r,d,e),{url:kn(l),options:d}},postSqlsource:async(t,n,r,o={})=>{gt("postSqlsource","projectName",t),gt("postSqlsource","connectionName",n),gt("postSqlsource","postSqlsourceRequest",r);const a="/projects/{projectName}/connections/{connectionName}/sqlSource".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"POST",...l,...o},d={},f={};d["Content-Type"]="application/json",wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},c.data=Xa(r,c,e),{url:kn(i),options:c}},postTemporarytable:async(t,n,r,o={})=>{gt("postTemporarytable","projectName",t),gt("postTemporarytable","connectionName",n),gt("postTemporarytable","postSqlsourceRequest",r);const a="/projects/{projectName}/connections/{connectionName}/sqlTemporaryTable".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"POST",...l,...o},d={},f={};d["Content-Type"]="application/json",wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},c.data=Xa(r,c,e),{url:kn(i),options:c}},updateConnection:async(t,n,r,o={})=>{gt("updateConnection","projectName",t),gt("updateConnection","connectionName",n),gt("updateConnection","updateConnectionRequest",r);const a="/projects/{projectName}/connections/{connectionName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"PATCH",...l,...o},d={},f={};d["Content-Type"]="application/json",wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},c.data=Xa(r,c,e),{url:kn(i),options:c}}}},Vo=function(e){const t=xte(e);return{async createConnection(n,r,o,a){const i=await t.createConnection(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.createConnection"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)},async deleteConnection(n,r,o){const a=await t.deleteConnection(n,r,o),i=e?.serverIndex??0,l=Cn["ConnectionsApi.deleteConnection"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)},async getConnection(n,r,o){const a=await t.getConnection(n,r,o),i=e?.serverIndex??0,l=Cn["ConnectionsApi.getConnection"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)},async getQuerydata(n,r,o,a,i){const l=await t.getQuerydata(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ConnectionsApi.getQuerydata"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async getSqlsource(n,r,o,a){const i=await t.getSqlsource(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.getSqlsource"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)},async getTable(n,r,o,a,i){const l=await t.getTable(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ConnectionsApi.getTable"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async getTemporarytable(n,r,o,a){const i=await t.getTemporarytable(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.getTemporarytable"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)},async listConnections(n,r){const o=await t.listConnections(n,r),a=e?.serverIndex??0,i=Cn["ConnectionsApi.listConnections"]?.[a]?.url;return(l,c)=>An(o,Dt,xn,e)(l,i||c)},async listSchemas(n,r,o){const a=await t.listSchemas(n,r,o),i=e?.serverIndex??0,l=Cn["ConnectionsApi.listSchemas"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)},async listTables(n,r,o,a,i){const l=await t.listTables(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ConnectionsApi.listTables"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async postQuerydata(n,r,o,a,i){const l=await t.postQuerydata(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ConnectionsApi.postQuerydata"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async postSqlsource(n,r,o,a){const i=await t.postSqlsource(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.postSqlsource"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)},async postTemporarytable(n,r,o,a){const i=await t.postTemporarytable(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.postTemporarytable"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)},async updateConnection(n,r,o,a){const i=await t.updateConnection(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.updateConnection"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)}}};let Ste=class extends lc{createConnection(t,n,r,o){return Vo(this.configuration).createConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteConnection(t,n,r){return Vo(this.configuration).deleteConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getConnection(t,n,r){return Vo(this.configuration).getConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getQuerydata(t,n,r,o,a){return Vo(this.configuration).getQuerydata(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getSqlsource(t,n,r,o){return Vo(this.configuration).getSqlsource(t,n,r,o).then(a=>a(this.axios,this.basePath))}getTable(t,n,r,o,a){return Vo(this.configuration).getTable(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getTemporarytable(t,n,r,o){return Vo(this.configuration).getTemporarytable(t,n,r,o).then(a=>a(this.axios,this.basePath))}listConnections(t,n){return Vo(this.configuration).listConnections(t,n).then(r=>r(this.axios,this.basePath))}listSchemas(t,n,r){return Vo(this.configuration).listSchemas(t,n,r).then(o=>o(this.axios,this.basePath))}listTables(t,n,r,o,a){return Vo(this.configuration).listTables(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}postQuerydata(t,n,r,o,a){return Vo(this.configuration).postQuerydata(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}postSqlsource(t,n,r,o){return Vo(this.configuration).postSqlsource(t,n,r,o).then(a=>a(this.axios,this.basePath))}postTemporarytable(t,n,r,o){return Vo(this.configuration).postTemporarytable(t,n,r,o).then(a=>a(this.axios,this.basePath))}updateConnection(t,n,r,o){return Vo(this.configuration).updateConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Ete=function(e){return{listDatabases:async(t,n,r,o={})=>{gt("listDatabases","projectName",t),gt("listDatabases","packageName",n);const a="/projects/{projectName}/packages/{packageName}/databases".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...o},d={},f={};r!==void 0&&(f.versionId=r),wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},{url:kn(i),options:c}}}},Cte=function(e){const t=Ete(e);return{async listDatabases(n,r,o,a){const i=await t.listDatabases(n,r,o,a),l=e?.serverIndex??0,c=Cn["DatabasesApi.listDatabases"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)}}};let Tte=class extends lc{listDatabases(t,n,r,o){return Cte(this.configuration).listDatabases(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const wte=function(e){return{compileModelSource:async(t,n,r,o,a={})=>{gt("compileModelSource","projectName",t),gt("compileModelSource","packageName",n),gt("compileModelSource","path",r),gt("compileModelSource","compileRequest",o);const i="/projects/{projectName}/packages/{packageName}/models/{path}/compile".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"POST",...c,...a},f={},h={};f["Content-Type"]="application/json",wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},d.data=Xa(o,d,e),{url:kn(l),options:d}},executeQueryModel:async(t,n,r,o,a={})=>{gt("executeQueryModel","projectName",t),gt("executeQueryModel","packageName",n),gt("executeQueryModel","path",r),gt("executeQueryModel","queryRequest",o);const i="/projects/{projectName}/packages/{packageName}/models/{path}/query".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"POST",...c,...a},f={},h={};f["Content-Type"]="application/json",wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},d.data=Xa(o,d,e),{url:kn(l),options:d}},getModel:async(t,n,r,o,a={})=>{gt("getModel","projectName",t),gt("getModel","packageName",n),gt("getModel","path",r);const i="/projects/{projectName}/packages/{packageName}/models/{path}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"GET",...c,...a},f={},h={};o!==void 0&&(h.versionId=o),wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},{url:kn(l),options:d}},listModels:async(t,n,r,o={})=>{gt("listModels","projectName",t),gt("listModels","packageName",n);const a="/projects/{projectName}/packages/{packageName}/models".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...o},d={},f={};r!==void 0&&(f.versionId=r),wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},{url:kn(i),options:c}}}},Yy=function(e){const t=wte(e);return{async compileModelSource(n,r,o,a,i){const l=await t.compileModelSource(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ModelsApi.compileModelSource"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async executeQueryModel(n,r,o,a,i){const l=await t.executeQueryModel(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ModelsApi.executeQueryModel"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async getModel(n,r,o,a,i){const l=await t.getModel(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ModelsApi.getModel"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async listModels(n,r,o,a){const i=await t.listModels(n,r,o,a),l=e?.serverIndex??0,c=Cn["ModelsApi.listModels"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)}}};let kte=class extends lc{compileModelSource(t,n,r,o,a){return Yy(this.configuration).compileModelSource(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}executeQueryModel(t,n,r,o,a){return Yy(this.configuration).executeQueryModel(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getModel(t,n,r,o,a){return Yy(this.configuration).getModel(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listModels(t,n,r,o){return Yy(this.configuration).listModels(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Ate=function(e){return{executeNotebookCell:async(t,n,r,o,a,i,l,c={})=>{gt("executeNotebookCell","projectName",t),gt("executeNotebookCell","packageName",n),gt("executeNotebookCell","path",r),gt("executeNotebookCell","cellIndex",o);const d="/projects/{projectName}/packages/{packageName}/notebooks/{path}/cells/{cellIndex}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))).replace("{cellIndex}",encodeURIComponent(String(o))),f=new URL(d,Tn);let h;e&&(h=e.baseOptions);const g={method:"GET",...h,...c},m={},v={};a!==void 0&&(v.versionId=a),i!==void 0&&(v.filter_params=i),l!==void 0&&(v.bypass_filters=l),wn(f,v);let S=h&&h.headers?h.headers:{};return g.headers={...m,...S,...c.headers},{url:kn(f),options:g}},getNotebook:async(t,n,r,o,a={})=>{gt("getNotebook","projectName",t),gt("getNotebook","packageName",n),gt("getNotebook","path",r);const i="/projects/{projectName}/packages/{packageName}/notebooks/{path}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"GET",...c,...a},f={},h={};o!==void 0&&(h.versionId=o),wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},{url:kn(l),options:d}},listNotebooks:async(t,n,r,o={})=>{gt("listNotebooks","projectName",t),gt("listNotebooks","packageName",n);const a="/projects/{projectName}/packages/{packageName}/notebooks".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...o},d={},f={};r!==void 0&&(f.versionId=r),wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},{url:kn(i),options:c}}}},WS=function(e){const t=Ate(e);return{async executeNotebookCell(n,r,o,a,i,l,c,d){const f=await t.executeNotebookCell(n,r,o,a,i,l,c,d),h=e?.serverIndex??0,g=Cn["NotebooksApi.executeNotebookCell"]?.[h]?.url;return(m,v)=>An(f,Dt,xn,e)(m,g||v)},async getNotebook(n,r,o,a,i){const l=await t.getNotebook(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["NotebooksApi.getNotebook"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async listNotebooks(n,r,o,a){const i=await t.listNotebooks(n,r,o,a),l=e?.serverIndex??0,c=Cn["NotebooksApi.listNotebooks"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)}}};let Dte=class extends lc{executeNotebookCell(t,n,r,o,a,i,l,c){return WS(this.configuration).executeNotebookCell(t,n,r,o,a,i,l,c).then(d=>d(this.axios,this.basePath))}getNotebook(t,n,r,o,a){return WS(this.configuration).getNotebook(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listNotebooks(t,n,r,o){return WS(this.configuration).listNotebooks(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Rte=function(e){return{createPackage:async(t,n,r={})=>{gt("createPackage","projectName",t),gt("createPackage","_package",n);const o="/projects/{projectName}/packages".replace("{projectName}",encodeURIComponent(String(t))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"POST",...i,...r},c={},d={};c["Content-Type"]="application/json",wn(a,d);let f=i&&i.headers?i.headers:{};return l.headers={...c,...f,...r.headers},l.data=Xa(n,l,e),{url:kn(a),options:l}},deletePackage:async(t,n,r={})=>{gt("deletePackage","projectName",t),gt("deletePackage","packageName",n);const o="/projects/{projectName}/packages/{packageName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"DELETE",...i,...r},c={};wn(a,{});let d=i&&i.headers?i.headers:{};return l.headers={...c,...d,...r.headers},{url:kn(a),options:l}},getPackage:async(t,n,r,o,a={})=>{gt("getPackage","projectName",t),gt("getPackage","packageName",n);const i="/projects/{projectName}/packages/{packageName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"GET",...c,...a},f={},h={};r!==void 0&&(h.versionId=r),o!==void 0&&(h.reload=o),wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},{url:kn(l),options:d}},listPackages:async(t,n={})=>{gt("listPackages","projectName",t);const r="/projects/{projectName}/packages".replace("{projectName}",encodeURIComponent(String(t))),o=new URL(r,Tn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},l={};wn(o,{});let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...n.headers},{url:kn(o),options:i}},updatePackage:async(t,n,r,o={})=>{gt("updatePackage","projectName",t),gt("updatePackage","packageName",n),gt("updatePackage","_package",r);const a="/projects/{projectName}/packages/{packageName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"PATCH",...l,...o},d={},f={};d["Content-Type"]="application/json",wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},c.data=Xa(r,c,e),{url:kn(i),options:c}}}},Xp=function(e){const t=Rte(e);return{async createPackage(n,r,o){const a=await t.createPackage(n,r,o),i=e?.serverIndex??0,l=Cn["PackagesApi.createPackage"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)},async deletePackage(n,r,o){const a=await t.deletePackage(n,r,o),i=e?.serverIndex??0,l=Cn["PackagesApi.deletePackage"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)},async getPackage(n,r,o,a,i){const l=await t.getPackage(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["PackagesApi.getPackage"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async listPackages(n,r){const o=await t.listPackages(n,r),a=e?.serverIndex??0,i=Cn["PackagesApi.listPackages"]?.[a]?.url;return(l,c)=>An(o,Dt,xn,e)(l,i||c)},async updatePackage(n,r,o,a){const i=await t.updatePackage(n,r,o,a),l=e?.serverIndex??0,c=Cn["PackagesApi.updatePackage"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)}}};let Mte=class extends lc{createPackage(t,n,r){return Xp(this.configuration).createPackage(t,n,r).then(o=>o(this.axios,this.basePath))}deletePackage(t,n,r){return Xp(this.configuration).deletePackage(t,n,r).then(o=>o(this.axios,this.basePath))}getPackage(t,n,r,o,a){return Xp(this.configuration).getPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listPackages(t,n){return Xp(this.configuration).listPackages(t,n).then(r=>r(this.axios,this.basePath))}updatePackage(t,n,r,o){return Xp(this.configuration).updatePackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Ite=function(e){return{createProject:async(t,n={})=>{gt("createProject","project",t);const r="/projects",o=new URL(r,Tn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},l={},c={};l["Content-Type"]="application/json",wn(o,c);let d=a&&a.headers?a.headers:{};return i.headers={...l,...d,...n.headers},i.data=Xa(t,i,e),{url:kn(o),options:i}},deleteProject:async(t,n={})=>{gt("deleteProject","projectName",t);const r="/projects/{projectName}".replace("{projectName}",encodeURIComponent(String(t))),o=new URL(r,Tn);let a;e&&(a=e.baseOptions);const i={method:"DELETE",...a,...n},l={};wn(o,{});let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...n.headers},{url:kn(o),options:i}},getProject:async(t,n,r={})=>{gt("getProject","projectName",t);const o="/projects/{projectName}".replace("{projectName}",encodeURIComponent(String(t))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"GET",...i,...r},c={},d={};n!==void 0&&(d.reload=n),wn(a,d);let f=i&&i.headers?i.headers:{};return l.headers={...c,...f,...r.headers},{url:kn(a),options:l}},listProjects:async(t={})=>{const n="/projects",r=new URL(n,Tn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={};wn(r,{});let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:kn(r),options:a}},updateProject:async(t,n,r={})=>{gt("updateProject","projectName",t),gt("updateProject","project",n);const o="/projects/{projectName}".replace("{projectName}",encodeURIComponent(String(t))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"PATCH",...i,...r},c={},d={};c["Content-Type"]="application/json",wn(a,d);let f=i&&i.headers?i.headers:{};return l.headers={...c,...f,...r.headers},l.data=Xa(n,l,e),{url:kn(a),options:l}}}},Zp=function(e){const t=Ite(e);return{async createProject(n,r){const o=await t.createProject(n,r),a=e?.serverIndex??0,i=Cn["ProjectsApi.createProject"]?.[a]?.url;return(l,c)=>An(o,Dt,xn,e)(l,i||c)},async deleteProject(n,r){const o=await t.deleteProject(n,r),a=e?.serverIndex??0,i=Cn["ProjectsApi.deleteProject"]?.[a]?.url;return(l,c)=>An(o,Dt,xn,e)(l,i||c)},async getProject(n,r,o){const a=await t.getProject(n,r,o),i=e?.serverIndex??0,l=Cn["ProjectsApi.getProject"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)},async listProjects(n){const r=await t.listProjects(n),o=e?.serverIndex??0,a=Cn["ProjectsApi.listProjects"]?.[o]?.url;return(i,l)=>An(r,Dt,xn,e)(i,a||l)},async updateProject(n,r,o){const a=await t.updateProject(n,r,o),i=e?.serverIndex??0,l=Cn["ProjectsApi.updateProject"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)}}};let Ote=class extends lc{createProject(t,n){return Zp(this.configuration).createProject(t,n).then(r=>r(this.axios,this.basePath))}deleteProject(t,n){return Zp(this.configuration).deleteProject(t,n).then(r=>r(this.axios,this.basePath))}getProject(t,n,r){return Zp(this.configuration).getProject(t,n,r).then(o=>o(this.axios,this.basePath))}listProjects(t){return Zp(this.configuration).listProjects(t).then(n=>n(this.axios,this.basePath))}updateProject(t,n,r){return Zp(this.configuration).updateProject(t,n,r).then(o=>o(this.axios,this.basePath))}};const Nte=function(e){return{getStatus:async(t={})=>{const n="/status",r=new URL(n,Tn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={};wn(r,{});let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:kn(r),options:a}}}},Pte=function(e){const t=Nte(e);return{async getStatus(n){const r=await t.getStatus(n),o=e?.serverIndex??0,a=Cn["PublisherApi.getStatus"]?.[o]?.url;return(i,l)=>An(r,Dt,xn,e)(i,a||l)}}};let _te=class extends lc{getStatus(t){return Pte(this.configuration).getStatus(t).then(n=>n(this.axios,this.basePath))}};const Lte=function(e){return{getWatchStatus:async(t={})=>{const n="/watch-mode/status",r=new URL(n,Tn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={};wn(r,{});let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:kn(r),options:a}},startWatching:async(t,n={})=>{gt("startWatching","startWatchRequest",t);const r="/watch-mode/start",o=new URL(r,Tn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},l={},c={};l["Content-Type"]="application/json",wn(o,c);let d=a&&a.headers?a.headers:{};return i.headers={...l,...d,...n.headers},i.data=Xa(t,i,e),{url:kn(o),options:i}},stopWatching:async(t={})=>{const n="/watch-mode/stop",r=new URL(n,Tn);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...t},i={};wn(r,{});let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:kn(r),options:a}}}},qS=function(e){const t=Lte(e);return{async getWatchStatus(n){const r=await t.getWatchStatus(n),o=e?.serverIndex??0,a=Cn["WatchModeApi.getWatchStatus"]?.[o]?.url;return(i,l)=>An(r,Dt,xn,e)(i,a||l)},async startWatching(n,r){const o=await t.startWatching(n,r),a=e?.serverIndex??0,i=Cn["WatchModeApi.startWatching"]?.[a]?.url;return(l,c)=>An(o,Dt,xn,e)(l,i||c)},async stopWatching(n){const r=await t.stopWatching(n),o=e?.serverIndex??0,a=Cn["WatchModeApi.stopWatching"]?.[o]?.url;return(i,l)=>An(r,Dt,xn,e)(i,a||l)}}};let Fte=class extends lc{getWatchStatus(t){return qS(this.configuration).getWatchStatus(t).then(n=>n(this.axios,this.basePath))}startWatching(t,n){return qS(this.configuration).startWatching(t,n).then(r=>r(this.axios,this.basePath))}stopWatching(t){return qS(this.configuration).stopWatching(t).then(n=>n(this.axios,this.basePath))}},jte=class{apiKey;username;password;accessToken;basePath;serverIndex;baseOptions;formDataCtor;constructor(t={}){this.apiKey=t.apiKey,this.username=t.username,this.password=t.password,this.accessToken=t.accessToken,this.basePath=t.basePath,this.serverIndex=t.serverIndex,this.baseOptions={...t.baseOptions,headers:{...t.baseOptions?.headers}},this.formDataCtor=t.formDataCtor}isJsonMime(t){const n=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(n.test(t)||t.toLowerCase()==="application/json-patch+json")}};const Ww=new MJ({defaultOptions:{queries:{retry:!1,throwOnError:!1},mutations:{retry:!1,throwOnError:!1}}});Dt.defaults.baseURL||(Dt.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet");const ML=C.createContext(void 0),Bte=(e,t)=>{const n=`${window.location.protocol}//${window.location.host}/api/v0`,r=Dt.create({baseURL:e||n,withCredentials:!0,timeout:6e5});r.interceptors.request.use(async a=>{const i=await t?.();return a.headers.Authorization=i||"",a});const o=new jte({basePath:n});return{models:new kte(o,n,r),publisher:new _te(o,n,r),projects:new Ote(o,n,r),packages:new Mte(o,n,r),notebooks:new Dte(o,n,r),connections:new Ste(o,n,r),databases:new Tte(o,n,r),watchMode:new Fte(o,n,r)}},$te=({children:e,getAccessToken:t,baseURL:n,mutable:r})=>{const o=C.useMemo(()=>Bte(n,t),[n,t]),a=n||`${window.location.protocol}//${window.location.host}/api/v0`,[i,l]=C.useState(r),[c,d]=C.useState(!0);C.useEffect(()=>{let h=!0;return(async()=>{try{const g=await o.publisher.getStatus();if(h){const m=g.data?.frozenConfig;let v;m?v=!1:r===void 0?v=!0:v=r,l(v),d(!1)}}catch(g){console.error("Failed to fetch publisher status:",g),h&&(l(r),d(!1))}})(),()=>{h=!1}},[o,r]);const f={server:a,getAccessToken:t,apiClients:o,mutable:i,isLoadingStatus:c};return y.jsx(IJ,{client:Ww,children:y.jsx(ML.Provider,{value:f,children:e})})},Yn=()=>{const e=C.useContext(ML);if(e===void 0)throw new Error("useServer must be used within a ServerProvider");return e},zte=ac(y.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"})),Ute=ac(y.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m4 11h-3v3c0 .55-.45 1-1 1s-1-.45-1-1v-3H8c-.55 0-1-.45-1-1s.45-1 1-1h3V8c0-.55.45-1 1-1s1 .45 1 1v3h3c.55 0 1 .45 1 1s-.45 1-1 1"})),qw=ac(y.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"})),Gw=ac(y.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"})),IL=ac(y.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),Hte=ac(y.jsx("path",{d:"M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z"}));function Hc(){return Hc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Hc.apply(this,arguments)}const Vte=["children","options"],jO=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{class:"className",for:"htmlFor"}),BO={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},Wte=["style","script","pre"],qte=["src","href","data","formAction","srcDoc","action"],Gte=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,Yte=/mailto:/i,Kte=/\n{2,}$/,$O=/^(\s*>[\s\S]*?)(?=\n\n|$)/,Qte=/^ *> ?/gm,Xte=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Zte=/^ {2,}\n/,Jte=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,zO=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,UO=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,ene=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,tne=/^(?:\n *)*\n/,nne=/\r\n?/g,rne=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,one=/^\[\^([^\]]+)]/,ane=/\f/g,ine=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,sne=/^\s*?\[(x|\s)\]/,HO=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,VO=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,WO=/^([^\n]+)\n *(=|-){3,} *\n/,GS=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,lne=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,qO=/^<!--[\s\S]*?(?:-->)/,cne=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,YS=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,une=/^\{.*\}$/,dne=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,fne=/^<([^ >]+@[^ >]+)>/,pne=/^<([^ >]+:\/[^ >]+)>/,hne=/-([a-z])?/gi,GO=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,mne=/^[^\n]+(?: \n|\n{2,})/,gne=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,yne=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,bne=/^\[([^\]]*)\] ?\[([^\]]*)\]/,vne=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,xne=/\t/g,Sne=/(^ *\||\| *$)/g,Ene=/^ *:-+: *$/,Cne=/^ *:-+ *$/,Tne=/^ *-+: *$/,S0=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,E0="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",wne=RegExp(`^([*_])\\1${S0(1)}${E0}\\1\\1(?!\\1)`),kne=RegExp(`^([*_])${S0(0)}${E0}\\1(?!\\1)`),Ane=RegExp(`^(==)${S0(0)}${E0}\\1`),Dne=RegExp(`^(~~)${S0(0)}${E0}\\1`),Rne=/^(:[a-zA-Z0-9-_]+:)/,Mne=/^\\([^0-9A-Za-z\s])/,Ine=/\\([^0-9A-Za-z\s])/g,One=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,Nne=/^\n+/,Pne=/^([ \t]*)/,_ne=/(?:^|\n)( *)$/,Yw="(?:\\d+\\.)",Kw="(?:[*+-])";function OL(e){return"( *)("+(e===1?Yw:Kw)+") +"}const NL=OL(1),PL=OL(2);function _L(e){return RegExp("^"+(e===1?NL:PL))}const Lne=_L(1),Fne=_L(2);function LL(e){return RegExp("^"+(e===1?NL:PL)+"[^\\n]*(?:\\n(?!\\1"+(e===1?Yw:Kw)+" )[^\\n]*)*(\\n|$)","gm")}const jne=LL(1),Bne=LL(2);function FL(e){const t=e===1?Yw:Kw;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const jL=FL(1),BL=FL(2);function YO(e,t){const n=t===1,r=n?jL:BL,o=n?jne:Bne,a=n?Lne:Fne;return{t:i=>a.test(i),o:df(function(i,l){const c=_ne.exec(l.prevCapture);return c&&(l.list||!l.inline&&!l.simple)?r.exec(i=c[1]+i):null}),i:1,u(i,l,c){const d=n?+i[2]:void 0,f=i[0].replace(Kte,`
219
+ `+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=fu(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&kb.assertOptions(r,{silentJSONParsing:ji.transitional(ji.boolean),forcedJSONParsing:ji.transitional(ji.boolean),clarifyTimeoutError:ji.transitional(ji.boolean)},!1),o!=null&&(Ne.isFunction(o)?n.paramsSerializer={serialize:o}:kb.assertOptions(o,{encode:ji.function,serialize:ji.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),kb.assertOptions(n,{baseUrl:ji.spelling("baseURL"),withXsrfToken:ji.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=a&&Ne.merge(a.common,a[n.method]);a&&Ne.forEach(["delete","get","head","post","put","patch","common"],v=>{delete a[v]}),n.headers=ea.concat(i,a);const l=[];let c=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(n)===!1||(c=c&&S.synchronous,l.unshift(S.fulfilled,S.rejected))});const d=[];this.interceptors.response.forEach(function(S){d.push(S.fulfilled,S.rejected)});let f,h=0,g;if(!c){const v=[LO.bind(this),void 0];for(v.unshift(...l),v.push(...d),g=v.length,f=Promise.resolve(n);h<g;)f=f.then(v[h++],v[h++]);return f}g=l.length;let m=n;for(;h<g;){const v=l[h++],S=l[h++];try{m=v(m)}catch(E){S.call(this,E);break}}try{f=LO.call(this,m)}catch(v){return Promise.reject(v)}for(h=0,g=d.length;h<g;)f=f.then(d[h++],d[h++]);return f}getUri(t){t=fu(this.defaults,t);const n=SL(t.baseURL,t.url,t.allowAbsoluteUrls);return gL(n,t.params,t.paramsSerializer)}};Ne.forEach(["delete","get","head","options"],function(t){eu.prototype[t]=function(n,r){return this.request(fu(r||{},{method:t,url:n,data:(r||{}).data}))}});Ne.forEach(["post","put","patch"],function(t){function n(r){return function(a,i,l){return this.request(fu(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:a,data:i}))}}eu.prototype[t]=n(),eu.prototype[t+"Form"]=n(!0)});let gte=class kL{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const r=this;this.promise.then(o=>{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(l=>{r.subscribe(l),a=l}).then(o);return i.cancel=function(){r.unsubscribe(a)},i},t(function(a,i,l){r.reason||(r.reason=new If(a,i,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new kL(function(o){t=o}),cancel:t}}};function yte(e){return function(n){return e.apply(null,n)}}function bte(e){return Ne.isObject(e)&&e.isAxiosError===!0}const RC={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(RC).forEach(([e,t])=>{RC[t]=e});function AL(e){const t=new eu(e),n=oL(eu.prototype.request,t);return Ne.extend(n,eu.prototype,t,{allOwnKeys:!0}),Ne.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return AL(fu(e,o))},n}const Dt=AL(og);Dt.Axios=eu;Dt.CanceledError=If;Dt.CancelToken=gte;Dt.isCancel=vL;Dt.VERSION=wL;Dt.toFormData=v0;Dt.AxiosError=en;Dt.Cancel=Dt.CanceledError;Dt.all=function(t){return Promise.all(t)};Dt.spread=yte;Dt.isAxiosError=bte;Dt.mergeConfig=fu;Dt.AxiosHeaders=ea;Dt.formToJSON=e=>bL(Ne.isHTMLForm(e)?new FormData(e):e);Dt.getAdapter=TL.getAdapter;Dt.HttpStatusCode=RC;Dt.default=Dt;const{Axios:pMe,AxiosError:hMe,CanceledError:mMe,isCancel:gMe,CancelToken:yMe,VERSION:bMe,all:vMe,Cancel:xMe,isAxiosError:SMe,spread:EMe,toFormData:CMe,AxiosHeaders:TMe,HttpStatusCode:wMe,formToJSON:kMe,getAdapter:AMe,mergeConfig:DMe}=Dt,xn="http://localhost/api/v0".replace(/\/+$/,"");let lc=class{constructor(t,n=xn,r=Dt){this.basePath=n,this.axios=r,t&&(this.configuration=t,this.basePath=t.basePath??n)}configuration},vte=class extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}};const Cn={},Tn="https://example.com",gt=function(e,t,n){if(n==null)throw new vte(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function MC(e,t,n=""){t!=null&&(typeof t=="object"?Array.isArray(t)?t.forEach(r=>MC(e,r,n)):Object.keys(t).forEach(r=>MC(e,t[r],`${n}${n!==""?".":""}${r}`)):e.has(n)?e.append(n,t):e.set(n,t))}const wn=function(e,...t){const n=new URLSearchParams(e.search);MC(n,t),e.search=n.toString()},Xa=function(e,t,n){const r=typeof e!="string";return(r&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):r)?JSON.stringify(e!==void 0?e:{}):e||""},kn=function(e){return e.pathname+e.search+e.hash},An=function(e,t,n,r){return(o=t,a=n)=>{const i={...e.options,url:(o.defaults.baseURL?"":r?.basePath??a)+e.url};return o.request(i)}},DL={Bigquery:"bigquery",Snowflake:"snowflake",Postgres:"postgres",Gcs:"gcs",S3:"s3",Azure:"azure"},RL={Postgres:"postgres",Bigquery:"bigquery",Snowflake:"snowflake",Trino:"trino",Mysql:"mysql",Duckdb:"duckdb",Motherduck:"motherduck",Ducklake:"ducklake"},xte=function(e){return{createConnection:async(t,n,r,o={})=>{gt("createConnection","projectName",t),gt("createConnection","connectionName",n),gt("createConnection","connection",r);const a="/projects/{projectName}/connections/{connectionName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"POST",...l,...o},d={},f={};d["Content-Type"]="application/json",wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},c.data=Xa(r,c,e),{url:kn(i),options:c}},deleteConnection:async(t,n,r={})=>{gt("deleteConnection","projectName",t),gt("deleteConnection","connectionName",n);const o="/projects/{projectName}/connections/{connectionName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"DELETE",...i,...r},c={};wn(a,{});let d=i&&i.headers?i.headers:{};return l.headers={...c,...d,...r.headers},{url:kn(a),options:l}},getConnection:async(t,n,r={})=>{gt("getConnection","projectName",t),gt("getConnection","connectionName",n);const o="/projects/{projectName}/connections/{connectionName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"GET",...i,...r},c={};wn(a,{});let d=i&&i.headers?i.headers:{};return l.headers={...c,...d,...r.headers},{url:kn(a),options:l}},getQuerydata:async(t,n,r,o,a={})=>{gt("getQuerydata","projectName",t),gt("getQuerydata","connectionName",n);const i="/projects/{projectName}/connections/{connectionName}/queryData".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"GET",...c,...a},f={},h={};r!==void 0&&(h.sqlStatement=r),o!==void 0&&(h.options=o),wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},{url:kn(l),options:d}},getSqlsource:async(t,n,r,o={})=>{gt("getSqlsource","projectName",t),gt("getSqlsource","connectionName",n);const a="/projects/{projectName}/connections/{connectionName}/sqlSource".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...o},d={},f={};r!==void 0&&(f.sqlStatement=r),wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},{url:kn(i),options:c}},getTable:async(t,n,r,o,a={})=>{gt("getTable","projectName",t),gt("getTable","connectionName",n),gt("getTable","schemaName",r),gt("getTable","tablePath",o);const i="/projects/{projectName}/connections/{connectionName}/schemas/{schemaName}/tables/{tablePath}".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))).replace("{tablePath}",encodeURIComponent(String(o))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"GET",...c,...a},f={};wn(l,{});let h=c&&c.headers?c.headers:{};return d.headers={...f,...h,...a.headers},{url:kn(l),options:d}},getTemporarytable:async(t,n,r,o={})=>{gt("getTemporarytable","projectName",t),gt("getTemporarytable","connectionName",n);const a="/projects/{projectName}/connections/{connectionName}/temporaryTable".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...o},d={},f={};r!==void 0&&(f.sqlStatement=r),wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},{url:kn(i),options:c}},listConnections:async(t,n={})=>{gt("listConnections","projectName",t);const r="/projects/{projectName}/connections".replace("{projectName}",encodeURIComponent(String(t))),o=new URL(r,Tn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},l={};wn(o,{});let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...n.headers},{url:kn(o),options:i}},listSchemas:async(t,n,r={})=>{gt("listSchemas","projectName",t),gt("listSchemas","connectionName",n);const o="/projects/{projectName}/connections/{connectionName}/schemas".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"GET",...i,...r},c={};wn(a,{});let d=i&&i.headers?i.headers:{};return l.headers={...c,...d,...r.headers},{url:kn(a),options:l}},listTables:async(t,n,r,o,a={})=>{gt("listTables","projectName",t),gt("listTables","connectionName",n),gt("listTables","schemaName",r);const i="/projects/{projectName}/connections/{connectionName}/schemas/{schemaName}/tables".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))).replace("{schemaName}",encodeURIComponent(String(r))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"GET",...c,...a},f={},h={};o&&(h.tableNames=o),wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},{url:kn(l),options:d}},postQuerydata:async(t,n,r,o={})=>{gt("postQuerydata","projectName",t),gt("postQuerydata","connectionName",n),gt("postQuerydata","postQuerydataRequest",r);const a="/projects/{projectName}/connections/{connectionName}/sqlQuery".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"POST",...l,...o},d={},f={};d["Content-Type"]="application/json",wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},c.data=Xa(r,c,e),{url:kn(i),options:c}},postSqlsource:async(t,n,r,o={})=>{gt("postSqlsource","projectName",t),gt("postSqlsource","connectionName",n),gt("postSqlsource","postSqlsourceRequest",r);const a="/projects/{projectName}/connections/{connectionName}/sqlSource".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"POST",...l,...o},d={},f={};d["Content-Type"]="application/json",wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},c.data=Xa(r,c,e),{url:kn(i),options:c}},postTemporarytable:async(t,n,r,o={})=>{gt("postTemporarytable","projectName",t),gt("postTemporarytable","connectionName",n),gt("postTemporarytable","postSqlsourceRequest",r);const a="/projects/{projectName}/connections/{connectionName}/sqlTemporaryTable".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"POST",...l,...o},d={},f={};d["Content-Type"]="application/json",wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},c.data=Xa(r,c,e),{url:kn(i),options:c}},updateConnection:async(t,n,r,o={})=>{gt("updateConnection","projectName",t),gt("updateConnection","connectionName",n),gt("updateConnection","updateConnectionRequest",r);const a="/projects/{projectName}/connections/{connectionName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{connectionName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"PATCH",...l,...o},d={},f={};d["Content-Type"]="application/json",wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},c.data=Xa(r,c,e),{url:kn(i),options:c}}}},Vo=function(e){const t=xte(e);return{async createConnection(n,r,o,a){const i=await t.createConnection(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.createConnection"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)},async deleteConnection(n,r,o){const a=await t.deleteConnection(n,r,o),i=e?.serverIndex??0,l=Cn["ConnectionsApi.deleteConnection"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)},async getConnection(n,r,o){const a=await t.getConnection(n,r,o),i=e?.serverIndex??0,l=Cn["ConnectionsApi.getConnection"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)},async getQuerydata(n,r,o,a,i){const l=await t.getQuerydata(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ConnectionsApi.getQuerydata"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async getSqlsource(n,r,o,a){const i=await t.getSqlsource(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.getSqlsource"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)},async getTable(n,r,o,a,i){const l=await t.getTable(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ConnectionsApi.getTable"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async getTemporarytable(n,r,o,a){const i=await t.getTemporarytable(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.getTemporarytable"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)},async listConnections(n,r){const o=await t.listConnections(n,r),a=e?.serverIndex??0,i=Cn["ConnectionsApi.listConnections"]?.[a]?.url;return(l,c)=>An(o,Dt,xn,e)(l,i||c)},async listSchemas(n,r,o){const a=await t.listSchemas(n,r,o),i=e?.serverIndex??0,l=Cn["ConnectionsApi.listSchemas"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)},async listTables(n,r,o,a,i){const l=await t.listTables(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ConnectionsApi.listTables"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async postQuerydata(n,r,o,a){const i=await t.postQuerydata(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.postQuerydata"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)},async postSqlsource(n,r,o,a){const i=await t.postSqlsource(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.postSqlsource"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)},async postTemporarytable(n,r,o,a){const i=await t.postTemporarytable(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.postTemporarytable"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)},async updateConnection(n,r,o,a){const i=await t.updateConnection(n,r,o,a),l=e?.serverIndex??0,c=Cn["ConnectionsApi.updateConnection"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)}}};let Ste=class extends lc{createConnection(t,n,r,o){return Vo(this.configuration).createConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}deleteConnection(t,n,r){return Vo(this.configuration).deleteConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getConnection(t,n,r){return Vo(this.configuration).getConnection(t,n,r).then(o=>o(this.axios,this.basePath))}getQuerydata(t,n,r,o,a){return Vo(this.configuration).getQuerydata(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getSqlsource(t,n,r,o){return Vo(this.configuration).getSqlsource(t,n,r,o).then(a=>a(this.axios,this.basePath))}getTable(t,n,r,o,a){return Vo(this.configuration).getTable(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getTemporarytable(t,n,r,o){return Vo(this.configuration).getTemporarytable(t,n,r,o).then(a=>a(this.axios,this.basePath))}listConnections(t,n){return Vo(this.configuration).listConnections(t,n).then(r=>r(this.axios,this.basePath))}listSchemas(t,n,r){return Vo(this.configuration).listSchemas(t,n,r).then(o=>o(this.axios,this.basePath))}listTables(t,n,r,o,a){return Vo(this.configuration).listTables(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}postQuerydata(t,n,r,o){return Vo(this.configuration).postQuerydata(t,n,r,o).then(a=>a(this.axios,this.basePath))}postSqlsource(t,n,r,o){return Vo(this.configuration).postSqlsource(t,n,r,o).then(a=>a(this.axios,this.basePath))}postTemporarytable(t,n,r,o){return Vo(this.configuration).postTemporarytable(t,n,r,o).then(a=>a(this.axios,this.basePath))}updateConnection(t,n,r,o){return Vo(this.configuration).updateConnection(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Ete=function(e){return{listDatabases:async(t,n,r,o={})=>{gt("listDatabases","projectName",t),gt("listDatabases","packageName",n);const a="/projects/{projectName}/packages/{packageName}/databases".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...o},d={},f={};r!==void 0&&(f.versionId=r),wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},{url:kn(i),options:c}}}},Cte=function(e){const t=Ete(e);return{async listDatabases(n,r,o,a){const i=await t.listDatabases(n,r,o,a),l=e?.serverIndex??0,c=Cn["DatabasesApi.listDatabases"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)}}};let Tte=class extends lc{listDatabases(t,n,r,o){return Cte(this.configuration).listDatabases(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const wte=function(e){return{compileModelSource:async(t,n,r,o,a={})=>{gt("compileModelSource","projectName",t),gt("compileModelSource","packageName",n),gt("compileModelSource","path",r),gt("compileModelSource","compileRequest",o);const i="/projects/{projectName}/packages/{packageName}/models/{path}/compile".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"POST",...c,...a},f={},h={};f["Content-Type"]="application/json",wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},d.data=Xa(o,d,e),{url:kn(l),options:d}},executeQueryModel:async(t,n,r,o,a={})=>{gt("executeQueryModel","projectName",t),gt("executeQueryModel","packageName",n),gt("executeQueryModel","path",r),gt("executeQueryModel","queryRequest",o);const i="/projects/{projectName}/packages/{packageName}/models/{path}/query".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"POST",...c,...a},f={},h={};f["Content-Type"]="application/json",wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},d.data=Xa(o,d,e),{url:kn(l),options:d}},getModel:async(t,n,r,o,a={})=>{gt("getModel","projectName",t),gt("getModel","packageName",n),gt("getModel","path",r);const i="/projects/{projectName}/packages/{packageName}/models/{path}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"GET",...c,...a},f={},h={};o!==void 0&&(h.versionId=o),wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},{url:kn(l),options:d}},listModels:async(t,n,r,o={})=>{gt("listModels","projectName",t),gt("listModels","packageName",n);const a="/projects/{projectName}/packages/{packageName}/models".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...o},d={},f={};r!==void 0&&(f.versionId=r),wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},{url:kn(i),options:c}}}},Yy=function(e){const t=wte(e);return{async compileModelSource(n,r,o,a,i){const l=await t.compileModelSource(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ModelsApi.compileModelSource"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async executeQueryModel(n,r,o,a,i){const l=await t.executeQueryModel(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ModelsApi.executeQueryModel"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async getModel(n,r,o,a,i){const l=await t.getModel(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["ModelsApi.getModel"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async listModels(n,r,o,a){const i=await t.listModels(n,r,o,a),l=e?.serverIndex??0,c=Cn["ModelsApi.listModels"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)}}};let kte=class extends lc{compileModelSource(t,n,r,o,a){return Yy(this.configuration).compileModelSource(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}executeQueryModel(t,n,r,o,a){return Yy(this.configuration).executeQueryModel(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}getModel(t,n,r,o,a){return Yy(this.configuration).getModel(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listModels(t,n,r,o){return Yy(this.configuration).listModels(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Ate=function(e){return{executeNotebookCell:async(t,n,r,o,a,i,l,c={})=>{gt("executeNotebookCell","projectName",t),gt("executeNotebookCell","packageName",n),gt("executeNotebookCell","path",r),gt("executeNotebookCell","cellIndex",o);const d="/projects/{projectName}/packages/{packageName}/notebooks/{path}/cells/{cellIndex}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))).replace("{cellIndex}",encodeURIComponent(String(o))),f=new URL(d,Tn);let h;e&&(h=e.baseOptions);const g={method:"GET",...h,...c},m={},v={};a!==void 0&&(v.versionId=a),i!==void 0&&(v.filter_params=i),l!==void 0&&(v.bypass_filters=l),wn(f,v);let S=h&&h.headers?h.headers:{};return g.headers={...m,...S,...c.headers},{url:kn(f),options:g}},getNotebook:async(t,n,r,o,a={})=>{gt("getNotebook","projectName",t),gt("getNotebook","packageName",n),gt("getNotebook","path",r);const i="/projects/{projectName}/packages/{packageName}/notebooks/{path}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))).replace("{path}",encodeURIComponent(String(r))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"GET",...c,...a},f={},h={};o!==void 0&&(h.versionId=o),wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},{url:kn(l),options:d}},listNotebooks:async(t,n,r,o={})=>{gt("listNotebooks","projectName",t),gt("listNotebooks","packageName",n);const a="/projects/{projectName}/packages/{packageName}/notebooks".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"GET",...l,...o},d={},f={};r!==void 0&&(f.versionId=r),wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},{url:kn(i),options:c}}}},WS=function(e){const t=Ate(e);return{async executeNotebookCell(n,r,o,a,i,l,c,d){const f=await t.executeNotebookCell(n,r,o,a,i,l,c,d),h=e?.serverIndex??0,g=Cn["NotebooksApi.executeNotebookCell"]?.[h]?.url;return(m,v)=>An(f,Dt,xn,e)(m,g||v)},async getNotebook(n,r,o,a,i){const l=await t.getNotebook(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["NotebooksApi.getNotebook"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async listNotebooks(n,r,o,a){const i=await t.listNotebooks(n,r,o,a),l=e?.serverIndex??0,c=Cn["NotebooksApi.listNotebooks"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)}}};let Dte=class extends lc{executeNotebookCell(t,n,r,o,a,i,l,c){return WS(this.configuration).executeNotebookCell(t,n,r,o,a,i,l,c).then(d=>d(this.axios,this.basePath))}getNotebook(t,n,r,o,a){return WS(this.configuration).getNotebook(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listNotebooks(t,n,r,o){return WS(this.configuration).listNotebooks(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Rte=function(e){return{createPackage:async(t,n,r,o={})=>{gt("createPackage","projectName",t),gt("createPackage","_package",n);const a="/projects/{projectName}/packages".replace("{projectName}",encodeURIComponent(String(t))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"POST",...l,...o},d={},f={};r!==void 0&&(f.autoLoadManifest=r),d["Content-Type"]="application/json",wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},c.data=Xa(n,c,e),{url:kn(i),options:c}},deletePackage:async(t,n,r={})=>{gt("deletePackage","projectName",t),gt("deletePackage","packageName",n);const o="/projects/{projectName}/packages/{packageName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"DELETE",...i,...r},c={};wn(a,{});let d=i&&i.headers?i.headers:{};return l.headers={...c,...d,...r.headers},{url:kn(a),options:l}},getPackage:async(t,n,r,o,a={})=>{gt("getPackage","projectName",t),gt("getPackage","packageName",n);const i="/projects/{projectName}/packages/{packageName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),l=new URL(i,Tn);let c;e&&(c=e.baseOptions);const d={method:"GET",...c,...a},f={},h={};r!==void 0&&(h.versionId=r),o!==void 0&&(h.reload=o),wn(l,h);let g=c&&c.headers?c.headers:{};return d.headers={...f,...g,...a.headers},{url:kn(l),options:d}},listPackages:async(t,n={})=>{gt("listPackages","projectName",t);const r="/projects/{projectName}/packages".replace("{projectName}",encodeURIComponent(String(t))),o=new URL(r,Tn);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...n},l={};wn(o,{});let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...n.headers},{url:kn(o),options:i}},updatePackage:async(t,n,r,o={})=>{gt("updatePackage","projectName",t),gt("updatePackage","packageName",n),gt("updatePackage","_package",r);const a="/projects/{projectName}/packages/{packageName}".replace("{projectName}",encodeURIComponent(String(t))).replace("{packageName}",encodeURIComponent(String(n))),i=new URL(a,Tn);let l;e&&(l=e.baseOptions);const c={method:"PATCH",...l,...o},d={},f={};d["Content-Type"]="application/json",wn(i,f);let h=l&&l.headers?l.headers:{};return c.headers={...d,...h,...o.headers},c.data=Xa(r,c,e),{url:kn(i),options:c}}}},Xp=function(e){const t=Rte(e);return{async createPackage(n,r,o,a){const i=await t.createPackage(n,r,o,a),l=e?.serverIndex??0,c=Cn["PackagesApi.createPackage"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)},async deletePackage(n,r,o){const a=await t.deletePackage(n,r,o),i=e?.serverIndex??0,l=Cn["PackagesApi.deletePackage"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)},async getPackage(n,r,o,a,i){const l=await t.getPackage(n,r,o,a,i),c=e?.serverIndex??0,d=Cn["PackagesApi.getPackage"]?.[c]?.url;return(f,h)=>An(l,Dt,xn,e)(f,d||h)},async listPackages(n,r){const o=await t.listPackages(n,r),a=e?.serverIndex??0,i=Cn["PackagesApi.listPackages"]?.[a]?.url;return(l,c)=>An(o,Dt,xn,e)(l,i||c)},async updatePackage(n,r,o,a){const i=await t.updatePackage(n,r,o,a),l=e?.serverIndex??0,c=Cn["PackagesApi.updatePackage"]?.[l]?.url;return(d,f)=>An(i,Dt,xn,e)(d,c||f)}}};let Mte=class extends lc{createPackage(t,n,r,o){return Xp(this.configuration).createPackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}deletePackage(t,n,r){return Xp(this.configuration).deletePackage(t,n,r).then(o=>o(this.axios,this.basePath))}getPackage(t,n,r,o,a){return Xp(this.configuration).getPackage(t,n,r,o,a).then(i=>i(this.axios,this.basePath))}listPackages(t,n){return Xp(this.configuration).listPackages(t,n).then(r=>r(this.axios,this.basePath))}updatePackage(t,n,r,o){return Xp(this.configuration).updatePackage(t,n,r,o).then(a=>a(this.axios,this.basePath))}};const Ite=function(e){return{createProject:async(t,n={})=>{gt("createProject","project",t);const r="/projects",o=new URL(r,Tn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},l={},c={};l["Content-Type"]="application/json",wn(o,c);let d=a&&a.headers?a.headers:{};return i.headers={...l,...d,...n.headers},i.data=Xa(t,i,e),{url:kn(o),options:i}},deleteProject:async(t,n={})=>{gt("deleteProject","projectName",t);const r="/projects/{projectName}".replace("{projectName}",encodeURIComponent(String(t))),o=new URL(r,Tn);let a;e&&(a=e.baseOptions);const i={method:"DELETE",...a,...n},l={};wn(o,{});let c=a&&a.headers?a.headers:{};return i.headers={...l,...c,...n.headers},{url:kn(o),options:i}},getProject:async(t,n,r={})=>{gt("getProject","projectName",t);const o="/projects/{projectName}".replace("{projectName}",encodeURIComponent(String(t))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"GET",...i,...r},c={},d={};n!==void 0&&(d.reload=n),wn(a,d);let f=i&&i.headers?i.headers:{};return l.headers={...c,...f,...r.headers},{url:kn(a),options:l}},listProjects:async(t={})=>{const n="/projects",r=new URL(n,Tn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={};wn(r,{});let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:kn(r),options:a}},updateProject:async(t,n,r={})=>{gt("updateProject","projectName",t),gt("updateProject","project",n);const o="/projects/{projectName}".replace("{projectName}",encodeURIComponent(String(t))),a=new URL(o,Tn);let i;e&&(i=e.baseOptions);const l={method:"PATCH",...i,...r},c={},d={};c["Content-Type"]="application/json",wn(a,d);let f=i&&i.headers?i.headers:{};return l.headers={...c,...f,...r.headers},l.data=Xa(n,l,e),{url:kn(a),options:l}}}},Zp=function(e){const t=Ite(e);return{async createProject(n,r){const o=await t.createProject(n,r),a=e?.serverIndex??0,i=Cn["ProjectsApi.createProject"]?.[a]?.url;return(l,c)=>An(o,Dt,xn,e)(l,i||c)},async deleteProject(n,r){const o=await t.deleteProject(n,r),a=e?.serverIndex??0,i=Cn["ProjectsApi.deleteProject"]?.[a]?.url;return(l,c)=>An(o,Dt,xn,e)(l,i||c)},async getProject(n,r,o){const a=await t.getProject(n,r,o),i=e?.serverIndex??0,l=Cn["ProjectsApi.getProject"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)},async listProjects(n){const r=await t.listProjects(n),o=e?.serverIndex??0,a=Cn["ProjectsApi.listProjects"]?.[o]?.url;return(i,l)=>An(r,Dt,xn,e)(i,a||l)},async updateProject(n,r,o){const a=await t.updateProject(n,r,o),i=e?.serverIndex??0,l=Cn["ProjectsApi.updateProject"]?.[i]?.url;return(c,d)=>An(a,Dt,xn,e)(c,l||d)}}};let Ote=class extends lc{createProject(t,n){return Zp(this.configuration).createProject(t,n).then(r=>r(this.axios,this.basePath))}deleteProject(t,n){return Zp(this.configuration).deleteProject(t,n).then(r=>r(this.axios,this.basePath))}getProject(t,n,r){return Zp(this.configuration).getProject(t,n,r).then(o=>o(this.axios,this.basePath))}listProjects(t){return Zp(this.configuration).listProjects(t).then(n=>n(this.axios,this.basePath))}updateProject(t,n,r){return Zp(this.configuration).updateProject(t,n,r).then(o=>o(this.axios,this.basePath))}};const Nte=function(e){return{getStatus:async(t={})=>{const n="/status",r=new URL(n,Tn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={};wn(r,{});let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:kn(r),options:a}}}},Pte=function(e){const t=Nte(e);return{async getStatus(n){const r=await t.getStatus(n),o=e?.serverIndex??0,a=Cn["PublisherApi.getStatus"]?.[o]?.url;return(i,l)=>An(r,Dt,xn,e)(i,a||l)}}};let _te=class extends lc{getStatus(t){return Pte(this.configuration).getStatus(t).then(n=>n(this.axios,this.basePath))}};const Lte=function(e){return{getWatchStatus:async(t={})=>{const n="/watch-mode/status",r=new URL(n,Tn);let o;e&&(o=e.baseOptions);const a={method:"GET",...o,...t},i={};wn(r,{});let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:kn(r),options:a}},startWatching:async(t,n={})=>{gt("startWatching","startWatchRequest",t);const r="/watch-mode/start",o=new URL(r,Tn);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...n},l={},c={};l["Content-Type"]="application/json",wn(o,c);let d=a&&a.headers?a.headers:{};return i.headers={...l,...d,...n.headers},i.data=Xa(t,i,e),{url:kn(o),options:i}},stopWatching:async(t={})=>{const n="/watch-mode/stop",r=new URL(n,Tn);let o;e&&(o=e.baseOptions);const a={method:"POST",...o,...t},i={};wn(r,{});let l=o&&o.headers?o.headers:{};return a.headers={...i,...l,...t.headers},{url:kn(r),options:a}}}},qS=function(e){const t=Lte(e);return{async getWatchStatus(n){const r=await t.getWatchStatus(n),o=e?.serverIndex??0,a=Cn["WatchModeApi.getWatchStatus"]?.[o]?.url;return(i,l)=>An(r,Dt,xn,e)(i,a||l)},async startWatching(n,r){const o=await t.startWatching(n,r),a=e?.serverIndex??0,i=Cn["WatchModeApi.startWatching"]?.[a]?.url;return(l,c)=>An(o,Dt,xn,e)(l,i||c)},async stopWatching(n){const r=await t.stopWatching(n),o=e?.serverIndex??0,a=Cn["WatchModeApi.stopWatching"]?.[o]?.url;return(i,l)=>An(r,Dt,xn,e)(i,a||l)}}};let Fte=class extends lc{getWatchStatus(t){return qS(this.configuration).getWatchStatus(t).then(n=>n(this.axios,this.basePath))}startWatching(t,n){return qS(this.configuration).startWatching(t,n).then(r=>r(this.axios,this.basePath))}stopWatching(t){return qS(this.configuration).stopWatching(t).then(n=>n(this.axios,this.basePath))}},jte=class{apiKey;username;password;accessToken;basePath;serverIndex;baseOptions;formDataCtor;constructor(t={}){this.apiKey=t.apiKey,this.username=t.username,this.password=t.password,this.accessToken=t.accessToken,this.basePath=t.basePath,this.serverIndex=t.serverIndex,this.baseOptions={...t.baseOptions,headers:{...t.baseOptions?.headers}},this.formDataCtor=t.formDataCtor}isJsonMime(t){const n=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return t!==null&&(n.test(t)||t.toLowerCase()==="application/json-patch+json")}};const Ww=new MJ({defaultOptions:{queries:{retry:!1,throwOnError:!1},mutations:{retry:!1,throwOnError:!1}}});Dt.defaults.baseURL||(Dt.defaults.baseURL="IfYouAreSeeingThis_baseURL_IsNotSet");const ML=C.createContext(void 0),Bte=(e,t)=>{const n=`${window.location.protocol}//${window.location.host}/api/v0`,r=Dt.create({baseURL:e||n,withCredentials:!0,timeout:6e5});r.interceptors.request.use(async a=>{const i=await t?.();return a.headers.Authorization=i||"",a});const o=new jte({basePath:n});return{models:new kte(o,n,r),publisher:new _te(o,n,r),projects:new Ote(o,n,r),packages:new Mte(o,n,r),notebooks:new Dte(o,n,r),connections:new Ste(o,n,r),databases:new Tte(o,n,r),watchMode:new Fte(o,n,r)}},$te=({children:e,getAccessToken:t,baseURL:n,mutable:r})=>{const o=C.useMemo(()=>Bte(n,t),[n,t]),a=n||`${window.location.protocol}//${window.location.host}/api/v0`,[i,l]=C.useState(r),[c,d]=C.useState(!0);C.useEffect(()=>{let h=!0;return(async()=>{try{const g=await o.publisher.getStatus();if(h){const m=g.data?.frozenConfig;let v;m?v=!1:r===void 0?v=!0:v=r,l(v),d(!1)}}catch(g){console.error("Failed to fetch publisher status:",g),h&&(l(r),d(!1))}})(),()=>{h=!1}},[o,r]);const f={server:a,getAccessToken:t,apiClients:o,mutable:i,isLoadingStatus:c};return y.jsx(IJ,{client:Ww,children:y.jsx(ML.Provider,{value:f,children:e})})},Yn=()=>{const e=C.useContext(ML);if(e===void 0)throw new Error("useServer must be used within a ServerProvider");return e},zte=ac(y.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"})),Ute=ac(y.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m4 11h-3v3c0 .55-.45 1-1 1s-1-.45-1-1v-3H8c-.55 0-1-.45-1-1s.45-1 1-1h3V8c0-.55.45-1 1-1s1 .45 1 1v3h3c.55 0 1 .45 1 1s-.45 1-1 1"})),qw=ac(y.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"})),Gw=ac(y.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"})),IL=ac(y.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),Hte=ac(y.jsx("path",{d:"M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z"}));function Hc(){return Hc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Hc.apply(this,arguments)}const Vte=["children","options"],jO=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,t)=>(e[t.toLowerCase()]=t,e),{class:"className",for:"htmlFor"}),BO={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},Wte=["style","script","pre"],qte=["src","href","data","formAction","srcDoc","action"],Gte=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,Yte=/mailto:/i,Kte=/\n{2,}$/,$O=/^(\s*>[\s\S]*?)(?=\n\n|$)/,Qte=/^ *> ?/gm,Xte=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,Zte=/^ {2,}\n/,Jte=/^(?:( *[-*_])){3,} *(?:\n *)+\n/,zO=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,UO=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,ene=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,tne=/^(?:\n *)*\n/,nne=/\r\n?/g,rne=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,one=/^\[\^([^\]]+)]/,ane=/\f/g,ine=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,sne=/^\s*?\[(x|\s)\]/,HO=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,VO=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,WO=/^([^\n]+)\n *(=|-){3,} *\n/,GS=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,lne=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,qO=/^<!--[\s\S]*?(?:-->)/,cne=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,YS=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,une=/^\{.*\}$/,dne=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,fne=/^<([^ >]+@[^ >]+)>/,pne=/^<([^ >]+:\/[^ >]+)>/,hne=/-([a-z])?/gi,GO=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,mne=/^[^\n]+(?: \n|\n{2,})/,gne=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,yne=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,bne=/^\[([^\]]*)\] ?\[([^\]]*)\]/,vne=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,xne=/\t/g,Sne=/(^ *\||\| *$)/g,Ene=/^ *:-+: *$/,Cne=/^ *:-+ *$/,Tne=/^ *-+: *$/,S0=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,E0="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",wne=RegExp(`^([*_])\\1${S0(1)}${E0}\\1\\1(?!\\1)`),kne=RegExp(`^([*_])${S0(0)}${E0}\\1(?!\\1)`),Ane=RegExp(`^(==)${S0(0)}${E0}\\1`),Dne=RegExp(`^(~~)${S0(0)}${E0}\\1`),Rne=/^(:[a-zA-Z0-9-_]+:)/,Mne=/^\\([^0-9A-Za-z\s])/,Ine=/\\([^0-9A-Za-z\s])/g,One=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,Nne=/^\n+/,Pne=/^([ \t]*)/,_ne=/(?:^|\n)( *)$/,Yw="(?:\\d+\\.)",Kw="(?:[*+-])";function OL(e){return"( *)("+(e===1?Yw:Kw)+") +"}const NL=OL(1),PL=OL(2);function _L(e){return RegExp("^"+(e===1?NL:PL))}const Lne=_L(1),Fne=_L(2);function LL(e){return RegExp("^"+(e===1?NL:PL)+"[^\\n]*(?:\\n(?!\\1"+(e===1?Yw:Kw)+" )[^\\n]*)*(\\n|$)","gm")}const jne=LL(1),Bne=LL(2);function FL(e){const t=e===1?Yw:Kw;return RegExp("^( *)("+t+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+t+" (?!"+t+" ))\\n*|\\s*\\n*$)")}const jL=FL(1),BL=FL(2);function YO(e,t){const n=t===1,r=n?jL:BL,o=n?jne:Bne,a=n?Lne:Fne;return{t:i=>a.test(i),o:df(function(i,l){const c=_ne.exec(l.prevCapture);return c&&(l.list||!l.inline&&!l.simple)?r.exec(i=c[1]+i):null}),i:1,u(i,l,c){const d=n?+i[2]:void 0,f=i[0].replace(Kte,`
220
220
  `).match(o);let h=!1;return{items:f.map(function(g,m){const v=a.exec(g)[0].length,S=RegExp("^ {1,"+v+"}","gm"),E=g.replace(S,"").replace(a,""),x=m===f.length-1,w=E.indexOf(`
221
221
 
222
222
  `)!==-1||x&&h;h=w;const T=c.inline,R=c.list;let D;c.list=!0,w?(c.inline=!1,D=jh(E)+`
@@ -323,7 +323,7 @@ import {${t.sourceName}}" from '${t.modelPath}'"
323
323
  - [ ] `),/^\d+.\s/.test(i)&&(T=`
324
324
  `+(parseInt(i)+1)+". "),Xd(r,T)}else if(e.code&&e.code.toLowerCase()==="keyd"&&e.ctrlKey){$b(e);var R={start:r.selectionStart,end:r.selectionEnd},D=R;R=em({text:r.value,selection:R});var M=r.value.slice(R.start,R.end);l.setSelectionRange({start:R.end,end:R.end}),Xd(r,`
325
325
  `+M),l.setSelectionRange({start:D.start,end:D.end})}else e.code&&e.code.toLowerCase()==="arrowup"&&e.altKey?E_(e,-1):e.code&&e.code.toLowerCase()==="arrowdown"&&e.altKey&&E_(e,1)}var ave=["prefixCls","onChange"],ive=["markdown","commands","fullscreen","preview","highlightEnable","extraCommands","tabSize","defaultTabEnable","autoFocusEnd","textareaWarp","dispatch"];function sve(e){var{prefixCls:t,onChange:n}=e,r=Ot(e,ave),o=C.useContext($f),{markdown:a,commands:i,fullscreen:l,preview:c,highlightEnable:d,extraCommands:f,tabSize:h,defaultTabEnable:g,autoFocusEnd:m,textareaWarp:v,dispatch:S}=o;Ot(o,ive);var E=Je.useRef(null),x=Je.useRef(),w=Je.useRef({fullscreen:l,preview:c});C.useEffect(()=>{w.current={fullscreen:l,preview:c,highlightEnable:d}},[l,c,d]),C.useEffect(()=>{if(E.current&&S){var R=new Xk(E.current);x.current=R,S({textarea:E.current,commandOrchestrator:R})}},[]),C.useEffect(()=>{if(m&&E.current&&v){E.current.focus();var R=E.current.value.length;E.current.setSelectionRange(R,R),setTimeout(()=>{v&&(v.scrollTop=v.scrollHeight),E.current&&(E.current.scrollTop=E.current.scrollHeight)},0)}},[v]);var T=R=>{ove(R,h,g),a7(R,[...i||[],...f||[]],x.current,S,w.current)};return C.useEffect(()=>(E.current&&E.current.addEventListener("keydown",T),()=>{E.current&&E.current.removeEventListener("keydown",T)}),[]),y.jsx("textarea",ne({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1},r,{ref:E,className:t+"-text-input "+(r.className?r.className:""),value:a,onChange:R=>{S&&S({markdown:R.target.value}),n&&n(R)}}))}var lve=["prefixCls","className","onScroll","renderTextarea"];function cve(e){var t=e||{},{prefixCls:n,className:r,onScroll:o,renderTextarea:a}=t,i=Ot(t,lve),{markdown:l,scrollTop:c,commands:d,extraCommands:f,dispatch:h}=C.useContext($f),g=Je.useRef(null),m=Je.useRef(),v=Je.createRef();C.useEffect(()=>{var E={};v.current&&(E.textareaWarp=v.current||void 0,v.current.scrollTop=c||0),h&&h(ne({},E))},[]),C.useEffect(()=>{if(g.current&&h){var E=new Xk(g.current);m.current=E,h({textarea:g.current,commandOrchestrator:E})}},[]);var S={WebkitTextFillColor:"initial",overflow:"auto"};return y.jsx("div",{ref:v,className:n+"-area "+(r||""),onScroll:o,children:y.jsx("div",{className:n+"-text",children:a?Je.cloneElement(a(ne({},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:a7,useContext:{commands:d,extraCommands:f,commandOrchestrator:m.current}}),{ref:g}):y.jsx(C.Fragment,{children:y.jsx(sve,ne({prefixCls:n},i,{style:S}))})})})}function uve(e){var{prefixCls:t,groupName:n,commands:r,children:o}=e||{},{barPopup:a={}}=C.useContext($f);return C.useMemo(()=>y.jsx("div",{className:t+"-toolbar-child "+(n&&a[n]?"active":""),onClick:i=>i.stopPropagation(),children:Array.isArray(r)?y.jsx(u7,ne({commands:r},e,{isChild:!0})):o}),[r,a,n,t])}function C_(e){var{prefixCls:t,overflow:n}=e,{fullscreen:r,preview:o,barPopup:a={},components:i,commandOrchestrator:l,dispatch:c}=C.useContext($f),d=C.useRef("");function f(h,g){if(c){var m={barPopup:ne({},a)};h.keyCommand==="preview"&&(m.preview=h.value),h.keyCommand==="fullscreen"&&(m.fullscreen=!r),e.commands&&h.keyCommand==="group"?e.commands.forEach(v=>{g===v.groupName?m.barPopup[g]=!0:v.keyCommand&&(m.barPopup[v.groupName]=!1)}):(g||h.parent)&&Object.keys(m.barPopup||{}).forEach(v=>{m.barPopup[v]=!1}),Object.keys(m).length&&c(ne({},m)),l&&l.executeCommand(h)}}return C.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]),y.jsx("ul",{children:(e.commands||[]).map((h,g)=>{if(h.keyCommand==="divider")return y.jsx("li",ne({},h.liProps,{className:t+"-toolbar-divider"}),g);if(!h.keyCommand)return y.jsx(C.Fragment,{},g);var m=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:()=>f({},h.groupName),execute:()=>f({execute:h.execute}),dispatch:c}):void 0,S=a&&o&&o==="preview"&&!/(preview|fullscreen)/.test(h.keyCommand),E=i?.toolbar||h.render,x=E&&typeof E=="function"?E(h,!!S,f,g):null;return y.jsxs("li",ne({},h.liProps,{className:m?"active":"",children:[x&&Je.isValidElement(x)&&x,!x&&!h.buttonProps&&h.icon,!x&&h.buttonProps&&Je.createElement("button",ne({type:"button",key:g,disabled:S,"data-name":h.name},h.buttonProps,{onClick:w=>{w.stopPropagation(),f(h,h.groupName)}}),h.icon),h.children&&y.jsx(uve,{overflow:n,groupName:h.groupName,prefixCls:t,children:v,commands:Array.isArray(h.children)?h.children:void 0})]}),g)})})}function u7(e){e===void 0&&(e={});var{prefixCls:t,isChild:n,className:r}=e,{commands:o,extraCommands:a}=C.useContext($f);return y.jsxs("div",{className:t+"-toolbar "+r,children:[y.jsx(C_,ne({},e,{commands:e.commands||o||[]})),!n&&y.jsx(C_,ne({},e,{commands:a||[]}))]})}function T_(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 y.jsx(u7,{prefixCls:a,overflow:o,className:i})}var dve=e=>{var{prefixCls:t,onChange:n}=e||{},r=C.useRef(null),o=C.useRef(),a=C.useRef(e.height);C.useEffect(()=>{a.current!==e.height&&(a.current=e.height)},[e.height]);function i(f){if(o.current){var h,g=f.clientY||((h=f.changedTouches[0])==null?void 0:h.clientY),m=o.current.height+g-o.current.dragY;m>=e.minHeight&&m<=e.maxHeight&&n&&n(o.current.height+(g-o.current.dragY))}}function l(){var f,h;o.current=void 0,document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",l),(f=r.current)==null||f.removeEventListener("touchmove",i),(h=r.current)==null||h.removeEventListener("touchend",l)}function c(f){var h,g,m;f.preventDefault();var v=f.clientY||((h=f.changedTouches[0])==null?void 0:h.clientY);o.current={height:a.current,dragY:v},document.addEventListener("mousemove",i),document.addEventListener("mouseup",l),(g=r.current)==null||g.addEventListener("touchmove",i,{passive:!1}),(m=r.current)==null||m.addEventListener("touchend",l,{passive:!1})}C.useEffect(()=>{if(document){var f,h;(f=r.current)==null||f.addEventListener("touchstart",c,{passive:!1}),(h=r.current)==null||h.addEventListener("mousedown",c)}return()=>{if(document){var g;(g=r.current)==null||g.removeEventListener("touchstart",c),document.removeEventListener("mousemove",i)}}},[]);var d=C.useMemo(()=>y.jsx("svg",{viewBox:"0 0 512 512",height:"100%",children:y.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 y.jsx("div",{className:t+"-bar",ref:r,children:d})},fve=["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 pve(e){return e===void 0&&(e={}),Object.keys(e).forEach(t=>{e[t]=!1}),e}var hve=Je.forwardRef((e,t)=>{var n=e||{},{prefixCls:r="w-md-editor",className:o,value:a,commands:i=nve(),commandsFilter:l,direction:c,extraCommands:d=rve(),height:f=200,enableScroll:h=!0,visibleDragbar:g=typeof e.visiableDragbar=="boolean"?e.visiableDragbar:!0,highlightEnable:m=!0,preview:v="live",fullscreen:S=!1,overflow:E=!0,previewOptions:x={},textareaProps:w,maxHeight:T=1200,minHeight:R=100,autoFocus:D,autoFocusEnd:M=!1,tabSize:F=2,defaultTabEnable:B=!1,onChange:H,onStatistics:j,onHeightChange:z,hideToolbar:k,toolbarBottom:_=!1,components:P,renderTextarea:$}=n,L=Ot(n,fve),G=i.map(me=>l?l(me,!1):me).filter(Boolean),V=d.map(me=>l?l(me,!0):me).filter(Boolean),[Y,N]=C.useReducer(Cbe,{markdown:a,preview:v,components:P,height:f,minHeight:R,highlightEnable:m,tabSize:F,defaultTabEnable:B,scrollTop:0,scrollTopPreview:0,commands:G,extraCommands:V,fullscreen:S,barPopup:{}}),q=C.useRef(null),K=C.useRef(null),U=C.useRef(h);C.useImperativeHandle(t,()=>ne({},Y,{container:q.current,dispatch:N})),C.useMemo(()=>U.current=h,[h]),C.useEffect(()=>{var me={};q.current&&(me.container=q.current||void 0),me.markdown=a||"",me.barPopup={},N&&N(ne({},Y,me))},[]);var J=[o,"wmde-markdown-var",c?r+"-"+c:null,r,Y.preview?r+"-show-"+Y.preview:null,Y.fullscreen?r+"-fullscreen":null].filter(Boolean).join(" ").trim();C.useMemo(()=>a!==Y.markdown&&N({markdown:a||""}),[a,Y.markdown]),C.useMemo(()=>v!==Y.preview&&N({preview:v}),[v]),C.useMemo(()=>F!==Y.tabSize&&N({tabSize:F}),[F]),C.useMemo(()=>m!==Y.highlightEnable&&N({highlightEnable:m}),[m]),C.useMemo(()=>D!==Y.autoFocus&&N({autoFocus:D}),[D]),C.useMemo(()=>M!==Y.autoFocusEnd&&N({autoFocusEnd:M}),[M]),C.useMemo(()=>S!==Y.fullscreen&&N({fullscreen:S}),[S]),C.useMemo(()=>f!==Y.height&&N({height:f}),[f]),C.useMemo(()=>f!==Y.height&&z&&z(Y.height,f,Y),[f,z,Y]),C.useMemo(()=>i!==Y.commands&&N({commands:G}),[e.commands]),C.useMemo(()=>d!==Y.extraCommands&&N({extraCommands:V}),[e.extraCommands]);var Z=C.useRef(),Q=C.useRef("preview"),re=C.useRef(!1);C.useMemo(()=>{Z.current=Y.textareaWarp,Y.textareaWarp&&(Y.textareaWarp.addEventListener("mouseover",()=>{Q.current="text"}),Y.textareaWarp.addEventListener("mouseleave",()=>{Q.current="preview"}))},[Y.textareaWarp]);var te=(me,ve)=>{if(U.current){var Xe=Z.current,Be=K.current?K.current:void 0;if(re.current||(Q.current=ve,re.current=!0),Xe&&Be){var Ue=(Xe.scrollHeight-Xe.offsetHeight)/(Be.scrollHeight-Be.offsetHeight);me.target===Xe&&Q.current==="text"&&(Be.scrollTop=Xe.scrollTop/Ue),me.target===Be&&Q.current==="preview"&&(Xe.scrollTop=Be.scrollTop*Ue);var He=0;Q.current==="text"?He=Xe.scrollTop||0:Q.current==="preview"&&(He=Be.scrollTop||0),N({scrollTop:He})}}},ue=r+"-preview "+(x.className||""),fe=me=>te(me,"preview"),de=C.useMemo(()=>y.jsx("div",{ref:K,className:ue,children:y.jsx(r7,ne({},x,{onScroll:fe,source:Y.markdown||""}))}),[ue,x,Y.markdown]),xe=P?.preview&&P?.preview(Y.markdown||"",Y,N);xe&&Je.isValidElement(xe)&&(de=y.jsx("div",{className:ue,ref:K,onScroll:fe,children:xe}));var ae=ne({},L.style,{height:Y.height||"100%"}),se=()=>N({barPopup:ne({},pve(Y.barPopup))}),je=me=>N({height:me}),De=me=>{if(H&&H(me.target.value,me,Y),w&&w.onChange&&w.onChange(me),Y.textarea&&Y.textarea instanceof HTMLTextAreaElement&&j){var ve=new Xk(Y.textarea),Xe=ve.getState()||{};j(ne({},Xe,{lineCount:me.target.value.split(`
326
- `).length,length:me.target.value.length}))}};return y.jsx($f.Provider,{value:ne({},Y,{dispatch:N}),children:y.jsxs("div",ne({ref:q,className:J},L,{onClick:se,style:ae,children:[y.jsx(T_,{hideToolbar:k,toolbarBottom:_,prefixCls:r,overflow:E,placement:"top"}),y.jsxs("div",{className:r+"-content",children:[/(edit|live)/.test(Y.preview||"")&&y.jsx(cve,ne({className:r+"-input",prefixCls:r,autoFocus:D},w,{onChange:De,renderTextarea:P?.textarea||$,onScroll:me=>te(me,"text")})),/(live|preview)/.test(Y.preview||"")&&de]}),g&&!Y.fullscreen&&y.jsx(dve,{prefixCls:r,height:Y.height,maxHeight:T,minHeight:R,onChange:je}),y.jsx(T_,{hideToolbar:k,toolbarBottom:_,prefixCls:r,overflow:E,placement:"bottom"})]}))})}),d7=hve;d7.Markdown=r7;const LE={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"}]}}},mve={...LE,patterns:[...LE.patterns,{include:"#docvar"}],repository:{...LE.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},gve={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"}]}}},yve="github-light";let FE;function bve(){return FE||(FE=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:a}]=await Promise.all([po(()=>import("./core-B4ZYB7aS.es-8Zh0TkSr.js"),__vite__mapDeps([0,1])),po(()=>import("./engine-oniguruma-C4vnmooL.es-jdkXmgTr.js"),[]),po(()=>import("./sql-DCkt643-.es-COK4E0Yg.js"),[]),po(()=>import("./json-71t8ZF9g.es-BQoSv7ci.js"),[]),po(()=>import("./typescript-buWNZFwO.es-Dj6nwHGl.js"),[]),po(()=>import("./github-light-JYsPkUQd.es-DAi9KRSo.js"),[])]);return e({engine:t(po(()=>import("./wasm-DQxwEHae.es-CG6Dc4jp.js"),[])),themes:[a],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...mve},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...gve}]})})()),FE}async function Iv(e,t){return(await bve()).codeToHtml(e,{lang:t,theme:yve})}function Do(e){const{server:t}=Yn(),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 HJ(n,Ww)}function ts(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 VJ(t,Ww)}const Dr=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==="projects"?n.projectName=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.projectName)throw new Error(`Failed to parse resource URI: ${e}`);return n},Zk=e=>{if(!e.projectName)throw new Error(`Failed to encode resource URI, missing project name: ${e}`);let t=`publisher://projects/${e.projectName}`;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 f7({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a}){return Je.useEffect(()=>{o&&o(t)},[t,o]),y.jsx(bk,{children:y.jsxs(GW,{spacing:2,component:"section",children:[y.jsx(xve,{sourceAndPath:e[t],existingQuery:n,onChange:i=>{r&&r(i)},resourceUri:a}),y.jsx(jV,{height:"5px"})]})})}function zb(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function vve({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a}){const[i,l]=Je.useState(n||zb()),[c,d]=Je.useState(void 0);Je.useEffect(()=>{n&&l(n)},[n]);const[f,h]=Je.useState([]),{MalloyExplorerProvider:g,QueryPanel:m,ResizableCollapsiblePanel:v,ResultPanel:S,SourcePanel:E}=r;Je.useEffect(()=>{t&&t(i)},[t,i]);const{projectName:x,packageName:w,versionId:T}=Dr(a),{apiClients:R}=Yn(),D=ts({mutationFn:()=>{const H=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:()=>{D.reset(),d(void 0)},response:{result:{}}}),l({...i,query:H}),R.models.executeQueryModel(x,w,e.modelPath,{query:H,sourceName:void 0,queryName:void 0,versionId:T})},onSuccess:H=>{if(H){const j=JSON.parse(H.data.result);l({...i,malloyResult:j}),d(z=>z?{...z,executionState:"finished",response:{result:j}}:void 0)}},onError:H=>{d(void 0),console.error("Query execution error:",H)}}),[M,F]=Je.useState(e.sourceInfo.name);Je.useEffect(()=>{M!==e.sourceInfo.name&&(F(e.sourceInfo.name),l(zb()),d(void 0))},[e,M]);const B=Je.useCallback(H=>{l({...i,malloyQuery:H,malloyResult:void 0})},[i]);return M!==e.sourceInfo.name?y.jsx("div",{children:"Loading..."}):y.jsx(z6,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:y.jsx(g,{source:e.sourceInfo,query:i?.malloyQuery,topValues:[],onFocusedNestViewPathChange:h,focusedNestViewPath:f,onQueryChange:B,children:y.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[y.jsx(v,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:y.jsx(E,{onRefresh:()=>l(zb())})}),y.jsx(v,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:y.jsx(m,{runQuery:()=>{console.log(`running query with: ${i?.malloyQuery}`);try{D.mutate()}catch(H){console.error("Error running query:",H)}}})}),y.jsx(S,{source:e.sourceInfo,draftQuery:i?.malloyQuery,setDraftQuery:H=>l({...i,malloyQuery:H}),submittedQuery:c,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function xve(e){const[t,n]=C.useState(null),[r,o]=C.useState(null),[a,i]=C.useState(!0);return C.useEffect(()=>{let l=!0;return Promise.all([po(()=>import("./index-BefdHHMa.js"),__vite__mapDeps([2,3,4])),po(()=>import("./index-BWJkzsfl.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?y.jsx(Vie,{children:y.jsx(z6,{children:y.jsx("div",{style:{alignItems:"center",justifyContent:"center",height:"200px",color:"#666"},children:"Loading explorer..."})})}):y.jsx(vve,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function Lo({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:a=2,textVariant:i="body2"}){const l=y.jsxs(Bt,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:a},children:[y.jsx(s0,{size:t,color:n,thickness:r}),e&&y.jsx(mt,{variant:i,color:"text.secondary",children:e})]});return o?y.jsx(Bt,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:l}):l}const Sve=C.lazy(()=>Promise.resolve().then(()=>KRe));function e1({result:e,maxHeight:t,maxResultSize:n=0}){const r=C.useRef(null),[o,a]=C.useState(t),[i,l]=C.useState(!1);if(!e)return null;if(n>0&&e.length>n&&!i)return y.jsxs(Bt,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[y.jsx(Hte,{sx:{fontSize:48,color:"#757575"}}),y.jsx(mt,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),y.jsx(Sa,{variant:"contained",color:"primary",onClick:()=>l(!0),children:"Proceed"})]});const c=y.jsx(Lo,{text:"Loading...",centered:!0,size:32}),d=Math.min(t,o);return y.jsx(Bt,{ref:r,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden"},children:e&&y.jsx(C.Suspense,{fallback:c,children:y.jsx(Sve,{result:e,height:d,onSizeChange:a})})})}function Eve({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 y.jsx(f7,{resourceUri:n,sourceAndPaths:t,selectedSourceIndex:i>=0?i:0,existingQuery:a,onQueryChange:r,onSourceChange:o})}function Cve({cell:e,editingMalloy:t,editingMarkdown:n,sourceAndPaths:r,resourceUri:o,onCellChange:a,onClose:i,onEdit:l,onDelete:c,addButtonCallback:d}){const[f,h]=C.useState(e.value),[g,m]=Je.useState(!1),[v,S]=Je.useState(!1),[E,x]=Je.useState(),[w]=Je.useState(),[T,R]=Je.useState(zb()),[D,M]=Je.useState(!1),[F,B]=Je.useState(e.sourceName?r.findIndex(q=>q.sourceInfo.name===e.sourceName):0);C.useEffect(()=>{e.isMarkdown||Iv(e.value,"malloy").then(q=>{x(q)})},[e]),Je.useEffect(()=>{document.documentElement.setAttribute("data-color-mode","light")});const[H,j]=C.useState(!1),z=()=>{c(),j(!1)},k=r.length===0,_=Je.useCallback(()=>{const q=r[F],K=q?.modelPath||e.modelPath||"",U=q?.sourceInfo.name||e.sourceName||"";a({...e,value:e.isMarkdown?f:T.query,result:T.malloyResult?JSON.stringify(T.malloyResult):void 0,queryInfo:T.malloyQuery?JSON.stringify(T.malloyQuery):void 0,sourceName:U,modelPath:K})},[e,f,T,a,F,r]),P=y.jsx(ma,{title:"Delete Cell",children:y.jsx(kr,{size:"small",onClick:()=>j(!0),children:y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:y.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"})})})}),$=y.jsxs(Ql,{open:H,onClose:()=>j(!1),children:[y.jsx(Zl,{children:"Confirm Delete"}),y.jsx(Xl,{children:y.jsx(mt,{children:"Are you sure you want to delete this cell?"})}),y.jsxs(P4,{children:[y.jsx(Sa,{onClick:()=>j(!1),children:"Cancel"}),y.jsx(Sa,{onClick:z,color:"error",children:"Delete"})]})]}),L=()=>{_(),i()},G=e.isMarkdown?y.jsxs(y.Fragment,{children:[n?y.jsx(ma,{title:"Save",children:y.jsx(kr,{size:"small",onClick:L,children:y.jsx(Zy,{})})}):y.jsx(ma,{title:"Edit",children:y.jsx(kr,{size:"small",onClick:l,children:y.jsx(WN,{})})}),!n&&P]}):y.jsxs(y.Fragment,{children:[!t&&y.jsx(ma,{title:g?"Hide Code":"View Code",children:y.jsx(kr,{size:"small",onClick:()=>{m(!g)},children:y.jsx(U6,{})})}),!t&&e.result&&y.jsx(ma,{title:v?"Hide Embedding":"View Embedding",children:y.jsx(kr,{size:"small",onClick:()=>{S(!v)},children:y.jsx(vk,{})})}),t&&y.jsx(ma,{title:"Save",children:y.jsx(kr,{size:"small",onClick:L,children:y.jsx(Zy,{})})}),!t&&y.jsx(ma,{title:"Edit",children:y.jsx(kr,{size:"small",onClick:l,children:y.jsx(WN,{})})}),!t&&P]}),V=t||n,Y=n?y.jsx(ma,{title:"Save",children:y.jsx(kr,{size:"small",onClick:L,children:y.jsx(Zy,{})})}):t?y.jsx(ma,{title:"Save",children:y.jsx(kr,{size:"small",onClick:L,children:y.jsx(Zy,{})})}):null,N=D&&y.jsx(Bt,{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:!V&&y.jsxs(y.Fragment,{children:[d(!0),d(!1),G]})||Y});return y.jsxs(Sv,{sx:{position:"relative",marginTop:"5px",marginBottom:"5px",borderWidth:"1.5px",backgroundColor:"#fff",minHeight:"50px"},onMouseEnter:()=>M(!0),onMouseLeave:()=>{M(!1)},children:[N,e.isMarkdown?y.jsx(y.Fragment,{children:n?y.jsx(d7,{value:f,preview:"edit",autoFocus:!0,onChange:q=>{h(q),a({...e,value:q})},onBlur:()=>{_(),D||L()}}):y.jsx(Bt,{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?y.jsx(Bt,{onClick:l,sx:{cursor:"pointer"},children:y.jsx(pv,{children:e.value})}):y.jsxs(Bt,{onClick:l,sx:{cursor:"pointer"},children:[y.jsx(mt,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Markdown is empty"}),y.jsx(mt,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})})}):y.jsxs(y.Fragment,{children:[y.jsx(nv,{in:v,timeout:"auto",unmountOnExit:!0,children:y.jsx(io,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:y.jsx(mt,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:w}})})}),y.jsx(nv,{in:g,timeout:"auto",unmountOnExit:!0,children:y.jsx(io,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:y.jsx(mt,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:E}})})}),t&&(k?y.jsxs(y.Fragment,{children:[y.jsx(mt,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"No Model Imports"}),y.jsx(mt,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Please add a model import above."})]}):y.jsx(Eve,{sourceAndPaths:r,resourceUri:o,onQueryChange:q=>{R(q)},onSourceChange:q=>{B(q)},cell:e})),!t&&e.result&&y.jsx(Sv,{variant:"outlined",sx:{borderRadius:0},children:y.jsx(e1,{result:e.result,maxHeight:800})}),!t&&!e.result&&y.jsxs(Bt,{onClick:l,sx:{cursor:"pointer"},children:[y.jsx(mt,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Explore is empty"}),y.jsx(mt,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})]}),H&&$]})}const p7=C.createContext(void 0);function Tve({children:e,workbookStorage:t}){const n=C.useMemo(()=>({workbookStorage:t}),[t]);return y.jsx(p7.Provider,{value:n,children:e})}function wve(){const e=C.useContext(p7);if(!e)throw new Error("useWorkbookStorage must be used within a WorkbookStorageProvider");return e}const tc=dn(y.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"})),kve=dn(y.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 wo({error:e,context:t}){const n=e.data?.message||"Unknown Error";return y.jsxs(y.Fragment,{children:[t&&y.jsx(mt,{variant:"body2",sx:{p:"10px",m:"auto"},children:t}),y.jsx("pre",{style:{whiteSpace:"pre-wrap",color:"red",padding:"10px",margin:"auto"},children:n})]})}function Ave({initialSelectedModels:e,onModelChange:t,resourceUri:n}){const{projectName:r,packageName:o,versionId:a}=Dr(n),{apiClients:i}=Yn(),{data:l,isLoading:c,isSuccess:d,isError:f,error:h}=Do({queryKey:["models",r,o,a],queryFn:()=>i.models.listModels(r,o,a)}),[g,m]=Je.useState(e||[]),[v,S]=Je.useState(null);Je.useEffect(()=>{m(e||[])},[e]);const E=T=>{const R=g.filter(D=>D!==T);m(R),t(R)},x=T=>{const R=[...g,T];m(R),t(R),S(null)};let w=[];return d&&l?.data&&(w=l.data.filter(T=>!g.includes(T.path)).map(T=>T.path)),f?y.jsx(wo,{error:h,context:`${r} > ${o} > Model Picker`}):y.jsxs(y.Fragment,{children:[y.jsxs(_4,{fullWidth:!0,children:[c&&y.jsx(mt,{children:"Loading..."}),y.jsxs(io,{direction:"row",spacing:1,children:[g.map(T=>y.jsx(Eb,{label:T,onDelete:()=>E(T),deleteIcon:y.jsx(tc,{}),sx:{marginBottom:"5px"}},T)),y.jsx(Sa,{size:"small",startIcon:y.jsx(kve,{}),onClick:T=>S(T.currentTarget),disabled:c||f||w.length===0,children:"Add Model"})]})]}),y.jsxs(eg,{anchorEl:v,open:!!v,onClose:()=>S(null),children:[y.jsx(mt,{variant:"subtitle2",sx:{ml:1},children:"Models"}),y.jsx(os,{}),w.length===0?y.jsx(Jl,{disabled:!0,children:"No models available"}):w.map(T=>y.jsx(Jl,{onClick:()=>x(T),children:y.jsx(mt,{variant:"body2",children:T})},T))]})]})}function Dve(){const e=h3();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 $Me({workbookPath:e,resourceUri:t}){const n=Dve(),{server:r,getAccessToken:o}=Yn(),{apiClients:a}=Yn(),{workbookStorage:i}=wve(),{projectName:l,packageName:c}=Dr(t),[d,f]=Je.useState(void 0),[h,g]=Je.useState(void 0);if(!i)throw new Error("Workbook storage be provided via WorkbookStorageProvider");const[m,v]=Je.useState(),[S,E]=Je.useState(),[x,w]=Je.useState(),[T,R]=Je.useState([]),[D,M]=Je.useState(null),[F,B]=Je.useState(null),H=!!D,j=()=>{M(null),B(null)},z=(q,K)=>{m&&(v(m.insertCell(K,{isMarkdown:q,value:""})),q?w(K):E(K),j(),console.log("handleAddCell",q,K))},[k,_]=Je.useState(!1),P=()=>{_(!0)},$=async()=>{e&&i&&await i.deleteWorkbook(e).then(()=>{g(void 0),f(void 0)}).catch(q=>{g(`Error deleting workbook: ${q.message}`),f(void 0)}),_(!1),n(`/${l}/${c}`)},L=()=>{_(!1)},G=Je.useCallback(async()=>{if(!m){console.log("No workbook data ref");return}try{v(await m.saveWorkbook()),g(void 0),f("Workbook saved")}catch(q){g(`Error saving workbook: ${q.message}`),f(void 0)}},[m]);if(Je.useEffect(()=>{m&&(async()=>{const q=new Map(T.map(({modelPath:J,sourceInfos:Z})=>[J,Z])),K=[],U=[];for(const J of m.getModels())q.has(J)?K.push({modelPath:J,sourceInfos:q.get(J)}):(console.log("Fetching model from Publisher",J),U.push(a.models.getModel(l,c,J,void 0).then(Z=>({modelPath:J,sourceInfos:Z.data.sourceInfos.map(Q=>JSON.parse(Q))}))));if(U.length>0){const J=await Promise.all(U);R([...K,...J])}else R(K)})()},[o,m,c,l,r]),Je.useEffect(()=>{e&&Vh.loadWorkbook(i,e).then(q=>{v(q)})},[e,i]),!m)return y.jsx("div",{children:"Loading..."});const V=q=>{const K=[];for(const U of q)for(const J of U.sourceInfos)K.push({modelPath:U.modelPath,sourceInfo:J});return K},Y=(q,K)=>y.jsx(Sa,{size:"small",startIcon:y.jsx(yk,{}),onClick:()=>z(q,K),variant:"contained",sx:{backgroundColor:"#fff",color:U=>U.palette.mode==="dark"?U.palette.grey[100]:U.palette.grey[700],boxShadow:"none","&:hover":{backgroundColor:U=>U.palette.mode==="dark"?U.palette.grey[500]:U.palette.grey[300],boxShadow:"none"}},children:q?"Markdown":"Explore"}),N=y.jsxs(Bt,{sx:{display:"flex",gap:1,justifyContent:"center",flex:2},children:[Y(!1,m.getCells().length),Y(!0,m.getCells().length)]});return y.jsxs(Sv,{variant:"outlined",children:[y.jsxs($6,{children:[y.jsx(Bt,{sx:{mb:2},children:y.jsx(Bt,{sx:{minHeight:"24px"},children:h?y.jsx(mt,{color:"error",variant:"body2",children:h}):d?y.jsx(mt,{color:"success",variant:"body2",children:d}):y.jsx("span",{children:" "})})}),y.jsxs(wd,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[y.jsxs(wd,{direction:"row",spacing:1,alignItems:"center",children:[y.jsx(mt,{variant:"overline",sx:{fontSize:"13px",fontWeight:"bold",verticalAlign:"middle"},children:"Workbook"}),y.jsx(mt,{variant:"subtitle2",sx:{fontSize:"13px",fontWeight:"normal",verticalAlign:"middle",ml:1},children:`${e.workspace} > ${e.path}`})]}),y.jsxs(wd,{sx:{display:"flex",flexDirection:"row",gap:1},children:[y.jsx(Bt,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:y.jsx(Rve,{workbookData:m})}),y.jsxs(Bt,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:[y.jsx(Sa,{color:"error",onClick:P,size:"small",children:"Delete"}),y.jsxs(Ql,{open:k,onClose:L,children:[y.jsx(Zl,{children:"Delete Workbook"}),y.jsx(Xl,{children:y.jsxs(AQ,{children:['Are you sure you want to delete the workbook "',e.path,'"? This action cannot be undone.']})}),y.jsxs(P4,{children:[y.jsx(Sa,{onClick:L,color:"primary",size:"small",children:"Cancel"}),y.jsx(Sa,{onClick:$,color:"error",autoFocus:!0,size:"small",children:"Delete"})]})]})]})]})]}),y.jsx(os,{}),y.jsxs(wd,{sx:{display:"flex",flexDirection:"row",width:"100%",mt:2},children:[y.jsx(Bt,{sx:{flex:1},children:y.jsx(Ave,{initialSelectedModels:m.getModels(),onModelChange:q=>{v(m.setModels(q)),G()},resourceUri:t})}),y.jsx(Bt,{sx:{flex:1}})]})]}),y.jsx(bk,{children:y.jsxs(wd,{children:[m.getCells().length===0&&y.jsxs(y.Fragment,{children:[y.jsx(mt,{sx:{textAlign:"center",p:2,variant:"subtitle2",fontWeight:"medium"},children:"Workbook is empty"}),y.jsx(mt,{variant:"body2",sx:{textAlign:"center",mb:2,variant:"body2"},children:"Click the + buttons to add a markdown or code cell."})]}),m.getCells().map((q,K)=>y.jsx(Je.Fragment,{children:y.jsx(Cve,{cell:q,resourceUri:t,addButtonCallback:U=>Y(U,K),sourceAndPaths:V(T),editingMarkdown:x===K,editingMalloy:S===K,onDelete:()=>{v(m.deleteCell(K)),G()},onCellChange:U=>{v(m.setCell(K,U))},onEdit:()=>{q.isMarkdown?w(K):E(K)},onClose:()=>{q.isMarkdown?w(void 0):E(void 0),G()}},`${K}-${q.isMarkdown}-${e.workspace}-${e.path}`)},`${K}-${m.getCells().length}`)),N,y.jsxs(eg,{anchorEl:D,open:H,onClose:j,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[y.jsx(Jl,{onClick:()=>z(!0,F??0),children:"Add Markdown"}),y.jsx(Jl,{onClick:()=>z(!1,F??0),children:"Add Malloy"})]}),y.jsx(wd,{sx:{flexDirection:"row",justifyContent:"flex-end",p:1}})]})})]})}function Rve({workbookData:e}){const[t,n]=Je.useState(!1);return y.jsx(Sa,{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 w_="Local";class Mve{async listWorkspaces(t){return Promise.resolve([{name:w_,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:w_})}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)}}const Ive=e=>{const t=C.useRef({});return C.useEffect(()=>{t.current=e}),t.current};function k_({array1:e,array2:t,parser:n=r=>r}){return e&&t&&e.length===t.length&&e.every((r,o)=>n(r)===n(t[o]))}function A_(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Ove(e={}){const{ignoreAccents:t=!0,ignoreCase:n=!0,limit:r,matchFrom:o="any",stringify:a,trim:i=!1}=e;return(l,{inputValue:c,getOptionLabel:d})=>{let f=i?c.trim():c;n&&(f=f.toLowerCase()),t&&(f=A_(f));const h=f?l.filter(g=>{let m=(a||d)(g);return n&&(m=m.toLowerCase()),t&&(m=A_(m)),o==="start"?m.startsWith(f):m.includes(f)}):l;return typeof r=="number"?h.slice(0,r):h}}const Nve=Ove(),D_=5,Pve=e=>e.current!==null&&e.current.parentElement?.contains(document.activeElement),_ve=[];function R_(e,t,n,r){if(t||e==null||r)return"";const o=n(e);return typeof o=="string"?o:""}function Lve(e){const{unstable_isActiveElementInListbox:t=Pve,unstable_classNamePrefix:n="Mui",autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:i=!1,clearOnBlur:l=!e.freeSolo,clearOnEscape:c=!1,componentName:d="useAutocomplete",defaultValue:f=e.multiple?_ve:null,disableClearable:h=!1,disableCloseOnSelect:g=!1,disabled:m,disabledItemsFocusable:v=!1,disableListWrap:S=!1,filterOptions:E=Nve,filterSelectedOptions:x=!1,freeSolo:w=!1,getOptionDisabled:T,getOptionKey:R,getOptionLabel:D=Re=>Re.label??Re,groupBy:M,handleHomeEndKeys:F=!e.freeSolo,id:B,includeInputInList:H=!1,inputValue:j,isOptionEqualToValue:z=(Re,Oe)=>Re===Oe,multiple:k=!1,onChange:_,onClose:P,onHighlightChange:$,onInputChange:L,onOpen:G,open:V,openOnFocus:Y=!1,options:N,readOnly:q=!1,renderValue:K,selectOnFocus:U=!e.freeSolo,value:J}=e,Z=Ri(B);let Q=D;Q=Re=>{const Oe=D(Re);return typeof Oe!="string"?String(Oe):Oe};const re=C.useRef(!1),te=C.useRef(!0),ue=C.useRef(null),fe=C.useRef(null),[de,xe]=C.useState(null),[ae,se]=C.useState(-1),je=o?0:-1,De=C.useRef(je),me=C.useRef(R_(f??J,k,Q)).current,[ve,Xe]=Ta({controlled:J,default:f,name:d}),[Be,Ue]=Ta({controlled:j,default:me,name:d,state:"inputValue"}),[He,Rt]=C.useState(!1),Mt=C.useCallback((Re,Oe,ut)=>{if(!(k?ve.length<Oe.length:Oe!==null)&&!l)return;const Nt=R_(Oe,k,Q,K);Be!==Nt&&(Ue(Nt),L&&L(Re,Nt,ut))},[Q,Be,k,L,Ue,l,ve,K]),[bt,ge]=Ta({controlled:V,default:!1,name:d,state:"open"}),[Ee,Ge]=C.useState(!0),st=!k&&ve!=null&&Be===Q(ve),ot=bt&&!q,Ye=ot?E(N.filter(Re=>!(x&&(k?ve:[ve]).some(Oe=>Oe!==null&&z(Re,Oe)))),{inputValue:st&&Ee?"":Be,getOptionLabel:Q}):[],zt=Ive({filteredOptions:Ye,value:ve,inputValue:Be});C.useEffect(()=>{const Re=ve!==zt.value;He&&!Re||w&&!Re||Mt(null,ve,"reset")},[ve,Mt,He,zt.value,w]);const Gt=bt&&Ye.length>0&&!q,rt=dt(Re=>{if(Re===-1)ue.current.focus();else{const Oe=K?"data-item-index":"data-tag-index";de.querySelector(`[${Oe}="${Re}"]`).focus()}});C.useEffect(()=>{k&&ae>ve.length-1&&(se(-1),rt(-1))},[ve,k,ae,rt]);function he(Re,Oe){if(!fe.current||Re<0||Re>=Ye.length)return-1;let ut=Re;for(;;){const Nt=fe.current.querySelector(`[data-option-index="${ut}"]`),$t=v?!1:!Nt||Nt.disabled||Nt.getAttribute("aria-disabled")==="true";if(Nt&&Nt.hasAttribute("tabindex")&&!$t)return ut;if(Oe==="next"?ut=(ut+1)%Ye.length:ut=(ut-1+Ye.length)%Ye.length,ut===Re)return-1}}const Se=dt(({event:Re,index:Oe,reason:ut})=>{if(De.current=Oe,Oe===-1?ue.current.removeAttribute("aria-activedescendant"):ue.current.setAttribute("aria-activedescendant",`${Z}-option-${Oe}`),$&&["mouse","keyboard","touch"].includes(ut)&&$(Re,Oe===-1?null:Ye[Oe],ut),!fe.current)return;const Nt=fe.current.querySelector(`[role="option"].${n}-focused`);Nt&&(Nt.classList.remove(`${n}-focused`),Nt.classList.remove(`${n}-focusVisible`));let $t=fe.current;if(fe.current.getAttribute("role")!=="listbox"&&($t=fe.current.parentElement.querySelector('[role="listbox"]')),!$t)return;if(Oe===-1){$t.scrollTop=0;return}const Nn=fe.current.querySelector(`[data-option-index="${Oe}"]`);if(Nn&&(Nn.classList.add(`${n}-focused`),ut==="keyboard"&&Nn.classList.add(`${n}-focusVisible`),$t.scrollHeight>$t.clientHeight&&ut!=="mouse"&&ut!=="touch")){const or=Nn,go=$t.clientHeight+$t.scrollTop,Qt=or.offsetTop+or.offsetHeight;Qt>go?$t.scrollTop=Qt-$t.clientHeight:or.offsetTop-or.offsetHeight*(M?1.3:0)<$t.scrollTop&&($t.scrollTop=or.offsetTop-or.offsetHeight*(M?1.3:0))}}),lt=dt(({event:Re,diff:Oe,direction:ut="next",reason:Nt})=>{if(!ot)return;const $t=he((()=>{const Nn=Ye.length-1;if(Oe==="reset")return je;if(Oe==="start")return 0;if(Oe==="end")return Nn;const or=De.current+Oe;return or<0?or===-1&&H?-1:S&&De.current!==-1||Math.abs(Oe)>1?0:Nn:or>Nn?or===Nn+1&&H?-1:S||Math.abs(Oe)>1?Nn:0:or})(),ut);if(Se({index:$t,reason:Nt,event:Re}),r&&Oe!=="reset")if($t===-1)ue.current.value=Be;else{const Nn=Q(Ye[$t]);ue.current.value=Nn,Nn.toLowerCase().indexOf(Be.toLowerCase())===0&&Be.length>0&&ue.current.setSelectionRange(Be.length,Nn.length)}}),nt=!k_({array1:zt.filteredOptions,array2:Ye,parser:Q}),tn=()=>{const Re=(Oe,ut)=>{const Nt=Oe?Q(Oe):"",$t=ut?Q(ut):"";return Nt===$t};if(De.current!==-1&&!k_({array1:zt.filteredOptions,array2:Ye,parser:Q})&&zt.inputValue===Be&&(k?ve.length===zt.value.length&&zt.value.every((Oe,ut)=>Q(ve[ut])===Q(Oe)):Re(zt.value,ve))){const Oe=zt.filteredOptions[De.current];if(Oe)return Ye.findIndex(ut=>Q(ut)===Q(Oe))}return-1},_n=C.useCallback(()=>{if(!ot)return;const Re=tn();if(Re!==-1){De.current=Re;return}const Oe=k?ve[0]:ve;if(Ye.length===0||Oe==null){lt({diff:"reset"});return}if(fe.current){if(Oe!=null){const ut=Ye[De.current];if(k&&ut&&ve.findIndex($t=>z(ut,$t))!==-1)return;const Nt=Ye.findIndex($t=>z($t,Oe));Nt===-1?lt({diff:"reset"}):Se({index:Nt});return}if(De.current>=Ye.length-1){Se({index:Ye.length-1});return}Se({index:De.current})}},[Ye.length,k?!1:ve,x,lt,Se,ot,Be,k]),$n=dt(Re=>{GC(fe,Re),Re&&_n()});C.useEffect(()=>{nt&&_n()},[_n,nt]);const Kn=Re=>{bt||(ge(!0),Ge(!0),G&&G(Re))},lr=(Re,Oe)=>{bt&&(ge(!1),P&&P(Re,Oe))},mr=(Re,Oe,ut,Nt)=>{if(k){if(ve.length===Oe.length&&ve.every(($t,Nn)=>$t===Oe[Nn]))return}else if(ve===Oe)return;_&&_(Re,Oe,ut,Nt),Xe(Oe)},On=C.useRef(!1),Cr=(Re,Oe,ut="selectOption",Nt="options")=>{let $t=ut,Nn=Oe;if(k){Nn=Array.isArray(ve)?ve.slice():[];const or=Nn.findIndex(go=>z(Oe,go));or===-1?Nn.push(Oe):Nt!=="freeSolo"&&(Nn.splice(or,1),$t="removeOption")}Mt(Re,Nn,$t),mr(Re,Nn,$t,{option:Oe}),!g&&(!Re||!Re.ctrlKey&&!Re.metaKey)&&lr(Re,$t),(i===!0||i==="touch"&&On.current||i==="mouse"&&!On.current)&&ue.current.blur()};function It(Re,Oe){if(Re===-1)return-1;let ut=Re;for(;;){if(Oe==="next"&&ut===ve.length||Oe==="previous"&&ut===-1)return-1;const Nt=K?"data-item-index":"data-tag-index",$t=de.querySelector(`[${Nt}="${ut}"]`);if(!$t||!$t.hasAttribute("tabindex")||$t.disabled||$t.getAttribute("aria-disabled")==="true")ut+=Oe==="next"?1:-1;else return ut}}const le=(Re,Oe)=>{if(!k)return;Be===""&&lr(Re,"toggleInput");let ut=ae;ae===-1?Be===""&&Oe==="previous"&&(ut=ve.length-1):(ut+=Oe==="next"?1:-1,ut<0&&(ut=0),ut===ve.length&&(ut=-1)),ut=It(ut,Oe),se(ut),rt(ut)},be=Re=>{re.current=!0,Ue(""),L&&L(Re,"","clear"),mr(Re,k?[]:null,"clear")},Ae=Re=>Oe=>{if(Re.onKeyDown&&Re.onKeyDown(Oe),!Oe.defaultMuiPrevented&&(ae!==-1&&!["ArrowLeft","ArrowRight"].includes(Oe.key)&&(se(-1),rt(-1)),Oe.which!==229))switch(Oe.key){case"Home":ot&&F&&(Oe.preventDefault(),lt({diff:"start",direction:"next",reason:"keyboard",event:Oe}));break;case"End":ot&&F&&(Oe.preventDefault(),lt({diff:"end",direction:"previous",reason:"keyboard",event:Oe}));break;case"PageUp":Oe.preventDefault(),lt({diff:-D_,direction:"previous",reason:"keyboard",event:Oe}),Kn(Oe);break;case"PageDown":Oe.preventDefault(),lt({diff:D_,direction:"next",reason:"keyboard",event:Oe}),Kn(Oe);break;case"ArrowDown":Oe.preventDefault(),lt({diff:1,direction:"next",reason:"keyboard",event:Oe}),Kn(Oe);break;case"ArrowUp":Oe.preventDefault(),lt({diff:-1,direction:"previous",reason:"keyboard",event:Oe}),Kn(Oe);break;case"ArrowLeft":!k&&K?rt(0):le(Oe,"previous");break;case"ArrowRight":!k&&K?rt(-1):le(Oe,"next");break;case"Enter":if(De.current!==-1&&ot){const ut=Ye[De.current],Nt=T?T(ut):!1;if(Oe.preventDefault(),Nt)return;Cr(Oe,ut,"selectOption"),r&&ue.current.setSelectionRange(ue.current.value.length,ue.current.value.length)}else w&&Be!==""&&st===!1&&(k&&Oe.preventDefault(),Cr(Oe,Be,"createOption","freeSolo"));break;case"Escape":ot?(Oe.preventDefault(),Oe.stopPropagation(),lr(Oe,"escape")):c&&(Be!==""||k&&ve.length>0||K)&&(Oe.preventDefault(),Oe.stopPropagation(),be(Oe));break;case"Backspace":if(k&&!q&&Be===""&&ve.length>0){const ut=ae===-1?ve.length-1:ae,Nt=ve.slice();Nt.splice(ut,1),mr(Oe,Nt,"removeOption",{option:ve[ut]})}!k&&K&&!q&&(Xe(null),rt(-1));break;case"Delete":if(k&&!q&&Be===""&&ve.length>0&&ae!==-1){const ut=ae,Nt=ve.slice();Nt.splice(ut,1),mr(Oe,Nt,"removeOption",{option:ve[ut]})}!k&&K&&!q&&(Xe(null),rt(-1));break}},Ve=Re=>{Rt(!0),Y&&!re.current&&Kn(Re)},Ze=Re=>{if(t(fe)){ue.current.focus();return}Rt(!1),te.current=!0,re.current=!1,a&&De.current!==-1&&ot?Cr(Re,Ye[De.current],"blur"):a&&w&&Be!==""?Cr(Re,Be,"blur","freeSolo"):l&&Mt(Re,ve,"blur"),lr(Re,"blur")},St=Re=>{const Oe=Re.target.value;Be!==Oe&&(Ue(Oe),Ge(!1),L&&L(Re,Oe,"input")),Oe===""?!h&&!k&&mr(Re,null,"clear"):Kn(Re)},kt=Re=>{const Oe=Number(Re.currentTarget.getAttribute("data-option-index"));De.current!==Oe&&Se({event:Re,index:Oe,reason:"mouse"})},Ct=Re=>{Se({event:Re,index:Number(Re.currentTarget.getAttribute("data-option-index")),reason:"touch"}),On.current=!0},At=Re=>{const Oe=Number(Re.currentTarget.getAttribute("data-option-index"));Cr(Re,Ye[Oe],"selectOption"),On.current=!1},yt=Re=>Oe=>{const ut=ve.slice();ut.splice(Re,1),mr(Oe,ut,"removeOption",{option:ve[Re]})},pt=Re=>{mr(Re,null,"removeOption",{option:ve})},vt=Re=>{bt?lr(Re,"toggleInput"):Kn(Re)},Xt=Re=>{Re.currentTarget.contains(Re.target)&&Re.target.getAttribute("id")!==Z&&Re.preventDefault()},Dn=Re=>{Re.currentTarget.contains(Re.target)&&(ue.current.focus(),U&&te.current&&ue.current.selectionEnd-ue.current.selectionStart===0&&ue.current.select(),te.current=!1)},Qn=Re=>{!m&&(Be===""||!bt)&&vt(Re)};let Xn=w&&Be.length>0;Xn=Xn||(k?ve.length>0:ve!==null);let Yt=Ye;return M&&(Yt=Ye.reduce((Re,Oe,ut)=>{const Nt=M(Oe);return Re.length>0&&Re[Re.length-1].group===Nt?Re[Re.length-1].options.push(Oe):Re.push({key:ut,index:ut,group:Nt,options:[Oe]}),Re},[])),m&&He&&Ze(),{getRootProps:(Re={})=>({...Re,onKeyDown:Ae(Re),onMouseDown:Xt,onClick:Dn}),getInputLabelProps:()=>({id:`${Z}-label`,htmlFor:Z}),getInputProps:()=>({id:Z,value:Be,onBlur:Ze,onFocus:Ve,onChange:St,onMouseDown:Qn,"aria-activedescendant":ot?"":null,"aria-autocomplete":r?"both":"list","aria-controls":Gt?`${Z}-listbox`:void 0,"aria-expanded":Gt,autoComplete:"off",ref:ue,autoCapitalize:"none",spellCheck:"false",role:"combobox",disabled:m}),getClearProps:()=>({tabIndex:-1,type:"button",onClick:be}),getItemProps:({index:Re=0}={})=>({...k&&{key:Re},...K?{"data-item-index":Re}:{"data-tag-index":Re},tabIndex:-1,...!q&&{onDelete:k?yt(Re):pt}}),getPopupIndicatorProps:()=>({tabIndex:-1,type:"button",onClick:vt}),getTagProps:({index:Re})=>({key:Re,"data-tag-index":Re,tabIndex:-1,...!q&&{onDelete:yt(Re)}}),getListboxProps:()=>({role:"listbox",id:`${Z}-listbox`,"aria-labelledby":`${Z}-label`,ref:$n,onMouseDown:Re=>{Re.preventDefault()}}),getOptionProps:({index:Re,option:Oe})=>{const ut=(k?ve:[ve]).some($t=>$t!=null&&z(Oe,$t)),Nt=T?T(Oe):!1;return{key:R?.(Oe)??Q(Oe),tabIndex:-1,role:"option",id:`${Z}-option-${Re}`,onMouseMove:kt,onClick:At,onTouchStart:Ct,"data-option-index":Re,"aria-disabled":Nt,"aria-selected":ut}},id:Z,inputValue:Be,value:ve,dirty:Xn,expanded:ot&&de,popupOpen:ot,focused:He||ae!==-1,anchorEl:de,setAnchorEl:xe,focusedItem:ae,focusedTag:ae,groupedOptions:Yt}}const h7=Pe.oneOfType([Pe.func,Pe.object]);var ta="top",ii="bottom",si="right",na="left",Jk="auto",yg=[ta,ii,si,na],yf="start",Pm="end",Fve="clippingParents",m7="viewport",fh="popper",jve="reference",M_=yg.reduce(function(e,t){return e.concat([t+"-"+yf,t+"-"+Pm])},[]),g7=[].concat(yg,[Jk]).reduce(function(e,t){return e.concat([t,t+"-"+yf,t+"-"+Pm])},[]),Bve="beforeRead",$ve="read",zve="afterRead",Uve="beforeMain",Hve="main",Vve="afterMain",Wve="beforeWrite",qve="write",Gve="afterWrite",Yve=[Bve,$ve,zve,Uve,Hve,Vve,Wve,qve,Gve];function is(e){return e?(e.nodeName||"").toLowerCase():null}function Da(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function yu(e){var t=Da(e).Element;return e instanceof t||e instanceof Element}function ti(e){var t=Da(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function eA(e){if(typeof ShadowRoot>"u")return!1;var t=Da(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Kve(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},a=t.elements[n];!ti(a)||!is(a)||(Object.assign(a.style,r),Object.keys(o).forEach(function(i){var l=o[i];l===!1?a.removeAttribute(i):a.setAttribute(i,l===!0?"":l)}))})}function Qve(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],a=t.attributes[r]||{},i=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),l=i.reduce(function(c,d){return c[d]="",c},{});!ti(o)||!is(o)||(Object.assign(o.style,l),Object.keys(a).forEach(function(c){o.removeAttribute(c)}))})}}const Xve={name:"applyStyles",enabled:!0,phase:"write",fn:Kve,effect:Qve,requires:["computeStyles"]};function ns(e){return e.split("-")[0]}var ou=Math.max,Ov=Math.min,bf=Math.round;function yT(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function y7(){return!/^((?!chrome|android).)*safari/i.test(yT())}function vf(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,a=1;t&&ti(e)&&(o=e.offsetWidth>0&&bf(r.width)/e.offsetWidth||1,a=e.offsetHeight>0&&bf(r.height)/e.offsetHeight||1);var i=yu(e)?Da(e):window,l=i.visualViewport,c=!y7()&&n,d=(r.left+(c&&l?l.offsetLeft:0))/o,f=(r.top+(c&&l?l.offsetTop:0))/a,h=r.width/o,g=r.height/a;return{width:h,height:g,top:f,right:d+h,bottom:f+g,left:d,x:d,y:f}}function tA(e){var t=vf(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function b7(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&eA(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Ks(e){return Da(e).getComputedStyle(e)}function Zve(e){return["table","td","th"].indexOf(is(e))>=0}function pc(e){return((yu(e)?e.ownerDocument:e.document)||window.document).documentElement}function t1(e){return is(e)==="html"?e:e.assignedSlot||e.parentNode||(eA(e)?e.host:null)||pc(e)}function I_(e){return!ti(e)||Ks(e).position==="fixed"?null:e.offsetParent}function Jve(e){var t=/firefox/i.test(yT()),n=/Trident/i.test(yT());if(n&&ti(e)){var r=Ks(e);if(r.position==="fixed")return null}var o=t1(e);for(eA(o)&&(o=o.host);ti(o)&&["html","body"].indexOf(is(o))<0;){var a=Ks(o);if(a.transform!=="none"||a.perspective!=="none"||a.contain==="paint"||["transform","perspective"].indexOf(a.willChange)!==-1||t&&a.willChange==="filter"||t&&a.filter&&a.filter!=="none")return o;o=o.parentNode}return null}function bg(e){for(var t=Da(e),n=I_(e);n&&Zve(n)&&Ks(n).position==="static";)n=I_(n);return n&&(is(n)==="html"||is(n)==="body"&&Ks(n).position==="static")?t:n||Jve(e)||t}function nA(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function tm(e,t,n){return ou(e,Ov(t,n))}function e0e(e,t,n){var r=tm(e,t,n);return r>n?n:r}function v7(){return{top:0,right:0,bottom:0,left:0}}function x7(e){return Object.assign({},v7(),e)}function S7(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var t0e=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,x7(typeof e!="number"?e:S7(e,yg))};function n0e(e){var t,n=e.state,r=e.name,o=e.options,a=n.elements.arrow,i=n.modifiersData.popperOffsets,l=ns(n.placement),c=nA(l),d=[na,si].indexOf(l)>=0,f=d?"height":"width";if(!(!a||!i)){var h=t0e(o.padding,n),g=tA(a),m=c==="y"?ta:na,v=c==="y"?ii:si,S=n.rects.reference[f]+n.rects.reference[c]-i[c]-n.rects.popper[f],E=i[c]-n.rects.reference[c],x=bg(a),w=x?c==="y"?x.clientHeight||0:x.clientWidth||0:0,T=S/2-E/2,R=h[m],D=w-g[f]-h[v],M=w/2-g[f]/2+T,F=tm(R,M,D),B=c;n.modifiersData[r]=(t={},t[B]=F,t.centerOffset=F-M,t)}}function r0e(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||b7(t.elements.popper,o)&&(t.elements.arrow=o))}const o0e={name:"arrow",enabled:!0,phase:"main",fn:n0e,effect:r0e,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function xf(e){return e.split("-")[1]}var a0e={top:"auto",right:"auto",bottom:"auto",left:"auto"};function i0e(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:bf(n*o)/o||0,y:bf(r*o)/o||0}}function O_(e){var t,n=e.popper,r=e.popperRect,o=e.placement,a=e.variation,i=e.offsets,l=e.position,c=e.gpuAcceleration,d=e.adaptive,f=e.roundOffsets,h=e.isFixed,g=i.x,m=g===void 0?0:g,v=i.y,S=v===void 0?0:v,E=typeof f=="function"?f({x:m,y:S}):{x:m,y:S};m=E.x,S=E.y;var x=i.hasOwnProperty("x"),w=i.hasOwnProperty("y"),T=na,R=ta,D=window;if(d){var M=bg(n),F="clientHeight",B="clientWidth";if(M===Da(n)&&(M=pc(n),Ks(M).position!=="static"&&l==="absolute"&&(F="scrollHeight",B="scrollWidth")),M=M,o===ta||(o===na||o===si)&&a===Pm){R=ii;var H=h&&M===D&&D.visualViewport?D.visualViewport.height:M[F];S-=H-r.height,S*=c?1:-1}if(o===na||(o===ta||o===ii)&&a===Pm){T=si;var j=h&&M===D&&D.visualViewport?D.visualViewport.width:M[B];m-=j-r.width,m*=c?1:-1}}var z=Object.assign({position:l},d&&a0e),k=f===!0?i0e({x:m,y:S},Da(n)):{x:m,y:S};if(m=k.x,S=k.y,c){var _;return Object.assign({},z,(_={},_[R]=w?"0":"",_[T]=x?"0":"",_.transform=(D.devicePixelRatio||1)<=1?"translate("+m+"px, "+S+"px)":"translate3d("+m+"px, "+S+"px, 0)",_))}return Object.assign({},z,(t={},t[R]=w?S+"px":"",t[T]=x?m+"px":"",t.transform="",t))}function s0e(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,a=n.adaptive,i=a===void 0?!0:a,l=n.roundOffsets,c=l===void 0?!0:l,d={placement:ns(t.placement),variation:xf(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,O_(Object.assign({},d,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,O_(Object.assign({},d,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const l0e={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:s0e,data:{}};var sb={passive:!0};function c0e(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,a=o===void 0?!0:o,i=r.resize,l=i===void 0?!0:i,c=Da(t.elements.popper),d=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&d.forEach(function(f){f.addEventListener("scroll",n.update,sb)}),l&&c.addEventListener("resize",n.update,sb),function(){a&&d.forEach(function(f){f.removeEventListener("scroll",n.update,sb)}),l&&c.removeEventListener("resize",n.update,sb)}}const u0e={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:c0e,data:{}};var d0e={left:"right",right:"left",bottom:"top",top:"bottom"};function Ub(e){return e.replace(/left|right|bottom|top/g,function(t){return d0e[t]})}var f0e={start:"end",end:"start"};function N_(e){return e.replace(/start|end/g,function(t){return f0e[t]})}function rA(e){var t=Da(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function oA(e){return vf(pc(e)).left+rA(e).scrollLeft}function p0e(e,t){var n=Da(e),r=pc(e),o=n.visualViewport,a=r.clientWidth,i=r.clientHeight,l=0,c=0;if(o){a=o.width,i=o.height;var d=y7();(d||!d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}return{width:a,height:i,x:l+oA(e),y:c}}function h0e(e){var t,n=pc(e),r=rA(e),o=(t=e.ownerDocument)==null?void 0:t.body,a=ou(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=ou(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),l=-r.scrollLeft+oA(e),c=-r.scrollTop;return Ks(o||n).direction==="rtl"&&(l+=ou(n.clientWidth,o?o.clientWidth:0)-a),{width:a,height:i,x:l,y:c}}function aA(e){var t=Ks(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function E7(e){return["html","body","#document"].indexOf(is(e))>=0?e.ownerDocument.body:ti(e)&&aA(e)?e:E7(t1(e))}function nm(e,t){var n;t===void 0&&(t=[]);var r=E7(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),a=Da(r),i=o?[a].concat(a.visualViewport||[],aA(r)?r:[]):r,l=t.concat(i);return o?l:l.concat(nm(t1(i)))}function bT(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function m0e(e,t){var n=vf(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function P_(e,t,n){return t===m7?bT(p0e(e,n)):yu(t)?m0e(t,n):bT(h0e(pc(e)))}function g0e(e){var t=nm(t1(e)),n=["absolute","fixed"].indexOf(Ks(e).position)>=0,r=n&&ti(e)?bg(e):e;return yu(r)?t.filter(function(o){return yu(o)&&b7(o,r)&&is(o)!=="body"}):[]}function y0e(e,t,n,r){var o=t==="clippingParents"?g0e(e):[].concat(t),a=[].concat(o,[n]),i=a[0],l=a.reduce(function(c,d){var f=P_(e,d,r);return c.top=ou(f.top,c.top),c.right=Ov(f.right,c.right),c.bottom=Ov(f.bottom,c.bottom),c.left=ou(f.left,c.left),c},P_(e,i,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function C7(e){var t=e.reference,n=e.element,r=e.placement,o=r?ns(r):null,a=r?xf(r):null,i=t.x+t.width/2-n.width/2,l=t.y+t.height/2-n.height/2,c;switch(o){case ta:c={x:i,y:t.y-n.height};break;case ii:c={x:i,y:t.y+t.height};break;case si:c={x:t.x+t.width,y:l};break;case na:c={x:t.x-n.width,y:l};break;default:c={x:t.x,y:t.y}}var d=o?nA(o):null;if(d!=null){var f=d==="y"?"height":"width";switch(a){case yf:c[d]=c[d]-(t[f]/2-n[f]/2);break;case Pm:c[d]=c[d]+(t[f]/2-n[f]/2);break}}return c}function _m(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,a=n.strategy,i=a===void 0?e.strategy:a,l=n.boundary,c=l===void 0?Fve:l,d=n.rootBoundary,f=d===void 0?m7:d,h=n.elementContext,g=h===void 0?fh:h,m=n.altBoundary,v=m===void 0?!1:m,S=n.padding,E=S===void 0?0:S,x=x7(typeof E!="number"?E:S7(E,yg)),w=g===fh?jve:fh,T=e.rects.popper,R=e.elements[v?w:g],D=y0e(yu(R)?R:R.contextElement||pc(e.elements.popper),c,f,i),M=vf(e.elements.reference),F=C7({reference:M,element:T,placement:o}),B=bT(Object.assign({},T,F)),H=g===fh?B:M,j={top:D.top-H.top+x.top,bottom:H.bottom-D.bottom+x.bottom,left:D.left-H.left+x.left,right:H.right-D.right+x.right},z=e.modifiersData.offset;if(g===fh&&z){var k=z[o];Object.keys(j).forEach(function(_){var P=[si,ii].indexOf(_)>=0?1:-1,$=[ta,ii].indexOf(_)>=0?"y":"x";j[_]+=k[$]*P})}return j}function b0e(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,a=n.rootBoundary,i=n.padding,l=n.flipVariations,c=n.allowedAutoPlacements,d=c===void 0?g7:c,f=xf(r),h=f?l?M_:M_.filter(function(v){return xf(v)===f}):yg,g=h.filter(function(v){return d.indexOf(v)>=0});g.length===0&&(g=h);var m=g.reduce(function(v,S){return v[S]=_m(e,{placement:S,boundary:o,rootBoundary:a,padding:i})[ns(S)],v},{});return Object.keys(m).sort(function(v,S){return m[v]-m[S]})}function v0e(e){if(ns(e)===Jk)return[];var t=Ub(e);return[N_(e),t,N_(t)]}function x0e(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,a=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!0:i,c=n.fallbackPlacements,d=n.padding,f=n.boundary,h=n.rootBoundary,g=n.altBoundary,m=n.flipVariations,v=m===void 0?!0:m,S=n.allowedAutoPlacements,E=t.options.placement,x=ns(E),w=x===E,T=c||(w||!v?[Ub(E)]:v0e(E)),R=[E].concat(T).reduce(function(J,Z){return J.concat(ns(Z)===Jk?b0e(t,{placement:Z,boundary:f,rootBoundary:h,padding:d,flipVariations:v,allowedAutoPlacements:S}):Z)},[]),D=t.rects.reference,M=t.rects.popper,F=new Map,B=!0,H=R[0],j=0;j<R.length;j++){var z=R[j],k=ns(z),_=xf(z)===yf,P=[ta,ii].indexOf(k)>=0,$=P?"width":"height",L=_m(t,{placement:z,boundary:f,rootBoundary:h,altBoundary:g,padding:d}),G=P?_?si:na:_?ii:ta;D[$]>M[$]&&(G=Ub(G));var V=Ub(G),Y=[];if(a&&Y.push(L[k]<=0),l&&Y.push(L[G]<=0,L[V]<=0),Y.every(function(J){return J})){H=z,B=!1;break}F.set(z,Y)}if(B)for(var N=v?3:1,q=function(J){var Z=R.find(function(Q){var re=F.get(Q);if(re)return re.slice(0,J).every(function(te){return te})});if(Z)return H=Z,"break"},K=N;K>0;K--){var U=q(K);if(U==="break")break}t.placement!==H&&(t.modifiersData[r]._skip=!0,t.placement=H,t.reset=!0)}}const S0e={name:"flip",enabled:!0,phase:"main",fn:x0e,requiresIfExists:["offset"],data:{_skip:!1}};function __(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function L_(e){return[ta,si,ii,na].some(function(t){return e[t]>=0})}function E0e(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,a=t.modifiersData.preventOverflow,i=_m(t,{elementContext:"reference"}),l=_m(t,{altBoundary:!0}),c=__(i,r),d=__(l,o,a),f=L_(c),h=L_(d);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:f,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":h})}const C0e={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:E0e};function T0e(e,t,n){var r=ns(e),o=[na,ta].indexOf(r)>=0?-1:1,a=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=a[0],l=a[1];return i=i||0,l=(l||0)*o,[na,si].indexOf(r)>=0?{x:l,y:i}:{x:i,y:l}}function w0e(e){var t=e.state,n=e.options,r=e.name,o=n.offset,a=o===void 0?[0,0]:o,i=g7.reduce(function(f,h){return f[h]=T0e(h,t.rects,a),f},{}),l=i[t.placement],c=l.x,d=l.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=d),t.modifiersData[r]=i}const k0e={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:w0e};function A0e(e){var t=e.state,n=e.name;t.modifiersData[n]=C7({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const D0e={name:"popperOffsets",enabled:!0,phase:"read",fn:A0e,data:{}};function R0e(e){return e==="x"?"y":"x"}function M0e(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,a=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!1:i,c=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.padding,g=n.tether,m=g===void 0?!0:g,v=n.tetherOffset,S=v===void 0?0:v,E=_m(t,{boundary:c,rootBoundary:d,padding:h,altBoundary:f}),x=ns(t.placement),w=xf(t.placement),T=!w,R=nA(x),D=R0e(R),M=t.modifiersData.popperOffsets,F=t.rects.reference,B=t.rects.popper,H=typeof S=="function"?S(Object.assign({},t.rects,{placement:t.placement})):S,j=typeof H=="number"?{mainAxis:H,altAxis:H}:Object.assign({mainAxis:0,altAxis:0},H),z=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,k={x:0,y:0};if(M){if(a){var _,P=R==="y"?ta:na,$=R==="y"?ii:si,L=R==="y"?"height":"width",G=M[R],V=G+E[P],Y=G-E[$],N=m?-B[L]/2:0,q=w===yf?F[L]:B[L],K=w===yf?-B[L]:-F[L],U=t.elements.arrow,J=m&&U?tA(U):{width:0,height:0},Z=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:v7(),Q=Z[P],re=Z[$],te=tm(0,F[L],J[L]),ue=T?F[L]/2-N-te-Q-j.mainAxis:q-te-Q-j.mainAxis,fe=T?-F[L]/2+N+te+re+j.mainAxis:K+te+re+j.mainAxis,de=t.elements.arrow&&bg(t.elements.arrow),xe=de?R==="y"?de.clientTop||0:de.clientLeft||0:0,ae=(_=z?.[R])!=null?_:0,se=G+ue-ae-xe,je=G+fe-ae,De=tm(m?Ov(V,se):V,G,m?ou(Y,je):Y);M[R]=De,k[R]=De-G}if(l){var me,ve=R==="x"?ta:na,Xe=R==="x"?ii:si,Be=M[D],Ue=D==="y"?"height":"width",He=Be+E[ve],Rt=Be-E[Xe],Mt=[ta,na].indexOf(x)!==-1,bt=(me=z?.[D])!=null?me:0,ge=Mt?He:Be-F[Ue]-B[Ue]-bt+j.altAxis,Ee=Mt?Be+F[Ue]+B[Ue]-bt-j.altAxis:Rt,Ge=m&&Mt?e0e(ge,Be,Ee):tm(m?ge:He,Be,m?Ee:Rt);M[D]=Ge,k[D]=Ge-Be}t.modifiersData[r]=k}}const I0e={name:"preventOverflow",enabled:!0,phase:"main",fn:M0e,requiresIfExists:["offset"]};function O0e(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function N0e(e){return e===Da(e)||!ti(e)?rA(e):O0e(e)}function P0e(e){var t=e.getBoundingClientRect(),n=bf(t.width)/e.offsetWidth||1,r=bf(t.height)/e.offsetHeight||1;return n!==1||r!==1}function _0e(e,t,n){n===void 0&&(n=!1);var r=ti(t),o=ti(t)&&P0e(t),a=pc(t),i=vf(e,o,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((is(t)!=="body"||aA(a))&&(l=N0e(t)),ti(t)?(c=vf(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):a&&(c.x=oA(a))),{x:i.left+l.scrollLeft-c.x,y:i.top+l.scrollTop-c.y,width:i.width,height:i.height}}function L0e(e){var t=new Map,n=new Set,r=[];e.forEach(function(a){t.set(a.name,a)});function o(a){n.add(a.name);var i=[].concat(a.requires||[],a.requiresIfExists||[]);i.forEach(function(l){if(!n.has(l)){var c=t.get(l);c&&o(c)}}),r.push(a)}return e.forEach(function(a){n.has(a.name)||o(a)}),r}function F0e(e){var t=L0e(e);return Yve.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function j0e(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function B0e(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var F_={placement:"bottom",modifiers:[],strategy:"absolute"};function j_(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function $0e(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,o=t.defaultOptions,a=o===void 0?F_:o;return function(i,l,c){c===void 0&&(c=a);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},F_,a),modifiersData:{},elements:{reference:i,popper:l},attributes:{},styles:{}},f=[],h=!1,g={state:d,setOptions:function(S){var E=typeof S=="function"?S(d.options):S;v(),d.options=Object.assign({},a,d.options,E),d.scrollParents={reference:yu(i)?nm(i):i.contextElement?nm(i.contextElement):[],popper:nm(l)};var x=F0e(B0e([].concat(r,d.options.modifiers)));return d.orderedModifiers=x.filter(function(w){return w.enabled}),m(),g.update()},forceUpdate:function(){if(!h){var S=d.elements,E=S.reference,x=S.popper;if(j_(E,x)){d.rects={reference:_0e(E,bg(x),d.options.strategy==="fixed"),popper:tA(x)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(B){return d.modifiersData[B.name]=Object.assign({},B.data)});for(var w=0;w<d.orderedModifiers.length;w++){if(d.reset===!0){d.reset=!1,w=-1;continue}var T=d.orderedModifiers[w],R=T.fn,D=T.options,M=D===void 0?{}:D,F=T.name;typeof R=="function"&&(d=R({state:d,options:M,name:F,instance:g})||d)}}}},update:j0e(function(){return new Promise(function(S){g.forceUpdate(),S(d)})}),destroy:function(){v(),h=!0}};if(!j_(i,l))return g;g.setOptions(c).then(function(S){!h&&c.onFirstUpdate&&c.onFirstUpdate(S)});function m(){d.orderedModifiers.forEach(function(S){var E=S.name,x=S.options,w=x===void 0?{}:x,T=S.effect;if(typeof T=="function"){var R=T({state:d,name:E,instance:g,options:w}),D=function(){};f.push(R||D)}})}function v(){f.forEach(function(S){return S()}),f=[]}return g}}var z0e=[u0e,D0e,l0e,Xve,k0e,S0e,I0e,o0e,C0e],U0e=$0e({defaultModifiers:z0e});function Sf(e){return typeof e=="string"}function T7(e,t,n){return e===void 0||Sf(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function Io(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function B_(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function w7(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:o,className:a}=e;if(!t){const m=ft(n?.className,a,o?.className,r?.className),v={...n?.style,...o?.style,...r?.style},S={...n,...o,...r};return m.length>0&&(S.className=m),Object.keys(v).length>0&&(S.style=v),{props:S,internalRef:void 0}}const i=Io({...o,...r}),l=B_(r),c=B_(o),d=t(i),f=ft(d?.className,n?.className,a,o?.className,r?.className),h={...d?.style,...n?.style,...o?.style,...r?.style},g={...d,...n,...c,...l};return f.length>0&&(g.className=f),Object.keys(h).length>0&&(g.style=h),{props:g,internalRef:d.ref}}function Qa(e,t,n){return typeof e=="function"?e(t,n):e}function hn(e){const{elementType:t,externalSlotProps:n,ownerState:r,skipResolvingSlotProps:o=!1,...a}=e,i=o?{}:Qa(n,r),{props:l,internalRef:c}=w7({...a,externalSlotProps:i}),d=mn(c,i?.ref,e.additionalProps?.ref);return T7(t,{...l,ref:d},r)}function Uf(e){return parseInt(C.version,10)>=19?e?.props?.ref||null:e?.ref||null}function H0e(e){return typeof e=="function"?e():e}const k7=C.forwardRef(function(e,t){const{children:n,container:r,disablePortal:o=!1}=e,[a,i]=C.useState(null),l=mn(C.isValidElement(n)?Uf(n):null,t);if(Jr(()=>{o||i(H0e(r)||document.body)},[r,o]),Jr(()=>{if(a&&!o)return GC(t,a),()=>{GC(t,null)}},[t,a,o]),o){if(C.isValidElement(n)){const c={ref:l};return C.cloneElement(n,c)}return n}return a&&qm.createPortal(n,a)});function V0e(e){return Tt("MuiPopper",e)}xt("MuiPopper",["root"]);function W0e(e,t){if(t==="ltr")return e;switch(e){case"bottom-end":return"bottom-start";case"bottom-start":return"bottom-end";case"top-end":return"top-start";case"top-start":return"top-end";default:return e}}function vT(e){return typeof e=="function"?e():e}function q0e(e){return e.nodeType!==void 0}const G0e=e=>{const{classes:t}=e;return Et({root:["root"]},V0e,t)},Y0e={},K0e=C.forwardRef(function(e,t){const{anchorEl:n,children:r,direction:o,disablePortal:a,modifiers:i,open:l,placement:c,popperOptions:d,popperRef:f,slotProps:h={},slots:g={},TransitionProps:m,ownerState:v,...S}=e,E=C.useRef(null),x=mn(E,t),w=C.useRef(null),T=mn(w,f),R=C.useRef(T);Jr(()=>{R.current=T},[T]),C.useImperativeHandle(f,()=>w.current,[]);const D=W0e(c,o),[M,F]=C.useState(D),[B,H]=C.useState(vT(n));C.useEffect(()=>{w.current&&w.current.forceUpdate()}),C.useEffect(()=>{n&&H(vT(n))},[n]),Jr(()=>{if(!B||!l)return;const P=G=>{F(G.placement)};let $=[{name:"preventOverflow",options:{altBoundary:a}},{name:"flip",options:{altBoundary:a}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:({state:G})=>{P(G)}}];i!=null&&($=$.concat(i)),d&&d.modifiers!=null&&($=$.concat(d.modifiers));const L=U0e(B,E.current,{placement:D,...d,modifiers:$});return R.current(L),()=>{L.destroy(),R.current(null)}},[B,a,i,l,d,D]);const j={placement:M};m!==null&&(j.TransitionProps=m);const z=G0e(e),k=g.root??"div",_=hn({elementType:k,externalSlotProps:h.root,externalForwardedProps:S,additionalProps:{role:"tooltip",ref:x},ownerState:e,className:z.root});return y.jsx(k,{..._,children:typeof r=="function"?r(j):r})}),Q0e=C.forwardRef(function(e,t){const{anchorEl:n,children:r,container:o,direction:a="ltr",disablePortal:i=!1,keepMounted:l=!1,modifiers:c,open:d,placement:f="bottom",popperOptions:h=Y0e,popperRef:g,style:m,transition:v=!1,slotProps:S={},slots:E={},...x}=e,[w,T]=C.useState(!0),R=()=>{T(!1)},D=()=>{T(!0)};if(!l&&!d&&(!v||w))return null;let M;if(o)M=o;else if(n){const H=vT(n);M=H&&q0e(H)?Yr(H).body:Yr(null).body}const F=!d&&l&&(!v||w)?"none":void 0,B=v?{in:d,onEnter:R,onExited:D}:void 0;return y.jsx(k7,{disablePortal:i,container:M,children:y.jsx(K0e,{anchorEl:n,direction:a,disablePortal:i,modifiers:c,ref:t,open:v?!w:d,placement:f,popperOptions:h,popperRef:g,slotProps:S,slots:E,...x,style:{position:"fixed",top:0,left:0,display:F,...m},TransitionProps:B,children:r})})}),X0e=we(Q0e,{name:"MuiPopper",slot:"Root"})({}),iA=C.forwardRef(function(e,t){const n=di(),r=an({props:e,name:"MuiPopper"}),{anchorEl:o,component:a,components:i,componentsProps:l,container:c,disablePortal:d,keepMounted:f,modifiers:h,open:g,placement:m,popperOptions:v,popperRef:S,transition:E,slots:x,slotProps:w,...T}=r,R=x?.root??i?.Root,D={anchorEl:o,container:c,disablePortal:d,keepMounted:f,modifiers:h,open:g,placement:m,popperOptions:v,popperRef:S,transition:E,...T};return y.jsx(X0e,{as:a,direction:n?"rtl":"ltr",slots:{root:R},slotProps:w??l,...D,ref:t})});function Z0e(e){return Tt("MuiListSubheader",e)}xt("MuiListSubheader",["root","colorPrimary","colorInherit","gutters","inset","sticky"]);const J0e=e=>{const{classes:t,color:n,disableGutters:r,inset:o,disableSticky:a}=e,i={root:["root",n!=="default"&&`color${tt(n)}`,!r&&"gutters",o&&"inset",!a&&"sticky"]};return Et(i,Z0e,t)},e1e=we("li",{name:"MuiListSubheader",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${tt(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(un(({theme:e})=>({boxSizing:"border-box",lineHeight:"48px",listStyle:"none",color:(e.vars||e).palette.text.secondary,fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(14),variants:[{props:{color:"primary"},style:{color:(e.vars||e).palette.primary.main}},{props:{color:"inherit"},style:{color:"inherit"}},{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:t})=>t.inset,style:{paddingLeft:72}},{props:({ownerState:t})=>!t.disableSticky,style:{position:"sticky",top:0,zIndex:1,backgroundColor:(e.vars||e).palette.background.paper}}]}))),xT=C.forwardRef(function(e,t){const n=an({props:e,name:"MuiListSubheader"}),{className:r,color:o="default",component:a="li",disableGutters:i=!1,disableSticky:l=!1,inset:c=!1,...d}=n,f={...n,color:o,component:a,disableGutters:i,disableSticky:l,inset:c},h=J0e(f);return y.jsx(e1e,{as:a,className:ft(h.root,r),ref:t,ownerState:f,...d})});xT&&(xT.muiSkipListHighlight=!0);function t1e(e){return Tt("MuiPaper",e)}xt("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);const n1e=e=>{const{square:t,elevation:n,variant:r,classes:o}=e,a={root:["root",r,!t&&"rounded",r==="elevation"&&`elevation${n}`]};return Et(a,t1e,o)},r1e=we("div",{name:"MuiPaper",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],!n.square&&t.rounded,n.variant==="elevation"&&t[`elevation${n.elevation}`]]}})(un(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,color:(e.vars||e).palette.text.primary,transition:e.transitions.create("box-shadow"),variants:[{props:({ownerState:t})=>!t.square,style:{borderRadius:e.shape.borderRadius}},{props:{variant:"outlined"},style:{border:`1px solid ${(e.vars||e).palette.divider}`}},{props:{variant:"elevation"},style:{boxShadow:"var(--Paper-shadow)",backgroundImage:"var(--Paper-overlay)"}}]}))),Iu=C.forwardRef(function(e,t){const n=an({props:e,name:"MuiPaper"}),r=cc(),{className:o,component:a="div",elevation:i=1,square:l=!1,variant:c="elevation",...d}=n,f={...n,component:a,elevation:i,square:l,variant:c},h=n1e(f);return y.jsx(r1e,{as:a,ownerState:f,className:ft(h.root,o),ref:t,...d,style:{...c==="elevation"&&{"--Paper-shadow":(r.vars||r).shadows[i],...r.vars&&{"--Paper-overlay":r.vars.overlays?.[i]},...!r.vars&&r.palette.mode==="dark"&&{"--Paper-overlay":`linear-gradient(${vv("#fff",WC(i))}, ${vv("#fff",WC(i))})`}},...d.style}})});function o1e(e){return typeof e.main=="string"}function a1e(e,t=[]){if(!o1e(e))return!1;for(const n of t)if(!e.hasOwnProperty(n)||typeof e[n]!="string")return!1;return!0}function Po(e=[]){return([,t])=>t&&a1e(t,e)}function $_(e){try{return e.matches(":focus-visible")}catch{}return!1}const z_={};function A7(e,t){const n=C.useRef(z_);return n.current===z_&&(n.current=e(t)),n}class Nv{static create(){return new Nv}static use(){const t=A7(Nv.create).current,[n,r]=C.useState(!1);return t.shouldMount=n,t.setShouldMount=r,C.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=s1e(),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 i1e(){return Nv.use()}function s1e(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n}function ST(e,t){return ST=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ST(e,t)}function sA(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ST(e,t)}function l1e(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function c1e(e,t){e.classList?e.classList.add(t):l1e(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function U_(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function u1e(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=U_(e.className,t):e.setAttribute("class",U_(e.className&&e.className.baseVal||"",t))}const H_={disabled:!1},Pv=Je.createContext(null);var D7=function(e){return e.scrollTop},Mh="unmounted",zc="exited",Uc="entering",_d="entered",ET="exiting",pi=(function(e){sA(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=zc,a.appearStatus=Uc):c=_d:r.unmountOnExit||r.mountOnEnter?c=Mh:c=zc,a.state={status:c},a.nextCallback=null,a}t.getDerivedStateFromProps=function(r,o){var a=r.in;return a&&o.status===Mh?{status:zc}: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!==Uc&&a!==_d&&(o=Uc):(a===Uc||a===_d)&&(o=ET)}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===Uc){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:Ll.findDOMNode(this);a&&D7(a)}this.performEnter(r)}else this.performExit();else this.props.unmountOnExit&&this.state.status===zc&&this.setState({status:Mh})},n.performEnter=function(r){var o=this,a=this.props.enter,i=this.context?this.context.isMounting:r,l=this.props.nodeRef?[i]:[Ll.findDOMNode(this),i],c=l[0],d=l[1],f=this.getTimeouts(),h=i?f.appear:f.enter;if(!r&&!a||H_.disabled){this.safeSetState({status:_d},function(){o.props.onEntered(c)});return}this.props.onEnter(c,d),this.safeSetState({status:Uc},function(){o.props.onEntering(c,d),o.onTransitionEnd(h,function(){o.safeSetState({status:_d},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:Ll.findDOMNode(this);if(!o||H_.disabled){this.safeSetState({status:zc},function(){r.props.onExited(i)});return}this.props.onExit(i),this.safeSetState({status:ET},function(){r.props.onExiting(i),r.onTransitionEnd(a.exit,function(){r.safeSetState({status:zc},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:Ll.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===Mh)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=Ot(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Je.createElement(Pv.Provider,{value:null},typeof a=="function"?a(r,i):Je.cloneElement(Je.Children.only(a),i))},t})(Je.Component);pi.contextType=Pv;pi.propTypes={};function Rd(){}pi.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Rd,onEntering:Rd,onEntered:Rd,onExit:Rd,onExiting:Rd,onExited:Rd};pi.UNMOUNTED=Mh;pi.EXITED=zc;pi.ENTERING=Uc;pi.ENTERED=_d;pi.EXITING=ET;var d1e=function(e,t){return e&&t&&t.split(" ").forEach(function(n){return c1e(e,n)})},jE=function(e,t){return e&&t&&t.split(" ").forEach(function(n){return u1e(e,n)})},lA=(function(e){sA(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),f=d[0],h=d[1];r.removeClasses(f,"exit"),r.addClass(f,h?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(l,c)},r.onEntering=function(l,c){var d=r.resolveArguments(l,c),f=d[0],h=d[1],g=h?"appear":"enter";r.addClass(f,g,"active"),r.props.onEntering&&r.props.onEntering(l,c)},r.onEntered=function(l,c){var d=r.resolveArguments(l,c),f=d[0],h=d[1],g=h?"appear":"enter";r.removeClasses(f,g),r.addClass(f,g,"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",f=d&&c?c+"-":"",h=d?""+f+l:c[l],g=d?h+"-active":c[l+"Active"],m=d?h+"-done":c[l+"Done"];return{baseClassName:h,activeClassName:g,doneClassName:m}},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&&D7(r),i&&(this.appliedClasses[o][a]=i,d1e(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&&jE(r,i),l&&jE(r,l),c&&jE(r,c)},n.render=function(){var r=this.props;r.classNames;var o=Ot(r,["classNames"]);return Je.createElement(pi,ne({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t})(Je.Component);lA.defaultProps={classNames:""};lA.propTypes={};function f1e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cA(e,t){var n=function(o){return t&&C.isValidElement(o)?t(o):o},r=Object.create(null);return e&&C.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function p1e(e,t){e=e||{},t=t||{};function n(f){return f in t?t[f]:e[f]}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 Zc(e,t,n){return n[t]!=null?n[t]:e.props[t]}function h1e(e,t){return cA(e.children,function(n){return C.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:Zc(n,"appear",e),enter:Zc(n,"enter",e),exit:Zc(n,"exit",e)})})}function m1e(e,t,n){var r=cA(e.children),o=p1e(t,r);return Object.keys(o).forEach(function(a){var i=o[a];if(C.isValidElement(i)){var l=a in t,c=a in r,d=t[a],f=C.isValidElement(d)&&!d.props.in;c&&(!l||f)?o[a]=C.cloneElement(i,{onExited:n.bind(null,i),in:!0,exit:Zc(i,"exit",e),enter:Zc(i,"enter",e)}):!c&&l&&!f?o[a]=C.cloneElement(i,{in:!1}):c&&l&&C.isValidElement(d)&&(o[a]=C.cloneElement(i,{onExited:n.bind(null,i),in:d.props.in,exit:Zc(i,"exit",e),enter:Zc(i,"enter",e)}))}}),o}var g1e=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},y1e={component:"div",childFactory:function(e){return e}},vg=(function(e){sA(t,e);function t(r,o){var a;a=e.call(this,r,o)||this;var i=a.handleExited.bind(f1e(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?h1e(r,i):m1e(r,a,i),firstRender:!1}},n.handleExited=function(r,o){var a=cA(this.props.children);r.key in a||(r.props.onExited&&r.props.onExited(o),this.mounted&&this.setState(function(i){var l=ne({},i.children);return delete l[r.key],{children:l}}))},n.render=function(){var r=this.props,o=r.component,a=r.childFactory,i=Ot(r,["component","childFactory"]),l=this.state.contextValue,c=g1e(this.state.children).map(a);return delete i.appear,delete i.enter,delete i.exit,o===null?Je.createElement(Pv.Provider,{value:l},c):Je.createElement(Pv.Provider,{value:l},Je.createElement(o,i,c))},t})(Je.Component);vg.propTypes={};vg.defaultProps=y1e;const b1e=[];function v1e(e){C.useEffect(e,b1e)}class uA{static create(){return new uA}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 n1(){const e=A7(uA.create).current;return v1e(e.disposeEffect),e}function x1e(e){const{className:t,classes:n,pulsate:r=!1,rippleX:o,rippleY:a,rippleSize:i,in:l,onExited:c,timeout:d}=e,[f,h]=C.useState(!1),g=ft(t,n.ripple,n.rippleVisible,r&&n.ripplePulsate),m={width:i,height:i,top:-(i/2)+a,left:-(i/2)+o},v=ft(n.child,f&&n.childLeaving,r&&n.childPulsate);return!l&&!f&&h(!0),C.useEffect(()=>{if(!l&&c!=null){const S=setTimeout(c,d);return()=>{clearTimeout(S)}}},[c,l,d]),y.jsx("span",{className:g,style:m,children:y.jsx("span",{className:v})})}const Va=xt("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),CT=550,S1e=80,E1e=cs`
326
+ `).length,length:me.target.value.length}))}};return y.jsx($f.Provider,{value:ne({},Y,{dispatch:N}),children:y.jsxs("div",ne({ref:q,className:J},L,{onClick:se,style:ae,children:[y.jsx(T_,{hideToolbar:k,toolbarBottom:_,prefixCls:r,overflow:E,placement:"top"}),y.jsxs("div",{className:r+"-content",children:[/(edit|live)/.test(Y.preview||"")&&y.jsx(cve,ne({className:r+"-input",prefixCls:r,autoFocus:D},w,{onChange:De,renderTextarea:P?.textarea||$,onScroll:me=>te(me,"text")})),/(live|preview)/.test(Y.preview||"")&&de]}),g&&!Y.fullscreen&&y.jsx(dve,{prefixCls:r,height:Y.height,maxHeight:T,minHeight:R,onChange:je}),y.jsx(T_,{hideToolbar:k,toolbarBottom:_,prefixCls:r,overflow:E,placement:"bottom"})]}))})}),d7=hve;d7.Markdown=r7;const LE={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"}]}}},mve={...LE,patterns:[...LE.patterns,{include:"#docvar"}],repository:{...LE.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},gve={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"}]}}},yve="github-light";let FE;function bve(){return FE||(FE=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:a}]=await Promise.all([po(()=>import("./core-CjeTkq8O.es-BqRc6yhC.js"),__vite__mapDeps([0,1])),po(()=>import("./engine-oniguruma-C4vnmooL.es-jdkXmgTr.js"),[]),po(()=>import("./sql-DCkt643-.es-COK4E0Yg.js"),[]),po(()=>import("./json-71t8ZF9g.es-BQoSv7ci.js"),[]),po(()=>import("./typescript-buWNZFwO.es-Dj6nwHGl.js"),[]),po(()=>import("./github-light-JYsPkUQd.es-DAi9KRSo.js"),[])]);return e({engine:t(po(()=>import("./wasm-DQxwEHae.es-CG6Dc4jp.js"),[])),themes:[a],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...mve},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...gve}]})})()),FE}async function Iv(e,t){return(await bve()).codeToHtml(e,{lang:t,theme:yve})}function Do(e){const{server:t}=Yn(),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 HJ(n,Ww)}function ts(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 VJ(t,Ww)}const Dr=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==="projects"?n.projectName=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.projectName)throw new Error(`Failed to parse resource URI: ${e}`);return n},Zk=e=>{if(!e.projectName)throw new Error(`Failed to encode resource URI, missing project name: ${e}`);let t=`publisher://projects/${e.projectName}`;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 f7({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:a}){return Je.useEffect(()=>{o&&o(t)},[t,o]),y.jsx(bk,{children:y.jsxs(GW,{spacing:2,component:"section",children:[y.jsx(xve,{sourceAndPath:e[t],existingQuery:n,onChange:i=>{r&&r(i)},resourceUri:a}),y.jsx(jV,{height:"5px"})]})})}function zb(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function vve({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:a}){const[i,l]=Je.useState(n||zb()),[c,d]=Je.useState(void 0);Je.useEffect(()=>{n&&l(n)},[n]);const[f,h]=Je.useState([]),{MalloyExplorerProvider:g,QueryPanel:m,ResizableCollapsiblePanel:v,ResultPanel:S,SourcePanel:E}=r;Je.useEffect(()=>{t&&t(i)},[t,i]);const{projectName:x,packageName:w,versionId:T}=Dr(a),{apiClients:R}=Yn(),D=ts({mutationFn:()=>{const H=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:()=>{D.reset(),d(void 0)},response:{result:{}}}),l({...i,query:H}),R.models.executeQueryModel(x,w,e.modelPath,{query:H,sourceName:void 0,queryName:void 0,versionId:T})},onSuccess:H=>{if(H){const j=JSON.parse(H.data.result);l({...i,malloyResult:j}),d(z=>z?{...z,executionState:"finished",response:{result:j}}:void 0)}},onError:H=>{d(void 0),console.error("Query execution error:",H)}}),[M,F]=Je.useState(e.sourceInfo.name);Je.useEffect(()=>{M!==e.sourceInfo.name&&(F(e.sourceInfo.name),l(zb()),d(void 0))},[e,M]);const B=Je.useCallback(H=>{l({...i,malloyQuery:H,malloyResult:void 0})},[i]);return M!==e.sourceInfo.name?y.jsx("div",{children:"Loading..."}):y.jsx(z6,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:y.jsx(g,{source:e.sourceInfo,query:i?.malloyQuery,topValues:[],onFocusedNestViewPathChange:h,focusedNestViewPath:f,onQueryChange:B,children:y.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[y.jsx(v,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:y.jsx(E,{onRefresh:()=>l(zb())})}),y.jsx(v,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:y.jsx(m,{runQuery:()=>{console.log(`running query with: ${i?.malloyQuery}`);try{D.mutate()}catch(H){console.error("Error running query:",H)}}})}),y.jsx(S,{source:e.sourceInfo,draftQuery:i?.malloyQuery,setDraftQuery:H=>l({...i,malloyQuery:H}),submittedQuery:c,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function xve(e){const[t,n]=C.useState(null),[r,o]=C.useState(null),[a,i]=C.useState(!0);return C.useEffect(()=>{let l=!0;return Promise.all([po(()=>import("./index-D68X76-7.js"),__vite__mapDeps([2,3,4])),po(()=>import("./index-Bb2jqquW.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?y.jsx(Vie,{children:y.jsx(z6,{children:y.jsx("div",{style:{alignItems:"center",justifyContent:"center",height:"200px",color:"#666"},children:"Loading explorer..."})})}):y.jsx(vve,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}function Lo({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:a=2,textVariant:i="body2"}){const l=y.jsxs(Bt,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:a},children:[y.jsx(s0,{size:t,color:n,thickness:r}),e&&y.jsx(mt,{variant:i,color:"text.secondary",children:e})]});return o?y.jsx(Bt,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:l}):l}const Sve=C.lazy(()=>Promise.resolve().then(()=>KRe));function e1({result:e,maxHeight:t,maxResultSize:n=0}){const r=C.useRef(null),[o,a]=C.useState(t),[i,l]=C.useState(!1);if(!e)return null;if(n>0&&e.length>n&&!i)return y.jsxs(Bt,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[y.jsx(Hte,{sx:{fontSize:48,color:"#757575"}}),y.jsx(mt,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),y.jsx(Sa,{variant:"contained",color:"primary",onClick:()=>l(!0),children:"Proceed"})]});const c=y.jsx(Lo,{text:"Loading...",centered:!0,size:32}),d=Math.min(t,o);return y.jsx(Bt,{ref:r,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden"},children:e&&y.jsx(C.Suspense,{fallback:c,children:y.jsx(Sve,{result:e,height:d,onSizeChange:a})})})}function Eve({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 y.jsx(f7,{resourceUri:n,sourceAndPaths:t,selectedSourceIndex:i>=0?i:0,existingQuery:a,onQueryChange:r,onSourceChange:o})}function Cve({cell:e,editingMalloy:t,editingMarkdown:n,sourceAndPaths:r,resourceUri:o,onCellChange:a,onClose:i,onEdit:l,onDelete:c,addButtonCallback:d}){const[f,h]=C.useState(e.value),[g,m]=Je.useState(!1),[v,S]=Je.useState(!1),[E,x]=Je.useState(),[w]=Je.useState(),[T,R]=Je.useState(zb()),[D,M]=Je.useState(!1),[F,B]=Je.useState(e.sourceName?r.findIndex(q=>q.sourceInfo.name===e.sourceName):0);C.useEffect(()=>{e.isMarkdown||Iv(e.value,"malloy").then(q=>{x(q)})},[e]),Je.useEffect(()=>{document.documentElement.setAttribute("data-color-mode","light")});const[H,j]=C.useState(!1),z=()=>{c(),j(!1)},k=r.length===0,_=Je.useCallback(()=>{const q=r[F],K=q?.modelPath||e.modelPath||"",U=q?.sourceInfo.name||e.sourceName||"";a({...e,value:e.isMarkdown?f:T.query,result:T.malloyResult?JSON.stringify(T.malloyResult):void 0,queryInfo:T.malloyQuery?JSON.stringify(T.malloyQuery):void 0,sourceName:U,modelPath:K})},[e,f,T,a,F,r]),P=y.jsx(ma,{title:"Delete Cell",children:y.jsx(kr,{size:"small",onClick:()=>j(!0),children:y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:y.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"})})})}),$=y.jsxs(Ql,{open:H,onClose:()=>j(!1),children:[y.jsx(Zl,{children:"Confirm Delete"}),y.jsx(Xl,{children:y.jsx(mt,{children:"Are you sure you want to delete this cell?"})}),y.jsxs(P4,{children:[y.jsx(Sa,{onClick:()=>j(!1),children:"Cancel"}),y.jsx(Sa,{onClick:z,color:"error",children:"Delete"})]})]}),L=()=>{_(),i()},G=e.isMarkdown?y.jsxs(y.Fragment,{children:[n?y.jsx(ma,{title:"Save",children:y.jsx(kr,{size:"small",onClick:L,children:y.jsx(Zy,{})})}):y.jsx(ma,{title:"Edit",children:y.jsx(kr,{size:"small",onClick:l,children:y.jsx(WN,{})})}),!n&&P]}):y.jsxs(y.Fragment,{children:[!t&&y.jsx(ma,{title:g?"Hide Code":"View Code",children:y.jsx(kr,{size:"small",onClick:()=>{m(!g)},children:y.jsx(U6,{})})}),!t&&e.result&&y.jsx(ma,{title:v?"Hide Embedding":"View Embedding",children:y.jsx(kr,{size:"small",onClick:()=>{S(!v)},children:y.jsx(vk,{})})}),t&&y.jsx(ma,{title:"Save",children:y.jsx(kr,{size:"small",onClick:L,children:y.jsx(Zy,{})})}),!t&&y.jsx(ma,{title:"Edit",children:y.jsx(kr,{size:"small",onClick:l,children:y.jsx(WN,{})})}),!t&&P]}),V=t||n,Y=n?y.jsx(ma,{title:"Save",children:y.jsx(kr,{size:"small",onClick:L,children:y.jsx(Zy,{})})}):t?y.jsx(ma,{title:"Save",children:y.jsx(kr,{size:"small",onClick:L,children:y.jsx(Zy,{})})}):null,N=D&&y.jsx(Bt,{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:!V&&y.jsxs(y.Fragment,{children:[d(!0),d(!1),G]})||Y});return y.jsxs(Sv,{sx:{position:"relative",marginTop:"5px",marginBottom:"5px",borderWidth:"1.5px",backgroundColor:"#fff",minHeight:"50px"},onMouseEnter:()=>M(!0),onMouseLeave:()=>{M(!1)},children:[N,e.isMarkdown?y.jsx(y.Fragment,{children:n?y.jsx(d7,{value:f,preview:"edit",autoFocus:!0,onChange:q=>{h(q),a({...e,value:q})},onBlur:()=>{_(),D||L()}}):y.jsx(Bt,{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?y.jsx(Bt,{onClick:l,sx:{cursor:"pointer"},children:y.jsx(pv,{children:e.value})}):y.jsxs(Bt,{onClick:l,sx:{cursor:"pointer"},children:[y.jsx(mt,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Markdown is empty"}),y.jsx(mt,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})})}):y.jsxs(y.Fragment,{children:[y.jsx(nv,{in:v,timeout:"auto",unmountOnExit:!0,children:y.jsx(io,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:y.jsx(mt,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:w}})})}),y.jsx(nv,{in:g,timeout:"auto",unmountOnExit:!0,children:y.jsx(io,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:y.jsx(mt,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:E}})})}),t&&(k?y.jsxs(y.Fragment,{children:[y.jsx(mt,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"No Model Imports"}),y.jsx(mt,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Please add a model import above."})]}):y.jsx(Eve,{sourceAndPaths:r,resourceUri:o,onQueryChange:q=>{R(q)},onSourceChange:q=>{B(q)},cell:e})),!t&&e.result&&y.jsx(Sv,{variant:"outlined",sx:{borderRadius:0},children:y.jsx(e1,{result:e.result,maxHeight:800})}),!t&&!e.result&&y.jsxs(Bt,{onClick:l,sx:{cursor:"pointer"},children:[y.jsx(mt,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Explore is empty"}),y.jsx(mt,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})]}),H&&$]})}const p7=C.createContext(void 0);function Tve({children:e,workbookStorage:t}){const n=C.useMemo(()=>({workbookStorage:t}),[t]);return y.jsx(p7.Provider,{value:n,children:e})}function wve(){const e=C.useContext(p7);if(!e)throw new Error("useWorkbookStorage must be used within a WorkbookStorageProvider");return e}const tc=dn(y.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"})),kve=dn(y.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 wo({error:e,context:t}){const n=e.data?.message||"Unknown Error";return y.jsxs(y.Fragment,{children:[t&&y.jsx(mt,{variant:"body2",sx:{p:"10px",m:"auto"},children:t}),y.jsx("pre",{style:{whiteSpace:"pre-wrap",color:"red",padding:"10px",margin:"auto"},children:n})]})}function Ave({initialSelectedModels:e,onModelChange:t,resourceUri:n}){const{projectName:r,packageName:o,versionId:a}=Dr(n),{apiClients:i}=Yn(),{data:l,isLoading:c,isSuccess:d,isError:f,error:h}=Do({queryKey:["models",r,o,a],queryFn:()=>i.models.listModels(r,o,a)}),[g,m]=Je.useState(e||[]),[v,S]=Je.useState(null);Je.useEffect(()=>{m(e||[])},[e]);const E=T=>{const R=g.filter(D=>D!==T);m(R),t(R)},x=T=>{const R=[...g,T];m(R),t(R),S(null)};let w=[];return d&&l?.data&&(w=l.data.filter(T=>!g.includes(T.path)).map(T=>T.path)),f?y.jsx(wo,{error:h,context:`${r} > ${o} > Model Picker`}):y.jsxs(y.Fragment,{children:[y.jsxs(_4,{fullWidth:!0,children:[c&&y.jsx(mt,{children:"Loading..."}),y.jsxs(io,{direction:"row",spacing:1,children:[g.map(T=>y.jsx(Eb,{label:T,onDelete:()=>E(T),deleteIcon:y.jsx(tc,{}),sx:{marginBottom:"5px"}},T)),y.jsx(Sa,{size:"small",startIcon:y.jsx(kve,{}),onClick:T=>S(T.currentTarget),disabled:c||f||w.length===0,children:"Add Model"})]})]}),y.jsxs(eg,{anchorEl:v,open:!!v,onClose:()=>S(null),children:[y.jsx(mt,{variant:"subtitle2",sx:{ml:1},children:"Models"}),y.jsx(os,{}),w.length===0?y.jsx(Jl,{disabled:!0,children:"No models available"}):w.map(T=>y.jsx(Jl,{onClick:()=>x(T),children:y.jsx(mt,{variant:"body2",children:T})},T))]})]})}function Dve(){const e=h3();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 $Me({workbookPath:e,resourceUri:t}){const n=Dve(),{server:r,getAccessToken:o}=Yn(),{apiClients:a}=Yn(),{workbookStorage:i}=wve(),{projectName:l,packageName:c}=Dr(t),[d,f]=Je.useState(void 0),[h,g]=Je.useState(void 0);if(!i)throw new Error("Workbook storage be provided via WorkbookStorageProvider");const[m,v]=Je.useState(),[S,E]=Je.useState(),[x,w]=Je.useState(),[T,R]=Je.useState([]),[D,M]=Je.useState(null),[F,B]=Je.useState(null),H=!!D,j=()=>{M(null),B(null)},z=(q,K)=>{m&&(v(m.insertCell(K,{isMarkdown:q,value:""})),q?w(K):E(K),j(),console.log("handleAddCell",q,K))},[k,_]=Je.useState(!1),P=()=>{_(!0)},$=async()=>{e&&i&&await i.deleteWorkbook(e).then(()=>{g(void 0),f(void 0)}).catch(q=>{g(`Error deleting workbook: ${q.message}`),f(void 0)}),_(!1),n(`/${l}/${c}`)},L=()=>{_(!1)},G=Je.useCallback(async()=>{if(!m){console.log("No workbook data ref");return}try{v(await m.saveWorkbook()),g(void 0),f("Workbook saved")}catch(q){g(`Error saving workbook: ${q.message}`),f(void 0)}},[m]);if(Je.useEffect(()=>{m&&(async()=>{const q=new Map(T.map(({modelPath:J,sourceInfos:Z})=>[J,Z])),K=[],U=[];for(const J of m.getModels())q.has(J)?K.push({modelPath:J,sourceInfos:q.get(J)}):(console.log("Fetching model from Publisher",J),U.push(a.models.getModel(l,c,J,void 0).then(Z=>({modelPath:J,sourceInfos:Z.data.sourceInfos.map(Q=>JSON.parse(Q))}))));if(U.length>0){const J=await Promise.all(U);R([...K,...J])}else R(K)})()},[o,m,c,l,r]),Je.useEffect(()=>{e&&Vh.loadWorkbook(i,e).then(q=>{v(q)})},[e,i]),!m)return y.jsx("div",{children:"Loading..."});const V=q=>{const K=[];for(const U of q)for(const J of U.sourceInfos)K.push({modelPath:U.modelPath,sourceInfo:J});return K},Y=(q,K)=>y.jsx(Sa,{size:"small",startIcon:y.jsx(yk,{}),onClick:()=>z(q,K),variant:"contained",sx:{backgroundColor:"#fff",color:U=>U.palette.mode==="dark"?U.palette.grey[100]:U.palette.grey[700],boxShadow:"none","&:hover":{backgroundColor:U=>U.palette.mode==="dark"?U.palette.grey[500]:U.palette.grey[300],boxShadow:"none"}},children:q?"Markdown":"Explore"}),N=y.jsxs(Bt,{sx:{display:"flex",gap:1,justifyContent:"center",flex:2},children:[Y(!1,m.getCells().length),Y(!0,m.getCells().length)]});return y.jsxs(Sv,{variant:"outlined",children:[y.jsxs($6,{children:[y.jsx(Bt,{sx:{mb:2},children:y.jsx(Bt,{sx:{minHeight:"24px"},children:h?y.jsx(mt,{color:"error",variant:"body2",children:h}):d?y.jsx(mt,{color:"success",variant:"body2",children:d}):y.jsx("span",{children:" "})})}),y.jsxs(wd,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[y.jsxs(wd,{direction:"row",spacing:1,alignItems:"center",children:[y.jsx(mt,{variant:"overline",sx:{fontSize:"13px",fontWeight:"bold",verticalAlign:"middle"},children:"Workbook"}),y.jsx(mt,{variant:"subtitle2",sx:{fontSize:"13px",fontWeight:"normal",verticalAlign:"middle",ml:1},children:`${e.workspace} > ${e.path}`})]}),y.jsxs(wd,{sx:{display:"flex",flexDirection:"row",gap:1},children:[y.jsx(Bt,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:y.jsx(Rve,{workbookData:m})}),y.jsxs(Bt,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:[y.jsx(Sa,{color:"error",onClick:P,size:"small",children:"Delete"}),y.jsxs(Ql,{open:k,onClose:L,children:[y.jsx(Zl,{children:"Delete Workbook"}),y.jsx(Xl,{children:y.jsxs(AQ,{children:['Are you sure you want to delete the workbook "',e.path,'"? This action cannot be undone.']})}),y.jsxs(P4,{children:[y.jsx(Sa,{onClick:L,color:"primary",size:"small",children:"Cancel"}),y.jsx(Sa,{onClick:$,color:"error",autoFocus:!0,size:"small",children:"Delete"})]})]})]})]})]}),y.jsx(os,{}),y.jsxs(wd,{sx:{display:"flex",flexDirection:"row",width:"100%",mt:2},children:[y.jsx(Bt,{sx:{flex:1},children:y.jsx(Ave,{initialSelectedModels:m.getModels(),onModelChange:q=>{v(m.setModels(q)),G()},resourceUri:t})}),y.jsx(Bt,{sx:{flex:1}})]})]}),y.jsx(bk,{children:y.jsxs(wd,{children:[m.getCells().length===0&&y.jsxs(y.Fragment,{children:[y.jsx(mt,{sx:{textAlign:"center",p:2,variant:"subtitle2",fontWeight:"medium"},children:"Workbook is empty"}),y.jsx(mt,{variant:"body2",sx:{textAlign:"center",mb:2,variant:"body2"},children:"Click the + buttons to add a markdown or code cell."})]}),m.getCells().map((q,K)=>y.jsx(Je.Fragment,{children:y.jsx(Cve,{cell:q,resourceUri:t,addButtonCallback:U=>Y(U,K),sourceAndPaths:V(T),editingMarkdown:x===K,editingMalloy:S===K,onDelete:()=>{v(m.deleteCell(K)),G()},onCellChange:U=>{v(m.setCell(K,U))},onEdit:()=>{q.isMarkdown?w(K):E(K)},onClose:()=>{q.isMarkdown?w(void 0):E(void 0),G()}},`${K}-${q.isMarkdown}-${e.workspace}-${e.path}`)},`${K}-${m.getCells().length}`)),N,y.jsxs(eg,{anchorEl:D,open:H,onClose:j,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[y.jsx(Jl,{onClick:()=>z(!0,F??0),children:"Add Markdown"}),y.jsx(Jl,{onClick:()=>z(!1,F??0),children:"Add Malloy"})]}),y.jsx(wd,{sx:{flexDirection:"row",justifyContent:"flex-end",p:1}})]})})]})}function Rve({workbookData:e}){const[t,n]=Je.useState(!1);return y.jsx(Sa,{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 w_="Local";class Mve{async listWorkspaces(t){return Promise.resolve([{name:w_,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:w_})}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)}}const Ive=e=>{const t=C.useRef({});return C.useEffect(()=>{t.current=e}),t.current};function k_({array1:e,array2:t,parser:n=r=>r}){return e&&t&&e.length===t.length&&e.every((r,o)=>n(r)===n(t[o]))}function A_(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Ove(e={}){const{ignoreAccents:t=!0,ignoreCase:n=!0,limit:r,matchFrom:o="any",stringify:a,trim:i=!1}=e;return(l,{inputValue:c,getOptionLabel:d})=>{let f=i?c.trim():c;n&&(f=f.toLowerCase()),t&&(f=A_(f));const h=f?l.filter(g=>{let m=(a||d)(g);return n&&(m=m.toLowerCase()),t&&(m=A_(m)),o==="start"?m.startsWith(f):m.includes(f)}):l;return typeof r=="number"?h.slice(0,r):h}}const Nve=Ove(),D_=5,Pve=e=>e.current!==null&&e.current.parentElement?.contains(document.activeElement),_ve=[];function R_(e,t,n,r){if(t||e==null||r)return"";const o=n(e);return typeof o=="string"?o:""}function Lve(e){const{unstable_isActiveElementInListbox:t=Pve,unstable_classNamePrefix:n="Mui",autoComplete:r=!1,autoHighlight:o=!1,autoSelect:a=!1,blurOnSelect:i=!1,clearOnBlur:l=!e.freeSolo,clearOnEscape:c=!1,componentName:d="useAutocomplete",defaultValue:f=e.multiple?_ve:null,disableClearable:h=!1,disableCloseOnSelect:g=!1,disabled:m,disabledItemsFocusable:v=!1,disableListWrap:S=!1,filterOptions:E=Nve,filterSelectedOptions:x=!1,freeSolo:w=!1,getOptionDisabled:T,getOptionKey:R,getOptionLabel:D=Re=>Re.label??Re,groupBy:M,handleHomeEndKeys:F=!e.freeSolo,id:B,includeInputInList:H=!1,inputValue:j,isOptionEqualToValue:z=(Re,Oe)=>Re===Oe,multiple:k=!1,onChange:_,onClose:P,onHighlightChange:$,onInputChange:L,onOpen:G,open:V,openOnFocus:Y=!1,options:N,readOnly:q=!1,renderValue:K,selectOnFocus:U=!e.freeSolo,value:J}=e,Z=Ri(B);let Q=D;Q=Re=>{const Oe=D(Re);return typeof Oe!="string"?String(Oe):Oe};const re=C.useRef(!1),te=C.useRef(!0),ue=C.useRef(null),fe=C.useRef(null),[de,xe]=C.useState(null),[ae,se]=C.useState(-1),je=o?0:-1,De=C.useRef(je),me=C.useRef(R_(f??J,k,Q)).current,[ve,Xe]=Ta({controlled:J,default:f,name:d}),[Be,Ue]=Ta({controlled:j,default:me,name:d,state:"inputValue"}),[He,Rt]=C.useState(!1),Mt=C.useCallback((Re,Oe,ut)=>{if(!(k?ve.length<Oe.length:Oe!==null)&&!l)return;const Nt=R_(Oe,k,Q,K);Be!==Nt&&(Ue(Nt),L&&L(Re,Nt,ut))},[Q,Be,k,L,Ue,l,ve,K]),[bt,ge]=Ta({controlled:V,default:!1,name:d,state:"open"}),[Ee,Ge]=C.useState(!0),st=!k&&ve!=null&&Be===Q(ve),ot=bt&&!q,Ye=ot?E(N.filter(Re=>!(x&&(k?ve:[ve]).some(Oe=>Oe!==null&&z(Re,Oe)))),{inputValue:st&&Ee?"":Be,getOptionLabel:Q}):[],zt=Ive({filteredOptions:Ye,value:ve,inputValue:Be});C.useEffect(()=>{const Re=ve!==zt.value;He&&!Re||w&&!Re||Mt(null,ve,"reset")},[ve,Mt,He,zt.value,w]);const Gt=bt&&Ye.length>0&&!q,rt=dt(Re=>{if(Re===-1)ue.current.focus();else{const Oe=K?"data-item-index":"data-tag-index";de.querySelector(`[${Oe}="${Re}"]`).focus()}});C.useEffect(()=>{k&&ae>ve.length-1&&(se(-1),rt(-1))},[ve,k,ae,rt]);function he(Re,Oe){if(!fe.current||Re<0||Re>=Ye.length)return-1;let ut=Re;for(;;){const Nt=fe.current.querySelector(`[data-option-index="${ut}"]`),$t=v?!1:!Nt||Nt.disabled||Nt.getAttribute("aria-disabled")==="true";if(Nt&&Nt.hasAttribute("tabindex")&&!$t)return ut;if(Oe==="next"?ut=(ut+1)%Ye.length:ut=(ut-1+Ye.length)%Ye.length,ut===Re)return-1}}const Se=dt(({event:Re,index:Oe,reason:ut})=>{if(De.current=Oe,Oe===-1?ue.current.removeAttribute("aria-activedescendant"):ue.current.setAttribute("aria-activedescendant",`${Z}-option-${Oe}`),$&&["mouse","keyboard","touch"].includes(ut)&&$(Re,Oe===-1?null:Ye[Oe],ut),!fe.current)return;const Nt=fe.current.querySelector(`[role="option"].${n}-focused`);Nt&&(Nt.classList.remove(`${n}-focused`),Nt.classList.remove(`${n}-focusVisible`));let $t=fe.current;if(fe.current.getAttribute("role")!=="listbox"&&($t=fe.current.parentElement.querySelector('[role="listbox"]')),!$t)return;if(Oe===-1){$t.scrollTop=0;return}const Nn=fe.current.querySelector(`[data-option-index="${Oe}"]`);if(Nn&&(Nn.classList.add(`${n}-focused`),ut==="keyboard"&&Nn.classList.add(`${n}-focusVisible`),$t.scrollHeight>$t.clientHeight&&ut!=="mouse"&&ut!=="touch")){const or=Nn,go=$t.clientHeight+$t.scrollTop,Qt=or.offsetTop+or.offsetHeight;Qt>go?$t.scrollTop=Qt-$t.clientHeight:or.offsetTop-or.offsetHeight*(M?1.3:0)<$t.scrollTop&&($t.scrollTop=or.offsetTop-or.offsetHeight*(M?1.3:0))}}),lt=dt(({event:Re,diff:Oe,direction:ut="next",reason:Nt})=>{if(!ot)return;const $t=he((()=>{const Nn=Ye.length-1;if(Oe==="reset")return je;if(Oe==="start")return 0;if(Oe==="end")return Nn;const or=De.current+Oe;return or<0?or===-1&&H?-1:S&&De.current!==-1||Math.abs(Oe)>1?0:Nn:or>Nn?or===Nn+1&&H?-1:S||Math.abs(Oe)>1?Nn:0:or})(),ut);if(Se({index:$t,reason:Nt,event:Re}),r&&Oe!=="reset")if($t===-1)ue.current.value=Be;else{const Nn=Q(Ye[$t]);ue.current.value=Nn,Nn.toLowerCase().indexOf(Be.toLowerCase())===0&&Be.length>0&&ue.current.setSelectionRange(Be.length,Nn.length)}}),nt=!k_({array1:zt.filteredOptions,array2:Ye,parser:Q}),tn=()=>{const Re=(Oe,ut)=>{const Nt=Oe?Q(Oe):"",$t=ut?Q(ut):"";return Nt===$t};if(De.current!==-1&&!k_({array1:zt.filteredOptions,array2:Ye,parser:Q})&&zt.inputValue===Be&&(k?ve.length===zt.value.length&&zt.value.every((Oe,ut)=>Q(ve[ut])===Q(Oe)):Re(zt.value,ve))){const Oe=zt.filteredOptions[De.current];if(Oe)return Ye.findIndex(ut=>Q(ut)===Q(Oe))}return-1},_n=C.useCallback(()=>{if(!ot)return;const Re=tn();if(Re!==-1){De.current=Re;return}const Oe=k?ve[0]:ve;if(Ye.length===0||Oe==null){lt({diff:"reset"});return}if(fe.current){if(Oe!=null){const ut=Ye[De.current];if(k&&ut&&ve.findIndex($t=>z(ut,$t))!==-1)return;const Nt=Ye.findIndex($t=>z($t,Oe));Nt===-1?lt({diff:"reset"}):Se({index:Nt});return}if(De.current>=Ye.length-1){Se({index:Ye.length-1});return}Se({index:De.current})}},[Ye.length,k?!1:ve,x,lt,Se,ot,Be,k]),$n=dt(Re=>{GC(fe,Re),Re&&_n()});C.useEffect(()=>{nt&&_n()},[_n,nt]);const Kn=Re=>{bt||(ge(!0),Ge(!0),G&&G(Re))},lr=(Re,Oe)=>{bt&&(ge(!1),P&&P(Re,Oe))},mr=(Re,Oe,ut,Nt)=>{if(k){if(ve.length===Oe.length&&ve.every(($t,Nn)=>$t===Oe[Nn]))return}else if(ve===Oe)return;_&&_(Re,Oe,ut,Nt),Xe(Oe)},On=C.useRef(!1),Cr=(Re,Oe,ut="selectOption",Nt="options")=>{let $t=ut,Nn=Oe;if(k){Nn=Array.isArray(ve)?ve.slice():[];const or=Nn.findIndex(go=>z(Oe,go));or===-1?Nn.push(Oe):Nt!=="freeSolo"&&(Nn.splice(or,1),$t="removeOption")}Mt(Re,Nn,$t),mr(Re,Nn,$t,{option:Oe}),!g&&(!Re||!Re.ctrlKey&&!Re.metaKey)&&lr(Re,$t),(i===!0||i==="touch"&&On.current||i==="mouse"&&!On.current)&&ue.current.blur()};function It(Re,Oe){if(Re===-1)return-1;let ut=Re;for(;;){if(Oe==="next"&&ut===ve.length||Oe==="previous"&&ut===-1)return-1;const Nt=K?"data-item-index":"data-tag-index",$t=de.querySelector(`[${Nt}="${ut}"]`);if(!$t||!$t.hasAttribute("tabindex")||$t.disabled||$t.getAttribute("aria-disabled")==="true")ut+=Oe==="next"?1:-1;else return ut}}const le=(Re,Oe)=>{if(!k)return;Be===""&&lr(Re,"toggleInput");let ut=ae;ae===-1?Be===""&&Oe==="previous"&&(ut=ve.length-1):(ut+=Oe==="next"?1:-1,ut<0&&(ut=0),ut===ve.length&&(ut=-1)),ut=It(ut,Oe),se(ut),rt(ut)},be=Re=>{re.current=!0,Ue(""),L&&L(Re,"","clear"),mr(Re,k?[]:null,"clear")},Ae=Re=>Oe=>{if(Re.onKeyDown&&Re.onKeyDown(Oe),!Oe.defaultMuiPrevented&&(ae!==-1&&!["ArrowLeft","ArrowRight"].includes(Oe.key)&&(se(-1),rt(-1)),Oe.which!==229))switch(Oe.key){case"Home":ot&&F&&(Oe.preventDefault(),lt({diff:"start",direction:"next",reason:"keyboard",event:Oe}));break;case"End":ot&&F&&(Oe.preventDefault(),lt({diff:"end",direction:"previous",reason:"keyboard",event:Oe}));break;case"PageUp":Oe.preventDefault(),lt({diff:-D_,direction:"previous",reason:"keyboard",event:Oe}),Kn(Oe);break;case"PageDown":Oe.preventDefault(),lt({diff:D_,direction:"next",reason:"keyboard",event:Oe}),Kn(Oe);break;case"ArrowDown":Oe.preventDefault(),lt({diff:1,direction:"next",reason:"keyboard",event:Oe}),Kn(Oe);break;case"ArrowUp":Oe.preventDefault(),lt({diff:-1,direction:"previous",reason:"keyboard",event:Oe}),Kn(Oe);break;case"ArrowLeft":!k&&K?rt(0):le(Oe,"previous");break;case"ArrowRight":!k&&K?rt(-1):le(Oe,"next");break;case"Enter":if(De.current!==-1&&ot){const ut=Ye[De.current],Nt=T?T(ut):!1;if(Oe.preventDefault(),Nt)return;Cr(Oe,ut,"selectOption"),r&&ue.current.setSelectionRange(ue.current.value.length,ue.current.value.length)}else w&&Be!==""&&st===!1&&(k&&Oe.preventDefault(),Cr(Oe,Be,"createOption","freeSolo"));break;case"Escape":ot?(Oe.preventDefault(),Oe.stopPropagation(),lr(Oe,"escape")):c&&(Be!==""||k&&ve.length>0||K)&&(Oe.preventDefault(),Oe.stopPropagation(),be(Oe));break;case"Backspace":if(k&&!q&&Be===""&&ve.length>0){const ut=ae===-1?ve.length-1:ae,Nt=ve.slice();Nt.splice(ut,1),mr(Oe,Nt,"removeOption",{option:ve[ut]})}!k&&K&&!q&&(Xe(null),rt(-1));break;case"Delete":if(k&&!q&&Be===""&&ve.length>0&&ae!==-1){const ut=ae,Nt=ve.slice();Nt.splice(ut,1),mr(Oe,Nt,"removeOption",{option:ve[ut]})}!k&&K&&!q&&(Xe(null),rt(-1));break}},Ve=Re=>{Rt(!0),Y&&!re.current&&Kn(Re)},Ze=Re=>{if(t(fe)){ue.current.focus();return}Rt(!1),te.current=!0,re.current=!1,a&&De.current!==-1&&ot?Cr(Re,Ye[De.current],"blur"):a&&w&&Be!==""?Cr(Re,Be,"blur","freeSolo"):l&&Mt(Re,ve,"blur"),lr(Re,"blur")},St=Re=>{const Oe=Re.target.value;Be!==Oe&&(Ue(Oe),Ge(!1),L&&L(Re,Oe,"input")),Oe===""?!h&&!k&&mr(Re,null,"clear"):Kn(Re)},kt=Re=>{const Oe=Number(Re.currentTarget.getAttribute("data-option-index"));De.current!==Oe&&Se({event:Re,index:Oe,reason:"mouse"})},Ct=Re=>{Se({event:Re,index:Number(Re.currentTarget.getAttribute("data-option-index")),reason:"touch"}),On.current=!0},At=Re=>{const Oe=Number(Re.currentTarget.getAttribute("data-option-index"));Cr(Re,Ye[Oe],"selectOption"),On.current=!1},yt=Re=>Oe=>{const ut=ve.slice();ut.splice(Re,1),mr(Oe,ut,"removeOption",{option:ve[Re]})},pt=Re=>{mr(Re,null,"removeOption",{option:ve})},vt=Re=>{bt?lr(Re,"toggleInput"):Kn(Re)},Xt=Re=>{Re.currentTarget.contains(Re.target)&&Re.target.getAttribute("id")!==Z&&Re.preventDefault()},Dn=Re=>{Re.currentTarget.contains(Re.target)&&(ue.current.focus(),U&&te.current&&ue.current.selectionEnd-ue.current.selectionStart===0&&ue.current.select(),te.current=!1)},Qn=Re=>{!m&&(Be===""||!bt)&&vt(Re)};let Xn=w&&Be.length>0;Xn=Xn||(k?ve.length>0:ve!==null);let Yt=Ye;return M&&(Yt=Ye.reduce((Re,Oe,ut)=>{const Nt=M(Oe);return Re.length>0&&Re[Re.length-1].group===Nt?Re[Re.length-1].options.push(Oe):Re.push({key:ut,index:ut,group:Nt,options:[Oe]}),Re},[])),m&&He&&Ze(),{getRootProps:(Re={})=>({...Re,onKeyDown:Ae(Re),onMouseDown:Xt,onClick:Dn}),getInputLabelProps:()=>({id:`${Z}-label`,htmlFor:Z}),getInputProps:()=>({id:Z,value:Be,onBlur:Ze,onFocus:Ve,onChange:St,onMouseDown:Qn,"aria-activedescendant":ot?"":null,"aria-autocomplete":r?"both":"list","aria-controls":Gt?`${Z}-listbox`:void 0,"aria-expanded":Gt,autoComplete:"off",ref:ue,autoCapitalize:"none",spellCheck:"false",role:"combobox",disabled:m}),getClearProps:()=>({tabIndex:-1,type:"button",onClick:be}),getItemProps:({index:Re=0}={})=>({...k&&{key:Re},...K?{"data-item-index":Re}:{"data-tag-index":Re},tabIndex:-1,...!q&&{onDelete:k?yt(Re):pt}}),getPopupIndicatorProps:()=>({tabIndex:-1,type:"button",onClick:vt}),getTagProps:({index:Re})=>({key:Re,"data-tag-index":Re,tabIndex:-1,...!q&&{onDelete:yt(Re)}}),getListboxProps:()=>({role:"listbox",id:`${Z}-listbox`,"aria-labelledby":`${Z}-label`,ref:$n,onMouseDown:Re=>{Re.preventDefault()}}),getOptionProps:({index:Re,option:Oe})=>{const ut=(k?ve:[ve]).some($t=>$t!=null&&z(Oe,$t)),Nt=T?T(Oe):!1;return{key:R?.(Oe)??Q(Oe),tabIndex:-1,role:"option",id:`${Z}-option-${Re}`,onMouseMove:kt,onClick:At,onTouchStart:Ct,"data-option-index":Re,"aria-disabled":Nt,"aria-selected":ut}},id:Z,inputValue:Be,value:ve,dirty:Xn,expanded:ot&&de,popupOpen:ot,focused:He||ae!==-1,anchorEl:de,setAnchorEl:xe,focusedItem:ae,focusedTag:ae,groupedOptions:Yt}}const h7=Pe.oneOfType([Pe.func,Pe.object]);var ta="top",ii="bottom",si="right",na="left",Jk="auto",yg=[ta,ii,si,na],yf="start",Pm="end",Fve="clippingParents",m7="viewport",fh="popper",jve="reference",M_=yg.reduce(function(e,t){return e.concat([t+"-"+yf,t+"-"+Pm])},[]),g7=[].concat(yg,[Jk]).reduce(function(e,t){return e.concat([t,t+"-"+yf,t+"-"+Pm])},[]),Bve="beforeRead",$ve="read",zve="afterRead",Uve="beforeMain",Hve="main",Vve="afterMain",Wve="beforeWrite",qve="write",Gve="afterWrite",Yve=[Bve,$ve,zve,Uve,Hve,Vve,Wve,qve,Gve];function is(e){return e?(e.nodeName||"").toLowerCase():null}function Da(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function yu(e){var t=Da(e).Element;return e instanceof t||e instanceof Element}function ti(e){var t=Da(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function eA(e){if(typeof ShadowRoot>"u")return!1;var t=Da(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Kve(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},a=t.elements[n];!ti(a)||!is(a)||(Object.assign(a.style,r),Object.keys(o).forEach(function(i){var l=o[i];l===!1?a.removeAttribute(i):a.setAttribute(i,l===!0?"":l)}))})}function Qve(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],a=t.attributes[r]||{},i=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),l=i.reduce(function(c,d){return c[d]="",c},{});!ti(o)||!is(o)||(Object.assign(o.style,l),Object.keys(a).forEach(function(c){o.removeAttribute(c)}))})}}const Xve={name:"applyStyles",enabled:!0,phase:"write",fn:Kve,effect:Qve,requires:["computeStyles"]};function ns(e){return e.split("-")[0]}var ou=Math.max,Ov=Math.min,bf=Math.round;function yT(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function y7(){return!/^((?!chrome|android).)*safari/i.test(yT())}function vf(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,a=1;t&&ti(e)&&(o=e.offsetWidth>0&&bf(r.width)/e.offsetWidth||1,a=e.offsetHeight>0&&bf(r.height)/e.offsetHeight||1);var i=yu(e)?Da(e):window,l=i.visualViewport,c=!y7()&&n,d=(r.left+(c&&l?l.offsetLeft:0))/o,f=(r.top+(c&&l?l.offsetTop:0))/a,h=r.width/o,g=r.height/a;return{width:h,height:g,top:f,right:d+h,bottom:f+g,left:d,x:d,y:f}}function tA(e){var t=vf(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function b7(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&eA(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Ks(e){return Da(e).getComputedStyle(e)}function Zve(e){return["table","td","th"].indexOf(is(e))>=0}function pc(e){return((yu(e)?e.ownerDocument:e.document)||window.document).documentElement}function t1(e){return is(e)==="html"?e:e.assignedSlot||e.parentNode||(eA(e)?e.host:null)||pc(e)}function I_(e){return!ti(e)||Ks(e).position==="fixed"?null:e.offsetParent}function Jve(e){var t=/firefox/i.test(yT()),n=/Trident/i.test(yT());if(n&&ti(e)){var r=Ks(e);if(r.position==="fixed")return null}var o=t1(e);for(eA(o)&&(o=o.host);ti(o)&&["html","body"].indexOf(is(o))<0;){var a=Ks(o);if(a.transform!=="none"||a.perspective!=="none"||a.contain==="paint"||["transform","perspective"].indexOf(a.willChange)!==-1||t&&a.willChange==="filter"||t&&a.filter&&a.filter!=="none")return o;o=o.parentNode}return null}function bg(e){for(var t=Da(e),n=I_(e);n&&Zve(n)&&Ks(n).position==="static";)n=I_(n);return n&&(is(n)==="html"||is(n)==="body"&&Ks(n).position==="static")?t:n||Jve(e)||t}function nA(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function tm(e,t,n){return ou(e,Ov(t,n))}function e0e(e,t,n){var r=tm(e,t,n);return r>n?n:r}function v7(){return{top:0,right:0,bottom:0,left:0}}function x7(e){return Object.assign({},v7(),e)}function S7(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var t0e=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,x7(typeof e!="number"?e:S7(e,yg))};function n0e(e){var t,n=e.state,r=e.name,o=e.options,a=n.elements.arrow,i=n.modifiersData.popperOffsets,l=ns(n.placement),c=nA(l),d=[na,si].indexOf(l)>=0,f=d?"height":"width";if(!(!a||!i)){var h=t0e(o.padding,n),g=tA(a),m=c==="y"?ta:na,v=c==="y"?ii:si,S=n.rects.reference[f]+n.rects.reference[c]-i[c]-n.rects.popper[f],E=i[c]-n.rects.reference[c],x=bg(a),w=x?c==="y"?x.clientHeight||0:x.clientWidth||0:0,T=S/2-E/2,R=h[m],D=w-g[f]-h[v],M=w/2-g[f]/2+T,F=tm(R,M,D),B=c;n.modifiersData[r]=(t={},t[B]=F,t.centerOffset=F-M,t)}}function r0e(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||b7(t.elements.popper,o)&&(t.elements.arrow=o))}const o0e={name:"arrow",enabled:!0,phase:"main",fn:n0e,effect:r0e,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function xf(e){return e.split("-")[1]}var a0e={top:"auto",right:"auto",bottom:"auto",left:"auto"};function i0e(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:bf(n*o)/o||0,y:bf(r*o)/o||0}}function O_(e){var t,n=e.popper,r=e.popperRect,o=e.placement,a=e.variation,i=e.offsets,l=e.position,c=e.gpuAcceleration,d=e.adaptive,f=e.roundOffsets,h=e.isFixed,g=i.x,m=g===void 0?0:g,v=i.y,S=v===void 0?0:v,E=typeof f=="function"?f({x:m,y:S}):{x:m,y:S};m=E.x,S=E.y;var x=i.hasOwnProperty("x"),w=i.hasOwnProperty("y"),T=na,R=ta,D=window;if(d){var M=bg(n),F="clientHeight",B="clientWidth";if(M===Da(n)&&(M=pc(n),Ks(M).position!=="static"&&l==="absolute"&&(F="scrollHeight",B="scrollWidth")),M=M,o===ta||(o===na||o===si)&&a===Pm){R=ii;var H=h&&M===D&&D.visualViewport?D.visualViewport.height:M[F];S-=H-r.height,S*=c?1:-1}if(o===na||(o===ta||o===ii)&&a===Pm){T=si;var j=h&&M===D&&D.visualViewport?D.visualViewport.width:M[B];m-=j-r.width,m*=c?1:-1}}var z=Object.assign({position:l},d&&a0e),k=f===!0?i0e({x:m,y:S},Da(n)):{x:m,y:S};if(m=k.x,S=k.y,c){var _;return Object.assign({},z,(_={},_[R]=w?"0":"",_[T]=x?"0":"",_.transform=(D.devicePixelRatio||1)<=1?"translate("+m+"px, "+S+"px)":"translate3d("+m+"px, "+S+"px, 0)",_))}return Object.assign({},z,(t={},t[R]=w?S+"px":"",t[T]=x?m+"px":"",t.transform="",t))}function s0e(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,a=n.adaptive,i=a===void 0?!0:a,l=n.roundOffsets,c=l===void 0?!0:l,d={placement:ns(t.placement),variation:xf(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,O_(Object.assign({},d,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,O_(Object.assign({},d,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const l0e={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:s0e,data:{}};var sb={passive:!0};function c0e(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,a=o===void 0?!0:o,i=r.resize,l=i===void 0?!0:i,c=Da(t.elements.popper),d=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&d.forEach(function(f){f.addEventListener("scroll",n.update,sb)}),l&&c.addEventListener("resize",n.update,sb),function(){a&&d.forEach(function(f){f.removeEventListener("scroll",n.update,sb)}),l&&c.removeEventListener("resize",n.update,sb)}}const u0e={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:c0e,data:{}};var d0e={left:"right",right:"left",bottom:"top",top:"bottom"};function Ub(e){return e.replace(/left|right|bottom|top/g,function(t){return d0e[t]})}var f0e={start:"end",end:"start"};function N_(e){return e.replace(/start|end/g,function(t){return f0e[t]})}function rA(e){var t=Da(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function oA(e){return vf(pc(e)).left+rA(e).scrollLeft}function p0e(e,t){var n=Da(e),r=pc(e),o=n.visualViewport,a=r.clientWidth,i=r.clientHeight,l=0,c=0;if(o){a=o.width,i=o.height;var d=y7();(d||!d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}return{width:a,height:i,x:l+oA(e),y:c}}function h0e(e){var t,n=pc(e),r=rA(e),o=(t=e.ownerDocument)==null?void 0:t.body,a=ou(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=ou(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),l=-r.scrollLeft+oA(e),c=-r.scrollTop;return Ks(o||n).direction==="rtl"&&(l+=ou(n.clientWidth,o?o.clientWidth:0)-a),{width:a,height:i,x:l,y:c}}function aA(e){var t=Ks(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function E7(e){return["html","body","#document"].indexOf(is(e))>=0?e.ownerDocument.body:ti(e)&&aA(e)?e:E7(t1(e))}function nm(e,t){var n;t===void 0&&(t=[]);var r=E7(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),a=Da(r),i=o?[a].concat(a.visualViewport||[],aA(r)?r:[]):r,l=t.concat(i);return o?l:l.concat(nm(t1(i)))}function bT(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function m0e(e,t){var n=vf(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function P_(e,t,n){return t===m7?bT(p0e(e,n)):yu(t)?m0e(t,n):bT(h0e(pc(e)))}function g0e(e){var t=nm(t1(e)),n=["absolute","fixed"].indexOf(Ks(e).position)>=0,r=n&&ti(e)?bg(e):e;return yu(r)?t.filter(function(o){return yu(o)&&b7(o,r)&&is(o)!=="body"}):[]}function y0e(e,t,n,r){var o=t==="clippingParents"?g0e(e):[].concat(t),a=[].concat(o,[n]),i=a[0],l=a.reduce(function(c,d){var f=P_(e,d,r);return c.top=ou(f.top,c.top),c.right=Ov(f.right,c.right),c.bottom=Ov(f.bottom,c.bottom),c.left=ou(f.left,c.left),c},P_(e,i,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function C7(e){var t=e.reference,n=e.element,r=e.placement,o=r?ns(r):null,a=r?xf(r):null,i=t.x+t.width/2-n.width/2,l=t.y+t.height/2-n.height/2,c;switch(o){case ta:c={x:i,y:t.y-n.height};break;case ii:c={x:i,y:t.y+t.height};break;case si:c={x:t.x+t.width,y:l};break;case na:c={x:t.x-n.width,y:l};break;default:c={x:t.x,y:t.y}}var d=o?nA(o):null;if(d!=null){var f=d==="y"?"height":"width";switch(a){case yf:c[d]=c[d]-(t[f]/2-n[f]/2);break;case Pm:c[d]=c[d]+(t[f]/2-n[f]/2);break}}return c}function _m(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,a=n.strategy,i=a===void 0?e.strategy:a,l=n.boundary,c=l===void 0?Fve:l,d=n.rootBoundary,f=d===void 0?m7:d,h=n.elementContext,g=h===void 0?fh:h,m=n.altBoundary,v=m===void 0?!1:m,S=n.padding,E=S===void 0?0:S,x=x7(typeof E!="number"?E:S7(E,yg)),w=g===fh?jve:fh,T=e.rects.popper,R=e.elements[v?w:g],D=y0e(yu(R)?R:R.contextElement||pc(e.elements.popper),c,f,i),M=vf(e.elements.reference),F=C7({reference:M,element:T,placement:o}),B=bT(Object.assign({},T,F)),H=g===fh?B:M,j={top:D.top-H.top+x.top,bottom:H.bottom-D.bottom+x.bottom,left:D.left-H.left+x.left,right:H.right-D.right+x.right},z=e.modifiersData.offset;if(g===fh&&z){var k=z[o];Object.keys(j).forEach(function(_){var P=[si,ii].indexOf(_)>=0?1:-1,$=[ta,ii].indexOf(_)>=0?"y":"x";j[_]+=k[$]*P})}return j}function b0e(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,a=n.rootBoundary,i=n.padding,l=n.flipVariations,c=n.allowedAutoPlacements,d=c===void 0?g7:c,f=xf(r),h=f?l?M_:M_.filter(function(v){return xf(v)===f}):yg,g=h.filter(function(v){return d.indexOf(v)>=0});g.length===0&&(g=h);var m=g.reduce(function(v,S){return v[S]=_m(e,{placement:S,boundary:o,rootBoundary:a,padding:i})[ns(S)],v},{});return Object.keys(m).sort(function(v,S){return m[v]-m[S]})}function v0e(e){if(ns(e)===Jk)return[];var t=Ub(e);return[N_(e),t,N_(t)]}function x0e(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,a=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!0:i,c=n.fallbackPlacements,d=n.padding,f=n.boundary,h=n.rootBoundary,g=n.altBoundary,m=n.flipVariations,v=m===void 0?!0:m,S=n.allowedAutoPlacements,E=t.options.placement,x=ns(E),w=x===E,T=c||(w||!v?[Ub(E)]:v0e(E)),R=[E].concat(T).reduce(function(J,Z){return J.concat(ns(Z)===Jk?b0e(t,{placement:Z,boundary:f,rootBoundary:h,padding:d,flipVariations:v,allowedAutoPlacements:S}):Z)},[]),D=t.rects.reference,M=t.rects.popper,F=new Map,B=!0,H=R[0],j=0;j<R.length;j++){var z=R[j],k=ns(z),_=xf(z)===yf,P=[ta,ii].indexOf(k)>=0,$=P?"width":"height",L=_m(t,{placement:z,boundary:f,rootBoundary:h,altBoundary:g,padding:d}),G=P?_?si:na:_?ii:ta;D[$]>M[$]&&(G=Ub(G));var V=Ub(G),Y=[];if(a&&Y.push(L[k]<=0),l&&Y.push(L[G]<=0,L[V]<=0),Y.every(function(J){return J})){H=z,B=!1;break}F.set(z,Y)}if(B)for(var N=v?3:1,q=function(J){var Z=R.find(function(Q){var re=F.get(Q);if(re)return re.slice(0,J).every(function(te){return te})});if(Z)return H=Z,"break"},K=N;K>0;K--){var U=q(K);if(U==="break")break}t.placement!==H&&(t.modifiersData[r]._skip=!0,t.placement=H,t.reset=!0)}}const S0e={name:"flip",enabled:!0,phase:"main",fn:x0e,requiresIfExists:["offset"],data:{_skip:!1}};function __(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function L_(e){return[ta,si,ii,na].some(function(t){return e[t]>=0})}function E0e(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,a=t.modifiersData.preventOverflow,i=_m(t,{elementContext:"reference"}),l=_m(t,{altBoundary:!0}),c=__(i,r),d=__(l,o,a),f=L_(c),h=L_(d);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:f,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":f,"data-popper-escaped":h})}const C0e={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:E0e};function T0e(e,t,n){var r=ns(e),o=[na,ta].indexOf(r)>=0?-1:1,a=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=a[0],l=a[1];return i=i||0,l=(l||0)*o,[na,si].indexOf(r)>=0?{x:l,y:i}:{x:i,y:l}}function w0e(e){var t=e.state,n=e.options,r=e.name,o=n.offset,a=o===void 0?[0,0]:o,i=g7.reduce(function(f,h){return f[h]=T0e(h,t.rects,a),f},{}),l=i[t.placement],c=l.x,d=l.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=d),t.modifiersData[r]=i}const k0e={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:w0e};function A0e(e){var t=e.state,n=e.name;t.modifiersData[n]=C7({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const D0e={name:"popperOffsets",enabled:!0,phase:"read",fn:A0e,data:{}};function R0e(e){return e==="x"?"y":"x"}function M0e(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,a=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!1:i,c=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.padding,g=n.tether,m=g===void 0?!0:g,v=n.tetherOffset,S=v===void 0?0:v,E=_m(t,{boundary:c,rootBoundary:d,padding:h,altBoundary:f}),x=ns(t.placement),w=xf(t.placement),T=!w,R=nA(x),D=R0e(R),M=t.modifiersData.popperOffsets,F=t.rects.reference,B=t.rects.popper,H=typeof S=="function"?S(Object.assign({},t.rects,{placement:t.placement})):S,j=typeof H=="number"?{mainAxis:H,altAxis:H}:Object.assign({mainAxis:0,altAxis:0},H),z=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,k={x:0,y:0};if(M){if(a){var _,P=R==="y"?ta:na,$=R==="y"?ii:si,L=R==="y"?"height":"width",G=M[R],V=G+E[P],Y=G-E[$],N=m?-B[L]/2:0,q=w===yf?F[L]:B[L],K=w===yf?-B[L]:-F[L],U=t.elements.arrow,J=m&&U?tA(U):{width:0,height:0},Z=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:v7(),Q=Z[P],re=Z[$],te=tm(0,F[L],J[L]),ue=T?F[L]/2-N-te-Q-j.mainAxis:q-te-Q-j.mainAxis,fe=T?-F[L]/2+N+te+re+j.mainAxis:K+te+re+j.mainAxis,de=t.elements.arrow&&bg(t.elements.arrow),xe=de?R==="y"?de.clientTop||0:de.clientLeft||0:0,ae=(_=z?.[R])!=null?_:0,se=G+ue-ae-xe,je=G+fe-ae,De=tm(m?Ov(V,se):V,G,m?ou(Y,je):Y);M[R]=De,k[R]=De-G}if(l){var me,ve=R==="x"?ta:na,Xe=R==="x"?ii:si,Be=M[D],Ue=D==="y"?"height":"width",He=Be+E[ve],Rt=Be-E[Xe],Mt=[ta,na].indexOf(x)!==-1,bt=(me=z?.[D])!=null?me:0,ge=Mt?He:Be-F[Ue]-B[Ue]-bt+j.altAxis,Ee=Mt?Be+F[Ue]+B[Ue]-bt-j.altAxis:Rt,Ge=m&&Mt?e0e(ge,Be,Ee):tm(m?ge:He,Be,m?Ee:Rt);M[D]=Ge,k[D]=Ge-Be}t.modifiersData[r]=k}}const I0e={name:"preventOverflow",enabled:!0,phase:"main",fn:M0e,requiresIfExists:["offset"]};function O0e(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function N0e(e){return e===Da(e)||!ti(e)?rA(e):O0e(e)}function P0e(e){var t=e.getBoundingClientRect(),n=bf(t.width)/e.offsetWidth||1,r=bf(t.height)/e.offsetHeight||1;return n!==1||r!==1}function _0e(e,t,n){n===void 0&&(n=!1);var r=ti(t),o=ti(t)&&P0e(t),a=pc(t),i=vf(e,o,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((is(t)!=="body"||aA(a))&&(l=N0e(t)),ti(t)?(c=vf(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):a&&(c.x=oA(a))),{x:i.left+l.scrollLeft-c.x,y:i.top+l.scrollTop-c.y,width:i.width,height:i.height}}function L0e(e){var t=new Map,n=new Set,r=[];e.forEach(function(a){t.set(a.name,a)});function o(a){n.add(a.name);var i=[].concat(a.requires||[],a.requiresIfExists||[]);i.forEach(function(l){if(!n.has(l)){var c=t.get(l);c&&o(c)}}),r.push(a)}return e.forEach(function(a){n.has(a.name)||o(a)}),r}function F0e(e){var t=L0e(e);return Yve.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function j0e(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function B0e(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var F_={placement:"bottom",modifiers:[],strategy:"absolute"};function j_(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function $0e(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,o=t.defaultOptions,a=o===void 0?F_:o;return function(i,l,c){c===void 0&&(c=a);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},F_,a),modifiersData:{},elements:{reference:i,popper:l},attributes:{},styles:{}},f=[],h=!1,g={state:d,setOptions:function(S){var E=typeof S=="function"?S(d.options):S;v(),d.options=Object.assign({},a,d.options,E),d.scrollParents={reference:yu(i)?nm(i):i.contextElement?nm(i.contextElement):[],popper:nm(l)};var x=F0e(B0e([].concat(r,d.options.modifiers)));return d.orderedModifiers=x.filter(function(w){return w.enabled}),m(),g.update()},forceUpdate:function(){if(!h){var S=d.elements,E=S.reference,x=S.popper;if(j_(E,x)){d.rects={reference:_0e(E,bg(x),d.options.strategy==="fixed"),popper:tA(x)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(B){return d.modifiersData[B.name]=Object.assign({},B.data)});for(var w=0;w<d.orderedModifiers.length;w++){if(d.reset===!0){d.reset=!1,w=-1;continue}var T=d.orderedModifiers[w],R=T.fn,D=T.options,M=D===void 0?{}:D,F=T.name;typeof R=="function"&&(d=R({state:d,options:M,name:F,instance:g})||d)}}}},update:j0e(function(){return new Promise(function(S){g.forceUpdate(),S(d)})}),destroy:function(){v(),h=!0}};if(!j_(i,l))return g;g.setOptions(c).then(function(S){!h&&c.onFirstUpdate&&c.onFirstUpdate(S)});function m(){d.orderedModifiers.forEach(function(S){var E=S.name,x=S.options,w=x===void 0?{}:x,T=S.effect;if(typeof T=="function"){var R=T({state:d,name:E,instance:g,options:w}),D=function(){};f.push(R||D)}})}function v(){f.forEach(function(S){return S()}),f=[]}return g}}var z0e=[u0e,D0e,l0e,Xve,k0e,S0e,I0e,o0e,C0e],U0e=$0e({defaultModifiers:z0e});function Sf(e){return typeof e=="string"}function T7(e,t,n){return e===void 0||Sf(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function Io(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function B_(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function w7(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:o,className:a}=e;if(!t){const m=ft(n?.className,a,o?.className,r?.className),v={...n?.style,...o?.style,...r?.style},S={...n,...o,...r};return m.length>0&&(S.className=m),Object.keys(v).length>0&&(S.style=v),{props:S,internalRef:void 0}}const i=Io({...o,...r}),l=B_(r),c=B_(o),d=t(i),f=ft(d?.className,n?.className,a,o?.className,r?.className),h={...d?.style,...n?.style,...o?.style,...r?.style},g={...d,...n,...c,...l};return f.length>0&&(g.className=f),Object.keys(h).length>0&&(g.style=h),{props:g,internalRef:d.ref}}function Qa(e,t,n){return typeof e=="function"?e(t,n):e}function hn(e){const{elementType:t,externalSlotProps:n,ownerState:r,skipResolvingSlotProps:o=!1,...a}=e,i=o?{}:Qa(n,r),{props:l,internalRef:c}=w7({...a,externalSlotProps:i}),d=mn(c,i?.ref,e.additionalProps?.ref);return T7(t,{...l,ref:d},r)}function Uf(e){return parseInt(C.version,10)>=19?e?.props?.ref||null:e?.ref||null}function H0e(e){return typeof e=="function"?e():e}const k7=C.forwardRef(function(e,t){const{children:n,container:r,disablePortal:o=!1}=e,[a,i]=C.useState(null),l=mn(C.isValidElement(n)?Uf(n):null,t);if(Jr(()=>{o||i(H0e(r)||document.body)},[r,o]),Jr(()=>{if(a&&!o)return GC(t,a),()=>{GC(t,null)}},[t,a,o]),o){if(C.isValidElement(n)){const c={ref:l};return C.cloneElement(n,c)}return n}return a&&qm.createPortal(n,a)});function V0e(e){return Tt("MuiPopper",e)}xt("MuiPopper",["root"]);function W0e(e,t){if(t==="ltr")return e;switch(e){case"bottom-end":return"bottom-start";case"bottom-start":return"bottom-end";case"top-end":return"top-start";case"top-start":return"top-end";default:return e}}function vT(e){return typeof e=="function"?e():e}function q0e(e){return e.nodeType!==void 0}const G0e=e=>{const{classes:t}=e;return Et({root:["root"]},V0e,t)},Y0e={},K0e=C.forwardRef(function(e,t){const{anchorEl:n,children:r,direction:o,disablePortal:a,modifiers:i,open:l,placement:c,popperOptions:d,popperRef:f,slotProps:h={},slots:g={},TransitionProps:m,ownerState:v,...S}=e,E=C.useRef(null),x=mn(E,t),w=C.useRef(null),T=mn(w,f),R=C.useRef(T);Jr(()=>{R.current=T},[T]),C.useImperativeHandle(f,()=>w.current,[]);const D=W0e(c,o),[M,F]=C.useState(D),[B,H]=C.useState(vT(n));C.useEffect(()=>{w.current&&w.current.forceUpdate()}),C.useEffect(()=>{n&&H(vT(n))},[n]),Jr(()=>{if(!B||!l)return;const P=G=>{F(G.placement)};let $=[{name:"preventOverflow",options:{altBoundary:a}},{name:"flip",options:{altBoundary:a}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:({state:G})=>{P(G)}}];i!=null&&($=$.concat(i)),d&&d.modifiers!=null&&($=$.concat(d.modifiers));const L=U0e(B,E.current,{placement:D,...d,modifiers:$});return R.current(L),()=>{L.destroy(),R.current(null)}},[B,a,i,l,d,D]);const j={placement:M};m!==null&&(j.TransitionProps=m);const z=G0e(e),k=g.root??"div",_=hn({elementType:k,externalSlotProps:h.root,externalForwardedProps:S,additionalProps:{role:"tooltip",ref:x},ownerState:e,className:z.root});return y.jsx(k,{..._,children:typeof r=="function"?r(j):r})}),Q0e=C.forwardRef(function(e,t){const{anchorEl:n,children:r,container:o,direction:a="ltr",disablePortal:i=!1,keepMounted:l=!1,modifiers:c,open:d,placement:f="bottom",popperOptions:h=Y0e,popperRef:g,style:m,transition:v=!1,slotProps:S={},slots:E={},...x}=e,[w,T]=C.useState(!0),R=()=>{T(!1)},D=()=>{T(!0)};if(!l&&!d&&(!v||w))return null;let M;if(o)M=o;else if(n){const H=vT(n);M=H&&q0e(H)?Yr(H).body:Yr(null).body}const F=!d&&l&&(!v||w)?"none":void 0,B=v?{in:d,onEnter:R,onExited:D}:void 0;return y.jsx(k7,{disablePortal:i,container:M,children:y.jsx(K0e,{anchorEl:n,direction:a,disablePortal:i,modifiers:c,ref:t,open:v?!w:d,placement:f,popperOptions:h,popperRef:g,slotProps:S,slots:E,...x,style:{position:"fixed",top:0,left:0,display:F,...m},TransitionProps:B,children:r})})}),X0e=we(Q0e,{name:"MuiPopper",slot:"Root"})({}),iA=C.forwardRef(function(e,t){const n=di(),r=an({props:e,name:"MuiPopper"}),{anchorEl:o,component:a,components:i,componentsProps:l,container:c,disablePortal:d,keepMounted:f,modifiers:h,open:g,placement:m,popperOptions:v,popperRef:S,transition:E,slots:x,slotProps:w,...T}=r,R=x?.root??i?.Root,D={anchorEl:o,container:c,disablePortal:d,keepMounted:f,modifiers:h,open:g,placement:m,popperOptions:v,popperRef:S,transition:E,...T};return y.jsx(X0e,{as:a,direction:n?"rtl":"ltr",slots:{root:R},slotProps:w??l,...D,ref:t})});function Z0e(e){return Tt("MuiListSubheader",e)}xt("MuiListSubheader",["root","colorPrimary","colorInherit","gutters","inset","sticky"]);const J0e=e=>{const{classes:t,color:n,disableGutters:r,inset:o,disableSticky:a}=e,i={root:["root",n!=="default"&&`color${tt(n)}`,!r&&"gutters",o&&"inset",!a&&"sticky"]};return Et(i,Z0e,t)},e1e=we("li",{name:"MuiListSubheader",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${tt(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(un(({theme:e})=>({boxSizing:"border-box",lineHeight:"48px",listStyle:"none",color:(e.vars||e).palette.text.secondary,fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(14),variants:[{props:{color:"primary"},style:{color:(e.vars||e).palette.primary.main}},{props:{color:"inherit"},style:{color:"inherit"}},{props:({ownerState:t})=>!t.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:t})=>t.inset,style:{paddingLeft:72}},{props:({ownerState:t})=>!t.disableSticky,style:{position:"sticky",top:0,zIndex:1,backgroundColor:(e.vars||e).palette.background.paper}}]}))),xT=C.forwardRef(function(e,t){const n=an({props:e,name:"MuiListSubheader"}),{className:r,color:o="default",component:a="li",disableGutters:i=!1,disableSticky:l=!1,inset:c=!1,...d}=n,f={...n,color:o,component:a,disableGutters:i,disableSticky:l,inset:c},h=J0e(f);return y.jsx(e1e,{as:a,className:ft(h.root,r),ref:t,ownerState:f,...d})});xT&&(xT.muiSkipListHighlight=!0);function t1e(e){return Tt("MuiPaper",e)}xt("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);const n1e=e=>{const{square:t,elevation:n,variant:r,classes:o}=e,a={root:["root",r,!t&&"rounded",r==="elevation"&&`elevation${n}`]};return Et(a,t1e,o)},r1e=we("div",{name:"MuiPaper",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],!n.square&&t.rounded,n.variant==="elevation"&&t[`elevation${n.elevation}`]]}})(un(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,color:(e.vars||e).palette.text.primary,transition:e.transitions.create("box-shadow"),variants:[{props:({ownerState:t})=>!t.square,style:{borderRadius:e.shape.borderRadius}},{props:{variant:"outlined"},style:{border:`1px solid ${(e.vars||e).palette.divider}`}},{props:{variant:"elevation"},style:{boxShadow:"var(--Paper-shadow)",backgroundImage:"var(--Paper-overlay)"}}]}))),Iu=C.forwardRef(function(e,t){const n=an({props:e,name:"MuiPaper"}),r=cc(),{className:o,component:a="div",elevation:i=1,square:l=!1,variant:c="elevation",...d}=n,f={...n,component:a,elevation:i,square:l,variant:c},h=n1e(f);return y.jsx(r1e,{as:a,ownerState:f,className:ft(h.root,o),ref:t,...d,style:{...c==="elevation"&&{"--Paper-shadow":(r.vars||r).shadows[i],...r.vars&&{"--Paper-overlay":r.vars.overlays?.[i]},...!r.vars&&r.palette.mode==="dark"&&{"--Paper-overlay":`linear-gradient(${vv("#fff",WC(i))}, ${vv("#fff",WC(i))})`}},...d.style}})});function o1e(e){return typeof e.main=="string"}function a1e(e,t=[]){if(!o1e(e))return!1;for(const n of t)if(!e.hasOwnProperty(n)||typeof e[n]!="string")return!1;return!0}function Po(e=[]){return([,t])=>t&&a1e(t,e)}function $_(e){try{return e.matches(":focus-visible")}catch{}return!1}const z_={};function A7(e,t){const n=C.useRef(z_);return n.current===z_&&(n.current=e(t)),n}class Nv{static create(){return new Nv}static use(){const t=A7(Nv.create).current,[n,r]=C.useState(!1);return t.shouldMount=n,t.setShouldMount=r,C.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=s1e(),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 i1e(){return Nv.use()}function s1e(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n}function ST(e,t){return ST=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ST(e,t)}function sA(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ST(e,t)}function l1e(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function c1e(e,t){e.classList?e.classList.add(t):l1e(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function U_(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function u1e(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=U_(e.className,t):e.setAttribute("class",U_(e.className&&e.className.baseVal||"",t))}const H_={disabled:!1},Pv=Je.createContext(null);var D7=function(e){return e.scrollTop},Mh="unmounted",zc="exited",Uc="entering",_d="entered",ET="exiting",pi=(function(e){sA(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=zc,a.appearStatus=Uc):c=_d:r.unmountOnExit||r.mountOnEnter?c=Mh:c=zc,a.state={status:c},a.nextCallback=null,a}t.getDerivedStateFromProps=function(r,o){var a=r.in;return a&&o.status===Mh?{status:zc}: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!==Uc&&a!==_d&&(o=Uc):(a===Uc||a===_d)&&(o=ET)}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===Uc){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:Ll.findDOMNode(this);a&&D7(a)}this.performEnter(r)}else this.performExit();else this.props.unmountOnExit&&this.state.status===zc&&this.setState({status:Mh})},n.performEnter=function(r){var o=this,a=this.props.enter,i=this.context?this.context.isMounting:r,l=this.props.nodeRef?[i]:[Ll.findDOMNode(this),i],c=l[0],d=l[1],f=this.getTimeouts(),h=i?f.appear:f.enter;if(!r&&!a||H_.disabled){this.safeSetState({status:_d},function(){o.props.onEntered(c)});return}this.props.onEnter(c,d),this.safeSetState({status:Uc},function(){o.props.onEntering(c,d),o.onTransitionEnd(h,function(){o.safeSetState({status:_d},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:Ll.findDOMNode(this);if(!o||H_.disabled){this.safeSetState({status:zc},function(){r.props.onExited(i)});return}this.props.onExit(i),this.safeSetState({status:ET},function(){r.props.onExiting(i),r.onTransitionEnd(a.exit,function(){r.safeSetState({status:zc},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:Ll.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===Mh)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=Ot(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Je.createElement(Pv.Provider,{value:null},typeof a=="function"?a(r,i):Je.cloneElement(Je.Children.only(a),i))},t})(Je.Component);pi.contextType=Pv;pi.propTypes={};function Rd(){}pi.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Rd,onEntering:Rd,onEntered:Rd,onExit:Rd,onExiting:Rd,onExited:Rd};pi.UNMOUNTED=Mh;pi.EXITED=zc;pi.ENTERING=Uc;pi.ENTERED=_d;pi.EXITING=ET;var d1e=function(e,t){return e&&t&&t.split(" ").forEach(function(n){return c1e(e,n)})},jE=function(e,t){return e&&t&&t.split(" ").forEach(function(n){return u1e(e,n)})},lA=(function(e){sA(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),f=d[0],h=d[1];r.removeClasses(f,"exit"),r.addClass(f,h?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(l,c)},r.onEntering=function(l,c){var d=r.resolveArguments(l,c),f=d[0],h=d[1],g=h?"appear":"enter";r.addClass(f,g,"active"),r.props.onEntering&&r.props.onEntering(l,c)},r.onEntered=function(l,c){var d=r.resolveArguments(l,c),f=d[0],h=d[1],g=h?"appear":"enter";r.removeClasses(f,g),r.addClass(f,g,"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",f=d&&c?c+"-":"",h=d?""+f+l:c[l],g=d?h+"-active":c[l+"Active"],m=d?h+"-done":c[l+"Done"];return{baseClassName:h,activeClassName:g,doneClassName:m}},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&&D7(r),i&&(this.appliedClasses[o][a]=i,d1e(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&&jE(r,i),l&&jE(r,l),c&&jE(r,c)},n.render=function(){var r=this.props;r.classNames;var o=Ot(r,["classNames"]);return Je.createElement(pi,ne({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t})(Je.Component);lA.defaultProps={classNames:""};lA.propTypes={};function f1e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cA(e,t){var n=function(o){return t&&C.isValidElement(o)?t(o):o},r=Object.create(null);return e&&C.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function p1e(e,t){e=e||{},t=t||{};function n(f){return f in t?t[f]:e[f]}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 Zc(e,t,n){return n[t]!=null?n[t]:e.props[t]}function h1e(e,t){return cA(e.children,function(n){return C.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:Zc(n,"appear",e),enter:Zc(n,"enter",e),exit:Zc(n,"exit",e)})})}function m1e(e,t,n){var r=cA(e.children),o=p1e(t,r);return Object.keys(o).forEach(function(a){var i=o[a];if(C.isValidElement(i)){var l=a in t,c=a in r,d=t[a],f=C.isValidElement(d)&&!d.props.in;c&&(!l||f)?o[a]=C.cloneElement(i,{onExited:n.bind(null,i),in:!0,exit:Zc(i,"exit",e),enter:Zc(i,"enter",e)}):!c&&l&&!f?o[a]=C.cloneElement(i,{in:!1}):c&&l&&C.isValidElement(d)&&(o[a]=C.cloneElement(i,{onExited:n.bind(null,i),in:d.props.in,exit:Zc(i,"exit",e),enter:Zc(i,"enter",e)}))}}),o}var g1e=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},y1e={component:"div",childFactory:function(e){return e}},vg=(function(e){sA(t,e);function t(r,o){var a;a=e.call(this,r,o)||this;var i=a.handleExited.bind(f1e(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?h1e(r,i):m1e(r,a,i),firstRender:!1}},n.handleExited=function(r,o){var a=cA(this.props.children);r.key in a||(r.props.onExited&&r.props.onExited(o),this.mounted&&this.setState(function(i){var l=ne({},i.children);return delete l[r.key],{children:l}}))},n.render=function(){var r=this.props,o=r.component,a=r.childFactory,i=Ot(r,["component","childFactory"]),l=this.state.contextValue,c=g1e(this.state.children).map(a);return delete i.appear,delete i.enter,delete i.exit,o===null?Je.createElement(Pv.Provider,{value:l},c):Je.createElement(Pv.Provider,{value:l},Je.createElement(o,i,c))},t})(Je.Component);vg.propTypes={};vg.defaultProps=y1e;const b1e=[];function v1e(e){C.useEffect(e,b1e)}class uA{static create(){return new uA}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 n1(){const e=A7(uA.create).current;return v1e(e.disposeEffect),e}function x1e(e){const{className:t,classes:n,pulsate:r=!1,rippleX:o,rippleY:a,rippleSize:i,in:l,onExited:c,timeout:d}=e,[f,h]=C.useState(!1),g=ft(t,n.ripple,n.rippleVisible,r&&n.ripplePulsate),m={width:i,height:i,top:-(i/2)+a,left:-(i/2)+o},v=ft(n.child,f&&n.childLeaving,r&&n.childPulsate);return!l&&!f&&h(!0),C.useEffect(()=>{if(!l&&c!=null){const S=setTimeout(c,d);return()=>{clearTimeout(S)}}},[c,l,d]),y.jsx("span",{className:g,style:m,children:y.jsx("span",{className:v})})}const Va=xt("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),CT=550,S1e=80,E1e=cs`
327
327
  0% {
328
328
  transform: scale(0);
329
329
  opacity: 0.1;
@@ -453,4 +453,4 @@ import {${t.sourceName}}" from '${t.modelPath}'"
453
453
  `));n(m=>{const v=m.items.itemMetaMap[h];return v.label!==g?ne({},m,{items:ne({},m.items,{itemMetaMap:ne({},m.items.itemMetaMap,{[h]:ne({},v,{label:g})})})}):m}),r.onItemLabelChange&&r.onItemLabelChange(h,g)};return{instance:{setEditedItemId:i,isItemBeingEdited:l,updateItemLabel:f,isItemEditable:d,isTreeViewEditable:c,isItemBeingEditedRef:a},publicAPI:{updateItemLabel:f}}};ni.itemPlugin=EDe;ni.getDefaultizedParams=({params:e,experimentalFeatures:t})=>{const n=t?.labelEditing;return ne({},e,{isItemEditable:n?e.isItemEditable??!1:!1})};ni.getInitialState=()=>({editedItemId:null});ni.params={onItemLabelChange:!0,isItemEditable:!0};const iu=(e,t)=>e.getAvailablePlugins().has(t),HB=e=>Array.isArray(e)?e.length>0&&e.some(HB):!!e,CDe=({itemId:e,children:t})=>{const{instance:n,selection:{multiSelect:r},publicAPI:o}=Nu(),a={expandable:HB(t),expanded:n.isItemExpanded(e),focused:n.isItemFocused(e),selected:n.isItemSelected(e),disabled:n.isItemDisabled(e),editing:n?.isItemBeingEdited?n?.isItemBeingEdited(e):!1,editable:n.isItemEditable?n.isItemEditable(e):!1},i=f=>{if(a.disabled)return;a.focused||n.focusItem(f,e);const h=r&&(f.shiftKey||f.ctrlKey||f.metaKey);a.expandable&&!(h&&n.isItemExpanded(e))&&n.toggleItemExpansion(f,e)},l=f=>{a.disabled||(!a.focused&&!a.editing&&n.focusItem(f,e),r&&(f.shiftKey||f.ctrlKey||f.metaKey)?f.shiftKey?n.expandSelectionRange(f,e):n.selectItem({event:f,itemId:e,keepExistingSelection:!0}):n.selectItem({event:f,itemId:e,shouldBeSelected:!0}))},c=f=>{const h=f.nativeEvent.shiftKey;r&&h?n.expandSelectionRange(f,e):n.selectItem({event:f,itemId:e,keepExistingSelection:r,shouldBeSelected:f.target.checked})},d=()=>{iu(n,ni)&&n.isItemEditable(e)&&(n.isItemBeingEdited(e)?n.setEditedItemId(null):n.setEditedItemId(e))};return{interactions:{handleExpansion:i,handleSelection:l,handleCheckboxSelection:c,toggleItemEditing:d,handleSaveItemLabel:(f,h)=>{iu(n,ni)&&n.isItemBeingEditedRef(e)&&(n.updateItemLabel(e,h),d(),n.focusItem(f,e))},handleCancelItemLabelEditing:f=>{iu(n,ni)&&n.isItemBeingEditedRef(e)&&(d(),n.focusItem(f,e))}},status:a,publicAPI:o}},AA=C.createContext(()=>-1),VB=(e,t)=>{let n=t.length-1;for(;n>=0&&!e.isItemNavigable(t[n]);)n-=1;if(n!==-1)return t[n]},WB=(e,t)=>{const n=e.getItemMeta(t),r=e.getItemOrderedChildrenIds(n.parentId),o=e.getItemIndex(t);if(o===0)return n.parentId;let a=o-1;for(;!e.isItemNavigable(r[a])&&a>=0;)a-=1;if(a===-1)return n.parentId==null?null:WB(e,n.parentId);let i=r[a],l=VB(e,e.getItemOrderedChildrenIds(i));for(;e.isItemExpanded(i)&&l!=null;)i=l,l=e.getItemOrderedChildrenIds(i).find(e.isItemNavigable);return i},Vb=(e,t)=>{if(e.isItemExpanded(t)){const r=e.getItemOrderedChildrenIds(t).find(e.isItemNavigable);if(r!=null)return r}let n=e.getItemMeta(t);for(;n!=null;){const r=e.getItemOrderedChildrenIds(n.parentId),o=e.getItemIndex(n.id);if(o<r.length-1){let a=o+1;for(;!e.isItemNavigable(r[a])&&a<r.length-1;)a+=1;if(e.isItemNavigable(r[a]))return r[a]}n=e.getItemMeta(n.parentId)}return null},qB=e=>{let t=null;for(;t==null||e.isItemExpanded(t);){const n=e.getItemOrderedChildrenIds(t),r=VB(e,n);if(r==null)return t;t=r}return t},zm=e=>e.getItemOrderedChildrenIds(null).find(e.isItemNavigable),GB=(e,t,n)=>{if(t===n)return[t,n];const r=e.getItemMeta(t),o=e.getItemMeta(n);if(r.parentId===o.id||o.parentId===r.id)return o.parentId===r.id?[r.id,o.id]:[o.id,r.id];const a=[r.id],i=[o.id];let l=r.parentId,c=o.parentId,d=i.indexOf(l)!==-1,f=a.indexOf(c)!==-1,h=!0,g=!0;for(;!f&&!d;)h&&(a.push(l),d=i.indexOf(l)!==-1,h=l!==null,!d&&h&&(l=e.getItemMeta(l).parentId)),g&&!d&&(i.push(c),f=a.indexOf(c)!==-1,g=c!==null,!f&&g&&(c=e.getItemMeta(c).parentId));const m=d?l:c,v=e.getItemOrderedChildrenIds(m),S=a[a.indexOf(m)-1],E=i[i.indexOf(m)-1];return v.indexOf(S)<v.indexOf(E)?[t,n]:[n,t]},TDe=(e,t,n)=>{const r=c=>{if(e.isItemExpandable(c)&&e.isItemExpanded(c))return e.getItemOrderedChildrenIds(c)[0];let d=e.getItemMeta(c);for(;d!=null;){const f=e.getItemOrderedChildrenIds(d.parentId),h=e.getItemIndex(d.id);if(h<f.length-1)return f[h+1];d=e.getItemMeta(d.parentId)}throw new Error("Invalid range")},[o,a]=GB(e,t,n),i=[o];let l=o;for(;l!==a;)l=r(l),e.isItemDisabled(l)||i.push(l);return i},wDe=e=>{let t=zm(e);const n=[];for(;t!=null;)n.push(t),t=Vb(e,t);return n},Um=(e,t)=>t!==e.closest('*[role="treeitem"]');let q5=0;const kDe=()=>(q5+=1,`mui-tree-view-${q5}`),DA=({id:e,treeId:t="",itemId:n})=>e??`${t}-${n}`,ADe=e=>{const{runItemPlugins:t,items:{onItemClick:n,disabledItemsFocusable:r,indentationAtItemLevel:o},selection:{disableSelection:a,checkboxSelection:i},expansion:{expansionTrigger:l},treeId:c,instance:d,publicAPI:f}=Nu(),h=C.useContext(AA),{id:g,itemId:m,label:v,children:S,rootRef:E}=e,{rootRef:x,contentRef:w,propsEnhancers:T}=t(e),{interactions:R,status:D}=CDe({itemId:m,children:S}),M=C.useRef(null),F=C.useRef(null),B=mn(E,x,M),H=mn(w,F),j=C.useRef(null),z=DA({itemId:m,treeId:c,id:g}),k=d.canItemBeTabbed(m)?0:-1,_={rootRefObject:M,contentRefObject:F,interactions:R},P=K=>U=>{if(K.onFocus?.(U),U.defaultMuiPrevented)return;const J=!D.disabled||r;!D.focused&&J&&U.currentTarget===U.target&&d.focusItem(U,m)},$=K=>U=>{if(K.onBlur?.(U),U.defaultMuiPrevented)return;const J=d.getItemDOMElement(m);D.editing||U.relatedTarget&&Um(U.relatedTarget,J)&&(U.target&&U.target?.dataset?.element==="labelInput"&&Um(U.target,J)||U.relatedTarget?.dataset?.element==="labelInput")||d.removeFocusedItem()},L=K=>U=>{K.onKeyDown?.(U),!(U.defaultMuiPrevented||U.target?.dataset?.element==="labelInput")&&d.handleItemKeyDown(U,m)},G=K=>U=>{K.onDoubleClick?.(U),!U.defaultMuiPrevented&&R.toggleItemEditing()},V=K=>U=>{K.onClick?.(U),n?.(U,m),!(U.defaultMuiPrevented||j.current?.contains(U.target))&&(l==="content"&&R.handleExpansion(U),i||R.handleSelection(U))},Y=K=>U=>{K.onMouseDown?.(U),!U.defaultMuiPrevented&&(U.shiftKey||U.ctrlKey||U.metaKey||D.disabled)&&U.preventDefault()},N=K=>U=>{K.onChange?.(U),!U.defaultMuiPrevented&&(a||D.disabled||R.handleCheckboxSelection(U))},q=K=>U=>{K.onClick?.(U),!U.defaultMuiPrevented&&l==="iconContainer"&&R.handleExpansion(U)};return{getRootProps:(K={})=>{const U=ne({},Io(e),Io(K));let J;D.selected?J=!0:a||D.disabled?J=void 0:J=!1;const Z=ne({},U,{ref:B,role:"treeitem",tabIndex:k,id:z,"aria-expanded":D.expandable?D.expanded:void 0,"aria-selected":J,"aria-disabled":D.disabled||void 0},K,{onFocus:P(U),onBlur:$(U),onKeyDown:L(U)});o&&(Z.style={"--TreeView-itemDepth":typeof h=="function"?h(m):h});const Q=T.root?.(ne({},_,{externalEventHandlers:U}))??{};return ne({},Z,Q)},getContentProps:(K={})=>{const U=Io(K),J=ne({},U,K,{ref:H,onClick:V(U),onMouseDown:Y(U),status:D});o&&(J.indentationAtItemLevel=!0);const Z=T.content?.(ne({},_,{externalEventHandlers:U}))??{};return ne({},J,Z)},getGroupTransitionProps:(K={})=>{const U=Io(K),J=ne({},U,{unmountOnExit:!0,component:"ul",role:"group",in:D.expanded,children:S},K);return o&&(J.indentationAtItemLevel=!0),J},getIconContainerProps:(K={})=>{const U=Io(K);return ne({},U,K,{onClick:q(U)})},getCheckboxProps:(K={})=>{const U=Io(K);return ne({},U,{visible:i,ref:j,checked:D.selected,disabled:a||D.disabled,tabIndex:-1},K,{onChange:N(U)})},getLabelProps:(K={})=>{const U=ne({},Io(K)),J=ne({},U,{children:v},K,{onDoubleClick:G(U)});return d.isTreeViewEditable&&(J.editable=D.editable),J},getLabelInputProps:(K={})=>{const U=Io(K),J=T.labelInput?.({rootRefObject:M,contentRefObject:F,externalEventHandlers:U,interactions:R})??{};return ne({},K,J)},getDragAndDropOverlayProps:(K={})=>{const U=Io(K),J=T.dragAndDropOverlay?.(ne({},_,{externalEventHandlers:U}))??{};return ne({},K,J)},rootRef:B,status:D,publicAPI:f}},DDe=ADe;function YB(e){const{instance:t,items:{onItemClick:n},selection:{multiSelect:r,checkboxSelection:o,disableSelection:a},expansion:{expansionTrigger:i}}=Nu(),l=t.isItemExpandable(e),c=t.isItemExpanded(e),d=t.isItemFocused(e),f=t.isItemSelected(e),h=t.isItemDisabled(e),g=t?.isItemBeingEdited?t?.isItemBeingEdited(e):!1,m=t.isItemEditable?t.isItemEditable(e):!1,v=T=>{if(!h){d||t.focusItem(T,e);const R=r&&(T.shiftKey||T.ctrlKey||T.metaKey);l&&!(R&&t.isItemExpanded(e))&&t.toggleItemExpansion(T,e)}},S=T=>{h||(!d&&!g&&t.focusItem(T,e),r&&(T.shiftKey||T.ctrlKey||T.metaKey)?T.shiftKey?t.expandSelectionRange(T,e):t.selectItem({event:T,itemId:e,keepExistingSelection:!0}):t.selectItem({event:T,itemId:e,shouldBeSelected:!0}))},E=T=>{if(a||h)return;const R=T.nativeEvent.shiftKey;r&&R?t.expandSelectionRange(T,e):t.selectItem({event:T,itemId:e,keepExistingSelection:r,shouldBeSelected:T.target.checked})},x=T=>{(T.shiftKey||T.ctrlKey||T.metaKey||h)&&T.preventDefault()},w=()=>{iu(t,ni)&&t.isItemEditable(e)&&(t.isItemBeingEdited(e)?t.setEditedItemId(null):t.setEditedItemId(e))};return{disabled:h,expanded:c,selected:f,focused:d,editable:m,editing:g,disableSelection:a,checkboxSelection:o,handleExpansion:v,handleSelection:S,handleCheckboxSelection:E,handleContentClick:n,preventSelection:x,expansionTrigger:i,toggleItemEditing:w,handleSaveItemLabel:(T,R)=>{iu(t,ni)&&t.isItemBeingEditedRef(e)&&(t.updateItemLabel(e,R),w(),t.focusItem(T,e))},handleCancelItemLabelEditing:T=>{iu(t,ni)&&t.isItemBeingEditedRef(e)&&(w(),t.focusItem(T,e))}}}const RDe=we("div",{name:"MuiTreeItem2DragAndDropOverlay",slot:"Root",overridesResolver:(e,t)=>t.root,shouldForwardProp:e=>Oh(e)&&e!=="action"})(({theme:e})=>({position:"absolute",left:0,display:"flex",top:0,bottom:0,right:0,pointerEvents:"none",variants:[{props:{action:"make-child"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderRadius:e.shape.borderRadius,backgroundColor:e.vars?`rgba(${e.vars.palette.primary.darkChannel} / ${e.vars.palette.action.focusOpacity})`:Zr(e.palette.primary.dark,e.palette.action.focusOpacity)}},{props:{action:"reorder-above"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderTop:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"reorder-below"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"move-to-parent"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}}]}));function MDe(e){return e.action==null?null:y.jsx(RDe,ne({},e))}const IDe=we("input",{name:"MuiTreeItem2",slot:"LabelInput",overridesResolver:(e,t)=>t.labelInput})(({theme:e})=>ne({},e.typography.body1,{width:"100%",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadius,border:"none",padding:"0 2px",boxSizing:"border-box","&:focus":{outline:`1px solid ${e.palette.primary.main}`}})),ODe=["classes","className","displayIcon","expansionIcon","icon","label","itemId","onClick","onMouseDown","dragAndDropOverlayProps","labelInputProps"],KB=C.forwardRef(function(e,t){const{classes:n,className:r,displayIcon:o,expansionIcon:a,icon:i,label:l,itemId:c,onClick:d,onMouseDown:f,dragAndDropOverlayProps:h,labelInputProps:g}=e,m=Ot(e,ODe),{disabled:v,expanded:S,selected:E,focused:x,editing:w,editable:T,disableSelection:R,checkboxSelection:D,handleExpansion:M,handleSelection:F,handleCheckboxSelection:B,handleContentClick:H,preventSelection:j,expansionTrigger:z,toggleItemEditing:k}=YB(c),_=i||a||o,P=C.useRef(null),$=V=>{j(V),f&&f(V)},L=V=>{H?.(V,c),!P.current?.contains(V.target)&&(z==="content"&&M(V),D||F(V),d&&d(V))},G=V=>{V.defaultMuiPrevented||k()};return y.jsxs("div",ne({},m,{className:ft(n.root,r,S&&n.expanded,E&&n.selected,x&&n.focused,v&&n.disabled,w&&n.editing,T&&n.editable),onClick:L,onMouseDown:$,ref:t,children:[y.jsx("div",{className:n.iconContainer,children:_}),D&&y.jsx($B,{className:n.checkbox,checked:E,onChange:B,disabled:v||R,ref:P,tabIndex:-1}),w?y.jsx(IDe,ne({},g,{className:n.labelInput})):y.jsx("div",ne({className:n.label},T&&{onDoubleClick:G},{children:l})),h&&y.jsx(MDe,ne({},h))]}))});function NDe(e){return Tt("MuiTreeItem",e)}const Fs=xt("MuiTreeItem",["root","groupTransition","content","expanded","selected","focused","disabled","iconContainer","label","checkbox","labelInput","editable","editing","dragAndDropOverlay"]),QB=dn(y.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),XB=dn(y.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}));function RA(e){const{children:t,itemId:n}=e,{wrapItem:r,instance:o}=Nu();return r({children:t,itemId:n,instance:o})}RA.propTypes={children:Pe.node,itemId:Pe.string.isRequired};const PDe=["children","className","slots","slotProps","ContentComponent","ContentProps","itemId","id","label","onClick","onMouseDown","onFocus","onBlur","onKeyDown"],_De=["ownerState"],LDe=["ownerState"],FDe=["ownerState"],jDe=zB(),BDe=e=>{const{classes:t}=e;return Et({root:["root"],content:["content"],expanded:["expanded"],selected:["selected"],focused:["focused"],disabled:["disabled"],iconContainer:["iconContainer"],checkbox:["checkbox"],label:["label"],labelInput:["labelInput"],editing:["editing"],editable:["editable"],groupTransition:["groupTransition"]},NDe,t)},$De=we("li",{name:"MuiTreeItem",slot:"Root",overridesResolver:(e,t)=>t.root})({listStyle:"none",margin:0,padding:0,outline:0}),zDe=we(KB,{name:"MuiTreeItem",slot:"Content",overridesResolver:(e,t)=>[t.content,t.iconContainer&&{[`& .${Fs.iconContainer}`]:t.iconContainer},t.label&&{[`& .${Fs.label}`]:t.label}],shouldForwardProp:e=>ql(e)&&e!=="indentationAtItemLevel"})(({theme:e})=>({padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius,width:"100%",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",gap:e.spacing(1),cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Fs.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity,backgroundColor:"transparent"},[`&.${Fs.focused}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Fs.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Zr(e.palette.primary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Zr(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Zr(e.palette.primary.main,e.palette.action.selectedOpacity)}},[`&.${Fs.focused}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:Zr(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`& .${Fs.iconContainer}`]:{width:16,display:"flex",flexShrink:0,justifyContent:"center","& svg":{fontSize:18}},[`& .${Fs.label}`]:ne({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative"},e.typography.body1),[`& .${Fs.checkbox}`]:{padding:0},variants:[{props:{indentationAtItemLevel:!0},style:{paddingLeft:`calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`}}]})),UDe=we($m,{name:"MuiTreeItem",slot:"GroupTransition",overridesResolver:(e,t)=>t.groupTransition,shouldForwardProp:e=>ql(e)&&e!=="indentationAtItemLevel"})({margin:0,padding:0,paddingLeft:"var(--TreeView-itemChildrenIndentation)",variants:[{props:{indentationAtItemLevel:!0},style:{paddingLeft:0}}]}),HDe=C.forwardRef(function(e,t){const{icons:n,runItemPlugins:r,items:{disabledItemsFocusable:o,indentationAtItemLevel:a},selection:{disableSelection:i},expansion:{expansionTrigger:l},treeId:c,instance:d}=Nu(),f=C.useContext(AA),h=jDe({props:e,name:"MuiTreeItem"}),{children:g,className:m,slots:v,slotProps:S,ContentComponent:E=KB,ContentProps:x,itemId:w,id:T,label:R,onClick:D,onMouseDown:M,onBlur:F,onKeyDown:B}=h,H=Ot(h,PDe),{expanded:j,focused:z,selected:k,disabled:_,editing:P,handleExpansion:$,handleCancelItemLabelEditing:L,handleSaveItemLabel:G}=YB(w),{contentRef:V,rootRef:Y,propsEnhancers:N}=r(h),q=C.useRef(null),K=C.useRef(null),U=mn(t,Y,q),J=mn(x?.ref,V,K),Z={expandIcon:v?.expandIcon??n.slots.expandIcon??QB,collapseIcon:v?.collapseIcon??n.slots.collapseIcon??XB,endIcon:v?.endIcon??n.slots.endIcon,icon:v?.icon,groupTransition:v?.groupTransition},Q=Se=>Array.isArray(Se)?Se.length>0&&Se.some(Q):!!Se,re=Q(g),te=ne({},h,{expanded:j,focused:z,selected:k,disabled:_,indentationAtItemLevel:a}),ue=BDe(te),fe=Z.groupTransition??void 0,de=hn({elementType:fe,ownerState:{},externalSlotProps:S?.groupTransition,additionalProps:ne({unmountOnExit:!0,in:j,component:"ul",role:"group"},a?{indentationAtItemLevel:!0}:{}),className:ue.groupTransition}),xe=Se=>{l==="iconContainer"&&$(Se)},ae=j?Z.collapseIcon:Z.expandIcon,se=hn({elementType:ae,ownerState:{},externalSlotProps:Se=>j?ne({},Qa(n.slotProps.collapseIcon,Se),Qa(S?.collapseIcon,Se)):ne({},Qa(n.slotProps.expandIcon,Se),Qa(S?.expandIcon,Se)),additionalProps:{onClick:xe}}),je=Ot(se,_De),De=re&&ae?y.jsx(ae,ne({},je)):null,me=re?void 0:Z.endIcon,ve=hn({elementType:me,ownerState:{},externalSlotProps:Se=>re?{}:ne({},Qa(n.slotProps.endIcon,Se),Qa(S?.endIcon,Se))}),Xe=Ot(ve,LDe),Be=me?y.jsx(me,ne({},Xe)):null,Ue=Z.icon,He=hn({elementType:Ue,ownerState:{},externalSlotProps:S?.icon}),Rt=Ot(He,FDe),Mt=Ue?y.jsx(Ue,ne({},Rt)):null;let bt;k?bt=!0:i||_?bt=void 0:bt=!1;function ge(Se){!z&&(!_||o)&&Se.currentTarget===Se.target&&d.focusItem(Se,w)}function Ee(Se){F?.(Se),!(P||Se.relatedTarget&&Um(Se.relatedTarget,q.current)&&(Se.target&&Se.target?.dataset?.element==="labelInput"&&Um(Se.target,q.current)||Se.relatedTarget?.dataset?.element==="labelInput"))&&d.removeFocusedItem()}const Ge=Se=>{B?.(Se),Se.target?.dataset?.element!=="labelInput"&&d.handleItemKeyDown(Se,w)},st=DA({itemId:w,treeId:c,id:T}),ot=d.canItemBeTabbed(w)?0:-1,Ye={rootRefObject:q,contentRefObject:K,interactions:{handleSaveItemLabel:G,handleCancelItemLabelEditing:L}},zt=N.root?.(ne({},Ye,{externalEventHandlers:Io(H)}))??{},Gt=N.content?.(ne({},Ye,{externalEventHandlers:Io(x)}))??{},rt=N.dragAndDropOverlay?.(ne({},Ye,{externalEventHandlers:{}}))??{},he=N.labelInput?.(ne({},Ye,{externalEventHandlers:{}}))??{};return y.jsx(RA,{itemId:w,children:y.jsxs($De,ne({className:ft(ue.root,m),role:"treeitem","aria-expanded":re?j:void 0,"aria-selected":bt,"aria-disabled":_||void 0,id:st,tabIndex:ot},H,{ownerState:te,onFocus:ge,onBlur:Ee,onKeyDown:Ge,ref:U,style:a?ne({},H.style,{"--TreeView-itemDepth":typeof f=="function"?f(w):f}):H.style},zt,{children:[y.jsx(zDe,ne({as:E,classes:{root:ue.content,expanded:ue.expanded,selected:ue.selected,focused:ue.focused,disabled:ue.disabled,editable:ue.editable,editing:ue.editing,iconContainer:ue.iconContainer,label:ue.label,labelInput:ue.labelInput,checkbox:ue.checkbox},label:R,itemId:w,onClick:D,onMouseDown:M,icon:Mt,expansionIcon:De,displayIcon:Be,ownerState:te},x,Gt,rt.action==null?{}:{dragAndDropOverlayProps:rt},he.value==null?{}:{labelInputProps:he},{ref:J})),g&&y.jsx(UDe,ne({as:fe},de,{children:g}))]}))})});function VDe(e){const{slots:t,slotProps:n,status:r}=e,o=Nu(),a=ne({},o.icons.slots,{expandIcon:o.icons.slots.expandIcon??QB,collapseIcon:o.icons.slots.collapseIcon??XB}),i=o.icons.slotProps;let l;t?.icon?l="icon":r.expandable?r.expanded?l="collapseIcon":l="expandIcon":l="endIcon";const c=t?.[l]??a[l],d=hn({elementType:c,externalSlotProps:f=>ne({},Qa(i[l],f),Qa(n?.[l],f)),ownerState:{}});return c?y.jsx(c,ne({},d)):null}const WDe=["visible"],qDe=we("li",{name:"MuiTreeItem2",slot:"Root",overridesResolver:(e,t)=>t.root})({listStyle:"none",margin:0,padding:0,outline:0}),GDe=we("div",{name:"MuiTreeItem2",slot:"Content",overridesResolver:(e,t)=>t.content,shouldForwardProp:e=>ql(e)&&e!=="status"&&e!=="indentationAtItemLevel"})(({theme:e})=>({padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius,width:"100%",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",gap:e.spacing(1),cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},variants:[{props:{indentationAtItemLevel:!0},style:{paddingLeft:`calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`}},{props:({status:t})=>t.disabled,style:{opacity:(e.vars||e).palette.action.disabledOpacity,backgroundColor:"transparent"}},{props:({status:t})=>t.focused,style:{backgroundColor:(e.vars||e).palette.action.focus}},{props:({status:t})=>t.selected,style:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Zr(e.palette.primary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Zr(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Zr(e.palette.primary.main,e.palette.action.selectedOpacity)}}}},{props:({status:t})=>t.selected&&t.focused,style:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:Zr(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}}]})),YDe=we("div",{name:"MuiTreeItem2",slot:"Label",overridesResolver:(e,t)=>t.label,shouldForwardProp:e=>ql(e)&&e!=="editable"})(({theme:e})=>ne({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative",overflow:"hidden"},e.typography.body1,{variants:[{props:({editable:t})=>t,style:{paddingLeft:"2px"}}]})),KDe=we("div",{name:"MuiTreeItem2",slot:"IconContainer",overridesResolver:(e,t)=>t.iconContainer})({width:16,display:"flex",flexShrink:0,justifyContent:"center","& svg":{fontSize:18}});we($m,{name:"MuiTreeItem2",slot:"GroupTransition",overridesResolver:(e,t)=>t.groupTransition,shouldForwardProp:e=>ql(e)&&e!=="indentationAtItemLevel"})({margin:0,padding:0,paddingLeft:"var(--TreeView-itemChildrenIndentation)",variants:[{props:{indentationAtItemLevel:!0},style:{paddingLeft:0}}]});we(C.forwardRef((e,t)=>{const{visible:n}=e,r=Ot(e,WDe);return n?y.jsx($B,ne({},r,{ref:t})):null}),{name:"MuiTreeItem2",slot:"Checkbox",overridesResolver:(e,t)=>t.checkbox})({padding:0});function QDe(e){return Tt("MuiRichTreeView",e)}xt("MuiRichTreeView",["root"]);const XDe=(e,t)=>{const n=C.useRef({}),[r,o]=C.useState(()=>{const a={};return e.forEach(i=>{i.models&&Object.entries(i.models).forEach(([l,c])=>{n.current[l]={isControlled:t[l]!==void 0,getDefaultValue:c.getDefaultValue},a[l]=c.getDefaultValue(t)})}),a});return Object.fromEntries(Object.entries(n.current).map(([a,i])=>{const l=t[a]??r[a];return[a,{value:l,setControlledValue:c=>{i.isControlled||o(d=>ne({},d,{[a]:c}))}}]}))};class ZDe{constructor(){this.maxListeners=20,this.warnOnce=!1,this.events={}}on(t,n,r={}){let o=this.events[t];o||(o={highPriority:new Map,regular:new Map},this.events[t]=o),r.isFirst?o.highPriority.set(n,!0):o.regular.set(n,!0)}removeListener(t,n){this.events[t]&&(this.events[t].regular.delete(n),this.events[t].highPriority.delete(n))}removeAllListeners(){this.events={}}emit(t,...n){const r=this.events[t];if(!r)return;const o=Array.from(r.highPriority.keys()),a=Array.from(r.regular.keys());for(let i=o.length-1;i>=0;i-=1){const l=o[i];r.highPriority.has(l)&&l.apply(this,n)}for(let i=0;i<a.length;i+=1){const l=a[i];r.regular.has(l)&&l.apply(this,n)}}once(t,n){const r=this;this.on(t,function o(...a){r.removeListener(t,o),n.apply(r,a)})}}const JDe=e=>e.isPropagationStopped!==void 0,ZB=()=>{const[e]=C.useState(()=>new ZDe),t=C.useCallback((...r)=>{const[o,a,i={}]=r;i.defaultMuiPrevented=!1,!(JDe(i)&&i.isPropagationStopped())&&e.emit(o,a,i)},[e]),n=C.useCallback((r,o)=>(e.on(r,o),()=>{e.removeListener(r,o)}),[e]);return{instance:{$$publishEvent:t,$$subscribeEvent:n}}};ZB.params={};const JB=({plugins:e})=>{const t=new Set(e);return{instance:{getAvailablePlugins:()=>t}}};JB.params={};const MA=({params:e,state:t,setState:n})=>{C.useEffect(()=>{n(o=>o.id.treeId===e.id&&o.id.treeId!==void 0?o:ne({},o,{id:ne({},o.id,{treeId:e.id??kDe()})}))},[n,e.id]);const r=e.id??t.id.treeId;return{getRootProps:()=>({id:r}),contextValue:{treeId:r}}};MA.params={id:!0};MA.getInitialState=({id:e})=>({id:{treeId:e??void 0}});const eRe=[ZB,JB,MA],tRe=["slots","slotProps","apiRef","experimentalFeatures"],nRe=e=>{let{props:{slots:t,slotProps:n,apiRef:r,experimentalFeatures:o},plugins:a}=e,i=Ot(e.props,tRe);const l={};a.forEach(g=>{Object.assign(l,g.params)});const c={},d={};Object.keys(i).forEach(g=>{const m=i[g];l[g]?c[g]=m:d[g]=m});const f=o??{},h=a.reduce((g,m)=>m.getDefaultizedParams?m.getDefaultizedParams({params:g,experimentalFeatures:f}):g,c);return{apiRef:r,forwardedProps:d,pluginParams:h,slots:t??{},slotProps:n??{},experimentalFeatures:f}},rRe=({plugins:e,instance:t,publicAPI:n,rootRef:r})=>({runItemPlugins:o=>{let a=null,i=null;const l=[],c={};e.forEach(h=>{if(!h.itemPlugin)return;const g=h.itemPlugin({props:o,rootRef:a,contentRef:i});g?.rootRef&&(a=g.rootRef),g?.contentRef&&(i=g.contentRef),g?.propsEnhancers&&(l.push(g.propsEnhancers),Object.keys(g.propsEnhancers).forEach(m=>{c[m]=!0}))});const d=h=>g=>{const m={};return l.forEach(v=>{const S=v[h];S!=null&&Object.assign(m,S(g))}),m},f=Object.fromEntries(Object.keys(c).map(h=>[h,d(h)]));return{contentRef:i,rootRef:a,propsEnhancers:f}},wrapItem:({itemId:o,children:a})=>{let i=a;for(let l=e.length-1;l>=0;l-=1){const c=e[l];c.wrapItem&&(i=c.wrapItem({itemId:o,children:i,instance:t}))}return i},wrapRoot:({children:o})=>{let a=o;for(let i=e.length-1;i>=0;i-=1){const l=e[i];l.wrapRoot&&(a=l.wrapRoot({children:a,instance:t}))}return a},instance:t,rootRef:r,publicAPI:n});function oRe(e){const t=C.useRef({});return e?(e.current==null&&(e.current={}),e.current):t.current}const aRe=({plugins:e,rootRef:t,props:n})=>{const r=[...eRe,...e],{pluginParams:o,forwardedProps:a,apiRef:i,experimentalFeatures:l,slots:c,slotProps:d}=nRe({plugins:r,props:n}),f=XDe(r,o),h=C.useRef({}).current,g=oRe(i),m=C.useRef(null),v=mn(m,t),S=rRe({plugins:r,instance:h,publicAPI:g,rootRef:m}),[E,x]=C.useState(()=>{const R={};return r.forEach(D=>{D.getInitialState&&Object.assign(R,D.getInitialState(o))}),R}),w=[],T=R=>{const D=R({instance:h,params:o,slots:c,slotProps:d,experimentalFeatures:l,state:E,setState:x,rootRef:m,models:f,plugins:r});D.getRootProps&&w.push(D.getRootProps),D.publicAPI&&Object.assign(g,D.publicAPI),D.instance&&Object.assign(h,D.instance),D.contextValue&&Object.assign(S,D.contextValue)};return r.forEach(T),{getRootProps:(R={})=>{const D=ne({role:"tree"},a,R,{ref:v});return w.forEach(M=>{Object.assign(D,M(R))}),D},rootRef:v,contextValue:S,instance:h}},iRe=(e,t,n)=>{e.$$publishEvent(t,n)},Bd="__TREE_VIEW_ROOT_PARENT_ID__",sRe=e=>{const t={};return e.forEach((n,r)=>{t[n]=r}),t},lRe=["children"],e8=({items:e,isItemDisabled:t,getItemLabel:n,getItemId:r})=>{const o={},a={},i={[Bd]:[]},l=(d,f,h)=>{const g=r?r(d):d.id;if(g==null)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.","An item was provided without id in the `items` prop:",JSON.stringify(d)].join(`
454
454
  `));if(o[g]!=null)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.",`Two items were provided with the same id in the \`items\` prop: "${g}"`].join(`
455
455
  `));const m=n?n(d):d.label;if(m==null)throw new Error(["MUI X: The Tree View component requires all items to have a `label` property.","Alternatively, you can use the `getItemLabel` prop to specify a custom label for each item.","An item was provided without label in the `items` prop:",JSON.stringify(d)].join(`
456
- `));o[g]={id:g,label:m,parentId:h,idAttribute:void 0,expandable:!!d.children?.length,disabled:t?t(d):!1,depth:f},a[g]=d;const v=h??Bd;i[v]||(i[v]=[]),i[v].push(g),d.children?.forEach(S=>l(S,f+1,g))};e.forEach(d=>l(d,0,null));const c={};return Object.keys(i).forEach(d=>{c[d]=sRe(i[d])}),{itemMetaMap:o,itemMap:a,itemOrderedChildrenIds:i,itemChildrenIndexes:c}},Eg=({instance:e,params:t,state:n,setState:r,experimentalFeatures:o})=>{const a=C.useCallback(E=>n.items.itemMetaMap[E],[n.items.itemMetaMap]),i=C.useCallback(E=>n.items.itemMap[E],[n.items.itemMap]),l=C.useCallback(()=>{const E=x=>{const w=n.items.itemMap[x],T=Ot(w,lRe),R=n.items.itemOrderedChildrenIds[x];return R&&(T.children=R.map(E)),T};return n.items.itemOrderedChildrenIds[Bd].map(E)},[n.items.itemMap,n.items.itemOrderedChildrenIds]),c=C.useCallback(E=>{if(E==null)return!1;let x=e.getItemMeta(E);if(!x)return!1;if(x.disabled)return!0;for(;x.parentId!=null;)if(x=e.getItemMeta(x.parentId),x.disabled)return!0;return!1},[e]),d=C.useCallback(E=>{const x=e.getItemMeta(E).parentId??Bd;return n.items.itemChildrenIndexes[x][E]},[e,n.items.itemChildrenIndexes]),f=C.useCallback(E=>n.items.itemOrderedChildrenIds[E??Bd]??[],[n.items.itemOrderedChildrenIds]),h=E=>{const x=e.getItemMeta(E);return x==null?null:document.getElementById(DA({treeId:n.id.treeId,itemId:E,id:x.idAttribute}))},g=E=>t.disabledItemsFocusable?!0:!e.isItemDisabled(E),m=C.useRef(!1),v=C.useCallback(()=>{m.current=!0},[]),S=C.useCallback(()=>m.current,[]);return C.useEffect(()=>{e.areItemUpdatesPrevented()||r(E=>{const x=e8({items:t.items,isItemDisabled:t.isItemDisabled,getItemId:t.getItemId,getItemLabel:t.getItemLabel});return Object.values(E.items.itemMetaMap).forEach(w=>{x.itemMetaMap[w.id]||iRe(e,"removeItem",{id:w.id})}),ne({},E,{items:x})})},[e,r,t.items,t.isItemDisabled,t.getItemId,t.getItemLabel]),{getRootProps:()=>({style:{"--TreeView-itemChildrenIndentation":typeof t.itemChildrenIndentation=="number"?`${t.itemChildrenIndentation}px`:t.itemChildrenIndentation}}),publicAPI:{getItem:i,getItemDOMElement:h,getItemTree:l,getItemOrderedChildrenIds:f},instance:{getItemMeta:a,getItem:i,getItemTree:l,getItemsToRender:()=>{const E=x=>{const w=n.items.itemMetaMap[x];return{label:w.label,itemId:w.id,id:w.idAttribute,children:n.items.itemOrderedChildrenIds[x]?.map(E)}};return n.items.itemOrderedChildrenIds[Bd].map(E)},getItemIndex:d,getItemDOMElement:h,getItemOrderedChildrenIds:f,isItemDisabled:c,isItemNavigable:g,preventItemUpdates:v,areItemUpdatesPrevented:S},contextValue:{items:{onItemClick:t.onItemClick,disabledItemsFocusable:t.disabledItemsFocusable,indentationAtItemLevel:o.indentationAtItemLevel??!1}}}};Eg.getInitialState=e=>({items:e8({items:e.items,isItemDisabled:e.isItemDisabled,getItemId:e.getItemId,getItemLabel:e.getItemLabel})});Eg.getDefaultizedParams=({params:e})=>ne({},e,{disabledItemsFocusable:e.disabledItemsFocusable??!1,itemChildrenIndentation:e.itemChildrenIndentation??"12px"});Eg.wrapRoot=({children:e,instance:t})=>y.jsx(AA.Provider,{value:n=>t.getItemMeta(n)?.depth??0,children:e});Eg.params={disabledItemsFocusable:!0,items:!0,isItemDisabled:!0,getItemLabel:!0,getItemId:!0,onItemClick:!0,itemChildrenIndentation:!0};const p1=({instance:e,params:t,models:n})=>{const r=C.useMemo(()=>{const h=new Map;return n.expandedItems.value.forEach(g=>{h.set(g,!0)}),h},[n.expandedItems.value]),o=(h,g)=>{t.onExpandedItemsChange?.(h,g),n.expandedItems.setControlledValue(g)},a=C.useCallback(h=>r.has(h),[r]),i=C.useCallback(h=>!!e.getItemMeta(h)?.expandable,[e]),l=dt((h,g)=>{const m=e.isItemExpanded(g);e.setItemExpansion(h,g,!m)}),c=dt((h,g,m)=>{if(e.isItemExpanded(g)===m)return;let v;m?v=[g].concat(n.expandedItems.value):v=n.expandedItems.value.filter(S=>S!==g),t.onItemExpansionToggle&&t.onItemExpansionToggle(h,g,m),o(h,v)}),d=(h,g)=>{const m=e.getItemMeta(g),v=e.getItemOrderedChildrenIds(m.parentId).filter(E=>e.isItemExpandable(E)&&!e.isItemExpanded(E)),S=n.expandedItems.value.concat(v);v.length>0&&(t.onItemExpansionToggle&&v.forEach(E=>{t.onItemExpansionToggle(h,E,!0)}),o(h,S))},f=C.useMemo(()=>t.expansionTrigger?t.expansionTrigger:e.isTreeViewEditable?"iconContainer":"content",[t.expansionTrigger,e.isTreeViewEditable]);return{publicAPI:{setItemExpansion:c},instance:{isItemExpanded:a,isItemExpandable:i,setItemExpansion:c,toggleItemExpansion:l,expandAllSiblings:d},contextValue:{expansion:{expansionTrigger:f}}}};p1.models={expandedItems:{getDefaultValue:e=>e.defaultExpandedItems}};const cRe=[];p1.getDefaultizedParams=({params:e})=>ne({},e,{defaultExpandedItems:e.defaultExpandedItems??cRe});p1.params={expandedItems:!0,defaultExpandedItems:!0,onExpandedItemsChange:!0,onItemExpansionToggle:!0,expansionTrigger:!0};const Wb=e=>Array.isArray(e)?e:e!=null?[e]:[],GE=e=>{const t={};return e.forEach(n=>{t[n]=!0}),t},h1=({instance:e,params:t,models:n})=>{const r=C.useRef(null),o=C.useRef({}),a=C.useMemo(()=>{const f=new Map;return Array.isArray(n.selectedItems.value)?n.selectedItems.value.forEach(h=>{f.set(h,!0)}):n.selectedItems.value!=null&&f.set(n.selectedItems.value,!0),f},[n.selectedItems.value]),i=(f,h)=>{if(t.onItemSelectionToggle)if(t.multiSelect){const g=h.filter(v=>!e.isItemSelected(v)),m=n.selectedItems.value.filter(v=>!h.includes(v));g.forEach(v=>{t.onItemSelectionToggle(f,v,!0)}),m.forEach(v=>{t.onItemSelectionToggle(f,v,!1)})}else h!==n.selectedItems.value&&(n.selectedItems.value!=null&&t.onItemSelectionToggle(f,n.selectedItems.value,!1),h!=null&&t.onItemSelectionToggle(f,h,!0));t.onSelectedItemsChange&&t.onSelectedItemsChange(f,h),n.selectedItems.setControlledValue(h)},l=f=>a.has(f),c=({event:f,itemId:h,keepExistingSelection:g=!1,shouldBeSelected:m})=>{if(t.disableSelection)return;let v;if(g){const S=Wb(n.selectedItems.value),E=e.isItemSelected(h);E&&(m===!1||m==null)?v=S.filter(x=>x!==h):!E&&(m===!0||m==null)?v=[h].concat(S):v=S}else m===!1||m==null&&e.isItemSelected(h)?v=t.multiSelect?[]:null:v=t.multiSelect?[h]:h;i(f,v),r.current=h,o.current={}},d=(f,[h,g])=>{if(t.disableSelection||!t.multiSelect)return;let m=Wb(n.selectedItems.value).slice();Object.keys(o.current).length>0&&(m=m.filter(x=>!o.current[x]));const v=GE(m),S=TDe(e,h,g),E=S.filter(x=>!v[x]);m=m.concat(E),i(f,m),o.current=GE(S)};return{getRootProps:()=>({"aria-multiselectable":t.multiSelect}),publicAPI:{selectItem:c},instance:{isItemSelected:l,selectItem:c,selectAllNavigableItems:f=>{if(t.disableSelection||!t.multiSelect)return;const h=wDe(e);i(f,h),o.current=GE(h)},expandSelectionRange:(f,h)=>{if(r.current!=null){const[g,m]=GB(e,h,r.current);d(f,[g,m])}},selectRangeFromStartToItem:(f,h)=>{d(f,[zm(e),h])},selectRangeFromItemToEnd:(f,h)=>{d(f,[h,qB(e)])},selectItemFromArrowNavigation:(f,h,g)=>{if(t.disableSelection||!t.multiSelect)return;let m=Wb(n.selectedItems.value).slice();Object.keys(o.current).length===0?(m.push(g),o.current={[h]:!0,[g]:!0}):(o.current[h]||(o.current={}),o.current[g]?(m=m.filter(v=>v!==h),delete o.current[h]):(m.push(g),o.current[g]=!0)),i(f,m)}},contextValue:{selection:{multiSelect:t.multiSelect,checkboxSelection:t.checkboxSelection,disableSelection:t.disableSelection}}}};h1.models={selectedItems:{getDefaultValue:e=>e.defaultSelectedItems}};const uRe=[];h1.getDefaultizedParams=({params:e})=>ne({},e,{disableSelection:e.disableSelection??!1,multiSelect:e.multiSelect??!1,checkboxSelection:e.checkboxSelection??!1,defaultSelectedItems:e.defaultSelectedItems??(e.multiSelect?uRe:null)});h1.params={disableSelection:!0,multiSelect:!0,checkboxSelection:!0,defaultSelectedItems:!0,selectedItems:!0,onSelectedItemsChange:!0,onItemSelectionToggle:!0};const G5=1e3;class dRe{constructor(t=G5){this.timeouts=new Map,this.cleanupTimeout=G5,this.cleanupTimeout=t}register(t,n,r){this.timeouts||(this.timeouts=new Map);const o=setTimeout(()=>{typeof n=="function"&&n(),this.timeouts.delete(r.cleanupToken)},this.cleanupTimeout);this.timeouts.set(r.cleanupToken,o)}unregister(t){const n=this.timeouts.get(t.cleanupToken);n&&(this.timeouts.delete(t.cleanupToken),clearTimeout(n))}reset(){this.timeouts&&(this.timeouts.forEach((t,n)=>{this.unregister({cleanupToken:n})}),this.timeouts=void 0)}}class fRe{constructor(){this.registry=new FinalizationRegistry(t=>{typeof t=="function"&&t()})}register(t,n,r){this.registry.register(t,n,r)}unregister(t){this.registry.unregister(t)}reset(){}}class pRe{}function hRe(e){let t=0;return function(n,r,o){e.registry===null&&(e.registry=typeof FinalizationRegistry<"u"?new fRe:new dRe);const[a]=C.useState(new pRe),i=C.useRef(null),l=C.useRef(void 0);l.current=o;const c=C.useRef(null);if(!i.current&&l.current){const d=(f,h)=>{h.defaultMuiPrevented||l.current?.(f,h)};i.current=n.$$subscribeEvent(r,d),t+=1,c.current={cleanupToken:t},e.registry.register(a,()=>{i.current?.(),i.current=null,c.current=null},c.current)}else!l.current&&i.current&&(i.current(),i.current=null,c.current&&(e.registry.unregister(c.current),c.current=null));C.useEffect(()=>{if(!i.current&&l.current){const d=(f,h)=>{h.defaultMuiPrevented||l.current?.(f,h)};i.current=n.$$subscribeEvent(r,d)}return c.current&&e.registry&&(e.registry.unregister(c.current),c.current=null),()=>{i.current?.(),i.current=null}},[n,r])}}const mRe={registry:null},gRe=hRe(mRe),t8=(e=document)=>{const t=e.activeElement;return t?t.shadowRoot?t8(t.shadowRoot):t:null},yRe=(e,t)=>{let n=Wb(t).find(r=>{if(!e.isItemNavigable(r))return!1;const o=e.getItemMeta(r);return o&&(o.parentId==null||e.isItemExpanded(o.parentId))});return n==null&&(n=zm(e)),n},IA=({instance:e,params:t,state:n,setState:r,models:o,rootRef:a})=>{const i=yRe(e,o.selectedItems.value),l=dt(E=>{const x=typeof E=="function"?E(n.focusedItemId):E;n.focusedItemId!==x&&r(w=>ne({},w,{focusedItemId:x}))}),c=C.useCallback(()=>!!a.current&&a.current.contains(t8(Yr(a.current))),[a]),d=C.useCallback(E=>n.focusedItemId===E&&c(),[n.focusedItemId,c]),f=E=>{const x=e.getItemMeta(E);return x&&(x.parentId==null||e.isItemExpanded(x.parentId))},h=(E,x)=>{const w=e.getItemDOMElement(x);w&&w.focus(),l(x),t.onItemFocus&&t.onItemFocus(E,x)},g=dt((E,x)=>{f(x)&&h(E,x)}),m=dt(()=>{if(n.focusedItemId!=null){if(e.getItemMeta(n.focusedItemId)){const E=e.getItemDOMElement(n.focusedItemId);E&&E.blur()}l(null)}}),v=E=>E===i;gRe(e,"removeItem",({id:E})=>{n.focusedItemId===E&&h(null,i)});const S=E=>x=>{E.onFocus?.(x),!x.defaultMuiPrevented&&x.target===x.currentTarget&&h(x,i)};return{getRootProps:E=>({onFocus:S(E)}),publicAPI:{focusItem:g},instance:{isItemFocused:d,canItemBeTabbed:v,focusItem:g,removeFocusedItem:m}}};IA.getInitialState=()=>({focusedItemId:null});IA.params={onItemFocus:!0};function bRe(e){return!!e&&e.length===1&&!!e.match(/\S/)}const n8=({instance:e,params:t,state:n})=>{const r=di(),o=C.useRef({}),a=dt(d=>{o.current=d(o.current)});C.useEffect(()=>{if(e.areItemUpdatesPrevented())return;const d={},f=h=>{d[h.id]=h.label.substring(0,1).toLowerCase()};Object.values(n.items.itemMetaMap).forEach(f),o.current=d},[n.items.itemMetaMap,t.getItemId,e]);const i=(d,f)=>{const h=f.toLowerCase(),g=E=>{const x=Vb(e,E);return x===null?zm(e):x};let m=null,v=g(d);const S={};for(;m==null&&!S[v];)o.current[v]===h?m=v:(S[v]=!0,v=g(v));return m},l=d=>!t.disableSelection&&!e.isItemDisabled(d),c=d=>!e.isItemDisabled(d)&&e.isItemExpandable(d);return{instance:{updateFirstCharMap:a,handleItemKeyDown:(d,f)=>{if(d.defaultMuiPrevented||d.altKey||Um(d.target,d.currentTarget))return;const h=d.ctrlKey||d.metaKey,g=d.key;switch(!0){case(g===" "&&l(f)):{d.preventDefault(),t.multiSelect&&d.shiftKey?e.expandSelectionRange(d,f):e.selectItem({event:d,itemId:f,keepExistingSelection:t.multiSelect,shouldBeSelected:t.multiSelect?void 0:!0});break}case g==="Enter":{iu(e,ni)&&e.isItemEditable(f)&&!e.isItemBeingEdited(f)?e.setEditedItemId(f):c(f)?(e.toggleItemExpansion(d,f),d.preventDefault()):l(f)&&(t.multiSelect?(d.preventDefault(),e.selectItem({event:d,itemId:f,keepExistingSelection:!0})):e.isItemSelected(f)||(e.selectItem({event:d,itemId:f}),d.preventDefault()));break}case g==="ArrowDown":{const m=Vb(e,f);m&&(d.preventDefault(),e.focusItem(d,m),t.multiSelect&&d.shiftKey&&l(m)&&e.selectItemFromArrowNavigation(d,f,m));break}case g==="ArrowUp":{const m=WB(e,f);m&&(d.preventDefault(),e.focusItem(d,m),t.multiSelect&&d.shiftKey&&l(m)&&e.selectItemFromArrowNavigation(d,f,m));break}case(g==="ArrowRight"&&!r||g==="ArrowLeft"&&r):{if(h)return;if(e.isItemExpanded(f)){const m=Vb(e,f);m&&(e.focusItem(d,m),d.preventDefault())}else c(f)&&(e.toggleItemExpansion(d,f),d.preventDefault());break}case(g==="ArrowLeft"&&!r||g==="ArrowRight"&&r):{if(h)return;if(c(f)&&e.isItemExpanded(f))e.toggleItemExpansion(d,f),d.preventDefault();else{const m=e.getItemMeta(f).parentId;m&&(e.focusItem(d,m),d.preventDefault())}break}case g==="Home":{l(f)&&t.multiSelect&&h&&d.shiftKey?e.selectRangeFromStartToItem(d,f):e.focusItem(d,zm(e)),d.preventDefault();break}case g==="End":{l(f)&&t.multiSelect&&h&&d.shiftKey?e.selectRangeFromItemToEnd(d,f):e.focusItem(d,qB(e)),d.preventDefault();break}case g==="*":{e.expandAllSiblings(d,f),d.preventDefault();break}case(String.fromCharCode(d.keyCode)==="A"&&h&&t.multiSelect&&!t.disableSelection):{e.selectAllNavigableItems(d),d.preventDefault();break}case(!h&&!d.shiftKey&&bRe(g)):{const m=i(f,g);m!=null&&(e.focusItem(d,m),d.preventDefault());break}}}}}};n8.params={};const r8=({slots:e,slotProps:t})=>({contextValue:{icons:{slots:{collapseIcon:e.collapseIcon,expandIcon:e.expandIcon,endIcon:e.endIcon},slotProps:{collapseIcon:t.collapseIcon,expandIcon:t.expandIcon,endIcon:t.endIcon}}}});r8.params={};const vRe=[Eg,p1,h1,IA,n8,r8,ni],xRe=["ownerState"];function SRe({slots:e,slotProps:t,label:n,id:r,itemId:o,itemsToRender:a}){const i=e?.item??HDe,l=hn({elementType:i,externalSlotProps:t?.item,additionalProps:{itemId:o,id:r,label:n},ownerState:{itemId:o,label:n}}),c=Ot(l,xRe),d=C.useMemo(()=>a?y.jsx(o8,{itemsToRender:a,slots:e,slotProps:t}):null,[a,e,t]);return y.jsx(i,ne({},c,{children:d}))}function o8(e){const{itemsToRender:t,slots:n,slotProps:r}=e;return y.jsx(C.Fragment,{children:t.map(o=>y.jsx(SRe,{slots:n,slotProps:r,label:o.label,id:o.id,itemId:o.itemId,itemsToRender:o.children},o.itemId))})}const ERe=zB(),CRe=e=>{const{classes:t}=e;return Et({root:["root"]},QDe,t)},TRe=we("ul",{name:"MuiRichTreeView",slot:"Root",overridesResolver:(e,t)=>t.root})({padding:0,margin:0,listStyle:"none",outline:0,position:"relative"}),wRe=C.forwardRef(function(e,t){const n=ERe({props:e,name:"MuiRichTreeView"}),{getRootProps:r,contextValue:o,instance:a}=aRe({plugins:vRe,rootRef:t,props:n}),{slots:i,slotProps:l}=n,c=CRe(n),d=i?.root??TRe,f=hn({elementType:d,externalSlotProps:l?.root,className:c.root,getSlotProps:r,ownerState:n});return y.jsx(SDe,{value:o,children:y.jsx(d,ne({},f,{children:y.jsx(o8,{slots:i,slotProps:l,itemsToRender:a.getItemsToRender()})}))})}),kRe=dn(y.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),ARe=dn([y.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),y.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),DRe=dn(y.jsx("path",{d:"M19 15v4H5v-4zm1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1M7 18.5c-.82 0-1.5-.67-1.5-1.5s.68-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5M19 5v4H5V5zm1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1M7 8.5c-.82 0-1.5-.67-1.5-1.5S6.18 5.5 7 5.5s1.5.68 1.5 1.5S7.83 8.5 7 8.5"})),RRe=dn(y.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"}));function a8({items:e,defaultExpandedItems:t,onClickTreeNode:n}){return y.jsx(wRe,{items:PRe(e,n),defaultExpandedItems:t,slots:{item:NRe}})}const MRe=yoe($m);function IRe(e){const t=roe({to:{opacity:e.in?1:0,transform:`translate3d(0,${e.in?0:20}px,0)`}});return y.jsx(MRe,{style:t,...e})}function ORe({item:e,...t}){const n=y.jsxs(YDe,{...t,sx:{display:"flex",alignItems:"center",color:e.error?"error.main":"grey.600"},children:[e.fileType==="directory"&&y.jsx(kRe,{})||e.fileType==="notebook"&&y.jsx(ARe,{})||e.fileType==="model"&&y.jsx(RRe,{})||e.fileType=="database"&&y.jsx(DRe,{})||y.jsx(jB,{}),y.jsx(mt,{variant:"body2",sx:{marginLeft:"5px"},color:e.error?"error.main":e.link?"primary.main":"grey.600",children:e.label})]});return e.error?y.jsx(ma,{title:e.error,placement:"right",children:n}):n}const NRe=C.forwardRef(function(e,t){const{id:n,itemId:r,label:o,children:a,disabled:i,...l}=e,{getRootProps:c,getContentProps:d,getLabelProps:f,getIconContainerProps:h,getGroupTransitionProps:g,status:m,publicAPI:v}=DDe({id:n,itemId:r,children:a,label:o,disabled:i,rootRef:t}),S=v.getItem(r);return m.selected=!1,m.focused=!1,y.jsx(RA,{itemId:r,children:y.jsxs(qDe,{...c(l),children:[y.jsxs(GDe,{...d(),...S.link&&{onClick:E=>S.link(E)},sx:{pointerEvents:!S.selectable&&"none"},children:[y.jsx(KDe,{...h(),children:y.jsx(VDe,{status:m})}),y.jsx(ORe,{...f({item:S})})]}),a&&y.jsx(IRe,{...g()})]})})});function PRe(e,t){const n=new Map;return e.map(r=>{let o=n;const a=r.path.split("/");a.forEach((i,l)=>{l===a.length-1?o.set(i,r):(o.has(i)||o.set(i,new Map),o=o.get(i))})}),i8(n,"",t)}function i8(e,t,n){const r=[];return e.forEach((o,a)=>{const i=a.endsWith(".malloy")&&"model"||a.endsWith(".malloynb")&&"notebook"||a.endsWith(".parquet")&&"database"||"unknown";if(i!=="unknown"){const l=o;r.push({id:t+a,label:a,fileType:i,link:i==="model"||i==="notebook"?c=>n(t+a,c):void 0,selectable:i==="model"||i==="notebook",error:"error"in l?l.error:void 0})}else{const l=t+a+"/";r.push({id:l,label:a,fileType:"directory",selectable:!0,link:void 0,children:i8(o,l,n)})}}),r}const _Re=["notebooks/","models/"];function LRe({onClickModelFile:e,resourceUri:t}){const{projectName:n,packageName:r,versionId:o}=Dr(t),{apiClients:a}=Yn(),{data:i,isError:l,error:c,isSuccess:d}=Do({queryKey:["models",n,r,o],queryFn:()=>a.models.listModels(n,r,o)});return y.jsx(uc,{children:y.jsxs(dc,{children:[y.jsx(ku,{children:"Semantic Models"}),y.jsxs(Bt,{sx:{maxHeight:"200px",overflowY:"auto"},children:[!d&&!l&&y.jsx(Lo,{text:"Fetching Models..."}),l&&y.jsx(wo,{error:c,context:`${n} > ${r} > Models`}),d&&i.data.length>0&&y.jsx(a8,{items:i.data.sort((f,h)=>f.path.localeCompare(h.path)),onClickTreeNode:e,defaultExpandedItems:_Re}),d&&i.data.length===0&&y.jsx(mt,{variant:"body2",children:"No models found"})]})]})})}const FRe=["notebooks/"];function jRe({onClickNotebookFile:e,resourceUri:t}){const{apiClients:n}=Yn(),{projectName:r,packageName:o,versionId:a}=Dr(t),{data:i,isError:l,error:c,isSuccess:d}=Do({queryKey:["notebooks",r,o,a],queryFn:()=>n.notebooks.listNotebooks(r,o,a)});return y.jsx(uc,{children:y.jsxs(dc,{children:[y.jsx(ku,{children:"Notebooks"}),y.jsxs(Bt,{sx:{maxHeight:"200px",overflowY:"auto"},children:[!d&&!l&&y.jsx(Lo,{text:"Fetching Notebooks..."}),l&&y.jsx(wo,{error:c,context:`${r} > ${o} > Notebooks`}),d&&i.data.length>0&&y.jsx(a8,{items:i.data.sort((f,h)=>f.path.localeCompare(h.path)),defaultExpandedItems:FRe,onClickTreeNode:e}),d&&i.data.length===0&&y.jsx(mt,{variant:"body2",children:"No notebooks found"})]})]})})}const BRe="README.malloynb";function HMe({onClickPackageFile:e,resourceUri:t,retrievalFn:n}){e||(e=o=>{window.location.href=o});const r=Zk({...Dr(t),modelPath:BRe});return y.jsx(y.Fragment,{children:y.jsxs(Lr,{container:!0,spacing:3,columns:12,children:[y.jsx(Lr,{size:{xs:12,md:4},children:y.jsx(H2e,{resourceUri:t})}),y.jsx(Lr,{size:{xs:12,md:4},children:y.jsx(jRe,{onClickNotebookFile:e,resourceUri:t})}),y.jsx(Lr,{size:{xs:12,md:4},children:y.jsx(LRe,{onClickModelFile:e,resourceUri:t})}),y.jsx(Lr,{size:{xs:12,md:6},children:y.jsx(tDe,{resourceUri:t})}),y.jsx(Lr,{size:{xs:12,md:6},children:y.jsx(eDe,{resourceUri:t})}),y.jsx(Lr,{size:{xs:12,md:12},children:y.jsx(uc,{children:y.jsxs(dc,{children:[y.jsx(ku,{children:"README"}),y.jsx(Bt,{sx:{mt:1},children:y.jsx(U2e,{resourceUri:r,retrievalFn:n})})]})})})]})})}function $Re({resourceUri:e}){const{projectName:t}=Dr(e),{apiClients:n}=Yn(),[r,o]=C.useState(!1),a=90,{data:i,isSuccess:l,isError:c,error:d}=Do({queryKey:["about",t],queryFn:()=>n.projects.getProject(t,!1)}),f=i?.data?.readme||"",h=f.split(/\s+/),g=h.length>a,m=h.slice(0,a).join(" ");return y.jsxs(y.Fragment,{children:[!l&&!c&&y.jsx(Lo,{text:"Fetching About..."}),l&&f&&y.jsx(uc,{children:y.jsxs(dc,{children:[y.jsx(ku,{children:"Readme"}),y.jsxs(Bt,{sx:{mt:1,fontSize:"0.875rem",lineHeight:1.6},children:[y.jsx(pv,{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||!g?f:m}),g&&y.jsxs(Bt,{sx:{mt:1},children:[" ",y.jsx(Sa,{variant:"text",size:"small",onClick:()=>o(!r),children:r?"Read less":"Read more"})]})]})]})}),c&&y.jsx(wo,{error:d,context:`${t} > About`})]})}function zRe({resourceUri:e}){const[t,n]=C.useState(!1),{apiClients:r}=Yn(),o=Xs(),[a,i]=C.useState(""),l=()=>{n(!0)},c=()=>{n(!1)},{projectName:d}=Dr(e),f=ts({async mutationFn(g){return r.packages.createPackage(d,{name:g.name,description:g.description,location:g.location})},onSuccess(){c(),i("Package created successfully"),o.invalidateQueries({queryKey:["packages",d]})},onError(g){i(g instanceof Error?g.message:"An unknown error occurred")}}),h=g=>{g.preventDefault();const m=new FormData(g.currentTarget),v=m.get("name")?.toString(),S=m.get("description")?.toString(),E=m.get("location")?.toString();f.mutate({name:v,description:S,location:E})};return y.jsxs(Je.Fragment,{children:[y.jsx(pr,{onClick:l,variant:"contained",color:"primary",startIcon:y.jsx(zte,{}),sx:{color:"white"},children:"Add Package"}),y.jsxs(ms,{open:t,onClose:c,children:[y.jsx(el,{children:"Create New Package"}),y.jsxs(hs,{children:[y.jsxs(Vf,{children:["Create a new malloy package to start exploring your data.",y.jsx("br",{}),y.jsx("br",{}),"The location can be a GitHub/S3/GCP URL containing a package (Zipped or unzipped), or an absolute path to a directory that the publisher server has access to.",y.jsx("br",{}),y.jsx("br",{}),"Make sure to conform the"," ",y.jsx("a",{href:"https://github.com/malloydata/publisher/blob/main/README.md#architecture-overview",target:"_blank",rel:"noopener noreferrer",children:"Malloy Package Format"}),"."]}),y.jsxs("form",{onSubmit:h,id:"package-form",children:[y.jsx(on,{autoFocus:!0,required:!0,margin:"dense",id:"name",name:"name",label:"Package Name",type:"text",fullWidth:!0,variant:"standard"}),y.jsx(on,{id:"description",name:"description",label:"Description",multiline:!0,fullWidth:!0,rows:4,variant:"standard"}),y.jsx(on,{id:"location",name:"location",label:"Location",type:"text",placeholder:"E.g. s3://my-bucket/my-package.zip",fullWidth:!0,variant:"standard"})]})]}),y.jsxs(ps,{children:[y.jsx(pr,{disabled:f.isPending,onClick:c,children:"Cancel"}),y.jsx(pr,{type:"submit",form:"package-form",loading:f.isPending,children:"Save Changes"})]})]}),y.jsx(Qs,{open:a!=="",autoHideDuration:6e3,onClose:()=>i(""),message:a})]})}function URe({resourceUri:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=Yn(),a=Xs(),[i,l]=C.useState(""),c=()=>{r(!0)},d=()=>{r(!1),t()},{projectName:f,packageName:h}=Dr(e),g=ts({mutationFn:()=>o.packages.deletePackage(f,h),onSuccess(){d(),a.invalidateQueries({queryKey:["packages"]}),l("Package deleted successfully")},onError(m){l(m instanceof Error?m.message:"An unknown error occurred")}});return y.jsxs(Je.Fragment,{children:[y.jsxs(Jl,{onClick:c,children:[y.jsx(h0,{children:y.jsx(qw,{fontSize:"small"})}),y.jsx(zs,{children:"Delete"})]}),y.jsxs(ms,{onClose:d,"aria-labelledby":"customized-dialog-title",open:n,children:[y.jsx(el,{sx:{m:0,p:2},id:"customized-dialog-title",children:"Delete Package"}),y.jsx(Ra,{"aria-label":"close",onClick:d,sx:m=>({position:"absolute",right:8,top:8,color:m.palette.grey[500]}),children:y.jsx(tc,{})}),y.jsx(hs,{dividers:!0,children:y.jsxs(rr,{gutterBottom:!0,children:['Are you sure you want to delete "',h,'"? This action cannot be undone.']})}),y.jsxs(ps,{children:[y.jsx(pr,{variant:"outlined",onClick:d,style:{borderColor:"#14b3cb",color:"#14b3cb"},children:"Cancel"}),y.jsx(pr,{variant:"contained",autoFocus:!0,onClick:()=>g.mutate(),color:"error",loading:g.isPending,children:"Delete"})]}),y.jsx(Qs,{open:i!=="",autoHideDuration:6e3,onClose:()=>l(""),message:i})]})]})}function HRe({package:e,resourceUri:t,onCloseDialog:n}){const[r,o]=C.useState(!1),{apiClients:a}=Yn(),i=Xs(),[l,c]=C.useState(""),d=()=>{o(!0)},f=()=>{o(!1),n()},{packageName:h,projectName:g}=Dr(t),m=ts({async mutationFn(S){return a.packages.updatePackage(g,h,{name:h,description:S.description})},onSuccess(){f(),c("Package updated successfully"),i.invalidateQueries({queryKey:["packages",g]})},onError(S){c(S instanceof Error?S.message:"An unknown error occurred")}}),v=S=>{S.preventDefault();const E=new FormData(S.currentTarget).get("description")?.toString();m.mutate({description:E})};return y.jsxs(Je.Fragment,{children:[y.jsxs(Jl,{onClick:d,children:[y.jsx(h0,{children:y.jsx(Gw,{fontSize:"small"})}),y.jsx(zs,{children:"Edit"})]}),y.jsxs(ms,{open:r,onClose:f,children:[y.jsx(el,{children:"Edit Package"}),y.jsxs(hs,{children:[y.jsxs(Vf,{children:['Update the details for "',e.name,'".']}),y.jsxs("form",{onSubmit:v,id:"package-form",children:[y.jsx(on,{autoFocus:!0,required:!0,margin:"dense",id:"name",name:"name",label:"Package Name",disabled:!0,type:"text",fullWidth:!0,variant:"standard",defaultValue:e.name}),y.jsx(on,{id:"description",name:"description",label:"Description",multiline:!0,fullWidth:!0,rows:4,defaultValue:e.description,variant:"standard"})]})]}),y.jsxs(ps,{children:[y.jsx(pr,{disabled:m.isPending,onClick:f,children:"Cancel"}),y.jsx(pr,{type:"submit",form:"package-form",loading:m.isPending,children:"Save Changes"})]})]}),y.jsx(Qs,{open:l!=="",autoHideDuration:6e3,onClose:()=>c(""),message:l})]})}const VRe=({package:e,resourceUri:t})=>{const{mutable:n}=Yn(),[r,o]=C.useState(null),a=!!r,i=c=>{o(c.currentTarget)},l=()=>{o(null)};return y.jsx(y.Fragment,{children:n&&y.jsxs(y.Fragment,{children:[y.jsx(kr,{onClick:c=>{c.stopPropagation(),i(c)},"aria-controls":a?"package-menu":void 0,"aria-haspopup":"true","aria-expanded":a?"true":void 0,children:y.jsx(IL,{fontSize:"small"})}),y.jsxs(eg,{id:"package-menu","aria-haspopup":"true","aria-expanded":a?"true":void 0,open:a,anchorEl:r,onClose:l,disableRestoreFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"right"},onClick:c=>{c.stopPropagation()},children:[y.jsx(HRe,{package:e,resourceUri:t,onCloseDialog:l}),y.jsx(URe,{resourceUri:t,onCloseDialog:l})]})]})})};function WRe({onSelectPackage:e,resourceUri:t}){const{apiClients:n}=Yn(),{projectName:r}=Dr(t),{data:o,isSuccess:a,isError:i,error:l}=Do({queryKey:["packages",r],queryFn:()=>n.packages.listPackages(r)});return y.jsxs(y.Fragment,{children:[!a&&!i&&y.jsx(Lo,{text:"Fetching Packages..."}),a&&y.jsx(Lr,{container:!0,spacing:3,columns:12,children:o.data.sort((c,d)=>c.name.localeCompare(d.name)).map(c=>{const d=Zk({projectName:r,packageName:c.name});return y.jsx(Lr,{size:{xs:12,sm:12,md:12,lg:4},children:y.jsx(uc,{sx:{cursor:"pointer",transition:"all 0.2s ease-in-out",paddingTop:"8px","&:hover":{boxShadow:"0 2px 6px rgba(0, 0, 0, 0.08)",transform:"translateY(-1px)"}},onClick:f=>{e(c.name,f)},children:y.jsxs(dc,{children:[y.jsxs(Bt,{display:"flex",alignItems:"center",justifyContent:"space-between",sx:{marginBottom:"8px"},children:[y.jsx(mt,{variant:"overline",sx:{fontSize:"12px",fontWeight:"600",color:"primary.main",textTransform:"uppercase",letterSpacing:"0.5px"},children:c.name}),y.jsx(VRe,{package:c,resourceUri:d})]}),y.jsx(os,{sx:{mb:2}}),y.jsx(Bt,{sx:{maxHeight:"120px",overflowY:"auto",mt:2},children:y.jsx(mt,{variant:"body2",children:c.description})})]})})},c.name)})}),i&&y.jsx(wo,{error:l,context:`${r} > Packages`})]})}function VMe({onSelectPackage:e,resourceUri:t}){const{mutable:n}=Yn(),{projectName:r}=Dr(t);return C.useEffect(()=>{window.scrollTo({top:0,behavior:"auto"})},[]),y.jsx(y.Fragment,{children:y.jsxs(Wie,{children:[y.jsxs(Bt,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[y.jsxs(mt,{variant:"h6",children:[r," packages"]}),n&&y.jsx(zRe,{resourceUri:t})]}),y.jsxs(Lr,{container:!0,spacing:3,columns:12,children:[y.jsx(Lr,{size:{xs:12,md:12},children:y.jsx(WRe,{onSelectPackage:e,resourceUri:t})}),y.jsx(Lr,{size:{xs:12,md:12},children:y.jsx($Re,{resourceUri:t})})]})]})})}const qRe=async e=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:t}=await po(async()=>{const{MalloyRenderer:n}=await import("./index.umd-lY-87l4L.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 GRe({result:e,height:t,onDrill:n,onSizeChange:r}){const o=C.useRef(null),a=C.useRef(!1);return C.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 f=()=>{if(a.current||!i||!l.firstElementChild)return;const h=l.firstElementChild.firstElementChild;if(!h)return;const g=h.firstElementChild;let m=h.scrollHeight||h.offsetHeight||0;g&&h.classList.contains("malloy-dashboard")&&(m=g.scrollHeight||g.offsetHeight||0),m>0&&(a.current=!0,r&&r(m))};return qRe(n).then(h=>{if(i){c=new MutationObserver(()=>{d&&clearTimeout(d),d=setTimeout(()=>{f(),c?.disconnect()},100)}),c.observe(l,{childList:!0,subtree:!0,attributes:!0});try{h.setResult(JSON.parse(e)),h.render(l)}catch(g){console.error("Error rendering visualization:",g),c?.disconnect()}}}).catch(h=>{console.error("Failed to create renderer:",h)}),()=>{i=!1,c?.disconnect(),d&&clearTimeout(d)}},[e,n,r]),y.jsx("div",{ref:o,style:{width:"100%",height:t?`${t}px`:"400px"}})}function YRe(e){return typeof window>"u"?y.jsx("div",{style:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#666"},children:"Loading..."}):y.jsx(C.Suspense,{fallback:y.jsx("div",{style:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#666"},children:"Loading visualization..."}),children:y.jsx(GRe,{...e})})}const KRe=Object.freeze(Object.defineProperty({__proto__:null,default:YRe},Symbol.toStringTag,{value:"Module"})),Sr={primary:{main:"#14b3cb",light:"#22d3ee",dark:"#0e7490",50:"#ecfeff",100:"#cffafe",500:"#14b3cb",600:"#0891b2",700:"#0e7490"},secondary:{main:"#fbbb04",light:"#fde047",dark:"#eab308",50:"#fefce8",100:"#fef3c7",500:"#fbbb04",600:"#eab308",700:"#ca8a04"},grey:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827"},success:{main:"#059669",light:"#10b981",dark:"#047857"},warning:{main:"#d97706",light:"#f59e0b",dark:"#b45309"},error:{main:"#dc2626",light:"#ef4444",dark:"#b91c1c"},info:{main:"#0891b2",light:"#06b6d4",dark:"#0e7490"}},QRe=a0({palette:{mode:"light",primary:Sr.primary,secondary:Sr.secondary,grey:Sr.grey,success:Sr.success,warning:Sr.warning,error:Sr.error,info:Sr.info,background:{default:"#ffffff",paper:"#ffffff"},text:{primary:Sr.grey[900],secondary:Sr.grey[600]},divider:Sr.grey[200]},typography:{fontFamily:'"Inter", "Roboto", "Helvetica", "Arial", sans-serif',h1:{fontWeight:700,letterSpacing:"-0.025em"},h2:{fontWeight:700,letterSpacing:"-0.025em"},h3:{fontWeight:600,letterSpacing:"-0.025em"},h4:{fontWeight:600,letterSpacing:"-0.025em"},h5:{fontWeight:600,letterSpacing:"-0.025em"},h6:{fontWeight:600,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:{MuiCssBaseline:{styleOverrides:{body:{scrollbarWidth:"thin",scrollbarColor:`${Sr.grey[300]} ${Sr.grey[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:Sr.grey[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:Sr.grey[300],borderRadius:"4px","&:hover":{background:Sr.grey[400]}},"&::-webkit-scrollbar-corner":{background:Sr.grey[100]}},"*":{scrollbarWidth:"thin",scrollbarColor:`${Sr.grey[300]} ${Sr.grey[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:Sr.grey[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:Sr.grey[300],borderRadius:"4px","&:hover":{background:Sr.grey[400]}},"&::-webkit-scrollbar-corner":{background:Sr.grey[100]}},"div[data-radix-popper-content-wrapper]":{zIndex:"1300 !important"}}},MuiButton:{styleOverrides:{root:{borderRadius:4,textTransform:"none",fontWeight:500,boxShadow:"none","&:hover":{boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"}},contained:{"&:hover":{boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}}}},MuiCard:{styleOverrides:{root:{borderRadius:4,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",border:"1px solid",borderColor:"rgba(0, 0, 0, 0.05)"}}},MuiChip:{styleOverrides:{root:{borderRadius:4,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:4}}}},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)"}}},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 rgba(0, 0, 0, 0.05)"}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:Sr.grey[400]}}}},MuiDivider:{styleOverrides:{root:{margin:"4px 0",borderColor:Sr.grey[200]}},defaultProps:{sx:{my:1}}}}}),XRe=C.lazy(()=>po(()=>import("./HomePage-DsuUvSI_.js"),[])),ZRe=C.lazy(()=>po(()=>import("./MainPage-DHWFkEN6.js"),[])),JRe=C.lazy(()=>po(()=>import("./ModelPage-DNwcx1nE.js"),[])),eMe=C.lazy(()=>po(()=>import("./PackagePage-DSgz9G2V.js"),[])),tMe=C.lazy(()=>po(()=>import("./ProjectPage-CSdPosLV.js"),[])),nMe=C.lazy(()=>po(()=>import("./RouteError-orw1RX8q.js"),[])),rMe=C.lazy(()=>po(()=>import("./WorkbookPage-Bp-BpGjL.js"),[])),oMe=(e="/",t,n)=>xU([{path:e,element:y.jsx($te,{children:y.jsx(Tve,{workbookStorage:t,children:y.jsxs(Aq,{theme:QRe,children:[y.jsx(VK,{}),y.jsx(ZRe,{headerProps:n})]})})}),errorElement:y.jsx(nMe,{}),children:[{path:"",element:y.jsx(XRe,{})},{path:":projectName",element:y.jsx(tMe,{})},{path:":projectName/:packageName",element:y.jsx(eMe,{})},{path:":projectName/:packageName/*",element:y.jsx(JRe,{})},{path:":projectName/:packageName/workbook/:workspace/:workbookPath",element:y.jsx(rMe,{})}]}]),aMe=oMe("/",new Mve,void 0);S$.createRoot(document.getElementById("root")).render(y.jsx(C.StrictMode,{children:y.jsx(OU,{router:aMe})}));export{Je as $,BK as A,lu as B,Eb as C,Zk as D,UMe as E,U2e as F,HMe as G,VMe as H,kr as I,Hz as J,dg as K,$pe as L,eg as M,Pk as N,cMe as O,Vs as P,Du as Q,sm as R,io as S,mt as T,U0 as U,xk as V,Ek as W,DP as X,H6 as Y,$Me as Z,sMe as _,ka as a,Ll as a0,qm as a1,iMe as a2,Y5 as a3,_t as b,Ft as c,Dve as d,jt as e,ht as f,qV as g,Ke as h,zMe as i,y as j,Lt as k,Qo as l,Kt as m,ac as n,rC as o,w4 as p,Zi as q,C as r,ze as s,lMe as t,sw as u,Bt as v,h3 as w,oc as x,Jl as y,Sa as z};
456
+ `));o[g]={id:g,label:m,parentId:h,idAttribute:void 0,expandable:!!d.children?.length,disabled:t?t(d):!1,depth:f},a[g]=d;const v=h??Bd;i[v]||(i[v]=[]),i[v].push(g),d.children?.forEach(S=>l(S,f+1,g))};e.forEach(d=>l(d,0,null));const c={};return Object.keys(i).forEach(d=>{c[d]=sRe(i[d])}),{itemMetaMap:o,itemMap:a,itemOrderedChildrenIds:i,itemChildrenIndexes:c}},Eg=({instance:e,params:t,state:n,setState:r,experimentalFeatures:o})=>{const a=C.useCallback(E=>n.items.itemMetaMap[E],[n.items.itemMetaMap]),i=C.useCallback(E=>n.items.itemMap[E],[n.items.itemMap]),l=C.useCallback(()=>{const E=x=>{const w=n.items.itemMap[x],T=Ot(w,lRe),R=n.items.itemOrderedChildrenIds[x];return R&&(T.children=R.map(E)),T};return n.items.itemOrderedChildrenIds[Bd].map(E)},[n.items.itemMap,n.items.itemOrderedChildrenIds]),c=C.useCallback(E=>{if(E==null)return!1;let x=e.getItemMeta(E);if(!x)return!1;if(x.disabled)return!0;for(;x.parentId!=null;)if(x=e.getItemMeta(x.parentId),x.disabled)return!0;return!1},[e]),d=C.useCallback(E=>{const x=e.getItemMeta(E).parentId??Bd;return n.items.itemChildrenIndexes[x][E]},[e,n.items.itemChildrenIndexes]),f=C.useCallback(E=>n.items.itemOrderedChildrenIds[E??Bd]??[],[n.items.itemOrderedChildrenIds]),h=E=>{const x=e.getItemMeta(E);return x==null?null:document.getElementById(DA({treeId:n.id.treeId,itemId:E,id:x.idAttribute}))},g=E=>t.disabledItemsFocusable?!0:!e.isItemDisabled(E),m=C.useRef(!1),v=C.useCallback(()=>{m.current=!0},[]),S=C.useCallback(()=>m.current,[]);return C.useEffect(()=>{e.areItemUpdatesPrevented()||r(E=>{const x=e8({items:t.items,isItemDisabled:t.isItemDisabled,getItemId:t.getItemId,getItemLabel:t.getItemLabel});return Object.values(E.items.itemMetaMap).forEach(w=>{x.itemMetaMap[w.id]||iRe(e,"removeItem",{id:w.id})}),ne({},E,{items:x})})},[e,r,t.items,t.isItemDisabled,t.getItemId,t.getItemLabel]),{getRootProps:()=>({style:{"--TreeView-itemChildrenIndentation":typeof t.itemChildrenIndentation=="number"?`${t.itemChildrenIndentation}px`:t.itemChildrenIndentation}}),publicAPI:{getItem:i,getItemDOMElement:h,getItemTree:l,getItemOrderedChildrenIds:f},instance:{getItemMeta:a,getItem:i,getItemTree:l,getItemsToRender:()=>{const E=x=>{const w=n.items.itemMetaMap[x];return{label:w.label,itemId:w.id,id:w.idAttribute,children:n.items.itemOrderedChildrenIds[x]?.map(E)}};return n.items.itemOrderedChildrenIds[Bd].map(E)},getItemIndex:d,getItemDOMElement:h,getItemOrderedChildrenIds:f,isItemDisabled:c,isItemNavigable:g,preventItemUpdates:v,areItemUpdatesPrevented:S},contextValue:{items:{onItemClick:t.onItemClick,disabledItemsFocusable:t.disabledItemsFocusable,indentationAtItemLevel:o.indentationAtItemLevel??!1}}}};Eg.getInitialState=e=>({items:e8({items:e.items,isItemDisabled:e.isItemDisabled,getItemId:e.getItemId,getItemLabel:e.getItemLabel})});Eg.getDefaultizedParams=({params:e})=>ne({},e,{disabledItemsFocusable:e.disabledItemsFocusable??!1,itemChildrenIndentation:e.itemChildrenIndentation??"12px"});Eg.wrapRoot=({children:e,instance:t})=>y.jsx(AA.Provider,{value:n=>t.getItemMeta(n)?.depth??0,children:e});Eg.params={disabledItemsFocusable:!0,items:!0,isItemDisabled:!0,getItemLabel:!0,getItemId:!0,onItemClick:!0,itemChildrenIndentation:!0};const p1=({instance:e,params:t,models:n})=>{const r=C.useMemo(()=>{const h=new Map;return n.expandedItems.value.forEach(g=>{h.set(g,!0)}),h},[n.expandedItems.value]),o=(h,g)=>{t.onExpandedItemsChange?.(h,g),n.expandedItems.setControlledValue(g)},a=C.useCallback(h=>r.has(h),[r]),i=C.useCallback(h=>!!e.getItemMeta(h)?.expandable,[e]),l=dt((h,g)=>{const m=e.isItemExpanded(g);e.setItemExpansion(h,g,!m)}),c=dt((h,g,m)=>{if(e.isItemExpanded(g)===m)return;let v;m?v=[g].concat(n.expandedItems.value):v=n.expandedItems.value.filter(S=>S!==g),t.onItemExpansionToggle&&t.onItemExpansionToggle(h,g,m),o(h,v)}),d=(h,g)=>{const m=e.getItemMeta(g),v=e.getItemOrderedChildrenIds(m.parentId).filter(E=>e.isItemExpandable(E)&&!e.isItemExpanded(E)),S=n.expandedItems.value.concat(v);v.length>0&&(t.onItemExpansionToggle&&v.forEach(E=>{t.onItemExpansionToggle(h,E,!0)}),o(h,S))},f=C.useMemo(()=>t.expansionTrigger?t.expansionTrigger:e.isTreeViewEditable?"iconContainer":"content",[t.expansionTrigger,e.isTreeViewEditable]);return{publicAPI:{setItemExpansion:c},instance:{isItemExpanded:a,isItemExpandable:i,setItemExpansion:c,toggleItemExpansion:l,expandAllSiblings:d},contextValue:{expansion:{expansionTrigger:f}}}};p1.models={expandedItems:{getDefaultValue:e=>e.defaultExpandedItems}};const cRe=[];p1.getDefaultizedParams=({params:e})=>ne({},e,{defaultExpandedItems:e.defaultExpandedItems??cRe});p1.params={expandedItems:!0,defaultExpandedItems:!0,onExpandedItemsChange:!0,onItemExpansionToggle:!0,expansionTrigger:!0};const Wb=e=>Array.isArray(e)?e:e!=null?[e]:[],GE=e=>{const t={};return e.forEach(n=>{t[n]=!0}),t},h1=({instance:e,params:t,models:n})=>{const r=C.useRef(null),o=C.useRef({}),a=C.useMemo(()=>{const f=new Map;return Array.isArray(n.selectedItems.value)?n.selectedItems.value.forEach(h=>{f.set(h,!0)}):n.selectedItems.value!=null&&f.set(n.selectedItems.value,!0),f},[n.selectedItems.value]),i=(f,h)=>{if(t.onItemSelectionToggle)if(t.multiSelect){const g=h.filter(v=>!e.isItemSelected(v)),m=n.selectedItems.value.filter(v=>!h.includes(v));g.forEach(v=>{t.onItemSelectionToggle(f,v,!0)}),m.forEach(v=>{t.onItemSelectionToggle(f,v,!1)})}else h!==n.selectedItems.value&&(n.selectedItems.value!=null&&t.onItemSelectionToggle(f,n.selectedItems.value,!1),h!=null&&t.onItemSelectionToggle(f,h,!0));t.onSelectedItemsChange&&t.onSelectedItemsChange(f,h),n.selectedItems.setControlledValue(h)},l=f=>a.has(f),c=({event:f,itemId:h,keepExistingSelection:g=!1,shouldBeSelected:m})=>{if(t.disableSelection)return;let v;if(g){const S=Wb(n.selectedItems.value),E=e.isItemSelected(h);E&&(m===!1||m==null)?v=S.filter(x=>x!==h):!E&&(m===!0||m==null)?v=[h].concat(S):v=S}else m===!1||m==null&&e.isItemSelected(h)?v=t.multiSelect?[]:null:v=t.multiSelect?[h]:h;i(f,v),r.current=h,o.current={}},d=(f,[h,g])=>{if(t.disableSelection||!t.multiSelect)return;let m=Wb(n.selectedItems.value).slice();Object.keys(o.current).length>0&&(m=m.filter(x=>!o.current[x]));const v=GE(m),S=TDe(e,h,g),E=S.filter(x=>!v[x]);m=m.concat(E),i(f,m),o.current=GE(S)};return{getRootProps:()=>({"aria-multiselectable":t.multiSelect}),publicAPI:{selectItem:c},instance:{isItemSelected:l,selectItem:c,selectAllNavigableItems:f=>{if(t.disableSelection||!t.multiSelect)return;const h=wDe(e);i(f,h),o.current=GE(h)},expandSelectionRange:(f,h)=>{if(r.current!=null){const[g,m]=GB(e,h,r.current);d(f,[g,m])}},selectRangeFromStartToItem:(f,h)=>{d(f,[zm(e),h])},selectRangeFromItemToEnd:(f,h)=>{d(f,[h,qB(e)])},selectItemFromArrowNavigation:(f,h,g)=>{if(t.disableSelection||!t.multiSelect)return;let m=Wb(n.selectedItems.value).slice();Object.keys(o.current).length===0?(m.push(g),o.current={[h]:!0,[g]:!0}):(o.current[h]||(o.current={}),o.current[g]?(m=m.filter(v=>v!==h),delete o.current[h]):(m.push(g),o.current[g]=!0)),i(f,m)}},contextValue:{selection:{multiSelect:t.multiSelect,checkboxSelection:t.checkboxSelection,disableSelection:t.disableSelection}}}};h1.models={selectedItems:{getDefaultValue:e=>e.defaultSelectedItems}};const uRe=[];h1.getDefaultizedParams=({params:e})=>ne({},e,{disableSelection:e.disableSelection??!1,multiSelect:e.multiSelect??!1,checkboxSelection:e.checkboxSelection??!1,defaultSelectedItems:e.defaultSelectedItems??(e.multiSelect?uRe:null)});h1.params={disableSelection:!0,multiSelect:!0,checkboxSelection:!0,defaultSelectedItems:!0,selectedItems:!0,onSelectedItemsChange:!0,onItemSelectionToggle:!0};const G5=1e3;class dRe{constructor(t=G5){this.timeouts=new Map,this.cleanupTimeout=G5,this.cleanupTimeout=t}register(t,n,r){this.timeouts||(this.timeouts=new Map);const o=setTimeout(()=>{typeof n=="function"&&n(),this.timeouts.delete(r.cleanupToken)},this.cleanupTimeout);this.timeouts.set(r.cleanupToken,o)}unregister(t){const n=this.timeouts.get(t.cleanupToken);n&&(this.timeouts.delete(t.cleanupToken),clearTimeout(n))}reset(){this.timeouts&&(this.timeouts.forEach((t,n)=>{this.unregister({cleanupToken:n})}),this.timeouts=void 0)}}class fRe{constructor(){this.registry=new FinalizationRegistry(t=>{typeof t=="function"&&t()})}register(t,n,r){this.registry.register(t,n,r)}unregister(t){this.registry.unregister(t)}reset(){}}class pRe{}function hRe(e){let t=0;return function(n,r,o){e.registry===null&&(e.registry=typeof FinalizationRegistry<"u"?new fRe:new dRe);const[a]=C.useState(new pRe),i=C.useRef(null),l=C.useRef(void 0);l.current=o;const c=C.useRef(null);if(!i.current&&l.current){const d=(f,h)=>{h.defaultMuiPrevented||l.current?.(f,h)};i.current=n.$$subscribeEvent(r,d),t+=1,c.current={cleanupToken:t},e.registry.register(a,()=>{i.current?.(),i.current=null,c.current=null},c.current)}else!l.current&&i.current&&(i.current(),i.current=null,c.current&&(e.registry.unregister(c.current),c.current=null));C.useEffect(()=>{if(!i.current&&l.current){const d=(f,h)=>{h.defaultMuiPrevented||l.current?.(f,h)};i.current=n.$$subscribeEvent(r,d)}return c.current&&e.registry&&(e.registry.unregister(c.current),c.current=null),()=>{i.current?.(),i.current=null}},[n,r])}}const mRe={registry:null},gRe=hRe(mRe),t8=(e=document)=>{const t=e.activeElement;return t?t.shadowRoot?t8(t.shadowRoot):t:null},yRe=(e,t)=>{let n=Wb(t).find(r=>{if(!e.isItemNavigable(r))return!1;const o=e.getItemMeta(r);return o&&(o.parentId==null||e.isItemExpanded(o.parentId))});return n==null&&(n=zm(e)),n},IA=({instance:e,params:t,state:n,setState:r,models:o,rootRef:a})=>{const i=yRe(e,o.selectedItems.value),l=dt(E=>{const x=typeof E=="function"?E(n.focusedItemId):E;n.focusedItemId!==x&&r(w=>ne({},w,{focusedItemId:x}))}),c=C.useCallback(()=>!!a.current&&a.current.contains(t8(Yr(a.current))),[a]),d=C.useCallback(E=>n.focusedItemId===E&&c(),[n.focusedItemId,c]),f=E=>{const x=e.getItemMeta(E);return x&&(x.parentId==null||e.isItemExpanded(x.parentId))},h=(E,x)=>{const w=e.getItemDOMElement(x);w&&w.focus(),l(x),t.onItemFocus&&t.onItemFocus(E,x)},g=dt((E,x)=>{f(x)&&h(E,x)}),m=dt(()=>{if(n.focusedItemId!=null){if(e.getItemMeta(n.focusedItemId)){const E=e.getItemDOMElement(n.focusedItemId);E&&E.blur()}l(null)}}),v=E=>E===i;gRe(e,"removeItem",({id:E})=>{n.focusedItemId===E&&h(null,i)});const S=E=>x=>{E.onFocus?.(x),!x.defaultMuiPrevented&&x.target===x.currentTarget&&h(x,i)};return{getRootProps:E=>({onFocus:S(E)}),publicAPI:{focusItem:g},instance:{isItemFocused:d,canItemBeTabbed:v,focusItem:g,removeFocusedItem:m}}};IA.getInitialState=()=>({focusedItemId:null});IA.params={onItemFocus:!0};function bRe(e){return!!e&&e.length===1&&!!e.match(/\S/)}const n8=({instance:e,params:t,state:n})=>{const r=di(),o=C.useRef({}),a=dt(d=>{o.current=d(o.current)});C.useEffect(()=>{if(e.areItemUpdatesPrevented())return;const d={},f=h=>{d[h.id]=h.label.substring(0,1).toLowerCase()};Object.values(n.items.itemMetaMap).forEach(f),o.current=d},[n.items.itemMetaMap,t.getItemId,e]);const i=(d,f)=>{const h=f.toLowerCase(),g=E=>{const x=Vb(e,E);return x===null?zm(e):x};let m=null,v=g(d);const S={};for(;m==null&&!S[v];)o.current[v]===h?m=v:(S[v]=!0,v=g(v));return m},l=d=>!t.disableSelection&&!e.isItemDisabled(d),c=d=>!e.isItemDisabled(d)&&e.isItemExpandable(d);return{instance:{updateFirstCharMap:a,handleItemKeyDown:(d,f)=>{if(d.defaultMuiPrevented||d.altKey||Um(d.target,d.currentTarget))return;const h=d.ctrlKey||d.metaKey,g=d.key;switch(!0){case(g===" "&&l(f)):{d.preventDefault(),t.multiSelect&&d.shiftKey?e.expandSelectionRange(d,f):e.selectItem({event:d,itemId:f,keepExistingSelection:t.multiSelect,shouldBeSelected:t.multiSelect?void 0:!0});break}case g==="Enter":{iu(e,ni)&&e.isItemEditable(f)&&!e.isItemBeingEdited(f)?e.setEditedItemId(f):c(f)?(e.toggleItemExpansion(d,f),d.preventDefault()):l(f)&&(t.multiSelect?(d.preventDefault(),e.selectItem({event:d,itemId:f,keepExistingSelection:!0})):e.isItemSelected(f)||(e.selectItem({event:d,itemId:f}),d.preventDefault()));break}case g==="ArrowDown":{const m=Vb(e,f);m&&(d.preventDefault(),e.focusItem(d,m),t.multiSelect&&d.shiftKey&&l(m)&&e.selectItemFromArrowNavigation(d,f,m));break}case g==="ArrowUp":{const m=WB(e,f);m&&(d.preventDefault(),e.focusItem(d,m),t.multiSelect&&d.shiftKey&&l(m)&&e.selectItemFromArrowNavigation(d,f,m));break}case(g==="ArrowRight"&&!r||g==="ArrowLeft"&&r):{if(h)return;if(e.isItemExpanded(f)){const m=Vb(e,f);m&&(e.focusItem(d,m),d.preventDefault())}else c(f)&&(e.toggleItemExpansion(d,f),d.preventDefault());break}case(g==="ArrowLeft"&&!r||g==="ArrowRight"&&r):{if(h)return;if(c(f)&&e.isItemExpanded(f))e.toggleItemExpansion(d,f),d.preventDefault();else{const m=e.getItemMeta(f).parentId;m&&(e.focusItem(d,m),d.preventDefault())}break}case g==="Home":{l(f)&&t.multiSelect&&h&&d.shiftKey?e.selectRangeFromStartToItem(d,f):e.focusItem(d,zm(e)),d.preventDefault();break}case g==="End":{l(f)&&t.multiSelect&&h&&d.shiftKey?e.selectRangeFromItemToEnd(d,f):e.focusItem(d,qB(e)),d.preventDefault();break}case g==="*":{e.expandAllSiblings(d,f),d.preventDefault();break}case(String.fromCharCode(d.keyCode)==="A"&&h&&t.multiSelect&&!t.disableSelection):{e.selectAllNavigableItems(d),d.preventDefault();break}case(!h&&!d.shiftKey&&bRe(g)):{const m=i(f,g);m!=null&&(e.focusItem(d,m),d.preventDefault());break}}}}}};n8.params={};const r8=({slots:e,slotProps:t})=>({contextValue:{icons:{slots:{collapseIcon:e.collapseIcon,expandIcon:e.expandIcon,endIcon:e.endIcon},slotProps:{collapseIcon:t.collapseIcon,expandIcon:t.expandIcon,endIcon:t.endIcon}}}});r8.params={};const vRe=[Eg,p1,h1,IA,n8,r8,ni],xRe=["ownerState"];function SRe({slots:e,slotProps:t,label:n,id:r,itemId:o,itemsToRender:a}){const i=e?.item??HDe,l=hn({elementType:i,externalSlotProps:t?.item,additionalProps:{itemId:o,id:r,label:n},ownerState:{itemId:o,label:n}}),c=Ot(l,xRe),d=C.useMemo(()=>a?y.jsx(o8,{itemsToRender:a,slots:e,slotProps:t}):null,[a,e,t]);return y.jsx(i,ne({},c,{children:d}))}function o8(e){const{itemsToRender:t,slots:n,slotProps:r}=e;return y.jsx(C.Fragment,{children:t.map(o=>y.jsx(SRe,{slots:n,slotProps:r,label:o.label,id:o.id,itemId:o.itemId,itemsToRender:o.children},o.itemId))})}const ERe=zB(),CRe=e=>{const{classes:t}=e;return Et({root:["root"]},QDe,t)},TRe=we("ul",{name:"MuiRichTreeView",slot:"Root",overridesResolver:(e,t)=>t.root})({padding:0,margin:0,listStyle:"none",outline:0,position:"relative"}),wRe=C.forwardRef(function(e,t){const n=ERe({props:e,name:"MuiRichTreeView"}),{getRootProps:r,contextValue:o,instance:a}=aRe({plugins:vRe,rootRef:t,props:n}),{slots:i,slotProps:l}=n,c=CRe(n),d=i?.root??TRe,f=hn({elementType:d,externalSlotProps:l?.root,className:c.root,getSlotProps:r,ownerState:n});return y.jsx(SDe,{value:o,children:y.jsx(d,ne({},f,{children:y.jsx(o8,{slots:i,slotProps:l,itemsToRender:a.getItemsToRender()})}))})}),kRe=dn(y.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),ARe=dn([y.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),y.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),DRe=dn(y.jsx("path",{d:"M19 15v4H5v-4zm1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1M7 18.5c-.82 0-1.5-.67-1.5-1.5s.68-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5M19 5v4H5V5zm1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1M7 8.5c-.82 0-1.5-.67-1.5-1.5S6.18 5.5 7 5.5s1.5.68 1.5 1.5S7.83 8.5 7 8.5"})),RRe=dn(y.jsx("path",{d:"M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z"}));function a8({items:e,defaultExpandedItems:t,onClickTreeNode:n}){return y.jsx(wRe,{items:PRe(e,n),defaultExpandedItems:t,slots:{item:NRe}})}const MRe=yoe($m);function IRe(e){const t=roe({to:{opacity:e.in?1:0,transform:`translate3d(0,${e.in?0:20}px,0)`}});return y.jsx(MRe,{style:t,...e})}function ORe({item:e,...t}){const n=y.jsxs(YDe,{...t,sx:{display:"flex",alignItems:"center",color:e.error?"error.main":"grey.600"},children:[e.fileType==="directory"&&y.jsx(kRe,{})||e.fileType==="notebook"&&y.jsx(ARe,{})||e.fileType==="model"&&y.jsx(RRe,{})||e.fileType=="database"&&y.jsx(DRe,{})||y.jsx(jB,{}),y.jsx(mt,{variant:"body2",sx:{marginLeft:"5px"},color:e.error?"error.main":e.link?"primary.main":"grey.600",children:e.label})]});return e.error?y.jsx(ma,{title:e.error,placement:"right",children:n}):n}const NRe=C.forwardRef(function(e,t){const{id:n,itemId:r,label:o,children:a,disabled:i,...l}=e,{getRootProps:c,getContentProps:d,getLabelProps:f,getIconContainerProps:h,getGroupTransitionProps:g,status:m,publicAPI:v}=DDe({id:n,itemId:r,children:a,label:o,disabled:i,rootRef:t}),S=v.getItem(r);return m.selected=!1,m.focused=!1,y.jsx(RA,{itemId:r,children:y.jsxs(qDe,{...c(l),children:[y.jsxs(GDe,{...d(),...S.link&&{onClick:E=>S.link(E)},sx:{pointerEvents:!S.selectable&&"none"},children:[y.jsx(KDe,{...h(),children:y.jsx(VDe,{status:m})}),y.jsx(ORe,{...f({item:S})})]}),a&&y.jsx(IRe,{...g()})]})})});function PRe(e,t){const n=new Map;return e.map(r=>{let o=n;const a=r.path.split("/");a.forEach((i,l)=>{l===a.length-1?o.set(i,r):(o.has(i)||o.set(i,new Map),o=o.get(i))})}),i8(n,"",t)}function i8(e,t,n){const r=[];return e.forEach((o,a)=>{const i=a.endsWith(".malloy")&&"model"||a.endsWith(".malloynb")&&"notebook"||a.endsWith(".parquet")&&"database"||"unknown";if(i!=="unknown"){const l=o;r.push({id:t+a,label:a,fileType:i,link:i==="model"||i==="notebook"?c=>n(t+a,c):void 0,selectable:i==="model"||i==="notebook",error:"error"in l?l.error:void 0})}else{const l=t+a+"/";r.push({id:l,label:a,fileType:"directory",selectable:!0,link:void 0,children:i8(o,l,n)})}}),r}const _Re=["notebooks/","models/"];function LRe({onClickModelFile:e,resourceUri:t}){const{projectName:n,packageName:r,versionId:o}=Dr(t),{apiClients:a}=Yn(),{data:i,isError:l,error:c,isSuccess:d}=Do({queryKey:["models",n,r,o],queryFn:()=>a.models.listModels(n,r,o)});return y.jsx(uc,{children:y.jsxs(dc,{children:[y.jsx(ku,{children:"Semantic Models"}),y.jsxs(Bt,{sx:{maxHeight:"200px",overflowY:"auto"},children:[!d&&!l&&y.jsx(Lo,{text:"Fetching Models..."}),l&&y.jsx(wo,{error:c,context:`${n} > ${r} > Models`}),d&&i.data.length>0&&y.jsx(a8,{items:i.data.sort((f,h)=>f.path.localeCompare(h.path)),onClickTreeNode:e,defaultExpandedItems:_Re}),d&&i.data.length===0&&y.jsx(mt,{variant:"body2",children:"No models found"})]})]})})}const FRe=["notebooks/"];function jRe({onClickNotebookFile:e,resourceUri:t}){const{apiClients:n}=Yn(),{projectName:r,packageName:o,versionId:a}=Dr(t),{data:i,isError:l,error:c,isSuccess:d}=Do({queryKey:["notebooks",r,o,a],queryFn:()=>n.notebooks.listNotebooks(r,o,a)});return y.jsx(uc,{children:y.jsxs(dc,{children:[y.jsx(ku,{children:"Notebooks"}),y.jsxs(Bt,{sx:{maxHeight:"200px",overflowY:"auto"},children:[!d&&!l&&y.jsx(Lo,{text:"Fetching Notebooks..."}),l&&y.jsx(wo,{error:c,context:`${r} > ${o} > Notebooks`}),d&&i.data.length>0&&y.jsx(a8,{items:i.data.sort((f,h)=>f.path.localeCompare(h.path)),defaultExpandedItems:FRe,onClickTreeNode:e}),d&&i.data.length===0&&y.jsx(mt,{variant:"body2",children:"No notebooks found"})]})]})})}const BRe="README.malloynb";function HMe({onClickPackageFile:e,resourceUri:t,retrievalFn:n}){e||(e=o=>{window.location.href=o});const r=Zk({...Dr(t),modelPath:BRe});return y.jsx(y.Fragment,{children:y.jsxs(Lr,{container:!0,spacing:3,columns:12,children:[y.jsx(Lr,{size:{xs:12,md:4},children:y.jsx(H2e,{resourceUri:t})}),y.jsx(Lr,{size:{xs:12,md:4},children:y.jsx(jRe,{onClickNotebookFile:e,resourceUri:t})}),y.jsx(Lr,{size:{xs:12,md:4},children:y.jsx(LRe,{onClickModelFile:e,resourceUri:t})}),y.jsx(Lr,{size:{xs:12,md:6},children:y.jsx(tDe,{resourceUri:t})}),y.jsx(Lr,{size:{xs:12,md:6},children:y.jsx(eDe,{resourceUri:t})}),y.jsx(Lr,{size:{xs:12,md:12},children:y.jsx(uc,{children:y.jsxs(dc,{children:[y.jsx(ku,{children:"README"}),y.jsx(Bt,{sx:{mt:1},children:y.jsx(U2e,{resourceUri:r,retrievalFn:n})})]})})})]})})}function $Re({resourceUri:e}){const{projectName:t}=Dr(e),{apiClients:n}=Yn(),[r,o]=C.useState(!1),a=90,{data:i,isSuccess:l,isError:c,error:d}=Do({queryKey:["about",t],queryFn:()=>n.projects.getProject(t,!1)}),f=i?.data?.readme||"",h=f.split(/\s+/),g=h.length>a,m=h.slice(0,a).join(" ");return y.jsxs(y.Fragment,{children:[!l&&!c&&y.jsx(Lo,{text:"Fetching About..."}),l&&f&&y.jsx(uc,{children:y.jsxs(dc,{children:[y.jsx(ku,{children:"Readme"}),y.jsxs(Bt,{sx:{mt:1,fontSize:"0.875rem",lineHeight:1.6},children:[y.jsx(pv,{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||!g?f:m}),g&&y.jsxs(Bt,{sx:{mt:1},children:[" ",y.jsx(Sa,{variant:"text",size:"small",onClick:()=>o(!r),children:r?"Read less":"Read more"})]})]})]})}),c&&y.jsx(wo,{error:d,context:`${t} > About`})]})}function zRe({resourceUri:e}){const[t,n]=C.useState(!1),{apiClients:r}=Yn(),o=Xs(),[a,i]=C.useState(""),l=()=>{n(!0)},c=()=>{n(!1)},{projectName:d}=Dr(e),f=ts({async mutationFn(g){return r.packages.createPackage(d,{name:g.name,description:g.description,location:g.location})},onSuccess(){c(),i("Package created successfully"),o.invalidateQueries({queryKey:["packages",d]})},onError(g){i(g instanceof Error?g.message:"An unknown error occurred")}}),h=g=>{g.preventDefault();const m=new FormData(g.currentTarget),v=m.get("name")?.toString(),S=m.get("description")?.toString(),E=m.get("location")?.toString();f.mutate({name:v,description:S,location:E})};return y.jsxs(Je.Fragment,{children:[y.jsx(pr,{onClick:l,variant:"contained",color:"primary",startIcon:y.jsx(zte,{}),sx:{color:"white"},children:"Add Package"}),y.jsxs(ms,{open:t,onClose:c,children:[y.jsx(el,{children:"Create New Package"}),y.jsxs(hs,{children:[y.jsxs(Vf,{children:["Create a new malloy package to start exploring your data.",y.jsx("br",{}),y.jsx("br",{}),"The location can be a GitHub/S3/GCP URL containing a package (Zipped or unzipped), or an absolute path to a directory that the publisher server has access to.",y.jsx("br",{}),y.jsx("br",{}),"Make sure to conform the"," ",y.jsx("a",{href:"https://github.com/malloydata/publisher/blob/main/README.md#architecture-overview",target:"_blank",rel:"noopener noreferrer",children:"Malloy Package Format"}),"."]}),y.jsxs("form",{onSubmit:h,id:"package-form",children:[y.jsx(on,{autoFocus:!0,required:!0,margin:"dense",id:"name",name:"name",label:"Package Name",type:"text",fullWidth:!0,variant:"standard"}),y.jsx(on,{id:"description",name:"description",label:"Description",multiline:!0,fullWidth:!0,rows:4,variant:"standard"}),y.jsx(on,{id:"location",name:"location",label:"Location",type:"text",placeholder:"E.g. s3://my-bucket/my-package.zip",fullWidth:!0,variant:"standard"})]})]}),y.jsxs(ps,{children:[y.jsx(pr,{disabled:f.isPending,onClick:c,children:"Cancel"}),y.jsx(pr,{type:"submit",form:"package-form",loading:f.isPending,children:"Save Changes"})]})]}),y.jsx(Qs,{open:a!=="",autoHideDuration:6e3,onClose:()=>i(""),message:a})]})}function URe({resourceUri:e,onCloseDialog:t}){const[n,r]=C.useState(!1),{apiClients:o}=Yn(),a=Xs(),[i,l]=C.useState(""),c=()=>{r(!0)},d=()=>{r(!1),t()},{projectName:f,packageName:h}=Dr(e),g=ts({mutationFn:()=>o.packages.deletePackage(f,h),onSuccess(){d(),a.invalidateQueries({queryKey:["packages"]}),l("Package deleted successfully")},onError(m){l(m instanceof Error?m.message:"An unknown error occurred")}});return y.jsxs(Je.Fragment,{children:[y.jsxs(Jl,{onClick:c,children:[y.jsx(h0,{children:y.jsx(qw,{fontSize:"small"})}),y.jsx(zs,{children:"Delete"})]}),y.jsxs(ms,{onClose:d,"aria-labelledby":"customized-dialog-title",open:n,children:[y.jsx(el,{sx:{m:0,p:2},id:"customized-dialog-title",children:"Delete Package"}),y.jsx(Ra,{"aria-label":"close",onClick:d,sx:m=>({position:"absolute",right:8,top:8,color:m.palette.grey[500]}),children:y.jsx(tc,{})}),y.jsx(hs,{dividers:!0,children:y.jsxs(rr,{gutterBottom:!0,children:['Are you sure you want to delete "',h,'"? This action cannot be undone.']})}),y.jsxs(ps,{children:[y.jsx(pr,{variant:"outlined",onClick:d,style:{borderColor:"#14b3cb",color:"#14b3cb"},children:"Cancel"}),y.jsx(pr,{variant:"contained",autoFocus:!0,onClick:()=>g.mutate(),color:"error",loading:g.isPending,children:"Delete"})]}),y.jsx(Qs,{open:i!=="",autoHideDuration:6e3,onClose:()=>l(""),message:i})]})]})}function HRe({package:e,resourceUri:t,onCloseDialog:n}){const[r,o]=C.useState(!1),{apiClients:a}=Yn(),i=Xs(),[l,c]=C.useState(""),d=()=>{o(!0)},f=()=>{o(!1),n()},{packageName:h,projectName:g}=Dr(t),m=ts({async mutationFn(S){return a.packages.updatePackage(g,h,{name:h,description:S.description})},onSuccess(){f(),c("Package updated successfully"),i.invalidateQueries({queryKey:["packages",g]})},onError(S){c(S instanceof Error?S.message:"An unknown error occurred")}}),v=S=>{S.preventDefault();const E=new FormData(S.currentTarget).get("description")?.toString();m.mutate({description:E})};return y.jsxs(Je.Fragment,{children:[y.jsxs(Jl,{onClick:d,children:[y.jsx(h0,{children:y.jsx(Gw,{fontSize:"small"})}),y.jsx(zs,{children:"Edit"})]}),y.jsxs(ms,{open:r,onClose:f,children:[y.jsx(el,{children:"Edit Package"}),y.jsxs(hs,{children:[y.jsxs(Vf,{children:['Update the details for "',e.name,'".']}),y.jsxs("form",{onSubmit:v,id:"package-form",children:[y.jsx(on,{autoFocus:!0,required:!0,margin:"dense",id:"name",name:"name",label:"Package Name",disabled:!0,type:"text",fullWidth:!0,variant:"standard",defaultValue:e.name}),y.jsx(on,{id:"description",name:"description",label:"Description",multiline:!0,fullWidth:!0,rows:4,defaultValue:e.description,variant:"standard"})]})]}),y.jsxs(ps,{children:[y.jsx(pr,{disabled:m.isPending,onClick:f,children:"Cancel"}),y.jsx(pr,{type:"submit",form:"package-form",loading:m.isPending,children:"Save Changes"})]})]}),y.jsx(Qs,{open:l!=="",autoHideDuration:6e3,onClose:()=>c(""),message:l})]})}const VRe=({package:e,resourceUri:t})=>{const{mutable:n}=Yn(),[r,o]=C.useState(null),a=!!r,i=c=>{o(c.currentTarget)},l=()=>{o(null)};return y.jsx(y.Fragment,{children:n&&y.jsxs(y.Fragment,{children:[y.jsx(kr,{onClick:c=>{c.stopPropagation(),i(c)},"aria-controls":a?"package-menu":void 0,"aria-haspopup":"true","aria-expanded":a?"true":void 0,children:y.jsx(IL,{fontSize:"small"})}),y.jsxs(eg,{id:"package-menu","aria-haspopup":"true","aria-expanded":a?"true":void 0,open:a,anchorEl:r,onClose:l,disableRestoreFocus:!0,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"right"},onClick:c=>{c.stopPropagation()},children:[y.jsx(HRe,{package:e,resourceUri:t,onCloseDialog:l}),y.jsx(URe,{resourceUri:t,onCloseDialog:l})]})]})})};function WRe({onSelectPackage:e,resourceUri:t}){const{apiClients:n}=Yn(),{projectName:r}=Dr(t),{data:o,isSuccess:a,isError:i,error:l}=Do({queryKey:["packages",r],queryFn:()=>n.packages.listPackages(r)});return y.jsxs(y.Fragment,{children:[!a&&!i&&y.jsx(Lo,{text:"Fetching Packages..."}),a&&y.jsx(Lr,{container:!0,spacing:3,columns:12,children:o.data.sort((c,d)=>c.name.localeCompare(d.name)).map(c=>{const d=Zk({projectName:r,packageName:c.name});return y.jsx(Lr,{size:{xs:12,sm:12,md:12,lg:4},children:y.jsx(uc,{sx:{cursor:"pointer",transition:"all 0.2s ease-in-out",paddingTop:"8px","&:hover":{boxShadow:"0 2px 6px rgba(0, 0, 0, 0.08)",transform:"translateY(-1px)"}},onClick:f=>{e(c.name,f)},children:y.jsxs(dc,{children:[y.jsxs(Bt,{display:"flex",alignItems:"center",justifyContent:"space-between",sx:{marginBottom:"8px"},children:[y.jsx(mt,{variant:"overline",sx:{fontSize:"12px",fontWeight:"600",color:"primary.main",textTransform:"uppercase",letterSpacing:"0.5px"},children:c.name}),y.jsx(VRe,{package:c,resourceUri:d})]}),y.jsx(os,{sx:{mb:2}}),y.jsx(Bt,{sx:{maxHeight:"120px",overflowY:"auto",mt:2},children:y.jsx(mt,{variant:"body2",children:c.description})})]})})},c.name)})}),i&&y.jsx(wo,{error:l,context:`${r} > Packages`})]})}function VMe({onSelectPackage:e,resourceUri:t}){const{mutable:n}=Yn(),{projectName:r}=Dr(t);return C.useEffect(()=>{window.scrollTo({top:0,behavior:"auto"})},[]),y.jsx(y.Fragment,{children:y.jsxs(Wie,{children:[y.jsxs(Bt,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,children:[y.jsxs(mt,{variant:"h6",children:[r," packages"]}),n&&y.jsx(zRe,{resourceUri:t})]}),y.jsxs(Lr,{container:!0,spacing:3,columns:12,children:[y.jsx(Lr,{size:{xs:12,md:12},children:y.jsx(WRe,{onSelectPackage:e,resourceUri:t})}),y.jsx(Lr,{size:{xs:12,md:12},children:y.jsx($Re,{resourceUri:t})})]})]})})}const qRe=async e=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:t}=await po(async()=>{const{MalloyRenderer:n}=await import("./index.umd-DGBekgSu.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 GRe({result:e,height:t,onDrill:n,onSizeChange:r}){const o=C.useRef(null),a=C.useRef(!1);return C.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 f=()=>{if(a.current||!i||!l.firstElementChild)return;const h=l.firstElementChild.firstElementChild;if(!h)return;const g=h.firstElementChild;let m=h.scrollHeight||h.offsetHeight||0;g&&h.classList.contains("malloy-dashboard")&&(m=g.scrollHeight||g.offsetHeight||0),m>0&&(a.current=!0,r&&r(m))};return qRe(n).then(h=>{if(i){c=new MutationObserver(()=>{d&&clearTimeout(d),d=setTimeout(()=>{f(),c?.disconnect()},100)}),c.observe(l,{childList:!0,subtree:!0,attributes:!0});try{h.setResult(JSON.parse(e)),h.render(l)}catch(g){console.error("Error rendering visualization:",g),c?.disconnect()}}}).catch(h=>{console.error("Failed to create renderer:",h)}),()=>{i=!1,c?.disconnect(),d&&clearTimeout(d)}},[e,n,r]),y.jsx("div",{ref:o,style:{width:"100%",height:t?`${t}px`:"400px"}})}function YRe(e){return typeof window>"u"?y.jsx("div",{style:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#666"},children:"Loading..."}):y.jsx(C.Suspense,{fallback:y.jsx("div",{style:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#666"},children:"Loading visualization..."}),children:y.jsx(GRe,{...e})})}const KRe=Object.freeze(Object.defineProperty({__proto__:null,default:YRe},Symbol.toStringTag,{value:"Module"})),Sr={primary:{main:"#14b3cb",light:"#22d3ee",dark:"#0e7490",50:"#ecfeff",100:"#cffafe",500:"#14b3cb",600:"#0891b2",700:"#0e7490"},secondary:{main:"#fbbb04",light:"#fde047",dark:"#eab308",50:"#fefce8",100:"#fef3c7",500:"#fbbb04",600:"#eab308",700:"#ca8a04"},grey:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827"},success:{main:"#059669",light:"#10b981",dark:"#047857"},warning:{main:"#d97706",light:"#f59e0b",dark:"#b45309"},error:{main:"#dc2626",light:"#ef4444",dark:"#b91c1c"},info:{main:"#0891b2",light:"#06b6d4",dark:"#0e7490"}},QRe=a0({palette:{mode:"light",primary:Sr.primary,secondary:Sr.secondary,grey:Sr.grey,success:Sr.success,warning:Sr.warning,error:Sr.error,info:Sr.info,background:{default:"#ffffff",paper:"#ffffff"},text:{primary:Sr.grey[900],secondary:Sr.grey[600]},divider:Sr.grey[200]},typography:{fontFamily:'"Inter", "Roboto", "Helvetica", "Arial", sans-serif',h1:{fontWeight:700,letterSpacing:"-0.025em"},h2:{fontWeight:700,letterSpacing:"-0.025em"},h3:{fontWeight:600,letterSpacing:"-0.025em"},h4:{fontWeight:600,letterSpacing:"-0.025em"},h5:{fontWeight:600,letterSpacing:"-0.025em"},h6:{fontWeight:600,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:{MuiCssBaseline:{styleOverrides:{body:{scrollbarWidth:"thin",scrollbarColor:`${Sr.grey[300]} ${Sr.grey[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:Sr.grey[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:Sr.grey[300],borderRadius:"4px","&:hover":{background:Sr.grey[400]}},"&::-webkit-scrollbar-corner":{background:Sr.grey[100]}},"*":{scrollbarWidth:"thin",scrollbarColor:`${Sr.grey[300]} ${Sr.grey[100]}`,"&::-webkit-scrollbar":{width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:Sr.grey[100],borderRadius:"4px"},"&::-webkit-scrollbar-thumb":{background:Sr.grey[300],borderRadius:"4px","&:hover":{background:Sr.grey[400]}},"&::-webkit-scrollbar-corner":{background:Sr.grey[100]}},"div[data-radix-popper-content-wrapper]":{zIndex:"1300 !important"}}},MuiButton:{styleOverrides:{root:{borderRadius:4,textTransform:"none",fontWeight:500,boxShadow:"none","&:hover":{boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"}},contained:{"&:hover":{boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"}}}},MuiCard:{styleOverrides:{root:{borderRadius:4,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",border:"1px solid",borderColor:"rgba(0, 0, 0, 0.05)"}}},MuiChip:{styleOverrides:{root:{borderRadius:4,fontWeight:500}}},MuiTextField:{styleOverrides:{root:{"& .MuiOutlinedInput-root":{borderRadius:4}}}},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)"}}},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 rgba(0, 0, 0, 0.05)"}}},MuiBreadcrumbs:{styleOverrides:{root:{"& .MuiBreadcrumbs-separator":{margin:"0 6px",color:Sr.grey[400]}}}},MuiDivider:{styleOverrides:{root:{margin:"4px 0",borderColor:Sr.grey[200]}},defaultProps:{sx:{my:1}}}}}),XRe=C.lazy(()=>po(()=>import("./HomePage-Dn3E4CuB.js"),[])),ZRe=C.lazy(()=>po(()=>import("./MainPage-BzB3yoqi.js"),[])),JRe=C.lazy(()=>po(()=>import("./ModelPage-C9O_sAXT.js"),[])),eMe=C.lazy(()=>po(()=>import("./PackagePage-DcxKEjBX.js"),[])),tMe=C.lazy(()=>po(()=>import("./ProjectPage-BDj307rF.js"),[])),nMe=C.lazy(()=>po(()=>import("./RouteError-DAShbVCG.js"),[])),rMe=C.lazy(()=>po(()=>import("./WorkbookPage-Cs_XYEaB.js"),[])),oMe=(e="/",t,n)=>xU([{path:e,element:y.jsx($te,{children:y.jsx(Tve,{workbookStorage:t,children:y.jsxs(Aq,{theme:QRe,children:[y.jsx(VK,{}),y.jsx(ZRe,{headerProps:n})]})})}),errorElement:y.jsx(nMe,{}),children:[{path:"",element:y.jsx(XRe,{})},{path:":projectName",element:y.jsx(tMe,{})},{path:":projectName/:packageName",element:y.jsx(eMe,{})},{path:":projectName/:packageName/*",element:y.jsx(JRe,{})},{path:":projectName/:packageName/workbook/:workspace/:workbookPath",element:y.jsx(rMe,{})}]}]),aMe=oMe("/",new Mve,void 0);S$.createRoot(document.getElementById("root")).render(y.jsx(C.StrictMode,{children:y.jsx(OU,{router:aMe})}));export{Je as $,BK as A,lu as B,Eb as C,Zk as D,UMe as E,U2e as F,HMe as G,VMe as H,kr as I,Hz as J,dg as K,$pe as L,eg as M,Pk as N,cMe as O,Vs as P,Du as Q,sm as R,io as S,mt as T,U0 as U,xk as V,Ek as W,DP as X,H6 as Y,$Me as Z,sMe as _,ka as a,Ll as a0,qm as a1,iMe as a2,Y5 as a3,_t as b,Ft as c,Dve as d,jt as e,ht as f,qV as g,Ke as h,zMe as i,y as j,Lt as k,Qo as l,Kt as m,ac as n,rC as o,w4 as p,Zi as q,C as r,ze as s,lMe as t,sw as u,Bt as v,h3 as w,oc as x,Jl as y,Sa as z};