sqlmesh 0.181.2.dev25__py3-none-any.whl → 0.181.2.dev26__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.
- sqlmesh/_version.py +2 -2
- {sqlmesh-0.181.2.dev25.dist-info → sqlmesh-0.181.2.dev26.dist-info}/METADATA +1 -1
- {sqlmesh-0.181.2.dev25.dist-info → sqlmesh-0.181.2.dev26.dist-info}/RECORD +50 -50
- web/client/dist/assets/Audits-CQSghR1z.js +1 -0
- web/client/dist/assets/Banner-B0bpqtD_.js +1 -0
- web/client/dist/assets/{ChevronDownIcon-Clb0EegJ.js → ChevronDownIcon-BCSgClK9.js} +1 -1
- web/client/dist/assets/{ChevronRightIcon-dJMaxBt0.js → ChevronRightIcon-Bcz9goZS.js} +1 -1
- web/client/dist/assets/Content-BhpD1QIh.js +10 -0
- web/client/dist/assets/Content-DcS8joWy.js +1 -0
- web/client/dist/assets/Data-Cx_yMlp4.js +1 -0
- web/client/dist/assets/{DataCatalog-DOMFDv-k.js → DataCatalog-HXtPC12m.js} +1 -1
- web/client/dist/assets/{Editor-BcrLy189.js → Editor-DOjTVzHs.js} +1 -1
- web/client/dist/assets/Editor-DlcCcxAF.js +1 -0
- web/client/dist/assets/Errors-RKQ2D8gd.js +1 -0
- web/client/dist/assets/FileExplorer-CstWOCnn.js +2 -0
- web/client/dist/assets/{Footer-CrjZJkj4.js → Footer-CpMoFxgd.js} +1 -1
- web/client/dist/assets/{Header-DE3bKMcG.js → Header-mC2S0YQz.js} +1 -1
- web/client/dist/assets/Input-BmfZ-VnW.js +41 -0
- web/client/dist/assets/Lineage-VCDzvguV.js +1 -0
- web/client/dist/assets/ListboxShow-CVN-1wre.js +1 -0
- web/client/dist/assets/ModelLineage-DxdKn0Xe.js +1 -0
- web/client/dist/assets/Models-BMTG-GKX.js +1 -0
- web/client/dist/assets/{Page-KC6UG65M.js → Page-DrM7FMiZ.js} +1 -1
- web/client/dist/assets/{Plan-xbMFAnVh.js → Plan-Cwr9Ts3u.js} +1 -1
- web/client/dist/assets/PlusCircleIcon-DPJ5E9WX.js +1 -0
- web/client/dist/assets/ReportErrors-DXdPHMbP.js +1 -0
- web/client/dist/assets/Root-DyEjo8XJ.js +1 -0
- web/client/dist/assets/{SearchList-BShQn9jm.js → SearchList-CJR2axiJ.js} +1 -1
- web/client/dist/assets/SelectEnvironment-BhhJ4ZjZ.js +2 -0
- web/client/dist/assets/{SourceList-DQ72TcK1.js → SourceList-CXyYEJjr.js} +1 -1
- web/client/dist/assets/{SourceListItem-CncMnWed.js → SourceListItem-DVQwSGMy.js} +1 -1
- web/client/dist/assets/{SplitPane-BY85POxQ.js → SplitPane-B5WJSZPo.js} +1 -1
- web/client/dist/assets/Tests-BjGO6Jnt.js +1 -0
- web/client/dist/assets/{Welcome-Blok6Zy8.js → Welcome-DMIPcEFX.js} +1 -1
- web/client/dist/assets/{context-Dx2o1ZRq.js → context-DeHggMKx.js} +1 -1
- web/client/dist/assets/context-Dwh4I8fp.js +1 -0
- web/client/dist/assets/{editor-Dj_6cws7.js → editor-intN6ort.js} +1 -1
- web/client/dist/assets/file-ZamfLSgo.js +1 -0
- web/client/dist/assets/floating-ui.react-dom-dR28niet.js +1 -0
- web/client/dist/assets/{help-Bolb6haG.js → help-BzkjAMMJ.js} +1 -1
- web/client/dist/assets/{index-DQbKL5-Q.js → index-BObtdpsN.js} +1 -1
- web/client/dist/assets/{index-CkIQhGgw.js → index-EyUZDtV7.js} +1 -1
- web/client/dist/assets/plan-gWbTulhw.js +1 -0
- web/client/dist/assets/popover-CA0_-cE5.js +13 -0
- web/client/dist/assets/{project-XFpF0AcJ.js → project-BX-rNI7d.js} +1 -1
- web/client/dist/index.html +1 -1
- web/client/dist/assets/Audits-9LEBiRIZ.js +0 -1
- web/client/dist/assets/Banner-Cd1C5Udq.js +0 -1
- web/client/dist/assets/Content-BR4S-QHM.js +0 -1
- web/client/dist/assets/Content-poZFtj-2.js +0 -10
- web/client/dist/assets/Data-DaQiUe8h.js +0 -1
- web/client/dist/assets/Editor-BmDyTaeT.js +0 -1
- web/client/dist/assets/Errors-Cjh1BMUt.js +0 -1
- web/client/dist/assets/FileExplorer-Cdh0DRgS.js +0 -2
- web/client/dist/assets/Input-BY5Rc3go.js +0 -41
- web/client/dist/assets/Lineage-CLoHrLAT.js +0 -1
- web/client/dist/assets/ListboxShow-TFvq9fMB.js +0 -1
- web/client/dist/assets/ModelLineage-CB8Rie_r.js +0 -1
- web/client/dist/assets/Models-DXUrmUm_.js +0 -1
- web/client/dist/assets/PlusCircleIcon-CoFMRFQI.js +0 -1
- web/client/dist/assets/ReportErrors-mVM8O5iE.js +0 -1
- web/client/dist/assets/Root-BuQJ2VAg.js +0 -1
- web/client/dist/assets/SelectEnvironment-8p6ZQ-QH.js +0 -2
- web/client/dist/assets/Tests-DeaITzzp.js +0 -1
- web/client/dist/assets/context-B3nwRpP1.js +0 -1
- web/client/dist/assets/file-Bs2Eq56_.js +0 -1
- web/client/dist/assets/index-COQuzlwN.js +0 -1
- web/client/dist/assets/plan-BZyi7OFv.js +0 -1
- web/client/dist/assets/transition-B5aHgz_j.js +0 -4
- {sqlmesh-0.181.2.dev25.dist-info → sqlmesh-0.181.2.dev26.dist-info}/WHEEL +0 -0
- {sqlmesh-0.181.2.dev25.dist-info → sqlmesh-0.181.2.dev26.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.181.2.dev25.dist-info → sqlmesh-0.181.2.dev26.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.181.2.dev25.dist-info → sqlmesh-0.181.2.dev26.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var N=Object.defineProperty;var I=(u,r,t)=>r in u?N(u,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[r]=t;var a=(u,r,t)=>I(u,typeof r!="symbol"?r+"":r,t);import{$ as F,q as x,b as f,v as l,f as R,A as w,C as v,i as p,g as V,a0 as D}from"./index-EyUZDtV7.js";const s={Done:"done",Run:"run",Running:"running",RunningTask:"running-task",ApplyVirtual:"apply-virtual",ApplyBackfill:"apply-backfill",ApplyChangesAndBackfill:"apply-changes-and-backfill",ApplyMetadata:"apply-metadata",Applying:"applying",Cancelling:"cancelling"};class O extends F{constructor(t){super(t!=null&&t.isModel?t.initial:{...t,value:(t==null?void 0:t.value)??s.Run});a(this,"_value");this._value=(t==null?void 0:t.value)??this.initial.value}get value(){return this._value}get isRun(){return this.value===s.Run}get isDone(){return this.value===s.Done}get isApplyVirtual(){return this.value===s.ApplyVirtual}get isApplyBackfill(){return this.value===s.ApplyBackfill}get isApplyChangesAndBackfill(){return this.value===s.ApplyChangesAndBackfill}get isApplyMetadata(){return this.value===s.ApplyMetadata}get isApply(){return this.isApplyVirtual||this.isApplyBackfill||this.isApplyChangesAndBackfill||this.isApplyMetadata}get isCancelling(){return this.value===s.Cancelling}get isApplying(){return this.value===s.Applying}get isRunning(){return x([s.Running,s.RunningTask],this.value)}get isRunningTask(){return this.value===s.RunningTask}get isProcessing(){return this.isRunning||this.isApplying||this.isCancelling}get isIdle(){return f(this.isProcessing)}displayStatus(t){return this.isCancelling?"Cancelling Plan...":this.isApplying?"Applying Plan...":this.isRunning&&l(t.hasChanges)?"Getting Changes...":this.isRunning&&l(t.hasBackfills)?"Getting Backfills...":this.isRunning?"Checking Plan...":this.isRunningTask?"Running Task...":"Plan"}static getActionDisplayName(t,e=[],i="Plan"){if(!e.includes(t.value))return i;let n;switch(t.value){case s.Done:n="Done";break;case s.Running:n="Running...";break;case s.RunningTask:n="Running Task...";break;case s.Applying:n="Applying...";break;case s.Cancelling:n="Cancelling...";break;case s.Run:n="Plan";break;case s.ApplyChangesAndBackfill:n="Apply Changes And Backfill";break;case s.ApplyVirtual:n="Apply Virtual Update";break;case s.ApplyBackfill:n="Apply And Backfill";break;case s.ApplyMetadata:n="Apply Metadata";break;default:n=i;break}return n}static getPlanAction({planOverview:t,planApply:e,planCancel:i}){const n=t.isRunning,c=e.isRunning,h=i.isRunning,d=e.isFinished&&t.isFinished||i.isFinished;return i.isEmpty&&e.isEmpty&&t.isEmpty?s.Run:h?s.Cancelling:c?s.Applying:n?s.Running:d?s.Done:t.isVirtualUpdate?s.ApplyVirtual:t.isMetadataUpdate?s.ApplyMetadata:t.isBackfillUpdate?s.ApplyBackfill:t.isChangesAndBackfillUpdate?s.ApplyChangesAndBackfill:s.Done}}class U extends F{constructor(t){super(t==null?void 0:t.initial);a(this,"_current");a(this,"_isFetching",!1);this._current=t==null?void 0:t._current,this._isFetching=(t==null?void 0:t._isFetching)??!1}get current(){return this._current}get environment(){var t;return(t=this.current)==null?void 0:t.environment}get meta(){var t;return(t=this.current)==null?void 0:t.meta}get plan_options(){var t;return(t=this.current)==null?void 0:t.plan_options}get start(){var t;return(t=this.current)==null?void 0:t.start}get end(){var t;return(t=this.current)==null?void 0:t.end}get duration(){var t;return((t=this==null?void 0:this.meta)==null?void 0:t.duration)??-1}get isFinished(){var t,e,i,n;return R((e=(t=this.current)==null?void 0:t.meta)==null?void 0:e.done)&&((n=(i=this.current)==null?void 0:i.meta)==null?void 0:n.status)!==w.init&&f(this.isFetching)}get isRunning(){var t,e,i,n;return v((e=(t=this.current)==null?void 0:t.meta)==null?void 0:e.done)&&((n=(i=this.current)==null?void 0:i.meta)==null?void 0:n.status)===w.init||this.isFetching}get isSuccessful(){var t,e;return this.isFinished&&((e=(t=this.current)==null?void 0:t.meta)==null?void 0:e.status)===w.success}get isFailed(){var t,e,i;return this.isFinished&&(l((t=this.current)==null?void 0:t.meta)||((i=(e=this.current)==null?void 0:e.meta)==null?void 0:i.status)===w.fail)}get isEmpty(){return l(this.current)}get isFetching(){return this._isFetching}set isFetching(t){this._isFetching=t}reset(){this._current=void 0}}class o extends F{constructor(t){var e,i;super(t);a(this,"name");a(this,"view_name");a(this,"node_type");a(this,"change_category");a(this,"diff");a(this,"indirect");a(this,"batches");a(this,"direct");a(this,"completed");a(this,"end");a(this,"interval");a(this,"start");a(this,"total");this.name=encodeURI(this.initial.name),this.view_name=encodeURI(this.initial.view_name),this.node_type=this.initial.node_type,this.change_category=this.initial.change_category,this.diff=this.initial.diff,this.batches=this.initial.batches,this.interval=this.initial.interval,this.start=this.initial.start,this.total=this.initial.total,this.completed=this.initial.completed,this.end=this.initial.end,this.indirect=(e=this.initial.indirect)==null?void 0:e.map(n=>new o(n)),this.direct=(i=this.initial.direct)==null?void 0:i.map(n=>new o(n))}get nodeType(){return this.node_type}get viewName(){return this.view_name}get displayName(){return decodeURI(this.name)}get displayViewName(){return decodeURI(this.view_name)}get changeCategory(){return this.change_category}}class k extends U{constructor(t){super(t);a(this,"_last");a(this,"_planOverview");a(this,"_lastPlanOverview");p(t)&&t.isModel&&(this._current=t._current,this._last=t._last,this._planOverview=t._planOverview,this._lastPlanOverview=t._lastPlanOverview)}get current(){return this._current??this._last}get environment(){var t,e;return((t=this._last)==null?void 0:t.environment)??((e=this._current)==null?void 0:e.environment)}get meta(){var t,e;return((t=this._last)==null?void 0:t.meta)??((e=this._current)==null?void 0:e.meta)}get plan_options(){var t,e;return((t=this._last)==null?void 0:t.plan_options)??((e=this._current)==null?void 0:e.plan_options)}get start(){var t,e;return((t=this._last)==null?void 0:t.start)??((e=this._current)==null?void 0:e.start)}get end(){var t,e;return((t=this._last)==null?void 0:t.end)??((e=this._current)==null?void 0:e.end)}get overview(){return this._lastPlanOverview??this._planOverview}get backfills(){var t;return((t=this.overview)==null?void 0:t.backfills)??[]}get added(){var t;return((t=this.overview)==null?void 0:t.added)??[]}get removed(){var t;return((t=this.overview)==null?void 0:t.removed)??[]}get direct(){var t;return((t=this.overview)==null?void 0:t.direct)??[]}get indirect(){var t;return((t=this.overview)==null?void 0:t.indirect)??[]}get metadata(){var t;return((t=this.overview)==null?void 0:t.metadata)??[]}get tasks(){var e,i,n,c;const t=((i=(e=this._last)==null?void 0:e.backfill)==null?void 0:i.tasks)??((c=(n=this._current)==null?void 0:n.backfill)==null?void 0:c.tasks)??{};return Object.entries(t??{}).reduce((h,[d,_])=>(h[encodeURI(d)]=new o(_),h),{})}get queue(){var t,e;return((e=(t=this.stageBackfill)==null?void 0:t.queue)==null?void 0:e.map(i=>this.tasks[encodeURI(i)]).filter(Boolean))??[]}get stageValidation(){var t;return(t=this.overview)==null?void 0:t.stageValidation}get stageChanges(){var t;return(t=this.overview)==null?void 0:t.stageChanges}get stageBackfills(){var t;return(t=this.overview)==null?void 0:t.stageBackfills}get stageCreation(){var t,e;return((t=this._last)==null?void 0:t.creation)??((e=this._current)==null?void 0:e.creation)}get stageRestate(){var t,e;return((t=this._last)==null?void 0:t.restate)??((e=this._current)==null?void 0:e.restate)}get stageBackfill(){var t,e;return((t=this._last)==null?void 0:t.backfill)??((e=this._current)==null?void 0:e.backfill)}get stagePromote(){var t,e;return((t=this._last)==null?void 0:t.promote)??((e=this._current)==null?void 0:e.promote)}get shouldShowEvaluation(){return this.isFailed||p(this.stageCreation)||p(this.stageBackfill)||p(this.stagePromote)}get evaluationStart(){var t,e,i,n,c,h;return((e=(t=this.stageCreation)==null?void 0:t.meta)==null?void 0:e.start)??((n=(i=this.stageBackfill)==null?void 0:i.meta)==null?void 0:n.start)??((h=(c=this.stagePromote)==null?void 0:c.meta)==null?void 0:h.start)}get evaluationEnd(){var t,e,i,n,c,h;return((e=(t=this.stagePromote)==null?void 0:t.meta)==null?void 0:e.end)??((n=(i=this.stageBackfill)==null?void 0:i.meta)==null?void 0:n.end)??((h=(c=this.stageCreation)==null?void 0:c.meta)==null?void 0:h.end)}update(t,e){var m,y,A,g,M,T,E;const{creation:i,restate:n,backfill:c,promote:h,meta:d,environment:_}=t,B=l(d)||l(_)?void 0:t;if(l(B)){this._current=void 0;return}l(this._current)&&(this._current=t),this._current.start=t.start,this._current.end=t.end,this._current.meta=t.meta,this._current.environment=t.environment,this._current.plan_options=t.plan_options,p(i)&&(l(this._current.creation)||v((m=this._current.creation.meta)==null?void 0:m.done))&&(this._current.creation=i),p(n)&&(l(this._current.restate)||v((y=this._current.restate.meta)==null?void 0:y.done))&&(this._current.restate=n),p(c)&&(l(this._current.backfill)||v((A=this._current.backfill.meta)==null?void 0:A.done))&&(this._current.backfill=c),p(h)&&(l(this._current.promote)||v((g=this._current.promote.meta)==null?void 0:g.done))&&(this._current.promote=h),R((T=(M=this.current)==null?void 0:M.meta)==null?void 0:T.done)&&l(this._last)?(this._last=this._current,this._lastPlanOverview=this._planOverview,this._current=void 0,this._planOverview=void 0):this._planOverview=p(d)&&p(_)?e==null?void 0:e.clone():void 0,this.isFetching=f((E=t.meta)==null?void 0:E.done)}reset(){this._current=void 0,this._planOverview=void 0}clear(){this._current=void 0,this._last=void 0,this._planOverview=void 0,this._lastPlanOverview=void 0}clone(){var e;const t=new k;return p(this.current)&&t.update(structuredClone(this.current),(e=this.overview)==null?void 0:e.clone()),t}}class b extends U{get cancel(){var r;return(r=this._current)==null?void 0:r.cancel}get isCancelling(){var r,t,e,i;return v((t=(r=this.current)==null?void 0:r.meta)==null?void 0:t.done)&&((i=(e=this.current)==null?void 0:e.meta)==null?void 0:i.status)===w.init||this.isFetching}update(r){var t;this._current=r,this.isFetching=f((t=r.meta)==null?void 0:t.done)}}class C extends U{constructor(t){super(t);a(this,"_added",[]);a(this,"_removed",[]);a(this,"_direct",[]);a(this,"_indirect",[]);a(this,"_metadata",[]);a(this,"_backfills",[]);p(t)&&t.isModel&&(this._added=t.added,this._removed=t.removed,this._direct=t.direct,this._indirect=t.indirect,this._metadata=t.metadata,this._backfills=t.backfills)}get stageValidation(){var t;return(t=this._current)==null?void 0:t.validation}get stageChanges(){var t;return(t=this._current)==null?void 0:t.changes}get stageBackfills(){var t;return(t=this._current)==null?void 0:t.backfills}get validation(){var t;return(t=this._current)==null?void 0:t.validation}get hasChanges(){var d;if(l((d=this._current)==null?void 0:d.changes))return;const{added:t,removed:e,modified:i}=this._current.changes??{};if([t,e,i].every(l))return;const{direct:n,indirect:c,metadata:h}=i??{};return[t,e,n,c,h].some(V)}get changes(){var t;return(t=this._current)==null?void 0:t.changes}get hasBackfills(){var t,e,i;return l((e=(t=this._current)==null?void 0:t.backfills)==null?void 0:e.models)?void 0:V((i=this._current.backfills)==null?void 0:i.models)}get hasUpdates(){return R(this.hasChanges)||R(this.hasBackfills)}get backfills(){return this._backfills}get added(){return this._added}get removed(){return this._removed}get direct(){return this._direct}get indirect(){return this._indirect}get metadata(){return this._metadata}get isVirtualUpdate(){return p(this.hasChanges)&&l(this.hasBackfills)||!!this.hasChanges&&this.skipBackfill}get isMetadataUpdate(){var t;return!!((t=this.metadata)!=null&&t.length)&&l(this.hasBackfills)}get isBackfillUpdate(){return v(this.hasChanges)&&!!this.hasBackfills&&f(this.skipBackfill)}get isChangesAndBackfillUpdate(){return!!this.hasChanges&&!!this.hasBackfills&&f(this.skipBackfill)}get isLatest(){return this.isFinished&&l(this.hasChanges)&&(l(this.hasBackfills)||this.skipBackfill)}get skipTests(){var t,e;return((e=(t=this._current)==null?void 0:t.plan_options)==null?void 0:e.skip_tests)??!1}get skipBackfill(){var t,e;return((e=(t=this._current)==null?void 0:t.plan_options)==null?void 0:e.skip_backfill)??!1}update(t){var c,h,d,_,P,B,m,y,A;this._current=t,this.isFetching=f((c=t.meta)==null?void 0:c.done);const e=((h=this._current)==null?void 0:h.changes)??{},i=(e==null?void 0:e.modified)??{},n=((d=this._current)==null?void 0:d.backfills)??{};this._added=((_=e.added)==null?void 0:_.map(g=>new o(g)))??[],this._removed=((P=e.removed)==null?void 0:P.map(g=>new o(g)))??[],this._direct=((B=i.direct)==null?void 0:B.map(g=>new o(g)))??[],this._indirect=((m=i.indirect)==null?void 0:m.map(g=>new o(g)))??[],this._metadata=((y=i.metadata)==null?void 0:y.map(g=>new o(g)))??[],this._backfills=((A=n.models)==null?void 0:A.map(g=>new o(g)))??[]}clone(){const t=new C;return p(this.current)&&t.update(structuredClone(this.current)),t}}const G=D((u,r)=>({planAction:new O,planOverview:new C,planApply:new k,planCancel:new b,setPlanAction:t=>{u(()=>({planAction:new O(t)}))},setPlanApply:t=>{u(()=>({planApply:new k(t)}))},setPlanOverview:t=>{u(()=>({planOverview:new C(t)}))},setPlanCancel:t=>{u(()=>({planCancel:new b(t)}))},resetPlanTrackers:()=>{const t=r();t.planApply.reset(),t.planCancel.reset(),t.planOverview.reset(),u(()=>({planApply:new k(t.planApply),planCancel:new b(t.planCancel),planOverview:new C(t.planOverview)}))},resetPlanCancel:()=>{const t=r();t.planCancel.reset(),u(()=>({planCancel:new b(t.planCancel)}))},clearPlanApply:()=>{const t=r();t.planApply.clear(),u(()=>({planApply:new k(t.planApply)}))}}));export{s as E,C as M,O as a,G as u};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{R as S,r as u,aj as _n,at as ot}from"./index-EyUZDtV7.js";import{u as Wn,i as Me,e as Gn,o as Vt,d as qe,m as Ye,g as Un,j as Vn,r as Ie,s as Kn,f as qn,a as Yn,c as zn}from"./floating-ui.react-dom-dR28niet.js";const Kt=typeof document<"u"?S.useLayoutEffect:()=>{};function Xn(e){const t=u.useRef(null);return Kt(()=>{t.current=e},[e]),u.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const pe=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},me=e=>e&&"window"in e&&e.window===e?e:pe(e).defaultView||window;function Jn(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Qn(e){return Jn(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Zn=!1;function ht(){return Zn}function qt(e,t){if(!ht())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:Qn(n)?n=n.host:n=n.parentNode}return!1}const lt=(e=document)=>{var t;if(!ht())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function Yt(e){return ht()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function er(e){var t;return typeof window>"u"||window.navigator==null?!1:((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands.some(n=>e.test(n.brand)))||e.test(window.navigator.userAgent)}function tr(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function zt(e){let t=null;return()=>(t==null&&(t=e()),t)}const nr=zt(function(){return tr(/^Mac/i)}),rr=zt(function(){return er(/Android/i)});function Xt(){let e=u.useRef(new Map),t=u.useCallback((o,a,i,l)=>{let s=l!=null&&l.once?(...c)=>{e.current.delete(i),i(...c)}:i;e.current.set(i,{type:a,eventTarget:o,fn:s,options:l}),o.addEventListener(a,s,l)},[]),n=u.useCallback((o,a,i,l)=>{var s;let c=((s=e.current.get(i))===null||s===void 0?void 0:s.fn)||i;o.removeEventListener(a,c,l),e.current.delete(i)},[]),r=u.useCallback(()=>{e.current.forEach((o,a)=>{n(o.eventTarget,o.type,a,o.options)})},[n]);return u.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function or(e){return e.mozInputSource===0&&e.isTrusted?!0:rr()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Jt(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function lr(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Qt(e){let t=u.useRef({isFocused:!1,observer:null});Kt(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Xn(r=>{e==null||e(r)});return u.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,a=i=>{if(t.current.isFocused=!1,o.disabled){let l=Jt(i);n(l)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",a,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let l=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:l})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:l}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let ar=!1,Re=null,at=new Set,Te=new Map,Ee=!1,ut=!1;const ur={Tab:!0,Escape:!0};function gt(e,t){for(let n of at)n(e,t)}function sr(e){return!(e.metaKey||!nr()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Ne(e){Ee=!0,sr(e)&&(Re="keyboard",gt("keyboard",e))}function ye(e){Re="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Ee=!0,gt("pointer",e))}function Zt(e){or(e)&&(Ee=!0,Re="virtual")}function en(e){e.target===window||e.target===document||ar||!e.isTrusted||(!Ee&&!ut&&(Re="virtual",gt("virtual",e)),Ee=!1,ut=!1)}function tn(){Ee=!1,ut=!0}function st(e){if(typeof window>"u"||Te.get(me(e)))return;const t=me(e),n=pe(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Ee=!0,r.apply(this,arguments)},n.addEventListener("keydown",Ne,!0),n.addEventListener("keyup",Ne,!0),n.addEventListener("click",Zt,!0),t.addEventListener("focus",en,!0),t.addEventListener("blur",tn,!1),typeof PointerEvent<"u"&&(n.addEventListener("pointerdown",ye,!0),n.addEventListener("pointermove",ye,!0),n.addEventListener("pointerup",ye,!0)),t.addEventListener("beforeunload",()=>{nn(e)},{once:!0}),Te.set(t,{focus:r})}const nn=(e,t)=>{const n=me(e),r=pe(e);t&&r.removeEventListener("DOMContentLoaded",t),Te.has(n)&&(n.HTMLElement.prototype.focus=Te.get(n).focus,r.removeEventListener("keydown",Ne,!0),r.removeEventListener("keyup",Ne,!0),r.removeEventListener("click",Zt,!0),n.removeEventListener("focus",en,!0),n.removeEventListener("blur",tn,!1),typeof PointerEvent<"u"&&(r.removeEventListener("pointerdown",ye,!0),r.removeEventListener("pointermove",ye,!0),r.removeEventListener("pointerup",ye,!0)),Te.delete(n))};function ir(e){const t=pe(e);let n;return t.readyState!=="loading"?st(e):(n=()=>{st(e)},t.addEventListener("DOMContentLoaded",n)),()=>nn(e,n)}typeof document<"u"&&ir();function rn(){return Re!=="pointer"}const cr=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function fr(e,t,n){let r=pe(n==null?void 0:n.target);const o=typeof window<"u"?me(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,a=typeof window<"u"?me(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?me(n==null?void 0:n.target).HTMLElement:HTMLElement,l=typeof window<"u"?me(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!cr.has(r.activeElement.type)||r.activeElement instanceof a||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof l&&!ur[n.key])}function dr(e,t,n){st(),u.useEffect(()=>{let r=(o,a)=>{fr(!!(n!=null&&n.isTextInput),o,a)&&e(rn())};return at.add(r),()=>{at.delete(r)}},t)}function pr(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const a=u.useCallback(s=>{if(s.target===s.currentTarget)return r&&r(s),o&&o(!1),!0},[r,o]),i=Qt(a),l=u.useCallback(s=>{const c=pe(s.target),f=c?lt(c):lt();s.target===s.currentTarget&&f===Yt(s.nativeEvent)&&(n&&n(s),o&&o(!0),i(s))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?l:void 0,onBlur:!t&&(r||o)?a:void 0}}}function vr(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,a=u.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:l}=Xt(),s=u.useCallback(h=>{h.currentTarget.contains(h.target)&&a.current.isFocusWithin&&!h.currentTarget.contains(h.relatedTarget)&&(a.current.isFocusWithin=!1,l(),n&&n(h),o&&o(!1))},[n,o,a,l]),c=Qt(s),f=u.useCallback(h=>{if(!h.currentTarget.contains(h.target))return;const m=pe(h.target),d=lt(m);if(!a.current.isFocusWithin&&d===Yt(h.nativeEvent)){r&&r(h),o&&o(!0),a.current.isFocusWithin=!0,c(h);let p=h.currentTarget;i(m,"focus",v=>{if(a.current.isFocusWithin&&!qt(p,v.target)){let g=new m.defaultView.FocusEvent("blur",{relatedTarget:v.target});lr(g,p);let E=Jt(g);s(E)}},{capture:!0})}},[r,o,c,i,s]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:s}}}let it=!1,ze=0;function mr(){it=!0,setTimeout(()=>{it=!1},50)}function Ft(e){e.pointerType==="touch"&&mr()}function hr(){if(!(typeof document>"u"))return typeof PointerEvent<"u"&&document.addEventListener("pointerup",Ft),ze++,()=>{ze--,!(ze>0)&&typeof PointerEvent<"u"&&document.removeEventListener("pointerup",Ft)}}function gr(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[a,i]=u.useState(!1),l=u.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;u.useEffect(hr,[]);let{addGlobalListener:s,removeAllGlobalListeners:c}=Xt(),{hoverProps:f,triggerHoverEnd:h}=u.useMemo(()=>{let m=(v,g)=>{if(l.pointerType=g,o||g==="touch"||l.isHovered||!v.currentTarget.contains(v.target))return;l.isHovered=!0;let E=v.currentTarget;l.target=E,s(pe(v.target),"pointerover",y=>{l.isHovered&&l.target&&!qt(l.target,y.target)&&d(y,y.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:E,pointerType:g}),n&&n(!0),i(!0)},d=(v,g)=>{let E=l.target;l.pointerType="",l.target=null,!(g==="touch"||!l.isHovered||!E)&&(l.isHovered=!1,c(),r&&r({type:"hoverend",target:E,pointerType:g}),n&&n(!1),i(!1))},p={};return typeof PointerEvent<"u"&&(p.onPointerEnter=v=>{it&&v.pointerType==="mouse"||m(v,v.pointerType)},p.onPointerLeave=v=>{!o&&v.currentTarget.contains(v.target)&&d(v,v.pointerType)}),{hoverProps:p,triggerHoverEnd:d}},[t,n,r,o,l,s,c]);return u.useEffect(()=>{o&&h({currentTarget:l.target},l.pointerType)},[o]),{hoverProps:f,isHovered:a}}function br(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=u.useRef({isFocused:!1,isFocusVisible:t||rn()}),[a,i]=u.useState(!1),[l,s]=u.useState(()=>o.current.isFocused&&o.current.isFocusVisible),c=u.useCallback(()=>s(o.current.isFocused&&o.current.isFocusVisible),[]),f=u.useCallback(d=>{o.current.isFocused=d,i(d),c()},[c]);dr(d=>{o.current.isFocusVisible=d,c()},[],{isTextInput:n});let{focusProps:h}=pr({isDisabled:r,onFocusChange:f}),{focusWithinProps:m}=vr({isDisabled:!r,onFocusWithinChange:f});return{isFocused:a,isFocusVisible:l,focusProps:r?m:h}}var Er=Object.defineProperty,$r=(e,t,n)=>t in e?Er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xe=(e,t,n)=>($r(e,typeof t!="symbol"?t+"":t,n),n);let yr=class{constructor(){Xe(this,"current",this.detect()),Xe(this,"handoffState","pending"),Xe(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},be=new yr;function Se(e){var t,n;return be.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function on(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function oe(){let e=[],t={addEventListener(n,r,o,a){return n.addEventListener(r,o,a),t.add(()=>n.removeEventListener(r,o,a))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return on(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let a=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:a})})},group(n){let r=oe();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function je(){let[e]=u.useState(oe);return u.useEffect(()=>()=>e.dispose(),[e]),e}let N=(e,t)=>{be.isServer?u.useEffect(e,t):u.useLayoutEffect(e,t)};function se(e){let t=u.useRef(e);return N(()=>{t.current=e},[e]),t}let x=function(e){let t=se(e);return S.useCallback((...n)=>t.current(...n),[t])};function wr(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function Pr(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Sr({disabled:e=!1}={}){let t=u.useRef(null),[n,r]=u.useState(!1),o=je(),a=x(()=>{t.current=null,r(!1),o.dispose()}),i=x(l=>{if(o.dispose(),t.current===null){t.current=l.currentTarget,r(!0);{let s=Se(l.currentTarget);o.addEventListener(s,"pointerup",a,!1),o.addEventListener(s,"pointermove",c=>{if(t.current){let f=wr(c);r(Pr(f,t.current.getBoundingClientRect()))}},!1),o.addEventListener(s,"pointercancel",a,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:a,onClick:a}}}function ct(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function J(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,J),r}var we=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(we||{}),ce=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ce||{});function ee(){let e=xr();return u.useCallback(t=>Cr({mergeRefs:e,...t}),[e])}function Cr({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:a=!0,name:i,mergeRefs:l}){l=l??Fr;let s=ln(t,e);if(a)return Le(s,n,r,i,l);let c=o??0;if(c&2){let{static:f=!1,...h}=s;if(f)return Le(h,n,r,i,l)}if(c&1){let{unmount:f=!0,...h}=s;return J(f?0:1,{0(){return null},1(){return Le({...h,hidden:!0,style:{display:"none"}},n,r,i,l)}})}return Le(s,n,r,i,l)}function Le(e,t={},n,r,o){let{as:a=n,children:i,refName:l="ref",...s}=Je(e,["unmount","static"]),c=e.ref!==void 0?{[l]:e.ref}:{},f=typeof i=="function"?i(t):i;"className"in s&&s.className&&typeof s.className=="function"&&(s.className=s.className(t)),s["aria-labelledby"]&&s["aria-labelledby"]===s.id&&(s["aria-labelledby"]=void 0);let h={};if(t){let m=!1,d=[];for(let[p,v]of Object.entries(t))typeof v=="boolean"&&(m=!0),v===!0&&d.push(p.replace(/([A-Z])/g,g=>`-${g.toLowerCase()}`));if(m){h["data-headlessui-state"]=d.join(" ");for(let p of d)h[`data-${p}`]=""}}if(a===u.Fragment&&(Object.keys(ve(s)).length>0||Object.keys(ve(h)).length>0))if(!u.isValidElement(f)||Array.isArray(f)&&f.length>1){if(Object.keys(ve(s)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(ve(s)).concat(Object.keys(ve(h))).map(m=>` - ${m}`).join(`
|
|
2
|
+
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(m=>` - ${m}`).join(`
|
|
3
|
+
`)].join(`
|
|
4
|
+
`))}else{let m=f.props,d=m==null?void 0:m.className,p=typeof d=="function"?(...E)=>ct(d(...E),s.className):ct(d,s.className),v=p?{className:p}:{},g=ln(f.props,ve(Je(s,["ref"])));for(let E in h)E in g&&delete h[E];return u.cloneElement(f,Object.assign({},g,h,c,{ref:o(Tr(f),c.ref)},v))}return u.createElement(a,Object.assign({},Je(s,["ref"]),a!==u.Fragment&&c,a!==u.Fragment&&h),f)}function xr(){let e=u.useRef([]),t=u.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function Fr(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function ln(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var a;return(a=o==null?void 0:o.preventDefault)==null?void 0:a.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...a){let i=n[r];for(let l of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;l(o,...a)}}});return t}function ft(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let a=n[r];for(let i of a)i==null||i(...o)}});return t}function z(e){var t;return Object.assign(u.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ve(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Je(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Tr(e){return S.version.split(".")[0]>="19"?e.props.ref:e.ref}let Or="span";var Oe=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Oe||{});function Rr(e,t){var n;let{features:r=1,...o}=e,a={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return ee()({ourProps:a,theirProps:o,slot:{},defaultTag:Or,name:"Hidden"})}let De=z(Rr);function an(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function de(e){return an(e)&&"tagName"in e}function re(e){return de(e)&&"accessKey"in e}function he(e){return de(e)&&"tabIndex"in e}function kr(e){return de(e)&&"style"in e}function Mr(e){return re(e)&&e.nodeName==="IFRAME"}function Lr(e){return re(e)&&e.nodeName==="INPUT"}function Ul(e){return re(e)&&e.nodeName==="LABEL"}function Ar(e){return re(e)&&e.nodeName==="FIELDSET"}function un(e){return re(e)&&e.nodeName==="LEGEND"}function Vl(e){return de(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function sn(e){let t=e.parentElement,n=null;for(;t&&!Ar(t);)un(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Ir(n)?!1:r}function Ir(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(un(t))return!1;t=t.previousElementSibling}return!0}let cn=Symbol();function fn(e,t=!0){return Object.assign(e,{[cn]:t})}function Z(...e){let t=u.useRef(e);u.useEffect(()=>{t.current=e},[e]);let n=x(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[cn]))?void 0:n}var ie=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(ie||{});let Nr=u.createContext(()=>{});function dn({value:e,children:t}){return S.createElement(Nr.Provider,{value:e},t)}function Dr(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Hr(e,t=!1){let[n,r]=u.useReducer(()=>({}),{}),o=u.useMemo(()=>Dr(e),[e,n]);return N(()=>{if(!e)return;let a=new ResizeObserver(r);return a.observe(e),()=>{a.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let pn=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var jr=Object.defineProperty,Br=(e,t,n)=>t in e?jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_r=(e,t,n)=>(Br(e,t+"",n),n),vn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},X=(e,t,n)=>(vn(e,t,"read from private field"),n?n.call(e):t.get(e)),Qe=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Tt=(e,t,n,r)=>(vn(e,t,"write to private field"),t.set(e,n),n),ne,xe,Fe;let mn=class{constructor(t){Qe(this,ne,{}),Qe(this,xe,new pn(()=>new Set)),Qe(this,Fe,new Set),_r(this,"disposables",oe()),Tt(this,ne,t)}dispose(){this.disposables.dispose()}get state(){return X(this,ne)}subscribe(t,n){let r={selector:t,callback:n,current:t(X(this,ne))};return X(this,Fe).add(r),this.disposables.add(()=>{X(this,Fe).delete(r)})}on(t,n){return X(this,xe).get(t).add(n),this.disposables.add(()=>{X(this,xe).get(t).delete(n)})}send(t){let n=this.reduce(X(this,ne),t);if(n!==X(this,ne)){Tt(this,ne,n);for(let r of X(this,Fe)){let o=r.selector(X(this,ne));hn(r.current,o)||(r.current=o,r.callback(o))}for(let r of X(this,xe).get(t.type))r(X(this,ne),t)}}};ne=new WeakMap,xe=new WeakMap,Fe=new WeakMap;function hn(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:Ze(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Ze(e.entries(),t.entries()):Ot(e)&&Ot(t)?Ze(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Ze(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function Ot(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Yl(e){let[t,n]=e(),r=oe();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Wr=Object.defineProperty,Gr=(e,t,n)=>t in e?Wr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rt=(e,t,n)=>(Gr(e,typeof t!="symbol"?t+"":t,n),n),Ur=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Ur||{});let Vr={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let a=e.stack.slice();return a.splice(o,1),a.push(n),r=a,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},Kr=class gn extends mn{constructor(){super(...arguments),Rt(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Rt(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new gn({stack:[]})}reduce(t,n){return J(n.type,Vr,t,n)}};const bn=new pn(()=>Kr.new());var et={exports:{}},tt={};/**
|
|
5
|
+
* @license React
|
|
6
|
+
* use-sync-external-store-with-selector.production.js
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/var kt;function qr(){if(kt)return tt;kt=1;var e=_n();function t(s,c){return s===c&&(s!==0||1/s===1/c)||s!==s&&c!==c}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,a=e.useEffect,i=e.useMemo,l=e.useDebugValue;return tt.useSyncExternalStoreWithSelector=function(s,c,f,h,m){var d=o(null);if(d.current===null){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=i(function(){function g(F){if(!E){if(E=!0,y=F,F=h(F),m!==void 0&&p.hasValue){var O=p.value;if(m(O,F))return b=O}return b=F}if(O=b,n(y,F))return O;var T=h(F);return m!==void 0&&m(O,T)?(y=F,O):(y=F,b=T)}var E=!1,y,b,C=f===void 0?null:f;return[function(){return g(c())},C===null?void 0:function(){return g(C())}]},[c,f,h,m]);var v=r(s,d[0],d[1]);return a(function(){p.hasValue=!0,p.value=v},[v]),l(v),v},tt}var Mt;function Yr(){return Mt||(Mt=1,et.exports=qr()),et.exports}var zr=Yr();function $e(e,t,n=hn){return zr.useSyncExternalStoreWithSelector(x(r=>e.subscribe(Xr,r)),x(()=>e.state),x(()=>e.state),x(t),n)}function Xr(e){return e}function Jr(e,t){let n=u.useId(),r=bn.get(t),[o,a]=$e(r,u.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return N(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?a?o:!0:!1}function Qr(e,t,n){let r=se(o=>{let a=o.getBoundingClientRect();a.x===0&&a.y===0&&a.width===0&&a.height===0&&n()});u.useEffect(()=>{if(!e)return;let o=t===null?null:re(t)?t:t.current;if(!o)return;let a=oe();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),a.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),a.add(()=>i.disconnect())}return()=>a.dispose()},[t,r,e])}let dt=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),Zr=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var ae=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(ae||{}),He=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(He||{}),eo=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(eo||{});function ke(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(dt)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function to(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Zr)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var bt=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(bt||{});function Et(e,t=0){var n;return e===((n=Se(e))==null?void 0:n.body)?!1:J(t,{0(){return e.matches(dt)},1(){let r=e;for(;r!==null;){if(r.matches(dt))return!0;r=r.parentElement}return!1}})}function zl(e){let t=Se(e);oe().nextFrame(()=>{t&&he(t.activeElement)&&!Et(t.activeElement,0)&&ro(e)})}var no=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(no||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function ro(e){e==null||e.focus({preventScroll:!0})}let oo=["textarea","input"].join(",");function lo(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,oo))!=null?n:!1}function ao(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),a=t(r);if(o===null||a===null)return 0;let i=o.compareDocumentPosition(a);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Xl(e,t){return fe(ke(),t,{relativeTo:e})}function fe(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let a=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?ao(e):e:t&64?to(e):ke(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(p=>p!=null&&"current"in p?(p==null?void 0:p.current)===d:p===d))),r=r??a.activeElement;let l=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),s=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},f=0,h=i.length,m;do{if(f>=h||f+h<=0)return 0;let d=s+f;if(t&16)d=(d+h)%h;else{if(d<0)return 3;if(d>=h)return 1}m=i[d],m==null||m.focus(c),f+=l}while(m!==a.activeElement);return t&6&&lo(m)&&m.select(),2}function En(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function uo(){return/Android/gi.test(window.navigator.userAgent)}function Lt(){return En()||uo()}function Ae(e,t,n,r){let o=se(n);u.useEffect(()=>{if(!e)return;function a(i){o.current(i)}return document.addEventListener(t,a,r),()=>document.removeEventListener(t,a,r)},[e,t,r])}function $n(e,t,n,r){let o=se(n);u.useEffect(()=>{if(!e)return;function a(i){o.current(i)}return window.addEventListener(t,a,r),()=>window.removeEventListener(t,a,r)},[e,t,r])}const At=30;function so(e,t,n){let r=se(n),o=u.useCallback(function(l,s){if(l.defaultPrevented)return;let c=s(l);if(c===null||!c.getRootNode().contains(c)||!c.isConnected)return;let f=function h(m){return typeof m=="function"?h(m()):Array.isArray(m)||m instanceof Set?m:[m]}(t);for(let h of f)if(h!==null&&(h.contains(c)||l.composed&&l.composedPath().includes(h)))return;return!Et(c,bt.Loose)&&c.tabIndex!==-1&&l.preventDefault(),r.current(l,c)},[r,t]),a=u.useRef(null);Ae(e,"pointerdown",l=>{var s,c;Lt()||(a.current=((c=(s=l.composedPath)==null?void 0:s.call(l))==null?void 0:c[0])||l.target)},!0),Ae(e,"pointerup",l=>{if(Lt()||!a.current)return;let s=a.current;return a.current=null,o(l,()=>s)},!0);let i=u.useRef({x:0,y:0});Ae(e,"touchstart",l=>{i.current.x=l.touches[0].clientX,i.current.y=l.touches[0].clientY},!0),Ae(e,"touchend",l=>{let s={x:l.changedTouches[0].clientX,y:l.changedTouches[0].clientY};if(!(Math.abs(s.x-i.current.x)>=At||Math.abs(s.y-i.current.y)>=At))return o(l,()=>he(l.target)?l.target:null)},!0),$n(e,"blur",l=>o(l,()=>Mr(window.document.activeElement)?window.document.activeElement:null),!0)}function Pe(...e){return u.useMemo(()=>Se(...e),[...e])}function io(e,t,n,r){let o=se(n);u.useEffect(()=>{e=e??window;function a(i){o.current(i)}return e.addEventListener(t,a,r),()=>e.removeEventListener(t,a,r)},[e,t,r])}function co(e,t){return u.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function fo(e){return u.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function po(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...a){let i=t[o].call(n,...a);i&&(n=i,r.forEach(l=>l()))}}}function vo(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),a=Math.max(0,e-o);n.style(r,"paddingRight",`${a}px`)}}}function mo(){return En()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(a=>a()).some(a=>a.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let l=oe();l.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>l.dispose()))}let a=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",l=>{if(he(l.target))try{let s=l.target.closest("a");if(!s)return;let{hash:c}=new URL(s.href),f=e.querySelector(c);he(f)&&!r(f)&&(i=f)}catch{}},!0),t.addEventListener(e,"touchstart",l=>{if(he(l.target)&&kr(l.target))if(r(l.target)){let s=l.target;for(;s.parentElement&&r(s.parentElement);)s=s.parentElement;t.style(s,"overscrollBehavior","contain")}else t.style(l.target,"touchAction","none")}),t.addEventListener(e,"touchmove",l=>{if(he(l.target)){if(Lr(l.target))return;if(r(l.target)){let s=l.target;for(;s.parentElement&&s.dataset.headlessuiPortal!==""&&!(s.scrollHeight>s.clientHeight||s.scrollWidth>s.clientWidth);)s=s.parentElement;s.dataset.headlessuiPortal===""&&l.preventDefault()}else l.preventDefault()}},{passive:!1}),t.add(()=>{var l;let s=(l=window.scrollY)!=null?l:window.pageYOffset;a!==s&&window.scrollTo(0,a),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function ho(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function go(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let ge=po(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:oe(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:go(n)},o=[mo(),vo(),ho()];o.forEach(({before:a})=>a==null?void 0:a(r)),o.forEach(({after:a})=>a==null?void 0:a(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});ge.subscribe(()=>{let e=ge.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&ge.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&ge.dispatch("TEARDOWN",n)}});function bo(e,t,n=()=>({containers:[]})){let r=fo(ge),o=t?r.get(t):void 0,a=o?o.count>0:!1;return N(()=>{if(!(!t||!e))return ge.dispatch("PUSH",t,n),()=>ge.dispatch("POP",t,n)},[e,t]),a}function Eo(e,t,n=()=>[document.body]){let r=Jr(e,"scroll-lock");bo(r,t,o=>{var a;return{containers:[...(a=o.containers)!=null?a:[],n]}})}function $o(e=0){let[t,n]=u.useState(e),r=u.useCallback(s=>n(s),[t]),o=u.useCallback(s=>n(c=>c|s),[t]),a=u.useCallback(s=>(t&s)===s,[t]),i=u.useCallback(s=>n(c=>c&~s),[n]),l=u.useCallback(s=>n(c=>c^s),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:a,removeFlag:i,toggleFlag:l}}var yo={},It,Nt;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((It=process==null?void 0:yo)==null?void 0:It.NODE_ENV)==="test"&&typeof((Nt=Element==null?void 0:Element.prototype)==null?void 0:Nt.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
13
|
+
`)),[]});var wo=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(wo||{});function $t(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function yt(e,t,n,r){let[o,a]=u.useState(n),{hasFlag:i,addFlag:l,removeFlag:s}=$o(e&&o?3:0),c=u.useRef(!1),f=u.useRef(!1),h=je();return N(()=>{var m;if(e){if(n&&a(!0),!t){n&&l(3);return}return(m=r==null?void 0:r.start)==null||m.call(r,n),Po(t,{inFlight:c,prepare(){f.current?f.current=!1:f.current=c.current,c.current=!0,!f.current&&(n?(l(3),s(4)):(l(4),s(2)))},run(){f.current?n?(s(3),l(4)):(s(4),l(3)):n?s(1):l(1)},done(){var d;f.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,s(7),n||a(!1),(d=r==null?void 0:r.end)==null||d.call(r,n))}})}},[e,n,t,h]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Po(e,{prepare:t,run:n,done:r,inFlight:o}){let a=oe();return Co(e,{prepare:t,inFlight:o}),a.nextFrame(()=>{n(),a.requestAnimationFrame(()=>{a.add(So(e,r))})}),a.dispose}function So(e,t){var n,r;let o=oe();if(!e)return o.dispose;let a=!1;o.add(()=>{a=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(l=>l instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(l=>l.finished)).then(()=>{a||t()}),o.dispose)}function Co(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function xo(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const yn={...ot},Fo=yn.useInsertionEffect,To=Fo||(e=>e());function wn(e){const t=u.useRef(()=>{});return To(()=>{t.current=e}),u.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var pt=typeof document<"u"?u.useLayoutEffect:u.useEffect;let Dt=!1,Oo=0;const Ht=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Oo++;function Ro(){const[e,t]=u.useState(()=>Dt?Ht():void 0);return pt(()=>{e==null&&t(Ht())},[]),u.useEffect(()=>{Dt=!0},[]),e}const ko=yn.useId,Mo=ko||Ro;function Lo(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const Ao=u.createContext(null),Io=u.createContext(null),No=()=>{var e;return((e=u.useContext(Ao))==null?void 0:e.id)||null},Do=()=>u.useContext(Io),Ho="data-floating-ui-focusable";function jo(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Mo(),a=u.useRef({}),[i]=u.useState(()=>Lo()),l=No()!=null,[s,c]=u.useState(r.reference),f=wn((d,p,v)=>{a.current.openEvent=d?p:void 0,i.emit("openchange",{open:d,event:p,reason:v,nested:l}),n==null||n(d,p,v)}),h=u.useMemo(()=>({setPositionReference:c}),[]),m=u.useMemo(()=>({reference:s||r.reference||null,floating:r.floating||null,domReference:r.reference}),[s,r.reference,r.floating]);return u.useMemo(()=>({dataRef:a,open:t,onOpenChange:f,elements:m,events:i,floatingId:o,refs:h}),[t,f,m,i,o,h])}function Bo(e){e===void 0&&(e={});const{nodeId:t}=e,n=jo({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[a,i]=u.useState(null),[l,s]=u.useState(null),f=(o==null?void 0:o.domReference)||a,h=u.useRef(null),m=Do();pt(()=>{f&&(h.current=f)},[f]);const d=Wn({...e,elements:{...o,...l&&{reference:l}}}),p=u.useCallback(b=>{const C=Me(b)?{getBoundingClientRect:()=>b.getBoundingClientRect(),contextElement:b}:b;s(C),d.refs.setReference(C)},[d.refs]),v=u.useCallback(b=>{(Me(b)||b===null)&&(h.current=b,i(b)),(Me(d.refs.reference.current)||d.refs.reference.current===null||b!==null&&!Me(b))&&d.refs.setReference(b)},[d.refs]),g=u.useMemo(()=>({...d.refs,setReference:v,setPositionReference:p,domReference:h}),[d.refs,v,p]),E=u.useMemo(()=>({...d.elements,domReference:f}),[d.elements,f]),y=u.useMemo(()=>({...d,...r,refs:g,elements:E,nodeId:t}),[d,g,E,t,r]);return pt(()=>{r.dataRef.current.floatingContext=y;const b=m==null?void 0:m.nodesRef.current.find(C=>C.id===t);b&&(b.context=y)}),u.useMemo(()=>({...d,context:y,refs:g,elements:E}),[d,g,E,y])}const jt="active",Bt="selected";function nt(e,t,n){const r=new Map,o=n==="item";let a=e;if(o&&e){const{[jt]:i,[Bt]:l,...s}=e;a=s}return{...n==="floating"&&{tabIndex:-1,[Ho]:""},...a,...t.map(i=>{const l=i?i[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((i,l)=>(l&&Object.entries(l).forEach(s=>{let[c,f]=s;if(!(o&&[jt,Bt].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof f=="function"){var h;(h=r.get(c))==null||h.push(f),i[c]=function(){for(var m,d=arguments.length,p=new Array(d),v=0;v<d;v++)p[v]=arguments[v];return(m=r.get(c))==null?void 0:m.map(g=>g(...p)).find(g=>g!==void 0)}}}else i[c]=f}),i),{})}}function _o(e){e===void 0&&(e=[]);const t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=u.useCallback(l=>nt(l,e,"reference"),t),a=u.useCallback(l=>nt(l,e,"floating"),n),i=u.useCallback(l=>nt(l,e,"item"),r);return u.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:i}),[o,a,i])}function _t(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Wo=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:a=0,index:i=0,minItemsVisible:l=4,referenceOverflowThreshold:s=0,scrollRef:c,...f}=Gn(e,t),{rects:h,elements:{floating:m}}=t,d=n.current[i],p=(c==null?void 0:c.current)||m,v=m.clientTop||p.clientTop,g=m.clientTop!==0,E=p.clientTop!==0,y=m===p;if(!d)return{};const b={...t,...await Vt(-d.offsetTop-m.clientTop-h.reference.height/2-d.offsetHeight/2-a).fn(t)},C=await qe(_t(b,p.scrollHeight+v+m.clientTop),f),F=await qe(b,{...f,elementContext:"reference"}),O=Ye(0,C.top),T=b.y+O,R=(p.scrollHeight>p.clientHeight?M=>M:Un)(Ye(0,p.scrollHeight+(g&&y||E?v*2:0)-O-Ye(0,C.bottom)));if(p.style.maxHeight=R+"px",p.scrollTop=O,o){const M=p.offsetHeight<d.offsetHeight*Vn(l,n.current.length)-1||F.top>=-s||F.bottom>=-s;Ie.flushSync(()=>o(M))}return r&&(r.current=await qe(_t({...b,y:T},p.offsetHeight+v+m.clientTop),f)),{y:T}}});function Go(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:a,scrollRef:i,onChange:l}=t,s=wn(l),c=u.useRef(!1),f=u.useRef(null),h=u.useRef(null);u.useEffect(()=>{if(!o)return;function d(v){if(v.ctrlKey||!p||a.current==null)return;const g=v.deltaY,E=a.current.top>=-.5,y=a.current.bottom>=-.5,b=p.scrollHeight-p.clientHeight,C=g<0?-1:1,F=g<0?"max":"min";p.scrollHeight<=p.clientHeight||(!E&&g>0||!y&&g<0?(v.preventDefault(),Ie.flushSync(()=>{s(O=>O+Math[F](g,b*C))})):/firefox/i.test(xo())&&(p.scrollTop+=g))}const p=(i==null?void 0:i.current)||r.floating;if(n&&p)return p.addEventListener("wheel",d),requestAnimationFrame(()=>{f.current=p.scrollTop,a.current!=null&&(h.current={...a.current})}),()=>{f.current=null,h.current=null,p.removeEventListener("wheel",d)}},[o,n,r.floating,a,i,s]);const m=u.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!a.current||!d||!c.current)){if(f.current!==null){const p=d.scrollTop-f.current;(a.current.bottom<-.5&&p<-1||a.current.top<-.5&&p>1)&&Ie.flushSync(()=>s(v=>v+p))}requestAnimationFrame(()=>{f.current=d.scrollTop})}}}),[r.floating,s,a,i]);return u.useMemo(()=>o?{floating:m}:{},[o,m])}let Ce=u.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Ce.displayName="FloatingContext";let wt=u.createContext(null);wt.displayName="PlacementContext";function Uo(e){return u.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function Vo(){return u.useContext(Ce).setReference}function Jl(){return u.useContext(Ce).getReferenceProps}function Ko(){let{getFloatingProps:e,slot:t}=u.useContext(Ce);return u.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function qo(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=u.useContext(wt),n=u.useMemo(()=>e,[JSON.stringify(e,(o,a)=>{var i;return(i=a==null?void 0:a.outerHTML)!=null?i:a})]);N(()=>{t==null||t(n??null)},[t,n]);let r=u.useContext(Ce);return u.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Wt=4;function Yo({children:e,enabled:t=!0}){let[n,r]=u.useState(null),[o,a]=u.useState(0),i=u.useRef(null),[l,s]=u.useState(null);zo(l);let c=t&&n!==null&&l!==null,{to:f="bottom",gap:h=0,offset:m=0,padding:d=0,inner:p}=Xo(n,l),[v,g="center"]=f.split(" ");N(()=>{c&&a(0)},[c]);let{refs:E,floatingStyles:y,context:b}=Bo({open:c,placement:v==="selection"?g==="center"?"bottom":`bottom-${g}`:g==="center"?`${v}`:`${v}-${g}`,strategy:"absolute",transform:!1,middleware:[Vt({mainAxis:v==="selection"?0:h,crossAxis:m}),Kn({padding:d}),v!=="selection"&&qn({padding:d}),v==="selection"&&p?Wo({...p,padding:d,overflowRef:i,offset:o,minItemsVisible:Wt,referenceOverflowThreshold:d,onFallbackChange(M){var A,D;if(!M)return;let w=b.elements.floating;if(!w)return;let H=parseFloat(getComputedStyle(w).scrollPaddingBottom)||0,K=Math.min(Wt,w.childElementCount),V=0,_=0;for(let k of(D=(A=b.elements.floating)==null?void 0:A.childNodes)!=null?D:[])if(re(k)){let j=k.offsetTop,le=j+k.clientHeight+H,te=w.scrollTop,P=te+w.clientHeight;if(j>=te&&le<=P)K--;else{_=Math.max(0,Math.min(le,P)-Math.max(j,te)),V=k.clientHeight;break}}K>=1&&a(k=>{let j=V*K-_+H;return k>=j?k:j})}}):null,Yn({padding:d,apply({availableWidth:M,availableHeight:A,elements:D}){Object.assign(D.floating.style,{overflow:"auto",maxWidth:`${M}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${A}px)`})}})].filter(Boolean),whileElementsMounted:zn}),[C=v,F=g]=b.placement.split("-");v==="selection"&&(C="selection");let O=u.useMemo(()=>({anchor:[C,F].filter(Boolean).join(" ")}),[C,F]),T=Go(b,{overflowRef:i,onChange:a}),{getReferenceProps:W,getFloatingProps:Q}=_o([T]),R=x(M=>{s(M),E.setFloating(M)});return u.createElement(wt.Provider,{value:r},u.createElement(Ce.Provider,{value:{setFloating:R,setReference:E.setReference,styles:y,getReferenceProps:W,getFloatingProps:Q,slot:O}},e))}function zo(e){N(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function Xo(e,t){var n,r,o;let a=rt((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=rt((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),l=rt((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:a,offset:i,padding:l}}function rt(e,t,n=void 0){let r=je(),o=x((s,c)=>{if(s==null)return[n,null];if(typeof s=="number")return[s,null];if(typeof s=="string"){if(!c)return[n,null];let f=Gt(s,c);return[f,h=>{let m=Pn(s);{let d=m.map(p=>window.getComputedStyle(c).getPropertyValue(p));r.requestAnimationFrame(function p(){r.nextFrame(p);let v=!1;for(let[E,y]of m.entries()){let b=window.getComputedStyle(c).getPropertyValue(y);if(d[E]!==b){d[E]=b,v=!0;break}}if(!v)return;let g=Gt(s,c);f!==g&&(h(g),f=g)})}return r.dispose}]}return[n,null]}),a=u.useMemo(()=>o(e,t)[0],[e,t]),[i=a,l]=u.useState();return N(()=>{let[s,c]=o(e,t);if(l(s),!!c)return c(l)},[e,t]),i}function Pn(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...Pn(o)]:[r]}return[]}function Gt(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}let Be=u.createContext(null);Be.displayName="OpenClosedContext";var Y=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Y||{});function _e(){return u.useContext(Be)}function Sn({value:e,children:t}){return S.createElement(Be.Provider,{value:e},t)}function Jo({children:e}){return S.createElement(Be.Provider,{value:null},e)}function Cn(e){let t=x(e),n=u.useRef(!1);u.useEffect(()=>(n.current=!1,()=>{n.current=!0,on(()=>{n.current&&t()})}),[t])}function Qo(){let e=typeof document>"u";return"useSyncExternalStore"in ot?(t=>t.useSyncExternalStore)(ot)(()=>()=>{},()=>!1,()=>!e):!1}function Pt(){let e=Qo(),[t,n]=u.useState(be.isHandoffComplete);return t&&be.isHandoffComplete===!1&&n(!1),u.useEffect(()=>{t!==!0&&n(!0)},[t]),u.useEffect(()=>be.handoff(),[]),e?!1:t}let xn=u.createContext(!1);function Zo(){return u.useContext(xn)}function Ql(e){return S.createElement(xn.Provider,{value:e.force},e.children)}function el(e){let t=Zo(),n=u.useContext(Tn),[r,o]=u.useState(()=>{var a;if(!t&&n!==null)return(a=n.current)!=null?a:null;if(be.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let l=e.createElement("div");return l.setAttribute("id","headlessui-portal-root"),e.body.appendChild(l)});return u.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),u.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Fn=u.Fragment,tl=z(function(e,t){let{ownerDocument:n=null,...r}=e,o=u.useRef(null),a=Z(fn(d=>{o.current=d}),t),i=Pe(o),l=n??i,s=el(l),[c]=u.useState(()=>{var d;return be.isServer?null:(d=l==null?void 0:l.createElement("div"))!=null?d:null}),f=u.useContext(vt),h=Pt();N(()=>{!s||!c||s.contains(c)||(c.setAttribute("data-headlessui-portal",""),s.appendChild(c))},[s,c]),N(()=>{if(c&&f)return f.register(c)},[f,c]),Cn(()=>{var d;!s||!c||(an(c)&&s.contains(c)&&s.removeChild(c),s.childNodes.length<=0&&((d=s.parentElement)==null||d.removeChild(s)))});let m=ee();return h?!s||!c?null:Ie.createPortal(m({ourProps:{ref:a},theirProps:r,slot:{},defaultTag:Fn,name:"Portal"}),c):null});function nl(e,t){let n=Z(t),{enabled:r=!0,ownerDocument:o,...a}=e,i=ee();return r?S.createElement(tl,{...a,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:a,slot:{},defaultTag:Fn,name:"Portal"})}let rl=u.Fragment,Tn=u.createContext(null);function ol(e,t){let{target:n,...r}=e,o={ref:Z(t)},a=ee();return S.createElement(Tn.Provider,{value:n},a({ourProps:o,theirProps:r,defaultTag:rl,name:"Popover.Group"}))}let vt=u.createContext(null);function ll(){let e=u.useContext(vt),t=u.useRef([]),n=x(a=>(t.current.push(a),e&&e.register(a),()=>r(a))),r=x(a=>{let i=t.current.indexOf(a);i!==-1&&t.current.splice(i,1),e&&e.unregister(a)}),o=u.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,u.useMemo(()=>function({children:a}){return S.createElement(vt.Provider,{value:o},a)},[o])]}let al=z(nl),ul=z(ol),sl=Object.assign(al,{Group:ul});function il({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let r=Pe(n),o=x(()=>{var a,i;let l=[];for(let s of e)s!==null&&(de(s)?l.push(s):"current"in s&&de(s.current)&&l.push(s.current));if(t!=null&&t.current)for(let s of t.current)l.push(s);for(let s of(a=r==null?void 0:r.querySelectorAll("html > *, body > *"))!=null?a:[])s!==document.body&&s!==document.head&&de(s)&&s.id!=="headlessui-portal-root"&&(n&&(s.contains(n)||s.contains((i=n==null?void 0:n.getRootNode())==null?void 0:i.host))||l.some(c=>s.contains(c))||l.push(s));return l});return{resolveContainers:o,contains:x(a=>o().some(i=>i.contains(a)))}}let On=u.createContext(null);function Rn({children:e,node:t}){let[n,r]=u.useState(null),o=kn(t??n);return S.createElement(On.Provider,{value:o},e,o===null&&S.createElement(De,{features:Oe.Hidden,ref:a=>{var i,l;if(a){for(let s of(l=(i=Se(a))==null?void 0:i.querySelectorAll("html > *, body > *"))!=null?l:[])if(s!==document.body&&s!==document.head&&de(s)&&s!=null&&s.contains(a)){r(s);break}}}}))}function kn(e=null){var t;return(t=u.useContext(On))!=null?t:e}function cl(){let e=u.useRef(!1);return N(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var ue=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(ue||{});function Mn(){let e=u.useRef(0);return $n(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function Ln(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:In)!==u.Fragment||S.Children.count(e.children)===1}let We=u.createContext(null);We.displayName="TransitionContext";var fl=(e=>(e.Visible="visible",e.Hidden="hidden",e))(fl||{});function dl(){let e=u.useContext(We);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function pl(){let e=u.useContext(Ge);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Ge=u.createContext(null);Ge.displayName="NestingContext";function Ue(e){return"children"in e?Ue(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function An(e,t){let n=se(e),r=u.useRef([]),o=cl(),a=je(),i=x((d,p=ce.Hidden)=>{let v=r.current.findIndex(({el:g})=>g===d);v!==-1&&(J(p,{[ce.Unmount](){r.current.splice(v,1)},[ce.Hidden](){r.current[v].state="hidden"}}),a.microTask(()=>{var g;!Ue(r)&&o.current&&((g=n.current)==null||g.call(n))}))}),l=x(d=>{let p=r.current.find(({el:v})=>v===d);return p?p.state!=="visible"&&(p.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,ce.Unmount)}),s=u.useRef([]),c=u.useRef(Promise.resolve()),f=u.useRef({enter:[],leave:[]}),h=x((d,p,v)=>{s.current.splice(0),t&&(t.chains.current[p]=t.chains.current[p].filter(([g])=>g!==d)),t==null||t.chains.current[p].push([d,new Promise(g=>{s.current.push(g)})]),t==null||t.chains.current[p].push([d,new Promise(g=>{Promise.all(f.current[p].map(([E,y])=>y)).then(()=>g())})]),p==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(p)):v(p)}),m=x((d,p,v)=>{Promise.all(f.current[p].splice(0).map(([g,E])=>E)).then(()=>{var g;(g=s.current.shift())==null||g()}).then(()=>v(p))});return u.useMemo(()=>({children:r,register:l,unregister:i,onStart:h,onStop:m,wait:c,chains:f}),[l,i,r,h,m,f,c])}let In=u.Fragment,Nn=we.RenderStrategy;function vl(e,t){var n,r;let{transition:o=!0,beforeEnter:a,afterEnter:i,beforeLeave:l,afterLeave:s,enter:c,enterFrom:f,enterTo:h,entered:m,leave:d,leaveFrom:p,leaveTo:v,...g}=e,[E,y]=u.useState(null),b=u.useRef(null),C=Ln(e),F=Z(...C?[b,t,y]:t===null?[]:[t]),O=(n=g.unmount)==null||n?ce.Unmount:ce.Hidden,{show:T,appear:W,initial:Q}=dl(),[R,M]=u.useState(T?"visible":"hidden"),A=pl(),{register:D,unregister:w}=A;N(()=>D(b),[D,b]),N(()=>{if(O===ce.Hidden&&b.current){if(T&&R!=="visible"){M("visible");return}return J(R,{hidden:()=>w(b),visible:()=>D(b)})}},[R,b,D,w,T,O]);let H=Pt();N(()=>{if(C&&H&&R==="visible"&&b.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[b,R,H,C]);let K=Q&&!W,V=W&&T&&Q,_=u.useRef(!1),k=An(()=>{_.current||(M("hidden"),w(b))},A),j=x(B=>{_.current=!0;let G=B?"enter":"leave";k.onStart(b,G,U=>{U==="enter"?a==null||a():U==="leave"&&(l==null||l())})}),le=x(B=>{let G=B?"enter":"leave";_.current=!1,k.onStop(b,G,U=>{U==="enter"?i==null||i():U==="leave"&&(s==null||s())}),G==="leave"&&!Ue(k)&&(M("hidden"),w(b))});u.useEffect(()=>{C&&o||(j(T),le(T))},[T,C,o]);let te=!(!o||!C||!H||K),[,P]=yt(te,E,T,{start:j,end:le}),q=ve({ref:F,className:((r=ct(g.className,V&&c,V&&f,P.enter&&c,P.enter&&P.closed&&f,P.enter&&!P.closed&&h,P.leave&&d,P.leave&&!P.closed&&p,P.leave&&P.closed&&v,!P.transition&&T&&m))==null?void 0:r.trim())||void 0,...$t(P)}),$=0;R==="visible"&&($|=Y.Open),R==="hidden"&&($|=Y.Closed),T&&R==="hidden"&&($|=Y.Opening),!T&&R==="visible"&&($|=Y.Closing);let I=ee();return S.createElement(Ge.Provider,{value:k},S.createElement(Sn,{value:$},I({ourProps:q,theirProps:g,defaultTag:In,features:Nn,visible:R==="visible",name:"Transition.Child"})))}function ml(e,t){let{show:n,appear:r=!1,unmount:o=!0,...a}=e,i=u.useRef(null),l=Ln(e),s=Z(...l?[i,t]:t===null?[]:[t]);Pt();let c=_e();if(n===void 0&&c!==null&&(n=(c&Y.Open)===Y.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[f,h]=u.useState(n?"visible":"hidden"),m=An(()=>{n||h("hidden")}),[d,p]=u.useState(!0),v=u.useRef([n]);N(()=>{d!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),p(!1))},[v,n]);let g=u.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);N(()=>{n?h("visible"):!Ue(m)&&i.current!==null&&h("hidden")},[n,m]);let E={unmount:o},y=x(()=>{var F;d&&p(!1),(F=e.beforeEnter)==null||F.call(e)}),b=x(()=>{var F;d&&p(!1),(F=e.beforeLeave)==null||F.call(e)}),C=ee();return S.createElement(Ge.Provider,{value:m},S.createElement(We.Provider,{value:g},C({ourProps:{...E,as:u.Fragment,children:S.createElement(Dn,{ref:s,...E,...a,beforeEnter:y,beforeLeave:b})},theirProps:{},defaultTag:u.Fragment,features:Nn,visible:f==="visible",name:"Transition"})))}function hl(e,t){let n=u.useContext(We)!==null,r=_e()!==null;return S.createElement(S.Fragment,null,!n&&r?S.createElement(mt,{ref:t,...e}):S.createElement(Dn,{ref:t,...e}))}let mt=z(ml),Dn=z(vl),gl=z(hl),Zl=Object.assign(mt,{Child:gl,Root:mt});var bl=Object.defineProperty,El=(e,t,n)=>t in e?bl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ut=(e,t,n)=>(El(e,typeof t!="symbol"?t+"":t,n),n),L=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(L||{}),$l=(e=>(e[e.OpenPopover=0]="OpenPopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))($l||{});let yl={0:e=>e.popoverState===0?e:{...e,popoverState:0,__demoMode:!1},1(e){return e.popoverState===1?e:{...e,popoverState:1,__demoMode:!1}},2(e,t){return e.button===t.button?e:{...e,button:t.button}},3(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},4(e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},5(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}};class St extends mn{constructor(t){super(t),Ut(this,"actions",{close:()=>this.send({type:1}),refocusableClose:n=>{this.actions.close();let r=n?re(n)?n:"current"in n&&re(n.current)?n.current:this.state.button:this.state.button;r==null||r.focus()},open:()=>this.send({type:0}),setButtonId:n=>this.send({type:3,buttonId:n}),setButton:n=>this.send({type:2,button:n}),setPanelId:n=>this.send({type:5,panelId:n}),setPanel:n=>this.send({type:4,panel:n})}),Ut(this,"selectors",{isPortalled:n=>{if(!n.button||!n.panel)return!1;for(let c of document.querySelectorAll("body > *"))if(Number(c==null?void 0:c.contains(n.button))^Number(c==null?void 0:c.contains(n.panel)))return!0;let r=ke(),o=r.indexOf(n.button),a=(o+r.length-1)%r.length,i=(o+1)%r.length,l=r[a],s=r[i];return!n.panel.contains(l)&&!n.panel.contains(s)}});{let n=this.state.id,r=bn.get(null);this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new St({id:t,__demoMode:n,popoverState:n?0:1,buttons:{current:[]},button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:{current:null},afterPanelSentinel:{current:null},afterButtonSentinel:{current:null}})}reduce(t,n){return J(n.type,yl,t,n)}}const Hn=u.createContext(null);function Ve(e){let t=u.useContext(Hn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ve),n}return t}function wl({id:e,__demoMode:t=!1}){let n=u.useMemo(()=>St.new({id:e,__demoMode:t}),[]);return Cn(()=>n.dispose()),n}let Ct=u.createContext(null);Ct.displayName="PopoverGroupContext";function jn(){return u.useContext(Ct)}let Ke=u.createContext(null);Ke.displayName="PopoverPanelContext";function Pl(){return u.useContext(Ke)}let Sl="div";function Cl(e,t){var n;let r=u.useId(),{__demoMode:o=!1,...a}=e,i=wl({id:r,__demoMode:o}),l=u.useRef(null),s=Z(t,fn(w=>{l.current=w})),[c,f,h,m,d]=$e(i,u.useCallback(w=>[w.popoverState,w.button,w.panel,w.buttonId,w.panelId],[])),p=Pe((n=l.current)!=null?n:f),v=se(m),g=se(d),E=u.useMemo(()=>({buttonId:v,panelId:g,close:i.actions.close}),[v,g,i]),y=jn(),b=y==null?void 0:y.registerPopover,C=x(()=>{var w;return(w=y==null?void 0:y.isFocusWithinPopoverGroup())!=null?w:(p==null?void 0:p.activeElement)&&((f==null?void 0:f.contains(p.activeElement))||(h==null?void 0:h.contains(p.activeElement)))});u.useEffect(()=>b==null?void 0:b(E),[b,E]);let[F,O]=ll(),T=kn(f),W=il({mainTreeNode:T,portals:F,defaultContainers:[{get current(){return i.state.button}},{get current(){return i.state.panel}}]});io(p==null?void 0:p.defaultView,"focus",w=>{var H,K,V,_,k,j;w.target!==window&&he(w.target)&&i.state.popoverState===L.Open&&(C()||i.state.button&&i.state.panel&&(W.contains(w.target)||(K=(H=i.state.beforePanelSentinel.current)==null?void 0:H.contains)!=null&&K.call(H,w.target)||(_=(V=i.state.afterPanelSentinel.current)==null?void 0:V.contains)!=null&&_.call(V,w.target)||(j=(k=i.state.afterButtonSentinel.current)==null?void 0:k.contains)!=null&&j.call(k,w.target)||i.actions.close()))},!0);let Q=c===L.Open;so(Q,W.resolveContainers,(w,H)=>{i.actions.close(),Et(H,bt.Loose)||(w.preventDefault(),f==null||f.focus())});let R=u.useMemo(()=>({open:c===L.Open,close:i.actions.refocusableClose}),[c,i]),M=$e(i,u.useCallback(w=>J(w.popoverState,{[L.Open]:Y.Open,[L.Closed]:Y.Closed}),[])),A={ref:s},D=ee();return S.createElement(Rn,{node:T},S.createElement(Yo,null,S.createElement(Ke.Provider,{value:null},S.createElement(Hn.Provider,{value:i},S.createElement(dn,{value:i.actions.refocusableClose},S.createElement(Sn,{value:M},S.createElement(O,null,D({ourProps:A,theirProps:a,slot:R,defaultTag:Sl,name:"Popover"}))))))))}let xl="button";function Fl(e,t){let n=u.useId(),{id:r=`headlessui-popover-button-${n}`,disabled:o=!1,autoFocus:a=!1,...i}=e,l=Ve("Popover.Button"),[s,c,f,h,m,d,p]=$e(l,u.useCallback($=>[$.popoverState,l.selectors.isPortalled($),$.button,$.buttonId,$.panel,$.panelId,$.afterButtonSentinel],[])),v=u.useRef(null),g=`headlessui-focus-sentinel-${u.useId()}`,E=jn(),y=E==null?void 0:E.closeOthers,b=Pl()!==null;u.useEffect(()=>{if(!b)return l.actions.setButtonId(r),()=>l.actions.setButtonId(null)},[b,r,l]);let[C]=u.useState(()=>Symbol()),F=Z(v,t,Vo(),x($=>{if(!b){if($)l.state.buttons.current.push(C);else{let I=l.state.buttons.current.indexOf(C);I!==-1&&l.state.buttons.current.splice(I,1)}l.state.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),$&&l.actions.setButton($)}})),O=Z(v,t),T=Pe(v),W=x($=>{var I,B,G;if(b){if(l.state.popoverState===L.Closed)return;switch($.key){case ie.Space:case ie.Enter:$.preventDefault(),(B=(I=$.target).click)==null||B.call(I),l.actions.close(),(G=l.state.button)==null||G.focus();break}}else switch($.key){case ie.Space:case ie.Enter:$.preventDefault(),$.stopPropagation(),l.state.popoverState===L.Closed?(y==null||y(l.state.buttonId),l.actions.open()):l.actions.close();break;case ie.Escape:if(l.state.popoverState!==L.Open)return y==null?void 0:y(l.state.buttonId);if(!v.current||T!=null&&T.activeElement&&!v.current.contains(T.activeElement))return;$.preventDefault(),$.stopPropagation(),l.actions.close();break}}),Q=x($=>{b||$.key===ie.Space&&$.preventDefault()}),R=x($=>{var I,B;sn($.currentTarget)||o||(b?(l.actions.close(),(I=l.state.button)==null||I.focus()):($.preventDefault(),$.stopPropagation(),l.state.popoverState===L.Closed?(y==null||y(l.state.buttonId),l.actions.open()):l.actions.close(),(B=l.state.button)==null||B.focus()))}),M=x($=>{$.preventDefault(),$.stopPropagation()}),{isFocusVisible:A,focusProps:D}=br({autoFocus:a}),{isHovered:w,hoverProps:H}=gr({isDisabled:o}),{pressed:K,pressProps:V}=Sr({disabled:o}),_=s===L.Open,k=u.useMemo(()=>({open:_,active:K||_,disabled:o,hover:w,focus:A,autofocus:a}),[_,w,A,K,o,a]),j=co(e,f),le=ft(b?{ref:O,type:j,onKeyDown:W,onClick:R,disabled:o||void 0,autoFocus:a}:{ref:F,id:h,type:j,"aria-expanded":s===L.Open,"aria-controls":m?d:void 0,disabled:o||void 0,autoFocus:a,onKeyDown:W,onKeyUp:Q,onClick:R,onMouseDown:M},D,H,V),te=Mn(),P=x(()=>{if(!re(l.state.panel))return;let $=l.state.panel;function I(){J(te.current,{[ue.Forwards]:()=>fe($,ae.First),[ue.Backwards]:()=>fe($,ae.Last)})===He.Error&&fe(ke().filter(B=>B.dataset.headlessuiFocusGuard!=="true"),J(te.current,{[ue.Forwards]:ae.Next,[ue.Backwards]:ae.Previous}),{relativeTo:l.state.button})}I()}),q=ee();return S.createElement(S.Fragment,null,q({ourProps:le,theirProps:i,slot:k,defaultTag:xl,name:"Popover.Button"}),_&&!b&&c&&S.createElement(De,{id:g,ref:p,features:Oe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:P}))}let Tl="div",Ol=we.RenderStrategy|we.Static;function Bn(e,t){let n=u.useId(),{id:r=`headlessui-popover-backdrop-${n}`,transition:o=!1,...a}=e,i=Ve("Popover.Backdrop"),l=$e(i,u.useCallback(E=>E.popoverState,[])),[s,c]=u.useState(null),f=Z(t,c),h=_e(),[m,d]=yt(o,s,h!==null?(h&Y.Open)===Y.Open:l===L.Open),p=x(E=>{if(sn(E.currentTarget))return E.preventDefault();i.actions.close()}),v=u.useMemo(()=>({open:l===L.Open}),[l]),g={ref:f,id:r,"aria-hidden":!0,onClick:p,...$t(d)};return ee()({ourProps:g,theirProps:a,slot:v,defaultTag:Tl,features:Ol,visible:m,name:"Popover.Backdrop"})}let Rl="div",kl=we.RenderStrategy|we.Static;function Ml(e,t){let n=u.useId(),{id:r=`headlessui-popover-panel-${n}`,focus:o=!1,anchor:a,portal:i=!1,modal:l=!1,transition:s=!1,...c}=e,f=Ve("Popover.Panel"),h=$e(f,f.selectors.isPortalled),[m,d,p,v,g]=$e(f,u.useCallback(P=>[P.popoverState,P.button,P.__demoMode,P.beforePanelSentinel,P.afterPanelSentinel],[])),E=`headlessui-focus-sentinel-before-${n}`,y=`headlessui-focus-sentinel-after-${n}`,b=u.useRef(null),C=Uo(a),[F,O]=qo(C),T=Ko();C&&(i=!0);let[W,Q]=u.useState(null),R=Z(b,t,C?F:null,f.actions.setPanel,Q),M=Pe(d),A=Pe(b);N(()=>(f.actions.setPanelId(r),()=>f.actions.setPanelId(null)),[r,f]);let D=_e(),[w,H]=yt(s,W,D!==null?(D&Y.Open)===Y.Open:m===L.Open);Qr(w,d,f.actions.close),Eo(p?!1:l&&w,A);let K=x(P=>{var q;switch(P.key){case ie.Escape:if(f.state.popoverState!==L.Open||!b.current||A!=null&&A.activeElement&&!b.current.contains(A.activeElement))return;P.preventDefault(),P.stopPropagation(),f.actions.close(),(q=f.state.button)==null||q.focus();break}});u.useEffect(()=>{var P;e.static||m===L.Closed&&((P=e.unmount)==null||P)&&f.actions.setPanel(null)},[m,e.unmount,e.static,f]),u.useEffect(()=>{if(p||!o||m!==L.Open||!b.current)return;let P=A==null?void 0:A.activeElement;b.current.contains(P)||fe(b.current,ae.First)},[p,o,b.current,m]);let V=u.useMemo(()=>({open:m===L.Open,close:f.actions.refocusableClose}),[m,f]),_=ft(C?T():{},{ref:R,id:r,onKeyDown:K,onBlur:o&&m===L.Open?P=>{var q,$,I,B,G;let U=P.relatedTarget;U&&b.current&&((q=b.current)!=null&&q.contains(U)||(f.actions.close(),((I=($=v.current)==null?void 0:$.contains)!=null&&I.call($,U)||(G=(B=g.current)==null?void 0:B.contains)!=null&&G.call(B,U))&&U.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...c.style,...O,"--button-width":Hr(d,!0).width},...$t(H)}),k=Mn(),j=x(()=>{let P=b.current;if(!P)return;function q(){J(k.current,{[ue.Forwards]:()=>{var $;fe(P,ae.First)===He.Error&&(($=f.state.afterPanelSentinel.current)==null||$.focus())},[ue.Backwards]:()=>{var $;($=f.state.button)==null||$.focus({preventScroll:!0})}})}q()}),le=x(()=>{let P=b.current;if(!P)return;function q(){J(k.current,{[ue.Forwards]:()=>{if(!f.state.button)return;let $=ke(),I=$.indexOf(f.state.button),B=$.slice(0,I+1),G=[...$.slice(I+1),...B];for(let U of G.slice())if(U.dataset.headlessuiFocusGuard==="true"||W!=null&&W.contains(U)){let xt=G.indexOf(U);xt!==-1&&G.splice(xt,1)}fe(G,ae.First,{sorted:!1})},[ue.Backwards]:()=>{var $;fe(P,ae.Previous)===He.Error&&(($=f.state.button)==null||$.focus())}})}q()}),te=ee();return S.createElement(Jo,null,S.createElement(Ke.Provider,{value:r},S.createElement(dn,{value:f.actions.refocusableClose},S.createElement(sl,{enabled:i?e.static||w:!1,ownerDocument:M},w&&h&&S.createElement(De,{id:E,ref:v,features:Oe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:j}),te({ourProps:_,theirProps:c,slot:V,defaultTag:Rl,features:kl,visible:w,name:"Popover.Panel"}),w&&h&&S.createElement(De,{id:y,ref:g,features:Oe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:le})))))}let Ll="div";function Al(e,t){let n=u.useRef(null),r=Z(n,t),[o,a]=u.useState([]),i=x(v=>{a(g=>{let E=g.indexOf(v);if(E!==-1){let y=g.slice();return y.splice(E,1),y}return g})}),l=x(v=>(a(g=>[...g,v]),()=>i(v))),s=x(()=>{var v;let g=Se(n);if(!g)return!1;let E=g.activeElement;return(v=n.current)!=null&&v.contains(E)?!0:o.some(y=>{var b,C;return((b=g.getElementById(y.buttonId.current))==null?void 0:b.contains(E))||((C=g.getElementById(y.panelId.current))==null?void 0:C.contains(E))})}),c=x(v=>{for(let g of o)g.buttonId.current!==v&&g.close()}),f=u.useMemo(()=>({registerPopover:l,unregisterPopover:i,isFocusWithinPopoverGroup:s,closeOthers:c}),[l,i,s,c]),h=u.useMemo(()=>({}),[]),m=e,d={ref:r},p=ee();return S.createElement(Rn,null,S.createElement(Ct.Provider,{value:f},p({ourProps:d,theirProps:m,slot:h,defaultTag:Ll,name:"Popover.Group"})))}let Il=z(Cl),Nl=z(Fl),Dl=z(Bn),Hl=z(Bn),jl=z(Ml),Bl=z(Al),ea=Object.assign(Il,{Button:Nl,Backdrop:Hl,Overlay:Dl,Panel:jl,Group:Bl});export{br as $,kn as A,bn as B,so as C,Eo as D,io as E,gl as F,Qr as G,il as H,Jr as I,Jo as J,z as K,ee as L,Ql as M,sl as N,ul as O,Rn as P,dn as Q,we as R,$e as S,ae as T,ea as U,Ul as V,gr as W,Sr as X,co as Y,sn as Z,ft as _,ie as a,Se as a0,mn as a1,Yl as a2,Ur as a3,ao as a4,Yo as a5,Sn as a6,Uo as a7,qo as a8,Ko as a9,yt as aa,$t as ab,Hr as ac,Jl as ad,Vo as ae,Xl as af,zl as ag,Et as ah,bt as ai,oe as aj,se as ak,ve as al,Vl as am,Lr as an,Ae as ao,an as ap,fn as aq,Pe as b,re as c,J as d,ue as e,dt as f,fe as g,De as h,he as i,Cn as j,ro as k,Pt as l,cl as m,N as n,x as o,je as p,on as q,He as r,Oe as s,de as t,Mn as u,_e as v,Y as w,ll as x,Z as y,Zl as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var n=Object.defineProperty;var d=(i,t,e)=>t in i?n(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var c=(i,t,e)=>d(i,typeof t!="symbol"?t+"":t,e);import{a,M as f}from"./file-
|
|
1
|
+
var n=Object.defineProperty;var d=(i,t,e)=>t in i?n(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var c=(i,t,e)=>d(i,typeof t!="symbol"?t+"":t,e);import{a,M as f}from"./file-ZamfLSgo.js";import{b as p,a0 as u}from"./index-EyUZDtV7.js";class h extends a{constructor(e,s){super(e!=null&&e.isModel?e.initial:{...e,directories:(e==null?void 0:e.directories)??[],files:(e==null?void 0:e.files)??[]},s);c(this,"_isOpen",!1);c(this,"directories",[]);c(this,"files",[]);c(this,"syncStateOpen");e!=null&&e.isModel?(this.directories=e.directories,this.files=e.files):this.update({files:this.initial.files,directories:this.initial.directories})}get level(){var e;return(((e=this.parent)==null?void 0:e.level)??-1)+1}get isChanged(){return this.name!==this.initial.name||this.files.some(e=>e.isChanged)||this.directories.some(e=>e.isChanged)}get isEmpty(){return this.directories.length===0&&this.files.length===0}get withFiles(){return this.files.length>0}get withDirectories(){return this.directories.length>0}get isNotEmpty(){return this.withFiles||this.withDirectories}get artifacts(){return this.directories.concat(this.files)}get allDirectories(){return this.directories.concat(this.directories.map(e=>e.allDirectories).flat(100))}get allFiles(){return this.files.concat(this.allDirectories.map(e=>e.files).flat(100))}get allVisibleArtifacts(){return this.directories.map(e=>e.isOpened?[e,e.allVisibleArtifacts]:[e]).flat(100).concat(this.isOpened?this.files:[])}get allArtifacts(){return this.directories.map(e=>[e,e.allArtifacts]).flat(100).concat(this.files)}get isOpened(){return this._isOpen}get isClosed(){return p(this._isOpen)}get isModels(){return this.path.startsWith("models")}get isTests(){return this.path.startsWith("tests")}open(){var e;this._isOpen=!0,(e=this.syncStateOpen)==null||e.call(this,this.isOpened)}close(){var e;this._isOpen=!1,(e=this.syncStateOpen)==null||e.call(this,this.isOpened)}toggle(){this.isOpened?this.close():this.open()}expand(){this.open(),this.directories.forEach(e=>{e.expand()})}collapse(){this.close(),this.directories.forEach(e=>{e.collapse()})}containsName(e){return this.artifacts.some(s=>s.name===e)}hasFile(e){return this.allFiles.includes(e)}hasDirectory(e){return this.allDirectories.includes(e)}addFile(e){this.files.push(e),e.parent=this}addDirectory(e){this.directories.push(e),e.parent=this}removeFile(e){this.files=this.files.filter(s=>s!==e)}removeDirectory(e){this.directories=this.directories.filter(s=>s!==e)}update({files:e=[],directories:s=[]}){this.files=[],this.directories=[],s.forEach(r=>{this.addDirectory(new h(r,this))}),e.forEach(r=>{this.addFile(new f(r,this))})}}const O=u((i,t)=>({tests:void 0,project:new h,selectedFile:void 0,files:new Map,activeRange:[],setTests(e){i(()=>({tests:e}))},setActiveRange(e){const s=t();i(()=>({activeRange:s.project.allVisibleArtifacts.filter(r=>o(r,e??s.activeRange))}))},inActiveRange(e){const s=t();return o(e,s.activeRange)},setProject(e){i(()=>({project:e}))},setFiles(e){const s=t();s.files.clear(),i(()=>({files:new Map(e.reduce((r,l)=>r.set(l.id,l),s.files))}))},setSelectedFile(e){i(()=>({selectedFile:e}))},findArtifactByPath(e){const s=t();return a.findArtifactByPath(s.project,e)},refreshFiles(e){const s=t();s.setFiles(e??s.project.allFiles)}}));function o(i,t){return t.includes(i)}export{h as M,O as u};
|
web/client/dist/index.html
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{y as u,j as s,O as f,e as t,I as c,B as p,n as d,m as x}from"./index-CkIQhGgw.js";import{P as j}from"./Page-KC6UG65M.js";import{u as h}from"./project-XFpF0AcJ.js";import{S as v}from"./SourceList-DQ72TcK1.js";import{S as y}from"./SourceListItem-CncMnWed.js";import"./SplitPane-BY85POxQ.js";import"./file-Bs2Eq56_.js";import"./Input-BY5Rc3go.js";import"./index-COQuzlwN.js";import"./index-DQbKL5-Q.js";function k(){const{pathname:a}=u(),i=h(e=>e.files),r=Array.from(i.values()).filter(e=>e.path.endsWith("audits"));return s.jsx(j,{sidebar:s.jsxs("div",{className:"flex flex-col w-full h-full",children:[s.jsx(v,{keyId:"basename",keyName:"basename",to:t.Audits,items:r,isActive:e=>`${t.Audits}/${e}`===a,className:"h-full",listItem:({to:e,name:o,description:m,text:l,disabled:n=!1})=>s.jsx(y,{to:e,name:o,text:l,description:m,disabled:n})}),s.jsx(c,{}),s.jsx("div",{className:"py-1 px-1 flex justify-end",children:s.jsx(p,{size:x.sm,variant:d.Neutral,children:"Run All"})})]}),content:s.jsx(f,{})})}export{k as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s,c as i,m as a,n,I as p}from"./index-CkIQhGgw.js";function l({variant:t=n.Neutral,size:e=a.md,isFull:r=!1,isCenter:u=!1,hasBackground:x=!0,hasBackgroundOnHover:f=!1,hasBorder:c=!1,children:m,className:b}){return s.jsx("div",{className:i("w-full text-sm px-4 overflow-hidden rounded-lg",e===a.sm&&"py-2",e===a.md&&"py-4",e===a.lg&&"py-6",r&&"h-full",u&&"justify-center items-center",c&&"border-2",w(t,x,f),b),children:m})}function g({className:t}){return s.jsx(p,{className:i("mx-4 w-full",t)})}function d({children:t,className:e}){return s.jsx("h4",{className:i("font-bold text-sm whitespace-nowrap text-left",e),children:t})}function o({children:t,className:e}){return s.jsx("p",{className:i("text-neutral-600",e),children:t})}l.Label=d;l.Description=o;l.Divider=g;function w(t,e=!0,r=!1){switch(t){case n.Primary:return[r?"hover:bg-primary-5":"",e?"bg-primary-5":"","text-primary-600 dark:text-primary-400"];case n.Success:return[r?"hover:bg-success-5":"",e?"bg-success-5":"","text-success-600 dark:text-success-400"];case n.Warning:return[r?"hover:bg-warning-5":"",e?"bg-warning-5":"","text-warning-600 dark:text-warning-400"];case n.Danger:return[r?"hover:bg-danger-5":"",e?"bg-danger-5":"","text-danger-600 dark:text-danger-400"];case n.Info:return[r?"hover:bg-info-5":"",e?"bg-info-5":"","text-info-600 dark:text-info-400"];case n.Neutral:return[r?"hover:bg-neutral-5":"",e?"bg-neutral-5":"","text-neutral-600 dark:text-neutral-400"];default:return["bg-transparent","text-neutral-600 dark:text-neutral-400"]}}export{l as B};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as a,U as l,w as e,j as r,V as n,e as d}from"./index-CkIQhGgw.js";import{D as u}from"./ReportErrors-mVM8O5iE.js";import"./PlusCircleIcon-CoFMRFQI.js";import"./transition-B5aHgz_j.js";import"./index-COQuzlwN.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./SplitPane-BY85POxQ.js";function E(){const{errors:i}=a(),{id:o}=l(),s=e(o)?void 0:Array.from(i).find(t=>t.id===o);return r.jsx("div",{className:"flex overflow-auto w-full h-full",children:e(s)?r.jsx(n,{link:d.Errors,description:e(o)?void 0:`Error ${o} Does Not Exist`,message:"Back To Errors"}):r.jsx("div",{className:"p-4 h-full w-full",children:r.jsx("div",{className:"w-full h-full p-4 rounded-lg bg-danger-5 text-danger-700",children:r.jsx(u,{error:s,scope:s.key,withSplitPane:!0})})})})}export{E as default};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{r as y,R as J,a as O,j as e,n as I,t as Me,b as C,B as te,w as B,m as T,c as g,M as Pe,g as V,J as ze,K as ie,i as M,P as Q,h as H,T as Re,I as re,Q as xe,D as Ue,C as U,s as Le,L as $e,d as Ve,l as Ge,p as He,q as qe,U as Ke,V as Ze,e as Ye}from"./index-CkIQhGgw.js";import{G as Je,B as Qe,F as We,w as Xe,u as Z,S as es,A as ss,a as ge,b as E,E as A,P as L,c as as}from"./SelectEnvironment-8p6ZQ-QH.js";import{u as x,a as Y,E as z}from"./plan-BZyi7OFv.js";import{B as F}from"./Banner-Cd1C5Udq.js";import{A as $,F as ye,a as we,p as ns}from"./PlusCircleIcon-CoFMRFQI.js";import{U as ts,C as Ee,I as ls,y as is,o as le,T as rs,p as os,b as cs,F as ds,c as ms,A as us,z as Te,D as ee}from"./transition-B5aHgz_j.js";import{I as q}from"./Input-BY5Rc3go.js";import{T as ps,p as fs}from"./ListboxShow-TFvq9fMB.js";import{u as Be}from"./project-XFpF0AcJ.js";import{F as je}from"./context-Dx2o1ZRq.js";import"./ModelLineage-CB8Rie_r.js";import"./editor-Dj_6cws7.js";import"./file-Bs2Eq56_.js";import"./SearchList-BShQn9jm.js";import"./help-6Q7f7fjd.js";import"./ChevronDownIcon-Clb0EegJ.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./index-COQuzlwN.js";import"./SourceList-DQ72TcK1.js";import"./index-DQbKL5-Q.js";function hs({title:s,titleId:a,...t},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":a},t),s?y.createElement("title",{id:a},s):null,y.createElement("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"}))}const W=y.forwardRef(hs);let be=y.createContext(null);be.displayName="GroupContext";let xs=y.Fragment;function js(s){var a;let[t,r]=y.useState(null),[l,i]=We(),[o,u]=Xe(),c=y.useMemo(()=>({switch:t,setSwitch:r,labelledby:l,describedby:o}),[t,r,l,o]),d={},p=s;return J.createElement(u,{name:"Switch.Description"},J.createElement(i,{name:"Switch.Label",props:{htmlFor:(a=c.switch)==null?void 0:a.id,onClick(n){t&&(n.currentTarget.tagName==="LABEL"&&n.preventDefault(),t.click(),t.focus({preventScroll:!0}))}}},J.createElement(be.Provider,{value:c},Ee({ourProps:d,theirProps:p,defaultTag:xs,name:"Switch.Group"}))))}let vs="button";function gs(s,a){var t;let r=ls(),{id:l=`headlessui-switch-${r}`,checked:i,defaultChecked:o=!1,onChange:u,disabled:c=!1,name:d,value:p,form:n,...j}=s,m=y.useContext(be),f=y.useRef(null),h=is(f,a,m===null?null:m.setSwitch),[P,S]=ps(i,u,o),D=le(()=>S==null?void 0:S(!P)),N=le(_=>{if(us(_.currentTarget))return _.preventDefault();_.preventDefault(),D()}),k=le(_=>{_.key===Te.Space?(_.preventDefault(),D()):_.key===Te.Enter&&fs(_.currentTarget)}),w=le(_=>_.preventDefault()),R=y.useMemo(()=>({checked:P}),[P]),pe={id:l,ref:h,role:"switch",type:rs(s,f),tabIndex:s.tabIndex===-1?0:(t=s.tabIndex)!=null?t:0,"aria-checked":P,"aria-labelledby":m==null?void 0:m.labelledby,"aria-describedby":m==null?void 0:m.describedby,disabled:c,onClick:N,onKeyUp:k,onKeyPress:w},fe=os();return y.useEffect(()=>{var _;let b=(_=f.current)==null?void 0:_.closest("form");b&&o!==void 0&&fe.addEventListener(b,"reset",()=>{S(o)})},[f,S]),J.createElement(J.Fragment,null,d!=null&&P&&J.createElement(cs,{features:ms.Hidden,...ds({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:c,form:n,checked:P,name:d,value:p})}),Ee({ourProps:pe,theirProps:j,slot:R,defaultTag:vs,name:"Switch"}))}let ys=ts(gs),ws=js,he=Object.assign(ys,{Group:ws,Label:Qe,Description:Je});function bs(){const s=O(a=>a.environment);return e.jsx("div",{className:"flex flex-col px-4 py-2 w-full",children:e.jsx(F,{variant:I.Warning,children:e.jsx($,{defaultOpen:!1,children:({open:a})=>e.jsxs(e.Fragment,{children:[e.jsxs($.Button,{className:"w-full flex items-center justify-between",children:[e.jsx(F.Label,{className:"w-full",children:s.isInitialProd?"Initializing Prod Environment":"Prod Environment"}),s.isInitialProd&&e.jsx(e.Fragment,{children:a?e.jsx(ye,{className:"w-5 text-warning-500"}):e.jsx(we,{className:"w-5 text-warning-500"})})]}),s.isInitialProd&&e.jsx($.Panel,{className:"px-2 text-sm mt-2",children:e.jsx(F.Description,{children:"Prod will be completely backfilled in order to ensure there are no data gaps. After this is applied, it is recommended to validate further changes in a dev environment before deploying to production."})})]})})})})}function Ns(s=0){return y.useCallback(a=>{setTimeout(()=>{a==null||a.focus()},s)},[s])}function ks({run:s,apply:a,cancel:t,reset:r}){const l=Me(),{change_categorization:i}=Z(),o=O(b=>b.modules),u=O(b=>b.environment),c=O(b=>b.environments),d=O(b=>b.addConfirmation),p=O(b=>b.setShowConfirmation),n=x(b=>b.planAction),j=x(b=>b.planOverview),m=x(b=>b.planApply),f=x(b=>b.planCancel),h=Ns();function P(b){b.stopPropagation(),r()}function S(b){b.stopPropagation(),t()}function D(b){b.stopPropagation(),l(-1)}function N(b){b.stopPropagation();const Oe=u.isProd&&C(u.isInitial),ke=Array.from(i.values()).some(Ie=>B(Ie.category));Oe?d({headline:"Applying Plan Directly On Prod Environment!",tagline:"Safer choice will be to select or add new environment first.",description:"Are you sure you want to apply your changes directly on prod?",yesText:`Yes, Run ${u.name}`,noText:"No, Cancel",action:a,details:ke?["ATTENTION!","[Breaking Change] category will be applied to all uncategorized changes"]:void 0,children:e.jsxs("div",{className:"mt-5 pt-4",children:[e.jsx("h4",{className:"mb-2",children:`${c.size>1?"Select or ":""}Add Environment`}),e.jsxs("div",{className:"flex items-center relative",children:[c.size>1&&e.jsx(es,{className:"mr-2",showAddEnvironment:!1,onSelect:()=>{p(!1)},size:T.md}),e.jsx(ss,{className:"w-full",size:T.md,onAdd:()=>{p(!1)}})]})]})}):ke?d({headline:"Some changes are missing categorization!",description:"Are you sure you want to proceed?",details:["[Breaking Change] category will be applied to all uncategorized changes"],yesText:"Yes, Apply",noText:"No, Cancel",action:a}):a()}function k(b){b.stopPropagation(),s()}const w=j.isFailed||m.isFailed||f.isSuccessful,R=C(n.isCancelling)&&C(n.isDone)&&(n.isProcessing?C(f.isSuccessful):!0)&&C(w),pe=n.isApplying||f.isCancelling||m.isRunning&&j.isFinished,fe=w||C(n.isProcessing)&&C(n.isRun)&&C(n.isDone),_=o.showHistoryNavigation;return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex justify-between pt-2 pl-4 pr-2 pb-2",children:[e.jsx("div",{className:"flex w-full items-center",children:e.jsx(ee,{appear:!0,show:R,enter:"transition ease duration-300 transform",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"transition ease duration-300 transform",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",className:"trasition-all duration-300 ease-in-out",children:R&&e.jsx(te,{disabled:n.isProcessing||f.isSuccessful||n.isDone,onClick:n.isRun?k:f.isSuccessful?void 0:N,ref:h,variant:f.isSuccessful?I.Danger:I.Primary,autoFocus:!0,className:"trasition-all duration-300 ease-in-out",children:e.jsx("span",{children:Y.getActionDisplayName(n,f.isSuccessful?[]:[z.RunningTask,z.Running,z.Run,z.Applying,z.ApplyBackfill,z.ApplyVirtual,z.ApplyChangesAndBackfill,z.ApplyMetadata],f.isSuccessful?"Canceled":"Done")})})})}),e.jsxs("div",{className:"flex items-center",children:[pe&&e.jsx(te,{onClick:S,variant:I.Danger,disabled:n.isCancelling||n.isProcessing&&f.isSuccessful,children:Y.getActionDisplayName(n,n.isProcessing&&C(f.isSuccessful)?[z.Cancelling]:[],f.isSuccessful?"Finishing Cancellation...":"Cancel")}),fe&&e.jsx(te,{onClick:P,variant:I.Info,disabled:n.isCancelling||n.isProcessing&&f.isSuccessful,children:"Start Over"}),_&&e.jsx(te,{onClick:D,variant:I.Info,children:"Go Back"})]})]})})}function Ps({label:s,enabled:a,setEnabled:t,a11yTitle:r,size:l=T.md,disabled:i=!1,className:o}){return e.jsxs(he.Group,{as:"div",className:"m-1",children:[e.jsxs(he,{checked:i?!1:a,onChange:t,className:g("flex relative border-secondary-30 rounded-full m-0","shrink-0 focus:outline-none ring-secondary-300 ring-opacity-60 ring-offset ring-offset-secondary-100 focus:border-secondary-500 focus-visible:ring-opacity-75","transition duration-200 ease-in-out",a?"bg-secondary-500":"bg-secondary-20",o,i?"opacity-50 cursor-not-allowed":"cursor-pointer",l===T.sm&&"h-[14px] w-6 focus:ring-1 border",l===T.md&&"h-5 w-10 focus:ring-2 border-2",l===T.lg&&"h-7 w-14 focus:ring-4 border-2"),disabled:i,children:[e.jsx("span",{className:"sr-only",children:r}),e.jsx("span",{"aria-hidden":"true",className:g("pointer-events-none inline-block transform rounded-full shadow-md transition duration-200 ease-in-out","bg-light",l===T.sm&&"h-3 w-3",l===T.md&&"h-4 w-4",l===T.lg&&"h-6 w-6",a&&l===T.sm&&"translate-x-[10px]",a&&l===T.md&&"translate-x-5",a&&l===T.lg&&"translate-x-7")})]}),s!=null&&e.jsx(he.Label,{className:g("text-xs font-light ml-1 text-neutral-600 dark:text-neutral-400"),children:s})]})}function K({label:s,info:a,enabled:t,disabled:r=!1,setEnabled:l,className:i}){return e.jsxs("div",{className:g("flex justify-between",i),children:[e.jsxs("label",{className:"block mb-1 px-3 text-sm font-bold",children:[s,e.jsx("small",{className:"block text-xs text-neutral-500",children:a})]}),e.jsx(Ps,{disabled:r,enabled:t,setEnabled:l,size:T.lg})]})}function Ts({disabled:s=!1,className:a}){const t=ge(),{start:r,end:l,isInitialPlanRun:i}=Z();return e.jsxs("div",{className:g("flex w-full flex-wrap md:flex-nowrap",a),children:[e.jsx(q,{className:"w-full md:w-[50%]",label:"Start Date (UTC)",info:"The start datetime of the interval",disabled:s||i,children:({disabled:o,className:u})=>e.jsx(q.Textfield,{className:g(u,"w-full"),disabled:o,placeholder:"2023-12-13",value:r,onInput:c=>{c.stopPropagation(),t({type:E.DateStart,start:c.target.value})}})}),e.jsx(q,{className:"w-full md:w-[50%]",label:"End Date (UTC)",info:"The end datetime of the interval",disabled:s||i,children:({disabled:o,className:u})=>e.jsx(q.Textfield,{className:g(u,"w-full"),disabled:o,placeholder:"2022-12-13",value:l,onInput:c=>{c.stopPropagation(),t({type:E.DateEnd,end:c.target.value})}})})]})}function Cs(){const s=ge(),{skip_tests:a,no_gaps:t,skip_backfill:r,forward_only:l,auto_apply:i,no_auto_categorization:o,restate_models:u,isInitialPlanRun:c,create_from:d,include_unmodified:p}=Z(),n=y.useRef(null),j=x(N=>N.planAction),m=x(N=>N.planOverview),f=x(N=>N.planApply),h=O(N=>N.environment),P=O(N=>N.environments),S=Pe.getOnlyRemote(Array.from(P));y.useEffect(()=>{s({type:E.PlanOptions,...m.plan_options,skip_tests:!1})},[]);const D=j.isProcessing||j.isDone||f.isFinished||m.isLatest&&C(j.isRun)||m.isVirtualUpdate;return y.useEffect(()=>{var N;B(n.current)||j.isProcessing&&n.current.classList.contains("--is-open")&&((N=n.current)==null||N.click())},[n,j]),e.jsxs("form",{className:"w-full",children:[e.jsx("fieldset",{className:g(D&&"opacity-50 cursor-not-allowed"),children:e.jsx(Ts,{className:g(D&&"pointer-events-none")})}),e.jsx("fieldset",{className:"my-2",children:e.jsx(F,{children:e.jsx($,{defaultOpen:j.isRun,children:({open:N})=>e.jsxs(e.Fragment,{children:[e.jsxs($.Button,{ref:n,className:g("w-full flex items-center",N&&"--is-open"),children:[e.jsxs(F.Label,{className:"mr-2 text-sm w-full",children:[e.jsx("span",{children:"Additional Options"}),D&&e.jsx("span",{className:"ml-1",children:"(Read Only)"})]}),N?e.jsx(ye,{className:"h-5 w-5 text-neutral-400"}):e.jsx(we,{className:"h-5 w-5 text-neutral-400"})]}),e.jsxs($.Panel,{unmount:!1,className:g("py-4 text-sm text-neutral-500",D&&"opacity-50 cursor-not-allowed"),children:[e.jsx("div",{className:g(D&&"pointer-events-none"),children:e.jsxs("div",{className:"flex flex-wrap md:flex-nowrap",children:[C(h.isProd)&&e.jsx(q,{className:"w-full",label:"Create From Environment",info:"The environment to base the plan on rather than local files",disabled:S.length<2,children:({className:k,disabled:w})=>e.jsx(q.Selector,{className:g(k,"w-full"),list:Pe.getOnlyRemote(Array.from(P)).filter(R=>R!==h).map(R=>({value:R.name,text:R.name})),onChange:R=>{s({type:E.PlanOptions,create_from:R})},value:d,disabled:w})}),e.jsx(q,{className:"w-full",label:"Restate Models",info:`Restate data for specified models and models
|
|
2
|
-
downstream from the one specified. For production
|
|
3
|
-
environment, all related model versions will have
|
|
4
|
-
their intervals wiped, but only the current
|
|
5
|
-
versions will be backfilled. For development
|
|
6
|
-
environment, only the current model versions will
|
|
7
|
-
be affected`,children:({className:k})=>e.jsx(q.Textfield,{className:g(k,"w-full"),placeholder:"project.model1, project.model2",disabled:c,value:u??"",onInput:w=>{w.stopPropagation(),s({type:E.PlanOptions,restate_models:w.target.value})}})})]})}),e.jsxs("div",{className:g("flex flex-wrap md:flex-nowrap w-full mt-3",D&&"pointer-events-none"),children:[e.jsxs("div",{className:"w-full md:mr-2",children:[e.jsx("div",{className:"block my-2",children:e.jsx(K,{label:"Skip Tests",info:`Skip tests prior to generating the plan if they
|
|
8
|
-
are defined`,enabled:!!a,setEnabled:k=>{s({type:E.PlanOptions,skip_tests:k})}})}),e.jsx("div",{className:"block my-2",children:e.jsx(K,{label:"No Gaps",info:`Ensure that new snapshots have no data gaps when
|
|
9
|
-
comparing to existing snapshots for matching
|
|
10
|
-
models in the target environment`,enabled:!!t||!!r&&h.isInitialProd||h.isInitialProd,disabled:c||!!r&&h.isInitialProd||h.isInitialProd,setEnabled:k=>{s({type:E.PlanOptions,no_gaps:k})}})}),e.jsx("div",{className:"block my-2",children:e.jsx(K,{label:"Skip Backfill",info:"Skip the backfill step",enabled:!!r,disabled:c||h.isInitialProd,setEnabled:k=>{s({type:E.PlanOptions,skip_backfill:k})}})})]}),e.jsxs("div",{className:"w-full md:ml-2",children:[e.jsxs("div",{className:"block my-2",children:[e.jsx(K,{label:"Include Unmodified",info:"Indicates whether to create views for all models in the target development environment or only for modified ones",enabled:!!p,disabled:c||h.isInitialProd,setEnabled:k=>{s({type:E.PlanOptions,include_unmodified:k})}}),e.jsx(K,{label:"Forward Only",info:"Create a plan for forward-only changes",enabled:!!l,disabled:c||h.isInitialProd,setEnabled:k=>{s({type:E.PlanOptions,forward_only:k})}})]}),e.jsx("div",{className:"block my-2",children:e.jsx(K,{label:"Auto Apply",info:"Automatically apply the plan after it is generated",enabled:!!i,setEnabled:k=>{s({type:E.PlanOptions,auto_apply:k})}})}),e.jsx("div",{className:"block my-2",children:e.jsx(K,{label:"No Auto Categorization",info:"Set category manually",enabled:!!o,disabled:c||h.isInitialProd,setEnabled:k=>{s({type:E.PlanOptions,no_auto_categorization:k})}})})]})]})]})]})},String(j.isRun))})})]})}function As(s){const{start:a,end:t,skip_tests:r,no_gaps:l,skip_backfill:i,forward_only:o,include_unmodified:u,no_auto_categorization:c,restate_models:d,auto_apply:p,create_from:n,change_categorization:j}=Z(),m=O(D=>D.environment),f=B(m==null?void 0:m.isDefault)||V(m==null?void 0:m.isDefault),h=y.useMemo(()=>{if(!m.isProd)return{start:a,end:f&&ze(d)?void 0:t}},[m,a,t,f,d]),P=y.useMemo(()=>m.isInitialProd?{include_unmodified:!0,no_gaps:!0,skip_tests:r,auto_apply:p}:{skip_tests:r,no_gaps:l,skip_backfill:i,forward_only:o,create_from:n,no_auto_categorization:c,restate_models:d,include_unmodified:u,auto_apply:p},[m,l,i,o,u,n,c,r,d,p]),S=y.useMemo(()=>Array.from(j.values()).reduce((D,{category:N,change:k})=>(D[k.displayName]=(N==null?void 0:N.value)??ie.NUMBER_1,D),{}),[j]);return{planOptions:{...P,...s},planDates:h,categories:S}}function Fs(){const{start:s,end:a,skip_tests:t,no_gaps:r,skip_backfill:l,forward_only:i,include_unmodified:o,no_auto_categorization:u,restate_models:c,create_from:d,change_categorization:p}=Z(),n=O(h=>h.environment),j=B(n==null?void 0:n.isDefault)||V(n==null?void 0:n.isDefault),m=y.useMemo(()=>{if(!j)return{start:s,end:a}},[s,a,j]),f=y.useMemo(()=>Array.from(p.values()).reduce((h,{category:P,change:S})=>(h[S.displayName]=(P==null?void 0:P.value)??ie.NUMBER_1,h),{}),[p]);return{planDates:m,planOptions:{no_gaps:r,skip_backfill:l,forward_only:i,include_unmodified:o,create_from:d,no_auto_categorization:u,skip_tests:t,restate_models:c},categories:f}}function X(s,a,t){var o;const r=(s.isFinished&&(a.isLatest||a.isRunning)||t.isFinished||C((o=s.overview)==null?void 0:o.isFailed))&&M(s.overview),l=r?s.overview:a,i=r?s:a;return{meta:i.meta,start:i.start,end:i.end,hasChanges:l.hasChanges,hasBackfills:l.hasBackfills,backfills:i.backfills??[],added:i.added??[],removed:i.removed??[],direct:i.direct??[],indirect:i.indirect??[],metadata:i.metadata??[],plan_options:i.plan_options,stageValidation:i.stageValidation,stageBackfills:i.stageBackfills,stageChanges:i.stageChanges,isFailed:l.isFailed||t.isFailed||s.isFailed}}const Ce=3;function se({progress:s=0,delay:a=0,duration:t=0,startFromZero:r=!0,className:l}){return C(r)&&(s=s<Ce?Ce:s),e.jsx("div",{className:g("w-full h-1 bg-neutral-30 overflow-hidden flex items-center rounded-lg my-1",l),children:e.jsx("div",{className:"transition-[width] h-full bg-success-500 rounded-lg",style:{width:`${s}%`,transitionDelay:`${a}ms`,transitionDuration:`${t}ms`}})})}const v=function({children:a,setRefTasksOverview:t,tasks:r}){const{models:l,taskCompleted:i,taskTotal:o,batchesTotal:u,batchesCompleted:c}=y.useMemo(()=>{const d=Object.values(r),p=d.length;let n=0,j=0,m=0;return d.forEach(f=>{n=f.completed===f.total?n+1:n,j+=f.total,m+=f.completed}),{models:d,taskCompleted:n,taskTotal:p,batchesTotal:j,batchesCompleted:m}},[r]);return e.jsx("div",{className:"text-prose",ref:t,children:a({models:l,completed:i,total:o,totalBatches:u,completedBatches:c})})};function Ss({className:s,headline:a,environment:t,completed:r,total:l,updatedAt:i,updateType:o,completedBatches:u,totalBatches:c}){return e.jsx(Ne,{className:s,children:e.jsxs(oe,{children:[e.jsxs(ce,{children:[e.jsx(de,{children:e.jsx(_e,{headline:a,environment:t})}),e.jsxs(me,{children:[e.jsx(ae,{completed:r,total:l,unit:"task"}),e.jsx(ne,{}),e.jsx(ae,{completed:u,total:c,unit:"batches"}),e.jsx(ne,{}),e.jsx(ue,{completed:u,total:c})]})]}),e.jsx(se,{progress:Q(u,c)}),M(i)&&e.jsx(Rs,{updatedAt:i,updateType:o})]})})}function Ds({models:s,className:a,added:t,removed:r,direct:l,indirect:i,metadata:o,showBatches:u=!0,showProgress:c=!0,showVirtualUpdate:d=!1,queue:p}){return e.jsxs(e.Fragment,{children:[e.jsx(ee,{show:H(p),enter:"transition ease duration-300 transform",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"transition ease duration-300 transform",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",className:"trasition-all duration-300 ease-in-out",children:e.jsxs("div",{className:"px-4 pt-3 pb-2 mt-4 shadow-lg rounded-lg",children:[e.jsx(Re,{text:"Currently in proccess"}),e.jsx(ve,{models:p,children:n=>e.jsxs(oe,{children:[e.jsxs(ce,{children:[e.jsxs(de,{children:[H(n.interval)&&e.jsx(Ae,{start:n.interval[0],end:n.interval[1]}),e.jsx(Se,{modelName:n.displayViewName,changeType:De({modelName:n.name,added:t,removed:r,direct:l,indirect:i,metadata:o})})]}),e.jsxs(me,{children:[u&&e.jsx(ae,{completed:n.completed,total:n.total,unit:"batch"}),e.jsx(ne,{}),c&&e.jsx(e.Fragment,{children:B(n.end)||B(n.start)?e.jsx(ue,{total:n.total,completed:n.completed}):e.jsx(Fe,{start:n.start,end:n.end})}),d&&e.jsx("span",{className:"inline-block whitespace-nowrap font-bold ml-2",children:"Updated"})]})]}),c?e.jsx(se,{startFromZero:!1,progress:Q(n.completed,n.total)}):e.jsx(re,{className:"my-1 border-neutral-200 opacity-50"})]})})]})}),e.jsx(Ne,{className:a,children:e.jsx(ve,{models:s,children:n=>e.jsxs(oe,{children:[e.jsxs(ce,{children:[e.jsxs(de,{children:[H(n.interval)&&e.jsx(Ae,{start:n.interval[0],end:n.interval[1]}),e.jsx(Se,{modelName:n.displayViewName,changeType:De({modelName:n.name,added:t,removed:r,direct:l,indirect:i,metadata:o})})]}),e.jsxs(me,{children:[u&&e.jsx(ae,{completed:n.completed,total:n.total,unit:"batch"}),e.jsx(ne,{}),c&&e.jsx(e.Fragment,{children:B(n.end)||B(n.start)?e.jsx(ue,{total:n.total,completed:n.completed}):e.jsx(Fe,{start:n.start,end:n.end})}),d&&e.jsx("span",{className:"inline-block whitespace-nowrap font-bold ml-2",children:"Updated"})]})]}),c?e.jsx(se,{progress:Q(n.completed,n.total),startFromZero:p.findIndex(j=>j.name===n.name)===-1}):e.jsx(re,{className:"my-1 border-neutral-200 opacity-50"})]})})})]})}function Ne({className:s,children:a}){return e.jsx("div",{className:g("max-h-[50vh] overflow-auto hover:scrollbar scrollbar--vertical scrollbar--horizontal",s),children:a})}function oe({className:s,children:a}){return e.jsx("div",{className:g("px-2",s),children:a})}function ve({className:s,models:a,children:t}){return e.jsx("ul",{className:g("rounded-lg pt-4 overflow-auto text-prose hover:scrollbar scrollbar--vertical scrollbar--horizontal",s),children:a.map(r=>e.jsx("li",{className:"mb-2",children:t(r)},r.name))})}function ce({className:s,children:a}){return e.jsx("div",{className:g("flex sm:justify-between sm:items-baseline text-xs",s),children:a})}function _e({className:s,headline:a,environment:t}){return e.jsxs("span",{className:g("flex items-center",s),children:[e.jsx("span",{className:"block whitespace-nowrap text-sm font-medium",children:a}),M(t)&&e.jsx("small",{className:"inline-block ml-1 px-2 py-[0.125rem] text-xs font-bold bg-neutral-10 rounded-md",children:t})]})}function de({className:s,children:a}){return e.jsx("div",{className:g("flex mr-6 w-full sm:w-auto overflow-hidden",s),children:a})}function me({className:s,children:a}){return e.jsx("div",{className:g("flex items-center",s),children:a})}function Ae({className:s,start:a,end:t}){return e.jsxs("span",{className:g("inline-block mr-2 whitespace-nowrap font-mono",s),children:[a," – ",t]})}function ae({className:s,total:a,completed:t,unit:r}){return e.jsxs("span",{className:g("inline-block whitespace-nowrap",s),children:[t," of ",a," ",ns(r,a)]})}function ne({className:s}){return e.jsx("span",{className:g("inline-block mx-2",s),children:"|"})}function ue({className:s,total:a,completed:t}){return e.jsxs("span",{className:g("inline-block whitespace-nowrap font-bold",s),children:[Math.ceil(Q(t,a)),"%"]})}function Fe({className:s,start:a,end:t}){return e.jsx("span",{className:g("inline-block whitespace-nowrap font-bold",s),children:`${Math.floor((t-a)/6e4)}:${String(Math.ceil((t-a)/1e3%60)).padStart(2,"0")}`})}function Rs({updateType:s,updatedAt:a}){return e.jsxs("div",{className:"flex justify-between mt-1",children:[e.jsxs("small",{className:"text-xs",children:[e.jsx("b",{children:"Update Type:"}),e.jsx("span",{className:"inline-block ml-1",children:s})]}),e.jsxs("small",{className:"text-xs",children:[e.jsx("b",{children:"Last Update:"}),e.jsx("span",{className:"inline-block ml-1",children:xe(new Date(a),"yyyy-mm-dd hh-mm-ss",!1)})]})]})}function Se({className:s,modelName:a,changeType:t}){return e.jsx("span",{className:g("font-bold whitespace-nowrap",t===A.Add&&"text-success-600 dark:text-success-500",t===A.Remove&&"text-danger-500",t===A.Direct&&"text-secondary-500 dark:text-primary-500",t===A.Indirect&&"text-warning-500",t===A.Default&&"text-prose",s),children:a})}v.Block=Ne;v.Summary=Ss;v.Details=Ds;v.DetailsProgress=me;v.Task=oe;v.Tasks=ve;v.TaskDetails=ce;v.TaskProgress=ue;v.TaskSize=ae;v.TaskDivider=ne;v.TaskInfo=de;v.TaskHeadline=_e;function De({modelName:s,added:a,removed:t,direct:r,indirect:l,metadata:i}){return a.some(o=>o.name===s)?A.Add:t.some(o=>o.name===s)?A.Remove:r.some(o=>o.name===s)?A.Direct:l.some(o=>o.name===s)?A.Indirect:i.some(o=>o.name===s)?A.Metadata:A.Default}function Es({report:s}){var a;return e.jsxs("div",{children:[e.jsxs("div",{className:"py-2",children:[e.jsxs("p",{children:["Total: ",s.total]}),e.jsxs("p",{children:["Succeeded: ",s.successful]}),e.jsxs("p",{children:["Failed: ",s.failures]}),e.jsxs("p",{children:["Errors: ",s.errors]}),e.jsxs("p",{children:["Dialect: ",s.dialect]})]}),e.jsx("ul",{children:(a=s.details)==null?void 0:a.map(t=>e.jsxs("li",{className:"flex mb-1",children:[e.jsx("span",{className:"inline-block mr-4",children:"—"}),e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("span",{className:"inline-block mb-2",children:t.message}),e.jsx("code",{className:"inline-block max-h-[50vh] bg-theme py-2 px-4 rounded-lg w-full overflow-auto hover:scrollbar scrollbar--vertical scrollbar--horizontal",children:e.jsx("pre",{children:t.details})})]})]},t.message))})]})}function Bs(){var f;const s=Be(h=>h.tests),a=x(h=>h.planApply),t=x(h=>h.planOverview),r=x(h=>h.planCancel),l=x(h=>h.planAction),{plan_options:i,hasChanges:o,hasBackfills:u,isFailed:c}=X(a,t,r),d=M(s)&&!!s.total,p=M(s)&&!!s.message&&C(d),n=M(s)&&(!!s.failures||!!s.errors),j=C(l.isProcessing)&&C(l.isDone)&&C(r.isFinished),m=c&&[n,d,o,u].every(Ue);return e.jsx(ee,{appear:!0,show:C(l.isRun),enter:"transition ease duration-300 transform",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"transition ease duration-300 transform",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",className:g("my-2 rounded-xl",c&&"bg-danger-5"),children:m?e.jsxs(F,{className:"flex items-center",size:T.sm,variant:I.Danger,children:[e.jsx(je,{className:"w-4 mr-2"}),e.jsx(F.Label,{className:"mr-2 text-sm",children:"Plan Failed"})]}):e.jsxs(e.Fragment,{children:[c&&e.jsxs(F,{className:"flex items-center mb-1",size:T.sm,variant:I.Danger,children:[e.jsx(je,{className:"w-4 mr-2"}),e.jsx(F.Label,{className:"mr-2 text-sm",children:"Plan Failed"})]}),V(i==null?void 0:i.skip_tests)?e.jsxs(F,{className:"flex items-center mb-1",size:T.sm,hasBackground:!1,children:[e.jsx(W,{className:"w-4 mr-2"}),e.jsx(F.Label,{className:"mr-2 text-sm",children:"Tests Skipped"})]}):d?e.jsx(Ms,{isOpen:!0,report:s}):p?e.jsx(Is,{report:s}):e.jsxs(F,{className:"flex items-center mb-1",size:T.sm,hasBackground:!1,children:[e.jsx(W,{className:"w-4 mr-2"}),e.jsx(F.Label,{className:"mr-2 text-sm",children:"No Tests"})]}),C(n)&&e.jsxs(e.Fragment,{children:[e.jsx(_s,{isOpen:j}),e.jsx(Os,{isOpen:j}),e.jsx(Gs,{}),a.shouldShowEvaluation&&e.jsxs(zs,{start:a.evaluationStart,end:a.isFinished?a.evaluationEnd??((f=r.meta)==null?void 0:f.end):void 0,children:[e.jsx(Us,{}),e.jsx(Ls,{}),e.jsx($s,{}),e.jsx(Vs,{})]})]})]})})}function _s({isOpen:s=!1}){var d;const a=x(p=>p.planApply),t=x(p=>p.planOverview),r=x(p=>p.planCancel),{meta:l,stageChanges:i,hasChanges:o}=X(a,t,r),u=(i==null?void 0:i.meta)??l;return Le([U.init,U.fail],(d=i==null?void 0:i.meta)==null?void 0:d.status)||V(o)?e.jsx(G,{meta:u,states:["Changes","Failed Getting Changes","Getting Changes..."],isOpen:s&&V(o),panel:e.jsx(Hs,{})}):e.jsxs(F,{className:"flex items-center mb-1",size:T.sm,hasBackground:!1,children:[e.jsx(W,{className:"w-4 mr-2"}),e.jsx(F.Label,{className:"mr-2 text-sm",children:"No Changes"})]})}function Os({isOpen:s=!1}){const{change_categorization:a}=Z(),t=x(m=>m.planApply),r=x(m=>m.planOverview),l=x(m=>m.planCancel),{meta:i,stageBackfills:o,backfills:u,hasBackfills:c}=X(t,r,l),d=(o==null?void 0:o.meta)??i,p=y.useMemo(()=>Array.from(a.values()).reduce((m,{category:f,change:h})=>{var P;return(f==null?void 0:f.value)!==ie.NUMBER_3&&m.add(h.name),(B(f)||f.value===ie.NUMBER_1)&&((P=h.indirect)==null||P.forEach(S=>m.add(S.name))),m},new Set),[a]),n=y.useMemo(()=>a.size>0?u.filter(m=>p.has(m.name)):u,[u,p]);return((d==null?void 0:d.status)===U.init||V(c))&&(a.size>0?n.length>0:!0)?e.jsx(G,{meta:d,states:["Backfills","Failed Getting Backfills","Getting Backfills..."],isOpen:s&&V(c),panel:e.jsx(L,{headline:`Models ${n.length}`,type:A.Default,children:e.jsx(L.Default,{type:A.Default,changes:n})})}):e.jsxs(F,{className:"flex items-center mb-1",size:T.sm,hasBackground:!1,children:[e.jsx(W,{className:"w-4 mr-2"}),e.jsx(F.Label,{className:"mr-2 text-sm",children:"No Backfills"})]})}function Is({report:s}){return e.jsx(G,{meta:{status:U.success,...s},states:["Tests Completed","Failed Tests","Running Tests..."],children:s.message})}function Ms({report:s,isOpen:a=!1}){return e.jsx(G,{variant:I.Danger,meta:{status:U.fail,...s},isOpen:a,states:["Tests Failed","One or More Tests Failed","Running Tests..."],shouldCollapse:!1,children:e.jsx(Es,{report:s})})}function zs({start:s,end:a,children:t}){const r=y.useRef(null);return y.useEffect(()=>{setTimeout(()=>{var l;(l=r.current)==null||l.scrollIntoView({behavior:"smooth",block:"start"})},500)},[]),B(s)?e.jsx(e.Fragment,{}):e.jsxs("div",{ref:r,className:"pt-4 pb-2 text-xs",children:[e.jsxs("span",{className:"text-neutral-500 block px-4 mb-1",children:["Evaluation started at"," ",xe(new Date(s),"yyyy-mm-dd hh-mm-ss")]}),e.jsx(re,{}),e.jsx("div",{className:"py-2",children:t}),M(a)&&e.jsxs(e.Fragment,{children:[e.jsx(re,{}),e.jsxs("span",{className:"text-neutral-500 block px-4 mt-1",children:["Evaluation stopped at"," ",xe(new Date(a),"yyyy-mm-dd hh-mm-ss")]})]})]})}function Us({isOpen:s}){var t;const a=x(r=>r.planApply);return B(a.stageCreation)?e.jsx(e.Fragment,{}):e.jsx(G,{meta:(t=a.stageCreation)==null?void 0:t.meta,states:["Snapshot Tables Created","Snapshot Tables Creation Failed","Creating Snapshot Tables..."],isOpen:s,children:e.jsx(v.Block,{children:e.jsxs(v.Task,{children:[e.jsxs(v.TaskDetails,{children:[e.jsx(v.TaskInfo,{children:e.jsx(v.TaskHeadline,{headline:"Snapshot Tables"})}),e.jsxs(v.DetailsProgress,{children:[e.jsx(v.TaskSize,{completed:a.stageCreation.num_tasks,total:a.stageCreation.total_tasks,unit:"task"}),e.jsx(v.TaskDivider,{}),e.jsx(v.TaskProgress,{completed:a.stageCreation.num_tasks,total:a.stageCreation.total_tasks})]})]}),e.jsx(se,{progress:Q(a.stageCreation.num_tasks,a.stageCreation.total_tasks)})]})})})}function Ls(){var a;const s=x(t=>t.planApply);return B(s.stageRestate)?e.jsxs(F,{className:"flex items-center mb-1",size:T.sm,hasBackground:!1,children:[e.jsx(W,{className:"w-4 mr-2"}),e.jsx(F.Label,{className:"mr-2 text-sm",children:"No Models To Restate"})]}):e.jsx(G,{meta:(a=s.stageRestate)==null?void 0:a.meta,states:["Restate Models","Restate Models Failed","Restating Models..."]})}function $s(){const s=x(d=>d.planApply),a=x(d=>d.planAction),t=x(d=>d.planOverview),r=x(d=>d.planCancel),l=s.environment,i=s.stageBackfill,{backfills:o}=X(s,t,r),u=y.useMemo(()=>Object.values(s.tasks).reduce((d,p)=>{const n=o.find(j=>j.name===p.name);return p.interval=(n==null?void 0:n.interval)??[],d[p.name]=p,d},{}),[o,s.tasks]);return M(i)&&M(l)?e.jsx(G,{meta:i.meta,states:["Backfilled","Backfilling Failed","Backfilling Intervals..."],showDetails:!0,isOpen:!0,shouldCollapse:!1,children:e.jsx(v,{tasks:u,children:({total:d,completed:p,models:n,completedBatches:j,totalBatches:m})=>e.jsxs(e.Fragment,{children:[e.jsx(v.Summary,{headline:"Target Environment",environment:l,completed:p,total:d,completedBatches:j,totalBatches:m,updateType:a.isApplyVirtual?"Virtual":"Backfill"}),M(n)&&e.jsx(v.Details,{models:n,added:s.added,removed:s.removed,direct:s.direct,indirect:s.indirect,metadata:s.metadata,queue:s.queue,showBatches:!0,showVirtualUpdate:a.isApplyVirtual,showProgress:!0})]})})}):e.jsx(e.Fragment,{})}function Vs(){var a;const s=x(t=>t.planApply);return B(s.stagePromote)?e.jsx(e.Fragment,{}):e.jsx("div",{children:e.jsx(G,{meta:(a=s.stagePromote)==null?void 0:a.meta,states:["Environment Promoted","Promotion Failed","Promoting Environment..."],children:e.jsx(v.Block,{children:e.jsxs(v.Task,{children:[e.jsxs(v.TaskDetails,{children:[e.jsx(v.TaskInfo,{children:e.jsx(v.TaskHeadline,{headline:`Promote Environment: ${s.stagePromote.target_environment}`})}),e.jsxs(v.DetailsProgress,{children:[e.jsx(v.TaskSize,{completed:s.stagePromote.num_tasks,total:s.stagePromote.total_tasks,unit:"task"}),e.jsx(v.TaskDivider,{}),e.jsx(v.TaskProgress,{completed:s.stagePromote.num_tasks,total:s.stagePromote.total_tasks})]})]}),e.jsx(se,{progress:Q(s.stagePromote.num_tasks,s.stagePromote.total_tasks)})]})})})})}function Gs(){var u;const{virtualUpdateDescription:s}=Z(),a=x(c=>c.planApply),t=x(c=>c.planOverview),r=x(c=>c.planCancel),{isFailed:l}=X(a,t,r),i=((u=a.overview)==null?void 0:u.isVirtualUpdate)??t.isVirtualUpdate,o=V(a.isFinished);return i&&C(l)?e.jsx(G,{meta:{status:U.success,done:o},states:[o?"Virtual Update Completed":"Virtual Update","Virtual Update Failed","Applying Virtual Update..."],children:s}):e.jsx(e.Fragment,{})}function Hs(){const s=x(n=>n.planAction),a=x(n=>n.planOverview),t=x(n=>n.planApply),r=x(n=>n.planCancel),{hasChanges:l,added:i,removed:o,direct:u,indirect:c,metadata:d}=X(t,a,r),p=s.isProcessing||s.isDone||t.isFinished||a.isLatest&&C(s.isRun)||a.isVirtualUpdate;return e.jsx("div",{className:"w-full my-2",children:V(l)&&e.jsxs(e.Fragment,{children:[H(i)&&e.jsx(L,{className:"w-full my-2",headline:"Added Models",type:A.Add,children:e.jsx(L.Default,{type:A.Add,changes:i})}),H(o)&&e.jsx(L,{className:"w-full my-2",headline:"Removed Models",type:A.Remove,children:e.jsx(L.Default,{type:A.Remove,changes:o})}),H(u)&&e.jsx(L,{className:"my-2 w-full",headline:"Modified Directly",type:A.Direct,children:e.jsx(L.Direct,{changes:u,disabled:p})}),H(c)&&e.jsx(L,{className:"my-2 w-full",headline:"Modified Indirectly",type:A.Indirect,children:e.jsx(L.Indirect,{changes:c})}),H(d)&&e.jsx(L,{className:"my-2 w-full",headline:"Modified Metadata",type:A.Default,children:e.jsx(L.Default,{type:A.Default,changes:d})})]})})}function G({meta:s,states:a=["Success","Failed","Running"],isOpen:t=!1,trigger:r,panel:l,children:i,showDetails:o=!0,shouldCollapse:u=!0}){const c=y.useRef(null),d=x(R=>R.planOverview),p=x(R=>R.planApply),n=(s==null?void 0:s.status)!==U.fail&&M(l)||M(i),[j,m]=y.useState(t);y.useEffect(()=>{var R;B(c.current)||u&&(p.isFinished||d.isLatest)&&c.current.classList.contains("--is-open")&&((R=c.current)==null||R.click())},[c,d,p,u]),y.useEffect(()=>{m(t&&n)},[t,n]);const f=(s==null?void 0:s.status)===U.fail,h=(s==null?void 0:s.status)===U.success,P=(s==null?void 0:s.status)===U.init,S=h?I.Success:f?I.Danger:I.Info,[D,N,k]=a,w=h?D:f?N:k;return e.jsx(ee,{appear:!0,show:M(s),enter:"transition ease duration-300 transform",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"transition ease duration-300 transform",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",className:"my-2",children:e.jsxs($,{children:[e.jsx(F,{className:"mb-1",variant:S,size:T.sm,hasBackground:!1,hasBackgroundOnHover:n,children:e.jsx($.Button,{ref:c,className:g("w-full flex flex-col",j&&"--is-open",C(n)&&"cursor-default"),onClick:()=>m(R=>!R),children:B(r)?e.jsxs(e.Fragment,{children:[P&&e.jsx($e,{text:w,hasSpinner:!0,size:T.sm,variant:I.Primary,className:"w-full"}),C(P)&&e.jsxs("div",{className:"flex items-center h-full",children:[o&&n?e.jsx(e.Fragment,{children:j?e.jsx(ye,{className:"w-4 mr-2"}):e.jsx(we,{className:"w-4 mr-2"})}):e.jsxs(e.Fragment,{children:[(s==null?void 0:s.status)===U.success&&e.jsx(W,{className:"min-w-4 max-w-4 mr-2"}),(s==null?void 0:s.status)===U.fail&&e.jsx(je,{className:"min-w-4 max-w-4 mr-2"})]}),e.jsx(F.Label,{className:"mr-2 text-sm",children:e.jsx(Re,{text:w,size:T.sm,variant:S})})]})]}):r})}),e.jsx(ee,{appear:!0,show:j,enter:"transition ease duration-300 transform",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"transition ease duration-300 transform",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",className:"trasition-all duration-300 ease-in-out",children:e.jsxs($.Panel,{static:!0,className:"px-2 text-xs mb-2",children:[M(i)&&e.jsx("div",{className:g("p-4 rounded-md",S===I.Danger?"bg-danger-5 text-danger-500":"bg-neutral-5"),children:i}),(s==null?void 0:s.status)!==U.fail&&l]})})]})})}function qs(){const s=ge(),{clearErrors:a}=Ve(),t=O(w=>w.environment),r=x(w=>w.planAction),l=x(w=>w.setPlanAction),i=x(w=>w.resetPlanTrackers),o=x(w=>w.resetPlanCancel),u=x(w=>w.clearPlanApply),c=Be(w=>w.setTests),d=As(),p=Fs(),{refetch:n,cancel:j}=Ge(t.name,d),{refetch:m,cancel:f}=He(t.name,p),{refetch:h}=qe();function P(){a(),s([{type:E.ResetPlanDates},{type:E.ResetPlanOptions},{type:E.ResetTestsReport},{type:E.ResetCategories}])}function S(){l(new Y({value:z.Run})),u(),P(),setTimeout(()=>i(),500)}function D(){l(new Y({value:z.Cancelling})),o(),s([{type:E.ResetTestsReport}]);let w;r.isApplying?w=j:w=f,w(),h()}function N(){l(new Y({value:z.Applying})),u(),s([{type:E.ResetTestsReport}]),m().catch(console.log)}function k(){l(new Y({value:z.Running})),i(),c(void 0),s([{type:E.ResetTestsReport}]),n().catch(console.log)}return e.jsxs("div",{className:"flex flex-col w-full h-full max-w-[80rem]",children:[t.isProd&&e.jsx(bs,{}),e.jsxs("div",{className:"relative w-full h-full flex flex-col pt-2 pl-4 pr-2 overflow-y-scroll hover:scrollbar scrollbar--vertical",children:[e.jsx(Cs,{}),e.jsx(Bs,{})]}),e.jsx(ks,{apply:N,run:k,cancel:D,reset:S})]})}function pa(){const{environmentName:s}=Ke(),a=O(l=>l.environment),t=O(l=>l.environments),r=O(l=>l.setEnvironment);return y.useEffect(()=>{if(a.isInitialProd||s===a.name)return;const l=Array.from(t).find(i=>i.name===s);B(l)||r(l)},[s]),e.jsx(as,{children:B(a)?e.jsx(Ze,{link:Ye.Plan,description:B(s)?void 0:`Environment ${s} Does Not Exist`,message:"Back To Data Catalog"}):e.jsx(qs,{})})}export{pa as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as x,a as m,w as h,Q as a,a5 as c,a6 as D,a7 as T,r as b,j as u}from"./index-CkIQhGgw.js";import{g,T as E}from"./help-Bolb6haG.js";import{u as r}from"./editor-Dj_6cws7.js";import"./index-DQbKL5-Q.js";import"./index-COQuzlwN.js";import"./Input-BY5Rc3go.js";import"./file-Bs2Eq56_.js";const d=24*60*60*1e3;function S(){const{modelName:o}=x(),p=m(e=>e.models),s=m(e=>e.lastSelectedModel),f=r(e=>e.previewTable),i=r(e=>e.setPreviewQuery),n=r(e=>e.setPreviewTable),t=h(o)||o===(s==null?void 0:s.name)?s:p.get(encodeURI(o)),l={model:t.displayName,start:a(c(Date.now()-d)),end:a(new Date),execution_time:a(c(Date.now()-d)),limit:1e3},{refetch:v}=D(l),{refetch:w}=T(l);return b.useEffect(()=>{i(void 0),n(void 0),v().then(({data:e})=>{i(e==null?void 0:e.sql)}),w().then(({data:e})=>{n(g(e))})},[t]),u.jsx("div",{className:"flex overflow-hidden w-full h-full px-2",children:u.jsx(E,{headline:t==null?void 0:t.displayName,data:f??[[],[]]})})}export{S as default};
|
|
@@ -1 +0,0 @@
|
|
|
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,ag as qe,ah as at,d as Ye,t as ot,e as it,s as ct,G as $,F as dt,a8 as ut,_ as ft,ai as mt}from"./index-CkIQhGgw.js";import{u as ee,M as xt}from"./project-XFpF0AcJ.js";import{S as We}from"./SplitPane-BY85POxQ.js";import{E as J,M as ht}from"./file-Bs2Eq56_.js";import{u as N}from"./editor-Dj_6cws7.js";import{I as T}from"./Input-BY5Rc3go.js";import{F as pt,L as gt}from"./ListboxShow-TFvq9fMB.js";import{B as Be}from"./Banner-Cd1C5Udq.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-B5aHgz_j.js";import{g as Fe,G as yt,F as Tt,T as Et}from"./help-Bolb6haG.js";import{M as Pt,u as Xe,a as Re,b as St,c as Ct,C as kt}from"./context-Dx2o1ZRq.js";import{A as Se,F as It,a as Rt}from"./PlusCircleIcon-CoFMRFQI.js";import{D as Dt}from"./ReportErrors-mVM8O5iE.js";import"./index-COQuzlwN.js";import"./index-DQbKL5-Q.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./help-6Q7f7fjd.js";import"./SourceList-DQ72TcK1.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-CB8Rie_r.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 +0,0 @@
|
|
|
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-CkIQhGgw.js";import{P as I}from"./Page-KC6UG65M.js";import{S as z}from"./SourceList-DQ72TcK1.js";import{S as C}from"./SourceListItem-CncMnWed.js";import"./SplitPane-BY85POxQ.js";import"./Input-BY5Rc3go.js";import"./index-COQuzlwN.js";import"./index-DQbKL5-Q.js";function F(){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{F as default};
|