sqlmesh 0.202.2.dev7__py3-none-any.whl → 0.202.2.dev9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. sqlmesh/_version.py +2 -2
  2. {sqlmesh-0.202.2.dev7.dist-info → sqlmesh-0.202.2.dev9.dist-info}/METADATA +1 -1
  3. {sqlmesh-0.202.2.dev7.dist-info → sqlmesh-0.202.2.dev9.dist-info}/RECORD +51 -51
  4. web/client/dist/assets/{Audits-BuHAmFO8.js → Audits-Jm353fhk.js} +1 -1
  5. web/client/dist/assets/{Banner-DFFgSp7_.js → Banner-DzWLWxS2.js} +1 -1
  6. web/client/dist/assets/{ChevronDownIcon-DtTgO9XQ.js → ChevronDownIcon-DND34_0j.js} +1 -1
  7. web/client/dist/assets/{ChevronRightIcon-UI3RytmK.js → ChevronRightIcon-BrnG7zJd.js} +1 -1
  8. web/client/dist/assets/{Content-aUn7pk46.js → Content-BaMgXJRh.js} +1 -1
  9. web/client/dist/assets/{Content-CpNCWToC.js → Content-DphTMPPH.js} +1 -1
  10. web/client/dist/assets/Data-MJRTjiHp.js +1 -0
  11. web/client/dist/assets/{DataCatalog-BTH7PLMa.js → DataCatalog-DnhHmqO9.js} +1 -1
  12. web/client/dist/assets/Editor-Bsp2nRii.js +1 -0
  13. web/client/dist/assets/{Editor-biLDBbAA.js → Editor-CD1DYOmd.js} +1 -1
  14. web/client/dist/assets/{Errors-CH0KFwsR.js → Errors-CwLLcKXv.js} +1 -1
  15. web/client/dist/assets/{FileExplorer-DajbVeH5.js → FileExplorer-CjiHTJqb.js} +1 -1
  16. web/client/dist/assets/{Footer-1kutyViJ.js → Footer-BeDVe5W7.js} +1 -1
  17. web/client/dist/assets/{Header-BeNTIlzT.js → Header-dh7a7qX-.js} +1 -1
  18. web/client/dist/assets/{Input-BGdTmRPV.js → Input-B-Ounlv_.js} +1 -1
  19. web/client/dist/assets/Lineage-DDBcnPQX.js +1 -0
  20. web/client/dist/assets/ListboxShow-CV2BuG5q.js +1 -0
  21. web/client/dist/assets/{ModelLineage-BVQJptIB.js → ModelLineage-B1JusHLp.js} +1 -1
  22. web/client/dist/assets/{Models-B5TYaoIH.js → Models-BILTGfK2.js} +1 -1
  23. web/client/dist/assets/{Page-D_es10yq.js → Page-SvStklIG.js} +1 -1
  24. web/client/dist/assets/{Plan-D4VG3U-s.js → Plan-BHC6Jsvb.js} +1 -1
  25. web/client/dist/assets/{PlusCircleIcon-M3NGeHST.js → PlusCircleIcon-BWbZTVU_.js} +1 -1
  26. web/client/dist/assets/{ReportErrors-CaaGo6UD.js → ReportErrors-h8_M9bTF.js} +1 -1
  27. web/client/dist/assets/{Root-DcJxWwG4.js → Root-yarU-KP7.js} +1 -1
  28. web/client/dist/assets/{SearchList-vj2s_Pnb.js → SearchList-BLcpQVJH.js} +1 -1
  29. web/client/dist/assets/{SelectEnvironment-GfN4mjDu.js → SelectEnvironment-BcN1dphw.js} +1 -1
  30. web/client/dist/assets/{SourceList-BioJ2XB9.js → SourceList-Kt2aCd0O.js} +1 -1
  31. web/client/dist/assets/{SourceListItem-DhUDAM6G.js → SourceListItem-B7x_VFKR.js} +1 -1
  32. web/client/dist/assets/{SplitPane-CqYEXonR.js → SplitPane-BH6IQnVH.js} +1 -1
  33. web/client/dist/assets/{Tests-D0MOEJwQ.js → Tests-ClEdNkg6.js} +1 -1
  34. web/client/dist/assets/{Welcome-ALXxKTT6.js → Welcome-D2UIox3v.js} +1 -1
  35. web/client/dist/assets/{context-C6O7H5eL.js → context-DieJUDVl.js} +17 -17
  36. web/client/dist/assets/{context-DUS5wzfN.js → context-DykI9LSF.js} +1 -1
  37. web/client/dist/assets/{editor-DQqZC36D.js → editor-DNt3hEcu.js} +1 -1
  38. web/client/dist/assets/{file-gUDWL5Z6.js → file-y5ZNtlGh.js} +1 -1
  39. web/client/dist/assets/{floating-ui.react-dom-9Mo3XjFw.js → floating-ui.react-dom-BX3awo09.js} +1 -1
  40. web/client/dist/assets/help-B59vE3aE.js +1 -0
  41. web/client/dist/assets/{help-CfEW8yRZ.js → help-DeXhqTBT.js} +1 -1
  42. web/client/dist/assets/index-DXRmsAbz.js +58 -0
  43. web/client/dist/assets/{index-Ditw2lX8.js → index-DyOMAzII.js} +1 -1
  44. web/client/dist/assets/{plan-BC79Qq7e.js → plan-B4z00b85.js} +1 -1
  45. web/client/dist/assets/popover-B6Q1laIx.js +13 -0
  46. web/client/dist/assets/{project-YuVl6ae5.js → project-BraqCC5X.js} +1 -1
  47. web/client/dist/index.html +1 -1
  48. web/client/dist/assets/Data-CZDVrGG4.js +0 -1
  49. web/client/dist/assets/Editor-aTj13TCY.js +0 -1
  50. web/client/dist/assets/Lineage-C7Aqseca.js +0 -1
  51. web/client/dist/assets/ListboxShow-BRUdoaSL.js +0 -1
  52. web/client/dist/assets/help-6Q7f7fjd.js +0 -1
  53. web/client/dist/assets/index-DH1v9iOD.js +0 -58
  54. web/client/dist/assets/popover-BS2D7N_A.js +0 -13
  55. {sqlmesh-0.202.2.dev7.dist-info → sqlmesh-0.202.2.dev9.dist-info}/WHEEL +0 -0
  56. {sqlmesh-0.202.2.dev7.dist-info → sqlmesh-0.202.2.dev9.dist-info}/entry_points.txt +0 -0
  57. {sqlmesh-0.202.2.dev7.dist-info → sqlmesh-0.202.2.dev9.dist-info}/licenses/LICENSE +0 -0
  58. {sqlmesh-0.202.2.dev7.dist-info → sqlmesh-0.202.2.dev9.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
- import{r as w}from"./index-DH1v9iOD.js";import{r as I}from"./floating-ui.react-dom-9Mo3XjFw.js";function v(r,l,e){let s=e.initialDeps??[],t;function n(){var i,o,h,c;let a;e.key&&((i=e.debug)!=null&&i.call(e))&&(a=Date.now());const u=r();if(!(u.length!==s.length||u.some((f,g)=>s[g]!==f)))return t;s=u;let m;if(e.key&&((o=e.debug)!=null&&o.call(e))&&(m=Date.now()),t=l(...u),e.key&&((h=e.debug)!=null&&h.call(e))){const f=Math.round((Date.now()-a)*100)/100,g=Math.round((Date.now()-m)*100)/100,x=g/16,b=(p,C)=>{for(p=String(p);p.length<C;)p=" "+p;return p};console.info(`%c⏱ ${b(g,5)} /${b(f,5)} ms`,`
1
+ import{r as w}from"./index-DXRmsAbz.js";import{r as I}from"./floating-ui.react-dom-BX3awo09.js";function v(r,l,e){let s=e.initialDeps??[],t;function n(){var i,o,h,c;let a;e.key&&((i=e.debug)!=null&&i.call(e))&&(a=Date.now());const u=r();if(!(u.length!==s.length||u.some((f,g)=>s[g]!==f)))return t;s=u;let m;if(e.key&&((o=e.debug)!=null&&o.call(e))&&(m=Date.now()),t=l(...u),e.key&&((h=e.debug)!=null&&h.call(e))){const f=Math.round((Date.now()-a)*100)/100,g=Math.round((Date.now()-m)*100)/100,x=g/16,b=(p,C)=>{for(p=String(p);p.length<C;)p=" "+p;return p};console.info(`%c⏱ ${b(g,5)} /${b(f,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*x,120))}deg 100% 31%);`,e==null?void 0:e.key)}return(c=e==null?void 0:e.onChange)==null||c.call(e,t),t}return n.updateDeps=i=>{s=i},n}function S(r,l){if(r===void 0)throw new Error("Unexpected undefined");return r}const R=(r,l)=>Math.abs(r-l)<1.01,_=(r,l,e)=>{let s;return function(...t){r.clearTimeout(s),s=r.setTimeout(()=>l.apply(this,t),e)}},y=r=>{const{offsetWidth:l,offsetHeight:e}=r;return{width:l,height:e}},F=r=>r,A=r=>{const l=Math.max(r.startIndex-r.overscan,0),e=Math.min(r.endIndex+r.overscan,r.count-1),s=[];for(let t=l;t<=e;t++)s.push(t);return s},T=(r,l)=>{const e=r.scrollElement;if(!e)return;const s=r.targetWindow;if(!s)return;const t=i=>{const{width:o,height:h}=i;l({width:Math.round(o),height:Math.round(h)})};if(t(y(e)),!s.ResizeObserver)return()=>{};const n=new s.ResizeObserver(i=>{const o=()=>{const h=i[0];if(h!=null&&h.borderBoxSize){const c=h.borderBoxSize[0];if(c){t({width:c.inlineSize,height:c.blockSize});return}}t(y(e))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return n.observe(e,{box:"border-box"}),()=>{n.unobserve(e)}},M={passive:!0},E=typeof window>"u"?!0:"onscrollend"in window,k=(r,l)=>{const e=r.scrollElement;if(!e)return;const s=r.targetWindow;if(!s)return;let t=0;const n=r.options.useScrollendEvent&&E?()=>{}:_(s,()=>{l(t,!1)},r.options.isScrollingResetDelay),i=a=>()=>{const{horizontal:u,isRtl:d}=r.options;t=u?e.scrollLeft*(d&&-1||1):e.scrollTop,n(),l(t,a)},o=i(!0),h=i(!1);h(),e.addEventListener("scroll",o,M);const c=r.options.useScrollendEvent&&E;return c&&e.addEventListener("scrollend",h,M),()=>{e.removeEventListener("scroll",o),c&&e.removeEventListener("scrollend",h)}},D=(r,l,e)=>{if(l!=null&&l.borderBoxSize){const s=l.borderBoxSize[0];if(s)return Math.round(s[e.options.horizontal?"inlineSize":"blockSize"])}return r[e.options.horizontal?"offsetWidth":"offsetHeight"]},W=(r,{adjustments:l=0,behavior:e},s)=>{var t,n;const i=r+l;(n=(t=s.scrollElement)==null?void 0:t.scrollTo)==null||n.call(t,{[s.options.horizontal?"left":"top"]:i,behavior:e})};class j{constructor(l){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const s=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(t=>{t.forEach(n=>{const i=()=>{this._measureElement(n.target,n)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var t;(t=s())==null||t.disconnect(),e=null},observe:t=>{var n;return(n=s())==null?void 0:n.observe(t,{box:"border-box"})},unobserve:t=>{var n;return(n=s())==null?void 0:n.unobserve(t)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([s,t])=>{typeof t>"u"&&delete e[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:F,rangeExtractor:A,onChange:()=>{},measureElement:D,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var s,t;(t=(s=this.options).onChange)==null||t.call(s,this,e)},this.maybeNotify=v(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(t=>{this.observer.observe(t)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,t=>{this.scrollRect=t,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(t,n)=>{this.scrollAdjustments=0,this.scrollDirection=n?this.getScrollOffset()<t?"forward":"backward":null,this.scrollOffset=t,this.isScrolling=n,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,s)=>{const t=new Map,n=new Map;for(let i=s-1;i>=0;i--){const o=e[i];if(t.has(o.lane))continue;const h=n.get(o.lane);if(h==null||o.end>h.end?n.set(o.lane,o):o.end<h.end&&t.set(o.lane,!0),t.size===this.options.lanes)break}return n.size===this.options.lanes?Array.from(n.values()).sort((i,o)=>i.end===o.end?i.index-o.index:i.end-o.end)[0]:void 0},this.getMeasurementOptions=v(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(e,s,t,n,i)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:s,scrollMargin:t,getItemKey:n,enabled:i}),{key:!1}),this.getMeasurements=v(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:s,scrollMargin:t,getItemKey:n,enabled:i},o)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(a=>{this.itemSizeCache.set(a.key,a.size)}));const h=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const c=this.measurementsCache.slice(0,h);for(let a=h;a<e;a++){const u=n(a),d=this.options.lanes===1?c[a-1]:this.getFurthestMeasurement(c,a),m=d?d.end+this.options.gap:s+t,f=o.get(u),g=typeof f=="number"?f:this.options.estimateSize(a),x=m+g,b=d?d.lane:a%this.options.lanes;c[a]={index:a,start:m,size:g,end:x,key:u,lane:b}}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=v(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,s,t,n)=>this.range=e.length>0&&s>0?L({measurements:e,outerSize:s,scrollOffset:t,lanes:n}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=v(()=>{let e=null,s=null;const t=this.calculateRange();return t&&(e=t.startIndex,s=t.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,s]},(e,s,t,n,i)=>n===null||i===null?[]:e({startIndex:n,endIndex:i,overscan:s,count:t}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const s=this.options.indexAttribute,t=e.getAttribute(s);return t?parseInt(t,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(e,s)=>{const t=this.indexFromElement(e),n=this.measurementsCache[t];if(!n)return;const i=n.key,o=this.elementsCache.get(i);o!==e&&(o&&this.observer.unobserve(o),this.observer.observe(e),this.elementsCache.set(i,e)),e.isConnected&&this.resizeItem(t,this.options.measureElement(e,s,this))},this.resizeItem=(e,s)=>{const t=this.measurementsCache[e];if(!t)return;const n=this.itemSizeCache.get(t.key)??t.size,i=s-n;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(t,i,this):t.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(t.index),this.itemSizeCache=new Map(this.itemSizeCache.set(t.key,s)),this.notify(!1))},this.measureElement=e=>{if(!e){this.elementsCache.forEach((s,t)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(t))});return}this._measureElement(e,void 0)},this.getVirtualItems=v(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,s)=>{const t=[];for(let n=0,i=e.length;n<i;n++){const o=e[n],h=s[o];t.push(h)}return t},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const s=this.getMeasurements();if(s.length!==0)return S(s[O(0,s.length-1,t=>S(s[t]).start,e)])},this.getOffsetForAlignment=(e,s,t=0)=>{const n=this.getSize(),i=this.getScrollOffset();s==="auto"&&(s=e>=i+n?"end":"start"),s==="center"?e+=(t-n)/2:s==="end"&&(e-=n);const o=this.getTotalSize()+this.options.scrollMargin-n;return Math.max(Math.min(o,e),0)},this.getOffsetForIndex=(e,s="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const t=this.measurementsCache[e];if(!t)return;const n=this.getSize(),i=this.getScrollOffset();if(s==="auto")if(t.end>=i+n-this.options.scrollPaddingEnd)s="end";else if(t.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];const o=s==="end"?t.end+this.options.scrollPaddingEnd:t.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,s,t.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:s="start",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,s),{adjustments:void 0,behavior:t})},this.scrollToIndex=(e,{align:s="auto",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let n=0;const i=10,o=c=>{if(!this.targetWindow)return;const a=this.getOffsetForIndex(e,c);if(!a){console.warn("Failed to get offset for index:",e);return}const[u,d]=a;this._scrollToOffset(u,{adjustments:void 0,behavior:t}),this.targetWindow.requestAnimationFrame(()=>{const m=this.getScrollOffset(),f=this.getOffsetForIndex(e,d);if(!f){console.warn("Failed to get offset for index:",e);return}R(f[0],m)||h(d)})},h=c=>{this.targetWindow&&(n++,n<i?this.targetWindow.requestAnimationFrame(()=>o(c)):console.warn(`Failed to scroll to index ${e} after ${i} attempts.`))};o(s)},this.scrollBy=(e,{behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var e;const s=this.getMeasurements();let t;if(s.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=((e=s[s.length-1])==null?void 0:e.end)??0;else{const n=Array(this.options.lanes).fill(null);let i=s.length-1;for(;i>=0&&n.some(o=>o===null);){const o=s[i];n[o.lane]===null&&(n[o.lane]=o.end),i--}t=Math.max(...n.filter(o=>o!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:s,behavior:t})=>{this.options.scrollToFn(e,{behavior:t,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(l)}}const O=(r,l,e,s)=>{for(;r<=l;){const t=(r+l)/2|0,n=e(t);if(n<s)r=t+1;else if(n>s)l=t-1;else return t}return r>0?r-1:0};function L({measurements:r,outerSize:l,scrollOffset:e,lanes:s}){const t=r.length-1,n=h=>r[h].start;if(r.length<=s)return{startIndex:0,endIndex:t};let i=O(0,t,n,e),o=i;if(s===1)for(;o<t&&r[o].end<e+l;)o++;else if(s>1){const h=Array(s).fill(0);for(;o<t&&h.some(a=>a<e+l);){const a=r[o];h[a.lane]=a.end,o++}const c=Array(s).fill(e+l);for(;i>=0&&c.some(a=>a>=e);){const a=r[i];c[a.lane]=a.start,i--}i=Math.max(0,i-i%s),o=Math.min(t,o+(s-1-o%s))}return{startIndex:i,endIndex:o}}const z=typeof document<"u"?w.useLayoutEffect:w.useEffect;function P(r){const l=w.useReducer(()=>({}),{})[1],e={...r,onChange:(t,n)=>{var i;n?I.flushSync(l):l(),(i=r.onChange)==null||i.call(r,t,n)}},[s]=w.useState(()=>new j(e));return s.setOptions(e),z(()=>s._didMount(),[]),z(()=>s._willUpdate()),s}function N(r){return P({observeElementRect:T,observeElementOffset:k,scrollToFn:W,...r})}export{N as u};
@@ -1 +1 @@
1
- var N=Object.defineProperty;var I=(u,r,t)=>r in u?N(u,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[r]=t;var a=(u,r,t)=>I(u,typeof r!="symbol"?r+"":r,t);import{$ as F,q as x,b as f,v as l,f as R,A as w,C as v,i as p,g as V,a0 as D}from"./index-DH1v9iOD.js";const s={Done:"done",Run:"run",Running:"running",RunningTask:"running-task",ApplyVirtual:"apply-virtual",ApplyBackfill:"apply-backfill",ApplyChangesAndBackfill:"apply-changes-and-backfill",ApplyMetadata:"apply-metadata",Applying:"applying",Cancelling:"cancelling"};class O extends F{constructor(t){super(t!=null&&t.isModel?t.initial:{...t,value:(t==null?void 0:t.value)??s.Run});a(this,"_value");this._value=(t==null?void 0:t.value)??this.initial.value}get value(){return this._value}get isRun(){return this.value===s.Run}get isDone(){return this.value===s.Done}get isApplyVirtual(){return this.value===s.ApplyVirtual}get isApplyBackfill(){return this.value===s.ApplyBackfill}get isApplyChangesAndBackfill(){return this.value===s.ApplyChangesAndBackfill}get isApplyMetadata(){return this.value===s.ApplyMetadata}get isApply(){return this.isApplyVirtual||this.isApplyBackfill||this.isApplyChangesAndBackfill||this.isApplyMetadata}get isCancelling(){return this.value===s.Cancelling}get isApplying(){return this.value===s.Applying}get isRunning(){return x([s.Running,s.RunningTask],this.value)}get isRunningTask(){return this.value===s.RunningTask}get isProcessing(){return this.isRunning||this.isApplying||this.isCancelling}get isIdle(){return f(this.isProcessing)}displayStatus(t){return this.isCancelling?"Cancelling Plan...":this.isApplying?"Applying Plan...":this.isRunning&&l(t.hasChanges)?"Getting Changes...":this.isRunning&&l(t.hasBackfills)?"Getting Backfills...":this.isRunning?"Checking Plan...":this.isRunningTask?"Running Task...":"Plan"}static getActionDisplayName(t,e=[],i="Plan"){if(!e.includes(t.value))return i;let n;switch(t.value){case s.Done:n="Done";break;case s.Running:n="Running...";break;case s.RunningTask:n="Running Task...";break;case s.Applying:n="Applying...";break;case s.Cancelling:n="Cancelling...";break;case s.Run:n="Plan";break;case s.ApplyChangesAndBackfill:n="Apply Changes And Backfill";break;case s.ApplyVirtual:n="Apply Virtual Update";break;case s.ApplyBackfill:n="Apply And Backfill";break;case s.ApplyMetadata:n="Apply Metadata";break;default:n=i;break}return n}static getPlanAction({planOverview:t,planApply:e,planCancel:i}){const n=t.isRunning,c=e.isRunning,h=i.isRunning,d=e.isFinished&&t.isFinished||i.isFinished;return i.isEmpty&&e.isEmpty&&t.isEmpty?s.Run:h?s.Cancelling:c?s.Applying:n?s.Running:d?s.Done:t.isVirtualUpdate?s.ApplyVirtual:t.isMetadataUpdate?s.ApplyMetadata:t.isBackfillUpdate?s.ApplyBackfill:t.isChangesAndBackfillUpdate?s.ApplyChangesAndBackfill:s.Done}}class U extends F{constructor(t){super(t==null?void 0:t.initial);a(this,"_current");a(this,"_isFetching",!1);this._current=t==null?void 0:t._current,this._isFetching=(t==null?void 0:t._isFetching)??!1}get current(){return this._current}get environment(){var t;return(t=this.current)==null?void 0:t.environment}get meta(){var t;return(t=this.current)==null?void 0:t.meta}get plan_options(){var t;return(t=this.current)==null?void 0:t.plan_options}get start(){var t;return(t=this.current)==null?void 0:t.start}get end(){var t;return(t=this.current)==null?void 0:t.end}get duration(){var t;return((t=this==null?void 0:this.meta)==null?void 0:t.duration)??-1}get isFinished(){var t,e,i,n;return R((e=(t=this.current)==null?void 0:t.meta)==null?void 0:e.done)&&((n=(i=this.current)==null?void 0:i.meta)==null?void 0:n.status)!==w.init&&f(this.isFetching)}get isRunning(){var t,e,i,n;return v((e=(t=this.current)==null?void 0:t.meta)==null?void 0:e.done)&&((n=(i=this.current)==null?void 0:i.meta)==null?void 0:n.status)===w.init||this.isFetching}get isSuccessful(){var t,e;return this.isFinished&&((e=(t=this.current)==null?void 0:t.meta)==null?void 0:e.status)===w.success}get isFailed(){var t,e,i;return this.isFinished&&(l((t=this.current)==null?void 0:t.meta)||((i=(e=this.current)==null?void 0:e.meta)==null?void 0:i.status)===w.fail)}get isEmpty(){return l(this.current)}get isFetching(){return this._isFetching}set isFetching(t){this._isFetching=t}reset(){this._current=void 0}}class o extends F{constructor(t){var e,i;super(t);a(this,"name");a(this,"view_name");a(this,"node_type");a(this,"change_category");a(this,"diff");a(this,"indirect");a(this,"batches");a(this,"direct");a(this,"completed");a(this,"end");a(this,"interval");a(this,"start");a(this,"total");this.name=encodeURI(this.initial.name),this.view_name=encodeURI(this.initial.view_name),this.node_type=this.initial.node_type,this.change_category=this.initial.change_category,this.diff=this.initial.diff,this.batches=this.initial.batches,this.interval=this.initial.interval,this.start=this.initial.start,this.total=this.initial.total,this.completed=this.initial.completed,this.end=this.initial.end,this.indirect=(e=this.initial.indirect)==null?void 0:e.map(n=>new o(n)),this.direct=(i=this.initial.direct)==null?void 0:i.map(n=>new o(n))}get nodeType(){return this.node_type}get viewName(){return this.view_name}get displayName(){return decodeURI(this.name)}get displayViewName(){return decodeURI(this.view_name)}get changeCategory(){return this.change_category}}class k extends U{constructor(t){super(t);a(this,"_last");a(this,"_planOverview");a(this,"_lastPlanOverview");p(t)&&t.isModel&&(this._current=t._current,this._last=t._last,this._planOverview=t._planOverview,this._lastPlanOverview=t._lastPlanOverview)}get current(){return this._current??this._last}get environment(){var t,e;return((t=this._last)==null?void 0:t.environment)??((e=this._current)==null?void 0:e.environment)}get meta(){var t,e;return((t=this._last)==null?void 0:t.meta)??((e=this._current)==null?void 0:e.meta)}get plan_options(){var t,e;return((t=this._last)==null?void 0:t.plan_options)??((e=this._current)==null?void 0:e.plan_options)}get start(){var t,e;return((t=this._last)==null?void 0:t.start)??((e=this._current)==null?void 0:e.start)}get end(){var t,e;return((t=this._last)==null?void 0:t.end)??((e=this._current)==null?void 0:e.end)}get overview(){return this._lastPlanOverview??this._planOverview}get backfills(){var t;return((t=this.overview)==null?void 0:t.backfills)??[]}get added(){var t;return((t=this.overview)==null?void 0:t.added)??[]}get removed(){var t;return((t=this.overview)==null?void 0:t.removed)??[]}get direct(){var t;return((t=this.overview)==null?void 0:t.direct)??[]}get indirect(){var t;return((t=this.overview)==null?void 0:t.indirect)??[]}get metadata(){var t;return((t=this.overview)==null?void 0:t.metadata)??[]}get tasks(){var e,i,n,c;const t=((i=(e=this._last)==null?void 0:e.backfill)==null?void 0:i.tasks)??((c=(n=this._current)==null?void 0:n.backfill)==null?void 0:c.tasks)??{};return Object.entries(t??{}).reduce((h,[d,_])=>(h[encodeURI(d)]=new o(_),h),{})}get queue(){var t,e;return((e=(t=this.stageBackfill)==null?void 0:t.queue)==null?void 0:e.map(i=>this.tasks[encodeURI(i)]).filter(Boolean))??[]}get stageValidation(){var t;return(t=this.overview)==null?void 0:t.stageValidation}get stageChanges(){var t;return(t=this.overview)==null?void 0:t.stageChanges}get stageBackfills(){var t;return(t=this.overview)==null?void 0:t.stageBackfills}get stageCreation(){var t,e;return((t=this._last)==null?void 0:t.creation)??((e=this._current)==null?void 0:e.creation)}get stageRestate(){var t,e;return((t=this._last)==null?void 0:t.restate)??((e=this._current)==null?void 0:e.restate)}get stageBackfill(){var t,e;return((t=this._last)==null?void 0:t.backfill)??((e=this._current)==null?void 0:e.backfill)}get stagePromote(){var t,e;return((t=this._last)==null?void 0:t.promote)??((e=this._current)==null?void 0:e.promote)}get shouldShowEvaluation(){return this.isFailed||p(this.stageCreation)||p(this.stageBackfill)||p(this.stagePromote)}get evaluationStart(){var t,e,i,n,c,h;return((e=(t=this.stageCreation)==null?void 0:t.meta)==null?void 0:e.start)??((n=(i=this.stageBackfill)==null?void 0:i.meta)==null?void 0:n.start)??((h=(c=this.stagePromote)==null?void 0:c.meta)==null?void 0:h.start)}get evaluationEnd(){var t,e,i,n,c,h;return((e=(t=this.stagePromote)==null?void 0:t.meta)==null?void 0:e.end)??((n=(i=this.stageBackfill)==null?void 0:i.meta)==null?void 0:n.end)??((h=(c=this.stageCreation)==null?void 0:c.meta)==null?void 0:h.end)}update(t,e){var m,y,A,g,M,T,E;const{creation:i,restate:n,backfill:c,promote:h,meta:d,environment:_}=t,B=l(d)||l(_)?void 0:t;if(l(B)){this._current=void 0;return}l(this._current)&&(this._current=t),this._current.start=t.start,this._current.end=t.end,this._current.meta=t.meta,this._current.environment=t.environment,this._current.plan_options=t.plan_options,p(i)&&(l(this._current.creation)||v((m=this._current.creation.meta)==null?void 0:m.done))&&(this._current.creation=i),p(n)&&(l(this._current.restate)||v((y=this._current.restate.meta)==null?void 0:y.done))&&(this._current.restate=n),p(c)&&(l(this._current.backfill)||v((A=this._current.backfill.meta)==null?void 0:A.done))&&(this._current.backfill=c),p(h)&&(l(this._current.promote)||v((g=this._current.promote.meta)==null?void 0:g.done))&&(this._current.promote=h),R((T=(M=this.current)==null?void 0:M.meta)==null?void 0:T.done)&&l(this._last)?(this._last=this._current,this._lastPlanOverview=this._planOverview,this._current=void 0,this._planOverview=void 0):this._planOverview=p(d)&&p(_)?e==null?void 0:e.clone():void 0,this.isFetching=f((E=t.meta)==null?void 0:E.done)}reset(){this._current=void 0,this._planOverview=void 0}clear(){this._current=void 0,this._last=void 0,this._planOverview=void 0,this._lastPlanOverview=void 0}clone(){var e;const t=new k;return p(this.current)&&t.update(structuredClone(this.current),(e=this.overview)==null?void 0:e.clone()),t}}class b extends U{get cancel(){var r;return(r=this._current)==null?void 0:r.cancel}get isCancelling(){var r,t,e,i;return v((t=(r=this.current)==null?void 0:r.meta)==null?void 0:t.done)&&((i=(e=this.current)==null?void 0:e.meta)==null?void 0:i.status)===w.init||this.isFetching}update(r){var t;this._current=r,this.isFetching=f((t=r.meta)==null?void 0:t.done)}}class C extends U{constructor(t){super(t);a(this,"_added",[]);a(this,"_removed",[]);a(this,"_direct",[]);a(this,"_indirect",[]);a(this,"_metadata",[]);a(this,"_backfills",[]);p(t)&&t.isModel&&(this._added=t.added,this._removed=t.removed,this._direct=t.direct,this._indirect=t.indirect,this._metadata=t.metadata,this._backfills=t.backfills)}get stageValidation(){var t;return(t=this._current)==null?void 0:t.validation}get stageChanges(){var t;return(t=this._current)==null?void 0:t.changes}get stageBackfills(){var t;return(t=this._current)==null?void 0:t.backfills}get validation(){var t;return(t=this._current)==null?void 0:t.validation}get hasChanges(){var d;if(l((d=this._current)==null?void 0:d.changes))return;const{added:t,removed:e,modified:i}=this._current.changes??{};if([t,e,i].every(l))return;const{direct:n,indirect:c,metadata:h}=i??{};return[t,e,n,c,h].some(V)}get changes(){var t;return(t=this._current)==null?void 0:t.changes}get hasBackfills(){var t,e,i;return l((e=(t=this._current)==null?void 0:t.backfills)==null?void 0:e.models)?void 0:V((i=this._current.backfills)==null?void 0:i.models)}get hasUpdates(){return R(this.hasChanges)||R(this.hasBackfills)}get backfills(){return this._backfills}get added(){return this._added}get removed(){return this._removed}get direct(){return this._direct}get indirect(){return this._indirect}get metadata(){return this._metadata}get isVirtualUpdate(){return p(this.hasChanges)&&l(this.hasBackfills)||!!this.hasChanges&&this.skipBackfill}get isMetadataUpdate(){var t;return!!((t=this.metadata)!=null&&t.length)&&l(this.hasBackfills)}get isBackfillUpdate(){return v(this.hasChanges)&&!!this.hasBackfills&&f(this.skipBackfill)}get isChangesAndBackfillUpdate(){return!!this.hasChanges&&!!this.hasBackfills&&f(this.skipBackfill)}get isLatest(){return this.isFinished&&l(this.hasChanges)&&(l(this.hasBackfills)||this.skipBackfill)}get skipTests(){var t,e;return((e=(t=this._current)==null?void 0:t.plan_options)==null?void 0:e.skip_tests)??!1}get skipBackfill(){var t,e;return((e=(t=this._current)==null?void 0:t.plan_options)==null?void 0:e.skip_backfill)??!1}update(t){var c,h,d,_,P,B,m,y,A;this._current=t,this.isFetching=f((c=t.meta)==null?void 0:c.done);const e=((h=this._current)==null?void 0:h.changes)??{},i=(e==null?void 0:e.modified)??{},n=((d=this._current)==null?void 0:d.backfills)??{};this._added=((_=e.added)==null?void 0:_.map(g=>new o(g)))??[],this._removed=((P=e.removed)==null?void 0:P.map(g=>new o(g)))??[],this._direct=((B=i.direct)==null?void 0:B.map(g=>new o(g)))??[],this._indirect=((m=i.indirect)==null?void 0:m.map(g=>new o(g)))??[],this._metadata=((y=i.metadata)==null?void 0:y.map(g=>new o(g)))??[],this._backfills=((A=n.models)==null?void 0:A.map(g=>new o(g)))??[]}clone(){const t=new C;return p(this.current)&&t.update(structuredClone(this.current)),t}}const G=D((u,r)=>({planAction:new O,planOverview:new C,planApply:new k,planCancel:new b,setPlanAction:t=>{u(()=>({planAction:new O(t)}))},setPlanApply:t=>{u(()=>({planApply:new k(t)}))},setPlanOverview:t=>{u(()=>({planOverview:new C(t)}))},setPlanCancel:t=>{u(()=>({planCancel:new b(t)}))},resetPlanTrackers:()=>{const t=r();t.planApply.reset(),t.planCancel.reset(),t.planOverview.reset(),u(()=>({planApply:new k(t.planApply),planCancel:new b(t.planCancel),planOverview:new C(t.planOverview)}))},resetPlanCancel:()=>{const t=r();t.planCancel.reset(),u(()=>({planCancel:new b(t.planCancel)}))},clearPlanApply:()=>{const t=r();t.planApply.clear(),u(()=>({planApply:new k(t.planApply)}))}}));export{s as E,C as M,O as a,G as u};
1
+ var N=Object.defineProperty;var I=(u,r,t)=>r in u?N(u,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[r]=t;var a=(u,r,t)=>I(u,typeof r!="symbol"?r+"":r,t);import{$ as F,q as x,b as f,v as l,f as R,A as w,C as v,i as p,g as V,a0 as D}from"./index-DXRmsAbz.js";const s={Done:"done",Run:"run",Running:"running",RunningTask:"running-task",ApplyVirtual:"apply-virtual",ApplyBackfill:"apply-backfill",ApplyChangesAndBackfill:"apply-changes-and-backfill",ApplyMetadata:"apply-metadata",Applying:"applying",Cancelling:"cancelling"};class O extends F{constructor(t){super(t!=null&&t.isModel?t.initial:{...t,value:(t==null?void 0:t.value)??s.Run});a(this,"_value");this._value=(t==null?void 0:t.value)??this.initial.value}get value(){return this._value}get isRun(){return this.value===s.Run}get isDone(){return this.value===s.Done}get isApplyVirtual(){return this.value===s.ApplyVirtual}get isApplyBackfill(){return this.value===s.ApplyBackfill}get isApplyChangesAndBackfill(){return this.value===s.ApplyChangesAndBackfill}get isApplyMetadata(){return this.value===s.ApplyMetadata}get isApply(){return this.isApplyVirtual||this.isApplyBackfill||this.isApplyChangesAndBackfill||this.isApplyMetadata}get isCancelling(){return this.value===s.Cancelling}get isApplying(){return this.value===s.Applying}get isRunning(){return x([s.Running,s.RunningTask],this.value)}get isRunningTask(){return this.value===s.RunningTask}get isProcessing(){return this.isRunning||this.isApplying||this.isCancelling}get isIdle(){return f(this.isProcessing)}displayStatus(t){return this.isCancelling?"Cancelling Plan...":this.isApplying?"Applying Plan...":this.isRunning&&l(t.hasChanges)?"Getting Changes...":this.isRunning&&l(t.hasBackfills)?"Getting Backfills...":this.isRunning?"Checking Plan...":this.isRunningTask?"Running Task...":"Plan"}static getActionDisplayName(t,e=[],i="Plan"){if(!e.includes(t.value))return i;let n;switch(t.value){case s.Done:n="Done";break;case s.Running:n="Running...";break;case s.RunningTask:n="Running Task...";break;case s.Applying:n="Applying...";break;case s.Cancelling:n="Cancelling...";break;case s.Run:n="Plan";break;case s.ApplyChangesAndBackfill:n="Apply Changes And Backfill";break;case s.ApplyVirtual:n="Apply Virtual Update";break;case s.ApplyBackfill:n="Apply And Backfill";break;case s.ApplyMetadata:n="Apply Metadata";break;default:n=i;break}return n}static getPlanAction({planOverview:t,planApply:e,planCancel:i}){const n=t.isRunning,c=e.isRunning,h=i.isRunning,d=e.isFinished&&t.isFinished||i.isFinished;return i.isEmpty&&e.isEmpty&&t.isEmpty?s.Run:h?s.Cancelling:c?s.Applying:n?s.Running:d?s.Done:t.isVirtualUpdate?s.ApplyVirtual:t.isMetadataUpdate?s.ApplyMetadata:t.isBackfillUpdate?s.ApplyBackfill:t.isChangesAndBackfillUpdate?s.ApplyChangesAndBackfill:s.Done}}class U extends F{constructor(t){super(t==null?void 0:t.initial);a(this,"_current");a(this,"_isFetching",!1);this._current=t==null?void 0:t._current,this._isFetching=(t==null?void 0:t._isFetching)??!1}get current(){return this._current}get environment(){var t;return(t=this.current)==null?void 0:t.environment}get meta(){var t;return(t=this.current)==null?void 0:t.meta}get plan_options(){var t;return(t=this.current)==null?void 0:t.plan_options}get start(){var t;return(t=this.current)==null?void 0:t.start}get end(){var t;return(t=this.current)==null?void 0:t.end}get duration(){var t;return((t=this==null?void 0:this.meta)==null?void 0:t.duration)??-1}get isFinished(){var t,e,i,n;return R((e=(t=this.current)==null?void 0:t.meta)==null?void 0:e.done)&&((n=(i=this.current)==null?void 0:i.meta)==null?void 0:n.status)!==w.init&&f(this.isFetching)}get isRunning(){var t,e,i,n;return v((e=(t=this.current)==null?void 0:t.meta)==null?void 0:e.done)&&((n=(i=this.current)==null?void 0:i.meta)==null?void 0:n.status)===w.init||this.isFetching}get isSuccessful(){var t,e;return this.isFinished&&((e=(t=this.current)==null?void 0:t.meta)==null?void 0:e.status)===w.success}get isFailed(){var t,e,i;return this.isFinished&&(l((t=this.current)==null?void 0:t.meta)||((i=(e=this.current)==null?void 0:e.meta)==null?void 0:i.status)===w.fail)}get isEmpty(){return l(this.current)}get isFetching(){return this._isFetching}set isFetching(t){this._isFetching=t}reset(){this._current=void 0}}class o extends F{constructor(t){var e,i;super(t);a(this,"name");a(this,"view_name");a(this,"node_type");a(this,"change_category");a(this,"diff");a(this,"indirect");a(this,"batches");a(this,"direct");a(this,"completed");a(this,"end");a(this,"interval");a(this,"start");a(this,"total");this.name=encodeURI(this.initial.name),this.view_name=encodeURI(this.initial.view_name),this.node_type=this.initial.node_type,this.change_category=this.initial.change_category,this.diff=this.initial.diff,this.batches=this.initial.batches,this.interval=this.initial.interval,this.start=this.initial.start,this.total=this.initial.total,this.completed=this.initial.completed,this.end=this.initial.end,this.indirect=(e=this.initial.indirect)==null?void 0:e.map(n=>new o(n)),this.direct=(i=this.initial.direct)==null?void 0:i.map(n=>new o(n))}get nodeType(){return this.node_type}get viewName(){return this.view_name}get displayName(){return decodeURI(this.name)}get displayViewName(){return decodeURI(this.view_name)}get changeCategory(){return this.change_category}}class k extends U{constructor(t){super(t);a(this,"_last");a(this,"_planOverview");a(this,"_lastPlanOverview");p(t)&&t.isModel&&(this._current=t._current,this._last=t._last,this._planOverview=t._planOverview,this._lastPlanOverview=t._lastPlanOverview)}get current(){return this._current??this._last}get environment(){var t,e;return((t=this._last)==null?void 0:t.environment)??((e=this._current)==null?void 0:e.environment)}get meta(){var t,e;return((t=this._last)==null?void 0:t.meta)??((e=this._current)==null?void 0:e.meta)}get plan_options(){var t,e;return((t=this._last)==null?void 0:t.plan_options)??((e=this._current)==null?void 0:e.plan_options)}get start(){var t,e;return((t=this._last)==null?void 0:t.start)??((e=this._current)==null?void 0:e.start)}get end(){var t,e;return((t=this._last)==null?void 0:t.end)??((e=this._current)==null?void 0:e.end)}get overview(){return this._lastPlanOverview??this._planOverview}get backfills(){var t;return((t=this.overview)==null?void 0:t.backfills)??[]}get added(){var t;return((t=this.overview)==null?void 0:t.added)??[]}get removed(){var t;return((t=this.overview)==null?void 0:t.removed)??[]}get direct(){var t;return((t=this.overview)==null?void 0:t.direct)??[]}get indirect(){var t;return((t=this.overview)==null?void 0:t.indirect)??[]}get metadata(){var t;return((t=this.overview)==null?void 0:t.metadata)??[]}get tasks(){var e,i,n,c;const t=((i=(e=this._last)==null?void 0:e.backfill)==null?void 0:i.tasks)??((c=(n=this._current)==null?void 0:n.backfill)==null?void 0:c.tasks)??{};return Object.entries(t??{}).reduce((h,[d,_])=>(h[encodeURI(d)]=new o(_),h),{})}get queue(){var t,e;return((e=(t=this.stageBackfill)==null?void 0:t.queue)==null?void 0:e.map(i=>this.tasks[encodeURI(i)]).filter(Boolean))??[]}get stageValidation(){var t;return(t=this.overview)==null?void 0:t.stageValidation}get stageChanges(){var t;return(t=this.overview)==null?void 0:t.stageChanges}get stageBackfills(){var t;return(t=this.overview)==null?void 0:t.stageBackfills}get stageCreation(){var t,e;return((t=this._last)==null?void 0:t.creation)??((e=this._current)==null?void 0:e.creation)}get stageRestate(){var t,e;return((t=this._last)==null?void 0:t.restate)??((e=this._current)==null?void 0:e.restate)}get stageBackfill(){var t,e;return((t=this._last)==null?void 0:t.backfill)??((e=this._current)==null?void 0:e.backfill)}get stagePromote(){var t,e;return((t=this._last)==null?void 0:t.promote)??((e=this._current)==null?void 0:e.promote)}get shouldShowEvaluation(){return this.isFailed||p(this.stageCreation)||p(this.stageBackfill)||p(this.stagePromote)}get evaluationStart(){var t,e,i,n,c,h;return((e=(t=this.stageCreation)==null?void 0:t.meta)==null?void 0:e.start)??((n=(i=this.stageBackfill)==null?void 0:i.meta)==null?void 0:n.start)??((h=(c=this.stagePromote)==null?void 0:c.meta)==null?void 0:h.start)}get evaluationEnd(){var t,e,i,n,c,h;return((e=(t=this.stagePromote)==null?void 0:t.meta)==null?void 0:e.end)??((n=(i=this.stageBackfill)==null?void 0:i.meta)==null?void 0:n.end)??((h=(c=this.stageCreation)==null?void 0:c.meta)==null?void 0:h.end)}update(t,e){var m,y,A,g,M,T,E;const{creation:i,restate:n,backfill:c,promote:h,meta:d,environment:_}=t,B=l(d)||l(_)?void 0:t;if(l(B)){this._current=void 0;return}l(this._current)&&(this._current=t),this._current.start=t.start,this._current.end=t.end,this._current.meta=t.meta,this._current.environment=t.environment,this._current.plan_options=t.plan_options,p(i)&&(l(this._current.creation)||v((m=this._current.creation.meta)==null?void 0:m.done))&&(this._current.creation=i),p(n)&&(l(this._current.restate)||v((y=this._current.restate.meta)==null?void 0:y.done))&&(this._current.restate=n),p(c)&&(l(this._current.backfill)||v((A=this._current.backfill.meta)==null?void 0:A.done))&&(this._current.backfill=c),p(h)&&(l(this._current.promote)||v((g=this._current.promote.meta)==null?void 0:g.done))&&(this._current.promote=h),R((T=(M=this.current)==null?void 0:M.meta)==null?void 0:T.done)&&l(this._last)?(this._last=this._current,this._lastPlanOverview=this._planOverview,this._current=void 0,this._planOverview=void 0):this._planOverview=p(d)&&p(_)?e==null?void 0:e.clone():void 0,this.isFetching=f((E=t.meta)==null?void 0:E.done)}reset(){this._current=void 0,this._planOverview=void 0}clear(){this._current=void 0,this._last=void 0,this._planOverview=void 0,this._lastPlanOverview=void 0}clone(){var e;const t=new k;return p(this.current)&&t.update(structuredClone(this.current),(e=this.overview)==null?void 0:e.clone()),t}}class b extends U{get cancel(){var r;return(r=this._current)==null?void 0:r.cancel}get isCancelling(){var r,t,e,i;return v((t=(r=this.current)==null?void 0:r.meta)==null?void 0:t.done)&&((i=(e=this.current)==null?void 0:e.meta)==null?void 0:i.status)===w.init||this.isFetching}update(r){var t;this._current=r,this.isFetching=f((t=r.meta)==null?void 0:t.done)}}class C extends U{constructor(t){super(t);a(this,"_added",[]);a(this,"_removed",[]);a(this,"_direct",[]);a(this,"_indirect",[]);a(this,"_metadata",[]);a(this,"_backfills",[]);p(t)&&t.isModel&&(this._added=t.added,this._removed=t.removed,this._direct=t.direct,this._indirect=t.indirect,this._metadata=t.metadata,this._backfills=t.backfills)}get stageValidation(){var t;return(t=this._current)==null?void 0:t.validation}get stageChanges(){var t;return(t=this._current)==null?void 0:t.changes}get stageBackfills(){var t;return(t=this._current)==null?void 0:t.backfills}get validation(){var t;return(t=this._current)==null?void 0:t.validation}get hasChanges(){var d;if(l((d=this._current)==null?void 0:d.changes))return;const{added:t,removed:e,modified:i}=this._current.changes??{};if([t,e,i].every(l))return;const{direct:n,indirect:c,metadata:h}=i??{};return[t,e,n,c,h].some(V)}get changes(){var t;return(t=this._current)==null?void 0:t.changes}get hasBackfills(){var t,e,i;return l((e=(t=this._current)==null?void 0:t.backfills)==null?void 0:e.models)?void 0:V((i=this._current.backfills)==null?void 0:i.models)}get hasUpdates(){return R(this.hasChanges)||R(this.hasBackfills)}get backfills(){return this._backfills}get added(){return this._added}get removed(){return this._removed}get direct(){return this._direct}get indirect(){return this._indirect}get metadata(){return this._metadata}get isVirtualUpdate(){return p(this.hasChanges)&&l(this.hasBackfills)||!!this.hasChanges&&this.skipBackfill}get isMetadataUpdate(){var t;return!!((t=this.metadata)!=null&&t.length)&&l(this.hasBackfills)}get isBackfillUpdate(){return v(this.hasChanges)&&!!this.hasBackfills&&f(this.skipBackfill)}get isChangesAndBackfillUpdate(){return!!this.hasChanges&&!!this.hasBackfills&&f(this.skipBackfill)}get isLatest(){return this.isFinished&&l(this.hasChanges)&&(l(this.hasBackfills)||this.skipBackfill)}get skipTests(){var t,e;return((e=(t=this._current)==null?void 0:t.plan_options)==null?void 0:e.skip_tests)??!1}get skipBackfill(){var t,e;return((e=(t=this._current)==null?void 0:t.plan_options)==null?void 0:e.skip_backfill)??!1}update(t){var c,h,d,_,P,B,m,y,A;this._current=t,this.isFetching=f((c=t.meta)==null?void 0:c.done);const e=((h=this._current)==null?void 0:h.changes)??{},i=(e==null?void 0:e.modified)??{},n=((d=this._current)==null?void 0:d.backfills)??{};this._added=((_=e.added)==null?void 0:_.map(g=>new o(g)))??[],this._removed=((P=e.removed)==null?void 0:P.map(g=>new o(g)))??[],this._direct=((B=i.direct)==null?void 0:B.map(g=>new o(g)))??[],this._indirect=((m=i.indirect)==null?void 0:m.map(g=>new o(g)))??[],this._metadata=((y=i.metadata)==null?void 0:y.map(g=>new o(g)))??[],this._backfills=((A=n.models)==null?void 0:A.map(g=>new o(g)))??[]}clone(){const t=new C;return p(this.current)&&t.update(structuredClone(this.current)),t}}const G=D((u,r)=>({planAction:new O,planOverview:new C,planApply:new k,planCancel:new b,setPlanAction:t=>{u(()=>({planAction:new O(t)}))},setPlanApply:t=>{u(()=>({planApply:new k(t)}))},setPlanOverview:t=>{u(()=>({planOverview:new C(t)}))},setPlanCancel:t=>{u(()=>({planCancel:new b(t)}))},resetPlanTrackers:()=>{const t=r();t.planApply.reset(),t.planCancel.reset(),t.planOverview.reset(),u(()=>({planApply:new k(t.planApply),planCancel:new b(t.planCancel),planOverview:new C(t.planOverview)}))},resetPlanCancel:()=>{const t=r();t.planCancel.reset(),u(()=>({planCancel:new b(t.planCancel)}))},clearPlanApply:()=>{const t=r();t.planApply.clear(),u(()=>({planApply:new k(t.planApply)}))}}));export{s as E,C as M,O as a,G as u};
@@ -0,0 +1,13 @@
1
+ import{R as P,r as u,aj as Wn,at as lt}from"./index-DXRmsAbz.js";import{u as Gn,i as Me,e as Un,o as Kt,d as Ye,m as ze,g as Vn,j as Kn,r as Ne,s as qn,f as Yn,a as zn,c as Xn}from"./floating-ui.react-dom-BX3awo09.js";const qt=typeof document<"u"?P.useLayoutEffect:()=>{};var Xe;const Jn=(Xe=P.useInsertionEffect)!==null&&Xe!==void 0?Xe:qt;function Qn(e){const t=u.useRef(null);return Jn(()=>{t.current=e},[e]),u.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const pe=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},me=e=>e&&"window"in e&&e.window===e?e:pe(e).defaultView||window;function Zn(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function er(e){return Zn(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let tr=!1;function gt(){return tr}function Yt(e,t){if(!gt())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:er(n)?n=n.host:n=n.parentNode}return!1}const at=(e=document)=>{var t;if(!gt())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function zt(e){return gt()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function nr(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function rr(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function Xt(e){let t=null;return()=>(t==null&&(t=e()),t)}const or=Xt(function(){return rr(/^Mac/i)}),lr=Xt(function(){return nr(/Android/i)});function Jt(){let e=u.useRef(new Map),t=u.useCallback((o,a,i,l)=>{let s=l!=null&&l.once?(...c)=>{e.current.delete(i),i(...c)}:i;e.current.set(i,{type:a,eventTarget:o,fn:s,options:l}),o.addEventListener(a,s,l)},[]),n=u.useCallback((o,a,i,l)=>{var s;let c=((s=e.current.get(i))===null||s===void 0?void 0:s.fn)||i;o.removeEventListener(a,c,l),e.current.delete(i)},[]),r=u.useCallback(()=>{e.current.forEach((o,a)=>{n(o.eventTarget,o.type,a,o.options)})},[n]);return u.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function ar(e){return e.mozInputSource===0&&e.isTrusted?!0:lr()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Qt(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function ur(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Zt(e){let t=u.useRef({isFocused:!1,observer:null});qt(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Qn(r=>{e==null||e(r)});return u.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,a=i=>{if(t.current.isFocused=!1,o.disabled){let l=Qt(i);n(l)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",a,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let l=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:l})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:l}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let sr=!1,Re=null,ut=new Set,Te=new Map,Ee=!1,st=!1;const ir={Tab:!0,Escape:!0};function bt(e,t){for(let n of ut)n(e,t)}function cr(e){return!(e.metaKey||!or()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function De(e){Ee=!0,cr(e)&&(Re="keyboard",bt("keyboard",e))}function ye(e){Re="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Ee=!0,bt("pointer",e))}function en(e){ar(e)&&(Ee=!0,Re="virtual")}function tn(e){e.target===window||e.target===document||sr||!e.isTrusted||(!Ee&&!st&&(Re="virtual",bt("virtual",e)),Ee=!1,st=!1)}function nn(){Ee=!1,st=!0}function it(e){if(typeof window>"u"||typeof document>"u"||Te.get(me(e)))return;const t=me(e),n=pe(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Ee=!0,r.apply(this,arguments)},n.addEventListener("keydown",De,!0),n.addEventListener("keyup",De,!0),n.addEventListener("click",en,!0),t.addEventListener("focus",tn,!0),t.addEventListener("blur",nn,!1),typeof PointerEvent<"u"&&(n.addEventListener("pointerdown",ye,!0),n.addEventListener("pointermove",ye,!0),n.addEventListener("pointerup",ye,!0)),t.addEventListener("beforeunload",()=>{rn(e)},{once:!0}),Te.set(t,{focus:r})}const rn=(e,t)=>{const n=me(e),r=pe(e);t&&r.removeEventListener("DOMContentLoaded",t),Te.has(n)&&(n.HTMLElement.prototype.focus=Te.get(n).focus,r.removeEventListener("keydown",De,!0),r.removeEventListener("keyup",De,!0),r.removeEventListener("click",en,!0),n.removeEventListener("focus",tn,!0),n.removeEventListener("blur",nn,!1),typeof PointerEvent<"u"&&(r.removeEventListener("pointerdown",ye,!0),r.removeEventListener("pointermove",ye,!0),r.removeEventListener("pointerup",ye,!0)),Te.delete(n))};function fr(e){const t=pe(e);let n;return t.readyState!=="loading"?it(e):(n=()=>{it(e)},t.addEventListener("DOMContentLoaded",n)),()=>rn(e,n)}typeof document<"u"&&fr();function on(){return Re!=="pointer"}const dr=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function pr(e,t,n){let r=pe(n==null?void 0:n.target);const o=typeof window<"u"?me(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,a=typeof window<"u"?me(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?me(n==null?void 0:n.target).HTMLElement:HTMLElement,l=typeof window<"u"?me(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!dr.has(r.activeElement.type)||r.activeElement instanceof a||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof l&&!ir[n.key])}function vr(e,t,n){it(),u.useEffect(()=>{let r=(o,a)=>{pr(!!(n!=null&&n.isTextInput),o,a)&&e(on())};return ut.add(r),()=>{ut.delete(r)}},t)}function mr(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const a=u.useCallback(s=>{if(s.target===s.currentTarget)return r&&r(s),o&&o(!1),!0},[r,o]),i=Zt(a),l=u.useCallback(s=>{const c=pe(s.target),f=c?at(c):at();s.target===s.currentTarget&&f===zt(s.nativeEvent)&&(n&&n(s),o&&o(!0),i(s))},[o,n,i]);return{focusProps:{onFocus:!t&&(n||o||r)?l:void 0,onBlur:!t&&(r||o)?a:void 0}}}function hr(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,a=u.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:l}=Jt(),s=u.useCallback(h=>{h.currentTarget.contains(h.target)&&a.current.isFocusWithin&&!h.currentTarget.contains(h.relatedTarget)&&(a.current.isFocusWithin=!1,l(),n&&n(h),o&&o(!1))},[n,o,a,l]),c=Zt(s),f=u.useCallback(h=>{if(!h.currentTarget.contains(h.target))return;const m=pe(h.target),d=at(m);if(!a.current.isFocusWithin&&d===zt(h.nativeEvent)){r&&r(h),o&&o(!0),a.current.isFocusWithin=!0,c(h);let p=h.currentTarget;i(m,"focus",v=>{if(a.current.isFocusWithin&&!Yt(p,v.target)){let g=new m.defaultView.FocusEvent("blur",{relatedTarget:v.target});ur(g,p);let E=Qt(g);s(E)}},{capture:!0})}},[r,o,c,i,s]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:s}}}let ct=!1,Ae=0;function gr(){ct=!0,setTimeout(()=>{ct=!1},50)}function Tt(e){e.pointerType==="touch"&&gr()}function br(){if(!(typeof document>"u"))return Ae===0&&typeof PointerEvent<"u"&&document.addEventListener("pointerup",Tt),Ae++,()=>{Ae--,!(Ae>0)&&typeof PointerEvent<"u"&&document.removeEventListener("pointerup",Tt)}}function Er(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[a,i]=u.useState(!1),l=u.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;u.useEffect(br,[]);let{addGlobalListener:s,removeAllGlobalListeners:c}=Jt(),{hoverProps:f,triggerHoverEnd:h}=u.useMemo(()=>{let m=(v,g)=>{if(l.pointerType=g,o||g==="touch"||l.isHovered||!v.currentTarget.contains(v.target))return;l.isHovered=!0;let E=v.currentTarget;l.target=E,s(pe(v.target),"pointerover",y=>{l.isHovered&&l.target&&!Yt(l.target,y.target)&&d(y,y.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:E,pointerType:g}),n&&n(!0),i(!0)},d=(v,g)=>{let E=l.target;l.pointerType="",l.target=null,!(g==="touch"||!l.isHovered||!E)&&(l.isHovered=!1,c(),r&&r({type:"hoverend",target:E,pointerType:g}),n&&n(!1),i(!1))},p={};return typeof PointerEvent<"u"&&(p.onPointerEnter=v=>{ct&&v.pointerType==="mouse"||m(v,v.pointerType)},p.onPointerLeave=v=>{!o&&v.currentTarget.contains(v.target)&&d(v,v.pointerType)}),{hoverProps:p,triggerHoverEnd:d}},[t,n,r,o,l,s,c]);return u.useEffect(()=>{o&&h({currentTarget:l.target},l.pointerType)},[o]),{hoverProps:f,isHovered:a}}function $r(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=u.useRef({isFocused:!1,isFocusVisible:t||on()}),[a,i]=u.useState(!1),[l,s]=u.useState(()=>o.current.isFocused&&o.current.isFocusVisible),c=u.useCallback(()=>s(o.current.isFocused&&o.current.isFocusVisible),[]),f=u.useCallback(d=>{o.current.isFocused=d,i(d),c()},[c]);vr(d=>{o.current.isFocusVisible=d,c()},[],{isTextInput:n});let{focusProps:h}=mr({isDisabled:r,onFocusChange:f}),{focusWithinProps:m}=hr({isDisabled:!r,onFocusWithinChange:f});return{isFocused:a,isFocusVisible:l,focusProps:r?m:h}}var yr=Object.defineProperty,wr=(e,t,n)=>t in e?yr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Je=(e,t,n)=>(wr(e,typeof t!="symbol"?t+"":t,n),n);let Pr=class{constructor(){Je(this,"current",this.detect()),Je(this,"handoffState","pending"),Je(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},be=new Pr;function Se(e){var t,n;return be.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function ln(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function oe(){let e=[],t={addEventListener(n,r,o,a){return n.addEventListener(r,o,a),t.add(()=>n.removeEventListener(r,o,a))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return ln(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let a=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:a})})},group(n){let r=oe();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function Be(){let[e]=u.useState(oe);return u.useEffect(()=>()=>e.dispose(),[e]),e}let N=(e,t)=>{be.isServer?u.useEffect(e,t):u.useLayoutEffect(e,t)};function se(e){let t=u.useRef(e);return N(()=>{t.current=e},[e]),t}let x=function(e){let t=se(e);return P.useCallback((...n)=>t.current(...n),[t])};function Sr(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function Cr(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function xr({disabled:e=!1}={}){let t=u.useRef(null),[n,r]=u.useState(!1),o=Be(),a=x(()=>{t.current=null,r(!1),o.dispose()}),i=x(l=>{if(o.dispose(),t.current===null){t.current=l.currentTarget,r(!0);{let s=Se(l.currentTarget);o.addEventListener(s,"pointerup",a,!1),o.addEventListener(s,"pointermove",c=>{if(t.current){let f=Sr(c);r(Cr(f,t.current.getBoundingClientRect()))}},!1),o.addEventListener(s,"pointercancel",a,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:i,onPointerUp:a,onClick:a}}}function ft(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function J(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,J),r}var we=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(we||{}),ce=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ce||{});function ee(){let e=Tr();return u.useCallback(t=>Fr({mergeRefs:e,...t}),[e])}function Fr({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:a=!0,name:i,mergeRefs:l}){l=l??Or;let s=an(t,e);if(a)return Ie(s,n,r,i,l);let c=o??0;if(c&2){let{static:f=!1,...h}=s;if(f)return Ie(h,n,r,i,l)}if(c&1){let{unmount:f=!0,...h}=s;return J(f?0:1,{0(){return null},1(){return Ie({...h,hidden:!0,style:{display:"none"}},n,r,i,l)}})}return Ie(s,n,r,i,l)}function Ie(e,t={},n,r,o){let{as:a=n,children:i,refName:l="ref",...s}=Qe(e,["unmount","static"]),c=e.ref!==void 0?{[l]:e.ref}:{},f=typeof i=="function"?i(t):i;"className"in s&&s.className&&typeof s.className=="function"&&(s.className=s.className(t)),s["aria-labelledby"]&&s["aria-labelledby"]===s.id&&(s["aria-labelledby"]=void 0);let h={};if(t){let m=!1,d=[];for(let[p,v]of Object.entries(t))typeof v=="boolean"&&(m=!0),v===!0&&d.push(p.replace(/([A-Z])/g,g=>`-${g.toLowerCase()}`));if(m){h["data-headlessui-state"]=d.join(" ");for(let p of d)h[`data-${p}`]=""}}if(a===u.Fragment&&(Object.keys(ve(s)).length>0||Object.keys(ve(h)).length>0))if(!u.isValidElement(f)||Array.isArray(f)&&f.length>1){if(Object.keys(ve(s)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(ve(s)).concat(Object.keys(ve(h))).map(m=>` - ${m}`).join(`
2
+ `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(m=>` - ${m}`).join(`
3
+ `)].join(`
4
+ `))}else{let m=f.props,d=m==null?void 0:m.className,p=typeof d=="function"?(...E)=>ft(d(...E),s.className):ft(d,s.className),v=p?{className:p}:{},g=an(f.props,ve(Qe(s,["ref"])));for(let E in h)E in g&&delete h[E];return u.cloneElement(f,Object.assign({},g,h,c,{ref:o(Rr(f),c.ref)},v))}return u.createElement(a,Object.assign({},Qe(s,["ref"]),a!==u.Fragment&&c,a!==u.Fragment&&h),f)}function Tr(){let e=u.useRef([]),t=u.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function Or(...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 an(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var a;return(a=o==null?void 0:o.preventDefault)==null?void 0:a.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...a){let i=n[r];for(let l of i){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;l(o,...a)}}});return t}function dt(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let a=n[r];for(let i of a)i==null||i(...o)}});return t}function z(e){var t;return Object.assign(u.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ve(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Qe(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Rr(e){return P.version.split(".")[0]>="19"?e.props.ref:e.ref}let kr="span";var Oe=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Oe||{});function Mr(e,t){var n;let{features:r=1,...o}=e,a={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return ee()({ourProps:a,theirProps:o,slot:{},defaultTag:kr,name:"Hidden"})}let He=z(Mr);function un(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function de(e){return un(e)&&"tagName"in e}function re(e){return de(e)&&"accessKey"in e}function he(e){return de(e)&&"tabIndex"in e}function Ar(e){return de(e)&&"style"in e}function Ir(e){return re(e)&&e.nodeName==="IFRAME"}function Lr(e){return re(e)&&e.nodeName==="INPUT"}function Kl(e){return re(e)&&e.nodeName==="LABEL"}function Nr(e){return re(e)&&e.nodeName==="FIELDSET"}function sn(e){return re(e)&&e.nodeName==="LEGEND"}function ql(e){return de(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function cn(e){let t=e.parentElement,n=null;for(;t&&!Nr(t);)sn(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Dr(n)?!1:r}function Dr(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(sn(t))return!1;t=t.previousElementSibling}return!0}let fn=Symbol();function dn(e,t=!0){return Object.assign(e,{[fn]:t})}function Z(...e){let t=u.useRef(e);u.useEffect(()=>{t.current=e},[e]);let n=x(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[fn]))?void 0:n}var ie=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(ie||{});let Hr=u.createContext(()=>{});function pn({value:e,children:t}){return P.createElement(Hr.Provider,{value:e},t)}function jr(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Br(e,t=!1){let[n,r]=u.useReducer(()=>({}),{}),o=u.useMemo(()=>jr(e),[e,n]);return N(()=>{if(!e)return;let a=new ResizeObserver(r);return a.observe(e),()=>{a.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let vn=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var _r=Object.defineProperty,Wr=(e,t,n)=>t in e?_r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gr=(e,t,n)=>(Wr(e,t+"",n),n),mn=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},X=(e,t,n)=>(mn(e,t,"read from private field"),n?n.call(e):t.get(e)),Ze=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Ot=(e,t,n,r)=>(mn(e,t,"write to private field"),t.set(e,n),n),ne,xe,Fe;let hn=class{constructor(t){Ze(this,ne,{}),Ze(this,xe,new vn(()=>new Set)),Ze(this,Fe,new Set),Gr(this,"disposables",oe()),Ot(this,ne,t)}dispose(){this.disposables.dispose()}get state(){return X(this,ne)}subscribe(t,n){let r={selector:t,callback:n,current:t(X(this,ne))};return X(this,Fe).add(r),this.disposables.add(()=>{X(this,Fe).delete(r)})}on(t,n){return X(this,xe).get(t).add(n),this.disposables.add(()=>{X(this,xe).get(t).delete(n)})}send(t){let n=this.reduce(X(this,ne),t);if(n!==X(this,ne)){Ot(this,ne,n);for(let r of X(this,Fe)){let o=r.selector(X(this,ne));gn(r.current,o)||(r.current=o,r.callback(o))}for(let r of X(this,xe).get(t.type))r(X(this,ne),t)}}};ne=new WeakMap,xe=new WeakMap,Fe=new WeakMap;function gn(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:et(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:et(e.entries(),t.entries()):Rt(e)&&Rt(t)?et(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function et(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function Rt(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Xl(e){let[t,n]=e(),r=oe();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Ur=Object.defineProperty,Vr=(e,t,n)=>t in e?Ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kt=(e,t,n)=>(Vr(e,typeof t!="symbol"?t+"":t,n),n),Kr=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Kr||{});let qr={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let a=e.stack.slice();return a.splice(o,1),a.push(n),r=a,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},Yr=class bn extends hn{constructor(){super(...arguments),kt(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),kt(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new bn({stack:[]})}reduce(t,n){return J(n.type,qr,t,n)}};const En=new vn(()=>Yr.new());var tt={exports:{}},nt={};/**
5
+ * @license React
6
+ * use-sync-external-store-with-selector.production.js
7
+ *
8
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ */var Mt;function zr(){if(Mt)return nt;Mt=1;var e=Wn();function t(s,c){return s===c&&(s!==0||1/s===1/c)||s!==s&&c!==c}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,a=e.useEffect,i=e.useMemo,l=e.useDebugValue;return nt.useSyncExternalStoreWithSelector=function(s,c,f,h,m){var d=o(null);if(d.current===null){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=i(function(){function g(F){if(!E){if(E=!0,y=F,F=h(F),m!==void 0&&p.hasValue){var O=p.value;if(m(O,F))return b=O}return b=F}if(O=b,n(y,F))return O;var T=h(F);return m!==void 0&&m(O,T)?(y=F,O):(y=F,b=T)}var E=!1,y,b,C=f===void 0?null:f;return[function(){return g(c())},C===null?void 0:function(){return g(C())}]},[c,f,h,m]);var v=r(s,d[0],d[1]);return a(function(){p.hasValue=!0,p.value=v},[v]),l(v),v},nt}var At;function Xr(){return At||(At=1,tt.exports=zr()),tt.exports}var Jr=Xr();function $e(e,t,n=gn){return Jr.useSyncExternalStoreWithSelector(x(r=>e.subscribe(Qr,r)),x(()=>e.state),x(()=>e.state),x(t),n)}function Qr(e){return e}function Zr(e,t){let n=u.useId(),r=En.get(t),[o,a]=$e(r,u.useCallback(i=>[r.selectors.isTop(i,n),r.selectors.inStack(i,n)],[r,n]));return N(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?a?o:!0:!1}function eo(e,t,n){let r=se(o=>{let a=o.getBoundingClientRect();a.x===0&&a.y===0&&a.width===0&&a.height===0&&n()});u.useEffect(()=>{if(!e)return;let o=t===null?null:re(t)?t:t.current;if(!o)return;let a=oe();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>r.current(o));i.observe(o),a.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>r.current(o));i.observe(o),a.add(()=>i.disconnect())}return()=>a.dispose()},[t,r,e])}let pt=["[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(","),to=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var ae=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(ae||{}),je=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(je||{}),no=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(no||{});function ke(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(pt)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function ro(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(to)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Et=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Et||{});function $t(e,t=0){var n;return e===((n=Se(e))==null?void 0:n.body)?!1:J(t,{0(){return e.matches(pt)},1(){let r=e;for(;r!==null;){if(r.matches(pt))return!0;r=r.parentElement}return!1}})}function Jl(e){let t=Se(e);oe().nextFrame(()=>{t&&he(t.activeElement)&&!$t(t.activeElement,0)&&lo(e)})}var oo=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(oo||{});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 lo(e){e==null||e.focus({preventScroll:!0})}let ao=["textarea","input"].join(",");function uo(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,ao))!=null?n:!1}function so(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),a=t(r);if(o===null||a===null)return 0;let i=o.compareDocumentPosition(a);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Ql(e,t){return fe(ke(),t,{relativeTo:e})}function fe(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let a=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?so(e):e:t&64?ro(e):ke(e);o.length>0&&i.length>1&&(i=i.filter(d=>!o.some(p=>p!=null&&"current"in p?(p==null?void 0:p.current)===d:p===d))),r=r??a.activeElement;let l=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),s=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(r))-1;if(t&4)return Math.max(0,i.indexOf(r))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},f=0,h=i.length,m;do{if(f>=h||f+h<=0)return 0;let d=s+f;if(t&16)d=(d+h)%h;else{if(d<0)return 3;if(d>=h)return 1}m=i[d],m==null||m.focus(c),f+=l}while(m!==a.activeElement);return t&6&&uo(m)&&m.select(),2}function $n(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function io(){return/Android/gi.test(window.navigator.userAgent)}function It(){return $n()||io()}function Le(e,t,n,r){let o=se(n);u.useEffect(()=>{if(!e)return;function a(i){o.current(i)}return document.addEventListener(t,a,r),()=>document.removeEventListener(t,a,r)},[e,t,r])}function yn(e,t,n,r){let o=se(n);u.useEffect(()=>{if(!e)return;function a(i){o.current(i)}return window.addEventListener(t,a,r),()=>window.removeEventListener(t,a,r)},[e,t,r])}const Lt=30;function co(e,t,n){let r=se(n),o=u.useCallback(function(l,s){if(l.defaultPrevented)return;let c=s(l);if(c===null||!c.getRootNode().contains(c)||!c.isConnected)return;let f=function h(m){return typeof m=="function"?h(m()):Array.isArray(m)||m instanceof Set?m:[m]}(t);for(let h of f)if(h!==null&&(h.contains(c)||l.composed&&l.composedPath().includes(h)))return;return!$t(c,Et.Loose)&&c.tabIndex!==-1&&l.preventDefault(),r.current(l,c)},[r,t]),a=u.useRef(null);Le(e,"pointerdown",l=>{var s,c;It()||(a.current=((c=(s=l.composedPath)==null?void 0:s.call(l))==null?void 0:c[0])||l.target)},!0),Le(e,"pointerup",l=>{if(It()||!a.current)return;let s=a.current;return a.current=null,o(l,()=>s)},!0);let i=u.useRef({x:0,y:0});Le(e,"touchstart",l=>{i.current.x=l.touches[0].clientX,i.current.y=l.touches[0].clientY},!0),Le(e,"touchend",l=>{let s={x:l.changedTouches[0].clientX,y:l.changedTouches[0].clientY};if(!(Math.abs(s.x-i.current.x)>=Lt||Math.abs(s.y-i.current.y)>=Lt))return o(l,()=>he(l.target)?l.target:null)},!0),yn(e,"blur",l=>o(l,()=>Ir(window.document.activeElement)?window.document.activeElement:null),!0)}function Pe(...e){return u.useMemo(()=>Se(...e),[...e])}function fo(e,t,n,r){let o=se(n);u.useEffect(()=>{e=e??window;function a(i){o.current(i)}return e.addEventListener(t,a,r),()=>e.removeEventListener(t,a,r)},[e,t,r])}function po(e,t){return u.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function vo(e){return u.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function mo(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...a){let i=t[o].call(n,...a);i&&(n=i,r.forEach(l=>l()))}}}function ho(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),a=Math.max(0,e-o);n.style(r,"paddingRight",`${a}px`)}}}function go(){return $n()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(a=>a()).some(a=>a.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let l=oe();l.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>l.dispose()))}let a=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",l=>{if(he(l.target))try{let s=l.target.closest("a");if(!s)return;let{hash:c}=new URL(s.href),f=e.querySelector(c);he(f)&&!r(f)&&(i=f)}catch{}},!0),t.addEventListener(e,"touchstart",l=>{if(he(l.target)&&Ar(l.target))if(r(l.target)){let s=l.target;for(;s.parentElement&&r(s.parentElement);)s=s.parentElement;t.style(s,"overscrollBehavior","contain")}else t.style(l.target,"touchAction","none")}),t.addEventListener(e,"touchmove",l=>{if(he(l.target)){if(Lr(l.target))return;if(r(l.target)){let s=l.target;for(;s.parentElement&&s.dataset.headlessuiPortal!==""&&!(s.scrollHeight>s.clientHeight||s.scrollWidth>s.clientWidth);)s=s.parentElement;s.dataset.headlessuiPortal===""&&l.preventDefault()}else l.preventDefault()}},{passive:!1}),t.add(()=>{var l;let s=(l=window.scrollY)!=null?l:window.pageYOffset;a!==s&&window.scrollTo(0,a),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function bo(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Eo(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let ge=mo(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:oe(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:Eo(n)},o=[go(),ho(),bo()];o.forEach(({before:a})=>a==null?void 0:a(r)),o.forEach(({after:a})=>a==null?void 0:a(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});ge.subscribe(()=>{let e=ge.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&ge.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&ge.dispatch("TEARDOWN",n)}});function $o(e,t,n=()=>({containers:[]})){let r=vo(ge),o=t?r.get(t):void 0,a=o?o.count>0:!1;return N(()=>{if(!(!t||!e))return ge.dispatch("PUSH",t,n),()=>ge.dispatch("POP",t,n)},[e,t]),a}function yo(e,t,n=()=>[document.body]){let r=Zr(e,"scroll-lock");$o(r,t,o=>{var a;return{containers:[...(a=o.containers)!=null?a:[],n]}})}function wo(e=0){let[t,n]=u.useState(e),r=u.useCallback(s=>n(s),[t]),o=u.useCallback(s=>n(c=>c|s),[t]),a=u.useCallback(s=>(t&s)===s,[t]),i=u.useCallback(s=>n(c=>c&~s),[n]),l=u.useCallback(s=>n(c=>c^s),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:a,removeFlag:i,toggleFlag:l}}var Po={},Nt,Dt;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Nt=process==null?void 0:Po)==null?void 0:Nt.NODE_ENV)==="test"&&typeof((Dt=Element==null?void 0:Element.prototype)==null?void 0:Dt.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
13
+ `)),[]});var So=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(So||{});function yt(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function wt(e,t,n,r){let[o,a]=u.useState(n),{hasFlag:i,addFlag:l,removeFlag:s}=wo(e&&o?3:0),c=u.useRef(!1),f=u.useRef(!1),h=Be();return N(()=>{var m;if(e){if(n&&a(!0),!t){n&&l(3);return}return(m=r==null?void 0:r.start)==null||m.call(r,n),Co(t,{inFlight:c,prepare(){f.current?f.current=!1:f.current=c.current,c.current=!0,!f.current&&(n?(l(3),s(4)):(l(4),s(2)))},run(){f.current?n?(s(3),l(4)):(s(4),l(3)):n?s(1):l(1)},done(){var d;f.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,s(7),n||a(!1),(d=r==null?void 0:r.end)==null||d.call(r,n))}})}},[e,n,t,h]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Co(e,{prepare:t,run:n,done:r,inFlight:o}){let a=oe();return Fo(e,{prepare:t,inFlight:o}),a.nextFrame(()=>{n(),a.requestAnimationFrame(()=>{a.add(xo(e,r))})}),a.dispose}function xo(e,t){var n,r;let o=oe();if(!e)return o.dispose;let a=!1;o.add(()=>{a=!0});let i=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(l=>l instanceof CSSTransition))!=null?r:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(l=>l.finished)).then(()=>{a||t()}),o.dispose)}function Fo(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function To(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const wn={...lt},Oo=wn.useInsertionEffect,Ro=Oo||(e=>e());function Pn(e){const t=u.useRef(()=>{});return Ro(()=>{t.current=e}),u.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var vt=typeof document<"u"?u.useLayoutEffect:u.useEffect;let Ht=!1,ko=0;const jt=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+ko++;function Mo(){const[e,t]=u.useState(()=>Ht?jt():void 0);return vt(()=>{e==null&&t(jt())},[]),u.useEffect(()=>{Ht=!0},[]),e}const Ao=wn.useId,Io=Ao||Mo;function Lo(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const No=u.createContext(null),Do=u.createContext(null),Ho=()=>{var e;return((e=u.useContext(No))==null?void 0:e.id)||null},jo=()=>u.useContext(Do),Bo="data-floating-ui-focusable";function _o(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Io(),a=u.useRef({}),[i]=u.useState(()=>Lo()),l=Ho()!=null,[s,c]=u.useState(r.reference),f=Pn((d,p,v)=>{a.current.openEvent=d?p:void 0,i.emit("openchange",{open:d,event:p,reason:v,nested:l}),n==null||n(d,p,v)}),h=u.useMemo(()=>({setPositionReference:c}),[]),m=u.useMemo(()=>({reference:s||r.reference||null,floating:r.floating||null,domReference:r.reference}),[s,r.reference,r.floating]);return u.useMemo(()=>({dataRef:a,open:t,onOpenChange:f,elements:m,events:i,floatingId:o,refs:h}),[t,f,m,i,o,h])}function Wo(e){e===void 0&&(e={});const{nodeId:t}=e,n=_o({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[a,i]=u.useState(null),[l,s]=u.useState(null),f=(o==null?void 0:o.domReference)||a,h=u.useRef(null),m=jo();vt(()=>{f&&(h.current=f)},[f]);const d=Gn({...e,elements:{...o,...l&&{reference:l}}}),p=u.useCallback(b=>{const C=Me(b)?{getBoundingClientRect:()=>b.getBoundingClientRect(),contextElement:b}:b;s(C),d.refs.setReference(C)},[d.refs]),v=u.useCallback(b=>{(Me(b)||b===null)&&(h.current=b,i(b)),(Me(d.refs.reference.current)||d.refs.reference.current===null||b!==null&&!Me(b))&&d.refs.setReference(b)},[d.refs]),g=u.useMemo(()=>({...d.refs,setReference:v,setPositionReference:p,domReference:h}),[d.refs,v,p]),E=u.useMemo(()=>({...d.elements,domReference:f}),[d.elements,f]),y=u.useMemo(()=>({...d,...r,refs:g,elements:E,nodeId:t}),[d,g,E,t,r]);return vt(()=>{r.dataRef.current.floatingContext=y;const b=m==null?void 0:m.nodesRef.current.find(C=>C.id===t);b&&(b.context=y)}),u.useMemo(()=>({...d,context:y,refs:g,elements:E}),[d,g,E,y])}const Bt="active",_t="selected";function rt(e,t,n){const r=new Map,o=n==="item";let a=e;if(o&&e){const{[Bt]:i,[_t]:l,...s}=e;a=s}return{...n==="floating"&&{tabIndex:-1,[Bo]:""},...a,...t.map(i=>{const l=i?i[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((i,l)=>(l&&Object.entries(l).forEach(s=>{let[c,f]=s;if(!(o&&[Bt,_t].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof f=="function"){var h;(h=r.get(c))==null||h.push(f),i[c]=function(){for(var m,d=arguments.length,p=new Array(d),v=0;v<d;v++)p[v]=arguments[v];return(m=r.get(c))==null?void 0:m.map(g=>g(...p)).find(g=>g!==void 0)}}}else i[c]=f}),i),{})}}function Go(e){e===void 0&&(e=[]);const t=e.map(l=>l==null?void 0:l.reference),n=e.map(l=>l==null?void 0:l.floating),r=e.map(l=>l==null?void 0:l.item),o=u.useCallback(l=>rt(l,e,"reference"),t),a=u.useCallback(l=>rt(l,e,"floating"),n),i=u.useCallback(l=>rt(l,e,"item"),r);return u.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:i}),[o,a,i])}function Wt(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Uo=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:a=0,index:i=0,minItemsVisible:l=4,referenceOverflowThreshold:s=0,scrollRef:c,...f}=Un(e,t),{rects:h,elements:{floating:m}}=t,d=n.current[i],p=(c==null?void 0:c.current)||m,v=m.clientTop||p.clientTop,g=m.clientTop!==0,E=p.clientTop!==0,y=m===p;if(!d)return{};const b={...t,...await Kt(-d.offsetTop-m.clientTop-h.reference.height/2-d.offsetHeight/2-a).fn(t)},C=await Ye(Wt(b,p.scrollHeight+v+m.clientTop),f),F=await Ye(b,{...f,elementContext:"reference"}),O=ze(0,C.top),T=b.y+O,R=(p.scrollHeight>p.clientHeight?M=>M:Vn)(ze(0,p.scrollHeight+(g&&y||E?v*2:0)-O-ze(0,C.bottom)));if(p.style.maxHeight=R+"px",p.scrollTop=O,o){const M=p.offsetHeight<d.offsetHeight*Kn(l,n.current.length)-1||F.top>=-s||F.bottom>=-s;Ne.flushSync(()=>o(M))}return r&&(r.current=await Ye(Wt({...b,y:T},p.offsetHeight+v+m.clientTop),f)),{y:T}}});function Vo(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:a,scrollRef:i,onChange:l}=t,s=Pn(l),c=u.useRef(!1),f=u.useRef(null),h=u.useRef(null);u.useEffect(()=>{if(!o)return;function d(v){if(v.ctrlKey||!p||a.current==null)return;const g=v.deltaY,E=a.current.top>=-.5,y=a.current.bottom>=-.5,b=p.scrollHeight-p.clientHeight,C=g<0?-1:1,F=g<0?"max":"min";p.scrollHeight<=p.clientHeight||(!E&&g>0||!y&&g<0?(v.preventDefault(),Ne.flushSync(()=>{s(O=>O+Math[F](g,b*C))})):/firefox/i.test(To())&&(p.scrollTop+=g))}const p=(i==null?void 0:i.current)||r.floating;if(n&&p)return p.addEventListener("wheel",d),requestAnimationFrame(()=>{f.current=p.scrollTop,a.current!=null&&(h.current={...a.current})}),()=>{f.current=null,h.current=null,p.removeEventListener("wheel",d)}},[o,n,r.floating,a,i,s]);const m=u.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const d=(i==null?void 0:i.current)||r.floating;if(!(!a.current||!d||!c.current)){if(f.current!==null){const p=d.scrollTop-f.current;(a.current.bottom<-.5&&p<-1||a.current.top<-.5&&p>1)&&Ne.flushSync(()=>s(v=>v+p))}requestAnimationFrame(()=>{f.current=d.scrollTop})}}}),[r.floating,s,a,i]);return u.useMemo(()=>o?{floating:m}:{},[o,m])}let Ce=u.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Ce.displayName="FloatingContext";let Pt=u.createContext(null);Pt.displayName="PlacementContext";function Ko(e){return u.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function qo(){return u.useContext(Ce).setReference}function Zl(){return u.useContext(Ce).getReferenceProps}function Yo(){let{getFloatingProps:e,slot:t}=u.useContext(Ce);return u.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function zo(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=u.useContext(Pt),n=u.useMemo(()=>e,[JSON.stringify(e,(o,a)=>{var i;return(i=a==null?void 0:a.outerHTML)!=null?i:a})]);N(()=>{t==null||t(n??null)},[t,n]);let r=u.useContext(Ce);return u.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Gt=4;function Xo({children:e,enabled:t=!0}){let[n,r]=u.useState(null),[o,a]=u.useState(0),i=u.useRef(null),[l,s]=u.useState(null);Jo(l);let c=t&&n!==null&&l!==null,{to:f="bottom",gap:h=0,offset:m=0,padding:d=0,inner:p}=Qo(n,l),[v,g="center"]=f.split(" ");N(()=>{c&&a(0)},[c]);let{refs:E,floatingStyles:y,context:b}=Wo({open:c,placement:v==="selection"?g==="center"?"bottom":`bottom-${g}`:g==="center"?`${v}`:`${v}-${g}`,strategy:"absolute",transform:!1,middleware:[Kt({mainAxis:v==="selection"?0:h,crossAxis:m}),qn({padding:d}),v!=="selection"&&Yn({padding:d}),v==="selection"&&p?Uo({...p,padding:d,overflowRef:i,offset:o,minItemsVisible:Gt,referenceOverflowThreshold:d,onFallbackChange(M){var I,D;if(!M)return;let w=b.elements.floating;if(!w)return;let H=parseFloat(getComputedStyle(w).scrollPaddingBottom)||0,K=Math.min(Gt,w.childElementCount),V=0,_=0;for(let k of(D=(I=b.elements.floating)==null?void 0:I.childNodes)!=null?D:[])if(re(k)){let j=k.offsetTop,le=j+k.clientHeight+H,te=w.scrollTop,S=te+w.clientHeight;if(j>=te&&le<=S)K--;else{_=Math.max(0,Math.min(le,S)-Math.max(j,te)),V=k.clientHeight;break}}K>=1&&a(k=>{let j=V*K-_+H;return k>=j?k:j})}}):null,zn({padding:d,apply({availableWidth:M,availableHeight:I,elements:D}){Object.assign(D.floating.style,{overflow:"auto",maxWidth:`${M}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${I}px)`})}})].filter(Boolean),whileElementsMounted:Xn}),[C=v,F=g]=b.placement.split("-");v==="selection"&&(C="selection");let O=u.useMemo(()=>({anchor:[C,F].filter(Boolean).join(" ")}),[C,F]),T=Vo(b,{overflowRef:i,onChange:a}),{getReferenceProps:W,getFloatingProps:Q}=Go([T]),R=x(M=>{s(M),E.setFloating(M)});return u.createElement(Pt.Provider,{value:r},u.createElement(Ce.Provider,{value:{setFloating:R,setReference:E.setReference,styles:y,getReferenceProps:W,getFloatingProps:Q,slot:O}},e))}function Jo(e){N(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function Qo(e,t){var n,r,o;let a=ot((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),i=ot((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),l=ot((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:a,offset:i,padding:l}}function ot(e,t,n=void 0){let r=Be(),o=x((s,c)=>{if(s==null)return[n,null];if(typeof s=="number")return[s,null];if(typeof s=="string"){if(!c)return[n,null];let f=Ut(s,c);return[f,h=>{let m=Sn(s);{let d=m.map(p=>window.getComputedStyle(c).getPropertyValue(p));r.requestAnimationFrame(function p(){r.nextFrame(p);let v=!1;for(let[E,y]of m.entries()){let b=window.getComputedStyle(c).getPropertyValue(y);if(d[E]!==b){d[E]=b,v=!0;break}}if(!v)return;let g=Ut(s,c);f!==g&&(h(g),f=g)})}return r.dispose}]}return[n,null]}),a=u.useMemo(()=>o(e,t)[0],[e,t]),[i=a,l]=u.useState();return N(()=>{let[s,c]=o(e,t);if(l(s),!!c)return c(l)},[e,t]),i}function Sn(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...Sn(o)]:[r]}return[]}function Ut(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}let _e=u.createContext(null);_e.displayName="OpenClosedContext";var Y=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Y||{});function We(){return u.useContext(_e)}function Cn({value:e,children:t}){return P.createElement(_e.Provider,{value:e},t)}function Zo({children:e}){return P.createElement(_e.Provider,{value:null},e)}function xn(e){let t=x(e),n=u.useRef(!1);u.useEffect(()=>(n.current=!1,()=>{n.current=!0,ln(()=>{n.current&&t()})}),[t])}function el(){let e=typeof document>"u";return"useSyncExternalStore"in lt?(t=>t.useSyncExternalStore)(lt)(()=>()=>{},()=>!1,()=>!e):!1}function St(){let e=el(),[t,n]=u.useState(be.isHandoffComplete);return t&&be.isHandoffComplete===!1&&n(!1),u.useEffect(()=>{t!==!0&&n(!0)},[t]),u.useEffect(()=>be.handoff(),[]),e?!1:t}let Fn=u.createContext(!1);function tl(){return u.useContext(Fn)}function ea(e){return P.createElement(Fn.Provider,{value:e.force},e.children)}function nl(e){let t=tl(),n=u.useContext(On),[r,o]=u.useState(()=>{var a;if(!t&&n!==null)return(a=n.current)!=null?a:null;if(be.isServer)return null;let i=e==null?void 0:e.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let l=e.createElement("div");return l.setAttribute("id","headlessui-portal-root"),e.body.appendChild(l)});return u.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),u.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let Tn=u.Fragment,rl=z(function(e,t){let{ownerDocument:n=null,...r}=e,o=u.useRef(null),a=Z(dn(d=>{o.current=d}),t),i=Pe(o),l=n??i,s=nl(l),[c]=u.useState(()=>{var d;return be.isServer?null:(d=l==null?void 0:l.createElement("div"))!=null?d:null}),f=u.useContext(mt),h=St();N(()=>{!s||!c||s.contains(c)||(c.setAttribute("data-headlessui-portal",""),s.appendChild(c))},[s,c]),N(()=>{if(c&&f)return f.register(c)},[f,c]),xn(()=>{var d;!s||!c||(un(c)&&s.contains(c)&&s.removeChild(c),s.childNodes.length<=0&&((d=s.parentElement)==null||d.removeChild(s)))});let m=ee();return h?!s||!c?null:Ne.createPortal(m({ourProps:{ref:a},theirProps:r,slot:{},defaultTag:Tn,name:"Portal"}),c):null});function ol(e,t){let n=Z(t),{enabled:r=!0,ownerDocument:o,...a}=e,i=ee();return r?P.createElement(rl,{...a,ownerDocument:o,ref:n}):i({ourProps:{ref:n},theirProps:a,slot:{},defaultTag:Tn,name:"Portal"})}let ll=u.Fragment,On=u.createContext(null);function al(e,t){let{target:n,...r}=e,o={ref:Z(t)},a=ee();return P.createElement(On.Provider,{value:n},a({ourProps:o,theirProps:r,defaultTag:ll,name:"Popover.Group"}))}let mt=u.createContext(null);function ul(){let e=u.useContext(mt),t=u.useRef([]),n=x(a=>(t.current.push(a),e&&e.register(a),()=>r(a))),r=x(a=>{let i=t.current.indexOf(a);i!==-1&&t.current.splice(i,1),e&&e.unregister(a)}),o=u.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,u.useMemo(()=>function({children:a}){return P.createElement(mt.Provider,{value:o},a)},[o])]}let sl=z(ol),il=z(al),cl=Object.assign(sl,{Group:il});function fl({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let r=Pe(n),o=x(()=>{var a,i;let l=[];for(let s of e)s!==null&&(de(s)?l.push(s):"current"in s&&de(s.current)&&l.push(s.current));if(t!=null&&t.current)for(let s of t.current)l.push(s);for(let s of(a=r==null?void 0:r.querySelectorAll("html > *, body > *"))!=null?a:[])s!==document.body&&s!==document.head&&de(s)&&s.id!=="headlessui-portal-root"&&(n&&(s.contains(n)||s.contains((i=n==null?void 0:n.getRootNode())==null?void 0:i.host))||l.some(c=>s.contains(c))||l.push(s));return l});return{resolveContainers:o,contains:x(a=>o().some(i=>i.contains(a)))}}let Rn=u.createContext(null);function kn({children:e,node:t}){let[n,r]=u.useState(null),o=Mn(t??n);return P.createElement(Rn.Provider,{value:o},e,o===null&&P.createElement(He,{features:Oe.Hidden,ref:a=>{var i,l;if(a){for(let s of(l=(i=Se(a))==null?void 0:i.querySelectorAll("html > *, body > *"))!=null?l:[])if(s!==document.body&&s!==document.head&&de(s)&&s!=null&&s.contains(a)){r(s);break}}}}))}function Mn(e=null){var t;return(t=u.useContext(Rn))!=null?t:e}function dl(){let e=u.useRef(!1);return N(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var ue=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(ue||{});function An(){let e=u.useRef(0);return yn(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function In(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Nn)!==u.Fragment||P.Children.count(e.children)===1}let Ge=u.createContext(null);Ge.displayName="TransitionContext";var pl=(e=>(e.Visible="visible",e.Hidden="hidden",e))(pl||{});function vl(){let e=u.useContext(Ge);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function ml(){let e=u.useContext(Ue);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Ue=u.createContext(null);Ue.displayName="NestingContext";function Ve(e){return"children"in e?Ve(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Ln(e,t){let n=se(e),r=u.useRef([]),o=dl(),a=Be(),i=x((d,p=ce.Hidden)=>{let v=r.current.findIndex(({el:g})=>g===d);v!==-1&&(J(p,{[ce.Unmount](){r.current.splice(v,1)},[ce.Hidden](){r.current[v].state="hidden"}}),a.microTask(()=>{var g;!Ve(r)&&o.current&&((g=n.current)==null||g.call(n))}))}),l=x(d=>{let p=r.current.find(({el:v})=>v===d);return p?p.state!=="visible"&&(p.state="visible"):r.current.push({el:d,state:"visible"}),()=>i(d,ce.Unmount)}),s=u.useRef([]),c=u.useRef(Promise.resolve()),f=u.useRef({enter:[],leave:[]}),h=x((d,p,v)=>{s.current.splice(0),t&&(t.chains.current[p]=t.chains.current[p].filter(([g])=>g!==d)),t==null||t.chains.current[p].push([d,new Promise(g=>{s.current.push(g)})]),t==null||t.chains.current[p].push([d,new Promise(g=>{Promise.all(f.current[p].map(([E,y])=>y)).then(()=>g())})]),p==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(p)):v(p)}),m=x((d,p,v)=>{Promise.all(f.current[p].splice(0).map(([g,E])=>E)).then(()=>{var g;(g=s.current.shift())==null||g()}).then(()=>v(p))});return u.useMemo(()=>({children:r,register:l,unregister:i,onStart:h,onStop:m,wait:c,chains:f}),[l,i,r,h,m,f,c])}let Nn=u.Fragment,Dn=we.RenderStrategy;function hl(e,t){var n,r;let{transition:o=!0,beforeEnter:a,afterEnter:i,beforeLeave:l,afterLeave:s,enter:c,enterFrom:f,enterTo:h,entered:m,leave:d,leaveFrom:p,leaveTo:v,...g}=e,[E,y]=u.useState(null),b=u.useRef(null),C=In(e),F=Z(...C?[b,t,y]:t===null?[]:[t]),O=(n=g.unmount)==null||n?ce.Unmount:ce.Hidden,{show:T,appear:W,initial:Q}=vl(),[R,M]=u.useState(T?"visible":"hidden"),I=ml(),{register:D,unregister:w}=I;N(()=>D(b),[D,b]),N(()=>{if(O===ce.Hidden&&b.current){if(T&&R!=="visible"){M("visible");return}return J(R,{hidden:()=>w(b),visible:()=>D(b)})}},[R,b,D,w,T,O]);let H=St();N(()=>{if(C&&H&&R==="visible"&&b.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[b,R,H,C]);let K=Q&&!W,V=W&&T&&Q,_=u.useRef(!1),k=Ln(()=>{_.current||(M("hidden"),w(b))},I),j=x(B=>{_.current=!0;let G=B?"enter":"leave";k.onStart(b,G,U=>{U==="enter"?a==null||a():U==="leave"&&(l==null||l())})}),le=x(B=>{let G=B?"enter":"leave";_.current=!1,k.onStop(b,G,U=>{U==="enter"?i==null||i():U==="leave"&&(s==null||s())}),G==="leave"&&!Ve(k)&&(M("hidden"),w(b))});u.useEffect(()=>{C&&o||(j(T),le(T))},[T,C,o]);let te=!(!o||!C||!H||K),[,S]=wt(te,E,T,{start:j,end:le}),q=ve({ref:F,className:((r=ft(g.className,V&&c,V&&f,S.enter&&c,S.enter&&S.closed&&f,S.enter&&!S.closed&&h,S.leave&&d,S.leave&&!S.closed&&p,S.leave&&S.closed&&v,!S.transition&&T&&m))==null?void 0:r.trim())||void 0,...yt(S)}),$=0;R==="visible"&&($|=Y.Open),R==="hidden"&&($|=Y.Closed),T&&R==="hidden"&&($|=Y.Opening),!T&&R==="visible"&&($|=Y.Closing);let L=ee();return P.createElement(Ue.Provider,{value:k},P.createElement(Cn,{value:$},L({ourProps:q,theirProps:g,defaultTag:Nn,features:Dn,visible:R==="visible",name:"Transition.Child"})))}function gl(e,t){let{show:n,appear:r=!1,unmount:o=!0,...a}=e,i=u.useRef(null),l=In(e),s=Z(...l?[i,t]:t===null?[]:[t]);St();let c=We();if(n===void 0&&c!==null&&(n=(c&Y.Open)===Y.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[f,h]=u.useState(n?"visible":"hidden"),m=Ln(()=>{n||h("hidden")}),[d,p]=u.useState(!0),v=u.useRef([n]);N(()=>{d!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),p(!1))},[v,n]);let g=u.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);N(()=>{n?h("visible"):!Ve(m)&&i.current!==null&&h("hidden")},[n,m]);let E={unmount:o},y=x(()=>{var F;d&&p(!1),(F=e.beforeEnter)==null||F.call(e)}),b=x(()=>{var F;d&&p(!1),(F=e.beforeLeave)==null||F.call(e)}),C=ee();return P.createElement(Ue.Provider,{value:m},P.createElement(Ge.Provider,{value:g},C({ourProps:{...E,as:u.Fragment,children:P.createElement(Hn,{ref:s,...E,...a,beforeEnter:y,beforeLeave:b})},theirProps:{},defaultTag:u.Fragment,features:Dn,visible:f==="visible",name:"Transition"})))}function bl(e,t){let n=u.useContext(Ge)!==null,r=We()!==null;return P.createElement(P.Fragment,null,!n&&r?P.createElement(ht,{ref:t,...e}):P.createElement(Hn,{ref:t,...e}))}let ht=z(gl),Hn=z(hl),El=z(bl),ta=Object.assign(ht,{Child:El,Root:ht});var $l=Object.defineProperty,yl=(e,t,n)=>t in e?$l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vt=(e,t,n)=>(yl(e,typeof t!="symbol"?t+"":t,n),n),A=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(A||{}),wl=(e=>(e[e.OpenPopover=0]="OpenPopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(wl||{});let Pl={0:e=>e.popoverState===0?e:{...e,popoverState:0,__demoMode:!1},1(e){return e.popoverState===1?e:{...e,popoverState:1,__demoMode:!1}},2(e,t){return e.button===t.button?e:{...e,button:t.button}},3(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},4(e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},5(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}};class Ct extends hn{constructor(t){super(t),Vt(this,"actions",{close:()=>this.send({type:1}),refocusableClose:n=>{this.actions.close();let r=n?re(n)?n:"current"in n&&re(n.current)?n.current:this.state.button:this.state.button;r==null||r.focus()},open:()=>this.send({type:0}),setButtonId:n=>this.send({type:3,buttonId:n}),setButton:n=>this.send({type:2,button:n}),setPanelId:n=>this.send({type:5,panelId:n}),setPanel:n=>this.send({type:4,panel:n})}),Vt(this,"selectors",{isPortalled:n=>{if(!n.button||!n.panel)return!1;for(let c of document.querySelectorAll("body > *"))if(Number(c==null?void 0:c.contains(n.button))^Number(c==null?void 0:c.contains(n.panel)))return!0;let r=ke(),o=r.indexOf(n.button),a=(o+r.length-1)%r.length,i=(o+1)%r.length,l=r[a],s=r[i];return!n.panel.contains(l)&&!n.panel.contains(s)}});{let n=this.state.id,r=En.get(null);this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new Ct({id:t,__demoMode:n,popoverState:n?0:1,buttons:{current:[]},button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:{current:null},afterPanelSentinel:{current:null},afterButtonSentinel:{current:null}})}reduce(t,n){return J(n.type,Pl,t,n)}}const jn=u.createContext(null);function Ke(e){let t=u.useContext(jn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ke),n}return t}function Sl({id:e,__demoMode:t=!1}){let n=u.useMemo(()=>Ct.new({id:e,__demoMode:t}),[]);return xn(()=>n.dispose()),n}let xt=u.createContext(null);xt.displayName="PopoverGroupContext";function Bn(){return u.useContext(xt)}let qe=u.createContext(null);qe.displayName="PopoverPanelContext";function Cl(){return u.useContext(qe)}let xl="div";function Fl(e,t){var n;let r=u.useId(),{__demoMode:o=!1,...a}=e,i=Sl({id:r,__demoMode:o}),l=u.useRef(null),s=Z(t,dn(w=>{l.current=w})),[c,f,h,m,d]=$e(i,u.useCallback(w=>[w.popoverState,w.button,w.panel,w.buttonId,w.panelId],[])),p=Pe((n=l.current)!=null?n:f),v=se(m),g=se(d),E=u.useMemo(()=>({buttonId:v,panelId:g,close:i.actions.close}),[v,g,i]),y=Bn(),b=y==null?void 0:y.registerPopover,C=x(()=>{var w;return(w=y==null?void 0:y.isFocusWithinPopoverGroup())!=null?w:(p==null?void 0:p.activeElement)&&((f==null?void 0:f.contains(p.activeElement))||(h==null?void 0:h.contains(p.activeElement)))});u.useEffect(()=>b==null?void 0:b(E),[b,E]);let[F,O]=ul(),T=Mn(f),W=fl({mainTreeNode:T,portals:F,defaultContainers:[{get current(){return i.state.button}},{get current(){return i.state.panel}}]});fo(p==null?void 0:p.defaultView,"focus",w=>{var H,K,V,_,k,j;w.target!==window&&he(w.target)&&i.state.popoverState===A.Open&&(C()||i.state.button&&i.state.panel&&(W.contains(w.target)||(K=(H=i.state.beforePanelSentinel.current)==null?void 0:H.contains)!=null&&K.call(H,w.target)||(_=(V=i.state.afterPanelSentinel.current)==null?void 0:V.contains)!=null&&_.call(V,w.target)||(j=(k=i.state.afterButtonSentinel.current)==null?void 0:k.contains)!=null&&j.call(k,w.target)||i.actions.close()))},!0);let Q=c===A.Open;co(Q,W.resolveContainers,(w,H)=>{i.actions.close(),$t(H,Et.Loose)||(w.preventDefault(),f==null||f.focus())});let R=u.useMemo(()=>({open:c===A.Open,close:i.actions.refocusableClose}),[c,i]),M=$e(i,u.useCallback(w=>J(w.popoverState,{[A.Open]:Y.Open,[A.Closed]:Y.Closed}),[])),I={ref:s},D=ee();return P.createElement(kn,{node:T},P.createElement(Xo,null,P.createElement(qe.Provider,{value:null},P.createElement(jn.Provider,{value:i},P.createElement(pn,{value:i.actions.refocusableClose},P.createElement(Cn,{value:M},P.createElement(O,null,D({ourProps:I,theirProps:a,slot:R,defaultTag:xl,name:"Popover"}))))))))}let Tl="button";function Ol(e,t){let n=u.useId(),{id:r=`headlessui-popover-button-${n}`,disabled:o=!1,autoFocus:a=!1,...i}=e,l=Ke("Popover.Button"),[s,c,f,h,m,d,p]=$e(l,u.useCallback($=>[$.popoverState,l.selectors.isPortalled($),$.button,$.buttonId,$.panel,$.panelId,$.afterButtonSentinel],[])),v=u.useRef(null),g=`headlessui-focus-sentinel-${u.useId()}`,E=Bn(),y=E==null?void 0:E.closeOthers,b=Cl()!==null;u.useEffect(()=>{if(!b)return l.actions.setButtonId(r),()=>l.actions.setButtonId(null)},[b,r,l]);let[C]=u.useState(()=>Symbol()),F=Z(v,t,qo(),x($=>{if(!b){if($)l.state.buttons.current.push(C);else{let L=l.state.buttons.current.indexOf(C);L!==-1&&l.state.buttons.current.splice(L,1)}l.state.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),$&&l.actions.setButton($)}})),O=Z(v,t),T=Pe(v),W=x($=>{var L,B,G;if(b){if(l.state.popoverState===A.Closed)return;switch($.key){case ie.Space:case ie.Enter:$.preventDefault(),(B=(L=$.target).click)==null||B.call(L),l.actions.close(),(G=l.state.button)==null||G.focus();break}}else switch($.key){case ie.Space:case ie.Enter:$.preventDefault(),$.stopPropagation(),l.state.popoverState===A.Closed?(y==null||y(l.state.buttonId),l.actions.open()):l.actions.close();break;case ie.Escape:if(l.state.popoverState!==A.Open)return y==null?void 0:y(l.state.buttonId);if(!v.current||T!=null&&T.activeElement&&!v.current.contains(T.activeElement))return;$.preventDefault(),$.stopPropagation(),l.actions.close();break}}),Q=x($=>{b||$.key===ie.Space&&$.preventDefault()}),R=x($=>{var L,B;cn($.currentTarget)||o||(b?(l.actions.close(),(L=l.state.button)==null||L.focus()):($.preventDefault(),$.stopPropagation(),l.state.popoverState===A.Closed?(y==null||y(l.state.buttonId),l.actions.open()):l.actions.close(),(B=l.state.button)==null||B.focus()))}),M=x($=>{$.preventDefault(),$.stopPropagation()}),{isFocusVisible:I,focusProps:D}=$r({autoFocus:a}),{isHovered:w,hoverProps:H}=Er({isDisabled:o}),{pressed:K,pressProps:V}=xr({disabled:o}),_=s===A.Open,k=u.useMemo(()=>({open:_,active:K||_,disabled:o,hover:w,focus:I,autofocus:a}),[_,w,I,K,o,a]),j=po(e,f),le=dt(b?{ref:O,type:j,onKeyDown:W,onClick:R,disabled:o||void 0,autoFocus:a}:{ref:F,id:h,type:j,"aria-expanded":s===A.Open,"aria-controls":m?d:void 0,disabled:o||void 0,autoFocus:a,onKeyDown:W,onKeyUp:Q,onClick:R,onMouseDown:M},D,H,V),te=An(),S=x(()=>{if(!re(l.state.panel))return;let $=l.state.panel;function L(){J(te.current,{[ue.Forwards]:()=>fe($,ae.First),[ue.Backwards]:()=>fe($,ae.Last)})===je.Error&&fe(ke().filter(B=>B.dataset.headlessuiFocusGuard!=="true"),J(te.current,{[ue.Forwards]:ae.Next,[ue.Backwards]:ae.Previous}),{relativeTo:l.state.button})}L()}),q=ee();return P.createElement(P.Fragment,null,q({ourProps:le,theirProps:i,slot:k,defaultTag:Tl,name:"Popover.Button"}),_&&!b&&c&&P.createElement(He,{id:g,ref:p,features:Oe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:S}))}let Rl="div",kl=we.RenderStrategy|we.Static;function _n(e,t){let n=u.useId(),{id:r=`headlessui-popover-backdrop-${n}`,transition:o=!1,...a}=e,i=Ke("Popover.Backdrop"),l=$e(i,u.useCallback(E=>E.popoverState,[])),[s,c]=u.useState(null),f=Z(t,c),h=We(),[m,d]=wt(o,s,h!==null?(h&Y.Open)===Y.Open:l===A.Open),p=x(E=>{if(cn(E.currentTarget))return E.preventDefault();i.actions.close()}),v=u.useMemo(()=>({open:l===A.Open}),[l]),g={ref:f,id:r,"aria-hidden":!0,onClick:p,...yt(d)};return ee()({ourProps:g,theirProps:a,slot:v,defaultTag:Rl,features:kl,visible:m,name:"Popover.Backdrop"})}let Ml="div",Al=we.RenderStrategy|we.Static;function Il(e,t){let n=u.useId(),{id:r=`headlessui-popover-panel-${n}`,focus:o=!1,anchor:a,portal:i=!1,modal:l=!1,transition:s=!1,...c}=e,f=Ke("Popover.Panel"),h=$e(f,f.selectors.isPortalled),[m,d,p,v,g]=$e(f,u.useCallback(S=>[S.popoverState,S.button,S.__demoMode,S.beforePanelSentinel,S.afterPanelSentinel],[])),E=`headlessui-focus-sentinel-before-${n}`,y=`headlessui-focus-sentinel-after-${n}`,b=u.useRef(null),C=Ko(a),[F,O]=zo(C),T=Yo();C&&(i=!0);let[W,Q]=u.useState(null),R=Z(b,t,C?F:null,f.actions.setPanel,Q),M=Pe(d),I=Pe(b);N(()=>(f.actions.setPanelId(r),()=>f.actions.setPanelId(null)),[r,f]);let D=We(),[w,H]=wt(s,W,D!==null?(D&Y.Open)===Y.Open:m===A.Open);eo(w,d,f.actions.close),yo(p?!1:l&&w,I);let K=x(S=>{var q;switch(S.key){case ie.Escape:if(f.state.popoverState!==A.Open||!b.current||I!=null&&I.activeElement&&!b.current.contains(I.activeElement))return;S.preventDefault(),S.stopPropagation(),f.actions.close(),(q=f.state.button)==null||q.focus();break}});u.useEffect(()=>{var S;e.static||m===A.Closed&&((S=e.unmount)==null||S)&&f.actions.setPanel(null)},[m,e.unmount,e.static,f]),u.useEffect(()=>{if(p||!o||m!==A.Open||!b.current)return;let S=I==null?void 0:I.activeElement;b.current.contains(S)||fe(b.current,ae.First)},[p,o,b.current,m]);let V=u.useMemo(()=>({open:m===A.Open,close:f.actions.refocusableClose}),[m,f]),_=dt(C?T():{},{ref:R,id:r,onKeyDown:K,onBlur:o&&m===A.Open?S=>{var q,$,L,B,G;let U=S.relatedTarget;U&&b.current&&((q=b.current)!=null&&q.contains(U)||(f.actions.close(),((L=($=v.current)==null?void 0:$.contains)!=null&&L.call($,U)||(G=(B=g.current)==null?void 0:B.contains)!=null&&G.call(B,U))&&U.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...c.style,...O,"--button-width":Br(d,!0).width},...yt(H)}),k=An(),j=x(()=>{let S=b.current;if(!S)return;function q(){J(k.current,{[ue.Forwards]:()=>{var $;fe(S,ae.First)===je.Error&&(($=f.state.afterPanelSentinel.current)==null||$.focus())},[ue.Backwards]:()=>{var $;($=f.state.button)==null||$.focus({preventScroll:!0})}})}q()}),le=x(()=>{let S=b.current;if(!S)return;function q(){J(k.current,{[ue.Forwards]:()=>{if(!f.state.button)return;let $=ke(),L=$.indexOf(f.state.button),B=$.slice(0,L+1),G=[...$.slice(L+1),...B];for(let U of G.slice())if(U.dataset.headlessuiFocusGuard==="true"||W!=null&&W.contains(U)){let Ft=G.indexOf(U);Ft!==-1&&G.splice(Ft,1)}fe(G,ae.First,{sorted:!1})},[ue.Backwards]:()=>{var $;fe(S,ae.Previous)===je.Error&&(($=f.state.button)==null||$.focus())}})}q()}),te=ee();return P.createElement(Zo,null,P.createElement(qe.Provider,{value:r},P.createElement(pn,{value:f.actions.refocusableClose},P.createElement(cl,{enabled:i?e.static||w:!1,ownerDocument:M},w&&h&&P.createElement(He,{id:E,ref:v,features:Oe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:j}),te({ourProps:_,theirProps:c,slot:V,defaultTag:Ml,features:Al,visible:w,name:"Popover.Panel"}),w&&h&&P.createElement(He,{id:y,ref:g,features:Oe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:le})))))}let Ll="div";function Nl(e,t){let n=u.useRef(null),r=Z(n,t),[o,a]=u.useState([]),i=x(v=>{a(g=>{let E=g.indexOf(v);if(E!==-1){let y=g.slice();return y.splice(E,1),y}return g})}),l=x(v=>(a(g=>[...g,v]),()=>i(v))),s=x(()=>{var v;let g=Se(n);if(!g)return!1;let E=g.activeElement;return(v=n.current)!=null&&v.contains(E)?!0:o.some(y=>{var b,C;return((b=g.getElementById(y.buttonId.current))==null?void 0:b.contains(E))||((C=g.getElementById(y.panelId.current))==null?void 0:C.contains(E))})}),c=x(v=>{for(let g of o)g.buttonId.current!==v&&g.close()}),f=u.useMemo(()=>({registerPopover:l,unregisterPopover:i,isFocusWithinPopoverGroup:s,closeOthers:c}),[l,i,s,c]),h=u.useMemo(()=>({}),[]),m=e,d={ref:r},p=ee();return P.createElement(kn,null,P.createElement(xt.Provider,{value:f},p({ourProps:d,theirProps:m,slot:h,defaultTag:Ll,name:"Popover.Group"})))}let Dl=z(Fl),Hl=z(Ol),jl=z(_n),Bl=z(_n),_l=z(Il),Wl=z(Nl),na=Object.assign(Dl,{Button:Hl,Backdrop:Bl,Overlay:jl,Panel:_l,Group:Wl});export{$r as $,Mn as A,En as B,co as C,yo as D,fo as E,El as F,eo as G,fl as H,Zr as I,Zo as J,z as K,ee as L,ea as M,cl as N,il as O,kn as P,pn as Q,we as R,$e as S,ae as T,na as U,Kl as V,Er as W,xr as X,po as Y,cn as Z,dt as _,ie as a,Se as a0,hn as a1,Xl as a2,Kr as a3,so as a4,Xo as a5,Cn as a6,Ko as a7,zo as a8,Yo as a9,wt as aa,yt as ab,Br as ac,Zl as ad,qo as ae,Ql as af,Jl as ag,$t as ah,Et as ai,oe as aj,se as ak,ve as al,ql as am,Lr as an,Le as ao,un as ap,dn as aq,Pe as b,re as c,J as d,ue as e,pt as f,fe as g,He as h,he as i,xn as j,lo as k,St as l,dl as m,N as n,x as o,Be as p,ln as q,je as r,Oe as s,de as t,An as u,We as v,Y as w,ul as x,Z as y,ta as z};
@@ -1 +1 @@
1
- var n=Object.defineProperty;var d=(i,t,e)=>t in i?n(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var c=(i,t,e)=>d(i,typeof t!="symbol"?t+"":t,e);import{a,M as f}from"./file-gUDWL5Z6.js";import{b as p,a0 as u}from"./index-DH1v9iOD.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
+ 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-y5ZNtlGh.js";import{b as p,a0 as u}from"./index-DXRmsAbz.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};
@@ -231,7 +231,7 @@
231
231
  type="font/woff2"
232
232
  crossorigin="anonymous"
233
233
  />
234
- <script type="module" crossorigin src="/assets/index-DH1v9iOD.js"></script>
234
+ <script type="module" crossorigin src="/assets/index-DXRmsAbz.js"></script>
235
235
 
236
236
  </head>
237
237
 
@@ -1 +0,0 @@
1
- import{Q as x,a as m,v as h,P as a,a4 as c,a5 as D,a6 as P,r as T,j as u}from"./index-DH1v9iOD.js";import{g as b,T as g}from"./help-CfEW8yRZ.js";import{u as r}from"./editor-DQqZC36D.js";import"./index-Ditw2lX8.js";import"./floating-ui.react-dom-9Mo3XjFw.js";import"./Input-BGdTmRPV.js";import"./file-gUDWL5Z6.js";const d=24*60*60*1e3;function S(){const{modelName:o}=x(),p=m(e=>e.models),s=m(e=>e.lastSelectedModel),v=r(e=>e.previewTable),i=r(e=>e.setPreviewQuery),n=r(e=>e.setPreviewTable),t=h(o)||o===(s==null?void 0:s.name)?s:p.get(encodeURI(o)),l={model:t.displayName,start:a(c(Date.now()-d)),end:a(new Date),execution_time:a(c(Date.now()-d)),limit:1e3},{refetch:f}=D(l),{refetch:w}=P(l);return T.useEffect(()=>{i(void 0),n(void 0),f().then(({data:e})=>{i(e==null?void 0:e.sql)}),w().then(({data:e})=>{n(b(e))})},[t]),u.jsx("div",{className:"flex overflow-hidden w-full h-full px-2",children:u.jsx(g,{headline:t==null?void 0:t.displayName,data:v??[[],[]]})})}export{S as default};
@@ -1 +0,0 @@
1
- import{r as u,R as oe,g as Le,j as t,i as k,c as b,v as H,f as mt,b as M,a as D,l as T,I as me,B as $,m as R,P as Ie,a4 as Ue,a5 as xt,a6 as ht,H as ce,S as Pe,af as Ke,ag as pt,d as et,s as gt,e as bt,q as vt,F as B,D as jt,a7 as wt,_ as Nt,ah as yt}from"./index-DH1v9iOD.js";import{u as le,M as Tt}from"./project-YuVl6ae5.js";import{S as Ve}from"./SplitPane-CqYEXonR.js";import{E as te,M as Et}from"./file-gUDWL5Z6.js";import{u as N}from"./editor-DQqZC36D.js";import{I as y}from"./Input-BGdTmRPV.js";import{F as Pt,L as St}from"./ListboxShow-BRUdoaSL.js";import{B as Ye}from"./Banner-DFFgSp7_.js";import{m as Ct,h as tt,s as kt,K as xe,ak as we,y as he,o as se,n as Te,a4 as ue,L as pe,$ as st,_ as lt,d as fe,r as Ne,a0 as Dt,a as q,g as re,T as U,q as It,W as Ft,X as Mt,Y as Rt,R as Ze}from"./popover-BS2D7N_A.js";import{g as $e,G as Lt,F as _t,T as At}from"./help-CfEW8yRZ.js";import{M as $t,u as nt,a as _e,b as zt,c as Ot,C as Qt}from"./context-C6O7H5eL.js";import{V as Fe,F as Bt,a as Wt}from"./PlusCircleIcon-M3NGeHST.js";import{D as Ht}from"./ReportErrors-CaaGo6UD.js";import"./floating-ui.react-dom-9Mo3XjFw.js";import"./index-Ditw2lX8.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./help-6Q7f7fjd.js";import"./SourceList-BioJ2XB9.js";function Gt({onFocus:e}){let[s,l]=u.useState(!0),n=Ct();return s?oe.createElement(tt,{as:"button",type:"button",features:kt.Focusable,onFocus:i=>{i.preventDefault();let r,a=50;function d(){if(a--<=0){r&&cancelAnimationFrame(r);return}if(e()){if(cancelAnimationFrame(r),!n.current)return;l(!1);return}r=requestAnimationFrame(d)}r=requestAnimationFrame(d)}}):null}const rt=u.createContext(null);function qt(){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 a(){let d=n.get(s);d>1?n.set(s,d-1):n.delete(s)}return[r,a]}}}function Ut({children:e}){let s=u.useRef(qt());return u.createElement(rt.Provider,{value:s},e)}function at(e){let s=u.useContext(rt);if(!s)throw new Error("You must wrap your component in a <StableCollection>");let l=u.useId(),[n,i]=s.current.get(e,l);return u.useEffect(()=>i,[]),n}var Vt=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(Vt||{}),Yt=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(Yt||{}),Zt=(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))(Zt||{});let Xt={0(e,s){var l;let n=ue(e.tabs,f=>f.current),i=ue(e.panels,f=>f.current),r=n.filter(f=>{var g;return!((g=f.current)!=null&&g.hasAttribute("disabled"))}),a={...e,tabs:n,panels:i};if(s.index<0||s.index>n.length-1){let f=fe(Math.sign(s.index-e.selectedIndex),{[-1]:()=>1,0:()=>fe(Math.sign(s.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(r.length===0)return a;let g=fe(f,{0:()=>n.indexOf(r[0]),1:()=>n.indexOf(r[r.length-1])});return{...a,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 a;let o=(l=n.indexOf(p))!=null?l:e.selectedIndex;return o===-1&&(o=e.selectedIndex),{...a,selectedIndex:o}},1(e,s){if(e.tabs.includes(s.tab))return e;let l=e.tabs[e.selectedIndex],n=ue([...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:ue([...e.panels,s.panel],l=>l.current)}},4(e,s){return{...e,panels:e.panels.filter(l=>l!==s.panel)}}},ze=u.createContext(null);ze.displayName="TabsDataContext";function ie(e){let s=u.useContext(ze);if(s===null){let l=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,ie),l}return s}let Oe=u.createContext(null);Oe.displayName="TabsActionsContext";function Qe(e){let s=u.useContext(Oe);if(s===null){let l=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,Qe),l}return s}function Jt(e,s){return fe(s.type,Xt,e,s)}let Kt="div";function es(e,s){let{defaultIndex:l=0,vertical:n=!1,manual:i=!1,onChange:r,selectedIndex:a=null,...d}=e;const p=n?"vertical":"horizontal",o=i?"manual":"auto";let f=a!==null,g=we({isControlled:f}),E=he(s),[m,v]=u.useReducer(Jt,{info:g,selectedIndex:a??l,tabs:[],panels:[]}),I=u.useMemo(()=>({selectedIndex:m.selectedIndex}),[m.selectedIndex]),j=we(r||(()=>{})),c=we(m.tabs),w=u.useMemo(()=>({orientation:p,activation:o,...m}),[p,o,m]),h=se(P=>(v({type:1,tab:P}),()=>v({type:2,tab:P}))),C=se(P=>(v({type:3,panel:P}),()=>v({type:4,panel:P}))),L=se(P=>{_.current!==P&&j.current(P),f||v({type:0,index:P})}),_=we(f?e.selectedIndex:m.selectedIndex),z=u.useMemo(()=>({registerTab:h,registerPanel:C,change:L}),[]);Te(()=>{v({type:0,index:a??l})},[a]),Te(()=>{if(_.current===void 0||m.tabs.length<=0)return;let P=ue(m.tabs,G=>G.current);P.some((G,Y)=>m.tabs[Y]!==G)&&L(P.indexOf(m.tabs[_.current]))});let ne={ref:E},J=pe();return oe.createElement(Ut,null,oe.createElement(Oe.Provider,{value:z},oe.createElement(ze.Provider,{value:w},w.tabs.length<=0&&oe.createElement(Gt,{onFocus:()=>{var P,G;for(let Y of c.current)if(((P=Y.current)==null?void 0:P.tabIndex)===0)return(G=Y.current)==null||G.focus(),!0;return!1}}),J({ourProps:ne,theirProps:d,slot:I,defaultTag:Kt,name:"Tabs"}))))}let ts="div";function ss(e,s){let{orientation:l,selectedIndex:n}=ie("Tab.List"),i=he(s),r=u.useMemo(()=>({selectedIndex:n}),[n]),a=e,d={ref:i,role:"tablist","aria-orientation":l};return pe()({ourProps:d,theirProps:a,slot:r,defaultTag:ts,name:"Tabs.List"})}let ls="button";function ns(e,s){var l,n;let i=u.useId(),{id:r=`headlessui-tabs-tab-${i}`,disabled:a=!1,autoFocus:d=!1,...p}=e,{orientation:o,activation:f,selectedIndex:g,tabs:E,panels:m}=ie("Tab"),v=Qe("Tab"),I=ie("Tab"),[j,c]=u.useState(null),w=u.useRef(null),h=he(w,s,c);Te(()=>v.registerTab(w),[v,w]);let C=at("tabs"),L=E.indexOf(w);L===-1&&(L=C);let _=L===g,z=se(S=>{var Z;let je=S();if(je===Ne.Success&&f==="auto"){let ut=(Z=Dt(w))==null?void 0:Z.activeElement,qe=I.tabs.findIndex(ft=>ft.current===ut);qe!==-1&&v.change(qe)}return je}),ne=se(S=>{let Z=E.map(je=>je.current).filter(Boolean);if(S.key===q.Space||S.key===q.Enter){S.preventDefault(),S.stopPropagation(),v.change(L);return}switch(S.key){case q.Home:case q.PageUp:return S.preventDefault(),S.stopPropagation(),z(()=>re(Z,U.First));case q.End:case q.PageDown:return S.preventDefault(),S.stopPropagation(),z(()=>re(Z,U.Last))}if(z(()=>fe(o,{vertical(){return S.key===q.ArrowUp?re(Z,U.Previous|U.WrapAround):S.key===q.ArrowDown?re(Z,U.Next|U.WrapAround):Ne.Error},horizontal(){return S.key===q.ArrowLeft?re(Z,U.Previous|U.WrapAround):S.key===q.ArrowRight?re(Z,U.Next|U.WrapAround):Ne.Error}}))===Ne.Success)return S.preventDefault()}),J=u.useRef(!1),P=se(()=>{var S;J.current||(J.current=!0,(S=w.current)==null||S.focus({preventScroll:!0}),v.change(L),It(()=>{J.current=!1}))}),G=se(S=>{S.preventDefault()}),{isFocusVisible:Y,focusProps:ke}=st({autoFocus:d}),{isHovered:de,hoverProps:ve}=Ft({isDisabled:a}),{pressed:x,pressProps:F}=Mt({disabled:a}),O=u.useMemo(()=>({selected:_,hover:de,active:x,focus:Y,autofocus:d,disabled:a}),[_,de,Y,x,d,a]),De=lt({ref:h,onKeyDown:ne,onMouseDown:G,onClick:P,id:r,role:"tab",type:Rt(e,j),"aria-controls":(n=(l=m[L])==null?void 0:l.current)==null?void 0:n.id,"aria-selected":_,tabIndex:_?0:-1,disabled:a||void 0,autoFocus:d},ke,ve,F);return pe()({ourProps:De,theirProps:p,slot:O,defaultTag:ls,name:"Tabs.Tab"})}let rs="div";function as(e,s){let{selectedIndex:l}=ie("Tab.Panels"),n=he(s),i=u.useMemo(()=>({selectedIndex:l}),[l]),r=e,a={ref:n};return pe()({ourProps:a,theirProps:r,slot:i,defaultTag:rs,name:"Tabs.Panels"})}let os="div",is=Ze.RenderStrategy|Ze.Static;function cs(e,s){var l,n,i,r;let a=u.useId(),{id:d=`headlessui-tabs-panel-${a}`,tabIndex:p=0,...o}=e,{selectedIndex:f,tabs:g,panels:E}=ie("Tab.Panel"),m=Qe("Tab.Panel"),v=u.useRef(null),I=he(v,s);Te(()=>m.registerPanel(v),[m,v]);let j=at("panels"),c=E.indexOf(v);c===-1&&(c=j);let w=c===f,{isFocusVisible:h,focusProps:C}=st(),L=u.useMemo(()=>({selected:w,focus:h}),[w,h]),_=lt({ref:I,id:d,role:"tabpanel","aria-labelledby":(n=(l=g[c])==null?void 0:l.current)==null?void 0:n.id,tabIndex:w?p:-1},C),z=pe();return!w&&((i=o.unmount)==null||i)&&!((r=o.static)!=null&&r)?oe.createElement(tt,{"aria-hidden":"true",..._}):z({ourProps:_,theirProps:o,slot:L,defaultTag:os,features:is,visible:w,name:"Tabs.Panel"})}let ds=xe(ns),ot=xe(es),us=xe(ss),it=xe(as),ae=xe(cs),W=Object.assign(ds,{Group:ot,List:us,Panels:it,Panel:ae});function fs({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 ct=u.forwardRef(fs);function ms({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 xs=u.forwardRef(ms);function hs({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 ps=u.forwardRef(hs);function gs(e){switch(e){case te.SQL:return"SQL";case te.PY:return"Python";case te.YAML:case te.YML:return"YAML";default:return"Plain Text"}}function bs(e,s){return e.file.extension===te.SQL&&e.file.isLocal&&Le(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 vs({text:e,className:s}){return t.jsx("span",{className:b("font-normal",s),children:e})}function js({ok:e,className:s}){return t.jsx("span",{className:b("inline-block w-2 h-2 rounded-full",H(e)&&"bg-warning-500",mt(e)&&"bg-success-500",M(e)&&"bg-danger-500",s)})}A.Text=vs;A.Light=js;const Q={Model:"model",Test:"test",Macro:"macro",Hook:"hook",Log:"log",Config:"config",Seed:"seed",Metric:"metric",Schema:"schema",Unknown:"unknown"};function ws({tab:e}){const s=D(a=>a.isModel),l=N(a=>a.engine),n=N(a=>a.dialects),i=N(a=>a.refreshTab);u.useEffect(()=>{var d;const a=(d=n[0])==null?void 0:d.dialect_name;H(e.dialect)&&k(a)&&r(a)},[n,e]);function r(a){e.dialect=a,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:M(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:gs(e.file.extension)})}),bs(e,n)&&t.jsx(A,{className:"mr-2",text:"Dialect",children:t.jsx(y,{size:T.sm,children:({className:a,size:d})=>t.jsx(y.Selector,{className:a,size:d,list:n.map(p=>({text:p.dialect_title,value:me(p.dialect_name)?"sqlglot":p.dialect_name})),onChange:r,value:e.dialect})})}),s(e.file.path)&&!me(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:Ns(e.file.path)})})]})}function Ns(e){return me(e)?Q.Unknown:e.startsWith("models")?Q.Model:e.startsWith("tests")?Q.Test:e.startsWith("logs")?Q.Log:e.startsWith("macros")?Q.Macro:e.startsWith("hooks")?Q.Hook:e.startsWith("seeds")?Q.Seed:e.startsWith("metrics")?Q.Metric:["config.yaml","config.yml","config.py"].includes(e)?Q.Config:["external_models.yaml","schema.yaml"].includes(e)?Q.Schema:Q.Unknown}function Xe({tab:e,title:s}){const l=u.useRef(null),n=D(g=>g.addConfirmation),i=le(g=>g.setSelectedFile),r=N(g=>g.closeTab),a=N(g=>g.tab),d=e.file.id===(a==null?void 0:a.file.id);return u.useEffect(()=>{H(e)||(e.el=l.current??void 0)},[l,e]),u.useEffect(()=>{H(a)||setTimeout(()=>{var g;(g=a.el)==null||g.scrollIntoView({behavior:"smooth",inline:"center"})},300)},[a]),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:o})]})});function p(g){g.stopPropagation(),i(e.file)}function o(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 ys(){const e=D(c=>c.modules),s=D(c=>c.models),l=D(c=>c.lastSelectedModel),n=D(c=>c.setLastSelectedModel),i=le(c=>c.files),r=le(c=>c.selectedFile),a=le(c=>c.setSelectedFile),d=N(c=>c.tab),p=N(c=>c.tabs),o=N(c=>c.replaceTab),f=N(c=>c.createTab),g=N(c=>c.selectTab),E=N(c=>c.addTab),[m,v]=u.useMemo(()=>{const c=[],w=[];return p.forEach(h=>{h.file.isLocal&&c.push(h),h.file.isRemote&&w.push(h)}),[c,w]},[p]);return u.useEffect(()=>{if(H(r)||(d==null?void 0:d.file)===r||r instanceof Tt||M(e.hasFiles))return;n(s.get(r.path));const c=f(r);k(d)&&d.file instanceof Et&&M(d.file.isChanged)&&d.file.isRemote&&M(p.has(r))?o(d,c):E(c),g(c)},[r,e]),u.useEffect(()=>{if(H(l))return;const c=i.get(l.path);H(c)||a(c)},[l]),t.jsxs("div",{className:"flex items-center bg-neutral-5",children:[t.jsx($,{className:"h-6 m-0 ml-1 mr-2 border-none",variant:R.Alternative,size:T.sm,onClick:I,children:t.jsx(xs,{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((c,w)=>t.jsx(Xe,{tab:c,title:`Custom SQL ${w+1}`},c.id)),v.map(c=>t.jsx(Xe,{tab:c,title:c.file.name},c.id))]})]});function I(c){c.stopPropagation(),j()}function j(){const c=f();E(c),g(c),a(c.file)}}function Be({list:e,children:s=[],className:l,disabled:n=!1}){return t.jsxs(W.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(W,{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 Je=24*60*60*1e3,Ts=1e3,Ee=50;function Es({tab:e,isOpen:s=!0,toggle:l}){const n=D(a=>a.models),i=D(a=>a.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(Ps,{tab:e,model:r,isOpen:s,toggle:l}):t.jsx(Ss,{tab:e,isOpen:s,toggle:l})})}function Ps({tab:e,model:s,isOpen:l=!0,toggle:n}){const i=D(d=>d.environment),r=D(d=>d.environments),a=Array.from(r).filter(({isRemote:d})=>d).map(({name:d})=>({text:d,value:d}));return t.jsxs(W.Group,{children:[t.jsxs("div",{className:"flex w-full items-center",children:[t.jsx($,{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:R.Info,size:T.sm,onClick:d=>{d.stopPropagation(),n==null||n()},children:t.jsx(ct,{className:"w-4 h-4"})}),l&&t.jsx(Be,{className:"flex justify-center items-center",list:["Evaluate","Columns",a.length>1&&i.isRemote&&"Diff"].filter(Boolean)})]}),l&&t.jsxs(W.Panels,{className:"h-full w-full overflow-hidden",children:[t.jsx(W.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(Ds,{model:s})}),t.jsx(W.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($t,{nodeId:s.fqn,columns:s.columns,disabled:M(s.isModelSQL),withHandles:!1,withSource:!1,withDescription:!0,limit:10})}),a.length>1&&i.isRemote&&t.jsx(W.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(Is,{tab:e,model:s,list:a.filter(({value:d})=>i.name!==d),target:{text:i.name,value:i.name}})})]})]})}function Ss({tab:e,isOpen:s=!0,toggle:l}){return t.jsxs(W.Group,{children:[t.jsxs("div",{className:"flex w-full items-center",children:[t.jsx($,{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:R.Info,size:T.sm,onClick:n=>{n.stopPropagation(),l==null||l()},children:t.jsx(ct,{className:"w-4 h-4"})}),s&&t.jsx(Be,{className:"flex justify-center items-center",list:["Run Query","Diff"]})]}),s&&t.jsxs(W.Panels,{className:"h-full w-full overflow-hidden",children:[t.jsx(W.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(ks,{tab:e})}),t.jsx(W.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(Fs,{})})]})]})}function Cs({children:e}){return t.jsx("fieldset",{className:"flex my-3",children:e})}function Se({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 Ce({children:e}){return t.jsx("div",{className:"flex w-full py-1 px-1 justify-end",children:e})}function ks({tab:e}){const s=N(p=>p.setPreviewQuery),l=N(p=>p.setPreviewTable),n=N(p=>p.engine),{refetch:i,isFetching:r,cancel:a}=pt({sql:e.file.content});u.useEffect(()=>()=>{a()},[]);function d(){l(void 0),s(e.file.content),i().then(({data:p})=>{l($e(p))})}return t.jsxs(t.Fragment,{children:[t.jsx(Se,{}),t.jsx(ce,{}),t.jsxs(Ce,{children:[t.jsx($,{size:T.sm,variant:R.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(Pe,{className:"w-3"}),t.jsx("small",{className:"text-xs text-neutral-400 block mx-2",children:"Running Query..."}),t.jsx($,{size:T.sm,variant:R.Danger,onClick:p=>{p.stopPropagation(),a()},children:"Cancel"})]}):t.jsx($,{size:T.sm,variant:R.Alternative,disabled:r,onClick:p=>{p.stopPropagation(),d()},children:"Run Query"})]})]})}function Ds({model:e}){const s=D(m=>m.environment),l=D(m=>m.isModel),n=N(m=>m.setPreviewQuery),i=N(m=>m.setPreviewTable),[r,a]=u.useState({model:e.displayName,start:Ie(Ue(Date.now()-Je)),end:Ie(new Date),execution_time:Ie(Ue(Date.now()-Je)),limit:1e3}),{refetch:d}=xt({model:r.model,start:r.start,end:r.end,execution_time:r.execution_time,dialect:e.dialect,pretty:!0}),{refetch:p,isFetching:o,cancel:f}=ht(r),g=l(e.path)&&Object.values(r).every(Boolean);u.useEffect(()=>()=>{f()},[]);function E(){n(void 0),i(void 0),d().then(({data:m})=>{n(m==null?void 0:m.sql)}),p().then(({data:m})=>{i($e(m))})}return t.jsxs(t.Fragment,{children:[t.jsx(Se,{children:t.jsxs("form",{className:"w-full",children:[M(g)&&t.jsx(Cs,{children:t.jsx(Ye,{variant:R.Warning,children:t.jsxs(Ye.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(y,{className:"w-full mx-0",label:"Start Date",size:T.sm,children:({className:m})=>t.jsx(y.Textfield,{className:b(m,"w-full"),placeholder:"02/11/2023",value:r.start,onInput:v=>{v.stopPropagation(),a({...r,start:v.target.value??""})}})}),t.jsx(y,{className:"w-full mx-0",label:"End Date",size:T.sm,children:({className:m})=>t.jsx(y.Textfield,{className:b(m,"w-full"),placeholder:"02/13/2023",value:r.end,onInput:v=>{v.stopPropagation(),a({...r,end:v.target.value??""})}})}),t.jsx(y,{className:"w-full mx-0",label:"Execution Time",size:T.sm,children:({className:m})=>t.jsx(y.Textfield,{className:b(m,"w-full"),placeholder:"02/13/2023",value:r.execution_time,onInput:v=>{v.stopPropagation(),a({...r,execution_time:v.target.value??""})}})}),k(r.limit)&&t.jsx(y,{className:"w-full mx-0",label:"Limit",size:T.sm,children:({className:m})=>t.jsx(y.Textfield,{className:b(m,"w-full"),type:"number",placeholder:"1000",value:r.limit,onInput:v=>{v.stopPropagation(),a({...r,limit:v.target.valueAsNumber??Ts})}})})]})]})}),t.jsx(ce,{}),t.jsx(Ce,{children:t.jsx("div",{className:"flex w-full justify-end",children:l(e.path)&&o?t.jsxs("div",{className:"flex items-center",children:[t.jsx(Pe,{className:"w-3"}),t.jsx("small",{className:"text-xs text-neutral-400 block mx-2",children:"Evaluating..."}),t.jsx($,{size:T.sm,variant:R.Danger,onClick:m=>{m.stopPropagation(),f()},children:"Cancel"})]}):t.jsx($,{size:T.sm,variant:R.Alternative,disabled:M(g)||o||s.isInitialProd,onClick:m=>{m.stopPropagation(),E()},children:"Evaluate"})})})]})}function Is({tab:e,model:s,list:l,target:n}){const i=D(h=>h.isModel),r=N(h=>h.setPreviewDiff),[a,d]=u.useState(l[0].value),[p,o]=u.useState(Ee),[f,g]=u.useState(""),[E,m]=u.useState(""),{refetch:v,isFetching:I,cancel:j}=Ke({source:a,target:n.value,model_or_snapshot:s.name,limit:p,on:f,where:E}),c=u.useCallback(()=>{r(void 0),v().then(({data:h})=>{r(h)})},[s.name,s.hash]);u.useEffect(()=>()=>{j()},[]),u.useEffect(()=>{d(l[0].value)},[l]);const w=i(e.file.path)&&[a,n,p].every(Boolean);return t.jsxs(t.Fragment,{children:[t.jsx(Se,{children:t.jsx("form",{className:"w-full",children:t.jsxs("fieldset",{className:"px-2 w-full text-neutral-500",children:[t.jsx(y,{className:"w-full mx-0",label:"Source",disabled:l.length<2,size:T.sm,children:({disabled:h,className:C})=>t.jsx(y.Selector,{className:b(C,"w-full"),list:l,value:a,disabled:h,onChange:d})}),t.jsx(y,{className:"w-full mx-0",label:"Target",disabled:!0,children:({disabled:h,className:C})=>t.jsx(y.Textfield,{className:b(C,"w-full"),disabled:h,value:n.value})}),t.jsx(y,{className:"w-full mx-0",label:"Limit",size:T.sm,children:({className:h})=>t.jsx(y.Textfield,{className:b(h,"w-full"),type:"number",placeholder:"1000",value:p,onInput:C=>{C.stopPropagation(),o(C.target.valueAsNumber??Ee)}})}),t.jsx(y,{className:"w-full mx-0",label:"ON",size:T.sm,children:({className:h})=>t.jsx(y.Textfield,{className:b(h,"w-full"),placeholder:"s.id = t.id",value:f,onInput:C=>{C.stopPropagation(),g(C.target.value)}})}),t.jsx(y,{className:"w-full mx-0",label:"WHERE",size:T.sm,children:({className:h})=>t.jsx(y.Textfield,{className:b(h,"w-full"),placeholder:"id > 10",value:E,onInput:C=>{C.stopPropagation(),m(C.target.value)}})})]})})}),t.jsx(ce,{}),t.jsx(Ce,{children:t.jsx("div",{className:"flex w-full justify-end items-center px-2",children:I?t.jsxs("div",{className:"flex items-center",children:[t.jsx(Pe,{className:"w-3"}),t.jsx("small",{className:"text-xs text-neutral-400 block mx-2",children:"Getting Diff..."}),t.jsx($,{size:T.sm,variant:R.Danger,onClick:h=>{h.stopPropagation(),j()},children:"Cancel"})]}):t.jsx($,{className:"ml-2",size:T.sm,variant:R.Alternative,disabled:M(w)||I,onClick:h=>{h.stopPropagation(),c()},children:"Get Diff"})})})]})}function Fs(){const e=N(j=>j.setPreviewDiff),[s,l]=u.useState(""),[n,i]=u.useState(""),[r,a]=u.useState(Ee),[d,p]=u.useState(""),[o,f]=u.useState(""),{refetch:g,isFetching:E,cancel:m}=Ke({source:s,target:n,limit:r,on:d,where:o});u.useEffect(()=>()=>{m()},[]);function v(){e(void 0),g().then(({data:j})=>{e(j)})}const I=[s,n,r,d].every(Boolean);return t.jsxs(t.Fragment,{children:[t.jsx(Se,{children:t.jsx("form",{className:"w-full",children:t.jsxs("fieldset",{className:"px-2 w-full text-neutral-500",children:[t.jsx(y,{className:"w-full mx-0",label:"Source",size:T.sm,children:({className:j})=>t.jsx(y.Textfield,{className:b(j,"w-full"),placeholder:"exp.tst_model__dev",value:s,onInput:c=>{c.stopPropagation(),l(c.target.value)}})}),t.jsx(y,{className:"w-full mx-0",label:"Target",size:T.sm,children:({className:j})=>t.jsx(y.Textfield,{className:b(j,"w-full"),placeholder:"exp.tst_snapshot__1353336088",value:n,onInput:c=>{c.stopPropagation(),i(c.target.value)}})}),t.jsx(y,{className:"w-full mx-0",label:"Limit",size:T.sm,children:({className:j})=>t.jsx(y.Textfield,{className:b(j,"w-full"),type:"number",placeholder:"1000",value:r,onInput:c=>{c.stopPropagation(),a(c.target.valueAsNumber??Ee)}})}),t.jsx(y,{className:"w-full mx-0",label:"ON",size:T.sm,children:({className:j})=>t.jsx(y.Textfield,{className:b(j,"w-full"),placeholder:"s.id = t.id",value:d,onInput:c=>{c.stopPropagation(),p(c.target.value)}})}),t.jsx(y,{className:"w-full mx-0",label:"WHERE",size:T.sm,children:({className:j})=>t.jsx(y.Textfield,{className:b(j,"w-full"),placeholder:"id > 10",value:o,onInput:c=>{c.stopPropagation(),f(c.target.value)}})})]})})}),t.jsx(ce,{}),t.jsx(Ce,{children:E?t.jsxs("div",{className:"flex items-center",children:[t.jsx(Pe,{className:"w-3"}),t.jsx("small",{className:"text-xs text-neutral-400 block mx-2",children:"Getting Diff..."}),t.jsx($,{size:T.sm,variant:R.Danger,onClick:j=>{j.stopPropagation(),m()},children:"Cancel"})]}):t.jsx($,{className:"ml-2",size:T.sm,variant:R.Alternative,disabled:M(I)||E,onClick:j=>{j.stopPropagation(),v()},children:"Get Diff"})})]})}const ge="s__",be="t__",We="NULL";function Ms({source_schema:e,target_schema:s},l,n){const i=Array.from(new Set(n.flat())),r=Object.keys(e),a=Object.keys(s),p=Array.from(new Set(r.concat(a))).filter(g=>r.includes(g)&&a.includes(g)),o=r.filter(g=>!a.includes(g)),f=a.filter(g=>!r.includes(g));return{all:Array.from(new Set([i,l.modifiedColumns&&p,l.addedColumns&&f,l.removedColumns&&o].filter(Boolean).flat())),added:f.length,deleted:o.length,modified:p.length-i.length}}function Rs(e,s,l){const n=Object.values(e.row_diff.sample)[0]??{},i=[],r=[],a=[];return Object.keys(n).forEach(d=>{ee(e,d,l)?r.push(d):K(e,d,l)?i.push(d):a.push(d)}),{all:[s.modifiedRows&&a,s.addedRows&&r,s.removedRows&&i].filter(Boolean).flat(),added:r.length,deleted:i.length,modified:a.length}}function Ae(e,s,l){const n=V(e,ge,s,l),i=V(e,be,s,l);return n!==i}function K(e,s,l){return l.every(([n,i])=>{const r=V(e,ge,n,s),a=V(e,be,i,s);return k(r)&&H(a)})}function ee(e,s,l){return l.every(([n,i])=>{const r=V(e,ge,n,s),a=V(e,be,i,s);return H(r)&&k(a)})}function Me(e,s,l,n){return l in e.schema_diff.added||l in e.schema_diff.removed?!1:s.some(i=>M(ee(e,i,n))&&M(K(e,i,n))&&Ae(e,l,i))}function V(e,s,l,n){var i;return(i=e.row_diff.sample[`${s}${l}`])==null?void 0:i[n]}function Ls(e,s,l){return V(e,ge,s,l)??We}function _s(e,s,l){return V(e,be,s,l)??We}function As({diff:e}){const[s,l]=u.useState({modifiedRows:!0,addedRows:!0,removedRows:!0,modifiedColumns:!0,addedColumns:!0,removedColumns:!0}),n=Ms(e.schema_diff,s,e.on),i=Rs(e,s,e.on),r=s.addedRows&&!s.removedRows&&!s.modifiedRows,a=!s.addedRows&&s.removedRows&&!s.modifiedRows,d=Array.from(new Set(e.on.flat())),p=Object.values(e.row_diff.sample).some(o=>Object.keys(o).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(Os,{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(St,{options:Object.keys(s).reduce((o,f)=>(o[f]=g=>l(E=>({...E,[f]:g})),o),{}),value:Object.keys(s).map(o=>M(s[o])?void 0:o).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(o=>t.jsx("th",{colSpan:Me(e,i.all,o,e.on)?2:1,className:b("text-left whitespace-nowrap py-1 px-2 font-bold",o in e.schema_diff.added?"border-t-2 border-l-2 border-r-2 border-success-500":o in e.schema_diff.removed?"border-t-2 border-l-2 border-r-2 border-danger-500":d.includes(o)?"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(o)?"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:o})," ",t.jsxs("small",{className:"text-neutral-500 font-medium",children:["(",e.schema_diff.source_schema[o]??e.schema_diff.target_schema[o],")"]})]}),M(d.includes(o))&&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=>Ae(e,o,f)).length/i.all.length*100),"%"]})})]})},o))})}),t.jsx("tbody",{children:Le(i.all)?i.all.map(o=>t.jsx("tr",{children:n.all.map(f=>Me(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",ee(e,o,e.on)&&"bg-success-10 text-success-500",K(e,o,e.on)&&"bg-danger-5 text-danger-500"),children:t.jsx("div",{className:b("px-2 py-1 whitespace-nowrap font-bold rounded-md ",ee(e,o,e.on)&&"bg-success-10 text-success-500",K(e,o,e.on)&&"bg-danger-5 text-danger-500"),children:Ls(e,f,o)})},`${o}-${f}-source`),t.jsx("td",{className:b("p-1 border-r border-b border-neutral-100 dark:border-neutral-700 last:border-r-0",ee(e,o,e.on)&&"bg-success-10 text-success-500",K(e,o,e.on)&&"bg-danger-5 text-danger-500"),children:t.jsx("div",{className:b("px-2 py-1 whitespace-nowrap font-bold rounded-md",Ae(e,f,o)&&"bg-primary-10 text-primary-500",ee(e,o,e.on)&&"!bg-success-10 !text-success-500",K(e,o,e.on)&&"!bg-danger-5 !text-danger-500"),children:_s(e,f,o)})},`${o}-${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",K(e,o,e.on)&&"!bg-danger-5 text-danger-500 font-bold",ee(e,o,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||ee(e,o,e.on))&&"bg-success-10 text-success-500 font-bold",(f in e.schema_diff.removed||K(e,o,e.on))&&"!bg-danger-5 !text-danger-500 font-bold"),children:V(e,ge,f,o)??V(e,be,f,o)??We})},`${o}-${f}`))},o)):t.jsx(Lt,{columns:n.all.length>0?n.all.length:void 0})}),Le(i.all)&&t.jsx("tfoot",{className:"sticky bg-theme bottom-0",children:t.jsx("tr",{children:n.all.map(o=>Me(e,i.all,o,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(o)?"bg-brand-10":"bg-neutral-10"),children:"Source"},`${o}-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(o)?"bg-brand-10":"bg-primary-10"),children:"Target"},`${o}-target`)]}):t.jsxs("th",{className:b("text-left whitespace-nowrap px-2 py-1 font-bold",o in e.schema_diff.added?"border-b-2 border-l-2 border-r-2 border-success-500":o in e.schema_diff.removed?"border-b-2 border-l-2 border-r-2 border-danger-500":d.includes(o)?"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(o)?"bg-brand-10":"bg-neutral-10"),children:[(o in e.schema_diff.removed||a)&&t.jsx("span",{children:"Source"}),(o in e.schema_diff.added||r)&&t.jsx("span",{children:"Target"})]},o))})})]})}),t.jsxs("div",{className:"flex justify-between items-center px-2 mt-2",children:[t.jsx(_t,{count:i.all.length}),t.jsx($s,{})]})]})}function $s(){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(zs,{text:s,className:l},s))})}function zs({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 Os({diff:e,rows:s,columns:l}){return t.jsx(Fe,{defaultOpen:!1,children:({open:n})=>t.jsxs(t.Fragment,{children:[t.jsxs(Fe.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(Bt,{className:"h-6 w-6 text-primary-500"}):t.jsx(Wt,{className:"h-6 w-6 text-primary-500"})]}),t.jsx(Fe.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(Re,{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(Re,{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(Re,{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 Re({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 Qs=u.lazy(async()=>await Nt(()=>import("./ModelLineage-BVQJptIB.js"),[])),X={Query:"Query",Table:"Data Preview",Lineage:"Lineage",Diff:"Diff",Errors:"Errors"};function Bs({tab:e,className:s}){const{errors:l,removeError:n}=et(),i=gt(),r=D(h=>h.models),a=D(h=>h.isModel),d=N(h=>h.direction),p=N(h=>h.previewQuery),o=N(h=>h.previewTable),f=N(h=>h.previewDiff),g=N(h=>h.setDirection),[E,m]=u.useState(-1),v=nt(e.file.path,h=>{i(`${bt.DataCatalogModels}/${h.name}`)}),I=r.get(e.file.path),j=M(e.file.isEmpty)&&k(I)&&a(e.file.path),c=l.size>0,w=u.useMemo(()=>[k(o)&&X.Table,k(p)&&e.file.isRemote&&X.Query,j&&X.Lineage,k(f)&&X.Diff,c&&X.Errors].filter(Boolean),[e.id,o,p,f,j,l,c]);return u.useEffect(()=>{k(o)?m(w.indexOf(X.Table)):m(0)},[o]),u.useEffect(()=>{k(f)?m(w.indexOf(X.Diff)):m(0)},[f]),u.useEffect(()=>{k(j)?m(w.indexOf(X.Lineage)):m(0)},[j]),u.useEffect(()=>{m(c?w.indexOf(X.Errors):0)},[c]),u.useEffect(()=>{for(const h of l)vt([B.Fetchdf,B.EvaluateModel,B.RenderQuery,B.ColumnLineage,B.ModelLineage,B.TableDiff,B.Table,B.SaveFile],h.key)&&n(h)},[o,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:jt(w)?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(ot,{as:u.Fragment,onChange:m,selectedIndex:E,children:[t.jsx(Be,{list:w,children:t.jsx("div",{className:"ml-2",children:t.jsx($,{className:"!m-0 !py-0.5 px-[0.25rem] border-none",variant:R.Alternative,size:T.sm,onClick:()=>{g(d==="horizontal"?"vertical":"horizontal")},children:t.jsx(ps,{"aria-label":d==="horizontal"?"Use vertical layout":"Use horizontal layout",className:"text-primary-500 w-5"})})})},w.join("-")),t.jsxs(it,{className:"h-full w-full overflow-hidden",children:[k(o)&&t.jsx(ae,{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(At,{data:o})}),k(p)&&e.file.isRemote&&t.jsx(ae,{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(_e,{type:te.SQL,content:p??"",extensions:v,className:"text-xs"})})}),j&&t.jsx(ae,{as:"div",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(wt,{children:"Loading Model page..."}),children:t.jsx(Qs,{model:I})})}),k(f==null?void 0:f.row_diff)&&t.jsx(ae,{as:"div",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(As,{diff:f},e.id)}),c&&t.jsx(ae,{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(h=>t.jsx("li",{className:"bg-danger-10 mb-4 last:m-0 p-2 rounded-md",children:t.jsx(Ht,{scope:h.key,error:h})},h.id))})})]})]},e.id)})}const ye=32,Ws=2;function He(){const e=N(s=>s.tab);return t.jsxs("div",{className:"w-full h-full flex flex-col overflow-hidden",children:[t.jsx(ys,{}),t.jsx(ce,{}),H(e)?t.jsx(Ge,{}):t.jsx(dt,{tab:e})]})}function Ge(){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 dt({tab:e}){const{errors:s,addError:l,removeError:n}=et(),i=D(x=>x.environment),r=D(x=>x.models),a=D(x=>x.isModel),d=le(x=>x.files),p=le(x=>x.selectedFile),o=le(x=>x.setSelectedFile),f=N(x=>x.direction),g=N(x=>x.engine),E=N(x=>x.previewTable),m=N(x=>x.previewDiff),v=N(x=>x.refreshTab),I=N(x=>x.updateStoredTabsIds),j=N(x=>x.setPreviewQuery),c=N(x=>x.setPreviewTable),w=N(x=>x.setPreviewDiff),h=N(x=>x.setDialects),{setManuallySelectedColumn:C}=zt(),L=u.useCallback(function(x){o(d.get(x.path))},[d]),_=u.useCallback(function(x,F){C([x,F])},[]),z=Ot(),ne=nt(e.file.path,L,_),[J,P]=u.useState(!1),G=u.useMemo(()=>[...z,{key:"Mod-Enter",win:"Ctrl-Enter",preventDefault:!0,stopPropagation:!0,run(x){const F=x.state.doc.toString();c(void 0),j(F);for(const O of s)O.key===B.Fetchdf&&n(O);return yt({sql:F}).then(O=>{c($e(O))}).catch(O=>{l(B.Fetchdf,{...O,errorKey:B.Fetchdf,trigger:"Editor -> customSQLKeymaps",message:O.message,timestamp:Date.now(),origin:"useQueryTimeout"})}),!0}}],[z,s]);u.useEffect(()=>{P(!1),H(p)&&o(e==null?void 0:e.file)},[e.id]),u.useEffect(()=>(g.addEventListener("message",ve),()=>{g.removeEventListener("message",ve)}),[e.id,e.dialect]),u.useEffect(()=>{j(void 0),c(void 0),w(void 0),I()},[e.id,e.file.fingerprint]),u.useEffect(()=>{w(void 0)},[i]);function Y(){const x=r.get(e.file.path),F=M(e.file.isEmpty)&&k(x)&&a(e.file.path);return s.size>0||[E,m].some(Boolean)||F?[70,30]:[100,0]}function ke(){const x=r.get(e==null?void 0:e.file.path);return J&&(k(x)&&a(e.file.path)||e.file.isLocal)&&M(me(e.file.content))?[70,30]:[100,0]}function de(x){e.file.content=x,v(e)}function ve(x){if(x.data.topic==="dialects"){const F=r.get(e.file.path);e.dialect=(F==null?void 0:F.dialect)??e.dialect??"",h(x.data.payload),v(e)}if(x.data.topic==="format"){if(me(x.data.payload))return;e.file.content=x.data.payload,v(e)}}return t.jsxs(Ve,{className:b("w-full h-full overflow-hidden",f==="vertical"?"flex flex-col":"flex"),sizes:Y(),direction:f,minSize:[ye,0],snapOffset:0,children:[t.jsxs("div",{className:b("flex flex-col",f==="vertical"?"w-full ":"h-full"),children:[t.jsxs(Ve,{className:"flex h-full overflow-hidden",sizes:ke(),minSize:ye,snapOffset:ye,handleDrag:(x,F)=>{const De=F.parent.getBoundingClientRect().width*(x[1]??0)/100;P(De>=ye+Ws)},children:[t.jsxs("div",{className:"flex flex-col h-full",children:[e.file.isLocal&&t.jsx(_e,{type:te.SQL,dialect:e.dialect,keymaps:G,content:e.file.content,extensions:ne,onChange:de}),e.file.isRemote&&t.jsx(Qt,{keymaps:z,path:e.file.path,children:({file:x,keymaps:F})=>t.jsx(_e,{type:x.extension,dialect:e.dialect,extensions:ne,keymaps:F,content:x.content,onChange:de})})]}),t.jsx("div",{className:"flex flex-col h-full",children:t.jsx(Es,{tab:e,toggle:()=>P(x=>!x),isOpen:J})})]},e.id),t.jsx(ce,{}),t.jsx(ws,{tab:e},e.file.fingerprint)]}),t.jsx(Bs,{tab:e,className:b(f==="vertical"?"flex flex-col":"flex")})]},f)}He.Empty=Ge;He.Loading=Ge;He.Main=dt;export{He as default};
@@ -1 +0,0 @@
1
- import{s as u,Q as c,a as n,v as a,j as s,e as f}from"./index-DH1v9iOD.js";import{L as g}from"./context-C6O7H5eL.js";import x from"./ModelLineage-BVQJptIB.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./floating-ui.react-dom-9Mo3XjFw.js";import"./editor-DQqZC36D.js";import"./file-gUDWL5Z6.js";import"./project-YuVl6ae5.js";import"./help-6Q7f7fjd.js";import"./SourceList-BioJ2XB9.js";import"./Input-BGdTmRPV.js";import"./index-Ditw2lX8.js";import"./popover-BS2D7N_A.js";import"./ListboxShow-BRUdoaSL.js";import"./SearchList-vj2s_Pnb.js";function S(){const l=u(),{modelName:t}=c(),i=n(e=>e.models),o=n(e=>e.lastSelectedModel),r=a(t)||t===(o==null?void 0:o.name)?o:i.get(encodeURI(t));function d(e){const m=i.get(e);a(m)||l(f.LineageModels+"/"+m.name)}function p(e){console.log(e==null?void 0:e.message)}return s.jsx("div",{className:"flex overflow-hidden w-full h-full",children:s.jsx(g,{showColumns:!0,handleClickModel:d,handleError:p,children:s.jsx(x,{model:r})})})}export{S as default};
@@ -1 +0,0 @@
1
- import{r as i,R as S,j as k,b as tt,c as Oe}from"./index-DH1v9iOD.js";import{o as C,p as Te,h as Pe,al as nt,s as Me,K,y as G,n as H,L as Z,am as rt,V as Se,an as ot,I as lt,aj as Ae,a0 as Ne,ao as ye,ap as it,i as at,c as je,a1 as st,a2 as ve,d as q,B as _e,a3 as ut,a4 as ct,j as dt,S as A,C as pt,a5 as ft,a6 as vt,w as le,ak as mt,a7 as bt,b as $e,v as ht,aa as gt,G as xt,D as Ot,a8 as St,a9 as yt,a as I,af as $t,T as Ee,_ as Be,ab as Et,ac as wt,N as It,ae as Rt,ad as Ct,Z as Lt,$ as kt,W as Dt,X as Ft,Y as Tt,R as we,ah as Pt,ai as Mt,z as At}from"./popover-BS2D7N_A.js";import{r as Y}from"./floating-ui.react-dom-9Mo3XjFw.js";import{t as Nt,v as jt}from"./Input-BGdTmRPV.js";function _t({title:e,titleId:n,...t},r){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":n},t),e?i.createElement("title",{id:n},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"}))}const Bt=i.forwardRef(_t);let Ut=i.createContext(void 0);function he(){return i.useContext(Ut)}function zt(e,n,t){let[r,o]=i.useState(t),l=e!==void 0,a=i.useRef(l),s=i.useRef(!1),c=i.useRef(!1);return l&&!a.current&&!s.current?(s.current=!0,a.current=l,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!l&&a.current&&!c.current&&(c.current=!0,a.current=l,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[l?e:r,C(d=>(l||o(d),n==null?void 0:n(d)))]}function Qt(e){let[n]=i.useState(e);return n}function Ue(e={},n=null,t=[]){for(let[r,o]of Object.entries(e))Qe(t,ze(n,r),o);return t}function ze(e,n){return e?e+"["+n+"]":n}function Qe(e,n,t){if(Array.isArray(t))for(let[r,o]of t.entries())Qe(e,ze(n,r.toString()),o);else t instanceof Date?e.push([n,t.toISOString()]):typeof t=="boolean"?e.push([n,t?"1":"0"]):typeof t=="string"?e.push([n,t]):typeof t=="number"?e.push([n,`${t}`]):t==null?e.push([n,""]):Ue(t,n,e)}function Vt(e){var n,t;let r=(n=e==null?void 0:e.form)!=null?n:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(t=r.requestSubmit)==null||t.call(r)}}let Ht=i.createContext(null);function Kt({children:e}){let n=i.useContext(Ht);if(!n)return S.createElement(S.Fragment,null,e);let{target:t}=n;return t?Y.createPortal(S.createElement(S.Fragment,null,e),t):null}function Gt({data:e,form:n,disabled:t,onReset:r,overrides:o}){let[l,a]=i.useState(null),s=Te();return i.useEffect(()=>{if(r&&l)return s.addEventListener(l,"reset",r)},[l,n,r]),S.createElement(Kt,null,S.createElement(Zt,{setForm:a,formId:n}),Ue(e).map(([c,d])=>S.createElement(Pe,{features:Me.Hidden,...nt({key:c,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:n,disabled:t,name:c,value:d,...o})})))}function Zt({setForm:e,formId:n}){return i.useEffect(()=>{if(n){let t=document.getElementById(n);t&&e(t)}},[e,n]),n?null:S.createElement(Pe,{features:Me.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:t=>{if(!t)return;let r=t.closest("form");r&&e(r)}})}let Xt=i.createContext(void 0);function Ve(){return i.useContext(Xt)}let ie=i.createContext(null);ie.displayName="DescriptionContext";function He(){let e=i.useContext(ie);if(e===null){let n=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(n,He),n}return e}function Yt(){var e,n;return(n=(e=i.useContext(ie))==null?void 0:e.value)!=null?n:void 0}function Qn(){let[e,n]=i.useState([]);return[e.length>0?e.join(" "):void 0,i.useMemo(()=>function(t){let r=C(l=>(n(a=>[...a,l]),()=>n(a=>{let s=a.slice(),c=s.indexOf(l);return c!==-1&&s.splice(c,1),s}))),o=i.useMemo(()=>({register:r,slot:t.slot,name:t.name,props:t.props,value:t.value}),[r,t.slot,t.name,t.props,t.value]);return S.createElement(ie.Provider,{value:o},t.children)},[n])]}let qt="p";function Wt(e,n){let t=i.useId(),r=he(),{id:o=`headlessui-description-${t}`,...l}=e,a=He(),s=G(n);H(()=>a.register(o),[o,a.register]);let c=r||!1,d=i.useMemo(()=>({...a.slot,disabled:c}),[a.slot,c]),p={ref:s,...a.props,id:o};return Z()({ourProps:p,theirProps:l,slot:d,defaultTag:qt,name:a.name||"Description"})}let Jt=K(Wt),Vn=Object.assign(Jt,{}),ae=i.createContext(null);ae.displayName="LabelContext";function Ke(){let e=i.useContext(ae);if(e===null){let n=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(n,Ke),n}return e}function Ge(e){var n,t,r;let o=(t=(n=i.useContext(ae))==null?void 0:n.value)!=null?t:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function en({inherit:e=!1}={}){let n=Ge(),[t,r]=i.useState([]),o=e?[n,...t].filter(Boolean):t;return[o.length>0?o.join(" "):void 0,i.useMemo(()=>function(l){let a=C(c=>(r(d=>[...d,c]),()=>r(d=>{let p=d.slice(),m=p.indexOf(c);return m!==-1&&p.splice(m,1),p}))),s=i.useMemo(()=>({register:a,slot:l.slot,name:l.name,props:l.props,value:l.value}),[a,l.slot,l.name,l.props,l.value]);return S.createElement(ae.Provider,{value:s},l.children)},[r])]}let tn="label";function nn(e,n){var t;let r=i.useId(),o=Ke(),l=Ve(),a=he(),{id:s=`headlessui-label-${r}`,htmlFor:c=l??((t=o.props)==null?void 0:t.htmlFor),passive:d=!1,...p}=e,m=G(n);H(()=>o.register(s),[s,o.register]);let f=C(y=>{let P=y.currentTarget;if(!(y.target!==y.currentTarget&&rt(y.target))&&(Se(P)&&y.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(y),Se(P))){let O=document.getElementById(P.htmlFor);if(O){let $=O.getAttribute("disabled");if($==="true"||$==="")return;let R=O.getAttribute("aria-disabled");if(R==="true"||R==="")return;(ot(O)&&(O.type==="file"||O.type==="radio"||O.type==="checkbox")||O.role==="radio"||O.role==="checkbox"||O.role==="switch")&&O.click(),O.focus({preventScroll:!0})}}}),u=a||!1,x=i.useMemo(()=>({...o.slot,disabled:u}),[o.slot,u]),w={ref:m,...o.props,id:s,htmlFor:c,onClick:f};return d&&("onClick"in w&&(delete w.htmlFor,delete w.onClick),"onClick"in p&&delete p.onClick),Z()({ourProps:w,theirProps:p,slot:x,defaultTag:c?tn:"div",name:o.name||"Label"})}let rn=K(nn),on=Object.assign(rn,{});function ln(e,n){return e!==null&&n!==null&&typeof e=="object"&&typeof n=="object"&&"id"in e&&"id"in n?e.id===n.id:e===n}function an(e=ln){return i.useCallback((n,t)=>{if(typeof e=="string"){let r=e;return(n==null?void 0:n[r])===(t==null?void 0:t[r])}return e(n,t)},[e])}let me=new Map,J=new Map;function Ie(e){var n;let t=(n=J.get(e))!=null?n:0;return J.set(e,t+1),t!==0?()=>Re(e):(me.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Re(e))}function Re(e){var n;let t=(n=J.get(e))!=null?n:1;if(t===1?J.delete(e):J.set(e,t-1),t!==1)return;let r=me.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,me.delete(e))}function sn(e,{allowed:n,disallowed:t}={}){let r=lt(e,"inert-others");H(()=>{var o,l;if(!r)return;let a=Ae();for(let c of(o=t==null?void 0:t())!=null?o:[])c&&a.add(Ie(c));let s=(l=n==null?void 0:n())!=null?l:[];for(let c of s){if(!c)continue;let d=Ne(c);if(!d)continue;let p=c.parentElement;for(;p&&p!==d.body;){for(let m of p.children)s.some(f=>m.contains(f))||a.add(Ie(m));p=p.parentElement}}return a.dispose},[r,n,t])}var un=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(un||{});const ne={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},cn=200;function dn(e,{trigger:n,action:t,close:r,select:o}){let l=i.useRef(null);ye(e&&n!==null,"pointerdown",a=>{it(a==null?void 0:a.target)&&n!=null&&n.contains(a.target)&&(l.current=new Date)}),ye(e&&n!==null,"pointerup",a=>{if(l.current===null||!at(a.target))return;let s=t(a),c=new Date().getTime()-l.current.getTime();switch(l.current=null,s.kind){case 0:return;case 1:{c>cn&&(o(s.target),r());break}case 2:{r();break}}},{capture:!0})}function Ce(e){return[e.screenX,e.screenY]}function pn(){let e=i.useRef([-1,-1]);return{wasMoved(n){let t=Ce(n);return e.current[0]===t[0]&&e.current[1]===t[1]?!1:(e.current=t,!0)},update(n){e.current=Ce(n)}}}function fn(e,n){let[t,r]=i.useState(n);return!e&&t!==n&&r(n),e?t:n}function vn(e){throw new Error("Unexpected object: "+e)}var g=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(g||{});function re(e,n){let t=n.resolveItems();if(t.length<=0)return null;let r=n.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let l=0;l<t.length;++l)if(!n.resolveDisabled(t[l],l,t))return l;return r}case 1:{o===-1&&(o=t.length);for(let l=o-1;l>=0;--l)if(!n.resolveDisabled(t[l],l,t))return l;return r}case 2:{for(let l=o+1;l<t.length;++l)if(!n.resolveDisabled(t[l],l,t))return l;return r}case 3:{for(let l=t.length-1;l>=0;--l)if(!n.resolveDisabled(t[l],l,t))return l;return r}case 4:{for(let l=0;l<t.length;++l)if(n.resolveId(t[l],l,t)===e.id)return l;return r}case 5:return null;default:vn(e)}}function mn(e,n){let t=i.useRef({left:0,top:0});if(H(()=>{if(!n)return;let o=n.getBoundingClientRect();o&&(t.current=o)},[e,n]),n==null||!e||n===document.activeElement)return!1;let r=n.getBoundingClientRect();return r.top!==t.current.top||r.left!==t.current.left}let Le=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ke(e){var n,t;let r=(n=e.innerText)!=null?n:"",o=e.cloneNode(!0);if(!je(o))return r;let l=!1;for(let s of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))s.remove(),l=!0;let a=l?(t=o.innerText)!=null?t:"":r;return Le.test(a)&&(a=a.replace(Le,"")),a}function bn(e){let n=e.getAttribute("aria-label");if(typeof n=="string")return n.trim();let t=e.getAttribute("aria-labelledby");if(t){let r=t.split(" ").map(o=>{let l=document.getElementById(o);if(l){let a=l.getAttribute("aria-label");return typeof a=="string"?a.trim():ke(l).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return ke(e).trim()}function hn(e){let n=i.useRef(""),t=i.useRef("");return C(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(n.current===o)return t.current;let l=bn(r).trim().toLowerCase();return n.current=o,t.current=l,l})}var gn=Object.defineProperty,xn=(e,n,t)=>n in e?gn(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,De=(e,n,t)=>(xn(e,typeof n!="symbol"?n+"":n,t),t),E=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(E||{}),_=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(_||{}),be=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(be||{}),Ze=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(Ze||{});function Fe(e,n=t=>t){let t=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=ct(n(e.options.slice()),l=>l.dataRef.current.domRef.current),o=t?r.indexOf(t):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let On={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:g.Nothing},listboxState:1,__demoMode:!1}},0(e,n){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(l=>r(l.dataRef.current.value));return o!==-1&&(t=o),{...e,pendingFocus:n.focus,listboxState:0,activeOptionIndex:t,__demoMode:!1}},2(e,n){var t,r,o,l,a;if(e.dataRef.current.disabled||e.listboxState===1)return e;let s={...e,searchQuery:"",activationTrigger:(t=n.trigger)!=null?t:1,__demoMode:!1};if(n.focus===g.Nothing)return{...s,activeOptionIndex:null};if(n.focus===g.Specific)return{...s,activeOptionIndex:e.options.findIndex(p=>p.id===n.id)};if(n.focus===g.Previous){let p=e.activeOptionIndex;if(p!==null){let m=e.options[p].dataRef.current.domRef,f=re(n,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});if(f!==null){let u=e.options[f].dataRef.current.domRef;if(((r=m.current)==null?void 0:r.previousElementSibling)===u.current||((o=u.current)==null?void 0:o.previousElementSibling)===null)return{...s,activeOptionIndex:f}}}}else if(n.focus===g.Next){let p=e.activeOptionIndex;if(p!==null){let m=e.options[p].dataRef.current.domRef,f=re(n,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});if(f!==null){let u=e.options[f].dataRef.current.domRef;if(((l=m.current)==null?void 0:l.nextElementSibling)===u.current||((a=u.current)==null?void 0:a.nextElementSibling)===null)return{...s,activeOptionIndex:f}}}}let c=Fe(e),d=re(n,{resolveItems:()=>c.options,resolveActiveIndex:()=>c.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});return{...s,...c,activeOptionIndex:d}},3:(e,n)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.searchQuery!==""?0:1,r=e.searchQuery+n.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+t).concat(e.options.slice(0,e.activeOptionIndex+t)):e.options).find(a=>{var s;return!a.dataRef.current.disabled&&((s=a.dataRef.current.textValue)==null?void 0:s.startsWith(r))}),l=o?e.options.indexOf(o):-1;return l===-1||l===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:l,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,n)=>{let t=e.options.concat(n.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==g.Nothing&&(r=re(e.pendingFocus,{resolveItems:()=>t,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let l=t.findIndex(a=>o==null?void 0:o(a.dataRef.current.value));l!==-1&&(r=l)}}return{...e,options:t,activeOptionIndex:r,pendingFocus:{focus:g.Nothing},pendingShouldSort:!0}},6:(e,n)=>{let t=e.options,r=[],o=new Set(n.options);for(let[l,a]of t.entries())if(o.has(a.id)&&(r.push(l),o.delete(a.id),o.size===0))break;if(r.length>0){t=t.slice();for(let l of r.reverse())t.splice(l,1)}return{...e,options:t,activationTrigger:1}},7:(e,n)=>e.buttonElement===n.element?e:{...e,buttonElement:n.element},8:(e,n)=>e.optionsElement===n.element?e:{...e,optionsElement:n.element},9:e=>e.pendingShouldSort?{...e,...Fe(e),pendingShouldSort:!1}:e};class ge extends st{constructor(n){super(n),De(this,"actions",{onChange:t=>{let{onChange:r,compare:o,mode:l,value:a}=this.state.dataRef.current;return q(l,{0:()=>r==null?void 0:r(t),1:()=>{let s=a.slice(),c=s.findIndex(d=>o(d,t));return c===-1?s.push(t):s.splice(c,1),r==null?void 0:r(s)}})},registerOption:ve(()=>{let t=[],r=new Set;return[(o,l)=>{r.has(l)||(r.add(l),t.push({id:o,dataRef:l}))},()=>(r.clear(),this.send({type:5,options:t.splice(0)}))]}),unregisterOption:ve(()=>{let t=[];return[r=>t.push(r),()=>{this.send({type:6,options:t.splice(0)})}]}),goToOption:ve(()=>{let t=null;return[(r,o)=>{t={type:2,...r,trigger:o}},()=>t&&this.send(t)]}),closeListbox:()=>{this.send({type:1})},openListbox:t=>{this.send({type:0,focus:t})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:t,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(t.current.value),this.send({type:2,focus:g.Specific,id:r})}},selectOption:t=>{let r=this.state.options.find(o=>o.id===t);r&&this.actions.onChange(r.dataRef.current.value)},search:t=>{this.send({type:3,value:t})},clearSearch:()=>{this.send({type:4})},setButtonElement:t=>{this.send({type:7,element:t})},setOptionsElement:t=>{this.send({type:8,element:t})}}),De(this,"selectors",{activeDescendantId(t){var r;let o=t.activeOptionIndex,l=t.options;return o===null||(r=l[o])==null?void 0:r.id},isActive(t,r){var o;let l=t.activeOptionIndex,a=t.options;return l!==null?((o=a[l])==null?void 0:o.id)===r:!1},shouldScrollIntoView(t,r){return t.__demoMode||t.listboxState!==0||t.activationTrigger===0?!1:this.isActive(t,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let t=this.state.id,r=_e.get(null);this.disposables.add(r.on(ut.Push,o=>{!r.selectors.isTop(o,t)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(t)),this.on(1,()=>r.actions.pop(t))}}static new({id:n,__demoMode:t=!1}){return new ge({id:n,dataRef:{current:{}},listboxState:t?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:g.Nothing},__demoMode:t})}reduce(n,t){return q(t.type,On,n,t)}}const Xe=i.createContext(null);function xe(e){let n=i.useContext(Xe);if(n===null){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Ye),t}return n}function Ye({id:e,__demoMode:n=!1}){let t=i.useMemo(()=>ge.new({id:e,__demoMode:n}),[]);return dt(()=>t.dispose()),t}let se=i.createContext(null);se.displayName="ListboxDataContext";function ee(e){let n=i.useContext(se);if(n===null){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,ee),t}return n}let Sn=i.Fragment;function yn(e,n){let t=i.useId(),r=he(),{value:o,defaultValue:l,form:a,name:s,onChange:c,by:d,invalid:p=!1,disabled:m=r||!1,horizontal:f=!1,multiple:u=!1,__demoMode:x=!1,...w}=e;const y=f?"horizontal":"vertical";let P=G(n),O=Qt(l),[$=u?[]:void 0,R]=zt(o,c,O),L=Ye({id:t,__demoMode:x}),N=i.useRef({static:!1,hold:!1}),U=i.useRef(new Map),M=an(d),z=i.useCallback(T=>q(b.mode,{[_.Multi]:()=>$.some(W=>M(W,T)),[_.Single]:()=>M($,T)}),[$]),b=i.useMemo(()=>({value:$,disabled:m,invalid:p,mode:u?_.Multi:_.Single,orientation:y,onChange:R,compare:M,isSelected:z,optionsPropsRef:N,listRef:U}),[$,m,p,u,y,R,M,z,N,U]);H(()=>{L.state.dataRef.current=b},[b]);let D=A(L,T=>T.listboxState),Q=_e.get(null),V=A(Q,i.useCallback(T=>Q.selectors.isTop(T,t),[Q,t])),[j,h]=A(L,T=>[T.buttonElement,T.optionsElement]);pt(V,[j,h],(T,W)=>{L.send({type:Ze.CloseListbox}),Pt(W,Mt.Loose)||(T.preventDefault(),j==null||j.focus())});let B=i.useMemo(()=>({open:D===E.Open,disabled:m,invalid:p,value:$}),[D,m,p,$]),[ue,ce]=en({inherit:!0}),de={ref:P},te=i.useCallback(()=>{if(O!==void 0)return R==null?void 0:R(O)},[R,O]),pe=Z();return S.createElement(ce,{value:ue,props:{htmlFor:j==null?void 0:j.id},slot:{open:D===E.Open,disabled:m}},S.createElement(ft,null,S.createElement(Xe.Provider,{value:L},S.createElement(se.Provider,{value:b},S.createElement(vt,{value:q(D,{[E.Open]:le.Open,[E.Closed]:le.Closed})},s!=null&&$!=null&&S.createElement(Gt,{disabled:m,data:{[s]:$},form:a,onReset:te}),pe({ourProps:de,theirProps:w,slot:B,defaultTag:Sn,name:"Listbox"}))))))}let $n="button";function En(e,n){let t=i.useId(),r=Ve(),o=ee("Listbox.Button"),l=xe("Listbox.Button"),{id:a=r||`headlessui-listbox-button-${t}`,disabled:s=o.disabled||!1,autoFocus:c=!1,...d}=e,p=G(n,Rt(),l.actions.setButtonElement),m=Ct(),[f,u,x]=A(l,h=>[h.listboxState,h.buttonElement,h.optionsElement]),w=f===E.Open;dn(w,{trigger:u,action:i.useCallback(h=>{if(u!=null&&u.contains(h.target))return ne.Ignore;let B=h.target.closest('[role="option"]:not([data-disabled])');return je(B)?ne.Select(B):x!=null&&x.contains(h.target)?ne.Ignore:ne.Close},[u,x]),close:l.actions.closeListbox,select:l.actions.selectActiveOption});let y=C(h=>{switch(h.key){case I.Enter:Vt(h.currentTarget);break;case I.Space:case I.ArrowDown:h.preventDefault(),l.actions.openListbox({focus:o.value?g.Nothing:g.First});break;case I.ArrowUp:h.preventDefault(),l.actions.openListbox({focus:o.value?g.Nothing:g.Last});break}}),P=C(h=>{switch(h.key){case I.Space:h.preventDefault();break}}),O=C(h=>{var B;if(h.button===0){if(Lt(h.currentTarget))return h.preventDefault();l.state.listboxState===E.Open?(Y.flushSync(()=>l.actions.closeListbox()),(B=l.state.buttonElement)==null||B.focus({preventScroll:!0})):(h.preventDefault(),l.actions.openListbox({focus:g.Nothing}))}}),$=C(h=>h.preventDefault()),R=Ge([a]),L=Yt(),{isFocusVisible:N,focusProps:U}=kt({autoFocus:c}),{isHovered:M,hoverProps:z}=Dt({isDisabled:s}),{pressed:b,pressProps:D}=Ft({disabled:s}),Q=i.useMemo(()=>({open:f===E.Open,active:b||f===E.Open,disabled:s,invalid:o.invalid,value:o.value,hover:M,focus:N,autofocus:c}),[f,o.value,s,M,N,b,o.invalid,c]),V=A(l,h=>h.listboxState===E.Open),j=Be(m(),{ref:p,id:a,type:Tt(e,u),"aria-haspopup":"listbox","aria-controls":x==null?void 0:x.id,"aria-expanded":V,"aria-labelledby":R,"aria-describedby":L,disabled:s||void 0,autoFocus:c,onKeyDown:y,onKeyUp:P,onKeyPress:$,onPointerDown:O},U,z,D);return Z()({ourProps:j,theirProps:d,slot:Q,defaultTag:$n,name:"Listbox.Button"})}let qe=i.createContext(!1),wn="div",In=we.RenderStrategy|we.Static;function Rn(e,n){let t=i.useId(),{id:r=`headlessui-listbox-options-${t}`,anchor:o,portal:l=!1,modal:a=!0,transition:s=!1,...c}=e,d=bt(o),[p,m]=i.useState(null);d&&(l=!0);let f=ee("Listbox.Options"),u=xe("Listbox.Options"),[x,w,y,P]=A(u,v=>[v.listboxState,v.buttonElement,v.optionsElement,v.__demoMode]),O=$e(w),$=$e(y),R=ht(),[L,N]=gt(s,p,R!==null?(R&le.Open)===le.Open:x===E.Open);xt(L,w,u.actions.closeListbox);let U=P?!1:a&&x===E.Open;Ot(U,$);let M=P?!1:a&&x===E.Open;sn(M,{allowed:i.useCallback(()=>[w,y],[w,y])});let z=x!==E.Open,b=mn(z,w)?!1:L,D=L&&x===E.Closed,Q=fn(D,f.value),V=C(v=>f.compare(Q,v)),j=A(u,v=>{var F;if(d==null||!((F=d==null?void 0:d.to)!=null&&F.includes("selection")))return null;let X=v.options.findIndex(fe=>V(fe.dataRef.current.value));return X===-1&&(X=0),X}),h=(()=>{if(d==null)return;if(j===null)return{...d,inner:void 0};let v=Array.from(f.listRef.current.values());return{...d,inner:{listRef:{current:v},index:j}}})(),[B,ue]=St(h),ce=yt(),de=G(n,d?B:null,u.actions.setOptionsElement,m),te=Te();i.useEffect(()=>{var v;let F=y;F&&x===E.Open&&F!==((v=Ne(F))==null?void 0:v.activeElement)&&(F==null||F.focus({preventScroll:!0}))},[x,y]);let pe=C(v=>{var F,X;switch(te.dispose(),v.key){case I.Space:if(u.state.searchQuery!=="")return v.preventDefault(),v.stopPropagation(),u.actions.search(v.key);case I.Enter:if(v.preventDefault(),v.stopPropagation(),u.state.activeOptionIndex!==null){let{dataRef:fe}=u.state.options[u.state.activeOptionIndex];u.actions.onChange(fe.current.value)}f.mode===_.Single&&(Y.flushSync(()=>u.actions.closeListbox()),(F=u.state.buttonElement)==null||F.focus({preventScroll:!0}));break;case q(f.orientation,{vertical:I.ArrowDown,horizontal:I.ArrowRight}):return v.preventDefault(),v.stopPropagation(),u.actions.goToOption({focus:g.Next});case q(f.orientation,{vertical:I.ArrowUp,horizontal:I.ArrowLeft}):return v.preventDefault(),v.stopPropagation(),u.actions.goToOption({focus:g.Previous});case I.Home:case I.PageUp:return v.preventDefault(),v.stopPropagation(),u.actions.goToOption({focus:g.First});case I.End:case I.PageDown:return v.preventDefault(),v.stopPropagation(),u.actions.goToOption({focus:g.Last});case I.Escape:v.preventDefault(),v.stopPropagation(),Y.flushSync(()=>u.actions.closeListbox()),(X=u.state.buttonElement)==null||X.focus({preventScroll:!0});return;case I.Tab:v.preventDefault(),v.stopPropagation(),Y.flushSync(()=>u.actions.closeListbox()),$t(u.state.buttonElement,v.shiftKey?Ee.Previous:Ee.Next);break;default:v.key.length===1&&(u.actions.search(v.key),te.setTimeout(()=>u.actions.clearSearch(),350));break}}),T=A(u,v=>{var F;return(F=v.buttonElement)==null?void 0:F.id}),W=i.useMemo(()=>({open:x===E.Open}),[x]),We=Be(d?ce():{},{id:r,ref:de,"aria-activedescendant":A(u,u.selectors.activeDescendantId),"aria-multiselectable":f.mode===_.Multi?!0:void 0,"aria-labelledby":T,"aria-orientation":f.orientation,onKeyDown:pe,role:"listbox",tabIndex:x===E.Open?0:void 0,style:{...c.style,...ue,"--button-width":wt(w,!0).width},...Et(N)}),Je=Z(),et=i.useMemo(()=>f.mode===_.Multi?f:{...f,isSelected:V},[f,V]);return S.createElement(It,{enabled:l?e.static||L:!1,ownerDocument:O},S.createElement(se.Provider,{value:et},Je({ourProps:We,theirProps:c,slot:W,defaultTag:wn,features:In,visible:b,name:"Listbox.Options"})))}let Cn="div";function Ln(e,n){let t=i.useId(),{id:r=`headlessui-listbox-option-${t}`,disabled:o=!1,value:l,...a}=e,s=i.useContext(qe)===!0,c=ee("Listbox.Option"),d=xe("Listbox.Option"),p=A(d,b=>d.selectors.isActive(b,r)),m=c.isSelected(l),f=i.useRef(null),u=hn(f),x=mt({disabled:o,value:l,domRef:f,get textValue(){return u()}}),w=G(n,f,b=>{b?c.listRef.current.set(r,b):c.listRef.current.delete(r)}),y=A(d,b=>d.selectors.shouldScrollIntoView(b,r));H(()=>{if(y)return Ae().requestAnimationFrame(()=>{var b,D;(D=(b=f.current)==null?void 0:b.scrollIntoView)==null||D.call(b,{block:"nearest"})})},[y,f]),H(()=>{if(!s)return d.actions.registerOption(r,x),()=>d.actions.unregisterOption(r)},[x,r,s]);let P=C(b=>{var D;if(o)return b.preventDefault();d.actions.onChange(l),c.mode===_.Single&&(Y.flushSync(()=>d.actions.closeListbox()),(D=d.state.buttonElement)==null||D.focus({preventScroll:!0}))}),O=C(()=>{if(o)return d.actions.goToOption({focus:g.Nothing});d.actions.goToOption({focus:g.Specific,id:r})}),$=pn(),R=C(b=>{$.update(b),!o&&(p||d.actions.goToOption({focus:g.Specific,id:r},be.Pointer))}),L=C(b=>{$.wasMoved(b)&&(o||p||d.actions.goToOption({focus:g.Specific,id:r},be.Pointer))}),N=C(b=>{$.wasMoved(b)&&(o||p&&d.actions.goToOption({focus:g.Nothing}))}),U=i.useMemo(()=>({active:p,focus:p,selected:m,disabled:o,selectedOption:m&&s}),[p,m,o,s]),M=s?{}:{id:r,ref:w,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":m,disabled:void 0,onClick:P,onFocus:O,onPointerEnter:R,onMouseEnter:R,onPointerMove:L,onMouseMove:L,onPointerLeave:N,onMouseLeave:N},z=Z();return!m&&s?null:z({ourProps:M,theirProps:a,slot:U,defaultTag:Cn,name:"Listbox.Option"})}let kn=i.Fragment;function Dn(e,n){let{options:t,placeholder:r,...o}=e,l={ref:G(n)},a=ee("ListboxSelectedOption"),s=i.useMemo(()=>({}),[]),c=a.value===void 0||a.value===null||a.mode===_.Multi&&Array.isArray(a.value)&&a.value.length===0,d=Z();return S.createElement(qe.Provider,{value:!0},d({ourProps:l,theirProps:{...o,children:S.createElement(S.Fragment,null,r&&c?r:t)},slot:s,defaultTag:kn,name:"ListboxSelectedOption"}))}let Fn=K(yn),Tn=K(En),Pn=on,Mn=K(Rn),An=K(Ln),Nn=K(Dn),oe=Object.assign(Fn,{Button:Tn,Label:Pn,Options:Mn,Option:An,SelectedOption:Nn});function jn({title:e,titleId:n,...t},r){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":n},t),e?i.createElement("title",{id:n},e):null,i.createElement("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-1.72 6.97a.75.75 0 1 0-1.06 1.06L10.94 12l-1.72 1.72a.75.75 0 1 0 1.06 1.06L12 13.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L13.06 12l1.72-1.72a.75.75 0 1 0-1.06-1.06L12 10.94l-1.72-1.72Z",clipRule:"evenodd"}))}const Hn=i.forwardRef(jn);function Kn({options:e,value:n=[]}){const[t,r]=i.useState([]);return i.useEffect(()=>{r(n)},[n]),k.jsx(oe,{value:t,onChange:o=>{var l;r(o);for(const a in e)(l=e[a])==null||l.call(e,o.includes(a))},multiple:!0,children:k.jsxs("div",{className:"relative flex",children:[k.jsxs(oe.Button,{className:"flex items-center relative w-full bg-primary-10 text-xs rounded-full text-primary-500 py-1 px-2 text-center focus:outline-none focus-visible:border-accent-500 focus-visible:ring-2 focus-visible:ring-light focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-brand-300 cursor-pointer",children:[k.jsxs("span",{className:"flex truncate items-center",children:[k.jsx(Bt,{className:"h-3 w-3 mr-0 sm:mr-1"})," ",k.jsx("span",{className:"sr-only sm:not-sr-only",children:"Show"})]}),k.jsx(Nt,{className:"ml-2 h-4 w-4","aria-hidden":"true"})]}),k.jsx(At,{as:i.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:k.jsx(oe.Options,{className:"absolute top-8 right-0 z-50 max-h-60 min-w-16 overflow-auto rounded-md bg-theme py-2 shadow-lg ring-2 ring-primary-10 ring-opacity-5 focus:outline-none sm:text-sm",children:Object.keys(e).filter(o=>e[o]).map(o=>k.jsx(oe.Option,{className:({active:l,disabled:a})=>Oe("relative cursor-default select-none py-1 pl-10 pr-4",a?"opacity-50 cursor-not-allowed":"",l?"bg-primary-10 text-primary-500":"text-neutral-700 dark:text-neutral-300"),value:o,disabled:tt(!!e[o]),children:({selected:l})=>k.jsxs(k.Fragment,{children:[k.jsx("span",{children:o}),k.jsx("span",{className:Oe("absolute inset-y-0 left-0 flex items-center pl-3 text-primary-500",l?"block":"hidden"),children:k.jsx(jt,{className:"h-4 w-4","aria-hidden":"true"})})]})},o))})})]})})}export{Ke as C,Hn as F,Vn as H,Kn as L,Ge as N,en as Q,zt as T,Yt as U,on as V,he as a,pn as b,g as c,mn as d,an as e,re as f,ne as g,Gt as j,dn as k,Qt as l,Vt as p,hn as s,Ve as u,Qn as w,sn as y};
@@ -1 +0,0 @@
1
- const L="";function _(l,t){return l.replaceAll(t,`<b class="inline-block text-brand-500 bg-brand-10">${t}</b>`)}function i(l=[],t){return t=t.toLocaleLowerCase(),l.reduce((e,[s,n])=>{const o=n.toLocaleLowerCase().indexOf(t);if(o<0)return e;if(n.length<40)e.push([s,n]);else{const T=Math.max(0,o-40),r=Math.min(n.length-1,o+t.length+40);e.push([s,`${T>0?"...":L}${n.slice(T,r)}${r<n.length?"...":L}`])}return e},[])}export{L as E,i as f,_ as h};