diff --git a/recce/data/404.html b/recce/data/404.html index de473f0a..3c929321 100644 --- a/recce/data/404.html +++ b/recce/data/404.html @@ -1 +1 @@ -404: This page could not be found.recce

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.recce

404

This page could not be found.

\ No newline at end of file diff --git a/recce/data/_next/static/chunks/607285b2-06d9683b5002e6fd.js b/recce/data/_next/static/chunks/607285b2-06d9683b5002e6fd.js deleted file mode 100644 index bbb01df7..00000000 --- a/recce/data/_next/static/chunks/607285b2-06d9683b5002e6fd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[521],{15012:function(t,a,r){r.d(a,{Ks7:function(){return TbBrandStackshare},WzH:function(){return TbChecklist},dku:function(){return TbChartHistogram},pRi:function(){return TbAlignBoxLeftStretch},r2i:function(){return TbSql},uhn:function(){return TbSchema}});var n=r(27600);function TbAlignBoxLeftStretch(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"}},{tag:"path",attr:{d:"M9 17h-2"}},{tag:"path",attr:{d:"M13 12h-6"}},{tag:"path",attr:{d:"M11 7h-4"}}]})(t)}function TbBrandStackshare(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M19 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}},{tag:"path",attr:{d:"M19 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}},{tag:"path",attr:{d:"M5 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}},{tag:"path",attr:{d:"M7 12h3l3.5 6h3.5"}},{tag:"path",attr:{d:"M17 6h-3.5l-3.5 6"}}]})(t)}function TbChartHistogram(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M3 3v18h18"}},{tag:"path",attr:{d:"M20 18v3"}},{tag:"path",attr:{d:"M16 16v5"}},{tag:"path",attr:{d:"M12 13v8"}},{tag:"path",attr:{d:"M8 16v5"}},{tag:"path",attr:{d:"M3 11c6 0 5 -5 9 -5s3 5 9 5"}}]})(t)}function TbChecklist(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M9.615 20h-2.615a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8"}},{tag:"path",attr:{d:"M14 19l2 2l4 -4"}},{tag:"path",attr:{d:"M9 8h4"}},{tag:"path",attr:{d:"M9 12h2"}}]})(t)}function TbSchema(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M5 2h5v4h-5z"}},{tag:"path",attr:{d:"M15 10h5v4h-5z"}},{tag:"path",attr:{d:"M5 18h5v4h-5z"}},{tag:"path",attr:{d:"M5 10h5v4h-5z"}},{tag:"path",attr:{d:"M10 12h5"}},{tag:"path",attr:{d:"M7.5 6v4"}},{tag:"path",attr:{d:"M7.5 14v4"}}]})(t)}function TbSql(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"}},{tag:"path",attr:{d:"M17 8v8h4"}},{tag:"path",attr:{d:"M13 15l1 1"}},{tag:"path",attr:{d:"M3 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"}}]})(t)}}}]); \ No newline at end of file diff --git a/recce/data/_next/static/chunks/607285b2-dadd48144d45dbcf.js b/recce/data/_next/static/chunks/607285b2-dadd48144d45dbcf.js new file mode 100644 index 00000000..44e334e5 --- /dev/null +++ b/recce/data/_next/static/chunks/607285b2-dadd48144d45dbcf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[521],{15012:function(t,a,r){r.d(a,{KA6:function(){return TbEyeSearch},Ks7:function(){return TbBrandStackshare},WzH:function(){return TbChecklist},dku:function(){return TbChartHistogram},pRi:function(){return TbAlignBoxLeftStretch},r2i:function(){return TbSql},uhn:function(){return TbSchema}});var n=r(27600);function TbAlignBoxLeftStretch(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"}},{tag:"path",attr:{d:"M9 17h-2"}},{tag:"path",attr:{d:"M13 12h-6"}},{tag:"path",attr:{d:"M11 7h-4"}}]})(t)}function TbBrandStackshare(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M19 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}},{tag:"path",attr:{d:"M19 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}},{tag:"path",attr:{d:"M5 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"}},{tag:"path",attr:{d:"M7 12h3l3.5 6h3.5"}},{tag:"path",attr:{d:"M17 6h-3.5l-3.5 6"}}]})(t)}function TbChartHistogram(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M3 3v18h18"}},{tag:"path",attr:{d:"M20 18v3"}},{tag:"path",attr:{d:"M16 16v5"}},{tag:"path",attr:{d:"M12 13v8"}},{tag:"path",attr:{d:"M8 16v5"}},{tag:"path",attr:{d:"M3 11c6 0 5 -5 9 -5s3 5 9 5"}}]})(t)}function TbChecklist(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M9.615 20h-2.615a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8"}},{tag:"path",attr:{d:"M14 19l2 2l4 -4"}},{tag:"path",attr:{d:"M9 8h4"}},{tag:"path",attr:{d:"M9 12h2"}}]})(t)}function TbEyeSearch(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"}},{tag:"path",attr:{d:"M12 18c-.328 0 -.652 -.017 -.97 -.05c-3.172 -.332 -5.85 -2.315 -8.03 -5.95c2.4 -4 5.4 -6 9 -6c3.465 0 6.374 1.853 8.727 5.558"}},{tag:"path",attr:{d:"M18 18m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"}},{tag:"path",attr:{d:"M20.2 20.2l1.8 1.8"}}]})(t)}function TbSchema(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M5 2h5v4h-5z"}},{tag:"path",attr:{d:"M15 10h5v4h-5z"}},{tag:"path",attr:{d:"M5 18h5v4h-5z"}},{tag:"path",attr:{d:"M5 10h5v4h-5z"}},{tag:"path",attr:{d:"M10 12h5"}},{tag:"path",attr:{d:"M7.5 6v4"}},{tag:"path",attr:{d:"M7.5 14v4"}}]})(t)}function TbSql(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}},{tag:"path",attr:{d:"M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"}},{tag:"path",attr:{d:"M17 8v8h4"}},{tag:"path",attr:{d:"M13 15l1 1"}},{tag:"path",attr:{d:"M3 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"}}]})(t)}}}]); \ No newline at end of file diff --git a/recce/data/_next/static/chunks/6af6e714-6003aba9c53d2dcd.js b/recce/data/_next/static/chunks/6af6e714-6003aba9c53d2dcd.js new file mode 100644 index 00000000..ec58dc7c --- /dev/null +++ b/recce/data/_next/static/chunks/6af6e714-6003aba9c53d2dcd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[498],{79648:function(t,r,e){e.d(r,{Pkc:function(){return LuBarChartHorizontalBig}});var n=e(27600);function LuBarChartHorizontalBig(t){return(0,n.w_)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 3v18h18"}},{tag:"rect",attr:{width:"12",height:"4",x:"7",y:"5",rx:"1"}},{tag:"rect",attr:{width:"7",height:"4",x:"7",y:"13",rx:"1"}}]})(t)}}}]); \ No newline at end of file diff --git a/recce/data/_next/static/chunks/7c9ab469-5d619c5876a32d36.js b/recce/data/_next/static/chunks/7c9ab469-732af37965d79ccf.js similarity index 82% rename from recce/data/_next/static/chunks/7c9ab469-5d619c5876a32d36.js rename to recce/data/_next/static/chunks/7c9ab469-732af37965d79ccf.js index 20c93315..f5c2978b 100644 --- a/recce/data/_next/static/chunks/7c9ab469-5d619c5876a32d36.js +++ b/recce/data/_next/static/chunks/7c9ab469-732af37965d79ccf.js @@ -1,6 +1,6 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[634],{85670:function(t,e,i){i.d(e,{ZL:function(){return BarElement},f$:function(){return LinearScale},kL:function(){return Chart},uw:function(){return CategoryScale},vn:function(){return BarController}});var s=i(53183);/*! +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[634],{85670:function(t,e,i){i.d(e,{RM:function(){return TimeSeriesScale},ZL:function(){return BarElement},f$:function(){return LinearScale},kL:function(){return Chart},u:function(){return P},uw:function(){return CategoryScale},vn:function(){return BarController}});var s=i(53183);/*! * Chart.js v4.4.1 * https://www.chartjs.org * (c) 2023 Chart.js Contributors * Released under the MIT License - */let Animator=class Animator{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){let a=e.listeners[s],n=e.duration;a.forEach(s=>s({chart:t,initial:e.initial,numSteps:n,currentStep:Math.min(i-e.start,n)}))}_refresh(){this._request||(this._running=!0,this._request=s.r.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{let a;if(!i.running||!i.items.length)return;let n=i.items,r=n.length-1,o=!1;for(;r>=0;--r)(a=n[r])._active?(a._total>i.duration&&(i.duration=a._total),a.tick(t),o=!0):(n[r]=n[n.length-1],n.pop());o&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length}),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((t,e)=>Math.max(t,e._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!!e&&!!e.running&&!!e.items.length}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};var a=new Animator;let n="transparent",r={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){let a=(0,s.c)(t||n),r=a.valid&&(0,s.c)(e||n);return r&&r.valid?r.mix(a,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};let Animation=class Animation{constructor(t,e,i,a){let n=e[i];a=(0,s.a)([t.to,a,n,t.from]);let o=(0,s.a)([t.from,n,a]);this._active=!0,this._fn=t.fn||r[t.type||typeof o],this._easing=s.e[t.easing]||s.e.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=a,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let a=this._target[this._prop],n=i-this._start,r=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=(0,s.a)([t.to,e,a,t.from]),this._from=(0,s.a)([t.from,a,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e;let i=t-this._start,s=this._duration,a=this._prop,n=this._from,r=this._loop,o=this._to;if(this._active=n!==o&&(r||i1?2-e:e,e=this._easing(Math.min(1,Math.max(0,e))),this._target[a]=this._fn(n,o,e)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let t=0;t{let n=t[a];if(!(0,s.i)(n))return;let r={};for(let t of e)r[t]=n[t];((0,s.b)(n.properties)&&n.properties||[a]).forEach(t=>{t!==a&&i.has(t)||i.set(t,r)})})}_animateOptions(t,e){let i=e.options,s=resolveTargetOptions(t,i);if(!s)return[];let a=this._createAnimations(s,i);return i.$shared&&awaitAll(t.options.$animations,i).then(()=>{t.options=i},()=>{}),a}_createAnimations(t,e){let i;let s=this._properties,a=[],n=t.$animations||(t.$animations={}),r=Object.keys(e),o=Date.now();for(i=r.length-1;i>=0;--i){let l=r[i];if("$"===l.charAt(0))continue;if("options"===l){a.push(...this._animateOptions(t,e));continue}let h=e[l],d=n[l],c=s.get(l);if(d){if(c&&d.active()){d.update(c,h,o);continue}d.cancel()}if(!c||!c.duration){t[l]=h;continue}n[l]=d=new Animation(c,t,l,h),a.push(d)}return a}update(t,e){if(0===this._properties.size){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return a.add(this._chart,i),!0}};function awaitAll(t,e){let i=[],s=Object.keys(e);for(let e=0;e0||!i&&e<0)return a.index}return null}function updateStacks(t,e){let i;let{chart:s,_cachedMeta:a}=t,n=s._stacks||(s._stacks={}),{iScale:r,vScale:o,index:l}=a,h=r.axis,d=o.axis,c=getStackKey(r,o,a),u=e.length;for(let t=0;ti[t].axis===e).shift()}function createDatasetContext(t,e){return(0,s.j)(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function createDataContext(t,e,i){return(0,s.j)(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}function clearStacks(t,e){let i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s)for(let a of e=e||t._parsed){let t=a._stacks;if(!t||void 0===t[s]||void 0===t[s][i])return;delete t[s][i],void 0!==t[s]._visualValues&&void 0!==t[s]._visualValues[i]&&delete t[s]._visualValues[i]}}let isDirectUpdateMode=t=>"reset"===t||"none"===t,cloneIfNotShared=(t,e)=>e?t:Object.assign({},t),createStack=(t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:getSortedDatasetIndices(i,!0),values:null};let DatasetController=class DatasetController{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=isStacked(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&clearStacks(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),chooseId=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,a=e.xAxisID=(0,s.v)(i.xAxisID,getFirstScaleId(t,"x")),n=e.yAxisID=(0,s.v)(i.yAxisID,getFirstScaleId(t,"y")),r=e.rAxisID=(0,s.v)(i.rAxisID,getFirstScaleId(t,"r")),o=e.indexAxis,l=e.iAxisID=chooseId(o,a,n,r),h=e.vAxisID=chooseId(o,n,a,r);e.xScale=this.getScaleForId(a),e.yScale=this.getScaleForId(n),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&(0,s.u)(this._data,this),t._stacked&&clearStacks(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if((0,s.i)(e))this._data=convertObjectDataToArray(e);else if(i!==e){if(i){(0,s.u)(i,this);let t=this._cachedMeta;clearStacks(t),t._parsed=[]}e&&Object.isExtensible(e)&&(0,s.l)(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),s=!1;this._dataCheck();let a=e._stacked;e._stacked=isStacked(e.vScale,e),e.stack!==i.stack&&(s=!0,clearStacks(e),e.stack=i.stack),this._resyncElements(t),(s||a!==e._stacked)&&updateStacks(this,e._parsed)}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let i,a,n;let{_cachedMeta:r,_data:o}=this,{iScale:l,_stacked:h}=r,d=l.axis,c=0===t&&e===o.length||r._sorted,u=t>0&&r._parsed[t-1];if(!1===this._parsing)r._parsed=o,r._sorted=!0,n=o;else{n=(0,s.b)(o[t])?this.parseArrayData(r,o,t,e):(0,s.i)(o[t])?this.parseObjectData(r,o,t,e):this.parsePrimitiveData(r,o,t,e);let isNotInOrderComparedToPrev=()=>null===a[d]||u&&a[d]e||g=0;--i)if(!_skip()){this.updateRangeFromParsed(c,t,a,d);break}}return c}getAllParsedValues(t){let e,i,a;let n=this._cachedMeta._parsed,r=[];for(e=0,i=n.length;e=0&&tthis.getContext(i,a,e),c);return p.$shared&&(p.$shared=l,n[r]=Object.freeze(cloneIfNotShared(p,l))),p}_resolveAnimations(t,e,i){let s;let a=this.chart,n=this._cachedDataOpts,r=`animation-${e}`,o=n[r];if(o)return o;if(!1!==a.options.animation){let a=this.chart.config,n=a.datasetAnimationScopeKeys(this._type,e),r=a.getOptionScopes(this.getDataset(),n);s=a.createResolver(r,this.getContext(t,i,e))}let l=new Animations(a,s&&s.animations);return s&&s._cacheable&&(n[r]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||isDirectUpdateMode(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,a=this.getSharedOptions(i),n=this.includeOptions(e,a)||a!==s;return this.updateSharedOptions(a,e,i),{sharedOptions:a,includeOptions:n}}updateElement(t,e,i,s){isDirectUpdateMode(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!isDirectUpdateMode(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;let a=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(a)||a})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];let s=i.length,a=e.length,n=Math.min(a,s);n&&this.parse(0,n),a>s?this._insertElements(s,a-s,t):a{for(t.length+=e,s=t.length-1;s>=r;s--)t[s]=t[s-e]};for(move(n),s=t;st-e))}return t._cache.$bar}function computeMinSampleSize(t){let e,i,a,n;let r=t.iScale,o=getAllScaleValues(r,t.type),l=r._length,updateMinAndPrev=()=>{32767!==a&&-32768!==a&&((0,s.h)(n)&&(l=Math.min(l,Math.abs(a-n)||l)),n=a)};for(e=0,i=o.length;e0?a[t-1]:null,o=tMath.abs(o)&&(l=o,h=r),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:a,end:n,min:r,max:o}}function parseValue(t,e,i,a){return(0,s.b)(t)?parseFloatBar(t,e,i,a):e[i.axis]=i.parse(t,a),e}function parseArrayOrPrimitive(t,e,i,s){let a,n,r,o;let l=t.iScale,h=t.vScale,d=l.getLabels(),c=l===h,u=[];for(a=i,n=i+s;a=i?1:-1)}function borderProps(t){let e,i,s,a,n;return t.horizontal?(e=t.base>t.x,i="left",s="right"):(e=t.baset.controller.options.grouped),n=i.options.stacked,r=[],skipNull=t=>{let i=t.controller.getParsed(e),a=i&&i[t.vScale.axis];if((0,s.k)(a)||isNaN(a))return!0};for(let i of a)if(!(void 0!==e&&skipNull(i))&&((!1===n||-1===r.indexOf(i.stack)||void 0===n&&void 0===i.stack)&&r.push(i.stack),i.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){let s=this._getStacks(t,i),a=void 0!==e?s.indexOf(e):-1;return -1===a?s.length-1:a}_getRuler(){let t,e;let i=this.options,s=this._cachedMeta,a=s.iScale,n=[];for(t=0,e=s.data.length;t=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:a}=e,n=this.getParsed(t),r=s.getLabelForValue(n.x),o=a.getLabelForValue(n.y),l=n._custom;return{label:i[t]||"",value:"("+r+", "+o+(l?", "+l:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){let a="reset"===s,{iScale:n,vScale:r}=this._cachedMeta,{sharedOptions:o,includeOptions:l}=this._getSharedOptions(e,s),h=n.axis,d=r.axis;for(let c=e;c(0,s.p)(e,t,l,!0)?1:Math.max(a,a*i,n,n*i),calcMin=(e,a,n)=>(0,s.p)(e,t,l,!0)?-1:Math.min(a,a*i,n,n*i),g=calcMax(0,h,c),p=calcMax(s.H,d,u),f=calcMin(s.P,h,c),m=calcMin(s.P+s.H,d,u);a=(g-f)/2,n=(p-m)/2,r=-(g+f)/2,o=-(p+m)/2}return{ratioX:a,ratioY:n,offsetX:r,offsetY:o}}let DoughnutController=class DoughnutController extends DatasetController{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((e,a)=>{let n=t.getDatasetMeta(0),r=n.controller.getStyle(a);return{text:e,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,fontColor:s,lineWidth:r.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){let i=this.getDataset().data,a=this._cachedMeta;if(!1===this._parsing)a._parsed=i;else{let n,r,getter=t=>+i[t];if((0,s.i)(i[t])){let{key:t="value"}=this._parsing;getter=e=>+(0,s.f)(i[e],t)}for(n=t,r=t+e;n0&&!isNaN(t)?s.T*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,a=i.data.labels||[],n=(0,s.o)(e._parsed[t],i.options.locale);return{label:a[t]||"",value:n}}getMaxBorderWidth(t){let e,i,s,a,n,r=0,o=this.chart;if(!t){for(e=0,i=o.data.datasets.length;e0&&this.getParsed(e-1);for(let i=0;i<_;++i){let p=t[i],_=x?p:{};if(i=b){_.skip=!0;continue}let y=this.getParsed(i),k=(0,s.k)(y[g]),M=_[u]=r.getPixelForValue(y[u],i),S=_[g]=n||k?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,y,l):y[g],i);_.skip=isNaN(M)||isNaN(S)||k,_.stop=i>0&&Math.abs(y[u]-v[u])>m,f&&(_.parsed=y,_.raw=h.data[i]),c&&(_.options=d||this.resolveDataElementOptions(i,p.active?"active":a)),x||this.updateElement(p,i,_,a),v=y}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;let a=s[0].size(this.resolveDataElementOptions(0)),n=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,a,n)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};let PolarAreaController=class PolarAreaController extends DatasetController{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((e,a)=>{let n=t.getDatasetMeta(0),r=n.controller.getStyle(a);return{text:e,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,fontColor:s,lineWidth:r.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,a=i.data.labels||[],n=(0,s.o)(e._parsed[t].r,i.options.locale);return{label:a[t]||"",value:n}}parseObjectData(t,e,i,a){return s.y.bind(this)(t,e,i,a)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((t,i)=>{let s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(se.max&&(e.max=s))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),a=Math.max(s/2,0),n=Math.max(i.cutoutPercentage?a/100*i.cutoutPercentage:1,0),r=(a-n)/t.getVisibleDatasetCount();this.outerRadius=a-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,i,a){let n;let r="reset"===a,o=this.chart,l=o.options,h=l.animation,d=this._cachedMeta.rScale,c=d.xCenter,u=d.yCenter,g=d.getIndexAngle(0)-.5*s.P,p=g,f=360/this.countVisibleElements();for(n=0;n{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?(0,s.t)(this.resolveDataElementOptions(t,e).angle||i):0}};let PieController=class PieController extends DoughnutController{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}};let RadarController=class RadarController extends DatasetController{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,a){return s.y.bind(this)(t,e,i,a)}update(t){let e=this._cachedMeta,i=e.dataset,s=e.data||[],a=e.iScale.getLabels();if(i.points=s,"resize"!==t){let e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);let n={_loop:!0,_fullLoop:a.length===s.length,options:e};this.updateElement(i,void 0,n,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){let a=this._cachedMeta.rScale,n="reset"===s;for(let r=e;r0&&this.getParsed(e-1);for(let d=e;d0&&Math.abs(i[g]-_[g])>x,m&&(f.parsed=i,f.raw=h.data[d]),u&&(f.options=c||this.resolveDataElementOptions(d,e.active?"active":a)),b||this.updateElement(e,d,f,a),_=i}this.updateSharedOptions(c,a,d)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}let i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;let a=e[0].size(this.resolveDataElementOptions(0)),n=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,a,n)/2}};function abstract(){throw Error("This method is not implemented: Check that a complete date adapter is provided.")}let DateAdapterBase=class DateAdapterBase{static override(t){Object.assign(DateAdapterBase.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return abstract()}parse(){return abstract()}format(){return abstract()}add(){return abstract()}diff(){return abstract()}startOf(){return abstract()}endOf(){return abstract()}};var o={_date:DateAdapterBase};function binarySearch(t,e,i,a){let{controller:n,data:r,_sorted:o}=t,l=n._cachedMeta.iScale;if(l&&e===l.axis&&"r"!==e&&o&&r.length){let t=l._reversePixels?s.A:s.B;if(!a)return t(r,e,i);if(n._sharedOptions){let s=r[0],a="function"==typeof s.getRange&&s.getRange(e);if(a){let s=t(r,e,i-a),n=t(r,e,i+a);return{lo:s.lo,hi:n.hi}}}}return{lo:0,hi:r.length-1}}function evaluateInteractionItems(t,e,i,s,a){let n=t.getSortedVisibleDatasetMetas(),r=i[e];for(let t=0,i=n.length;t{t[r](e[i],a)&&(n.push({element:t,datasetIndex:s,index:l}),o=o||t.inRange(e.x,e.y,a))}),s&&!o)?[]:n}var l={modes:{index(t,e,i,a){let n=(0,s.z)(e,t),r=i.axis||"x",o=i.includeInvisible||!1,l=i.intersect?getIntersectItems(t,n,r,a,o):getNearestItems(t,n,r,!1,a,o),h=[];return l.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{let e=l[0].index,i=t.data[e];i&&!i.skip&&h.push({element:i,datasetIndex:t.index,index:e})}),h):[]},dataset(t,e,i,a){let n=(0,s.z)(e,t),r=i.axis||"xy",o=i.includeInvisible||!1,l=i.intersect?getIntersectItems(t,n,r,a,o):getNearestItems(t,n,r,!1,a,o);if(l.length>0){let e=l[0].datasetIndex,i=t.getDatasetMeta(e).data;l=[];for(let t=0;tt.pos===e)}function filterDynamicPositionByAxis(t,e){return t.filter(t=>-1===h.indexOf(t.pos)&&t.box.axis===e)}function sortByWeight(t,e){return t.sort((t,i)=>{let s=e?i:t,a=e?t:i;return s.weight===a.weight?s.index-a.index:s.weight-a.weight})}function wrapBoxes(t){let e,i,s,a,n,r;let o=[];for(e=0,i=(t||[]).length;et.box.fullSize),!0),s=sortByWeight(filterByPosition(e,"left"),!0),a=sortByWeight(filterByPosition(e,"right")),n=sortByWeight(filterByPosition(e,"top"),!0),r=sortByWeight(filterByPosition(e,"bottom")),o=filterDynamicPositionByAxis(e,"x"),l=filterDynamicPositionByAxis(e,"y");return{fullSize:i,leftAndTop:s.concat(n),rightAndBottom:a.concat(l).concat(r).concat(o),chartArea:filterByPosition(e,"chartArea"),vertical:s.concat(a).concat(l),horizontal:n.concat(r).concat(o)}}function getCombinedMax(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function updateMaxPadding(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function updateDims(t,e,i,a){let{pos:n,box:r}=i,o=t.maxPadding;if(!(0,s.i)(n)){i.size&&(t[n]-=i.size);let e=a[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?r.height:r.width),i.size=e.size/e.count,t[n]+=i.size}r.getPadding&&updateMaxPadding(o,r.getPadding());let l=Math.max(0,e.outerWidth-getCombinedMax(o,t,"left","right")),h=Math.max(0,e.outerHeight-getCombinedMax(o,t,"top","bottom")),d=l!==t.w,c=h!==t.h;return t.w=l,t.h=h,i.horizontal?{same:d,other:c}:{same:c,other:d}}function handleMaxPadding(t){let e=t.maxPadding;function updatePos(i){let s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=updatePos("top"),t.x+=updatePos("left"),updatePos("right"),updatePos("bottom")}function getMargins(t,e){let i=e.maxPadding;return function(t){let s={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{s[t]=Math.max(e[t],i[t])}),s}(t?["left","right"]:["top","bottom"])}function fitBoxes(t,e,i,s){let a,n,r,o,l,h;let d=[];for(a=0,n=t.length,l=0;a{"function"==typeof t.beforeLayout&&t.beforeLayout()});let c=h.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1,u=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/c,hBoxMaxHeight:o/2}),g=Object.assign({},n);updateMaxPadding(g,(0,s.E)(a));let p=Object.assign({maxPadding:g,w:r,h:o,x:n.left,y:n.top},n),f=setLayoutDims(h.concat(d),u);fitBoxes(l.fullSize,p,u,f),fitBoxes(h,p,u,f),fitBoxes(d,p,u,f)&&fitBoxes(h,p,u,f),handleMaxPadding(p),placeBoxes(l.leftAndTop,p,u,f),p.x+=p.w,p.y+=p.h,placeBoxes(l.rightAndBottom,p,u,f),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},(0,s.F)(l.chartArea,e=>{let i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};let BasePlatform=class BasePlatform{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}};let BasicPlatform=class BasicPlatform extends BasePlatform{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}};let c="$chartjs",u={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},isNullOrEmpty=t=>null===t||""===t;function initCanvas(t,e){let i=t.style,a=t.getAttribute("height"),n=t.getAttribute("width");if(t[c]={initial:{height:a,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",isNullOrEmpty(n)){let e=(0,s.J)(t,"width");void 0!==e&&(t.width=e)}if(isNullOrEmpty(a)){if(""===t.style.height)t.height=t.width/(e||2);else{let e=(0,s.J)(t,"height");void 0!==e&&(t.height=e)}}return t}let g=!!s.K&&{passive:!0};function addListener(t,e,i){t.addEventListener(e,i,g)}function removeListener(t,e,i){t.canvas.removeEventListener(e,i,g)}function fromNativeEvent(t,e){let i=u[t.type]||t.type,{x:a,y:n}=(0,s.z)(t,e);return{type:i,chart:e,native:t,x:void 0!==a?a:null,y:void 0!==n?n:null}}function nodeListContains(t,e){for(let i of t)if(i===e||i.contains(e))return!0}function createAttachObserver(t,e,i){let s=t.canvas,a=new MutationObserver(t=>{let e=!1;for(let i of t)e=(e=e||nodeListContains(i.addedNodes,s))&&!nodeListContains(i.removedNodes,s);e&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}function createDetachObserver(t,e,i){let s=t.canvas,a=new MutationObserver(t=>{let e=!1;for(let i of t)e=(e=e||nodeListContains(i.removedNodes,s))&&!nodeListContains(i.addedNodes,s);e&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}let p=new Map,f=0;function onWindowResize(){let t=window.devicePixelRatio;t!==f&&(f=t,p.forEach((e,i)=>{i.currentDevicePixelRatio!==t&&e()}))}function listenDevicePixelRatioChanges(t,e){p.size||window.addEventListener("resize",onWindowResize),p.set(t,e)}function unlistenDevicePixelRatioChanges(t){p.delete(t),p.size||window.removeEventListener("resize",onWindowResize)}function createResizeObserver(t,e,i){let a=t.canvas,n=a&&(0,s.I)(a);if(!n)return;let r=(0,s.L)((t,e)=>{let s=n.clientWidth;i(t,e),s{let e=t[0],i=e.contentRect.width,s=e.contentRect.height;(0!==i||0!==s)&&r(i,s)});return o.observe(n),listenDevicePixelRatioChanges(t,r),o}function releaseObserver(t,e,i){i&&i.disconnect(),"resize"===e&&unlistenDevicePixelRatioChanges(t)}function createProxyAndListen(t,e,i){let a=t.canvas,n=(0,s.L)(e=>{null!==t.ctx&&i(fromNativeEvent(e,t))},t);return addListener(a,e,n),n}let DomPlatform=class DomPlatform extends BasePlatform{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(initCanvas(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[c])return!1;let i=e[c].initial;["height","width"].forEach(t=>{let a=i[t];(0,s.k)(a)?e.removeAttribute(t):e.setAttribute(t,a)});let a=i.style||{};return Object.keys(a).forEach(t=>{e.style[t]=a[t]}),e.width=e.width,delete e[c],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:createAttachObserver,detach:createDetachObserver,resize:createResizeObserver}[e]||createProxyAndListen;s[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;let a={attach:releaseObserver,detach:releaseObserver,resize:releaseObserver}[e]||removeListener;a(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,a){return(0,s.G)(t,e,i,a)}isAttached(t){let e=(0,s.I)(t);return!!(e&&e.isConnected)}};function _detectPlatform(t){return!(0,s.M)()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?BasicPlatform:DomPlatform}let Element=class Element{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return(0,s.x)(this.x)&&(0,s.x)(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let s={};return t.forEach(t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),s}};function autoSkip(t,e){let i=t.options.ticks,a=determineMaxTicks(t),n=Math.min(i.maxTicksLimit||a,a),r=i.major.enabled?getMajorIndices(e):[],o=r.length,l=r[0],h=r[o-1],d=[];if(o>n)return skipMajors(e,d,r,o/n),d;let c=calculateSpacing(r,e,n);if(o>0){let t,i;let a=o>1?Math.round((h-l)/(o-1)):null;for(skip(e,d,c,(0,s.k)(a)?0:l-a,l),t=0,i=o-1;tn)return e}return Math.max(n,1)}function getMajorIndices(t){let e,i;let s=[];for(e=0,i=t.length;e"left"===t?"right":"right"===t?"left":t,offsetFromEdge=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,getTicksLimit=(t,e)=>Math.min(e||t,t);function sample(t,e){let i=[],s=t.length/e,a=t.length,n=0;for(;no+1e-6)))return l}function garbageCollect(t,e){(0,s.F)(t,t=>{let i;let s=t.gc,a=s.length/2;if(a>e){for(i=0;ia?a:i,a=n&&i>a?i:a,{min:(0,s.O)(i,(0,s.O)(a,i)),max:(0,s.O)(a,(0,s.O)(i,a))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){let e=this._labelItems||(this._labelItems=this._computeLabelItems(t));return e}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){(0,s.Q)(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:a,grace:n,ticks:r}=this.options,o=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=(0,s.R)(this,n,a),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=o=l||r<=1||!this.isHorizontal()){this.labelRotation=o;return}let d=this._getLabelSizes(),c=d.widest.width,u=d.highest.height,g=(0,s.S)(this.chart.width-c,0,this.maxWidth);c+6>(t=a.offset?this.maxWidth/r:g/(r-1))&&(t=g/(r-(a.offset?.5:1)),e=this.maxHeight-getTickMarkLength(a.grid)-n.padding-getTitleHeight(a.title,this.chart.options.font),i=Math.sqrt(c*c+u*u),h=Math.max(o,Math.min(l,h=(0,s.U)(Math.min(Math.asin((0,s.S)((d.highest.height+6)/t,-1,1)),Math.asin((0,s.S)(e/i,-1,1))-Math.asin((0,s.S)(u/i,-1,1))))))),this.labelRotation=h}afterCalculateLabelRotation(){(0,s.Q)(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){(0,s.Q)(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:a,grid:n}}=this,r=this._isVisible(),o=this.isHorizontal();if(r){let r=getTitleHeight(a,e.options.font);if(o?(t.width=this.maxWidth,t.height=getTickMarkLength(n)+r):(t.height=this.maxHeight,t.width=getTickMarkLength(n)+r),i.display&&this.ticks.length){let{first:e,last:a,widest:n,highest:r}=this._getLabelSizes(),l=2*i.padding,h=(0,s.t)(this.labelRotation),d=Math.cos(h),c=Math.sin(h);if(o){let e=i.mirror?0:c*n.width+d*r.height;t.height=Math.min(this.maxHeight,t.height+e+l)}else{let e=i.mirror?0:d*n.width+c*r.height;t.width=Math.min(this.maxWidth,t.width+e+l)}this._calculatePadding(e,a,c,d)}}this._handleMargins(),o?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){let{ticks:{align:a,padding:n},position:r}=this.options,o=0!==this.labelRotation,l="top"!==r&&"x"===this.axis;if(this.isHorizontal()){let r=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),d=0,c=0;o?l?(d=s*t.width,c=i*e.height):(d=i*t.height,c=s*e.width):"start"===a?c=e.width:"end"===a?d=t.width:"inner"!==a&&(d=t.width/2,c=e.width/2),this.paddingLeft=Math.max((d-r+n)*this.width/(this.width-r),0),this.paddingRight=Math.max((c-h+n)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===a?(i=0,s=t.height):"end"===a&&(i=e.height,s=0),this.paddingTop=i+n,this.paddingBottom=s+n}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){(0,s.Q)(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e({width:x[t]||0,height:b[t]||0});return{first:valueAt(0),last:valueAt(e-1),widest:valueAt(k),highest:valueAt(M),widths:x,heights:b}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return(0,s.W)(this._alignToPixels?(0,s.X)(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&to*a?o/i:l/a:l*a0}_computeGridLineItems(t){let e,i,a,n,r,o,l,h,d,c,u,g;let p=this.axis,f=this.chart,m=this.options,{grid:x,position:b,border:_}=m,v=x.offset,y=this.isHorizontal(),k=this.ticks,M=k.length+(v?1:0),S=getTickMarkLength(x),P=[],w=_.setContext(this.getContext()),C=w.display?w.width:0,D=C/2,alignBorderValue=function(t){return(0,s.X)(f,t,C)};if("top"===b)e=alignBorderValue(this.bottom),o=this.bottom-S,h=e-D,c=alignBorderValue(t.top)+D,g=t.bottom;else if("bottom"===b)e=alignBorderValue(this.top),c=t.top,g=alignBorderValue(t.bottom)-D,o=e+D,h=this.top+S;else if("left"===b)e=alignBorderValue(this.right),r=this.right-S,l=e-D,d=alignBorderValue(t.left)+D,u=t.right;else if("right"===b)e=alignBorderValue(this.left),d=t.left,u=alignBorderValue(t.right)-D,r=e+D,l=this.left+S;else if("x"===p){if("center"===b)e=alignBorderValue((t.top+t.bottom)/2+.5);else if((0,s.i)(b)){let t=Object.keys(b)[0],i=b[t];e=alignBorderValue(this.chart.scales[t].getPixelForValue(i))}c=t.top,g=t.bottom,h=(o=e+D)+S}else if("y"===p){if("center"===b)e=alignBorderValue((t.left+t.right)/2);else if((0,s.i)(b)){let t=Object.keys(b)[0],i=b[t];e=alignBorderValue(this.chart.scales[t].getPixelForValue(i))}l=(r=e-D)-S,d=t.left,u=t.right}let L=(0,s.v)(m.ticks.maxTicksLimit,M),A=Math.max(1,Math.ceil(M/L));for(i=0;i0&&(h-=r/2)}t={left:h,top:l,width:r+a.width,height:n+a.height,color:g.backdropColor}}C.push({label:a,font:h,textOffset:u,options:{rotation:w,color:_,strokeColor:y,strokeWidth:M,textAlign:S,textBaseline:D,translation:[n,r],backdrop:t}})}return C}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options,i=-(0,s.t)(this.labelRotation);if(i)return"top"===t?"left":"right";let a="center";return"start"===e.align?a="left":"end"===e.align?a="right":"inner"===e.align&&(a="inner"),a}_getYAxisLabelAlignment(t){let e,i;let{position:s,ticks:{crossAlign:a,mirror:n,padding:r}}=this.options,o=this._getLabelSizes(),l=t+r,h=o.widest.width;return"left"===s?n?(i=this.right+r,"near"===a?e="left":"center"===a?(e="center",i+=h/2):(e="right",i+=h)):(i=this.right-l,"near"===a?e="right":"center"===a?(e="center",i-=h/2):(e="left",i=this.left)):"right"===s?n?(i=this.left+r,"near"===a?e="right":"center"===a?(e="center",i-=h/2):(e="left",i-=h)):(i=this.left+l,"near"===a?e="left":"center"===a?(e="center",i+=h/2):(e="right",i=this.right)):e="right",{textAlign:e,x:i}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:i,top:s,width:a,height:n}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,a,n),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let i=this.ticks,s=i.findIndex(e=>e.value===t);if(s>=0){let t=e.setContext(this.getContext(s));return t.lineWidth}return 0}drawGrid(t){let e,i;let s=this.options.grid,a=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),drawLine=(t,e,i)=>{i.width&&i.color&&(a.save(),a.lineWidth=i.width,a.strokeStyle=i.color,a.setLineDash(i.borderDash||[]),a.lineDashOffset=i.borderDashOffset,a.beginPath(),a.moveTo(t.x,t.y),a.lineTo(e.x,e.y),a.stroke(),a.restore())};if(s.display)for(e=0,i=n.length;e{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:a,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){let e,i;let s=this.chart.getSortedVisibleDatasetMetas(),a=this.axis+"AxisID",n=[];for(e=0,i=s.length;e{let a=i.split("."),n=a.pop(),r=[t].concat(a).join("."),o=e[i].split("."),l=o.pop(),h=o.join(".");s.d.route(r,n,h,l)})}function isIChartComponent(t){return"id"in t&&"defaults"in t}let Registry=class Registry{constructor(){this.controllers=new TypedRegistry(DatasetController,"datasets",!0),this.elements=new TypedRegistry(Element,"elements"),this.plugins=new TypedRegistry(Object,"plugins"),this.scales=new TypedRegistry(Scale,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(e=>{let a=i||this._getRegistryForType(e);i||a.isForType(e)||a===this.plugins&&e.id?this._exec(t,a,e):(0,s.F)(e,e=>{let s=i||this._getRegistryForType(e);this._exec(t,s,e)})})}_exec(t,e,i){let a=(0,s.a5)(t);(0,s.Q)(i["before"+a],[],i),e[t](i),(0,s.Q)(i["after"+a],[],i)}_getRegistryForType(t){for(let e=0;et.filter(t=>!e.some(e=>t.plugin.id===e.plugin.id));this._notify(diff(e,i),t,"stop"),this._notify(diff(i,e),t,"start")}};function allPlugins(t){let e={},i=[],s=Object.keys(m.plugins.items);for(let t=0;t1&&idMatchesAxis(t[0].toLowerCase());if(e)return e}throw Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function getAxisFromDataset(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function retrieveAxisFromDatasets(t,e){if(e.data&&e.data.datasets){let i=e.data.datasets.filter(e=>e.xAxisID===t||e.yAxisID===t);if(i.length)return getAxisFromDataset(t,"x",i[0])||getAxisFromDataset(t,"y",i[0])}return{}}function mergeScaleConfig(t,e){let i=s.a3[t.type]||{scales:{}},a=e.scales||{},n=getIndexAxis(t.type,e),r=Object.create(null);return Object.keys(a).forEach(e=>{let o=a[e];if(!(0,s.i)(o))return console.error(`Invalid scale configuration for scale: ${e}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);let l=determineAxis(e,o,retrieveAxisFromDatasets(e,t),s.d.scales[o.type]),h=getDefaultScaleIDFromAxis(l,n),d=i.scales||{};r[e]=(0,s.ab)(Object.create(null),[{axis:l},o,d[l],d[h]])}),t.data.datasets.forEach(i=>{let n=i.type||t.type,o=i.indexAxis||getIndexAxis(n,e),l=s.a3[n]||{},h=l.scales||{};Object.keys(h).forEach(t=>{let e=getAxisFromDefaultScaleID(t,o),n=i[e+"AxisID"]||e;r[n]=r[n]||Object.create(null),(0,s.ab)(r[n],[{axis:e},a[n],h[t]])})}),Object.keys(r).forEach(t=>{let e=r[t];(0,s.ab)(e,[s.d.scales[e.type],s.d.scale])}),r}function initOptions(t){let e=t.options||(t.options={});e.plugins=(0,s.v)(e.plugins,{}),e.scales=mergeScaleConfig(t,e)}function initData(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}function initConfig(t){return(t=t||{}).data=initData(t.data),initOptions(t),t}let x=new Map,b=new Set;function cachedKeys(t,e){let i=x.get(t);return i||(i=e(),x.set(t,i),b.add(i)),i}let addIfFound=(t,e,i)=>{let a=(0,s.f)(e,i);void 0!==a&&t.add(a)};let Config=class Config{constructor(t){this._config=initConfig(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=initData(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),initOptions(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return cachedKeys(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return cachedKeys(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return cachedKeys(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return cachedKeys(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){let{options:a,type:n}=this,r=this._cachedScopes(t,i),o=r.get(e);if(o)return o;let l=new Set;e.forEach(e=>{t&&(l.add(t),e.forEach(e=>addIfFound(l,t,e))),e.forEach(t=>addIfFound(l,a,t)),e.forEach(t=>addIfFound(l,s.a3[n]||{},t)),e.forEach(t=>addIfFound(l,s.d,t)),e.forEach(t=>addIfFound(l,s.a6,t))});let h=Array.from(l);return 0===h.length&&h.push(Object.create(null)),b.has(e)&&r.set(e,h),h}chartOptionScopes(){let{options:t,type:e}=this;return[t,s.a3[e]||{},s.d.datasets[e]||{},{type:e},s.d,s.a6]}resolveNamedOptions(t,e,i,a=[""]){let n={$shared:!0},{resolver:r,subPrefixes:o}=getResolver(this._resolverCache,t,a),l=r;if(needContext(r,e)){n.$shared=!1,i=(0,s.a7)(i)?i():i;let e=this.createResolver(t,i,o);l=(0,s.a8)(r,i,e)}for(let t of e)n[t]=l[t];return n}createResolver(t,e,i=[""],a){let{resolver:n}=getResolver(this._resolverCache,t,i);return(0,s.i)(e)?(0,s.a8)(n,e,void 0,a):n}};function getResolver(t,e,i){let a=t.get(e);a||(a=new Map,t.set(e,a));let n=i.join(),r=a.get(n);if(!r){let t=(0,s.a9)(e,i);r={resolver:t,subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},a.set(n,r)}return r}let hasFunction=t=>(0,s.i)(t)&&Object.getOwnPropertyNames(t).some(e=>(0,s.a7)(t[e]));function needContext(t,e){let{isScriptable:i,isIndexable:a}=(0,s.aa)(t);for(let n of e){let e=i(n),r=a(n),o=(r||e)&&t[n];if(e&&((0,s.a7)(o)||hasFunction(o))||r&&(0,s.b)(o))return!0}return!1}let _=["top","bottom","left","right","chartArea"];function positionIsHorizontal(t,e){return"top"===t||"bottom"===t||-1===_.indexOf(t)&&"x"===e}function compare2Level(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function onAnimationsComplete(t){let e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),(0,s.Q)(i&&i.onComplete,[t],e)}function onAnimationProgress(t){let e=t.chart,i=e.options.animation;(0,s.Q)(i&&i.onProgress,[t],e)}function getCanvas(t){return(0,s.M)()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}let v={},getChart=t=>{let e=getCanvas(t);return Object.values(v).filter(t=>t.canvas===e).pop()};function moveNumericKeys(t,e,i){let s=Object.keys(t);for(let a of s){let s=+a;if(s>=e){let n=t[a];delete t[a],(i>0||s>e)&&(t[s+i]=n)}}}function determineLastEvent(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}function getSizeForArea(t,e,i){return t.options.clip?t[i]:e[i]}function getDatasetArea(t,e){let{xScale:i,yScale:s}=t;return i&&s?{left:getSizeForArea(i,e,"left"),right:getSizeForArea(i,e,"right"),top:getSizeForArea(s,e,"top"),bottom:getSizeForArea(s,e,"bottom")}:e}let Chart=class Chart{static defaults=s.d;static instances=v;static overrides=s.a3;static registry=m;static version="4.4.1";static getChart=getChart;static register(...t){m.add(...t),invalidatePlugins()}static unregister(...t){m.remove(...t),invalidatePlugins()}constructor(t,e){let i=this.config=new Config(e),n=getCanvas(t),r=getChart(n);if(r)throw Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");let o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||_detectPlatform(n)),this.platform.updateConfig(i);let l=this.platform.acquireContext(n,o.aspectRatio),h=l&&l.canvas,d=h&&h.height,c=h&&h.width;if(this.id=(0,s.ac)(),this.ctx=l,this.canvas=h,this.width=c,this.height=d,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new PluginService,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=(0,s.ad)(t=>this.update(t),o.resizeDelay||0),this._dataChanges=[],v[this.id]=this,!l||!h){console.error("Failed to create chart: can't acquire context from the given item");return}a.listen(this,"complete",onAnimationsComplete),a.listen(this,"progress",onAnimationProgress),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:a,_aspectRatio:n}=this;return(0,s.k)(t)?e&&n?n:a?i/a:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return m}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():(0,s.ae)(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return(0,s.af)(this.canvas,this.ctx),this}stop(){return a.stop(this),this}resize(t,e){a.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,a=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(a,t,e,n),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,(0,s.ae)(this,o,!0)&&(this.notifyPlugins("resize",{size:r}),(0,s.Q)(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let t=this.options,e=t.scales||{};(0,s.F)(e,(t,e)=>{t.id=e})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,a=Object.keys(i).reduce((t,e)=>(t[e]=!1,t),{}),n=[];e&&(n=n.concat(Object.keys(e).map(t=>{let i=e[t],s=determineAxis(t,i),a="r"===s,n="x"===s;return{options:i,dposition:a?"chartArea":n?"bottom":"left",dtype:a?"radialLinear":n?"category":"linear"}}))),(0,s.F)(n,e=>{let n=e.options,r=n.id,o=determineAxis(r,n),l=(0,s.v)(n.type,e.dtype);(void 0===n.position||positionIsHorizontal(n.position,o)!==positionIsHorizontal(e.dposition))&&(n.position=e.dposition),a[r]=!0;let h=null;if(r in i&&i[r].type===l)h=i[r];else{let t=m.getScale(l);i[(h=new t({id:r,type:l,ctx:this.ctx,chart:this})).id]=h}h.init(n,t)}),(0,s.F)(a,(t,e)=>{t||delete i[e]}),(0,s.F)(i,t=>{d.configure(this,t,t.options),d.addBox(this,t)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),i>e){for(let t=e;te.length&&delete this._stacks,t.forEach((t,i)=>{0===e.filter(e=>e===t._dataset).length&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){let t,e;let i=[],a=this.data.datasets;for(this._removeUnreferencedMetasets(),t=0,e=a.length;t{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),a=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;let n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let t=0,e=this.data.datasets.length;t{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(compare2Level("z","_idx"));let{_active:o,_lastEvent:l}=this;l?this._eventHandler(l,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){(0,s.F)(this.scales,t=>{d.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(0,s.ag)(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:s,count:a}of e){let e="_removeElements"===i?-a:a;moveNumericKeys(t,s,e)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,makeSet=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),i=makeSet(0);for(let t=1;tt.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;d.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],(0,s.F)(this.boxes,t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,e)=>{t._idx=e}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i=t._clip,a=!i.disabled,n=getDatasetArea(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",r)&&(a&&(0,s.Y)(e,{left:!1===i.left?0:n.left-i.left,right:!1===i.right?this.width:n.right+i.right,top:!1===i.top?0:n.top-i.top,bottom:!1===i.bottom?this.height:n.bottom+i.bottom}),t.controller.draw(),a&&(0,s.$)(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return(0,s.C)(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){let a=l.modes[e];return"function"==typeof a?a(this,t,i,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,s=i.filter(t=>t&&t._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=(0,s.j)(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let a=i?"show":"hide",n=this.getDatasetMeta(t),r=n.controller._resolveAnimations(void 0,a);(0,s.h)(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(n,{visible:i}),this.update(e=>e.datasetIndex===t?a:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),a.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,i,s),t[i]=s},listener=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};(0,s.F)(this.options.events,t=>_add(t,listener))}bindResponsiveEvents(){let t;this._responsiveListeners||(this._responsiveListeners={});let e=this._responsiveListeners,i=this.platform,_add=(t,s)=>{i.addEventListener(this,t,s),e[t]=s},_remove=(t,s)=>{e[t]&&(i.removeEventListener(this,t,s),delete e[t])},listener=(t,e)=>{this.canvas&&this.resize(t,e)},attached=()=>{_remove("attach",attached),this.attached=!0,this.resize(),_add("resize",listener),_add("detach",t)};t=()=>{this.attached=!1,_remove("resize",listener),this._stop(),this._resize(0,0),_add("attach",attached)},i.isAttached(this.canvas)?attached():t()}unbindEvents(){(0,s.F)(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},(0,s.F)(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let s,a,n;let r=i?"set":"remove";for("dataset"===e&&this.getDatasetMeta(t[0].datasetIndex).controller["_"+r+"DatasetHoverStyle"](),a=0,n=t.length;a{let i=this.getDatasetMeta(t);if(!i)throw Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),a=!(0,s.ah)(i,e);a&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter(e=>e.plugin.id===t).length}_updateHoverStyles(t,e,i){let s=this.options.hover,diff=(t,e)=>t.filter(t=>!e.some(e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)),a=diff(e,t),n=i?t:diff(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),n.length&&s.mode&&this.updateHoverStyle(n,s.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},eventFilter=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,eventFilter))return;let s=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,eventFilter),(s||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:a=[],options:n}=this,r=this._getActiveElements(t,a,i,e),o=(0,s.ai)(t),l=determineLastEvent(t,this._lastEvent,i,o);i&&(this._lastEvent=null,(0,s.Q)(n.onHover,[t,r,this],this),o&&(0,s.Q)(n.onClick,[t,r,this],this));let h=!(0,s.ah)(r,a);return(h||e)&&(this._active=r,this._updateHoverStyles(r,a,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;let a=this.options.hover;return this.getElementsAtEventForMode(t,a.mode,a,s)}};function invalidatePlugins(){return(0,s.F)(Chart.instances,t=>t._plugins.invalidate())}function clipArc(t,e,i){let{startAngle:a,pixelMargin:n,x:r,y:o,outerRadius:l,innerRadius:h}=e,d=n/l;t.beginPath(),t.arc(r,o,l,a-d,i+d),h>n?(d=n/h,t.arc(r,o,h,i+d,a-d,!0)):t.arc(r,o,n,i+s.H,a-s.H),t.closePath(),t.clip()}function toRadiusCorners(t){return(0,s.ak)(t,["outerStart","outerEnd","innerStart","innerEnd"])}function parseBorderRadius$1(t,e,i,a){let n=toRadiusCorners(t.options.borderRadius),r=(i-e)/2,o=Math.min(r,a*e/2),computeOuterLimit=t=>{let e=(i-Math.min(r,t))*a/2;return(0,s.S)(t,0,Math.min(r,e))};return{outerStart:computeOuterLimit(n.outerStart),outerEnd:computeOuterLimit(n.outerEnd),innerStart:(0,s.S)(n.innerStart,0,o),innerEnd:(0,s.S)(n.innerEnd,0,o)}}function rThetaToXY(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function pathArc(t,e,i,a,n,r){let{x:o,y:l,startAngle:h,pixelMargin:d,innerRadius:c}=e,u=Math.max(e.outerRadius+a+i-d,0),g=c>0?c+a+i+d:0,p=0,f=n-h;if(a){let t=u>0?u-a:0,e=((c>0?c-a:0)+t)/2;p=(f-(0!==e?f*e/(e+a):f))/2}let m=Math.max(.001,f*u-i/s.P)/u,x=(f-m)/2,b=h+x+p,_=n-x-p,{outerStart:v,outerEnd:y,innerStart:k,innerEnd:M}=parseBorderRadius$1(e,g,u,_-b),S=u-v,P=u-y,w=b+v/S,C=_-y/P,D=g+k,L=g+M,A=b+k/D,T=_-M/L;if(t.beginPath(),r){let e=(w+C)/2;if(t.arc(o,l,u,w,e),t.arc(o,l,u,e,C),y>0){let e=rThetaToXY(P,C,o,l);t.arc(e.x,e.y,y,C,_+s.H)}let i=rThetaToXY(L,_,o,l);if(t.lineTo(i.x,i.y),M>0){let e=rThetaToXY(L,T,o,l);t.arc(e.x,e.y,M,_+s.H,T+Math.PI)}let a=(_-M/g+(b+k/g))/2;if(t.arc(o,l,g,_-M/g,a,!0),t.arc(o,l,g,a,b+k/g,!0),k>0){let e=rThetaToXY(D,A,o,l);t.arc(e.x,e.y,k,A+Math.PI,b-s.H)}let n=rThetaToXY(S,b,o,l);if(t.lineTo(n.x,n.y),v>0){let e=rThetaToXY(S,w,o,l);t.arc(e.x,e.y,v,b-s.H,w)}}else{t.moveTo(o,l);let e=Math.cos(w)*u+o,i=Math.sin(w)*u+l;t.lineTo(e,i);let s=Math.cos(C)*u+o,a=Math.sin(C)*u+l;t.lineTo(s,a)}t.closePath()}function drawArc(t,e,i,a,n){let{fullCircles:r,startAngle:o,circumference:l}=e,h=e.endAngle;if(r){pathArc(t,e,i,a,h,n);for(let e=0;e"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){let a=this.getProps(["x","y"],i),{angle:n,distance:r}=(0,s.D)(a,{x:t,y:e}),{startAngle:o,endAngle:l,innerRadius:h,outerRadius:d,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=(this.options.spacing+this.options.borderWidth)/2,g=(0,s.v)(c,l-o),p=g>=s.T||(0,s.p)(n,o,l),f=(0,s.aj)(r,h+u,d+u);return p&&f}getCenterPoint(t){let{x:e,y:i,startAngle:s,endAngle:a,innerRadius:n,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:o,spacing:l}=this.options,h=(s+a)/2,d=(n+r+l+o)/2;return{x:e+Math.cos(h)*d,y:i+Math.sin(h)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){let{options:e,circumference:i}=this,a=(e.offset||0)/4,n=(e.spacing||0)/2,r=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>s.T?Math.floor(i/s.T):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let o=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(o)*a,Math.sin(o)*a);let l=1-Math.sin(Math.min(s.P,i||0)),h=a*l;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,drawArc(t,this,h,n,r),drawBorder(t,this,h,n,r),t.restore()}};function setStyle(t,e,i=e){t.lineCap=(0,s.v)(i.borderCapStyle,e.borderCapStyle),t.setLineDash((0,s.v)(i.borderDash,e.borderDash)),t.lineDashOffset=(0,s.v)(i.borderDashOffset,e.borderDashOffset),t.lineJoin=(0,s.v)(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=(0,s.v)(i.borderWidth,e.borderWidth),t.strokeStyle=(0,s.v)(i.borderColor,e.borderColor)}function lineTo(t,e,i){t.lineTo(i.x,i.y)}function getLineMethod(t){return t.stepped?s.ar:t.tension||"monotone"===t.cubicInterpolationMode?s.as:lineTo}function pathVars(t,e,i={}){let s=t.length,{start:a=0,end:n=s-1}=i,{start:r,end:o}=e,l=Math.max(a,r),h=Math.min(n,o);return{count:s,start:l,loop:e.loop,ilen:ho&&n>o)?s+h-l:h-l}}function pathSegment(t,e,i,s){let a,n,r;let{points:o,options:l}=e,{count:h,start:d,loop:c,ilen:u}=pathVars(o,i,s),g=getLineMethod(l),{move:p=!0,reverse:f}=s||{};for(a=0;a<=u;++a)(n=o[(d+(f?u-a:a))%h]).skip||(p?(t.moveTo(n.x,n.y),p=!1):g(t,r,n,f,l.stepped),r=n);return c&&g(t,r,n=o[(d+(f?u:0))%h],f,l.stepped),!!c}function fastPathSegment(t,e,i,s){let a,n,r,o,l,h;let d=e.points,{count:c,start:u,ilen:g}=pathVars(d,i,s),{move:p=!0,reverse:f}=s||{},m=0,x=0,pointIndex=t=>(u+(f?g-t:t))%c,drawX=()=>{o!==l&&(t.lineTo(m,l),t.lineTo(m,o),t.lineTo(m,h))};for(p&&(n=d[pointIndex(0)],t.moveTo(n.x,n.y)),a=0;a<=g;++a){if((n=d[pointIndex(a)]).skip)continue;let e=n.x,i=n.y,s=0|e;s===r?(il&&(l=i),m=(x*m+e)/++x):(drawX(),t.lineTo(e,i),r=s,x=0,o=l=i),h=i}drawX()}function _getSegmentMethod(t){let e=t.options,i=e.borderDash&&e.borderDash.length,s=!t._decimated&&!t._loop&&!e.tension&&"monotone"!==e.cubicInterpolationMode&&!e.stepped&&!i;return s?fastPathSegment:pathSegment}function _getInterpolationMethod(t){return t.stepped?s.ao:t.tension||"monotone"===t.cubicInterpolationMode?s.ap:s.aq}function strokePathWithCache(t,e,i,s){let a=e._path;!a&&(a=e._path=new Path2D,e.path(a,i,s)&&a.closePath()),setStyle(t,e.options),t.stroke(a)}function strokePathDirect(t,e,i,s){let{segments:a,options:n}=e,r=_getSegmentMethod(e);for(let o of a)setStyle(t,n,o.style),t.beginPath(),r(t,e,o,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}let y="function"==typeof Path2D;function draw(t,e,i,s){y&&!e.options.segment?strokePathWithCache(t,e,i,s):strokePathDirect(t,e,i,s)}let LineElement=class LineElement extends Element{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){let a=i.spanGaps?this._loop:this._fullLoop;(0,s.al)(this._points,i,t,a,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=(0,s.am)(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i,a;let n=this.options,r=t[e],o=this.points,l=(0,s.an)(this,{property:e,start:r,end:r});if(!l.length)return;let h=[],d=_getInterpolationMethod(n);for(i=0,a=l.length;it.replace("rgb(","rgba(").replace(")",", 0.5)"));function getBorderColor(t){return k[t%k.length]}function getBackgroundColor(t){return M[t%M.length]}function _segments(t,e,i){let a=t.segments,n=t.points,r=e.points,o=[];for(let t of a){let{start:a,end:l}=t;l=_findSegmentEnd(a,l,n);let h=_getBounds(i,n[a],n[l],t.loop);if(!e.segments){o.push({source:t,target:h,start:n[a],end:n[l]});continue}let d=(0,s.an)(e,h);for(let e of d){let a=_getBounds(i,r[e.start],r[e.end],e.loop),l=(0,s.ax)(t,n,a);for(let t of l)o.push({source:t,target:e,start:{[i]:_getEdge(h,a,"start",Math.max)},end:{[i]:_getEdge(h,a,"end",Math.min)}})}}return o}function _getBounds(t,e,i,a){if(a)return;let n=e[t],r=i[t];return"angle"===t&&(n=(0,s.ay)(n),r=(0,s.ay)(r)),{property:t,start:n,end:r}}function _pointsFromSegments(t,e){let{x:i=null,y:s=null}=t||{},a=e.points,n=[];return e.segments.forEach(({start:t,end:e})=>{e=_findSegmentEnd(t,e,a);let r=a[t],o=a[e];null!==s?(n.push({x:r.x,y:s}),n.push({x:o.x,y:s})):null!==i&&(n.push({x:i,y:r.y}),n.push({x:i,y:o.y}))}),n}function _findSegmentEnd(t,e,i){for(;e>t;e--){let t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function _getEdge(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function _createBoundaryLine(t,e){let i=[],a=!1;return(0,s.b)(t)?(a=!0,i=t):i=_pointsFromSegments(t,e),i.length?new LineElement({points:i,options:{tension:0},_loop:a,_fullLoop:a}):null}function _getTargetPixel(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:(0,s.i)(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}function _getTargetValue(t,e,i){return"start"===t?i:"end"===t?e.options.reverse?e.min:e.max:(0,s.i)(t)?t.value:e.getBaseValue()}function _buildStackLine(t){let{scale:e,index:i,line:s}=t,a=[],n=s.segments,r=s.points,o=getLinesBelow(e,i);o.push(_createBoundaryLine({x:null,y:e.bottom},s));for(let t=0;tt.length>e.length?t:e)),e+i.size/2+s.measureText(a).width}function calculateItemHeight(t,e,i){let s=t;return"string"!=typeof e.text&&(s=calculateLegendItemHeight(e,i)),s}function calculateLegendItemHeight(t,e){let i=t.text?t.text.length:0;return e*i}new WeakMap;let S={average(t){let e,i;if(!t.length)return!1;let s=0,a=0,n=0;for(e=0,i=t.length;e-1?t.split("\n"):t}function createTooltipItem(t,e){let{element:i,datasetIndex:s,index:a}=e,n=t.getDatasetMeta(s).controller,{label:r,value:o}=n.getLabelAndValue(a);return{chart:t,label:r,parsed:n.getParsed(a),raw:t.data.datasets[s].data[a],formattedValue:o,dataset:n.getDataset(),dataIndex:a,datasetIndex:s,element:i}}function getTooltipSize(t,e){let i=t.chart.ctx,{body:a,footer:n,title:r}=t,{boxWidth:o,boxHeight:l}=e,h=(0,s.a0)(e.bodyFont),d=(0,s.a0)(e.titleFont),c=(0,s.a0)(e.footerFont),u=r.length,g=n.length,p=a.length,f=(0,s.E)(e.padding),m=f.height,x=0,b=a.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0);if(b+=t.beforeBody.length+t.afterBody.length,u&&(m+=u*d.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),b){let t=e.displayColors?Math.max(l,h.lineHeight):h.lineHeight;m+=p*t+(b-p)*h.lineHeight+(b-1)*e.bodySpacing}g&&(m+=e.footerMarginTop+g*c.lineHeight+(g-1)*e.footerSpacing);let _=0,maxLineWidth=function(t){x=Math.max(x,i.measureText(t).width+_)};return i.save(),i.font=d.string,(0,s.F)(t.title,maxLineWidth),i.font=h.string,(0,s.F)(t.beforeBody.concat(t.afterBody),maxLineWidth),_=e.displayColors?o+2+e.boxPadding:0,(0,s.F)(a,t=>{(0,s.F)(t.before,maxLineWidth),(0,s.F)(t.lines,maxLineWidth),(0,s.F)(t.after,maxLineWidth)}),_=0,i.font=c.string,(0,s.F)(t.footer,maxLineWidth),i.restore(),{width:x+=f.width,height:m}}function determineYAlign(t,e){let{y:i,height:s}=e;return it.height-s/2?"bottom":"center"}function doesNotFitWithAlign(t,e,i,s){let{x:a,width:n}=s,r=i.caretSize+i.caretPadding;if("left"===t&&a+n+r>e.width||"right"===t&&a-n-r<0)return!0}function determineXAlign(t,e,i,s){let{x:a,width:n}=i,{width:r,chartArea:{left:o,right:l}}=t,h="center";return"center"===s?h=a<=(o+l)/2?"left":"right":a<=n/2?h="left":a>=r-n/2&&(h="right"),doesNotFitWithAlign(h,t,e,i)&&(h="center"),h}function determineAlignment(t,e,i){let s=i.yAlign||e.yAlign||determineYAlign(t,i);return{xAlign:i.xAlign||e.xAlign||determineXAlign(t,e,i,s),yAlign:s}}function alignX(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}function alignY(t,e,i){let{y:s,height:a}=t;return"top"===e?s+=i:"bottom"===e?s-=a+i:s-=a/2,s}function getBackgroundPoint(t,e,i,a){let{caretSize:n,caretPadding:r,cornerRadius:o}=t,{xAlign:l,yAlign:h}=i,d=n+r,{topLeft:c,topRight:u,bottomLeft:g,bottomRight:p}=(0,s.aw)(o),f=alignX(e,l),m=alignY(e,h,d);return"center"===h?"left"===l?f+=d:"right"===l&&(f-=d):"left"===l?f-=Math.max(c,g)+n:"right"===l&&(f+=Math.max(u,p)+n),{x:(0,s.S)(f,0,a.width-e.width),y:(0,s.S)(m,0,a.height-e.height)}}function getAlignedX(t,e,i){let a=(0,s.E)(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-a.right:t.x+a.left}function createTooltipContext(t,e,i){return(0,s.j)(t,{tooltip:e,tooltipItems:i,type:"tooltip"})}function overrideCallbacks(t,e){let i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}let P={beforeTitle:s.aF,title(t){if(t.length>0){let e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex{let e={before:[],lines:[],after:[]},s=overrideCallbacks(i,t);pushOrConcat(e.before,splitNewlines(invokeCallbackWithFallback(s,"beforeLabel",this,t))),pushOrConcat(e.lines,invokeCallbackWithFallback(s,"label",this,t)),pushOrConcat(e.after,splitNewlines(invokeCallbackWithFallback(s,"afterLabel",this,t))),a.push(e)}),a}getAfterBody(t,e){return pushOrConcat([],splitNewlines(invokeCallbackWithFallback(e.callbacks,"afterBody",this,t)))}getFooter(t,e){let{callbacks:i}=e,s=invokeCallbackWithFallback(i,"beforeFooter",this,t),a=invokeCallbackWithFallback(i,"footer",this,t),n=invokeCallbackWithFallback(i,"afterFooter",this,t),r=[];return r=pushOrConcat(r,splitNewlines(s)),r=pushOrConcat(r,splitNewlines(a)),r=pushOrConcat(r,splitNewlines(n))}_createItems(t){let e,i;let a=this._active,n=this.chart.data,r=[],o=[],l=[],h=[];for(e=0,i=a.length;et.filter(e,i,s,n))),t.itemSort&&(h=h.sort((e,i)=>t.itemSort(e,i,n))),(0,s.F)(h,e=>{let i=overrideCallbacks(t.callbacks,e);r.push(invokeCallbackWithFallback(i,"labelColor",this,e)),o.push(invokeCallbackWithFallback(i,"labelPointStyle",this,e)),l.push(invokeCallbackWithFallback(i,"labelTextColor",this,e))}),this.labelColors=r,this.labelPointStyles=o,this.labelTextColors=l,this.dataPoints=h,h}update(t,e){let i;let s=this.options.setContext(this.getContext()),a=this._active,n=[];if(a.length){let t=S[s.position].call(this,a,this._eventPosition);n=this._createItems(s),this.title=this.getTitle(n,s),this.beforeBody=this.getBeforeBody(n,s),this.body=this.getBody(n,s),this.afterBody=this.getAfterBody(n,s),this.footer=this.getFooter(n,s);let e=this._size=getTooltipSize(this,s),r=Object.assign({},t,e),o=determineAlignment(this.chart,s,r),l=getBackgroundPoint(s,r,o,this.chart);this.xAlign=o.xAlign,this.yAlign=o.yAlign,i={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(i={opacity:0});this._tooltipItems=n,this.$context=void 0,i&&this._resolveAnimations().update(this,i),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){let a=this.getCaretPosition(t,i,s);e.lineTo(a.x1,a.y1),e.lineTo(a.x2,a.y2),e.lineTo(a.x3,a.y3)}getCaretPosition(t,e,i){let a,n,r,o,l,h;let{xAlign:d,yAlign:c}=this,{caretSize:u,cornerRadius:g}=i,{topLeft:p,topRight:f,bottomLeft:m,bottomRight:x}=(0,s.aw)(g),{x:b,y:_}=t,{width:v,height:y}=e;return"center"===c?(l=_+y/2,"left"===d?(n=(a=b)-u,o=l+u,h=l-u):(n=(a=b+v)+u,o=l-u,h=l+u),r=a):(n="left"===d?b+Math.max(p,m)+u:"right"===d?b+v-Math.max(f,x)-u:this.caretX,"top"===c?(l=(o=_)-u,a=n-u,r=n+u):(l=(o=_+y)+u,a=n+u,r=n-u),h=o),{x1:a,x2:n,x3:r,y1:o,y2:l,y3:h}}drawTitle(t,e,i){let a,n,r;let o=this.title,l=o.length;if(l){let h=(0,s.az)(i.rtl,this.x,this.width);for(r=0,t.x=getAlignedX(this,i.titleAlign,i),e.textAlign=h.textAlign(i.titleAlign),e.textBaseline="middle",a=(0,s.a0)(i.titleFont),n=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string;r0!==t)?(t.beginPath(),t.fillStyle=n.multiKeyBackground,(0,s.au)(t,{x:e,y:p,w:h,h:l,radius:o}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),(0,s.au)(t,{x:i,y:p+1,w:h-2,h:l-2,radius:o}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,p,h,l),t.strokeRect(e,p,h,l),t.fillStyle=r.backgroundColor,t.fillRect(i,p+1,h-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let a,n,r,o,l,h,d;let{body:c}=this,{bodySpacing:u,bodyAlign:g,displayColors:p,boxHeight:f,boxWidth:m,boxPadding:x}=i,b=(0,s.a0)(i.bodyFont),_=b.lineHeight,v=0,y=(0,s.az)(i.rtl,this.x,this.width),fillLineOfText=function(i){e.fillText(i,y.x(t.x+v),t.y+_/2),t.y+=_+u},k=y.textAlign(g);for(e.textAlign=g,e.textBaseline="middle",e.font=b.string,t.x=getAlignedX(this,k,i),e.fillStyle=i.bodyColor,(0,s.F)(this.beforeBody,fillLineOfText),v=p&&"right"!==k?"center"===g?m/2+x:m+2+x:0,o=0,h=c.length;o0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,s=i&&i.x,a=i&&i.y;if(s||a){let i=S[t.position].call(this,this._active,this._eventPosition);if(!i)return;let n=this._size=getTooltipSize(this,t),r=Object.assign({},i,this._size),o=determineAlignment(e,t,r),l=getBackgroundPoint(t,r,o,e);(s._to!==l.x||a._to!==l.y)&&(this.xAlign=o.xAlign,this.yAlign=o.yAlign,this.width=n.width,this.height=n.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let a={width:this.width,height:this.height},n={x:this.x,y:this.y};i=.001>Math.abs(i)?0:i;let r=(0,s.E)(e.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,a,e),(0,s.aA)(t,e.textDirection),n.y+=r.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),(0,s.aC)(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,a=t.map(({datasetIndex:t,index:e})=>{let i=this.chart.getDatasetMeta(t);if(!i)throw Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),n=!(0,s.ah)(i,a),r=this._positionChanged(a,e);(n||r)&&(this._active=a,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let a=this.options,n=this._active||[],r=this._getActiveElements(t,n,e,i),o=this._positionChanged(r,t),l=e||!(0,s.ah)(r,n)||o;return l&&(this._active=r,(a.enabled||a.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){let a=this.options;if("mouseout"===t.type)return[];if(!s)return e.filter(t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index));let n=this.chart.getElementsAtEventForMode(t,a.mode,a,i);return a.reverse&&n.reverse(),n}_positionChanged(t,e){let{caretX:i,caretY:s,options:a}=this,n=S[a.position].call(this,t,e);return!1!==n&&(i!==n.x||s!==n.y)}};let addIfString=(t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i);function findOrAddLabel(t,e,i,s){let a=t.indexOf(e);if(-1===a)return addIfString(t,e,i,s);let n=t.lastIndexOf(e);return a!==n?i:a}let validIndex=(t,e)=>null===t?null:(0,s.S)(Math.round(t),0,e);function _getLabelForValue(t){let e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};function generateTicks$1(t,e){let i,a,n,r;let o=[],{bounds:l,step:h,min:d,max:c,precision:u,count:g,maxTicks:p,maxDigits:f,includeBounds:m}=t,x=h||1,b=p-1,{min:_,max:v}=e,y=!(0,s.k)(d),k=!(0,s.k)(c),M=!(0,s.k)(g),S=(v-_)/(f+1),P=(0,s.aH)((v-_)/b/x)*x;if(P<1e-14&&!y&&!k)return[{value:_},{value:v}];(r=Math.ceil(v/P)-Math.floor(_/P))>b&&(P=(0,s.aH)(r*P/b/x)*x),(0,s.k)(u)||(P=Math.ceil(P*(i=Math.pow(10,u)))/i),"ticks"===l?(a=Math.floor(_/P)*P,n=Math.ceil(v/P)*P):(a=_,n=v),y&&k&&h&&(0,s.aI)((c-d)/h,P/1e3)?(r=Math.round(Math.min((c-d)/P,p)),P=(c-d)/r,a=d,n=c):M?(a=y?d:a,P=((n=k?c:n)-a)/(r=g-1)):(r=(n-a)/P,r=(0,s.aJ)(r,Math.round(r),P/1e3)?Math.round(r):Math.ceil(r));let w=Math.max((0,s.aK)(P),(0,s.aK)(a));a=Math.round(a*(i=Math.pow(10,(0,s.k)(u)?w:u)))/i,n=Math.round(n*i)/i;let C=0;for(y&&(m&&a!==d?(o.push({value:d}),ac)break;o.push({value:t})}return k&&m&&n!==c?o.length&&(0,s.aJ)(o[o.length-1].value,c,relativeLabelSize(c,S,t))?o[o.length-1].value=c:o.push({value:c}):k&&n!==c||o.push({value:n}),o}function relativeLabelSize(t,e,{horizontal:i,minRotation:a}){let n=(0,s.t)(a),r=.75*e*(""+t).length;return Math.min(e/((i?Math.sin(n):Math.cos(n))||.001),r)}let LinearScaleBase=class LinearScaleBase extends Scale{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return(0,s.k)(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:a,max:n}=this,setMin=t=>a=e?a:t,setMax=t=>n=i?n:t;if(t){let t=(0,s.s)(a),e=(0,s.s)(n);t<0&&e<0?setMax(0):t>0&&e>0&&setMin(0)}if(a===n){let e=0===n?1:Math.abs(.05*n);setMax(n+e),t||setMin(a-e)}this.min=a,this.max=n}getTickLimit(){let t;let e=this.options.ticks,{maxTicksLimit:i,stepSize:s}=e;return s?(t=Math.ceil(this.max/s)-Math.floor(this.min/s)+1)>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${t} ticks. Limiting to 1000.`),t=1e3):(t=this.computeTickLimit(),i=i||11),i&&(t=Math.min(i,t)),t}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let a={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},n=this._range||this,r=generateTicks$1(a,n);return"ticks"===t.bounds&&(0,s.aG)(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return(0,s.o)(t,this.chart.options.locale,this.options.ticks.format)}};let LinearScale=class LinearScale extends LinearScaleBase{static id="linear";static defaults={ticks:{callback:s.aL.formatters.numeric}};determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=(0,s.g)(t)?t:0,this.max=(0,s.g)(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=(0,s.t)(this.options.ticks.minRotation),a=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,a.lineHeight/((t?Math.sin(i):Math.cos(i))||.001)))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}};let log10Floor=t=>Math.floor((0,s.aM)(t)),changeExponent=(t,e)=>Math.pow(10,log10Floor(t)+e);function isMajor(t){let e=t/Math.pow(10,log10Floor(t));return 1===e}function steps(t,e,i){let s=Math.pow(10,i);return Math.ceil(e/s)-Math.floor(t/s)}function startExp(t,e){let i=e-t,s=log10Floor(i);for(;steps(t,e,s)>10;)s++;for(;10>steps(t,e,s);)s--;return Math.min(s,log10Floor(t))}function generateTicks(t,{min:e,max:i}){e=(0,s.O)(t.min,e);let a=[],n=log10Floor(e),r=startExp(e,i),o=r<0?Math.pow(10,Math.abs(r)):1,l=Math.pow(10,r),h=n>r?Math.pow(10,n):0,d=Math.round((e-h)*o)/o,c=Math.floor((e-h)/l/10)*l*10,u=Math.floor((d-c)/Math.pow(10,r)),g=(0,s.O)(t.min,Math.round((h+c+u*Math.pow(10,r))*o)/o);for(;g=10?u=u<15?15:20:u++,u>=20&&(u=2,o=++r>=0?1:o),g=Math.round((h+c+u*Math.pow(10,r))*o)/o;let p=(0,s.O)(t.max,g);return a.push({value:p,major:isMajor(p),significand:u}),a}let LogarithmicScale=class LogarithmicScale extends Scale{static id="logarithmic";static defaults={ticks:{callback:s.aL.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=LinearScaleBase.prototype.parse.apply(this,[t,e]);if(0===i){this._zero=!0;return}return(0,s.g)(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=(0,s.g)(t)?Math.max(0,t):null,this.max=(0,s.g)(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!(0,s.g)(this._userMin)&&(this.min=t===changeExponent(this.min,0)?changeExponent(this.min,-1):changeExponent(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),i=this.min,s=this.max,setMin=e=>i=t?i:e,setMax=t=>s=e?s:t;i===s&&(i<=0?(setMin(1),setMax(10)):(setMin(changeExponent(i,-1)),setMax(changeExponent(s,1)))),i<=0&&setMin(changeExponent(s,-1)),s<=0&&setMax(changeExponent(i,1)),this.min=i,this.max=s}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=generateTicks(e,this);return"ticks"===t.bounds&&(0,s.aG)(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return void 0===t?"0":(0,s.o)(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=(0,s.aM)(t),this._valueRange=(0,s.aM)(this.max)-(0,s.aM)(t)}getPixelForValue(t){return((void 0===t||0===t)&&(t=this.min),null===t||isNaN(t))?NaN:this.getPixelForDecimal(t===this.min?0:((0,s.aM)(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};function getTickBackdropHeight(t){let e=t.ticks;if(e.display&&t.display){let t=(0,s.E)(e.backdropPadding);return(0,s.v)(e.font&&e.font.size,s.d.font.size)+t.height}return 0}function measureLabelSize(t,e,i){return i=(0,s.b)(i)?i:[i],{w:(0,s.aN)(t,e.string,i),h:i.length*e.lineHeight}}function determineLimits(t,e,i,s,a){return t===s||t===a?{start:e-i/2,end:e+i/2}:ta?{start:e-i,end:e}:{start:e,end:e+i}}function fitWithPointLabels(t){let e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),a=[],n=[],r=t._pointLabels.length,o=t.options.pointLabels,l=o.centerPointLabels?s.P/r:0;for(let h=0;he.r&&(o=(s.end-e.r)/n,t.r=Math.max(t.r,e.r+o)),a.starte.b&&(l=(a.end-e.b)/r,t.b=Math.max(t.b,e.b+l))}function createPointLabelItem(t,e,i){let a=t.drawingArea,{extra:n,additionalAngle:r,padding:o,size:l}=i,h=t.getPointPosition(e,a+n+o,r),d=Math.round((0,s.U)((0,s.ay)(h.angle+s.H))),c=yForAngle(h.y,l.h,d),u=getTextAlignForAngle(d),g=leftForTextAlign(h.x,l.w,u);return{visible:!0,x:h.x,y:c,textAlign:u,left:g,top:c,right:g+l.w,bottom:c+l.h}}function isNotOverlapped(t,e){if(!e)return!0;let{left:i,top:a,right:n,bottom:r}=t,o=(0,s.C)({x:i,y:a},e)||(0,s.C)({x:i,y:r},e)||(0,s.C)({x:n,y:a},e)||(0,s.C)({x:n,y:r},e);return!o}function buildPointLabelItems(t,e,i){let a;let n=[],r=t._pointLabels.length,o=t.options,{centerPointLabels:l,display:h}=o.pointLabels,d={extra:getTickBackdropHeight(o)/2,additionalAngle:l?s.P/r:0};for(let s=0;s270||i<90)&&(t-=e),t}function drawPointLabelBox(t,e,i){let{left:a,top:n,right:r,bottom:o}=i,{backdropColor:l}=e;if(!(0,s.k)(l)){let i=(0,s.aw)(e.borderRadius),h=(0,s.E)(e.backdropPadding);t.fillStyle=l;let d=a-h.left,c=n-h.top,u=r-a+h.width,g=o-n+h.height;Object.values(i).some(t=>0!==t)?(t.beginPath(),(0,s.au)(t,{x:d,y:c,w:u,h:g,radius:i}),t.fill()):t.fillRect(d,c,u,g)}}function drawPointLabels(t,e){let{ctx:i,options:{pointLabels:a}}=t;for(let n=e-1;n>=0;n--){let e=t._pointLabelItems[n];if(!e.visible)continue;let r=a.setContext(t.getPointLabelContext(n));drawPointLabelBox(i,r,e);let o=(0,s.a0)(r.font),{x:l,y:h,textAlign:d}=e;(0,s.Z)(i,t._pointLabels[n],l,h+o.lineHeight/2,o,{color:r.color,textAlign:d,textBaseline:"middle"})}}function pathRadiusLine(t,e,i,a){let{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,s.T);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let s=1;st,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=(0,s.E)(getTickBackdropHeight(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=(0,s.g)(t)&&!isNaN(t)?t:0,this.max=(0,s.g)(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/getTickBackdropHeight(this.options))}generateTickLabels(t){LinearScaleBase.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((t,e)=>{let i=(0,s.Q)(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){let t=this.options;t.display&&t.pointLabels.display?fitWithPointLabels(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){let e=s.T/(this._pointLabels.length||1),i=this.options.startAngle||0;return(0,s.ay)(t*e+(0,s.t)(i))}getDistanceFromCenterForValue(t){if((0,s.k)(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if((0,s.k)(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t{if(0!==i){e=this.getDistanceFromCenterForValue(t.value);let s=this.getContext(i),a=r.setContext(s),n=o.setContext(s);drawRadiusLine(this,a,e,l,n)}}),n.display){for(s.save(),t=l-1;t>=0;t--){let r=n.setContext(this.getPointLabelContext(t)),{color:o,lineWidth:l}=r;l&&o&&(s.lineWidth=l,s.strokeStyle=o,s.setLineDash(r.borderDash),s.lineDashOffset=r.borderDashOffset,e=this.getDistanceFromCenterForValue(a.ticks.reverse?this.min:this.max),i=this.getPointPosition(t,e),s.beginPath(),s.moveTo(this.xCenter,this.yCenter),s.lineTo(i.x,i.y),s.stroke())}s.restore()}}drawBorder(){}drawLabels(){let t,e;let i=this.ctx,a=this.options,n=a.ticks;if(!n.display)return;let r=this.getIndexAngle(0);i.save(),i.translate(this.xCenter,this.yCenter),i.rotate(r),i.textAlign="center",i.textBaseline="middle",this.ticks.forEach((r,o)=>{if(0===o&&!a.reverse)return;let l=n.setContext(this.getContext(o)),h=(0,s.a0)(l.font);if(t=this.getDistanceFromCenterForValue(this.ticks[o].value),l.showLabelBackdrop){i.font=h.string,e=i.measureText(r.label).width,i.fillStyle=l.backdropColor;let a=(0,s.E)(l.backdropPadding);i.fillRect(-e/2-a.left,-t-h.size/2-a.top,e+a.width,h.size+a.height)}(0,s.Z)(i,r.label,0,-t,h,{color:l.color,strokeColor:l.textStrokeColor,strokeWidth:l.textStrokeWidth})}),i.restore()}drawTitle(){}};let w={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},C=Object.keys(w);function sorter(t,e){return t-e}function parse(t,e){if((0,s.k)(e))return null;let i=t._adapter,{parser:a,round:n,isoWeekday:r}=t._parseOpts,o=e;return("function"==typeof a&&(o=a(o)),(0,s.g)(o)||(o="string"==typeof a?i.parse(o,a):i.parse(o)),null===o)?null:(n&&(o="week"===n&&((0,s.x)(r)||!0===r)?i.startOf(o,"isoWeek",r):i.startOf(o,n)),+o)}function determineUnitForAutoTicks(t,e,i,s){let a=C.length;for(let n=C.indexOf(t);n=C.indexOf(i);n--){let i=C[n];if(w[i].common&&t._adapter.diff(a,s,i)>=e-1)return i}return C[i?C.indexOf(i):0]}function determineMajorUnit(t){for(let e=C.indexOf(t)+1,i=C.length;e=e?i[a]:i[n];t[r]=!0}}else t[e]=!0}function setMajorTicks(t,e,i,s){let a,n;let r=t._adapter,o=+r.startOf(e[0].value,s),l=e[e.length-1].value;for(a=o;a<=l;a=+r.add(a,1,s))(n=i[a])>=0&&(e[n].major=!0);return e}function ticksFromTimestamps(t,e,i){let s,a;let n=[],r={},o=e.length;for(s=0;s+t.value))}initOffsets(t=[]){let e,i,a=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),a=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);let r=t.length<3?.5:.25;a=(0,s.S)(a,0,r),n=(0,s.S)(n,0,r),this._offsets={start:a,end:n,factor:1/(a+1+n)}}_generate(){let t,e;let i=this._adapter,a=this.min,n=this.max,r=this.options,o=r.time,l=o.unit||determineUnitForAutoTicks(o.minUnit,a,n,this._getLabelCapacity(a)),h=(0,s.v)(r.ticks.stepSize,1),d="week"===l&&o.isoWeekday,c=(0,s.x)(d)||!0===d,u={},g=a;if(c&&(g=+i.startOf(g,"isoWeek",d)),g=+i.startOf(g,c?"day":l),i.diff(n,a,l)>1e5*h)throw Error(a+" and "+n+" are too far apart with stepSize of "+h+" "+l);let p="data"===r.ticks.source&&this.getDataTimestamps();for(t=g,e=0;t+t)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){let i=this.options,s=i.time.displayFormats,a=this._unit,n=e||s[a];return this._adapter.format(t,n)}_tickFormatFunction(t,e,i,a){let n=this.options,r=n.ticks.callback;if(r)return(0,s.Q)(r,[t,e,i],this);let o=n.time.displayFormats,l=this._unit,h=this._majorUnit,d=l&&o[l],c=h&&o[h],u=i[e],g=h&&c&&u&&u.major;return this._adapter.format(t,a||(g?c:d))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t=t[l].pos&&e<=t[h].pos&&({lo:l,hi:h}=(0,s.B)(t,"pos",e)),{pos:a,time:r}=t[l],{pos:n,time:o}=t[h]):(e>=t[l].time&&e<=t[h].time&&({lo:l,hi:h}=(0,s.B)(t,"time",e)),{time:a,pos:r}=t[l],{time:n,pos:o}=t[h]);let d=n-a;return d?r+(o-r)*(e-a)/d:r}let TimeSeriesScale=class TimeSeriesScale extends TimeScale{static id="timeseries";static defaults=TimeScale.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=interpolate(e,this.min),this._tableRange=interpolate(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let e,i,s;let{min:a,max:n}=this,r=[],o=[];for(e=0,i=t.length;e=a&&s<=n&&r.push(s);if(r.length<2)return[{time:a,pos:0},{time:n,pos:1}];for(e=0,i=r.length;et-e)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t}getDecimalForValue(t){return(interpolate(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return interpolate(this._table,i*this._tableRange+this._minPos,!0)}}}}]); \ No newline at end of file + */let Animator=class Animator{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){let a=e.listeners[s],n=e.duration;a.forEach(s=>s({chart:t,initial:e.initial,numSteps:n,currentStep:Math.min(i-e.start,n)}))}_refresh(){this._request||(this._running=!0,this._request=s.r.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{let a;if(!i.running||!i.items.length)return;let n=i.items,r=n.length-1,o=!1;for(;r>=0;--r)(a=n[r])._active?(a._total>i.duration&&(i.duration=a._total),a.tick(t),o=!0):(n[r]=n[n.length-1],n.pop());o&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length}),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((t,e)=>Math.max(t,e._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!!e&&!!e.running&&!!e.items.length}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};var a=new Animator;let n="transparent",r={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){let a=(0,s.c)(t||n),r=a.valid&&(0,s.c)(e||n);return r&&r.valid?r.mix(a,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};let Animation=class Animation{constructor(t,e,i,a){let n=e[i];a=(0,s.a)([t.to,a,n,t.from]);let o=(0,s.a)([t.from,n,a]);this._active=!0,this._fn=t.fn||r[t.type||typeof o],this._easing=s.e[t.easing]||s.e.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=a,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let a=this._target[this._prop],n=i-this._start,r=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=(0,s.a)([t.to,e,a,t.from]),this._from=(0,s.a)([t.from,a,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e;let i=t-this._start,s=this._duration,a=this._prop,n=this._from,r=this._loop,o=this._to;if(this._active=n!==o&&(r||i1?2-e:e,e=this._easing(Math.min(1,Math.max(0,e))),this._target[a]=this._fn(n,o,e)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let t=0;t{let n=t[a];if(!(0,s.i)(n))return;let r={};for(let t of e)r[t]=n[t];((0,s.b)(n.properties)&&n.properties||[a]).forEach(t=>{t!==a&&i.has(t)||i.set(t,r)})})}_animateOptions(t,e){let i=e.options,s=resolveTargetOptions(t,i);if(!s)return[];let a=this._createAnimations(s,i);return i.$shared&&awaitAll(t.options.$animations,i).then(()=>{t.options=i},()=>{}),a}_createAnimations(t,e){let i;let s=this._properties,a=[],n=t.$animations||(t.$animations={}),r=Object.keys(e),o=Date.now();for(i=r.length-1;i>=0;--i){let l=r[i];if("$"===l.charAt(0))continue;if("options"===l){a.push(...this._animateOptions(t,e));continue}let h=e[l],d=n[l],c=s.get(l);if(d){if(c&&d.active()){d.update(c,h,o);continue}d.cancel()}if(!c||!c.duration){t[l]=h;continue}n[l]=d=new Animation(c,t,l,h),a.push(d)}return a}update(t,e){if(0===this._properties.size){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return a.add(this._chart,i),!0}};function awaitAll(t,e){let i=[],s=Object.keys(e);for(let e=0;e0||!i&&e<0)return a.index}return null}function updateStacks(t,e){let i;let{chart:s,_cachedMeta:a}=t,n=s._stacks||(s._stacks={}),{iScale:r,vScale:o,index:l}=a,h=r.axis,d=o.axis,c=getStackKey(r,o,a),u=e.length;for(let t=0;ti[t].axis===e).shift()}function createDatasetContext(t,e){return(0,s.j)(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function createDataContext(t,e,i){return(0,s.j)(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}function clearStacks(t,e){let i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s)for(let a of e=e||t._parsed){let t=a._stacks;if(!t||void 0===t[s]||void 0===t[s][i])return;delete t[s][i],void 0!==t[s]._visualValues&&void 0!==t[s]._visualValues[i]&&delete t[s]._visualValues[i]}}let isDirectUpdateMode=t=>"reset"===t||"none"===t,cloneIfNotShared=(t,e)=>e?t:Object.assign({},t),createStack=(t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:getSortedDatasetIndices(i,!0),values:null};let DatasetController=class DatasetController{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=isStacked(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&clearStacks(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),chooseId=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,a=e.xAxisID=(0,s.v)(i.xAxisID,getFirstScaleId(t,"x")),n=e.yAxisID=(0,s.v)(i.yAxisID,getFirstScaleId(t,"y")),r=e.rAxisID=(0,s.v)(i.rAxisID,getFirstScaleId(t,"r")),o=e.indexAxis,l=e.iAxisID=chooseId(o,a,n,r),h=e.vAxisID=chooseId(o,n,a,r);e.xScale=this.getScaleForId(a),e.yScale=this.getScaleForId(n),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&(0,s.u)(this._data,this),t._stacked&&clearStacks(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if((0,s.i)(e))this._data=convertObjectDataToArray(e);else if(i!==e){if(i){(0,s.u)(i,this);let t=this._cachedMeta;clearStacks(t),t._parsed=[]}e&&Object.isExtensible(e)&&(0,s.l)(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),s=!1;this._dataCheck();let a=e._stacked;e._stacked=isStacked(e.vScale,e),e.stack!==i.stack&&(s=!0,clearStacks(e),e.stack=i.stack),this._resyncElements(t),(s||a!==e._stacked)&&updateStacks(this,e._parsed)}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let i,a,n;let{_cachedMeta:r,_data:o}=this,{iScale:l,_stacked:h}=r,d=l.axis,c=0===t&&e===o.length||r._sorted,u=t>0&&r._parsed[t-1];if(!1===this._parsing)r._parsed=o,r._sorted=!0,n=o;else{n=(0,s.b)(o[t])?this.parseArrayData(r,o,t,e):(0,s.i)(o[t])?this.parseObjectData(r,o,t,e):this.parsePrimitiveData(r,o,t,e);let isNotInOrderComparedToPrev=()=>null===a[d]||u&&a[d]e||g=0;--i)if(!_skip()){this.updateRangeFromParsed(c,t,a,d);break}}return c}getAllParsedValues(t){let e,i,a;let n=this._cachedMeta._parsed,r=[];for(e=0,i=n.length;e=0&&tthis.getContext(i,a,e),c);return p.$shared&&(p.$shared=l,n[r]=Object.freeze(cloneIfNotShared(p,l))),p}_resolveAnimations(t,e,i){let s;let a=this.chart,n=this._cachedDataOpts,r=`animation-${e}`,o=n[r];if(o)return o;if(!1!==a.options.animation){let a=this.chart.config,n=a.datasetAnimationScopeKeys(this._type,e),r=a.getOptionScopes(this.getDataset(),n);s=a.createResolver(r,this.getContext(t,i,e))}let l=new Animations(a,s&&s.animations);return s&&s._cacheable&&(n[r]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||isDirectUpdateMode(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,a=this.getSharedOptions(i),n=this.includeOptions(e,a)||a!==s;return this.updateSharedOptions(a,e,i),{sharedOptions:a,includeOptions:n}}updateElement(t,e,i,s){isDirectUpdateMode(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!isDirectUpdateMode(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;let a=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(a)||a})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];let s=i.length,a=e.length,n=Math.min(a,s);n&&this.parse(0,n),a>s?this._insertElements(s,a-s,t):a{for(t.length+=e,s=t.length-1;s>=r;s--)t[s]=t[s-e]};for(move(n),s=t;st-e))}return t._cache.$bar}function computeMinSampleSize(t){let e,i,a,n;let r=t.iScale,o=getAllScaleValues(r,t.type),l=r._length,updateMinAndPrev=()=>{32767!==a&&-32768!==a&&((0,s.h)(n)&&(l=Math.min(l,Math.abs(a-n)||l)),n=a)};for(e=0,i=o.length;e0?a[t-1]:null,o=tMath.abs(o)&&(l=o,h=r),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:a,end:n,min:r,max:o}}function parseValue(t,e,i,a){return(0,s.b)(t)?parseFloatBar(t,e,i,a):e[i.axis]=i.parse(t,a),e}function parseArrayOrPrimitive(t,e,i,s){let a,n,r,o;let l=t.iScale,h=t.vScale,d=l.getLabels(),c=l===h,u=[];for(a=i,n=i+s;a=i?1:-1)}function borderProps(t){let e,i,s,a,n;return t.horizontal?(e=t.base>t.x,i="left",s="right"):(e=t.baset.controller.options.grouped),n=i.options.stacked,r=[],skipNull=t=>{let i=t.controller.getParsed(e),a=i&&i[t.vScale.axis];if((0,s.k)(a)||isNaN(a))return!0};for(let i of a)if(!(void 0!==e&&skipNull(i))&&((!1===n||-1===r.indexOf(i.stack)||void 0===n&&void 0===i.stack)&&r.push(i.stack),i.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){let s=this._getStacks(t,i),a=void 0!==e?s.indexOf(e):-1;return -1===a?s.length-1:a}_getRuler(){let t,e;let i=this.options,s=this._cachedMeta,a=s.iScale,n=[];for(t=0,e=s.data.length;t=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:a}=e,n=this.getParsed(t),r=s.getLabelForValue(n.x),o=a.getLabelForValue(n.y),l=n._custom;return{label:i[t]||"",value:"("+r+", "+o+(l?", "+l:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){let a="reset"===s,{iScale:n,vScale:r}=this._cachedMeta,{sharedOptions:o,includeOptions:l}=this._getSharedOptions(e,s),h=n.axis,d=r.axis;for(let c=e;c(0,s.p)(e,t,l,!0)?1:Math.max(a,a*i,n,n*i),calcMin=(e,a,n)=>(0,s.p)(e,t,l,!0)?-1:Math.min(a,a*i,n,n*i),g=calcMax(0,h,c),p=calcMax(s.H,d,u),f=calcMin(s.P,h,c),m=calcMin(s.P+s.H,d,u);a=(g-f)/2,n=(p-m)/2,r=-(g+f)/2,o=-(p+m)/2}return{ratioX:a,ratioY:n,offsetX:r,offsetY:o}}let DoughnutController=class DoughnutController extends DatasetController{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((e,a)=>{let n=t.getDatasetMeta(0),r=n.controller.getStyle(a);return{text:e,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,fontColor:s,lineWidth:r.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){let i=this.getDataset().data,a=this._cachedMeta;if(!1===this._parsing)a._parsed=i;else{let n,r,getter=t=>+i[t];if((0,s.i)(i[t])){let{key:t="value"}=this._parsing;getter=e=>+(0,s.f)(i[e],t)}for(n=t,r=t+e;n0&&!isNaN(t)?s.T*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,a=i.data.labels||[],n=(0,s.o)(e._parsed[t],i.options.locale);return{label:a[t]||"",value:n}}getMaxBorderWidth(t){let e,i,s,a,n,r=0,o=this.chart;if(!t){for(e=0,i=o.data.datasets.length;e0&&this.getParsed(e-1);for(let i=0;i<_;++i){let p=t[i],_=x?p:{};if(i=b){_.skip=!0;continue}let y=this.getParsed(i),k=(0,s.k)(y[g]),M=_[u]=r.getPixelForValue(y[u],i),S=_[g]=n||k?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,y,l):y[g],i);_.skip=isNaN(M)||isNaN(S)||k,_.stop=i>0&&Math.abs(y[u]-v[u])>m,f&&(_.parsed=y,_.raw=h.data[i]),c&&(_.options=d||this.resolveDataElementOptions(i,p.active?"active":a)),x||this.updateElement(p,i,_,a),v=y}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;let a=s[0].size(this.resolveDataElementOptions(0)),n=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,a,n)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};let PolarAreaController=class PolarAreaController extends DatasetController{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((e,a)=>{let n=t.getDatasetMeta(0),r=n.controller.getStyle(a);return{text:e,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,fontColor:s,lineWidth:r.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,a=i.data.labels||[],n=(0,s.o)(e._parsed[t].r,i.options.locale);return{label:a[t]||"",value:n}}parseObjectData(t,e,i,a){return s.y.bind(this)(t,e,i,a)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((t,i)=>{let s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(se.max&&(e.max=s))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),a=Math.max(s/2,0),n=Math.max(i.cutoutPercentage?a/100*i.cutoutPercentage:1,0),r=(a-n)/t.getVisibleDatasetCount();this.outerRadius=a-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,i,a){let n;let r="reset"===a,o=this.chart,l=o.options,h=l.animation,d=this._cachedMeta.rScale,c=d.xCenter,u=d.yCenter,g=d.getIndexAngle(0)-.5*s.P,p=g,f=360/this.countVisibleElements();for(n=0;n{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?(0,s.t)(this.resolveDataElementOptions(t,e).angle||i):0}};let PieController=class PieController extends DoughnutController{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}};let RadarController=class RadarController extends DatasetController{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,a){return s.y.bind(this)(t,e,i,a)}update(t){let e=this._cachedMeta,i=e.dataset,s=e.data||[],a=e.iScale.getLabels();if(i.points=s,"resize"!==t){let e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);let n={_loop:!0,_fullLoop:a.length===s.length,options:e};this.updateElement(i,void 0,n,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){let a=this._cachedMeta.rScale,n="reset"===s;for(let r=e;r0&&this.getParsed(e-1);for(let d=e;d0&&Math.abs(i[g]-_[g])>x,m&&(f.parsed=i,f.raw=h.data[d]),u&&(f.options=c||this.resolveDataElementOptions(d,e.active?"active":a)),b||this.updateElement(e,d,f,a),_=i}this.updateSharedOptions(c,a,d)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}let i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;let a=e[0].size(this.resolveDataElementOptions(0)),n=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,a,n)/2}};function abstract(){throw Error("This method is not implemented: Check that a complete date adapter is provided.")}let DateAdapterBase=class DateAdapterBase{static override(t){Object.assign(DateAdapterBase.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return abstract()}parse(){return abstract()}format(){return abstract()}add(){return abstract()}diff(){return abstract()}startOf(){return abstract()}endOf(){return abstract()}};var o={_date:DateAdapterBase};function binarySearch(t,e,i,a){let{controller:n,data:r,_sorted:o}=t,l=n._cachedMeta.iScale;if(l&&e===l.axis&&"r"!==e&&o&&r.length){let t=l._reversePixels?s.A:s.B;if(!a)return t(r,e,i);if(n._sharedOptions){let s=r[0],a="function"==typeof s.getRange&&s.getRange(e);if(a){let s=t(r,e,i-a),n=t(r,e,i+a);return{lo:s.lo,hi:n.hi}}}}return{lo:0,hi:r.length-1}}function evaluateInteractionItems(t,e,i,s,a){let n=t.getSortedVisibleDatasetMetas(),r=i[e];for(let t=0,i=n.length;t{t[r](e[i],a)&&(n.push({element:t,datasetIndex:s,index:l}),o=o||t.inRange(e.x,e.y,a))}),s&&!o)?[]:n}var l={modes:{index(t,e,i,a){let n=(0,s.z)(e,t),r=i.axis||"x",o=i.includeInvisible||!1,l=i.intersect?getIntersectItems(t,n,r,a,o):getNearestItems(t,n,r,!1,a,o),h=[];return l.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{let e=l[0].index,i=t.data[e];i&&!i.skip&&h.push({element:i,datasetIndex:t.index,index:e})}),h):[]},dataset(t,e,i,a){let n=(0,s.z)(e,t),r=i.axis||"xy",o=i.includeInvisible||!1,l=i.intersect?getIntersectItems(t,n,r,a,o):getNearestItems(t,n,r,!1,a,o);if(l.length>0){let e=l[0].datasetIndex,i=t.getDatasetMeta(e).data;l=[];for(let t=0;tt.pos===e)}function filterDynamicPositionByAxis(t,e){return t.filter(t=>-1===h.indexOf(t.pos)&&t.box.axis===e)}function sortByWeight(t,e){return t.sort((t,i)=>{let s=e?i:t,a=e?t:i;return s.weight===a.weight?s.index-a.index:s.weight-a.weight})}function wrapBoxes(t){let e,i,s,a,n,r;let o=[];for(e=0,i=(t||[]).length;et.box.fullSize),!0),s=sortByWeight(filterByPosition(e,"left"),!0),a=sortByWeight(filterByPosition(e,"right")),n=sortByWeight(filterByPosition(e,"top"),!0),r=sortByWeight(filterByPosition(e,"bottom")),o=filterDynamicPositionByAxis(e,"x"),l=filterDynamicPositionByAxis(e,"y");return{fullSize:i,leftAndTop:s.concat(n),rightAndBottom:a.concat(l).concat(r).concat(o),chartArea:filterByPosition(e,"chartArea"),vertical:s.concat(a).concat(l),horizontal:n.concat(r).concat(o)}}function getCombinedMax(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function updateMaxPadding(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function updateDims(t,e,i,a){let{pos:n,box:r}=i,o=t.maxPadding;if(!(0,s.i)(n)){i.size&&(t[n]-=i.size);let e=a[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?r.height:r.width),i.size=e.size/e.count,t[n]+=i.size}r.getPadding&&updateMaxPadding(o,r.getPadding());let l=Math.max(0,e.outerWidth-getCombinedMax(o,t,"left","right")),h=Math.max(0,e.outerHeight-getCombinedMax(o,t,"top","bottom")),d=l!==t.w,c=h!==t.h;return t.w=l,t.h=h,i.horizontal?{same:d,other:c}:{same:c,other:d}}function handleMaxPadding(t){let e=t.maxPadding;function updatePos(i){let s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=updatePos("top"),t.x+=updatePos("left"),updatePos("right"),updatePos("bottom")}function getMargins(t,e){let i=e.maxPadding;return function(t){let s={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{s[t]=Math.max(e[t],i[t])}),s}(t?["left","right"]:["top","bottom"])}function fitBoxes(t,e,i,s){let a,n,r,o,l,h;let d=[];for(a=0,n=t.length,l=0;a{"function"==typeof t.beforeLayout&&t.beforeLayout()});let c=h.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1,u=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/c,hBoxMaxHeight:o/2}),g=Object.assign({},n);updateMaxPadding(g,(0,s.E)(a));let p=Object.assign({maxPadding:g,w:r,h:o,x:n.left,y:n.top},n),f=setLayoutDims(h.concat(d),u);fitBoxes(l.fullSize,p,u,f),fitBoxes(h,p,u,f),fitBoxes(d,p,u,f)&&fitBoxes(h,p,u,f),handleMaxPadding(p),placeBoxes(l.leftAndTop,p,u,f),p.x+=p.w,p.y+=p.h,placeBoxes(l.rightAndBottom,p,u,f),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},(0,s.F)(l.chartArea,e=>{let i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};let BasePlatform=class BasePlatform{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}};let BasicPlatform=class BasicPlatform extends BasePlatform{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}};let c="$chartjs",u={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},isNullOrEmpty=t=>null===t||""===t;function initCanvas(t,e){let i=t.style,a=t.getAttribute("height"),n=t.getAttribute("width");if(t[c]={initial:{height:a,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",isNullOrEmpty(n)){let e=(0,s.J)(t,"width");void 0!==e&&(t.width=e)}if(isNullOrEmpty(a)){if(""===t.style.height)t.height=t.width/(e||2);else{let e=(0,s.J)(t,"height");void 0!==e&&(t.height=e)}}return t}let g=!!s.K&&{passive:!0};function addListener(t,e,i){t.addEventListener(e,i,g)}function removeListener(t,e,i){t.canvas.removeEventListener(e,i,g)}function fromNativeEvent(t,e){let i=u[t.type]||t.type,{x:a,y:n}=(0,s.z)(t,e);return{type:i,chart:e,native:t,x:void 0!==a?a:null,y:void 0!==n?n:null}}function nodeListContains(t,e){for(let i of t)if(i===e||i.contains(e))return!0}function createAttachObserver(t,e,i){let s=t.canvas,a=new MutationObserver(t=>{let e=!1;for(let i of t)e=(e=e||nodeListContains(i.addedNodes,s))&&!nodeListContains(i.removedNodes,s);e&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}function createDetachObserver(t,e,i){let s=t.canvas,a=new MutationObserver(t=>{let e=!1;for(let i of t)e=(e=e||nodeListContains(i.removedNodes,s))&&!nodeListContains(i.addedNodes,s);e&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}let p=new Map,f=0;function onWindowResize(){let t=window.devicePixelRatio;t!==f&&(f=t,p.forEach((e,i)=>{i.currentDevicePixelRatio!==t&&e()}))}function listenDevicePixelRatioChanges(t,e){p.size||window.addEventListener("resize",onWindowResize),p.set(t,e)}function unlistenDevicePixelRatioChanges(t){p.delete(t),p.size||window.removeEventListener("resize",onWindowResize)}function createResizeObserver(t,e,i){let a=t.canvas,n=a&&(0,s.I)(a);if(!n)return;let r=(0,s.L)((t,e)=>{let s=n.clientWidth;i(t,e),s{let e=t[0],i=e.contentRect.width,s=e.contentRect.height;(0!==i||0!==s)&&r(i,s)});return o.observe(n),listenDevicePixelRatioChanges(t,r),o}function releaseObserver(t,e,i){i&&i.disconnect(),"resize"===e&&unlistenDevicePixelRatioChanges(t)}function createProxyAndListen(t,e,i){let a=t.canvas,n=(0,s.L)(e=>{null!==t.ctx&&i(fromNativeEvent(e,t))},t);return addListener(a,e,n),n}let DomPlatform=class DomPlatform extends BasePlatform{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(initCanvas(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[c])return!1;let i=e[c].initial;["height","width"].forEach(t=>{let a=i[t];(0,s.k)(a)?e.removeAttribute(t):e.setAttribute(t,a)});let a=i.style||{};return Object.keys(a).forEach(t=>{e.style[t]=a[t]}),e.width=e.width,delete e[c],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:createAttachObserver,detach:createDetachObserver,resize:createResizeObserver}[e]||createProxyAndListen;s[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;let a={attach:releaseObserver,detach:releaseObserver,resize:releaseObserver}[e]||removeListener;a(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,a){return(0,s.G)(t,e,i,a)}isAttached(t){let e=(0,s.I)(t);return!!(e&&e.isConnected)}};function _detectPlatform(t){return!(0,s.M)()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?BasicPlatform:DomPlatform}let Element=class Element{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return(0,s.x)(this.x)&&(0,s.x)(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let s={};return t.forEach(t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),s}};function autoSkip(t,e){let i=t.options.ticks,a=determineMaxTicks(t),n=Math.min(i.maxTicksLimit||a,a),r=i.major.enabled?getMajorIndices(e):[],o=r.length,l=r[0],h=r[o-1],d=[];if(o>n)return skipMajors(e,d,r,o/n),d;let c=calculateSpacing(r,e,n);if(o>0){let t,i;let a=o>1?Math.round((h-l)/(o-1)):null;for(skip(e,d,c,(0,s.k)(a)?0:l-a,l),t=0,i=o-1;tn)return e}return Math.max(n,1)}function getMajorIndices(t){let e,i;let s=[];for(e=0,i=t.length;e"left"===t?"right":"right"===t?"left":t,offsetFromEdge=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,getTicksLimit=(t,e)=>Math.min(e||t,t);function sample(t,e){let i=[],s=t.length/e,a=t.length,n=0;for(;no+1e-6)))return l}function garbageCollect(t,e){(0,s.F)(t,t=>{let i;let s=t.gc,a=s.length/2;if(a>e){for(i=0;ia?a:i,a=n&&i>a?i:a,{min:(0,s.O)(i,(0,s.O)(a,i)),max:(0,s.O)(a,(0,s.O)(i,a))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){let e=this._labelItems||(this._labelItems=this._computeLabelItems(t));return e}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){(0,s.Q)(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:a,grace:n,ticks:r}=this.options,o=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=(0,s.R)(this,n,a),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=o=l||r<=1||!this.isHorizontal()){this.labelRotation=o;return}let d=this._getLabelSizes(),c=d.widest.width,u=d.highest.height,g=(0,s.S)(this.chart.width-c,0,this.maxWidth);c+6>(t=a.offset?this.maxWidth/r:g/(r-1))&&(t=g/(r-(a.offset?.5:1)),e=this.maxHeight-getTickMarkLength(a.grid)-n.padding-getTitleHeight(a.title,this.chart.options.font),i=Math.sqrt(c*c+u*u),h=Math.max(o,Math.min(l,h=(0,s.U)(Math.min(Math.asin((0,s.S)((d.highest.height+6)/t,-1,1)),Math.asin((0,s.S)(e/i,-1,1))-Math.asin((0,s.S)(u/i,-1,1))))))),this.labelRotation=h}afterCalculateLabelRotation(){(0,s.Q)(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){(0,s.Q)(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:a,grid:n}}=this,r=this._isVisible(),o=this.isHorizontal();if(r){let r=getTitleHeight(a,e.options.font);if(o?(t.width=this.maxWidth,t.height=getTickMarkLength(n)+r):(t.height=this.maxHeight,t.width=getTickMarkLength(n)+r),i.display&&this.ticks.length){let{first:e,last:a,widest:n,highest:r}=this._getLabelSizes(),l=2*i.padding,h=(0,s.t)(this.labelRotation),d=Math.cos(h),c=Math.sin(h);if(o){let e=i.mirror?0:c*n.width+d*r.height;t.height=Math.min(this.maxHeight,t.height+e+l)}else{let e=i.mirror?0:d*n.width+c*r.height;t.width=Math.min(this.maxWidth,t.width+e+l)}this._calculatePadding(e,a,c,d)}}this._handleMargins(),o?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){let{ticks:{align:a,padding:n},position:r}=this.options,o=0!==this.labelRotation,l="top"!==r&&"x"===this.axis;if(this.isHorizontal()){let r=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),d=0,c=0;o?l?(d=s*t.width,c=i*e.height):(d=i*t.height,c=s*e.width):"start"===a?c=e.width:"end"===a?d=t.width:"inner"!==a&&(d=t.width/2,c=e.width/2),this.paddingLeft=Math.max((d-r+n)*this.width/(this.width-r),0),this.paddingRight=Math.max((c-h+n)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===a?(i=0,s=t.height):"end"===a&&(i=e.height,s=0),this.paddingTop=i+n,this.paddingBottom=s+n}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){(0,s.Q)(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e({width:x[t]||0,height:b[t]||0});return{first:valueAt(0),last:valueAt(e-1),widest:valueAt(k),highest:valueAt(M),widths:x,heights:b}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return(0,s.W)(this._alignToPixels?(0,s.X)(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&to*a?o/i:l/a:l*a0}_computeGridLineItems(t){let e,i,a,n,r,o,l,h,d,c,u,g;let p=this.axis,f=this.chart,m=this.options,{grid:x,position:b,border:_}=m,v=x.offset,y=this.isHorizontal(),k=this.ticks,M=k.length+(v?1:0),S=getTickMarkLength(x),w=[],P=_.setContext(this.getContext()),C=P.display?P.width:0,D=C/2,alignBorderValue=function(t){return(0,s.X)(f,t,C)};if("top"===b)e=alignBorderValue(this.bottom),o=this.bottom-S,h=e-D,c=alignBorderValue(t.top)+D,g=t.bottom;else if("bottom"===b)e=alignBorderValue(this.top),c=t.top,g=alignBorderValue(t.bottom)-D,o=e+D,h=this.top+S;else if("left"===b)e=alignBorderValue(this.right),r=this.right-S,l=e-D,d=alignBorderValue(t.left)+D,u=t.right;else if("right"===b)e=alignBorderValue(this.left),d=t.left,u=alignBorderValue(t.right)-D,r=e+D,l=this.left+S;else if("x"===p){if("center"===b)e=alignBorderValue((t.top+t.bottom)/2+.5);else if((0,s.i)(b)){let t=Object.keys(b)[0],i=b[t];e=alignBorderValue(this.chart.scales[t].getPixelForValue(i))}c=t.top,g=t.bottom,h=(o=e+D)+S}else if("y"===p){if("center"===b)e=alignBorderValue((t.left+t.right)/2);else if((0,s.i)(b)){let t=Object.keys(b)[0],i=b[t];e=alignBorderValue(this.chart.scales[t].getPixelForValue(i))}l=(r=e-D)-S,d=t.left,u=t.right}let L=(0,s.v)(m.ticks.maxTicksLimit,M),A=Math.max(1,Math.ceil(M/L));for(i=0;i0&&(h-=r/2)}t={left:h,top:l,width:r+a.width,height:n+a.height,color:g.backdropColor}}C.push({label:a,font:h,textOffset:u,options:{rotation:P,color:_,strokeColor:y,strokeWidth:M,textAlign:S,textBaseline:D,translation:[n,r],backdrop:t}})}return C}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options,i=-(0,s.t)(this.labelRotation);if(i)return"top"===t?"left":"right";let a="center";return"start"===e.align?a="left":"end"===e.align?a="right":"inner"===e.align&&(a="inner"),a}_getYAxisLabelAlignment(t){let e,i;let{position:s,ticks:{crossAlign:a,mirror:n,padding:r}}=this.options,o=this._getLabelSizes(),l=t+r,h=o.widest.width;return"left"===s?n?(i=this.right+r,"near"===a?e="left":"center"===a?(e="center",i+=h/2):(e="right",i+=h)):(i=this.right-l,"near"===a?e="right":"center"===a?(e="center",i-=h/2):(e="left",i=this.left)):"right"===s?n?(i=this.left+r,"near"===a?e="right":"center"===a?(e="center",i-=h/2):(e="left",i-=h)):(i=this.left+l,"near"===a?e="left":"center"===a?(e="center",i+=h/2):(e="right",i=this.right)):e="right",{textAlign:e,x:i}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:i,top:s,width:a,height:n}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,a,n),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let i=this.ticks,s=i.findIndex(e=>e.value===t);if(s>=0){let t=e.setContext(this.getContext(s));return t.lineWidth}return 0}drawGrid(t){let e,i;let s=this.options.grid,a=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),drawLine=(t,e,i)=>{i.width&&i.color&&(a.save(),a.lineWidth=i.width,a.strokeStyle=i.color,a.setLineDash(i.borderDash||[]),a.lineDashOffset=i.borderDashOffset,a.beginPath(),a.moveTo(t.x,t.y),a.lineTo(e.x,e.y),a.stroke(),a.restore())};if(s.display)for(e=0,i=n.length;e{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:a,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){let e,i;let s=this.chart.getSortedVisibleDatasetMetas(),a=this.axis+"AxisID",n=[];for(e=0,i=s.length;e{let a=i.split("."),n=a.pop(),r=[t].concat(a).join("."),o=e[i].split("."),l=o.pop(),h=o.join(".");s.d.route(r,n,h,l)})}function isIChartComponent(t){return"id"in t&&"defaults"in t}let Registry=class Registry{constructor(){this.controllers=new TypedRegistry(DatasetController,"datasets",!0),this.elements=new TypedRegistry(Element,"elements"),this.plugins=new TypedRegistry(Object,"plugins"),this.scales=new TypedRegistry(Scale,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(e=>{let a=i||this._getRegistryForType(e);i||a.isForType(e)||a===this.plugins&&e.id?this._exec(t,a,e):(0,s.F)(e,e=>{let s=i||this._getRegistryForType(e);this._exec(t,s,e)})})}_exec(t,e,i){let a=(0,s.a5)(t);(0,s.Q)(i["before"+a],[],i),e[t](i),(0,s.Q)(i["after"+a],[],i)}_getRegistryForType(t){for(let e=0;et.filter(t=>!e.some(e=>t.plugin.id===e.plugin.id));this._notify(diff(e,i),t,"stop"),this._notify(diff(i,e),t,"start")}};function allPlugins(t){let e={},i=[],s=Object.keys(m.plugins.items);for(let t=0;t1&&idMatchesAxis(t[0].toLowerCase());if(e)return e}throw Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function getAxisFromDataset(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function retrieveAxisFromDatasets(t,e){if(e.data&&e.data.datasets){let i=e.data.datasets.filter(e=>e.xAxisID===t||e.yAxisID===t);if(i.length)return getAxisFromDataset(t,"x",i[0])||getAxisFromDataset(t,"y",i[0])}return{}}function mergeScaleConfig(t,e){let i=s.a3[t.type]||{scales:{}},a=e.scales||{},n=getIndexAxis(t.type,e),r=Object.create(null);return Object.keys(a).forEach(e=>{let o=a[e];if(!(0,s.i)(o))return console.error(`Invalid scale configuration for scale: ${e}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);let l=determineAxis(e,o,retrieveAxisFromDatasets(e,t),s.d.scales[o.type]),h=getDefaultScaleIDFromAxis(l,n),d=i.scales||{};r[e]=(0,s.ab)(Object.create(null),[{axis:l},o,d[l],d[h]])}),t.data.datasets.forEach(i=>{let n=i.type||t.type,o=i.indexAxis||getIndexAxis(n,e),l=s.a3[n]||{},h=l.scales||{};Object.keys(h).forEach(t=>{let e=getAxisFromDefaultScaleID(t,o),n=i[e+"AxisID"]||e;r[n]=r[n]||Object.create(null),(0,s.ab)(r[n],[{axis:e},a[n],h[t]])})}),Object.keys(r).forEach(t=>{let e=r[t];(0,s.ab)(e,[s.d.scales[e.type],s.d.scale])}),r}function initOptions(t){let e=t.options||(t.options={});e.plugins=(0,s.v)(e.plugins,{}),e.scales=mergeScaleConfig(t,e)}function initData(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}function initConfig(t){return(t=t||{}).data=initData(t.data),initOptions(t),t}let x=new Map,b=new Set;function cachedKeys(t,e){let i=x.get(t);return i||(i=e(),x.set(t,i),b.add(i)),i}let addIfFound=(t,e,i)=>{let a=(0,s.f)(e,i);void 0!==a&&t.add(a)};let Config=class Config{constructor(t){this._config=initConfig(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=initData(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),initOptions(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return cachedKeys(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return cachedKeys(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return cachedKeys(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return cachedKeys(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){let{options:a,type:n}=this,r=this._cachedScopes(t,i),o=r.get(e);if(o)return o;let l=new Set;e.forEach(e=>{t&&(l.add(t),e.forEach(e=>addIfFound(l,t,e))),e.forEach(t=>addIfFound(l,a,t)),e.forEach(t=>addIfFound(l,s.a3[n]||{},t)),e.forEach(t=>addIfFound(l,s.d,t)),e.forEach(t=>addIfFound(l,s.a6,t))});let h=Array.from(l);return 0===h.length&&h.push(Object.create(null)),b.has(e)&&r.set(e,h),h}chartOptionScopes(){let{options:t,type:e}=this;return[t,s.a3[e]||{},s.d.datasets[e]||{},{type:e},s.d,s.a6]}resolveNamedOptions(t,e,i,a=[""]){let n={$shared:!0},{resolver:r,subPrefixes:o}=getResolver(this._resolverCache,t,a),l=r;if(needContext(r,e)){n.$shared=!1,i=(0,s.a7)(i)?i():i;let e=this.createResolver(t,i,o);l=(0,s.a8)(r,i,e)}for(let t of e)n[t]=l[t];return n}createResolver(t,e,i=[""],a){let{resolver:n}=getResolver(this._resolverCache,t,i);return(0,s.i)(e)?(0,s.a8)(n,e,void 0,a):n}};function getResolver(t,e,i){let a=t.get(e);a||(a=new Map,t.set(e,a));let n=i.join(),r=a.get(n);if(!r){let t=(0,s.a9)(e,i);r={resolver:t,subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},a.set(n,r)}return r}let hasFunction=t=>(0,s.i)(t)&&Object.getOwnPropertyNames(t).some(e=>(0,s.a7)(t[e]));function needContext(t,e){let{isScriptable:i,isIndexable:a}=(0,s.aa)(t);for(let n of e){let e=i(n),r=a(n),o=(r||e)&&t[n];if(e&&((0,s.a7)(o)||hasFunction(o))||r&&(0,s.b)(o))return!0}return!1}let _=["top","bottom","left","right","chartArea"];function positionIsHorizontal(t,e){return"top"===t||"bottom"===t||-1===_.indexOf(t)&&"x"===e}function compare2Level(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function onAnimationsComplete(t){let e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),(0,s.Q)(i&&i.onComplete,[t],e)}function onAnimationProgress(t){let e=t.chart,i=e.options.animation;(0,s.Q)(i&&i.onProgress,[t],e)}function getCanvas(t){return(0,s.M)()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}let v={},getChart=t=>{let e=getCanvas(t);return Object.values(v).filter(t=>t.canvas===e).pop()};function moveNumericKeys(t,e,i){let s=Object.keys(t);for(let a of s){let s=+a;if(s>=e){let n=t[a];delete t[a],(i>0||s>e)&&(t[s+i]=n)}}}function determineLastEvent(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}function getSizeForArea(t,e,i){return t.options.clip?t[i]:e[i]}function getDatasetArea(t,e){let{xScale:i,yScale:s}=t;return i&&s?{left:getSizeForArea(i,e,"left"),right:getSizeForArea(i,e,"right"),top:getSizeForArea(s,e,"top"),bottom:getSizeForArea(s,e,"bottom")}:e}let Chart=class Chart{static defaults=s.d;static instances=v;static overrides=s.a3;static registry=m;static version="4.4.1";static getChart=getChart;static register(...t){m.add(...t),invalidatePlugins()}static unregister(...t){m.remove(...t),invalidatePlugins()}constructor(t,e){let i=this.config=new Config(e),n=getCanvas(t),r=getChart(n);if(r)throw Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");let o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||_detectPlatform(n)),this.platform.updateConfig(i);let l=this.platform.acquireContext(n,o.aspectRatio),h=l&&l.canvas,d=h&&h.height,c=h&&h.width;if(this.id=(0,s.ac)(),this.ctx=l,this.canvas=h,this.width=c,this.height=d,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new PluginService,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=(0,s.ad)(t=>this.update(t),o.resizeDelay||0),this._dataChanges=[],v[this.id]=this,!l||!h){console.error("Failed to create chart: can't acquire context from the given item");return}a.listen(this,"complete",onAnimationsComplete),a.listen(this,"progress",onAnimationProgress),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:a,_aspectRatio:n}=this;return(0,s.k)(t)?e&&n?n:a?i/a:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return m}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():(0,s.ae)(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return(0,s.af)(this.canvas,this.ctx),this}stop(){return a.stop(this),this}resize(t,e){a.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,a=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(a,t,e,n),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,(0,s.ae)(this,o,!0)&&(this.notifyPlugins("resize",{size:r}),(0,s.Q)(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let t=this.options,e=t.scales||{};(0,s.F)(e,(t,e)=>{t.id=e})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,a=Object.keys(i).reduce((t,e)=>(t[e]=!1,t),{}),n=[];e&&(n=n.concat(Object.keys(e).map(t=>{let i=e[t],s=determineAxis(t,i),a="r"===s,n="x"===s;return{options:i,dposition:a?"chartArea":n?"bottom":"left",dtype:a?"radialLinear":n?"category":"linear"}}))),(0,s.F)(n,e=>{let n=e.options,r=n.id,o=determineAxis(r,n),l=(0,s.v)(n.type,e.dtype);(void 0===n.position||positionIsHorizontal(n.position,o)!==positionIsHorizontal(e.dposition))&&(n.position=e.dposition),a[r]=!0;let h=null;if(r in i&&i[r].type===l)h=i[r];else{let t=m.getScale(l);i[(h=new t({id:r,type:l,ctx:this.ctx,chart:this})).id]=h}h.init(n,t)}),(0,s.F)(a,(t,e)=>{t||delete i[e]}),(0,s.F)(i,t=>{d.configure(this,t,t.options),d.addBox(this,t)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),i>e){for(let t=e;te.length&&delete this._stacks,t.forEach((t,i)=>{0===e.filter(e=>e===t._dataset).length&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){let t,e;let i=[],a=this.data.datasets;for(this._removeUnreferencedMetasets(),t=0,e=a.length;t{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),a=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;let n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let t=0,e=this.data.datasets.length;t{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(compare2Level("z","_idx"));let{_active:o,_lastEvent:l}=this;l?this._eventHandler(l,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){(0,s.F)(this.scales,t=>{d.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(0,s.ag)(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:s,count:a}of e){let e="_removeElements"===i?-a:a;moveNumericKeys(t,s,e)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,makeSet=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),i=makeSet(0);for(let t=1;tt.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;d.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],(0,s.F)(this.boxes,t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,e)=>{t._idx=e}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i=t._clip,a=!i.disabled,n=getDatasetArea(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",r)&&(a&&(0,s.Y)(e,{left:!1===i.left?0:n.left-i.left,right:!1===i.right?this.width:n.right+i.right,top:!1===i.top?0:n.top-i.top,bottom:!1===i.bottom?this.height:n.bottom+i.bottom}),t.controller.draw(),a&&(0,s.$)(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return(0,s.C)(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){let a=l.modes[e];return"function"==typeof a?a(this,t,i,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,s=i.filter(t=>t&&t._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=(0,s.j)(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let a=i?"show":"hide",n=this.getDatasetMeta(t),r=n.controller._resolveAnimations(void 0,a);(0,s.h)(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(n,{visible:i}),this.update(e=>e.datasetIndex===t?a:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),a.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,i,s),t[i]=s},listener=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};(0,s.F)(this.options.events,t=>_add(t,listener))}bindResponsiveEvents(){let t;this._responsiveListeners||(this._responsiveListeners={});let e=this._responsiveListeners,i=this.platform,_add=(t,s)=>{i.addEventListener(this,t,s),e[t]=s},_remove=(t,s)=>{e[t]&&(i.removeEventListener(this,t,s),delete e[t])},listener=(t,e)=>{this.canvas&&this.resize(t,e)},attached=()=>{_remove("attach",attached),this.attached=!0,this.resize(),_add("resize",listener),_add("detach",t)};t=()=>{this.attached=!1,_remove("resize",listener),this._stop(),this._resize(0,0),_add("attach",attached)},i.isAttached(this.canvas)?attached():t()}unbindEvents(){(0,s.F)(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},(0,s.F)(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let s,a,n;let r=i?"set":"remove";for("dataset"===e&&this.getDatasetMeta(t[0].datasetIndex).controller["_"+r+"DatasetHoverStyle"](),a=0,n=t.length;a{let i=this.getDatasetMeta(t);if(!i)throw Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),a=!(0,s.ah)(i,e);a&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter(e=>e.plugin.id===t).length}_updateHoverStyles(t,e,i){let s=this.options.hover,diff=(t,e)=>t.filter(t=>!e.some(e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)),a=diff(e,t),n=i?t:diff(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),n.length&&s.mode&&this.updateHoverStyle(n,s.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},eventFilter=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,eventFilter))return;let s=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,eventFilter),(s||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:a=[],options:n}=this,r=this._getActiveElements(t,a,i,e),o=(0,s.ai)(t),l=determineLastEvent(t,this._lastEvent,i,o);i&&(this._lastEvent=null,(0,s.Q)(n.onHover,[t,r,this],this),o&&(0,s.Q)(n.onClick,[t,r,this],this));let h=!(0,s.ah)(r,a);return(h||e)&&(this._active=r,this._updateHoverStyles(r,a,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;let a=this.options.hover;return this.getElementsAtEventForMode(t,a.mode,a,s)}};function invalidatePlugins(){return(0,s.F)(Chart.instances,t=>t._plugins.invalidate())}function clipArc(t,e,i){let{startAngle:a,pixelMargin:n,x:r,y:o,outerRadius:l,innerRadius:h}=e,d=n/l;t.beginPath(),t.arc(r,o,l,a-d,i+d),h>n?(d=n/h,t.arc(r,o,h,i+d,a-d,!0)):t.arc(r,o,n,i+s.H,a-s.H),t.closePath(),t.clip()}function toRadiusCorners(t){return(0,s.ak)(t,["outerStart","outerEnd","innerStart","innerEnd"])}function parseBorderRadius$1(t,e,i,a){let n=toRadiusCorners(t.options.borderRadius),r=(i-e)/2,o=Math.min(r,a*e/2),computeOuterLimit=t=>{let e=(i-Math.min(r,t))*a/2;return(0,s.S)(t,0,Math.min(r,e))};return{outerStart:computeOuterLimit(n.outerStart),outerEnd:computeOuterLimit(n.outerEnd),innerStart:(0,s.S)(n.innerStart,0,o),innerEnd:(0,s.S)(n.innerEnd,0,o)}}function rThetaToXY(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function pathArc(t,e,i,a,n,r){let{x:o,y:l,startAngle:h,pixelMargin:d,innerRadius:c}=e,u=Math.max(e.outerRadius+a+i-d,0),g=c>0?c+a+i+d:0,p=0,f=n-h;if(a){let t=u>0?u-a:0,e=((c>0?c-a:0)+t)/2;p=(f-(0!==e?f*e/(e+a):f))/2}let m=Math.max(.001,f*u-i/s.P)/u,x=(f-m)/2,b=h+x+p,_=n-x-p,{outerStart:v,outerEnd:y,innerStart:k,innerEnd:M}=parseBorderRadius$1(e,g,u,_-b),S=u-v,w=u-y,P=b+v/S,C=_-y/w,D=g+k,L=g+M,A=b+k/D,T=_-M/L;if(t.beginPath(),r){let e=(P+C)/2;if(t.arc(o,l,u,P,e),t.arc(o,l,u,e,C),y>0){let e=rThetaToXY(w,C,o,l);t.arc(e.x,e.y,y,C,_+s.H)}let i=rThetaToXY(L,_,o,l);if(t.lineTo(i.x,i.y),M>0){let e=rThetaToXY(L,T,o,l);t.arc(e.x,e.y,M,_+s.H,T+Math.PI)}let a=(_-M/g+(b+k/g))/2;if(t.arc(o,l,g,_-M/g,a,!0),t.arc(o,l,g,a,b+k/g,!0),k>0){let e=rThetaToXY(D,A,o,l);t.arc(e.x,e.y,k,A+Math.PI,b-s.H)}let n=rThetaToXY(S,b,o,l);if(t.lineTo(n.x,n.y),v>0){let e=rThetaToXY(S,P,o,l);t.arc(e.x,e.y,v,b-s.H,P)}}else{t.moveTo(o,l);let e=Math.cos(P)*u+o,i=Math.sin(P)*u+l;t.lineTo(e,i);let s=Math.cos(C)*u+o,a=Math.sin(C)*u+l;t.lineTo(s,a)}t.closePath()}function drawArc(t,e,i,a,n){let{fullCircles:r,startAngle:o,circumference:l}=e,h=e.endAngle;if(r){pathArc(t,e,i,a,h,n);for(let e=0;e"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){let a=this.getProps(["x","y"],i),{angle:n,distance:r}=(0,s.D)(a,{x:t,y:e}),{startAngle:o,endAngle:l,innerRadius:h,outerRadius:d,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=(this.options.spacing+this.options.borderWidth)/2,g=(0,s.v)(c,l-o),p=g>=s.T||(0,s.p)(n,o,l),f=(0,s.aj)(r,h+u,d+u);return p&&f}getCenterPoint(t){let{x:e,y:i,startAngle:s,endAngle:a,innerRadius:n,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:o,spacing:l}=this.options,h=(s+a)/2,d=(n+r+l+o)/2;return{x:e+Math.cos(h)*d,y:i+Math.sin(h)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){let{options:e,circumference:i}=this,a=(e.offset||0)/4,n=(e.spacing||0)/2,r=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>s.T?Math.floor(i/s.T):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let o=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(o)*a,Math.sin(o)*a);let l=1-Math.sin(Math.min(s.P,i||0)),h=a*l;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,drawArc(t,this,h,n,r),drawBorder(t,this,h,n,r),t.restore()}};function setStyle(t,e,i=e){t.lineCap=(0,s.v)(i.borderCapStyle,e.borderCapStyle),t.setLineDash((0,s.v)(i.borderDash,e.borderDash)),t.lineDashOffset=(0,s.v)(i.borderDashOffset,e.borderDashOffset),t.lineJoin=(0,s.v)(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=(0,s.v)(i.borderWidth,e.borderWidth),t.strokeStyle=(0,s.v)(i.borderColor,e.borderColor)}function lineTo(t,e,i){t.lineTo(i.x,i.y)}function getLineMethod(t){return t.stepped?s.ar:t.tension||"monotone"===t.cubicInterpolationMode?s.as:lineTo}function pathVars(t,e,i={}){let s=t.length,{start:a=0,end:n=s-1}=i,{start:r,end:o}=e,l=Math.max(a,r),h=Math.min(n,o);return{count:s,start:l,loop:e.loop,ilen:ho&&n>o)?s+h-l:h-l}}function pathSegment(t,e,i,s){let a,n,r;let{points:o,options:l}=e,{count:h,start:d,loop:c,ilen:u}=pathVars(o,i,s),g=getLineMethod(l),{move:p=!0,reverse:f}=s||{};for(a=0;a<=u;++a)(n=o[(d+(f?u-a:a))%h]).skip||(p?(t.moveTo(n.x,n.y),p=!1):g(t,r,n,f,l.stepped),r=n);return c&&g(t,r,n=o[(d+(f?u:0))%h],f,l.stepped),!!c}function fastPathSegment(t,e,i,s){let a,n,r,o,l,h;let d=e.points,{count:c,start:u,ilen:g}=pathVars(d,i,s),{move:p=!0,reverse:f}=s||{},m=0,x=0,pointIndex=t=>(u+(f?g-t:t))%c,drawX=()=>{o!==l&&(t.lineTo(m,l),t.lineTo(m,o),t.lineTo(m,h))};for(p&&(n=d[pointIndex(0)],t.moveTo(n.x,n.y)),a=0;a<=g;++a){if((n=d[pointIndex(a)]).skip)continue;let e=n.x,i=n.y,s=0|e;s===r?(il&&(l=i),m=(x*m+e)/++x):(drawX(),t.lineTo(e,i),r=s,x=0,o=l=i),h=i}drawX()}function _getSegmentMethod(t){let e=t.options,i=e.borderDash&&e.borderDash.length,s=!t._decimated&&!t._loop&&!e.tension&&"monotone"!==e.cubicInterpolationMode&&!e.stepped&&!i;return s?fastPathSegment:pathSegment}function _getInterpolationMethod(t){return t.stepped?s.ao:t.tension||"monotone"===t.cubicInterpolationMode?s.ap:s.aq}function strokePathWithCache(t,e,i,s){let a=e._path;!a&&(a=e._path=new Path2D,e.path(a,i,s)&&a.closePath()),setStyle(t,e.options),t.stroke(a)}function strokePathDirect(t,e,i,s){let{segments:a,options:n}=e,r=_getSegmentMethod(e);for(let o of a)setStyle(t,n,o.style),t.beginPath(),r(t,e,o,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}let y="function"==typeof Path2D;function draw(t,e,i,s){y&&!e.options.segment?strokePathWithCache(t,e,i,s):strokePathDirect(t,e,i,s)}let LineElement=class LineElement extends Element{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){let a=i.spanGaps?this._loop:this._fullLoop;(0,s.al)(this._points,i,t,a,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=(0,s.am)(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i,a;let n=this.options,r=t[e],o=this.points,l=(0,s.an)(this,{property:e,start:r,end:r});if(!l.length)return;let h=[],d=_getInterpolationMethod(n);for(i=0,a=l.length;it.replace("rgb(","rgba(").replace(")",", 0.5)"));function getBorderColor(t){return k[t%k.length]}function getBackgroundColor(t){return M[t%M.length]}function _segments(t,e,i){let a=t.segments,n=t.points,r=e.points,o=[];for(let t of a){let{start:a,end:l}=t;l=_findSegmentEnd(a,l,n);let h=_getBounds(i,n[a],n[l],t.loop);if(!e.segments){o.push({source:t,target:h,start:n[a],end:n[l]});continue}let d=(0,s.an)(e,h);for(let e of d){let a=_getBounds(i,r[e.start],r[e.end],e.loop),l=(0,s.ax)(t,n,a);for(let t of l)o.push({source:t,target:e,start:{[i]:_getEdge(h,a,"start",Math.max)},end:{[i]:_getEdge(h,a,"end",Math.min)}})}}return o}function _getBounds(t,e,i,a){if(a)return;let n=e[t],r=i[t];return"angle"===t&&(n=(0,s.ay)(n),r=(0,s.ay)(r)),{property:t,start:n,end:r}}function _pointsFromSegments(t,e){let{x:i=null,y:s=null}=t||{},a=e.points,n=[];return e.segments.forEach(({start:t,end:e})=>{e=_findSegmentEnd(t,e,a);let r=a[t],o=a[e];null!==s?(n.push({x:r.x,y:s}),n.push({x:o.x,y:s})):null!==i&&(n.push({x:i,y:r.y}),n.push({x:i,y:o.y}))}),n}function _findSegmentEnd(t,e,i){for(;e>t;e--){let t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function _getEdge(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function _createBoundaryLine(t,e){let i=[],a=!1;return(0,s.b)(t)?(a=!0,i=t):i=_pointsFromSegments(t,e),i.length?new LineElement({points:i,options:{tension:0},_loop:a,_fullLoop:a}):null}function _getTargetPixel(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:(0,s.i)(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}function _getTargetValue(t,e,i){return"start"===t?i:"end"===t?e.options.reverse?e.min:e.max:(0,s.i)(t)?t.value:e.getBaseValue()}function _buildStackLine(t){let{scale:e,index:i,line:s}=t,a=[],n=s.segments,r=s.points,o=getLinesBelow(e,i);o.push(_createBoundaryLine({x:null,y:e.bottom},s));for(let t=0;tt.length>e.length?t:e)),e+i.size/2+s.measureText(a).width}function calculateItemHeight(t,e,i){let s=t;return"string"!=typeof e.text&&(s=calculateLegendItemHeight(e,i)),s}function calculateLegendItemHeight(t,e){let i=t.text?t.text.length:0;return e*i}new WeakMap;let S={average(t){let e,i;if(!t.length)return!1;let s=0,a=0,n=0;for(e=0,i=t.length;e-1?t.split("\n"):t}function createTooltipItem(t,e){let{element:i,datasetIndex:s,index:a}=e,n=t.getDatasetMeta(s).controller,{label:r,value:o}=n.getLabelAndValue(a);return{chart:t,label:r,parsed:n.getParsed(a),raw:t.data.datasets[s].data[a],formattedValue:o,dataset:n.getDataset(),dataIndex:a,datasetIndex:s,element:i}}function getTooltipSize(t,e){let i=t.chart.ctx,{body:a,footer:n,title:r}=t,{boxWidth:o,boxHeight:l}=e,h=(0,s.a0)(e.bodyFont),d=(0,s.a0)(e.titleFont),c=(0,s.a0)(e.footerFont),u=r.length,g=n.length,p=a.length,f=(0,s.E)(e.padding),m=f.height,x=0,b=a.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0);if(b+=t.beforeBody.length+t.afterBody.length,u&&(m+=u*d.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),b){let t=e.displayColors?Math.max(l,h.lineHeight):h.lineHeight;m+=p*t+(b-p)*h.lineHeight+(b-1)*e.bodySpacing}g&&(m+=e.footerMarginTop+g*c.lineHeight+(g-1)*e.footerSpacing);let _=0,maxLineWidth=function(t){x=Math.max(x,i.measureText(t).width+_)};return i.save(),i.font=d.string,(0,s.F)(t.title,maxLineWidth),i.font=h.string,(0,s.F)(t.beforeBody.concat(t.afterBody),maxLineWidth),_=e.displayColors?o+2+e.boxPadding:0,(0,s.F)(a,t=>{(0,s.F)(t.before,maxLineWidth),(0,s.F)(t.lines,maxLineWidth),(0,s.F)(t.after,maxLineWidth)}),_=0,i.font=c.string,(0,s.F)(t.footer,maxLineWidth),i.restore(),{width:x+=f.width,height:m}}function determineYAlign(t,e){let{y:i,height:s}=e;return it.height-s/2?"bottom":"center"}function doesNotFitWithAlign(t,e,i,s){let{x:a,width:n}=s,r=i.caretSize+i.caretPadding;if("left"===t&&a+n+r>e.width||"right"===t&&a-n-r<0)return!0}function determineXAlign(t,e,i,s){let{x:a,width:n}=i,{width:r,chartArea:{left:o,right:l}}=t,h="center";return"center"===s?h=a<=(o+l)/2?"left":"right":a<=n/2?h="left":a>=r-n/2&&(h="right"),doesNotFitWithAlign(h,t,e,i)&&(h="center"),h}function determineAlignment(t,e,i){let s=i.yAlign||e.yAlign||determineYAlign(t,i);return{xAlign:i.xAlign||e.xAlign||determineXAlign(t,e,i,s),yAlign:s}}function alignX(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}function alignY(t,e,i){let{y:s,height:a}=t;return"top"===e?s+=i:"bottom"===e?s-=a+i:s-=a/2,s}function getBackgroundPoint(t,e,i,a){let{caretSize:n,caretPadding:r,cornerRadius:o}=t,{xAlign:l,yAlign:h}=i,d=n+r,{topLeft:c,topRight:u,bottomLeft:g,bottomRight:p}=(0,s.aw)(o),f=alignX(e,l),m=alignY(e,h,d);return"center"===h?"left"===l?f+=d:"right"===l&&(f-=d):"left"===l?f-=Math.max(c,g)+n:"right"===l&&(f+=Math.max(u,p)+n),{x:(0,s.S)(f,0,a.width-e.width),y:(0,s.S)(m,0,a.height-e.height)}}function getAlignedX(t,e,i){let a=(0,s.E)(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-a.right:t.x+a.left}function createTooltipContext(t,e,i){return(0,s.j)(t,{tooltip:e,tooltipItems:i,type:"tooltip"})}function overrideCallbacks(t,e){let i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}let w={beforeTitle:s.aF,title(t){if(t.length>0){let e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex{let e={before:[],lines:[],after:[]},s=overrideCallbacks(i,t);pushOrConcat(e.before,splitNewlines(invokeCallbackWithFallback(s,"beforeLabel",this,t))),pushOrConcat(e.lines,invokeCallbackWithFallback(s,"label",this,t)),pushOrConcat(e.after,splitNewlines(invokeCallbackWithFallback(s,"afterLabel",this,t))),a.push(e)}),a}getAfterBody(t,e){return pushOrConcat([],splitNewlines(invokeCallbackWithFallback(e.callbacks,"afterBody",this,t)))}getFooter(t,e){let{callbacks:i}=e,s=invokeCallbackWithFallback(i,"beforeFooter",this,t),a=invokeCallbackWithFallback(i,"footer",this,t),n=invokeCallbackWithFallback(i,"afterFooter",this,t),r=[];return r=pushOrConcat(r,splitNewlines(s)),r=pushOrConcat(r,splitNewlines(a)),r=pushOrConcat(r,splitNewlines(n))}_createItems(t){let e,i;let a=this._active,n=this.chart.data,r=[],o=[],l=[],h=[];for(e=0,i=a.length;et.filter(e,i,s,n))),t.itemSort&&(h=h.sort((e,i)=>t.itemSort(e,i,n))),(0,s.F)(h,e=>{let i=overrideCallbacks(t.callbacks,e);r.push(invokeCallbackWithFallback(i,"labelColor",this,e)),o.push(invokeCallbackWithFallback(i,"labelPointStyle",this,e)),l.push(invokeCallbackWithFallback(i,"labelTextColor",this,e))}),this.labelColors=r,this.labelPointStyles=o,this.labelTextColors=l,this.dataPoints=h,h}update(t,e){let i;let s=this.options.setContext(this.getContext()),a=this._active,n=[];if(a.length){let t=S[s.position].call(this,a,this._eventPosition);n=this._createItems(s),this.title=this.getTitle(n,s),this.beforeBody=this.getBeforeBody(n,s),this.body=this.getBody(n,s),this.afterBody=this.getAfterBody(n,s),this.footer=this.getFooter(n,s);let e=this._size=getTooltipSize(this,s),r=Object.assign({},t,e),o=determineAlignment(this.chart,s,r),l=getBackgroundPoint(s,r,o,this.chart);this.xAlign=o.xAlign,this.yAlign=o.yAlign,i={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(i={opacity:0});this._tooltipItems=n,this.$context=void 0,i&&this._resolveAnimations().update(this,i),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){let a=this.getCaretPosition(t,i,s);e.lineTo(a.x1,a.y1),e.lineTo(a.x2,a.y2),e.lineTo(a.x3,a.y3)}getCaretPosition(t,e,i){let a,n,r,o,l,h;let{xAlign:d,yAlign:c}=this,{caretSize:u,cornerRadius:g}=i,{topLeft:p,topRight:f,bottomLeft:m,bottomRight:x}=(0,s.aw)(g),{x:b,y:_}=t,{width:v,height:y}=e;return"center"===c?(l=_+y/2,"left"===d?(n=(a=b)-u,o=l+u,h=l-u):(n=(a=b+v)+u,o=l-u,h=l+u),r=a):(n="left"===d?b+Math.max(p,m)+u:"right"===d?b+v-Math.max(f,x)-u:this.caretX,"top"===c?(l=(o=_)-u,a=n-u,r=n+u):(l=(o=_+y)+u,a=n+u,r=n-u),h=o),{x1:a,x2:n,x3:r,y1:o,y2:l,y3:h}}drawTitle(t,e,i){let a,n,r;let o=this.title,l=o.length;if(l){let h=(0,s.az)(i.rtl,this.x,this.width);for(r=0,t.x=getAlignedX(this,i.titleAlign,i),e.textAlign=h.textAlign(i.titleAlign),e.textBaseline="middle",a=(0,s.a0)(i.titleFont),n=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string;r0!==t)?(t.beginPath(),t.fillStyle=n.multiKeyBackground,(0,s.au)(t,{x:e,y:p,w:h,h:l,radius:o}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),(0,s.au)(t,{x:i,y:p+1,w:h-2,h:l-2,radius:o}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,p,h,l),t.strokeRect(e,p,h,l),t.fillStyle=r.backgroundColor,t.fillRect(i,p+1,h-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let a,n,r,o,l,h,d;let{body:c}=this,{bodySpacing:u,bodyAlign:g,displayColors:p,boxHeight:f,boxWidth:m,boxPadding:x}=i,b=(0,s.a0)(i.bodyFont),_=b.lineHeight,v=0,y=(0,s.az)(i.rtl,this.x,this.width),fillLineOfText=function(i){e.fillText(i,y.x(t.x+v),t.y+_/2),t.y+=_+u},k=y.textAlign(g);for(e.textAlign=g,e.textBaseline="middle",e.font=b.string,t.x=getAlignedX(this,k,i),e.fillStyle=i.bodyColor,(0,s.F)(this.beforeBody,fillLineOfText),v=p&&"right"!==k?"center"===g?m/2+x:m+2+x:0,o=0,h=c.length;o0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,s=i&&i.x,a=i&&i.y;if(s||a){let i=S[t.position].call(this,this._active,this._eventPosition);if(!i)return;let n=this._size=getTooltipSize(this,t),r=Object.assign({},i,this._size),o=determineAlignment(e,t,r),l=getBackgroundPoint(t,r,o,e);(s._to!==l.x||a._to!==l.y)&&(this.xAlign=o.xAlign,this.yAlign=o.yAlign,this.width=n.width,this.height=n.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let a={width:this.width,height:this.height},n={x:this.x,y:this.y};i=.001>Math.abs(i)?0:i;let r=(0,s.E)(e.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,a,e),(0,s.aA)(t,e.textDirection),n.y+=r.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),(0,s.aC)(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,a=t.map(({datasetIndex:t,index:e})=>{let i=this.chart.getDatasetMeta(t);if(!i)throw Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),n=!(0,s.ah)(i,a),r=this._positionChanged(a,e);(n||r)&&(this._active=a,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let a=this.options,n=this._active||[],r=this._getActiveElements(t,n,e,i),o=this._positionChanged(r,t),l=e||!(0,s.ah)(r,n)||o;return l&&(this._active=r,(a.enabled||a.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){let a=this.options;if("mouseout"===t.type)return[];if(!s)return e.filter(t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index));let n=this.chart.getElementsAtEventForMode(t,a.mode,a,i);return a.reverse&&n.reverse(),n}_positionChanged(t,e){let{caretX:i,caretY:s,options:a}=this,n=S[a.position].call(this,t,e);return!1!==n&&(i!==n.x||s!==n.y)}};var P={id:"tooltip",_element:Tooltip,positioners:S,afterInit(t,e,i){i&&(t.tooltip=new Tooltip({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){let e=t.tooltip;if(e&&e._willRender()){let i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){let i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:w},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};let addIfString=(t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i);function findOrAddLabel(t,e,i,s){let a=t.indexOf(e);if(-1===a)return addIfString(t,e,i,s);let n=t.lastIndexOf(e);return a!==n?i:a}let validIndex=(t,e)=>null===t?null:(0,s.S)(Math.round(t),0,e);function _getLabelForValue(t){let e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};function generateTicks$1(t,e){let i,a,n,r;let o=[],{bounds:l,step:h,min:d,max:c,precision:u,count:g,maxTicks:p,maxDigits:f,includeBounds:m}=t,x=h||1,b=p-1,{min:_,max:v}=e,y=!(0,s.k)(d),k=!(0,s.k)(c),M=!(0,s.k)(g),S=(v-_)/(f+1),w=(0,s.aH)((v-_)/b/x)*x;if(w<1e-14&&!y&&!k)return[{value:_},{value:v}];(r=Math.ceil(v/w)-Math.floor(_/w))>b&&(w=(0,s.aH)(r*w/b/x)*x),(0,s.k)(u)||(w=Math.ceil(w*(i=Math.pow(10,u)))/i),"ticks"===l?(a=Math.floor(_/w)*w,n=Math.ceil(v/w)*w):(a=_,n=v),y&&k&&h&&(0,s.aI)((c-d)/h,w/1e3)?(r=Math.round(Math.min((c-d)/w,p)),w=(c-d)/r,a=d,n=c):M?(a=y?d:a,w=((n=k?c:n)-a)/(r=g-1)):(r=(n-a)/w,r=(0,s.aJ)(r,Math.round(r),w/1e3)?Math.round(r):Math.ceil(r));let P=Math.max((0,s.aK)(w),(0,s.aK)(a));a=Math.round(a*(i=Math.pow(10,(0,s.k)(u)?P:u)))/i,n=Math.round(n*i)/i;let C=0;for(y&&(m&&a!==d?(o.push({value:d}),ac)break;o.push({value:t})}return k&&m&&n!==c?o.length&&(0,s.aJ)(o[o.length-1].value,c,relativeLabelSize(c,S,t))?o[o.length-1].value=c:o.push({value:c}):k&&n!==c||o.push({value:n}),o}function relativeLabelSize(t,e,{horizontal:i,minRotation:a}){let n=(0,s.t)(a),r=.75*e*(""+t).length;return Math.min(e/((i?Math.sin(n):Math.cos(n))||.001),r)}let LinearScaleBase=class LinearScaleBase extends Scale{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return(0,s.k)(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:a,max:n}=this,setMin=t=>a=e?a:t,setMax=t=>n=i?n:t;if(t){let t=(0,s.s)(a),e=(0,s.s)(n);t<0&&e<0?setMax(0):t>0&&e>0&&setMin(0)}if(a===n){let e=0===n?1:Math.abs(.05*n);setMax(n+e),t||setMin(a-e)}this.min=a,this.max=n}getTickLimit(){let t;let e=this.options.ticks,{maxTicksLimit:i,stepSize:s}=e;return s?(t=Math.ceil(this.max/s)-Math.floor(this.min/s)+1)>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${t} ticks. Limiting to 1000.`),t=1e3):(t=this.computeTickLimit(),i=i||11),i&&(t=Math.min(i,t)),t}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let a={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},n=this._range||this,r=generateTicks$1(a,n);return"ticks"===t.bounds&&(0,s.aG)(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return(0,s.o)(t,this.chart.options.locale,this.options.ticks.format)}};let LinearScale=class LinearScale extends LinearScaleBase{static id="linear";static defaults={ticks:{callback:s.aL.formatters.numeric}};determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=(0,s.g)(t)?t:0,this.max=(0,s.g)(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=(0,s.t)(this.options.ticks.minRotation),a=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,a.lineHeight/((t?Math.sin(i):Math.cos(i))||.001)))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}};let log10Floor=t=>Math.floor((0,s.aM)(t)),changeExponent=(t,e)=>Math.pow(10,log10Floor(t)+e);function isMajor(t){let e=t/Math.pow(10,log10Floor(t));return 1===e}function steps(t,e,i){let s=Math.pow(10,i);return Math.ceil(e/s)-Math.floor(t/s)}function startExp(t,e){let i=e-t,s=log10Floor(i);for(;steps(t,e,s)>10;)s++;for(;10>steps(t,e,s);)s--;return Math.min(s,log10Floor(t))}function generateTicks(t,{min:e,max:i}){e=(0,s.O)(t.min,e);let a=[],n=log10Floor(e),r=startExp(e,i),o=r<0?Math.pow(10,Math.abs(r)):1,l=Math.pow(10,r),h=n>r?Math.pow(10,n):0,d=Math.round((e-h)*o)/o,c=Math.floor((e-h)/l/10)*l*10,u=Math.floor((d-c)/Math.pow(10,r)),g=(0,s.O)(t.min,Math.round((h+c+u*Math.pow(10,r))*o)/o);for(;g=10?u=u<15?15:20:u++,u>=20&&(u=2,o=++r>=0?1:o),g=Math.round((h+c+u*Math.pow(10,r))*o)/o;let p=(0,s.O)(t.max,g);return a.push({value:p,major:isMajor(p),significand:u}),a}let LogarithmicScale=class LogarithmicScale extends Scale{static id="logarithmic";static defaults={ticks:{callback:s.aL.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=LinearScaleBase.prototype.parse.apply(this,[t,e]);if(0===i){this._zero=!0;return}return(0,s.g)(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=(0,s.g)(t)?Math.max(0,t):null,this.max=(0,s.g)(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!(0,s.g)(this._userMin)&&(this.min=t===changeExponent(this.min,0)?changeExponent(this.min,-1):changeExponent(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),i=this.min,s=this.max,setMin=e=>i=t?i:e,setMax=t=>s=e?s:t;i===s&&(i<=0?(setMin(1),setMax(10)):(setMin(changeExponent(i,-1)),setMax(changeExponent(s,1)))),i<=0&&setMin(changeExponent(s,-1)),s<=0&&setMax(changeExponent(i,1)),this.min=i,this.max=s}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=generateTicks(e,this);return"ticks"===t.bounds&&(0,s.aG)(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return void 0===t?"0":(0,s.o)(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=(0,s.aM)(t),this._valueRange=(0,s.aM)(this.max)-(0,s.aM)(t)}getPixelForValue(t){return((void 0===t||0===t)&&(t=this.min),null===t||isNaN(t))?NaN:this.getPixelForDecimal(t===this.min?0:((0,s.aM)(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};function getTickBackdropHeight(t){let e=t.ticks;if(e.display&&t.display){let t=(0,s.E)(e.backdropPadding);return(0,s.v)(e.font&&e.font.size,s.d.font.size)+t.height}return 0}function measureLabelSize(t,e,i){return i=(0,s.b)(i)?i:[i],{w:(0,s.aN)(t,e.string,i),h:i.length*e.lineHeight}}function determineLimits(t,e,i,s,a){return t===s||t===a?{start:e-i/2,end:e+i/2}:ta?{start:e-i,end:e}:{start:e,end:e+i}}function fitWithPointLabels(t){let e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),a=[],n=[],r=t._pointLabels.length,o=t.options.pointLabels,l=o.centerPointLabels?s.P/r:0;for(let h=0;he.r&&(o=(s.end-e.r)/n,t.r=Math.max(t.r,e.r+o)),a.starte.b&&(l=(a.end-e.b)/r,t.b=Math.max(t.b,e.b+l))}function createPointLabelItem(t,e,i){let a=t.drawingArea,{extra:n,additionalAngle:r,padding:o,size:l}=i,h=t.getPointPosition(e,a+n+o,r),d=Math.round((0,s.U)((0,s.ay)(h.angle+s.H))),c=yForAngle(h.y,l.h,d),u=getTextAlignForAngle(d),g=leftForTextAlign(h.x,l.w,u);return{visible:!0,x:h.x,y:c,textAlign:u,left:g,top:c,right:g+l.w,bottom:c+l.h}}function isNotOverlapped(t,e){if(!e)return!0;let{left:i,top:a,right:n,bottom:r}=t,o=(0,s.C)({x:i,y:a},e)||(0,s.C)({x:i,y:r},e)||(0,s.C)({x:n,y:a},e)||(0,s.C)({x:n,y:r},e);return!o}function buildPointLabelItems(t,e,i){let a;let n=[],r=t._pointLabels.length,o=t.options,{centerPointLabels:l,display:h}=o.pointLabels,d={extra:getTickBackdropHeight(o)/2,additionalAngle:l?s.P/r:0};for(let s=0;s270||i<90)&&(t-=e),t}function drawPointLabelBox(t,e,i){let{left:a,top:n,right:r,bottom:o}=i,{backdropColor:l}=e;if(!(0,s.k)(l)){let i=(0,s.aw)(e.borderRadius),h=(0,s.E)(e.backdropPadding);t.fillStyle=l;let d=a-h.left,c=n-h.top,u=r-a+h.width,g=o-n+h.height;Object.values(i).some(t=>0!==t)?(t.beginPath(),(0,s.au)(t,{x:d,y:c,w:u,h:g,radius:i}),t.fill()):t.fillRect(d,c,u,g)}}function drawPointLabels(t,e){let{ctx:i,options:{pointLabels:a}}=t;for(let n=e-1;n>=0;n--){let e=t._pointLabelItems[n];if(!e.visible)continue;let r=a.setContext(t.getPointLabelContext(n));drawPointLabelBox(i,r,e);let o=(0,s.a0)(r.font),{x:l,y:h,textAlign:d}=e;(0,s.Z)(i,t._pointLabels[n],l,h+o.lineHeight/2,o,{color:r.color,textAlign:d,textBaseline:"middle"})}}function pathRadiusLine(t,e,i,a){let{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,s.T);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let s=1;st,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=(0,s.E)(getTickBackdropHeight(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=(0,s.g)(t)&&!isNaN(t)?t:0,this.max=(0,s.g)(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/getTickBackdropHeight(this.options))}generateTickLabels(t){LinearScaleBase.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((t,e)=>{let i=(0,s.Q)(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){let t=this.options;t.display&&t.pointLabels.display?fitWithPointLabels(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){let e=s.T/(this._pointLabels.length||1),i=this.options.startAngle||0;return(0,s.ay)(t*e+(0,s.t)(i))}getDistanceFromCenterForValue(t){if((0,s.k)(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if((0,s.k)(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t{if(0!==i){e=this.getDistanceFromCenterForValue(t.value);let s=this.getContext(i),a=r.setContext(s),n=o.setContext(s);drawRadiusLine(this,a,e,l,n)}}),n.display){for(s.save(),t=l-1;t>=0;t--){let r=n.setContext(this.getPointLabelContext(t)),{color:o,lineWidth:l}=r;l&&o&&(s.lineWidth=l,s.strokeStyle=o,s.setLineDash(r.borderDash),s.lineDashOffset=r.borderDashOffset,e=this.getDistanceFromCenterForValue(a.ticks.reverse?this.min:this.max),i=this.getPointPosition(t,e),s.beginPath(),s.moveTo(this.xCenter,this.yCenter),s.lineTo(i.x,i.y),s.stroke())}s.restore()}}drawBorder(){}drawLabels(){let t,e;let i=this.ctx,a=this.options,n=a.ticks;if(!n.display)return;let r=this.getIndexAngle(0);i.save(),i.translate(this.xCenter,this.yCenter),i.rotate(r),i.textAlign="center",i.textBaseline="middle",this.ticks.forEach((r,o)=>{if(0===o&&!a.reverse)return;let l=n.setContext(this.getContext(o)),h=(0,s.a0)(l.font);if(t=this.getDistanceFromCenterForValue(this.ticks[o].value),l.showLabelBackdrop){i.font=h.string,e=i.measureText(r.label).width,i.fillStyle=l.backdropColor;let a=(0,s.E)(l.backdropPadding);i.fillRect(-e/2-a.left,-t-h.size/2-a.top,e+a.width,h.size+a.height)}(0,s.Z)(i,r.label,0,-t,h,{color:l.color,strokeColor:l.textStrokeColor,strokeWidth:l.textStrokeWidth})}),i.restore()}drawTitle(){}};let C={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},D=Object.keys(C);function sorter(t,e){return t-e}function parse(t,e){if((0,s.k)(e))return null;let i=t._adapter,{parser:a,round:n,isoWeekday:r}=t._parseOpts,o=e;return("function"==typeof a&&(o=a(o)),(0,s.g)(o)||(o="string"==typeof a?i.parse(o,a):i.parse(o)),null===o)?null:(n&&(o="week"===n&&((0,s.x)(r)||!0===r)?i.startOf(o,"isoWeek",r):i.startOf(o,n)),+o)}function determineUnitForAutoTicks(t,e,i,s){let a=D.length;for(let n=D.indexOf(t);n=D.indexOf(i);n--){let i=D[n];if(C[i].common&&t._adapter.diff(a,s,i)>=e-1)return i}return D[i?D.indexOf(i):0]}function determineMajorUnit(t){for(let e=D.indexOf(t)+1,i=D.length;e=e?i[a]:i[n];t[r]=!0}}else t[e]=!0}function setMajorTicks(t,e,i,s){let a,n;let r=t._adapter,o=+r.startOf(e[0].value,s),l=e[e.length-1].value;for(a=o;a<=l;a=+r.add(a,1,s))(n=i[a])>=0&&(e[n].major=!0);return e}function ticksFromTimestamps(t,e,i){let s,a;let n=[],r={},o=e.length;for(s=0;s+t.value))}initOffsets(t=[]){let e,i,a=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),a=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);let r=t.length<3?.5:.25;a=(0,s.S)(a,0,r),n=(0,s.S)(n,0,r),this._offsets={start:a,end:n,factor:1/(a+1+n)}}_generate(){let t,e;let i=this._adapter,a=this.min,n=this.max,r=this.options,o=r.time,l=o.unit||determineUnitForAutoTicks(o.minUnit,a,n,this._getLabelCapacity(a)),h=(0,s.v)(r.ticks.stepSize,1),d="week"===l&&o.isoWeekday,c=(0,s.x)(d)||!0===d,u={},g=a;if(c&&(g=+i.startOf(g,"isoWeek",d)),g=+i.startOf(g,c?"day":l),i.diff(n,a,l)>1e5*h)throw Error(a+" and "+n+" are too far apart with stepSize of "+h+" "+l);let p="data"===r.ticks.source&&this.getDataTimestamps();for(t=g,e=0;t+t)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){let i=this.options,s=i.time.displayFormats,a=this._unit,n=e||s[a];return this._adapter.format(t,n)}_tickFormatFunction(t,e,i,a){let n=this.options,r=n.ticks.callback;if(r)return(0,s.Q)(r,[t,e,i],this);let o=n.time.displayFormats,l=this._unit,h=this._majorUnit,d=l&&o[l],c=h&&o[h],u=i[e],g=h&&c&&u&&u.major;return this._adapter.format(t,a||(g?c:d))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t=t[l].pos&&e<=t[h].pos&&({lo:l,hi:h}=(0,s.B)(t,"pos",e)),{pos:a,time:r}=t[l],{pos:n,time:o}=t[h]):(e>=t[l].time&&e<=t[h].time&&({lo:l,hi:h}=(0,s.B)(t,"time",e)),{time:a,pos:r}=t[l],{time:n,pos:o}=t[h]);let d=n-a;return d?r+(o-r)*(e-a)/d:r}let TimeSeriesScale=class TimeSeriesScale extends TimeScale{static id="timeseries";static defaults=TimeScale.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=interpolate(e,this.min),this._tableRange=interpolate(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let e,i,s;let{min:a,max:n}=this,r=[],o=[];for(e=0,i=t.length;e=a&&s<=n&&r.push(s);if(r.length<2)return[{time:a,pos:0},{time:n,pos:1}];for(e=0,i=r.length;et-e)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t}getDecimalForValue(t){return(interpolate(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return interpolate(this._table,i*this._tableRange+this._minPos,!0)}}}}]); \ No newline at end of file diff --git a/recce/data/_next/static/chunks/880-6a8f9af22d85a0db.js b/recce/data/_next/static/chunks/880-97510f708b3c5314.js similarity index 95% rename from recce/data/_next/static/chunks/880-6a8f9af22d85a0db.js rename to recce/data/_next/static/chunks/880-97510f708b3c5314.js index d72e7d2a..cb9836e1 100644 --- a/recce/data/_next/static/chunks/880-6a8f9af22d85a0db.js +++ b/recce/data/_next/static/chunks/880-97510f708b3c5314.js @@ -359,4 +359,4 @@ ${U.current.stack} top: ${c}px !important; left: ${d}px !important; } - `),()=>{document.head.removeChild(m)}},[n]),i.createElement(PopChildMeasure,{isPresent:n,childRef:s,sizeRef:u},i.cloneElement(e,{ref:s}))}let PresenceChild=({children:e,initial:n,isPresent:o,onExitComplete:s,custom:u,presenceAffectsLayout:m,mode:g})=>{let y=(0,d.h)(newChildrenMap),b=(0,i.useId)(),x=(0,i.useMemo)(()=>({id:b,initial:n,isPresent:o,custom:u,onExitComplete:e=>{for(let n of(y.set(e,!0),y.values()))if(!n)return;s&&s()},register:e=>(y.set(e,!1),()=>y.delete(e))}),m?void 0:[o]);return(0,i.useMemo)(()=>{y.forEach((e,n)=>y.set(n,!1))},[o]),i.useEffect(()=>{o||y.size||!s||s()},[o]),"popLayout"===g&&(e=i.createElement(PopChild,{isPresent:o},e)),i.createElement(c.O.Provider,{value:x},e)};function newChildrenMap(){return new Map}var m=o(1369);function useUnmountEffect(e){return(0,i.useEffect)(()=>()=>e(),[])}var g=o(316);let getChildKey=e=>e.key||"";function updateChildLookup(e,n){e.forEach(e=>{let o=getChildKey(e);n.set(o,e)})}function onlyElements(e){let n=[];return i.Children.forEach(e,e=>{(0,i.isValidElement)(e)&&n.push(e)}),n}let AnimatePresence=({children:e,custom:n,initial:o=!0,onExitComplete:u,exitBeforeEnter:c,presenceAffectsLayout:d=!0,mode:y="sync"})=>{(0,g.k)(!c,"Replace exitBeforeEnter with mode='wait'");let b=(0,i.useContext)(m.p).forceRender||useForceUpdate()[0],x=useIsMounted(),w=onlyElements(e),S=w,_=(0,i.useRef)(new Map).current,C=(0,i.useRef)(S),E=(0,i.useRef)(new Map).current,T=(0,i.useRef)(!0);if((0,s.L)(()=>{T.current=!1,updateChildLookup(w,E),C.current=S}),useUnmountEffect(()=>{T.current=!0,E.clear(),_.clear()}),T.current)return i.createElement(i.Fragment,null,S.map(e=>i.createElement(PresenceChild,{key:getChildKey(e),isPresent:!0,initial:!!o&&void 0,presenceAffectsLayout:d,mode:y},e)));S=[...S];let P=C.current.map(getChildKey),O=w.map(getChildKey),R=P.length;for(let e=0;e{if(-1!==O.indexOf(o))return;let s=E.get(o);if(!s)return;let c=P.indexOf(o),m=e;m||(m=i.createElement(PresenceChild,{key:getChildKey(s),isPresent:!1,onExitComplete:()=>{E.delete(o),_.delete(o);let e=C.current.findIndex(e=>e.key===o);if(C.current.splice(e,1),!_.size){if(C.current=w,!1===x.current)return;b(),u&&u()}},custom:n,presenceAffectsLayout:d,mode:y},s),_.set(o,m)),S.splice(c,0,m)}),S=S.map(e=>{let n=e.key;return _.has(n)?e:i.createElement(PresenceChild,{key:getChildKey(e),isPresent:!0,presenceAffectsLayout:d,mode:y},e)}),i.createElement(i.Fragment,null,_.size?S:S.map(e=>(0,i.cloneElement)(e)))}},27038:function(e,n,o){"use strict";o.d(n,{hO:function(){return useIsPresent},oO:function(){return usePresence}});var i=o(27726),s=o(53046);function usePresence(){let e=(0,i.useContext)(s.O);if(null===e)return[!0,null];let{isPresent:n,onExitComplete:o,register:u}=e,c=(0,i.useId)();return(0,i.useEffect)(()=>u(c),[]),!n&&o?[!1,()=>o&&o(c)]:[!0]}function useIsPresent(){return isPresent((0,i.useContext)(s.O))}function isPresent(e){return null===e||e.isPresent}},1369:function(e,n,o){"use strict";o.d(n,{p:function(){return s}});var i=o(27726);let s=(0,i.createContext)({})},53046:function(e,n,o){"use strict";o.d(n,{O:function(){return s}});var i=o(27726);let s=(0,i.createContext)(null)},74489:function(e,n,o){"use strict";o.d(n,{Pn:function(){return c},Wi:function(){return u},frameData:function(){return d},S6:function(){return m}});var i=o(68390);let Queue=class Queue{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){let n=this.order.indexOf(e);-1!==n&&(this.order.splice(n,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}};function createRenderStep(e){let n=new Queue,o=new Queue,i=0,s=!1,u=!1,c=new WeakSet,d={schedule:(e,u=!1,d=!1)=>{let m=d&&s,g=m?n:o;return u&&c.add(e),g.add(e)&&m&&s&&(i=n.order.length),e},cancel:e=>{o.remove(e),c.delete(e)},process:m=>{if(s){u=!0;return}if(s=!0,[n,o]=[o,n],o.clear(),i=n.order.length)for(let o=0;o(e[n]=createRenderStep(()=>o=!0),e),{}),processStep=e=>c[e].process(u),processBatch=()=>{let c=performance.now();o=!1,u.delta=i?1e3/60:Math.max(Math.min(c-u.timestamp,40),1),u.timestamp=c,u.isProcessing=!0,s.forEach(processStep),u.isProcessing=!1,o&&n&&(i=!1,e(processBatch))},wake=()=>{o=!0,i=!0,u.isProcessing||e(processBatch)},d=s.reduce((e,n)=>{let i=c[n];return e[n]=(e,n=!1,s=!1)=>(o||wake(),i.schedule(e,n,s)),e},{});return{schedule:d,cancel:e=>s.forEach(n=>c[n].cancel(e)),state:u,steps:c}}let{schedule:u,cancel:c,state:d,steps:m}=createRenderBatcher("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:i.Z,!0)},89977:function(e,n,o){"use strict";o.d(n,{E:function(){return tP}});var i=o(27726);let s=(0,i.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),u=(0,i.createContext)({});var c=o(53046),d=o(90529);let m=(0,i.createContext)({strict:!1});function useVisualElement(e,n,o,g){let{visualElement:y}=(0,i.useContext)(u),b=(0,i.useContext)(m),x=(0,i.useContext)(c.O),w=(0,i.useContext)(s).reducedMotion,S=(0,i.useRef)();g=g||b.renderer,!S.current&&g&&(S.current=g(e,{visualState:n,parent:y,props:o,presenceContext:x,blockInitialAnimation:!!x&&!1===x.initial,reducedMotionConfig:w}));let _=S.current;(0,i.useInsertionEffect)(()=>{_&&_.update(o,x)});let C=(0,i.useRef)(!!window.HandoffAppearAnimations);return(0,d.L)(()=>{_&&(_.render(),C.current&&_.animationState&&_.animationState.animateChanges())}),(0,i.useEffect)(()=>{_&&(_.updateFeatures(),!C.current&&_.animationState&&_.animationState.animateChanges(),window.HandoffAppearAnimations=void 0,C.current=!1)}),_}function isRefObject(e){return"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function useMotionRef(e,n,o){return(0,i.useCallback)(i=>{i&&e.mount&&e.mount(i),n&&(i?n.mount(i):n.unmount()),o&&("function"==typeof o?o(i):isRefObject(o)&&(o.current=i))},[n])}function isVariantLabel(e){return"string"==typeof e||Array.isArray(e)}function isAnimationControls(e){return"object"==typeof e&&"function"==typeof e.start}let g=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],y=["initial",...g];function isControllingVariants(e){return isAnimationControls(e.animate)||y.some(n=>isVariantLabel(e[n]))}function isVariantNode(e){return!!(isControllingVariants(e)||e.variants)}function getCurrentTreeVariants(e,n){if(isControllingVariants(e)){let{initial:n,animate:o}=e;return{initial:!1===n||isVariantLabel(n)?n:void 0,animate:isVariantLabel(o)?o:void 0}}return!1!==e.inherit?n:{}}function useCreateMotionContext(e){let{initial:n,animate:o}=getCurrentTreeVariants(e,(0,i.useContext)(u));return(0,i.useMemo)(()=>({initial:n,animate:o}),[variantLabelsAsDependency(n),variantLabelsAsDependency(o)])}function variantLabelsAsDependency(e){return Array.isArray(e)?e.join(" "):e}let b={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},x={};for(let e in b)x[e]={isEnabled:n=>b[e].some(e=>!!n[e])};function loadFeatures(e){for(let n in e)x[n]={...x[n],...e[n]}}var w=o(99228),S=o(1369);let _=(0,i.createContext)({}),C=Symbol.for("motionComponentSymbol");function motion_createMotionComponent({preloadedFeatures:e,createVisualElement:n,useRender:o,useVisualState:c,Component:d}){function MotionComponent(g,y){let b;let x={...(0,i.useContext)(s),...g,layoutId:useLayoutId(g)},{isStatic:S}=x,C=useCreateMotionContext(g),E=c(g,S);if(!S&&w.j){C.visualElement=useVisualElement(d,E,x,n);let o=(0,i.useContext)(_),s=(0,i.useContext)(m).strict;C.visualElement&&(b=C.visualElement.loadFeatures(x,s,e,o))}return i.createElement(u.Provider,{value:C},b&&C.visualElement?i.createElement(b,{visualElement:C.visualElement,...x}):null,o(d,g,useMotionRef(E,C.visualElement,y),E,S,C.visualElement))}e&&loadFeatures(e);let g=(0,i.forwardRef)(MotionComponent);return g[C]=d,g}function useLayoutId({layoutId:e}){let n=(0,i.useContext)(S.p).id;return n&&void 0!==e?n+"-"+e:e}function createMotionProxy(e){function custom(n,o={}){return motion_createMotionComponent(e(n,o))}if("undefined"==typeof Proxy)return custom;let n=new Map;return new Proxy(custom,{get:(e,o)=>(n.has(o)||n.set(o,custom(o)),n.get(o))})}let E=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function isSVGComponent(e){if("string"!=typeof e||e.includes("-"));else if(E.indexOf(e)>-1||/[A-Z]/.test(e))return!0;return!1}let T={};function addScaleCorrector(e){Object.assign(T,e)}let P=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],O=new Set(P);function isForcedMotionValue(e,{layout:n,layoutId:o}){return O.has(e)||e.startsWith("origin")||(n||void 0!==o)&&(!!T[e]||"opacity"===e)}let isMotionValue=e=>!!(e&&e.getVelocity),R={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},M=P.length;function buildTransform(e,{enableHardwareAcceleration:n=!0,allowTransformNone:o=!0},i,s){let u="";for(let n=0;nn=>"string"==typeof n&&n.startsWith(e),j=checkStringStartsWith("--"),B=checkStringStartsWith("var(--"),getValueAsType=(e,n)=>n&&"number"==typeof e?n.transform(e):e,clamp=(e,n,o)=>Math.min(Math.max(o,e),n),F={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},L={...F,transform:e=>clamp(0,1,e)},N={...F,default:1},sanitize=e=>Math.round(1e5*e)/1e5,V=/(-)?([\d]*\.?[\d])+/g,W=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,U=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function isString(e){return"string"==typeof e}let createUnitType=e=>({test:n=>isString(n)&&n.endsWith(e)&&1===n.split(" ").length,parse:parseFloat,transform:n=>`${n}${e}`}),$=createUnitType("deg"),H=createUnitType("%"),G=createUnitType("px"),K=createUnitType("vh"),Y=createUnitType("vw"),X={...H,parse:e=>H.parse(e)/100,transform:e=>H.transform(100*e)},Q={...F,transform:Math.round},J={borderWidth:G,borderTopWidth:G,borderRightWidth:G,borderBottomWidth:G,borderLeftWidth:G,borderRadius:G,radius:G,borderTopLeftRadius:G,borderTopRightRadius:G,borderBottomRightRadius:G,borderBottomLeftRadius:G,width:G,maxWidth:G,height:G,maxHeight:G,size:G,top:G,right:G,bottom:G,left:G,padding:G,paddingTop:G,paddingRight:G,paddingBottom:G,paddingLeft:G,margin:G,marginTop:G,marginRight:G,marginBottom:G,marginLeft:G,rotate:$,rotateX:$,rotateY:$,rotateZ:$,scale:N,scaleX:N,scaleY:N,scaleZ:N,skew:$,skewX:$,skewY:$,distance:G,translateX:G,translateY:G,translateZ:G,x:G,y:G,z:G,perspective:G,transformPerspective:G,opacity:L,originX:X,originY:X,originZ:G,zIndex:Q,fillOpacity:L,strokeOpacity:L,numOctaves:Q};function buildHTMLStyles(e,n,o,i){let{style:s,vars:u,transform:c,transformOrigin:d}=e,m=!1,g=!1,y=!0;for(let e in n){let o=n[e];if(j(e)){u[e]=o;continue}let i=J[e],b=getValueAsType(o,i);if(O.has(e)){if(m=!0,c[e]=b,!y)continue;o!==(i.default||0)&&(y=!1)}else e.startsWith("origin")?(g=!0,d[e]=b):s[e]=b}if(!n.transform&&(m||i?s.transform=buildTransform(e.transform,o,y,i):s.transform&&(s.transform="none")),g){let{originX:e="50%",originY:n="50%",originZ:o=0}=d;s.transformOrigin=`${e} ${n} ${o}`}}let createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(e,n,o){for(let i in n)isMotionValue(n[i])||isForcedMotionValue(i,o)||(e[i]=n[i])}function useInitialMotionValues({transformTemplate:e},n,o){return(0,i.useMemo)(()=>{let i=createHtmlRenderState();return buildHTMLStyles(i,n,{enableHardwareAcceleration:!o},e),Object.assign({},i.vars,i.style)},[n])}function useStyle(e,n,o){let i=e.style||{},s={};return copyRawValuesOnly(s,i,e),Object.assign(s,useInitialMotionValues(e,n,o)),e.transformValues?e.transformValues(s):s}function useHTMLProps(e,n,o){let i={},s=useStyle(e,n,o);return e.drag&&!1!==e.dragListener&&(i.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(i.tabIndex=0),i.style=s,i}let ee=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function isValidMotionProp(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||ee.has(e)}let shouldForward=e=>!isValidMotionProp(e);function loadExternalIsValidProp(e){e&&(shouldForward=n=>n.startsWith("on")?!isValidMotionProp(n):e(n))}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch(e){}function filterProps(e,n,o){let i={};for(let s in e)("values"!==s||"object"!=typeof e.values)&&(shouldForward(s)||!0===o&&isValidMotionProp(s)||!n&&!isValidMotionProp(s)||e.draggable&&s.startsWith("onDrag"))&&(i[s]=e[s]);return i}function calcOrigin(e,n,o){return"string"==typeof e?e:G.transform(n+o*e)}function calcSVGTransformOrigin(e,n,o){let i=calcOrigin(n,e.x,e.width),s=calcOrigin(o,e.y,e.height);return`${i} ${s}`}let et={offset:"stroke-dashoffset",array:"stroke-dasharray"},er={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(e,n,o=1,i=0,s=!0){e.pathLength=1;let u=s?et:er;e[u.offset]=G.transform(-i);let c=G.transform(n),d=G.transform(o);e[u.array]=`${c} ${d}`}function buildSVGAttrs(e,{attrX:n,attrY:o,attrScale:i,originX:s,originY:u,pathLength:c,pathSpacing:d=1,pathOffset:m=0,...g},y,b,x){if(buildHTMLStyles(e,g,y,x),b){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:w,style:S,dimensions:_}=e;w.transform&&(_&&(S.transform=w.transform),delete w.transform),_&&(void 0!==s||void 0!==u||S.transform)&&(S.transformOrigin=calcSVGTransformOrigin(_,void 0!==s?s:.5,void 0!==u?u:.5)),void 0!==n&&(w.x=n),void 0!==o&&(w.y=o),void 0!==i&&(w.scale=i),void 0!==c&&buildSVGPath(w,c,d,m,!1)}let createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=e=>"string"==typeof e&&"svg"===e.toLowerCase();function useSVGProps(e,n,o,s){let u=(0,i.useMemo)(()=>{let o=createSvgRenderState();return buildSVGAttrs(o,n,{enableHardwareAcceleration:!1},isSVGTag(s),e.transformTemplate),{...o.attrs,style:{...o.style}}},[n]);if(e.style){let n={};copyRawValuesOnly(n,e.style,e),u.style={...n,...u.style}}return u}function createUseRender(e=!1){return(n,o,s,{latestValues:u},c)=>{let d=isSVGComponent(n)?useSVGProps:useHTMLProps,m=d(o,u,c,n),g=filterProps(o,"string"==typeof n,e),y={...g,...m,ref:s},{children:b}=o,x=(0,i.useMemo)(()=>isMotionValue(b)?b.get():b,[b]);return(0,i.createElement)(n,{...y,children:x})}}let camelToDash=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function renderHTML(e,{style:n,vars:o},i,s){for(let u in Object.assign(e.style,n,s&&s.getProjectionStyles(i)),o)e.style.setProperty(u,o[u])}let en=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function renderSVG(e,n,o,i){for(let o in renderHTML(e,n,void 0,i),n.attrs)e.setAttribute(en.has(o)?o:camelToDash(o),n.attrs[o])}function scrapeMotionValuesFromProps(e,n){let{style:o}=e,i={};for(let s in o)(isMotionValue(o[s])||n.style&&isMotionValue(n.style[s])||isForcedMotionValue(s,e))&&(i[s]=o[s]);return i}function scrape_motion_values_scrapeMotionValuesFromProps(e,n){let o=scrapeMotionValuesFromProps(e,n);for(let i in e)if(isMotionValue(e[i])||isMotionValue(n[i])){let n=-1!==P.indexOf(i)?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;o[n]=e[i]}return o}function resolveVariantFromProps(e,n,o,i={},s={}){return"function"==typeof n&&(n=n(void 0!==o?o:e.custom,i,s)),"string"==typeof n&&(n=e.variants&&e.variants[n]),"function"==typeof n&&(n=n(void 0!==o?o:e.custom,i,s)),n}var eo=o(740);let isKeyframesTarget=e=>Array.isArray(e),isCustomValue=e=>!!(e&&"object"==typeof e&&e.mix&&e.toValue),resolveFinalValueInKeyframes=e=>isKeyframesTarget(e)?e[e.length-1]||0:e;function resolveMotionValue(e){let n=isMotionValue(e)?e.get():e;return isCustomValue(n)?n.toValue():n}function makeState({scrapeMotionValuesFromProps:e,createRenderState:n,onMount:o},i,s,u){let c={latestValues:makeLatestValues(i,s,u,e),renderState:n()};return o&&(c.mount=e=>o(i,e,c)),c}let makeUseVisualState=e=>(n,o)=>{let s=(0,i.useContext)(u),d=(0,i.useContext)(c.O),make=()=>makeState(e,n,s,d);return o?make():(0,eo.h)(make)};function makeLatestValues(e,n,o,i){let s={},u=i(e,{});for(let e in u)s[e]=resolveMotionValue(u[e]);let{initial:c,animate:d}=e,m=isControllingVariants(e),g=isVariantNode(e);n&&g&&!m&&!1!==e.inherit&&(void 0===c&&(c=n.initial),void 0===d&&(d=n.animate));let y=!!o&&!1===o.initial;y=y||!1===c;let b=y?d:c;if(b&&"boolean"!=typeof b&&!isAnimationControls(b)){let n=Array.isArray(b)?b:[b];n.forEach(n=>{let o=resolveVariantFromProps(e,n);if(!o)return;let{transitionEnd:i,transition:u,...c}=o;for(let e in c){let n=c[e];if(Array.isArray(n)){let e=y?n.length-1:0;n=n[e]}null!==n&&(s[e]=n)}for(let e in i)s[e]=i[e]})}return s}var ei=o(74489);let ea={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrape_motion_values_scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:(e,n,{renderState:o,latestValues:i})=>{ei.Wi.read(()=>{try{o.dimensions="function"==typeof n.getBBox?n.getBBox():n.getBoundingClientRect()}catch(e){o.dimensions={x:0,y:0,width:0,height:0}}}),ei.Wi.render(()=>{buildSVGAttrs(o,i,{enableHardwareAcceleration:!1},isSVGTag(n.tagName),e.transformTemplate),renderSVG(n,o)})}})},es={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps,createRenderState:createHtmlRenderState})};function create_config_createDomMotionConfig(e,{forwardMotionProps:n=!1},o,i){let s=isSVGComponent(e)?ea:es;return{...s,preloadedFeatures:o,useRender:createUseRender(n),createVisualElement:i,Component:e}}function addDomEvent(e,n,o,i={passive:!0}){return e.addEventListener(n,o,i),()=>e.removeEventListener(n,o)}let isPrimaryPointer=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function extractEventInfo(e,n="page"){return{point:{x:e[n+"X"],y:e[n+"Y"]}}}let addPointerInfo=e=>n=>isPrimaryPointer(n)&&e(n,extractEventInfo(n));function addPointerEvent(e,n,o,i){return addDomEvent(e,n,addPointerInfo(o),i)}let combineFunctions=(e,n)=>o=>n(e(o)),pipe=(...e)=>e.reduce(combineFunctions);function createLock(e){let n=null;return()=>null===n&&(n=e,()=>{n=null})}let el=createLock("dragHorizontal"),eu=createLock("dragVertical");function getGlobalLock(e){let n=!1;if("y"===e)n=eu();else if("x"===e)n=el();else{let e=el(),o=eu();e&&o?n=()=>{e(),o()}:(e&&e(),o&&o())}return n}function isDragActive(){let e=getGlobalLock(!0);return!e||(e(),!1)}let Feature=class Feature{constructor(e){this.isMounted=!1,this.node=e}update(){}};function addHoverEvent(e,n){let o="pointer"+(n?"enter":"leave"),i="onHover"+(n?"Start":"End");return addPointerEvent(e.current,o,(o,s)=>{if("touch"===o.type||isDragActive())return;let u=e.getProps();e.animationState&&u.whileHover&&e.animationState.setActive("whileHover",n),u[i]&&ei.Wi.update(()=>u[i](o,s))},{passive:!e.getProps()[i]})}let HoverGesture=class HoverGesture extends Feature{mount(){this.unmount=pipe(addHoverEvent(this.node,!0),addHoverEvent(this.node,!1))}unmount(){}};let FocusGesture=class FocusGesture extends Feature{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(n){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=pipe(addDomEvent(this.node.current,"focus",()=>this.onFocus()),addDomEvent(this.node.current,"blur",()=>this.onBlur()))}unmount(){}};let isNodeOrChild=(e,n)=>!!n&&(e===n||isNodeOrChild(e,n.parentElement));var ec=o(68390);function fireSyntheticPointerEvent(e,n){if(!n)return;let o=new PointerEvent("pointer"+e);n(o,extractEventInfo(o))}let PressGesture=class PressGesture extends Feature{constructor(){super(...arguments),this.removeStartListeners=ec.Z,this.removeEndListeners=ec.Z,this.removeAccessibleListeners=ec.Z,this.startPointerPress=(e,n)=>{if(this.removeEndListeners(),this.isPressing)return;let o=this.node.getProps(),i=addPointerEvent(window,"pointerup",(e,n)=>{if(!this.checkPressEnd())return;let{onTap:o,onTapCancel:i}=this.node.getProps();ei.Wi.update(()=>{isNodeOrChild(this.node.current,e.target)?o&&o(e,n):i&&i(e,n)})},{passive:!(o.onTap||o.onPointerUp)}),s=addPointerEvent(window,"pointercancel",(e,n)=>this.cancelPress(e,n),{passive:!(o.onTapCancel||o.onPointerCancel)});this.removeEndListeners=pipe(i,s),this.startPress(e,n)},this.startAccessiblePress=()=>{let e=addDomEvent(this.node.current,"keydown",e=>{"Enter"!==e.key||this.isPressing||(this.removeEndListeners(),this.removeEndListeners=addDomEvent(this.node.current,"keyup",e=>{"Enter"===e.key&&this.checkPressEnd()&&fireSyntheticPointerEvent("up",(e,n)=>{let{onTap:o}=this.node.getProps();o&&ei.Wi.update(()=>o(e,n))})}),fireSyntheticPointerEvent("down",(e,n)=>{this.startPress(e,n)}))}),n=addDomEvent(this.node.current,"blur",()=>{this.isPressing&&fireSyntheticPointerEvent("cancel",(e,n)=>this.cancelPress(e,n))});this.removeAccessibleListeners=pipe(e,n)}}startPress(e,n){this.isPressing=!0;let{onTapStart:o,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),o&&ei.Wi.update(()=>o(e,n))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;let e=this.node.getProps();return e.whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!isDragActive()}cancelPress(e,n){if(!this.checkPressEnd())return;let{onTapCancel:o}=this.node.getProps();o&&ei.Wi.update(()=>o(e,n))}mount(){let e=this.node.getProps(),n=addPointerEvent(this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),o=addDomEvent(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=pipe(n,o)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}};let ed=new WeakMap,ef=new WeakMap,fireObserverCallback=e=>{let n=ed.get(e.target);n&&n(e)},fireAllObserverCallbacks=e=>{e.forEach(fireObserverCallback)};function initIntersectionObserver({root:e,...n}){let o=e||document;ef.has(o)||ef.set(o,{});let i=ef.get(o),s=JSON.stringify(n);return i[s]||(i[s]=new IntersectionObserver(fireAllObserverCallbacks,{root:e,...n})),i[s]}function observeIntersection(e,n,o){let i=initIntersectionObserver(n);return ed.set(e,o),i.observe(e),()=>{ed.delete(e),i.unobserve(e)}}let ep={some:0,all:1};let InViewFeature=class InViewFeature extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:n,margin:o,amount:i="some",once:s}=e,u={root:n?n.current:void 0,rootMargin:o,threshold:"number"==typeof i?i:ep[i]};return observeIntersection(this.node.current,u,e=>{let{isIntersecting:n}=e;if(this.isInView===n||(this.isInView=n,s&&!n&&this.hasEnteredView))return;n&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",n);let{onViewportEnter:o,onViewportLeave:i}=this.node.getProps(),u=n?o:i;u&&u(e)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;let{props:e,prevProps:n}=this.node,o=["amount","margin","root"].some(hasViewportOptionChanged(e,n));o&&this.startObserver()}unmount(){}};function hasViewportOptionChanged({viewport:e={}},{viewport:n={}}={}){return o=>e[o]!==n[o]}function shallowCompare(e,n){if(!Array.isArray(n))return!1;let o=n.length;if(o!==e.length)return!1;for(let i=0;in[o]=e.get()),n}function getVelocity(e){let n={};return e.values.forEach((e,o)=>n[o]=e.getVelocity()),n}function resolveVariant(e,n,o){let i=e.getProps();return resolveVariantFromProps(i,n,void 0!==o?o:i.custom,getCurrent(e),getVelocity(e))}let eh="data-"+camelToDash("framerAppearId");var em=o(316);let secondsToMilliseconds=e=>1e3*e,millisecondsToSeconds=e=>e/1e3,eg={current:!1},isBezierDefinition=e=>Array.isArray(e)&&"number"==typeof e[0];function isWaapiSupportedEasing(e){return!!(!e||"string"==typeof e&&ev[e]||isBezierDefinition(e)||Array.isArray(e)&&e.every(isWaapiSupportedEasing))}let cubicBezierAsString=([e,n,o,i])=>`cubic-bezier(${e}, ${n}, ${o}, ${i})`,ev={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cubicBezierAsString([0,.65,.55,1]),circOut:cubicBezierAsString([.55,0,1,.45]),backIn:cubicBezierAsString([.31,.01,.66,-.59]),backOut:cubicBezierAsString([.33,1.53,.69,.99])};function mapEasingToNativeEasing(e){if(e)return isBezierDefinition(e)?cubicBezierAsString(e):Array.isArray(e)?e.map(mapEasingToNativeEasing):ev[e]}function animateStyle(e,n,o,{delay:i=0,duration:s,repeat:u=0,repeatType:c="loop",ease:d,times:m}={}){let g={[n]:o};m&&(g.offset=m);let y=mapEasingToNativeEasing(d);return Array.isArray(y)&&(g.easing=y),e.animate(g,{delay:i,duration:s,easing:Array.isArray(y)?"linear":y,fill:"both",iterations:u+1,direction:"reverse"===c?"alternate":"normal"})}function getFinalKeyframe(e,{repeat:n,repeatType:o="loop"}){let i=n&&"loop"!==o&&n%2==1?0:e.length-1;return e[i]}let calcBezier=(e,n,o)=>(((1-3*o+3*n)*e+(3*o-6*n))*e+3*n)*e;function binarySubdivide(e,n,o,i,s){let u,c;let d=0;do(u=calcBezier(c=n+(o-n)/2,i,s)-e)>0?o=c:n=c;while(Math.abs(u)>1e-7&&++d<12);return c}function cubicBezier(e,n,o,i){if(e===n&&o===i)return ec.Z;let getTForX=n=>binarySubdivide(n,0,1,e,o);return e=>0===e||1===e?e:calcBezier(getTForX(e),n,i)}let ey=cubicBezier(.42,0,1,1),eb=cubicBezier(0,0,.58,1),ex=cubicBezier(.42,0,.58,1),isEasingArray=e=>Array.isArray(e)&&"number"!=typeof e[0],mirrorEasing=e=>n=>n<=.5?e(2*n)/2:(2-e(2*(1-n)))/2,reverseEasing=e=>n=>1-e(1-n),circIn=e=>1-Math.sin(Math.acos(e)),ew=reverseEasing(circIn),eS=mirrorEasing(ew),e_=cubicBezier(.33,1.53,.69,.99),eC=reverseEasing(e_),ek=mirrorEasing(eC),eE={linear:ec.Z,easeIn:ey,easeInOut:ex,easeOut:eb,circIn:circIn,circInOut:eS,circOut:ew,backIn:eC,backInOut:ek,backOut:e_,anticipate:e=>(e*=2)<1?.5*eC(e):.5*(2-Math.pow(2,-10*(e-1)))},easingDefinitionToFunction=e=>{if(Array.isArray(e)){(0,em.k)(4===e.length,"Cubic bezier arrays must contain four numerical values.");let[n,o,i,s]=e;return cubicBezier(n,o,i,s)}return"string"==typeof e?((0,em.k)(void 0!==eE[e],`Invalid easing type '${e}'`),eE[e]):e},isColorString=(e,n)=>o=>!!(isString(o)&&U.test(o)&&o.startsWith(e)||n&&Object.prototype.hasOwnProperty.call(o,n)),splitColor=(e,n,o)=>i=>{if(!isString(i))return i;let[s,u,c,d]=i.match(V);return{[e]:parseFloat(s),[n]:parseFloat(u),[o]:parseFloat(c),alpha:void 0!==d?parseFloat(d):1}},clampRgbUnit=e=>clamp(0,255,e),eT={...F,transform:e=>Math.round(clampRgbUnit(e))},eP={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:e,green:n,blue:o,alpha:i=1})=>"rgba("+eT.transform(e)+", "+eT.transform(n)+", "+eT.transform(o)+", "+sanitize(L.transform(i))+")"};function parseHex(e){let n="",o="",i="",s="";return e.length>5?(n=e.substring(1,3),o=e.substring(3,5),i=e.substring(5,7),s=e.substring(7,9)):(n=e.substring(1,2),o=e.substring(2,3),i=e.substring(3,4),s=e.substring(4,5),n+=n,o+=o,i+=i,s+=s),{red:parseInt(n,16),green:parseInt(o,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}}let eO={test:isColorString("#"),parse:parseHex,transform:eP.transform},eA={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:e,saturation:n,lightness:o,alpha:i=1})=>"hsla("+Math.round(e)+", "+H.transform(sanitize(n))+", "+H.transform(sanitize(o))+", "+sanitize(L.transform(i))+")"},eR={test:e=>eP.test(e)||eO.test(e)||eA.test(e),parse:e=>eP.test(e)?eP.parse(e):eA.test(e)?eA.parse(e):eO.parse(e),transform:e=>isString(e)?e:e.hasOwnProperty("red")?eP.transform(e):eA.transform(e)},mix=(e,n,o)=>-o*e+o*n+e;function hueToRgb(e,n,o){return(o<0&&(o+=1),o>1&&(o-=1),o<1/6)?e+(n-e)*6*o:o<.5?n:o<2/3?e+(n-e)*(2/3-o)*6:e}function hslaToRgba({hue:e,saturation:n,lightness:o,alpha:i}){e/=360,o/=100;let s=0,u=0,c=0;if(n/=100){let i=o<.5?o*(1+n):o+n-o*n,d=2*o-i;s=hueToRgb(d,i,e+1/3),u=hueToRgb(d,i,e),c=hueToRgb(d,i,e-1/3)}else s=u=c=o;return{red:Math.round(255*s),green:Math.round(255*u),blue:Math.round(255*c),alpha:i}}let mixLinearColor=(e,n,o)=>{let i=e*e;return Math.sqrt(Math.max(0,o*(n*n-i)+i))},eI=[eO,eP,eA],getColorType=e=>eI.find(n=>n.test(e));function asRGBA(e){let n=getColorType(e);(0,em.k)(!!n,`'${e}' is not an animatable color. Use the equivalent color code instead.`);let o=n.parse(e);return n===eA&&(o=hslaToRgba(o)),o}let mixColor=(e,n)=>{let o=asRGBA(e),i=asRGBA(n),s={...o};return e=>(s.red=mixLinearColor(o.red,i.red,e),s.green=mixLinearColor(o.green,i.green,e),s.blue=mixLinearColor(o.blue,i.blue,e),s.alpha=mix(o.alpha,i.alpha,e),eP.transform(s))};function test(e){var n,o;return isNaN(e)&&isString(e)&&((null===(n=e.match(V))||void 0===n?void 0:n.length)||0)+((null===(o=e.match(W))||void 0===o?void 0:o.length)||0)>0}let eM={regex:/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,countKey:"Vars",token:"${v}",parse:ec.Z},ej={regex:W,countKey:"Colors",token:"${c}",parse:eR.parse},eD={regex:V,countKey:"Numbers",token:"${n}",parse:F.parse};function tokenise(e,{regex:n,countKey:o,token:i,parse:s}){let u=e.tokenised.match(n);u&&(e["num"+o]=u.length,e.tokenised=e.tokenised.replace(n,i),e.values.push(...u.map(s)))}function analyseComplexValue(e){let n=e.toString(),o={value:n,tokenised:n,values:[],numVars:0,numColors:0,numNumbers:0};return o.value.includes("var(--")&&tokenise(o,eM),tokenise(o,ej),tokenise(o,eD),o}function parseComplexValue(e){return analyseComplexValue(e).values}function createTransformer(e){let{values:n,numColors:o,numVars:i,tokenised:s}=analyseComplexValue(e),u=n.length;return e=>{let n=s;for(let s=0;s"number"==typeof e?0:e;function getAnimatableNone(e){let n=parseComplexValue(e),o=createTransformer(e);return o(n.map(convertNumbersToZero))}let eB={test,parse:parseComplexValue,createTransformer,getAnimatableNone},mixImmediate=(e,n)=>o=>`${o>0?n:e}`;function getMixer(e,n){return"number"==typeof e?o=>mix(e,n,o):eR.test(e)?mixColor(e,n):e.startsWith("var(")?mixImmediate(e,n):mixComplex(e,n)}let mixArray=(e,n)=>{let o=[...e],i=o.length,s=e.map((e,o)=>getMixer(e,n[o]));return e=>{for(let n=0;n{let o={...e,...n},i={};for(let s in o)void 0!==e[s]&&void 0!==n[s]&&(i[s]=getMixer(e[s],n[s]));return e=>{for(let n in i)o[n]=i[n](e);return o}},mixComplex=(e,n)=>{let o=eB.createTransformer(n),i=analyseComplexValue(e),s=analyseComplexValue(n),u=i.numVars===s.numVars&&i.numColors===s.numColors&&i.numNumbers>=s.numNumbers;return u?pipe(mixArray(i.values,s.values),o):((0,em.K)(!0,`Complex values '${e}' and '${n}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),mixImmediate(e,n))},progress=(e,n,o)=>{let i=n-e;return 0===i?1:(o-e)/i},mixNumber=(e,n)=>o=>mix(e,n,o);function detectMixerFactory(e){if("number"==typeof e);else if("string"==typeof e)return eR.test(e)?mixColor:mixComplex;else if(Array.isArray(e))return mixArray;else if("object"==typeof e)return mixObject;return mixNumber}function createMixers(e,n,o){let i=[],s=o||detectMixerFactory(e[0]),u=e.length-1;for(let o=0;on[0];e[0]>e[u-1]&&(e=[...e].reverse(),n=[...n].reverse());let c=createMixers(n,i,s),d=c.length,interpolator=n=>{let o=0;if(d>1)for(;ointerpolator(clamp(e[0],e[u-1],n)):interpolator}function fillOffset(e,n){let o=e[e.length-1];for(let i=1;i<=n;i++){let s=progress(0,n,i);e.push(mix(o,1,s))}}function defaultOffset(e){let n=[0];return fillOffset(n,e.length-1),n}function convertOffsetToTimes(e,n){return e.map(e=>e*n)}function defaultEasing(e,n){return e.map(()=>n||ex).splice(0,e.length-1)}function keyframes({duration:e=300,keyframes:n,times:o,ease:i="easeInOut"}){let s=isEasingArray(i)?i.map(easingDefinitionToFunction):easingDefinitionToFunction(i),u={done:!1,value:n[0]},c=convertOffsetToTimes(o&&o.length===n.length?o:defaultOffset(n),e),d=interpolate(c,n,{ease:Array.isArray(s)?s:defaultEasing(n,s)});return{calculatedDuration:e,next:n=>(u.value=d(n),u.done=n>=e,u)}}function calcGeneratorVelocity(e,n,o){var i,s;let u=Math.max(n-5,0);return i=o-e(u),(s=n-u)?i*(1e3/s):0}function findSpring({duration:e=800,bounce:n=.25,velocity:o=0,mass:i=1}){let s,u;(0,em.K)(e<=secondsToMilliseconds(10),"Spring duration must be 10 seconds or less");let c=1-n;c=clamp(.05,1,c),e=clamp(.01,10,millisecondsToSeconds(e)),c<1?(s=n=>{let i=n*c,s=i*e,u=calcAngularFreq(n,c),d=Math.exp(-s);return .001-(i-o)/u*d},u=n=>{let i=n*c,u=i*e,d=Math.pow(c,2)*Math.pow(n,2)*e,m=Math.exp(-u),g=calcAngularFreq(Math.pow(n,2),c),y=-s(n)+.001>0?-1:1;return y*((u*o+o-d)*m)/g}):(s=n=>{let i=Math.exp(-n*e),s=(n-o)*e+1;return -.001+i*s},u=n=>{let i=Math.exp(-n*e),s=(o-n)*(e*e);return i*s});let d=5/e,m=approximateRoot(s,u,d);if(e=secondsToMilliseconds(e),isNaN(m))return{stiffness:100,damping:10,duration:e};{let n=Math.pow(m,2)*i;return{stiffness:n,damping:2*c*Math.sqrt(i*n),duration:e}}}function approximateRoot(e,n,o){let i=o;for(let o=1;o<12;o++)i-=e(i)/n(i);return i}function calcAngularFreq(e,n){return e*Math.sqrt(1-n*n)}let eF=["duration","bounce"],eL=["stiffness","damping","mass"];function isSpringType(e,n){return n.some(n=>void 0!==e[n])}function getSpringOptions(e){let n={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!isSpringType(e,eL)&&isSpringType(e,eF)){let o=findSpring(e);(n={...n,...o,velocity:0,mass:1}).isResolvedFromDuration=!0}return n}function spring({keyframes:e,restDelta:n,restSpeed:o,...i}){let s;let u=e[0],c=e[e.length-1],d={done:!1,value:u},{stiffness:m,damping:g,mass:y,velocity:b,duration:x,isResolvedFromDuration:w}=getSpringOptions(i),S=b?-millisecondsToSeconds(b):0,_=g/(2*Math.sqrt(m*y)),C=c-u,E=millisecondsToSeconds(Math.sqrt(m/y)),T=5>Math.abs(C);if(o||(o=T?.01:2),n||(n=T?.005:.5),_<1){let e=calcAngularFreq(E,_);s=n=>{let o=Math.exp(-_*E*n);return c-o*((S+_*E*C)/e*Math.sin(e*n)+C*Math.cos(e*n))}}else if(1===_)s=e=>c-Math.exp(-E*e)*(C+(S+E*C)*e);else{let e=E*Math.sqrt(_*_-1);s=n=>{let o=Math.exp(-_*E*n),i=Math.min(e*n,300);return c-o*((S+_*E*C)*Math.sinh(i)+e*C*Math.cosh(i))/e}}return{calculatedDuration:w&&x||null,next:e=>{let i=s(e);if(w)d.done=e>=x;else{let u=S;0!==e&&(u=_<1?calcGeneratorVelocity(s,e,i):0);let m=Math.abs(u)<=o,g=Math.abs(c-i)<=n;d.done=m&&g}return d.value=d.done?c:i,d}}}function inertia({keyframes:e,velocity:n=0,power:o=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:u=500,modifyTarget:c,min:d,max:m,restDelta:g=.5,restSpeed:y}){let b,x;let w=e[0],S={done:!1,value:w},isOutOfBounds=e=>void 0!==d&&em,nearestBoundary=e=>void 0===d?m:void 0===m?d:Math.abs(d-e)-_*Math.exp(-e/i),calcLatest=e=>E+calcDelta(e),applyFriction=e=>{let n=calcDelta(e),o=calcLatest(e);S.done=Math.abs(n)<=g,S.value=S.done?E:o},checkCatchBoundary=e=>{isOutOfBounds(S.value)&&(b=e,x=spring({keyframes:[S.value,nearestBoundary(S.value)],velocity:calcGeneratorVelocity(calcLatest,e,S.value),damping:s,stiffness:u,restDelta:g,restSpeed:y}))};return checkCatchBoundary(0),{calculatedDuration:null,next:e=>{let n=!1;return(x||void 0!==b||(n=!0,applyFriction(e),checkCatchBoundary(e)),void 0!==b&&e>b)?x.next(e-b):(n||applyFriction(e),S)}}}let frameloopDriver=e=>{let passTimestamp=({timestamp:n})=>e(n);return{start:()=>ei.Wi.update(passTimestamp,!0),stop:()=>(0,ei.Pn)(passTimestamp),now:()=>ei.frameData.isProcessing?ei.frameData.timestamp:performance.now()}};function calcGeneratorDuration(e){let n=0,o=e.next(n);for(;!o.done&&n<2e4;)n+=50,o=e.next(n);return n>=2e4?1/0:n}let eN={decay:inertia,inertia:inertia,tween:keyframes,keyframes:keyframes,spring:spring};function animateValue({autoplay:e=!0,delay:n=0,driver:o=frameloopDriver,keyframes:i,type:s="keyframes",repeat:u=0,repeatDelay:c=0,repeatType:d="loop",onPlay:m,onStop:g,onComplete:y,onUpdate:b,...x}){let w,S,_,C,E,T=1,P=!1,updateFinishedPromise=()=>{S=new Promise(e=>{w=e})};updateFinishedPromise();let O=eN[s]||keyframes;O!==keyframes&&"number"!=typeof i[0]&&(C=interpolate([0,100],i,{clamp:!1}),i=[0,100]);let R=O({...x,keyframes:i});"mirror"===d&&(E=O({...x,keyframes:[...i].reverse(),velocity:-(x.velocity||0)}));let M="idle",j=null,B=null,F=null;null===R.calculatedDuration&&u&&(R.calculatedDuration=calcGeneratorDuration(R));let{calculatedDuration:L}=R,N=1/0,V=1/0;null!==L&&(V=(N=L+c)*(u+1)-c);let W=0,tick=e=>{if(null===B)return;T>0&&(B=Math.min(B,e)),T<0&&(B=Math.min(e-V/T,B)),W=null!==j?j:Math.round(e-B)*T;let o=W-n*(T>=0?1:-1),s=T>=0?o<0:o>V;W=Math.max(o,0),"finished"===M&&null===j&&(W=V);let m=W,g=R;if(u){let e=W/N,n=Math.floor(e),o=e%1;!o&&e>=1&&(o=1),1===o&&n--,n=Math.min(n,u+1);let i=!!(n%2);i&&("reverse"===d?(o=1-o,c&&(o-=c/N)):"mirror"===d&&(g=E));let s=clamp(0,1,o);W>V&&(s="reverse"===d&&i?1:0),m=s*N}let y=s?{done:!1,value:i[0]}:g.next(m);C&&(y.value=C(y.value));let{done:x}=y;s||null===L||(x=T>=0?W>=V:W<=0);let w=null===j&&("finished"===M||"running"===M&&x);return b&&b(y.value),w&&finish(),y},stopAnimationDriver=()=>{_&&_.stop(),_=void 0},cancel=()=>{M="idle",stopAnimationDriver(),w(),updateFinishedPromise(),B=F=null},finish=()=>{M="finished",y&&y(),stopAnimationDriver(),w()},play=()=>{if(P)return;_||(_=o(tick));let e=_.now();m&&m(),null!==j?B=e-j:B&&"finished"!==M||(B=e),"finished"===M&&updateFinishedPromise(),F=B,j=null,M="running",_.start()};e&&play();let U={then:(e,n)=>S.then(e,n),get time(){return millisecondsToSeconds(W)},set time(newTime){W=newTime=secondsToMilliseconds(newTime),null===j&&_&&0!==T?B=_.now()-newTime/T:j=newTime},get duration(){let e=null===R.calculatedDuration?calcGeneratorDuration(R):R.calculatedDuration;return millisecondsToSeconds(e)},get speed(){return T},set speed(newSpeed){if(newSpeed===T||!_)return;T=newSpeed,U.time=millisecondsToSeconds(W)},get state(){return M},play,pause:()=>{M="paused",j=W},stop:()=>{P=!0,"idle"!==M&&(M="idle",g&&g(),cancel())},cancel:()=>{null!==F&&tick(F),cancel()},complete:()=>{M="finished"},sample:e=>(B=0,tick(e))};return U}function memo(e){let n;return()=>(void 0===n&&(n=e()),n)}let eV=memo(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ez=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),requiresPregeneratedKeyframes=(e,n)=>"spring"===n.type||"backgroundColor"===e||!isWaapiSupportedEasing(n.ease);function createAcceleratedAnimation(e,n,{onUpdate:o,onComplete:i,...s}){let u,c;let d=eV()&&ez.has(n)&&!s.repeatDelay&&"mirror"!==s.repeatType&&0!==s.damping&&"inertia"!==s.type;if(!d)return!1;let m=!1,updateFinishedPromise=()=>{c=new Promise(e=>{u=e})};updateFinishedPromise();let{keyframes:g,duration:y=300,ease:b,times:x}=s;if(requiresPregeneratedKeyframes(n,s)){let e=animateValue({...s,repeat:0,delay:0}),n={done:!1,value:g[0]},o=[],i=0;for(;!n.done&&i<2e4;)n=e.sample(i),o.push(n.value),i+=10;x=void 0,g=o,y=i-10,b="linear"}let w=animateStyle(e.owner.current,n,g,{...s,duration:y,ease:b,times:x});s.syncStart&&(w.startTime=ei.frameData.isProcessing?ei.frameData.timestamp:document.timeline?document.timeline.currentTime:performance.now());let cancelAnimation=()=>w.cancel(),safeCancel=()=>{ei.Wi.update(cancelAnimation),u(),updateFinishedPromise()};return w.onfinish=()=>{e.set(getFinalKeyframe(g,s)),i&&i(),safeCancel()},{then:(e,n)=>c.then(e,n),attachTimeline:e=>(w.timeline=e,w.onfinish=null,ec.Z),get time(){return millisecondsToSeconds(w.currentTime||0)},set time(newTime){w.currentTime=secondsToMilliseconds(newTime)},get speed(){return w.playbackRate},set speed(newSpeed){w.playbackRate=newSpeed},get duration(){return millisecondsToSeconds(y)},play:()=>{m||(w.play(),(0,ei.Pn)(cancelAnimation))},pause:()=>w.pause(),stop:()=>{if(m=!0,"idle"===w.playState)return;let{currentTime:n}=w;if(n){let o=animateValue({...s,autoplay:!1});e.setWithVelocity(o.sample(n-10).value,o.sample(n).value,10)}safeCancel()},complete:()=>w.finish(),cancel:safeCancel}}function createInstantAnimation({keyframes:e,delay:n,onUpdate:o,onComplete:i}){let setValue=()=>(o&&o(e[e.length-1]),i&&i(),{time:0,speed:1,duration:0,play:ec.Z,pause:ec.Z,stop:ec.Z,then:e=>(e(),Promise.resolve()),cancel:ec.Z,complete:ec.Z});return n?animateValue({keyframes:[0,1],duration:0,delay:n,onComplete:setValue}):setValue()}let eW={type:"spring",stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=e=>({type:"spring",stiffness:550,damping:0===e?2*Math.sqrt(550):30,restSpeed:10}),eU={type:"keyframes",duration:.8},e$={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(e,{keyframes:n})=>n.length>2?eU:O.has(e)?e.startsWith("scale")?criticallyDampedSpring(n[1]):eW:e$,isAnimatable=(e,n)=>"zIndex"!==e&&!!("number"==typeof n||Array.isArray(n)||"string"==typeof n&&(eB.test(n)||"0"===n)&&!n.startsWith("url(")),eH=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(e){let[n,o]=e.slice(0,-1).split("(");if("drop-shadow"===n)return e;let[i]=o.match(V)||[];if(!i)return e;let s=o.replace(i,""),u=eH.has(n)?1:0;return i!==o&&(u*=100),n+"("+u+s+")"}let eG=/([a-z-]*)\(.*?\)/g,eZ={...eB,getAnimatableNone:e=>{let n=e.match(eG);return n?n.map(applyDefaultFilter).join(" "):e}},eK={...J,color:eR,backgroundColor:eR,outlineColor:eR,fill:eR,stroke:eR,borderColor:eR,borderTopColor:eR,borderRightColor:eR,borderBottomColor:eR,borderLeftColor:eR,filter:eZ,WebkitFilter:eZ},getDefaultValueType=e=>eK[e];function animatable_none_getAnimatableNone(e,n){let o=getDefaultValueType(e);return o!==eZ&&(o=eB),o.getAnimatableNone?o.getAnimatableNone(n):void 0}let isZeroValueString=e=>/^0[^.\s]+$/.test(e);function isNone(e){return"number"==typeof e?0===e:null!==e?"none"===e||"0"===e||isZeroValueString(e):void 0}function getKeyframes(e,n,o,i){let s,u;let c=isAnimatable(n,o);s=Array.isArray(o)?[...o]:[null,o];let d=void 0!==i.from?i.from:e.get(),m=[];for(let e=0;es=>{let u=getValueTransition(i,e)||{},c=u.delay||i.delay||0,{elapsed:d=0}=i;d-=secondsToMilliseconds(c);let m=getKeyframes(n,e,o,u),g=m[0],y=m[m.length-1],b=isAnimatable(e,g),x=isAnimatable(e,y);(0,em.K)(b===x,`You are trying to animate ${e} from "${g}" to "${y}". ${g} is not an animatable value - to enable this animation set ${g} to a value animatable to ${y} via the \`style\` property.`);let w={keyframes:m,velocity:n.getVelocity(),ease:"easeOut",...u,delay:-d,onUpdate:e=>{n.set(e),u.onUpdate&&u.onUpdate(e)},onComplete:()=>{s(),u.onComplete&&u.onComplete()}};if(isTransitionDefined(u)||(w={...w,...getDefaultTransition(e,w)}),w.duration&&(w.duration=secondsToMilliseconds(w.duration)),w.repeatDelay&&(w.repeatDelay=secondsToMilliseconds(w.repeatDelay)),!b||!x||eg.current||!1===u.type)return createInstantAnimation(eg.current?{...w,delay:0}:w);if(n.owner&&n.owner.current instanceof HTMLElement&&!n.owner.getProps().onUpdate){let o=createAcceleratedAnimation(n,e,w);if(o)return o}return animateValue(w)};function isWillChangeMotionValue(e){return!!(isMotionValue(e)&&e.add)}let isNumericalString=e=>/^\-?\d*\.?\d+$/.test(e);function addUniqueItem(e,n){-1===e.indexOf(n)&&e.push(n)}function removeItem(e,n){let o=e.indexOf(n);o>-1&&e.splice(o,1)}let SubscriptionManager=class SubscriptionManager{constructor(){this.subscriptions=[]}add(e){return addUniqueItem(this.subscriptions,e),()=>removeItem(this.subscriptions,e)}notify(e,n,o){let i=this.subscriptions.length;if(i){if(1===i)this.subscriptions[0](e,n,o);else for(let s=0;s!isNaN(parseFloat(e)),eY={current:void 0};let MotionValue=class MotionValue{constructor(e,n={}){this.version="10.16.4",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(e,n=!0)=>{this.prev=this.current,this.current=e;let{delta:o,timestamp:i}=ei.frameData;this.lastUpdated!==i&&(this.timeDelta=o,this.lastUpdated=i,ei.Wi.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),n&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>ei.Wi.postRender(this.velocityCheck),this.velocityCheck=({timestamp:e})=>{e!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=isFloat(this.current),this.owner=n.owner}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new SubscriptionManager);let o=this.events[e].add(n);return"change"===e?()=>{o(),ei.Wi.read(()=>{this.events.change.getSize()||this.stop()})}:o}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){n&&this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e,n)}setWithVelocity(e,n,o){this.set(n),this.prev=e,this.timeDelta=o}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return eY.current&&eY.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e,n;return this.canTrackVelocity?(e=parseFloat(this.current)-parseFloat(this.prev),(n=this.timeDelta)?e*(1e3/n):0):0}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function motionValue(e,n){return new MotionValue(e,n)}let testValueType=e=>n=>n.test(e),eX=[F,G,H,$,Y,K,{test:e=>"auto"===e,parse:e=>e}],findDimensionValueType=e=>eX.find(testValueType(e)),eQ=[...eX,eR,eB],findValueType=e=>eQ.find(testValueType(e));function setMotionValue(e,n,o){e.hasValue(n)?e.getValue(n).set(o):e.addValue(n,motionValue(o))}function setTarget(e,n){let o=resolveVariant(e,n),{transitionEnd:i={},transition:s={},...u}=o?e.makeTargetAnimatable(o,!1):{};for(let n in u={...u,...i}){let o=resolveFinalValueInKeyframes(u[n]);setMotionValue(e,n,o)}}function checkTargetForNewValues(e,n,o){var i,s;let u=Object.keys(n).filter(n=>!e.hasValue(n)),c=u.length;if(c)for(let d=0;dm.remove(n))),g.push(b)}return c&&Promise.all(g).then(()=>{c&&setTarget(e,c)}),g}function animateVariant(e,n,o={}){let i=resolveVariant(e,n,o.custom),{transition:s=e.getDefaultTransition()||{}}=i||{};o.transitionOverride&&(s=o.transitionOverride);let u=i?()=>Promise.all(animateTarget(e,i,o)):()=>Promise.resolve(),c=e.variantChildren&&e.variantChildren.size?(i=0)=>{let{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=s;return animateChildren(e,n,u+i,c,d,o)}:()=>Promise.resolve(),{when:d}=s;if(!d)return Promise.all([u(),c(o.delay)]);{let[e,n]="beforeChildren"===d?[u,c]:[c,u];return e().then(()=>n())}}function animateChildren(e,n,o=0,i=0,s=1,u){let c=[],d=(e.variantChildren.size-1)*i,m=1===s?(e=0)=>e*i:(e=0)=>d-e*i;return Array.from(e.variantChildren).sort(sortByTreeOrder).forEach((e,i)=>{e.notify("AnimationStart",n),c.push(animateVariant(e,n,{...u,delay:o+m(i)}).then(()=>e.notify("AnimationComplete",n)))}),Promise.all(c)}function sortByTreeOrder(e,n){return e.sortNodePosition(n)}function animateVisualElement(e,n,o={}){let i;if(e.notify("AnimationStart",n),Array.isArray(n)){let s=n.map(n=>animateVariant(e,n,o));i=Promise.all(s)}else if("string"==typeof n)i=animateVariant(e,n,o);else{let s="function"==typeof n?resolveVariant(e,n,o.custom):n;i=Promise.all(animateTarget(e,s,o))}return i.then(()=>e.notify("AnimationComplete",n))}let eJ=[...g].reverse(),e0=g.length;function animateList(e){return n=>Promise.all(n.map(({animation:n,options:o})=>animateVisualElement(e,n,o)))}function createAnimationState(e){let n=animateList(e),o=createState(),i=!0,buildResolvedTypeValues=(n,o)=>{let i=resolveVariant(e,o);if(i){let{transition:e,transitionEnd:o,...s}=i;n={...n,...s,...o}}return n};function animateChanges(s,u){let c=e.getProps(),d=e.getVariantContext(!0)||{},m=[],g=new Set,y={},b=1/0;for(let n=0;nb&&_,O=Array.isArray(S)?S:[S],R=O.reduce(buildResolvedTypeValues,{});!1===C&&(R={});let{prevResolvedValues:M={}}=w,j={...M,...R},markToAnimate=e=>{P=!0,g.delete(e),w.needsAnimating[e]=!0};for(let e in j){let n=R[e],o=M[e];y.hasOwnProperty(e)||(n!==o?isKeyframesTarget(n)&&isKeyframesTarget(o)?!shallowCompare(n,o)||T?markToAnimate(e):w.protectedKeys[e]=!0:void 0!==n?markToAnimate(e):g.add(e):void 0!==n&&g.has(e)?markToAnimate(e):w.protectedKeys[e]=!0)}w.prevProp=S,w.prevResolvedValues=R,w.isActive&&(y={...y,...R}),i&&e.blockInitialAnimation&&(P=!1),P&&!E&&m.push(...O.map(e=>({animation:e,options:{type:x,...s}})))}if(g.size){let n={};g.forEach(o=>{let i=e.getBaseTarget(o);void 0!==i&&(n[o]=i)}),m.push({animation:n})}let x=!!m.length;return i&&!1===c.initial&&!e.manuallyAnimateOnMount&&(x=!1),i=!1,x?n(m):Promise.resolve()}function setActive(n,i,s){var u;if(o[n].isActive===i)return Promise.resolve();null===(u=e.variantChildren)||void 0===u||u.forEach(e=>{var o;return null===(o=e.animationState)||void 0===o?void 0:o.setActive(n,i)}),o[n].isActive=i;let c=animateChanges(s,n);for(let e in o)o[e].protectedKeys={};return c}return{animateChanges,setActive,setAnimateFunction:function(o){n=o(e)},getState:()=>o}}function checkVariantsDidChange(e,n){return"string"==typeof n?n!==e:!!Array.isArray(n)&&!shallowCompare(n,e)}function createTypeState(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function createState(){return{animate:createTypeState(!0),whileInView:createTypeState(),whileHover:createTypeState(),whileTap:createTypeState(),whileDrag:createTypeState(),whileFocus:createTypeState(),exit:createTypeState()}}let AnimationFeature=class AnimationFeature extends Feature{constructor(e){super(e),e.animationState||(e.animationState=createAnimationState(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();this.unmount(),isAnimationControls(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){}};let e1=0;let ExitAnimationFeature=class ExitAnimationFeature extends Feature{constructor(){super(...arguments),this.id=e1++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:n,custom:o}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;let s=this.node.animationState.setActive("exit",!e,{custom:null!=o?o:this.node.getProps().custom});n&&!e&&s.then(()=>n(this.id))}mount(){let{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}};let distance=(e,n)=>Math.abs(e-n);function distance2D(e,n){let o=distance(e.x,n.x),i=distance(e.y,n.y);return Math.sqrt(o**2+i**2)}let PanSession=class PanSession{constructor(e,n,{transformPagePoint:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let e=getPanInfo(this.lastMoveEventInfo,this.history),n=null!==this.startEvent,o=distance2D(e.offset,{x:0,y:0})>=3;if(!n&&!o)return;let{point:i}=e,{timestamp:s}=ei.frameData;this.history.push({...i,timestamp:s});let{onStart:u,onMove:c}=this.handlers;n||(u&&u(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),c&&c(this.lastMoveEvent,e)},this.handlePointerMove=(e,n)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=transformPoint(n,this.transformPagePoint),ei.Wi.update(this.updatePoint,!0)},this.handlePointerUp=(e,n)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let{onEnd:o,onSessionEnd:i}=this.handlers,s=getPanInfo("pointercancel"===e.type?this.lastMoveEventInfo:transformPoint(n,this.transformPagePoint),this.history);this.startEvent&&o&&o(e,s),i&&i(e,s)},!isPrimaryPointer(e))return;this.handlers=n,this.transformPagePoint=o;let i=extractEventInfo(e),s=transformPoint(i,this.transformPagePoint),{point:u}=s,{timestamp:c}=ei.frameData;this.history=[{...u,timestamp:c}];let{onSessionStart:d}=n;d&&d(e,getPanInfo(s,this.history)),this.removeListeners=pipe(addPointerEvent(window,"pointermove",this.handlePointerMove),addPointerEvent(window,"pointerup",this.handlePointerUp),addPointerEvent(window,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),(0,ei.Pn)(this.updatePoint)}};function transformPoint(e,n){return n?{point:n(e.point)}:e}function subtractPoint(e,n){return{x:e.x-n.x,y:e.y-n.y}}function getPanInfo({point:e},n){return{point:e,delta:subtractPoint(e,lastDevicePoint(n)),offset:subtractPoint(e,startDevicePoint(n)),velocity:PanSession_getVelocity(n,.1)}}function startDevicePoint(e){return e[0]}function lastDevicePoint(e){return e[e.length-1]}function PanSession_getVelocity(e,n){if(e.length<2)return{x:0,y:0};let o=e.length-1,i=null,s=lastDevicePoint(e);for(;o>=0&&(i=e[o],!(s.timestamp-i.timestamp>secondsToMilliseconds(n)));)o--;if(!i)return{x:0,y:0};let u=millisecondsToSeconds(s.timestamp-i.timestamp);if(0===u)return{x:0,y:0};let c={x:(s.x-i.x)/u,y:(s.y-i.y)/u};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function calcLength(e){return e.max-e.min}function isNear(e,n=0,o=.01){return Math.abs(e-n)<=o}function calcAxisDelta(e,n,o,i=.5){e.origin=i,e.originPoint=mix(n.min,n.max,e.origin),e.scale=calcLength(o)/calcLength(n),(isNear(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=mix(o.min,o.max,e.origin)-e.originPoint,(isNear(e.translate)||isNaN(e.translate))&&(e.translate=0)}function calcBoxDelta(e,n,o,i){calcAxisDelta(e.x,n.x,o.x,i?i.originX:void 0),calcAxisDelta(e.y,n.y,o.y,i?i.originY:void 0)}function calcRelativeAxis(e,n,o){e.min=o.min+n.min,e.max=e.min+calcLength(n)}function calcRelativeBox(e,n,o){calcRelativeAxis(e.x,n.x,o.x),calcRelativeAxis(e.y,n.y,o.y)}function calcRelativeAxisPosition(e,n,o){e.min=n.min-o.min,e.max=e.min+calcLength(n)}function calcRelativePosition(e,n,o){calcRelativeAxisPosition(e.x,n.x,o.x),calcRelativeAxisPosition(e.y,n.y,o.y)}function applyConstraints(e,{min:n,max:o},i){return void 0!==n&&eo&&(e=i?mix(o,e,i.max):Math.min(e,o)),e}function calcRelativeAxisConstraints(e,n,o){return{min:void 0!==n?e.min+n:void 0,max:void 0!==o?e.max+o-(e.max-e.min):void 0}}function calcRelativeConstraints(e,{top:n,left:o,bottom:i,right:s}){return{x:calcRelativeAxisConstraints(e.x,o,s),y:calcRelativeAxisConstraints(e.y,n,i)}}function calcViewportAxisConstraints(e,n){let o=n.min-e.min,i=n.max-e.max;return n.max-n.mini?o=progress(n.min,n.max-i,e.min):i>s&&(o=progress(e.min,e.max-s,n.min)),clamp(0,1,o)}function rebaseAxisConstraints(e,n){let o={};return void 0!==n.min&&(o.min=n.min-e.min),void 0!==n.max&&(o.max=n.max-e.min),o}function resolveDragElastic(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:resolveAxisElastic(e,"left","right"),y:resolveAxisElastic(e,"top","bottom")}}function resolveAxisElastic(e,n,o){return{min:resolvePointElastic(e,n),max:resolvePointElastic(e,o)}}function resolvePointElastic(e,n){return"number"==typeof e?e:e[n]||0}let createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()});function eachAxis(e){return[e("x"),e("y")]}function convertBoundingBoxToBox({top:e,left:n,right:o,bottom:i}){return{x:{min:n,max:o},y:{min:e,max:i}}}function convertBoxToBoundingBox({x:e,y:n}){return{top:n.min,right:e.max,bottom:n.max,left:e.min}}function transformBoxPoints(e,n){if(!n)return e;let o=n({x:e.left,y:e.top}),i=n({x:e.right,y:e.bottom});return{top:o.y,left:o.x,bottom:i.y,right:i.x}}function isIdentityScale(e){return void 0===e||1===e}function hasScale({scale:e,scaleX:n,scaleY:o}){return!isIdentityScale(e)||!isIdentityScale(n)||!isIdentityScale(o)}function hasTransform(e){return hasScale(e)||has2DTranslate(e)||e.z||e.rotate||e.rotateX||e.rotateY}function has2DTranslate(e){var n,o;return(n=e.x)&&"0%"!==n||(o=e.y)&&"0%"!==o}function applyPointDelta(e,n,o,i,s){return void 0!==s&&(e=i+s*(e-i)),i+o*(e-i)+n}function applyAxisDelta(e,n=0,o=1,i,s){e.min=applyPointDelta(e.min,n,o,i,s),e.max=applyPointDelta(e.max,n,o,i,s)}function applyBoxDelta(e,{x:n,y:o}){applyAxisDelta(e.x,n.translate,n.scale,n.originPoint),applyAxisDelta(e.y,o.translate,o.scale,o.originPoint)}function applyTreeDeltas(e,n,o,i=!1){let s,u;let c=o.length;if(c){n.x=n.y=1;for(let d=0;d1.0000000000001||e<.999999999999?e:1}function translateAxis(e,n){e.min=e.min+n,e.max=e.max+n}function transformAxis(e,n,[o,i,s]){let u=void 0!==n[s]?n[s]:.5,c=mix(e.min,e.max,u);applyAxisDelta(e,n[o],n[i],c,n.scale)}let e2=["x","scaleX","originX"],e5=["y","scaleY","originY"];function transformBox(e,n){transformAxis(e.x,n,e2),transformAxis(e.y,n,e5)}function measureViewportBox(e,n){return convertBoundingBoxToBox(transformBoxPoints(e.getBoundingClientRect(),n))}function measurePageBox(e,n,o){let i=measureViewportBox(e,o),{scroll:s}=n;return s&&(translateAxis(i.x,s.offset.x),translateAxis(i.y,s.offset.y)),i}let e4=new WeakMap;let VisualElementDragControls=class VisualElementDragControls{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=createBox(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){let{presenceContext:o}=this.visualElement;o&&!1===o.isPresent||(this.panSession=new PanSession(e,{onSessionStart:e=>{this.stopAnimation(),n&&this.snapToCursor(extractEventInfo(e,"page").point)},onStart:(e,n)=>{let{drag:o,dragPropagation:i,onDragStart:s}=this.getProps();if(o&&!i&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=getGlobalLock(o),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(e=>{let n=this.getAxisMotionValue(e).get()||0;if(H.test(n)){let{projection:o}=this.visualElement;if(o&&o.layout){let i=o.layout.layoutBox[e];if(i){let e=calcLength(i);n=e*(parseFloat(n)/100)}}}this.originPoint[e]=n}),s&&ei.Wi.update(()=>s(e,n),!1,!0);let{animationState:u}=this.visualElement;u&&u.setActive("whileDrag",!0)},onMove:(e,n)=>{let{dragPropagation:o,dragDirectionLock:i,onDirectionLock:s,onDrag:u}=this.getProps();if(!o&&!this.openGlobalLock)return;let{offset:c}=n;if(i&&null===this.currentDirection){this.currentDirection=getCurrentDirection(c),null!==this.currentDirection&&s&&s(this.currentDirection);return}this.updateAxis("x",n.point,c),this.updateAxis("y",n.point,c),this.visualElement.render(),u&&u(e,n)},onSessionEnd:(e,n)=>this.stop(e,n)},{transformPagePoint:this.visualElement.getTransformPagePoint()}))}stop(e,n){let o=this.isDragging;if(this.cancel(),!o)return;let{velocity:i}=n;this.startAnimation(i);let{onDragEnd:s}=this.getProps();s&&ei.Wi.update(()=>s(e,n))}cancel(){this.isDragging=!1;let{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:o}=this.getProps();!o&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,o){let{drag:i}=this.getProps();if(!o||!shouldDrag(e,i,this.currentDirection))return;let s=this.getAxisMotionValue(e),u=this.originPoint[e]+o[e];this.constraints&&this.constraints[e]&&(u=applyConstraints(u,this.constraints[e],this.elastic[e])),s.set(u)}resolveConstraints(){let{dragConstraints:e,dragElastic:n}=this.getProps(),{layout:o}=this.visualElement.projection||{},i=this.constraints;e&&isRefObject(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&o?this.constraints=calcRelativeConstraints(o.layoutBox,e):this.constraints=!1,this.elastic=resolveDragElastic(n),i!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(e=>{this.getAxisMotionValue(e)&&(this.constraints[e]=rebaseAxisConstraints(o.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!isRefObject(e))return!1;let o=e.current;(0,em.k)(null!==o,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");let{projection:i}=this.visualElement;if(!i||!i.layout)return!1;let s=measurePageBox(o,i.root,this.visualElement.getTransformPagePoint()),u=calcViewportConstraints(i.layout.layoutBox,s);if(n){let e=n(convertBoxToBoundingBox(u));this.hasMutatedConstraints=!!e,e&&(u=convertBoundingBoxToBox(e))}return u}startAnimation(e){let{drag:n,dragMomentum:o,dragElastic:i,dragTransition:s,dragSnapToOrigin:u,onDragTransitionEnd:c}=this.getProps(),d=this.constraints||{},m=eachAxis(c=>{if(!shouldDrag(c,n,this.currentDirection))return;let m=d&&d[c]||{};u&&(m={min:0,max:0});let g={type:"inertia",velocity:o?e[c]:0,bounceStiffness:i?200:1e6,bounceDamping:i?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...s,...m};return this.startAxisValueAnimation(c,g)});return Promise.all(m).then(c)}startAxisValueAnimation(e,n){let o=this.getAxisMotionValue(e);return o.start(animateMotionValue(e,o,0,n))}stopAnimation(){eachAxis(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let n="_drag"+e.toUpperCase(),o=this.visualElement.getProps(),i=o[n];return i||this.visualElement.getValue(e,(o.initial?o.initial[e]:void 0)||0)}snapToCursor(e){eachAxis(n=>{let{drag:o}=this.getProps();if(!shouldDrag(n,o,this.currentDirection))return;let{projection:i}=this.visualElement,s=this.getAxisMotionValue(n);if(i&&i.layout){let{min:o,max:u}=i.layout.layoutBox[n];s.set(e[n]-mix(o,u,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:n}=this.getProps(),{projection:o}=this.visualElement;if(!isRefObject(n)||!o||!this.constraints)return;this.stopAnimation();let i={x:0,y:0};eachAxis(e=>{let n=this.getAxisMotionValue(e);if(n){let o=n.get();i[e]=constraints_calcOrigin({min:o,max:o},this.constraints[e])}});let{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",o.root&&o.root.updateScroll(),o.updateLayout(),this.resolveConstraints(),eachAxis(n=>{if(!shouldDrag(n,e,null))return;let o=this.getAxisMotionValue(n),{min:s,max:u}=this.constraints[n];o.set(mix(s,u,i[n]))})}addListeners(){if(!this.visualElement.current)return;e4.set(this.visualElement,this);let e=this.visualElement.current,n=addPointerEvent(e,"pointerdown",e=>{let{drag:n,dragListener:o=!0}=this.getProps();n&&o&&this.start(e)}),measureDragConstraints=()=>{let{dragConstraints:e}=this.getProps();isRefObject(e)&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,i=o.addEventListener("measure",measureDragConstraints);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),measureDragConstraints();let s=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),u=o.addEventListener("didUpdate",({delta:e,hasLayoutChanged:n})=>{this.isDragging&&n&&(eachAxis(n=>{let o=this.getAxisMotionValue(n);o&&(this.originPoint[n]+=e[n].translate,o.set(o.get()+e[n].translate))}),this.visualElement.render())});return()=>{s(),n(),i(),u&&u()}}getProps(){let e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:o=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:u=.35,dragMomentum:c=!0}=e;return{...e,drag:n,dragDirectionLock:o,dragPropagation:i,dragConstraints:s,dragElastic:u,dragMomentum:c}}};function shouldDrag(e,n,o){return(!0===n||n===e)&&(null===o||o===e)}function getCurrentDirection(e,n=10){let o=null;return Math.abs(e.y)>n?o="y":Math.abs(e.x)>n&&(o="x"),o}let DragGesture=class DragGesture extends Feature{constructor(e){super(e),this.removeGroupControls=ec.Z,this.removeListeners=ec.Z,this.controls=new VisualElementDragControls(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ec.Z}unmount(){this.removeGroupControls(),this.removeListeners()}};let asyncHandler=e=>(n,o)=>{e&&ei.Wi.update(()=>e(n,o))};let PanGesture=class PanGesture extends Feature{constructor(){super(...arguments),this.removePointerDownListener=ec.Z}onPointerDown(e){this.session=new PanSession(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:n,onPan:o,onPanEnd:i}=this.node.getProps();return{onSessionStart:asyncHandler(e),onStart:asyncHandler(n),onMove:o,onEnd:(e,n)=>{delete this.session,i&&ei.Wi.update(()=>i(e,n))}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}};var e3=o(27038);let e6={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pixelsToPercent(e,n){return n.max===n.min?0:e/(n.max-n.min)*100}let e7={correct:(e,n)=>{if(!n.target)return e;if("string"==typeof e){if(!G.test(e))return e;e=parseFloat(e)}let o=pixelsToPercent(e,n.target.x),i=pixelsToPercent(e,n.target.y);return`${o}% ${i}%`}};let MeasureLayoutWithContext=class MeasureLayoutWithContext extends i.Component{componentDidMount(){let{visualElement:e,layoutGroup:n,switchLayoutGroup:o,layoutId:i}=this.props,{projection:s}=e;addScaleCorrector(e8),s&&(n.group&&n.group.add(s),o&&o.register&&i&&o.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),e6.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:n,visualElement:o,drag:i,isPresent:s}=this.props,u=o.projection;return u&&(u.isPresent=s,i||e.layoutDependency!==n||void 0===n?u.willUpdate():this.safeToRemove(),e.isPresent===s||(s?u.promote():u.relegate()||ei.Wi.postRender(()=>{let e=u.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),queueMicrotask(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:n,switchLayoutGroup:o}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),o&&o.deregister&&o.deregister(i))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function MeasureLayout(e){let[n,o]=(0,e3.oO)(),s=(0,i.useContext)(S.p);return i.createElement(MeasureLayoutWithContext,{...e,layoutGroup:s,switchLayoutGroup:(0,i.useContext)(_),isPresent:n,safeToRemove:o})}let e8={borderRadius:{...e7,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:e7,borderTopRightRadius:e7,borderBottomLeftRadius:e7,borderBottomRightRadius:e7,boxShadow:{correct:(e,{treeScale:n,projectionDelta:o})=>{let i=eB.parse(e);if(i.length>5)return e;let s=eB.createTransformer(e),u="number"!=typeof i[0]?1:0,c=o.x.scale*n.x,d=o.y.scale*n.y;i[0+u]/=c,i[1+u]/=d;let m=mix(c,d,.5);return"number"==typeof i[2+u]&&(i[2+u]/=m),"number"==typeof i[3+u]&&(i[3+u]/=m),s(i)}}},e9=["TopLeft","TopRight","BottomLeft","BottomRight"],tt=e9.length,asNumber=e=>"string"==typeof e?parseFloat(e):e,isPx=e=>"number"==typeof e||G.test(e);function mixValues(e,n,o,i,s,u){s?(e.opacity=mix(0,void 0!==o.opacity?o.opacity:1,tr(i)),e.opacityExit=mix(void 0!==n.opacity?n.opacity:1,0,tn(i))):u&&(e.opacity=mix(void 0!==n.opacity?n.opacity:1,void 0!==o.opacity?o.opacity:1,i));for(let s=0;sin?1:o(progress(e,n,i))}function copyAxisInto(e,n){e.min=n.min,e.max=n.max}function copyBoxInto(e,n){copyAxisInto(e.x,n.x),copyAxisInto(e.y,n.y)}function removePointDelta(e,n,o,i,s){return e-=n,e=i+1/o*(e-i),void 0!==s&&(e=i+1/s*(e-i)),e}function removeAxisDelta(e,n=0,o=1,i=.5,s,u=e,c=e){if(H.test(n)){n=parseFloat(n);let e=mix(c.min,c.max,n/100);n=e-c.min}if("number"!=typeof n)return;let d=mix(u.min,u.max,i);e===u&&(d-=n),e.min=removePointDelta(e.min,n,o,d,s),e.max=removePointDelta(e.max,n,o,d,s)}function removeAxisTransforms(e,n,[o,i,s],u,c){removeAxisDelta(e,n[o],n[i],n[s],n.scale,u,c)}let ti=["x","scaleX","originX"],ta=["y","scaleY","originY"];function removeBoxTransforms(e,n,o,i){removeAxisTransforms(e.x,n,ti,o?o.x:void 0,i?i.x:void 0),removeAxisTransforms(e.y,n,ta,o?o.y:void 0,i?i.y:void 0)}function isAxisDeltaZero(e){return 0===e.translate&&1===e.scale}function isDeltaZero(e){return isAxisDeltaZero(e.x)&&isAxisDeltaZero(e.y)}function boxEquals(e,n){return e.x.min===n.x.min&&e.x.max===n.x.max&&e.y.min===n.y.min&&e.y.max===n.y.max}function boxEqualsRounded(e,n){return Math.round(e.x.min)===Math.round(n.x.min)&&Math.round(e.x.max)===Math.round(n.x.max)&&Math.round(e.y.min)===Math.round(n.y.min)&&Math.round(e.y.max)===Math.round(n.y.max)}function aspectRatio(e){return calcLength(e.x)/calcLength(e.y)}let NodeStack=class NodeStack{constructor(){this.members=[]}add(e){addUniqueItem(this.members,e),e.scheduleRender()}remove(e){if(removeItem(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let n;let o=this.members.findIndex(n=>e===n);if(0===o)return!1;for(let e=o;e>=0;e--){let o=this.members[e];if(!1!==o.isPresent){n=o;break}}return!!n&&(this.promote(n),!0)}promote(e,n){let o=this.lead;if(e!==o&&(this.prevLead=o,this.lead=e,e.show(),o)){o.instance&&o.scheduleRender(),e.scheduleRender(),e.resumeFrom=o,n&&(e.resumeFrom.preserveOpacity=!0),o.snapshot&&(e.snapshot=o.snapshot,e.snapshot.latestValues=o.animationValues||o.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);let{crossfade:i}=e.options;!1===i&&o.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:n,resumingFrom:o}=e;n.onExitComplete&&n.onExitComplete(),o&&o.options.onExitComplete&&o.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}};function buildProjectionTransform(e,n,o){let i="",s=e.x.translate/n.x,u=e.y.translate/n.y;if((s||u)&&(i=`translate3d(${s}px, ${u}px, 0) `),(1!==n.x||1!==n.y)&&(i+=`scale(${1/n.x}, ${1/n.y}) `),o){let{rotate:e,rotateX:n,rotateY:s}=o;e&&(i+=`rotate(${e}deg) `),n&&(i+=`rotateX(${n}deg) `),s&&(i+=`rotateY(${s}deg) `)}let c=e.x.scale*n.x,d=e.y.scale*n.y;return(1!==c||1!==d)&&(i+=`scale(${c}, ${d})`),i||"none"}let compareByDepth=(e,n)=>e.depth-n.depth;let FlatTree=class FlatTree{constructor(){this.children=[],this.isDirty=!1}add(e){addUniqueItem(this.children,e),this.isDirty=!0}remove(e){removeItem(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(e)}};function delay(e,n){let o=performance.now(),checkElapsed=({timestamp:i})=>{let s=i-o;s>=n&&((0,ei.Pn)(checkElapsed),e(s-n))};return ei.Wi.read(checkElapsed,!0),()=>(0,ei.Pn)(checkElapsed)}function record(e){window.MotionDebug&&window.MotionDebug.record(e)}function isSVGElement(e){return e instanceof SVGElement&&"svg"!==e.tagName}function animateSingleValue(e,n,o){let i=isMotionValue(e)?e:motionValue(e);return i.start(animateMotionValue("",i,n,o)),i.animation}let ts=["","X","Y","Z"],tl=0,tu={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function createProjectionNode({attachResizeListener:e,defaultParent:n,measureScroll:o,checkIsScrollRoot:i,resetTransform:s}){return class{constructor(e={},o=null==n?void 0:n()){this.id=tl++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{tu.totalNodes=tu.resolvedTargetDeltas=tu.recalculatedProjection=0,this.nodes.forEach(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes),record(tu)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let e=0;ethis.root.updateBlockedByResize=!1;e(n,()=>{this.root.updateBlockedByResize=!0,o&&o(),o=delay(resizeUnblockUpdate,250),e6.hasAnimatedSinceResize&&(e6.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation))})}i&&this.root.registerSharedNode(i,this),!1!==this.options.animate&&u&&(i||s)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:n,hasRelativeTargetChanged:o,layout:i})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let s=this.options.transition||u.getDefaultTransition()||tc,{onLayoutAnimationStart:c,onLayoutAnimationComplete:d}=u.getProps(),m=!this.targetLayout||!boxEqualsRounded(this.targetLayout,i)||o,g=!n&&o;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||n&&(m||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(e,g);let n={...getValueTransition(s,"layout"),onPlay:c,onComplete:d};(u.shouldReduceMotion||this.options.layoutRoot)&&(n.delay=0,n.type=!1),this.startAnimation(n)}else n||finishAnimation(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=i})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,(0,ei.Pn)(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(resetRotation),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;ethis.update()))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){ei.Wi.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){ei.Wi.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e{let i=n/1e3;mixAxisDelta(c.x,e.x,i),mixAxisDelta(c.y,e.y,i),this.setTargetDelta(c),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,d,i),o&&boxEquals(this.relativeTarget,o)&&(this.isProjectionDirty=!1),o||(o=createBox()),copyBoxInto(o,this.relativeTarget)),y&&(this.animationValues=u,mixValues(u,s,this.latestValues,i,w,x)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&((0,ei.Pn)(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ei.Wi.update(()=>{e6.hasAnimatedSinceResize=!0,this.currentAnimation=animateSingleValue(0,1e3,{...e,onUpdate:n=>{this.mixTargetDelta(n),e.onUpdate&&e.onUpdate(n)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:n,target:o,layout:i,latestValues:s}=e;if(n&&o&&i){if(this!==e&&this.layout&&i&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,i.layoutBox)){o=this.target||createBox();let n=calcLength(this.layout.layoutBox.x);o.x.min=e.target.x.min,o.x.max=o.x.min+n;let i=calcLength(this.layout.layoutBox.y);o.y.min=e.target.y.min,o.y.max=o.y.min+i}copyBoxInto(n,o),transformBox(n,s),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,n,s)}}registerSharedNode(e,n){this.sharedNodes.has(e)||this.sharedNodes.set(e,new NodeStack);let o=this.sharedNodes.get(e);o.add(n);let i=n.options.initialPromotionConfig;n.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(n):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){var e;let{layoutId:n}=this.options;return n&&(null===(e=this.getStack())||void 0===e?void 0:e.lead)||this}getPrevLead(){var e;let{layoutId:n}=this.options;return n?null===(e=this.getStack())||void 0===e?void 0:e.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:n,preserveFollowOpacity:o}={}){let i=this.getStack();i&&i.promote(this,o),e&&(this.projectionDelta=void 0,this.needsReset=!0),n&&this.setOptions({transition:n})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetRotation(){let{visualElement:e}=this.options;if(!e)return;let n=!1,{latestValues:o}=e;if((o.rotate||o.rotateX||o.rotateY||o.rotateZ)&&(n=!0),!n)return;let i={};for(let n=0;n{var n;return null===(n=e.currentAnimation)||void 0===n?void 0:n.stop()}),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}function updateLayout(e){e.updateLayout()}function notifyLayoutUpdate(e){var n;let o=(null===(n=e.resumeFrom)||void 0===n?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&o&&e.hasListeners("didUpdate")){let{layoutBox:n,measuredBox:i}=e.layout,{animationType:s}=e.options,u=o.source!==e.layout.source;"size"===s?eachAxis(e=>{let i=u?o.measuredBox[e]:o.layoutBox[e],s=calcLength(i);i.min=n[e].min,i.max=i.min+s}):shouldAnimatePositionOnly(s,o.layoutBox,n)&&eachAxis(i=>{let s=u?o.measuredBox[i]:o.layoutBox[i],c=calcLength(n[i]);s.max=s.min+c,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[i].max=e.relativeTarget[i].min+c)});let c=createDelta();calcBoxDelta(c,n,o.layoutBox);let d=createDelta();u?calcBoxDelta(d,e.applyTransform(i,!0),o.measuredBox):calcBoxDelta(d,n,o.layoutBox);let m=!isDeltaZero(c),g=!1;if(!e.resumeFrom){let i=e.getClosestProjectingParent();if(i&&!i.resumeFrom){let{snapshot:s,layout:u}=i;if(s&&u){let c=createBox();calcRelativePosition(c,o.layoutBox,s.layoutBox);let d=createBox();calcRelativePosition(d,n,u.layoutBox),boxEqualsRounded(c,d)||(g=!0),i.options.layoutRoot&&(e.relativeTarget=d,e.relativeTargetOrigin=c,e.relativeParent=i)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:o,delta:d,layoutDelta:c,hasLayoutChanged:m,hasRelativeTargetChanged:g})}else if(e.isLead()){let{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function propagateDirtyNodes(e){tu.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function cleanDirtyNodes(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function clearSnapshot(e){e.clearSnapshot()}function clearMeasurements(e){e.clearMeasurements()}function clearIsLayoutDirty(e){e.isLayoutDirty=!1}function resetTransformStyle(e){let{visualElement:n}=e.options;n&&n.getProps().onBeforeLayoutMeasure&&n.notify("BeforeLayoutMeasure"),e.resetTransform()}function finishAnimation(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function resolveTargetDelta(e){e.resolveTargetDelta()}function calcProjection(e){e.calcProjection()}function resetRotation(e){e.resetRotation()}function removeLeadSnapshots(e){e.removeLeadSnapshot()}function mixAxisDelta(e,n,o){e.translate=mix(n.translate,0,o),e.scale=mix(n.scale,1,o),e.origin=n.origin,e.originPoint=n.originPoint}function mixAxis(e,n,o,i){e.min=mix(n.min,o.min,i),e.max=mix(n.max,o.max,i)}function mixBox(e,n,o,i){mixAxis(e.x,n.x,o.x,i),mixAxis(e.y,n.y,o.y,i)}function hasOpacityCrossfade(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let tc={duration:.45,ease:[.4,0,.1,1]},userAgentContains=e=>"undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().includes(e),td=userAgentContains("applewebkit/")&&!userAgentContains("chrome/")?Math.round:ec.Z;function roundAxis(e){e.min=td(e.min),e.max=td(e.max)}function roundBox(e){roundAxis(e.x),roundAxis(e.y)}function shouldAnimatePositionOnly(e,n,o){return"position"===e||"preserve-aspect"===e&&!isNear(aspectRatio(n),aspectRatio(o),.2)}let tf=createProjectionNode({attachResizeListener:(e,n)=>addDomEvent(e,"resize",n),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),tp={current:void 0},th=createProjectionNode({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!tp.current){let e=new tf({});e.mount(window),e.setOptions({layoutScroll:!0}),tp.current=e}return tp.current},resetTransform:(e,n)=>{e.style.transform=void 0!==n?n:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position}),tm=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function parseCSSVariable(e){let n=tm.exec(e);if(!n)return[,];let[,o,i]=n;return[o,i]}function getVariableValue(e,n,o=1){(0,em.k)(o<=4,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);let[i,s]=parseCSSVariable(e);if(!i)return;let u=window.getComputedStyle(n).getPropertyValue(i);if(u){let e=u.trim();return isNumericalString(e)?parseFloat(e):e}return B(s)?getVariableValue(s,n,o+1):s}function resolveCSSVariables(e,{...n},o){let i=e.current;if(!(i instanceof Element))return{target:n,transitionEnd:o};for(let s in o&&(o={...o}),e.values.forEach(e=>{let n=e.get();if(!B(n))return;let o=getVariableValue(n,i);o&&e.set(o)}),n){let e=n[s];if(!B(e))continue;let u=getVariableValue(e,i);u&&(n[s]=u,o||(o={}),void 0===o[s]&&(o[s]=e))}return{target:n,transitionEnd:o}}let tg=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),isPositionalKey=e=>tg.has(e),hasPositionalKey=e=>Object.keys(e).some(isPositionalKey),isNumOrPxType=e=>e===F||e===G,getPosFromMatrix=(e,n)=>parseFloat(e.split(", ")[n]),getTranslateFromMatrix=(e,n)=>(o,{transform:i})=>{if("none"===i||!i)return 0;let s=i.match(/^matrix3d\((.+)\)$/);if(s)return getPosFromMatrix(s[1],n);{let n=i.match(/^matrix\((.+)\)$/);return n?getPosFromMatrix(n[1],e):0}},tv=new Set(["x","y","z"]),ty=P.filter(e=>!tv.has(e));function removeNonTranslationalTransform(e){let n=[];return ty.forEach(o=>{let i=e.getValue(o);void 0!==i&&(n.push([o,i.get()]),i.set(o.startsWith("scale")?1:0))}),n.length&&e.render(),n}let tb={width:({x:e},{paddingLeft:n="0",paddingRight:o="0"})=>e.max-e.min-parseFloat(n)-parseFloat(o),height:({y:e},{paddingTop:n="0",paddingBottom:o="0"})=>e.max-e.min-parseFloat(n)-parseFloat(o),top:(e,{top:n})=>parseFloat(n),left:(e,{left:n})=>parseFloat(n),bottom:({y:e},{top:n})=>parseFloat(n)+(e.max-e.min),right:({x:e},{left:n})=>parseFloat(n)+(e.max-e.min),x:getTranslateFromMatrix(4,13),y:getTranslateFromMatrix(5,14)};tb.translateX=tb.x,tb.translateY=tb.y;let convertChangedValueTypes=(e,n,o)=>{let i=n.measureViewportBox(),s=n.current,u=getComputedStyle(s),{display:c}=u,d={};"none"===c&&n.setStaticValue("display",e.display||"block"),o.forEach(e=>{d[e]=tb[e](i,u)}),n.render();let m=n.measureViewportBox();return o.forEach(o=>{let i=n.getValue(o);i&&i.jump(d[o]),e[o]=tb[o](m,u)}),e},checkAndConvertChangedValueTypes=(e,n,o={},i={})=>{n={...n},i={...i};let s=Object.keys(n).filter(isPositionalKey),u=[],c=!1,d=[];if(s.forEach(s=>{let m;let g=e.getValue(s);if(!e.hasValue(s))return;let y=o[s],b=findDimensionValueType(y),x=n[s];if(isKeyframesTarget(x)){let e=x.length,n=null===x[0]?1:0;b=findDimensionValueType(y=x[n]);for(let o=n;o=0?window.pageYOffset:null,s=convertChangedValueTypes(n,e,d);return u.length&&u.forEach(([n,o])=>{e.getValue(n).set(o)}),e.render(),w.j&&null!==o&&window.scrollTo({top:o}),{target:s,transitionEnd:i}}};function unitConversion(e,n,o,i){return hasPositionalKey(n)?checkAndConvertChangedValueTypes(e,n,o,i):{target:n,transitionEnd:i}}let parseDomVariant=(e,n,o,i)=>{let s=resolveCSSVariables(e,n,i);return unitConversion(e,n=s.target,o,i=s.transitionEnd)},tx={current:null},tw={current:!1};function initPrefersReducedMotion(){if(tw.current=!0,w.j){if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),setReducedMotionPreferences=()=>tx.current=e.matches;e.addListener(setReducedMotionPreferences),setReducedMotionPreferences()}else tx.current=!1}}function updateMotionValuesFromProps(e,n,o){let{willChange:i}=n;for(let s in n){let u=n[s],c=o[s];if(isMotionValue(u))e.addValue(s,u),isWillChangeMotionValue(i)&&i.add(s);else if(isMotionValue(c))e.addValue(s,motionValue(u,{owner:e})),isWillChangeMotionValue(i)&&i.remove(s);else if(c!==u){if(e.hasValue(s)){let n=e.getValue(s);n.hasAnimated||n.set(u)}else{let n=e.getStaticValue(s);e.addValue(s,motionValue(void 0!==n?n:u,{owner:e}))}}}for(let i in o)void 0===n[i]&&e.removeValue(i);return n}let tS=new WeakMap,t_=Object.keys(x),tC=t_.length,tk=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],tE=y.length;let VisualElement=class VisualElement{constructor({parent:e,props:n,presenceContext:o,reducedMotionConfig:i,visualState:s},u={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>ei.Wi.render(this.render,!1,!0);let{latestValues:c,renderState:d}=s;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=d,this.parent=e,this.props=n,this.presenceContext=o,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=u,this.isControllingVariants=isControllingVariants(n),this.isVariantNode=isVariantNode(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:m,...g}=this.scrapeMotionValuesFromProps(n,{});for(let e in g){let n=g[e];void 0!==c[e]&&isMotionValue(n)&&(n.set(c[e],!1),isWillChangeMotionValue(m)&&m.add(e))}}scrapeMotionValuesFromProps(e,n){return{}}mount(e){this.current=e,tS.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,n)=>this.bindToMotionValue(n,e)),tw.current||initPrefersReducedMotion(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||tx.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in tS.delete(this.current),this.projection&&this.projection.unmount(),(0,ei.Pn)(this.notifyUpdate),(0,ei.Pn)(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this),this.events)this.events[e].clear();for(let e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,n){let o=O.has(e),i=n.on("change",n=>{this.latestValues[e]=n,this.props.onUpdate&&ei.Wi.update(this.notifyUpdate,!1,!0),o&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{i(),s()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}loadFeatures({children:e,...n},o,i,s){let u,c;for(let e=0;ethis.scheduleRender(),animationType:"string"==typeof o?o:"both",initialPromotionConfig:s,layoutScroll:d,layoutRoot:m})}return c}updateFeatures(){for(let e in this.features){let n=this.features[e];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):createBox()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}makeTargetAnimatable(e,n=!0){return this.makeTargetAnimatableFromInstance(e,this.props,n)}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let n=0;nn.variantChildren.delete(e)}addValue(e,n){n!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,n)),this.values.set(e,n),this.latestValues[e]=n.get()}removeValue(e){this.values.delete(e);let n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let o=this.values.get(e);return void 0===o&&void 0!==n&&(o=motionValue(n,{owner:this}),this.addValue(e,o)),o}readValue(e){var n;return void 0===this.latestValues[e]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,e))&&void 0!==n?n:this.readValueFromInstance(this.current,e,this.options):this.latestValues[e]}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;let{initial:o}=this.props,i="string"==typeof o||"object"==typeof o?null===(n=resolveVariantFromProps(this.props,o))||void 0===n?void 0:n[e]:void 0;if(o&&void 0!==i)return i;let s=this.getBaseTargetFromProps(this.props,e);return void 0===s||isMotionValue(s)?void 0!==this.initialValues[e]&&void 0===i?void 0:this.baseTarget[e]:s}on(e,n){return this.events[e]||(this.events[e]=new SubscriptionManager),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}};let DOMVisualElement=class DOMVisualElement extends VisualElement{sortInstanceNodePosition(e,n){return 2&e.compareDocumentPosition(n)?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:o}){delete n[e],delete o[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:n,...o},{transformValues:i},s){let u=getOrigin(o,e||{},this);if(i&&(n&&(n=i(n)),o&&(o=i(o)),u&&(u=i(u))),s){checkTargetForNewValues(this,o,u);let e=parseDomVariant(this,o,u,n);n=e.transitionEnd,o=e.target}return{transition:e,transitionEnd:n,...o}}};function HTMLVisualElement_getComputedStyle(e){return window.getComputedStyle(e)}let HTMLVisualElement=class HTMLVisualElement extends DOMVisualElement{readValueFromInstance(e,n){if(O.has(n)){let e=getDefaultValueType(n);return e&&e.default||0}{let o=HTMLVisualElement_getComputedStyle(e),i=(j(n)?o.getPropertyValue(n):o[n])||0;return"string"==typeof i?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return measureViewportBox(e,n)}build(e,n,o,i){buildHTMLStyles(e,n,o,i.transformTemplate)}scrapeMotionValuesFromProps(e,n){return scrapeMotionValuesFromProps(e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;isMotionValue(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}renderInstance(e,n,o,i){renderHTML(e,n,o,i)}};let SVGVisualElement=class SVGVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(O.has(n)){let e=getDefaultValueType(n);return e&&e.default||0}return n=en.has(n)?n:camelToDash(n),e.getAttribute(n)}measureInstanceViewportBox(){return createBox()}scrapeMotionValuesFromProps(e,n){return scrape_motion_values_scrapeMotionValuesFromProps(e,n)}build(e,n,o,i){buildSVGAttrs(e,n,o,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,o,i){renderSVG(e,n,o,i)}mount(e){this.isSVGTag=isSVGTag(e.tagName),super.mount(e)}};let create_visual_element_createDomVisualElement=(e,n)=>isSVGComponent(e)?new SVGVisualElement(n,{enableHardwareAcceleration:!1}):new HTMLVisualElement(n,{enableHardwareAcceleration:!0}),tT={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature},inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture},pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:th,MeasureLayout:MeasureLayout},layout:{ProjectionNode:th,MeasureLayout:MeasureLayout}},tP=createMotionProxy((e,n)=>create_config_createDomMotionConfig(e,n,tT,create_visual_element_createDomVisualElement))},316:function(e,n,o){"use strict";o.d(n,{K:function(){return s},k:function(){return u}});var i=o(68390);let s=i.Z,u=i.Z},99228:function(e,n,o){"use strict";o.d(n,{j:function(){return i}});let i="undefined"!=typeof document},68390:function(e,n,o){"use strict";o.d(n,{Z:function(){return noop}});let noop=e=>e},740:function(e,n,o){"use strict";o.d(n,{h:function(){return useConstant}});var i=o(27726);function useConstant(e){let n=(0,i.useRef)(null);return null===n.current&&(n.current=e()),n.current}},90529:function(e,n,o){"use strict";o.d(n,{L:function(){return u}});var i=o(27726),s=o(99228);let u=s.j?i.useLayoutEffect:i.useEffect},84021:function(e,n,o){"use strict";o.d(n,{$Q:function(){return d}});var i=o(27726),s=o(85670);let u="label";function reforwardRef(e,n){"function"==typeof e?e(n):e&&(e.current=n)}function setOptions(e,n){let o=e.options;o&&n&&Object.assign(o,n)}function setDatasets(e,n){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u,i=[];e.datasets=n.map(n=>{let s=e.datasets.find(e=>e[o]===n[o]);return!s||!n.data||i.includes(s)?{...n}:(i.push(s),Object.assign(s,n),s)})}function cloneData(e){var n;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u,i={labels:[],datasets:[]};return n=e.labels,i.labels=n,setDatasets(i,e.datasets,o),i}function ChartComponent(e,n){let{height:o=150,width:u=300,redraw:c=!1,datasetIdKey:d,type:m,data:g,options:y,plugins:b=[],fallbackContent:x,updateMode:w,...S}=e,_=(0,i.useRef)(null),C=(0,i.useRef)(),renderChart=()=>{_.current&&(C.current=new s.kL(_.current,{type:m,data:cloneData(g,d),options:y&&{...y},plugins:b}),reforwardRef(n,C.current))},destroyChart=()=>{reforwardRef(n,null),C.current&&(C.current.destroy(),C.current=null)};return(0,i.useEffect)(()=>{!c&&C.current&&y&&setOptions(C.current,y)},[c,y]),(0,i.useEffect)(()=>{if(!c&&C.current){var e,n;e=C.current.config.data,n=g.labels,e.labels=n}},[c,g.labels]),(0,i.useEffect)(()=>{!c&&C.current&&g.datasets&&setDatasets(C.current.config.data,g.datasets,d)},[c,g.datasets]),(0,i.useEffect)(()=>{C.current&&(c?(destroyChart(),setTimeout(renderChart)):C.current.update(w))},[c,y,g.labels,g.datasets,w]),(0,i.useEffect)(()=>{C.current&&(destroyChart(),setTimeout(renderChart))},[m]),(0,i.useEffect)(()=>(renderChart(),()=>destroyChart()),[]),i.createElement("canvas",Object.assign({ref:_,role:"img",height:o,width:u},S),x)}let c=(0,i.forwardRef)(ChartComponent);function createTypedChart(e,n){return s.kL.register(n),(0,i.forwardRef)((n,o)=>i.createElement(c,Object.assign({},n,{ref:o,type:e})))}let d=createTypedChart("bar",s.vn)},52116:function(e,n,o){"use strict";o.d(n,{ZP:function(){return $},Ug:function(){return textEditor}});var i=o(27726),s=o(47603);function r(e){var n,o,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e){if(Array.isArray(e))for(n=0;n1&&(!e.frozen||e.idx+i-1<=n))return i}function stopPropagation(e){e.stopPropagation()}function scrollIntoView(e){e?.scrollIntoView({inline:"nearest",block:"nearest"})}function createCellEvent(e){let n=!1,o={...e,preventGridDefault(){n=!0},isGridDefaultPrevented:()=>n};return Object.setPrototypeOf(o,Object.getPrototypeOf(e)),o}let c=new Set(["Unidentified","Alt","AltGraph","CapsLock","Control","Fn","FnLock","Meta","NumLock","ScrollLock","Shift","Tab","ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp","Insert","ContextMenu","Escape","Pause","Play","PrintScreen","F1","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]);function isCtrlKeyHeldDown(e){return(e.ctrlKey||e.metaKey)&&"Control"!==e.key}function isDefaultCellInput(e){return!c.has(e.key)}function onEditorNavigation({key:e,target:n}){return!!("Tab"===e&&(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement))&&n.closest(".rdg-editor-container")?.querySelectorAll("input, textarea, select").length===1}function renderMeasuringCells(e){return e.map(({key:e,idx:n,minWidth:o,maxWidth:i})=>(0,u.jsx)("div",{className:"mlln6zg7-0-0-beta-40",style:{gridColumnStart:n+1,minWidth:o,maxWidth:i},"data-measuring-cell-key":e},e))}function isSelectedCellEditable({selectedPosition:e,columns:n,rows:o}){let i=n[e.idx],s=o[e.rowIdx];return isCellEditable(i,s)}function isCellEditable(e,n){return null!=e.renderEditCell&&("function"==typeof e.editable?e.editable(n):e.editable)!==!1}function getSelectedCellColSpan({rows:e,topSummaryRows:n,bottomSummaryRows:o,rowIdx:i,mainHeaderRowIdx:s,lastFrozenColumnIndex:u,column:c}){let d=n?.length??0;if(i===s)return getColSpan(c,u,{type:"HEADER"});if(n&&i>s&&i<=d+s)return getColSpan(c,u,{type:"SUMMARY",row:n[i+d]});if(i>=0&&i{for(let n of s){let o=n.idx;if(o>C)break;let i=getSelectedCellColSpan({rows:u,topSummaryRows:c,bottomSummaryRows:d,rowIdx:E,mainHeaderRowIdx:g,lastFrozenColumnIndex:S,column:n});if(i&&C>o&&Ce.level+g;if(_(w)&&(setColSpan(n),E{if(n){let e=i[C],n=e.parent;for(;void 0!==n;){let e=getParentRowIdx(n);if(E===e){C=n.idx+n.colSpan;break}n=n.parent}}else if(e){let e=i[C],n=e.parent,o=!1;for(;void 0!==n;){let e=getParentRowIdx(n);if(E>=e){C=n.idx,E=e,o=!0;break}n=n.parent}o||(C=b,E=x)}})()),"CHANGE_ROW"===o){let e=C===T,n=-1===C;if(e){let e=E===y;e||(C=0,E+=1)}else if(n){let e=E===m;e||(E-=1,C=T-1),setColSpan(!1)}}if(E=o&&(E=e,C=n.idx),n=n.parent}}return{idx:C,rowIdx:E}}function canExitGrid({maxColIdx:e,minRowIdx:n,maxRowIdx:o,selectedPosition:{rowIdx:i,idx:s},shiftKey:u}){return u?0===s&&i===n:s===e&&i===o}let d="rdg-cell cj343x07-0-0-beta-40";function getRowStyle(e,n){return void 0!==n?{"--rdg-grid-row-start":e,"--rdg-row-height":`${n}px`}:{"--rdg-grid-row-start":e}}function getHeaderCellStyle(e,n,o){let i=n+1,s=`calc(${o-1} * var(--rdg-header-row-height))`;return void 0===e.parent?{insetBlockStart:0,gridRowStart:1,gridRowEnd:i,paddingBlockStart:s}:{insetBlockStart:`calc(${n-o} * var(--rdg-header-row-height))`,gridRowStart:i-o,gridRowEnd:i,paddingBlockStart:s}}function getCellStyle(e,n=1){let o=e.idx+1;return{gridColumnStart:o,gridColumnEnd:o+n,insetInlineStart:e.frozen?`var(--rdg-frozen-left-${e.idx})`:void 0}}function getCellClassname(e,...n){return dist_clsx(d,...n,e.frozen&&"rdg-cell-frozen csofj7r7-0-0-beta-40",e.isLastFrozenColumn&&"rdg-cell-frozen-last ch2wcw87-0-0-beta-40")}let{min:m,max:g,round:y,floor:b,sign:x,abs:w}=Math;function assertIsValidKeyGetter(e){if("function"!=typeof e)throw Error("Please specify the rowKeyGetter prop to use selection")}function clampColumnWidth(e,{minWidth:n,maxWidth:o}){return(e=g(e,n),"number"==typeof o&&o>=n)?m(e,o):e}function getHeaderCellRowSpan(e,n){return void 0===e.parent?n:e.level-e.parent.level}function renderCheckbox({onChange:e,...n}){function handleChange(n){e(n.target.checked,n.nativeEvent.shiftKey)}return(0,u.jsxs)("label",{className:dist_clsx("rdg-checkbox-label c1bn88vv7-0-0-beta-40",n.disabled&&"rdg-checkbox-label-disabled c1lwve4p7-0-0-beta-40"),children:[(0,u.jsx)("input",{type:"checkbox",...n,className:"rdg-checkbox-input c1qt073l7-0-0-beta-40",onChange:handleChange}),(0,u.jsx)("div",{className:"rdg-checkbox cf71kmq7-0-0-beta-40"})]})}function renderValue(e){try{return e.row[e.column.key]}catch{return null}}let S=(0,i.createContext)(void 0),_=S.Provider;function useDefaultRenderers(){return(0,i.useContext)(S)}let C=(0,i.createContext)(void 0),E=C.Provider,T=(0,i.createContext)(void 0),P=T.Provider,O="select-row";function useCalculatedColumns({rawColumns:e,defaultColumnOptions:n,getColumnWidth:o,viewportWidth:s,scrollLeft:u,enableVirtualization:c}){let d=n?.width??"auto",y=n?.minWidth??50,b=n?.maxWidth??void 0,x=n?.renderCell??renderValue,w=n?.sortable??!1,S=n?.resizable??!1,_=n?.draggable??!1,{columns:C,colSpanColumns:E,lastFrozenColumnIndex:T,headerRowsCount:P}=(0,i.useMemo)(()=>{let n=-1,o=1,i=[];function collectColumns(e,s,u){for(let c of e){if("children"in c){let e={name:c.name,parent:u,idx:-1,colSpan:0,level:0,headerCellClass:c.headerCellClass};collectColumns(c.children,s+1,e);continue}let e=c.frozen??!1,m={...c,parent:u,idx:0,level:0,frozen:e,isLastFrozenColumn:!1,width:c.width??d,minWidth:c.minWidth??y,maxWidth:c.maxWidth??b,sortable:c.sortable??w,resizable:c.resizable??S,draggable:c.draggable??_,renderCell:c.renderCell??x};i.push(m),e&&n++,s>o&&(o=s)}}collectColumns(e,1),i.sort(({key:e,frozen:n},{key:o,frozen:i})=>e===O?-1:o===O?1:n?i?0:-1:i?1:0);let s=[];return i.forEach((e,n)=>{e.idx=n,updateColumnParent(e,n,0),null!=e.colSpan&&s.push(e)}),-1!==n&&(i[n].isLastFrozenColumn=!0),{columns:i,colSpanColumns:s,lastFrozenColumnIndex:n,headerRowsCount:o}},[e,d,y,b,x,S,w,_]),{templateColumns:R,layoutCssVars:M,totalFrozenColumnWidth:j,columnMetrics:B}=(0,i.useMemo)(()=>{let e=new Map,n=0,i=0,s=[];for(let i of C){let u=o(i);u="number"==typeof u?clampColumnWidth(u,i):i.minWidth,s.push(`${u}px`),e.set(i,{width:u,left:n}),n+=u}if(-1!==T){let n=e.get(C[T]);i=n.left+n.width}let u={};for(let n=0;n<=T;n++){let o=C[n];u[`--rdg-frozen-left-${o.idx}`]=`${e.get(o).left}px`}return{templateColumns:s,layoutCssVars:u,totalFrozenColumnWidth:i,columnMetrics:e}},[o,C,T]),[F,L]=(0,i.useMemo)(()=>{if(!c)return[0,C.length-1];let e=u+j,n=u+s,o=C.length-1,i=m(T+1,o);if(e>=n)return[i,i];let d=i;for(;de)break;d++}let y=d;for(;y=n)break;y++}let b=g(i,d-1),x=m(o,y+1);return[b,x]},[B,C,T,u,j,s,c]);return{columns:C,colSpanColumns:E,colOverscanStartIdx:F,colOverscanEndIdx:L,templateColumns:R,layoutCssVars:M,headerRowsCount:P,lastFrozenColumnIndex:T,totalFrozenColumnWidth:j}}function updateColumnParent(e,n,o){if(o{let o=new Map(n),i=!1;for(let s of e){let e=measureColumnWidth(u,s);i||=e!==n.get(s),void 0===e?o.delete(s):o.set(s,e)}return i?o:n})}return R(()=>{x.current=c,updateMeasuredWidths(C)}),{gridTemplateColumns:E,handleColumnResize:function(e,i){let{key:c}=e,m=[...o],y=[];for(let{key:e,idx:o,width:s}of n)if(c===e){let e="number"==typeof i?`${i}px`:i;m[o]=e}else w&&"string"==typeof s&&!d.has(e)&&(m[o]=s,y.push(e));u.current.style.gridTemplateColumns=m.join(" ");let x="number"==typeof i?i:measureColumnWidth(u,c);(0,s.flushSync)(()=>{g(e=>{let n=new Map(e);return n.set(c,x),n}),updateMeasuredWidths(y)}),b?.(e.idx,x)}}}function measureColumnWidth(e,n){let o=`[data-measuring-cell-key="${CSS.escape(n)}"]`,i=e.current.querySelector(o);return i?.getBoundingClientRect().width}function useGridDimensions(){let e=(0,i.useRef)(null),[n,o]=(0,i.useState)(1),[u,c]=(0,i.useState)(1);return R(()=>{let{ResizeObserver:n}=window;if(null==n)return;let{clientWidth:i,clientHeight:u,offsetWidth:d,offsetHeight:m}=e.current,{width:g,height:y}=e.current.getBoundingClientRect();o(g-d+i),c(y-m+u);let b=new n(e=>{let n=e[0].contentBoxSize[0];(0,s.flushSync)(()=>{o(n.inlineSize),c(n.blockSize)})});return b.observe(e.current),()=>{b.disconnect()}},[]),[e,n,u]}function useLatestFunc(e){let n=(0,i.useRef)(e);(0,i.useEffect)(()=>{n.current=e});let o=(0,i.useCallback)((...e)=>{n.current(...e)},[]);return e?o:e}function useRovingTabIndex(e){let[n,o]=(0,i.useState)(!1);function onFocus(e){e.target!==e.currentTarget&&o(!0)}return n&&!e&&o(!1),{tabIndex:e&&!n?0:-1,childTabIndex:e?0:-1,onFocus:e?onFocus:void 0}}function useViewportColumns({columns:e,colSpanColumns:n,rows:o,topSummaryRows:s,bottomSummaryRows:u,colOverscanStartIdx:c,colOverscanEndIdx:d,lastFrozenColumnIndex:m,rowOverscanStartIdx:g,rowOverscanEndIdx:y}){let b=(0,i.useMemo)(()=>{if(0===c)return 0;let e=c,updateStartIdx=(n,o)=>void 0!==o&&n+o>c&&(e=n,!0);for(let i of n){let n=i.idx;if(n>=e||updateStartIdx(n,getColSpan(i,m,{type:"HEADER"})))break;for(let e=g;e<=y;e++){let s=o[e];if(updateStartIdx(n,getColSpan(i,m,{type:"ROW",row:s})))break}if(null!=s){for(let e of s)if(updateStartIdx(n,getColSpan(i,m,{type:"SUMMARY",row:e})))break}if(null!=u){for(let e of u)if(updateStartIdx(n,getColSpan(i,m,{type:"SUMMARY",row:e})))break}}return e},[g,y,o,s,u,c,m,n]);return(0,i.useMemo)(()=>{let n=[];for(let o=0;o<=d;o++){let i=e[o];(!(o{if("number"==typeof n)return{totalRowHeight:n*e.length,gridTemplateRows:` repeat(${e.length}, ${n}px)`,getRowTop:e=>e*n,getRowHeight:()=>n,findRowIdx:e=>b(e/n)};let o=0,i=" ",s=e.map(e=>{let s=n(e),u={top:o,height:s};return i+=`${s}px `,o+=s,u}),validateRowIdx=n=>g(0,m(e.length-1,n));return{totalRowHeight:o,gridTemplateRows:i,getRowTop:e=>s[validateRowIdx(e)].top,getRowHeight:e=>s[validateRowIdx(e)].height,findRowIdx(e){let n=0,o=s.length-1;for(;n<=o;){let i=n+b((o-n)/2),u=s[i].top;if(u===e)return i;if(ue&&(o=i-1),n>o)return o}return 0}}},[n,e]),S=0,_=e.length-1;if(u){let n=w(s),i=w(s+o);S=g(0,n-4),_=m(e.length-1,i+4)}return{rowOverscanStartIdx:S,rowOverscanEndIdx:_,totalRowHeight:c,gridTemplateRows:d,getRowTop:y,getRowHeight:x,findRowIdx:w}}function DragHandle({gridRowStart:e,rows:n,column:o,columnWidth:i,selectedPosition:s,latestDraggedOverRowIdx:c,isCellEditable:d,onRowsChange:m,onFill:g,onClick:y,setDragging:b,setDraggedOverRowIdx:x}){let{idx:w,rowIdx:S}=s;function handleMouseDown(e){function onMouseOver(e){1!==e.buttons&&onMouseUp()}function onMouseUp(){window.removeEventListener("mouseover",onMouseOver),window.removeEventListener("mouseup",onMouseUp),b(!1),handleDragEnd()}e.preventDefault(),1===e.buttons&&(b(!0),window.addEventListener("mouseover",onMouseOver),window.addEventListener("mouseup",onMouseUp))}function handleDragEnd(){let e=c.current;if(void 0===e)return;let n=S0&&m?.(u,{indexes:c,column:o})}let _=o.colSpan?.({type:"ROW",row:n[S]})??1,C=getCellStyle(o,_);return(0,u.jsx)("div",{style:{...C,gridRowStart:e,insetInlineStart:C.insetInlineStart&&"number"==typeof i?`calc(${C.insetInlineStart} + ${i}px - var(--rdg-drag-handle-size))`:void 0},className:dist_clsx("rdg-cell-drag-handle c1w9bbhr7-0-0-beta-40",o.frozen&&"c1creorc7-0-0-beta-40"),onClick:y,onMouseDown:handleMouseDown,onDoubleClick:handleDoubleClick})}function EditCell({column:e,colSpan:n,row:o,rowIdx:s,onRowChange:c,closeEditor:d,onKeyDown:m,navigate:g}){let y=(0,i.useRef)(),b=e.editorOptions?.commitOnOutsideClick!==!1,x=useLatestFunc(()=>{onClose(!0,!1)});function cancelFrameRequest(){cancelAnimationFrame(y.current)}function handleKeyDown(n){if(m){let i=createCellEvent(n);if(m({mode:"EDIT",row:o,column:e,rowIdx:s,navigate(){g(n)},onClose},i),i.isGridDefaultPrevented())return}"Escape"===n.key?onClose():"Enter"===n.key?onClose(!0):onEditorNavigation(n)&&g(n)}function onClose(e=!1,n=!0){e?c(o,!0,n):d(n)}function onEditorRowChange(e,n=!1){c(e,n,n)}(0,i.useEffect)(()=>{if(b)return addEventListener("mousedown",onWindowCaptureMouseDown,{capture:!0}),()=>{removeEventListener("mousedown",onWindowCaptureMouseDown,{capture:!0}),cancelFrameRequest()};function onWindowCaptureMouseDown(){y.current=requestAnimationFrame(x)}},[b,x]);let{cellClass:w}=e,S=getCellClassname(e,"rdg-editor-container","function"==typeof w?w(o):w,!e.editorOptions?.displayCellContent&&"cis5rrm7-0-0-beta-40");return(0,u.jsx)("div",{role:"gridcell","aria-colindex":e.idx+1,"aria-colspan":n,"aria-selected":!0,className:S,style:getCellStyle(e,n),onKeyDown:handleKeyDown,onMouseDownCapture:cancelFrameRequest,children:null!=e.renderEditCell&&(0,u.jsxs)(u.Fragment,{children:[e.renderEditCell({column:e,row:o,onRowChange:onEditorRowChange,onClose}),e.editorOptions?.displayCellContent&&e.renderCell({column:e,row:o,isCellEditable:!0,tabIndex:-1,onRowChange:onEditorRowChange})]})})}function GroupedColumnHeaderCell({column:e,rowIdx:n,isCellSelected:o,selectCell:i}){let{tabIndex:s,onFocus:c}=useRovingTabIndex(o),{colSpan:m}=e,g=getHeaderCellRowSpan(e,n),y=e.idx+1;function onClick(){i({idx:e.idx,rowIdx:n})}return(0,u.jsx)("div",{role:"columnheader","aria-colindex":y,"aria-colspan":m,"aria-rowspan":g,"aria-selected":o,tabIndex:s,className:dist_clsx(d,e.headerCellClass),style:{...getHeaderCellStyle(e,n,g),gridColumnStart:y,gridColumnEnd:y+m},onFocus:c,onClick:onClick,children:e.name})}function renderHeaderCell({column:e,sortDirection:n,priority:o}){return e.sortable?(0,u.jsx)(SortableHeaderCell,{sortDirection:n,priority:o,children:e.name}):e.name}function SortableHeaderCell({sortDirection:e,priority:n,children:o}){let i=useDefaultRenderers().renderSortStatus;return(0,u.jsxs)("span",{className:"h44jtk67-0-0-beta-40",children:[(0,u.jsx)("span",{className:"rdg-header-sort-name hcgkhxz7-0-0-beta-40",children:o}),(0,u.jsx)("span",{children:i({sortDirection:e,priority:n})})]})}function HeaderCell({column:e,colSpan:n,rowIdx:o,isCellSelected:s,onColumnResize:c,onColumnsReorder:d,sortColumns:m,onSortColumnsChange:g,selectCell:y,shouldFocusGrid:b,direction:x,dragDropKey:w}){let S;let[_,C]=(0,i.useState)(!1),[E,T]=(0,i.useState)(!1),P="rtl"===x,O=getHeaderCellRowSpan(e,o),{tabIndex:R,childTabIndex:M,onFocus:j}=useRovingTabIndex(s),B=m?.findIndex(n=>n.columnKey===e.key),F=void 0!==B&&B>-1?m[B]:void 0,L=F?.direction,N=void 0!==F&&m.length>1?B+1:void 0,V=L&&!N?"ASC"===L?"ascending":"descending":void 0,{sortable:W,resizable:U,draggable:$}=e,H=getCellClassname(e,e.headerCellClass,W&&"c6l2wv17-0-0-beta-40",U&&"rdg-cell-resizable c1kqdw7y7-0-0-beta-40",$&&"rdg-cell-draggable",_&&"rdg-cell-dragging c1bezg5o7-0-0-beta-40",E&&"rdg-cell-drag-over c1vc96037-0-0-beta-40"),G=e.renderHeaderCell??renderHeaderCell;function onPointerDown(n){if("mouse"===n.pointerType&&1!==n.buttons)return;let{currentTarget:o,pointerId:i}=n,s=o.parentElement,{right:u,left:d}=s.getBoundingClientRect(),m=P?n.clientX-d:u-n.clientX;function onPointerMove(n){n.preventDefault();let{right:o,left:i}=s.getBoundingClientRect(),u=P?o+m-n.clientX:n.clientX+m-i;u>0&&c(e,clampColumnWidth(u,e))}function onLostPointerCapture(){o.removeEventListener("pointermove",onPointerMove),o.removeEventListener("lostpointercapture",onLostPointerCapture)}o.setPointerCapture(i),o.addEventListener("pointermove",onPointerMove),o.addEventListener("lostpointercapture",onLostPointerCapture)}function onSort(n){if(null==g)return;let{sortDescendingFirst:o}=e;if(void 0===F){let i={columnKey:e.key,direction:o?"DESC":"ASC"};g(m&&n?[...m,i]:[i])}else{let i;if((!0===o&&"DESC"===L||!0!==o&&"ASC"===L)&&(i={columnKey:e.key,direction:"ASC"===L?"DESC":"ASC"}),n){let e=[...m];i?e[B]=i:e.splice(B,1),g(e)}else g(i?[i]:[])}}function onClick(n){y({idx:e.idx,rowIdx:o}),W&&onSort(n.ctrlKey||n.metaKey)}function onDoubleClick(){c(e,"max-content")}function handleFocus(e){j?.(e),b&&y({idx:0,rowIdx:o})}function onKeyDown(e){(" "===e.key||"Enter"===e.key)&&(e.preventDefault(),onSort(e.ctrlKey||e.metaKey))}function onDragStart(n){n.dataTransfer.setData(w,e.key),n.dataTransfer.dropEffect="move",C(!0)}function onDragEnd(){C(!1)}function onDragOver(e){e.preventDefault(),e.dataTransfer.dropEffect="move"}function onDrop(n){if(T(!1),n.dataTransfer.types.includes(w)){let o=n.dataTransfer.getData(w);o!==e.key&&(n.preventDefault(),d?.(o,e.key))}}function onDragEnter(e){isEventPertinent(e)&&T(!0)}function onDragLeave(e){isEventPertinent(e)&&T(!1)}return $&&(S={draggable:!0,onDragStart,onDragEnd,onDragOver,onDragEnter,onDragLeave,onDrop}),(0,u.jsxs)("div",{role:"columnheader","aria-colindex":e.idx+1,"aria-colspan":n,"aria-rowspan":O,"aria-selected":s,"aria-sort":V,tabIndex:b?0:R,className:H,style:{...getHeaderCellStyle(e,o,O),...getCellStyle(e,n)},onFocus:handleFocus,onClick:onClick,onKeyDown:W?onKeyDown:void 0,...S,children:[G({column:e,sortDirection:L,priority:N,tabIndex:M}),U&&(0,u.jsx)("div",{className:"r1y6ywlx7-0-0-beta-40",onClick:stopPropagation,onDoubleClick:onDoubleClick,onPointerDown:onPointerDown})]})}function isEventPertinent(e){let n=e.relatedTarget;return!e.currentTarget.contains(n)}let M="rdg-row r1upfr807-0-0-beta-40",j="rdg-row-selected",B="rdg-header-row h10tskcx7-0-0-beta-40";function HeaderRow({rowIdx:e,columns:n,onColumnResize:o,onColumnsReorder:s,sortColumns:c,onSortColumnsChange:d,lastFrozenColumnIndex:m,selectedCellIdx:g,selectCell:y,shouldFocusGrid:b,direction:x}){let w=(0,i.useId)(),S=[];for(let i=0;in&&void 0!==o.parent;)o=o.parent;if(o.level===n&&!d.has(o)){d.add(o);let{idx:n}=o;c.push((0,u.jsx)(GroupedColumnHeaderCell,{column:o,rowIdx:e,isCellSelected:i===n,selectCell:s},n))}}}return(0,u.jsx)("div",{role:"row","aria-rowindex":e,className:B,children:c})}let L=(0,i.memo)(GroupedColumnHeaderRow);function Cell({column:e,colSpan:n,isCellSelected:o,isCopied:i,isDraggedOver:s,row:c,rowIdx:d,onClick:m,onDoubleClick:g,onContextMenu:y,onRowChange:b,selectCell:x,...w}){let{tabIndex:S,childTabIndex:_,onFocus:C}=useRovingTabIndex(o),{cellClass:E}=e,T=getCellClassname(e,"function"==typeof E?E(c):E,i&&"rdg-cell-copied c6ra8a37-0-0-beta-40",s&&"rdg-cell-dragged-over cq910m07-0-0-beta-40"),P=isCellEditable(e,c);function selectCellWrapper(n){x({rowIdx:d,idx:e.idx},n)}function handleClick(n){if(m){let o=createCellEvent(n);if(m({row:c,column:e,selectCell:selectCellWrapper},o),o.isGridDefaultPrevented())return}selectCellWrapper()}function handleContextMenu(n){if(y){let o=createCellEvent(n);if(y({row:c,column:e,selectCell:selectCellWrapper},o),o.isGridDefaultPrevented())return}selectCellWrapper()}function handleDoubleClick(n){if(g){let o=createCellEvent(n);if(g({row:c,column:e,selectCell:selectCellWrapper},o),o.isGridDefaultPrevented())return}selectCellWrapper(!0)}function handleRowChange(n){b(e,n)}return(0,u.jsx)("div",{role:"gridcell","aria-colindex":e.idx+1,"aria-colspan":n,"aria-selected":o,"aria-readonly":!P||void 0,tabIndex:S,className:T,style:getCellStyle(e,n),onClick:handleClick,onDoubleClick:handleDoubleClick,onContextMenu:handleContextMenu,onFocus:C,...w,children:e.renderCell({column:e,row:c,isCellEditable:P,tabIndex:_,onRowChange:handleRowChange})})}let N=(0,i.memo)(Cell);function Row({className:e,rowIdx:n,gridRowStart:o,height:i,selectedCellIdx:s,isRowSelected:c,copiedCellIdx:d,draggedOverCellIdx:m,lastFrozenColumnIndex:g,row:y,viewportColumns:b,selectedCellEditor:x,onCellClick:w,onCellDoubleClick:S,onCellContextMenu:_,rowClass:C,setDraggedOverRowIdx:T,onMouseEnter:P,onRowChange:O,selectCell:R,...B},F){let L=useLatestFunc((e,o)=>{O(e,n,o)});function handleDragEnter(e){T?.(n),P?.(e)}e=dist_clsx(M,`rdg-row-${n%2==0?"even":"odd"}`,C?.(y,n),e,-1===s&&j);let V=[];for(let e=0;e{scrollIntoView(c.current)}),R(()=>{function removeScrollToCell(){s(null)}let e=new IntersectionObserver(removeScrollToCell,{root:o,threshold:1});return e.observe(c.current),()=>{e.disconnect()}},[o,s]),(0,u.jsx)("div",{ref:c,style:{gridColumn:void 0===e?"1/-1":e+1,gridRow:void 0===n?"1/-1":n+2}})}function renderSortStatus({sortDirection:e,priority:n}){return(0,u.jsxs)(u.Fragment,{children:[renderSortIcon({sortDirection:e}),renderSortPriority({priority:n})]})}function renderSortIcon({sortDirection:e}){return void 0===e?null:(0,u.jsx)("svg",{viewBox:"0 0 12 8",width:"12",height:"8",className:"rdg-sort-arrow a3ejtar7-0-0-beta-40","aria-hidden":!0,children:(0,u.jsx)("path",{d:"ASC"===e?"M0 8 6 0 12 8":"M0 0 6 8 12 0"})})}function renderSortPriority({priority:e}){return e}function SummaryCell({column:e,colSpan:n,row:o,rowIdx:i,isCellSelected:s,selectCell:c}){let{tabIndex:d,childTabIndex:m,onFocus:g}=useRovingTabIndex(s),{summaryCellClass:y}=e,b=getCellClassname(e,"s8wc6fl7-0-0-beta-40","function"==typeof y?y(o):y);function onClick(){c({rowIdx:i,idx:e.idx})}return(0,u.jsx)("div",{role:"gridcell","aria-colindex":e.idx+1,"aria-colspan":n,"aria-selected":s,tabIndex:d,className:b,style:getCellStyle(e,n),onClick:onClick,onFocus:g,children:e.renderSummaryCell?.({column:e,row:o,tabIndex:m})})}let W=(0,i.memo)(SummaryCell);function SummaryRow({rowIdx:e,gridRowStart:n,row:o,viewportColumns:i,top:s,bottom:c,lastFrozenColumnIndex:d,selectedCellIdx:m,isTop:g,showBorder:y,selectCell:b,"aria-rowindex":x}){let w=[];for(let n=0;nnew Map),[eO,eA]=(0,i.useState)(()=>new Map),[eR,eI]=(0,i.useState)(null),[eM,ej]=(0,i.useState)(!1),[eD,eB]=(0,i.useState)(void 0),[eF,eL]=(0,i.useState)(null),eN=(0,i.useCallback)(e=>eT.get(e.key)??eO.get(e.key)??e.width,[eO,eT]),[eV,ez,eW]=useGridDimensions(),{columns:eU,colSpanColumns:e$,lastFrozenColumnIndex:eH,headerRowsCount:eG,colOverscanStartIdx:eZ,colOverscanEndIdx:eK,templateColumns:eY,layoutCssVars:eX,totalFrozenColumnWidth:eQ}=useCalculatedColumns({rawColumns:o,defaultColumnOptions:B,getColumnWidth:eN,scrollLeft:ek,viewportWidth:ez,enableVirtualization:ew}),eJ=d?.length??0,e0=m?.length??0,e1=eJ+e0,e2=eG+eJ,e5=eG-1,e4=-e2,e3=e4+e5,e6=c.length+e0-1,[e7,e8]=(0,i.useState)(()=>({idx:-1,rowIdx:e4-1,mode:"SELECT"})),e9=(0,i.useRef)(e7),tt=(0,i.useRef)(eD),tr=(0,i.useRef)(-1),tn=(0,i.useRef)(null),ti=(0,i.useRef)(!1),ta="treegrid"===ep,ts=eG*em,tl=eW-ts-e1*eg,tu=null!=T&&null!=O,tc="rtl"===eS,td=tc?"ArrowRight":"ArrowLeft",tf=tc?"ArrowLeft":"ArrowRight",tp=ec??eG+c.length+e1,th=(0,i.useMemo)(()=>({renderCheckbox:eb,renderSortStatus:ey}),[eb,ey]),tm=(0,i.useMemo)(()=>{let{length:e}=c;return 0!==e&&null!=T&&null!=g&&T.size>=e&&c.every(e=>T.has(g(e)))},[c,T,g]),{rowOverscanStartIdx:tg,rowOverscanEndIdx:tv,totalRowHeight:ty,gridTemplateRows:tb,getRowTop:tx,getRowHeight:tw,findRowIdx:tS}=useViewportRows({rows:c,rowHeight:eh,clientHeight:tl,scrollTop:e_,enableVirtualization:ew}),t_=useViewportColumns({columns:eU,colSpanColumns:e$,colOverscanStartIdx:eZ,colOverscanEndIdx:eK,lastFrozenColumnIndex:eH,rowOverscanStartIdx:tg,rowOverscanEndIdx:tv,rows:c,topSummaryRows:d,bottomSummaryRows:m}),{gridTemplateColumns:tC,handleColumnResize:tk}=useColumnWidths(eU,t_,eY,eV,ez,eT,eO,eP,eA,K),tE=ta?-1:0,tT=eU.length-1,tP=isCellWithinSelectionBounds(e7),tO=isCellWithinViewportBounds(e7),tA=useLatestFunc(tk),tR=useLatestFunc(Y),tI=useLatestFunc(j),tM=useLatestFunc(N),tj=useLatestFunc(V),tD=useLatestFunc(W),tB=useLatestFunc(selectRow),tF=useLatestFunc(updateRow),tL=useLatestFunc(selectCell),tN=useLatestFunc(({idx:e,rowIdx:n})=>{selectCell({rowIdx:e4+n-1,idx:e})});R(()=>{if(!tP||isSamePosition(e7,e9.current)){e9.current=e7;return}e9.current=e7,-1===e7.idx&&(tn.current.focus({preventScroll:!0}),scrollIntoView(tn.current))}),R(()=>{ti.current&&(ti.current=!1,focusCellOrCellContent())}),(0,i.useImperativeHandle)(n,()=>({element:eV.current,scrollToCell({idx:e,rowIdx:n}){let o=void 0!==e&&e>eH&&e{eB(e),tt.current=e},[]);function selectRow(e){if(!O)return;if(assertIsValidKeyGetter(g),"HEADER"===e.type){let n=new Set(T);for(let o of c){let i=g(o);e.checked?n.add(i):n.delete(i)}O(n);return}let{row:n,checked:o,isShiftClick:i}=e,s=new Set(T),u=g(n);if(o){s.add(u);let e=tr.current,o=c.indexOf(n);if(tr.current=o,i&&-1!==e&&e!==o){let n=x(o-e);for(let i=e+n;i!==o;i+=n){let e=c[i];s.add(g(e))}}}else s.delete(u),tr.current=-1;O(s)}function handleKeyDown(e){let{idx:n,rowIdx:o,mode:i}=e7;if("EDIT"===i)return;if($&&isRowIdxWithinViewportBounds(o)){let i=c[o],s=createCellEvent(e);if($({mode:"SELECT",row:i,column:eU[n],rowIdx:o,selectCell},s),s.isGridDefaultPrevented())return}if(!(e.target instanceof Element))return;let s=null!==e.target.closest(".rdg-cell"),u=ta&&e.target===tn.current;if(!s&&!u)return;let{keyCode:d}=e;if(tO&&(null!=J||null!=Q)&&isCtrlKeyHeldDown(e)){if(67===d){handleCopy();return}if(86===d){handlePaste();return}}switch(e.key){case"Escape":eI(null);return;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"Tab":case"Home":case"End":case"PageUp":case"PageDown":navigate(e);break;default:handleCellInput(e)}}function handleScroll(e){let{scrollTop:n,scrollLeft:o}=e.currentTarget;(0,s.flushSync)(()=>{eC(n),eE(w(o))}),G?.(e)}function updateRow(e,n,o){if("function"!=typeof y||o===c[n])return;let i=[...c];i[n]=o,y(i,{indexes:[n],column:e})}function commitEditorChanges(){"EDIT"===e7.mode&&updateRow(eU[e7.idx],e7.rowIdx,e7.row)}function handleCopy(){let{idx:e,rowIdx:n}=e7,o=c[n],i=eU[e].key;eI({row:o,columnKey:i}),Q?.({sourceRow:o,sourceColumnKey:i})}function handlePaste(){if(!J||!y||null===eR||!isCellEditable(e7))return;let{idx:e,rowIdx:n}=e7,o=eU[e],i=c[n],s=J({sourceRow:eR.row,sourceColumnKey:eR.columnKey,targetRow:i,targetColumnKey:o.key});updateRow(o,n,s)}function handleCellInput(e){if(!tO)return;let n=c[e7.rowIdx],{key:o,shiftKey:i}=e;if(tu&&i&&" "===o){assertIsValidKeyGetter(g);let o=g(n);selectRow({type:"ROW",row:n,checked:!T.has(o),isShiftClick:!1}),e.preventDefault();return}isCellEditable(e7)&&isDefaultCellInput(e)&&e8(({idx:e,rowIdx:o})=>({idx:e,rowIdx:o,mode:"EDIT",row:n,originalRow:n}))}function isRowIdxWithinViewportBounds(e){return e>=0&&e=e4&&n<=e6&&(o=e)>=tE&&o<=tT}function isCellWithinViewportBounds({idx:e,rowIdx:n}){var o;return isRowIdxWithinViewportBounds(n)&&(o=e)>=tE&&o<=tT}function isCellEditable(e){return isCellWithinViewportBounds(e)&&isSelectedCellEditable({columns:eU,rows:c,selectedPosition:e})}function selectCell(e,n){if(!isCellWithinSelectionBounds(e))return;commitEditorChanges();let o=c[e.rowIdx],i=isSamePosition(e7,e);n&&isCellEditable(e)?e8({...e,mode:"EDIT",row:o,originalRow:o}):i?scrollIntoView(getCellToScroll(eV.current)):(ti.current=!0,e8({...e,mode:"SELECT"})),H&&!i&&H({rowIdx:e.rowIdx,row:o,column:eU[e.idx]})}function getNextPosition(e,n,o){let{idx:i,rowIdx:s}=e7,u=tP&&-1===i;switch(e){case"ArrowUp":return{idx:i,rowIdx:s-1};case"ArrowDown":return{idx:i,rowIdx:s+1};case td:return{idx:i-1,rowIdx:s};case tf:return{idx:i+1,rowIdx:s};case"Tab":return{idx:i+(o?-1:1),rowIdx:s};case"Home":if(u)return{idx:i,rowIdx:e4};return{idx:0,rowIdx:n?e4:s};case"End":if(u)return{idx:i,rowIdx:e6};return{idx:tT,rowIdx:n?e6:s};case"PageUp":{if(e7.rowIdx===e4)return e7;let e=tx(s)+tw(s)-tl;return{idx:i,rowIdx:e>0?tS(e):0}}case"PageDown":{if(e7.rowIdx>=c.length)return e7;let e=tx(s)+tl;return{idx:i,rowIdx:ee&&e>=eD;return o?e7.idx:void 0}function focusCellOrCellContent(){let e=getCellToScroll(eV.current);if(null===e)return;scrollIntoView(e);let n=e.querySelector('[tabindex="0"]')??e;n.focus({preventScroll:!0})}function renderDragHandle(){if(null==X||"EDIT"===e7.mode||!isCellWithinViewportBounds(e7))return;let e=eU[e7.idx];if(null==e.renderEditCell||!1===e.editable)return;let n=eN(e);return(0,u.jsx)(DragHandle,{gridRowStart:e2+e7.rowIdx+1,rows:c,column:e,columnWidth:n,selectedPosition:e7,isCellEditable:isCellEditable,latestDraggedOverRowIdx:tt,onRowsChange:y,onClick:focusCellOrCellContent,onFill:X,setDragging:ej,setDraggedOverRowIdx:tV})}function getCellEditor(e){if(e7.rowIdx!==e||"SELECT"===e7.mode)return;let{idx:n,row:o}=e7,i=eU[n],d=getColSpan(i,eH,{type:"ROW",row:o}),closeEditor=e=>{ti.current=e,e8(({idx:e,rowIdx:n})=>({idx:e,rowIdx:n,mode:"SELECT"}))};return c[e7.rowIdx]!==e7.originalRow&&closeEditor(!1),(0,u.jsx)(EditCell,{column:i,colSpan:d,row:o,rowIdx:e,onRowChange:(e,n,o)=>{n?(0,s.flushSync)(()=>{updateRow(i,e7.rowIdx,e),closeEditor(o)}):e8(n=>({...n,row:e}))},closeEditor:closeEditor,onKeyDown:$,navigate:navigate},i.key)}function getRowViewportColumns(e){let n=-1===e7.idx?void 0:eU[e7.idx];return void 0===n||e7.rowIdx!==e||t_.includes(n)?t_:e7.idx>eK?[...t_,n]:[...t_.slice(0,eH+1),n,...t_.slice(eH+1)]}function getViewportRows(){let e=[],{idx:n,rowIdx:o}=e7,i=tO&&otv?tv+1:tv;for(let u=i;u<=s;u++){let i=u===tg-1||u===tv+1,s=i?o:u,d=t_,m=-1===n?void 0:eU[n];void 0!==m&&(d=i?[m]:getRowViewportColumns(s));let y=c[s],b=e2+s+1,x=s,w=!1;"function"==typeof g&&(x=g(y),w=T?.has(x)??!1),e.push(ev(x,{"aria-rowindex":e2+s+1,"aria-selected":tu?w:void 0,rowIdx:s,row:y,viewportColumns:d,isRowSelected:w,onCellClick:tM,onCellDoubleClick:tj,onCellContextMenu:tD,rowClass:eo,gridRowStart:b,height:tw(s),copiedCellIdx:null!==eR&&eR.row===y?eU.findIndex(e=>e.key===eR.columnKey):void 0,selectedCellIdx:o===s?n:void 0,draggedOverCellIdx:getDraggedOverCellIdx(s),setDraggedOverRowIdx:eM?tV:void 0,lastFrozenColumnIndex:eH,onRowChange:tF,selectCell:tL,selectedCellEditor:getCellEditor(s)}))}return e}(e7.idx>tT||e7.rowIdx>e6)&&(e8({idx:-1,rowIdx:e4-1,mode:"SELECT"}),tV(void 0));let tz=`repeat(${eG}, ${em}px)`;eJ>0&&(tz+=` repeat(${eJ}, ${eg}px)`),c.length>0&&(tz+=tb),e0>0&&(tz+=` repeat(${e0}, ${eg}px)`);let tW=-1===e7.idx&&e7.rowIdx!==e4-1;return(0,u.jsxs)("div",{role:ep,"aria-label":es,"aria-labelledby":el,"aria-describedby":eu,"aria-multiselectable":!!tu||void 0,"aria-colcount":eU.length,"aria-rowcount":tp,className:dist_clsx("rdg rnvodz57-0-0-beta-40",er,eM&&"rdg-viewport-dragging vlqv91k7-0-0-beta-40"),style:{...en,scrollPaddingInlineStart:e7.idx>eH||eF?.idx!==void 0?`${eQ}px`:void 0,scrollPaddingBlock:isRowIdxWithinViewportBounds(e7.rowIdx)||eF?.rowIdx!==void 0?`${ts+eJ*eg}px ${e0*eg}px`:void 0,gridTemplateColumns:tC,gridTemplateRows:tz,"--rdg-header-row-height":`${em}px`,"--rdg-summary-row-height":`${eg}px`,"--rdg-sign":tc?-1:1,...eX},dir:eS,ref:eV,onScroll:handleScroll,onKeyDown:handleKeyDown,"data-testid":ed,children:[(0,u.jsx)(_,{value:th,children:(0,u.jsxs)(P,{value:tB,children:[(0,u.jsxs)(E,{value:tm,children:[Array.from({length:e5},(e,n)=>(0,u.jsx)(L,{rowIdx:n+1,level:-e5+n,columns:getRowViewportColumns(e4+n),selectedCellIdx:e7.rowIdx===e4+n?e7.idx:void 0,selectCell:tN},n)),(0,u.jsx)(F,{rowIdx:eG,columns:getRowViewportColumns(e3),onColumnResize:tA,onColumnsReorder:tR,sortColumns:M,onSortColumnsChange:tI,lastFrozenColumnIndex:eH,selectedCellIdx:e7.rowIdx===e3?e7.idx:void 0,selectCell:tN,shouldFocusGrid:!tP,direction:eS})]}),0===c.length&&ex?ex:(0,u.jsxs)(u.Fragment,{children:[d?.map((e,n)=>{let o=eG+1+n,i=e3+1+n,s=e7.rowIdx===i,c=ts+eg*n;return u.jsx(U,{"aria-rowindex":o,rowIdx:i,gridRowStart:o,row:e,top:c,bottom:void 0,viewportColumns:getRowViewportColumns(i),lastFrozenColumnIndex:eH,selectedCellIdx:s?e7.idx:void 0,isTop:!0,showBorder:n===eJ-1,selectCell:tL},n)}),getViewportRows(),m?.map((e,n)=>{let o=e2+c.length+n+1,i=c.length+n,s=e7.rowIdx===i,d=tl>ty?eW-eg*(m.length-n):void 0,g=void 0===d?eg*(m.length-1-n):void 0;return u.jsx(U,{"aria-rowindex":tp-e0+n+1,rowIdx:i,gridRowStart:o,row:e,top:d,bottom:g,viewportColumns:getRowViewportColumns(i),lastFrozenColumnIndex:eH,selectedCellIdx:s?e7.idx:void 0,isTop:!1,showBorder:0===n,selectCell:tL},n)})]})]})}),renderDragHandle(),renderMeasuringCells(t_),ta&&(0,u.jsx)("div",{ref:tn,tabIndex:tW?0:-1,className:dist_clsx("f1lsfrzw7-0-0-beta-40",tW&&["r190mhd37-0-0-beta-40",-1!==eH&&"r139qu9m7-0-0-beta-40"],!isRowIdxWithinViewportBounds(e7.rowIdx)&&"f1cte0lg7-0-0-beta-40"),style:{gridRowStart:e7.rowIdx+e2+1}}),null!==eF&&(0,u.jsx)(ScrollToCell,{scrollToPosition:eF,setScrollToCellPosition:eL,gridElement:eV.current})]})}function getCellToScroll(e){return e.querySelector(':scope > [role="row"] > [tabindex="0"]')}function isSamePosition(e,n){return e.idx===n.idx&&e.rowIdx===n.rowIdx}let $=(0,i.forwardRef)(DataGrid);function autoFocusAndSelect(e){e?.focus(),e?.select()}function textEditor({row:e,column:n,onRowChange:o,onClose:i}){return(0,u.jsx)("input",{className:"rdg-text-editor t7vyx3i7-0-0-beta-40",ref:autoFocusAndSelect,value:e[n.key],onChange:i=>o({...e,[n.key]:i.target.value}),onBlur:()=>i(!0,!1)})}},90701:function(e,n,o){"use strict";o.d(n,{CR:function(){return __read},Jh:function(){return __generator},XA:function(){return __values},ZT:function(){return __extends},_T:function(){return __rest},ev:function(){return __spreadArray},mG:function(){return __awaiter},pi:function(){return __assign}});var extendStatics=function(e,n){return(extendStatics=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])})(e,n)};function __extends(e,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function __(){this.constructor=e}extendStatics(e,n),e.prototype=null===n?Object.create(n):(__.prototype=n.prototype,new __)}var __assign=function(){return(__assign=Object.assign||function(e){for(var n,o=1,i=arguments.length;on.indexOf(i)&&(o[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,i=Object.getOwnPropertySymbols(e);sn.indexOf(i[s])&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(o[i[s]]=e[i[s]]);return o}function __awaiter(e,n,o,i){function adopt(e){return e instanceof o?e:new o(function(n){n(e)})}return new(o||(o=Promise))(function(o,s){function fulfilled(e){try{step(i.next(e))}catch(e){s(e)}}function rejected(e){try{step(i.throw(e))}catch(e){s(e)}}function step(e){e.done?o(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,n||[])).next())})}function __generator(e,n){var o,i,s,u,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return u={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function verb(e){return function(n){return step([e,n])}}function step(d){if(o)throw TypeError("Generator is already executing.");for(;u&&(u=0,d[0]&&(c=0)),c;)try{if(o=1,i&&(s=2&d[0]?i.return:d[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,d[1])).done)return s;switch(i=0,s&&(d=[2&d[0],s.value]),d[0]){case 0:case 1:s=d;break;case 4:return c.label++,{value:d[1],done:!1};case 5:c.label++,i=d[1],d=[0];continue;case 7:d=c.ops.pop(),c.trys.pop();continue;default:if(!(s=(s=c.trys).length>0&&s[s.length-1])&&(6===d[0]||2===d[0])){c=0;continue}if(3===d[0]&&(!s||d[1]>s[0]&&d[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(e,n){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var i,s,u=o.call(e),c=[];try{for(;(void 0===n||n-- >0)&&!(i=u.next()).done;)c.push(i.value)}catch(e){s={error:e}}finally{try{i&&!i.done&&(o=u.return)&&o.call(u)}finally{if(s)throw s.error}}return c}function __spreadArray(e,n,o){if(o||2==arguments.length)for(var i,s=0,u=n.length;sn[o]||(n[o]=e(o));return(e,n)=>{let{regexp:o,keys:i}=getRegexp(e||""),s=o.exec(n);if(!s)return[!1,null];let u=i.reduce((e,n,o)=>(e[n.name]=s[o+1],e),{});return[!0,u]}}let escapeRx=e=>e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),rxForSegment=(e,n,o)=>{let i=e?"((?:[^\\/]+?)(?:\\/(?:[^\\/]+?))*)":"([^\\/]+?)";return n&&o&&(i="(?:\\/"+i+")"),i+(n?"?":"")},pathToRegexp=e=>{let n=/:([A-Za-z0-9_]+)([?+*]?)/g,o=null,i=0,s=[],u="";for(;null!==(o=n.exec(e));){let[c,d,m]=o,g="+"===m||"*"===m,y="?"===m||"*"===m,b=y&&"/"===e[o.index-1]?1:0,x=e.substring(i,o.index-b);s.push({name:d}),i=n.lastIndex,u+=escapeRx(x)+rxForSegment(g,y,b)}return{keys:s,regexp:RegExp("^"+(u+=escapeRx(e.substring(i)))+"(?:\\/)?$","i")}};var s=o(42445);let u={hook:i.ZP,matcher:makeMatcher(),base:""},c=(0,s.kr)(u),useRouter=()=>(0,s.qp)(c),useLocationFromRouter=e=>e.hook(e),useLocation=()=>useLocationFromRouter(useRouter()),useRoute=e=>{let n=useRouter(),[o]=useLocationFromRouter(n);return n.matcher(e,o)},d=(0,s.kr)({params:{}}),Router=({hook:e,matcher:n,ssrPath:o,base:i="",parent:d,children:m})=>{let updateRouter=(s,c=d||u)=>(s.hook=e||c.hook,s.matcher=n||c.matcher,s.ssrPath=o||c.ssrPath,s.ownBase=i,s.parent=d,s),[g]=(0,s.eJ)(()=>updateRouter({get base(){return(g.parent||u).base+g.ownBase}}));return(0,s.NU)(()=>{updateRouter(g)}),(0,s.az)(c.Provider,{value:g,children:m})},ParamsWrapper=(e,n)=>(0,s.az)(d.Provider,{value:{params:e},children:n}),Route=({path:e,match:n,component:o,children:i})=>{let u=useRoute(e),[c,d]=n||u;return c?o?ParamsWrapper(d,(0,s.az)(o,{params:d})):ParamsWrapper(d,"function"==typeof i?i(d):i):null};(0,s.Gp)((e,n)=>{let o=useRouter(),[,i]=useLocationFromRouter(o),{to:u,href:c=u,children:d,onClick:m}=e,g=(0,s.zX)(n=>{n.ctrlKey||n.metaKey||n.altKey||n.shiftKey||0!==n.button||(m&&m(n),n.defaultPrevented||(n.preventDefault(),i(u||c,e)))}),y={href:"~"===c[0]?c.slice(1):o.base+c,onClick:g,to:null,ref:n},b=(0,s.l$)(d)?d:(0,s.az)("a",e);return(0,s.Tm)(b,y)});let flattenChildren=e=>Array.isArray(e)?[].concat(...e.map(e=>e&&e.type===s.HY?flattenChildren(e.props.children):flattenChildren(e))):[e],Switch=({children:e,location:n})=>{let o=useRouter(),i=o.matcher,[u]=useLocationFromRouter(o);for(let o of flattenChildren(e)){let e=0;if((0,s.l$)(o)&&(e=o.props.path?i(o.props.path,n||u):[!0,{}])[0])return(0,s.Tm)(o,{match:e})}return null},Redirect=e=>{let{to:n,href:o=n}=e,[,i]=useLocation(),u=(0,s.zX)(()=>i(n||o,e));return(0,s.LI)(()=>{u()},[]),null}},42445:function(e,n,o){"use strict";o.d(n,{HY:function(){return i.Fragment},Tm:function(){return i.cloneElement},kr:function(){return i.createContext},az:function(){return i.createElement},Gp:function(){return i.forwardRef},l$:function(){return i.isValidElement},qp:function(){return i.useContext},zX:function(){return useEvent},NU:function(){return x},LI:function(){return b},eJ:function(){return i.useState},$N:function(){return u.useSyncExternalStore}});var i=o(27726),s=o.t(i,2),u=o(33916);let{useEffect:c,useLayoutEffect:d,useRef:m,useInsertionEffect:g}=s,y=!!("undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement),b=y?d:c,x=g||b,useEvent=e=>{let n=m([e,(...e)=>n[0](...e)]).current;return x(()=>{n[0]=e}),n[1]}},72952:function(e,n,o){"use strict";o.d(n,{ZP:function(){return use_location},c4:function(){return use_location_navigate},LD:function(){return useLocationProperty}});var i=o(42445);let relativePath=(e="",n=location.pathname)=>n.toLowerCase().indexOf(e.toLowerCase())?"~"+n:n.slice(e.length)||"/",absolutePath=(e,n="")=>"~"===e[0]?e.slice(1):n+e,s="pushState",u="replaceState",c=["popstate",s,u,"hashchange"],subscribeToLocationUpdates=e=>{for(let n of c)addEventListener(n,e);return()=>{for(let n of c)removeEventListener(n,e)}},useLocationProperty=(e,n)=>(0,i.$N)(subscribeToLocationUpdates,e,n),currentPathname=()=>location.pathname,usePathname=({ssrPath:e}={})=>useLocationProperty(currentPathname,e?()=>e:currentPathname),use_location_navigate=(e,{replace:n=!1}={})=>history[n?u:s](null,"",e);var use_location=(e={})=>[relativePath(e.base,usePathname(e)),(0,i.zX)((n,o)=>use_location_navigate(absolutePath(n,e.base),o))];if("undefined"!=typeof history)for(let e of[s,u]){let n=history[e];history[e]=function(){let o=n.apply(this,arguments),i=new Event(e);return i.arguments=arguments,dispatchEvent(i),o}}},1475:function(e,n,o){"use strict";function shallow$1(e,n){if(Object.is(e,n))return!0;if("object"!=typeof e||null===e||"object"!=typeof n||null===n)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(let[o,i]of e)if(!Object.is(i,n.get(o)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(let o of e)if(!n.has(o))return!1;return!0}let o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;for(let i=0;i{let n;let o=new Set,setState=(e,i)=>{let s="function"==typeof e?e(n):e;if(!Object.is(s,n)){let e=n;n=(null!=i?i:"object"!=typeof s)?s:Object.assign({},n,s),o.forEach(o=>o(n,e))}},getState=()=>n,i={setState,getState,subscribe:e=>(o.add(e),()=>o.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),o.clear()}};return n=e(setState,getState,i),i},createStore=e=>e?createStoreImpl(e):createStoreImpl,{useDebugValue:u}=i,{useSyncExternalStoreWithSelector:c}=s;function useStoreWithEqualityFn(e,n=e.getState,o){let i=c(e.subscribe,e.getState,e.getServerState||e.getState,n,o);return u(i),i}let createWithEqualityFnImpl=(e,n)=>{let o=createStore(e),useBoundStoreWithEqualityFn=(e,i=n)=>useStoreWithEqualityFn(o,e,i);return Object.assign(useBoundStoreWithEqualityFn,o),useBoundStoreWithEqualityFn},createWithEqualityFn=(e,n)=>e?createWithEqualityFnImpl(e,n):createWithEqualityFnImpl}}]); \ No newline at end of file + `),()=>{document.head.removeChild(m)}},[n]),i.createElement(PopChildMeasure,{isPresent:n,childRef:s,sizeRef:u},i.cloneElement(e,{ref:s}))}let PresenceChild=({children:e,initial:n,isPresent:o,onExitComplete:s,custom:u,presenceAffectsLayout:m,mode:g})=>{let y=(0,d.h)(newChildrenMap),b=(0,i.useId)(),x=(0,i.useMemo)(()=>({id:b,initial:n,isPresent:o,custom:u,onExitComplete:e=>{for(let n of(y.set(e,!0),y.values()))if(!n)return;s&&s()},register:e=>(y.set(e,!1),()=>y.delete(e))}),m?void 0:[o]);return(0,i.useMemo)(()=>{y.forEach((e,n)=>y.set(n,!1))},[o]),i.useEffect(()=>{o||y.size||!s||s()},[o]),"popLayout"===g&&(e=i.createElement(PopChild,{isPresent:o},e)),i.createElement(c.O.Provider,{value:x},e)};function newChildrenMap(){return new Map}var m=o(1369);function useUnmountEffect(e){return(0,i.useEffect)(()=>()=>e(),[])}var g=o(316);let getChildKey=e=>e.key||"";function updateChildLookup(e,n){e.forEach(e=>{let o=getChildKey(e);n.set(o,e)})}function onlyElements(e){let n=[];return i.Children.forEach(e,e=>{(0,i.isValidElement)(e)&&n.push(e)}),n}let AnimatePresence=({children:e,custom:n,initial:o=!0,onExitComplete:u,exitBeforeEnter:c,presenceAffectsLayout:d=!0,mode:y="sync"})=>{(0,g.k)(!c,"Replace exitBeforeEnter with mode='wait'");let b=(0,i.useContext)(m.p).forceRender||useForceUpdate()[0],x=useIsMounted(),w=onlyElements(e),S=w,_=(0,i.useRef)(new Map).current,C=(0,i.useRef)(S),E=(0,i.useRef)(new Map).current,T=(0,i.useRef)(!0);if((0,s.L)(()=>{T.current=!1,updateChildLookup(w,E),C.current=S}),useUnmountEffect(()=>{T.current=!0,E.clear(),_.clear()}),T.current)return i.createElement(i.Fragment,null,S.map(e=>i.createElement(PresenceChild,{key:getChildKey(e),isPresent:!0,initial:!!o&&void 0,presenceAffectsLayout:d,mode:y},e)));S=[...S];let P=C.current.map(getChildKey),O=w.map(getChildKey),R=P.length;for(let e=0;e{if(-1!==O.indexOf(o))return;let s=E.get(o);if(!s)return;let c=P.indexOf(o),m=e;m||(m=i.createElement(PresenceChild,{key:getChildKey(s),isPresent:!1,onExitComplete:()=>{E.delete(o),_.delete(o);let e=C.current.findIndex(e=>e.key===o);if(C.current.splice(e,1),!_.size){if(C.current=w,!1===x.current)return;b(),u&&u()}},custom:n,presenceAffectsLayout:d,mode:y},s),_.set(o,m)),S.splice(c,0,m)}),S=S.map(e=>{let n=e.key;return _.has(n)?e:i.createElement(PresenceChild,{key:getChildKey(e),isPresent:!0,presenceAffectsLayout:d,mode:y},e)}),i.createElement(i.Fragment,null,_.size?S:S.map(e=>(0,i.cloneElement)(e)))}},27038:function(e,n,o){"use strict";o.d(n,{hO:function(){return useIsPresent},oO:function(){return usePresence}});var i=o(27726),s=o(53046);function usePresence(){let e=(0,i.useContext)(s.O);if(null===e)return[!0,null];let{isPresent:n,onExitComplete:o,register:u}=e,c=(0,i.useId)();return(0,i.useEffect)(()=>u(c),[]),!n&&o?[!1,()=>o&&o(c)]:[!0]}function useIsPresent(){return isPresent((0,i.useContext)(s.O))}function isPresent(e){return null===e||e.isPresent}},1369:function(e,n,o){"use strict";o.d(n,{p:function(){return s}});var i=o(27726);let s=(0,i.createContext)({})},53046:function(e,n,o){"use strict";o.d(n,{O:function(){return s}});var i=o(27726);let s=(0,i.createContext)(null)},74489:function(e,n,o){"use strict";o.d(n,{Pn:function(){return c},Wi:function(){return u},frameData:function(){return d},S6:function(){return m}});var i=o(68390);let Queue=class Queue{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){let n=this.order.indexOf(e);-1!==n&&(this.order.splice(n,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}};function createRenderStep(e){let n=new Queue,o=new Queue,i=0,s=!1,u=!1,c=new WeakSet,d={schedule:(e,u=!1,d=!1)=>{let m=d&&s,g=m?n:o;return u&&c.add(e),g.add(e)&&m&&s&&(i=n.order.length),e},cancel:e=>{o.remove(e),c.delete(e)},process:m=>{if(s){u=!0;return}if(s=!0,[n,o]=[o,n],o.clear(),i=n.order.length)for(let o=0;o(e[n]=createRenderStep(()=>o=!0),e),{}),processStep=e=>c[e].process(u),processBatch=()=>{let c=performance.now();o=!1,u.delta=i?1e3/60:Math.max(Math.min(c-u.timestamp,40),1),u.timestamp=c,u.isProcessing=!0,s.forEach(processStep),u.isProcessing=!1,o&&n&&(i=!1,e(processBatch))},wake=()=>{o=!0,i=!0,u.isProcessing||e(processBatch)},d=s.reduce((e,n)=>{let i=c[n];return e[n]=(e,n=!1,s=!1)=>(o||wake(),i.schedule(e,n,s)),e},{});return{schedule:d,cancel:e=>s.forEach(n=>c[n].cancel(e)),state:u,steps:c}}let{schedule:u,cancel:c,state:d,steps:m}=createRenderBatcher("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:i.Z,!0)},89977:function(e,n,o){"use strict";o.d(n,{E:function(){return tP}});var i=o(27726);let s=(0,i.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),u=(0,i.createContext)({});var c=o(53046),d=o(90529);let m=(0,i.createContext)({strict:!1});function useVisualElement(e,n,o,g){let{visualElement:y}=(0,i.useContext)(u),b=(0,i.useContext)(m),x=(0,i.useContext)(c.O),w=(0,i.useContext)(s).reducedMotion,S=(0,i.useRef)();g=g||b.renderer,!S.current&&g&&(S.current=g(e,{visualState:n,parent:y,props:o,presenceContext:x,blockInitialAnimation:!!x&&!1===x.initial,reducedMotionConfig:w}));let _=S.current;(0,i.useInsertionEffect)(()=>{_&&_.update(o,x)});let C=(0,i.useRef)(!!window.HandoffAppearAnimations);return(0,d.L)(()=>{_&&(_.render(),C.current&&_.animationState&&_.animationState.animateChanges())}),(0,i.useEffect)(()=>{_&&(_.updateFeatures(),!C.current&&_.animationState&&_.animationState.animateChanges(),window.HandoffAppearAnimations=void 0,C.current=!1)}),_}function isRefObject(e){return"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function useMotionRef(e,n,o){return(0,i.useCallback)(i=>{i&&e.mount&&e.mount(i),n&&(i?n.mount(i):n.unmount()),o&&("function"==typeof o?o(i):isRefObject(o)&&(o.current=i))},[n])}function isVariantLabel(e){return"string"==typeof e||Array.isArray(e)}function isAnimationControls(e){return"object"==typeof e&&"function"==typeof e.start}let g=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],y=["initial",...g];function isControllingVariants(e){return isAnimationControls(e.animate)||y.some(n=>isVariantLabel(e[n]))}function isVariantNode(e){return!!(isControllingVariants(e)||e.variants)}function getCurrentTreeVariants(e,n){if(isControllingVariants(e)){let{initial:n,animate:o}=e;return{initial:!1===n||isVariantLabel(n)?n:void 0,animate:isVariantLabel(o)?o:void 0}}return!1!==e.inherit?n:{}}function useCreateMotionContext(e){let{initial:n,animate:o}=getCurrentTreeVariants(e,(0,i.useContext)(u));return(0,i.useMemo)(()=>({initial:n,animate:o}),[variantLabelsAsDependency(n),variantLabelsAsDependency(o)])}function variantLabelsAsDependency(e){return Array.isArray(e)?e.join(" "):e}let b={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},x={};for(let e in b)x[e]={isEnabled:n=>b[e].some(e=>!!n[e])};function loadFeatures(e){for(let n in e)x[n]={...x[n],...e[n]}}var w=o(99228),S=o(1369);let _=(0,i.createContext)({}),C=Symbol.for("motionComponentSymbol");function motion_createMotionComponent({preloadedFeatures:e,createVisualElement:n,useRender:o,useVisualState:c,Component:d}){function MotionComponent(g,y){let b;let x={...(0,i.useContext)(s),...g,layoutId:useLayoutId(g)},{isStatic:S}=x,C=useCreateMotionContext(g),E=c(g,S);if(!S&&w.j){C.visualElement=useVisualElement(d,E,x,n);let o=(0,i.useContext)(_),s=(0,i.useContext)(m).strict;C.visualElement&&(b=C.visualElement.loadFeatures(x,s,e,o))}return i.createElement(u.Provider,{value:C},b&&C.visualElement?i.createElement(b,{visualElement:C.visualElement,...x}):null,o(d,g,useMotionRef(E,C.visualElement,y),E,S,C.visualElement))}e&&loadFeatures(e);let g=(0,i.forwardRef)(MotionComponent);return g[C]=d,g}function useLayoutId({layoutId:e}){let n=(0,i.useContext)(S.p).id;return n&&void 0!==e?n+"-"+e:e}function createMotionProxy(e){function custom(n,o={}){return motion_createMotionComponent(e(n,o))}if("undefined"==typeof Proxy)return custom;let n=new Map;return new Proxy(custom,{get:(e,o)=>(n.has(o)||n.set(o,custom(o)),n.get(o))})}let E=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function isSVGComponent(e){if("string"!=typeof e||e.includes("-"));else if(E.indexOf(e)>-1||/[A-Z]/.test(e))return!0;return!1}let T={};function addScaleCorrector(e){Object.assign(T,e)}let P=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],O=new Set(P);function isForcedMotionValue(e,{layout:n,layoutId:o}){return O.has(e)||e.startsWith("origin")||(n||void 0!==o)&&(!!T[e]||"opacity"===e)}let isMotionValue=e=>!!(e&&e.getVelocity),R={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},M=P.length;function buildTransform(e,{enableHardwareAcceleration:n=!0,allowTransformNone:o=!0},i,s){let u="";for(let n=0;nn=>"string"==typeof n&&n.startsWith(e),j=checkStringStartsWith("--"),B=checkStringStartsWith("var(--"),getValueAsType=(e,n)=>n&&"number"==typeof e?n.transform(e):e,clamp=(e,n,o)=>Math.min(Math.max(o,e),n),F={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},L={...F,transform:e=>clamp(0,1,e)},N={...F,default:1},sanitize=e=>Math.round(1e5*e)/1e5,V=/(-)?([\d]*\.?[\d])+/g,W=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,U=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function isString(e){return"string"==typeof e}let createUnitType=e=>({test:n=>isString(n)&&n.endsWith(e)&&1===n.split(" ").length,parse:parseFloat,transform:n=>`${n}${e}`}),$=createUnitType("deg"),H=createUnitType("%"),G=createUnitType("px"),K=createUnitType("vh"),Y=createUnitType("vw"),X={...H,parse:e=>H.parse(e)/100,transform:e=>H.transform(100*e)},Q={...F,transform:Math.round},J={borderWidth:G,borderTopWidth:G,borderRightWidth:G,borderBottomWidth:G,borderLeftWidth:G,borderRadius:G,radius:G,borderTopLeftRadius:G,borderTopRightRadius:G,borderBottomRightRadius:G,borderBottomLeftRadius:G,width:G,maxWidth:G,height:G,maxHeight:G,size:G,top:G,right:G,bottom:G,left:G,padding:G,paddingTop:G,paddingRight:G,paddingBottom:G,paddingLeft:G,margin:G,marginTop:G,marginRight:G,marginBottom:G,marginLeft:G,rotate:$,rotateX:$,rotateY:$,rotateZ:$,scale:N,scaleX:N,scaleY:N,scaleZ:N,skew:$,skewX:$,skewY:$,distance:G,translateX:G,translateY:G,translateZ:G,x:G,y:G,z:G,perspective:G,transformPerspective:G,opacity:L,originX:X,originY:X,originZ:G,zIndex:Q,fillOpacity:L,strokeOpacity:L,numOctaves:Q};function buildHTMLStyles(e,n,o,i){let{style:s,vars:u,transform:c,transformOrigin:d}=e,m=!1,g=!1,y=!0;for(let e in n){let o=n[e];if(j(e)){u[e]=o;continue}let i=J[e],b=getValueAsType(o,i);if(O.has(e)){if(m=!0,c[e]=b,!y)continue;o!==(i.default||0)&&(y=!1)}else e.startsWith("origin")?(g=!0,d[e]=b):s[e]=b}if(!n.transform&&(m||i?s.transform=buildTransform(e.transform,o,y,i):s.transform&&(s.transform="none")),g){let{originX:e="50%",originY:n="50%",originZ:o=0}=d;s.transformOrigin=`${e} ${n} ${o}`}}let createHtmlRenderState=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function copyRawValuesOnly(e,n,o){for(let i in n)isMotionValue(n[i])||isForcedMotionValue(i,o)||(e[i]=n[i])}function useInitialMotionValues({transformTemplate:e},n,o){return(0,i.useMemo)(()=>{let i=createHtmlRenderState();return buildHTMLStyles(i,n,{enableHardwareAcceleration:!o},e),Object.assign({},i.vars,i.style)},[n])}function useStyle(e,n,o){let i=e.style||{},s={};return copyRawValuesOnly(s,i,e),Object.assign(s,useInitialMotionValues(e,n,o)),e.transformValues?e.transformValues(s):s}function useHTMLProps(e,n,o){let i={},s=useStyle(e,n,o);return e.drag&&!1!==e.dragListener&&(i.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(i.tabIndex=0),i.style=s,i}let ee=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function isValidMotionProp(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||ee.has(e)}let shouldForward=e=>!isValidMotionProp(e);function loadExternalIsValidProp(e){e&&(shouldForward=n=>n.startsWith("on")?!isValidMotionProp(n):e(n))}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch(e){}function filterProps(e,n,o){let i={};for(let s in e)("values"!==s||"object"!=typeof e.values)&&(shouldForward(s)||!0===o&&isValidMotionProp(s)||!n&&!isValidMotionProp(s)||e.draggable&&s.startsWith("onDrag"))&&(i[s]=e[s]);return i}function calcOrigin(e,n,o){return"string"==typeof e?e:G.transform(n+o*e)}function calcSVGTransformOrigin(e,n,o){let i=calcOrigin(n,e.x,e.width),s=calcOrigin(o,e.y,e.height);return`${i} ${s}`}let et={offset:"stroke-dashoffset",array:"stroke-dasharray"},er={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(e,n,o=1,i=0,s=!0){e.pathLength=1;let u=s?et:er;e[u.offset]=G.transform(-i);let c=G.transform(n),d=G.transform(o);e[u.array]=`${c} ${d}`}function buildSVGAttrs(e,{attrX:n,attrY:o,attrScale:i,originX:s,originY:u,pathLength:c,pathSpacing:d=1,pathOffset:m=0,...g},y,b,x){if(buildHTMLStyles(e,g,y,x),b){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:w,style:S,dimensions:_}=e;w.transform&&(_&&(S.transform=w.transform),delete w.transform),_&&(void 0!==s||void 0!==u||S.transform)&&(S.transformOrigin=calcSVGTransformOrigin(_,void 0!==s?s:.5,void 0!==u?u:.5)),void 0!==n&&(w.x=n),void 0!==o&&(w.y=o),void 0!==i&&(w.scale=i),void 0!==c&&buildSVGPath(w,c,d,m,!1)}let createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=e=>"string"==typeof e&&"svg"===e.toLowerCase();function useSVGProps(e,n,o,s){let u=(0,i.useMemo)(()=>{let o=createSvgRenderState();return buildSVGAttrs(o,n,{enableHardwareAcceleration:!1},isSVGTag(s),e.transformTemplate),{...o.attrs,style:{...o.style}}},[n]);if(e.style){let n={};copyRawValuesOnly(n,e.style,e),u.style={...n,...u.style}}return u}function createUseRender(e=!1){return(n,o,s,{latestValues:u},c)=>{let d=isSVGComponent(n)?useSVGProps:useHTMLProps,m=d(o,u,c,n),g=filterProps(o,"string"==typeof n,e),y={...g,...m,ref:s},{children:b}=o,x=(0,i.useMemo)(()=>isMotionValue(b)?b.get():b,[b]);return(0,i.createElement)(n,{...y,children:x})}}let camelToDash=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function renderHTML(e,{style:n,vars:o},i,s){for(let u in Object.assign(e.style,n,s&&s.getProjectionStyles(i)),o)e.style.setProperty(u,o[u])}let en=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function renderSVG(e,n,o,i){for(let o in renderHTML(e,n,void 0,i),n.attrs)e.setAttribute(en.has(o)?o:camelToDash(o),n.attrs[o])}function scrapeMotionValuesFromProps(e,n){let{style:o}=e,i={};for(let s in o)(isMotionValue(o[s])||n.style&&isMotionValue(n.style[s])||isForcedMotionValue(s,e))&&(i[s]=o[s]);return i}function scrape_motion_values_scrapeMotionValuesFromProps(e,n){let o=scrapeMotionValuesFromProps(e,n);for(let i in e)if(isMotionValue(e[i])||isMotionValue(n[i])){let n=-1!==P.indexOf(i)?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;o[n]=e[i]}return o}function resolveVariantFromProps(e,n,o,i={},s={}){return"function"==typeof n&&(n=n(void 0!==o?o:e.custom,i,s)),"string"==typeof n&&(n=e.variants&&e.variants[n]),"function"==typeof n&&(n=n(void 0!==o?o:e.custom,i,s)),n}var eo=o(740);let isKeyframesTarget=e=>Array.isArray(e),isCustomValue=e=>!!(e&&"object"==typeof e&&e.mix&&e.toValue),resolveFinalValueInKeyframes=e=>isKeyframesTarget(e)?e[e.length-1]||0:e;function resolveMotionValue(e){let n=isMotionValue(e)?e.get():e;return isCustomValue(n)?n.toValue():n}function makeState({scrapeMotionValuesFromProps:e,createRenderState:n,onMount:o},i,s,u){let c={latestValues:makeLatestValues(i,s,u,e),renderState:n()};return o&&(c.mount=e=>o(i,e,c)),c}let makeUseVisualState=e=>(n,o)=>{let s=(0,i.useContext)(u),d=(0,i.useContext)(c.O),make=()=>makeState(e,n,s,d);return o?make():(0,eo.h)(make)};function makeLatestValues(e,n,o,i){let s={},u=i(e,{});for(let e in u)s[e]=resolveMotionValue(u[e]);let{initial:c,animate:d}=e,m=isControllingVariants(e),g=isVariantNode(e);n&&g&&!m&&!1!==e.inherit&&(void 0===c&&(c=n.initial),void 0===d&&(d=n.animate));let y=!!o&&!1===o.initial;y=y||!1===c;let b=y?d:c;if(b&&"boolean"!=typeof b&&!isAnimationControls(b)){let n=Array.isArray(b)?b:[b];n.forEach(n=>{let o=resolveVariantFromProps(e,n);if(!o)return;let{transitionEnd:i,transition:u,...c}=o;for(let e in c){let n=c[e];if(Array.isArray(n)){let e=y?n.length-1:0;n=n[e]}null!==n&&(s[e]=n)}for(let e in i)s[e]=i[e]})}return s}var ei=o(74489);let ea={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrape_motion_values_scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:(e,n,{renderState:o,latestValues:i})=>{ei.Wi.read(()=>{try{o.dimensions="function"==typeof n.getBBox?n.getBBox():n.getBoundingClientRect()}catch(e){o.dimensions={x:0,y:0,width:0,height:0}}}),ei.Wi.render(()=>{buildSVGAttrs(o,i,{enableHardwareAcceleration:!1},isSVGTag(n.tagName),e.transformTemplate),renderSVG(n,o)})}})},es={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps,createRenderState:createHtmlRenderState})};function create_config_createDomMotionConfig(e,{forwardMotionProps:n=!1},o,i){let s=isSVGComponent(e)?ea:es;return{...s,preloadedFeatures:o,useRender:createUseRender(n),createVisualElement:i,Component:e}}function addDomEvent(e,n,o,i={passive:!0}){return e.addEventListener(n,o,i),()=>e.removeEventListener(n,o)}let isPrimaryPointer=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function extractEventInfo(e,n="page"){return{point:{x:e[n+"X"],y:e[n+"Y"]}}}let addPointerInfo=e=>n=>isPrimaryPointer(n)&&e(n,extractEventInfo(n));function addPointerEvent(e,n,o,i){return addDomEvent(e,n,addPointerInfo(o),i)}let combineFunctions=(e,n)=>o=>n(e(o)),pipe=(...e)=>e.reduce(combineFunctions);function createLock(e){let n=null;return()=>null===n&&(n=e,()=>{n=null})}let el=createLock("dragHorizontal"),eu=createLock("dragVertical");function getGlobalLock(e){let n=!1;if("y"===e)n=eu();else if("x"===e)n=el();else{let e=el(),o=eu();e&&o?n=()=>{e(),o()}:(e&&e(),o&&o())}return n}function isDragActive(){let e=getGlobalLock(!0);return!e||(e(),!1)}let Feature=class Feature{constructor(e){this.isMounted=!1,this.node=e}update(){}};function addHoverEvent(e,n){let o="pointer"+(n?"enter":"leave"),i="onHover"+(n?"Start":"End");return addPointerEvent(e.current,o,(o,s)=>{if("touch"===o.type||isDragActive())return;let u=e.getProps();e.animationState&&u.whileHover&&e.animationState.setActive("whileHover",n),u[i]&&ei.Wi.update(()=>u[i](o,s))},{passive:!e.getProps()[i]})}let HoverGesture=class HoverGesture extends Feature{mount(){this.unmount=pipe(addHoverEvent(this.node,!0),addHoverEvent(this.node,!1))}unmount(){}};let FocusGesture=class FocusGesture extends Feature{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(n){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=pipe(addDomEvent(this.node.current,"focus",()=>this.onFocus()),addDomEvent(this.node.current,"blur",()=>this.onBlur()))}unmount(){}};let isNodeOrChild=(e,n)=>!!n&&(e===n||isNodeOrChild(e,n.parentElement));var ec=o(68390);function fireSyntheticPointerEvent(e,n){if(!n)return;let o=new PointerEvent("pointer"+e);n(o,extractEventInfo(o))}let PressGesture=class PressGesture extends Feature{constructor(){super(...arguments),this.removeStartListeners=ec.Z,this.removeEndListeners=ec.Z,this.removeAccessibleListeners=ec.Z,this.startPointerPress=(e,n)=>{if(this.removeEndListeners(),this.isPressing)return;let o=this.node.getProps(),i=addPointerEvent(window,"pointerup",(e,n)=>{if(!this.checkPressEnd())return;let{onTap:o,onTapCancel:i}=this.node.getProps();ei.Wi.update(()=>{isNodeOrChild(this.node.current,e.target)?o&&o(e,n):i&&i(e,n)})},{passive:!(o.onTap||o.onPointerUp)}),s=addPointerEvent(window,"pointercancel",(e,n)=>this.cancelPress(e,n),{passive:!(o.onTapCancel||o.onPointerCancel)});this.removeEndListeners=pipe(i,s),this.startPress(e,n)},this.startAccessiblePress=()=>{let e=addDomEvent(this.node.current,"keydown",e=>{"Enter"!==e.key||this.isPressing||(this.removeEndListeners(),this.removeEndListeners=addDomEvent(this.node.current,"keyup",e=>{"Enter"===e.key&&this.checkPressEnd()&&fireSyntheticPointerEvent("up",(e,n)=>{let{onTap:o}=this.node.getProps();o&&ei.Wi.update(()=>o(e,n))})}),fireSyntheticPointerEvent("down",(e,n)=>{this.startPress(e,n)}))}),n=addDomEvent(this.node.current,"blur",()=>{this.isPressing&&fireSyntheticPointerEvent("cancel",(e,n)=>this.cancelPress(e,n))});this.removeAccessibleListeners=pipe(e,n)}}startPress(e,n){this.isPressing=!0;let{onTapStart:o,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),o&&ei.Wi.update(()=>o(e,n))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;let e=this.node.getProps();return e.whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!isDragActive()}cancelPress(e,n){if(!this.checkPressEnd())return;let{onTapCancel:o}=this.node.getProps();o&&ei.Wi.update(()=>o(e,n))}mount(){let e=this.node.getProps(),n=addPointerEvent(this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),o=addDomEvent(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=pipe(n,o)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}};let ed=new WeakMap,ef=new WeakMap,fireObserverCallback=e=>{let n=ed.get(e.target);n&&n(e)},fireAllObserverCallbacks=e=>{e.forEach(fireObserverCallback)};function initIntersectionObserver({root:e,...n}){let o=e||document;ef.has(o)||ef.set(o,{});let i=ef.get(o),s=JSON.stringify(n);return i[s]||(i[s]=new IntersectionObserver(fireAllObserverCallbacks,{root:e,...n})),i[s]}function observeIntersection(e,n,o){let i=initIntersectionObserver(n);return ed.set(e,o),i.observe(e),()=>{ed.delete(e),i.unobserve(e)}}let ep={some:0,all:1};let InViewFeature=class InViewFeature extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:n,margin:o,amount:i="some",once:s}=e,u={root:n?n.current:void 0,rootMargin:o,threshold:"number"==typeof i?i:ep[i]};return observeIntersection(this.node.current,u,e=>{let{isIntersecting:n}=e;if(this.isInView===n||(this.isInView=n,s&&!n&&this.hasEnteredView))return;n&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",n);let{onViewportEnter:o,onViewportLeave:i}=this.node.getProps(),u=n?o:i;u&&u(e)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;let{props:e,prevProps:n}=this.node,o=["amount","margin","root"].some(hasViewportOptionChanged(e,n));o&&this.startObserver()}unmount(){}};function hasViewportOptionChanged({viewport:e={}},{viewport:n={}}={}){return o=>e[o]!==n[o]}function shallowCompare(e,n){if(!Array.isArray(n))return!1;let o=n.length;if(o!==e.length)return!1;for(let i=0;in[o]=e.get()),n}function getVelocity(e){let n={};return e.values.forEach((e,o)=>n[o]=e.getVelocity()),n}function resolveVariant(e,n,o){let i=e.getProps();return resolveVariantFromProps(i,n,void 0!==o?o:i.custom,getCurrent(e),getVelocity(e))}let eh="data-"+camelToDash("framerAppearId");var em=o(316);let secondsToMilliseconds=e=>1e3*e,millisecondsToSeconds=e=>e/1e3,eg={current:!1},isBezierDefinition=e=>Array.isArray(e)&&"number"==typeof e[0];function isWaapiSupportedEasing(e){return!!(!e||"string"==typeof e&&ev[e]||isBezierDefinition(e)||Array.isArray(e)&&e.every(isWaapiSupportedEasing))}let cubicBezierAsString=([e,n,o,i])=>`cubic-bezier(${e}, ${n}, ${o}, ${i})`,ev={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cubicBezierAsString([0,.65,.55,1]),circOut:cubicBezierAsString([.55,0,1,.45]),backIn:cubicBezierAsString([.31,.01,.66,-.59]),backOut:cubicBezierAsString([.33,1.53,.69,.99])};function mapEasingToNativeEasing(e){if(e)return isBezierDefinition(e)?cubicBezierAsString(e):Array.isArray(e)?e.map(mapEasingToNativeEasing):ev[e]}function animateStyle(e,n,o,{delay:i=0,duration:s,repeat:u=0,repeatType:c="loop",ease:d,times:m}={}){let g={[n]:o};m&&(g.offset=m);let y=mapEasingToNativeEasing(d);return Array.isArray(y)&&(g.easing=y),e.animate(g,{delay:i,duration:s,easing:Array.isArray(y)?"linear":y,fill:"both",iterations:u+1,direction:"reverse"===c?"alternate":"normal"})}function getFinalKeyframe(e,{repeat:n,repeatType:o="loop"}){let i=n&&"loop"!==o&&n%2==1?0:e.length-1;return e[i]}let calcBezier=(e,n,o)=>(((1-3*o+3*n)*e+(3*o-6*n))*e+3*n)*e;function binarySubdivide(e,n,o,i,s){let u,c;let d=0;do(u=calcBezier(c=n+(o-n)/2,i,s)-e)>0?o=c:n=c;while(Math.abs(u)>1e-7&&++d<12);return c}function cubicBezier(e,n,o,i){if(e===n&&o===i)return ec.Z;let getTForX=n=>binarySubdivide(n,0,1,e,o);return e=>0===e||1===e?e:calcBezier(getTForX(e),n,i)}let ey=cubicBezier(.42,0,1,1),eb=cubicBezier(0,0,.58,1),ex=cubicBezier(.42,0,.58,1),isEasingArray=e=>Array.isArray(e)&&"number"!=typeof e[0],mirrorEasing=e=>n=>n<=.5?e(2*n)/2:(2-e(2*(1-n)))/2,reverseEasing=e=>n=>1-e(1-n),circIn=e=>1-Math.sin(Math.acos(e)),ew=reverseEasing(circIn),eS=mirrorEasing(ew),e_=cubicBezier(.33,1.53,.69,.99),eC=reverseEasing(e_),ek=mirrorEasing(eC),eE={linear:ec.Z,easeIn:ey,easeInOut:ex,easeOut:eb,circIn:circIn,circInOut:eS,circOut:ew,backIn:eC,backInOut:ek,backOut:e_,anticipate:e=>(e*=2)<1?.5*eC(e):.5*(2-Math.pow(2,-10*(e-1)))},easingDefinitionToFunction=e=>{if(Array.isArray(e)){(0,em.k)(4===e.length,"Cubic bezier arrays must contain four numerical values.");let[n,o,i,s]=e;return cubicBezier(n,o,i,s)}return"string"==typeof e?((0,em.k)(void 0!==eE[e],`Invalid easing type '${e}'`),eE[e]):e},isColorString=(e,n)=>o=>!!(isString(o)&&U.test(o)&&o.startsWith(e)||n&&Object.prototype.hasOwnProperty.call(o,n)),splitColor=(e,n,o)=>i=>{if(!isString(i))return i;let[s,u,c,d]=i.match(V);return{[e]:parseFloat(s),[n]:parseFloat(u),[o]:parseFloat(c),alpha:void 0!==d?parseFloat(d):1}},clampRgbUnit=e=>clamp(0,255,e),eT={...F,transform:e=>Math.round(clampRgbUnit(e))},eP={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:e,green:n,blue:o,alpha:i=1})=>"rgba("+eT.transform(e)+", "+eT.transform(n)+", "+eT.transform(o)+", "+sanitize(L.transform(i))+")"};function parseHex(e){let n="",o="",i="",s="";return e.length>5?(n=e.substring(1,3),o=e.substring(3,5),i=e.substring(5,7),s=e.substring(7,9)):(n=e.substring(1,2),o=e.substring(2,3),i=e.substring(3,4),s=e.substring(4,5),n+=n,o+=o,i+=i,s+=s),{red:parseInt(n,16),green:parseInt(o,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}}let eO={test:isColorString("#"),parse:parseHex,transform:eP.transform},eA={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:e,saturation:n,lightness:o,alpha:i=1})=>"hsla("+Math.round(e)+", "+H.transform(sanitize(n))+", "+H.transform(sanitize(o))+", "+sanitize(L.transform(i))+")"},eR={test:e=>eP.test(e)||eO.test(e)||eA.test(e),parse:e=>eP.test(e)?eP.parse(e):eA.test(e)?eA.parse(e):eO.parse(e),transform:e=>isString(e)?e:e.hasOwnProperty("red")?eP.transform(e):eA.transform(e)},mix=(e,n,o)=>-o*e+o*n+e;function hueToRgb(e,n,o){return(o<0&&(o+=1),o>1&&(o-=1),o<1/6)?e+(n-e)*6*o:o<.5?n:o<2/3?e+(n-e)*(2/3-o)*6:e}function hslaToRgba({hue:e,saturation:n,lightness:o,alpha:i}){e/=360,o/=100;let s=0,u=0,c=0;if(n/=100){let i=o<.5?o*(1+n):o+n-o*n,d=2*o-i;s=hueToRgb(d,i,e+1/3),u=hueToRgb(d,i,e),c=hueToRgb(d,i,e-1/3)}else s=u=c=o;return{red:Math.round(255*s),green:Math.round(255*u),blue:Math.round(255*c),alpha:i}}let mixLinearColor=(e,n,o)=>{let i=e*e;return Math.sqrt(Math.max(0,o*(n*n-i)+i))},eI=[eO,eP,eA],getColorType=e=>eI.find(n=>n.test(e));function asRGBA(e){let n=getColorType(e);(0,em.k)(!!n,`'${e}' is not an animatable color. Use the equivalent color code instead.`);let o=n.parse(e);return n===eA&&(o=hslaToRgba(o)),o}let mixColor=(e,n)=>{let o=asRGBA(e),i=asRGBA(n),s={...o};return e=>(s.red=mixLinearColor(o.red,i.red,e),s.green=mixLinearColor(o.green,i.green,e),s.blue=mixLinearColor(o.blue,i.blue,e),s.alpha=mix(o.alpha,i.alpha,e),eP.transform(s))};function test(e){var n,o;return isNaN(e)&&isString(e)&&((null===(n=e.match(V))||void 0===n?void 0:n.length)||0)+((null===(o=e.match(W))||void 0===o?void 0:o.length)||0)>0}let eM={regex:/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,countKey:"Vars",token:"${v}",parse:ec.Z},ej={regex:W,countKey:"Colors",token:"${c}",parse:eR.parse},eD={regex:V,countKey:"Numbers",token:"${n}",parse:F.parse};function tokenise(e,{regex:n,countKey:o,token:i,parse:s}){let u=e.tokenised.match(n);u&&(e["num"+o]=u.length,e.tokenised=e.tokenised.replace(n,i),e.values.push(...u.map(s)))}function analyseComplexValue(e){let n=e.toString(),o={value:n,tokenised:n,values:[],numVars:0,numColors:0,numNumbers:0};return o.value.includes("var(--")&&tokenise(o,eM),tokenise(o,ej),tokenise(o,eD),o}function parseComplexValue(e){return analyseComplexValue(e).values}function createTransformer(e){let{values:n,numColors:o,numVars:i,tokenised:s}=analyseComplexValue(e),u=n.length;return e=>{let n=s;for(let s=0;s"number"==typeof e?0:e;function getAnimatableNone(e){let n=parseComplexValue(e),o=createTransformer(e);return o(n.map(convertNumbersToZero))}let eB={test,parse:parseComplexValue,createTransformer,getAnimatableNone},mixImmediate=(e,n)=>o=>`${o>0?n:e}`;function getMixer(e,n){return"number"==typeof e?o=>mix(e,n,o):eR.test(e)?mixColor(e,n):e.startsWith("var(")?mixImmediate(e,n):mixComplex(e,n)}let mixArray=(e,n)=>{let o=[...e],i=o.length,s=e.map((e,o)=>getMixer(e,n[o]));return e=>{for(let n=0;n{let o={...e,...n},i={};for(let s in o)void 0!==e[s]&&void 0!==n[s]&&(i[s]=getMixer(e[s],n[s]));return e=>{for(let n in i)o[n]=i[n](e);return o}},mixComplex=(e,n)=>{let o=eB.createTransformer(n),i=analyseComplexValue(e),s=analyseComplexValue(n),u=i.numVars===s.numVars&&i.numColors===s.numColors&&i.numNumbers>=s.numNumbers;return u?pipe(mixArray(i.values,s.values),o):((0,em.K)(!0,`Complex values '${e}' and '${n}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),mixImmediate(e,n))},progress=(e,n,o)=>{let i=n-e;return 0===i?1:(o-e)/i},mixNumber=(e,n)=>o=>mix(e,n,o);function detectMixerFactory(e){if("number"==typeof e);else if("string"==typeof e)return eR.test(e)?mixColor:mixComplex;else if(Array.isArray(e))return mixArray;else if("object"==typeof e)return mixObject;return mixNumber}function createMixers(e,n,o){let i=[],s=o||detectMixerFactory(e[0]),u=e.length-1;for(let o=0;on[0];e[0]>e[u-1]&&(e=[...e].reverse(),n=[...n].reverse());let c=createMixers(n,i,s),d=c.length,interpolator=n=>{let o=0;if(d>1)for(;ointerpolator(clamp(e[0],e[u-1],n)):interpolator}function fillOffset(e,n){let o=e[e.length-1];for(let i=1;i<=n;i++){let s=progress(0,n,i);e.push(mix(o,1,s))}}function defaultOffset(e){let n=[0];return fillOffset(n,e.length-1),n}function convertOffsetToTimes(e,n){return e.map(e=>e*n)}function defaultEasing(e,n){return e.map(()=>n||ex).splice(0,e.length-1)}function keyframes({duration:e=300,keyframes:n,times:o,ease:i="easeInOut"}){let s=isEasingArray(i)?i.map(easingDefinitionToFunction):easingDefinitionToFunction(i),u={done:!1,value:n[0]},c=convertOffsetToTimes(o&&o.length===n.length?o:defaultOffset(n),e),d=interpolate(c,n,{ease:Array.isArray(s)?s:defaultEasing(n,s)});return{calculatedDuration:e,next:n=>(u.value=d(n),u.done=n>=e,u)}}function calcGeneratorVelocity(e,n,o){var i,s;let u=Math.max(n-5,0);return i=o-e(u),(s=n-u)?i*(1e3/s):0}function findSpring({duration:e=800,bounce:n=.25,velocity:o=0,mass:i=1}){let s,u;(0,em.K)(e<=secondsToMilliseconds(10),"Spring duration must be 10 seconds or less");let c=1-n;c=clamp(.05,1,c),e=clamp(.01,10,millisecondsToSeconds(e)),c<1?(s=n=>{let i=n*c,s=i*e,u=calcAngularFreq(n,c),d=Math.exp(-s);return .001-(i-o)/u*d},u=n=>{let i=n*c,u=i*e,d=Math.pow(c,2)*Math.pow(n,2)*e,m=Math.exp(-u),g=calcAngularFreq(Math.pow(n,2),c),y=-s(n)+.001>0?-1:1;return y*((u*o+o-d)*m)/g}):(s=n=>{let i=Math.exp(-n*e),s=(n-o)*e+1;return -.001+i*s},u=n=>{let i=Math.exp(-n*e),s=(o-n)*(e*e);return i*s});let d=5/e,m=approximateRoot(s,u,d);if(e=secondsToMilliseconds(e),isNaN(m))return{stiffness:100,damping:10,duration:e};{let n=Math.pow(m,2)*i;return{stiffness:n,damping:2*c*Math.sqrt(i*n),duration:e}}}function approximateRoot(e,n,o){let i=o;for(let o=1;o<12;o++)i-=e(i)/n(i);return i}function calcAngularFreq(e,n){return e*Math.sqrt(1-n*n)}let eF=["duration","bounce"],eL=["stiffness","damping","mass"];function isSpringType(e,n){return n.some(n=>void 0!==e[n])}function getSpringOptions(e){let n={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!isSpringType(e,eL)&&isSpringType(e,eF)){let o=findSpring(e);(n={...n,...o,velocity:0,mass:1}).isResolvedFromDuration=!0}return n}function spring({keyframes:e,restDelta:n,restSpeed:o,...i}){let s;let u=e[0],c=e[e.length-1],d={done:!1,value:u},{stiffness:m,damping:g,mass:y,velocity:b,duration:x,isResolvedFromDuration:w}=getSpringOptions(i),S=b?-millisecondsToSeconds(b):0,_=g/(2*Math.sqrt(m*y)),C=c-u,E=millisecondsToSeconds(Math.sqrt(m/y)),T=5>Math.abs(C);if(o||(o=T?.01:2),n||(n=T?.005:.5),_<1){let e=calcAngularFreq(E,_);s=n=>{let o=Math.exp(-_*E*n);return c-o*((S+_*E*C)/e*Math.sin(e*n)+C*Math.cos(e*n))}}else if(1===_)s=e=>c-Math.exp(-E*e)*(C+(S+E*C)*e);else{let e=E*Math.sqrt(_*_-1);s=n=>{let o=Math.exp(-_*E*n),i=Math.min(e*n,300);return c-o*((S+_*E*C)*Math.sinh(i)+e*C*Math.cosh(i))/e}}return{calculatedDuration:w&&x||null,next:e=>{let i=s(e);if(w)d.done=e>=x;else{let u=S;0!==e&&(u=_<1?calcGeneratorVelocity(s,e,i):0);let m=Math.abs(u)<=o,g=Math.abs(c-i)<=n;d.done=m&&g}return d.value=d.done?c:i,d}}}function inertia({keyframes:e,velocity:n=0,power:o=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:u=500,modifyTarget:c,min:d,max:m,restDelta:g=.5,restSpeed:y}){let b,x;let w=e[0],S={done:!1,value:w},isOutOfBounds=e=>void 0!==d&&em,nearestBoundary=e=>void 0===d?m:void 0===m?d:Math.abs(d-e)-_*Math.exp(-e/i),calcLatest=e=>E+calcDelta(e),applyFriction=e=>{let n=calcDelta(e),o=calcLatest(e);S.done=Math.abs(n)<=g,S.value=S.done?E:o},checkCatchBoundary=e=>{isOutOfBounds(S.value)&&(b=e,x=spring({keyframes:[S.value,nearestBoundary(S.value)],velocity:calcGeneratorVelocity(calcLatest,e,S.value),damping:s,stiffness:u,restDelta:g,restSpeed:y}))};return checkCatchBoundary(0),{calculatedDuration:null,next:e=>{let n=!1;return(x||void 0!==b||(n=!0,applyFriction(e),checkCatchBoundary(e)),void 0!==b&&e>b)?x.next(e-b):(n||applyFriction(e),S)}}}let frameloopDriver=e=>{let passTimestamp=({timestamp:n})=>e(n);return{start:()=>ei.Wi.update(passTimestamp,!0),stop:()=>(0,ei.Pn)(passTimestamp),now:()=>ei.frameData.isProcessing?ei.frameData.timestamp:performance.now()}};function calcGeneratorDuration(e){let n=0,o=e.next(n);for(;!o.done&&n<2e4;)n+=50,o=e.next(n);return n>=2e4?1/0:n}let eN={decay:inertia,inertia:inertia,tween:keyframes,keyframes:keyframes,spring:spring};function animateValue({autoplay:e=!0,delay:n=0,driver:o=frameloopDriver,keyframes:i,type:s="keyframes",repeat:u=0,repeatDelay:c=0,repeatType:d="loop",onPlay:m,onStop:g,onComplete:y,onUpdate:b,...x}){let w,S,_,C,E,T=1,P=!1,updateFinishedPromise=()=>{S=new Promise(e=>{w=e})};updateFinishedPromise();let O=eN[s]||keyframes;O!==keyframes&&"number"!=typeof i[0]&&(C=interpolate([0,100],i,{clamp:!1}),i=[0,100]);let R=O({...x,keyframes:i});"mirror"===d&&(E=O({...x,keyframes:[...i].reverse(),velocity:-(x.velocity||0)}));let M="idle",j=null,B=null,F=null;null===R.calculatedDuration&&u&&(R.calculatedDuration=calcGeneratorDuration(R));let{calculatedDuration:L}=R,N=1/0,V=1/0;null!==L&&(V=(N=L+c)*(u+1)-c);let W=0,tick=e=>{if(null===B)return;T>0&&(B=Math.min(B,e)),T<0&&(B=Math.min(e-V/T,B)),W=null!==j?j:Math.round(e-B)*T;let o=W-n*(T>=0?1:-1),s=T>=0?o<0:o>V;W=Math.max(o,0),"finished"===M&&null===j&&(W=V);let m=W,g=R;if(u){let e=W/N,n=Math.floor(e),o=e%1;!o&&e>=1&&(o=1),1===o&&n--,n=Math.min(n,u+1);let i=!!(n%2);i&&("reverse"===d?(o=1-o,c&&(o-=c/N)):"mirror"===d&&(g=E));let s=clamp(0,1,o);W>V&&(s="reverse"===d&&i?1:0),m=s*N}let y=s?{done:!1,value:i[0]}:g.next(m);C&&(y.value=C(y.value));let{done:x}=y;s||null===L||(x=T>=0?W>=V:W<=0);let w=null===j&&("finished"===M||"running"===M&&x);return b&&b(y.value),w&&finish(),y},stopAnimationDriver=()=>{_&&_.stop(),_=void 0},cancel=()=>{M="idle",stopAnimationDriver(),w(),updateFinishedPromise(),B=F=null},finish=()=>{M="finished",y&&y(),stopAnimationDriver(),w()},play=()=>{if(P)return;_||(_=o(tick));let e=_.now();m&&m(),null!==j?B=e-j:B&&"finished"!==M||(B=e),"finished"===M&&updateFinishedPromise(),F=B,j=null,M="running",_.start()};e&&play();let U={then:(e,n)=>S.then(e,n),get time(){return millisecondsToSeconds(W)},set time(newTime){W=newTime=secondsToMilliseconds(newTime),null===j&&_&&0!==T?B=_.now()-newTime/T:j=newTime},get duration(){let e=null===R.calculatedDuration?calcGeneratorDuration(R):R.calculatedDuration;return millisecondsToSeconds(e)},get speed(){return T},set speed(newSpeed){if(newSpeed===T||!_)return;T=newSpeed,U.time=millisecondsToSeconds(W)},get state(){return M},play,pause:()=>{M="paused",j=W},stop:()=>{P=!0,"idle"!==M&&(M="idle",g&&g(),cancel())},cancel:()=>{null!==F&&tick(F),cancel()},complete:()=>{M="finished"},sample:e=>(B=0,tick(e))};return U}function memo(e){let n;return()=>(void 0===n&&(n=e()),n)}let eV=memo(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ez=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),requiresPregeneratedKeyframes=(e,n)=>"spring"===n.type||"backgroundColor"===e||!isWaapiSupportedEasing(n.ease);function createAcceleratedAnimation(e,n,{onUpdate:o,onComplete:i,...s}){let u,c;let d=eV()&&ez.has(n)&&!s.repeatDelay&&"mirror"!==s.repeatType&&0!==s.damping&&"inertia"!==s.type;if(!d)return!1;let m=!1,updateFinishedPromise=()=>{c=new Promise(e=>{u=e})};updateFinishedPromise();let{keyframes:g,duration:y=300,ease:b,times:x}=s;if(requiresPregeneratedKeyframes(n,s)){let e=animateValue({...s,repeat:0,delay:0}),n={done:!1,value:g[0]},o=[],i=0;for(;!n.done&&i<2e4;)n=e.sample(i),o.push(n.value),i+=10;x=void 0,g=o,y=i-10,b="linear"}let w=animateStyle(e.owner.current,n,g,{...s,duration:y,ease:b,times:x});s.syncStart&&(w.startTime=ei.frameData.isProcessing?ei.frameData.timestamp:document.timeline?document.timeline.currentTime:performance.now());let cancelAnimation=()=>w.cancel(),safeCancel=()=>{ei.Wi.update(cancelAnimation),u(),updateFinishedPromise()};return w.onfinish=()=>{e.set(getFinalKeyframe(g,s)),i&&i(),safeCancel()},{then:(e,n)=>c.then(e,n),attachTimeline:e=>(w.timeline=e,w.onfinish=null,ec.Z),get time(){return millisecondsToSeconds(w.currentTime||0)},set time(newTime){w.currentTime=secondsToMilliseconds(newTime)},get speed(){return w.playbackRate},set speed(newSpeed){w.playbackRate=newSpeed},get duration(){return millisecondsToSeconds(y)},play:()=>{m||(w.play(),(0,ei.Pn)(cancelAnimation))},pause:()=>w.pause(),stop:()=>{if(m=!0,"idle"===w.playState)return;let{currentTime:n}=w;if(n){let o=animateValue({...s,autoplay:!1});e.setWithVelocity(o.sample(n-10).value,o.sample(n).value,10)}safeCancel()},complete:()=>w.finish(),cancel:safeCancel}}function createInstantAnimation({keyframes:e,delay:n,onUpdate:o,onComplete:i}){let setValue=()=>(o&&o(e[e.length-1]),i&&i(),{time:0,speed:1,duration:0,play:ec.Z,pause:ec.Z,stop:ec.Z,then:e=>(e(),Promise.resolve()),cancel:ec.Z,complete:ec.Z});return n?animateValue({keyframes:[0,1],duration:0,delay:n,onComplete:setValue}):setValue()}let eW={type:"spring",stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=e=>({type:"spring",stiffness:550,damping:0===e?2*Math.sqrt(550):30,restSpeed:10}),eU={type:"keyframes",duration:.8},e$={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(e,{keyframes:n})=>n.length>2?eU:O.has(e)?e.startsWith("scale")?criticallyDampedSpring(n[1]):eW:e$,isAnimatable=(e,n)=>"zIndex"!==e&&!!("number"==typeof n||Array.isArray(n)||"string"==typeof n&&(eB.test(n)||"0"===n)&&!n.startsWith("url(")),eH=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(e){let[n,o]=e.slice(0,-1).split("(");if("drop-shadow"===n)return e;let[i]=o.match(V)||[];if(!i)return e;let s=o.replace(i,""),u=eH.has(n)?1:0;return i!==o&&(u*=100),n+"("+u+s+")"}let eG=/([a-z-]*)\(.*?\)/g,eZ={...eB,getAnimatableNone:e=>{let n=e.match(eG);return n?n.map(applyDefaultFilter).join(" "):e}},eK={...J,color:eR,backgroundColor:eR,outlineColor:eR,fill:eR,stroke:eR,borderColor:eR,borderTopColor:eR,borderRightColor:eR,borderBottomColor:eR,borderLeftColor:eR,filter:eZ,WebkitFilter:eZ},getDefaultValueType=e=>eK[e];function animatable_none_getAnimatableNone(e,n){let o=getDefaultValueType(e);return o!==eZ&&(o=eB),o.getAnimatableNone?o.getAnimatableNone(n):void 0}let isZeroValueString=e=>/^0[^.\s]+$/.test(e);function isNone(e){return"number"==typeof e?0===e:null!==e?"none"===e||"0"===e||isZeroValueString(e):void 0}function getKeyframes(e,n,o,i){let s,u;let c=isAnimatable(n,o);s=Array.isArray(o)?[...o]:[null,o];let d=void 0!==i.from?i.from:e.get(),m=[];for(let e=0;es=>{let u=getValueTransition(i,e)||{},c=u.delay||i.delay||0,{elapsed:d=0}=i;d-=secondsToMilliseconds(c);let m=getKeyframes(n,e,o,u),g=m[0],y=m[m.length-1],b=isAnimatable(e,g),x=isAnimatable(e,y);(0,em.K)(b===x,`You are trying to animate ${e} from "${g}" to "${y}". ${g} is not an animatable value - to enable this animation set ${g} to a value animatable to ${y} via the \`style\` property.`);let w={keyframes:m,velocity:n.getVelocity(),ease:"easeOut",...u,delay:-d,onUpdate:e=>{n.set(e),u.onUpdate&&u.onUpdate(e)},onComplete:()=>{s(),u.onComplete&&u.onComplete()}};if(isTransitionDefined(u)||(w={...w,...getDefaultTransition(e,w)}),w.duration&&(w.duration=secondsToMilliseconds(w.duration)),w.repeatDelay&&(w.repeatDelay=secondsToMilliseconds(w.repeatDelay)),!b||!x||eg.current||!1===u.type)return createInstantAnimation(eg.current?{...w,delay:0}:w);if(n.owner&&n.owner.current instanceof HTMLElement&&!n.owner.getProps().onUpdate){let o=createAcceleratedAnimation(n,e,w);if(o)return o}return animateValue(w)};function isWillChangeMotionValue(e){return!!(isMotionValue(e)&&e.add)}let isNumericalString=e=>/^\-?\d*\.?\d+$/.test(e);function addUniqueItem(e,n){-1===e.indexOf(n)&&e.push(n)}function removeItem(e,n){let o=e.indexOf(n);o>-1&&e.splice(o,1)}let SubscriptionManager=class SubscriptionManager{constructor(){this.subscriptions=[]}add(e){return addUniqueItem(this.subscriptions,e),()=>removeItem(this.subscriptions,e)}notify(e,n,o){let i=this.subscriptions.length;if(i){if(1===i)this.subscriptions[0](e,n,o);else for(let s=0;s!isNaN(parseFloat(e)),eY={current:void 0};let MotionValue=class MotionValue{constructor(e,n={}){this.version="10.16.4",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(e,n=!0)=>{this.prev=this.current,this.current=e;let{delta:o,timestamp:i}=ei.frameData;this.lastUpdated!==i&&(this.timeDelta=o,this.lastUpdated=i,ei.Wi.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),n&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>ei.Wi.postRender(this.velocityCheck),this.velocityCheck=({timestamp:e})=>{e!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=isFloat(this.current),this.owner=n.owner}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new SubscriptionManager);let o=this.events[e].add(n);return"change"===e?()=>{o(),ei.Wi.read(()=>{this.events.change.getSize()||this.stop()})}:o}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){n&&this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e,n)}setWithVelocity(e,n,o){this.set(n),this.prev=e,this.timeDelta=o}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return eY.current&&eY.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e,n;return this.canTrackVelocity?(e=parseFloat(this.current)-parseFloat(this.prev),(n=this.timeDelta)?e*(1e3/n):0):0}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function motionValue(e,n){return new MotionValue(e,n)}let testValueType=e=>n=>n.test(e),eX=[F,G,H,$,Y,K,{test:e=>"auto"===e,parse:e=>e}],findDimensionValueType=e=>eX.find(testValueType(e)),eQ=[...eX,eR,eB],findValueType=e=>eQ.find(testValueType(e));function setMotionValue(e,n,o){e.hasValue(n)?e.getValue(n).set(o):e.addValue(n,motionValue(o))}function setTarget(e,n){let o=resolveVariant(e,n),{transitionEnd:i={},transition:s={},...u}=o?e.makeTargetAnimatable(o,!1):{};for(let n in u={...u,...i}){let o=resolveFinalValueInKeyframes(u[n]);setMotionValue(e,n,o)}}function checkTargetForNewValues(e,n,o){var i,s;let u=Object.keys(n).filter(n=>!e.hasValue(n)),c=u.length;if(c)for(let d=0;dm.remove(n))),g.push(b)}return c&&Promise.all(g).then(()=>{c&&setTarget(e,c)}),g}function animateVariant(e,n,o={}){let i=resolveVariant(e,n,o.custom),{transition:s=e.getDefaultTransition()||{}}=i||{};o.transitionOverride&&(s=o.transitionOverride);let u=i?()=>Promise.all(animateTarget(e,i,o)):()=>Promise.resolve(),c=e.variantChildren&&e.variantChildren.size?(i=0)=>{let{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=s;return animateChildren(e,n,u+i,c,d,o)}:()=>Promise.resolve(),{when:d}=s;if(!d)return Promise.all([u(),c(o.delay)]);{let[e,n]="beforeChildren"===d?[u,c]:[c,u];return e().then(()=>n())}}function animateChildren(e,n,o=0,i=0,s=1,u){let c=[],d=(e.variantChildren.size-1)*i,m=1===s?(e=0)=>e*i:(e=0)=>d-e*i;return Array.from(e.variantChildren).sort(sortByTreeOrder).forEach((e,i)=>{e.notify("AnimationStart",n),c.push(animateVariant(e,n,{...u,delay:o+m(i)}).then(()=>e.notify("AnimationComplete",n)))}),Promise.all(c)}function sortByTreeOrder(e,n){return e.sortNodePosition(n)}function animateVisualElement(e,n,o={}){let i;if(e.notify("AnimationStart",n),Array.isArray(n)){let s=n.map(n=>animateVariant(e,n,o));i=Promise.all(s)}else if("string"==typeof n)i=animateVariant(e,n,o);else{let s="function"==typeof n?resolveVariant(e,n,o.custom):n;i=Promise.all(animateTarget(e,s,o))}return i.then(()=>e.notify("AnimationComplete",n))}let eJ=[...g].reverse(),e0=g.length;function animateList(e){return n=>Promise.all(n.map(({animation:n,options:o})=>animateVisualElement(e,n,o)))}function createAnimationState(e){let n=animateList(e),o=createState(),i=!0,buildResolvedTypeValues=(n,o)=>{let i=resolveVariant(e,o);if(i){let{transition:e,transitionEnd:o,...s}=i;n={...n,...s,...o}}return n};function animateChanges(s,u){let c=e.getProps(),d=e.getVariantContext(!0)||{},m=[],g=new Set,y={},b=1/0;for(let n=0;nb&&_,O=Array.isArray(S)?S:[S],R=O.reduce(buildResolvedTypeValues,{});!1===C&&(R={});let{prevResolvedValues:M={}}=w,j={...M,...R},markToAnimate=e=>{P=!0,g.delete(e),w.needsAnimating[e]=!0};for(let e in j){let n=R[e],o=M[e];y.hasOwnProperty(e)||(n!==o?isKeyframesTarget(n)&&isKeyframesTarget(o)?!shallowCompare(n,o)||T?markToAnimate(e):w.protectedKeys[e]=!0:void 0!==n?markToAnimate(e):g.add(e):void 0!==n&&g.has(e)?markToAnimate(e):w.protectedKeys[e]=!0)}w.prevProp=S,w.prevResolvedValues=R,w.isActive&&(y={...y,...R}),i&&e.blockInitialAnimation&&(P=!1),P&&!E&&m.push(...O.map(e=>({animation:e,options:{type:x,...s}})))}if(g.size){let n={};g.forEach(o=>{let i=e.getBaseTarget(o);void 0!==i&&(n[o]=i)}),m.push({animation:n})}let x=!!m.length;return i&&!1===c.initial&&!e.manuallyAnimateOnMount&&(x=!1),i=!1,x?n(m):Promise.resolve()}function setActive(n,i,s){var u;if(o[n].isActive===i)return Promise.resolve();null===(u=e.variantChildren)||void 0===u||u.forEach(e=>{var o;return null===(o=e.animationState)||void 0===o?void 0:o.setActive(n,i)}),o[n].isActive=i;let c=animateChanges(s,n);for(let e in o)o[e].protectedKeys={};return c}return{animateChanges,setActive,setAnimateFunction:function(o){n=o(e)},getState:()=>o}}function checkVariantsDidChange(e,n){return"string"==typeof n?n!==e:!!Array.isArray(n)&&!shallowCompare(n,e)}function createTypeState(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function createState(){return{animate:createTypeState(!0),whileInView:createTypeState(),whileHover:createTypeState(),whileTap:createTypeState(),whileDrag:createTypeState(),whileFocus:createTypeState(),exit:createTypeState()}}let AnimationFeature=class AnimationFeature extends Feature{constructor(e){super(e),e.animationState||(e.animationState=createAnimationState(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();this.unmount(),isAnimationControls(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){}};let e1=0;let ExitAnimationFeature=class ExitAnimationFeature extends Feature{constructor(){super(...arguments),this.id=e1++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:n,custom:o}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;let s=this.node.animationState.setActive("exit",!e,{custom:null!=o?o:this.node.getProps().custom});n&&!e&&s.then(()=>n(this.id))}mount(){let{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}};let distance=(e,n)=>Math.abs(e-n);function distance2D(e,n){let o=distance(e.x,n.x),i=distance(e.y,n.y);return Math.sqrt(o**2+i**2)}let PanSession=class PanSession{constructor(e,n,{transformPagePoint:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let e=getPanInfo(this.lastMoveEventInfo,this.history),n=null!==this.startEvent,o=distance2D(e.offset,{x:0,y:0})>=3;if(!n&&!o)return;let{point:i}=e,{timestamp:s}=ei.frameData;this.history.push({...i,timestamp:s});let{onStart:u,onMove:c}=this.handlers;n||(u&&u(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),c&&c(this.lastMoveEvent,e)},this.handlePointerMove=(e,n)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=transformPoint(n,this.transformPagePoint),ei.Wi.update(this.updatePoint,!0)},this.handlePointerUp=(e,n)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let{onEnd:o,onSessionEnd:i}=this.handlers,s=getPanInfo("pointercancel"===e.type?this.lastMoveEventInfo:transformPoint(n,this.transformPagePoint),this.history);this.startEvent&&o&&o(e,s),i&&i(e,s)},!isPrimaryPointer(e))return;this.handlers=n,this.transformPagePoint=o;let i=extractEventInfo(e),s=transformPoint(i,this.transformPagePoint),{point:u}=s,{timestamp:c}=ei.frameData;this.history=[{...u,timestamp:c}];let{onSessionStart:d}=n;d&&d(e,getPanInfo(s,this.history)),this.removeListeners=pipe(addPointerEvent(window,"pointermove",this.handlePointerMove),addPointerEvent(window,"pointerup",this.handlePointerUp),addPointerEvent(window,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),(0,ei.Pn)(this.updatePoint)}};function transformPoint(e,n){return n?{point:n(e.point)}:e}function subtractPoint(e,n){return{x:e.x-n.x,y:e.y-n.y}}function getPanInfo({point:e},n){return{point:e,delta:subtractPoint(e,lastDevicePoint(n)),offset:subtractPoint(e,startDevicePoint(n)),velocity:PanSession_getVelocity(n,.1)}}function startDevicePoint(e){return e[0]}function lastDevicePoint(e){return e[e.length-1]}function PanSession_getVelocity(e,n){if(e.length<2)return{x:0,y:0};let o=e.length-1,i=null,s=lastDevicePoint(e);for(;o>=0&&(i=e[o],!(s.timestamp-i.timestamp>secondsToMilliseconds(n)));)o--;if(!i)return{x:0,y:0};let u=millisecondsToSeconds(s.timestamp-i.timestamp);if(0===u)return{x:0,y:0};let c={x:(s.x-i.x)/u,y:(s.y-i.y)/u};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function calcLength(e){return e.max-e.min}function isNear(e,n=0,o=.01){return Math.abs(e-n)<=o}function calcAxisDelta(e,n,o,i=.5){e.origin=i,e.originPoint=mix(n.min,n.max,e.origin),e.scale=calcLength(o)/calcLength(n),(isNear(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=mix(o.min,o.max,e.origin)-e.originPoint,(isNear(e.translate)||isNaN(e.translate))&&(e.translate=0)}function calcBoxDelta(e,n,o,i){calcAxisDelta(e.x,n.x,o.x,i?i.originX:void 0),calcAxisDelta(e.y,n.y,o.y,i?i.originY:void 0)}function calcRelativeAxis(e,n,o){e.min=o.min+n.min,e.max=e.min+calcLength(n)}function calcRelativeBox(e,n,o){calcRelativeAxis(e.x,n.x,o.x),calcRelativeAxis(e.y,n.y,o.y)}function calcRelativeAxisPosition(e,n,o){e.min=n.min-o.min,e.max=e.min+calcLength(n)}function calcRelativePosition(e,n,o){calcRelativeAxisPosition(e.x,n.x,o.x),calcRelativeAxisPosition(e.y,n.y,o.y)}function applyConstraints(e,{min:n,max:o},i){return void 0!==n&&eo&&(e=i?mix(o,e,i.max):Math.min(e,o)),e}function calcRelativeAxisConstraints(e,n,o){return{min:void 0!==n?e.min+n:void 0,max:void 0!==o?e.max+o-(e.max-e.min):void 0}}function calcRelativeConstraints(e,{top:n,left:o,bottom:i,right:s}){return{x:calcRelativeAxisConstraints(e.x,o,s),y:calcRelativeAxisConstraints(e.y,n,i)}}function calcViewportAxisConstraints(e,n){let o=n.min-e.min,i=n.max-e.max;return n.max-n.mini?o=progress(n.min,n.max-i,e.min):i>s&&(o=progress(e.min,e.max-s,n.min)),clamp(0,1,o)}function rebaseAxisConstraints(e,n){let o={};return void 0!==n.min&&(o.min=n.min-e.min),void 0!==n.max&&(o.max=n.max-e.min),o}function resolveDragElastic(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:resolveAxisElastic(e,"left","right"),y:resolveAxisElastic(e,"top","bottom")}}function resolveAxisElastic(e,n,o){return{min:resolvePointElastic(e,n),max:resolvePointElastic(e,o)}}function resolvePointElastic(e,n){return"number"==typeof e?e:e[n]||0}let createAxisDelta=()=>({translate:0,scale:1,origin:0,originPoint:0}),createDelta=()=>({x:createAxisDelta(),y:createAxisDelta()}),createAxis=()=>({min:0,max:0}),createBox=()=>({x:createAxis(),y:createAxis()});function eachAxis(e){return[e("x"),e("y")]}function convertBoundingBoxToBox({top:e,left:n,right:o,bottom:i}){return{x:{min:n,max:o},y:{min:e,max:i}}}function convertBoxToBoundingBox({x:e,y:n}){return{top:n.min,right:e.max,bottom:n.max,left:e.min}}function transformBoxPoints(e,n){if(!n)return e;let o=n({x:e.left,y:e.top}),i=n({x:e.right,y:e.bottom});return{top:o.y,left:o.x,bottom:i.y,right:i.x}}function isIdentityScale(e){return void 0===e||1===e}function hasScale({scale:e,scaleX:n,scaleY:o}){return!isIdentityScale(e)||!isIdentityScale(n)||!isIdentityScale(o)}function hasTransform(e){return hasScale(e)||has2DTranslate(e)||e.z||e.rotate||e.rotateX||e.rotateY}function has2DTranslate(e){var n,o;return(n=e.x)&&"0%"!==n||(o=e.y)&&"0%"!==o}function applyPointDelta(e,n,o,i,s){return void 0!==s&&(e=i+s*(e-i)),i+o*(e-i)+n}function applyAxisDelta(e,n=0,o=1,i,s){e.min=applyPointDelta(e.min,n,o,i,s),e.max=applyPointDelta(e.max,n,o,i,s)}function applyBoxDelta(e,{x:n,y:o}){applyAxisDelta(e.x,n.translate,n.scale,n.originPoint),applyAxisDelta(e.y,o.translate,o.scale,o.originPoint)}function applyTreeDeltas(e,n,o,i=!1){let s,u;let c=o.length;if(c){n.x=n.y=1;for(let d=0;d1.0000000000001||e<.999999999999?e:1}function translateAxis(e,n){e.min=e.min+n,e.max=e.max+n}function transformAxis(e,n,[o,i,s]){let u=void 0!==n[s]?n[s]:.5,c=mix(e.min,e.max,u);applyAxisDelta(e,n[o],n[i],c,n.scale)}let e2=["x","scaleX","originX"],e5=["y","scaleY","originY"];function transformBox(e,n){transformAxis(e.x,n,e2),transformAxis(e.y,n,e5)}function measureViewportBox(e,n){return convertBoundingBoxToBox(transformBoxPoints(e.getBoundingClientRect(),n))}function measurePageBox(e,n,o){let i=measureViewportBox(e,o),{scroll:s}=n;return s&&(translateAxis(i.x,s.offset.x),translateAxis(i.y,s.offset.y)),i}let e4=new WeakMap;let VisualElementDragControls=class VisualElementDragControls{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=createBox(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){let{presenceContext:o}=this.visualElement;o&&!1===o.isPresent||(this.panSession=new PanSession(e,{onSessionStart:e=>{this.stopAnimation(),n&&this.snapToCursor(extractEventInfo(e,"page").point)},onStart:(e,n)=>{let{drag:o,dragPropagation:i,onDragStart:s}=this.getProps();if(o&&!i&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=getGlobalLock(o),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),eachAxis(e=>{let n=this.getAxisMotionValue(e).get()||0;if(H.test(n)){let{projection:o}=this.visualElement;if(o&&o.layout){let i=o.layout.layoutBox[e];if(i){let e=calcLength(i);n=e*(parseFloat(n)/100)}}}this.originPoint[e]=n}),s&&ei.Wi.update(()=>s(e,n),!1,!0);let{animationState:u}=this.visualElement;u&&u.setActive("whileDrag",!0)},onMove:(e,n)=>{let{dragPropagation:o,dragDirectionLock:i,onDirectionLock:s,onDrag:u}=this.getProps();if(!o&&!this.openGlobalLock)return;let{offset:c}=n;if(i&&null===this.currentDirection){this.currentDirection=getCurrentDirection(c),null!==this.currentDirection&&s&&s(this.currentDirection);return}this.updateAxis("x",n.point,c),this.updateAxis("y",n.point,c),this.visualElement.render(),u&&u(e,n)},onSessionEnd:(e,n)=>this.stop(e,n)},{transformPagePoint:this.visualElement.getTransformPagePoint()}))}stop(e,n){let o=this.isDragging;if(this.cancel(),!o)return;let{velocity:i}=n;this.startAnimation(i);let{onDragEnd:s}=this.getProps();s&&ei.Wi.update(()=>s(e,n))}cancel(){this.isDragging=!1;let{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:o}=this.getProps();!o&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,o){let{drag:i}=this.getProps();if(!o||!shouldDrag(e,i,this.currentDirection))return;let s=this.getAxisMotionValue(e),u=this.originPoint[e]+o[e];this.constraints&&this.constraints[e]&&(u=applyConstraints(u,this.constraints[e],this.elastic[e])),s.set(u)}resolveConstraints(){let{dragConstraints:e,dragElastic:n}=this.getProps(),{layout:o}=this.visualElement.projection||{},i=this.constraints;e&&isRefObject(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&o?this.constraints=calcRelativeConstraints(o.layoutBox,e):this.constraints=!1,this.elastic=resolveDragElastic(n),i!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&eachAxis(e=>{this.getAxisMotionValue(e)&&(this.constraints[e]=rebaseAxisConstraints(o.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!isRefObject(e))return!1;let o=e.current;(0,em.k)(null!==o,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");let{projection:i}=this.visualElement;if(!i||!i.layout)return!1;let s=measurePageBox(o,i.root,this.visualElement.getTransformPagePoint()),u=calcViewportConstraints(i.layout.layoutBox,s);if(n){let e=n(convertBoxToBoundingBox(u));this.hasMutatedConstraints=!!e,e&&(u=convertBoundingBoxToBox(e))}return u}startAnimation(e){let{drag:n,dragMomentum:o,dragElastic:i,dragTransition:s,dragSnapToOrigin:u,onDragTransitionEnd:c}=this.getProps(),d=this.constraints||{},m=eachAxis(c=>{if(!shouldDrag(c,n,this.currentDirection))return;let m=d&&d[c]||{};u&&(m={min:0,max:0});let g={type:"inertia",velocity:o?e[c]:0,bounceStiffness:i?200:1e6,bounceDamping:i?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...s,...m};return this.startAxisValueAnimation(c,g)});return Promise.all(m).then(c)}startAxisValueAnimation(e,n){let o=this.getAxisMotionValue(e);return o.start(animateMotionValue(e,o,0,n))}stopAnimation(){eachAxis(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let n="_drag"+e.toUpperCase(),o=this.visualElement.getProps(),i=o[n];return i||this.visualElement.getValue(e,(o.initial?o.initial[e]:void 0)||0)}snapToCursor(e){eachAxis(n=>{let{drag:o}=this.getProps();if(!shouldDrag(n,o,this.currentDirection))return;let{projection:i}=this.visualElement,s=this.getAxisMotionValue(n);if(i&&i.layout){let{min:o,max:u}=i.layout.layoutBox[n];s.set(e[n]-mix(o,u,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:n}=this.getProps(),{projection:o}=this.visualElement;if(!isRefObject(n)||!o||!this.constraints)return;this.stopAnimation();let i={x:0,y:0};eachAxis(e=>{let n=this.getAxisMotionValue(e);if(n){let o=n.get();i[e]=constraints_calcOrigin({min:o,max:o},this.constraints[e])}});let{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",o.root&&o.root.updateScroll(),o.updateLayout(),this.resolveConstraints(),eachAxis(n=>{if(!shouldDrag(n,e,null))return;let o=this.getAxisMotionValue(n),{min:s,max:u}=this.constraints[n];o.set(mix(s,u,i[n]))})}addListeners(){if(!this.visualElement.current)return;e4.set(this.visualElement,this);let e=this.visualElement.current,n=addPointerEvent(e,"pointerdown",e=>{let{drag:n,dragListener:o=!0}=this.getProps();n&&o&&this.start(e)}),measureDragConstraints=()=>{let{dragConstraints:e}=this.getProps();isRefObject(e)&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,i=o.addEventListener("measure",measureDragConstraints);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),measureDragConstraints();let s=addDomEvent(window,"resize",()=>this.scalePositionWithinConstraints()),u=o.addEventListener("didUpdate",({delta:e,hasLayoutChanged:n})=>{this.isDragging&&n&&(eachAxis(n=>{let o=this.getAxisMotionValue(n);o&&(this.originPoint[n]+=e[n].translate,o.set(o.get()+e[n].translate))}),this.visualElement.render())});return()=>{s(),n(),i(),u&&u()}}getProps(){let e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:o=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:u=.35,dragMomentum:c=!0}=e;return{...e,drag:n,dragDirectionLock:o,dragPropagation:i,dragConstraints:s,dragElastic:u,dragMomentum:c}}};function shouldDrag(e,n,o){return(!0===n||n===e)&&(null===o||o===e)}function getCurrentDirection(e,n=10){let o=null;return Math.abs(e.y)>n?o="y":Math.abs(e.x)>n&&(o="x"),o}let DragGesture=class DragGesture extends Feature{constructor(e){super(e),this.removeGroupControls=ec.Z,this.removeListeners=ec.Z,this.controls=new VisualElementDragControls(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ec.Z}unmount(){this.removeGroupControls(),this.removeListeners()}};let asyncHandler=e=>(n,o)=>{e&&ei.Wi.update(()=>e(n,o))};let PanGesture=class PanGesture extends Feature{constructor(){super(...arguments),this.removePointerDownListener=ec.Z}onPointerDown(e){this.session=new PanSession(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:n,onPan:o,onPanEnd:i}=this.node.getProps();return{onSessionStart:asyncHandler(e),onStart:asyncHandler(n),onMove:o,onEnd:(e,n)=>{delete this.session,i&&ei.Wi.update(()=>i(e,n))}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}};var e3=o(27038);let e6={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pixelsToPercent(e,n){return n.max===n.min?0:e/(n.max-n.min)*100}let e7={correct:(e,n)=>{if(!n.target)return e;if("string"==typeof e){if(!G.test(e))return e;e=parseFloat(e)}let o=pixelsToPercent(e,n.target.x),i=pixelsToPercent(e,n.target.y);return`${o}% ${i}%`}};let MeasureLayoutWithContext=class MeasureLayoutWithContext extends i.Component{componentDidMount(){let{visualElement:e,layoutGroup:n,switchLayoutGroup:o,layoutId:i}=this.props,{projection:s}=e;addScaleCorrector(e8),s&&(n.group&&n.group.add(s),o&&o.register&&i&&o.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),e6.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:n,visualElement:o,drag:i,isPresent:s}=this.props,u=o.projection;return u&&(u.isPresent=s,i||e.layoutDependency!==n||void 0===n?u.willUpdate():this.safeToRemove(),e.isPresent===s||(s?u.promote():u.relegate()||ei.Wi.postRender(()=>{let e=u.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),queueMicrotask(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:n,switchLayoutGroup:o}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),o&&o.deregister&&o.deregister(i))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function MeasureLayout(e){let[n,o]=(0,e3.oO)(),s=(0,i.useContext)(S.p);return i.createElement(MeasureLayoutWithContext,{...e,layoutGroup:s,switchLayoutGroup:(0,i.useContext)(_),isPresent:n,safeToRemove:o})}let e8={borderRadius:{...e7,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:e7,borderTopRightRadius:e7,borderBottomLeftRadius:e7,borderBottomRightRadius:e7,boxShadow:{correct:(e,{treeScale:n,projectionDelta:o})=>{let i=eB.parse(e);if(i.length>5)return e;let s=eB.createTransformer(e),u="number"!=typeof i[0]?1:0,c=o.x.scale*n.x,d=o.y.scale*n.y;i[0+u]/=c,i[1+u]/=d;let m=mix(c,d,.5);return"number"==typeof i[2+u]&&(i[2+u]/=m),"number"==typeof i[3+u]&&(i[3+u]/=m),s(i)}}},e9=["TopLeft","TopRight","BottomLeft","BottomRight"],tt=e9.length,asNumber=e=>"string"==typeof e?parseFloat(e):e,isPx=e=>"number"==typeof e||G.test(e);function mixValues(e,n,o,i,s,u){s?(e.opacity=mix(0,void 0!==o.opacity?o.opacity:1,tr(i)),e.opacityExit=mix(void 0!==n.opacity?n.opacity:1,0,tn(i))):u&&(e.opacity=mix(void 0!==n.opacity?n.opacity:1,void 0!==o.opacity?o.opacity:1,i));for(let s=0;sin?1:o(progress(e,n,i))}function copyAxisInto(e,n){e.min=n.min,e.max=n.max}function copyBoxInto(e,n){copyAxisInto(e.x,n.x),copyAxisInto(e.y,n.y)}function removePointDelta(e,n,o,i,s){return e-=n,e=i+1/o*(e-i),void 0!==s&&(e=i+1/s*(e-i)),e}function removeAxisDelta(e,n=0,o=1,i=.5,s,u=e,c=e){if(H.test(n)){n=parseFloat(n);let e=mix(c.min,c.max,n/100);n=e-c.min}if("number"!=typeof n)return;let d=mix(u.min,u.max,i);e===u&&(d-=n),e.min=removePointDelta(e.min,n,o,d,s),e.max=removePointDelta(e.max,n,o,d,s)}function removeAxisTransforms(e,n,[o,i,s],u,c){removeAxisDelta(e,n[o],n[i],n[s],n.scale,u,c)}let ti=["x","scaleX","originX"],ta=["y","scaleY","originY"];function removeBoxTransforms(e,n,o,i){removeAxisTransforms(e.x,n,ti,o?o.x:void 0,i?i.x:void 0),removeAxisTransforms(e.y,n,ta,o?o.y:void 0,i?i.y:void 0)}function isAxisDeltaZero(e){return 0===e.translate&&1===e.scale}function isDeltaZero(e){return isAxisDeltaZero(e.x)&&isAxisDeltaZero(e.y)}function boxEquals(e,n){return e.x.min===n.x.min&&e.x.max===n.x.max&&e.y.min===n.y.min&&e.y.max===n.y.max}function boxEqualsRounded(e,n){return Math.round(e.x.min)===Math.round(n.x.min)&&Math.round(e.x.max)===Math.round(n.x.max)&&Math.round(e.y.min)===Math.round(n.y.min)&&Math.round(e.y.max)===Math.round(n.y.max)}function aspectRatio(e){return calcLength(e.x)/calcLength(e.y)}let NodeStack=class NodeStack{constructor(){this.members=[]}add(e){addUniqueItem(this.members,e),e.scheduleRender()}remove(e){if(removeItem(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let n;let o=this.members.findIndex(n=>e===n);if(0===o)return!1;for(let e=o;e>=0;e--){let o=this.members[e];if(!1!==o.isPresent){n=o;break}}return!!n&&(this.promote(n),!0)}promote(e,n){let o=this.lead;if(e!==o&&(this.prevLead=o,this.lead=e,e.show(),o)){o.instance&&o.scheduleRender(),e.scheduleRender(),e.resumeFrom=o,n&&(e.resumeFrom.preserveOpacity=!0),o.snapshot&&(e.snapshot=o.snapshot,e.snapshot.latestValues=o.animationValues||o.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);let{crossfade:i}=e.options;!1===i&&o.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:n,resumingFrom:o}=e;n.onExitComplete&&n.onExitComplete(),o&&o.options.onExitComplete&&o.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}};function buildProjectionTransform(e,n,o){let i="",s=e.x.translate/n.x,u=e.y.translate/n.y;if((s||u)&&(i=`translate3d(${s}px, ${u}px, 0) `),(1!==n.x||1!==n.y)&&(i+=`scale(${1/n.x}, ${1/n.y}) `),o){let{rotate:e,rotateX:n,rotateY:s}=o;e&&(i+=`rotate(${e}deg) `),n&&(i+=`rotateX(${n}deg) `),s&&(i+=`rotateY(${s}deg) `)}let c=e.x.scale*n.x,d=e.y.scale*n.y;return(1!==c||1!==d)&&(i+=`scale(${c}, ${d})`),i||"none"}let compareByDepth=(e,n)=>e.depth-n.depth;let FlatTree=class FlatTree{constructor(){this.children=[],this.isDirty=!1}add(e){addUniqueItem(this.children,e),this.isDirty=!0}remove(e){removeItem(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(e)}};function delay(e,n){let o=performance.now(),checkElapsed=({timestamp:i})=>{let s=i-o;s>=n&&((0,ei.Pn)(checkElapsed),e(s-n))};return ei.Wi.read(checkElapsed,!0),()=>(0,ei.Pn)(checkElapsed)}function record(e){window.MotionDebug&&window.MotionDebug.record(e)}function isSVGElement(e){return e instanceof SVGElement&&"svg"!==e.tagName}function animateSingleValue(e,n,o){let i=isMotionValue(e)?e:motionValue(e);return i.start(animateMotionValue("",i,n,o)),i.animation}let ts=["","X","Y","Z"],tl=0,tu={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function createProjectionNode({attachResizeListener:e,defaultParent:n,measureScroll:o,checkIsScrollRoot:i,resetTransform:s}){return class{constructor(e={},o=null==n?void 0:n()){this.id=tl++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{tu.totalNodes=tu.resolvedTargetDeltas=tu.recalculatedProjection=0,this.nodes.forEach(propagateDirtyNodes),this.nodes.forEach(resolveTargetDelta),this.nodes.forEach(calcProjection),this.nodes.forEach(cleanDirtyNodes),record(tu)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let e=0;ethis.root.updateBlockedByResize=!1;e(n,()=>{this.root.updateBlockedByResize=!0,o&&o(),o=delay(resizeUnblockUpdate,250),e6.hasAnimatedSinceResize&&(e6.hasAnimatedSinceResize=!1,this.nodes.forEach(finishAnimation))})}i&&this.root.registerSharedNode(i,this),!1!==this.options.animate&&u&&(i||s)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:n,hasRelativeTargetChanged:o,layout:i})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let s=this.options.transition||u.getDefaultTransition()||tc,{onLayoutAnimationStart:c,onLayoutAnimationComplete:d}=u.getProps(),m=!this.targetLayout||!boxEqualsRounded(this.targetLayout,i)||o,g=!n&&o;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||n&&(m||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(e,g);let n={...getValueTransition(s,"layout"),onPlay:c,onComplete:d};(u.shouldReduceMotion||this.options.layoutRoot)&&(n.delay=0,n.type=!1),this.startAnimation(n)}else n||finishAnimation(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=i})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,(0,ei.Pn)(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(resetRotation),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;ethis.update()))}clearAllSnapshots(){this.nodes.forEach(clearSnapshot),this.sharedNodes.forEach(removeLeadSnapshots)}scheduleUpdateProjection(){ei.Wi.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){ei.Wi.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e{let i=n/1e3;mixAxisDelta(c.x,e.x,i),mixAxisDelta(c.y,e.y,i),this.setTargetDelta(c),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(calcRelativePosition(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),mixBox(this.relativeTarget,this.relativeTargetOrigin,d,i),o&&boxEquals(this.relativeTarget,o)&&(this.isProjectionDirty=!1),o||(o=createBox()),copyBoxInto(o,this.relativeTarget)),y&&(this.animationValues=u,mixValues(u,s,this.latestValues,i,w,x)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&((0,ei.Pn)(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ei.Wi.update(()=>{e6.hasAnimatedSinceResize=!0,this.currentAnimation=animateSingleValue(0,1e3,{...e,onUpdate:n=>{this.mixTargetDelta(n),e.onUpdate&&e.onUpdate(n)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:n,target:o,layout:i,latestValues:s}=e;if(n&&o&&i){if(this!==e&&this.layout&&i&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,i.layoutBox)){o=this.target||createBox();let n=calcLength(this.layout.layoutBox.x);o.x.min=e.target.x.min,o.x.max=o.x.min+n;let i=calcLength(this.layout.layoutBox.y);o.y.min=e.target.y.min,o.y.max=o.y.min+i}copyBoxInto(n,o),transformBox(n,s),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,n,s)}}registerSharedNode(e,n){this.sharedNodes.has(e)||this.sharedNodes.set(e,new NodeStack);let o=this.sharedNodes.get(e);o.add(n);let i=n.options.initialPromotionConfig;n.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(n):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){var e;let{layoutId:n}=this.options;return n&&(null===(e=this.getStack())||void 0===e?void 0:e.lead)||this}getPrevLead(){var e;let{layoutId:n}=this.options;return n?null===(e=this.getStack())||void 0===e?void 0:e.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:n,preserveFollowOpacity:o}={}){let i=this.getStack();i&&i.promote(this,o),e&&(this.projectionDelta=void 0,this.needsReset=!0),n&&this.setOptions({transition:n})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetRotation(){let{visualElement:e}=this.options;if(!e)return;let n=!1,{latestValues:o}=e;if((o.rotate||o.rotateX||o.rotateY||o.rotateZ)&&(n=!0),!n)return;let i={};for(let n=0;n{var n;return null===(n=e.currentAnimation)||void 0===n?void 0:n.stop()}),this.root.nodes.forEach(clearMeasurements),this.root.sharedNodes.clear()}}}function updateLayout(e){e.updateLayout()}function notifyLayoutUpdate(e){var n;let o=(null===(n=e.resumeFrom)||void 0===n?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&o&&e.hasListeners("didUpdate")){let{layoutBox:n,measuredBox:i}=e.layout,{animationType:s}=e.options,u=o.source!==e.layout.source;"size"===s?eachAxis(e=>{let i=u?o.measuredBox[e]:o.layoutBox[e],s=calcLength(i);i.min=n[e].min,i.max=i.min+s}):shouldAnimatePositionOnly(s,o.layoutBox,n)&&eachAxis(i=>{let s=u?o.measuredBox[i]:o.layoutBox[i],c=calcLength(n[i]);s.max=s.min+c,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[i].max=e.relativeTarget[i].min+c)});let c=createDelta();calcBoxDelta(c,n,o.layoutBox);let d=createDelta();u?calcBoxDelta(d,e.applyTransform(i,!0),o.measuredBox):calcBoxDelta(d,n,o.layoutBox);let m=!isDeltaZero(c),g=!1;if(!e.resumeFrom){let i=e.getClosestProjectingParent();if(i&&!i.resumeFrom){let{snapshot:s,layout:u}=i;if(s&&u){let c=createBox();calcRelativePosition(c,o.layoutBox,s.layoutBox);let d=createBox();calcRelativePosition(d,n,u.layoutBox),boxEqualsRounded(c,d)||(g=!0),i.options.layoutRoot&&(e.relativeTarget=d,e.relativeTargetOrigin=c,e.relativeParent=i)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:o,delta:d,layoutDelta:c,hasLayoutChanged:m,hasRelativeTargetChanged:g})}else if(e.isLead()){let{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function propagateDirtyNodes(e){tu.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function cleanDirtyNodes(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function clearSnapshot(e){e.clearSnapshot()}function clearMeasurements(e){e.clearMeasurements()}function clearIsLayoutDirty(e){e.isLayoutDirty=!1}function resetTransformStyle(e){let{visualElement:n}=e.options;n&&n.getProps().onBeforeLayoutMeasure&&n.notify("BeforeLayoutMeasure"),e.resetTransform()}function finishAnimation(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function resolveTargetDelta(e){e.resolveTargetDelta()}function calcProjection(e){e.calcProjection()}function resetRotation(e){e.resetRotation()}function removeLeadSnapshots(e){e.removeLeadSnapshot()}function mixAxisDelta(e,n,o){e.translate=mix(n.translate,0,o),e.scale=mix(n.scale,1,o),e.origin=n.origin,e.originPoint=n.originPoint}function mixAxis(e,n,o,i){e.min=mix(n.min,o.min,i),e.max=mix(n.max,o.max,i)}function mixBox(e,n,o,i){mixAxis(e.x,n.x,o.x,i),mixAxis(e.y,n.y,o.y,i)}function hasOpacityCrossfade(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let tc={duration:.45,ease:[.4,0,.1,1]},userAgentContains=e=>"undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().includes(e),td=userAgentContains("applewebkit/")&&!userAgentContains("chrome/")?Math.round:ec.Z;function roundAxis(e){e.min=td(e.min),e.max=td(e.max)}function roundBox(e){roundAxis(e.x),roundAxis(e.y)}function shouldAnimatePositionOnly(e,n,o){return"position"===e||"preserve-aspect"===e&&!isNear(aspectRatio(n),aspectRatio(o),.2)}let tf=createProjectionNode({attachResizeListener:(e,n)=>addDomEvent(e,"resize",n),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),tp={current:void 0},th=createProjectionNode({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!tp.current){let e=new tf({});e.mount(window),e.setOptions({layoutScroll:!0}),tp.current=e}return tp.current},resetTransform:(e,n)=>{e.style.transform=void 0!==n?n:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position}),tm=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function parseCSSVariable(e){let n=tm.exec(e);if(!n)return[,];let[,o,i]=n;return[o,i]}function getVariableValue(e,n,o=1){(0,em.k)(o<=4,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);let[i,s]=parseCSSVariable(e);if(!i)return;let u=window.getComputedStyle(n).getPropertyValue(i);if(u){let e=u.trim();return isNumericalString(e)?parseFloat(e):e}return B(s)?getVariableValue(s,n,o+1):s}function resolveCSSVariables(e,{...n},o){let i=e.current;if(!(i instanceof Element))return{target:n,transitionEnd:o};for(let s in o&&(o={...o}),e.values.forEach(e=>{let n=e.get();if(!B(n))return;let o=getVariableValue(n,i);o&&e.set(o)}),n){let e=n[s];if(!B(e))continue;let u=getVariableValue(e,i);u&&(n[s]=u,o||(o={}),void 0===o[s]&&(o[s]=e))}return{target:n,transitionEnd:o}}let tg=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),isPositionalKey=e=>tg.has(e),hasPositionalKey=e=>Object.keys(e).some(isPositionalKey),isNumOrPxType=e=>e===F||e===G,getPosFromMatrix=(e,n)=>parseFloat(e.split(", ")[n]),getTranslateFromMatrix=(e,n)=>(o,{transform:i})=>{if("none"===i||!i)return 0;let s=i.match(/^matrix3d\((.+)\)$/);if(s)return getPosFromMatrix(s[1],n);{let n=i.match(/^matrix\((.+)\)$/);return n?getPosFromMatrix(n[1],e):0}},tv=new Set(["x","y","z"]),ty=P.filter(e=>!tv.has(e));function removeNonTranslationalTransform(e){let n=[];return ty.forEach(o=>{let i=e.getValue(o);void 0!==i&&(n.push([o,i.get()]),i.set(o.startsWith("scale")?1:0))}),n.length&&e.render(),n}let tb={width:({x:e},{paddingLeft:n="0",paddingRight:o="0"})=>e.max-e.min-parseFloat(n)-parseFloat(o),height:({y:e},{paddingTop:n="0",paddingBottom:o="0"})=>e.max-e.min-parseFloat(n)-parseFloat(o),top:(e,{top:n})=>parseFloat(n),left:(e,{left:n})=>parseFloat(n),bottom:({y:e},{top:n})=>parseFloat(n)+(e.max-e.min),right:({x:e},{left:n})=>parseFloat(n)+(e.max-e.min),x:getTranslateFromMatrix(4,13),y:getTranslateFromMatrix(5,14)};tb.translateX=tb.x,tb.translateY=tb.y;let convertChangedValueTypes=(e,n,o)=>{let i=n.measureViewportBox(),s=n.current,u=getComputedStyle(s),{display:c}=u,d={};"none"===c&&n.setStaticValue("display",e.display||"block"),o.forEach(e=>{d[e]=tb[e](i,u)}),n.render();let m=n.measureViewportBox();return o.forEach(o=>{let i=n.getValue(o);i&&i.jump(d[o]),e[o]=tb[o](m,u)}),e},checkAndConvertChangedValueTypes=(e,n,o={},i={})=>{n={...n},i={...i};let s=Object.keys(n).filter(isPositionalKey),u=[],c=!1,d=[];if(s.forEach(s=>{let m;let g=e.getValue(s);if(!e.hasValue(s))return;let y=o[s],b=findDimensionValueType(y),x=n[s];if(isKeyframesTarget(x)){let e=x.length,n=null===x[0]?1:0;b=findDimensionValueType(y=x[n]);for(let o=n;o=0?window.pageYOffset:null,s=convertChangedValueTypes(n,e,d);return u.length&&u.forEach(([n,o])=>{e.getValue(n).set(o)}),e.render(),w.j&&null!==o&&window.scrollTo({top:o}),{target:s,transitionEnd:i}}};function unitConversion(e,n,o,i){return hasPositionalKey(n)?checkAndConvertChangedValueTypes(e,n,o,i):{target:n,transitionEnd:i}}let parseDomVariant=(e,n,o,i)=>{let s=resolveCSSVariables(e,n,i);return unitConversion(e,n=s.target,o,i=s.transitionEnd)},tx={current:null},tw={current:!1};function initPrefersReducedMotion(){if(tw.current=!0,w.j){if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),setReducedMotionPreferences=()=>tx.current=e.matches;e.addListener(setReducedMotionPreferences),setReducedMotionPreferences()}else tx.current=!1}}function updateMotionValuesFromProps(e,n,o){let{willChange:i}=n;for(let s in n){let u=n[s],c=o[s];if(isMotionValue(u))e.addValue(s,u),isWillChangeMotionValue(i)&&i.add(s);else if(isMotionValue(c))e.addValue(s,motionValue(u,{owner:e})),isWillChangeMotionValue(i)&&i.remove(s);else if(c!==u){if(e.hasValue(s)){let n=e.getValue(s);n.hasAnimated||n.set(u)}else{let n=e.getStaticValue(s);e.addValue(s,motionValue(void 0!==n?n:u,{owner:e}))}}}for(let i in o)void 0===n[i]&&e.removeValue(i);return n}let tS=new WeakMap,t_=Object.keys(x),tC=t_.length,tk=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],tE=y.length;let VisualElement=class VisualElement{constructor({parent:e,props:n,presenceContext:o,reducedMotionConfig:i,visualState:s},u={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>ei.Wi.render(this.render,!1,!0);let{latestValues:c,renderState:d}=s;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=d,this.parent=e,this.props=n,this.presenceContext=o,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=u,this.isControllingVariants=isControllingVariants(n),this.isVariantNode=isVariantNode(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:m,...g}=this.scrapeMotionValuesFromProps(n,{});for(let e in g){let n=g[e];void 0!==c[e]&&isMotionValue(n)&&(n.set(c[e],!1),isWillChangeMotionValue(m)&&m.add(e))}}scrapeMotionValuesFromProps(e,n){return{}}mount(e){this.current=e,tS.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,n)=>this.bindToMotionValue(n,e)),tw.current||initPrefersReducedMotion(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||tx.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in tS.delete(this.current),this.projection&&this.projection.unmount(),(0,ei.Pn)(this.notifyUpdate),(0,ei.Pn)(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this),this.events)this.events[e].clear();for(let e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,n){let o=O.has(e),i=n.on("change",n=>{this.latestValues[e]=n,this.props.onUpdate&&ei.Wi.update(this.notifyUpdate,!1,!0),o&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{i(),s()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}loadFeatures({children:e,...n},o,i,s){let u,c;for(let e=0;ethis.scheduleRender(),animationType:"string"==typeof o?o:"both",initialPromotionConfig:s,layoutScroll:d,layoutRoot:m})}return c}updateFeatures(){for(let e in this.features){let n=this.features[e];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):createBox()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}makeTargetAnimatable(e,n=!0){return this.makeTargetAnimatableFromInstance(e,this.props,n)}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let n=0;nn.variantChildren.delete(e)}addValue(e,n){n!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,n)),this.values.set(e,n),this.latestValues[e]=n.get()}removeValue(e){this.values.delete(e);let n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let o=this.values.get(e);return void 0===o&&void 0!==n&&(o=motionValue(n,{owner:this}),this.addValue(e,o)),o}readValue(e){var n;return void 0===this.latestValues[e]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,e))&&void 0!==n?n:this.readValueFromInstance(this.current,e,this.options):this.latestValues[e]}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;let{initial:o}=this.props,i="string"==typeof o||"object"==typeof o?null===(n=resolveVariantFromProps(this.props,o))||void 0===n?void 0:n[e]:void 0;if(o&&void 0!==i)return i;let s=this.getBaseTargetFromProps(this.props,e);return void 0===s||isMotionValue(s)?void 0!==this.initialValues[e]&&void 0===i?void 0:this.baseTarget[e]:s}on(e,n){return this.events[e]||(this.events[e]=new SubscriptionManager),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}};let DOMVisualElement=class DOMVisualElement extends VisualElement{sortInstanceNodePosition(e,n){return 2&e.compareDocumentPosition(n)?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:o}){delete n[e],delete o[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:n,...o},{transformValues:i},s){let u=getOrigin(o,e||{},this);if(i&&(n&&(n=i(n)),o&&(o=i(o)),u&&(u=i(u))),s){checkTargetForNewValues(this,o,u);let e=parseDomVariant(this,o,u,n);n=e.transitionEnd,o=e.target}return{transition:e,transitionEnd:n,...o}}};function HTMLVisualElement_getComputedStyle(e){return window.getComputedStyle(e)}let HTMLVisualElement=class HTMLVisualElement extends DOMVisualElement{readValueFromInstance(e,n){if(O.has(n)){let e=getDefaultValueType(n);return e&&e.default||0}{let o=HTMLVisualElement_getComputedStyle(e),i=(j(n)?o.getPropertyValue(n):o[n])||0;return"string"==typeof i?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return measureViewportBox(e,n)}build(e,n,o,i){buildHTMLStyles(e,n,o,i.transformTemplate)}scrapeMotionValuesFromProps(e,n){return scrapeMotionValuesFromProps(e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;isMotionValue(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}renderInstance(e,n,o,i){renderHTML(e,n,o,i)}};let SVGVisualElement=class SVGVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(O.has(n)){let e=getDefaultValueType(n);return e&&e.default||0}return n=en.has(n)?n:camelToDash(n),e.getAttribute(n)}measureInstanceViewportBox(){return createBox()}scrapeMotionValuesFromProps(e,n){return scrape_motion_values_scrapeMotionValuesFromProps(e,n)}build(e,n,o,i){buildSVGAttrs(e,n,o,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,o,i){renderSVG(e,n,o,i)}mount(e){this.isSVGTag=isSVGTag(e.tagName),super.mount(e)}};let create_visual_element_createDomVisualElement=(e,n)=>isSVGComponent(e)?new SVGVisualElement(n,{enableHardwareAcceleration:!1}):new HTMLVisualElement(n,{enableHardwareAcceleration:!0}),tT={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature},inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture},pan:{Feature:PanGesture},drag:{Feature:DragGesture,ProjectionNode:th,MeasureLayout:MeasureLayout},layout:{ProjectionNode:th,MeasureLayout:MeasureLayout}},tP=createMotionProxy((e,n)=>create_config_createDomMotionConfig(e,n,tT,create_visual_element_createDomVisualElement))},316:function(e,n,o){"use strict";o.d(n,{K:function(){return s},k:function(){return u}});var i=o(68390);let s=i.Z,u=i.Z},99228:function(e,n,o){"use strict";o.d(n,{j:function(){return i}});let i="undefined"!=typeof document},68390:function(e,n,o){"use strict";o.d(n,{Z:function(){return noop}});let noop=e=>e},740:function(e,n,o){"use strict";o.d(n,{h:function(){return useConstant}});var i=o(27726);function useConstant(e){let n=(0,i.useRef)(null);return null===n.current&&(n.current=e()),n.current}},90529:function(e,n,o){"use strict";o.d(n,{L:function(){return u}});var i=o(27726),s=o(99228);let u=s.j?i.useLayoutEffect:i.useEffect},84021:function(e,n,o){"use strict";o.d(n,{$Q:function(){return d},kL:function(){return c}});var i=o(27726),s=o(85670);let u="label";function reforwardRef(e,n){"function"==typeof e?e(n):e&&(e.current=n)}function setOptions(e,n){let o=e.options;o&&n&&Object.assign(o,n)}function setDatasets(e,n){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u,i=[];e.datasets=n.map(n=>{let s=e.datasets.find(e=>e[o]===n[o]);return!s||!n.data||i.includes(s)?{...n}:(i.push(s),Object.assign(s,n),s)})}function cloneData(e){var n;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u,i={labels:[],datasets:[]};return n=e.labels,i.labels=n,setDatasets(i,e.datasets,o),i}function ChartComponent(e,n){let{height:o=150,width:u=300,redraw:c=!1,datasetIdKey:d,type:m,data:g,options:y,plugins:b=[],fallbackContent:x,updateMode:w,...S}=e,_=(0,i.useRef)(null),C=(0,i.useRef)(),renderChart=()=>{_.current&&(C.current=new s.kL(_.current,{type:m,data:cloneData(g,d),options:y&&{...y},plugins:b}),reforwardRef(n,C.current))},destroyChart=()=>{reforwardRef(n,null),C.current&&(C.current.destroy(),C.current=null)};return(0,i.useEffect)(()=>{!c&&C.current&&y&&setOptions(C.current,y)},[c,y]),(0,i.useEffect)(()=>{if(!c&&C.current){var e,n;e=C.current.config.data,n=g.labels,e.labels=n}},[c,g.labels]),(0,i.useEffect)(()=>{!c&&C.current&&g.datasets&&setDatasets(C.current.config.data,g.datasets,d)},[c,g.datasets]),(0,i.useEffect)(()=>{C.current&&(c?(destroyChart(),setTimeout(renderChart)):C.current.update(w))},[c,y,g.labels,g.datasets,w]),(0,i.useEffect)(()=>{C.current&&(destroyChart(),setTimeout(renderChart))},[m]),(0,i.useEffect)(()=>(renderChart(),()=>destroyChart()),[]),i.createElement("canvas",Object.assign({ref:_,role:"img",height:o,width:u},S),x)}let c=(0,i.forwardRef)(ChartComponent);function createTypedChart(e,n){return s.kL.register(n),(0,i.forwardRef)((n,o)=>i.createElement(c,Object.assign({},n,{ref:o,type:e})))}let d=createTypedChart("bar",s.vn)},52116:function(e,n,o){"use strict";o.d(n,{ZP:function(){return $},Ug:function(){return textEditor}});var i=o(27726),s=o(47603);function r(e){var n,o,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e){if(Array.isArray(e))for(n=0;n1&&(!e.frozen||e.idx+i-1<=n))return i}function stopPropagation(e){e.stopPropagation()}function scrollIntoView(e){e?.scrollIntoView({inline:"nearest",block:"nearest"})}function createCellEvent(e){let n=!1,o={...e,preventGridDefault(){n=!0},isGridDefaultPrevented:()=>n};return Object.setPrototypeOf(o,Object.getPrototypeOf(e)),o}let c=new Set(["Unidentified","Alt","AltGraph","CapsLock","Control","Fn","FnLock","Meta","NumLock","ScrollLock","Shift","Tab","ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp","Insert","ContextMenu","Escape","Pause","Play","PrintScreen","F1","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]);function isCtrlKeyHeldDown(e){return(e.ctrlKey||e.metaKey)&&"Control"!==e.key}function isDefaultCellInput(e){return!c.has(e.key)}function onEditorNavigation({key:e,target:n}){return!!("Tab"===e&&(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement))&&n.closest(".rdg-editor-container")?.querySelectorAll("input, textarea, select").length===1}function renderMeasuringCells(e){return e.map(({key:e,idx:n,minWidth:o,maxWidth:i})=>(0,u.jsx)("div",{className:"mlln6zg7-0-0-beta-40",style:{gridColumnStart:n+1,minWidth:o,maxWidth:i},"data-measuring-cell-key":e},e))}function isSelectedCellEditable({selectedPosition:e,columns:n,rows:o}){let i=n[e.idx],s=o[e.rowIdx];return isCellEditable(i,s)}function isCellEditable(e,n){return null!=e.renderEditCell&&("function"==typeof e.editable?e.editable(n):e.editable)!==!1}function getSelectedCellColSpan({rows:e,topSummaryRows:n,bottomSummaryRows:o,rowIdx:i,mainHeaderRowIdx:s,lastFrozenColumnIndex:u,column:c}){let d=n?.length??0;if(i===s)return getColSpan(c,u,{type:"HEADER"});if(n&&i>s&&i<=d+s)return getColSpan(c,u,{type:"SUMMARY",row:n[i+d]});if(i>=0&&i{for(let n of s){let o=n.idx;if(o>C)break;let i=getSelectedCellColSpan({rows:u,topSummaryRows:c,bottomSummaryRows:d,rowIdx:E,mainHeaderRowIdx:g,lastFrozenColumnIndex:S,column:n});if(i&&C>o&&Ce.level+g;if(_(w)&&(setColSpan(n),E{if(n){let e=i[C],n=e.parent;for(;void 0!==n;){let e=getParentRowIdx(n);if(E===e){C=n.idx+n.colSpan;break}n=n.parent}}else if(e){let e=i[C],n=e.parent,o=!1;for(;void 0!==n;){let e=getParentRowIdx(n);if(E>=e){C=n.idx,E=e,o=!0;break}n=n.parent}o||(C=b,E=x)}})()),"CHANGE_ROW"===o){let e=C===T,n=-1===C;if(e){let e=E===y;e||(C=0,E+=1)}else if(n){let e=E===m;e||(E-=1,C=T-1),setColSpan(!1)}}if(E=o&&(E=e,C=n.idx),n=n.parent}}return{idx:C,rowIdx:E}}function canExitGrid({maxColIdx:e,minRowIdx:n,maxRowIdx:o,selectedPosition:{rowIdx:i,idx:s},shiftKey:u}){return u?0===s&&i===n:s===e&&i===o}let d="rdg-cell cj343x07-0-0-beta-40";function getRowStyle(e,n){return void 0!==n?{"--rdg-grid-row-start":e,"--rdg-row-height":`${n}px`}:{"--rdg-grid-row-start":e}}function getHeaderCellStyle(e,n,o){let i=n+1,s=`calc(${o-1} * var(--rdg-header-row-height))`;return void 0===e.parent?{insetBlockStart:0,gridRowStart:1,gridRowEnd:i,paddingBlockStart:s}:{insetBlockStart:`calc(${n-o} * var(--rdg-header-row-height))`,gridRowStart:i-o,gridRowEnd:i,paddingBlockStart:s}}function getCellStyle(e,n=1){let o=e.idx+1;return{gridColumnStart:o,gridColumnEnd:o+n,insetInlineStart:e.frozen?`var(--rdg-frozen-left-${e.idx})`:void 0}}function getCellClassname(e,...n){return dist_clsx(d,...n,e.frozen&&"rdg-cell-frozen csofj7r7-0-0-beta-40",e.isLastFrozenColumn&&"rdg-cell-frozen-last ch2wcw87-0-0-beta-40")}let{min:m,max:g,round:y,floor:b,sign:x,abs:w}=Math;function assertIsValidKeyGetter(e){if("function"!=typeof e)throw Error("Please specify the rowKeyGetter prop to use selection")}function clampColumnWidth(e,{minWidth:n,maxWidth:o}){return(e=g(e,n),"number"==typeof o&&o>=n)?m(e,o):e}function getHeaderCellRowSpan(e,n){return void 0===e.parent?n:e.level-e.parent.level}function renderCheckbox({onChange:e,...n}){function handleChange(n){e(n.target.checked,n.nativeEvent.shiftKey)}return(0,u.jsxs)("label",{className:dist_clsx("rdg-checkbox-label c1bn88vv7-0-0-beta-40",n.disabled&&"rdg-checkbox-label-disabled c1lwve4p7-0-0-beta-40"),children:[(0,u.jsx)("input",{type:"checkbox",...n,className:"rdg-checkbox-input c1qt073l7-0-0-beta-40",onChange:handleChange}),(0,u.jsx)("div",{className:"rdg-checkbox cf71kmq7-0-0-beta-40"})]})}function renderValue(e){try{return e.row[e.column.key]}catch{return null}}let S=(0,i.createContext)(void 0),_=S.Provider;function useDefaultRenderers(){return(0,i.useContext)(S)}let C=(0,i.createContext)(void 0),E=C.Provider,T=(0,i.createContext)(void 0),P=T.Provider,O="select-row";function useCalculatedColumns({rawColumns:e,defaultColumnOptions:n,getColumnWidth:o,viewportWidth:s,scrollLeft:u,enableVirtualization:c}){let d=n?.width??"auto",y=n?.minWidth??50,b=n?.maxWidth??void 0,x=n?.renderCell??renderValue,w=n?.sortable??!1,S=n?.resizable??!1,_=n?.draggable??!1,{columns:C,colSpanColumns:E,lastFrozenColumnIndex:T,headerRowsCount:P}=(0,i.useMemo)(()=>{let n=-1,o=1,i=[];function collectColumns(e,s,u){for(let c of e){if("children"in c){let e={name:c.name,parent:u,idx:-1,colSpan:0,level:0,headerCellClass:c.headerCellClass};collectColumns(c.children,s+1,e);continue}let e=c.frozen??!1,m={...c,parent:u,idx:0,level:0,frozen:e,isLastFrozenColumn:!1,width:c.width??d,minWidth:c.minWidth??y,maxWidth:c.maxWidth??b,sortable:c.sortable??w,resizable:c.resizable??S,draggable:c.draggable??_,renderCell:c.renderCell??x};i.push(m),e&&n++,s>o&&(o=s)}}collectColumns(e,1),i.sort(({key:e,frozen:n},{key:o,frozen:i})=>e===O?-1:o===O?1:n?i?0:-1:i?1:0);let s=[];return i.forEach((e,n)=>{e.idx=n,updateColumnParent(e,n,0),null!=e.colSpan&&s.push(e)}),-1!==n&&(i[n].isLastFrozenColumn=!0),{columns:i,colSpanColumns:s,lastFrozenColumnIndex:n,headerRowsCount:o}},[e,d,y,b,x,S,w,_]),{templateColumns:R,layoutCssVars:M,totalFrozenColumnWidth:j,columnMetrics:B}=(0,i.useMemo)(()=>{let e=new Map,n=0,i=0,s=[];for(let i of C){let u=o(i);u="number"==typeof u?clampColumnWidth(u,i):i.minWidth,s.push(`${u}px`),e.set(i,{width:u,left:n}),n+=u}if(-1!==T){let n=e.get(C[T]);i=n.left+n.width}let u={};for(let n=0;n<=T;n++){let o=C[n];u[`--rdg-frozen-left-${o.idx}`]=`${e.get(o).left}px`}return{templateColumns:s,layoutCssVars:u,totalFrozenColumnWidth:i,columnMetrics:e}},[o,C,T]),[F,L]=(0,i.useMemo)(()=>{if(!c)return[0,C.length-1];let e=u+j,n=u+s,o=C.length-1,i=m(T+1,o);if(e>=n)return[i,i];let d=i;for(;de)break;d++}let y=d;for(;y=n)break;y++}let b=g(i,d-1),x=m(o,y+1);return[b,x]},[B,C,T,u,j,s,c]);return{columns:C,colSpanColumns:E,colOverscanStartIdx:F,colOverscanEndIdx:L,templateColumns:R,layoutCssVars:M,headerRowsCount:P,lastFrozenColumnIndex:T,totalFrozenColumnWidth:j}}function updateColumnParent(e,n,o){if(o{let o=new Map(n),i=!1;for(let s of e){let e=measureColumnWidth(u,s);i||=e!==n.get(s),void 0===e?o.delete(s):o.set(s,e)}return i?o:n})}return R(()=>{x.current=c,updateMeasuredWidths(C)}),{gridTemplateColumns:E,handleColumnResize:function(e,i){let{key:c}=e,m=[...o],y=[];for(let{key:e,idx:o,width:s}of n)if(c===e){let e="number"==typeof i?`${i}px`:i;m[o]=e}else w&&"string"==typeof s&&!d.has(e)&&(m[o]=s,y.push(e));u.current.style.gridTemplateColumns=m.join(" ");let x="number"==typeof i?i:measureColumnWidth(u,c);(0,s.flushSync)(()=>{g(e=>{let n=new Map(e);return n.set(c,x),n}),updateMeasuredWidths(y)}),b?.(e.idx,x)}}}function measureColumnWidth(e,n){let o=`[data-measuring-cell-key="${CSS.escape(n)}"]`,i=e.current.querySelector(o);return i?.getBoundingClientRect().width}function useGridDimensions(){let e=(0,i.useRef)(null),[n,o]=(0,i.useState)(1),[u,c]=(0,i.useState)(1);return R(()=>{let{ResizeObserver:n}=window;if(null==n)return;let{clientWidth:i,clientHeight:u,offsetWidth:d,offsetHeight:m}=e.current,{width:g,height:y}=e.current.getBoundingClientRect();o(g-d+i),c(y-m+u);let b=new n(e=>{let n=e[0].contentBoxSize[0];(0,s.flushSync)(()=>{o(n.inlineSize),c(n.blockSize)})});return b.observe(e.current),()=>{b.disconnect()}},[]),[e,n,u]}function useLatestFunc(e){let n=(0,i.useRef)(e);(0,i.useEffect)(()=>{n.current=e});let o=(0,i.useCallback)((...e)=>{n.current(...e)},[]);return e?o:e}function useRovingTabIndex(e){let[n,o]=(0,i.useState)(!1);function onFocus(e){e.target!==e.currentTarget&&o(!0)}return n&&!e&&o(!1),{tabIndex:e&&!n?0:-1,childTabIndex:e?0:-1,onFocus:e?onFocus:void 0}}function useViewportColumns({columns:e,colSpanColumns:n,rows:o,topSummaryRows:s,bottomSummaryRows:u,colOverscanStartIdx:c,colOverscanEndIdx:d,lastFrozenColumnIndex:m,rowOverscanStartIdx:g,rowOverscanEndIdx:y}){let b=(0,i.useMemo)(()=>{if(0===c)return 0;let e=c,updateStartIdx=(n,o)=>void 0!==o&&n+o>c&&(e=n,!0);for(let i of n){let n=i.idx;if(n>=e||updateStartIdx(n,getColSpan(i,m,{type:"HEADER"})))break;for(let e=g;e<=y;e++){let s=o[e];if(updateStartIdx(n,getColSpan(i,m,{type:"ROW",row:s})))break}if(null!=s){for(let e of s)if(updateStartIdx(n,getColSpan(i,m,{type:"SUMMARY",row:e})))break}if(null!=u){for(let e of u)if(updateStartIdx(n,getColSpan(i,m,{type:"SUMMARY",row:e})))break}}return e},[g,y,o,s,u,c,m,n]);return(0,i.useMemo)(()=>{let n=[];for(let o=0;o<=d;o++){let i=e[o];(!(o{if("number"==typeof n)return{totalRowHeight:n*e.length,gridTemplateRows:` repeat(${e.length}, ${n}px)`,getRowTop:e=>e*n,getRowHeight:()=>n,findRowIdx:e=>b(e/n)};let o=0,i=" ",s=e.map(e=>{let s=n(e),u={top:o,height:s};return i+=`${s}px `,o+=s,u}),validateRowIdx=n=>g(0,m(e.length-1,n));return{totalRowHeight:o,gridTemplateRows:i,getRowTop:e=>s[validateRowIdx(e)].top,getRowHeight:e=>s[validateRowIdx(e)].height,findRowIdx(e){let n=0,o=s.length-1;for(;n<=o;){let i=n+b((o-n)/2),u=s[i].top;if(u===e)return i;if(ue&&(o=i-1),n>o)return o}return 0}}},[n,e]),S=0,_=e.length-1;if(u){let n=w(s),i=w(s+o);S=g(0,n-4),_=m(e.length-1,i+4)}return{rowOverscanStartIdx:S,rowOverscanEndIdx:_,totalRowHeight:c,gridTemplateRows:d,getRowTop:y,getRowHeight:x,findRowIdx:w}}function DragHandle({gridRowStart:e,rows:n,column:o,columnWidth:i,selectedPosition:s,latestDraggedOverRowIdx:c,isCellEditable:d,onRowsChange:m,onFill:g,onClick:y,setDragging:b,setDraggedOverRowIdx:x}){let{idx:w,rowIdx:S}=s;function handleMouseDown(e){function onMouseOver(e){1!==e.buttons&&onMouseUp()}function onMouseUp(){window.removeEventListener("mouseover",onMouseOver),window.removeEventListener("mouseup",onMouseUp),b(!1),handleDragEnd()}e.preventDefault(),1===e.buttons&&(b(!0),window.addEventListener("mouseover",onMouseOver),window.addEventListener("mouseup",onMouseUp))}function handleDragEnd(){let e=c.current;if(void 0===e)return;let n=S0&&m?.(u,{indexes:c,column:o})}let _=o.colSpan?.({type:"ROW",row:n[S]})??1,C=getCellStyle(o,_);return(0,u.jsx)("div",{style:{...C,gridRowStart:e,insetInlineStart:C.insetInlineStart&&"number"==typeof i?`calc(${C.insetInlineStart} + ${i}px - var(--rdg-drag-handle-size))`:void 0},className:dist_clsx("rdg-cell-drag-handle c1w9bbhr7-0-0-beta-40",o.frozen&&"c1creorc7-0-0-beta-40"),onClick:y,onMouseDown:handleMouseDown,onDoubleClick:handleDoubleClick})}function EditCell({column:e,colSpan:n,row:o,rowIdx:s,onRowChange:c,closeEditor:d,onKeyDown:m,navigate:g}){let y=(0,i.useRef)(),b=e.editorOptions?.commitOnOutsideClick!==!1,x=useLatestFunc(()=>{onClose(!0,!1)});function cancelFrameRequest(){cancelAnimationFrame(y.current)}function handleKeyDown(n){if(m){let i=createCellEvent(n);if(m({mode:"EDIT",row:o,column:e,rowIdx:s,navigate(){g(n)},onClose},i),i.isGridDefaultPrevented())return}"Escape"===n.key?onClose():"Enter"===n.key?onClose(!0):onEditorNavigation(n)&&g(n)}function onClose(e=!1,n=!0){e?c(o,!0,n):d(n)}function onEditorRowChange(e,n=!1){c(e,n,n)}(0,i.useEffect)(()=>{if(b)return addEventListener("mousedown",onWindowCaptureMouseDown,{capture:!0}),()=>{removeEventListener("mousedown",onWindowCaptureMouseDown,{capture:!0}),cancelFrameRequest()};function onWindowCaptureMouseDown(){y.current=requestAnimationFrame(x)}},[b,x]);let{cellClass:w}=e,S=getCellClassname(e,"rdg-editor-container","function"==typeof w?w(o):w,!e.editorOptions?.displayCellContent&&"cis5rrm7-0-0-beta-40");return(0,u.jsx)("div",{role:"gridcell","aria-colindex":e.idx+1,"aria-colspan":n,"aria-selected":!0,className:S,style:getCellStyle(e,n),onKeyDown:handleKeyDown,onMouseDownCapture:cancelFrameRequest,children:null!=e.renderEditCell&&(0,u.jsxs)(u.Fragment,{children:[e.renderEditCell({column:e,row:o,onRowChange:onEditorRowChange,onClose}),e.editorOptions?.displayCellContent&&e.renderCell({column:e,row:o,isCellEditable:!0,tabIndex:-1,onRowChange:onEditorRowChange})]})})}function GroupedColumnHeaderCell({column:e,rowIdx:n,isCellSelected:o,selectCell:i}){let{tabIndex:s,onFocus:c}=useRovingTabIndex(o),{colSpan:m}=e,g=getHeaderCellRowSpan(e,n),y=e.idx+1;function onClick(){i({idx:e.idx,rowIdx:n})}return(0,u.jsx)("div",{role:"columnheader","aria-colindex":y,"aria-colspan":m,"aria-rowspan":g,"aria-selected":o,tabIndex:s,className:dist_clsx(d,e.headerCellClass),style:{...getHeaderCellStyle(e,n,g),gridColumnStart:y,gridColumnEnd:y+m},onFocus:c,onClick:onClick,children:e.name})}function renderHeaderCell({column:e,sortDirection:n,priority:o}){return e.sortable?(0,u.jsx)(SortableHeaderCell,{sortDirection:n,priority:o,children:e.name}):e.name}function SortableHeaderCell({sortDirection:e,priority:n,children:o}){let i=useDefaultRenderers().renderSortStatus;return(0,u.jsxs)("span",{className:"h44jtk67-0-0-beta-40",children:[(0,u.jsx)("span",{className:"rdg-header-sort-name hcgkhxz7-0-0-beta-40",children:o}),(0,u.jsx)("span",{children:i({sortDirection:e,priority:n})})]})}function HeaderCell({column:e,colSpan:n,rowIdx:o,isCellSelected:s,onColumnResize:c,onColumnsReorder:d,sortColumns:m,onSortColumnsChange:g,selectCell:y,shouldFocusGrid:b,direction:x,dragDropKey:w}){let S;let[_,C]=(0,i.useState)(!1),[E,T]=(0,i.useState)(!1),P="rtl"===x,O=getHeaderCellRowSpan(e,o),{tabIndex:R,childTabIndex:M,onFocus:j}=useRovingTabIndex(s),B=m?.findIndex(n=>n.columnKey===e.key),F=void 0!==B&&B>-1?m[B]:void 0,L=F?.direction,N=void 0!==F&&m.length>1?B+1:void 0,V=L&&!N?"ASC"===L?"ascending":"descending":void 0,{sortable:W,resizable:U,draggable:$}=e,H=getCellClassname(e,e.headerCellClass,W&&"c6l2wv17-0-0-beta-40",U&&"rdg-cell-resizable c1kqdw7y7-0-0-beta-40",$&&"rdg-cell-draggable",_&&"rdg-cell-dragging c1bezg5o7-0-0-beta-40",E&&"rdg-cell-drag-over c1vc96037-0-0-beta-40"),G=e.renderHeaderCell??renderHeaderCell;function onPointerDown(n){if("mouse"===n.pointerType&&1!==n.buttons)return;let{currentTarget:o,pointerId:i}=n,s=o.parentElement,{right:u,left:d}=s.getBoundingClientRect(),m=P?n.clientX-d:u-n.clientX;function onPointerMove(n){n.preventDefault();let{right:o,left:i}=s.getBoundingClientRect(),u=P?o+m-n.clientX:n.clientX+m-i;u>0&&c(e,clampColumnWidth(u,e))}function onLostPointerCapture(){o.removeEventListener("pointermove",onPointerMove),o.removeEventListener("lostpointercapture",onLostPointerCapture)}o.setPointerCapture(i),o.addEventListener("pointermove",onPointerMove),o.addEventListener("lostpointercapture",onLostPointerCapture)}function onSort(n){if(null==g)return;let{sortDescendingFirst:o}=e;if(void 0===F){let i={columnKey:e.key,direction:o?"DESC":"ASC"};g(m&&n?[...m,i]:[i])}else{let i;if((!0===o&&"DESC"===L||!0!==o&&"ASC"===L)&&(i={columnKey:e.key,direction:"ASC"===L?"DESC":"ASC"}),n){let e=[...m];i?e[B]=i:e.splice(B,1),g(e)}else g(i?[i]:[])}}function onClick(n){y({idx:e.idx,rowIdx:o}),W&&onSort(n.ctrlKey||n.metaKey)}function onDoubleClick(){c(e,"max-content")}function handleFocus(e){j?.(e),b&&y({idx:0,rowIdx:o})}function onKeyDown(e){(" "===e.key||"Enter"===e.key)&&(e.preventDefault(),onSort(e.ctrlKey||e.metaKey))}function onDragStart(n){n.dataTransfer.setData(w,e.key),n.dataTransfer.dropEffect="move",C(!0)}function onDragEnd(){C(!1)}function onDragOver(e){e.preventDefault(),e.dataTransfer.dropEffect="move"}function onDrop(n){if(T(!1),n.dataTransfer.types.includes(w)){let o=n.dataTransfer.getData(w);o!==e.key&&(n.preventDefault(),d?.(o,e.key))}}function onDragEnter(e){isEventPertinent(e)&&T(!0)}function onDragLeave(e){isEventPertinent(e)&&T(!1)}return $&&(S={draggable:!0,onDragStart,onDragEnd,onDragOver,onDragEnter,onDragLeave,onDrop}),(0,u.jsxs)("div",{role:"columnheader","aria-colindex":e.idx+1,"aria-colspan":n,"aria-rowspan":O,"aria-selected":s,"aria-sort":V,tabIndex:b?0:R,className:H,style:{...getHeaderCellStyle(e,o,O),...getCellStyle(e,n)},onFocus:handleFocus,onClick:onClick,onKeyDown:W?onKeyDown:void 0,...S,children:[G({column:e,sortDirection:L,priority:N,tabIndex:M}),U&&(0,u.jsx)("div",{className:"r1y6ywlx7-0-0-beta-40",onClick:stopPropagation,onDoubleClick:onDoubleClick,onPointerDown:onPointerDown})]})}function isEventPertinent(e){let n=e.relatedTarget;return!e.currentTarget.contains(n)}let M="rdg-row r1upfr807-0-0-beta-40",j="rdg-row-selected",B="rdg-header-row h10tskcx7-0-0-beta-40";function HeaderRow({rowIdx:e,columns:n,onColumnResize:o,onColumnsReorder:s,sortColumns:c,onSortColumnsChange:d,lastFrozenColumnIndex:m,selectedCellIdx:g,selectCell:y,shouldFocusGrid:b,direction:x}){let w=(0,i.useId)(),S=[];for(let i=0;in&&void 0!==o.parent;)o=o.parent;if(o.level===n&&!d.has(o)){d.add(o);let{idx:n}=o;c.push((0,u.jsx)(GroupedColumnHeaderCell,{column:o,rowIdx:e,isCellSelected:i===n,selectCell:s},n))}}}return(0,u.jsx)("div",{role:"row","aria-rowindex":e,className:B,children:c})}let L=(0,i.memo)(GroupedColumnHeaderRow);function Cell({column:e,colSpan:n,isCellSelected:o,isCopied:i,isDraggedOver:s,row:c,rowIdx:d,onClick:m,onDoubleClick:g,onContextMenu:y,onRowChange:b,selectCell:x,...w}){let{tabIndex:S,childTabIndex:_,onFocus:C}=useRovingTabIndex(o),{cellClass:E}=e,T=getCellClassname(e,"function"==typeof E?E(c):E,i&&"rdg-cell-copied c6ra8a37-0-0-beta-40",s&&"rdg-cell-dragged-over cq910m07-0-0-beta-40"),P=isCellEditable(e,c);function selectCellWrapper(n){x({rowIdx:d,idx:e.idx},n)}function handleClick(n){if(m){let o=createCellEvent(n);if(m({row:c,column:e,selectCell:selectCellWrapper},o),o.isGridDefaultPrevented())return}selectCellWrapper()}function handleContextMenu(n){if(y){let o=createCellEvent(n);if(y({row:c,column:e,selectCell:selectCellWrapper},o),o.isGridDefaultPrevented())return}selectCellWrapper()}function handleDoubleClick(n){if(g){let o=createCellEvent(n);if(g({row:c,column:e,selectCell:selectCellWrapper},o),o.isGridDefaultPrevented())return}selectCellWrapper(!0)}function handleRowChange(n){b(e,n)}return(0,u.jsx)("div",{role:"gridcell","aria-colindex":e.idx+1,"aria-colspan":n,"aria-selected":o,"aria-readonly":!P||void 0,tabIndex:S,className:T,style:getCellStyle(e,n),onClick:handleClick,onDoubleClick:handleDoubleClick,onContextMenu:handleContextMenu,onFocus:C,...w,children:e.renderCell({column:e,row:c,isCellEditable:P,tabIndex:_,onRowChange:handleRowChange})})}let N=(0,i.memo)(Cell);function Row({className:e,rowIdx:n,gridRowStart:o,height:i,selectedCellIdx:s,isRowSelected:c,copiedCellIdx:d,draggedOverCellIdx:m,lastFrozenColumnIndex:g,row:y,viewportColumns:b,selectedCellEditor:x,onCellClick:w,onCellDoubleClick:S,onCellContextMenu:_,rowClass:C,setDraggedOverRowIdx:T,onMouseEnter:P,onRowChange:O,selectCell:R,...B},F){let L=useLatestFunc((e,o)=>{O(e,n,o)});function handleDragEnter(e){T?.(n),P?.(e)}e=dist_clsx(M,`rdg-row-${n%2==0?"even":"odd"}`,C?.(y,n),e,-1===s&&j);let V=[];for(let e=0;e{scrollIntoView(c.current)}),R(()=>{function removeScrollToCell(){s(null)}let e=new IntersectionObserver(removeScrollToCell,{root:o,threshold:1});return e.observe(c.current),()=>{e.disconnect()}},[o,s]),(0,u.jsx)("div",{ref:c,style:{gridColumn:void 0===e?"1/-1":e+1,gridRow:void 0===n?"1/-1":n+2}})}function renderSortStatus({sortDirection:e,priority:n}){return(0,u.jsxs)(u.Fragment,{children:[renderSortIcon({sortDirection:e}),renderSortPriority({priority:n})]})}function renderSortIcon({sortDirection:e}){return void 0===e?null:(0,u.jsx)("svg",{viewBox:"0 0 12 8",width:"12",height:"8",className:"rdg-sort-arrow a3ejtar7-0-0-beta-40","aria-hidden":!0,children:(0,u.jsx)("path",{d:"ASC"===e?"M0 8 6 0 12 8":"M0 0 6 8 12 0"})})}function renderSortPriority({priority:e}){return e}function SummaryCell({column:e,colSpan:n,row:o,rowIdx:i,isCellSelected:s,selectCell:c}){let{tabIndex:d,childTabIndex:m,onFocus:g}=useRovingTabIndex(s),{summaryCellClass:y}=e,b=getCellClassname(e,"s8wc6fl7-0-0-beta-40","function"==typeof y?y(o):y);function onClick(){c({rowIdx:i,idx:e.idx})}return(0,u.jsx)("div",{role:"gridcell","aria-colindex":e.idx+1,"aria-colspan":n,"aria-selected":s,tabIndex:d,className:b,style:getCellStyle(e,n),onClick:onClick,onFocus:g,children:e.renderSummaryCell?.({column:e,row:o,tabIndex:m})})}let W=(0,i.memo)(SummaryCell);function SummaryRow({rowIdx:e,gridRowStart:n,row:o,viewportColumns:i,top:s,bottom:c,lastFrozenColumnIndex:d,selectedCellIdx:m,isTop:g,showBorder:y,selectCell:b,"aria-rowindex":x}){let w=[];for(let n=0;nnew Map),[eO,eA]=(0,i.useState)(()=>new Map),[eR,eI]=(0,i.useState)(null),[eM,ej]=(0,i.useState)(!1),[eD,eB]=(0,i.useState)(void 0),[eF,eL]=(0,i.useState)(null),eN=(0,i.useCallback)(e=>eT.get(e.key)??eO.get(e.key)??e.width,[eO,eT]),[eV,ez,eW]=useGridDimensions(),{columns:eU,colSpanColumns:e$,lastFrozenColumnIndex:eH,headerRowsCount:eG,colOverscanStartIdx:eZ,colOverscanEndIdx:eK,templateColumns:eY,layoutCssVars:eX,totalFrozenColumnWidth:eQ}=useCalculatedColumns({rawColumns:o,defaultColumnOptions:B,getColumnWidth:eN,scrollLeft:ek,viewportWidth:ez,enableVirtualization:ew}),eJ=d?.length??0,e0=m?.length??0,e1=eJ+e0,e2=eG+eJ,e5=eG-1,e4=-e2,e3=e4+e5,e6=c.length+e0-1,[e7,e8]=(0,i.useState)(()=>({idx:-1,rowIdx:e4-1,mode:"SELECT"})),e9=(0,i.useRef)(e7),tt=(0,i.useRef)(eD),tr=(0,i.useRef)(-1),tn=(0,i.useRef)(null),ti=(0,i.useRef)(!1),ta="treegrid"===ep,ts=eG*em,tl=eW-ts-e1*eg,tu=null!=T&&null!=O,tc="rtl"===eS,td=tc?"ArrowRight":"ArrowLeft",tf=tc?"ArrowLeft":"ArrowRight",tp=ec??eG+c.length+e1,th=(0,i.useMemo)(()=>({renderCheckbox:eb,renderSortStatus:ey}),[eb,ey]),tm=(0,i.useMemo)(()=>{let{length:e}=c;return 0!==e&&null!=T&&null!=g&&T.size>=e&&c.every(e=>T.has(g(e)))},[c,T,g]),{rowOverscanStartIdx:tg,rowOverscanEndIdx:tv,totalRowHeight:ty,gridTemplateRows:tb,getRowTop:tx,getRowHeight:tw,findRowIdx:tS}=useViewportRows({rows:c,rowHeight:eh,clientHeight:tl,scrollTop:e_,enableVirtualization:ew}),t_=useViewportColumns({columns:eU,colSpanColumns:e$,colOverscanStartIdx:eZ,colOverscanEndIdx:eK,lastFrozenColumnIndex:eH,rowOverscanStartIdx:tg,rowOverscanEndIdx:tv,rows:c,topSummaryRows:d,bottomSummaryRows:m}),{gridTemplateColumns:tC,handleColumnResize:tk}=useColumnWidths(eU,t_,eY,eV,ez,eT,eO,eP,eA,K),tE=ta?-1:0,tT=eU.length-1,tP=isCellWithinSelectionBounds(e7),tO=isCellWithinViewportBounds(e7),tA=useLatestFunc(tk),tR=useLatestFunc(Y),tI=useLatestFunc(j),tM=useLatestFunc(N),tj=useLatestFunc(V),tD=useLatestFunc(W),tB=useLatestFunc(selectRow),tF=useLatestFunc(updateRow),tL=useLatestFunc(selectCell),tN=useLatestFunc(({idx:e,rowIdx:n})=>{selectCell({rowIdx:e4+n-1,idx:e})});R(()=>{if(!tP||isSamePosition(e7,e9.current)){e9.current=e7;return}e9.current=e7,-1===e7.idx&&(tn.current.focus({preventScroll:!0}),scrollIntoView(tn.current))}),R(()=>{ti.current&&(ti.current=!1,focusCellOrCellContent())}),(0,i.useImperativeHandle)(n,()=>({element:eV.current,scrollToCell({idx:e,rowIdx:n}){let o=void 0!==e&&e>eH&&e{eB(e),tt.current=e},[]);function selectRow(e){if(!O)return;if(assertIsValidKeyGetter(g),"HEADER"===e.type){let n=new Set(T);for(let o of c){let i=g(o);e.checked?n.add(i):n.delete(i)}O(n);return}let{row:n,checked:o,isShiftClick:i}=e,s=new Set(T),u=g(n);if(o){s.add(u);let e=tr.current,o=c.indexOf(n);if(tr.current=o,i&&-1!==e&&e!==o){let n=x(o-e);for(let i=e+n;i!==o;i+=n){let e=c[i];s.add(g(e))}}}else s.delete(u),tr.current=-1;O(s)}function handleKeyDown(e){let{idx:n,rowIdx:o,mode:i}=e7;if("EDIT"===i)return;if($&&isRowIdxWithinViewportBounds(o)){let i=c[o],s=createCellEvent(e);if($({mode:"SELECT",row:i,column:eU[n],rowIdx:o,selectCell},s),s.isGridDefaultPrevented())return}if(!(e.target instanceof Element))return;let s=null!==e.target.closest(".rdg-cell"),u=ta&&e.target===tn.current;if(!s&&!u)return;let{keyCode:d}=e;if(tO&&(null!=J||null!=Q)&&isCtrlKeyHeldDown(e)){if(67===d){handleCopy();return}if(86===d){handlePaste();return}}switch(e.key){case"Escape":eI(null);return;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"Tab":case"Home":case"End":case"PageUp":case"PageDown":navigate(e);break;default:handleCellInput(e)}}function handleScroll(e){let{scrollTop:n,scrollLeft:o}=e.currentTarget;(0,s.flushSync)(()=>{eC(n),eE(w(o))}),G?.(e)}function updateRow(e,n,o){if("function"!=typeof y||o===c[n])return;let i=[...c];i[n]=o,y(i,{indexes:[n],column:e})}function commitEditorChanges(){"EDIT"===e7.mode&&updateRow(eU[e7.idx],e7.rowIdx,e7.row)}function handleCopy(){let{idx:e,rowIdx:n}=e7,o=c[n],i=eU[e].key;eI({row:o,columnKey:i}),Q?.({sourceRow:o,sourceColumnKey:i})}function handlePaste(){if(!J||!y||null===eR||!isCellEditable(e7))return;let{idx:e,rowIdx:n}=e7,o=eU[e],i=c[n],s=J({sourceRow:eR.row,sourceColumnKey:eR.columnKey,targetRow:i,targetColumnKey:o.key});updateRow(o,n,s)}function handleCellInput(e){if(!tO)return;let n=c[e7.rowIdx],{key:o,shiftKey:i}=e;if(tu&&i&&" "===o){assertIsValidKeyGetter(g);let o=g(n);selectRow({type:"ROW",row:n,checked:!T.has(o),isShiftClick:!1}),e.preventDefault();return}isCellEditable(e7)&&isDefaultCellInput(e)&&e8(({idx:e,rowIdx:o})=>({idx:e,rowIdx:o,mode:"EDIT",row:n,originalRow:n}))}function isRowIdxWithinViewportBounds(e){return e>=0&&e=e4&&n<=e6&&(o=e)>=tE&&o<=tT}function isCellWithinViewportBounds({idx:e,rowIdx:n}){var o;return isRowIdxWithinViewportBounds(n)&&(o=e)>=tE&&o<=tT}function isCellEditable(e){return isCellWithinViewportBounds(e)&&isSelectedCellEditable({columns:eU,rows:c,selectedPosition:e})}function selectCell(e,n){if(!isCellWithinSelectionBounds(e))return;commitEditorChanges();let o=c[e.rowIdx],i=isSamePosition(e7,e);n&&isCellEditable(e)?e8({...e,mode:"EDIT",row:o,originalRow:o}):i?scrollIntoView(getCellToScroll(eV.current)):(ti.current=!0,e8({...e,mode:"SELECT"})),H&&!i&&H({rowIdx:e.rowIdx,row:o,column:eU[e.idx]})}function getNextPosition(e,n,o){let{idx:i,rowIdx:s}=e7,u=tP&&-1===i;switch(e){case"ArrowUp":return{idx:i,rowIdx:s-1};case"ArrowDown":return{idx:i,rowIdx:s+1};case td:return{idx:i-1,rowIdx:s};case tf:return{idx:i+1,rowIdx:s};case"Tab":return{idx:i+(o?-1:1),rowIdx:s};case"Home":if(u)return{idx:i,rowIdx:e4};return{idx:0,rowIdx:n?e4:s};case"End":if(u)return{idx:i,rowIdx:e6};return{idx:tT,rowIdx:n?e6:s};case"PageUp":{if(e7.rowIdx===e4)return e7;let e=tx(s)+tw(s)-tl;return{idx:i,rowIdx:e>0?tS(e):0}}case"PageDown":{if(e7.rowIdx>=c.length)return e7;let e=tx(s)+tl;return{idx:i,rowIdx:ee&&e>=eD;return o?e7.idx:void 0}function focusCellOrCellContent(){let e=getCellToScroll(eV.current);if(null===e)return;scrollIntoView(e);let n=e.querySelector('[tabindex="0"]')??e;n.focus({preventScroll:!0})}function renderDragHandle(){if(null==X||"EDIT"===e7.mode||!isCellWithinViewportBounds(e7))return;let e=eU[e7.idx];if(null==e.renderEditCell||!1===e.editable)return;let n=eN(e);return(0,u.jsx)(DragHandle,{gridRowStart:e2+e7.rowIdx+1,rows:c,column:e,columnWidth:n,selectedPosition:e7,isCellEditable:isCellEditable,latestDraggedOverRowIdx:tt,onRowsChange:y,onClick:focusCellOrCellContent,onFill:X,setDragging:ej,setDraggedOverRowIdx:tV})}function getCellEditor(e){if(e7.rowIdx!==e||"SELECT"===e7.mode)return;let{idx:n,row:o}=e7,i=eU[n],d=getColSpan(i,eH,{type:"ROW",row:o}),closeEditor=e=>{ti.current=e,e8(({idx:e,rowIdx:n})=>({idx:e,rowIdx:n,mode:"SELECT"}))};return c[e7.rowIdx]!==e7.originalRow&&closeEditor(!1),(0,u.jsx)(EditCell,{column:i,colSpan:d,row:o,rowIdx:e,onRowChange:(e,n,o)=>{n?(0,s.flushSync)(()=>{updateRow(i,e7.rowIdx,e),closeEditor(o)}):e8(n=>({...n,row:e}))},closeEditor:closeEditor,onKeyDown:$,navigate:navigate},i.key)}function getRowViewportColumns(e){let n=-1===e7.idx?void 0:eU[e7.idx];return void 0===n||e7.rowIdx!==e||t_.includes(n)?t_:e7.idx>eK?[...t_,n]:[...t_.slice(0,eH+1),n,...t_.slice(eH+1)]}function getViewportRows(){let e=[],{idx:n,rowIdx:o}=e7,i=tO&&otv?tv+1:tv;for(let u=i;u<=s;u++){let i=u===tg-1||u===tv+1,s=i?o:u,d=t_,m=-1===n?void 0:eU[n];void 0!==m&&(d=i?[m]:getRowViewportColumns(s));let y=c[s],b=e2+s+1,x=s,w=!1;"function"==typeof g&&(x=g(y),w=T?.has(x)??!1),e.push(ev(x,{"aria-rowindex":e2+s+1,"aria-selected":tu?w:void 0,rowIdx:s,row:y,viewportColumns:d,isRowSelected:w,onCellClick:tM,onCellDoubleClick:tj,onCellContextMenu:tD,rowClass:eo,gridRowStart:b,height:tw(s),copiedCellIdx:null!==eR&&eR.row===y?eU.findIndex(e=>e.key===eR.columnKey):void 0,selectedCellIdx:o===s?n:void 0,draggedOverCellIdx:getDraggedOverCellIdx(s),setDraggedOverRowIdx:eM?tV:void 0,lastFrozenColumnIndex:eH,onRowChange:tF,selectCell:tL,selectedCellEditor:getCellEditor(s)}))}return e}(e7.idx>tT||e7.rowIdx>e6)&&(e8({idx:-1,rowIdx:e4-1,mode:"SELECT"}),tV(void 0));let tz=`repeat(${eG}, ${em}px)`;eJ>0&&(tz+=` repeat(${eJ}, ${eg}px)`),c.length>0&&(tz+=tb),e0>0&&(tz+=` repeat(${e0}, ${eg}px)`);let tW=-1===e7.idx&&e7.rowIdx!==e4-1;return(0,u.jsxs)("div",{role:ep,"aria-label":es,"aria-labelledby":el,"aria-describedby":eu,"aria-multiselectable":!!tu||void 0,"aria-colcount":eU.length,"aria-rowcount":tp,className:dist_clsx("rdg rnvodz57-0-0-beta-40",er,eM&&"rdg-viewport-dragging vlqv91k7-0-0-beta-40"),style:{...en,scrollPaddingInlineStart:e7.idx>eH||eF?.idx!==void 0?`${eQ}px`:void 0,scrollPaddingBlock:isRowIdxWithinViewportBounds(e7.rowIdx)||eF?.rowIdx!==void 0?`${ts+eJ*eg}px ${e0*eg}px`:void 0,gridTemplateColumns:tC,gridTemplateRows:tz,"--rdg-header-row-height":`${em}px`,"--rdg-summary-row-height":`${eg}px`,"--rdg-sign":tc?-1:1,...eX},dir:eS,ref:eV,onScroll:handleScroll,onKeyDown:handleKeyDown,"data-testid":ed,children:[(0,u.jsx)(_,{value:th,children:(0,u.jsxs)(P,{value:tB,children:[(0,u.jsxs)(E,{value:tm,children:[Array.from({length:e5},(e,n)=>(0,u.jsx)(L,{rowIdx:n+1,level:-e5+n,columns:getRowViewportColumns(e4+n),selectedCellIdx:e7.rowIdx===e4+n?e7.idx:void 0,selectCell:tN},n)),(0,u.jsx)(F,{rowIdx:eG,columns:getRowViewportColumns(e3),onColumnResize:tA,onColumnsReorder:tR,sortColumns:M,onSortColumnsChange:tI,lastFrozenColumnIndex:eH,selectedCellIdx:e7.rowIdx===e3?e7.idx:void 0,selectCell:tN,shouldFocusGrid:!tP,direction:eS})]}),0===c.length&&ex?ex:(0,u.jsxs)(u.Fragment,{children:[d?.map((e,n)=>{let o=eG+1+n,i=e3+1+n,s=e7.rowIdx===i,c=ts+eg*n;return u.jsx(U,{"aria-rowindex":o,rowIdx:i,gridRowStart:o,row:e,top:c,bottom:void 0,viewportColumns:getRowViewportColumns(i),lastFrozenColumnIndex:eH,selectedCellIdx:s?e7.idx:void 0,isTop:!0,showBorder:n===eJ-1,selectCell:tL},n)}),getViewportRows(),m?.map((e,n)=>{let o=e2+c.length+n+1,i=c.length+n,s=e7.rowIdx===i,d=tl>ty?eW-eg*(m.length-n):void 0,g=void 0===d?eg*(m.length-1-n):void 0;return u.jsx(U,{"aria-rowindex":tp-e0+n+1,rowIdx:i,gridRowStart:o,row:e,top:d,bottom:g,viewportColumns:getRowViewportColumns(i),lastFrozenColumnIndex:eH,selectedCellIdx:s?e7.idx:void 0,isTop:!1,showBorder:0===n,selectCell:tL},n)})]})]})}),renderDragHandle(),renderMeasuringCells(t_),ta&&(0,u.jsx)("div",{ref:tn,tabIndex:tW?0:-1,className:dist_clsx("f1lsfrzw7-0-0-beta-40",tW&&["r190mhd37-0-0-beta-40",-1!==eH&&"r139qu9m7-0-0-beta-40"],!isRowIdxWithinViewportBounds(e7.rowIdx)&&"f1cte0lg7-0-0-beta-40"),style:{gridRowStart:e7.rowIdx+e2+1}}),null!==eF&&(0,u.jsx)(ScrollToCell,{scrollToPosition:eF,setScrollToCellPosition:eL,gridElement:eV.current})]})}function getCellToScroll(e){return e.querySelector(':scope > [role="row"] > [tabindex="0"]')}function isSamePosition(e,n){return e.idx===n.idx&&e.rowIdx===n.rowIdx}let $=(0,i.forwardRef)(DataGrid);function autoFocusAndSelect(e){e?.focus(),e?.select()}function textEditor({row:e,column:n,onRowChange:o,onClose:i}){return(0,u.jsx)("input",{className:"rdg-text-editor t7vyx3i7-0-0-beta-40",ref:autoFocusAndSelect,value:e[n.key],onChange:i=>o({...e,[n.key]:i.target.value}),onBlur:()=>i(!0,!1)})}},90701:function(e,n,o){"use strict";o.d(n,{CR:function(){return __read},Jh:function(){return __generator},XA:function(){return __values},ZT:function(){return __extends},_T:function(){return __rest},ev:function(){return __spreadArray},mG:function(){return __awaiter},pi:function(){return __assign}});var extendStatics=function(e,n){return(extendStatics=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])})(e,n)};function __extends(e,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function __(){this.constructor=e}extendStatics(e,n),e.prototype=null===n?Object.create(n):(__.prototype=n.prototype,new __)}var __assign=function(){return(__assign=Object.assign||function(e){for(var n,o=1,i=arguments.length;on.indexOf(i)&&(o[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,i=Object.getOwnPropertySymbols(e);sn.indexOf(i[s])&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(o[i[s]]=e[i[s]]);return o}function __awaiter(e,n,o,i){function adopt(e){return e instanceof o?e:new o(function(n){n(e)})}return new(o||(o=Promise))(function(o,s){function fulfilled(e){try{step(i.next(e))}catch(e){s(e)}}function rejected(e){try{step(i.throw(e))}catch(e){s(e)}}function step(e){e.done?o(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,n||[])).next())})}function __generator(e,n){var o,i,s,u,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return u={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function verb(e){return function(n){return step([e,n])}}function step(d){if(o)throw TypeError("Generator is already executing.");for(;u&&(u=0,d[0]&&(c=0)),c;)try{if(o=1,i&&(s=2&d[0]?i.return:d[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,d[1])).done)return s;switch(i=0,s&&(d=[2&d[0],s.value]),d[0]){case 0:case 1:s=d;break;case 4:return c.label++,{value:d[1],done:!1};case 5:c.label++,i=d[1],d=[0];continue;case 7:d=c.ops.pop(),c.trys.pop();continue;default:if(!(s=(s=c.trys).length>0&&s[s.length-1])&&(6===d[0]||2===d[0])){c=0;continue}if(3===d[0]&&(!s||d[1]>s[0]&&d[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(e,n){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var i,s,u=o.call(e),c=[];try{for(;(void 0===n||n-- >0)&&!(i=u.next()).done;)c.push(i.value)}catch(e){s={error:e}}finally{try{i&&!i.done&&(o=u.return)&&o.call(u)}finally{if(s)throw s.error}}return c}function __spreadArray(e,n,o){if(o||2==arguments.length)for(var i,s=0,u=n.length;sn[o]||(n[o]=e(o));return(e,n)=>{let{regexp:o,keys:i}=getRegexp(e||""),s=o.exec(n);if(!s)return[!1,null];let u=i.reduce((e,n,o)=>(e[n.name]=s[o+1],e),{});return[!0,u]}}let escapeRx=e=>e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),rxForSegment=(e,n,o)=>{let i=e?"((?:[^\\/]+?)(?:\\/(?:[^\\/]+?))*)":"([^\\/]+?)";return n&&o&&(i="(?:\\/"+i+")"),i+(n?"?":"")},pathToRegexp=e=>{let n=/:([A-Za-z0-9_]+)([?+*]?)/g,o=null,i=0,s=[],u="";for(;null!==(o=n.exec(e));){let[c,d,m]=o,g="+"===m||"*"===m,y="?"===m||"*"===m,b=y&&"/"===e[o.index-1]?1:0,x=e.substring(i,o.index-b);s.push({name:d}),i=n.lastIndex,u+=escapeRx(x)+rxForSegment(g,y,b)}return{keys:s,regexp:RegExp("^"+(u+=escapeRx(e.substring(i)))+"(?:\\/)?$","i")}};var s=o(42445);let u={hook:i.ZP,matcher:makeMatcher(),base:""},c=(0,s.kr)(u),useRouter=()=>(0,s.qp)(c),useLocationFromRouter=e=>e.hook(e),useLocation=()=>useLocationFromRouter(useRouter()),useRoute=e=>{let n=useRouter(),[o]=useLocationFromRouter(n);return n.matcher(e,o)},d=(0,s.kr)({params:{}}),Router=({hook:e,matcher:n,ssrPath:o,base:i="",parent:d,children:m})=>{let updateRouter=(s,c=d||u)=>(s.hook=e||c.hook,s.matcher=n||c.matcher,s.ssrPath=o||c.ssrPath,s.ownBase=i,s.parent=d,s),[g]=(0,s.eJ)(()=>updateRouter({get base(){return(g.parent||u).base+g.ownBase}}));return(0,s.NU)(()=>{updateRouter(g)}),(0,s.az)(c.Provider,{value:g,children:m})},ParamsWrapper=(e,n)=>(0,s.az)(d.Provider,{value:{params:e},children:n}),Route=({path:e,match:n,component:o,children:i})=>{let u=useRoute(e),[c,d]=n||u;return c?o?ParamsWrapper(d,(0,s.az)(o,{params:d})):ParamsWrapper(d,"function"==typeof i?i(d):i):null};(0,s.Gp)((e,n)=>{let o=useRouter(),[,i]=useLocationFromRouter(o),{to:u,href:c=u,children:d,onClick:m}=e,g=(0,s.zX)(n=>{n.ctrlKey||n.metaKey||n.altKey||n.shiftKey||0!==n.button||(m&&m(n),n.defaultPrevented||(n.preventDefault(),i(u||c,e)))}),y={href:"~"===c[0]?c.slice(1):o.base+c,onClick:g,to:null,ref:n},b=(0,s.l$)(d)?d:(0,s.az)("a",e);return(0,s.Tm)(b,y)});let flattenChildren=e=>Array.isArray(e)?[].concat(...e.map(e=>e&&e.type===s.HY?flattenChildren(e.props.children):flattenChildren(e))):[e],Switch=({children:e,location:n})=>{let o=useRouter(),i=o.matcher,[u]=useLocationFromRouter(o);for(let o of flattenChildren(e)){let e=0;if((0,s.l$)(o)&&(e=o.props.path?i(o.props.path,n||u):[!0,{}])[0])return(0,s.Tm)(o,{match:e})}return null},Redirect=e=>{let{to:n,href:o=n}=e,[,i]=useLocation(),u=(0,s.zX)(()=>i(n||o,e));return(0,s.LI)(()=>{u()},[]),null}},42445:function(e,n,o){"use strict";o.d(n,{HY:function(){return i.Fragment},Tm:function(){return i.cloneElement},kr:function(){return i.createContext},az:function(){return i.createElement},Gp:function(){return i.forwardRef},l$:function(){return i.isValidElement},qp:function(){return i.useContext},zX:function(){return useEvent},NU:function(){return x},LI:function(){return b},eJ:function(){return i.useState},$N:function(){return u.useSyncExternalStore}});var i=o(27726),s=o.t(i,2),u=o(33916);let{useEffect:c,useLayoutEffect:d,useRef:m,useInsertionEffect:g}=s,y=!!("undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement),b=y?d:c,x=g||b,useEvent=e=>{let n=m([e,(...e)=>n[0](...e)]).current;return x(()=>{n[0]=e}),n[1]}},72952:function(e,n,o){"use strict";o.d(n,{ZP:function(){return use_location},c4:function(){return use_location_navigate},LD:function(){return useLocationProperty}});var i=o(42445);let relativePath=(e="",n=location.pathname)=>n.toLowerCase().indexOf(e.toLowerCase())?"~"+n:n.slice(e.length)||"/",absolutePath=(e,n="")=>"~"===e[0]?e.slice(1):n+e,s="pushState",u="replaceState",c=["popstate",s,u,"hashchange"],subscribeToLocationUpdates=e=>{for(let n of c)addEventListener(n,e);return()=>{for(let n of c)removeEventListener(n,e)}},useLocationProperty=(e,n)=>(0,i.$N)(subscribeToLocationUpdates,e,n),currentPathname=()=>location.pathname,usePathname=({ssrPath:e}={})=>useLocationProperty(currentPathname,e?()=>e:currentPathname),use_location_navigate=(e,{replace:n=!1}={})=>history[n?u:s](null,"",e);var use_location=(e={})=>[relativePath(e.base,usePathname(e)),(0,i.zX)((n,o)=>use_location_navigate(absolutePath(n,e.base),o))];if("undefined"!=typeof history)for(let e of[s,u]){let n=history[e];history[e]=function(){let o=n.apply(this,arguments),i=new Event(e);return i.arguments=arguments,dispatchEvent(i),o}}},1475:function(e,n,o){"use strict";function shallow$1(e,n){if(Object.is(e,n))return!0;if("object"!=typeof e||null===e||"object"!=typeof n||null===n)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(let[o,i]of e)if(!Object.is(i,n.get(o)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(let o of e)if(!n.has(o))return!1;return!0}let o=Object.keys(e);if(o.length!==Object.keys(n).length)return!1;for(let i=0;i{let n;let o=new Set,setState=(e,i)=>{let s="function"==typeof e?e(n):e;if(!Object.is(s,n)){let e=n;n=(null!=i?i:"object"!=typeof s)?s:Object.assign({},n,s),o.forEach(o=>o(n,e))}},getState=()=>n,i={setState,getState,subscribe:e=>(o.add(e),()=>o.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),o.clear()}};return n=e(setState,getState,i),i},createStore=e=>e?createStoreImpl(e):createStoreImpl,{useDebugValue:u}=i,{useSyncExternalStoreWithSelector:c}=s;function useStoreWithEqualityFn(e,n=e.getState,o){let i=c(e.subscribe,e.getState,e.getServerState||e.getState,n,o);return u(i),i}let createWithEqualityFnImpl=(e,n)=>{let o=createStore(e),useBoundStoreWithEqualityFn=(e,i=n)=>useStoreWithEqualityFn(o,e,i);return Object.assign(useBoundStoreWithEqualityFn,o),useBoundStoreWithEqualityFn},createWithEqualityFn=(e,n)=>e?createWithEqualityFnImpl(e,n):createWithEqualityFnImpl}}]); \ No newline at end of file diff --git a/recce/data/_next/static/chunks/app/page-74c7caf13135bebe.js b/recce/data/_next/static/chunks/app/page-74c7caf13135bebe.js deleted file mode 100644 index a3c910bc..00000000 --- a/recce/data/_next/static/chunks/app/page-74c7caf13135bebe.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{99178:function(e,n,t){Promise.resolve().then(t.bind(t,25459))},25459:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Home}});var r=t(757),i=t(27869);function getNeighborSet(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,r=new Set,i={},dfs=(e,t)=>{if(t<0||void 0!==i[e]&&i[e]>=t)return;i[e]=t;let l=n(e);for(let e of l)dfs(e,t-1);r.add(e)};for(let n of e)dfs(n,t);return r}function buildDefaultLineageGraphSets(e,n){function buildAllLineageGraph(e,n){let t={},r={},buildNode=(e,n)=>({id:e,name:e,data:{},from:n,parents:{},children:{},isSelected:!1});for(let[n,r]of Object.entries(e.parent_map)){t[n]=buildNode(n,"base");let r=e.nodes&&e.nodes[n];r&&(t[n].data.base=r,t[n].name=null==r?void 0:r.name,t[n].resourceType=null==r?void 0:r.resource_type,t[n].packageName=null==r?void 0:r.package_name)}for(let[e,r]of Object.entries(n.parent_map)){t[e]?t[e].from="both":t[e]=buildNode(e,"current");let r=n.nodes&&n.nodes[e];r&&(t[e].data.current=n.nodes&&n.nodes[e],t[e].name=null==r?void 0:r.name,t[e].resourceType=null==r?void 0:r.resource_type,t[e].packageName=null==r?void 0:r.package_name)}for(let[n,i]of Object.entries(e.parent_map))for(let e of i){let i=t[n],l=t[e],o="".concat(e,"_").concat(n);r[o]={id:o,from:"base",parent:l,child:i};let a=r[o];i.parents[e]=a,l.children[n]=a}for(let[e,i]of Object.entries(n.parent_map))for(let n of i){let i=t[e],l=t[n],o="".concat(n,"_").concat(e);r[o]?r[o].from="both":r[o]={id:o,from:"current",parent:l,child:i};let a=r[o];i.parents[n]=a,l.children[e]=a}return{edges:r,nodes:t}}function buildChangedOnlyLineageGraph(e,n){let t={},r={};function union(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{r.add(e)})}),r}let i=selectDownstream(e,n),l=selectUpstream(e,n,1),o=union(i,l);return Object.entries(e.nodes).forEach(e=>{let[n,r]=e;o.has(n)&&(t[n]=r)}),Object.entries(e.edges).forEach(e=>{let[n,t]=e;o.has(t.parent.id)&&o.has(t.child.id)&&(r[n]=t)}),{nodes:t,edges:r}}let{nodes:t,edges:r}=buildAllLineageGraph(e,n),i=[];for(let[e,n]of Object.entries(t))if("base"===n.from)n.changeStatus="removed",i.push(n.id);else if("current"===n.from)n.changeStatus="added",i.push(n.id);else{var l,o,a,s,c,d;let e=null==n?void 0:null===(a=n.data)||void 0===a?void 0:null===(o=a.base)||void 0===o?void 0:null===(l=o.checksum)||void 0===l?void 0:l.checksum,t=null==n?void 0:null===(d=n.data)||void 0===d?void 0:null===(c=d.current)||void 0===c?void 0:null===(s=c.checksum)||void 0===s?void 0:s.checksum;e&&t&&e!==t&&(n.changeStatus="modified",i.push(n.id))}for(let[e,n]of Object.entries(r))"base"===n.from?n.changeStatus="removed":"current"===n.from&&(n.changeStatus="added");return{all:{nodes:t,edges:r},changed:buildChangedOnlyLineageGraph({nodes:t,edges:r},i),modifiedSet:i,catalogExistence:{base:!!e.catalog_metadata,current:!!n.catalog_metadata}}}function selectUpstream(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return getNeighborSet(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].parents),t)}function selectDownstream(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return getNeighborSet(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].children),t)}function toReactflow(e,n){let t=[],r=[];for(let[n,r]of Object.entries(e.nodes))t.push({id:r.id,position:{x:0,y:0},data:r,type:"customNode",targetPosition:i.Ly.Left,sourcePosition:i.Ly.Right});for(let[n,t]of Object.entries(e.edges))r.push({id:t.id,type:"customEdge",source:t.parent.id,target:t.child.id,data:t});return highlightPath(e,n,t,r,null)}function highlightPath(e,n,t,r,i){function union(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{r.add(e)})}),r}let l=null!==i?union(selectUpstream(e,[i]),selectDownstream(e,[i])):getNeighborSet(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].children)),o=new Set(r.filter(e=>l.has(e.source)&&l.has(e.target)).map(e=>e.id)),a=t.map(e=>({...e,data:{...e.data,isHighlighted:l.has(e.id)}})),s=r.map(e=>({...e,data:{...e.data,isHighlighted:o.has(e.id)}}));return[a,s]}function selectSingleNode(e,n){let t=n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:t}}});return t}function selectNode(e,n){let t=n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:n.data.isSelected!==t}}});return t}function selectNodes(e,n){let t=n.map(n=>{let t=e.includes(n.id);return{...n,data:{...n.data,isSelected:n.data.isSelected||t}}});return t}function cleanUpSelectedNodes(e){let n=e.map(e=>({...e,data:{...e.data,isSelected:!1}}));return n}var l=t(10126),o=t(83172),a=t(55528),s=t(29330),c=t(17714),d=t(46543),u=t(76920),h=t(39668),m=t(83179),x=t(62648),f=t(43093),g=t(7752),p=t(94410),y=t(23330),j=t(29985),v=t(42524),C=t(36700),b=t(10287),k=t(48950),w=t(27726),S=t(26187),_=t(23704),R=t(33710),D=t(93864),N=t.n(D);t(94570);var E=t(90593),T=t(11180),F=t(63240),I=t(54057);let L=T.Nbv,O=T.sFB,z=T.UGs,IconChanged=e=>(0,r.jsxs)("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 16 16",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 11 a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"}),(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:""})]});function getIconForChangeStatus(e){return"added"===e?{color:"#1dce00",icon:L}:"removed"===e?{color:"#ff4444",icon:O}:"modified"===e?{color:"#ffa502",icon:z}:{color:"inherit",icon:void 0}}function getIconForResourceType(e){return"model"===e?{color:"#c0eafd",icon:F.Fn3}:"metric"===e?{color:"#ffe6ee",icon:I._MV}:"source"===e?{color:"#a6dda6",icon:F.i1q}:"exposure"===e?{color:"#ffe6ee",icon:I.n8P}:"semantic_model"===e?{color:"#fb8caf",icon:I.R1C}:"seed"===e?{color:"#a6dda6",icon:F.tWi}:{color:"inherit",icon:void 0}}t(88727);var M=t(19920),P=t(19103),V=t(95913),B=t(89042),A=t(80294),q=t(35537),K=t(10929),W=t(12218);let H=W.env.NEXT_PUBLIC_API_URL?W.env.NEXT_PUBLIC_API_URL:window.location.origin;var U=t(27471);let Q=K.default.create({baseURL:H}),G=new U.S;async function submitRun(e,n,t){let r=await Q.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait}),i=r.data;return i}async function waitRun(e,n){let t=await Q.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}}),r=t.data;return r}async function cancelRun(e){return await Q.post("/api/runs/".concat(e,"/cancel"))}async function submitRunFromCheck(e,n){let t=await Q.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait}),r=t.data;return r}async function submitRowCountDiff(e,n){return await submitRun("row_count_diff",e,n)}let J={allRowCount:()=>["row_count"],rowCount:e=>["row_count",e],lineage:()=>["lineage"],checks:()=>["checks","list"],check:e=>["checks",e]},Z='select * from {{ ref("mymodel") }}',X=(0,w.createContext)({sqlQuery:Z,setSqlQuery:()=>{}});function RecceQueryContextProvider(e){let{children:n}=e,[t,i]=w.useState(Z);return(0,r.jsx)(X.Provider,{value:{setSqlQuery:i,sqlQuery:t},children:n})}let useRecceQueryContext=()=>(0,w.useContext)(X),Y=(0,w.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function RowCountStateContextProvider(e){let{children:n}=e,[t,i]=w.useState([]);return(0,r.jsx)(Y.Provider,{value:{isNodesFetching:t,setIsNodesFetching:i},children:n})}let useRowCountStateContext=()=>(0,w.useContext)(Y);async function models_queryModelRowCount(e){let{result:n}=await queryRowCount([e]);return n[e]}async function queryRowCount(e){if(0===e.length)throw Error("No model names provided");let{run_id:n}=await submitRowCountDiff({node_names:e},{nowait:!0}),t=await waitRun(n);return{runId:n,result:t.result}}function useRowCountQueries(e){let[n,t]=(0,w.useState)(!1),r=(0,q.NL)(),{setIsNodesFetching:i}=useRowCountStateContext(),l=r.getQueriesData({queryKey:J.allRowCount()}).filter(n=>{let[t,r]=n,[i,l]=t;return e.includes(l)}).map(e=>{let[n,t]=e,[r,i]=n;return{modelName:i,data:t}}),o=[];return e.forEach(e=>{let{data:n}=l.find(n=>n.modelName===e)||{data:void 0,modelName:e};void 0===n&&o.push(e)}),{isLoading:n,fetchFn:async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=n&&n.skipCache?e:o;t(!0),i(l);let{runId:a,result:s}=await queryRowCount(l);return Object.keys(s).forEach(e=>{let n=s[e];r.setQueryData(J.rowCount(e),{base:n.base,curr:n.curr})}),t(!1),i([]),a}}}var $=t(44903),ee=t(62516);function RowCountByCompare(e){let{rowCount:n}=e,t=null===n.base?-1:n.base,i=null===n.curr?-1:n.curr,l=null===t?"N/A":t,o=null===i?"N/A":i;return t===i?(0,r.jsx)(x.U,{children:(0,r.jsxs)(f.x,{children:[l," == ",o," rows"]})}):tt?(0,r.jsxs)(x.U,{children:[(0,r.jsx)(f.x,{children:l}),(0,r.jsx)(s.J,{as:B.ZBs,color:"red.500"}),(0,r.jsxs)(f.x,{children:[o," row"]})]}):void 0}function RowCountWiteRate(e){let{rowCount:n}=e,t=null===n.base?-1:n.base,i=null===n.curr?-1:n.curr;return t<=0||i<=0?(0,r.jsx)(RowCountByCompare,{rowCount:n}):t===i?(0,r.jsxs)(x.U,{children:[(0,r.jsxs)(f.x,{children:[i," rows"]}),(0,r.jsx)(s.J,{as:ee.lxc,color:"gray.500"}),(0,r.jsx)(f.x,{color:"gray.500",children:"No Change"})]}):tmodels_queryModelRowCount(n.name),enabled:"model"===n.resourceType&&t}),m=h||l.includes(n.name),x=a||l.includes(n.name);function ProcessedRowCountTag(e){let{isLoading:n,rowCount:t}=e;return(0,r.jsx)(M.Sn,{children:(0,r.jsx)(P.N,{isLoaded:!n,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:(0,r.jsx)(ModelRowCount,{rowCount:t})})})}function UnprocessedRowCountTag(e){let{isInteractive:n,invokeFunction:t}=e;return n?(0,r.jsx)(V.h,{"aria-label":"Query Row Count",icon:(0,r.jsx)(A.j3i,{}),size:"xs",onClick:()=>{t()}}):(0,r.jsx)(s.J,{as:A.ebq})}if(!1===i&&!1===u&&!1===m)return null;let f="Query the number of row";if(m)f="Querying the number of row";else if(u){let e=(null==c?void 0:c.base)===null?"N/A":null==c?void 0:c.base,n=(null==c?void 0:c.curr)===null?"N/A":null==c?void 0:c.curr;f="".concat(e," -> ").concat(n," rows")}return(0,r.jsx)(o.u,{hasArrow:!0,label:f,openDelay:500,closeDelay:200,children:(0,r.jsxs)(M.Vp,{children:[(0,r.jsx)(M.AD,{as:B.SwK}),u||m?(0,r.jsx)(ProcessedRowCountTag,{isLoading:x,rowCount:c}):(0,r.jsx)(UnprocessedRowCountTag,{isInteractive:i,invokeFunction:d})]})})}function FetchSelectedNodesRowCountButton(e){let{nodes:n,onFinish:t}=e,{isLoading:i,fetchFn:l}=useRowCountQueries(n.map(e=>e.name));return(0,r.jsxs)(m.z,{isLoading:i,loadingText:"Querying",size:"xs",variant:"outline",title:"Query Row Counts",onClick:async()=>{await l(),t&&t()},isDisabled:0===n.length,children:[(0,r.jsx)(s.J,{as:A.j3i,mr:1}),"Query Row Counts"]})}function GraphNode(e){var n,t;let c,{data:d}=e,{isHighlighted:u,isSelected:h,resourceType:m,changeStatus:f}=d,g=(0,i.oR)(e=>e.transform[2]>.3),{icon:p}=getIconForResourceType(m),y="gray.400",j="solid";f&&(c=getIconForChangeStatus(f).icon,y=getIconForChangeStatus(f).color);let v=y,C=d.isSelected?"rgba(3, 102, 214, 0.5) 5px 5px 10px 3px":"unset",b=null==d?void 0:d.name;return(0,r.jsx)(o.u,{label:"model"===m?b:"".concat(b," (").concat(m,")"),placement:"top",children:(0,r.jsxs)(a.k,{width:"300px",_hover:{backgroundColor:g?"gray.100":y},borderColor:v,borderWidth:1,borderStyle:j,backgroundColor:g?"white":y,borderRadius:3,boxShadow:C,transition:"box-shadow 0.2s ease-in-out",padding:0,className:!0===u?"node-highlight":!0===h?"node-highlight":!1===u?"node-unhighlight":void 0,children:[(0,r.jsx)(a.k,{backgroundColor:y,padding:2,borderRightWidth:1,borderColor:v,borderStyle:j,alignItems:"top",visibility:g?"inherit":"hidden",children:(0,r.jsx)(s.J,{as:p})}),(0,r.jsxs)(a.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",children:[(0,r.jsxs)(a.k,{width:"100%",textAlign:"left",flex:"1",p:1,alignItems:"center",visibility:g?"inherit":"hidden",children:[(0,r.jsx)(l.xu,{flex:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:b}),c&&(0,r.jsx)(a.k,{children:(0,r.jsx)(s.J,{color:y,as:c,flex:"0 0 20px"})})]}),"model"===d.resourceType&&(0,r.jsx)(a.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:g?"inherit":"hidden",children:(0,r.jsxs)(x.U,{spacing:"8px",children:[(0,r.jsx)(E.L,{}),(0,r.jsx)(RowCountTag,{node:d,isInteractive:!1})]})})]}),Object.keys(null!==(n=null==d?void 0:d.parents)&&void 0!==n?n:{}).length>0&&(0,r.jsx)(i.HH,{type:"target",position:i.Ly.Left,isConnectable:!1}),Object.keys(null!==(t=null==d?void 0:d.children)&&void 0!==t?t:{}).length>0&&(0,r.jsx)(i.HH,{type:"source",position:i.Ly.Right,isConnectable:!1})]})})}function GraphEdge(e){let{sourceX:n,sourceY:t,targetX:l,targetY:o,sourcePosition:a,targetPosition:s,style:c={},markerEnd:d,data:u}=e,h={...c};(null==u?void 0:u.changeStatus)&&(h.stroke=getIconForChangeStatus(null==u?void 0:u.changeStatus).color,h.strokeDasharray="5"),(null==u?void 0:u.isHighlighted)===!1&&(h.filter="opacity(0.2) grayscale(50%)");let[m]=(0,i.OQ)({sourceX:n,sourceY:t,sourcePosition:a,targetX:l,targetY:o,targetPosition:s});return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(i.u5,{path:m,markerEnd:d,style:{...h,...c}})})}var en=t(67907),et=t(74796),er=t(79315),ei=t(58909),el=t(2593),eo=t(55344),ea=t(1726),es=t(83622),ec=t(21801),ed=t(29731),eu=t(18974);function mergeKeys(e,n){let t=[...e],r=[...n],i=[];for(;t.length>0&&r.length>0;)if(i.includes(t[0]))t.shift();else if(i.includes(r[0]))r.shift();else if(t[0]===r[0])i.push(t[0]),t.shift(),r.shift();else if(r.includes(t[0])){let e=r.indexOf(t[0]);for(let n=0;n{i.includes(e)||i.push(e)}),r.forEach(e=>{i.includes(e)||i.push(e)}),i}function mergeKeysWithStatus(e,n){let t=mergeKeys(e,n),r={};for(let i of t)e.includes(i)?n.includes(i)?r[i]=void 0:r[i]="removed":r[i]="added";let i={};e.forEach((e,n)=>{i[e]=n});let l=-1;for(let e of t){let n=i[e];void 0!==n&&(n>l?l=n:r[e]="reordered")}return r}function mergeColumns(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={},r=mergeKeysWithStatus(Object.keys(e),Object.keys(n));return Object.entries(r).forEach(e=>{let[n,r]=e;t[n]={name:n,reordered:"reordered"===r}}),Object.entries(e).map((e,n)=>{let[r,i]=e;t[r].baseIndex=n+1,t[r].baseType=i.type}),Object.entries(n).map((e,n)=>{let[r,i]=e;t[r].currentIndex=n+1,t[r].currentType=i.type}),t}function toDataGrid(e){function columnIndexCellClass(e){return void 0===e.baseIndex?"column-index-added":void 0===e.currentIndex?"column-index-removed":!0===e.reordered?"column-index-reordered":"column-index-normal"}function columnNameCellClass(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":!0===e.reordered?"column-body-reordered":"column-body-normal"}function columnTypeCellClass(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":e.baseType!==e.currentType?"column-body-type-changed":!0===e.reordered?"column-body-reordered":"column-body-normal"}let n=Object.values(e);return{columns:[{key:"baseIndex",name:"",resizable:!0,minWidth:35,cellClass:columnIndexCellClass},{key:"currentIndex",name:"",resizable:!0,minWidth:35,cellClass:columnIndexCellClass},{key:"name",name:"Name",resizable:!0,cellClass:columnNameCellClass},{key:"baseType",name:"Base Type",resizable:!0,cellClass:columnTypeCellClass},{key:"currentType",name:"Current Type",resizable:!0,cellClass:columnTypeCellClass}],rows:n}}t(75165),t(91702);var eh=t(93683),em=t(7873),ex=t(52116),ef=t(47367),eg=t(55201),ep=t.n(eg),ey=t(15550);function useClipBoardToast(){let e=(0,ey.p)();return{successToast:function(n){e({description:n,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})},failToast:function(n,t){e({title:n,description:"".concat(t),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}}}let ej="ignore-screenshot";function useToBlob(e){let{imageType:n="png",backgroundColor:t=null,boardEffect:r=!0,shadowEffect:i=!1,borderStyle:l="solid 1px #ccc",borderRadius:o="10px",onSuccess:a,onError:s,ignoreElements:c}=e,[d,u]=(0,w.useState)("idle"),h=(0,w.useRef)(null),toImage=async()=>{if(!h.current){console.error("No node to use for screenshot"),u("error"),s&&s(Error("No node to use for screenshot"));return}let e=h.current.element||h.current,d=e.style.overflow,m=e.style.border,x=e.style.borderRadius,f=e.style.backgroundColor;function resetStyles(){e.style.overflow=d,e.style.border=m,e.style.borderRadius=x,e.style.backgroundColor=f}try{var g;e.style.overflow="hidden",e.style.border=r?l:"",e.style.borderRadius=r?o:"",e.style.backgroundColor=t||"";let d=document.createElement("style");document.head.appendChild(d),null===(g=d.sheet)||void 0===g||g.insertRule("body > div:last-child img { display: inline-block; }"),u("loading");let h=await ep()(e,{logging:!1,backgroundColor:null,ignoreElements:c});d.remove();let m=i?document.createElement("canvas"):h;if(i){m.width=h.width+80,m.height=h.height+80;let e=m.getContext("2d");if(e)e.shadowColor="rgba(0, 0, 0, 0.5)",e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(h,40,40);else{console.error("Error getting canvas context"),u("error"),s&&s(Error("Error getting canvas context to add shadow effect"));return}}m.toBlob(async e=>{u("success"),a&&e&&await a(e)},"image/".concat(n))}catch(e){console.error("Error converting to image",e),u("error"),s&&s(e);return}finally{resetStyles()}};return{status:d,isLoading:"loading"===d,isErrored:"error"===d,isSuccess:"success"===d,toImage,ref:h}}async function copyBlobToClipboard(e){if(!e)throw Error("No blob to copy to clipboard");try{await navigator.clipboard.write([new ClipboardItem({[e.type]:e})])}catch(e){throw console.error("Error copying to clipboard",e),e}}function useCopyToClipboardButton(e){let{successToast:n,failToast:t}=useClipBoardToast(),{isLoading:i,toImage:l,ref:o}=useToBlob({imageType:"png",shadowEffect:!0,backgroundColor:(null==e?void 0:e.backgroundColor)||null,onSuccess:async e=>{try{await copyBlobToClipboard(e),n("Copied the query result as an image to clipboard")}catch(e){t("Failed to copy image to clipboard",e)}},onError:e=>{console.error("Error taking screenshot",e),t("Failed to copy image to clipboard",e)}});function CopyToClipboardButton(e){let{imageType:n="png",...t}=e;return(0,r.jsx)(m.z,{size:"sm",leftIcon:(0,r.jsx)(ef.T,{}),style:{position:"absolute",bottom:"16px",right:"16px"},isLoading:i,onMouseEnter:()=>{if(o.current){let e=o.current.element||o.current;e.style.boxShadow="rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px",e.style.transition="box-shadow 0.5s ease-in-out"}},onMouseLeave:()=>{if(o.current){let e=o.current.element||o.current;e.style.boxShadow=""}},onClick:async()=>{o.current&&await l()},children:"Copy to Clipboard"})}return{ref:o,CopyToClipboardButton}}function ScreenshotDataGrid(e){let{enableScreenshot:n=!0,...t}=e,{ref:i,CopyToClipboardButton:l}=useCopyToClipboardButton();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ex.ZP,{ref:i,...t}),n&&(0,r.jsx)(l,{imageType:"png"})]})}var ev=t(99691);async function getLineage(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=await Q.get("/api/lineage?base=".concat(e));return n.data}async function getLineageWithError(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let n=await getLineage(e);return{data:n}}catch(e){if(!(e instanceof ev.d7))return{error:null==e?void 0:e.message};{var n,t;let r=null==e?void 0:null===(t=e.response)||void 0===t?void 0:null===(n=t.data)||void 0===n?void 0:n.detail;if(r)return{error:r};return{error:null==e?void 0:e.message}}}}async function getLineageDiff(){let[e,n]=await Promise.all([getLineageWithError(!0),getLineageWithError(!1)]);return{base:e.data,current:n.data,base_error:e.error,current_error:n.error}}var eC=t(21123),eb=t.n(eC);let ek=(0,w.createContext)({});function LineageWatcher(e){let{refetch:n}=e,t=(0,ey.p)(),[i,l]=(0,w.useState)(),o=(0,q.NL)();return(0,w.useEffect)(()=>{function httpUrlToWebSocketUrl(e){return e.replace(/(http)(s)?\:\/\//,"ws$2://")}let e=new WebSocket("".concat(httpUrlToWebSocketUrl(H),"/api/ws"));return l(e),e.onopen=()=>{e.send("ping")},e.onmessage=e=>{if("pong"!==e.data)try{let n=JSON.parse(e.data);if("refresh"===n.command){let{eventType:e,srcPath:r}=n.event,[i,l]=r.split("/").slice(-2),a=eb().parse(l).name;t({description:"Detected ".concat(i," ").concat(a," ").concat(e),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),o.invalidateQueries({queryKey:J.lineage()})}}catch(e){console.error(e)}},()=>{e&&e.close()}},[t,o]),(0,r.jsx)(r.Fragment,{})}function LineageGraphsContextProvider(e){let{children:n}=e,{data:t,isLoading:i,error:l,refetch:o}=(0,$.a)({queryKey:J.lineage(),queryFn:getLineageDiff}),a=(0,w.useMemo)(()=>{if(t)return buildDefaultLineageGraphSets(t.base,t.current)},[t]),s=(null==l?void 0:l.message)||(null==t?void 0:t.current_error)||(null==t?void 0:t.base_error);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(LineageWatcher,{refetch:o}),(0,r.jsx)(ek.Provider,{value:{lineageGraphSets:a,metadata:null==t?void 0:t.current.metadata,error:s,isLoading:i},children:n})]})}let useLineageGraphsContext=()=>(0,w.useContext)(ek);function SchemaView(e){let n,t,{base:i,current:l,enableScreenshot:o=!1}=e,{columns:s,rows:c}=(0,w.useMemo)(()=>toDataGrid(mergeColumns(null==i?void 0:i.columns,null==l?void 0:l.columns)),[i,l]),{lineageGraphSets:d}=useLineageGraphsContext(),u=(null==d?void 0:d.catalogExistence.base)===!1,h=(null==d?void 0:d.catalogExistence.current)===!1;u&&h?n="catalog.json is missing on both current and base environments.":u?n="catalog.json is missing on base environment.":h&&(n="catalog.json is missing on current environment.");let m=i&&void 0===i.columns,x=l&&void 0===l.columns;return m&&x?t="Schema information is missing on both current and base environments.":m?t="Schema information is missing on base environment.":x&&(t="Schema information is missing on current environment."),(0,r.jsxs)(a.k,{direction:"column",children:[n?(0,r.jsxs)(eh.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,r.jsx)(em.z,{}),n]}):t?(0,r.jsxs)(eh.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,r.jsx)(em.z,{}),t]}):(0,r.jsx)(r.Fragment,{}),c.length>0&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:s,rows:c,className:"rdg-light",enableScreenshot:o})})]})}var ew=t(29357);function SqlDiffView(e){let{base:n,current:t}=e;return(0,r.jsx)(ew.SV,{height:"500px",language:"sql",theme:"vs",original:null==n?void 0:n.raw_code,modified:null==t?void 0:t.raw_code,options:{readOnly:!0,fontSize:14,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same"}})}var eS=t(32865);async function createSimpleCheck(){let e=await Q.post("/api/checks",{type:"simple"}),n=e.data;return n}async function createLineageDiffCheck(e,n){let t=await Q.post("/api/checks",{type:"lineage_diff",params:{view_mode:e,node_ids:n}}),r=t.data;return r}async function createCheckByNodeSchema(e){let n=await Q.post("/api/checks",{type:"schema_diff",params:{node_id:e}}),t=n.data;return t}async function createCheckByRun(e,n){let t=await Q.post("/api/checks",{run_id:e,view_options:n}),r=t.data;return r}async function listChecks(){let e=await Q.get("/api/checks");return e.data}async function getCheck(e){let n=await Q.get("/api/checks/".concat(e));return n.data}async function updateCheck(e,n){let t=await Q.patch("/api/checks/".concat(e),n);return t.data}async function deleteCheck(e){let n=await Q.delete("/api/checks/".concat(e));return n.data}async function reorderChecks(e){return await Q.post("/api/checks/reorder",e)}var e_=t(78448),eR=t(93573);function ColumnNameCell(e){let{params:n,column:t,containerRef:i}=e,{runAction:o}=useRecceActionContext(),handleValueDiffDetail=(e,t)=>{let r={...n,...e};o("value_diff_detail",r,t)};return(0,r.jsxs)(a.k,{children:[(0,r.jsx)(l.xu,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,r.jsx)(E.L,{}),(0,r.jsx)(C.v,{children:e=>{let{isOpen:n}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eu.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:V.h,icon:(0,r.jsx)(s.J,{as:T.D_A}),variant:"unstyled",size:"sm"}),(0,r.jsx)(e_.h,{containerRef:i,children:(0,r.jsx)(b.q,{lineHeight:"20px",children:(0,r.jsxs)(eR.k,{title:"Action",as:l.xu,fontSize:"8pt",children:[(0,r.jsx)(k.s,{fontSize:"10pt",onClick:()=>handleValueDiffDetail({},{showForm:!0}),children:"Show mismatched values..."}),(0,r.jsxs)(k.s,{fontSize:"10pt",onClick:()=>handleValueDiffDetail({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})})]})}})]})}function ValueDiffResultView(e){let{run:n}=e,t=n.result,i=n.params,cellClass=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},o=(0,w.useRef)(),c=[{key:"__is_pk__",name:"",maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,r.jsx)(u.M,{height:"100%",children:n[0]===i.primary_key&&(0,r.jsx)(s.J,{as:T.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,r.jsx)(ColumnNameCell,{column:n[t.key],params:i,containerRef:o})},cellClass:"cell-show-context-menu"},{key:"1",name:"Matched",resizable:!0,cellClass},{key:"2",name:"Matched %",resizable:!0,renderCell:e=>{let{column:n,row:t}=e,i=t[n.key];return(0,r.jsx)(l.xu,{textAlign:"end",children:void 0!=i&&null!==i?"".concat((100*i).toFixed(2)," %"):"N/A"})},cellClass}];return(0,r.jsxs)(a.k,{direction:"column",gap:"5px",pt:"5px",height:"100%",ref:o,children:[(0,r.jsxs)(l.xu,{px:"16px",children:["Model: ",i.model,", ",t.summary.total," total (",t.summary.total-t.summary.added-t.summary.removed," ","common, ",t.summary.added," added, ",t.summary.removed," removed)"]}),(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:c,rows:t.data.data,defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})}var eD=t(41171),eN=t(53930),eE=t(25535),eT=t(51348),eF=t(11546),eI=t(83978),eL=t.n(eI);function extractColumnNames(e){function getNames(e){return e&&e.columns?Object.values(e.columns).map(e=>e.name):[]}let n=getNames(e.data.base),t=getNames(e.data.current),r=[];return n.forEach(e=>{r.includes(e)||r.push(e)}),t.forEach(e=>{r.includes(e)||r.push(e)}),r}function ValueDiffForm(e){var n;let{params:t,onParamsChanged:i,setIsReadyToExecute:l}=e,o=useLineageGraphsContext(),[a,s]=(0,w.useState)(!t.columns||0===t.columns.length);(0,w.useEffect)(()=>{let e=!0;t.primary_key&&(a||t.columns&&0!==t.columns.length)||(e=!1),l(e)},[t,l,a]);let c=eL().find(null===(n=o.lineageGraphSets)||void 0===n?void 0:n.all.nodes,{name:null==t?void 0:t.model}),d=c?extractColumnNames(c):[];return(0,r.jsxs)(h.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,r.jsxs)(eD.NI,{children:[(0,r.jsx)(eN.l,{children:"Model"}),(0,r.jsx)(eE.I,{isReadOnly:!0,value:null==t?void 0:t.model})]}),(0,r.jsxs)(eD.NI,{children:[(0,r.jsx)(eN.l,{children:"Primary key"}),(0,r.jsx)(eF.Z,{placeholder:"Select primary key",value:(null==t?void 0:t.primary_key)&&(null==t?void 0:t.primary_key)!==""?{label:null==t?void 0:t.primary_key,value:null==t?void 0:t.primary_key}:void 0,options:(d||[]).map(e=>({label:e,value:e})),onChange:e=>{s(!0),i({...t,primary_key:(null==e?void 0:e.value)||"",columns:void 0})}})]}),(0,r.jsxs)(eD.NI,{children:[(0,r.jsx)(eN.l,{children:"Columns"}),(0,r.jsx)(eT.X,{marginBottom:"10px",isChecked:a,onChange:e=>{s(e.target.checked),i({...t,columns:void 0})},children:"All columns"}),!a&&(0,r.jsx)(eF.Z,{isMulti:!0,closeMenuOnSelect:!1,options:(d||[]).map(e=>({label:e,value:e})),value:(t.columns||[]).map(e=>({label:e,value:e})),onChange:e=>{i({...t,columns:(e||[]).map(e=>e.value)})}})]})]})}function _getColumnMap(e,n){let t={},r=mergeKeysWithStatus(e.columns.map(e=>e.name),n.columns.map(e=>e.name));return Object.entries(r).map(r=>{let[i,l]=r;t[i]={status:l,baseColumnIndex:e.columns.findIndex(e=>e.name===i),currentColumnIndex:n.columns.findIndex(e=>e.name===i)}}),t}function _getPrimaryKeyIndexes(e,n){let t=[];for(let r of n){let n=e.findIndex(e=>e.name===r);if(n<0)throw Error("Column ".concat(r," not found"));t.push(n)}return t}function _getPrimaryKeyValue(e,n,t){let r={};if(0===n.length)return JSON.stringify({_index:t._index});for(let i of n){let n=e[i];r[n.name]=t[i]}return JSON.stringify(r)}function DataFrameColumnGroupHeader(e){let{name:n,columnStatus:t,onPrimaryKeyChange:i,onPinnedColumnsChange:o,...c}=e,d=c.primaryKeys||[],u=c.pinnedColumns||[],h=d.includes(n),m=u.includes(n);return"index"===n?(0,r.jsx)(r.Fragment,{}):(0,r.jsxs)(a.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,r.jsx)(l.xu,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),"added"!==t&&"removed"!==t&&i&&(0,r.jsx)(s.J,{className:h?"close-icon":"key-icon",display:h?"block":"none",cursor:"pointer",as:h?T.ven:T.MhP,onClick:h?()=>{let e=d.filter(e=>e!==n);i&&i(e)}:()=>{let e=[...d.filter(e=>"index"!==e),n];i&&i(e)}}),!h&&o&&(0,r.jsx)(s.J,{className:m?"unpin-icon":"pin-icon",display:m?"block":"none",cursor:"pointer",as:m?T.$kI:T.oJP,onClick:m?()=>{let e=u.filter(e=>e!==n);o&&o(e)}:()=>{let e=[...u,n];o&&o(e)}})]})}t(7866);let defaultRenderCell=e=>{let{row:n,column:t}=e,i=n[t.key];return(0,r.jsx)(r.Fragment,{children:"boolean"==typeof i?i.toString():i})};function toDataDiffGrid(e,n,t){let i=e||{columns:[],data:[]},l=n||{columns:[],data:[]},o=(null==t?void 0:t.primaryKeys)||[],a=(null==t?void 0:t.pinnedColumns)||[],s=(null==t?void 0:t.changedOnly)||!1,c=[],d=_getColumnMap(i,l),u={},h={},m=!1,x=!1;if(0===o.length)i.data.forEach((e,n)=>{e._index=n+1,u[JSON.stringify({_index:n+1})]=e}),l.data.forEach((e,n)=>{e._index=n+1,h[JSON.stringify({_index:n+1})]=e});else{let e=_getPrimaryKeyIndexes(i.columns,o);i.data.forEach((n,t)=>{let r=_getPrimaryKeyValue(i.columns,e,n);r in u&&(m=!0),u[r]=n}),e=_getPrimaryKeyIndexes(l.columns,o),l.data.forEach((n,t)=>{let r=_getPrimaryKeyValue(l.columns,e,n);r in h&&(x=!0),h[r]=n})}let f=mergeKeysWithStatus(Object.keys(u),Object.keys(h)),g=Object.entries(f).map(e=>{let[n,t]=e,r=u[n],a=h[n],s=JSON.parse(n);if(r&&i.columns.forEach((e,n)=>{o.includes(e.name)||(s["base__".concat(e.name)]=r[n])}),a&&l.columns.forEach((e,n)=>{o.includes(e.name)||(s["current__".concat(e.name)]=a[n])}),r){if(a)for(let[e,n]of Object.entries(d))"index"===e||o.includes(e)||n.baseColumnIndex<0||n.currentColumnIndex<0||eL().isEqual(r[n.baseColumnIndex],a[n.currentColumnIndex])||(s.status="modified",n.status="modified");else s.status="removed"}else s.status="added";return s});s&&(g=g.filter(e=>"added"===e.status||"removed"===e.status||"modified"===e.status));let toColumn=(e,n)=>{let i="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,cellClass=t=>{let r=t.status;if("removed"===r)return"diff-cell-removed";if("added"===r)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!eL().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:i,name:(0,r.jsx)(DataFrameColumnGroupHeader,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:ex.Ug,headerCellClass:i,cellClass,renderCell:defaultRenderCell,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:ex.Ug,headerCellClass:i,cellClass,renderCell:defaultRenderCell,size:"auto"}]}};return 0===o.length?c.push({key:"_index",name:"",cellClass:"index-column"}):o.forEach(e=>{let n=d[e].status||"";c.push({key:"".concat(e),name:(0,r.jsx)(DataFrameColumnGroupHeader,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.status)return"diff-header-".concat(e.status)}})}),a.forEach(e=>{let n=d[e].status||"";"index"===e||o.includes(e)||c.push(toColumn(e,n))}),Object.entries(d).forEach(e=>{let[n,t]=e,r=t.status||"";"index"===n||o.includes(n)||a.includes(n)||s&&"added"!==r&&"removed"!==r&&"modified"!==r||c.push(toColumn(n,r))}),{columns:c,rows:g,invalidPKeyBase:m,invalidPKeyCurrent:x}}function ProfileDiffResultView(e){var n;let{run:t,viewOptions:i,onViewOptionsChanged:l}=e,o=t.result;t.params;let a=(0,w.useMemo)(()=>(null==i?void 0:i.pinned_columns)||[],[i]),s=((null==o?void 0:null===(n=o.current)||void 0===n?void 0:n.columns)||[]).find(e=>"column_name"===e.name.toLowerCase()),c=(null==s?void 0:s.name)||"column_name",d=(0,w.useMemo)(()=>toDataDiffGrid(null==o?void 0:o.base,null==o?void 0:o.current,{primaryKeys:[c],pinnedColumns:a,onPinnedColumnsChange:e=>{l&&l({...i,pinned_columns:e})}}),[o,c,a,i,l]);return 0===d.columns.length?(0,r.jsx)(u.M,{height:"100%",children:"No data"}):(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:d.columns,rows:d.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})})}var eO=t(84680),ez=t(70556),eM=t(46016);let RunView=e=>{var n,t;let{isPending:i,isAborting:o,progress:s,error:c,run:d,onCancel:x,viewOptions:f,onViewOptionsChanged:g,RunResultView:p,children:y}=e;if(y&&p)throw Error("RunView requires either a children or a RunResultView prop, but not both.");if(!y&&!p)throw Error("RunView requires at least one of children or RunResultView prop.");let j=(null==c?void 0:null===(t=c.response)||void 0===t?void 0:null===(n=t.data)||void 0===n?void 0:n.detail)||(null==d?void 0:d.error);if(j)return(0,r.jsxs)(eh.b,{status:"error",children:[(0,r.jsx)(em.z,{}),"Error: ",j]});if(i){let e=(null==s?void 0:s.message)?null==s?void 0:s.message:"Loading...";return(0,r.jsx)(u.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,r.jsxs)(h.g,{children:[(0,r.jsxs)(a.k,{alignItems:"center",children:[(null==s?void 0:s.percentage)===void 0||(null==s?void 0:s.percentage)===null?(0,r.jsx)(eM.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,r.jsx)(eM.D,{size:"20px",value:100*s.percentage,mr:"8px"}),o?(0,r.jsx)(r.Fragment,{children:"Aborting..."}):(0,r.jsx)(r.Fragment,{children:e})]}),!o&&(0,r.jsx)(m.z,{onClick:x,colorScheme:"blue",size:"sm",children:"Cancel"})]})})}return d?(0,r.jsxs)(l.xu,{h:"100%",style:{contain:"size layout"},overflow:"auto",children:[p&&(0,r.jsx)(p,{run:d,viewOptions:f,onViewOptionsChanged:g}),y&&y({run:d,viewOptions:f,onViewOptionsChanged:g})]}):(0,r.jsx)(u.M,{bg:"rgb(249,249,249)",height:"100%",children:"No data"})},RunModal=e=>{let{isOpen:n,onClose:t,type:i,title:o,params:s,RunForm:c,RunResultView:d}=e,[,u]=(0,eS.TH)(),[h,x]=(0,w.useState)(),[f,C]=(0,w.useState)(s),[b,k]=(0,w.useState)(!1),[S,_]=(0,w.useState)(!1),[R,D]=(0,w.useState)(),[N,E]=(0,w.useState)(),submitRunFn=async()=>{let{run_id:e}=await submitRun(i,f,{nowait:!0});for(x(e);;){let n=await waitRun(e,2);if(D(n.progress),n.result||n.error)return k(!1),D(void 0),n}},{data:T,mutate:F,reset:I,error:L,isPending:O}=(0,ez.D)({mutationFn:submitRunFn});(0,w.useEffect)(()=>{n&&void 0===c&&F()},[n]);let z=(0,q.NL)(),M=(0,w.useCallback)(async()=>{if(k(!0),h)return await cancelRun(h)},[h]),P=(0,w.useCallback)(()=>{F()},[F]),V=(0,w.useCallback)(()=>{F()},[F]),handleReset=()=>{k(!1),C(s),D(void 0),I()},B=(0,w.useCallback)(async()=>{if(!(null==T?void 0:T.run_id))return;let e=await createCheckByRun(T.run_id,N);z.invalidateQueries({queryKey:J.checks()}),u("/checks/".concat(e.check_id))},[null==T?void 0:T.run_id,u,z,N]),handleClose=async()=>{t(),O&&h&&await cancelRun(h),handleReset()};return(0,r.jsxs)(g.u_,{isOpen:n,onClose:handleClose,size:"6xl",scrollBehavior:"inside",children:[(0,r.jsx)(p.Z,{}),(0,r.jsxs)(y.h,{overflowY:"auto",height:"75%",children:[(0,r.jsx)(ei.x,{children:o}),(0,r.jsx)(j.o,{}),(0,r.jsx)(v.f,{p:"0px",h:"100%",overflow:"auto",borderY:"1px solid lightgray",children:O||T||L?(0,r.jsx)(RunView,{isPending:O,isAborting:b,run:T,error:L,progress:R,onCancel:M,viewOptions:N,onViewOptionsChanged:E,RunResultView:d}):(0,r.jsx)(l.xu,{style:{contain:"layout"},children:c&&(0,r.jsx)(c,{params:f,onParamsChanged:C,setIsReadyToExecute:_})})}),(0,r.jsx)(eO.m,{children:(0,r.jsxs)(a.k,{gap:"10px",children:[T&&c&&(0,r.jsx)(m.z,{colorScheme:"blue",onClick:handleReset,children:"Reset"}),(null==T?void 0:T.result)&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(m.z,{colorScheme:"blue",onClick:B,children:"Add to checklist"})}),O&&(0,r.jsx)(m.z,{onClick:M,isDisabled:b,colorScheme:"blue",children:"Cancel"}),!T&&!O&&(0,r.jsx)(m.z,{isDisabled:O||!S,colorScheme:"blue",onClick:P,children:"Execute"}),T&&!c&&(0,r.jsx)(m.z,{colorScheme:"blue",onClick:V,children:"Rerun"})]})})]})]})};var eP=t(49294),eV=t(99986);function valuediff_getColumnMap(e){let n={};return e.columns.map((e,t)=>{n[e.name]={index:t}}),n}function valuediff_getPrimaryKeyIndexes(e,n){let t=[];for(let r of n){let n=e.findIndex(e=>e.name===r);if(n<0)throw Error("Column ".concat(r," not found"));t.push(n)}return t}function valuediff_getPrimaryKeyValue(e,n,t){let r={};if(0===n.length)return JSON.stringify({_index:t._index});for(let i of n){let n=e[i];r[n.name]=t[i]}return JSON.stringify(r)}function valuediff_DataFrameColumnGroupHeader(e){let{name:n,columnStatus:t,onPrimaryKeyChange:i,onPinnedColumnsChange:o,...c}=e,d=c.primaryKeys||[],u=c.pinnedColumns||[],h=d.includes(n),m=u.includes(n);return"index"===n?(0,r.jsx)(r.Fragment,{}):(0,r.jsxs)(a.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,r.jsx)(l.xu,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),!h&&o&&(0,r.jsx)(s.J,{className:m?"unpin-icon":"pin-icon",display:m?"block":"none",cursor:"pointer",as:m?T.$kI:T.oJP,onClick:m?()=>{let e=u.filter(e=>e!==n);o&&o(e)}:()=>{let e=[...u,n];o&&o(e)}})]})}let valuediff_defaultRenderCell=e=>{let{row:n,column:t}=e,i=n[t.key];return(0,r.jsx)(r.Fragment,{children:"boolean"==typeof i?i.toString():i})};function toValueDiffGrid(e,n,t){let i=(null==t?void 0:t.pinnedColumns)||[],l=(null==t?void 0:t.changedOnly)||!1,o=[],a=valuediff_getColumnMap(e),s={},c={};if(0===n.length)throw Error("Primary keys are required");let d=valuediff_getPrimaryKeyIndexes(e.columns,n),u=(a.in_a||a.IN_A).index,h=(a.in_b||a.IN_B).index;e.data.forEach((n,t)=>{let r=valuediff_getPrimaryKeyValue(e.columns,d,n);n[u]&&(s[r]=n),n[h]&&(c[r]=n)});let m=mergeKeysWithStatus(Object.keys(s),Object.keys(c)),x=Object.entries(m).map(t=>{let[r,i]=t,l=s[r],o=c[r],d=JSON.parse(r);if(l&&e.columns.forEach((e,t)=>{n.includes(e.name)||(d["base__".concat(e.name)]=l[t])}),o&&e.columns.forEach((e,t)=>{n.includes(e.name)||(d["current__".concat(e.name)]=o[t])}),l){if(o)for(let[e,t]of Object.entries(a))!("index"===e||n.includes(e))&&(eL().isEqual(l[t.index],o[t.index])||(d.status="modified",t.status="modified"));else d.status="removed"}else d.status="added";return d});l&&(x=x.filter(e=>"added"===e.status||"removed"===e.status||"modified"===e.status));let toColumn=(e,n)=>{let i="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,cellClass=t=>{let r=t.status;if("removed"===r)return"diff-cell-removed";if("added"===r)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!eL().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:i,name:(0,r.jsx)(valuediff_DataFrameColumnGroupHeader,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:ex.Ug,headerCellClass:i,cellClass,renderCell:valuediff_defaultRenderCell,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:ex.Ug,headerCellClass:i,cellClass,renderCell:valuediff_defaultRenderCell,size:"auto"}]}};return n.forEach(e=>{let n=a[e].status||"";o.push({key:"".concat(e),name:(0,r.jsx)(valuediff_DataFrameColumnGroupHeader,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.status)return"diff-header-".concat(e.status)}})}),i.forEach(e=>{let t=a[e].status||"";n.includes(e)||o.push(toColumn(e,t))}),Object.entries(a).forEach(e=>{let[t,r]=e,a=r.status||"";"in_a"===t||"in_b"===t||n.includes(t)||i.includes(t)||l&&"added"!==a&&"removed"!==a&&"modified"!==a||o.push(toColumn(t,a))}),{columns:o,rows:x}}let ValueDiffDetailResultView=e=>{var n,t;let{run:i,onAddToChecklist:s,viewOptions:c,onViewOptionsChanged:d}=e,h=(0,w.useMemo)(()=>(null==c?void 0:c.changed_only)||!1,[c]),m=(0,w.useMemo)(()=>(null==c?void 0:c.pinned_columns)||[],[c]),x=(0,w.useMemo)(()=>{var e,n;if(!i.result)return{columns:[],rows:[]};let t=(null==i?void 0:null===(e=i.params)||void 0===e?void 0:e.primary_key)?[null==i?void 0:null===(n=i.params)||void 0===n?void 0:n.primary_key]:[];return toValueDiffGrid(null==i?void 0:i.result,t,{changedOnly:h,pinnedColumns:m,onPinnedColumnsChange:e=>{d&&d({...c,pinned_columns:e})}})},[i,c,h,m,d]);if(0===x.columns.length)return(0,r.jsx)(u.M,{height:"100%",children:"No data"});if(h&&0===x.rows.length)return(0,r.jsx)(u.M,{height:"100%",children:"No change"});let f=(null===(n=i.result)||void 0===n?void 0:n.limit)||0,g=f>0&&(null==i?void 0:null===(t=i.result)||void 0===t?void 0:t.more)?"Warning: Displayed results are limited to ".concat(f.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null;return(0,r.jsxs)(a.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,r.jsxs)(a.k,{borderBottom:"1px solid lightgray",justifyContent:"flex-end",gap:"5px",alignItems:"center",px:"10px",bg:g?"orange.100":"inherit",children:[g&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eP.a,{color:"orange.600"})," ",(0,r.jsx)(l.xu,{children:g})]}),(0,r.jsx)(E.L,{minHeight:"32px"}),(0,r.jsx)(eT.X,{isChecked:null==c?void 0:c.changed_only,onChange:()=>{let e=!(null==c?void 0:c.changed_only);d&&d({...c,changed_only:e})},children:"Changed only"}),s&&(0,r.jsx)(o.u,{label:"Add to Checklist",children:(0,r.jsx)(V.h,{variant:"unstyled",size:"sm","aria-label":"Add",icon:(0,r.jsx)(eV.d,{}),onClick:()=>s(i)})})]}),(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:x.columns,rows:x.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})};var eB=t(17180),eA=t(34030);function formatNumber(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US",t=arguments.length>2?arguments[2]:void 0;return"number"!=typeof e?e:new Intl.NumberFormat(n,t).format(e)}function formatIntervalMinMax(e){let n=e>0&&e<=.001,t=e<1&&e>=.999,formatter=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return formatNumber(n,"en-US",{style:"percent",minimumFractionDigits:1})};if(n){let e=formatter(.001);return"<".concat(e)}if(t){let e=formatter(.999);return">".concat(e)}return formatter()}function formatAsAbbreviatedNumber(e){if("number"!=typeof e)return e;{let n=Math.abs(e),t=n>=.01,r=n>=1e6,i=n>=1e9,l=n>=1e15;if(l||n>=1e12)return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:l?0:2}).format(e/1e12).replace("L","T");if(i||r||n>=1e3){let n={base:i?1e9:r?1e6:1e3,unit:i?"B":r?"M":"K"};return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:1}).format(e/n.base).replace("L",n.unit)}return n>=1?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):new Intl.NumberFormat("en-US",{maximumFractionDigits:t?3:2,notation:t||0===n?"standard":"scientific"}).format(e)}}var eq=t(85670),eK=t(84021);function TopKSummaryList(e){let{topk:n,valids:t,isDisplayTopTen:i}=e,s=i?10:n.counts.length,c=n.counts.slice(0,s),d=t-c.reduce((e,n)=>e+n,0);return(0,r.jsx)(l.xu,{w:"100%",children:c.concat([d]).map((e,i)=>{let l=i===c.length,s=l?d:e,u=String(n.values[i]),h=l?"(others)":u||"(empty)",m=formatAsAbbreviatedNumber(s),x=formatIntervalMinMax(s/t);return(0,r.jsx)(w.Fragment,{children:!l||l&&s>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(a.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:3,children:[(0,r.jsx)(o.u,{label:h,placement:"start",children:(0,r.jsx)(f.x,{noOfLines:1,width:"14em",fontSize:"sm",color:l||0===u.length?"gray.400":"inherit",children:h})}),(0,r.jsx)(a.k,{height:"2em",width:"10em",children:(0,r.jsx)(CategoricalBarChart,{topkCount:s,topkLabel:h,valids:t})}),(0,r.jsx)(o.u,{label:m,placement:"start",children:(0,r.jsx)(f.x,{ml:5,mr:2,fontSize:"sm",width:"4em",noOfLines:1,children:m})}),(0,r.jsx)(o.u,{label:x,placement:"start",children:(0,r.jsx)(f.x,{color:"gray.400",fontSize:"sm",width:"4em",children:x})})]}),(0,r.jsx)(eB.i,{})]}):(0,r.jsx)(r.Fragment,{})},i)})})}function CategoricalBarChart(e){let{topkCount:n,topkLabel:t,valids:i,animation:l=!1}=e;eq.kL.register(eq.uw,eq.ZL,eq.f$);let o=getCatBarChartOptions(n,i,{animation:l}),a=getCatBarChartData({topkCount:n,topkLabel:t});return(0,r.jsx)(eK.$Q,{data:a,options:o,plugins:[]})}function getCatBarChartOptions(e,n){let{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{responsive:!0,maintainAspectRatio:!1,indexAxis:"y",scales:{x:{display:!1,max:n,grid:{display:!1}},y:{display:!1}},plugins:{tooltip:{enabled:!1}},...t}}function getCatBarChartData(e){let{topkLabel:n,topkCount:t}=e;return{labels:[n],datasets:[{indexAxis:"y",data:[t],backgroundColor:"#63B3ED",hoverBackgroundColor:"#002a53",borderWidth:1,borderColor:"#002a53",barPercentage:1,categoryPercentage:.6}]}}let ScreenshotBox=e=>{let{children:n,...t}=e,{ref:i,CopyToClipboardButton:o}=useCopyToClipboardButton({backgroundColor:"white"});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.xu,{ref:i,...t,overflow:"auto",children:n}),(0,r.jsx)(o,{imageType:"png"})]})};function TopKDiffResultView(e){let{run:n}=e,[t,i]=(0,w.useState)(!0),o=n.result,s=n.params,c=o.base,d=o.current;return(0,r.jsxs)(a.k,{direction:"column",height:"100%",children:[(0,r.jsxs)(ScreenshotBox,{children:[(0,r.jsxs)(er.X,{as:"h1",size:"md",marginTop:4,textAlign:"center",children:["Model ",s.model,".",s.column_name]}),(0,r.jsxs)(x.U,{children:[(0,r.jsx)(E.L,{}),(0,r.jsxs)(l.xu,{children:[(0,r.jsx)(er.X,{as:"h3",size:"sm",m:"2",color:"gray",children:"Base"}),(0,r.jsx)(eB.i,{}),(0,r.jsx)(TopKSummaryList,{topk:c,valids:c.valids||0,isDisplayTopTen:t})]}),(0,r.jsxs)(l.xu,{children:[(0,r.jsx)(er.X,{as:"h3",size:"sm",m:"2",color:"gray",children:"Current"}),(0,r.jsx)(eB.i,{}),(0,r.jsx)(TopKSummaryList,{topk:d,valids:d.valids||0,isDisplayTopTen:t})]}),(0,r.jsx)(E.L,{})]})]}),(0,r.jsx)(E.L,{}),(c.values.length>10||d.values.length>10)&&(0,r.jsx)(a.k,{p:5,justify:"start",children:(0,r.jsx)(eA.r,{onClick:()=>i(e=>!e),textColor:"blue.500",children:t?"View More Items":"View Only Top-10"})})]})}var eW=t(68665);function TopKDiffForm(e){var n;let{params:t,onParamsChanged:i,setIsReadyToExecute:o}=e,a=useLineageGraphsContext(),s=eL().find(null===(n=a.lineageGraphSets)||void 0===n?void 0:n.all.nodes,{name:null==t?void 0:t.model}),c=s?extractColumnNames(s):[];return(0,w.useEffect)(()=>{o(!!t.column_name)},[t,o]),(0,r.jsx)(l.xu,{m:"16px",children:(0,r.jsxs)(eD.NI,{children:[(0,r.jsx)(eN.l,{children:"Pick a column to show top-k"}),(0,r.jsx)(eW.P,{placeholder:"Select column",value:null==t?void 0:t.column_name,onChange:e=>{let n=e.target.value;i({...t,column_name:n})},children:c.map(e=>(0,r.jsx)("option",{value:e,children:e},e))})]})})}let eH=(0,w.createContext)({runAction:()=>{}}),eU={profile_diff:{title:"Profile Diff",RunResultView:ProfileDiffResultView},value_diff:{title:"Value Diff",RunResultView:ValueDiffResultView,RunForm:ValueDiffForm},value_diff_detail:{title:"Value Diff Detail",RunResultView:ValueDiffDetailResultView,RunForm:ValueDiffForm},top_k_diff:{title:"Top-K Diff",RunResultView:TopKDiffResultView,RunForm:TopKDiffForm}},useCloseModalEffect=e=>{let[n]=(0,eS.TH)();(0,w.useEffect)(()=>{e()},[e,n])};function RecceActionContextProvider(e){var n;let{children:t}=e,[i,l]=(0,w.useState)(),{isOpen:o,onOpen:a,onClose:s}=(0,c.q)(),d=(0,w.useCallback)((e,n,t)=>{let r=new Date().getTime().toString();l({session:r,type:e,params:n,options:t}),a()},[l,a]);return useCloseModalEffect(s),(0,r.jsxs)(eH.Provider,{value:{runAction:d},children:[i&&eU[i.type]&&(0,r.jsx)(RunModal,{isOpen:o,onClose:s,title:eU[i.type].title,type:i.type,params:i.params,RunResultView:eU[i.type].RunResultView,RunForm:(null===(n=i.options)||void 0===n?void 0:n.showForm)?eU[i.type].RunForm:void 0},i.session),t]})}let useRecceActionContext=()=>(0,w.useContext)(eH);function NodeView(e){let{node:n,onCloseNode:t}=e,[,i]=(0,eS.TH)(),{setSqlQuery:o}=useRecceQueryContext(),{fetchFn:s}=useRowCountQueries([n.name]),d="model"===n.resourceType||"seed"===n.resourceType||"source"===n.resourceType,{isOpen:u,onOpen:h,onClose:f}=(0,c.q)(),{runAction:S}=useRecceActionContext(),_=(0,w.useCallback)(async()=>{let e=n.id,t=await createCheckByNodeSchema(e);i("/checks/".concat(t.check_id))},[n,i]),R=(0,w.useCallback)(async()=>{let e=await s({skipCache:!0}),n=await createCheckByRun(e);i("/checks/".concat(n.check_id))},[i,s]);return(0,r.jsxs)(et.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,r.jsxs)(x.U,{children:[(0,r.jsx)(l.xu,{flex:"0 1 20%",p:"16px",children:(0,r.jsx)(er.X,{size:"sm",children:n.name})}),(0,r.jsx)(E.L,{}),"modified"===n.changeStatus&&(0,r.jsxs)(l.xu,{children:[(0,r.jsx)(m.z,{onClick:h,leftIcon:(0,r.jsx)(F.tvD,{}),colorScheme:"orange",variant:"solid",children:"Diff"}),(0,r.jsxs)(g.u_,{isOpen:u,onClose:f,size:"6xl",children:[(0,r.jsx)(p.Z,{}),(0,r.jsxs)(y.h,{overflowY:"auto",height:"75%",children:[(0,r.jsx)(ei.x,{children:"Model Raw Code Diff"}),(0,r.jsx)(j.o,{}),(0,r.jsx)(v.f,{children:(0,r.jsx)(SqlDiffView,{base:n.data.base,current:n.data.current})})]})]})]}),(0,r.jsx)(l.xu,{flex:"0 1 1%",p:"16px",children:(0,r.jsx)(el.P,{onClick:t})})]}),(0,r.jsx)(l.xu,{color:"gray",paddingLeft:"16px",children:(0,r.jsxs)(x.U,{spacing:"8px",children:[(0,r.jsx)(ResourceTypeTag,{node:n}),"model"===n.resourceType&&(0,r.jsx)(RowCountTag,{node:n})]})}),d&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(eo.m,{overflow:"auto",as:a.k,children:[(0,r.jsx)(ea.t,{children:(0,r.jsx)(es.O,{children:"Columns"})}),(0,r.jsx)(ec.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,r.jsx)(ed.x,{p:0,overflowY:"auto",height:"100%",children:(0,r.jsx)(SchemaView,{base:n.data.base,current:n.data.current})})})]}),(0,r.jsxs)(x.U,{p:"16px",children:[(0,r.jsxs)(C.v,{children:[(0,r.jsx)(eu.j,{as:m.z,size:"sm",colorScheme:"blue",children:"Add check"}),(0,r.jsxs)(b.q,{children:[(0,r.jsx)(k.s,{onClick:_,children:"Schema Check"}),(0,r.jsx)(k.s,{onClick:R,children:"Row Count Check"})]})]}),(0,r.jsx)(E.L,{}),"model"===n.resourceType&&(0,r.jsxs)(r.Fragment,{children:["added"!==n.changeStatus&&"removed"!==n.changeStatus&&(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(C.v,{children:[(0,r.jsx)(eu.j,{as:m.z,size:"sm",colorScheme:"blue",children:"Advanced Diffs"}),(0,r.jsxs)(b.q,{children:[(0,r.jsx)(k.s,{onClick:()=>{S("profile_diff",{model:n.name})},children:"Profile Diff"}),(0,r.jsx)(k.s,{onClick:()=>{S("value_diff",{model:n.name,primary_key:""},{showForm:!0})},children:"Value Diff"}),(0,r.jsx)(k.s,{onClick:()=>{S("top_k_diff",{model:n.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"})]})]})}),(0,r.jsx)(m.z,{colorScheme:"blue",size:"sm",onClick:()=>{o('select * from {{ ref("'.concat(n.name,'") }}')),i("/query")},children:"Query"})]})]})]})]})}let eQ={added:["Model Added","Added resource"],removed:["Model Removed","Removed resource"],modified:["Model Modified","Modified resource"],col_added:["Column Added","Added column"],col_removed:["Column Removed","Removed column"],col_changed:["Column Modified","Modified column"],folder_changed:["Modified","Modified folder"]};function ChangeSummary_getIconForChangeStatus(e){if("added"===e)return{color:"#1dce00",icon:L};if("removed"===e)return{color:"#ff067e",icon:O};if("modified"===e)return{color:"#ffa502",icon:z};if("col_added"===e)return{color:"#1dce00",icon:L};if("col_removed"===e)return{color:"#ff067e",icon:O};if("col_changed"===e)return{color:"#ffa502",icon:z};if("folder_changed"===e)return{color:"#ffa502",icon:IconChanged};return{color:"inherit",icon:void 0}}function SummaryText(e){let{name:n,value:t,tip:i}=e;return(0,r.jsxs)(h.g,{alignItems:"stretch",children:[(0,r.jsxs)(f.x,{fontSize:"sm",color:"gray",children:[n,i&&(0,r.jsx)(o.u,{label:i,children:(0,r.jsx)(l.xu,{display:"inline-block",children:(0,r.jsx)(s.J,{mx:"2px",as:B.H33,boxSize:3})})})]}),t]})}function ChangeStatusCountLabel(e){let{changeStatus:n,value:t}=e,[i]=n?eQ[n]:[""],{icon:l,color:o}=ChangeSummary_getIconForChangeStatus(n);return(0,r.jsxs)(h.g,{alignItems:"stretch",children:[(0,r.jsxs)(a.k,{alignItems:"center",fontSize:"sm",color:"gray",children:[(0,r.jsx)(s.J,{mr:"5px",as:l,color:o}),i]}),(0,r.jsx)(f.x,{fontSize:"sm",children:t})]})}function calculateColumnChange(e,n){let t=0,r=0,i=0;return(e||n)&&(n&&Object.keys(n.columns||{}).forEach(n=>{(!e||!e.columns||!e.columns[n])&&t++}),e&&Object.keys(e.columns||{}).forEach(e=>{(!n||!n.columns||!n.columns[e])&&r++}),n&&e&&Object.keys(n.columns||{}).forEach(t=>{e.columns&&n.columns&&e.columns[t]&&e.columns[t].type!==n.columns[t].type&&i++})),{adds:t,removes:r,modifies:i}}function calculateChangeSummary(e,n){let t=0,r=0,i=0,l=0,o=0,a=0;return n.forEach(n=>{"added"===e.nodes[n].changeStatus?t++:"removed"===e.nodes[n].changeStatus?r++:"modified"===e.nodes[n].changeStatus&&i++;let s=e.nodes[n].data.base,c=e.nodes[n].data.current,d=calculateColumnChange(s,c);l+=d.adds,o+=d.removes,a+=d.modifies}),{adds:t,removes:r,modifies:i,col_added:l,col_removed:o,col_changed:a}}function ChangeSummary(e){let{lineageGraphSets:n}=e,{adds:t,removes:i,modifies:o,col_added:a,col_removed:s,col_changed:c}=calculateChangeSummary(n.all,n.modifiedSet);return(0,r.jsxs)(et.r,{templateColumns:"1fr 1fr",mb:"10px",borderTop:"1px solid lightgray",padding:"2.5vw",children:[(0,r.jsx)(l.xu,{borderColor:"lightgray",children:(0,r.jsx)(SummaryText,{name:"Code Changes",value:(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(et.r,{templateColumns:"1fr 1fr 1fr",width:"100%",children:[(0,r.jsx)(ChangeStatusCountLabel,{changeStatus:"added",value:t}),(0,r.jsx)(ChangeStatusCountLabel,{changeStatus:"removed",value:i}),(0,r.jsx)(ChangeStatusCountLabel,{changeStatus:"modified",value:o})]})})})}),(0,r.jsx)(l.xu,{borderLeft:"1px",paddingLeft:"12px",borderColor:"lightgray",children:(0,r.jsx)(SummaryText,{name:"Column Changes",value:(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(et.r,{templateColumns:"1fr 1fr 1fr",width:"100%",children:[(0,r.jsx)(ChangeStatusCountLabel,{changeStatus:"col_added",value:a}),(0,r.jsx)(ChangeStatusCountLabel,{changeStatus:"col_removed",value:s}),(0,r.jsx)(ChangeStatusCountLabel,{changeStatus:"col_changed",value:c})]})})})})]})}var eG=t(76353),eJ=t(53248),eZ=t(9763),eX=t(95853);function SchemaDiffCard(e){let{node:n,...t}=e;return(0,r.jsxs)(eG.Z,{maxWidth:"500px",children:[(0,r.jsxs)(eJ.O,{children:[(0,r.jsx)(er.X,{fontSize:18,children:t.title}),(0,r.jsxs)(x.U,{spacing:"8px",p:"16px",children:[(0,r.jsx)(ResourceTypeTag,{node:n}),"model"===n.resourceType&&(0,r.jsx)(RowCountTag,{node:n,isAutoFetching:!0})]})]}),(0,r.jsx)(eZ.e,{children:(0,r.jsx)(a.k,{children:(0,r.jsx)(SchemaView,{base:n.data.base,current:n.data.current})})})]})}function listChangedNodes(e){let n=[],t=e.all.nodes;return e.modifiedSet.forEach(e=>{var r,i;let l=t[e],o=mergeKeysWithStatus(Object.keys((null===(r=l.data.base)||void 0===r?void 0:r.columns)||{}),Object.keys((null===(i=l.data.current)||void 0===i?void 0:i.columns)||{})),a=!Object.values(o).every(e=>void 0===e);a&&l.data.base&&l.data.current&&n.push(l)}),n}function SchemaSummary(e){let{lineageGraphSets:n}=e,[t,i]=(0,w.useState)([]);return(0,w.useEffect)(()=>{i(listChangedNodes(n))},[n]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.k,{w:"100%",paddingBottom:"10px",marginBottom:"20px",marginTop:"20px",children:(0,r.jsx)(er.X,{fontSize:24,children:"Schema Summary"})}),(0,r.jsx)(a.k,{w:"100%",paddingBottom:"10px",marginBottom:"20px",children:0===t.length?(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(f.x,{fontSize:18,color:"gray",children:"No schema changes detected."})}):(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(eX.M,{minChildWidth:"400px",spacing:"2vw",padding:"2.5vw",width:"100%",backgroundColor:"lightgray",children:t.map(e=>(0,r.jsx)(SchemaDiffCard,{title:e.name,node:e},e.id))})})})]})}function SummaryView(){let{lineageGraphSets:e}=useLineageGraphsContext();return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(a.k,{direction:"column",w:"100%",minHeight:"650px",children:[(0,r.jsx)(a.k,{w:"100%",paddingBottom:"10px",marginBottom:"20px",children:(0,r.jsx)(er.X,{fontSize:24,children:"Change Summary"})}),e&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ChangeSummary,{lineageGraphSets:e}),(0,r.jsx)(eB.i,{}),(0,r.jsx)(SchemaSummary,{lineageGraphSets:e})]})]})})}var eY=t(45438),e$=t(40312),e0=t(52246),e1=t(25807),e2=t(15012);function AddSchemaChangesCheckButton(e){let{nodes:n,onFinish:t}=e,[,i]=(0,eS.TH)();return(0,r.jsxs)(m.z,{size:"xs",variant:"outline",isDisabled:0===n.length,onClick:async()=>{let e;1===n.length?e=await createCheckByNodeSchema(n[0].id):await Promise.all(n.map(async e=>{await createCheckByNodeSchema(e.id)})),t(),e?i("/checks/".concat(e.check_id)):i("/checks")},children:[(0,r.jsx)(s.J,{as:A.Edg}),"Add schema check"]})}function AddRowCountCheckButton(e){let{nodes:n,onFinish:t}=e,[,i]=(0,eS.TH)(),{isLoading:l,fetchFn:o}=useRowCountQueries(n.map(e=>e.name));return(0,r.jsxs)(m.z,{size:"xs",isLoading:l,loadingText:"Querying",variant:"outline",isDisabled:0===n.length,onClick:async()=>{let e=await o({skipCache:!0}),n=await createCheckByRun(e);n?i("/checks/".concat(n.check_id)):i("/checks"),t()},children:[(0,r.jsx)(s.J,{as:B.SwK}),"Add row count check"]})}function AddLineageDiffCheckButton(e){let{viewMode:n,nodes:t,onFinish:i,withIcon:l}=e,[,o]=(0,eS.TH)();return(0,r.jsxs)(m.z,{size:"xs",variant:"outline",isDisabled:0===t.length,onClick:async()=>{let e=t.map(e=>e.id),r=await createLineageDiffCheck(n,e);i(),r?o("/checks/".concat(r.check_id)):o("/checks")},children:[l&&(0,r.jsx)(s.J,{as:e2.Ks7}),"Add lineage diff check"]})}function NodeSelector(e){let{viewMode:n,nodes:t,isOpen:i,onClose:o}=e;function countSelectedNodes(e){return e.filter(e=>e.isSelected).length}let a=t.filter(e=>e.isSelected);return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(e$.R,{in:i,style:{zIndex:10},children:(0,r.jsx)(l.xu,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,r.jsxs)(x.U,{p:"5px 15px",mt:"4",divider:(0,r.jsx)(e0.c,{borderColor:"gray.200"}),spacing:4,children:[(0,r.jsxs)(e1.h,{size:"xs",isAttached:!0,variant:"outline",rounded:"xs",onClick:o,children:[(0,r.jsxs)(m.z,{children:[countSelectedNodes(t)," selected"]}),(0,r.jsx)(V.h,{"aria-label":"Exit select Mode",icon:(0,r.jsx)(eY.D,{})})]}),(0,r.jsxs)(x.U,{children:[(0,r.jsx)(FetchSelectedNodesRowCountButton,{nodes:a.length>0?a:[],onFinish:o}),(0,r.jsx)(AddSchemaChangesCheckButton,{nodes:a.length>0?a:[],onFinish:o}),(0,r.jsx)(AddRowCountCheckButton,{nodes:a.length>0?a:[],onFinish:o}),(0,r.jsx)(AddLineageDiffCheckButton,{viewMode:n,nodes:a.length>0?a:[],onFinish:o,withIcon:!0})]})]})})})})}let layout=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",r=new(N()).graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:t}),e.forEach(e=>{r.setNode(e.id,{width:300,height:36})}),n.forEach(e=>{r.setEdge(e.source,e.target)}),N().layout(r),e.forEach(e=>{let n=r.node(e.id);return e.position={x:n.x-150,y:n.y-18},e})},e5={customNode:GraphNode},e3={customEdge:GraphEdge},nodeColor=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?getIconForChangeStatus(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},e4={all:"All",changed_models:"Changed Models"};function ChangeStatusLegend(){return(0,r.jsx)(l.xu,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({added:["Added","Added resource"],removed:["Removed","Removed resource"],modified:["Modified","Modified resource"]}).map(e=>{let[n,[t,i]]=e,{icon:l,color:c}=getIconForChangeStatus(n);return(0,r.jsx)(o.u,{label:i,children:(0,r.jsxs)(a.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,r.jsx)(s.J,{color:c,as:l})," ",t]})},n)})})}function _LineageView(e){let{...n}=e,{fitView:t}=(0,i._K)(),{successToast:o,failToast:D}=useClipBoardToast(),{toImage:N,ref:E}=useToBlob({imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(ej))},onSuccess:async e=>{try{await copyBlobToClipboard(e),o("Copied the Lineage View as an image to clipboard")}catch(e){D("Failed to copy image to clipboard",e)}},onError:e=>{console.error("Error taking screenshot",e),D("Failed to copy image to clipboard",e)}}),[T,F,I]=(0,i.Rr)([]),[L,O,z]=(0,i.ll)([]),[M,P]=(0,w.useState)(),[V,A]=(0,w.useState)(),{lineageGraphSets:q,isLoading:K,error:W}=useLineageGraphsContext(),{isOpen:H,onOpen:U,onClose:Q}=(0,c.q)(),[G,J]=(0,w.useState)("detail"),[Z,X]=(0,w.useState)(),[Y,$]=(0,w.useState)(!1),[ee,et]=(0,w.useState)(n.viewMode||"changed_models"),[er,ei]=(0,w.useState)(!1),[el,eo]=(0,w.useState)({x:0,y:0});if((0,w.useEffect)(()=>{if(!q)return;let e="changed_models"===ee?{...q.changed}:{...q.all},t=q.modifiedSet;if("function"==typeof n.filterNodes){let t=n.filterNodes?n.filterNodes:()=>!0;e.nodes=Object.fromEntries(Object.entries(e.nodes).filter(e=>{let[n,r]=e;return t(n,r)}))}let[r,i]=toReactflow(e,q.modifiedSet);layout(r,i),P(e),A(t),F(r),O(i)},[F,O,ee,q,n.filterNodes]),(0,w.useEffect)(()=>{let e=new ResizeObserver(()=>{t({padding:.2,includeHiddenNodes:!0,duration:300})});return E.current&&e.observe(E.current),()=>e.disconnect()},[E,Y,t]),K)return(0,r.jsx)(a.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,r.jsx)(d.$,{size:"xl"})});let closeContextMenu=()=>{ei(!1),eo({x:0,y:0})};return W?(0,r.jsxs)(r.Fragment,{children:["Fail to load lineage data: ",W]}):"changed_models"===ee&&(void 0===V||(null==V?void 0:V.length)===0)?(0,r.jsx)(u.M,{h:"100%",children:(0,r.jsxs)(h.g,{children:[(0,r.jsx)(r.Fragment,{children:"No change detected"}),(0,r.jsx)(m.z,{colorScheme:"blue",onClick:()=>{et("all")},children:"Show all nodes"})]})}):(0,r.jsxs)(a.k,{width:"100%",height:"100%",children:[(0,r.jsx)(l.xu,{flex:"1 0 0px",children:(0,r.jsxs)(i.x$,{nodeTypes:e5,edgeTypes:e3,nodes:T,edges:L,onNodesChange:I,onEdgesChange:z,onNodeClick:(e,t)=>{!1!==n.interactive&&(closeContextMenu(),"detail"===G?(X(t.id),Y||$(!0),F(selectSingleNode(t.id,T))):F(selectNode(t.id,T)))},onNodeMouseEnter:(e,n)=>{if(M&&void 0!==V){let[e,t]=highlightPath(M,V,T,L,n.id);F(e),O(t)}},onNodeMouseLeave:(e,n)=>{if(M&&void 0!==V){let[e,n]=highlightPath(M,V,T,L,null);F(e),O(n)}},onNodeContextMenu:(e,n)=>{"action"===G&&(e.preventDefault(),eo({x:e.clientX,y:e.clientY,selectedNode:n}),ei(!0))},onClick:closeContextMenu,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:n.interactive,ref:E,children:[(0,r.jsx)(S.A,{color:"#ccc"}),(0,r.jsxs)(_.Z,{showInteractive:!1,position:"top-right",className:ej,children:[n.interactive&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(_.B,{title:"switch mode",onClick:()=>{et("all"===ee?"changed_models":"all");let e=cleanUpSelectedNodes(T);F(e)},children:(0,r.jsx)(s.J,{as:B.Bw1})}),(0,r.jsx)(_.B,{title:"summary",onClick:U,children:(0,r.jsx)(s.J,{as:B.SnF})})]}),(0,r.jsx)(_.B,{title:"copy image",onClick:()=>{N()},children:(0,r.jsx)(s.J,{as:B.C3L})})]}),(0,r.jsx)(i.s_,{position:"bottom-left",children:(0,r.jsxs)(x.U,{children:[(0,r.jsx)(ChangeStatusLegend,{}),n.interactive&&(0,r.jsxs)(l.xu,{p:2,flex:"0 1 160px",fontSize:"14px",className:ej,children:[(0,r.jsx)(f.x,{color:"gray",mb:"2px",children:"Actions"}),(0,r.jsxs)(h.g,{spacing:1,align:"baseline",children:[(0,r.jsx)(m.z,{size:"xs",variant:"outline",isDisabled:"action"===G,onClick:()=>{let e=cleanUpSelectedNodes(T);F(e),J("detail"===G?"action":"detail")},children:"Select Models"}),(0,r.jsx)(AddLineageDiffCheckButton,{viewMode:ee,nodes:T.map(e=>e.data),onFinish:()=>J("detail")})]})]})]})}),(0,r.jsx)(i.s_,{position:"top-left",children:(0,r.jsx)(f.x,{fontSize:"xl",color:"grey",opacity:.5,children:e4[ee]})}),(0,r.jsx)(i.s_,{position:"bottom-center",className:ej,children:(0,r.jsx)(NodeSelector,{viewMode:ee,nodes:T.map(e=>e.data),isOpen:"action"===G,onClose:()=>{J("detail");let e=cleanUpSelectedNodes(T);F(e)}})}),(0,r.jsx)(R.a,{nodeColor:nodeColor,nodeStrokeWidth:3})]})}),(0,r.jsxs)(g.u_,{isOpen:H,onClose:Q,size:"6xl",children:[(0,r.jsx)(p.Z,{}),(0,r.jsxs)(y.h,{overflowY:"auto",height:"80%",children:[(0,r.jsx)(j.o,{}),(0,r.jsx)(v.f,{children:(0,r.jsx)(SummaryView,{})})]})]}),"detail"===G&&Z&&(null==M?void 0:M.nodes[Z])&&(0,r.jsx)(l.xu,{flex:"0 0 500px",borderLeft:"solid 1px lightgray",height:"100%",children:(0,r.jsx)(NodeView,{node:null==M?void 0:M.nodes[Z],onCloseNode:()=>{X(void 0),$(!1),F(cleanUpSelectedNodes(T))}})}),er&&(0,r.jsx)(C.v,{isOpen:!0,onClose:closeContextMenu,children:(0,r.jsxs)(b.q,{style:{position:"absolute",left:"".concat(el.x,"px"),top:"".concat(el.y,"px")},children:[(0,r.jsx)(k.s,{icon:(0,r.jsx)(en.Cv2,{}),onClick:()=>{let e=el.selectedNode;if("action"!==G||void 0===e||void 0===M)return;let n=e.id,t=selectUpstream(M,[n]),r=selectNodes([...t],T);F(r)},children:"Select parent nodes"}),(0,r.jsx)(k.s,{icon:(0,r.jsx)(en.IMj,{}),onClick:()=>{let e=el.selectedNode;if("action"!==G||void 0===e||void 0===M)return;let n=e.id,t=selectDownstream(M,[n]),r=selectNodes([...t],T);F(r)},children:"Select child nodes"})]})})]})}function LineageView(e){let{...n}=e;return void 0===n.interactive&&(n.interactive=!0),void 0===n.viewMode&&(n.viewMode="changed_models"),(0,r.jsx)(i.tV,{children:(0,r.jsx)(_LineageView,{...n})})}var e6=t(12844),e9=t(98786);function RecceContextProvider(e){let{children:n}=e;return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(RecceQueryContextProvider,{children:(0,r.jsx)(LineageGraphsContextProvider,{children:(0,r.jsx)(RowCountStateContextProvider,{children:(0,r.jsx)(RecceActionContextProvider,{children:n})})})})})}function useVersionNumber(){let[e,n]=(0,w.useState)("");return(0,w.useEffect)(()=>{(async function(){try{let e=await Q.get("/api/version");n(e.data)}catch(e){console.error("Error fetching version number:",e)}})()},[]),e}var e8=t(45489),e7=t(69005),ne=t(14800),nn=t(2600),nt=t(68677),nr=t(83358),ni=t(44525),nl=t(79935),no=t(93197),na=t(234),ns=t(96094),nc=t(36334);function CheckBreadcrumb(e){let{name:n,setName:t}=e,[i,o]=(0,w.useState)(!1),[a,s]=(0,w.useState)(n),c=(0,w.useRef)(null),d=(0,w.useCallback)(()=>{t(a),o(!1)},[t,o,a]);return(0,w.useEffect)(()=>{let handleClickOutside=e=>{c.current&&!c.current.contains(e.target)&&d()};return i&&document.addEventListener("mousedown",handleClickOutside),()=>{document.removeEventListener("mousedown",handleClickOutside)}},[i,c,d]),(0,r.jsxs)(na.a,{flex:"0 1",fontSize:"12pt",fontWeight:"500",separator:(0,r.jsx)(nc.X,{color:"gray.500"}),children:[(0,r.jsx)(ns.g,{children:(0,r.jsx)(l.xu,{children:"Checklist"})}),(0,r.jsx)(ns.g,{flex:"0 1",cursor:"pointer",children:i?(0,r.jsx)(eE.I,{ref:c,value:a,onChange:e=>{s(e.target.value)},onKeyDown:e=>{"Enter"===e.key?(t(a),o(!1)):"Escape"===e.key&&(s(n),o(!1))},size:"sm",w:"auto",minW:"200px",maxW:"600px"}):(0,r.jsx)(l.xu,{onClick:()=>{s(n),o(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})]})}function SchemaDiffView(e){let{check:n}=e,{lineageGraphSets:t}=useLineageGraphsContext(),i=n.params,l=i.node_id,o=l?null==t?void 0:t.all.nodes[l]:void 0;return o?(0,r.jsx)(SchemaView,{base:o.data.base,current:o.data.current,enableScreenshot:!0}):(0,r.jsx)(r.Fragment,{})}var nd=t(33695);function CheckDescription(e){let{value:n,onChange:t}=e,[i,l]=(0,w.useState)(!1),[o,s]=(0,w.useState)(),c=(0,w.useRef)(null);return((0,w.useEffect)(()=>{if(i&&c.current){let e=c.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[i]),i)?(0,r.jsxs)(a.k,{direction:"column",align:"flex-end",children:[(0,r.jsx)(nd.g,{h:"200px",value:o,onChange:e=>{s(e.target.value)},onKeyDown:e=>{"Escape"===e.key&&l(!1)},ref:c}),(0,r.jsxs)(a.k,{gap:"12px",alignItems:"flex-end",children:[(0,r.jsx)(eA.r,{onClick:()=>{setTimeout(()=>{l(!1)},100)},colorScheme:"blue",children:"cancel"}),(0,r.jsx)(m.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:()=>{t&&(t(o),l(!1))},children:"Update"})]})]}):(0,r.jsx)(f.x,{maxHeight:"400px",overflow:"auto",fontSize:"11pt",onClick:()=>{s(n||""),l(!0)},whiteSpace:"pre-line",color:n?"inherit":"lightgray",children:n||"Add description here"})}function RowCountDiffResultView(e){let{run:n}=e;function columnCellClass(e){if(e.base===e.current);else if(e.basee.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let t=n.result||{},i=Object.keys(n.result||{}).map(e=>{let n=t[e],r=(null==n?void 0:n.base)||null,i=(null==n?void 0:n.curr)||null,l="No Change";return null!==r&&null!==i?l=ri?"- ".concat(Math.round((r-i)/r*100),"%"):"No Change":r===i?l="N/A":null===r?l="Added":null===i&&(l="Removed"),{name:e,base:null===r?"N/A":Number(r),current:null===i?"N/A":Number(i),delta:l}});return(0,r.jsx)(a.k,{direction:"column",children:Object.keys(t).length>0&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:[{key:"name",name:"Name",cellClass:columnCellClass},{key:"base",name:"Base Rows",cellClass:columnCellClass},{key:"current",name:"Current Rows",cellClass:columnCellClass},{key:"delta",name:"Delta",cellClass:columnCellClass}],rows:i,className:"rdg-light",enableScreenshot:!0})})})}var nu=t(48742);function _templateObject(){let e=(0,e8._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return _templateObject=function(){return e},e}function buildTitle(e){return"".concat(e.is_checked?"✅ ":"").concat(e.name)}function buildDescription(e){return e.description?e.description:"_(no description)_"}function buildQuery(e){var n;return(0,nu.Pn)(_templateObject(),null===(n=e.params)||void 0===n?void 0:n.sql_template)}var query_SqlEditor=e=>{let{value:n,onChange:t,onRun:i,onRunDiff:l,options:o={},...a}=e;return(0,r.jsx)(ew.ZP,{language:"sql",theme:"vs",value:n,onChange:e=>{void 0!==e&&t&&t(e)},onMount:(e,n)=>{i&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,i),l&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,l)},options:{tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...o}})};function DataFrameColumnHeader(e){let{name:n,pinnedColumns:t=[],onPinnedColumnsChange:i=()=>{}}=e,o=t.includes(n);return(0,r.jsxs)(a.k,{className:"grid-header",alignItems:"center",children:[(0,r.jsx)(l.xu,{flex:1,children:n}),(0,r.jsx)(s.J,{className:o?"unpin-icon":"pin-icon",display:o?"block":"none",cursor:"pointer",as:o?T.$kI:T.oJP,onClick:o?()=>{let e=t.filter(e=>e!==n);i(e)}:()=>{let e=[...t,n];i(e)}})]})}function QueryResultView_toDataGrid(e,n){let t=[],i=n.pinnedColumns||[],toColumn=(e,t)=>({key:String(e),name:(0,r.jsx)(DataFrameColumnHeader,{name:t,...n}),width:"auto",renderCell:defaultRenderCell});return t.push({key:"_index",name:"",width:10,cellClass:"index-column"}),i.forEach(n=>{let r=eL().findIndex(e.columns,e=>e.name===n);r<0||t.push(toColumn(r,n))}),e.columns.forEach((e,n)=>{i.includes(e.name)||t.push(toColumn(n,e.name))}),e.data.forEach((e,n)=>{e._index=n+1}),{columns:t,rows:e.data}}let QueryResultView=e=>{let{run:n,viewOptions:t,onViewOptionsChanged:i,onAddToChecklist:s}=e,c=(0,w.useMemo)(()=>(null==t?void 0:t.pinned_columns)||[],[t]),d=null==n?void 0:n.result,h=(0,w.useMemo)(()=>d?QueryResultView_toDataGrid(d,{pinnedColumns:c,onPinnedColumnsChange:e=>{i&&i({...t,pinned_columns:e})}}):{rows:[],columns:[]},[d,c,t,i]);if(0===h.columns.length)return(0,r.jsx)(u.M,{height:"100%",children:"No data"});let m=(null==d?void 0:d.limit)||0,x=m>0&&(null==d?void 0:d.more)?"Warning: Displayed results are limited to ".concat(m.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null;return(0,r.jsxs)(a.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(s||x)&&(0,r.jsxs)(a.k,{borderBottom:"1px solid lightgray",alignItems:"center",gap:"5px",px:"10px",bg:x?"orange.100":"inherit",children:[x&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eP.a,{color:"orange.600",alignSelf:"center"})," ",(0,r.jsx)(l.xu,{children:x})]}),(0,r.jsx)(E.L,{minHeight:"32px"}),s&&(0,r.jsx)(o.u,{label:"Add to Checklist",children:(0,r.jsx)(V.h,{variant:"unstyled",size:"sm","aria-label":"Add",icon:(0,r.jsx)(eV.d,{}),onClick:()=>s(n)})})]}),(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},QueryDiffResultView=e=>{var n,t,i,s,c,d;let{run:m,onAddToChecklist:x,viewOptions:f,onViewOptionsChanged:g}=e,p=(0,w.useMemo)(()=>(null==f?void 0:f.primary_keys)||[],[f]),y=(0,w.useMemo)(()=>(null==f?void 0:f.changed_only)||!1,[f]),j=(0,w.useMemo)(()=>(null==f?void 0:f.pinned_columns)||[],[f]),v=(0,w.useMemo)(()=>{var e,n;return toDataDiffGrid(null==m?void 0:null===(e=m.result)||void 0===e?void 0:e.base,null==m?void 0:null===(n=m.result)||void 0===n?void 0:n.current,{changedOnly:y,primaryKeys:p,onPrimaryKeyChange:e=>{g&&g({...f,primary_keys:e})},pinnedColumns:j,onPinnedColumnsChange:e=>{g&&g({...f,pinned_columns:e})}})},[m,f,y,p,j,g]),C=(0,w.useMemo)(()=>{let e=p.join(", ");return v.invalidPKeyBase&&v.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the base and current environments"):v.invalidPKeyBase?"Warning: The primary key '".concat(e,"' is not unique in the base environment"):v.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the current environment"):void 0},[v.invalidPKeyBase,v.invalidPKeyCurrent,p]);if(0===v.columns.length)return(0,r.jsx)(u.M,{height:"100%",children:"No data"});if(y&&0===v.rows.length)return(0,r.jsx)(u.M,{height:"100%",children:"No change"});let b=(null===(t=m.result)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.limit)||0,k=b>0&&((null==m?void 0:null===(s=m.result)||void 0===s?void 0:null===(i=s.current)||void 0===i?void 0:i.more)||(null==m?void 0:null===(d=m.result)||void 0===d?void 0:null===(c=d.base)||void 0===c?void 0:c.more))?"Warning: Displayed results are limited to ".concat(b.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null;return(0,r.jsxs)(a.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,r.jsxs)(a.k,{borderBottom:"1px solid lightgray",justifyContent:"flex-end",gap:"5px",alignItems:"center",px:"10px",bg:k||C?"orange.100":"inherit",children:[(0,r.jsxs)(h.g,{alignItems:"flex-start",spacing:0,children:[C&&(0,r.jsxs)(l.xu,{children:[(0,r.jsx)(eP.a,{color:"orange.600"})," ",C]}),k&&(0,r.jsxs)(l.xu,{children:[(0,r.jsx)(eP.a,{color:"orange.600"})," ",k]})]}),(0,r.jsx)(E.L,{minHeight:"32px"}),(0,r.jsx)(eT.X,{isChecked:null==f?void 0:f.changed_only,onChange:()=>{let e=!(null==f?void 0:f.changed_only);g&&g({...f,changed_only:e})},children:"Changed only"}),x&&(0,r.jsx)(o.u,{label:"Add to Checklist",children:(0,r.jsx)(V.h,{variant:"unstyled",size:"sm","aria-label":"Add",icon:(0,r.jsx)(eV.d,{}),onClick:()=>x(m)})})]}),(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:v.columns,rows:v.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})};var nh=t(43105);function LineageDiffView(e){var n;let{check:t}=e,i=(null===(n=t.params)||void 0===n?void 0:n.view_mode)||"";return(0,r.jsx)(a.k,{direction:"column",height:"100%",children:(0,r.jsx)(LineageView,{viewMode:i,interactive:!1,filterNodes:e=>{var n,r;return null===(r=t.params)||void 0===r?void 0:null===(n=r.node_ids)||void 0===n?void 0:n.includes(e)}})})}function CheckDetail_templateObject(){let e=(0,e8._)(["\n
","\n\n ","\n\n
"]);return CheckDetail_templateObject=function(){return e},e}let nm={query:QueryResultView,query_diff:QueryDiffResultView,value_diff:ValueDiffResultView,value_diff_detail:ValueDiffDetailResultView,profile_diff:ProfileDiffResultView,row_count_diff:RowCountDiffResultView,top_k_diff:TopKDiffResultView},useCancelOnUnmount=e=>{let{runId:n,isPending:t,setAborting:r}=e;(0,w.useEffect)(()=>()=>{r(!1),n&&t&&cancelRun(n)},[t,n,r])},CheckDetail=e=>{var n;let{checkId:t}=e,i=(0,q.NL)(),[,c]=(0,eS.TH)(),{successToast:d,failToast:h}=useClipBoardToast(),[x,f]=(0,w.useState)(),[g,p]=(0,w.useState)(),[y,j]=(0,w.useState)(!1),{isLoading:v,error:S,refetch:_,data:R}=(0,$.a)({queryKey:J.check(t),queryFn:async()=>getCheck(t),refetchOnMount:!1,staleTime:3e5}),D=R&&(null==R?void 0:R.type)in nm?nm[null==R?void 0:R.type]:void 0,{mutate:N}=(0,ez.D)({mutationFn:e=>updateCheck(t,e),onSuccess:()=>{i.invalidateQueries({queryKey:J.check(t)}),i.invalidateQueries({queryKey:J.checks()})}}),{mutate:F}=(0,ez.D)({mutationFn:()=>deleteCheck(t),onSuccess:()=>{i.invalidateQueries({queryKey:J.checks()}),c("/checks")}}),submitRunFn=async()=>{let e=null==R?void 0:R.type;if(!e)return;let{run_id:n}=await submitRunFromCheck(t,{nowait:!0});for(f(n);;){let e=await waitRun(n,2);if(p(e.progress),e.result||e.error)return j(!1),p(void 0),e}},{data:I,mutate:L,error:O,isIdle:z,isPending:M}=(0,ez.D)({mutationFn:submitRunFn,onSuccess:e=>{_()}}),handleRerun=async()=>{L()},P=(0,w.useCallback)(async()=>{if(j(!0),x)return await cancelRun(x)},[x]);useCancelOnUnmount({runId:x,isPending:M,setAborting:j});let handleCopy=async()=>{if(!R)return;let e=buildMarkdown(R);if(!navigator.clipboard){h("Failed to copy the check to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));return}try{await navigator.clipboard.writeText(e),d("Copied the check to the clipboard")}catch(e){h("Failed to copy the check to clipboard",e)}},B=(0,w.useCallback)(()=>{let e=null==R?void 0:R.is_checked;N({is_checked:!e})},[null==R?void 0:R.is_checked,N]);if(v)return(0,r.jsx)(u.M,{h:"100%",children:"Loading"});if(S)return(0,r.jsxs)(u.M,{h:"100%",children:["Error: ",S.message]});let A=z?null==R?void 0:R.last_run:I,K=(null==A?void 0:A.run_at)?(0,nh.Z)(new Date(A.run_at),{addSuffix:!0}):null;return(0,r.jsxs)(a.k,{height:"100%",width:"100%",maxHeight:"100%",direction:"column",children:[(0,r.jsxs)(a.k,{p:"0px 16px",alignItems:"center",children:[(0,r.jsx)(CheckBreadcrumb,{name:(null==R?void 0:R.name)||"",setName:e=>{N({name:e})}}),(0,r.jsx)(E.L,{}),(0,r.jsxs)(C.v,{children:[(0,r.jsx)(eu.j,{isRound:!0,as:V.h,icon:(0,r.jsx)(s.J,{as:T.D_A}),variant:"ghost"}),(0,r.jsx)(b.q,{children:(0,r.jsx)(k.s,{icon:(0,r.jsx)(ni.p,{}),onClick:()=>F(),children:"Delete"})})]}),K&&(0,r.jsx)(l.xu,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:K}),R&&(null==R?void 0:R.type)in nm&&(0,r.jsx)(o.u,{label:"Rerun",children:(0,r.jsx)(V.h,{isRound:!0,isLoading:M,variant:"ghost","aria-label":"Rerun",icon:(0,r.jsx)(nl.n,{}),onClick:()=>handleRerun()})}),(0,r.jsx)(o.u,{label:"Copy markdown",children:(0,r.jsx)(V.h,{isRound:!0,variant:"ghost","aria-label":"Copy markdown",icon:(0,r.jsx)(ef.T,{}),onClick:()=>handleCopy()})}),(0,r.jsx)(o.u,{label:(null==R?void 0:R.is_checked)?"Mark as unchecked":"Mark as checked",children:(0,r.jsx)(m.z,{size:"sm",colorScheme:(null==R?void 0:R.is_checked)?"green":"gray",leftIcon:(0,r.jsx)(no.r,{}),onClick:()=>B(),children:(null==R?void 0:R.is_checked)?"Checked":"Unchecked"})})]}),(0,r.jsx)(l.xu,{p:"8px 16px",minHeight:"100px",children:(0,r.jsx)(CheckDescription,{value:null==R?void 0:R.description,onChange:e=>{N({description:e})}},null==R?void 0:R.check_id)}),((null==R?void 0:R.type)==="query"||(null==R?void 0:R.type)==="query_diff")&&(0,r.jsx)(e7.U,{defaultIndex:[],allowToggle:!0,children:(0,r.jsxs)(ne.Q,{children:[(0,r.jsxs)(nn.K,{children:["query",(0,r.jsx)(nt.X,{})]}),(0,r.jsx)(nr.H,{children:(0,r.jsx)(l.xu,{height:"400px",width:"100%",border:"lightgray 1px solid ",children:(0,r.jsx)(query_SqlEditor,{value:(null===(n=null==R?void 0:R.params)||void 0===n?void 0:n.sql_template)||"",options:{readOnly:!0}})})})]})}),(0,r.jsxs)(l.xu,{style:{contain:"size"},flex:"1 1 0%",children:[D&&(0,r.jsx)(RunView,{isPending:M,isAborting:y,run:A,error:O,progress:g,RunResultView:D,viewOptions:null==R?void 0:R.view_options,onViewOptionsChanged:e=>{N({view_options:e})},onCancel:P}),R&&"schema_diff"===R.type&&(0,r.jsx)(SchemaDiffView,{check:R}),R&&"lineage_diff"===R.type&&(0,r.jsx)(LineageDiffView,{check:R})]})]})};function buildMarkdown(e){return(0,nu.Pn)(CheckDetail_templateObject(),buildTitle(e),buildBody(e))}function buildBody(e){return"query"===e.type||"query_diff"===e.type?"".concat(buildDescription(e),"\n\n").concat(buildQuery(e)):buildDescription(e)}var nx=t(38505);let ChecklistItem=e=>{let{check:n,selected:t,onSelect:i}=e,o=(0,q.NL)(),c=n.check_id,{mutate:d}=(0,ez.D)({mutationFn:e=>updateCheck(c,e),onSuccess:()=>{o.invalidateQueries({queryKey:J.check(c)}),o.invalidateQueries({queryKey:J.checks()})}}),u=(e=>{switch(e){case"schema_diff":return e2.uhn;case"query":case"query_diff":return e2.r2i;case"value_diff":return e2.pRi;case"profile_diff":return e2.dku;case"row_count_diff":return B.SwK;case"lineage_diff":return e2.Ks7;default:return e2.WzH}})(n.type);return(0,r.jsxs)(a.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"gray.200"},bg:t?"gray.100":"inherit",onClick:()=>i(n.check_id),alignItems:"center",gap:"5px",children:[(0,r.jsx)(s.J,{as:u}),(0,r.jsx)(l.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n.name}),n.is_checked&&(0,r.jsx)(s.J,{color:"green",as:F.FJM})]})},CheckList=e=>{let{checks:n,selectedItem:t,onCheckSelected:i,onChecksReordered:l}=e;return(0,r.jsx)(nx.Z5,{onDragEnd:e=>{e.destination&&l(e.source.index,e.destination.index)},children:(0,r.jsx)(nx.bK,{droppableId:"checklist",children:e=>(0,r.jsxs)(h.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",children:[n.map((e,n)=>(0,r.jsx)(nx._l,{draggableId:e.check_id,index:n,children:n=>(0,r.jsx)(a.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,r.jsx)(ChecklistItem,{check:e,selected:e.check_id===t,onSelect:i},e.check_id)})},e.check_id)),e.placeholder]})})})};function CheckPage_templateObject(){let e=(0,e8._)(["\n
","\n\n ","\n\n
"]);return CheckPage_templateObject=function(){return e},e}let CheckPage=()=>{let[,e]=(0,eS.TH)(),[,n]=(0,eS.yj)("/checks/:checkId"),t=(0,q.NL)(),{successToast:i,failToast:s}=useClipBoardToast(),c=null==n?void 0:n.checkId,{isLoading:d,error:f,data:g,status:p}=(0,$.a)({queryKey:J.checks(),queryFn:listChecks,refetchOnMount:!0}),y=(0,w.useCallback)(n=>{e("/checks/".concat(n))},[e]),[j,v]=(0,w.useState)(g||[]),{mutate:C}=(0,ez.D)({mutationFn:e=>reorderChecks(e),onSuccess:()=>{t.invalidateQueries({queryKey:J.checks()})}}),b=(0,w.useCallback)((e,n)=>{let t=[...j],[r]=t.splice(e,1);t.splice(n,0,r),C({source:e,destination:n}),v(t)},[j,v,C]),k=(0,w.useCallback)(async()=>{let e=await createSimpleCheck();t.invalidateQueries({queryKey:J.checks()}),y(e.check_id)},[t,y]);return((0,w.useEffect)(()=>{"success"===p&&(!c&&g.length>0&&e("/checks/".concat(g[0].check_id)),v(g))},[p,c,g,v,e]),d)?(0,r.jsx)(r.Fragment,{children:"Loading"}):f?(0,r.jsxs)(r.Fragment,{children:["Error: ",f.message]}):(null==g?void 0:g.length)?(0,r.jsxs)(a.k,{height:"100%",children:[(0,r.jsx)(l.xu,{flex:"0 0 400px",borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,r.jsxs)(h.g,{spacing:0,align:"flex-end",h:"100%",children:[(0,r.jsxs)(x.U,{children:[(0,r.jsx)(o.u,{label:"Create a simple check",children:(0,r.jsx)(V.h,{variant:"unstyled","aria-label":"Create a simple check",onClick:k,icon:(0,r.jsx)(eV.d,{})})}),(0,r.jsx)(o.u,{label:"Copy checklist to the clipboard",children:(0,r.jsx)(V.h,{variant:"unstyled","aria-label":"Copy checklist to the clipboard",mr:"10px",onClick:async()=>{let e=CheckPage_buildMarkdown(g);if(!navigator.clipboard){s("Failed to copy checklist to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));return}try{await navigator.clipboard.writeText(e),i("Copied ".concat(g.length," checks to the clipboard"))}catch(e){s("Failed to copy checklist to clipboard",e)}},icon:(0,r.jsx)(ef.T,{})})})]}),(0,r.jsx)(eB.i,{mb:"8px"}),(0,r.jsx)(CheckList,{checks:j,selectedItem:c,onCheckSelected:y,onChecksReordered:b})]})}),(0,r.jsx)(l.xu,{flex:"1",height:"100%",width:"calc(100% - 400px)",children:(0,r.jsx)(eS.rs,{children:(0,r.jsx)(eS.AW,{path:"/checks/:checkId",children:e=>(0,r.jsx)(CheckDetail,{checkId:e.checkId},e.checkId)})})})]}):(0,r.jsx)(u.M,{h:"100%",children:(0,r.jsxs)(h.g,{children:[(0,r.jsx)(l.xu,{children:"No checks"}),(0,r.jsx)(m.z,{colorScheme:"blue",onClick:k,children:"Create a simple check"})]})})};function CheckPage_buildMarkdown(e){let n=e.map(e=>(0,nu.Pn)(CheckPage_templateObject(),buildTitle(e),buildDescription(e)));return n.join("\n\n")}async function submitQuery(e,n){return await submitRun("query",e,n)}async function submitQueryDiff(e,n){return await submitRun("query_diff",e,n)}let QueryPage=()=>{let{sqlQuery:e,setSqlQuery:n}=useRecceQueryContext(),[t,i]=(0,w.useState)(),[o,s]=(0,w.useState)(),[c,d]=(0,w.useState)({}),u=(0,q.NL)(),[,h]=(0,eS.TH)(),queryFn=async n=>{i(n);let{run_id:t}="query"===n?await submitQuery({sql_template:e},{nowait:!0}):await submitQueryDiff({sql_template:e},{nowait:!0});return s(t),await waitRun(t)},{data:x,mutate:f,error:g,isPending:p}=(0,ez.D)({mutationFn:queryFn,onSuccess:e=>{d({})}}),y=(0,w.useCallback)(async()=>{if(o)return await cancelRun(o)},[o]),j=(0,w.useCallback)(async e=>{if(!(null==e?void 0:e.run_id))return;let n=await createCheckByRun(e.run_id,c);u.invalidateQueries({queryKey:J.checks()}),h("/checks/".concat(n.check_id))},[h,c,u]);return!p&&(null==x?void 0:x.run_id)&&(null==x||x.error),(0,r.jsxs)(a.k,{direction:"column",height:"100%",children:[(0,r.jsxs)(a.k,{justifyContent:"right",padding:"5px",gap:"5px",children:[(0,r.jsx)(m.z,{colorScheme:"blue",onClick:()=>f("query_diff"),isDisabled:p,size:"sm",children:"Run Diff"}),(0,r.jsx)(m.z,{colorScheme:"blue",onClick:()=>f("query"),isDisabled:p,size:"sm",children:"Run"})]}),(0,r.jsx)(l.xu,{flex:"1",border:"1px solid #CBD5E0",height:"200px",width:"100%",children:(0,r.jsx)(query_SqlEditor,{value:e,onChange:n,onRun:()=>f("query"),onRunDiff:()=>f("query_diff")})}),(0,r.jsx)(a.k,{height:"50vh",direction:"column",children:"query"===t?(0,r.jsx)(RunView,{run:x,error:g,isPending:p,onCancel:y,children:e=>(0,r.jsx)(QueryResultView,{...e,onAddToChecklist:j})},o):(0,r.jsx)(RunView,{isPending:p,run:x,error:g,viewOptions:c,onViewOptionsChanged:d,onCancel:y,children:e=>(0,r.jsx)(QueryDiffResultView,{...e,onAddToChecklist:j})},o)})]})};var nf=t(72952);let hashNavigate=e=>(0,nf.c4)("#!"+e),useHashLocation=()=>{let e=(0,nf.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr");return[e,hashNavigate]};var ng=t(82017),np=t(41546),ny=t(85036),nj=t(12218);function getCookie(e){var n=document.cookie.match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)");return n?n.pop():""}function TopBar(){let{metadata:e}=useLineageGraphsContext(),n=null==e?void 0:e.pr_url;return n&&null!==n?(0,r.jsxs)(a.k,{gap:"5px",minHeight:"35px",alignItems:"center",justifyContent:"center",bg:"orange.300",children:[(0,r.jsx)(ny.s,{color:"orange.600"}),(0,r.jsxs)(f.x,{children:["Please check"," ",(0,r.jsx)(eA.r,{textDecoration:"underline",fontWeight:"600",href:n,isExternal:!0,children:"this Pull Request"})," ","comment for context about this Recce instance"]})]}):(0,r.jsx)(r.Fragment,{})}function NavBar(){let[e,n]=(0,eS.TH)(),t=useVersionNumber(),i=[["Lineage","/lineage"],["Query","/query"],["Checklist","/checks"]],o=eL().findIndex(i,n=>{let[,t]=n;return e.startsWith(t)});return(0,r.jsx)(eo.m,{index:o,children:(0,r.jsxs)(ea.t,{children:[i.map(e=>{let[t,i]=e;return(0,r.jsx)(es.O,{onClick:()=>{n(i)},children:t},t)}),(0,r.jsx)(l.xu,{position:"absolute",right:"0",top:"0",p:"2",color:"gray.500",children:t})]})})}function Home(){(0,w.useLayoutEffect)(()=>{let e=getCookie("recce_user_id");if(e&&nj.env.AMPLITUDE_API_KEY)try{e9.S1(nj.env.AMPLITUDE_API_KEY,e,{defaultTracking:!0})}catch(e){console.error(e)}},[]);let e=(0,ng.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,r.jsx)(np.Z,{theme:e,children:(0,r.jsx)(e6.x,{children:(0,r.jsx)(q.aH,{client:G,children:(0,r.jsx)(eS.F0,{hook:useHashLocation,children:(0,r.jsx)(RecceContextProvider,{children:(0,r.jsxs)(a.k,{direction:"column",height:"100vh",children:[(0,r.jsx)(TopBar,{}),(0,r.jsx)(NavBar,{}),(0,r.jsx)(l.xu,{p:0,overflow:"auto",flex:"1",style:{contain:"size"},children:(0,r.jsxs)(eS.rs,{children:[(0,r.jsx)(eS.AW,{path:"/lineage",children:(0,r.jsx)(LineageView,{})}),(0,r.jsx)(eS.AW,{path:"/query",children:(0,r.jsx)(QueryPage,{})}),(0,r.jsx)(eS.AW,{path:"/checks/:slug*",children:(0,r.jsx)(CheckPage,{})}),(0,r.jsx)(eS.AW,{path:"/ssr",children:(0,r.jsx)(r.Fragment,{children:"Loading"})}),(0,r.jsx)(eS.AW,{children:(0,r.jsx)(eS.l_,{to:"/lineage"})})]})})]})})})})})})}},88727:function(){},7866:function(){},75165:function(){}},function(e){e.O(0,[634,145,170,521,462,531,182,710,971,495,599,512,880,297,62,744],function(){return e(e.s=99178)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/recce/data/_next/static/chunks/app/page-83c844933e28ea4c.js b/recce/data/_next/static/chunks/app/page-83c844933e28ea4c.js new file mode 100644 index 00000000..0fae5f49 --- /dev/null +++ b/recce/data/_next/static/chunks/app/page-83c844933e28ea4c.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{99178:function(e,n,t){Promise.resolve().then(t.bind(t,31398))},31398:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Home}});var r=t(757),i=t(27869);function getNeighborSet(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,r=new Set,i={},dfs=(e,t)=>{if(t<0||void 0!==i[e]&&i[e]>=t)return;i[e]=t;let o=n(e);for(let e of o)dfs(e,t-1);r.add(e)};for(let n of e)dfs(n,t);return r}function buildDefaultLineageGraphSets(e,n){function buildAllLineageGraph(e,n){let t={},r={},buildNode=(e,n)=>({id:e,name:e,data:{},from:n,parents:{},children:{},isSelected:!1});for(let[n,r]of Object.entries(e.parent_map)){t[n]=buildNode(n,"base");let r=e.nodes&&e.nodes[n];r&&(t[n].data.base=r,t[n].name=null==r?void 0:r.name,t[n].resourceType=null==r?void 0:r.resource_type,t[n].packageName=null==r?void 0:r.package_name)}for(let[e,r]of Object.entries(n.parent_map)){t[e]?t[e].from="both":t[e]=buildNode(e,"current");let r=n.nodes&&n.nodes[e];r&&(t[e].data.current=n.nodes&&n.nodes[e],t[e].name=null==r?void 0:r.name,t[e].resourceType=null==r?void 0:r.resource_type,t[e].packageName=null==r?void 0:r.package_name)}for(let[n,i]of Object.entries(e.parent_map))for(let e of i){let i=t[n],o=t[e],l="".concat(e,"_").concat(n);r[l]={id:l,from:"base",parent:o,child:i};let a=r[l];i.parents[e]=a,o.children[n]=a}for(let[e,i]of Object.entries(n.parent_map))for(let n of i){let i=t[e],o=t[n],l="".concat(n,"_").concat(e);r[l]?r[l].from="both":r[l]={id:l,from:"current",parent:o,child:i};let a=r[l];i.parents[n]=a,o.children[e]=a}return{edges:r,nodes:t}}function buildChangedOnlyLineageGraph(e,n){let t={},r={};function union(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{r.add(e)})}),r}let i=selectDownstream(e,n),o=selectUpstream(e,n,1),l=union(i,o);return Object.entries(e.nodes).forEach(e=>{let[n,r]=e;l.has(n)&&(t[n]=r)}),Object.entries(e.edges).forEach(e=>{let[n,t]=e;l.has(t.parent.id)&&l.has(t.child.id)&&(r[n]=t)}),{nodes:t,edges:r}}let{nodes:t,edges:r}=buildAllLineageGraph(e,n),i=[];for(let[e,n]of Object.entries(t))if("base"===n.from)n.changeStatus="removed",i.push(n.id);else if("current"===n.from)n.changeStatus="added",i.push(n.id);else{var o,l,a,s,c,d;let e=null==n?void 0:null===(a=n.data)||void 0===a?void 0:null===(l=a.base)||void 0===l?void 0:null===(o=l.checksum)||void 0===o?void 0:o.checksum,t=null==n?void 0:null===(d=n.data)||void 0===d?void 0:null===(c=d.current)||void 0===c?void 0:null===(s=c.checksum)||void 0===s?void 0:s.checksum;e&&t&&e!==t&&(n.changeStatus="modified",i.push(n.id))}for(let[e,n]of Object.entries(r))"base"===n.from?n.changeStatus="removed":"current"===n.from&&(n.changeStatus="added");return{all:{nodes:t,edges:r},changed:buildChangedOnlyLineageGraph({nodes:t,edges:r},i),modifiedSet:i,catalogExistence:{base:!!e.catalog_metadata,current:!!n.catalog_metadata}}}function selectUpstream(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return getNeighborSet(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].parents),t)}function selectDownstream(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;return getNeighborSet(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].children),t)}function toReactflow(e,n){let t=[],r=[];for(let[n,r]of Object.entries(e.nodes))t.push({id:r.id,position:{x:0,y:0},data:r,type:"customNode",targetPosition:i.Ly.Left,sourcePosition:i.Ly.Right});for(let[n,t]of Object.entries(e.edges))r.push({id:t.id,type:"customEdge",source:t.parent.id,target:t.child.id,data:t});return highlightPath(e,n,t,r,null)}function highlightPath(e,n,t,r,i){function union(){for(var e=arguments.length,n=Array(e),t=0;t{e.forEach(e=>{r.add(e)})}),r}let o=null!==i?union(selectUpstream(e,[i]),selectDownstream(e,[i])):getNeighborSet(n,n=>void 0===e.nodes[n]?[]:Object.keys(e.nodes[n].children)),l=new Set(r.filter(e=>o.has(e.source)&&o.has(e.target)).map(e=>e.id)),a=t.map(e=>({...e,data:{...e.data,isHighlighted:o.has(e.id)}})),s=r.map(e=>({...e,data:{...e.data,isHighlighted:l.has(e.id)}}));return[a,s]}function selectSingleNode(e,n){let t=n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:t}}});return t}function selectNode(e,n){let t=n.map(n=>{let t=n.id===e;return{...n,data:{...n.data,isSelected:n.data.isSelected!==t}}});return t}function selectNodes(e,n){let t=n.map(n=>{let t=e.includes(n.id);return{...n,data:{...n.data,isSelected:n.data.isSelected||t}}});return t}function cleanUpSelectedNodes(e){let n=e.map(e=>({...e,data:{...e.data,isSelected:!1}}));return n}var o=t(10126),l=t(83172),a=t(55528),s=t(29330),c=t(17714),d=t(46543),u=t(76920),h=t(39668),m=t(83179),x=t(62648),f=t(43093),g=t(7752),p=t(94410),y=t(23330),v=t(29985),j=t(42524),C=t(36700),b=t(10287),k=t(48950),w=t(27726),S=t(26187),_=t(23704),R=t(33710),T=t(93864),D=t.n(T);t(94570);var N=t(90593),E=t(11180),I=t(63240),L=t(54057);let M=E.Nbv,F=E.sFB,O=E.UGs,IconChanged=e=>(0,r.jsxs)("svg",{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 16 16",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 11 a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"}),(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:""})]});function getIconForChangeStatus(e){return"added"===e?{color:"#1dce00",icon:M}:"removed"===e?{color:"#ff4444",icon:F}:"modified"===e?{color:"#ffa502",icon:O}:{color:"inherit",icon:void 0}}function getIconForResourceType(e){return"model"===e?{color:"#c0eafd",icon:I.Fn3}:"metric"===e?{color:"#ffe6ee",icon:L._MV}:"source"===e?{color:"#a6dda6",icon:I.i1q}:"exposure"===e?{color:"#ffe6ee",icon:L.n8P}:"semantic_model"===e?{color:"#fb8caf",icon:L.R1C}:"seed"===e?{color:"#a6dda6",icon:I.tWi}:{color:"inherit",icon:void 0}}t(88727);var A=t(19920),z=t(19103),P=t(95913),V=t(89042),B=t(80294),q=t(35537),H=t(10929),K=t(12218);let W=K.env.NEXT_PUBLIC_API_URL?K.env.NEXT_PUBLIC_API_URL:window.location.origin;var U=t(27471);let G=H.default.create({baseURL:W}),Q=new U.S;async function submitRun(e,n,t){let r=await G.post("/api/runs",{type:e,params:n,nowait:null==t?void 0:t.nowait}),i=r.data;return i}async function waitRun(e,n){let t=await G.get("/api/runs/".concat(e,"/wait"),{params:{timeout:n}}),r=t.data;return r}async function cancelRun(e){return await G.post("/api/runs/".concat(e,"/cancel"))}async function submitRunFromCheck(e,n){let t=await G.post("/api/checks/".concat(e,"/run"),{nowait:null==n?void 0:n.nowait}),r=t.data;return r}async function submitRowCountDiff(e,n){return await submitRun("row_count_diff",e,n)}let J={allRowCount:()=>["row_count"],rowCount:e=>["row_count",e],lineage:()=>["lineage"],checks:()=>["checks","list"],check:e=>["checks",e]},Z='select * from {{ ref("mymodel") }}',X=(0,w.createContext)({sqlQuery:Z,setSqlQuery:()=>{}});function RecceQueryContextProvider(e){let{children:n}=e,[t,i]=w.useState(Z);return(0,r.jsx)(X.Provider,{value:{setSqlQuery:i,sqlQuery:t},children:n})}let useRecceQueryContext=()=>(0,w.useContext)(X),Y=(0,w.createContext)({isNodesFetching:[],setIsNodesFetching:()=>{}});function RowCountStateContextProvider(e){let{children:n}=e,[t,i]=w.useState([]);return(0,r.jsx)(Y.Provider,{value:{isNodesFetching:t,setIsNodesFetching:i},children:n})}let useRowCountStateContext=()=>(0,w.useContext)(Y);async function models_queryModelRowCount(e){let{result:n}=await queryRowCount([e]);return n[e]}async function queryRowCount(e){if(0===e.length)throw Error("No model names provided");let{run_id:n}=await submitRowCountDiff({node_names:e},{nowait:!0}),t=await waitRun(n);return{runId:n,result:t.result}}function useRowCountQueries(e){let[n,t]=(0,w.useState)(!1),r=(0,q.NL)(),{setIsNodesFetching:i}=useRowCountStateContext(),o=r.getQueriesData({queryKey:J.allRowCount()}).filter(n=>{let[t,r]=n,[i,o]=t;return e.includes(o)}).map(e=>{let[n,t]=e,[r,i]=n;return{modelName:i,data:t}}),l=[];return e.forEach(e=>{let{data:n}=o.find(n=>n.modelName===e)||{data:void 0,modelName:e};void 0===n&&l.push(e)}),{isLoading:n,fetchFn:async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=n&&n.skipCache?e:l;t(!0),i(o);let{runId:a,result:s}=await queryRowCount(o);return Object.keys(s).forEach(e=>{let n=s[e];r.setQueryData(J.rowCount(e),{base:n.base,curr:n.curr})}),t(!1),i([]),a}}}var $=t(44903),ee=t(62516);function RowCountByCompare(e){let{rowCount:n}=e,t=null===n.base?-1:n.base,i=null===n.curr?-1:n.curr,o=null===t?"N/A":t,l=null===i?"N/A":i;return t===i?(0,r.jsx)(x.U,{children:(0,r.jsxs)(f.x,{children:[o," == ",l," rows"]})}):tt?(0,r.jsxs)(x.U,{children:[(0,r.jsx)(f.x,{children:o}),(0,r.jsx)(s.J,{as:V.ZBs,color:"red.500"}),(0,r.jsxs)(f.x,{children:[l," row"]})]}):void 0}function RowCountWiteRate(e){let{rowCount:n}=e,t=null===n.base?-1:n.base,i=null===n.curr?-1:n.curr;return t<=0||i<=0?(0,r.jsx)(RowCountByCompare,{rowCount:n}):t===i?(0,r.jsxs)(x.U,{children:[(0,r.jsxs)(f.x,{children:[i," rows"]}),(0,r.jsx)(s.J,{as:ee.lxc,color:"gray.500"}),(0,r.jsx)(f.x,{color:"gray.500",children:"No Change"})]}):tmodels_queryModelRowCount(n.name),enabled:"model"===n.resourceType&&t}),m=h||o.includes(n.name),x=a||o.includes(n.name);function ProcessedRowCountTag(e){let{isLoading:n,rowCount:t}=e;return(0,r.jsx)(A.Sn,{children:(0,r.jsx)(z.N,{isLoaded:!n,noOfLines:1,skeletonHeight:2,minWidth:"30px",children:(0,r.jsx)(ModelRowCount,{rowCount:t})})})}function UnprocessedRowCountTag(e){let{isInteractive:n,invokeFunction:t}=e;return n?(0,r.jsx)(P.h,{"aria-label":"Query Row Count",icon:(0,r.jsx)(B.j3i,{}),size:"xs",onClick:()=>{t()}}):(0,r.jsx)(s.J,{as:B.ebq})}if(!1===i&&!1===u&&!1===m)return null;let f="Query the number of row";if(m)f="Querying the number of row";else if(u){let e=(null==c?void 0:c.base)===null?"N/A":null==c?void 0:c.base,n=(null==c?void 0:c.curr)===null?"N/A":null==c?void 0:c.curr;f="".concat(e," -> ").concat(n," rows")}return(0,r.jsx)(l.u,{hasArrow:!0,label:f,openDelay:500,closeDelay:200,children:(0,r.jsxs)(A.Vp,{children:[(0,r.jsx)(A.AD,{as:V.SwK}),u||m?(0,r.jsx)(ProcessedRowCountTag,{isLoading:x,rowCount:c}):(0,r.jsx)(UnprocessedRowCountTag,{isInteractive:i,invokeFunction:d})]})})}function FetchSelectedNodesRowCountButton(e){let{nodes:n,onFinish:t}=e,{isLoading:i,fetchFn:o}=useRowCountQueries(n.map(e=>e.name));return(0,r.jsxs)(m.z,{isLoading:i,loadingText:"Querying",size:"xs",variant:"outline",title:"Query Row Counts",onClick:async()=>{await o(),t&&t()},isDisabled:0===n.length,children:[(0,r.jsx)(s.J,{as:B.j3i,mr:1}),"Query Row Counts"]})}function GraphNode(e){var n,t;let c,{data:d}=e,{isHighlighted:u,isSelected:h,resourceType:m,changeStatus:f}=d,g=(0,i.oR)(e=>e.transform[2]>.3),{icon:p}=getIconForResourceType(m),y="gray.400",v="solid";f&&(c=getIconForChangeStatus(f).icon,y=getIconForChangeStatus(f).color);let j=y,C=d.isSelected?"rgba(3, 102, 214, 0.5) 5px 5px 10px 3px":"unset",b=null==d?void 0:d.name;return(0,r.jsx)(l.u,{label:"model"===m?b:"".concat(b," (").concat(m,")"),placement:"top",children:(0,r.jsxs)(a.k,{width:"300px",_hover:{backgroundColor:g?"gray.100":y},borderColor:j,borderWidth:1,borderStyle:v,backgroundColor:g?"white":y,borderRadius:3,boxShadow:C,transition:"box-shadow 0.2s ease-in-out",padding:0,className:!0===u?"node-highlight":!0===h?"node-highlight":!1===u?"node-unhighlight":void 0,children:[(0,r.jsx)(a.k,{backgroundColor:y,padding:2,borderRightWidth:1,borderColor:j,borderStyle:v,alignItems:"top",visibility:g?"inherit":"hidden",children:(0,r.jsx)(s.J,{as:p})}),(0,r.jsxs)(a.k,{flex:"1 0 auto",mx:"1",width:"100px",direction:"column",children:[(0,r.jsxs)(a.k,{width:"100%",textAlign:"left",flex:"1",p:1,alignItems:"center",visibility:g?"inherit":"hidden",children:[(0,r.jsx)(o.xu,{flex:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:b}),c&&(0,r.jsx)(a.k,{children:(0,r.jsx)(s.J,{color:y,as:c,flex:"0 0 20px"})})]}),"model"===d.resourceType&&(0,r.jsx)(a.k,{flex:"1 0 auto",mx:"1",direction:"column",paddingBottom:"1",visibility:g?"inherit":"hidden",children:(0,r.jsxs)(x.U,{spacing:"8px",children:[(0,r.jsx)(N.L,{}),(0,r.jsx)(RowCountTag,{node:d,isInteractive:!1})]})})]}),Object.keys(null!==(n=null==d?void 0:d.parents)&&void 0!==n?n:{}).length>0&&(0,r.jsx)(i.HH,{type:"target",position:i.Ly.Left,isConnectable:!1}),Object.keys(null!==(t=null==d?void 0:d.children)&&void 0!==t?t:{}).length>0&&(0,r.jsx)(i.HH,{type:"source",position:i.Ly.Right,isConnectable:!1})]})})}function GraphEdge(e){let{sourceX:n,sourceY:t,targetX:o,targetY:l,sourcePosition:a,targetPosition:s,style:c={},markerEnd:d,data:u}=e,h={...c};(null==u?void 0:u.changeStatus)&&(h.stroke=getIconForChangeStatus(null==u?void 0:u.changeStatus).color,h.strokeDasharray="5"),(null==u?void 0:u.isHighlighted)===!1&&(h.filter="opacity(0.2) grayscale(50%)");let[m]=(0,i.OQ)({sourceX:n,sourceY:t,sourcePosition:a,targetX:o,targetY:l,targetPosition:s});return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(i.u5,{path:m,markerEnd:d,style:{...h,...c}})})}var en=t(67907),et=t(74796),er=t(79315),ei=t(58909),eo=t(2593),el=t(55344),ea=t(1726),es=t(83622),ec=t(21801),ed=t(29731),eu=t(18974);function mergeKeys(e,n){let t=[...e],r=[...n],i=[];for(;t.length>0&&r.length>0;)if(i.includes(t[0]))t.shift();else if(i.includes(r[0]))r.shift();else if(t[0]===r[0])i.push(t[0]),t.shift(),r.shift();else if(r.includes(t[0])){let e=r.indexOf(t[0]);for(let n=0;n{i.includes(e)||i.push(e)}),r.forEach(e=>{i.includes(e)||i.push(e)}),i}function mergeKeysWithStatus(e,n){let t=mergeKeys(e,n),r={};for(let i of t)e.includes(i)?n.includes(i)?r[i]=void 0:r[i]="removed":r[i]="added";let i={};e.forEach((e,n)=>{i[e]=n});let o=-1;for(let e of t){let n=i[e];void 0!==n&&(n>o?o=n:r[e]="reordered")}return r}function mergeColumns(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={},r=mergeKeysWithStatus(Object.keys(e),Object.keys(n));return Object.entries(r).forEach(e=>{let[n,r]=e;t[n]={name:n,reordered:"reordered"===r}}),Object.entries(e).map((e,n)=>{let[r,i]=e;t[r].baseIndex=n+1,t[r].baseType=i.type}),Object.entries(n).map((e,n)=>{let[r,i]=e;t[r].currentIndex=n+1,t[r].currentType=i.type}),t}function toDataGrid(e){function columnIndexCellClass(e){return void 0===e.baseIndex?"column-index-added":void 0===e.currentIndex?"column-index-removed":!0===e.reordered?"column-index-reordered":"column-index-normal"}function columnNameCellClass(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":!0===e.reordered?"column-body-reordered":"column-body-normal"}function columnTypeCellClass(e){return void 0===e.baseIndex?"column-body-added":void 0===e.currentIndex?"column-body-removed":e.baseType!==e.currentType?"column-body-type-changed":!0===e.reordered?"column-body-reordered":"column-body-normal"}let n=Object.values(e);return{columns:[{key:"baseIndex",name:"",resizable:!0,minWidth:35,cellClass:columnIndexCellClass},{key:"currentIndex",name:"",resizable:!0,minWidth:35,cellClass:columnIndexCellClass},{key:"name",name:"Name",resizable:!0,cellClass:columnNameCellClass},{key:"baseType",name:"Base Type",resizable:!0,cellClass:columnTypeCellClass},{key:"currentType",name:"Current Type",resizable:!0,cellClass:columnTypeCellClass}],rows:n}}t(75165),t(91702);var eh=t(93683),em=t(7873),ex=t(52116),ef=t(47367),eg=t(55201),ep=t.n(eg),ey=t(15550);function useClipBoardToast(){let e=(0,ey.p)();return{successToast:function(n){e({description:n,status:"info",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})},failToast:function(n,t){e({title:n,description:"".concat(t),status:"error",variant:"left-accent",position:"bottom",duration:5e3,isClosable:!0})}}}let ev="ignore-screenshot";function useToBlob(e){let{imageType:n="png",backgroundColor:t=null,boardEffect:r=!0,shadowEffect:i=!1,borderStyle:o="solid 1px #ccc",borderRadius:l="10px",onSuccess:a,onError:s,ignoreElements:c}=e,[d,u]=(0,w.useState)("idle"),h=(0,w.useRef)(null),toImage=async()=>{if(!h.current){console.error("No node to use for screenshot"),u("error"),s&&s(Error("No node to use for screenshot"));return}let e=h.current.element||h.current,d=e.style.overflow,m=e.style.border,x=e.style.borderRadius,f=e.style.backgroundColor;function resetStyles(){e.style.overflow=d,e.style.border=m,e.style.borderRadius=x,e.style.backgroundColor=f}try{var g;e.style.overflow="hidden",e.style.border=r?o:"",e.style.borderRadius=r?l:"",e.style.backgroundColor=t||"";let d=document.createElement("style");document.head.appendChild(d),null===(g=d.sheet)||void 0===g||g.insertRule("body > div:last-child img { display: inline-block; }"),u("loading");let h=await ep()(e,{logging:!1,backgroundColor:null,ignoreElements:c});d.remove();let m=i?document.createElement("canvas"):h;if(i){m.width=h.width+80,m.height=h.height+80;let e=m.getContext("2d");if(e)e.shadowColor="rgba(0, 0, 0, 0.5)",e.shadowBlur=20,e.shadowOffsetX=10,e.shadowOffsetY=10,e.drawImage(h,40,40);else{console.error("Error getting canvas context"),u("error"),s&&s(Error("Error getting canvas context to add shadow effect"));return}}m.toBlob(async e=>{u("success"),a&&e&&await a(e)},"image/".concat(n))}catch(e){console.error("Error converting to image",e),u("error"),s&&s(e);return}finally{resetStyles()}};return{status:d,isLoading:"loading"===d,isErrored:"error"===d,isSuccess:"success"===d,toImage,ref:h}}async function copyBlobToClipboard(e){if(!e)throw Error("No blob to copy to clipboard");try{await navigator.clipboard.write([new ClipboardItem({[e.type]:e})])}catch(e){throw console.error("Error copying to clipboard",e),e}}function useCopyToClipboardButton(e){let{successToast:n,failToast:t}=useClipBoardToast(),{isLoading:i,toImage:o,ref:l}=useToBlob({imageType:"png",shadowEffect:!0,backgroundColor:(null==e?void 0:e.backgroundColor)||null,onSuccess:async e=>{try{await copyBlobToClipboard(e),n("Copied the query result as an image to clipboard")}catch(e){t("Failed to copy image to clipboard",e)}},onError:e=>{console.error("Error taking screenshot",e),t("Failed to copy image to clipboard",e)}});function CopyToClipboardButton(e){let{imageType:n="png",...t}=e;return(0,r.jsx)(m.z,{size:"sm",leftIcon:(0,r.jsx)(ef.T,{}),style:{position:"absolute",bottom:"16px",right:"16px"},isLoading:i,onMouseEnter:()=>{if(l.current){let e=l.current.element||l.current;e.style.boxShadow="rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px",e.style.transition="box-shadow 0.5s ease-in-out"}},onMouseLeave:()=>{if(l.current){let e=l.current.element||l.current;e.style.boxShadow=""}},onClick:async()=>{l.current&&await o()},children:"Copy to Clipboard"})}return{ref:l,CopyToClipboardButton}}function ScreenshotDataGrid(e){let{enableScreenshot:n=!0,...t}=e,{ref:i,CopyToClipboardButton:o}=useCopyToClipboardButton();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ex.ZP,{ref:i,...t}),n&&(0,r.jsx)(o,{imageType:"png"})]})}var ej=t(99691);async function getLineage(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=await G.get("/api/lineage?base=".concat(e));return n.data}async function getLineageWithError(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{let n=await getLineage(e);return{data:n}}catch(e){if(!(e instanceof ej.d7))return{error:null==e?void 0:e.message};{var n,t;let r=null==e?void 0:null===(t=e.response)||void 0===t?void 0:null===(n=t.data)||void 0===n?void 0:n.detail;if(r)return{error:r};return{error:null==e?void 0:e.message}}}}async function getLineageDiff(){let[e,n]=await Promise.all([getLineageWithError(!0),getLineageWithError(!1)]);return{base:e.data,current:n.data,base_error:e.error,current_error:n.error}}var eC=t(21123),eb=t.n(eC);let ek=(0,w.createContext)({});function LineageWatcher(e){let{refetch:n}=e,t=(0,ey.p)(),[i,o]=(0,w.useState)(),l=(0,q.NL)();return(0,w.useEffect)(()=>{function httpUrlToWebSocketUrl(e){return e.replace(/(http)(s)?\:\/\//,"ws$2://")}let e=new WebSocket("".concat(httpUrlToWebSocketUrl(W),"/api/ws"));return o(e),e.onopen=()=>{e.send("ping")},e.onmessage=e=>{if("pong"!==e.data)try{let n=JSON.parse(e.data);if("refresh"===n.command){let{eventType:e,srcPath:r}=n.event,[i,o]=r.split("/").slice(-2),a=eb().parse(o).name;t({description:"Detected ".concat(i," ").concat(a," ").concat(e),status:"info",variant:"left-accent",position:"bottom-right",duration:5e3,isClosable:!0}),l.invalidateQueries({queryKey:J.lineage()})}}catch(e){console.error(e)}},()=>{e&&e.close()}},[t,l]),(0,r.jsx)(r.Fragment,{})}function LineageGraphsContextProvider(e){let{children:n}=e,{data:t,isLoading:i,error:o,refetch:l}=(0,$.a)({queryKey:J.lineage(),queryFn:getLineageDiff}),a=(0,w.useMemo)(()=>{if(t)return buildDefaultLineageGraphSets(t.base,t.current)},[t]),s=(null==o?void 0:o.message)||(null==t?void 0:t.current_error)||(null==t?void 0:t.base_error);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(LineageWatcher,{refetch:l}),(0,r.jsx)(ek.Provider,{value:{lineageGraphSets:a,metadata:null==t?void 0:t.current.metadata,error:s,isLoading:i},children:n})]})}let useLineageGraphsContext=()=>(0,w.useContext)(ek);function SchemaView(e){let n,t,{base:i,current:o,enableScreenshot:l=!1}=e,{columns:s,rows:c}=(0,w.useMemo)(()=>toDataGrid(mergeColumns(null==i?void 0:i.columns,null==o?void 0:o.columns)),[i,o]),{lineageGraphSets:d}=useLineageGraphsContext(),u=(null==d?void 0:d.catalogExistence.base)===!1,h=(null==d?void 0:d.catalogExistence.current)===!1;u&&h?n="catalog.json is missing on both current and base environments.":u?n="catalog.json is missing on base environment.":h&&(n="catalog.json is missing on current environment.");let m=i&&void 0===i.columns,x=o&&void 0===o.columns;return m&&x?t="Schema information is missing on both current and base environments.":m?t="Schema information is missing on base environment.":x&&(t="Schema information is missing on current environment."),(0,r.jsxs)(a.k,{direction:"column",children:[n?(0,r.jsxs)(eh.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,r.jsx)(em.z,{}),n]}):t?(0,r.jsxs)(eh.b,{status:"warning",fontSize:"12px",p:"8px",children:[(0,r.jsx)(em.z,{}),t]}):(0,r.jsx)(r.Fragment,{}),c.length>0&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:s,rows:c,className:"rdg-light",enableScreenshot:l})})]})}var ew=t(29357);function SqlDiffView(e){let{base:n,current:t}=e;return(0,r.jsx)(ew.SV,{height:"500px",language:"sql",theme:"vs",original:null==n?void 0:n.raw_code,modified:null==t?void 0:t.raw_code,options:{readOnly:!0,fontSize:14,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"same"}})}var eS=t(32865);async function createSimpleCheck(){let e=await G.post("/api/checks",{type:"simple"}),n=e.data;return n}async function createLineageDiffCheck(e,n){let t=await G.post("/api/checks",{type:"lineage_diff",params:{view_mode:e,node_ids:n}}),r=t.data;return r}async function createCheckByNodeSchema(e){let n=await G.post("/api/checks",{type:"schema_diff",params:{node_id:e}}),t=n.data;return t}async function createCheckByRun(e,n){let t=await G.post("/api/checks",{run_id:e,view_options:n}),r=t.data;return r}async function listChecks(){let e=await G.get("/api/checks");return e.data}async function getCheck(e){let n=await G.get("/api/checks/".concat(e));return n.data}async function updateCheck(e,n){let t=await G.patch("/api/checks/".concat(e),n);return t.data}async function deleteCheck(e){let n=await G.delete("/api/checks/".concat(e));return n.data}async function reorderChecks(e){return await G.post("/api/checks/reorder",e)}var e_=t(78448),eR=t(93573);function ColumnNameCell(e){let{params:n,column:t,containerRef:i}=e,{runAction:l}=useRecceActionContext(),handleValueDiffDetail=(e,t)=>{let r={...n,...e};l("value_diff_detail",r,t)};return(0,r.jsxs)(a.k,{children:[(0,r.jsx)(o.xu,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t}),(0,r.jsx)(N.L,{}),(0,r.jsx)(C.v,{children:e=>{let{isOpen:n}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eu.j,{className:"row-context-menu",visibility:n?"visible":"hidden",width:n?"auto":"0px",minWidth:n?"auto":"0px",as:P.h,icon:(0,r.jsx)(s.J,{as:E.D_A}),variant:"unstyled",size:"sm"}),(0,r.jsx)(e_.h,{containerRef:i,children:(0,r.jsx)(b.q,{lineHeight:"20px",children:(0,r.jsxs)(eR.k,{title:"Action",as:o.xu,fontSize:"8pt",children:[(0,r.jsx)(k.s,{fontSize:"10pt",onClick:()=>handleValueDiffDetail({},{showForm:!0}),children:"Show mismatched values..."}),(0,r.jsxs)(k.s,{fontSize:"10pt",onClick:()=>handleValueDiffDetail({columns:[t]},{showForm:!1}),children:["Show mismatched values for '",t,"'"]})]})})})]})}})]})}function ValueDiffResultView(e){let{run:n}=e,t=n.result,i=n.params,cellClass=e=>{let n=e[2];return null!=n&&n<1?"diff-cell-modified":""},l=(0,w.useRef)(),c=[{key:"__is_pk__",name:"",maxWidth:30,renderCell:e=>{let{row:n}=e;return(0,r.jsx)(u.M,{height:"100%",children:n[0]===i.primary_key&&(0,r.jsx)(s.J,{as:E.MhP})})}},{key:"0",name:"Column",resizable:!0,renderCell:e=>{let{row:n,column:t}=e;return(0,r.jsx)(ColumnNameCell,{column:n[t.key],params:i,containerRef:l})},cellClass:"cell-show-context-menu"},{key:"1",name:"Matched",resizable:!0,cellClass},{key:"2",name:"Matched %",resizable:!0,renderCell:e=>{let{column:n,row:t}=e,i=t[n.key];return(0,r.jsx)(o.xu,{textAlign:"end",children:void 0!=i&&null!==i?"".concat((100*i).toFixed(2)," %"):"N/A"})},cellClass}];return(0,r.jsxs)(a.k,{direction:"column",gap:"5px",pt:"5px",height:"100%",ref:l,children:[(0,r.jsxs)(o.xu,{px:"16px",children:["Model: ",i.model,", ",t.summary.total," total (",t.summary.total-t.summary.added-t.summary.removed," ","common, ",t.summary.added," added, ",t.summary.removed," removed)"]}),(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",borderBlock:"1px solid lightgray"},columns:c,rows:t.data.data,defaultColumnOptions:{resizable:!0},className:"rdg-light",enableScreenshot:!0})]})}var eT=t(41171),eD=t(53930),eN=t(25535),eE=t(51348),eI=t(11546),eL=t(83978),eM=t.n(eL);function extractColumns(e){function getColumns(e){return e&&e.columns?Object.values(e.columns):[]}let n=getColumns(e.data.base),t=getColumns(e.data.current),r=[];return n.forEach(e=>{r.some(n=>n.name===e.name)||r.push(e)}),t.forEach(e=>{r.some(n=>n.name===e.name)||r.push(e)}),r}function extractColumnNames(e){function getNames(e){return e&&e.columns?Object.values(e.columns).map(e=>e.name):[]}let n=getNames(e.data.base),t=getNames(e.data.current),r=[];return n.forEach(e=>{r.includes(e)||r.push(e)}),t.forEach(e=>{r.includes(e)||r.push(e)}),r}function ValueDiffForm(e){var n;let{params:t,onParamsChanged:i,setIsReadyToExecute:o}=e,l=useLineageGraphsContext(),[a,s]=(0,w.useState)(!t.columns||0===t.columns.length);(0,w.useEffect)(()=>{let e=!0;t.primary_key&&(a||t.columns&&0!==t.columns.length)||(e=!1),o(e)},[t,o,a]);let c=eM().find(null===(n=l.lineageGraphSets)||void 0===n?void 0:n.all.nodes,{name:null==t?void 0:t.model}),d=c?extractColumnNames(c):[];return(0,r.jsxs)(h.g,{gap:5,m:"8px 24px",paddingBottom:"200px",children:[(0,r.jsxs)(eT.NI,{children:[(0,r.jsx)(eD.l,{children:"Model"}),(0,r.jsx)(eN.I,{isReadOnly:!0,value:null==t?void 0:t.model})]}),(0,r.jsxs)(eT.NI,{children:[(0,r.jsx)(eD.l,{children:"Primary key"}),(0,r.jsx)(eI.Z,{placeholder:"Select primary key",value:(null==t?void 0:t.primary_key)&&(null==t?void 0:t.primary_key)!==""?{label:null==t?void 0:t.primary_key,value:null==t?void 0:t.primary_key}:void 0,options:(d||[]).map(e=>({label:e,value:e})),onChange:e=>{s(!0),i({...t,primary_key:(null==e?void 0:e.value)||"",columns:void 0})}})]}),(0,r.jsxs)(eT.NI,{children:[(0,r.jsx)(eD.l,{children:"Columns"}),(0,r.jsx)(eE.X,{marginBottom:"10px",isChecked:a,onChange:e=>{s(e.target.checked),i({...t,columns:void 0})},children:"All columns"}),!a&&(0,r.jsx)(eI.Z,{isMulti:!0,closeMenuOnSelect:!1,options:(d||[]).map(e=>({label:e,value:e})),value:(t.columns||[]).map(e=>({label:e,value:e})),onChange:e=>{i({...t,columns:(e||[]).map(e=>e.value)})}})]})]})}function _getColumnMap(e,n){let t={},r=mergeKeysWithStatus(e.columns.map(e=>e.name),n.columns.map(e=>e.name));return Object.entries(r).map(r=>{let[i,o]=r;t[i]={status:o,baseColumnIndex:e.columns.findIndex(e=>e.name===i),currentColumnIndex:n.columns.findIndex(e=>e.name===i)}}),t}function _getPrimaryKeyIndexes(e,n){let t=[];for(let r of n){let n=e.findIndex(e=>e.name===r);if(n<0)throw Error("Column ".concat(r," not found"));t.push(n)}return t}function _getPrimaryKeyValue(e,n,t){let r={};if(0===n.length)return JSON.stringify({_index:t._index});for(let i of n){let n=e[i];r[n.name]=t[i]}return JSON.stringify(r)}function DataFrameColumnGroupHeader(e){let{name:n,columnStatus:t,onPrimaryKeyChange:i,onPinnedColumnsChange:l,...c}=e,d=c.primaryKeys||[],u=c.pinnedColumns||[],h=d.includes(n),m=u.includes(n);return"index"===n?(0,r.jsx)(r.Fragment,{}):(0,r.jsxs)(a.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,r.jsx)(o.xu,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),"added"!==t&&"removed"!==t&&i&&(0,r.jsx)(s.J,{className:h?"close-icon":"key-icon",display:h?"block":"none",cursor:"pointer",as:h?E.ven:E.MhP,onClick:h?()=>{let e=d.filter(e=>e!==n);i&&i(e)}:()=>{let e=[...d.filter(e=>"index"!==e),n];i&&i(e)}}),!h&&l&&(0,r.jsx)(s.J,{className:m?"unpin-icon":"pin-icon",display:m?"block":"none",cursor:"pointer",as:m?E.$kI:E.oJP,onClick:m?()=>{let e=u.filter(e=>e!==n);l&&l(e)}:()=>{let e=[...u,n];l&&l(e)}})]})}t(7866);let defaultRenderCell=e=>{let{row:n,column:t}=e,i=n[t.key];return(0,r.jsx)(r.Fragment,{children:"boolean"==typeof i?i.toString():i})};function toDataDiffGrid(e,n,t){let i=e||{columns:[],data:[]},o=n||{columns:[],data:[]},l=(null==t?void 0:t.primaryKeys)||[],a=(null==t?void 0:t.pinnedColumns)||[],s=(null==t?void 0:t.changedOnly)||!1,c=[],d=_getColumnMap(i,o),u={},h={},m=!1,x=!1;if(0===l.length)i.data.forEach((e,n)=>{e._index=n+1,u[JSON.stringify({_index:n+1})]=e}),o.data.forEach((e,n)=>{e._index=n+1,h[JSON.stringify({_index:n+1})]=e});else{let e=_getPrimaryKeyIndexes(i.columns,l);i.data.forEach((n,t)=>{let r=_getPrimaryKeyValue(i.columns,e,n);r in u&&(m=!0),u[r]=n}),e=_getPrimaryKeyIndexes(o.columns,l),o.data.forEach((n,t)=>{let r=_getPrimaryKeyValue(o.columns,e,n);r in h&&(x=!0),h[r]=n})}let f=mergeKeysWithStatus(Object.keys(u),Object.keys(h)),g=Object.entries(f).map(e=>{let[n,t]=e,r=u[n],a=h[n],s=JSON.parse(n);if(r&&i.columns.forEach((e,n)=>{l.includes(e.name)||(s["base__".concat(e.name)]=r[n])}),a&&o.columns.forEach((e,n)=>{l.includes(e.name)||(s["current__".concat(e.name)]=a[n])}),r){if(a)for(let[e,n]of Object.entries(d))"index"===e||l.includes(e)||n.baseColumnIndex<0||n.currentColumnIndex<0||eM().isEqual(r[n.baseColumnIndex],a[n.currentColumnIndex])||(s.status="modified",n.status="modified");else s.status="removed"}else s.status="added";return s});s&&(g=g.filter(e=>"added"===e.status||"removed"===e.status||"modified"===e.status));let toColumn=(e,n)=>{let i="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,cellClass=t=>{let r=t.status;if("removed"===r)return"diff-cell-removed";if("added"===r)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!eM().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:i,name:(0,r.jsx)(DataFrameColumnGroupHeader,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:ex.Ug,headerCellClass:i,cellClass,renderCell:defaultRenderCell,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:ex.Ug,headerCellClass:i,cellClass,renderCell:defaultRenderCell,size:"auto"}]}};return 0===l.length?c.push({key:"_index",name:"",cellClass:"index-column"}):l.forEach(e=>{let n=d[e].status||"";c.push({key:"".concat(e),name:(0,r.jsx)(DataFrameColumnGroupHeader,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.status)return"diff-header-".concat(e.status)}})}),a.forEach(e=>{let n=d[e].status||"";"index"===e||l.includes(e)||c.push(toColumn(e,n))}),Object.entries(d).forEach(e=>{let[n,t]=e,r=t.status||"";"index"===n||l.includes(n)||a.includes(n)||s&&"added"!==r&&"removed"!==r&&"modified"!==r||c.push(toColumn(n,r))}),{columns:c,rows:g,invalidPKeyBase:m,invalidPKeyCurrent:x}}function ProfileDiffResultView(e){var n;let{run:t,viewOptions:i,onViewOptionsChanged:o}=e,l=t.result;t.params;let a=(0,w.useMemo)(()=>(null==i?void 0:i.pinned_columns)||[],[i]),s=((null==l?void 0:null===(n=l.current)||void 0===n?void 0:n.columns)||[]).find(e=>"column_name"===e.name.toLowerCase()),c=(null==s?void 0:s.name)||"column_name",d=(0,w.useMemo)(()=>toDataDiffGrid(null==l?void 0:l.base,null==l?void 0:l.current,{primaryKeys:[c],pinnedColumns:a,onPinnedColumnsChange:e=>{o&&o({...i,pinned_columns:e})}}),[l,c,a,i,o]);return 0===d.columns.length?(0,r.jsx)(u.M,{height:"100%",children:"No data"}):(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:d.columns,rows:d.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})})}var eF=t(84680),eO=t(70556),eA=t(46016);let RunView=e=>{var n,t;let{isPending:i,isAborting:l,progress:s,error:c,run:d,onCancel:x,viewOptions:f,onViewOptionsChanged:g,RunResultView:p,children:y}=e;if(y&&p)throw Error("RunView requires either a children or a RunResultView prop, but not both.");if(!y&&!p)throw Error("RunView requires at least one of children or RunResultView prop.");let v=(null==c?void 0:null===(t=c.response)||void 0===t?void 0:null===(n=t.data)||void 0===n?void 0:n.detail)||(null==d?void 0:d.error);if(v)return(0,r.jsxs)(eh.b,{status:"error",children:[(0,r.jsx)(em.z,{}),"Error: ",v]});if(i){let e=(null==s?void 0:s.message)?null==s?void 0:s.message:"Loading...";return(0,r.jsx)(u.M,{p:"16px",height:"100%",bg:"rgb(249,249,249)",children:(0,r.jsxs)(h.g,{children:[(0,r.jsxs)(a.k,{alignItems:"center",children:[(null==s?void 0:s.percentage)===void 0||(null==s?void 0:s.percentage)===null?(0,r.jsx)(eA.D,{isIndeterminate:!0,size:"20px",mr:"8px"}):(0,r.jsx)(eA.D,{size:"20px",value:100*s.percentage,mr:"8px"}),l?(0,r.jsx)(r.Fragment,{children:"Aborting..."}):(0,r.jsx)(r.Fragment,{children:e})]}),!l&&(0,r.jsx)(m.z,{onClick:x,colorScheme:"blue",size:"sm",children:"Cancel"})]})})}return d?(0,r.jsxs)(o.xu,{h:"100%",style:{contain:"size layout"},overflow:"auto",children:[p&&(0,r.jsx)(p,{run:d,viewOptions:f,onViewOptionsChanged:g}),y&&y({run:d,viewOptions:f,onViewOptionsChanged:g})]}):(0,r.jsx)(u.M,{bg:"rgb(249,249,249)",height:"100%",children:"No data"})},RunModal=e=>{let{isOpen:n,onClose:t,type:i,title:l,params:s,RunForm:c,RunResultView:d}=e,[,u]=(0,eS.TH)(),[h,x]=(0,w.useState)(),[f,C]=(0,w.useState)(s),[b,k]=(0,w.useState)(!1),[S,_]=(0,w.useState)(!1),[R,T]=(0,w.useState)(),[D,N]=(0,w.useState)(),submitRunFn=async()=>{let{run_id:e}=await submitRun(i,f,{nowait:!0});for(x(e);;){let n=await waitRun(e,2);if(T(n.progress),n.result||n.error)return k(!1),T(void 0),n}},{data:E,mutate:I,reset:L,error:M,isPending:F}=(0,eO.D)({mutationFn:submitRunFn});(0,w.useEffect)(()=>{n&&void 0===c&&I()},[n]);let O=(0,q.NL)(),A=(0,w.useCallback)(async()=>{if(k(!0),h)return await cancelRun(h)},[h]),z=(0,w.useCallback)(()=>{I()},[I]),P=(0,w.useCallback)(()=>{I()},[I]),handleReset=()=>{k(!1),C(s),T(void 0),L()},V=(0,w.useCallback)(async()=>{if(!(null==E?void 0:E.run_id))return;let e=await createCheckByRun(E.run_id,D);O.invalidateQueries({queryKey:J.checks()}),u("/checks/".concat(e.check_id))},[null==E?void 0:E.run_id,u,O,D]),handleClose=async()=>{t(),F&&h&&await cancelRun(h),handleReset()};return(0,r.jsxs)(g.u_,{isOpen:n,onClose:handleClose,size:"6xl",scrollBehavior:"inside",children:[(0,r.jsx)(p.Z,{}),(0,r.jsxs)(y.h,{overflowY:"auto",height:"75%",children:[(0,r.jsx)(ei.x,{children:l}),(0,r.jsx)(v.o,{}),(0,r.jsx)(j.f,{p:"0px",h:"100%",overflow:"auto",borderY:"1px solid lightgray",children:F||E||M?(0,r.jsx)(RunView,{isPending:F,isAborting:b,run:E,error:M,progress:R,onCancel:A,viewOptions:D,onViewOptionsChanged:N,RunResultView:d}):(0,r.jsx)(o.xu,{style:{contain:"layout"},children:c&&(0,r.jsx)(c,{params:f,onParamsChanged:C,setIsReadyToExecute:_})})}),(0,r.jsx)(eF.m,{children:(0,r.jsxs)(a.k,{gap:"10px",children:[E&&c&&(0,r.jsx)(m.z,{colorScheme:"blue",onClick:handleReset,children:"Reset"}),(null==E?void 0:E.result)&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(m.z,{colorScheme:"blue",onClick:V,children:"Add to checklist"})}),F&&(0,r.jsx)(m.z,{onClick:A,isDisabled:b,colorScheme:"blue",children:"Cancel"}),!E&&!F&&(0,r.jsx)(m.z,{isDisabled:F||!S,colorScheme:"blue",onClick:z,children:"Execute"}),E&&!c&&(0,r.jsx)(m.z,{colorScheme:"blue",onClick:P,children:"Rerun"})]})})]})]})};var ez=t(49294),eP=t(99986);function valuediff_getColumnMap(e){let n={};return e.columns.map((e,t)=>{n[e.name]={index:t}}),n}function valuediff_getPrimaryKeyIndexes(e,n){let t=[];for(let r of n){let n=e.findIndex(e=>e.name===r);if(n<0)throw Error("Column ".concat(r," not found"));t.push(n)}return t}function valuediff_getPrimaryKeyValue(e,n,t){let r={};if(0===n.length)return JSON.stringify({_index:t._index});for(let i of n){let n=e[i];r[n.name]=t[i]}return JSON.stringify(r)}function valuediff_DataFrameColumnGroupHeader(e){let{name:n,columnStatus:t,onPrimaryKeyChange:i,onPinnedColumnsChange:l,...c}=e,d=c.primaryKeys||[],u=c.pinnedColumns||[],h=d.includes(n),m=u.includes(n);return"index"===n?(0,r.jsx)(r.Fragment,{}):(0,r.jsxs)(a.k,{alignItems:"center",gap:"10px",className:"grid-header",children:[(0,r.jsx)(o.xu,{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:n}),!h&&l&&(0,r.jsx)(s.J,{className:m?"unpin-icon":"pin-icon",display:m?"block":"none",cursor:"pointer",as:m?E.$kI:E.oJP,onClick:m?()=>{let e=u.filter(e=>e!==n);l&&l(e)}:()=>{let e=[...u,n];l&&l(e)}})]})}let valuediff_defaultRenderCell=e=>{let{row:n,column:t}=e,i=n[t.key];return(0,r.jsx)(r.Fragment,{children:"boolean"==typeof i?i.toString():i})};function toValueDiffGrid(e,n,t){let i=(null==t?void 0:t.pinnedColumns)||[],o=(null==t?void 0:t.changedOnly)||!1,l=[],a=valuediff_getColumnMap(e),s={},c={};if(0===n.length)throw Error("Primary keys are required");let d=valuediff_getPrimaryKeyIndexes(e.columns,n),u=(a.in_a||a.IN_A).index,h=(a.in_b||a.IN_B).index;e.data.forEach((n,t)=>{let r=valuediff_getPrimaryKeyValue(e.columns,d,n);n[u]&&(s[r]=n),n[h]&&(c[r]=n)});let m=mergeKeysWithStatus(Object.keys(s),Object.keys(c)),x=Object.entries(m).map(t=>{let[r,i]=t,o=s[r],l=c[r],d=JSON.parse(r);if(o&&e.columns.forEach((e,t)=>{n.includes(e.name)||(d["base__".concat(e.name)]=o[t])}),l&&e.columns.forEach((e,t)=>{n.includes(e.name)||(d["current__".concat(e.name)]=l[t])}),o){if(l)for(let[e,t]of Object.entries(a))!("index"===e||n.includes(e))&&(eM().isEqual(o[t.index],l[t.index])||(d.status="modified",t.status="modified"));else d.status="removed"}else d.status="added";return d});o&&(x=x.filter(e=>"added"===e.status||"removed"===e.status||"modified"===e.status));let toColumn=(e,n)=>{let i="added"===n?"diff-header-added":"removed"===n?"diff-header-removed":void 0,cellClass=t=>{let r=t.status;if("removed"===r)return"diff-cell-removed";if("added"===r)return"diff-cell-added";if("added"===n);else if("removed"===n);else if(!eM().isEqual(t["base__".concat(e)],t["current__".concat(e)]))return"diff-cell-modified"};return{headerCellClass:i,name:(0,r.jsx)(valuediff_DataFrameColumnGroupHeader,{name:e,columnStatus:n,...t}),children:[{key:"base__".concat(e),name:"Base",renderEditCell:ex.Ug,headerCellClass:i,cellClass,renderCell:valuediff_defaultRenderCell,size:"auto"},{key:"current__".concat(e),name:"Current",renderEditCell:ex.Ug,headerCellClass:i,cellClass,renderCell:valuediff_defaultRenderCell,size:"auto"}]}};return n.forEach(e=>{let n=a[e].status||"";l.push({key:"".concat(e),name:(0,r.jsx)(valuediff_DataFrameColumnGroupHeader,{name:e,columnStatus:n,...t}),frozen:!0,cellClass:e=>{if(e.status)return"diff-header-".concat(e.status)}})}),i.forEach(e=>{let t=a[e].status||"";n.includes(e)||l.push(toColumn(e,t))}),Object.entries(a).forEach(e=>{let[t,r]=e,a=r.status||"";"in_a"===t||"in_b"===t||n.includes(t)||i.includes(t)||o&&"added"!==a&&"removed"!==a&&"modified"!==a||l.push(toColumn(t,a))}),{columns:l,rows:x}}let ValueDiffDetailResultView=e=>{var n,t;let{run:i,onAddToChecklist:s,viewOptions:c,onViewOptionsChanged:d}=e,h=(0,w.useMemo)(()=>(null==c?void 0:c.changed_only)||!1,[c]),m=(0,w.useMemo)(()=>(null==c?void 0:c.pinned_columns)||[],[c]),x=(0,w.useMemo)(()=>{var e,n;if(!i.result)return{columns:[],rows:[]};let t=(null==i?void 0:null===(e=i.params)||void 0===e?void 0:e.primary_key)?[null==i?void 0:null===(n=i.params)||void 0===n?void 0:n.primary_key]:[];return toValueDiffGrid(null==i?void 0:i.result,t,{changedOnly:h,pinnedColumns:m,onPinnedColumnsChange:e=>{d&&d({...c,pinned_columns:e})}})},[i,c,h,m,d]);if(0===x.columns.length)return(0,r.jsx)(u.M,{height:"100%",children:"No data"});if(h&&0===x.rows.length)return(0,r.jsx)(u.M,{height:"100%",children:"No change"});let f=(null===(n=i.result)||void 0===n?void 0:n.limit)||0,g=f>0&&(null==i?void 0:null===(t=i.result)||void 0===t?void 0:t.more)?"Warning: Displayed results are limited to ".concat(f.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null;return(0,r.jsxs)(a.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,r.jsxs)(a.k,{borderBottom:"1px solid lightgray",justifyContent:"flex-end",gap:"5px",alignItems:"center",px:"10px",bg:g?"orange.100":"inherit",children:[g&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ez.a,{color:"orange.600"})," ",(0,r.jsx)(o.xu,{children:g})]}),(0,r.jsx)(N.L,{minHeight:"32px"}),(0,r.jsx)(eE.X,{isChecked:null==c?void 0:c.changed_only,onChange:()=>{let e=!(null==c?void 0:c.changed_only);d&&d({...c,changed_only:e})},children:"Changed only"}),s&&(0,r.jsx)(l.u,{label:"Add to Checklist",children:(0,r.jsx)(P.h,{variant:"unstyled",size:"sm","aria-label":"Add",icon:(0,r.jsx)(eP.d,{}),onClick:()=>s(i)})})]}),(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:x.columns,rows:x.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})};var eV=t(17180),eB=t(34030);function formatNumber(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US",t=arguments.length>2?arguments[2]:void 0;return"number"!=typeof e?e:new Intl.NumberFormat(n,t).format(e)}function formatIntervalMinMax(e){let n=e>0&&e<=.001,t=e<1&&e>=.999,formatter=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return formatNumber(n,"en-US",{style:"percent",minimumFractionDigits:1})};if(n){let e=formatter(.001);return"<".concat(e)}if(t){let e=formatter(.999);return">".concat(e)}return formatter()}function formatAsAbbreviatedNumber(e){if("number"!=typeof e)return e;{let n=Math.abs(e),t=n>=.01,r=n>=1e6,i=n>=1e9,o=n>=1e15;if(o||n>=1e12)return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:o?0:2}).format(e/1e12).replace("L","T");if(i||r||n>=1e3){let n={base:i?1e9:r?1e6:1e3,unit:i?"B":r?"M":"K"};return new Intl.NumberFormat("en-US",{style:"unit",unit:"liter",unitDisplay:"narrow",maximumFractionDigits:1}).format(e/n.base).replace("L",n.unit)}return n>=1?new Intl.NumberFormat("en-US",{maximumFractionDigits:2}).format(e):new Intl.NumberFormat("en-US",{maximumFractionDigits:t?3:2,notation:t||0===n?"standard":"scientific"}).format(e)}}var eq=t(85670),eH=t(84021);function TopKSummaryList(e){let{topk:n,valids:t,isDisplayTopTen:i}=e,s=i?10:n.counts.length,c=n.counts.slice(0,s),d=t-c.reduce((e,n)=>e+n,0);return(0,r.jsx)(o.xu,{w:"100%",children:c.concat([d]).map((e,i)=>{let o=i===c.length,s=o?d:e,u=String(n.values[i]),h=o?"(others)":u||"(empty)",m=formatAsAbbreviatedNumber(s),x=formatIntervalMinMax(s/t);return(0,r.jsx)(w.Fragment,{children:!o||o&&s>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(a.k,{alignItems:"center",width:"100%",_hover:{bg:"blackAlpha.300"},px:3,children:[(0,r.jsx)(l.u,{label:h,placement:"start",children:(0,r.jsx)(f.x,{noOfLines:1,width:"14em",fontSize:"sm",color:o||0===u.length?"gray.400":"inherit",children:h})}),(0,r.jsx)(a.k,{height:"2em",width:"10em",children:(0,r.jsx)(CategoricalBarChart,{topkCount:s,topkLabel:h,valids:t})}),(0,r.jsx)(l.u,{label:m,placement:"start",children:(0,r.jsx)(f.x,{ml:5,mr:2,fontSize:"sm",width:"4em",noOfLines:1,children:m})}),(0,r.jsx)(l.u,{label:x,placement:"start",children:(0,r.jsx)(f.x,{color:"gray.400",fontSize:"sm",width:"4em",children:x})})]}),(0,r.jsx)(eV.i,{})]}):(0,r.jsx)(r.Fragment,{})},i)})})}function CategoricalBarChart(e){let{topkCount:n,topkLabel:t,valids:i,animation:o=!1}=e;eq.kL.register(eq.uw,eq.ZL,eq.f$);let l=getCatBarChartOptions(n,i,{animation:o}),a=getCatBarChartData({topkCount:n,topkLabel:t});return(0,r.jsx)(eH.$Q,{data:a,options:l,plugins:[]})}function getCatBarChartOptions(e,n){let{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{responsive:!0,maintainAspectRatio:!1,indexAxis:"y",scales:{x:{display:!1,max:n,grid:{display:!1}},y:{display:!1}},plugins:{tooltip:{enabled:!1}},...t}}function getCatBarChartData(e){let{topkLabel:n,topkCount:t}=e;return{labels:[n],datasets:[{indexAxis:"y",data:[t],backgroundColor:"#63B3ED",hoverBackgroundColor:"#002a53",borderWidth:1,borderColor:"#002a53",barPercentage:1,categoryPercentage:.6}]}}let ScreenshotBox=e=>{let{backgroundColor:n="white",blockSize:t,children:i,...l}=e,{ref:a,CopyToClipboardButton:s}=useCopyToClipboardButton({backgroundColor:n});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.xu,{ref:a,...l,overflow:"auto",children:(0,r.jsx)(o.xu,{backgroundColor:n,height:"100%",blockSize:t,children:i})}),(0,r.jsx)(s,{imageType:"png"})]})};function TopKDiffResultView(e){let{run:n}=e,[t,i]=(0,w.useState)(!0),l=n.result,s=n.params,c=l.base,d=l.current;return(0,r.jsxs)(a.k,{direction:"column",height:"100%",children:[(0,r.jsxs)(ScreenshotBox,{blockSize:"auto",children:[(0,r.jsxs)(er.X,{as:"h1",size:"md",paddingTop:4,textAlign:"center",children:["Model ",s.model,".",s.column_name]}),(0,r.jsxs)(x.U,{children:[(0,r.jsx)(N.L,{}),(0,r.jsxs)(o.xu,{children:[(0,r.jsx)(er.X,{as:"h3",size:"sm",m:"2",color:"gray",children:"Base"}),(0,r.jsx)(eV.i,{}),(0,r.jsx)(TopKSummaryList,{topk:c,valids:c.valids||0,isDisplayTopTen:t})]}),(0,r.jsxs)(o.xu,{children:[(0,r.jsx)(er.X,{as:"h3",size:"sm",m:"2",color:"gray",children:"Current"}),(0,r.jsx)(eV.i,{}),(0,r.jsx)(TopKSummaryList,{topk:d,valids:d.valids||0,isDisplayTopTen:t})]}),(0,r.jsx)(N.L,{})]})]}),(0,r.jsx)(N.L,{}),(c.values.length>10||d.values.length>10)&&(0,r.jsx)(a.k,{p:5,justify:"start",children:(0,r.jsx)(eB.r,{onClick:()=>i(e=>!e),textColor:"blue.500",children:t?"View More Items":"View Only Top-10"})})]})}var eK=t(68665);function TopKDiffForm(e){var n;let{params:t,onParamsChanged:i,setIsReadyToExecute:l}=e,a=useLineageGraphsContext(),s=eM().find(null===(n=a.lineageGraphSets)||void 0===n?void 0:n.all.nodes,{name:null==t?void 0:t.model}),c=s?extractColumnNames(s):[];return(0,w.useEffect)(()=>{l(!!t.column_name)},[t,l]),(0,r.jsx)(o.xu,{m:"16px",children:(0,r.jsxs)(eT.NI,{children:[(0,r.jsx)(eD.l,{children:"Pick a column to show top-k"}),(0,r.jsx)(eK.P,{placeholder:"Select column",value:null==t?void 0:t.column_name,onChange:e=>{let n=e.target.value;i({...t,column_name:n})},children:c.map(e=>(0,r.jsx)("option",{value:e,children:e},e))})]})})}function HistogramChart(e){let{data:n,hideAxis:t=!1,animation:i=!1}=e;eq.kL.register(eq.ZL,eq.RM,eq.f$,eq.uw,eq.u);let o=getHistogramChartOptions(n,t,{animation:i}),l=getHistogramChartData(n);return(0,r.jsx)(eH.kL,{type:"bar",options:o,data:l,plugins:[]})}function getHistogramChartData(e){let{histogram:n,type:t,binEdges:r}=e,{counts:i=[]}=n||{},o="datetime"===t?i.map((e,n)=>({x:r[n],y:e})):i,l=r.map((e,n)=>formatDisplayedBinItem(r,n)).slice(0,-1);return{labels:l,datasets:[{label:"counts",data:o,backgroundColor:"#63B3ED",borderColor:"#4299E1",hoverBackgroundColor:"#002A53",borderWidth:1,categoryPercentage:1,barPercentage:1,xAxisID:"x"}]}}function getHistogramChartOptions(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{...t}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{histogram:r,type:i,samples:o=0,binEdges:l}=e,{counts:a=[]}=r||{},s="datetime"===i;return{responsive:!0,maintainAspectRatio:!1,plugins:{tooltip:{mode:"index",position:"nearest",intersect:!1,callbacks:{title(e){let[{dataIndex:n}]=e,t=formatDisplayedBinItem(l,n),r=formatIntervalMinMax(a[n]/o);return"".concat(s?"Date Range":"string"===i?"Text Length":"Value Range","\n").concat(t,"\n(").concat(r,")")}}}},scales:getScales(e,n),...t}}function getScales(e){let{histogram:n,min:t=0,max:r=0,type:i,binEdges:o}=e,l=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{counts:a=[]}=n||{},s=o.map((e,n)=>formatDisplayedBinItem(o,n)).slice(0,-1);return{x:"datetime"===i?{display:!l,type:"timeseries",min:t,max:r,adapters:{date:{}},time:{minUnit:"day"},grid:{display:!1},ticks:{minRotation:30,maxRotation:30,maxTicksLimit:8}}:{display:!l,type:"category",grid:{display:!1},ticks:{callback:(e,n)=>s[n]}},y:{display:!l,type:"linear",max:Math.max(...a),border:{dash:[2,2]},grid:{color:"lightgray"},ticks:{maxTicksLimit:8,callback:function(e,n){return formatAsAbbreviatedNumber(e)}}}}}function formatDisplayedBinItem(e,n){let t=e[n],r=e[n+1],i=formatAsAbbreviatedNumber(t),o=formatAsAbbreviatedNumber(r),l="".concat(i," - ").concat(o);return l}function HistogramDiffResultView(e){var n,t,i,l,s,c,d;let{run:u}=e,h=u.params,m=null===(n=u.result)||void 0===n?void 0:n.base,f=null===(t=u.result)||void 0===t?void 0:t.current,g=null===(i=u.result)||void 0===i?void 0:i.min,p=null===(l=u.result)||void 0===l?void 0:l.max,y=null===(s=u.result)||void 0===s?void 0:s.bin_edges;return m&&f?(0,r.jsx)(a.k,{direction:"column",height:"500px",children:(0,r.jsxs)(ScreenshotBox,{height:"100%",children:[(0,r.jsxs)(er.X,{as:"h1",size:"md",paddingTop:"4",textAlign:"center",children:["Model ",h.model,".",h.column_name]}),(0,r.jsxs)(x.U,{children:[(0,r.jsx)(N.L,{}),(0,r.jsxs)(o.xu,{w:"40%",h:"300px",m:"4",children:[(0,r.jsx)(er.X,{as:"h3",size:"sm",m:"2",color:"gray",children:"Base"}),(0,r.jsx)(HistogramChart,{data:{type:(null===(c=u.params)||void 0===c?void 0:c.column_type)||"",histogram:m,min:g,max:p,samples:m.total,binEdges:y}})]}),(0,r.jsxs)(o.xu,{w:"40%",h:"300px",m:"4",children:[(0,r.jsx)(er.X,{as:"h3",size:"sm",m:"2",color:"gray",children:"Current"}),(0,r.jsx)(HistogramChart,{data:{type:(null===(d=u.params)||void 0===d?void 0:d.column_type)||"",histogram:f,min:g,max:p,samples:f.total,binEdges:y}})]}),(0,r.jsx)(N.L,{})]})]})}):(0,r.jsx)("div",{children:"Loading..."})}function isStringDataType(e){return["CHAR","VARCHAR","TINYTEXT","TEXT","MEDIUMTEXT","LONGTEXT","NCHAR","NVARCHAR","VARCHAR2","NVARCHAR2","CLOB","NCLOB","VARCHAR(MAX)","XML","JSON","BOOLEAN","TINYINT(1)","BIT","NUMBER(1)","BOOL"].includes(e.toUpperCase())}function isDateTimeType(e){return["DATE","DATETIME","TIMESTAMP","TIME","YEAR","DATETIME2","SMALLDATETIME","DATETIMEOFFSET","INTERVAL","TIMESTAMPTZ","TIMETZ","TIMESTAMP WITH TIME ZONE","TIMESTAMP WITH LOCAL TIME ZONE","TIMESTAMP_LTZ","TIMESTAMP_NTZ","TIMESTAMP_TZ"].includes(e.toUpperCase())}function HistogramDiffForm(e){var n;let{params:t,onParamsChanged:i,setIsReadyToExecute:l}=e,a=useLineageGraphsContext(),s=eM().find(null===(n=a.lineageGraphSets)||void 0===n?void 0:n.all.nodes,{name:null==t?void 0:t.model}),c=s?extractColumns(s).filter(e=>!isStringDataType(e.type)&&!isDateTimeType(e.type)):[];return(0,r.jsx)(o.xu,{m:"16px",children:(0,r.jsxs)(eT.NI,{children:[(0,r.jsx)(eD.l,{children:"Pick a column to show Histogram Diff"}),(0,r.jsx)(eK.P,{placeholder:"Select column",value:null==t?void 0:t.column_name,onChange:e=>{var n;let r=e.target.value;l(!!r);let o=(null===(n=c.find(e=>e.name===r))||void 0===n?void 0:n.type)||"";i({...t,column_name:r,column_type:o})},children:c.map(e=>(0,r.jsxs)("option",{value:e.name,children:[e.name," : ",e.type]},e.name))})]})})}let eW=(0,w.createContext)({runAction:()=>{}}),eU={profile_diff:{title:"Profile Diff",RunResultView:ProfileDiffResultView},value_diff:{title:"Value Diff",RunResultView:ValueDiffResultView,RunForm:ValueDiffForm},value_diff_detail:{title:"Value Diff Detail",RunResultView:ValueDiffDetailResultView,RunForm:ValueDiffForm},top_k_diff:{title:"Top-K Diff",RunResultView:TopKDiffResultView,RunForm:TopKDiffForm},histogram_diff:{title:"Histogram Diff",RunResultView:HistogramDiffResultView,RunForm:HistogramDiffForm}},useCloseModalEffect=e=>{let[n]=(0,eS.TH)();(0,w.useEffect)(()=>{e()},[e,n])};function RecceActionContextProvider(e){var n;let{children:t}=e,[i,o]=(0,w.useState)(),{isOpen:l,onOpen:a,onClose:s}=(0,c.q)(),d=(0,w.useCallback)((e,n,t)=>{let r=new Date().getTime().toString();o({session:r,type:e,params:n,options:t}),a()},[o,a]);return useCloseModalEffect(s),(0,r.jsxs)(eW.Provider,{value:{runAction:d},children:[i&&eU[i.type]&&(0,r.jsx)(RunModal,{isOpen:l,onClose:s,title:eU[i.type].title,type:i.type,params:i.params,RunResultView:eU[i.type].RunResultView,RunForm:(null===(n=i.options)||void 0===n?void 0:n.showForm)?eU[i.type].RunForm:void 0},i.session),t]})}let useRecceActionContext=()=>(0,w.useContext)(eW);function NodeView(e){let{node:n,onCloseNode:t}=e,[,i]=(0,eS.TH)(),{setSqlQuery:l}=useRecceQueryContext(),{fetchFn:s}=useRowCountQueries([n.name]),d="model"===n.resourceType||"seed"===n.resourceType||"source"===n.resourceType,{isOpen:u,onOpen:h,onClose:f}=(0,c.q)(),{runAction:S}=useRecceActionContext(),_=(0,w.useCallback)(async()=>{let e=n.id,t=await createCheckByNodeSchema(e);i("/checks/".concat(t.check_id))},[n,i]),R=(0,w.useCallback)(async()=>{let e=await s({skipCache:!0}),n=await createCheckByRun(e);i("/checks/".concat(n.check_id))},[i,s]);return(0,r.jsxs)(et.r,{height:"100%",templateRows:"auto auto 1fr",children:[(0,r.jsxs)(x.U,{children:[(0,r.jsx)(o.xu,{flex:"0 1 20%",p:"16px",children:(0,r.jsx)(er.X,{size:"sm",children:n.name})}),(0,r.jsx)(N.L,{}),"modified"===n.changeStatus&&(0,r.jsxs)(o.xu,{children:[(0,r.jsx)(m.z,{onClick:h,leftIcon:(0,r.jsx)(I.tvD,{}),colorScheme:"orange",variant:"solid",children:"Diff"}),(0,r.jsxs)(g.u_,{isOpen:u,onClose:f,size:"6xl",children:[(0,r.jsx)(p.Z,{}),(0,r.jsxs)(y.h,{overflowY:"auto",height:"75%",children:[(0,r.jsx)(ei.x,{children:"Model Raw Code Diff"}),(0,r.jsx)(v.o,{}),(0,r.jsx)(j.f,{children:(0,r.jsx)(SqlDiffView,{base:n.data.base,current:n.data.current})})]})]})]}),(0,r.jsx)(o.xu,{flex:"0 1 1%",p:"16px",children:(0,r.jsx)(eo.P,{onClick:t})})]}),(0,r.jsx)(o.xu,{color:"gray",paddingLeft:"16px",children:(0,r.jsxs)(x.U,{spacing:"8px",children:[(0,r.jsx)(ResourceTypeTag,{node:n}),"model"===n.resourceType&&(0,r.jsx)(RowCountTag,{node:n})]})}),d&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(el.m,{overflow:"auto",as:a.k,children:[(0,r.jsx)(ea.t,{children:(0,r.jsx)(es.O,{children:"Columns"})}),(0,r.jsx)(ec.n,{overflow:"auto",height:"calc(100% - 42px)",children:(0,r.jsx)(ed.x,{p:0,overflowY:"auto",height:"100%",children:(0,r.jsx)(SchemaView,{base:n.data.base,current:n.data.current})})})]}),(0,r.jsxs)(x.U,{p:"16px",children:[(0,r.jsxs)(C.v,{children:[(0,r.jsx)(eu.j,{as:m.z,size:"sm",colorScheme:"blue",children:"Add check"}),(0,r.jsxs)(b.q,{children:[(0,r.jsx)(k.s,{onClick:_,children:"Schema Check"}),(0,r.jsx)(k.s,{onClick:R,children:"Row Count Check"})]})]}),(0,r.jsx)(N.L,{}),"model"===n.resourceType&&(0,r.jsxs)(r.Fragment,{children:["added"!==n.changeStatus&&"removed"!==n.changeStatus&&(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(C.v,{children:[(0,r.jsx)(eu.j,{as:m.z,size:"sm",colorScheme:"blue",children:"Advanced Diffs"}),(0,r.jsxs)(b.q,{children:[(0,r.jsx)(k.s,{onClick:()=>{S("profile_diff",{model:n.name})},children:"Profile Diff"}),(0,r.jsx)(k.s,{onClick:()=>{S("value_diff",{model:n.name,primary_key:""},{showForm:!0})},children:"Value Diff"}),(0,r.jsx)(k.s,{onClick:()=>{S("top_k_diff",{model:n.name,column_name:"",k:50},{showForm:!0})},children:"Top-K Diff"}),(0,r.jsx)(k.s,{onClick:()=>{S("histogram_diff",{model:n.name,column_name:"",column_type:""},{showForm:!0})},children:"Histogram Diff"})]})]})}),(0,r.jsx)(m.z,{colorScheme:"blue",size:"sm",onClick:()=>{l('select * from {{ ref("'.concat(n.name,'") }}')),i("/query")},children:"Query"})]})]})]})]})}let eG={added:["Model Added","Added resource"],removed:["Model Removed","Removed resource"],modified:["Model Modified","Modified resource"],col_added:["Column Added","Added column"],col_removed:["Column Removed","Removed column"],col_changed:["Column Modified","Modified column"],folder_changed:["Modified","Modified folder"]};function ChangeSummary_getIconForChangeStatus(e){if("added"===e)return{color:"#1dce00",icon:M};if("removed"===e)return{color:"#ff067e",icon:F};if("modified"===e)return{color:"#ffa502",icon:O};if("col_added"===e)return{color:"#1dce00",icon:M};if("col_removed"===e)return{color:"#ff067e",icon:F};if("col_changed"===e)return{color:"#ffa502",icon:O};if("folder_changed"===e)return{color:"#ffa502",icon:IconChanged};return{color:"inherit",icon:void 0}}function SummaryText(e){let{name:n,value:t,tip:i}=e;return(0,r.jsxs)(h.g,{alignItems:"stretch",children:[(0,r.jsxs)(f.x,{fontSize:"sm",color:"gray",children:[n,i&&(0,r.jsx)(l.u,{label:i,children:(0,r.jsx)(o.xu,{display:"inline-block",children:(0,r.jsx)(s.J,{mx:"2px",as:V.H33,boxSize:3})})})]}),t]})}function ChangeStatusCountLabel(e){let{changeStatus:n,value:t}=e,[i]=n?eG[n]:[""],{icon:o,color:l}=ChangeSummary_getIconForChangeStatus(n);return(0,r.jsxs)(h.g,{alignItems:"stretch",children:[(0,r.jsxs)(a.k,{alignItems:"center",fontSize:"sm",color:"gray",children:[(0,r.jsx)(s.J,{mr:"5px",as:o,color:l}),i]}),(0,r.jsx)(f.x,{fontSize:"sm",children:t})]})}function calculateColumnChange(e,n){let t=0,r=0,i=0;return(e||n)&&(n&&Object.keys(n.columns||{}).forEach(n=>{(!e||!e.columns||!e.columns[n])&&t++}),e&&Object.keys(e.columns||{}).forEach(e=>{(!n||!n.columns||!n.columns[e])&&r++}),n&&e&&Object.keys(n.columns||{}).forEach(t=>{e.columns&&n.columns&&e.columns[t]&&e.columns[t].type!==n.columns[t].type&&i++})),{adds:t,removes:r,modifies:i}}function calculateChangeSummary(e,n){let t=0,r=0,i=0,o=0,l=0,a=0;return n.forEach(n=>{"added"===e.nodes[n].changeStatus?t++:"removed"===e.nodes[n].changeStatus?r++:"modified"===e.nodes[n].changeStatus&&i++;let s=e.nodes[n].data.base,c=e.nodes[n].data.current,d=calculateColumnChange(s,c);o+=d.adds,l+=d.removes,a+=d.modifies}),{adds:t,removes:r,modifies:i,col_added:o,col_removed:l,col_changed:a}}function ChangeSummary(e){let{lineageGraphSets:n}=e,{adds:t,removes:i,modifies:l,col_added:a,col_removed:s,col_changed:c}=calculateChangeSummary(n.all,n.modifiedSet);return(0,r.jsxs)(et.r,{templateColumns:"1fr 1fr",mb:"10px",borderTop:"1px solid lightgray",padding:"2.5vw",children:[(0,r.jsx)(o.xu,{borderColor:"lightgray",children:(0,r.jsx)(SummaryText,{name:"Code Changes",value:(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(et.r,{templateColumns:"1fr 1fr 1fr",width:"100%",children:[(0,r.jsx)(ChangeStatusCountLabel,{changeStatus:"added",value:t}),(0,r.jsx)(ChangeStatusCountLabel,{changeStatus:"removed",value:i}),(0,r.jsx)(ChangeStatusCountLabel,{changeStatus:"modified",value:l})]})})})}),(0,r.jsx)(o.xu,{borderLeft:"1px",paddingLeft:"12px",borderColor:"lightgray",children:(0,r.jsx)(SummaryText,{name:"Column Changes",value:(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(et.r,{templateColumns:"1fr 1fr 1fr",width:"100%",children:[(0,r.jsx)(ChangeStatusCountLabel,{changeStatus:"col_added",value:a}),(0,r.jsx)(ChangeStatusCountLabel,{changeStatus:"col_removed",value:s}),(0,r.jsx)(ChangeStatusCountLabel,{changeStatus:"col_changed",value:c})]})})})})]})}var eQ=t(76353),eJ=t(53248),eZ=t(9763),eX=t(95853);function SchemaDiffCard(e){let{node:n,...t}=e;return(0,r.jsxs)(eQ.Z,{maxWidth:"500px",children:[(0,r.jsxs)(eJ.O,{children:[(0,r.jsx)(er.X,{fontSize:18,children:t.title}),(0,r.jsxs)(x.U,{spacing:"8px",p:"16px",children:[(0,r.jsx)(ResourceTypeTag,{node:n}),"model"===n.resourceType&&(0,r.jsx)(RowCountTag,{node:n,isAutoFetching:!0})]})]}),(0,r.jsx)(eZ.e,{children:(0,r.jsx)(a.k,{children:(0,r.jsx)(SchemaView,{base:n.data.base,current:n.data.current})})})]})}function listChangedNodes(e){let n=[],t=e.all.nodes;return e.modifiedSet.forEach(e=>{var r,i;let o=t[e],l=mergeKeysWithStatus(Object.keys((null===(r=o.data.base)||void 0===r?void 0:r.columns)||{}),Object.keys((null===(i=o.data.current)||void 0===i?void 0:i.columns)||{})),a=!Object.values(l).every(e=>void 0===e);a&&o.data.base&&o.data.current&&n.push(o)}),n}function SchemaSummary(e){let{lineageGraphSets:n}=e,[t,i]=(0,w.useState)([]);return(0,w.useEffect)(()=>{i(listChangedNodes(n))},[n]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.k,{w:"100%",paddingBottom:"10px",marginBottom:"20px",marginTop:"20px",children:(0,r.jsx)(er.X,{fontSize:24,children:"Schema Summary"})}),(0,r.jsx)(a.k,{w:"100%",paddingBottom:"10px",marginBottom:"20px",children:0===t.length?(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(f.x,{fontSize:18,color:"gray",children:"No schema changes detected."})}):(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(eX.M,{minChildWidth:"400px",spacing:"2vw",padding:"2.5vw",width:"100%",backgroundColor:"lightgray",children:t.map(e=>(0,r.jsx)(SchemaDiffCard,{title:e.name,node:e},e.id))})})})]})}function SummaryView(){let{lineageGraphSets:e}=useLineageGraphsContext();return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(a.k,{direction:"column",w:"100%",minHeight:"650px",children:[(0,r.jsx)(a.k,{w:"100%",paddingBottom:"10px",marginBottom:"20px",children:(0,r.jsx)(er.X,{fontSize:24,children:"Change Summary"})}),e&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ChangeSummary,{lineageGraphSets:e}),(0,r.jsx)(eV.i,{}),(0,r.jsx)(SchemaSummary,{lineageGraphSets:e})]})]})})}var eY=t(45438),e$=t(40312),e0=t(52246),e1=t(25807),e2=t(15012);function AddSchemaChangesCheckButton(e){let{nodes:n,onFinish:t}=e,[,i]=(0,eS.TH)();return(0,r.jsxs)(m.z,{size:"xs",variant:"outline",isDisabled:0===n.length,onClick:async()=>{let e;1===n.length?e=await createCheckByNodeSchema(n[0].id):await Promise.all(n.map(async e=>{await createCheckByNodeSchema(e.id)})),t(),e?i("/checks/".concat(e.check_id)):i("/checks")},children:[(0,r.jsx)(s.J,{as:B.Edg}),"Add schema check"]})}function AddRowCountCheckButton(e){let{nodes:n,onFinish:t}=e,[,i]=(0,eS.TH)(),{isLoading:o,fetchFn:l}=useRowCountQueries(n.map(e=>e.name));return(0,r.jsxs)(m.z,{size:"xs",isLoading:o,loadingText:"Querying",variant:"outline",isDisabled:0===n.length,onClick:async()=>{let e=await l({skipCache:!0}),n=await createCheckByRun(e);n?i("/checks/".concat(n.check_id)):i("/checks"),t()},children:[(0,r.jsx)(s.J,{as:V.SwK}),"Add row count check"]})}function AddLineageDiffCheckButton(e){let{viewMode:n,nodes:t,onFinish:i,withIcon:o}=e,[,l]=(0,eS.TH)();return(0,r.jsxs)(m.z,{size:"xs",variant:"outline",isDisabled:0===t.length,onClick:async()=>{let e=t.map(e=>e.id),r=await createLineageDiffCheck(n,e);i(),r?l("/checks/".concat(r.check_id)):l("/checks")},children:[o&&(0,r.jsx)(s.J,{as:e2.Ks7}),"Add lineage diff check"]})}function NodeSelector(e){let{viewMode:n,nodes:t,isOpen:i,onClose:l}=e;function countSelectedNodes(e){return e.filter(e=>e.isSelected).length}let a=t.filter(e=>e.isSelected);return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(e$.R,{in:i,style:{zIndex:10},children:(0,r.jsx)(o.xu,{bg:"white",rounded:"md",shadow:"dark-lg",children:(0,r.jsxs)(x.U,{p:"5px 15px",mt:"4",divider:(0,r.jsx)(e0.c,{borderColor:"gray.200"}),spacing:4,children:[(0,r.jsxs)(e1.h,{size:"xs",isAttached:!0,variant:"outline",rounded:"xs",onClick:l,children:[(0,r.jsxs)(m.z,{children:[countSelectedNodes(t)," selected"]}),(0,r.jsx)(P.h,{"aria-label":"Exit select Mode",icon:(0,r.jsx)(eY.D,{})})]}),(0,r.jsxs)(x.U,{children:[(0,r.jsx)(FetchSelectedNodesRowCountButton,{nodes:a.length>0?a:[],onFinish:l}),(0,r.jsx)(AddSchemaChangesCheckButton,{nodes:a.length>0?a:[],onFinish:l}),(0,r.jsx)(AddRowCountCheckButton,{nodes:a.length>0?a:[],onFinish:l}),(0,r.jsx)(AddLineageDiffCheckButton,{viewMode:n,nodes:a.length>0?a:[],onFinish:l,withIcon:!0})]})]})})})})}let layout=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"LR",r=new(D()).graphlib.Graph;r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:t}),e.forEach(e=>{r.setNode(e.id,{width:300,height:36})}),n.forEach(e=>{r.setEdge(e.source,e.target)}),D().layout(r),e.forEach(e=>{let n=r.node(e.id);return e.position={x:n.x-150,y:n.y-18},e})},e5={customNode:GraphNode},e3={customEdge:GraphEdge},nodeColor=e=>{var n,t;return(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.changeStatus)?getIconForChangeStatus(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.changeStatus).color:"lightgray"},e4={all:"All",changed_models:"Changed Models"};function ChangeStatusLegend(){return(0,r.jsx)(o.xu,{bg:"white",padding:"12px",borderWidth:"1px",borderColor:"gray.200",fontSize:"sm",children:Object.entries({added:["Added","Added resource"],removed:["Removed","Removed resource"],modified:["Modified","Modified resource"]}).map(e=>{let[n,[t,i]]=e,{icon:o,color:c}=getIconForChangeStatus(n);return(0,r.jsx)(l.u,{label:i,children:(0,r.jsxs)(a.k,{alignItems:"center",gap:"6px",marginBottom:"2px",children:[(0,r.jsx)(s.J,{color:c,as:o})," ",t]})},n)})})}function _LineageView(e){let{...n}=e,{fitView:t}=(0,i._K)(),{successToast:l,failToast:T}=useClipBoardToast(),{toImage:D,ref:N}=useToBlob({imageType:"png",shadowEffect:!0,backgroundColor:"white",ignoreElements:e=>{let n=e.className;return!!("string"==typeof n&&n.includes(ev))},onSuccess:async e=>{try{await copyBlobToClipboard(e),l("Copied the Lineage View as an image to clipboard")}catch(e){T("Failed to copy image to clipboard",e)}},onError:e=>{console.error("Error taking screenshot",e),T("Failed to copy image to clipboard",e)}}),[E,I,L]=(0,i.Rr)([]),[M,F,O]=(0,i.ll)([]),[A,z]=(0,w.useState)(),[P,B]=(0,w.useState)(),{lineageGraphSets:q,isLoading:H,error:K}=useLineageGraphsContext(),{isOpen:W,onOpen:U,onClose:G}=(0,c.q)(),[Q,J]=(0,w.useState)("detail"),[Z,X]=(0,w.useState)(),[Y,$]=(0,w.useState)(!1),[ee,et]=(0,w.useState)(n.viewMode||"changed_models"),[er,ei]=(0,w.useState)(!1),[eo,el]=(0,w.useState)({x:0,y:0});if((0,w.useEffect)(()=>{if(!q)return;let e="changed_models"===ee?{...q.changed}:{...q.all},t=q.modifiedSet;if("function"==typeof n.filterNodes){let t=n.filterNodes?n.filterNodes:()=>!0;e.nodes=Object.fromEntries(Object.entries(e.nodes).filter(e=>{let[n,r]=e;return t(n,r)}))}let[r,i]=toReactflow(e,q.modifiedSet);layout(r,i),z(e),B(t),I(r),F(i)},[I,F,ee,q,n.filterNodes]),(0,w.useEffect)(()=>{let e=new ResizeObserver(()=>{t({padding:.2,includeHiddenNodes:!0,duration:300})});return N.current&&e.observe(N.current),()=>e.disconnect()},[N,Y,t]),H)return(0,r.jsx)(a.k,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",children:(0,r.jsx)(d.$,{size:"xl"})});let closeContextMenu=()=>{ei(!1),el({x:0,y:0})};return K?(0,r.jsxs)(r.Fragment,{children:["Fail to load lineage data: ",K]}):"changed_models"===ee&&(void 0===P||(null==P?void 0:P.length)===0)?(0,r.jsx)(u.M,{h:"100%",children:(0,r.jsxs)(h.g,{children:[(0,r.jsx)(r.Fragment,{children:"No change detected"}),(0,r.jsx)(m.z,{colorScheme:"blue",onClick:()=>{et("all")},children:"Show all nodes"})]})}):(0,r.jsxs)(a.k,{width:"100%",height:"100%",children:[(0,r.jsx)(o.xu,{flex:"1 0 0px",children:(0,r.jsxs)(i.x$,{nodeTypes:e5,edgeTypes:e3,nodes:E,edges:M,onNodesChange:L,onEdgesChange:O,onNodeClick:(e,t)=>{!1!==n.interactive&&(closeContextMenu(),"detail"===Q?(X(t.id),Y||$(!0),I(selectSingleNode(t.id,E))):I(selectNode(t.id,E)))},onNodeMouseEnter:(e,n)=>{if(A&&void 0!==P){let[e,t]=highlightPath(A,P,E,M,n.id);I(e),F(t)}},onNodeMouseLeave:(e,n)=>{if(A&&void 0!==P){let[e,n]=highlightPath(A,P,E,M,null);I(e),F(n)}},onNodeContextMenu:(e,n)=>{"action"===Q&&(e.preventDefault(),el({x:e.clientX,y:e.clientY,selectedNode:n}),ei(!0))},onClick:closeContextMenu,maxZoom:1,minZoom:.1,fitView:!0,nodesDraggable:n.interactive,ref:N,children:[(0,r.jsx)(S.A,{color:"#ccc"}),(0,r.jsxs)(_.Z,{showInteractive:!1,position:"top-right",className:ev,children:[n.interactive&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(_.B,{title:"switch mode",onClick:()=>{et("all"===ee?"changed_models":"all");let e=cleanUpSelectedNodes(E);I(e)},children:(0,r.jsx)(s.J,{as:V.Bw1})}),(0,r.jsx)(_.B,{title:"summary",onClick:U,children:(0,r.jsx)(s.J,{as:V.SnF})})]}),(0,r.jsx)(_.B,{title:"copy image",onClick:()=>{D()},children:(0,r.jsx)(s.J,{as:V.C3L})})]}),(0,r.jsx)(i.s_,{position:"bottom-left",children:(0,r.jsxs)(x.U,{children:[(0,r.jsx)(ChangeStatusLegend,{}),n.interactive&&(0,r.jsxs)(o.xu,{p:2,flex:"0 1 160px",fontSize:"14px",className:ev,children:[(0,r.jsx)(f.x,{color:"gray",mb:"2px",children:"Actions"}),(0,r.jsxs)(h.g,{spacing:1,align:"baseline",children:[(0,r.jsx)(m.z,{size:"xs",variant:"outline",isDisabled:"action"===Q,onClick:()=>{let e=cleanUpSelectedNodes(E);I(e),J("detail"===Q?"action":"detail")},children:"Select Models"}),(0,r.jsx)(AddLineageDiffCheckButton,{viewMode:ee,nodes:E.map(e=>e.data),onFinish:()=>J("detail")})]})]})]})}),(0,r.jsx)(i.s_,{position:"top-left",children:(0,r.jsx)(f.x,{fontSize:"xl",color:"grey",opacity:.5,children:e4[ee]})}),(0,r.jsx)(i.s_,{position:"bottom-center",className:ev,children:(0,r.jsx)(NodeSelector,{viewMode:ee,nodes:E.map(e=>e.data),isOpen:"action"===Q,onClose:()=>{J("detail");let e=cleanUpSelectedNodes(E);I(e)}})}),(0,r.jsx)(R.a,{nodeColor:nodeColor,nodeStrokeWidth:3})]})}),(0,r.jsxs)(g.u_,{isOpen:W,onClose:G,size:"6xl",children:[(0,r.jsx)(p.Z,{}),(0,r.jsxs)(y.h,{overflowY:"auto",height:"80%",children:[(0,r.jsx)(v.o,{}),(0,r.jsx)(j.f,{children:(0,r.jsx)(SummaryView,{})})]})]}),"detail"===Q&&Z&&(null==A?void 0:A.nodes[Z])&&(0,r.jsx)(o.xu,{flex:"0 0 500px",borderLeft:"solid 1px lightgray",height:"100%",children:(0,r.jsx)(NodeView,{node:null==A?void 0:A.nodes[Z],onCloseNode:()=>{X(void 0),$(!1),I(cleanUpSelectedNodes(E))}})}),er&&(0,r.jsx)(C.v,{isOpen:!0,onClose:closeContextMenu,children:(0,r.jsxs)(b.q,{style:{position:"absolute",left:"".concat(eo.x,"px"),top:"".concat(eo.y,"px")},children:[(0,r.jsx)(k.s,{icon:(0,r.jsx)(en.Cv2,{}),onClick:()=>{let e=eo.selectedNode;if("action"!==Q||void 0===e||void 0===A)return;let n=e.id,t=selectUpstream(A,[n]),r=selectNodes([...t],E);I(r)},children:"Select parent nodes"}),(0,r.jsx)(k.s,{icon:(0,r.jsx)(en.IMj,{}),onClick:()=>{let e=eo.selectedNode;if("action"!==Q||void 0===e||void 0===A)return;let n=e.id,t=selectDownstream(A,[n]),r=selectNodes([...t],E);I(r)},children:"Select child nodes"})]})})]})}function LineageView(e){let{...n}=e;return void 0===n.interactive&&(n.interactive=!0),void 0===n.viewMode&&(n.viewMode="changed_models"),(0,r.jsx)(i.tV,{children:(0,r.jsx)(_LineageView,{...n})})}var e6=t(12844),e9=t(98786);function RecceContextProvider(e){let{children:n}=e;return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(RecceQueryContextProvider,{children:(0,r.jsx)(LineageGraphsContextProvider,{children:(0,r.jsx)(RowCountStateContextProvider,{children:(0,r.jsx)(RecceActionContextProvider,{children:n})})})})})}function useVersionNumber(){let[e,n]=(0,w.useState)("");return(0,w.useEffect)(()=>{(async function(){try{let e=await G.get("/api/version");n(e.data)}catch(e){console.error("Error fetching version number:",e)}})()},[]),e}var e8=t(45489),e7=t(69005),ne=t(14800),nn=t(2600),nt=t(68677),nr=t(83358),ni=t(44525),no=t(79935),nl=t(93197),na=t(234),ns=t(96094),nc=t(36334);function CheckBreadcrumb(e){let{name:n,setName:t}=e,[i,l]=(0,w.useState)(!1),[a,s]=(0,w.useState)(n),c=(0,w.useRef)(null),d=(0,w.useCallback)(()=>{t(a),l(!1)},[t,l,a]);return(0,w.useEffect)(()=>{let handleClickOutside=e=>{c.current&&!c.current.contains(e.target)&&d()};return i&&document.addEventListener("mousedown",handleClickOutside),()=>{document.removeEventListener("mousedown",handleClickOutside)}},[i,c,d]),(0,r.jsxs)(na.a,{flex:"0 1",fontSize:"12pt",fontWeight:"500",separator:(0,r.jsx)(nc.X,{color:"gray.500"}),children:[(0,r.jsx)(ns.g,{children:(0,r.jsx)(o.xu,{children:"Checklist"})}),(0,r.jsx)(ns.g,{flex:"0 1",cursor:"pointer",children:i?(0,r.jsx)(eN.I,{ref:c,value:a,onChange:e=>{s(e.target.value)},onKeyDown:e=>{"Enter"===e.key?(t(a),l(!1)):"Escape"===e.key&&(s(n),l(!1))},size:"sm",w:"auto",minW:"200px",maxW:"600px"}):(0,r.jsx)(o.xu,{onClick:()=>{s(n),l(!0)},textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n})})]})}function SchemaDiffView(e){let{check:n}=e,{lineageGraphSets:t}=useLineageGraphsContext(),i=n.params,o=i.node_id,l=o?null==t?void 0:t.all.nodes[o]:void 0;return l?(0,r.jsx)(SchemaView,{base:l.data.base,current:l.data.current,enableScreenshot:!0}):(0,r.jsx)(r.Fragment,{})}var nd=t(33695);function CheckDescription(e){let{value:n,onChange:t}=e,[i,o]=(0,w.useState)(!1),[l,s]=(0,w.useState)(),c=(0,w.useRef)(null);return((0,w.useEffect)(()=>{if(i&&c.current){let e=c.current;e.focus(),e.setSelectionRange(e.value.length,e.value.length)}},[i]),i)?(0,r.jsxs)(a.k,{direction:"column",align:"flex-end",children:[(0,r.jsx)(nd.g,{h:"200px",value:l,onChange:e=>{s(e.target.value)},onKeyDown:e=>{"Escape"===e.key&&o(!1)},ref:c}),(0,r.jsxs)(a.k,{gap:"12px",alignItems:"flex-end",children:[(0,r.jsx)(eB.r,{onClick:()=>{setTimeout(()=>{o(!1)},100)},colorScheme:"blue",children:"cancel"}),(0,r.jsx)(m.z,{mt:"8px",size:"sm",colorScheme:"blue",onClick:()=>{t&&(t(l),o(!1))},children:"Update"})]})]}):(0,r.jsx)(f.x,{maxHeight:"400px",overflow:"auto",fontSize:"11pt",onClick:()=>{s(n||""),o(!0)},whiteSpace:"pre-line",color:n?"inherit":"lightgray",children:n||"Add description here"})}function RowCountDiffResultView(e){let{run:n}=e;function columnCellClass(e){if(e.base===e.current);else if(e.basee.current||"N/A"===e.current)return"column-body-removed";return"column-body-normal"}let t=n.result||{},i=Object.keys(n.result||{}).map(e=>{let n=t[e],r=(null==n?void 0:n.base)||null,i=(null==n?void 0:n.curr)||null,o="No Change";return null!==r&&null!==i?o=ri?"- ".concat(Math.round((r-i)/r*100),"%"):"No Change":r===i?o="N/A":null===r?o="Added":null===i&&(o="Removed"),{name:e,base:null===r?"N/A":Number(r),current:null===i?"N/A":Number(i),delta:o}});return(0,r.jsx)(a.k,{direction:"column",children:Object.keys(t).length>0&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto",fontSize:"10pt",borderWidth:1},columns:[{key:"name",name:"Name",cellClass:columnCellClass},{key:"base",name:"Base Rows",cellClass:columnCellClass},{key:"current",name:"Current Rows",cellClass:columnCellClass},{key:"delta",name:"Delta",cellClass:columnCellClass}],rows:i,className:"rdg-light",enableScreenshot:!0})})})}var nu=t(48742);function _templateObject(){let e=(0,e8._)(["\n **SQL**\n ```sql\n ","\n ```\n "],["\n **SQL**\n \\`\\`\\`sql\n ","\n \\`\\`\\`\n "]);return _templateObject=function(){return e},e}function buildTitle(e){return"".concat(e.is_checked?"✅ ":"").concat(e.name)}function buildDescription(e){return e.description?e.description:"_(no description)_"}function buildQuery(e){var n;return(0,nu.Pn)(_templateObject(),null===(n=e.params)||void 0===n?void 0:n.sql_template)}var query_SqlEditor=e=>{let{value:n,onChange:t,onRun:i,onRunDiff:o,options:l={},...a}=e;return(0,r.jsx)(ew.ZP,{language:"sql",theme:"vs",value:n,onChange:e=>{void 0!==e&&t&&t(e)},onMount:(e,n)=>{i&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.Enter,i),o&&e.addCommand(n.KeyMod.CtrlCmd|n.KeyMod.Shift|n.KeyCode.Enter,o)},options:{tabSize:2,fontSize:16,lineNumbers:"on",automaticLayout:!0,minimap:{enabled:!1},wordWrap:"on",wrappingIndent:"indent",...l}})};function DataFrameColumnHeader(e){let{name:n,pinnedColumns:t=[],onPinnedColumnsChange:i=()=>{}}=e,l=t.includes(n);return(0,r.jsxs)(a.k,{className:"grid-header",alignItems:"center",children:[(0,r.jsx)(o.xu,{flex:1,children:n}),(0,r.jsx)(s.J,{className:l?"unpin-icon":"pin-icon",display:l?"block":"none",cursor:"pointer",as:l?E.$kI:E.oJP,onClick:l?()=>{let e=t.filter(e=>e!==n);i(e)}:()=>{let e=[...t,n];i(e)}})]})}function QueryResultView_toDataGrid(e,n){let t=[],i=n.pinnedColumns||[],toColumn=(e,t)=>({key:String(e),name:(0,r.jsx)(DataFrameColumnHeader,{name:t,...n}),width:"auto",renderCell:defaultRenderCell});return t.push({key:"_index",name:"",width:10,cellClass:"index-column"}),i.forEach(n=>{let r=eM().findIndex(e.columns,e=>e.name===n);r<0||t.push(toColumn(r,n))}),e.columns.forEach((e,n)=>{i.includes(e.name)||t.push(toColumn(n,e.name))}),e.data.forEach((e,n)=>{e._index=n+1}),{columns:t,rows:e.data}}let QueryResultView=e=>{let{run:n,viewOptions:t,onViewOptionsChanged:i,onAddToChecklist:s}=e,c=(0,w.useMemo)(()=>(null==t?void 0:t.pinned_columns)||[],[t]),d=null==n?void 0:n.result,h=(0,w.useMemo)(()=>d?QueryResultView_toDataGrid(d,{pinnedColumns:c,onPinnedColumnsChange:e=>{i&&i({...t,pinned_columns:e})}}):{rows:[],columns:[]},[d,c,t,i]);if(0===h.columns.length)return(0,r.jsx)(u.M,{height:"100%",children:"No data"});let m=(null==d?void 0:d.limit)||0,x=m>0&&(null==d?void 0:d.more)?"Warning: Displayed results are limited to ".concat(m.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null;return(0,r.jsxs)(a.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(s||x)&&(0,r.jsxs)(a.k,{borderBottom:"1px solid lightgray",alignItems:"center",gap:"5px",px:"10px",bg:x?"orange.100":"inherit",children:[x&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ez.a,{color:"orange.600",alignSelf:"center"})," ",(0,r.jsx)(o.xu,{children:x})]}),(0,r.jsx)(N.L,{minHeight:"32px"}),s&&(0,r.jsx)(l.u,{label:"Add to Checklist",children:(0,r.jsx)(P.h,{variant:"unstyled",size:"sm","aria-label":"Add",icon:(0,r.jsx)(eP.d,{}),onClick:()=>s(n)})})]}),(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:h.columns,rows:h.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})},QueryDiffResultView=e=>{var n,t,i,s,c,d;let{run:m,onAddToChecklist:x,viewOptions:f,onViewOptionsChanged:g}=e,p=(0,w.useMemo)(()=>(null==f?void 0:f.primary_keys)||[],[f]),y=(0,w.useMemo)(()=>(null==f?void 0:f.changed_only)||!1,[f]),v=(0,w.useMemo)(()=>(null==f?void 0:f.pinned_columns)||[],[f]),j=(0,w.useMemo)(()=>{var e,n;return toDataDiffGrid(null==m?void 0:null===(e=m.result)||void 0===e?void 0:e.base,null==m?void 0:null===(n=m.result)||void 0===n?void 0:n.current,{changedOnly:y,primaryKeys:p,onPrimaryKeyChange:e=>{g&&g({...f,primary_keys:e})},pinnedColumns:v,onPinnedColumnsChange:e=>{g&&g({...f,pinned_columns:e})}})},[m,f,y,p,v,g]),C=(0,w.useMemo)(()=>{let e=p.join(", ");return j.invalidPKeyBase&&j.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the base and current environments"):j.invalidPKeyBase?"Warning: The primary key '".concat(e,"' is not unique in the base environment"):j.invalidPKeyCurrent?"Warning: The primary key '".concat(e,"' is not unique in the current environment"):void 0},[j.invalidPKeyBase,j.invalidPKeyCurrent,p]);if(0===j.columns.length)return(0,r.jsx)(u.M,{height:"100%",children:"No data"});if(y&&0===j.rows.length)return(0,r.jsx)(u.M,{height:"100%",children:"No change"});let b=(null===(t=m.result)||void 0===t?void 0:null===(n=t.current)||void 0===n?void 0:n.limit)||0,k=b>0&&((null==m?void 0:null===(s=m.result)||void 0===s?void 0:null===(i=s.current)||void 0===i?void 0:i.more)||(null==m?void 0:null===(d=m.result)||void 0===d?void 0:null===(c=d.base)||void 0===c?void 0:c.more))?"Warning: Displayed results are limited to ".concat(b.toLocaleString()," records. To ensure complete data retrieval, consider applying a LIMIT or WHERE clause to constrain the result set."):null;return(0,r.jsxs)(a.k,{direction:"column",backgroundColor:"rgb(249, 249, 249)",height:"100%",children:[(0,r.jsxs)(a.k,{borderBottom:"1px solid lightgray",justifyContent:"flex-end",gap:"5px",alignItems:"center",px:"10px",bg:k||C?"orange.100":"inherit",children:[(0,r.jsxs)(h.g,{alignItems:"flex-start",spacing:0,children:[C&&(0,r.jsxs)(o.xu,{children:[(0,r.jsx)(ez.a,{color:"orange.600"})," ",C]}),k&&(0,r.jsxs)(o.xu,{children:[(0,r.jsx)(ez.a,{color:"orange.600"})," ",k]})]}),(0,r.jsx)(N.L,{minHeight:"32px"}),(0,r.jsx)(eE.X,{isChecked:null==f?void 0:f.changed_only,onChange:()=>{let e=!(null==f?void 0:f.changed_only);g&&g({...f,changed_only:e})},children:"Changed only"}),x&&(0,r.jsx)(l.u,{label:"Add to Checklist",children:(0,r.jsx)(P.h,{variant:"unstyled",size:"sm","aria-label":"Add",icon:(0,r.jsx)(eP.d,{}),onClick:()=>x(m)})})]}),(0,r.jsx)(ScreenshotDataGrid,{style:{blockSize:"auto",maxHeight:"100%",overflow:"auto"},columns:j.columns,rows:j.rows,defaultColumnOptions:{resizable:!0,maxWidth:800,minWidth:35},className:"rdg-light",enableScreenshot:!0})]})};var nh=t(43105);function LineageDiffView(e){var n;let{check:t}=e,i=(null===(n=t.params)||void 0===n?void 0:n.view_mode)||"";return(0,r.jsx)(a.k,{direction:"column",height:"100%",children:(0,r.jsx)(LineageView,{viewMode:i,interactive:!1,filterNodes:e=>{var n,r;return null===(r=t.params)||void 0===r?void 0:null===(n=r.node_ids)||void 0===n?void 0:n.includes(e)}})})}function CheckDetail_templateObject(){let e=(0,e8._)(["\n
","\n\n ","\n\n
"]);return CheckDetail_templateObject=function(){return e},e}let nm={query:QueryResultView,query_diff:QueryDiffResultView,value_diff:ValueDiffResultView,value_diff_detail:ValueDiffDetailResultView,profile_diff:ProfileDiffResultView,row_count_diff:RowCountDiffResultView,top_k_diff:TopKDiffResultView,histogram_diff:HistogramDiffResultView},useCancelOnUnmount=e=>{let{runId:n,isPending:t,setAborting:r}=e;(0,w.useEffect)(()=>()=>{r(!1),n&&t&&cancelRun(n)},[t,n,r])},CheckDetail=e=>{var n;let{checkId:t}=e,i=(0,q.NL)(),[,c]=(0,eS.TH)(),{successToast:d,failToast:h}=useClipBoardToast(),[x,f]=(0,w.useState)(),[g,p]=(0,w.useState)(),[y,v]=(0,w.useState)(!1),{isLoading:j,error:S,refetch:_,data:R}=(0,$.a)({queryKey:J.check(t),queryFn:async()=>getCheck(t),refetchOnMount:!1,staleTime:3e5}),T=R&&(null==R?void 0:R.type)in nm?nm[null==R?void 0:R.type]:void 0,{mutate:D}=(0,eO.D)({mutationFn:e=>updateCheck(t,e),onSuccess:()=>{i.invalidateQueries({queryKey:J.check(t)}),i.invalidateQueries({queryKey:J.checks()})}}),{mutate:I}=(0,eO.D)({mutationFn:()=>deleteCheck(t),onSuccess:()=>{i.invalidateQueries({queryKey:J.checks()}),c("/checks")}}),submitRunFn=async()=>{let e=null==R?void 0:R.type;if(!e)return;let{run_id:n}=await submitRunFromCheck(t,{nowait:!0});for(f(n);;){let e=await waitRun(n,2);if(p(e.progress),e.result||e.error)return v(!1),p(void 0),e}},{data:L,mutate:M,error:F,isIdle:O,isPending:A}=(0,eO.D)({mutationFn:submitRunFn,onSuccess:e=>{_()}}),handleRerun=async()=>{M()},z=(0,w.useCallback)(async()=>{if(v(!0),x)return await cancelRun(x)},[x]);useCancelOnUnmount({runId:x,isPending:A,setAborting:v});let handleCopy=async()=>{if(!R)return;let e=buildMarkdown(R);if(!navigator.clipboard){h("Failed to copy the check to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));return}try{await navigator.clipboard.writeText(e),d("Copied the check to the clipboard")}catch(e){h("Failed to copy the check to clipboard",e)}},V=(0,w.useCallback)(()=>{let e=null==R?void 0:R.is_checked;D({is_checked:!e})},[null==R?void 0:R.is_checked,D]);if(j)return(0,r.jsx)(u.M,{h:"100%",children:"Loading"});if(S)return(0,r.jsxs)(u.M,{h:"100%",children:["Error: ",S.message]});let B=O?null==R?void 0:R.last_run:L,H=(null==B?void 0:B.run_at)?(0,nh.Z)(new Date(B.run_at),{addSuffix:!0}):null;return(0,r.jsxs)(a.k,{height:"100%",width:"100%",maxHeight:"100%",direction:"column",children:[(0,r.jsxs)(a.k,{p:"0px 16px",alignItems:"center",children:[(0,r.jsx)(CheckBreadcrumb,{name:(null==R?void 0:R.name)||"",setName:e=>{D({name:e})}}),(0,r.jsx)(N.L,{}),(0,r.jsxs)(C.v,{children:[(0,r.jsx)(eu.j,{isRound:!0,as:P.h,icon:(0,r.jsx)(s.J,{as:E.D_A}),variant:"ghost"}),(0,r.jsx)(b.q,{children:(0,r.jsx)(k.s,{icon:(0,r.jsx)(ni.p,{}),onClick:()=>I(),children:"Delete"})})]}),H&&(0,r.jsx)(o.xu,{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",fontSize:"10pt",children:H}),R&&(null==R?void 0:R.type)in nm&&(0,r.jsx)(l.u,{label:"Rerun",children:(0,r.jsx)(P.h,{isRound:!0,isLoading:A,variant:"ghost","aria-label":"Rerun",icon:(0,r.jsx)(no.n,{}),onClick:()=>handleRerun()})}),(0,r.jsx)(l.u,{label:"Copy markdown",children:(0,r.jsx)(P.h,{isRound:!0,variant:"ghost","aria-label":"Copy markdown",icon:(0,r.jsx)(ef.T,{}),onClick:()=>handleCopy()})}),(0,r.jsx)(l.u,{label:(null==R?void 0:R.is_checked)?"Mark as unchecked":"Mark as checked",children:(0,r.jsx)(m.z,{size:"sm",colorScheme:(null==R?void 0:R.is_checked)?"green":"gray",leftIcon:(0,r.jsx)(nl.r,{}),onClick:()=>V(),children:(null==R?void 0:R.is_checked)?"Checked":"Unchecked"})})]}),(0,r.jsx)(o.xu,{p:"8px 16px",minHeight:"100px",children:(0,r.jsx)(CheckDescription,{value:null==R?void 0:R.description,onChange:e=>{D({description:e})}},null==R?void 0:R.check_id)}),((null==R?void 0:R.type)==="query"||(null==R?void 0:R.type)==="query_diff")&&(0,r.jsx)(e7.U,{defaultIndex:[],allowToggle:!0,children:(0,r.jsxs)(ne.Q,{children:[(0,r.jsxs)(nn.K,{children:["query",(0,r.jsx)(nt.X,{})]}),(0,r.jsx)(nr.H,{children:(0,r.jsx)(o.xu,{height:"400px",width:"100%",border:"lightgray 1px solid ",children:(0,r.jsx)(query_SqlEditor,{value:(null===(n=null==R?void 0:R.params)||void 0===n?void 0:n.sql_template)||"",options:{readOnly:!0}})})})]})}),(0,r.jsxs)(o.xu,{style:{contain:"size"},flex:"1 1 0%",children:[T&&(0,r.jsx)(RunView,{isPending:A,isAborting:y,run:B,error:F,progress:g,RunResultView:T,viewOptions:null==R?void 0:R.view_options,onViewOptionsChanged:e=>{D({view_options:e})},onCancel:z}),R&&"schema_diff"===R.type&&(0,r.jsx)(SchemaDiffView,{check:R}),R&&"lineage_diff"===R.type&&(0,r.jsx)(LineageDiffView,{check:R})]})]})};function buildMarkdown(e){return(0,nu.Pn)(CheckDetail_templateObject(),buildTitle(e),buildBody(e))}function buildBody(e){return"query"===e.type||"query_diff"===e.type?"".concat(buildDescription(e),"\n\n").concat(buildQuery(e)):buildDescription(e)}var nx=t(79648),nf=t(38505);let ChecklistItem=e=>{let{check:n,selected:t,onSelect:i}=e,l=(0,q.NL)(),c=n.check_id,{mutate:d}=(0,eO.D)({mutationFn:e=>updateCheck(c,e),onSuccess:()=>{l.invalidateQueries({queryKey:J.check(c)}),l.invalidateQueries({queryKey:J.checks()})}}),u=(e=>{switch(e){case"schema_diff":return e2.uhn;case"query":case"query_diff":return e2.r2i;case"value_diff":return e2.pRi;case"profile_diff":return e2.KA6;case"row_count_diff":return V.SwK;case"lineage_diff":return e2.Ks7;case"top_k_diff":return nx.Pkc;case"histogram_diff":return e2.dku;default:return e2.WzH}})(n.type);return(0,r.jsxs)(a.k,{width:"100%",p:"10px 20px",cursor:"pointer",_hover:{bg:"gray.200"},bg:t?"gray.100":"inherit",onClick:()=>i(n.check_id),alignItems:"center",gap:"5px",children:[(0,r.jsx)(s.J,{as:u}),(0,r.jsx)(o.xu,{flex:"1",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",children:n.name}),n.is_checked&&(0,r.jsx)(s.J,{color:"green",as:I.FJM})]})},CheckList=e=>{let{checks:n,selectedItem:t,onCheckSelected:i,onChecksReordered:o}=e;return(0,r.jsx)(nf.Z5,{onDragEnd:e=>{e.destination&&o(e.source.index,e.destination.index)},children:(0,r.jsx)(nf.bK,{droppableId:"checklist",children:e=>(0,r.jsxs)(h.g,{...e.droppableProps,ref:e.innerRef,w:"full",spacing:"0",flex:"1",children:[n.map((e,n)=>(0,r.jsx)(nf._l,{draggableId:e.check_id,index:n,children:n=>(0,r.jsx)(a.k,{ref:n.innerRef,...n.draggableProps,...n.dragHandleProps,w:"full",children:(0,r.jsx)(ChecklistItem,{check:e,selected:e.check_id===t,onSelect:i},e.check_id)})},e.check_id)),e.placeholder]})})})};function CheckPage_templateObject(){let e=(0,e8._)(["\n
","\n\n ","\n\n
"]);return CheckPage_templateObject=function(){return e},e}let CheckPage=()=>{let[,e]=(0,eS.TH)(),[,n]=(0,eS.yj)("/checks/:checkId"),t=(0,q.NL)(),{successToast:i,failToast:s}=useClipBoardToast(),c=null==n?void 0:n.checkId,{isLoading:d,error:f,data:g,status:p}=(0,$.a)({queryKey:J.checks(),queryFn:listChecks,refetchOnMount:!0}),y=(0,w.useCallback)(n=>{e("/checks/".concat(n))},[e]),[v,j]=(0,w.useState)(g||[]),{mutate:C}=(0,eO.D)({mutationFn:e=>reorderChecks(e),onSuccess:()=>{t.invalidateQueries({queryKey:J.checks()})}}),b=(0,w.useCallback)((e,n)=>{let t=[...v],[r]=t.splice(e,1);t.splice(n,0,r),C({source:e,destination:n}),j(t)},[v,j,C]),k=(0,w.useCallback)(async()=>{let e=await createSimpleCheck();t.invalidateQueries({queryKey:J.checks()}),y(e.check_id)},[t,y]);return((0,w.useEffect)(()=>{"success"===p&&(!c&&g.length>0&&e("/checks/".concat(g[0].check_id)),j(g))},[p,c,g,j,e]),d)?(0,r.jsx)(r.Fragment,{children:"Loading"}):f?(0,r.jsxs)(r.Fragment,{children:["Error: ",f.message]}):(null==g?void 0:g.length)?(0,r.jsxs)(a.k,{height:"100%",children:[(0,r.jsx)(o.xu,{flex:"0 0 400px",borderRight:"lightgray solid 1px",height:"100%",style:{contain:"size"},children:(0,r.jsxs)(h.g,{spacing:0,align:"flex-end",h:"100%",children:[(0,r.jsxs)(x.U,{children:[(0,r.jsx)(l.u,{label:"Create a simple check",children:(0,r.jsx)(P.h,{variant:"unstyled","aria-label":"Create a simple check",onClick:k,icon:(0,r.jsx)(eP.d,{})})}),(0,r.jsx)(l.u,{label:"Copy checklist to the clipboard",children:(0,r.jsx)(P.h,{variant:"unstyled","aria-label":"Copy checklist to the clipboard",mr:"10px",onClick:async()=>{let e=CheckPage_buildMarkdown(g);if(!navigator.clipboard){s("Failed to copy checklist to clipboard",Error("Copy to clipboard is available only in secure contexts (HTTPS)"));return}try{await navigator.clipboard.writeText(e),i("Copied ".concat(g.length," checks to the clipboard"))}catch(e){s("Failed to copy checklist to clipboard",e)}},icon:(0,r.jsx)(ef.T,{})})})]}),(0,r.jsx)(eV.i,{mb:"8px"}),(0,r.jsx)(CheckList,{checks:v,selectedItem:c,onCheckSelected:y,onChecksReordered:b})]})}),(0,r.jsx)(o.xu,{flex:"1",height:"100%",width:"calc(100% - 400px)",children:(0,r.jsx)(eS.rs,{children:(0,r.jsx)(eS.AW,{path:"/checks/:checkId",children:e=>(0,r.jsx)(CheckDetail,{checkId:e.checkId},e.checkId)})})})]}):(0,r.jsx)(u.M,{h:"100%",children:(0,r.jsxs)(h.g,{children:[(0,r.jsx)(o.xu,{children:"No checks"}),(0,r.jsx)(m.z,{colorScheme:"blue",onClick:k,children:"Create a simple check"})]})})};function CheckPage_buildMarkdown(e){let n=e.map(e=>(0,nu.Pn)(CheckPage_templateObject(),buildTitle(e),buildDescription(e)));return n.join("\n\n")}async function submitQuery(e,n){return await submitRun("query",e,n)}async function submitQueryDiff(e,n){return await submitRun("query_diff",e,n)}let QueryPage=()=>{let{sqlQuery:e,setSqlQuery:n}=useRecceQueryContext(),[t,i]=(0,w.useState)(),[l,s]=(0,w.useState)(),[c,d]=(0,w.useState)({}),u=(0,q.NL)(),[,h]=(0,eS.TH)(),queryFn=async n=>{i(n);let{run_id:t}="query"===n?await submitQuery({sql_template:e},{nowait:!0}):await submitQueryDiff({sql_template:e},{nowait:!0});return s(t),await waitRun(t)},{data:x,mutate:f,error:g,isPending:p}=(0,eO.D)({mutationFn:queryFn,onSuccess:e=>{d({})}}),y=(0,w.useCallback)(async()=>{if(l)return await cancelRun(l)},[l]),v=(0,w.useCallback)(async e=>{if(!(null==e?void 0:e.run_id))return;let n=await createCheckByRun(e.run_id,c);u.invalidateQueries({queryKey:J.checks()}),h("/checks/".concat(n.check_id))},[h,c,u]);return!p&&(null==x?void 0:x.run_id)&&(null==x||x.error),(0,r.jsxs)(a.k,{direction:"column",height:"100%",children:[(0,r.jsxs)(a.k,{justifyContent:"right",padding:"5px",gap:"5px",children:[(0,r.jsx)(m.z,{colorScheme:"blue",onClick:()=>f("query_diff"),isDisabled:p,size:"sm",children:"Run Diff"}),(0,r.jsx)(m.z,{colorScheme:"blue",onClick:()=>f("query"),isDisabled:p,size:"sm",children:"Run"})]}),(0,r.jsx)(o.xu,{flex:"1",border:"1px solid #CBD5E0",height:"200px",width:"100%",children:(0,r.jsx)(query_SqlEditor,{value:e,onChange:n,onRun:()=>f("query"),onRunDiff:()=>f("query_diff")})}),(0,r.jsx)(a.k,{height:"50vh",direction:"column",children:"query"===t?(0,r.jsx)(RunView,{run:x,error:g,isPending:p,onCancel:y,children:e=>(0,r.jsx)(QueryResultView,{...e,onAddToChecklist:v})},l):(0,r.jsx)(RunView,{isPending:p,run:x,error:g,viewOptions:c,onViewOptionsChanged:d,onCancel:y,children:e=>(0,r.jsx)(QueryDiffResultView,{...e,onAddToChecklist:v})},l)})]})};var ng=t(72952);let hashNavigate=e=>(0,ng.c4)("#!"+e),useHashLocation=()=>{let e=(0,ng.LD)(()=>window.location.hash.replace(/^#!/,"")||"/",()=>"/ssr");return[e,hashNavigate]};var np=t(82017),ny=t(41546),nv=t(85036),nj=t(12218);function getCookie(e){var n=document.cookie.match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)");return n?n.pop():""}function TopBar(){let{metadata:e}=useLineageGraphsContext(),n=null==e?void 0:e.pr_url;return n&&null!==n?(0,r.jsxs)(a.k,{gap:"5px",minHeight:"35px",alignItems:"center",justifyContent:"center",bg:"orange.300",children:[(0,r.jsx)(nv.s,{color:"orange.600"}),(0,r.jsxs)(f.x,{children:["Please check"," ",(0,r.jsx)(eB.r,{textDecoration:"underline",fontWeight:"600",href:n,isExternal:!0,children:"this Pull Request"})," ","comment for context about this Recce instance"]})]}):(0,r.jsx)(r.Fragment,{})}function NavBar(){let[e,n]=(0,eS.TH)(),t=useVersionNumber(),i=[["Lineage","/lineage"],["Query","/query"],["Checklist","/checks"]],l=eM().findIndex(i,n=>{let[,t]=n;return e.startsWith(t)});return(0,r.jsx)(el.m,{index:l,children:(0,r.jsxs)(ea.t,{children:[i.map(e=>{let[t,i]=e;return(0,r.jsx)(es.O,{onClick:()=>{n(i)},children:t},t)}),(0,r.jsx)(o.xu,{position:"absolute",right:"0",top:"0",p:"2",color:"gray.500",children:t})]})})}function Home(){(0,w.useLayoutEffect)(()=>{let e=getCookie("recce_user_id");if(e&&nj.env.AMPLITUDE_API_KEY)try{e9.S1(nj.env.AMPLITUDE_API_KEY,e,{defaultTracking:!0})}catch(e){console.error(e)}},[]);let e=(0,np.Z)({components:{MuiTooltip:{styleOverrides:{tooltip:{zIndex:1500}}}}});return(0,r.jsx)(ny.Z,{theme:e,children:(0,r.jsx)(e6.x,{children:(0,r.jsx)(q.aH,{client:Q,children:(0,r.jsx)(eS.F0,{hook:useHashLocation,children:(0,r.jsx)(RecceContextProvider,{children:(0,r.jsxs)(a.k,{direction:"column",height:"100vh",children:[(0,r.jsx)(TopBar,{}),(0,r.jsx)(NavBar,{}),(0,r.jsx)(o.xu,{p:0,overflow:"auto",flex:"1",style:{contain:"size"},children:(0,r.jsxs)(eS.rs,{children:[(0,r.jsx)(eS.AW,{path:"/lineage",children:(0,r.jsx)(LineageView,{})}),(0,r.jsx)(eS.AW,{path:"/query",children:(0,r.jsx)(QueryPage,{})}),(0,r.jsx)(eS.AW,{path:"/checks/:slug*",children:(0,r.jsx)(CheckPage,{})}),(0,r.jsx)(eS.AW,{path:"/ssr",children:(0,r.jsx)(r.Fragment,{children:"Loading"})}),(0,r.jsx)(eS.AW,{children:(0,r.jsx)(eS.l_,{to:"/lineage"})})]})})]})})})})})})}},88727:function(){},7866:function(){},75165:function(){}},function(e){e.O(0,[634,145,170,521,462,531,498,182,710,971,495,599,512,880,297,62,744],function(){return e(e.s=99178)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/recce/data/_next/static/4wAgE6FzB1dt7u73qW9qb/_buildManifest.js b/recce/data/_next/static/p7PO8kCLIzsLWm8-VEylH/_buildManifest.js similarity index 100% rename from recce/data/_next/static/4wAgE6FzB1dt7u73qW9qb/_buildManifest.js rename to recce/data/_next/static/p7PO8kCLIzsLWm8-VEylH/_buildManifest.js diff --git a/recce/data/_next/static/4wAgE6FzB1dt7u73qW9qb/_ssgManifest.js b/recce/data/_next/static/p7PO8kCLIzsLWm8-VEylH/_ssgManifest.js similarity index 100% rename from recce/data/_next/static/4wAgE6FzB1dt7u73qW9qb/_ssgManifest.js rename to recce/data/_next/static/p7PO8kCLIzsLWm8-VEylH/_ssgManifest.js diff --git a/recce/data/index.html b/recce/data/index.html index ca5451a5..4e270345 100644 --- a/recce/data/index.html +++ b/recce/data/index.html @@ -1,4 +1,4 @@ -recce
Loading
\ No newline at end of file + ){outline:none;box-shadow:none;}select::-ms-expand{display:none;}:root,:host{--chakra-vh:100vh;}@supports (height: -webkit-fill-available){:root,:host{--chakra-vh:-webkit-fill-available;}}@supports (height: -moz-fill-available){:root,:host{--chakra-vh:-moz-fill-available;}}@supports (height: 100dvh){:root,:host{--chakra-vh:100dvh;}}
Loading
\ No newline at end of file diff --git a/recce/data/index.txt b/recce/data/index.txt index 94685973..ef8be7e9 100644 --- a/recce/data/index.txt +++ b/recce/data/index.txt @@ -1,9 +1,9 @@ -0:["4wAgE6FzB1dt7u73qW9qb",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L1",[null,"$L2"]]]] +0:["p7PO8kCLIzsLWm8-VEylH",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L1",[null,"$L2"]]]] 3:HL["/_next/static/css/6d0611c21a82d0bb.css","style",{"crossOrigin":""}] 4:I[44813,[],""] 5:I[82593,[],""] 7:I[32658,[],""] -8:I[25459,["634","static/chunks/7c9ab469-5d619c5876a32d36.js","145","static/chunks/fb2d5402-0c0828ea6e615a3b.js","170","static/chunks/526a6206-7ccbd30e159c1652.js","521","static/chunks/607285b2-06d9683b5002e6fd.js","462","static/chunks/f6be744d-5973a409ea097354.js","531","static/chunks/f78b7092-bf8a8853eef36a4c.js","182","static/chunks/5e9a126f-da62af62011c0643.js","710","static/chunks/2d02f0f7-ed3b4e4daa7c5d22.js","971","static/chunks/49348413-7aacf235ca16afb9.js","495","static/chunks/6dc81886-a3fa8efdc3652e8f.js","599","static/chunks/c132bf7d-fca1bc3c8aa231eb.js","512","static/chunks/4b89641d-019428e080b47700.js","880","static/chunks/880-6a8f9af22d85a0db.js","931","static/chunks/app/page-74c7caf13135bebe.js"],""] +8:I[31398,["634","static/chunks/7c9ab469-732af37965d79ccf.js","145","static/chunks/fb2d5402-0c0828ea6e615a3b.js","170","static/chunks/526a6206-7ccbd30e159c1652.js","521","static/chunks/607285b2-dadd48144d45dbcf.js","462","static/chunks/f6be744d-5973a409ea097354.js","531","static/chunks/f78b7092-bf8a8853eef36a4c.js","498","static/chunks/6af6e714-6003aba9c53d2dcd.js","182","static/chunks/5e9a126f-da62af62011c0643.js","710","static/chunks/2d02f0f7-ed3b4e4daa7c5d22.js","971","static/chunks/49348413-7aacf235ca16afb9.js","495","static/chunks/6dc81886-a3fa8efdc3652e8f.js","599","static/chunks/c132bf7d-fca1bc3c8aa231eb.js","512","static/chunks/4b89641d-019428e080b47700.js","880","static/chunks/880-97510f708b3c5314.js","931","static/chunks/app/page-83c844933e28ea4c.js"],""] 1:[null,["$","html",null,{"lang":"en","children":["$","body",null,{"suppressHydrationWarning":true,"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","loadingScripts":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"childProp":{"current":["$L6",["$","$L7",null,{"propsForComponent":{"params":{}},"Component":"$8","isStaticGeneration":true}],null],"segment":"__PAGE__"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/6d0611c21a82d0bb.css","precedence":"next","crossOrigin":""}]]}]}]}],null] 2:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"recce"}],["$","meta","3",{"name":"description","content":"Recce: a dbt tool"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]] 6:null