sqlmesh 0.181.2.dev9__py3-none-any.whl → 0.181.2.dev10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. sqlmesh/_version.py +2 -2
  2. {sqlmesh-0.181.2.dev9.dist-info → sqlmesh-0.181.2.dev10.dist-info}/METADATA +1 -1
  3. {sqlmesh-0.181.2.dev9.dist-info → sqlmesh-0.181.2.dev10.dist-info}/RECORD +49 -49
  4. web/client/dist/assets/{Audits-DRkR6sg0.js → Audits-BnT_XU4z.js} +1 -1
  5. web/client/dist/assets/{Banner-BXisqtMu.js → Banner-CIGf1CgX.js} +1 -1
  6. web/client/dist/assets/{ChevronDownIcon-D8CFPQ96.js → ChevronDownIcon-D3eSCae0.js} +1 -1
  7. web/client/dist/assets/{ChevronRightIcon-BpRv8ZN4.js → ChevronRightIcon-BYX0d3Wq.js} +1 -1
  8. web/client/dist/assets/{Content-KG4KSDDO.js → Content-C-dbt7Qf.js} +1 -1
  9. web/client/dist/assets/{Content-pMJLtxGr.js → Content-PeLqYFgC.js} +1 -1
  10. web/client/dist/assets/{Data-D-rZnh8x.js → Data-CR1hP4VP.js} +1 -1
  11. web/client/dist/assets/{DataCatalog-BJTDeU-_.js → DataCatalog-D3ACH3Kc.js} +1 -1
  12. web/client/dist/assets/{Editor-C8-1rqZ2.js → Editor-BiQM-0yy.js} +1 -1
  13. web/client/dist/assets/{Editor-Cpn7iBcm.js → Editor-DAPqExjL.js} +1 -1
  14. web/client/dist/assets/{Errors-DyDRdQyq.js → Errors-fiNNK-UR.js} +1 -1
  15. web/client/dist/assets/{FileExplorer-CmdsG4yG.js → FileExplorer-axtC_Ai-.js} +1 -1
  16. web/client/dist/assets/{Footer-D4ok48Gm.js → Footer-BK44TAno.js} +1 -1
  17. web/client/dist/assets/{Header-BVwdhMQQ.js → Header-BAp2F5ka.js} +1 -1
  18. web/client/dist/assets/{Input-CxOCLTNw.js → Input-C5uXc-nB.js} +1 -1
  19. web/client/dist/assets/Lineage-_5zC2lrH.js +1 -0
  20. web/client/dist/assets/{ListboxShow-YBO3HIHQ.js → ListboxShow-DvjSHd_L.js} +1 -1
  21. web/client/dist/assets/{ModelLineage-BFuK5Bgk.js → ModelLineage-Vjinxl8m.js} +1 -1
  22. web/client/dist/assets/{Models-Dn2xoUA7.js → Models-DdFxJdwq.js} +1 -1
  23. web/client/dist/assets/{Page-kOwPk8A6.js → Page-BjM3k1UE.js} +1 -1
  24. web/client/dist/assets/{Plan-BQe3-3RL.js → Plan-D-yXZg-l.js} +1 -1
  25. web/client/dist/assets/{PlusCircleIcon-CXYicjof.js → PlusCircleIcon-rlJbTzSO.js} +1 -1
  26. web/client/dist/assets/{ReportErrors-DaAC3YF4.js → ReportErrors-DTvhPb_i.js} +1 -1
  27. web/client/dist/assets/{Root-BIGZcS_U.js → Root-hF35YwMr.js} +1 -1
  28. web/client/dist/assets/{SearchList-Lag39srv.js → SearchList--GtSxkZn.js} +1 -1
  29. web/client/dist/assets/{SelectEnvironment-0MCV04NI.js → SelectEnvironment-BNlbuzcL.js} +1 -1
  30. web/client/dist/assets/{SourceList-CTL41Fia.js → SourceList-B0glAf8v.js} +1 -1
  31. web/client/dist/assets/{SourceListItem-6mIYlySR.js → SourceListItem-BUiMwOLB.js} +1 -1
  32. web/client/dist/assets/{SplitPane-7_khUxNG.js → SplitPane-Bec3_12u.js} +1 -1
  33. web/client/dist/assets/{Tests-DSsKelgd.js → Tests-egYRjgvR.js} +1 -1
  34. web/client/dist/assets/{Welcome-C0F3fb3h.js → Welcome-uoXIxnJO.js} +1 -1
  35. web/client/dist/assets/{context-B0V9EzWJ.js → context-CDuVFxib.js} +42 -34
  36. web/client/dist/assets/{context-pytQSsK4.js → context-DhtR-yn6.js} +1 -1
  37. web/client/dist/assets/{editor-CmeEFdEz.js → editor-D99craz3.js} +1 -1
  38. web/client/dist/assets/{file-DY5SRTK1.js → file-DIuTD7Ex.js} +1 -1
  39. web/client/dist/assets/{help-Bm8ph9oI.js → help-5fQwnZLr.js} +1 -1
  40. web/client/dist/assets/{index-BWibl-Ee.js → index-DZbqZ0F2.js} +1 -1
  41. web/client/dist/assets/index-Dqo42q_-.js +82 -0
  42. web/client/dist/assets/{plan-BUTy2uM-.js → plan-BIkqMXq0.js} +1 -1
  43. web/client/dist/assets/{project-CtAE3tsj.js → project-DHnuzhZ_.js} +1 -1
  44. web/client/dist/assets/{transition-CiMBgn_Y.js → transition-BpitCk1w.js} +1 -1
  45. web/client/dist/index.html +1 -1
  46. web/client/dist/assets/Lineage-ZXdxdqzl.js +0 -1
  47. web/client/dist/assets/index-C22hdM_h.js +0 -90
  48. {sqlmesh-0.181.2.dev9.dist-info → sqlmesh-0.181.2.dev10.dist-info}/WHEEL +0 -0
  49. {sqlmesh-0.181.2.dev9.dist-info → sqlmesh-0.181.2.dev10.dist-info}/entry_points.txt +0 -0
  50. {sqlmesh-0.181.2.dev9.dist-info → sqlmesh-0.181.2.dev10.dist-info}/licenses/LICENSE +0 -0
  51. {sqlmesh-0.181.2.dev9.dist-info → sqlmesh-0.181.2.dev10.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- import{r as u,R as ne,h as Ie,j as t,i as k,c as b,w as Q,g as lt,b as F,a as R,m as E,J as de,B as z,n as L,Q as Pe,a5 as Qe,a6 as nt,a7 as rt,I as ae,S as Ne,al as qe,am as at,d as Ye,t as ot,e as it,s as ct,G as $,F as dt,a8 as ut,_ as ft,an as mt}from"./index-C22hdM_h.js";import{u as ee,M as xt}from"./project-CtAE3tsj.js";import{S as We}from"./SplitPane-7_khUxNG.js";import{E as J,M as ht}from"./file-DY5SRTK1.js";import{u as N}from"./editor-CmeEFdEz.js";import{I as T}from"./Input-CxOCLTNw.js";import{F as pt,L as gt}from"./ListboxShow-YBO3HIHQ.js";import{B as Be}from"./Banner-BXisqtMu.js";import{f as bt,b as Ve,c as vt,U as ue,I as Ze,y as fe,i as je,o as K,N as ge,G as jt,z as W,O as le,M as B,u as ce,t as wt,T as Nt,C as me,R as be,P as ie,x as Ge}from"./transition-CiMBgn_Y.js";import{g as Fe,G as yt,F as Tt,T as Et}from"./help-Bm8ph9oI.js";import{M as Pt,u as Xe,a as Re,b as St,c as Ct,C as kt}from"./context-B0V9EzWJ.js";import{A as Se,F as It,a as Rt}from"./PlusCircleIcon-CXYicjof.js";import{D as Dt}from"./ReportErrors-DaAC3YF4.js";import"./index-BWibl-Ee.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./help-6Q7f7fjd.js";import"./SourceList-CTL41Fia.js";function Ft({onFocus:e}){let[s,l]=u.useState(!0),n=bt();return s?ne.createElement(Ve,{as:"button",type:"button",features:vt.Focusable,onFocus:i=>{i.preventDefault();let r,c=50;function d(){if(c--<=0){r&&cancelAnimationFrame(r);return}if(e()){if(cancelAnimationFrame(r),!n.current)return;l(!1);return}r=requestAnimationFrame(d)}r=requestAnimationFrame(d)}}):null}const Je=u.createContext(null);function Mt(){return{groups:new Map,get(e,s){var l;let n=this.groups.get(e);n||(n=new Map,this.groups.set(e,n));let i=(l=n.get(s))!=null?l:0;n.set(s,i+1);let r=Array.from(n.keys()).indexOf(s);function c(){let d=n.get(s);d>1?n.set(s,d-1):n.delete(s)}return[r,c]}}}function _t({children:e}){let s=u.useRef(Mt());return u.createElement(Je.Provider,{value:s},e)}function Ke(e){let s=u.useContext(Je);if(!s)throw new Error("You must wrap your component in a <StableCollection>");let l=Lt(),[n,i]=s.current.get(e,l);return u.useEffect(()=>i,[]),n}function Lt(){var e,s,l;let n=(l=(s=(e=u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==null?void 0:e.ReactCurrentOwner)==null?void 0:s.current)!=null?l:null;if(!n)return Symbol();let i=[],r=n;for(;r;)i.push(r.index),r=r.return;return"$."+i.join(".")}var At=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(At||{}),zt=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(zt||{}),Ot=(e=>(e[e.SetSelectedIndex=0]="SetSelectedIndex",e[e.RegisterTab=1]="RegisterTab",e[e.UnregisterTab=2]="UnregisterTab",e[e.RegisterPanel=3]="RegisterPanel",e[e.UnregisterPanel=4]="UnregisterPanel",e))(Ot||{});let $t={0(e,s){var l;let n=ie(e.tabs,f=>f.current),i=ie(e.panels,f=>f.current),r=n.filter(f=>{var g;return!((g=f.current)!=null&&g.hasAttribute("disabled"))}),c={...e,tabs:n,panels:i};if(s.index<0||s.index>n.length-1){let f=ce(Math.sign(s.index-e.selectedIndex),{[-1]:()=>1,0:()=>ce(Math.sign(s.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(r.length===0)return c;let g=ce(f,{0:()=>n.indexOf(r[0]),1:()=>n.indexOf(r[r.length-1])});return{...c,selectedIndex:g===-1?e.selectedIndex:g}}let d=n.slice(0,s.index),p=[...n.slice(s.index),...d].find(f=>r.includes(f));if(!p)return c;let a=(l=n.indexOf(p))!=null?l:e.selectedIndex;return a===-1&&(a=e.selectedIndex),{...c,selectedIndex:a}},1(e,s){if(e.tabs.includes(s.tab))return e;let l=e.tabs[e.selectedIndex],n=ie([...e.tabs,s.tab],r=>r.current),i=e.selectedIndex;return e.info.current.isControlled||(i=n.indexOf(l),i===-1&&(i=e.selectedIndex)),{...e,tabs:n,selectedIndex:i}},2(e,s){return{...e,tabs:e.tabs.filter(l=>l!==s.tab)}},3(e,s){return e.panels.includes(s.panel)?e:{...e,panels:ie([...e.panels,s.panel],l=>l.current)}},4(e,s){return{...e,panels:e.panels.filter(l=>l!==s.panel)}}},Me=u.createContext(null);Me.displayName="TabsDataContext";function re(e){let s=u.useContext(Me);if(s===null){let l=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,re),l}return s}let _e=u.createContext(null);_e.displayName="TabsActionsContext";function Le(e){let s=u.useContext(_e);if(s===null){let l=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,Le),l}return s}function Qt(e,s){return ce(s.type,$t,e,s)}let Wt=u.Fragment;function Bt(e,s){let{defaultIndex:l=0,vertical:n=!1,manual:i=!1,onChange:r,selectedIndex:c=null,...d}=e;const p=n?"vertical":"horizontal",a=i?"manual":"auto";let f=c!==null,g=be({isControlled:f}),P=fe(s),[m,v]=u.useReducer(Qt,{info:g,selectedIndex:c??l,tabs:[],panels:[]}),D=u.useMemo(()=>({selectedIndex:m.selectedIndex}),[m.selectedIndex]),j=be(r||(()=>{})),o=be(m.tabs),y=u.useMemo(()=>({orientation:p,activation:a,...m}),[p,a,m]),x=K(C=>(v({type:1,tab:C}),()=>v({type:2,tab:C}))),S=K(C=>(v({type:3,panel:C}),()=>v({type:4,panel:C}))),q=K(C=>{Z.current!==C&&j.current(C),f||v({type:0,index:C})}),Z=be(f?e.selectedIndex:m.selectedIndex),X=u.useMemo(()=>({registerTab:x,registerPanel:S,change:q}),[]);je(()=>{v({type:0,index:c??l})},[c]),je(()=>{if(Z.current===void 0||m.tabs.length<=0)return;let C=ie(m.tabs,w=>w.current);C.some((w,M)=>m.tabs[M]!==w)&&q(C.indexOf(m.tabs[Z.current]))});let te={ref:P};return ne.createElement(_t,null,ne.createElement(_e.Provider,{value:X},ne.createElement(Me.Provider,{value:y},y.tabs.length<=0&&ne.createElement(Ft,{onFocus:()=>{var C,w;for(let M of o.current)if(((C=M.current)==null?void 0:C.tabIndex)===0)return(w=M.current)==null||w.focus(),!0;return!1}}),me({ourProps:te,theirProps:d,slot:D,defaultTag:Wt,name:"Tabs"}))))}let Gt="div";function Ht(e,s){let{orientation:l,selectedIndex:n}=re("Tab.List"),i=fe(s);return me({ourProps:{ref:i,role:"tablist","aria-orientation":l},theirProps:e,slot:{selectedIndex:n},defaultTag:Gt,name:"Tabs.List"})}let Ut="button";function qt(e,s){var l,n;let i=Ze(),{id:r=`headlessui-tabs-tab-${i}`,...c}=e,{orientation:d,activation:p,selectedIndex:a,tabs:f,panels:g}=re("Tab"),P=Le("Tab"),m=re("Tab"),v=u.useRef(null),D=fe(v,s);je(()=>P.registerTab(v),[P,v]);let j=Ke("tabs"),o=f.indexOf(v);o===-1&&(o=j);let y=o===a,x=K(w=>{var M;let se=w();if(se===ge.Success&&p==="auto"){let Ee=(M=jt(v))==null?void 0:M.activeElement,oe=m.tabs.findIndex(pe=>pe.current===Ee);oe!==-1&&P.change(oe)}return se}),S=K(w=>{let M=f.map(se=>se.current).filter(Boolean);if(w.key===W.Space||w.key===W.Enter){w.preventDefault(),w.stopPropagation(),P.change(o);return}switch(w.key){case W.Home:case W.PageUp:return w.preventDefault(),w.stopPropagation(),x(()=>le(M,B.First));case W.End:case W.PageDown:return w.preventDefault(),w.stopPropagation(),x(()=>le(M,B.Last))}if(x(()=>ce(d,{vertical(){return w.key===W.ArrowUp?le(M,B.Previous|B.WrapAround):w.key===W.ArrowDown?le(M,B.Next|B.WrapAround):ge.Error},horizontal(){return w.key===W.ArrowLeft?le(M,B.Previous|B.WrapAround):w.key===W.ArrowRight?le(M,B.Next|B.WrapAround):ge.Error}}))===ge.Success)return w.preventDefault()}),q=u.useRef(!1),Z=K(()=>{var w;q.current||(q.current=!0,(w=v.current)==null||w.focus({preventScroll:!0}),P.change(o),wt(()=>{q.current=!1}))}),X=K(w=>{w.preventDefault()}),te=u.useMemo(()=>{var w;return{selected:y,disabled:(w=e.disabled)!=null?w:!1}},[y,e.disabled]),C={ref:D,onKeyDown:S,onMouseDown:X,onClick:Z,id:r,role:"tab",type:Nt(e,v),"aria-controls":(n=(l=g[o])==null?void 0:l.current)==null?void 0:n.id,"aria-selected":y,tabIndex:y?0:-1};return me({ourProps:C,theirProps:c,slot:te,defaultTag:Ut,name:"Tabs.Tab"})}let Yt="div";function Vt(e,s){let{selectedIndex:l}=re("Tab.Panels"),n=fe(s),i=u.useMemo(()=>({selectedIndex:l}),[l]);return me({ourProps:{ref:n},theirProps:e,slot:i,defaultTag:Yt,name:"Tabs.Panels"})}let Zt="div",Xt=Ge.RenderStrategy|Ge.Static;function Jt(e,s){var l,n,i,r;let c=Ze(),{id:d=`headlessui-tabs-panel-${c}`,tabIndex:p=0,...a}=e,{selectedIndex:f,tabs:g,panels:P}=re("Tab.Panel"),m=Le("Tab.Panel"),v=u.useRef(null),D=fe(v,s);je(()=>m.registerPanel(v),[m,v,d]);let j=Ke("panels"),o=P.indexOf(v);o===-1&&(o=j);let y=o===f,x=u.useMemo(()=>({selected:y}),[y]),S={ref:D,id:d,role:"tabpanel","aria-labelledby":(n=(l=g[o])==null?void 0:l.current)==null?void 0:n.id,tabIndex:y?p:-1};return!y&&((i=a.unmount)==null||i)&&!((r=a.static)!=null&&r)?ne.createElement(Ve,{as:"span","aria-hidden":"true",...S}):me({ourProps:S,theirProps:a,slot:x,defaultTag:Zt,features:Xt,visible:y,name:"Tabs.Panel"})}let Kt=ue(qt),es=ue(Bt),ts=ue(Ht),ss=ue(Vt),ls=ue(Jt),I=Object.assign(Kt,{Group:es,List:ts,Panels:ss,Panel:ls});function ns({title:e,titleId:s,...l},n){return u.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":s},l),e?u.createElement("title",{id:s},e):null,u.createElement("path",{fillRule:"evenodd",d:"M3 6.75A.75.75 0 0 1 3.75 6h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 6.75ZM3 12a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 12Zm0 5.25a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"}))}const et=u.forwardRef(ns);function rs({title:e,titleId:s,...l},n){return u.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":s},l),e?u.createElement("title",{id:s},e):null,u.createElement("path",{fillRule:"evenodd",d:"M12 3.75a.75.75 0 0 1 .75.75v6.75h6.75a.75.75 0 0 1 0 1.5h-6.75v6.75a.75.75 0 0 1-1.5 0v-6.75H4.5a.75.75 0 0 1 0-1.5h6.75V4.5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"}))}const as=u.forwardRef(rs);function os({title:e,titleId:s,...l},n){return u.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":s},l),e?u.createElement("title",{id:s},e):null,u.createElement("path",{d:"M15 3.75H9v16.5h6V3.75ZM16.5 20.25h3.375c1.035 0 1.875-.84 1.875-1.875V5.625c0-1.036-.84-1.875-1.875-1.875H16.5v16.5ZM4.125 3.75H7.5v16.5H4.125a1.875 1.875 0 0 1-1.875-1.875V5.625c0-1.036.84-1.875 1.875-1.875Z"}))}const is=u.forwardRef(os);function cs(e){switch(e){case J.SQL:return"SQL";case J.PY:return"Python";case J.YAML:case J.YML:return"YAML";default:return"Plain Text"}}function ds(e,s){return e.file.extension===J.SQL&&e.file.isLocal&&Ie(s)}const A=function({text:s,children:l,className:n}){return t.jsxs("small",{className:b("font-bold whitespace-nowrap text-xs",n),children:[k(s)&&t.jsxs("span",{children:[s,": "]}),l]})};function us({text:e,className:s}){return t.jsx("span",{className:b("font-normal",s),children:e})}function fs({ok:e,className:s}){return t.jsx("span",{className:b("inline-block w-2 h-2 rounded-full",Q(e)&&"bg-warning-500",lt(e)&&"bg-success-500",F(e)&&"bg-danger-500",s)})}A.Text=us;A.Light=fs;const O={Model:"model",Test:"test",Macro:"macro",Hook:"hook",Log:"log",Config:"config",Seed:"seed",Metric:"metric",Schema:"schema",Unknown:"unknown"};function ms({tab:e}){const s=R(c=>c.isModel),l=N(c=>c.engine),n=N(c=>c.dialects),i=N(c=>c.refreshTab);u.useEffect(()=>{var d;const c=(d=n[0])==null?void 0:d.dialect_name;Q(e.dialect)&&k(c)&&r(c)},[n,e]);function r(c){e.dialect=c,i(e),l.postMessage({topic:"dialect",payload:e.dialect})}return t.jsxs("div",{className:"flex w-full items-center px-2 min-h-[2rem] overflow-hidden",children:[e.file.isRemote&&t.jsx(A,{className:"mr-2",text:"Saved",children:t.jsx(A.Light,{ok:F(e.file.isChanged)})}),e.file.isRemote&&e.file.isSQL&&t.jsx(A,{className:"mr-2",text:"Formatted",children:t.jsx(A.Light,{ok:e.file.isFormatted})}),t.jsx(A,{className:"mr-2",text:"Language",children:t.jsx(A.Text,{text:cs(e.file.extension)})}),ds(e,n)&&t.jsx(A,{className:"mr-2",text:"Dialect",children:t.jsx(T,{size:E.sm,children:({className:c,size:d})=>t.jsx(T.Selector,{className:c,size:d,list:n.map(p=>({text:p.dialect_title,value:de(p.dialect_name)?"sqlglot":p.dialect_name})),onChange:r,value:e.dialect})})}),s(e.file.path)&&!de(e.dialect)&&t.jsx(A,{className:"mr-2",text:"Dialect",children:t.jsx(A.Text,{text:e.dialect})}),t.jsx(A,{className:"mr-2",text:"SQLMesh Type",children:t.jsx(A.Text,{text:xs(e.file.path)})})]})}function xs(e){return de(e)?O.Unknown:e.startsWith("models")?O.Model:e.startsWith("tests")?O.Test:e.startsWith("logs")?O.Log:e.startsWith("macros")?O.Macro:e.startsWith("hooks")?O.Hook:e.startsWith("seeds")?O.Seed:e.startsWith("metrics")?O.Metric:["config.yaml","config.yml","config.py"].includes(e)?O.Config:["external_models.yaml","schema.yaml"].includes(e)?O.Schema:O.Unknown}function He({tab:e,title:s}){const l=u.useRef(null),n=R(g=>g.addConfirmation),i=ee(g=>g.setSelectedFile),r=N(g=>g.closeTab),c=N(g=>g.tab),d=e.file.id===(c==null?void 0:c.file.id);return u.useEffect(()=>{Q(e)||(e.el=l.current??void 0)},[l,e]),u.useEffect(()=>{Q(c)||setTimeout(()=>{var g;(g=c.el)==null||g.scrollIntoView({behavior:"smooth",inline:"center"})},300)},[c]),t.jsx("li",{ref:l,className:b("inline-block py-1 pr-2 last-child:pr-0 overflow-hidden text-center overflow-ellipsis cursor-pointer"),onClick:p,children:t.jsxs("span",{className:b("flex border-2 justify-between items-center pl-1 pr-1 py-[0.125rem] min-w-[8rem] rounded-md group border-transparent border-r border-r-theme-darker dark:border-r-theme-lighter",d?"bg-neutral-200 border-neutral-200 text-neutral-900 dark:bg-dark-lighter dark:border-dark-lighter dark:text-primary-500":"bg-trasparent hover:bg-theme-darker dark:hover:bg-theme-lighter"),children:[t.jsx("small",{className:"text-xs",children:s}),t.jsx("small",{className:b("group-hover:hidden text-xs inline-block ml-3 mr-1 w-2 h-2 rounded-full",e.file.isChanged?"bg-warning-500":"bg-transparent")}),t.jsx(pt,{className:"hidden group-hover:inline-block text-neutral-600 dark:text-neutral-100 w-4 h-4 ml-2 mr-0 cursor-pointer",onClick:a})]})});function p(g){g.stopPropagation(),i(e.file)}function a(g){g.stopPropagation(),f()}function f(){e.file.isChanged?n({headline:"Closing Tab",description:"All unsaved changes will be lost. Do you want to close the tab anyway?",yesText:"Yes, Close Tab",noText:"No, Cancel",action:()=>r(e.file)}):r(e.file)}}function hs(){const e=R(o=>o.modules),s=R(o=>o.models),l=R(o=>o.lastSelectedModel),n=R(o=>o.setLastSelectedModel),i=ee(o=>o.files),r=ee(o=>o.selectedFile),c=ee(o=>o.setSelectedFile),d=N(o=>o.tab),p=N(o=>o.tabs),a=N(o=>o.replaceTab),f=N(o=>o.createTab),g=N(o=>o.selectTab),P=N(o=>o.addTab),[m,v]=u.useMemo(()=>{const o=[],y=[];return p.forEach(x=>{x.file.isLocal&&o.push(x),x.file.isRemote&&y.push(x)}),[o,y]},[p]);return u.useEffect(()=>{if(Q(r)||(d==null?void 0:d.file)===r||r instanceof xt||F(e.hasFiles))return;n(s.get(r.path));const o=f(r);k(d)&&d.file instanceof ht&&F(d.file.isChanged)&&d.file.isRemote&&F(p.has(r))?a(d,o):P(o),g(o)},[r,e]),u.useEffect(()=>{if(Q(l))return;const o=i.get(l.path);Q(o)||c(o)},[l]),t.jsxs("div",{className:"flex items-center bg-neutral-5",children:[t.jsx(z,{className:"h-6 m-0 ml-1 mr-2 border-none",variant:L.Alternative,size:E.sm,onClick:D,children:t.jsx(as,{className:"inline-block w-3 h-4"})}),t.jsxs("ul",{className:"w-full whitespace-nowrap min-h-[2rem] max-h-[2rem] overflow-hidden overflow-x-auto hover:scrollbar scrollbar--horizontal",children:[m.map((o,y)=>t.jsx(He,{tab:o,title:`Custom SQL ${y+1}`},o.id)),v.map(o=>t.jsx(He,{tab:o,title:o.file.name},o.id))]})]});function D(o){o.stopPropagation(),j()}function j(){const o=f();P(o),g(o),c(o.file)}}function Ae({list:e,children:s=[],className:l,disabled:n=!1}){return t.jsxs(I.List,{className:b("w-full whitespace-nowrap px-2 flex justify-center items-center",n&&"cursor-not-allowed"),children:[t.jsx("div",{className:b("flex w-full overflow-hidden overflow-x-auto py-1 hover:scrollbar scrollbar--horizontal",l,n&&"opacity-50 pointer-events-none"),children:t.jsx("div",{className:"flex p-1 items-center bg-secondary-10 dark:bg-primary-10 cursor-pointer rounded-full overflow-hidden",children:e.map(i=>t.jsx(I,{className:({selected:r})=>b("text-xs px-2 py-0.5 mr-2 last:mr-0 rounded-full relative align-middle",r?"bg-secondary-500 text-secondary-100 cursor-default font-bold":"cursor-pointer font-medium text-secondary-400 dark:text-secondary-400"),children:i},i))})}),s]})}const Ue=24*60*60*1e3,ps=1e3,we=50;function gs({tab:e,isOpen:s=!0,toggle:l}){const n=R(c=>c.models),i=R(c=>c.isModel),r=u.useMemo(()=>n.get(e.file.path),[e,n]);return t.jsx("div",{className:b("flex flex-col w-full h-full items-center overflow-hidden"),children:i(e.file.path)?k(r)&&t.jsx(bs,{tab:e,model:r,isOpen:s,toggle:l}):t.jsx(vs,{tab:e,isOpen:s,toggle:l})})}function bs({tab:e,model:s,isOpen:l=!0,toggle:n}){const i=R(d=>d.environment),r=R(d=>d.environments),c=Array.from(r).filter(({isRemote:d})=>d).map(({name:d})=>({text:d,value:d}));return t.jsxs(I.Group,{children:[t.jsxs("div",{className:"flex w-full items-center",children:[t.jsx(z,{className:b("h-6 w-6 !px-0 border-none bg-neutral-10 dark:bg-neutral-20",l?"text-secondary-500 dark:text-secondary-300":"text-neutral-500 dark:text-neutral-300"),variant:L.Info,size:E.sm,onClick:d=>{d.stopPropagation(),n==null||n()},children:t.jsx(et,{className:"w-4 h-4"})}),l&&t.jsx(Ae,{className:"flex justify-center items-center",list:["Evaluate","Columns",c.length>1&&i.isRemote&&"Diff"].filter(Boolean)})]}),l&&t.jsxs(I.Panels,{className:"h-full w-full overflow-hidden",children:[t.jsx(I.Panel,{unmount:!1,className:b("flex flex-col w-full h-full relative overflow-hidden","ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2"),children:t.jsx(Ns,{model:s})}),t.jsx(I.Panel,{unmount:!1,className:"text-xs w-full h-full ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2 px-2",children:t.jsx(Pt,{nodeId:s.fqn,columns:s.columns,disabled:F(s.isModelSQL),withHandles:!1,withSource:!1,withDescription:!0,limit:10})}),c.length>1&&i.isRemote&&t.jsx(I.Panel,{unmount:!1,className:b("flex flex-col w-full h-full relative overflow-hidden","ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2"),children:t.jsx(ys,{tab:e,model:s,list:c.filter(({value:d})=>i.name!==d),target:{text:i.name,value:i.name}})})]})]})}function vs({tab:e,isOpen:s=!0,toggle:l}){return t.jsxs(I.Group,{children:[t.jsxs("div",{className:"flex w-full items-center",children:[t.jsx(z,{className:b("h-6 w-6 !px-0 border-none bg-neutral-10 dark:bg-neutral-20",s?"text-secondary-500 dark:text-secondary-300":"text-neutral-500 dark:text-neutral-300"),variant:L.Info,size:E.sm,onClick:n=>{n.stopPropagation(),l==null||l()},children:t.jsx(et,{className:"w-4 h-4"})}),s&&t.jsx(Ae,{className:"flex justify-center items-center",list:["Run Query","Diff"]})]}),s&&t.jsxs(I.Panels,{className:"h-full w-full overflow-hidden",children:[t.jsx(I.Panel,{unmount:!1,className:b("flex flex-col w-full h-full relative overflow-hidden","ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2"),children:t.jsx(ws,{tab:e})}),t.jsx(I.Panel,{unmount:!1,className:b("flex flex-col w-full h-full relative overflow-hidden","ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2"),children:t.jsx(Ts,{})})]})]})}function js({children:e}){return t.jsx("fieldset",{className:"flex my-3",children:e})}function ye({children:e}){return t.jsx("div",{className:"flex w-full h-full py-1 overflow-hidden overflow-y-auto hover:scrollbar scrollbar--vertical",children:e})}function Te({children:e}){return t.jsx("div",{className:"flex w-full py-1 px-1 justify-end",children:e})}function ws({tab:e}){const s=N(p=>p.setPreviewQuery),l=N(p=>p.setPreviewTable),n=N(p=>p.engine),{refetch:i,isFetching:r,cancel:c}=at({sql:e.file.content});u.useEffect(()=>()=>{c()},[]);function d(){l(void 0),s(e.file.content),i().then(({data:p})=>{l(Fe(p))})}return t.jsxs(t.Fragment,{children:[t.jsx(ye,{}),t.jsx(ae,{}),t.jsxs(Te,{children:[t.jsx(z,{size:E.sm,variant:L.Alternative,onClick:p=>{p.stopPropagation(),n.postMessage({topic:"format",payload:{sql:e.file.content,dialect:e.dialect}})},children:"Format"}),r?t.jsxs("div",{className:"flex items-center",children:[t.jsx(Ne,{className:"w-3"}),t.jsx("small",{className:"text-xs text-neutral-400 block mx-2",children:"Running Query..."}),t.jsx(z,{size:E.sm,variant:L.Danger,onClick:p=>{p.stopPropagation(),c()},children:"Cancel"})]}):t.jsx(z,{size:E.sm,variant:L.Alternative,disabled:r,onClick:p=>{p.stopPropagation(),d()},children:"Run Query"})]})]})}function Ns({model:e}){const s=R(m=>m.environment),l=R(m=>m.isModel),n=N(m=>m.setPreviewQuery),i=N(m=>m.setPreviewTable),[r,c]=u.useState({model:e.displayName,start:Pe(Qe(Date.now()-Ue)),end:Pe(new Date),execution_time:Pe(Qe(Date.now()-Ue)),limit:1e3}),{refetch:d}=nt({model:r.model,start:r.start,end:r.end,execution_time:r.execution_time,dialect:e.dialect,pretty:!0}),{refetch:p,isFetching:a,cancel:f}=rt(r),g=l(e.path)&&Object.values(r).every(Boolean);u.useEffect(()=>()=>{f()},[]);function P(){n(void 0),i(void 0),d().then(({data:m})=>{n(m==null?void 0:m.sql)}),p().then(({data:m})=>{i(Fe(m))})}return t.jsxs(t.Fragment,{children:[t.jsx(ye,{children:t.jsxs("form",{className:"w-full",children:[F(g)&&t.jsx(js,{children:t.jsx(Be,{variant:L.Warning,children:t.jsxs(Be.Description,{className:"w-full mr-2 text-sm",children:["Please fill out all fields to ",t.jsx("b",{children:"evaluate the model"}),"."]})})}),t.jsxs("fieldset",{className:"px-2 w-full text-neutral-500",children:[t.jsx(T,{className:"w-full mx-0",label:"Start Date",size:E.sm,children:({className:m})=>t.jsx(T.Textfield,{className:b(m,"w-full"),placeholder:"02/11/2023",value:r.start,onInput:v=>{v.stopPropagation(),c({...r,start:v.target.value??""})}})}),t.jsx(T,{className:"w-full mx-0",label:"End Date",size:E.sm,children:({className:m})=>t.jsx(T.Textfield,{className:b(m,"w-full"),placeholder:"02/13/2023",value:r.end,onInput:v=>{v.stopPropagation(),c({...r,end:v.target.value??""})}})}),t.jsx(T,{className:"w-full mx-0",label:"Execution Time",size:E.sm,children:({className:m})=>t.jsx(T.Textfield,{className:b(m,"w-full"),placeholder:"02/13/2023",value:r.execution_time,onInput:v=>{v.stopPropagation(),c({...r,execution_time:v.target.value??""})}})}),k(r.limit)&&t.jsx(T,{className:"w-full mx-0",label:"Limit",size:E.sm,children:({className:m})=>t.jsx(T.Textfield,{className:b(m,"w-full"),type:"number",placeholder:"1000",value:r.limit,onInput:v=>{v.stopPropagation(),c({...r,limit:v.target.valueAsNumber??ps})}})})]})]})}),t.jsx(ae,{}),t.jsx(Te,{children:t.jsx("div",{className:"flex w-full justify-end",children:l(e.path)&&a?t.jsxs("div",{className:"flex items-center",children:[t.jsx(Ne,{className:"w-3"}),t.jsx("small",{className:"text-xs text-neutral-400 block mx-2",children:"Evaluating..."}),t.jsx(z,{size:E.sm,variant:L.Danger,onClick:m=>{m.stopPropagation(),f()},children:"Cancel"})]}):t.jsx(z,{size:E.sm,variant:L.Alternative,disabled:F(g)||a||s.isInitialProd,onClick:m=>{m.stopPropagation(),P()},children:"Evaluate"})})})]})}function ys({tab:e,model:s,list:l,target:n}){const i=R(x=>x.isModel),r=N(x=>x.setPreviewDiff),[c,d]=u.useState(l[0].value),[p,a]=u.useState(we),[f,g]=u.useState(""),[P,m]=u.useState(""),{refetch:v,isFetching:D,cancel:j}=qe({source:c,target:n.value,model_or_snapshot:s.name,limit:p,on:f,where:P}),o=u.useCallback(()=>{r(void 0),v().then(({data:x})=>{r(x)})},[s.name,s.hash]);u.useEffect(()=>()=>{j()},[]),u.useEffect(()=>{d(l[0].value)},[l]);const y=i(e.file.path)&&[c,n,p].every(Boolean);return t.jsxs(t.Fragment,{children:[t.jsx(ye,{children:t.jsx("form",{className:"w-full",children:t.jsxs("fieldset",{className:"px-2 w-full text-neutral-500",children:[t.jsx(T,{className:"w-full mx-0",label:"Source",disabled:l.length<2,size:E.sm,children:({disabled:x,className:S})=>t.jsx(T.Selector,{className:b(S,"w-full"),list:l,value:c,disabled:x,onChange:d})}),t.jsx(T,{className:"w-full mx-0",label:"Target",disabled:!0,children:({disabled:x,className:S})=>t.jsx(T.Textfield,{className:b(S,"w-full"),disabled:x,value:n.value})}),t.jsx(T,{className:"w-full mx-0",label:"Limit",size:E.sm,children:({className:x})=>t.jsx(T.Textfield,{className:b(x,"w-full"),type:"number",placeholder:"1000",value:p,onInput:S=>{S.stopPropagation(),a(S.target.valueAsNumber??we)}})}),t.jsx(T,{className:"w-full mx-0",label:"ON",size:E.sm,children:({className:x})=>t.jsx(T.Textfield,{className:b(x,"w-full"),placeholder:"s.id = t.id",value:f,onInput:S=>{S.stopPropagation(),g(S.target.value)}})}),t.jsx(T,{className:"w-full mx-0",label:"WHERE",size:E.sm,children:({className:x})=>t.jsx(T.Textfield,{className:b(x,"w-full"),placeholder:"id > 10",value:P,onInput:S=>{S.stopPropagation(),m(S.target.value)}})})]})})}),t.jsx(ae,{}),t.jsx(Te,{children:t.jsx("div",{className:"flex w-full justify-end items-center px-2",children:D?t.jsxs("div",{className:"flex items-center",children:[t.jsx(Ne,{className:"w-3"}),t.jsx("small",{className:"text-xs text-neutral-400 block mx-2",children:"Getting Diff..."}),t.jsx(z,{size:E.sm,variant:L.Danger,onClick:x=>{x.stopPropagation(),j()},children:"Cancel"})]}):t.jsx(z,{className:"ml-2",size:E.sm,variant:L.Alternative,disabled:F(y)||D,onClick:x=>{x.stopPropagation(),o()},children:"Get Diff"})})})]})}function Ts(){const e=N(j=>j.setPreviewDiff),[s,l]=u.useState(""),[n,i]=u.useState(""),[r,c]=u.useState(we),[d,p]=u.useState(""),[a,f]=u.useState(""),{refetch:g,isFetching:P,cancel:m}=qe({source:s,target:n,limit:r,on:d,where:a});u.useEffect(()=>()=>{m()},[]);function v(){e(void 0),g().then(({data:j})=>{e(j)})}const D=[s,n,r,d].every(Boolean);return t.jsxs(t.Fragment,{children:[t.jsx(ye,{children:t.jsx("form",{className:"w-full",children:t.jsxs("fieldset",{className:"px-2 w-full text-neutral-500",children:[t.jsx(T,{className:"w-full mx-0",label:"Source",size:E.sm,children:({className:j})=>t.jsx(T.Textfield,{className:b(j,"w-full"),placeholder:"exp.tst_model__dev",value:s,onInput:o=>{o.stopPropagation(),l(o.target.value)}})}),t.jsx(T,{className:"w-full mx-0",label:"Target",size:E.sm,children:({className:j})=>t.jsx(T.Textfield,{className:b(j,"w-full"),placeholder:"exp.tst_snapshot__1353336088",value:n,onInput:o=>{o.stopPropagation(),i(o.target.value)}})}),t.jsx(T,{className:"w-full mx-0",label:"Limit",size:E.sm,children:({className:j})=>t.jsx(T.Textfield,{className:b(j,"w-full"),type:"number",placeholder:"1000",value:r,onInput:o=>{o.stopPropagation(),c(o.target.valueAsNumber??we)}})}),t.jsx(T,{className:"w-full mx-0",label:"ON",size:E.sm,children:({className:j})=>t.jsx(T.Textfield,{className:b(j,"w-full"),placeholder:"s.id = t.id",value:d,onInput:o=>{o.stopPropagation(),p(o.target.value)}})}),t.jsx(T,{className:"w-full mx-0",label:"WHERE",size:E.sm,children:({className:j})=>t.jsx(T.Textfield,{className:b(j,"w-full"),placeholder:"id > 10",value:a,onInput:o=>{o.stopPropagation(),f(o.target.value)}})})]})})}),t.jsx(ae,{}),t.jsx(Te,{children:P?t.jsxs("div",{className:"flex items-center",children:[t.jsx(Ne,{className:"w-3"}),t.jsx("small",{className:"text-xs text-neutral-400 block mx-2",children:"Getting Diff..."}),t.jsx(z,{size:E.sm,variant:L.Danger,onClick:j=>{j.stopPropagation(),m()},children:"Cancel"})]}):t.jsx(z,{className:"ml-2",size:E.sm,variant:L.Alternative,disabled:F(D)||P,onClick:j=>{j.stopPropagation(),v()},children:"Get Diff"})})]})}const xe="s__",he="t__",ze="NULL";function Es({source_schema:e,target_schema:s},l,n){const i=Array.from(new Set(n.flat())),r=Object.keys(e),c=Object.keys(s),p=Array.from(new Set(r.concat(c))).filter(g=>r.includes(g)&&c.includes(g)),a=r.filter(g=>!c.includes(g)),f=c.filter(g=>!r.includes(g));return{all:Array.from(new Set([i,l.modifiedColumns&&p,l.addedColumns&&f,l.removedColumns&&a].filter(Boolean).flat())),added:f.length,deleted:a.length,modified:p.length-i.length}}function Ps(e,s,l){const n=Object.values(e.row_diff.sample)[0]??{},i=[],r=[],c=[];return Object.keys(n).forEach(d=>{V(e,d,l)?r.push(d):Y(e,d,l)?i.push(d):c.push(d)}),{all:[s.modifiedRows&&c,s.addedRows&&r,s.removedRows&&i].filter(Boolean).flat(),added:r.length,deleted:i.length,modified:c.length}}function De(e,s,l){const n=G(e,xe,s,l),i=G(e,he,s,l);return n!==i}function Y(e,s,l){return l.every(([n,i])=>{const r=G(e,xe,n,s),c=G(e,he,i,s);return k(r)&&Q(c)})}function V(e,s,l){return l.every(([n,i])=>{const r=G(e,xe,n,s),c=G(e,he,i,s);return Q(r)&&k(c)})}function Ce(e,s,l,n){return l in e.schema_diff.added||l in e.schema_diff.removed?!1:s.some(i=>F(V(e,i,n))&&F(Y(e,i,n))&&De(e,l,i))}function G(e,s,l,n){var i;return(i=e.row_diff.sample[`${s}${l}`])==null?void 0:i[n]}function Ss(e,s,l){return G(e,xe,s,l)??ze}function Cs(e,s,l){return G(e,he,s,l)??ze}function ks({diff:e}){const[s,l]=u.useState({modifiedRows:!0,addedRows:!0,removedRows:!0,modifiedColumns:!0,addedColumns:!0,removedColumns:!0}),n=Es(e.schema_diff,s,e.on),i=Ps(e,s,e.on),r=s.addedRows&&!s.removedRows&&!s.modifiedRows,c=!s.addedRows&&s.removedRows&&!s.modifiedRows,d=Array.from(new Set(e.on.flat())),p=Object.values(e.row_diff.sample).some(a=>Object.keys(a).length>0);return t.jsxs("div",{className:"px-2 h-full flex flex-col rounded-lg",children:[p&&t.jsxs(t.Fragment,{children:[t.jsx(Ds,{diff:e,rows:i,columns:n}),t.jsx("div",{className:"mt-2 mb-1 flex rounded-lg items-center",children:t.jsx("div",{className:"w-full flex justify-end items-center",children:t.jsx(gt,{options:Object.keys(s).reduce((a,f)=>(a[f]=g=>l(P=>({...P,[f]:g})),a),{}),value:Object.keys(s).map(a=>F(s[a])?void 0:a).filter(Boolean)})})})]}),t.jsx("div",{className:"overflow-auto h-full hover:scrollbar scrollbar--horizontal scrollbar--vertical",children:t.jsxs("table",{cellPadding:0,cellSpacing:0,className:"w-full text-xs text-neutral-600 dark:text-neutral-200 font-normal border-separate",children:[t.jsx("thead",{className:"sticky bg-theme top-0 z-10",children:t.jsx("tr",{children:n.all.map(a=>t.jsx("th",{colSpan:Ce(e,i.all,a,e.on)?2:1,className:b("text-left whitespace-nowrap py-1 px-2 font-bold",a in e.schema_diff.added?"border-t-2 border-l-2 border-r-2 border-success-500":a in e.schema_diff.removed?"border-t-2 border-l-2 border-r-2 border-danger-500":d.includes(a)?"border-brand-500 border-l-2 border-t-2 border-r-2":"border-r border-b border-neutral-100 dark:border-neutral-700 last:border-r-0",d.includes(a)?"bg-brand-10":"bg-neutral-5"),children:t.jsxs("div",{className:"flex justify-between",children:[t.jsxs("div",{className:"mr-2",children:[t.jsx("span",{children:a})," ",t.jsxs("small",{className:"text-neutral-500 font-medium",children:["(",e.schema_diff.source_schema[a]??e.schema_diff.target_schema[a],")"]})]}),F(d.includes(a))&&t.jsx("div",{className:"ml-2",children:t.jsxs("small",{className:"inline-block bg-neutral-10 px-2 py-0.5 rounded-full",children:[Math.round(i.all.filter(f=>De(e,a,f)).length/i.all.length*100),"%"]})})]})},a))})}),t.jsx("tbody",{children:Ie(i.all)?i.all.map(a=>t.jsx("tr",{children:n.all.map(f=>Ce(e,i.all,f,e.on)?t.jsxs(t.Fragment,{children:[t.jsx("td",{className:b("p-1 border-r border-b border-neutral-100 dark:border-neutral-700 last:border-r-0",V(e,a,e.on)&&"bg-success-10 text-success-500",Y(e,a,e.on)&&"bg-danger-5 text-danger-500"),children:t.jsx("div",{className:b("px-2 py-1 whitespace-nowrap font-bold rounded-md ",V(e,a,e.on)&&"bg-success-10 text-success-500",Y(e,a,e.on)&&"bg-danger-5 text-danger-500"),children:Ss(e,f,a)})},`${a}-${f}-source`),t.jsx("td",{className:b("p-1 border-r border-b border-neutral-100 dark:border-neutral-700 last:border-r-0",V(e,a,e.on)&&"bg-success-10 text-success-500",Y(e,a,e.on)&&"bg-danger-5 text-danger-500"),children:t.jsx("div",{className:b("px-2 py-1 whitespace-nowrap font-bold rounded-md",De(e,f,a)&&"bg-primary-10 text-primary-500",V(e,a,e.on)&&"!bg-success-10 !text-success-500",Y(e,a,e.on)&&"!bg-danger-5 !text-danger-500"),children:Cs(e,f,a)})},`${a}-${f}-target`)]}):t.jsx("td",{className:b("p-1",f in e.schema_diff.added?"bg-success-10 border-l-2 border-r-2 border-success-500 text-success-500 font-bold":f in e.schema_diff.removed?"bg-danger-5 border-l-2 border-r-2 border-danger-500 !text-danger-500 font-bold":d.includes(f)?"border-brand-500 border-l-2 border-r-2":"border-r border-b border-neutral-100 dark:border-neutral-700 last:border-r-0",Y(e,a,e.on)&&"!bg-danger-5 text-danger-500 font-bold",V(e,a,e.on)&&"bg-success-10 text-success-500 font-bold"),children:t.jsx("div",{className:b("px-2 py-1 whitespace-nowrap rounded-md",(f in e.schema_diff.added||V(e,a,e.on))&&"bg-success-10 text-success-500 font-bold",(f in e.schema_diff.removed||Y(e,a,e.on))&&"!bg-danger-5 !text-danger-500 font-bold"),children:G(e,xe,f,a)??G(e,he,f,a)??ze})},`${a}-${f}`))},a)):t.jsx(yt,{columns:n.all.length>0?n.all.length:void 0})}),Ie(i.all)&&t.jsx("tfoot",{className:"sticky bg-theme bottom-0",children:t.jsx("tr",{children:n.all.map(a=>Ce(e,i.all,a,e.on)?t.jsxs(t.Fragment,{children:[t.jsx("th",{className:b("text-left whitespace-nowrap px-2 py-1 border-r border-t border-neutral-100 dark:border-neutral-700 last:border-r-0",d.includes(a)?"bg-brand-10":"bg-neutral-10"),children:"Source"},`${a}-source`),t.jsx("th",{className:b("text-left whitespace-nowrap px-2 py-1 border-r border-t border-neutral-100 dark:border-neutral-700 last:border-r-0",d.includes(a)?"bg-brand-10":"bg-primary-10"),children:"Target"},`${a}-target`)]}):t.jsxs("th",{className:b("text-left whitespace-nowrap px-2 py-1 font-bold",a in e.schema_diff.added?"border-b-2 border-l-2 border-r-2 border-success-500":a in e.schema_diff.removed?"border-b-2 border-l-2 border-r-2 border-danger-500":d.includes(a)?"border-brand-500 border-l-2 border-b-2 border-r-2":"border-r border-t border-neutral-100 dark:border-neutral-700 last:border-r-0",d.includes(a)?"bg-brand-10":"bg-neutral-10"),children:[(a in e.schema_diff.removed||c)&&t.jsx("span",{children:"Source"}),(a in e.schema_diff.added||r)&&t.jsx("span",{children:"Target"})]},a))})})]})}),t.jsxs("div",{className:"flex justify-between items-center px-2 mt-2",children:[t.jsx(Tt,{count:i.all.length}),t.jsx(Is,{})]})]})}function Is(){const e=[["Grain","bg-brand-500"],["Changed","bg-primary-500"],["Added","bg-success-500"],["Deleted","bg-danger-500"]];return t.jsx("div",{className:"flex text-xs",children:e.map(([s="",l])=>t.jsx(Rs,{text:s,className:l},s))})}function Rs({text:e,className:s}){return t.jsxs("div",{className:"flex ml-2 items-center",children:[t.jsx("span",{className:b("inline-block w-3 h-3 mr-2 rounded-full",s)}),t.jsx("small",{className:"text-neutral-600 dark:text-neutral-400",children:e})]})}function Ds({diff:e,rows:s,columns:l}){return t.jsx(Se,{defaultOpen:!1,children:({open:n})=>t.jsxs(t.Fragment,{children:[t.jsxs(Se.Button,{className:"flex items-center w-full justify-between rounded-lg text-left text-sm px-4 pt-3 pb-2 bg-neutral-10 hover:bg-theme-darker dark:hover:bg-theme-lighter text-neutral-600 dark:text-neutral-400",children:[t.jsx("h2",{className:"whitespace-nowrap text-xl font-bold mb-1",children:"Stats"}),n?t.jsx(It,{className:"h-6 w-6 text-primary-500"}):t.jsx(Rt,{className:"h-6 w-6 text-primary-500"})]}),t.jsx(Se.Panel,{className:"px-4 pb-2 text-sm text-neutral-500",children:t.jsxs("div",{className:"p-2 grid grid-cols-3 gap-4 mb-3",children:[t.jsx(ke,{text:"Row Count Change",children:t.jsxs("p",{className:"text-6xl font-light text-primary-500 mt-3",children:[Math.round(Math.abs(e.row_diff.count_pct_change)),t.jsx("small",{className:"text-sm",children:"%"})]})}),t.jsxs(ke,{text:"Column Count Change",count:s.all.length,children:[t.jsx("p",{className:"text-center text-6xl font-light text-primary-500 mt-3",children:s.modified}),t.jsx("p",{className:"text-center text-6xl font-light text-success-500 mt-3",children:s.added}),t.jsx("p",{className:"text-center text-6xl font-light text-danger-500 mt-3",children:s.deleted})]}),t.jsxs(ke,{text:"Column Changes",count:l.all.length,children:[t.jsx("p",{className:"text-center text-6xl font-light text-primary-500 mt-3",children:l.modified}),t.jsx("p",{className:"text-center text-6xl font-light text-success-500 mt-3",children:l.added}),t.jsx("p",{className:"text-center text-6xl font-light text-danger-500 mt-3",children:l.deleted})]})]})})]})})}function ke({text:e,children:s,className:l,count:n}){return t.jsxs("div",{className:b("rounded-xl overflow-hidden px-3 py-6 bg-primary-10",l),children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("h3",{className:"text-neutral-500 dark:text-neutral-300 text-sm font-bold",children:e}),k(n)&&t.jsx("div",{children:t.jsx("small",{className:"inline-block px-2 py-0.5 bg-neutral-10 rounded-full",children:n})})]}),t.jsx("div",{className:"grid grid-cols-3 gap-2",children:s})]})}const Fs=u.lazy(async()=>await ft(()=>import("./ModelLineage-BFuK5Bgk.js"),[])),U={Query:"Query",Table:"Data Preview",Lineage:"Lineage",Diff:"Diff",Errors:"Errors"};function Ms({tab:e,className:s}){const{errors:l,removeError:n}=Ye(),i=ot(),r=R(x=>x.models),c=R(x=>x.isModel),d=N(x=>x.direction),p=N(x=>x.previewQuery),a=N(x=>x.previewTable),f=N(x=>x.previewDiff),g=N(x=>x.setDirection),[P,m]=u.useState(-1),v=Xe(e.file.path,x=>{i(`${it.DataCatalogModels}/${x.name}`)}),D=r.get(e.file.path),j=F(e.file.isEmpty)&&k(D)&&c(e.file.path),o=l.size>0,y=u.useMemo(()=>[k(a)&&U.Table,k(p)&&e.file.isRemote&&U.Query,j&&U.Lineage,k(f)&&U.Diff,o&&U.Errors].filter(Boolean),[e.id,a,p,f,j,l,o]);return u.useEffect(()=>{k(a)?m(y.indexOf(U.Table)):m(0)},[a]),u.useEffect(()=>{k(f)?m(y.indexOf(U.Diff)):m(0)},[f]),u.useEffect(()=>{k(j)?m(y.indexOf(U.Lineage)):m(0)},[j]),u.useEffect(()=>{m(o?y.indexOf(U.Errors):0)},[o]),u.useEffect(()=>{for(const x of l)ct([$.Fetchdf,$.EvaluateModel,$.RenderQuery,$.ColumnLineage,$.ModelLineage,$.TableDiff,$.Table,$.SaveFile],x.key)&&n(x)},[a,f,p,j]),t.jsx("div",{className:b("w-full h-full flex flex-col text-prose overflow-auto hover:scrollbar scrollbar--vertical",s),children:dt(y)?t.jsx("div",{className:"flex justify-center items-center w-full h-full",children:t.jsx("h3",{className:"text-md",children:"No Data To Preview"})}):t.jsxs(I.Group,{onChange:m,selectedIndex:P,children:[t.jsx(Ae,{list:y,children:t.jsx("div",{className:"ml-2",children:t.jsx(z,{className:"!m-0 !py-0.5 px-[0.25rem] border-none",variant:L.Alternative,size:E.sm,onClick:()=>{g(d==="horizontal"?"vertical":"horizontal")},children:t.jsx(is,{"aria-label":d==="horizontal"?"Use vertical layout":"Use horizontal layout",className:"text-primary-500 w-5"})})})},y.join("-")),t.jsxs(I.Panels,{className:"h-full w-full overflow-hidden",children:[k(a)&&t.jsx(I.Panel,{unmount:!1,className:b("w-full h-full pt-4 relative px-2","ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2"),children:t.jsx(Et,{data:a})}),k(p)&&e.file.isRemote&&t.jsx(I.Panel,{unmount:!1,className:"w-full h-full ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2 p-2",children:t.jsx("div",{className:"w-full h-full p-2 bg-primary-10 rounded-lg overflow-auto hover:scrollbar scrollbar--horizontal scrollbar--vertical",children:t.jsx(Re,{type:J.SQL,content:p??"",extensions:v,className:"text-xs"})})}),j&&t.jsx(I.Panel,{unmount:!1,className:b("w-full h-full ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2"),children:t.jsx(u.Suspense,{fallback:t.jsx(ut,{children:"Loading Model page..."}),children:t.jsx(Fs,{model:D})})}),k(f==null?void 0:f.row_diff)&&t.jsx(I.Panel,{unmount:!1,className:b("w-full h-full ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2 py-2"),children:t.jsx(ks,{diff:f},e.id)}),o&&t.jsx(I.Panel,{unmount:!1,className:"w-full h-full ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2 py-2",children:t.jsx("ul",{className:"w-full h-full p-2 overflow-auto hover:scrollbar scrollbar--vertical scrollbar--horizontal",children:Array.from(l).reverse().map(x=>t.jsx("li",{className:"bg-danger-10 mb-4 last:m-0 p-2 rounded-md",children:t.jsx(Dt,{scope:x.key,error:x})},x.id))})})]})]},e.id)})}const ve=32,_s=2;function Oe(){const e=N(s=>s.tab);return t.jsxs("div",{className:"w-full h-full flex flex-col overflow-hidden",children:[t.jsx(hs,{}),t.jsx(ae,{}),Q(e)?t.jsx($e,{}):t.jsx(tt,{tab:e})]})}function $e(){return t.jsx("div",{className:"flex justify-center items-center w-full h-full",children:t.jsx("div",{className:"p-4 text-center text-theme-darker dark:text-theme-lighter",children:t.jsx("h2",{className:"text-3xl",children:"Select File or Add New SQL Tab"})})})}function tt({tab:e}){const{errors:s,addError:l,removeError:n}=Ye(),i=R(h=>h.environment),r=R(h=>h.models),c=R(h=>h.isModel),d=ee(h=>h.files),p=ee(h=>h.selectedFile),a=ee(h=>h.setSelectedFile),f=N(h=>h.direction),g=N(h=>h.engine),P=N(h=>h.previewTable),m=N(h=>h.previewDiff),v=N(h=>h.refreshTab),D=N(h=>h.updateStoredTabsIds),j=N(h=>h.setPreviewQuery),o=N(h=>h.setPreviewTable),y=N(h=>h.setPreviewDiff),x=N(h=>h.setDialects),{setManuallySelectedColumn:S}=St(),q=u.useCallback(function(h){a(d.get(h.path))},[d]),Z=u.useCallback(function(h,_){S([h,_])},[]),X=Ct(),te=Xe(e.file.path,q,Z),[C,w]=u.useState(!1),M=u.useMemo(()=>[...X,{key:"Mod-Enter",win:"Ctrl-Enter",preventDefault:!0,stopPropagation:!0,run(h){const _=h.state.doc.toString();o(void 0),j(_);for(const H of s)H.key===$.Fetchdf&&n(H);return mt({sql:_}).then(H=>{o(Fe(H))}).catch(H=>{l($.Fetchdf,{...H,errorKey:$.Fetchdf,trigger:"Editor -> customSQLKeymaps",message:H.message,timestamp:Date.now(),origin:"useQueryTimeout"})}),!0}}],[X,s]);u.useEffect(()=>{w(!1),Q(p)&&a(e==null?void 0:e.file)},[e.id]),u.useEffect(()=>(g.addEventListener("message",pe),()=>{g.removeEventListener("message",pe)}),[e.id,e.dialect]),u.useEffect(()=>{j(void 0),o(void 0),y(void 0),D()},[e.id,e.file.fingerprint]),u.useEffect(()=>{y(void 0)},[i]);function se(){const h=r.get(e.file.path),_=F(e.file.isEmpty)&&k(h)&&c(e.file.path);return s.size>0||[P,m].some(Boolean)||_?[70,30]:[100,0]}function Ee(){const h=r.get(e==null?void 0:e.file.path);return C&&(k(h)&&c(e.file.path)||e.file.isLocal)&&F(de(e.file.content))?[70,30]:[100,0]}function oe(h){e.file.content=h,v(e)}function pe(h){if(h.data.topic==="dialects"){const _=r.get(e.file.path);e.dialect=(_==null?void 0:_.dialect)??e.dialect??"",x(h.data.payload),v(e)}if(h.data.topic==="format"){if(de(h.data.payload))return;e.file.content=h.data.payload,v(e)}}return t.jsxs(We,{className:b("w-full h-full overflow-hidden",f==="vertical"?"flex flex-col":"flex"),sizes:se(),direction:f,minSize:[ve,0],snapOffset:0,children:[t.jsxs("div",{className:b("flex flex-col",f==="vertical"?"w-full ":"h-full"),children:[t.jsxs(We,{className:"flex h-full overflow-hidden",sizes:Ee(),minSize:ve,snapOffset:ve,handleDrag:(h,_)=>{const st=_.parent.getBoundingClientRect().width*(h[1]??0)/100;w(st>=ve+_s)},children:[t.jsxs("div",{className:"flex flex-col h-full",children:[e.file.isLocal&&t.jsx(Re,{type:J.SQL,dialect:e.dialect,keymaps:M,content:e.file.content,extensions:te,onChange:oe}),e.file.isRemote&&t.jsx(kt,{keymaps:X,path:e.file.path,children:({file:h,keymaps:_})=>t.jsx(Re,{type:h.extension,dialect:e.dialect,extensions:te,keymaps:_,content:h.content,onChange:oe})})]}),t.jsx("div",{className:"flex flex-col h-full",children:t.jsx(gs,{tab:e,toggle:()=>w(h=>!h),isOpen:C})})]},e.id),t.jsx(ae,{}),t.jsx(ms,{tab:e},e.file.fingerprint)]}),t.jsx(Ms,{tab:e,className:b(f==="vertical"?"flex flex-col":"flex")})]},f)}Oe.Empty=$e;Oe.Loading=$e;Oe.Main=tt;export{Oe as default};
1
+ import{r as u,R as ne,h as Ie,j as t,i as k,c as b,w as Q,g as lt,b as F,a as R,m as E,J as de,B as z,n as L,Q as Pe,a5 as Qe,a6 as nt,a7 as rt,I as ae,S as Ne,al as qe,am as at,d as Ye,t as ot,e as it,s as ct,G as $,F as dt,a8 as ut,_ as ft,an as mt}from"./index-Dqo42q_-.js";import{u as ee,M as xt}from"./project-DHnuzhZ_.js";import{S as We}from"./SplitPane-Bec3_12u.js";import{E as J,M as ht}from"./file-DIuTD7Ex.js";import{u as N}from"./editor-D99craz3.js";import{I as T}from"./Input-C5uXc-nB.js";import{F as pt,L as gt}from"./ListboxShow-DvjSHd_L.js";import{B as Be}from"./Banner-CIGf1CgX.js";import{f as bt,b as Ve,c as vt,U as ue,I as Ze,y as fe,i as je,o as K,N as ge,G as jt,z as W,O as le,M as B,u as ce,t as wt,T as Nt,C as me,R as be,P as ie,x as Ge}from"./transition-BpitCk1w.js";import{g as Fe,G as yt,F as Tt,T as Et}from"./help-5fQwnZLr.js";import{M as Pt,u as Xe,a as Re,b as St,c as Ct,C as kt}from"./context-CDuVFxib.js";import{A as Se,F as It,a as Rt}from"./PlusCircleIcon-rlJbTzSO.js";import{D as Dt}from"./ReportErrors-DTvhPb_i.js";import"./index-DZbqZ0F2.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./help-6Q7f7fjd.js";import"./SourceList-B0glAf8v.js";function Ft({onFocus:e}){let[s,l]=u.useState(!0),n=bt();return s?ne.createElement(Ve,{as:"button",type:"button",features:vt.Focusable,onFocus:i=>{i.preventDefault();let r,c=50;function d(){if(c--<=0){r&&cancelAnimationFrame(r);return}if(e()){if(cancelAnimationFrame(r),!n.current)return;l(!1);return}r=requestAnimationFrame(d)}r=requestAnimationFrame(d)}}):null}const Je=u.createContext(null);function Mt(){return{groups:new Map,get(e,s){var l;let n=this.groups.get(e);n||(n=new Map,this.groups.set(e,n));let i=(l=n.get(s))!=null?l:0;n.set(s,i+1);let r=Array.from(n.keys()).indexOf(s);function c(){let d=n.get(s);d>1?n.set(s,d-1):n.delete(s)}return[r,c]}}}function _t({children:e}){let s=u.useRef(Mt());return u.createElement(Je.Provider,{value:s},e)}function Ke(e){let s=u.useContext(Je);if(!s)throw new Error("You must wrap your component in a <StableCollection>");let l=Lt(),[n,i]=s.current.get(e,l);return u.useEffect(()=>i,[]),n}function Lt(){var e,s,l;let n=(l=(s=(e=u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==null?void 0:e.ReactCurrentOwner)==null?void 0:s.current)!=null?l:null;if(!n)return Symbol();let i=[],r=n;for(;r;)i.push(r.index),r=r.return;return"$."+i.join(".")}var At=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(At||{}),zt=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(zt||{}),Ot=(e=>(e[e.SetSelectedIndex=0]="SetSelectedIndex",e[e.RegisterTab=1]="RegisterTab",e[e.UnregisterTab=2]="UnregisterTab",e[e.RegisterPanel=3]="RegisterPanel",e[e.UnregisterPanel=4]="UnregisterPanel",e))(Ot||{});let $t={0(e,s){var l;let n=ie(e.tabs,f=>f.current),i=ie(e.panels,f=>f.current),r=n.filter(f=>{var g;return!((g=f.current)!=null&&g.hasAttribute("disabled"))}),c={...e,tabs:n,panels:i};if(s.index<0||s.index>n.length-1){let f=ce(Math.sign(s.index-e.selectedIndex),{[-1]:()=>1,0:()=>ce(Math.sign(s.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(r.length===0)return c;let g=ce(f,{0:()=>n.indexOf(r[0]),1:()=>n.indexOf(r[r.length-1])});return{...c,selectedIndex:g===-1?e.selectedIndex:g}}let d=n.slice(0,s.index),p=[...n.slice(s.index),...d].find(f=>r.includes(f));if(!p)return c;let a=(l=n.indexOf(p))!=null?l:e.selectedIndex;return a===-1&&(a=e.selectedIndex),{...c,selectedIndex:a}},1(e,s){if(e.tabs.includes(s.tab))return e;let l=e.tabs[e.selectedIndex],n=ie([...e.tabs,s.tab],r=>r.current),i=e.selectedIndex;return e.info.current.isControlled||(i=n.indexOf(l),i===-1&&(i=e.selectedIndex)),{...e,tabs:n,selectedIndex:i}},2(e,s){return{...e,tabs:e.tabs.filter(l=>l!==s.tab)}},3(e,s){return e.panels.includes(s.panel)?e:{...e,panels:ie([...e.panels,s.panel],l=>l.current)}},4(e,s){return{...e,panels:e.panels.filter(l=>l!==s.panel)}}},Me=u.createContext(null);Me.displayName="TabsDataContext";function re(e){let s=u.useContext(Me);if(s===null){let l=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,re),l}return s}let _e=u.createContext(null);_e.displayName="TabsActionsContext";function Le(e){let s=u.useContext(_e);if(s===null){let l=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,Le),l}return s}function Qt(e,s){return ce(s.type,$t,e,s)}let Wt=u.Fragment;function Bt(e,s){let{defaultIndex:l=0,vertical:n=!1,manual:i=!1,onChange:r,selectedIndex:c=null,...d}=e;const p=n?"vertical":"horizontal",a=i?"manual":"auto";let f=c!==null,g=be({isControlled:f}),P=fe(s),[m,v]=u.useReducer(Qt,{info:g,selectedIndex:c??l,tabs:[],panels:[]}),D=u.useMemo(()=>({selectedIndex:m.selectedIndex}),[m.selectedIndex]),j=be(r||(()=>{})),o=be(m.tabs),y=u.useMemo(()=>({orientation:p,activation:a,...m}),[p,a,m]),x=K(C=>(v({type:1,tab:C}),()=>v({type:2,tab:C}))),S=K(C=>(v({type:3,panel:C}),()=>v({type:4,panel:C}))),q=K(C=>{Z.current!==C&&j.current(C),f||v({type:0,index:C})}),Z=be(f?e.selectedIndex:m.selectedIndex),X=u.useMemo(()=>({registerTab:x,registerPanel:S,change:q}),[]);je(()=>{v({type:0,index:c??l})},[c]),je(()=>{if(Z.current===void 0||m.tabs.length<=0)return;let C=ie(m.tabs,w=>w.current);C.some((w,M)=>m.tabs[M]!==w)&&q(C.indexOf(m.tabs[Z.current]))});let te={ref:P};return ne.createElement(_t,null,ne.createElement(_e.Provider,{value:X},ne.createElement(Me.Provider,{value:y},y.tabs.length<=0&&ne.createElement(Ft,{onFocus:()=>{var C,w;for(let M of o.current)if(((C=M.current)==null?void 0:C.tabIndex)===0)return(w=M.current)==null||w.focus(),!0;return!1}}),me({ourProps:te,theirProps:d,slot:D,defaultTag:Wt,name:"Tabs"}))))}let Gt="div";function Ht(e,s){let{orientation:l,selectedIndex:n}=re("Tab.List"),i=fe(s);return me({ourProps:{ref:i,role:"tablist","aria-orientation":l},theirProps:e,slot:{selectedIndex:n},defaultTag:Gt,name:"Tabs.List"})}let Ut="button";function qt(e,s){var l,n;let i=Ze(),{id:r=`headlessui-tabs-tab-${i}`,...c}=e,{orientation:d,activation:p,selectedIndex:a,tabs:f,panels:g}=re("Tab"),P=Le("Tab"),m=re("Tab"),v=u.useRef(null),D=fe(v,s);je(()=>P.registerTab(v),[P,v]);let j=Ke("tabs"),o=f.indexOf(v);o===-1&&(o=j);let y=o===a,x=K(w=>{var M;let se=w();if(se===ge.Success&&p==="auto"){let Ee=(M=jt(v))==null?void 0:M.activeElement,oe=m.tabs.findIndex(pe=>pe.current===Ee);oe!==-1&&P.change(oe)}return se}),S=K(w=>{let M=f.map(se=>se.current).filter(Boolean);if(w.key===W.Space||w.key===W.Enter){w.preventDefault(),w.stopPropagation(),P.change(o);return}switch(w.key){case W.Home:case W.PageUp:return w.preventDefault(),w.stopPropagation(),x(()=>le(M,B.First));case W.End:case W.PageDown:return w.preventDefault(),w.stopPropagation(),x(()=>le(M,B.Last))}if(x(()=>ce(d,{vertical(){return w.key===W.ArrowUp?le(M,B.Previous|B.WrapAround):w.key===W.ArrowDown?le(M,B.Next|B.WrapAround):ge.Error},horizontal(){return w.key===W.ArrowLeft?le(M,B.Previous|B.WrapAround):w.key===W.ArrowRight?le(M,B.Next|B.WrapAround):ge.Error}}))===ge.Success)return w.preventDefault()}),q=u.useRef(!1),Z=K(()=>{var w;q.current||(q.current=!0,(w=v.current)==null||w.focus({preventScroll:!0}),P.change(o),wt(()=>{q.current=!1}))}),X=K(w=>{w.preventDefault()}),te=u.useMemo(()=>{var w;return{selected:y,disabled:(w=e.disabled)!=null?w:!1}},[y,e.disabled]),C={ref:D,onKeyDown:S,onMouseDown:X,onClick:Z,id:r,role:"tab",type:Nt(e,v),"aria-controls":(n=(l=g[o])==null?void 0:l.current)==null?void 0:n.id,"aria-selected":y,tabIndex:y?0:-1};return me({ourProps:C,theirProps:c,slot:te,defaultTag:Ut,name:"Tabs.Tab"})}let Yt="div";function Vt(e,s){let{selectedIndex:l}=re("Tab.Panels"),n=fe(s),i=u.useMemo(()=>({selectedIndex:l}),[l]);return me({ourProps:{ref:n},theirProps:e,slot:i,defaultTag:Yt,name:"Tabs.Panels"})}let Zt="div",Xt=Ge.RenderStrategy|Ge.Static;function Jt(e,s){var l,n,i,r;let c=Ze(),{id:d=`headlessui-tabs-panel-${c}`,tabIndex:p=0,...a}=e,{selectedIndex:f,tabs:g,panels:P}=re("Tab.Panel"),m=Le("Tab.Panel"),v=u.useRef(null),D=fe(v,s);je(()=>m.registerPanel(v),[m,v,d]);let j=Ke("panels"),o=P.indexOf(v);o===-1&&(o=j);let y=o===f,x=u.useMemo(()=>({selected:y}),[y]),S={ref:D,id:d,role:"tabpanel","aria-labelledby":(n=(l=g[o])==null?void 0:l.current)==null?void 0:n.id,tabIndex:y?p:-1};return!y&&((i=a.unmount)==null||i)&&!((r=a.static)!=null&&r)?ne.createElement(Ve,{as:"span","aria-hidden":"true",...S}):me({ourProps:S,theirProps:a,slot:x,defaultTag:Zt,features:Xt,visible:y,name:"Tabs.Panel"})}let Kt=ue(qt),es=ue(Bt),ts=ue(Ht),ss=ue(Vt),ls=ue(Jt),I=Object.assign(Kt,{Group:es,List:ts,Panels:ss,Panel:ls});function ns({title:e,titleId:s,...l},n){return u.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":s},l),e?u.createElement("title",{id:s},e):null,u.createElement("path",{fillRule:"evenodd",d:"M3 6.75A.75.75 0 0 1 3.75 6h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 6.75ZM3 12a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75A.75.75 0 0 1 3 12Zm0 5.25a.75.75 0 0 1 .75-.75h16.5a.75.75 0 0 1 0 1.5H3.75a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"}))}const et=u.forwardRef(ns);function rs({title:e,titleId:s,...l},n){return u.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":s},l),e?u.createElement("title",{id:s},e):null,u.createElement("path",{fillRule:"evenodd",d:"M12 3.75a.75.75 0 0 1 .75.75v6.75h6.75a.75.75 0 0 1 0 1.5h-6.75v6.75a.75.75 0 0 1-1.5 0v-6.75H4.5a.75.75 0 0 1 0-1.5h6.75V4.5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"}))}const as=u.forwardRef(rs);function os({title:e,titleId:s,...l},n){return u.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":s},l),e?u.createElement("title",{id:s},e):null,u.createElement("path",{d:"M15 3.75H9v16.5h6V3.75ZM16.5 20.25h3.375c1.035 0 1.875-.84 1.875-1.875V5.625c0-1.036-.84-1.875-1.875-1.875H16.5v16.5ZM4.125 3.75H7.5v16.5H4.125a1.875 1.875 0 0 1-1.875-1.875V5.625c0-1.036.84-1.875 1.875-1.875Z"}))}const is=u.forwardRef(os);function cs(e){switch(e){case J.SQL:return"SQL";case J.PY:return"Python";case J.YAML:case J.YML:return"YAML";default:return"Plain Text"}}function ds(e,s){return e.file.extension===J.SQL&&e.file.isLocal&&Ie(s)}const A=function({text:s,children:l,className:n}){return t.jsxs("small",{className:b("font-bold whitespace-nowrap text-xs",n),children:[k(s)&&t.jsxs("span",{children:[s,": "]}),l]})};function us({text:e,className:s}){return t.jsx("span",{className:b("font-normal",s),children:e})}function fs({ok:e,className:s}){return t.jsx("span",{className:b("inline-block w-2 h-2 rounded-full",Q(e)&&"bg-warning-500",lt(e)&&"bg-success-500",F(e)&&"bg-danger-500",s)})}A.Text=us;A.Light=fs;const O={Model:"model",Test:"test",Macro:"macro",Hook:"hook",Log:"log",Config:"config",Seed:"seed",Metric:"metric",Schema:"schema",Unknown:"unknown"};function ms({tab:e}){const s=R(c=>c.isModel),l=N(c=>c.engine),n=N(c=>c.dialects),i=N(c=>c.refreshTab);u.useEffect(()=>{var d;const c=(d=n[0])==null?void 0:d.dialect_name;Q(e.dialect)&&k(c)&&r(c)},[n,e]);function r(c){e.dialect=c,i(e),l.postMessage({topic:"dialect",payload:e.dialect})}return t.jsxs("div",{className:"flex w-full items-center px-2 min-h-[2rem] overflow-hidden",children:[e.file.isRemote&&t.jsx(A,{className:"mr-2",text:"Saved",children:t.jsx(A.Light,{ok:F(e.file.isChanged)})}),e.file.isRemote&&e.file.isSQL&&t.jsx(A,{className:"mr-2",text:"Formatted",children:t.jsx(A.Light,{ok:e.file.isFormatted})}),t.jsx(A,{className:"mr-2",text:"Language",children:t.jsx(A.Text,{text:cs(e.file.extension)})}),ds(e,n)&&t.jsx(A,{className:"mr-2",text:"Dialect",children:t.jsx(T,{size:E.sm,children:({className:c,size:d})=>t.jsx(T.Selector,{className:c,size:d,list:n.map(p=>({text:p.dialect_title,value:de(p.dialect_name)?"sqlglot":p.dialect_name})),onChange:r,value:e.dialect})})}),s(e.file.path)&&!de(e.dialect)&&t.jsx(A,{className:"mr-2",text:"Dialect",children:t.jsx(A.Text,{text:e.dialect})}),t.jsx(A,{className:"mr-2",text:"SQLMesh Type",children:t.jsx(A.Text,{text:xs(e.file.path)})})]})}function xs(e){return de(e)?O.Unknown:e.startsWith("models")?O.Model:e.startsWith("tests")?O.Test:e.startsWith("logs")?O.Log:e.startsWith("macros")?O.Macro:e.startsWith("hooks")?O.Hook:e.startsWith("seeds")?O.Seed:e.startsWith("metrics")?O.Metric:["config.yaml","config.yml","config.py"].includes(e)?O.Config:["external_models.yaml","schema.yaml"].includes(e)?O.Schema:O.Unknown}function He({tab:e,title:s}){const l=u.useRef(null),n=R(g=>g.addConfirmation),i=ee(g=>g.setSelectedFile),r=N(g=>g.closeTab),c=N(g=>g.tab),d=e.file.id===(c==null?void 0:c.file.id);return u.useEffect(()=>{Q(e)||(e.el=l.current??void 0)},[l,e]),u.useEffect(()=>{Q(c)||setTimeout(()=>{var g;(g=c.el)==null||g.scrollIntoView({behavior:"smooth",inline:"center"})},300)},[c]),t.jsx("li",{ref:l,className:b("inline-block py-1 pr-2 last-child:pr-0 overflow-hidden text-center overflow-ellipsis cursor-pointer"),onClick:p,children:t.jsxs("span",{className:b("flex border-2 justify-between items-center pl-1 pr-1 py-[0.125rem] min-w-[8rem] rounded-md group border-transparent border-r border-r-theme-darker dark:border-r-theme-lighter",d?"bg-neutral-200 border-neutral-200 text-neutral-900 dark:bg-dark-lighter dark:border-dark-lighter dark:text-primary-500":"bg-trasparent hover:bg-theme-darker dark:hover:bg-theme-lighter"),children:[t.jsx("small",{className:"text-xs",children:s}),t.jsx("small",{className:b("group-hover:hidden text-xs inline-block ml-3 mr-1 w-2 h-2 rounded-full",e.file.isChanged?"bg-warning-500":"bg-transparent")}),t.jsx(pt,{className:"hidden group-hover:inline-block text-neutral-600 dark:text-neutral-100 w-4 h-4 ml-2 mr-0 cursor-pointer",onClick:a})]})});function p(g){g.stopPropagation(),i(e.file)}function a(g){g.stopPropagation(),f()}function f(){e.file.isChanged?n({headline:"Closing Tab",description:"All unsaved changes will be lost. Do you want to close the tab anyway?",yesText:"Yes, Close Tab",noText:"No, Cancel",action:()=>r(e.file)}):r(e.file)}}function hs(){const e=R(o=>o.modules),s=R(o=>o.models),l=R(o=>o.lastSelectedModel),n=R(o=>o.setLastSelectedModel),i=ee(o=>o.files),r=ee(o=>o.selectedFile),c=ee(o=>o.setSelectedFile),d=N(o=>o.tab),p=N(o=>o.tabs),a=N(o=>o.replaceTab),f=N(o=>o.createTab),g=N(o=>o.selectTab),P=N(o=>o.addTab),[m,v]=u.useMemo(()=>{const o=[],y=[];return p.forEach(x=>{x.file.isLocal&&o.push(x),x.file.isRemote&&y.push(x)}),[o,y]},[p]);return u.useEffect(()=>{if(Q(r)||(d==null?void 0:d.file)===r||r instanceof xt||F(e.hasFiles))return;n(s.get(r.path));const o=f(r);k(d)&&d.file instanceof ht&&F(d.file.isChanged)&&d.file.isRemote&&F(p.has(r))?a(d,o):P(o),g(o)},[r,e]),u.useEffect(()=>{if(Q(l))return;const o=i.get(l.path);Q(o)||c(o)},[l]),t.jsxs("div",{className:"flex items-center bg-neutral-5",children:[t.jsx(z,{className:"h-6 m-0 ml-1 mr-2 border-none",variant:L.Alternative,size:E.sm,onClick:D,children:t.jsx(as,{className:"inline-block w-3 h-4"})}),t.jsxs("ul",{className:"w-full whitespace-nowrap min-h-[2rem] max-h-[2rem] overflow-hidden overflow-x-auto hover:scrollbar scrollbar--horizontal",children:[m.map((o,y)=>t.jsx(He,{tab:o,title:`Custom SQL ${y+1}`},o.id)),v.map(o=>t.jsx(He,{tab:o,title:o.file.name},o.id))]})]});function D(o){o.stopPropagation(),j()}function j(){const o=f();P(o),g(o),c(o.file)}}function Ae({list:e,children:s=[],className:l,disabled:n=!1}){return t.jsxs(I.List,{className:b("w-full whitespace-nowrap px-2 flex justify-center items-center",n&&"cursor-not-allowed"),children:[t.jsx("div",{className:b("flex w-full overflow-hidden overflow-x-auto py-1 hover:scrollbar scrollbar--horizontal",l,n&&"opacity-50 pointer-events-none"),children:t.jsx("div",{className:"flex p-1 items-center bg-secondary-10 dark:bg-primary-10 cursor-pointer rounded-full overflow-hidden",children:e.map(i=>t.jsx(I,{className:({selected:r})=>b("text-xs px-2 py-0.5 mr-2 last:mr-0 rounded-full relative align-middle",r?"bg-secondary-500 text-secondary-100 cursor-default font-bold":"cursor-pointer font-medium text-secondary-400 dark:text-secondary-400"),children:i},i))})}),s]})}const Ue=24*60*60*1e3,ps=1e3,we=50;function gs({tab:e,isOpen:s=!0,toggle:l}){const n=R(c=>c.models),i=R(c=>c.isModel),r=u.useMemo(()=>n.get(e.file.path),[e,n]);return t.jsx("div",{className:b("flex flex-col w-full h-full items-center overflow-hidden"),children:i(e.file.path)?k(r)&&t.jsx(bs,{tab:e,model:r,isOpen:s,toggle:l}):t.jsx(vs,{tab:e,isOpen:s,toggle:l})})}function bs({tab:e,model:s,isOpen:l=!0,toggle:n}){const i=R(d=>d.environment),r=R(d=>d.environments),c=Array.from(r).filter(({isRemote:d})=>d).map(({name:d})=>({text:d,value:d}));return t.jsxs(I.Group,{children:[t.jsxs("div",{className:"flex w-full items-center",children:[t.jsx(z,{className:b("h-6 w-6 !px-0 border-none bg-neutral-10 dark:bg-neutral-20",l?"text-secondary-500 dark:text-secondary-300":"text-neutral-500 dark:text-neutral-300"),variant:L.Info,size:E.sm,onClick:d=>{d.stopPropagation(),n==null||n()},children:t.jsx(et,{className:"w-4 h-4"})}),l&&t.jsx(Ae,{className:"flex justify-center items-center",list:["Evaluate","Columns",c.length>1&&i.isRemote&&"Diff"].filter(Boolean)})]}),l&&t.jsxs(I.Panels,{className:"h-full w-full overflow-hidden",children:[t.jsx(I.Panel,{unmount:!1,className:b("flex flex-col w-full h-full relative overflow-hidden","ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2"),children:t.jsx(Ns,{model:s})}),t.jsx(I.Panel,{unmount:!1,className:"text-xs w-full h-full ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2 px-2",children:t.jsx(Pt,{nodeId:s.fqn,columns:s.columns,disabled:F(s.isModelSQL),withHandles:!1,withSource:!1,withDescription:!0,limit:10})}),c.length>1&&i.isRemote&&t.jsx(I.Panel,{unmount:!1,className:b("flex flex-col w-full h-full relative overflow-hidden","ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2"),children:t.jsx(ys,{tab:e,model:s,list:c.filter(({value:d})=>i.name!==d),target:{text:i.name,value:i.name}})})]})]})}function vs({tab:e,isOpen:s=!0,toggle:l}){return t.jsxs(I.Group,{children:[t.jsxs("div",{className:"flex w-full items-center",children:[t.jsx(z,{className:b("h-6 w-6 !px-0 border-none bg-neutral-10 dark:bg-neutral-20",s?"text-secondary-500 dark:text-secondary-300":"text-neutral-500 dark:text-neutral-300"),variant:L.Info,size:E.sm,onClick:n=>{n.stopPropagation(),l==null||l()},children:t.jsx(et,{className:"w-4 h-4"})}),s&&t.jsx(Ae,{className:"flex justify-center items-center",list:["Run Query","Diff"]})]}),s&&t.jsxs(I.Panels,{className:"h-full w-full overflow-hidden",children:[t.jsx(I.Panel,{unmount:!1,className:b("flex flex-col w-full h-full relative overflow-hidden","ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2"),children:t.jsx(ws,{tab:e})}),t.jsx(I.Panel,{unmount:!1,className:b("flex flex-col w-full h-full relative overflow-hidden","ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2"),children:t.jsx(Ts,{})})]})]})}function js({children:e}){return t.jsx("fieldset",{className:"flex my-3",children:e})}function ye({children:e}){return t.jsx("div",{className:"flex w-full h-full py-1 overflow-hidden overflow-y-auto hover:scrollbar scrollbar--vertical",children:e})}function Te({children:e}){return t.jsx("div",{className:"flex w-full py-1 px-1 justify-end",children:e})}function ws({tab:e}){const s=N(p=>p.setPreviewQuery),l=N(p=>p.setPreviewTable),n=N(p=>p.engine),{refetch:i,isFetching:r,cancel:c}=at({sql:e.file.content});u.useEffect(()=>()=>{c()},[]);function d(){l(void 0),s(e.file.content),i().then(({data:p})=>{l(Fe(p))})}return t.jsxs(t.Fragment,{children:[t.jsx(ye,{}),t.jsx(ae,{}),t.jsxs(Te,{children:[t.jsx(z,{size:E.sm,variant:L.Alternative,onClick:p=>{p.stopPropagation(),n.postMessage({topic:"format",payload:{sql:e.file.content,dialect:e.dialect}})},children:"Format"}),r?t.jsxs("div",{className:"flex items-center",children:[t.jsx(Ne,{className:"w-3"}),t.jsx("small",{className:"text-xs text-neutral-400 block mx-2",children:"Running Query..."}),t.jsx(z,{size:E.sm,variant:L.Danger,onClick:p=>{p.stopPropagation(),c()},children:"Cancel"})]}):t.jsx(z,{size:E.sm,variant:L.Alternative,disabled:r,onClick:p=>{p.stopPropagation(),d()},children:"Run Query"})]})]})}function Ns({model:e}){const s=R(m=>m.environment),l=R(m=>m.isModel),n=N(m=>m.setPreviewQuery),i=N(m=>m.setPreviewTable),[r,c]=u.useState({model:e.displayName,start:Pe(Qe(Date.now()-Ue)),end:Pe(new Date),execution_time:Pe(Qe(Date.now()-Ue)),limit:1e3}),{refetch:d}=nt({model:r.model,start:r.start,end:r.end,execution_time:r.execution_time,dialect:e.dialect,pretty:!0}),{refetch:p,isFetching:a,cancel:f}=rt(r),g=l(e.path)&&Object.values(r).every(Boolean);u.useEffect(()=>()=>{f()},[]);function P(){n(void 0),i(void 0),d().then(({data:m})=>{n(m==null?void 0:m.sql)}),p().then(({data:m})=>{i(Fe(m))})}return t.jsxs(t.Fragment,{children:[t.jsx(ye,{children:t.jsxs("form",{className:"w-full",children:[F(g)&&t.jsx(js,{children:t.jsx(Be,{variant:L.Warning,children:t.jsxs(Be.Description,{className:"w-full mr-2 text-sm",children:["Please fill out all fields to ",t.jsx("b",{children:"evaluate the model"}),"."]})})}),t.jsxs("fieldset",{className:"px-2 w-full text-neutral-500",children:[t.jsx(T,{className:"w-full mx-0",label:"Start Date",size:E.sm,children:({className:m})=>t.jsx(T.Textfield,{className:b(m,"w-full"),placeholder:"02/11/2023",value:r.start,onInput:v=>{v.stopPropagation(),c({...r,start:v.target.value??""})}})}),t.jsx(T,{className:"w-full mx-0",label:"End Date",size:E.sm,children:({className:m})=>t.jsx(T.Textfield,{className:b(m,"w-full"),placeholder:"02/13/2023",value:r.end,onInput:v=>{v.stopPropagation(),c({...r,end:v.target.value??""})}})}),t.jsx(T,{className:"w-full mx-0",label:"Execution Time",size:E.sm,children:({className:m})=>t.jsx(T.Textfield,{className:b(m,"w-full"),placeholder:"02/13/2023",value:r.execution_time,onInput:v=>{v.stopPropagation(),c({...r,execution_time:v.target.value??""})}})}),k(r.limit)&&t.jsx(T,{className:"w-full mx-0",label:"Limit",size:E.sm,children:({className:m})=>t.jsx(T.Textfield,{className:b(m,"w-full"),type:"number",placeholder:"1000",value:r.limit,onInput:v=>{v.stopPropagation(),c({...r,limit:v.target.valueAsNumber??ps})}})})]})]})}),t.jsx(ae,{}),t.jsx(Te,{children:t.jsx("div",{className:"flex w-full justify-end",children:l(e.path)&&a?t.jsxs("div",{className:"flex items-center",children:[t.jsx(Ne,{className:"w-3"}),t.jsx("small",{className:"text-xs text-neutral-400 block mx-2",children:"Evaluating..."}),t.jsx(z,{size:E.sm,variant:L.Danger,onClick:m=>{m.stopPropagation(),f()},children:"Cancel"})]}):t.jsx(z,{size:E.sm,variant:L.Alternative,disabled:F(g)||a||s.isInitialProd,onClick:m=>{m.stopPropagation(),P()},children:"Evaluate"})})})]})}function ys({tab:e,model:s,list:l,target:n}){const i=R(x=>x.isModel),r=N(x=>x.setPreviewDiff),[c,d]=u.useState(l[0].value),[p,a]=u.useState(we),[f,g]=u.useState(""),[P,m]=u.useState(""),{refetch:v,isFetching:D,cancel:j}=qe({source:c,target:n.value,model_or_snapshot:s.name,limit:p,on:f,where:P}),o=u.useCallback(()=>{r(void 0),v().then(({data:x})=>{r(x)})},[s.name,s.hash]);u.useEffect(()=>()=>{j()},[]),u.useEffect(()=>{d(l[0].value)},[l]);const y=i(e.file.path)&&[c,n,p].every(Boolean);return t.jsxs(t.Fragment,{children:[t.jsx(ye,{children:t.jsx("form",{className:"w-full",children:t.jsxs("fieldset",{className:"px-2 w-full text-neutral-500",children:[t.jsx(T,{className:"w-full mx-0",label:"Source",disabled:l.length<2,size:E.sm,children:({disabled:x,className:S})=>t.jsx(T.Selector,{className:b(S,"w-full"),list:l,value:c,disabled:x,onChange:d})}),t.jsx(T,{className:"w-full mx-0",label:"Target",disabled:!0,children:({disabled:x,className:S})=>t.jsx(T.Textfield,{className:b(S,"w-full"),disabled:x,value:n.value})}),t.jsx(T,{className:"w-full mx-0",label:"Limit",size:E.sm,children:({className:x})=>t.jsx(T.Textfield,{className:b(x,"w-full"),type:"number",placeholder:"1000",value:p,onInput:S=>{S.stopPropagation(),a(S.target.valueAsNumber??we)}})}),t.jsx(T,{className:"w-full mx-0",label:"ON",size:E.sm,children:({className:x})=>t.jsx(T.Textfield,{className:b(x,"w-full"),placeholder:"s.id = t.id",value:f,onInput:S=>{S.stopPropagation(),g(S.target.value)}})}),t.jsx(T,{className:"w-full mx-0",label:"WHERE",size:E.sm,children:({className:x})=>t.jsx(T.Textfield,{className:b(x,"w-full"),placeholder:"id > 10",value:P,onInput:S=>{S.stopPropagation(),m(S.target.value)}})})]})})}),t.jsx(ae,{}),t.jsx(Te,{children:t.jsx("div",{className:"flex w-full justify-end items-center px-2",children:D?t.jsxs("div",{className:"flex items-center",children:[t.jsx(Ne,{className:"w-3"}),t.jsx("small",{className:"text-xs text-neutral-400 block mx-2",children:"Getting Diff..."}),t.jsx(z,{size:E.sm,variant:L.Danger,onClick:x=>{x.stopPropagation(),j()},children:"Cancel"})]}):t.jsx(z,{className:"ml-2",size:E.sm,variant:L.Alternative,disabled:F(y)||D,onClick:x=>{x.stopPropagation(),o()},children:"Get Diff"})})})]})}function Ts(){const e=N(j=>j.setPreviewDiff),[s,l]=u.useState(""),[n,i]=u.useState(""),[r,c]=u.useState(we),[d,p]=u.useState(""),[a,f]=u.useState(""),{refetch:g,isFetching:P,cancel:m}=qe({source:s,target:n,limit:r,on:d,where:a});u.useEffect(()=>()=>{m()},[]);function v(){e(void 0),g().then(({data:j})=>{e(j)})}const D=[s,n,r,d].every(Boolean);return t.jsxs(t.Fragment,{children:[t.jsx(ye,{children:t.jsx("form",{className:"w-full",children:t.jsxs("fieldset",{className:"px-2 w-full text-neutral-500",children:[t.jsx(T,{className:"w-full mx-0",label:"Source",size:E.sm,children:({className:j})=>t.jsx(T.Textfield,{className:b(j,"w-full"),placeholder:"exp.tst_model__dev",value:s,onInput:o=>{o.stopPropagation(),l(o.target.value)}})}),t.jsx(T,{className:"w-full mx-0",label:"Target",size:E.sm,children:({className:j})=>t.jsx(T.Textfield,{className:b(j,"w-full"),placeholder:"exp.tst_snapshot__1353336088",value:n,onInput:o=>{o.stopPropagation(),i(o.target.value)}})}),t.jsx(T,{className:"w-full mx-0",label:"Limit",size:E.sm,children:({className:j})=>t.jsx(T.Textfield,{className:b(j,"w-full"),type:"number",placeholder:"1000",value:r,onInput:o=>{o.stopPropagation(),c(o.target.valueAsNumber??we)}})}),t.jsx(T,{className:"w-full mx-0",label:"ON",size:E.sm,children:({className:j})=>t.jsx(T.Textfield,{className:b(j,"w-full"),placeholder:"s.id = t.id",value:d,onInput:o=>{o.stopPropagation(),p(o.target.value)}})}),t.jsx(T,{className:"w-full mx-0",label:"WHERE",size:E.sm,children:({className:j})=>t.jsx(T.Textfield,{className:b(j,"w-full"),placeholder:"id > 10",value:a,onInput:o=>{o.stopPropagation(),f(o.target.value)}})})]})})}),t.jsx(ae,{}),t.jsx(Te,{children:P?t.jsxs("div",{className:"flex items-center",children:[t.jsx(Ne,{className:"w-3"}),t.jsx("small",{className:"text-xs text-neutral-400 block mx-2",children:"Getting Diff..."}),t.jsx(z,{size:E.sm,variant:L.Danger,onClick:j=>{j.stopPropagation(),m()},children:"Cancel"})]}):t.jsx(z,{className:"ml-2",size:E.sm,variant:L.Alternative,disabled:F(D)||P,onClick:j=>{j.stopPropagation(),v()},children:"Get Diff"})})]})}const xe="s__",he="t__",ze="NULL";function Es({source_schema:e,target_schema:s},l,n){const i=Array.from(new Set(n.flat())),r=Object.keys(e),c=Object.keys(s),p=Array.from(new Set(r.concat(c))).filter(g=>r.includes(g)&&c.includes(g)),a=r.filter(g=>!c.includes(g)),f=c.filter(g=>!r.includes(g));return{all:Array.from(new Set([i,l.modifiedColumns&&p,l.addedColumns&&f,l.removedColumns&&a].filter(Boolean).flat())),added:f.length,deleted:a.length,modified:p.length-i.length}}function Ps(e,s,l){const n=Object.values(e.row_diff.sample)[0]??{},i=[],r=[],c=[];return Object.keys(n).forEach(d=>{V(e,d,l)?r.push(d):Y(e,d,l)?i.push(d):c.push(d)}),{all:[s.modifiedRows&&c,s.addedRows&&r,s.removedRows&&i].filter(Boolean).flat(),added:r.length,deleted:i.length,modified:c.length}}function De(e,s,l){const n=G(e,xe,s,l),i=G(e,he,s,l);return n!==i}function Y(e,s,l){return l.every(([n,i])=>{const r=G(e,xe,n,s),c=G(e,he,i,s);return k(r)&&Q(c)})}function V(e,s,l){return l.every(([n,i])=>{const r=G(e,xe,n,s),c=G(e,he,i,s);return Q(r)&&k(c)})}function Ce(e,s,l,n){return l in e.schema_diff.added||l in e.schema_diff.removed?!1:s.some(i=>F(V(e,i,n))&&F(Y(e,i,n))&&De(e,l,i))}function G(e,s,l,n){var i;return(i=e.row_diff.sample[`${s}${l}`])==null?void 0:i[n]}function Ss(e,s,l){return G(e,xe,s,l)??ze}function Cs(e,s,l){return G(e,he,s,l)??ze}function ks({diff:e}){const[s,l]=u.useState({modifiedRows:!0,addedRows:!0,removedRows:!0,modifiedColumns:!0,addedColumns:!0,removedColumns:!0}),n=Es(e.schema_diff,s,e.on),i=Ps(e,s,e.on),r=s.addedRows&&!s.removedRows&&!s.modifiedRows,c=!s.addedRows&&s.removedRows&&!s.modifiedRows,d=Array.from(new Set(e.on.flat())),p=Object.values(e.row_diff.sample).some(a=>Object.keys(a).length>0);return t.jsxs("div",{className:"px-2 h-full flex flex-col rounded-lg",children:[p&&t.jsxs(t.Fragment,{children:[t.jsx(Ds,{diff:e,rows:i,columns:n}),t.jsx("div",{className:"mt-2 mb-1 flex rounded-lg items-center",children:t.jsx("div",{className:"w-full flex justify-end items-center",children:t.jsx(gt,{options:Object.keys(s).reduce((a,f)=>(a[f]=g=>l(P=>({...P,[f]:g})),a),{}),value:Object.keys(s).map(a=>F(s[a])?void 0:a).filter(Boolean)})})})]}),t.jsx("div",{className:"overflow-auto h-full hover:scrollbar scrollbar--horizontal scrollbar--vertical",children:t.jsxs("table",{cellPadding:0,cellSpacing:0,className:"w-full text-xs text-neutral-600 dark:text-neutral-200 font-normal border-separate",children:[t.jsx("thead",{className:"sticky bg-theme top-0 z-10",children:t.jsx("tr",{children:n.all.map(a=>t.jsx("th",{colSpan:Ce(e,i.all,a,e.on)?2:1,className:b("text-left whitespace-nowrap py-1 px-2 font-bold",a in e.schema_diff.added?"border-t-2 border-l-2 border-r-2 border-success-500":a in e.schema_diff.removed?"border-t-2 border-l-2 border-r-2 border-danger-500":d.includes(a)?"border-brand-500 border-l-2 border-t-2 border-r-2":"border-r border-b border-neutral-100 dark:border-neutral-700 last:border-r-0",d.includes(a)?"bg-brand-10":"bg-neutral-5"),children:t.jsxs("div",{className:"flex justify-between",children:[t.jsxs("div",{className:"mr-2",children:[t.jsx("span",{children:a})," ",t.jsxs("small",{className:"text-neutral-500 font-medium",children:["(",e.schema_diff.source_schema[a]??e.schema_diff.target_schema[a],")"]})]}),F(d.includes(a))&&t.jsx("div",{className:"ml-2",children:t.jsxs("small",{className:"inline-block bg-neutral-10 px-2 py-0.5 rounded-full",children:[Math.round(i.all.filter(f=>De(e,a,f)).length/i.all.length*100),"%"]})})]})},a))})}),t.jsx("tbody",{children:Ie(i.all)?i.all.map(a=>t.jsx("tr",{children:n.all.map(f=>Ce(e,i.all,f,e.on)?t.jsxs(t.Fragment,{children:[t.jsx("td",{className:b("p-1 border-r border-b border-neutral-100 dark:border-neutral-700 last:border-r-0",V(e,a,e.on)&&"bg-success-10 text-success-500",Y(e,a,e.on)&&"bg-danger-5 text-danger-500"),children:t.jsx("div",{className:b("px-2 py-1 whitespace-nowrap font-bold rounded-md ",V(e,a,e.on)&&"bg-success-10 text-success-500",Y(e,a,e.on)&&"bg-danger-5 text-danger-500"),children:Ss(e,f,a)})},`${a}-${f}-source`),t.jsx("td",{className:b("p-1 border-r border-b border-neutral-100 dark:border-neutral-700 last:border-r-0",V(e,a,e.on)&&"bg-success-10 text-success-500",Y(e,a,e.on)&&"bg-danger-5 text-danger-500"),children:t.jsx("div",{className:b("px-2 py-1 whitespace-nowrap font-bold rounded-md",De(e,f,a)&&"bg-primary-10 text-primary-500",V(e,a,e.on)&&"!bg-success-10 !text-success-500",Y(e,a,e.on)&&"!bg-danger-5 !text-danger-500"),children:Cs(e,f,a)})},`${a}-${f}-target`)]}):t.jsx("td",{className:b("p-1",f in e.schema_diff.added?"bg-success-10 border-l-2 border-r-2 border-success-500 text-success-500 font-bold":f in e.schema_diff.removed?"bg-danger-5 border-l-2 border-r-2 border-danger-500 !text-danger-500 font-bold":d.includes(f)?"border-brand-500 border-l-2 border-r-2":"border-r border-b border-neutral-100 dark:border-neutral-700 last:border-r-0",Y(e,a,e.on)&&"!bg-danger-5 text-danger-500 font-bold",V(e,a,e.on)&&"bg-success-10 text-success-500 font-bold"),children:t.jsx("div",{className:b("px-2 py-1 whitespace-nowrap rounded-md",(f in e.schema_diff.added||V(e,a,e.on))&&"bg-success-10 text-success-500 font-bold",(f in e.schema_diff.removed||Y(e,a,e.on))&&"!bg-danger-5 !text-danger-500 font-bold"),children:G(e,xe,f,a)??G(e,he,f,a)??ze})},`${a}-${f}`))},a)):t.jsx(yt,{columns:n.all.length>0?n.all.length:void 0})}),Ie(i.all)&&t.jsx("tfoot",{className:"sticky bg-theme bottom-0",children:t.jsx("tr",{children:n.all.map(a=>Ce(e,i.all,a,e.on)?t.jsxs(t.Fragment,{children:[t.jsx("th",{className:b("text-left whitespace-nowrap px-2 py-1 border-r border-t border-neutral-100 dark:border-neutral-700 last:border-r-0",d.includes(a)?"bg-brand-10":"bg-neutral-10"),children:"Source"},`${a}-source`),t.jsx("th",{className:b("text-left whitespace-nowrap px-2 py-1 border-r border-t border-neutral-100 dark:border-neutral-700 last:border-r-0",d.includes(a)?"bg-brand-10":"bg-primary-10"),children:"Target"},`${a}-target`)]}):t.jsxs("th",{className:b("text-left whitespace-nowrap px-2 py-1 font-bold",a in e.schema_diff.added?"border-b-2 border-l-2 border-r-2 border-success-500":a in e.schema_diff.removed?"border-b-2 border-l-2 border-r-2 border-danger-500":d.includes(a)?"border-brand-500 border-l-2 border-b-2 border-r-2":"border-r border-t border-neutral-100 dark:border-neutral-700 last:border-r-0",d.includes(a)?"bg-brand-10":"bg-neutral-10"),children:[(a in e.schema_diff.removed||c)&&t.jsx("span",{children:"Source"}),(a in e.schema_diff.added||r)&&t.jsx("span",{children:"Target"})]},a))})})]})}),t.jsxs("div",{className:"flex justify-between items-center px-2 mt-2",children:[t.jsx(Tt,{count:i.all.length}),t.jsx(Is,{})]})]})}function Is(){const e=[["Grain","bg-brand-500"],["Changed","bg-primary-500"],["Added","bg-success-500"],["Deleted","bg-danger-500"]];return t.jsx("div",{className:"flex text-xs",children:e.map(([s="",l])=>t.jsx(Rs,{text:s,className:l},s))})}function Rs({text:e,className:s}){return t.jsxs("div",{className:"flex ml-2 items-center",children:[t.jsx("span",{className:b("inline-block w-3 h-3 mr-2 rounded-full",s)}),t.jsx("small",{className:"text-neutral-600 dark:text-neutral-400",children:e})]})}function Ds({diff:e,rows:s,columns:l}){return t.jsx(Se,{defaultOpen:!1,children:({open:n})=>t.jsxs(t.Fragment,{children:[t.jsxs(Se.Button,{className:"flex items-center w-full justify-between rounded-lg text-left text-sm px-4 pt-3 pb-2 bg-neutral-10 hover:bg-theme-darker dark:hover:bg-theme-lighter text-neutral-600 dark:text-neutral-400",children:[t.jsx("h2",{className:"whitespace-nowrap text-xl font-bold mb-1",children:"Stats"}),n?t.jsx(It,{className:"h-6 w-6 text-primary-500"}):t.jsx(Rt,{className:"h-6 w-6 text-primary-500"})]}),t.jsx(Se.Panel,{className:"px-4 pb-2 text-sm text-neutral-500",children:t.jsxs("div",{className:"p-2 grid grid-cols-3 gap-4 mb-3",children:[t.jsx(ke,{text:"Row Count Change",children:t.jsxs("p",{className:"text-6xl font-light text-primary-500 mt-3",children:[Math.round(Math.abs(e.row_diff.count_pct_change)),t.jsx("small",{className:"text-sm",children:"%"})]})}),t.jsxs(ke,{text:"Column Count Change",count:s.all.length,children:[t.jsx("p",{className:"text-center text-6xl font-light text-primary-500 mt-3",children:s.modified}),t.jsx("p",{className:"text-center text-6xl font-light text-success-500 mt-3",children:s.added}),t.jsx("p",{className:"text-center text-6xl font-light text-danger-500 mt-3",children:s.deleted})]}),t.jsxs(ke,{text:"Column Changes",count:l.all.length,children:[t.jsx("p",{className:"text-center text-6xl font-light text-primary-500 mt-3",children:l.modified}),t.jsx("p",{className:"text-center text-6xl font-light text-success-500 mt-3",children:l.added}),t.jsx("p",{className:"text-center text-6xl font-light text-danger-500 mt-3",children:l.deleted})]})]})})]})})}function ke({text:e,children:s,className:l,count:n}){return t.jsxs("div",{className:b("rounded-xl overflow-hidden px-3 py-6 bg-primary-10",l),children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("h3",{className:"text-neutral-500 dark:text-neutral-300 text-sm font-bold",children:e}),k(n)&&t.jsx("div",{children:t.jsx("small",{className:"inline-block px-2 py-0.5 bg-neutral-10 rounded-full",children:n})})]}),t.jsx("div",{className:"grid grid-cols-3 gap-2",children:s})]})}const Fs=u.lazy(async()=>await ft(()=>import("./ModelLineage-Vjinxl8m.js"),[])),U={Query:"Query",Table:"Data Preview",Lineage:"Lineage",Diff:"Diff",Errors:"Errors"};function Ms({tab:e,className:s}){const{errors:l,removeError:n}=Ye(),i=ot(),r=R(x=>x.models),c=R(x=>x.isModel),d=N(x=>x.direction),p=N(x=>x.previewQuery),a=N(x=>x.previewTable),f=N(x=>x.previewDiff),g=N(x=>x.setDirection),[P,m]=u.useState(-1),v=Xe(e.file.path,x=>{i(`${it.DataCatalogModels}/${x.name}`)}),D=r.get(e.file.path),j=F(e.file.isEmpty)&&k(D)&&c(e.file.path),o=l.size>0,y=u.useMemo(()=>[k(a)&&U.Table,k(p)&&e.file.isRemote&&U.Query,j&&U.Lineage,k(f)&&U.Diff,o&&U.Errors].filter(Boolean),[e.id,a,p,f,j,l,o]);return u.useEffect(()=>{k(a)?m(y.indexOf(U.Table)):m(0)},[a]),u.useEffect(()=>{k(f)?m(y.indexOf(U.Diff)):m(0)},[f]),u.useEffect(()=>{k(j)?m(y.indexOf(U.Lineage)):m(0)},[j]),u.useEffect(()=>{m(o?y.indexOf(U.Errors):0)},[o]),u.useEffect(()=>{for(const x of l)ct([$.Fetchdf,$.EvaluateModel,$.RenderQuery,$.ColumnLineage,$.ModelLineage,$.TableDiff,$.Table,$.SaveFile],x.key)&&n(x)},[a,f,p,j]),t.jsx("div",{className:b("w-full h-full flex flex-col text-prose overflow-auto hover:scrollbar scrollbar--vertical",s),children:dt(y)?t.jsx("div",{className:"flex justify-center items-center w-full h-full",children:t.jsx("h3",{className:"text-md",children:"No Data To Preview"})}):t.jsxs(I.Group,{onChange:m,selectedIndex:P,children:[t.jsx(Ae,{list:y,children:t.jsx("div",{className:"ml-2",children:t.jsx(z,{className:"!m-0 !py-0.5 px-[0.25rem] border-none",variant:L.Alternative,size:E.sm,onClick:()=>{g(d==="horizontal"?"vertical":"horizontal")},children:t.jsx(is,{"aria-label":d==="horizontal"?"Use vertical layout":"Use horizontal layout",className:"text-primary-500 w-5"})})})},y.join("-")),t.jsxs(I.Panels,{className:"h-full w-full overflow-hidden",children:[k(a)&&t.jsx(I.Panel,{unmount:!1,className:b("w-full h-full pt-4 relative px-2","ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2"),children:t.jsx(Et,{data:a})}),k(p)&&e.file.isRemote&&t.jsx(I.Panel,{unmount:!1,className:"w-full h-full ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2 p-2",children:t.jsx("div",{className:"w-full h-full p-2 bg-primary-10 rounded-lg overflow-auto hover:scrollbar scrollbar--horizontal scrollbar--vertical",children:t.jsx(Re,{type:J.SQL,content:p??"",extensions:v,className:"text-xs"})})}),j&&t.jsx(I.Panel,{unmount:!1,className:b("w-full h-full ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2"),children:t.jsx(u.Suspense,{fallback:t.jsx(ut,{children:"Loading Model page..."}),children:t.jsx(Fs,{model:D})})}),k(f==null?void 0:f.row_diff)&&t.jsx(I.Panel,{unmount:!1,className:b("w-full h-full ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2 py-2"),children:t.jsx(ks,{diff:f},e.id)}),o&&t.jsx(I.Panel,{unmount:!1,className:"w-full h-full ring-white ring-opacity-60 ring-offset-2 ring-offset-blue-400 focus:outline-none focus:ring-2 py-2",children:t.jsx("ul",{className:"w-full h-full p-2 overflow-auto hover:scrollbar scrollbar--vertical scrollbar--horizontal",children:Array.from(l).reverse().map(x=>t.jsx("li",{className:"bg-danger-10 mb-4 last:m-0 p-2 rounded-md",children:t.jsx(Dt,{scope:x.key,error:x})},x.id))})})]})]},e.id)})}const ve=32,_s=2;function Oe(){const e=N(s=>s.tab);return t.jsxs("div",{className:"w-full h-full flex flex-col overflow-hidden",children:[t.jsx(hs,{}),t.jsx(ae,{}),Q(e)?t.jsx($e,{}):t.jsx(tt,{tab:e})]})}function $e(){return t.jsx("div",{className:"flex justify-center items-center w-full h-full",children:t.jsx("div",{className:"p-4 text-center text-theme-darker dark:text-theme-lighter",children:t.jsx("h2",{className:"text-3xl",children:"Select File or Add New SQL Tab"})})})}function tt({tab:e}){const{errors:s,addError:l,removeError:n}=Ye(),i=R(h=>h.environment),r=R(h=>h.models),c=R(h=>h.isModel),d=ee(h=>h.files),p=ee(h=>h.selectedFile),a=ee(h=>h.setSelectedFile),f=N(h=>h.direction),g=N(h=>h.engine),P=N(h=>h.previewTable),m=N(h=>h.previewDiff),v=N(h=>h.refreshTab),D=N(h=>h.updateStoredTabsIds),j=N(h=>h.setPreviewQuery),o=N(h=>h.setPreviewTable),y=N(h=>h.setPreviewDiff),x=N(h=>h.setDialects),{setManuallySelectedColumn:S}=St(),q=u.useCallback(function(h){a(d.get(h.path))},[d]),Z=u.useCallback(function(h,_){S([h,_])},[]),X=Ct(),te=Xe(e.file.path,q,Z),[C,w]=u.useState(!1),M=u.useMemo(()=>[...X,{key:"Mod-Enter",win:"Ctrl-Enter",preventDefault:!0,stopPropagation:!0,run(h){const _=h.state.doc.toString();o(void 0),j(_);for(const H of s)H.key===$.Fetchdf&&n(H);return mt({sql:_}).then(H=>{o(Fe(H))}).catch(H=>{l($.Fetchdf,{...H,errorKey:$.Fetchdf,trigger:"Editor -> customSQLKeymaps",message:H.message,timestamp:Date.now(),origin:"useQueryTimeout"})}),!0}}],[X,s]);u.useEffect(()=>{w(!1),Q(p)&&a(e==null?void 0:e.file)},[e.id]),u.useEffect(()=>(g.addEventListener("message",pe),()=>{g.removeEventListener("message",pe)}),[e.id,e.dialect]),u.useEffect(()=>{j(void 0),o(void 0),y(void 0),D()},[e.id,e.file.fingerprint]),u.useEffect(()=>{y(void 0)},[i]);function se(){const h=r.get(e.file.path),_=F(e.file.isEmpty)&&k(h)&&c(e.file.path);return s.size>0||[P,m].some(Boolean)||_?[70,30]:[100,0]}function Ee(){const h=r.get(e==null?void 0:e.file.path);return C&&(k(h)&&c(e.file.path)||e.file.isLocal)&&F(de(e.file.content))?[70,30]:[100,0]}function oe(h){e.file.content=h,v(e)}function pe(h){if(h.data.topic==="dialects"){const _=r.get(e.file.path);e.dialect=(_==null?void 0:_.dialect)??e.dialect??"",x(h.data.payload),v(e)}if(h.data.topic==="format"){if(de(h.data.payload))return;e.file.content=h.data.payload,v(e)}}return t.jsxs(We,{className:b("w-full h-full overflow-hidden",f==="vertical"?"flex flex-col":"flex"),sizes:se(),direction:f,minSize:[ve,0],snapOffset:0,children:[t.jsxs("div",{className:b("flex flex-col",f==="vertical"?"w-full ":"h-full"),children:[t.jsxs(We,{className:"flex h-full overflow-hidden",sizes:Ee(),minSize:ve,snapOffset:ve,handleDrag:(h,_)=>{const st=_.parent.getBoundingClientRect().width*(h[1]??0)/100;w(st>=ve+_s)},children:[t.jsxs("div",{className:"flex flex-col h-full",children:[e.file.isLocal&&t.jsx(Re,{type:J.SQL,dialect:e.dialect,keymaps:M,content:e.file.content,extensions:te,onChange:oe}),e.file.isRemote&&t.jsx(kt,{keymaps:X,path:e.file.path,children:({file:h,keymaps:_})=>t.jsx(Re,{type:h.extension,dialect:e.dialect,extensions:te,keymaps:_,content:h.content,onChange:oe})})]}),t.jsx("div",{className:"flex flex-col h-full",children:t.jsx(gs,{tab:e,toggle:()=>w(h=>!h),isOpen:C})})]},e.id),t.jsx(ae,{}),t.jsx(ms,{tab:e},e.file.fingerprint)]}),t.jsx(Ms,{tab:e,className:b(f==="vertical"?"flex flex-col":"flex")})]},f)}Oe.Empty=$e;Oe.Loading=$e;Oe.Main=tt;export{Oe as default};
@@ -1 +1 @@
1
- import{d as f,a as i,r,w as j,G as E,j as e,L as c,S as d,_ as l}from"./index-C22hdM_h.js";import{u as p}from"./project-CtAE3tsj.js";import{P as b}from"./Page-kOwPk8A6.js";import"./file-DY5SRTK1.js";import"./SplitPane-7_khUxNG.js";const v=r.lazy(()=>l(()=>import("./FileExplorer-CmdsG4yG.js"),[])),P=r.lazy(()=>l(()=>import("./context-pytQSsK4.js"),[])),L=r.lazy(()=>l(()=>import("./Editor-C8-1rqZ2.js"),[])),N=r.lazy(()=>l(()=>import("./context-B0V9EzWJ.js").then(t=>t.v),[]));function w(){const{addError:t}=f(),m=i(s=>s.modules),n=i(s=>s.models),u=i(s=>s.setLastSelectedModel),x=p(s=>s.files),h=r.useCallback(function(o){const a=n.get(o);j(a)||u(a)},[x,n]),_=r.useCallback(function(o){t(E.ColumnLineage,o)},[]);return e.jsx(b,{sidebar:m.hasFiles?e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"flex justify-center items-center w-full h-full",children:e.jsxs(c,{className:"inline-block",children:[e.jsx(d,{className:"w-3 h-3 border border-neutral-10 mr-4"}),e.jsx("h3",{className:"text-md",children:"Getting Files..."})]})}),children:e.jsx(P,{children:e.jsx(v,{})})}):void 0,content:e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"flex justify-center items-center w-full h-full",children:e.jsxs(c,{className:"inline-block",children:[e.jsx(d,{className:"w-3 h-3 border border-neutral-10 mr-4"}),e.jsx("h3",{className:"text-md",children:"Getting Editor Ready..."})]})}),children:e.jsx(N,{showColumns:!0,handleClickModel:h,handleError:_,children:e.jsx(L,{})})})})}export{w as default};
1
+ import{d as f,a as i,r,w as j,G as E,j as e,L as c,S as d,_ as l}from"./index-Dqo42q_-.js";import{u as p}from"./project-DHnuzhZ_.js";import{P as b}from"./Page-BjM3k1UE.js";import"./file-DIuTD7Ex.js";import"./SplitPane-Bec3_12u.js";const v=r.lazy(()=>l(()=>import("./FileExplorer-axtC_Ai-.js"),[])),P=r.lazy(()=>l(()=>import("./context-DhtR-yn6.js"),[])),L=r.lazy(()=>l(()=>import("./Editor-BiQM-0yy.js"),[])),N=r.lazy(()=>l(()=>import("./context-CDuVFxib.js").then(t=>t.v),[]));function w(){const{addError:t}=f(),m=i(s=>s.modules),n=i(s=>s.models),u=i(s=>s.setLastSelectedModel),x=p(s=>s.files),h=r.useCallback(function(o){const a=n.get(o);j(a)||u(a)},[x,n]),_=r.useCallback(function(o){t(E.ColumnLineage,o)},[]);return e.jsx(b,{sidebar:m.hasFiles?e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"flex justify-center items-center w-full h-full",children:e.jsxs(c,{className:"inline-block",children:[e.jsx(d,{className:"w-3 h-3 border border-neutral-10 mr-4"}),e.jsx("h3",{className:"text-md",children:"Getting Files..."})]})}),children:e.jsx(P,{children:e.jsx(v,{})})}):void 0,content:e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"flex justify-center items-center w-full h-full",children:e.jsxs(c,{className:"inline-block",children:[e.jsx(d,{className:"w-3 h-3 border border-neutral-10 mr-4"}),e.jsx("h3",{className:"text-md",children:"Getting Editor Ready..."})]})}),children:e.jsx(N,{showColumns:!0,handleClickModel:h,handleError:_,children:e.jsx(L,{})})})})}export{w as default};
@@ -1 +1 @@
1
- import{y as j,t as v,d as y,r as l,F as N,e as i,w as g,j as r,O as h,n as m,I as k,B as D,m as S,i as A}from"./index-C22hdM_h.js";import{P as I}from"./Page-kOwPk8A6.js";import{S as z}from"./SourceList-CTL41Fia.js";import{S as C}from"./SourceListItem-6mIYlySR.js";import"./SplitPane-7_khUxNG.js";import"./Input-CxOCLTNw.js";import"./index-BWibl-Ee.js";function $(){const{pathname:c}=j(),a=v(),{errors:o,removeError:u,clearErrors:f}=y(),t=l.useMemo(()=>Array.from(o).reverse(),[o]);l.useEffect(()=>{var e;if(N(t))setTimeout(()=>a(i.Home));else{const s=(e=t[0])==null?void 0:e.id;g(s)?a(i.Errors,{replace:!0}):a(i.Errors+"/"+s,{replace:!0})}},[t]);function d(e){const s=t.find(n=>n.id===e);A(s)&&u(s)}return r.jsx(I,{sidebar:r.jsxs("div",{className:"flex flex-col h-full w-full",children:[r.jsx(z,{keyId:"id",keyName:"key",keyDescription:"message",to:i.Errors,items:t,isActive:e=>`${i.Errors}/${e}`===c,types:t.reduce((e,s)=>Object.assign(e,{[s.id]:s.status}),{}),listItem:({id:e,to:s,name:n,description:p,text:x,disabled:E=!1})=>r.jsx(C,{to:s,name:n,text:x,description:p,variant:m.Danger,disabled:E,handleDelete:()=>d(e)})}),r.jsx(k,{}),o.size>0&&r.jsx("div",{className:"flex justify-end",children:r.jsx(D,{size:S.sm,variant:m.Neutral,onClick:()=>f(),children:"Clear All"})})]}),content:r.jsx(h,{})})}export{$ as default};
1
+ import{y as j,t as v,d as y,r as l,F as N,e as i,w as g,j as r,O as h,n as m,I as k,B as D,m as S,i as A}from"./index-Dqo42q_-.js";import{P as I}from"./Page-BjM3k1UE.js";import{S as z}from"./SourceList-B0glAf8v.js";import{S as C}from"./SourceListItem-BUiMwOLB.js";import"./SplitPane-Bec3_12u.js";import"./Input-C5uXc-nB.js";import"./index-DZbqZ0F2.js";function $(){const{pathname:c}=j(),a=v(),{errors:o,removeError:u,clearErrors:f}=y(),t=l.useMemo(()=>Array.from(o).reverse(),[o]);l.useEffect(()=>{var e;if(N(t))setTimeout(()=>a(i.Home));else{const s=(e=t[0])==null?void 0:e.id;g(s)?a(i.Errors,{replace:!0}):a(i.Errors+"/"+s,{replace:!0})}},[t]);function d(e){const s=t.find(n=>n.id===e);A(s)&&u(s)}return r.jsx(I,{sidebar:r.jsxs("div",{className:"flex flex-col h-full w-full",children:[r.jsx(z,{keyId:"id",keyName:"key",keyDescription:"message",to:i.Errors,items:t,isActive:e=>`${i.Errors}/${e}`===c,types:t.reduce((e,s)=>Object.assign(e,{[s.id]:s.status}),{}),listItem:({id:e,to:s,name:n,description:p,text:x,disabled:E=!1})=>r.jsx(C,{to:s,name:n,text:x,description:p,variant:m.Danger,disabled:E,handleDelete:()=>d(e)})}),r.jsx(k,{}),o.size>0&&r.jsx("div",{className:"flex justify-end",children:r.jsx(D,{size:S.sm,variant:m.Neutral,onClick:()=>f(),children:"Clear All"})})]}),content:r.jsx(h,{})})}export{$ as default};
@@ -1,4 +1,4 @@
1
- import{r as i,j as u,ac as Zr,R as re,f as gn,ad as Qr,ae as Jr,af as pe,ag as eo,a2 as to,c as L,W as hn,b as X,w as no,h as ro,a as oo,A as so,L as io,S as ao,m as co}from"./index-C22hdM_h.js";import{u as k,M as lt}from"./project-CtAE3tsj.js";import{u as uo,o as lo,s as fo,f as go,a as ho,b as po,h as mo,l as vo,c as yo,d as Co,e as xo,z as So,g as bo,i as wo,R as Eo,j as Do,k as To}from"./Input-CxOCLTNw.js";import{M as Oo}from"./file-DY5SRTK1.js";import{useFileExplorer as Ge}from"./context-pytQSsK4.js";import{u as pn,S as Io}from"./SearchList-Lag39srv.js";import{u as Qe}from"./editor-CmeEFdEz.js";import{F as Po}from"./ChevronDownIcon-D8CFPQ96.js";import{F as Ro}from"./ChevronRightIcon-BpRv8ZN4.js";import"./help-6Q7f7fjd.js";import"./transition-CiMBgn_Y.js";function Mo({title:t,titleId:e,...n},r){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?i.createElement("title",{id:e},t):null,i.createElement("path",{d:"M5.625 1.5c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0 0 16.5 9h-1.875a1.875 1.875 0 0 1-1.875-1.875V5.25A3.75 3.75 0 0 0 9 1.5H5.625Z"}),i.createElement("path",{d:"M12.971 1.816A5.23 5.23 0 0 1 14.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 0 1 3.434 1.279 9.768 9.768 0 0 0-6.963-6.963Z"}))}const No=i.forwardRef(Mo);function Ao({title:t,titleId:e,...n},r){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?i.createElement("title",{id:e},t):null,i.createElement("path",{d:"M19.906 9c.382 0 .749.057 1.094.162V9a3 3 0 0 0-3-3h-3.879a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H6a3 3 0 0 0-3 3v3.162A3.756 3.756 0 0 1 4.094 9h15.812ZM4.094 10.5a2.25 2.25 0 0 0-2.227 2.568l.857 6A2.25 2.25 0 0 0 4.951 21H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-2.227-2.568H4.094Z"}))}const _o=i.forwardRef(Ao);function jo({title:t,titleId:e,...n},r){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?i.createElement("title",{id:e},t):null,i.createElement("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"}))}const Fo=i.forwardRef(jo);function P(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t==null||t(o),n===!1||!o.defaultPrevented)return e==null?void 0:e(o)}}function Te(t,e=[]){let n=[];function r(s,a){const c=i.createContext(a),d=n.length;n=[...n,a];const l=h=>{var y;const{scope:g,children:m,...C}=h,p=((y=g==null?void 0:g[t])==null?void 0:y[d])||c,v=i.useMemo(()=>C,Object.values(C));return u.jsx(p.Provider,{value:v,children:m})};l.displayName=s+"Provider";function f(h,g){var p;const m=((p=g==null?void 0:g[t])==null?void 0:p[d])||c,C=i.useContext(m);if(C)return C;if(a!==void 0)return a;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[l,f]}const o=()=>{const s=n.map(a=>i.createContext(a));return function(c){const d=(c==null?void 0:c[t])||s;return i.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return o.scopeName=t,[r,Lo(o,...e)]}function Lo(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=r.reduce((c,{useScope:d,scopeName:l})=>{const h=d(s)[`__scope${l}`];return{...c,...h}},{});return i.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function Ut(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function mn(...t){return e=>{let n=!1;const r=t.map(o=>{const s=Ut(o,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Ut(t[o],null)}}}}function $(...t){return i.useCallback(mn(...t),t)}function He(t){const e=ko(t),n=i.forwardRef((r,o)=>{const{children:s,...a}=r,c=i.Children.toArray(s),d=c.find(Ho);if(d){const l=d.props.children,f=c.map(h=>h===d?i.Children.count(l)>1?i.Children.only(null):i.isValidElement(l)?l.props.children:null:h);return u.jsx(e,{...a,ref:o,children:i.isValidElement(l)?i.cloneElement(l,void 0,f):null})}return u.jsx(e,{...a,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}function ko(t){const e=i.forwardRef((n,r)=>{const{children:o,...s}=n,a=i.isValidElement(o)?Bo(o):void 0,c=$(a,r);if(i.isValidElement(o)){const d=$o(s,o.props);return o.type!==i.Fragment&&(d.ref=c),i.cloneElement(o,d)}return i.Children.count(o)>1?i.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Uo=Symbol("radix.slottable");function Ho(t){return i.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Uo}function $o(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{const d=s(...c);return o(...c),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function Bo(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Go=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],B=Go.reduce((t,e)=>{const n=He(`Primitive.${e}`),r=i.forwardRef((o,s)=>{const{asChild:a,...c}=o,d=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(d,{...c,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function vn(t,e){t&&Zr.flushSync(()=>t.dispatchEvent(e))}function yn(t){const e=t+"CollectionProvider",[n,r]=Te(e),[o,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{const{scope:v,children:y}=p,w=re.useRef(null),b=re.useRef(new Map).current;return u.jsx(o,{scope:v,itemMap:b,collectionRef:w,children:y})};a.displayName=e;const c=t+"CollectionSlot",d=He(c),l=re.forwardRef((p,v)=>{const{scope:y,children:w}=p,b=s(c,y),E=$(v,b.collectionRef);return u.jsx(d,{ref:E,children:w})});l.displayName=c;const f=t+"CollectionItemSlot",h="data-radix-collection-item",g=He(f),m=re.forwardRef((p,v)=>{const{scope:y,children:w,...b}=p,E=re.useRef(null),I=$(v,E),R=s(f,y);return re.useEffect(()=>(R.itemMap.set(E,{ref:E,...b}),()=>void R.itemMap.delete(E))),u.jsx(g,{[h]:"",ref:I,children:w})});m.displayName=f;function C(p){const v=s(t+"CollectionConsumer",p);return re.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const b=Array.from(w.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((R,T)=>b.indexOf(R.ref.current)-b.indexOf(T.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:a,Slot:l,ItemSlot:m},C,r]}var Ko=i.createContext(void 0);function Cn(t){const e=i.useContext(Ko);return t||e||"ltr"}function J(t){const e=i.useRef(t);return i.useEffect(()=>{e.current=t}),i.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Wo(t,e=globalThis==null?void 0:globalThis.document){const n=J(t);i.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var Vo="DismissableLayer",dt="dismissableLayer.update",Yo="dismissableLayer.pointerDownOutside",Xo="dismissableLayer.focusOutside",Ht,xn=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sn=i.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:c,...d}=t,l=i.useContext(xn),[f,h]=i.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=i.useState({}),C=$(e,T=>h(T)),p=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=p.indexOf(v),w=f?p.indexOf(f):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,E=w>=y,I=Zo(T=>{const M=T.target,_=[...l.branches].some(F=>F.contains(M));!E||_||(o==null||o(T),a==null||a(T),T.defaultPrevented||c==null||c())},g),R=Qo(T=>{const M=T.target;[...l.branches].some(F=>F.contains(M))||(s==null||s(T),a==null||a(T),T.defaultPrevented||c==null||c())},g);return Wo(T=>{w===l.layers.size-1&&(r==null||r(T),!T.defaultPrevented&&c&&(T.preventDefault(),c()))},g),i.useEffect(()=>{if(f)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Ht=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),$t(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Ht)}},[f,g,n,l]),i.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),$t())},[f,l]),i.useEffect(()=>{const T=()=>m({});return document.addEventListener(dt,T),()=>document.removeEventListener(dt,T)},[]),u.jsx(B.div,{...d,ref:C,style:{pointerEvents:b?E?"auto":"none":void 0,...t.style},onFocusCapture:P(t.onFocusCapture,R.onFocusCapture),onBlurCapture:P(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:P(t.onPointerDownCapture,I.onPointerDownCapture)})});Sn.displayName=Vo;var zo="DismissableLayerBranch",qo=i.forwardRef((t,e)=>{const n=i.useContext(xn),r=i.useRef(null),o=$(e,r);return i.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),u.jsx(B.div,{...t,ref:o})});qo.displayName=zo;function Zo(t,e=globalThis==null?void 0:globalThis.document){const n=J(t),r=i.useRef(!1),o=i.useRef(()=>{});return i.useEffect(()=>{const s=c=>{if(c.target&&!r.current){let d=function(){bn(Yo,n,l,{discrete:!0})};const l={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=d,e.addEventListener("click",o.current,{once:!0})):d()}else e.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",s),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function Qo(t,e=globalThis==null?void 0:globalThis.document){const n=J(t),r=i.useRef(!1);return i.useEffect(()=>{const o=s=>{s.target&&!r.current&&bn(Xo,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function $t(){const t=new CustomEvent(dt);document.dispatchEvent(t)}function bn(t,e,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?vn(o,s):o.dispatchEvent(s)}var Je=0;function Jo(){i.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Bt()),document.body.insertAdjacentElement("beforeend",t[1]??Bt()),Je++,()=>{Je===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Je--}},[])}function Bt(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var et="focusScope.autoFocusOnMount",tt="focusScope.autoFocusOnUnmount",Gt={bubbles:!1,cancelable:!0},es="FocusScope",wn=i.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=t,[c,d]=i.useState(null),l=J(o),f=J(s),h=i.useRef(null),g=$(e,p=>d(p)),m=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let p=function(b){if(m.paused||!c)return;const E=b.target;c.contains(E)?h.current=E:oe(h.current,{select:!0})},v=function(b){if(m.paused||!c)return;const E=b.relatedTarget;E!==null&&(c.contains(E)||oe(h.current,{select:!0}))},y=function(b){if(document.activeElement===document.body)for(const I of b)I.removedNodes.length>0&&oe(c)};document.addEventListener("focusin",p),document.addEventListener("focusout",v);const w=new MutationObserver(y);return c&&w.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",v),w.disconnect()}}},[r,c,m.paused]),i.useEffect(()=>{if(c){Wt.add(m);const p=document.activeElement;if(!c.contains(p)){const y=new CustomEvent(et,Gt);c.addEventListener(et,l),c.dispatchEvent(y),y.defaultPrevented||(ts(is(En(c)),{select:!0}),document.activeElement===p&&oe(c))}return()=>{c.removeEventListener(et,l),setTimeout(()=>{const y=new CustomEvent(tt,Gt);c.addEventListener(tt,f),c.dispatchEvent(y),y.defaultPrevented||oe(p??document.body,{select:!0}),c.removeEventListener(tt,f),Wt.remove(m)},0)}}},[c,l,f,m]);const C=i.useCallback(p=>{if(!n&&!r||m.paused)return;const v=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,y=document.activeElement;if(v&&y){const w=p.currentTarget,[b,E]=ns(w);b&&E?!p.shiftKey&&y===E?(p.preventDefault(),n&&oe(b,{select:!0})):p.shiftKey&&y===b&&(p.preventDefault(),n&&oe(E,{select:!0})):y===w&&p.preventDefault()}},[n,r,m.paused]);return u.jsx(B.div,{tabIndex:-1,...a,ref:g,onKeyDown:C})});wn.displayName=es;function ts(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(oe(r,{select:e}),document.activeElement!==n)return}function ns(t){const e=En(t),n=Kt(e,t),r=Kt(e.reverse(),t);return[n,r]}function En(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Kt(t,e){for(const n of t)if(!rs(n,{upTo:e}))return n}function rs(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function os(t){return t instanceof HTMLInputElement&&"select"in t}function oe(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&os(t)&&e&&t.select()}}var Wt=ss();function ss(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Vt(t,e),t.unshift(e)},remove(e){var n;t=Vt(t,e),(n=t[0])==null||n.resume()}}}function Vt(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function is(t){return t.filter(e=>e.tagName!=="A")}var se=globalThis!=null&&globalThis.document?i.useLayoutEffect:()=>{},as=gn[" useId ".trim().toString()]||(()=>{}),cs=0;function us(t){const[e,n]=i.useState(as());return se(()=>{n(r=>r??String(cs++))},[t]),e?`radix-${e}`:""}var ls="Arrow",Dn=i.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...s}=t;return u.jsx(B.svg,{...s,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});Dn.displayName=ls;var ds=Dn;function fs(t){const[e,n]=i.useState(void 0);return se(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,c;if("borderBoxSize"in s){const d=s.borderBoxSize,l=Array.isArray(d)?d[0]:d;a=l.inlineSize,c=l.blockSize}else a=t.offsetWidth,c=t.offsetHeight;n({width:a,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var xt="Popper",[Tn,On]=Te(xt),[gs,In]=Tn(xt),Pn=t=>{const{__scopePopper:e,children:n}=t,[r,o]=i.useState(null);return u.jsx(gs,{scope:e,anchor:r,onAnchorChange:o,children:n})};Pn.displayName=xt;var Rn="PopperAnchor",Mn=i.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,s=In(Rn,n),a=i.useRef(null),c=$(e,a);return i.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||a.current)}),r?null:u.jsx(B.div,{...o,ref:c})});Mn.displayName=Rn;var St="PopperContent",[hs,ps]=Tn(St),Nn=i.forwardRef((t,e)=>{var ne,ye,Y,Ce,Ft,Lt;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:a=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:l=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:m="optimized",onPlaced:C,...p}=t,v=In(St,n),[y,w]=i.useState(null),b=$(e,xe=>w(xe)),[E,I]=i.useState(null),R=fs(E),T=(R==null?void 0:R.width)??0,M=(R==null?void 0:R.height)??0,_=r+(s!=="center"?"-"+s:""),F=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},D=Array.isArray(l)?l:[l],A=D.length>0,K={padding:F,boundary:D.filter(vs),altBoundary:A},{refs:ee,floatingStyles:te,placement:V,isPositioned:U,middlewareData:S}=uo({strategy:"fixed",placement:_,whileElementsMounted:(...xe)=>yo(...xe,{animationFrame:m==="always"}),elements:{reference:v.anchor},middleware:[lo({mainAxis:o+M,alignmentAxis:a}),d&&fo({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?vo():void 0,...K}),d&&go({...K}),ho({...K,apply:({elements:xe,rects:kt,availableWidth:Yr,availableHeight:Xr})=>{const{width:zr,height:qr}=kt.reference,Ne=xe.floating.style;Ne.setProperty("--radix-popper-available-width",`${Yr}px`),Ne.setProperty("--radix-popper-available-height",`${Xr}px`),Ne.setProperty("--radix-popper-anchor-width",`${zr}px`),Ne.setProperty("--radix-popper-anchor-height",`${qr}px`)}}),E&&po({element:E,padding:c}),ys({arrowWidth:T,arrowHeight:M}),g&&mo({strategy:"referenceHidden",...K})]}),[x,N]=jn(V),j=J(C);se(()=>{U&&(j==null||j())},[U,j]);const H=(ne=S.arrow)==null?void 0:ne.x,me=(ye=S.arrow)==null?void 0:ye.y,ve=((Y=S.arrow)==null?void 0:Y.centerOffset)!==0,[Me,ie]=i.useState();return se(()=>{y&&ie(window.getComputedStyle(y).zIndex)},[y]),u.jsx("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...te,transform:U?te.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Me,"--radix-popper-transform-origin":[(Ce=S.transformOrigin)==null?void 0:Ce.x,(Ft=S.transformOrigin)==null?void 0:Ft.y].join(" "),...((Lt=S.hide)==null?void 0:Lt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:u.jsx(hs,{scope:n,placedSide:x,onArrowChange:I,arrowX:H,arrowY:me,shouldHideArrow:ve,children:u.jsx(B.div,{"data-side":x,"data-align":N,...p,ref:b,style:{...p.style,animation:U?void 0:"none"}})})})});Nn.displayName=St;var An="PopperArrow",ms={top:"bottom",right:"left",bottom:"top",left:"right"},_n=i.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,s=ps(An,r),a=ms[s.placedSide];return u.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:u.jsx(ds,{...o,ref:n,style:{...o.style,display:"block"}})})});_n.displayName=An;function vs(t){return t!==null}var ys=t=>({name:"transformOrigin",options:t,fn(e){var v,y,w;const{placement:n,rects:r,middlewareData:o}=e,a=((v=o.arrow)==null?void 0:v.centerOffset)!==0,c=a?0:t.arrowWidth,d=a?0:t.arrowHeight,[l,f]=jn(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((y=o.arrow)==null?void 0:y.x)??0)+c/2,m=(((w=o.arrow)==null?void 0:w.y)??0)+d/2;let C="",p="";return l==="bottom"?(C=a?h:`${g}px`,p=`${-d}px`):l==="top"?(C=a?h:`${g}px`,p=`${r.floating.height+d}px`):l==="right"?(C=`${-d}px`,p=a?h:`${m}px`):l==="left"&&(C=`${r.floating.width+d}px`,p=a?h:`${m}px`),{data:{x:C,y:p}}}});function jn(t){const[e,n="center"]=t.split("-");return[e,n]}var Cs=Pn,xs=Mn,Ss=Nn,bs=_n,ws="Portal",Fn=i.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[o,s]=i.useState(!1);se(()=>s(!0),[]);const a=n||o&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return a?Qr.createPortal(u.jsx(B.div,{...r,ref:e}),a):null});Fn.displayName=ws;function Es(t,e){return i.useReducer((n,r)=>e[n][r]??n,t)}var Oe=t=>{const{present:e,children:n}=t,r=Ds(e),o=typeof n=="function"?n({present:r.isPresent}):i.Children.only(n),s=$(r.ref,Ts(o));return typeof n=="function"||r.isPresent?i.cloneElement(o,{ref:s}):null};Oe.displayName="Presence";function Ds(t){const[e,n]=i.useState(),r=i.useRef(null),o=i.useRef(t),s=i.useRef("none"),a=t?"mounted":"unmounted",[c,d]=Es(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const l=Ae(r.current);s.current=c==="mounted"?l:"none"},[c]),se(()=>{const l=r.current,f=o.current;if(f!==t){const g=s.current,m=Ae(l);t?d("MOUNT"):m==="none"||(l==null?void 0:l.display)==="none"?d("UNMOUNT"):d(f&&g!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,d]),se(()=>{if(e){let l;const f=e.ownerDocument.defaultView??window,h=m=>{const p=Ae(r.current).includes(m.animationName);if(m.target===e&&p&&(d("ANIMATION_END"),!o.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",l=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},g=m=>{m.target===e&&(s.current=Ae(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{f.clearTimeout(l),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else d("ANIMATION_END")},[e,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(l=>{r.current=l?getComputedStyle(l):null,n(l)},[])}}function Ae(t){return(t==null?void 0:t.animationName)||"none"}function Ts(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Os=gn[" useInsertionEffect ".trim().toString()]||se;function Is({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,s,a]=Ps({defaultProp:e,onChange:n}),c=t!==void 0,d=c?t:o;{const f=i.useRef(t!==void 0);i.useEffect(()=>{const h=f.current;h!==c&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const l=i.useCallback(f=>{var h;if(c){const g=Rs(f)?f(t):f;g!==t&&((h=a.current)==null||h.call(a,g))}else s(f)},[c,t,s,a]);return[d,l]}function Ps({defaultProp:t,onChange:e}){const[n,r]=i.useState(t),o=i.useRef(n),s=i.useRef(e);return Os(()=>{s.current=e},[e]),i.useEffect(()=>{var a;o.current!==n&&((a=s.current)==null||a.call(s,n),o.current=n)},[n,o]),[n,r,s]}function Rs(t){return typeof t=="function"}var nt="rovingFocusGroup.onEntryFocus",Ms={bubbles:!1,cancelable:!0},Ie="RovingFocusGroup",[ft,Ln,Ns]=yn(Ie),[As,kn]=Te(Ie,[Ns]),[_s,js]=As(Ie),Un=i.forwardRef((t,e)=>u.jsx(ft.Provider,{scope:t.__scopeRovingFocusGroup,children:u.jsx(ft.Slot,{scope:t.__scopeRovingFocusGroup,children:u.jsx(Fs,{...t,ref:e})})}));Un.displayName=Ie;var Fs=i.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:l,preventScrollOnEntryFocus:f=!1,...h}=t,g=i.useRef(null),m=$(e,g),C=Cn(s),[p,v]=Is({prop:a,defaultProp:c??null,onChange:d,caller:Ie}),[y,w]=i.useState(!1),b=J(l),E=Ln(n),I=i.useRef(!1),[R,T]=i.useState(0);return i.useEffect(()=>{const M=g.current;if(M)return M.addEventListener(nt,b),()=>M.removeEventListener(nt,b)},[b]),u.jsx(_s,{scope:n,orientation:r,dir:C,loop:o,currentTabStopId:p,onItemFocus:i.useCallback(M=>v(M),[v]),onItemShiftTab:i.useCallback(()=>w(!0),[]),onFocusableItemAdd:i.useCallback(()=>T(M=>M+1),[]),onFocusableItemRemove:i.useCallback(()=>T(M=>M-1),[]),children:u.jsx(B.div,{tabIndex:y||R===0?-1:0,"data-orientation":r,...h,ref:m,style:{outline:"none",...t.style},onMouseDown:P(t.onMouseDown,()=>{I.current=!0}),onFocus:P(t.onFocus,M=>{const _=!I.current;if(M.target===M.currentTarget&&_&&!y){const F=new CustomEvent(nt,Ms);if(M.currentTarget.dispatchEvent(F),!F.defaultPrevented){const D=E().filter(V=>V.focusable),A=D.find(V=>V.active),K=D.find(V=>V.id===p),te=[A,K,...D].filter(Boolean).map(V=>V.ref.current);Bn(te,f)}}I.current=!1}),onBlur:P(t.onBlur,()=>w(!1))})})}),Hn="RovingFocusGroupItem",$n=i.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:a,...c}=t,d=us(),l=s||d,f=js(Hn,n),h=f.currentTabStopId===l,g=Ln(n),{onFocusableItemAdd:m,onFocusableItemRemove:C,currentTabStopId:p}=f;return i.useEffect(()=>{if(r)return m(),()=>C()},[r,m,C]),u.jsx(ft.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:u.jsx(B.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:P(t.onMouseDown,v=>{r?f.onItemFocus(l):v.preventDefault()}),onFocus:P(t.onFocus,()=>f.onItemFocus(l)),onKeyDown:P(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=Us(v,f.orientation,f.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let b=g().filter(E=>E.focusable).map(E=>E.ref.current);if(y==="last")b.reverse();else if(y==="prev"||y==="next"){y==="prev"&&b.reverse();const E=b.indexOf(v.currentTarget);b=f.loop?Hs(b,E+1):b.slice(E+1)}setTimeout(()=>Bn(b))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:p!=null}):a})})});$n.displayName=Hn;var Ls={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ks(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Us(t,e,n){const r=ks(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Ls[r]}function Bn(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Hs(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var $s=Un,Bs=$n,Gn=Co(),rt=function(){},Ke=i.forwardRef(function(t,e){var n=i.useRef(null),r=i.useState({onScrollCapture:rt,onWheelCapture:rt,onTouchMoveCapture:rt}),o=r[0],s=r[1],a=t.forwardProps,c=t.children,d=t.className,l=t.removeScrollBar,f=t.enabled,h=t.shards,g=t.sideCar,m=t.noIsolation,C=t.inert,p=t.allowPinchZoom,v=t.as,y=v===void 0?"div":v,w=t.gapMode,b=Jr(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=g,I=xo([n,e]),R=pe(pe({},b),o);return i.createElement(i.Fragment,null,f&&i.createElement(E,{sideCar:Gn,removeScrollBar:l,shards:h,noIsolation:m,inert:C,setCallbacks:s,allowPinchZoom:!!p,lockRef:n,gapMode:w}),a?i.cloneElement(i.Children.only(c),pe(pe({},R),{ref:I})):i.createElement(y,pe({},R,{className:d,ref:I}),c))});Ke.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ke.classNames={fullWidth:bo,zeroRight:So};var gt=!1;if(typeof window<"u")try{var _e=Object.defineProperty({},"passive",{get:function(){return gt=!0,!0}});window.addEventListener("test",_e,_e),window.removeEventListener("test",_e,_e)}catch{gt=!1}var fe=gt?{passive:!1}:!1,Gs=function(t){return t.tagName==="TEXTAREA"},Kn=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Gs(t)&&n[e]==="visible")},Ks=function(t){return Kn(t,"overflowY")},Ws=function(t){return Kn(t,"overflowX")},Yt=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Wn(t,r);if(o){var s=Vn(t,r),a=s[1],c=s[2];if(a>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Vs=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Ys=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Wn=function(t,e){return t==="v"?Ks(e):Ws(e)},Vn=function(t,e){return t==="v"?Vs(e):Ys(e)},Xs=function(t,e){return t==="h"&&e==="rtl"?-1:1},zs=function(t,e,n,r,o){var s=Xs(t,window.getComputedStyle(e).direction),a=s*r,c=n.target,d=e.contains(c),l=!1,f=a>0,h=0,g=0;do{var m=Vn(t,c),C=m[0],p=m[1],v=m[2],y=p-v-s*C;(C||y)&&Wn(t,c)&&(h+=y,g+=C),c instanceof ShadowRoot?c=c.host:c=c.parentNode}while(!d&&c!==document.body||d&&(e.contains(c)||e===c));return(f&&Math.abs(h)<1||!f&&Math.abs(g)<1)&&(l=!0),l},je=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Xt=function(t){return[t.deltaX,t.deltaY]},zt=function(t){return t&&"current"in t?t.current:t},qs=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Zs=function(t){return`
1
+ import{r as i,j as u,ac as Zr,R as re,f as gn,ad as Qr,ae as Jr,af as pe,ag as eo,a2 as to,c as L,W as hn,b as X,w as no,h as ro,a as oo,A as so,L as io,S as ao,m as co}from"./index-Dqo42q_-.js";import{u as k,M as lt}from"./project-DHnuzhZ_.js";import{u as uo,o as lo,s as fo,f as go,a as ho,b as po,h as mo,l as vo,c as yo,d as Co,e as xo,z as So,g as bo,i as wo,R as Eo,j as Do,k as To}from"./Input-C5uXc-nB.js";import{M as Oo}from"./file-DIuTD7Ex.js";import{useFileExplorer as Ge}from"./context-DhtR-yn6.js";import{u as pn,S as Io}from"./SearchList--GtSxkZn.js";import{u as Qe}from"./editor-D99craz3.js";import{F as Po}from"./ChevronDownIcon-D3eSCae0.js";import{F as Ro}from"./ChevronRightIcon-BYX0d3Wq.js";import"./help-6Q7f7fjd.js";import"./transition-BpitCk1w.js";function Mo({title:t,titleId:e,...n},r){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?i.createElement("title",{id:e},t):null,i.createElement("path",{d:"M5.625 1.5c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0 0 16.5 9h-1.875a1.875 1.875 0 0 1-1.875-1.875V5.25A3.75 3.75 0 0 0 9 1.5H5.625Z"}),i.createElement("path",{d:"M12.971 1.816A5.23 5.23 0 0 1 14.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 0 1 3.434 1.279 9.768 9.768 0 0 0-6.963-6.963Z"}))}const No=i.forwardRef(Mo);function Ao({title:t,titleId:e,...n},r){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?i.createElement("title",{id:e},t):null,i.createElement("path",{d:"M19.906 9c.382 0 .749.057 1.094.162V9a3 3 0 0 0-3-3h-3.879a.75.75 0 0 1-.53-.22L11.47 3.66A2.25 2.25 0 0 0 9.879 3H6a3 3 0 0 0-3 3v3.162A3.756 3.756 0 0 1 4.094 9h15.812ZM4.094 10.5a2.25 2.25 0 0 0-2.227 2.568l.857 6A2.25 2.25 0 0 0 4.951 21H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-2.227-2.568H4.094Z"}))}const _o=i.forwardRef(Ao);function jo({title:t,titleId:e,...n},r){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?i.createElement("title",{id:e},t):null,i.createElement("path",{d:"M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"}))}const Fo=i.forwardRef(jo);function P(t,e,{checkForDefaultPrevented:n=!0}={}){return function(o){if(t==null||t(o),n===!1||!o.defaultPrevented)return e==null?void 0:e(o)}}function Te(t,e=[]){let n=[];function r(s,a){const c=i.createContext(a),d=n.length;n=[...n,a];const l=h=>{var y;const{scope:g,children:m,...C}=h,p=((y=g==null?void 0:g[t])==null?void 0:y[d])||c,v=i.useMemo(()=>C,Object.values(C));return u.jsx(p.Provider,{value:v,children:m})};l.displayName=s+"Provider";function f(h,g){var p;const m=((p=g==null?void 0:g[t])==null?void 0:p[d])||c,C=i.useContext(m);if(C)return C;if(a!==void 0)return a;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[l,f]}const o=()=>{const s=n.map(a=>i.createContext(a));return function(c){const d=(c==null?void 0:c[t])||s;return i.useMemo(()=>({[`__scope${t}`]:{...c,[t]:d}}),[c,d])}};return o.scopeName=t,[r,Lo(o,...e)]}function Lo(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=r.reduce((c,{useScope:d,scopeName:l})=>{const h=d(s)[`__scope${l}`];return{...c,...h}},{});return i.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function Ut(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function mn(...t){return e=>{let n=!1;const r=t.map(o=>{const s=Ut(o,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Ut(t[o],null)}}}}function $(...t){return i.useCallback(mn(...t),t)}function He(t){const e=ko(t),n=i.forwardRef((r,o)=>{const{children:s,...a}=r,c=i.Children.toArray(s),d=c.find(Ho);if(d){const l=d.props.children,f=c.map(h=>h===d?i.Children.count(l)>1?i.Children.only(null):i.isValidElement(l)?l.props.children:null:h);return u.jsx(e,{...a,ref:o,children:i.isValidElement(l)?i.cloneElement(l,void 0,f):null})}return u.jsx(e,{...a,ref:o,children:s})});return n.displayName=`${t}.Slot`,n}function ko(t){const e=i.forwardRef((n,r)=>{const{children:o,...s}=n,a=i.isValidElement(o)?Bo(o):void 0,c=$(a,r);if(i.isValidElement(o)){const d=$o(s,o.props);return o.type!==i.Fragment&&(d.ref=c),i.cloneElement(o,d)}return i.Children.count(o)>1?i.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Uo=Symbol("radix.slottable");function Ho(t){return i.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Uo}function $o(t,e){const n={...e};for(const r in e){const o=t[r],s=e[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...c)=>{const d=s(...c);return o(...c),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}function Bo(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Go=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],B=Go.reduce((t,e)=>{const n=He(`Primitive.${e}`),r=i.forwardRef((o,s)=>{const{asChild:a,...c}=o,d=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(d,{...c,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function vn(t,e){t&&Zr.flushSync(()=>t.dispatchEvent(e))}function yn(t){const e=t+"CollectionProvider",[n,r]=Te(e),[o,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{const{scope:v,children:y}=p,w=re.useRef(null),b=re.useRef(new Map).current;return u.jsx(o,{scope:v,itemMap:b,collectionRef:w,children:y})};a.displayName=e;const c=t+"CollectionSlot",d=He(c),l=re.forwardRef((p,v)=>{const{scope:y,children:w}=p,b=s(c,y),E=$(v,b.collectionRef);return u.jsx(d,{ref:E,children:w})});l.displayName=c;const f=t+"CollectionItemSlot",h="data-radix-collection-item",g=He(f),m=re.forwardRef((p,v)=>{const{scope:y,children:w,...b}=p,E=re.useRef(null),I=$(v,E),R=s(f,y);return re.useEffect(()=>(R.itemMap.set(E,{ref:E,...b}),()=>void R.itemMap.delete(E))),u.jsx(g,{[h]:"",ref:I,children:w})});m.displayName=f;function C(p){const v=s(t+"CollectionConsumer",p);return re.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const b=Array.from(w.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((R,T)=>b.indexOf(R.ref.current)-b.indexOf(T.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:a,Slot:l,ItemSlot:m},C,r]}var Ko=i.createContext(void 0);function Cn(t){const e=i.useContext(Ko);return t||e||"ltr"}function J(t){const e=i.useRef(t);return i.useEffect(()=>{e.current=t}),i.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Wo(t,e=globalThis==null?void 0:globalThis.document){const n=J(t);i.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var Vo="DismissableLayer",dt="dismissableLayer.update",Yo="dismissableLayer.pointerDownOutside",Xo="dismissableLayer.focusOutside",Ht,xn=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sn=i.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:c,...d}=t,l=i.useContext(xn),[f,h]=i.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=i.useState({}),C=$(e,T=>h(T)),p=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=p.indexOf(v),w=f?p.indexOf(f):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,E=w>=y,I=Zo(T=>{const M=T.target,_=[...l.branches].some(F=>F.contains(M));!E||_||(o==null||o(T),a==null||a(T),T.defaultPrevented||c==null||c())},g),R=Qo(T=>{const M=T.target;[...l.branches].some(F=>F.contains(M))||(s==null||s(T),a==null||a(T),T.defaultPrevented||c==null||c())},g);return Wo(T=>{w===l.layers.size-1&&(r==null||r(T),!T.defaultPrevented&&c&&(T.preventDefault(),c()))},g),i.useEffect(()=>{if(f)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Ht=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),$t(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Ht)}},[f,g,n,l]),i.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),$t())},[f,l]),i.useEffect(()=>{const T=()=>m({});return document.addEventListener(dt,T),()=>document.removeEventListener(dt,T)},[]),u.jsx(B.div,{...d,ref:C,style:{pointerEvents:b?E?"auto":"none":void 0,...t.style},onFocusCapture:P(t.onFocusCapture,R.onFocusCapture),onBlurCapture:P(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:P(t.onPointerDownCapture,I.onPointerDownCapture)})});Sn.displayName=Vo;var zo="DismissableLayerBranch",qo=i.forwardRef((t,e)=>{const n=i.useContext(xn),r=i.useRef(null),o=$(e,r);return i.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),u.jsx(B.div,{...t,ref:o})});qo.displayName=zo;function Zo(t,e=globalThis==null?void 0:globalThis.document){const n=J(t),r=i.useRef(!1),o=i.useRef(()=>{});return i.useEffect(()=>{const s=c=>{if(c.target&&!r.current){let d=function(){bn(Yo,n,l,{discrete:!0})};const l={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=d,e.addEventListener("click",o.current,{once:!0})):d()}else e.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",s),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function Qo(t,e=globalThis==null?void 0:globalThis.document){const n=J(t),r=i.useRef(!1);return i.useEffect(()=>{const o=s=>{s.target&&!r.current&&bn(Xo,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function $t(){const t=new CustomEvent(dt);document.dispatchEvent(t)}function bn(t,e,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?vn(o,s):o.dispatchEvent(s)}var Je=0;function Jo(){i.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Bt()),document.body.insertAdjacentElement("beforeend",t[1]??Bt()),Je++,()=>{Je===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Je--}},[])}function Bt(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var et="focusScope.autoFocusOnMount",tt="focusScope.autoFocusOnUnmount",Gt={bubbles:!1,cancelable:!0},es="FocusScope",wn=i.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=t,[c,d]=i.useState(null),l=J(o),f=J(s),h=i.useRef(null),g=$(e,p=>d(p)),m=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let p=function(b){if(m.paused||!c)return;const E=b.target;c.contains(E)?h.current=E:oe(h.current,{select:!0})},v=function(b){if(m.paused||!c)return;const E=b.relatedTarget;E!==null&&(c.contains(E)||oe(h.current,{select:!0}))},y=function(b){if(document.activeElement===document.body)for(const I of b)I.removedNodes.length>0&&oe(c)};document.addEventListener("focusin",p),document.addEventListener("focusout",v);const w=new MutationObserver(y);return c&&w.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",v),w.disconnect()}}},[r,c,m.paused]),i.useEffect(()=>{if(c){Wt.add(m);const p=document.activeElement;if(!c.contains(p)){const y=new CustomEvent(et,Gt);c.addEventListener(et,l),c.dispatchEvent(y),y.defaultPrevented||(ts(is(En(c)),{select:!0}),document.activeElement===p&&oe(c))}return()=>{c.removeEventListener(et,l),setTimeout(()=>{const y=new CustomEvent(tt,Gt);c.addEventListener(tt,f),c.dispatchEvent(y),y.defaultPrevented||oe(p??document.body,{select:!0}),c.removeEventListener(tt,f),Wt.remove(m)},0)}}},[c,l,f,m]);const C=i.useCallback(p=>{if(!n&&!r||m.paused)return;const v=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,y=document.activeElement;if(v&&y){const w=p.currentTarget,[b,E]=ns(w);b&&E?!p.shiftKey&&y===E?(p.preventDefault(),n&&oe(b,{select:!0})):p.shiftKey&&y===b&&(p.preventDefault(),n&&oe(E,{select:!0})):y===w&&p.preventDefault()}},[n,r,m.paused]);return u.jsx(B.div,{tabIndex:-1,...a,ref:g,onKeyDown:C})});wn.displayName=es;function ts(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(oe(r,{select:e}),document.activeElement!==n)return}function ns(t){const e=En(t),n=Kt(e,t),r=Kt(e.reverse(),t);return[n,r]}function En(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Kt(t,e){for(const n of t)if(!rs(n,{upTo:e}))return n}function rs(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function os(t){return t instanceof HTMLInputElement&&"select"in t}function oe(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&os(t)&&e&&t.select()}}var Wt=ss();function ss(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Vt(t,e),t.unshift(e)},remove(e){var n;t=Vt(t,e),(n=t[0])==null||n.resume()}}}function Vt(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function is(t){return t.filter(e=>e.tagName!=="A")}var se=globalThis!=null&&globalThis.document?i.useLayoutEffect:()=>{},as=gn[" useId ".trim().toString()]||(()=>{}),cs=0;function us(t){const[e,n]=i.useState(as());return se(()=>{n(r=>r??String(cs++))},[t]),e?`radix-${e}`:""}var ls="Arrow",Dn=i.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...s}=t;return u.jsx(B.svg,{...s,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});Dn.displayName=ls;var ds=Dn;function fs(t){const[e,n]=i.useState(void 0);return se(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,c;if("borderBoxSize"in s){const d=s.borderBoxSize,l=Array.isArray(d)?d[0]:d;a=l.inlineSize,c=l.blockSize}else a=t.offsetWidth,c=t.offsetHeight;n({width:a,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var xt="Popper",[Tn,On]=Te(xt),[gs,In]=Tn(xt),Pn=t=>{const{__scopePopper:e,children:n}=t,[r,o]=i.useState(null);return u.jsx(gs,{scope:e,anchor:r,onAnchorChange:o,children:n})};Pn.displayName=xt;var Rn="PopperAnchor",Mn=i.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,s=In(Rn,n),a=i.useRef(null),c=$(e,a);return i.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||a.current)}),r?null:u.jsx(B.div,{...o,ref:c})});Mn.displayName=Rn;var St="PopperContent",[hs,ps]=Tn(St),Nn=i.forwardRef((t,e)=>{var ne,ye,Y,Ce,Ft,Lt;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:a=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:l=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:m="optimized",onPlaced:C,...p}=t,v=In(St,n),[y,w]=i.useState(null),b=$(e,xe=>w(xe)),[E,I]=i.useState(null),R=fs(E),T=(R==null?void 0:R.width)??0,M=(R==null?void 0:R.height)??0,_=r+(s!=="center"?"-"+s:""),F=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},D=Array.isArray(l)?l:[l],A=D.length>0,K={padding:F,boundary:D.filter(vs),altBoundary:A},{refs:ee,floatingStyles:te,placement:V,isPositioned:U,middlewareData:S}=uo({strategy:"fixed",placement:_,whileElementsMounted:(...xe)=>yo(...xe,{animationFrame:m==="always"}),elements:{reference:v.anchor},middleware:[lo({mainAxis:o+M,alignmentAxis:a}),d&&fo({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?vo():void 0,...K}),d&&go({...K}),ho({...K,apply:({elements:xe,rects:kt,availableWidth:Yr,availableHeight:Xr})=>{const{width:zr,height:qr}=kt.reference,Ne=xe.floating.style;Ne.setProperty("--radix-popper-available-width",`${Yr}px`),Ne.setProperty("--radix-popper-available-height",`${Xr}px`),Ne.setProperty("--radix-popper-anchor-width",`${zr}px`),Ne.setProperty("--radix-popper-anchor-height",`${qr}px`)}}),E&&po({element:E,padding:c}),ys({arrowWidth:T,arrowHeight:M}),g&&mo({strategy:"referenceHidden",...K})]}),[x,N]=jn(V),j=J(C);se(()=>{U&&(j==null||j())},[U,j]);const H=(ne=S.arrow)==null?void 0:ne.x,me=(ye=S.arrow)==null?void 0:ye.y,ve=((Y=S.arrow)==null?void 0:Y.centerOffset)!==0,[Me,ie]=i.useState();return se(()=>{y&&ie(window.getComputedStyle(y).zIndex)},[y]),u.jsx("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...te,transform:U?te.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Me,"--radix-popper-transform-origin":[(Ce=S.transformOrigin)==null?void 0:Ce.x,(Ft=S.transformOrigin)==null?void 0:Ft.y].join(" "),...((Lt=S.hide)==null?void 0:Lt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:u.jsx(hs,{scope:n,placedSide:x,onArrowChange:I,arrowX:H,arrowY:me,shouldHideArrow:ve,children:u.jsx(B.div,{"data-side":x,"data-align":N,...p,ref:b,style:{...p.style,animation:U?void 0:"none"}})})})});Nn.displayName=St;var An="PopperArrow",ms={top:"bottom",right:"left",bottom:"top",left:"right"},_n=i.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,s=ps(An,r),a=ms[s.placedSide];return u.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:u.jsx(ds,{...o,ref:n,style:{...o.style,display:"block"}})})});_n.displayName=An;function vs(t){return t!==null}var ys=t=>({name:"transformOrigin",options:t,fn(e){var v,y,w;const{placement:n,rects:r,middlewareData:o}=e,a=((v=o.arrow)==null?void 0:v.centerOffset)!==0,c=a?0:t.arrowWidth,d=a?0:t.arrowHeight,[l,f]=jn(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((y=o.arrow)==null?void 0:y.x)??0)+c/2,m=(((w=o.arrow)==null?void 0:w.y)??0)+d/2;let C="",p="";return l==="bottom"?(C=a?h:`${g}px`,p=`${-d}px`):l==="top"?(C=a?h:`${g}px`,p=`${r.floating.height+d}px`):l==="right"?(C=`${-d}px`,p=a?h:`${m}px`):l==="left"&&(C=`${r.floating.width+d}px`,p=a?h:`${m}px`),{data:{x:C,y:p}}}});function jn(t){const[e,n="center"]=t.split("-");return[e,n]}var Cs=Pn,xs=Mn,Ss=Nn,bs=_n,ws="Portal",Fn=i.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[o,s]=i.useState(!1);se(()=>s(!0),[]);const a=n||o&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return a?Qr.createPortal(u.jsx(B.div,{...r,ref:e}),a):null});Fn.displayName=ws;function Es(t,e){return i.useReducer((n,r)=>e[n][r]??n,t)}var Oe=t=>{const{present:e,children:n}=t,r=Ds(e),o=typeof n=="function"?n({present:r.isPresent}):i.Children.only(n),s=$(r.ref,Ts(o));return typeof n=="function"||r.isPresent?i.cloneElement(o,{ref:s}):null};Oe.displayName="Presence";function Ds(t){const[e,n]=i.useState(),r=i.useRef(null),o=i.useRef(t),s=i.useRef("none"),a=t?"mounted":"unmounted",[c,d]=Es(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const l=Ae(r.current);s.current=c==="mounted"?l:"none"},[c]),se(()=>{const l=r.current,f=o.current;if(f!==t){const g=s.current,m=Ae(l);t?d("MOUNT"):m==="none"||(l==null?void 0:l.display)==="none"?d("UNMOUNT"):d(f&&g!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,d]),se(()=>{if(e){let l;const f=e.ownerDocument.defaultView??window,h=m=>{const p=Ae(r.current).includes(m.animationName);if(m.target===e&&p&&(d("ANIMATION_END"),!o.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",l=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},g=m=>{m.target===e&&(s.current=Ae(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{f.clearTimeout(l),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else d("ANIMATION_END")},[e,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(l=>{r.current=l?getComputedStyle(l):null,n(l)},[])}}function Ae(t){return(t==null?void 0:t.animationName)||"none"}function Ts(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Os=gn[" useInsertionEffect ".trim().toString()]||se;function Is({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[o,s,a]=Ps({defaultProp:e,onChange:n}),c=t!==void 0,d=c?t:o;{const f=i.useRef(t!==void 0);i.useEffect(()=>{const h=f.current;h!==c&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const l=i.useCallback(f=>{var h;if(c){const g=Rs(f)?f(t):f;g!==t&&((h=a.current)==null||h.call(a,g))}else s(f)},[c,t,s,a]);return[d,l]}function Ps({defaultProp:t,onChange:e}){const[n,r]=i.useState(t),o=i.useRef(n),s=i.useRef(e);return Os(()=>{s.current=e},[e]),i.useEffect(()=>{var a;o.current!==n&&((a=s.current)==null||a.call(s,n),o.current=n)},[n,o]),[n,r,s]}function Rs(t){return typeof t=="function"}var nt="rovingFocusGroup.onEntryFocus",Ms={bubbles:!1,cancelable:!0},Ie="RovingFocusGroup",[ft,Ln,Ns]=yn(Ie),[As,kn]=Te(Ie,[Ns]),[_s,js]=As(Ie),Un=i.forwardRef((t,e)=>u.jsx(ft.Provider,{scope:t.__scopeRovingFocusGroup,children:u.jsx(ft.Slot,{scope:t.__scopeRovingFocusGroup,children:u.jsx(Fs,{...t,ref:e})})}));Un.displayName=Ie;var Fs=i.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:l,preventScrollOnEntryFocus:f=!1,...h}=t,g=i.useRef(null),m=$(e,g),C=Cn(s),[p,v]=Is({prop:a,defaultProp:c??null,onChange:d,caller:Ie}),[y,w]=i.useState(!1),b=J(l),E=Ln(n),I=i.useRef(!1),[R,T]=i.useState(0);return i.useEffect(()=>{const M=g.current;if(M)return M.addEventListener(nt,b),()=>M.removeEventListener(nt,b)},[b]),u.jsx(_s,{scope:n,orientation:r,dir:C,loop:o,currentTabStopId:p,onItemFocus:i.useCallback(M=>v(M),[v]),onItemShiftTab:i.useCallback(()=>w(!0),[]),onFocusableItemAdd:i.useCallback(()=>T(M=>M+1),[]),onFocusableItemRemove:i.useCallback(()=>T(M=>M-1),[]),children:u.jsx(B.div,{tabIndex:y||R===0?-1:0,"data-orientation":r,...h,ref:m,style:{outline:"none",...t.style},onMouseDown:P(t.onMouseDown,()=>{I.current=!0}),onFocus:P(t.onFocus,M=>{const _=!I.current;if(M.target===M.currentTarget&&_&&!y){const F=new CustomEvent(nt,Ms);if(M.currentTarget.dispatchEvent(F),!F.defaultPrevented){const D=E().filter(V=>V.focusable),A=D.find(V=>V.active),K=D.find(V=>V.id===p),te=[A,K,...D].filter(Boolean).map(V=>V.ref.current);Bn(te,f)}}I.current=!1}),onBlur:P(t.onBlur,()=>w(!1))})})}),Hn="RovingFocusGroupItem",$n=i.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:a,...c}=t,d=us(),l=s||d,f=js(Hn,n),h=f.currentTabStopId===l,g=Ln(n),{onFocusableItemAdd:m,onFocusableItemRemove:C,currentTabStopId:p}=f;return i.useEffect(()=>{if(r)return m(),()=>C()},[r,m,C]),u.jsx(ft.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:u.jsx(B.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:P(t.onMouseDown,v=>{r?f.onItemFocus(l):v.preventDefault()}),onFocus:P(t.onFocus,()=>f.onItemFocus(l)),onKeyDown:P(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=Us(v,f.orientation,f.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let b=g().filter(E=>E.focusable).map(E=>E.ref.current);if(y==="last")b.reverse();else if(y==="prev"||y==="next"){y==="prev"&&b.reverse();const E=b.indexOf(v.currentTarget);b=f.loop?Hs(b,E+1):b.slice(E+1)}setTimeout(()=>Bn(b))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:p!=null}):a})})});$n.displayName=Hn;var Ls={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ks(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Us(t,e,n){const r=ks(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Ls[r]}function Bn(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Hs(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var $s=Un,Bs=$n,Gn=Co(),rt=function(){},Ke=i.forwardRef(function(t,e){var n=i.useRef(null),r=i.useState({onScrollCapture:rt,onWheelCapture:rt,onTouchMoveCapture:rt}),o=r[0],s=r[1],a=t.forwardProps,c=t.children,d=t.className,l=t.removeScrollBar,f=t.enabled,h=t.shards,g=t.sideCar,m=t.noIsolation,C=t.inert,p=t.allowPinchZoom,v=t.as,y=v===void 0?"div":v,w=t.gapMode,b=Jr(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=g,I=xo([n,e]),R=pe(pe({},b),o);return i.createElement(i.Fragment,null,f&&i.createElement(E,{sideCar:Gn,removeScrollBar:l,shards:h,noIsolation:m,inert:C,setCallbacks:s,allowPinchZoom:!!p,lockRef:n,gapMode:w}),a?i.cloneElement(i.Children.only(c),pe(pe({},R),{ref:I})):i.createElement(y,pe({},R,{className:d,ref:I}),c))});Ke.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ke.classNames={fullWidth:bo,zeroRight:So};var gt=!1;if(typeof window<"u")try{var _e=Object.defineProperty({},"passive",{get:function(){return gt=!0,!0}});window.addEventListener("test",_e,_e),window.removeEventListener("test",_e,_e)}catch{gt=!1}var fe=gt?{passive:!1}:!1,Gs=function(t){return t.tagName==="TEXTAREA"},Kn=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Gs(t)&&n[e]==="visible")},Ks=function(t){return Kn(t,"overflowY")},Ws=function(t){return Kn(t,"overflowX")},Yt=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Wn(t,r);if(o){var s=Vn(t,r),a=s[1],c=s[2];if(a>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Vs=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Ys=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Wn=function(t,e){return t==="v"?Ks(e):Ws(e)},Vn=function(t,e){return t==="v"?Vs(e):Ys(e)},Xs=function(t,e){return t==="h"&&e==="rtl"?-1:1},zs=function(t,e,n,r,o){var s=Xs(t,window.getComputedStyle(e).direction),a=s*r,c=n.target,d=e.contains(c),l=!1,f=a>0,h=0,g=0;do{var m=Vn(t,c),C=m[0],p=m[1],v=m[2],y=p-v-s*C;(C||y)&&Wn(t,c)&&(h+=y,g+=C),c instanceof ShadowRoot?c=c.host:c=c.parentNode}while(!d&&c!==document.body||d&&(e.contains(c)||e===c));return(f&&Math.abs(h)<1||!f&&Math.abs(g)<1)&&(l=!0),l},je=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Xt=function(t){return[t.deltaX,t.deltaY]},zt=function(t){return t&&"current"in t?t.current:t},qs=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Zs=function(t){return`
2
2
  .block-interactivity-`.concat(t,` {pointer-events: none;}
3
3
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
4
4
  `)},Qs=0,ge=[];function Js(t){var e=i.useRef([]),n=i.useRef([0,0]),r=i.useRef(),o=i.useState(Qs++)[0],s=i.useState(wo)[0],a=i.useRef(t);i.useEffect(function(){a.current=t},[t]),i.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var p=eo([t.lockRef.current],(t.shards||[]).map(zt),!0).filter(Boolean);return p.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var c=i.useCallback(function(p,v){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!a.current.allowPinchZoom;var y=je(p),w=n.current,b="deltaX"in p?p.deltaX:w[0]-y[0],E="deltaY"in p?p.deltaY:w[1]-y[1],I,R=p.target,T=Math.abs(b)>Math.abs(E)?"h":"v";if("touches"in p&&T==="h"&&R.type==="range")return!1;var M=Yt(T,R);if(!M)return!0;if(M?I=T:(I=T==="v"?"h":"v",M=Yt(T,R)),!M)return!1;if(!r.current&&"changedTouches"in p&&(b||E)&&(r.current=I),!I)return!0;var _=r.current||I;return zs(_,v,p,_==="h"?b:E)},[]),d=i.useCallback(function(p){var v=p;if(!(!ge.length||ge[ge.length-1]!==s)){var y="deltaY"in v?Xt(v):je(v),w=e.current.filter(function(I){return I.name===v.type&&(I.target===v.target||v.target===I.shadowParent)&&qs(I.delta,y)})[0];if(w&&w.should){v.cancelable&&v.preventDefault();return}if(!w){var b=(a.current.shards||[]).map(zt).filter(Boolean).filter(function(I){return I.contains(v.target)}),E=b.length>0?c(v,b[0]):!a.current.noIsolation;E&&v.cancelable&&v.preventDefault()}}},[]),l=i.useCallback(function(p,v,y,w){var b={name:p,delta:v,target:y,should:w,shadowParent:ei(y)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(E){return E!==b})},1)},[]),f=i.useCallback(function(p){n.current=je(p),r.current=void 0},[]),h=i.useCallback(function(p){l(p.type,Xt(p),p.target,c(p,t.lockRef.current))},[]),g=i.useCallback(function(p){l(p.type,je(p),p.target,c(p,t.lockRef.current))},[]);i.useEffect(function(){return ge.push(s),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",d,fe),document.addEventListener("touchmove",d,fe),document.addEventListener("touchstart",f,fe),function(){ge=ge.filter(function(p){return p!==s}),document.removeEventListener("wheel",d,fe),document.removeEventListener("touchmove",d,fe),document.removeEventListener("touchstart",f,fe)}},[]);var m=t.removeScrollBar,C=t.inert;return i.createElement(i.Fragment,null,C?i.createElement(s,{styles:Zs(o)}):null,m?i.createElement(Eo,{gapMode:t.gapMode}):null)}function ei(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const ti=Do(Gn,Js);var Yn=i.forwardRef(function(t,e){return i.createElement(Ke,pe({},t,{ref:e,sideCar:ti}))});Yn.classNames=Ke.classNames;var ht=["Enter"," "],ni=["ArrowDown","PageUp","Home"],Xn=["ArrowUp","PageDown","End"],ri=[...ni,...Xn],oi={ltr:[...ht,"ArrowRight"],rtl:[...ht,"ArrowLeft"]},si={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Pe="Menu",[we,ii,ai]=yn(Pe),[ue,zn]=Te(Pe,[ai,On,kn]),We=On(),qn=kn(),[ci,le]=ue(Pe),[ui,Re]=ue(Pe),Zn=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:s,modal:a=!0}=t,c=We(e),[d,l]=i.useState(null),f=i.useRef(!1),h=J(s),g=Cn(o);return i.useEffect(()=>{const m=()=>{f.current=!0,document.addEventListener("pointerdown",C,{capture:!0,once:!0}),document.addEventListener("pointermove",C,{capture:!0,once:!0})},C=()=>f.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",C,{capture:!0}),document.removeEventListener("pointermove",C,{capture:!0})}},[]),u.jsx(Cs,{...c,children:u.jsx(ci,{scope:e,open:n,onOpenChange:h,content:d,onContentChange:l,children:u.jsx(ui,{scope:e,onClose:i.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:a,children:r})})})};Zn.displayName=Pe;var li="MenuAnchor",bt=i.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=We(n);return u.jsx(xs,{...o,...r,ref:e})});bt.displayName=li;var wt="MenuPortal",[di,Qn]=ue(wt,{forceMount:void 0}),Jn=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:o}=t,s=le(wt,e);return u.jsx(di,{scope:e,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(Fn,{asChild:!0,container:o,children:r})})})};Jn.displayName=wt;var Z="MenuContent",[fi,Et]=ue(Z),er=i.forwardRef((t,e)=>{const n=Qn(Z,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,s=le(Z,t.__scopeMenu),a=Re(Z,t.__scopeMenu);return u.jsx(we.Provider,{scope:t.__scopeMenu,children:u.jsx(Oe,{present:r||s.open,children:u.jsx(we.Slot,{scope:t.__scopeMenu,children:a.modal?u.jsx(gi,{...o,ref:e}):u.jsx(hi,{...o,ref:e})})})})}),gi=i.forwardRef((t,e)=>{const n=le(Z,t.__scopeMenu),r=i.useRef(null),o=$(e,r);return i.useEffect(()=>{const s=r.current;if(s)return To(s)},[]),u.jsx(Dt,{...t,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:P(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),hi=i.forwardRef((t,e)=>{const n=le(Z,t.__scopeMenu);return u.jsx(Dt,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),pi=He("MenuContent.ScrollLock"),Dt=i.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:l,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:m,disableOutsideScroll:C,...p}=t,v=le(Z,n),y=Re(Z,n),w=We(n),b=qn(n),E=ii(n),[I,R]=i.useState(null),T=i.useRef(null),M=$(e,T,v.onContentChange),_=i.useRef(0),F=i.useRef(""),D=i.useRef(0),A=i.useRef(null),K=i.useRef("right"),ee=i.useRef(0),te=C?Yn:i.Fragment,V=C?{as:pi,allowPinchZoom:!0}:void 0,U=x=>{var ne,ye;const N=F.current+x,j=E().filter(Y=>!Y.disabled),H=document.activeElement,me=(ne=j.find(Y=>Y.ref.current===H))==null?void 0:ne.textValue,ve=j.map(Y=>Y.textValue),Me=Oi(ve,N,me),ie=(ye=j.find(Y=>Y.textValue===Me))==null?void 0:ye.ref.current;(function Y(Ce){F.current=Ce,window.clearTimeout(_.current),Ce!==""&&(_.current=window.setTimeout(()=>Y(""),1e3))})(N),ie&&setTimeout(()=>ie.focus())};i.useEffect(()=>()=>window.clearTimeout(_.current),[]),Jo();const S=i.useCallback(x=>{var j,H;return K.current===((j=A.current)==null?void 0:j.side)&&Pi(x,(H=A.current)==null?void 0:H.area)},[]);return u.jsx(fi,{scope:n,searchRef:F,onItemEnter:i.useCallback(x=>{S(x)&&x.preventDefault()},[S]),onItemLeave:i.useCallback(x=>{var N;S(x)||((N=T.current)==null||N.focus(),R(null))},[S]),onTriggerLeave:i.useCallback(x=>{S(x)&&x.preventDefault()},[S]),pointerGraceTimerRef:D,onPointerGraceIntentChange:i.useCallback(x=>{A.current=x},[]),children:u.jsx(te,{...V,children:u.jsx(wn,{asChild:!0,trapped:o,onMountAutoFocus:P(s,x=>{var N;x.preventDefault(),(N=T.current)==null||N.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:u.jsx(Sn,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:l,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:m,children:u.jsx($s,{asChild:!0,...b,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:I,onCurrentTabStopIdChange:R,onEntryFocus:P(d,x=>{y.isUsingKeyboardRef.current||x.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(Ss,{role:"menu","aria-orientation":"vertical","data-state":mr(v.open),"data-radix-menu-content":"",dir:y.dir,...w,...p,ref:M,style:{outline:"none",...p.style},onKeyDown:P(p.onKeyDown,x=>{const j=x.target.closest("[data-radix-menu-content]")===x.currentTarget,H=x.ctrlKey||x.altKey||x.metaKey,me=x.key.length===1;j&&(x.key==="Tab"&&x.preventDefault(),!H&&me&&U(x.key));const ve=T.current;if(x.target!==ve||!ri.includes(x.key))return;x.preventDefault();const ie=E().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);Xn.includes(x.key)&&ie.reverse(),Di(ie)}),onBlur:P(t.onBlur,x=>{x.currentTarget.contains(x.target)||(window.clearTimeout(_.current),F.current="")}),onPointerMove:P(t.onPointerMove,Ee(x=>{const N=x.target,j=ee.current!==x.clientX;if(x.currentTarget.contains(N)&&j){const H=x.clientX>ee.current?"right":"left";K.current=H,ee.current=x.clientX}}))})})})})})})});er.displayName=Z;var mi="MenuGroup",Tt=i.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return u.jsx(B.div,{role:"group",...r,ref:e})});Tt.displayName=mi;var vi="MenuLabel",tr=i.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return u.jsx(B.div,{...r,ref:e})});tr.displayName=vi;var $e="MenuItem",qt="menu.itemSelect",Ve=i.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...o}=t,s=i.useRef(null),a=Re($e,t.__scopeMenu),c=Et($e,t.__scopeMenu),d=$(e,s),l=i.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(qt,{bubbles:!0,cancelable:!0});h.addEventListener(qt,m=>r==null?void 0:r(m),{once:!0}),vn(h,g),g.defaultPrevented?l.current=!1:a.onClose()}};return u.jsx(nr,{...o,ref:d,disabled:n,onClick:P(t.onClick,f),onPointerDown:h=>{var g;(g=t.onPointerDown)==null||g.call(t,h),l.current=!0},onPointerUp:P(t.onPointerUp,h=>{var g;l.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:P(t.onKeyDown,h=>{const g=c.searchRef.current!=="";n||g&&h.key===" "||ht.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Ve.displayName=$e;var nr=i.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=t,a=Et($e,n),c=qn(n),d=i.useRef(null),l=$(e,d),[f,h]=i.useState(!1),[g,m]=i.useState("");return i.useEffect(()=>{const C=d.current;C&&m((C.textContent??"").trim())},[s.children]),u.jsx(we.ItemSlot,{scope:n,disabled:r,textValue:o??g,children:u.jsx(Bs,{asChild:!0,...c,focusable:!r,children:u.jsx(B.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:l,onPointerMove:P(t.onPointerMove,Ee(C=>{r?a.onItemLeave(C):(a.onItemEnter(C),C.defaultPrevented||C.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:P(t.onPointerLeave,Ee(C=>a.onItemLeave(C))),onFocus:P(t.onFocus,()=>h(!0)),onBlur:P(t.onBlur,()=>h(!1))})})})}),yi="MenuCheckboxItem",rr=i.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...o}=t;return u.jsx(cr,{scope:t.__scopeMenu,checked:n,children:u.jsx(Ve,{role:"menuitemcheckbox","aria-checked":Be(n)?"mixed":n,...o,ref:e,"data-state":It(n),onSelect:P(o.onSelect,()=>r==null?void 0:r(Be(n)?!0:!n),{checkForDefaultPrevented:!1})})})});rr.displayName=yi;var or="MenuRadioGroup",[Ci,xi]=ue(or,{value:void 0,onValueChange:()=>{}}),sr=i.forwardRef((t,e)=>{const{value:n,onValueChange:r,...o}=t,s=J(r);return u.jsx(Ci,{scope:t.__scopeMenu,value:n,onValueChange:s,children:u.jsx(Tt,{...o,ref:e})})});sr.displayName=or;var ir="MenuRadioItem",ar=i.forwardRef((t,e)=>{const{value:n,...r}=t,o=xi(ir,t.__scopeMenu),s=n===o.value;return u.jsx(cr,{scope:t.__scopeMenu,checked:s,children:u.jsx(Ve,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":It(s),onSelect:P(r.onSelect,()=>{var a;return(a=o.onValueChange)==null?void 0:a.call(o,n)},{checkForDefaultPrevented:!1})})})});ar.displayName=ir;var Ot="MenuItemIndicator",[cr,Si]=ue(Ot,{checked:!1}),ur=i.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...o}=t,s=Si(Ot,n);return u.jsx(Oe,{present:r||Be(s.checked)||s.checked===!0,children:u.jsx(B.span,{...o,ref:e,"data-state":It(s.checked)})})});ur.displayName=Ot;var bi="MenuSeparator",lr=i.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return u.jsx(B.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});lr.displayName=bi;var wi="MenuArrow",dr=i.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,o=We(n);return u.jsx(bs,{...o,...r,ref:e})});dr.displayName=wi;var Ei="MenuSub",[zu,fr]=ue(Ei),Se="MenuSubTrigger",gr=i.forwardRef((t,e)=>{const n=le(Se,t.__scopeMenu),r=Re(Se,t.__scopeMenu),o=fr(Se,t.__scopeMenu),s=Et(Se,t.__scopeMenu),a=i.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=s,l={__scopeMenu:t.__scopeMenu},f=i.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return i.useEffect(()=>f,[f]),i.useEffect(()=>{const h=c.current;return()=>{window.clearTimeout(h),d(null)}},[c,d]),u.jsx(bt,{asChild:!0,...l,children:u.jsx(nr,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":mr(n.open),...t,ref:mn(e,o.onTriggerChange),onClick:h=>{var g;(g=t.onClick)==null||g.call(t,h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:P(t.onPointerMove,Ee(h=>{s.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:P(t.onPointerLeave,Ee(h=>{var m,C;f();const g=(m=n.content)==null?void 0:m.getBoundingClientRect();if(g){const p=(C=n.content)==null?void 0:C.dataset.side,v=p==="right",y=v?-5:5,w=g[v?"left":"right"],b=g[v?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+y,y:h.clientY},{x:w,y:g.top},{x:b,y:g.top},{x:b,y:g.bottom},{x:w,y:g.bottom}],side:p}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:P(t.onKeyDown,h=>{var m;const g=s.searchRef.current!=="";t.disabled||g&&h.key===" "||oi[r.dir].includes(h.key)&&(n.onOpenChange(!0),(m=n.content)==null||m.focus(),h.preventDefault())})})})});gr.displayName=Se;var hr="MenuSubContent",pr=i.forwardRef((t,e)=>{const n=Qn(Z,t.__scopeMenu),{forceMount:r=n.forceMount,...o}=t,s=le(Z,t.__scopeMenu),a=Re(Z,t.__scopeMenu),c=fr(hr,t.__scopeMenu),d=i.useRef(null),l=$(e,d);return u.jsx(we.Provider,{scope:t.__scopeMenu,children:u.jsx(Oe,{present:r||s.open,children:u.jsx(we.Slot,{scope:t.__scopeMenu,children:u.jsx(Dt,{id:c.contentId,"aria-labelledby":c.triggerId,...o,ref:l,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;a.isUsingKeyboardRef.current&&((h=d.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:P(t.onFocusOutside,f=>{f.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:P(t.onEscapeKeyDown,f=>{a.onClose(),f.preventDefault()}),onKeyDown:P(t.onKeyDown,f=>{var m;const h=f.currentTarget.contains(f.target),g=si[a.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(m=c.trigger)==null||m.focus(),f.preventDefault())})})})})})});pr.displayName=hr;function mr(t){return t?"open":"closed"}function Be(t){return t==="indeterminate"}function It(t){return Be(t)?"indeterminate":t?"checked":"unchecked"}function Di(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Ti(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Oi(t,e,n){const o=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let a=Ti(t,Math.max(s,0));o.length===1&&(a=a.filter(l=>l!==n));const d=a.find(l=>l.toLowerCase().startsWith(o.toLowerCase()));return d!==n?d:void 0}function Ii(t,e){const{x:n,y:r}=t;let o=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const c=e[s],d=e[a],l=c.x,f=c.y,h=d.x,g=d.y;f>r!=g>r&&n<(h-l)*(r-f)/(g-f)+l&&(o=!o)}return o}function Pi(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Ii(n,e)}function Ee(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Ri=Zn,Mi=bt,Ni=Jn,Ai=er,_i=Tt,ji=tr,Fi=Ve,Li=rr,ki=sr,Ui=ar,Hi=ur,$i=lr,Bi=dr,Gi=gr,Ki=pr,Pt="ContextMenu",[Wi,qu]=Te(Pt,[zn]),G=zn(),[Vi,vr]=Wi(Pt),yr=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:o,modal:s=!0}=t,[a,c]=i.useState(!1),d=G(e),l=J(r),f=i.useCallback(h=>{c(h),l(h)},[l]);return u.jsx(Vi,{scope:e,open:a,onOpenChange:f,modal:s,children:u.jsx(Ri,{...d,dir:o,open:a,onOpenChange:f,modal:s,children:n})})};yr.displayName=Pt;var Cr="ContextMenuTrigger",xr=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...o}=t,s=vr(Cr,n),a=G(n),c=i.useRef({x:0,y:0}),d=i.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...c.current})}),l=i.useRef(0),f=i.useCallback(()=>window.clearTimeout(l.current),[]),h=g=>{c.current={x:g.clientX,y:g.clientY},s.onOpenChange(!0)};return i.useEffect(()=>f,[f]),i.useEffect(()=>void(r&&f()),[r,f]),u.jsxs(u.Fragment,{children:[u.jsx(Mi,{...a,virtualRef:d}),u.jsx(B.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...o,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:P(t.onContextMenu,g=>{f(),h(g),g.preventDefault()}),onPointerDown:r?t.onPointerDown:P(t.onPointerDown,Fe(g=>{f(),l.current=window.setTimeout(()=>h(g),700)})),onPointerMove:r?t.onPointerMove:P(t.onPointerMove,Fe(f)),onPointerCancel:r?t.onPointerCancel:P(t.onPointerCancel,Fe(f)),onPointerUp:r?t.onPointerUp:P(t.onPointerUp,Fe(f))})]})});xr.displayName=Cr;var Yi="ContextMenuPortal",Sr=t=>{const{__scopeContextMenu:e,...n}=t,r=G(e);return u.jsx(Ni,{...r,...n})};Sr.displayName=Yi;var br="ContextMenuContent",wr=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=vr(br,n),s=G(n),a=i.useRef(!1);return u.jsx(Ai,{...s,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:c=>{var d;(d=t.onCloseAutoFocus)==null||d.call(t,c),!c.defaultPrevented&&a.current&&c.preventDefault(),a.current=!1},onInteractOutside:c=>{var d;(d=t.onInteractOutside)==null||d.call(t,c),!c.defaultPrevented&&!o.modal&&(a.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});wr.displayName=br;var Xi="ContextMenuGroup",zi=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=G(n);return u.jsx(_i,{...o,...r,ref:e})});zi.displayName=Xi;var qi="ContextMenuLabel",Zi=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=G(n);return u.jsx(ji,{...o,...r,ref:e})});Zi.displayName=qi;var Qi="ContextMenuItem",Er=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=G(n);return u.jsx(Fi,{...o,...r,ref:e})});Er.displayName=Qi;var Ji="ContextMenuCheckboxItem",ea=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=G(n);return u.jsx(Li,{...o,...r,ref:e})});ea.displayName=Ji;var ta="ContextMenuRadioGroup",na=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=G(n);return u.jsx(ki,{...o,...r,ref:e})});na.displayName=ta;var ra="ContextMenuRadioItem",oa=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=G(n);return u.jsx(Ui,{...o,...r,ref:e})});oa.displayName=ra;var sa="ContextMenuItemIndicator",ia=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=G(n);return u.jsx(Hi,{...o,...r,ref:e})});ia.displayName=sa;var aa="ContextMenuSeparator",Dr=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=G(n);return u.jsx($i,{...o,...r,ref:e})});Dr.displayName=aa;var ca="ContextMenuArrow",ua=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=G(n);return u.jsx(Bi,{...o,...r,ref:e})});ua.displayName=ca;var la="ContextMenuSubTrigger",da=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=G(n);return u.jsx(Gi,{...o,...r,ref:e})});da.displayName=la;var fa="ContextMenuSubContent",ga=i.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,o=G(n);return u.jsx(Ki,{...o,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ga.displayName=fa;function Fe(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var ha=yr,pa=xr,ma=Sr,va=wr,Q=Er,Zt=Dr;const Tr=i.createContext({dragDropManager:void 0});function z(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var Qt=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Jt=function(){return Math.random().toString(36).substring(7).split("").join(".")},en={INIT:"@@redux/INIT"+Jt(),REPLACE:"@@redux/REPLACE"+Jt()};function ya(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function Or(t,e,n){var r;if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(z(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(z(1));return n(Or)(t,e)}if(typeof t!="function")throw new Error(z(2));var o=t,s=e,a=[],c=a,d=!1;function l(){c===a&&(c=a.slice())}function f(){if(d)throw new Error(z(3));return s}function h(p){if(typeof p!="function")throw new Error(z(4));if(d)throw new Error(z(5));var v=!0;return l(),c.push(p),function(){if(v){if(d)throw new Error(z(6));v=!1,l();var w=c.indexOf(p);c.splice(w,1),a=null}}}function g(p){if(!ya(p))throw new Error(z(7));if(typeof p.type>"u")throw new Error(z(8));if(d)throw new Error(z(9));try{d=!0,s=o(s,p)}finally{d=!1}for(var v=a=c,y=0;y<v.length;y++){var w=v[y];w()}return p}function m(p){if(typeof p!="function")throw new Error(z(10));o=p,g({type:en.REPLACE})}function C(){var p,v=h;return p={subscribe:function(w){if(typeof w!="object"||w===null)throw new Error(z(11));function b(){w.next&&w.next(f())}b();var E=v(b);return{unsubscribe:E}}},p[Qt]=function(){return this},p}return g({type:en.INIT}),r={dispatch:g,subscribe:h,getState:f,replaceReducer:m},r[Qt]=C,r}function O(t,e,...n){if(Ca()&&e===void 0)throw new Error("invariant requires an error message argument");if(!t){let r;if(e===void 0)r=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let o=0;r=new Error(e.replace(/%s/g,function(){return n[o++]})),r.name="Invariant Violation"}throw r.framesToPop=1,r}}function Ca(){return typeof process<"u"&&!0}function xa(t,e,n){return e.split(".").reduce((r,o)=>r&&r[o]?r[o]:n||null,t)}function Sa(t,e){return t.filter(n=>n!==e)}function Ir(t){return typeof t=="object"}function ba(t,e){const n=new Map,r=s=>{n.set(s,n.has(s)?n.get(s)+1:1)};t.forEach(r),e.forEach(r);const o=[];return n.forEach((s,a)=>{s===1&&o.push(a)}),o}function wa(t,e){return t.filter(n=>e.indexOf(n)>-1)}const Rt="dnd-core/INIT_COORDS",Ye="dnd-core/BEGIN_DRAG",Mt="dnd-core/PUBLISH_DRAG_SOURCE",Xe="dnd-core/HOVER",ze="dnd-core/DROP",qe="dnd-core/END_DRAG";function tn(t,e){return{type:Rt,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}const Ea={type:Rt,payload:{clientOffset:null,sourceClientOffset:null}};function Da(t){return function(n=[],r={publishSource:!0}){const{publishSource:o=!0,clientOffset:s,getSourceClientOffset:a}=r,c=t.getMonitor(),d=t.getRegistry();t.dispatch(tn(s)),Ta(n,c,d);const l=Pa(n,c);if(l==null){t.dispatch(Ea);return}let f=null;if(s){if(!a)throw new Error("getSourceClientOffset must be defined");Oa(a),f=a(l)}t.dispatch(tn(s,f));const g=d.getSource(l).beginDrag(c,l);if(g==null)return;Ia(g),d.pinSource(l);const m=d.getSourceType(l);return{type:Ye,payload:{itemType:m,item:g,sourceId:l,clientOffset:s||null,sourceClientOffset:f||null,isSourcePublic:!!o}}}}function Ta(t,e,n){O(!e.isDragging(),"Cannot call beginDrag while dragging."),t.forEach(function(r){O(n.getSource(r),"Expected sourceIds to be registered.")})}function Oa(t){O(typeof t=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function Ia(t){O(Ir(t),"Item must be an object.")}function Pa(t,e){let n=null;for(let r=t.length-1;r>=0;r--)if(e.canDragSource(t[r])){n=t[r];break}return n}function Ra(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ma(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{},r=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable}))),r.forEach(function(o){Ra(t,o,n[o])})}return t}function Na(t){return function(n={}){const r=t.getMonitor(),o=t.getRegistry();Aa(r),Fa(r).forEach((a,c)=>{const d=_a(a,c,o,r),l={type:ze,payload:{dropResult:Ma({},n,d)}};t.dispatch(l)})}}function Aa(t){O(t.isDragging(),"Cannot call drop while not dragging."),O(!t.didDrop(),"Cannot call drop twice during one drag operation.")}function _a(t,e,n,r){const o=n.getTarget(t);let s=o?o.drop(r,t):void 0;return ja(s),typeof s>"u"&&(s=e===0?{}:r.getDropResult()),s}function ja(t){O(typeof t>"u"||Ir(t),"Drop result must either be an object or undefined.")}function Fa(t){const e=t.getTargetIds().filter(t.canDropOnTarget,t);return e.reverse(),e}function La(t){return function(){const n=t.getMonitor(),r=t.getRegistry();ka(n);const o=n.getSourceId();return o!=null&&(r.getSource(o,!0).endDrag(n,o),r.unpinSource()),{type:qe}}}function ka(t){O(t.isDragging(),"Cannot call endDrag while not dragging.")}function pt(t,e){return e===null?t===null:Array.isArray(t)?t.some(n=>n===e):t===e}function Ua(t){return function(n,{clientOffset:r}={}){Ha(n);const o=n.slice(0),s=t.getMonitor(),a=t.getRegistry(),c=s.getItemType();return Ba(o,a,c),$a(o,s,a),Ga(o,s,a),{type:Xe,payload:{targetIds:o,clientOffset:r||null}}}}function Ha(t){O(Array.isArray(t),"Expected targetIds to be an array.")}function $a(t,e,n){O(e.isDragging(),"Cannot call hover while not dragging."),O(!e.didDrop(),"Cannot call hover after drop.");for(let r=0;r<t.length;r++){const o=t[r];O(t.lastIndexOf(o)===r,"Expected targetIds to be unique in the passed array.");const s=n.getTarget(o);O(s,"Expected targetIds to be registered.")}}function Ba(t,e,n){for(let r=t.length-1;r>=0;r--){const o=t[r],s=e.getTargetType(o);pt(s,n)||t.splice(r,1)}}function Ga(t,e,n){t.forEach(function(r){n.getTarget(r).hover(e,r)})}function Ka(t){return function(){if(t.getMonitor().isDragging())return{type:Mt}}}function Wa(t){return{beginDrag:Da(t),publishDragSource:Ka(t),hover:Ua(t),drop:Na(t),endDrag:La(t)}}class Va{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:n}=this.store;function r(s){return(...a)=>{const c=s.apply(e,a);typeof c<"u"&&n(c)}}const o=Wa(this);return Object.keys(o).reduce((s,a)=>{const c=o[a];return s[a]=r(c),s},{})}dispatch(e){this.store.dispatch(e)}constructor(e,n){this.isSetUp=!1,this.handleRefCountChange=()=>{const r=this.store.getState().refCount>0;this.backend&&(r&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!r&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=n,e.subscribe(this.handleRefCountChange)}}function Ya(t,e){return{x:t.x+e.x,y:t.y+e.y}}function Pr(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Xa(t){const{clientOffset:e,initialClientOffset:n,initialSourceClientOffset:r}=t;return!e||!n||!r?null:Pr(Ya(e,r),n)}function za(t){const{clientOffset:e,initialClientOffset:n}=t;return!e||!n?null:Pr(e,n)}const be=[],Nt=[];be.__IS_NONE__=!0;Nt.__IS_ALL__=!0;function qa(t,e){return t===be?!1:t===Nt||typeof e>"u"?!0:wa(e,t).length>0}class Za{subscribeToStateChange(e,n={}){const{handlerIds:r}=n;O(typeof e=="function","listener must be a function."),O(typeof r>"u"||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let o=this.store.getState().stateId;const s=()=>{const a=this.store.getState(),c=a.stateId;try{c===o||c===o+1&&!qa(a.dirtyHandlerIds,r)||e()}finally{o=c}};return this.store.subscribe(s)}subscribeToOffsetChange(e){O(typeof e=="function","listener must be a function.");let n=this.store.getState().dragOffset;const r=()=>{const o=this.store.getState().dragOffset;o!==n&&(n=o,e())};return this.store.subscribe(r)}canDragSource(e){if(!e)return!1;const n=this.registry.getSource(e);return O(n,`Expected to find a valid source. sourceId=${e}`),this.isDragging()?!1:n.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const n=this.registry.getTarget(e);if(O(n,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;const r=this.registry.getTargetType(e),o=this.getItemType();return pt(r,o)&&n.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;const n=this.registry.getSource(e,!0);if(O(n,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic())return!1;const r=this.registry.getSourceType(e),o=this.getItemType();return r!==o?!1:n.isDragging(this,e)}isOverTarget(e,n={shallow:!1}){if(!e)return!1;const{shallow:r}=n;if(!this.isDragging())return!1;const o=this.registry.getTargetType(e),s=this.getItemType();if(s&&!pt(o,s))return!1;const a=this.getTargetIds();if(!a.length)return!1;const c=a.indexOf(e);return r?c===a.length-1:c>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return Xa(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return za(this.store.getState().dragOffset)}constructor(e,n){this.store=e,this.registry=n}}const nn=typeof global<"u"?global:self,Rr=nn.MutationObserver||nn.WebKitMutationObserver;function Mr(t){return function(){const n=setTimeout(o,0),r=setInterval(o,50);function o(){clearTimeout(n),clearInterval(r),t()}}}function Qa(t){let e=1;const n=new Rr(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}const Ja=typeof Rr=="function"?Qa:Mr;class ec{enqueueTask(e){const{queue:n,requestFlush:r}=this;n.length||(r(),this.flushing=!0),n[n.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const n=this.index;if(this.index++,e[n].call(),this.index>this.capacity){for(let r=0,o=e.length-this.index;r<o;r++)e[r]=e[r+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=Ja(this.flush),this.requestErrorThrow=Mr(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class tc{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,n){this.onError=e,this.release=n,this.task=null}}class nc{create(e){const n=this.freeTasks,r=n.length?n.pop():new tc(this.onError,o=>n[n.length]=o);return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}const Nr=new ec,rc=new nc(Nr.registerPendingError);function oc(t){Nr.enqueueTask(rc.create(t))}const At="dnd-core/ADD_SOURCE",_t="dnd-core/ADD_TARGET",jt="dnd-core/REMOVE_SOURCE",Ze="dnd-core/REMOVE_TARGET";function sc(t){return{type:At,payload:{sourceId:t}}}function ic(t){return{type:_t,payload:{targetId:t}}}function ac(t){return{type:jt,payload:{sourceId:t}}}function cc(t){return{type:Ze,payload:{targetId:t}}}function uc(t){O(typeof t.canDrag=="function","Expected canDrag to be a function."),O(typeof t.beginDrag=="function","Expected beginDrag to be a function."),O(typeof t.endDrag=="function","Expected endDrag to be a function.")}function lc(t){O(typeof t.canDrop=="function","Expected canDrop to be a function."),O(typeof t.hover=="function","Expected hover to be a function."),O(typeof t.drop=="function","Expected beginDrag to be a function.")}function mt(t,e){if(e&&Array.isArray(t)){t.forEach(n=>mt(n,!1));return}O(typeof t=="string"||typeof t=="symbol",e?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var q;(function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"})(q||(q={}));let dc=0;function fc(){return dc++}function gc(t){const e=fc().toString();switch(t){case q.SOURCE:return`S${e}`;case q.TARGET:return`T${e}`;default:throw new Error(`Unknown Handler Role: ${t}`)}}function rn(t){switch(t[0]){case"S":return q.SOURCE;case"T":return q.TARGET;default:throw new Error(`Cannot parse handler ID: ${t}`)}}function on(t,e){const n=t.entries();let r=!1;do{const{done:o,value:[,s]}=n.next();if(s===e)return!0;r=!!o}while(!r);return!1}class hc{addSource(e,n){mt(e),uc(n);const r=this.addHandler(q.SOURCE,e,n);return this.store.dispatch(sc(r)),r}addTarget(e,n){mt(e,!0),lc(n);const r=this.addHandler(q.TARGET,e,n);return this.store.dispatch(ic(r)),r}containsHandler(e){return on(this.dragSources,e)||on(this.dropTargets,e)}getSource(e,n=!1){return O(this.isSourceId(e),"Expected a valid source ID."),n&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return O(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return O(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return O(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return rn(e)===q.SOURCE}isTargetId(e){return rn(e)===q.TARGET}removeSource(e){O(this.getSource(e),"Expected an existing source."),this.store.dispatch(ac(e)),oc(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){O(this.getTarget(e),"Expected an existing target."),this.store.dispatch(cc(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const n=this.getSource(e);O(n,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=n}unpinSource(){O(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,n,r){const o=gc(e);return this.types.set(o,n),e===q.SOURCE?this.dragSources.set(o,r):e===q.TARGET&&this.dropTargets.set(o,r),o}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const pc=(t,e)=>t===e;function mc(t,e){return!t&&!e?!0:!t||!e?!1:t.x===e.x&&t.y===e.y}function vc(t,e,n=pc){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!n(t[r],e[r]))return!1;return!0}function yc(t=be,e){switch(e.type){case Xe:break;case At:case _t:case Ze:case jt:return be;case Ye:case Mt:case qe:case ze:default:return Nt}const{targetIds:n=[],prevTargetIds:r=[]}=e.payload,o=ba(n,r);if(!(o.length>0||!vc(n,r)))return be;const a=r[r.length-1],c=n[n.length-1];return a!==c&&(a&&o.push(a),c&&o.push(c)),o}function Cc(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{},r=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable}))),r.forEach(function(o){Cc(t,o,n[o])})}return t}const sn={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Sc(t=sn,e){const{payload:n}=e;switch(e.type){case Rt:case Ye:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case Xe:return mc(t.clientOffset,n.clientOffset)?t:xc({},t,{clientOffset:n.clientOffset});case qe:case ze:return sn;default:return t}}function bc(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function he(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{},r=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable}))),r.forEach(function(o){bc(t,o,n[o])})}return t}const wc={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Ec(t=wc,e){const{payload:n}=e;switch(e.type){case Ye:return he({},t,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case Mt:return he({},t,{isSourcePublic:!0});case Xe:return he({},t,{targetIds:n.targetIds});case Ze:return t.targetIds.indexOf(n.targetId)===-1?t:he({},t,{targetIds:Sa(t.targetIds,n.targetId)});case ze:return he({},t,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case qe:return he({},t,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return t}}function Dc(t=0,e){switch(e.type){case At:case _t:return t+1;case jt:case Ze:return t-1;default:return t}}function Tc(t=0){return t+1}function Oc(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ic(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{},r=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable}))),r.forEach(function(o){Oc(t,o,n[o])})}return t}function Pc(t={},e){return{dirtyHandlerIds:yc(t.dirtyHandlerIds,{type:e.type,payload:Ic({},e.payload,{prevTargetIds:xa(t,"dragOperation.targetIds",[])})}),dragOffset:Sc(t.dragOffset,e),refCount:Dc(t.refCount,e),dragOperation:Ec(t.dragOperation,e),stateId:Tc(t.stateId)}}function Rc(t,e=void 0,n={},r=!1){const o=Mc(r),s=new Za(o,new hc(o)),a=new Va(o,s),c=t(a,e,n);return a.receiveBackend(c),a}function Mc(t){const e=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Or(Pc,t&&e&&e({name:"dnd-core",instanceId:"dnd-core"}))}function Nc(t,e){if(t==null)return{};var n=Ac(t,e),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(o=0;o<s.length;o++)r=s[o],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Ac(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,s;for(s=0;s<r.length;s++)o=r[s],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}let an=0;const Ue=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var _c=i.memo(function(e){var{children:n}=e,r=Nc(e,["children"]);const[o,s]=jc(r);return i.useEffect(()=>{if(s){const a=Ar();return++an,()=>{--an===0&&(a[Ue]=null)}}},[]),u.jsx(Tr.Provider,{value:o,children:n})});function jc(t){if("manager"in t)return[{dragDropManager:t.manager},!1];const e=Fc(t.backend,t.context,t.options,t.debugMode),n=!t.context;return[e,n]}function Fc(t,e=Ar(),n,r){const o=e;return o[Ue]||(o[Ue]={dragDropManager:Rc(t,e,n,r)}),o[Ue]}function Ar(){return typeof global<"u"?global:window}var ot,cn;function Lc(){return cn||(cn=1,ot=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var a=s[o];if(!t(e[a],n[a]))return!1}return!0}return e!==e&&n!==n}),ot}var kc=Lc();const Uc=to(kc),ae=typeof window<"u"?i.useLayoutEffect:i.useEffect;function _r(t,e,n){const[r,o]=i.useState(()=>e(t)),s=i.useCallback(()=>{const a=e(t);Uc(r,a)||(o(a),n&&n())},[r,t,n]);return ae(s),[r,s]}function Hc(t,e,n){const[r,o]=_r(t,e,n);return ae(function(){const a=t.getHandlerId();if(a!=null)return t.subscribeToStateChange(o,{handlerIds:[a]})},[t,o]),r}function jr(t,e,n){return Hc(e,t||(()=>({})),()=>n.reconnect())}function Fr(t,e){const n=[...e||[]];return e==null&&typeof t!="function"&&n.push(t),i.useMemo(()=>typeof t=="function"?t():t,n)}function $c(t){return i.useMemo(()=>t.hooks.dragSource(),[t])}function Bc(t){return i.useMemo(()=>t.hooks.dragPreview(),[t])}let st=!1,it=!1;class Gc{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){O(!st,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return st=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{st=!1}}isDragging(){if(!this.sourceId)return!1;O(!it,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return it=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{it=!1}}subscribeToStateChange(e,n){return this.internalMonitor.subscribeToStateChange(e,n)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,n){return this.internalMonitor.isOverTarget(e,n)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}let at=!1;class Kc{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,n){return this.internalMonitor.subscribeToStateChange(e,n)}canDrop(){if(!this.targetId)return!1;O(!at,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return at=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{at=!1}}isOver(e){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,e):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}function Wc(t,e,n){const r=n.getRegistry(),o=r.addTarget(t,e);return[o,()=>r.removeTarget(o)]}function Vc(t,e,n){const r=n.getRegistry(),o=r.addSource(t,e);return[o,()=>r.removeSource(o)]}function vt(t,e,n,r){let o;if(o!==void 0)return!!o;if(t===e)return!0;if(typeof t!="object"||!t||typeof e!="object"||!e)return!1;const s=Object.keys(t),a=Object.keys(e);if(s.length!==a.length)return!1;const c=Object.prototype.hasOwnProperty.bind(e);for(let d=0;d<s.length;d++){const l=s[d];if(!c(l))return!1;const f=t[l],h=e[l];if(o=void 0,o===!1||o===void 0&&f!==h)return!1}return!0}function yt(t){return t!==null&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function Yc(t){if(typeof t.type=="string")return;const e=t.type.displayName||t.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${e} into a <div>, or turn it into a drag source or a drop target itself.`)}function Xc(t){return(e=null,n=null)=>{if(!i.isValidElement(e)){const s=e;return t(s,n),s}const r=e;return Yc(r),zc(r,n?s=>t(s,n):t)}}function Lr(t){const e={};return Object.keys(t).forEach(n=>{const r=t[n];if(n.endsWith("Ref"))e[n]=t[n];else{const o=Xc(r);e[n]=()=>o}}),e}function un(t,e){typeof t=="function"?t(e):t.current=e}function zc(t,e){const n=t.ref;return O(typeof n!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?i.cloneElement(t,{ref:r=>{un(n,r),un(e,r)}}):i.cloneElement(t,{ref:e})}class qc{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return n&&this.disconnectDragSource(),this.handlerId?e?(n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),n):(this.lastConnectedDragSource=e,n):n}reconnectDragPreview(e=!1){const n=this.dragPreview,r=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(r&&this.disconnectDragPreview(),!!this.handlerId){if(!n){this.lastConnectedDragPreview=n;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=n,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,n,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!vt(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!vt(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=Lr({dragSource:(n,r)=>{this.clearDragSource(),this.dragSourceOptions=r||null,yt(n)?this.dragSourceRef=n:this.dragSourceNode=n,this.reconnectDragSource()},dragPreview:(n,r)=>{this.clearDragPreview(),this.dragPreviewOptions=r||null,yt(n)?this.dragPreviewRef=n:this.dragPreviewNode=n,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}class Zc{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const n=this.dropTarget;if(this.handlerId){if(!n){this.lastConnectedDropTarget=n;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions))}}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!vt(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=Lr({dropTarget:(n,r)=>{this.clearDropTarget(),this.dropTargetOptions=r,yt(n)?this.dropTargetRef=n:this.dropTargetNode=n,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}function de(){const{dragDropManager:t}=i.useContext(Tr);return O(t!=null,"Expected drag drop context"),t}function Qc(t,e){const n=de(),r=i.useMemo(()=>new qc(n.getBackend()),[n]);return ae(()=>(r.dragSourceOptions=t||null,r.reconnect(),()=>r.disconnectDragSource()),[r,t]),ae(()=>(r.dragPreviewOptions=e||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,e]),r}function Jc(){const t=de();return i.useMemo(()=>new Gc(t),[t])}class eu{beginDrag(){const e=this.spec,n=this.monitor;let r=null;return typeof e.item=="object"?r=e.item:typeof e.item=="function"?r=e.item(n):r={},r??null}canDrag(){const e=this.spec,n=this.monitor;return typeof e.canDrag=="boolean"?e.canDrag:typeof e.canDrag=="function"?e.canDrag(n):!0}isDragging(e,n){const r=this.spec,o=this.monitor,{isDragging:s}=r;return s?s(o):n===e.getSourceId()}endDrag(){const e=this.spec,n=this.monitor,r=this.connector,{end:o}=e;o&&o(n.getItem(),n),r.reconnect()}constructor(e,n,r){this.spec=e,this.monitor=n,this.connector=r}}function tu(t,e,n){const r=i.useMemo(()=>new eu(t,e,n),[e,n]);return i.useEffect(()=>{r.spec=t},[t]),r}function nu(t){return i.useMemo(()=>{const e=t.type;return O(e!=null,"spec.type must be defined"),e},[t])}function ru(t,e,n){const r=de(),o=tu(t,e,n),s=nu(t);ae(function(){if(s!=null){const[c,d]=Vc(s,o,r);return e.receiveHandlerId(c),n.receiveHandlerId(c),d}},[r,e,n,o,s])}function kr(t,e){const n=Fr(t,e);O(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const r=Jc(),o=Qc(n.options,n.previewOptions);return ru(n,r,o),[jr(n.collect,r,o),$c(o),Bc(o)]}function ou(t){const n=de().getMonitor(),[r,o]=_r(n,t);return i.useEffect(()=>n.subscribeToOffsetChange(o)),i.useEffect(()=>n.subscribeToStateChange(o)),r}function su(t){return i.useMemo(()=>t.hooks.dropTarget(),[t])}function iu(t){const e=de(),n=i.useMemo(()=>new Zc(e.getBackend()),[e]);return ae(()=>(n.dropTargetOptions=t||null,n.reconnect(),()=>n.disconnectDropTarget()),[t]),n}function au(){const t=de();return i.useMemo(()=>new Kc(t),[t])}function cu(t){const{accept:e}=t;return i.useMemo(()=>(O(t.accept!=null,"accept must be defined"),Array.isArray(e)?e:[e]),[e])}class uu{canDrop(){const e=this.spec,n=this.monitor;return e.canDrop?e.canDrop(n.getItem(),n):!0}hover(){const e=this.spec,n=this.monitor;e.hover&&e.hover(n.getItem(),n)}drop(){const e=this.spec,n=this.monitor;if(e.drop)return e.drop(n.getItem(),n)}constructor(e,n){this.spec=e,this.monitor=n}}function lu(t,e){const n=i.useMemo(()=>new uu(t,e),[e]);return i.useEffect(()=>{n.spec=t},[t]),n}function du(t,e,n){const r=de(),o=lu(t,e),s=cu(t);ae(function(){const[c,d]=Wc(s,o,r);return e.receiveHandlerId(c),n.receiveHandlerId(c),d},[r,e,o,n,s.map(a=>a.toString()).join("|")])}function fu(t,e){const n=Fr(t,e),r=au(),o=iu(n.options);return du(n,r,o),[jr(n.collect,r,o),su(o)]}function Ur(t){let e=null;return()=>(e==null&&(e=t()),e)}function gu(t,e){return t.filter(n=>n!==e)}function hu(t,e){const n=new Set,r=s=>n.add(s);t.forEach(r),e.forEach(r);const o=[];return n.forEach(s=>o.push(s)),o}class pu{enter(e){const n=this.entered.length,r=o=>this.isNodeInDocument(o)&&(!o.contains||o.contains(e));return this.entered=hu(this.entered.filter(r),[e]),n===0&&this.entered.length>0}leave(e){const n=this.entered.length;return this.entered=gu(this.entered.filter(this.isNodeInDocument),e),n>0&&this.entered.length===0}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class mu{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null}})})}loadDataTransfer(e){if(e){const n={};Object.keys(this.config.exposeProperties).forEach(r=>{const o=this.config.exposeProperties[r];o!=null&&(n[r]={value:o(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,n)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,n){return n===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}const Hr="__NATIVE_FILE__",$r="__NATIVE_URL__",Br="__NATIVE_TEXT__",Gr="__NATIVE_HTML__",ln=Object.freeze(Object.defineProperty({__proto__:null,FILE:Hr,HTML:Gr,TEXT:Br,URL:$r},Symbol.toStringTag,{value:"Module"}));function ct(t,e,n){const r=e.reduce((o,s)=>o||t.getData(s),"");return r??n}const Ct={[Hr]:{exposeProperties:{files:t=>Array.prototype.slice.call(t.files),items:t=>t.items,dataTransfer:t=>t},matchesTypes:["Files"]},[Gr]:{exposeProperties:{html:(t,e)=>ct(t,e,""),dataTransfer:t=>t},matchesTypes:["Html","text/html"]},[$r]:{exposeProperties:{urls:(t,e)=>ct(t,e,"").split(`
@@ -1 +1 @@
1
- import{a as n,j as e,i as r}from"./index-C22hdM_h.js";function i(){const s=n(t=>t.version);return e.jsxs("footer",{className:"px-2 py-1 text-xs flex justify-between",children:[e.jsx("span",{children:r(s)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"hidden sm:inline",children:"SQLMesh: "}),e.jsx("span",{title:"SQLMesh Version",className:"font-black inline-block mr-4",children:s})]})}),e.jsxs("small",{className:"text-xs",children:["© ",new Date().getFullYear()," ",e.jsx("a",{href:"https://tobikodata.com/",target:"_blank",rel:"noopener noreferrer",className:"underline",title:"Tobiko Data website",children:"Tobiko Data, Inc."}),"  All rights reserved."]})]})}export{i as default};
1
+ import{a as n,j as e,i as r}from"./index-Dqo42q_-.js";function i(){const s=n(t=>t.version);return e.jsxs("footer",{className:"px-2 py-1 text-xs flex justify-between",children:[e.jsx("span",{children:r(s)&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"hidden sm:inline",children:"SQLMesh: "}),e.jsx("span",{title:"SQLMesh Version",className:"font-black inline-block mr-4",children:s})]})}),e.jsxs("small",{className:"text-xs",children:["© ",new Date().getFullYear()," ",e.jsx("a",{href:"https://tobikodata.com/",target:"_blank",rel:"noopener noreferrer",className:"underline",title:"Tobiko Data website",children:"Tobiko Data, Inc."}),"  All rights reserved."]})]})}export{i as default};