forked from bombastictranz/DuneQueryRepo
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
[[...slug]]-ad391516a822e3f0.js.download
2 lines (2 loc) · 107 KB
/
[[...slug]]-ad391516a822e3f0.js.download
1
2
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9976],{38194:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/queries/[[...slug]]",function(){return n(58103)}])},58789:function(e,t,n){"use strict";n.d(t,{a:function(){return l},u:function(){return a}});var r=n(85893),i=n(67294);let s=(0,i.createContext)(void 0);function a(e){return(0,r.jsx)(s.Provider,{value:e.value,children:e.children})}function l(){let e=(0,i.useContext)(s);if(void 0===e)throw Error("Attempted to use LoggedInContext outside it's provider!");return e}},5228:function(e,t,n){"use strict";n.d(t,{c:function(){return h}});var r=n(85893),i=n(37242),s=n(11163),a=n(67294),l=n(57831),o=n(85361),d=n(58789),u=n(10475),c=n(71909);function h(e){return function(t){let n=(0,s.useRouter)(),h=(0,c.J)(),{session:v,sessionLoading:m}=(0,a.useContext)(l.B3),p=(0,o._0)(),x=(0,a.useMemo)(()=>(null==v?void 0:v.user)?{...v,user:v.user}:void 0,[v]);return m||(0,u.s$)()||!n.isReady?(0,r.jsx)(i.h,{}):x?p?(0,r.jsx)(d.u,{value:{activeContext:p,session:x},children:(0,r.jsx)(e,{...t})}):(0,r.jsx)(i.h,{}):(n.replace(h),(0,r.jsx)(i.h,{}))}}},36986:function(e,t,n){"use strict";n.d(t,{a:function(){return r.a},c:function(){return i.c}});var r=n(58789),i=n(5228)},76644:function(e,t,n){"use strict";n.d(t,{f:function(){return i}});var r=n(84077);function i(){let[e,t,n]=(0,r.Z)("query-event",void 0);return{activeQueryEventId:e,setActiveQueryEventId:t,getActiveQueryEventIdUrl:n}}},20139:function(e,t,n){"use strict";n.d(t,{Y:function(){return l}});var r=n(85893),i=n(22169),s=n(44161),a=n(82876);function l(e){let{theme:t,height:n,...s}=e,{mode:l}=(0,a.v)();return(0,r.jsx)(i.ZP,{style:{height:"100%"},theme:[u,d[l],null!=t?t:[]],...s})}let o={background:"var(--background--base)",gutterBackground:"var(--background--base)",lineHighlight:"transparent",fontFamily:"IBM Plex Mono"},d={light:(0,s.s8)({settings:o}),dark:(0,s.A)({settings:o})},u=i.tk.baseTheme({"&.cm-editor":{height:"100%",padding:"1.6rem",fontSize:"1.3rem"},"&.cm-focused":{outline:"none"}})},68576:function(e,t,n){"use strict";n.d(t,{f:function(){return h}});var r=n(82729),i=n(67294),s=n(83171),a=n(57831),l=n(51577),o=n(39137),d=n(84937);function u(){let e=(0,r._)(["\n query GetInitialQueryEvent($query_id: Int!) {\n initialQueryEvent(queryId: $query_id) {\n id\n userId\n teamId\n queryVersion\n from\n to\n type\n createdAt\n metadata {\n name\n description\n }\n }\n }\n"]);return u=function(){return e},e}function c(){let e=(0,r._)(["\n query GetQueryEvents($query_id: Int!, $pagination: LimitOffsetInput!) {\n queryEvents(query_id: $query_id, pagination: $pagination) {\n results {\n id\n userId\n teamId\n queryVersion\n from\n to\n type\n createdAt\n metadata {\n name\n description\n }\n }\n pastRetentionWindow\n retentionDays\n }\n }\n"]);return c=function(){return e},e}let h=(e,t)=>{var n,r,o;let u=(0,a.kP)(),{data:c}=(0,d.nDB)({context:{session:u},variables:{query_id:e},skip:!u||void 0===e,fetchPolicy:null==t?void 0:t.fetchPolicy,onError:l.k.error}),h=(0,d.qRg)({context:{session:u},variables:{query_id:e,pagination:{limit:25,offset:0}},skip:!u||void 0===e,fetchPolicy:null==t?void 0:t.fetchPolicy,onError:l.k.error}),{data:v}=h,m=(0,i.useMemo)(()=>{let e=new Map;if(v)for(let n of null==v?void 0:v.queryEvents.results){var t;let r=(0,s.o0)(n.createdAt),i=null!==(t=e.get(r))&&void 0!==t?t:e.set(r,[]).get(r);i.push(n)}return e},[null==v?void 0:v.queryEvents.results]);return{...h,queryEventDateMap:m,initialQueryEvent:null!==(n=null==c?void 0:c.initialQueryEvent)&&void 0!==n?n:void 0,retentionInfo:{pastRetentionWindow:null!==(r=null==v?void 0:v.queryEvents.pastRetentionWindow)&&void 0!==r&&r,retentionDays:null!==(o=null==v?void 0:v.queryEvents.retentionDays)&&void 0!==o?o:0}}};(0,o.Z)(u()),(0,o.Z)(c())},28889:function(e,t,n){"use strict";n.d(t,{l:function(){return u}});var r=n(85893),i=n(10933),s=n(33473),a=n(56283),l=n(67294),o=n(42120),d=n(57831);function u(e){var t;let[n,u]=(0,l.useState)(!1),c=(0,o.Lf)(),h=(0,o.ws)(),v=null!==(t=(0,o.hC)())&&void 0!==t&&t,m=(0,d.kP)();if(!c||!h||v||!m)return null;let{renderSettingsButton:p=e=>{let{active:t,onClick:n}=e;return(0,r.jsx)(i.h,{theme:"tertiary",size:"M",onClick:n,active:t,children:(0,r.jsx)(s.Z,{})})}}=e;return(0,r.jsxs)(r.Fragment,{children:[p({active:n,onClick:()=>u(e=>!e)}),(0,r.jsx)(a.V,{isOpen:n,close:()=>u(!1),session:m,trackedButtonLocationOnPage:e.trackedButtonLocationOnPage})]})}},33183:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(82729),i=n(84937);function s(){let e=(0,r._)(["\n query GetExecutionStats($id: String!) {\n getExecutionStats(executionId: $id) {\n wall_time_seconds: wallTimeSeconds\n analysis_time_seconds: analysisTimeSeconds\n cpu_time_seconds: cpuTimeSeconds\n created_at: createdAt\n cumulative_memory_bytes: cumulativeMemoryBytes\n execution_id: executionId\n execution_time_seconds: executionTimeSeconds\n output_bytes: outputBytes\n output_rows: outputRows\n peak_task_total_memory_bytes: peakTaskTotalMemoryBytes\n physical_input_bytes: physicalInputBytes\n physical_input_rows: physicalInputRows\n queued_time_seconds: queuedTimeSeconds\n directly_referenced_table_names: directlyReferencedTableNames\n }\n }\n"]);return s=function(){return e},e}function a(e){let{executionId:t,skip:n}=e;return(0,i.pgX)({skip:void 0===t||n,variables:{id:t}})}(0,n(39137).Z)(s())},36721:function(e,t,n){"use strict";n.d(t,{l:function(){return _}});var r=n(85893),i=n(67294),s=n(9522),a=n.n(s),l=n(7036),o=n(61451),d=n(10933),u=n(41118),c=n(39612),h=n(4817),v=n.n(h),m=n(15660),p=n.n(m),x=n(72853),y=n.n(x);n(35266);let f={diffViewerBackground:"var(--palette--gray--800)",diffViewerColor:"#EBDAB4",addedBackground:"rgba(137, 219, 181, 0.16)",addedColor:"#EBDAB4",removedBackground:"rgba(248, 162, 156, 0.16)",removedColor:"#EBDAB4",wordAddedBackground:"#055d67",wordRemovedBackground:"#7d383f",addedGutterBackground:"rgba(137, 219, 181, 0.16)",removedGutterBackground:"rgba(248, 162, 156, 0.16)",gutterBackground:"var(--palette--gray--800)",gutterBackgroundDark:"var(--palette--gray--800)",highlightBackground:"#2a3967",highlightGutterBackground:"#2d4077",codeFoldGutterBackground:"#21232b",codeFoldBackground:"#262831",emptyLineBackground:"#363946",gutterColor:"#9CA1A5",addedGutterColor:"#89DBB5",removedGutterColor:"#F36960",codeFoldContentColor:"#555a7b",diffViewerTitleBackground:"#2f323e",diffViewerTitleColor:"#555a7b",diffViewerTitleBorderColor:"#353846"},j=e=>{let{from:t,to:n}=e;return(0,r.jsx)("div",{className:y().container,children:(0,r.jsx)(v(),{oldValue:t,newValue:n,splitView:!1,showDiffOnly:!1,useDarkTheme:!0,styles:{variables:{dark:f},gutter:{pre:{opacity:1},":first-of-type":{display:t===n?"none":void 0}},diffContainer:{pre:{lineHeight:"2.0rem"}},wordDiff:{padding:0}},renderContent:e=>(0,r.jsx)("pre",{style:{display:"inline"},dangerouslySetInnerHTML:{__html:p().highlight(e,p().languages.sql,"sql")}})})})};var g=n(83171);let _=e=>{let{queryEvent:t,query:n,onClose:s}=e,{createdAt:h,to:v}=null!=t?t:{},[m,p]=(0,i.useState)(!0),[x,y]=(0,i.useState)(!1),f=m?n:v.query;return(0,r.jsxs)("div",{className:a().container,children:[(0,r.jsx)(g.iH,{queryEventId:t.id,isOpen:x,onDismiss:()=>{y(!1)},onQueryRestored:()=>{null==s||s()}}),(0,r.jsxs)("div",{className:a().header,children:[(0,r.jsx)("p",{children:(0,c.EV)(h)}),(0,r.jsxs)("div",{className:a().right,children:[(0,r.jsx)("div",{children:(0,r.jsx)(l.Z,{label:"Show Differences",loading:!1,enabled:m,setEnabled:p})}),(0,r.jsx)(o.z,{theme:"tertiary",size:"M",onClick:()=>{y(!0)},children:"Restore Version"}),(0,r.jsx)(d.h,{theme:"tertiary",size:"M",onClick:s,children:(0,r.jsx)(u.IconCross,{})})]})]}),(0,r.jsx)(j,{from:f,to:v.query})]})}},91210:function(e,t,n){"use strict";n.d(t,{X:function(){return s}});var r=n(85893),i=n(67294);function s(e){let t=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=t.current;null!==e&&(()=>{let t=e.placeholder;e.placeholder="",e.clientHeight===e.scrollHeight&&(e.style.height="0"),e.style.height="".concat(e.scrollHeight,"px"),e.placeholder=t})()},[e.value]),(0,r.jsx)("textarea",{ref:t,...e})}},20705:function(e,t,n){"use strict";n.d(t,{l:function(){return d},p:function(){return u}});var r=n(85893),i=n(67294),s=n(15490),a=n(51577),l=n(11163),o=n(71909);let d=e=>{let{replace:t,push:n}=(0,l.useRouter)(),o=!e.href.startsWith("/");return i.useEffect(()=>{e.replace&&o?window.location.replace(e.href):e.replace?t(e.href).catch(a.k.error):o?window.location.href=e.href:n(e.href).catch(a.k.error)},[e.href,o]),(0,r.jsx)(s.g,{})},u=()=>{let e=(0,o.J)();return(0,r.jsx)(d,{href:e})}},58765:function(e,t,n){"use strict";n.d(t,{H:function(){return v}});var r=n(85893),i=n(41664),s=n.n(i),a=n(99292),l=n.n(a),o=n(47730),d=n(30297),u=n(54179),c=n(1801),h=n(32613);function v(e){let{avatarList:t,maxAvatars:n=5,invertStackLayout:i=!1}=e;function a(e){switch(e){case"S":return 16;case"L":return 24;default:return 20}}let v=t.length;return(0,r.jsxs)("div",{className:l().avatarGroup,suppressHydrationWarning:!0,children:[(0,r.jsx)("ul",{className:l().avatarsList,children:t.slice(0,n).map((t,u)=>(0,r.jsx)("li",{className:l().element,style:{zIndex:i?n-u:"auto"},children:(0,r.jsx)(s(),{href:"/".concat(t.handle),children:(0,r.jsx)(o.u,{label:"@".concat(t.handle),position:"below-center",children:(0,r.jsx)("div",{className:l().avatarWrapper,children:(0,r.jsx)(d.q,{ownerId:t.ownerId,handle:t.handle,src:t.profile_image_url,size:a(e.size),type:t.type})})})})},t.handle))}),v>n&&(0,r.jsx)(u.c,{position:"below-align-right",content:()=>(0,r.jsx)(h.s_,{children:(0,r.jsx)(h.$0,{children:t.slice(n).map(t=>(0,r.jsxs)(h.FB,{href:"/".concat(t.handle),children:[(0,r.jsx)(d.q,{ownerId:t.ownerId,handle:t.handle,src:t.profile_image_url,size:a(e.size),type:t.type}),"@",t.handle]},t.handle))})}),children:(0,r.jsxs)(c.C,{size:"S",variant:"filled",color:"neutral",children:["+",v-n]})})]})}},25088:function(e,t,n){"use strict";n.r(t),n.d(t,{IconFadersHorizontalPlus:function(){return i}});var r=n(85893);function i(){return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("path",{d:"M2.5 13H9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M11.5 13H14.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M13 11.5V14.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M8.5 3H2.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M13.5 3H10.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M4.5 8H2.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M13.5 8H6.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M6.5 6.5V9.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M10.5 4.5V1.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]})}},38598:function(e,t,n){"use strict";n.r(t),n.d(t,{IconFileCsvDownload:function(){return i}});var r=n(85893);let i=()=>(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("path",{d:"M10.75 11.5L12 14.5L13.25 11.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M5 14.1562C4.76078 14.3749 4.44911 14.4974 4.125 14.5C3.3625 14.5 2.75 13.8313 2.75 13C2.75 12.1687 3.3625 11.5 4.125 11.5C4.44911 11.5026 4.76078 11.6251 5 11.8438",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M7 14.25C7.27088 14.452 7.59957 14.5616 7.9375 14.5625C8.5 14.5625 9 14.375 9 13.75C9 12.75 7 13.1875 7 12.25C7 11.75 7.375 11.4375 7.9375 11.4375C8.27543 11.4384 8.60412 11.548 8.875 11.75",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M3 9V1.5C3 1.36739 3.05268 1.24021 3.14645 1.14645C3.24021 1.05268 3.36739 1 3.5 1H9.5L13 4.5V9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M9.5 1V4.5H13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M0.5 7L3 9.5L5.5 7",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]})},95257:function(e,t,n){"use strict";n.r(t),n.d(t,{IconTableMaterialized:function(){return i}});var r=n(85893);let i=e=>{let{className:t}=e;return(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,r.jsx)("path",{d:"M1.5 6C1.5 5.72386 1.72386 5.5 2 5.5H12C12.2761 5.5 12.5 5.72386 12.5 6V14C12.5 14.2761 12.2761 14.5 12 14.5H2C1.72386 14.5 1.5 14.2761 1.5 14V6Z",stroke:"currentColor"}),(0,r.jsx)("path",{d:"M4.5 2C4.5 1.72386 4.72386 1.5 5 1.5H14C14.2761 1.5 14.5 1.72386 14.5 2V8C14.5 8.27614 14.2761 8.5 14 8.5H5C4.72386 8.5 4.5 8.27614 4.5 8V2Z",stroke:"currentColor"}),(0,r.jsx)("path",{d:"M2 8.5H12",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M2 11.5H12",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M4.5 8.5V14.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M9.5 1.5V14.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]})}},78662:function(e,t,n){"use strict";n.d(t,{f:function(){return h}});var r=n(85893),i=n(19738),s=n.n(i),a=n(94184),l=n.n(a),o=n(10933),d=n(41118),u=n(41664),c=n.n(u);let h=e=>{let{href:t,replace:n,active:i,onDismiss:a,shallow:u}=e;return(0,r.jsxs)(c(),{href:t,replace:n,shallow:u,className:l()(s().tab,i&&s().active,a&&s().dismissible),onClick:e.onClick,children:[e.children,a&&(0,r.jsx)(o.h,{theme:"ghost",size:"XS",onClick:e=>{e.preventDefault(),e.stopPropagation(),a()},"aria-label":"Remove",children:(0,r.jsx)(d.IconCross,{})})]})}},71510:function(e,t,n){"use strict";n.d(t,{X:function(){return l},f:function(){return a}});var r=n(11163),i=n(94682);let s=()=>{let{query:e}=(0,r.useRouter)();if("slugs"in e)throw Error("The slug parameter should not be pluralized.");return e.slug?e.slug instanceof Array?e.slug:[e.slug]:[]},a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return s()[e]},l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=a(e);return void 0===t?t:(0,i.YX)(t,void 0)}},58103:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return iX},default:function(){return iK}});var r=n(85893),i=n(67294),s=n(94184),a=n.n(s),l=n(37469),o=n.n(l),d=n(61451),u=n(54173),c=n(10933),h=n(88812),v=n(47730),m=n(5152),p=n.n(m),x=n(4755),y=n.n(x),f=n(15490),j=n(42120);let g=p()(()=>Promise.all([n.e(4281),n.e(2307),n.e(7018),n.e(8878)]).then(n.bind(n,48878)),{loadableGenerated:{webpack:()=>[48878]},loading:()=>(0,r.jsx)(_,{}),ssr:!1}),_=()=>{let e=(0,j.gi)();return(0,r.jsx)("div",{className:a()(y().loading,e),children:(0,r.jsx)(f.g,{})})};var w=n(32911),C=n.n(w),b=n(25088),k=n(17479),q=n(18172),E=n(83787),z=n(57831);let S=()=>{let e=(0,j._3)(),t=(0,j.f8)(),n=(0,j.M2)(),i=(0,j.I8)();return e?(0,r.jsx)(c.h,{theme:"tertiary",size:"M",onClick:()=>{var t;let r=(0,E.yi)(null!==(t=null==e?void 0:e.defaults)&&void 0!==t?t:[]),s=(0,E.Ds)(r.parameter);n.includes(s)||null==i||i.paste(s)},disabled:(null==t?void 0:t.is_archived)||!!(null==t?void 0:t.matview_id),children:(0,r.jsx)(b.IconFadersHorizontalPlus,{})}):null},I=()=>{let e=(0,j.L$)(),t=(0,j._3)(),n=(0,j.Lf)(),s=(0,j.Yt)(),a=(0,j.f8)(),l=(0,j.M2)(),{session:o}=(0,i.useContext)(z.B3);if(!t)return null;let d=t=>{e({type:"replaceQueryParameters",parameters:t})};if(!n&&0===t.defaults.length)return null;let u=!(null==a?void 0:a.is_archived)&&!!o;return(0,r.jsx)("div",{className:C().parameters,children:(0,r.jsx)(k.a,{parameters:t.defaults,overrides:t.overrides,applied:t.applied,onOverride:t.onOverride,onApply:()=>{var e;null==s||null===(e=s.refresh)||void 0===e||e.call(s),t.onApply()},onRemove:n?e=>{d((0,q.ZP)(t.defaults,t=>{t.splice((0,E.kZ)(t,e),1)}))}:void 0,onReplace:n?(n,r)=>{let i=(0,E.Ds)(t.defaults[n]),s=(0,E.Ds)(r);i&&s&&e({type:"replaceQueryCode",code:l.replaceAll(i,s)}),d((0,q.ZP)(t.defaults,e=>{e[n]=r}))}:void 0,disabled:!u,canEdit:n})})};var M=n(66465),N=n(76644),T=n(68576),L=n(45186),P=n(32613),Q=n(80949);function D(){let e=(0,j.gi)(),t=(0,j.L$)(),n="light"===e?"dark":"light";return(0,r.jsxs)(P.ys,{onClick:()=>{t({type:"selectTheme",theme:n})},children:[(0,r.jsxs)("span",{children:["Switch to ",n," theme"]}),(0,r.jsx)(A,{theme:n})]})}function A(e){let{theme:t}=e;switch(t){case"light":return(0,r.jsx)(Q.J,{icon:"sun-fill"});case"dark":return(0,r.jsx)(Q.J,{icon:"moon-fill"})}}var O=n(33473);function B(e){let t=(0,j.OA)(),n=function(e){switch(e){case"pg":case"spark":return!0;default:return!1}}(null==t?void 0:t.type),i=new URLSearchParams(window.location.search).get("migrate");return i&&n?(0,r.jsx)(P.ys,{onClick:e.onClick,children:"Migrate to Dune SQL (experimental)"}):null}var R=n(59999),F=n(44227),V=n.n(F),U=n(18605),Z=n(43583),$=n(48114),G=n(50124),W=n(93166);let Y=(e,t)=>{var n;let r=null!==(n=t.tokenizerOptions.extraParens)&&void 0!==n?n:[];return J((0,G.w4)(e,{dialect:{tokenizerOptions:{...t.tokenizerOptions,extraParens:[...r,"{}"]},formatOptions:t.formatOptions}}))};function H(e){switch(e){case"pg":default:return W.D;case"spark":return Z.j;case"trino":return U.h}}let J=e=>e.replaceAll(/[&|^<>!=+\-%*/](?={{)/g,"$& ").replaceAll("_ {{","_{{"),X=()=>{let e=(0,j.f8)(),t=(0,j.OA)(),[n,s]=(0,i.useState)(!1),a=(0,j.L$)(),l=H(null==t?void 0:t.type);return(0,i.useEffect)(()=>{let e=null;return n&&(e=window.setTimeout(()=>{s(!1)},1e3)),()=>{e&&clearTimeout(e)}},[n]),(0,r.jsx)(c.h,{theme:"tertiary",size:"M",onClick:()=>{let t=null==e?void 0:e.query;t&&(s(!0),a({type:"replaceQueryCode",code:Y(t,l)}))},disabled:null==e?void 0:e.is_archived,children:n?(0,r.jsx)(Q.J,{icon:"check-filled"}):(0,r.jsx)($.Z,{})})};var K=n(56223),ee=n(40802),et=n(51577);function en(e){let[t,n]=function(){var e;let[t,n]=(0,i.useState)({status:"init"}),r=(0,j.f8)(),s=(0,j.OA)(),a=H(null==s?void 0:s.type),l=null!==(e=null==s?void 0:s.name)&&void 0!==e?e:"ethereum",o=(0,j.L$)(),{captureEvent:d}=(0,M.z$)();function u(e){let{success:t}=e;s&&r&&"id"in r&&d("Translate query",{dataset:{id:s.id,language:s.type},queryId:r.id,success:t})}return[function(){return new Promise((null==r?void 0:r.query)===void 0||"loading"===status?()=>{}:e=>{n({status:"loading"}),(0,K.Ko)("https://querytranslator.dune.com/",{query:r.query,dialect:function(e){switch(e){case Z.j:return"spark";case U.h:return"trino";default:return"postgresql"}}(a),dataset:l}).then(t=>{n({status:"success"}),u({success:!0}),o({type:"selectDataset",id:11}),o({type:"replaceQueryCode",code:function(e,t){try{return Y(e,t)}catch(t){return et.k.error(t),e}}(t.translated,U.h)}),e()},e=>{if(400===e.statusCode){let t=e.jsonBody.detail;n({status:"error",hint:t}),u({success:!1})}else n({status:"error"}),u({success:!1});e.message="Query translation failed: "+e.message,ee.Tb(e)})})},t]}();return(0,r.jsxs)("div",{className:V().content,children:[(0,r.jsxs)("div",{className:V().main,children:[(0,r.jsx)("h3",{children:"Migrate query to Dune SQL"}),(0,r.jsx)("p",{children:"Once the query is migrated, the query will automatically be changed to run against Dune SQL."}),(0,r.jsxs)("p",{children:["Before you migrate, consider forking this query to have a backup. It should be possible to select the code editor and hit"," ",(0,r.jsx)(P.z9,{shortcut:{pc:"ctrl+z",mac:"cmd+z"}})," to undo the code changes after migrating, but you may not be able to change back to the dataset you used previously, if it is deprecated."]})]}),"error"===n.status&&(0,r.jsxs)("div",{className:V().errorMessage,children:[(0,r.jsx)(Q.J,{icon:"warning-triangle"}),(0,r.jsxs)("div",{className:V().blocks,children:[(0,r.jsx)("p",{children:"Failed to migrate the query."}),(0,r.jsx)("p",{children:'Please check that the query runs and that you have quotes around columns like "from", as this is a reserved word.'}),n.hint&&(0,r.jsxs)("p",{children:["The migration tool returned an error message:",(0,r.jsx)("br",{}),n.hint]}),(0,r.jsxs)("p",{children:["If you still face issues, please reach out to us on Discord in the"," ",(0,r.jsx)("a",{href:"https://discord.com/channels/757637422384283659/1051871389432422491",target:"_blank",rel:"noreferrer",children:"#dune-SQL"})," ","channel."]})]})]}),(0,r.jsxs)("div",{className:V().buttonGroup,children:[(0,r.jsx)(d.z,{theme:"primary",size:"M",onClick:()=>t().then(e.close),loading:"loading"===n.status,children:"Migrate"}),(0,r.jsx)(d.z,{theme:"tertiary",size:"M",onClick:e.close,children:"Cancel"})]})]})}var er=n(1801),ei=n(24426);let es=e=>{let[t,n]=(0,i.useState)(!1),s=(0,ei.N)("codemirror"),a=(0,j.yi)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L.f,{position:"above-align-left",content:t=>{let{close:i}=t;return(0,r.jsxs)(P.s_,{children:[s&&(0,r.jsx)(P.$0,{children:(0,r.jsx)(ea,{})}),(0,r.jsxs)(P.$0,{children:[e.editable&&(0,r.jsx)(el,{}),!a&&(0,r.jsx)(D,{}),(0,r.jsx)(eo,{toggleEditorFullscreen:e.toggleEditorFullscreen}),(0,r.jsx)(B,{onClick:()=>{n(!0),i()}})]})]})},children:(0,r.jsx)("span",{children:(0,r.jsx)(iW,{tooltip:"Settings",children:(0,r.jsx)(c.h,{theme:"tertiary",size:"M",children:(0,r.jsx)(O.Z,{})})})})}),(0,r.jsx)(R.Vq,{size:"sm",label:"Migrate to Dune SQL",isOpen:t,onDismiss:()=>n(!1),children:(0,r.jsx)(en,{close:()=>n(!1)})})]})};function ea(){let e=(0,j.L$)(),t=(0,j.yi)();return(0,r.jsxs)(P.ys,{onClick:()=>e({type:"toggleEnableCodeMirror"}),children:[(0,r.jsxs)("span",{children:["Use ",t?"old":"new"," editor"]}),(0,r.jsx)(er.C,{size:"M",variant:"filled",color:"info",children:"Feature flagged"})]})}function el(){let e=(0,j.lF)(),t=(0,j.L$)();return(0,r.jsx)(P.Bl,{checked:e,onChange:()=>t({type:"toggleAutosuggest"}),description:"You can always show suggestions with CTRL-space",hasIconBeforeText:!1,children:(0,r.jsx)("span",{children:"Enable autosuggest (beta)"})})}function eo(e){if(!document.fullscreenEnabled)return null;let t=document.fullscreenElement;return(0,r.jsxs)(P.ys,{onClick:e.toggleEditorFullscreen,children:[(0,r.jsx)("span",{children:t?"Exit fullscreen":"Fullscreen"}),(0,r.jsx)(P.z9,{shortcut:{pc:"ctrl+shift+f",mac:"cmd+shift+f"}})]})}let ed=p()(()=>Promise.all([n.e(492),n.e(9028),n.e(1595),n.e(702),n.e(747)]).then(n.bind(n,22510)).then(e=>e.EditorPageSidebar),{loadableGenerated:{webpack:()=>[22510]},loading:()=>null,ssr:!1});var eu=n(30990),ec=n(20426),eh=n(46166);let ev=(e,t)=>{let n=i.useCallback(n=>{n.key===e&&(n.metaKey||n.ctrlKey)&&t()},[e,t]);i.useEffect(()=>(document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)),[n])};var em=n(84077),ep=n(72939),ex=n(45172);let ey=(0,i.createContext)(void 0);function ef(e){let{children:t}=e,n=(0,j.OW)(),s=(0,j.Rr)(),a=(0,j.M2)(),l=(0,z.qy)(),o=function(){let[e]=(0,em.Z)("wand",void 0);if(void 0!==e)try{return decodeURIComponent(e)}catch(e){return""}}(),[d,u]=(0,i.useState)(void 0!==o),[c,h]=(0,i.useState)(""===a?"create":"edit"),[v,m]=(0,i.useState)(!1),[p,x]=(0,i.useState)(null!=o?o:""),[y,f]=(0,i.useState)(null);if((0,i.useEffect)(()=>{u(void 0!==o),x(null!=o?o:"")},[o]),void 0===l)return(0,r.jsx)(ey.Provider,{value:void 0,children:t});let g=async()=>{try{m(!0);let e=await (0,ep.Zf)(p,n,s,l);if(void 0===e)return;return ex.Z.trackEvent("Wand Generate SQL",{prompt:p,sql:e.query}),f(e),e.query}finally{m(!1)}},_=async()=>{try{m(!0);let e=await (0,ep.Ah)(p,a,l);if(void 0===e)return;return ex.Z.trackEvent("Wand Edit SQL",{prompt:p,sql:e.query,previous_sql:a}),e.query}finally{m(!1)}},w=async e=>{await (0,ep.Vu)(null==y?void 0:y.response_id,e,l)};return(0,r.jsx)(ey.Provider,{value:{isOpen:d,setIsOpen:u,mode:c,setMode:h,isRunning:v,setIsRunning:m,question:p,setQuestion:x,createQuery:g,editQuery:_,updateCompletionQueryId:w},children:t})}function ej(){return(0,i.useContext)(ey)}var eg=n(11163),e_=n.n(eg),ew=n(17870),eC=n(57903),eb=n(19592),ek=n(38252),eq=n(41664),eE=n.n(eq),ez=n(81167),eS=n.n(ez);function eI(e){let{error:t,onErrorChange:n}=e,i=(0,j.f8)();return void 0!==i&&"id"in i?(0,r.jsx)(R.Vq,{label:"Query has changed",size:"sm",isOpen:null!==t,onDismiss:()=>{e.onErrorChange(null)},children:(0,r.jsx)(eM,{activeContext:e.activeContext,performance:e.performance,query:i,error:t,onErrorChange:n})}):null}function eM(e){let{activeContext:t,performance:n,query:i,error:s,onErrorChange:a}=e,{getActiveQueryEventIdUrl:l}=(0,N.f)(),o=(0,eb.x)({onQueryHasChangedError:a}),u=(0,ek.h)({activeContext:t,performance:n});if(null===s)return null;let{queryEvent:c,queryVersion:h}=s,v=()=>{a(null)},m=async()=>{let e={...i,version:h},t=await o(e);void 0!==t&&(await u(t,{refresh:!0}),v())},p=void 0!==c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(eE(),{href:"/".concat(c.requestor.handle),children:["@",c.requestor.handle]})," ","just saved"," ",(0,r.jsx)(eE(),{href:l(c.id),onClick:v,children:"a new version of this query"}),", saving over it will impact visualisations that rely on this query."]}):(0,r.jsx)(r.Fragment,{children:"A new version of this query exists. Saving over it will impact visualisations that rely on this query."});return(0,r.jsxs)("div",{className:eS().content,children:[(0,r.jsxs)("div",{className:eS().main,children:[(0,r.jsx)("h3",{children:"There's a new version of this query"}),(0,r.jsx)("p",{children:p})]}),(0,r.jsxs)("div",{className:eS().buttonGroup,children:[(0,r.jsx)(d.z,{theme:"primary",size:"M",onClick:m,children:"Save anyway"}),(0,r.jsx)(d.z,{theme:"tertiary",size:"M",onClick:v,children:"Back"})]})]})}var eN=n(27005),eT=n.n(eN),eL=n(31544),eP=n.n(eL),eQ=n(7301),eD=n(53947),eA=n(50292);function eO(e){let[t,n]=(0,i.useState)(!1);return(0,r.jsxs)(r.Fragment,{children:[e.children,(0,r.jsx)(eQ.t9,{isOpen:e.isOpen,onDismiss:e.close,className:eT().overlay,children:(0,r.jsx)(eQ.cZ,{className:a()(eP().contentWrapper,eP()["size-M"]),"aria-label":"updateMatViewDefinition",children:(0,r.jsxs)("div",{className:eP().body,children:[(0,r.jsxs)("div",{className:eP().header,children:[(0,r.jsx)("div",{className:eP().titleRow,children:(0,r.jsx)("h2",{children:"Update a materialized view"})}),(0,r.jsx)("p",{className:eP().description,children:"You are about to update a materialized view definition. The materialized view will also update with the new SQL statement and may impact other queries if there are breaking changes."})]}),(0,r.jsx)(eD.o,{checked:t,onChange:()=>n(!t),children:"Ignore warning for the next 15 minutes"}),(0,r.jsxs)("div",{className:eP().buttons,children:[(0,r.jsx)(d.z,{size:"M",theme:"tertiary",onClick:e.close,children:"Cancel"}),(0,r.jsx)(d.z,{size:"M",theme:"primary",onClick:()=>{t&&((0,eA.EB)("ignore_warning_on_matview_definition_update",new Date().toISOString()),n(!1)),e.onContinueExecution(),e.close()},children:"Continue with execution"})]})]})})})]})}var eB=n(82729),eR=n(78718),eF=n.n(eR),eV=n(84937),eU=n(39137);function eZ(){let e=(0,eB._)(["\n mutation UpdateMatView($input: UpdateMaterializedViewInput!) {\n updateMaterializedView(input: $input) {\n matview_id: id\n query_id: queryId\n sql_names: sqlNames\n is_private: isPrivate\n execution_id: executionId\n schedule {\n id\n cron_expression: cronExpression\n performance\n next_execution_time: nextExecutionTime\n }\n }\n }\n"]);return eZ=function(){return e},e}let e$=()=>{let[e,t]=(0,eV.Kvi)();return async n=>{let{session:r,values:i,queryOwner:s,queryId:a}=n;return t.loading?new Promise(()=>{}):await e({context:{session:r},variables:{input:{updater:eF()(s,["id","type"]),queryId:a,isPrivate:i.private,performance:i.performanceTier,cronExpression:i.cronString}},refetchQueries:[{query:eV.Tqw,variables:{id:i.matViewId},context:{session:r}}],awaitRefetchQueries:!0})}};(0,eU.Z)(eZ());var eG=n(45466),eW=n(38960);function eY(e,t){let n=(0,eG.gh)(e);switch(null==t?void 0:t.type){case"user":return(0,eW.r)(e);case"team":{let e=n.find(e=>e.id===t.id);if(!e)return;return(0,eW.S)(e)}default:return}}var eH=n(58152),eJ=n(11865),eX=n.n(eJ),eK=n(61575),e0=n(84512),e1=n(35560),e5=n(56446),e3=n(59019);let e4=(e,t,n)=>{var r,i,s,a,l;let o=(0,e3.i)(e,null===(r=(0,j.OA)())||void 0===r?void 0:r.id).performanceTiers.filter(e=>e.credits>0),d=(0,e0.rn)((0,e5.Kj)()),u=null==n?void 0:null===(i=n.schedule)||void 0===i?void 0:i.cron_expression,c=(0,eK.C_)(u)&&(0,e0.fN)(u)?u:d,h=null==n?void 0:null===(s=n.schedule)||void 0===s?void 0:s.performance,v=(0,eK.C_)(h)&&(0,e1.U)(h)?h:null===(a=o[0])||void 0===a?void 0:a.publicPerformanceTierKey;return{name:eX()(null==t?void 0:t.name),sqlNames:null==n?void 0:n.sql_names,matViewId:null==t?void 0:t.matview_id,cronString:c,performanceTier:v,private:null!==(l=null==n?void 0:n.is_private)&&void 0!==l&&l}};var e2=n(4564),e8=n(88006),e7=n.n(e8);function e6(e){let{onDismiss:t,onContinueExecution:n}=e;return(0,r.jsxs)("div",{className:eP().body,children:[(0,r.jsxs)("div",{className:eP().header,children:[(0,r.jsx)("div",{className:eP().titleRow,children:(0,r.jsx)("h2",{children:"You are above the storage limit. Upgrade for more storage."})}),(0,r.jsx)("div",{className:eP().description,children:"This materialized view won't be updated until you are within the limit. You can always delete other materialized views or uploaded datasets to free up storage space."})]}),(0,r.jsxs)("div",{className:a()(eP().buttons,eP().gapFillMiddle,e7().footer),children:[(0,r.jsx)(d.z,{size:"M",theme:"tertiary",onClick:()=>{n(),t()},children:"Ok, Run Query"}),(0,r.jsx)(u.A,{size:"M",theme:"primary",href:"/pricing",target:"_blank",children:"View plans"})]})]})}let e9=e=>{let{isOpen:t,onDismiss:n,onContinueExecution:i}=e;return(0,r.jsx)(e2.L9,{label:"You've exceeded your storage limit",size:"M",onDismiss:n,isOpen:t,content:(0,r.jsx)(e6,{onContinueExecution:i,onDismiss:n})})};var te=n(34728),tt=n(530),tn=n(84899);function tr(e){let{session:t,activeContext:n,performance:s}=e,{updateLastExecutedPerformance:a=()=>{}}=(0,tt.C)(),[l,o]=(0,i.useState)(!1),[u,c]=(0,i.useState)(!1),h=(0,eg.useRouter)(),[m,p]=i.useState(!1),[x,y]=i.useState(null),f=(0,j._3)(),g=(0,j.f8)(),_=(0,j.dc)(),w=(0,j.R8)(),C=(0,j.NZ)(),b=(0,j.ws)(),k=(0,j.OS)(),q=(0,eb.x)({onQueryHasChangedError:y}),E=(0,ek.h)({activeContext:n,performance:s}),z=ej(),S=e$(),I=eY(t,_),N=(0,j.f8)(),T=(0,j.cV)(),L=(0,eH.E)(t,T),{isStorageLimitReached:P}=(0,te.N)(I),Q=e4(I,N,L);ev("Enter",()=>{null==Z||Z().catch(et.k.warn)});let D=k&&!!(null==g?void 0:g.matview_id),A=async()=>{if(!g)return;let e=await q(g);void 0!==e&&(void 0!==z&&await z.updateCompletionQueryId(e),await E(e,{refresh:!1}),await h.push({pathname:(0,eh.xT)(e),query:h.query},void 0,{shallow:!0}))},O=async()=>{if(!g)return;let e=await q(g);void 0!==e&&(void 0!==z&&await z.updateCompletionQueryId(e),D&&_&&await S({session:t,queryOwner:_,queryId:e,values:Q}),await E(e,{refresh:!0}))},B=async()=>{var e,n,r,i;if(!w||!C)return;let s=await (0,ec.Px)(w.id,t),a=null===(e=s.data)||void 0===e?void 0:e.forkQuery;if(void 0===a){(0,eC.Bh)({level:"error",title:"Query execution failed",description:"Could not find id in forkQuery response"});return}try{await (0,ec._y)({id:a.id,name:a.name,description:null!==(n=a.description)&&void 0!==n?n:"",isTemp:a.isTemp,isPrivate:a.isPrivate,isArchived:a.isArchived,datasetId:a.datasetId,query:C,parameters:a.parameters,tags:a.tags,version:a.ownerFields.version,userId:null!==(r=a.userId)&&void 0!==r?r:null,teamId:null!==(i=a.teamId)&&void 0!==i?i:null},t)}catch(e){(0,eC.Bh)({level:"error",title:"Query execution failed",description:"Could not update query code"});return}await E(a.id,{refresh:!0})},R=async()=>{w&&await E(w.id,{refresh:!0})},{captureEvent:F}=(0,M.z$)(),[V,U]=(()=>{let e=e=>{F("Run query",{action:e})};return b?C?["Run selection",()=>(e("Run selection"),a(),B())]:k?(null==g?void 0:g.is_temp)?["Run",()=>(e("Update unsaved"),a(),O())]:["Save and run",()=>(e("Update saved"),a(),O())]:["Run",()=>(e("Unchanged"),a(),R())]:["Run",()=>(e("Create"),a(),A())]})(),Z=async()=>{if(!G)try{if(p(!0),D){let e=(0,eA.v4)("ignore_warning_on_matview_definition_update");if(P){o(!0);return}if(e&&function(e){let t=new Date(e),n=new Date,r=n.getTime()-t.getTime();return r>9e5}(e)||!e){c(!0);return}}await U()}catch(e){}finally{p(!1)}},$=(0,j.OA)(),G=(null==g?void 0:g.is_archived)||$&&(0,tn.r)($.id),W=(0,j.gi)();return f?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eO,{close:()=>c(!1),onContinueExecution:O,isOpen:u,children:(0,r.jsx)(v.u,{label:"Archived queries cannot be updated",position:"above-center",hidden:!(null==g?void 0:g.is_archived),darkMode:"dark"===W,children:(0,r.jsxs)(d.z,{theme:"tertiary",size:"M",onClick:Z,loading:m,disabled:G,id:"run-query-button",children:[s&&(0,r.jsx)(ew.P,{performance:s}),V]})})}),(0,r.jsx)(e9,{isOpen:l,onContinueExecution:O,onDismiss:()=>o(!1)}),(0,r.jsx)(eI,{activeContext:n,performance:s,error:x,onErrorChange:y})]}):null}var ti=n(15405),ts=n.n(ti),ta=n(54015),tl=n(71429),to=n(39612),td=n(67165),tu=n(45765),tc=n(55601),th=n(85361),tv=n(77656),tm=n.n(tv),tp=n(41118),tx=n(95404),ty=n(75805),tf=n(68444),tj=n(33183);function tg(e){var t,n,i,s,a,l,o,u;let h,v;let{query:m}=e,p=(0,tj.Z)({executionId:((t=e.queryResult)&&null!==(0,eK.$K)(null===(n=t.meta)||void 0===n?void 0:n.job_id)&&null!==(0,eK.$K)(null===(i=t.meta)||void 0===i?void 0:i.generated_at)&&(h=null===(a=t.meta)||void 0===a?void 0:a.job_id,v=null===(l=t.meta)||void 0===l?void 0:l.generated_at),(null==t?void 0:null===(s=t.error)||void 0===s?void 0:s.generated_at)!==void 0&&(void 0===v||v<(null===(o=t.error)||void 0===o?void 0:o.generated_at))&&(h=null===(u=t.error)||void 0===u?void 0:u.job_id),h),skip:!e.isOpen});return(0,r.jsx)(e2.L9,{size:"M",label:"Get Query Execution Statistics",isOpen:e.isOpen,onDismiss:e.close,content:(0,r.jsxs)("section",{className:eP().body,children:[(0,r.jsx)("div",{className:eP().header,children:(0,r.jsxs)("div",{className:eP().titleRow,children:[(0,r.jsx)("h2",{children:"Query Execution Statistics"}),(0,r.jsx)(c.h,{size:"XS",theme:"ghost",onClick:e.close,children:(0,r.jsx)(tp.IconCross,{})})]})}),(0,r.jsx)(t_,{query:m,executionStatsResult:p}),(0,r.jsx)("div",{className:eP().buttons,children:(0,r.jsx)(d.z,{size:"M",theme:"primary",onClick:e.close,children:"Close"})})]})})}function t_(e){var t,n,i,s,a,l;let{query:o,executionStatsResult:u}=e,c=null===(t=u.data)||void 0===t?void 0:t.getExecutionStats;return c?(0,r.jsx)("table",{className:tm().stats,children:(0,r.jsxs)("tbody",{children:[(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Query"}),(0,r.jsx)("td",{children:null==o?void 0:o.name})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Execution Id"}),(0,r.jsx)("td",{children:c.execution_id})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{children:"Execution time"}),(0,r.jsx)(v.u,{className:tm().tooltip,label:(0,r.jsx)(r.Fragment,{children:"Time taken for execution, including fetching data, performing calculations and applying any filters or aggregations"}),position:"right-of-center",children:(0,r.jsx)("div",{children:(0,r.jsx)(tx.IconInformation,{})})})]})}),(0,r.jsxs)("td",{children:[c.execution_time_seconds," seconds"]})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{children:"Wall time"}),(0,r.jsx)(v.u,{className:tm().tooltip,label:(0,r.jsx)(r.Fragment,{children:"Time taken from start to finish, including analysis, execution and any wait times in a queue"}),position:"right-of-center",children:(0,r.jsx)("div",{children:(0,r.jsx)(tx.IconInformation,{})})})]})}),(0,r.jsxs)("td",{children:[c.wall_time_seconds," seconds"]})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{children:"Analysis time"}),(0,r.jsx)(v.u,{className:tm().tooltip,label:(0,r.jsx)(r.Fragment,{children:"Time used for analysis, including parsing the SQL, resolving table and column names and performing semantic analysis"}),position:"right-of-center",children:(0,r.jsx)("div",{children:(0,r.jsx)(tx.IconInformation,{})})})]})}),(0,r.jsxs)("td",{children:[c.analysis_time_seconds," seconds"]})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{children:"CPU time"}),(0,r.jsx)(v.u,{className:tm().tooltip,label:(0,r.jsx)(r.Fragment,{children:"Amount of CPU time used during execution"}),position:"right-of-center",children:(0,r.jsx)("div",{children:(0,r.jsx)(tx.IconInformation,{})})})]})}),(0,r.jsxs)("td",{children:[c.cpu_time_seconds," seconds"]})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{children:"Queued time"}),(0,r.jsx)(v.u,{className:tm().tooltip,label:(0,r.jsx)(r.Fragment,{children:"Time spent waiting in a Trino queue, after it was picked up for execution"}),position:"right-of-center",children:(0,r.jsx)("div",{children:(0,r.jsx)(tx.IconInformation,{})})})]})}),(0,r.jsxs)("td",{children:[c.queued_time_seconds," seconds"]})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Physical input"}),(0,r.jsxs)("td",{children:[null===(n=c.physical_input_rows)||void 0===n?void 0:n.toString()," rows (",tw(null===(i=c.physical_input_bytes)||void 0===i?void 0:i.toNumber()),")"]})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Output"}),(0,r.jsxs)("td",{children:[null===(s=c.output_rows)||void 0===s?void 0:s.toString()," rows (",tw(null===(a=c.output_bytes)||void 0===a?void 0:a.toNumber()),")"]})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Peak task total memory"}),(0,r.jsx)("td",{children:tw(null===(l=c.peak_task_total_memory_bytes)||void 0===l?void 0:l.toNumber())})]})]})}):u.error?(0,r.jsx)(tf.P,{level:"error",title:"Something went wrong, please try again.",actions:(0,r.jsx)(d.z,{theme:"tertiary",size:"M",onClick:()=>u.refetch(),children:"Try again"})}):(0,r.jsxs)("p",{className:tm().loading,children:[(0,r.jsx)(ty.IconLoading,{}),"Getting Query Execution Statistics..."]})}let tw=e=>{let t=["Bytes","KB","MB","GB","TB"];if(void 0===e||(null==e?void 0:e.valueOf)===void 0)return"";let n=e.valueOf();if(0===n)return"0 Bytes";let r=Math.floor(Math.log(n)/Math.log(1024));return 0===r?n+" "+t[r]:(n/Math.pow(1024,r)).toFixed(1)+" "+t[r]};var tC=n(5505),tb=n(59085),tk=n(21647),tq=n(55417);let tE=e=>{let{session:t,contextOwner:n,performanceTiers:s,queryId:a,existingSchedule:l,existingQueryAlerts:o,close:d}=e,u=null==o?void 0:o.email,c=null==o?void 0:o.slack,h=null==o?void 0:o.discord,v=null==o?void 0:o.webhook,m=(0,i.useMemo)(()=>{let e;return l&&(e={...l,alerts:{}},(0,eK.C_)(u)&&(e.alerts.emails=u.emails),(0,eK.C_)(c)&&(e.alerts.slack=c.url),(0,eK.C_)(h)&&(e.alerts.discord=h.url),(0,eK.C_)(v)&&(e.alerts.webhook=v.url)),e},[l,u,c,h,v]),[p,x]=(0,tb.Z0)(),[y,f]=(0,tb.kS)(),[j,g]=(0,tb.SO)(),[_,w]=(0,tb.AE)(),[C,b]=(0,tb.J0)(),[k,q]=(0,tb.Kl)(),[E,z]=(0,tb.ru)(),[S,I]=(0,tb.jA)(),M=async e=>{let n;l?(n=l.id,await y(t,{queryId:a,scheduleId:l.id},e)):n=await p(t,a,e),(0,tb.L5)(e)?await j(t,n,null==u?void 0:u.id,e):(0,eK.C_)(u)&&await S(t,u.id,"email"),(0,tb.Kv)(e)?await _(t,n,null==c?void 0:c.id,e):(0,eK.C_)(c)&&await S(t,c.id,"slack"),(0,tb.e_)(e)?await C(t,n,null==h?void 0:h.id,e):(0,eK.C_)(h)&&await S(t,h.id,"discord"),(0,tb.kf)(e)?await k(t,n,null==v?void 0:v.id,e):(0,eK.C_)(v)&&await S(t,v.id,"webhook"),d()},N=l?async()=>{(0,eK.C_)(u)&&await S(t,u.id,"email"),(0,eK.C_)(c)&&await S(t,c.id,"slack"),(0,eK.C_)(h)&&await S(t,h.id,"discord"),(0,eK.C_)(v)&&await S(t,v.id,"webhook"),await E(t,{queryId:a,scheduleId:l.id}),d()}:void 0,T=x.error||z.error||f.error||g.error||w.error||b.error||q.error||I.error,L=x.loading||z.loading||f.loading||g.loading||w.loading||b.loading||q.loading||I.loading;return(0,r.jsx)(tq.r,{contextOwner:n,queryId:a,performanceTiers:s,initialState:m,save:M,stop:N,close:d,error:T,loading:L})};var tz=n(61018),tS=n(41958);let tI=e=>{let{children:t,enabled:n}=e;return n?(0,r.jsx)(tS.S,{feature:"Query alerts",position:"above-align-right",title:"Receive Alerts on your Scheduled Queries",description:"You can now receive an email or a webhook alert with results every time your scheduled query runs",img:{src:"/_next/static/media/create-query-alert.9210a938.png",alt:"Paper plane"},actions:(0,r.jsx)(u.A,{size:"M",theme:"tertiary",href:"https://dune.com/docs/app/alerts",target:"_blank",children:"Learn more"}),endDate:new Date("2024-02-09T00:00:00.000Z"),children:t}):t};var tM=n(9661),tN=n.n(tM),tT=n(99134),tL=n(67050),tP=n.n(tL),tQ=n(7675),tD=n(41982),tA=n(10398),tO=n(95552),tB=n(6791),tR=n(67929),tF=n(63943),tV=n(5717);function tU(e){var t,n,i;let{parameter:s,onChange:a}=e,{value:l="",values:o=[]}=s,d=e=>{a({...s,value:e})};switch(s.type){case"text":return(0,r.jsx)(tA.U,{size:"M",style:"contained",inputType:"text",label:s.key,hint:s.description,prefix:(0,r.jsx)(tB.IconText,{}),placeholder:null!==(t=s.default_value)&&void 0!==t?t:"",value:l,onChange:e=>d(e.target.value)});case"number":return(0,r.jsx)(tA.U,{size:"M",style:"contained",inputType:"number",label:s.key,hint:s.description,prefix:(0,r.jsx)(tR.IconNumberSquare,{}),placeholder:null!==(n=s.default_value)&&void 0!==n?n:"",value:l,onChange:e=>d(e.target.value)});case"datetime":return(0,r.jsx)(tQ.W,{id:s.key,size:"M",style:"contained",label:s.key,hint:s.description,prefix:(0,r.jsx)(tV.IconCalendarBlank,{}),renderInput:e=>(0,r.jsx)(tD.a,{kind:"dialog",onChange:d,value:l,required:!0,wrapperClassNameOverride:tP().dateParameterField,customInput:(0,r.jsx)("input",{...e,value:l,type:"string"})})});case"enum":{let{isMultiselect:t=!1}=s;if(!t)return(0,r.jsx)(tO._,{parameter:e.parameter,parameterValues:""===l?[null!==(i=s.default_value)&&void 0!==i?i:""]:[l],onChange:e.onChange,renderFormField:e=>{let{renderButton:t,disabled:n}=e;return(0,r.jsx)(tQ.W,{size:"M",style:"contained",id:s.key,label:s.key,hint:s.description,prefix:(0,r.jsx)(tF.IconList,{}),disabled:n,renderInput:t})}});return(0,r.jsx)(tO._,{parameter:e.parameter,parameterValues:o,onChange:e.onChange,renderFormField:e=>{let{renderButton:t,disabled:n}=e;return(0,r.jsx)(tQ.W,{size:"M",style:"contained",id:s.key,label:s.key,hint:s.description,prefix:(0,r.jsx)(tF.IconList,{}),disabled:n,renderInput:t})}})}default:return et.k.warn("unsupported parameter type",s.type),null}}var tZ=n(36532),t$=n(75546);function tG(e){let{template:t}=e,n=(0,t$.b)(t.id,t.parameters,{can_refresh:!1});return(0,r.jsx)(tZ.cp,{visual:t.visualization,queryId:t.id,owner:void 0,result:n,watermark:!1,transparent:!1,ignoreStaleResult:!0})}var tW=n(36986);function tY(){let e=(0,eB._)(["\n mutation CreateQueryFromTemplate($query: CreateQueryInput!) {\n createQuery(query: $query) {\n id\n }\n }\n"]);return tY=function(){return e},e}function tH(){let e=(0,eB._)(["\n mutation CreateVisualization($input: CreateVisualizationInput!) {\n createVisualization(input: $input) {\n id\n }\n }\n"]);return tH=function(){return e},e}(0,eU.Z)(tY()),(0,eU.Z)(tH());var tJ=n(76872);function tX(e){let{activeContext:t}=(0,tW.a)(),{template:n,setTemplate:i}=e,[s,l]=function(){let[e,t]=(0,eV.xs)(),n=(0,z.kP)(),r=(0,th._0)();return[function(i){return new Promise(n&&r&&!t.loading?t=>{e({context:{session:n},variables:{query:{datasetId:i.dataset_id,description:i.description,isPrivate:!1,name:i.name,parameters:i.parameters,query:i.query,teamId:"team"===r.type?r.id:null,userId:"user"===r.type?r.id:null,isTemp:!1}}}).then(e=>{e.data&&t({queryId:e.data.createQuery.id})},e=>{e.message="Failed mutation CreateQueryFromTemplate: "+e.message,ee.Tb(e)})}:()=>{})},t]}(),[o,u]=function(){let[e,t]=(0,eV.$MN)(),n=(0,z.kP)(),r=(0,th._0)();return[function(i){return new Promise(n&&r&&!t.loading?t=>{e({context:{session:n},variables:{input:i}}).then(e=>{t()},e=>{e.message="Failed mutation AddVisualizations: "+e.message,ee.Tb(e)})}:()=>{})},t]}(),h=(0,eg.useRouter)(),{canSelectPerformance:v,performance:m,setPerformance:p,performanceTiers:x}=(0,e3.C)({datasetId:11,getDefaultPerformanceKey:()=>"medium"});return(0,r.jsxs)("div",{className:eP().body,children:[(0,r.jsxs)("div",{className:eP().header,children:[(0,r.jsxs)("div",{className:eP().titleRow,children:[(0,r.jsx)("h2",{children:n.name}),(0,r.jsx)(c.h,{size:"XS",theme:"ghost",onClick:e.close,children:(0,r.jsx)(tp.IconCross,{})})]}),(0,r.jsx)("p",{className:eP().description,children:n.description})]}),(0,r.jsx)("div",{className:eP().content,children:(0,r.jsx)(tG,{template:n})}),(0,r.jsxs)("form",{className:eP().subBody,onSubmit:e=>{e.preventDefault(),s(n).then(e=>{let{queryId:t}=e;o({queryId:t,...eF()(n.visualization,["type","name","options"])}).then(()=>{tK.justCreatedFromTemplate=n,v&&(0,tJ.s8)(t,m),h.push("/queries/".concat(t))})})},children:[(0,r.jsx)("div",{className:a()(eP().content,tN().fields),children:n.parameters.map(e=>(0,r.jsx)(tU,{parameter:e,onChange:t=>i({...n,parameters:n.parameters.map(n=>n!==e?n:t)})},e.key))}),(l.error||u.error)&&(0,r.jsxs)("p",{className:tN().errorMessage,children:[(0,r.jsx)(tT.IconWarning,{}),"Something went wrong, please try again."]}),(0,r.jsxs)("div",{className:eP().buttons,children:[(0,r.jsx)(d.z,{size:"M",theme:"tertiary",onClick:e.goBack,type:"button",children:"Back"}),(0,r.jsxs)(ta.f,{children:[(0,r.jsxs)(d.z,{size:"M",theme:"primary",type:"submit",children:[void 0!==m&&(0,r.jsx)(ew.P,{performance:m}),"Create query"]}),v&&(0,r.jsx)(tc.K,{buttonTheme:"primary",performance:m,setPerformance:p,activeContext:t,performanceTiers:x})]})]})]})]})}let tK={justCreatedFromTemplate:void 0},t0=e=>{let[t]=(0,i.useState)(tK.justCreatedFromTemplate),n=void 0!==t;(0,i.useEffect)(()=>{n&&(tK.justCreatedFromTemplate=void 0,setTimeout(()=>{var e;null===(e=document.getElementById("run-query-button"))||void 0===e||e.click()},200))},[n]),(0,i.useEffect)(()=>{t&&ex.Z.trackEvent("Query Created From Template Modal",{query_id:e,template_id:t.id,template_name:t.name})},[e,t])};function t1(e){var t,n;let{source:i}=e,s=(0,z.qy)(),a=(0,j.OW)(),l=(0,j.dc)(),o=(0,j.Lf)(),d=null!==(t=(0,j.hC)())&&void 0!==t&&t,u=null!==(n=(0,j.EK)())&&void 0!==n&&n;return s&&void 0!==a&&l&&o&&!d&&!u?(0,r.jsx)(t5,{session:s,queryOwner:l,queryId:a,source:i}):null}function t5(e){var t;let{session:n,queryOwner:i,queryId:s,source:a}=e,l=(0,j.gi)();t0(s);let{schedule:o}=(0,tb.nG)(s,n),u=(0,tb.lp)(n,null==o?void 0:o.id),h=(0,j.OA)(),m=!!(h&&(0,tn.r)(h.id)),p=(0,tb.hc)(n,o,i),x=(0,e3.i)(p,null===(t=(0,j.OA)())||void 0===t?void 0:t.id);if(!p||x.loading)return null;let y=x.performanceTiers.filter(e=>e.credits>0),f=o&&(0,e5.mB)(o.cronString),g=!!((null==u?void 0:u.email)||(null==u?void 0:u.slack)||(null==u?void 0:u.discord)||(null==u?void 0:u.webhook)),_=()=>{ex.Z.trackEvent("Query Schedule Modal Opened",{query_id:s,source:a})},w="qe_alert_btn"===a?tz.IconBellRing:tC.IconClockHistory;if(m)return(0,r.jsx)(tk.n,{openOn:"hover",position:"below-align-right",content:()=>(0,r.jsx)("div",{style:{maxWidth:"25rem",whiteSpace:"initial"},children:"This query needs to be migrated to DuneSQL first"}),children:(0,r.jsx)(c.h,{size:"M",theme:"tertiary",disabled:!0,children:(0,r.jsx)(w,{})})});let C={label:"qe_schedule_btn"===a?"Schedule query refresh":"Alerts",position:"qe_schedule_btn"===a?"above-center":"below-align-right",darkMode:"qe_schedule_btn"===a?"dark"===l:void 0};return(0,r.jsx)(e2.u_,{size:"M",label:"Query execution schedule",content:e=>{let{close:t}=e;return(0,r.jsx)(tE,{session:n,contextOwner:p,performanceTiers:y,queryId:s,existingSchedule:o,existingQueryAlerts:u,close:t})},trigger:e=>{let{isOpen:t,onClick:n}=e,i=()=>{_(),n()};return(0,r.jsx)(tI,{enabled:"qe_schedule_btn"===a,children:(0,r.jsx)(v.u,{...C,children:o&&"qe_schedule_btn"===a?(0,r.jsxs)(d.z,{size:"M",theme:"tertiary",className:t?"active":void 0,onClick:i,children:[g?(0,r.jsx)(tz.IconBellRing,{}):(0,r.jsx)(tC.IconClockHistory,{}),void 0===f?"Unknown":(0,e5.Sq)(f)]}):(0,r.jsx)(c.h,{size:"M",theme:"tertiary",className:t?"active":void 0,onClick:i,children:(0,r.jsx)(w,{})})})})}})}var t3=n(71909),t4=n(25137);let t2=()=>{var e,t,n,s,a,l,o,d,u,c,h,v;let m=(0,j.Yt)(),p=(0,j.f8)(),x=(0,z.kP)(),y=(0,td.X0)(m),f=(0,td._q)(m),g=(0,td.NV)(m),_=f?"complete":y?"queued":g?"running":void 0,[w,C]=(0,i.useState)(!1),b={status:null!=_?_:"complete",pendingExecution:{createdAt:null!==(d=null==m?void 0:null===(e=m.job)||void 0===e?void 0:e.created_at)&&void 0!==d?d:"",queuePosition:null==m?void 0:null===(t=m.job)||void 0===t?void 0:t.queue_position,executionType:(null==m?void 0:null===(n=m.job)||void 0===n?void 0:n.category)==="ttl"?"ttl":"other",ownedBySessionUser:(0,td.UH)(m,x),queryId:null!==(u=null==m?void 0:null===(s=m.job)||void 0===s?void 0:s.query_id)&&void 0!==u?u:0,executionId:null!==(c=null==m?void 0:null===(a=m.job)||void 0===a?void 0:a.id)&&void 0!==c?c:""},meta:{generatedAt:null!==(h=null==m?void 0:null===(l=m.meta)||void 0===l?void 0:l.generated_at)&&void 0!==h?h:"",runtime:null!==(v=null==m?void 0:null===(o=m.meta)||void 0===o?void 0:o.runtime)&&void 0!==v?v:0}};return(0,r.jsxs)("div",{className:ts().status,children:[(0,r.jsx)(t7,{result:b}),(0,r.jsx)(t1,{source:"qe_schedule_btn"}),(0,r.jsx)(t8,{result:b,onClick:()=>{C(!0),ex.Z.trackEvent("Query Execution Stats Viewed")}}),(0,r.jsx)(tg,{isOpen:w,close:()=>{C(!1)},query:p,queryResult:m})]})},t8=e=>{var t,n,i,s,a,l;let{result:o,onClick:u}=e,c=(null===(t=o.pendingExecution)||void 0===t?void 0:t.executionType)==="ttl",h=null===(n=o.pendingExecution)||void 0===n?void 0:n.createdAt,v=null===(i=o.meta)||void 0===i?void 0:i.generatedAt,m=null===(s=o.meta)||void 0===s?void 0:s.runtime,p=!c&&"queued"===o.status,x=p&&(0,r.jsxs)("span",{children:["Currently queued:"," ",(0,r.jsx)(tl.bM,{counter:!0,children:null!==(l=null===(a=o.pendingExecution)||void 0===a?void 0:a.createdAt)&&void 0!==l?l:""})]}),y=!x&&!c&&h,f=y&&(0,r.jsxs)("span",{children:["Currently running: ",(0,r.jsx)(tl.bM,{counter:!0,children:h})]}),j=!f&&!x&&v&&(0,r.jsxs)("span",{children:["Last run ",(0,r.jsx)(tl.bM,{children:v})]}),g="number"==typeof m&&(0,r.jsxs)("span",{children:["Last run took ",(0,to.ZC)(m)]});return p||y||v?(0,r.jsx)(d.z,{theme:"tertiary",size:"M",disabled:!(!p&&!y),onClick:u,children:(0,r.jsxs)("div",{className:ts().text,children:[f,x,j,g]})}):null},t7=e=>{let{result:t}=e,{session:n}=i.useContext(z.B3),s=(0,th._0)(),a=(0,t3.J)();return(null==n?void 0:n.user)&&s?(0,r.jsx)(t6,{session:{...n,user:n.user},activeContext:s,result:t}):(0,r.jsx)(u.A,{theme:"tertiary",size:"M",href:a,children:"Run"})},t6=e=>{var t,n;let{session:i,activeContext:s,result:a}=e,l="complete"===a.status,o=(null==a?void 0:null===(t=a.pendingExecution)||void 0===t?void 0:t.executionType)==="ttl",d=null==a?void 0:null===(n=a.pendingExecution)||void 0===n?void 0:n.ownedBySessionUser,{canSelectPerformance:u,performance:c,setPerformance:h,performanceTiers:v}=(0,tt.C)();return l||o||!a?(0,r.jsxs)(ta.f,{children:[(0,r.jsx)(tr,{session:i,activeContext:s,performance:u?c:void 0}),u&&(0,r.jsx)(tc.K,{performance:c,setPerformance:h,activeContext:s,performanceTiers:v})]}):(0,r.jsxs)("div",{className:ts().buttonGroup,children:[d&&(0,r.jsx)(ne,{}),(0,r.jsxs)(ta.f,{children:[(0,r.jsx)(t9,{result:a}),u&&(0,r.jsx)(tc.K,{disabled:!0,performance:c,setPerformance:h,activeContext:s,performanceTiers:v})]})]})},t9=e=>{var t,n;let{result:i}=e;if(null===(t=i.pendingExecution)||void 0===t?void 0:t.ownedBySessionUser)switch(null==i?void 0:i.status){case"queued":return(0,r.jsxs)(d.z,{theme:"tertiary",size:"M",disabled:!0,children:["Queued (",null!==(n=i.pendingExecution.queuePosition)&&void 0!==n?n:"",")",(0,r.jsx)(Q.J,{icon:"clock"})]});case"running":return(0,r.jsx)(d.z,{theme:"tertiary",size:"M",loading:!0,children:"Running"})}return(0,r.jsxs)(d.z,{theme:"tertiary",size:"M",loading:!0,title:"Another user is running the query.",children:["Running",(0,r.jsx)(Q.J,{icon:"person"})]})},ne=()=>{var e,t;let[n,s]=i.useState(!1),a=(0,z.Xd)(),l=(0,tu.c)(),o=(0,j.Yt)(),u=(0,j.f8)(),c=null==o?void 0:null===(e=o.job)||void 0===e?void 0:e.query_id,h=null==o?void 0:null===(t=o.job)||void 0===t?void 0:t.id,v=async()=>{if(h)try{var e;s(!0),await (0,t4.q)({executionId:h,query:{id:null!=c?c:0,parameters:null!==(e=null==u?void 0:u.parameters)&&void 0!==e?e:[]},session:a}).catch(e=>{let t=!(0,eu.MS)(e)||!e.message.includes("execution ID not found");if(t)throw e})}catch(e){l(e)}};return(ev("Enter",()=>{v().catch(et.k.warn)}),h)?(0,r.jsx)(d.z,{theme:"tertiary",size:"M",onClick:v,loading:n,children:"Cancel"}):null};var nt=n(91074),nn=n(32037),nr=n(70353);let ni=e=>(0,r.jsx)(nr.o,{label:"Something went wrong",onDismiss:e.onDismiss,size:"sm",isOpen:!0,children:(0,r.jsx)("p",{children:e.error.message})});var ns=n(76138);function na(){let e=(0,eB._)(["\n mutation ForkQueryV3($queryId: Int!, $contextOwner: ContextOwner!) {\n forkQuery(queryId: $queryId, forkTo: $contextOwner) {\n query_id: id\n }\n }\n"]);return na=function(){return e},e}let nl=()=>{let{session:e}=i.useContext(z.B3),t=(0,th._0)(),n=(0,j.OW)(),s=(0,j.ws)(),[a,l]=i.useState(!1),[o,d]=i.useState(),u=(0,t3.J)();if(!n||!s)return null;if(!e||!t)return(0,r.jsx)(nn.lr,{href:u,size:"sm",color2:!0,light:!0,children:"Fork"});let c=async r=>{try{var i;r.preventDefault(),l(!0);let s=await ns.bj.mutate({mutation:eV.tBP,variables:{queryId:n,contextOwner:eF()(t,["id","type"])},context:{session:e}}),a=null===(i=s.data.forkQuery)||void 0===i?void 0:i.query_id;if(!a){d(Error("Something went wrong."));return}let o=(0,eh.xT)(a);1===r.button?window.open(o,"_blank"):window.location.href=o}catch(e){d(e instanceof Error?e:Error("Something went wrong."))}};return(0,r.jsxs)(nn.lr,{onMouseUp:c,loading:a,size:"sm",color2:!0,light:!0,children:["Fork",o&&(o.message.includes("max_number_of_private_queries_reached")?(0,r.jsx)(ni,{error:Error("You have reached your quota of private queries."),onDismiss:()=>d(void 0)}):(0,r.jsx)(ni,{error:o,onDismiss:()=>d(void 0)}))]})};(0,eU.Z)(na());var no=n(38546),nd=n.n(no),nu=n(30205);function nc(){let e=(0,eB._)(["\nmutation TrackFirstQuerySaved($userId: Int!) {\n trackFirstQuerySaved(userId: $userId) {\n dismissedAt\n querySavedAt\n userId\n visualizationCreatedAt\n visualizationSharedAt\n }\n}\n"]);return nc=function(){return e},e}function nh(e){let{session:t}=i.useContext(z.B3),n=(0,j.f8)(),s=(0,j.L$)(),a=(0,j._3)(),l=(0,j.R8)(),o=(0,j.Jm)(),[u]=function(e){let t=(0,nu.Z)(e),[n,r]=(0,eV.JTc)({context:{session:e},variables:{userId:e.user.id}}),i=(null==e?void 0:e.user)!==void 0&&void 0!==t&&null===t.querySavedAt;return[i?n:()=>{},r]}(t),[c,h]=i.useState(!1);ev("Enter",()=>{null==x||x().catch(et.k.warn)});let{captureEvent:v}=(0,M.z$)(),m=()=>{v("save_query",{name:name})};if(!t||!a)return null;let p=async()=>{if(!l)return;let n={...l,name:e.name,is_temp:!1,is_private:e.isPrivate,parameters:a.defaults};await (0,ec.rq)(n,t),u(),await (null==o?void 0:o()),s({type:"saveQuery"})},x=async()=>{try{m(),h(!0),await p()}catch(r){if(r instanceof eu.cA){var t,n;let i=null===(n=r.graphQLErrors[0].extensions)||void 0===n?void 0:null===(t=n.internal)||void 0===t?void 0:t.error.message;i?e.onError(Error(i)):e.onError(r)}else e.onError(r)}finally{h(!1)}};return(0,r.jsx)(d.z,{type:"submit",theme:"primary",size:"M",onClick:x,loading:c,disabled:e.disabled||(null==n?void 0:n.is_archived),children:"Save"})}(0,eU.Z)(nc());var nv=n(4377),nm=n(75642),np=n(50642),nx=n(20326),ny=n(5048),nf=n(54179),nj=n(44914),ng=n(87312),n_=n(80808);let nw=e=>{let[t,n]=i.useState(!1),s=()=>n(e=>!e);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(nn.lr,{onClick:s,size:"sm",color2:!0,children:"Save"}),(0,r.jsx)(R.Vq,{label:"New query",size:"sm",isOpen:t,onDismiss:s,children:(0,r.jsx)(nC,{...e,onDismiss:s})})]})},nC=e=>{var t,n,s;let a=(0,z.Ke)(),l=(0,j.yU)(),o=(0,j.f8)(),u=l===nv.rg?"":l,[c,h]=i.useState(u),[v,m]=i.useState(null!==(n=null==o?void 0:o.is_private)&&void 0!==n&&n),[p,x]=i.useState(),y=null!==(s=(0,th._0)())&&void 0!==s?s:{type:"user",id:a.user.id,handle:a.user.name},f=(0,nj.fw)(y),g=(0,nx.G)(y),_=void 0!==o&&(0,ny.V)({isCurrentlyPrivate:(null==o?void 0:o.is_private)||!1,queryOwner:o.owner,selectedOwner:y,remainingQuota:(null===(t=g.data)||void 0===t?void 0:t.remainingQuota)||-1});return(0,i.useEffect)(()=>{v&&!_&&m(!1)},[_,v]),(0,r.jsxs)(np.l,{size:"M",children:[(0,r.jsx)(tA.U,{size:"M",style:"contained",label:"Give your new query a name!",hint:"Don't worry, you can change this any time.",value:c,placeholder:"My awesome query",onChange:e=>h(e.target.value)}),(0,r.jsx)(nf.c,{position:"below-align-left",content:()=>(0,r.jsx)(ng.s,{resource:"query",hasAdminPermission:f}),enabled:!_,children:(0,r.jsx)(eD.o,{label:"Privacy",checked:v,onChange:e=>m(e.target.checked),disabled:!_,children:"Make private"})}),p&&!(0,nm.b)(p)&&(0,r.jsxs)("div",{className:nd().error,role:"alert",children:[(0,r.jsx)(tT.IconWarning,{}),p.message]}),(0,r.jsxs)("div",{className:nd().buttons,children:[(0,r.jsx)(d.z,{type:"button",theme:"tertiary",size:"M",onClick:e.onDismiss,children:"Cancel"}),(0,r.jsx)(nh,{name:c,owner:y,isPrivate:v,disabled:!c.trim(),onError:e=>{x(e),(0,nm.b)(e)&&(m(!1),(0,n_.g)(f))}})]})]})};var nb=n(28889),nk=n(80558),nq=n(12111),nE=n(93184);let nz=(e,t)=>{var n,r,s;let a=(0,z.kP)(),l=(0,j.f8)(),o=(0,j.OW)(),d=(0,j.Lf)(),u=(0,j.L$)(),c=(0,j.Jm)(),h=(0,nj.fw)(t),[v,m]=i.useState(),p=[],x=(null!==(n=(0,eG.hx)(a))&&void 0!==n?n:[]).filter(e=>["admin","editor"].includes(e.membership.role)),y=async e=>{if(a)return await (0,ec.rq)(e,a)},f=async n=>{if(u({type:"replaceOwner",owner:n}),!l||!("id"in l))return;let r={...l,owner:n};try{await y(r),u({type:"saveQuery"}),await (null==c?void 0:c()),(0,tb.ph)(l.id),e()}catch(e){if(!(e instanceof Error))return;m(e),t&&u({type:"replaceOwner",owner:t})}};return!d&&t?p.push(t):t&&((!o||h)&&(p=null!==(r=x.map(e=>{let{name:t,handle:n,id:r,profileImageUrl:i}=e;return{id:r,name:t,type:"team",handle:n,profile_image_url:null!=i?i:null}}))&&void 0!==r?r:[]),(!o&&(null==a?void 0:a.user)||h&&(null==a?void 0:a.user))&&p.push({type:"user",id:a.user.id,name:a.user.name,handle:a.user.name,profile_image_url:null!==(s=a.user.profileImageUrl)&&void 0!==s?s:null})),{onOwnerChange:f,eligibleOwners:p,error:v,clearError:()=>m(void 0)}};var nS=n(58765);function nI(){let e=(0,eB._)(["\n query GetQueryContributors($queryId: Int!) {\n queryContributors(query_id: $queryId) {\n results {\n query_id: queryId\n contributions\n user {\n id\n handle\n profileImageUrl\n }\n }\n }\n }\n"]);return nI=function(){return e},e}function nM(e){let t=function(e){var t;let n=(0,z.kP)(),r=(0,eV.MK4)({context:{session:n},variables:{queryId:e},fetchPolicy:"cache-first"});return null===(t=r.data)||void 0===t?void 0:t.queryContributors.results.map(e=>({...e,user_id:e.user.id,handle:e.user.handle,profile_image_url:e.user.profileImageUrl}))}(e.queryId);if(!t)return null;let n=t.map(e=>{let{user_id:t,handle:n,profile_image_url:r}=e;return{ownerId:t,handle:n,profile_image_url:null!=r?r:void 0,type:"user"}});return(0,r.jsx)(nS.H,{avatarList:n,size:"L"})}(0,eU.Z)(nI());var nN=n(46367);function nT(){let e=(0,eB._)(["\n query FindQueryFolder($id: Int!) {\n query(id: $id) {\n id\n is_archived: isArchived\n folder {\n id\n icon\n color\n name\n description\n path\n }\n }\n }\n"]);return nT=function(){return e},e}let nL=()=>{let e=(0,z.qy)(),t=(0,j.OW)(),n=(0,j.Lf)(),r=(0,eV.qEm)({skip:!e||!n||void 0===t,context:{session:e},variables:{id:t}});if((0,nN.n)(r.data)&&(0,nN.n)(r.data.query))return{folder:function(e){if((0,nN.n)(e.data)&&(0,nN.n)(e.data.query)){if(e.data.query.is_archived)return{id:"",name:"Archived",path:"",icon:"archive",color:"red"};if(!e.data.query.is_archived&&!(0,nN.n)(e.data.query.folder))return{id:"",name:"Creations",path:"",icon:"folder",color:"gray"};if((0,nN.n)(e.data.query.folder)){var t;return{id:e.data.query.folder.id,name:null!==(t=e.data.query.folder.name)&&void 0!==t?t:"Creations",path:e.data.query.folder.path,icon:e.data.query.folder.icon,color:e.data.query.folder.color}}}}(r),refetch:()=>{r.refetch()}}};(0,eU.Z)(nT());let nP=()=>{var e;let t=(0,j.yU)(),n=(0,j.dN)(),i=(0,j.dc)(),s=(0,j.ws)(),a=(0,j.hC)(),l=(0,j.f8)(),o=nL(),{eligibleOwners:u,error:c,clearError:h,onOwnerChange:v}=nz(()=>{null==o||o.refetch()},i);if(!i||!l)return null;let m=s&&(0,r.jsxs)(nt.Z,{layout:"center-aligned",children:[!a&&(0,r.jsx)(nM,{queryId:l.id}),!a&&(0,r.jsx)(nk.v,{entry:l}),!a&&(0,r.jsx)(nl,{}),!a&&(0,r.jsx)(nb.l,{trackedButtonLocationOnPage:"Page sub-nav",renderSettingsButton:e=>{let{active:t,onClick:n}=e;return(0,r.jsxs)(d.z,{theme:"tertiary",size:"M",onClick:n,active:t,children:[(0,r.jsx)(O.Z,{}),"Settings"]})}}),a&&(0,r.jsx)(nw,{})]}),p=l.forked_query&&(0,r.jsxs)("span",{children:["forked from ",(0,r.jsxs)(eE(),{href:(0,eh.xT)(l.forked_query.query_id),children:["@",l.forked_query.owner_handle,"/",l.forked_query.query_name]})]});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(nq.B,{resourceType:"query",owner:i,eligibleOwners:u,onOwnerChange:v,title:t,private:!!l.is_private,unsaved:a,tags:n.length>0&&(0,r.jsx)(nE.$,{slug:"queries",tags:n}),caption:p,disableOwnerSelect:!s||a,matViewId:null!==(e=l.matview_id)&&void 0!==e?e:void 0,folder:o&&{contentItem:{type:"query",id:l.id},result:o.folder,refetchFolder:o.refetch},children:m}),c&&(0,r.jsx)(ni,{error:c,onDismiss:h})]})};var nQ=n(43307),nD=n(82733),nA=n(80403),nO=n(37242),nB=n(31821),nR=n(34201),nF=n(20705),nV=n(91817),nU=n.n(nV);let nZ=e=>{let{height:t,setHeight:n}=e,s=i.useRef(null),a=i.useCallback(()=>{let e=e=>{var t;let r=null===(t=s.current)||void 0===t?void 0:t.getBoundingClientRect().height;r&&n(r+e.movementY)},t=()=>{document.removeEventListener("pointermove",e),document.removeEventListener("pointerup",t)};document.addEventListener("pointermove",e),document.addEventListener("pointerup",t)},[]);return(0,r.jsxs)("div",{className:nU().resize,style:{height:t},ref:s,children:[e.children,(0,r.jsx)("button",{className:nU().handle,onPointerDown:a,"aria-label":"Resize handle"})]})},n$=(e,t)=>{let n=null==e?void 0:e.line,r=null==e?void 0:e.position;if(t&&"number"==typeof n&&"number"==typeof r)return{type:"error",text:null!=t?t:"",row:Math.max(0,n-1),column:Math.max(0,r-1)}};var nG=n(33315),nW=n(71510),nY=n(59377);let nH=(e,t,n)=>{i.useEffect(()=>{let r=r=>{let i=e_().asPath.split("?")[0],s=r.split("?")[0],a=i!==s&&!s.startsWith("/queries/".concat(n));if(a&&e&&!confirm(t))throw e_().events.emit("routeChangeError"),e_().replace(e_(),e_().asPath).catch(et.k.warn),"Abort route change. Please ignore this error."},i=n=>{if(e)return n.preventDefault(),n.returnValue=t,t};return window.addEventListener("beforeunload",i),e_().events.on("routeChangeStart",r),()=>{window.removeEventListener("beforeunload",i),e_().events.off("routeChangeStart",r)}},[e,t])};var nJ=n(42665),nX=n(96526),nK=n(36721);let n0=()=>{let e=(0,j.L$)(),t=(0,th._0)(),n=(0,j.OW)(),r=(0,j.dc)(),s=t&&((null==r?void 0:r.id)!==t.id||(null==r?void 0:r.type)!==t.type);i.useEffect(()=>{if(s&&!n){var r;e({type:"replaceOwner",owner:{type:t.type,id:t.id,name:t.name,handle:t.handle,profile_image_url:null!==(r=t.profile_image_url)&&void 0!==r?r:null}})}},[s])};var n1=n(27444),n5=n(69673),n3=n.n(n5),n4=n(78528),n2=n(23735);let n8=["create","edit"],n7={create:"Generate SQL",edit:"Edit SQL"};function n6(e){return(0,r.jsxs)(ta.f,{children:[(0,r.jsx)(v.u,{label:(0,r.jsxs)(er.C,{size:"M",color:"neutral",variant:"filled",children:["10",(0,r.jsx)(n2.IconCoins,{})]}),position:"above-center",children:(0,r.jsx)(d.z,{theme:"secondary",size:"M",loading:e.loading,disabled:e.disabled,onClick:e.onClick,children:n7[e.mode]})}),(0,r.jsx)(L.f,{position:"below-align-right",content:t=>{let{close:n}=t;return(0,r.jsx)("div",{className:"lightMode",children:(0,r.jsx)(P.s_,{children:(0,r.jsx)(P.$0,{children:n8.map(t=>(0,r.jsx)(P.ys,{active:t===e.mode,onClick:()=>{e.onModeChange(t),n()},children:n7[t]},t))})})})},children:(0,r.jsx)(c.h,{theme:"secondary",size:"M",disabled:e.loading,children:(0,r.jsx)(n4.IconChevronDown,{})})})]})}var n9=n(91210);function re(){let e=(0,j.L$)(),t=(0,j.M2)(),{captureEvent:n}=(0,M.z$)(),i=ej();if(void 0===i)return null;let s=async()=>{n("Wand: Generate SQL"),ex.Z.trackEvent("Wand Generate SQL Clicked",{prompt:i.question});let t=await i.createQuery();void 0!==t&&e({type:"replaceQueryCode",code:t})},l=async()=>{n("Wand: Edit SQL"),ex.Z.trackEvent("Wand Edit SQL Clicked",{prompt:i.question});let t=await i.editQuery();void 0!==t&&e({type:"replaceQueryCode",code:t})},o=async()=>{switch(i.mode){case"create":await s();break;case"edit":await l()}};return i.isOpen?(0,r.jsxs)("div",{className:a()(n3().wand,n3().open),children:[(0,r.jsxs)(er.C,{size:"M",color:"info",variant:"filled",children:[(0,r.jsx)(tx.IconInformation,{})," Beta"]}),(0,r.jsx)(n9.X,{className:n3().question,placeholder:"create"===i.mode?'Bootstrap your SQL query with natural language, "How many transactions did Ethereum process today using ethereum.transactions?"':"Describe the desired changes to the SQL query, such as adding, removing, or updating columns, or applying functions.",value:i.question,onChange:e=>{i.setQuestion(e.target.value)}}),(0,r.jsx)(n6,{mode:i.mode,loading:i.isRunning,disabled:"create"===i.mode&&!(null==i?void 0:i.question)||"edit"===i.mode&&""===t,onModeChange:i.setMode,onClick:o}),(0,r.jsx)(c.h,{theme:"secondary-light",size:"M",onClick:()=>{n("Wand: Close"),ex.Z.trackEvent("Wand Closed"),i.setIsOpen(!1)},children:(0,r.jsx)(tp.IconCross,{})})]}):(0,r.jsx)("div",{className:a()(n3().wand),children:(0,r.jsx)(v.u,{label:"Use Dune AI to create or edit your query",position:"left-of-center",children:(0,r.jsx)(c.h,{theme:"secondary-light",size:"M",onClick:()=>{n("Wand: Open"),ex.Z.trackEvent("Wand Opened"),i.setIsOpen(!0)},children:(0,r.jsx)(n1.IconMagicWand,{})})})})}var rt=n(5424),rn=n.n(rt),rr=n(39138),ri=n.n(rr),rs=n(14800),ra=n(73874),rl=n(76350),ro=n(78662),rd=n(11893),ru=n(25147),rc=n(43447),rh=n(46392);let rv=e=>{let{queryId:t}=e,n=(0,rc.$)();return n?(0,r.jsx)(e2.u_,{size:"L",label:"Create an API endpoint out of any SQL query",trigger:e=>{let{onClick:t,isOpen:n}=e;return(0,r.jsx)(d.z,{theme:"tertiary",size:"M",onClick:t,active:n,children:"API"})},content:e=>{let{close:n}=e;return(0,r.jsx)(rh.r,{queryId:t,close:n})}}):null};var rm=n(84541),rp=n(38598),rx=n(58653),ry=n(97099),rf=n.n(ry),rj=n(24745);function rg(){let e=(0,eB._)(["\nquery ExecutionCost($filters: ExecutionCostFiltersInput!) {\n executionCost(filters: $filters) {\n executionId\n creditCost\n }\n}\n"]);return rg=function(){return e},e}let r_=e=>{var t;let n=(0,z.kP)(),i=(0,th._0)(),{data:s,loading:l}=(0,eV.TaR)({skip:!(null==n?void 0:n.user),variables:{filters:{executionId:{eq:e.executionId},teamId:(null==i?void 0:i.type)==="team"?{eq:i.id}:null}},fetchPolicy:"cache-first",context:{session:n}}),{creditCost:o=0}=null!==(t=null==s?void 0:s.executionCost)&&void 0!==t?t:{creditCost:0};return(0,r.jsxs)("div",{className:eP().body,children:[(0,r.jsx)("div",{className:eP().header,children:(0,r.jsxs)("div",{className:eP().titleRow,children:[(0,r.jsx)("h3",{className:eP().titleRow,children:"Export to CSV"}),(0,r.jsx)(c.h,{size:"XS",theme:"ghost",onClick:e.close,children:(0,r.jsx)(tp.IconCross,{})})]})}),(0,r.jsx)("div",{className:a()(eP().content,rf().content),children:l?(0,r.jsx)(ty.IconLoading,{}):(0,r.jsx)(nJ.P,{level:"info",dismissable:!1,title:"This action will use ".concat((0,rj.u)(o)," ").concat(1===o?"credit":"credits"," from ").concat(null==i?void 0:i.name," plan quota.")})}),(0,r.jsxs)("div",{className:eP().buttons,children:[(0,r.jsx)(d.z,{size:"M",theme:"tertiary",type:"button",onClick:e.close,children:"Cancel"}),(0,r.jsx)(d.z,{size:"M",theme:"primary",disabled:l,onClick:()=>{e.close(),e.onExport()},children:"Export"})]})]})};(0,eU.Z)(rg());var rw=n(21154),rC=n(11969),rb=n(68357);let rk=e=>{let{isArchived:t,userBelongsToPaidTeam:n,isCSVExportEnabled:i}=e;return t?{content:()=>(0,r.jsx)(r.Fragment,{children:"Archived queries cannot be updated"}),position:"below-align-right"}:i?{content:()=>(0,r.jsx)(r.Fragment,{children:"Export to CSV"}),position:"below-center"}:{content:()=>n?(0,r.jsxs)(r.Fragment,{children:["CSV downloads are only available on paid team plans.",(0,r.jsx)("br",{}),(0,r.jsx)(rw.V,{size:"S",theme:"secondary",insideText:!0,onClick:()=>(0,rC.MD)(!0),children:"Switch"})," ","your active account to your paid team",(0,r.jsx)("br",{}),"in order to download this query's results."]}):(0,r.jsxs)("div",{style:{maxWidth:"25rem",whiteSpace:"initial"},children:["CSV downloads are only available on higher plan tiers."," ",(0,r.jsx)(rb.L,{href:"/pricing",size:"M",theme:"secondary",children:"Upgrade your plan"})]}),position:"below-align-right"}},rq=()=>{var e,t,n,s,a,l;let{session:o}=i.useContext(z.B3),[d,u]=i.useState(!1),h=(0,j.Yt)(),m=(0,j.f8)(),p=(0,th._0)(),x=(0,j._3)(),y=null!==(s=null==h?void 0:null===(e=h.matrix)||void 0===e?void 0:e.rows)&&void 0!==s?s:[],f=null==h?void 0:null===(t=h.meta)||void 0===t?void 0:t.result_id,g=(0,t3.J)(),_=null!==(a=null==p?void 0:p.serviceTier.isCSVExportEnabled)&&void 0!==a&&a,w=null===(n=(0,eG.hx)(o))||void 0===n?void 0:n.filter(e=>(0,rx.P)(e.serviceTier.id)),C=!!w&&w.length>0;if(!f||0===y.length)return null;if(!o||!p)return(0,r.jsx)(v.u,{label:(null==m?void 0:m.is_archived)?"Archived queries cannot be updated":"Export to CSV",position:"below-center",children:(0,r.jsx)(rm.w,{theme:"tertiary",size:"M",href:g,children:(0,r.jsx)(rp.IconFileCsvDownload,{})})});let b=()=>{var e;u(!0),(0,ec.rI)({executionId:f,queryId:(null===(e=h.meta)||void 0===e?void 0:e.query_id)||0,parameters:(null==x?void 0:x.merged)||[],downloadFor:{id:p.id,type:p.type},session:o}).then(e=>rE(e.data)).catch(e=>{var t;let n=e instanceof eu.cA&&(null===(t=e.graphQLErrors[0].extensions)||void 0===t?void 0:t.code);if(!n)return(0,eC.Bh)({level:"error",title:"Unable to export to CSV"});switch(n){case"csv_export_quota_exceeded":return(0,eC.Bh)({level:"error",title:"You’ve reached the CSV export limit",actions:(0,r.jsx)(eE(),{target:"_blank",href:"/pricing",children:"Upgrade plan"})});case"csv_export_not_allowed":return(0,eC.Bh)({level:"error",title:"You don't have CSV exports included in your plan",actions:(0,r.jsx)(eE(),{target:"_blank",href:"/pricing",children:"Upgrade plan"})});case"execution_forbidden":return(0,eC.Bh)({level:"error",title:"You cannot export this query's results from this account"});default:return(0,eC.Bh)({level:"error",title:"Unable to export to CSV"})}}).finally(()=>u(!1))};return(0,r.jsx)(e2.u_,{size:"M",label:"Export to CSV",content:e=>{let{close:t}=e;return(0,r.jsx)(r_,{executionId:f,onExport:b,loading:d,close:t})},trigger:e=>{let{onClick:t}=e;return(0,r.jsx)(tk.n,{openOn:"hover",...rk({isArchived:null!==(l=null==m?void 0:m.is_archived)&&void 0!==l&&l,userBelongsToPaidTeam:C,isCSVExportEnabled:_}),children:(0,r.jsx)(c.h,{theme:"tertiary",size:"M",disabled:(null==m?void 0:m.is_archived)||!_,onClick:t,loading:d,children:(0,r.jsx)(rp.IconFileCsvDownload,{})})})}})},rE=e=>{var t;(null==e?void 0:null===(t=e.exportCsv)||void 0===t?void 0:t.url)&&(window.location.href=e.exportCsv.url)};var rz=n(95257),rS=n(83215),rI=n.n(rS),rM=n(38574),rN=n(12098),rT=n(85592),rL=n(98570),rP=n(31250),rQ=n.n(rP);let rD=e=>(null!=e?e:"").replace(/ /g,"_").toLowerCase(),rA=e=>{var t,n,i;let s=(0,j.yU)(),a=null===(t=(0,j.dc)())||void 0===t?void 0:t.name,l="dune.".concat(rD(a),".result_").replace(/__$/,"_"),o=(null===(n=e.state.error)||void 0===n?void 0:n.name)==="name"?null===(i=e.state.error)||void 0===i?void 0:i.value:void 0;return(0,r.jsx)(tA.U,{size:"M",style:"contained",label:"Name",prefix:l,onChange:t=>e.setState({...e.state,name:t.target.value}),inputContainerClassName:rQ().input,error:o,hint:!o&&(0,r.jsxs)("span",{className:rQ().hint,children:[(0,r.jsx)(tx.IconInformation,{}),"You cannot rename a materialized view after it’s created."]}),value:rD(e.state.name),placeholder:rD(s)})};var rO=n(7036);let rB=e=>{var t,n,s;let{initialState:l,performanceTiers:o,contextOwner:c,close:h,onSubmit:v,onDelete:m,errorMessage:p}=e,[x,y]=(0,i.useState)(!1),f=!!l.matViewId,[j,g]=(0,i.useState)(l),_=(0,e5.mB)(j.cronString),w=o.find(e=>e.publicPerformanceTierKey===j.performanceTier);if(!w||!_)return null;let C=(0,rL.Z)(_)*w.credits,b=c.serviceTier.includedCredits,k=["premium","premium_annually"].includes(c.serviceTier.name)||c.serviceTier.hasCustomPlan;return(0,r.jsxs)("div",{className:eP().body,children:[(0,r.jsxs)("div",{className:eP().header,children:[(0,r.jsx)("h3",{className:eP().titleRow,children:f?"Edit materialized view":"New materialized view"}),!f&&(0,r.jsxs)("p",{className:eP().description,children:["A materialized view is a precomputed result of a SQL query that is stored as a physical table. They are used to improve query performance, and they are refreshed automatically to reflect changes in the underlying data."," ",(0,r.jsx)(eE(),{href:"/docs/query/materialized-views",target:"_blank",className:e7().link,children:"Learn more"})]})]}),f&&!p&&l.sqlNames&&(0,r.jsx)(nJ.P,{level:"success",dismissable:!1,title:"Use your materialized view",description:(0,r.jsxs)(r.Fragment,{children:["You can query your materialized view through",1===l.sqlNames.length?" this table name:":" these table names:",(0,r.jsx)("ul",{className:"show-item-dots",children:l.sqlNames.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)("code",{children:e})},e))})]})}),f&&p&&(0,r.jsx)(nJ.P,{level:"error",dismissable:!1,title:"An error occurred while materializing your query",description:p}),(0,r.jsx)("form",{className:eP().subBody,onSubmit:e=>{if(e.preventDefault(),!j.name){g(e=>({...e,error:{name:"name",value:"Materialized view name is required"}}));return}y(!0),v(j).then(()=>{h()}).catch(e=>{function t(e){g(t=>({...t,error:e}))}if((null==e?void 0:e.cause)instanceof eu.cA){var n,r;let i=null==e?void 0:null===(r=e.cause.graphQLErrors)||void 0===r?void 0:null===(n=r[0].extensions)||void 0===n?void 0:n.key;switch(i){case"configured_limits_reached":case"storage_limit_reached":case"schedule_limit_reached":case"credits_limit_reached":t({name:"notification",value:e.message});return}}t({name:"submit",value:e.message})}).finally(()=>y(!1))},children:(0,r.jsxs)("div",{className:a()(eP().content),children:[!f&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:e7().fields,children:[(0,r.jsx)(rA,{state:j,setState:g}),(0,r.jsx)("hr",{})]}),(0,r.jsx)("p",{className:e7().scheduleDisclaimer,children:"To ensure your materialized view is always up to date, we need you to setup a refresh schedule."})]}),(0,r.jsxs)("div",{className:e7().fields,children:[(0,r.jsx)(rN.u,{state:j,setState:g}),(0,r.jsx)("hr",{}),(0,r.jsx)(rT.nn,{contextOwner:c,performanceTiers:o,state:j,setState:g,CostNotification:rT.C2,cost:{monthlyCredits:C,planMonthlyCredits:b}}),(0,r.jsx)("hr",{}),(0,r.jsx)("div",{className:e7().privateToggle,children:(0,r.jsx)(tk.n,{enabled:!k,openOn:"hover",content:()=>(0,r.jsxs)("div",{style:{whiteSpace:"normal",maxWidth:"25rem"},children:["Private materialized views are only available on Premium or higher tier subscriptions."," ",(0,r.jsx)(rb.L,{theme:"secondary",size:"M",target:"_blank",href:{pathname:"/pricing",query:(0,th.JW)(c)},children:"Upgrade here"}),"."]}),position:"above-align-left",children:(0,r.jsx)("div",{children:(0,r.jsx)(rO.Z,{label:"Make materialized view private",description:"Private materialized views are only queryable by you and your team.",enabled:j.private,disabled:!k,setEnabled:()=>g(e=>({...e,private:!e.private}))})})})}),(null===(t=j.error)||void 0===t?void 0:t.name)==="notification"&&(0,r.jsx)(nJ.P,{level:"brand-orange",dismissable:!1,title:j.error.value,actions:(0,r.jsx)(u.A,{href:{pathname:"/pricing",query:(0,th.JW)(c)},theme:"secondary",size:"M",children:"Upgrade plan"})})]}),(null===(n=j.error)||void 0===n?void 0:n.name)==="submit"&&(0,r.jsxs)("p",{className:e7().errorMessage,children:[(0,r.jsx)(tT.IconWarning,{})," ",null===(s=j.error)||void 0===s?void 0:s.value]}),(0,r.jsxs)("div",{className:a()(eP().buttons,eP().gapFillMiddle,e7().footer),children:[f&&(0,r.jsx)(d.z,{size:"M",theme:"danger",type:"button",disabled:x,onClick:()=>m(l.matViewId),children:"Delete"}),(0,r.jsx)("hr",{className:eP().gapFillMiddle}),(0,r.jsx)(d.z,{size:"M",theme:"tertiary",type:"button",onClick:h,children:"Cancel"}),(0,r.jsx)(d.z,{size:"M",theme:"primary",type:"submit",disabled:x,children:f?"Save":"Create materialized view"})]})]})})]})},rR=e=>{let{executionStatus:t}=e,n=(0,tl.II)(),i=null==t?void 0:t.execution_ended_at,s=null!=i?(0,tl.wr)({now:n,date:new Date(i)}):"";switch(null==t?void 0:t.state){case"QUERY_STATE_COMPLETED":if(""===s)return null;return(0,r.jsx)(er.C,{size:"M",variant:"filled",color:"success",children:s.includes("Now")?"Updated now":"Updated ".concat(s," ago")});case"QUERY_STATE_FAILED":case"QUERY_STATE_NEEDS_RETRY":return(0,r.jsx)(er.C,{size:"M",variant:"filled",color:"error",children:"Error"});case"QUERY_STATE_PENDING":case"QUERY_STATE_EXECUTING":return(0,r.jsxs)(er.C,{size:"M",variant:"filled",color:"neutral",children:["Refreshing",(0,r.jsx)(ty.IconLoading,{})]});default:return null}},rF=e=>(0,r.jsxs)("div",{className:eP().body,children:[(0,r.jsxs)("div",{className:eP().header,children:[(0,r.jsx)("h3",{className:eP().titleRow,children:"Delete materialized view"}),(0,r.jsx)("p",{className:eP().description,children:"Deleting a materialized view will result in breaking queries that rely on it."})]}),(0,r.jsxs)("div",{className:eP().buttons,children:[(0,r.jsx)(d.z,{size:"M",theme:"tertiary",onClick:e.onCancel,children:"Cancel"}),(0,r.jsx)(d.z,{size:"M",theme:"danger",onClick:e.onDelete,children:"Delete"})]})]});var rV=n(3046),rU=n(42387);function rZ(){let e=(0,eB._)(["\n query GetExecutionStatus($id: String!) {\n executionStatus(executionId: $id) {\n state\n execution_ended_at: executionEndedAt\n error_message: errorMessage\n }\n }\n"]);return rZ=function(){return e},e}let r$=(e,t)=>{var n,r,s;let a=(0,i.useRef)(!1),l=(0,eV.w5s)({context:{session:e},skip:null==t,variables:{id:null!=t?t:""},returnPartialData:!0,fetchPolicy:"cache-and-network"}),o=null===(n=l.data)||void 0===n?void 0:n.executionStatus,d=null==o?void 0:o.state,u="QUERY_STATE_PENDING"===d||"QUERY_STATE_EXECUTING"===d||"QUERY_STATE_NEEDS_RETRY"===d;return(0,i.useEffect)(()=>{u&&!a.current&&(a.current=!0,l.startPolling(1e3))},[u,a.current]),(0,i.useEffect)(()=>{!u&&a.current&&(a.current=!1,l.stopPolling())},[u,a.current]),null!==(s=null===(r=l.data)||void 0===r?void 0:r.executionStatus)&&void 0!==s?s:null};(0,eU.Z)(rZ());var rG=n(58740),rW=n.n(rG);let rY=e=>{var t;let{onClick:n,isLoading:i,contextOwner:s}=e,{isStorageLimitReached:a,isLoading:l}=(0,te.N)(s),o=!!(null===(t=(0,j._3)())||void 0===t?void 0:t.defaults.length),u=o?{Content:()=>(0,r.jsx)("div",{className:rW().hoverPopover,children:"Queries with parameters cannot be materialized."}),enabled:!0}:a?{Content:()=>(0,r.jsxs)("div",{className:rW().hoverPopover,children:["You're above your plan's storage limit."," ",(0,r.jsx)(eE(),{href:"/pricing",children:"Upgrade plan"}),"."]}),enabled:!0}:{Content:()=>null,enabled:!1};return i||l?null:(0,r.jsx)("div",{children:(0,r.jsx)(nf.c,{content:u.Content,enabled:u.enabled,position:"below-align-right",children:(0,r.jsxs)(d.z,{theme:"tertiary",size:"M",disabled:u.enabled,loading:i,onClick:n,children:[!i&&(0,r.jsx)(rz.IconTableMaterialized,{}),(0,r.jsx)("span",{children:"Materialize"})]})})})},rH=i.memo(()=>{let e=(0,z.qy)(),t=(0,j.OW)(),n=(0,j.dc)(),i=(0,j.Lf)(),s=(0,j.hC)(),a=(0,j.EK)();return e&&t&&n&&i&&!s&&!a?(0,r.jsx)(rJ,{session:e,queryOwner:n,queryId:t}):null}),rJ=e=>{var t;let n=(0,j.Jm)(),[s,a]=(0,i.useState)(!1),l=(0,j.f8)(),o=(0,j.cV)(),d=(0,rV.Q)(),u=(0,rU.Q)(),h=e$(),v=(0,eH.E)(e.session,o),m=null==v?void 0:v.last_execution_id,p=r$(e.session,m),x=null==p?void 0:p.error_message;null===x&&(x=void 0);let y=eY(e.session,e.queryOwner),f=(0,e3.i)(y,null===(t=(0,j.OA)())||void 0===t?void 0:t.id).performanceTiers.filter(e=>e.credits>0),g=e4(y,l,v),_=async t=>{if(s)return;let r=o?"update":"create";a(!0);try{switch(r){case"create":await d({session:e.session,queryOwner:e.queryOwner,queryId:e.queryId,values:t});break;case"update":await h({session:e.session,queryOwner:e.queryOwner,queryId:e.queryId,values:t})}null==n||n()}catch(t){if(t instanceof eu.cA){let e=t.graphQLErrors[0].message;return Promise.reject(Error(e,{cause:t}))}return ee.Tb("Failed to ".concat(r," materialized view: ").concat(t),{extra:{creator:eF()(e.queryOwner,["id","type"]),queryId:e.queryId}}),Promise.reject(Error("Failed to ".concat(r," materialized view"),{cause:t}))}finally{a(!1)}},w=async()=>{if(!s){a(!0);try{await u({session:e.session,queryOwner:e.queryOwner,queryId:e.queryId}),null==n||n()}catch(t){if(t instanceof eu.cA){let e=t.graphQLErrors[0].message;return Promise.reject(Error(e))}return ee.Tb("Failed to delete materialized view: ".concat(t),{extra:{deleter:eF()(e.queryOwner,["id","type"]),queryId:e.queryId}}),Promise.reject(Error("Failed to delete materialized view"))}finally{a(!1)}}};return y&&0!==f.length?o?(0,r.jsx)("div",{className:rI().badgeContainer,children:(0,r.jsx)(er.C,{size:"L",color:"info",variant:"outlined",children:(0,r.jsxs)("div",{className:rI().badgeContent,children:[(0,r.jsx)(rz.IconTableMaterialized,{}),(0,r.jsx)("span",{children:"Materialized"}),(0,r.jsx)(rR,{executionStatus:p}),(0,r.jsx)(rX,{initialState:g,matViewId:o,onDeleteConfirm:w,contextOwner:y,onSubmit:_,trigger:e=>{let{onClick:t}=e;return(0,r.jsx)(c.h,{size:"S",theme:"ghost",onClick:t,children:(0,r.jsx)(rM.IconGear,{})})},errorMessage:x})]})})}):(0,r.jsx)(rX,{initialState:g,matViewId:o,onDeleteConfirm:w,contextOwner:y,onSubmit:_,trigger:e=>{let{onClick:t}=e;return(0,r.jsx)(rY,{onClick:t,contextOwner:y,isLoading:s})},errorMessage:x}):null},rX=e=>{var t;let{trigger:n,matViewId:s,onSubmit:a,onDeleteConfirm:l,contextOwner:o,initialState:d,errorMessage:u}=e,[c,h]=(0,i.useState)("CREATE_UPDATE"),v=(0,e3.i)(o,null===(t=(0,j.OA)())||void 0===t?void 0:t.id).performanceTiers.filter(e=>e.credits>0);return"DELETE"===c?(0,r.jsx)(e2.u_,{size:"M",label:"Delete materialized view",content:e=>{let{close:t}=e;return(0,r.jsx)(rF,{onDelete:l,onCancel:t})},trigger:n,onDismiss:()=>h("CREATE_UPDATE")}):(0,r.jsx)(e2.u_,{size:"L",label:s?"Update materialized view":"New materialized view",content:e=>{let{close:t}=e;return(0,r.jsx)(rB,{initialState:d,close:t,onSubmit:a,onDelete:()=>h("DELETE"),contextOwner:o,performanceTiers:v,errorMessage:u})},trigger:n})};var rK=n(74855),r0=n.n(rK),r1=n(1036),r5=n.n(r1),r3=n(2178);function r4(){let e=(0,eB._)(["\nmutation TrackFirstVisualizationShared($userId: Int!) {\n trackFirstVisualizationShared(userId: $userId) {\n dismissedAt\n querySavedAt\n userId\n visualizationCreatedAt\n visualizationSharedAt\n }\n}\n"]);return r4=function(){return e},e}(0,eU.Z)(r4());var r2=n(34668),r8=n(14080);function r7(){let e=(0,eB._)(["\n mutation InsertQueryApiKey($queryId: Int!) {\n createQueryApiKey(queryId: $queryId ) {\n id\n }\n }\n"]);return r7=function(){return e},e}let r6=e=>(0,r.jsx)(e2.u_,{size:"L",label:e.label,content:t=>{let{close:n}=t;return(0,r.jsx)(r9,{...e,onDismiss:n})},trigger:t=>{let{onClick:n}=t;return(0,r.jsx)(d.z,{disabled:e.disabled,size:"M",theme:"tertiary",onClick:n,children:e.label})}}),r9=e=>{let{query:t,visual:n}=e,{session:s}=i.useContext(z.B3),[l]=function(e){let t=(0,nu.Z)(e),[n,r]=(0,eV.hmv)({context:{session:e},variables:{userId:e.user.id}}),i=(null==e?void 0:e.user)!==void 0&&void 0!==t&&null===t.visualizationSharedAt;return[i?n:()=>{},r]}(s),[o,u]=i.useState(!1),[h,v]=i.useState(""),[m,p]=i.useState(""),[x,y]=i.useState(""),f=(0,tu.c)(),j=()=>{u(!0),l()},g=(0,nj.Kz)({type:"owner"in e?e.owner.type:"user",id:"owner"in e?e.owner.id:-1});return(0,i.useEffect)(()=>{t.is_private&&s&&!x&&g&&ir(t.id,s).then(y).catch(f),m||!x&&t.is_private||it({queryId:t.id,vizId:n,key:x}).then(p).catch(f),h||!x&&t.is_private||ie({queryId:t.id,vizId:n,key:x}).then(v).catch(f)},[s,m,h,x,t.id,t.is_private]),(0,i.useEffect)(()=>{o&&((0,eC.Bh)({level:"success",title:"Link copied"}),e.onDismiss())},[o]),(0,r.jsxs)("div",{className:eP().body,children:[(0,r.jsx)("div",{className:eP().header,children:(0,r.jsxs)("div",{className:eP().titleRow,children:[(0,r.jsx)("h2",{children:"Share this visualization"}),(0,r.jsx)(c.h,{theme:"ghost",size:"S",onClick:e.onDismiss,children:(0,r.jsx)(tp.IconCross,{})})]})}),(0,r.jsxs)("div",{className:a()(eP().content,r5().modalContent),children:[(0,r.jsxs)("section",{children:[(0,r.jsx)(r2._,{htmlFor:"vizLink",children:"Share Link"}),(0,r.jsx)(tA.U,{id:"vizLink",size:"L",style:"contained",value:h,disabled:!0,placeholder:"",onChange:()=>{}}),(0,r.jsx)(r0(),{text:h,onCopy:j,children:(0,r.jsxs)(d.z,{size:"M",theme:"primary",children:[(0,r.jsx)(r8.IconCopy,{}),"Copy"]})}),(0,r.jsxs)("div",{className:r5().hint,children:[(0,r.jsx)(tx.IconInformation,{}),(0,r.jsx)("span",{children:"Visitors will see this page with your SQL code and charts."})]})]}),(0,r.jsxs)("section",{children:[(0,r.jsx)(r2._,{htmlFor:"embedLink",children:"Embed Iframe"}),(0,r.jsxs)("pre",{id:"embedLink",className:r5().embedIframeHtml,children:[(0,r.jsx)("span",{className:r5().tag,children:"<iframe "}),(0,r.jsx)("span",{className:r5().attribute,children:"src"}),"=",(0,r.jsxs)("span",{className:r5().value,children:['"',m,'"']}),(0,r.jsx)("span",{className:r5().tag,children:"/>"})]}),(0,r.jsx)(r0(),{text:'<iframe src="'.concat(m,'"/>'),onCopy:j,children:(0,r.jsxs)(d.z,{size:"M",theme:"primary",children:[(0,r.jsx)(r8.IconCopy,{}),"Copy"]})}),(0,r.jsxs)("div",{className:r5().hint,children:[(0,r.jsx)(tx.IconInformation,{}),(0,r.jsx)("span",{children:"Insert the selected chart directly into your website."})]})]}),(0,r.jsx)(r3.G,{props:{type:"embed",query:t},session:s})]})]})},ie=async e=>(0,eh.WJ)(e.queryId,e.vizId,e.key),it=async e=>(0,eh.oR)(e.queryId,e.vizId,e.key),ir=async(e,t)=>{var n,r;let i=await ns.bj.mutate({mutation:eV.hPQ,variables:{queryId:e},context:{session:t},fetchPolicy:"no-cache"});if(!(null===(r=i.data)||void 0===r?void 0:null===(n=r.createQueryApiKey)||void 0===n?void 0:n.id))throw Error("could not create query key");return i.data.createQueryApiKey.id};(0,eU.Z)(r7());let ii=()=>{let{session:e}=i.useContext(z.B3),t=(0,j.OW)(),n=(0,j.f8)(),s=(0,j._r)(),a=(0,j.hC)(),l=(0,t3.J)();return t&&n&&s&&s.id&&!a?e?(null==n?void 0:n.is_archived)?(0,r.jsx)(v.u,{label:"Archived queries cannot be updated",position:"below-align-right",children:(0,r.jsx)("div",{children:(0,r.jsx)(d.z,{theme:"tertiary",size:"M",disabled:!0,children:"Share"})})}):(0,r.jsx)(r6,{label:"Share",query:{id:t,is_private:n.is_private},visual:s.id,owner:n.owner}):(0,r.jsx)(u.A,{theme:"tertiary",size:"M",href:l,children:"Share"}):null};var is=n(34031),ia=n.n(is),il=n(64776),io=n.n(il),id=n(43953),iu=n(31269);function ic(){let e=(0,eB._)(["\nquery ListTemplateQueries($filters: QueryFilterInput!, $pagination: PaginationInput!) {\n queries(filters: $filters, pagination: $pagination) {\n edges {\n node {\n id\n name\n description\n tags\n parameters\n datasetId\n ownerFields {\n query\n }\n visualizations {\n id\n type\n name\n description\n options\n }\n }\n }\n }\n}\n"]);return ic=function(){return e},e}let ih=function(){let e="3137143;3137145;3149774;3137144;3137147;3137146;3137148;3149778;2812434;2966116;2977251;3137137;3137142;3429156;3429162;3429143;";if(void 0===e)throw Error("process.env.NEXT_PUBLIC_TEMPLATE_QUERY_IDS not found");let t=e.split(";").filter(e=>e.length>0).map(Number),n=t.some(e=>Number.isNaN(e));if(n)throw Error('NEXT_PUBLIC_TEMPLATE_QUERY_IDS must only contain numbers, separated by ";"');return t}();function iv(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,eV.aDE)({skip:e.skip,variables:{filters:{id:{in:ih}},pagination:{first:ih.length}},fetchPolicy:"cache-first"})}(0,eU.Z)(ic());let im=["Tokens","Trades","Contracts","Farcaster","Misc"];function ip(e){return e.queries.edges.map(e=>e.node).slice().sort((e,t)=>ih.indexOf(e.id)-ih.indexOf(t.id)).map(e=>{var t,n,r;let{tags:i}=e;return{id:e.id,name:null!==(t=e.name)&&void 0!==t?t:"",description:null!==(n=e.description)&&void 0!==n?n:"",category:(0,iu.GI)(i)&&null!==(r=im.find(e=>i.map(e=>e.toLowerCase()).includes(e.toLowerCase())))&&void 0!==r?r:"Misc",parameters:e.parameters.map(e=>{let{type:t,key:n,description:r,value:i,values:s,isMultiselect:a,enumFromResults:l,enumOptions:o}=e;return{type:t,key:n,description:null!=r?r:void 0,value:null!=i?i:void 0,values:null!=s?s:void 0,..."boolean"==typeof a?{isMultiselect:a}:{},...l?{enumFromResults:l}:{},...o?{enumOptions:o}:{}}}),dataset_id:e.datasetId,query:e.ownerFields.query,visualization:(0,q.ZP)(e.visualizations.filter(e=>"table"===e.type)[0],e=>{e.options.itemsPerPage=5})}})}var ix=n(48821);function iy(e){return{...e,template:void 0}}function ij(e){function t(t){return e.includes(t)}let[n,r,i]=(0,em.Z)("templateCategory",void 0,{onChangeTransform:iy});return{getCategoryUrl:i,setSelectedCategoryInUrl:r,selectedCategoryInUrl:t(n)?n:void 0,hasUnavailableSelectedCategoryInUrl:!t(n)}}function ig(e){return{...e,templateCategory:void 0}}function i_(e){return(0,r.jsxs)("div",{className:eP().body,children:[(0,r.jsxs)("div",{className:eP().header,children:[(0,r.jsxs)("div",{className:eP().titleRow,children:[(0,r.jsx)("h2",{children:"Jump start your Dune journey"}),(0,r.jsx)(c.h,{size:"XS",theme:"ghost",onClick:e.close,children:(0,r.jsx)(tp.IconCross,{})})]}),(0,r.jsxs)("p",{className:eP().description,children:["Templates let you easily select wallets, tokens, and contracts and track their key actions over time. Have something you want to track and don't see it here?"," ",(0,r.jsxs)(rb.L,{size:"L",theme:"primary",href:"https://form.typeform.com/to/ZNhlPZQY",target:"_blank",children:["Request a new template",(0,r.jsx)(Q.J,{icon:"external-link"})]}),"."]})]}),(0,r.jsx)("div",{className:a()(eP().content,io().content),children:(0,r.jsx)(iw,{openTemplate:e.openTemplate})}),(0,r.jsxs)("div",{className:eP().buttons,children:[(0,r.jsx)(u.A,{size:"M",theme:"tertiary",href:"/docs",target:"_blank",children:"Read our docs"}),(0,r.jsx)(d.z,{size:"M",theme:"primary",onClick:e.close,children:"Close"})]})]})}function iw(e){let t=iv();if(t.error)return(0,r.jsx)("div",{children:"Error"});if(t.data){let n=ip(t.data);return 0===n.length?(0,r.jsx)("div",{children:"There doesn't seem to be any templates!"}):(0,r.jsx)(iC,{openTemplate:e.openTemplate,templates:n})}return t.loading,(0,r.jsx)("div",{children:"Loading"})}function iC(e){let{templates:t}=e,n=im.filter(e=>t.some(t=>t.category===e)),{selectedCategoryInUrl:i,getCategoryUrl:s}=ij(n);return(0,r.jsxs)("div",{children:[n.length>1&&(0,r.jsx)(rl.t,{size:"M",fillWidth:!0,children:n.map(e=>(0,r.jsx)(ro.f,{active:i===e,href:s(e),children:e},e))}),(0,r.jsx)("ul",{children:t.filter(e=>e.category===i).map(t=>(0,r.jsx)("li",{children:(0,r.jsxs)("label",{className:io().template,children:[(0,r.jsxs)("div",{className:io().titleAndDescription,children:[(0,r.jsx)("div",{className:io().title,children:t.name}),(0,r.jsx)("p",{className:io().description,children:t.description})]}),(0,r.jsxs)(rw.V,{size:"M",theme:"secondary",onClick:()=>e.openTemplate(t),children:["Use template",(0,r.jsx)(id.IconArrowRight,{})]})]})},t.id))})]})}var ib=n(50361),ik=n.n(ib);let iq=(0,tW.c)(function(){let[e,t]=(0,i.useState)(),{selectedTemplateIdInUrl:n,setSelectedTemplateIdInUrl:s}=function(){let[e,t,n]=(0,ix.Z)(e=>{let t=Number(e.template),n=Number.isInteger(t)&&t>0;return n?t:void 0},e=>({template:e}),{onChangeTransform:ig});return{selectedTemplateIdInUrl:e,setSelectedTemplateIdInUrl:t,getTemplateIdUrl:n}}(),a=iv({skip:void 0===n});(0,i.useEffect)(()=>{if((null==e?void 0:e.id)===n)return;if(void 0===n&&void 0!==e){t(void 0);return}if(!a.data)return;let r=ip(a.data),i=r.find(e=>e.id===n);t(ik()(i)),i||s(void 0)},[null==e?void 0:e.id,n,a.data]);let{selectedCategoryInUrl:l,setSelectedCategoryInUrl:o,hasUnavailableSelectedCategoryInUrl:d}=ij(im),u=void 0!==l&&void 0===n;function c(){ex.Z.trackEvent("Template Modal Closed")}return(0,i.useEffect)(()=>{d&&o(void 0)},[]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e2.QC,{size:"L",label:"Tutorials",content:e=>{let{close:t}=e;return(0,r.jsx)(i_,{close:()=>{t(),c()},openTemplate:e=>{t(),s(e.id),ex.Z.trackEvent("Template Selected From Template Modal",{id:e.id,name:e.name})}})},trigger:e=>{let{onClick:t}=e;return(0,r.jsx)("button",{onClick:()=>{ex.Z.trackEvent("Template Modal Opened"),t()},className:ia().link,children:"template"})},isOpen:u,setIsOpen:function(e){o(e?null!=l?l:im[0]:void 0)},onClickOutside:c}),e&&(0,r.jsx)(e2.L9,{isOpen:!0,onDismiss:void 0,size:"XL",label:e.name,content:(0,r.jsx)(tX,{template:e,setTemplate:e=>t(e),close:()=>{s(void 0),c()},goBack:()=>{o(e.category)}})})]})}),iE=()=>(0,r.jsx)("section",{className:ia().resultsEmpty,children:(0,r.jsxs)("div",{className:ia().header,children:[(0,r.jsx)("h2",{children:"...or use these resources to get started."}),(0,r.jsxs)("p",{children:["Start with a ",(0,r.jsx)(iq,{}),", use"," ",(0,r.jsx)(eE(),{className:ia().link,href:"/ai",target:"_blank",children:"DuneAI"})," ","to create a query, or read an intro to SQL in the"," ",(0,r.jsx)(eE(),{href:"/docs",className:ia().link,target:"_blank",children:"docs"}),"."]})]})});var iz=n(29570);let iS=e=>{var t,n,i,s;let a=(0,j.dc)(),l=(0,j.OW)(),o=(0,j.yU)(),d=(0,j.dE)(),u=(0,j.Yt)(),c=(0,j.Bb)(),h=null===(t=(0,j._3)())||void 0===t?void 0:t.appliedMerged,v=null!==(i=null===(n=(0,th._0)())||void 0===n?void 0:n.serviceTier.removeWatermark)&&void 0!==i&&i;return void 0===l?null:(0,r.jsx)(r.Fragment,{children:c.map((t,n)=>(0,r.jsx)(ru.I,{active:e.activeTab===n,children:(0,r.jsx)(tZ.cp,{visual:t,queryId:l,queryName:o,queryDescription:{formatted:(0,iz.U)(null!==(s=(0,eK.Rs)(t.description))&&void 0!==s?s:d,h)},owner:a,result:u,watermark:!v,transparent:!1,ignoreStaleResult:!0})},n))})},iI=e=>{let{session:t}=i.useContext(z.B3),n=(0,j.L$)(),s=(0,j.Lf)(),a=(0,j.Bb)(),l=(0,j.f8)(),o=(0,j.OW)(),d=(0,j.Ss)(),u=(0,j.Yt)(),[c,h]=i.useState(),v=(0,eg.useRouter)(),m=()=>h(void 0),p=e=>{n({type:"selectVisual",index:e})};function x(e){return{query:{...v.query,slug:[String(o),String(e.id)]}}}let y=e=>{m(),(0,ec.dm)(e.id,t).then(()=>{void 0!==o&&v.replace(x(a[0]),void 0,{scroll:!1,shallow:!0}),n({type:"removeVisual",visual:e})}).catch(e=>h(iM(e)))},f=e=>{confirm("Are you sure you want to remove this visualization?")&&y(e)};return void 0===o?(0,r.jsx)(iE,{}):(0,r.jsxs)("section",{className:rn().results,id:"results",children:[(0,r.jsxs)("div",{className:rn().panels,children:[(0,r.jsxs)("div",{className:rn().header,children:[(0,r.jsxs)("div",{className:rn().rightPanel,children:[(0,r.jsx)(rH,{}),(0,r.jsx)(t1,{source:"qe_alert_btn"}),(0,r.jsx)(rq,{}),l&&!0!==l.is_temp&&"id"in l&&(0,r.jsx)(rv,{queryId:l.id}),(0,r.jsx)(ii,{})]}),(0,r.jsxs)(rl.t,{size:"M",children:[a.map((e,t)=>(0,r.jsxs)(ro.f,{active:d===t,href:x(e),onClick:()=>p(t),onDismiss:s?()=>f(e):void 0,replace:!0,shallow:!0,children:[(0,r.jsx)(Q.J,{icon:(0,ra.RQ)(e)}),ri()((0,ra.VJ)(e),{length:30})]},t)),s&&(!l||!l.is_archived)&&(0,r.jsx)(rd.O,{active:d===a.length,onClick:()=>p(a.length),children:"New visualization"},a.length)]})]}),(0,r.jsxs)("div",{className:rn().results,children:[(0,r.jsx)(iS,{...e,activeTab:d}),s&&(0,r.jsx)(ru.I,{active:d===a.length,children:(0,r.jsx)(rs.y9,{result:u})},a.length)]})]}),c&&(0,r.jsx)(ni,{error:c,onDismiss:m})]})},iM=e=>e.message.includes("widgets_visualization_id_fkey")?Error("\n This visualisation can't be deleted because\n it is currently used on a dashboard.\n "):e;var iN=n(91350),iT=n.n(iN),iL=n(12007),iP=n(85101);let iQ=()=>{let e=(0,z.kP)(),t=(0,j.f8)(),{captureEvent:n}=(0,M.z$)(),[s,a]=(0,i.useState)(!1),l=(0,t3.J)();return e?t&&"id"in t&&!t.is_temp?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(iW,{tooltip:"Explain query",children:(0,r.jsx)(c.h,{theme:"tertiary",size:"M",onClick:()=>{a(!0),ex.Z.trackEvent("Wand Explain Dialog Opened"),n("explain_query_dialog_opened",{query_id:t.id})},children:(0,r.jsx)(iL.IconNote,{})})}),(0,r.jsx)(iD,{isOpen:s,close:()=>{ex.Z.trackEvent("Wand Explain Dialog Closed"),a(!1)},query:t,session:e})]}):null:(0,r.jsx)(iW,{tooltip:"Explain query",children:(0,r.jsx)(rm.w,{theme:"tertiary",size:"M",href:l,children:(0,r.jsx)(iL.IconNote,{})})})};function iD(e){let{query:t}=e,[n,s]=(0,i.useState)({status:"init"}),a=async()=>{s({status:"loading"});try{let n=await (0,ep.tG)(t.query,e.session);ex.Z.trackEvent("Wand Explain Result Returned",{name:t.name,description:t.description,query:t.query,result:n}),s({status:"success",result:n})}catch(e){s({status:"error"})}};return(0,i.useEffect)(()=>{e.isOpen&&a()},[e.isOpen]),(0,r.jsx)(R.Vq,{label:"Explain",size:"md",isOpen:e.isOpen,onDismiss:e.close,children:(0,r.jsxs)("section",{className:iT().dialog,children:[(0,r.jsxs)("div",{className:iT().titleAndContent,children:[(0,r.jsx)("h2",{children:t.name}),"success"===n.status&&(0,r.jsx)(iP.U,{children:n.result})]}),"loading"===n.status&&(0,r.jsxs)("p",{className:iT().loading,children:[(0,r.jsx)(ty.IconLoading,{}),"Generating query explanation..."]}),"error"===n.status?(0,r.jsx)(tf.P,{level:"error",title:"Something went wrong, please try again.",actions:(0,r.jsx)(d.z,{theme:"tertiary",size:"M",onClick:a,children:"Try again"})}):(0,r.jsx)(tf.P,{level:"neutral",dismissable:!1,title:"This explanation was automatically generated by GPT-4."}),(0,r.jsx)("div",{children:(0,r.jsx)(d.z,{theme:"primary",size:"L",onClick:e.close,children:"Done"})})]})})}var iA=n(36031),iO=n(24506);function iB(){let e=(0,j.f8)();if(!e||!("id"in e)||e.is_temp)return null;let t="".concat(window.location.origin,"/queries/").concat(e.id);return(0,r.jsx)(iW,{tooltip:"Share query",children:(0,r.jsx)(iO.Z,{size:"M",theme:"tertiary",text:t,onCopy:()=>{ex.Z.trackEvent("Share Query Button Clicked",{query_id:e.id,owner_team_id:"team"===e.owner.type&&e.owner.id,owner_user_id:"user"===e.owner.type&&e.owner.id})},children:(0,r.jsx)(iA.Z,{})})})}var iR=n(18099),iF=n(69501),iV=n(25657),iU=n(20139),iZ=n(68191);let i$=e=>{var t,n;let s=(0,j.Yt)(),l=(0,j.ws)(),d=(0,j.Lf)(),u=(0,j.hC)(),c=(0,j.OS)(),h=(0,j.OW)(),v=(0,j.yU)(),m=(0,j.dc)(),p=l&&(u||c),x=l&&d&&!!(null==s?void 0:null===(t=s.matrix)||void 0===t?void 0:t.rows.length);n0(),nH(p,u?"This query has not been saved yet. Discard unsaved changes?":"This query has unsaved changes. Discard unsaved changes?",h);let y=a()(o().editor,d&&o().showSidebar,l&&o().showResults,x&&o().showOptions);i.useEffect(()=>{if(h){let e=m?(0,iR.k)(m):{};ex.Z.trackEvent("Query Viewed",{query_id:h,...e}),m&&(0,iV.u)({event:"QUERY_VIEW",properties:{id:h,..."team"===m.type?{teamId:m.id,userId:null}:{userId:m.id,teamId:null}}})}},[h,m]);let{title:f=v}=e,g=null==s?void 0:null===(n=s.job)||void 0===n?void 0:n.progress_percentage,_=void 0!==g&&g<100?"(".concat(Math.round(g),"%) ").concat(null!=f?f:""):f;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(nB.yG,{title:_,preview:e.preview,loading:!(0,td._q)(s),description:e.description}),(0,r.jsx)(nA.h,{}),(0,r.jsx)(nR.r,{children:(0,r.jsxs)(nD.r,{children:[(0,r.jsx)(nP,{}),(0,r.jsxs)("div",{className:y,children:[(0,r.jsxs)("div",{className:o().content,children:[(0,r.jsx)(iG,{}),(0,r.jsx)(iI,{})]}),x&&(0,r.jsx)("section",{className:o().options,children:(0,r.jsx)(nQ.q3,{})}),d&&(0,r.jsx)(ed,{})]})]})})]})},iG=()=>{var e,t,n,i;let s=(0,j.Yt)(),l=(0,j._3)(),d=(0,td.zO)(null!==(i=null==s?void 0:null===(e=s.error)||void 0===e?void 0:e.message)&&void 0!==i?i:null==s?void 0:null===(t=s.fetchError)||void 0===t?void 0:t.message),u=n$(null==s?void 0:null===(n=s.error)||void 0===n?void 0:n.metadata,d),c=d&&!u,h=a()(o().input,l&&l.defaults.length>0&&o().showParameters,c&&o().showError);return(0,r.jsxs)("section",{className:h,children:[c&&(0,r.jsxs)("div",{className:o().error,children:[(0,r.jsx)(Q.J,{icon:"warning"}),d]}),(0,r.jsx)(iY,{error:u}),!!(null==l?void 0:l.defaults.length)&&(0,r.jsx)(I,{})]})};function iW(e){let t=(0,j.gi)();return(0,r.jsx)(v.u,{label:e.tooltip,position:"above-center",darkMode:"dark"===t,children:(0,r.jsx)("li",{children:e.children})})}let iY=e=>{let t=(0,j.yi)(),n=(0,j.lF)(),s=(0,j.gi)(),l=(0,j.L$)(),{setActiveQueryEventId:d}=(0,N.f)(),u=(0,j.Lf)(),v=(0,j.OA)(),m=(0,nN.n)(v)&&(0,tn.r)(v.id),p=(0,j.M2)(),x=u&&!m,y=(0,j.f8)(),f=function(){var e;let{activeQueryEventId:t}=(0,N.f)(),n=(0,T.f)((0,j.OW)(),{fetchPolicy:"cache-only"});return null===(e=n.data)||void 0===e?void 0:e.queryEvents.results.find(e=>e.id===t)}(),_=(0,j.I8)(),w=(0,j.ws)(),C=(0,j._3)(),b=iJ(),[k,q]=i.useState(b),E=k===window.innerHeight;i.useEffect(()=>{e.error?null==_||_.annotate([e.error]):null==_||_.annotate([])},[e.error]);let z=e=>{let{difference:t,nextKeys:n,prevKeys:r}=(0,nG.o9)(p,e);if(C&&t.length>0){let{nextParameters:i,updatedCode:s}=(0,nG.Oy)({difference:t,nextCode:e,nextKeys:n,parameters:C,prevKeys:r});l({type:"replaceQueryCodeAndParameters",parameters:i,code:null!=s?s:e})}else l({type:"replaceQueryCode",code:e})},I=e=>{l({type:"replaceCodeSelection",code:e})},{captureEvent:L}=(0,M.z$)(),P=i.useRef(null),Q=i.useCallback(()=>{if(document.fullscreenElement)document.exitFullscreen();else{var e;null===(e=P.current)||void 0===e||e.requestFullscreen(),L("Query editor: Fullscreen")}},[L]);return i.useEffect(()=>{let e=(0,nX.JZ)({pc:"ctrl+shift+f",mac:"cmd+shift+f"},Q);return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[Q]),(0,r.jsx)(nZ,{height:k,setHeight:q,children:(0,r.jsx)("div",{className:a()(o().resizeContent,"".concat(s,"Mode")),ref:P,children:f?(0,r.jsx)(nK.l,{query:p,queryEvent:f,onClose:()=>d(void 0)}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:o().editorActionPalletBottom,children:[(0,r.jsx)(iH,{isDatasetDeprecated:m}),(0,r.jsxs)("div",{className:o().editorToolbarBottom,children:[(0,r.jsx)("div",{className:o().toolbarGroupLeft,children:(0,r.jsxs)("ul",{children:[(0,r.jsx)(iW,{tooltip:E?"Collapse":"Expand",children:(0,r.jsx)(c.h,{theme:"tertiary",size:"M",onClick:function(){E?q(b):q(window.innerHeight)},children:(0,r.jsx)(h.IconChevronBarExpand,{})})}),(0,r.jsx)(es,{editable:u,toggleEditorFullscreen:Q}),(0,r.jsx)(iQ,{}),x&&(0,r.jsx)(iW,{tooltip:"Format query",children:(0,r.jsx)(X,{})}),w&&x&&(0,r.jsx)(iW,{tooltip:(null==y?void 0:y.is_archived)?"Archived queries cannot be updated":(null==y?void 0:y.matview_id)?(0,r.jsxs)(r.Fragment,{children:["Queries with materialized views",(0,r.jsx)("br",{})," cannot contain parameters."]}):"Add parameter",children:(0,r.jsx)(S,{})}),(0,r.jsx)(iB,{})]})}),(0,r.jsx)(t2,{})]})]}),t?(0,r.jsx)(iU.Y,{onChange:e=>z(e),onUpdate:e=>{if(e.selectionSet){let[t]=e.state.selection.ranges,n=t.empty?"":e.state.sliceDoc(t.from,t.to);I(n)}},value:p,readOnly:!x||(null==y?void 0:y.is_archived),extensions:[(0,iZ.i6)()]}):(0,r.jsx)(g,{autosuggest:n,onLoad:e=>{l({type:"replaceCodeHelpers",helpers:e})},onChange:z,onSelect:I,value:p,readOnly:!x||(null==y?void 0:y.is_archived),theme:s}),x&&(0,r.jsx)(re,{})]})})})};function iH(e){let{isDatasetDeprecated:t}=e,[n,s]=i.useState(!1),a=(0,j.Lf)(),l=(0,r.jsx)(R.Vq,{size:"sm",label:"Migrate to Dune SQL",isOpen:n,onDismiss:()=>s(!1),children:(0,r.jsx)(en,{close:()=>s(!1)})});return t?(0,r.jsx)(nJ.P,{level:"warning",title:"Deprecated dataset",description:(0,r.jsx)(r.Fragment,{children:"This query runs against a deprecated dataset and can no longer be executed. Please query against Dune SQL instead. You can migrate this query to DuneSQL, which is faster, more powerful and more user friendly. Migrating this query will have the query run automatically against DuneSQL."}),actions:(0,r.jsxs)(r.Fragment,{children:[a&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.z,{theme:"secondary",size:"S",onClick:()=>s(!0),children:"Migrate to Dune SQL"}),l]}),(0,r.jsx)(u.A,{theme:"tertiary",size:"S",href:"/blog/introducing-dune-sql",target:"_blank",children:"What is DuneSQL?"})]})}):null}let iJ=()=>{let e=(0,j.ws)(),t=(0,j.M2)(),n=window.innerHeight;if(!e)return n-400;let r=t.split("\n").length;return Math.max(300,Math.min(n/2.5,100+22*r))};var iX=!0,iK=e=>{let{session:t,sessionLoading:n}=i.useContext(z.B3),s=(0,th._0)(),a=(0,nW.X)(0),l=(0,nW.X)(1),o=(0,nW.f)(2),d=(0,nY.y)();(0,iF.D)("Query Editor Max Memory Used",{query_id:null!=a?a:0,optional_viz_id:null!=l?l:0});let u=(0,r.jsx)(nO.h,{title:e.title,description:""!==e.description?e.description:void 0});return n?u:a||t?t&&t.user&&!s||!d.isReady?u:(0,r.jsx)(j.KU,{query:a,visual:l,apiKey:o,prefillCode:d.value,session:t,activeContext:s,children:(0,r.jsx)(ef,{children:(0,r.jsx)(i$,{...e})})},a):(0,r.jsx)(nF.p,{})}},59377:function(e,t,n){"use strict";n.d(t,{V:function(){return s},y:function(){return i}});var r=n(11163);function i(){let e=(0,r.useRouter)(),t="string"==typeof e.query.prefillCode?decodeURIComponent(e.query.prefillCode):void 0;return{value:t,isReady:e.isReady}}function s(e){return{pathname:"/queries",query:{prefillCode:encodeURIComponent(e)}}}},43447:function(e,t,n){"use strict";n.d(t,{$:function(){return i}});var r=n(85361);function i(){let e=(0,r._0)();return!!e}},97099:function(e){e.exports={content:"CSVDownloadModalContent_content__bTH3B"}},38546:function(e){e.exports={editButton:"title_editButton__AKRkY",private:"title_private__YXu7n",error:"title_error__GISXv",buttons:"title_buttons__4lPGa"}},88006:function(e){e.exports={scheduleDisclaimer:"CreateUpdateMatView_scheduleDisclaimer__qaPSc",link:"CreateUpdateMatView_link___t4cJ",fields:"CreateUpdateMatView_fields__oDBG5",privateToggle:"CreateUpdateMatView_privateToggle__SCxjs",footer:"CreateUpdateMatView_footer__8uv9O",errorMessage:"CreateUpdateMatView_errorMessage__GxUIm"}},58740:function(e){e.exports={hoverPopover:"CreateMatViewButton_hoverPopover__Sfhm_"}},83215:function(e){e.exports={container:"EditorMatViewButton_container___kbTM",badgeContainer:"EditorMatViewButton_badgeContainer__W425J",badgeContent:"EditorMatViewButton_badgeContent__9Rrhp"}},31250:function(e){e.exports={hint:"FieldName_hint__NwvdD",input:"FieldName_input__MPgMB"}},37469:function(e){e.exports={editor:"QueryPage_editor___w06h",content:"QueryPage_content__fJ0SQ",showResults:"QueryPage_showResults__pV77V",input:"QueryPage_input__Gp3j1",showError:"QueryPage_showError___fqjX",showParameters:"QueryPage_showParameters__gtysx",error:"QueryPage_error__wsrf4",resizeContent:"QueryPage_resizeContent__Nj80g",editorActionPalletBottom:"QueryPage_editorActionPalletBottom__AU8Mf",editorToolbarBottom:"QueryPage_editorToolbarBottom__0zx1E",toolbarGroupLeft:"QueryPage_toolbarGroupLeft__63ywA",showSidebar:"QueryPage_showSidebar___JBqI",showOptions:"QueryPage_showOptions__JBbrx",sidebar:"QueryPage_sidebar__PdAuy",options:"QueryPage_options__TJJcm"}},77656:function(e){e.exports={stats:"GetQueryStatsDialog_stats__hKgMc",loading:"GetQueryStatsDialog_loading__u_Fhr",tooltip:"GetQueryStatsDialog_tooltip__gNU_H"}},72853:function(e){e.exports={container:"DiffViewer_container__9bBr7"}},9522:function(e){e.exports={container:"QueryVersionDiff_container__H4lLY",header:"QueryVersionDiff_header__CJUJj",right:"QueryVersionDiff_right__Nqwa4"}},9661:function(e){e.exports={fields:"Form_fields__n5Ats",errorMessage:"Form_errorMessage__xlHEz"}},67050:function(e){e.exports={dateParameterField:"ParameterField_dateParameterField__GXqB_"}},64776:function(e){e.exports={content:"TemplatesModalContent_content___YpdG",template:"TemplatesModalContent_template__gnXXW",titleAndDescription:"TemplatesModalContent_titleAndDescription__6oqNS",title:"TemplatesModalContent_title__3NFpc",description:"TemplatesModalContent_description__17qM4"}},5424:function(e){e.exports={panels:"SectionResults_panels__jh3PA",header:"SectionResults_header__3Xw_E",rightPanel:"SectionResults_rightPanel__5hJ2p",results:"SectionResults_results__vPGZw",new:"SectionResults_new__PYMyV"}},34031:function(e){e.exports={resultsEmpty:"SectionResultsEmpty_resultsEmpty__WOZar",header:"SectionResultsEmpty_header__3YD6W",buttonGroup:"SectionResultsEmpty_buttonGroup__mdtqC",link:"SectionResultsEmpty_link__a86RD"}},44227:function(e){e.exports={content:"TranslateSqlDialogContent_content___JYRh",main:"TranslateSqlDialogContent_main__n6lhx",buttonGroup:"TranslateSqlDialogContent_buttonGroup__OI3wl",errorMessage:"TranslateSqlDialogContent_errorMessage__ZqJKN",blocks:"TranslateSqlDialogContent_blocks__LsVbX"}},91350:function(e){e.exports={dialog:"ExplainButton_dialog__2hwXd",titleAndContent:"ExplainButton_titleAndContent__6XRp2",loading:"ExplainButton_loading__e1_Ta"}},69673:function(e){e.exports={wand:"Wand_wand__zX7vF",open:"Wand_open__8qZNF",question:"Wand_question__E20Zk"}},4755:function(e){e.exports={loading:"code-loader_loading__UMeyu"}},32911:function(e){e.exports={parameters:"parameters_parameters__2Yw1U"}},91817:function(e){e.exports={resize:"resize_resize__q5g6s",handle:"resize_handle__iJS4a"}},15405:function(e){e.exports={status:"status_status__zpC4x",text:"status_text__w950a",buttonGroup:"status_buttonGroup__sfqSC"}},81167:function(e){e.exports={content:"QueryHasChangedDialog_content___nfcO",main:"QueryHasChangedDialog_main__jblf4",buttonGroup:"QueryHasChangedDialog_buttonGroup___8qLY"}},99292:function(e){e.exports={avatarGroup:"AvatarGroup_avatarGroup__Zzhwu",avatarsList:"AvatarGroup_avatarsList__aL00A",element:"AvatarGroup_element__9Ky8Y",avatarWrapper:"AvatarGroup_avatarWrapper__fDvax"}}},function(e){var t=function(t){return e(e.s=t)};e.O(0,[9225,5762,3318,8110,3295,777,6746,3829,1403,9512,5660,8548,2792,4064,1444,9002,9938,9694,4974,819,1434,6532,4941,2547,3171,2882,9774,2888,179],function(){return t(73611),t(38194)}),_N_E=e.O()}]);
//# sourceMappingURL=[[...slug]]-ad391516a822e3f0.js.map