sqlmesh 0.181.2.dev22__py3-none-any.whl → 0.181.2.dev24__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.dev22.dist-info → sqlmesh-0.181.2.dev24.dist-info}/METADATA +1 -1
- {sqlmesh-0.181.2.dev22.dist-info → sqlmesh-0.181.2.dev24.dist-info}/RECORD +50 -49
- web/client/dist/assets/Audits-7rP8WdsD.js +1 -0
- web/client/dist/assets/{Banner-OvD39mOq.js → Banner-jMPu9_jP.js} +1 -1
- web/client/dist/assets/{ChevronDownIcon-BqleRn_G.js → ChevronDownIcon-BZk6URUK.js} +1 -1
- web/client/dist/assets/{ChevronRightIcon-CXKkTIzW.js → ChevronRightIcon-Ctcbr61G.js} +1 -1
- web/client/dist/assets/{Content-COW0vEIQ.js → Content-C43kcRta.js} +2 -2
- web/client/dist/assets/Content-DITnFT31.js +1 -0
- web/client/dist/assets/Data-B5q1KzIa.js +1 -0
- web/client/dist/assets/{DataCatalog-iRjvB2C3.js → DataCatalog-BRzSrlJL.js} +2 -2
- web/client/dist/assets/{Editor-BLhCfpzx.js → Editor-7muj9lbw.js} +1 -1
- web/client/dist/assets/Editor-CAMzYH0x.js +1 -0
- web/client/dist/assets/Errors-Bbd2EOQg.js +1 -0
- web/client/dist/assets/{FileExplorer-gjDFmLLh.js → FileExplorer-DMR02idl.js} +3 -3
- web/client/dist/assets/{Footer-CfHqR8wm.js → Footer-Cnu_IoqE.js} +1 -1
- web/client/dist/assets/{Header-sstE4Gqk.js → Header-NJkxh8bb.js} +1 -1
- web/client/dist/assets/Input-CYm3h-zG.js +41 -0
- web/client/dist/assets/Lineage-HZl7aUI5.js +1 -0
- web/client/dist/assets/{ListboxShow-nvacUoI1.js → ListboxShow-CwgOYGSe.js} +1 -1
- web/client/dist/assets/ModelLineage-Bnes5PV4.js +1 -0
- web/client/dist/assets/Models-B_sukTY5.js +1 -0
- web/client/dist/assets/{Page-D0nUv5ck.js → Page-DxTzPmYT.js} +1 -1
- web/client/dist/assets/{Plan-Cj_0vc_H.js → Plan-B2b637kI.js} +1 -1
- web/client/dist/assets/{PlusCircleIcon-C2xHHnL-.js → PlusCircleIcon-FgfUjgrM.js} +1 -1
- web/client/dist/assets/{ReportErrors-D88IZz3n.js → ReportErrors-xnNgNULg.js} +1 -1
- web/client/dist/assets/Root-BMcIwqdc.js +1 -0
- web/client/dist/assets/{SearchList-Dltx9F6k.js → SearchList-9n_6_E0k.js} +1 -1
- web/client/dist/assets/{SelectEnvironment-CZAVUJhY.js → SelectEnvironment-DC6x26Ax.js} +1 -1
- web/client/dist/assets/{SourceList-Diwt0dWW.js → SourceList-Chz492Ne.js} +1 -1
- web/client/dist/assets/{SourceListItem-CjW93oYe.js → SourceListItem-DIieM0S_.js} +1 -1
- web/client/dist/assets/{SplitPane-B-vlCkrS.js → SplitPane-CmzNrZQN.js} +1 -1
- web/client/dist/assets/Tests-DbVFKqeG.js +1 -0
- web/client/dist/assets/{Welcome-DbFwSigj.js → Welcome-DxKW_LKA.js} +1 -1
- web/client/dist/assets/{context-Dvup3XDX.js → context-CzM900aY.js} +1 -1
- web/client/dist/assets/{context-CA-MXfZ6.js → context-DhymIb_N.js} +4 -4
- web/client/dist/assets/{editor-DmJY3IbC.js → editor-Bf9rhumO.js} +2 -2
- web/client/dist/assets/{file-DYgUpg8u.js → file-CcK5Oobc.js} +1 -1
- web/client/dist/assets/{help-CNdZX-7b.js → help-DtLmoC0U.js} +1 -1
- web/client/dist/assets/index-BdXOfeCo.js +1 -0
- web/client/dist/assets/{index-D-9edHVb.js → index-CLuHMKlN.js} +2 -2
- web/client/dist/assets/index-KZcJd7F1.js +58 -0
- web/client/dist/assets/{plan-Cdj5QED6.js → plan-e4fPD47J.js} +1 -1
- web/client/dist/assets/{project-BlT_dmGo.js → project-CjyecwCx.js} +1 -1
- web/client/dist/assets/{transition-nHCHMLQ-.js → transition-C8EjNcgL.js} +2 -2
- web/client/dist/index.html +1 -1
- web/client/dist/assets/Audits-BZWk3jlL.js +0 -1
- web/client/dist/assets/Content-CkK8L7V3.js +0 -1
- web/client/dist/assets/Data-CQQQmeF1.js +0 -1
- web/client/dist/assets/Editor-DKqRG32p.js +0 -1
- web/client/dist/assets/Errors-x-oFeSch.js +0 -1
- web/client/dist/assets/Input-A6Hrwz1k.js +0 -41
- web/client/dist/assets/Lineage-CzdZCXc6.js +0 -1
- web/client/dist/assets/ModelLineage-B6geDuI6.js +0 -1
- web/client/dist/assets/Models-B1vLawzn.js +0 -1
- web/client/dist/assets/Root-DCNtqbqI.js +0 -1
- web/client/dist/assets/Tests-D8lyWcVm.js +0 -1
- web/client/dist/assets/index-L7UJWCGi.js +0 -74
- {sqlmesh-0.181.2.dev22.dist-info → sqlmesh-0.181.2.dev24.dist-info}/WHEEL +0 -0
- {sqlmesh-0.181.2.dev22.dist-info → sqlmesh-0.181.2.dev24.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.181.2.dev22.dist-info → sqlmesh-0.181.2.dev24.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.181.2.dev22.dist-info → sqlmesh-0.181.2.dev24.dist-info}/top_level.txt +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
var N=Object.defineProperty;var D=(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)=>D(u,typeof r!="symbol"?r+"":r,t);import{a0 as F,s as I,b as f,w as l,g as R,C as w,D as v,i as p,h as V,a1 as x}from"./index-L7UJWCGi.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 I([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=x((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};
|
|
1
|
+
var N=Object.defineProperty;var D=(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)=>D(u,typeof r!="symbol"?r+"":r,t);import{a0 as F,s as I,b as f,w as l,g as R,C as w,D as v,i as p,h as V,a1 as x}from"./index-KZcJd7F1.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 I([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=x((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};
|
|
@@ -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-CcK5Oobc.js";import{b as p,a1 as u}from"./index-KZcJd7F1.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,R as E,f as De
|
|
1
|
+
import{r as l,R as E,f as De}from"./index-KZcJd7F1.js";import{r as ot}from"./index-BdXOfeCo.js";var lt=Object.defineProperty,ut=(e,t,n)=>t in e?lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Se=(e,t,n)=>(ut(e,typeof t!="symbol"?t+"":t,n),n);let at=class{constructor(){Se(this,"current",this.detect()),Se(this,"handoffState","pending"),Se(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"}},W=new at,B=(e,t)=>{W.isServer?l.useEffect(e,t):l.useLayoutEffect(e,t)};function j(e){let t=l.useRef(e);return B(()=>{t.current=e},[e]),t}let P=function(e){let t=j(e);return E.useCallback((...n)=>t.current(...n),[t])};function Ue(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function le(){let e=[],t={addEventListener(n,r,u,a){return n.addEventListener(r,u,a),t.add(()=>n.removeEventListener(r,u,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 Ue(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,u){let a=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:u}),this.add(()=>{Object.assign(n.style,{[r]:a})})},group(n){let r=le();return n(r),this.add(()=>r.dispose())},add(n){return e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let u of e.splice(r,1))u()}},dispose(){for(let n of e.splice(0))n()}};return t}function qe(){let[e]=l.useState(le);return l.useEffect(()=>()=>e.dispose(),[e]),e}function it(){let e=typeof document>"u";return"useSyncExternalStore"in De?(t=>t.useSyncExternalStore)(De)(()=>()=>{},()=>!1,()=>!e):!1}function ve(){let e=it(),[t,n]=l.useState(W.isHandoffComplete);return t&&W.isHandoffComplete===!1&&n(!1),l.useEffect(()=>{t!==!0&&n(!0)},[t]),l.useEffect(()=>W.handoff(),[]),e?!1:t}var He;let ne=(He=E.useId)!=null?He:function(){let e=ve(),[t,n]=E.useState(e?()=>W.nextId():null);return B(()=>{t===null&&n(W.nextId())},[t]),t!=null?""+t:void 0};function I(e,t,...n){if(e in t){let u=t[e];return typeof u=="function"?u(...n):u}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(u=>`"${u}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,I),r}function me(e){return W.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let Fe=["[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(",");var K=(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))(K||{}),fe=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(fe||{}),st=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(st||{});function se(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Fe)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Ce=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ce||{});function Oe(e,t=0){var n;return e===((n=me(e))==null?void 0:n.body)?!1:I(t,{0(){return e.matches(Fe)},1(){let r=e;for(;r!==null;){if(r.matches(Fe))return!0;r=r.parentElement}return!1}})}function Fn(e){let t=me(e);le().nextFrame(()=>{t&&!Oe(t.activeElement,0)&&dt(e)})}var ct=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(ct||{});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 dt(e){e==null||e.focus({preventScroll:!0})}let ft=["textarea","input"].join(",");function pt(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,ft))!=null?n:!1}function vt(e,t=n=>n){return e.slice().sort((n,r)=>{let u=t(n),a=t(r);if(u===null||a===null)return 0;let o=u.compareDocumentPosition(a);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function xn(e,t){return J(se(),t,{relativeTo:e})}function J(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:u=[]}={}){let a=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,o=Array.isArray(e)?n?vt(e):e:se(e);u.length>0&&o.length>1&&(o=o.filter(b=>!u.includes(b))),r=r??a.activeElement;let c=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),i=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,o.indexOf(r))-1;if(t&4)return Math.max(0,o.indexOf(r))+1;if(t&8)return o.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),p=t&32?{preventScroll:!0}:{},s=0,d=o.length,f;do{if(s>=d||s+d<=0)return 0;let b=i+s;if(t&16)b=(b+d)%d;else{if(b<0)return 3;if(b>=d)return 1}f=o[b],f==null||f.focus(p),s+=c}while(f!==a.activeElement);return t&6&&pt(f)&&f.select(),2}function mt(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function ht(){return/Android/gi.test(window.navigator.userAgent)}function gt(){return mt()||ht()}function ce(e,t,n){let r=j(t);l.useEffect(()=>{function u(a){r.current(a)}return document.addEventListener(e,u,n),()=>document.removeEventListener(e,u,n)},[e,n])}function Ge(e,t,n){let r=j(t);l.useEffect(()=>{function u(a){r.current(a)}return window.addEventListener(e,u,n),()=>window.removeEventListener(e,u,n)},[e,n])}function bt(e,t,n=!0){let r=l.useRef(!1);l.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function u(o,c){if(!r.current||o.defaultPrevented)return;let i=c(o);if(i===null||!i.getRootNode().contains(i)||!i.isConnected)return;let p=function s(d){return typeof d=="function"?s(d()):Array.isArray(d)||d instanceof Set?d:[d]}(e);for(let s of p){if(s===null)continue;let d=s instanceof HTMLElement?s:s.current;if(d!=null&&d.contains(i)||o.composed&&o.composedPath().includes(d))return}return!Oe(i,Ce.Loose)&&i.tabIndex!==-1&&o.preventDefault(),t(o,i)}let a=l.useRef(null);ce("pointerdown",o=>{var c,i;r.current&&(a.current=((i=(c=o.composedPath)==null?void 0:c.call(o))==null?void 0:i[0])||o.target)},!0),ce("mousedown",o=>{var c,i;r.current&&(a.current=((i=(c=o.composedPath)==null?void 0:c.call(o))==null?void 0:i[0])||o.target)},!0),ce("click",o=>{gt()||a.current&&(u(o,()=>a.current),a.current=null)},!0),ce("touchend",o=>u(o,()=>o.target instanceof HTMLElement?o.target:null),!0),Ge("blur",o=>u(o,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function ue(...e){return l.useMemo(()=>me(...e),[...e])}function je(e){var t;if(e.type)return e.type;let n=(t=e.as)!=null?t:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function Et(e,t){let[n,r]=l.useState(()=>je(e));return B(()=>{r(je(e))},[e.type,e.as]),B(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let Ke=Symbol();function Ve(e,t=!0){return Object.assign(e,{[Ke]:t})}function U(...e){let t=l.useRef(e);l.useEffect(()=>{t.current=e},[e]);let n=P(r=>{for(let u of t.current)u!=null&&(typeof u=="function"?u(r):u.current=r)});return e.every(r=>r==null||(r==null?void 0:r[Ke]))?void 0:n}function pe(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var re=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(re||{}),Z=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Z||{});function q({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:u,visible:a=!0,name:o,mergeRefs:c}){c=c??Pt;let i=We(t,e);if(a)return de(i,n,r,o,c);let p=u??0;if(p&2){let{static:s=!1,...d}=i;if(s)return de(d,n,r,o,c)}if(p&1){let{unmount:s=!0,...d}=i;return I(s?0:1,{0(){return null},1(){return de({...d,hidden:!0,style:{display:"none"}},n,r,o,c)}})}return de(i,n,r,o,c)}function de(e,t={},n,r,u){let{as:a=n,children:o,refName:c="ref",...i}=we(e,["unmount","static"]),p=e.ref!==void 0?{[c]:e.ref}:{},s=typeof o=="function"?o(t):o;"className"in i&&i.className&&typeof i.className=="function"&&(i.className=i.className(t));let d={};if(t){let f=!1,b=[];for(let[g,m]of Object.entries(t))typeof m=="boolean"&&(f=!0),m===!0&&b.push(g);f&&(d["data-headlessui-state"]=b.join(" "))}if(a===l.Fragment&&Object.keys(Be(i)).length>0){if(!l.isValidElement(s)||Array.isArray(s)&&s.length>1)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(i).map(m=>` - ${m}`).join(`
|
|
2
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
3
|
`)].join(`
|
|
4
|
-
`));let f=s.props,b=typeof(f==null?void 0:f.className)=="function"?(...m)=>pe(f==null?void 0:f.className(...m),i.className):pe(f==null?void 0:f.className,i.className),g=b?{className:b}:{};return l.cloneElement(s,Object.assign({},We(s.props,Be(we(i,["ref"]))),d,p,{ref:u(s.ref,p.ref)},g))}return l.createElement(a,Object.assign({},we(i,["ref"]),a!==l.Fragment&&p,a!==l.Fragment&&d),s)}function yt(){let e=l.useRef([]),t=l.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 Pt(...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 We(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let u in r)u.startsWith("on")&&typeof r[u]=="function"?(n[u]!=null||(n[u]=[]),n[u].push(r[u])):t[u]=r[u];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](u,...a){let o=n[r];for(let c of o){if((u instanceof Event||(u==null?void 0:u.nativeEvent)instanceof Event)&&u.defaultPrevented)return;c(u,...a)}}});return t}function _(e){var t;return Object.assign(l.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Be(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function we(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let St="div";var oe=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(oe||{});function wt(e,t){var n;let{features:r=1,...u}=e,a={ref:t,"aria-hidden":(r&2)===2?!0:(n=u["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 q({ourProps:a,theirProps:u,slot:{},defaultTag:St,name:"Hidden"})}let ie=_(wt),Ie=l.createContext(null);Ie.displayName="OpenClosedContext";var k=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(k||{});function he(){return l.useContext(Ie)}function ze({value:e,children:t}){return E.createElement(Ie.Provider,{value:e},t)}function Ye(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Tt(n)?!1:r}function Tt(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}var X=(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))(X||{});function $t(e,t,n,r){let u=j(n);l.useEffect(()=>{e=e??window;function a(o){u.current(o)}return e.addEventListener(t,a,r),()=>e.removeEventListener(t,a,r)},[e,t,r])}function Re(){let e=l.useRef(!1);return B(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ft(e){let t=P(e),n=l.useRef(!1);l.useEffect(()=>(n.current=!1,()=>{n.current=!0,Ue(()=>{n.current&&t()})}),[t])}var V=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(V||{});function Qe(){let e=l.useRef(0);return Ge("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let Xe=l.createContext(!1);function xt(){return l.useContext(Xe)}function xn(e){return E.createElement(Xe.Provider,{value:e.force},e.children)}function Nt(e){let t=xt(),n=l.useContext(Je),r=ue(e),[u,a]=l.useState(()=>{if(!t&&n!==null||W.isServer)return null;let o=r==null?void 0:r.getElementById("headlessui-portal-root");if(o)return o;if(r===null)return null;let c=r.createElement("div");return c.setAttribute("id","headlessui-portal-root"),r.body.appendChild(c)});return l.useEffect(()=>{u!==null&&(r!=null&&r.body.contains(u)||r==null||r.body.appendChild(u))},[u,r]),l.useEffect(()=>{t||n!==null&&a(n.current)},[n,a,t]),u}let Ct=l.Fragment;function Ot(e,t){let n=e,r=l.useRef(null),u=U(Ve(s=>{r.current=s}),t),a=ue(r),o=Nt(r),[c]=l.useState(()=>{var s;return W.isServer?null:(s=a==null?void 0:a.createElement("div"))!=null?s:null}),i=l.useContext(xe),p=ve();return B(()=>{!o||!c||o.contains(c)||(c.setAttribute("data-headlessui-portal",""),o.appendChild(c))},[o,c]),B(()=>{if(c&&i)return i.register(c)},[i,c]),Ft(()=>{var s;!o||!c||(c instanceof Node&&o.contains(c)&&o.removeChild(c),o.childNodes.length<=0&&((s=o.parentElement)==null||s.removeChild(o)))}),p?!o||!c?null:ot.createPortal(q({ourProps:{ref:u},theirProps:n,defaultTag:Ct,name:"Portal"}),c):null}let It=l.Fragment,Je=l.createContext(null);function Rt(e,t){let{target:n,...r}=e,u={ref:U(t)};return E.createElement(Je.Provider,{value:n},q({ourProps:u,theirProps:r,defaultTag:It,name:"Popover.Group"}))}let xe=l.createContext(null);function Mt(){let e=l.useContext(xe),t=l.useRef([]),n=P(a=>(t.current.push(a),e&&e.register(a),()=>r(a))),r=P(a=>{let o=t.current.indexOf(a);o!==-1&&t.current.splice(o,1),e&&e.unregister(a)}),u=l.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,l.useMemo(()=>function({children:a}){return E.createElement(xe.Provider,{value:u},a)},[u])]}let Lt=_(Ot),kt=_(Rt),Nn=Object.assign(Lt,{Group:kt});function At({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var r;let u=l.useRef((r=n==null?void 0:n.current)!=null?r:null),a=ue(u),o=P(()=>{var c,i,p;let s=[];for(let d of e)d!==null&&(d instanceof HTMLElement?s.push(d):"current"in d&&d.current instanceof HTMLElement&&s.push(d.current));if(t!=null&&t.current)for(let d of t.current)s.push(d);for(let d of(c=a==null?void 0:a.querySelectorAll("html > *, body > *"))!=null?c:[])d!==document.body&&d!==document.head&&d instanceof HTMLElement&&d.id!=="headlessui-portal-root"&&(d.contains(u.current)||d.contains((p=(i=u.current)==null?void 0:i.getRootNode())==null?void 0:p.host)||s.some(f=>d.contains(f))||s.push(d));return s});return{resolveContainers:o,contains:P(c=>o().some(i=>i.contains(c))),mainTreeNodeRef:u,MainTreeNode:l.useMemo(()=>function(){return n!=null?null:E.createElement(ie,{features:oe.Hidden,ref:u})},[u,n])}}function Dt(){let e=l.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:l.useMemo(()=>function(){return E.createElement(ie,{features:oe.Hidden,ref:e})},[e])}}var Ht=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ht||{}),jt=(e=>(e[e.TogglePopover=0]="TogglePopover",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))(jt||{});let Bt={0:e=>{let t={...e,popoverState:I(e.popoverState,{0:1,1:0})};return t.popoverState===0&&(t.__demoMode=!1),t},1(e){return e.popoverState===1?e:{...e,popoverState: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}}},Me=l.createContext(null);Me.displayName="PopoverContext";function ge(e){let t=l.useContext(Me);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ge),n}return t}let Le=l.createContext(null);Le.displayName="PopoverAPIContext";function ke(e){let t=l.useContext(Le);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ke),n}return t}let Ae=l.createContext(null);Ae.displayName="PopoverGroupContext";function Ze(){return l.useContext(Ae)}let be=l.createContext(null);be.displayName="PopoverPanelContext";function _t(){return l.useContext(be)}function Ut(e,t){return I(t.type,Bt,e,t)}let qt="div";function Gt(e,t){var n;let{__demoMode:r=!1,...u}=e,a=l.useRef(null),o=U(t,Ve(y=>{a.current=y})),c=l.useRef([]),i=l.useReducer(Ut,{__demoMode:r,popoverState:r?0:1,buttons:c,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:l.createRef(),afterPanelSentinel:l.createRef()}),[{popoverState:p,button:s,buttonId:d,panel:f,panelId:b,beforePanelSentinel:g,afterPanelSentinel:m},v]=i,S=ue((n=a.current)!=null?n:s),x=l.useMemo(()=>{if(!s||!f)return!1;for(let H of document.querySelectorAll("body > *"))if(Number(H==null?void 0:H.contains(s))^Number(H==null?void 0:H.contains(f)))return!0;let y=se(),L=y.indexOf(s),te=(L+y.length-1)%y.length,ee=(L+1)%y.length,G=y[te],ae=y[ee];return!f.contains(G)&&!f.contains(ae)},[s,f]),T=j(d),R=j(b),A=l.useMemo(()=>({buttonId:T,panelId:R,close:()=>v({type:1})}),[T,R,v]),C=Ze(),D=C==null?void 0:C.registerPopover,$=P(()=>{var y;return(y=C==null?void 0:C.isFocusWithinPopoverGroup())!=null?y:(S==null?void 0:S.activeElement)&&((s==null?void 0:s.contains(S.activeElement))||(f==null?void 0:f.contains(S.activeElement)))});l.useEffect(()=>D==null?void 0:D(A),[D,A]);let[N,F]=Mt(),h=At({mainTreeNodeRef:C==null?void 0:C.mainTreeNodeRef,portals:N,defaultContainers:[s,f]});$t(S==null?void 0:S.defaultView,"focus",y=>{var L,te,ee,G;y.target!==window&&y.target instanceof HTMLElement&&p===0&&($()||s&&f&&(h.contains(y.target)||(te=(L=g.current)==null?void 0:L.contains)!=null&&te.call(L,y.target)||(G=(ee=m.current)==null?void 0:ee.contains)!=null&&G.call(ee,y.target)||v({type:1})))},!0),bt(h.resolveContainers,(y,L)=>{v({type:1}),Oe(L,Ce.Loose)||(y.preventDefault(),s==null||s.focus())},p===0);let w=P(y=>{v({type:1});let L=y?y instanceof HTMLElement?y:"current"in y&&y.current instanceof HTMLElement?y.current:s:s;L==null||L.focus()}),O=l.useMemo(()=>({close:w,isPortalled:x}),[w,x]),M=l.useMemo(()=>({open:p===0,close:w}),[p,w]),z={ref:o};return E.createElement(be.Provider,{value:null},E.createElement(Me.Provider,{value:i},E.createElement(Le.Provider,{value:O},E.createElement(ze,{value:I(p,{0:k.Open,1:k.Closed})},E.createElement(F,null,q({ourProps:z,theirProps:u,slot:M,defaultTag:qt,name:"Popover"}),E.createElement(h.MainTreeNode,null))))))}let Kt="button";function Vt(e,t){let n=ne(),{id:r=`headlessui-popover-button-${n}`,...u}=e,[a,o]=ge("Popover.Button"),{isPortalled:c}=ke("Popover.Button"),i=l.useRef(null),p=`headlessui-focus-sentinel-${ne()}`,s=Ze(),d=s==null?void 0:s.closeOthers,f=_t()!==null;l.useEffect(()=>{if(!f)return o({type:3,buttonId:r}),()=>{o({type:3,buttonId:null})}},[f,r,o]);let[b]=l.useState(()=>Symbol()),g=U(i,t,f?null:h=>{if(h)a.buttons.current.push(b);else{let w=a.buttons.current.indexOf(b);w!==-1&&a.buttons.current.splice(w,1)}a.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),h&&o({type:2,button:h})}),m=U(i,t),v=ue(i),S=P(h=>{var w,O,M;if(f){if(a.popoverState===1)return;switch(h.key){case X.Space:case X.Enter:h.preventDefault(),(O=(w=h.target).click)==null||O.call(w),o({type:1}),(M=a.button)==null||M.focus();break}}else switch(h.key){case X.Space:case X.Enter:h.preventDefault(),h.stopPropagation(),a.popoverState===1&&(d==null||d(a.buttonId)),o({type:0});break;case X.Escape:if(a.popoverState!==0)return d==null?void 0:d(a.buttonId);if(!i.current||v!=null&&v.activeElement&&!i.current.contains(v.activeElement))return;h.preventDefault(),h.stopPropagation(),o({type:1});break}}),x=P(h=>{f||h.key===X.Space&&h.preventDefault()}),T=P(h=>{var w,O;Ye(h.currentTarget)||e.disabled||(f?(o({type:1}),(w=a.button)==null||w.focus()):(h.preventDefault(),h.stopPropagation(),a.popoverState===1&&(d==null||d(a.buttonId)),o({type:0}),(O=a.button)==null||O.focus()))}),R=P(h=>{h.preventDefault(),h.stopPropagation()}),A=a.popoverState===0,C=l.useMemo(()=>({open:A}),[A]),D=Et(e,i),$=f?{ref:m,type:D,onKeyDown:S,onClick:T}:{ref:g,id:a.buttonId,type:D,"aria-expanded":a.popoverState===0,"aria-controls":a.panel?a.panelId:void 0,onKeyDown:S,onKeyUp:x,onClick:T,onMouseDown:R},N=Qe(),F=P(()=>{let h=a.panel;if(!h)return;function w(){I(N.current,{[V.Forwards]:()=>J(h,K.First),[V.Backwards]:()=>J(h,K.Last)})===fe.Error&&J(se().filter(O=>O.dataset.headlessuiFocusGuard!=="true"),I(N.current,{[V.Forwards]:K.Next,[V.Backwards]:K.Previous}),{relativeTo:a.button})}w()});return E.createElement(E.Fragment,null,q({ourProps:$,theirProps:u,slot:C,defaultTag:Kt,name:"Popover.Button"}),A&&!f&&c&&E.createElement(ie,{id:p,features:oe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:F}))}let Wt="div",zt=re.RenderStrategy|re.Static;function Yt(e,t){let n=ne(),{id:r=`headlessui-popover-overlay-${n}`,...u}=e,[{popoverState:a},o]=ge("Popover.Overlay"),c=U(t),i=he(),p=i!==null?(i&k.Open)===k.Open:a===0,s=P(f=>{if(Ye(f.currentTarget))return f.preventDefault();o({type:1})}),d=l.useMemo(()=>({open:a===0}),[a]);return q({ourProps:{ref:c,id:r,"aria-hidden":!0,onClick:s},theirProps:u,slot:d,defaultTag:Wt,features:zt,visible:p,name:"Popover.Overlay"})}let Qt="div",Xt=re.RenderStrategy|re.Static;function Jt(e,t){let n=ne(),{id:r=`headlessui-popover-panel-${n}`,focus:u=!1,...a}=e,[o,c]=ge("Popover.Panel"),{close:i,isPortalled:p}=ke("Popover.Panel"),s=`headlessui-focus-sentinel-before-${ne()}`,d=`headlessui-focus-sentinel-after-${ne()}`,f=l.useRef(null),b=U(f,t,$=>{c({type:4,panel:$})}),g=ue(f),m=yt();B(()=>(c({type:5,panelId:r}),()=>{c({type:5,panelId:null})}),[r,c]);let v=he(),S=v!==null?(v&k.Open)===k.Open:o.popoverState===0,x=P($=>{var N;switch($.key){case X.Escape:if(o.popoverState!==0||!f.current||g!=null&&g.activeElement&&!f.current.contains(g.activeElement))return;$.preventDefault(),$.stopPropagation(),c({type:1}),(N=o.button)==null||N.focus();break}});l.useEffect(()=>{var $;e.static||o.popoverState===1&&(($=e.unmount)==null||$)&&c({type:4,panel:null})},[o.popoverState,e.unmount,e.static,c]),l.useEffect(()=>{if(o.__demoMode||!u||o.popoverState!==0||!f.current)return;let $=g==null?void 0:g.activeElement;f.current.contains($)||J(f.current,K.First)},[o.__demoMode,u,f,o.popoverState]);let T=l.useMemo(()=>({open:o.popoverState===0,close:i}),[o,i]),R={ref:b,id:r,onKeyDown:x,onBlur:u&&o.popoverState===0?$=>{var N,F,h,w,O;let M=$.relatedTarget;M&&f.current&&((N=f.current)!=null&&N.contains(M)||(c({type:1}),((h=(F=o.beforePanelSentinel.current)==null?void 0:F.contains)!=null&&h.call(F,M)||(O=(w=o.afterPanelSentinel.current)==null?void 0:w.contains)!=null&&O.call(w,M))&&M.focus({preventScroll:!0})))}:void 0,tabIndex:-1},A=Qe(),C=P(()=>{let $=f.current;if(!$)return;function N(){I(A.current,{[V.Forwards]:()=>{var F;J($,K.First)===fe.Error&&((F=o.afterPanelSentinel.current)==null||F.focus())},[V.Backwards]:()=>{var F;(F=o.button)==null||F.focus({preventScroll:!0})}})}N()}),D=P(()=>{let $=f.current;if(!$)return;function N(){I(A.current,{[V.Forwards]:()=>{var F;if(!o.button)return;let h=se(),w=h.indexOf(o.button),O=h.slice(0,w+1),M=[...h.slice(w+1),...O];for(let z of M.slice())if(z.dataset.headlessuiFocusGuard==="true"||(F=o.panel)!=null&&F.contains(z)){let y=M.indexOf(z);y!==-1&&M.splice(y,1)}J(M,K.First,{sorted:!1})},[V.Backwards]:()=>{var F;J($,K.Previous)===fe.Error&&((F=o.button)==null||F.focus())}})}N()});return E.createElement(be.Provider,{value:r},S&&p&&E.createElement(ie,{id:s,ref:o.beforePanelSentinel,features:oe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:C}),q({mergeRefs:m,ourProps:R,theirProps:a,slot:T,defaultTag:Qt,features:Xt,visible:S,name:"Popover.Panel"}),S&&p&&E.createElement(ie,{id:d,ref:o.afterPanelSentinel,features:oe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:D}))}let Zt="div";function en(e,t){let n=l.useRef(null),r=U(n,t),[u,a]=l.useState([]),o=Dt(),c=P(m=>{a(v=>{let S=v.indexOf(m);if(S!==-1){let x=v.slice();return x.splice(S,1),x}return v})}),i=P(m=>(a(v=>[...v,m]),()=>c(m))),p=P(()=>{var m;let v=me(n);if(!v)return!1;let S=v.activeElement;return(m=n.current)!=null&&m.contains(S)?!0:u.some(x=>{var T,R;return((T=v.getElementById(x.buttonId.current))==null?void 0:T.contains(S))||((R=v.getElementById(x.panelId.current))==null?void 0:R.contains(S))})}),s=P(m=>{for(let v of u)v.buttonId.current!==m&&v.close()}),d=l.useMemo(()=>({registerPopover:i,unregisterPopover:c,isFocusWithinPopoverGroup:p,closeOthers:s,mainTreeNodeRef:o.mainTreeNodeRef}),[i,c,p,s,o.mainTreeNodeRef]),f=l.useMemo(()=>({}),[]),b=e,g={ref:r};return E.createElement(Ae.Provider,{value:d},q({ourProps:g,theirProps:b,slot:f,defaultTag:Zt,name:"Popover.Group"}),E.createElement(o.MainTreeNode,null))}let tn=_(Gt),nn=_(Vt),rn=_(Yt),on=_(Jt),ln=_(en),Cn=Object.assign(tn,{Button:nn,Overlay:rn,Panel:on,Group:ln});function un(e=0){let[t,n]=l.useState(e),r=Re(),u=l.useCallback(i=>{r.current&&n(p=>p|i)},[t,r]),a=l.useCallback(i=>!!(t&i),[t]),o=l.useCallback(i=>{r.current&&n(p=>p&~i)},[n,r]),c=l.useCallback(i=>{r.current&&n(p=>p^i)},[n]);return{flags:t,addFlag:u,hasFlag:a,removeFlag:o,toggleFlag:c}}function an(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function Te(e,...t){e&&t.length>0&&e.classList.add(...t)}function $e(e,...t){e&&t.length>0&&e.classList.remove(...t)}function sn(e,t){let n=le();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:u}=getComputedStyle(e),[a,o]=[r,u].map(i=>{let[p=0]=i.split(",").filter(Boolean).map(s=>s.includes("ms")?parseFloat(s):parseFloat(s)*1e3).sort((s,d)=>d-s);return p}),c=a+o;if(c!==0){n.group(p=>{p.setTimeout(()=>{t(),p.dispose()},c),p.addEventListener(e,"transitionrun",s=>{s.target===s.currentTarget&&p.dispose()})});let i=n.addEventListener(e,"transitionend",p=>{p.target===p.currentTarget&&(t(),i())})}else t();return n.add(()=>t()),n.dispose}function cn(e,t,n,r){let u=n?"enter":"leave",a=le(),o=r!==void 0?an(r):()=>{};u==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let c=I(u,{enter:()=>t.enter,leave:()=>t.leave}),i=I(u,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),p=I(u,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return $e(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),Te(e,...t.base,...c,...p),a.nextFrame(()=>{$e(e,...t.base,...c,...p),Te(e,...t.base,...c,...i),sn(e,()=>($e(e,...t.base,...c),Te(e,...t.base,...t.entered),o()))}),a.dispose}function dn({immediate:e,container:t,direction:n,classes:r,onStart:u,onStop:a}){let o=Re(),c=qe(),i=j(n);B(()=>{e&&(i.current="enter")},[e]),B(()=>{let p=le();c.add(p.dispose);let s=t.current;if(s&&i.current!=="idle"&&o.current)return p.dispose(),u.current(i.current),p.add(cn(s,r.current,i.current==="enter",()=>{p.dispose(),a.current(i.current)})),p.dispose},[n])}function Q(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let Ee=l.createContext(null);Ee.displayName="TransitionContext";var fn=(e=>(e.Visible="visible",e.Hidden="hidden",e))(fn||{});function pn(){let e=l.useContext(Ee);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function vn(){let e=l.useContext(ye);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let ye=l.createContext(null);ye.displayName="NestingContext";function Pe(e){return"children"in e?Pe(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function et(e,t){let n=j(e),r=l.useRef([]),u=Re(),a=qe(),o=P((b,g=Z.Hidden)=>{let m=r.current.findIndex(({el:v})=>v===b);m!==-1&&(I(g,{[Z.Unmount](){r.current.splice(m,1)},[Z.Hidden](){r.current[m].state="hidden"}}),a.microTask(()=>{var v;!Pe(r)&&u.current&&((v=n.current)==null||v.call(n))}))}),c=P(b=>{let g=r.current.find(({el:m})=>m===b);return g?g.state!=="visible"&&(g.state="visible"):r.current.push({el:b,state:"visible"}),()=>o(b,Z.Unmount)}),i=l.useRef([]),p=l.useRef(Promise.resolve()),s=l.useRef({enter:[],leave:[],idle:[]}),d=P((b,g,m)=>{i.current.splice(0),t&&(t.chains.current[g]=t.chains.current[g].filter(([v])=>v!==b)),t==null||t.chains.current[g].push([b,new Promise(v=>{i.current.push(v)})]),t==null||t.chains.current[g].push([b,new Promise(v=>{Promise.all(s.current[g].map(([S,x])=>x)).then(()=>v())})]),g==="enter"?p.current=p.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(g)):m(g)}),f=P((b,g,m)=>{Promise.all(s.current[g].splice(0).map(([v,S])=>S)).then(()=>{var v;(v=i.current.shift())==null||v()}).then(()=>m(g))});return l.useMemo(()=>({children:r,register:c,unregister:o,onStart:d,onStop:f,wait:p,chains:s}),[c,o,r,d,f,s,p])}function mn(){}let hn=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function _e(e){var t;let n={};for(let r of hn)n[r]=(t=e[r])!=null?t:mn;return n}function gn(e){let t=l.useRef(_e(e));return l.useEffect(()=>{t.current=_e(e)},[e]),t}let bn="div",tt=re.RenderStrategy;function En(e,t){var n,r;let{beforeEnter:u,afterEnter:a,beforeLeave:o,afterLeave:c,enter:i,enterFrom:p,enterTo:s,entered:d,leave:f,leaveFrom:b,leaveTo:g,...m}=e,v=l.useRef(null),S=U(v,t),x=(n=m.unmount)==null||n?Z.Unmount:Z.Hidden,{show:T,appear:R,initial:A}=pn(),[C,D]=l.useState(T?"visible":"hidden"),$=vn(),{register:N,unregister:F}=$;l.useEffect(()=>N(v),[N,v]),l.useEffect(()=>{if(x===Z.Hidden&&v.current){if(T&&C!=="visible"){D("visible");return}return I(C,{hidden:()=>F(v),visible:()=>N(v)})}},[C,v,N,F,T,x]);let h=j({base:Q(m.className),enter:Q(i),enterFrom:Q(p),enterTo:Q(s),entered:Q(d),leave:Q(f),leaveFrom:Q(b),leaveTo:Q(g)}),w=gn({beforeEnter:u,afterEnter:a,beforeLeave:o,afterLeave:c}),O=ve();l.useEffect(()=>{if(O&&C==="visible"&&v.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[v,C,O]);let M=A&&!R,z=R&&T&&A,y=!O||M?"idle":T?"enter":"leave",L=un(0),te=P(Y=>I(Y,{enter:()=>{L.addFlag(k.Opening),w.current.beforeEnter()},leave:()=>{L.addFlag(k.Closing),w.current.beforeLeave()},idle:()=>{}})),ee=P(Y=>I(Y,{enter:()=>{L.removeFlag(k.Opening),w.current.afterEnter()},leave:()=>{L.removeFlag(k.Closing),w.current.afterLeave()},idle:()=>{}})),G=et(()=>{D("hidden"),F(v)},$),ae=l.useRef(!1);dn({immediate:z,container:v,classes:h,direction:y,onStart:j(Y=>{ae.current=!0,G.onStart(v,Y,te)}),onStop:j(Y=>{ae.current=!1,G.onStop(v,Y,ee),Y==="leave"&&!Pe(G)&&(D("hidden"),F(v))})});let H=m,rt={ref:S};return z?H={...H,className:pe(m.className,...h.current.enter,...h.current.enterFrom)}:ae.current&&(H.className=pe(m.className,(r=v.current)==null?void 0:r.className),H.className===""&&delete H.className),E.createElement(ye.Provider,{value:G},E.createElement(ze,{value:I(C,{visible:k.Open,hidden:k.Closed})|L.flags},q({ourProps:rt,theirProps:H,defaultTag:bn,features:tt,visible:C==="visible",name:"Transition.Child"})))}function yn(e,t){let{show:n,appear:r=!1,unmount:u=!0,...a}=e,o=l.useRef(null),c=U(o,t);ve();let i=he();if(n===void 0&&i!==null&&(n=(i&k.Open)===k.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[p,s]=l.useState(n?"visible":"hidden"),d=et(()=>{s("hidden")}),[f,b]=l.useState(!0),g=l.useRef([n]);B(()=>{f!==!1&&g.current[g.current.length-1]!==n&&(g.current.push(n),b(!1))},[g,n]);let m=l.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);l.useEffect(()=>{if(n)s("visible");else if(!Pe(d))s("hidden");else{let T=o.current;if(!T)return;let R=T.getBoundingClientRect();R.x===0&&R.y===0&&R.width===0&&R.height===0&&s("hidden")}},[n,d]);let v={unmount:u},S=P(()=>{var T;f&&b(!1),(T=e.beforeEnter)==null||T.call(e)}),x=P(()=>{var T;f&&b(!1),(T=e.beforeLeave)==null||T.call(e)});return E.createElement(ye.Provider,{value:d},E.createElement(Ee.Provider,{value:m},q({ourProps:{...v,as:l.Fragment,children:E.createElement(nt,{ref:c,...v,...a,beforeEnter:S,beforeLeave:x})},theirProps:{},defaultTag:l.Fragment,features:tt,visible:p==="visible",name:"Transition"})))}function Pn(e,t){let n=l.useContext(Ee)!==null,r=he()!==null;return E.createElement(E.Fragment,null,!n&&r?E.createElement(Ne,{ref:t,...e}):E.createElement(nt,{ref:t,...e}))}let Ne=_(yn),nt=_(En),Sn=_(Pn),On=Object.assign(Ne,{Child:Sn,Root:Ne});export{Ye as A,Cn as B,q as C,On as D,$t as E,Be as F,me as G,ze as H,ne as I,Oe as J,Ce as K,$n as L,K as M,fe as N,J as O,vt as P,un as Q,j as R,Ve as S,Et as T,_ as U,yt as V,Fn as _,Qe as a,ie as b,oe as c,Ft as d,dt as e,Re as f,mt as g,le as h,B as i,he as j,k,ve as l,Mt as m,ue as n,P as o,qe as p,At as q,bt as r,V as s,Ue as t,I as u,xn as v,Nn as w,re as x,U as y,X as z};
|
|
4
|
+
`));let f=s.props,b=typeof(f==null?void 0:f.className)=="function"?(...m)=>pe(f==null?void 0:f.className(...m),i.className):pe(f==null?void 0:f.className,i.className),g=b?{className:b}:{};return l.cloneElement(s,Object.assign({},We(s.props,Be(we(i,["ref"]))),d,p,{ref:u(s.ref,p.ref)},g))}return l.createElement(a,Object.assign({},we(i,["ref"]),a!==l.Fragment&&p,a!==l.Fragment&&d),s)}function yt(){let e=l.useRef([]),t=l.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 Pt(...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 We(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let u in r)u.startsWith("on")&&typeof r[u]=="function"?(n[u]!=null||(n[u]=[]),n[u].push(r[u])):t[u]=r[u];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](u,...a){let o=n[r];for(let c of o){if((u instanceof Event||(u==null?void 0:u.nativeEvent)instanceof Event)&&u.defaultPrevented)return;c(u,...a)}}});return t}function _(e){var t;return Object.assign(l.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Be(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function we(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let St="div";var oe=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(oe||{});function wt(e,t){var n;let{features:r=1,...u}=e,a={ref:t,"aria-hidden":(r&2)===2?!0:(n=u["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 q({ourProps:a,theirProps:u,slot:{},defaultTag:St,name:"Hidden"})}let ie=_(wt),Ie=l.createContext(null);Ie.displayName="OpenClosedContext";var k=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(k||{});function he(){return l.useContext(Ie)}function ze({value:e,children:t}){return E.createElement(Ie.Provider,{value:e},t)}function Ye(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Tt(n)?!1:r}function Tt(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}var X=(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))(X||{});function $t(e,t,n,r){let u=j(n);l.useEffect(()=>{e=e??window;function a(o){u.current(o)}return e.addEventListener(t,a,r),()=>e.removeEventListener(t,a,r)},[e,t,r])}function Re(){let e=l.useRef(!1);return B(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ft(e){let t=P(e),n=l.useRef(!1);l.useEffect(()=>(n.current=!1,()=>{n.current=!0,Ue(()=>{n.current&&t()})}),[t])}var V=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(V||{});function Qe(){let e=l.useRef(0);return Ge("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let Xe=l.createContext(!1);function xt(){return l.useContext(Xe)}function Nn(e){return E.createElement(Xe.Provider,{value:e.force},e.children)}function Nt(e){let t=xt(),n=l.useContext(Je),r=ue(e),[u,a]=l.useState(()=>{if(!t&&n!==null||W.isServer)return null;let o=r==null?void 0:r.getElementById("headlessui-portal-root");if(o)return o;if(r===null)return null;let c=r.createElement("div");return c.setAttribute("id","headlessui-portal-root"),r.body.appendChild(c)});return l.useEffect(()=>{u!==null&&(r!=null&&r.body.contains(u)||r==null||r.body.appendChild(u))},[u,r]),l.useEffect(()=>{t||n!==null&&a(n.current)},[n,a,t]),u}let Ct=l.Fragment;function Ot(e,t){let n=e,r=l.useRef(null),u=U(Ve(s=>{r.current=s}),t),a=ue(r),o=Nt(r),[c]=l.useState(()=>{var s;return W.isServer?null:(s=a==null?void 0:a.createElement("div"))!=null?s:null}),i=l.useContext(xe),p=ve();return B(()=>{!o||!c||o.contains(c)||(c.setAttribute("data-headlessui-portal",""),o.appendChild(c))},[o,c]),B(()=>{if(c&&i)return i.register(c)},[i,c]),Ft(()=>{var s;!o||!c||(c instanceof Node&&o.contains(c)&&o.removeChild(c),o.childNodes.length<=0&&((s=o.parentElement)==null||s.removeChild(o)))}),p?!o||!c?null:ot.createPortal(q({ourProps:{ref:u},theirProps:n,defaultTag:Ct,name:"Portal"}),c):null}let It=l.Fragment,Je=l.createContext(null);function Rt(e,t){let{target:n,...r}=e,u={ref:U(t)};return E.createElement(Je.Provider,{value:n},q({ourProps:u,theirProps:r,defaultTag:It,name:"Popover.Group"}))}let xe=l.createContext(null);function Mt(){let e=l.useContext(xe),t=l.useRef([]),n=P(a=>(t.current.push(a),e&&e.register(a),()=>r(a))),r=P(a=>{let o=t.current.indexOf(a);o!==-1&&t.current.splice(o,1),e&&e.unregister(a)}),u=l.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,l.useMemo(()=>function({children:a}){return E.createElement(xe.Provider,{value:u},a)},[u])]}let Lt=_(Ot),kt=_(Rt),Cn=Object.assign(Lt,{Group:kt});function At({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var r;let u=l.useRef((r=n==null?void 0:n.current)!=null?r:null),a=ue(u),o=P(()=>{var c,i,p;let s=[];for(let d of e)d!==null&&(d instanceof HTMLElement?s.push(d):"current"in d&&d.current instanceof HTMLElement&&s.push(d.current));if(t!=null&&t.current)for(let d of t.current)s.push(d);for(let d of(c=a==null?void 0:a.querySelectorAll("html > *, body > *"))!=null?c:[])d!==document.body&&d!==document.head&&d instanceof HTMLElement&&d.id!=="headlessui-portal-root"&&(d.contains(u.current)||d.contains((p=(i=u.current)==null?void 0:i.getRootNode())==null?void 0:p.host)||s.some(f=>d.contains(f))||s.push(d));return s});return{resolveContainers:o,contains:P(c=>o().some(i=>i.contains(c))),mainTreeNodeRef:u,MainTreeNode:l.useMemo(()=>function(){return n!=null?null:E.createElement(ie,{features:oe.Hidden,ref:u})},[u,n])}}function Dt(){let e=l.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:l.useMemo(()=>function(){return E.createElement(ie,{features:oe.Hidden,ref:e})},[e])}}var Ht=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ht||{}),jt=(e=>(e[e.TogglePopover=0]="TogglePopover",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))(jt||{});let Bt={0:e=>{let t={...e,popoverState:I(e.popoverState,{0:1,1:0})};return t.popoverState===0&&(t.__demoMode=!1),t},1(e){return e.popoverState===1?e:{...e,popoverState: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}}},Me=l.createContext(null);Me.displayName="PopoverContext";function ge(e){let t=l.useContext(Me);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ge),n}return t}let Le=l.createContext(null);Le.displayName="PopoverAPIContext";function ke(e){let t=l.useContext(Le);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ke),n}return t}let Ae=l.createContext(null);Ae.displayName="PopoverGroupContext";function Ze(){return l.useContext(Ae)}let be=l.createContext(null);be.displayName="PopoverPanelContext";function _t(){return l.useContext(be)}function Ut(e,t){return I(t.type,Bt,e,t)}let qt="div";function Gt(e,t){var n;let{__demoMode:r=!1,...u}=e,a=l.useRef(null),o=U(t,Ve(y=>{a.current=y})),c=l.useRef([]),i=l.useReducer(Ut,{__demoMode:r,popoverState:r?0:1,buttons:c,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:l.createRef(),afterPanelSentinel:l.createRef()}),[{popoverState:p,button:s,buttonId:d,panel:f,panelId:b,beforePanelSentinel:g,afterPanelSentinel:m},v]=i,S=ue((n=a.current)!=null?n:s),x=l.useMemo(()=>{if(!s||!f)return!1;for(let H of document.querySelectorAll("body > *"))if(Number(H==null?void 0:H.contains(s))^Number(H==null?void 0:H.contains(f)))return!0;let y=se(),L=y.indexOf(s),te=(L+y.length-1)%y.length,ee=(L+1)%y.length,G=y[te],ae=y[ee];return!f.contains(G)&&!f.contains(ae)},[s,f]),T=j(d),R=j(b),A=l.useMemo(()=>({buttonId:T,panelId:R,close:()=>v({type:1})}),[T,R,v]),C=Ze(),D=C==null?void 0:C.registerPopover,$=P(()=>{var y;return(y=C==null?void 0:C.isFocusWithinPopoverGroup())!=null?y:(S==null?void 0:S.activeElement)&&((s==null?void 0:s.contains(S.activeElement))||(f==null?void 0:f.contains(S.activeElement)))});l.useEffect(()=>D==null?void 0:D(A),[D,A]);let[N,F]=Mt(),h=At({mainTreeNodeRef:C==null?void 0:C.mainTreeNodeRef,portals:N,defaultContainers:[s,f]});$t(S==null?void 0:S.defaultView,"focus",y=>{var L,te,ee,G;y.target!==window&&y.target instanceof HTMLElement&&p===0&&($()||s&&f&&(h.contains(y.target)||(te=(L=g.current)==null?void 0:L.contains)!=null&&te.call(L,y.target)||(G=(ee=m.current)==null?void 0:ee.contains)!=null&&G.call(ee,y.target)||v({type:1})))},!0),bt(h.resolveContainers,(y,L)=>{v({type:1}),Oe(L,Ce.Loose)||(y.preventDefault(),s==null||s.focus())},p===0);let w=P(y=>{v({type:1});let L=y?y instanceof HTMLElement?y:"current"in y&&y.current instanceof HTMLElement?y.current:s:s;L==null||L.focus()}),O=l.useMemo(()=>({close:w,isPortalled:x}),[w,x]),M=l.useMemo(()=>({open:p===0,close:w}),[p,w]),z={ref:o};return E.createElement(be.Provider,{value:null},E.createElement(Me.Provider,{value:i},E.createElement(Le.Provider,{value:O},E.createElement(ze,{value:I(p,{0:k.Open,1:k.Closed})},E.createElement(F,null,q({ourProps:z,theirProps:u,slot:M,defaultTag:qt,name:"Popover"}),E.createElement(h.MainTreeNode,null))))))}let Kt="button";function Vt(e,t){let n=ne(),{id:r=`headlessui-popover-button-${n}`,...u}=e,[a,o]=ge("Popover.Button"),{isPortalled:c}=ke("Popover.Button"),i=l.useRef(null),p=`headlessui-focus-sentinel-${ne()}`,s=Ze(),d=s==null?void 0:s.closeOthers,f=_t()!==null;l.useEffect(()=>{if(!f)return o({type:3,buttonId:r}),()=>{o({type:3,buttonId:null})}},[f,r,o]);let[b]=l.useState(()=>Symbol()),g=U(i,t,f?null:h=>{if(h)a.buttons.current.push(b);else{let w=a.buttons.current.indexOf(b);w!==-1&&a.buttons.current.splice(w,1)}a.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),h&&o({type:2,button:h})}),m=U(i,t),v=ue(i),S=P(h=>{var w,O,M;if(f){if(a.popoverState===1)return;switch(h.key){case X.Space:case X.Enter:h.preventDefault(),(O=(w=h.target).click)==null||O.call(w),o({type:1}),(M=a.button)==null||M.focus();break}}else switch(h.key){case X.Space:case X.Enter:h.preventDefault(),h.stopPropagation(),a.popoverState===1&&(d==null||d(a.buttonId)),o({type:0});break;case X.Escape:if(a.popoverState!==0)return d==null?void 0:d(a.buttonId);if(!i.current||v!=null&&v.activeElement&&!i.current.contains(v.activeElement))return;h.preventDefault(),h.stopPropagation(),o({type:1});break}}),x=P(h=>{f||h.key===X.Space&&h.preventDefault()}),T=P(h=>{var w,O;Ye(h.currentTarget)||e.disabled||(f?(o({type:1}),(w=a.button)==null||w.focus()):(h.preventDefault(),h.stopPropagation(),a.popoverState===1&&(d==null||d(a.buttonId)),o({type:0}),(O=a.button)==null||O.focus()))}),R=P(h=>{h.preventDefault(),h.stopPropagation()}),A=a.popoverState===0,C=l.useMemo(()=>({open:A}),[A]),D=Et(e,i),$=f?{ref:m,type:D,onKeyDown:S,onClick:T}:{ref:g,id:a.buttonId,type:D,"aria-expanded":a.popoverState===0,"aria-controls":a.panel?a.panelId:void 0,onKeyDown:S,onKeyUp:x,onClick:T,onMouseDown:R},N=Qe(),F=P(()=>{let h=a.panel;if(!h)return;function w(){I(N.current,{[V.Forwards]:()=>J(h,K.First),[V.Backwards]:()=>J(h,K.Last)})===fe.Error&&J(se().filter(O=>O.dataset.headlessuiFocusGuard!=="true"),I(N.current,{[V.Forwards]:K.Next,[V.Backwards]:K.Previous}),{relativeTo:a.button})}w()});return E.createElement(E.Fragment,null,q({ourProps:$,theirProps:u,slot:C,defaultTag:Kt,name:"Popover.Button"}),A&&!f&&c&&E.createElement(ie,{id:p,features:oe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:F}))}let Wt="div",zt=re.RenderStrategy|re.Static;function Yt(e,t){let n=ne(),{id:r=`headlessui-popover-overlay-${n}`,...u}=e,[{popoverState:a},o]=ge("Popover.Overlay"),c=U(t),i=he(),p=i!==null?(i&k.Open)===k.Open:a===0,s=P(f=>{if(Ye(f.currentTarget))return f.preventDefault();o({type:1})}),d=l.useMemo(()=>({open:a===0}),[a]);return q({ourProps:{ref:c,id:r,"aria-hidden":!0,onClick:s},theirProps:u,slot:d,defaultTag:Wt,features:zt,visible:p,name:"Popover.Overlay"})}let Qt="div",Xt=re.RenderStrategy|re.Static;function Jt(e,t){let n=ne(),{id:r=`headlessui-popover-panel-${n}`,focus:u=!1,...a}=e,[o,c]=ge("Popover.Panel"),{close:i,isPortalled:p}=ke("Popover.Panel"),s=`headlessui-focus-sentinel-before-${ne()}`,d=`headlessui-focus-sentinel-after-${ne()}`,f=l.useRef(null),b=U(f,t,$=>{c({type:4,panel:$})}),g=ue(f),m=yt();B(()=>(c({type:5,panelId:r}),()=>{c({type:5,panelId:null})}),[r,c]);let v=he(),S=v!==null?(v&k.Open)===k.Open:o.popoverState===0,x=P($=>{var N;switch($.key){case X.Escape:if(o.popoverState!==0||!f.current||g!=null&&g.activeElement&&!f.current.contains(g.activeElement))return;$.preventDefault(),$.stopPropagation(),c({type:1}),(N=o.button)==null||N.focus();break}});l.useEffect(()=>{var $;e.static||o.popoverState===1&&(($=e.unmount)==null||$)&&c({type:4,panel:null})},[o.popoverState,e.unmount,e.static,c]),l.useEffect(()=>{if(o.__demoMode||!u||o.popoverState!==0||!f.current)return;let $=g==null?void 0:g.activeElement;f.current.contains($)||J(f.current,K.First)},[o.__demoMode,u,f,o.popoverState]);let T=l.useMemo(()=>({open:o.popoverState===0,close:i}),[o,i]),R={ref:b,id:r,onKeyDown:x,onBlur:u&&o.popoverState===0?$=>{var N,F,h,w,O;let M=$.relatedTarget;M&&f.current&&((N=f.current)!=null&&N.contains(M)||(c({type:1}),((h=(F=o.beforePanelSentinel.current)==null?void 0:F.contains)!=null&&h.call(F,M)||(O=(w=o.afterPanelSentinel.current)==null?void 0:w.contains)!=null&&O.call(w,M))&&M.focus({preventScroll:!0})))}:void 0,tabIndex:-1},A=Qe(),C=P(()=>{let $=f.current;if(!$)return;function N(){I(A.current,{[V.Forwards]:()=>{var F;J($,K.First)===fe.Error&&((F=o.afterPanelSentinel.current)==null||F.focus())},[V.Backwards]:()=>{var F;(F=o.button)==null||F.focus({preventScroll:!0})}})}N()}),D=P(()=>{let $=f.current;if(!$)return;function N(){I(A.current,{[V.Forwards]:()=>{var F;if(!o.button)return;let h=se(),w=h.indexOf(o.button),O=h.slice(0,w+1),M=[...h.slice(w+1),...O];for(let z of M.slice())if(z.dataset.headlessuiFocusGuard==="true"||(F=o.panel)!=null&&F.contains(z)){let y=M.indexOf(z);y!==-1&&M.splice(y,1)}J(M,K.First,{sorted:!1})},[V.Backwards]:()=>{var F;J($,K.Previous)===fe.Error&&((F=o.button)==null||F.focus())}})}N()});return E.createElement(be.Provider,{value:r},S&&p&&E.createElement(ie,{id:s,ref:o.beforePanelSentinel,features:oe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:C}),q({mergeRefs:m,ourProps:R,theirProps:a,slot:T,defaultTag:Qt,features:Xt,visible:S,name:"Popover.Panel"}),S&&p&&E.createElement(ie,{id:d,ref:o.afterPanelSentinel,features:oe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:D}))}let Zt="div";function en(e,t){let n=l.useRef(null),r=U(n,t),[u,a]=l.useState([]),o=Dt(),c=P(m=>{a(v=>{let S=v.indexOf(m);if(S!==-1){let x=v.slice();return x.splice(S,1),x}return v})}),i=P(m=>(a(v=>[...v,m]),()=>c(m))),p=P(()=>{var m;let v=me(n);if(!v)return!1;let S=v.activeElement;return(m=n.current)!=null&&m.contains(S)?!0:u.some(x=>{var T,R;return((T=v.getElementById(x.buttonId.current))==null?void 0:T.contains(S))||((R=v.getElementById(x.panelId.current))==null?void 0:R.contains(S))})}),s=P(m=>{for(let v of u)v.buttonId.current!==m&&v.close()}),d=l.useMemo(()=>({registerPopover:i,unregisterPopover:c,isFocusWithinPopoverGroup:p,closeOthers:s,mainTreeNodeRef:o.mainTreeNodeRef}),[i,c,p,s,o.mainTreeNodeRef]),f=l.useMemo(()=>({}),[]),b=e,g={ref:r};return E.createElement(Ae.Provider,{value:d},q({ourProps:g,theirProps:b,slot:f,defaultTag:Zt,name:"Popover.Group"}),E.createElement(o.MainTreeNode,null))}let tn=_(Gt),nn=_(Vt),rn=_(Yt),on=_(Jt),ln=_(en),On=Object.assign(tn,{Button:nn,Overlay:rn,Panel:on,Group:ln});function un(e=0){let[t,n]=l.useState(e),r=Re(),u=l.useCallback(i=>{r.current&&n(p=>p|i)},[t,r]),a=l.useCallback(i=>!!(t&i),[t]),o=l.useCallback(i=>{r.current&&n(p=>p&~i)},[n,r]),c=l.useCallback(i=>{r.current&&n(p=>p^i)},[n]);return{flags:t,addFlag:u,hasFlag:a,removeFlag:o,toggleFlag:c}}function an(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function Te(e,...t){e&&t.length>0&&e.classList.add(...t)}function $e(e,...t){e&&t.length>0&&e.classList.remove(...t)}function sn(e,t){let n=le();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:u}=getComputedStyle(e),[a,o]=[r,u].map(i=>{let[p=0]=i.split(",").filter(Boolean).map(s=>s.includes("ms")?parseFloat(s):parseFloat(s)*1e3).sort((s,d)=>d-s);return p}),c=a+o;if(c!==0){n.group(p=>{p.setTimeout(()=>{t(),p.dispose()},c),p.addEventListener(e,"transitionrun",s=>{s.target===s.currentTarget&&p.dispose()})});let i=n.addEventListener(e,"transitionend",p=>{p.target===p.currentTarget&&(t(),i())})}else t();return n.add(()=>t()),n.dispose}function cn(e,t,n,r){let u=n?"enter":"leave",a=le(),o=r!==void 0?an(r):()=>{};u==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let c=I(u,{enter:()=>t.enter,leave:()=>t.leave}),i=I(u,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),p=I(u,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return $e(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),Te(e,...t.base,...c,...p),a.nextFrame(()=>{$e(e,...t.base,...c,...p),Te(e,...t.base,...c,...i),sn(e,()=>($e(e,...t.base,...c),Te(e,...t.base,...t.entered),o()))}),a.dispose}function dn({immediate:e,container:t,direction:n,classes:r,onStart:u,onStop:a}){let o=Re(),c=qe(),i=j(n);B(()=>{e&&(i.current="enter")},[e]),B(()=>{let p=le();c.add(p.dispose);let s=t.current;if(s&&i.current!=="idle"&&o.current)return p.dispose(),u.current(i.current),p.add(cn(s,r.current,i.current==="enter",()=>{p.dispose(),a.current(i.current)})),p.dispose},[n])}function Q(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let Ee=l.createContext(null);Ee.displayName="TransitionContext";var fn=(e=>(e.Visible="visible",e.Hidden="hidden",e))(fn||{});function pn(){let e=l.useContext(Ee);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function vn(){let e=l.useContext(ye);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let ye=l.createContext(null);ye.displayName="NestingContext";function Pe(e){return"children"in e?Pe(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function et(e,t){let n=j(e),r=l.useRef([]),u=Re(),a=qe(),o=P((b,g=Z.Hidden)=>{let m=r.current.findIndex(({el:v})=>v===b);m!==-1&&(I(g,{[Z.Unmount](){r.current.splice(m,1)},[Z.Hidden](){r.current[m].state="hidden"}}),a.microTask(()=>{var v;!Pe(r)&&u.current&&((v=n.current)==null||v.call(n))}))}),c=P(b=>{let g=r.current.find(({el:m})=>m===b);return g?g.state!=="visible"&&(g.state="visible"):r.current.push({el:b,state:"visible"}),()=>o(b,Z.Unmount)}),i=l.useRef([]),p=l.useRef(Promise.resolve()),s=l.useRef({enter:[],leave:[],idle:[]}),d=P((b,g,m)=>{i.current.splice(0),t&&(t.chains.current[g]=t.chains.current[g].filter(([v])=>v!==b)),t==null||t.chains.current[g].push([b,new Promise(v=>{i.current.push(v)})]),t==null||t.chains.current[g].push([b,new Promise(v=>{Promise.all(s.current[g].map(([S,x])=>x)).then(()=>v())})]),g==="enter"?p.current=p.current.then(()=>t==null?void 0:t.wait.current).then(()=>m(g)):m(g)}),f=P((b,g,m)=>{Promise.all(s.current[g].splice(0).map(([v,S])=>S)).then(()=>{var v;(v=i.current.shift())==null||v()}).then(()=>m(g))});return l.useMemo(()=>({children:r,register:c,unregister:o,onStart:d,onStop:f,wait:p,chains:s}),[c,o,r,d,f,s,p])}function mn(){}let hn=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function _e(e){var t;let n={};for(let r of hn)n[r]=(t=e[r])!=null?t:mn;return n}function gn(e){let t=l.useRef(_e(e));return l.useEffect(()=>{t.current=_e(e)},[e]),t}let bn="div",tt=re.RenderStrategy;function En(e,t){var n,r;let{beforeEnter:u,afterEnter:a,beforeLeave:o,afterLeave:c,enter:i,enterFrom:p,enterTo:s,entered:d,leave:f,leaveFrom:b,leaveTo:g,...m}=e,v=l.useRef(null),S=U(v,t),x=(n=m.unmount)==null||n?Z.Unmount:Z.Hidden,{show:T,appear:R,initial:A}=pn(),[C,D]=l.useState(T?"visible":"hidden"),$=vn(),{register:N,unregister:F}=$;l.useEffect(()=>N(v),[N,v]),l.useEffect(()=>{if(x===Z.Hidden&&v.current){if(T&&C!=="visible"){D("visible");return}return I(C,{hidden:()=>F(v),visible:()=>N(v)})}},[C,v,N,F,T,x]);let h=j({base:Q(m.className),enter:Q(i),enterFrom:Q(p),enterTo:Q(s),entered:Q(d),leave:Q(f),leaveFrom:Q(b),leaveTo:Q(g)}),w=gn({beforeEnter:u,afterEnter:a,beforeLeave:o,afterLeave:c}),O=ve();l.useEffect(()=>{if(O&&C==="visible"&&v.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[v,C,O]);let M=A&&!R,z=R&&T&&A,y=!O||M?"idle":T?"enter":"leave",L=un(0),te=P(Y=>I(Y,{enter:()=>{L.addFlag(k.Opening),w.current.beforeEnter()},leave:()=>{L.addFlag(k.Closing),w.current.beforeLeave()},idle:()=>{}})),ee=P(Y=>I(Y,{enter:()=>{L.removeFlag(k.Opening),w.current.afterEnter()},leave:()=>{L.removeFlag(k.Closing),w.current.afterLeave()},idle:()=>{}})),G=et(()=>{D("hidden"),F(v)},$),ae=l.useRef(!1);dn({immediate:z,container:v,classes:h,direction:y,onStart:j(Y=>{ae.current=!0,G.onStart(v,Y,te)}),onStop:j(Y=>{ae.current=!1,G.onStop(v,Y,ee),Y==="leave"&&!Pe(G)&&(D("hidden"),F(v))})});let H=m,rt={ref:S};return z?H={...H,className:pe(m.className,...h.current.enter,...h.current.enterFrom)}:ae.current&&(H.className=pe(m.className,(r=v.current)==null?void 0:r.className),H.className===""&&delete H.className),E.createElement(ye.Provider,{value:G},E.createElement(ze,{value:I(C,{visible:k.Open,hidden:k.Closed})|L.flags},q({ourProps:rt,theirProps:H,defaultTag:bn,features:tt,visible:C==="visible",name:"Transition.Child"})))}function yn(e,t){let{show:n,appear:r=!1,unmount:u=!0,...a}=e,o=l.useRef(null),c=U(o,t);ve();let i=he();if(n===void 0&&i!==null&&(n=(i&k.Open)===k.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[p,s]=l.useState(n?"visible":"hidden"),d=et(()=>{s("hidden")}),[f,b]=l.useState(!0),g=l.useRef([n]);B(()=>{f!==!1&&g.current[g.current.length-1]!==n&&(g.current.push(n),b(!1))},[g,n]);let m=l.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);l.useEffect(()=>{if(n)s("visible");else if(!Pe(d))s("hidden");else{let T=o.current;if(!T)return;let R=T.getBoundingClientRect();R.x===0&&R.y===0&&R.width===0&&R.height===0&&s("hidden")}},[n,d]);let v={unmount:u},S=P(()=>{var T;f&&b(!1),(T=e.beforeEnter)==null||T.call(e)}),x=P(()=>{var T;f&&b(!1),(T=e.beforeLeave)==null||T.call(e)});return E.createElement(ye.Provider,{value:d},E.createElement(Ee.Provider,{value:m},q({ourProps:{...v,as:l.Fragment,children:E.createElement(nt,{ref:c,...v,...a,beforeEnter:S,beforeLeave:x})},theirProps:{},defaultTag:l.Fragment,features:tt,visible:p==="visible",name:"Transition"})))}function Pn(e,t){let n=l.useContext(Ee)!==null,r=he()!==null;return E.createElement(E.Fragment,null,!n&&r?E.createElement(Ne,{ref:t,...e}):E.createElement(nt,{ref:t,...e}))}let Ne=_(yn),nt=_(En),Sn=_(Pn),In=Object.assign(Ne,{Child:Sn,Root:Ne});export{Ye as A,On as B,q as C,In as D,$t as E,Be as F,me as G,ze as H,ne as I,Oe as J,Ce as K,Fn as L,K as M,fe as N,J as O,vt as P,un as Q,j as R,Ve as S,Et as T,_ as U,yt as V,xn as _,Qe as a,ie as b,oe as c,Ft as d,dt as e,Re as f,mt as g,le as h,B as i,he as j,k,ve as l,Mt as m,ue as n,P as o,qe as p,At as q,bt as r,V as s,Ue as t,I as u,Nn as v,Cn as w,re as x,U as y,X as z};
|
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 d,n as p,m as x}from"./index-L7UJWCGi.js";import{P as j}from"./Page-D0nUv5ck.js";import{u as h}from"./project-BlT_dmGo.js";import{S as v}from"./SourceList-Diwt0dWW.js";import{S as y}from"./SourceListItem-CjW93oYe.js";import"./SplitPane-B-vlCkrS.js";import"./file-DYgUpg8u.js";import"./Input-A6Hrwz1k.js";import"./index-D-9edHVb.js";function g(){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(d,{size:x.sm,variant:p.Neutral,children:"Run All"})})]}),content:s.jsx(f,{})})}export{g as default};
|
|
@@ -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-L7UJWCGi.js";import{D as u}from"./ReportErrors-D88IZz3n.js";import"./PlusCircleIcon-C2xHHnL-.js";import"./transition-nHCHMLQ-.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./SplitPane-B-vlCkrS.js";function j(){const{errors:i}=a(),{id:s}=l(),o=e(s)?void 0:Array.from(i).find(t=>t.id===s);return r.jsx("div",{className:"flex overflow-auto w-full h-full",children:e(o)?r.jsx(n,{link:d.Errors,description:e(s)?void 0:`Error ${s} 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:o,scope:o.key,withSplitPane:!0})})})})}export{j as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as x,a as m,w as h,Q as o,a5 as c,a6 as D,a7 as T,r as b,j as u}from"./index-L7UJWCGi.js";import{g,T as E}from"./help-CNdZX-7b.js";import{u as r}from"./editor-DmJY3IbC.js";import"./index-D-9edHVb.js";import"./Input-A6Hrwz1k.js";import"./file-DYgUpg8u.js";const d=24*60*60*1e3;function Q(){const{modelName:a}=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(a)||a===(s==null?void 0:s.name)?s:p.get(encodeURI(a)),l={model:t.displayName,start:o(c(Date.now()-d)),end:o(new Date),execution_time:o(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{Q 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,al as qe,am as at,d as Ye,t as ot,e as it,s as ct,G as $,F as dt,a8 as ut,_ as ft,an as mt}from"./index-L7UJWCGi.js";import{u as ee,M as xt}from"./project-BlT_dmGo.js";import{S as We}from"./SplitPane-B-vlCkrS.js";import{E as J,M as ht}from"./file-DYgUpg8u.js";import{u as N}from"./editor-DmJY3IbC.js";import{I as T}from"./Input-A6Hrwz1k.js";import{F as pt,L as gt}from"./ListboxShow-nvacUoI1.js";import{B as Be}from"./Banner-OvD39mOq.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-nHCHMLQ-.js";import{g as Fe,G as yt,F as Tt,T as Et}from"./help-CNdZX-7b.js";import{M as Pt,u as Xe,a as Re,b as St,c as Ct,C as kt}from"./context-CA-MXfZ6.js";import{A as Se,F as It,a as Rt}from"./PlusCircleIcon-C2xHHnL-.js";import{D as Dt}from"./ReportErrors-D88IZz3n.js";import"./index-D-9edHVb.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./help-6Q7f7fjd.js";import"./SourceList-Diwt0dWW.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-B6geDuI6.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-L7UJWCGi.js";import{P as I}from"./Page-D0nUv5ck.js";import{S as z}from"./SourceList-Diwt0dWW.js";import{S as C}from"./SourceListItem-CjW93oYe.js";import"./SplitPane-B-vlCkrS.js";import"./Input-A6Hrwz1k.js";import"./index-D-9edHVb.js";function $(){const{pathname:c}=j(),a=v(),{errors:o,removeError:u,clearErrors:f}=y(),t=l.useMemo(()=>Array.from(o).reverse(),[o]);l.useEffect(()=>{var e;if(N(t))setTimeout(()=>a(i.Home));else{const s=(e=t[0])==null?void 0:e.id;g(s)?a(i.Errors,{replace:!0}):a(i.Errors+"/"+s,{replace:!0})}},[t]);function d(e){const s=t.find(n=>n.id===e);A(s)&&u(s)}return r.jsx(I,{sidebar:r.jsxs("div",{className:"flex flex-col h-full w-full",children:[r.jsx(z,{keyId:"id",keyName:"key",keyDescription:"message",to:i.Errors,items:t,isActive:e=>`${i.Errors}/${e}`===c,types:t.reduce((e,s)=>Object.assign(e,{[s.id]:s.status}),{}),listItem:({id:e,to:s,name:n,description:p,text:x,disabled:E=!1})=>r.jsx(C,{to:s,name:n,text:x,description:p,variant:m.Danger,disabled:E,handleDelete:()=>d(e)})}),r.jsx(k,{}),o.size>0&&r.jsx("div",{className:"flex justify-end",children:r.jsx(D,{size:S.sm,variant:m.Neutral,onClick:()=>f(),children:"Clear All"})})]}),content:r.jsx(h,{})})}export{$ as default};
|